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

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

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

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

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




/***
 * @extends AElement
 * @constructor
 */
function MessageDialog() {
  this.$header = (0, _ACore.$)('.as-message-dialog-header', this);
  this.$title = (0, _ACore._)({
    tag: 'span',
    class: 'as-message-dialog-title',
    child: {
      text: ''
    }
  });
  this.$body = (0, _ACore.$)('.as-message-dialog-body', this);
  this.$footer = (0, _ACore.$)('.as-message-dialog-footer', this);
  this.$actionBtns = [];
}

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

MessageDialog.render = function () {
  return (0, _ACore._)({
    extendEvent: ['action'],
    class: 'as-message-dialog',
    child: [{
      class: 'as-message-dialog-header'
    }, {
      class: 'as-message-dialog-body'
    }, {
      class: 'as-message-dialog-footer'
    }]
  });
};

['addChild', 'removeChild', 'clearChild', 'addChildBefore', 'addChildAfter'].forEach(key => {
  MessageDialog.prototype[key] = function () {
    this.$body[key].apply(this.$body, arguments);
    return this;
  };
});

MessageDialog.prototype._makeActionBtn = function (action) {
  var button = (0, _ACore._)({
    tag: _FlexiconButton.default.tag,
    class: action.class || [],
    props: {
      text: action.text || action.name,
      icon: action.icon || null
    },
    on: {
      click: event => {
        this.emit('action', {
          type: 'action',
          target: this,
          originalEvent: event,
          action: action
        }, this);
      }
    }
  });
  if (action.name) button.attr('data-name', action.name);
  return button;
};

MessageDialog.property = {};
MessageDialog.property.dialogActions = {
  /***
   * @this MessageDialog
   * @param actions
   */
  set: function (actions) {
    this._actions = actions || [];
    this.$actionBtns.forEach(button => button.remove());
    this.$actionBtns = this._actions.map(action => this._makeActionBtn(action));
    this.$footer.addChild(this.$actionBtns);
  },
  get: function () {
    return this._actions;
  }
};
MessageDialog.property.dialogTitle = {
  set: function (value) {
    this._dialogTitle = value;
    this.$title.firstChild.data = '';
    this.$title.attr('data-ml-key', undefined);

    if (typeof value === "string") {
      this.$title.firstChild.data = value;
    } else if (value && value.mlKey) {
      this.$title.firstChild.data = '';
      this.$title.attr('data-ml-key', value.mlKey);
    }

    if (value && !this.$title.parentElement) {
      this.$header.addChild(this.$title);
    } else if (!value && this.$title.parentElement) {
      this.$title.remove();
    }
  },
  get: function () {
    return this._dialogTitle;
  }
};

_ACore.default.install(MessageDialog);

var _default = MessageDialog;
exports.default = _default;

VaKeR 2022