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-form__js__components__NumberInput.js
/*** module: node_modules/absol-form/js/components/NumberInput.js ***/
"use strict";

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

var _FCore = _interopRequireDefault(require("../core/FCore"));

var _ScalableComponent = _interopRequireDefault(require("../core/ScalableComponent"));

var _inheritComponentClass = _interopRequireDefault(require("../core/inheritComponentClass"));

var _InputAttributeHandlers = _interopRequireWildcard(require("./handlers/InputAttributeHandlers"));

var _Assembler = require("../core/Assembler");

var _InputStyleHandlers = _interopRequireDefault(require("./handlers/InputStyleHandlers"));

var _utils = require("absol-acomp/js/utils");




var _ = _FCore.default._;
/***
 * @extends ScalableComponent
 * @constructor
 */

function NumberInput() {
  _ScalableComponent.default.call(this);
}

(0, _inheritComponentClass.default)(NumberInput, _ScalableComponent.default);
NumberInput.prototype.tag = "NumberInput";
NumberInput.prototype.menuIcon = 'span.mdi.mdi-numeric-2-box-outline';
NumberInput.prototype.SUPPORT_ATTRIBUTE_NAMES = ['value'];
NumberInput.prototype.SUPPORT_EVENT_NAMES = ['change'];
NumberInput.prototype.attributes.floatFixed = 'auto';
NumberInput.prototype.style.vAlign = 'center';
NumberInput.prototype.style.display = 'inline-block';
NumberInput.prototype.style.textAlign = 'default';
Object.assign(NumberInput.prototype.attributeHandlers, _InputAttributeHandlers.default);
Object.assign(NumberInput.prototype.styleHandlers, _InputStyleHandlers.default);
NumberInput.prototype.attributeHandlers.value = {
  set: function (value) {
    var prev = this.domElt.value;
    this.domElt.value = value;

    if (prev !== this.domElt.value) {
      this.pinFire('value');
      this.notifyChange();
    }
  },
  get: function () {
    return this.domElt.value;
  },
  descriptor: function () {
    return {
      type: "number",
      max: this.attributes.max,
      min: this.attributes.min
    };
  }
};
NumberInput.prototype.attributeHandlers.min = {
  set: function (value) {
    if (!(0, _utils.isRealNumber)(value)) value = -Infinity;
    this.domElt.min = value;
  },
  get: function () {
    return this.domElt.min;
  },
  descriptor: function () {
    return {
      type: "number",
      nullable: true,
      defaultValue: -1e12
    };
  },
  export: function () {
    var value = this.attributes.min;
    if (value === -Infinity) return undefined;
    return value;
  }
};
NumberInput.prototype.attributeHandlers.max = {
  set: function (value) {
    if (!(0, _utils.isRealNumber)(value)) value = Infinity;
    this.domElt.max = value;
  },
  get: function () {
    return this.domElt.max;
  },
  descriptor: function () {
    return {
      type: "number",
      nullable: true,
      defaultValue: 1e12
    };
  },
  export: function () {
    var value = this.attributes.max;
    if (value === Infinity) return undefined;
    return value;
  }
};
NumberInput.prototype.attributeHandlers.floatFixed = {
  set: function (value) {
    if (value !== 'auto' && !(value >= 0 && value < 20)) value = 'auto';
    this.domElt.floatFixed = value === 'auto' ? null : value;
    return value;
  },
  descriptor: {
    type: "enum",
    values: ['auto', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
  },
  export: function () {
    var value = this.attributes.floatFixed;
    if (value !== 'auto' && !(value >= 0 && value < 20)) value = undefined;
    return value;
  }
};
NumberInput.prototype.attributeHandlers.step = {
  set: function (value) {
    this.domElt.step = value;
  },
  get: function () {
    return this.domElt.step;
  },
  descriptor: {
    type: 'number',
    min: 0
  },
  export: function () {
    var value = this.domElt.step;
    if (value === 1) return undefined;
    return value;
  }
};
NumberInput.prototype.pinHandlers.value = {
  receives: function (value) {
    this.attributes.value = value;
  },
  get: function () {
    return this.domElt.value;
  },
  descriptor: {
    type: 'number'
  }
};
NumberInput.prototype.pinHandlers.min = {
  receives: function (value) {
    this.attributes.min = value;
  },
  descriptor: {
    type: 'number'
  }
};
NumberInput.prototype.pinHandlers.max = {
  receives: function (value) {
    this.attributes.max = value;
  },
  descriptor: {
    type: 'number'
  }
};
NumberInput.prototype.pinHandlers.userModified = {
  get: function () {
    return true;
  }
};

NumberInput.prototype.onCreate = function () {
  _ScalableComponent.default.prototype.onCreate.call(this);
};

NumberInput.prototype.onCreated = function () {
  _ScalableComponent.default.prototype.onCreated.call(this);

  var self = this;
  this.domElt.on('change', function (event) {
    self.pinFire('userModified');
    self.pinFire('value');
    self.notifyChange();
  });
  this.view._debug = true;
};

NumberInput.prototype.render = function () {
  return _('numberinput');
};

NumberInput.prototype.createDataBindingDescriptor = function () {
  var thisC = this;
  return {
    configurable: true,
    set: function (value) {
      thisC.setAttribute('value', value);
    },
    get: function () {
      return thisC.getAttribute('value');
    }
  };
};

_Assembler.AssemblerInstance.addClass(NumberInput);

var _default = NumberInput;
exports.default = _default;

VaKeR 2022