@weeehaoooz/talos-ui 0.1.1 → 0.1.2
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 +2 -0
- package/fesm2022/{weeehaoooz-talos-ui-button-button-group.mjs → weeehaoooz-talos-ui-button.mjs} +91 -15
- package/fesm2022/weeehaoooz-talos-ui-button.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display.mjs +3110 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz.mjs +2414 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-dropdown.mjs +1039 -0
- package/fesm2022/weeehaoooz-talos-ui-dropdown.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback.mjs +2885 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form.mjs +10799 -0
- package/fesm2022/weeehaoooz-talos-ui-form.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-layout.mjs +1316 -7
- package/fesm2022/weeehaoooz-talos-ui-layout.mjs.map +1 -1
- package/fesm2022/weeehaoooz-talos-ui-nav.mjs +3 -3
- package/fesm2022/weeehaoooz-talos-ui-nav.mjs.map +1 -1
- package/fesm2022/weeehaoooz-talos-ui.mjs +21592 -16293
- package/fesm2022/weeehaoooz-talos-ui.mjs.map +1 -1
- package/package.json +20 -139
- package/styles/_breadcrumb.scss +16 -0
- package/styles/_button-group.scss +2 -1
- package/styles/_buttons.scss +51 -0
- package/styles/_dropdown.scss +438 -0
- package/styles/_form-controls.scss +13 -0
- package/styles/_progress-bar.scss +43 -0
- package/styles/_skeleton.scss +176 -0
- package/styles/_spinner.scss +58 -0
- package/styles/_variables.scss +33 -0
- package/styles/index.scss +6 -1
- package/types/weeehaoooz-talos-ui-button.d.ts +92 -0
- package/types/weeehaoooz-talos-ui-button.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-display.d.ts +1018 -0
- package/types/weeehaoooz-talos-ui-data-display.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-viz.d.ts +839 -0
- package/types/weeehaoooz-talos-ui-data-viz.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-dropdown.d.ts +187 -0
- package/types/weeehaoooz-talos-ui-dropdown.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-feedback.d.ts +1495 -0
- package/types/weeehaoooz-talos-ui-feedback.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form.d.ts +2639 -0
- package/types/weeehaoooz-talos-ui-form.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-layout.d.ts +851 -3
- package/types/weeehaoooz-talos-ui-layout.d.ts.map +1 -1
- package/types/weeehaoooz-talos-ui-nav.d.ts +1 -1
- package/types/weeehaoooz-talos-ui.d.ts +7148 -4629
- package/types/weeehaoooz-talos-ui.d.ts.map +1 -1
- package/fesm2022/weeehaoooz-talos-ui-button-button-group.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-button-button.mjs +0 -94
- package/fesm2022/weeehaoooz-talos-ui-button-button.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-data-display-badge.mjs +0 -233
- package/fesm2022/weeehaoooz-talos-ui-data-display-badge.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-data-display-data-grid.mjs +0 -1627
- package/fesm2022/weeehaoooz-talos-ui-data-display-data-grid.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-data-display-status-tag.mjs +0 -361
- package/fesm2022/weeehaoooz-talos-ui-data-display-status-tag.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-data-display-timeline.mjs +0 -312
- package/fesm2022/weeehaoooz-talos-ui-data-display-timeline.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-data-display-trend-indicator.mjs +0 -235
- package/fesm2022/weeehaoooz-talos-ui-data-display-trend-indicator.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-data-viz-category-bar.mjs +0 -462
- package/fesm2022/weeehaoooz-talos-ui-data-viz-category-bar.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-data-viz-heatmap.mjs +0 -805
- package/fesm2022/weeehaoooz-talos-ui-data-viz-heatmap.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-data-viz-mini-donut.mjs +0 -267
- package/fesm2022/weeehaoooz-talos-ui-data-viz-mini-donut.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-data-viz-mini-gauge.mjs +0 -351
- package/fesm2022/weeehaoooz-talos-ui-data-viz-mini-gauge.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-data-viz-sparkline.mjs +0 -566
- package/fesm2022/weeehaoooz-talos-ui-data-viz-sparkline.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-feedback-alert.mjs +0 -534
- package/fesm2022/weeehaoooz-talos-ui-feedback-alert.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-feedback-dialog.mjs +0 -446
- package/fesm2022/weeehaoooz-talos-ui-feedback-dialog.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-feedback-snackbar.mjs +0 -376
- package/fesm2022/weeehaoooz-talos-ui-feedback-snackbar.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-feedback-tooltip.mjs +0 -147
- package/fesm2022/weeehaoooz-talos-ui-feedback-tooltip.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-affix.mjs +0 -242
- package/fesm2022/weeehaoooz-talos-ui-form-affix.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-autocomplete.mjs +0 -514
- package/fesm2022/weeehaoooz-talos-ui-form-autocomplete.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-checkbox.mjs +0 -548
- package/fesm2022/weeehaoooz-talos-ui-form-checkbox.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-chips.mjs +0 -692
- package/fesm2022/weeehaoooz-talos-ui-form-chips.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-color-picker.mjs +0 -761
- package/fesm2022/weeehaoooz-talos-ui-form-color-picker.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-date-picker.mjs +0 -896
- package/fesm2022/weeehaoooz-talos-ui-form-date-picker.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-date-range-picker.mjs +0 -872
- package/fesm2022/weeehaoooz-talos-ui-form-date-range-picker.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-date-time-picker.mjs +0 -119
- package/fesm2022/weeehaoooz-talos-ui-form-date-time-picker.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-date-time-range-picker.mjs +0 -135
- package/fesm2022/weeehaoooz-talos-ui-form-date-time-range-picker.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-drop-zone.mjs +0 -666
- package/fesm2022/weeehaoooz-talos-ui-form-drop-zone.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-form-field.mjs +0 -147
- package/fesm2022/weeehaoooz-talos-ui-form-form-field.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-input.mjs +0 -33
- package/fesm2022/weeehaoooz-talos-ui-form-input.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-otp.mjs +0 -455
- package/fesm2022/weeehaoooz-talos-ui-form-otp.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-password-input.mjs +0 -379
- package/fesm2022/weeehaoooz-talos-ui-form-password-input.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-radio.mjs +0 -297
- package/fesm2022/weeehaoooz-talos-ui-form-radio.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-range-input.mjs +0 -661
- package/fesm2022/weeehaoooz-talos-ui-form-range-input.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-rating.mjs +0 -346
- package/fesm2022/weeehaoooz-talos-ui-form-rating.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-select-input.mjs +0 -896
- package/fesm2022/weeehaoooz-talos-ui-form-select-input.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-slide-toggle.mjs +0 -252
- package/fesm2022/weeehaoooz-talos-ui-form-slide-toggle.mjs.map +0 -1
- package/fesm2022/weeehaoooz-talos-ui-form-transfer-list.mjs +0 -916
- package/fesm2022/weeehaoooz-talos-ui-form-transfer-list.mjs.map +0 -1
- package/types/weeehaoooz-talos-ui-button-button-group.d.ts +0 -62
- package/types/weeehaoooz-talos-ui-button-button-group.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-button-button.d.ts +0 -38
- package/types/weeehaoooz-talos-ui-button-button.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-data-display-badge.d.ts +0 -119
- package/types/weeehaoooz-talos-ui-data-display-badge.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-data-display-data-grid.d.ts +0 -272
- package/types/weeehaoooz-talos-ui-data-display-data-grid.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-data-display-status-tag.d.ts +0 -135
- package/types/weeehaoooz-talos-ui-data-display-status-tag.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-data-display-timeline.d.ts +0 -144
- package/types/weeehaoooz-talos-ui-data-display-timeline.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-data-display-trend-indicator.d.ts +0 -83
- package/types/weeehaoooz-talos-ui-data-display-trend-indicator.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-data-viz-category-bar.d.ts +0 -255
- package/types/weeehaoooz-talos-ui-data-viz-category-bar.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-data-viz-heatmap.d.ts +0 -204
- package/types/weeehaoooz-talos-ui-data-viz-heatmap.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-data-viz-mini-donut.d.ts +0 -101
- package/types/weeehaoooz-talos-ui-data-viz-mini-donut.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-data-viz-mini-gauge.d.ts +0 -138
- package/types/weeehaoooz-talos-ui-data-viz-mini-gauge.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-data-viz-sparkline.d.ts +0 -161
- package/types/weeehaoooz-talos-ui-data-viz-sparkline.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-feedback-alert.d.ts +0 -212
- package/types/weeehaoooz-talos-ui-feedback-alert.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-feedback-dialog.d.ts +0 -259
- package/types/weeehaoooz-talos-ui-feedback-dialog.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-feedback-snackbar.d.ts +0 -147
- package/types/weeehaoooz-talos-ui-feedback-snackbar.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-feedback-tooltip.d.ts +0 -32
- package/types/weeehaoooz-talos-ui-feedback-tooltip.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-affix.d.ts +0 -88
- package/types/weeehaoooz-talos-ui-form-affix.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-autocomplete.d.ts +0 -113
- package/types/weeehaoooz-talos-ui-form-autocomplete.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-checkbox.d.ts +0 -165
- package/types/weeehaoooz-talos-ui-form-checkbox.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-chips.d.ts +0 -152
- package/types/weeehaoooz-talos-ui-form-chips.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-color-picker.d.ts +0 -144
- package/types/weeehaoooz-talos-ui-form-color-picker.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-date-picker.d.ts +0 -138
- package/types/weeehaoooz-talos-ui-form-date-picker.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-date-range-picker.d.ts +0 -148
- package/types/weeehaoooz-talos-ui-form-date-range-picker.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-date-time-picker.d.ts +0 -44
- package/types/weeehaoooz-talos-ui-form-date-time-picker.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-date-time-range-picker.d.ts +0 -48
- package/types/weeehaoooz-talos-ui-form-date-time-range-picker.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-drop-zone.d.ts +0 -227
- package/types/weeehaoooz-talos-ui-form-drop-zone.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-form-field.d.ts +0 -42
- package/types/weeehaoooz-talos-ui-form-form-field.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-input.d.ts +0 -15
- package/types/weeehaoooz-talos-ui-form-input.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-otp.d.ts +0 -111
- package/types/weeehaoooz-talos-ui-form-otp.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-password-input.d.ts +0 -145
- package/types/weeehaoooz-talos-ui-form-password-input.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-radio.d.ts +0 -84
- package/types/weeehaoooz-talos-ui-form-radio.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-range-input.d.ts +0 -181
- package/types/weeehaoooz-talos-ui-form-range-input.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-rating.d.ts +0 -110
- package/types/weeehaoooz-talos-ui-form-rating.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-select-input.d.ts +0 -195
- package/types/weeehaoooz-talos-ui-form-select-input.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-slide-toggle.d.ts +0 -79
- package/types/weeehaoooz-talos-ui-form-slide-toggle.d.ts.map +0 -1
- package/types/weeehaoooz-talos-ui-form-transfer-list.d.ts +0 -192
- package/types/weeehaoooz-talos-ui-form-transfer-list.d.ts.map +0 -1
|
@@ -1,666 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, input, output, signal, Directive, model, computed, forwardRef, ViewChild, Component, NgModule } from '@angular/core';
|
|
3
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
-
import { NgTemplateOutlet } from '@angular/common';
|
|
5
|
-
|
|
6
|
-
class TalosFileDropDirective {
|
|
7
|
-
elementRef = inject(ElementRef);
|
|
8
|
-
/** Whether the drop target is disabled */
|
|
9
|
-
disabled = input(false, /* @ts-ignore */
|
|
10
|
-
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
11
|
-
/** Signal emitting when files are dropped onto the element */
|
|
12
|
-
fileDrop = output();
|
|
13
|
-
/** Signal emitting when a drag enters the element */
|
|
14
|
-
dragOver = output();
|
|
15
|
-
/** Signal emitting when a drag leaves the element */
|
|
16
|
-
dragLeave = output();
|
|
17
|
-
/** Internal signal tracking active drag over state */
|
|
18
|
-
isDragOver = signal(false, /* @ts-ignore */
|
|
19
|
-
...(ngDevMode ? [{ debugName: "isDragOver" }] : /* istanbul ignore next */ []));
|
|
20
|
-
/** Counter to handle dragenter/dragleave transitions between child elements */
|
|
21
|
-
dragCounter = 0;
|
|
22
|
-
onDragOver(event) {
|
|
23
|
-
if (this.disabled())
|
|
24
|
-
return;
|
|
25
|
-
event.preventDefault();
|
|
26
|
-
event.stopPropagation();
|
|
27
|
-
if (event.dataTransfer) {
|
|
28
|
-
event.dataTransfer.dropEffect = 'copy';
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
onDragEnter(event) {
|
|
32
|
-
if (this.disabled())
|
|
33
|
-
return;
|
|
34
|
-
event.preventDefault();
|
|
35
|
-
event.stopPropagation();
|
|
36
|
-
this.dragCounter++;
|
|
37
|
-
if (this.dragCounter === 1) {
|
|
38
|
-
this.isDragOver.set(true);
|
|
39
|
-
this.dragOver.emit(event);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
onDragLeave(event) {
|
|
43
|
-
if (this.disabled())
|
|
44
|
-
return;
|
|
45
|
-
event.preventDefault();
|
|
46
|
-
event.stopPropagation();
|
|
47
|
-
this.dragCounter--;
|
|
48
|
-
if (this.dragCounter <= 0) {
|
|
49
|
-
this.dragCounter = 0;
|
|
50
|
-
this.isDragOver.set(false);
|
|
51
|
-
this.dragLeave.emit(event);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
onDrop(event) {
|
|
55
|
-
if (this.disabled())
|
|
56
|
-
return;
|
|
57
|
-
event.preventDefault();
|
|
58
|
-
event.stopPropagation();
|
|
59
|
-
this.dragCounter = 0;
|
|
60
|
-
this.isDragOver.set(false);
|
|
61
|
-
const dataTransfer = event.dataTransfer;
|
|
62
|
-
if (!dataTransfer || !dataTransfer.files || dataTransfer.files.length === 0) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const files = Array.from(dataTransfer.files);
|
|
66
|
-
this.fileDrop.emit(files);
|
|
67
|
-
}
|
|
68
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosFileDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
69
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.1", type: TalosFileDropDirective, isStandalone: true, selector: "[talosFileDrop], [talos-file-drop]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fileDrop: "fileDrop", dragOver: "dragOver", dragLeave: "dragLeave" }, host: { listeners: { "dragover": "onDragOver($event)", "dragenter": "onDragEnter($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "class.is-drag-over": "isDragOver()", "class.is-disabled": "disabled()" }, classAttribute: "talos-file-drop-target" }, ngImport: i0 });
|
|
70
|
-
}
|
|
71
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosFileDropDirective, decorators: [{
|
|
72
|
-
type: Directive,
|
|
73
|
-
args: [{
|
|
74
|
-
selector: '[talosFileDrop], [talos-file-drop]',
|
|
75
|
-
host: {
|
|
76
|
-
'class': 'talos-file-drop-target',
|
|
77
|
-
'[class.is-drag-over]': 'isDragOver()',
|
|
78
|
-
'[class.is-disabled]': 'disabled()',
|
|
79
|
-
'(dragover)': 'onDragOver($event)',
|
|
80
|
-
'(dragenter)': 'onDragEnter($event)',
|
|
81
|
-
'(dragleave)': 'onDragLeave($event)',
|
|
82
|
-
'(drop)': 'onDrop($event)'
|
|
83
|
-
}
|
|
84
|
-
}]
|
|
85
|
-
}], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], fileDrop: [{ type: i0.Output, args: ["fileDrop"] }], dragOver: [{ type: i0.Output, args: ["dragOver"] }], dragLeave: [{ type: i0.Output, args: ["dragLeave"] }] } });
|
|
86
|
-
|
|
87
|
-
let uniqueDropZoneIdCounter = 0;
|
|
88
|
-
class TalosDropZoneComponent {
|
|
89
|
-
elementRef = inject(ElementRef);
|
|
90
|
-
// --- Signal Inputs ---
|
|
91
|
-
/** Accepted file types / extensions (e.g. "image/*", ".pdf,.docx", "image/png,image/jpeg") */
|
|
92
|
-
accept = input('', /* @ts-ignore */
|
|
93
|
-
...(ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []));
|
|
94
|
-
/** Allow selecting multiple files */
|
|
95
|
-
multiple = input(true, /* @ts-ignore */
|
|
96
|
-
...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
97
|
-
/** Maximum file size in bytes or human-readable string (e.g. 5242880 or '5MB') */
|
|
98
|
-
maxFileSize = input(null, /* @ts-ignore */
|
|
99
|
-
...(ngDevMode ? [{ debugName: "maxFileSize" }] : /* istanbul ignore next */ []));
|
|
100
|
-
/** Minimum file size in bytes or human-readable string (e.g. 1024 or '1KB') */
|
|
101
|
-
minFileSize = input(null, /* @ts-ignore */
|
|
102
|
-
...(ngDevMode ? [{ debugName: "minFileSize" }] : /* istanbul ignore next */ []));
|
|
103
|
-
/** Maximum total number of files allowed */
|
|
104
|
-
maxFiles = input(null, /* @ts-ignore */
|
|
105
|
-
...(ngDevMode ? [{ debugName: "maxFiles" }] : /* istanbul ignore next */ []));
|
|
106
|
-
/** Disable user interactions */
|
|
107
|
-
disabled = input(false, /* @ts-ignore */
|
|
108
|
-
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
109
|
-
/** Make drop zone read-only */
|
|
110
|
-
readonly = input(false, /* @ts-ignore */
|
|
111
|
-
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
112
|
-
/** Display loading / processing spinner */
|
|
113
|
-
loading = input(false, /* @ts-ignore */
|
|
114
|
-
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
115
|
-
/** Layout visual variant */
|
|
116
|
-
variant = input('default', /* @ts-ignore */
|
|
117
|
-
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
118
|
-
/** Sizing variant */
|
|
119
|
-
size = input('md', /* @ts-ignore */
|
|
120
|
-
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
121
|
-
/** Primary title displayed in the drop zone */
|
|
122
|
-
title = input('Choose a file or drag & drop it here', /* @ts-ignore */
|
|
123
|
-
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
124
|
-
/** Subtitle / hint text displayed below the title */
|
|
125
|
-
subTitle = input('JPEG, PNG, PDF, and DOC formats, up to 50 MB', /* @ts-ignore */
|
|
126
|
-
...(ngDevMode ? [{ debugName: "subTitle" }] : /* istanbul ignore next */ []));
|
|
127
|
-
/** Text label for the browse button/link */
|
|
128
|
-
browseLabel = input('Browse file', /* @ts-ignore */
|
|
129
|
-
...(ngDevMode ? [{ debugName: "browseLabel" }] : /* istanbul ignore next */ []));
|
|
130
|
-
/** Secondary bottom helper text or error message */
|
|
131
|
-
hint = input('', /* @ts-ignore */
|
|
132
|
-
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
133
|
-
/** Whether to render the built-in staged file list preview */
|
|
134
|
-
showFileList = input(true, /* @ts-ignore */
|
|
135
|
-
...(ngDevMode ? [{ debugName: "showFileList" }] : /* istanbul ignore next */ []));
|
|
136
|
-
/** Automatically manage staged files in internal state when dropped/selected */
|
|
137
|
-
autoManageFiles = input(true, /* @ts-ignore */
|
|
138
|
-
...(ngDevMode ? [{ debugName: "autoManageFiles" }] : /* istanbul ignore next */ []));
|
|
139
|
-
/** Automatically generate object URL thumbnails for image files */
|
|
140
|
-
autoGeneratePreviews = input(true, /* @ts-ignore */
|
|
141
|
-
...(ngDevMode ? [{ debugName: "autoGeneratePreviews" }] : /* istanbul ignore next */ []));
|
|
142
|
-
/** Allow removing staged files */
|
|
143
|
-
removable = input(true, /* @ts-ignore */
|
|
144
|
-
...(ngDevMode ? [{ debugName: "removable" }] : /* istanbul ignore next */ []));
|
|
145
|
-
/** Allow retrying failed uploads */
|
|
146
|
-
allowRetry = input(true, /* @ts-ignore */
|
|
147
|
-
...(ngDevMode ? [{ debugName: "allowRetry" }] : /* istanbul ignore next */ []));
|
|
148
|
-
/** Custom validator function for individual files */
|
|
149
|
-
validator = input(null, /* @ts-ignore */
|
|
150
|
-
...(ngDevMode ? [{ debugName: "validator" }] : /* istanbul ignore next */ []));
|
|
151
|
-
/** Custom template for rendering staged file list items */
|
|
152
|
-
itemTemplate = input(null, /* @ts-ignore */
|
|
153
|
-
...(ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []));
|
|
154
|
-
/** Custom template for rendering drop zone inner content */
|
|
155
|
-
contentTemplate = input(null, /* @ts-ignore */
|
|
156
|
-
...(ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []));
|
|
157
|
-
/** Component DOM ID */
|
|
158
|
-
id = input('', /* @ts-ignore */
|
|
159
|
-
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
160
|
-
/** Form control name */
|
|
161
|
-
name = input('', /* @ts-ignore */
|
|
162
|
-
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
163
|
-
// --- Two-way Model Signal ---
|
|
164
|
-
/** Staged / uploaded files model */
|
|
165
|
-
files = model([], /* @ts-ignore */
|
|
166
|
-
...(ngDevMode ? [{ debugName: "files" }] : /* istanbul ignore next */ []));
|
|
167
|
-
// --- Signal Outputs ---
|
|
168
|
-
/** Emitted with raw native File objects */
|
|
169
|
-
rawFilesChange = output();
|
|
170
|
-
/** Emitted when files are dropped */
|
|
171
|
-
fileDrop = output();
|
|
172
|
-
/** Emitted when files are selected via native file dialog */
|
|
173
|
-
fileSelect = output();
|
|
174
|
-
/** Emitted when a file is removed */
|
|
175
|
-
fileRemove = output();
|
|
176
|
-
/** Emitted when a file retry button is clicked */
|
|
177
|
-
fileRetry = output();
|
|
178
|
-
/** Emitted when files fail validation */
|
|
179
|
-
rejected = output();
|
|
180
|
-
/** Emitted when drag over state changes */
|
|
181
|
-
dragStateChange = output();
|
|
182
|
-
/** Emitted with full change event payload */
|
|
183
|
-
change = output();
|
|
184
|
-
// --- View Children ---
|
|
185
|
-
fileInput;
|
|
186
|
-
// --- IDs & Internal Signals ---
|
|
187
|
-
autoId = `talos-dropzone-${uniqueDropZoneIdCounter++}`;
|
|
188
|
-
componentId = computed(() => this.id() || this.autoId, /* @ts-ignore */
|
|
189
|
-
...(ngDevMode ? [{ debugName: "componentId" }] : /* istanbul ignore next */ []));
|
|
190
|
-
inputId = computed(() => `${this.componentId()}-input`, /* @ts-ignore */
|
|
191
|
-
...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
|
|
192
|
-
isDragOver = signal(false, /* @ts-ignore */
|
|
193
|
-
...(ngDevMode ? [{ debugName: "isDragOver" }] : /* istanbul ignore next */ []));
|
|
194
|
-
isDisabled = signal(false, /* @ts-ignore */
|
|
195
|
-
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
196
|
-
isTouched = signal(false, /* @ts-ignore */
|
|
197
|
-
...(ngDevMode ? [{ debugName: "isTouched" }] : /* istanbul ignore next */ []));
|
|
198
|
-
// --- Computed States ---
|
|
199
|
-
effectiveDisabled = computed(() => this.disabled() || this.isDisabled() || this.readonly(), /* @ts-ignore */
|
|
200
|
-
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
201
|
-
maxSizeBytes = computed(() => this.parseByteSize(this.maxFileSize()), /* @ts-ignore */
|
|
202
|
-
...(ngDevMode ? [{ debugName: "maxSizeBytes" }] : /* istanbul ignore next */ []));
|
|
203
|
-
minSizeBytes = computed(() => this.parseByteSize(this.minFileSize()), /* @ts-ignore */
|
|
204
|
-
...(ngDevMode ? [{ debugName: "minSizeBytes" }] : /* istanbul ignore next */ []));
|
|
205
|
-
hasFiles = computed(() => this.files().length > 0, /* @ts-ignore */
|
|
206
|
-
...(ngDevMode ? [{ debugName: "hasFiles" }] : /* istanbul ignore next */ []));
|
|
207
|
-
isMaxFilesReached = computed(() => {
|
|
208
|
-
const max = this.maxFiles();
|
|
209
|
-
if (max === null || max === undefined)
|
|
210
|
-
return false;
|
|
211
|
-
return this.files().length >= max;
|
|
212
|
-
}, /* @ts-ignore */
|
|
213
|
-
...(ngDevMode ? [{ debugName: "isMaxFilesReached" }] : /* istanbul ignore next */ []));
|
|
214
|
-
// --- ControlValueAccessor Callbacks ---
|
|
215
|
-
onChange = () => { };
|
|
216
|
-
onTouched = () => { };
|
|
217
|
-
// --- ControlValueAccessor Implementation ---
|
|
218
|
-
writeValue(value) {
|
|
219
|
-
if (value === null || value === undefined) {
|
|
220
|
-
this.files.set([]);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
if (Array.isArray(value)) {
|
|
224
|
-
const parsedFiles = value.map((item, idx) => {
|
|
225
|
-
if (item instanceof File) {
|
|
226
|
-
return this.createDropZoneFile(item, `file-${idx}`);
|
|
227
|
-
}
|
|
228
|
-
return item;
|
|
229
|
-
});
|
|
230
|
-
this.files.set(parsedFiles);
|
|
231
|
-
}
|
|
232
|
-
else if (value instanceof File) {
|
|
233
|
-
this.files.set([this.createDropZoneFile(value, 'file-0')]);
|
|
234
|
-
}
|
|
235
|
-
else if (typeof value === 'object' && 'file' in value) {
|
|
236
|
-
this.files.set([value]);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
registerOnChange(fn) {
|
|
240
|
-
this.onChange = fn;
|
|
241
|
-
}
|
|
242
|
-
registerOnTouched(fn) {
|
|
243
|
-
this.onTouched = fn;
|
|
244
|
-
}
|
|
245
|
-
setDisabledState(isDisabled) {
|
|
246
|
-
this.isDisabled.set(isDisabled);
|
|
247
|
-
}
|
|
248
|
-
// --- Public / Interaction Methods ---
|
|
249
|
-
/**
|
|
250
|
-
* Opens the native file selector dialog.
|
|
251
|
-
*/
|
|
252
|
-
openFileDialog() {
|
|
253
|
-
if (this.effectiveDisabled() || this.isMaxFilesReached())
|
|
254
|
-
return;
|
|
255
|
-
if (this.fileInput) {
|
|
256
|
-
// Reset input value to allow selecting the same file again
|
|
257
|
-
this.fileInput.nativeElement.value = '';
|
|
258
|
-
this.fileInput.nativeElement.click();
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Keyboard handler on the drop zone container (Enter / Space to open browse dialog)
|
|
263
|
-
*/
|
|
264
|
-
onKeyDown(event) {
|
|
265
|
-
if (this.effectiveDisabled())
|
|
266
|
-
return;
|
|
267
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
268
|
-
event.preventDefault();
|
|
269
|
-
this.openFileDialog();
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Native file input change handler
|
|
274
|
-
*/
|
|
275
|
-
onNativeInputChange(event) {
|
|
276
|
-
if (this.effectiveDisabled())
|
|
277
|
-
return;
|
|
278
|
-
const input = event.target;
|
|
279
|
-
if (!input.files || input.files.length === 0)
|
|
280
|
-
return;
|
|
281
|
-
const files = Array.from(input.files);
|
|
282
|
-
this.fileSelect.emit(files);
|
|
283
|
-
this.processFiles(files);
|
|
284
|
-
this.markAsTouched();
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Handles files dropped onto the dropzone
|
|
288
|
-
*/
|
|
289
|
-
onDropFiles(droppedFiles) {
|
|
290
|
-
if (this.effectiveDisabled())
|
|
291
|
-
return;
|
|
292
|
-
this.fileDrop.emit(droppedFiles);
|
|
293
|
-
this.processFiles(droppedFiles);
|
|
294
|
-
this.markAsTouched();
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Updates drag over state
|
|
298
|
-
*/
|
|
299
|
-
onDragState(isOver) {
|
|
300
|
-
if (this.effectiveDisabled())
|
|
301
|
-
return;
|
|
302
|
-
this.isDragOver.set(isOver);
|
|
303
|
-
this.dragStateChange.emit(isOver);
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Removes a file from the staged list
|
|
307
|
-
*/
|
|
308
|
-
removeFile(dropFile, event) {
|
|
309
|
-
if (event) {
|
|
310
|
-
event.stopPropagation();
|
|
311
|
-
event.preventDefault();
|
|
312
|
-
}
|
|
313
|
-
if (this.effectiveDisabled() || !this.removable())
|
|
314
|
-
return;
|
|
315
|
-
// Revoke preview URL if created
|
|
316
|
-
if (dropFile.previewUrl && dropFile.previewUrl.startsWith('blob:')) {
|
|
317
|
-
URL.revokeObjectURL(dropFile.previewUrl);
|
|
318
|
-
}
|
|
319
|
-
const updated = this.files().filter((f) => f.id !== dropFile.id);
|
|
320
|
-
this.files.set(updated);
|
|
321
|
-
this.fileRemove.emit(dropFile);
|
|
322
|
-
this.emitChanges(updated);
|
|
323
|
-
this.markAsTouched();
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Retries uploading a file
|
|
327
|
-
*/
|
|
328
|
-
retryFile(dropFile, event) {
|
|
329
|
-
if (event) {
|
|
330
|
-
event.stopPropagation();
|
|
331
|
-
event.preventDefault();
|
|
332
|
-
}
|
|
333
|
-
if (this.effectiveDisabled() || !this.allowRetry())
|
|
334
|
-
return;
|
|
335
|
-
// Update status to pending
|
|
336
|
-
const updated = this.files().map((f) => {
|
|
337
|
-
if (f.id === dropFile.id) {
|
|
338
|
-
return { ...f, status: 'pending', errorMessage: undefined, progress: 0 };
|
|
339
|
-
}
|
|
340
|
-
return f;
|
|
341
|
-
});
|
|
342
|
-
this.files.set(updated);
|
|
343
|
-
this.fileRetry.emit(dropFile);
|
|
344
|
-
this.emitChanges(updated);
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Updates the progress or status of a staged file programmatically.
|
|
348
|
-
*/
|
|
349
|
-
updateFileProgress(fileId, progress, status, errorMessage) {
|
|
350
|
-
const updated = this.files().map((f) => {
|
|
351
|
-
if (f.id === fileId) {
|
|
352
|
-
return {
|
|
353
|
-
...f,
|
|
354
|
-
progress: Math.min(100, Math.max(0, progress)),
|
|
355
|
-
status: status ?? (progress >= 100 ? 'success' : 'uploading'),
|
|
356
|
-
errorMessage
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
return f;
|
|
360
|
-
});
|
|
361
|
-
this.files.set(updated);
|
|
362
|
-
this.emitChanges(updated);
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Clear all files from the drop zone.
|
|
366
|
-
*/
|
|
367
|
-
clearFiles() {
|
|
368
|
-
// Revoke preview URLs
|
|
369
|
-
for (const f of this.files()) {
|
|
370
|
-
if (f.previewUrl && f.previewUrl.startsWith('blob:')) {
|
|
371
|
-
URL.revokeObjectURL(f.previewUrl);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
this.files.set([]);
|
|
375
|
-
this.emitChanges([]);
|
|
376
|
-
this.markAsTouched();
|
|
377
|
-
}
|
|
378
|
-
// --- Processing & Validation ---
|
|
379
|
-
processFiles(rawFiles) {
|
|
380
|
-
if (!rawFiles || rawFiles.length === 0)
|
|
381
|
-
return;
|
|
382
|
-
const currentFiles = this.files();
|
|
383
|
-
const accepted = [];
|
|
384
|
-
const rejections = [];
|
|
385
|
-
const isMultiple = this.multiple();
|
|
386
|
-
const maxFilesAllowed = this.maxFiles();
|
|
387
|
-
// If single mode, replace existing or take only the first file
|
|
388
|
-
const targetFiles = isMultiple ? rawFiles : [rawFiles[0]];
|
|
389
|
-
for (const file of targetFiles) {
|
|
390
|
-
// Check total count constraint
|
|
391
|
-
const simulatedCount = isMultiple ? currentFiles.length + accepted.length : accepted.length;
|
|
392
|
-
if (maxFilesAllowed !== null && maxFilesAllowed !== undefined && simulatedCount >= maxFilesAllowed) {
|
|
393
|
-
rejections.push({
|
|
394
|
-
file,
|
|
395
|
-
reason: 'MAX_FILES_EXCEEDED',
|
|
396
|
-
message: `Maximum allowed number of files (${maxFilesAllowed}) reached.`
|
|
397
|
-
});
|
|
398
|
-
continue;
|
|
399
|
-
}
|
|
400
|
-
// Check file validation
|
|
401
|
-
const validation = this.validateFile(file);
|
|
402
|
-
if (!validation.valid && validation.rejection) {
|
|
403
|
-
rejections.push(validation.rejection);
|
|
404
|
-
continue;
|
|
405
|
-
}
|
|
406
|
-
const dropZoneFile = this.createDropZoneFile(file);
|
|
407
|
-
accepted.push(dropZoneFile);
|
|
408
|
-
}
|
|
409
|
-
if (rejections.length > 0) {
|
|
410
|
-
this.rejected.emit(rejections);
|
|
411
|
-
}
|
|
412
|
-
if (accepted.length > 0 && this.autoManageFiles()) {
|
|
413
|
-
let nextFiles;
|
|
414
|
-
if (isMultiple) {
|
|
415
|
-
nextFiles = [...currentFiles, ...accepted];
|
|
416
|
-
}
|
|
417
|
-
else {
|
|
418
|
-
// Clear previous previews if replacing
|
|
419
|
-
for (const f of currentFiles) {
|
|
420
|
-
if (f.previewUrl && f.previewUrl.startsWith('blob:')) {
|
|
421
|
-
URL.revokeObjectURL(f.previewUrl);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
nextFiles = accepted;
|
|
425
|
-
}
|
|
426
|
-
this.files.set(nextFiles);
|
|
427
|
-
this.emitChanges(nextFiles, rejections);
|
|
428
|
-
}
|
|
429
|
-
else if (rejections.length > 0) {
|
|
430
|
-
this.change.emit({
|
|
431
|
-
files: currentFiles,
|
|
432
|
-
rawFiles: currentFiles.map((f) => f.file),
|
|
433
|
-
rejected: rejections
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
validateFile(file) {
|
|
438
|
-
// 1. Accept filter check
|
|
439
|
-
const acceptStr = this.accept();
|
|
440
|
-
if (acceptStr && !this.checkAccept(file, acceptStr)) {
|
|
441
|
-
return {
|
|
442
|
-
valid: false,
|
|
443
|
-
rejection: {
|
|
444
|
-
file,
|
|
445
|
-
reason: 'INVALID_TYPE',
|
|
446
|
-
message: `File type "${file.type || 'unknown'}" is not supported.`
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
// 2. Max file size check
|
|
451
|
-
const maxBytes = this.maxSizeBytes();
|
|
452
|
-
if (maxBytes !== null && file.size > maxBytes) {
|
|
453
|
-
return {
|
|
454
|
-
valid: false,
|
|
455
|
-
rejection: {
|
|
456
|
-
file,
|
|
457
|
-
reason: 'FILE_TOO_LARGE',
|
|
458
|
-
message: `File size (${this.formatBytes(file.size)}) exceeds maximum limit of ${this.formatBytes(maxBytes)}.`
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
// 3. Min file size check
|
|
463
|
-
const minBytes = this.minSizeBytes();
|
|
464
|
-
if (minBytes !== null && file.size < minBytes) {
|
|
465
|
-
return {
|
|
466
|
-
valid: false,
|
|
467
|
-
rejection: {
|
|
468
|
-
file,
|
|
469
|
-
reason: 'FILE_TOO_SMALL',
|
|
470
|
-
message: `File size (${this.formatBytes(file.size)}) is smaller than minimum required ${this.formatBytes(minBytes)}.`
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
// 4. Custom validator check
|
|
475
|
-
const customVal = this.validator();
|
|
476
|
-
if (customVal) {
|
|
477
|
-
const errorMsg = customVal(file);
|
|
478
|
-
if (errorMsg) {
|
|
479
|
-
return {
|
|
480
|
-
valid: false,
|
|
481
|
-
rejection: {
|
|
482
|
-
file,
|
|
483
|
-
reason: 'CUSTOM_VALIDATION_FAILED',
|
|
484
|
-
message: errorMsg
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
return { valid: true };
|
|
490
|
-
}
|
|
491
|
-
checkAccept(file, accept) {
|
|
492
|
-
const rules = accept.split(',').map((r) => r.trim().toLowerCase());
|
|
493
|
-
const fileName = file.name.toLowerCase();
|
|
494
|
-
const fileType = file.type.toLowerCase();
|
|
495
|
-
for (const rule of rules) {
|
|
496
|
-
if (!rule)
|
|
497
|
-
continue;
|
|
498
|
-
if (rule.startsWith('.')) {
|
|
499
|
-
// Extension check (e.g. .pdf, .png)
|
|
500
|
-
if (fileName.endsWith(rule))
|
|
501
|
-
return true;
|
|
502
|
-
}
|
|
503
|
-
else if (rule.endsWith('/*')) {
|
|
504
|
-
// Wildcard MIME check (e.g. image/*, video/*, audio/*)
|
|
505
|
-
const prefix = rule.slice(0, -1); // "image/"
|
|
506
|
-
if (fileType.startsWith(prefix))
|
|
507
|
-
return true;
|
|
508
|
-
}
|
|
509
|
-
else if (fileType === rule) {
|
|
510
|
-
// Exact MIME check (e.g. application/pdf)
|
|
511
|
-
return true;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
return false;
|
|
515
|
-
}
|
|
516
|
-
createDropZoneFile(file, idPrefix = 'file') {
|
|
517
|
-
const id = `${idPrefix}-${Math.random().toString(36).substring(2, 9)}`;
|
|
518
|
-
let previewUrl;
|
|
519
|
-
if (this.autoGeneratePreviews() && file.type.startsWith('image/')) {
|
|
520
|
-
try {
|
|
521
|
-
previewUrl = URL.createObjectURL(file);
|
|
522
|
-
}
|
|
523
|
-
catch {
|
|
524
|
-
previewUrl = undefined;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
return {
|
|
528
|
-
id,
|
|
529
|
-
file,
|
|
530
|
-
name: file.name,
|
|
531
|
-
size: file.size,
|
|
532
|
-
type: file.type,
|
|
533
|
-
progress: 0,
|
|
534
|
-
status: 'pending',
|
|
535
|
-
previewUrl
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
emitChanges(updatedFiles, rejections = []) {
|
|
539
|
-
const raw = updatedFiles.map((f) => f.file);
|
|
540
|
-
this.rawFilesChange.emit(raw);
|
|
541
|
-
this.onChange(updatedFiles);
|
|
542
|
-
this.change.emit({
|
|
543
|
-
files: updatedFiles,
|
|
544
|
-
rawFiles: raw,
|
|
545
|
-
rejected: rejections
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
markAsTouched() {
|
|
549
|
-
if (!this.isTouched()) {
|
|
550
|
-
this.isTouched.set(true);
|
|
551
|
-
this.onTouched();
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
// --- Formatters & Helpers ---
|
|
555
|
-
parseByteSize(size) {
|
|
556
|
-
if (size === null || size === undefined || size === '')
|
|
557
|
-
return null;
|
|
558
|
-
if (typeof size === 'number')
|
|
559
|
-
return size;
|
|
560
|
-
const cleaned = size.trim().toUpperCase();
|
|
561
|
-
const match = cleaned.match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)?$/);
|
|
562
|
-
if (!match)
|
|
563
|
-
return null;
|
|
564
|
-
const num = parseFloat(match[1]);
|
|
565
|
-
const unit = match[2] || 'B';
|
|
566
|
-
const multipliers = {
|
|
567
|
-
B: 1,
|
|
568
|
-
KB: 1024,
|
|
569
|
-
MB: 1024 * 1024,
|
|
570
|
-
GB: 1024 * 1024 * 1024,
|
|
571
|
-
TB: 1024 * 1024 * 1024 * 1024
|
|
572
|
-
};
|
|
573
|
-
return Math.round(num * (multipliers[unit] || 1));
|
|
574
|
-
}
|
|
575
|
-
formatBytes(bytes, decimals = 1) {
|
|
576
|
-
if (bytes === 0)
|
|
577
|
-
return '0 B';
|
|
578
|
-
const k = 1024;
|
|
579
|
-
const dm = decimals < 0 ? 0 : decimals;
|
|
580
|
-
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
581
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
582
|
-
const formatted = parseFloat((bytes / Math.pow(k, i)).toFixed(dm));
|
|
583
|
-
return `${formatted} ${sizes[i]}`;
|
|
584
|
-
}
|
|
585
|
-
getFileTypeCategory(file) {
|
|
586
|
-
const type = file.type.toLowerCase();
|
|
587
|
-
const name = file.name.toLowerCase();
|
|
588
|
-
if (type.startsWith('image/') || /\.(png|jpg|jpeg|gif|webp|svg|bmp|ico)$/.test(name))
|
|
589
|
-
return 'image';
|
|
590
|
-
if (type === 'application/pdf' || name.endsWith('.pdf'))
|
|
591
|
-
return 'pdf';
|
|
592
|
-
if (type.includes('word') ||
|
|
593
|
-
type.includes('document') ||
|
|
594
|
-
type.includes('sheet') ||
|
|
595
|
-
type.includes('excel') ||
|
|
596
|
-
type.includes('presentation') ||
|
|
597
|
-
type.includes('powerpoint') ||
|
|
598
|
-
/\.(doc|docx|xls|xlsx|ppt|pptx|txt|rtf|csv)$/.test(name)) {
|
|
599
|
-
return 'doc';
|
|
600
|
-
}
|
|
601
|
-
if (type.includes('zip') || type.includes('compressed') || type.includes('tar') || /\.(zip|rar|7z|tar|gz)$/.test(name)) {
|
|
602
|
-
return 'archive';
|
|
603
|
-
}
|
|
604
|
-
if (type.startsWith('audio/') || /\.(mp3|wav|ogg|flac|m4a)$/.test(name))
|
|
605
|
-
return 'audio';
|
|
606
|
-
if (type.startsWith('video/') || /\.(mp4|webm|mkv|mov|avi)$/.test(name))
|
|
607
|
-
return 'video';
|
|
608
|
-
if (/\.(ts|js|json|html|css|scss|py|go|rs|java|c|cpp|sql|xml|yaml|yml)$/.test(name))
|
|
609
|
-
return 'code';
|
|
610
|
-
return 'generic';
|
|
611
|
-
}
|
|
612
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosDropZoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
613
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: TalosDropZoneComponent, isStandalone: true, selector: "talos-drop-zone, talos-file-upload", inputs: { accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, minFileSize: { classPropertyName: "minFileSize", publicName: "minFileSize", isSignal: true, isRequired: false, transformFunction: null }, maxFiles: { classPropertyName: "maxFiles", publicName: "maxFiles", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, subTitle: { classPropertyName: "subTitle", publicName: "subTitle", isSignal: true, isRequired: false, transformFunction: null }, browseLabel: { classPropertyName: "browseLabel", publicName: "browseLabel", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, showFileList: { classPropertyName: "showFileList", publicName: "showFileList", isSignal: true, isRequired: false, transformFunction: null }, autoManageFiles: { classPropertyName: "autoManageFiles", publicName: "autoManageFiles", isSignal: true, isRequired: false, transformFunction: null }, autoGeneratePreviews: { classPropertyName: "autoGeneratePreviews", publicName: "autoGeneratePreviews", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, allowRetry: { classPropertyName: "allowRetry", publicName: "allowRetry", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "validator", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null }, contentTemplate: { classPropertyName: "contentTemplate", publicName: "contentTemplate", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, files: { classPropertyName: "files", publicName: "files", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { files: "filesChange", rawFilesChange: "rawFilesChange", fileDrop: "fileDrop", fileSelect: "fileSelect", fileRemove: "fileRemove", fileRetry: "fileRetry", rejected: "rejected", dragStateChange: "dragStateChange", change: "change" }, host: { properties: { "class.is-disabled": "effectiveDisabled()", "class.is-readonly": "readonly()", "class.is-loading": "loading()", "class.is-drag-over": "isDragOver()", "class.variant-default": "variant() === \"default\"", "class.variant-compact": "variant() === \"compact\"", "class.variant-mini": "variant() === \"mini\"", "class.variant-card": "variant() === \"card\"", "class.size-sm": "size() === \"sm\"", "class.size-md": "size() === \"md\"", "class.size-lg": "size() === \"lg\"" }, classAttribute: "talos-drop-zone-host" }, providers: [
|
|
614
|
-
{
|
|
615
|
-
provide: NG_VALUE_ACCESSOR,
|
|
616
|
-
useExisting: forwardRef(() => TalosDropZoneComponent),
|
|
617
|
-
multi: true
|
|
618
|
-
}
|
|
619
|
-
], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<div\n class=\"talos-drop-zone-area\"\n talosFileDrop\n [disabled]=\"effectiveDisabled() || isMaxFilesReached()\"\n (fileDrop)=\"onDropFiles($event)\"\n (dragOver)=\"onDragState(true)\"\n (dragLeave)=\"onDragState(false)\"\n (click)=\"openFileDialog()\"\n (keydown)=\"onKeyDown($event)\"\n tabindex=\"0\"\n role=\"button\"\n [attr.aria-disabled]=\"effectiveDisabled() ? 'true' : null\"\n [attr.aria-label]=\"title()\"\n [attr.id]=\"componentId()\"\n>\n <!-- Hidden Native File Input -->\n <input\n #fileInput\n type=\"file\"\n class=\"talos-drop-zone-native-input\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name() || null\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"effectiveDisabled() || isMaxFilesReached()\"\n (change)=\"onNativeInputChange($event)\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n />\n\n <!-- Loading Overlay -->\n @if (loading()) {\n <div class=\"talos-drop-zone-loading-overlay\" aria-live=\"polite\" aria-busy=\"true\">\n <div class=\"talos-drop-zone-spinner\" aria-hidden=\"true\"></div>\n <span class=\"talos-drop-zone-loading-text\">Processing files...</span>\n </div>\n }\n\n <!-- Drop Zone Inner Content -->\n @if (contentTemplate()) {\n <ng-container [ngTemplateOutlet]=\"contentTemplate()!\" />\n } @else {\n <div class=\"talos-drop-zone-content\">\n <div class=\"talos-drop-zone-icon-wrapper\" aria-hidden=\"true\">\n <svg\n class=\"talos-drop-zone-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.8\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <path d=\"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242\" />\n <path d=\"M12 12v9\" />\n <path d=\"m16 16-4-4-4 4\" />\n </svg>\n </div>\n\n <div class=\"talos-drop-zone-text-group\">\n <div class=\"talos-drop-zone-title\">\n <span>{{ title() }}</span>\n @if (browseLabel()) {\n <span class=\"talos-drop-zone-browse-link\"> {{ browseLabel() }}</span>\n }\n </div>\n\n @if (subTitle()) {\n <p class=\"talos-drop-zone-subtitle\">{{ subTitle() }}</p>\n }\n </div>\n </div>\n }\n</div>\n\n<!-- Helper / Error Hint -->\n@if (hint()) {\n <div class=\"talos-drop-zone-hint\">\n {{ hint() }}\n </div>\n}\n\n<!-- Attached / Staged Files List Preview -->\n@if (showFileList() && hasFiles()) {\n <div class=\"talos-drop-zone-file-list\" aria-label=\"Attached files\">\n <div class=\"talos-drop-zone-file-list-header\">\n <span class=\"talos-drop-zone-file-list-title\">\n Attached files ({{ files().length }}{{ maxFiles() ? ' / ' + maxFiles() : '' }})\n </span>\n @if (removable() && !effectiveDisabled()) {\n <button\n type=\"button\"\n class=\"talos-drop-zone-clear-all-btn\"\n (click)=\"clearFiles()\"\n aria-label=\"Clear all attached files\"\n >\n Clear all\n </button>\n }\n </div>\n\n <div class=\"talos-drop-zone-files-grid\">\n @for (file of files(); track file.id; let idx = $index) {\n @if (itemTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()!\"\n [ngTemplateOutletContext]=\"{\n $implicit: file,\n index: idx,\n remove: removeFile.bind(this, file),\n retry: retryFile.bind(this, file)\n }\"\n />\n } @else {\n <div\n class=\"talos-drop-zone-file-item\"\n [class.status-pending]=\"file.status === 'pending'\"\n [class.status-uploading]=\"file.status === 'uploading'\"\n [class.status-success]=\"file.status === 'success'\"\n [class.status-error]=\"file.status === 'error'\"\n >\n <!-- Thumbnail or Icon -->\n <div class=\"talos-drop-zone-file-preview\" aria-hidden=\"true\">\n @if (file.previewUrl) {\n <img [src]=\"file.previewUrl\" [alt]=\"file.name\" class=\"talos-drop-zone-img-preview\" />\n } @else {\n @switch (getFileTypeCategory(file)) {\n @case ('pdf') {\n <div class=\"talos-drop-zone-type-badge type-pdf\">\n <span>PDF</span>\n </div>\n }\n @case ('doc') {\n <div class=\"talos-drop-zone-type-badge type-doc\">\n <span>DOC</span>\n </div>\n }\n @case ('archive') {\n <div class=\"talos-drop-zone-type-badge type-archive\">\n <span>ZIP</span>\n </div>\n }\n @case ('audio') {\n <div class=\"talos-drop-zone-type-badge type-audio\">\n <span>AUD</span>\n </div>\n }\n @case ('video') {\n <div class=\"talos-drop-zone-type-badge type-video\">\n <span>VID</span>\n </div>\n }\n @case ('code') {\n <div class=\"talos-drop-zone-type-badge type-code\">\n <span></></span>\n </div>\n }\n @default {\n <div class=\"talos-drop-zone-type-badge type-generic\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z\" />\n <polyline points=\"14 2 14 8 20 8\" />\n </svg>\n </div>\n }\n }\n }\n </div>\n\n <!-- File Info & Progress -->\n <div class=\"talos-drop-zone-file-meta\">\n <div class=\"talos-drop-zone-file-header\">\n <span class=\"talos-drop-zone-file-name\" [title]=\"file.name\">{{ file.name }}</span>\n <span class=\"talos-drop-zone-file-size\">{{ formatBytes(file.size) }}</span>\n </div>\n\n @if (file.status === 'uploading' && file.progress !== undefined) {\n <div class=\"talos-drop-zone-file-progress-bar\" role=\"progressbar\" [attr.aria-valuenow]=\"file.progress\" aria-valuemin=\"0\" aria-valuemax=\"100\">\n <div class=\"talos-drop-zone-file-progress-fill\" [style.width.%]=\"file.progress\"></div>\n </div>\n }\n\n @if (file.status === 'error' && file.errorMessage) {\n <div class=\"talos-drop-zone-file-error-msg\">\n {{ file.errorMessage }}\n </div>\n }\n </div>\n\n <!-- Status Indicator / Actions -->\n <div class=\"talos-drop-zone-file-actions\">\n @if (file.status === 'uploading') {\n <span class=\"talos-drop-zone-file-percent\">{{ file.progress }}%</span>\n }\n\n @if (file.status === 'success') {\n <span class=\"talos-drop-zone-status-icon status-success\" title=\"Uploaded successfully\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n </span>\n }\n\n @if (file.status === 'error' && allowRetry()) {\n <button\n type=\"button\"\n class=\"talos-drop-zone-action-btn btn-retry\"\n [attr.aria-label]=\"'Retry upload for ' + file.name\"\n (click)=\"retryFile(file, $event)\"\n title=\"Retry upload\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M21.5 2v6h-6M21.34 15.57a10 10 0 1 1-.57-8.38l5.67-5.67\" />\n </svg>\n </button>\n }\n\n @if (removable() && !effectiveDisabled()) {\n <button\n type=\"button\"\n class=\"talos-drop-zone-action-btn btn-remove\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n (click)=\"removeFile(file, $event)\"\n title=\"Remove file\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n }\n </div>\n </div>\n }\n }\n </div>\n </div>\n}\n", styles: [":host{display:block;width:100%;box-sizing:border-box;font-family:inherit}.talos-drop-zone-native-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.talos-drop-zone-area{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;padding:2rem 1.5rem;background-color:var(--talos-dropzone-bg, var(--talos-card-bg, #ffffff));border:2px dashed var(--talos-dropzone-border, var(--talos-border-color, #cbd5e1));border-radius:var(--talos-dropzone-radius, var(--talos-border-radius, .625rem));cursor:pointer;outline:none;box-sizing:border-box;text-align:center;-webkit-user-select:none;user-select:none;overflow:hidden;transition:border-color .2s cubic-bezier(.4,0,.2,1),background-color .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out}.talos-drop-zone-area:hover:not([aria-disabled=true]){border-color:var(--talos-dropzone-hover-border, var(--talos-border-hover, #64748b));background-color:var(--talos-dropzone-hover-bg, var(--talos-bg-subtle, #f8fafc))}.talos-drop-zone-area:hover:not([aria-disabled=true]) .talos-drop-zone-icon-wrapper{transform:translateY(-2px) scale(1.04);background-color:var(--talos-primary-light-hover, #dbeafe)}.talos-drop-zone-area:hover:not([aria-disabled=true]) .talos-drop-zone-browse-link{color:var(--talos-primary-hover, #1d4ed8);text-decoration:underline}.talos-drop-zone-area:focus-visible{border-color:var(--talos-primary-color, #2563eb);box-shadow:var(--talos-focus-ring, 0 0 0 3px rgba(37, 99, 235, .2))}.talos-drop-zone-area.is-drag-over{border-color:var(--talos-dropzone-drag-border, var(--talos-primary-color, #2563eb))!important;background-color:var(--talos-dropzone-drag-bg, var(--talos-primary-light, #eff6ff))!important;box-shadow:0 0 0 4px #2563eb26;border-style:solid}.talos-drop-zone-area.is-drag-over .talos-drop-zone-icon-wrapper{transform:scale(1.12);background-color:var(--talos-primary-color, #2563eb);color:#fff;box-shadow:0 4px 12px #2563eb47}.talos-drop-zone-area.is-drag-over .talos-drop-zone-icon-wrapper .talos-drop-zone-icon{color:#fff}.talos-drop-zone-area[aria-disabled=true]{cursor:not-allowed;opacity:.6;background-color:var(--talos-input-disabled-bg, var(--talos-bg-color, #f8fafc));border-color:var(--talos-input-disabled-border, #e2e8f0)}.talos-drop-zone-area[aria-disabled=true] .talos-drop-zone-browse-link{cursor:not-allowed;text-decoration:none}.talos-drop-zone-loading-overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.75rem;background-color:var(--talos-loading-overlay-bg, rgba(255, 255, 255, .85));-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);z-index:10;border-radius:inherit}.talos-drop-zone-loading-overlay .talos-drop-zone-spinner{width:1.75rem;height:1.75rem;border:2.5px solid var(--talos-border-color, #cbd5e1);border-top-color:var(--talos-primary-color, #2563eb);border-radius:50%;animation:talos-spin .75s linear infinite}.talos-drop-zone-loading-overlay .talos-drop-zone-loading-text{font-size:.8125rem;font-weight:500;color:var(--talos-text-color, #0f172a)}@keyframes talos-spin{to{transform:rotate(360deg)}}.talos-drop-zone-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.875rem;width:100%}.talos-drop-zone-icon-wrapper{display:flex;align-items:center;justify-content:center;width:3.25rem;height:3.25rem;border-radius:50%;background-color:var(--talos-primary-light, #eff6ff);color:var(--talos-dropzone-icon-color, var(--talos-primary-color, #2563eb));transition:all .2s cubic-bezier(.4,0,.2,1)}.talos-drop-zone-icon-wrapper .talos-drop-zone-icon{width:1.625rem;height:1.625rem;stroke-width:1.8}.talos-drop-zone-text-group{display:flex;flex-direction:column;align-items:center;gap:.25rem}.talos-drop-zone-title{font-size:.875rem;font-weight:600;color:var(--talos-dropzone-text, var(--talos-text-color, #0f172a));line-height:1.4}.talos-drop-zone-title .talos-drop-zone-browse-link{color:var(--talos-primary-color, #2563eb);font-weight:600;cursor:pointer;transition:color .15s ease}.talos-drop-zone-subtitle{font-size:.75rem;color:var(--talos-dropzone-subtext, var(--talos-text-muted, #64748b));margin:0;line-height:1.4}.talos-drop-zone-hint{font-size:.75rem;color:var(--talos-text-muted, #64748b);margin-top:.375rem;padding-left:.25rem}:host(.size-sm) .talos-drop-zone-area{padding:1.25rem 1rem}:host(.size-sm) .talos-drop-zone-icon-wrapper{width:2.5rem;height:2.5rem}:host(.size-sm) .talos-drop-zone-icon-wrapper .talos-drop-zone-icon{width:1.25rem;height:1.25rem}:host(.size-sm) .talos-drop-zone-title{font-size:.8125rem}:host(.size-sm) .talos-drop-zone-subtitle{font-size:.6875rem}:host(.size-lg) .talos-drop-zone-area{padding:2.75rem 2rem}:host(.size-lg) .talos-drop-zone-icon-wrapper{width:4rem;height:4rem}:host(.size-lg) .talos-drop-zone-icon-wrapper .talos-drop-zone-icon{width:2rem;height:2rem}:host(.size-lg) .talos-drop-zone-title{font-size:1rem}:host(.size-lg) .talos-drop-zone-subtitle{font-size:.8125rem}:host(.variant-compact) .talos-drop-zone-area{padding:1rem 1.25rem;flex-direction:row;justify-content:flex-start;text-align:left}:host(.variant-compact) .talos-drop-zone-content{flex-direction:row;align-items:center;justify-content:flex-start;gap:1rem}:host(.variant-compact) .talos-drop-zone-icon-wrapper{width:2.5rem;height:2.5rem;flex-shrink:0}:host(.variant-compact) .talos-drop-zone-icon-wrapper .talos-drop-zone-icon{width:1.25rem;height:1.25rem}:host(.variant-compact) .talos-drop-zone-text-group{align-items:flex-start;flex:1}:host(.variant-mini) .talos-drop-zone-area{padding:.625rem .875rem;flex-direction:row;justify-content:center}:host(.variant-mini) .talos-drop-zone-content{flex-direction:row;gap:.5rem}:host(.variant-mini) .talos-drop-zone-icon-wrapper{width:1.75rem;height:1.75rem;background:transparent}:host(.variant-mini) .talos-drop-zone-icon-wrapper .talos-drop-zone-icon{width:1.125rem;height:1.125rem}:host(.variant-mini) .talos-drop-zone-subtitle{display:none}:host(.variant-card) .talos-drop-zone-area{border-style:solid;border-width:1px;box-shadow:0 1px 3px #0000000d}:host(.variant-card) .talos-drop-zone-area:hover:not([aria-disabled=true]){box-shadow:0 4px 6px -1px #00000014,0 2px 4px -2px #0000000a}.talos-drop-zone-file-list{margin-top:1rem;display:flex;flex-direction:column;gap:.5rem}.talos-drop-zone-file-list-header{display:flex;align-items:center;justify-content:space-between;padding:0 .25rem}.talos-drop-zone-file-list-header .talos-drop-zone-file-list-title{font-size:.8125rem;font-weight:600;color:var(--talos-text-color, #0f172a)}.talos-drop-zone-file-list-header .talos-drop-zone-clear-all-btn{background:none;border:none;padding:.125rem .375rem;font-size:.75rem;font-weight:500;color:var(--talos-text-muted, #64748b);cursor:pointer;border-radius:var(--talos-border-radius, .25rem);transition:color .15s ease,background-color .15s ease}.talos-drop-zone-file-list-header .talos-drop-zone-clear-all-btn:hover{color:var(--talos-error-color, #ef4444);background-color:#ef444414}.talos-drop-zone-files-grid{display:flex;flex-direction:column;gap:.5rem}.talos-drop-zone-file-item{display:flex;align-items:center;gap:.75rem;padding:.625rem .875rem;background-color:var(--talos-dropzone-file-bg, var(--talos-card-bg, #ffffff));border:1px solid var(--talos-dropzone-file-border, var(--talos-border-color, #cbd5e1));border-radius:var(--talos-dropzone-radius, var(--talos-border-radius, .5rem));transition:border-color .15s ease,box-shadow .15s ease,transform .15s ease}.talos-drop-zone-file-item:hover{border-color:var(--talos-border-hover, #94a3b8);box-shadow:0 1px 3px #0000000a}.talos-drop-zone-file-item.status-error{border-color:var(--talos-error-color, #ef4444);background-color:#ef444405}.talos-drop-zone-file-item.status-success{border-color:var(--talos-border-color, #cbd5e1)}.talos-drop-zone-file-preview{display:flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;border-radius:.375rem;overflow:hidden;flex-shrink:0;background-color:var(--talos-bg-subtle, #f1f5f9)}.talos-drop-zone-file-preview .talos-drop-zone-img-preview{width:100%;height:100%;object-fit:cover;display:block}.talos-drop-zone-type-badge{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:.6875rem;font-weight:700;letter-spacing:.02em;border-radius:inherit}.talos-drop-zone-type-badge svg{width:1.25rem;height:1.25rem}.talos-drop-zone-type-badge.type-pdf{background-color:#fee2e2;color:#b91c1c}.talos-drop-zone-type-badge.type-doc{background-color:#dbeafe;color:#1d4ed8}.talos-drop-zone-type-badge.type-archive{background-color:#fef3c7;color:#b45309}.talos-drop-zone-type-badge.type-audio{background-color:#f3e8ff;color:#7e22ce}.talos-drop-zone-type-badge.type-video{background-color:#e0e7ff;color:#4338ca}.talos-drop-zone-type-badge.type-code{background-color:#d1fae5;color:#047857}.talos-drop-zone-type-badge.type-generic{background-color:var(--talos-bg-subtle, #f1f5f9);color:var(--talos-text-muted, #64748b)}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-pdf,:host-context(.dark) .talos-drop-zone-type-badge.type-pdf{background-color:#ef444433;color:#f87171}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-doc,:host-context(.dark) .talos-drop-zone-type-badge.type-doc{background-color:#3b82f633;color:#93c5fd}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-archive,:host-context(.dark) .talos-drop-zone-type-badge.type-archive{background-color:#f59e0b33;color:#fcd34d}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-audio,:host-context(.dark) .talos-drop-zone-type-badge.type-audio{background-color:#a855f733;color:#d8b4fe}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-video,:host-context(.dark) .talos-drop-zone-type-badge.type-video{background-color:#6366f133;color:#a5b4fc}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-code,:host-context(.dark) .talos-drop-zone-type-badge.type-code{background-color:#10b98133;color:#6ee7b7}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-generic,:host-context(.dark) .talos-drop-zone-type-badge.type-generic{background-color:#1f2937;color:#9ca3af}.talos-drop-zone-file-meta{flex:1;min-width:0;display:flex;flex-direction:column;gap:.25rem}.talos-drop-zone-file-header{display:flex;align-items:center;justify-content:space-between;gap:.5rem}.talos-drop-zone-file-name{font-size:.8125rem;font-weight:500;color:var(--talos-text-color, #0f172a);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.talos-drop-zone-file-size{font-size:.6875rem;color:var(--talos-text-muted, #64748b);white-space:nowrap}.talos-drop-zone-file-progress-bar{width:100%;height:.25rem;background-color:var(--talos-bg-subtle, #e2e8f0);border-radius:9999px;overflow:hidden;margin-top:.125rem}.talos-drop-zone-file-progress-fill{height:100%;background-color:var(--talos-primary-color, #2563eb);border-radius:inherit;transition:width .2s ease-out}.talos-drop-zone-file-error-msg{font-size:.6875rem;color:var(--talos-error-color, #ef4444);font-weight:500}.talos-drop-zone-file-actions{display:flex;align-items:center;gap:.375rem;flex-shrink:0}.talos-drop-zone-file-percent{font-size:.75rem;font-weight:600;color:var(--talos-primary-color, #2563eb)}.talos-drop-zone-status-icon{display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem}.talos-drop-zone-status-icon.status-success{color:var(--talos-success-color, #16a34a)}.talos-drop-zone-status-icon.status-success svg{width:1.125rem;height:1.125rem}.talos-drop-zone-action-btn{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.25rem;background:transparent;border:none;cursor:pointer;padding:0;transition:background-color .15s ease,color .15s ease,transform .1s ease}.talos-drop-zone-action-btn svg{width:1rem;height:1rem}.talos-drop-zone-action-btn.btn-remove{color:var(--talos-text-muted, #94a3b8)}.talos-drop-zone-action-btn.btn-remove:hover{color:var(--talos-error-color, #ef4444);background-color:#ef44441a}.talos-drop-zone-action-btn.btn-remove:active{transform:scale(.92)}.talos-drop-zone-action-btn.btn-retry{color:var(--talos-primary-color, #2563eb)}.talos-drop-zone-action-btn.btn-retry:hover{background-color:var(--talos-primary-light, #eff6ff)}.talos-drop-zone-action-btn.btn-retry:active{transform:scale(.92)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TalosFileDropDirective, selector: "[talosFileDrop], [talos-file-drop]", inputs: ["disabled"], outputs: ["fileDrop", "dragOver", "dragLeave"] }] });
|
|
620
|
-
}
|
|
621
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosDropZoneComponent, decorators: [{
|
|
622
|
-
type: Component,
|
|
623
|
-
args: [{ selector: 'talos-drop-zone, talos-file-upload', imports: [NgTemplateOutlet, TalosFileDropDirective], providers: [
|
|
624
|
-
{
|
|
625
|
-
provide: NG_VALUE_ACCESSOR,
|
|
626
|
-
useExisting: forwardRef(() => TalosDropZoneComponent),
|
|
627
|
-
multi: true
|
|
628
|
-
}
|
|
629
|
-
], host: {
|
|
630
|
-
'class': 'talos-drop-zone-host',
|
|
631
|
-
'[class.is-disabled]': 'effectiveDisabled()',
|
|
632
|
-
'[class.is-readonly]': 'readonly()',
|
|
633
|
-
'[class.is-loading]': 'loading()',
|
|
634
|
-
'[class.is-drag-over]': 'isDragOver()',
|
|
635
|
-
'[class.variant-default]': 'variant() === "default"',
|
|
636
|
-
'[class.variant-compact]': 'variant() === "compact"',
|
|
637
|
-
'[class.variant-mini]': 'variant() === "mini"',
|
|
638
|
-
'[class.variant-card]': 'variant() === "card"',
|
|
639
|
-
'[class.size-sm]': 'size() === "sm"',
|
|
640
|
-
'[class.size-md]': 'size() === "md"',
|
|
641
|
-
'[class.size-lg]': 'size() === "lg"'
|
|
642
|
-
}, template: "<div\n class=\"talos-drop-zone-area\"\n talosFileDrop\n [disabled]=\"effectiveDisabled() || isMaxFilesReached()\"\n (fileDrop)=\"onDropFiles($event)\"\n (dragOver)=\"onDragState(true)\"\n (dragLeave)=\"onDragState(false)\"\n (click)=\"openFileDialog()\"\n (keydown)=\"onKeyDown($event)\"\n tabindex=\"0\"\n role=\"button\"\n [attr.aria-disabled]=\"effectiveDisabled() ? 'true' : null\"\n [attr.aria-label]=\"title()\"\n [attr.id]=\"componentId()\"\n>\n <!-- Hidden Native File Input -->\n <input\n #fileInput\n type=\"file\"\n class=\"talos-drop-zone-native-input\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name() || null\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"effectiveDisabled() || isMaxFilesReached()\"\n (change)=\"onNativeInputChange($event)\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n />\n\n <!-- Loading Overlay -->\n @if (loading()) {\n <div class=\"talos-drop-zone-loading-overlay\" aria-live=\"polite\" aria-busy=\"true\">\n <div class=\"talos-drop-zone-spinner\" aria-hidden=\"true\"></div>\n <span class=\"talos-drop-zone-loading-text\">Processing files...</span>\n </div>\n }\n\n <!-- Drop Zone Inner Content -->\n @if (contentTemplate()) {\n <ng-container [ngTemplateOutlet]=\"contentTemplate()!\" />\n } @else {\n <div class=\"talos-drop-zone-content\">\n <div class=\"talos-drop-zone-icon-wrapper\" aria-hidden=\"true\">\n <svg\n class=\"talos-drop-zone-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.8\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <path d=\"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242\" />\n <path d=\"M12 12v9\" />\n <path d=\"m16 16-4-4-4 4\" />\n </svg>\n </div>\n\n <div class=\"talos-drop-zone-text-group\">\n <div class=\"talos-drop-zone-title\">\n <span>{{ title() }}</span>\n @if (browseLabel()) {\n <span class=\"talos-drop-zone-browse-link\"> {{ browseLabel() }}</span>\n }\n </div>\n\n @if (subTitle()) {\n <p class=\"talos-drop-zone-subtitle\">{{ subTitle() }}</p>\n }\n </div>\n </div>\n }\n</div>\n\n<!-- Helper / Error Hint -->\n@if (hint()) {\n <div class=\"talos-drop-zone-hint\">\n {{ hint() }}\n </div>\n}\n\n<!-- Attached / Staged Files List Preview -->\n@if (showFileList() && hasFiles()) {\n <div class=\"talos-drop-zone-file-list\" aria-label=\"Attached files\">\n <div class=\"talos-drop-zone-file-list-header\">\n <span class=\"talos-drop-zone-file-list-title\">\n Attached files ({{ files().length }}{{ maxFiles() ? ' / ' + maxFiles() : '' }})\n </span>\n @if (removable() && !effectiveDisabled()) {\n <button\n type=\"button\"\n class=\"talos-drop-zone-clear-all-btn\"\n (click)=\"clearFiles()\"\n aria-label=\"Clear all attached files\"\n >\n Clear all\n </button>\n }\n </div>\n\n <div class=\"talos-drop-zone-files-grid\">\n @for (file of files(); track file.id; let idx = $index) {\n @if (itemTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()!\"\n [ngTemplateOutletContext]=\"{\n $implicit: file,\n index: idx,\n remove: removeFile.bind(this, file),\n retry: retryFile.bind(this, file)\n }\"\n />\n } @else {\n <div\n class=\"talos-drop-zone-file-item\"\n [class.status-pending]=\"file.status === 'pending'\"\n [class.status-uploading]=\"file.status === 'uploading'\"\n [class.status-success]=\"file.status === 'success'\"\n [class.status-error]=\"file.status === 'error'\"\n >\n <!-- Thumbnail or Icon -->\n <div class=\"talos-drop-zone-file-preview\" aria-hidden=\"true\">\n @if (file.previewUrl) {\n <img [src]=\"file.previewUrl\" [alt]=\"file.name\" class=\"talos-drop-zone-img-preview\" />\n } @else {\n @switch (getFileTypeCategory(file)) {\n @case ('pdf') {\n <div class=\"talos-drop-zone-type-badge type-pdf\">\n <span>PDF</span>\n </div>\n }\n @case ('doc') {\n <div class=\"talos-drop-zone-type-badge type-doc\">\n <span>DOC</span>\n </div>\n }\n @case ('archive') {\n <div class=\"talos-drop-zone-type-badge type-archive\">\n <span>ZIP</span>\n </div>\n }\n @case ('audio') {\n <div class=\"talos-drop-zone-type-badge type-audio\">\n <span>AUD</span>\n </div>\n }\n @case ('video') {\n <div class=\"talos-drop-zone-type-badge type-video\">\n <span>VID</span>\n </div>\n }\n @case ('code') {\n <div class=\"talos-drop-zone-type-badge type-code\">\n <span></></span>\n </div>\n }\n @default {\n <div class=\"talos-drop-zone-type-badge type-generic\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z\" />\n <polyline points=\"14 2 14 8 20 8\" />\n </svg>\n </div>\n }\n }\n }\n </div>\n\n <!-- File Info & Progress -->\n <div class=\"talos-drop-zone-file-meta\">\n <div class=\"talos-drop-zone-file-header\">\n <span class=\"talos-drop-zone-file-name\" [title]=\"file.name\">{{ file.name }}</span>\n <span class=\"talos-drop-zone-file-size\">{{ formatBytes(file.size) }}</span>\n </div>\n\n @if (file.status === 'uploading' && file.progress !== undefined) {\n <div class=\"talos-drop-zone-file-progress-bar\" role=\"progressbar\" [attr.aria-valuenow]=\"file.progress\" aria-valuemin=\"0\" aria-valuemax=\"100\">\n <div class=\"talos-drop-zone-file-progress-fill\" [style.width.%]=\"file.progress\"></div>\n </div>\n }\n\n @if (file.status === 'error' && file.errorMessage) {\n <div class=\"talos-drop-zone-file-error-msg\">\n {{ file.errorMessage }}\n </div>\n }\n </div>\n\n <!-- Status Indicator / Actions -->\n <div class=\"talos-drop-zone-file-actions\">\n @if (file.status === 'uploading') {\n <span class=\"talos-drop-zone-file-percent\">{{ file.progress }}%</span>\n }\n\n @if (file.status === 'success') {\n <span class=\"talos-drop-zone-status-icon status-success\" title=\"Uploaded successfully\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n </span>\n }\n\n @if (file.status === 'error' && allowRetry()) {\n <button\n type=\"button\"\n class=\"talos-drop-zone-action-btn btn-retry\"\n [attr.aria-label]=\"'Retry upload for ' + file.name\"\n (click)=\"retryFile(file, $event)\"\n title=\"Retry upload\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M21.5 2v6h-6M21.34 15.57a10 10 0 1 1-.57-8.38l5.67-5.67\" />\n </svg>\n </button>\n }\n\n @if (removable() && !effectiveDisabled()) {\n <button\n type=\"button\"\n class=\"talos-drop-zone-action-btn btn-remove\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n (click)=\"removeFile(file, $event)\"\n title=\"Remove file\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n }\n </div>\n </div>\n }\n }\n </div>\n </div>\n}\n", styles: [":host{display:block;width:100%;box-sizing:border-box;font-family:inherit}.talos-drop-zone-native-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.talos-drop-zone-area{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;padding:2rem 1.5rem;background-color:var(--talos-dropzone-bg, var(--talos-card-bg, #ffffff));border:2px dashed var(--talos-dropzone-border, var(--talos-border-color, #cbd5e1));border-radius:var(--talos-dropzone-radius, var(--talos-border-radius, .625rem));cursor:pointer;outline:none;box-sizing:border-box;text-align:center;-webkit-user-select:none;user-select:none;overflow:hidden;transition:border-color .2s cubic-bezier(.4,0,.2,1),background-color .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out}.talos-drop-zone-area:hover:not([aria-disabled=true]){border-color:var(--talos-dropzone-hover-border, var(--talos-border-hover, #64748b));background-color:var(--talos-dropzone-hover-bg, var(--talos-bg-subtle, #f8fafc))}.talos-drop-zone-area:hover:not([aria-disabled=true]) .talos-drop-zone-icon-wrapper{transform:translateY(-2px) scale(1.04);background-color:var(--talos-primary-light-hover, #dbeafe)}.talos-drop-zone-area:hover:not([aria-disabled=true]) .talos-drop-zone-browse-link{color:var(--talos-primary-hover, #1d4ed8);text-decoration:underline}.talos-drop-zone-area:focus-visible{border-color:var(--talos-primary-color, #2563eb);box-shadow:var(--talos-focus-ring, 0 0 0 3px rgba(37, 99, 235, .2))}.talos-drop-zone-area.is-drag-over{border-color:var(--talos-dropzone-drag-border, var(--talos-primary-color, #2563eb))!important;background-color:var(--talos-dropzone-drag-bg, var(--talos-primary-light, #eff6ff))!important;box-shadow:0 0 0 4px #2563eb26;border-style:solid}.talos-drop-zone-area.is-drag-over .talos-drop-zone-icon-wrapper{transform:scale(1.12);background-color:var(--talos-primary-color, #2563eb);color:#fff;box-shadow:0 4px 12px #2563eb47}.talos-drop-zone-area.is-drag-over .talos-drop-zone-icon-wrapper .talos-drop-zone-icon{color:#fff}.talos-drop-zone-area[aria-disabled=true]{cursor:not-allowed;opacity:.6;background-color:var(--talos-input-disabled-bg, var(--talos-bg-color, #f8fafc));border-color:var(--talos-input-disabled-border, #e2e8f0)}.talos-drop-zone-area[aria-disabled=true] .talos-drop-zone-browse-link{cursor:not-allowed;text-decoration:none}.talos-drop-zone-loading-overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.75rem;background-color:var(--talos-loading-overlay-bg, rgba(255, 255, 255, .85));-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);z-index:10;border-radius:inherit}.talos-drop-zone-loading-overlay .talos-drop-zone-spinner{width:1.75rem;height:1.75rem;border:2.5px solid var(--talos-border-color, #cbd5e1);border-top-color:var(--talos-primary-color, #2563eb);border-radius:50%;animation:talos-spin .75s linear infinite}.talos-drop-zone-loading-overlay .talos-drop-zone-loading-text{font-size:.8125rem;font-weight:500;color:var(--talos-text-color, #0f172a)}@keyframes talos-spin{to{transform:rotate(360deg)}}.talos-drop-zone-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.875rem;width:100%}.talos-drop-zone-icon-wrapper{display:flex;align-items:center;justify-content:center;width:3.25rem;height:3.25rem;border-radius:50%;background-color:var(--talos-primary-light, #eff6ff);color:var(--talos-dropzone-icon-color, var(--talos-primary-color, #2563eb));transition:all .2s cubic-bezier(.4,0,.2,1)}.talos-drop-zone-icon-wrapper .talos-drop-zone-icon{width:1.625rem;height:1.625rem;stroke-width:1.8}.talos-drop-zone-text-group{display:flex;flex-direction:column;align-items:center;gap:.25rem}.talos-drop-zone-title{font-size:.875rem;font-weight:600;color:var(--talos-dropzone-text, var(--talos-text-color, #0f172a));line-height:1.4}.talos-drop-zone-title .talos-drop-zone-browse-link{color:var(--talos-primary-color, #2563eb);font-weight:600;cursor:pointer;transition:color .15s ease}.talos-drop-zone-subtitle{font-size:.75rem;color:var(--talos-dropzone-subtext, var(--talos-text-muted, #64748b));margin:0;line-height:1.4}.talos-drop-zone-hint{font-size:.75rem;color:var(--talos-text-muted, #64748b);margin-top:.375rem;padding-left:.25rem}:host(.size-sm) .talos-drop-zone-area{padding:1.25rem 1rem}:host(.size-sm) .talos-drop-zone-icon-wrapper{width:2.5rem;height:2.5rem}:host(.size-sm) .talos-drop-zone-icon-wrapper .talos-drop-zone-icon{width:1.25rem;height:1.25rem}:host(.size-sm) .talos-drop-zone-title{font-size:.8125rem}:host(.size-sm) .talos-drop-zone-subtitle{font-size:.6875rem}:host(.size-lg) .talos-drop-zone-area{padding:2.75rem 2rem}:host(.size-lg) .talos-drop-zone-icon-wrapper{width:4rem;height:4rem}:host(.size-lg) .talos-drop-zone-icon-wrapper .talos-drop-zone-icon{width:2rem;height:2rem}:host(.size-lg) .talos-drop-zone-title{font-size:1rem}:host(.size-lg) .talos-drop-zone-subtitle{font-size:.8125rem}:host(.variant-compact) .talos-drop-zone-area{padding:1rem 1.25rem;flex-direction:row;justify-content:flex-start;text-align:left}:host(.variant-compact) .talos-drop-zone-content{flex-direction:row;align-items:center;justify-content:flex-start;gap:1rem}:host(.variant-compact) .talos-drop-zone-icon-wrapper{width:2.5rem;height:2.5rem;flex-shrink:0}:host(.variant-compact) .talos-drop-zone-icon-wrapper .talos-drop-zone-icon{width:1.25rem;height:1.25rem}:host(.variant-compact) .talos-drop-zone-text-group{align-items:flex-start;flex:1}:host(.variant-mini) .talos-drop-zone-area{padding:.625rem .875rem;flex-direction:row;justify-content:center}:host(.variant-mini) .talos-drop-zone-content{flex-direction:row;gap:.5rem}:host(.variant-mini) .talos-drop-zone-icon-wrapper{width:1.75rem;height:1.75rem;background:transparent}:host(.variant-mini) .talos-drop-zone-icon-wrapper .talos-drop-zone-icon{width:1.125rem;height:1.125rem}:host(.variant-mini) .talos-drop-zone-subtitle{display:none}:host(.variant-card) .talos-drop-zone-area{border-style:solid;border-width:1px;box-shadow:0 1px 3px #0000000d}:host(.variant-card) .talos-drop-zone-area:hover:not([aria-disabled=true]){box-shadow:0 4px 6px -1px #00000014,0 2px 4px -2px #0000000a}.talos-drop-zone-file-list{margin-top:1rem;display:flex;flex-direction:column;gap:.5rem}.talos-drop-zone-file-list-header{display:flex;align-items:center;justify-content:space-between;padding:0 .25rem}.talos-drop-zone-file-list-header .talos-drop-zone-file-list-title{font-size:.8125rem;font-weight:600;color:var(--talos-text-color, #0f172a)}.talos-drop-zone-file-list-header .talos-drop-zone-clear-all-btn{background:none;border:none;padding:.125rem .375rem;font-size:.75rem;font-weight:500;color:var(--talos-text-muted, #64748b);cursor:pointer;border-radius:var(--talos-border-radius, .25rem);transition:color .15s ease,background-color .15s ease}.talos-drop-zone-file-list-header .talos-drop-zone-clear-all-btn:hover{color:var(--talos-error-color, #ef4444);background-color:#ef444414}.talos-drop-zone-files-grid{display:flex;flex-direction:column;gap:.5rem}.talos-drop-zone-file-item{display:flex;align-items:center;gap:.75rem;padding:.625rem .875rem;background-color:var(--talos-dropzone-file-bg, var(--talos-card-bg, #ffffff));border:1px solid var(--talos-dropzone-file-border, var(--talos-border-color, #cbd5e1));border-radius:var(--talos-dropzone-radius, var(--talos-border-radius, .5rem));transition:border-color .15s ease,box-shadow .15s ease,transform .15s ease}.talos-drop-zone-file-item:hover{border-color:var(--talos-border-hover, #94a3b8);box-shadow:0 1px 3px #0000000a}.talos-drop-zone-file-item.status-error{border-color:var(--talos-error-color, #ef4444);background-color:#ef444405}.talos-drop-zone-file-item.status-success{border-color:var(--talos-border-color, #cbd5e1)}.talos-drop-zone-file-preview{display:flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;border-radius:.375rem;overflow:hidden;flex-shrink:0;background-color:var(--talos-bg-subtle, #f1f5f9)}.talos-drop-zone-file-preview .talos-drop-zone-img-preview{width:100%;height:100%;object-fit:cover;display:block}.talos-drop-zone-type-badge{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:.6875rem;font-weight:700;letter-spacing:.02em;border-radius:inherit}.talos-drop-zone-type-badge svg{width:1.25rem;height:1.25rem}.talos-drop-zone-type-badge.type-pdf{background-color:#fee2e2;color:#b91c1c}.talos-drop-zone-type-badge.type-doc{background-color:#dbeafe;color:#1d4ed8}.talos-drop-zone-type-badge.type-archive{background-color:#fef3c7;color:#b45309}.talos-drop-zone-type-badge.type-audio{background-color:#f3e8ff;color:#7e22ce}.talos-drop-zone-type-badge.type-video{background-color:#e0e7ff;color:#4338ca}.talos-drop-zone-type-badge.type-code{background-color:#d1fae5;color:#047857}.talos-drop-zone-type-badge.type-generic{background-color:var(--talos-bg-subtle, #f1f5f9);color:var(--talos-text-muted, #64748b)}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-pdf,:host-context(.dark) .talos-drop-zone-type-badge.type-pdf{background-color:#ef444433;color:#f87171}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-doc,:host-context(.dark) .talos-drop-zone-type-badge.type-doc{background-color:#3b82f633;color:#93c5fd}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-archive,:host-context(.dark) .talos-drop-zone-type-badge.type-archive{background-color:#f59e0b33;color:#fcd34d}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-audio,:host-context(.dark) .talos-drop-zone-type-badge.type-audio{background-color:#a855f733;color:#d8b4fe}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-video,:host-context(.dark) .talos-drop-zone-type-badge.type-video{background-color:#6366f133;color:#a5b4fc}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-code,:host-context(.dark) .talos-drop-zone-type-badge.type-code{background-color:#10b98133;color:#6ee7b7}:host-context([data-theme=dark]) .talos-drop-zone-type-badge.type-generic,:host-context(.dark) .talos-drop-zone-type-badge.type-generic{background-color:#1f2937;color:#9ca3af}.talos-drop-zone-file-meta{flex:1;min-width:0;display:flex;flex-direction:column;gap:.25rem}.talos-drop-zone-file-header{display:flex;align-items:center;justify-content:space-between;gap:.5rem}.talos-drop-zone-file-name{font-size:.8125rem;font-weight:500;color:var(--talos-text-color, #0f172a);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.talos-drop-zone-file-size{font-size:.6875rem;color:var(--talos-text-muted, #64748b);white-space:nowrap}.talos-drop-zone-file-progress-bar{width:100%;height:.25rem;background-color:var(--talos-bg-subtle, #e2e8f0);border-radius:9999px;overflow:hidden;margin-top:.125rem}.talos-drop-zone-file-progress-fill{height:100%;background-color:var(--talos-primary-color, #2563eb);border-radius:inherit;transition:width .2s ease-out}.talos-drop-zone-file-error-msg{font-size:.6875rem;color:var(--talos-error-color, #ef4444);font-weight:500}.talos-drop-zone-file-actions{display:flex;align-items:center;gap:.375rem;flex-shrink:0}.talos-drop-zone-file-percent{font-size:.75rem;font-weight:600;color:var(--talos-primary-color, #2563eb)}.talos-drop-zone-status-icon{display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem}.talos-drop-zone-status-icon.status-success{color:var(--talos-success-color, #16a34a)}.talos-drop-zone-status-icon.status-success svg{width:1.125rem;height:1.125rem}.talos-drop-zone-action-btn{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.25rem;background:transparent;border:none;cursor:pointer;padding:0;transition:background-color .15s ease,color .15s ease,transform .1s ease}.talos-drop-zone-action-btn svg{width:1rem;height:1rem}.talos-drop-zone-action-btn.btn-remove{color:var(--talos-text-muted, #94a3b8)}.talos-drop-zone-action-btn.btn-remove:hover{color:var(--talos-error-color, #ef4444);background-color:#ef44441a}.talos-drop-zone-action-btn.btn-remove:active{transform:scale(.92)}.talos-drop-zone-action-btn.btn-retry{color:var(--talos-primary-color, #2563eb)}.talos-drop-zone-action-btn.btn-retry:hover{background-color:var(--talos-primary-light, #eff6ff)}.talos-drop-zone-action-btn.btn-retry:active{transform:scale(.92)}\n"] }]
|
|
643
|
-
}], propDecorators: { accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], maxFileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFileSize", required: false }] }], minFileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "minFileSize", required: false }] }], maxFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFiles", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], subTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "subTitle", required: false }] }], browseLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "browseLabel", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], showFileList: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFileList", required: false }] }], autoManageFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoManageFiles", required: false }] }], autoGeneratePreviews: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoGeneratePreviews", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], allowRetry: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowRetry", required: false }] }], validator: [{ type: i0.Input, args: [{ isSignal: true, alias: "validator", required: false }] }], itemTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], contentTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentTemplate", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], files: [{ type: i0.Input, args: [{ isSignal: true, alias: "files", required: false }] }, { type: i0.Output, args: ["filesChange"] }], rawFilesChange: [{ type: i0.Output, args: ["rawFilesChange"] }], fileDrop: [{ type: i0.Output, args: ["fileDrop"] }], fileSelect: [{ type: i0.Output, args: ["fileSelect"] }], fileRemove: [{ type: i0.Output, args: ["fileRemove"] }], fileRetry: [{ type: i0.Output, args: ["fileRetry"] }], rejected: [{ type: i0.Output, args: ["rejected"] }], dragStateChange: [{ type: i0.Output, args: ["dragStateChange"] }], change: [{ type: i0.Output, args: ["change"] }], fileInput: [{
|
|
644
|
-
type: ViewChild,
|
|
645
|
-
args: ['fileInput']
|
|
646
|
-
}] } });
|
|
647
|
-
|
|
648
|
-
class TalosDropZoneModule {
|
|
649
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosDropZoneModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
650
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.1", ngImport: i0, type: TalosDropZoneModule, imports: [TalosDropZoneComponent, TalosFileDropDirective], exports: [TalosDropZoneComponent, TalosFileDropDirective] });
|
|
651
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosDropZoneModule });
|
|
652
|
-
}
|
|
653
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosDropZoneModule, decorators: [{
|
|
654
|
-
type: NgModule,
|
|
655
|
-
args: [{
|
|
656
|
-
imports: [TalosDropZoneComponent, TalosFileDropDirective],
|
|
657
|
-
exports: [TalosDropZoneComponent, TalosFileDropDirective]
|
|
658
|
-
}]
|
|
659
|
-
}] });
|
|
660
|
-
|
|
661
|
-
/**
|
|
662
|
-
* Generated bundle index. Do not edit.
|
|
663
|
-
*/
|
|
664
|
-
|
|
665
|
-
export { TalosDropZoneComponent, TalosDropZoneModule, TalosFileDropDirective };
|
|
666
|
-
//# sourceMappingURL=weeehaoooz-talos-ui-form-drop-zone.mjs.map
|