![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/libs/absol-full/dist/js/ |
Upload File : |
/*** module: node_modules/absol-sheet/js/util.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isNone = isNone; exports.isDifferent = isDifferent; exports.duplicateData = duplicateData; exports.getDefaultWeekFormat = getDefaultWeekFormat; exports.computeSheetDescriptor = computeSheetDescriptor; exports.calcIndexColumnWidth = calcIndexColumnWidth; var _generator = require("absol/src/JSMaker/generator"); var _TSSwitch = _interopRequireDefault(require("./fx/TSSwitch")); var _TSFunction = _interopRequireDefault(require("./fx/TSFunction")); var _CheckListBox = require("absol-acomp/js/CheckListBox"); var _TextMeasure = _interopRequireDefault(require("absol-acomp/js/TextMeasure")); function isNone(o) { return o === null || o === undefined; } function isDifferent(a, b) { return a !== b && (!isNone(a) || !isNone(b)); } function duplicateData(o) { return (0, _generator.replaceDateStringJSVariable)(o); } function getDefaultWeekFormat() { var lang = 'VN'; if (window['systemconfig'] && window['systemconfig']['language']) lang = window['systemconfig']['language']; if (lang.toUpperCase().match(/VN|VI/)) return 'Tuần ww, yyyy'; if (lang.toUpperCase().match(/EN|US/)) return 'Week ww, yyyy'; return 'Week ww, yyyy'; } function computeSheetDescriptor(propertyNames, propertyDescriptors) { var computeFxDescriptor = descriptor => { Object.defineProperty(descriptor, '__fx__', { configurable: true, enumerable: false, value: {} }); Object.keys(descriptor).reduce((ac, key) => { var val = descriptor[key]; if (typeof val === 'string') { if (val.startsWith('=')) { descriptor.__fx__[key] = new _TSFunction.default(propertyNames, val); } else if (val.startsWith('{{') && val.endsWith('}}')) { descriptor.__fx__[key] = new _TSFunction.default(propertyNames, val.substring(2, val.length - 2)); } else if (key === 'onchange') { descriptor.__fx__[key] = new _TSFunction.default(propertyNames, val); } } else if (key === 'switch') { descriptor.__fx__['switch'] = new _TSSwitch.default(descriptor['switch']); } return ac; }, descriptor.__fx__); }; var computeDependenciesDescriptor = descriptor => { var dependencies = {}; var fx = descriptor.__fx__; Object.keys(fx).reduce(function (ac, key) { if (fx[key].dependents) { fx[key].dependents.reduce(function (ac1, pName) { ac1[pName] = true; return ac1; }, ac); } // ac[]; return ac; }, dependencies); delete dependencies[name]; Object.defineProperty(descriptor, '__dependencies__', { configurable: true, enumerable: false, value: dependencies }); }; var descriptor; propertyNames.forEach(name => { descriptor = propertyDescriptors[name]; if (!descriptor) return; computeFxDescriptor(descriptor); computeDependenciesDescriptor(descriptor); }); } var icWidthCache = Array(10).fill(0); function calcIndexColumnWidth(nRow) { var l = (nRow + '').length; l = Math.max(1, l); if (icWidthCache[l]) return icWidthCache[l]; var res = _TextMeasure.default.measureWidth('0'.repeat(l), 'Arial', 14) + 2 + 0.7 * 14; res = Math.ceil(res); icWidthCache[l] = res; return res; }