![]() 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 : |
/*** module: node_modules/absol-form/js/components/DateInput.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 _datetime = require("absol/src/Time/datetime"); var _inheritComponentClass = _interopRequireDefault(require("../core/inheritComponentClass")); var _InputAttributeHandlers = _interopRequireWildcard(require("./handlers/InputAttributeHandlers")); var _Assembler = require("../core/Assembler"); var _InputStyleHandlers = _interopRequireDefault(require("./handlers/InputStyleHandlers")); var _DateInput = _interopRequireDefault(require("absol-acomp/js/DateInput2")); var _ = _FCore.default._; var dateKeyOf = date => { if (!date) return 'NULL'; if (date.getTime) return (0, _datetime.beginOfDay)(date).toString(); return date + ''; }; /*** * @extends ScalableComponent * @constructor */ function DateInput() { _ScalableComponent.default.call(this); } (0, _inheritComponentClass.default)(DateInput, _ScalableComponent.default); DateInput.prototype.tag = "DateInput"; DateInput.prototype.menuIcon = "span.mdi.mdi-calendar-edit"; DateInput.prototype.SUPPORT_EVENT_NAMES = ['change']; Object.assign(DateInput.prototype.attributeHandlers, _InputAttributeHandlers.default); Object.assign(DateInput.prototype.styleHandlers, _InputStyleHandlers.default); DateInput.prototype.style.vAlign = 'center'; DateInput.prototype.style.display = 'inline-block'; DateInput.prototype.style.width = 150; DateInput.prototype.style.height = 30; DateInput.prototype.attributes.value = null; DateInput.prototype.attributeHandlers.value = { set: function (value) { var prevKey = dateKeyOf(this.domElt.value); value = (0, _datetime.implicitDate)(value); if (value) value = (0, _datetime.beginOfDay)(value); this.domElt.value = value; var cur = dateKeyOf(this.domElt.value); if (prevKey !== cur) { this.pinFire('value'); this.notifyChange(); } }, get: function () { return this.view.value; }, descriptor: { type: 'date', nullable: true, // defaultValue: beginOfDay(new Date()),//?? sign: 'SimpleDate' }, export: function () { if (this.domElt.notNull && !this.domElt._value) return undefined; //this is auto, not assign var value = this.domElt.value; if (!value) return undefined; return value; } }; DateInput.prototype.attributeHandlers.min = { set: function (value) { value = (0, _datetime.implicitDate)(value); this.domElt.min = value; }, get: function () { return this.domElt.min; }, descriptor: { type: 'date', nullable: true, sign: 'date_min' }, export: function () { var value = this.domElt.min; if (!value) return undefined; if ((0, _datetime.compareDate)(value, new Date(1890, 0, 1, 0, 0, 0, 0)) === 0) return undefined; return value; } }; DateInput.prototype.attributeHandlers.max = { set: function (value) { value = (0, _datetime.implicitDate)(value); this.domElt.max = value; }, get: function () { return this.domElt.max; }, descriptor: { type: 'date', nullable: true, sign: 'date_min' }, export: function () { var value = this.domElt.max; if (!value) return undefined; if ((0, _datetime.compareDate)(value, new Date(2090, 0, 1, 0, 0, 0, 0)) === 0) return undefined; if (_DateInput.default) return value; } }; DateInput.prototype.attributeHandlers.format = { set: function (value) { this.domElt.format = value || 'dd/MM/yyyy'; }, get: function () { return this.domElt.format; }, descriptor: { type: 'enum', values: ['dd/MM/yyyy', 'MM/dd/yyyy', 'yyyy/MM/dd', 'dd-MM-yyyy', 'MM-dd-yyyy', 'MM/yyyy', 'MM-yyyy', 'yyyy'] } }; DateInput.prototype.attributeHandlers.notNull = { set: function (value) { this.domElt.notNull = !!value; }, get: function () { return this.domElt.notNull; }, export: function () { return this.domElt.notNull || undefined; }, descriptor: { type: 'bool', sign: 'value_not_null' } }; DateInput.prototype.pinHandlers.min = { receives: function (value) { this.domElt.min = (0, _datetime.implicitDate)(value); }, descriptor: { type: "Date" } }; DateInput.prototype.pinHandlers.max = { receives: function (value) { value = (0, _datetime.implicitDate)(value); this.domElt.max = value; }, descriptor: { type: "Date" } }; DateInput.prototype.pinHandlers.value = { receives: function (value) { this.attributes.value = value; }, get: function () { return this.domElt.value; }, descriptor: { type: "Date" } }; DateInput.prototype.render = function () { return _('dateinput'); }; DateInput.prototype.onCreated = function () { _ScalableComponent.default.prototype.onCreated.call(this); this.domElt.on('change', this.ev_inputChange.bind(this)); }; DateInput.prototype.measureMinSize = function () { return { width: 75, height: 16 }; }; DateInput.prototype.verify = function () { if (!this.attributes.required) return { completed: true }; var value = this.attributes.value; if (value === null) { return { completed: false, comp: this }; } }; DateInput.prototype.createDataBindingDescriptor = function () { var thisC = this; return { configurable: true, set: function (value) { thisC.setAttribute('value', value); }, get: function () { return thisC.getAttribute('value'); } }; }; DateInput.prototype.ev_inputChange = function () { this.pinFire('value'); this.notifyChange(); }; _Assembler.AssemblerInstance.addClass(DateInput); var _default = DateInput; exports.default = _default;