@vaadin/upload 24.8.0-alpha8 → 25.0.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/README.md +0 -23
- package/package.json +11 -14
- package/src/vaadin-upload-file-list.js +22 -17
- package/src/vaadin-upload-file.d.ts +1 -2
- package/src/vaadin-upload-file.js +30 -28
- package/src/vaadin-upload-icon.js +15 -12
- package/src/vaadin-upload-mixin.d.ts +34 -29
- package/src/vaadin-upload-mixin.js +150 -135
- package/src/vaadin-upload.d.ts +1 -2
- package/src/vaadin-upload.js +33 -30
- package/web-types.json +10 -10
- package/web-types.lit.json +8 -8
- package/src/vaadin-lit-upload-file-list.js +0 -56
- package/src/vaadin-lit-upload-file.js +0 -87
- package/src/vaadin-lit-upload-icon.js +0 -41
- package/src/vaadin-lit-upload.d.ts +0 -6
- package/src/vaadin-lit-upload.js +0 -77
- package/theme/lumo/vaadin-lit-upload.d.ts +0 -2
- package/theme/lumo/vaadin-lit-upload.js +0 -2
- package/theme/material/vaadin-lit-upload.d.ts +0 -2
- package/theme/material/vaadin-lit-upload.js +0 -2
- package/theme/material/vaadin-upload-styles.d.ts +0 -5
- package/theme/material/vaadin-upload-styles.js +0 -253
- package/theme/material/vaadin-upload.d.ts +0 -2
- package/theme/material/vaadin-upload.js +0 -2
- package/vaadin-lit-upload.d.ts +0 -1
- package/vaadin-lit-upload.js +0 -2
package/README.md
CHANGED
|
@@ -28,29 +28,6 @@ Once installed, import the component in your application:
|
|
|
28
28
|
import '@vaadin/upload';
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
## Themes
|
|
32
|
-
|
|
33
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
34
|
-
The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/upload/vaadin-upload.js) of the package uses the Lumo theme.
|
|
35
|
-
|
|
36
|
-
To use the Material theme, import the component from the `theme/material` folder:
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
import '@vaadin/upload/theme/material/vaadin-upload.js';
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
You can also import the Lumo version of the component explicitly:
|
|
43
|
-
|
|
44
|
-
```js
|
|
45
|
-
import '@vaadin/upload/theme/lumo/vaadin-upload.js';
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
|
|
49
|
-
|
|
50
|
-
```js
|
|
51
|
-
import '@vaadin/upload/src/vaadin-upload.js';
|
|
52
|
-
```
|
|
53
|
-
|
|
54
31
|
## Contributing
|
|
55
32
|
|
|
56
33
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/upload",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,24 +31,21 @@
|
|
|
31
31
|
"Vaadin",
|
|
32
32
|
"upload",
|
|
33
33
|
"web-components",
|
|
34
|
-
"web-component"
|
|
35
|
-
"polymer"
|
|
34
|
+
"web-component"
|
|
36
35
|
],
|
|
37
36
|
"dependencies": {
|
|
38
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
|
-
"@
|
|
40
|
-
"@vaadin/
|
|
41
|
-
"@vaadin/
|
|
42
|
-
"@vaadin/
|
|
43
|
-
"@vaadin/
|
|
44
|
-
"@vaadin/vaadin-
|
|
45
|
-
"@vaadin/vaadin-material-styles": "24.8.0-alpha8",
|
|
46
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha8",
|
|
38
|
+
"@vaadin/a11y-base": "25.0.0-alpha1",
|
|
39
|
+
"@vaadin/button": "25.0.0-alpha1",
|
|
40
|
+
"@vaadin/component-base": "25.0.0-alpha1",
|
|
41
|
+
"@vaadin/progress-bar": "25.0.0-alpha1",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
|
|
47
44
|
"lit": "^3.0.0"
|
|
48
45
|
},
|
|
49
46
|
"devDependencies": {
|
|
50
|
-
"@vaadin/chai-plugins": "
|
|
51
|
-
"@vaadin/test-runner-commands": "
|
|
47
|
+
"@vaadin/chai-plugins": "25.0.0-alpha1",
|
|
48
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha1",
|
|
52
49
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
53
50
|
"sinon": "^18.0.0"
|
|
54
51
|
},
|
|
@@ -56,5 +53,5 @@
|
|
|
56
53
|
"web-types.json",
|
|
57
54
|
"web-types.lit.json"
|
|
58
55
|
],
|
|
59
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
|
|
60
57
|
}
|
|
@@ -4,8 +4,9 @@
|
|
|
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,
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
8
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
10
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
11
|
import { UploadFileListMixin } from './vaadin-upload-file-list-mixin.js';
|
|
11
12
|
|
|
@@ -18,28 +19,32 @@ import { UploadFileListMixin } from './vaadin-upload-file-list-mixin.js';
|
|
|
18
19
|
* @mixes UploadFileListMixin
|
|
19
20
|
* @private
|
|
20
21
|
*/
|
|
21
|
-
class UploadFileList extends UploadFileListMixin(ThemableMixin(
|
|
22
|
+
class UploadFileList extends UploadFileListMixin(ThemableMixin(PolylitMixin(LitElement))) {
|
|
22
23
|
static get is() {
|
|
23
24
|
return 'vaadin-upload-file-list';
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
static get
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
:
|
|
30
|
-
|
|
31
|
-
}
|
|
27
|
+
static get styles() {
|
|
28
|
+
return css`
|
|
29
|
+
:host {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
:host([hidden]) {
|
|
34
|
+
display: none !important;
|
|
35
|
+
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
[part='list'] {
|
|
38
|
+
padding: 0;
|
|
39
|
+
margin: 0;
|
|
40
|
+
list-style-type: none;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** @protected */
|
|
46
|
+
render() {
|
|
47
|
+
return html`
|
|
43
48
|
<ul part="list">
|
|
44
49
|
<slot></slot>
|
|
45
50
|
</ul>
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
7
6
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
7
|
import { UploadFileMixin } from './vaadin-upload-file-mixin.js';
|
|
9
8
|
|
|
@@ -70,7 +69,7 @@ export interface UploadFileEventMap extends HTMLElementEventMap, UploadFileCusto
|
|
|
70
69
|
*
|
|
71
70
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
72
71
|
*/
|
|
73
|
-
declare class UploadFile extends UploadFileMixin(ThemableMixin(
|
|
72
|
+
declare class UploadFile extends UploadFileMixin(ThemableMixin(HTMLElement)) {
|
|
74
73
|
addEventListener<K extends keyof UploadFileEventMap>(
|
|
75
74
|
type: K,
|
|
76
75
|
listener: (this: UploadFile, ev: UploadFileEventMap[K]) => void,
|
|
@@ -5,15 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/progress-bar/src/vaadin-progress-bar.js';
|
|
7
7
|
import './vaadin-upload-icons.js';
|
|
8
|
-
import { html,
|
|
9
|
-
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
8
|
+
import { html, LitElement, nothing } from 'lit';
|
|
10
9
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
11
|
-
import {
|
|
10
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
12
|
import { UploadFileMixin } from './vaadin-upload-file-mixin.js';
|
|
13
13
|
import { uploadFileStyles } from './vaadin-upload-file-styles.js';
|
|
14
14
|
|
|
15
|
-
registerStyles('vaadin-upload-file', uploadFileStyles, { moduleId: 'vaadin-upload-file-styles' });
|
|
16
|
-
|
|
17
15
|
/**
|
|
18
16
|
* `<vaadin-upload-file>` element represents a file in the file list of `<vaadin-upload>`.
|
|
19
17
|
*
|
|
@@ -52,22 +50,30 @@ registerStyles('vaadin-upload-file', uploadFileStyles, { moduleId: 'vaadin-uploa
|
|
|
52
50
|
*
|
|
53
51
|
* @customElement
|
|
54
52
|
* @extends HTMLElement
|
|
55
|
-
* @mixes ControllerMixin
|
|
56
53
|
* @mixes UploadFileMixin
|
|
57
54
|
* @mixes ThemableMixin
|
|
58
55
|
*/
|
|
59
|
-
class UploadFile extends UploadFileMixin(ThemableMixin(
|
|
60
|
-
static get
|
|
56
|
+
class UploadFile extends UploadFileMixin(ThemableMixin(PolylitMixin(LitElement))) {
|
|
57
|
+
static get is() {
|
|
58
|
+
return 'vaadin-upload-file';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static get styles() {
|
|
62
|
+
return uploadFileStyles;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** @protected */
|
|
66
|
+
render() {
|
|
61
67
|
return html`
|
|
62
68
|
<div part="row">
|
|
63
69
|
<div part="info">
|
|
64
|
-
<div part="done-icon" hidden
|
|
65
|
-
<div part="warning-icon" hidden
|
|
70
|
+
<div part="done-icon" ?hidden="${!this.complete}" aria-hidden="true"></div>
|
|
71
|
+
<div part="warning-icon" ?hidden="${!this.errorMessage}" aria-hidden="true"></div>
|
|
66
72
|
|
|
67
73
|
<div part="meta">
|
|
68
|
-
<div part="name" id="name"
|
|
69
|
-
<div part="status" hidden
|
|
70
|
-
<div part="error" id="error" hidden
|
|
74
|
+
<div part="name" id="name">${this.fileName}</div>
|
|
75
|
+
<div part="status" ?hidden="${!this.status}" id="status">${this.status}</div>
|
|
76
|
+
<div part="error" id="error" ?hidden="${!this.errorMessage}">${this.errorMessage}</div>
|
|
71
77
|
</div>
|
|
72
78
|
</div>
|
|
73
79
|
<div part="commands">
|
|
@@ -75,29 +81,29 @@ class UploadFile extends UploadFileMixin(ThemableMixin(ControllerMixin(PolymerEl
|
|
|
75
81
|
type="button"
|
|
76
82
|
part="start-button"
|
|
77
83
|
file-event="file-start"
|
|
78
|
-
|
|
79
|
-
hidden
|
|
80
|
-
disabled
|
|
81
|
-
aria-label
|
|
84
|
+
@click="${this._fireFileEvent}"
|
|
85
|
+
?hidden="${!this.held}"
|
|
86
|
+
?disabled="${this.disabled}"
|
|
87
|
+
aria-label="${this.i18n ? this.i18n.file.start : nothing}"
|
|
82
88
|
aria-describedby="name"
|
|
83
89
|
></button>
|
|
84
90
|
<button
|
|
85
91
|
type="button"
|
|
86
92
|
part="retry-button"
|
|
87
93
|
file-event="file-retry"
|
|
88
|
-
|
|
89
|
-
hidden
|
|
90
|
-
disabled
|
|
91
|
-
aria-label
|
|
94
|
+
@click="${this._fireFileEvent}"
|
|
95
|
+
?hidden="${!this.errorMessage}"
|
|
96
|
+
?disabled="${this.disabled}"
|
|
97
|
+
aria-label="${this.i18n ? this.i18n.file.retry : nothing}"
|
|
92
98
|
aria-describedby="name"
|
|
93
99
|
></button>
|
|
94
100
|
<button
|
|
95
101
|
type="button"
|
|
96
102
|
part="remove-button"
|
|
97
103
|
file-event="file-abort"
|
|
98
|
-
|
|
99
|
-
disabled
|
|
100
|
-
aria-label
|
|
104
|
+
@click="${this._fireFileEvent}"
|
|
105
|
+
?disabled="${this.disabled}"
|
|
106
|
+
aria-label="${this.i18n ? this.i18n.file.remove : nothing}"
|
|
101
107
|
aria-describedby="name"
|
|
102
108
|
></button>
|
|
103
109
|
</div>
|
|
@@ -107,10 +113,6 @@ class UploadFile extends UploadFileMixin(ThemableMixin(ControllerMixin(PolymerEl
|
|
|
107
113
|
`;
|
|
108
114
|
}
|
|
109
115
|
|
|
110
|
-
static get is() {
|
|
111
|
-
return 'vaadin-upload-file';
|
|
112
|
-
}
|
|
113
|
-
|
|
114
116
|
/**
|
|
115
117
|
* Fired when the retry button is pressed. It is listened by `vaadin-upload`
|
|
116
118
|
* which will start a new upload process of this file.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { css, html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
9
|
|
|
@@ -14,24 +14,27 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
14
14
|
* @extends HTMLElement
|
|
15
15
|
* @private
|
|
16
16
|
*/
|
|
17
|
-
class UploadIcon extends ThemableMixin(
|
|
17
|
+
class UploadIcon extends ThemableMixin(LitElement) {
|
|
18
18
|
static get is() {
|
|
19
19
|
return 'vaadin-upload-icon';
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
static get
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
:
|
|
26
|
-
|
|
27
|
-
}
|
|
22
|
+
static get styles() {
|
|
23
|
+
return css`
|
|
24
|
+
:host {
|
|
25
|
+
display: inline-block;
|
|
26
|
+
}
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</style>
|
|
28
|
+
:host([hidden]) {
|
|
29
|
+
display: none !important;
|
|
30
|
+
}
|
|
33
31
|
`;
|
|
34
32
|
}
|
|
33
|
+
|
|
34
|
+
/** @protected */
|
|
35
|
+
render() {
|
|
36
|
+
return html``;
|
|
37
|
+
}
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
defineCustomElement(UploadIcon);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { I18nMixinClass } from '@vaadin/component-base/src/i18n-mixin.js';
|
|
7
8
|
|
|
8
9
|
export interface UploadFile extends File {
|
|
9
10
|
uploadTarget: string;
|
|
@@ -25,47 +26,51 @@ export interface UploadFile extends File {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export interface UploadI18n {
|
|
28
|
-
dropFiles
|
|
29
|
-
one
|
|
30
|
-
many
|
|
29
|
+
dropFiles?: {
|
|
30
|
+
one?: string;
|
|
31
|
+
many?: string;
|
|
31
32
|
};
|
|
32
|
-
addFiles
|
|
33
|
-
one
|
|
34
|
-
many
|
|
33
|
+
addFiles?: {
|
|
34
|
+
one?: string;
|
|
35
|
+
many?: string;
|
|
35
36
|
};
|
|
36
|
-
error
|
|
37
|
-
tooManyFiles
|
|
38
|
-
fileIsTooBig
|
|
39
|
-
incorrectFileType
|
|
37
|
+
error?: {
|
|
38
|
+
tooManyFiles?: string;
|
|
39
|
+
fileIsTooBig?: string;
|
|
40
|
+
incorrectFileType?: string;
|
|
40
41
|
};
|
|
41
|
-
uploading
|
|
42
|
-
status
|
|
43
|
-
connecting
|
|
44
|
-
stalled
|
|
45
|
-
processing
|
|
46
|
-
held
|
|
42
|
+
uploading?: {
|
|
43
|
+
status?: {
|
|
44
|
+
connecting?: string;
|
|
45
|
+
stalled?: string;
|
|
46
|
+
processing?: string;
|
|
47
|
+
held?: string;
|
|
47
48
|
};
|
|
48
|
-
remainingTime
|
|
49
|
-
prefix
|
|
50
|
-
unknown
|
|
49
|
+
remainingTime?: {
|
|
50
|
+
prefix?: string;
|
|
51
|
+
unknown?: string;
|
|
51
52
|
};
|
|
52
|
-
error
|
|
53
|
-
serverUnavailable
|
|
54
|
-
unexpectedServerError
|
|
55
|
-
forbidden
|
|
53
|
+
error?: {
|
|
54
|
+
serverUnavailable?: string;
|
|
55
|
+
unexpectedServerError?: string;
|
|
56
|
+
forbidden?: string;
|
|
56
57
|
};
|
|
57
58
|
};
|
|
58
|
-
units
|
|
59
|
-
size
|
|
59
|
+
units?: {
|
|
60
|
+
size?: string[];
|
|
60
61
|
sizeBase?: number;
|
|
61
62
|
};
|
|
63
|
+
|
|
62
64
|
formatSize?(bytes: number): string;
|
|
65
|
+
|
|
63
66
|
formatTime?(seconds: number, units: number[]): string;
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
export type UploadMethod = 'POST' | 'PUT';
|
|
67
70
|
|
|
68
|
-
export declare function UploadMixin<T extends Constructor<HTMLElement>>(
|
|
71
|
+
export declare function UploadMixin<T extends Constructor<HTMLElement>>(
|
|
72
|
+
base: T,
|
|
73
|
+
): Constructor<UploadMixinClass> & Constructor<I18nMixinClass<UploadI18n>> & T;
|
|
69
74
|
|
|
70
75
|
export declare class UploadMixinClass {
|
|
71
76
|
/**
|
|
@@ -190,9 +195,9 @@ export declare class UploadMixinClass {
|
|
|
190
195
|
capture: string | null | undefined;
|
|
191
196
|
|
|
192
197
|
/**
|
|
193
|
-
* The object used to localize this component.
|
|
194
|
-
*
|
|
195
|
-
*
|
|
198
|
+
* The object used to localize this component. To change the default
|
|
199
|
+
* localization, replace this with an object that provides all properties, or
|
|
200
|
+
* just the individual properties you want to change.
|
|
196
201
|
*
|
|
197
202
|
* The object has the following JSON structure and default values:
|
|
198
203
|
*
|