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

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

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

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

var _SelectListItem = require("./SelectListItem");

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

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



/***
 * @extends ExpNode
 * @constructor
 */
function CheckTreeItem() {
  this._itemData = null;
  this.$name = (0, _ACore.$)('span.absol-exp-node-name', this);
  this.$desc = (0, _ACore.$)('span.absol-exp-node-desc', this);
  this.$iconCtn = (0, _ACore.$)('div.absol-exp-node-ext-icon', this);
  this.$level = (0, _ACore.$)('.absol-exp-node-level', this);
  this.$checkbox = (0, _ACore.$)('checkboxbutton', this).on('change', this.eventHandler.checkboxChange);
  this.$toggleIcon = (0, _ACore.$)('toggler-ico', this);
  this.on('click', this.eventHandler.click);
}

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

CheckTreeItem.render = function () {
  return (0, _ACore._)({
    tag: 'button',
    extendEvent: ['select', 'presstoggle'],
    class: ['as-check-tree-item', 'absol-exp-node'],
    child: ['.absol-exp-node-level', 'toggler-ico', 'checkboxbutton', 'img.absol-exp-node-ext-icon', 'div.absol-exp-node-ext-icon', 'span.absol-exp-node-name', 'span.absol-exp-node-desc']
  });
};

CheckTreeItem.property = {};
CheckTreeItem.property.icon = _ExpTree.ExpNode.property.icon;
CheckTreeItem.property.text = _ExpTree.ExpNode.property.name;
CheckTreeItem.property.level = _ExpTree.ExpNode.property.level;
CheckTreeItem.property.desc = _ExpTree.ExpNode.property.desc;
CheckTreeItem.property.status = _ExpTree.ExpNode.property.status;
CheckTreeItem.property.data = {
  set: function (itemData) {
    this._itemData = itemData;
    var text = (0, _SelectListItem.getTextOfListItem)(itemData);
    this.text = text;
    this.attr('title', itemData.value + '');
    var desc = (0, _SelectListItem.getDescriptionOfListItem)(itemData);
    this.desc = desc;

    if (itemData && itemData.icon) {
      this.icon = itemData.icon;
    } else {
      this.icon = null;
    }

    this.noSelect = itemData.noSelect;
  },
  get: function () {
    return this._itemData;
  }
};
CheckTreeItem.property.selected = {
  set: function (value) {
    this._selected = value;
    this.$checkbox.disabled = value === 'empty';

    if (value === 'all') {
      this.$checkbox.minus = false;
      this.$checkbox.checked = true;
    } else if (value === 'child') {
      this.$checkbox.checked = false;
      this.$checkbox.minus = true;
    } else if (value === 'empty') {
      this.$checkbox.minus = false;
      this.$checkbox.checked = false;
    } else {
      this.$checkbox.minus = false;
      this.$checkbox.checked = false;
    }
  },
  get: function () {
    if (this.$checkbox.disabled) return 'empty';
    if (this.$checkbox.checked) return 'all';else if (this.$checkbox.minus) return 'child';
    return 'none';
  }
};
CheckTreeItem.property.noSelect = {
  set: function (value) {
    if (value) {
      this.addClass('as-no-select');
    } else {
      this.removeClass('as-no-select');
    }
  },
  get: function () {
    return this.hasClass('as-no-select');
  }
};
CheckTreeItem.eventHandler = {};

CheckTreeItem.eventHandler.checkboxChange = function (event) {
  this.emit('select', {
    type: 'select',
    target: this,
    originalEvent: event.originalEvent || event.originEvent || event
  });
};

CheckTreeItem.eventHandler.click = function (event) {
  var tBound;

  if (this.status === 'open' || this.status === 'close') {
    tBound = this.$toggleIcon.getBoundingClientRect();

    if (event.clientX <= tBound.right || this.noSelect) {
      this.emit('presstoggle', {
        type: 'presstoggle',
        target: this,
        originalEvent: event
      }, this);
    } else if (!(0, _EventEmitter.hitElement)(this.$checkbox, event) && !this.$checkbox.disabled) {
      this.$checkbox.checked = !this.$checkbox.checked;
      this.eventHandler.checkboxChange(event);
    }
  } else {
    if (!(0, _EventEmitter.hitElement)(this.$checkbox, event) && !this.noSelect && !this.$checkbox.disabled) {
      this.$checkbox.checked = !this.$checkbox.checked;
      this.eventHandler.checkboxChange(event);
    }
  }
};

_ACore.default.install(CheckTreeItem);

var _default = CheckTreeItem;
exports.default = _default;

VaKeR 2022