![]() 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-form/js/components/ |
Upload File : |
import FCore, {$, _} from "../core/FCore"; import {AssemblerInstance} from "../core/Assembler"; import inheritComponentClass from "../core/inheritComponentClass"; import ScalableComponent from "../core/ScalableComponent"; /*** * @extends ScalableComponent * @constructor */ function FileListInput() { ScalableComponent.call(this); this._prevFiles = []; } inheritComponentClass(FileListInput, ScalableComponent); FileListInput.prototype.tag = 'FileListInput'; FileListInput.prototype.menuIcon = 'span.mdi.mdi-file-multiple-outline'; FileListInput.prototype.render = function () { var self = this; var elt = _({ tag: 'filelistinput', props: { droppable: false }, on: { change: function () { self.pinFire('files'); } } }); elt.$addedFile.on('click', function (event) { if (window.contentModule && window.contentModule.chooseFile && !self.attributes.useSystemDialog) { event.preventDefault(); window.contentModule.chooseFile({accept: this.attributes.accept}).then(function (result) { if (result) { elt.add(result); self.pinFire('files'); } }); } }); return elt; }; FileListInput.prototype.style.height = 100; FileListInput.prototype.style.width = 100; FileListInput.prototype.attributeHandlers.files = { set: function (files) { files = files || []; var changed = this._prevFiles.length !== files.length; if (!changed) { for (var i = 0; i < this._prevFiles.length && !changed; ++i) { if (files[i] === this._prevFiles[i]) changed = true; } } this._prevFiles = files.slice(); if (changed) { this.domElt.files = files; this.pinFire('files'); } }, get: function () { return this.domElt.files; }, descriptor: { type: 'file[]' } }; FileListInput.prototype.attributeHandlers.readOnly = { set: function (value) { this.domElt.readOnly = !!value; }, get: function () { return this.domElt.readOnly; }, descriptor: { type: 'boolean' } }; FileListInput.prototype.attributeHandlers.multiple = { set: function (value) { this.domElt.multiple = !!value; }, get: function () { return this.domElt.multiple; }, descriptor: { type: 'boolean' } }; FileListInput.prototype.attributeHandlers.useSystemDialog = { set: function (value) { value = !!value; this.domElt.droppable = value; return value; }, descriptor: { type: 'boolean' } }; FileListInput.prototype.pinHandlers.files = { get: function () { return this.attributes.files; }, receives: function (files) { this.attributes.files = files; }, descriptor: { type: 'file[]' } }; FileListInput.prototype.createDataBindingDescriptor = function () { var thisC = this; return { configurable: true, set: function (value) { thisC.attributes.files = value; }, get: function () { return thisC.attributes.files; } } }; AssemblerInstance.addClass(FileListInput); export default FileListInput;