@vaadin/upload
Advanced tools
Comparing version 22.0.0-alpha7 to 22.0.0-alpha8
{ | ||
"name": "@vaadin/upload", | ||
"version": "22.0.0-alpha7", | ||
"version": "22.0.0-alpha8", | ||
"publishConfig": { | ||
@@ -36,8 +36,8 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/button": "22.0.0-alpha7", | ||
"@vaadin/component-base": "22.0.0-alpha7", | ||
"@vaadin/progress-bar": "22.0.0-alpha7", | ||
"@vaadin/vaadin-lumo-styles": "22.0.0-alpha7", | ||
"@vaadin/vaadin-material-styles": "22.0.0-alpha7", | ||
"@vaadin/vaadin-themable-mixin": "22.0.0-alpha7" | ||
"@vaadin/button": "22.0.0-alpha8", | ||
"@vaadin/component-base": "22.0.0-alpha8", | ||
"@vaadin/progress-bar": "22.0.0-alpha8", | ||
"@vaadin/vaadin-lumo-styles": "22.0.0-alpha8", | ||
"@vaadin/vaadin-material-styles": "22.0.0-alpha8", | ||
"@vaadin/vaadin-themable-mixin": "22.0.0-alpha8" | ||
}, | ||
@@ -49,3 +49,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "8e89419c6b44a1d225d5859e180d7b35e47ddb52" | ||
"gitHead": "c24468526298ee26ad7f7280b59f6c8789e1f75f" | ||
} |
@@ -31,3 +31,3 @@ /** | ||
* `retry-button` | Retry file upload button | ||
* `clear-button` | Clear file button | ||
* `remove-button` | Remove file button | ||
* `progress`| Progress bar | ||
@@ -104,6 +104,6 @@ * | ||
type="button" | ||
part="clear-button" | ||
part="remove-button" | ||
file-event="file-abort" | ||
on-click="_fireFileEvent" | ||
aria-label$="[[i18n.file.clear]]" | ||
aria-label$="[[i18n.file.remove]]" | ||
aria-describedby="name" | ||
@@ -110,0 +110,0 @@ ></button> |
@@ -0,8 +1,171 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js'; | ||
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
import { UploadEventMap, UploadFile, UploadI18n, UploadMethod } from './interfaces'; | ||
export interface UploadFile extends File { | ||
uploadTarget: string; | ||
elapsed: number; | ||
elapsedStr: string; | ||
remaining: number; | ||
remainingStr: string; | ||
progress: number; | ||
speed: number; | ||
totalStr: string; | ||
loaded: number; | ||
loadedStr: string; | ||
status: string; | ||
error: string; | ||
abort?: boolean; | ||
complete?: boolean; | ||
uploading?: boolean; | ||
} | ||
export interface UploadI18n { | ||
dropFiles: { | ||
one: string; | ||
many: string; | ||
}; | ||
addFiles: { | ||
one: string; | ||
many: string; | ||
}; | ||
error: { | ||
tooManyFiles: string; | ||
fileIsTooBig: string; | ||
incorrectFileType: string; | ||
}; | ||
uploading: { | ||
status: { | ||
connecting: string; | ||
stalled: string; | ||
processing: string; | ||
held: string; | ||
}; | ||
remainingTime: { | ||
prefix: string; | ||
unknown: string; | ||
}; | ||
error: { | ||
serverUnavailable: string; | ||
unexpectedServerError: string; | ||
forbidden: string; | ||
}; | ||
}; | ||
units: { | ||
size: string[]; | ||
sizeBase?: number; | ||
}; | ||
formatSize?: (bytes: number) => string; | ||
formatTime?: (seconds: number, units: number[]) => string; | ||
} | ||
export type UploadMethod = 'POST' | 'PUT'; | ||
/** | ||
* Fired when a file cannot be added to the queue due to a constrain: | ||
* file-size, file-type or maxFiles | ||
*/ | ||
export type UploadFileRejectEvent = CustomEvent<{ file: UploadFile; error: string }>; | ||
/** | ||
* Fired when the `files` property changes. | ||
*/ | ||
export type UploadFilesChangedEvent = CustomEvent<{ value: UploadFile[] }>; | ||
/** | ||
* Fired when the `max-files-reached` property changes. | ||
*/ | ||
export type UploadMaxFilesReachedChangedEvent = CustomEvent<{ value: boolean }>; | ||
/** | ||
* Fired before the XHR is opened. Could be used for changing the request | ||
* URL. If the default is prevented, then XHR would not be opened. | ||
*/ | ||
export type UploadBeforeEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>; | ||
/** | ||
* Fired when the XHR is sent. | ||
*/ | ||
export type UploadStartEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>; | ||
/** | ||
* Fired as many times as the progress is updated. | ||
*/ | ||
export type UploadProgressEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>; | ||
/** | ||
* Fired in case the upload process succeeded. | ||
*/ | ||
export type UploadSuccessEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>; | ||
/** | ||
* Fired in case the upload process failed. | ||
*/ | ||
export type UploadErrorEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>; | ||
/** | ||
* Fired when we have the actual server response, and before the component | ||
* analyses it. It's useful for developers to make the upload fail depending | ||
* on the server response. If the event is defaultPrevented the vaadin-upload | ||
* will return allowing the user to do something on his own like retry the | ||
* upload, etc. since he has full access to the `xhr` and `file` objects. | ||
* Otherwise, if the event is not prevented default `vaadin-upload` continues | ||
* with the normal workflow checking the `xhr.status` and `file.error` | ||
* which also might be modified by the user to force a customized response, | ||
*/ | ||
export type UploadResponseEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>; | ||
/** | ||
* Fired when retry upload is requested. If the default is prevented, then | ||
* retry would not be performed. | ||
*/ | ||
export type UploadRetryEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>; | ||
/** | ||
* Fired when upload abort is requested. If the default is prevented, then the | ||
* file upload would not be aborted. | ||
*/ | ||
export type UploadAbortEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>; | ||
/** | ||
* Fired when the XHR has been opened but not sent yet. Useful for appending | ||
* data keys to the FormData object, for changing some parameters like | ||
* headers, etc. If the event is defaultPrevented, `vaadin-upload` will not | ||
* send the request allowing the user to do something on his own. | ||
*/ | ||
export type UploadRequestEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile; formData: FormData }>; | ||
export interface UploadCustomEventMap { | ||
'file-reject': UploadFileRejectEvent; | ||
'files-changed': UploadFilesChangedEvent; | ||
'max-files-reached-changed': UploadMaxFilesReachedChangedEvent; | ||
'upload-before': UploadBeforeEvent; | ||
'upload-start': UploadStartEvent; | ||
'upload-progress': UploadProgressEvent; | ||
'upload-response': UploadResponseEvent; | ||
'upload-success': UploadSuccessEvent; | ||
'upload-error': UploadErrorEvent; | ||
'upload-retry': UploadRetryEvent; | ||
'upload-abort': UploadAbortEvent; | ||
'upload-request': UploadRequestEvent; | ||
} | ||
export interface UploadEventMap extends HTMLElementEventMap, UploadCustomEventMap {} | ||
/** | ||
* `<vaadin-upload>` is a Web Component for uploading multiple files with drag and drop support. | ||
@@ -211,3 +374,3 @@ * | ||
* start: 'Start', | ||
* clear: 'Clear' | ||
* remove: 'Remove' | ||
* }, | ||
@@ -214,0 +377,0 @@ * units: { |
@@ -372,3 +372,3 @@ /** | ||
* start: 'Start', | ||
* clear: 'Clear' | ||
* remove: 'Remove' | ||
* }, | ||
@@ -428,3 +428,3 @@ * units: { | ||
start: 'Start', | ||
clear: 'Clear' | ||
remove: 'Remove' | ||
}, | ||
@@ -431,0 +431,0 @@ units: { |
@@ -162,3 +162,3 @@ import '@vaadin/vaadin-lumo-styles/font-icons.js'; | ||
[part='clear-button']::before { | ||
[part='remove-button']::before { | ||
content: var(--lumo-icons-cross); | ||
@@ -165,0 +165,0 @@ } |
@@ -171,3 +171,3 @@ import '@vaadin/vaadin-material-styles/color.js'; | ||
[part='clear-button'] { | ||
[part='remove-button'] { | ||
margin-right: -8px; | ||
@@ -198,3 +198,3 @@ } | ||
[part='clear-button']::before { | ||
[part='remove-button']::before { | ||
content: var(--material-icons-clear); | ||
@@ -201,0 +201,0 @@ } |
export * from './src/vaadin-upload.js'; | ||
export * from './src/interfaces'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77454
1900
13
+ Added@vaadin/button@22.0.0-alpha8(transitive)
+ Added@vaadin/component-base@22.0.0-alpha8(transitive)
+ Added@vaadin/icon@22.0.0-alpha8(transitive)
+ Added@vaadin/progress-bar@22.0.0-alpha8(transitive)
+ Added@vaadin/vaadin-lumo-styles@22.0.0-alpha8(transitive)
+ Added@vaadin/vaadin-material-styles@22.0.0-alpha8(transitive)
+ Added@vaadin/vaadin-themable-mixin@22.0.0-alpha8(transitive)
- Removed@vaadin/button@22.0.0-alpha7(transitive)
- Removed@vaadin/component-base@22.0.0-alpha7(transitive)
- Removed@vaadin/icon@22.0.0-alpha7(transitive)
- Removed@vaadin/progress-bar@22.0.0-alpha7(transitive)
- Removed@vaadin/vaadin-lumo-styles@22.0.0-alpha7(transitive)
- Removed@vaadin/vaadin-material-styles@22.0.0-alpha7(transitive)
- Removed@vaadin/vaadin-themable-mixin@22.0.0-alpha7(transitive)
Updated@vaadin/button@22.0.0-alpha8