@abdelfattahqandil21/ryzen-ui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -0
- package/fesm2022/abdelfattahqandil21-ryzen-ui.mjs +2389 -0
- package/fesm2022/abdelfattahqandil21-ryzen-ui.mjs.map +1 -0
- package/index.d.ts +1008 -0
- package/package.json +39 -0
|
@@ -0,0 +1,2389 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { model, input, computed, ChangeDetectionStrategy, Component, inject, ElementRef, signal, output, effect, TemplateRef, ContentChild, Injectable, contentChildren, DestroyRef } from '@angular/core';
|
|
3
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
import { Router, NavigationEnd } from '@angular/router';
|
|
5
|
+
import { filter } from 'rxjs/operators';
|
|
6
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
7
|
+
|
|
8
|
+
const THEME_COLORS = [
|
|
9
|
+
'primary',
|
|
10
|
+
'secondary',
|
|
11
|
+
'accent',
|
|
12
|
+
'success',
|
|
13
|
+
'warning',
|
|
14
|
+
'danger',
|
|
15
|
+
'info',
|
|
16
|
+
];
|
|
17
|
+
function isThemeColor(value) {
|
|
18
|
+
return THEME_COLORS.includes(value);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class CheckboxComponent {
|
|
22
|
+
checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : []));
|
|
23
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
24
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
25
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
26
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
27
|
+
indeterminate = input(false, ...(ngDevMode ? [{ debugName: "indeterminate" }] : []));
|
|
28
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
29
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
30
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
31
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
32
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
33
|
+
_accentKey = computed(() => {
|
|
34
|
+
const c = this.accentColor();
|
|
35
|
+
return c && isThemeColor(c) ? c : null;
|
|
36
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
37
|
+
_rawAccent = computed(() => {
|
|
38
|
+
const c = this.accentColor();
|
|
39
|
+
return c && !isThemeColor(c) ? c : null;
|
|
40
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
41
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
42
|
+
toggle() {
|
|
43
|
+
if (this.disabled())
|
|
44
|
+
return;
|
|
45
|
+
this.checked.update(v => !v);
|
|
46
|
+
}
|
|
47
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
48
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: CheckboxComponent, isStandalone: true, selector: "app-checkbox", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, accentColor: { classPropertyName: "accentColor", publicName: "accentColor", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: { properties: { "attr.data-size": "_size", "attr.data-accent": "_accentKey", "class.has-error": "error()", "style.--cb-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<label class=\"cb-field\" [class.is-disabled]=\"disabled()\">\n <span\n class=\"cb-box\"\n [class.is-checked]=\"checked()\"\n [class.is-indeterminate]=\"indeterminate() && !checked()\"\n role=\"checkbox\"\n [attr.aria-checked]=\"indeterminate() && !checked() ? 'mixed' : checked()\"\n tabindex=\"0\"\n (click)=\"toggle()\"\n (keydown.enter)=\"toggle()\"\n (keydown.space)=\"toggle(); $event.preventDefault()\"\n >\n @if (checked()) {\n <i class=\"pi pi-check\" style=\"color:white;font-weight:700\"></i>\n } @else if (indeterminate()) {\n <span class=\"w-2 h-0.5 rounded-full\" style=\"background:white\"></span>\n }\n </span>\n\n @if (label()) {\n <span class=\"cb-label\">{{ label() }}</span>\n }\n</label>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--cb-accent: var(--color-primary, oklch(.32 .09 258));--cb-bg: var(--color-surface, oklch(.99 0 0));--cb-border: var(--color-border, oklch(.83 .015 260));--cb-text: var(--color-text, oklch(.14 .01 260));--cb-muted: var(--color-text-muted, oklch(.48 .01 260));position:relative;display:inline-flex;flex-direction:column;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--cb-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--cb-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--cb-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--cb-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--cb-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--cb-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--cb-accent: var(--color-info, oklch(.55 .15 235))}.cb-field{display:inline-flex;align-items:center;gap:.5rem;cursor:pointer}.cb-field.is-disabled{opacity:.5;cursor:not-allowed}.cb-box{display:inline-flex;align-items:center;justify-content:center;border:2px solid var(--cb-border);border-radius:4px;background:var(--cb-bg);transition:all .15s ease;flex-shrink:0}.cb-box.is-checked,.cb-box.is-indeterminate{background:var(--cb-accent);border-color:var(--cb-accent)}.cb-box:focus-visible{outline:2px solid var(--cb-accent);outline-offset:2px}.cb-label{font-family:var(--font-sans);-webkit-user-select:none;user-select:none;color:var(--cb-text)}:host([data-size=\"sm\"]) .cb-box{width:1rem;height:1rem;font-size:.625rem}:host([data-size=\"sm\"]) .cb-label{font-size:.75rem}:host([data-size=\"md\"]) .cb-box{width:1.25rem;height:1.25rem;font-size:.75rem}:host([data-size=\"md\"]) .cb-label{font-size:.875rem}:host([data-size=\"lg\"]) .cb-box{width:1.5rem;height:1.5rem;font-size:.875rem}:host([data-size=\"lg\"]) .cb-label{font-size:1rem}:host(.has-error) .cb-box{border-color:var(--color-danger, oklch(.55 .25 25))}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
49
|
+
}
|
|
50
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
51
|
+
type: Component,
|
|
52
|
+
args: [{ selector: 'app-checkbox', imports: [], host: {
|
|
53
|
+
'[attr.data-size]': '_size',
|
|
54
|
+
'[attr.data-accent]': '_accentKey',
|
|
55
|
+
'[class.has-error]': 'error()',
|
|
56
|
+
'[style.--cb-accent]': '_rawAccent',
|
|
57
|
+
'[style.width]': '_width',
|
|
58
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<label class=\"cb-field\" [class.is-disabled]=\"disabled()\">\n <span\n class=\"cb-box\"\n [class.is-checked]=\"checked()\"\n [class.is-indeterminate]=\"indeterminate() && !checked()\"\n role=\"checkbox\"\n [attr.aria-checked]=\"indeterminate() && !checked() ? 'mixed' : checked()\"\n tabindex=\"0\"\n (click)=\"toggle()\"\n (keydown.enter)=\"toggle()\"\n (keydown.space)=\"toggle(); $event.preventDefault()\"\n >\n @if (checked()) {\n <i class=\"pi pi-check\" style=\"color:white;font-weight:700\"></i>\n } @else if (indeterminate()) {\n <span class=\"w-2 h-0.5 rounded-full\" style=\"background:white\"></span>\n }\n </span>\n\n @if (label()) {\n <span class=\"cb-label\">{{ label() }}</span>\n }\n</label>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--cb-accent: var(--color-primary, oklch(.32 .09 258));--cb-bg: var(--color-surface, oklch(.99 0 0));--cb-border: var(--color-border, oklch(.83 .015 260));--cb-text: var(--color-text, oklch(.14 .01 260));--cb-muted: var(--color-text-muted, oklch(.48 .01 260));position:relative;display:inline-flex;flex-direction:column;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--cb-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--cb-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--cb-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--cb-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--cb-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--cb-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--cb-accent: var(--color-info, oklch(.55 .15 235))}.cb-field{display:inline-flex;align-items:center;gap:.5rem;cursor:pointer}.cb-field.is-disabled{opacity:.5;cursor:not-allowed}.cb-box{display:inline-flex;align-items:center;justify-content:center;border:2px solid var(--cb-border);border-radius:4px;background:var(--cb-bg);transition:all .15s ease;flex-shrink:0}.cb-box.is-checked,.cb-box.is-indeterminate{background:var(--cb-accent);border-color:var(--cb-accent)}.cb-box:focus-visible{outline:2px solid var(--cb-accent);outline-offset:2px}.cb-label{font-family:var(--font-sans);-webkit-user-select:none;user-select:none;color:var(--cb-text)}:host([data-size=\"sm\"]) .cb-box{width:1rem;height:1rem;font-size:.625rem}:host([data-size=\"sm\"]) .cb-label{font-size:.75rem}:host([data-size=\"md\"]) .cb-box{width:1.25rem;height:1.25rem;font-size:.75rem}:host([data-size=\"md\"]) .cb-label{font-size:.875rem}:host([data-size=\"lg\"]) .cb-box{width:1.5rem;height:1.5rem;font-size:.875rem}:host([data-size=\"lg\"]) .cb-label{font-size:1rem}:host(.has-error) .cb-box{border-color:var(--color-danger, oklch(.55 .25 25))}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
59
|
+
}], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], accentColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accentColor", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
|
|
60
|
+
|
|
61
|
+
class DatePickerComponent {
|
|
62
|
+
_elementRef = inject(ElementRef);
|
|
63
|
+
_closeTimer = null;
|
|
64
|
+
_docClickCleanup;
|
|
65
|
+
_today = signal((() => { const d = new Date(); d.setHours(0, 0, 0, 0); return d; })(), ...(ngDevMode ? [{ debugName: "_today" }] : []));
|
|
66
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
67
|
+
placeholder = input('Select date', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
68
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
69
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
70
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
71
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
72
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
73
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
74
|
+
format = input('dd/MM/yyyy', ...(ngDevMode ? [{ debugName: "format" }] : []));
|
|
75
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
76
|
+
config = input({}, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
77
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
78
|
+
_accentKey = computed(() => {
|
|
79
|
+
const c = this.accentColor();
|
|
80
|
+
return c && isThemeColor(c) ? c : null;
|
|
81
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
82
|
+
_rawAccent = computed(() => {
|
|
83
|
+
const c = this.accentColor();
|
|
84
|
+
return c && !isThemeColor(c) ? c : null;
|
|
85
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
86
|
+
_accentColorValue = computed(() => {
|
|
87
|
+
const c = this.accentColor();
|
|
88
|
+
if (c && !isThemeColor(c))
|
|
89
|
+
return c;
|
|
90
|
+
const key = c && isThemeColor(c) ? c : 'primary';
|
|
91
|
+
const fallbacks = { primary: 'oklch(0.32 0.09 258)', secondary: 'oklch(0.55 0.12 40)', accent: 'oklch(0.64 0.2 50)', success: 'oklch(0.55 0.18 145)', warning: 'oklch(0.68 0.18 75)', danger: 'oklch(0.55 0.22 25)', info: 'oklch(0.55 0.15 235)' };
|
|
92
|
+
return `var(--color-${key}, ${fallbacks[key]})`;
|
|
93
|
+
}, ...(ngDevMode ? [{ debugName: "_accentColorValue" }] : []));
|
|
94
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
95
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
96
|
+
_isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : []));
|
|
97
|
+
_panelDirection = signal('down', ...(ngDevMode ? [{ debugName: "_panelDirection" }] : []));
|
|
98
|
+
_panelX = signal(0, ...(ngDevMode ? [{ debugName: "_panelX" }] : []));
|
|
99
|
+
_panelY = signal(0, ...(ngDevMode ? [{ debugName: "_panelY" }] : []));
|
|
100
|
+
_panelWidth = signal(0, ...(ngDevMode ? [{ debugName: "_panelWidth" }] : []));
|
|
101
|
+
_panelEl = null;
|
|
102
|
+
_viewDate = signal(new Date(), ...(ngDevMode ? [{ debugName: "_viewDate" }] : []));
|
|
103
|
+
_viewMode = signal('days', ...(ngDevMode ? [{ debugName: "_viewMode" }] : []));
|
|
104
|
+
_decade = signal(2020, ...(ngDevMode ? [{ debugName: "_decade" }] : []));
|
|
105
|
+
_monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
106
|
+
_weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
107
|
+
_weekdaysAr = ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'];
|
|
108
|
+
_monthsShort = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
109
|
+
_displayValue = computed(() => {
|
|
110
|
+
const date = this.value();
|
|
111
|
+
if (!date)
|
|
112
|
+
return '';
|
|
113
|
+
const d = String(date.getDate()).padStart(2, '0');
|
|
114
|
+
const m = String(date.getMonth() + 1).padStart(2, '0');
|
|
115
|
+
const y = date.getFullYear();
|
|
116
|
+
switch (this.format()) {
|
|
117
|
+
case 'MM/dd/yyyy': return `${m}/${d}/${y}`;
|
|
118
|
+
case 'yyyy-MM-dd': return `${y}-${m}-${d}`;
|
|
119
|
+
default: return `${d}/${m}/${y}`;
|
|
120
|
+
}
|
|
121
|
+
}, ...(ngDevMode ? [{ debugName: "_displayValue" }] : []));
|
|
122
|
+
_monthName = computed(() => this._monthNames[this._viewDate().getMonth()], ...(ngDevMode ? [{ debugName: "_monthName" }] : []));
|
|
123
|
+
_year = computed(() => this._viewDate().getFullYear(), ...(ngDevMode ? [{ debugName: "_year" }] : []));
|
|
124
|
+
_decadeLabel = computed(() => `${this._decade()} - ${this._decade() + 9}`, ...(ngDevMode ? [{ debugName: "_decadeLabel" }] : []));
|
|
125
|
+
_appendToParent = computed(() => this.config().appendToParent ?? false, ...(ngDevMode ? [{ debugName: "_appendToParent" }] : []));
|
|
126
|
+
_panelFixed = computed(() => this._isOpen() && this._appendToParent() ? 'fixed' : null, ...(ngDevMode ? [{ debugName: "_panelFixed" }] : []));
|
|
127
|
+
_showTodayBtn = computed(() => this.config().showTodayButton !== false, ...(ngDevMode ? [{ debugName: "_showTodayBtn" }] : []));
|
|
128
|
+
_showYearNav = computed(() => this.config().showYearNavigation !== false, ...(ngDevMode ? [{ debugName: "_showYearNav" }] : []));
|
|
129
|
+
_firstDay = computed(() => this.config().firstDayOfWeek ?? 0, ...(ngDevMode ? [{ debugName: "_firstDay" }] : []));
|
|
130
|
+
_weekDaysOrdered = computed(() => {
|
|
131
|
+
const arr = [...this._weekdays];
|
|
132
|
+
if (this._firstDay() === 1)
|
|
133
|
+
arr.push(arr.shift());
|
|
134
|
+
return arr;
|
|
135
|
+
}, ...(ngDevMode ? [{ debugName: "_weekDaysOrdered" }] : []));
|
|
136
|
+
_yearsList = computed(() => Array.from({ length: 10 }, (_, i) => this._decade() + i), ...(ngDevMode ? [{ debugName: "_yearsList" }] : []));
|
|
137
|
+
_calendarDays = computed(() => {
|
|
138
|
+
const viewDate = this._viewDate();
|
|
139
|
+
const selectedDate = this.value();
|
|
140
|
+
const cfg = this.config();
|
|
141
|
+
const today = this._today();
|
|
142
|
+
const year = viewDate.getFullYear();
|
|
143
|
+
const month = viewDate.getMonth();
|
|
144
|
+
const firstDay = new Date(year, month, 1);
|
|
145
|
+
const lastDay = new Date(year, month + 1, 0);
|
|
146
|
+
let startOffset = firstDay.getDay() - this._firstDay();
|
|
147
|
+
if (startOffset < 0)
|
|
148
|
+
startOffset += 7;
|
|
149
|
+
const days = [];
|
|
150
|
+
const prevLast = new Date(year, month, 0).getDate();
|
|
151
|
+
for (let i = startOffset - 1; i >= 0; i--) {
|
|
152
|
+
const date = new Date(year, month - 1, prevLast - i);
|
|
153
|
+
days.push(this._toDay(date, false, today, selectedDate, cfg));
|
|
154
|
+
}
|
|
155
|
+
for (let d = 1; d <= lastDay.getDate(); d++) {
|
|
156
|
+
const date = new Date(year, month, d);
|
|
157
|
+
days.push(this._toDay(date, true, today, selectedDate, cfg));
|
|
158
|
+
}
|
|
159
|
+
const remaining = 42 - days.length;
|
|
160
|
+
for (let d = 1; d <= remaining; d++) {
|
|
161
|
+
const date = new Date(year, month + 1, d);
|
|
162
|
+
days.push(this._toDay(date, false, today, selectedDate, cfg));
|
|
163
|
+
}
|
|
164
|
+
return days;
|
|
165
|
+
}, ...(ngDevMode ? [{ debugName: "_calendarDays" }] : []));
|
|
166
|
+
_toDay(date, isCurrent, today, selected, cfg) {
|
|
167
|
+
const d = new Date(date);
|
|
168
|
+
d.setHours(0, 0, 0, 0);
|
|
169
|
+
const t = new Date(today);
|
|
170
|
+
t.setHours(0, 0, 0, 0);
|
|
171
|
+
const sel = selected ? new Date(selected.getFullYear(), selected.getMonth(), selected.getDate()) : null;
|
|
172
|
+
const disabled = (cfg.minDate && d < cfg.minDate)
|
|
173
|
+
|| (cfg.maxDate && d > cfg.maxDate)
|
|
174
|
+
|| !!cfg.disabledDates?.some(x => this._sameDay(x, date));
|
|
175
|
+
const highlighted = !!cfg.highlightedDates?.some(x => this._sameDay(x, date));
|
|
176
|
+
return {
|
|
177
|
+
date,
|
|
178
|
+
day: date.getDate(),
|
|
179
|
+
isCurrentMonth: isCurrent,
|
|
180
|
+
isToday: d.getTime() === t.getTime(),
|
|
181
|
+
isSelected: !!sel && d.getTime() === sel.getTime(),
|
|
182
|
+
isDisabled: disabled,
|
|
183
|
+
isHighlighted: highlighted,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
_sameDay(a, b) {
|
|
187
|
+
return a.getFullYear() === b.getFullYear()
|
|
188
|
+
&& a.getMonth() === b.getMonth()
|
|
189
|
+
&& a.getDate() === b.getDate();
|
|
190
|
+
}
|
|
191
|
+
/* ── input computed classes ── */
|
|
192
|
+
_inputSizeCls = computed(() => {
|
|
193
|
+
const s = this.size();
|
|
194
|
+
return s === 'sm' ? 'py-1 pl-2 pr-8 text-xs' : s === 'lg' ? 'py-3 pl-4 pr-10 text-base' : 'py-2 pl-3 pr-10 text-sm';
|
|
195
|
+
}, ...(ngDevMode ? [{ debugName: "_inputSizeCls" }] : []));
|
|
196
|
+
_iconCls = computed(() => {
|
|
197
|
+
const s = this.size();
|
|
198
|
+
const r = s === 'sm' ? 'right-2' : s === 'lg' ? 'right-3' : 'right-2.5';
|
|
199
|
+
const f = s === 'sm' ? 'text-xs' : s === 'lg' ? 'text-lg' : 'text-sm';
|
|
200
|
+
return `absolute top-1/2 -translate-y-1/2 ${r} ${f} text-[var(--date-accent)] pointer-events-none`;
|
|
201
|
+
}, ...(ngDevMode ? [{ debugName: "_iconCls" }] : []));
|
|
202
|
+
/* ── actions ── */
|
|
203
|
+
_onTriggerClick(event) {
|
|
204
|
+
if (this.disabled())
|
|
205
|
+
return;
|
|
206
|
+
if (this._isOpen()) {
|
|
207
|
+
this._close();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
this._open();
|
|
211
|
+
}
|
|
212
|
+
_onPanelClick(event) {
|
|
213
|
+
event.stopPropagation();
|
|
214
|
+
}
|
|
215
|
+
_open() {
|
|
216
|
+
this._isClosing.set(false);
|
|
217
|
+
this._isOpen.set(true);
|
|
218
|
+
const d = new Date();
|
|
219
|
+
d.setHours(0, 0, 0, 0);
|
|
220
|
+
this._today.set(d);
|
|
221
|
+
this._viewMode.set('days');
|
|
222
|
+
const val = this.value();
|
|
223
|
+
if (val)
|
|
224
|
+
this._viewDate.set(new Date(val.getFullYear(), val.getMonth(), 1));
|
|
225
|
+
this._decade.set(Math.floor(this._viewDate().getFullYear() / 10) * 10);
|
|
226
|
+
const rect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
227
|
+
this._panelDirection.set(window.innerHeight - rect.bottom >= 320 ? 'down' : 'up');
|
|
228
|
+
if (this._appendToParent()) {
|
|
229
|
+
this._panelX.set(rect.left);
|
|
230
|
+
this._panelY.set(this._panelDirection() === 'down' ? rect.bottom : rect.top);
|
|
231
|
+
this._panelWidth.set(rect.width);
|
|
232
|
+
setTimeout(() => this._attachToBody());
|
|
233
|
+
}
|
|
234
|
+
const handler = (e) => this._onDocClick(e);
|
|
235
|
+
document.addEventListener('click', handler);
|
|
236
|
+
this._docClickCleanup = () => document.removeEventListener('click', handler);
|
|
237
|
+
}
|
|
238
|
+
_attachToBody() {
|
|
239
|
+
const panel = this._elementRef.nativeElement.querySelector('[data-dp-panel]');
|
|
240
|
+
if (panel) {
|
|
241
|
+
document.body.appendChild(panel);
|
|
242
|
+
this._panelEl = panel;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
_detachFromBody() {
|
|
246
|
+
if (!this._panelEl)
|
|
247
|
+
return;
|
|
248
|
+
const wrapper = this._elementRef.nativeElement.querySelector('.dp-wrapper');
|
|
249
|
+
if (wrapper && this._panelEl.parentNode !== wrapper) {
|
|
250
|
+
wrapper.appendChild(this._panelEl);
|
|
251
|
+
}
|
|
252
|
+
this._panelEl = null;
|
|
253
|
+
}
|
|
254
|
+
_close() {
|
|
255
|
+
if (!this._isOpen())
|
|
256
|
+
return;
|
|
257
|
+
this._docClickCleanup?.();
|
|
258
|
+
this._docClickCleanup = undefined;
|
|
259
|
+
if (this._closeTimer)
|
|
260
|
+
clearTimeout(this._closeTimer);
|
|
261
|
+
this._isClosing.set(true);
|
|
262
|
+
if (this._appendToParent())
|
|
263
|
+
this._detachFromBody();
|
|
264
|
+
this._closeTimer = setTimeout(() => {
|
|
265
|
+
this._isOpen.set(false);
|
|
266
|
+
this._isClosing.set(false);
|
|
267
|
+
this._viewMode.set('days');
|
|
268
|
+
this._closeTimer = null;
|
|
269
|
+
}, 150);
|
|
270
|
+
}
|
|
271
|
+
ngOnDestroy() {
|
|
272
|
+
this._docClickCleanup?.();
|
|
273
|
+
if (this._closeTimer)
|
|
274
|
+
clearTimeout(this._closeTimer);
|
|
275
|
+
if (this._panelEl && document.body.contains(this._panelEl)) {
|
|
276
|
+
document.body.removeChild(this._panelEl);
|
|
277
|
+
this._panelEl = null;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
_selectDate(date) {
|
|
281
|
+
const d = new Date(date);
|
|
282
|
+
const cfg = this.config();
|
|
283
|
+
if (cfg.minDate && d < cfg.minDate)
|
|
284
|
+
return;
|
|
285
|
+
if (cfg.maxDate && d > cfg.maxDate)
|
|
286
|
+
return;
|
|
287
|
+
if (cfg.disabledDates?.some(x => this._sameDay(x, d)))
|
|
288
|
+
return;
|
|
289
|
+
this.value.set(d);
|
|
290
|
+
this._close();
|
|
291
|
+
}
|
|
292
|
+
_selectMonth(idx) {
|
|
293
|
+
this._viewDate.set(new Date(this._year(), idx, 1));
|
|
294
|
+
this._viewMode.set('days');
|
|
295
|
+
}
|
|
296
|
+
_selectYear(year) {
|
|
297
|
+
this._viewDate.set(new Date(year, this._viewDate().getMonth(), 1));
|
|
298
|
+
this._viewMode.set('months');
|
|
299
|
+
}
|
|
300
|
+
_prevMonth() { this._viewDate.update(d => new Date(d.getFullYear(), d.getMonth() - 1, 1)); }
|
|
301
|
+
_nextMonth() { this._viewDate.update(d => new Date(d.getFullYear(), d.getMonth() + 1, 1)); }
|
|
302
|
+
_prevYear() { this._viewDate.update(d => new Date(d.getFullYear() - 1, d.getMonth(), 1)); }
|
|
303
|
+
_nextYear() { this._viewDate.update(d => new Date(d.getFullYear() + 1, d.getMonth(), 1)); }
|
|
304
|
+
_prevDecade() { this._decade.update(v => v - 10); }
|
|
305
|
+
_nextDecade() { this._decade.update(v => v + 10); }
|
|
306
|
+
_showMonths() { this._viewMode.set('months'); }
|
|
307
|
+
_showYears() {
|
|
308
|
+
this._decade.set(Math.floor(this._viewDate().getFullYear() / 10) * 10);
|
|
309
|
+
this._viewMode.set('years');
|
|
310
|
+
}
|
|
311
|
+
_prevPeriod() {
|
|
312
|
+
const m = this._viewMode();
|
|
313
|
+
if (m === 'days')
|
|
314
|
+
this._prevMonth();
|
|
315
|
+
else if (m === 'months')
|
|
316
|
+
this._prevYear();
|
|
317
|
+
else
|
|
318
|
+
this._prevDecade();
|
|
319
|
+
}
|
|
320
|
+
_nextPeriod() {
|
|
321
|
+
const m = this._viewMode();
|
|
322
|
+
if (m === 'days')
|
|
323
|
+
this._nextMonth();
|
|
324
|
+
else if (m === 'months')
|
|
325
|
+
this._nextYear();
|
|
326
|
+
else
|
|
327
|
+
this._nextDecade();
|
|
328
|
+
}
|
|
329
|
+
_goToToday() {
|
|
330
|
+
const today = new Date();
|
|
331
|
+
this._viewDate.set(new Date(today.getFullYear(), today.getMonth(), 1));
|
|
332
|
+
this._viewMode.set('days');
|
|
333
|
+
this._selectDate(today);
|
|
334
|
+
}
|
|
335
|
+
_clear(event) {
|
|
336
|
+
event.stopPropagation();
|
|
337
|
+
this.value.set(null);
|
|
338
|
+
}
|
|
339
|
+
_isCurrentMonth(idx) { return this._viewDate().getMonth() === idx; }
|
|
340
|
+
_isCurrentYear(year) { return this._viewDate().getFullYear() === year; }
|
|
341
|
+
_onDocClick(event) {
|
|
342
|
+
if (!this._isOpen())
|
|
343
|
+
return;
|
|
344
|
+
const target = event.target;
|
|
345
|
+
if (this._elementRef.nativeElement.contains(target))
|
|
346
|
+
return;
|
|
347
|
+
if (this._panelEl?.contains(target))
|
|
348
|
+
return;
|
|
349
|
+
this._close();
|
|
350
|
+
}
|
|
351
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: DatePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
352
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: DatePickerComponent, isStandalone: true, selector: "app-date-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, accentColor: { classPropertyName: "accentColor", publicName: "accentColor", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "attr.data-size": "_size", "attr.data-accent": "_accentKey", "class.has-error": "error()", "style.--date-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<div class=\"relative dp-wrapper\">\n <label class=\"flex items-center w-full\" (click)=\"_onTriggerClick($event)\">\n <input\n class=\"w-full outline-none transition-[border-color,box-shadow] duration-200 ease bg-[var(--date-bg)] border border-[var(--date-border)] rounded-[var(--date-radius)] text-[var(--date-text)] font-[var(--font-sans)] placeholder:text-[var(--date-muted)] disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer focus:border-[var(--date-accent)] focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--date-accent)_20%,transparent)]\"\n [class]=\"_inputSizeCls()\"\n type=\"text\"\n readonly\n [attr.placeholder]=\"placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n [value]=\"_displayValue()\"\n />\n\n @if (_displayValue() && !disabled()) {\n <button class=\"absolute top-1/2 -translate-y-1/2 right-8 flex items-center justify-center p-0 border-none bg-transparent cursor-pointer text-[var(--date-muted)] hover:text-[var(--date-text)] transition-colors duration-150\" type=\"button\" (click)=\"_clear($event)\" aria-label=\"Clear date\">\n <i class=\"pi pi-times text-xs sm:text-sm lg:text-base\"></i>\n </button>\n }\n\n <i [class]=\"_iconCls() + ' pi pi-calendar'\"></i>\n </label>\n\n @if (_isOpen() || _isClosing()) {\n <div\n data-dp-panel\n class=\"left-0 z-50 w-full min-w-60 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--radius-md)] shadow-lg overflow-hidden text-[var(--color-text)]\"\n [class.absolute]=\"!_appendToParent()\"\n [style.position]=\"_panelFixed()\"\n [style.left.px]=\"_appendToParent() ? _panelX() : null\"\n [style.top.px]=\"_appendToParent() ? _panelY() : null\"\n [style.width.px]=\"_appendToParent() ? _panelWidth() : null\"\n [class.top-full]=\"!_appendToParent() && _panelDirection() === 'down'\"\n [class.bottom-full]=\"!_appendToParent() && _panelDirection() === 'up'\"\n [class.dp-fade-in]=\"_isOpen() && !_isClosing()\"\n [class.dp-fade-out]=\"_isClosing()\"\n (click)=\"_onPanelClick($event)\">\n <div [style.background-color]=\"_accentColorValue()\" class=\"text-white px-3 py-2.5\">\n <!-- top row: nav arrows + month/year title -->\n <div class=\"flex items-center justify-between mb-1.5\">\n @if (_viewMode() === 'days' && _showYearNav()) {\n <button type=\"button\" (click)=\"_prevYear()\" class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-white/80 hover:bg-white/20 cursor-pointer transition-colors\" aria-label=\"Previous year\">\n <i class=\"pi pi-angle-double-left text-xs\"></i>\n </button>\n }\n @if (_viewMode() !== 'years') {\n <button type=\"button\" (click)=\"_prevPeriod()\" class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-white/80 hover:bg-white/20 cursor-pointer transition-colors\" aria-label=\"Previous\">\n <i class=\"pi pi-angle-left text-sm\"></i>\n </button>\n }\n\n <div class=\"flex items-center gap-1 text-sm font-semibold\">\n @if (_viewMode() === 'days') {\n <button type=\"button\" (click)=\"_showMonths()\" class=\"px-1.5 py-0.5 border-none rounded bg-transparent text-white hover:bg-white/20 cursor-pointer transition-colors\">{{ _monthName() }}</button>\n <button type=\"button\" (click)=\"_showYears()\" class=\"px-1.5 py-0.5 border-none rounded bg-transparent text-white hover:bg-white/20 cursor-pointer transition-colors\">{{ _year() }}</button>\n }\n @if (_viewMode() === 'months') {\n <button type=\"button\" (click)=\"_showYears()\" class=\"px-1.5 py-0.5 border-none rounded bg-transparent text-white hover:bg-white/20 cursor-pointer transition-colors\">{{ _year() }}</button>\n }\n @if (_viewMode() === 'years') {\n <span class=\"px-1.5\">{{ _decadeLabel() }}</span>\n }\n </div>\n\n @if (_viewMode() !== 'years') {\n <button type=\"button\" (click)=\"_nextPeriod()\" class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-white/80 hover:bg-white/20 cursor-pointer transition-colors\" aria-label=\"Next\">\n <i class=\"pi pi-angle-right text-sm\"></i>\n </button>\n }\n @if (_viewMode() === 'days' && _showYearNav()) {\n <button type=\"button\" (click)=\"_nextYear()\" class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-white/80 hover:bg-white/20 cursor-pointer transition-colors\" aria-label=\"Next year\">\n <i class=\"pi pi-angle-double-right text-xs\"></i>\n </button>\n }\n </div>\n\n <!-- today button -->\n @if (_showTodayBtn() && _viewMode() === 'days') {\n <button type=\"button\" (click)=\"_goToToday()\" class=\"w-full flex items-center justify-center gap-1.5 py-1 px-2 border-none rounded bg-white/20 hover:bg-white/30 text-white text-xs cursor-pointer transition-colors\">\n <i class=\"pi pi-calendar-plus text-xs\"></i>\n Today\n </button>\n }\n </div>\n\n <!-- ===== DAYS VIEW ===== -->\n @if (_viewMode() === 'days') {\n <div class=\"p-2.5\">\n <div class=\"grid grid-cols-7 mb-0.5\">\n @for (day of _weekDaysOrdered(); track $index) {\n <div class=\"flex items-center justify-center h-7 text-xs font-medium text-[var(--color-text-muted)] font-[var(--font-sans)]\">{{ day }}</div>\n }\n </div>\n <div class=\"grid grid-cols-7 gap-0.5\">\n @for (day of _calendarDays(); track day.date.getTime()) {\n @if (day.date.getMonth() === _viewDate().getMonth() || day.date.getMonth() === _viewDate().getMonth() - 1 || day.date.getMonth() === _viewDate().getMonth() + 1) {\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-9 h-9 p-0 border-none rounded-full cursor-pointer text-sm font-[var(--font-sans)] transition-all duration-150\"\n [class.text-[var(--color-text-muted)]]=\"!day.isCurrentMonth && !day.isSelected\"\n [class.text-[var(--color-text)]]=\"day.isCurrentMonth && !day.isSelected && !day.isToday\"\n [class.font-semibold]=\"day.isToday || day.isSelected\"\n [class.bg-[var(--date-accent)]]=\"day.isSelected\"\n [class.text-white]=\"day.isSelected\"\n [class.ring-2]=\"day.isToday && !day.isSelected\"\n [class.ring-[var(--date-accent)]]=\"day.isToday && !day.isSelected\"\n [class.bg-[var(--color-surface-alt)]]=\"day.isHighlighted && !day.isSelected\"\n [class.hover:bg-[var(--color-surface-alt)]]=\"!day.isSelected && !day.isDisabled\"\n [class.opacity-30]=\"day.isDisabled\"\n [class.cursor-not-allowed]=\"day.isDisabled\"\n [disabled]=\"day.isDisabled\"\n (click)=\"_selectDate(day.date)\"\n [attr.aria-label]=\"day.date.toLocaleDateString()\"\n >{{ day.day }}</button>\n }\n }\n </div>\n </div>\n }\n\n <!-- ===== MONTHS VIEW ===== -->\n @if (_viewMode() === 'months') {\n <div class=\"grid grid-cols-3 gap-2 p-3\">\n @for (month of _monthNames; track $index) {\n <button\n type=\"button\"\n class=\"p-2 rounded-lg text-xs font-[var(--font-sans)] transition-colors cursor-pointer\"\n [class.bg-[var(--date-accent)]]=\"_isCurrentMonth($index)\"\n [class.text-white]=\"_isCurrentMonth($index)\"\n [class.text-[var(--color-text)]]=\"!_isCurrentMonth($index)\"\n [class.hover:bg-[var(--color-surface-alt)]]=\"!_isCurrentMonth($index)\"\n (click)=\"_selectMonth($index)\"\n >{{ _monthsShort[$index] }}</button>\n }\n </div>\n }\n\n <!-- ===== YEARS VIEW ===== -->\n @if (_viewMode() === 'years') {\n <div class=\"p-2.5\">\n <div class=\"flex items-center justify-between mb-2 px-1\">\n <button type=\"button\" (click)=\"_prevDecade()\" class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-[var(--date-accent)] hover:bg-[var(--color-surface-alt)] cursor-pointer transition-colors\">\n <i class=\"pi pi-chevron-left text-xs\"></i>\n </button>\n <span class=\"text-sm font-semibold text-[var(--color-text)] font-[var(--font-sans)]\">{{ _decadeLabel() }}</span>\n <button type=\"button\" (click)=\"_nextDecade()\" class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-[var(--date-accent)] hover:bg-[var(--color-surface-alt)] cursor-pointer transition-colors\">\n <i class=\"pi pi-chevron-right text-xs\"></i>\n </button>\n </div>\n <div class=\"grid grid-cols-4 gap-2\">\n @for (year of _yearsList(); track $index) {\n <button\n type=\"button\"\n class=\"p-2 rounded-lg text-xs font-[var(--font-sans)] transition-colors cursor-pointer\"\n [class.bg-[var(--date-accent)]]=\"_isCurrentYear(year)\"\n [class.text-white]=\"_isCurrentYear(year)\"\n [class.text-[var(--color-text)]]=\"!_isCurrentYear(year)\"\n [class.hover:bg-[var(--color-surface-alt)]]=\"!_isCurrentYear(year)\"\n (click)=\"_selectYear(year)\"\n >{{ year }}</button>\n }\n </div>\n </div>\n }\n </div>\n }\n</div>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--date-accent: var(--color-primary, oklch(.32 .09 258));--date-bg: var(--color-surface, oklch(.99 0 0));--date-border: var(--color-border, oklch(.83 .015 260));--date-text: var(--color-text, oklch(.14 .01 260));--date-muted: var(--color-text-muted, oklch(.48 .01 260));--date-radius: var(--radius-md, .5rem);position:relative;display:inline-block;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--date-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--date-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--date-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--date-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--date-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--date-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--date-accent: var(--color-info, oklch(.55 .15 235))}:host.has-error input{border-color:var(--color-danger)!important}:host.has-error input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.dp-fade-in{animation:dpIn .2s ease}.dp-fade-out{animation:dpOut .15s ease forwards}@keyframes dpIn{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes dpOut{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
353
|
+
}
|
|
354
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: DatePickerComponent, decorators: [{
|
|
355
|
+
type: Component,
|
|
356
|
+
args: [{ selector: 'app-date-picker', imports: [], host: {
|
|
357
|
+
'[attr.data-size]': '_size',
|
|
358
|
+
'[attr.data-accent]': '_accentKey',
|
|
359
|
+
'[class.has-error]': 'error()',
|
|
360
|
+
'[style.--date-accent]': '_rawAccent',
|
|
361
|
+
'[style.width]': '_width',
|
|
362
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"relative dp-wrapper\">\n <label class=\"flex items-center w-full\" (click)=\"_onTriggerClick($event)\">\n <input\n class=\"w-full outline-none transition-[border-color,box-shadow] duration-200 ease bg-[var(--date-bg)] border border-[var(--date-border)] rounded-[var(--date-radius)] text-[var(--date-text)] font-[var(--font-sans)] placeholder:text-[var(--date-muted)] disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer focus:border-[var(--date-accent)] focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--date-accent)_20%,transparent)]\"\n [class]=\"_inputSizeCls()\"\n type=\"text\"\n readonly\n [attr.placeholder]=\"placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n [value]=\"_displayValue()\"\n />\n\n @if (_displayValue() && !disabled()) {\n <button class=\"absolute top-1/2 -translate-y-1/2 right-8 flex items-center justify-center p-0 border-none bg-transparent cursor-pointer text-[var(--date-muted)] hover:text-[var(--date-text)] transition-colors duration-150\" type=\"button\" (click)=\"_clear($event)\" aria-label=\"Clear date\">\n <i class=\"pi pi-times text-xs sm:text-sm lg:text-base\"></i>\n </button>\n }\n\n <i [class]=\"_iconCls() + ' pi pi-calendar'\"></i>\n </label>\n\n @if (_isOpen() || _isClosing()) {\n <div\n data-dp-panel\n class=\"left-0 z-50 w-full min-w-60 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--radius-md)] shadow-lg overflow-hidden text-[var(--color-text)]\"\n [class.absolute]=\"!_appendToParent()\"\n [style.position]=\"_panelFixed()\"\n [style.left.px]=\"_appendToParent() ? _panelX() : null\"\n [style.top.px]=\"_appendToParent() ? _panelY() : null\"\n [style.width.px]=\"_appendToParent() ? _panelWidth() : null\"\n [class.top-full]=\"!_appendToParent() && _panelDirection() === 'down'\"\n [class.bottom-full]=\"!_appendToParent() && _panelDirection() === 'up'\"\n [class.dp-fade-in]=\"_isOpen() && !_isClosing()\"\n [class.dp-fade-out]=\"_isClosing()\"\n (click)=\"_onPanelClick($event)\">\n <div [style.background-color]=\"_accentColorValue()\" class=\"text-white px-3 py-2.5\">\n <!-- top row: nav arrows + month/year title -->\n <div class=\"flex items-center justify-between mb-1.5\">\n @if (_viewMode() === 'days' && _showYearNav()) {\n <button type=\"button\" (click)=\"_prevYear()\" class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-white/80 hover:bg-white/20 cursor-pointer transition-colors\" aria-label=\"Previous year\">\n <i class=\"pi pi-angle-double-left text-xs\"></i>\n </button>\n }\n @if (_viewMode() !== 'years') {\n <button type=\"button\" (click)=\"_prevPeriod()\" class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-white/80 hover:bg-white/20 cursor-pointer transition-colors\" aria-label=\"Previous\">\n <i class=\"pi pi-angle-left text-sm\"></i>\n </button>\n }\n\n <div class=\"flex items-center gap-1 text-sm font-semibold\">\n @if (_viewMode() === 'days') {\n <button type=\"button\" (click)=\"_showMonths()\" class=\"px-1.5 py-0.5 border-none rounded bg-transparent text-white hover:bg-white/20 cursor-pointer transition-colors\">{{ _monthName() }}</button>\n <button type=\"button\" (click)=\"_showYears()\" class=\"px-1.5 py-0.5 border-none rounded bg-transparent text-white hover:bg-white/20 cursor-pointer transition-colors\">{{ _year() }}</button>\n }\n @if (_viewMode() === 'months') {\n <button type=\"button\" (click)=\"_showYears()\" class=\"px-1.5 py-0.5 border-none rounded bg-transparent text-white hover:bg-white/20 cursor-pointer transition-colors\">{{ _year() }}</button>\n }\n @if (_viewMode() === 'years') {\n <span class=\"px-1.5\">{{ _decadeLabel() }}</span>\n }\n </div>\n\n @if (_viewMode() !== 'years') {\n <button type=\"button\" (click)=\"_nextPeriod()\" class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-white/80 hover:bg-white/20 cursor-pointer transition-colors\" aria-label=\"Next\">\n <i class=\"pi pi-angle-right text-sm\"></i>\n </button>\n }\n @if (_viewMode() === 'days' && _showYearNav()) {\n <button type=\"button\" (click)=\"_nextYear()\" class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-white/80 hover:bg-white/20 cursor-pointer transition-colors\" aria-label=\"Next year\">\n <i class=\"pi pi-angle-double-right text-xs\"></i>\n </button>\n }\n </div>\n\n <!-- today button -->\n @if (_showTodayBtn() && _viewMode() === 'days') {\n <button type=\"button\" (click)=\"_goToToday()\" class=\"w-full flex items-center justify-center gap-1.5 py-1 px-2 border-none rounded bg-white/20 hover:bg-white/30 text-white text-xs cursor-pointer transition-colors\">\n <i class=\"pi pi-calendar-plus text-xs\"></i>\n Today\n </button>\n }\n </div>\n\n <!-- ===== DAYS VIEW ===== -->\n @if (_viewMode() === 'days') {\n <div class=\"p-2.5\">\n <div class=\"grid grid-cols-7 mb-0.5\">\n @for (day of _weekDaysOrdered(); track $index) {\n <div class=\"flex items-center justify-center h-7 text-xs font-medium text-[var(--color-text-muted)] font-[var(--font-sans)]\">{{ day }}</div>\n }\n </div>\n <div class=\"grid grid-cols-7 gap-0.5\">\n @for (day of _calendarDays(); track day.date.getTime()) {\n @if (day.date.getMonth() === _viewDate().getMonth() || day.date.getMonth() === _viewDate().getMonth() - 1 || day.date.getMonth() === _viewDate().getMonth() + 1) {\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-9 h-9 p-0 border-none rounded-full cursor-pointer text-sm font-[var(--font-sans)] transition-all duration-150\"\n [class.text-[var(--color-text-muted)]]=\"!day.isCurrentMonth && !day.isSelected\"\n [class.text-[var(--color-text)]]=\"day.isCurrentMonth && !day.isSelected && !day.isToday\"\n [class.font-semibold]=\"day.isToday || day.isSelected\"\n [class.bg-[var(--date-accent)]]=\"day.isSelected\"\n [class.text-white]=\"day.isSelected\"\n [class.ring-2]=\"day.isToday && !day.isSelected\"\n [class.ring-[var(--date-accent)]]=\"day.isToday && !day.isSelected\"\n [class.bg-[var(--color-surface-alt)]]=\"day.isHighlighted && !day.isSelected\"\n [class.hover:bg-[var(--color-surface-alt)]]=\"!day.isSelected && !day.isDisabled\"\n [class.opacity-30]=\"day.isDisabled\"\n [class.cursor-not-allowed]=\"day.isDisabled\"\n [disabled]=\"day.isDisabled\"\n (click)=\"_selectDate(day.date)\"\n [attr.aria-label]=\"day.date.toLocaleDateString()\"\n >{{ day.day }}</button>\n }\n }\n </div>\n </div>\n }\n\n <!-- ===== MONTHS VIEW ===== -->\n @if (_viewMode() === 'months') {\n <div class=\"grid grid-cols-3 gap-2 p-3\">\n @for (month of _monthNames; track $index) {\n <button\n type=\"button\"\n class=\"p-2 rounded-lg text-xs font-[var(--font-sans)] transition-colors cursor-pointer\"\n [class.bg-[var(--date-accent)]]=\"_isCurrentMonth($index)\"\n [class.text-white]=\"_isCurrentMonth($index)\"\n [class.text-[var(--color-text)]]=\"!_isCurrentMonth($index)\"\n [class.hover:bg-[var(--color-surface-alt)]]=\"!_isCurrentMonth($index)\"\n (click)=\"_selectMonth($index)\"\n >{{ _monthsShort[$index] }}</button>\n }\n </div>\n }\n\n <!-- ===== YEARS VIEW ===== -->\n @if (_viewMode() === 'years') {\n <div class=\"p-2.5\">\n <div class=\"flex items-center justify-between mb-2 px-1\">\n <button type=\"button\" (click)=\"_prevDecade()\" class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-[var(--date-accent)] hover:bg-[var(--color-surface-alt)] cursor-pointer transition-colors\">\n <i class=\"pi pi-chevron-left text-xs\"></i>\n </button>\n <span class=\"text-sm font-semibold text-[var(--color-text)] font-[var(--font-sans)]\">{{ _decadeLabel() }}</span>\n <button type=\"button\" (click)=\"_nextDecade()\" class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-[var(--date-accent)] hover:bg-[var(--color-surface-alt)] cursor-pointer transition-colors\">\n <i class=\"pi pi-chevron-right text-xs\"></i>\n </button>\n </div>\n <div class=\"grid grid-cols-4 gap-2\">\n @for (year of _yearsList(); track $index) {\n <button\n type=\"button\"\n class=\"p-2 rounded-lg text-xs font-[var(--font-sans)] transition-colors cursor-pointer\"\n [class.bg-[var(--date-accent)]]=\"_isCurrentYear(year)\"\n [class.text-white]=\"_isCurrentYear(year)\"\n [class.text-[var(--color-text)]]=\"!_isCurrentYear(year)\"\n [class.hover:bg-[var(--color-surface-alt)]]=\"!_isCurrentYear(year)\"\n (click)=\"_selectYear(year)\"\n >{{ year }}</button>\n }\n </div>\n </div>\n }\n </div>\n }\n</div>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--date-accent: var(--color-primary, oklch(.32 .09 258));--date-bg: var(--color-surface, oklch(.99 0 0));--date-border: var(--color-border, oklch(.83 .015 260));--date-text: var(--color-text, oklch(.14 .01 260));--date-muted: var(--color-text-muted, oklch(.48 .01 260));--date-radius: var(--radius-md, .5rem);position:relative;display:inline-block;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--date-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--date-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--date-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--date-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--date-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--date-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--date-accent: var(--color-info, oklch(.55 .15 235))}:host.has-error input{border-color:var(--color-danger)!important}:host.has-error input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.dp-fade-in{animation:dpIn .2s ease}.dp-fade-out{animation:dpOut .15s ease forwards}@keyframes dpIn{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes dpOut{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
363
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], accentColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accentColor", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }] } });
|
|
364
|
+
|
|
365
|
+
class DropDownComponent {
|
|
366
|
+
_elementRef = inject(ElementRef);
|
|
367
|
+
_closeTimer = null;
|
|
368
|
+
_docClickCleanup;
|
|
369
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
370
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
371
|
+
placeholder = input('Select...', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
372
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
373
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
374
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
375
|
+
searchable = input(false, ...(ngDevMode ? [{ debugName: "searchable" }] : []));
|
|
376
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
377
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
378
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
379
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
380
|
+
config = input({}, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
381
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
382
|
+
_direction = computed(() => this.config().direction ?? 'auto', ...(ngDevMode ? [{ debugName: "_direction" }] : []));
|
|
383
|
+
_accentKey = computed(() => {
|
|
384
|
+
const c = this.accentColor();
|
|
385
|
+
return c && isThemeColor(c) ? c : null;
|
|
386
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
387
|
+
_rawAccent = computed(() => {
|
|
388
|
+
const c = this.accentColor();
|
|
389
|
+
return c && !isThemeColor(c) ? c : null;
|
|
390
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
391
|
+
_accentColorValue = computed(() => {
|
|
392
|
+
const c = this.accentColor();
|
|
393
|
+
if (c && !isThemeColor(c))
|
|
394
|
+
return c;
|
|
395
|
+
const key = c && isThemeColor(c) ? c : 'primary';
|
|
396
|
+
const fallbacks = { primary: 'oklch(0.32 0.09 258)', secondary: 'oklch(0.55 0.12 40)', accent: 'oklch(0.64 0.2 50)', success: 'oklch(0.55 0.18 145)', warning: 'oklch(0.68 0.18 75)', danger: 'oklch(0.55 0.22 25)', info: 'oklch(0.55 0.15 235)' };
|
|
397
|
+
return `var(--color-${key}, ${fallbacks[key]})`;
|
|
398
|
+
}, ...(ngDevMode ? [{ debugName: "_accentColorValue" }] : []));
|
|
399
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
400
|
+
_normalizedOptions = computed(() => this.options().map(o => typeof o === 'string' ? { label: o, value: o } : o), ...(ngDevMode ? [{ debugName: "_normalizedOptions" }] : []));
|
|
401
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
402
|
+
_isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : []));
|
|
403
|
+
_panelDirection = signal('down', ...(ngDevMode ? [{ debugName: "_panelDirection" }] : []));
|
|
404
|
+
_panelX = signal(0, ...(ngDevMode ? [{ debugName: "_panelX" }] : []));
|
|
405
|
+
_panelY = signal(0, ...(ngDevMode ? [{ debugName: "_panelY" }] : []));
|
|
406
|
+
_panelWidth = signal(0, ...(ngDevMode ? [{ debugName: "_panelWidth" }] : []));
|
|
407
|
+
_panelEl = null;
|
|
408
|
+
_searchQuery = signal('', ...(ngDevMode ? [{ debugName: "_searchQuery" }] : []));
|
|
409
|
+
_appendToParent = computed(() => this.config().appendToParent ?? false, ...(ngDevMode ? [{ debugName: "_appendToParent" }] : []));
|
|
410
|
+
_panelFixed = computed(() => this._isOpen() && this._appendToParent() ? 'fixed' : null, ...(ngDevMode ? [{ debugName: "_panelFixed" }] : []));
|
|
411
|
+
_maxHeight = computed(() => this.config().maxHeight ?? '256px', ...(ngDevMode ? [{ debugName: "_maxHeight" }] : []));
|
|
412
|
+
_selectedLabel = computed(() => {
|
|
413
|
+
const v = this.value();
|
|
414
|
+
if (!v)
|
|
415
|
+
return '';
|
|
416
|
+
const found = this._normalizedOptions().find(o => o.value === v);
|
|
417
|
+
return found ? found.label : v;
|
|
418
|
+
}, ...(ngDevMode ? [{ debugName: "_selectedLabel" }] : []));
|
|
419
|
+
_filteredOptions = computed(() => {
|
|
420
|
+
const q = this._searchQuery().toLowerCase();
|
|
421
|
+
if (!q)
|
|
422
|
+
return this._normalizedOptions();
|
|
423
|
+
return this._normalizedOptions().filter(o => o.label.toLowerCase().includes(q));
|
|
424
|
+
}, ...(ngDevMode ? [{ debugName: "_filteredOptions" }] : []));
|
|
425
|
+
_inputSizeCls = computed(() => {
|
|
426
|
+
const s = this.size();
|
|
427
|
+
return s === 'sm' ? 'py-1 pl-2 pr-8 text-xs' : s === 'lg' ? 'py-3 pl-4 pr-10 text-base' : 'py-2 pl-3 pr-10 text-sm';
|
|
428
|
+
}, ...(ngDevMode ? [{ debugName: "_inputSizeCls" }] : []));
|
|
429
|
+
_iconCls = computed(() => {
|
|
430
|
+
const s = this.size();
|
|
431
|
+
const r = s === 'sm' ? 'right-2' : s === 'lg' ? 'right-3' : 'right-2.5';
|
|
432
|
+
const f = s === 'sm' ? 'text-xs' : s === 'lg' ? 'text-lg' : 'text-sm';
|
|
433
|
+
return `absolute top-1/2 -translate-y-1/2 ${r} ${f} text-[var(--drop-muted)] pointer-events-none transition-transform duration-200 ${this._isOpen() ? 'rotate-180' : ''}`;
|
|
434
|
+
}, ...(ngDevMode ? [{ debugName: "_iconCls" }] : []));
|
|
435
|
+
_optionCls = computed(() => {
|
|
436
|
+
const s = this.size();
|
|
437
|
+
return `w-full text-left border-none cursor-pointer transition-colors duration-100 hover:bg-[color-mix(in_srgb,var(--color-accent)_12%,var(--color-surface))] ${s === 'sm' ? 'px-2 py-1.5 text-xs' : s === 'lg' ? 'px-4 py-3 text-base' : 'px-3 py-2 text-sm'}`;
|
|
438
|
+
}, ...(ngDevMode ? [{ debugName: "_optionCls" }] : []));
|
|
439
|
+
_onTriggerClick(event) {
|
|
440
|
+
if (this.disabled())
|
|
441
|
+
return;
|
|
442
|
+
if (this._isOpen()) {
|
|
443
|
+
this._close();
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
this._open();
|
|
447
|
+
}
|
|
448
|
+
_onPanelClick(event) {
|
|
449
|
+
event.stopPropagation();
|
|
450
|
+
}
|
|
451
|
+
_open() {
|
|
452
|
+
this._isClosing.set(false);
|
|
453
|
+
this._isOpen.set(true);
|
|
454
|
+
this._searchQuery.set('');
|
|
455
|
+
const rect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
456
|
+
const dir = this._direction();
|
|
457
|
+
if (dir === 'up' || dir === 'down') {
|
|
458
|
+
this._panelDirection.set(dir);
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
const panelH = Math.min(320, parseInt(this._maxHeight()));
|
|
462
|
+
this._panelDirection.set(window.innerHeight - rect.bottom >= panelH + 60 ? 'down' : 'up');
|
|
463
|
+
}
|
|
464
|
+
if (this._appendToParent()) {
|
|
465
|
+
this._panelX.set(rect.left);
|
|
466
|
+
this._panelY.set(this._panelDirection() === 'down' ? rect.bottom : rect.top);
|
|
467
|
+
this._panelWidth.set(rect.width);
|
|
468
|
+
setTimeout(() => this._attachToBody());
|
|
469
|
+
}
|
|
470
|
+
if (this.searchable()) {
|
|
471
|
+
setTimeout(() => {
|
|
472
|
+
const input = this._elementRef.nativeElement.querySelector('[data-dd-search]');
|
|
473
|
+
input?.focus();
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
const handler = (e) => this._onDocClick(e);
|
|
477
|
+
document.addEventListener('click', handler);
|
|
478
|
+
this._docClickCleanup = () => document.removeEventListener('click', handler);
|
|
479
|
+
}
|
|
480
|
+
_close() {
|
|
481
|
+
if (!this._isOpen())
|
|
482
|
+
return;
|
|
483
|
+
this._docClickCleanup?.();
|
|
484
|
+
this._docClickCleanup = undefined;
|
|
485
|
+
if (this._closeTimer)
|
|
486
|
+
clearTimeout(this._closeTimer);
|
|
487
|
+
this._isClosing.set(true);
|
|
488
|
+
if (this._appendToParent())
|
|
489
|
+
this._detachFromBody();
|
|
490
|
+
this._closeTimer = setTimeout(() => {
|
|
491
|
+
this._isOpen.set(false);
|
|
492
|
+
this._isClosing.set(false);
|
|
493
|
+
this._closeTimer = null;
|
|
494
|
+
}, 150);
|
|
495
|
+
}
|
|
496
|
+
_attachToBody() {
|
|
497
|
+
const panel = this._elementRef.nativeElement.querySelector('[data-dd-panel]');
|
|
498
|
+
if (panel) {
|
|
499
|
+
document.body.appendChild(panel);
|
|
500
|
+
this._panelEl = panel;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
_detachFromBody() {
|
|
504
|
+
if (!this._panelEl)
|
|
505
|
+
return;
|
|
506
|
+
const wrapper = this._elementRef.nativeElement.querySelector('.dd-wrapper');
|
|
507
|
+
if (wrapper && this._panelEl.parentNode !== wrapper) {
|
|
508
|
+
wrapper.appendChild(this._panelEl);
|
|
509
|
+
}
|
|
510
|
+
this._panelEl = null;
|
|
511
|
+
}
|
|
512
|
+
_selectOption(option) {
|
|
513
|
+
this.value.set(option.value);
|
|
514
|
+
this._close();
|
|
515
|
+
}
|
|
516
|
+
_clear(event) {
|
|
517
|
+
event.stopPropagation();
|
|
518
|
+
this.value.set(null);
|
|
519
|
+
}
|
|
520
|
+
_onWindowScroll() {
|
|
521
|
+
if (this._isOpen() && this._appendToParent()) {
|
|
522
|
+
this._close();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
_onDocClick(event) {
|
|
526
|
+
if (!this._isOpen())
|
|
527
|
+
return;
|
|
528
|
+
const target = event.target;
|
|
529
|
+
if (this._elementRef.nativeElement.contains(target))
|
|
530
|
+
return;
|
|
531
|
+
if (this._panelEl?.contains(target))
|
|
532
|
+
return;
|
|
533
|
+
this._close();
|
|
534
|
+
}
|
|
535
|
+
ngOnDestroy() {
|
|
536
|
+
this._docClickCleanup?.();
|
|
537
|
+
if (this._closeTimer)
|
|
538
|
+
clearTimeout(this._closeTimer);
|
|
539
|
+
if (this._panelEl && document.body.contains(this._panelEl)) {
|
|
540
|
+
document.body.removeChild(this._panelEl);
|
|
541
|
+
this._panelEl = null;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: DropDownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
545
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: DropDownComponent, isStandalone: true, selector: "app-drop-down", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, accentColor: { classPropertyName: "accentColor", publicName: "accentColor", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "window:scroll": "_onWindowScroll()" }, properties: { "attr.data-size": "_size", "attr.data-accent": "_accentKey", "class.has-error": "error()", "style.--drop-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<div class=\"relative dd-wrapper\">\n <label class=\"flex items-center w-full\" (click)=\"_onTriggerClick($event)\">\n <input\n class=\"w-full outline-none transition-[border-color,box-shadow] duration-200 ease bg-[var(--drop-bg)] border border-[var(--drop-border)] rounded-[var(--drop-radius)] text-[var(--drop-text)] font-[var(--font-sans)] placeholder:text-[var(--drop-muted)] disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer focus:border-[var(--drop-accent)] focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--drop-accent)_20%,transparent)]\"\n [class]=\"_inputSizeCls()\"\n type=\"text\"\n readonly\n [attr.placeholder]=\"placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n [value]=\"_selectedLabel()\"\n />\n\n @if (_selectedLabel() && !disabled()) {\n <button class=\"absolute top-1/2 -translate-y-1/2 right-8 flex items-center justify-center p-0 border-none bg-transparent cursor-pointer text-[var(--drop-muted)] hover:text-[var(--drop-text)] transition-colors duration-150\" type=\"button\" (click)=\"_clear($event)\" aria-label=\"Clear\">\n <i class=\"pi pi-times text-xs sm:text-sm lg:text-base\"></i>\n </button>\n }\n\n <i [class]=\"_iconCls() + ' pi pi-chevron-down'\"></i>\n </label>\n\n @if (_isOpen() || _isClosing()) {\n <div\n data-dd-panel\n class=\"left-0 z-50 w-full min-w-60 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--radius-md)] shadow-lg overflow-hidden text-[var(--color-text)]\"\n [class.absolute]=\"!_appendToParent()\"\n [style.position]=\"_panelFixed()\"\n [style.left.px]=\"_appendToParent() ? _panelX() : null\"\n [style.top.px]=\"_appendToParent() ? _panelY() : null\"\n [style.width.px]=\"_appendToParent() ? _panelWidth() : null\"\n [class.top-full]=\"!_appendToParent() && _panelDirection() === 'down'\"\n [class.bottom-full]=\"!_appendToParent() && _panelDirection() === 'up'\"\n [class.dd-fade-in]=\"_isOpen() && !_isClosing()\"\n [class.dd-fade-out]=\"_isClosing()\"\n (click)=\"_onPanelClick($event)\">\n\n @if (searchable()) {\n <div class=\"px-2 pt-2\">\n <input\n data-dd-search\n type=\"text\"\n class=\"w-full px-2 py-1.5 text-sm border border-[var(--color-border)] rounded outline-none bg-[var(--color-surface)] text-[var(--color-text)] placeholder:text-[var(--color-text-muted)] focus:border-[var(--color-accent)]\"\n placeholder=\"Search...\"\n [value]=\"_searchQuery()\"\n (input)=\"_searchQuery.set($any($event.target).value)\"\n (click)=\"$event.stopPropagation()\"\n />\n </div>\n }\n\n <div\n class=\"overflow-y-auto\"\n [style.max-height]=\"_maxHeight()\"\n (scroll)=\"$event.stopPropagation()\">\n @for (option of _filteredOptions(); track option.value) {\n <button\n type=\"button\"\n [class]=\"_optionCls()\"\n [class.font-semibold]=\"option.value === value()\"\n [style.background-color]=\"option.value === value() ? 'var(--color-accent)' : null\"\n [style.color]=\"option.value === value() ? 'var(--color-primary-inverse)' : null\"\n (click)=\"_selectOption(option)\"\n >{{ option.label }}</button>\n }\n\n @if (_filteredOptions().length === 0) {\n <div class=\"px-3 py-4 text-center text-sm text-[var(--drop-muted)]\">No results found</div>\n }\n </div>\n </div>\n }\n</div>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--drop-accent: var(--color-accent, oklch(.64 .2 50));--drop-bg: var(--color-surface, oklch(.99 0 0));--drop-border: var(--color-border, oklch(.83 .015 260));--drop-text: var(--color-text, oklch(.14 .01 260));--drop-muted: var(--color-text-muted, oklch(.48 .01 260));--drop-surface: var(--color-surface-alt, oklch(.975 .005 260));--drop-radius: var(--radius-md, .5rem);position:relative;display:inline-block;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--drop-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--drop-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--drop-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--drop-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--drop-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--drop-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--drop-accent: var(--color-info, oklch(.55 .15 235))}:host.has-error input{border-color:var(--color-danger, oklch(.55 .25 25))!important}:host.has-error input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger, oklch(.55 .25 25)) 20%,transparent)!important}.dd-fade-in{animation:ddIn .2s ease}.dd-fade-out{animation:ddOut .15s ease forwards}@keyframes ddIn{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes ddOut{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
546
|
+
}
|
|
547
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: DropDownComponent, decorators: [{
|
|
548
|
+
type: Component,
|
|
549
|
+
args: [{ selector: 'app-drop-down', imports: [], host: {
|
|
550
|
+
'[attr.data-size]': '_size',
|
|
551
|
+
'[attr.data-accent]': '_accentKey',
|
|
552
|
+
'[class.has-error]': 'error()',
|
|
553
|
+
'[style.--drop-accent]': '_rawAccent',
|
|
554
|
+
'[style.width]': '_width',
|
|
555
|
+
'(window:scroll)': '_onWindowScroll()',
|
|
556
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"relative dd-wrapper\">\n <label class=\"flex items-center w-full\" (click)=\"_onTriggerClick($event)\">\n <input\n class=\"w-full outline-none transition-[border-color,box-shadow] duration-200 ease bg-[var(--drop-bg)] border border-[var(--drop-border)] rounded-[var(--drop-radius)] text-[var(--drop-text)] font-[var(--font-sans)] placeholder:text-[var(--drop-muted)] disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer focus:border-[var(--drop-accent)] focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--drop-accent)_20%,transparent)]\"\n [class]=\"_inputSizeCls()\"\n type=\"text\"\n readonly\n [attr.placeholder]=\"placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n [value]=\"_selectedLabel()\"\n />\n\n @if (_selectedLabel() && !disabled()) {\n <button class=\"absolute top-1/2 -translate-y-1/2 right-8 flex items-center justify-center p-0 border-none bg-transparent cursor-pointer text-[var(--drop-muted)] hover:text-[var(--drop-text)] transition-colors duration-150\" type=\"button\" (click)=\"_clear($event)\" aria-label=\"Clear\">\n <i class=\"pi pi-times text-xs sm:text-sm lg:text-base\"></i>\n </button>\n }\n\n <i [class]=\"_iconCls() + ' pi pi-chevron-down'\"></i>\n </label>\n\n @if (_isOpen() || _isClosing()) {\n <div\n data-dd-panel\n class=\"left-0 z-50 w-full min-w-60 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--radius-md)] shadow-lg overflow-hidden text-[var(--color-text)]\"\n [class.absolute]=\"!_appendToParent()\"\n [style.position]=\"_panelFixed()\"\n [style.left.px]=\"_appendToParent() ? _panelX() : null\"\n [style.top.px]=\"_appendToParent() ? _panelY() : null\"\n [style.width.px]=\"_appendToParent() ? _panelWidth() : null\"\n [class.top-full]=\"!_appendToParent() && _panelDirection() === 'down'\"\n [class.bottom-full]=\"!_appendToParent() && _panelDirection() === 'up'\"\n [class.dd-fade-in]=\"_isOpen() && !_isClosing()\"\n [class.dd-fade-out]=\"_isClosing()\"\n (click)=\"_onPanelClick($event)\">\n\n @if (searchable()) {\n <div class=\"px-2 pt-2\">\n <input\n data-dd-search\n type=\"text\"\n class=\"w-full px-2 py-1.5 text-sm border border-[var(--color-border)] rounded outline-none bg-[var(--color-surface)] text-[var(--color-text)] placeholder:text-[var(--color-text-muted)] focus:border-[var(--color-accent)]\"\n placeholder=\"Search...\"\n [value]=\"_searchQuery()\"\n (input)=\"_searchQuery.set($any($event.target).value)\"\n (click)=\"$event.stopPropagation()\"\n />\n </div>\n }\n\n <div\n class=\"overflow-y-auto\"\n [style.max-height]=\"_maxHeight()\"\n (scroll)=\"$event.stopPropagation()\">\n @for (option of _filteredOptions(); track option.value) {\n <button\n type=\"button\"\n [class]=\"_optionCls()\"\n [class.font-semibold]=\"option.value === value()\"\n [style.background-color]=\"option.value === value() ? 'var(--color-accent)' : null\"\n [style.color]=\"option.value === value() ? 'var(--color-primary-inverse)' : null\"\n (click)=\"_selectOption(option)\"\n >{{ option.label }}</button>\n }\n\n @if (_filteredOptions().length === 0) {\n <div class=\"px-3 py-4 text-center text-sm text-[var(--drop-muted)]\">No results found</div>\n }\n </div>\n </div>\n }\n</div>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--drop-accent: var(--color-accent, oklch(.64 .2 50));--drop-bg: var(--color-surface, oklch(.99 0 0));--drop-border: var(--color-border, oklch(.83 .015 260));--drop-text: var(--color-text, oklch(.14 .01 260));--drop-muted: var(--color-text-muted, oklch(.48 .01 260));--drop-surface: var(--color-surface-alt, oklch(.975 .005 260));--drop-radius: var(--radius-md, .5rem);position:relative;display:inline-block;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--drop-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--drop-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--drop-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--drop-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--drop-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--drop-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--drop-accent: var(--color-info, oklch(.55 .15 235))}:host.has-error input{border-color:var(--color-danger, oklch(.55 .25 25))!important}:host.has-error input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger, oklch(.55 .25 25)) 20%,transparent)!important}.dd-fade-in{animation:ddIn .2s ease}.dd-fade-out{animation:ddOut .15s ease forwards}@keyframes ddIn{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes ddOut{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
557
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], accentColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accentColor", required: false }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }] } });
|
|
558
|
+
|
|
559
|
+
class FileUploadComponent {
|
|
560
|
+
files = model([], ...(ngDevMode ? [{ debugName: "files" }] : []));
|
|
561
|
+
accept = input('', ...(ngDevMode ? [{ debugName: "accept" }] : []));
|
|
562
|
+
multiple = input(true, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
563
|
+
maxSize = input(0, ...(ngDevMode ? [{ debugName: "maxSize" }] : []));
|
|
564
|
+
maxFiles = input(0, ...(ngDevMode ? [{ debugName: "maxFiles" }] : []));
|
|
565
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
566
|
+
placeholder = input('Drop files here or click to browse', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
567
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
568
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
569
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
570
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
571
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
572
|
+
_isDragOver = signal(false, ...(ngDevMode ? [{ debugName: "_isDragOver" }] : []));
|
|
573
|
+
_totalSize = computed(() => this.files().reduce((s, f) => s + f.size, 0), ...(ngDevMode ? [{ debugName: "_totalSize" }] : []));
|
|
574
|
+
_onDragOver(event) {
|
|
575
|
+
event.preventDefault();
|
|
576
|
+
event.stopPropagation();
|
|
577
|
+
if (!this.disabled())
|
|
578
|
+
this._isDragOver.set(true);
|
|
579
|
+
}
|
|
580
|
+
_onDragLeave(event) {
|
|
581
|
+
event.preventDefault();
|
|
582
|
+
event.stopPropagation();
|
|
583
|
+
this._isDragOver.set(false);
|
|
584
|
+
}
|
|
585
|
+
_onDrop(event) {
|
|
586
|
+
event.preventDefault();
|
|
587
|
+
event.stopPropagation();
|
|
588
|
+
this._isDragOver.set(false);
|
|
589
|
+
if (this.disabled())
|
|
590
|
+
return;
|
|
591
|
+
const dropped = event.dataTransfer?.files;
|
|
592
|
+
if (dropped)
|
|
593
|
+
this._addFiles(Array.from(dropped));
|
|
594
|
+
}
|
|
595
|
+
_onFileSelected(event) {
|
|
596
|
+
const input = event.target;
|
|
597
|
+
if (input.files)
|
|
598
|
+
this._addFiles(Array.from(input.files));
|
|
599
|
+
input.value = '';
|
|
600
|
+
}
|
|
601
|
+
_removeFile(index) {
|
|
602
|
+
this.files.update(f => f.filter((_, i) => i !== index));
|
|
603
|
+
}
|
|
604
|
+
_addFiles(newFiles) {
|
|
605
|
+
let current = this.files();
|
|
606
|
+
if (this.accept()) {
|
|
607
|
+
const accepted = this.accept().split(',').map(a => a.trim().toLowerCase());
|
|
608
|
+
newFiles = newFiles.filter(f => accepted.some(a => f.type.match(a.replace('*', '.*')) || f.name.toLowerCase().endsWith(a.replace('.*', ''))));
|
|
609
|
+
}
|
|
610
|
+
if (this.maxSize()) {
|
|
611
|
+
newFiles = newFiles.filter(f => f.size <= this.maxSize());
|
|
612
|
+
}
|
|
613
|
+
if (this.multiple()) {
|
|
614
|
+
const max = this.maxFiles() || Infinity;
|
|
615
|
+
const remaining = max - current.length;
|
|
616
|
+
if (remaining <= 0)
|
|
617
|
+
return;
|
|
618
|
+
newFiles = newFiles.slice(0, remaining);
|
|
619
|
+
current = [...current, ...newFiles];
|
|
620
|
+
}
|
|
621
|
+
else {
|
|
622
|
+
current = newFiles.slice(0, 1);
|
|
623
|
+
}
|
|
624
|
+
this.files.set(current);
|
|
625
|
+
}
|
|
626
|
+
_formatSize(bytes) {
|
|
627
|
+
if (bytes < 1024)
|
|
628
|
+
return `${bytes} B`;
|
|
629
|
+
if (bytes < 1048576)
|
|
630
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
631
|
+
return `${(bytes / 1048576).toFixed(1)} MB`;
|
|
632
|
+
}
|
|
633
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: FileUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
634
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: FileUploadComponent, isStandalone: true, selector: "app-file-upload", inputs: { files: { classPropertyName: "files", publicName: "files", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, maxSize: { classPropertyName: "maxSize", publicName: "maxSize", isSignal: true, isRequired: false, transformFunction: null }, maxFiles: { classPropertyName: "maxFiles", publicName: "maxFiles", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { files: "filesChange" }, host: { properties: { "attr.data-size": "_size" } }, ngImport: i0, template: "<div\n class=\"drop-zone\"\n [class.is-dragover]=\"_isDragOver()\"\n [class.is-disabled]=\"disabled()\"\n (dragover)=\"_onDragOver($event)\"\n (dragleave)=\"_onDragLeave($event)\"\n (drop)=\"_onDrop($event)\"\n (click)=\"_input.click()\"\n>\n <input\n #_input\n type=\"file\"\n [attr.accept]=\"accept() || null\"\n [attr.multiple]=\"multiple() ? true : null\"\n [attr.disabled]=\"disabled() ? true : null\"\n (change)=\"_onFileSelected($event)\"\n style=\"display:none\"\n />\n\n <i class=\"pi pi-cloud-upload\" [class.text-2xl]=\"size() !== 'sm'\" [class.text-xl]=\"size() === 'sm'\"></i>\n\n @if (files().length) {\n <span class=\"text-xs font-medium\">{{ files().length }} file{{ files().length !== 1 ? 's' : '' }} selected</span>\n } @else {\n <span class=\"text-xs\">{{ placeholder() }}</span>\n }\n\n @if (maxSize()) {\n <span class=\"text-[10px] opacity-60\">Max {{ _formatSize(maxSize()) }} per file</span>\n }\n</div>\n\n@if (files().length) {\n <div class=\"file-list\">\n @for (file of files(); track file.name + file.size + file.lastModified; let i = $index) {\n <div class=\"file-item\">\n <i class=\"pi pi-file file-item-icon\"></i>\n <span class=\"file-item-name\" [title]=\"file.name\">{{ file.name }}</span>\n <span class=\"file-item-size\">{{ _formatSize(file.size) }}</span>\n <button type=\"button\" class=\"file-item-remove\" (click)=\"_removeFile(i)\" aria-label=\"Remove file\">×</button>\n </div>\n }\n </div>\n}\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--fu-accent: var(--color-accent, oklch(.64 .2 50));--fu-bg: var(--color-surface, oklch(.99 0 0));--fu-border: var(--color-border, oklch(.83 .015 260));--fu-text: var(--color-text, oklch(.14 .01 260));--fu-muted: var(--color-text-muted, oklch(.48 .01 260));--fu-radius: var(--radius-md, .5rem);position:relative;display:inline-block;padding-bottom:1.375rem;width:100%}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}.drop-zone{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.375rem;padding:2rem 1rem;border:2px dashed var(--fu-border);border-radius:var(--fu-radius);background:var(--fu-bg);cursor:pointer;transition:all .2s ease;color:var(--fu-muted);text-align:center}.drop-zone:hover,.drop-zone.is-dragover{border-color:var(--fu-accent);background:color-mix(in srgb,var(--fu-accent) 6%,var(--fu-bg));color:var(--fu-text)}.drop-zone.is-disabled{opacity:.5;cursor:not-allowed}.file-list{display:flex;flex-direction:column;gap:.25rem;margin-top:.5rem}.file-item{display:flex;align-items:center;gap:.5rem;padding:.375rem .5rem;border-radius:calc(var(--fu-radius) - 2px);background:color-mix(in srgb,var(--fu-accent) 6%,var(--fu-bg));font-size:.8125rem;color:var(--fu-text)}.file-item-icon{flex-shrink:0;font-size:.75rem;color:var(--fu-accent)}.file-item-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-item-size{flex-shrink:0;font-size:.6875rem;color:var(--fu-muted)}.file-item-remove{display:inline-flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;padding:0;border:none;border-radius:50%;background:transparent;cursor:pointer;color:var(--fu-muted);font-size:.6875rem;transition:all .15s}.file-item-remove:hover{background:color-mix(in srgb,var(--color-danger) 15%,transparent);color:var(--color-danger)}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
635
|
+
}
|
|
636
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: FileUploadComponent, decorators: [{
|
|
637
|
+
type: Component,
|
|
638
|
+
args: [{ selector: 'app-file-upload', imports: [], host: {
|
|
639
|
+
'[attr.data-size]': '_size',
|
|
640
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"drop-zone\"\n [class.is-dragover]=\"_isDragOver()\"\n [class.is-disabled]=\"disabled()\"\n (dragover)=\"_onDragOver($event)\"\n (dragleave)=\"_onDragLeave($event)\"\n (drop)=\"_onDrop($event)\"\n (click)=\"_input.click()\"\n>\n <input\n #_input\n type=\"file\"\n [attr.accept]=\"accept() || null\"\n [attr.multiple]=\"multiple() ? true : null\"\n [attr.disabled]=\"disabled() ? true : null\"\n (change)=\"_onFileSelected($event)\"\n style=\"display:none\"\n />\n\n <i class=\"pi pi-cloud-upload\" [class.text-2xl]=\"size() !== 'sm'\" [class.text-xl]=\"size() === 'sm'\"></i>\n\n @if (files().length) {\n <span class=\"text-xs font-medium\">{{ files().length }} file{{ files().length !== 1 ? 's' : '' }} selected</span>\n } @else {\n <span class=\"text-xs\">{{ placeholder() }}</span>\n }\n\n @if (maxSize()) {\n <span class=\"text-[10px] opacity-60\">Max {{ _formatSize(maxSize()) }} per file</span>\n }\n</div>\n\n@if (files().length) {\n <div class=\"file-list\">\n @for (file of files(); track file.name + file.size + file.lastModified; let i = $index) {\n <div class=\"file-item\">\n <i class=\"pi pi-file file-item-icon\"></i>\n <span class=\"file-item-name\" [title]=\"file.name\">{{ file.name }}</span>\n <span class=\"file-item-size\">{{ _formatSize(file.size) }}</span>\n <button type=\"button\" class=\"file-item-remove\" (click)=\"_removeFile(i)\" aria-label=\"Remove file\">×</button>\n </div>\n }\n </div>\n}\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--fu-accent: var(--color-accent, oklch(.64 .2 50));--fu-bg: var(--color-surface, oklch(.99 0 0));--fu-border: var(--color-border, oklch(.83 .015 260));--fu-text: var(--color-text, oklch(.14 .01 260));--fu-muted: var(--color-text-muted, oklch(.48 .01 260));--fu-radius: var(--radius-md, .5rem);position:relative;display:inline-block;padding-bottom:1.375rem;width:100%}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}.drop-zone{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.375rem;padding:2rem 1rem;border:2px dashed var(--fu-border);border-radius:var(--fu-radius);background:var(--fu-bg);cursor:pointer;transition:all .2s ease;color:var(--fu-muted);text-align:center}.drop-zone:hover,.drop-zone.is-dragover{border-color:var(--fu-accent);background:color-mix(in srgb,var(--fu-accent) 6%,var(--fu-bg));color:var(--fu-text)}.drop-zone.is-disabled{opacity:.5;cursor:not-allowed}.file-list{display:flex;flex-direction:column;gap:.25rem;margin-top:.5rem}.file-item{display:flex;align-items:center;gap:.5rem;padding:.375rem .5rem;border-radius:calc(var(--fu-radius) - 2px);background:color-mix(in srgb,var(--fu-accent) 6%,var(--fu-bg));font-size:.8125rem;color:var(--fu-text)}.file-item-icon{flex-shrink:0;font-size:.75rem;color:var(--fu-accent)}.file-item-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-item-size{flex-shrink:0;font-size:.6875rem;color:var(--fu-muted)}.file-item-remove{display:inline-flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;padding:0;border:none;border-radius:50%;background:transparent;cursor:pointer;color:var(--fu-muted);font-size:.6875rem;transition:all .15s}.file-item-remove:hover{background:color-mix(in srgb,var(--color-danger) 15%,transparent);color:var(--color-danger)}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
641
|
+
}], propDecorators: { files: [{ type: i0.Input, args: [{ isSignal: true, alias: "files", required: false }] }, { type: i0.Output, args: ["filesChange"] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], maxSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSize", required: false }] }], maxFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFiles", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }] } });
|
|
642
|
+
|
|
643
|
+
class MultiSelectComponent {
|
|
644
|
+
_elementRef = inject(ElementRef);
|
|
645
|
+
_closeTimer = null;
|
|
646
|
+
_docClickCleanup;
|
|
647
|
+
value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
648
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
649
|
+
placeholder = input('Select...', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
650
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
651
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
652
|
+
selectAll = input(true, ...(ngDevMode ? [{ debugName: "selectAll" }] : []));
|
|
653
|
+
selectAllLabel = input('Select All', ...(ngDevMode ? [{ debugName: "selectAllLabel" }] : []));
|
|
654
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
655
|
+
searchable = input(false, ...(ngDevMode ? [{ debugName: "searchable" }] : []));
|
|
656
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
657
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
658
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
659
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
660
|
+
config = input({}, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
661
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
662
|
+
_direction = computed(() => this.config().direction ?? 'auto', ...(ngDevMode ? [{ debugName: "_direction" }] : []));
|
|
663
|
+
_accentKey = computed(() => {
|
|
664
|
+
const c = this.accentColor();
|
|
665
|
+
return c && isThemeColor(c) ? c : null;
|
|
666
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
667
|
+
_rawAccent = computed(() => {
|
|
668
|
+
const c = this.accentColor();
|
|
669
|
+
return c && !isThemeColor(c) ? c : null;
|
|
670
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
671
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
672
|
+
_normalizedOptions = computed(() => this.options().map(o => typeof o === 'string' ? { label: o, value: o } : o), ...(ngDevMode ? [{ debugName: "_normalizedOptions" }] : []));
|
|
673
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
674
|
+
_isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : []));
|
|
675
|
+
_panelDirection = signal('down', ...(ngDevMode ? [{ debugName: "_panelDirection" }] : []));
|
|
676
|
+
_panelX = signal(0, ...(ngDevMode ? [{ debugName: "_panelX" }] : []));
|
|
677
|
+
_panelY = signal(0, ...(ngDevMode ? [{ debugName: "_panelY" }] : []));
|
|
678
|
+
_panelWidth = signal(0, ...(ngDevMode ? [{ debugName: "_panelWidth" }] : []));
|
|
679
|
+
_panelEl = null;
|
|
680
|
+
_searchQuery = signal('', ...(ngDevMode ? [{ debugName: "_searchQuery" }] : []));
|
|
681
|
+
_appendToParent = computed(() => this.config().appendToParent ?? false, ...(ngDevMode ? [{ debugName: "_appendToParent" }] : []));
|
|
682
|
+
_panelFixed = computed(() => this._isOpen() && this._appendToParent() ? 'fixed' : null, ...(ngDevMode ? [{ debugName: "_panelFixed" }] : []));
|
|
683
|
+
_maxHeight = computed(() => this.config().maxHeight ?? '256px', ...(ngDevMode ? [{ debugName: "_maxHeight" }] : []));
|
|
684
|
+
_selectedLabels = computed(() => {
|
|
685
|
+
const v = this.value();
|
|
686
|
+
if (!v.length)
|
|
687
|
+
return [];
|
|
688
|
+
return this._normalizedOptions().filter(o => v.includes(o.value)).map(o => o.label);
|
|
689
|
+
}, ...(ngDevMode ? [{ debugName: "_selectedLabels" }] : []));
|
|
690
|
+
_filteredOptions = computed(() => {
|
|
691
|
+
const q = this._searchQuery().toLowerCase();
|
|
692
|
+
if (!q)
|
|
693
|
+
return this._normalizedOptions();
|
|
694
|
+
return this._normalizedOptions().filter(o => o.label.toLowerCase().includes(q));
|
|
695
|
+
}, ...(ngDevMode ? [{ debugName: "_filteredOptions" }] : []));
|
|
696
|
+
_allFilteredSelected = computed(() => {
|
|
697
|
+
const v = this.value();
|
|
698
|
+
return this._filteredOptions().every(o => v.includes(o.value));
|
|
699
|
+
}, ...(ngDevMode ? [{ debugName: "_allFilteredSelected" }] : []));
|
|
700
|
+
_triggerText = computed(() => {
|
|
701
|
+
const labels = this._selectedLabels();
|
|
702
|
+
if (!labels.length)
|
|
703
|
+
return '';
|
|
704
|
+
if (labels.length === 1)
|
|
705
|
+
return labels[0];
|
|
706
|
+
return `${labels.length} selected`;
|
|
707
|
+
}, ...(ngDevMode ? [{ debugName: "_triggerText" }] : []));
|
|
708
|
+
_inputSizeCls = computed(() => {
|
|
709
|
+
const s = this.size();
|
|
710
|
+
return s === 'sm' ? 'py-1 pl-2 pr-8 text-xs' : s === 'lg' ? 'py-3 pl-4 pr-10 text-base' : 'py-2 pl-3 pr-10 text-sm';
|
|
711
|
+
}, ...(ngDevMode ? [{ debugName: "_inputSizeCls" }] : []));
|
|
712
|
+
_iconCls = computed(() => {
|
|
713
|
+
const s = this.size();
|
|
714
|
+
const r = s === 'sm' ? 'right-2' : s === 'lg' ? 'right-3' : 'right-2.5';
|
|
715
|
+
const f = s === 'sm' ? 'text-xs' : s === 'lg' ? 'text-lg' : 'text-sm';
|
|
716
|
+
return `absolute top-1/2 -translate-y-1/2 ${r} ${f} text-[var(--drop-muted)] pointer-events-none transition-transform duration-200 ${this._isOpen() ? 'rotate-180' : ''}`;
|
|
717
|
+
}, ...(ngDevMode ? [{ debugName: "_iconCls" }] : []));
|
|
718
|
+
_optionCls = computed(() => {
|
|
719
|
+
const s = this.size();
|
|
720
|
+
return `w-full flex items-center gap-2 text-left border-none cursor-pointer transition-colors duration-100 hover:bg-[color-mix(in_srgb,var(--color-accent)_12%,var(--color-surface))] ${s === 'sm' ? 'px-2 py-1.5 text-xs' : s === 'lg' ? 'px-4 py-3 text-base' : 'px-3 py-2 text-sm'}`;
|
|
721
|
+
}, ...(ngDevMode ? [{ debugName: "_optionCls" }] : []));
|
|
722
|
+
_chipCls = computed(() => {
|
|
723
|
+
return `ms-chip`;
|
|
724
|
+
}, ...(ngDevMode ? [{ debugName: "_chipCls" }] : []));
|
|
725
|
+
_isSelected(val) {
|
|
726
|
+
return this.value().includes(val);
|
|
727
|
+
}
|
|
728
|
+
_optVal(option) {
|
|
729
|
+
return option.value;
|
|
730
|
+
}
|
|
731
|
+
_onTriggerClick(event) {
|
|
732
|
+
if (this.disabled())
|
|
733
|
+
return;
|
|
734
|
+
if (this._isOpen()) {
|
|
735
|
+
this._close();
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
this._open();
|
|
739
|
+
}
|
|
740
|
+
_onPanelClick(event) {
|
|
741
|
+
event.stopPropagation();
|
|
742
|
+
}
|
|
743
|
+
_onInput(event) {
|
|
744
|
+
this._searchQuery.set(event.target.value);
|
|
745
|
+
}
|
|
746
|
+
_open() {
|
|
747
|
+
this._isClosing.set(false);
|
|
748
|
+
this._isOpen.set(true);
|
|
749
|
+
this._searchQuery.set('');
|
|
750
|
+
const rect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
751
|
+
const dir = this._direction();
|
|
752
|
+
if (dir === 'up' || dir === 'down') {
|
|
753
|
+
this._panelDirection.set(dir);
|
|
754
|
+
}
|
|
755
|
+
else {
|
|
756
|
+
const panelH = Math.min(320, parseInt(this._maxHeight()));
|
|
757
|
+
this._panelDirection.set(window.innerHeight - rect.bottom >= panelH + 60 ? 'down' : 'up');
|
|
758
|
+
}
|
|
759
|
+
if (this._appendToParent()) {
|
|
760
|
+
this._panelX.set(rect.left);
|
|
761
|
+
this._panelY.set(this._panelDirection() === 'down' ? rect.bottom : rect.top);
|
|
762
|
+
this._panelWidth.set(rect.width);
|
|
763
|
+
setTimeout(() => this._attachToBody());
|
|
764
|
+
}
|
|
765
|
+
if (this.searchable()) {
|
|
766
|
+
setTimeout(() => {
|
|
767
|
+
const input = this._elementRef.nativeElement.querySelector('[data-ms-search]');
|
|
768
|
+
input?.focus();
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
const handler = (e) => this._onDocClick(e);
|
|
772
|
+
document.addEventListener('click', handler);
|
|
773
|
+
this._docClickCleanup = () => document.removeEventListener('click', handler);
|
|
774
|
+
}
|
|
775
|
+
_close() {
|
|
776
|
+
if (!this._isOpen())
|
|
777
|
+
return;
|
|
778
|
+
this._docClickCleanup?.();
|
|
779
|
+
this._docClickCleanup = undefined;
|
|
780
|
+
if (this._closeTimer)
|
|
781
|
+
clearTimeout(this._closeTimer);
|
|
782
|
+
this._isClosing.set(true);
|
|
783
|
+
if (this._appendToParent())
|
|
784
|
+
this._detachFromBody();
|
|
785
|
+
this._closeTimer = setTimeout(() => {
|
|
786
|
+
this._isOpen.set(false);
|
|
787
|
+
this._isClosing.set(false);
|
|
788
|
+
this._closeTimer = null;
|
|
789
|
+
}, 150);
|
|
790
|
+
}
|
|
791
|
+
_attachToBody() {
|
|
792
|
+
const panel = this._elementRef.nativeElement.querySelector('[data-ms-panel]');
|
|
793
|
+
if (panel) {
|
|
794
|
+
document.body.appendChild(panel);
|
|
795
|
+
this._panelEl = panel;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
_detachFromBody() {
|
|
799
|
+
if (!this._panelEl)
|
|
800
|
+
return;
|
|
801
|
+
const wrapper = this._elementRef.nativeElement.querySelector('.ms-wrapper');
|
|
802
|
+
if (wrapper && this._panelEl.parentNode !== wrapper) {
|
|
803
|
+
wrapper.appendChild(this._panelEl);
|
|
804
|
+
}
|
|
805
|
+
this._panelEl = null;
|
|
806
|
+
}
|
|
807
|
+
_toggleOption(option) {
|
|
808
|
+
const val = option.value;
|
|
809
|
+
const current = this.value();
|
|
810
|
+
if (current.includes(val)) {
|
|
811
|
+
this.value.set(current.filter(v => v !== val));
|
|
812
|
+
}
|
|
813
|
+
else {
|
|
814
|
+
this.value.set([...current, val]);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
_toggleSelectAll() {
|
|
818
|
+
if (this._allFilteredSelected()) {
|
|
819
|
+
const remove = this._filteredOptions().map(o => o.value);
|
|
820
|
+
this.value.set(this.value().filter(v => !remove.includes(v)));
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
const add = this._filteredOptions().map(o => o.value);
|
|
824
|
+
const existing = this.value();
|
|
825
|
+
this.value.set([...new Set([...existing, ...add])]);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
_removeChip(val, event) {
|
|
829
|
+
event.stopPropagation();
|
|
830
|
+
this.value.set(this.value().filter(v => v !== val));
|
|
831
|
+
}
|
|
832
|
+
_clearAll(event) {
|
|
833
|
+
event.stopPropagation();
|
|
834
|
+
this.value.set([]);
|
|
835
|
+
}
|
|
836
|
+
_onWindowScroll() {
|
|
837
|
+
if (this._isOpen() && this._appendToParent()) {
|
|
838
|
+
this._close();
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
_onDocClick(event) {
|
|
842
|
+
if (!this._isOpen())
|
|
843
|
+
return;
|
|
844
|
+
const target = event.target;
|
|
845
|
+
if (this._elementRef.nativeElement.contains(target))
|
|
846
|
+
return;
|
|
847
|
+
if (this._panelEl?.contains(target))
|
|
848
|
+
return;
|
|
849
|
+
this._close();
|
|
850
|
+
}
|
|
851
|
+
ngOnDestroy() {
|
|
852
|
+
this._docClickCleanup?.();
|
|
853
|
+
if (this._closeTimer)
|
|
854
|
+
clearTimeout(this._closeTimer);
|
|
855
|
+
if (this._panelEl && document.body.contains(this._panelEl)) {
|
|
856
|
+
document.body.removeChild(this._panelEl);
|
|
857
|
+
this._panelEl = null;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: MultiSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
861
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: MultiSelectComponent, isStandalone: true, selector: "app-multi-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, selectAll: { classPropertyName: "selectAll", publicName: "selectAll", isSignal: true, isRequired: false, transformFunction: null }, selectAllLabel: { classPropertyName: "selectAllLabel", publicName: "selectAllLabel", isSignal: true, isRequired: false, transformFunction: null }, accentColor: { classPropertyName: "accentColor", publicName: "accentColor", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "window:scroll": "_onWindowScroll()" }, properties: { "attr.data-size": "_size", "attr.data-accent": "_accentKey", "class.has-error": "error()", "style.--drop-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<div class=\"relative ms-wrapper\">\n <label class=\"flex items-center w-full cursor-text\" (click)=\"_onTriggerClick($event)\">\n @let chips = _selectedLabels();\n\n <div class=\"!flex flex-wrap items-center gap-1 min-h-0 h-auto cursor-pointer py-1.5 w-full outline-none transition-[border-color,box-shadow] duration-200 ease bg-[var(--drop-bg)] border border-[var(--drop-border)] rounded-[var(--drop-radius)] text-[var(--drop-text)] font-[var(--font-sans)] disabled:opacity-50 disabled:cursor-not-allowed\"\n [class]=\"_inputSizeCls()\"\n >\n @for (label of chips; track label) {\n <span class=\"ms-chip\">\n {{ label }}\n <button type=\"button\" class=\"ms-chip-remove\"\n (click)=\"_removeChip(value()[$index], $event)\"\n tabindex=\"-1\"\n aria-label=\"Remove {{ label }}\"\n >×</button>\n </span>\n }\n\n <input\n type=\"text\"\n class=\"flex-1 min-w-[50px] outline-none border-none bg-transparent text-[var(--drop-text)] placeholder:text-[var(--drop-muted)]\"\n [class.text-xs]=\"size() === 'sm'\"\n [class.text-sm]=\"size() !== 'sm'\"\n [style.height]=\"size() === 'sm' ? '1.25rem' : '1.5rem'\"\n [attr.placeholder]=\"chips.length ? '' : placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n [value]=\"chips.length ? '' : ''\"\n (input)=\"_onInput($event)\"\n (click)=\"$event.stopPropagation()\"\n />\n </div>\n\n <i [class]=\"_iconCls() + ' pi pi-chevron-down'\"></i>\n </label>\n\n @if (_isOpen() || _isClosing()) {\n <div\n data-ms-panel\n class=\"left-0 z-50 w-full min-w-60 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--radius-md)] shadow-lg overflow-hidden text-[var(--color-text)]\"\n [class.absolute]=\"!_appendToParent()\"\n [style.position]=\"_panelFixed()\"\n [style.left.px]=\"_appendToParent() ? _panelX() : null\"\n [style.top.px]=\"_appendToParent() ? _panelY() : null\"\n [style.width.px]=\"_appendToParent() ? _panelWidth() : null\"\n [class.top-full]=\"!_appendToParent() && _panelDirection() === 'down'\"\n [class.bottom-full]=\"!_appendToParent() && _panelDirection() === 'up'\"\n [class.ms-fade-in]=\"_isOpen() && !_isClosing()\"\n [class.ms-fade-out]=\"_isClosing()\"\n (click)=\"_onPanelClick($event)\">\n\n @if (searchable()) {\n <div class=\"px-2 pt-2\">\n <input\n data-ms-search\n type=\"text\"\n class=\"w-full px-2 py-1.5 text-sm border border-[var(--color-border)] rounded outline-none bg-[var(--color-surface)] text-[var(--color-text)] placeholder:text-[var(--color-text-muted)] focus:border-[var(--color-accent)]\"\n placeholder=\"Search...\"\n [value]=\"_searchQuery()\"\n (input)=\"_searchQuery.set($any($event.target).value)\"\n (click)=\"$event.stopPropagation()\"\n />\n </div>\n }\n\n <div\n class=\"overflow-y-auto\"\n [style.max-height]=\"_maxHeight()\"\n (scroll)=\"$event.stopPropagation()\">\n\n @if (selectAll() && _filteredOptions().length > 0) {\n <button\n type=\"button\"\n [class]=\"_optionCls()\"\n (click)=\"_toggleSelectAll()\"\n >\n <span\n class=\"inline-flex items-center justify-center w-4 h-4 rounded border text-[10px] shrink-0 transition-colors\"\n [style.border-color]=\"'var(--drop-border)'\"\n [style.background-color]=\"_allFilteredSelected() ? 'var(--drop-accent)' : 'transparent'\"\n [style.color]=\"_allFilteredSelected() ? 'white' : 'transparent'\"\n >\n @if (_allFilteredSelected()) { ✓ }\n </span>\n <span class=\"font-medium\">{{ selectAllLabel() }}</span>\n </button>\n <div class=\"h-px mx-2\" [style.background-color]=\"'var(--drop-border)'\"></div>\n }\n\n @for (option of _filteredOptions(); track option.value) {\n <button\n type=\"button\"\n [class]=\"_optionCls()\"\n [class.selected]=\"_isSelected(_optVal(option))\"\n (click)=\"_toggleOption(option)\"\n >\n <span\n class=\"inline-flex items-center justify-center w-4 h-4 rounded border text-[10px] shrink-0 transition-colors\"\n [style.border-color]=\"_isSelected(_optVal(option)) ? 'var(--color-accent)' : 'var(--drop-border)'\"\n [style.background-color]=\"_isSelected(_optVal(option)) ? 'var(--color-accent)' : 'transparent'\"\n [style.color]=\"_isSelected(_optVal(option)) ? 'white' : 'transparent'\"\n >\n @if (_isSelected(_optVal(option))) { ✓ }\n </span>\n <span>{{ option.label }}</span>\n </button>\n }\n\n @if (_filteredOptions().length === 0) {\n <div class=\"px-3 py-4 text-center text-sm text-[var(--drop-muted)]\">No results found</div>\n }\n </div>\n </div>\n }\n</div>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--drop-accent: var(--color-accent, oklch(.64 .2 50));--drop-bg: var(--color-surface, oklch(.99 0 0));--drop-border: var(--color-border, oklch(.83 .015 260));--drop-text: var(--color-text, oklch(.14 .01 260));--drop-muted: var(--color-text-muted, oklch(.48 .01 260));--drop-surface: var(--color-surface-alt, oklch(.975 .005 260));--drop-radius: var(--radius-md, .5rem);position:relative;display:inline-block;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--drop-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--drop-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--drop-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--drop-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--drop-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--drop-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--drop-accent: var(--color-info, oklch(.55 .15 235))}:host.has-error input{border-color:var(--color-danger, oklch(.55 .25 25))!important}:host.has-error input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger, oklch(.55 .25 25)) 20%,transparent)!important}.ms-fade-in{animation:msIn .2s ease}.ms-fade-out{animation:msOut .15s ease forwards}@keyframes msIn{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes msOut{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}.ms-chip{display:inline-flex;align-items:center;gap:2px;padding:1px 6px 1px 8px;font-size:.75rem;border-radius:9999px;white-space:nowrap;background:color-mix(in srgb,var(--drop-accent) 15%,transparent);color:var(--drop-accent);line-height:1.5}.ms-chip-remove{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;padding:0;border:none;border-radius:50%;background:transparent;cursor:pointer;color:inherit;font-size:10px;transition:background .15s}.ms-chip-remove:hover{background:color-mix(in srgb,var(--drop-accent) 20%,transparent)}.ms-option.selected{background-color:var(--color-accent)!important;color:var(--color-primary-inverse, oklch(.99 0 0))!important}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
862
|
+
}
|
|
863
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: MultiSelectComponent, decorators: [{
|
|
864
|
+
type: Component,
|
|
865
|
+
args: [{ selector: 'app-multi-select', imports: [], host: {
|
|
866
|
+
'[attr.data-size]': '_size',
|
|
867
|
+
'[attr.data-accent]': '_accentKey',
|
|
868
|
+
'[class.has-error]': 'error()',
|
|
869
|
+
'[style.--drop-accent]': '_rawAccent',
|
|
870
|
+
'[style.width]': '_width',
|
|
871
|
+
'(window:scroll)': '_onWindowScroll()',
|
|
872
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"relative ms-wrapper\">\n <label class=\"flex items-center w-full cursor-text\" (click)=\"_onTriggerClick($event)\">\n @let chips = _selectedLabels();\n\n <div class=\"!flex flex-wrap items-center gap-1 min-h-0 h-auto cursor-pointer py-1.5 w-full outline-none transition-[border-color,box-shadow] duration-200 ease bg-[var(--drop-bg)] border border-[var(--drop-border)] rounded-[var(--drop-radius)] text-[var(--drop-text)] font-[var(--font-sans)] disabled:opacity-50 disabled:cursor-not-allowed\"\n [class]=\"_inputSizeCls()\"\n >\n @for (label of chips; track label) {\n <span class=\"ms-chip\">\n {{ label }}\n <button type=\"button\" class=\"ms-chip-remove\"\n (click)=\"_removeChip(value()[$index], $event)\"\n tabindex=\"-1\"\n aria-label=\"Remove {{ label }}\"\n >×</button>\n </span>\n }\n\n <input\n type=\"text\"\n class=\"flex-1 min-w-[50px] outline-none border-none bg-transparent text-[var(--drop-text)] placeholder:text-[var(--drop-muted)]\"\n [class.text-xs]=\"size() === 'sm'\"\n [class.text-sm]=\"size() !== 'sm'\"\n [style.height]=\"size() === 'sm' ? '1.25rem' : '1.5rem'\"\n [attr.placeholder]=\"chips.length ? '' : placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n [value]=\"chips.length ? '' : ''\"\n (input)=\"_onInput($event)\"\n (click)=\"$event.stopPropagation()\"\n />\n </div>\n\n <i [class]=\"_iconCls() + ' pi pi-chevron-down'\"></i>\n </label>\n\n @if (_isOpen() || _isClosing()) {\n <div\n data-ms-panel\n class=\"left-0 z-50 w-full min-w-60 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--radius-md)] shadow-lg overflow-hidden text-[var(--color-text)]\"\n [class.absolute]=\"!_appendToParent()\"\n [style.position]=\"_panelFixed()\"\n [style.left.px]=\"_appendToParent() ? _panelX() : null\"\n [style.top.px]=\"_appendToParent() ? _panelY() : null\"\n [style.width.px]=\"_appendToParent() ? _panelWidth() : null\"\n [class.top-full]=\"!_appendToParent() && _panelDirection() === 'down'\"\n [class.bottom-full]=\"!_appendToParent() && _panelDirection() === 'up'\"\n [class.ms-fade-in]=\"_isOpen() && !_isClosing()\"\n [class.ms-fade-out]=\"_isClosing()\"\n (click)=\"_onPanelClick($event)\">\n\n @if (searchable()) {\n <div class=\"px-2 pt-2\">\n <input\n data-ms-search\n type=\"text\"\n class=\"w-full px-2 py-1.5 text-sm border border-[var(--color-border)] rounded outline-none bg-[var(--color-surface)] text-[var(--color-text)] placeholder:text-[var(--color-text-muted)] focus:border-[var(--color-accent)]\"\n placeholder=\"Search...\"\n [value]=\"_searchQuery()\"\n (input)=\"_searchQuery.set($any($event.target).value)\"\n (click)=\"$event.stopPropagation()\"\n />\n </div>\n }\n\n <div\n class=\"overflow-y-auto\"\n [style.max-height]=\"_maxHeight()\"\n (scroll)=\"$event.stopPropagation()\">\n\n @if (selectAll() && _filteredOptions().length > 0) {\n <button\n type=\"button\"\n [class]=\"_optionCls()\"\n (click)=\"_toggleSelectAll()\"\n >\n <span\n class=\"inline-flex items-center justify-center w-4 h-4 rounded border text-[10px] shrink-0 transition-colors\"\n [style.border-color]=\"'var(--drop-border)'\"\n [style.background-color]=\"_allFilteredSelected() ? 'var(--drop-accent)' : 'transparent'\"\n [style.color]=\"_allFilteredSelected() ? 'white' : 'transparent'\"\n >\n @if (_allFilteredSelected()) { ✓ }\n </span>\n <span class=\"font-medium\">{{ selectAllLabel() }}</span>\n </button>\n <div class=\"h-px mx-2\" [style.background-color]=\"'var(--drop-border)'\"></div>\n }\n\n @for (option of _filteredOptions(); track option.value) {\n <button\n type=\"button\"\n [class]=\"_optionCls()\"\n [class.selected]=\"_isSelected(_optVal(option))\"\n (click)=\"_toggleOption(option)\"\n >\n <span\n class=\"inline-flex items-center justify-center w-4 h-4 rounded border text-[10px] shrink-0 transition-colors\"\n [style.border-color]=\"_isSelected(_optVal(option)) ? 'var(--color-accent)' : 'var(--drop-border)'\"\n [style.background-color]=\"_isSelected(_optVal(option)) ? 'var(--color-accent)' : 'transparent'\"\n [style.color]=\"_isSelected(_optVal(option)) ? 'white' : 'transparent'\"\n >\n @if (_isSelected(_optVal(option))) { ✓ }\n </span>\n <span>{{ option.label }}</span>\n </button>\n }\n\n @if (_filteredOptions().length === 0) {\n <div class=\"px-3 py-4 text-center text-sm text-[var(--drop-muted)]\">No results found</div>\n }\n </div>\n </div>\n }\n</div>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--drop-accent: var(--color-accent, oklch(.64 .2 50));--drop-bg: var(--color-surface, oklch(.99 0 0));--drop-border: var(--color-border, oklch(.83 .015 260));--drop-text: var(--color-text, oklch(.14 .01 260));--drop-muted: var(--color-text-muted, oklch(.48 .01 260));--drop-surface: var(--color-surface-alt, oklch(.975 .005 260));--drop-radius: var(--radius-md, .5rem);position:relative;display:inline-block;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--drop-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--drop-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--drop-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--drop-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--drop-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--drop-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--drop-accent: var(--color-info, oklch(.55 .15 235))}:host.has-error input{border-color:var(--color-danger, oklch(.55 .25 25))!important}:host.has-error input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger, oklch(.55 .25 25)) 20%,transparent)!important}.ms-fade-in{animation:msIn .2s ease}.ms-fade-out{animation:msOut .15s ease forwards}@keyframes msIn{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes msOut{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}.ms-chip{display:inline-flex;align-items:center;gap:2px;padding:1px 6px 1px 8px;font-size:.75rem;border-radius:9999px;white-space:nowrap;background:color-mix(in srgb,var(--drop-accent) 15%,transparent);color:var(--drop-accent);line-height:1.5}.ms-chip-remove{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;padding:0;border:none;border-radius:50%;background:transparent;cursor:pointer;color:inherit;font-size:10px;transition:background .15s}.ms-chip-remove:hover{background:color-mix(in srgb,var(--drop-accent) 20%,transparent)}.ms-option.selected{background-color:var(--color-accent)!important;color:var(--color-primary-inverse, oklch(.99 0 0))!important}\n"] }]
|
|
873
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], selectAll: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectAll", required: false }] }], selectAllLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectAllLabel", required: false }] }], accentColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accentColor", required: false }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }] } });
|
|
874
|
+
|
|
875
|
+
class PasswordInputComponent {
|
|
876
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
877
|
+
placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
878
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
879
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
880
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
881
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
882
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
883
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
884
|
+
hideToggle = input(false, ...(ngDevMode ? [{ debugName: "hideToggle" }] : []));
|
|
885
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
886
|
+
visible = signal(false, ...(ngDevMode ? [{ debugName: "visible" }] : []));
|
|
887
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
888
|
+
_type = computed(() => (this.visible() ? 'text' : 'password'), ...(ngDevMode ? [{ debugName: "_type" }] : []));
|
|
889
|
+
_accentKey = computed(() => {
|
|
890
|
+
const c = this.accentColor();
|
|
891
|
+
return c && isThemeColor(c) ? c : null;
|
|
892
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
893
|
+
_rawAccent = computed(() => {
|
|
894
|
+
const c = this.accentColor();
|
|
895
|
+
return c && !isThemeColor(c) ? c : null;
|
|
896
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
897
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
898
|
+
_touched = signal(false, ...(ngDevMode ? [{ debugName: "_touched" }] : []));
|
|
899
|
+
_inputSizeCls = computed(() => {
|
|
900
|
+
return this.size() === 'sm' ? 'py-1 pr-8 pl-2 text-xs' : this.size() === 'lg' ? 'py-3 pr-11 pl-4 text-base' : 'py-2 pr-10 pl-3 text-sm';
|
|
901
|
+
}, ...(ngDevMode ? [{ debugName: "_inputSizeCls" }] : []));
|
|
902
|
+
_toggleCls = computed(() => {
|
|
903
|
+
const base = 'absolute flex items-center justify-center p-0 border-none rounded-full bg-transparent cursor-pointer text-[var(--password-muted)] transition-[color,background] duration-150 hover:text-[var(--password-text)] hover:bg-[var(--color-surface-alt)]';
|
|
904
|
+
const s = this.size();
|
|
905
|
+
const pos = s === 'sm' ? 'right-1 w-5 h-5' : s === 'lg' ? 'right-2 w-6 h-6' : 'right-1.5 w-6 h-6';
|
|
906
|
+
const icon = s === 'sm' ? 'text-xs' : s === 'lg' ? 'text-lg' : 'text-sm';
|
|
907
|
+
return `${base} ${pos} ${icon}`;
|
|
908
|
+
}, ...(ngDevMode ? [{ debugName: "_toggleCls" }] : []));
|
|
909
|
+
toggleVisibility() {
|
|
910
|
+
this.visible.update((v) => !v);
|
|
911
|
+
}
|
|
912
|
+
onInput(event) {
|
|
913
|
+
this.value.set(event.target.value);
|
|
914
|
+
}
|
|
915
|
+
onBlur() {
|
|
916
|
+
this._touched.set(true);
|
|
917
|
+
}
|
|
918
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: PasswordInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
919
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: PasswordInputComponent, isStandalone: true, selector: "app-password-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, accentColor: { classPropertyName: "accentColor", publicName: "accentColor", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hideToggle: { classPropertyName: "hideToggle", publicName: "hideToggle", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "attr.data-size": "_size", "attr.data-accent": "_accentKey", "class.has-error": "error()", "style.--password-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<label class=\"relative flex items-center w-full\">\n <input\n class=\"w-full outline-none transition-[border-color,box-shadow] duration-200 ease bg-[var(--password-bg)] border border-[var(--password-border)] rounded-[var(--password-radius)] text-[var(--password-text)] font-[var(--font-sans)] placeholder:text-[var(--password-muted)] disabled:opacity-50 disabled:cursor-not-allowed focus:border-[var(--password-accent)] focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--password-accent)_20%,transparent)]\"\n [class]=\"_inputSizeCls()\"\n [attr.type]=\"_type()\"\n [attr.placeholder]=\"placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n\n @if (!hideToggle()) {\n <button\n [class]=\"_toggleCls()\"\n type=\"button\"\n (click)=\"toggleVisibility()\"\n [attr.aria-label]=\"visible() ? 'Hide password' : 'Show password'\"\n >\n <i [class]=\"visible() ? 'pi pi-eye-slash' : 'pi pi-eye'\"></i>\n </button>\n }\n</label>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--password-accent: var(--color-primary);--password-bg: var(--color-surface);--password-border: var(--color-border);--password-text: var(--color-text);--password-muted: var(--color-text-muted);--password-radius: var(--radius-md);position:relative;display:inline-block;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--password-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--password-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--password-accent: var(--color-accent)}:host([data-accent=\"success\"]){--password-accent: var(--color-success)}:host([data-accent=\"warning\"]){--password-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--password-accent: var(--color-danger)}:host([data-accent=\"info\"]){--password-accent: var(--color-info)}:host.has-error input{border-color:var(--color-danger)!important}:host.has-error input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
920
|
+
}
|
|
921
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: PasswordInputComponent, decorators: [{
|
|
922
|
+
type: Component,
|
|
923
|
+
args: [{ selector: 'app-password-input', imports: [], host: {
|
|
924
|
+
'[attr.data-size]': '_size',
|
|
925
|
+
'[attr.data-accent]': '_accentKey',
|
|
926
|
+
'[class.has-error]': 'error()',
|
|
927
|
+
'[style.--password-accent]': '_rawAccent',
|
|
928
|
+
'[style.width]': '_width',
|
|
929
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<label class=\"relative flex items-center w-full\">\n <input\n class=\"w-full outline-none transition-[border-color,box-shadow] duration-200 ease bg-[var(--password-bg)] border border-[var(--password-border)] rounded-[var(--password-radius)] text-[var(--password-text)] font-[var(--font-sans)] placeholder:text-[var(--password-muted)] disabled:opacity-50 disabled:cursor-not-allowed focus:border-[var(--password-accent)] focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--password-accent)_20%,transparent)]\"\n [class]=\"_inputSizeCls()\"\n [attr.type]=\"_type()\"\n [attr.placeholder]=\"placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n\n @if (!hideToggle()) {\n <button\n [class]=\"_toggleCls()\"\n type=\"button\"\n (click)=\"toggleVisibility()\"\n [attr.aria-label]=\"visible() ? 'Hide password' : 'Show password'\"\n >\n <i [class]=\"visible() ? 'pi pi-eye-slash' : 'pi pi-eye'\"></i>\n </button>\n }\n</label>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--password-accent: var(--color-primary);--password-bg: var(--color-surface);--password-border: var(--color-border);--password-text: var(--color-text);--password-muted: var(--color-text-muted);--password-radius: var(--radius-md);position:relative;display:inline-block;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--password-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--password-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--password-accent: var(--color-accent)}:host([data-accent=\"success\"]){--password-accent: var(--color-success)}:host([data-accent=\"warning\"]){--password-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--password-accent: var(--color-danger)}:host([data-accent=\"info\"]){--password-accent: var(--color-info)}:host.has-error input{border-color:var(--color-danger)!important}:host.has-error input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
930
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], accentColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accentColor", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], hideToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideToggle", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
|
|
931
|
+
|
|
932
|
+
class SearchInputComponent {
|
|
933
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
934
|
+
placeholder = input('Search...', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
935
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
936
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
937
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
938
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
939
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
940
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
941
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
942
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
943
|
+
_accentKey = computed(() => {
|
|
944
|
+
const c = this.accentColor();
|
|
945
|
+
return c && isThemeColor(c) ? c : null;
|
|
946
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
947
|
+
_rawAccent = computed(() => {
|
|
948
|
+
const c = this.accentColor();
|
|
949
|
+
return c && !isThemeColor(c) ? c : null;
|
|
950
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
951
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
952
|
+
_touched = signal(false, ...(ngDevMode ? [{ debugName: "_touched" }] : []));
|
|
953
|
+
_iconCls = computed(() => {
|
|
954
|
+
const l = this.size() === 'sm' ? 'left-2' : this.size() === 'lg' ? 'left-3.5' : 'left-3';
|
|
955
|
+
const f = this.size() === 'sm' ? 'text-xs' : this.size() === 'lg' ? 'text-lg' : 'text-sm';
|
|
956
|
+
return `absolute ${l} flex pointer-events-none transition-colors duration-200 text-[var(--search-muted)] ${f}`;
|
|
957
|
+
}, ...(ngDevMode ? [{ debugName: "_iconCls" }] : []));
|
|
958
|
+
_inputSizeCls = computed(() => {
|
|
959
|
+
const s = this.size();
|
|
960
|
+
return s === 'sm' ? 'py-1 px-8 text-xs' : s === 'lg' ? 'py-3 px-11 text-base' : 'py-2 pl-10 pr-10 text-sm';
|
|
961
|
+
}, ...(ngDevMode ? [{ debugName: "_inputSizeCls" }] : []));
|
|
962
|
+
onInput(event) {
|
|
963
|
+
this.value.set(event.target.value);
|
|
964
|
+
}
|
|
965
|
+
onBlur() {
|
|
966
|
+
this._touched.set(true);
|
|
967
|
+
}
|
|
968
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SearchInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
969
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: SearchInputComponent, isStandalone: true, selector: "app-search-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, accentColor: { classPropertyName: "accentColor", publicName: "accentColor", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "attr.data-size": "_size", "attr.data-accent": "_accentKey", "class.has-error": "error()", "style.--search-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<label class=\"relative flex items-center w-full\">\n <span [class]=\"_iconCls()\" aria-hidden=\"true\">\n <i class=\"pi pi-search\"></i>\n </span>\n\n <input\n class=\"w-full outline-none transition-[border-color,box-shadow] duration-200 ease bg-[var(--search-bg)] border border-[var(--search-border)] rounded-[var(--search-radius)] text-[var(--search-text)] font-[var(--font-sans)] placeholder:text-[var(--search-muted)] disabled:opacity-50 disabled:cursor-not-allowed focus:border-[var(--search-accent)] focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--search-accent)_20%,transparent)]\"\n [class]=\"_inputSizeCls()\"\n type=\"search\"\n [attr.placeholder]=\"placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n\n @if (value() && !disabled()) {\n <button class=\"absolute right-2 flex items-center justify-center w-6 h-6 p-0 border-none rounded-full bg-transparent cursor-pointer text-[var(--search-muted)] transition-[color,background] duration-150 hover:text-[var(--search-text)] hover:bg-[var(--color-surface-alt)]\" type=\"button\" (click)=\"value.set('')\" aria-label=\"Clear search\">\n <i class=\"pi pi-times\"></i>\n </button>\n }\n</label>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--search-accent: var(--color-primary);--search-bg: var(--color-surface);--search-border: var(--color-border);--search-text: var(--color-text);--search-muted: var(--color-text-muted);--search-radius: var(--radius-md);position:relative;display:inline-block;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--search-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--search-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--search-accent: var(--color-accent)}:host([data-accent=\"success\"]){--search-accent: var(--color-success)}:host([data-accent=\"warning\"]){--search-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--search-accent: var(--color-danger)}:host([data-accent=\"info\"]){--search-accent: var(--color-info)}.search-input::-webkit-search-decoration,.search-input::-webkit-search-cancel-button,.search-input::-webkit-search-results-button,.search-input::-webkit-search-results-decoration{display:none}:host.has-error input{border-color:var(--color-danger)!important}:host.has-error input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
970
|
+
}
|
|
971
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SearchInputComponent, decorators: [{
|
|
972
|
+
type: Component,
|
|
973
|
+
args: [{ selector: 'app-search-input', imports: [], host: {
|
|
974
|
+
'[attr.data-size]': '_size',
|
|
975
|
+
'[attr.data-accent]': '_accentKey',
|
|
976
|
+
'[class.has-error]': 'error()',
|
|
977
|
+
'[style.--search-accent]': '_rawAccent',
|
|
978
|
+
'[style.width]': '_width',
|
|
979
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<label class=\"relative flex items-center w-full\">\n <span [class]=\"_iconCls()\" aria-hidden=\"true\">\n <i class=\"pi pi-search\"></i>\n </span>\n\n <input\n class=\"w-full outline-none transition-[border-color,box-shadow] duration-200 ease bg-[var(--search-bg)] border border-[var(--search-border)] rounded-[var(--search-radius)] text-[var(--search-text)] font-[var(--font-sans)] placeholder:text-[var(--search-muted)] disabled:opacity-50 disabled:cursor-not-allowed focus:border-[var(--search-accent)] focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--search-accent)_20%,transparent)]\"\n [class]=\"_inputSizeCls()\"\n type=\"search\"\n [attr.placeholder]=\"placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n\n @if (value() && !disabled()) {\n <button class=\"absolute right-2 flex items-center justify-center w-6 h-6 p-0 border-none rounded-full bg-transparent cursor-pointer text-[var(--search-muted)] transition-[color,background] duration-150 hover:text-[var(--search-text)] hover:bg-[var(--color-surface-alt)]\" type=\"button\" (click)=\"value.set('')\" aria-label=\"Clear search\">\n <i class=\"pi pi-times\"></i>\n </button>\n }\n</label>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--search-accent: var(--color-primary);--search-bg: var(--color-surface);--search-border: var(--color-border);--search-text: var(--color-text);--search-muted: var(--color-text-muted);--search-radius: var(--radius-md);position:relative;display:inline-block;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--search-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--search-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--search-accent: var(--color-accent)}:host([data-accent=\"success\"]){--search-accent: var(--color-success)}:host([data-accent=\"warning\"]){--search-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--search-accent: var(--color-danger)}:host([data-accent=\"info\"]){--search-accent: var(--color-info)}.search-input::-webkit-search-decoration,.search-input::-webkit-search-cancel-button,.search-input::-webkit-search-results-button,.search-input::-webkit-search-results-decoration{display:none}:host.has-error input{border-color:var(--color-danger)!important}:host.has-error input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
980
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], accentColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accentColor", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
|
|
981
|
+
|
|
982
|
+
class TextInputComponent {
|
|
983
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
984
|
+
placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
985
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
986
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
987
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
988
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
989
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
990
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
991
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
992
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
993
|
+
_accentKey = computed(() => {
|
|
994
|
+
const c = this.accentColor();
|
|
995
|
+
return c && isThemeColor(c) ? c : null;
|
|
996
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
997
|
+
_rawAccent = computed(() => {
|
|
998
|
+
const c = this.accentColor();
|
|
999
|
+
return c && !isThemeColor(c) ? c : null;
|
|
1000
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
1001
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
1002
|
+
_touched = signal(false, ...(ngDevMode ? [{ debugName: "_touched" }] : []));
|
|
1003
|
+
_inputSizeCls = computed(() => {
|
|
1004
|
+
return this.size() === 'sm' ? 'py-1 px-2 text-xs' : this.size() === 'lg' ? 'py-3 px-4 text-base' : 'py-2 px-3 text-sm';
|
|
1005
|
+
}, ...(ngDevMode ? [{ debugName: "_inputSizeCls" }] : []));
|
|
1006
|
+
onInput(event) {
|
|
1007
|
+
this.value.set(event.target.value);
|
|
1008
|
+
}
|
|
1009
|
+
onBlur() {
|
|
1010
|
+
this._touched.set(true);
|
|
1011
|
+
}
|
|
1012
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TextInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1013
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: TextInputComponent, isStandalone: true, selector: "app-text-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, accentColor: { classPropertyName: "accentColor", publicName: "accentColor", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "attr.data-size": "_size", "attr.data-accent": "_accentKey", "class.has-error": "error()", "style.--text-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<input\n class=\"w-full outline-none transition-[border-color,box-shadow] duration-200 ease bg-[var(--text-bg)] border border-[var(--text-border)] rounded-[var(--text-radius)] text-[var(--text-text)] font-[var(--font-sans)] placeholder:text-[var(--text-muted)] disabled:opacity-50 disabled:cursor-not-allowed focus:border-[var(--text-accent)] focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--text-accent)_20%,transparent)]\"\n [class]=\"_inputSizeCls()\"\n type=\"text\"\n [attr.placeholder]=\"placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n/>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--text-accent: var(--color-primary);--text-bg: var(--color-surface);--text-border: var(--color-border);--text-text: var(--color-text);--text-muted: var(--color-text-muted);--text-radius: var(--radius-md);position:relative;display:inline-block;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--text-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--text-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--text-accent: var(--color-accent)}:host([data-accent=\"success\"]){--text-accent: var(--color-success)}:host([data-accent=\"warning\"]){--text-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--text-accent: var(--color-danger)}:host([data-accent=\"info\"]){--text-accent: var(--color-info)}:host.has-error input{border-color:var(--color-danger)!important}:host.has-error input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1014
|
+
}
|
|
1015
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TextInputComponent, decorators: [{
|
|
1016
|
+
type: Component,
|
|
1017
|
+
args: [{ selector: 'app-text-input', imports: [], host: {
|
|
1018
|
+
'[attr.data-size]': '_size',
|
|
1019
|
+
'[attr.data-accent]': '_accentKey',
|
|
1020
|
+
'[class.has-error]': 'error()',
|
|
1021
|
+
'[style.--text-accent]': '_rawAccent',
|
|
1022
|
+
'[style.width]': '_width',
|
|
1023
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<input\n class=\"w-full outline-none transition-[border-color,box-shadow] duration-200 ease bg-[var(--text-bg)] border border-[var(--text-border)] rounded-[var(--text-radius)] text-[var(--text-text)] font-[var(--font-sans)] placeholder:text-[var(--text-muted)] disabled:opacity-50 disabled:cursor-not-allowed focus:border-[var(--text-accent)] focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--text-accent)_20%,transparent)]\"\n [class]=\"_inputSizeCls()\"\n type=\"text\"\n [attr.placeholder]=\"placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n/>\n\n@if (hint() && !error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-text-muted)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)] whitespace-nowrap overflow-hidden text-ellipsis\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--text-accent: var(--color-primary);--text-bg: var(--color-surface);--text-border: var(--color-border);--text-text: var(--color-text);--text-muted: var(--color-text-muted);--text-radius: var(--radius-md);position:relative;display:inline-block;padding-bottom:1.375rem}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-accent=\"primary\"]){--text-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--text-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--text-accent: var(--color-accent)}:host([data-accent=\"success\"]){--text-accent: var(--color-success)}:host([data-accent=\"warning\"]){--text-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--text-accent: var(--color-danger)}:host([data-accent=\"info\"]){--text-accent: var(--color-info)}:host.has-error input{border-color:var(--color-danger)!important}:host.has-error input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
1024
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], accentColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accentColor", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
|
|
1025
|
+
|
|
1026
|
+
class ToggleComponent {
|
|
1027
|
+
checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : []));
|
|
1028
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
1029
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1030
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
1031
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
1032
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
1033
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
1034
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
1035
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
1036
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
1037
|
+
_accentKey = computed(() => {
|
|
1038
|
+
const c = this.accentColor();
|
|
1039
|
+
return c && isThemeColor(c) ? c : null;
|
|
1040
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
1041
|
+
_rawAccent = computed(() => {
|
|
1042
|
+
const c = this.accentColor();
|
|
1043
|
+
return c && !isThemeColor(c) ? c : null;
|
|
1044
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
1045
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
1046
|
+
toggle() {
|
|
1047
|
+
if (this.disabled())
|
|
1048
|
+
return;
|
|
1049
|
+
this.checked.update(v => !v);
|
|
1050
|
+
}
|
|
1051
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1052
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: ToggleComponent, isStandalone: true, selector: "app-toggle", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, accentColor: { classPropertyName: "accentColor", publicName: "accentColor", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: { properties: { "attr.data-size": "_size", "attr.data-accent": "_accentKey", "class.has-error": "error()", "class.is-checked": "checked()", "style.--toggle-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<label class=\"toggle-field\">\n @if (label()) {\n <span class=\"toggle-label\">{{ label() }}</span>\n }\n\n <button\n class=\"toggle-track\"\n type=\"button\"\n role=\"switch\"\n [attr.aria-checked]=\"checked()\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n >\n <span class=\"toggle-knob\"></span>\n </button>\n</label>\n\n@if (hint() && !error()) {\n <span class=\"field-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"field-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--toggle-accent: var(--color-primary);--toggle-bg: var(--color-text-muted);--toggle-knob: var(--color-surface);--toggle-knob-border: var(--color-border-light);--toggle-muted: var(--color-text-muted);--toggle-text: var(--color-text);--toggle-radius: var(--radius-full);position:relative;display:inline-flex;flex-direction:column;padding-bottom:1.375rem}.toggle-field{display:inline-flex;align-items:center;gap:.625rem;cursor:default}.toggle-label{font-family:var(--font-sans);font-size:.875rem;color:var(--toggle-text);-webkit-user-select:none;user-select:none}.toggle-track{position:relative;display:inline-flex;align-items:center;padding:3px;border:none;border-radius:var(--toggle-radius);background:var(--toggle-bg);cursor:pointer;transition:background .2s ease}.toggle-track:focus-visible{outline:2px solid var(--toggle-accent);outline-offset:2px}.toggle-track:disabled{opacity:.5;cursor:not-allowed}.toggle-knob{position:absolute;top:3px;left:3px;background:var(--toggle-knob);border:1px solid var(--toggle-knob-border);border-radius:50%;transition:left .25s ease;box-shadow:0 1px 3px color-mix(in srgb,var(--color-text) 15%,transparent)}:host(.is-checked) .toggle-track{background:var(--toggle-accent)}:host(.is-checked) .toggle-knob{left:calc(100% - var(--toggle-knob-size) - 3px)}.field-hint,.field-error{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.field-hint{color:var(--color-text-muted)}.field-error{color:var(--color-danger)}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-size=\"sm\"]){--toggle-knob-size: .875rem}:host([data-size=\"sm\"]) .toggle-track{width:2.125rem;height:1.25rem}:host([data-size=\"sm\"]) .toggle-knob{width:.875rem;height:.875rem}:host([data-size=\"sm\"]) .toggle-label{font-size:.75rem}:host([data-size=\"md\"]){--toggle-knob-size: 1.125rem}:host([data-size=\"md\"]) .toggle-track{width:2.75rem;height:1.5rem}:host([data-size=\"md\"]) .toggle-knob{width:1.125rem;height:1.125rem}:host([data-size=\"md\"]) .toggle-label{font-size:.875rem}:host([data-size=\"lg\"]){--toggle-knob-size: 1.375rem}:host([data-size=\"lg\"]) .toggle-track{width:3.25rem;height:1.75rem}:host([data-size=\"lg\"]) .toggle-knob{width:1.375rem;height:1.375rem}:host([data-size=\"lg\"]) .toggle-label{font-size:1rem}:host([data-accent=\"primary\"]){--toggle-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--toggle-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--toggle-accent: var(--color-accent)}:host([data-accent=\"success\"]){--toggle-accent: var(--color-success)}:host([data-accent=\"warning\"]){--toggle-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--toggle-accent: var(--color-danger)}:host([data-accent=\"info\"]){--toggle-accent: var(--color-info)}:host(.has-error) .toggle-track{outline:2px solid var(--color-danger)}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1053
|
+
}
|
|
1054
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToggleComponent, decorators: [{
|
|
1055
|
+
type: Component,
|
|
1056
|
+
args: [{ selector: 'app-toggle', imports: [], host: {
|
|
1057
|
+
'[attr.data-size]': '_size',
|
|
1058
|
+
'[attr.data-accent]': '_accentKey',
|
|
1059
|
+
'[class.has-error]': 'error()',
|
|
1060
|
+
'[class.is-checked]': 'checked()',
|
|
1061
|
+
'[style.--toggle-accent]': '_rawAccent',
|
|
1062
|
+
'[style.width]': '_width',
|
|
1063
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<label class=\"toggle-field\">\n @if (label()) {\n <span class=\"toggle-label\">{{ label() }}</span>\n }\n\n <button\n class=\"toggle-track\"\n type=\"button\"\n role=\"switch\"\n [attr.aria-checked]=\"checked()\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n >\n <span class=\"toggle-knob\"></span>\n </button>\n</label>\n\n@if (hint() && !error()) {\n <span class=\"field-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"field-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--toggle-accent: var(--color-primary);--toggle-bg: var(--color-text-muted);--toggle-knob: var(--color-surface);--toggle-knob-border: var(--color-border-light);--toggle-muted: var(--color-text-muted);--toggle-text: var(--color-text);--toggle-radius: var(--radius-full);position:relative;display:inline-flex;flex-direction:column;padding-bottom:1.375rem}.toggle-field{display:inline-flex;align-items:center;gap:.625rem;cursor:default}.toggle-label{font-family:var(--font-sans);font-size:.875rem;color:var(--toggle-text);-webkit-user-select:none;user-select:none}.toggle-track{position:relative;display:inline-flex;align-items:center;padding:3px;border:none;border-radius:var(--toggle-radius);background:var(--toggle-bg);cursor:pointer;transition:background .2s ease}.toggle-track:focus-visible{outline:2px solid var(--toggle-accent);outline-offset:2px}.toggle-track:disabled{opacity:.5;cursor:not-allowed}.toggle-knob{position:absolute;top:3px;left:3px;background:var(--toggle-knob);border:1px solid var(--toggle-knob-border);border-radius:50%;transition:left .25s ease;box-shadow:0 1px 3px color-mix(in srgb,var(--color-text) 15%,transparent)}:host(.is-checked) .toggle-track{background:var(--toggle-accent)}:host(.is-checked) .toggle-knob{left:calc(100% - var(--toggle-knob-size) - 3px)}.field-hint,.field-error{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.field-hint{color:var(--color-text-muted)}.field-error{color:var(--color-danger)}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}:host([data-size=\"sm\"]){--toggle-knob-size: .875rem}:host([data-size=\"sm\"]) .toggle-track{width:2.125rem;height:1.25rem}:host([data-size=\"sm\"]) .toggle-knob{width:.875rem;height:.875rem}:host([data-size=\"sm\"]) .toggle-label{font-size:.75rem}:host([data-size=\"md\"]){--toggle-knob-size: 1.125rem}:host([data-size=\"md\"]) .toggle-track{width:2.75rem;height:1.5rem}:host([data-size=\"md\"]) .toggle-knob{width:1.125rem;height:1.125rem}:host([data-size=\"md\"]) .toggle-label{font-size:.875rem}:host([data-size=\"lg\"]){--toggle-knob-size: 1.375rem}:host([data-size=\"lg\"]) .toggle-track{width:3.25rem;height:1.75rem}:host([data-size=\"lg\"]) .toggle-knob{width:1.375rem;height:1.375rem}:host([data-size=\"lg\"]) .toggle-label{font-size:1rem}:host([data-accent=\"primary\"]){--toggle-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--toggle-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--toggle-accent: var(--color-accent)}:host([data-accent=\"success\"]){--toggle-accent: var(--color-success)}:host([data-accent=\"warning\"]){--toggle-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--toggle-accent: var(--color-danger)}:host([data-accent=\"info\"]){--toggle-accent: var(--color-info)}:host(.has-error) .toggle-track{outline:2px solid var(--color-danger)}.hint-enter{animation:hint-in .2s ease-out}.error-enter{animation:error-in .25s ease-out}.hint-leave{animation:hint-out .15s ease-in forwards}.error-leave{animation:error-out .2s ease-in forwards}@keyframes hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
1064
|
+
}], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], accentColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accentColor", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
|
|
1065
|
+
|
|
1066
|
+
class BadgeComponent {
|
|
1067
|
+
accentColor = input('primary', ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
1068
|
+
variant = input('filled', ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
1069
|
+
size = input('sm', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1070
|
+
dot = input(false, ...(ngDevMode ? [{ debugName: "dot" }] : []));
|
|
1071
|
+
_sizeCls = computed(() => {
|
|
1072
|
+
const sizes = {
|
|
1073
|
+
sm: 'px-1.5 py-0.5 text-[10px]',
|
|
1074
|
+
md: 'px-2 py-0.5 text-xs',
|
|
1075
|
+
lg: 'px-2.5 py-1 text-sm',
|
|
1076
|
+
};
|
|
1077
|
+
return sizes[this.size()] ?? sizes.sm;
|
|
1078
|
+
}, ...(ngDevMode ? [{ debugName: "_sizeCls" }] : []));
|
|
1079
|
+
_fallback = {
|
|
1080
|
+
primary: 'oklch(0.32 0.09 258)',
|
|
1081
|
+
secondary: 'oklch(0.55 0.12 40)',
|
|
1082
|
+
accent: 'oklch(0.64 0.2 50)',
|
|
1083
|
+
success: 'oklch(0.55 0.18 145)',
|
|
1084
|
+
warning: 'oklch(0.68 0.18 75)',
|
|
1085
|
+
danger: 'oklch(0.55 0.22 25)',
|
|
1086
|
+
info: 'oklch(0.55 0.15 235)',
|
|
1087
|
+
};
|
|
1088
|
+
_resolvedColor = computed(() => {
|
|
1089
|
+
const c = this.accentColor();
|
|
1090
|
+
if (isThemeColor(c))
|
|
1091
|
+
return `var(--color-${c}, ${this._fallback[c] ?? this._fallback['primary']})`;
|
|
1092
|
+
return c;
|
|
1093
|
+
}, ...(ngDevMode ? [{ debugName: "_resolvedColor" }] : []));
|
|
1094
|
+
_subtleBg = computed(() => {
|
|
1095
|
+
const c = this.accentColor();
|
|
1096
|
+
const key = isThemeColor(c) ? c : 'primary';
|
|
1097
|
+
return `color-mix(in srgb, var(--color-${key}, ${this._fallback[key]}) 15%, var(--color-surface, oklch(0.99 0 0)))`;
|
|
1098
|
+
}, ...(ngDevMode ? [{ debugName: "_subtleBg" }] : []));
|
|
1099
|
+
_style = computed(() => {
|
|
1100
|
+
const v = this.variant();
|
|
1101
|
+
const color = this._resolvedColor();
|
|
1102
|
+
if (v === 'filled')
|
|
1103
|
+
return { backgroundColor: color, color: 'var(--color-primary-inverse,oklch(0.99 0 0))' };
|
|
1104
|
+
if (v === 'outlined')
|
|
1105
|
+
return { backgroundColor: 'transparent', color, border: `1px solid ${color}` };
|
|
1106
|
+
return { backgroundColor: this._subtleBg(), color };
|
|
1107
|
+
}, ...(ngDevMode ? [{ debugName: "_style" }] : []));
|
|
1108
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: BadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1109
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: BadgeComponent, isStandalone: true, selector: "app-badge", inputs: { accentColor: { classPropertyName: "accentColor", publicName: "accentColor", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, dot: { classPropertyName: "dot", publicName: "dot", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<span class=\"inline-flex items-center gap-1 font-medium rounded-[var(--radius-sm,0.25rem)] whitespace-nowrap\" [style]=\"_style()\" [class]=\"_sizeCls()\">\n @if (dot()) {\n <span class=\"rounded-full shrink-0\" style=\"width:6px;height:6px;background-color:currentColor\"></span>\n }\n <ng-content />\n</span>\n", styles: [":host{display:inline-flex}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1110
|
+
}
|
|
1111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: BadgeComponent, decorators: [{
|
|
1112
|
+
type: Component,
|
|
1113
|
+
args: [{ selector: 'app-badge', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<span class=\"inline-flex items-center gap-1 font-medium rounded-[var(--radius-sm,0.25rem)] whitespace-nowrap\" [style]=\"_style()\" [class]=\"_sizeCls()\">\n @if (dot()) {\n <span class=\"rounded-full shrink-0\" style=\"width:6px;height:6px;background-color:currentColor\"></span>\n }\n <ng-content />\n</span>\n", styles: [":host{display:inline-flex}\n"] }]
|
|
1114
|
+
}], propDecorators: { accentColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accentColor", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], dot: [{ type: i0.Input, args: [{ isSignal: true, alias: "dot", required: false }] }] } });
|
|
1115
|
+
|
|
1116
|
+
class BannerSliderComponent {
|
|
1117
|
+
items = input.required(...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
1118
|
+
height = input('400px', ...(ngDevMode ? [{ debugName: "height" }] : []));
|
|
1119
|
+
autoPlay = input(true, ...(ngDevMode ? [{ debugName: "autoPlay" }] : []));
|
|
1120
|
+
interval = input(5000, ...(ngDevMode ? [{ debugName: "interval" }] : []));
|
|
1121
|
+
showArrows = input(true, ...(ngDevMode ? [{ debugName: "showArrows" }] : []));
|
|
1122
|
+
showDots = input(true, ...(ngDevMode ? [{ debugName: "showDots" }] : []));
|
|
1123
|
+
overlayMode = input('left', ...(ngDevMode ? [{ debugName: "overlayMode" }] : []));
|
|
1124
|
+
ctaClick = output();
|
|
1125
|
+
_height = computed(() => this.height(), ...(ngDevMode ? [{ debugName: "_height" }] : []));
|
|
1126
|
+
_index = signal(0, ...(ngDevMode ? [{ debugName: "_index" }] : []));
|
|
1127
|
+
_overlayCls = computed(() => `overlay-${this.overlayMode()}`, ...(ngDevMode ? [{ debugName: "_overlayCls" }] : []));
|
|
1128
|
+
_timer = null;
|
|
1129
|
+
constructor() {
|
|
1130
|
+
effect(() => {
|
|
1131
|
+
if (this.autoPlay())
|
|
1132
|
+
this._startTimer();
|
|
1133
|
+
else
|
|
1134
|
+
this._stopTimer();
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
_transform = computed(() => `translateX(-${this._index() * 100}%)`, ...(ngDevMode ? [{ debugName: "_transform" }] : []));
|
|
1138
|
+
_current = computed(() => this.items()[this._index()], ...(ngDevMode ? [{ debugName: "_current" }] : []));
|
|
1139
|
+
_go(index) {
|
|
1140
|
+
const len = this.items().length;
|
|
1141
|
+
if (len < 2)
|
|
1142
|
+
return;
|
|
1143
|
+
this._index.set(((index % len) + len) % len);
|
|
1144
|
+
if (this.autoPlay())
|
|
1145
|
+
this._startTimer();
|
|
1146
|
+
}
|
|
1147
|
+
_prev() { this._go(this._index() - 1); }
|
|
1148
|
+
_next() { this._go(this._index() + 1); }
|
|
1149
|
+
_onCtaClick() {
|
|
1150
|
+
this.ctaClick.emit(this._current());
|
|
1151
|
+
}
|
|
1152
|
+
_startTimer() {
|
|
1153
|
+
this._stopTimer();
|
|
1154
|
+
this._timer = setInterval(() => this._next(), this.interval());
|
|
1155
|
+
}
|
|
1156
|
+
_stopTimer() {
|
|
1157
|
+
if (this._timer) {
|
|
1158
|
+
clearInterval(this._timer);
|
|
1159
|
+
this._timer = null;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
_xStart = 0;
|
|
1163
|
+
_onTouchStart(event) {
|
|
1164
|
+
this._xStart = event.touches[0].clientX;
|
|
1165
|
+
}
|
|
1166
|
+
_onTouchEnd(event) {
|
|
1167
|
+
const dx = event.changedTouches[0].clientX - this._xStart;
|
|
1168
|
+
if (Math.abs(dx) > 50)
|
|
1169
|
+
dx > 0 ? this._prev() : this._next();
|
|
1170
|
+
}
|
|
1171
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: BannerSliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1172
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: BannerSliderComponent, isStandalone: true, selector: "app-banner-slider", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, autoPlay: { classPropertyName: "autoPlay", publicName: "autoPlay", isSignal: true, isRequired: false, transformFunction: null }, interval: { classPropertyName: "interval", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, showArrows: { classPropertyName: "showArrows", publicName: "showArrows", isSignal: true, isRequired: false, transformFunction: null }, showDots: { classPropertyName: "showDots", publicName: "showDots", isSignal: true, isRequired: false, transformFunction: null }, overlayMode: { classPropertyName: "overlayMode", publicName: "overlayMode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ctaClick: "ctaClick" }, ngImport: i0, template: "<div\n class=\"bs-track\"\n [style.transform]=\"_transform()\"\n [style.height]=\"_height()\"\n (touchstart)=\"_onTouchStart($event)\"\n (touchend)=\"_onTouchEnd($event)\"\n>\n @for (item of items(); track $index) {\n <div class=\"bs-slide\">\n <img [src]=\"item.src\" [alt]=\"item.alt || ''\" style=\"height:100%;width:100%;object-fit:cover\" />\n <div class=\"bs-overlay\" [class]=\"_overlayCls()\" [style.justify-content]=\"overlayMode() === 'center' ? 'center' : overlayMode() === 'right' ? 'flex-end' : 'flex-start'\">\n <div class=\"bs-content\" [style.text-align]=\"overlayMode() === 'center' ? 'center' : 'left'\" [style.max-width]=\"overlayMode() === 'center' ? '80%' : '50%'\">\n @if (item.subtitle) { <span class=\"bs-subtitle\">{{ item.subtitle }}</span> }\n @if (item.title) { <h2 class=\"bs-title\">{{ item.title }}</h2> }\n @if (item.description) { <p class=\"bs-desc\">{{ item.description }}</p> }\n @if (item.ctaLabel) {\n @if (item.ctaLink) {\n <a [href]=\"item.ctaLink\" class=\"bs-cta\" (click)=\"ctaClick.emit(item)\">\n {{ item.ctaLabel }}\n <i class=\"pi pi-arrow-right\" style=\"font-size:0.6875rem\"></i>\n </a>\n } @else {\n <button type=\"button\" class=\"bs-cta\" (click)=\"_onCtaClick()\">\n {{ item.ctaLabel }}\n <i class=\"pi pi-arrow-right\" style=\"font-size:0.6875rem\"></i>\n </button>\n }\n }\n </div>\n </div>\n </div>\n }\n</div>\n\n@if (showArrows() && items().length > 1) {\n <button type=\"button\" class=\"bs-arrow bs-arrow-prev\" (click)=\"_prev()\" aria-label=\"Previous\">\n <i class=\"pi pi-chevron-left\"></i>\n </button>\n <button type=\"button\" class=\"bs-arrow bs-arrow-next\" (click)=\"_next()\" aria-label=\"Next\">\n <i class=\"pi pi-chevron-right\"></i>\n </button>\n}\n\n@if (showDots() && items().length > 1) {\n <div class=\"bs-dots\">\n @for (item of items(); track $index) {\n <button\n type=\"button\"\n class=\"bs-dot\"\n [class.is-active]=\"$index === _index()\"\n (click)=\"_go($index)\"\n [attr.aria-label]=\"'Go to banner ' + ($index + 1)\"\n ></button>\n }\n </div>\n}\n", styles: [":host{--bs-accent: var(--color-accent, oklch(.64 .2 50));--bs-radius: var(--radius-lg, .75rem);display:block;position:relative;overflow:hidden;border-radius:var(--bs-radius);width:100%;-webkit-user-select:none;user-select:none}.bs-track{display:flex;transition:transform .5s cubic-bezier(.25,.1,.25,1);will-change:transform}.bs-slide{flex:0 0 100%;min-width:0;position:relative}.bs-slide img{display:block;width:100%;height:100%;object-fit:cover}.bs-overlay{position:absolute;inset:0;display:flex;align-items:center;padding:2rem 3rem;background:linear-gradient(90deg,rgba(0,0,0,.55) 0%,transparent 100%)}.bs-content{max-width:50%;color:#fff;text-shadow:0 1px 4px rgba(0,0,0,.3)}.bs-subtitle{display:inline-block;font-size:.75rem;font-weight:600;letter-spacing:.05em;text-transform:uppercase;margin-bottom:.5rem;opacity:.8}.bs-title{font-size:1.5rem;font-weight:700;line-height:1.2;margin-bottom:.5rem}.bs-desc{font-size:.875rem;line-height:1.5;opacity:.85;margin-bottom:1rem}.bs-cta{display:inline-flex;align-items:center;gap:.375rem;padding:.5rem 1.25rem;border:none;border-radius:var(--bs-radius);background:var(--bs-accent);color:#fff;font-size:.8125rem;font-weight:600;cursor:pointer;transition:opacity .15s;text-decoration:none}.bs-cta:hover{opacity:.85}.bs-arrow{position:absolute;top:50%;translate:0 -50%;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;padding:0;border:none;border-radius:50%;background:#fff3;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);cursor:pointer;color:#fff;font-size:1.125rem;transition:background .15s}.bs-arrow:hover{background:#ffffff59}.bs-arrow-prev{left:.75rem}.bs-arrow-next{right:.75rem}.bs-dots{position:absolute;bottom:1rem;left:50%;translate:-50% 0;display:flex;gap:.5rem;z-index:2}.bs-dot{width:2rem;height:3px;padding:0;border:none;border-radius:2px;background:#ffffff59;cursor:pointer;transition:all .25s}.bs-dot.is-active{background:#fff;width:3rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1173
|
+
}
|
|
1174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: BannerSliderComponent, decorators: [{
|
|
1175
|
+
type: Component,
|
|
1176
|
+
args: [{ selector: 'app-banner-slider', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"bs-track\"\n [style.transform]=\"_transform()\"\n [style.height]=\"_height()\"\n (touchstart)=\"_onTouchStart($event)\"\n (touchend)=\"_onTouchEnd($event)\"\n>\n @for (item of items(); track $index) {\n <div class=\"bs-slide\">\n <img [src]=\"item.src\" [alt]=\"item.alt || ''\" style=\"height:100%;width:100%;object-fit:cover\" />\n <div class=\"bs-overlay\" [class]=\"_overlayCls()\" [style.justify-content]=\"overlayMode() === 'center' ? 'center' : overlayMode() === 'right' ? 'flex-end' : 'flex-start'\">\n <div class=\"bs-content\" [style.text-align]=\"overlayMode() === 'center' ? 'center' : 'left'\" [style.max-width]=\"overlayMode() === 'center' ? '80%' : '50%'\">\n @if (item.subtitle) { <span class=\"bs-subtitle\">{{ item.subtitle }}</span> }\n @if (item.title) { <h2 class=\"bs-title\">{{ item.title }}</h2> }\n @if (item.description) { <p class=\"bs-desc\">{{ item.description }}</p> }\n @if (item.ctaLabel) {\n @if (item.ctaLink) {\n <a [href]=\"item.ctaLink\" class=\"bs-cta\" (click)=\"ctaClick.emit(item)\">\n {{ item.ctaLabel }}\n <i class=\"pi pi-arrow-right\" style=\"font-size:0.6875rem\"></i>\n </a>\n } @else {\n <button type=\"button\" class=\"bs-cta\" (click)=\"_onCtaClick()\">\n {{ item.ctaLabel }}\n <i class=\"pi pi-arrow-right\" style=\"font-size:0.6875rem\"></i>\n </button>\n }\n }\n </div>\n </div>\n </div>\n }\n</div>\n\n@if (showArrows() && items().length > 1) {\n <button type=\"button\" class=\"bs-arrow bs-arrow-prev\" (click)=\"_prev()\" aria-label=\"Previous\">\n <i class=\"pi pi-chevron-left\"></i>\n </button>\n <button type=\"button\" class=\"bs-arrow bs-arrow-next\" (click)=\"_next()\" aria-label=\"Next\">\n <i class=\"pi pi-chevron-right\"></i>\n </button>\n}\n\n@if (showDots() && items().length > 1) {\n <div class=\"bs-dots\">\n @for (item of items(); track $index) {\n <button\n type=\"button\"\n class=\"bs-dot\"\n [class.is-active]=\"$index === _index()\"\n (click)=\"_go($index)\"\n [attr.aria-label]=\"'Go to banner ' + ($index + 1)\"\n ></button>\n }\n </div>\n}\n", styles: [":host{--bs-accent: var(--color-accent, oklch(.64 .2 50));--bs-radius: var(--radius-lg, .75rem);display:block;position:relative;overflow:hidden;border-radius:var(--bs-radius);width:100%;-webkit-user-select:none;user-select:none}.bs-track{display:flex;transition:transform .5s cubic-bezier(.25,.1,.25,1);will-change:transform}.bs-slide{flex:0 0 100%;min-width:0;position:relative}.bs-slide img{display:block;width:100%;height:100%;object-fit:cover}.bs-overlay{position:absolute;inset:0;display:flex;align-items:center;padding:2rem 3rem;background:linear-gradient(90deg,rgba(0,0,0,.55) 0%,transparent 100%)}.bs-content{max-width:50%;color:#fff;text-shadow:0 1px 4px rgba(0,0,0,.3)}.bs-subtitle{display:inline-block;font-size:.75rem;font-weight:600;letter-spacing:.05em;text-transform:uppercase;margin-bottom:.5rem;opacity:.8}.bs-title{font-size:1.5rem;font-weight:700;line-height:1.2;margin-bottom:.5rem}.bs-desc{font-size:.875rem;line-height:1.5;opacity:.85;margin-bottom:1rem}.bs-cta{display:inline-flex;align-items:center;gap:.375rem;padding:.5rem 1.25rem;border:none;border-radius:var(--bs-radius);background:var(--bs-accent);color:#fff;font-size:.8125rem;font-weight:600;cursor:pointer;transition:opacity .15s;text-decoration:none}.bs-cta:hover{opacity:.85}.bs-arrow{position:absolute;top:50%;translate:0 -50%;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;padding:0;border:none;border-radius:50%;background:#fff3;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);cursor:pointer;color:#fff;font-size:1.125rem;transition:background .15s}.bs-arrow:hover{background:#ffffff59}.bs-arrow-prev{left:.75rem}.bs-arrow-next{right:.75rem}.bs-dots{position:absolute;bottom:1rem;left:50%;translate:-50% 0;display:flex;gap:.5rem;z-index:2}.bs-dot{width:2rem;height:3px;padding:0;border:none;border-radius:2px;background:#ffffff59;cursor:pointer;transition:all .25s}.bs-dot.is-active{background:#fff;width:3rem}\n"] }]
|
|
1177
|
+
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], autoPlay: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoPlay", required: false }] }], interval: [{ type: i0.Input, args: [{ isSignal: true, alias: "interval", required: false }] }], showArrows: [{ type: i0.Input, args: [{ isSignal: true, alias: "showArrows", required: false }] }], showDots: [{ type: i0.Input, args: [{ isSignal: true, alias: "showDots", required: false }] }], overlayMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayMode", required: false }] }], ctaClick: [{ type: i0.Output, args: ["ctaClick"] }] } });
|
|
1178
|
+
|
|
1179
|
+
class CarouselComponent {
|
|
1180
|
+
items = input.required(...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
1181
|
+
height = input('320px', ...(ngDevMode ? [{ debugName: "height" }] : []));
|
|
1182
|
+
autoPlay = input(true, ...(ngDevMode ? [{ debugName: "autoPlay" }] : []));
|
|
1183
|
+
interval = input(4000, ...(ngDevMode ? [{ debugName: "interval" }] : []));
|
|
1184
|
+
showArrows = input(true, ...(ngDevMode ? [{ debugName: "showArrows" }] : []));
|
|
1185
|
+
showDots = input(true, ...(ngDevMode ? [{ debugName: "showDots" }] : []));
|
|
1186
|
+
_height = computed(() => this.height(), ...(ngDevMode ? [{ debugName: "_height" }] : []));
|
|
1187
|
+
_index = signal(0, ...(ngDevMode ? [{ debugName: "_index" }] : []));
|
|
1188
|
+
_timer = null;
|
|
1189
|
+
constructor() {
|
|
1190
|
+
effect(() => {
|
|
1191
|
+
const ap = this.autoPlay();
|
|
1192
|
+
if (ap) {
|
|
1193
|
+
this._startTimer();
|
|
1194
|
+
}
|
|
1195
|
+
else {
|
|
1196
|
+
this._stopTimer();
|
|
1197
|
+
}
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
_current = computed(() => this.items()[this._index()], ...(ngDevMode ? [{ debugName: "_current" }] : []));
|
|
1201
|
+
_transform = computed(() => `translateX(-${this._index() * 100}%)`, ...(ngDevMode ? [{ debugName: "_transform" }] : []));
|
|
1202
|
+
_go(index) {
|
|
1203
|
+
const len = this.items().length;
|
|
1204
|
+
if (len < 2)
|
|
1205
|
+
return;
|
|
1206
|
+
this._index.set(((index % len) + len) % len);
|
|
1207
|
+
if (this.autoPlay())
|
|
1208
|
+
this._startTimer();
|
|
1209
|
+
}
|
|
1210
|
+
_prev() { this._go(this._index() - 1); }
|
|
1211
|
+
_next() { this._go(this._index() + 1); }
|
|
1212
|
+
_startTimer() {
|
|
1213
|
+
this._stopTimer();
|
|
1214
|
+
this._timer = setInterval(() => this._next(), this.interval());
|
|
1215
|
+
}
|
|
1216
|
+
_stopTimer() {
|
|
1217
|
+
if (this._timer) {
|
|
1218
|
+
clearInterval(this._timer);
|
|
1219
|
+
this._timer = null;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
_xStart = 0;
|
|
1223
|
+
_onTouchStart(event) {
|
|
1224
|
+
this._xStart = event.touches[0].clientX;
|
|
1225
|
+
}
|
|
1226
|
+
_onTouchEnd(event) {
|
|
1227
|
+
const dx = event.changedTouches[0].clientX - this._xStart;
|
|
1228
|
+
if (Math.abs(dx) > 50) {
|
|
1229
|
+
dx > 0 ? this._prev() : this._next();
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: CarouselComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1233
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: CarouselComponent, isStandalone: true, selector: "app-carousel", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, autoPlay: { classPropertyName: "autoPlay", publicName: "autoPlay", isSignal: true, isRequired: false, transformFunction: null }, interval: { classPropertyName: "interval", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, showArrows: { classPropertyName: "showArrows", publicName: "showArrows", isSignal: true, isRequired: false, transformFunction: null }, showDots: { classPropertyName: "showDots", publicName: "showDots", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.height": "_height" } }, ngImport: i0, template: "<div\n class=\"carousel-track\"\n [style.transform]=\"_transform()\"\n (touchstart)=\"_onTouchStart($event)\"\n (touchend)=\"_onTouchEnd($event)\"\n>\n @for (item of items(); track $index) {\n <div class=\"carousel-slide\">\n <img [src]=\"item.src\" [alt]=\"item.alt || ''\" />\n @if (item.title || item.description) {\n <div class=\"ca-caption\">\n @if (item.title) { <div class=\"ca-caption-title\">{{ item.title }}</div> }\n @if (item.description) { <div class=\"ca-caption-desc\">{{ item.description }}</div> }\n </div>\n }\n </div>\n }\n</div>\n\n@if (showArrows() && items().length > 1) {\n <button type=\"button\" class=\"arrow arrow-prev\" (click)=\"_prev()\" aria-label=\"Previous\">\n <i class=\"pi pi-chevron-left\"></i>\n </button>\n <button type=\"button\" class=\"arrow arrow-next\" (click)=\"_next()\" aria-label=\"Next\">\n <i class=\"pi pi-chevron-right\"></i>\n </button>\n}\n\n@if (showDots() && items().length > 1) {\n <div class=\"dots\">\n @for (item of items(); track $index) {\n <button\n type=\"button\"\n class=\"dot\"\n [class.is-active]=\"$index === _index()\"\n (click)=\"_go($index)\"\n [attr.aria-label]=\"'Go to slide ' + ($index + 1)\"\n ></button>\n }\n </div>\n}\n", styles: [":host{--ca-accent: var(--color-accent, oklch(.64 .2 50));--ca-bg: var(--color-surface-alt, oklch(.94 .005 260));--ca-text: var(--color-text, oklch(.14 .01 260));--ca-muted: var(--color-text-muted, oklch(.48 .01 260));--ca-radius: var(--radius-md, .5rem);display:block;position:relative;overflow:hidden;border-radius:var(--ca-radius);width:100vw;margin-inline:calc(-50vw + 50%);-webkit-user-select:none;user-select:none}.carousel-track{display:flex;height:100%;transition:transform .4s cubic-bezier(.25,.1,.25,1);will-change:transform}.carousel-slide{flex:0 0 100%;min-width:0;height:100%}.carousel-slide img{display:block;width:100%;height:100%;object-fit:cover}.arrow{position:absolute;top:50%;translate:0 -50%;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:2.25rem;height:2.25rem;padding:0;border:none;border-radius:50%;background:color-mix(in srgb,var(--ca-bg) 80%,transparent);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);cursor:pointer;color:var(--ca-text);font-size:1rem;transition:background .15s;opacity:0;transition:opacity .2s,background .15s}:host:hover .arrow{opacity:1}.arrow:hover{background:var(--ca-bg)}.arrow-prev{left:.75rem}.arrow-next{right:.75rem}.dots{position:absolute;bottom:.75rem;left:50%;translate:-50% 0;display:flex;gap:.375rem;z-index:2}.dot{width:.5rem;height:.5rem;padding:0;border:none;border-radius:50%;background:color-mix(in srgb,var(--ca-accent) 30%,var(--ca-bg));cursor:pointer;transition:all .2s}.dot.is-active{background:var(--ca-accent);width:1.25rem;border-radius:.25rem}.ca-caption{position:absolute;bottom:2rem;left:1rem;right:1rem;z-index:1;text-align:center;color:#fff;text-shadow:0 1px 3px rgba(0,0,0,.5);pointer-events:none}.ca-caption-title{font-size:1.125rem;font-weight:600;margin-bottom:.25rem}.ca-caption-desc{font-size:.8125rem;opacity:.85}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1234
|
+
}
|
|
1235
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: CarouselComponent, decorators: [{
|
|
1236
|
+
type: Component,
|
|
1237
|
+
args: [{ selector: 'app-carousel', imports: [], host: {
|
|
1238
|
+
'[style.height]': '_height',
|
|
1239
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"carousel-track\"\n [style.transform]=\"_transform()\"\n (touchstart)=\"_onTouchStart($event)\"\n (touchend)=\"_onTouchEnd($event)\"\n>\n @for (item of items(); track $index) {\n <div class=\"carousel-slide\">\n <img [src]=\"item.src\" [alt]=\"item.alt || ''\" />\n @if (item.title || item.description) {\n <div class=\"ca-caption\">\n @if (item.title) { <div class=\"ca-caption-title\">{{ item.title }}</div> }\n @if (item.description) { <div class=\"ca-caption-desc\">{{ item.description }}</div> }\n </div>\n }\n </div>\n }\n</div>\n\n@if (showArrows() && items().length > 1) {\n <button type=\"button\" class=\"arrow arrow-prev\" (click)=\"_prev()\" aria-label=\"Previous\">\n <i class=\"pi pi-chevron-left\"></i>\n </button>\n <button type=\"button\" class=\"arrow arrow-next\" (click)=\"_next()\" aria-label=\"Next\">\n <i class=\"pi pi-chevron-right\"></i>\n </button>\n}\n\n@if (showDots() && items().length > 1) {\n <div class=\"dots\">\n @for (item of items(); track $index) {\n <button\n type=\"button\"\n class=\"dot\"\n [class.is-active]=\"$index === _index()\"\n (click)=\"_go($index)\"\n [attr.aria-label]=\"'Go to slide ' + ($index + 1)\"\n ></button>\n }\n </div>\n}\n", styles: [":host{--ca-accent: var(--color-accent, oklch(.64 .2 50));--ca-bg: var(--color-surface-alt, oklch(.94 .005 260));--ca-text: var(--color-text, oklch(.14 .01 260));--ca-muted: var(--color-text-muted, oklch(.48 .01 260));--ca-radius: var(--radius-md, .5rem);display:block;position:relative;overflow:hidden;border-radius:var(--ca-radius);width:100vw;margin-inline:calc(-50vw + 50%);-webkit-user-select:none;user-select:none}.carousel-track{display:flex;height:100%;transition:transform .4s cubic-bezier(.25,.1,.25,1);will-change:transform}.carousel-slide{flex:0 0 100%;min-width:0;height:100%}.carousel-slide img{display:block;width:100%;height:100%;object-fit:cover}.arrow{position:absolute;top:50%;translate:0 -50%;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:2.25rem;height:2.25rem;padding:0;border:none;border-radius:50%;background:color-mix(in srgb,var(--ca-bg) 80%,transparent);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);cursor:pointer;color:var(--ca-text);font-size:1rem;transition:background .15s;opacity:0;transition:opacity .2s,background .15s}:host:hover .arrow{opacity:1}.arrow:hover{background:var(--ca-bg)}.arrow-prev{left:.75rem}.arrow-next{right:.75rem}.dots{position:absolute;bottom:.75rem;left:50%;translate:-50% 0;display:flex;gap:.375rem;z-index:2}.dot{width:.5rem;height:.5rem;padding:0;border:none;border-radius:50%;background:color-mix(in srgb,var(--ca-accent) 30%,var(--ca-bg));cursor:pointer;transition:all .2s}.dot.is-active{background:var(--ca-accent);width:1.25rem;border-radius:.25rem}.ca-caption{position:absolute;bottom:2rem;left:1rem;right:1rem;z-index:1;text-align:center;color:#fff;text-shadow:0 1px 3px rgba(0,0,0,.5);pointer-events:none}.ca-caption-title{font-size:1.125rem;font-weight:600;margin-bottom:.25rem}.ca-caption-desc{font-size:.8125rem;opacity:.85}\n"] }]
|
|
1240
|
+
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], autoPlay: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoPlay", required: false }] }], interval: [{ type: i0.Input, args: [{ isSignal: true, alias: "interval", required: false }] }], showArrows: [{ type: i0.Input, args: [{ isSignal: true, alias: "showArrows", required: false }] }], showDots: [{ type: i0.Input, args: [{ isSignal: true, alias: "showDots", required: false }] }] } });
|
|
1241
|
+
|
|
1242
|
+
class EmptyStateComponent {
|
|
1243
|
+
icon = input('', ...(ngDevMode ? [{ debugName: "icon" }] : []));
|
|
1244
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
1245
|
+
message = input('', ...(ngDevMode ? [{ debugName: "message" }] : []));
|
|
1246
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
1247
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: EmptyStateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1248
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: EmptyStateComponent, isStandalone: true, selector: "app-empty-state", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"flex flex-col items-center justify-center gap-3 px-4 py-12 text-center\" [style.width]=\"width() || '100%'\">\n @if (icon()) {\n <div class=\"flex items-center justify-center w-14 h-14 rounded-full bg-[var(--color-surface-alt,oklch(0.975 0.005 260))]\">\n <i [class]=\"icon()\" class=\"text-lg text-[var(--color-text-muted,oklch(0.48 0.01 260))]\"></i>\n </div>\n }\n @if (title()) {\n <h3 class=\"text-base font-semibold text-[var(--color-text,oklch(0.14 0.01 260))]\">{{ title() }}</h3>\n }\n @if (message()) {\n <p class=\"text-sm text-[var(--color-text-muted,oklch(0.48 0.01 260))] max-w-xs\">{{ message() }}</p>\n }\n <ng-content />\n</div>\n", styles: [":host{display:contents}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1249
|
+
}
|
|
1250
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: EmptyStateComponent, decorators: [{
|
|
1251
|
+
type: Component,
|
|
1252
|
+
args: [{ selector: 'app-empty-state', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col items-center justify-center gap-3 px-4 py-12 text-center\" [style.width]=\"width() || '100%'\">\n @if (icon()) {\n <div class=\"flex items-center justify-center w-14 h-14 rounded-full bg-[var(--color-surface-alt,oklch(0.975 0.005 260))]\">\n <i [class]=\"icon()\" class=\"text-lg text-[var(--color-text-muted,oklch(0.48 0.01 260))]\"></i>\n </div>\n }\n @if (title()) {\n <h3 class=\"text-base font-semibold text-[var(--color-text,oklch(0.14 0.01 260))]\">{{ title() }}</h3>\n }\n @if (message()) {\n <p class=\"text-sm text-[var(--color-text-muted,oklch(0.48 0.01 260))] max-w-xs\">{{ message() }}</p>\n }\n <ng-content />\n</div>\n", styles: [":host{display:contents}\n"] }]
|
|
1253
|
+
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
|
|
1254
|
+
|
|
1255
|
+
class ImageUploadComponent {
|
|
1256
|
+
images = model([], ...(ngDevMode ? [{ debugName: "images" }] : []));
|
|
1257
|
+
multiple = input(true, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
1258
|
+
maxFiles = input(4, ...(ngDevMode ? [{ debugName: "maxFiles" }] : []));
|
|
1259
|
+
maxSize = input(2097152, ...(ngDevMode ? [{ debugName: "maxSize" }] : []));
|
|
1260
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
1261
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1262
|
+
placeholder = input('Drop images or click', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1263
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
1264
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
1265
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
1266
|
+
_isDragOver = signal(false, ...(ngDevMode ? [{ debugName: "_isDragOver" }] : []));
|
|
1267
|
+
_onDragOver(event) {
|
|
1268
|
+
event.preventDefault();
|
|
1269
|
+
event.stopPropagation();
|
|
1270
|
+
if (!this.disabled())
|
|
1271
|
+
this._isDragOver.set(true);
|
|
1272
|
+
}
|
|
1273
|
+
_onDragLeave(event) {
|
|
1274
|
+
event.preventDefault();
|
|
1275
|
+
event.stopPropagation();
|
|
1276
|
+
this._isDragOver.set(false);
|
|
1277
|
+
}
|
|
1278
|
+
_onDrop(event) {
|
|
1279
|
+
event.preventDefault();
|
|
1280
|
+
event.stopPropagation();
|
|
1281
|
+
this._isDragOver.set(false);
|
|
1282
|
+
if (this.disabled())
|
|
1283
|
+
return;
|
|
1284
|
+
const dropped = event.dataTransfer?.files;
|
|
1285
|
+
if (dropped)
|
|
1286
|
+
this._addFiles(Array.from(dropped));
|
|
1287
|
+
}
|
|
1288
|
+
_onFileSelected(event) {
|
|
1289
|
+
const input = event.target;
|
|
1290
|
+
if (input.files)
|
|
1291
|
+
this._addFiles(Array.from(input.files));
|
|
1292
|
+
input.value = '';
|
|
1293
|
+
}
|
|
1294
|
+
_removeFile(index) {
|
|
1295
|
+
const removed = this.images()[index];
|
|
1296
|
+
URL.revokeObjectURL(removed.url);
|
|
1297
|
+
this.images.update(f => f.filter((_, i) => i !== index));
|
|
1298
|
+
}
|
|
1299
|
+
_addFiles(newFiles) {
|
|
1300
|
+
const imgs = newFiles.filter(f => f.type.startsWith('image/'));
|
|
1301
|
+
if (this.maxSize()) {
|
|
1302
|
+
imgs.splice(0, imgs.length, ...imgs.filter(f => f.size <= (this.maxSize() || Infinity)));
|
|
1303
|
+
}
|
|
1304
|
+
const current = this.images();
|
|
1305
|
+
if (!this.multiple()) {
|
|
1306
|
+
current.forEach(f => URL.revokeObjectURL(f.url));
|
|
1307
|
+
if (imgs.length) {
|
|
1308
|
+
this.images.set([{ file: imgs[0], url: URL.createObjectURL(imgs[0]) }]);
|
|
1309
|
+
}
|
|
1310
|
+
else {
|
|
1311
|
+
this.images.set([]);
|
|
1312
|
+
}
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
const max = this.maxFiles() || Infinity;
|
|
1316
|
+
const remaining = max - current.length;
|
|
1317
|
+
if (remaining <= 0)
|
|
1318
|
+
return;
|
|
1319
|
+
const add = imgs.slice(0, remaining).map(f => ({ file: f, url: URL.createObjectURL(f) }));
|
|
1320
|
+
this.images.set([...current, ...add]);
|
|
1321
|
+
}
|
|
1322
|
+
_formatSize(bytes) {
|
|
1323
|
+
if (bytes < 1024)
|
|
1324
|
+
return `${bytes} B`;
|
|
1325
|
+
if (bytes < 1048576)
|
|
1326
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
1327
|
+
return `${(bytes / 1048576).toFixed(1)} MB`;
|
|
1328
|
+
}
|
|
1329
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ImageUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1330
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: ImageUploadComponent, isStandalone: true, selector: "app-image-upload", inputs: { images: { classPropertyName: "images", publicName: "images", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, maxFiles: { classPropertyName: "maxFiles", publicName: "maxFiles", 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 }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { images: "imagesChange" }, host: { properties: { "attr.data-size": "_size" } }, ngImport: i0, template: "@if (images().length) {\n <div class=\"preview-grid\">\n @for (img of images(); track img.url; let i = $index) {\n <div class=\"preview-item\">\n <img [src]=\"img.url\" [alt]=\"img.file.name\" />\n <div class=\"preview-item-overlay\">\n <button type=\"button\" class=\"remove-btn\" (click)=\"_removeFile(i)\" aria-label=\"Remove\" title=\"Remove\">×</button>\n </div>\n </div>\n }\n @if (multiple() && images().length < maxFiles()) {\n <button type=\"button\" class=\"add-btn\" (click)=\"_input.click()\" title=\"Add image\">\n <i class=\"pi pi-plus text-lg\"></i>\n <span>Add</span>\n </button>\n }\n </div>\n} @else {\n <div\n class=\"drop-zone\"\n [class.is-dragover]=\"_isDragOver()\"\n (dragover)=\"_onDragOver($event)\"\n (dragleave)=\"_onDragLeave($event)\"\n (drop)=\"_onDrop($event)\"\n (click)=\"_input.click()\"\n >\n <i class=\"pi pi-image text-2xl\"></i>\n <span class=\"text-xs\">{{ placeholder() }}</span>\n @if (maxSize()) {\n <span class=\"text-[10px] opacity-60\">Max {{ _formatSize(maxSize()) }} each</span>\n }\n </div>\n}\n\n<input\n #_input\n type=\"file\"\n accept=\"image/*\"\n [attr.multiple]=\"multiple() ? true : null\"\n [attr.disabled]=\"disabled() ? true : null\"\n (change)=\"_onFileSelected($event)\"\n style=\"display:none\"\n/>\n\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)]\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--iu-accent: var(--color-accent, oklch(.64 .2 50));--iu-bg: var(--color-surface, oklch(.99 0 0));--iu-border: var(--color-border, oklch(.83 .015 260));--iu-text: var(--color-text, oklch(.14 .01 260));--iu-muted: var(--color-text-muted, oklch(.48 .01 260));--iu-radius: var(--radius-md, .5rem);position:relative;display:block;padding-bottom:1.375rem;width:100%}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}.drop-zone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.375rem;min-height:8rem;padding:1.5rem 1rem;border:2px dashed var(--iu-border);border-radius:var(--iu-radius);background:var(--iu-bg);cursor:pointer;transition:all .2s ease;color:var(--iu-muted);text-align:center}.drop-zone:hover,.drop-zone.is-dragover{border-color:var(--iu-accent);background:color-mix(in srgb,var(--iu-accent) 6%,var(--iu-bg));color:var(--iu-text)}.drop-zone.has-preview{border-style:solid;border-color:transparent;background:transparent;min-height:auto;padding:0;cursor:default}.drop-zone.has-preview:hover{border-color:transparent;background:transparent}.preview-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(100px,1fr));gap:.5rem}.preview-item{position:relative;aspect-ratio:1;border-radius:calc(var(--iu-radius) - 2px);overflow:hidden;border:1px solid var(--iu-border);background:color-mix(in srgb,var(--iu-accent) 4%,var(--iu-bg))}.preview-item img{width:100%;height:100%;object-fit:cover;display:block}.preview-item-overlay{position:absolute;inset:0;display:flex;align-items:flex-start;justify-content:flex-end;padding:.25rem;opacity:0;transition:opacity .15s;background:linear-gradient(to bottom,rgba(0,0,0,.4) 0%,transparent 60%)}.preview-item:hover .preview-item-overlay{opacity:1}.remove-btn{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:none;border-radius:50%;background:#00000080;cursor:pointer;color:#fff;font-size:.875rem;transition:background .15s}.remove-btn:hover{background:var(--color-danger, oklch(.55 .22 25))}.add-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;aspect-ratio:1;border:2px dashed var(--iu-border);border-radius:calc(var(--iu-radius) - 2px);background:transparent;cursor:pointer;color:var(--iu-muted);font-size:.75rem;gap:.25rem;transition:all .2s}.add-btn:hover{border-color:var(--iu-accent);color:var(--iu-accent);background:color-mix(in srgb,var(--iu-accent) 6%,var(--iu-bg))}.error-enter{animation:error-in .25s ease-out}.error-leave{animation:error-out .2s ease-in forwards}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1331
|
+
}
|
|
1332
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ImageUploadComponent, decorators: [{
|
|
1333
|
+
type: Component,
|
|
1334
|
+
args: [{ selector: 'app-image-upload', imports: [], host: {
|
|
1335
|
+
'[attr.data-size]': '_size',
|
|
1336
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (images().length) {\n <div class=\"preview-grid\">\n @for (img of images(); track img.url; let i = $index) {\n <div class=\"preview-item\">\n <img [src]=\"img.url\" [alt]=\"img.file.name\" />\n <div class=\"preview-item-overlay\">\n <button type=\"button\" class=\"remove-btn\" (click)=\"_removeFile(i)\" aria-label=\"Remove\" title=\"Remove\">×</button>\n </div>\n </div>\n }\n @if (multiple() && images().length < maxFiles()) {\n <button type=\"button\" class=\"add-btn\" (click)=\"_input.click()\" title=\"Add image\">\n <i class=\"pi pi-plus text-lg\"></i>\n <span>Add</span>\n </button>\n }\n </div>\n} @else {\n <div\n class=\"drop-zone\"\n [class.is-dragover]=\"_isDragOver()\"\n (dragover)=\"_onDragOver($event)\"\n (dragleave)=\"_onDragLeave($event)\"\n (drop)=\"_onDrop($event)\"\n (click)=\"_input.click()\"\n >\n <i class=\"pi pi-image text-2xl\"></i>\n <span class=\"text-xs\">{{ placeholder() }}</span>\n @if (maxSize()) {\n <span class=\"text-[10px] opacity-60\">Max {{ _formatSize(maxSize()) }} each</span>\n }\n </div>\n}\n\n<input\n #_input\n type=\"file\"\n accept=\"image/*\"\n [attr.multiple]=\"multiple() ? true : null\"\n [attr.disabled]=\"disabled() ? true : null\"\n (change)=\"_onFileSelected($event)\"\n style=\"display:none\"\n/>\n\n@if (error()) {\n <span class=\"absolute left-0 right-0 bottom-0 m-0 text-xs font-[var(--font-sans)] text-[var(--color-danger)]\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--iu-accent: var(--color-accent, oklch(.64 .2 50));--iu-bg: var(--color-surface, oklch(.99 0 0));--iu-border: var(--color-border, oklch(.83 .015 260));--iu-text: var(--color-text, oklch(.14 .01 260));--iu-muted: var(--color-text-muted, oklch(.48 .01 260));--iu-radius: var(--radius-md, .5rem);position:relative;display:block;padding-bottom:1.375rem;width:100%}:host([data-size=\"sm\"]){padding-bottom:1.25rem}:host([data-size=\"lg\"]){padding-bottom:1.5rem}.drop-zone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.375rem;min-height:8rem;padding:1.5rem 1rem;border:2px dashed var(--iu-border);border-radius:var(--iu-radius);background:var(--iu-bg);cursor:pointer;transition:all .2s ease;color:var(--iu-muted);text-align:center}.drop-zone:hover,.drop-zone.is-dragover{border-color:var(--iu-accent);background:color-mix(in srgb,var(--iu-accent) 6%,var(--iu-bg));color:var(--iu-text)}.drop-zone.has-preview{border-style:solid;border-color:transparent;background:transparent;min-height:auto;padding:0;cursor:default}.drop-zone.has-preview:hover{border-color:transparent;background:transparent}.preview-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(100px,1fr));gap:.5rem}.preview-item{position:relative;aspect-ratio:1;border-radius:calc(var(--iu-radius) - 2px);overflow:hidden;border:1px solid var(--iu-border);background:color-mix(in srgb,var(--iu-accent) 4%,var(--iu-bg))}.preview-item img{width:100%;height:100%;object-fit:cover;display:block}.preview-item-overlay{position:absolute;inset:0;display:flex;align-items:flex-start;justify-content:flex-end;padding:.25rem;opacity:0;transition:opacity .15s;background:linear-gradient(to bottom,rgba(0,0,0,.4) 0%,transparent 60%)}.preview-item:hover .preview-item-overlay{opacity:1}.remove-btn{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:none;border-radius:50%;background:#00000080;cursor:pointer;color:#fff;font-size:.875rem;transition:background .15s}.remove-btn:hover{background:var(--color-danger, oklch(.55 .22 25))}.add-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;aspect-ratio:1;border:2px dashed var(--iu-border);border-radius:calc(var(--iu-radius) - 2px);background:transparent;cursor:pointer;color:var(--iu-muted);font-size:.75rem;gap:.25rem;transition:all .2s}.add-btn:hover{border-color:var(--iu-accent);color:var(--iu-accent);background:color-mix(in srgb,var(--iu-accent) 6%,var(--iu-bg))}.error-enter{animation:error-in .25s ease-out}.error-leave{animation:error-out .2s ease-in forwards}@keyframes error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
1337
|
+
}], propDecorators: { images: [{ type: i0.Input, args: [{ isSignal: true, alias: "images", required: false }] }, { type: i0.Output, args: ["imagesChange"] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], maxFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFiles", required: false }] }], maxSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSize", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }] } });
|
|
1338
|
+
|
|
1339
|
+
class SkeletonComponent {
|
|
1340
|
+
variant = input('text', ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
1341
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
1342
|
+
height = input('', ...(ngDevMode ? [{ debugName: "height" }] : []));
|
|
1343
|
+
count = input(1, ...(ngDevMode ? [{ debugName: "count" }] : []));
|
|
1344
|
+
borderRadius = input('', ...(ngDevMode ? [{ debugName: "borderRadius" }] : []));
|
|
1345
|
+
accentColor = input('', ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
1346
|
+
_items = computed(() => Array.from({ length: this.count() }), ...(ngDevMode ? [{ debugName: "_items" }] : []));
|
|
1347
|
+
_baseWidth = computed(() => this.width() || (this.variant() === 'circle' ? '40px' : '100%'), ...(ngDevMode ? [{ debugName: "_baseWidth" }] : []));
|
|
1348
|
+
_baseHeight = computed(() => {
|
|
1349
|
+
if (this.height())
|
|
1350
|
+
return this.height();
|
|
1351
|
+
switch (this.variant()) {
|
|
1352
|
+
case 'circle': return '40px';
|
|
1353
|
+
case 'rect': return '100px';
|
|
1354
|
+
case 'text':
|
|
1355
|
+
default: return '14px';
|
|
1356
|
+
}
|
|
1357
|
+
}, ...(ngDevMode ? [{ debugName: "_baseHeight" }] : []));
|
|
1358
|
+
_radius = computed(() => {
|
|
1359
|
+
if (this.borderRadius())
|
|
1360
|
+
return this.borderRadius();
|
|
1361
|
+
switch (this.variant()) {
|
|
1362
|
+
case 'circle': return '9999px';
|
|
1363
|
+
case 'rect': return 'var(--radius-md,0.5rem)';
|
|
1364
|
+
case 'text':
|
|
1365
|
+
default: return 'var(--radius-sm,0.25rem)';
|
|
1366
|
+
}
|
|
1367
|
+
}, ...(ngDevMode ? [{ debugName: "_radius" }] : []));
|
|
1368
|
+
_bg = computed(() => {
|
|
1369
|
+
if (this.accentColor())
|
|
1370
|
+
return `var(--color-${this.accentColor()}-bg,var(--color-surface-alt,oklch(0.975 0.005 260)))`;
|
|
1371
|
+
return 'var(--color-surface-alt,oklch(0.975 0.005 260))';
|
|
1372
|
+
}, ...(ngDevMode ? [{ debugName: "_bg" }] : []));
|
|
1373
|
+
_lineWidth(index) {
|
|
1374
|
+
if (this.width())
|
|
1375
|
+
return this.width();
|
|
1376
|
+
const total = this.count();
|
|
1377
|
+
if (total <= 1)
|
|
1378
|
+
return '100%';
|
|
1379
|
+
if (index === total - 1)
|
|
1380
|
+
return '60%';
|
|
1381
|
+
return '100%';
|
|
1382
|
+
}
|
|
1383
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SkeletonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1384
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: SkeletonComponent, isStandalone: true, selector: "app-skeleton", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, borderRadius: { classPropertyName: "borderRadius", publicName: "borderRadius", isSignal: true, isRequired: false, transformFunction: null }, accentColor: { classPropertyName: "accentColor", publicName: "accentColor", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"flex flex-col gap-2\" [style.width]=\"_baseWidth()\">\n @for (item of _items(); track $index) {\n <div\n class=\"skeleton-pulse\"\n [style.height]=\"_baseHeight()\"\n [style.width]=\"_lineWidth($index)\"\n [style.border-radius]=\"_radius()\"\n [style.background-color]=\"_bg()\"\n ></div>\n }\n</div>\n", styles: [":host{display:contents}.skeleton-pulse{animation:skeletonPulse 1.5s ease-in-out infinite}@keyframes skeletonPulse{0%,to{opacity:1}50%{opacity:.4}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1385
|
+
}
|
|
1386
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SkeletonComponent, decorators: [{
|
|
1387
|
+
type: Component,
|
|
1388
|
+
args: [{ selector: 'app-skeleton', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-2\" [style.width]=\"_baseWidth()\">\n @for (item of _items(); track $index) {\n <div\n class=\"skeleton-pulse\"\n [style.height]=\"_baseHeight()\"\n [style.width]=\"_lineWidth($index)\"\n [style.border-radius]=\"_radius()\"\n [style.background-color]=\"_bg()\"\n ></div>\n }\n</div>\n", styles: [":host{display:contents}.skeleton-pulse{animation:skeletonPulse 1.5s ease-in-out infinite}@keyframes skeletonPulse{0%,to{opacity:1}50%{opacity:.4}}\n"] }]
|
|
1389
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], count: [{ type: i0.Input, args: [{ isSignal: true, alias: "count", required: false }] }], borderRadius: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderRadius", required: false }] }], accentColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accentColor", required: false }] }] } });
|
|
1390
|
+
|
|
1391
|
+
class TableSkeletonComponent {
|
|
1392
|
+
rows = input(5, ...(ngDevMode ? [{ debugName: "rows" }] : []));
|
|
1393
|
+
columns = input(4, ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
1394
|
+
_rowArr = computed(() => Array.from({ length: this.rows() }), ...(ngDevMode ? [{ debugName: "_rowArr" }] : []));
|
|
1395
|
+
_cols = computed(() => {
|
|
1396
|
+
const c = this.columns();
|
|
1397
|
+
if (typeof c === 'number')
|
|
1398
|
+
return Array.from({ length: c }, () => ({ shape: 'bar' }));
|
|
1399
|
+
return c.map(col => ({ shape: col.shape ?? 'bar', width: col.width }));
|
|
1400
|
+
}, ...(ngDevMode ? [{ debugName: "_cols" }] : []));
|
|
1401
|
+
_colWidth = computed(() => {
|
|
1402
|
+
const cols = this._cols();
|
|
1403
|
+
const count = cols.length;
|
|
1404
|
+
if (count === 0)
|
|
1405
|
+
return [];
|
|
1406
|
+
const defined = cols.filter(c => c.width);
|
|
1407
|
+
const definedTotal = defined.reduce((sum, c) => sum + parseFloat(c.width || '0'), 0);
|
|
1408
|
+
const undefinedCount = count - defined.length;
|
|
1409
|
+
const remainingPct = 100 - definedTotal;
|
|
1410
|
+
const eachPct = undefinedCount > 0 ? Math.floor(remainingPct / undefinedCount) : 0;
|
|
1411
|
+
return cols.map(c => c.width || `${eachPct}%`);
|
|
1412
|
+
}, ...(ngDevMode ? [{ debugName: "_colWidth" }] : []));
|
|
1413
|
+
_shapeClass(shape) {
|
|
1414
|
+
switch (shape) {
|
|
1415
|
+
case 'circle': return 'rounded-full';
|
|
1416
|
+
case 'action': return 'rounded-md';
|
|
1417
|
+
default: return 'rounded-[var(--radius-sm,0.25rem)]';
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
_shapeSize(shape) {
|
|
1421
|
+
switch (shape) {
|
|
1422
|
+
case 'circle': return { width: '32px', height: '32px' };
|
|
1423
|
+
case 'action': return { width: '28px', height: '28px' };
|
|
1424
|
+
default: return { width: '100%', height: '14px' };
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TableSkeletonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1428
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: TableSkeletonComponent, isStandalone: true, selector: "app-table-skeleton", inputs: { rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"overflow-hidden rounded-[var(--radius-lg,0.75rem)] border border-[var(--color-border-light,oklch(0.91 0.01 260))]\">\n <table class=\"w-full border-collapse\">\n <thead>\n <tr>\n @for (col of _cols(); track $index) {\n <th\n class=\"px-3 py-2.5\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.width]=\"_colWidth()[$index]\"\n >\n <div class=\"skeleton-shimmer rounded-[var(--radius-sm,0.25rem)]\" style=\"height:14px;width:60%\"></div>\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of _rowArr(); track $index) {\n <tr class=\"border-b border-[var(--color-border-light,oklch(0.91 0.01 260))]\">\n @for (col of _cols(); track $index) {\n <td class=\"px-3 py-2.5\">\n <div\n class=\"skeleton-shimmer\"\n [class]=\"_shapeClass(col.shape)\"\n [style]=\"_shapeSize(col.shape)\"\n [class.mx-auto]=\"col.shape === 'circle'\"\n ></div>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n</div>\n", styles: [":host{display:block}.skeleton-shimmer{background:var(--color-surface-alt, oklch(.975 .005 260));animation:skeletonPulse 1.5s ease-in-out infinite}thead .skeleton-shimmer{background:#fff3}@keyframes skeletonPulse{0%,to{opacity:1}50%{opacity:.4}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1429
|
+
}
|
|
1430
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TableSkeletonComponent, decorators: [{
|
|
1431
|
+
type: Component,
|
|
1432
|
+
args: [{ selector: 'app-table-skeleton', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"overflow-hidden rounded-[var(--radius-lg,0.75rem)] border border-[var(--color-border-light,oklch(0.91 0.01 260))]\">\n <table class=\"w-full border-collapse\">\n <thead>\n <tr>\n @for (col of _cols(); track $index) {\n <th\n class=\"px-3 py-2.5\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.width]=\"_colWidth()[$index]\"\n >\n <div class=\"skeleton-shimmer rounded-[var(--radius-sm,0.25rem)]\" style=\"height:14px;width:60%\"></div>\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of _rowArr(); track $index) {\n <tr class=\"border-b border-[var(--color-border-light,oklch(0.91 0.01 260))]\">\n @for (col of _cols(); track $index) {\n <td class=\"px-3 py-2.5\">\n <div\n class=\"skeleton-shimmer\"\n [class]=\"_shapeClass(col.shape)\"\n [style]=\"_shapeSize(col.shape)\"\n [class.mx-auto]=\"col.shape === 'circle'\"\n ></div>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n</div>\n", styles: [":host{display:block}.skeleton-shimmer{background:var(--color-surface-alt, oklch(.975 .005 260));animation:skeletonPulse 1.5s ease-in-out infinite}thead .skeleton-shimmer{background:#fff3}@keyframes skeletonPulse{0%,to{opacity:1}50%{opacity:.4}}\n"] }]
|
|
1433
|
+
}], propDecorators: { rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }] } });
|
|
1434
|
+
|
|
1435
|
+
class TooltipComponent {
|
|
1436
|
+
_el = inject(ElementRef);
|
|
1437
|
+
text = input('', ...(ngDevMode ? [{ debugName: "text" }] : []));
|
|
1438
|
+
position = input('top', ...(ngDevMode ? [{ debugName: "position" }] : []));
|
|
1439
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
1440
|
+
alwaysShow = input(false, ...(ngDevMode ? [{ debugName: "alwaysShow" }] : []));
|
|
1441
|
+
_visible = signal(false, ...(ngDevMode ? [{ debugName: "_visible" }] : []));
|
|
1442
|
+
_tipText = computed(() => this.text() || this._el.nativeElement.textContent?.trim() || '', ...(ngDevMode ? [{ debugName: "_tipText" }] : []));
|
|
1443
|
+
_onMouseEnter() {
|
|
1444
|
+
if (this.disabled())
|
|
1445
|
+
return;
|
|
1446
|
+
const content = this._el.nativeElement.querySelector('[data-tip-content]');
|
|
1447
|
+
if (content && !this.alwaysShow()) {
|
|
1448
|
+
if (content.scrollWidth <= content.clientWidth)
|
|
1449
|
+
return;
|
|
1450
|
+
}
|
|
1451
|
+
this._visible.set(true);
|
|
1452
|
+
}
|
|
1453
|
+
_onMouseLeave() {
|
|
1454
|
+
this._visible.set(false);
|
|
1455
|
+
}
|
|
1456
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1457
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: TooltipComponent, isStandalone: true, selector: "app-tooltip", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, alwaysShow: { classPropertyName: "alwaysShow", publicName: "alwaysShow", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "_onMouseEnter()", "mouseleave": "_onMouseLeave()" } }, ngImport: i0, template: "<div data-tip-content\n class=\"truncate\"\n>\n <ng-content />\n</div>\n@if (_visible()) {\n <div class=\"tooltip-panel tooltip-{{ position() }}\"\n animate.enter=\"tip-enter\"\n animate.leave=\"tip-leave\"\n >\n {{ _tipText() }}\n </div>\n}\n", styles: [":host{position:relative;display:inline-block;max-width:100%}.tooltip-panel{position:absolute;z-index:999;pointer-events:none;padding:4px 8px;font-size:.75rem;line-height:1.25;border-radius:4px;white-space:nowrap;max-width:300px;overflow:hidden;text-overflow:ellipsis;background:var(--color-text, oklch(.14 .01 260));color:var(--color-surface, oklch(.99 0 0))}.tooltip-top{bottom:100%;left:50%;translate:-50% 0;margin-bottom:4px}.tooltip-bottom{top:100%;left:50%;translate:-50% 0;margin-top:4px}.tooltip-left{right:100%;top:50%;translate:0 -50%;margin-right:4px}.tooltip-right{left:100%;top:50%;translate:0 -50%;margin-left:4px}.tip-enter{animation:tipIn .12s ease-out}.tip-leave{animation:tipOut .08s ease-in forwards}@keyframes tipIn{0%{opacity:0}to{opacity:1}}@keyframes tipOut{0%{opacity:1}to{opacity:0}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1458
|
+
}
|
|
1459
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
1460
|
+
type: Component,
|
|
1461
|
+
args: [{ selector: 'app-tooltip', imports: [], host: {
|
|
1462
|
+
'(mouseenter)': '_onMouseEnter()',
|
|
1463
|
+
'(mouseleave)': '_onMouseLeave()',
|
|
1464
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div data-tip-content\n class=\"truncate\"\n>\n <ng-content />\n</div>\n@if (_visible()) {\n <div class=\"tooltip-panel tooltip-{{ position() }}\"\n animate.enter=\"tip-enter\"\n animate.leave=\"tip-leave\"\n >\n {{ _tipText() }}\n </div>\n}\n", styles: [":host{position:relative;display:inline-block;max-width:100%}.tooltip-panel{position:absolute;z-index:999;pointer-events:none;padding:4px 8px;font-size:.75rem;line-height:1.25;border-radius:4px;white-space:nowrap;max-width:300px;overflow:hidden;text-overflow:ellipsis;background:var(--color-text, oklch(.14 .01 260));color:var(--color-surface, oklch(.99 0 0))}.tooltip-top{bottom:100%;left:50%;translate:-50% 0;margin-bottom:4px}.tooltip-bottom{top:100%;left:50%;translate:-50% 0;margin-top:4px}.tooltip-left{right:100%;top:50%;translate:0 -50%;margin-right:4px}.tooltip-right{left:100%;top:50%;translate:0 -50%;margin-left:4px}.tip-enter{animation:tipIn .12s ease-out}.tip-leave{animation:tipOut .08s ease-in forwards}@keyframes tipIn{0%{opacity:0}to{opacity:1}}@keyframes tipOut{0%{opacity:1}to{opacity:0}}\n"] }]
|
|
1465
|
+
}], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], alwaysShow: [{ type: i0.Input, args: [{ isSignal: true, alias: "alwaysShow", required: false }] }] } });
|
|
1466
|
+
|
|
1467
|
+
class TableComponent {
|
|
1468
|
+
columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
1469
|
+
rows = input([], ...(ngDevMode ? [{ debugName: "rows" }] : []));
|
|
1470
|
+
striped = input(false, ...(ngDevMode ? [{ debugName: "striped" }] : []));
|
|
1471
|
+
hoverable = input(true, ...(ngDevMode ? [{ debugName: "hoverable" }] : []));
|
|
1472
|
+
sortable = input(false, ...(ngDevMode ? [{ debugName: "sortable" }] : []));
|
|
1473
|
+
emptyMessage = input('No data available', ...(ngDevMode ? [{ debugName: "emptyMessage" }] : []));
|
|
1474
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
1475
|
+
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
|
|
1476
|
+
searchable = input(false, ...(ngDevMode ? [{ debugName: "searchable" }] : []));
|
|
1477
|
+
filterable = input(false, ...(ngDevMode ? [{ debugName: "filterable" }] : []));
|
|
1478
|
+
skeletonRows = input(5, ...(ngDevMode ? [{ debugName: "skeletonRows" }] : []));
|
|
1479
|
+
resizable = input(false, ...(ngDevMode ? [{ debugName: "resizable" }] : []));
|
|
1480
|
+
pageable = input(false, ...(ngDevMode ? [{ debugName: "pageable" }] : []));
|
|
1481
|
+
pageSize = input(10, ...(ngDevMode ? [{ debugName: "pageSize" }] : []));
|
|
1482
|
+
pageSizeOptions = input([5, 10, 20, 50], ...(ngDevMode ? [{ debugName: "pageSizeOptions" }] : []));
|
|
1483
|
+
selectable = input(false, ...(ngDevMode ? [{ debugName: "selectable" }] : []));
|
|
1484
|
+
selectionMode = input('multiple', ...(ngDevMode ? [{ debugName: "selectionMode" }] : []));
|
|
1485
|
+
selectionKey = input('', ...(ngDevMode ? [{ debugName: "selectionKey" }] : []));
|
|
1486
|
+
stickyHeader = input(false, ...(ngDevMode ? [{ debugName: "stickyHeader" }] : []));
|
|
1487
|
+
exportable = input(false, ...(ngDevMode ? [{ debugName: "exportable" }] : []));
|
|
1488
|
+
columnToggle = input(false, ...(ngDevMode ? [{ debugName: "columnToggle" }] : []));
|
|
1489
|
+
expandable = input(false, ...(ngDevMode ? [{ debugName: "expandable" }] : []));
|
|
1490
|
+
sortChange = output();
|
|
1491
|
+
pageChange = output();
|
|
1492
|
+
selectedRows = output();
|
|
1493
|
+
rowDetail;
|
|
1494
|
+
_sortKey = signal('', ...(ngDevMode ? [{ debugName: "_sortKey" }] : []));
|
|
1495
|
+
_sortDir = signal('', ...(ngDevMode ? [{ debugName: "_sortDir" }] : []));
|
|
1496
|
+
_searchQuery = signal('', ...(ngDevMode ? [{ debugName: "_searchQuery" }] : []));
|
|
1497
|
+
_filters = signal({}, ...(ngDevMode ? [{ debugName: "_filters" }] : []));
|
|
1498
|
+
_page = signal(1, ...(ngDevMode ? [{ debugName: "_page" }] : []));
|
|
1499
|
+
_pageSize = signal(10, ...(ngDevMode ? [{ debugName: "_pageSize" }] : []));
|
|
1500
|
+
_columnWidths = signal({}, ...(ngDevMode ? [{ debugName: "_columnWidths" }] : []));
|
|
1501
|
+
_hiddenColumns = signal(new Set(), ...(ngDevMode ? [{ debugName: "_hiddenColumns" }] : []));
|
|
1502
|
+
_selectedKeys = signal(new Set(), ...(ngDevMode ? [{ debugName: "_selectedKeys" }] : []));
|
|
1503
|
+
_expandedKeys = signal(new Set(), ...(ngDevMode ? [{ debugName: "_expandedKeys" }] : []));
|
|
1504
|
+
_pageSizeOptions = computed(() => this.pageSizeOptions().map(s => ({ label: `${s} / page`, value: String(s) })), ...(ngDevMode ? [{ debugName: "_pageSizeOptions" }] : []));
|
|
1505
|
+
_columnToggleOpen = signal(false, ...(ngDevMode ? [{ debugName: "_columnToggleOpen" }] : []));
|
|
1506
|
+
_exportOpen = signal(false, ...(ngDevMode ? [{ debugName: "_exportOpen" }] : []));
|
|
1507
|
+
_resizing = null;
|
|
1508
|
+
constructor() {
|
|
1509
|
+
effect(() => { this._pageSize.set(this.pageSize()); });
|
|
1510
|
+
effect(() => {
|
|
1511
|
+
this._searchQuery();
|
|
1512
|
+
this._filters();
|
|
1513
|
+
this._page.set(1);
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
_displayColumns = computed(() => this.columns().filter(c => !this._hiddenColumns().has(c.key)), ...(ngDevMode ? [{ debugName: "_displayColumns" }] : []));
|
|
1517
|
+
_colCount = computed(() => {
|
|
1518
|
+
let count = this._displayColumns().length;
|
|
1519
|
+
if (this.selectable())
|
|
1520
|
+
count++;
|
|
1521
|
+
if (this.expandable())
|
|
1522
|
+
count++;
|
|
1523
|
+
return count;
|
|
1524
|
+
}, ...(ngDevMode ? [{ debugName: "_colCount" }] : []));
|
|
1525
|
+
_filteredRows = computed(() => {
|
|
1526
|
+
let data = this.rows();
|
|
1527
|
+
const key = this._sortKey();
|
|
1528
|
+
const dir = this._sortDir();
|
|
1529
|
+
if (key && dir) {
|
|
1530
|
+
data = [...data].sort((a, b) => {
|
|
1531
|
+
const aVal = a[key];
|
|
1532
|
+
const bVal = b[key];
|
|
1533
|
+
const direction = dir === 'asc' ? 1 : -1;
|
|
1534
|
+
if (aVal < bVal)
|
|
1535
|
+
return -1 * direction;
|
|
1536
|
+
if (aVal > bVal)
|
|
1537
|
+
return 1 * direction;
|
|
1538
|
+
return 0;
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
const query = this._searchQuery().toLowerCase().trim();
|
|
1542
|
+
if (query) {
|
|
1543
|
+
data = data.filter(row => Object.values(row).some(val => String(val).toLowerCase().includes(query)));
|
|
1544
|
+
}
|
|
1545
|
+
const filters = this._filters();
|
|
1546
|
+
for (const [fk, fv] of Object.entries(filters)) {
|
|
1547
|
+
if (fv)
|
|
1548
|
+
data = data.filter(row => String(row[fk]) === fv);
|
|
1549
|
+
}
|
|
1550
|
+
return data;
|
|
1551
|
+
}, ...(ngDevMode ? [{ debugName: "_filteredRows" }] : []));
|
|
1552
|
+
_displayRows = computed(() => {
|
|
1553
|
+
if (!this.pageable())
|
|
1554
|
+
return this._filteredRows();
|
|
1555
|
+
const total = this._filteredRows().length;
|
|
1556
|
+
const size = this._pageSize();
|
|
1557
|
+
if (total === 0)
|
|
1558
|
+
return [];
|
|
1559
|
+
const maxPage = Math.max(1, Math.ceil(total / size));
|
|
1560
|
+
const page = Math.min(this._page(), maxPage);
|
|
1561
|
+
const start = (page - 1) * size;
|
|
1562
|
+
return this._filteredRows().slice(start, start + size);
|
|
1563
|
+
}, ...(ngDevMode ? [{ debugName: "_displayRows" }] : []));
|
|
1564
|
+
_totalPages = computed(() => this.pageable() ? Math.max(1, Math.ceil(this._filteredRows().length / this._pageSize())) : 1, ...(ngDevMode ? [{ debugName: "_totalPages" }] : []));
|
|
1565
|
+
_pageInfo = computed(() => {
|
|
1566
|
+
const total = this._filteredRows().length;
|
|
1567
|
+
const page = this._page();
|
|
1568
|
+
const size = this._pageSize();
|
|
1569
|
+
const from = total > 0 ? (page - 1) * size + 1 : 0;
|
|
1570
|
+
return { from, to: Math.min(page * size, total), total };
|
|
1571
|
+
}, ...(ngDevMode ? [{ debugName: "_pageInfo" }] : []));
|
|
1572
|
+
_visiblePages = computed(() => {
|
|
1573
|
+
const total = this._totalPages();
|
|
1574
|
+
const current = this._page();
|
|
1575
|
+
const range = 5;
|
|
1576
|
+
let start = Math.max(1, current - Math.floor(range / 2));
|
|
1577
|
+
let end = Math.min(total, start + range - 1);
|
|
1578
|
+
if (end - start + 1 < range)
|
|
1579
|
+
start = Math.max(1, end - range + 1);
|
|
1580
|
+
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
1581
|
+
}, ...(ngDevMode ? [{ debugName: "_visiblePages" }] : []));
|
|
1582
|
+
_rowMeta = computed(() => {
|
|
1583
|
+
const cols = this._displayColumns();
|
|
1584
|
+
const rows = this._displayRows();
|
|
1585
|
+
const active = {};
|
|
1586
|
+
return rows.map((row, rowIndex) => cols.map(col => {
|
|
1587
|
+
const key = col.key;
|
|
1588
|
+
if (active[key] !== undefined && active[key] > 1) {
|
|
1589
|
+
active[key]--;
|
|
1590
|
+
return { visible: false, rowspan: 0 };
|
|
1591
|
+
}
|
|
1592
|
+
if (active[key] !== undefined)
|
|
1593
|
+
delete active[key];
|
|
1594
|
+
if (col.rowSpan) {
|
|
1595
|
+
const span = col.rowSpan(row, rowIndex, rows);
|
|
1596
|
+
if (span > 1) {
|
|
1597
|
+
active[key] = span;
|
|
1598
|
+
return { visible: true, rowspan: span };
|
|
1599
|
+
}
|
|
1600
|
+
if (span === 0)
|
|
1601
|
+
return { visible: false, rowspan: 0 };
|
|
1602
|
+
}
|
|
1603
|
+
return { visible: true, rowspan: 1 };
|
|
1604
|
+
}));
|
|
1605
|
+
}, ...(ngDevMode ? [{ debugName: "_rowMeta" }] : []));
|
|
1606
|
+
_skeletonCols = computed(() => this.columns().map(col => ({ shape: col.actions ? 'action' : 'bar', width: col.width })), ...(ngDevMode ? [{ debugName: "_skeletonCols" }] : []));
|
|
1607
|
+
_filterCols = computed(() => this._displayColumns().filter(c => c.filterable && c.filterOptions), ...(ngDevMode ? [{ debugName: "_filterCols" }] : []));
|
|
1608
|
+
_footerCols = computed(() => this._displayColumns().filter(c => c.footer), ...(ngDevMode ? [{ debugName: "_footerCols" }] : []));
|
|
1609
|
+
_footerText = computed(() => this._footerCols().map(c => c.footer(this._filteredRows())).join(' · '), ...(ngDevMode ? [{ debugName: "_footerText" }] : []));
|
|
1610
|
+
_sortIcon(key) {
|
|
1611
|
+
if (this._sortKey() !== key || !this._sortDir())
|
|
1612
|
+
return 'pi pi-sort-alt';
|
|
1613
|
+
return this._sortDir() === 'asc' ? 'pi pi-sort-up' : 'pi pi-sort-down';
|
|
1614
|
+
}
|
|
1615
|
+
_toggleSort(key) {
|
|
1616
|
+
if (this._sortKey() === key) {
|
|
1617
|
+
if (this._sortDir() === 'asc')
|
|
1618
|
+
this._sortDir.set('desc');
|
|
1619
|
+
else if (this._sortDir() === 'desc') {
|
|
1620
|
+
this._sortDir.set('');
|
|
1621
|
+
this._sortKey.set('');
|
|
1622
|
+
}
|
|
1623
|
+
else
|
|
1624
|
+
this._sortDir.set('asc');
|
|
1625
|
+
}
|
|
1626
|
+
else {
|
|
1627
|
+
this._sortKey.set(key);
|
|
1628
|
+
this._sortDir.set('asc');
|
|
1629
|
+
}
|
|
1630
|
+
this.sortChange.emit({ key: this._sortKey(), direction: this._sortDir() });
|
|
1631
|
+
}
|
|
1632
|
+
_onSearch(value) { this._searchQuery.set(value ?? ''); }
|
|
1633
|
+
_setFilter(key, value) {
|
|
1634
|
+
this._filters.update(f => {
|
|
1635
|
+
if (!value) {
|
|
1636
|
+
const { [key]: _, ...rest } = f;
|
|
1637
|
+
return rest;
|
|
1638
|
+
}
|
|
1639
|
+
return { ...f, [key]: value };
|
|
1640
|
+
});
|
|
1641
|
+
}
|
|
1642
|
+
_colWidth(col) { return this._columnWidths()[col.key] || col.width || 'auto'; }
|
|
1643
|
+
_onResizeStart(event, key) {
|
|
1644
|
+
if (!this.resizable())
|
|
1645
|
+
return;
|
|
1646
|
+
const th = event.target.closest('th');
|
|
1647
|
+
if (!th)
|
|
1648
|
+
return;
|
|
1649
|
+
this._resizing = { key, startX: event.clientX, startWidth: th.offsetWidth };
|
|
1650
|
+
event.preventDefault();
|
|
1651
|
+
}
|
|
1652
|
+
_onDocMouseMove(event) {
|
|
1653
|
+
const r = this._resizing;
|
|
1654
|
+
if (!r)
|
|
1655
|
+
return;
|
|
1656
|
+
const diff = event.clientX - r.startX;
|
|
1657
|
+
this._columnWidths.update(w => ({ ...w, [r.key]: `${Math.max(50, r.startWidth + diff)}px` }));
|
|
1658
|
+
}
|
|
1659
|
+
_onDocMouseUp() { this._resizing = null; }
|
|
1660
|
+
_onDocClick(event) {
|
|
1661
|
+
const target = event.target;
|
|
1662
|
+
if (this._columnToggleOpen() && !target.closest('[data-col-toggle]')) {
|
|
1663
|
+
this._columnToggleOpen.set(false);
|
|
1664
|
+
}
|
|
1665
|
+
if (this._exportOpen() && !target.closest('[data-export-toggle]')) {
|
|
1666
|
+
this._exportOpen.set(false);
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
_goToPage(page) {
|
|
1670
|
+
const p = Math.max(1, Math.min(page, this._totalPages()));
|
|
1671
|
+
this._page.set(p);
|
|
1672
|
+
this.pageChange.emit(p);
|
|
1673
|
+
}
|
|
1674
|
+
_onPageSizeChange(val) {
|
|
1675
|
+
this._pageSize.set(parseInt(val ?? '10', 10));
|
|
1676
|
+
this._page.set(1);
|
|
1677
|
+
}
|
|
1678
|
+
_isSelected(row) {
|
|
1679
|
+
const key = this.selectionKey();
|
|
1680
|
+
if (!key)
|
|
1681
|
+
return false;
|
|
1682
|
+
const val = row[key];
|
|
1683
|
+
return val != null && this._selectedKeys().has(val);
|
|
1684
|
+
}
|
|
1685
|
+
_toggleSelect(row) {
|
|
1686
|
+
const key = this.selectionKey();
|
|
1687
|
+
const val = key ? row[key] : null;
|
|
1688
|
+
if (val == null)
|
|
1689
|
+
return;
|
|
1690
|
+
this._selectedKeys.update(s => {
|
|
1691
|
+
const next = new Set(s);
|
|
1692
|
+
if (this.selectionMode() === 'single')
|
|
1693
|
+
next.clear();
|
|
1694
|
+
if (next.has(val))
|
|
1695
|
+
next.delete(val);
|
|
1696
|
+
else
|
|
1697
|
+
next.add(val);
|
|
1698
|
+
return next;
|
|
1699
|
+
});
|
|
1700
|
+
this._emitSelection();
|
|
1701
|
+
}
|
|
1702
|
+
_isAllSelected() {
|
|
1703
|
+
const rows = this._displayRows();
|
|
1704
|
+
const key = this.selectionKey();
|
|
1705
|
+
if (rows.length === 0 || !key)
|
|
1706
|
+
return false;
|
|
1707
|
+
return rows.every(row => { const val = row[key]; return val != null && this._selectedKeys().has(val); });
|
|
1708
|
+
}
|
|
1709
|
+
_toggleSelectAll() {
|
|
1710
|
+
const key = this.selectionKey();
|
|
1711
|
+
if (!key)
|
|
1712
|
+
return;
|
|
1713
|
+
if (this._isAllSelected()) {
|
|
1714
|
+
this._selectedKeys.set(new Set());
|
|
1715
|
+
}
|
|
1716
|
+
else {
|
|
1717
|
+
const keys = new Set();
|
|
1718
|
+
for (const row of this._displayRows()) {
|
|
1719
|
+
const val = row[key];
|
|
1720
|
+
if (val != null)
|
|
1721
|
+
keys.add(val);
|
|
1722
|
+
}
|
|
1723
|
+
this._selectedKeys.set(keys);
|
|
1724
|
+
}
|
|
1725
|
+
this._emitSelection();
|
|
1726
|
+
}
|
|
1727
|
+
_emitSelection() {
|
|
1728
|
+
const selected = this._selectedKeys();
|
|
1729
|
+
const key = this.selectionKey();
|
|
1730
|
+
if (!key) {
|
|
1731
|
+
this.selectedRows.emit([]);
|
|
1732
|
+
return;
|
|
1733
|
+
}
|
|
1734
|
+
this.selectedRows.emit(this.rows().filter(row => { const val = row[key]; return val != null && selected.has(val); }));
|
|
1735
|
+
}
|
|
1736
|
+
_isColumnVisible(k) { return !this._hiddenColumns().has(k); }
|
|
1737
|
+
_toggleColumn(k) { this._hiddenColumns.update(h => { const n = new Set(h); if (n.has(k))
|
|
1738
|
+
n.delete(k);
|
|
1739
|
+
else
|
|
1740
|
+
n.add(k); return n; }); }
|
|
1741
|
+
_isExpanded(index) { return this._expandedKeys().has(index); }
|
|
1742
|
+
_toggleExpand(index) { this._expandedKeys.update(s => { const n = new Set(s); if (n.has(index))
|
|
1743
|
+
n.delete(index);
|
|
1744
|
+
else
|
|
1745
|
+
n.add(index); return n; }); }
|
|
1746
|
+
_cellText(row, col) {
|
|
1747
|
+
return col.cell ? col.cell(row) : String(row[col.key] ?? '');
|
|
1748
|
+
}
|
|
1749
|
+
_cellLabel(row, col) {
|
|
1750
|
+
const text = this._cellText(row, col);
|
|
1751
|
+
if (col.maxChars && text.length > col.maxChars)
|
|
1752
|
+
return text.slice(0, col.maxChars) + '…';
|
|
1753
|
+
return text;
|
|
1754
|
+
}
|
|
1755
|
+
async _exportExcel() {
|
|
1756
|
+
const ExcelJS = (await import('exceljs')).default;
|
|
1757
|
+
const workbook = new ExcelJS.Workbook();
|
|
1758
|
+
const worksheet = workbook.addWorksheet('Sheet1');
|
|
1759
|
+
const cols = this._displayColumns();
|
|
1760
|
+
const rows = this._filteredRows();
|
|
1761
|
+
const headerRow = worksheet.addRow(cols.map(c => c.header));
|
|
1762
|
+
headerRow.font = { bold: true, color: { argb: 'FFFFFFFF' } };
|
|
1763
|
+
headerRow.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FF0D4B7C' } };
|
|
1764
|
+
headerRow.alignment = { horizontal: 'center' };
|
|
1765
|
+
for (const row of rows) {
|
|
1766
|
+
worksheet.addRow(cols.map(c => this._cellText(row, c)));
|
|
1767
|
+
}
|
|
1768
|
+
cols.forEach((_, i) => { worksheet.getColumn(i + 1).width = 22; });
|
|
1769
|
+
const buffer = await workbook.xlsx.writeBuffer();
|
|
1770
|
+
const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
1771
|
+
const url = URL.createObjectURL(blob);
|
|
1772
|
+
const a = document.createElement('a');
|
|
1773
|
+
a.href = url;
|
|
1774
|
+
a.download = `export-${new Date().toISOString().slice(0, 10)}.xlsx`;
|
|
1775
|
+
a.click();
|
|
1776
|
+
setTimeout(() => URL.revokeObjectURL(url), 2000);
|
|
1777
|
+
}
|
|
1778
|
+
async _exportPdf() {
|
|
1779
|
+
const { default: jsPDF } = await import('jspdf');
|
|
1780
|
+
const doc = new jsPDF({ orientation: 'landscape', unit: 'pt' });
|
|
1781
|
+
const cols = this._displayColumns();
|
|
1782
|
+
const rows = this._filteredRows();
|
|
1783
|
+
const pageW = doc.internal.pageSize.getWidth();
|
|
1784
|
+
const margin = 30;
|
|
1785
|
+
const rh = 18;
|
|
1786
|
+
const colW = (pageW - margin * 2) / cols.length;
|
|
1787
|
+
const maxY = doc.internal.pageSize.getHeight() - margin;
|
|
1788
|
+
let y = margin;
|
|
1789
|
+
const drawHeader = () => {
|
|
1790
|
+
doc.setFillColor(13, 75, 124);
|
|
1791
|
+
doc.rect(margin, y, pageW - margin * 2, rh, 'F');
|
|
1792
|
+
doc.setTextColor(255, 255, 255);
|
|
1793
|
+
doc.setFontSize(9);
|
|
1794
|
+
doc.setFont('Helvetica', 'bold');
|
|
1795
|
+
cols.forEach((c, i) => {
|
|
1796
|
+
doc.text(c.header, margin + i * colW + 3, y + 12);
|
|
1797
|
+
});
|
|
1798
|
+
y += rh;
|
|
1799
|
+
};
|
|
1800
|
+
drawHeader();
|
|
1801
|
+
for (const row of rows) {
|
|
1802
|
+
if (y + rh > maxY) {
|
|
1803
|
+
doc.addPage();
|
|
1804
|
+
y = margin;
|
|
1805
|
+
drawHeader();
|
|
1806
|
+
}
|
|
1807
|
+
if ((rows.indexOf(row) + 1) % 2 === 0) {
|
|
1808
|
+
doc.setFillColor(247, 248, 250);
|
|
1809
|
+
doc.rect(margin, y, pageW - margin * 2, rh, 'F');
|
|
1810
|
+
}
|
|
1811
|
+
doc.setFont('Helvetica', 'normal');
|
|
1812
|
+
doc.setFontSize(8);
|
|
1813
|
+
doc.setTextColor(50, 50, 50);
|
|
1814
|
+
cols.forEach((c, ci) => {
|
|
1815
|
+
doc.text(this._cellText(row, c), margin + ci * colW + 3, y + 12);
|
|
1816
|
+
});
|
|
1817
|
+
doc.setDrawColor(220, 220, 220);
|
|
1818
|
+
doc.line(margin, y, pageW - margin, y);
|
|
1819
|
+
y += rh;
|
|
1820
|
+
}
|
|
1821
|
+
doc.save(`export-${new Date().toISOString().slice(0, 10)}.pdf`);
|
|
1822
|
+
}
|
|
1823
|
+
_trackByIndex(index) { return index; }
|
|
1824
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1825
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: TableComponent, isStandalone: true, selector: "app-table", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, striped: { classPropertyName: "striped", publicName: "striped", isSignal: true, isRequired: false, transformFunction: null }, hoverable: { classPropertyName: "hoverable", publicName: "hoverable", isSignal: true, isRequired: false, transformFunction: null }, sortable: { classPropertyName: "sortable", publicName: "sortable", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null }, skeletonRows: { classPropertyName: "skeletonRows", publicName: "skeletonRows", isSignal: true, isRequired: false, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, pageable: { classPropertyName: "pageable", publicName: "pageable", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizeOptions: { classPropertyName: "pageSizeOptions", publicName: "pageSizeOptions", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, selectionKey: { classPropertyName: "selectionKey", publicName: "selectionKey", isSignal: true, isRequired: false, transformFunction: null }, stickyHeader: { classPropertyName: "stickyHeader", publicName: "stickyHeader", isSignal: true, isRequired: false, transformFunction: null }, exportable: { classPropertyName: "exportable", publicName: "exportable", isSignal: true, isRequired: false, transformFunction: null }, columnToggle: { classPropertyName: "columnToggle", publicName: "columnToggle", isSignal: true, isRequired: false, transformFunction: null }, expandable: { classPropertyName: "expandable", publicName: "expandable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sortChange: "sortChange", pageChange: "pageChange", selectedRows: "selectedRows" }, host: { listeners: { "document:mousemove": "_onDocMouseMove($event)", "document:mouseup": "_onDocMouseUp()", "document:click": "_onDocClick($event)" } }, queries: [{ propertyName: "rowDetail", first: true, predicate: ["rowDetail"], descendants: true, read: TemplateRef }], ngImport: i0, template: "@if (loading()) {\n <app-table-skeleton [rows]=\"skeletonRows()\" [columns]=\"_skeletonCols()\" />\n} @else {\n <div class=\"overflow-x-auto relative rounded-md\"\n [style.width]=\"width() || '100%'\"\n [style.border]=\"'1px solid var(--color-border-light,oklch(0.91 0.01 260))'\"\n >\n <table class=\"w-full border-collapse\" style=\"table-layout:fixed\">\n <thead\n [style.position]=\"stickyHeader() ? 'sticky' : undefined\"\n [style.top]=\"stickyHeader() ? '0' : undefined\"\n [style.z-index]=\"stickyHeader() ? '2' : undefined\"\n >\n <tr>\n @if (selectable()) {\n <th class=\"relative px-3 py-2.5 text-xs whitespace-nowrap text-center\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.color]=\"'var(--color-primary-inverse,oklch(0.99 0 0))'\"\n style=\"width:40px\"\n >\n <input type=\"checkbox\"\n [checked]=\"_isAllSelected()\"\n (change)=\"_toggleSelectAll()\"\n class=\"cursor-pointer\"\n />\n </th>\n }\n @if (expandable()) {\n <th class=\"relative px-3 py-2.5 text-xs whitespace-nowrap text-center\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.color]=\"'var(--color-primary-inverse,oklch(0.99 0 0))'\"\n style=\"width:40px\"\n ></th>\n }\n @for (col of _displayColumns(); track col.key) {\n <th\n class=\"group relative px-3 py-2.5 text-xs font-semibold uppercase tracking-wider whitespace-nowrap\"\n [style.text-align]=\"col.align || 'left'\"\n [style.width]=\"_colWidth(col)\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.color]=\"'var(--color-primary-inverse,oklch(0.99 0 0))'\"\n [class.cursor-pointer]=\"col.sortable && sortable()\"\n [class.select-none]=\"col.sortable && sortable()\"\n (click)=\"sortable() && col.sortable && _toggleSort(col.key)\"\n >\n {{ col.header }}\n @if (col.sortable && sortable()) {\n <i class=\"pi ml-1.5 text-[10px] align-middle\" [class]=\"_sortIcon(col.key)\"></i>\n }\n @if (resizable()) {\n <div\n class=\"absolute right-0 top-0 bottom-0 w-2 cursor-col-resize z-10 transition-opacity duration-150 opacity-30 hover:opacity-100 group-hover:opacity-80\"\n [style.background]=\"'linear-gradient(90deg,transparent 33%,var(--color-accent,oklch(0.64 0.2 50)) 33%,var(--color-accent,oklch(0.64 0.2 50)) 66%,transparent 66%)'\"\n [style.background-size]=\"'100% 40%'\"\n [style.background-repeat]=\"'no-repeat'\"\n [style.background-position]=\"'center'\"\n (mousedown)=\"_onResizeStart($event,col.key)\"\n ></div>\n }\n </th>\n }\n </tr>\n @if (searchable() || _filterCols().length || exportable()) {\n <tr>\n <td [attr.colspan]=\"_colCount()\"\n [style.background-color]=\"'var(--color-surface-alt,oklch(0.975 0.005 260))'\"\n [style.border-bottom]=\"'1px solid var(--color-border-light,oklch(0.91 0.01 260))'\"\n [style.padding]=\"'8px 12px'\"\n [style.vertical-align]=\"'middle'\"\n >\n <div class=\"flex items-center flex-wrap gap-1.5\">\n @if (searchable()) {\n <app-search-input\n (valueChange)=\"_onSearch($event)\"\n placeholder=\"Search table...\"\n size=\"sm\"\n style=\"padding-bottom:0\"\n />\n }\n @for (col of _filterCols(); track col.key) {\n <app-drop-down\n [options]=\"col.filterOptions ?? []\"\n [placeholder]=\"'Filter ' + col.header\"\n size=\"sm\"\n [searchable]=\"true\"\n [config]=\"{ appendToParent: true }\"\n style=\"padding-bottom:0\"\n (valueChange)=\"_setFilter(col.key, $event)\"\n />\n }\n @if (columnToggle()) {\n <div data-col-toggle class=\"relative ml-auto\">\n <button\n type=\"button\"\n (click)=\"_columnToggleOpen.set(!_columnToggleOpen())\"\n class=\"inline-flex items-center gap-1 px-2 py-1 text-xs rounded-md border cursor-pointer transition-colors hover:opacity-80\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n [style.background-color]=\"'transparent'\"\n [style.color]=\"'var(--color-text,oklch(0.14 0.01 260))'\"\n ><i class=\"pi pi-list text-[10px]\"></i> Columns</button>\n @if (_columnToggleOpen()) {\n <div\n class=\"absolute top-full right-0 mt-1 min-w-[140px] p-1.5 rounded-md shadow-lg z-50 border\"\n [style.background-color]=\"'var(--color-surface,oklch(0.99 0 0))'\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n >\n @for (col of columns(); track col.key) {\n <label\n class=\"flex items-center gap-2 px-2 py-1.5 text-xs rounded cursor-pointer whitespace-nowrap transition-colors\"\n [style.color]=\"'var(--color-text,oklch(0.14 0.01 260))'\"\n >\n <input type=\"checkbox\"\n [checked]=\"_isColumnVisible(col.key)\"\n (change)=\"_toggleColumn(col.key)\"\n />\n {{ col.header }}\n </label>\n }\n </div>\n }\n </div>\n }\n @if (exportable()) {\n <div data-export-toggle class=\"relative\">\n <button\n type=\"button\"\n (click)=\"_exportOpen.set(!_exportOpen())\"\n class=\"inline-flex items-center gap-1 px-2 py-1 text-xs rounded-md border cursor-pointer transition-colors hover:opacity-80\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n [style.background-color]=\"'transparent'\"\n [style.color]=\"'var(--color-text,oklch(0.14 0.01 260))'\"\n ><i class=\"pi pi-download text-[10px]\"></i> Export</button>\n @if (_exportOpen()) {\n <div\n class=\"absolute top-full left-0 mt-1 min-w-[100px] p-1 rounded-md shadow-lg z-50 border\"\n [style.background-color]=\"'var(--color-surface,oklch(0.99 0 0))'\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n >\n @for (fmt of ['Excel', 'PDF']; track fmt) {\n <button\n type=\"button\"\n (click)=\"fmt === 'Excel' ? _exportExcel() : _exportPdf(); _exportOpen.set(false)\"\n class=\"export-opt block w-full text-left px-2 py-1.5 text-xs rounded cursor-pointer border-none transition-colors\"\n [style.color]=\"'var(--color-text,oklch(0.14 0.01 260))'\"\n [style.background-color]=\"'transparent'\"\n >{{ fmt }}</button>\n }\n </div>\n }\n </div>\n }\n </div>\n </td>\n </tr>\n }\n </thead>\n <tbody>\n @if (_displayRows().length === 0) {\n <tr>\n <td [attr.colspan]=\"_colCount()\"\n class=\"px-3 py-8 text-center text-sm text-[var(--color-text-muted,oklch(0.48 0.01 260))]\"\n >{{ emptyMessage() }}</td>\n </tr>\n } @else {\n @for (row of _displayRows(); track _trackByIndex($index); let rowIndex = $index) {\n <tr\n class=\"border-b border-[var(--color-border-light,oklch(0.91 0.01 260))] transition-colors\"\n [class.hover:bg-[var(--color-surface-alt,oklch(0.975 0.005 260))]]=\"hoverable()\"\n [style.background-color]=\"selectable() && _isSelected(row) ? 'color-mix(in srgb,var(--color-primary,oklch(0.32 0.09 258)) 8%,transparent)' : striped() && rowIndex % 2 === 1 ? 'var(--color-surface-alt,oklch(0.975 0.005 260))' : 'transparent'\"\n >\n @if (selectable()) {\n <td class=\"px-3 py-2.5 text-center\">\n <input type=\"checkbox\"\n [checked]=\"_isSelected(row)\"\n (change)=\"_toggleSelect(row)\"\n class=\"cursor-pointer\"\n />\n </td>\n }\n @if (expandable()) {\n <td class=\"px-3 py-2.5 text-center\">\n <button\n type=\"button\"\n (click)=\"_toggleExpand(rowIndex)\"\n class=\"inline-flex items-center justify-center w-6 h-6 border-none bg-transparent cursor-pointer rounded transition-colors hover:bg-[var(--color-surface-alt,oklch(0.975 0.005 260))]\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n >\n <i class=\"pi text-[10px]\" [class.pi-chevron-down]=\"_isExpanded(rowIndex)\" [class.pi-chevron-right]=\"!_isExpanded(rowIndex)\"></i>\n </button>\n </td>\n }\n @for (col of _displayColumns(); track col.key; let colIndex = $index) {\n @let meta = _rowMeta()[rowIndex][colIndex];\n @if (meta.visible) {\n <td\n [attr.rowspan]=\"meta.rowspan > 1 ? meta.rowspan : null\"\n [style.text-align]=\"col.align || 'left'\"\n class=\"px-3 py-2.5 text-sm text-[var(--color-text,oklch(0.14 0.01 260))]\"\n >\n @if (col.actions) {\n <div class=\"flex items-center gap-1\">\n @for (action of col.actions; track $index) {\n @if (!action.visible || action.visible(row)) {\n <button\n type=\"button\"\n class=\"inline-flex items-center justify-center gap-1 px-2 py-1 text-xs rounded-md border-none cursor-pointer transition-opacity disabled:cursor-not-allowed\"\n [style.background-color]=\"'transparent'\"\n [style.color]=\"action.accentColor ? 'var(--color-' + action.accentColor + ',oklch(0.32 0.09 258))' : 'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n [style.opacity]=\"action.disabled?.(row) ? '0.5' : '1'\"\n [disabled]=\"action.disabled?.(row) ?? false\"\n (click)=\"action.click(row)\"\n [title]=\"action.label || ''\"\n >\n @if (action.icon) { <i [class]=\"action.icon\" class=\"text-xs\"></i> }\n @if (action.label) { <span>{{ action.label }}</span> }\n </button>\n }\n }\n </div>\n } @else {\n @if (col.truncate) {\n <app-tooltip position=\"top\" [text]=\"_cellText(row, col)\">\n {{ _cellLabel(row, col) }}\n </app-tooltip>\n } @else {\n {{ _cellLabel(row, col) }}\n }\n }\n </td>\n }\n }\n </tr>\n @if (expandable() && _isExpanded(rowIndex)) {\n <tr class=\"border-b border-[var(--color-border-light,oklch(0.91 0.01 260))]\">\n <td [attr.colspan]=\"_colCount()\" class=\"p-0\">\n <div [style.background-color]=\"'var(--color-surface-alt,oklch(0.975 0.005 260))'\">\n @if (rowDetail) {\n <ng-container *ngTemplateOutlet=\"rowDetail; context: { $implicit: row }\" />\n } @else {\n <div class=\"p-3 text-sm text-[var(--color-text-muted,oklch(0.48 0.01 260))]\">No detail template</div>\n }\n </div>\n </td>\n </tr>\n }\n }\n @if (_footerCols().length) {\n <tr class=\"border-t-2 font-medium\"\n [style.border-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.background-color]=\"'var(--color-surface-alt,oklch(0.975 0.005 260))'\"\n >\n <td [attr.colspan]=\"_colCount()\" class=\"px-3 py-2.5 text-sm\"\n [style.color]=\"'var(--color-text,oklch(0.14 0.01 260))'\"\n >{{ _footerText() }}</td>\n </tr>\n }\n }\n </tbody>\n </table>\n @if (pageable() && _totalPages() > 1) {\n <div class=\"flex items-center justify-between px-3 py-2 border-t border-[var(--color-border-light,oklch(0.91 0.01 260))]\"\n [style.background-color]=\"'var(--color-surface,oklch(0.99 0 0))'\"\n >\n <div class=\"flex items-center gap-2 text-xs text-[var(--color-text-muted,oklch(0.48 0.01 260))]\">\n <span>{{ _pageInfo().from }}\u2013{{ _pageInfo().to }} of {{ _pageInfo().total }}</span>\n <app-drop-down\n [options]=\"_pageSizeOptions()\"\n [value]=\"'' + _pageSize()\"\n size=\"sm\"\n [config]=\"{ direction: 'up' }\"\n style=\"padding-bottom:0\"\n (valueChange)=\"_onPageSizeChange($event)\"\n />\n </div>\n <div class=\"flex items-center gap-0.5\">\n <button type=\"button\" (click)=\"_goToPage(1)\" [disabled]=\"_page() === 1\"\n class=\"inline-flex items-center justify-center w-7 h-7 text-xs rounded border-none cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-colors\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\" [style.background-color]=\"'transparent'\"\n ><i class=\"pi pi-angle-double-left text-[10px]\"></i></button>\n <button type=\"button\" (click)=\"_goToPage(_page() - 1)\" [disabled]=\"_page() === 1\"\n class=\"inline-flex items-center justify-center w-7 h-7 text-xs rounded border-none cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-colors\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\" [style.background-color]=\"'transparent'\"\n ><i class=\"pi pi-angle-left text-[10px]\"></i></button>\n @for (p of _visiblePages(); track p) {\n <button type=\"button\" (click)=\"_goToPage(p)\"\n class=\"inline-flex items-center justify-center w-7 h-7 text-xs rounded border-none cursor-pointer transition-colors font-medium\"\n [style.background-color]=\"p === _page() ? 'var(--color-primary,oklch(0.32 0.09 258))' : 'transparent'\"\n [style.color]=\"p === _page() ? 'var(--color-primary-inverse,oklch(0.99 0 0))' : 'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n >{{ p }}</button>\n }\n <button type=\"button\" (click)=\"_goToPage(_page() + 1)\" [disabled]=\"_page() === _totalPages()\"\n class=\"inline-flex items-center justify-center w-7 h-7 text-xs rounded border-none cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-colors\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\" [style.background-color]=\"'transparent'\"\n ><i class=\"pi pi-angle-right text-[10px]\"></i></button>\n <button type=\"button\" (click)=\"_goToPage(_totalPages())\" [disabled]=\"_page() === _totalPages()\"\n class=\"inline-flex items-center justify-center w-7 h-7 text-xs rounded border-none cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-colors\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\" [style.background-color]=\"'transparent'\"\n ><i class=\"pi pi-angle-double-right text-[10px]\"></i></button>\n </div>\n </div>\n }\n </div>\n}\n", styles: [":host{display:contents}[data-col-toggle] label:hover,[data-export-toggle] .export-opt:hover{background-color:var(--color-surface-alt, oklch(.975 .005 260))}\n"], dependencies: [{ kind: "component", type: SearchInputComponent, selector: "app-search-input", inputs: ["value", "placeholder", "size", "disabled", "accentColor", "hint", "errorMessage", "error", "width"], outputs: ["valueChange"] }, { kind: "component", type: DropDownComponent, selector: "app-drop-down", inputs: ["value", "options", "placeholder", "size", "disabled", "accentColor", "searchable", "hint", "errorMessage", "error", "width", "config"], outputs: ["valueChange"] }, { kind: "component", type: TableSkeletonComponent, selector: "app-table-skeleton", inputs: ["rows", "columns"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TooltipComponent, selector: "app-tooltip", inputs: ["text", "position", "disabled", "alwaysShow"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1826
|
+
}
|
|
1827
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TableComponent, decorators: [{
|
|
1828
|
+
type: Component,
|
|
1829
|
+
args: [{ selector: 'app-table', imports: [SearchInputComponent, DropDownComponent, TableSkeletonComponent, NgTemplateOutlet, TooltipComponent], host: {
|
|
1830
|
+
'(document:mousemove)': '_onDocMouseMove($event)',
|
|
1831
|
+
'(document:mouseup)': '_onDocMouseUp()',
|
|
1832
|
+
'(document:click)': '_onDocClick($event)',
|
|
1833
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (loading()) {\n <app-table-skeleton [rows]=\"skeletonRows()\" [columns]=\"_skeletonCols()\" />\n} @else {\n <div class=\"overflow-x-auto relative rounded-md\"\n [style.width]=\"width() || '100%'\"\n [style.border]=\"'1px solid var(--color-border-light,oklch(0.91 0.01 260))'\"\n >\n <table class=\"w-full border-collapse\" style=\"table-layout:fixed\">\n <thead\n [style.position]=\"stickyHeader() ? 'sticky' : undefined\"\n [style.top]=\"stickyHeader() ? '0' : undefined\"\n [style.z-index]=\"stickyHeader() ? '2' : undefined\"\n >\n <tr>\n @if (selectable()) {\n <th class=\"relative px-3 py-2.5 text-xs whitespace-nowrap text-center\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.color]=\"'var(--color-primary-inverse,oklch(0.99 0 0))'\"\n style=\"width:40px\"\n >\n <input type=\"checkbox\"\n [checked]=\"_isAllSelected()\"\n (change)=\"_toggleSelectAll()\"\n class=\"cursor-pointer\"\n />\n </th>\n }\n @if (expandable()) {\n <th class=\"relative px-3 py-2.5 text-xs whitespace-nowrap text-center\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.color]=\"'var(--color-primary-inverse,oklch(0.99 0 0))'\"\n style=\"width:40px\"\n ></th>\n }\n @for (col of _displayColumns(); track col.key) {\n <th\n class=\"group relative px-3 py-2.5 text-xs font-semibold uppercase tracking-wider whitespace-nowrap\"\n [style.text-align]=\"col.align || 'left'\"\n [style.width]=\"_colWidth(col)\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.color]=\"'var(--color-primary-inverse,oklch(0.99 0 0))'\"\n [class.cursor-pointer]=\"col.sortable && sortable()\"\n [class.select-none]=\"col.sortable && sortable()\"\n (click)=\"sortable() && col.sortable && _toggleSort(col.key)\"\n >\n {{ col.header }}\n @if (col.sortable && sortable()) {\n <i class=\"pi ml-1.5 text-[10px] align-middle\" [class]=\"_sortIcon(col.key)\"></i>\n }\n @if (resizable()) {\n <div\n class=\"absolute right-0 top-0 bottom-0 w-2 cursor-col-resize z-10 transition-opacity duration-150 opacity-30 hover:opacity-100 group-hover:opacity-80\"\n [style.background]=\"'linear-gradient(90deg,transparent 33%,var(--color-accent,oklch(0.64 0.2 50)) 33%,var(--color-accent,oklch(0.64 0.2 50)) 66%,transparent 66%)'\"\n [style.background-size]=\"'100% 40%'\"\n [style.background-repeat]=\"'no-repeat'\"\n [style.background-position]=\"'center'\"\n (mousedown)=\"_onResizeStart($event,col.key)\"\n ></div>\n }\n </th>\n }\n </tr>\n @if (searchable() || _filterCols().length || exportable()) {\n <tr>\n <td [attr.colspan]=\"_colCount()\"\n [style.background-color]=\"'var(--color-surface-alt,oklch(0.975 0.005 260))'\"\n [style.border-bottom]=\"'1px solid var(--color-border-light,oklch(0.91 0.01 260))'\"\n [style.padding]=\"'8px 12px'\"\n [style.vertical-align]=\"'middle'\"\n >\n <div class=\"flex items-center flex-wrap gap-1.5\">\n @if (searchable()) {\n <app-search-input\n (valueChange)=\"_onSearch($event)\"\n placeholder=\"Search table...\"\n size=\"sm\"\n style=\"padding-bottom:0\"\n />\n }\n @for (col of _filterCols(); track col.key) {\n <app-drop-down\n [options]=\"col.filterOptions ?? []\"\n [placeholder]=\"'Filter ' + col.header\"\n size=\"sm\"\n [searchable]=\"true\"\n [config]=\"{ appendToParent: true }\"\n style=\"padding-bottom:0\"\n (valueChange)=\"_setFilter(col.key, $event)\"\n />\n }\n @if (columnToggle()) {\n <div data-col-toggle class=\"relative ml-auto\">\n <button\n type=\"button\"\n (click)=\"_columnToggleOpen.set(!_columnToggleOpen())\"\n class=\"inline-flex items-center gap-1 px-2 py-1 text-xs rounded-md border cursor-pointer transition-colors hover:opacity-80\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n [style.background-color]=\"'transparent'\"\n [style.color]=\"'var(--color-text,oklch(0.14 0.01 260))'\"\n ><i class=\"pi pi-list text-[10px]\"></i> Columns</button>\n @if (_columnToggleOpen()) {\n <div\n class=\"absolute top-full right-0 mt-1 min-w-[140px] p-1.5 rounded-md shadow-lg z-50 border\"\n [style.background-color]=\"'var(--color-surface,oklch(0.99 0 0))'\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n >\n @for (col of columns(); track col.key) {\n <label\n class=\"flex items-center gap-2 px-2 py-1.5 text-xs rounded cursor-pointer whitespace-nowrap transition-colors\"\n [style.color]=\"'var(--color-text,oklch(0.14 0.01 260))'\"\n >\n <input type=\"checkbox\"\n [checked]=\"_isColumnVisible(col.key)\"\n (change)=\"_toggleColumn(col.key)\"\n />\n {{ col.header }}\n </label>\n }\n </div>\n }\n </div>\n }\n @if (exportable()) {\n <div data-export-toggle class=\"relative\">\n <button\n type=\"button\"\n (click)=\"_exportOpen.set(!_exportOpen())\"\n class=\"inline-flex items-center gap-1 px-2 py-1 text-xs rounded-md border cursor-pointer transition-colors hover:opacity-80\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n [style.background-color]=\"'transparent'\"\n [style.color]=\"'var(--color-text,oklch(0.14 0.01 260))'\"\n ><i class=\"pi pi-download text-[10px]\"></i> Export</button>\n @if (_exportOpen()) {\n <div\n class=\"absolute top-full left-0 mt-1 min-w-[100px] p-1 rounded-md shadow-lg z-50 border\"\n [style.background-color]=\"'var(--color-surface,oklch(0.99 0 0))'\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n >\n @for (fmt of ['Excel', 'PDF']; track fmt) {\n <button\n type=\"button\"\n (click)=\"fmt === 'Excel' ? _exportExcel() : _exportPdf(); _exportOpen.set(false)\"\n class=\"export-opt block w-full text-left px-2 py-1.5 text-xs rounded cursor-pointer border-none transition-colors\"\n [style.color]=\"'var(--color-text,oklch(0.14 0.01 260))'\"\n [style.background-color]=\"'transparent'\"\n >{{ fmt }}</button>\n }\n </div>\n }\n </div>\n }\n </div>\n </td>\n </tr>\n }\n </thead>\n <tbody>\n @if (_displayRows().length === 0) {\n <tr>\n <td [attr.colspan]=\"_colCount()\"\n class=\"px-3 py-8 text-center text-sm text-[var(--color-text-muted,oklch(0.48 0.01 260))]\"\n >{{ emptyMessage() }}</td>\n </tr>\n } @else {\n @for (row of _displayRows(); track _trackByIndex($index); let rowIndex = $index) {\n <tr\n class=\"border-b border-[var(--color-border-light,oklch(0.91 0.01 260))] transition-colors\"\n [class.hover:bg-[var(--color-surface-alt,oklch(0.975 0.005 260))]]=\"hoverable()\"\n [style.background-color]=\"selectable() && _isSelected(row) ? 'color-mix(in srgb,var(--color-primary,oklch(0.32 0.09 258)) 8%,transparent)' : striped() && rowIndex % 2 === 1 ? 'var(--color-surface-alt,oklch(0.975 0.005 260))' : 'transparent'\"\n >\n @if (selectable()) {\n <td class=\"px-3 py-2.5 text-center\">\n <input type=\"checkbox\"\n [checked]=\"_isSelected(row)\"\n (change)=\"_toggleSelect(row)\"\n class=\"cursor-pointer\"\n />\n </td>\n }\n @if (expandable()) {\n <td class=\"px-3 py-2.5 text-center\">\n <button\n type=\"button\"\n (click)=\"_toggleExpand(rowIndex)\"\n class=\"inline-flex items-center justify-center w-6 h-6 border-none bg-transparent cursor-pointer rounded transition-colors hover:bg-[var(--color-surface-alt,oklch(0.975 0.005 260))]\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n >\n <i class=\"pi text-[10px]\" [class.pi-chevron-down]=\"_isExpanded(rowIndex)\" [class.pi-chevron-right]=\"!_isExpanded(rowIndex)\"></i>\n </button>\n </td>\n }\n @for (col of _displayColumns(); track col.key; let colIndex = $index) {\n @let meta = _rowMeta()[rowIndex][colIndex];\n @if (meta.visible) {\n <td\n [attr.rowspan]=\"meta.rowspan > 1 ? meta.rowspan : null\"\n [style.text-align]=\"col.align || 'left'\"\n class=\"px-3 py-2.5 text-sm text-[var(--color-text,oklch(0.14 0.01 260))]\"\n >\n @if (col.actions) {\n <div class=\"flex items-center gap-1\">\n @for (action of col.actions; track $index) {\n @if (!action.visible || action.visible(row)) {\n <button\n type=\"button\"\n class=\"inline-flex items-center justify-center gap-1 px-2 py-1 text-xs rounded-md border-none cursor-pointer transition-opacity disabled:cursor-not-allowed\"\n [style.background-color]=\"'transparent'\"\n [style.color]=\"action.accentColor ? 'var(--color-' + action.accentColor + ',oklch(0.32 0.09 258))' : 'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n [style.opacity]=\"action.disabled?.(row) ? '0.5' : '1'\"\n [disabled]=\"action.disabled?.(row) ?? false\"\n (click)=\"action.click(row)\"\n [title]=\"action.label || ''\"\n >\n @if (action.icon) { <i [class]=\"action.icon\" class=\"text-xs\"></i> }\n @if (action.label) { <span>{{ action.label }}</span> }\n </button>\n }\n }\n </div>\n } @else {\n @if (col.truncate) {\n <app-tooltip position=\"top\" [text]=\"_cellText(row, col)\">\n {{ _cellLabel(row, col) }}\n </app-tooltip>\n } @else {\n {{ _cellLabel(row, col) }}\n }\n }\n </td>\n }\n }\n </tr>\n @if (expandable() && _isExpanded(rowIndex)) {\n <tr class=\"border-b border-[var(--color-border-light,oklch(0.91 0.01 260))]\">\n <td [attr.colspan]=\"_colCount()\" class=\"p-0\">\n <div [style.background-color]=\"'var(--color-surface-alt,oklch(0.975 0.005 260))'\">\n @if (rowDetail) {\n <ng-container *ngTemplateOutlet=\"rowDetail; context: { $implicit: row }\" />\n } @else {\n <div class=\"p-3 text-sm text-[var(--color-text-muted,oklch(0.48 0.01 260))]\">No detail template</div>\n }\n </div>\n </td>\n </tr>\n }\n }\n @if (_footerCols().length) {\n <tr class=\"border-t-2 font-medium\"\n [style.border-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.background-color]=\"'var(--color-surface-alt,oklch(0.975 0.005 260))'\"\n >\n <td [attr.colspan]=\"_colCount()\" class=\"px-3 py-2.5 text-sm\"\n [style.color]=\"'var(--color-text,oklch(0.14 0.01 260))'\"\n >{{ _footerText() }}</td>\n </tr>\n }\n }\n </tbody>\n </table>\n @if (pageable() && _totalPages() > 1) {\n <div class=\"flex items-center justify-between px-3 py-2 border-t border-[var(--color-border-light,oklch(0.91 0.01 260))]\"\n [style.background-color]=\"'var(--color-surface,oklch(0.99 0 0))'\"\n >\n <div class=\"flex items-center gap-2 text-xs text-[var(--color-text-muted,oklch(0.48 0.01 260))]\">\n <span>{{ _pageInfo().from }}\u2013{{ _pageInfo().to }} of {{ _pageInfo().total }}</span>\n <app-drop-down\n [options]=\"_pageSizeOptions()\"\n [value]=\"'' + _pageSize()\"\n size=\"sm\"\n [config]=\"{ direction: 'up' }\"\n style=\"padding-bottom:0\"\n (valueChange)=\"_onPageSizeChange($event)\"\n />\n </div>\n <div class=\"flex items-center gap-0.5\">\n <button type=\"button\" (click)=\"_goToPage(1)\" [disabled]=\"_page() === 1\"\n class=\"inline-flex items-center justify-center w-7 h-7 text-xs rounded border-none cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-colors\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\" [style.background-color]=\"'transparent'\"\n ><i class=\"pi pi-angle-double-left text-[10px]\"></i></button>\n <button type=\"button\" (click)=\"_goToPage(_page() - 1)\" [disabled]=\"_page() === 1\"\n class=\"inline-flex items-center justify-center w-7 h-7 text-xs rounded border-none cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-colors\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\" [style.background-color]=\"'transparent'\"\n ><i class=\"pi pi-angle-left text-[10px]\"></i></button>\n @for (p of _visiblePages(); track p) {\n <button type=\"button\" (click)=\"_goToPage(p)\"\n class=\"inline-flex items-center justify-center w-7 h-7 text-xs rounded border-none cursor-pointer transition-colors font-medium\"\n [style.background-color]=\"p === _page() ? 'var(--color-primary,oklch(0.32 0.09 258))' : 'transparent'\"\n [style.color]=\"p === _page() ? 'var(--color-primary-inverse,oklch(0.99 0 0))' : 'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n >{{ p }}</button>\n }\n <button type=\"button\" (click)=\"_goToPage(_page() + 1)\" [disabled]=\"_page() === _totalPages()\"\n class=\"inline-flex items-center justify-center w-7 h-7 text-xs rounded border-none cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-colors\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\" [style.background-color]=\"'transparent'\"\n ><i class=\"pi pi-angle-right text-[10px]\"></i></button>\n <button type=\"button\" (click)=\"_goToPage(_totalPages())\" [disabled]=\"_page() === _totalPages()\"\n class=\"inline-flex items-center justify-center w-7 h-7 text-xs rounded border-none cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-colors\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\" [style.background-color]=\"'transparent'\"\n ><i class=\"pi pi-angle-double-right text-[10px]\"></i></button>\n </div>\n </div>\n }\n </div>\n}\n", styles: [":host{display:contents}[data-col-toggle] label:hover,[data-export-toggle] .export-opt:hover{background-color:var(--color-surface-alt, oklch(.975 .005 260))}\n"] }]
|
|
1834
|
+
}], ctorParameters: () => [], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], striped: [{ type: i0.Input, args: [{ isSignal: true, alias: "striped", required: false }] }], hoverable: [{ type: i0.Input, args: [{ isSignal: true, alias: "hoverable", required: false }] }], sortable: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortable", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }], filterable: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterable", required: false }] }], skeletonRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "skeletonRows", required: false }] }], resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: false }] }], pageable: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageable", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], pageSizeOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizeOptions", required: false }] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], selectionKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionKey", required: false }] }], stickyHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "stickyHeader", required: false }] }], exportable: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportable", required: false }] }], columnToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnToggle", required: false }] }], expandable: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandable", required: false }] }], sortChange: [{ type: i0.Output, args: ["sortChange"] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], selectedRows: [{ type: i0.Output, args: ["selectedRows"] }], rowDetail: [{
|
|
1835
|
+
type: ContentChild,
|
|
1836
|
+
args: ['rowDetail', { read: TemplateRef, static: false }]
|
|
1837
|
+
}] } });
|
|
1838
|
+
|
|
1839
|
+
class AlertComponent {
|
|
1840
|
+
type = input('info', ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
1841
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
1842
|
+
dismissible = input(true, ...(ngDevMode ? [{ debugName: "dismissible" }] : []));
|
|
1843
|
+
showIcon = input(true, ...(ngDevMode ? [{ debugName: "showIcon" }] : []));
|
|
1844
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
1845
|
+
dismiss = output();
|
|
1846
|
+
_visible = signal(true, ...(ngDevMode ? [{ debugName: "_visible" }] : []));
|
|
1847
|
+
_isLeaving = signal(false, ...(ngDevMode ? [{ debugName: "_isLeaving" }] : []));
|
|
1848
|
+
_show = computed(() => this._visible() || this._isLeaving(), ...(ngDevMode ? [{ debugName: "_show" }] : []));
|
|
1849
|
+
_icon = computed(() => {
|
|
1850
|
+
const icons = {
|
|
1851
|
+
success: 'pi pi-check-circle',
|
|
1852
|
+
warning: 'pi pi-exclamation-triangle',
|
|
1853
|
+
danger: 'pi pi-times-circle',
|
|
1854
|
+
info: 'pi pi-info-circle',
|
|
1855
|
+
};
|
|
1856
|
+
return icons[this.type()];
|
|
1857
|
+
}, ...(ngDevMode ? [{ debugName: "_icon" }] : []));
|
|
1858
|
+
_fallback = {
|
|
1859
|
+
success: 'oklch(0.55 0.18 145)',
|
|
1860
|
+
warning: 'oklch(0.68 0.18 75)',
|
|
1861
|
+
danger: 'oklch(0.55 0.22 25)',
|
|
1862
|
+
info: 'oklch(0.55 0.15 235)',
|
|
1863
|
+
};
|
|
1864
|
+
_bg = computed(() => `var(--color-${this.type()}-bg, color-mix(in srgb, ${this._fallback[this.type()]} 15%, white))`, ...(ngDevMode ? [{ debugName: "_bg" }] : []));
|
|
1865
|
+
_border = computed(() => `var(--color-${this.type()}, ${this._fallback[this.type()]})`, ...(ngDevMode ? [{ debugName: "_border" }] : []));
|
|
1866
|
+
_dismiss() {
|
|
1867
|
+
this._isLeaving.set(true);
|
|
1868
|
+
setTimeout(() => {
|
|
1869
|
+
this._visible.set(false);
|
|
1870
|
+
this._isLeaving.set(false);
|
|
1871
|
+
this.dismiss.emit();
|
|
1872
|
+
}, 200);
|
|
1873
|
+
}
|
|
1874
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: AlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1875
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: AlertComponent, isStandalone: true, selector: "app-alert", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: true, isRequired: false, transformFunction: null }, showIcon: { classPropertyName: "showIcon", publicName: "showIcon", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dismiss: "dismiss" }, ngImport: i0, template: "@if (_show()) {\n <div\n class=\"flex items-start gap-3 p-3 rounded-[var(--radius-md,0.5rem)] border\"\n [style.background-color]=\"_bg()\"\n [style.border-color]=\"_border()\"\n [style.transition]=\"'opacity 0.2s ease-out, margin-bottom 0.2s ease-out'\"\n [class.opacity-0]=\"_isLeaving()\"\n [class.mb-[-3rem]]=\"_isLeaving()\"\n [style.width]=\"width() || 'auto'\"\n role=\"alert\"\n >\n @if (showIcon()) {\n <i class=\"mt-0.5 text-sm\" [class]=\"_icon()\" [style.color]=\"_border()\"></i>\n }\n <div class=\"flex-1 min-w-0\">\n @if (title()) {\n <p class=\"text-sm font-semibold text-[var(--color-text,oklch(0.14 0.01 260))]\">{{ title() }}</p>\n }\n <div class=\"text-sm text-[var(--color-text,oklch(0.14 0.01 260))]\"><ng-content /></div>\n </div>\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-6 h-6 p-0 border-none bg-transparent cursor-pointer rounded-full hover:opacity-70 text-[var(--color-text-muted,oklch(0.48 0.01 260))] shrink-0\"\n (click)=\"_dismiss()\"\n aria-label=\"Close\"\n >\n <i class=\"pi pi-times text-xs\"></i>\n </button>\n }\n </div>\n}\n", styles: [":host{display:contents}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1876
|
+
}
|
|
1877
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: AlertComponent, decorators: [{
|
|
1878
|
+
type: Component,
|
|
1879
|
+
args: [{ selector: 'app-alert', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (_show()) {\n <div\n class=\"flex items-start gap-3 p-3 rounded-[var(--radius-md,0.5rem)] border\"\n [style.background-color]=\"_bg()\"\n [style.border-color]=\"_border()\"\n [style.transition]=\"'opacity 0.2s ease-out, margin-bottom 0.2s ease-out'\"\n [class.opacity-0]=\"_isLeaving()\"\n [class.mb-[-3rem]]=\"_isLeaving()\"\n [style.width]=\"width() || 'auto'\"\n role=\"alert\"\n >\n @if (showIcon()) {\n <i class=\"mt-0.5 text-sm\" [class]=\"_icon()\" [style.color]=\"_border()\"></i>\n }\n <div class=\"flex-1 min-w-0\">\n @if (title()) {\n <p class=\"text-sm font-semibold text-[var(--color-text,oklch(0.14 0.01 260))]\">{{ title() }}</p>\n }\n <div class=\"text-sm text-[var(--color-text,oklch(0.14 0.01 260))]\"><ng-content /></div>\n </div>\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-6 h-6 p-0 border-none bg-transparent cursor-pointer rounded-full hover:opacity-70 text-[var(--color-text-muted,oklch(0.48 0.01 260))] shrink-0\"\n (click)=\"_dismiss()\"\n aria-label=\"Close\"\n >\n <i class=\"pi pi-times text-xs\"></i>\n </button>\n }\n </div>\n}\n", styles: [":host{display:contents}\n"] }]
|
|
1880
|
+
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], dismissible: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissible", required: false }] }], showIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "showIcon", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], dismiss: [{ type: i0.Output, args: ["dismiss"] }] } });
|
|
1881
|
+
|
|
1882
|
+
class SpinnerComponent {
|
|
1883
|
+
variant = input('dual-ring', ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
1884
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1885
|
+
accentColor = input('primary', ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
1886
|
+
overlay = input(false, ...(ngDevMode ? [{ debugName: "overlay" }] : []));
|
|
1887
|
+
text = input('', ...(ngDevMode ? [{ debugName: "text" }] : []));
|
|
1888
|
+
imageUrl = input('', ...(ngDevMode ? [{ debugName: "imageUrl" }] : []));
|
|
1889
|
+
_px = computed(() => {
|
|
1890
|
+
const sizes = { sm: 96, md: 144, lg: 240 };
|
|
1891
|
+
return sizes[this.size()] ?? 144;
|
|
1892
|
+
}, ...(ngDevMode ? [{ debugName: "_px" }] : []));
|
|
1893
|
+
_dims = computed(() => {
|
|
1894
|
+
const px = this._px();
|
|
1895
|
+
return {
|
|
1896
|
+
spinner: px,
|
|
1897
|
+
border: Math.max(2, Math.round(px / 6)),
|
|
1898
|
+
dualOuter: px * 2,
|
|
1899
|
+
dualInner: px,
|
|
1900
|
+
dualCenter: Math.round(px * 0.5),
|
|
1901
|
+
dot: Math.round(px * 0.45),
|
|
1902
|
+
pulse: Math.round(px * 1.8),
|
|
1903
|
+
barW: Math.max(3, Math.round(px * 0.2)),
|
|
1904
|
+
barH: px,
|
|
1905
|
+
};
|
|
1906
|
+
}, ...(ngDevMode ? [{ debugName: "_dims" }] : []));
|
|
1907
|
+
_color = computed(() => {
|
|
1908
|
+
const c = this.accentColor();
|
|
1909
|
+
if (isThemeColor(c))
|
|
1910
|
+
return `var(--color-${c}, oklch(0.32 0.09 258))`;
|
|
1911
|
+
return c;
|
|
1912
|
+
}, ...(ngDevMode ? [{ debugName: "_color" }] : []));
|
|
1913
|
+
_circleStyle = computed(() => ({
|
|
1914
|
+
width: this._dims().spinner + 'px',
|
|
1915
|
+
height: this._dims().spinner + 'px',
|
|
1916
|
+
borderWidth: this._dims().border + 'px',
|
|
1917
|
+
borderStyle: 'solid',
|
|
1918
|
+
borderColor: 'var(--color-border,oklch(0.83 0.015 260))',
|
|
1919
|
+
borderTopColor: this._color(),
|
|
1920
|
+
}), ...(ngDevMode ? [{ debugName: "_circleStyle" }] : []));
|
|
1921
|
+
_dualOuterStyle = computed(() => ({
|
|
1922
|
+
width: this._dims().dualOuter + 'px',
|
|
1923
|
+
height: this._dims().dualOuter + 'px',
|
|
1924
|
+
borderWidth: this._dims().border + 'px',
|
|
1925
|
+
borderStyle: 'solid',
|
|
1926
|
+
borderColor: 'var(--color-border,oklch(0.83 0.015 260))',
|
|
1927
|
+
borderTopColor: this._color(),
|
|
1928
|
+
}), ...(ngDevMode ? [{ debugName: "_dualOuterStyle" }] : []));
|
|
1929
|
+
_dualInnerStyle = computed(() => ({
|
|
1930
|
+
width: this._dims().dualInner + 'px',
|
|
1931
|
+
height: this._dims().dualInner + 'px',
|
|
1932
|
+
borderWidth: Math.max(2, this._dims().border - 1) + 'px',
|
|
1933
|
+
borderStyle: 'solid',
|
|
1934
|
+
borderColor: 'var(--color-border-light,oklch(0.91 0.01 260))',
|
|
1935
|
+
borderTopColor: this._color(),
|
|
1936
|
+
}), ...(ngDevMode ? [{ debugName: "_dualInnerStyle" }] : []));
|
|
1937
|
+
_imageStyle = computed(() => ({
|
|
1938
|
+
width: this._dims().dualCenter + 'px',
|
|
1939
|
+
height: this._dims().dualCenter + 'px',
|
|
1940
|
+
}), ...(ngDevMode ? [{ debugName: "_imageStyle" }] : []));
|
|
1941
|
+
_dotStyle = computed(() => ({
|
|
1942
|
+
width: this._dims().dot + 'px',
|
|
1943
|
+
height: this._dims().dot + 'px',
|
|
1944
|
+
backgroundColor: this._color(),
|
|
1945
|
+
}), ...(ngDevMode ? [{ debugName: "_dotStyle" }] : []));
|
|
1946
|
+
_pulseStyle = computed(() => ({
|
|
1947
|
+
width: this._dims().pulse + 'px',
|
|
1948
|
+
height: this._dims().pulse + 'px',
|
|
1949
|
+
backgroundColor: this._color(),
|
|
1950
|
+
}), ...(ngDevMode ? [{ debugName: "_pulseStyle" }] : []));
|
|
1951
|
+
_barStyle = computed(() => ({
|
|
1952
|
+
width: this._dims().barW + 'px',
|
|
1953
|
+
height: this._dims().barH + 'px',
|
|
1954
|
+
backgroundColor: this._color(),
|
|
1955
|
+
}), ...(ngDevMode ? [{ debugName: "_barStyle" }] : []));
|
|
1956
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1957
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: SpinnerComponent, isStandalone: true, selector: "app-spinner", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, accentColor: { classPropertyName: "accentColor", publicName: "accentColor", isSignal: true, isRequired: false, transformFunction: null }, overlay: { classPropertyName: "overlay", publicName: "overlay", isSignal: true, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, imageUrl: { classPropertyName: "imageUrl", publicName: "imageUrl", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div\n [style.display]=\"overlay() ? 'flex' : 'inline-flex'\"\n class=\"flex-col items-center justify-center\"\n [class.fixed]=\"overlay()\"\n [class.inset-0]=\"overlay()\"\n [class.z-50]=\"overlay()\"\n [style.background-color]=\"overlay() ? 'var(--color-backdrop,oklch(0 0 0/0.3))' : 'transparent'\"\n>\n @switch (variant()) {\n @case ('circle') {\n <div class=\"rounded-full animate-spin\" [style]=\"_circleStyle()\"></div>\n }\n @case ('dual-ring') {\n <div class=\"relative flex items-center justify-center\">\n <div class=\"rounded-full animate-spin\" [style]=\"_dualOuterStyle()\"></div>\n <div\n class=\"absolute rounded-full animate-spin\"\n [style]=\"_dualInnerStyle()\"\n style=\"animation-direction: reverse; animation-duration: 1.5s\"\n ></div>\n @if (imageUrl()) {\n <div class=\"absolute flex items-center justify-center\">\n <img [src]=\"imageUrl()\" [style]=\"_imageStyle()\" class=\"opacity-80\" alt=\"\" />\n </div>\n }\n </div>\n }\n @case ('dots') {\n <div class=\"flex items-center gap-1.5\">\n @for (dot of [0,1,2]; track dot) {\n <div\n class=\"rounded-full dot-loader\"\n [style]=\"_dotStyle()\"\n [style.animationDelay]=\"dot * 0.15 + 's'\"\n ></div>\n }\n </div>\n }\n @case ('pulse') {\n <div class=\"rounded-full pulse-loader\" [style]=\"_pulseStyle()\"></div>\n }\n @case ('bars') {\n <div class=\"flex items-end gap-[3px]\">\n @for (bar of [0,1,2,3,4]; track bar) {\n <div\n class=\"rounded-t-sm bar-loader\"\n [style]=\"_barStyle()\"\n [style.animationDelay]=\"bar * 0.1 + 's'\"\n ></div>\n }\n </div>\n }\n }\n\n @if (text()) {\n <p\n class=\"mt-2 text-xs\"\n [class.text-white]=\"overlay()\"\n [class.animate-pulse]=\"overlay()\"\n [class.text-[var(--color-text-muted,oklch(0.48 0.01 260))]]=\"!overlay()\"\n >{{ text() }}</p>\n }\n</div>\n", styles: [":host{display:contents}.dot-loader{animation:dotBounce .6s ease-in-out infinite alternate}.pulse-loader{animation:pulseRing 1.5s ease-in-out infinite}.bar-loader{animation:barWave .8s ease-in-out infinite}@keyframes dotBounce{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes pulseRing{0%,to{transform:scale(1);opacity:.6}50%{transform:scale(1.15);opacity:1}}@keyframes barWave{0%,to{transform:scaleY(.4)}50%{transform:scaleY(1)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1958
|
+
}
|
|
1959
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SpinnerComponent, decorators: [{
|
|
1960
|
+
type: Component,
|
|
1961
|
+
args: [{ selector: 'app-spinner', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n [style.display]=\"overlay() ? 'flex' : 'inline-flex'\"\n class=\"flex-col items-center justify-center\"\n [class.fixed]=\"overlay()\"\n [class.inset-0]=\"overlay()\"\n [class.z-50]=\"overlay()\"\n [style.background-color]=\"overlay() ? 'var(--color-backdrop,oklch(0 0 0/0.3))' : 'transparent'\"\n>\n @switch (variant()) {\n @case ('circle') {\n <div class=\"rounded-full animate-spin\" [style]=\"_circleStyle()\"></div>\n }\n @case ('dual-ring') {\n <div class=\"relative flex items-center justify-center\">\n <div class=\"rounded-full animate-spin\" [style]=\"_dualOuterStyle()\"></div>\n <div\n class=\"absolute rounded-full animate-spin\"\n [style]=\"_dualInnerStyle()\"\n style=\"animation-direction: reverse; animation-duration: 1.5s\"\n ></div>\n @if (imageUrl()) {\n <div class=\"absolute flex items-center justify-center\">\n <img [src]=\"imageUrl()\" [style]=\"_imageStyle()\" class=\"opacity-80\" alt=\"\" />\n </div>\n }\n </div>\n }\n @case ('dots') {\n <div class=\"flex items-center gap-1.5\">\n @for (dot of [0,1,2]; track dot) {\n <div\n class=\"rounded-full dot-loader\"\n [style]=\"_dotStyle()\"\n [style.animationDelay]=\"dot * 0.15 + 's'\"\n ></div>\n }\n </div>\n }\n @case ('pulse') {\n <div class=\"rounded-full pulse-loader\" [style]=\"_pulseStyle()\"></div>\n }\n @case ('bars') {\n <div class=\"flex items-end gap-[3px]\">\n @for (bar of [0,1,2,3,4]; track bar) {\n <div\n class=\"rounded-t-sm bar-loader\"\n [style]=\"_barStyle()\"\n [style.animationDelay]=\"bar * 0.1 + 's'\"\n ></div>\n }\n </div>\n }\n }\n\n @if (text()) {\n <p\n class=\"mt-2 text-xs\"\n [class.text-white]=\"overlay()\"\n [class.animate-pulse]=\"overlay()\"\n [class.text-[var(--color-text-muted,oklch(0.48 0.01 260))]]=\"!overlay()\"\n >{{ text() }}</p>\n }\n</div>\n", styles: [":host{display:contents}.dot-loader{animation:dotBounce .6s ease-in-out infinite alternate}.pulse-loader{animation:pulseRing 1.5s ease-in-out infinite}.bar-loader{animation:barWave .8s ease-in-out infinite}@keyframes dotBounce{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes pulseRing{0%,to{transform:scale(1);opacity:.6}50%{transform:scale(1.15);opacity:1}}@keyframes barWave{0%,to{transform:scaleY(.4)}50%{transform:scaleY(1)}}\n"] }]
|
|
1962
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], accentColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accentColor", required: false }] }], overlay: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlay", required: false }] }], text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], imageUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "imageUrl", required: false }] }] } });
|
|
1963
|
+
|
|
1964
|
+
class ToastService {
|
|
1965
|
+
_toasts = signal([], ...(ngDevMode ? [{ debugName: "_toasts" }] : []));
|
|
1966
|
+
_counter = 0;
|
|
1967
|
+
toasts = this._toasts.asReadonly();
|
|
1968
|
+
show(type, message, config) {
|
|
1969
|
+
const id = ++this._counter;
|
|
1970
|
+
const toast = {
|
|
1971
|
+
id,
|
|
1972
|
+
type,
|
|
1973
|
+
message,
|
|
1974
|
+
title: config?.title,
|
|
1975
|
+
duration: config?.duration,
|
|
1976
|
+
};
|
|
1977
|
+
this._toasts.update(list => [...list, toast]);
|
|
1978
|
+
const ms = config?.duration ?? 4000;
|
|
1979
|
+
if (ms > 0) {
|
|
1980
|
+
setTimeout(() => this.remove(id), ms);
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
success(message, config) {
|
|
1984
|
+
this.show('success', message, config);
|
|
1985
|
+
}
|
|
1986
|
+
error(message, config) {
|
|
1987
|
+
this.show('error', message, config);
|
|
1988
|
+
}
|
|
1989
|
+
warning(message, config) {
|
|
1990
|
+
this.show('warning', message, config);
|
|
1991
|
+
}
|
|
1992
|
+
info(message, config) {
|
|
1993
|
+
this.show('info', message, config);
|
|
1994
|
+
}
|
|
1995
|
+
remove(id) {
|
|
1996
|
+
this._toasts.update(list => list.filter(t => t.id !== id));
|
|
1997
|
+
}
|
|
1998
|
+
clear() {
|
|
1999
|
+
this._toasts.set([]);
|
|
2000
|
+
}
|
|
2001
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2002
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastService, providedIn: 'root' });
|
|
2003
|
+
}
|
|
2004
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastService, decorators: [{
|
|
2005
|
+
type: Injectable,
|
|
2006
|
+
args: [{ providedIn: 'root' }]
|
|
2007
|
+
}] });
|
|
2008
|
+
|
|
2009
|
+
class ToastComponent {
|
|
2010
|
+
position = input('top-right', ...(ngDevMode ? [{ debugName: "position" }] : []));
|
|
2011
|
+
maxVisible = input(5, ...(ngDevMode ? [{ debugName: "maxVisible" }] : []));
|
|
2012
|
+
_toastService = inject(ToastService);
|
|
2013
|
+
_toasts = computed(() => this._toastService.toasts().slice(-this.maxVisible()), ...(ngDevMode ? [{ debugName: "_toasts" }] : []));
|
|
2014
|
+
_positionCls = computed(() => {
|
|
2015
|
+
const positions = {
|
|
2016
|
+
'top-right': 'top-4 right-4',
|
|
2017
|
+
'top-left': 'top-4 left-4',
|
|
2018
|
+
'bottom-right': 'bottom-4 right-4',
|
|
2019
|
+
'bottom-left': 'bottom-4 left-4',
|
|
2020
|
+
};
|
|
2021
|
+
return positions[this.position()] ?? 'top-4 right-4';
|
|
2022
|
+
}, ...(ngDevMode ? [{ debugName: "_positionCls" }] : []));
|
|
2023
|
+
_fallback = {
|
|
2024
|
+
success: 'oklch(0.55 0.18 145)',
|
|
2025
|
+
error: 'oklch(0.55 0.22 25)',
|
|
2026
|
+
warning: 'oklch(0.68 0.18 75)',
|
|
2027
|
+
info: 'oklch(0.55 0.15 235)',
|
|
2028
|
+
};
|
|
2029
|
+
_iconMap = {
|
|
2030
|
+
success: 'pi pi-check-circle',
|
|
2031
|
+
error: 'pi pi-times-circle',
|
|
2032
|
+
warning: 'pi pi-exclamation-triangle',
|
|
2033
|
+
info: 'pi pi-info-circle',
|
|
2034
|
+
};
|
|
2035
|
+
_themeKey(type) {
|
|
2036
|
+
return type === 'error' ? 'danger' : type;
|
|
2037
|
+
}
|
|
2038
|
+
_getBg(type) {
|
|
2039
|
+
return `var(--color-${this._themeKey(type)}-bg, color-mix(in srgb, ${this._fallback[type]} 15%, white))`;
|
|
2040
|
+
}
|
|
2041
|
+
_getIcon(type) {
|
|
2042
|
+
return this._iconMap[type];
|
|
2043
|
+
}
|
|
2044
|
+
_getBorder(type) {
|
|
2045
|
+
return `var(--color-${this._themeKey(type)}, ${this._fallback[type]})`;
|
|
2046
|
+
}
|
|
2047
|
+
_remove(id) {
|
|
2048
|
+
this._toastService.remove(id);
|
|
2049
|
+
}
|
|
2050
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2051
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: ToastComponent, isStandalone: true, selector: "app-toast", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, maxVisible: { classPropertyName: "maxVisible", publicName: "maxVisible", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div\n class=\"fixed z-[9999] flex flex-col gap-2 w-72 max-w-[calc(100vw-2rem)] pointer-events-none\"\n [class]=\"_positionCls()\"\n>\n @for (toast of _toasts(); track toast.id) {\n <div\n class=\"flex items-start gap-3 p-3 rounded-[var(--radius-md,0.5rem)] shadow-lg border pointer-events-auto toast-enter\"\n [style.background-color]=\"_getBg(toast.type)\"\n [style.border-color]=\"_getBorder(toast.type)\"\n >\n <i class=\"mt-0.5 text-sm shrink-0\" [class]=\"_getIcon(toast.type)\" [style.color]=\"_getBorder(toast.type)\"></i>\n <div class=\"flex-1 min-w-0\">\n @if (toast.title) {\n <p class=\"text-xs font-semibold text-[var(--color-text,oklch(0.14 0.01 260))]\">{{ toast.title }}</p>\n }\n <p class=\"text-sm text-[var(--color-text,oklch(0.14 0.01 260))]\">{{ toast.message }}</p>\n </div>\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-5 h-5 p-0 border-none bg-transparent cursor-pointer rounded-full hover:opacity-70 shrink-0 text-[var(--color-text-muted,oklch(0.48 0.01 260))]\"\n (click)=\"_remove(toast.id)\"\n aria-label=\"Close\"\n >\n <i class=\"pi pi-times text-xs\"></i>\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:contents}.toast-enter{animation:toastSlideIn .3s ease-out}@keyframes toastSlideIn{0%{opacity:0;translate:0 -8px}to{opacity:1;translate:0}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2052
|
+
}
|
|
2053
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastComponent, decorators: [{
|
|
2054
|
+
type: Component,
|
|
2055
|
+
args: [{ selector: 'app-toast', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"fixed z-[9999] flex flex-col gap-2 w-72 max-w-[calc(100vw-2rem)] pointer-events-none\"\n [class]=\"_positionCls()\"\n>\n @for (toast of _toasts(); track toast.id) {\n <div\n class=\"flex items-start gap-3 p-3 rounded-[var(--radius-md,0.5rem)] shadow-lg border pointer-events-auto toast-enter\"\n [style.background-color]=\"_getBg(toast.type)\"\n [style.border-color]=\"_getBorder(toast.type)\"\n >\n <i class=\"mt-0.5 text-sm shrink-0\" [class]=\"_getIcon(toast.type)\" [style.color]=\"_getBorder(toast.type)\"></i>\n <div class=\"flex-1 min-w-0\">\n @if (toast.title) {\n <p class=\"text-xs font-semibold text-[var(--color-text,oklch(0.14 0.01 260))]\">{{ toast.title }}</p>\n }\n <p class=\"text-sm text-[var(--color-text,oklch(0.14 0.01 260))]\">{{ toast.message }}</p>\n </div>\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-5 h-5 p-0 border-none bg-transparent cursor-pointer rounded-full hover:opacity-70 shrink-0 text-[var(--color-text-muted,oklch(0.48 0.01 260))]\"\n (click)=\"_remove(toast.id)\"\n aria-label=\"Close\"\n >\n <i class=\"pi pi-times text-xs\"></i>\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:contents}.toast-enter{animation:toastSlideIn .3s ease-out}@keyframes toastSlideIn{0%{opacity:0;translate:0 -8px}to{opacity:1;translate:0}}\n"] }]
|
|
2056
|
+
}], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], maxVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxVisible", required: false }] }] } });
|
|
2057
|
+
|
|
2058
|
+
class AccordionPanelComponent {
|
|
2059
|
+
_accordion = inject(AccordionComponent, { optional: true });
|
|
2060
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
2061
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
2062
|
+
expanded = model(false, ...(ngDevMode ? [{ debugName: "expanded" }] : []));
|
|
2063
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
2064
|
+
_isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : []));
|
|
2065
|
+
_visible = computed(() => this._isOpen() || this._isClosing(), ...(ngDevMode ? [{ debugName: "_visible" }] : []));
|
|
2066
|
+
_open() {
|
|
2067
|
+
if (this.disabled() || this._isOpen())
|
|
2068
|
+
return;
|
|
2069
|
+
if (!this._accordion?.multi()) {
|
|
2070
|
+
this._accordion?.panels().forEach(p => { if (p !== this)
|
|
2071
|
+
p._close(); });
|
|
2072
|
+
}
|
|
2073
|
+
this._isOpen.set(true);
|
|
2074
|
+
this._isClosing.set(false);
|
|
2075
|
+
this.expanded.set(true);
|
|
2076
|
+
}
|
|
2077
|
+
_close() {
|
|
2078
|
+
if (!this._isOpen() || this._isClosing())
|
|
2079
|
+
return;
|
|
2080
|
+
this._isClosing.set(true);
|
|
2081
|
+
this._isOpen.set(false);
|
|
2082
|
+
setTimeout(() => {
|
|
2083
|
+
this._isClosing.set(false);
|
|
2084
|
+
this.expanded.set(false);
|
|
2085
|
+
}, 150);
|
|
2086
|
+
}
|
|
2087
|
+
_toggle() {
|
|
2088
|
+
if (this._isOpen())
|
|
2089
|
+
this._close();
|
|
2090
|
+
else
|
|
2091
|
+
this._open();
|
|
2092
|
+
}
|
|
2093
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: AccordionPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2094
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: AccordionPanelComponent, isStandalone: true, selector: "app-accordion-panel", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange" }, host: { properties: { "class": "'border border-[var(--color-border,oklch(0.83 0.015 260))] rounded-[var(--radius-md,0.5rem)] overflow-hidden'" } }, ngImport: i0, template: "<button\n type=\"button\"\n (click)=\"_toggle()\"\n [disabled]=\"disabled()\"\n class=\"inline-flex items-center justify-between w-full px-3 py-2.5 text-sm font-medium border-none bg-transparent cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 text-[var(--color-text,oklch(0.14 0.01 260))] transition-colors hover:bg-[var(--color-surface-alt,oklch(0.975 0.005 260))]\"\n>\n <span>{{ title() }}</span>\n <i class=\"pi pi-chevron-down text-xs transition-transform duration-200\"\n [style.transform]=\"_isOpen() ? 'rotate(180deg)' : 'rotate(0deg)'\"\n ></i>\n</button>\n@if (_visible()) {\n <div\n class=\"origin-top border-t border-[var(--color-border-light,oklch(0.91 0.01 260))]\"\n [class.acc-enter]=\"_isOpen() && !_isClosing()\"\n [class.acc-leave]=\"_isClosing()\"\n >\n <div class=\"px-3 py-2.5 text-sm text-[var(--color-text-muted,oklch(0.48 0.01 260))]\">\n <ng-content />\n </div>\n </div>\n}\n", styles: [":host{display:block}.acc-enter{animation:accSlideIn .2s ease-out}.acc-leave{animation:accSlideOut .15s ease-in forwards}@keyframes accSlideIn{0%{opacity:0;max-height:0}to{opacity:1;max-height:500px}}@keyframes accSlideOut{0%{opacity:1;max-height:500px}to{opacity:0;max-height:0}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2095
|
+
}
|
|
2096
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: AccordionPanelComponent, decorators: [{
|
|
2097
|
+
type: Component,
|
|
2098
|
+
args: [{ selector: 'app-accordion-panel', imports: [], host: {
|
|
2099
|
+
'[class]': "'border border-[var(--color-border,oklch(0.83 0.015 260))] rounded-[var(--radius-md,0.5rem)] overflow-hidden'",
|
|
2100
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n type=\"button\"\n (click)=\"_toggle()\"\n [disabled]=\"disabled()\"\n class=\"inline-flex items-center justify-between w-full px-3 py-2.5 text-sm font-medium border-none bg-transparent cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 text-[var(--color-text,oklch(0.14 0.01 260))] transition-colors hover:bg-[var(--color-surface-alt,oklch(0.975 0.005 260))]\"\n>\n <span>{{ title() }}</span>\n <i class=\"pi pi-chevron-down text-xs transition-transform duration-200\"\n [style.transform]=\"_isOpen() ? 'rotate(180deg)' : 'rotate(0deg)'\"\n ></i>\n</button>\n@if (_visible()) {\n <div\n class=\"origin-top border-t border-[var(--color-border-light,oklch(0.91 0.01 260))]\"\n [class.acc-enter]=\"_isOpen() && !_isClosing()\"\n [class.acc-leave]=\"_isClosing()\"\n >\n <div class=\"px-3 py-2.5 text-sm text-[var(--color-text-muted,oklch(0.48 0.01 260))]\">\n <ng-content />\n </div>\n </div>\n}\n", styles: [":host{display:block}.acc-enter{animation:accSlideIn .2s ease-out}.acc-leave{animation:accSlideOut .15s ease-in forwards}@keyframes accSlideIn{0%{opacity:0;max-height:0}to{opacity:1;max-height:500px}}@keyframes accSlideOut{0%{opacity:1;max-height:500px}to{opacity:0;max-height:0}}\n"] }]
|
|
2101
|
+
}], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }, { type: i0.Output, args: ["expandedChange"] }] } });
|
|
2102
|
+
|
|
2103
|
+
class AccordionComponent {
|
|
2104
|
+
multi = input(false, ...(ngDevMode ? [{ debugName: "multi" }] : []));
|
|
2105
|
+
panels = contentChildren(AccordionPanelComponent, ...(ngDevMode ? [{ debugName: "panels" }] : []));
|
|
2106
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: AccordionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2107
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.24", type: AccordionComponent, isStandalone: true, selector: "app-accordion", inputs: { multi: { classPropertyName: "multi", publicName: "multi", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.display": "'flex'", "style.flex-direction": "'column'" } }, queries: [{ propertyName: "panels", predicate: AccordionPanelComponent, isSignal: true }], ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2108
|
+
}
|
|
2109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: AccordionComponent, decorators: [{
|
|
2110
|
+
type: Component,
|
|
2111
|
+
args: [{
|
|
2112
|
+
selector: 'app-accordion',
|
|
2113
|
+
imports: [],
|
|
2114
|
+
template: '<ng-content />',
|
|
2115
|
+
host: { '[style.display]': "'flex'", '[style.flex-direction]': "'column'" },
|
|
2116
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2117
|
+
}]
|
|
2118
|
+
}], propDecorators: { multi: [{ type: i0.Input, args: [{ isSignal: true, alias: "multi", required: false }] }], panels: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => AccordionPanelComponent), { isSignal: true }] }] } });
|
|
2119
|
+
|
|
2120
|
+
class NavComponent {
|
|
2121
|
+
_router = inject(Router);
|
|
2122
|
+
_routerSub;
|
|
2123
|
+
items = input([], ...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
2124
|
+
brandText = input('Brand', ...(ngDevMode ? [{ debugName: "brandText" }] : []));
|
|
2125
|
+
brandIcon = input('pi pi-box', ...(ngDevMode ? [{ debugName: "brandIcon" }] : []));
|
|
2126
|
+
fixed = input(true, ...(ngDevMode ? [{ debugName: "fixed" }] : []));
|
|
2127
|
+
logout = output();
|
|
2128
|
+
_mobileOpen = signal(false, ...(ngDevMode ? [{ debugName: "_mobileOpen" }] : []));
|
|
2129
|
+
_openDropdown = signal(null, ...(ngDevMode ? [{ debugName: "_openDropdown" }] : []));
|
|
2130
|
+
_currentUrl = signal(this._router.url, ...(ngDevMode ? [{ debugName: "_currentUrl" }] : []));
|
|
2131
|
+
constructor() {
|
|
2132
|
+
this._routerSub = this._router.events
|
|
2133
|
+
.pipe(filter(e => e instanceof NavigationEnd))
|
|
2134
|
+
.subscribe(() => this._currentUrl.set(this._router.url));
|
|
2135
|
+
}
|
|
2136
|
+
_isActive(segment) {
|
|
2137
|
+
return this._currentUrl().includes(segment);
|
|
2138
|
+
}
|
|
2139
|
+
_toggleMobile() {
|
|
2140
|
+
this._mobileOpen.update(v => !v);
|
|
2141
|
+
if (!this._mobileOpen())
|
|
2142
|
+
this._openDropdown.set(null);
|
|
2143
|
+
}
|
|
2144
|
+
_toggleDropdown(name) {
|
|
2145
|
+
this._openDropdown.update(v => v === name ? null : name);
|
|
2146
|
+
}
|
|
2147
|
+
_navigate(route) {
|
|
2148
|
+
this._router.navigate([route]);
|
|
2149
|
+
this._mobileOpen.set(false);
|
|
2150
|
+
this._openDropdown.set(null);
|
|
2151
|
+
}
|
|
2152
|
+
_onDocClick() {
|
|
2153
|
+
this._openDropdown.set(null);
|
|
2154
|
+
}
|
|
2155
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: NavComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2156
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: NavComponent, isStandalone: true, selector: "app-nav", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, brandText: { classPropertyName: "brandText", publicName: "brandText", isSignal: true, isRequired: false, transformFunction: null }, brandIcon: { classPropertyName: "brandIcon", publicName: "brandIcon", isSignal: true, isRequired: false, transformFunction: null }, fixed: { classPropertyName: "fixed", publicName: "fixed", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { logout: "logout" }, host: { listeners: { "document:click": "_onDocClick()" } }, ngImport: i0, template: "<nav\n class=\"h-16 z-50 flex items-center px-5 gap-3\"\n [class.fixed]=\"fixed()\"\n [class.top-0]=\"fixed()\"\n [class.left-0]=\"fixed()\"\n [class.right-0]=\"fixed()\"\n [class.relative]=\"!fixed()\"\n [class.rounded-md]=\"!fixed()\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.color]=\"'var(--color-primary-inverse,oklch(0.99 0 0))'\"\n>\n <div class=\"flex items-center gap-2 shrink-0\">\n <i [class]=\"brandIcon()\" class=\"text-xl\"></i>\n <span class=\"text-sm font-bold hidden sm:inline\">{{ brandText() }}</span>\n </div>\n\n <button\n type=\"button\"\n (click)=\"_toggleMobile()\"\n class=\"inline-flex items-center justify-center w-8 h-8 border-none bg-transparent cursor-pointer rounded lg:hidden\"\n [style.color]=\"'inherit'\"\n >\n <i class=\"pi text-lg\" [class.pi-bars]=\"!_mobileOpen()\" [class.pi-times]=\"_mobileOpen()\"></i>\n </button>\n\n <!-- Desktop -->\n <div class=\"flex-1 hidden lg:flex items-center justify-center gap-1\">\n @for (item of items(); track item.id) {\n <div class=\"relative\" (click)=\"$event.stopPropagation()\">\n <button\n type=\"button\"\n (click)=\"item.children ? _toggleDropdown(item.id) : _navigate(item.route || '')\"\n class=\"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium border-none cursor-pointer whitespace-nowrap\"\n [style.color]=\"'inherit'\"\n [style.background-color]=\"_isActive(item.id) || _openDropdown() === item.id ? 'rgba(255,255,255,0.15)' : 'transparent'\"\n >\n @if (item.icon) { <i [class]=\"'pi ' + item.icon\" class=\"text-sm\"></i> }\n <span>{{ item.label }}</span>\n @if (item.children) {\n <i class=\"pi pi-chevron-down text-[10px] transition-transform duration-200\"\n [style.transform]=\"_openDropdown() === item.id ? 'rotate(180deg)' : ''\"\n ></i>\n }\n </button>\n\n @if (item.children && _openDropdown() === item.id) {\n <div\n class=\"absolute top-full right-0 mt-1 min-w-[180px] flex flex-col gap-0.5 p-2 rounded-xl shadow-lg z-50\"\n [style.background-color]=\"'var(--color-surface,oklch(0.99 0 0))'\"\n [style.border]=\"'1px solid var(--color-border-light,oklch(0.91 0.01 260))'\"\n animate.enter=\"nav-dd-in\"\n animate.leave=\"nav-dd-out\"\n >\n @for (child of item.children; track child.id) {\n <button\n type=\"button\"\n (click)=\"_navigate(child.route || '')\"\n class=\"w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium border-none cursor-pointer whitespace-nowrap transition-colors\"\n [style.color]=\"_isActive(child.id) ? 'var(--color-primary-inverse,oklch(0.99 0 0))' : 'var(--color-text,oklch(0.14 0.01 260))'\"\n [style.background-color]=\"_isActive(child.id) ? 'var(--color-primary,oklch(0.32 0.09 258))' : 'transparent'\"\n >\n @if (child.icon) { <i [class]=\"'pi ' + child.icon\" class=\"text-xs\"></i> }\n <span>{{ child.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n }\n </div>\n\n <!-- Mobile -->\n <div\n class=\"fixed left-0 right-0 top-16 flex flex-col gap-1 p-4 shadow-xl lg:hidden z-50\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.max-height]=\"_mobileOpen() ? 'calc(100vh - 64px)' : '0'\"\n [style.overflow]=\"_mobileOpen() ? 'auto' : 'hidden'\"\n [style.opacity]=\"_mobileOpen() ? '1' : '0'\"\n style=\"transition: max-height 0.3s ease, opacity 0.2s ease\"\n >\n @for (item of items(); track item.id) {\n <button\n type=\"button\"\n (click)=\"item.children ? _toggleDropdown(item.id) : _navigate(item.route || '')\"\n class=\"w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium border-none cursor-pointer transition-colors\"\n [style.color]=\"'inherit'\"\n [style.background-color]=\"_isActive(item.id) ? 'rgba(255,255,255,0.15)' : 'transparent'\"\n >\n @if (item.icon) { <i [class]=\"'pi ' + item.icon\" class=\"text-sm\"></i> }\n <span class=\"flex-1\">{{ item.label }}</span>\n @if (item.children) {\n <i class=\"pi pi-chevron-down text-xs transition-transform duration-200\"\n [style.transform]=\"_openDropdown() === item.id ? 'rotate(180deg)' : ''\"\n ></i>\n }\n </button>\n\n @if (item.children && _openDropdown() === item.id) {\n <div class=\"flex flex-col gap-0.5 mt-1 mr-4\"\n animate.enter=\"nav-mob-in\"\n animate.leave=\"nav-mob-out\"\n >\n @for (child of item.children; track child.id) {\n <button\n type=\"button\"\n (click)=\"_navigate(child.route || '')\"\n class=\"w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm border-none cursor-pointer transition-colors\"\n [style.color]=\"'rgba(255,255,255,0.85)'\"\n [style.background-color]=\"_isActive(child.id) ? 'rgba(255,255,255,0.15)' : 'transparent'\"\n >\n @if (child.icon) { <i [class]=\"'pi ' + child.icon\" class=\"text-xs\"></i> }\n <span>{{ child.label }}</span>\n </button>\n }\n </div>\n }\n }\n </div>\n\n <button\n type=\"button\"\n (click)=\"logout.emit()\"\n class=\"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium border whitespace-nowrap cursor-pointer transition-colors shrink-0\"\n [style.color]=\"'inherit'\"\n [style.border-color]=\"'rgba(255,255,255,0.3)'\"\n >\n <i class=\"pi pi-sign-out text-sm\"></i>\n <span class=\"hidden sm:inline\">Logout</span>\n </button>\n</nav>\n", styles: [":host{display:contents}.nav-dd-in{animation:navDdIn .2s ease-out}.nav-dd-out{animation:navDdOut .15s ease-in forwards}.nav-mob-in{animation:navMobIn .2s ease-out}.nav-mob-out{animation:navMobOut .12s ease-in forwards}@keyframes navDdIn{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0}}@keyframes navDdOut{0%{opacity:1;translate:0}to{opacity:0;translate:0 -6px}}@keyframes navMobIn{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes navMobOut{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2157
|
+
}
|
|
2158
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: NavComponent, decorators: [{
|
|
2159
|
+
type: Component,
|
|
2160
|
+
args: [{ selector: 'app-nav', imports: [], host: {
|
|
2161
|
+
'(document:click)': '_onDocClick()',
|
|
2162
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<nav\n class=\"h-16 z-50 flex items-center px-5 gap-3\"\n [class.fixed]=\"fixed()\"\n [class.top-0]=\"fixed()\"\n [class.left-0]=\"fixed()\"\n [class.right-0]=\"fixed()\"\n [class.relative]=\"!fixed()\"\n [class.rounded-md]=\"!fixed()\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.color]=\"'var(--color-primary-inverse,oklch(0.99 0 0))'\"\n>\n <div class=\"flex items-center gap-2 shrink-0\">\n <i [class]=\"brandIcon()\" class=\"text-xl\"></i>\n <span class=\"text-sm font-bold hidden sm:inline\">{{ brandText() }}</span>\n </div>\n\n <button\n type=\"button\"\n (click)=\"_toggleMobile()\"\n class=\"inline-flex items-center justify-center w-8 h-8 border-none bg-transparent cursor-pointer rounded lg:hidden\"\n [style.color]=\"'inherit'\"\n >\n <i class=\"pi text-lg\" [class.pi-bars]=\"!_mobileOpen()\" [class.pi-times]=\"_mobileOpen()\"></i>\n </button>\n\n <!-- Desktop -->\n <div class=\"flex-1 hidden lg:flex items-center justify-center gap-1\">\n @for (item of items(); track item.id) {\n <div class=\"relative\" (click)=\"$event.stopPropagation()\">\n <button\n type=\"button\"\n (click)=\"item.children ? _toggleDropdown(item.id) : _navigate(item.route || '')\"\n class=\"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium border-none cursor-pointer whitespace-nowrap\"\n [style.color]=\"'inherit'\"\n [style.background-color]=\"_isActive(item.id) || _openDropdown() === item.id ? 'rgba(255,255,255,0.15)' : 'transparent'\"\n >\n @if (item.icon) { <i [class]=\"'pi ' + item.icon\" class=\"text-sm\"></i> }\n <span>{{ item.label }}</span>\n @if (item.children) {\n <i class=\"pi pi-chevron-down text-[10px] transition-transform duration-200\"\n [style.transform]=\"_openDropdown() === item.id ? 'rotate(180deg)' : ''\"\n ></i>\n }\n </button>\n\n @if (item.children && _openDropdown() === item.id) {\n <div\n class=\"absolute top-full right-0 mt-1 min-w-[180px] flex flex-col gap-0.5 p-2 rounded-xl shadow-lg z-50\"\n [style.background-color]=\"'var(--color-surface,oklch(0.99 0 0))'\"\n [style.border]=\"'1px solid var(--color-border-light,oklch(0.91 0.01 260))'\"\n animate.enter=\"nav-dd-in\"\n animate.leave=\"nav-dd-out\"\n >\n @for (child of item.children; track child.id) {\n <button\n type=\"button\"\n (click)=\"_navigate(child.route || '')\"\n class=\"w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium border-none cursor-pointer whitespace-nowrap transition-colors\"\n [style.color]=\"_isActive(child.id) ? 'var(--color-primary-inverse,oklch(0.99 0 0))' : 'var(--color-text,oklch(0.14 0.01 260))'\"\n [style.background-color]=\"_isActive(child.id) ? 'var(--color-primary,oklch(0.32 0.09 258))' : 'transparent'\"\n >\n @if (child.icon) { <i [class]=\"'pi ' + child.icon\" class=\"text-xs\"></i> }\n <span>{{ child.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n }\n </div>\n\n <!-- Mobile -->\n <div\n class=\"fixed left-0 right-0 top-16 flex flex-col gap-1 p-4 shadow-xl lg:hidden z-50\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.max-height]=\"_mobileOpen() ? 'calc(100vh - 64px)' : '0'\"\n [style.overflow]=\"_mobileOpen() ? 'auto' : 'hidden'\"\n [style.opacity]=\"_mobileOpen() ? '1' : '0'\"\n style=\"transition: max-height 0.3s ease, opacity 0.2s ease\"\n >\n @for (item of items(); track item.id) {\n <button\n type=\"button\"\n (click)=\"item.children ? _toggleDropdown(item.id) : _navigate(item.route || '')\"\n class=\"w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium border-none cursor-pointer transition-colors\"\n [style.color]=\"'inherit'\"\n [style.background-color]=\"_isActive(item.id) ? 'rgba(255,255,255,0.15)' : 'transparent'\"\n >\n @if (item.icon) { <i [class]=\"'pi ' + item.icon\" class=\"text-sm\"></i> }\n <span class=\"flex-1\">{{ item.label }}</span>\n @if (item.children) {\n <i class=\"pi pi-chevron-down text-xs transition-transform duration-200\"\n [style.transform]=\"_openDropdown() === item.id ? 'rotate(180deg)' : ''\"\n ></i>\n }\n </button>\n\n @if (item.children && _openDropdown() === item.id) {\n <div class=\"flex flex-col gap-0.5 mt-1 mr-4\"\n animate.enter=\"nav-mob-in\"\n animate.leave=\"nav-mob-out\"\n >\n @for (child of item.children; track child.id) {\n <button\n type=\"button\"\n (click)=\"_navigate(child.route || '')\"\n class=\"w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm border-none cursor-pointer transition-colors\"\n [style.color]=\"'rgba(255,255,255,0.85)'\"\n [style.background-color]=\"_isActive(child.id) ? 'rgba(255,255,255,0.15)' : 'transparent'\"\n >\n @if (child.icon) { <i [class]=\"'pi ' + child.icon\" class=\"text-xs\"></i> }\n <span>{{ child.label }}</span>\n </button>\n }\n </div>\n }\n }\n </div>\n\n <button\n type=\"button\"\n (click)=\"logout.emit()\"\n class=\"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium border whitespace-nowrap cursor-pointer transition-colors shrink-0\"\n [style.color]=\"'inherit'\"\n [style.border-color]=\"'rgba(255,255,255,0.3)'\"\n >\n <i class=\"pi pi-sign-out text-sm\"></i>\n <span class=\"hidden sm:inline\">Logout</span>\n </button>\n</nav>\n", styles: [":host{display:contents}.nav-dd-in{animation:navDdIn .2s ease-out}.nav-dd-out{animation:navDdOut .15s ease-in forwards}.nav-mob-in{animation:navMobIn .2s ease-out}.nav-mob-out{animation:navMobOut .12s ease-in forwards}@keyframes navDdIn{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0}}@keyframes navDdOut{0%{opacity:1;translate:0}to{opacity:0;translate:0 -6px}}@keyframes navMobIn{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes navMobOut{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}\n"] }]
|
|
2163
|
+
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], brandText: [{ type: i0.Input, args: [{ isSignal: true, alias: "brandText", required: false }] }], brandIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "brandIcon", required: false }] }], fixed: [{ type: i0.Input, args: [{ isSignal: true, alias: "fixed", required: false }] }], logout: [{ type: i0.Output, args: ["logout"] }] } });
|
|
2164
|
+
|
|
2165
|
+
class SidebarComponent {
|
|
2166
|
+
_router = inject(Router);
|
|
2167
|
+
_destroyRef = inject(DestroyRef);
|
|
2168
|
+
isOpen = input(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
2169
|
+
isCollapsed = input(false, ...(ngDevMode ? [{ debugName: "isCollapsed" }] : []));
|
|
2170
|
+
items = input([], ...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
2171
|
+
title = input('Menu', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
2172
|
+
width = input('280px', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
2173
|
+
activeId = input(null, ...(ngDevMode ? [{ debugName: "activeId" }] : []));
|
|
2174
|
+
toggleOpen = output();
|
|
2175
|
+
toggleCollapse = output();
|
|
2176
|
+
itemClick = output();
|
|
2177
|
+
logout = output();
|
|
2178
|
+
_expanded = signal(new Set(), ...(ngDevMode ? [{ debugName: "_expanded" }] : []));
|
|
2179
|
+
_currentUrl = signal(this._router.url, ...(ngDevMode ? [{ debugName: "_currentUrl" }] : []));
|
|
2180
|
+
_activeId = computed(() => {
|
|
2181
|
+
if (this.activeId() !== null)
|
|
2182
|
+
return this.activeId();
|
|
2183
|
+
const url = this._currentUrl();
|
|
2184
|
+
for (const item of this.items()) {
|
|
2185
|
+
if (item.route && this._router.isActive(item.route, false))
|
|
2186
|
+
return item.id;
|
|
2187
|
+
if (item.children) {
|
|
2188
|
+
for (const child of item.children) {
|
|
2189
|
+
if (child.route && this._router.isActive(child.route, false))
|
|
2190
|
+
return child.id;
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
return null;
|
|
2195
|
+
}, ...(ngDevMode ? [{ debugName: "_activeId" }] : []));
|
|
2196
|
+
_asideStyle = computed(() => ({
|
|
2197
|
+
width: this.isCollapsed() ? '64px' : this.width(),
|
|
2198
|
+
'background-color': 'var(--color-surface,oklch(0.99 0 0))',
|
|
2199
|
+
}), ...(ngDevMode ? [{ debugName: "_asideStyle" }] : []));
|
|
2200
|
+
constructor() {
|
|
2201
|
+
this._router.events
|
|
2202
|
+
.pipe(filter(e => e instanceof NavigationEnd), takeUntilDestroyed(this._destroyRef))
|
|
2203
|
+
.subscribe(() => this._currentUrl.set(this._router.url));
|
|
2204
|
+
}
|
|
2205
|
+
_isActive(id) { return this._activeId() === id; }
|
|
2206
|
+
_isExpanded(id) { return this._expanded().has(id); }
|
|
2207
|
+
_onItemClick(item) {
|
|
2208
|
+
if (item.children?.length) {
|
|
2209
|
+
this._expanded.update(s => {
|
|
2210
|
+
const n = new Set(s);
|
|
2211
|
+
if (n.has(item.id))
|
|
2212
|
+
n.delete(item.id);
|
|
2213
|
+
else
|
|
2214
|
+
n.add(item.id);
|
|
2215
|
+
return n;
|
|
2216
|
+
});
|
|
2217
|
+
}
|
|
2218
|
+
else {
|
|
2219
|
+
this.itemClick.emit(item);
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
_onBackdrop() { this.toggleOpen.emit(); }
|
|
2223
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SidebarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2224
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: SidebarComponent, isStandalone: true, selector: "app-sidebar", inputs: { isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, isCollapsed: { classPropertyName: "isCollapsed", publicName: "isCollapsed", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, activeId: { classPropertyName: "activeId", publicName: "activeId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { toggleOpen: "toggleOpen", toggleCollapse: "toggleCollapse", itemClick: "itemClick", logout: "logout" }, host: { properties: { "style.display": "'contents'" } }, ngImport: i0, template: "@if (isOpen()) {\n <div\n class=\"sd-backdrop\"\n animate.enter=\"sd-backdrop-in\"\n animate.leave=\"sd-backdrop-out\"\n (click)=\"_onBackdrop()\"\n ></div>\n}\n\n<aside\n class=\"sd-aside\"\n [class.sd-open]=\"isOpen()\"\n [class.sd-collapsed]=\"isCollapsed()\"\n [style]=\"_asideStyle()\"\n>\n <div class=\"flex items-center justify-between shrink-0 px-4 h-14 border-b\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n >\n <button\n type=\"button\"\n (click)=\"toggleCollapse.emit()\"\n class=\"group inline-flex items-center justify-center w-8 h-8 border-none bg-transparent cursor-pointer rounded transition-all duration-200 hover:bg-[var(--color-accent,oklch(0.64 0.2 50))] active:bg-[var(--color-accent,oklch(0.64 0.2 50))]\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n >\n <i class=\"pi pi-th-large text-sm transition-transform duration-500 ease-in-out active:scale-90\"\n [style.transform]=\"isCollapsed() ? 'rotate(180deg)' : 'rotate(0deg)'\"\n ></i>\n </button>\n\n @if (!isCollapsed()) {\n <span class=\"text-sm font-semibold text-[var(--color-text,oklch(0.14 0.01 260))]\">{{ title() }}</span>\n }\n\n <button\n type=\"button\"\n (click)=\"_onBackdrop()\"\n class=\"sd-close-btn inline-flex items-center justify-center w-8 h-8 border-none bg-transparent cursor-pointer rounded transition-colors hover:bg-[var(--color-surface-alt,oklch(0.975 0.005 260))]\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n >\n <i class=\"pi pi-times text-sm\"></i>\n </button>\n </div>\n\n <nav class=\"flex-1 overflow-y-auto p-3\">\n <ul class=\"flex flex-col gap-1\" [style.list-style]=\"'none'\" [style.padding]=\"'0'\">\n @for (item of items(); track item.id) {\n <li>\n <button\n type=\"button\"\n (click)=\"_onItemClick(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-all duration-150 text-sm font-medium border-none cursor-pointer\"\n [style.background-color]=\"_isActive(item.id) ? 'var(--color-primary,oklch(0.32 0.09 258))' : 'transparent'\"\n [style.color]=\"_isActive(item.id) ? 'var(--color-primary-inverse,oklch(0.99 0 0))' : 'var(--color-text,oklch(0.14 0.01 260))'\"\n >\n @if (item.icon) {\n <i [class]=\"'pi ' + item.icon\" class=\"text-base shrink-0\"></i>\n }\n @if (!isCollapsed()) {\n <span class=\"flex-1 text-right\">{{ item.label }}</span>\n @if (item.children?.length) {\n <i class=\"pi pi-chevron-down text-xs transition-transform duration-200\"\n [style.transform]=\"_isExpanded(item.id) ? 'rotate(180deg)' : ''\"\n ></i>\n }\n }\n </button>\n\n @if (!isCollapsed() && item.children?.length && _isExpanded(item.id)) {\n <ul class=\"mt-1 mr-6 flex flex-col gap-0.5\"\n [style.list-style]=\"'none'\" [style.padding]=\"'0'\"\n animate.enter=\"sd-slide-in\"\n animate.leave=\"sd-slide-out\"\n >\n @for (child of item.children; track child.id) {\n <li>\n <button\n type=\"button\"\n (click)=\"_onItemClick(child)\"\n class=\"w-full flex items-center gap-2.5 px-3 py-2 rounded-lg transition-all duration-150 text-sm border-none cursor-pointer\"\n [style.background-color]=\"_isActive(child.id) ? 'var(--color-primary,oklch(0.32 0.09 258))' : 'transparent'\"\n [style.color]=\"_isActive(child.id) ? 'var(--color-primary-inverse,oklch(0.99 0 0))' : 'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n >\n <span class=\"w-1.5 h-1.5 rounded-full shrink-0\"\n [style.background-color]=\"_isActive(child.id) ? 'var(--color-primary-inverse,oklch(0.99 0 0))' : 'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n ></span>\n <span>{{ child.label }}</span>\n </button>\n </li>\n }\n </ul>\n }\n </li>\n }\n </ul>\n </nav>\n\n <div class=\"shrink-0 p-3 border-t flex flex-col gap-2\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n >\n <button\n type=\"button\"\n (click)=\"logout.emit()\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium border-none cursor-pointer transition-colors\"\n [style.background-color]=\"'var(--color-danger,oklch(0.57 0.21 25))'\"\n [style.color]=\"'white'\"\n [class.justify-center]=\"isCollapsed()\"\n >\n <i class=\"pi pi-sign-out text-base shrink-0\"></i>\n @if (!isCollapsed()) {\n <span>Logout</span>\n }\n </button>\n </div>\n</aside>\n", styles: [":host{display:contents}.sd-aside{display:flex;flex-direction:column;height:100%;position:relative;transition:transform .3s cubic-bezier(.4,0,.2,1),width .3s cubic-bezier(.4,0,.2,1);border:1px solid var(--color-border-light, oklch(.91 .01 260));border-radius:var(--radius-md, .5rem);overflow:hidden}@media(max-width:1023px){.sd-aside{position:fixed;top:0;right:0;z-index:50;height:100vh;box-shadow:0 8px 32px #0000001f;transform:translate(100%)}.sd-aside.sd-open{transform:translate(0)}.sd-backdrop{position:fixed;inset:0;z-index:40;background:#00000073;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}}.sd-backdrop-in{animation:sdFadeIn .2s ease-out}.sd-backdrop-out{animation:sdFadeOut .15s ease-in forwards}.sd-close-btn{display:none}@media(max-width:1023px){.sd-close-btn{display:inline-flex}}.sd-aside.sd-collapsed{width:64px!important}.sd-slide-in{animation:sdSlideDown .2s ease-out}.sd-slide-out{animation:sdSlideUp .15s ease-in forwards}@keyframes sdFadeIn{0%{opacity:0}to{opacity:1}}@keyframes sdFadeOut{0%{opacity:1}to{opacity:0}}@keyframes sdSlideDown{0%{opacity:0;translate:0 -8px}to{opacity:1;translate:0}}@keyframes sdSlideUp{0%{opacity:1;translate:0}to{opacity:0;translate:0 -8px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2225
|
+
}
|
|
2226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SidebarComponent, decorators: [{
|
|
2227
|
+
type: Component,
|
|
2228
|
+
args: [{ selector: 'app-sidebar', imports: [], host: {
|
|
2229
|
+
'[style.display]': "'contents'",
|
|
2230
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (isOpen()) {\n <div\n class=\"sd-backdrop\"\n animate.enter=\"sd-backdrop-in\"\n animate.leave=\"sd-backdrop-out\"\n (click)=\"_onBackdrop()\"\n ></div>\n}\n\n<aside\n class=\"sd-aside\"\n [class.sd-open]=\"isOpen()\"\n [class.sd-collapsed]=\"isCollapsed()\"\n [style]=\"_asideStyle()\"\n>\n <div class=\"flex items-center justify-between shrink-0 px-4 h-14 border-b\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n >\n <button\n type=\"button\"\n (click)=\"toggleCollapse.emit()\"\n class=\"group inline-flex items-center justify-center w-8 h-8 border-none bg-transparent cursor-pointer rounded transition-all duration-200 hover:bg-[var(--color-accent,oklch(0.64 0.2 50))] active:bg-[var(--color-accent,oklch(0.64 0.2 50))]\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n >\n <i class=\"pi pi-th-large text-sm transition-transform duration-500 ease-in-out active:scale-90\"\n [style.transform]=\"isCollapsed() ? 'rotate(180deg)' : 'rotate(0deg)'\"\n ></i>\n </button>\n\n @if (!isCollapsed()) {\n <span class=\"text-sm font-semibold text-[var(--color-text,oklch(0.14 0.01 260))]\">{{ title() }}</span>\n }\n\n <button\n type=\"button\"\n (click)=\"_onBackdrop()\"\n class=\"sd-close-btn inline-flex items-center justify-center w-8 h-8 border-none bg-transparent cursor-pointer rounded transition-colors hover:bg-[var(--color-surface-alt,oklch(0.975 0.005 260))]\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n >\n <i class=\"pi pi-times text-sm\"></i>\n </button>\n </div>\n\n <nav class=\"flex-1 overflow-y-auto p-3\">\n <ul class=\"flex flex-col gap-1\" [style.list-style]=\"'none'\" [style.padding]=\"'0'\">\n @for (item of items(); track item.id) {\n <li>\n <button\n type=\"button\"\n (click)=\"_onItemClick(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-all duration-150 text-sm font-medium border-none cursor-pointer\"\n [style.background-color]=\"_isActive(item.id) ? 'var(--color-primary,oklch(0.32 0.09 258))' : 'transparent'\"\n [style.color]=\"_isActive(item.id) ? 'var(--color-primary-inverse,oklch(0.99 0 0))' : 'var(--color-text,oklch(0.14 0.01 260))'\"\n >\n @if (item.icon) {\n <i [class]=\"'pi ' + item.icon\" class=\"text-base shrink-0\"></i>\n }\n @if (!isCollapsed()) {\n <span class=\"flex-1 text-right\">{{ item.label }}</span>\n @if (item.children?.length) {\n <i class=\"pi pi-chevron-down text-xs transition-transform duration-200\"\n [style.transform]=\"_isExpanded(item.id) ? 'rotate(180deg)' : ''\"\n ></i>\n }\n }\n </button>\n\n @if (!isCollapsed() && item.children?.length && _isExpanded(item.id)) {\n <ul class=\"mt-1 mr-6 flex flex-col gap-0.5\"\n [style.list-style]=\"'none'\" [style.padding]=\"'0'\"\n animate.enter=\"sd-slide-in\"\n animate.leave=\"sd-slide-out\"\n >\n @for (child of item.children; track child.id) {\n <li>\n <button\n type=\"button\"\n (click)=\"_onItemClick(child)\"\n class=\"w-full flex items-center gap-2.5 px-3 py-2 rounded-lg transition-all duration-150 text-sm border-none cursor-pointer\"\n [style.background-color]=\"_isActive(child.id) ? 'var(--color-primary,oklch(0.32 0.09 258))' : 'transparent'\"\n [style.color]=\"_isActive(child.id) ? 'var(--color-primary-inverse,oklch(0.99 0 0))' : 'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n >\n <span class=\"w-1.5 h-1.5 rounded-full shrink-0\"\n [style.background-color]=\"_isActive(child.id) ? 'var(--color-primary-inverse,oklch(0.99 0 0))' : 'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n ></span>\n <span>{{ child.label }}</span>\n </button>\n </li>\n }\n </ul>\n }\n </li>\n }\n </ul>\n </nav>\n\n <div class=\"shrink-0 p-3 border-t flex flex-col gap-2\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n >\n <button\n type=\"button\"\n (click)=\"logout.emit()\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium border-none cursor-pointer transition-colors\"\n [style.background-color]=\"'var(--color-danger,oklch(0.57 0.21 25))'\"\n [style.color]=\"'white'\"\n [class.justify-center]=\"isCollapsed()\"\n >\n <i class=\"pi pi-sign-out text-base shrink-0\"></i>\n @if (!isCollapsed()) {\n <span>Logout</span>\n }\n </button>\n </div>\n</aside>\n", styles: [":host{display:contents}.sd-aside{display:flex;flex-direction:column;height:100%;position:relative;transition:transform .3s cubic-bezier(.4,0,.2,1),width .3s cubic-bezier(.4,0,.2,1);border:1px solid var(--color-border-light, oklch(.91 .01 260));border-radius:var(--radius-md, .5rem);overflow:hidden}@media(max-width:1023px){.sd-aside{position:fixed;top:0;right:0;z-index:50;height:100vh;box-shadow:0 8px 32px #0000001f;transform:translate(100%)}.sd-aside.sd-open{transform:translate(0)}.sd-backdrop{position:fixed;inset:0;z-index:40;background:#00000073;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}}.sd-backdrop-in{animation:sdFadeIn .2s ease-out}.sd-backdrop-out{animation:sdFadeOut .15s ease-in forwards}.sd-close-btn{display:none}@media(max-width:1023px){.sd-close-btn{display:inline-flex}}.sd-aside.sd-collapsed{width:64px!important}.sd-slide-in{animation:sdSlideDown .2s ease-out}.sd-slide-out{animation:sdSlideUp .15s ease-in forwards}@keyframes sdFadeIn{0%{opacity:0}to{opacity:1}}@keyframes sdFadeOut{0%{opacity:1}to{opacity:0}}@keyframes sdSlideDown{0%{opacity:0;translate:0 -8px}to{opacity:1;translate:0}}@keyframes sdSlideUp{0%{opacity:1;translate:0}to{opacity:0;translate:0 -8px}}\n"] }]
|
|
2231
|
+
}], ctorParameters: () => [], propDecorators: { isOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOpen", required: false }] }], isCollapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "isCollapsed", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], activeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeId", required: false }] }], toggleOpen: [{ type: i0.Output, args: ["toggleOpen"] }], toggleCollapse: [{ type: i0.Output, args: ["toggleCollapse"] }], itemClick: [{ type: i0.Output, args: ["itemClick"] }], logout: [{ type: i0.Output, args: ["logout"] }] } });
|
|
2232
|
+
|
|
2233
|
+
class ConfirmDialogComponent {
|
|
2234
|
+
_closeTimer = null;
|
|
2235
|
+
open = model(false, ...(ngDevMode ? [{ debugName: "open" }] : []));
|
|
2236
|
+
message = input('', ...(ngDevMode ? [{ debugName: "message" }] : []));
|
|
2237
|
+
config = input({}, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
2238
|
+
confirm = output();
|
|
2239
|
+
cancel = output();
|
|
2240
|
+
_title = computed(() => this.config().title ?? 'Confirm', ...(ngDevMode ? [{ debugName: "_title" }] : []));
|
|
2241
|
+
_confirmText = computed(() => this.config().confirmText ?? 'Confirm', ...(ngDevMode ? [{ debugName: "_confirmText" }] : []));
|
|
2242
|
+
_cancelText = computed(() => this.config().cancelText ?? 'Cancel', ...(ngDevMode ? [{ debugName: "_cancelText" }] : []));
|
|
2243
|
+
_icon = computed(() => this.config().icon ?? 'pi pi-question-circle', ...(ngDevMode ? [{ debugName: "_icon" }] : []));
|
|
2244
|
+
_confirmAccent = computed(() => {
|
|
2245
|
+
const a = this.config().confirmAccent;
|
|
2246
|
+
if (a && isThemeColor(a))
|
|
2247
|
+
return a;
|
|
2248
|
+
return 'primary';
|
|
2249
|
+
}, ...(ngDevMode ? [{ debugName: "_confirmAccent" }] : []));
|
|
2250
|
+
_closeOnBackdrop = computed(() => this.config().closeOnBackdrop ?? false, ...(ngDevMode ? [{ debugName: "_closeOnBackdrop" }] : []));
|
|
2251
|
+
_closeOnEscape = computed(() => this.config().closeOnEscape ?? true, ...(ngDevMode ? [{ debugName: "_closeOnEscape" }] : []));
|
|
2252
|
+
_confirmBg = computed(() => {
|
|
2253
|
+
const fallbacks = { primary: 'oklch(0.32 0.09 258)', danger: 'oklch(0.55 0.22 25)', accent: 'oklch(0.64 0.2 50)', success: 'oklch(0.55 0.18 145)' };
|
|
2254
|
+
const key = this._confirmAccent();
|
|
2255
|
+
return `var(--color-${key}, ${fallbacks[key] ?? fallbacks['primary']})`;
|
|
2256
|
+
}, ...(ngDevMode ? [{ debugName: "_confirmBg" }] : []));
|
|
2257
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
2258
|
+
_isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : []));
|
|
2259
|
+
_visible = computed(() => this._isOpen() || this._isClosing(), ...(ngDevMode ? [{ debugName: "_visible" }] : []));
|
|
2260
|
+
constructor() {
|
|
2261
|
+
effect(() => {
|
|
2262
|
+
if (this.open() && !this._isOpen()) {
|
|
2263
|
+
this._isOpen.set(true);
|
|
2264
|
+
this._isClosing.set(false);
|
|
2265
|
+
}
|
|
2266
|
+
else if (!this.open() && this._isOpen()) {
|
|
2267
|
+
this._startClose();
|
|
2268
|
+
}
|
|
2269
|
+
});
|
|
2270
|
+
}
|
|
2271
|
+
_startClose() {
|
|
2272
|
+
if (this._closeTimer)
|
|
2273
|
+
clearTimeout(this._closeTimer);
|
|
2274
|
+
this._isClosing.set(true);
|
|
2275
|
+
this._closeTimer = setTimeout(() => {
|
|
2276
|
+
this._isOpen.set(false);
|
|
2277
|
+
this._isClosing.set(false);
|
|
2278
|
+
this._closeTimer = null;
|
|
2279
|
+
}, 200);
|
|
2280
|
+
}
|
|
2281
|
+
ngOnDestroy() {
|
|
2282
|
+
if (this._closeTimer)
|
|
2283
|
+
clearTimeout(this._closeTimer);
|
|
2284
|
+
}
|
|
2285
|
+
_onConfirm() {
|
|
2286
|
+
this.open.set(false);
|
|
2287
|
+
this.confirm.emit();
|
|
2288
|
+
}
|
|
2289
|
+
_onCancel() {
|
|
2290
|
+
this.open.set(false);
|
|
2291
|
+
this.cancel.emit();
|
|
2292
|
+
}
|
|
2293
|
+
_onBackdropClick() {
|
|
2294
|
+
if (this._closeOnBackdrop()) {
|
|
2295
|
+
this._onCancel();
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
_onEscape(event) {
|
|
2299
|
+
if (this._closeOnEscape() && this._visible()) {
|
|
2300
|
+
event.preventDefault();
|
|
2301
|
+
this._onCancel();
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ConfirmDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2305
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: ConfirmDialogComponent, isStandalone: true, selector: "app-confirm-dialog", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", confirm: "confirm", cancel: "cancel" }, host: { listeners: { "document:keydown.escape": "_onEscape($event)" } }, ngImport: i0, template: "@if (_visible()) {\n <div\n class=\"fixed inset-0 z-50 flex items-center justify-center bg-[var(--modal-backdrop,oklch(0 0 0/0.45))]\"\n [class.backdrop-enter]=\"_isOpen() && !_isClosing()\"\n [class.backdrop-leave]=\"_isClosing()\"\n (click)=\"_onBackdropClick()\"\n >\n <div\n class=\"bg-[var(--color-surface,oklch(0.99 0 0))] border border-[var(--color-border,oklch(0.83 0.015 260))] rounded-[var(--radius-lg,0.75rem)] shadow-xl w-full max-w-sm mx-4 overflow-hidden text-[var(--color-text,oklch(0.14 0.01 260))]\"\n [class.panel-enter]=\"_isOpen() && !_isClosing()\"\n [class.panel-leave]=\"_isClosing()\"\n (click)=\"$event.stopPropagation()\"\n >\n @if (_title()) {\n <div class=\"flex items-center justify-between px-4 py-3 border-b border-[var(--color-border-light,oklch(0.91 0.01 260))]\">\n <h3 class=\"text-sm font-semibold\">{{ _title() }}</h3>\n </div>\n }\n\n <div class=\"flex flex-col items-center gap-3 px-6 py-6 text-center\">\n @if (_icon()) {\n <i class=\"{{ _icon() }} text-2xl text-[var(--color-primary,oklch(0.32 0.09 258))]\"></i>\n }\n <p class=\"text-sm text-[var(--color-text,oklch(0.14 0.01 260))]\">{{ message() }}</p>\n </div>\n\n <div class=\"flex items-center justify-end gap-2 px-4 py-3 border-t border-[var(--color-border-light,oklch(0.91 0.01 260))]\">\n <button\n type=\"button\"\n class=\"px-3 py-1.5 text-sm rounded-[var(--radius-md,0.5rem)] border border-[var(--color-border,oklch(0.83 0.015 260))] bg-transparent text-[var(--color-text,oklch(0.14 0.01 260))] cursor-pointer transition-colors duration-150 hover:bg-[var(--color-surface-alt,oklch(0.975 0.005 260))]\"\n (click)=\"_onCancel()\"\n >{{ _cancelText() }}</button>\n\n <button\n type=\"button\"\n [style.background-color]=\"_confirmBg()\"\n class=\"px-3 py-1.5 text-sm rounded-[var(--radius-md,0.5rem)] border-none text-white cursor-pointer transition-opacity duration-150 hover:opacity-90\"\n (click)=\"_onConfirm()\"\n >{{ _confirmText() }}</button>\n </div>\n </div>\n </div>\n}\n", styles: [":host{display:contents}.backdrop-enter{animation:backdropIn .2s ease-out}.backdrop-leave{animation:backdropOut .2s ease-in forwards}.panel-enter{animation:panelIn .2s ease-out}.panel-leave{animation:panelOut .18s ease-in forwards}@keyframes backdropIn{0%{opacity:0}to{opacity:1}}@keyframes backdropOut{0%{opacity:1}to{opacity:0}}@keyframes panelIn{0%{opacity:0;scale:.95;translate:0 8px}to{opacity:1;scale:1;translate:0}}@keyframes panelOut{0%{opacity:1;scale:1;translate:0}to{opacity:0;scale:.95;translate:0 8px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2306
|
+
}
|
|
2307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ConfirmDialogComponent, decorators: [{
|
|
2308
|
+
type: Component,
|
|
2309
|
+
args: [{ selector: 'app-confirm-dialog', imports: [], host: {
|
|
2310
|
+
'(document:keydown.escape)': '_onEscape($event)',
|
|
2311
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (_visible()) {\n <div\n class=\"fixed inset-0 z-50 flex items-center justify-center bg-[var(--modal-backdrop,oklch(0 0 0/0.45))]\"\n [class.backdrop-enter]=\"_isOpen() && !_isClosing()\"\n [class.backdrop-leave]=\"_isClosing()\"\n (click)=\"_onBackdropClick()\"\n >\n <div\n class=\"bg-[var(--color-surface,oklch(0.99 0 0))] border border-[var(--color-border,oklch(0.83 0.015 260))] rounded-[var(--radius-lg,0.75rem)] shadow-xl w-full max-w-sm mx-4 overflow-hidden text-[var(--color-text,oklch(0.14 0.01 260))]\"\n [class.panel-enter]=\"_isOpen() && !_isClosing()\"\n [class.panel-leave]=\"_isClosing()\"\n (click)=\"$event.stopPropagation()\"\n >\n @if (_title()) {\n <div class=\"flex items-center justify-between px-4 py-3 border-b border-[var(--color-border-light,oklch(0.91 0.01 260))]\">\n <h3 class=\"text-sm font-semibold\">{{ _title() }}</h3>\n </div>\n }\n\n <div class=\"flex flex-col items-center gap-3 px-6 py-6 text-center\">\n @if (_icon()) {\n <i class=\"{{ _icon() }} text-2xl text-[var(--color-primary,oklch(0.32 0.09 258))]\"></i>\n }\n <p class=\"text-sm text-[var(--color-text,oklch(0.14 0.01 260))]\">{{ message() }}</p>\n </div>\n\n <div class=\"flex items-center justify-end gap-2 px-4 py-3 border-t border-[var(--color-border-light,oklch(0.91 0.01 260))]\">\n <button\n type=\"button\"\n class=\"px-3 py-1.5 text-sm rounded-[var(--radius-md,0.5rem)] border border-[var(--color-border,oklch(0.83 0.015 260))] bg-transparent text-[var(--color-text,oklch(0.14 0.01 260))] cursor-pointer transition-colors duration-150 hover:bg-[var(--color-surface-alt,oklch(0.975 0.005 260))]\"\n (click)=\"_onCancel()\"\n >{{ _cancelText() }}</button>\n\n <button\n type=\"button\"\n [style.background-color]=\"_confirmBg()\"\n class=\"px-3 py-1.5 text-sm rounded-[var(--radius-md,0.5rem)] border-none text-white cursor-pointer transition-opacity duration-150 hover:opacity-90\"\n (click)=\"_onConfirm()\"\n >{{ _confirmText() }}</button>\n </div>\n </div>\n </div>\n}\n", styles: [":host{display:contents}.backdrop-enter{animation:backdropIn .2s ease-out}.backdrop-leave{animation:backdropOut .2s ease-in forwards}.panel-enter{animation:panelIn .2s ease-out}.panel-leave{animation:panelOut .18s ease-in forwards}@keyframes backdropIn{0%{opacity:0}to{opacity:1}}@keyframes backdropOut{0%{opacity:1}to{opacity:0}}@keyframes panelIn{0%{opacity:0;scale:.95;translate:0 8px}to{opacity:1;scale:1;translate:0}}@keyframes panelOut{0%{opacity:1;scale:1;translate:0}to{opacity:0;scale:.95;translate:0 8px}}\n"] }]
|
|
2312
|
+
}], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }], confirm: [{ type: i0.Output, args: ["confirm"] }], cancel: [{ type: i0.Output, args: ["cancel"] }] } });
|
|
2313
|
+
|
|
2314
|
+
class ModalComponent {
|
|
2315
|
+
_closeTimer = null;
|
|
2316
|
+
open = model(false, ...(ngDevMode ? [{ debugName: "open" }] : []));
|
|
2317
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
2318
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
2319
|
+
config = input({}, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
2320
|
+
closed = output();
|
|
2321
|
+
_closeOnBackdrop = computed(() => this.config().closeOnBackdrop ?? true, ...(ngDevMode ? [{ debugName: "_closeOnBackdrop" }] : []));
|
|
2322
|
+
_closeOnEscape = computed(() => this.config().closeOnEscape ?? true, ...(ngDevMode ? [{ debugName: "_closeOnEscape" }] : []));
|
|
2323
|
+
_showClose = computed(() => this.config().showCloseButton ?? true, ...(ngDevMode ? [{ debugName: "_showClose" }] : []));
|
|
2324
|
+
_maxWidth = computed(() => this.config().maxWidth ?? '500px', ...(ngDevMode ? [{ debugName: "_maxWidth" }] : []));
|
|
2325
|
+
_width = computed(() => this.width() || this._maxWidth(), ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
2326
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
2327
|
+
_isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : []));
|
|
2328
|
+
_visible = computed(() => this._isOpen() || this._isClosing(), ...(ngDevMode ? [{ debugName: "_visible" }] : []));
|
|
2329
|
+
constructor() {
|
|
2330
|
+
effect(() => {
|
|
2331
|
+
if (this.open() && !this._isOpen()) {
|
|
2332
|
+
this._isOpen.set(true);
|
|
2333
|
+
this._isClosing.set(false);
|
|
2334
|
+
}
|
|
2335
|
+
else if (!this.open() && this._isOpen()) {
|
|
2336
|
+
this._startClose();
|
|
2337
|
+
}
|
|
2338
|
+
});
|
|
2339
|
+
}
|
|
2340
|
+
_startClose() {
|
|
2341
|
+
if (this._closeTimer)
|
|
2342
|
+
clearTimeout(this._closeTimer);
|
|
2343
|
+
this._isClosing.set(true);
|
|
2344
|
+
this._closeTimer = setTimeout(() => {
|
|
2345
|
+
this._isOpen.set(false);
|
|
2346
|
+
this._isClosing.set(false);
|
|
2347
|
+
this.closed.emit();
|
|
2348
|
+
this._closeTimer = null;
|
|
2349
|
+
}, 200);
|
|
2350
|
+
}
|
|
2351
|
+
close() {
|
|
2352
|
+
if (this._isOpen()) {
|
|
2353
|
+
this._startClose();
|
|
2354
|
+
}
|
|
2355
|
+
this.open.set(false);
|
|
2356
|
+
}
|
|
2357
|
+
ngOnDestroy() {
|
|
2358
|
+
if (this._closeTimer)
|
|
2359
|
+
clearTimeout(this._closeTimer);
|
|
2360
|
+
}
|
|
2361
|
+
_onBackdropClick(_event) {
|
|
2362
|
+
if (this._closeOnBackdrop()) {
|
|
2363
|
+
this.close();
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
_onEscape(event) {
|
|
2367
|
+
if (this._closeOnEscape() && this._visible()) {
|
|
2368
|
+
event.preventDefault();
|
|
2369
|
+
this.close();
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2373
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: ModalComponent, isStandalone: true, selector: "app-modal", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", closed: "closed" }, host: { listeners: { "document:keydown.escape": "_onEscape($event)" } }, ngImport: i0, template: "@if (_visible()) {\n <div\n class=\"modal-backdrop fixed inset-0 z-50 flex items-center justify-center bg-[var(--modal-backdrop,oklch(0 0 0/0.45))]\"\n [class.backdrop-enter]=\"_isOpen() && !_isClosing()\"\n [class.backdrop-leave]=\"_isClosing()\"\n (click)=\"_onBackdropClick($event)\"\n >\n <div\n class=\"bg-[var(--color-surface,oklch(0.99 0 0))] border border-[var(--color-border,oklch(0.83 0.015 260))] rounded-[var(--radius-lg,0.75rem)] shadow-xl w-full mx-4 overflow-hidden text-[var(--color-text,oklch(0.14 0.01 260))]\"\n [style.max-width]=\"_width()\"\n [class.panel-enter]=\"_isOpen() && !_isClosing()\"\n [class.panel-leave]=\"_isClosing()\"\n (click)=\"$event.stopPropagation()\"\n >\n @if (title() || _showClose()) {\n <div class=\"flex items-center justify-between px-4 py-3\" [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\">\n <h3 class=\"text-sm font-semibold text-[var(--color-primary-inverse,oklch(0.99 0 0))]\">{{ title() }}</h3>\n @if (_showClose()) {\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-white/80 hover:bg-white/20 cursor-pointer transition-colors\"\n (click)=\"close()\"\n aria-label=\"Close\"\n >\n <i class=\"pi pi-times text-xs\"></i>\n </button>\n }\n </div>\n }\n\n <div class=\"px-4 py-4\">\n <ng-content />\n </div>\n\n <div class=\"modal-footer flex items-center justify-end gap-2 px-4 py-3 border-t border-[var(--color-border-light,oklch(0.91 0.01 260))]\">\n <ng-content select=\"[modal-footer]\" />\n </div>\n </div>\n </div>\n}\n", styles: [":host{display:contents}.modal-backdrop{--modal-backdrop: var(--color-backdrop, oklch(0 0 0 / .45))}.backdrop-enter{animation:backdropIn .2s ease-out}.backdrop-leave{animation:backdropOut .2s ease-in forwards}.panel-enter{animation:panelIn .2s ease-out}.panel-leave{animation:panelOut .18s ease-in forwards}@keyframes backdropIn{0%{opacity:0}to{opacity:1}}@keyframes backdropOut{0%{opacity:1}to{opacity:0}}.modal-footer:empty{display:none}@keyframes panelIn{0%{opacity:0;scale:.95;translate:0 8px}to{opacity:1;scale:1;translate:0}}@keyframes panelOut{0%{opacity:1;scale:1;translate:0}to{opacity:0;scale:.95;translate:0 8px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2374
|
+
}
|
|
2375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ModalComponent, decorators: [{
|
|
2376
|
+
type: Component,
|
|
2377
|
+
args: [{ selector: 'app-modal', imports: [], host: {
|
|
2378
|
+
'(document:keydown.escape)': '_onEscape($event)',
|
|
2379
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (_visible()) {\n <div\n class=\"modal-backdrop fixed inset-0 z-50 flex items-center justify-center bg-[var(--modal-backdrop,oklch(0 0 0/0.45))]\"\n [class.backdrop-enter]=\"_isOpen() && !_isClosing()\"\n [class.backdrop-leave]=\"_isClosing()\"\n (click)=\"_onBackdropClick($event)\"\n >\n <div\n class=\"bg-[var(--color-surface,oklch(0.99 0 0))] border border-[var(--color-border,oklch(0.83 0.015 260))] rounded-[var(--radius-lg,0.75rem)] shadow-xl w-full mx-4 overflow-hidden text-[var(--color-text,oklch(0.14 0.01 260))]\"\n [style.max-width]=\"_width()\"\n [class.panel-enter]=\"_isOpen() && !_isClosing()\"\n [class.panel-leave]=\"_isClosing()\"\n (click)=\"$event.stopPropagation()\"\n >\n @if (title() || _showClose()) {\n <div class=\"flex items-center justify-between px-4 py-3\" [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\">\n <h3 class=\"text-sm font-semibold text-[var(--color-primary-inverse,oklch(0.99 0 0))]\">{{ title() }}</h3>\n @if (_showClose()) {\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-7 h-7 p-0 border-none rounded-full bg-transparent text-white/80 hover:bg-white/20 cursor-pointer transition-colors\"\n (click)=\"close()\"\n aria-label=\"Close\"\n >\n <i class=\"pi pi-times text-xs\"></i>\n </button>\n }\n </div>\n }\n\n <div class=\"px-4 py-4\">\n <ng-content />\n </div>\n\n <div class=\"modal-footer flex items-center justify-end gap-2 px-4 py-3 border-t border-[var(--color-border-light,oklch(0.91 0.01 260))]\">\n <ng-content select=\"[modal-footer]\" />\n </div>\n </div>\n </div>\n}\n", styles: [":host{display:contents}.modal-backdrop{--modal-backdrop: var(--color-backdrop, oklch(0 0 0 / .45))}.backdrop-enter{animation:backdropIn .2s ease-out}.backdrop-leave{animation:backdropOut .2s ease-in forwards}.panel-enter{animation:panelIn .2s ease-out}.panel-leave{animation:panelOut .18s ease-in forwards}@keyframes backdropIn{0%{opacity:0}to{opacity:1}}@keyframes backdropOut{0%{opacity:1}to{opacity:0}}.modal-footer:empty{display:none}@keyframes panelIn{0%{opacity:0;scale:.95;translate:0 8px}to{opacity:1;scale:1;translate:0}}@keyframes panelOut{0%{opacity:1;scale:1;translate:0}to{opacity:0;scale:.95;translate:0 8px}}\n"] }]
|
|
2380
|
+
}], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
|
|
2381
|
+
|
|
2382
|
+
// Form
|
|
2383
|
+
|
|
2384
|
+
/**
|
|
2385
|
+
* Generated bundle index. Do not edit.
|
|
2386
|
+
*/
|
|
2387
|
+
|
|
2388
|
+
export { AccordionComponent, AccordionPanelComponent, AlertComponent, BadgeComponent, BannerSliderComponent, CarouselComponent, CheckboxComponent, ConfirmDialogComponent, DatePickerComponent, DropDownComponent, EmptyStateComponent, FileUploadComponent, ImageUploadComponent, ModalComponent, MultiSelectComponent, NavComponent, PasswordInputComponent, SearchInputComponent, SidebarComponent, SkeletonComponent, SpinnerComponent, THEME_COLORS, TableComponent, TableSkeletonComponent, TextInputComponent, ToastComponent, ToastService, ToggleComponent, TooltipComponent, isThemeColor };
|
|
2389
|
+
//# sourceMappingURL=abdelfattahqandil21-ryzen-ui.mjs.map
|