ngx-core-components 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/ai-audio-wave/ai-audio-wave.component.d.ts +28 -0
- package/ai/ai-chat-widget/ai-chat-widget.component.d.ts +26 -0
- package/ai/ai-code-editor/ai-code-editor.component.d.ts +30 -0
- package/ai/ai-model-compare/ai-model-compare.component.d.ts +31 -0
- package/ai/ai-prompt-editor/ai-prompt-editor.component.d.ts +22 -0
- package/ai/public-api.d.ts +7 -0
- package/buttons/public-api.d.ts +2 -0
- package/buttons/speed-dial/speed-dial.component.d.ts +24 -0
- package/charts/area-chart/area-chart.component.d.ts +43 -0
- package/charts/funnel-chart/funnel-chart.component.d.ts +26 -0
- package/charts/gauge-chart/gauge-chart.component.d.ts +25 -0
- package/charts/heatmap-chart/heatmap-chart.component.d.ts +34 -0
- package/charts/public-api.d.ts +10 -0
- package/charts/radar-chart/radar-chart.component.d.ts +51 -0
- package/charts/treemap-chart/treemap-chart.component.d.ts +33 -0
- package/feedback/alert/alert.component.d.ts +19 -0
- package/feedback/avatar/avatar.component.d.ts +37 -0
- package/feedback/countdown/countdown.component.d.ts +46 -0
- package/feedback/empty-state/empty-state.component.d.ts +14 -0
- package/feedback/public-api.d.ts +9 -0
- package/feedback/stat-card/stat-card.component.d.ts +18 -0
- package/fesm2022/ngx-core-components-ai.mjs +1418 -2
- package/fesm2022/ngx-core-components-ai.mjs.map +1 -1
- package/fesm2022/ngx-core-components-buttons.mjs +133 -1
- package/fesm2022/ngx-core-components-buttons.mjs.map +1 -1
- package/fesm2022/ngx-core-components-charts.mjs +1474 -2
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
- package/fesm2022/ngx-core-components-feedback.mjs +973 -5
- package/fesm2022/ngx-core-components-feedback.mjs.map +1 -1
- package/fesm2022/ngx-core-components-inputs.mjs +1050 -12
- package/fesm2022/ngx-core-components-inputs.mjs.map +1 -1
- package/fesm2022/ngx-core-components-layout.mjs +930 -2
- package/fesm2022/ngx-core-components-layout.mjs.map +1 -1
- package/fesm2022/ngx-core-components-navigation.mjs +442 -2
- package/fesm2022/ngx-core-components-navigation.mjs.map +1 -1
- package/fesm2022/ngx-core-components-views.mjs +1626 -3
- package/fesm2022/ngx-core-components-views.mjs.map +1 -1
- package/fesm2022/ngx-core-components.mjs +8 -8
- package/fesm2022/ngx-core-components.mjs.map +1 -1
- package/inputs/file-preview/file-preview.component.d.ts +61 -0
- package/inputs/file-upload/file-upload.component.d.ts +51 -0
- package/inputs/public-api.d.ts +7 -0
- package/inputs/segmented-control/segmented-control.component.d.ts +20 -0
- package/inputs/tag-input/tag-input.component.d.ts +25 -0
- package/layout/carousel/carousel.component.d.ts +39 -0
- package/layout/dashboard-layout/dashboard-layout.component.d.ts +43 -0
- package/layout/dashboard-layout/models.d.ts +26 -0
- package/layout/drawer/drawer.component.d.ts +21 -0
- package/layout/public-api.d.ts +4 -0
- package/navigation/back-to-top/back-to-top.component.d.ts +15 -0
- package/navigation/command-palette/command-palette.component.d.ts +34 -0
- package/navigation/public-api.d.ts +3 -0
- package/package.json +1 -1
- package/public-api.d.ts +33 -9
- package/views/image-compare/image-compare.component.d.ts +26 -0
- package/views/kanban/kanban.component.d.ts +41 -0
- package/views/kanban/models.d.ts +19 -0
- package/views/key-value-list/key-value-list.component.d.ts +36 -0
- package/views/public-api.d.ts +11 -0
- package/views/scheduler/models.d.ts +18 -0
- package/views/scheduler/scheduler.component.d.ts +36 -0
- package/views/timeline/timeline.component.d.ts +19 -0
- package/views/virtual-list/virtual-list.component.d.ts +42 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, signal, computed, forwardRef, ChangeDetectionStrategy, Component, inject, ElementRef, HostListener, effect } from '@angular/core';
|
|
3
|
-
import
|
|
2
|
+
import { input, output, signal, computed, forwardRef, ChangeDetectionStrategy, Component, inject, ElementRef, HostListener, effect, model } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/forms';
|
|
4
|
+
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
5
|
+
import { CommonModule } from '@angular/common';
|
|
4
6
|
|
|
5
7
|
class TextBoxComponent {
|
|
6
8
|
value = input('');
|
|
@@ -127,7 +129,7 @@ class TextBoxComponent {
|
|
|
127
129
|
<div class="ngx-textbox-hint">{{ hint() }}</div>
|
|
128
130
|
}
|
|
129
131
|
</div>
|
|
130
|
-
`, isInline: true, styles: [":host{display:block}.ngx-textbox{position:relative;font-family:inherit}.ngx-textbox-label{display:block;font-size:
|
|
132
|
+
`, isInline: true, styles: [":host{display:block}.ngx-textbox{position:relative;font-family:inherit}.ngx-textbox-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #475569);margin-bottom:6px;transition:color .15s}.ngx-textbox-wrap{position:relative;display:flex;align-items:center;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #fff);transition:all .2s cubic-bezier(.4,0,.2,1)}.focused .ngx-textbox-wrap{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.has-error .ngx-textbox-wrap{border-color:var(--ngx-input-error, #ef4444)}.has-error.focused .ngx-textbox-wrap{box-shadow:0 0 0 3px #ef444426}.disabled .ngx-textbox-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed;opacity:.7}.ngx-textbox-input{flex:1;min-width:0;padding:10px 14px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #0f172a);font-family:inherit}.ngx-textbox-input:disabled{cursor:not-allowed;color:#94a3b8}.ngx-textbox-error{font-size:12px;color:var(--ngx-input-error, #ef4444);margin-top:4px;font-weight:550}.ngx-textbox-hint{font-size:12px;color:var(--ngx-input-label, #64748b);margin-top:4px}.ngx-textbox-affix{display:flex;align-items:center;padding:0 10px;color:#64748b;font-size:14px;flex-shrink:0}.ngx-textbox-clear{background:none;border:none;cursor:pointer;color:#94a3b8;font-size:12px;padding:0 8px;line-height:1;display:flex;align-items:center;flex-shrink:0}.ngx-textbox-clear:hover{color:#475569}.ngx-textbox-password-toggle{background:none;border:none;cursor:pointer;color:#94a3b8;font-size:14px;padding:0 8px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.ngx-textbox-password-toggle:hover{color:#475569}.ngx-textbox-charcount{font-size:11px;color:#94a3b8;margin-top:3px;text-align:right}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
131
133
|
}
|
|
132
134
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TextBoxComponent, decorators: [{
|
|
133
135
|
type: Component,
|
|
@@ -184,7 +186,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
184
186
|
<div class="ngx-textbox-hint">{{ hint() }}</div>
|
|
185
187
|
}
|
|
186
188
|
</div>
|
|
187
|
-
`, styles: [":host{display:block}.ngx-textbox{position:relative;font-family:inherit}.ngx-textbox-label{display:block;font-size:
|
|
189
|
+
`, styles: [":host{display:block}.ngx-textbox{position:relative;font-family:inherit}.ngx-textbox-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #475569);margin-bottom:6px;transition:color .15s}.ngx-textbox-wrap{position:relative;display:flex;align-items:center;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #fff);transition:all .2s cubic-bezier(.4,0,.2,1)}.focused .ngx-textbox-wrap{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.has-error .ngx-textbox-wrap{border-color:var(--ngx-input-error, #ef4444)}.has-error.focused .ngx-textbox-wrap{box-shadow:0 0 0 3px #ef444426}.disabled .ngx-textbox-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed;opacity:.7}.ngx-textbox-input{flex:1;min-width:0;padding:10px 14px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #0f172a);font-family:inherit}.ngx-textbox-input:disabled{cursor:not-allowed;color:#94a3b8}.ngx-textbox-error{font-size:12px;color:var(--ngx-input-error, #ef4444);margin-top:4px;font-weight:550}.ngx-textbox-hint{font-size:12px;color:var(--ngx-input-label, #64748b);margin-top:4px}.ngx-textbox-affix{display:flex;align-items:center;padding:0 10px;color:#64748b;font-size:14px;flex-shrink:0}.ngx-textbox-clear{background:none;border:none;cursor:pointer;color:#94a3b8;font-size:12px;padding:0 8px;line-height:1;display:flex;align-items:center;flex-shrink:0}.ngx-textbox-clear:hover{color:#475569}.ngx-textbox-password-toggle{background:none;border:none;cursor:pointer;color:#94a3b8;font-size:14px;padding:0 8px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.ngx-textbox-password-toggle:hover{color:#475569}.ngx-textbox-charcount{font-size:11px;color:#94a3b8;margin-top:3px;text-align:right}\n"] }]
|
|
188
190
|
}] });
|
|
189
191
|
|
|
190
192
|
class CheckboxComponent {
|
|
@@ -1203,7 +1205,13 @@ class DatePickerComponent {
|
|
|
1203
1205
|
// Leading blanks
|
|
1204
1206
|
for (let i = 0; i < first.getDay(); i++) {
|
|
1205
1207
|
const d = new Date(y, m, -first.getDay() + i + 1);
|
|
1206
|
-
|
|
1208
|
+
const isDisabled = (this.min() && d < this.min()) || (this.max() && d > this.max()) || false;
|
|
1209
|
+
days.push({
|
|
1210
|
+
date: d, label: d.getDate().toString(), current: false,
|
|
1211
|
+
isToday: false,
|
|
1212
|
+
isSelected: d.setHours(0, 0, 0, 0) === selectedTime,
|
|
1213
|
+
disabled: isDisabled
|
|
1214
|
+
});
|
|
1207
1215
|
}
|
|
1208
1216
|
// Days in month
|
|
1209
1217
|
for (let d = 1; d <= last.getDate(); d++) {
|
|
@@ -1220,7 +1228,13 @@ class DatePickerComponent {
|
|
|
1220
1228
|
const remaining = 42 - days.length;
|
|
1221
1229
|
for (let i = 1; i <= remaining; i++) {
|
|
1222
1230
|
const d = new Date(y, m + 1, i);
|
|
1223
|
-
|
|
1231
|
+
const isDisabled = (this.min() && d < this.min()) || (this.max() && d > this.max()) || false;
|
|
1232
|
+
days.push({
|
|
1233
|
+
date: d, label: i.toString(), current: false,
|
|
1234
|
+
isToday: false,
|
|
1235
|
+
isSelected: d.setHours(0, 0, 0, 0) === selectedTime,
|
|
1236
|
+
disabled: isDisabled
|
|
1237
|
+
});
|
|
1224
1238
|
}
|
|
1225
1239
|
return days;
|
|
1226
1240
|
});
|
|
@@ -1344,7 +1358,7 @@ class DatePickerComponent {
|
|
|
1344
1358
|
</div>
|
|
1345
1359
|
}
|
|
1346
1360
|
</div>
|
|
1347
|
-
`, isInline: true, styles: [":host{display:block}.ngx-date-picker{position:relative;font-family:inherit}.dp-label{display:block;font-size:
|
|
1361
|
+
`, isInline: true, styles: [":host{display:block}.ngx-date-picker{position:relative;font-family:inherit}.dp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #475569);margin-bottom:6px}.dp-input-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #fff);cursor:pointer;transition:border-color .2s,box-shadow .2s}.dp-input-wrap:hover{border-color:var(--primary-color, #4f46e5)}.open .dp-input-wrap{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.disabled .dp-input-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed;opacity:.7}.dp-input{flex:1;padding:10px 14px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #0f172a);cursor:pointer;font-family:inherit}.dp-input:disabled{cursor:not-allowed;color:#94a3b8}.dp-icon{padding:0 12px;color:#64748b;font-size:14px}.dp-popup{position:absolute;top:calc(100% + 6px);left:0;z-index:1000;background:var(--bg-secondary, #fff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--ngx-input-radius, 12px);box-shadow:var(--shadow-lg, 0 10px 25px rgba(0,0,0,.08));padding:16px;width:280px}.dp-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.dp-nav-btn{background:none;border:none;cursor:pointer;font-size:20px;color:#64748b;padding:2px 8px;border-radius:6px;line-height:1;transition:background .15s}.dp-nav-btn:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.dp-nav-title{font-size:14px;font-weight:750;color:var(--text-primary, #0f172a);font-family:var(--ngx-heading-font-family, inherit)}.dp-weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-bottom:6px}.dp-wd{text-align:center;font-size:11px;color:#94a3b8;font-weight:700;padding:4px 0;text-transform:uppercase;letter-spacing:.5px}.dp-days{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}.dp-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:500;border:none;background:none;cursor:pointer;border-radius:50%;color:var(--text-primary, #0f172a);transition:all .15s}.dp-day:hover:not(.disabled):not(.selected){background:var(--border-light, #f1f5f9)}.dp-day.other-month{color:#cbd5e1}.dp-day.today{font-weight:700;color:var(--primary-color, #4f46e5);border:1.5px solid var(--primary-color, #4f46e5)}.dp-day.selected{background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;font-weight:600;box-shadow:0 3px 8px #4f46e54d}.dp-day.disabled{color:#e2e8f0;cursor:not-allowed;text-decoration:line-through;opacity:.4}.dp-footer{display:flex;justify-content:space-between;margin-top:12px;padding-top:10px;border-top:1px solid var(--border-color, #e2e8f0)}.dp-today-btn,.dp-clear-btn{background:none;border:none;cursor:pointer;font-size:12px;font-weight:700;color:var(--primary-color, #4f46e5);padding:6px 12px;border-radius:6px;font-family:inherit;transition:background .15s}.dp-today-btn:hover{background:var(--primary-glow, rgba(79, 70, 229, .08))}.dp-clear-btn{color:var(--text-secondary, #64748b)}.dp-clear-btn:hover{background:var(--border-light, #f1f5f9)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1348
1362
|
}
|
|
1349
1363
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DatePickerComponent, decorators: [{
|
|
1350
1364
|
type: Component,
|
|
@@ -1408,7 +1422,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
1408
1422
|
</div>
|
|
1409
1423
|
}
|
|
1410
1424
|
</div>
|
|
1411
|
-
`, styles: [":host{display:block}.ngx-date-picker{position:relative;font-family:inherit}.dp-label{display:block;font-size:
|
|
1425
|
+
`, styles: [":host{display:block}.ngx-date-picker{position:relative;font-family:inherit}.dp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #475569);margin-bottom:6px}.dp-input-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #fff);cursor:pointer;transition:border-color .2s,box-shadow .2s}.dp-input-wrap:hover{border-color:var(--primary-color, #4f46e5)}.open .dp-input-wrap{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.disabled .dp-input-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed;opacity:.7}.dp-input{flex:1;padding:10px 14px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #0f172a);cursor:pointer;font-family:inherit}.dp-input:disabled{cursor:not-allowed;color:#94a3b8}.dp-icon{padding:0 12px;color:#64748b;font-size:14px}.dp-popup{position:absolute;top:calc(100% + 6px);left:0;z-index:1000;background:var(--bg-secondary, #fff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--ngx-input-radius, 12px);box-shadow:var(--shadow-lg, 0 10px 25px rgba(0,0,0,.08));padding:16px;width:280px}.dp-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.dp-nav-btn{background:none;border:none;cursor:pointer;font-size:20px;color:#64748b;padding:2px 8px;border-radius:6px;line-height:1;transition:background .15s}.dp-nav-btn:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.dp-nav-title{font-size:14px;font-weight:750;color:var(--text-primary, #0f172a);font-family:var(--ngx-heading-font-family, inherit)}.dp-weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-bottom:6px}.dp-wd{text-align:center;font-size:11px;color:#94a3b8;font-weight:700;padding:4px 0;text-transform:uppercase;letter-spacing:.5px}.dp-days{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}.dp-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:500;border:none;background:none;cursor:pointer;border-radius:50%;color:var(--text-primary, #0f172a);transition:all .15s}.dp-day:hover:not(.disabled):not(.selected){background:var(--border-light, #f1f5f9)}.dp-day.other-month{color:#cbd5e1}.dp-day.today{font-weight:700;color:var(--primary-color, #4f46e5);border:1.5px solid var(--primary-color, #4f46e5)}.dp-day.selected{background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;font-weight:600;box-shadow:0 3px 8px #4f46e54d}.dp-day.disabled{color:#e2e8f0;cursor:not-allowed;text-decoration:line-through;opacity:.4}.dp-footer{display:flex;justify-content:space-between;margin-top:12px;padding-top:10px;border-top:1px solid var(--border-color, #e2e8f0)}.dp-today-btn,.dp-clear-btn{background:none;border:none;cursor:pointer;font-size:12px;font-weight:700;color:var(--primary-color, #4f46e5);padding:6px 12px;border-radius:6px;font-family:inherit;transition:background .15s}.dp-today-btn:hover{background:var(--primary-glow, rgba(79, 70, 229, .08))}.dp-clear-btn{color:var(--text-secondary, #64748b)}.dp-clear-btn:hover{background:var(--border-light, #f1f5f9)}\n"] }]
|
|
1412
1426
|
}], propDecorators: { onDocClick: [{
|
|
1413
1427
|
type: HostListener,
|
|
1414
1428
|
args: ['document:click', ['$event']]
|
|
@@ -2144,7 +2158,7 @@ class DateRangePickerComponent {
|
|
|
2144
2158
|
this.picking.set('end');
|
|
2145
2159
|
}
|
|
2146
2160
|
else {
|
|
2147
|
-
if (
|
|
2161
|
+
if (ds >= this.startDate()) {
|
|
2148
2162
|
this.endDate.set(ds);
|
|
2149
2163
|
this.picking.set('start');
|
|
2150
2164
|
this.rangeChange.emit({ start: this.startDate(), end: ds });
|
|
@@ -2191,7 +2205,7 @@ class DateRangePickerComponent {
|
|
|
2191
2205
|
</div>
|
|
2192
2206
|
}
|
|
2193
2207
|
</div>
|
|
2194
|
-
`, isInline: true, styles: [":host{display:block;position:relative}.drp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #
|
|
2208
|
+
`, isInline: true, styles: [":host{display:block;position:relative}.drp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #475569);margin-bottom:6px}.drp-inputs{display:flex;align-items:center;gap:8px;padding:9px 12px;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);cursor:pointer;background:var(--ngx-input-bg, #fff);transition:all .2s}.drp-inputs:hover{border-color:var(--primary-color, #4f46e5)}.drp-input{border:none;background:transparent;font-size:13px;color:var(--ngx-input-text, #0f172a);outline:none;cursor:pointer;width:85px;font-family:inherit}.drp-sep{color:#94a3b8;font-weight:650}.drp-icon{font-size:14px;color:#64748b;margin-left:auto}.drp-calendar-wrap{position:absolute;top:calc(100% + 6px);left:0;background:var(--bg-secondary, #fff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--ngx-input-radius, 12px);box-shadow:var(--shadow-lg, 0 10px 25px rgba(0,0,0,.08));z-index:1000;padding:14px}.cal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.cal-nav{background:none;border:1px solid var(--border-color, #e2e8f0);border-radius:6px;cursor:pointer;padding:3px 8px;font-size:14px;color:#64748b;transition:all .15s}.cal-nav:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.cal-title{font-weight:750;font-size:13px;color:var(--text-primary, #0f172a);font-family:var(--ngx-heading-font-family, inherit)}.cal-grid{display:grid;grid-template-columns:repeat(7,34px);gap:3px}.cal-weekday{text-align:center;font-size:10px;font-weight:700;color:#94a3b8;padding:4px 0;text-transform:uppercase;letter-spacing:.5px}.cal-day{width:34px;height:34px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:550;border-radius:6px;cursor:pointer;transition:all .15s;color:var(--text-primary, #0f172a)}.cal-day:hover:not(.range-start):not(.range-end){background:var(--border-light, #f1f5f9)}.cal-day.other-month{color:#cbd5e1}.cal-day.in-range{background:var(--primary-glow, rgba(79, 70, 229, .08));color:var(--primary-color, #4f46e5);border-radius:0}.cal-day.range-start,.cal-day.range-end{background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;font-weight:700;border-radius:50%;box-shadow:0 2px 6px #4f46e559}.cal-day.today:not(.range-start):not(.range-end){font-weight:700;border:1.5px solid var(--primary-color, #4f46e5);color:var(--primary-color, #4f46e5)}\n"] });
|
|
2195
2209
|
}
|
|
2196
2210
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DateRangePickerComponent, decorators: [{
|
|
2197
2211
|
type: Component,
|
|
@@ -2230,7 +2244,1031 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
2230
2244
|
</div>
|
|
2231
2245
|
}
|
|
2232
2246
|
</div>
|
|
2233
|
-
`, styles: [":host{display:block;position:relative}.drp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #
|
|
2247
|
+
`, styles: [":host{display:block;position:relative}.drp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #475569);margin-bottom:6px}.drp-inputs{display:flex;align-items:center;gap:8px;padding:9px 12px;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);cursor:pointer;background:var(--ngx-input-bg, #fff);transition:all .2s}.drp-inputs:hover{border-color:var(--primary-color, #4f46e5)}.drp-input{border:none;background:transparent;font-size:13px;color:var(--ngx-input-text, #0f172a);outline:none;cursor:pointer;width:85px;font-family:inherit}.drp-sep{color:#94a3b8;font-weight:650}.drp-icon{font-size:14px;color:#64748b;margin-left:auto}.drp-calendar-wrap{position:absolute;top:calc(100% + 6px);left:0;background:var(--bg-secondary, #fff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--ngx-input-radius, 12px);box-shadow:var(--shadow-lg, 0 10px 25px rgba(0,0,0,.08));z-index:1000;padding:14px}.cal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.cal-nav{background:none;border:1px solid var(--border-color, #e2e8f0);border-radius:6px;cursor:pointer;padding:3px 8px;font-size:14px;color:#64748b;transition:all .15s}.cal-nav:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.cal-title{font-weight:750;font-size:13px;color:var(--text-primary, #0f172a);font-family:var(--ngx-heading-font-family, inherit)}.cal-grid{display:grid;grid-template-columns:repeat(7,34px);gap:3px}.cal-weekday{text-align:center;font-size:10px;font-weight:700;color:#94a3b8;padding:4px 0;text-transform:uppercase;letter-spacing:.5px}.cal-day{width:34px;height:34px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:550;border-radius:6px;cursor:pointer;transition:all .15s;color:var(--text-primary, #0f172a)}.cal-day:hover:not(.range-start):not(.range-end){background:var(--border-light, #f1f5f9)}.cal-day.other-month{color:#cbd5e1}.cal-day.in-range{background:var(--primary-glow, rgba(79, 70, 229, .08));color:var(--primary-color, #4f46e5);border-radius:0}.cal-day.range-start,.cal-day.range-end{background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;font-weight:700;border-radius:50%;box-shadow:0 2px 6px #4f46e559}.cal-day.today:not(.range-start):not(.range-end){font-weight:700;border:1.5px solid var(--primary-color, #4f46e5);color:var(--primary-color, #4f46e5)}\n"] }]
|
|
2248
|
+
}] });
|
|
2249
|
+
|
|
2250
|
+
class FileUploadComponent {
|
|
2251
|
+
// Inputs
|
|
2252
|
+
multiple = input(false);
|
|
2253
|
+
accept = input(''); // comma separated file rules
|
|
2254
|
+
maxSize = input(0); // max bytes limit (e.g. 5242880 for 5MB). 0 means unlimited
|
|
2255
|
+
disabled = input(false);
|
|
2256
|
+
theme = input('light');
|
|
2257
|
+
uploadUrl = input('');
|
|
2258
|
+
// Outputs
|
|
2259
|
+
filesSelected = output();
|
|
2260
|
+
fileRemoved = output();
|
|
2261
|
+
uploadProgress = output();
|
|
2262
|
+
uploadComplete = output();
|
|
2263
|
+
uploadError = output();
|
|
2264
|
+
// State
|
|
2265
|
+
isDragOver = signal(false);
|
|
2266
|
+
fileQueue = signal([]);
|
|
2267
|
+
onDragOver(event) {
|
|
2268
|
+
if (this.disabled())
|
|
2269
|
+
return;
|
|
2270
|
+
event.preventDefault();
|
|
2271
|
+
event.stopPropagation();
|
|
2272
|
+
this.isDragOver.set(true);
|
|
2273
|
+
}
|
|
2274
|
+
onDragLeave(event) {
|
|
2275
|
+
event.preventDefault();
|
|
2276
|
+
event.stopPropagation();
|
|
2277
|
+
this.isDragOver.set(false);
|
|
2278
|
+
}
|
|
2279
|
+
onDrop(event) {
|
|
2280
|
+
if (this.disabled())
|
|
2281
|
+
return;
|
|
2282
|
+
event.preventDefault();
|
|
2283
|
+
event.stopPropagation();
|
|
2284
|
+
this.isDragOver.set(false);
|
|
2285
|
+
if (event.dataTransfer && event.dataTransfer.files) {
|
|
2286
|
+
this.handleFiles(Array.from(event.dataTransfer.files));
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
onFileSelected(event) {
|
|
2290
|
+
const inputEl = event.target;
|
|
2291
|
+
if (inputEl.files) {
|
|
2292
|
+
this.handleFiles(Array.from(inputEl.files));
|
|
2293
|
+
inputEl.value = ''; // clear input selection
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
// Handle addition of files to the queue, runs validation, and triggers simulated upload
|
|
2297
|
+
handleFiles(incomingFiles) {
|
|
2298
|
+
if (incomingFiles.length === 0)
|
|
2299
|
+
return;
|
|
2300
|
+
// Filter by single vs multiple
|
|
2301
|
+
const filesToProcess = this.multiple() ? incomingFiles : [incomingFiles[0]];
|
|
2302
|
+
const newQueueItems = [];
|
|
2303
|
+
const validFiles = [];
|
|
2304
|
+
for (const file of filesToProcess) {
|
|
2305
|
+
const formattedSize = this.formatBytes(file.size);
|
|
2306
|
+
const id = Date.now().toString() + '-' + Math.random().toString(36).substr(2, 9);
|
|
2307
|
+
const item = {
|
|
2308
|
+
id,
|
|
2309
|
+
name: file.name,
|
|
2310
|
+
size: file.size,
|
|
2311
|
+
type: file.type,
|
|
2312
|
+
progress: 0,
|
|
2313
|
+
status: 'pending',
|
|
2314
|
+
formattedSize,
|
|
2315
|
+
fileObject: file
|
|
2316
|
+
};
|
|
2317
|
+
// Validation
|
|
2318
|
+
const errorMsg = this.validateFile(file);
|
|
2319
|
+
if (errorMsg) {
|
|
2320
|
+
item.status = 'error';
|
|
2321
|
+
item.errorMessage = errorMsg;
|
|
2322
|
+
}
|
|
2323
|
+
else {
|
|
2324
|
+
validFiles.push(file);
|
|
2325
|
+
}
|
|
2326
|
+
newQueueItems.push(item);
|
|
2327
|
+
}
|
|
2328
|
+
if (this.multiple()) {
|
|
2329
|
+
this.fileQueue.update(q => [...q, ...newQueueItems]);
|
|
2330
|
+
}
|
|
2331
|
+
else {
|
|
2332
|
+
this.fileQueue.set(newQueueItems);
|
|
2333
|
+
}
|
|
2334
|
+
if (validFiles.length > 0) {
|
|
2335
|
+
this.filesSelected.emit(validFiles);
|
|
2336
|
+
// Trigger simulation or actual file upload
|
|
2337
|
+
for (const item of newQueueItems) {
|
|
2338
|
+
if (item.status === 'pending') {
|
|
2339
|
+
this.uploadFile(item);
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
validateFile(file) {
|
|
2345
|
+
// 1. Max Size check
|
|
2346
|
+
const maxLimit = this.maxSize();
|
|
2347
|
+
if (maxLimit > 0 && file.size > maxLimit) {
|
|
2348
|
+
return `File exceeds max size limit of ${this.formatBytes(maxLimit)}.`;
|
|
2349
|
+
}
|
|
2350
|
+
// 2. Type/Accept format check
|
|
2351
|
+
const acceptRule = this.accept();
|
|
2352
|
+
if (acceptRule) {
|
|
2353
|
+
const allowedRules = acceptRule.split(',').map(r => r.trim().toLowerCase());
|
|
2354
|
+
const ext = ('.' + file.name.split('.').pop()).toLowerCase();
|
|
2355
|
+
const mime = file.type.toLowerCase();
|
|
2356
|
+
const isAllowed = allowedRules.some(rule => {
|
|
2357
|
+
if (rule.startsWith('.')) {
|
|
2358
|
+
return rule === ext;
|
|
2359
|
+
}
|
|
2360
|
+
else if (rule.endsWith('/*')) {
|
|
2361
|
+
const prefix = rule.slice(0, -2);
|
|
2362
|
+
return mime.startsWith(prefix);
|
|
2363
|
+
}
|
|
2364
|
+
else {
|
|
2365
|
+
return rule === mime;
|
|
2366
|
+
}
|
|
2367
|
+
});
|
|
2368
|
+
if (!isAllowed) {
|
|
2369
|
+
return `File type is not accepted. Only formats matching "${acceptRule}" are allowed.`;
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
return null;
|
|
2373
|
+
}
|
|
2374
|
+
uploadFile(item) {
|
|
2375
|
+
this.updateItemStatus(item.id, 'uploading', 0);
|
|
2376
|
+
// Mock Upload simulation
|
|
2377
|
+
// Increment progress linearly in steps
|
|
2378
|
+
let currentProgress = 0;
|
|
2379
|
+
const interval = setInterval(() => {
|
|
2380
|
+
currentProgress += Math.floor(Math.random() * 15) + 5;
|
|
2381
|
+
if (currentProgress >= 100) {
|
|
2382
|
+
currentProgress = 100;
|
|
2383
|
+
clearInterval(interval);
|
|
2384
|
+
// Randomly simulate 5% errors to showcase error recovery states
|
|
2385
|
+
const simulatedSuccess = Math.random() > 0.05;
|
|
2386
|
+
if (simulatedSuccess) {
|
|
2387
|
+
this.updateItemStatus(item.id, 'success', 100);
|
|
2388
|
+
this.uploadComplete.emit({ file: item.fileObject, response: { success: true } });
|
|
2389
|
+
}
|
|
2390
|
+
else {
|
|
2391
|
+
this.updateItemStatus(item.id, 'error', 100, 'Simulated connection failure during file upload.');
|
|
2392
|
+
this.uploadError.emit({ file: item.fileObject, error: 'Simulated connection failure' });
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
else {
|
|
2396
|
+
this.updateItemStatus(item.id, 'uploading', currentProgress);
|
|
2397
|
+
this.uploadProgress.emit({ file: item.fileObject, progress: currentProgress });
|
|
2398
|
+
}
|
|
2399
|
+
}, 250);
|
|
2400
|
+
}
|
|
2401
|
+
retryUpload(item) {
|
|
2402
|
+
this.uploadFile(item);
|
|
2403
|
+
}
|
|
2404
|
+
removeFile(item) {
|
|
2405
|
+
this.fileQueue.update(q => q.filter(x => x.id !== item.id));
|
|
2406
|
+
this.fileRemoved.emit(item.fileObject);
|
|
2407
|
+
}
|
|
2408
|
+
clearAll() {
|
|
2409
|
+
this.fileQueue.set([]);
|
|
2410
|
+
}
|
|
2411
|
+
updateItemStatus(id, status, progress, errorMsg) {
|
|
2412
|
+
this.fileQueue.update(queue => {
|
|
2413
|
+
return queue.map(x => {
|
|
2414
|
+
if (x.id === id) {
|
|
2415
|
+
return {
|
|
2416
|
+
...x,
|
|
2417
|
+
status,
|
|
2418
|
+
progress,
|
|
2419
|
+
errorMessage: errorMsg
|
|
2420
|
+
};
|
|
2421
|
+
}
|
|
2422
|
+
return x;
|
|
2423
|
+
});
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
// Utility text mappings
|
|
2427
|
+
getHelperText() {
|
|
2428
|
+
const limits = [];
|
|
2429
|
+
if (this.accept()) {
|
|
2430
|
+
limits.push(`Accepted: ${this.accept()}`);
|
|
2431
|
+
}
|
|
2432
|
+
if (this.maxSize() > 0) {
|
|
2433
|
+
limits.push(`Max: ${this.formatBytes(this.maxSize())}`);
|
|
2434
|
+
}
|
|
2435
|
+
return limits.length > 0 ? limits.join(' • ') : 'Supports any file';
|
|
2436
|
+
}
|
|
2437
|
+
// Byte formats convertor utility
|
|
2438
|
+
formatBytes(bytes, decimals = 2) {
|
|
2439
|
+
if (bytes === 0)
|
|
2440
|
+
return '0 Bytes';
|
|
2441
|
+
const k = 1024;
|
|
2442
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
2443
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
2444
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
2445
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
|
2446
|
+
}
|
|
2447
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FileUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2448
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: FileUploadComponent, isStandalone: true, selector: "ngx-file-upload", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, maxSize: { classPropertyName: "maxSize", publicName: "maxSize", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, uploadUrl: { classPropertyName: "uploadUrl", publicName: "uploadUrl", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filesSelected: "filesSelected", fileRemoved: "fileRemoved", uploadProgress: "uploadProgress", uploadComplete: "uploadComplete", uploadError: "uploadError" }, ngImport: i0, template: `
|
|
2449
|
+
<div
|
|
2450
|
+
class="file-upload-wrapper"
|
|
2451
|
+
[class.dark]="theme() === 'dark'"
|
|
2452
|
+
[class.drag-over]="isDragOver()"
|
|
2453
|
+
[class.disabled]="disabled()"
|
|
2454
|
+
>
|
|
2455
|
+
<!-- Dropzone Border Frame -->
|
|
2456
|
+
<div
|
|
2457
|
+
class="dropzone-area"
|
|
2458
|
+
(dragover)="onDragOver($event)"
|
|
2459
|
+
(dragleave)="onDragLeave($event)"
|
|
2460
|
+
(drop)="onDrop($event)"
|
|
2461
|
+
(click)="fileInput.click()"
|
|
2462
|
+
>
|
|
2463
|
+
<input
|
|
2464
|
+
#fileInput
|
|
2465
|
+
type="file"
|
|
2466
|
+
[multiple]="multiple()"
|
|
2467
|
+
[accept]="accept()"
|
|
2468
|
+
[disabled]="disabled()"
|
|
2469
|
+
(change)="onFileSelected($event)"
|
|
2470
|
+
class="hidden-file-input"
|
|
2471
|
+
/>
|
|
2472
|
+
|
|
2473
|
+
<div class="dropzone-content">
|
|
2474
|
+
<div class="upload-icon-circle">
|
|
2475
|
+
<svg class="upload-arrow-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2476
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
|
2477
|
+
<polyline points="17 8 12 3 7 8"/>
|
|
2478
|
+
<line x1="12" y1="3" x2="12" y2="15"/>
|
|
2479
|
+
</svg>
|
|
2480
|
+
</div>
|
|
2481
|
+
<div class="upload-headline">
|
|
2482
|
+
<span class="highlight">Click to upload</span> or drag and drop
|
|
2483
|
+
</div>
|
|
2484
|
+
<div class="upload-subtext">
|
|
2485
|
+
{{ getHelperText() }}
|
|
2486
|
+
</div>
|
|
2487
|
+
</div>
|
|
2488
|
+
</div>
|
|
2489
|
+
|
|
2490
|
+
<!-- File Queue List -->
|
|
2491
|
+
@if (fileQueue().length > 0) {
|
|
2492
|
+
<div class="file-queue-list">
|
|
2493
|
+
<div class="queue-header">
|
|
2494
|
+
<h4>Files Queue ({{ fileQueue().length }})</h4>
|
|
2495
|
+
<button class="clear-all-btn" (click)="clearAll()" [disabled]="disabled()">Clear All</button>
|
|
2496
|
+
</div>
|
|
2497
|
+
|
|
2498
|
+
<div class="queue-items">
|
|
2499
|
+
@for (item of fileQueue(); track item.id) {
|
|
2500
|
+
<div class="queue-item-card" [class]="item.status">
|
|
2501
|
+
<div class="item-icon">
|
|
2502
|
+
<svg class="file-icon-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2503
|
+
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
|
|
2504
|
+
<polyline points="14 2 14 8 20 8"/>
|
|
2505
|
+
</svg>
|
|
2506
|
+
</div>
|
|
2507
|
+
|
|
2508
|
+
<div class="item-details">
|
|
2509
|
+
<div class="item-meta">
|
|
2510
|
+
<span class="item-name" [title]="item.name">{{ item.name }}</span>
|
|
2511
|
+
<span class="item-size">{{ item.formattedSize }}</span>
|
|
2512
|
+
</div>
|
|
2513
|
+
|
|
2514
|
+
<!-- Progress meter -->
|
|
2515
|
+
@if (item.status === 'uploading') {
|
|
2516
|
+
<div class="item-progress-wrap">
|
|
2517
|
+
<div class="progress-track">
|
|
2518
|
+
<div class="progress-bar-fill" [style.width.%]="item.progress"></div>
|
|
2519
|
+
</div>
|
|
2520
|
+
<span class="progress-text">{{ item.progress }}%</span>
|
|
2521
|
+
</div>
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
<!-- Error message alert -->
|
|
2525
|
+
@if (item.status === 'error' && item.errorMessage) {
|
|
2526
|
+
<div class="item-error-msg">
|
|
2527
|
+
⚠️ {{ item.errorMessage }}
|
|
2528
|
+
</div>
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
<!-- Status badges -->
|
|
2532
|
+
@if (item.status === 'success') {
|
|
2533
|
+
<div class="item-status-badge success">✓ Uploaded</div>
|
|
2534
|
+
}
|
|
2535
|
+
</div>
|
|
2536
|
+
|
|
2537
|
+
<!-- Actions -->
|
|
2538
|
+
<div class="item-actions">
|
|
2539
|
+
@if (item.status === 'error') {
|
|
2540
|
+
<button class="action-btn retry-btn" (click)="retryUpload(item)" title="Retry upload">
|
|
2541
|
+
🔄
|
|
2542
|
+
</button>
|
|
2543
|
+
}
|
|
2544
|
+
<button class="action-btn remove-btn" (click)="removeFile(item)" title="Remove file" [disabled]="disabled()">
|
|
2545
|
+
✕
|
|
2546
|
+
</button>
|
|
2547
|
+
</div>
|
|
2548
|
+
</div>
|
|
2549
|
+
}
|
|
2550
|
+
</div>
|
|
2551
|
+
</div>
|
|
2552
|
+
}
|
|
2553
|
+
</div>
|
|
2554
|
+
`, isInline: true, styles: [":host{display:block;width:100%}.file-upload-wrapper{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);padding:16px;box-shadow:var(--shadow-sm);display:flex;flex-direction:column;gap:16px;transition:all .25s}.file-upload-wrapper.drag-over{border-color:var(--primary-color, #4f46e5);background:#4f46e503}.file-upload-wrapper.disabled{opacity:.65;pointer-events:none}.dropzone-area{border:2px dashed var(--border-color, #cbd5e1);border-radius:var(--radius-md, 10px);padding:32px 20px;text-align:center;cursor:pointer;background:#00000001;transition:all .2s ease-in-out;position:relative}.dropzone-area:hover{border-color:var(--primary-color, #4f46e5);background:#4f46e505}.drag-over .dropzone-area{border-color:var(--primary-color, #4f46e5);background:#4f46e50d}.hidden-file-input{display:none}.dropzone-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;-webkit-user-select:none;user-select:none}.upload-icon-circle{width:44px;height:44px;border-radius:50%;background:var(--border-light, #f1f5f9);display:flex;align-items:center;justify-content:center;color:var(--text-secondary, #475569);transition:all .2s}.dropzone-area:hover .upload-icon-circle{background:var(--primary-color, #4f46e5);color:#fff;transform:scale(1.05)}.upload-arrow-svg{width:20px;height:20px}.upload-headline{font-family:var(--ngx-font-family, sans-serif);font-size:14px;font-weight:550;color:var(--text-primary, #0f172a)}.upload-headline .highlight{color:var(--primary-color, #4f46e5);font-weight:700}.upload-subtext{font-family:var(--ngx-font-family, sans-serif);font-size:11px;color:var(--text-secondary, #64748b)}.file-queue-list{display:flex;flex-direction:column;gap:12px;border-top:1px solid var(--border-color, #e2e8f0);padding-top:16px}.queue-header{display:flex;justify-content:space-between;align-items:center;font-family:var(--ngx-font-family, sans-serif)}.queue-header h4{margin:0;font-size:13px;font-weight:750;color:var(--text-primary, #0f172a);text-transform:uppercase;letter-spacing:.5px}.clear-all-btn{background:transparent;border:none;color:#ef4444;font-size:11px;font-weight:700;cursor:pointer;padding:2px 6px;border-radius:4px;transition:background .2s}.clear-all-btn:hover{background:#ef44440d}.queue-items{display:flex;flex-direction:column;gap:8px;max-height:280px;overflow-y:auto;padding-right:4px}.queue-item-card{display:flex;align-items:center;gap:12px;padding:10px 14px;border:1px solid var(--border-color, #e2e8f0);border-radius:8px;background:var(--bg-secondary, #ffffff);transition:all .2s}.queue-item-card:hover{border-color:var(--text-secondary, #94a3b8);box-shadow:var(--shadow-sm)}.queue-item-card.success{border-color:#10b9814d;background:#10b98101}.queue-item-card.error{border-color:#ef44444d;background:#ef444401}.item-icon{color:var(--text-secondary, #64748b);display:flex;align-items:center;justify-content:center}.file-icon-svg{width:20px;height:20px}.item-details{flex:1;display:flex;flex-direction:column;gap:4px;overflow:hidden;font-family:var(--ngx-font-family, sans-serif)}.item-meta{display:flex;justify-content:space-between;gap:8px}.item-name{font-size:13px;font-weight:600;color:var(--text-primary, #0f172a);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.item-size{font-size:11px;color:var(--text-secondary, #64748b);white-space:nowrap}.item-progress-wrap{display:flex;align-items:center;gap:8px}.progress-track{flex:1;height:4px;background:var(--border-light, #f1f5f9);border-radius:2px;overflow:hidden}.progress-bar-fill{height:100%;background:var(--primary-color, #4f46e5);border-radius:2px;transition:width .15s}.progress-text{font-size:10px;font-weight:700;color:var(--text-secondary, #475569);min-width:28px;text-align:right}.item-error-msg{font-size:11px;color:#ef4444;font-weight:600}.item-status-badge{font-size:10px;font-weight:700;border-radius:4px;padding:1px 6px;width:fit-content}.item-status-badge.success{background:#10b9811a;color:#10b981}.item-actions{display:flex;gap:6px}.action-btn{background:transparent;border:none;font-size:12px;cursor:pointer;width:24px;height:24px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:var(--text-secondary, #64748b);transition:background .2s,color .2s}.action-btn:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.action-btn.remove-btn:hover{color:#ef4444;background:#ef44440d}.file-upload-wrapper.dark{background:#0f172a;border-color:#1f2937}.file-upload-wrapper.dark .dropzone-area{border-color:#374151}.file-upload-wrapper.dark .dropzone-area:hover{border-color:var(--primary-color, #6366f1);background:#6366f105}.file-upload-wrapper.dark .upload-icon-circle{background:#1e293b;color:#94a3b8}.file-upload-wrapper.dark .dropzone-area:hover .upload-icon-circle{background:var(--primary-color, #6366f1);color:#fff}.file-upload-wrapper.dark .upload-headline{color:#e2e8f0}.file-upload-wrapper.dark .upload-headline .highlight{color:var(--primary-color, #6366f1)}.file-upload-wrapper.dark .upload-subtext{color:#94a3b8}.file-upload-wrapper.dark .file-queue-list{border-top-color:#1f2937}.file-upload-wrapper.dark .queue-header h4{color:#e2e8f0}.file-upload-wrapper.dark .queue-item-card{border-color:#1f2937;background:#111827}.file-upload-wrapper.dark .queue-item-card:hover{border-color:#4b5563}.file-upload-wrapper.dark .queue-item-card.success{border-color:#10b98133}.file-upload-wrapper.dark .queue-item-card.error{border-color:#ef444433}.file-upload-wrapper.dark .item-name{color:#e2e8f0}.file-upload-wrapper.dark .item-size{color:#94a3b8}.file-upload-wrapper.dark .progress-track{background:#1e293b}.file-upload-wrapper.dark .progress-bar-fill{background:var(--primary-color, #6366f1)}.file-upload-wrapper.dark .progress-text{color:#94a3b8}.file-upload-wrapper.dark .action-btn:hover{background:#1e293b;color:#f8fafc}.file-upload-wrapper.dark .action-btn.remove-btn:hover{background:#ef44441a}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
2555
|
+
}
|
|
2556
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FileUploadComponent, decorators: [{
|
|
2557
|
+
type: Component,
|
|
2558
|
+
args: [{ selector: 'ngx-file-upload', standalone: true, imports: [CommonModule], template: `
|
|
2559
|
+
<div
|
|
2560
|
+
class="file-upload-wrapper"
|
|
2561
|
+
[class.dark]="theme() === 'dark'"
|
|
2562
|
+
[class.drag-over]="isDragOver()"
|
|
2563
|
+
[class.disabled]="disabled()"
|
|
2564
|
+
>
|
|
2565
|
+
<!-- Dropzone Border Frame -->
|
|
2566
|
+
<div
|
|
2567
|
+
class="dropzone-area"
|
|
2568
|
+
(dragover)="onDragOver($event)"
|
|
2569
|
+
(dragleave)="onDragLeave($event)"
|
|
2570
|
+
(drop)="onDrop($event)"
|
|
2571
|
+
(click)="fileInput.click()"
|
|
2572
|
+
>
|
|
2573
|
+
<input
|
|
2574
|
+
#fileInput
|
|
2575
|
+
type="file"
|
|
2576
|
+
[multiple]="multiple()"
|
|
2577
|
+
[accept]="accept()"
|
|
2578
|
+
[disabled]="disabled()"
|
|
2579
|
+
(change)="onFileSelected($event)"
|
|
2580
|
+
class="hidden-file-input"
|
|
2581
|
+
/>
|
|
2582
|
+
|
|
2583
|
+
<div class="dropzone-content">
|
|
2584
|
+
<div class="upload-icon-circle">
|
|
2585
|
+
<svg class="upload-arrow-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2586
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
|
2587
|
+
<polyline points="17 8 12 3 7 8"/>
|
|
2588
|
+
<line x1="12" y1="3" x2="12" y2="15"/>
|
|
2589
|
+
</svg>
|
|
2590
|
+
</div>
|
|
2591
|
+
<div class="upload-headline">
|
|
2592
|
+
<span class="highlight">Click to upload</span> or drag and drop
|
|
2593
|
+
</div>
|
|
2594
|
+
<div class="upload-subtext">
|
|
2595
|
+
{{ getHelperText() }}
|
|
2596
|
+
</div>
|
|
2597
|
+
</div>
|
|
2598
|
+
</div>
|
|
2599
|
+
|
|
2600
|
+
<!-- File Queue List -->
|
|
2601
|
+
@if (fileQueue().length > 0) {
|
|
2602
|
+
<div class="file-queue-list">
|
|
2603
|
+
<div class="queue-header">
|
|
2604
|
+
<h4>Files Queue ({{ fileQueue().length }})</h4>
|
|
2605
|
+
<button class="clear-all-btn" (click)="clearAll()" [disabled]="disabled()">Clear All</button>
|
|
2606
|
+
</div>
|
|
2607
|
+
|
|
2608
|
+
<div class="queue-items">
|
|
2609
|
+
@for (item of fileQueue(); track item.id) {
|
|
2610
|
+
<div class="queue-item-card" [class]="item.status">
|
|
2611
|
+
<div class="item-icon">
|
|
2612
|
+
<svg class="file-icon-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2613
|
+
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
|
|
2614
|
+
<polyline points="14 2 14 8 20 8"/>
|
|
2615
|
+
</svg>
|
|
2616
|
+
</div>
|
|
2617
|
+
|
|
2618
|
+
<div class="item-details">
|
|
2619
|
+
<div class="item-meta">
|
|
2620
|
+
<span class="item-name" [title]="item.name">{{ item.name }}</span>
|
|
2621
|
+
<span class="item-size">{{ item.formattedSize }}</span>
|
|
2622
|
+
</div>
|
|
2623
|
+
|
|
2624
|
+
<!-- Progress meter -->
|
|
2625
|
+
@if (item.status === 'uploading') {
|
|
2626
|
+
<div class="item-progress-wrap">
|
|
2627
|
+
<div class="progress-track">
|
|
2628
|
+
<div class="progress-bar-fill" [style.width.%]="item.progress"></div>
|
|
2629
|
+
</div>
|
|
2630
|
+
<span class="progress-text">{{ item.progress }}%</span>
|
|
2631
|
+
</div>
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
<!-- Error message alert -->
|
|
2635
|
+
@if (item.status === 'error' && item.errorMessage) {
|
|
2636
|
+
<div class="item-error-msg">
|
|
2637
|
+
⚠️ {{ item.errorMessage }}
|
|
2638
|
+
</div>
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
<!-- Status badges -->
|
|
2642
|
+
@if (item.status === 'success') {
|
|
2643
|
+
<div class="item-status-badge success">✓ Uploaded</div>
|
|
2644
|
+
}
|
|
2645
|
+
</div>
|
|
2646
|
+
|
|
2647
|
+
<!-- Actions -->
|
|
2648
|
+
<div class="item-actions">
|
|
2649
|
+
@if (item.status === 'error') {
|
|
2650
|
+
<button class="action-btn retry-btn" (click)="retryUpload(item)" title="Retry upload">
|
|
2651
|
+
🔄
|
|
2652
|
+
</button>
|
|
2653
|
+
}
|
|
2654
|
+
<button class="action-btn remove-btn" (click)="removeFile(item)" title="Remove file" [disabled]="disabled()">
|
|
2655
|
+
✕
|
|
2656
|
+
</button>
|
|
2657
|
+
</div>
|
|
2658
|
+
</div>
|
|
2659
|
+
}
|
|
2660
|
+
</div>
|
|
2661
|
+
</div>
|
|
2662
|
+
}
|
|
2663
|
+
</div>
|
|
2664
|
+
`, styles: [":host{display:block;width:100%}.file-upload-wrapper{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);padding:16px;box-shadow:var(--shadow-sm);display:flex;flex-direction:column;gap:16px;transition:all .25s}.file-upload-wrapper.drag-over{border-color:var(--primary-color, #4f46e5);background:#4f46e503}.file-upload-wrapper.disabled{opacity:.65;pointer-events:none}.dropzone-area{border:2px dashed var(--border-color, #cbd5e1);border-radius:var(--radius-md, 10px);padding:32px 20px;text-align:center;cursor:pointer;background:#00000001;transition:all .2s ease-in-out;position:relative}.dropzone-area:hover{border-color:var(--primary-color, #4f46e5);background:#4f46e505}.drag-over .dropzone-area{border-color:var(--primary-color, #4f46e5);background:#4f46e50d}.hidden-file-input{display:none}.dropzone-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;-webkit-user-select:none;user-select:none}.upload-icon-circle{width:44px;height:44px;border-radius:50%;background:var(--border-light, #f1f5f9);display:flex;align-items:center;justify-content:center;color:var(--text-secondary, #475569);transition:all .2s}.dropzone-area:hover .upload-icon-circle{background:var(--primary-color, #4f46e5);color:#fff;transform:scale(1.05)}.upload-arrow-svg{width:20px;height:20px}.upload-headline{font-family:var(--ngx-font-family, sans-serif);font-size:14px;font-weight:550;color:var(--text-primary, #0f172a)}.upload-headline .highlight{color:var(--primary-color, #4f46e5);font-weight:700}.upload-subtext{font-family:var(--ngx-font-family, sans-serif);font-size:11px;color:var(--text-secondary, #64748b)}.file-queue-list{display:flex;flex-direction:column;gap:12px;border-top:1px solid var(--border-color, #e2e8f0);padding-top:16px}.queue-header{display:flex;justify-content:space-between;align-items:center;font-family:var(--ngx-font-family, sans-serif)}.queue-header h4{margin:0;font-size:13px;font-weight:750;color:var(--text-primary, #0f172a);text-transform:uppercase;letter-spacing:.5px}.clear-all-btn{background:transparent;border:none;color:#ef4444;font-size:11px;font-weight:700;cursor:pointer;padding:2px 6px;border-radius:4px;transition:background .2s}.clear-all-btn:hover{background:#ef44440d}.queue-items{display:flex;flex-direction:column;gap:8px;max-height:280px;overflow-y:auto;padding-right:4px}.queue-item-card{display:flex;align-items:center;gap:12px;padding:10px 14px;border:1px solid var(--border-color, #e2e8f0);border-radius:8px;background:var(--bg-secondary, #ffffff);transition:all .2s}.queue-item-card:hover{border-color:var(--text-secondary, #94a3b8);box-shadow:var(--shadow-sm)}.queue-item-card.success{border-color:#10b9814d;background:#10b98101}.queue-item-card.error{border-color:#ef44444d;background:#ef444401}.item-icon{color:var(--text-secondary, #64748b);display:flex;align-items:center;justify-content:center}.file-icon-svg{width:20px;height:20px}.item-details{flex:1;display:flex;flex-direction:column;gap:4px;overflow:hidden;font-family:var(--ngx-font-family, sans-serif)}.item-meta{display:flex;justify-content:space-between;gap:8px}.item-name{font-size:13px;font-weight:600;color:var(--text-primary, #0f172a);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.item-size{font-size:11px;color:var(--text-secondary, #64748b);white-space:nowrap}.item-progress-wrap{display:flex;align-items:center;gap:8px}.progress-track{flex:1;height:4px;background:var(--border-light, #f1f5f9);border-radius:2px;overflow:hidden}.progress-bar-fill{height:100%;background:var(--primary-color, #4f46e5);border-radius:2px;transition:width .15s}.progress-text{font-size:10px;font-weight:700;color:var(--text-secondary, #475569);min-width:28px;text-align:right}.item-error-msg{font-size:11px;color:#ef4444;font-weight:600}.item-status-badge{font-size:10px;font-weight:700;border-radius:4px;padding:1px 6px;width:fit-content}.item-status-badge.success{background:#10b9811a;color:#10b981}.item-actions{display:flex;gap:6px}.action-btn{background:transparent;border:none;font-size:12px;cursor:pointer;width:24px;height:24px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:var(--text-secondary, #64748b);transition:background .2s,color .2s}.action-btn:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.action-btn.remove-btn:hover{color:#ef4444;background:#ef44440d}.file-upload-wrapper.dark{background:#0f172a;border-color:#1f2937}.file-upload-wrapper.dark .dropzone-area{border-color:#374151}.file-upload-wrapper.dark .dropzone-area:hover{border-color:var(--primary-color, #6366f1);background:#6366f105}.file-upload-wrapper.dark .upload-icon-circle{background:#1e293b;color:#94a3b8}.file-upload-wrapper.dark .dropzone-area:hover .upload-icon-circle{background:var(--primary-color, #6366f1);color:#fff}.file-upload-wrapper.dark .upload-headline{color:#e2e8f0}.file-upload-wrapper.dark .upload-headline .highlight{color:var(--primary-color, #6366f1)}.file-upload-wrapper.dark .upload-subtext{color:#94a3b8}.file-upload-wrapper.dark .file-queue-list{border-top-color:#1f2937}.file-upload-wrapper.dark .queue-header h4{color:#e2e8f0}.file-upload-wrapper.dark .queue-item-card{border-color:#1f2937;background:#111827}.file-upload-wrapper.dark .queue-item-card:hover{border-color:#4b5563}.file-upload-wrapper.dark .queue-item-card.success{border-color:#10b98133}.file-upload-wrapper.dark .queue-item-card.error{border-color:#ef444433}.file-upload-wrapper.dark .item-name{color:#e2e8f0}.file-upload-wrapper.dark .item-size{color:#94a3b8}.file-upload-wrapper.dark .progress-track{background:#1e293b}.file-upload-wrapper.dark .progress-bar-fill{background:var(--primary-color, #6366f1)}.file-upload-wrapper.dark .progress-text{color:#94a3b8}.file-upload-wrapper.dark .action-btn:hover{background:#1e293b;color:#f8fafc}.file-upload-wrapper.dark .action-btn.remove-btn:hover{background:#ef44441a}\n"] }]
|
|
2665
|
+
}] });
|
|
2666
|
+
|
|
2667
|
+
class TagInputComponent {
|
|
2668
|
+
// ── Inputs ──
|
|
2669
|
+
tags = input([]);
|
|
2670
|
+
placeholder = input('Add tag...');
|
|
2671
|
+
maxTags = input(20);
|
|
2672
|
+
allowDuplicates = input(false);
|
|
2673
|
+
disabled = input(false);
|
|
2674
|
+
theme = input('light');
|
|
2675
|
+
// ── Outputs ──
|
|
2676
|
+
tagsChange = output();
|
|
2677
|
+
tagAdded = output();
|
|
2678
|
+
tagRemoved = output();
|
|
2679
|
+
// ── Internal state ──
|
|
2680
|
+
internalTags = signal([]);
|
|
2681
|
+
isFocused = signal(false);
|
|
2682
|
+
inputValue = '';
|
|
2683
|
+
isAtMax = computed(() => this.internalTags().length >= this.maxTags());
|
|
2684
|
+
/** Native input element reference (grabbed via ViewChild-less approach via the template variable). */
|
|
2685
|
+
_inputEl = null;
|
|
2686
|
+
focusInput() {
|
|
2687
|
+
if (this.disabled() || this.isAtMax())
|
|
2688
|
+
return;
|
|
2689
|
+
// Query the rendered input inside the host
|
|
2690
|
+
const input = document.querySelector('ngx-tag-input .ngx-tag-input__field');
|
|
2691
|
+
input?.focus();
|
|
2692
|
+
}
|
|
2693
|
+
onKeydown(event) {
|
|
2694
|
+
if (this.disabled())
|
|
2695
|
+
return;
|
|
2696
|
+
if (event.key === 'Enter' || event.key === ',') {
|
|
2697
|
+
event.preventDefault();
|
|
2698
|
+
this.commitTag();
|
|
2699
|
+
}
|
|
2700
|
+
else if (event.key === 'Backspace' && !this.inputValue) {
|
|
2701
|
+
// Remove last tag on backspace when input is empty
|
|
2702
|
+
const tags = this.internalTags();
|
|
2703
|
+
if (tags.length > 0) {
|
|
2704
|
+
this.removeTag(tags[tags.length - 1]);
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
onBlur() {
|
|
2709
|
+
this.isFocused.set(false);
|
|
2710
|
+
// Commit any pending text on blur
|
|
2711
|
+
if (this.inputValue.trim()) {
|
|
2712
|
+
this.commitTag();
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
commitTag() {
|
|
2716
|
+
const raw = this.inputValue.replace(/,/g, '').trim();
|
|
2717
|
+
if (!raw)
|
|
2718
|
+
return;
|
|
2719
|
+
if (this.isAtMax())
|
|
2720
|
+
return;
|
|
2721
|
+
if (!this.allowDuplicates() && this.internalTags().includes(raw)) {
|
|
2722
|
+
this.inputValue = '';
|
|
2723
|
+
return;
|
|
2724
|
+
}
|
|
2725
|
+
const newTags = [...this.internalTags(), raw];
|
|
2726
|
+
this.internalTags.set(newTags);
|
|
2727
|
+
this.inputValue = '';
|
|
2728
|
+
this.tagsChange.emit(newTags);
|
|
2729
|
+
this.tagAdded.emit(raw);
|
|
2730
|
+
}
|
|
2731
|
+
removeTag(tag, event) {
|
|
2732
|
+
event?.stopPropagation();
|
|
2733
|
+
const newTags = this.internalTags().filter(t => t !== tag);
|
|
2734
|
+
this.internalTags.set(newTags);
|
|
2735
|
+
this.tagsChange.emit(newTags);
|
|
2736
|
+
this.tagRemoved.emit(tag);
|
|
2737
|
+
}
|
|
2738
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TagInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2739
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: TagInputComponent, isStandalone: true, selector: "ngx-tag-input", inputs: { tags: { classPropertyName: "tags", publicName: "tags", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, maxTags: { classPropertyName: "maxTags", publicName: "maxTags", isSignal: true, isRequired: false, transformFunction: null }, allowDuplicates: { classPropertyName: "allowDuplicates", publicName: "allowDuplicates", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { tagsChange: "tagsChange", tagAdded: "tagAdded", tagRemoved: "tagRemoved" }, ngImport: i0, template: `
|
|
2740
|
+
<div
|
|
2741
|
+
class="ngx-tag-input"
|
|
2742
|
+
[class.dark]="theme() === 'dark'"
|
|
2743
|
+
[class.disabled]="disabled()"
|
|
2744
|
+
[class.focused]="isFocused()"
|
|
2745
|
+
(click)="focusInput()"
|
|
2746
|
+
>
|
|
2747
|
+
<!-- Existing chips -->
|
|
2748
|
+
@for (tag of internalTags(); track tag + $index) {
|
|
2749
|
+
<span class="ngx-tag-chip">
|
|
2750
|
+
<span class="ngx-tag-chip__label">{{ tag }}</span>
|
|
2751
|
+
@if (!disabled()) {
|
|
2752
|
+
<button
|
|
2753
|
+
type="button"
|
|
2754
|
+
class="ngx-tag-chip__remove"
|
|
2755
|
+
(click)="removeTag(tag, $event)"
|
|
2756
|
+
[attr.aria-label]="'Remove ' + tag"
|
|
2757
|
+
>✕</button>
|
|
2758
|
+
}
|
|
2759
|
+
</span>
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2762
|
+
<!-- Text input -->
|
|
2763
|
+
@if (!isAtMax()) {
|
|
2764
|
+
<input
|
|
2765
|
+
#tagInput
|
|
2766
|
+
class="ngx-tag-input__field"
|
|
2767
|
+
type="text"
|
|
2768
|
+
[placeholder]="internalTags().length === 0 ? placeholder() : ''"
|
|
2769
|
+
[disabled]="disabled()"
|
|
2770
|
+
[(ngModel)]="inputValue"
|
|
2771
|
+
(keydown)="onKeydown($event)"
|
|
2772
|
+
(focus)="isFocused.set(true)"
|
|
2773
|
+
(blur)="onBlur()"
|
|
2774
|
+
/>
|
|
2775
|
+
}
|
|
2776
|
+
|
|
2777
|
+
<!-- Max tags hint -->
|
|
2778
|
+
@if (isAtMax() && !disabled()) {
|
|
2779
|
+
<span class="ngx-tag-input__max-hint">Max {{ maxTags() }} tags</span>
|
|
2780
|
+
}
|
|
2781
|
+
</div>
|
|
2782
|
+
`, isInline: true, styles: [":host{display:block}.ngx-tag-input{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:8px 12px;min-height:44px;border-radius:10px;border:1.5px solid var(--ngx-tag-border, hsl(220, 15%, 82%));background:var(--ngx-tag-bg, #ffffff);font-family:var(--ngx-font-family, system-ui, sans-serif);cursor:text;transition:border-color .18s ease,box-shadow .18s ease}.ngx-tag-input.focused{border-color:var(--ngx-tag-focus-border, hsl(250, 70%, 58%));box-shadow:0 0 0 3px var(--primary-glow, rgba(124, 95, 240, .15));outline:none}.ngx-tag-input.disabled{background:var(--ngx-tag-disabled-bg, hsl(220, 15%, 97%));border-color:var(--ngx-tag-disabled-border, hsl(220, 10%, 88%));cursor:not-allowed;opacity:.72}.ngx-tag-input.dark{background:var(--ngx-tag-dark-bg, hsl(225, 20%, 14%));border-color:var(--ngx-tag-dark-border, hsl(225, 15%, 28%))}.ngx-tag-input.dark.focused{border-color:var(--ngx-tag-focus-border, hsl(250, 65%, 65%));box-shadow:0 0 0 3px #7c5ff038}.ngx-tag-input.dark.disabled{background:#15171e;border-color:#31353f}.ngx-tag-chip{display:inline-flex;align-items:center;gap:4px;padding:3px 8px 3px 10px;background:var(--ngx-tag-chip-bg, hsl(250, 65%, 94%));color:var(--ngx-tag-chip-color, hsl(250, 55%, 38%));border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap;border:1px solid var(--ngx-tag-chip-border, hsl(250, 55%, 85%));transition:background .15s ease,border-color .15s ease;animation:chip-pop .18s cubic-bezier(.34,1.56,.64,1)}.dark .ngx-tag-chip{background:var(--ngx-tag-chip-dark-bg, hsl(250, 45%, 20%));color:var(--ngx-tag-chip-dark-color, hsl(250, 75%, 80%));border-color:#362a6f}@keyframes chip-pop{0%{transform:scale(.7);opacity:0}to{transform:scale(1);opacity:1}}.ngx-tag-chip__label{max-width:160px;overflow:hidden;text-overflow:ellipsis}.ngx-tag-chip__remove{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;background:transparent;border:none;border-radius:50%;color:inherit;font-size:9px;line-height:1;cursor:pointer;opacity:.5;transition:opacity .12s ease,background .12s ease;flex-shrink:0}.ngx-tag-chip__remove:hover{opacity:1;background:#0000001a}.dark .ngx-tag-chip__remove:hover{background:#ffffff1f}.ngx-tag-input__field{flex:1;min-width:100px;border:none;outline:none;background:transparent;font-size:13px;font-family:inherit;color:var(--ngx-tag-input-color, hsl(220, 20%, 18%));padding:2px 0}.ngx-tag-input__field::placeholder{color:var(--ngx-tag-placeholder-color, hsl(220, 12%, 65%))}.ngx-tag-input__field:disabled{cursor:not-allowed}.dark .ngx-tag-input__field{color:var(--ngx-tag-input-dark-color, hsl(220, 15%, 88%))}.dark .ngx-tag-input__field::placeholder{color:#6c7689}.ngx-tag-input__max-hint{font-size:11px;font-style:italic;color:#89909f;padding:2px 4px;align-self:center}.dark .ngx-tag-input__max-hint{color:#6e7687}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2783
|
+
}
|
|
2784
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TagInputComponent, decorators: [{
|
|
2785
|
+
type: Component,
|
|
2786
|
+
args: [{ selector: 'ngx-tag-input', standalone: true, imports: [CommonModule, FormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
2787
|
+
<div
|
|
2788
|
+
class="ngx-tag-input"
|
|
2789
|
+
[class.dark]="theme() === 'dark'"
|
|
2790
|
+
[class.disabled]="disabled()"
|
|
2791
|
+
[class.focused]="isFocused()"
|
|
2792
|
+
(click)="focusInput()"
|
|
2793
|
+
>
|
|
2794
|
+
<!-- Existing chips -->
|
|
2795
|
+
@for (tag of internalTags(); track tag + $index) {
|
|
2796
|
+
<span class="ngx-tag-chip">
|
|
2797
|
+
<span class="ngx-tag-chip__label">{{ tag }}</span>
|
|
2798
|
+
@if (!disabled()) {
|
|
2799
|
+
<button
|
|
2800
|
+
type="button"
|
|
2801
|
+
class="ngx-tag-chip__remove"
|
|
2802
|
+
(click)="removeTag(tag, $event)"
|
|
2803
|
+
[attr.aria-label]="'Remove ' + tag"
|
|
2804
|
+
>✕</button>
|
|
2805
|
+
}
|
|
2806
|
+
</span>
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
<!-- Text input -->
|
|
2810
|
+
@if (!isAtMax()) {
|
|
2811
|
+
<input
|
|
2812
|
+
#tagInput
|
|
2813
|
+
class="ngx-tag-input__field"
|
|
2814
|
+
type="text"
|
|
2815
|
+
[placeholder]="internalTags().length === 0 ? placeholder() : ''"
|
|
2816
|
+
[disabled]="disabled()"
|
|
2817
|
+
[(ngModel)]="inputValue"
|
|
2818
|
+
(keydown)="onKeydown($event)"
|
|
2819
|
+
(focus)="isFocused.set(true)"
|
|
2820
|
+
(blur)="onBlur()"
|
|
2821
|
+
/>
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
<!-- Max tags hint -->
|
|
2825
|
+
@if (isAtMax() && !disabled()) {
|
|
2826
|
+
<span class="ngx-tag-input__max-hint">Max {{ maxTags() }} tags</span>
|
|
2827
|
+
}
|
|
2828
|
+
</div>
|
|
2829
|
+
`, styles: [":host{display:block}.ngx-tag-input{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:8px 12px;min-height:44px;border-radius:10px;border:1.5px solid var(--ngx-tag-border, hsl(220, 15%, 82%));background:var(--ngx-tag-bg, #ffffff);font-family:var(--ngx-font-family, system-ui, sans-serif);cursor:text;transition:border-color .18s ease,box-shadow .18s ease}.ngx-tag-input.focused{border-color:var(--ngx-tag-focus-border, hsl(250, 70%, 58%));box-shadow:0 0 0 3px var(--primary-glow, rgba(124, 95, 240, .15));outline:none}.ngx-tag-input.disabled{background:var(--ngx-tag-disabled-bg, hsl(220, 15%, 97%));border-color:var(--ngx-tag-disabled-border, hsl(220, 10%, 88%));cursor:not-allowed;opacity:.72}.ngx-tag-input.dark{background:var(--ngx-tag-dark-bg, hsl(225, 20%, 14%));border-color:var(--ngx-tag-dark-border, hsl(225, 15%, 28%))}.ngx-tag-input.dark.focused{border-color:var(--ngx-tag-focus-border, hsl(250, 65%, 65%));box-shadow:0 0 0 3px #7c5ff038}.ngx-tag-input.dark.disabled{background:#15171e;border-color:#31353f}.ngx-tag-chip{display:inline-flex;align-items:center;gap:4px;padding:3px 8px 3px 10px;background:var(--ngx-tag-chip-bg, hsl(250, 65%, 94%));color:var(--ngx-tag-chip-color, hsl(250, 55%, 38%));border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap;border:1px solid var(--ngx-tag-chip-border, hsl(250, 55%, 85%));transition:background .15s ease,border-color .15s ease;animation:chip-pop .18s cubic-bezier(.34,1.56,.64,1)}.dark .ngx-tag-chip{background:var(--ngx-tag-chip-dark-bg, hsl(250, 45%, 20%));color:var(--ngx-tag-chip-dark-color, hsl(250, 75%, 80%));border-color:#362a6f}@keyframes chip-pop{0%{transform:scale(.7);opacity:0}to{transform:scale(1);opacity:1}}.ngx-tag-chip__label{max-width:160px;overflow:hidden;text-overflow:ellipsis}.ngx-tag-chip__remove{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;background:transparent;border:none;border-radius:50%;color:inherit;font-size:9px;line-height:1;cursor:pointer;opacity:.5;transition:opacity .12s ease,background .12s ease;flex-shrink:0}.ngx-tag-chip__remove:hover{opacity:1;background:#0000001a}.dark .ngx-tag-chip__remove:hover{background:#ffffff1f}.ngx-tag-input__field{flex:1;min-width:100px;border:none;outline:none;background:transparent;font-size:13px;font-family:inherit;color:var(--ngx-tag-input-color, hsl(220, 20%, 18%));padding:2px 0}.ngx-tag-input__field::placeholder{color:var(--ngx-tag-placeholder-color, hsl(220, 12%, 65%))}.ngx-tag-input__field:disabled{cursor:not-allowed}.dark .ngx-tag-input__field{color:var(--ngx-tag-input-dark-color, hsl(220, 15%, 88%))}.dark .ngx-tag-input__field::placeholder{color:#6c7689}.ngx-tag-input__max-hint{font-size:11px;font-style:italic;color:#89909f;padding:2px 4px;align-self:center}.dark .ngx-tag-input__max-hint{color:#6e7687}\n"] }]
|
|
2830
|
+
}] });
|
|
2831
|
+
|
|
2832
|
+
class FilePreviewComponent {
|
|
2833
|
+
// Inputs
|
|
2834
|
+
files = input(null);
|
|
2835
|
+
layout = input('grid');
|
|
2836
|
+
allowDelete = input(true);
|
|
2837
|
+
allowDownload = input(true);
|
|
2838
|
+
theme = input('light');
|
|
2839
|
+
// Outputs
|
|
2840
|
+
delete = output();
|
|
2841
|
+
download = output();
|
|
2842
|
+
// Object URL cache to prevent leaks and repeat generations
|
|
2843
|
+
objectUrlCache = new Map();
|
|
2844
|
+
// Map inputs to local standardized objects
|
|
2845
|
+
previewFiles = computed(() => {
|
|
2846
|
+
const rawFiles = this.files() || [];
|
|
2847
|
+
return rawFiles.map((file, idx) => {
|
|
2848
|
+
if (file instanceof File) {
|
|
2849
|
+
return {
|
|
2850
|
+
id: `${file.name}-${idx}-${file.size}`,
|
|
2851
|
+
name: file.name,
|
|
2852
|
+
size: file.size,
|
|
2853
|
+
type: file.type,
|
|
2854
|
+
progress: 100,
|
|
2855
|
+
status: 'success',
|
|
2856
|
+
formattedSize: this.formatBytes(file.size),
|
|
2857
|
+
fileObject: file,
|
|
2858
|
+
thumbnailUrl: file.type.startsWith('image/') ? this.getObjectUrl(file) : undefined,
|
|
2859
|
+
};
|
|
2860
|
+
}
|
|
2861
|
+
else {
|
|
2862
|
+
// UploadFileItem
|
|
2863
|
+
let thumbUrl = undefined;
|
|
2864
|
+
if (file.fileObject && file.type.startsWith('image/')) {
|
|
2865
|
+
thumbUrl = this.getObjectUrl(file.fileObject);
|
|
2866
|
+
}
|
|
2867
|
+
return {
|
|
2868
|
+
id: file.id || `${file.name}-${idx}`,
|
|
2869
|
+
name: file.name,
|
|
2870
|
+
size: file.size,
|
|
2871
|
+
type: file.type,
|
|
2872
|
+
progress: file.progress !== undefined ? file.progress : 100,
|
|
2873
|
+
status: file.status || 'success',
|
|
2874
|
+
errorMessage: file.errorMessage,
|
|
2875
|
+
formattedSize: file.formattedSize || this.formatBytes(file.size),
|
|
2876
|
+
fileObject: file.fileObject,
|
|
2877
|
+
thumbnailUrl: thumbUrl,
|
|
2878
|
+
};
|
|
2879
|
+
}
|
|
2880
|
+
});
|
|
2881
|
+
});
|
|
2882
|
+
ngOnDestroy() {
|
|
2883
|
+
this.objectUrlCache.forEach((url) => URL.revokeObjectURL(url));
|
|
2884
|
+
this.objectUrlCache.clear();
|
|
2885
|
+
}
|
|
2886
|
+
onDelete(item) {
|
|
2887
|
+
// Emit original item if possible or the constructed item
|
|
2888
|
+
const orig = this.findOriginal(item);
|
|
2889
|
+
this.delete.emit(orig);
|
|
2890
|
+
}
|
|
2891
|
+
onDownload(item) {
|
|
2892
|
+
const orig = this.findOriginal(item);
|
|
2893
|
+
this.download.emit(orig);
|
|
2894
|
+
}
|
|
2895
|
+
getFileDetails(item) {
|
|
2896
|
+
const type = item.type || '';
|
|
2897
|
+
const name = item.name || '';
|
|
2898
|
+
const ext = name.split('.').pop()?.toLowerCase() || '';
|
|
2899
|
+
if (type.startsWith('image/')) {
|
|
2900
|
+
return { label: 'IMG', color: '#3b82f6', icon: '🖼️' };
|
|
2901
|
+
}
|
|
2902
|
+
if (type === 'application/pdf' || ext === 'pdf') {
|
|
2903
|
+
return { label: 'PDF', color: '#ef4444', icon: '📄' };
|
|
2904
|
+
}
|
|
2905
|
+
if (type.includes('word') || type.includes('document') || ['doc', 'docx', 'txt', 'rtf'].includes(ext)) {
|
|
2906
|
+
return { label: 'DOC', color: '#2563eb', icon: '📝' };
|
|
2907
|
+
}
|
|
2908
|
+
if (type.includes('sheet') || type.includes('excel') || ['xls', 'xlsx', 'csv'].includes(ext)) {
|
|
2909
|
+
return { label: 'XLS', color: '#16a34a', icon: '📊' };
|
|
2910
|
+
}
|
|
2911
|
+
if (type.includes('presentation') || type.includes('powerpoint') || ['ppt', 'pptx'].includes(ext)) {
|
|
2912
|
+
return { label: 'PPT', color: '#ea580c', icon: '🎭' };
|
|
2913
|
+
}
|
|
2914
|
+
if (type.includes('zip') || type.includes('compressed') || type.includes('tar') || ['zip', 'rar', '7z', 'tar', 'gz'].includes(ext)) {
|
|
2915
|
+
return { label: 'ZIP', color: '#7c3aed', icon: '📦' };
|
|
2916
|
+
}
|
|
2917
|
+
if (type.includes('javascript') ||
|
|
2918
|
+
type.includes('typescript') ||
|
|
2919
|
+
type.includes('json') ||
|
|
2920
|
+
['js', 'ts', 'html', 'css', 'json', 'py', 'go', 'rs', 'cpp'].includes(ext)) {
|
|
2921
|
+
return { label: 'CODE', color: '#0f172a', icon: '💻' };
|
|
2922
|
+
}
|
|
2923
|
+
if (type.startsWith('audio/') || ['mp3', 'wav', 'ogg', 'm4a'].includes(ext)) {
|
|
2924
|
+
return { label: 'AUDIO', color: '#06b6d4', icon: '🎵' };
|
|
2925
|
+
}
|
|
2926
|
+
if (type.startsWith('video/') || ['mp4', 'mkv', 'avi', 'mov'].includes(ext)) {
|
|
2927
|
+
return { label: 'VIDEO', color: '#6366f1', icon: '🎥' };
|
|
2928
|
+
}
|
|
2929
|
+
return { label: 'FILE', color: '#64748b', icon: '📁' };
|
|
2930
|
+
}
|
|
2931
|
+
getObjectUrl(file) {
|
|
2932
|
+
if (this.objectUrlCache.has(file)) {
|
|
2933
|
+
return this.objectUrlCache.get(file);
|
|
2934
|
+
}
|
|
2935
|
+
const url = URL.createObjectURL(file);
|
|
2936
|
+
this.objectUrlCache.set(file, url);
|
|
2937
|
+
return url;
|
|
2938
|
+
}
|
|
2939
|
+
findOriginal(item) {
|
|
2940
|
+
const list = this.files() || [];
|
|
2941
|
+
// Search original items in the list
|
|
2942
|
+
for (const f of list) {
|
|
2943
|
+
if (f instanceof File) {
|
|
2944
|
+
if (f === item.fileObject)
|
|
2945
|
+
return f;
|
|
2946
|
+
}
|
|
2947
|
+
else {
|
|
2948
|
+
if (f.id === item.id || (f.name === item.name && f.size === item.size)) {
|
|
2949
|
+
return f;
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
return item;
|
|
2954
|
+
}
|
|
2955
|
+
formatBytes(bytes, decimals = 2) {
|
|
2956
|
+
if (bytes === 0)
|
|
2957
|
+
return '0 Bytes';
|
|
2958
|
+
const k = 1024;
|
|
2959
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
2960
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
2961
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
2962
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
|
2963
|
+
}
|
|
2964
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FilePreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2965
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: FilePreviewComponent, isStandalone: true, selector: "ngx-file-preview", inputs: { files: { classPropertyName: "files", publicName: "files", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, allowDelete: { classPropertyName: "allowDelete", publicName: "allowDelete", isSignal: true, isRequired: false, transformFunction: null }, allowDownload: { classPropertyName: "allowDownload", publicName: "allowDownload", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { delete: "delete", download: "download" }, ngImport: i0, template: `
|
|
2966
|
+
<div
|
|
2967
|
+
class="ngx-file-preview"
|
|
2968
|
+
[class.dark]="theme() === 'dark'"
|
|
2969
|
+
[class]="layout()"
|
|
2970
|
+
>
|
|
2971
|
+
@if (previewFiles().length === 0) {
|
|
2972
|
+
<div class="ngx-file-preview__empty">
|
|
2973
|
+
<svg viewBox="0 0 24 24" width="32" height="32" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
2974
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
|
2975
|
+
<polyline points="17 8 12 3 7 8"/>
|
|
2976
|
+
<line x1="12" y1="3" x2="12" y2="15"/>
|
|
2977
|
+
</svg>
|
|
2978
|
+
<span class="ngx-file-preview__empty-text">No files selected</span>
|
|
2979
|
+
</div>
|
|
2980
|
+
} @else {
|
|
2981
|
+
<div class="ngx-file-preview__grid-container">
|
|
2982
|
+
@for (item of previewFiles(); track item.id) {
|
|
2983
|
+
<div
|
|
2984
|
+
class="ngx-file-preview__card"
|
|
2985
|
+
[class]="item.status"
|
|
2986
|
+
>
|
|
2987
|
+
<!-- Image Thumbnail or Icon -->
|
|
2988
|
+
<div class="ngx-file-preview__media-wrapper">
|
|
2989
|
+
@if (item.thumbnailUrl) {
|
|
2990
|
+
<div
|
|
2991
|
+
class="ngx-file-preview__thumbnail"
|
|
2992
|
+
[style.backgroundImage]="'url(' + item.thumbnailUrl + ')'"
|
|
2993
|
+
></div>
|
|
2994
|
+
} @else {
|
|
2995
|
+
<div
|
|
2996
|
+
class="ngx-file-preview__icon-fallback"
|
|
2997
|
+
[style.background-color]="getFileDetails(item).color + '15'"
|
|
2998
|
+
[style.color]="getFileDetails(item).color"
|
|
2999
|
+
>
|
|
3000
|
+
<span class="file-icon-symbol">{{ getFileDetails(item).icon }}</span>
|
|
3001
|
+
<span class="file-icon-badge">{{ getFileDetails(item).label }}</span>
|
|
3002
|
+
</div>
|
|
3003
|
+
}
|
|
3004
|
+
|
|
3005
|
+
<!-- Delete & Download Hover Actions Overlay -->
|
|
3006
|
+
<div class="ngx-file-preview__overlay-actions">
|
|
3007
|
+
@if (allowDownload() && item.status === 'success') {
|
|
3008
|
+
<button
|
|
3009
|
+
class="ngx-file-preview__action-btn btn-download"
|
|
3010
|
+
(click)="onDownload(item)"
|
|
3011
|
+
aria-label="Download file"
|
|
3012
|
+
>
|
|
3013
|
+
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2">
|
|
3014
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
|
3015
|
+
<polyline points="7 10 12 15 17 10"/>
|
|
3016
|
+
<line x1="12" y1="15" x2="12" y2="3"/>
|
|
3017
|
+
</svg>
|
|
3018
|
+
</button>
|
|
3019
|
+
}
|
|
3020
|
+
@if (allowDelete()) {
|
|
3021
|
+
<button
|
|
3022
|
+
class="ngx-file-preview__action-btn btn-delete"
|
|
3023
|
+
(click)="onDelete(item)"
|
|
3024
|
+
aria-label="Delete file"
|
|
3025
|
+
>
|
|
3026
|
+
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2">
|
|
3027
|
+
<polyline points="3 6 5 6 21 6" />
|
|
3028
|
+
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
|
|
3029
|
+
</svg>
|
|
3030
|
+
</button>
|
|
3031
|
+
}
|
|
3032
|
+
</div>
|
|
3033
|
+
</div>
|
|
3034
|
+
|
|
3035
|
+
<!-- Content details -->
|
|
3036
|
+
<div class="ngx-file-preview__details">
|
|
3037
|
+
<div class="ngx-file-preview__meta">
|
|
3038
|
+
<span class="ngx-file-preview__name" [title]="item.name">{{ item.name }}</span>
|
|
3039
|
+
<span class="ngx-file-preview__size">{{ item.formattedSize }}</span>
|
|
3040
|
+
</div>
|
|
3041
|
+
|
|
3042
|
+
<!-- Status details / upload meter -->
|
|
3043
|
+
@if (item.status === 'uploading') {
|
|
3044
|
+
<div class="ngx-file-preview__progress-wrap">
|
|
3045
|
+
<div class="ngx-file-preview__progress-bar">
|
|
3046
|
+
<div class="ngx-file-preview__progress-fill" [style.width.%]="item.progress"></div>
|
|
3047
|
+
</div>
|
|
3048
|
+
<span class="ngx-file-preview__progress-text">{{ item.progress }}%</span>
|
|
3049
|
+
</div>
|
|
3050
|
+
} @else if (item.status === 'error') {
|
|
3051
|
+
<span class="ngx-file-preview__error-msg">
|
|
3052
|
+
⚠️ {{ item.errorMessage || 'Upload failed' }}
|
|
3053
|
+
</span>
|
|
3054
|
+
} @else {
|
|
3055
|
+
<div class="ngx-file-preview__status-row">
|
|
3056
|
+
<span class="status-indicator" [class]="item.status"></span>
|
|
3057
|
+
<span class="status-label">{{ item.status }}</span>
|
|
3058
|
+
</div>
|
|
3059
|
+
}
|
|
3060
|
+
</div>
|
|
3061
|
+
</div>
|
|
3062
|
+
}
|
|
3063
|
+
</div>
|
|
3064
|
+
}
|
|
3065
|
+
</div>
|
|
3066
|
+
`, isInline: true, styles: [":host{display:block;width:100%}.ngx-file-preview{width:100%;font-family:var(--ngx-font-family, system-ui, sans-serif)}.ngx-file-preview__empty{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px;border:2px dashed rgba(0,0,0,.1);border-radius:12px;color:#64748b;background:#fff3}.dark .ngx-file-preview__empty{border-color:#ffffff14;color:#94a3b8;background:#0f172a26}.ngx-file-preview__empty svg{margin-bottom:8px;stroke:#94a3b8}.ngx-file-preview__empty-text{font-size:13px;font-weight:500}.ngx-file-preview__grid-container{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:16px}.ngx-file-preview__card{display:flex;flex-direction:column;border-radius:12px;overflow:hidden;background:#ffffffb3;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border:1px solid rgba(0,0,0,.06);box-shadow:0 4px 6px -1px #00000008,0 2px 4px -1px #00000005;transition:all .2s ease}.ngx-file-preview__card:hover{transform:translateY(-2px);box-shadow:0 10px 15px -3px #0000000d,0 4px 6px -4px #0000000d;border-color:#0000001f}.dark .ngx-file-preview__card{background:#1e2030d9;border-color:#ffffff0f}.dark .ngx-file-preview__card:hover{border-color:#ffffff1f}.ngx-file-preview__media-wrapper{position:relative;width:100%;height:120px;background:#f8fafc;overflow:hidden;display:flex;align-items:center;justify-content:center}.dark .ngx-file-preview__media-wrapper{background:#1e293b}.ngx-file-preview__thumbnail{width:100%;height:100%;background-size:cover;background-position:center;background-repeat:no-repeat}.ngx-file-preview__icon-fallback{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%;font-weight:700}.file-icon-symbol{font-size:36px;line-height:1;margin-bottom:4px}.file-icon-badge{font-size:10px;padding:2px 6px;border-radius:4px;background:#0000000d;text-transform:uppercase;letter-spacing:.5px}.dark .file-icon-badge{background:#ffffff1a}.ngx-file-preview__overlay-actions{position:absolute;top:0;left:0;width:100%;height:100%;background:#0f172a66;display:flex;align-items:center;justify-content:center;gap:12px;opacity:0;transition:opacity .2s ease;z-index:5}.ngx-file-preview__media-wrapper:hover .ngx-file-preview__overlay-actions{opacity:1}.ngx-file-preview__action-btn{width:34px;height:34px;border-radius:50%;border:none;background:#ffffffe6;color:#0f172a;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .2s cubic-bezier(.4,0,.2,1);box-shadow:0 4px 6px #0000001a}.ngx-file-preview__action-btn:hover{transform:scale(1.1);background:#fff}.ngx-file-preview__action-btn.btn-delete:hover{background:#ef4444;color:#fff}.ngx-file-preview__action-btn.btn-download:hover{background:var(--primary-color, #3b82f6);color:#fff}.ngx-file-preview__details{padding:12px;display:flex;flex-direction:column;gap:6px;flex-grow:1}.ngx-file-preview__meta{display:flex;justify-content:space-between;align-items:baseline;gap:8px}.ngx-file-preview__name{font-size:13px;font-weight:600;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-grow:1}.dark .ngx-file-preview__name{color:#f8fafc}.ngx-file-preview__size{font-size:11px;font-weight:500;color:#64748b;white-space:nowrap}.dark .ngx-file-preview__size{color:#94a3b8}.ngx-file-preview__progress-wrap{display:flex;align-items:center;gap:8px;width:100%}.ngx-file-preview__progress-bar{flex-grow:1;height:4px;border-radius:2px;background:#0000000d;overflow:hidden}.dark .ngx-file-preview__progress-bar{background:#ffffff14}.ngx-file-preview__progress-fill{height:100%;background:var(--primary-color, #3b82f6);transition:width .2s ease}.ngx-file-preview__progress-text{font-size:10px;font-weight:600;color:#64748b;width:28px;text-align:right}.ngx-file-preview__error-msg{font-size:11px;color:#ef4444;font-weight:500}.ngx-file-preview__status-row{display:flex;align-items:center;gap:6px;font-size:11px;font-weight:600;text-transform:capitalize;color:#64748b}.dark .ngx-file-preview__status-row{color:#94a3b8}.status-indicator{width:6px;height:6px;border-radius:50%;background:#64748b}.status-indicator.success{background:#10b981}.status-indicator.pending{background:#f59e0b}.ngx-file-preview.list .ngx-file-preview__grid-container{display:flex;flex-direction:column;gap:8px}.ngx-file-preview.list .ngx-file-preview__card{flex-direction:row;align-items:center;padding:8px 12px;gap:12px}.ngx-file-preview.list .ngx-file-preview__card:hover{transform:translate(2px) translateY(0)}.ngx-file-preview.list .ngx-file-preview__media-wrapper{width:42px;height:42px;border-radius:6px;flex-shrink:0}.ngx-file-preview.list .file-icon-symbol{font-size:20px;margin:0}.ngx-file-preview.list .file-icon-badge{display:none}.ngx-file-preview.list .ngx-file-preview__details{padding:0;flex-direction:row;align-items:center;justify-content:space-between;width:100%;gap:16px}.ngx-file-preview.list .ngx-file-preview__meta{flex-grow:1;width:30%;flex-direction:column;gap:2px}.ngx-file-preview.list .ngx-file-preview__progress-wrap{width:120px;flex-shrink:0}.ngx-file-preview.list .ngx-file-preview__overlay-actions{position:static;opacity:1;background:transparent;box-shadow:none;width:auto;height:auto;gap:6px;margin-left:auto}.ngx-file-preview.list .ngx-file-preview__action-btn{width:30px;height:30px;box-shadow:none;border:1px solid rgba(0,0,0,.05);background:#00000005}.dark .ngx-file-preview.list .ngx-file-preview__action-btn{border-color:#ffffff0f;background:#ffffff05;color:#cbd5e1}.ngx-file-preview.list .ngx-file-preview__action-btn:hover{transform:scale(1.05)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3067
|
+
}
|
|
3068
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FilePreviewComponent, decorators: [{
|
|
3069
|
+
type: Component,
|
|
3070
|
+
args: [{ selector: 'ngx-file-preview', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
3071
|
+
<div
|
|
3072
|
+
class="ngx-file-preview"
|
|
3073
|
+
[class.dark]="theme() === 'dark'"
|
|
3074
|
+
[class]="layout()"
|
|
3075
|
+
>
|
|
3076
|
+
@if (previewFiles().length === 0) {
|
|
3077
|
+
<div class="ngx-file-preview__empty">
|
|
3078
|
+
<svg viewBox="0 0 24 24" width="32" height="32" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
3079
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
|
3080
|
+
<polyline points="17 8 12 3 7 8"/>
|
|
3081
|
+
<line x1="12" y1="3" x2="12" y2="15"/>
|
|
3082
|
+
</svg>
|
|
3083
|
+
<span class="ngx-file-preview__empty-text">No files selected</span>
|
|
3084
|
+
</div>
|
|
3085
|
+
} @else {
|
|
3086
|
+
<div class="ngx-file-preview__grid-container">
|
|
3087
|
+
@for (item of previewFiles(); track item.id) {
|
|
3088
|
+
<div
|
|
3089
|
+
class="ngx-file-preview__card"
|
|
3090
|
+
[class]="item.status"
|
|
3091
|
+
>
|
|
3092
|
+
<!-- Image Thumbnail or Icon -->
|
|
3093
|
+
<div class="ngx-file-preview__media-wrapper">
|
|
3094
|
+
@if (item.thumbnailUrl) {
|
|
3095
|
+
<div
|
|
3096
|
+
class="ngx-file-preview__thumbnail"
|
|
3097
|
+
[style.backgroundImage]="'url(' + item.thumbnailUrl + ')'"
|
|
3098
|
+
></div>
|
|
3099
|
+
} @else {
|
|
3100
|
+
<div
|
|
3101
|
+
class="ngx-file-preview__icon-fallback"
|
|
3102
|
+
[style.background-color]="getFileDetails(item).color + '15'"
|
|
3103
|
+
[style.color]="getFileDetails(item).color"
|
|
3104
|
+
>
|
|
3105
|
+
<span class="file-icon-symbol">{{ getFileDetails(item).icon }}</span>
|
|
3106
|
+
<span class="file-icon-badge">{{ getFileDetails(item).label }}</span>
|
|
3107
|
+
</div>
|
|
3108
|
+
}
|
|
3109
|
+
|
|
3110
|
+
<!-- Delete & Download Hover Actions Overlay -->
|
|
3111
|
+
<div class="ngx-file-preview__overlay-actions">
|
|
3112
|
+
@if (allowDownload() && item.status === 'success') {
|
|
3113
|
+
<button
|
|
3114
|
+
class="ngx-file-preview__action-btn btn-download"
|
|
3115
|
+
(click)="onDownload(item)"
|
|
3116
|
+
aria-label="Download file"
|
|
3117
|
+
>
|
|
3118
|
+
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2">
|
|
3119
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
|
3120
|
+
<polyline points="7 10 12 15 17 10"/>
|
|
3121
|
+
<line x1="12" y1="15" x2="12" y2="3"/>
|
|
3122
|
+
</svg>
|
|
3123
|
+
</button>
|
|
3124
|
+
}
|
|
3125
|
+
@if (allowDelete()) {
|
|
3126
|
+
<button
|
|
3127
|
+
class="ngx-file-preview__action-btn btn-delete"
|
|
3128
|
+
(click)="onDelete(item)"
|
|
3129
|
+
aria-label="Delete file"
|
|
3130
|
+
>
|
|
3131
|
+
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2">
|
|
3132
|
+
<polyline points="3 6 5 6 21 6" />
|
|
3133
|
+
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
|
|
3134
|
+
</svg>
|
|
3135
|
+
</button>
|
|
3136
|
+
}
|
|
3137
|
+
</div>
|
|
3138
|
+
</div>
|
|
3139
|
+
|
|
3140
|
+
<!-- Content details -->
|
|
3141
|
+
<div class="ngx-file-preview__details">
|
|
3142
|
+
<div class="ngx-file-preview__meta">
|
|
3143
|
+
<span class="ngx-file-preview__name" [title]="item.name">{{ item.name }}</span>
|
|
3144
|
+
<span class="ngx-file-preview__size">{{ item.formattedSize }}</span>
|
|
3145
|
+
</div>
|
|
3146
|
+
|
|
3147
|
+
<!-- Status details / upload meter -->
|
|
3148
|
+
@if (item.status === 'uploading') {
|
|
3149
|
+
<div class="ngx-file-preview__progress-wrap">
|
|
3150
|
+
<div class="ngx-file-preview__progress-bar">
|
|
3151
|
+
<div class="ngx-file-preview__progress-fill" [style.width.%]="item.progress"></div>
|
|
3152
|
+
</div>
|
|
3153
|
+
<span class="ngx-file-preview__progress-text">{{ item.progress }}%</span>
|
|
3154
|
+
</div>
|
|
3155
|
+
} @else if (item.status === 'error') {
|
|
3156
|
+
<span class="ngx-file-preview__error-msg">
|
|
3157
|
+
⚠️ {{ item.errorMessage || 'Upload failed' }}
|
|
3158
|
+
</span>
|
|
3159
|
+
} @else {
|
|
3160
|
+
<div class="ngx-file-preview__status-row">
|
|
3161
|
+
<span class="status-indicator" [class]="item.status"></span>
|
|
3162
|
+
<span class="status-label">{{ item.status }}</span>
|
|
3163
|
+
</div>
|
|
3164
|
+
}
|
|
3165
|
+
</div>
|
|
3166
|
+
</div>
|
|
3167
|
+
}
|
|
3168
|
+
</div>
|
|
3169
|
+
}
|
|
3170
|
+
</div>
|
|
3171
|
+
`, styles: [":host{display:block;width:100%}.ngx-file-preview{width:100%;font-family:var(--ngx-font-family, system-ui, sans-serif)}.ngx-file-preview__empty{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px;border:2px dashed rgba(0,0,0,.1);border-radius:12px;color:#64748b;background:#fff3}.dark .ngx-file-preview__empty{border-color:#ffffff14;color:#94a3b8;background:#0f172a26}.ngx-file-preview__empty svg{margin-bottom:8px;stroke:#94a3b8}.ngx-file-preview__empty-text{font-size:13px;font-weight:500}.ngx-file-preview__grid-container{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:16px}.ngx-file-preview__card{display:flex;flex-direction:column;border-radius:12px;overflow:hidden;background:#ffffffb3;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border:1px solid rgba(0,0,0,.06);box-shadow:0 4px 6px -1px #00000008,0 2px 4px -1px #00000005;transition:all .2s ease}.ngx-file-preview__card:hover{transform:translateY(-2px);box-shadow:0 10px 15px -3px #0000000d,0 4px 6px -4px #0000000d;border-color:#0000001f}.dark .ngx-file-preview__card{background:#1e2030d9;border-color:#ffffff0f}.dark .ngx-file-preview__card:hover{border-color:#ffffff1f}.ngx-file-preview__media-wrapper{position:relative;width:100%;height:120px;background:#f8fafc;overflow:hidden;display:flex;align-items:center;justify-content:center}.dark .ngx-file-preview__media-wrapper{background:#1e293b}.ngx-file-preview__thumbnail{width:100%;height:100%;background-size:cover;background-position:center;background-repeat:no-repeat}.ngx-file-preview__icon-fallback{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%;font-weight:700}.file-icon-symbol{font-size:36px;line-height:1;margin-bottom:4px}.file-icon-badge{font-size:10px;padding:2px 6px;border-radius:4px;background:#0000000d;text-transform:uppercase;letter-spacing:.5px}.dark .file-icon-badge{background:#ffffff1a}.ngx-file-preview__overlay-actions{position:absolute;top:0;left:0;width:100%;height:100%;background:#0f172a66;display:flex;align-items:center;justify-content:center;gap:12px;opacity:0;transition:opacity .2s ease;z-index:5}.ngx-file-preview__media-wrapper:hover .ngx-file-preview__overlay-actions{opacity:1}.ngx-file-preview__action-btn{width:34px;height:34px;border-radius:50%;border:none;background:#ffffffe6;color:#0f172a;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .2s cubic-bezier(.4,0,.2,1);box-shadow:0 4px 6px #0000001a}.ngx-file-preview__action-btn:hover{transform:scale(1.1);background:#fff}.ngx-file-preview__action-btn.btn-delete:hover{background:#ef4444;color:#fff}.ngx-file-preview__action-btn.btn-download:hover{background:var(--primary-color, #3b82f6);color:#fff}.ngx-file-preview__details{padding:12px;display:flex;flex-direction:column;gap:6px;flex-grow:1}.ngx-file-preview__meta{display:flex;justify-content:space-between;align-items:baseline;gap:8px}.ngx-file-preview__name{font-size:13px;font-weight:600;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-grow:1}.dark .ngx-file-preview__name{color:#f8fafc}.ngx-file-preview__size{font-size:11px;font-weight:500;color:#64748b;white-space:nowrap}.dark .ngx-file-preview__size{color:#94a3b8}.ngx-file-preview__progress-wrap{display:flex;align-items:center;gap:8px;width:100%}.ngx-file-preview__progress-bar{flex-grow:1;height:4px;border-radius:2px;background:#0000000d;overflow:hidden}.dark .ngx-file-preview__progress-bar{background:#ffffff14}.ngx-file-preview__progress-fill{height:100%;background:var(--primary-color, #3b82f6);transition:width .2s ease}.ngx-file-preview__progress-text{font-size:10px;font-weight:600;color:#64748b;width:28px;text-align:right}.ngx-file-preview__error-msg{font-size:11px;color:#ef4444;font-weight:500}.ngx-file-preview__status-row{display:flex;align-items:center;gap:6px;font-size:11px;font-weight:600;text-transform:capitalize;color:#64748b}.dark .ngx-file-preview__status-row{color:#94a3b8}.status-indicator{width:6px;height:6px;border-radius:50%;background:#64748b}.status-indicator.success{background:#10b981}.status-indicator.pending{background:#f59e0b}.ngx-file-preview.list .ngx-file-preview__grid-container{display:flex;flex-direction:column;gap:8px}.ngx-file-preview.list .ngx-file-preview__card{flex-direction:row;align-items:center;padding:8px 12px;gap:12px}.ngx-file-preview.list .ngx-file-preview__card:hover{transform:translate(2px) translateY(0)}.ngx-file-preview.list .ngx-file-preview__media-wrapper{width:42px;height:42px;border-radius:6px;flex-shrink:0}.ngx-file-preview.list .file-icon-symbol{font-size:20px;margin:0}.ngx-file-preview.list .file-icon-badge{display:none}.ngx-file-preview.list .ngx-file-preview__details{padding:0;flex-direction:row;align-items:center;justify-content:space-between;width:100%;gap:16px}.ngx-file-preview.list .ngx-file-preview__meta{flex-grow:1;width:30%;flex-direction:column;gap:2px}.ngx-file-preview.list .ngx-file-preview__progress-wrap{width:120px;flex-shrink:0}.ngx-file-preview.list .ngx-file-preview__overlay-actions{position:static;opacity:1;background:transparent;box-shadow:none;width:auto;height:auto;gap:6px;margin-left:auto}.ngx-file-preview.list .ngx-file-preview__action-btn{width:30px;height:30px;box-shadow:none;border:1px solid rgba(0,0,0,.05);background:#00000005}.dark .ngx-file-preview.list .ngx-file-preview__action-btn{border-color:#ffffff0f;background:#ffffff05;color:#cbd5e1}.ngx-file-preview.list .ngx-file-preview__action-btn:hover{transform:scale(1.05)}\n"] }]
|
|
3172
|
+
}] });
|
|
3173
|
+
|
|
3174
|
+
class SegmentedControlComponent {
|
|
3175
|
+
// Inputs
|
|
3176
|
+
options = input([]);
|
|
3177
|
+
value = model(null); // Signal-based model for two-way binding
|
|
3178
|
+
disabled = input(false);
|
|
3179
|
+
theme = input('light');
|
|
3180
|
+
variant = input('default');
|
|
3181
|
+
id = input('ngx-segmented-' + Math.random().toString(36).substring(2, 9));
|
|
3182
|
+
// Outputs
|
|
3183
|
+
valueChange = output();
|
|
3184
|
+
// Computeds
|
|
3185
|
+
selectedIndex = computed(() => {
|
|
3186
|
+
const val = this.value();
|
|
3187
|
+
return this.options().findIndex(opt => opt.value === val);
|
|
3188
|
+
});
|
|
3189
|
+
variantClass = computed(() => {
|
|
3190
|
+
return this.variant() !== 'default' ? this.variant() : '';
|
|
3191
|
+
});
|
|
3192
|
+
selectOption(val) {
|
|
3193
|
+
if (this.disabled())
|
|
3194
|
+
return;
|
|
3195
|
+
this.value.set(val);
|
|
3196
|
+
this.valueChange.emit(val);
|
|
3197
|
+
}
|
|
3198
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SegmentedControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3199
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: SegmentedControlComponent, isStandalone: true, selector: "ngx-segmented-control", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange" }, ngImport: i0, template: `
|
|
3200
|
+
<div
|
|
3201
|
+
class="ngx-segmented-control"
|
|
3202
|
+
[class.dark]="theme() === 'dark'"
|
|
3203
|
+
[class.disabled]="disabled()"
|
|
3204
|
+
[attr.id]="id()"
|
|
3205
|
+
>
|
|
3206
|
+
<!-- Sliding Highlight Backdrop indicator -->
|
|
3207
|
+
@if (selectedIndex() >= 0) {
|
|
3208
|
+
<div
|
|
3209
|
+
class="ngx-segmented-control__indicator"
|
|
3210
|
+
[style.width.%]="100 / options().length"
|
|
3211
|
+
[style.transform]="'translateX(' + (selectedIndex() * 100) + '%)'"
|
|
3212
|
+
[class]="variantClass()"
|
|
3213
|
+
></div>
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
<!-- Option buttons -->
|
|
3217
|
+
@for (opt of options(); track opt.value; let idx = $index) {
|
|
3218
|
+
<button
|
|
3219
|
+
class="ngx-segmented-control__option"
|
|
3220
|
+
[class.selected]="idx === selectedIndex()"
|
|
3221
|
+
(click)="selectOption(opt.value)"
|
|
3222
|
+
[disabled]="disabled()"
|
|
3223
|
+
[style.width.%]="100 / options().length"
|
|
3224
|
+
type="button"
|
|
3225
|
+
>
|
|
3226
|
+
<span class="ngx-segmented-control__label-text">{{ opt.label }}</span>
|
|
3227
|
+
@if (opt.badge) {
|
|
3228
|
+
<span class="ngx-segmented-control__badge">{{ opt.badge }}</span>
|
|
3229
|
+
}
|
|
3230
|
+
</button>
|
|
3231
|
+
}
|
|
3232
|
+
</div>
|
|
3233
|
+
`, isInline: true, styles: [":host{display:inline-block;min-width:240px}.ngx-segmented-control{position:relative;display:flex;width:100%;background:#0000000a;padding:3px;border-radius:10px;box-sizing:border-box;-webkit-user-select:none;user-select:none;font-family:var(--ngx-font-family, system-ui, sans-serif);border:1px solid rgba(0,0,0,.03)}.ngx-segmented-control.dark{background:#ffffff0f;border-color:#ffffff08}.ngx-segmented-control.disabled{opacity:.55;pointer-events:none}.ngx-segmented-control__indicator{position:absolute;top:3px;left:0;bottom:3px;background:#fff;border-radius:8px;box-shadow:0 1px 3px #0000001a,0 1px 2px #0000000f;transition:transform .26s cubic-bezier(.25,.8,.25,1);z-index:1}.ngx-segmented-control.dark .ngx-segmented-control__indicator{background:#ffffff26;box-shadow:none}.ngx-segmented-control__option{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 12px;font-size:13px;font-weight:600;color:#64748b;background:transparent;border:none;cursor:pointer;z-index:2;transition:color .2s ease;outline:none;height:30px;box-sizing:border-box}.ngx-segmented-control__option:hover:not([disabled]){color:#0f172a}.ngx-segmented-control__option.selected{color:#0f172a}.ngx-segmented-control.dark .ngx-segmented-control__option{color:#94a3b8}.ngx-segmented-control.dark .ngx-segmented-control__option:hover:not([disabled]),.ngx-segmented-control.dark .ngx-segmented-control__option.selected{color:#fff}.ngx-segmented-control__badge{font-size:9px;padding:1px 5px;border-radius:4px;background:#0000000f;color:#475569;font-weight:700;transition:all .2s ease}.ngx-segmented-control__option.selected .ngx-segmented-control__badge{background:#0000001a}.ngx-segmented-control.dark .ngx-segmented-control__badge{background:#ffffff14;color:#cbd5e1}.ngx-segmented-control.dark .ngx-segmented-control__option.selected .ngx-segmented-control__badge{background:#ffffff26}.ngx-segmented-control__indicator.primary{background:var(--primary-color, #3b82f6)}.ngx-segmented-control__indicator.success{background:#10b981}.ngx-segmented-control__indicator.danger{background:#ef4444}.ngx-segmented-control__indicator.warning{background:#f59e0b}.ngx-segmented-control__indicator.info{background:#3b82f6}.ngx-segmented-control__indicator.primary,.ngx-segmented-control__indicator.success,.ngx-segmented-control__indicator.danger,.ngx-segmented-control__indicator.warning,.ngx-segmented-control__indicator.info{box-shadow:none}.ngx-segmented-control__indicator:not(.default)~.ngx-segmented-control__option.selected{color:#fff}.ngx-segmented-control:has(.ngx-segmented-control__indicator:not(.default)) .ngx-segmented-control__option.selected{color:#fff!important}.ngx-segmented-control:has(.ngx-segmented-control__indicator:not(.default)) .ngx-segmented-control__option.selected .ngx-segmented-control__badge{background:#fff3;color:#fff}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3234
|
+
}
|
|
3235
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SegmentedControlComponent, decorators: [{
|
|
3236
|
+
type: Component,
|
|
3237
|
+
args: [{ selector: 'ngx-segmented-control', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
3238
|
+
<div
|
|
3239
|
+
class="ngx-segmented-control"
|
|
3240
|
+
[class.dark]="theme() === 'dark'"
|
|
3241
|
+
[class.disabled]="disabled()"
|
|
3242
|
+
[attr.id]="id()"
|
|
3243
|
+
>
|
|
3244
|
+
<!-- Sliding Highlight Backdrop indicator -->
|
|
3245
|
+
@if (selectedIndex() >= 0) {
|
|
3246
|
+
<div
|
|
3247
|
+
class="ngx-segmented-control__indicator"
|
|
3248
|
+
[style.width.%]="100 / options().length"
|
|
3249
|
+
[style.transform]="'translateX(' + (selectedIndex() * 100) + '%)'"
|
|
3250
|
+
[class]="variantClass()"
|
|
3251
|
+
></div>
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
<!-- Option buttons -->
|
|
3255
|
+
@for (opt of options(); track opt.value; let idx = $index) {
|
|
3256
|
+
<button
|
|
3257
|
+
class="ngx-segmented-control__option"
|
|
3258
|
+
[class.selected]="idx === selectedIndex()"
|
|
3259
|
+
(click)="selectOption(opt.value)"
|
|
3260
|
+
[disabled]="disabled()"
|
|
3261
|
+
[style.width.%]="100 / options().length"
|
|
3262
|
+
type="button"
|
|
3263
|
+
>
|
|
3264
|
+
<span class="ngx-segmented-control__label-text">{{ opt.label }}</span>
|
|
3265
|
+
@if (opt.badge) {
|
|
3266
|
+
<span class="ngx-segmented-control__badge">{{ opt.badge }}</span>
|
|
3267
|
+
}
|
|
3268
|
+
</button>
|
|
3269
|
+
}
|
|
3270
|
+
</div>
|
|
3271
|
+
`, styles: [":host{display:inline-block;min-width:240px}.ngx-segmented-control{position:relative;display:flex;width:100%;background:#0000000a;padding:3px;border-radius:10px;box-sizing:border-box;-webkit-user-select:none;user-select:none;font-family:var(--ngx-font-family, system-ui, sans-serif);border:1px solid rgba(0,0,0,.03)}.ngx-segmented-control.dark{background:#ffffff0f;border-color:#ffffff08}.ngx-segmented-control.disabled{opacity:.55;pointer-events:none}.ngx-segmented-control__indicator{position:absolute;top:3px;left:0;bottom:3px;background:#fff;border-radius:8px;box-shadow:0 1px 3px #0000001a,0 1px 2px #0000000f;transition:transform .26s cubic-bezier(.25,.8,.25,1);z-index:1}.ngx-segmented-control.dark .ngx-segmented-control__indicator{background:#ffffff26;box-shadow:none}.ngx-segmented-control__option{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 12px;font-size:13px;font-weight:600;color:#64748b;background:transparent;border:none;cursor:pointer;z-index:2;transition:color .2s ease;outline:none;height:30px;box-sizing:border-box}.ngx-segmented-control__option:hover:not([disabled]){color:#0f172a}.ngx-segmented-control__option.selected{color:#0f172a}.ngx-segmented-control.dark .ngx-segmented-control__option{color:#94a3b8}.ngx-segmented-control.dark .ngx-segmented-control__option:hover:not([disabled]),.ngx-segmented-control.dark .ngx-segmented-control__option.selected{color:#fff}.ngx-segmented-control__badge{font-size:9px;padding:1px 5px;border-radius:4px;background:#0000000f;color:#475569;font-weight:700;transition:all .2s ease}.ngx-segmented-control__option.selected .ngx-segmented-control__badge{background:#0000001a}.ngx-segmented-control.dark .ngx-segmented-control__badge{background:#ffffff14;color:#cbd5e1}.ngx-segmented-control.dark .ngx-segmented-control__option.selected .ngx-segmented-control__badge{background:#ffffff26}.ngx-segmented-control__indicator.primary{background:var(--primary-color, #3b82f6)}.ngx-segmented-control__indicator.success{background:#10b981}.ngx-segmented-control__indicator.danger{background:#ef4444}.ngx-segmented-control__indicator.warning{background:#f59e0b}.ngx-segmented-control__indicator.info{background:#3b82f6}.ngx-segmented-control__indicator.primary,.ngx-segmented-control__indicator.success,.ngx-segmented-control__indicator.danger,.ngx-segmented-control__indicator.warning,.ngx-segmented-control__indicator.info{box-shadow:none}.ngx-segmented-control__indicator:not(.default)~.ngx-segmented-control__option.selected{color:#fff}.ngx-segmented-control:has(.ngx-segmented-control__indicator:not(.default)) .ngx-segmented-control__option.selected{color:#fff!important}.ngx-segmented-control:has(.ngx-segmented-control__indicator:not(.default)) .ngx-segmented-control__option.selected .ngx-segmented-control__badge{background:#fff3;color:#fff}\n"] }]
|
|
2234
3272
|
}] });
|
|
2235
3273
|
|
|
2236
3274
|
/*
|
|
@@ -2242,5 +3280,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
2242
3280
|
* Generated bundle index. Do not edit.
|
|
2243
3281
|
*/
|
|
2244
3282
|
|
|
2245
|
-
export { AutocompleteComponent, CheckboxComponent, ColorPickerComponent, DatePickerComponent, DateRangePickerComponent, DropdownComponent, MultiSelectComponent, NumericTextBoxComponent, RadioGroupComponent, RatingComponent, SliderComponent, SwitchComponent, TextBoxComponent, TextareaComponent, TimePickerComponent };
|
|
3283
|
+
export { AutocompleteComponent, CheckboxComponent, ColorPickerComponent, DatePickerComponent, DateRangePickerComponent, DropdownComponent, FilePreviewComponent, FileUploadComponent, MultiSelectComponent, NumericTextBoxComponent, RadioGroupComponent, RatingComponent, SegmentedControlComponent, SliderComponent, SwitchComponent, TagInputComponent, TextBoxComponent, TextareaComponent, TimePickerComponent };
|
|
2246
3284
|
//# sourceMappingURL=ngx-core-components-inputs.mjs.map
|