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

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

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

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

var _BoardTable = _interopRequireDefault(require("./BoardTable"));

var _Switch = _interopRequireDefault(require("./Switch"));

var _Board = _interopRequireDefault(require("./Board"));

var _EventEmitter = require("absol/src/HTML5/EventEmitter");




/***
 * @extends AElement
 * @constructor
 */
function MKNavigatorItem() {
  this._data = [];
  this.$text = (0, _ACore.$)('.mk-nav-item-text', this);
  this.$switchCtn = (0, _ACore.$)('.mk-nav-item-switch-ctn', this);
  this.$switch = (0, _ACore.$)('switch', this).on('change', this.eventHandler.switchChange);
  this.$dragzone = (0, _ACore.$)('.mk-nav-item-drag-zone', this);
  this.on('click', this.eventHandler.click);
}

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

MKNavigatorItem.render = function () {
  return (0, _ACore._)({
    tag: _Board.default.tag,
    class: 'mk-nav-item',
    extendEvent: ['checkedchange', 'press'],
    child: [{
      class: ['mk-nav-item-drag-zone', _BoardTable.default.DRAG_ZONE_CLASS_NAME],
      child: '<i class="material-icons">drag_indicator</i>'
    }, {
      class: 'mk-nav-item-text-ctn',
      child: {
        tag: 'span',
        class: 'mk-nav-item-text',
        child: {
          text: ''
        }
      }
    }, {
      class: 'mk-nav-item-switch-ctn',
      child: {
        tag: _Switch.default.tag
      }
    }]
  });
};

MKNavigatorItem.prototype.updateText = function () {
  this.$text.firstChild.data = this._data.text;
};

MKNavigatorItem.prototype.updateChecked = function () {
  if (typeof this._data.checked === "boolean") {
    this.$switchCtn.removeStyle('display');
    this.$switch.checked = this._data.checked;
  } else {
    this.$switchCtn.addStyle('display', 'none');
  }
};

MKNavigatorItem.prototype.updateDraggable = function () {
  if (this._data.draggable) {
    this.$dragzone.removeStyle('display');
  } else {
    this.$dragzone.addStyle('display', 'none');
  }
};

MKNavigatorItem.property = {};
MKNavigatorItem.property.data = {
  /**
   * @this MKNavigatorItem
   * @param data
   */
  set: function (data) {
    data = data || {};
    this._data = data;
    this.updateText();
    this.updateChecked();
    this.updateDraggable();
  },
  get: function () {
    return this._data;
  }
};
/***
 * @memberOf MKNavigatorItem#
 * @type {{}}
 */

MKNavigatorItem.eventHandler = {};

MKNavigatorItem.eventHandler.switchChange = function (event) {
  this._data.checked = this.$switch.checked;
  this.emit('checkedchange', {
    type: 'checkedchange'
  }, this);
};

MKNavigatorItem.eventHandler.click = function (event) {
  if ((0, _EventEmitter.hitElement)(this.$switch, event) || (0, _EventEmitter.hitElement)(this.$dragzone, event)) return;
  this.emit('press', {
    type: 'press',
    target: this,
    originalEvent: event
  }, this);
};

_ACore.default.install(MKNavigatorItem);

var _default = MKNavigatorItem;
exports.default = _default;

VaKeR 2022