@vaadin/upload 22.0.13 → 22.0.16
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/upload",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.16",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@polymer/polymer": "^3.0.0",
|
|
36
|
-
"@vaadin/button": "^22.0.
|
|
37
|
-
"@vaadin/component-base": "^22.0.
|
|
38
|
-
"@vaadin/progress-bar": "^22.0.
|
|
39
|
-
"@vaadin/vaadin-lumo-styles": "^22.0.
|
|
40
|
-
"@vaadin/vaadin-material-styles": "^22.0.
|
|
41
|
-
"@vaadin/vaadin-themable-mixin": "^22.0.
|
|
36
|
+
"@vaadin/button": "^22.0.16",
|
|
37
|
+
"@vaadin/component-base": "^22.0.16",
|
|
38
|
+
"@vaadin/progress-bar": "^22.0.16",
|
|
39
|
+
"@vaadin/vaadin-lumo-styles": "^22.0.16",
|
|
40
|
+
"@vaadin/vaadin-material-styles": "^22.0.16",
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "^22.0.16"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@esm-bundle/chai": "^4.3.4",
|
|
45
|
-
"@vaadin/form-layout": "^22.0.
|
|
45
|
+
"@vaadin/form-layout": "^22.0.16",
|
|
46
46
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
47
47
|
"sinon": "^9.2.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "dac6f243594ea700bb796d3b41d7b17736d90be8"
|
|
50
50
|
}
|
|
@@ -129,7 +129,7 @@ class UploadFile extends ThemableMixin(PolymerElement) {
|
|
|
129
129
|
return {
|
|
130
130
|
file: Object,
|
|
131
131
|
|
|
132
|
-
i18n: Object
|
|
132
|
+
i18n: Object,
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -139,7 +139,7 @@ class UploadFile extends ThemableMixin(PolymerElement) {
|
|
|
139
139
|
'_toggleHostAttribute(file.error, "error")',
|
|
140
140
|
'_toggleHostAttribute(file.indeterminate, "indeterminate")',
|
|
141
141
|
'_toggleHostAttribute(file.uploading, "uploading")',
|
|
142
|
-
'_toggleHostAttribute(file.complete, "complete")'
|
|
142
|
+
'_toggleHostAttribute(file.complete, "complete")',
|
|
143
143
|
];
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -156,8 +156,8 @@ class UploadFile extends ThemableMixin(PolymerElement) {
|
|
|
156
156
|
new CustomEvent('file-remove', {
|
|
157
157
|
detail: { file: this.file },
|
|
158
158
|
bubbles: true,
|
|
159
|
-
composed: true
|
|
160
|
-
})
|
|
159
|
+
composed: true,
|
|
160
|
+
}),
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -173,8 +173,8 @@ class UploadFile extends ThemableMixin(PolymerElement) {
|
|
|
173
173
|
new CustomEvent(e.target.getAttribute('file-event'), {
|
|
174
174
|
detail: { file: this.file },
|
|
175
175
|
bubbles: true,
|
|
176
|
-
composed: true
|
|
177
|
-
})
|
|
176
|
+
composed: true,
|
|
177
|
+
}),
|
|
178
178
|
);
|
|
179
179
|
}
|
|
180
180
|
|
package/src/vaadin-upload.d.ts
CHANGED
|
@@ -401,13 +401,13 @@ declare class Upload extends ThemableMixin(ElementMixin(HTMLElement)) {
|
|
|
401
401
|
addEventListener<K extends keyof UploadEventMap>(
|
|
402
402
|
type: K,
|
|
403
403
|
listener: (this: Upload, ev: UploadEventMap[K]) => void,
|
|
404
|
-
options?: boolean | AddEventListenerOptions
|
|
404
|
+
options?: boolean | AddEventListenerOptions,
|
|
405
405
|
): void;
|
|
406
406
|
|
|
407
407
|
removeEventListener<K extends keyof UploadEventMap>(
|
|
408
408
|
type: K,
|
|
409
409
|
listener: (this: Upload, ev: UploadEventMap[K]) => void,
|
|
410
|
-
options?: boolean | EventListenerOptions
|
|
410
|
+
options?: boolean | EventListenerOptions,
|
|
411
411
|
): void;
|
|
412
412
|
}
|
|
413
413
|
|
package/src/vaadin-upload.js
CHANGED
|
@@ -143,7 +143,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
143
143
|
nodrop: {
|
|
144
144
|
type: Boolean,
|
|
145
145
|
reflectToAttribute: true,
|
|
146
|
-
value: isTouch
|
|
146
|
+
value: isTouch,
|
|
147
147
|
},
|
|
148
148
|
|
|
149
149
|
/**
|
|
@@ -153,7 +153,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
153
153
|
*/
|
|
154
154
|
target: {
|
|
155
155
|
type: String,
|
|
156
|
-
value: ''
|
|
156
|
+
value: '',
|
|
157
157
|
},
|
|
158
158
|
|
|
159
159
|
/**
|
|
@@ -162,7 +162,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
162
162
|
*/
|
|
163
163
|
method: {
|
|
164
164
|
type: String,
|
|
165
|
-
value: 'POST'
|
|
165
|
+
value: 'POST',
|
|
166
166
|
},
|
|
167
167
|
|
|
168
168
|
/**
|
|
@@ -175,7 +175,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
175
175
|
*/
|
|
176
176
|
headers: {
|
|
177
177
|
type: Object,
|
|
178
|
-
value: {}
|
|
178
|
+
value: {},
|
|
179
179
|
},
|
|
180
180
|
|
|
181
181
|
/**
|
|
@@ -185,14 +185,14 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
185
185
|
*/
|
|
186
186
|
timeout: {
|
|
187
187
|
type: Number,
|
|
188
|
-
value: 0
|
|
188
|
+
value: 0,
|
|
189
189
|
},
|
|
190
190
|
|
|
191
191
|
/** @private */
|
|
192
192
|
_dragover: {
|
|
193
193
|
type: Boolean,
|
|
194
194
|
value: false,
|
|
195
|
-
observer: '_dragoverChanged'
|
|
195
|
+
observer: '_dragoverChanged',
|
|
196
196
|
},
|
|
197
197
|
|
|
198
198
|
/**
|
|
@@ -223,7 +223,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
223
223
|
notify: true,
|
|
224
224
|
value: function () {
|
|
225
225
|
return [];
|
|
226
|
-
}
|
|
226
|
+
},
|
|
227
227
|
},
|
|
228
228
|
|
|
229
229
|
/**
|
|
@@ -234,7 +234,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
234
234
|
*/
|
|
235
235
|
maxFiles: {
|
|
236
236
|
type: Number,
|
|
237
|
-
value: Infinity
|
|
237
|
+
value: Infinity,
|
|
238
238
|
},
|
|
239
239
|
|
|
240
240
|
/**
|
|
@@ -248,7 +248,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
248
248
|
notify: true,
|
|
249
249
|
readOnly: true,
|
|
250
250
|
reflectToAttribute: true,
|
|
251
|
-
computed: '_maxFilesAdded(maxFiles, files.length)'
|
|
251
|
+
computed: '_maxFilesAdded(maxFiles, files.length)',
|
|
252
252
|
},
|
|
253
253
|
|
|
254
254
|
/**
|
|
@@ -262,7 +262,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
262
262
|
*/
|
|
263
263
|
accept: {
|
|
264
264
|
type: String,
|
|
265
|
-
value: ''
|
|
265
|
+
value: '',
|
|
266
266
|
},
|
|
267
267
|
|
|
268
268
|
/**
|
|
@@ -275,7 +275,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
275
275
|
*/
|
|
276
276
|
maxFileSize: {
|
|
277
277
|
type: Number,
|
|
278
|
-
value: Infinity
|
|
278
|
+
value: Infinity,
|
|
279
279
|
},
|
|
280
280
|
|
|
281
281
|
/**
|
|
@@ -286,7 +286,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
286
286
|
_dragoverValid: {
|
|
287
287
|
type: Boolean,
|
|
288
288
|
value: false,
|
|
289
|
-
observer: '_dragoverValidChanged'
|
|
289
|
+
observer: '_dragoverValidChanged',
|
|
290
290
|
},
|
|
291
291
|
|
|
292
292
|
/**
|
|
@@ -296,7 +296,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
296
296
|
*/
|
|
297
297
|
formDataName: {
|
|
298
298
|
type: String,
|
|
299
|
-
value: 'file'
|
|
299
|
+
value: 'file',
|
|
300
300
|
},
|
|
301
301
|
|
|
302
302
|
/**
|
|
@@ -307,7 +307,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
307
307
|
*/
|
|
308
308
|
noAuto: {
|
|
309
309
|
type: Boolean,
|
|
310
|
-
value: false
|
|
310
|
+
value: false,
|
|
311
311
|
},
|
|
312
312
|
|
|
313
313
|
/**
|
|
@@ -317,7 +317,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
317
317
|
*/
|
|
318
318
|
withCredentials: {
|
|
319
319
|
type: Boolean,
|
|
320
|
-
value: false
|
|
320
|
+
value: false,
|
|
321
321
|
},
|
|
322
322
|
|
|
323
323
|
/**
|
|
@@ -392,45 +392,45 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
392
392
|
return {
|
|
393
393
|
dropFiles: {
|
|
394
394
|
one: 'Drop file here',
|
|
395
|
-
many: 'Drop files here'
|
|
395
|
+
many: 'Drop files here',
|
|
396
396
|
},
|
|
397
397
|
addFiles: {
|
|
398
398
|
one: 'Upload File...',
|
|
399
|
-
many: 'Upload Files...'
|
|
399
|
+
many: 'Upload Files...',
|
|
400
400
|
},
|
|
401
401
|
error: {
|
|
402
402
|
tooManyFiles: 'Too Many Files.',
|
|
403
403
|
fileIsTooBig: 'File is Too Big.',
|
|
404
|
-
incorrectFileType: 'Incorrect File Type.'
|
|
404
|
+
incorrectFileType: 'Incorrect File Type.',
|
|
405
405
|
},
|
|
406
406
|
uploading: {
|
|
407
407
|
status: {
|
|
408
408
|
connecting: 'Connecting...',
|
|
409
409
|
stalled: 'Stalled',
|
|
410
410
|
processing: 'Processing File...',
|
|
411
|
-
held: 'Queued'
|
|
411
|
+
held: 'Queued',
|
|
412
412
|
},
|
|
413
413
|
remainingTime: {
|
|
414
414
|
prefix: 'remaining time: ',
|
|
415
|
-
unknown: 'unknown remaining time'
|
|
415
|
+
unknown: 'unknown remaining time',
|
|
416
416
|
},
|
|
417
417
|
error: {
|
|
418
418
|
serverUnavailable: 'Upload failed, please try again later',
|
|
419
419
|
unexpectedServerError: 'Upload failed due to server error',
|
|
420
|
-
forbidden: 'Upload forbidden'
|
|
421
|
-
}
|
|
420
|
+
forbidden: 'Upload forbidden',
|
|
421
|
+
},
|
|
422
422
|
},
|
|
423
423
|
file: {
|
|
424
424
|
retry: 'Retry',
|
|
425
425
|
start: 'Start',
|
|
426
|
-
remove: 'Remove'
|
|
426
|
+
remove: 'Remove',
|
|
427
427
|
},
|
|
428
428
|
units: {
|
|
429
|
-
size: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
|
430
|
-
}
|
|
429
|
+
size: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
|
|
430
|
+
},
|
|
431
431
|
};
|
|
432
|
-
}
|
|
433
|
-
}
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
434
|
};
|
|
435
435
|
}
|
|
436
436
|
|
|
@@ -644,8 +644,8 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
644
644
|
const evt = this.dispatchEvent(
|
|
645
645
|
new CustomEvent('upload-response', {
|
|
646
646
|
detail: { file, xhr },
|
|
647
|
-
cancelable: true
|
|
648
|
-
})
|
|
647
|
+
cancelable: true,
|
|
648
|
+
}),
|
|
649
649
|
);
|
|
650
650
|
|
|
651
651
|
if (!evt) {
|
|
@@ -662,8 +662,8 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
662
662
|
file.complete = !file.error;
|
|
663
663
|
this.dispatchEvent(
|
|
664
664
|
new CustomEvent(`upload-${file.error ? 'error' : 'success'}`, {
|
|
665
|
-
detail: { file, xhr }
|
|
666
|
-
})
|
|
665
|
+
detail: { file, xhr },
|
|
666
|
+
}),
|
|
667
667
|
);
|
|
668
668
|
this._notifyFileChanges(file);
|
|
669
669
|
}
|
|
@@ -677,8 +677,8 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
677
677
|
const evt = this.dispatchEvent(
|
|
678
678
|
new CustomEvent('upload-before', {
|
|
679
679
|
detail: { file, xhr },
|
|
680
|
-
cancelable: true
|
|
681
|
-
})
|
|
680
|
+
cancelable: true,
|
|
681
|
+
}),
|
|
682
682
|
);
|
|
683
683
|
if (!evt) {
|
|
684
684
|
return;
|
|
@@ -696,8 +696,8 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
696
696
|
xhr.upload.onloadstart = () => {
|
|
697
697
|
this.dispatchEvent(
|
|
698
698
|
new CustomEvent('upload-start', {
|
|
699
|
-
detail: { file, xhr }
|
|
700
|
-
})
|
|
699
|
+
detail: { file, xhr },
|
|
700
|
+
}),
|
|
701
701
|
);
|
|
702
702
|
this._notifyFileChanges(file);
|
|
703
703
|
};
|
|
@@ -707,8 +707,8 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
707
707
|
const uploadEvt = this.dispatchEvent(
|
|
708
708
|
new CustomEvent('upload-request', {
|
|
709
709
|
detail: { file, xhr, formData },
|
|
710
|
-
cancelable: true
|
|
711
|
-
})
|
|
710
|
+
cancelable: true,
|
|
711
|
+
}),
|
|
712
712
|
);
|
|
713
713
|
if (uploadEvt) {
|
|
714
714
|
xhr.send(formData);
|
|
@@ -720,8 +720,8 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
720
720
|
const evt = this.dispatchEvent(
|
|
721
721
|
new CustomEvent('upload-retry', {
|
|
722
722
|
detail: { file, xhr: file.xhr },
|
|
723
|
-
cancelable: true
|
|
724
|
-
})
|
|
723
|
+
cancelable: true,
|
|
724
|
+
}),
|
|
725
725
|
);
|
|
726
726
|
if (evt) {
|
|
727
727
|
this._uploadFile(file);
|
|
@@ -733,8 +733,8 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
733
733
|
const evt = this.dispatchEvent(
|
|
734
734
|
new CustomEvent('upload-abort', {
|
|
735
735
|
detail: { file, xhr: file.xhr },
|
|
736
|
-
cancelable: true
|
|
737
|
-
})
|
|
736
|
+
cancelable: true,
|
|
737
|
+
}),
|
|
738
738
|
);
|
|
739
739
|
if (evt) {
|
|
740
740
|
file.abort = true;
|
|
@@ -771,16 +771,16 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
771
771
|
if (this.maxFilesReached) {
|
|
772
772
|
this.dispatchEvent(
|
|
773
773
|
new CustomEvent('file-reject', {
|
|
774
|
-
detail: { file, error: this.i18n.error.tooManyFiles }
|
|
775
|
-
})
|
|
774
|
+
detail: { file, error: this.i18n.error.tooManyFiles },
|
|
775
|
+
}),
|
|
776
776
|
);
|
|
777
777
|
return;
|
|
778
778
|
}
|
|
779
779
|
if (this.maxFileSize >= 0 && file.size > this.maxFileSize) {
|
|
780
780
|
this.dispatchEvent(
|
|
781
781
|
new CustomEvent('file-reject', {
|
|
782
|
-
detail: { file, error: this.i18n.error.fileIsTooBig }
|
|
783
|
-
})
|
|
782
|
+
detail: { file, error: this.i18n.error.fileIsTooBig },
|
|
783
|
+
}),
|
|
784
784
|
);
|
|
785
785
|
return;
|
|
786
786
|
}
|
|
@@ -789,8 +789,8 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
789
789
|
if (this.accept && !(re.test(file.type) || re.test(fileExt))) {
|
|
790
790
|
this.dispatchEvent(
|
|
791
791
|
new CustomEvent('file-reject', {
|
|
792
|
-
detail: { file, error: this.i18n.error.incorrectFileType }
|
|
793
|
-
})
|
|
792
|
+
detail: { file, error: this.i18n.error.incorrectFileType },
|
|
793
|
+
}),
|
|
794
794
|
);
|
|
795
795
|
return;
|
|
796
796
|
}
|
|
@@ -93,7 +93,7 @@ registerStyles(
|
|
|
93
93
|
transition-delay: 0s, 0s;
|
|
94
94
|
}
|
|
95
95
|
`,
|
|
96
|
-
{ moduleId: 'material-upload' }
|
|
96
|
+
{ moduleId: 'material-upload' },
|
|
97
97
|
);
|
|
98
98
|
|
|
99
99
|
registerStyles(
|
|
@@ -247,5 +247,5 @@ registerStyles(
|
|
|
247
247
|
display: none;
|
|
248
248
|
}
|
|
249
249
|
`,
|
|
250
|
-
{ moduleId: 'material-upload-file' }
|
|
250
|
+
{ moduleId: 'material-upload-file' },
|
|
251
251
|
);
|