UNPKG

oda-framework

Version:

It's an ES Progressive Framework based on the technology of Web Components and designed especially for creating custom UI/UX of any complexity for web and cross-platform PWA mobile applications.

1,467 lines (1,276 loc) 457 kB
;(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.jSuites = factory(); }(this, (function () { var jSuites; /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 195: /***/ (function(module) { /** * (c) jSuites Javascript Plugins and Web Components (v4) * * Website: https://jsuites.net * Description: Create amazing web based applications. * Plugin: Organogram * * MIT License */ ;(function (global, factory) { true ? module.exports = factory() : 0; }(this, (function () { return (function(str) { function int64(msint_32, lsint_32) { this.highOrder = msint_32; this.lowOrder = lsint_32; } var H = [new int64(0x6a09e667, 0xf3bcc908), new int64(0xbb67ae85, 0x84caa73b), new int64(0x3c6ef372, 0xfe94f82b), new int64(0xa54ff53a, 0x5f1d36f1), new int64(0x510e527f, 0xade682d1), new int64(0x9b05688c, 0x2b3e6c1f), new int64(0x1f83d9ab, 0xfb41bd6b), new int64(0x5be0cd19, 0x137e2179)]; var K = [new int64(0x428a2f98, 0xd728ae22), new int64(0x71374491, 0x23ef65cd), new int64(0xb5c0fbcf, 0xec4d3b2f), new int64(0xe9b5dba5, 0x8189dbbc), new int64(0x3956c25b, 0xf348b538), new int64(0x59f111f1, 0xb605d019), new int64(0x923f82a4, 0xaf194f9b), new int64(0xab1c5ed5, 0xda6d8118), new int64(0xd807aa98, 0xa3030242), new int64(0x12835b01, 0x45706fbe), new int64(0x243185be, 0x4ee4b28c), new int64(0x550c7dc3, 0xd5ffb4e2), new int64(0x72be5d74, 0xf27b896f), new int64(0x80deb1fe, 0x3b1696b1), new int64(0x9bdc06a7, 0x25c71235), new int64(0xc19bf174, 0xcf692694), new int64(0xe49b69c1, 0x9ef14ad2), new int64(0xefbe4786, 0x384f25e3), new int64(0x0fc19dc6, 0x8b8cd5b5), new int64(0x240ca1cc, 0x77ac9c65), new int64(0x2de92c6f, 0x592b0275), new int64(0x4a7484aa, 0x6ea6e483), new int64(0x5cb0a9dc, 0xbd41fbd4), new int64(0x76f988da, 0x831153b5), new int64(0x983e5152, 0xee66dfab), new int64(0xa831c66d, 0x2db43210), new int64(0xb00327c8, 0x98fb213f), new int64(0xbf597fc7, 0xbeef0ee4), new int64(0xc6e00bf3, 0x3da88fc2), new int64(0xd5a79147, 0x930aa725), new int64(0x06ca6351, 0xe003826f), new int64(0x14292967, 0x0a0e6e70), new int64(0x27b70a85, 0x46d22ffc), new int64(0x2e1b2138, 0x5c26c926), new int64(0x4d2c6dfc, 0x5ac42aed), new int64(0x53380d13, 0x9d95b3df), new int64(0x650a7354, 0x8baf63de), new int64(0x766a0abb, 0x3c77b2a8), new int64(0x81c2c92e, 0x47edaee6), new int64(0x92722c85, 0x1482353b), new int64(0xa2bfe8a1, 0x4cf10364), new int64(0xa81a664b, 0xbc423001), new int64(0xc24b8b70, 0xd0f89791), new int64(0xc76c51a3, 0x0654be30), new int64(0xd192e819, 0xd6ef5218), new int64(0xd6990624, 0x5565a910), new int64(0xf40e3585, 0x5771202a), new int64(0x106aa070, 0x32bbd1b8), new int64(0x19a4c116, 0xb8d2d0c8), new int64(0x1e376c08, 0x5141ab53), new int64(0x2748774c, 0xdf8eeb99), new int64(0x34b0bcb5, 0xe19b48a8), new int64(0x391c0cb3, 0xc5c95a63), new int64(0x4ed8aa4a, 0xe3418acb), new int64(0x5b9cca4f, 0x7763e373), new int64(0x682e6ff3, 0xd6b2b8a3), new int64(0x748f82ee, 0x5defb2fc), new int64(0x78a5636f, 0x43172f60), new int64(0x84c87814, 0xa1f0ab72), new int64(0x8cc70208, 0x1a6439ec), new int64(0x90befffa, 0x23631e28), new int64(0xa4506ceb, 0xde82bde9), new int64(0xbef9a3f7, 0xb2c67915), new int64(0xc67178f2, 0xe372532b), new int64(0xca273ece, 0xea26619c), new int64(0xd186b8c7, 0x21c0c207), new int64(0xeada7dd6, 0xcde0eb1e), new int64(0xf57d4f7f, 0xee6ed178), new int64(0x06f067aa, 0x72176fba), new int64(0x0a637dc5, 0xa2c898a6), new int64(0x113f9804, 0xbef90dae), new int64(0x1b710b35, 0x131c471b), new int64(0x28db77f5, 0x23047d84), new int64(0x32caab7b, 0x40c72493), new int64(0x3c9ebe0a, 0x15c9bebc), new int64(0x431d67c4, 0x9c100d4c), new int64(0x4cc5d4be, 0xcb3e42b6), new int64(0x597f299c, 0xfc657e2a), new int64(0x5fcb6fab, 0x3ad6faec), new int64(0x6c44198c, 0x4a475817)]; var W = new Array(64); var a, b, c, d, e, f, g, h, i, j; var T1, T2; var charsize = 8; function utf8_encode(str) { return unescape(encodeURIComponent(str)); } function str2binb(str) { var bin = []; var mask = (1 << charsize) - 1; var len = str.length * charsize; for (var i = 0; i < len; i += charsize) { bin[i >> 5] |= (str.charCodeAt(i / charsize) & mask) << (32 - charsize - (i % 32)); } return bin; } function binb2hex(binarray) { var hex_tab = "0123456789abcdef"; var str = ""; var length = binarray.length * 4; var srcByte; for (var i = 0; i < length; i += 1) { srcByte = binarray[i >> 2] >> ((3 - (i % 4)) * 8); str += hex_tab.charAt((srcByte >> 4) & 0xF) + hex_tab.charAt(srcByte & 0xF); } return str; } function safe_add_2(x, y) { var lsw, msw, lowOrder, highOrder; lsw = (x.lowOrder & 0xFFFF) + (y.lowOrder & 0xFFFF); msw = (x.lowOrder >>> 16) + (y.lowOrder >>> 16) + (lsw >>> 16); lowOrder = ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); lsw = (x.highOrder & 0xFFFF) + (y.highOrder & 0xFFFF) + (msw >>> 16); msw = (x.highOrder >>> 16) + (y.highOrder >>> 16) + (lsw >>> 16); highOrder = ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); return new int64(highOrder, lowOrder); } function safe_add_4(a, b, c, d) { var lsw, msw, lowOrder, highOrder; lsw = (a.lowOrder & 0xFFFF) + (b.lowOrder & 0xFFFF) + (c.lowOrder & 0xFFFF) + (d.lowOrder & 0xFFFF); msw = (a.lowOrder >>> 16) + (b.lowOrder >>> 16) + (c.lowOrder >>> 16) + (d.lowOrder >>> 16) + (lsw >>> 16); lowOrder = ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); lsw = (a.highOrder & 0xFFFF) + (b.highOrder & 0xFFFF) + (c.highOrder & 0xFFFF) + (d.highOrder & 0xFFFF) + (msw >>> 16); msw = (a.highOrder >>> 16) + (b.highOrder >>> 16) + (c.highOrder >>> 16) + (d.highOrder >>> 16) + (lsw >>> 16); highOrder = ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); return new int64(highOrder, lowOrder); } function safe_add_5(a, b, c, d, e) { var lsw, msw, lowOrder, highOrder; lsw = (a.lowOrder & 0xFFFF) + (b.lowOrder & 0xFFFF) + (c.lowOrder & 0xFFFF) + (d.lowOrder & 0xFFFF) + (e.lowOrder & 0xFFFF); msw = (a.lowOrder >>> 16) + (b.lowOrder >>> 16) + (c.lowOrder >>> 16) + (d.lowOrder >>> 16) + (e.lowOrder >>> 16) + (lsw >>> 16); lowOrder = ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); lsw = (a.highOrder & 0xFFFF) + (b.highOrder & 0xFFFF) + (c.highOrder & 0xFFFF) + (d.highOrder & 0xFFFF) + (e.highOrder & 0xFFFF) + (msw >>> 16); msw = (a.highOrder >>> 16) + (b.highOrder >>> 16) + (c.highOrder >>> 16) + (d.highOrder >>> 16) + (e.highOrder >>> 16) + (lsw >>> 16); highOrder = ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); return new int64(highOrder, lowOrder); } function maj(x, y, z) { return new int64( (x.highOrder & y.highOrder) ^ (x.highOrder & z.highOrder) ^ (y.highOrder & z.highOrder), (x.lowOrder & y.lowOrder) ^ (x.lowOrder & z.lowOrder) ^ (y.lowOrder & z.lowOrder) ); } function ch(x, y, z) { return new int64( (x.highOrder & y.highOrder) ^ (~x.highOrder & z.highOrder), (x.lowOrder & y.lowOrder) ^ (~x.lowOrder & z.lowOrder) ); } function rotr(x, n) { if (n <= 32) { return new int64( (x.highOrder >>> n) | (x.lowOrder << (32 - n)), (x.lowOrder >>> n) | (x.highOrder << (32 - n)) ); } else { return new int64( (x.lowOrder >>> n) | (x.highOrder << (32 - n)), (x.highOrder >>> n) | (x.lowOrder << (32 - n)) ); } } function sigma0(x) { var rotr28 = rotr(x, 28); var rotr34 = rotr(x, 34); var rotr39 = rotr(x, 39); return new int64( rotr28.highOrder ^ rotr34.highOrder ^ rotr39.highOrder, rotr28.lowOrder ^ rotr34.lowOrder ^ rotr39.lowOrder ); } function sigma1(x) { var rotr14 = rotr(x, 14); var rotr18 = rotr(x, 18); var rotr41 = rotr(x, 41); return new int64( rotr14.highOrder ^ rotr18.highOrder ^ rotr41.highOrder, rotr14.lowOrder ^ rotr18.lowOrder ^ rotr41.lowOrder ); } function gamma0(x) { var rotr1 = rotr(x, 1), rotr8 = rotr(x, 8), shr7 = shr(x, 7); return new int64( rotr1.highOrder ^ rotr8.highOrder ^ shr7.highOrder, rotr1.lowOrder ^ rotr8.lowOrder ^ shr7.lowOrder ); } function gamma1(x) { var rotr19 = rotr(x, 19); var rotr61 = rotr(x, 61); var shr6 = shr(x, 6); return new int64( rotr19.highOrder ^ rotr61.highOrder ^ shr6.highOrder, rotr19.lowOrder ^ rotr61.lowOrder ^ shr6.lowOrder ); } function shr(x, n) { if (n <= 32) { return new int64( x.highOrder >>> n, x.lowOrder >>> n | (x.highOrder << (32 - n)) ); } else { return new int64( 0, x.highOrder << (32 - n) ); } } var str = utf8_encode(str); var strlen = str.length*charsize; str = str2binb(str); str[strlen >> 5] |= 0x80 << (24 - strlen % 32); str[(((strlen + 128) >> 10) << 5) + 31] = strlen; for (var i = 0; i < str.length; i += 32) { a = H[0]; b = H[1]; c = H[2]; d = H[3]; e = H[4]; f = H[5]; g = H[6]; h = H[7]; for (var j = 0; j < 80; j++) { if (j < 16) { W[j] = new int64(str[j*2 + i], str[j*2 + i + 1]); } else { W[j] = safe_add_4(gamma1(W[j - 2]), W[j - 7], gamma0(W[j - 15]), W[j - 16]); } T1 = safe_add_5(h, sigma1(e), ch(e, f, g), K[j], W[j]); T2 = safe_add_2(sigma0(a), maj(a, b, c)); h = g; g = f; f = e; e = safe_add_2(d, T1); d = c; c = b; b = a; a = safe_add_2(T1, T2); } H[0] = safe_add_2(a, H[0]); H[1] = safe_add_2(b, H[1]); H[2] = safe_add_2(c, H[2]); H[3] = safe_add_2(d, H[3]); H[4] = safe_add_2(e, H[4]); H[5] = safe_add_2(f, H[5]); H[6] = safe_add_2(g, H[6]); H[7] = safe_add_2(h, H[7]); } var binarray = []; for (var i = 0; i < H.length; i++) { binarray.push(H[i].highOrder); binarray.push(H[i].lowOrder); } return binb2hex(binarray); }); }))); /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ !function() { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function() { return module['default']; } : /******/ function() { return module; }; /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ }(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ !function() { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = function(exports, definition) { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ }(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ !function() { /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } /******/ }(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be in strict mode. !function() { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": function() { return /* binding */ jsuites; } }); ;// CONCATENATED MODULE: ./src/utils/dictionary.js // Update dictionary var setDictionary = function(d) { if (! document.dictionary) { document.dictionary = {} } // Replace the key into the dictionary and append the new ones var t = null; var i = null; var k = Object.keys(d); for (i = 0; i < k.length; i++) { document.dictionary[k[i]] = d[k[i]]; } } // Translate var translate = function(t) { if (typeof(document) !== "undefined" && document.dictionary) { return document.dictionary[t] || t; } else { return t; } } /* harmony default export */ var dictionary = ({ setDictionary, translate }); ;// CONCATENATED MODULE: ./src/utils/tracking.js const Tracking = function(component, state) { if (state === true) { window['jSuitesStateControl'] = window['jSuitesStateControl'].filter(function(v) { return v !== null; }); // Start after all events setTimeout(function() { window['jSuitesStateControl'].push(component); }, 0); } else { var index = window['jSuitesStateControl'].indexOf(component); if (index >= 0) { window['jSuitesStateControl'].splice(index, 1); } } } /* harmony default export */ var tracking = (Tracking); ;// CONCATENATED MODULE: ./src/utils/helpers.js var Helpers = {}; // Two digits Helpers.two = function(value) { value = '' + value; if (value.length == 1) { value = '0' + value; } return value; } Helpers.focus = function(el) { if (el.innerText.length) { var range = document.createRange(); var sel = window.getSelection(); var node = el.childNodes[el.childNodes.length-1]; range.setStart(node, node.length) range.collapse(true) sel.removeAllRanges() sel.addRange(range) el.scrollLeft = el.scrollWidth; } } Helpers.isNumeric = (function (num) { if (typeof(num) === 'string') { num = num.trim(); } return !isNaN(num) && num !== null && num !== ''; }); Helpers.guid = function() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); } Helpers.getNode = function() { var node = document.getSelection().anchorNode; if (node) { return (node.nodeType == 3 ? node.parentNode : node); } else { return null; } } /** * Generate hash from a string */ Helpers.hash = function(str) { var hash = 0, i, chr; if (str.length === 0) { return hash; } else { for (i = 0; i < str.length; i++) { chr = str.charCodeAt(i); if (chr > 32) { hash = ((hash << 5) - hash) + chr; hash |= 0; } } } return hash; } /** * Generate a random color */ Helpers.randomColor = function(h) { var lum = -0.25; var hex = String('#' + Math.random().toString(16).slice(2, 8).toUpperCase()).replace(/[^0-9a-f]/gi, ''); if (hex.length < 6) { hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; } var rgb = [], c, i; for (i = 0; i < 3; i++) { c = parseInt(hex.substr(i * 2, 2), 16); c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); rgb.push(("00" + c).substr(c.length)); } // Return hex if (h == true) { return '#' + Helpers.two(rgb[0].toString(16)) + Helpers.two(rgb[1].toString(16)) + Helpers.two(rgb[2].toString(16)); } return rgb; } Helpers.getWindowWidth = function() { var w = window, d = document, e = d.documentElement, g = d.getElementsByTagName('body')[0], x = w.innerWidth || e.clientWidth || g.clientWidth; return x; } Helpers.getWindowHeight = function() { var w = window, d = document, e = d.documentElement, g = d.getElementsByTagName('body')[0], y = w.innerHeight|| e.clientHeight|| g.clientHeight; return y; } Helpers.getPosition = function(e) { if (e.changedTouches && e.changedTouches[0]) { var x = e.changedTouches[0].pageX; var y = e.changedTouches[0].pageY; } else { var x = (window.Event) ? e.pageX : e.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); var y = (window.Event) ? e.pageY : e.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); } return [ x, y ]; } Helpers.click = function(el) { if (el.click) { el.click(); } else { var evt = new MouseEvent('click', { bubbles: true, cancelable: true, view: window }); el.dispatchEvent(evt); } } Helpers.findElement = function(element, condition) { var foundElement = false; function path (element) { if (element && ! foundElement) { if (typeof(condition) == 'function') { foundElement = condition(element) } else if (typeof(condition) == 'string') { if (element.classList && element.classList.contains(condition)) { foundElement = element; } } } if (element.parentNode && ! foundElement) { path(element.parentNode); } } path(element); return foundElement; } /* harmony default export */ var helpers = (Helpers); ;// CONCATENATED MODULE: ./src/utils/path.js function Path(str, val, remove) { str = str.split('.'); if (str.length) { let o = this; let p = null; while (str.length > 1) { // Get the property p = str.shift(); // Check if the property exists if (o.hasOwnProperty(p)) { o = o[p]; } else { // Property does not exists if (typeof(val) === 'undefined') { return undefined; } else { // Create the property o[p] = {}; // Next property o = o[p]; } } } // Get the property p = str.shift(); // Set or get the value if (typeof(val) !== 'undefined') { if (remove === true) { delete o[p]; } else { o[p] = val; } // Success return true; } else { // Return the value if (o) { return o[p]; } } } // Something went wrong return false; } ;// CONCATENATED MODULE: ./src/utils/sorting.js function Sorting(el, options) { var obj = {}; obj.options = {}; var defaults = { pointer: null, direction: null, ondragstart: null, ondragend: null, ondrop: null, } var dragElement = null; // Loop through the initial configuration for (var property in defaults) { if (options && options.hasOwnProperty(property)) { obj.options[property] = options[property]; } else { obj.options[property] = defaults[property]; } } el.classList.add('jsorting'); el.addEventListener('dragstart', function(e) { let target = e.target; if (target.nodeType === 3) { if (target.parentNode.getAttribute('draggable') === 'true') { target = target.parentNode; } else { e.preventDefault(); e.stopPropagation(); return; } } if (target.getAttribute('draggable') === 'true') { let position = Array.prototype.indexOf.call(target.parentNode.children, target); dragElement = { element: target, o: position, d: position } target.style.opacity = '0.25'; if (typeof (obj.options.ondragstart) == 'function') { obj.options.ondragstart(el, target, e); } e.dataTransfer.setDragImage(target,0,0); } }); el.addEventListener('dragover', function(e) { e.preventDefault(); if (dragElement) { if (getElement(e.target)) { if (e.target.getAttribute('draggable') == 'true' && dragElement.element != e.target) { if (!obj.options.direction) { var condition = e.target.clientHeight / 2 > e.offsetY; } else { var condition = e.target.clientWidth / 2 > e.offsetX; } if (condition) { e.target.parentNode.insertBefore(dragElement.element, e.target); } else { e.target.parentNode.insertBefore(dragElement.element, e.target.nextSibling); } dragElement.d = Array.prototype.indexOf.call(e.target.parentNode.children, dragElement.element); } } } }); el.addEventListener('dragleave', function(e) { e.preventDefault(); }); el.addEventListener('dragend', function(e) { e.preventDefault(); if (dragElement) { if (typeof(obj.options.ondragend) == 'function') { obj.options.ondragend(el, dragElement.element, e); } // Cancelled put element to the original position if (dragElement.o < dragElement.d) { e.target.parentNode.insertBefore(dragElement.element, e.target.parentNode.children[dragElement.o]); } else { e.target.parentNode.insertBefore(dragElement.element, e.target.parentNode.children[dragElement.o].nextSibling); } dragElement.element.style.opacity = ''; dragElement = null; } }); el.addEventListener('drop', function(e) { e.preventDefault(); if (dragElement) { if (dragElement.o !== dragElement.d) { if (typeof (obj.options.ondrop) == 'function') { obj.options.ondrop(el, dragElement.o, dragElement.d, dragElement.element, e.target, e); } } dragElement.element.style.opacity = ''; dragElement = null; } }); var getElement = function(element) { var sorting = false; function path (element) { if (element.className) { if (element.classList.contains('jsorting')) { sorting = true; } } if (! sorting) { path(element.parentNode); } } path(element); return sorting; } for (var i = 0; i < el.children.length; i++) { if (! el.children[i].hasAttribute('draggable')) { el.children[i].setAttribute('draggable', 'true'); } } el.val = function() { var id = null; var data = []; for (var i = 0; i < el.children.length; i++) { if (id = el.children[i].getAttribute('data-id')) { data.push(id); } } return data; } return el; } ;// CONCATENATED MODULE: ./src/utils/lazyloading.js function LazyLoading(el, options) { var obj = {} // Mandatory options if (! options.loadUp || typeof(options.loadUp) != 'function') { options.loadUp = function() { return false; } } if (! options.loadDown || typeof(options.loadDown) != 'function') { options.loadDown = function() { return false; } } // Timer ms if (! options.timer) { options.timer = 100; } // Timer var timeControlLoading = null; // Controls var scrollControls = function(e) { if (timeControlLoading == null) { var event = false; var scrollTop = el.scrollTop; if (el.scrollTop + (el.clientHeight * 2) >= el.scrollHeight) { if (options.loadDown()) { if (scrollTop == el.scrollTop) { el.scrollTop = el.scrollTop - (el.clientHeight); } event = true; } } else if (el.scrollTop <= el.clientHeight) { if (options.loadUp()) { if (scrollTop == el.scrollTop) { el.scrollTop = el.scrollTop + (el.clientHeight); } event = true; } } timeControlLoading = setTimeout(function() { timeControlLoading = null; }, options.timer); if (event) { if (typeof(options.onupdate) == 'function') { options.onupdate(); } } } } // Onscroll el.onscroll = function(e) { scrollControls(e); } el.onwheel = function(e) { scrollControls(e); } return obj; } ;// CONCATENATED MODULE: ./src/plugins/ajax.js function Ajax() { var Component = (function(options, complete) { if (Array.isArray(options)) { // Create multiple request controller var multiple = { instance: [], complete: complete, } if (options.length > 0) { for (var i = 0; i < options.length; i++) { options[i].multiple = multiple; multiple.instance.push(Component(options[i])); } } return multiple; } if (! options.data) { options.data = {}; } if (options.type) { options.method = options.type; } // Default method if (! options.method) { options.method = 'GET'; } // Default type if (! options.dataType) { options.dataType = 'json'; } if (options.data) { // Parse object to variables format var parseData = function (value, key) { var vars = []; if (value) { var keys = Object.keys(value); if (keys.length) { for (var i = 0; i < keys.length; i++) { if (key) { var k = key + '[' + keys[i] + ']'; } else { var k = keys[i]; } if (value[k] instanceof FileList) { vars[k] = value[keys[i]]; } else if (value[keys[i]] === null || value[keys[i]] === undefined) { vars[k] = ''; } else if (typeof(value[keys[i]]) == 'object') { var r = parseData(value[keys[i]], k); var o = Object.keys(r); for (var j = 0; j < o.length; j++) { vars[o[j]] = r[o[j]]; } } else { vars[k] = value[keys[i]]; } } } } return vars; } var d = parseData(options.data); var k = Object.keys(d); // Data form if (options.method == 'GET') { if (k.length) { var data = []; for (var i = 0; i < k.length; i++) { data.push(k[i] + '=' + encodeURIComponent(d[k[i]])); } if (options.url.indexOf('?') < 0) { options.url += '?'; } options.url += data.join('&'); } } else { var data = new FormData(); for (var i = 0; i < k.length; i++) { if (d[k[i]] instanceof FileList) { if (d[k[i]].length) { for (var j = 0; j < d[k[i]].length; j++) { data.append(k[i], d[k[i]][j], d[k[i]][j].name); } } } else { data.append(k[i], d[k[i]]); } } } } var httpRequest = new XMLHttpRequest(); httpRequest.open(options.method, options.url, true); if (options.requestedWith) { httpRequest.setRequestHeader('X-Requested-With', options.requestedWith); } else { if (options.requestedWith !== false) { httpRequest.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); } } // Content type if (options.contentType) { httpRequest.setRequestHeader('Content-Type', options.contentType); } // Headers if (options.method === 'POST') { httpRequest.setRequestHeader('Accept', 'application/json'); } else { if (options.dataType === 'blob') { httpRequest.responseType = "blob"; } else { if (! options.contentType) { if (options.dataType === 'json') { httpRequest.setRequestHeader('Content-Type', 'text/json'); } else if (options.dataType === 'html') { httpRequest.setRequestHeader('Content-Type', 'text/html'); } } } } // No cache if (options.cache !== true) { httpRequest.setRequestHeader('pragma', 'no-cache'); httpRequest.setRequestHeader('cache-control', 'no-cache'); } // Authentication if (options.withCredentials === true) { httpRequest.withCredentials = true } // Before send if (typeof(options.beforeSend) == 'function') { options.beforeSend(httpRequest); } // Before send if (typeof(Component.beforeSend) == 'function') { Component.beforeSend(httpRequest); } if (document.ajax && typeof(document.ajax.beforeSend) == 'function') { document.ajax.beforeSend(httpRequest); } httpRequest.onerror = function() { if (options.error && typeof(options.error) == 'function') { options.error({ message: 'Network error: Unable to reach the server.', status: 0 }); } } httpRequest.ontimeout = function() { if (options.error && typeof(options.error) == 'function') { options.error({ message: 'Request timed out after ' + httpRequest.timeout + 'ms.', status: 0 }); } } httpRequest.onload = function() { if (httpRequest.status >= 200 && httpRequest.status < 300) { if (options.dataType === 'json') { try { var result = JSON.parse(httpRequest.responseText); if (options.success && typeof(options.success) == 'function') { options.success(result); } } catch(err) { if (options.error && typeof(options.error) == 'function') { options.error(err, result); } } } else { if (options.dataType === 'blob') { var result = httpRequest.response; } else { var result = httpRequest.responseText; } if (options.success && typeof(options.success) == 'function') { options.success(result); } } } else { if (options.error && typeof(options.error) == 'function') { options.error(httpRequest.responseText, httpRequest.status); } } // Global queue if (Component.queue && Component.queue.length > 0) { Component.send(Component.queue.shift()); } // Global complete method if (Component.requests && Component.requests.length) { // Get index of this request in the container var index = Component.requests.indexOf(httpRequest); // Remove from the ajax requests container Component.requests.splice(index, 1); // Deprecated: Last one? if (! Component.requests.length) { // Object event if (options.complete && typeof(options.complete) == 'function') { options.complete(result); } } // Group requests if (options.group) { if (Component.oncomplete && typeof(Component.oncomplete[options.group]) == 'function') { if (! Component.pending(options.group)) { Component.oncomplete[options.group](); Component.oncomplete[options.group] = null; } } } // Multiple requests controller if (options.multiple && options.multiple.instance) { // Get index of this request in the container var index = options.multiple.instance.indexOf(httpRequest); // Remove from the ajax requests container options.multiple.instance.splice(index, 1); // If this is the last one call method complete if (! options.multiple.instance.length) { if (options.multiple.complete && typeof(options.multiple.complete) == 'function') { options.multiple.complete(result); } } } } } // Keep the options httpRequest.options = options; // Data httpRequest.data = data; // Queue if (options.queue === true && Component.requests.length > 0) { Component.queue.push(httpRequest); } else { Component.send(httpRequest) } return httpRequest; }); Component.send = function(httpRequest) { if (httpRequest.data) { if (Array.isArray(httpRequest.data)) { httpRequest.send(httpRequest.data.join('&')); } else { httpRequest.send(httpRequest.data); } } else { httpRequest.send(); } Component.requests.push(httpRequest); } Component.exists = function(url, __callback) { var http = new XMLHttpRequest(); http.open('HEAD', url, false); http.send(); if (http.status) { __callback(http.status); } } Component.pending = function(group) { var n = 0; var o = Component.requests; if (o && o.length) { for (var i = 0; i < o.length; i++) { if (! group || group == o[i].options.group) { n++ } } } return n; } Component.oncomplete = {}; Component.requests = []; Component.queue = []; return Component } /* harmony default export */ var ajax = (Ajax()); ;// CONCATENATED MODULE: ./src/plugins/animation.js function Animation() { const Component = { loading: {} } Component.loading.show = function(timeout) { if (! Component.loading.element) { Component.loading.element = document.createElement('div'); Component.loading.element.className = 'jloading'; } document.body.appendChild(Component.loading.element); // Max timeout in seconds if (timeout > 0) { setTimeout(function() { Component.loading.hide(); }, timeout * 1000) } } Component.loading.hide = function() { if (Component.loading.element && Component.loading.element.parentNode) { document.body.removeChild(Component.loading.element); } } Component.slideLeft = function (element, direction, done) { if (direction == true) { element.classList.add('jslide-left-in'); setTimeout(function () { element.classList.remove('jslide-left-in'); if (typeof (done) == 'function') { done(); } }, 400); } else { element.classList.add('jslide-left-out'); setTimeout(function () { element.classList.remove('jslide-left-out'); if (typeof (done) == 'function') { done(); } }, 400); } } Component.slideRight = function (element, direction, done) { if (direction === true) { element.classList.add('jslide-right-in'); setTimeout(function () { element.classList.remove('jslide-right-in'); if (typeof (done) == 'function') { done(); } }, 400); } else { element.classList.add('jslide-right-out'); setTimeout(function () { element.classList.remove('jslide-right-out'); if (typeof (done) == 'function') { done(); } }, 400); } } Component.slideTop = function (element, direction, done) { if (direction === true) { element.classList.add('jslide-top-in'); setTimeout(function () { element.classList.remove('jslide-top-in'); if (typeof (done) == 'function') { done(); } }, 400); } else { element.classList.add('jslide-top-out'); setTimeout(function () { element.classList.remove('jslide-top-out'); if (typeof (done) == 'function') { done(); } }, 400); } } Component.slideBottom = function (element, direction, done) { if (direction === true) { element.classList.add('jslide-bottom-in'); setTimeout(function () { element.classList.remove('jslide-bottom-in'); if (typeof (done) == 'function') { done(); } }, 400); } else { element.classList.add('jslide-bottom-out'); setTimeout(function () { element.classList.remove('jslide-bottom-out'); if (typeof (done) == 'function') { done(); } }, 100); } } Component.fadeIn = function (element, done) { element.style.display = ''; element.classList.add('jfade-in'); setTimeout(function () { element.classList.remove('jfade-in'); if (typeof (done) == 'function') { done(); } }, 2000); } Component.fadeOut = function (element, done) { element.classList.add('jfade-out'); setTimeout(function () { element.style.display = 'none'; element.classList.remove('jfade-out'); if (typeof (done) == 'function') { done(); } }, 1000); } return Component; } /* harmony default export */ var animation = (Animation()); ;// CONCATENATED MODULE: ./src/utils/helpers.date.js function HelpersDate() { var Component = {}; Component.now = function (date, dateOnly) { var y = null; var m = null; var d = null; var h = null; var i = null; var s = null; if (Array.isArray(date)) { y = date[0]; m = date[1]; d = date[2]; h = date[3]; i = date[4]; s = date[5]; } else { if (! date) { date = new Date(); } y = date.getFullYear(); m = date.getMonth() + 1; d = date.getDate(); h = date.getHours(); i = date.getMinutes(); s = date.getSeconds(); } if (dateOnly == true) { return helpers.two(y) + '-' + helpers.two(m) + '-' + helpers.two(d); } else { return helpers.two(y) + '-' + helpers.two(m) + '-' + helpers.two(d) + ' ' + helpers.two(h) + ':' + helpers.two(i) + ':' + helpers.two(s); } } Component.toArray = function (value) { var date = value.split(((value.indexOf('T') !== -1) ? 'T' : ' ')); var time = date[1]; var date = date[0].split('-'); var y = parseInt(date[0]); var m = parseInt(date[1]); var d = parseInt(date[2]); var h = 0; var i = 0; if (time) { time = time.split(':'); h = parseInt(time[0]); i = parseInt(time[1]); } return [y, m, d, h, i, 0]; } var excelInitialTime = Date.UTC(1900, 0, 0); var excelLeapYearBug = Date.UTC(1900, 1, 29); var millisecondsPerDay = 86400000; /** * Date to number */ Component.dateToNum = function (jsDate) { if (typeof (jsDate) === 'string') { jsDate = new Date(jsDate + ' GMT+0'); } var jsDateInMilliseconds = jsDate.getTime(); if (jsDateInMilliseconds >= excelLeapYearBug) { jsDateInMilliseconds += millisecondsPerDay; } jsDateInMilliseconds -= excelInitialTime; return jsDateInMilliseconds / millisecondsPerDay; } /** * Number to date * * IMPORTANT: Excel incorrectly considers 1900 to be a leap year */ Component.numToDate = function (excelSerialNumber) { var jsDateInMilliseconds = excelInitialTime + excelSerialNumber * millisecondsPerDay; if (jsDateInMilliseconds >= excelLeapYearBug) { jsDateInMilliseconds -= millisecondsPerDay; } const d = new Date(jsDateInMilliseconds); var date = [ d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), ]; return Component.now(date); } let weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; let months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; Object.defineProperty(Component, 'weekdays', { get: function () { return weekdays.map(function(v) { return dictionary.translate(v); }); }, }); Object.defineProperty(Component, 'weekdaysShort', { get: function () { return weekdays.map(function(v) { return dictionary.translate(v).substring(0,3); }); }, }); Object.defineProperty(Component, 'months', { get: function () { return months.map(function(v) { return dictionary.translate(v); }); }, }); Object.defineProperty(Component, 'monthsShort', { get: function () { return months.map(function(v) { return dictionary.translate(v).substring(0,3); }); }, }); return Component; } /* harmony default export */ var helpers_date = (HelpersDate()); ;// CONCATENATED MODULE: ./src/plugins/mask.js function Mask() { // Currency var tokens = { // Text text: [ '@' ], // Currency tokens currency: [ '#(.{1})##0?(.{1}0+)?( ?;(.*)?)?', '#' ], // Scientific scientific: [ '0{1}(.{1}0+)?E{1}\\+0+' ], // Percentage percentage: [ '0{1}(.{1}0+)?%' ], // Number numeric: [ '0{1}(.{1}0+)?' ], // Data tokens datetime: [ 'YYYY', 'YYY', 'YY', 'MMMMM', 'MMMM', 'MMM', 'MM', 'DDDDD', 'DDDD', 'DDD', 'DD', 'DY', 'DAY', 'WD', 'D', 'Q', 'MONTH', 'MON', 'HH24', 'HH12', 'HH', '\\[H\\]', 'H', 'AM/PM', 'MI', 'SS', 'MS', 'Y', 'M' ], // Other general: [ 'A', '0', '[0-9a-zA-Z\$]+', '.'] } var getDate = function() { if (this.mask.toLowerCase().indexOf('[h]') !== -1) { var m = 0; if (this.date[4]) { m = parseFloat(this.date[4] / 60); } var v = parseInt(this.date[3]) + m; v /= 24; } else if (! (this.date[0] && this.date[1] && this.date[2]) && (this.date[3] || this.date[4])) { v = helpers.two(this.date[3]) + ':' + helpers.two(this.date[4]) + ':' + helpers.two(this.date[5]) } else