![]() 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/FileInput.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _FCore = _interopRequireWildcard(require("../core/FCore")); var _ScalableComponent = _interopRequireDefault(require("../core/ScalableComponent")); var _inheritComponentClass = _interopRequireDefault(require("../core/inheritComponentClass")); require("../../css/imagefileinput.css"); var _utils = require("absol-acomp/js/utils"); var _Assembler = require("../core/Assembler"); var _FileInputBox = _interopRequireDefault(require("absol-acomp/js/FileInputBox")); var _ = _FCore.default._; /*** * @extends ScalableComponent * @constructor */ function FileInput() { _ScalableComponent.default.call(this); } (0, _inheritComponentClass.default)(FileInput, _ScalableComponent.default); FileInput.prototype.tag = "FileInput"; FileInput.prototype.menuIcon = "span.mdi.mdi-file-plus"; FileInput.prototype.style.vAlign = 'center'; FileInput.prototype.style.display = 'inline-block'; FileInput.prototype.attributes.allowUpload = true; FileInput.prototype.attributes.removable = true; FileInput.prototype.attributes.downloadable = true; FileInput.prototype.render = function () { return _({ tag: _FileInputBox.default.tag }); }; FileInput.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: { type: "FileSource", sign: 'FileSource' }, export: function () { return this.value || undefined; } }; FileInput.prototype.attributeHandlers.fileName = { set: function (value) { value = value || null; this.domElt.fileName = value; }, get: function () { return this.domElt.fileName; }, descriptor: { type: 'text' }, export: function () {} }; FileInput.prototype.pinHandlers.value = { get: function () { return this.attributes.value; }, descriptor: { type: "FileSource" } }; FileInput.prototype.attributeHandlers.allowUpload = { set: function (value) { this.domElt.allowUpload = value; }, get: function () { return this.domElt.allowUpload; }, descriptor: { type: 'bool' }, export: function () { return this.domElt.allowUpload ? undefined : false; } }; FileInput.prototype.attributeHandlers.removable = { set: function (value) { this.domElt.removable = value; }, get: function () { return this.domElt.removable; }, descriptor: { type: 'bool' }, export: function () { return this.domElt.removable ? undefined : false; } }; FileInput.prototype.attributeHandlers.downloadable = { set: function (value) { this.domElt.downloadable = value; }, get: function () { return this.domElt.downloadable; }, descriptor: { type: 'bool' }, export: function () { return this.domElt.downloadable ? undefined : false; } }; FileInput.prototype.attributeHandlers.accept = { set: function (value) { this.domElt.accept = value; }, get: function () { return this.domElt.accept; }, descriptor: { type: 'text' }, export: function () { return this.domElt.accept || undefined; } }; FileInput.prototype.attributeHandlers.directUpload = { descriptor: { type: 'bool' } }; FileInput.prototype.onCreated = function () { _ScalableComponent.default.prototype.onCreated.call(this); this.domElt.on('change', function () { this.pinFire('value'); this.notifyChange(); }.bind(this)); this.domElt.$input.on('click', function (event) { event.preventDefault(); this.openFileDialog(); }.bind(this)); }; FileInput.prototype.openFileDialog = function () { if (!this.attributes.directUpload && window.contentModule && window.contentModule.chooseFile) { window.contentModule.chooseFile({ accept: this.attributes.accept }).then(function (result) { if (result && result.length > 0) result = result[0]; if (result) { this.attributes.value = result; } }.bind(this)); } else { (0, _utils.openFileDialog)({ accept: this.attributes.accept }).then(function (files) { if (files && files.length > 0) { this.attributes.value = files[0]; } }.bind(this)); } }; FileInput.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(FileInput); var _default = FileInput; exports.default = _default;