VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-full/dist/js/mdls__absol-form__js__layouts__RelativeLayout.js
/*** module: node_modules/absol-form/js/layouts/RelativeLayout.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _RelativeAnchor = _interopRequireDefault(require("./anchors/RelativeAnchor"));

var _FCore = _interopRequireDefault(require("../core/FCore"));

var _BaseLayout = _interopRequireDefault(require("../core/BaseLayout"));

var _RelativeAnchorEditor = _interopRequireDefault(require("../layouteditor/anchoreditors/RelativeAnchorEditor"));

var _Assembler = require("../core/Assembler");

var _inheritComponentClass = _interopRequireDefault(require("../core/inheritComponentClass"));

var _ResizeSystem = _interopRequireDefault(require("absol/src/HTML5/ResizeSystem"));

var _Rectangle = _interopRequireDefault(require("absol/src/Math/Rectangle"));


var _ = _FCore.default._;
/**
 * @extends BaseLayout
 * @constructor
 */

function RelativeLayout() {
  _BaseLayout.default.call(this);
}

(0, _inheritComponentClass.default)(RelativeLayout, _BaseLayout.default);
RelativeLayout.prototype.tag = 'RelativeLayout';
RelativeLayout.prototype.menuIcon = 'span.mdi.mdi-relative-scale';
RelativeLayout.prototype.TOP_CLASS_NAME = 'as-relative-layout';
RelativeLayout.prototype.SUPPORT_STYLE_NAMES = ['width', 'height']; //, 'left', 'right', 'top', 'bottom'];

RelativeLayout.prototype.AnchorClass = _RelativeAnchor.default;

RelativeLayout.prototype.render = function () {
  return _({
    class: this.TOP_CLASS_NAME,
    props: {
      requestUpdateSize: this._updateMinSizeStyle.bind(this)
    }
  });
};
/**
 *
 * @param {BaseComponent} child
 * @param index
 */


RelativeLayout.prototype.onAddChild = function (child, index) {
  var anchor = new _RelativeAnchor.default(child);

  if (index === -1 || !this.domElt.childNodes[index]) {
    this.domElt.addChild(child.domElt);
  } else {
    this.domElt.addChildBefore(child.domElt, this.domElt.childNodes[index]);
  }
};
/**
 *
 * @param {BaseComponent} child
 */


RelativeLayout.prototype.onRemoveChild = function (child) {
  child.domElt.remove();
  child.anchor.destroy();
};
/**
 * @param {BaseComponent} child,
 * @param {Number} posX
 * @param {Number} posY
 */


RelativeLayout.prototype.addChildByPosition = function (child, posX, posY) {
  this.addChild(child);
  var width = this.style.getProperty('width', 'px');
  var height = this.style.getProperty('height', 'px');
  var cWidth = child.style.getProperty('width', 'px');
  var cHeight = child.style.getProperty('height', 'px');
  posX = Math.max(0, Math.min(width - cWidth, posX));
  posY = Math.max(0, Math.min(height - cHeight, posY));
  child.style.left = posX;
  child.style.top = posY;
  child.style.vAlign = 'top';

  this._updateMinSizeStyle();
};

RelativeLayout.prototype.onStart = function () {
  _BaseLayout.default.prototype.onStart.apply(this);

  this._updateMinSizeStyle();
};

RelativeLayout.prototype.onResume = function () {
  _BaseLayout.default.prototype.onResume.apply(this);

  this._updateMinSizeStyle();
};

RelativeLayout.prototype.measureMinSize = function () {
  if (!this.domElt) return {
    width: 0,
    height: 0
  };
  var prevBound = this.domElt.getBoundingClientRect();
  var bound = this.children.reduce((ac, child) => {
    var cBound = _Rectangle.default.fromClientRect(child.domElt.getBoundingClientRect());

    return ac.merge(cBound);
  }, new _Rectangle.default(prevBound.left, prevBound.top, 0, 0));
  return {
    width: bound.width,
    height: bound.height
  };
};

RelativeLayout.prototype._updateMinSizeStyle = function () {
  var prevBound = this.domElt.getBoundingClientRect();
  var bound = this.children.reduce((ac, child) => {
    var cBound = _Rectangle.default.fromClientRect(child.domElt.getBoundingClientRect());

    if (cBound.width * cBound.height === 0) return ac;
    return ac.merge(cBound);
  }, new _Rectangle.default(prevBound.left, prevBound.top, 0, 0));
  this.domElt.addStyle('--as-min-width', bound.width + 'px');
  this.domElt.addStyle('--as-min-height', bound.height + 'px');
  this.updateViewStyle();
  var newBound = this.domElt.getBoundingClientRect();
  if (newBound.width !== prevBound.width || newBound.height !== prevBound.height) _ResizeSystem.default.updateUp(this.domElt.parentElement);
};

_Assembler.AssemblerInstance.addClass(RelativeLayout);

var _default = RelativeLayout;
exports.default = _default;

VaKeR 2022