@vaadin/vaadin-upload 4.4.2 → 4.4.4
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# <vaadin-upload>
|
|
2
2
|
|
|
3
|
-
> ⚠️ Starting from Vaadin 20, the source code and issues for this component are migrated to the [`vaadin/web-components`](https://github.com/vaadin/web-components/tree/
|
|
3
|
+
> ⚠️ Starting from Vaadin 20, the source code and issues for this component are migrated to the [`vaadin/web-components`](https://github.com/vaadin/web-components/tree/main/packages/upload) monorepository.
|
|
4
4
|
> This repository contains the source code and releases of `<vaadin-upload>` for the Vaadin versions 10 to 19.
|
|
5
5
|
|
|
6
6
|
[<vaadin-upload>](https://vaadin.com/components/vaadin-upload) is a Web Component for uploading files, part of the [Vaadin components](https://vaadin.com/components).
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"repository": "vaadin/vaadin-upload",
|
|
11
11
|
"homepage": "https://vaadin.com/components",
|
|
12
12
|
"name": "@vaadin/vaadin-upload",
|
|
13
|
-
"version": "4.4.
|
|
13
|
+
"version": "4.4.4",
|
|
14
14
|
"main": "vaadin-upload.js",
|
|
15
15
|
"author": "Vaadin Ltd",
|
|
16
16
|
"license": "Apache-2.0",
|
|
@@ -25,8 +25,6 @@
|
|
|
25
25
|
"theme"
|
|
26
26
|
],
|
|
27
27
|
"resolutions": {
|
|
28
|
-
"es-abstract": "1.17.6",
|
|
29
|
-
"@types/doctrine": "0.0.3",
|
|
30
28
|
"inherits": "2.0.3",
|
|
31
29
|
"samsam": "1.1.3",
|
|
32
30
|
"supports-color": "3.1.2",
|
|
@@ -41,10 +39,9 @@
|
|
|
41
39
|
"@vaadin/vaadin-material-styles": "^1.1.0",
|
|
42
40
|
"@vaadin/vaadin-element-mixin": "^2.4.1"
|
|
43
41
|
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"generate-typings": "gen-typescript-declarations --outDir . --verify"
|
|
46
|
-
},
|
|
47
42
|
"devDependencies": {
|
|
43
|
+
"@web-padawan/gen-typescript-declarations": "^1.6.2",
|
|
44
|
+
"web-component-tester": "6.9.2",
|
|
48
45
|
"@polymer/iron-component-page": "^4.0.0",
|
|
49
46
|
"@polymer/iron-test-helpers": "^3.0.0",
|
|
50
47
|
"mock-http-request": "git://github.com/abuinitski/MockHttpRequest#npm_fix",
|
|
@@ -52,5 +49,9 @@
|
|
|
52
49
|
"wct-browser-legacy": "^1.0.1",
|
|
53
50
|
"@vaadin/vaadin-demo-helpers": "^3.1.0",
|
|
54
51
|
"@polymer/iron-icons": "^3.0.0"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"generate-typings": "gen-typescript-declarations --outDir . --verify",
|
|
55
|
+
"test": "wct --npm"
|
|
55
56
|
}
|
|
56
57
|
}
|
package/src/vaadin-upload.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ import {html} from '@polymer/polymer/lib/utils/html-tag.js';
|
|
|
49
49
|
* `nodrop` | Set when drag and drop is disabled (e. g., on touch devices) | `:host`
|
|
50
50
|
* `dragover` | A file is being dragged over the element | `:host`
|
|
51
51
|
* `dragover-valid` | A dragged file is valid with `maxFiles` and `accept` criteria | `:host`
|
|
52
|
+
* `max-files-reached` | The maximum number of files that the user is allowed to add to the upload has been reached | `:host`
|
|
52
53
|
*
|
|
53
54
|
* See [ThemableMixin – how to apply styles for shadow parts](https://github.com/vaadin/vaadin-themable-mixin/wiki)
|
|
54
55
|
*/
|
package/src/vaadin-upload.js
CHANGED
|
@@ -42,6 +42,7 @@ import { html } from '@polymer/polymer/lib/utils/html-tag.js';
|
|
|
42
42
|
* `nodrop` | Set when drag and drop is disabled (e. g., on touch devices) | `:host`
|
|
43
43
|
* `dragover` | A file is being dragged over the element | `:host`
|
|
44
44
|
* `dragover-valid` | A dragged file is valid with `maxFiles` and `accept` criteria | `:host`
|
|
45
|
+
* `max-files-reached` | The maximum number of files that the user is allowed to add to the upload has been reached | `:host`
|
|
45
46
|
*
|
|
46
47
|
* See [ThemableMixin – how to apply styles for shadow parts](https://github.com/vaadin/vaadin-themable-mixin/wiki)
|
|
47
48
|
*
|
|
@@ -102,7 +103,7 @@ class UploadElement extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
static get version() {
|
|
105
|
-
return '4.4.
|
|
106
|
+
return '4.4.4';
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
static get properties() {
|
|
@@ -230,6 +231,7 @@ class UploadElement extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
230
231
|
value: false,
|
|
231
232
|
notify: true,
|
|
232
233
|
readOnly: true,
|
|
234
|
+
reflectToAttribute: true,
|
|
233
235
|
computed: '_maxFilesAdded(maxFiles, files.length)'
|
|
234
236
|
},
|
|
235
237
|
|
|
@@ -751,7 +753,10 @@ class UploadElement extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
751
753
|
return;
|
|
752
754
|
}
|
|
753
755
|
const fileExt = file.name.match(/\.[^\.]*$|$/)[0];
|
|
754
|
-
|
|
756
|
+
// Escape regex operators common to mime types
|
|
757
|
+
const escapedAccept = this.accept.replace(/[+.]/g, '\\$&');
|
|
758
|
+
// Create accept regex that can match comma separated patterns, star (*) wildcards
|
|
759
|
+
const re = new RegExp(`^(${escapedAccept.replace(/[, ]+/g, '|').replace(/\/\*/g, '/.*')})$`, 'i');
|
|
755
760
|
if (this.accept && !(re.test(file.type) || re.test(fileExt))) {
|
|
756
761
|
this.dispatchEvent(
|
|
757
762
|
new CustomEvent('file-reject', {
|
|
@@ -47,6 +47,10 @@ const $_documentContainer = html`<dom-module id="lumo-upload" theme-for="vaadin-
|
|
|
47
47
|
color: var(--lumo-primary-text-color);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
:host([max-files-reached]) [part='drop-label'] {
|
|
51
|
+
color: var(--lumo-disabled-text-color);
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
[part="drop-label-icon"] {
|
|
51
55
|
display: inline-block;
|
|
52
56
|
}
|
|
@@ -52,6 +52,10 @@ const $_documentContainer = html`<dom-module id="material-upload" theme-for="vaa
|
|
|
52
52
|
color: var(--material-primary-text-color);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
:host([max-files-reached]) [part='drop-label'] {
|
|
56
|
+
color: var(--material-disabled-text-color);
|
|
57
|
+
}
|
|
58
|
+
|
|
55
59
|
[part="drop-label-icon"] {
|
|
56
60
|
display: inline-block;
|
|
57
61
|
margin-right: 8px;
|