shirkasoft-ui-components 1.14.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -9
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs +189 -100
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-button.mjs +363 -69
- package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-chart.mjs +206 -142
- package/fesm2022/shirkasoft-ui-components-chart.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-config.mjs +905 -843
- package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +307 -142
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs +1697 -1440
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs +347 -92
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs +555 -300
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-icons.mjs +1028 -533
- package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-knob.mjs +389 -201
- package/fesm2022/shirkasoft-ui-components-knob.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-loading.mjs +505 -128
- package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-modal.mjs +311 -314
- package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-notification.mjs +188 -142
- package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +585 -327
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +669 -289
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-select.mjs +1076 -819
- package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs +508 -184
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs +197 -57
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +1916 -1698
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tabs.mjs +419 -175
- package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tag.mjs +175 -49
- package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-text-field.mjs +749 -402
- package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +310 -124
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme.mjs +141 -174
- package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-timeline.mjs +791 -203
- package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-toggle.mjs +179 -109
- package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs +244 -180
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +129 -133
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-wizard.mjs +673 -165
- package/fesm2022/shirkasoft-ui-components-wizard.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components.mjs +0 -9
- package/package.json +5 -5
- package/types/shirkasoft-ui-components-breadcrumb.d.ts +59 -44
- package/types/shirkasoft-ui-components-button.d.ts +142 -49
- package/types/shirkasoft-ui-components-chart.d.ts +59 -44
- package/types/shirkasoft-ui-components-config.d.ts +193 -204
- package/types/shirkasoft-ui-components-confirm-dialog.d.ts +107 -66
- package/types/shirkasoft-ui-components-date-picker.d.ts +561 -398
- package/types/shirkasoft-ui-components-fieldset.d.ts +135 -60
- package/types/shirkasoft-ui-components-file-upload.d.ts +210 -112
- package/types/shirkasoft-ui-components-icons.d.ts +1302 -1294
- package/types/shirkasoft-ui-components-knob.d.ts +144 -78
- package/types/shirkasoft-ui-components-loading.d.ts +155 -64
- package/types/shirkasoft-ui-components-modal.d.ts +134 -136
- package/types/shirkasoft-ui-components-notification.d.ts +63 -59
- package/types/shirkasoft-ui-components-price-input.d.ts +232 -113
- package/types/shirkasoft-ui-components-rail-sidebar.d.ts +262 -142
- package/types/shirkasoft-ui-components-select.d.ts +335 -196
- package/types/shirkasoft-ui-components-sidebar.d.ts +198 -93
- package/types/shirkasoft-ui-components-skeleton.d.ts +68 -27
- package/types/shirkasoft-ui-components-table.d.ts +849 -660
- package/types/shirkasoft-ui-components-tabs.d.ts +102 -61
- package/types/shirkasoft-ui-components-tag.d.ts +54 -23
- package/types/shirkasoft-ui-components-text-field.d.ts +263 -127
- package/types/shirkasoft-ui-components-theme-picker.d.ts +92 -58
- package/types/shirkasoft-ui-components-theme.d.ts +56 -64
- package/types/shirkasoft-ui-components-timeline.d.ts +325 -150
- package/types/shirkasoft-ui-components-toggle.d.ts +73 -49
- package/types/shirkasoft-ui-components-tooltip.d.ts +64 -43
- package/types/shirkasoft-ui-components-utils.d.ts +47 -15
- package/types/shirkasoft-ui-components-wizard.d.ts +236 -87
- package/types/shirkasoft-ui-components.d.ts +1 -2
- package/fesm2022/shirkasoft-ui-components.mjs.map +0 -1
|
@@ -1,301 +1,556 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { CommonModule } from
|
|
4
|
-
import { TranslocoService } from
|
|
5
|
-
import { LucideUpload, ShkIconDirective } from
|
|
6
|
-
import { getIcon } from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input, model, output, signal } from "@angular/core";
|
|
3
|
+
import { CommonModule } from "@angular/common";
|
|
4
|
+
import { TranslocoService } from "@jsverse/transloco";
|
|
5
|
+
import { LucideUpload, ShkIconDirective } from "shirkasoft-ui-components/icons";
|
|
6
|
+
import { errorMessagesFromMap, getIcon, signalErrorsToMap } from "shirkasoft-ui-components/utils";
|
|
7
|
+
var FileUploadComponent = class FileUploadComponent {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.getIcon = (name) => getIcon(name, LucideUpload);
|
|
10
|
+
this.transloco = inject(TranslocoService);
|
|
11
|
+
this.label = input("Cargar archivo", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
12
|
+
this.accept = input("image/*", ...ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []);
|
|
13
|
+
this.maxFileSize = input(2097152, ...ngDevMode ? [{ debugName: "maxFileSize" }] : /* istanbul ignore next */ []);
|
|
14
|
+
this.maxFiles = input(0, ...ngDevMode ? [{ debugName: "maxFiles" }] : /* istanbul ignore next */ []);
|
|
15
|
+
this.fileUploadText = input("Seleccionar archivo", ...ngDevMode ? [{ debugName: "fileUploadText" }] : /* istanbul ignore next */ []);
|
|
16
|
+
this.fileRecommendation = input("", ...ngDevMode ? [{ debugName: "fileRecommendation" }] : /* istanbul ignore next */ []);
|
|
17
|
+
this.changeFilesText = input("Cambiar archivos", ...ngDevMode ? [{ debugName: "changeFilesText" }] : /* istanbul ignore next */ []);
|
|
18
|
+
this.multiple = input(false, ...ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []);
|
|
19
|
+
this.existingFiles = input([], ...ngDevMode ? [{ debugName: "existingFiles" }] : /* istanbul ignore next */ []);
|
|
20
|
+
this.existingDisplay = input("chips", ...ngDevMode ? [{ debugName: "existingDisplay" }] : /* istanbul ignore next */ []);
|
|
21
|
+
this.errors = input([], ...ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []);
|
|
22
|
+
this.invalid = input(false, ...ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []);
|
|
23
|
+
this.touched = input(false, ...ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []);
|
|
24
|
+
this.dirty = input(false, ...ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []);
|
|
25
|
+
this.fileSelected = output();
|
|
26
|
+
this.fileRemoved = output();
|
|
27
|
+
this.fileError = output();
|
|
28
|
+
this.fileWarning = output();
|
|
29
|
+
this.existingFileAction = output();
|
|
30
|
+
this.existingFileRemove = output();
|
|
31
|
+
this.value = model([], ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
32
|
+
this.touch = output();
|
|
33
|
+
this.errorMessage = signal("", ...ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []);
|
|
34
|
+
this.isDragOver = signal(false, ...ngDevMode ? [{ debugName: "isDragOver" }] : /* istanbul ignore next */ []);
|
|
35
|
+
this.displayError = computed(() => {
|
|
36
|
+
const local = this.errorMessage();
|
|
37
|
+
if (local) return local;
|
|
38
|
+
if (!this.invalid() || !this.touched() && !this.dirty()) return "";
|
|
39
|
+
const translate = (key, params) => this.transloco.translate(key, params);
|
|
40
|
+
return errorMessagesFromMap(signalErrorsToMap(this.errors()), {}, translate)[0] ?? "";
|
|
41
|
+
}, ...ngDevMode ? [{ debugName: "displayError" }] : /* istanbul ignore next */ []);
|
|
42
|
+
this.previewUrls = /* @__PURE__ */ new Map();
|
|
43
|
+
this.canAddMore = computed(() => {
|
|
44
|
+
if (!this.multiple()) return this.selectedFiles().length === 0;
|
|
45
|
+
const max = this.maxFiles();
|
|
46
|
+
if (max <= 0) return true;
|
|
47
|
+
return this.selectedFiles().length < max;
|
|
48
|
+
}, ...ngDevMode ? [{ debugName: "canAddMore" }] : /* istanbul ignore next */ []);
|
|
49
|
+
this.maxReached = computed(() => {
|
|
50
|
+
const max = this.maxFiles();
|
|
51
|
+
if (max <= 0) return false;
|
|
52
|
+
return this.selectedFiles().length >= max;
|
|
53
|
+
}, ...ngDevMode ? [{ debugName: "maxReached" }] : /* istanbul ignore next */ []);
|
|
54
|
+
}
|
|
55
|
+
get selectedFiles() {
|
|
56
|
+
return this.value;
|
|
57
|
+
}
|
|
58
|
+
isImageFile(file) {
|
|
59
|
+
return file.type.startsWith("image/");
|
|
60
|
+
}
|
|
61
|
+
previewUrl(file) {
|
|
62
|
+
if (!this.previewUrls.has(file)) this.previewUrls.set(file, URL.createObjectURL(file));
|
|
63
|
+
return this.previewUrls.get(file) ?? "";
|
|
64
|
+
}
|
|
65
|
+
onDragOver(event) {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
event.stopPropagation();
|
|
68
|
+
this.isDragOver.set(true);
|
|
69
|
+
}
|
|
70
|
+
onDragLeave(event) {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
event.stopPropagation();
|
|
73
|
+
this.isDragOver.set(false);
|
|
74
|
+
}
|
|
75
|
+
onDrop(event) {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
event.stopPropagation();
|
|
78
|
+
this.isDragOver.set(false);
|
|
79
|
+
const files = event.dataTransfer?.files;
|
|
80
|
+
if (files && files.length > 0) this.processFiles(Array.from(files));
|
|
81
|
+
}
|
|
82
|
+
onFileChange(event) {
|
|
83
|
+
const input = event.target;
|
|
84
|
+
const files = input.files;
|
|
85
|
+
if (files && files.length > 0) this.processFiles(Array.from(files));
|
|
86
|
+
input.value = "";
|
|
87
|
+
}
|
|
88
|
+
processFiles(files) {
|
|
89
|
+
this.errorMessage.set("");
|
|
90
|
+
const validFiles = [];
|
|
91
|
+
for (const file of files) {
|
|
92
|
+
const error = this.validateFile(file);
|
|
93
|
+
if (error) {
|
|
94
|
+
this.fileError.emit(error);
|
|
95
|
+
this.errorMessage.set(error.message);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const warning = this.checkSizeWarning(file);
|
|
99
|
+
if (warning) this.fileWarning.emit(warning);
|
|
100
|
+
validFiles.push(file);
|
|
101
|
+
}
|
|
102
|
+
const max = this.maxFiles();
|
|
103
|
+
if (max > 0) {
|
|
104
|
+
const allowed = max - this.selectedFiles().length;
|
|
105
|
+
if (validFiles.length > allowed) {
|
|
106
|
+
const errorMsg = this.transloco.translate("fileUpload.maxFiles", void 0, `Máximo ${max} archivos permitidos`);
|
|
107
|
+
this.errorMessage.set(errorMsg);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (this.multiple()) this.selectedFiles.set([...this.selectedFiles(), ...validFiles]);
|
|
112
|
+
else {
|
|
113
|
+
this.clearPreviews();
|
|
114
|
+
this.selectedFiles.set(validFiles);
|
|
115
|
+
}
|
|
116
|
+
this.touch.emit();
|
|
117
|
+
this.fileSelected.emit(this.selectedFiles());
|
|
118
|
+
}
|
|
119
|
+
validateFile(file) {
|
|
120
|
+
const acceptStr = this.accept();
|
|
121
|
+
if (acceptStr && acceptStr !== "*") {
|
|
122
|
+
if (!acceptStr.split(",").map((t) => t.trim()).some((type) => {
|
|
123
|
+
if (type.endsWith("/*")) {
|
|
124
|
+
const category = type.replace("/*", "");
|
|
125
|
+
return file.type.startsWith(category);
|
|
126
|
+
}
|
|
127
|
+
if (type.startsWith(".")) {
|
|
128
|
+
const ext = type.slice(1).toLowerCase();
|
|
129
|
+
return file.name.toLowerCase().endsWith("." + ext);
|
|
130
|
+
}
|
|
131
|
+
if (type.includes("/")) return file.type === type;
|
|
132
|
+
return false;
|
|
133
|
+
})) return {
|
|
134
|
+
type: "type",
|
|
135
|
+
message: this.transloco.translate("fileUpload.invalidType", { accept: acceptStr }, `Tipo de archivo no válido. Formatos aceptados: ${acceptStr}`),
|
|
136
|
+
file
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (this.maxFileSize() > 0 && file.size > this.maxFileSize()) return {
|
|
140
|
+
type: "size",
|
|
141
|
+
message: this.transloco.translate("fileUpload.fileTooLarge", { size: this.formatFileSize(this.maxFileSize()) }, `El archivo excede el tamaño máximo de ${this.formatFileSize(this.maxFileSize())}`),
|
|
142
|
+
file
|
|
143
|
+
};
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
checkSizeWarning(file) {
|
|
147
|
+
if (this.maxFileSize() > 0 && file.size > this.maxFileSize() * .9) return {
|
|
148
|
+
type: "size",
|
|
149
|
+
message: this.transloco.translate("fileUpload.sizeWarning", { size: this.formatFileSize(this.maxFileSize()) }, `El archivo está cerca del límite de tamaño (${this.formatFileSize(this.maxFileSize())})`),
|
|
150
|
+
file
|
|
151
|
+
};
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
removeFile(file) {
|
|
155
|
+
const url = this.previewUrls.get(file);
|
|
156
|
+
if (url) {
|
|
157
|
+
URL.revokeObjectURL(url);
|
|
158
|
+
this.previewUrls.delete(file);
|
|
159
|
+
}
|
|
160
|
+
this.selectedFiles.update((files) => files.filter((f) => f !== file));
|
|
161
|
+
this.errorMessage.set("");
|
|
162
|
+
if (this.selectedFiles().length === 0) this.fileRemoved.emit();
|
|
163
|
+
}
|
|
164
|
+
changeFiles() {
|
|
165
|
+
this.clearPreviews();
|
|
166
|
+
this.selectedFiles.set([]);
|
|
167
|
+
this.errorMessage.set("");
|
|
168
|
+
}
|
|
169
|
+
clearPreviews() {
|
|
170
|
+
for (const [file, url] of this.previewUrls) URL.revokeObjectURL(url);
|
|
171
|
+
this.previewUrls.clear();
|
|
172
|
+
}
|
|
173
|
+
ngOnDestroy() {
|
|
174
|
+
this.clearPreviews();
|
|
175
|
+
}
|
|
176
|
+
onExistingAction(file) {
|
|
177
|
+
this.existingFileAction.emit(file);
|
|
178
|
+
}
|
|
179
|
+
onExistingRemove(file) {
|
|
180
|
+
this.existingFileRemove.emit(file);
|
|
181
|
+
}
|
|
182
|
+
isExistingImage(file) {
|
|
183
|
+
if ((file.mimeType || "").toLowerCase().startsWith("image/")) return true;
|
|
184
|
+
const ext = this.getExtension(file.name).toLowerCase();
|
|
185
|
+
return [
|
|
186
|
+
"jpg",
|
|
187
|
+
"jpeg",
|
|
188
|
+
"png",
|
|
189
|
+
"gif",
|
|
190
|
+
"webp",
|
|
191
|
+
"svg"
|
|
192
|
+
].includes(ext);
|
|
193
|
+
}
|
|
194
|
+
getExtension(name) {
|
|
195
|
+
return name.split(".").pop()?.toLowerCase() || "";
|
|
196
|
+
}
|
|
197
|
+
getExistingBadge(file) {
|
|
198
|
+
const ext = this.getExtension(file.name);
|
|
199
|
+
switch (ext) {
|
|
200
|
+
case "pdf": return {
|
|
201
|
+
label: "PDF",
|
|
202
|
+
color: "bg-red-100 text-red-600",
|
|
203
|
+
icon: "file-text"
|
|
204
|
+
};
|
|
205
|
+
case "doc":
|
|
206
|
+
case "docx": return {
|
|
207
|
+
label: "DOC",
|
|
208
|
+
color: "bg-blue-100 text-blue-600",
|
|
209
|
+
icon: "file-text"
|
|
210
|
+
};
|
|
211
|
+
case "xls":
|
|
212
|
+
case "xlsx": return {
|
|
213
|
+
label: "XLS",
|
|
214
|
+
color: "bg-green-100 text-green-600",
|
|
215
|
+
icon: "file-spreadsheet"
|
|
216
|
+
};
|
|
217
|
+
default: return {
|
|
218
|
+
label: ext.toUpperCase() || "FILE",
|
|
219
|
+
color: "bg-slate-100 text-slate-500",
|
|
220
|
+
icon: "file"
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
trackExistingFile(file) {
|
|
225
|
+
return file.id ?? file.name;
|
|
226
|
+
}
|
|
227
|
+
formatFileSize(bytes) {
|
|
228
|
+
if (bytes < 1024) return bytes + " B";
|
|
229
|
+
if (bytes < 1048576) return (bytes / 1024).toFixed(1) + " KB";
|
|
230
|
+
return (bytes / 1048576).toFixed(1) + " MB";
|
|
231
|
+
}
|
|
232
|
+
static {
|
|
233
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
234
|
+
minVersion: "12.0.0",
|
|
235
|
+
version: "22.3.2",
|
|
236
|
+
ngImport: i0,
|
|
237
|
+
type: FileUploadComponent,
|
|
238
|
+
deps: [],
|
|
239
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
static {
|
|
243
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
244
|
+
minVersion: "17.0.0",
|
|
245
|
+
version: "22.3.2",
|
|
246
|
+
type: FileUploadComponent,
|
|
247
|
+
isStandalone: true,
|
|
248
|
+
selector: "shk-file-upload",
|
|
249
|
+
inputs: {
|
|
250
|
+
label: {
|
|
251
|
+
classPropertyName: "label",
|
|
252
|
+
publicName: "label",
|
|
253
|
+
isSignal: true,
|
|
254
|
+
isRequired: false,
|
|
255
|
+
transformFunction: null
|
|
256
|
+
},
|
|
257
|
+
accept: {
|
|
258
|
+
classPropertyName: "accept",
|
|
259
|
+
publicName: "accept",
|
|
260
|
+
isSignal: true,
|
|
261
|
+
isRequired: false,
|
|
262
|
+
transformFunction: null
|
|
263
|
+
},
|
|
264
|
+
maxFileSize: {
|
|
265
|
+
classPropertyName: "maxFileSize",
|
|
266
|
+
publicName: "maxFileSize",
|
|
267
|
+
isSignal: true,
|
|
268
|
+
isRequired: false,
|
|
269
|
+
transformFunction: null
|
|
270
|
+
},
|
|
271
|
+
maxFiles: {
|
|
272
|
+
classPropertyName: "maxFiles",
|
|
273
|
+
publicName: "maxFiles",
|
|
274
|
+
isSignal: true,
|
|
275
|
+
isRequired: false,
|
|
276
|
+
transformFunction: null
|
|
277
|
+
},
|
|
278
|
+
fileUploadText: {
|
|
279
|
+
classPropertyName: "fileUploadText",
|
|
280
|
+
publicName: "fileUploadText",
|
|
281
|
+
isSignal: true,
|
|
282
|
+
isRequired: false,
|
|
283
|
+
transformFunction: null
|
|
284
|
+
},
|
|
285
|
+
fileRecommendation: {
|
|
286
|
+
classPropertyName: "fileRecommendation",
|
|
287
|
+
publicName: "fileRecommendation",
|
|
288
|
+
isSignal: true,
|
|
289
|
+
isRequired: false,
|
|
290
|
+
transformFunction: null
|
|
291
|
+
},
|
|
292
|
+
changeFilesText: {
|
|
293
|
+
classPropertyName: "changeFilesText",
|
|
294
|
+
publicName: "changeFilesText",
|
|
295
|
+
isSignal: true,
|
|
296
|
+
isRequired: false,
|
|
297
|
+
transformFunction: null
|
|
298
|
+
},
|
|
299
|
+
multiple: {
|
|
300
|
+
classPropertyName: "multiple",
|
|
301
|
+
publicName: "multiple",
|
|
302
|
+
isSignal: true,
|
|
303
|
+
isRequired: false,
|
|
304
|
+
transformFunction: null
|
|
305
|
+
},
|
|
306
|
+
existingFiles: {
|
|
307
|
+
classPropertyName: "existingFiles",
|
|
308
|
+
publicName: "existingFiles",
|
|
309
|
+
isSignal: true,
|
|
310
|
+
isRequired: false,
|
|
311
|
+
transformFunction: null
|
|
312
|
+
},
|
|
313
|
+
existingDisplay: {
|
|
314
|
+
classPropertyName: "existingDisplay",
|
|
315
|
+
publicName: "existingDisplay",
|
|
316
|
+
isSignal: true,
|
|
317
|
+
isRequired: false,
|
|
318
|
+
transformFunction: null
|
|
319
|
+
},
|
|
320
|
+
errors: {
|
|
321
|
+
classPropertyName: "errors",
|
|
322
|
+
publicName: "errors",
|
|
323
|
+
isSignal: true,
|
|
324
|
+
isRequired: false,
|
|
325
|
+
transformFunction: null
|
|
326
|
+
},
|
|
327
|
+
invalid: {
|
|
328
|
+
classPropertyName: "invalid",
|
|
329
|
+
publicName: "invalid",
|
|
330
|
+
isSignal: true,
|
|
331
|
+
isRequired: false,
|
|
332
|
+
transformFunction: null
|
|
333
|
+
},
|
|
334
|
+
touched: {
|
|
335
|
+
classPropertyName: "touched",
|
|
336
|
+
publicName: "touched",
|
|
337
|
+
isSignal: true,
|
|
338
|
+
isRequired: false,
|
|
339
|
+
transformFunction: null
|
|
340
|
+
},
|
|
341
|
+
dirty: {
|
|
342
|
+
classPropertyName: "dirty",
|
|
343
|
+
publicName: "dirty",
|
|
344
|
+
isSignal: true,
|
|
345
|
+
isRequired: false,
|
|
346
|
+
transformFunction: null
|
|
347
|
+
},
|
|
348
|
+
value: {
|
|
349
|
+
classPropertyName: "value",
|
|
350
|
+
publicName: "value",
|
|
351
|
+
isSignal: true,
|
|
352
|
+
isRequired: false,
|
|
353
|
+
transformFunction: null
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
outputs: {
|
|
357
|
+
fileSelected: "fileSelected",
|
|
358
|
+
fileRemoved: "fileRemoved",
|
|
359
|
+
fileError: "fileError",
|
|
360
|
+
fileWarning: "fileWarning",
|
|
361
|
+
existingFileAction: "existingFileAction",
|
|
362
|
+
existingFileRemove: "existingFileRemove",
|
|
363
|
+
value: "valueChange",
|
|
364
|
+
touch: "touch"
|
|
365
|
+
},
|
|
366
|
+
ngImport: i0,
|
|
367
|
+
template: "<div class=\"flex flex-col gap-2\">\n @if (label()) {\n <label class=\"text-sm font-medium _shk-text-surface-700\">\n {{ label() }}\n </label>\n }\n\n @if (canAddMore()) {\n <div\n class=\"shk-dropzone relative border-2 border-dashed _shk-border rounded-lg p-4 transition-colors hover:[border-color:var(--shk-primary-400)] dark:hover:[border-color:var(--shk-primary-500)]\"\n [attr.aria-invalid]=\"displayError() ? true : null\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\"\n >\n <input\n #fileInput\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n (change)=\"onFileChange($event)\"\n class=\"hidden\"\n />\n\n <div\n class=\"flex flex-col items-center gap-2 cursor-pointer\"\n (click)=\"fileInput.click()\"\n [class.drag-over]=\"isDragOver()\"\n >\n <svg [shkIcon]=\"getIcon('upload')\" class=\"w-8 h-8 _shk-icon-subtle\"></svg>\n <span class=\"text-sm _shk-text-surface-700\">\n {{ fileUploadText() }}\n </span>\n @if (fileRecommendation()) {\n <span class=\"text-xs _shk-text-surface-400\">\n {{ fileRecommendation() }}\n </span>\n }\n </div>\n </div>\n }\n\n @if (maxReached()) {\n <div class=\"text-xs _shk-text-surface-400 text-center py-2\">\n Máximo {{ maxFiles() }} archivos alcanzado\n </div>\n }\n\n @if (selectedFiles().length > 0) {\n <div class=\"flex flex-wrap gap-3\">\n @for (file of selectedFiles(); track file.name + file.size + file.lastModified) {\n <div class=\"relative group\">\n @if (isImageFile(file)) {\n <img\n [src]=\"previewUrl(file)\"\n [alt]=\"file.name\"\n class=\"w-20 h-20 object-cover rounded-lg _shk-border\"\n />\n } @else {\n <div class=\"w-20 h-20 rounded-lg _shk-border flex flex-col items-center justify-center _shk-bg-surface-50 gap-1\">\n <svg [shkIcon]=\"getIcon('file')\" class=\"w-6 h-6 _shk-text-surface-400\"></svg>\n <span class=\"text-[10px] _shk-text-surface-400 truncate max-w-[70px] px-1 text-center\">{{ file.name }}</span>\n </div>\n }\n <button\n type=\"button\"\n (click)=\"removeFile(file)\"\n class=\"absolute -top-1.5 -right-1.5 w-5 h-5 bg-red-500 text-white rounded-full text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition shadow\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-3 h-3\"></svg>\n </button>\n </div>\n }\n </div>\n @if (!multiple()) {\n <button\n type=\"button\"\n (click)=\"changeFiles()\"\n class=\"text-xs _shk-text-primary hover:[color:var(--shk-primary-700)] dark:[color:var(--shk-primary-400)] dark:hover:[color:var(--shk-primary-300)] underline cursor-pointer bg-transparent border-0\"\n >\n {{ changeFilesText() }}\n </button>\n }\n }\n\n @if (existingFiles().length > 0) {\n <div class=\"flex flex-wrap gap-3\">\n @for (file of existingFiles(); track trackExistingFile(file)) {\n @if (existingDisplay() === 'tiles') {\n @let badge = getExistingBadge(file);\n <div class=\"relative group w-[80px]\">\n <div\n class=\"w-20 h-20 rounded-lg border _shk-border overflow-hidden cursor-pointer relative\"\n (click)=\"onExistingAction(file)\"\n [title]=\"file.name\"\n >\n @if (isExistingImage(file) && file.url) {\n <img [src]=\"file.url\" [alt]=\"file.name\" class=\"w-full h-full object-cover\" />\n } @else {\n <div class=\"w-full h-full flex flex-col items-center justify-center gap-1 _shk-bg-surface-50\">\n <svg [shkIcon]=\"getIcon(badge.icon)\" class=\"w-6 h-6 _shk-text-surface-400\"></svg>\n <span class=\"px-1.5 py-0.5 rounded text-[9px] font-semibold leading-none\" [class]=\"badge.color\">\n {{ badge.label }}\n </span>\n </div>\n }\n <div\n class=\"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 flex items-center justify-center transition rounded-lg\"\n >\n <svg [shkIcon]=\"getIcon('download')\" class=\"w-5 h-5 text-white\"></svg>\n </div>\n </div>\n <button\n type=\"button\"\n (click)=\"onExistingRemove(file)\"\n class=\"absolute -top-1.5 -right-1.5 w-5 h-5 bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition shadow\"\n aria-label=\"Remove\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-3 h-3\"></svg>\n </button>\n <span class=\"block text-[10px] _shk-text-surface-400 truncate text-center mt-1 max-w-[80px]\" [title]=\"file.name\">\n {{ file.name }}\n </span>\n </div>\n } @else {\n @let badge = getExistingBadge(file);\n <div class=\"flex items-center gap-2 _shk-bg-surface-50 border _shk-border rounded-full pl-3 pr-1.5 py-1 text-sm _shk-text-surface-700\">\n <svg [shkIcon]=\"getIcon(badge.icon)\" class=\"w-4 h-4 _shk-text-surface-400 shrink-0\"></svg>\n <span class=\"max-w-[200px] truncate\" [title]=\"file.name\">{{ file.name }}</span>\n <button\n type=\"button\"\n (click)=\"onExistingAction(file)\"\n [title]=\"file.name\"\n class=\"p-1 rounded-full hover:[background-color:var(--shk-surface-200)] _shk-text-surface-500 hover:[color:var(--shk-primary-600)]\"\n >\n <svg [shkIcon]=\"getIcon('download')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"onExistingRemove(file)\"\n class=\"p-1 rounded-full hover:[background-color:var(--shk-error-50)] _shk-text-surface-500 hover:[color:var(--shk-error-600)]\"\n aria-label=\"Remove\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n </div>\n }\n }\n </div>\n }\n\n @if (displayError()) {\n <p class=\"text-xs _shk-text-red-500\">{{ displayError() }}</p>\n }\n</div>",
|
|
368
|
+
dependencies: [{
|
|
369
|
+
kind: "ngmodule",
|
|
370
|
+
type: CommonModule
|
|
371
|
+
}, {
|
|
372
|
+
kind: "directive",
|
|
373
|
+
type: ShkIconDirective,
|
|
374
|
+
selector: "svg[shkIcon]",
|
|
375
|
+
inputs: [
|
|
376
|
+
"shkIcon",
|
|
377
|
+
"size",
|
|
378
|
+
"strokeWidth",
|
|
379
|
+
"color"
|
|
380
|
+
]
|
|
381
|
+
}],
|
|
382
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
387
|
+
minVersion: "12.0.0",
|
|
388
|
+
version: "22.3.2",
|
|
389
|
+
ngImport: i0,
|
|
390
|
+
type: FileUploadComponent,
|
|
391
|
+
decorators: [{
|
|
392
|
+
type: Component,
|
|
393
|
+
args: [{
|
|
394
|
+
selector: "shk-file-upload",
|
|
395
|
+
imports: [CommonModule, ShkIconDirective],
|
|
396
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
397
|
+
template: "<div class=\"flex flex-col gap-2\">\n @if (label()) {\n <label class=\"text-sm font-medium _shk-text-surface-700\">\n {{ label() }}\n </label>\n }\n\n @if (canAddMore()) {\n <div\n class=\"shk-dropzone relative border-2 border-dashed _shk-border rounded-lg p-4 transition-colors hover:[border-color:var(--shk-primary-400)] dark:hover:[border-color:var(--shk-primary-500)]\"\n [attr.aria-invalid]=\"displayError() ? true : null\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\"\n >\n <input\n #fileInput\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n (change)=\"onFileChange($event)\"\n class=\"hidden\"\n />\n\n <div\n class=\"flex flex-col items-center gap-2 cursor-pointer\"\n (click)=\"fileInput.click()\"\n [class.drag-over]=\"isDragOver()\"\n >\n <svg [shkIcon]=\"getIcon('upload')\" class=\"w-8 h-8 _shk-icon-subtle\"></svg>\n <span class=\"text-sm _shk-text-surface-700\">\n {{ fileUploadText() }}\n </span>\n @if (fileRecommendation()) {\n <span class=\"text-xs _shk-text-surface-400\">\n {{ fileRecommendation() }}\n </span>\n }\n </div>\n </div>\n }\n\n @if (maxReached()) {\n <div class=\"text-xs _shk-text-surface-400 text-center py-2\">\n Máximo {{ maxFiles() }} archivos alcanzado\n </div>\n }\n\n @if (selectedFiles().length > 0) {\n <div class=\"flex flex-wrap gap-3\">\n @for (file of selectedFiles(); track file.name + file.size + file.lastModified) {\n <div class=\"relative group\">\n @if (isImageFile(file)) {\n <img\n [src]=\"previewUrl(file)\"\n [alt]=\"file.name\"\n class=\"w-20 h-20 object-cover rounded-lg _shk-border\"\n />\n } @else {\n <div class=\"w-20 h-20 rounded-lg _shk-border flex flex-col items-center justify-center _shk-bg-surface-50 gap-1\">\n <svg [shkIcon]=\"getIcon('file')\" class=\"w-6 h-6 _shk-text-surface-400\"></svg>\n <span class=\"text-[10px] _shk-text-surface-400 truncate max-w-[70px] px-1 text-center\">{{ file.name }}</span>\n </div>\n }\n <button\n type=\"button\"\n (click)=\"removeFile(file)\"\n class=\"absolute -top-1.5 -right-1.5 w-5 h-5 bg-red-500 text-white rounded-full text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition shadow\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-3 h-3\"></svg>\n </button>\n </div>\n }\n </div>\n @if (!multiple()) {\n <button\n type=\"button\"\n (click)=\"changeFiles()\"\n class=\"text-xs _shk-text-primary hover:[color:var(--shk-primary-700)] dark:[color:var(--shk-primary-400)] dark:hover:[color:var(--shk-primary-300)] underline cursor-pointer bg-transparent border-0\"\n >\n {{ changeFilesText() }}\n </button>\n }\n }\n\n @if (existingFiles().length > 0) {\n <div class=\"flex flex-wrap gap-3\">\n @for (file of existingFiles(); track trackExistingFile(file)) {\n @if (existingDisplay() === 'tiles') {\n @let badge = getExistingBadge(file);\n <div class=\"relative group w-[80px]\">\n <div\n class=\"w-20 h-20 rounded-lg border _shk-border overflow-hidden cursor-pointer relative\"\n (click)=\"onExistingAction(file)\"\n [title]=\"file.name\"\n >\n @if (isExistingImage(file) && file.url) {\n <img [src]=\"file.url\" [alt]=\"file.name\" class=\"w-full h-full object-cover\" />\n } @else {\n <div class=\"w-full h-full flex flex-col items-center justify-center gap-1 _shk-bg-surface-50\">\n <svg [shkIcon]=\"getIcon(badge.icon)\" class=\"w-6 h-6 _shk-text-surface-400\"></svg>\n <span class=\"px-1.5 py-0.5 rounded text-[9px] font-semibold leading-none\" [class]=\"badge.color\">\n {{ badge.label }}\n </span>\n </div>\n }\n <div\n class=\"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 flex items-center justify-center transition rounded-lg\"\n >\n <svg [shkIcon]=\"getIcon('download')\" class=\"w-5 h-5 text-white\"></svg>\n </div>\n </div>\n <button\n type=\"button\"\n (click)=\"onExistingRemove(file)\"\n class=\"absolute -top-1.5 -right-1.5 w-5 h-5 bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition shadow\"\n aria-label=\"Remove\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-3 h-3\"></svg>\n </button>\n <span class=\"block text-[10px] _shk-text-surface-400 truncate text-center mt-1 max-w-[80px]\" [title]=\"file.name\">\n {{ file.name }}\n </span>\n </div>\n } @else {\n @let badge = getExistingBadge(file);\n <div class=\"flex items-center gap-2 _shk-bg-surface-50 border _shk-border rounded-full pl-3 pr-1.5 py-1 text-sm _shk-text-surface-700\">\n <svg [shkIcon]=\"getIcon(badge.icon)\" class=\"w-4 h-4 _shk-text-surface-400 shrink-0\"></svg>\n <span class=\"max-w-[200px] truncate\" [title]=\"file.name\">{{ file.name }}</span>\n <button\n type=\"button\"\n (click)=\"onExistingAction(file)\"\n [title]=\"file.name\"\n class=\"p-1 rounded-full hover:[background-color:var(--shk-surface-200)] _shk-text-surface-500 hover:[color:var(--shk-primary-600)]\"\n >\n <svg [shkIcon]=\"getIcon('download')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"onExistingRemove(file)\"\n class=\"p-1 rounded-full hover:[background-color:var(--shk-error-50)] _shk-text-surface-500 hover:[color:var(--shk-error-600)]\"\n aria-label=\"Remove\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n </div>\n }\n }\n </div>\n }\n\n @if (displayError()) {\n <p class=\"text-xs _shk-text-red-500\">{{ displayError() }}</p>\n }\n</div>"
|
|
398
|
+
}]
|
|
399
|
+
}],
|
|
400
|
+
propDecorators: {
|
|
401
|
+
label: [{
|
|
402
|
+
type: i0.Input,
|
|
403
|
+
args: [{
|
|
404
|
+
isSignal: true,
|
|
405
|
+
alias: "label",
|
|
406
|
+
required: false
|
|
407
|
+
}]
|
|
408
|
+
}],
|
|
409
|
+
accept: [{
|
|
410
|
+
type: i0.Input,
|
|
411
|
+
args: [{
|
|
412
|
+
isSignal: true,
|
|
413
|
+
alias: "accept",
|
|
414
|
+
required: false
|
|
415
|
+
}]
|
|
416
|
+
}],
|
|
417
|
+
maxFileSize: [{
|
|
418
|
+
type: i0.Input,
|
|
419
|
+
args: [{
|
|
420
|
+
isSignal: true,
|
|
421
|
+
alias: "maxFileSize",
|
|
422
|
+
required: false
|
|
423
|
+
}]
|
|
424
|
+
}],
|
|
425
|
+
maxFiles: [{
|
|
426
|
+
type: i0.Input,
|
|
427
|
+
args: [{
|
|
428
|
+
isSignal: true,
|
|
429
|
+
alias: "maxFiles",
|
|
430
|
+
required: false
|
|
431
|
+
}]
|
|
432
|
+
}],
|
|
433
|
+
fileUploadText: [{
|
|
434
|
+
type: i0.Input,
|
|
435
|
+
args: [{
|
|
436
|
+
isSignal: true,
|
|
437
|
+
alias: "fileUploadText",
|
|
438
|
+
required: false
|
|
439
|
+
}]
|
|
440
|
+
}],
|
|
441
|
+
fileRecommendation: [{
|
|
442
|
+
type: i0.Input,
|
|
443
|
+
args: [{
|
|
444
|
+
isSignal: true,
|
|
445
|
+
alias: "fileRecommendation",
|
|
446
|
+
required: false
|
|
447
|
+
}]
|
|
448
|
+
}],
|
|
449
|
+
changeFilesText: [{
|
|
450
|
+
type: i0.Input,
|
|
451
|
+
args: [{
|
|
452
|
+
isSignal: true,
|
|
453
|
+
alias: "changeFilesText",
|
|
454
|
+
required: false
|
|
455
|
+
}]
|
|
456
|
+
}],
|
|
457
|
+
multiple: [{
|
|
458
|
+
type: i0.Input,
|
|
459
|
+
args: [{
|
|
460
|
+
isSignal: true,
|
|
461
|
+
alias: "multiple",
|
|
462
|
+
required: false
|
|
463
|
+
}]
|
|
464
|
+
}],
|
|
465
|
+
existingFiles: [{
|
|
466
|
+
type: i0.Input,
|
|
467
|
+
args: [{
|
|
468
|
+
isSignal: true,
|
|
469
|
+
alias: "existingFiles",
|
|
470
|
+
required: false
|
|
471
|
+
}]
|
|
472
|
+
}],
|
|
473
|
+
existingDisplay: [{
|
|
474
|
+
type: i0.Input,
|
|
475
|
+
args: [{
|
|
476
|
+
isSignal: true,
|
|
477
|
+
alias: "existingDisplay",
|
|
478
|
+
required: false
|
|
479
|
+
}]
|
|
480
|
+
}],
|
|
481
|
+
errors: [{
|
|
482
|
+
type: i0.Input,
|
|
483
|
+
args: [{
|
|
484
|
+
isSignal: true,
|
|
485
|
+
alias: "errors",
|
|
486
|
+
required: false
|
|
487
|
+
}]
|
|
488
|
+
}],
|
|
489
|
+
invalid: [{
|
|
490
|
+
type: i0.Input,
|
|
491
|
+
args: [{
|
|
492
|
+
isSignal: true,
|
|
493
|
+
alias: "invalid",
|
|
494
|
+
required: false
|
|
495
|
+
}]
|
|
496
|
+
}],
|
|
497
|
+
touched: [{
|
|
498
|
+
type: i0.Input,
|
|
499
|
+
args: [{
|
|
500
|
+
isSignal: true,
|
|
501
|
+
alias: "touched",
|
|
502
|
+
required: false
|
|
503
|
+
}]
|
|
504
|
+
}],
|
|
505
|
+
dirty: [{
|
|
506
|
+
type: i0.Input,
|
|
507
|
+
args: [{
|
|
508
|
+
isSignal: true,
|
|
509
|
+
alias: "dirty",
|
|
510
|
+
required: false
|
|
511
|
+
}]
|
|
512
|
+
}],
|
|
513
|
+
fileSelected: [{
|
|
514
|
+
type: i0.Output,
|
|
515
|
+
args: ["fileSelected"]
|
|
516
|
+
}],
|
|
517
|
+
fileRemoved: [{
|
|
518
|
+
type: i0.Output,
|
|
519
|
+
args: ["fileRemoved"]
|
|
520
|
+
}],
|
|
521
|
+
fileError: [{
|
|
522
|
+
type: i0.Output,
|
|
523
|
+
args: ["fileError"]
|
|
524
|
+
}],
|
|
525
|
+
fileWarning: [{
|
|
526
|
+
type: i0.Output,
|
|
527
|
+
args: ["fileWarning"]
|
|
528
|
+
}],
|
|
529
|
+
existingFileAction: [{
|
|
530
|
+
type: i0.Output,
|
|
531
|
+
args: ["existingFileAction"]
|
|
532
|
+
}],
|
|
533
|
+
existingFileRemove: [{
|
|
534
|
+
type: i0.Output,
|
|
535
|
+
args: ["existingFileRemove"]
|
|
536
|
+
}],
|
|
537
|
+
value: [{
|
|
538
|
+
type: i0.Input,
|
|
539
|
+
args: [{
|
|
540
|
+
isSignal: true,
|
|
541
|
+
alias: "value",
|
|
542
|
+
required: false
|
|
543
|
+
}]
|
|
544
|
+
}, {
|
|
545
|
+
type: i0.Output,
|
|
546
|
+
args: ["valueChange"]
|
|
547
|
+
}],
|
|
548
|
+
touch: [{
|
|
549
|
+
type: i0.Output,
|
|
550
|
+
args: ["touch"]
|
|
551
|
+
}]
|
|
552
|
+
}
|
|
553
|
+
});
|
|
300
554
|
export { FileUploadComponent };
|
|
301
|
-
|
|
555
|
+
|
|
556
|
+
//# sourceMappingURL=shirkasoft-ui-components-file-upload.mjs.map
|