bromcom-ui 3.0.0-alpha.4 → 3.0.0-alpha.5
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/dist/bromcom-ui/bromcom-ui.css +1 -1
- package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
- package/dist/bromcom-ui/p-01eaca9a.entry.js +5 -0
- package/dist/bromcom-ui/p-3ddd3c83.entry.js +5 -0
- package/dist/bromcom-ui/p-aa67918a.entry.js +5 -0
- package/dist/bromcom-ui/p-d5464577.entry.js +16 -0
- package/dist/cjs/bcm-accordion_69.cjs.entry.js +704 -31
- package/dist/cjs/bcm-file-upload.cjs.entry.js +578 -0
- package/dist/cjs/bcm-form-2.cjs.entry.js +1 -0
- package/dist/cjs/bcm-number-input.cjs.entry.js +8 -2
- package/dist/cjs/bromcom-ui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/atoms/button/button.js +1 -1
- package/dist/collection/components/atoms/button/types.js +7 -0
- package/dist/collection/components/molecules/dropdown/dropdown.js +36 -1
- package/dist/collection/components/molecules/linked/linked-focus-manager.js +86 -0
- package/dist/collection/components/molecules/linked/linked.js +43 -1
- package/dist/collection/components/molecules/number-input/number-input.js +8 -2
- package/dist/collection/components/molecules/number-input/react-input.js +1 -1
- package/dist/collection/components/molecules/upload/file-upload.component.js +1060 -0
- package/dist/collection/components/molecules/upload/file-upload.style.js +201 -0
- package/dist/collection/components/organism/form/form.js +1 -0
- package/dist/collection/components/organism/form-2/bcm-form-components.js +1 -0
- package/dist/collection/components/organism/list/list-focus-manager.js +344 -0
- package/dist/collection/components/organism/list/list-key-control.js +9 -4
- package/dist/collection/components/organism/list/list.css +8 -3
- package/dist/collection/components/organism/list/list.js +226 -26
- package/dist/collection/components/other_deprecated/old-tag/old-tag.js +1 -1
- package/dist/collection/components/other_deprecated/tag/tag.js +1 -1
- package/dist/collection/templates/list-item-template.js +2 -1
- package/dist/components/bcm-dropdown.js +35 -0
- package/dist/components/bcm-file-upload.d.ts +11 -0
- package/dist/components/bcm-file-upload.js +625 -0
- package/dist/components/bcm-form-2.js +1 -0
- package/dist/components/bcm-number-input.js +8 -2
- package/dist/components/button.js +7 -0
- package/dist/components/form.js +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/linked.js +105 -2
- package/dist/components/list.js +559 -31
- package/dist/esm/bcm-accordion_69.entry.js +704 -31
- package/dist/esm/bcm-file-upload.entry.js +574 -0
- package/dist/esm/bcm-form-2.entry.js +1 -0
- package/dist/esm/bcm-number-input.entry.js +8 -2
- package/dist/esm/bromcom-ui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/atoms/button/types.d.ts +8 -1
- package/dist/types/components/molecules/dropdown/dropdown.d.ts +7 -0
- package/dist/types/components/molecules/linked/linked-focus-manager.d.ts +13 -0
- package/dist/types/components/molecules/linked/linked.d.ts +3 -0
- package/dist/types/components/molecules/number-input/number-input.d.ts +1 -0
- package/dist/types/components/molecules/upload/file-upload.component.d.ts +233 -0
- package/dist/types/components/molecules/upload/file-upload.style.d.ts +548 -0
- package/dist/types/components/organism/list/list-focus-manager.d.ts +53 -0
- package/dist/types/components/organism/list/list-key-control.d.ts +1 -0
- package/dist/types/components/organism/list/list.d.ts +18 -1
- package/dist/types/components.d.ts +417 -1
- package/package.json +1 -1
- package/dist/bromcom-ui/p-8e7274e4.entry.js +0 -5
- package/dist/bromcom-ui/p-9e0dd503.entry.js +0 -16
- package/dist/bromcom-ui/p-a320cde8.entry.js +0 -5
|
@@ -0,0 +1,1060 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Stencil
|
|
3
|
+
* Copyright (c) Bromcom.
|
|
4
|
+
*/
|
|
5
|
+
import { h, Host, } from '@stencil/core';
|
|
6
|
+
import { Generate } from '../../../helper/generate';
|
|
7
|
+
import { uploadClasses } from './file-upload.style';
|
|
8
|
+
import { CaptionTemplate } from '../../../templates/caption-template';
|
|
9
|
+
/**
|
|
10
|
+
* @component BcmFileUpload
|
|
11
|
+
* @description A fully featured drag-and-drop file uploader component.
|
|
12
|
+
* Supports form-associated behavior, validation, custom size limits,
|
|
13
|
+
* accepted file type filtering, multiple file selection, progress tracking,
|
|
14
|
+
* upload canceling, file removal, and accessibility events (focus/blur).
|
|
15
|
+
*
|
|
16
|
+
* Upload progress is currently simulated locally. The `uploadUrl` prop
|
|
17
|
+
* is reserved for future real HTTP upload integration and has no effect yet.
|
|
18
|
+
*
|
|
19
|
+
* @example Basic usage
|
|
20
|
+
* <bcm-file-upload name="report" label="Upload Report"></bcm-file-upload>
|
|
21
|
+
*
|
|
22
|
+
* @example Multiple files
|
|
23
|
+
* <bcm-file-upload name="attachments" multiple></bcm-file-upload>
|
|
24
|
+
*
|
|
25
|
+
* @example Custom max size and accepted formats
|
|
26
|
+
* <bcm-file-upload
|
|
27
|
+
* name="medicalFiles"
|
|
28
|
+
* accept=".pdf,.jpg"
|
|
29
|
+
* maxSize={5}
|
|
30
|
+
* ></bcm-file-upload>
|
|
31
|
+
*
|
|
32
|
+
* @prop {string} name
|
|
33
|
+
* The name of the form field used when the component is inside a `<form>`.
|
|
34
|
+
* Supports automatic FormData generation including:
|
|
35
|
+
* - single upload: name="file"
|
|
36
|
+
* - multiple upload: name="file[0], file[1], ..."
|
|
37
|
+
*
|
|
38
|
+
* @prop {string} label
|
|
39
|
+
* Optional label shown above the upload zone.
|
|
40
|
+
*
|
|
41
|
+
* @prop {string} caption
|
|
42
|
+
* Optional helper text rendered below the file list. Example: “Max size 5MB”.
|
|
43
|
+
*
|
|
44
|
+
* @prop {boolean} multiple
|
|
45
|
+
* Allows selecting and uploading multiple files at once.
|
|
46
|
+
*
|
|
47
|
+
* @prop {string} accept
|
|
48
|
+
* Comma-separated list of allowed file extensions.
|
|
49
|
+
* Example: ".pdf,.xls,.png".
|
|
50
|
+
*
|
|
51
|
+
* @prop {number} maxSize
|
|
52
|
+
* Maximum allowed size per file (in MB). If exceeded, an error alert appears.
|
|
53
|
+
*
|
|
54
|
+
* @prop {boolean} required
|
|
55
|
+
* Enables form validation — at least one file must be uploaded.
|
|
56
|
+
* Validation is applied by the surrounding `bcm-form-2` / `bcm-form`
|
|
57
|
+
* component, which reads `required` and `value` and sets the caption error.
|
|
58
|
+
*
|
|
59
|
+
* @prop {boolean} disabled
|
|
60
|
+
* Makes the uploader non-interactive: no clicking, no drag-and-drop.
|
|
61
|
+
*
|
|
62
|
+
* @prop {"medium" | "small"} size
|
|
63
|
+
* Controls spacing, typography, and visual density of the upload zone.
|
|
64
|
+
*
|
|
65
|
+
* @prop {string} uploadUrl
|
|
66
|
+
* Reserved for future backend upload integration.
|
|
67
|
+
* Currently has no effect and does not trigger any HTTP requests.
|
|
68
|
+
*
|
|
69
|
+
* @prop {number} maxFileCount
|
|
70
|
+
* Optional limit for how many files can be selected in total.
|
|
71
|
+
* Only applied when `multiple` is true.
|
|
72
|
+
* If exceeded, new files are ignored and a max-file-count error is shown.
|
|
73
|
+
*
|
|
74
|
+
* @prop {BcmUploadErrorMessages} customErrorMessages
|
|
75
|
+
* Optional override for all error messages:
|
|
76
|
+
* - maxSize: file too large
|
|
77
|
+
* - type: unsupported file type
|
|
78
|
+
* - maxFileCount: too many files selected
|
|
79
|
+
*
|
|
80
|
+
*
|
|
81
|
+
* @event {EventEmitter<File[]>} bcm-file-change
|
|
82
|
+
* Fired whenever the component's internal file list changes.
|
|
83
|
+
* Emits an array of the current File objects.
|
|
84
|
+
*
|
|
85
|
+
* @event {EventEmitter<BcmUploadItem>} bcm-file-removed
|
|
86
|
+
* Fired when the user removes a file from the list.
|
|
87
|
+
*
|
|
88
|
+
* @event {EventEmitter<BcmUploadItem>} bcm-upload-canceled
|
|
89
|
+
* Fired when an upload is canceled before completion.
|
|
90
|
+
*
|
|
91
|
+
* @event {EventEmitter<FocusEvent>} bcm-focus
|
|
92
|
+
* Fired when upload zone receives keyboard or mouse focus.
|
|
93
|
+
*
|
|
94
|
+
* @event {EventEmitter<FocusEvent>} bcm-blur
|
|
95
|
+
* Fired when upload zone loses focus.
|
|
96
|
+
*
|
|
97
|
+
*
|
|
98
|
+
* @csspart upload-zone
|
|
99
|
+
* The root clickable drop area for file selection or drag-and-drop.
|
|
100
|
+
*
|
|
101
|
+
* @csspart file-list
|
|
102
|
+
* The container wrapping rendered file rows.
|
|
103
|
+
*
|
|
104
|
+
* @csspart file-row
|
|
105
|
+
* A single file entry including its name, actions, and progress bar.
|
|
106
|
+
*
|
|
107
|
+
* @csspart remove-btn
|
|
108
|
+
* The remove action button inside uploaded file rows.
|
|
109
|
+
*
|
|
110
|
+
* @csspart cancel-btn
|
|
111
|
+
* The cancel upload button during uploading progress.
|
|
112
|
+
*
|
|
113
|
+
* @csspart download-btn
|
|
114
|
+
* The download button for already uploaded files.
|
|
115
|
+
*
|
|
116
|
+
* @csspart label
|
|
117
|
+
* The external label text displayed above the component.
|
|
118
|
+
*
|
|
119
|
+
* @csspart caption
|
|
120
|
+
* Helper or informative caption displayed below the uploaded list.
|
|
121
|
+
*/
|
|
122
|
+
export class BcmFileUpload {
|
|
123
|
+
constructor() {
|
|
124
|
+
this.inputId = Generate.UID();
|
|
125
|
+
this.labelId = Generate.UID();
|
|
126
|
+
this.internalMaxSizeInBytes = this.maxSize * 1024 * 1024;
|
|
127
|
+
this.onFileInputChange = (event) => {
|
|
128
|
+
const input = event.target;
|
|
129
|
+
this.addFiles(input.files);
|
|
130
|
+
// Reset input so the same file can be selected again
|
|
131
|
+
input.value = '';
|
|
132
|
+
};
|
|
133
|
+
this.openFileDialog = (ev) => {
|
|
134
|
+
var _a;
|
|
135
|
+
ev === null || ev === void 0 ? void 0 : ev.preventDefault();
|
|
136
|
+
ev === null || ev === void 0 ? void 0 : ev.stopPropagation();
|
|
137
|
+
if (this.disabled)
|
|
138
|
+
return;
|
|
139
|
+
(_a = this.fileInput) === null || _a === void 0 ? void 0 : _a.click();
|
|
140
|
+
};
|
|
141
|
+
this.handleZoneMouseEnter = () => {
|
|
142
|
+
if (!this.disabled)
|
|
143
|
+
this.zoneHovered = true;
|
|
144
|
+
};
|
|
145
|
+
this.handleZoneMouseLeave = () => {
|
|
146
|
+
this.zoneHovered = false;
|
|
147
|
+
};
|
|
148
|
+
this.handleZoneKeyDown = (event) => {
|
|
149
|
+
if (this.disabled)
|
|
150
|
+
return;
|
|
151
|
+
if (event.key === ' ' || event.key === 'Enter') {
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
this.openFileDialog();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
this.handleFocus = (event) => {
|
|
157
|
+
this.bcmFocus.emit(event);
|
|
158
|
+
};
|
|
159
|
+
this.handleBlur = (event) => {
|
|
160
|
+
this.bcmBlur.emit(event);
|
|
161
|
+
};
|
|
162
|
+
this.name = 'file';
|
|
163
|
+
this.label = '';
|
|
164
|
+
this.caption = '';
|
|
165
|
+
this.noCaption = false;
|
|
166
|
+
this.multiple = false;
|
|
167
|
+
this.accept = '';
|
|
168
|
+
this.maxSize = 2;
|
|
169
|
+
this.required = false;
|
|
170
|
+
this.disabled = false;
|
|
171
|
+
this.size = 'medium';
|
|
172
|
+
this.position = 'vertical';
|
|
173
|
+
this.buttonLabel = undefined;
|
|
174
|
+
this.showFileList = true;
|
|
175
|
+
this.fullWidth = false;
|
|
176
|
+
this.uploadUrl = undefined;
|
|
177
|
+
this.maxFileCount = undefined;
|
|
178
|
+
this.customErrorMessages = undefined;
|
|
179
|
+
this.value = null;
|
|
180
|
+
this.captionError = undefined;
|
|
181
|
+
this.captionType = undefined;
|
|
182
|
+
this.files = [];
|
|
183
|
+
this.dragActive = false;
|
|
184
|
+
this.zoneHovered = false;
|
|
185
|
+
this.maxSizeError = false;
|
|
186
|
+
this.typeError = false;
|
|
187
|
+
this.maxFileCountError = false;
|
|
188
|
+
}
|
|
189
|
+
componentWillLoad() {
|
|
190
|
+
this.internalMaxSizeInBytes = this.maxSize * 1024 * 1024;
|
|
191
|
+
if (!this.host.hasAttribute('position') && this.size === 'small') {
|
|
192
|
+
this.position = 'horizontal';
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
get isButtonMode() {
|
|
196
|
+
return this.position === 'button';
|
|
197
|
+
}
|
|
198
|
+
get zoneError() {
|
|
199
|
+
return this.captionType === 'error' && !!this.captionError;
|
|
200
|
+
}
|
|
201
|
+
getStyleProps() {
|
|
202
|
+
return {
|
|
203
|
+
size: this.size,
|
|
204
|
+
position: this.position,
|
|
205
|
+
disabled: this.disabled,
|
|
206
|
+
zoneHovered: this.zoneHovered,
|
|
207
|
+
dragActive: this.dragActive,
|
|
208
|
+
zoneError: this.zoneError,
|
|
209
|
+
fullWidth: this.fullWidth,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
disconnectedCallback() {
|
|
213
|
+
// Clear interval when component is removed from the DOM
|
|
214
|
+
if (this.uploadTimer) {
|
|
215
|
+
window.clearInterval(this.uploadTimer);
|
|
216
|
+
this.uploadTimer = undefined;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
handleMaxSizeChange() {
|
|
220
|
+
this.internalMaxSizeInBytes = this.maxSize * 1024 * 1024;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Normalize and check a file against the `accept` attribute.
|
|
224
|
+
*/
|
|
225
|
+
isFileAccepted(file) {
|
|
226
|
+
if (!this.accept)
|
|
227
|
+
return true;
|
|
228
|
+
const extension = '.' + (file.name.split('.').pop() || '').toLowerCase();
|
|
229
|
+
const accepted = this.accept
|
|
230
|
+
.toLowerCase()
|
|
231
|
+
.split(',')
|
|
232
|
+
.map(x => x.trim())
|
|
233
|
+
.filter(Boolean); // e.g. ['.pdf', '.jpg', '.png']
|
|
234
|
+
return accepted.includes(extension);
|
|
235
|
+
}
|
|
236
|
+
emitChange() {
|
|
237
|
+
const fileObjects = this.files.map(f => f.file);
|
|
238
|
+
this.value = fileObjects.length > 0 ? fileObjects : null;
|
|
239
|
+
this.bcmFileChange.emit(fileObjects);
|
|
240
|
+
this.bcmChange.emit(this.value);
|
|
241
|
+
}
|
|
242
|
+
normalizeSetDataToItems(data) {
|
|
243
|
+
const input = Array.isArray(data) ? data : [data];
|
|
244
|
+
return input
|
|
245
|
+
.filter(item => item instanceof File)
|
|
246
|
+
.map((file) => ({
|
|
247
|
+
id: Generate.UID(),
|
|
248
|
+
file,
|
|
249
|
+
status: this.showFileList ? 'uploading' : 'uploaded',
|
|
250
|
+
progress: this.showFileList ? 0 : undefined,
|
|
251
|
+
}));
|
|
252
|
+
}
|
|
253
|
+
async get() {
|
|
254
|
+
return this.value;
|
|
255
|
+
}
|
|
256
|
+
async set(data) {
|
|
257
|
+
if (this.uploadTimer) {
|
|
258
|
+
window.clearInterval(this.uploadTimer);
|
|
259
|
+
this.uploadTimer = undefined;
|
|
260
|
+
}
|
|
261
|
+
const items = this.normalizeSetDataToItems(data);
|
|
262
|
+
if (items.length > 0) {
|
|
263
|
+
this.files = this.multiple ? items : [items[0]];
|
|
264
|
+
this.maxSizeError = false;
|
|
265
|
+
this.typeError = false;
|
|
266
|
+
this.maxFileCountError = false;
|
|
267
|
+
this.emitChange();
|
|
268
|
+
if (this.showFileList) {
|
|
269
|
+
this.startFakeUpload();
|
|
270
|
+
}
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
// Backward-compatible fallback for non-File payloads
|
|
274
|
+
this.value = data;
|
|
275
|
+
this.bcmChange.emit(this.value);
|
|
276
|
+
}
|
|
277
|
+
async setClear() {
|
|
278
|
+
this.files = [];
|
|
279
|
+
this.maxSizeError = false;
|
|
280
|
+
this.typeError = false;
|
|
281
|
+
this.maxFileCountError = false;
|
|
282
|
+
this.emitChange();
|
|
283
|
+
return new Promise(resolve => setTimeout(() => {
|
|
284
|
+
this.resetCaption();
|
|
285
|
+
resolve(undefined);
|
|
286
|
+
}, 10));
|
|
287
|
+
}
|
|
288
|
+
async resetCaption() {
|
|
289
|
+
return new Promise(resolve => setTimeout(() => {
|
|
290
|
+
this.captionError = null;
|
|
291
|
+
this.captionType = null;
|
|
292
|
+
this.maxSizeError = false;
|
|
293
|
+
this.typeError = false;
|
|
294
|
+
this.maxFileCountError = false;
|
|
295
|
+
resolve(undefined);
|
|
296
|
+
}, 10));
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Simulate upload progress. Replace with real upload logic if needed.
|
|
300
|
+
*/
|
|
301
|
+
startFakeUpload() {
|
|
302
|
+
if (this.uploadTimer) {
|
|
303
|
+
window.clearInterval(this.uploadTimer);
|
|
304
|
+
}
|
|
305
|
+
this.uploadTimer = window.setInterval(() => {
|
|
306
|
+
let anyUploading = false;
|
|
307
|
+
this.files = this.files.map(item => {
|
|
308
|
+
var _a;
|
|
309
|
+
if (item.status !== 'uploading')
|
|
310
|
+
return item;
|
|
311
|
+
anyUploading = true;
|
|
312
|
+
const current = (_a = item.progress) !== null && _a !== void 0 ? _a : 0;
|
|
313
|
+
const next = Math.min(current + 15, 100);
|
|
314
|
+
if (next >= 100) {
|
|
315
|
+
return Object.assign(Object.assign({}, item), { status: 'uploaded', progress: undefined });
|
|
316
|
+
}
|
|
317
|
+
return Object.assign(Object.assign({}, item), { progress: next });
|
|
318
|
+
});
|
|
319
|
+
if (!anyUploading && this.uploadTimer) {
|
|
320
|
+
window.clearInterval(this.uploadTimer);
|
|
321
|
+
this.uploadTimer = undefined;
|
|
322
|
+
this.emitChange();
|
|
323
|
+
}
|
|
324
|
+
}, 300);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Add files from input or drop.
|
|
328
|
+
*/
|
|
329
|
+
addFiles(fileList) {
|
|
330
|
+
if (!fileList || this.disabled)
|
|
331
|
+
return;
|
|
332
|
+
const newItems = [];
|
|
333
|
+
let hasSizeError = false;
|
|
334
|
+
let hasTypeError = false;
|
|
335
|
+
Array.from(fileList).forEach(file => {
|
|
336
|
+
if (!this.isFileAccepted(file)) {
|
|
337
|
+
hasTypeError = true;
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (file.size > this.internalMaxSizeInBytes) {
|
|
341
|
+
hasSizeError = true;
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
newItems.push({
|
|
345
|
+
id: Generate.UID(),
|
|
346
|
+
file,
|
|
347
|
+
status: this.showFileList ? 'uploading' : 'uploaded',
|
|
348
|
+
progress: this.showFileList ? 0 : undefined,
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
this.maxSizeError = hasSizeError;
|
|
352
|
+
this.typeError = hasTypeError;
|
|
353
|
+
this.maxFileCountError = false;
|
|
354
|
+
// If there are no valid files, just update validity and exit.
|
|
355
|
+
if (!newItems.length) {
|
|
356
|
+
this.emitChange();
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
let merged;
|
|
360
|
+
if (this.multiple) {
|
|
361
|
+
if (typeof this.maxFileCount === 'number') {
|
|
362
|
+
const remaining = this.maxFileCount - this.files.length;
|
|
363
|
+
if (remaining <= 0) {
|
|
364
|
+
this.maxFileCountError = true;
|
|
365
|
+
this.emitChange();
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const acceptedNew = newItems.slice(0, Math.max(0, remaining));
|
|
369
|
+
if (acceptedNew.length < newItems.length) {
|
|
370
|
+
this.maxFileCountError = true;
|
|
371
|
+
}
|
|
372
|
+
merged = [...this.files, ...acceptedNew];
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
merged = [...this.files, ...newItems];
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
// single file mode → only take first new item
|
|
380
|
+
merged = [newItems[0]];
|
|
381
|
+
}
|
|
382
|
+
this.files = merged;
|
|
383
|
+
this.emitChange();
|
|
384
|
+
// Only fake upload for now (skip when file list UI is hidden).
|
|
385
|
+
if (this.showFileList) {
|
|
386
|
+
this.startFakeUpload();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
removeFile(item) {
|
|
390
|
+
this.files = this.files.filter(f => f.id !== item.id);
|
|
391
|
+
this.bcmFileRemoved.emit(item);
|
|
392
|
+
this.emitChange();
|
|
393
|
+
}
|
|
394
|
+
cancelUpload(item) {
|
|
395
|
+
this.files = this.files.filter(f => f.id !== item.id);
|
|
396
|
+
this.bcmUploadCanceled.emit(item);
|
|
397
|
+
this.emitChange();
|
|
398
|
+
}
|
|
399
|
+
handleDrop(ev) {
|
|
400
|
+
var _a;
|
|
401
|
+
ev.preventDefault();
|
|
402
|
+
this.dragActive = false;
|
|
403
|
+
if (this.disabled || this.isButtonMode)
|
|
404
|
+
return;
|
|
405
|
+
const files = ((_a = ev.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) || null;
|
|
406
|
+
if (!files || files.length === 0)
|
|
407
|
+
return;
|
|
408
|
+
const first = files.item(0);
|
|
409
|
+
if (!first || !this.isFileAccepted(first)) {
|
|
410
|
+
this.typeError = true;
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
this.addFiles(files);
|
|
414
|
+
}
|
|
415
|
+
handleDragOver(ev) {
|
|
416
|
+
ev.preventDefault();
|
|
417
|
+
if (this.disabled || this.isButtonMode)
|
|
418
|
+
return;
|
|
419
|
+
this.dragActive = true;
|
|
420
|
+
}
|
|
421
|
+
handleDragLeave(ev) {
|
|
422
|
+
ev.preventDefault();
|
|
423
|
+
this.dragActive = false;
|
|
424
|
+
}
|
|
425
|
+
async setFocus(options) {
|
|
426
|
+
var _a, _b;
|
|
427
|
+
if (this.isButtonMode) {
|
|
428
|
+
(_a = this.uploadButtonRef) === null || _a === void 0 ? void 0 : _a.focus(options);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
(_b = this.uploadZoneRef) === null || _b === void 0 ? void 0 : _b.focus(options);
|
|
432
|
+
}
|
|
433
|
+
getMaxSizeLabel() {
|
|
434
|
+
const maxMb = Math.round(this.internalMaxSizeInBytes / (1024 * 1024));
|
|
435
|
+
return `Maximum size ${maxMb}MB`;
|
|
436
|
+
}
|
|
437
|
+
renderErrors() {
|
|
438
|
+
var _a, _b, _c;
|
|
439
|
+
const { errorArea, errorIcon, errorClose } = uploadClasses(this.getStyleProps());
|
|
440
|
+
const maxSizeMsg = ((_a = this.customErrorMessages) === null || _a === void 0 ? void 0 : _a.maxSize) ||
|
|
441
|
+
`The file size exceeds the limit of ${Math.round(this.internalMaxSizeInBytes / (1024 * 1024))} MB.`;
|
|
442
|
+
const typeMsg = ((_b = this.customErrorMessages) === null || _b === void 0 ? void 0 : _b.type) ||
|
|
443
|
+
'This file type is not supported.';
|
|
444
|
+
const maxFileCountMsg = ((_c = this.customErrorMessages) === null || _c === void 0 ? void 0 : _c.maxFileCount) ||
|
|
445
|
+
'You have reached the maximum number of files.';
|
|
446
|
+
return (h("div", { class: "tw-w-full tw-space-y-2" }, this.maxSizeError && (h("div", { class: errorArea() }, h("div", { class: errorIcon() }, h("i", { class: "fa-solid fa-circle-exclamation" })), h("span", { class: "tw-flex-1" }, maxSizeMsg), h("div", { class: errorClose(), onClick: () => (this.maxSizeError = false) }, h("i", { class: "fa-solid fa-xmark" })))), this.typeError && (h("div", { class: errorArea() }, h("div", { class: errorIcon() }, h("i", { class: "fa-solid fa-circle-exclamation" })), h("span", { class: "tw-flex-1" }, typeMsg), h("div", { class: errorClose(), onClick: () => (this.typeError = false) }, h("i", { class: "fa-solid fa-xmark" })))), this.maxFileCountError && (h("div", { class: errorArea() }, h("div", { class: errorIcon() }, h("i", { class: "fa-solid fa-circle-exclamation" })), h("span", { class: "tw-flex-1" }, maxFileCountMsg), h("div", { class: errorClose(), onClick: () => (this.maxFileCountError = false) }, h("i", { class: "fa-solid fa-xmark" }))))));
|
|
447
|
+
}
|
|
448
|
+
renderUploadZone() {
|
|
449
|
+
const { zone, iconContainer, iconSizeClass, zoneTextWrapper, zoneTextMain, zoneTextSub, zoneLink, } = uploadClasses(this.getStyleProps());
|
|
450
|
+
return (h("div", { ref: el => (this.uploadZoneRef = el), tabindex: this.disabled ? undefined : 0, part: "upload-zone", class: zone(), role: "button", "aria-disabled": this.disabled ? 'true' : 'false', "aria-labelledby": this.label ? this.labelId : undefined, "aria-label": this.label || 'File upload', onClick: this.openFileDialog, onKeyDown: this.handleZoneKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur, onMouseEnter: this.handleZoneMouseEnter, onMouseLeave: this.handleZoneMouseLeave, onDragOver: ev => this.handleDragOver(ev), onDragLeave: ev => this.handleDragLeave(ev), onDrop: ev => this.handleDrop(ev) }, h("div", { class: iconContainer() }, h("i", { class: `fa-solid fa-cloud-arrow-up ${iconSizeClass()}`, "aria-hidden": "true" })), h("div", { class: zoneTextWrapper() }, h("div", { class: zoneTextMain() }, "Drag and drop your file here ", h("span", { class: "tw-inline-block" }, "or", ' ', h("span", { class: zoneLink(), role: "button", tabindex: -1, "aria-label": "Choose file", onClick: e => this.openFileDialog(e) }, "Browse files"))), h("div", { class: zoneTextSub() }, this.getMaxSizeLabel()))));
|
|
451
|
+
}
|
|
452
|
+
renderUploadButton() {
|
|
453
|
+
const { triggerWrap } = uploadClasses(this.getStyleProps());
|
|
454
|
+
const label = this.buttonLabel || 'Upload';
|
|
455
|
+
return (h("div", { class: triggerWrap(), part: "upload-trigger" }, h("bcm-button", { ref: el => (this.uploadButtonRef = el), variant: "upload", size: this.size, disabled: this.disabled, onFocus: this.handleFocus, onBlur: this.handleBlur, "onBcm-click": (e) => this.openFileDialog(e) }, label)));
|
|
456
|
+
}
|
|
457
|
+
renderHiddenInput() {
|
|
458
|
+
return (h("input", { ref: el => (this.fileInput = el), id: this.inputId, type: "file", hidden: true, accept: this.accept, multiple: this.multiple, disabled: this.disabled, onChange: this.onFileInputChange }));
|
|
459
|
+
}
|
|
460
|
+
renderFileRow(item) {
|
|
461
|
+
var _a, _b;
|
|
462
|
+
const { percent, iconBtn, fileRow, fileRowHeader, fileIcon, fileTitle, progressWrapper, progressTrack, progressBar, } = uploadClasses(this.getStyleProps());
|
|
463
|
+
const isUploading = (item === null || item === void 0 ? void 0 : item.status) === 'uploading';
|
|
464
|
+
return (h("div", { part: "file-row", class: fileRow(), title: (_a = item === null || item === void 0 ? void 0 : item.file) === null || _a === void 0 ? void 0 : _a.name }, h("div", { class: fileRowHeader() }, h("i", { class: `fa-regular fa-file ${fileIcon()}` }), h("span", { class: fileTitle() }, (_b = item === null || item === void 0 ? void 0 : item.file) === null || _b === void 0 ? void 0 : _b.name), h("button", { type: "button", part: isUploading ? 'cancel-btn' : 'remove-btn', class: iconBtn(), onClick: () => isUploading ? this.cancelUpload(item) : this.removeFile(item), title: isUploading ? 'Cancel' : 'Remove' }, h("i", { class: "fa-regular fa-trash" }))), this.showFileList && isUploading && (h("div", { class: progressWrapper() }, h("div", { class: progressTrack() }, h("div", { class: progressBar(), style: { width: `${item.progress || 0}%` } })), h("span", { class: percent() }, item.progress || 0, "%")))));
|
|
465
|
+
}
|
|
466
|
+
render() {
|
|
467
|
+
const { container, label, list, captionWrap } = uploadClasses(this.getStyleProps());
|
|
468
|
+
const hasCaptionText = typeof this.caption === 'string' ? this.caption.trim().length > 0 : !!this.caption;
|
|
469
|
+
const shouldShowCaption = !this.noCaption && (hasCaptionText || !!this.captionError);
|
|
470
|
+
return (h(Host, { tabindex: "-1" }, h("div", { class: container() }, this.label && (h("label", { id: this.labelId, htmlFor: this.inputId, part: "label", class: label() }, this.label)), this.isButtonMode ? this.renderUploadButton() : this.renderUploadZone(), this.renderHiddenInput(), this.renderErrors(), shouldShowCaption && (h("div", { class: captionWrap(), part: "caption" }, h(CaptionTemplate, { noCaption: false, captionType: this.captionType, captionError: this.captionError, caption: this.caption, size: this.size === 'small' ? 'medium' : 'large' }))), this.showFileList && this.files.length > 0 && (h("div", { part: "file-list", class: list() }, this.files.map(item => this.renderFileRow(item)))))));
|
|
471
|
+
}
|
|
472
|
+
static get is() { return "bcm-file-upload"; }
|
|
473
|
+
static get properties() {
|
|
474
|
+
return {
|
|
475
|
+
"name": {
|
|
476
|
+
"type": "string",
|
|
477
|
+
"mutable": false,
|
|
478
|
+
"complexType": {
|
|
479
|
+
"original": "string",
|
|
480
|
+
"resolved": "string",
|
|
481
|
+
"references": {}
|
|
482
|
+
},
|
|
483
|
+
"required": false,
|
|
484
|
+
"optional": false,
|
|
485
|
+
"docs": {
|
|
486
|
+
"tags": [],
|
|
487
|
+
"text": ""
|
|
488
|
+
},
|
|
489
|
+
"attribute": "name",
|
|
490
|
+
"reflect": false,
|
|
491
|
+
"defaultValue": "'file'"
|
|
492
|
+
},
|
|
493
|
+
"label": {
|
|
494
|
+
"type": "string",
|
|
495
|
+
"mutable": false,
|
|
496
|
+
"complexType": {
|
|
497
|
+
"original": "string",
|
|
498
|
+
"resolved": "string",
|
|
499
|
+
"references": {}
|
|
500
|
+
},
|
|
501
|
+
"required": false,
|
|
502
|
+
"optional": false,
|
|
503
|
+
"docs": {
|
|
504
|
+
"tags": [],
|
|
505
|
+
"text": ""
|
|
506
|
+
},
|
|
507
|
+
"attribute": "label",
|
|
508
|
+
"reflect": false,
|
|
509
|
+
"defaultValue": "''"
|
|
510
|
+
},
|
|
511
|
+
"caption": {
|
|
512
|
+
"type": "string",
|
|
513
|
+
"mutable": true,
|
|
514
|
+
"complexType": {
|
|
515
|
+
"original": "string",
|
|
516
|
+
"resolved": "string",
|
|
517
|
+
"references": {}
|
|
518
|
+
},
|
|
519
|
+
"required": false,
|
|
520
|
+
"optional": true,
|
|
521
|
+
"docs": {
|
|
522
|
+
"tags": [],
|
|
523
|
+
"text": ""
|
|
524
|
+
},
|
|
525
|
+
"attribute": "caption",
|
|
526
|
+
"reflect": false,
|
|
527
|
+
"defaultValue": "''"
|
|
528
|
+
},
|
|
529
|
+
"noCaption": {
|
|
530
|
+
"type": "boolean",
|
|
531
|
+
"mutable": true,
|
|
532
|
+
"complexType": {
|
|
533
|
+
"original": "boolean",
|
|
534
|
+
"resolved": "boolean",
|
|
535
|
+
"references": {}
|
|
536
|
+
},
|
|
537
|
+
"required": false,
|
|
538
|
+
"optional": false,
|
|
539
|
+
"docs": {
|
|
540
|
+
"tags": [],
|
|
541
|
+
"text": ""
|
|
542
|
+
},
|
|
543
|
+
"attribute": "no-caption",
|
|
544
|
+
"reflect": false,
|
|
545
|
+
"defaultValue": "false"
|
|
546
|
+
},
|
|
547
|
+
"multiple": {
|
|
548
|
+
"type": "boolean",
|
|
549
|
+
"mutable": false,
|
|
550
|
+
"complexType": {
|
|
551
|
+
"original": "boolean",
|
|
552
|
+
"resolved": "boolean",
|
|
553
|
+
"references": {}
|
|
554
|
+
},
|
|
555
|
+
"required": false,
|
|
556
|
+
"optional": false,
|
|
557
|
+
"docs": {
|
|
558
|
+
"tags": [],
|
|
559
|
+
"text": ""
|
|
560
|
+
},
|
|
561
|
+
"attribute": "multiple",
|
|
562
|
+
"reflect": false,
|
|
563
|
+
"defaultValue": "false"
|
|
564
|
+
},
|
|
565
|
+
"accept": {
|
|
566
|
+
"type": "string",
|
|
567
|
+
"mutable": false,
|
|
568
|
+
"complexType": {
|
|
569
|
+
"original": "string",
|
|
570
|
+
"resolved": "string",
|
|
571
|
+
"references": {}
|
|
572
|
+
},
|
|
573
|
+
"required": false,
|
|
574
|
+
"optional": false,
|
|
575
|
+
"docs": {
|
|
576
|
+
"tags": [],
|
|
577
|
+
"text": ""
|
|
578
|
+
},
|
|
579
|
+
"attribute": "accept",
|
|
580
|
+
"reflect": false,
|
|
581
|
+
"defaultValue": "''"
|
|
582
|
+
},
|
|
583
|
+
"maxSize": {
|
|
584
|
+
"type": "number",
|
|
585
|
+
"mutable": true,
|
|
586
|
+
"complexType": {
|
|
587
|
+
"original": "number",
|
|
588
|
+
"resolved": "number",
|
|
589
|
+
"references": {}
|
|
590
|
+
},
|
|
591
|
+
"required": false,
|
|
592
|
+
"optional": false,
|
|
593
|
+
"docs": {
|
|
594
|
+
"tags": [],
|
|
595
|
+
"text": ""
|
|
596
|
+
},
|
|
597
|
+
"attribute": "max-size",
|
|
598
|
+
"reflect": false,
|
|
599
|
+
"defaultValue": "2"
|
|
600
|
+
},
|
|
601
|
+
"required": {
|
|
602
|
+
"type": "boolean",
|
|
603
|
+
"mutable": false,
|
|
604
|
+
"complexType": {
|
|
605
|
+
"original": "boolean",
|
|
606
|
+
"resolved": "boolean",
|
|
607
|
+
"references": {}
|
|
608
|
+
},
|
|
609
|
+
"required": false,
|
|
610
|
+
"optional": false,
|
|
611
|
+
"docs": {
|
|
612
|
+
"tags": [],
|
|
613
|
+
"text": ""
|
|
614
|
+
},
|
|
615
|
+
"attribute": "required",
|
|
616
|
+
"reflect": false,
|
|
617
|
+
"defaultValue": "false"
|
|
618
|
+
},
|
|
619
|
+
"disabled": {
|
|
620
|
+
"type": "boolean",
|
|
621
|
+
"mutable": false,
|
|
622
|
+
"complexType": {
|
|
623
|
+
"original": "boolean",
|
|
624
|
+
"resolved": "boolean",
|
|
625
|
+
"references": {}
|
|
626
|
+
},
|
|
627
|
+
"required": false,
|
|
628
|
+
"optional": false,
|
|
629
|
+
"docs": {
|
|
630
|
+
"tags": [],
|
|
631
|
+
"text": ""
|
|
632
|
+
},
|
|
633
|
+
"attribute": "disabled",
|
|
634
|
+
"reflect": false,
|
|
635
|
+
"defaultValue": "false"
|
|
636
|
+
},
|
|
637
|
+
"size": {
|
|
638
|
+
"type": "string",
|
|
639
|
+
"mutable": false,
|
|
640
|
+
"complexType": {
|
|
641
|
+
"original": "'medium' | 'small'",
|
|
642
|
+
"resolved": "\"medium\" | \"small\"",
|
|
643
|
+
"references": {}
|
|
644
|
+
},
|
|
645
|
+
"required": false,
|
|
646
|
+
"optional": false,
|
|
647
|
+
"docs": {
|
|
648
|
+
"tags": [],
|
|
649
|
+
"text": ""
|
|
650
|
+
},
|
|
651
|
+
"attribute": "size",
|
|
652
|
+
"reflect": false,
|
|
653
|
+
"defaultValue": "'medium'"
|
|
654
|
+
},
|
|
655
|
+
"position": {
|
|
656
|
+
"type": "string",
|
|
657
|
+
"mutable": false,
|
|
658
|
+
"complexType": {
|
|
659
|
+
"original": "BcmUploadPosition",
|
|
660
|
+
"resolved": "\"button\" | \"horizontal\" | \"vertical\"",
|
|
661
|
+
"references": {
|
|
662
|
+
"BcmUploadPosition": {
|
|
663
|
+
"location": "local"
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
},
|
|
667
|
+
"required": false,
|
|
668
|
+
"optional": false,
|
|
669
|
+
"docs": {
|
|
670
|
+
"tags": [],
|
|
671
|
+
"text": ""
|
|
672
|
+
},
|
|
673
|
+
"attribute": "position",
|
|
674
|
+
"reflect": false,
|
|
675
|
+
"defaultValue": "'vertical'"
|
|
676
|
+
},
|
|
677
|
+
"buttonLabel": {
|
|
678
|
+
"type": "string",
|
|
679
|
+
"mutable": false,
|
|
680
|
+
"complexType": {
|
|
681
|
+
"original": "string",
|
|
682
|
+
"resolved": "string",
|
|
683
|
+
"references": {}
|
|
684
|
+
},
|
|
685
|
+
"required": false,
|
|
686
|
+
"optional": true,
|
|
687
|
+
"docs": {
|
|
688
|
+
"tags": [],
|
|
689
|
+
"text": ""
|
|
690
|
+
},
|
|
691
|
+
"attribute": "button-label",
|
|
692
|
+
"reflect": false
|
|
693
|
+
},
|
|
694
|
+
"showFileList": {
|
|
695
|
+
"type": "boolean",
|
|
696
|
+
"mutable": false,
|
|
697
|
+
"complexType": {
|
|
698
|
+
"original": "boolean",
|
|
699
|
+
"resolved": "boolean",
|
|
700
|
+
"references": {}
|
|
701
|
+
},
|
|
702
|
+
"required": false,
|
|
703
|
+
"optional": false,
|
|
704
|
+
"docs": {
|
|
705
|
+
"tags": [],
|
|
706
|
+
"text": ""
|
|
707
|
+
},
|
|
708
|
+
"attribute": "show-file-list",
|
|
709
|
+
"reflect": false,
|
|
710
|
+
"defaultValue": "true"
|
|
711
|
+
},
|
|
712
|
+
"fullWidth": {
|
|
713
|
+
"type": "boolean",
|
|
714
|
+
"mutable": false,
|
|
715
|
+
"complexType": {
|
|
716
|
+
"original": "boolean",
|
|
717
|
+
"resolved": "boolean",
|
|
718
|
+
"references": {}
|
|
719
|
+
},
|
|
720
|
+
"required": false,
|
|
721
|
+
"optional": false,
|
|
722
|
+
"docs": {
|
|
723
|
+
"tags": [],
|
|
724
|
+
"text": ""
|
|
725
|
+
},
|
|
726
|
+
"attribute": "full-width",
|
|
727
|
+
"reflect": false,
|
|
728
|
+
"defaultValue": "false"
|
|
729
|
+
},
|
|
730
|
+
"uploadUrl": {
|
|
731
|
+
"type": "string",
|
|
732
|
+
"mutable": false,
|
|
733
|
+
"complexType": {
|
|
734
|
+
"original": "string",
|
|
735
|
+
"resolved": "string",
|
|
736
|
+
"references": {}
|
|
737
|
+
},
|
|
738
|
+
"required": false,
|
|
739
|
+
"optional": true,
|
|
740
|
+
"docs": {
|
|
741
|
+
"tags": [],
|
|
742
|
+
"text": "Reserved for future backend upload integration.\nCurrently does not affect component behavior."
|
|
743
|
+
},
|
|
744
|
+
"attribute": "upload-url",
|
|
745
|
+
"reflect": false
|
|
746
|
+
},
|
|
747
|
+
"maxFileCount": {
|
|
748
|
+
"type": "number",
|
|
749
|
+
"mutable": false,
|
|
750
|
+
"complexType": {
|
|
751
|
+
"original": "number",
|
|
752
|
+
"resolved": "number",
|
|
753
|
+
"references": {}
|
|
754
|
+
},
|
|
755
|
+
"required": false,
|
|
756
|
+
"optional": true,
|
|
757
|
+
"docs": {
|
|
758
|
+
"tags": [],
|
|
759
|
+
"text": "Maximum number of files allowed in total.\nOnly applied when `multiple` is true."
|
|
760
|
+
},
|
|
761
|
+
"attribute": "max-file-count",
|
|
762
|
+
"reflect": false
|
|
763
|
+
},
|
|
764
|
+
"customErrorMessages": {
|
|
765
|
+
"type": "unknown",
|
|
766
|
+
"mutable": false,
|
|
767
|
+
"complexType": {
|
|
768
|
+
"original": "BcmUploadErrorMessages",
|
|
769
|
+
"resolved": "BcmUploadErrorMessages",
|
|
770
|
+
"references": {
|
|
771
|
+
"BcmUploadErrorMessages": {
|
|
772
|
+
"location": "local"
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
"required": false,
|
|
777
|
+
"optional": true,
|
|
778
|
+
"docs": {
|
|
779
|
+
"tags": [],
|
|
780
|
+
"text": "Allows consumers to override default error messages."
|
|
781
|
+
}
|
|
782
|
+
},
|
|
783
|
+
"value": {
|
|
784
|
+
"type": "any",
|
|
785
|
+
"mutable": true,
|
|
786
|
+
"complexType": {
|
|
787
|
+
"original": "any",
|
|
788
|
+
"resolved": "any",
|
|
789
|
+
"references": {}
|
|
790
|
+
},
|
|
791
|
+
"required": false,
|
|
792
|
+
"optional": false,
|
|
793
|
+
"docs": {
|
|
794
|
+
"tags": [],
|
|
795
|
+
"text": ""
|
|
796
|
+
},
|
|
797
|
+
"attribute": "value",
|
|
798
|
+
"reflect": false,
|
|
799
|
+
"defaultValue": "null"
|
|
800
|
+
},
|
|
801
|
+
"captionError": {
|
|
802
|
+
"type": "string",
|
|
803
|
+
"mutable": true,
|
|
804
|
+
"complexType": {
|
|
805
|
+
"original": "string",
|
|
806
|
+
"resolved": "string",
|
|
807
|
+
"references": {}
|
|
808
|
+
},
|
|
809
|
+
"required": false,
|
|
810
|
+
"optional": true,
|
|
811
|
+
"docs": {
|
|
812
|
+
"tags": [],
|
|
813
|
+
"text": ""
|
|
814
|
+
},
|
|
815
|
+
"attribute": "caption-error",
|
|
816
|
+
"reflect": false
|
|
817
|
+
},
|
|
818
|
+
"captionType": {
|
|
819
|
+
"type": "string",
|
|
820
|
+
"mutable": true,
|
|
821
|
+
"complexType": {
|
|
822
|
+
"original": "string",
|
|
823
|
+
"resolved": "string",
|
|
824
|
+
"references": {}
|
|
825
|
+
},
|
|
826
|
+
"required": false,
|
|
827
|
+
"optional": true,
|
|
828
|
+
"docs": {
|
|
829
|
+
"tags": [],
|
|
830
|
+
"text": ""
|
|
831
|
+
},
|
|
832
|
+
"attribute": "caption-type",
|
|
833
|
+
"reflect": false
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
static get states() {
|
|
838
|
+
return {
|
|
839
|
+
"files": {},
|
|
840
|
+
"dragActive": {},
|
|
841
|
+
"zoneHovered": {},
|
|
842
|
+
"maxSizeError": {},
|
|
843
|
+
"typeError": {},
|
|
844
|
+
"maxFileCountError": {}
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
static get events() {
|
|
848
|
+
return [{
|
|
849
|
+
"method": "bcmFileChange",
|
|
850
|
+
"name": "bcm-file-change",
|
|
851
|
+
"bubbles": false,
|
|
852
|
+
"cancelable": true,
|
|
853
|
+
"composed": false,
|
|
854
|
+
"docs": {
|
|
855
|
+
"tags": [],
|
|
856
|
+
"text": ""
|
|
857
|
+
},
|
|
858
|
+
"complexType": {
|
|
859
|
+
"original": "File[]",
|
|
860
|
+
"resolved": "File[]",
|
|
861
|
+
"references": {
|
|
862
|
+
"File": {
|
|
863
|
+
"location": "global"
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}, {
|
|
868
|
+
"method": "bcmChange",
|
|
869
|
+
"name": "bcm-change",
|
|
870
|
+
"bubbles": true,
|
|
871
|
+
"cancelable": true,
|
|
872
|
+
"composed": true,
|
|
873
|
+
"docs": {
|
|
874
|
+
"tags": [],
|
|
875
|
+
"text": ""
|
|
876
|
+
},
|
|
877
|
+
"complexType": {
|
|
878
|
+
"original": "any",
|
|
879
|
+
"resolved": "any",
|
|
880
|
+
"references": {}
|
|
881
|
+
}
|
|
882
|
+
}, {
|
|
883
|
+
"method": "bcmFileRemoved",
|
|
884
|
+
"name": "bcm-file-removed",
|
|
885
|
+
"bubbles": false,
|
|
886
|
+
"cancelable": true,
|
|
887
|
+
"composed": false,
|
|
888
|
+
"docs": {
|
|
889
|
+
"tags": [],
|
|
890
|
+
"text": ""
|
|
891
|
+
},
|
|
892
|
+
"complexType": {
|
|
893
|
+
"original": "BcmUploadItem",
|
|
894
|
+
"resolved": "BcmUploadItem",
|
|
895
|
+
"references": {
|
|
896
|
+
"BcmUploadItem": {
|
|
897
|
+
"location": "local"
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}, {
|
|
902
|
+
"method": "bcmUploadCanceled",
|
|
903
|
+
"name": "bcm-upload-canceled",
|
|
904
|
+
"bubbles": false,
|
|
905
|
+
"cancelable": true,
|
|
906
|
+
"composed": false,
|
|
907
|
+
"docs": {
|
|
908
|
+
"tags": [],
|
|
909
|
+
"text": ""
|
|
910
|
+
},
|
|
911
|
+
"complexType": {
|
|
912
|
+
"original": "BcmUploadItem",
|
|
913
|
+
"resolved": "BcmUploadItem",
|
|
914
|
+
"references": {
|
|
915
|
+
"BcmUploadItem": {
|
|
916
|
+
"location": "local"
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}, {
|
|
921
|
+
"method": "bcmFocus",
|
|
922
|
+
"name": "bcm-focus",
|
|
923
|
+
"bubbles": false,
|
|
924
|
+
"cancelable": true,
|
|
925
|
+
"composed": false,
|
|
926
|
+
"docs": {
|
|
927
|
+
"tags": [],
|
|
928
|
+
"text": ""
|
|
929
|
+
},
|
|
930
|
+
"complexType": {
|
|
931
|
+
"original": "FocusEvent",
|
|
932
|
+
"resolved": "FocusEvent",
|
|
933
|
+
"references": {
|
|
934
|
+
"FocusEvent": {
|
|
935
|
+
"location": "global"
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
}, {
|
|
940
|
+
"method": "bcmBlur",
|
|
941
|
+
"name": "bcm-blur",
|
|
942
|
+
"bubbles": false,
|
|
943
|
+
"cancelable": true,
|
|
944
|
+
"composed": false,
|
|
945
|
+
"docs": {
|
|
946
|
+
"tags": [],
|
|
947
|
+
"text": ""
|
|
948
|
+
},
|
|
949
|
+
"complexType": {
|
|
950
|
+
"original": "FocusEvent",
|
|
951
|
+
"resolved": "FocusEvent",
|
|
952
|
+
"references": {
|
|
953
|
+
"FocusEvent": {
|
|
954
|
+
"location": "global"
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}];
|
|
959
|
+
}
|
|
960
|
+
static get methods() {
|
|
961
|
+
return {
|
|
962
|
+
"get": {
|
|
963
|
+
"complexType": {
|
|
964
|
+
"signature": "() => Promise<any>",
|
|
965
|
+
"parameters": [],
|
|
966
|
+
"references": {
|
|
967
|
+
"Promise": {
|
|
968
|
+
"location": "global"
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
"return": "Promise<any>"
|
|
972
|
+
},
|
|
973
|
+
"docs": {
|
|
974
|
+
"text": "",
|
|
975
|
+
"tags": []
|
|
976
|
+
}
|
|
977
|
+
},
|
|
978
|
+
"set": {
|
|
979
|
+
"complexType": {
|
|
980
|
+
"signature": "(data: any) => Promise<void>",
|
|
981
|
+
"parameters": [{
|
|
982
|
+
"tags": [],
|
|
983
|
+
"text": ""
|
|
984
|
+
}],
|
|
985
|
+
"references": {
|
|
986
|
+
"Promise": {
|
|
987
|
+
"location": "global"
|
|
988
|
+
}
|
|
989
|
+
},
|
|
990
|
+
"return": "Promise<void>"
|
|
991
|
+
},
|
|
992
|
+
"docs": {
|
|
993
|
+
"text": "",
|
|
994
|
+
"tags": []
|
|
995
|
+
}
|
|
996
|
+
},
|
|
997
|
+
"setClear": {
|
|
998
|
+
"complexType": {
|
|
999
|
+
"signature": "() => Promise<unknown>",
|
|
1000
|
+
"parameters": [],
|
|
1001
|
+
"references": {
|
|
1002
|
+
"Promise": {
|
|
1003
|
+
"location": "global"
|
|
1004
|
+
}
|
|
1005
|
+
},
|
|
1006
|
+
"return": "Promise<unknown>"
|
|
1007
|
+
},
|
|
1008
|
+
"docs": {
|
|
1009
|
+
"text": "",
|
|
1010
|
+
"tags": []
|
|
1011
|
+
}
|
|
1012
|
+
},
|
|
1013
|
+
"resetCaption": {
|
|
1014
|
+
"complexType": {
|
|
1015
|
+
"signature": "() => Promise<unknown>",
|
|
1016
|
+
"parameters": [],
|
|
1017
|
+
"references": {
|
|
1018
|
+
"Promise": {
|
|
1019
|
+
"location": "global"
|
|
1020
|
+
}
|
|
1021
|
+
},
|
|
1022
|
+
"return": "Promise<unknown>"
|
|
1023
|
+
},
|
|
1024
|
+
"docs": {
|
|
1025
|
+
"text": "",
|
|
1026
|
+
"tags": []
|
|
1027
|
+
}
|
|
1028
|
+
},
|
|
1029
|
+
"setFocus": {
|
|
1030
|
+
"complexType": {
|
|
1031
|
+
"signature": "(options?: FocusOptions) => Promise<void>",
|
|
1032
|
+
"parameters": [{
|
|
1033
|
+
"tags": [],
|
|
1034
|
+
"text": ""
|
|
1035
|
+
}],
|
|
1036
|
+
"references": {
|
|
1037
|
+
"Promise": {
|
|
1038
|
+
"location": "global"
|
|
1039
|
+
},
|
|
1040
|
+
"FocusOptions": {
|
|
1041
|
+
"location": "global"
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
"return": "Promise<void>"
|
|
1045
|
+
},
|
|
1046
|
+
"docs": {
|
|
1047
|
+
"text": "",
|
|
1048
|
+
"tags": []
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
static get elementRef() { return "host"; }
|
|
1054
|
+
static get watchers() {
|
|
1055
|
+
return [{
|
|
1056
|
+
"propName": "maxSize",
|
|
1057
|
+
"methodName": "handleMaxSizeChange"
|
|
1058
|
+
}];
|
|
1059
|
+
}
|
|
1060
|
+
}
|