@vaadin/upload 24.8.4 → 25.0.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 +0 -23
- package/package.json +14 -15
- package/src/styles/vaadin-upload-base-styles.d.ts +8 -0
- package/src/styles/vaadin-upload-base-styles.js +58 -0
- package/src/styles/vaadin-upload-core-styles.d.ts +8 -0
- package/src/styles/vaadin-upload-core-styles.js +22 -0
- package/src/styles/vaadin-upload-file-base-styles.js +137 -0
- package/src/styles/vaadin-upload-file-core-styles.d.ts +8 -0
- package/src/styles/vaadin-upload-file-list-base-styles.d.ts +8 -0
- package/src/styles/vaadin-upload-file-list-base-styles.js +35 -0
- package/src/styles/vaadin-upload-file-list-core-styles.d.ts +8 -0
- package/src/styles/vaadin-upload-file-list-core-styles.js +22 -0
- package/src/styles/vaadin-upload-icon-base-styles.d.ts +8 -0
- package/src/styles/vaadin-upload-icon-base-styles.js +33 -0
- package/src/styles/vaadin-upload-icon-core-styles.d.ts +8 -0
- package/src/styles/vaadin-upload-icon-core-styles.js +16 -0
- package/src/vaadin-upload-file-list.js +11 -18
- package/src/vaadin-upload-file.d.ts +1 -2
- package/src/vaadin-upload-file.js +32 -29
- package/src/vaadin-upload-icon.js +16 -13
- package/src/vaadin-upload.d.ts +2 -3
- package/src/vaadin-upload.js +21 -30
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
- 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.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/src/{vaadin-upload-file-styles.d.ts → styles/vaadin-upload-file-base-styles.d.ts} +0 -0
- /package/src/{vaadin-upload-file-styles.js → styles/vaadin-upload-file-core-styles.js} +0 -0
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-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
+
"!src/styles/*-base-styles.d.ts",
|
|
25
|
+
"!src/styles/*-base-styles.js",
|
|
24
26
|
"theme",
|
|
25
27
|
"vaadin-*.d.ts",
|
|
26
28
|
"vaadin-*.js",
|
|
@@ -31,30 +33,27 @@
|
|
|
31
33
|
"Vaadin",
|
|
32
34
|
"upload",
|
|
33
35
|
"web-components",
|
|
34
|
-
"web-component"
|
|
35
|
-
"polymer"
|
|
36
|
+
"web-component"
|
|
36
37
|
],
|
|
37
38
|
"dependencies": {
|
|
38
39
|
"@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.4",
|
|
46
|
-
"@vaadin/vaadin-themable-mixin": "~24.8.4",
|
|
40
|
+
"@vaadin/a11y-base": "25.0.0-alpha10",
|
|
41
|
+
"@vaadin/button": "25.0.0-alpha10",
|
|
42
|
+
"@vaadin/component-base": "25.0.0-alpha10",
|
|
43
|
+
"@vaadin/progress-bar": "25.0.0-alpha10",
|
|
44
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
|
|
47
46
|
"lit": "^3.0.0"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
|
-
"@vaadin/chai-plugins": "
|
|
51
|
-
"@vaadin/test-runner-commands": "
|
|
52
|
-
"@vaadin/testing-helpers": "^
|
|
49
|
+
"@vaadin/chai-plugins": "25.0.0-alpha10",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha10",
|
|
51
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
53
52
|
"sinon": "^18.0.0"
|
|
54
53
|
},
|
|
55
54
|
"web-types": [
|
|
56
55
|
"web-types.json",
|
|
57
56
|
"web-types.lit.json"
|
|
58
57
|
],
|
|
59
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
|
|
60
59
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const uploadStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
background: var(--vaadin-upload-background, transparent);
|
|
12
|
+
border: var(
|
|
13
|
+
--vaadin-upload-border,
|
|
14
|
+
var(--vaadin-upload-border-width, 1px) solid var(--vaadin-upload-border-color, var(--vaadin-border-color))
|
|
15
|
+
);
|
|
16
|
+
border-radius: var(--vaadin-upload-border-radius, var(--vaadin-radius-m));
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
padding: var(--vaadin-upload-padding, var(--vaadin-padding));
|
|
21
|
+
position: relative;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([dragover-valid]) {
|
|
25
|
+
--vaadin-upload-background: var(--vaadin-background-container);
|
|
26
|
+
--vaadin-upload-border: 1px dashed var(--vaadin-color);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:host([hidden]) {
|
|
30
|
+
display: none !important;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[hidden] {
|
|
34
|
+
display: none !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[part='primary-buttons'] {
|
|
38
|
+
align-items: center;
|
|
39
|
+
display: flex;
|
|
40
|
+
gap: var(--vaadin-gap-container-inline);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[part='drop-label'] {
|
|
44
|
+
align-items: center;
|
|
45
|
+
color: var(--vaadin-upload-drop-label-color, var(--vaadin-color));
|
|
46
|
+
display: flex;
|
|
47
|
+
font-size: var(--vaadin-upload-drop-label-font-size, inherit);
|
|
48
|
+
font-weight: var(--vaadin-upload-drop-label-font-weight, inherit);
|
|
49
|
+
gap: var(--vaadin-upload-drop-label-gap, var(--vaadin-gap-container-inline));
|
|
50
|
+
line-height: var(--vaadin-upload-drop-label-line-height, inherit);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host([nodrop]) {
|
|
54
|
+
--vaadin-upload-border: none;
|
|
55
|
+
--vaadin-upload-border-radius: 0;
|
|
56
|
+
--vaadin-upload-padding: 0;
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 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 uploadStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
position: relative;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host([hidden]) {
|
|
16
|
+
display: none !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
[hidden] {
|
|
20
|
+
display: none !important;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const uploadFileStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
align-items: center;
|
|
12
|
+
display: grid;
|
|
13
|
+
gap: var(--vaadin-upload-file-gap, var(--vaadin-gap-container-block));
|
|
14
|
+
grid-template-columns: var(--vaadin-icon-size, 1lh) minmax(0, 1fr) auto;
|
|
15
|
+
padding: var(--vaadin-upload-file-padding, var(--vaadin-padding));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
[hidden] {
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[part='row'] {
|
|
23
|
+
display: contents;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[part='info'] {
|
|
27
|
+
display: contents;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[part='done-icon']:not([hidden]),
|
|
31
|
+
[part='warning-icon']:not([hidden]) {
|
|
32
|
+
display: flex;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[part='done-icon']::before,
|
|
36
|
+
[part='warning-icon']::before {
|
|
37
|
+
content: '';
|
|
38
|
+
display: inline-block;
|
|
39
|
+
flex: none;
|
|
40
|
+
height: var(--vaadin-icon-size, 1lh);
|
|
41
|
+
width: var(--vaadin-icon-size, 1lh);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[part='done-icon']::before {
|
|
45
|
+
background: var(--vaadin-upload-file-done-color, currentColor);
|
|
46
|
+
mask-image: var(--_vaadin-icon-checkmark);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[part='warning-icon']::before {
|
|
50
|
+
background: var(--vaadin-upload-file-warning-color, currentColor);
|
|
51
|
+
mask-image: var(--_vaadin-icon-warn);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
[part='meta'] {
|
|
55
|
+
grid-column: 2;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[part='name'] {
|
|
59
|
+
color: var(--vaadin-upload-file-name-color, var(--vaadin-color));
|
|
60
|
+
font-size: var(--vaadin-upload-file-name-font-size, inherit);
|
|
61
|
+
font-weight: var(--vaadin-upload-file-name-font-weight, inherit);
|
|
62
|
+
line-height: var(--vaadin-upload-file-name-line-height, inherit);
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
text-overflow: ellipsis;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
[part='status'] {
|
|
68
|
+
color: var(--vaadin-upload-file-status-color, var(--vaadin-color-subtle));
|
|
69
|
+
font-size: var(--vaadin-upload-file-status-font-size, inherit);
|
|
70
|
+
font-weight: var(--vaadin-upload-file-status-font-weight, inherit);
|
|
71
|
+
line-height: var(--vaadin-upload-file-status-line-height, inherit);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[part='error'] {
|
|
75
|
+
color: var(--vaadin-upload-file-error-color, var(--vaadin-color));
|
|
76
|
+
font-size: var(--vaadin-upload-file-error-font-size, inherit);
|
|
77
|
+
font-weight: var(--vaadin-upload-file-error-font-weight, inherit);
|
|
78
|
+
line-height: var(--vaadin-upload-file-error-line-height, inherit);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
button {
|
|
82
|
+
background: var(--vaadin-upload-file-button-background, transparent);
|
|
83
|
+
border: var(
|
|
84
|
+
--vaadin-upload-file-button-border,
|
|
85
|
+
var(--vaadin-upload-file-button-border-width, 1px) solid
|
|
86
|
+
var(--vaadin-upload-file-button-border-color, transparent)
|
|
87
|
+
);
|
|
88
|
+
border-radius: var(--vaadin-upload-file-button-border-radius, var(--vaadin-radius-m));
|
|
89
|
+
color: var(--vaadin-upload-file-button-text-color, var(--vaadin-color));
|
|
90
|
+
cursor: var(--vaadin-clickable-cursor);
|
|
91
|
+
flex-shrink: 0;
|
|
92
|
+
font-family: var(--vaadin-upload-file-button-font-family, inherit);
|
|
93
|
+
font-size: var(--vaadin-upload-file-button-font-size, inherit);
|
|
94
|
+
font-weight: var(--vaadin-upload-file-button-font-weight, 500);
|
|
95
|
+
height: var(--vaadin-upload-file-button-height, auto);
|
|
96
|
+
line-height: var(--vaadin-upload-file-button-line-height, inherit);
|
|
97
|
+
padding: var(--vaadin-upload-file-button-padding, var(--vaadin-padding-container));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
[part='start-button']::before,
|
|
101
|
+
[part='retry-button']::before,
|
|
102
|
+
[part='remove-button']::before {
|
|
103
|
+
background: currentColor;
|
|
104
|
+
content: '';
|
|
105
|
+
display: block;
|
|
106
|
+
height: var(--vaadin-icon-size, 1lh);
|
|
107
|
+
width: var(--vaadin-icon-size, 1lh);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
[part='start-button']::before {
|
|
111
|
+
mask-image: var(--_vaadin-icon-play);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
[part='retry-button']::before {
|
|
115
|
+
mask-image: var(--_vaadin-icon-refresh);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
[part='remove-button']::before {
|
|
119
|
+
mask-image: var(--_vaadin-icon-cross);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
::slotted([slot='progress']) {
|
|
123
|
+
grid-column: 2 / -1;
|
|
124
|
+
width: auto;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
:host([complete]) ::slotted([slot='progress']),
|
|
128
|
+
:host([error]) ::slotted([slot='progress']) {
|
|
129
|
+
display: none;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@media (forced-colors: active) {
|
|
133
|
+
:is([part$='icon'], [part$='button'])::before {
|
|
134
|
+
background: CanvasText;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const uploadFileListStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host([hidden]) {
|
|
15
|
+
display: none !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
[part='list'] {
|
|
19
|
+
list-style-type: none;
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
::slotted(:first-child) {
|
|
25
|
+
margin-top: var(--vaadin-upload-gap, var(--vaadin-gap-container-block));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
::slotted(li:not(:last-of-type)) {
|
|
29
|
+
border-bottom: var(
|
|
30
|
+
--vaadin-upload-file-list-border,
|
|
31
|
+
var(--vaadin-upload-file-list-border-width, 1px) solid
|
|
32
|
+
var(--vaadin-upload-file-list-border-color, var(--vaadin-border-color))
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 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 uploadFileListStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:host([hidden]) {
|
|
14
|
+
display: none !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[part='list'] {
|
|
18
|
+
padding: 0;
|
|
19
|
+
margin: 0;
|
|
20
|
+
list-style-type: none;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const uploadIconStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host::before {
|
|
15
|
+
background: var(--vaadin-upload-icon-color, currentColor);
|
|
16
|
+
content: '';
|
|
17
|
+
display: inline-block;
|
|
18
|
+
flex: none;
|
|
19
|
+
height: var(--vaadin-icon-size, 1lh);
|
|
20
|
+
mask-image: var(--_vaadin-icon-upload);
|
|
21
|
+
width: var(--vaadin-icon-size, 1lh);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([hidden]) {
|
|
25
|
+
display: none !important;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@media (forced-colors: active) {
|
|
29
|
+
:host::before {
|
|
30
|
+
background: CanvasText;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 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 uploadIconStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: inline-block;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:host([hidden]) {
|
|
14
|
+
display: none !important;
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
@@ -4,9 +4,12 @@
|
|
|
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 { 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';
|
|
10
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
9
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
+
import { uploadFileListStyles } from './styles/vaadin-upload-file-list-core-styles.js';
|
|
10
13
|
import { UploadFileListMixin } from './vaadin-upload-file-list-mixin.js';
|
|
11
14
|
|
|
12
15
|
/**
|
|
@@ -18,28 +21,18 @@ import { UploadFileListMixin } from './vaadin-upload-file-list-mixin.js';
|
|
|
18
21
|
* @mixes UploadFileListMixin
|
|
19
22
|
* @private
|
|
20
23
|
*/
|
|
21
|
-
class UploadFileList extends UploadFileListMixin(ThemableMixin(
|
|
24
|
+
class UploadFileList extends UploadFileListMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))) {
|
|
22
25
|
static get is() {
|
|
23
26
|
return 'vaadin-upload-file-list';
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
static get
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
:host {
|
|
30
|
-
display: block;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
:host([hidden]) {
|
|
34
|
-
display: none !important;
|
|
35
|
-
}
|
|
29
|
+
static get styles() {
|
|
30
|
+
return uploadFileListStyles;
|
|
31
|
+
}
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
list-style-type: none;
|
|
41
|
-
}
|
|
42
|
-
</style>
|
|
33
|
+
/** @protected */
|
|
34
|
+
render() {
|
|
35
|
+
return html`
|
|
43
36
|
<ul part="list">
|
|
44
37
|
<slot></slot>
|
|
45
38
|
</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,14 +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 { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
12
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
|
+
import { uploadFileStyles } from './styles/vaadin-upload-file-core-styles.js';
|
|
12
14
|
import { UploadFileMixin } from './vaadin-upload-file-mixin.js';
|
|
13
|
-
import { uploadFileStyles } from './vaadin-upload-file-styles.js';
|
|
14
|
-
|
|
15
|
-
registerStyles('vaadin-upload-file', uploadFileStyles, { moduleId: 'vaadin-upload-file-styles' });
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* `<vaadin-upload-file>` element represents a file in the file list of `<vaadin-upload>`.
|
|
@@ -52,22 +51,30 @@ registerStyles('vaadin-upload-file', uploadFileStyles, { moduleId: 'vaadin-uploa
|
|
|
52
51
|
*
|
|
53
52
|
* @customElement
|
|
54
53
|
* @extends HTMLElement
|
|
55
|
-
* @mixes ControllerMixin
|
|
56
54
|
* @mixes UploadFileMixin
|
|
57
55
|
* @mixes ThemableMixin
|
|
58
56
|
*/
|
|
59
|
-
class UploadFile extends UploadFileMixin(ThemableMixin(
|
|
60
|
-
static get
|
|
57
|
+
class UploadFile extends UploadFileMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))) {
|
|
58
|
+
static get is() {
|
|
59
|
+
return 'vaadin-upload-file';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static get styles() {
|
|
63
|
+
return uploadFileStyles;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** @protected */
|
|
67
|
+
render() {
|
|
61
68
|
return html`
|
|
62
69
|
<div part="row">
|
|
63
70
|
<div part="info">
|
|
64
|
-
<div part="done-icon" hidden
|
|
65
|
-
<div part="warning-icon" hidden
|
|
71
|
+
<div part="done-icon" ?hidden="${!this.complete}" aria-hidden="true"></div>
|
|
72
|
+
<div part="warning-icon" ?hidden="${!this.errorMessage}" aria-hidden="true"></div>
|
|
66
73
|
|
|
67
74
|
<div part="meta">
|
|
68
|
-
<div part="name" id="name"
|
|
69
|
-
<div part="status" hidden
|
|
70
|
-
<div part="error" id="error" hidden
|
|
75
|
+
<div part="name" id="name">${this.fileName}</div>
|
|
76
|
+
<div part="status" ?hidden="${!this.status}" id="status">${this.status}</div>
|
|
77
|
+
<div part="error" id="error" ?hidden="${!this.errorMessage}">${this.errorMessage}</div>
|
|
71
78
|
</div>
|
|
72
79
|
</div>
|
|
73
80
|
<div part="commands">
|
|
@@ -75,29 +82,29 @@ class UploadFile extends UploadFileMixin(ThemableMixin(ControllerMixin(PolymerEl
|
|
|
75
82
|
type="button"
|
|
76
83
|
part="start-button"
|
|
77
84
|
file-event="file-start"
|
|
78
|
-
|
|
79
|
-
hidden
|
|
80
|
-
disabled
|
|
81
|
-
aria-label
|
|
85
|
+
@click="${this._fireFileEvent}"
|
|
86
|
+
?hidden="${!this.held}"
|
|
87
|
+
?disabled="${this.disabled}"
|
|
88
|
+
aria-label="${this.i18n ? this.i18n.file.start : nothing}"
|
|
82
89
|
aria-describedby="name"
|
|
83
90
|
></button>
|
|
84
91
|
<button
|
|
85
92
|
type="button"
|
|
86
93
|
part="retry-button"
|
|
87
94
|
file-event="file-retry"
|
|
88
|
-
|
|
89
|
-
hidden
|
|
90
|
-
disabled
|
|
91
|
-
aria-label
|
|
95
|
+
@click="${this._fireFileEvent}"
|
|
96
|
+
?hidden="${!this.errorMessage}"
|
|
97
|
+
?disabled="${this.disabled}"
|
|
98
|
+
aria-label="${this.i18n ? this.i18n.file.retry : nothing}"
|
|
92
99
|
aria-describedby="name"
|
|
93
100
|
></button>
|
|
94
101
|
<button
|
|
95
102
|
type="button"
|
|
96
103
|
part="remove-button"
|
|
97
104
|
file-event="file-abort"
|
|
98
|
-
|
|
99
|
-
disabled
|
|
100
|
-
aria-label
|
|
105
|
+
@click="${this._fireFileEvent}"
|
|
106
|
+
?disabled="${this.disabled}"
|
|
107
|
+
aria-label="${this.i18n ? this.i18n.file.remove : nothing}"
|
|
101
108
|
aria-describedby="name"
|
|
102
109
|
></button>
|
|
103
110
|
</div>
|
|
@@ -107,10 +114,6 @@ class UploadFile extends UploadFileMixin(ThemableMixin(ControllerMixin(PolymerEl
|
|
|
107
114
|
`;
|
|
108
115
|
}
|
|
109
116
|
|
|
110
|
-
static get is() {
|
|
111
|
-
return 'vaadin-upload-file';
|
|
112
|
-
}
|
|
113
|
-
|
|
114
117
|
/**
|
|
115
118
|
* Fired when the retry button is pressed. It is listened by `vaadin-upload`
|
|
116
119
|
* which will start a new upload process of this file.
|