![]() 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-form/js/components/ |
Upload File : |
import {AssemblerInstance} from "../core/Assembler"; import inheritComponentClass from "../core/inheritComponentClass"; import ScalableComponent from "../core/ScalableComponent"; import {_} from "../core/FCore"; import MultiCheckTreeMenu from "absol-acomp/js/MultiCheckTreeMenu"; import ComboBox from "./ComboBox"; import InputAttributeHandlers from "./handlers/InputAttributeHandlers"; /*** * @extends ScalableComponent * @constructor */ function MultiSelectTreeComboBox() { ScalableComponent.call(this); } inheritComponentClass(MultiSelectTreeComboBox, ScalableComponent); MultiSelectTreeComboBox.prototype.tag = 'MultiSelectTreeComboBox'; MultiSelectTreeComboBox.prototype.render = function () { return _({ tag: MultiCheckTreeMenu.tag }); }; MultiSelectTreeComboBox.prototype.onCreated = function () { this.domElt.on('change', function () { this.pinFire('values'); }.bind(this)) }; Object.assign(MultiSelectTreeComboBox.prototype.attributeHandlers, InputAttributeHandlers); MultiSelectTreeComboBox.prototype.attributeHandlers.searchable = ComboBox.prototype.attributeHandlers.searchable; MultiSelectTreeComboBox.prototype.attributeHandlers.leafOnly = { set: function (value) { this.domElt.leafOnly = !!value; }, get: function () { return this.domElt.leafOnly; }, export: function () { return this.domElt.leafOnly || undefined; }, descriptor: { type: 'bool' } }; MultiSelectTreeComboBox.prototype.attributeHandlers.treeList = { set: function (items) { this.domElt.items = items; }, get: function () { return this.domElt.items; }, descriptor: { type: 'CheckTreeList' } }; MultiSelectTreeComboBox.prototype.attributeHandlers.values = { set: function (values) { var prev = this.domElt.values; this.domElt.values = values || []; var cur = this.domElt.values; var changed = prev.length !== cur.length; var pDict; if (!changed) { pDict = prev.reduce(function (ac, cr) { ac[cr] = true; return ac; }, {}); changed = cur.some(function (val) { return !pDict[val]; }); } if (changed) { this.pinFire('values'); } }, get: function () { return this.domElt.values; }, descriptor: { type: 'string[]|number[]' } }; MultiSelectTreeComboBox.prototype.pinHandlers.values = { receives: function (values) { this.domElt.values = values || []; }, get: function () { return this.attributes.values; }, descriptor: { type: 'string[]|number[]' } }; MultiSelectTreeComboBox.prototype.pinHandlers.treeList = { receives: function (items) { this.domElt.items = items; }, descriptor: { type: 'CheckTreeList' } }; MultiSelectTreeComboBox.prototype.createDataBindingDescriptor = function () { var thisC = this; var subObj = {}; Object.defineProperties(subObj, { values: { enumerable: true, set: function (value) { thisC.setAttribute('values', value); }, get: function () { return thisC.getAttribute('values'); } }, treeList: { enumerable: false, get: function () { return thisC.getAttribute('list'); }, set: function (value) { thisC.setAttribute('list', value); } } }); return { set: function (value) { Object.assign(subObj, value); }, get: function () { return subObj; } }; }; AssemblerInstance.addClass(MultiSelectTreeComboBox); AssemblerInstance.addClass('MultiCheckTreeComboBox', MultiSelectTreeComboBox); export default MultiSelectTreeComboBox;