mmo-upload
1 symbol · generated 5 Oct 2026
mmo-upload
mmo-upload.jhs:1Drop files, or pick them, and send them to mmo.edms: a chunk at a time, two files at once, each one resumed where the server stopped when a chunk fails.
- Extends
CustomShadowElement
Index
| url | where mmo.edms' api is: the page's (MMO.edms.config.url) by default | |
| token | the session's CSRF token: the page's by default | |
| labels | the labels of the files: ids, or quoted paths and "#tags", separated by spaces | |
| attachment | the uid of an entity the files are attached to | |
| max | how many files it takes at most | |
| accept | the types it takes, as an <input type="file"> says them (image,.pdf) | |
| temporary | no file is made: each one's id is for the application to take its bytes | |
| auto | the files are sent as soon as they are dropped | |
| disabled | takes no file | |
| ViewDefault static readonly accessor | ||
| api readonly accessor | The api the files are sent to | |
| disabled accessor | Get the disabled attribute | |
| labels accessor | Get the labels attribute | |
| attachment accessor | Get the attachment attribute | |
| temporary accessor | Get the temporary attribute | |
| auto readonly accessor | Get the auto attribute | |
| max accessor | Get the max attribute | |
| accept accessor | Get the accept attribute | |
| init() | ||
| handleLabelKeydown(event) | Handle the keydown event of the label | |
| filesChange(input) | Handle the change event of the file input | |
| addFiles(files) | Add files to send: with auto, they are sent once they are all added | |
| accepts(file) | ||
| addFile(file, submit) | Add a file to send | |
| removeItem(item) | Stop sending a file, and forget it | |
| submit(event) | Send the files not sent yet (those that failed are sent again) | |
| send(api, item) | Send one file: it never throws, what went wrong is on its row | |
| clear() | Remove every file | |
| update() | The send button, and the frosted zone once nothing more can be added | |
| .dragover | set while files are dragged over the element | |
| .maxed | set once it holds as many files as max | |
| .no-submit | hides the send button (the page calls submit() itself) |
Attributes9
url
mmo-upload.jhswhere mmo.edms' api is: the page's (MMO.edms.config.url) by default
url
token
mmo-upload.jhsthe session's CSRF token: the page's by default
token
labels
mmo-upload.jhsthe labels of the files: ids, or quoted paths and "#tags", separated by spaces
labels
attachment
mmo-upload.jhsthe uid of an entity the files are attached to
attachment
max
mmo-upload.jhshow many files it takes at most
max
accept
mmo-upload.jhsthe types it takes, as an <input type="file"> says them (image,.pdf)
accept
temporary
mmo-upload.jhsno file is made: each one's id is for the application to take its bytes
temporary
auto
mmo-upload.jhsthe files are sent as soon as they are dropped
auto
disabled
mmo-upload.jhstakes no file
disabled
Properties9
ViewDefault
staticreadonlyaccessormmo-upload.jhs:51api
readonlyaccessormmo-upload.jhs:59The api the files are sent to
- Type
- MMO.edms.Api
disabled
accessormmo-upload.jhs:67Get the disabled attribute
- Type
boolean
labels
accessormmo-upload.jhs:80Get the labels attribute
- Type
string|array
attachment
accessormmo-upload.jhs:92Get the attachment attribute
- Type
string
temporary
accessormmo-upload.jhs:104Get the temporary attribute
- Type
boolean
auto
readonlyaccessormmo-upload.jhs:117Get the auto attribute
- Type
boolean
max
accessormmo-upload.jhs:125Get the max attribute
- Type
number
accept
accessormmo-upload.jhs:138Get the accept attribute
- Type
string
Methods11
init()
mmo-upload.jhs:35handleLabelKeydown(event)
mmo-upload.jhs:150Handle the keydown event of the label
| event | Event | - The event |
filesChange(input)
mmo-upload.jhs:161Handle the change event of the file input
| input | HTMLInputElement | - The input |
addFiles(files)
mmo-upload.jhs:171Add files to send: with auto, they are sent once they are all added
| files | FileList | Array<File> |
accepts(file)
mmo-upload.jhs:180| file | File | |
| returns | boolean | true if the element takes a file of that type (accept) |
addFile(file, submit)
mmo-upload.jhs:194Add a file to send
| file | File | - The file to add |
| submit = true | boolean | - with auto, send it at once |
| returns | ?Object | the file's item, null if it is refused |
removeItem(item)
mmo-upload.jhs:229Stop sending a file, and forget it
| item | Object | - addFile |
submit(event)
mmo-upload.jhs:242Send the files not sent yet (those that failed are sent again)
| event = null | ?Event | - The event |
| returns | Promise<{files: Array<Object>, errors: Array<Error> | >} the files made -- for a temporary upload, {id, name, temporary} -- and the errors |
send(api, item)
mmo-upload.jhs:282Send one file: it never throws, what went wrong is on its row
| api | MMO.edms.Api | |
| item | Object | - addFile |
| returns | Promise |
clear()
mmo-upload.jhs:309Remove every file
update()
mmo-upload.jhs:318The send button, and the frosted zone once nothing more can be added
CSS hooks3
.dragover
mmo-upload.jhsset while files are dragged over the element
.dragover
.maxed
mmo-upload.jhsset once it holds as many files as max
.maxed
.no-submit
mmo-upload.jhshides the send button (the page calls submit() itself)
.no-submit