@vaadin/vaadin-upload 22.0.0-alpha6 → 22.0.0-beta1
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 +23 -30
- package/src/vaadin-upload.d.ts +13 -266
- package/src/vaadin-upload.js +4 -990
- package/theme/lumo/vaadin-upload.js +1 -2
- package/theme/material/vaadin-upload.js +1 -2
- package/vaadin-upload.d.ts +0 -1
- package/src/interfaces.d.ts +0 -161
- package/src/vaadin-upload-file.js +0 -235
- package/src/vaadin-upload-icons.js +0 -19
- package/theme/lumo/vaadin-upload-styles.js +0 -178
- package/theme/material/vaadin-upload-styles.js +0 -244
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import '../../src/vaadin-upload.js';
|
|
1
|
+
import '@vaadin/upload/theme/lumo/vaadin-upload.js';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import '../../src/vaadin-upload.js';
|
|
1
|
+
import '@vaadin/upload/theme/material/vaadin-upload.js';
|
package/vaadin-upload.d.ts
CHANGED
package/src/interfaces.d.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
export interface UploadFile extends File {
|
|
2
|
-
uploadTarget: string;
|
|
3
|
-
elapsed: number;
|
|
4
|
-
elapsedStr: string;
|
|
5
|
-
remaining: number;
|
|
6
|
-
remainingStr: string;
|
|
7
|
-
progress: number;
|
|
8
|
-
speed: number;
|
|
9
|
-
totalStr: string;
|
|
10
|
-
loaded: number;
|
|
11
|
-
loadedStr: string;
|
|
12
|
-
status: string;
|
|
13
|
-
error: string;
|
|
14
|
-
abort?: boolean;
|
|
15
|
-
complete?: boolean;
|
|
16
|
-
uploading?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface UploadI18n {
|
|
20
|
-
dropFiles: {
|
|
21
|
-
one: string;
|
|
22
|
-
many: string;
|
|
23
|
-
};
|
|
24
|
-
addFiles: {
|
|
25
|
-
one: string;
|
|
26
|
-
many: string;
|
|
27
|
-
};
|
|
28
|
-
cancel: string;
|
|
29
|
-
error: {
|
|
30
|
-
tooManyFiles: string;
|
|
31
|
-
fileIsTooBig: string;
|
|
32
|
-
incorrectFileType: string;
|
|
33
|
-
};
|
|
34
|
-
uploading: {
|
|
35
|
-
status: {
|
|
36
|
-
connecting: string;
|
|
37
|
-
stalled: string;
|
|
38
|
-
processing: string;
|
|
39
|
-
held: string;
|
|
40
|
-
};
|
|
41
|
-
remainingTime: {
|
|
42
|
-
prefix: string;
|
|
43
|
-
unknown: string;
|
|
44
|
-
};
|
|
45
|
-
error: {
|
|
46
|
-
serverUnavailable: string;
|
|
47
|
-
unexpectedServerError: string;
|
|
48
|
-
forbidden: string;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
units: {
|
|
52
|
-
size: string[];
|
|
53
|
-
sizeBase?: number;
|
|
54
|
-
};
|
|
55
|
-
formatSize?: (bytes: number) => string;
|
|
56
|
-
formatTime?: (seconds: number, units: number[]) => string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export type UploadMethod = 'POST' | 'PUT';
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Fired when a file cannot be added to the queue due to a constrain:
|
|
63
|
-
* file-size, file-type or maxFiles
|
|
64
|
-
*/
|
|
65
|
-
export type UploadFileRejectEvent = CustomEvent<{ file: UploadFile; error: string }>;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Fired when the `files` property changes.
|
|
69
|
-
*/
|
|
70
|
-
export type UploadFilesChangedEvent = CustomEvent<{ value: UploadFile[] }>;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Fired when the `max-files-reached` property changes.
|
|
74
|
-
*/
|
|
75
|
-
export type UploadMaxFilesReachedChangedEvent = CustomEvent<{ value: boolean }>;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Fired before the XHR is opened. Could be used for changing the request
|
|
79
|
-
* URL. If the default is prevented, then XHR would not be opened.
|
|
80
|
-
*/
|
|
81
|
-
export type UploadBeforeEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Fired when the XHR is sent.
|
|
85
|
-
*/
|
|
86
|
-
export type UploadStartEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Fired as many times as the progress is updated.
|
|
90
|
-
*/
|
|
91
|
-
export type UploadProgressEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Fired in case the upload process succeeded.
|
|
95
|
-
*/
|
|
96
|
-
export type UploadSuccessEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Fired in case the upload process failed.
|
|
100
|
-
*/
|
|
101
|
-
export type UploadErrorEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Fired when we have the actual server response, and before the component
|
|
105
|
-
* analyses it. It's useful for developers to make the upload fail depending
|
|
106
|
-
* on the server response. If the event is defaultPrevented the vaadin-upload
|
|
107
|
-
* will return allowing the user to do something on his own like retry the
|
|
108
|
-
* upload, etc. since he has full access to the `xhr` and `file` objects.
|
|
109
|
-
* Otherwise, if the event is not prevented default `vaadin-upload` continues
|
|
110
|
-
* with the normal workflow checking the `xhr.status` and `file.error`
|
|
111
|
-
* which also might be modified by the user to force a customized response,
|
|
112
|
-
*/
|
|
113
|
-
export type UploadResponseEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Fired when retry upload is requested. If the default is prevented, then
|
|
117
|
-
* retry would not be performed.
|
|
118
|
-
*/
|
|
119
|
-
export type UploadRetryEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Fired when upload abort is requested. If the default is prevented, then the
|
|
123
|
-
* file upload would not be aborted.
|
|
124
|
-
*/
|
|
125
|
-
export type UploadAbortEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile }>;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Fired when the XHR has been opened but not sent yet. Useful for appending
|
|
129
|
-
* data keys to the FormData object, for changing some parameters like
|
|
130
|
-
* headers, etc. If the event is defaultPrevented, `vaadin-upload` will not
|
|
131
|
-
* send the request allowing the user to do something on his own.
|
|
132
|
-
*/
|
|
133
|
-
export type UploadRequestEvent = CustomEvent<{ xhr: XMLHttpRequest; file: UploadFile; formData: FormData }>;
|
|
134
|
-
|
|
135
|
-
export interface UploadElementEventMap {
|
|
136
|
-
'file-reject': UploadFileRejectEvent;
|
|
137
|
-
|
|
138
|
-
'files-changed': UploadFilesChangedEvent;
|
|
139
|
-
|
|
140
|
-
'max-files-reached-changed': UploadMaxFilesReachedChangedEvent;
|
|
141
|
-
|
|
142
|
-
'upload-before': UploadBeforeEvent;
|
|
143
|
-
|
|
144
|
-
'upload-start': UploadStartEvent;
|
|
145
|
-
|
|
146
|
-
'upload-progress': UploadProgressEvent;
|
|
147
|
-
|
|
148
|
-
'upload-response': UploadResponseEvent;
|
|
149
|
-
|
|
150
|
-
'upload-success': UploadSuccessEvent;
|
|
151
|
-
|
|
152
|
-
'upload-error': UploadErrorEvent;
|
|
153
|
-
|
|
154
|
-
'upload-retry': UploadRetryEvent;
|
|
155
|
-
|
|
156
|
-
'upload-abort': UploadAbortEvent;
|
|
157
|
-
|
|
158
|
-
'upload-request': UploadRequestEvent;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export interface UploadEventMap extends HTMLElementEventMap, UploadElementEventMap {}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
|
|
7
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
-
import '@vaadin/vaadin-progress-bar/src/vaadin-progress-bar.js';
|
|
9
|
-
import './vaadin-upload-icons.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* `<vaadin-upload-file>` element represents a file in the file list of `<vaadin-upload>`.
|
|
13
|
-
*
|
|
14
|
-
* ### Styling
|
|
15
|
-
*
|
|
16
|
-
* The following shadow DOM parts are available for styling:
|
|
17
|
-
*
|
|
18
|
-
* Part name | Description
|
|
19
|
-
* ---|---
|
|
20
|
-
* `row` | File container
|
|
21
|
-
* `info` | Container for file status icon, file name, status and error messages
|
|
22
|
-
* `done-icon` | File done status icon
|
|
23
|
-
* `warning-icon` | File warning status icon
|
|
24
|
-
* `meta` | Container for file name, status and error messages
|
|
25
|
-
* `name` | File name
|
|
26
|
-
* `error` | Error message, shown when error happens
|
|
27
|
-
* `status` | Status message
|
|
28
|
-
* `commands` | Container for file command icons
|
|
29
|
-
* `start-button` | Start file upload button
|
|
30
|
-
* `retry-button` | Retry file upload button
|
|
31
|
-
* `clear-button` | Clear file button
|
|
32
|
-
* `progress`| Progress bar
|
|
33
|
-
*
|
|
34
|
-
* The following state attributes are available for styling:
|
|
35
|
-
*
|
|
36
|
-
* Attribute | Description | Part name
|
|
37
|
-
* ---|---|---
|
|
38
|
-
* `error` | An error has happened during uploading | `:host`
|
|
39
|
-
* `indeterminate` | Uploading is in progress, but the progress value is unknown | `:host`
|
|
40
|
-
* `uploading` | Uploading is in progress | `:host`
|
|
41
|
-
* `complete` | Uploading has finished successfully | `:host`
|
|
42
|
-
*
|
|
43
|
-
* See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
|
|
44
|
-
*
|
|
45
|
-
* @mixes ThemableMixin
|
|
46
|
-
*/
|
|
47
|
-
class UploadFileElement extends ThemableMixin(PolymerElement) {
|
|
48
|
-
static get template() {
|
|
49
|
-
return html`
|
|
50
|
-
<style>
|
|
51
|
-
:host {
|
|
52
|
-
display: block;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
[hidden] {
|
|
56
|
-
display: none;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
[part='row'] {
|
|
60
|
-
list-style-type: none;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
button {
|
|
64
|
-
background: transparent;
|
|
65
|
-
padding: 0;
|
|
66
|
-
border: none;
|
|
67
|
-
box-shadow: none;
|
|
68
|
-
}
|
|
69
|
-
</style>
|
|
70
|
-
|
|
71
|
-
<li part="row" tabindex="0">
|
|
72
|
-
<div part="info">
|
|
73
|
-
<div part="done-icon" hidden$="[[!file.complete]]"></div>
|
|
74
|
-
<div part="warning-icon" hidden$="[[!file.error]]"></div>
|
|
75
|
-
|
|
76
|
-
<div part="meta">
|
|
77
|
-
<div part="name" id="name">[[file.name]]</div>
|
|
78
|
-
<div part="status" hidden$="[[!file.status]]" id="status">[[file.status]]</div>
|
|
79
|
-
<div part="error" id="error" hidden$="[[!file.error]]">[[file.error]]</div>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
<div part="commands">
|
|
83
|
-
<button
|
|
84
|
-
type="button"
|
|
85
|
-
part="start-button"
|
|
86
|
-
file-event="file-start"
|
|
87
|
-
on-click="_fireFileEvent"
|
|
88
|
-
hidden$="[[!file.held]]"
|
|
89
|
-
aria-label$="[[i18n.file.start]]"
|
|
90
|
-
aria-describedby="name"
|
|
91
|
-
></button>
|
|
92
|
-
<button
|
|
93
|
-
type="button"
|
|
94
|
-
part="retry-button"
|
|
95
|
-
file-event="file-retry"
|
|
96
|
-
on-click="_fireFileEvent"
|
|
97
|
-
hidden$="[[!file.error]]"
|
|
98
|
-
aria-label$="[[i18n.file.retry]]"
|
|
99
|
-
aria-describedby="name"
|
|
100
|
-
></button>
|
|
101
|
-
<button
|
|
102
|
-
type="button"
|
|
103
|
-
part="clear-button"
|
|
104
|
-
file-event="file-abort"
|
|
105
|
-
on-click="_fireFileEvent"
|
|
106
|
-
aria-label$="[[i18n.file.clear]]"
|
|
107
|
-
aria-describedby="name"
|
|
108
|
-
></button>
|
|
109
|
-
</div>
|
|
110
|
-
</li>
|
|
111
|
-
|
|
112
|
-
<vaadin-progress-bar
|
|
113
|
-
part="progress"
|
|
114
|
-
id="progress"
|
|
115
|
-
value$="[[_formatProgressValue(file.progress)]]"
|
|
116
|
-
error$="[[file.error]]"
|
|
117
|
-
indeterminate$="[[file.indeterminate]]"
|
|
118
|
-
uploading$="[[file.uploading]]"
|
|
119
|
-
complete$="[[file.complete]]"
|
|
120
|
-
></vaadin-progress-bar>
|
|
121
|
-
`;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
static get is() {
|
|
125
|
-
return 'vaadin-upload-file';
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
static get properties() {
|
|
129
|
-
return {
|
|
130
|
-
file: Object,
|
|
131
|
-
|
|
132
|
-
i18n: Object
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
static get observers() {
|
|
137
|
-
return [
|
|
138
|
-
'_fileAborted(file.abort)',
|
|
139
|
-
'_toggleHostAttribute(file.error, "error")',
|
|
140
|
-
'_toggleHostAttribute(file.indeterminate, "indeterminate")',
|
|
141
|
-
'_toggleHostAttribute(file.uploading, "uploading")',
|
|
142
|
-
'_toggleHostAttribute(file.complete, "complete")'
|
|
143
|
-
];
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/** @private */
|
|
147
|
-
_fileAborted(abort) {
|
|
148
|
-
if (abort) {
|
|
149
|
-
this._remove();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/** @private */
|
|
154
|
-
_remove() {
|
|
155
|
-
this.dispatchEvent(
|
|
156
|
-
new CustomEvent('file-remove', {
|
|
157
|
-
detail: { file: this.file },
|
|
158
|
-
bubbles: true,
|
|
159
|
-
composed: true
|
|
160
|
-
})
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/** @private */
|
|
165
|
-
_formatProgressValue(progress) {
|
|
166
|
-
return progress / 100;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/** @private */
|
|
170
|
-
_fireFileEvent(e) {
|
|
171
|
-
e.preventDefault();
|
|
172
|
-
return this.dispatchEvent(
|
|
173
|
-
new CustomEvent(e.target.getAttribute('file-event'), {
|
|
174
|
-
detail: { file: this.file },
|
|
175
|
-
bubbles: true,
|
|
176
|
-
composed: true
|
|
177
|
-
})
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/** @private */
|
|
182
|
-
_toggleHostAttribute(value, attributeName) {
|
|
183
|
-
const shouldHave = Boolean(value);
|
|
184
|
-
const has = this.hasAttribute(attributeName);
|
|
185
|
-
if (has !== shouldHave) {
|
|
186
|
-
if (shouldHave) {
|
|
187
|
-
this.setAttribute(attributeName, '');
|
|
188
|
-
} else {
|
|
189
|
-
this.removeAttribute(attributeName);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Fired when the retry button is pressed. It is listened by `vaadin-upload`
|
|
196
|
-
* which will start a new upload process of this file.
|
|
197
|
-
*
|
|
198
|
-
* @event file-retry
|
|
199
|
-
* @param {Object} detail
|
|
200
|
-
* @param {Object} detail.file file to retry upload of
|
|
201
|
-
*/
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Fired when the start button is pressed. It is listened by `vaadin-upload`
|
|
205
|
-
* which will start a new upload process of this file.
|
|
206
|
-
*
|
|
207
|
-
* @event file-start
|
|
208
|
-
* @param {Object} detail
|
|
209
|
-
* @param {Object} detail.file file to start upload of
|
|
210
|
-
*/
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Fired when abort button is pressed. It is listened by `vaadin-upload` which
|
|
214
|
-
* will abort the upload in progress, but will not remove the file from the list
|
|
215
|
-
* to allow the animation to hide the element to be run.
|
|
216
|
-
*
|
|
217
|
-
* @event file-abort
|
|
218
|
-
* @param {Object} detail
|
|
219
|
-
* @param {Object} detail.file file to abort upload of
|
|
220
|
-
*/
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Fired after the animation to hide the element has finished. It is listened
|
|
224
|
-
* by `vaadin-upload` which will actually remove the file from the upload
|
|
225
|
-
* file list.
|
|
226
|
-
*
|
|
227
|
-
* @event file-remove
|
|
228
|
-
* @param {Object} detail
|
|
229
|
-
* @param {Object} detail.file file to remove from the upload of
|
|
230
|
-
*/
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
customElements.define(UploadFileElement.is, UploadFileElement);
|
|
234
|
-
|
|
235
|
-
export { UploadFileElement };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
const $_documentContainer = document.createElement('template');
|
|
7
|
-
|
|
8
|
-
$_documentContainer.innerHTML = `
|
|
9
|
-
<style>
|
|
10
|
-
@font-face {
|
|
11
|
-
font-family: 'vaadin-upload-icons';
|
|
12
|
-
src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAasAAsAAAAABmAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIF5mNtYXAAAAFoAAAAVAAAAFQXVtKMZ2FzcAAAAbwAAAAIAAAACAAAABBnbHlmAAABxAAAAfQAAAH0bBJxYWhlYWQAAAO4AAAANgAAADYPD267aGhlYQAAA/AAAAAkAAAAJAfCA8tobXR4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|
-
|
|
19
|
-
document.head.appendChild($_documentContainer.content);
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
2
|
-
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
3
|
-
import '@vaadin/vaadin-lumo-styles/sizing.js';
|
|
4
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
5
|
-
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
6
|
-
import '@vaadin/vaadin-lumo-styles/typography.js';
|
|
7
|
-
import { fieldButton } from '@vaadin/vaadin-lumo-styles/mixins/field-button.js';
|
|
8
|
-
import '@vaadin/button/theme/lumo/vaadin-button.js';
|
|
9
|
-
import '@vaadin/vaadin-progress-bar/theme/lumo/vaadin-progress-bar.js';
|
|
10
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
11
|
-
|
|
12
|
-
registerStyles(
|
|
13
|
-
'vaadin-upload',
|
|
14
|
-
css`
|
|
15
|
-
:host {
|
|
16
|
-
line-height: var(--lumo-line-height-m);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
:host(:not([nodrop])) {
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
border: 1px dashed var(--lumo-contrast-20pct);
|
|
22
|
-
border-radius: var(--lumo-border-radius-s);
|
|
23
|
-
padding: var(--lumo-space-m);
|
|
24
|
-
transition: background-color 0.6s, border-color 0.6s;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
[part='primary-buttons'] > * {
|
|
28
|
-
display: inline-block;
|
|
29
|
-
white-space: nowrap;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
[part='drop-label'] {
|
|
33
|
-
display: inline-block;
|
|
34
|
-
white-space: normal;
|
|
35
|
-
padding: 0 var(--lumo-space-s);
|
|
36
|
-
color: var(--lumo-secondary-text-color);
|
|
37
|
-
font-family: var(--lumo-font-family);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
:host([dragover-valid]) {
|
|
41
|
-
border-color: var(--lumo-primary-color-50pct);
|
|
42
|
-
background: var(--lumo-primary-color-10pct);
|
|
43
|
-
transition: background-color 0.1s, border-color 0.1s;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
:host([dragover-valid]) [part='drop-label'] {
|
|
47
|
-
color: var(--lumo-primary-text-color);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
[part='drop-label-icon'] {
|
|
51
|
-
display: inline-block;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
[part='drop-label-icon']::before {
|
|
55
|
-
content: var(--lumo-icons-upload);
|
|
56
|
-
font-family: lumo-icons;
|
|
57
|
-
font-size: var(--lumo-icon-size-m);
|
|
58
|
-
line-height: 1;
|
|
59
|
-
vertical-align: -0.25em;
|
|
60
|
-
}
|
|
61
|
-
`,
|
|
62
|
-
{ moduleId: 'lumo-upload' }
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const uploadFile = css`
|
|
66
|
-
:host {
|
|
67
|
-
padding: var(--lumo-space-s) 0;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
:host(:not(:first-child)) {
|
|
71
|
-
border-top: 1px solid var(--lumo-contrast-10pct);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
[part='row'] {
|
|
75
|
-
display: flex;
|
|
76
|
-
align-items: baseline;
|
|
77
|
-
justify-content: space-between;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
[part='status'],
|
|
81
|
-
[part='error'] {
|
|
82
|
-
color: var(--lumo-secondary-text-color);
|
|
83
|
-
font-size: var(--lumo-font-size-s);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
[part='info'] {
|
|
87
|
-
display: flex;
|
|
88
|
-
align-items: baseline;
|
|
89
|
-
flex: auto;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
[part='meta'] {
|
|
93
|
-
width: 0.001px;
|
|
94
|
-
flex: 1 1 auto;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
[part='name'] {
|
|
98
|
-
white-space: nowrap;
|
|
99
|
-
overflow: hidden;
|
|
100
|
-
text-overflow: ellipsis;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
[part='commands'] {
|
|
104
|
-
display: flex;
|
|
105
|
-
align-items: baseline;
|
|
106
|
-
flex: none;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
[part$='icon'] {
|
|
110
|
-
margin-right: var(--lumo-space-xs);
|
|
111
|
-
font-size: var(--lumo-icon-size-m);
|
|
112
|
-
font-family: 'lumo-icons';
|
|
113
|
-
line-height: 1;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/* When both icons are hidden, let us keep space for one */
|
|
117
|
-
[part='done-icon'][hidden] + [part='warning-icon'][hidden] {
|
|
118
|
-
display: block !important;
|
|
119
|
-
visibility: hidden;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
[part$='button'] {
|
|
123
|
-
flex: none;
|
|
124
|
-
margin-left: var(--lumo-space-xs);
|
|
125
|
-
cursor: var(--lumo-clickable-cursor);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
[part='row']:focus,
|
|
129
|
-
[part$='button']:focus {
|
|
130
|
-
outline: none;
|
|
131
|
-
border-radius: var(--lumo-border-radius-s);
|
|
132
|
-
box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
[part$='icon']::before,
|
|
136
|
-
[part$='button']::before {
|
|
137
|
-
vertical-align: -0.25em;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
[part='done-icon']::before {
|
|
141
|
-
content: var(--lumo-icons-checkmark);
|
|
142
|
-
color: var(--lumo-primary-text-color);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
[part='warning-icon']::before {
|
|
146
|
-
content: var(--lumo-icons-error);
|
|
147
|
-
color: var(--lumo-error-text-color);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
[part='start-button']::before {
|
|
151
|
-
content: var(--lumo-icons-play);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
[part='retry-button']::before {
|
|
155
|
-
content: var(--lumo-icons-reload);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
[part='clear-button']::before {
|
|
159
|
-
content: var(--lumo-icons-cross);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
[part='error'] {
|
|
163
|
-
color: var(--lumo-error-text-color);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
[part='progress'] {
|
|
167
|
-
width: auto;
|
|
168
|
-
margin-left: calc(var(--lumo-icon-size-m) + var(--lumo-space-xs));
|
|
169
|
-
margin-right: calc(var(--lumo-icon-size-m) + var(--lumo-space-xs));
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
[part='progress'][complete],
|
|
173
|
-
[part='progress'][error] {
|
|
174
|
-
display: none;
|
|
175
|
-
}
|
|
176
|
-
`;
|
|
177
|
-
|
|
178
|
-
registerStyles('vaadin-upload-file', [fieldButton, uploadFile], { moduleId: 'lumo-upload-file' });
|