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

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

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

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

var _AElement = _interopRequireDefault(require("absol/src/HTML5/AElement"));


var _ = _ACore.default._;
var $ = _ACore.default.$;
/***
 *
 * @extends {AElement}
 * @constructor
 */

function TrackBarInput() {
  var thisTI = this;
  this.$trackbar = $('trackbar', this);
  this.$input = $('flexiconinput', this);
  absol.OOP.drillProperty(this, this.$input, ['unit', 'icon']);
  this.$trackbar.on('change', function () {
    thisTI.$input.value = thisTI.value + '';
    thisTI.emit('change', thisTI.value);
  });
  this.$input.on('keyup', this.eventHandler.inputChange);
  this.inputTextWidth = 2;
  this.valueFixed = undefined;
  return this;
}

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

TrackBarInput.render = function () {
  return _({
    class: 'absol-trackbar-input',
    extendEvent: 'change',
    child: ['trackbar', 'flexiconinput']
  });
};

TrackBarInput.prototype.init = function (props) {
  props = props || {};
  props.leftValue = props.leftValue || 0;
  props.value = props.value || props.leftValue;
  Object.assign(this, props);
  this.value = props.value;
};

TrackBarInput.prototype._calInputTextWidth = function () {
  var l = Math.max(this.leftValue.toFixed(this.valueFixed || 0).length, this.rightValue.toFixed(this.valueFixed || 0).length, 2);

  if (this.valueFixed > 0) {
    l -= 0.8;
  }

  this.inputTextWidth = l;
};

TrackBarInput.prototype.addStyle = function (arg0, arg1) {
  if (arg0 === 'textAlign' || arg0 === 'text-align') {
    this.$input.addStyle('text-align', arg1);
    return this;
  } else {
    _AElement.default.prototype.addStyle.apply(this, arguments);

    return this;
  }
}; // absol.OOP.drillProperty(this, this.$trackbar, ['leftValue', 'rightValue']);


TrackBarInput.property = {};
TrackBarInput.property.leftValue = {
  set: function (value) {
    this.$trackbar.leftValue = value;

    this._calInputTextWidth();
  },
  get: function () {
    return this.$trackbar.leftValue;
  }
};
TrackBarInput.property.rightValue = {
  set: function (value) {
    this.$trackbar.rightValue = value;

    this._calInputTextWidth();
  },
  get: function () {
    return this.$trackbar.rightValue;
  }
};
TrackBarInput.property.value = {
  set: function (value) {
    this.$trackbar.value = value || 0;
    this.$input.value = this.value + '';
  },
  get: function () {
    return parseFloat((this.valueFixed === undefined ? this.$trackbar.value : this.$trackbar.value.toFixed(this.valueFixed)) + '');
  }
};
TrackBarInput.property.valueFixed = {
  set: function (value) {
    if (value === undefined || value === null) value = undefined;
    this._valueFixed = value;
    this.$input.value = this.value + '';

    this._calInputTextWidth();
  },
  get: function () {
    return this._valueFixed;
  }
};
TrackBarInput.property.inputTextWidth = {
  set: function (value) {
    if (typeof value == 'number') {
      this._inputTextWidth = value;
      this.addStyle('--input-width', 3 + (value - 2) * 0.42 + 0.3 + 'em');
    } else {
      this._inputTextWidth = value;
      this.addStyle('--input-width', value);
    }
  },
  get: function () {
    return this._inputTextWidth;
  }
};
TrackBarInput.property.disabled = {
  get: function () {
    return this.hasClass('as-disabled');
  },
  set: function (value) {
    if (value) {
      this.addClass('as-disabled');
    } else {
      this.removeClass('as-disabled');
    }

    this.$input.disabled = !!value;
    this.$trackbar.disabled = !!value;
  }
};
TrackBarInput.property.readOnly = {
  set: function (value) {
    value = !!value;

    if (value) {
      this.addClass('as-read-only');
    } else {
      this.removeClass('as-read-only');
    }

    this.$input.readOnly = value;
    this.$trackbar.readOnly = value;
  },
  get: function () {
    return this.hasClass('as-read-only');
  }
};
TrackBarInput.eventHandler = {};

TrackBarInput.eventHandler.inputChange = function (event) {
  var newValue = parseFloat(this.$input.value);

  if (!isNaN(newValue)) {
    newValue = Math.max(this.leftValue, Math.min(this.rightValue, newValue));
    this.$trackbar.value = newValue;
    this.emit('change', this.value);
  }
};

var _default = TrackBarInput;
exports.default = _default;

VaKeR 2022