@vaadin/upload
Advanced tools
Comparing version 24.6.0-alpha4 to 24.6.0-alpha5
{ | ||
"name": "@vaadin/upload", | ||
"version": "24.6.0-alpha4", | ||
"version": "24.6.0-alpha5", | ||
"publishConfig": { | ||
@@ -24,7 +24,2 @@ "access": "public" | ||
"src", | ||
"!src/vaadin-lit-upload-file-list.js", | ||
"!src/vaadin-lit-upload-file.js", | ||
"!src/vaadin-lit-upload-icon.js", | ||
"!src/vaadin-lit-upload.d.ts", | ||
"!src/vaadin-lit-upload.js", | ||
"theme", | ||
@@ -46,13 +41,13 @@ "vaadin-*.d.ts", | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/a11y-base": "24.6.0-alpha4", | ||
"@vaadin/button": "24.6.0-alpha4", | ||
"@vaadin/component-base": "24.6.0-alpha4", | ||
"@vaadin/progress-bar": "24.6.0-alpha4", | ||
"@vaadin/vaadin-lumo-styles": "24.6.0-alpha4", | ||
"@vaadin/vaadin-material-styles": "24.6.0-alpha4", | ||
"@vaadin/vaadin-themable-mixin": "24.6.0-alpha4", | ||
"@vaadin/a11y-base": "24.6.0-alpha5", | ||
"@vaadin/button": "24.6.0-alpha5", | ||
"@vaadin/component-base": "24.6.0-alpha5", | ||
"@vaadin/progress-bar": "24.6.0-alpha5", | ||
"@vaadin/vaadin-lumo-styles": "24.6.0-alpha5", | ||
"@vaadin/vaadin-material-styles": "24.6.0-alpha5", | ||
"@vaadin/vaadin-themable-mixin": "24.6.0-alpha5", | ||
"lit": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@vaadin/chai-plugins": "24.6.0-alpha4", | ||
"@vaadin/chai-plugins": "24.6.0-alpha5", | ||
"@vaadin/testing-helpers": "^1.0.0", | ||
@@ -65,3 +60,3 @@ "sinon": "^18.0.0" | ||
], | ||
"gitHead": "78967d4f3bb46f58f43c2cc621802554acb2efaf" | ||
"gitHead": "cbfa46fe276f254dcaa99a622710d56df7f0a539" | ||
} |
@@ -201,3 +201,3 @@ /** | ||
* addFiles: { | ||
* one: 'Select File...', | ||
* one: 'Upload File...', | ||
* many: 'Upload Files...' | ||
@@ -222,5 +222,5 @@ * }, | ||
* error: { | ||
* serverUnavailable: 'Server Unavailable', | ||
* unexpectedServerError: 'Unexpected Server Error', | ||
* forbidden: 'Forbidden' | ||
* serverUnavailable: 'Upload failed, please try again later', | ||
* unexpectedServerError: 'Upload failed due to server error', | ||
* forbidden: 'Upload forbidden' | ||
* } | ||
@@ -227,0 +227,0 @@ * }, |
@@ -279,3 +279,3 @@ /** | ||
* addFiles: { | ||
* one: 'Select File...', | ||
* one: 'Upload File...', | ||
* many: 'Upload Files...' | ||
@@ -300,5 +300,5 @@ * }, | ||
* error: { | ||
* serverUnavailable: 'Server Unavailable', | ||
* unexpectedServerError: 'Unexpected Server Error', | ||
* forbidden: 'Forbidden' | ||
* serverUnavailable: 'Upload failed, please try again later', | ||
* unexpectedServerError: 'Upload failed due to server error', | ||
* forbidden: 'Upload forbidden' | ||
* } | ||
@@ -563,10 +563,47 @@ * }, | ||
/** @private */ | ||
_onDrop(event) { | ||
async _onDrop(event) { | ||
if (!this.nodrop) { | ||
event.preventDefault(); | ||
this._dragover = this._dragoverValid = false; | ||
this._addFiles(event.dataTransfer.files); | ||
const files = await this.__getFilesFromDropEvent(event); | ||
this._addFiles(files); | ||
} | ||
} | ||
/** | ||
* Get the files from the drop event. The dropped items may contain a | ||
* combination of files and directories. If a dropped item is a directory, | ||
* it will be recursively traversed to get all files. | ||
* | ||
* @param {!DragEvent} dropEvent - The drop event | ||
* @returns {Promise<File[]>} - The files from the drop event | ||
* @private | ||
*/ | ||
__getFilesFromDropEvent(dropEvent) { | ||
async function getFilesFromEntry(entry) { | ||
if (entry.isFile) { | ||
return new Promise((resolve) => { | ||
// In case of an error, resolve without any files | ||
entry.file(resolve, () => resolve([])); | ||
}); | ||
} else if (entry.isDirectory) { | ||
const reader = entry.createReader(); | ||
const entries = await new Promise((resolve) => { | ||
// In case of an error, resolve without any files | ||
reader.readEntries(resolve, () => resolve([])); | ||
}); | ||
const files = await Promise.all(entries.map(getFilesFromEntry)); | ||
return files.flat(); | ||
} | ||
} | ||
const filePromises = Array.from(dropEvent.dataTransfer.items) | ||
.map((item) => item.webkitGetAsEntry()) | ||
.filter((entry) => !!entry) | ||
.map(getFilesFromEntry); | ||
return Promise.all(filePromises).then((files) => files.flat()); | ||
} | ||
/** @private */ | ||
@@ -573,0 +610,0 @@ _createXhr() { |
@@ -7,3 +7,3 @@ import '@vaadin/vaadin-lumo-styles/font-icons.js'; | ||
import '@vaadin/vaadin-lumo-styles/typography.js'; | ||
import '@vaadin/button/theme/lumo/vaadin-button.js'; | ||
import '@vaadin/progress-bar/theme/lumo/vaadin-progress-bar.js'; | ||
import '@vaadin/button/theme/lumo/vaadin-button-styles.js'; | ||
import '@vaadin/progress-bar/theme/lumo/vaadin-progress-bar-styles.js'; |
@@ -7,4 +7,4 @@ import '@vaadin/vaadin-lumo-styles/font-icons.js'; | ||
import '@vaadin/vaadin-lumo-styles/typography.js'; | ||
import '@vaadin/button/theme/lumo/vaadin-button.js'; | ||
import '@vaadin/progress-bar/theme/lumo/vaadin-progress-bar.js'; | ||
import '@vaadin/button/theme/lumo/vaadin-button-styles.js'; | ||
import '@vaadin/progress-bar/theme/lumo/vaadin-progress-bar-styles.js'; | ||
import { fieldButton } from '@vaadin/vaadin-lumo-styles/mixins/field-button.js'; | ||
@@ -11,0 +11,0 @@ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; |
import '@vaadin/vaadin-material-styles/color.js'; | ||
import '@vaadin/vaadin-material-styles/font-icons.js'; | ||
import '@vaadin/vaadin-material-styles/typography.js'; | ||
import '@vaadin/button/theme/material/vaadin-button.js'; | ||
import '@vaadin/progress-bar/theme/material/vaadin-progress-bar.js'; | ||
import '@vaadin/button/theme/material/vaadin-button-styles.js'; | ||
import '@vaadin/progress-bar/theme/material/vaadin-progress-bar-styles.js'; |
import '@vaadin/vaadin-material-styles/color.js'; | ||
import '@vaadin/vaadin-material-styles/font-icons.js'; | ||
import '@vaadin/vaadin-material-styles/typography.js'; | ||
import '@vaadin/button/theme/material/vaadin-button.js'; | ||
import '@vaadin/progress-bar/theme/material/vaadin-progress-bar.js'; | ||
import '@vaadin/button/theme/material/vaadin-button-styles.js'; | ||
import '@vaadin/progress-bar/theme/material/vaadin-progress-bar-styles.js'; | ||
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
@@ -7,0 +7,0 @@ |
{ | ||
"$schema": "https://json.schemastore.org/web-types", | ||
"name": "@vaadin/upload", | ||
"version": "24.6.0-alpha4", | ||
"version": "24.6.0-alpha5", | ||
"description-markup": "markdown", | ||
@@ -483,3 +483,3 @@ "contributions": { | ||
"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```", | ||
"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: 'Upload 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: 'Upload failed, please try again later',\n unexpectedServerError: 'Upload failed due to server error',\n forbidden: 'Upload 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": { | ||
@@ -486,0 +486,0 @@ "type": [ |
{ | ||
"$schema": "https://json.schemastore.org/web-types", | ||
"name": "@vaadin/upload", | ||
"version": "24.6.0-alpha4", | ||
"version": "24.6.0-alpha5", | ||
"description-markup": "markdown", | ||
@@ -213,3 +213,3 @@ "framework": "lit", | ||
"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```", | ||
"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: 'Upload 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: 'Upload failed, please try again later',\n unexpectedServerError: 'Upload failed due to server error',\n forbidden: 'Upload 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": { | ||
@@ -216,0 +216,0 @@ "kind": "expression" |
147585
40
3639
+ Added@vaadin/a11y-base@24.6.0-alpha5(transitive)
+ Added@vaadin/button@24.6.0-alpha5(transitive)
+ Added@vaadin/component-base@24.6.0-alpha5(transitive)
+ Added@vaadin/icon@24.6.0-alpha5(transitive)
+ Added@vaadin/progress-bar@24.6.0-alpha5(transitive)
+ Added@vaadin/vaadin-lumo-styles@24.6.0-alpha5(transitive)
+ Added@vaadin/vaadin-material-styles@24.6.0-alpha5(transitive)
+ Added@vaadin/vaadin-themable-mixin@24.6.0-alpha5(transitive)
- Removed@vaadin/a11y-base@24.6.0-alpha4(transitive)
- Removed@vaadin/button@24.6.0-alpha4(transitive)
- Removed@vaadin/component-base@24.6.0-alpha4(transitive)
- Removed@vaadin/icon@24.6.0-alpha4(transitive)
- Removed@vaadin/progress-bar@24.6.0-alpha4(transitive)
- Removed@vaadin/vaadin-lumo-styles@24.6.0-alpha4(transitive)
- Removed@vaadin/vaadin-material-styles@24.6.0-alpha4(transitive)
- Removed@vaadin/vaadin-themable-mixin@24.6.0-alpha4(transitive)
Updated@vaadin/button@24.6.0-alpha5