package.web-types.lit.json Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of upload Show documentation
Show all versions of upload Show documentation
Web Component for uploading files with drag and drop support
{
"$schema": "https://json.schemastore.org/web-types",
"name": "@vaadin/upload",
"version": "24.4.11",
"description-markup": "markdown",
"framework": "lit",
"framework-config": {
"enable-when": {
"node-packages": [
"lit"
]
}
},
"contributions": {
"html": {
"elements": [
{
"name": "vaadin-upload-file",
"description": "`` element represents a file in the file list of ``.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|-------------\n`row` | File container\n`info` | Container for file status icon, file name, status and error messages\n`done-icon` | File done status icon\n`warning-icon` | File warning status icon\n`meta` | Container for file name, status and error messages\n`name` | File name\n`error` | Error message, shown when error happens\n`status` | Status message\n`commands` | Container for file command buttons\n`start-button` | Start file upload button\n`retry-button` | Retry file upload button\n`remove-button` | Remove file button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|-------------\n`focus-ring` | Set when the element is focused using the keyboard.\n`focused` | Set when the element is focused.\n`error` | An error has happened during uploading.\n`indeterminate` | Uploading is in progress, but the progress value is unknown.\n`uploading` | Uploading is in progress.\n`complete` | Uploading has finished successfully.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
"extension": true,
"attributes": [
{
"name": "?complete",
"description": "True if uploading is completed, false otherwise.",
"value": {
"kind": "expression"
}
},
{
"name": "?held",
"description": "True if uploading is not started, false otherwise.",
"value": {
"kind": "expression"
}
},
{
"name": "?indeterminate",
"description": "True if remaining time is unknown, false otherwise.",
"value": {
"kind": "expression"
}
},
{
"name": "?uploading",
"description": "True if uploading is in progress, false otherwise.",
"value": {
"kind": "expression"
}
},
{
"name": ".errorMessage",
"description": "Error message returned by the server, if any.",
"value": {
"kind": "expression"
}
},
{
"name": ".file",
"description": "The object representing a file.",
"value": {
"kind": "expression"
}
},
{
"name": ".fileName",
"description": "Name of the uploading file.",
"value": {
"kind": "expression"
}
},
{
"name": ".i18n",
"description": "The object used to localize this component.",
"value": {
"kind": "expression"
}
},
{
"name": ".progress",
"description": "Number representing the uploading progress.",
"value": {
"kind": "expression"
}
},
{
"name": ".status",
"description": "Uploading status.",
"value": {
"kind": "expression"
}
},
{
"name": "@file-abort",
"description": "Fired when abort button is pressed. It is listened by `vaadin-upload` which\nwill abort the upload in progress, and then remove the file from the list.",
"value": {
"kind": "expression"
}
},
{
"name": "@file-retry",
"description": "Fired when the retry button is pressed. It is listened by `vaadin-upload`\nwhich will start a new upload process of this file.",
"value": {
"kind": "expression"
}
},
{
"name": "@file-start",
"description": "Fired when the start button is pressed. It is listened by `vaadin-upload`\nwhich will start a new upload process of this file.",
"value": {
"kind": "expression"
}
}
]
},
{
"name": "vaadin-upload",
"description": "`` is a Web Component for uploading multiple files with drag and drop support.\n\nExample:\n\n```\n \n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-------------------|-------------------------------------\n`primary-buttons` | Upload container\n`drop-label` | Element wrapping drop label and icon\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n---|---|---\n`nodrop` | Set when drag and drop is disabled (e. g., on touch devices) | `:host`\n`dragover` | A file is being dragged over the element | `:host`\n`dragover-valid` | A dragged file is valid with `maxFiles` and `accept` criteria | `:host`\n`max-files-reached` | The maximum number of files that the user is allowed to add to the upload has been reached | `:host`\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
"extension": true,
"attributes": [
{
"name": "?nodrop",
"description": "Define whether the element supports dropping files on it for uploading.\nBy default it's enabled in desktop and disabled in touch devices\nbecause mobile devices do not support drag events in general. Setting\nit false means that drop is enabled even in touch-devices, and true\ndisables drop in all devices.",
"value": {
"kind": "expression"
}
},
{
"name": "?noAuto",
"description": "Prevents upload(s) from immediately uploading upon adding file(s).\nWhen set, you must manually trigger uploads using the `uploadFiles` method",
"value": {
"kind": "expression"
}
},
{
"name": "?withCredentials",
"description": "Set the withCredentials flag on the request.",
"value": {
"kind": "expression"
}
},
{
"name": ".target",
"description": "The server URL. The default value is an empty string, which means that\n_window.location_ will be used.",
"value": {
"kind": "expression"
}
},
{
"name": ".method",
"description": "HTTP Method used to send the files. Only POST and PUT are allowed.",
"value": {
"kind": "expression"
}
},
{
"name": ".headers",
"description": "Key-Value map to send to the server. If you set this property as an\nattribute, use a valid JSON string, for example:\n```\n \n```",
"value": {
"kind": "expression"
}
},
{
"name": ".timeout",
"description": "Max time in milliseconds for the entire upload process, if exceeded the\nrequest will be aborted. Zero means that there is no timeout.",
"value": {
"kind": "expression"
}
},
{
"name": ".files",
"description": "The array of files being processed, or already uploaded.\n\nEach element is a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File)\nobject with a number of extra properties to track the upload process:\n- `uploadTarget`: The target URL used to upload this file.\n- `elapsed`: Elapsed time since the upload started.\n- `elapsedStr`: Human-readable elapsed time.\n- `remaining`: Number of seconds remaining for the upload to finish.\n- `remainingStr`: Human-readable remaining time for the upload to finish.\n- `progress`: Percentage of the file already uploaded.\n- `speed`: Upload speed in kB/s.\n- `size`: File size in bytes.\n- `totalStr`: Human-readable total size of the file.\n- `loaded`: Bytes transferred so far.\n- `loadedStr`: Human-readable uploaded size at the moment.\n- `status`: Status of the upload process.\n- `error`: Error message in case the upload failed.\n- `abort`: True if the file was canceled by the user.\n- `complete`: True when the file was transferred to the server.\n- `uploading`: True while transferring data to the server.",
"value": {
"kind": "expression"
}
},
{
"name": ".maxFiles",
"description": "Limit of files to upload, by default it is unlimited. If the value is\nset to one, native file browser will prevent selecting multiple files.",
"value": {
"kind": "expression"
}
},
{
"name": ".accept",
"description": "Specifies the types of files that the server accepts.\nSyntax: a comma-separated list of MIME type patterns (wildcards are\nallowed) or file extensions.\nNotice that MIME types are widely supported, while file extensions\nare only implemented in certain browsers, so avoid using it.\nExample: accept=\"video/*,image/tiff\" or accept=\".pdf,audio/mp3\"",
"value": {
"kind": "expression"
}
},
{
"name": ".maxFileSize",
"description": "Specifies the maximum file size in bytes allowed to upload.\nNotice that it is a client-side constraint, which will be checked before\nsending the request. Obviously you need to do the same validation in\nthe server-side and be sure that they are aligned.",
"value": {
"kind": "expression"
}
},
{
"name": ".formDataName",
"description": "Specifies the 'name' property at Content-Disposition",
"value": {
"kind": "expression"
}
},
{
"name": ".capture",
"description": "Pass-through to input's capture attribute. Allows user to trigger device inputs\nsuch as camera or microphone immediately.",
"value": {
"kind": "expression"
}
},
{
"name": ".i18n",
"description": "The object used to localize this component.\nFor changing the default localization, change the entire\n_i18n_ object or just the property you want to modify.\n\nThe object has the following JSON structure and default values:\n\n```\n{\n dropFiles: {\n one: 'Drop file here',\n many: 'Drop files here'\n },\n addFiles: {\n one: 'Select File...',\n many: 'Upload Files...'\n },\n error: {\n tooManyFiles: 'Too Many Files.',\n fileIsTooBig: 'File is Too Big.',\n incorrectFileType: 'Incorrect File Type.'\n },\n uploading: {\n status: {\n connecting: 'Connecting...',\n stalled: 'Stalled',\n processing: 'Processing File...',\n held: 'Queued'\n },\n remainingTime: {\n prefix: 'remaining time: ',\n unknown: 'unknown remaining time'\n },\n error: {\n serverUnavailable: 'Server Unavailable',\n unexpectedServerError: 'Unexpected Server Error',\n forbidden: 'Forbidden'\n }\n },\n file: {\n retry: 'Retry',\n start: 'Start',\n remove: 'Remove'\n },\n units: {\n size: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],\n sizeBase: 1000\n },\n formatSize: function(bytes) {\n // returns the size followed by the best suitable unit\n },\n formatTime: function(seconds, [secs, mins, hours]) {\n // returns a 'HH:MM:SS' string\n }\n}\n```",
"value": {
"kind": "expression"
}
},
{
"name": "@file-reject",
"description": "Fired when a file cannot be added to the queue due to a constrain:\n file-size, file-type or maxFiles",
"value": {
"kind": "expression"
}
},
{
"name": "@upload-abort",
"description": "Fired when retry abort is requested. If the default is prevented, then the\nfile upload would not be aborted.",
"value": {
"kind": "expression"
}
},
{
"name": "@upload-before",
"description": "Fired before the XHR is opened. Could be used for changing the request\nURL. If the default is prevented, then XHR would not be opened.",
"value": {
"kind": "expression"
}
},
{
"name": "@upload-error",
"description": "Fired in case the upload process failed.",
"value": {
"kind": "expression"
}
},
{
"name": "@upload-progress",
"description": "Fired as many times as the progress is updated.",
"value": {
"kind": "expression"
}
},
{
"name": "@upload-request",
"description": "Fired when the XHR has been opened but not sent yet. Useful for appending\ndata keys to the FormData object, for changing some parameters like\nheaders, etc. If the event is defaultPrevented, `vaadin-upload` will not\nsend the request allowing the user to do something on his own.",
"value": {
"kind": "expression"
}
},
{
"name": "@upload-response",
"description": "Fired when we have the actual server response, and before the component\nanalyses it. It's useful for developers to make the upload fail depending\non the server response. If the event is defaultPrevented the vaadin-upload\nwill return allowing the user to do something on his own like retry the\nupload, etc. since he has full access to the `xhr` and `file` objects.\nOtherwise, if the event is not prevented default `vaadin-upload` continues\nwith the normal workflow checking the `xhr.status` and `file.error`\nwhich also might be modified by the user to force a customized response.",
"value": {
"kind": "expression"
}
},
{
"name": "@upload-retry",
"description": "Fired when retry upload is requested. If the default is prevented, then\nretry would not be performed.",
"value": {
"kind": "expression"
}
},
{
"name": "@upload-start",
"description": "Fired when the XHR is sent.",
"value": {
"kind": "expression"
}
},
{
"name": "@upload-success",
"description": "Fired in case the upload process succeed.",
"value": {
"kind": "expression"
}
},
{
"name": "@files-changed",
"description": "Fired when the `files` property changes.",
"value": {
"kind": "expression"
}
},
{
"name": "@max-files-reached-changed",
"description": "Fired when the `maxFilesReached` property changes.",
"value": {
"kind": "expression"
}
}
]
}
]
}
}
}