![]() 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-acomp/js/MultiCheckTreeLeafMenu.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _ACore = _interopRequireWildcard(require("../ACore")); var _MultiCheckTreeLeafBox = _interopRequireDefault(require("./MultiCheckTreeLeafBox")); var _SelectTreeLeafMenu = _interopRequireWildcard(require("./SelectTreeLeafMenu")); var _SelectBoxItem = _interopRequireDefault(require("./SelectBoxItem")); var _MultiSelectMenu = _interopRequireDefault(require("./MultiSelectMenu")); var _OOP = _interopRequireDefault(require("absol/src/HTML5/OOP")); var _SelectMenu = _interopRequireDefault(require("./SelectMenu2")); var _MultiLanguageCSS = require("./MultiLanguageCSS"); /**** * Only leafs have checkbox * @extends AElement * @constructor */ function MultiCheckTreeLeafMenu() { (0, _MultiLanguageCSS.loadLanguageModule)(); this.$selectBox = (0, _ACore._)({ tag: _MultiCheckTreeLeafBox.default.tag, on: { change: this.eventHandler.selectBoxChange, preupdateposition: this.eventHandler.preUpdateListPosition } }); this.$selectlistBox = this.$selectBox; _OOP.default.drillProperty(this, this.$selectBox, 'enableSearch'); this.on('mousedown', this.eventHandler.click); this.$itemCtn = (0, _ACore.$)('.as-multi-select-menu-item-ctn', this); this.boxCtrl = new _SelectTreeLeafMenu.STLBoxController(this); _OOP.default.drillProperty(this, this.boxCtrl, 'isFocus'); } MultiCheckTreeLeafMenu.tag = 'MultiCheckTreeLeafMenu'.toLowerCase(); MultiCheckTreeLeafMenu.render = function () { return (0, _ACore._)({ class: ['as-multi-select-menu', 'as-multi-check-tree-leaf-menu'], extendEvent: ['change'], attr: { tabindex: '1' }, child: [{ attr: { 'data-ml-key': 'txt_select_value' }, class: ['as-multi-select-menu-item-ctn', 'as-bscroller'] }, { tag: 'button', class: 'as-multi-select-menu-toggle-btn', child: 'dropdown-ico' }, 'attachhook'] }); }; MultiCheckTreeLeafMenu.prototype._updateSelectedItems = function () { var values = this.$selectBox.values; while (this.$itemCtn.childNodes.length > values.length) { this.$itemCtn.removeChild(this.$itemCtn.lastChild); } while (this.$itemCtn.childNodes.length < values.length) { this.$itemCtn.addChild(this._makeItem()); } var item; for (var i = 0; i < values.length; ++i) { item = this.$selectBox.$itemByValue[values[i]] && this.$selectBox.$itemByValue[values[i]].itemData; if (item) { this.$itemCtn.childNodes[i].data = item; this.$itemCtn.childNodes[i].removeStyle('display', 'none'); } else { this.$itemCtn.childNodes[i].addStyle('display', 'none'); } } }; MultiCheckTreeLeafMenu.prototype._makeItem = function () { var itemElt = (0, _ACore._)({ tag: _SelectBoxItem.default.tag }); itemElt.on('close', this.eventHandler.itemPressClose.bind(null, itemElt)); return itemElt; }; MultiCheckTreeLeafMenu.prototype.init = function (props) { props = props || {}; var cProps = Object.assign({}, props); if ('items' in props) { this.items = props.items; delete cProps.items; } if ('values' in props) { this.values = props.values; delete cProps.values; } Object.assign(this, cProps); }; MultiCheckTreeLeafMenu.property = {}; MultiCheckTreeLeafMenu.property.items = { set: function (items) { this.$selectBox.items = items; this.addStyle('--select-list-estimate-width', Math.max(145 + 20, this.$selectBox.estimateSize.width) + 'px'); this._updateSelectedItems(); }, get: function () { return this.$selectBox.items; } }; MultiCheckTreeLeafMenu.property.values = { set: function (values) { values = values || []; this.pendingValues = values; this.$selectBox.values = values; this._updateSelectedItems(); }, get: function () { if ('pendingValues' in this) return this.pendingValues; return this.$selectBox.values.slice().filter(value => { return !!this.$selectBox.$itemByValue[value]; }); } }; MultiCheckTreeLeafMenu.property.disabled = _MultiSelectMenu.default.property.disabled; MultiCheckTreeLeafMenu.property.readOnly = _MultiSelectMenu.default.property.readOnly; MultiCheckTreeLeafMenu.property.placeholder = { set: function (value) { if (value) { this.$itemCtn.attr('data-placeholder', value + ''); } else { this.$itemCtn.attr('data-placeholder', null); } }, get: function () { return this.$itemCtn.attr('data-placeholder'); } }; MultiCheckTreeLeafMenu.eventHandler = {}; MultiCheckTreeLeafMenu.eventHandler.clickOut = _SelectTreeLeafMenu.default.eventHandler.clickOut; MultiCheckTreeLeafMenu.eventHandler.preUpdateListPosition = _SelectMenu.default.eventHandler.preUpdateListPosition; MultiCheckTreeLeafMenu.eventHandler.click = function (event) { if (!this.readOnly && (event.target === this || event.target === this.$itemCtn)) { this.isFocus = true; } }; MultiCheckTreeLeafMenu.eventHandler.selectBoxChange = function () { delete this.pendingValues; this._updateSelectedItems(); this.emit('change', { type: 'change', target: this }, this); }; MultiCheckTreeLeafMenu.eventHandler.itemPressClose = function (itemElt, event) { delete this.pendingValues; var item = itemElt.data; this.$selectBox.values = this.$selectBox.values.filter(function (value) { return value !== item.value; }); this._updateSelectedItems(); this.emit('change', { type: 'change', target: this }, this); }; _ACore.default.install(MultiCheckTreeLeafMenu); var _default = MultiCheckTreeLeafMenu; exports.default = _default;