@vaadin/vaadin-upload 22.0.0-alpha4 → 22.0.0-alpha8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +23 -30
- package/src/vaadin-upload.d.ts +13 -266
- package/src/vaadin-upload.js +4 -990
- package/theme/lumo/vaadin-upload.js +1 -2
- package/theme/material/vaadin-upload.js +1 -2
- package/vaadin-upload.d.ts +0 -1
- package/src/interfaces.d.ts +0 -161
- package/src/vaadin-upload-file.js +0 -235
- package/src/vaadin-upload-icons.js +0 -19
- package/theme/lumo/vaadin-upload-styles.js +0 -180
- package/theme/material/vaadin-upload-styles.js +0 -244
package/package.json
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/vaadin-upload",
|
|
3
|
-
"version": "22.0.0-
|
|
3
|
+
"version": "22.0.0-alpha8",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"description": "Web Component for uploading files with drag and drop support",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/vaadin/web-components.git",
|
|
12
|
+
"directory": "packages/vaadin-upload"
|
|
13
|
+
},
|
|
14
|
+
"author": "Vaadin Ltd",
|
|
15
|
+
"homepage": "https://vaadin.com/components",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/vaadin/vaadin-upload/issues"
|
|
18
|
+
},
|
|
5
19
|
"main": "vaadin-upload.js",
|
|
6
20
|
"module": "vaadin-upload.js",
|
|
7
|
-
"
|
|
21
|
+
"files": [
|
|
22
|
+
"src",
|
|
23
|
+
"theme",
|
|
24
|
+
"vaadin-*.d.ts",
|
|
25
|
+
"vaadin-*.js"
|
|
26
|
+
],
|
|
8
27
|
"keywords": [
|
|
9
28
|
"Vaadin",
|
|
10
29
|
"upload",
|
|
@@ -12,34 +31,8 @@
|
|
|
12
31
|
"web-component",
|
|
13
32
|
"polymer"
|
|
14
33
|
],
|
|
15
|
-
"author": "Vaadin Ltd",
|
|
16
|
-
"license": "Apache-2.0",
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://github.com/vaadin/vaadin-upload/issues"
|
|
19
|
-
},
|
|
20
|
-
"homepage": "https://vaadin.com/components",
|
|
21
|
-
"files": [
|
|
22
|
-
"vaadin-*.d.ts",
|
|
23
|
-
"vaadin-*.js",
|
|
24
|
-
"src",
|
|
25
|
-
"theme"
|
|
26
|
-
],
|
|
27
34
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@vaadin/button": "^22.0.0-alpha4",
|
|
30
|
-
"@vaadin/vaadin-element-mixin": "^22.0.0-alpha4",
|
|
31
|
-
"@vaadin/vaadin-lumo-styles": "^22.0.0-alpha4",
|
|
32
|
-
"@vaadin/vaadin-material-styles": "^22.0.0-alpha4",
|
|
33
|
-
"@vaadin/vaadin-progress-bar": "^22.0.0-alpha4",
|
|
34
|
-
"@vaadin/vaadin-themable-mixin": "^22.0.0-alpha4"
|
|
35
|
-
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@esm-bundle/chai": "^4.3.4",
|
|
38
|
-
"@vaadin/testing-helpers": "^0.2.1",
|
|
39
|
-
"sinon": "^9.2.0"
|
|
40
|
-
},
|
|
41
|
-
"publishConfig": {
|
|
42
|
-
"access": "public"
|
|
35
|
+
"@vaadin/upload": "22.0.0-alpha8"
|
|
43
36
|
},
|
|
44
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "c24468526298ee26ad7f7280b59f6c8789e1f75f"
|
|
45
38
|
}
|
package/src/vaadin-upload.d.ts
CHANGED
|
@@ -1,271 +1,18 @@
|
|
|
1
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
2
|
-
|
|
3
|
-
import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
|
|
4
|
-
|
|
5
|
-
import { UploadEventMap, UploadFile, UploadI18n, UploadMethod } from './interfaces';
|
|
6
|
-
|
|
7
1
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* ```
|
|
13
|
-
* <vaadin-upload></vaadin-upload>
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* ### Styling
|
|
17
|
-
*
|
|
18
|
-
* The following shadow DOM parts are available for styling:
|
|
19
|
-
*
|
|
20
|
-
* Part name | Description
|
|
21
|
-
* ---|---
|
|
22
|
-
* `primary-buttons` | Upload container
|
|
23
|
-
* `upload-button` | Upload button
|
|
24
|
-
* `drop-label` | Label for drop indicator
|
|
25
|
-
* `drop-label-icon` | Icon for drop indicator
|
|
26
|
-
* `file-list` | File list container
|
|
27
|
-
*
|
|
28
|
-
* The following state attributes are available for styling:
|
|
29
|
-
*
|
|
30
|
-
* Attribute | Description | Part name
|
|
31
|
-
* ---|---|---
|
|
32
|
-
* `nodrop` | Set when drag and drop is disabled (e. g., on touch devices) | `:host`
|
|
33
|
-
* `dragover` | A file is being dragged over the element | `:host`
|
|
34
|
-
* `dragover-valid` | A dragged file is valid with `maxFiles` and `accept` criteria | `:host`
|
|
35
|
-
*
|
|
36
|
-
* See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
|
|
37
|
-
*
|
|
38
|
-
* @fires {CustomEvent} file-reject - Fired when a file cannot be added to the queue due to a constrain.
|
|
39
|
-
* @fires {CustomEvent} files-changed - Fired when the `files` property changes.
|
|
40
|
-
* @fires {CustomEvent} max-files-reached-changed - Fired when the `maxFilesReached` property changes.
|
|
41
|
-
* @fires {CustomEvent} upload-before - Fired before the XHR is opened.
|
|
42
|
-
* @fires {CustomEvent} upload-start - Fired when the XHR is sent.
|
|
43
|
-
* @fires {CustomEvent} upload-progress - Fired as many times as the progress is updated.
|
|
44
|
-
* @fires {CustomEvent} upload-success - Fired in case the upload process succeeded.
|
|
45
|
-
* @fires {CustomEvent} upload-error - Fired in case the upload process failed.
|
|
46
|
-
* @fires {CustomEvent} upload-request - Fired when the XHR has been opened but not sent yet.
|
|
47
|
-
* @fires {CustomEvent} upload-response - Fired when on the server response before analyzing it.
|
|
48
|
-
* @fires {CustomEvent} upload-retry - Fired when retry upload is requested.
|
|
49
|
-
* @fires {CustomEvent} upload-abort - Fired when upload abort is requested.
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
50
5
|
*/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Define whether the element supports dropping files on it for uploading.
|
|
54
|
-
* By default it's enabled in desktop and disabled in touch devices
|
|
55
|
-
* because mobile devices do not support drag events in general. Setting
|
|
56
|
-
* it false means that drop is enabled even in touch-devices, and true
|
|
57
|
-
* disables drop in all devices.
|
|
58
|
-
*/
|
|
59
|
-
nodrop: boolean;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The server URL. The default value is an empty string, which means that
|
|
63
|
-
* _window.location_ will be used.
|
|
64
|
-
*/
|
|
65
|
-
target: string;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* HTTP Method used to send the files. Only POST and PUT are allowed.
|
|
69
|
-
*/
|
|
70
|
-
method: UploadMethod;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Key-Value map to send to the server. If you set this property as an
|
|
74
|
-
* attribute, use a valid JSON string, for example:
|
|
75
|
-
* ```
|
|
76
|
-
* <vaadin-upload headers='{"X-Foo": "Bar"}'></vaadin-upload>
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
headers: object | string | null;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Max time in milliseconds for the entire upload process, if exceeded the
|
|
83
|
-
* request will be aborted. Zero means that there is no timeout.
|
|
84
|
-
*/
|
|
85
|
-
timeout: number;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* The array of files being processed, or already uploaded.
|
|
89
|
-
*
|
|
90
|
-
* Each element is a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File)
|
|
91
|
-
* object with a number of extra properties to track the upload process:
|
|
92
|
-
* - `uploadTarget`: The target URL used to upload this file.
|
|
93
|
-
* - `elapsed`: Elapsed time since the upload started.
|
|
94
|
-
* - `elapsedStr`: Human-readable elapsed time.
|
|
95
|
-
* - `remaining`: Number of seconds remaining for the upload to finish.
|
|
96
|
-
* - `remainingStr`: Human-readable remaining time for the upload to finish.
|
|
97
|
-
* - `progress`: Percentage of the file already uploaded.
|
|
98
|
-
* - `speed`: Upload speed in kB/s.
|
|
99
|
-
* - `size`: File size in bytes.
|
|
100
|
-
* - `totalStr`: Human-readable total size of the file.
|
|
101
|
-
* - `loaded`: Bytes transferred so far.
|
|
102
|
-
* - `loadedStr`: Human-readable uploaded size at the moment.
|
|
103
|
-
* - `status`: Status of the upload process.
|
|
104
|
-
* - `error`: Error message in case the upload failed.
|
|
105
|
-
* - `abort`: True if the file was canceled by the user.
|
|
106
|
-
* - `complete`: True when the file was transferred to the server.
|
|
107
|
-
* - `uploading`: True while transferring data to the server.
|
|
108
|
-
*/
|
|
109
|
-
files: UploadFile[];
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Limit of files to upload, by default it is unlimited. If the value is
|
|
113
|
-
* set to one, native file browser will prevent selecting multiple files.
|
|
114
|
-
* @attr {number} max-files
|
|
115
|
-
*/
|
|
116
|
-
maxFiles: number;
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Specifies if the maximum number of files have been uploaded
|
|
120
|
-
* @attr {boolean} max-files-reached
|
|
121
|
-
*/
|
|
122
|
-
readonly maxFilesReached: boolean;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Specifies the types of files that the server accepts.
|
|
126
|
-
* Syntax: a comma-separated list of MIME type patterns (wildcards are
|
|
127
|
-
* allowed) or file extensions.
|
|
128
|
-
* Notice that MIME types are widely supported, while file extensions
|
|
129
|
-
* are only implemented in certain browsers, so avoid using it.
|
|
130
|
-
* Example: accept="video/*,image/tiff" or accept=".pdf,audio/mp3"
|
|
131
|
-
*/
|
|
132
|
-
accept: string;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Specifies the maximum file size in bytes allowed to upload.
|
|
136
|
-
* Notice that it is a client-side constraint, which will be checked before
|
|
137
|
-
* sending the request. Obviously you need to do the same validation in
|
|
138
|
-
* the server-side and be sure that they are aligned.
|
|
139
|
-
* @attr {number} max-file-size
|
|
140
|
-
*/
|
|
141
|
-
maxFileSize: number;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Specifies the 'name' property at Content-Disposition
|
|
145
|
-
* @attr {string} form-data-name
|
|
146
|
-
*/
|
|
147
|
-
formDataName: string;
|
|
6
|
+
import { Upload } from '@vaadin/upload/src/vaadin-upload.js';
|
|
148
7
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
*/
|
|
154
|
-
noAuto: boolean;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Set the withCredentials flag on the request.
|
|
158
|
-
* @attr {boolean} with-credentials
|
|
159
|
-
*/
|
|
160
|
-
withCredentials: boolean;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Pass-through to input's capture attribute. Allows user to trigger device inputs
|
|
164
|
-
* such as camera or microphone immediately.
|
|
165
|
-
*/
|
|
166
|
-
capture: string | null | undefined;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* The object used to localize this component.
|
|
170
|
-
* For changing the default localization, change the entire
|
|
171
|
-
* _i18n_ object or just the property you want to modify.
|
|
172
|
-
*
|
|
173
|
-
* The object has the following JSON structure and default values:
|
|
174
|
-
*
|
|
175
|
-
* ```
|
|
176
|
-
* {
|
|
177
|
-
* dropFiles: {
|
|
178
|
-
* one: 'Drop file here',
|
|
179
|
-
* many: 'Drop files here'
|
|
180
|
-
* },
|
|
181
|
-
* addFiles: {
|
|
182
|
-
* one: 'Select File...',
|
|
183
|
-
* many: 'Upload Files...'
|
|
184
|
-
* },
|
|
185
|
-
* cancel: 'Cancel',
|
|
186
|
-
* error: {
|
|
187
|
-
* tooManyFiles: 'Too Many Files.',
|
|
188
|
-
* fileIsTooBig: 'File is Too Big.',
|
|
189
|
-
* incorrectFileType: 'Incorrect File Type.'
|
|
190
|
-
* },
|
|
191
|
-
* uploading: {
|
|
192
|
-
* status: {
|
|
193
|
-
* connecting: 'Connecting...',
|
|
194
|
-
* stalled: 'Stalled',
|
|
195
|
-
* processing: 'Processing File...',
|
|
196
|
-
* held: 'Queued'
|
|
197
|
-
* },
|
|
198
|
-
* remainingTime: {
|
|
199
|
-
* prefix: 'remaining time: ',
|
|
200
|
-
* unknown: 'unknown remaining time'
|
|
201
|
-
* },
|
|
202
|
-
* error: {
|
|
203
|
-
* serverUnavailable: 'Server Unavailable',
|
|
204
|
-
* unexpectedServerError: 'Unexpected Server Error',
|
|
205
|
-
* forbidden: 'Forbidden'
|
|
206
|
-
* }
|
|
207
|
-
* },
|
|
208
|
-
* file: {
|
|
209
|
-
* retry: 'Retry',
|
|
210
|
-
* start: 'Start',
|
|
211
|
-
* clear: 'Clear'
|
|
212
|
-
* },
|
|
213
|
-
* units: {
|
|
214
|
-
* size: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
|
|
215
|
-
* sizeBase: 1000
|
|
216
|
-
* },
|
|
217
|
-
* formatSize: function(bytes) {
|
|
218
|
-
* // returns the size followed by the best suitable unit
|
|
219
|
-
* },
|
|
220
|
-
* formatTime: function(seconds, [secs, mins, hours]) {
|
|
221
|
-
* // returns a 'HH:MM:SS' string
|
|
222
|
-
* }
|
|
223
|
-
* }
|
|
224
|
-
* ```
|
|
225
|
-
*
|
|
226
|
-
* @type {!UploadI18n}
|
|
227
|
-
* @default {English}
|
|
228
|
-
*/
|
|
229
|
-
i18n: UploadI18n;
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Triggers the upload of any files that are not completed
|
|
233
|
-
*
|
|
234
|
-
* @param files Files being uploaded. Defaults to all outstanding files
|
|
235
|
-
*/
|
|
236
|
-
uploadFiles(files?: UploadFile | UploadFile[]): void;
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Add the file for uploading. Called internally for each file after picking files from dialog or dropping files.
|
|
240
|
-
*
|
|
241
|
-
* @param file File being added
|
|
242
|
-
*/
|
|
243
|
-
_addFile(file: UploadFile): void;
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Remove file from upload list. Called internally if file upload was canceled.
|
|
247
|
-
*
|
|
248
|
-
* @param file File to remove
|
|
249
|
-
*/
|
|
250
|
-
_removeFile(file: UploadFile): void;
|
|
251
|
-
|
|
252
|
-
addEventListener<K extends keyof UploadEventMap>(
|
|
253
|
-
type: K,
|
|
254
|
-
listener: (this: UploadElement, ev: UploadEventMap[K]) => void,
|
|
255
|
-
options?: boolean | AddEventListenerOptions
|
|
256
|
-
): void;
|
|
257
|
-
|
|
258
|
-
removeEventListener<K extends keyof UploadEventMap>(
|
|
259
|
-
type: K,
|
|
260
|
-
listener: (this: UploadElement, ev: UploadEventMap[K]) => void,
|
|
261
|
-
options?: boolean | EventListenerOptions
|
|
262
|
-
): void;
|
|
263
|
-
}
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Import `Upload` from `@vaadin/upload` instead.
|
|
10
|
+
*/
|
|
11
|
+
export type UploadElement = Upload;
|
|
264
12
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Import `Upload` from `@vaadin/upload` instead.
|
|
15
|
+
*/
|
|
16
|
+
export const UploadElement: typeof Upload;
|
|
270
17
|
|
|
271
|
-
export
|
|
18
|
+
export * from '@vaadin/upload/src/vaadin-upload.js';
|