![]() 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/DateTimeInput.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _ScalableComponent = _interopRequireDefault(require("../core/ScalableComponent")); var _FCore = require("../core/FCore"); var _inheritComponentClass = _interopRequireDefault(require("../core/inheritComponentClass")); var _InputAttributeHandlers = _interopRequireWildcard(require("./handlers/InputAttributeHandlers")); var _Assembler = require("../core/Assembler"); var _datetime = require("absol/src/Time/datetime"); var _InputStyleHandlers = _interopRequireDefault(require("./handlers/InputStyleHandlers")); function removeTimeFormat(format) { if (!format) return null; return format.replace(/[hH].+$/g, ''); } /*** * @extends ScalableComponent * @constructor */ function DateTimeInput() { _ScalableComponent.default.call(this); } (0, _inheritComponentClass.default)(DateTimeInput, _ScalableComponent.default); DateTimeInput.prototype.tag = 'DateTimeInput'; DateTimeInput.prototype.menuIcon = 'span.mdi.mdi-calendar-clock'; DateTimeInput.prototype.style.vAlign = 'center'; DateTimeInput.prototype.style.display = 'inline-block'; DateTimeInput.prototype.onCreate = function () { _ScalableComponent.default.prototype.onCreate.call(this); this.style.width = 174; this.style.height = 30; this.attributes.format = 'dd/MM/yyyy HH:mm'; }; Object.assign(DateTimeInput.prototype.attributeHandlers, _InputAttributeHandlers.default); Object.assign(DateTimeInput.prototype.styleHandlers, _InputStyleHandlers.default); DateTimeInput.prototype.attributeHandlers.format = { set: function (value) { this.$datetimeInput.format = value; if (this.$dateInput) this.$dateInput.format = removeTimeFormat(value); }, get: function () { return this.domElt.format; }, descriptor: { type: 'DateTimeFormat' }, export: function () { var value = this.format; if (value === 'dd/MM/yyyy HH:mm') return undefined; return value; } }; DateTimeInput.prototype.attributeHandlers.value = { set: function (value) { var prev = this.$datetimeInput.value; this.$datetimeInput.value = value; if (this.$dateInput) { this.$dateInput.value = this.$datetimeInput.value ? (0, _datetime.beginOfDay)(this.$datetimeInput.value) : null; } var cur = this.domElt.value; if (!prev !== !cur || prev && cur && prev.getTime() === cur.getTime()) { this.pinFire('value'); this.notifyChange(); } }, get: function () { return this.domElt.value; }, descriptor: { type: 'DateTime' }, export: function () { return this.value || undefined; } }; DateTimeInput.prototype.pinHandlers.value = { receives: function (value) { this.attributes.value = value; }, get: function () { return this.attributes.value; }, descriptor: { type: "Date" } }; DateTimeInput.prototype.attributeHandlers.dateOnly = { set: function (value) { value = !!value; var isDateOnly = this.$dateInput === this.domElt; if (isDateOnly === value) return; var oldElt = this.domElt; var prentElt = oldElt.parentElement; var newElt; if (value) { if (!this.$dateInput) { this.$dateInput = (0, _FCore._)({ tag: 'dateinput', class: 'as-base-component', on: { change: function () { this.$datetimeInput.value = this.$dateInput.value; this.pinFire('value'); this.notifyChange(); }.bind(this) } }); } newElt = this.$dateInput; if (this.$datetimeInput.value) { newElt.value = (0, _datetime.beginOfDay)(this.$datetimeInput.value); } else { newElt.value = null; } } else { newElt = this.$datetimeInput; } var style = Object.assign({}, this.style); if (prentElt) { oldElt.selfReplace(newElt); } this.domElt = newElt; Object.assign(this.style, style); this.pinFire('value'); this.notifyChange(); }, get: function () { return this.$dateInput === this.domElt; }, descriptor: { type: 'bool' } }; DateTimeInput.prototype.onCreated = function () { this.$dateInput = null; this.$datetimeInput.on('change', function () { this.pinFire('value'); this.notifyChange(); }.bind(this)); }; DateTimeInput.prototype.render = function () { this.$datetimeInput = (0, _FCore._)({ tag: 'datetimeinput' }); return this.$datetimeInput; }; DateTimeInput.prototype.createDataBindingDescriptor = function () { var thisC = this; return { configurable: true, set: function (value) { thisC.attributes.value = value; }, get: function () { return thisC.attributes.value; } }; }; _Assembler.AssemblerInstance.addClass(DateTimeInput); var _default = DateTimeInput; exports.default = _default;