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-mobile__js__dom__MCabinetTree.js
/*** module: node_modules/absol-mobile/js/dom/MCabinetTree.js ***/
"use strict";

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

var _Core = _interopRequireWildcard(require("./Core"));

var _MCabinetTreeNode = _interopRequireDefault(require("./MCabinetTreeNode"));

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

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

var _search = _interopRequireDefault(require("absol-acomp/js/list/search"));




/***
 * @extends AElement
 * @constructor
 */
function MCabinetTree() {
  this.$node = (0, _Core.$)(_MCabinetTreeNode.default.tag, this).on('toggle', this.eventHandler.toggle).on('click', this.eventHandler.click);
  this.$children = (0, _Core.$)('.am-cabinet-tree-children', this);

  _OOP.default.drillProperty(this, this.$node, ['content', 'quickmenu']);
  /***
   * @type {number}
   * @name level
   * @memberOf MCabinetTree#
   */

}

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

MCabinetTree.render = function () {
  return (0, _Core._)({
    extendEvent: ['click'],
    class: 'am-cabinet-tree',
    child: [{
      tag: _MCabinetTreeNode.default.tag
    }, {
      class: 'am-cabinet-tree-children'
    }]
  });
};

MCabinetTree.prototype._updateChildClass = function () {
  if (this.$children.childNodes.length > 0) {
    this.addClass('am-has-children');
  } else {
    this.removeClass('am-has-children');
  }
};

MCabinetTree.prototype.addChild = function (child) {
  if (child && child.forEach) {
    child.forEach(function (c) {
      this.addChild(c);
    }.bind(this));
    return this;
  }

  this.$children.addChild(child);
  child.level = this.level + 1;

  this._updateChildClass();
};

MCabinetTree.prototype.getSearchingItem = function () {
  var text = this.$node.getSearchingText();
  var value = this;
  var items = Array.prototype.map.call(this.$children.childNodes, function (subTree) {
    return subTree.getSearchingItem();
  });
  var res = {
    text: text,
    value: value
  };
  if (items.length > 0) res.items = items;
  return (0, _search.default)(res);
};

MCabinetTree.property = {};
MCabinetTree.property.level = {
  set: function (value) {
    this.$node.level = value;
    Array.prototype.forEach.call(this.$children.childNodes, function (treeElt) {
      treeElt.level = value + 1;
    });
  },
  get: function () {
    return this.$node.level;
  }
};
MCabinetTree.property.opened = {
  set: function (value) {
    if (value) {
      this.addClass('am-opened');
    } else {
      this.removeClass('am-opened');
    }
  },
  get: function () {
    return this.hasClass('am-opened');
  }
};
/***
 * @memberOf MCabinetTree#
 * @type {{}}
 */

MCabinetTree.eventHandler = {};

MCabinetTree.eventHandler.toggle = function (event) {
  this.opened = !this.opened;
};

MCabinetTree.eventHandler.click = function (event) {
  this.emit('click', event, this);
};

_Core.default.install(MCabinetTree);

var _default = MCabinetTree;
exports.default = _default;

VaKeR 2022