shirkasoft-ui-components 2.0.0 → 2.1.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/README.md +209 -53
- package/fesm2022/shirkasoft-ui-components-config.mjs +610 -72
- package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs +79 -6
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs +74 -3
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-icons.mjs +6 -6
- package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +70 -2
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-select.mjs +76 -14
- package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +11 -0
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-text-field.mjs +80 -18
- package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +262 -165
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme.mjs +2 -24
- package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +36 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/package.json +1 -1
- package/types/shirkasoft-ui-components-config.d.ts +246 -20
- package/types/shirkasoft-ui-components-date-picker.d.ts +35 -1
- package/types/shirkasoft-ui-components-file-upload.d.ts +35 -1
- package/types/shirkasoft-ui-components-icons.d.ts +6 -6
- package/types/shirkasoft-ui-components-price-input.d.ts +36 -2
- package/types/shirkasoft-ui-components-select.d.ts +36 -2
- package/types/shirkasoft-ui-components-text-field.d.ts +36 -4
- package/types/shirkasoft-ui-components-theme-picker.d.ts +40 -12
- package/types/shirkasoft-ui-components-theme.d.ts +17 -9
- package/types/shirkasoft-ui-components-utils.d.ts +34 -1
|
@@ -3,7 +3,7 @@ import { ChangeDetectionStrategy, Component, computed, inject, input, model, out
|
|
|
3
3
|
import { CommonModule } from "@angular/common";
|
|
4
4
|
import { TranslocoService } from "@jsverse/transloco";
|
|
5
5
|
import { LucideUpload, ShkIconDirective } from "shirkasoft-ui-components/icons";
|
|
6
|
-
import { getIcon } from "shirkasoft-ui-components/utils";
|
|
6
|
+
import { errorMessagesFromMap, getIcon, signalErrorsToMap } from "shirkasoft-ui-components/utils";
|
|
7
7
|
var FileUploadComponent = class FileUploadComponent {
|
|
8
8
|
constructor() {
|
|
9
9
|
this.getIcon = (name) => getIcon(name, LucideUpload);
|
|
@@ -18,6 +18,10 @@ var FileUploadComponent = class FileUploadComponent {
|
|
|
18
18
|
this.multiple = input(false, ...ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []);
|
|
19
19
|
this.existingFiles = input([], ...ngDevMode ? [{ debugName: "existingFiles" }] : /* istanbul ignore next */ []);
|
|
20
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 */ []);
|
|
21
25
|
this.fileSelected = output();
|
|
22
26
|
this.fileRemoved = output();
|
|
23
27
|
this.fileError = output();
|
|
@@ -28,6 +32,13 @@ var FileUploadComponent = class FileUploadComponent {
|
|
|
28
32
|
this.touch = output();
|
|
29
33
|
this.errorMessage = signal("", ...ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []);
|
|
30
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 */ []);
|
|
31
42
|
this.previewUrls = /* @__PURE__ */ new Map();
|
|
32
43
|
this.canAddMore = computed(() => {
|
|
33
44
|
if (!this.multiple()) return this.selectedFiles().length === 0;
|
|
@@ -306,6 +317,34 @@ var FileUploadComponent = class FileUploadComponent {
|
|
|
306
317
|
isRequired: false,
|
|
307
318
|
transformFunction: null
|
|
308
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
|
+
},
|
|
309
348
|
value: {
|
|
310
349
|
classPropertyName: "value",
|
|
311
350
|
publicName: "value",
|
|
@@ -325,7 +364,7 @@ var FileUploadComponent = class FileUploadComponent {
|
|
|
325
364
|
touch: "touch"
|
|
326
365
|
},
|
|
327
366
|
ngImport: i0,
|
|
328
|
-
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]=\"
|
|
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>",
|
|
329
368
|
dependencies: [{
|
|
330
369
|
kind: "ngmodule",
|
|
331
370
|
type: CommonModule
|
|
@@ -355,7 +394,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
355
394
|
selector: "shk-file-upload",
|
|
356
395
|
imports: [CommonModule, ShkIconDirective],
|
|
357
396
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
358
|
-
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]=\"
|
|
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>"
|
|
359
398
|
}]
|
|
360
399
|
}],
|
|
361
400
|
propDecorators: {
|
|
@@ -439,6 +478,38 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
439
478
|
required: false
|
|
440
479
|
}]
|
|
441
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
|
+
}],
|
|
442
513
|
fileSelected: [{
|
|
443
514
|
type: i0.Output,
|
|
444
515
|
args: ["fileSelected"]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shirkasoft-ui-components-file-upload.mjs","names":["getIconFromCentral"],"sources":["../../../projects/ui-components/file-upload/file-upload.component.ts","../../../projects/ui-components/file-upload/file-upload.component.html"],"sourcesContent":["import {\n Component,\n input,\n model,\n output,\n signal,\n computed,\n ChangeDetectionStrategy,\n inject,\n OnDestroy,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { TranslocoService } from '@jsverse/transloco';\nimport { ShkIconDirective, LucideUpload } from 'shirkasoft-ui-components/icons';\nimport { getIcon as getIconFromCentral } from 'shirkasoft-ui-components/utils';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nexport interface FileUploadError {\n type: 'size' | 'type';\n message: string;\n file: File;\n}\n\nexport interface ExistingFile {\n id?: number | string;\n name: string;\n url?: string;\n mimeType?: string;\n size?: number;\n}\n\n/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/**\n * Drag & drop file uploader with file type/size validation, image previews,\n * multiple files support and localized error messages.\n */\n@Component({\n selector: 'shk-file-upload',\n imports: [CommonModule, ShkIconDirective],\n templateUrl: './file-upload.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FileUploadComponent implements OnDestroy, FormValueControl<File[]> {\n protected getIcon = (name: any) => getIconFromCentral(name, LucideUpload);\n private transloco = inject(TranslocoService);\n\n /** Main label of the uploader. */\n label = input<string>('Cargar archivo');\n /** Accepted MIME types/extensions (e.g. 'image/*', '.pdf'). */\n accept = input<string>('image/*');\n /** Maximum allowed size per file (bytes). */\n maxFileSize = input<number>(2 * 1024 * 1024);\n /** Maximum number of files (0 = unlimited). */\n maxFiles = input<number>(0);\n /** Text of the file picker button. */\n fileUploadText = input<string>('Seleccionar archivo');\n /** Helper text shown next to the label. */\n fileRecommendation = input<string>('');\n /** Text shown when files are already loaded. */\n changeFilesText = input<string>('Cambiar archivos');\n /** Enables selecting more than one file at once. */\n multiple = input<boolean>(false);\n /** Files already stored by the parent (read-only; the component only emits events). */\n existingFiles = input<ExistingFile[]>([]);\n /** How existing files are rendered. */\n existingDisplay = input<'chips' | 'tiles'>('chips');\n\n /** Emitted with the currently selected files. */\n fileSelected = output<File[]>();\n /** Emitted when the last selected file is removed. */\n fileRemoved = output<void>();\n /** Emitted when a file fails validation (type/size). */\n fileError = output<FileUploadError>();\n /** Emitted when a file is near the size limit. */\n fileWarning = output<FileUploadError>();\n /** Emitted when an existing file is requested for download/view. */\n existingFileAction = output<ExistingFile>();\n /** Emitted when an existing file should be removed (parent deletes it). */\n existingFileRemove = output<ExistingFile>();\n\n /** Currently selected files. Two-way bindable and used by `[formField]`. */\n value = model<File[]>([]);\n /** Alias kept for the existing implementation and templates. */\n get selectedFiles() {\n return this.value;\n }\n /** Emitted when the selection changes so Signal Forms marks the field as touched. */\n touch = output<void>();\n /** Localized error message displayed to the user. */\n errorMessage = signal<string>('');\n /** Whether the user is dragging files over the zone. */\n isDragOver = signal<boolean>(false);\n\n /** Object URLs used for image previews. */\n private previewUrls = new Map<File, string>();\n\n /** Whether another selection is allowed. */\n canAddMore = computed(() => {\n if (!this.multiple()) return this.selectedFiles().length === 0;\n const max = this.maxFiles();\n if (max <= 0) return true;\n return this.selectedFiles().length < max;\n });\n\n /** True when the maximum number of files has been reached. */\n maxReached = computed(() => {\n const max = this.maxFiles();\n if (max <= 0) return false;\n return this.selectedFiles().length >= max;\n });\n\n /** Whether the file is an image (used for previews). */\n isImageFile(file: File): boolean {\n return file.type.startsWith('image/');\n }\n\n /** Returns (creating on demand) the object URL for a file preview. */\n previewUrl(file: File): string {\n if (!this.previewUrls.has(file)) {\n this.previewUrls.set(file, URL.createObjectURL(file));\n }\n return this.previewUrls.get(file) ?? '';\n }\n\n /** Marks the drop zone as active while dragging over it. */\n onDragOver(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(true);\n }\n\n /** Clears the drag-over state when the drag leaves the zone. */\n onDragLeave(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(false);\n }\n\n /** Processes the files dropped on the zone. */\n onDrop(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(false);\n\n const files = event.dataTransfer?.files;\n if (files && files.length > 0) {\n this.processFiles(Array.from(files));\n }\n }\n\n /** Processes the files picked from the native file input. */\n onFileChange(event: Event): void {\n const input = event.target as HTMLInputElement;\n const files = input.files;\n if (files && files.length > 0) {\n this.processFiles(Array.from(files));\n }\n input.value = '';\n }\n\n /** Validates and appends the received files, emitting errors/warnings. */\n private processFiles(files: File[]): void {\n this.errorMessage.set('');\n const validFiles: File[] = [];\n\n for (const file of files) {\n const error = this.validateFile(file);\n if (error) {\n this.fileError.emit(error);\n this.errorMessage.set(error.message);\n return;\n }\n\n const warning = this.checkSizeWarning(file);\n if (warning) {\n this.fileWarning.emit(warning);\n }\n\n validFiles.push(file);\n }\n\n const max = this.maxFiles();\n if (max > 0) {\n const currentCount = this.selectedFiles().length;\n const allowed = max - currentCount;\n if (validFiles.length > allowed) {\n const errorMsg = this.transloco.translate('fileUpload.maxFiles', undefined, `Máximo ${max} archivos permitidos`);\n this.errorMessage.set(errorMsg);\n return;\n }\n }\n\n if (this.multiple()) {\n this.selectedFiles.set([...this.selectedFiles(), ...validFiles]);\n } else {\n this.clearPreviews();\n this.selectedFiles.set(validFiles);\n }\n\n this.touch.emit();\n this.fileSelected.emit(this.selectedFiles());\n }\n\n /** Validates a file against `accept` and `maxFileSize`. */\n private validateFile(file: File): FileUploadError | null {\n const acceptStr = this.accept();\n if (acceptStr && acceptStr !== '*') {\n const acceptTypes = acceptStr.split(',').map((t) => t.trim());\n const valid = acceptTypes.some((type) => {\n if (type.endsWith('/*')) {\n const category = type.replace('/*', '');\n return file.type.startsWith(category);\n }\n if (type.startsWith('.')) {\n const ext = type.slice(1).toLowerCase();\n return file.name.toLowerCase().endsWith('.' + ext);\n }\n if (type.includes('/')) {\n return file.type === type;\n }\n return false;\n });\n\n if (!valid) {\n return {\n type: 'type',\n message: this.transloco.translate('fileUpload.invalidType', { accept: acceptStr }, `Tipo de archivo no válido. Formatos aceptados: ${acceptStr}`),\n file,\n };\n }\n }\n\n if (this.maxFileSize() > 0 && file.size > this.maxFileSize()) {\n return {\n type: 'size',\n message: this.transloco.translate('fileUpload.fileTooLarge', { size: this.formatFileSize(this.maxFileSize()) }, `El archivo excede el tamaño máximo de ${this.formatFileSize(this.maxFileSize())}`),\n file,\n };\n }\n\n return null;\n }\n\n /** Emits a warning when the file is close to the size limit (>90%). */\n private checkSizeWarning(file: File): FileUploadError | null {\n if (this.maxFileSize() > 0 && file.size > this.maxFileSize() * 0.9) {\n return {\n type: 'size',\n 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())})`),\n file,\n };\n }\n return null;\n }\n\n /** Removes a file, revoking its preview URL. */\n removeFile(file: File): void {\n const url = this.previewUrls.get(file);\n if (url) {\n URL.revokeObjectURL(url);\n this.previewUrls.delete(file);\n }\n\n this.selectedFiles.update((files) => files.filter((f) => f !== file));\n this.errorMessage.set('');\n\n if (this.selectedFiles().length === 0) {\n this.fileRemoved.emit();\n }\n }\n\n /** Clears all selected files and previews. */\n changeFiles(): void {\n this.clearPreviews();\n this.selectedFiles.set([]);\n this.errorMessage.set('');\n }\n\n /** Revokes every stored preview object URL. */\n private clearPreviews(): void {\n for (const [file, url] of this.previewUrls) {\n URL.revokeObjectURL(url);\n }\n this.previewUrls.clear();\n }\n\n /** Revokes pending preview URLs when the component is destroyed. */\n ngOnDestroy(): void {\n this.clearPreviews();\n }\n\n /** Emits the action (download/view) for an existing file. */\n onExistingAction(file: ExistingFile): void {\n this.existingFileAction.emit(file);\n }\n\n /** Emits the removal request for an existing file. */\n onExistingRemove(file: ExistingFile): void {\n this.existingFileRemove.emit(file);\n }\n\n /** Whether an existing file is an image (by mime type or extension). */\n isExistingImage(file: ExistingFile): boolean {\n const mime = (file.mimeType || '').toLowerCase();\n if (mime.startsWith('image/')) return true;\n const ext = this.getExtension(file.name).toLowerCase();\n return ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg'].includes(ext);\n }\n\n /** Resolves the extension of a file name. */\n getExtension(name: string): string {\n return name.split('.').pop()?.toLowerCase() || '';\n }\n\n /** Icon + colored badge shown for non-image files, hinting at the type. */\n getExistingBadge(file: ExistingFile): { label: string; color: string; icon: string } {\n const ext = this.getExtension(file.name);\n switch (ext) {\n case 'pdf':\n return { label: 'PDF', color: 'bg-red-100 text-red-600', icon: 'file-text' };\n case 'doc':\n case 'docx':\n return { label: 'DOC', color: 'bg-blue-100 text-blue-600', icon: 'file-text' };\n case 'xls':\n case 'xlsx':\n return { label: 'XLS', color: 'bg-green-100 text-green-600', icon: 'file-spreadsheet' };\n default:\n return { label: ext.toUpperCase() || 'FILE', color: 'bg-slate-100 text-slate-500', icon: 'file' };\n }\n }\n\n /** trackBy for existing files. */\n trackExistingFile(file: ExistingFile): any {\n return file.id ?? file.name;\n }\n\n /** Human readable size (B/KB/MB). */\n private formatFileSize(bytes: number): string {\n if (bytes < 1024) return bytes + ' B';\n if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';\n return (bytes / (1024 * 1024)).toFixed(1) + ' MB';\n }\n}","<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]=\"errorMessage() ? 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 (errorMessage()) {\n <p class=\"text-xs _shk-text-red-500\">{{ errorMessage() }}</p>\n }\n</div>"],"mappings":";;;;;;AA+CA,IAAa,sBAAb,MAAa,oBAAmB;CANhC,cAAA;EAOY,KAAA,WAAW,SAAcA,QAAmB,MAAM,YAAY;EAChE,KAAA,YAAY,OAAO,gBAAgB;EAG3C,KAAA,QAAQ,MAAc,kBAAiB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;EAEvC,KAAA,SAAS,MAAc,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;EAEjC,KAAA,cAAc,MAAc,SAAgB,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;EAE5C,KAAA,WAAW,MAAc,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;EAE3B,KAAA,iBAAiB,MAAc,uBAAsB,GAAA,YAAA,CAAA,EAAA,WAAA,iBAAA,CAAA,+BAAA,CAAA,CAAA;EAErD,KAAA,qBAAqB,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,qBAAA,CAAA,+BA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,CAAA;CAAA;;AAI7B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAmB,YAAA,CAAA;EAN/B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAiB,SAClB,CAAC,cAAc,gBAAgB;GAAC,iBAExB,wBAAwB;GAAM,UAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"shirkasoft-ui-components-file-upload.mjs","names":["getIconFromCentral"],"sources":["../../../projects/ui-components/file-upload/file-upload.component.ts","../../../projects/ui-components/file-upload/file-upload.component.html"],"sourcesContent":["import {\n Component,\n input,\n model,\n output,\n signal,\n computed,\n ChangeDetectionStrategy,\n inject,\n OnDestroy,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { TranslocoService } from '@jsverse/transloco';\nimport { ShkIconDirective, LucideUpload } from 'shirkasoft-ui-components/icons';\nimport {\n errorMessagesFromMap,\n getIcon as getIconFromCentral,\n signalErrorsToMap,\n} from 'shirkasoft-ui-components/utils';\nimport { type FormValueControl, type ValidationError } from '@angular/forms/signals';\n\nexport interface FileUploadError {\n type: 'size' | 'type';\n message: string;\n file: File;\n}\n\nexport interface ExistingFile {\n id?: number | string;\n name: string;\n url?: string;\n mimeType?: string;\n size?: number;\n}\n\n/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/**\n * Drag & drop file uploader with file type/size validation, image previews,\n * multiple files support and localized error messages.\n */\n@Component({\n selector: 'shk-file-upload',\n imports: [CommonModule, ShkIconDirective],\n templateUrl: './file-upload.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FileUploadComponent implements OnDestroy, FormValueControl<File[]> {\n protected getIcon = (name: any) => getIconFromCentral(name, LucideUpload);\n private transloco = inject(TranslocoService);\n /** Main label of the uploader. */\n label = input<string>('Cargar archivo');\n /** Accepted MIME types/extensions (e.g. 'image/*', '.pdf'). */\n accept = input<string>('image/*');\n /** Maximum allowed size per file (bytes). */\n maxFileSize = input<number>(2 * 1024 * 1024);\n /** Maximum number of files (0 = unlimited). */\n maxFiles = input<number>(0);\n /** Text of the file picker button. */\n fileUploadText = input<string>('Seleccionar archivo');\n /** Helper text shown next to the label. */\n fileRecommendation = input<string>('');\n /** Text shown when files are already loaded. */\n changeFilesText = input<string>('Cambiar archivos');\n /** Enables selecting more than one file at once. */\n multiple = input<boolean>(false);\n /** Files already stored by the parent (read-only; the component only emits events). */\n existingFiles = input<ExistingFile[]>([]);\n /** How existing files are rendered. */\n existingDisplay = input<'chips' | 'tiles'>('chips');\n /** Errors bound automatically by the Signal Forms `[formField]` directive. */\n errors = input<readonly ValidationError.WithOptionalFieldTree[]>([]);\n /** Invalid status bound automatically by `[formField]`. */\n invalid = input<boolean>(false);\n /** Touched status bound automatically by `[formField]`. */\n touched = input<boolean>(false);\n /** Dirty status bound automatically by `[formField]`. */\n dirty = input<boolean>(false);\n\n /** Emitted with the currently selected files. */\n fileSelected = output<File[]>();\n /** Emitted when the last selected file is removed. */\n fileRemoved = output<void>();\n /** Emitted when a file fails validation (type/size). */\n fileError = output<FileUploadError>();\n /** Emitted when a file is near the size limit. */\n fileWarning = output<FileUploadError>();\n /** Emitted when an existing file is requested for download/view. */\n existingFileAction = output<ExistingFile>();\n /** Emitted when an existing file should be removed (parent deletes it). */\n existingFileRemove = output<ExistingFile>();\n\n /** Currently selected files. Two-way bindable and used by `[formField]`. */\n value = model<File[]>([]);\n /** Alias kept for the existing implementation and templates. */\n get selectedFiles() {\n return this.value;\n }\n /** Emitted when the selection changes so Signal Forms marks the field as touched. */\n touch = output<void>();\n /** Localized error message displayed to the user. */\n errorMessage = signal<string>('');\n /** Whether the user is dragging files over the zone. */\n isDragOver = signal<boolean>(false);\n\n /**\n * Error message rendered under the uploader. Local type/size errors take\n * precedence; otherwise the first Signal Forms error is shown once the field\n * has been touched or modified.\n */\n displayError = computed(() => {\n const local = this.errorMessage();\n if (local) return local;\n\n if (!this.invalid() || (!this.touched() && !this.dirty())) return '';\n\n const translate = (key: string, params?: Record<string, any>) =>\n this.transloco.translate(key, params);\n\n return (\n errorMessagesFromMap(signalErrorsToMap(this.errors()), {}, translate)[0] ?? ''\n );\n });\n\n /** Object URLs used for image previews. */\n private previewUrls = new Map<File, string>();\n\n /** Whether another selection is allowed. */\n canAddMore = computed(() => {\n if (!this.multiple()) return this.selectedFiles().length === 0;\n const max = this.maxFiles();\n if (max <= 0) return true;\n return this.selectedFiles().length < max;\n });\n\n /** True when the maximum number of files has been reached. */\n maxReached = computed(() => {\n const max = this.maxFiles();\n if (max <= 0) return false;\n return this.selectedFiles().length >= max;\n });\n\n /** Whether the file is an image (used for previews). */\n isImageFile(file: File): boolean {\n return file.type.startsWith('image/');\n }\n\n /** Returns (creating on demand) the object URL for a file preview. */\n previewUrl(file: File): string {\n if (!this.previewUrls.has(file)) {\n this.previewUrls.set(file, URL.createObjectURL(file));\n }\n return this.previewUrls.get(file) ?? '';\n }\n\n /** Marks the drop zone as active while dragging over it. */\n onDragOver(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(true);\n }\n\n /** Clears the drag-over state when the drag leaves the zone. */\n onDragLeave(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(false);\n }\n\n /** Processes the files dropped on the zone. */\n onDrop(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(false);\n\n const files = event.dataTransfer?.files;\n if (files && files.length > 0) {\n this.processFiles(Array.from(files));\n }\n }\n\n /** Processes the files picked from the native file input. */\n onFileChange(event: Event): void {\n const input = event.target as HTMLInputElement;\n const files = input.files;\n if (files && files.length > 0) {\n this.processFiles(Array.from(files));\n }\n input.value = '';\n }\n\n /** Validates and appends the received files, emitting errors/warnings. */\n private processFiles(files: File[]): void {\n this.errorMessage.set('');\n const validFiles: File[] = [];\n\n for (const file of files) {\n const error = this.validateFile(file);\n if (error) {\n this.fileError.emit(error);\n this.errorMessage.set(error.message);\n return;\n }\n\n const warning = this.checkSizeWarning(file);\n if (warning) {\n this.fileWarning.emit(warning);\n }\n\n validFiles.push(file);\n }\n\n const max = this.maxFiles();\n if (max > 0) {\n const currentCount = this.selectedFiles().length;\n const allowed = max - currentCount;\n if (validFiles.length > allowed) {\n const errorMsg = this.transloco.translate('fileUpload.maxFiles', undefined, `Máximo ${max} archivos permitidos`);\n this.errorMessage.set(errorMsg);\n return;\n }\n }\n\n if (this.multiple()) {\n this.selectedFiles.set([...this.selectedFiles(), ...validFiles]);\n } else {\n this.clearPreviews();\n this.selectedFiles.set(validFiles);\n }\n\n this.touch.emit();\n this.fileSelected.emit(this.selectedFiles());\n }\n\n /** Validates a file against `accept` and `maxFileSize`. */\n private validateFile(file: File): FileUploadError | null {\n const acceptStr = this.accept();\n if (acceptStr && acceptStr !== '*') {\n const acceptTypes = acceptStr.split(',').map((t) => t.trim());\n const valid = acceptTypes.some((type) => {\n if (type.endsWith('/*')) {\n const category = type.replace('/*', '');\n return file.type.startsWith(category);\n }\n if (type.startsWith('.')) {\n const ext = type.slice(1).toLowerCase();\n return file.name.toLowerCase().endsWith('.' + ext);\n }\n if (type.includes('/')) {\n return file.type === type;\n }\n return false;\n });\n\n if (!valid) {\n return {\n type: 'type',\n message: this.transloco.translate('fileUpload.invalidType', { accept: acceptStr }, `Tipo de archivo no válido. Formatos aceptados: ${acceptStr}`),\n file,\n };\n }\n }\n\n if (this.maxFileSize() > 0 && file.size > this.maxFileSize()) {\n return {\n type: 'size',\n message: this.transloco.translate('fileUpload.fileTooLarge', { size: this.formatFileSize(this.maxFileSize()) }, `El archivo excede el tamaño máximo de ${this.formatFileSize(this.maxFileSize())}`),\n file,\n };\n }\n\n return null;\n }\n\n /** Emits a warning when the file is close to the size limit (>90%). */\n private checkSizeWarning(file: File): FileUploadError | null {\n if (this.maxFileSize() > 0 && file.size > this.maxFileSize() * 0.9) {\n return {\n type: 'size',\n 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())})`),\n file,\n };\n }\n return null;\n }\n\n /** Removes a file, revoking its preview URL. */\n removeFile(file: File): void {\n const url = this.previewUrls.get(file);\n if (url) {\n URL.revokeObjectURL(url);\n this.previewUrls.delete(file);\n }\n\n this.selectedFiles.update((files) => files.filter((f) => f !== file));\n this.errorMessage.set('');\n\n if (this.selectedFiles().length === 0) {\n this.fileRemoved.emit();\n }\n }\n\n /** Clears all selected files and previews. */\n changeFiles(): void {\n this.clearPreviews();\n this.selectedFiles.set([]);\n this.errorMessage.set('');\n }\n\n /** Revokes every stored preview object URL. */\n private clearPreviews(): void {\n for (const [file, url] of this.previewUrls) {\n URL.revokeObjectURL(url);\n }\n this.previewUrls.clear();\n }\n\n /** Revokes pending preview URLs when the component is destroyed. */\n ngOnDestroy(): void {\n this.clearPreviews();\n }\n\n /** Emits the action (download/view) for an existing file. */\n onExistingAction(file: ExistingFile): void {\n this.existingFileAction.emit(file);\n }\n\n /** Emits the removal request for an existing file. */\n onExistingRemove(file: ExistingFile): void {\n this.existingFileRemove.emit(file);\n }\n\n /** Whether an existing file is an image (by mime type or extension). */\n isExistingImage(file: ExistingFile): boolean {\n const mime = (file.mimeType || '').toLowerCase();\n if (mime.startsWith('image/')) return true;\n const ext = this.getExtension(file.name).toLowerCase();\n return ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg'].includes(ext);\n }\n\n /** Resolves the extension of a file name. */\n getExtension(name: string): string {\n return name.split('.').pop()?.toLowerCase() || '';\n }\n\n /** Icon + colored badge shown for non-image files, hinting at the type. */\n getExistingBadge(file: ExistingFile): { label: string; color: string; icon: string } {\n const ext = this.getExtension(file.name);\n switch (ext) {\n case 'pdf':\n return { label: 'PDF', color: 'bg-red-100 text-red-600', icon: 'file-text' };\n case 'doc':\n case 'docx':\n return { label: 'DOC', color: 'bg-blue-100 text-blue-600', icon: 'file-text' };\n case 'xls':\n case 'xlsx':\n return { label: 'XLS', color: 'bg-green-100 text-green-600', icon: 'file-spreadsheet' };\n default:\n return { label: ext.toUpperCase() || 'FILE', color: 'bg-slate-100 text-slate-500', icon: 'file' };\n }\n }\n\n /** trackBy for existing files. */\n trackExistingFile(file: ExistingFile): any {\n return file.id ?? file.name;\n }\n\n /** Human readable size (B/KB/MB). */\n private formatFileSize(bytes: number): string {\n if (bytes < 1024) return bytes + ' B';\n if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';\n return (bytes / (1024 * 1024)).toFixed(1) + ' MB';\n }\n}","<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 <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AAA;KAAA,YAAA;KAAA,mBAAA;IAAA;IAAA,SAAA;KAAA,mBAAA;KAAA,YAAA;KAAA,UAAA;KAAA,YAAA;KAAA,mBAAA;IAAA;IAAA,OAAA;KAAA,mBAAA;KAAA,YAAA;KAAA,UAAA;KAAA,YAAA;KAAA,mBAAA;IAAA;IAAA,OAAA;KAAA,mBAAA;KAAA,YAAA;KAAA,UAAA;KAAA,YAAA;KAAA,mBAAA;IAAA;GAAA;GAAA,SAAA;IAAA,cAAA;IAAA,aAAA;IAAA,WAAA;IAAA,aAAA;IAAA,oBAAA;IAAA,oBAAA;IAAA,OAAA;IAAA,OAAA;GAAA;GAAA,UAAA;GAAA,UCnDhC;GA0JM,cAAA,CAAA;IAAA,MAAA;IAAA,MD3GM;GAAY,GAAA;IAAA,MAAA;IAAA,MAAE;IAAgB,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA,CAAA;GAAA,iBAAA,GAAA,wBAAA;EAAA,CAAA;CAAA;;AAI7B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAmB,YAAA,CAAA;EAN/B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAiB,SAClB,CAAC,cAAc,gBAAgB;GAAC,iBAExB,wBAAwB;GAAM,UAAA;EAAA,CAAA"}
|
|
@@ -346,7 +346,7 @@ const ICON_NODES = {
|
|
|
346
346
|
"cy": "12",
|
|
347
347
|
"r": "10"
|
|
348
348
|
}],
|
|
349
|
-
["path", { "d": "M9 9.5a3 2.5 0
|
|
349
|
+
["path", { "d": "M9 9.5a3 2.5 0 0 1 6 0c0 2-2 2-3 3.5" }],
|
|
350
350
|
["path", { "d": "M12 17h.01" }]
|
|
351
351
|
],
|
|
352
352
|
LucideCircleX: [
|
|
@@ -411,7 +411,7 @@ const ICON_NODES = {
|
|
|
411
411
|
"rx": "1"
|
|
412
412
|
}]
|
|
413
413
|
],
|
|
414
|
-
LucideDollarSign: [["path", { "d": "M12 3v18" }], ["path", { "d": "M17 5H9.5a1 1 0
|
|
414
|
+
LucideDollarSign: [["path", { "d": "M12 3v18" }], ["path", { "d": "M17 5H9.5a1 1 0 0 0 0 7h5a1 1 0 0 1 0 7H6" }]],
|
|
415
415
|
LucideDownload: [
|
|
416
416
|
["path", { "d": "M12 15V3" }],
|
|
417
417
|
["path", { "d": "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }],
|
|
@@ -440,7 +440,7 @@ const ICON_NODES = {
|
|
|
440
440
|
"r": "3"
|
|
441
441
|
}]],
|
|
442
442
|
LucideEyeOff: [
|
|
443
|
-
["path", { "d": "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.
|
|
443
|
+
["path", { "d": "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.8 10.8 0 0 1-1.444 2.49" }],
|
|
444
444
|
["path", { "d": "M14.084 14.158a3 3 0 0 1-4.242-4.242" }],
|
|
445
445
|
["path", { "d": "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" }],
|
|
446
446
|
["path", { "d": "m2 2 20 20" }]
|
|
@@ -763,8 +763,8 @@ const ICON_NODES = {
|
|
|
763
763
|
LucideShip: [
|
|
764
764
|
["path", { "d": "M12 2v2" }],
|
|
765
765
|
["path", { "d": "M12 9.189V13" }],
|
|
766
|
-
["path", { "d": "M19 12V6a2 2 0
|
|
767
|
-
["path", { "d": "M19.38 19A11.6 11.6 0
|
|
766
|
+
["path", { "d": "M19 12V6a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6" }],
|
|
767
|
+
["path", { "d": "M19.38 19A11.6 11.6 0 0 0 21 13l-8.188-3.639a2 2 0 0 0-1.624 0L3 13.001a11.6 11.6 0 0 0 2.81 7.76" }],
|
|
768
768
|
["path", { "d": "M2 20c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1" }]
|
|
769
769
|
],
|
|
770
770
|
LucideSliders: [
|
|
@@ -799,7 +799,7 @@ const ICON_NODES = {
|
|
|
799
799
|
"rx": "2"
|
|
800
800
|
}]
|
|
801
801
|
],
|
|
802
|
-
LucideStar: [["path", { "d": "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.
|
|
802
|
+
LucideStar: [["path", { "d": "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.12 2.12 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16z" }]],
|
|
803
803
|
LucideTable: [
|
|
804
804
|
["path", { "d": "M12 3v18" }],
|
|
805
805
|
["rect", {
|