@siemens/element-ng 48.2.0 → 48.3.0
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/accordion/index.d.ts +5 -1
- package/application-header/index.d.ts +15 -2
- package/chat-messages/index.d.ts +654 -0
- package/chat-messages/package.json +3 -0
- package/dashboard/index.d.ts +1 -0
- package/fesm2022/siemens-element-ng-accordion.mjs +5 -1
- package/fesm2022/siemens-element-ng-accordion.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-application-header.mjs +62 -1
- package/fesm2022/siemens-element-ng-application-header.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-card.mjs +4 -4
- package/fesm2022/siemens-element-ng-card.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-chat-messages.mjs +863 -0
- package/fesm2022/siemens-element-ng-chat-messages.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-dashboard.mjs +8 -4
- package/fesm2022/siemens-element-ng-dashboard.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-file-uploader.mjs +277 -118
- package/fesm2022/siemens-element-ng-file-uploader.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-filtered-search.mjs +3 -4
- package/fesm2022/siemens-element-ng-filtered-search.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-icon.mjs +3 -1
- package/fesm2022/siemens-element-ng-icon.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-ip-input.mjs +92 -89
- package/fesm2022/siemens-element-ng-ip-input.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-markdown-renderer.mjs +253 -0
- package/fesm2022/siemens-element-ng-markdown-renderer.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-phone-number.mjs +5 -4
- package/fesm2022/siemens-element-ng-phone-number.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-popover.mjs +3 -4
- package/fesm2022/siemens-element-ng-popover.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-resize-observer.mjs +13 -0
- package/fesm2022/siemens-element-ng-resize-observer.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-translate.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tree-view.mjs +41 -2
- package/fesm2022/siemens-element-ng-tree-view.mjs.map +1 -1
- package/file-uploader/index.d.ts +119 -15
- package/icon/index.d.ts +3 -1
- package/ip-input/index.d.ts +13 -0
- package/markdown-renderer/index.d.ts +36 -0
- package/markdown-renderer/package.json +3 -0
- package/package.json +11 -3
- package/resize-observer/index.d.ts +13 -0
- package/schematics/migrations/action-modal-migration/action-modal-migration.js +2 -2
- package/schematics/migrations/data/attribute-selectors.js +6 -0
- package/schematics/migrations/data/component-names.js +78 -0
- package/schematics/migrations/data/element-selectors.js +10 -0
- package/schematics/migrations/data/index.js +17 -0
- package/schematics/migrations/data/output-names.js +8 -0
- package/schematics/migrations/data/symbol-removals.js +58 -0
- package/schematics/migrations/element-migration/element-migration.js +101 -0
- package/schematics/migrations/element-migration/index.js +5 -0
- package/schematics/migrations/index.js +7 -2
- package/schematics/migrations/wizard-migration/index.js +88 -0
- package/schematics/scss-import-to-siemens-migration/index.js +3 -3
- package/schematics/ts-import-to-siemens-migration/index.js +2 -2
- package/schematics/utils/index.js +3 -3
- package/schematics/utils/project-utils.js +24 -35
- package/schematics/utils/template-utils.js +78 -2
- package/schematics/utils/ts-utils.js +5 -5
- package/template-i18n.json +9 -0
- package/translate/index.d.ts +9 -0
- package/tree-view/index.d.ts +40 -1
- package/schematics/migrations/to-legacy-migration/to-legacy-migration.js +0 -55
- package/schematics/migrations/to-legacy-migration/to-legacy-replacement.js +0 -35
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, booleanAttribute, output,
|
|
2
|
+
import { input, booleanAttribute, output, inject, ElementRef, LOCALE_ID, Directive, computed, viewChild, ChangeDetectionStrategy, Component, numberAttribute, ChangeDetectorRef, NgModule } from '@angular/core';
|
|
3
3
|
import { addIcons, elementUpload, SiIconComponent, elementRedo, elementDocument, elementDelete, elementCancel, SiStatusIconComponent } from '@siemens/element-ng/icon';
|
|
4
4
|
import { t, SiTranslatePipe } from '@siemens/element-translate-ng/translate';
|
|
5
5
|
import { NgClass } from '@angular/common';
|
|
@@ -17,43 +17,25 @@ import { retry } from 'rxjs/operators';
|
|
|
17
17
|
* Copyright (c) Siemens 2016 - 2025
|
|
18
18
|
* SPDX-License-Identifier: MIT
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Text or translation key for max file size.
|
|
41
|
-
*
|
|
42
|
-
* @defaultValue
|
|
43
|
-
* ```
|
|
44
|
-
* t(() => $localize`:@@SI_FILE_UPLOADER.MAX_SIZE:Maximum upload size`)
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
maxFileSizeText = input(t(() => $localize `:@@SI_FILE_UPLOADER.MAX_SIZE:Maximum upload size`));
|
|
48
|
-
/**
|
|
49
|
-
* Text or translation key for accepted types.
|
|
50
|
-
*
|
|
51
|
-
* @defaultValue
|
|
52
|
-
* ```
|
|
53
|
-
* t(() => $localize`:@@SI_FILE_UPLOADER.ACCEPTED_FILE_TYPES:Accepted file types`)
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
acceptText = input(t(() => $localize `:@@SI_FILE_UPLOADER.ACCEPTED_FILE_TYPES:Accepted file types`));
|
|
20
|
+
/**
|
|
21
|
+
* Directive for handling file uploads with validation for file type and size.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```html
|
|
25
|
+
* <input
|
|
26
|
+
* #fileInput
|
|
27
|
+
* type="file"
|
|
28
|
+
* class="d-none"
|
|
29
|
+
* siFileUpload
|
|
30
|
+
* [accept]="accept()"
|
|
31
|
+
* [maxFileSize]="maxFileSize()"
|
|
32
|
+
* [multiple]="true"
|
|
33
|
+
* (validFiles)="onFilesAdded($event)"
|
|
34
|
+
* (fileError)="onFileError($event)"
|
|
35
|
+
* />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
class SiFileUploadDirective {
|
|
57
39
|
/**
|
|
58
40
|
* Text or translation key of message title if incorrect file type is dragged / dropped.
|
|
59
41
|
*
|
|
@@ -88,64 +70,130 @@ class SiFileDropzoneComponent {
|
|
|
88
70
|
* @defaultValue false
|
|
89
71
|
*/
|
|
90
72
|
multiple = input(false, { transform: booleanAttribute });
|
|
91
|
-
/**
|
|
92
|
-
* Event emitted when files are added.
|
|
93
|
-
*/
|
|
94
|
-
filesAdded = output();
|
|
95
73
|
/**
|
|
96
74
|
* Enable directory upload.
|
|
97
75
|
*
|
|
98
76
|
* @defaultValue false
|
|
99
77
|
*/
|
|
100
78
|
directoryUpload = input(false, { transform: booleanAttribute });
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Event emitted when valid files are added.
|
|
81
|
+
* Invalid files (due to size or type) will be ignored and instead the {@link fileError} event will be emitted.
|
|
82
|
+
*/
|
|
83
|
+
validFiles = output();
|
|
84
|
+
/**
|
|
85
|
+
* Event emitted when valid files are added.
|
|
86
|
+
* Also includes invalid files, but with status 'invalid' and an errorText describing why they were ignored.
|
|
87
|
+
*/
|
|
88
|
+
filesAdded = output();
|
|
89
|
+
/**
|
|
90
|
+
* Event emitted when file validation errors occur, including files that were ignored due to size or type.
|
|
91
|
+
*/
|
|
92
|
+
fileError = output();
|
|
93
|
+
elementRef = inject((ElementRef));
|
|
108
94
|
locale = inject(LOCALE_ID).toString();
|
|
109
95
|
numberFormat = new Intl.NumberFormat(this.locale, { maximumFractionDigits: 2 });
|
|
110
|
-
|
|
111
|
-
event.
|
|
112
|
-
|
|
113
|
-
this.handleItems(event.dataTransfer.items);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
this.handleFiles(event.dataTransfer.files);
|
|
117
|
-
}
|
|
118
|
-
this.dragOver = false;
|
|
119
|
-
}
|
|
120
|
-
dragOverHandler(event) {
|
|
121
|
-
event.preventDefault();
|
|
122
|
-
event.stopPropagation();
|
|
123
|
-
this.dragOver = true;
|
|
124
|
-
}
|
|
125
|
-
inputEnterHandler() {
|
|
126
|
-
this.fileInput().nativeElement.click();
|
|
127
|
-
}
|
|
128
|
-
inputHandler(event) {
|
|
129
|
-
this.handleFiles(event.target.files);
|
|
96
|
+
onInputChange(event) {
|
|
97
|
+
const inputElement = event.target;
|
|
98
|
+
this.handleFiles(inputElement.files);
|
|
130
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Handle files from input or drag and drop
|
|
102
|
+
*/
|
|
131
103
|
handleFiles(files) {
|
|
132
104
|
if (!files?.length) {
|
|
133
105
|
return;
|
|
134
106
|
}
|
|
135
107
|
const newFiles = [];
|
|
108
|
+
const validFiles = [];
|
|
136
109
|
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
137
110
|
for (let i = 0; i < files.length; i++) {
|
|
138
|
-
|
|
111
|
+
const uploadFile = this.makeUploadFile(files[i]);
|
|
112
|
+
newFiles.push(uploadFile);
|
|
113
|
+
if (uploadFile.status === 'invalid' && uploadFile.errorText) {
|
|
114
|
+
this.fileError.emit(uploadFile);
|
|
115
|
+
}
|
|
116
|
+
else if (uploadFile.status === 'added') {
|
|
117
|
+
validFiles.push(uploadFile);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (newFiles.length > 0) {
|
|
121
|
+
newFiles.sort((a, b) => a.fileName.localeCompare(b.fileName));
|
|
122
|
+
this.filesAdded.emit(newFiles);
|
|
123
|
+
}
|
|
124
|
+
if (validFiles.length > 0) {
|
|
125
|
+
validFiles.sort((a, b) => a.fileName.localeCompare(b.fileName));
|
|
126
|
+
this.validFiles.emit(validFiles);
|
|
139
127
|
}
|
|
140
|
-
newFiles.sort((a, b) => a.fileName.localeCompare(b.fileName));
|
|
141
|
-
this.filesAdded.emit(newFiles);
|
|
142
128
|
this.reset();
|
|
143
129
|
}
|
|
144
130
|
/**
|
|
145
|
-
*
|
|
131
|
+
* Handle directory entries for drag and drop
|
|
132
|
+
*/
|
|
133
|
+
handleItems(items) {
|
|
134
|
+
const newFiles = [];
|
|
135
|
+
let pendingEntries = 0;
|
|
136
|
+
const traverseFileTree = (item) => {
|
|
137
|
+
if (item.isFile) {
|
|
138
|
+
item.file(file => {
|
|
139
|
+
const uploadFile = this.makeUploadFile(file);
|
|
140
|
+
newFiles.push(uploadFile);
|
|
141
|
+
if (uploadFile.status === 'invalid' && uploadFile.errorText) {
|
|
142
|
+
this.fileError.emit(uploadFile);
|
|
143
|
+
}
|
|
144
|
+
if (--pendingEntries === 0) {
|
|
145
|
+
if (newFiles.length > 0) {
|
|
146
|
+
this.filesAdded.emit(newFiles);
|
|
147
|
+
}
|
|
148
|
+
const validFiles = newFiles.filter(f => f.status === 'added');
|
|
149
|
+
if (validFiles.length > 0) {
|
|
150
|
+
this.filesAdded.emit(validFiles);
|
|
151
|
+
}
|
|
152
|
+
this.reset();
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
else if (item.isDirectory) {
|
|
157
|
+
const dirReader = item.createReader();
|
|
158
|
+
dirReader.readEntries(entries => {
|
|
159
|
+
for (const entry of entries) {
|
|
160
|
+
pendingEntries++;
|
|
161
|
+
traverseFileTree(entry);
|
|
162
|
+
}
|
|
163
|
+
if (--pendingEntries === 0) {
|
|
164
|
+
if (newFiles.length > 0) {
|
|
165
|
+
this.filesAdded.emit(newFiles);
|
|
166
|
+
}
|
|
167
|
+
const validFiles = newFiles.filter(f => f.status === 'added');
|
|
168
|
+
if (validFiles.length > 0) {
|
|
169
|
+
this.filesAdded.emit(validFiles);
|
|
170
|
+
}
|
|
171
|
+
this.reset();
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
// items is not an array but of type DataTransferItemList
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
178
|
+
for (let i = 0; i < items.length; i++) {
|
|
179
|
+
const item = items[i].webkitGetAsEntry();
|
|
180
|
+
if (item) {
|
|
181
|
+
pendingEntries++;
|
|
182
|
+
traverseFileTree(item);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Reset the file input value
|
|
146
188
|
*/
|
|
147
189
|
reset() {
|
|
148
|
-
this.
|
|
190
|
+
this.elementRef.nativeElement.value = '';
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Trigger the file input click
|
|
194
|
+
*/
|
|
195
|
+
triggerClick() {
|
|
196
|
+
this.elementRef.nativeElement.click();
|
|
149
197
|
}
|
|
150
198
|
makeUploadFile(file) {
|
|
151
199
|
const uploadFile = {
|
|
@@ -182,7 +230,7 @@ class SiFileDropzoneComponent {
|
|
|
182
230
|
// Spec says that comma is the delimiter for filetypes. Also allow pipe for compatibility
|
|
183
231
|
return accept.split(/,|\|/).some(acceptedType => {
|
|
184
232
|
// convert accept glob into regex (example: images/* --> images/.*)
|
|
185
|
-
const acceptedRegexStr = acceptedType.replace(
|
|
233
|
+
const acceptedRegexStr = acceptedType.replace(/\./g, '\\.').replace('*', '.*').trim();
|
|
186
234
|
const acceptedRegex = new RegExp(acceptedRegexStr, 'i');
|
|
187
235
|
// if fileType is set and accepted type looks like a MIME type, match that otherwise extension
|
|
188
236
|
if (fileType && acceptedType.includes('/')) {
|
|
@@ -192,12 +240,16 @@ class SiFileDropzoneComponent {
|
|
|
192
240
|
});
|
|
193
241
|
}
|
|
194
242
|
fileSizeToString(num) {
|
|
243
|
+
return SiFileUploadDirective.formatFileSize(num, this.numberFormat);
|
|
244
|
+
}
|
|
245
|
+
static formatFileSize(num, formatter) {
|
|
246
|
+
const numberFormat = formatter ?? new Intl.NumberFormat('en-US', { maximumFractionDigits: 2 });
|
|
195
247
|
let suffix = 'B';
|
|
196
248
|
if (num >= 1_073_741_824) {
|
|
197
249
|
num /= 1_073_741_824;
|
|
198
250
|
suffix = 'GB';
|
|
199
251
|
}
|
|
200
|
-
if (num >= 1_048_576) {
|
|
252
|
+
else if (num >= 1_048_576) {
|
|
201
253
|
num /= 1_048_576;
|
|
202
254
|
suffix = 'MB';
|
|
203
255
|
}
|
|
@@ -205,51 +257,158 @@ class SiFileDropzoneComponent {
|
|
|
205
257
|
num /= 1_024;
|
|
206
258
|
suffix = 'KB';
|
|
207
259
|
}
|
|
208
|
-
return
|
|
260
|
+
return numberFormat.format(num) + suffix;
|
|
209
261
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
else if (item.isDirectory) {
|
|
224
|
-
const dirReader = item.createReader();
|
|
225
|
-
dirReader.readEntries(entries => {
|
|
226
|
-
for (const entry of entries) {
|
|
227
|
-
pendingEntries++;
|
|
228
|
-
traverseFileTree(entry);
|
|
229
|
-
}
|
|
230
|
-
if (--pendingEntries === 0) {
|
|
231
|
-
this.filesAdded.emit(newFiles);
|
|
232
|
-
this.reset();
|
|
262
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiFileUploadDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
263
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.6", type: SiFileUploadDirective, isStandalone: true, selector: "input[type=\"file\"][siFileUpload]", inputs: { errorTextFileType: { classPropertyName: "errorTextFileType", publicName: "errorTextFileType", isSignal: true, isRequired: false, transformFunction: null }, errorTextFileMaxSize: { classPropertyName: "errorTextFileMaxSize", publicName: "errorTextFileMaxSize", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, directoryUpload: { classPropertyName: "directoryUpload", publicName: "directoryUpload", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { validFiles: "validFiles", filesAdded: "filesAdded", fileError: "fileError" }, host: { listeners: { "change": "onInputChange($event)" }, properties: { "attr.accept": "accept()", "multiple": "directoryUpload() || multiple()", "attr.webkitdirectory": "directoryUpload() ? \"\" : null" } }, ngImport: i0 });
|
|
264
|
+
}
|
|
265
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiFileUploadDirective, decorators: [{
|
|
266
|
+
type: Directive,
|
|
267
|
+
args: [{
|
|
268
|
+
selector: 'input[type="file"][siFileUpload]',
|
|
269
|
+
standalone: true,
|
|
270
|
+
host: {
|
|
271
|
+
'[attr.accept]': 'accept()',
|
|
272
|
+
'[multiple]': 'directoryUpload() || multiple()',
|
|
273
|
+
'[attr.webkitdirectory]': 'directoryUpload() ? "" : null',
|
|
274
|
+
'(change)': 'onInputChange($event)'
|
|
233
275
|
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
276
|
+
}]
|
|
277
|
+
}] });
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Copyright (c) Siemens 2016 - 2025
|
|
281
|
+
* SPDX-License-Identifier: MIT
|
|
282
|
+
*/
|
|
283
|
+
class SiFileDropzoneComponent {
|
|
284
|
+
/**
|
|
285
|
+
* Text or translation key of the input file selector (is combined with the `uploadTextRest`).
|
|
286
|
+
*
|
|
287
|
+
* @defaultValue
|
|
288
|
+
* ```
|
|
289
|
+
* t(() => $localize`:@@SI_FILE_UPLOADER.FILE_SELECT:click to upload`)
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
uploadTextFileSelect = input(t(() => $localize `:@@SI_FILE_UPLOADER.FILE_SELECT:click to upload`));
|
|
293
|
+
/**
|
|
294
|
+
* Text or translation key of the drag&drop field (is combined with the `uploadTextFileSelect`).
|
|
295
|
+
*
|
|
296
|
+
* @defaultValue
|
|
297
|
+
* ```
|
|
298
|
+
* t(() => $localize`:@@SI_FILE_UPLOADER.DROP:Drop files here or`)
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
uploadDropText = input(t(() => $localize `:@@SI_FILE_UPLOADER.DROP:Drop files here or`));
|
|
302
|
+
/**
|
|
303
|
+
* Text or translation key for max file size.
|
|
304
|
+
*
|
|
305
|
+
* @defaultValue
|
|
306
|
+
* ```
|
|
307
|
+
* t(() => $localize`:@@SI_FILE_UPLOADER.MAX_SIZE:Maximum upload size`)
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
maxFileSizeText = input(t(() => $localize `:@@SI_FILE_UPLOADER.MAX_SIZE:Maximum upload size`));
|
|
311
|
+
/**
|
|
312
|
+
* Text or translation key for accepted types.
|
|
313
|
+
*
|
|
314
|
+
* @defaultValue
|
|
315
|
+
* ```
|
|
316
|
+
* t(() => $localize`:@@SI_FILE_UPLOADER.ACCEPTED_FILE_TYPES:Accepted file types`)
|
|
317
|
+
* ```
|
|
318
|
+
*/
|
|
319
|
+
acceptText = input(t(() => $localize `:@@SI_FILE_UPLOADER.ACCEPTED_FILE_TYPES:Accepted file types`));
|
|
320
|
+
/**
|
|
321
|
+
* Text or translation key of message title if incorrect file type is dragged / dropped.
|
|
322
|
+
*
|
|
323
|
+
* @defaultValue
|
|
324
|
+
* ```
|
|
325
|
+
* t(() => $localize`:@@SI_FILE_UPLOADER.ERROR_FILE_TYPE:Incorrect file type selected`)
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
328
|
+
errorTextFileType = input(t(() => $localize `:@@SI_FILE_UPLOADER.ERROR_FILE_TYPE:Incorrect file type selected`));
|
|
329
|
+
/**
|
|
330
|
+
* Message or translation key if file exceeds the maximum file size limit.
|
|
331
|
+
*
|
|
332
|
+
* @defaultValue
|
|
333
|
+
* ```
|
|
334
|
+
* t(() => $localize`:@@SI_FILE_UPLOADER.ERROR_FILE_SIZE_EXCEEDED:File exceeds allowed maximum size`)
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
errorTextFileMaxSize = input(t(() => $localize `:@@SI_FILE_UPLOADER.ERROR_FILE_SIZE_EXCEEDED:File exceeds allowed maximum size`));
|
|
338
|
+
/**
|
|
339
|
+
* Define which file types are suggested in file browser.
|
|
340
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-accept
|
|
341
|
+
*/
|
|
342
|
+
accept = input();
|
|
343
|
+
/**
|
|
344
|
+
* Define maximal allowed file size in bytes.
|
|
345
|
+
*/
|
|
346
|
+
maxFileSize = input();
|
|
347
|
+
/**
|
|
348
|
+
* Defines whether the file input allows selecting multiple files.
|
|
349
|
+
* When {@link directoryUpload} is enabled, this will have no effect.
|
|
350
|
+
*
|
|
351
|
+
* @defaultValue false
|
|
352
|
+
*/
|
|
353
|
+
multiple = input(false, { transform: booleanAttribute });
|
|
354
|
+
/**
|
|
355
|
+
* Event emitted when valid files are added.
|
|
356
|
+
* Invalid files are also included here, but with status 'invalid' and an errorText describing why they were ignored.
|
|
357
|
+
*/
|
|
358
|
+
filesAdded = output();
|
|
359
|
+
/**
|
|
360
|
+
* Event emitted when file validation errors occur, including files that were ignored due to size or type.
|
|
361
|
+
*/
|
|
362
|
+
fileError = output();
|
|
363
|
+
/**
|
|
364
|
+
* Enable directory upload.
|
|
365
|
+
*
|
|
366
|
+
* @defaultValue false
|
|
367
|
+
*/
|
|
368
|
+
directoryUpload = input(false, { transform: booleanAttribute });
|
|
369
|
+
maxFileSizeString = computed(() => {
|
|
370
|
+
const maxFileSize = this.maxFileSize();
|
|
371
|
+
return maxFileSize ? this.fileUploadDirective().fileSizeToString(maxFileSize) : '';
|
|
372
|
+
});
|
|
373
|
+
icons = addIcons({ elementUpload });
|
|
374
|
+
dragOver = false;
|
|
375
|
+
fileUploadDirective = viewChild.required(SiFileUploadDirective);
|
|
376
|
+
dropHandler(event) {
|
|
377
|
+
event.preventDefault();
|
|
378
|
+
if (this.directoryUpload()) {
|
|
379
|
+
this.fileUploadDirective().handleItems(event.dataTransfer.items);
|
|
245
380
|
}
|
|
381
|
+
else {
|
|
382
|
+
this.fileUploadDirective().handleFiles(event.dataTransfer.files);
|
|
383
|
+
}
|
|
384
|
+
this.dragOver = false;
|
|
385
|
+
}
|
|
386
|
+
dragOverHandler(event) {
|
|
387
|
+
event.preventDefault();
|
|
388
|
+
event.stopPropagation();
|
|
389
|
+
this.dragOver = true;
|
|
390
|
+
}
|
|
391
|
+
inputEnterHandler() {
|
|
392
|
+
this.fileUploadDirective().triggerClick();
|
|
393
|
+
}
|
|
394
|
+
onFilesAdded(files) {
|
|
395
|
+
this.filesAdded.emit(files);
|
|
396
|
+
}
|
|
397
|
+
onFileError(error) {
|
|
398
|
+
this.fileError.emit(error);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Reset all the files inside the native file input (and therefore the dropzone).
|
|
402
|
+
*/
|
|
403
|
+
reset() {
|
|
404
|
+
this.fileUploadDirective().reset();
|
|
246
405
|
}
|
|
247
406
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiFileDropzoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
248
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiFileDropzoneComponent, isStandalone: true, selector: "si-file-dropzone", inputs: { uploadTextFileSelect: { classPropertyName: "uploadTextFileSelect", publicName: "uploadTextFileSelect", isSignal: true, isRequired: false, transformFunction: null }, uploadDropText: { classPropertyName: "uploadDropText", publicName: "uploadDropText", isSignal: true, isRequired: false, transformFunction: null }, maxFileSizeText: { classPropertyName: "maxFileSizeText", publicName: "maxFileSizeText", isSignal: true, isRequired: false, transformFunction: null }, acceptText: { classPropertyName: "acceptText", publicName: "acceptText", isSignal: true, isRequired: false, transformFunction: null }, errorTextFileType: { classPropertyName: "errorTextFileType", publicName: "errorTextFileType", isSignal: true, isRequired: false, transformFunction: null }, errorTextFileMaxSize: { classPropertyName: "errorTextFileMaxSize", publicName: "errorTextFileMaxSize", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, directoryUpload: { classPropertyName: "directoryUpload", publicName: "directoryUpload", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filesAdded: "filesAdded" }, viewQueries: [{ propertyName: "
|
|
407
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiFileDropzoneComponent, isStandalone: true, selector: "si-file-dropzone", inputs: { uploadTextFileSelect: { classPropertyName: "uploadTextFileSelect", publicName: "uploadTextFileSelect", isSignal: true, isRequired: false, transformFunction: null }, uploadDropText: { classPropertyName: "uploadDropText", publicName: "uploadDropText", isSignal: true, isRequired: false, transformFunction: null }, maxFileSizeText: { classPropertyName: "maxFileSizeText", publicName: "maxFileSizeText", isSignal: true, isRequired: false, transformFunction: null }, acceptText: { classPropertyName: "acceptText", publicName: "acceptText", isSignal: true, isRequired: false, transformFunction: null }, errorTextFileType: { classPropertyName: "errorTextFileType", publicName: "errorTextFileType", isSignal: true, isRequired: false, transformFunction: null }, errorTextFileMaxSize: { classPropertyName: "errorTextFileMaxSize", publicName: "errorTextFileMaxSize", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, directoryUpload: { classPropertyName: "directoryUpload", publicName: "directoryUpload", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filesAdded: "filesAdded", fileError: "fileError" }, viewQueries: [{ propertyName: "fileUploadDirective", first: true, predicate: SiFileUploadDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<div\n class=\"drag-and-drop rounded p-6\"\n [class.drag-over]=\"dragOver\"\n (drop)=\"dropHandler($event)\"\n (dragover)=\"dragOverHandler($event)\"\n (dragleave)=\"dragOver = false\"\n>\n <si-icon class=\"mb-6 si-display-bold\" [icon]=\"icons.elementUpload\" />\n <span class=\"drag-and-drop-description si-h5 d-flex\">\n <span>{{ uploadDropText() | translate }}</span>\n \n <label class=\"select-file si-h5 mb-0\">\n <span tabindex=\"0\" (keydown.enter)=\"inputEnterHandler()\">{{\n uploadTextFileSelect() | translate\n }}</span>\n <input\n #fileInput\n type=\"file\"\n tabindex=\"-1\"\n class=\"d-none\"\n siFileUpload\n [accept]=\"accept()\"\n [maxFileSize]=\"maxFileSize()\"\n [multiple]=\"multiple()\"\n [directoryUpload]=\"directoryUpload()\"\n [errorTextFileType]=\"errorTextFileType()\"\n [errorTextFileMaxSize]=\"errorTextFileMaxSize()\"\n (filesAdded)=\"onFilesAdded($event)\"\n (fileError)=\"onFileError($event)\"\n (cancel)=\"$event.stopPropagation()\"\n />\n </label>\n </span>\n @if (maxFileSize() || accept()) {\n <div class=\"allowed si-caption mt-6\">\n @if (maxFileSize()) {\n {{ maxFileSizeText() | translate }}: {{ maxFileSizeString() }}.\n }\n @if (accept()) {\n {{ acceptText() | translate }}: {{ accept() }}.\n }\n </div>\n }\n</div>\n", styles: [":host{display:block}.select-file{margin-block-end:0;cursor:pointer;color:var(--element-ui-0)}.select-file:hover,.select-file:active{text-decoration:underline}.drag-and-drop{background-color:var(--element-base-1);border:1px dashed var(--element-ui-2);display:flex;flex-direction:column;justify-content:center;align-items:center}.drag-and-drop.drag-over{border:1px solid var(--element-focus-default);box-shadow:0 0 0 1px var(--element-focus-default)}\n"], dependencies: [{ kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }, { kind: "directive", type: SiFileUploadDirective, selector: "input[type=\"file\"][siFileUpload]", inputs: ["errorTextFileType", "errorTextFileMaxSize", "accept", "maxFileSize", "multiple", "directoryUpload"], outputs: ["validFiles", "filesAdded", "fileError"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
249
408
|
}
|
|
250
409
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiFileDropzoneComponent, decorators: [{
|
|
251
410
|
type: Component,
|
|
252
|
-
args: [{ selector: 'si-file-dropzone', imports: [SiIconComponent, SiTranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"drag-and-drop rounded p-6\"\n [class.drag-over]=\"dragOver\"\n (drop)=\"dropHandler($event)\"\n (dragover)=\"dragOverHandler($event)\"\n (dragleave)=\"dragOver = false\"\n>\n <si-icon class=\"mb-6 si-display-bold\" [icon]=\"icons.elementUpload\" />\n <span class=\"drag-and-drop-description si-h5 d-flex\">\n <span>{{ uploadDropText() | translate }}</span>\n \n <label class=\"select-file si-h5 mb-0\">\n <span tabindex=\"0\" (keydown.enter)=\"inputEnterHandler()\">{{\n uploadTextFileSelect() | translate\n }}</span>\n <input\n #fileInput\n type=\"file\"\n tabindex=\"-1\"\n class=\"d-none\"\n [
|
|
411
|
+
args: [{ selector: 'si-file-dropzone', imports: [SiIconComponent, SiTranslatePipe, SiFileUploadDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"drag-and-drop rounded p-6\"\n [class.drag-over]=\"dragOver\"\n (drop)=\"dropHandler($event)\"\n (dragover)=\"dragOverHandler($event)\"\n (dragleave)=\"dragOver = false\"\n>\n <si-icon class=\"mb-6 si-display-bold\" [icon]=\"icons.elementUpload\" />\n <span class=\"drag-and-drop-description si-h5 d-flex\">\n <span>{{ uploadDropText() | translate }}</span>\n \n <label class=\"select-file si-h5 mb-0\">\n <span tabindex=\"0\" (keydown.enter)=\"inputEnterHandler()\">{{\n uploadTextFileSelect() | translate\n }}</span>\n <input\n #fileInput\n type=\"file\"\n tabindex=\"-1\"\n class=\"d-none\"\n siFileUpload\n [accept]=\"accept()\"\n [maxFileSize]=\"maxFileSize()\"\n [multiple]=\"multiple()\"\n [directoryUpload]=\"directoryUpload()\"\n [errorTextFileType]=\"errorTextFileType()\"\n [errorTextFileMaxSize]=\"errorTextFileMaxSize()\"\n (filesAdded)=\"onFilesAdded($event)\"\n (fileError)=\"onFileError($event)\"\n (cancel)=\"$event.stopPropagation()\"\n />\n </label>\n </span>\n @if (maxFileSize() || accept()) {\n <div class=\"allowed si-caption mt-6\">\n @if (maxFileSize()) {\n {{ maxFileSizeText() | translate }}: {{ maxFileSizeString() }}.\n }\n @if (accept()) {\n {{ acceptText() | translate }}: {{ accept() }}.\n }\n </div>\n }\n</div>\n", styles: [":host{display:block}.select-file{margin-block-end:0;cursor:pointer;color:var(--element-ui-0)}.select-file:hover,.select-file:active{text-decoration:underline}.drag-and-drop{background-color:var(--element-base-1);border:1px dashed var(--element-ui-2);display:flex;flex-direction:column;justify-content:center;align-items:center}.drag-and-drop.drag-over{border:1px solid var(--element-focus-default);box-shadow:0 0 0 1px var(--element-focus-default)}\n"] }]
|
|
253
412
|
}] });
|
|
254
413
|
|
|
255
414
|
/**
|
|
@@ -712,7 +871,7 @@ class SiFileUploaderComponent {
|
|
|
712
871
|
return this.files.reduce((acc, f) => acc + (f.status !== 'invalid' ? 1 : 0), 0);
|
|
713
872
|
}
|
|
714
873
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiFileUploaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
715
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiFileUploaderComponent, isStandalone: true, selector: "si-file-uploader", inputs: { uploadTextFileSelect: { classPropertyName: "uploadTextFileSelect", publicName: "uploadTextFileSelect", isSignal: true, isRequired: false, transformFunction: null }, uploadDropText: { classPropertyName: "uploadDropText", publicName: "uploadDropText", isSignal: true, isRequired: false, transformFunction: null }, maxFileSizeText: { classPropertyName: "maxFileSizeText", publicName: "maxFileSizeText", isSignal: true, isRequired: false, transformFunction: null }, maxFilesReachedText: { classPropertyName: "maxFilesReachedText", publicName: "maxFilesReachedText", isSignal: true, isRequired: false, transformFunction: null }, acceptText: { classPropertyName: "acceptText", publicName: "acceptText", isSignal: true, isRequired: false, transformFunction: null }, uploadButtonText: { classPropertyName: "uploadButtonText", publicName: "uploadButtonText", isSignal: true, isRequired: false, transformFunction: null }, clearButtonText: { classPropertyName: "clearButtonText", publicName: "clearButtonText", isSignal: true, isRequired: false, transformFunction: null }, uploadingText: { classPropertyName: "uploadingText", publicName: "uploadingText", isSignal: true, isRequired: false, transformFunction: null }, removeButtonText: { classPropertyName: "removeButtonText", publicName: "removeButtonText", isSignal: true, isRequired: false, transformFunction: null }, cancelButtonText: { classPropertyName: "cancelButtonText", publicName: "cancelButtonText", isSignal: true, isRequired: false, transformFunction: null }, successTextTitle: { classPropertyName: "successTextTitle", publicName: "successTextTitle", isSignal: true, isRequired: false, transformFunction: null }, errorUploadFailed: { classPropertyName: "errorUploadFailed", publicName: "errorUploadFailed", isSignal: true, isRequired: false, transformFunction: null }, showHttpError: { classPropertyName: "showHttpError", publicName: "showHttpError", isSignal: true, isRequired: false, transformFunction: null }, errorTextFileType: { classPropertyName: "errorTextFileType", publicName: "errorTextFileType", isSignal: true, isRequired: false, transformFunction: null }, errorTextFileMaxSize: { classPropertyName: "errorTextFileMaxSize", publicName: "errorTextFileMaxSize", isSignal: true, isRequired: false, transformFunction: null }, uploadConfig: { classPropertyName: "uploadConfig", publicName: "uploadConfig", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, maxFiles: { classPropertyName: "maxFiles", publicName: "maxFiles", isSignal: true, isRequired: false, transformFunction: null }, maxConcurrentUploads: { classPropertyName: "maxConcurrentUploads", publicName: "maxConcurrentUploads", isSignal: true, isRequired: false, transformFunction: null }, retries: { classPropertyName: "retries", publicName: "retries", isSignal: true, isRequired: false, transformFunction: null }, autoUpload: { classPropertyName: "autoUpload", publicName: "autoUpload", isSignal: true, isRequired: false, transformFunction: null }, disableUpload: { classPropertyName: "disableUpload", publicName: "disableUpload", isSignal: true, isRequired: false, transformFunction: null }, directoryUpload: { classPropertyName: "directoryUpload", publicName: "directoryUpload", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { uploadCanceled: "uploadCanceled", uploadCompleted: "uploadCompleted", filesChanges: "filesChanges" }, viewQueries: [{ propertyName: "dropZone", first: true, predicate: ["dropZone"], descendants: true, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "<si-file-dropzone\n #dropZone\n [ngClass]=\"autoUpload() ? 'mb-8' : 'mb-4'\"\n [uploadTextFileSelect]=\"uploadTextFileSelect()\"\n [uploadDropText]=\"uploadDropText()\"\n [multiple]=\"maxFiles() > 1\"\n [directoryUpload]=\"directoryUpload()\"\n [maxFileSizeText]=\"maxFileSizeText()\"\n [acceptText]=\"acceptText()\"\n [errorTextFileType]=\"errorTextFileType()\"\n [errorTextFileMaxSize]=\"errorTextFileMaxSize()\"\n [accept]=\"accept()\"\n [maxFileSize]=\"maxFileSize()\"\n (filesAdded)=\"handleFiles($event)\"\n/>\n\n@if (maxFilesReached) {\n <si-inline-notification class=\"mb-4\" severity=\"info\" [message]=\"maxFilesReachedText()\" />\n}\n\n<div class=\"file-list\">\n @for (file of files; track file) {\n <div\n class=\"file d-flex\"\n [ngClass]=\"autoUpload() ? 'mb-8' : 'mb-4'\"\n [class.fade-out]=\"file.fadeOut\"\n >\n <si-icon class=\"icon align-self-center ms-6 me-4\" [icon]=\"icons.elementDocument\" />\n <div class=\"flex-fill overflow-hidden\">\n <div class=\"file-info\">\n <div class=\"file-name text-truncate si-h5\">{{ file.fileName }}</div>\n <div class=\"file-size text-secondary\">{{ file.size }}</div>\n </div>\n @if (file.errorText) {\n <div\n class=\"error text-truncate d-flex align-items-center\"\n [class.text-warning]=\"file.status === 'invalid'\"\n [class.text-danger]=\"file.status === 'error'\"\n >\n <si-status-icon\n class=\"icon-small my-n2 me-2\"\n [status]=\"file.status === 'invalid' ? 'warning' : 'danger'\"\n />\n {{ file.errorText | translate }}\n @if (file.httpErrorText) {\n : {{ file.httpErrorText }}\n }\n </div>\n } @else {\n <div class=\"position-relative\">\n <div class=\"position-absolute si-caption end-0 mt-n8\">{{ file.progress }} %</div>\n <si-progressbar\n height=\"small\"\n [value]=\"file.progress\"\n [ariaLabel]=\"uploadingText() | translate\"\n />\n </div>\n }\n </div>\n <div class=\"status align-self-center text-nowrap ps-4 pe-6\">\n @if (file.status === 'error') {\n <button\n type=\"button\"\n class=\"btn btn-circle btn-sm btn-tertiary me-4\"\n [disabled]=\"!uploadEnabled\"\n [title]=\"uploadButtonText() | translate\"\n [attr.aria-label]=\"uploadButtonText() | translate\"\n (click)=\"retryUpload(file)\"\n >\n <si-icon [icon]=\"icons.elementRedo\" />\n </button>\n }\n @if (file.status === 'added' || file.status === 'error' || file.status === 'invalid') {\n <button\n type=\"button\"\n class=\"btn btn-circle btn-sm btn-ghost\"\n [title]=\"removeButtonText() | translate\"\n [attr.aria-label]=\"removeButtonText() | translate\"\n (click)=\"removeFile($index)\"\n >\n <si-icon [icon]=\"icons.elementDelete\" />\n </button>\n }\n @if (file.status === 'uploading' || file.status === 'queued') {\n <button\n type=\"button\"\n class=\"btn btn-circle btn-sm btn-tertiary\"\n [title]=\"cancelButtonText() | translate\"\n [attr.aria-label]=\"cancelButtonText() | translate\"\n (click)=\"cancelUpload(file)\"\n >\n <si-icon [icon]=\"icons.elementCancel\" />\n </button>\n }\n @if (file.status === 'success') {\n <si-status-icon class=\"icon mx-2\" status=\"success\" />\n }\n </div>\n </div>\n }\n</div>\n\n@if (!autoUpload()) {\n <div class=\"buttons text-end\">\n <button\n type=\"button\"\n class=\"btn btn-secondary me-4\"\n [disabled]=\"pending || !files.length\"\n (click)=\"reset()\"\n >{{ clearButtonText() | translate }}</button\n >\n <button\n type=\"button\"\n class=\"btn btn-primary\"\n [disabled]=\"!uploadEnabled\"\n (click)=\"fileUpload()\"\n >{{ uploadButtonText() | translate }}</button\n >\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column;justify-content:center;align-items:stretch}:host>*{min-inline-size:320px;max-inline-size:680px;inline-size:100%;align-self:center}.file-list{overflow-y:auto}.file-info{display:flex;justify-content:center;flex-direction:column;block-size:56px}.file{min-block-size:72px;transition:opacity calc(.5s * var(--element-animations-enabled, 1))}.fade-out{opacity:0}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: SiStatusIconComponent, selector: "si-status-icon", inputs: ["status"] }, { kind: "component", type: SiFileDropzoneComponent, selector: "si-file-dropzone", inputs: ["uploadTextFileSelect", "uploadDropText", "maxFileSizeText", "acceptText", "errorTextFileType", "errorTextFileMaxSize", "accept", "maxFileSize", "multiple", "directoryUpload"], outputs: ["filesAdded"] }, { kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "component", type: SiInlineNotificationComponent, selector: "si-inline-notification", inputs: ["severity", "heading", "message", "action", "translationParams", "embedded"] }, { kind: "component", type: SiProgressbarComponent, selector: "si-progressbar", inputs: ["ariaLabel", "max", "value", "heading", "progress", "height"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
874
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: SiFileUploaderComponent, isStandalone: true, selector: "si-file-uploader", inputs: { uploadTextFileSelect: { classPropertyName: "uploadTextFileSelect", publicName: "uploadTextFileSelect", isSignal: true, isRequired: false, transformFunction: null }, uploadDropText: { classPropertyName: "uploadDropText", publicName: "uploadDropText", isSignal: true, isRequired: false, transformFunction: null }, maxFileSizeText: { classPropertyName: "maxFileSizeText", publicName: "maxFileSizeText", isSignal: true, isRequired: false, transformFunction: null }, maxFilesReachedText: { classPropertyName: "maxFilesReachedText", publicName: "maxFilesReachedText", isSignal: true, isRequired: false, transformFunction: null }, acceptText: { classPropertyName: "acceptText", publicName: "acceptText", isSignal: true, isRequired: false, transformFunction: null }, uploadButtonText: { classPropertyName: "uploadButtonText", publicName: "uploadButtonText", isSignal: true, isRequired: false, transformFunction: null }, clearButtonText: { classPropertyName: "clearButtonText", publicName: "clearButtonText", isSignal: true, isRequired: false, transformFunction: null }, uploadingText: { classPropertyName: "uploadingText", publicName: "uploadingText", isSignal: true, isRequired: false, transformFunction: null }, removeButtonText: { classPropertyName: "removeButtonText", publicName: "removeButtonText", isSignal: true, isRequired: false, transformFunction: null }, cancelButtonText: { classPropertyName: "cancelButtonText", publicName: "cancelButtonText", isSignal: true, isRequired: false, transformFunction: null }, successTextTitle: { classPropertyName: "successTextTitle", publicName: "successTextTitle", isSignal: true, isRequired: false, transformFunction: null }, errorUploadFailed: { classPropertyName: "errorUploadFailed", publicName: "errorUploadFailed", isSignal: true, isRequired: false, transformFunction: null }, showHttpError: { classPropertyName: "showHttpError", publicName: "showHttpError", isSignal: true, isRequired: false, transformFunction: null }, errorTextFileType: { classPropertyName: "errorTextFileType", publicName: "errorTextFileType", isSignal: true, isRequired: false, transformFunction: null }, errorTextFileMaxSize: { classPropertyName: "errorTextFileMaxSize", publicName: "errorTextFileMaxSize", isSignal: true, isRequired: false, transformFunction: null }, uploadConfig: { classPropertyName: "uploadConfig", publicName: "uploadConfig", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, maxFiles: { classPropertyName: "maxFiles", publicName: "maxFiles", isSignal: true, isRequired: false, transformFunction: null }, maxConcurrentUploads: { classPropertyName: "maxConcurrentUploads", publicName: "maxConcurrentUploads", isSignal: true, isRequired: false, transformFunction: null }, retries: { classPropertyName: "retries", publicName: "retries", isSignal: true, isRequired: false, transformFunction: null }, autoUpload: { classPropertyName: "autoUpload", publicName: "autoUpload", isSignal: true, isRequired: false, transformFunction: null }, disableUpload: { classPropertyName: "disableUpload", publicName: "disableUpload", isSignal: true, isRequired: false, transformFunction: null }, directoryUpload: { classPropertyName: "directoryUpload", publicName: "directoryUpload", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { uploadCanceled: "uploadCanceled", uploadCompleted: "uploadCompleted", filesChanges: "filesChanges" }, viewQueries: [{ propertyName: "dropZone", first: true, predicate: ["dropZone"], descendants: true, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "<si-file-dropzone\n #dropZone\n [ngClass]=\"autoUpload() ? 'mb-8' : 'mb-4'\"\n [uploadTextFileSelect]=\"uploadTextFileSelect()\"\n [uploadDropText]=\"uploadDropText()\"\n [multiple]=\"maxFiles() > 1\"\n [directoryUpload]=\"directoryUpload()\"\n [maxFileSizeText]=\"maxFileSizeText()\"\n [acceptText]=\"acceptText()\"\n [errorTextFileType]=\"errorTextFileType()\"\n [errorTextFileMaxSize]=\"errorTextFileMaxSize()\"\n [accept]=\"accept()\"\n [maxFileSize]=\"maxFileSize()\"\n (filesAdded)=\"handleFiles($event)\"\n/>\n\n@if (maxFilesReached) {\n <si-inline-notification class=\"mb-4\" severity=\"info\" [message]=\"maxFilesReachedText()\" />\n}\n\n<div class=\"file-list\">\n @for (file of files; track file) {\n <div\n class=\"file d-flex\"\n [ngClass]=\"autoUpload() ? 'mb-8' : 'mb-4'\"\n [class.fade-out]=\"file.fadeOut\"\n >\n <si-icon class=\"icon align-self-center ms-6 me-4\" [icon]=\"icons.elementDocument\" />\n <div class=\"flex-fill overflow-hidden\">\n <div class=\"file-info\">\n <div class=\"file-name text-truncate si-h5\">{{ file.fileName }}</div>\n <div class=\"file-size text-secondary\">{{ file.size }}</div>\n </div>\n @if (file.errorText) {\n <div\n class=\"error text-truncate d-flex align-items-center\"\n [class.text-warning]=\"file.status === 'invalid'\"\n [class.text-danger]=\"file.status === 'error'\"\n >\n <si-status-icon\n class=\"icon-small my-n2 me-2\"\n [status]=\"file.status === 'invalid' ? 'warning' : 'danger'\"\n />\n {{ file.errorText | translate }}\n @if (file.httpErrorText) {\n : {{ file.httpErrorText }}\n }\n </div>\n } @else {\n <div class=\"position-relative\">\n <div class=\"position-absolute si-caption end-0 mt-n8\">{{ file.progress }} %</div>\n <si-progressbar\n height=\"small\"\n [value]=\"file.progress\"\n [ariaLabel]=\"uploadingText() | translate\"\n />\n </div>\n }\n </div>\n <div class=\"status align-self-center text-nowrap ps-4 pe-6\">\n @if (file.status === 'error') {\n <button\n type=\"button\"\n class=\"btn btn-circle btn-sm btn-tertiary me-4\"\n [disabled]=\"!uploadEnabled\"\n [title]=\"uploadButtonText() | translate\"\n [attr.aria-label]=\"uploadButtonText() | translate\"\n (click)=\"retryUpload(file)\"\n >\n <si-icon [icon]=\"icons.elementRedo\" />\n </button>\n }\n @if (file.status === 'added' || file.status === 'error' || file.status === 'invalid') {\n <button\n type=\"button\"\n class=\"btn btn-circle btn-sm btn-ghost\"\n [title]=\"removeButtonText() | translate\"\n [attr.aria-label]=\"removeButtonText() | translate\"\n (click)=\"removeFile($index)\"\n >\n <si-icon [icon]=\"icons.elementDelete\" />\n </button>\n }\n @if (file.status === 'uploading' || file.status === 'queued') {\n <button\n type=\"button\"\n class=\"btn btn-circle btn-sm btn-tertiary\"\n [title]=\"cancelButtonText() | translate\"\n [attr.aria-label]=\"cancelButtonText() | translate\"\n (click)=\"cancelUpload(file)\"\n >\n <si-icon [icon]=\"icons.elementCancel\" />\n </button>\n }\n @if (file.status === 'success') {\n <si-status-icon class=\"icon mx-2\" status=\"success\" />\n }\n </div>\n </div>\n }\n</div>\n\n@if (!autoUpload()) {\n <div class=\"buttons text-end\">\n <button\n type=\"button\"\n class=\"btn btn-secondary me-4\"\n [disabled]=\"pending || !files.length\"\n (click)=\"reset()\"\n >{{ clearButtonText() | translate }}</button\n >\n <button\n type=\"button\"\n class=\"btn btn-primary\"\n [disabled]=\"!uploadEnabled\"\n (click)=\"fileUpload()\"\n >{{ uploadButtonText() | translate }}</button\n >\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column;justify-content:center;align-items:stretch}:host>*{min-inline-size:320px;max-inline-size:680px;inline-size:100%;align-self:center}.file-list{overflow-y:auto}.file-info{display:flex;justify-content:center;flex-direction:column;block-size:56px}.file{min-block-size:72px;transition:opacity calc(.5s * var(--element-animations-enabled, 1))}.fade-out{opacity:0}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: SiStatusIconComponent, selector: "si-status-icon", inputs: ["status"] }, { kind: "component", type: SiFileDropzoneComponent, selector: "si-file-dropzone", inputs: ["uploadTextFileSelect", "uploadDropText", "maxFileSizeText", "acceptText", "errorTextFileType", "errorTextFileMaxSize", "accept", "maxFileSize", "multiple", "directoryUpload"], outputs: ["filesAdded", "fileError"] }, { kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "component", type: SiInlineNotificationComponent, selector: "si-inline-notification", inputs: ["severity", "heading", "message", "action", "translationParams", "embedded"] }, { kind: "component", type: SiProgressbarComponent, selector: "si-progressbar", inputs: ["ariaLabel", "max", "value", "heading", "progress", "height"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
716
875
|
}
|
|
717
876
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiFileUploaderComponent, decorators: [{
|
|
718
877
|
type: Component,
|
|
@@ -733,14 +892,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
|
|
|
733
892
|
*/
|
|
734
893
|
class SiFileUploaderModule {
|
|
735
894
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiFileUploaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
736
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: SiFileUploaderModule, imports: [SiFileDropzoneComponent, SiFileUploaderComponent], exports: [SiFileDropzoneComponent, SiFileUploaderComponent] });
|
|
895
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: SiFileUploaderModule, imports: [SiFileDropzoneComponent, SiFileUploaderComponent, SiFileUploadDirective], exports: [SiFileDropzoneComponent, SiFileUploaderComponent, SiFileUploadDirective] });
|
|
737
896
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiFileUploaderModule, imports: [SiFileDropzoneComponent, SiFileUploaderComponent] });
|
|
738
897
|
}
|
|
739
898
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiFileUploaderModule, decorators: [{
|
|
740
899
|
type: NgModule,
|
|
741
900
|
args: [{
|
|
742
|
-
imports: [SiFileDropzoneComponent, SiFileUploaderComponent],
|
|
743
|
-
exports: [SiFileDropzoneComponent, SiFileUploaderComponent]
|
|
901
|
+
imports: [SiFileDropzoneComponent, SiFileUploaderComponent, SiFileUploadDirective],
|
|
902
|
+
exports: [SiFileDropzoneComponent, SiFileUploaderComponent, SiFileUploadDirective]
|
|
744
903
|
}]
|
|
745
904
|
}] });
|
|
746
905
|
|
|
@@ -753,5 +912,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
|
|
|
753
912
|
* Generated bundle index. Do not edit.
|
|
754
913
|
*/
|
|
755
914
|
|
|
756
|
-
export { SiFileDropzoneComponent, SiFileUploaderComponent, SiFileUploaderModule };
|
|
915
|
+
export { SiFileDropzoneComponent, SiFileUploadDirective, SiFileUploaderComponent, SiFileUploaderModule };
|
|
757
916
|
//# sourceMappingURL=siemens-element-ng-file-uploader.mjs.map
|