![]() 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-form/js/layouts/LinearLayout.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _FCore = _interopRequireDefault(require("../core/FCore")); var _BaseLayout = _interopRequireDefault(require("../core/BaseLayout")); var _LinearAnchor = _interopRequireDefault(require("./anchors/LinearAnchor")); var _LinearAnchorEditor = _interopRequireDefault(require("../layouteditor/anchoreditors/LinearAnchorEditor")); var _Assembler = require("../core/Assembler"); var _utils = require("../core/utils"); var _utils2 = require("absol-acomp/js/utils"); var _inheritComponentClass = _interopRequireDefault(require("../core/inheritComponentClass")); var _ = _FCore.default._; function LinearLayout() { _BaseLayout.default.call(this); } (0, _inheritComponentClass.default)(LinearLayout, _BaseLayout.default); LinearLayout.prototype.tag = 'LinearLayout'; LinearLayout.prototype.menuIcon = 'span.mdi.mdi-post-outline'; LinearLayout.prototype.TOP_CLASS_NAME = 'as-linear-layout'; LinearLayout.prototype.SUPPORT_STYLE_NAMES = ['width', 'height']; //, 'left', 'right', 'top', 'bottom']; LinearLayout.prototype.AnchorClass = _LinearAnchor.default; LinearLayout.prototype.style.paddingLeft = 0; LinearLayout.prototype.style.paddingRight = 0; LinearLayout.prototype.style.paddingTop = 0; LinearLayout.prototype.style.paddingBottom = 0; LinearLayout.prototype.styleHandlers.overflowY = { set: function (value) { if (['visible', 'hidden', 'auto'].indexOf(value) < 0) value = 'visible'; this.domElt.addStyle('overflowY', value); return value; }, export: function (ref) { var value = ref.get(); if (value === 'visible' || !value) return undefined; return value; }, descriptor: { type: 'enum', values: ['visible', 'hidden', 'auto'] } }; LinearLayout.prototype.styleHandlers.paddingLeft = { set: function (value) {}, get: function () {}, descriptor: { type: 'measurePosition' } }; LinearLayout.prototype.styleHandlers.paddingRight = { set: function (value) {}, get: function () {}, descriptor: { type: 'measurePosition' } }; ['left', 'right', 'top', 'bottom'].forEach(pos => { LinearLayout.prototype.styleHandlers['padding' + pos[0].toUpperCase() + pos.substring(1)] = { /*** * @this BaseComponent * @param value * @returns {*} */ set: function (value) { var ref = arguments[arguments.length - 1]; var unit = arguments.length > 2 ? arguments[1] : undefined; var currentValue = ref.get(); var current = (0, _utils.parseMeasureValue)(currentValue) || { value: 'auto', unit: null }; value = this.implicitMeasureSizeValue(value, unit, 'width', current.unit); if (value === 'auto') { this.domElt.removeStyle('padding-' + pos); } else if (value === 'match_parent') { this.domElt.addStyle('padding-' + pos, '100%'); } else if ((0, _utils2.isRealNumber)(value)) { this.domElt.addStyle('padding-' + pos, value + 'px'); } else this.domElt.addStyle('padding-' + pos, value); return value; }, get: function () { var unit = arguments.length > 1 ? arguments[0] : undefined; var ref = arguments[arguments.length - 1]; var value = ref.get(); var parentBound; if (unit === 'px') { if (value !== 'number') { return parseFloat(this.domElt.getComputedStyleValue('padding-' + pos).replace('px', '')); } else { return value; } } else if (unit === '%') { if (typeof value === 'string' && value.match(/%$/)) return parseFloat(value.replace('%', ''));else { parentBound = this.parent.domElt.getBoundingClientRect(); return parseFloat(this.domElt.getComputedStyleValue('padding-' + pos).replace('px', '')) * 100 / parentBound.width; } } else return value; }, descriptor: { type: 'measurePosition', sign: 'padding_' + pos } }; }); LinearLayout.prototype.onCreate = function () { _BaseLayout.default.prototype.onCreate.apply(this, arguments); this.style.overflowY = false; }; LinearLayout.prototype.render = function () { return _({ class: this.TOP_CLASS_NAME }); }; /** * * @param {BaseComponent} child * @param index */ LinearLayout.prototype.onAddChild = function (child, index) { var anchor = new _LinearAnchor.default(child); if (index === -1 || !this.view.childNodes[index]) { this.domElt.addChild(child.domElt); } else { this.view.addChildBefore(child.domElt, this.domElt.childNodes[index]); } }; /** * * @param {BaseComponent} child * @param index */ LinearLayout.prototype.onRemoveChild = function (child, index) { child.anchor.destroy(); child.domElt.remove(); }; /** * * @returns {{width:Number, height:Number}} */ LinearLayout.prototype.measureMinSize = function () { //todo var width = 0; var height = 0; var cW; var cH; var child; for (var i = 0; i < this.children.length; ++i) { child = this.children[i]; var minSize = child.measureMinSize(); cW = child.style.left + minSize.width + child.style.right; cH = child.style.top + minSize.height + child.style.bottom; width = Math.min(cW, width); height += cH; } return { width: width, height: height }; }; LinearLayout.prototype.addChildByPosition = function (child, posX, posY) { var bound = this.view.getBoundingClientRect(); var at = undefined; var y; for (var i = 0; i < this.children.length; ++i) { y = this.children[i].view.getBoundingClientRect().bottom - bound.top; if (y >= posY) { at = this.children[i]; break; } } if (at) { this.addChildBefore(child, at); } else { this.addChild(child); } }; _Assembler.AssemblerInstance.addClass(LinearLayout); var _default = LinearLayout; exports.default = _default;