@vaadin/upload 24.4.6 → 24.5.0-alpha10
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/README.md
CHANGED
|
@@ -53,7 +53,7 @@ import '@vaadin/upload/src/vaadin-upload.js';
|
|
|
53
53
|
|
|
54
54
|
## Contributing
|
|
55
55
|
|
|
56
|
-
Read the [contributing guide](https://vaadin.com/docs/latest/contributing
|
|
56
|
+
Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
|
57
57
|
|
|
58
58
|
## License
|
|
59
59
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/upload",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.5.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -42,23 +42,23 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
44
44
|
"@polymer/polymer": "^3.0.0",
|
|
45
|
-
"@vaadin/a11y-base": "
|
|
46
|
-
"@vaadin/button": "
|
|
47
|
-
"@vaadin/component-base": "
|
|
48
|
-
"@vaadin/progress-bar": "
|
|
49
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
50
|
-
"@vaadin/vaadin-material-styles": "
|
|
51
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
45
|
+
"@vaadin/a11y-base": "24.5.0-alpha10",
|
|
46
|
+
"@vaadin/button": "24.5.0-alpha10",
|
|
47
|
+
"@vaadin/component-base": "24.5.0-alpha10",
|
|
48
|
+
"@vaadin/progress-bar": "24.5.0-alpha10",
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "24.5.0-alpha10",
|
|
50
|
+
"@vaadin/vaadin-material-styles": "24.5.0-alpha10",
|
|
51
|
+
"@vaadin/vaadin-themable-mixin": "24.5.0-alpha10",
|
|
52
52
|
"lit": "^3.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@
|
|
56
|
-
"@vaadin/testing-helpers": "^0.
|
|
57
|
-
"sinon": "^
|
|
55
|
+
"@vaadin/chai-plugins": "24.5.0-alpha10",
|
|
56
|
+
"@vaadin/testing-helpers": "^1.0.0",
|
|
57
|
+
"sinon": "^18.0.0"
|
|
58
58
|
},
|
|
59
59
|
"web-types": [
|
|
60
60
|
"web-types.json",
|
|
61
61
|
"web-types.lit.json"
|
|
62
62
|
],
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "6f9c37308031af872a98017bfab4de89aeacda51"
|
|
64
64
|
}
|
|
@@ -576,7 +576,7 @@ export const UploadMixin = (superClass) =>
|
|
|
576
576
|
if (typeof this.headers === 'string') {
|
|
577
577
|
try {
|
|
578
578
|
this.headers = JSON.parse(this.headers);
|
|
579
|
-
} catch (
|
|
579
|
+
} catch (_) {
|
|
580
580
|
this.headers = undefined;
|
|
581
581
|
}
|
|
582
582
|
}
|
|
@@ -697,7 +697,9 @@ export const UploadMixin = (superClass) =>
|
|
|
697
697
|
|
|
698
698
|
const formData = new FormData();
|
|
699
699
|
|
|
700
|
-
|
|
700
|
+
if (!file.uploadTarget) {
|
|
701
|
+
file.uploadTarget = this.target || '';
|
|
702
|
+
}
|
|
701
703
|
file.formDataName = this.formDataName;
|
|
702
704
|
|
|
703
705
|
const evt = this.dispatchEvent(
|
|
@@ -751,6 +753,7 @@ export const UploadMixin = (superClass) =>
|
|
|
751
753
|
);
|
|
752
754
|
if (evt) {
|
|
753
755
|
this._uploadFile(file);
|
|
756
|
+
this._updateFocus(this.files.indexOf(file));
|
|
754
757
|
}
|
|
755
758
|
}
|
|
756
759
|
|
|
@@ -825,13 +828,27 @@ export const UploadMixin = (superClass) =>
|
|
|
825
828
|
}
|
|
826
829
|
}
|
|
827
830
|
|
|
831
|
+
/** @private */
|
|
832
|
+
_updateFocus(fileIndex) {
|
|
833
|
+
if (this.files.length === 0) {
|
|
834
|
+
this._addButton.focus();
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
const lastFileRemoved = fileIndex === this.files.length;
|
|
838
|
+
if (lastFileRemoved) {
|
|
839
|
+
fileIndex -= 1;
|
|
840
|
+
}
|
|
841
|
+
this._fileList.children[fileIndex].firstElementChild.focus();
|
|
842
|
+
}
|
|
843
|
+
|
|
828
844
|
/**
|
|
829
845
|
* Remove file from upload list. Called internally if file upload was canceled.
|
|
830
846
|
* @param {!UploadFile} file File to remove
|
|
831
847
|
* @protected
|
|
832
848
|
*/
|
|
833
849
|
_removeFile(file) {
|
|
834
|
-
|
|
850
|
+
const fileIndex = this.files.indexOf(file);
|
|
851
|
+
if (fileIndex >= 0) {
|
|
835
852
|
this.files = this.files.filter((i) => i !== file);
|
|
836
853
|
|
|
837
854
|
this.dispatchEvent(
|
|
@@ -841,6 +858,8 @@ export const UploadMixin = (superClass) =>
|
|
|
841
858
|
composed: true,
|
|
842
859
|
}),
|
|
843
860
|
);
|
|
861
|
+
|
|
862
|
+
this._updateFocus(fileIndex);
|
|
844
863
|
}
|
|
845
864
|
}
|
|
846
865
|
|
|
@@ -21,7 +21,9 @@ registerStyles(
|
|
|
21
21
|
border: 1px dashed var(--lumo-contrast-20pct);
|
|
22
22
|
border-radius: var(--lumo-border-radius-l);
|
|
23
23
|
padding: var(--lumo-space-m);
|
|
24
|
-
transition:
|
|
24
|
+
transition:
|
|
25
|
+
background-color 0.6s,
|
|
26
|
+
border-color 0.6s;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
[part='drop-label'] {
|
|
@@ -35,7 +37,9 @@ registerStyles(
|
|
|
35
37
|
:host([dragover-valid]) {
|
|
36
38
|
border-color: var(--lumo-primary-color-50pct);
|
|
37
39
|
background: var(--lumo-primary-color-10pct);
|
|
38
|
-
transition:
|
|
40
|
+
transition:
|
|
41
|
+
background-color 0.1s,
|
|
42
|
+
border-color 0.1s;
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
:host([dragover-valid]) [part='drop-label'] {
|
|
@@ -63,7 +63,9 @@ registerStyles(
|
|
|
63
63
|
background-color: var(--material-primary-color);
|
|
64
64
|
opacity: 0;
|
|
65
65
|
transform: translate(-50%, -50%) scale(0);
|
|
66
|
-
transition:
|
|
66
|
+
transition:
|
|
67
|
+
transform 0s cubic-bezier(0.075, 0.82, 0.165, 1),
|
|
68
|
+
opacity 0.4s linear;
|
|
67
69
|
transition-delay: 0.4s, 0s;
|
|
68
70
|
}
|
|
69
71
|
|
|
@@ -210,7 +212,9 @@ registerStyles(
|
|
|
210
212
|
background-color: var(--material-body-text-color);
|
|
211
213
|
transform: scale(0);
|
|
212
214
|
opacity: 0;
|
|
213
|
-
transition:
|
|
215
|
+
transition:
|
|
216
|
+
transform 0.08s,
|
|
217
|
+
opacity 0.01s;
|
|
214
218
|
will-change: transform, opacity;
|
|
215
219
|
}
|
|
216
220
|
|
package/web-types.json
CHANGED