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

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

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

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

var _Tooltip = _interopRequireDefault(require("./Tooltip"));

var _Clipboard = require("absol/src/HTML5/Clipboard");

var _Snackbar = _interopRequireDefault(require("./Snackbar"));

var _MultiLanguageText = _interopRequireDefault(require("./MultiLanguageText"));




/***
 * @extends {AElement}
 * @constructor
 */
function CopyableIconTooltip() {
  this._content = '';
  this.$content = null;
  this._value = '';
  this._icon = 'span.mdi.mdi-information-outline';
  this.$icon = (0, _ACore.$)('.as-cit-icon', this);
  this.tooltip = new TooltipController(this);
}

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

CopyableIconTooltip.render = function () {
  return (0, _ACore._)({
    tag: 'button',
    class: 'as-copyable-icon-tooltip',
    child: 'span.mdi.mdi-information-outline.as-cit-icon'
  });
};

CopyableIconTooltip.property = {};
CopyableIconTooltip.property.content = {
  set: function (value) {
    this._content = value || '';

    if (typeof this._content === "object") {
      this.$content = (0, _ACore._)(this._content);
    } else if (typeof this._content === "string") {
      this.$content = (0, _ACore._)({
        tag: 'span',
        style: {
          'white-space': 'pre-wrap'
        },
        props: {
          innerHTML: this._content
        }
      });

      _MultiLanguageText.default.replaceAll(this.$content);
    }
  },
  get: function () {
    return this._content;
  }
};
CopyableIconTooltip.property.icon = {
  set: function (value) {
    value = value || '';
    this._icon = value;
    this.clearChild();
    this.$icon = null;

    if (value) {
      if ((0, _Dom.isDomNode)(value)) {
        if (value.parentElement) value = value.cloneNode(true);
      } else value = (0, _ACore._)(value);

      this.$icon = (0, _ACore.$)(value).addClass('as-cit-icon');
      this.addChild(this.$icon);
    }
  },
  get: function () {
    return this._icon;
  }
};
CopyableIconTooltip.property.value = {
  set: function (value) {
    this._value = value;
  },
  get: function () {
    return this._value;
  }
};
/***
 *
 * @param {CopyableIconTooltip} elt
 * @constructor
 */

function TooltipController(elt) {
  /***
   *
   * @type {CopyableIconTooltip}
   */
  this.elt = elt;
  this.elt.on('mouseenter', this.ev_mouseEnter.bind(this));
  this.elt.on('mouseleave', this.ev_mouseLeave.bind(this));
  this.elt.on('click', this.ev_click.bind(this));
  this.session = -2;
  this.timeout = -1;
}

TooltipController.prototype.ev_mouseEnter = function () {
  clearTimeout(this.timeout);
  if (this.elt.$content) this.session = _Tooltip.default.show(this.elt, this.elt.$content, 'auto');
};

TooltipController.prototype.ev_mouseLeave = function () {
  this.timeout = setTimeout(() => {
    _Tooltip.default.close(this.session);
  }, 500);
};

TooltipController.prototype.ev_click = function () {
  var text;

  if (this.elt._value !== null && this.elt._value !== undefined) {
    text = this.elt._value + '';
  } else if (typeof this.elt._content === "string") {
    text = this.elt._content;
  } else {
    text = this.elt.$content.innerText;
  }

  (0, _Clipboard.copyText)(text);

  _Snackbar.default.show('Copied: ' + text);
};

var _default = CopyableIconTooltip;
exports.default = _default;

VaKeR 2022