![]() 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/layouts/ |
Upload File : |
import FCore from "../core/FCore"; import BaseLayout from "../core/BaseLayout"; import LinearAnchor from "../anchors/LinearAnchor"; import LinearAnchorEditor from "../anchoreditors/LinearAnchorEditor"; import {AssemblerInstance} from "../core/Assembler"; var _ = FCore._; function LinearLayout() { BaseLayout.call(this); } Object.defineProperties(LinearLayout.prototype, Object.getOwnPropertyDescriptors(BaseLayout.prototype)); LinearLayout.prototype.constructor = LinearLayout; 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.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.onCreate = function () { BaseLayout.prototype.onCreate.apply(this, arguments); this.style.overflowY = false; }; LinearLayout.prototype.getAnchorConstructor = function () { return LinearAnchor; }; LinearLayout.prototype.getAnchorEditorConstructor = function () { return LinearAnchorEditor; }; LinearLayout.prototype.render = function () { return _({ class: this.TOP_CLASS_NAME }); }; LinearLayout.prototype.onAddChild = function (child, index) { var anchor = new LinearAnchor(); anchor.attachChild(child); if (index == -1 || !this.view.childNodes[index]) { this.view.addChild(anchor.view); } else { this.view.addChildBefore(anchor.view, this.view.childNodes[index]); } }; LinearLayout.prototype.onRemoveChild = function (child, index) { var anchor = child.anchor; anchor.detachChild(); anchor.view.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); } }; AssemblerInstance.addClass(LinearLayout); export default LinearLayout;