![]() 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/StaticTabbar.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; require("../css/statictabbar.css"); var _ACore = _interopRequireDefault(require("../ACore")); var _stringGenerate = require("absol/src/String/stringGenerate"); var $ = _ACore.default.$; var _ = _ACore.default._; function StaticTabbar() { var thisST = this; this.$activeBox = $('.absol-static-tabbar-active-box', this); this.$hline = $('.absol-static-tabbar-hline', this); this.$buttons = []; this._btDict = {}; this._activedButton = undefined; this.sync = new Promise(function (resolve) { _('attachhook').on('error', function () { this.remove(); resolve(); }).addTo(thisST); }); return this; } StaticTabbar.tag = 'StaticTabbar'.toLowerCase(); StaticTabbar.render = function () { return _({ class: 'absol-static-tabbar', extendEvent: 'change', child: [{ class: 'absol-static-tabbar-active-box', child: '.absol-static-tabbar-hline' }] }); }; StaticTabbar.prototype.fireChange = function (data) { this.emit('change', { target: this, data, value: this.value }, self); }; StaticTabbar.property = {}; StaticTabbar.property.items = { set: function (value) { this.$buttons.forEach(function (e) { e.remove(); }); this._items = value; var self = this; this.$buttons = this.items.map(function (tab) { var ident = tab.value || (0, _stringGenerate.randomIdent)(); var button = _({ tag: 'button', class: 'absol-static-tabbar-button', id: 'tab-' + ident, child: { tag: 'span', child: { text: tab.text } }, on: { click: function (event) { if (self.value != tab.value) { self.value = ident; self.fireChange(tab); } } } }).addTo(self); self._btDict[ident] = button; return button; }); if (this.value !== undefined) { this.sync.then(this.activeTab.bind(this, this.value)); } }, get: function () { return this._items || []; } }; StaticTabbar.property.value = { set: function (value) { this._value = value; if (this.$buttons.length > 0) { this.sync.then(this.activeTab.bind(this, value)); } }, get: function () { return this._value; } }; StaticTabbar.prototype.activeTab = function (ident) { if (this._activedButton) this._activedButton.removeClass('active'); var button = this._btDict[ident]; this._activedButton = button; if (button) { button.addClass('active'); var bound = this.getBoundingClientRect(); var buttonBound = button.getBoundingClientRect(); var dx = buttonBound.left - bound.left; var fontSize = this.getFontSize(); this.$activeBox.addStyle({ left: dx / fontSize + 'em', width: buttonBound.width / fontSize + 'em' }); } else { this.$activeBox.addStyle({ left: '0', width: '0' }); } }; _ACore.default.install('statictabbar', StaticTabbar); var _default = StaticTabbar; exports.default = _default;