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-tutor__js__scriptor__ShowToastMessage.js
/*** module: node_modules/absol-tutor/js/scriptor/ShowToastMessage.js ***/
"use strict";

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

var _Toast = _interopRequireDefault(require("absol-acomp/js/Toast"));

var _TutorNameManager = _interopRequireDefault(require("./TutorNameManager"));

var _BaseCommand = _interopRequireDefault(require("./BaseCommand"));

var _OOP = _interopRequireDefault(require("absol/src/HTML5/OOP"));

var _TACData = _interopRequireDefault(require("./TACData"));

var _TCommand = require("../engine/TCommand");

var _TutorEngine = _interopRequireDefault(require("./TutorEngine"));

var _BaseState = _interopRequireDefault(require("./BaseState"));


/****
 * @extends BaseState
 * @constructor
 */
function StateShowMessage() {
  _BaseState.default.apply(this, arguments);
}

_OOP.default.mixClass(StateShowMessage, _BaseState.default);

StateShowMessage.prototype.onStart = function () {
  var title = this.args.title;
  var text = this.args.text;
  var variant = this.args.variant;
  var avoid = this.args.avoid;
  var disappearTimeout = this.args.disappearTimeout;
  var pos = 'se';

  if (["se", "sw", "ne", "nw", 'sc'].indexOf(avoid) >= 0) {
    pos = avoid;
  }

  this.command.$toast = _Toast.default.make({
    class: ['as-variant-background', 'atr-toast-message'],
    props: {
      htitle: title,
      disappearTimeout: disappearTimeout,
      variant: variant,
      timeText: ''
    },
    child: _BaseCommand.default.prototype.md2HTMLElements.call({
      $htmlRender: _BaseCommand.default.prototype.$htmlRender
    }, text)
  }, pos);
  this.command.avoidOverlay();
  this.goto('wait_until');
};
/****
 * @extends BaseState
 * @constructor
 */


function StateWaitUntil() {
  _BaseState.default.apply(this, arguments);
}

_OOP.default.mixClass(StateWaitUntil, _BaseState.default);

StateWaitUntil.prototype.onStart = function () {
  var until = this.args.until;
  if (!until) until = Promise.resolve();

  if (typeof until === 'number') {
    until = new Promise(function (resolve) {
      setTimeout(resolve, until);
    });
  } else if (typeof until === "function") {
    until = until();
  }

  if (until.depthClone) until = until.depthClone();
  if (until.exec) until = until.exec();

  if (until.then) {
    until.then(this.goto.bind(this, 'finish'));
  } else {
    this.goto('finish');
  }
};
/***
 * @extends BaseCommand
 * @constructor
 */


function ShowToastMessage() {
  _BaseCommand.default.apply(this, arguments);

  this.$toast = null;
}

(0, _TCommand.inheritCommand)(ShowToastMessage, _BaseCommand.default);
ShowToastMessage.prototype.argNames = ['title', 'text', 'disappearTimeout', 'until', 'variant', 'avoid'];
ShowToastMessage.prototype.name = 'showToastMessage';
ShowToastMessage.prototype.stateClasses.entry = StateShowMessage;
ShowToastMessage.prototype.stateClasses.wait_until = StateWaitUntil;
/***
 *
 * @protected
 */

ShowToastMessage.prototype.avoidOverlay = function () {
  var thisC = this;
  var avoidElt = null;

  this._toastElts.push(this.$toast);

  if (this.args.avoid) {
    if (["se", "sw", "ne", "nw"].indexOf(this.args.avoid) < 0) {
      avoidElt = this.args.avoid && this.tutor.findNode(this.args.avoid, true);
      if (avoidElt) thisC.assignTarget(avoidElt);
      setTimeout(function () {
        avoidElt = avoidElt || thisC.args.avoid && thisC.tutor.findNode(thisC.args.avoid, true);
        if (avoidElt) thisC.assignTarget(avoidElt);
      }, 3);
    }
  }
};

_TutorEngine.default.installClass(ShowToastMessage);

_TutorEngine.default.installClass(ShowToastMessage);

_TutorNameManager.default.addAsync('showToastMessage');

_TACData.default.define('showToastMessage', {
  type: 'function',
  args: [{
    name: 'title',
    type: 'string'
  }, {
    name: 'text',
    type: 'MarkdownString'
  }, {
    name: 'disappearTimeout',
    type: 'number'
  }, {
    name: 'until',
    type: 'Trigger'
  }, {
    name: 'variant',
    type: 'VariantColorNamesMap'
  }, {
    name: 'avoid?',
    type: '(string|AElement)'
  }],
  desc: 'VariantColorNamesMap("primary" | "secondary" | "success" | "info" | "warning" | "error" | "danger" | "light" | "dark" | "link" | "note")'
});

var _default = ShowToastMessage;
exports.default = _default;

VaKeR 2022