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

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

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

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

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


var _ = _Core.default._;
var $ = _Core.default.$;

function MMatMenuItem() {
  this.$node = $('mmatmenubutton', this).on('click', this.eventHandler.clickNode);

  _OOP.default.drillProperty(this, this.$node, ['icon', 'text']);
  /**
   * @type {import('./MMatMenu').default}
   */


  this.$matmenu = $('mmatmenu', this).on('press', this.eventHandler.itemPress);
  this.$dropdown = $('.am-mat-menu-dropdown', this);
}

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

MMatMenuItem.render = function () {
  return _({
    extendEvent: ['press'],
    class: 'am-mat-menu-item',
    child: [{
      tag: 'mmatmenubutton'
    }, {
      class: 'am-mat-menu-dropdown',
      child: {
        tag: 'mmatmenu'
      }
    }]
  });
};

MMatMenuItem.prototype.getNode = function () {
  return this.$node;
};

MMatMenuItem.prototype.openChild = function () {
  this.$node.status = 'open';
  this.addClass('am-status-open');
  var menuBound = this.$matmenu.getBoundingClientRect();
  this.$dropdown.addStyle('max-height', menuBound.height + 2 + 'px');
};

MMatMenuItem.prototype.closeChild = function () {
  this.$node.status = 'close';
  this.removeClass('am-status-open');
  this.$dropdown.removeStyle('max-height');
};

MMatMenuItem.prototype.toggleChild = function () {
  if (this.$node.status == 'open') {
    this.closeChild();
  } else if (this.$node.status == 'close') {
    this.openChild();
  }
};

MMatMenuItem.prototype.notifyPress = function (args) {
  this.emit('press', Object.assign({
    target: this,
    type: 'press',
    item: this,
    menuItem: this
  }, args || {}), this);
};

MMatMenuItem.property = {};
MMatMenuItem.property.items = {
  set: function (items) {
    items = items || [];
    if (items.length > 0) this.$node.status = 'close';else this.$node.status = 'none';
    this.$matmenu.items = items;
    this.level = this.level; // update
  },
  get: function () {
    return this.$matmenu.items;
  }
};
MMatMenuItem.property.level = {
  set: function (value) {
    this.$node.level = value;
    value = this.$node.level;

    for (var i = 0; i < this.$matmenu.childNodes.length; ++i) {
      this.$matmenu.childNodes[i].level = value + 1;
    }
  },
  get: function () {
    return this.$node.level;
  }
};
/**
 * @type {MMatMenuItem}
 */

MMatMenuItem.eventHandler = {};

MMatMenuItem.eventHandler.clickNode = function (event) {
  if (this.$node.status == 'none') {
    //todo
    this.notifyPress();
  } else {
    this.toggleChild();
  }
};

MMatMenuItem.eventHandler.itemPress = function (event) {
  this.notifyPress(event);
};

_Core.default.install(MMatMenuItem);

var _default = MMatMenuItem;
exports.default = _default;

VaKeR 2022