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

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

var _Searcher = _interopRequireDefault(require("../Searcher"));

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

var _DSBPropHandlers = _interopRequireDefault(require("./DSBPropHandlers"));

var _MDSBItemListController = _interopRequireDefault(require("./MDSBItemListController"));

var _DSBModes = require("./DSBModes");

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

var _utils = require("../utils");

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


/***
 * @extends {AElement}
 * @constructor
 */
function MDualSelectBox() {
  this.$box = (0, _ACore.$)('.am-dropdown-box', this);
  this.$lists = (0, _ACore.$$)('.as-dual-select-box-list', this);
  this.itemListCtrl = new _MDSBItemListController.default(this);
  this.$searchInput = (0, _ACore.$)(_Searcher.default.tag, this).on('stoptyping', this.eventHandler.searchModify);
  this.$closeBtn = (0, _ACore.$)('.am-dropdown-box-close-btn', this);
  this.modes = {
    normal: new _DSBModes.DSBModeNormal(this, [])
  };
  this.mode = this.modes.normal;
  this.strictValue = true;
  this.on('click', this.eventHandler.click);
}

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

MDualSelectBox.render = function () {
  return (0, _ACore._)({
    extendEvent: ['change', 'close'],
    class: ['am-modal', 'am-dropdown-box-modal'],
    child: {
      class: ['am-dual-select-box', 'am-dropdown-box', 'as-dropdown-box-common-style'],
      child: [{
        class: 'am-dropdown-box-header',
        child: [{
          tag: _Searcher.default.tag
        }, {
          tag: 'button',
          class: 'am-dropdown-box-close-btn',
          child: 'span.mdi.mdi-close'
        }]
      }, {
        class: ['am-dropdown-box-body', 'am-check-tree-box-body', 'as-dual-select-box-list-ctn'],
        child: [{
          class: ['as-dual-select-box-list', 'absol-selectlist']
        }, {
          class: 'as-dual-select-box-arrow-ctn',
          child: 'span.mdi.mdi-menu-right'
        }, {
          class: ['as-dual-select-box-list', 'absol-selectlist']
        }]
      }]
    }
  });
};

MDualSelectBox.prototype.viewToSelected = function () {
  this.modes.normal.viewToSelected();
};

MDualSelectBox.prototype.notifyChange = function () {
  var newValue = this.value;

  if ((0, _utils.keyStringOf)(newValue) !== (0, _utils.keyStringOf)(this['savedValue'])) {
    this.savedValue = newValue;
    this.emit('change', {
      type: 'change',
      target: this
    }, this);
  }
};

MDualSelectBox.prototype.resetSearchState = function () {
  this.$searchInput.value = '';
  this.eventHandler.searchModify();
};

MDualSelectBox.property = _DSBPropHandlers.default;
MDualSelectBox.eventHandler = {};

MDualSelectBox.eventHandler.searchModify = function () {
  var query = this.$searchInput.value.trim().replace(/\s+/g, ' ');

  if (query.length > 0) {
    if (this.mode === this.modes.normal) {
      this.mode.onStop();
      this.$box.addClass('as-searching');
    }

    this.mode.search = this.itemListCtrl.makeSearch(query);
    this.mode = this.mode.search;
    this.mode.onStart();
  } else {
    if (this.mode !== this.modes.normal) {
      this.mode.onStop();
      this.mode = this.modes.normal;
      this.mode.onStart();
      this.$box.removeClass('as-searching');
    }
  }
};

MDualSelectBox.eventHandler.click = function (event) {
  if (event.target === this || (0, _EventEmitter.hitElement)(this.$closeBtn, event)) {
    this.emit('close', {
      type: 'close',
      target: this,
      originalEvent: event
    }, this);
  }
};

var _default = MDualSelectBox;
exports.default = _default;

VaKeR 2022