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-acomp__js__DropPanel.js
/*** module: node_modules/absol-acomp/js/DropPanel.js ***/
"use strict";

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

require("../css/droppanel.css");

var _ACore = _interopRequireDefault(require("../ACore"));

var _OOP = _interopRequireDefault(require("absol/src/HTML5/OOP"));

var _AElement = _interopRequireDefault(require("absol/src/HTML5/AElement"));

var _ExpTree = require("./ExpTree");


var _ = _ACore.default._;
var $ = _ACore.default.$;
/**
 * @extends AElement
 * @constructor
 */

function DropPanel() {
  var thisDP = this;
  /***
   *
   * @type {ExpGroup}
   */

  this.$body = $('.absol-drop-panel-body', this);
  this.$head = $('.absol-drop-panel-head', this).on('click', thisDP.eventHandler.clickHead);
  this.$name = $('.absol-drop-panel-name', thisDP);

  _OOP.default.drillProperty(this, this.$name, 'name', 'innerHTML');

  return thisDP;
}

DropPanel.tag = 'DropPanel'.toLowerCase();

DropPanel.render = function () {
  return _({
    class: 'absol-drop-panel',
    extendEvent: ['toggle'],
    child: [{
      class: 'absol-drop-panel-head',
      child: ['toggler-ico', {
        tag: 'span',
        class: "absol-drop-panel-name"
      }]
    }, {
      tag: 'expgroup',
      class: ['absol-drop-panel-body', 'absol-bscroller']
    }]
  });
};

DropPanel.eventHandler = {};

DropPanel.eventHandler.clickHead = function (event) {
  if (!this._childOfButton(event.target)) {
    var event = {
      target: this,
      isShowed: this.show,
      preventDefault: function () {
        this.prevented = true;
      }
    };
    this.emit('toggle', event, this);

    if (!event.prevented) {
      this.toggle();
    }
  }
};

['findChildBefore', 'findChildAfter', 'removeChild', 'clearChild', 'addChild'].forEach(function (key) {
  DropPanel.prototype[key] = function () {
    this.$body[key].apply(this.$body, arguments);
  };
});

DropPanel.prototype._childOfButton = function (elt) {
  while (elt && elt != this) {
    if (elt.tagName == "BUTTON") {
      return true;
    }

    elt = elt.parentElement;
  }

  return false;
};

DropPanel.prototype.toggle = function () {
  this.show = !this.show;
};

DropPanel.property = {};
DropPanel.property.show = {
  set: function (value) {
    if (value) {
      var maxHeight = parseFloat(this.getComputedStyleValue('max-height').replace('px', ''));
      var headBound = this.$head.getBoundingClientRect();

      if (maxHeight != 'none' && maxHeight != 'auto') {
        this.$body.addStyle('max-height', maxHeight - headBound.height + 'px');
      }

      this.$body.addStyle('height', this.$body.scrollHeight + 'px');
      setTimeout(function () {
        this.$body.removeStyle('height');
        window.dispatchEvent(new Event('resize'));
      }.bind(this), 200);
      this.addClass('show');
    } else {
      this.$body.addStyle('height', this.$body.scrollHeight + 'px');
      setTimeout(function () {
        this.$body.addStyle('height', '0');
      }.bind(this), 0);
      setTimeout(function () {
        this.$body.removeStyle('height');
        window.dispatchEvent(new Event('resize'));
      }.bind(this), 200);
      this.removeClass('show');
    }
  },
  get: function () {
    return this.hasClass('show');
  }
};

_ACore.default.install(DropPanel);

var _default = DropPanel;
exports.default = _default;

VaKeR 2022