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

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

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

require("../../css/keeview/owmodal.css");

var _Dom = require("absol/src/HTML5/Dom");

var _FlexiconButton = _interopRequireDefault(require("../FlexiconButton"));


function implicitNode(data) {
  if (!data) return (0, _ACore._)('div');

  if (data instanceof Array) {
    return data.map(implicitNode);
  } else if ((0, _Dom.isDomNode)(data)) {
    return data;
  } else if (typeof data === "string") {
    return (0, _ACore._)({
      tag: 'span',
      child: {
        text: data
      }
    });
  } else if (typeof data === "object") {
    return (0, _ACore._)(data);
  } else return (0, _ACore._)('div');
}
/***
 *
 * @constructor
 */


function OWModalManager() {}

OWModalManager.prototype.getView = function () {
  if (!this.$view) this.createView();
  return this.$view;
};

OWModalManager.prototype.createView = function () {
  this.$view = (0, _ACore._)('.kv-ow-modal-manager');
};

OWModalManager.prototype.createModal = function (opt, caller) {
  console.trace(1);
  opt = opt || {};
  var modal = (0, _ACore._)({
    class: 'kv-ow-modal',
    child: {
      class: 'kv-ow-modal-window',
      child: [{
        class: 'kv-ow-modal-header',
        child: [{
          class: 'kv-ow-modal-title',
          child: {
            text: 'Tiêu đề'
          }
        }]
      }, {
        class: 'kv-ow-modal-body',
        child: Array(3).fill({
          tag: 'span',
          child: {
            text: 'Bạn có chắc muốn thoát khỏi nhóm? Đây là nội dung hơi bị dài luôn nè'
          }
        })
      }, {
        class: 'kv-ow-modal-footer'
      }]
    }
  });
  modal.$body = (0, _ACore.$)('.kv-ow-modal-body', modal);
  modal.$title = (0, _ACore.$)('.kv-ow-modal-title', modal);
  modal.$footer = (0, _ACore.$)('.kv-ow-modal-footer', modal);

  if (modal.$title) {
    if (typeof opt.title === "string") {
      modal.$title.clearChild().addChild((0, _ACore._)({
        text: opt.title
      }));
    } else {
      modal.$title.clearChild().addChild(implicitNode(opt.title));
    }
  } else {
    modal.$title.addStyle('display', 'none');
  }

  modal.$body.clearChild();

  if (opt.content || opt.contentbody) {
    modal.$body.addChild(implicitNode(opt.content || opt.contentbody));
  }

  modal.$footer.clearChild();

  if (opt.buttons || opt.buttonlist) {
    modal.$footer.addChild((opt.buttons || opt.buttonlist).map(function (bt) {
      var props = Object.assign({}, bt);
      delete props.onclick;
      var onclick = bt.onclick;
      return (0, _ACore._)({
        tag: _FlexiconButton.default.tag,
        props: props,
        on: {
          click: function (event) {
            if (typeof onclick === "function") {
              onclick.call(this, event, modal, caller);
            }
          }
        }
      });
    }));
  }

  return modal;
};

OWModalManager.prototype.showModal = function (opt, caller) {
  var modal = this.createModal(opt, caller);
  var minZIndex = Array.prototype.reduce.call(this.getView(), function (ac, cr) {
    return Math.max(ac, parseFloat(cr.style.zIndex) || 0);
  }, 0);
  modal.addStyle('zIndex', minZIndex + 1 + '');
  this.$view.addChild(modal);
  return modal;
};

var _default = OWModalManager;
exports.default = _default;

VaKeR 2022