![]() 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-card/js/taskboard/TLBoardTable.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _Core = _interopRequireDefault(require("../dom/Core")); var _AElement = _interopRequireDefault(require("absol/src/HTML5/AElement")); var _stringGenerate = require("absol/src/String/stringGenerate"); var _ResizeSystem = _interopRequireDefault(require("absol/src/HTML5/ResizeSystem")); var _BoardTable = _interopRequireDefault(require("absol-acomp/js/BoardTable")); require("../../css/tlboardtable.css"); var _OOP = _interopRequireDefault(require("absol/src/HTML5/OOP")); var _TLCard = _interopRequireDefault(require("./TLCard")); var _TLList = _interopRequireDefault(require("./TLList")); var _Dom = _interopRequireWildcard(require("absol/src/HTML5/Dom")); var _BrowserDetector = _interopRequireDefault(require("absol/src/Detector/BrowserDetector")); var _MHSnapScroller = _interopRequireDefault(require("absol-mobile/js/dom/MHSnapScroller")); var _Color = _interopRequireDefault(require("absol/src/Color/Color")); var _ = _Core.default._; var $ = _Core.default.$; _Core.default.install(_MHSnapScroller.default); var isIPhone = _BrowserDetector.default.isSafari && _BrowserDetector.default.isMobile; /*** * @extends AElement * @constructor */ function TLBoardTable() { this.$bodyFriends = []; var thisBT = this; this.$staticItems = []; this._title = ''; this.$title = $('.tl-board-table-title', this); this.$titleText = this.$title.firstChild; /*** * * @type {BoardTable} */ this.$body = $('boardtable.tl-board-table-body', this).on('orderchange', this.eventHandler.bodyChange); var screenSize = (0, _Dom.getScreenSize)(); // if (isIPhone && screenSize.width < screenSize.height) { // _({ // tag: MHSnapScroller.tag, // elt: this.$body // }) // } this.$addBtn = _({ class: ['tl-board-table-add-btn'], child: { text: '[ADD_TXT]' } }).on('click', this.eventHandler.clickAdd); /*** * * @type {Text} */ this.$addBtnText = this.$addBtn.firstChild; this.$body.addChild(this.$addBtn); this.$attachhook = _('attachhook').addTo(this); this.$attachhook.requestUpdateSize = this.updateSize.bind(this); this.$attachhook.on('attached', function () { _ResizeSystem.default.add(this); this.requestUpdateSize(); thisBT.updateAutoStyleValue(); }); _OOP.default.drillProperty(this, this, 'name', 'title'); } TLBoardTable.tag = "TLBoardTable".toLowerCase(); TLBoardTable.render = function () { return _({ id: (0, _stringGenerate.randomIdent)(16), class: ['tl-board-table', 'cd-header-hidden'], extendEvent: ['change', 'pressadd'], child: [{ class: 'tl-board-table-header', child: [{ tag: 'span', class: 'tl-board-table-title', child: { text: "" } }] }, { tag: 'boardtable', class: 'tl-board-table-body' }] }); }; TLBoardTable.prototype.updateAutoStyleValue = function () { var backgroundColorStyle = this.getComputedStyleValue('background-color'); var backgroundColor; try { backgroundColor = _Color.default.parse(backgroundColorStyle); } catch (error) { backgroundColor = _Color.default.parse('white'); } var contractColor = backgroundColor.getContrastYIQ(); var hsba = contractColor.toHSBA().slice(); hsba[2] = 0.5 * 0.3 + hsba[2] * 0.7; var lowContractColor = _Color.default.fromHSB(hsba[0], hsba[1], hsba[2]); this.addStyle('--background-yiq-color', contractColor.toString('hex6')); this.addStyle('--background-low-yiq-color', lowContractColor.toString('hex6')); }; TLBoardTable.prototype.addStyle = function () { if (arguments[0] === 'background-color' || arguments[0] === 'background' || arguments[0] === 'backgroundColor') { _AElement.default.prototype.addStyle.apply(this, arguments); this.updateAutoStyleValue(); return this; } else { return _AElement.default.prototype.addStyle.apply(this, arguments); } }; /*** * * @param {boolean} bothStatic * @returns {T[]} */ TLBoardTable.prototype.getAllItems = function (bothStatic) { return Array.prototype.filter.call(this.$body.childNodes, function (e) { // return e !== addBtn; return e.containsClass(bothStatic ? 'tl-board-table-item' : 'as-board'); }); }; TLBoardTable.prototype.getAllItem = TLBoardTable.prototype.getAllItems; /*** * * @param {TLCard|TLList} itemElt * @param {boolean} staticItem * @returns {TLBoardTable} */ TLBoardTable.prototype.addItem = function (itemElt, staticItem) { if (staticItem) { itemElt.removeClass('as-board'); } itemElt.addClass('tl-board-table-item'); this.$body.addChildBefore(itemElt, this.$addBtn); this.$bodyFriends.push(itemElt.$body); itemElt.$body.friends = this.$bodyFriends; return this; }; TLBoardTable.prototype.removeItem = function (itemElt) { this.$body.removeChild(itemElt); itemElt.removeClass('tl-board-table-item'); var friendIdx = this.$bodyFriends.indexOf(itemElt.$body); if (friendIdx >= 0) { this.$bodyFriends.splice(friendIdx, 1); } }; TLBoardTable.prototype.clearItem = function () { var items = this.getAllItems(true); for (var i = 0; i < items.length; ++i) { this.$body.removeChild(items[i]); } this.$bodyFriends = []; return this; }; TLBoardTable.prototype.updateSize = function () { if (!this.isDescendantOf(document.body)) return; var bound = this.$body.getBoundingClientRect(); if (bound.height === 0) { requestAnimationFrame(this.updateSize.bind(this)); } else { this.addStyle({ '--tl-board-table-body-width': bound.width + 'px', '--tl-board-table-body-height': bound.height + 'px' }); } }; TLBoardTable.property = {}; TLBoardTable.property.title = { set: function (value) { this.$title.clearChild(); this._title = value || ''; if (this._title) { this.$titleText.data = this._title; this.removeClass('cd-header-hidden'); } else { this.addClass('cd-header-hidden'); } this.updateSize(); }, get: function () { return this.$titleText.data; } }; TLBoardTable.property.addText = { set: function (text) { this.$addBtnText.data = text || ''; }, get: function () { return this.$addBtnText.data; } }; TLBoardTable.property.hasAddBtn = { set: function (value) { if (value) this.addClass('tl-has-add-btn');else this.removeClass('tl-has-add-btn'); }, get: function () { return this.containsClass('tl-has-add-btn'); } }; TLBoardTable.eventHandler = {}; TLBoardTable.eventHandler.clickAdd = function () { setTimeout(function () { this.emit('pressadd', { type: 'pressadd', target: this }, this); }.bind(this), 500); }; TLBoardTable.eventHandler.bodyChange = function (event) { setTimeout(function () { this.emit('change', Object.assign({}, event, { target: this, type: "change" }), this); }.bind(this), 500); this.updateSize(); }; _Core.default.install(TLBoardTable); var _default = TLBoardTable; exports.default = _default;