jComponent / 02. Library
Updated: 09. September 2020
Author: Peter Širka

02. Library

Professional Support Chat with contributors

Properties


Property: MAIN.components

readonly Gets all instances of components.

MAIN.components;
// returns {Array Object}

Property: MAIN.defaults

Gets default settings. With this property you can change behaviour of jComponent library.

MAIN.defaults;
// returns {Object}

DEF;
// returns {Object}
// Is an alias for MAIN.defaults

DEF.ajaxerrors = false;
// {Boolean} AJAX() method won't create an exception if HTTP status code will be >= 400

DEF.ajaxcredentials = false;
// {Boolean} +v18 enables cookies for CORS (default: false)

DEF.baseurl = '';
// This property affects a relative URL address in AJAX requests
// {String} If it contains "string" then the string is combined with URL: "url = baseurl + url"
// {Function(url)} If it contains "function" then the function needs to return a new url
// +v13.0.5

DEF.makerurl = function(url) {
   return url;
};
// This delegate can affect URL before is request created.
// It must return updated URL!!!
// +v14.3.1

DEF.dateformat = null;
// {String} A default date format
// It's used when "new Date().format(null)" contains "null" value

DEF.decimalseparator = '.';
// Default decimal separator

DEF.delay = 300;
// {Number} A delay for real-time keypress binding

DEF.delaybinder = 200;
// {Number} A default delay for binding of value for non-released component
// +v13.0.0

DEF.delaywatcher = 555;
// {Number} A delay for component watcher (component.width(), component.heigth(), etc.)
// +v13.0.0

DEF.devices = { xs: { max: 768 }, sm: { min: 768, max: 992 }, md: { min: 992, max: 1200 }, lg: { min: 1200 }};
// {Object} Custom display sizes for Responsive UI

DEF.fallback = 'https://cdn.componentator.com/j-{0}.html';
// {String} A fallback URL for non-exist components
// Import "fallback" will be disabled if the "fallback" will be empty
// +v14.0.0

DEF.fallbackcache = '5 minutes';
// {String} Fallback cache, empty value disables caching
// Default: empty
// +v14.0.0

DEF.headers = { 'X-Requested-With': 'XMLHttpRequest' };
// {Object} Custom AJAX() headers
// IMPORATNT: +v13.0.0 X-Requested-With is removed for CORS request

DEF.jsoncompress = false;
// {Boolean} Compresses JSON values (removes empty strings and null values from JSON)

DEF.jsondate = true;
// {Boolean} Converts date values in JSON automatically to Date object

DEF.keypress = true;
// {Boolean} Can disable real-time keypress binding

DEF.localstorage = true;
// {Boolean} Can disable localstorage

DEF.pingdata = {};
// {Object} Can contain GET params for PING method

DEF.thousandsseparator = ' ';
// {String} Default thousands separator

DEF.version = '1';
// {String} A default version for all jComponents
// Default: empty
// +v14.0.0

DEF.currencies;
// {Object}
// This object uses "Number.currency" method
// +v17

// Example:
DEF.currencies.eur = DEF.currencies.EUR = function(val) {
    return val.format(2) + ' €';
};

DEF.currency;
// {String}
// Can contain a default currency
// +v17

DEF.scrollbaranimate = true;
// {Boolean}
// Can disable CustomScrollbar animations (default: true)
// +v17

DEF.empty = '---';
// {String}
// Contains an empty string for "Thelpers.def" and "data-bind=...def" command.
// +v17

DEF.languagekey = 'language';
// {String}
// QueryString argument name for language
// +v18

DEF.language = 'sk';
// {String}
// Appends a value to each AJAX() request to "languagekey" param
// +v18

DEF.languagehtml = 'sk';
// {String}
// Appends a value to each AJAX() request for .html files only
// +v18

DEF.versionkey = 'version';
// {String}
// QueryString argument name for version
// +v18

DEF.version = '1';
// {String}
// Appends a value to each AJAX() request to "versionkey" param
// +v18

DEF.versionhtml = '1';
// {String}
// Appends a value to each AJAX() request for .html files only
// +v18

DEF.versioncomponents = '';
// {String}
// Explicity sets a new version to all components
// +v18

DEF.localstorage = 'jc';
// {String}
// Returns a localStorage key for jComponent. You can change this key by your needs.
// +v18

DEF.repeatfocus = true;
// {Boolean}
// Enables (default: true) focus condition in REPEAT() method
// +v18

DEF.secret(key);
// @key {String}
// Sets secret for data encryption (can be executed only onetime)
// +v18

Property: MAIN.validators

Contains RegExp validators.

MAIN.validators;
// returns {Object}

MAIN.validators.url;
// RegExp for URL addresses

MAIN.validators.email;
// RegExp for email addresses

MAIN.validators.phone;
// RegExp for phone numbers

Property: MAIN.loaded

readonly Determines whether is jComponent loaded (cache + document is ready).

MAIN.loaded;
// returns {Boolean}

Property: MAIN.version

readonly Returns the current build version of jComponent.

MAIN.version;
// returns {Number}

// For example:
// 16.027

Property: MAIN.ua

+v18 Returns parsed user-agent.

MAIN.ua;
// returns {Object}

// Example:
// console.log(MAIN.ua);
// Output: { os: 'Mac', browser: 'Opera', device: 'desktop' }

Property: MAIN.$components

readonly Gets all registered components, only types without instances.

MAIN.$components;
// returns {Object}

Property: MAIN.$language

Affects all AJAX() requests, it appends GET argument ?language=$language automatically to the URL address. IMPORTANT removed in v18, alternative DEF.language or DEF.languagehtml.

MAIN.$language = '';
// returns {String}

Property: MAIN.$localstorage

Returns a localStorage key for jComponent. You can change this key by your needs. IMPORTANT removed in v18, alternative DEF.localstorage.

MAIN.$localstorage = 'jc';
// returns {String}

Property: MAIN.$version

Affects all AJAX() requests, it appends GET argument ?version=$version automatically to the URL address. IMPORTANT removed in v18, alternative DEF.version or DEF.versionhtml.

MAIN.$version = '';
// returns {String}