@vaadin/upload 25.2.0-alpha1 → 25.2.0-alpha11
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/custom-elements.json +29 -19
- package/package.json +11 -11
- package/src/styles/vaadin-upload-file-base-styles.js +0 -1
- package/src/vaadin-upload-button.js +1 -4
- package/src/vaadin-upload-drop-zone.js +2 -4
- package/src/vaadin-upload-file-list-mixin.d.ts +37 -0
- package/src/vaadin-upload-file-list-mixin.js +57 -5
- package/src/vaadin-upload-file-list.js +0 -2
- package/src/vaadin-upload-file-mixin.js +0 -4
- package/src/vaadin-upload-file.d.ts +6 -6
- package/src/vaadin-upload-file.js +3 -32
- package/src/vaadin-upload-helpers.js +1 -1
- package/src/vaadin-upload-manager.js +8 -8
- package/src/vaadin-upload-mixin.d.ts +2 -1
- package/src/vaadin-upload-mixin.js +7 -5
- package/src/vaadin-upload.d.ts +8 -8
- package/src/vaadin-upload.js +8 -117
- package/web-types.json +125 -281
- package/web-types.lit.json +90 -97
package/src/vaadin-upload.js
CHANGED
|
@@ -88,25 +88,22 @@ import { UploadMixin } from './vaadin-upload-mixin.js';
|
|
|
88
88
|
*
|
|
89
89
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
90
90
|
*
|
|
91
|
-
* @fires {CustomEvent} file-reject - Fired when a file cannot be added to the queue due to a
|
|
91
|
+
* @fires {CustomEvent} file-reject - Fired when a file cannot be added to the queue due to a constraint: file size, file type, or maxFiles.
|
|
92
92
|
* @fires {CustomEvent} file-remove - Fired when a file is removed from the list.
|
|
93
93
|
* @fires {CustomEvent} files-changed - Fired when the `files` property changes.
|
|
94
94
|
* @fires {CustomEvent} max-files-reached-changed - Fired when the `maxFilesReached` property changes.
|
|
95
|
-
* @fires {CustomEvent} upload-before - Fired before the XHR is opened.
|
|
95
|
+
* @fires {CustomEvent} upload-before - Fired before the XHR is opened. Useful for changing the request URL. If the default is prevented, the XHR is not opened.
|
|
96
96
|
* @fires {CustomEvent} upload-start - Fired when the XHR is sent.
|
|
97
97
|
* @fires {CustomEvent} upload-progress - Fired as many times as the progress is updated.
|
|
98
|
-
* @fires {CustomEvent} upload-success - Fired
|
|
99
|
-
* @fires {CustomEvent} upload-error - Fired
|
|
100
|
-
* @fires {CustomEvent} upload-request - Fired when the XHR has been opened but not sent yet.
|
|
101
|
-
* @fires {CustomEvent} upload-response - Fired when
|
|
102
|
-
* @fires {CustomEvent} upload-retry - Fired when retry upload is requested.
|
|
103
|
-
* @fires {CustomEvent} upload-abort - Fired when upload abort is requested.
|
|
98
|
+
* @fires {CustomEvent} upload-success - Fired when the upload process succeeds.
|
|
99
|
+
* @fires {CustomEvent} upload-error - Fired when the upload process fails.
|
|
100
|
+
* @fires {CustomEvent} upload-request - Fired when the XHR has been opened but not sent yet. Useful for appending data to the FormData or modifying request parameters. If the default is prevented, the request is not sent.
|
|
101
|
+
* @fires {CustomEvent} upload-response - Fired when the server response is received, before the component analyzes it. If the default is prevented, the component returns and the listener can handle `xhr` and `file` directly; otherwise the normal flow checks `xhr.status` and `file.error`, which can be modified to force a custom outcome.
|
|
102
|
+
* @fires {CustomEvent} upload-retry - Fired when retry upload is requested. If the default is prevented, the retry is not performed.
|
|
103
|
+
* @fires {CustomEvent} upload-abort - Fired when upload abort is requested. If the default is prevented, the upload is not aborted.
|
|
104
104
|
*
|
|
105
105
|
* @customElement vaadin-upload
|
|
106
106
|
* @extends HTMLElement
|
|
107
|
-
* @mixes ThemableMixin
|
|
108
|
-
* @mixes ElementMixin
|
|
109
|
-
* @mixes UploadMixin
|
|
110
107
|
*/
|
|
111
108
|
class Upload extends UploadMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
112
109
|
static get is() {
|
|
@@ -144,112 +141,6 @@ class Upload extends UploadMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInj
|
|
|
144
141
|
/>
|
|
145
142
|
`;
|
|
146
143
|
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Fired when a file cannot be added to the queue due to a constrain:
|
|
150
|
-
* file-size, file-type or maxFiles
|
|
151
|
-
*
|
|
152
|
-
* @event file-reject
|
|
153
|
-
* @param {Object} detail
|
|
154
|
-
* @param {Object} detail.file the file added
|
|
155
|
-
* @param {string} detail.error the cause
|
|
156
|
-
*/
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Fired before the XHR is opened. Could be used for changing the request
|
|
160
|
-
* URL. If the default is prevented, then XHR would not be opened.
|
|
161
|
-
*
|
|
162
|
-
* @event upload-before
|
|
163
|
-
* @param {Object} detail
|
|
164
|
-
* @param {Object} detail.xhr the xhr
|
|
165
|
-
* @param {Object} detail.file the file being uploaded
|
|
166
|
-
* @param {Object} detail.file.uploadTarget the upload request URL, initialized with the value of vaadin-upload `target` property
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Fired when the XHR has been opened but not sent yet. Useful for appending
|
|
171
|
-
* data keys to the FormData object, for changing some parameters like
|
|
172
|
-
* headers, etc. If the event is defaultPrevented, `vaadin-upload` will not
|
|
173
|
-
* send the request allowing the user to do something on his own.
|
|
174
|
-
*
|
|
175
|
-
* @event upload-request
|
|
176
|
-
* @param {Object} detail
|
|
177
|
-
* @param {Object} detail.xhr the xhr
|
|
178
|
-
* @param {Object} detail.file the file being uploaded
|
|
179
|
-
* @param {Object} detail.formData the FormData object
|
|
180
|
-
*/
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Fired when the XHR is sent.
|
|
184
|
-
*
|
|
185
|
-
* @event upload-start
|
|
186
|
-
* @param {Object} detail
|
|
187
|
-
* @param {Object} detail.xhr the xhr
|
|
188
|
-
* @param {Object} detail.file the file being uploaded
|
|
189
|
-
*/
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Fired as many times as the progress is updated.
|
|
193
|
-
*
|
|
194
|
-
* @event upload-progress
|
|
195
|
-
* @param {Object} detail
|
|
196
|
-
* @param {Object} detail.xhr the xhr
|
|
197
|
-
* @param {Object} detail.file the file being uploaded with loaded info
|
|
198
|
-
*/
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Fired when we have the actual server response, and before the component
|
|
202
|
-
* analyses it. It's useful for developers to make the upload fail depending
|
|
203
|
-
* on the server response. If the event is defaultPrevented the vaadin-upload
|
|
204
|
-
* will return allowing the user to do something on his own like retry the
|
|
205
|
-
* upload, etc. since he has full access to the `xhr` and `file` objects.
|
|
206
|
-
* Otherwise, if the event is not prevented default `vaadin-upload` continues
|
|
207
|
-
* with the normal workflow checking the `xhr.status` and `file.error`
|
|
208
|
-
* which also might be modified by the user to force a customized response.
|
|
209
|
-
*
|
|
210
|
-
* @event upload-response
|
|
211
|
-
* @param {Object} detail
|
|
212
|
-
* @param {Object} detail.xhr the xhr
|
|
213
|
-
* @param {Object} detail.file the file being uploaded
|
|
214
|
-
*/
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Fired in case the upload process succeed.
|
|
218
|
-
*
|
|
219
|
-
* @event upload-success
|
|
220
|
-
* @param {Object} detail
|
|
221
|
-
* @param {Object} detail.xhr the xhr
|
|
222
|
-
* @param {Object} detail.file the file being uploaded with loaded info
|
|
223
|
-
*/
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Fired in case the upload process failed.
|
|
227
|
-
*
|
|
228
|
-
* @event upload-error
|
|
229
|
-
* @param {Object} detail
|
|
230
|
-
* @param {Object} detail.xhr the xhr
|
|
231
|
-
* @param {Object} detail.file the file being uploaded
|
|
232
|
-
*/
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Fired when retry upload is requested. If the default is prevented, then
|
|
236
|
-
* retry would not be performed.
|
|
237
|
-
*
|
|
238
|
-
* @event upload-retry
|
|
239
|
-
* @param {Object} detail
|
|
240
|
-
* @param {Object} detail.xhr the previous upload xhr
|
|
241
|
-
* @param {Object} detail.file the file being uploaded
|
|
242
|
-
*/
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Fired when retry abort is requested. If the default is prevented, then the
|
|
246
|
-
* file upload would not be aborted.
|
|
247
|
-
*
|
|
248
|
-
* @event upload-abort
|
|
249
|
-
* @param {Object} detail
|
|
250
|
-
* @param {Object} detail.xhr the xhr
|
|
251
|
-
* @param {Object} detail.file the file being uploaded
|
|
252
|
-
*/
|
|
253
144
|
}
|
|
254
145
|
|
|
255
146
|
defineCustomElement(Upload);
|