![]() 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/QuickPath.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; require("../css/quickpath.css"); var _ACore = _interopRequireDefault(require("../ACore")); var _QuickMenu = _interopRequireDefault(require("./QuickMenu")); var _ = _ACore.default._; var $ = _ACore.default.$; /*** * @extends AElement * @constructor */ function QuickPath() { this._holders = []; } /** * @type {QuickPath} */ QuickPath.eventHandler = {}; /*** * @this QuickPath * @param event */ QuickPath.eventHandler.click = function (event) { var button = this._fileButton(event.target); if (button) this.pressButton(button); }; QuickPath.tag = 'QuickPath'.toLowerCase(); /** * @returns {QuickPath} */ QuickPath.render = function () { return _({ class: 'absol-quick-path', extendEvent: ['change', 'press'] }); }; QuickPath.prototype.updatePath = function () { this.clearChild(); var self = this; this._holders = this._path.map(function (data, index) { var holder = self._createButton(data, index); holder.buttom.addTo(self); return holder; }); }; QuickPath.prototype._createButton = function (pathItem, index) { var buttom = _({ tag: 'expnode', class: 'absol-quick-path-btn', attr: { 'data-index': '' + index } }); buttom.status = 'close'; buttom.name = pathItem.name; if (pathItem.icon) { buttom.icon = pathItem.icon; } if (pathItem.iconSrc) { buttom.icon = { tag: 'img', props: { src: pathItem.iconSrc } }; } var thisQuickpath = this; if (pathItem.items) { _QuickMenu.default.toggleWhenClick(buttom, { getAnchor: function () { return [1, 2, 6, 5]; }, getMenuProps: function () { return { extendStyle: { fontSize: buttom.getComputedStyleValue('font-size') }, items: pathItem.items.map(function (it, menuIndex) { var res = { text: it.name, menuIndex: menuIndex, icon: it.iconSrc ? { tag: 'img', props: { src: it.iconSrc } } : it.icon || undefined, extendStyle: it.extendStyle || {}, extendClass: it.extendClass || [] }; return res; }) }; }, onOpen: function () { buttom.status = 'open'; thisQuickpath.emit('press', { target: thisQuickpath, pathItem: pathItem, index: index }, thisQuickpath); }, onClose: function () { buttom.status = 'close'; }, onSelect: function (item) { var dataItem = pathItem.items[item.menuIndex]; thisQuickpath.emit('change', { target: thisQuickpath, pathItem: pathItem, item: dataItem, index: index }, thisQuickpath); thisQuickpath.status = 'close'; } }); } else { buttom.on('click', function () { this.emit('press', { target: thisQuickpath, pathItem: pathItem, index: index }, thisQuickpath); }); } return { buttom: buttom }; }; QuickPath.prototype.push = function (item) { this.path.push(item); var holder = this._createButton(item, this.path.length - 1); this.addChild(holder, buttom); this._holders.push(holder); }; QuickPath.prototype.clear = function () { this.path = []; this._holders = []; }; QuickPath.prototype.pop = function () { //todo var res = this.path.pop(); var button = $('button[data-index="' + this.path.length + '"]'); if (button) button.remove(); return res; }; QuickPath.property = {}; /** * @typedef PathElement * @property {String} name * @property {String} icon * @property {Array<String>} items * */ QuickPath.property.path = { /** * @param {Array<PathElement>} value */ set: function (value) { this._path = value || []; this.updatePath(); }, get: function () { return this._path || []; } }; QuickPath.property.textPath = { get: function () { return this.path.join('/'); } }; _ACore.default.install('quickpath', QuickPath); var _default = QuickPath; exports.default = _default;