![]() 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/checktreebox/CheckTreeItem.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _ACore = require("../../ACore"); var _CTIPropHandlers = _interopRequireDefault(require("./CTIPropHandlers")); var _EventEmitter = require("absol/src/HTML5/EventEmitter"); var _utils = require("../utils"); /*** * @extends AElement * @constructor */ function CheckTreeItem() { this._data = null; this._status = 'none'; this.$text = (0, _ACore.$)('.am-check-tree-item-text', this).firstChild; this.$desc = (0, _ACore.$)('.am-check-tree-item-desc', this).firstChild; this.$iconCtn = (0, _ACore.$)('.am-check-tree-item-icon-ctn', this); this.$checkbox = (0, _ACore.$)('checkboxinput', this).on('change', this.eventHandler.checkboxChange); this.addEventListener('click', this.eventHandler.click); } CheckTreeItem.tag = 'CheckTreeItem'.toLowerCase(); CheckTreeItem.render = function () { return (0, _ACore._)({ extendEvent: ['checkedchange', 'click', 'statuschange'], class: ['am-check-tree-item', 'am-dropdown-box-item'], child: [{ class: 'am-check-tree-item-toggle-ctn', child: 'toggler-ico' }, { class: 'am-check-tree-item-icon-ctn' }, { class: 'am-check-tree-item-checkbox-ctn', child: 'checkboxinput' }, { class: 'am-check-tree-item-text', child: { text: '' } }, { class: 'am-check-tree-item-desc', child: { text: '' } }] }); }; CheckTreeItem.prototype._updateData = function () { this.$text.data = this.text; this.$desc.data = this.desc; this.$iconCtn.clearChild(); this.$icon = null; this.attr('data-key', (0, _utils.keyStringOf)(this.value)); if (this._data && this._data.icon) { this.$icon = (0, _ACore._)(this._data.icon); if (this.$icon.parentElement) { this.$icon = this.$icon.cloneNode(true); } this.$iconCtn.addChild(this.$icon); this.addClass('as-has-icon'); } else { this.removeClass('as-has-icon'); } if (this._data && this._data.isLeaf) { this.addClass('as-is-leaf'); } else { this.removeClass('as-is-leaf'); } }; CheckTreeItem.eventHandler = {}; CheckTreeItem.eventHandler.click = function (event) { if ((0, _EventEmitter.hitElement)(this.$checkbox, event)) return; var checkboxBound = this.$checkbox.getBoundingClientRect(); var canCheck = this.$checkbox.getComputedStyleValue('pointer-events') !== 'none' && !this.$checkbox.disabled && checkboxBound.width > 0; if (this.status === 'none' && canCheck) { this.$checkbox.checked = !this.$checkbox.checked; this.$checkbox.notifyChange(); } else if (this.status !== 'none') { if (!checkboxBound.width) { checkboxBound = this.$iconCtn.getBoundingClientRect(); } if (!checkboxBound.width) { checkboxBound = { left: this.getBoundingClientRect().left + parseFloat(this.$text.parentElement.getComputedStyleValue('padding-left').replace('px')) }; } if (event.clientX < checkboxBound.left || !canCheck) { this.status = this.status === 'open' ? 'close' : 'open'; this.emit('statuschange', { type: 'statuschange', target: this }, this); } else if (canCheck) { this.$checkbox.checked = !this.$checkbox.checked; this.$checkbox.notifyChange(); } } }; CheckTreeItem.eventHandler.checkboxChange = function () { this.emit('checkedchange', { type: 'checkedchange' }, this); }; CheckTreeItem.property = _CTIPropHandlers.default; /*** * @name data * @memberOf CheckTreeItem# */ /*** * @name text * @type {string} * @memberOf CheckTreeItem# */ /*** * @name desc * @type {string} * @memberOf CheckTreeItem# */ /*** * @name value * @memberOf CheckTreeItem# */ var _default = CheckTreeItem; exports.default = _default;