@vaadin/upload 24.2.0-dev.e9803eea7 → 24.3.0-alpha1
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 +16 -10
- package/src/vaadin-upload-file-list-mixin.js +74 -0
- package/src/vaadin-upload-file-list.js +9 -68
- package/src/vaadin-upload-file-mixin.d.ts +71 -0
- package/src/vaadin-upload-file-mixin.js +181 -0
- package/src/vaadin-upload-file-styles.d.ts +8 -0
- package/src/vaadin-upload-file-styles.js +32 -0
- package/src/vaadin-upload-file.d.ts +92 -0
- package/src/vaadin-upload-file.js +10 -199
- package/src/vaadin-upload-icon.js +3 -1
- package/src/vaadin-upload-mixin.d.ts +254 -0
- package/src/vaadin-upload-mixin.js +932 -0
- package/src/vaadin-upload.d.ts +3 -244
- package/src/vaadin-upload.js +6 -922
- package/web-types.json +546 -0
- package/web-types.lit.json +307 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/upload",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.3.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
+
"!src/vaadin-lit-upload-file-list.js",
|
|
25
|
+
"!src/vaadin-lit-upload-file.js",
|
|
26
|
+
"!src/vaadin-lit-upload-icon.js",
|
|
27
|
+
"!src/vaadin-lit-upload.d.ts",
|
|
28
|
+
"!src/vaadin-lit-upload.js",
|
|
24
29
|
"theme",
|
|
25
30
|
"vaadin-*.d.ts",
|
|
26
31
|
"vaadin-*.js",
|
|
@@ -35,24 +40,25 @@
|
|
|
35
40
|
"polymer"
|
|
36
41
|
],
|
|
37
42
|
"dependencies": {
|
|
43
|
+
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
44
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/a11y-base": "24.
|
|
40
|
-
"@vaadin/button": "24.
|
|
41
|
-
"@vaadin/component-base": "24.
|
|
42
|
-
"@vaadin/progress-bar": "24.
|
|
43
|
-
"@vaadin/vaadin-lumo-styles": "24.
|
|
44
|
-
"@vaadin/vaadin-material-styles": "24.
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "24.
|
|
45
|
+
"@vaadin/a11y-base": "24.3.0-alpha1",
|
|
46
|
+
"@vaadin/button": "24.3.0-alpha1",
|
|
47
|
+
"@vaadin/component-base": "24.3.0-alpha1",
|
|
48
|
+
"@vaadin/progress-bar": "24.3.0-alpha1",
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "24.3.0-alpha1",
|
|
50
|
+
"@vaadin/vaadin-material-styles": "24.3.0-alpha1",
|
|
51
|
+
"@vaadin/vaadin-themable-mixin": "24.3.0-alpha1",
|
|
46
52
|
"lit": "^2.0.0"
|
|
47
53
|
},
|
|
48
54
|
"devDependencies": {
|
|
49
55
|
"@esm-bundle/chai": "^4.3.4",
|
|
50
|
-
"@vaadin/testing-helpers": "^0.
|
|
56
|
+
"@vaadin/testing-helpers": "^0.5.0",
|
|
51
57
|
"sinon": "^13.0.2"
|
|
52
58
|
},
|
|
53
59
|
"web-types": [
|
|
54
60
|
"web-types.json",
|
|
55
61
|
"web-types.lit.json"
|
|
56
62
|
],
|
|
57
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "9ca6f3ca220a777e8eea181a1f5717e39a732240"
|
|
58
64
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { html, render } from 'lit';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @polymerMixin
|
|
10
|
+
*/
|
|
11
|
+
export const UploadFileListMixin = (superClass) =>
|
|
12
|
+
class UploadFileListMixin extends superClass {
|
|
13
|
+
static get properties() {
|
|
14
|
+
return {
|
|
15
|
+
/**
|
|
16
|
+
* The array of files being processed, or already uploaded.
|
|
17
|
+
*/
|
|
18
|
+
items: {
|
|
19
|
+
type: Array,
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The object used to localize upload files.
|
|
24
|
+
*/
|
|
25
|
+
i18n: {
|
|
26
|
+
type: Object,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static get observers() {
|
|
32
|
+
return ['__updateItems(items, i18n)'];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** @private */
|
|
36
|
+
__updateItems(items, i18n) {
|
|
37
|
+
if (items && i18n) {
|
|
38
|
+
this.requestContentUpdate();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Requests an update for the `vaadin-upload-file` elements.
|
|
44
|
+
*
|
|
45
|
+
* It is not guaranteed that the update happens immediately (synchronously) after it is requested.
|
|
46
|
+
*/
|
|
47
|
+
requestContentUpdate() {
|
|
48
|
+
const { items, i18n } = this;
|
|
49
|
+
|
|
50
|
+
render(
|
|
51
|
+
html`
|
|
52
|
+
${items.map(
|
|
53
|
+
(file) => html`
|
|
54
|
+
<li>
|
|
55
|
+
<vaadin-upload-file
|
|
56
|
+
.file="${file}"
|
|
57
|
+
.complete="${file.complete}"
|
|
58
|
+
.errorMessage="${file.error}"
|
|
59
|
+
.fileName="${file.name}"
|
|
60
|
+
.held="${file.held}"
|
|
61
|
+
.indeterminate="${file.indeterminate}"
|
|
62
|
+
.progress="${file.progress}"
|
|
63
|
+
.status="${file.status}"
|
|
64
|
+
.uploading="${file.uploading}"
|
|
65
|
+
.i18n="${i18n}"
|
|
66
|
+
></vaadin-upload-file>
|
|
67
|
+
</li>
|
|
68
|
+
`,
|
|
69
|
+
)}
|
|
70
|
+
`,
|
|
71
|
+
this,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
@@ -4,24 +4,27 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import './vaadin-upload-file.js';
|
|
7
|
-
import { html
|
|
8
|
-
import {
|
|
7
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
8
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
9
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
|
+
import { UploadFileListMixin } from './vaadin-upload-file-list-mixin.js';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* An element used internally by `<vaadin-upload>`. Not intended to be used separately.
|
|
13
14
|
*
|
|
15
|
+
* @customElement
|
|
14
16
|
* @extends HTMLElement
|
|
15
|
-
* @mixes
|
|
17
|
+
* @mixes ThemableMixin
|
|
18
|
+
* @mixes UploadFileListMixin
|
|
16
19
|
* @private
|
|
17
20
|
*/
|
|
18
|
-
class UploadFileList extends ThemableMixin(PolymerElement) {
|
|
21
|
+
class UploadFileList extends UploadFileListMixin(ThemableMixin(PolymerElement)) {
|
|
19
22
|
static get is() {
|
|
20
23
|
return 'vaadin-upload-file-list';
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
static get template() {
|
|
24
|
-
return
|
|
27
|
+
return html`
|
|
25
28
|
<style>
|
|
26
29
|
:host {
|
|
27
30
|
display: block;
|
|
@@ -42,70 +45,8 @@ class UploadFileList extends ThemableMixin(PolymerElement) {
|
|
|
42
45
|
</ul>
|
|
43
46
|
`;
|
|
44
47
|
}
|
|
45
|
-
|
|
46
|
-
static get properties() {
|
|
47
|
-
return {
|
|
48
|
-
/**
|
|
49
|
-
* The array of files being processed, or already uploaded.
|
|
50
|
-
*/
|
|
51
|
-
items: {
|
|
52
|
-
type: Array,
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* The object used to localize upload files.
|
|
57
|
-
*/
|
|
58
|
-
i18n: {
|
|
59
|
-
type: Object,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
static get observers() {
|
|
65
|
-
return ['__updateItems(items, i18n)'];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** @private */
|
|
69
|
-
__updateItems(items, i18n) {
|
|
70
|
-
if (items && i18n) {
|
|
71
|
-
this.requestContentUpdate();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Requests an update for the `vaadin-upload-file` elements.
|
|
77
|
-
*
|
|
78
|
-
* It is not guaranteed that the update happens immediately (synchronously) after it is requested.
|
|
79
|
-
*/
|
|
80
|
-
requestContentUpdate() {
|
|
81
|
-
const { items, i18n } = this;
|
|
82
|
-
|
|
83
|
-
render(
|
|
84
|
-
html`
|
|
85
|
-
${items.map(
|
|
86
|
-
(file) => html`
|
|
87
|
-
<li>
|
|
88
|
-
<vaadin-upload-file
|
|
89
|
-
.file="${file}"
|
|
90
|
-
.complete="${file.complete}"
|
|
91
|
-
.errorMessage="${file.error}"
|
|
92
|
-
.fileName="${file.name}"
|
|
93
|
-
.held="${file.held}"
|
|
94
|
-
.indeterminate="${file.indeterminate}"
|
|
95
|
-
.progress="${file.progress}"
|
|
96
|
-
.status="${file.status}"
|
|
97
|
-
.uploading="${file.uploading}"
|
|
98
|
-
.i18n="${i18n}"
|
|
99
|
-
></vaadin-upload-file>
|
|
100
|
-
</li>
|
|
101
|
-
`,
|
|
102
|
-
)}
|
|
103
|
-
`,
|
|
104
|
-
this,
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
48
|
}
|
|
108
49
|
|
|
109
|
-
|
|
50
|
+
defineCustomElement(UploadFileList);
|
|
110
51
|
|
|
111
52
|
export { UploadFileList };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
8
|
+
|
|
9
|
+
export interface UploadFileI18n {
|
|
10
|
+
file: {
|
|
11
|
+
retry: string;
|
|
12
|
+
start: string;
|
|
13
|
+
remove: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare function UploadFileMixin<T extends Constructor<HTMLElement>>(
|
|
18
|
+
base: T,
|
|
19
|
+
): Constructor<FocusMixinClass> & Constructor<UploadFileMixinClass> & T;
|
|
20
|
+
|
|
21
|
+
export declare class UploadFileMixinClass {
|
|
22
|
+
/**
|
|
23
|
+
* True if uploading is completed, false otherwise.
|
|
24
|
+
*/
|
|
25
|
+
complete: boolean;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Error message returned by the server, if any.
|
|
29
|
+
*/
|
|
30
|
+
errorMessage: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The object representing a file.
|
|
34
|
+
*/
|
|
35
|
+
file: File;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Name of the uploading file.
|
|
39
|
+
*/
|
|
40
|
+
fileName: string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* True if uploading is not started, false otherwise.
|
|
44
|
+
*/
|
|
45
|
+
held: boolean;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* True if remaining time is unknown, false otherwise.
|
|
49
|
+
*/
|
|
50
|
+
indeterminate: boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The object used to localize this component.
|
|
54
|
+
*/
|
|
55
|
+
i18n: UploadFileI18n;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Number representing the uploading progress.
|
|
59
|
+
*/
|
|
60
|
+
progress: number;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Uploading status.
|
|
64
|
+
*/
|
|
65
|
+
status: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* True if uploading is in progress, false otherwise.
|
|
69
|
+
*/
|
|
70
|
+
uploading: boolean;
|
|
71
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
7
|
+
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @polymerMixin
|
|
11
|
+
* @mixes FocusMixin
|
|
12
|
+
*/
|
|
13
|
+
export const UploadFileMixin = (superClass) =>
|
|
14
|
+
class UploadFileMixin extends FocusMixin(superClass) {
|
|
15
|
+
static get properties() {
|
|
16
|
+
return {
|
|
17
|
+
/**
|
|
18
|
+
* True if uploading is completed, false otherwise.
|
|
19
|
+
*/
|
|
20
|
+
complete: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
value: false,
|
|
23
|
+
reflectToAttribute: true,
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Error message returned by the server, if any.
|
|
28
|
+
*/
|
|
29
|
+
errorMessage: {
|
|
30
|
+
type: String,
|
|
31
|
+
value: '',
|
|
32
|
+
observer: '_errorMessageChanged',
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The object representing a file.
|
|
37
|
+
*/
|
|
38
|
+
file: {
|
|
39
|
+
type: Object,
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Name of the uploading file.
|
|
44
|
+
*/
|
|
45
|
+
fileName: {
|
|
46
|
+
type: String,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* True if uploading is not started, false otherwise.
|
|
51
|
+
*/
|
|
52
|
+
held: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
value: false,
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* True if remaining time is unknown, false otherwise.
|
|
59
|
+
*/
|
|
60
|
+
indeterminate: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
value: false,
|
|
63
|
+
reflectToAttribute: true,
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The object used to localize this component.
|
|
68
|
+
*/
|
|
69
|
+
i18n: {
|
|
70
|
+
type: Object,
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Number representing the uploading progress.
|
|
75
|
+
*/
|
|
76
|
+
progress: {
|
|
77
|
+
type: Number,
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Uploading status.
|
|
82
|
+
*/
|
|
83
|
+
status: {
|
|
84
|
+
type: String,
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Indicates whether the element can be focused and where it participates in sequential keyboard navigation.
|
|
89
|
+
* @protected
|
|
90
|
+
*/
|
|
91
|
+
tabindex: {
|
|
92
|
+
type: Number,
|
|
93
|
+
value: 0,
|
|
94
|
+
reflectToAttribute: true,
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* True if uploading is in progress, false otherwise.
|
|
99
|
+
*/
|
|
100
|
+
uploading: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
value: false,
|
|
103
|
+
reflectToAttribute: true,
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
/** @private */
|
|
107
|
+
_progress: {
|
|
108
|
+
type: Object,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
static get observers() {
|
|
114
|
+
return ['__updateProgress(_progress, progress, indeterminate)'];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** @protected */
|
|
118
|
+
ready() {
|
|
119
|
+
super.ready();
|
|
120
|
+
|
|
121
|
+
this.addController(
|
|
122
|
+
new SlotController(this, 'progress', 'vaadin-progress-bar', {
|
|
123
|
+
initializer: (progress) => {
|
|
124
|
+
this._progress = progress;
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
// Handle moving focus to the button on Tab.
|
|
130
|
+
this.shadowRoot.addEventListener('focusin', (e) => {
|
|
131
|
+
const target = e.composedPath()[0];
|
|
132
|
+
|
|
133
|
+
if (target.getAttribute('part').endsWith('button')) {
|
|
134
|
+
this._setFocused(false);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// Handle moving focus from the button on Shift Tab.
|
|
139
|
+
this.shadowRoot.addEventListener('focusout', (e) => {
|
|
140
|
+
if (e.relatedTarget === this) {
|
|
141
|
+
this._setFocused(true);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Override method inherited from `FocusMixin` to mark the file as focused
|
|
148
|
+
* only when the host is focused.
|
|
149
|
+
* @param {Event} event
|
|
150
|
+
* @return {boolean}
|
|
151
|
+
* @protected
|
|
152
|
+
*/
|
|
153
|
+
_shouldSetFocus(event) {
|
|
154
|
+
return event.composedPath()[0] === this;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** @private */
|
|
158
|
+
_errorMessageChanged(errorMessage) {
|
|
159
|
+
this.toggleAttribute('error', Boolean(errorMessage));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** @private */
|
|
163
|
+
__updateProgress(progress, value, indeterminate) {
|
|
164
|
+
if (progress) {
|
|
165
|
+
progress.value = isNaN(value) ? 0 : value / 100;
|
|
166
|
+
progress.indeterminate = indeterminate;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** @private */
|
|
171
|
+
_fireFileEvent(e) {
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
return this.dispatchEvent(
|
|
174
|
+
new CustomEvent(e.target.getAttribute('file-event'), {
|
|
175
|
+
detail: { file: this.file },
|
|
176
|
+
bubbles: true,
|
|
177
|
+
composed: true,
|
|
178
|
+
}),
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const uploadFileStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[hidden] {
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[part='row'] {
|
|
18
|
+
list-style-type: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
button {
|
|
22
|
+
background: transparent;
|
|
23
|
+
padding: 0;
|
|
24
|
+
border: none;
|
|
25
|
+
box-shadow: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([complete]) ::slotted([slot='progress']),
|
|
29
|
+
:host([error]) ::slotted([slot='progress']) {
|
|
30
|
+
display: none !important;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
7
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
+
import { UploadFileMixin } from './vaadin-upload-file-mixin.js';
|
|
9
|
+
|
|
10
|
+
export type { UploadFileI18n } from './vaadin-upload-file-mixin.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Fired when the retry button is pressed.
|
|
14
|
+
*/
|
|
15
|
+
export type UploadFileRetryEvent = CustomEvent<{ file: File }>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Fired when the start button is pressed.
|
|
19
|
+
*/
|
|
20
|
+
export type UploadFileStartEvent = CustomEvent<{ file: File }>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Fired when the abort button is pressed.
|
|
24
|
+
*/
|
|
25
|
+
export type UploadFileAbortEvent = CustomEvent<{ file: File }>;
|
|
26
|
+
|
|
27
|
+
export interface UploadFileCustomEventMap {
|
|
28
|
+
'file-retry': UploadFileRetryEvent;
|
|
29
|
+
|
|
30
|
+
'file-start': UploadFileStartEvent;
|
|
31
|
+
|
|
32
|
+
'file-abort': UploadFileAbortEvent;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface UploadFileEventMap extends HTMLElementEventMap, UploadFileCustomEventMap {}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* `<vaadin-upload-file>` element represents a file in the file list of `<vaadin-upload>`.
|
|
39
|
+
*
|
|
40
|
+
* ### Styling
|
|
41
|
+
*
|
|
42
|
+
* The following shadow DOM parts are available for styling:
|
|
43
|
+
*
|
|
44
|
+
* Part name | Description
|
|
45
|
+
* -----------------|-------------
|
|
46
|
+
* `row` | File container
|
|
47
|
+
* `info` | Container for file status icon, file name, status and error messages
|
|
48
|
+
* `done-icon` | File done status icon
|
|
49
|
+
* `warning-icon` | File warning status icon
|
|
50
|
+
* `meta` | Container for file name, status and error messages
|
|
51
|
+
* `name` | File name
|
|
52
|
+
* `error` | Error message, shown when error happens
|
|
53
|
+
* `status` | Status message
|
|
54
|
+
* `commands` | Container for file command buttons
|
|
55
|
+
* `start-button` | Start file upload button
|
|
56
|
+
* `retry-button` | Retry file upload button
|
|
57
|
+
* `remove-button` | Remove file button
|
|
58
|
+
*
|
|
59
|
+
* The following state attributes are available for styling:
|
|
60
|
+
*
|
|
61
|
+
* Attribute | Description
|
|
62
|
+
* -----------------|-------------
|
|
63
|
+
* `focus-ring` | Set when the element is focused using the keyboard.
|
|
64
|
+
* `focused` | Set when the element is focused.
|
|
65
|
+
* `error` | An error has happened during uploading.
|
|
66
|
+
* `indeterminate` | Uploading is in progress, but the progress value is unknown.
|
|
67
|
+
* `uploading` | Uploading is in progress.
|
|
68
|
+
* `complete` | Uploading has finished successfully.
|
|
69
|
+
*
|
|
70
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
71
|
+
*/
|
|
72
|
+
declare class UploadFile extends UploadFileMixin(ThemableMixin(ControllerMixin(HTMLElement))) {
|
|
73
|
+
addEventListener<K extends keyof UploadFileEventMap>(
|
|
74
|
+
type: K,
|
|
75
|
+
listener: (this: UploadFile, ev: UploadFileEventMap[K]) => void,
|
|
76
|
+
options?: AddEventListenerOptions | boolean,
|
|
77
|
+
): void;
|
|
78
|
+
|
|
79
|
+
removeEventListener<K extends keyof UploadFileEventMap>(
|
|
80
|
+
type: K,
|
|
81
|
+
listener: (this: UploadFile, ev: UploadFileEventMap[K]) => void,
|
|
82
|
+
options?: EventListenerOptions | boolean,
|
|
83
|
+
): void;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare global {
|
|
87
|
+
interface HTMLElementTagNameMap {
|
|
88
|
+
'vaadin-upload-file': UploadFile;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { UploadFile };
|