ryzen-ui 0.1.4
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 +1063 -0
- package/fesm2022/ryzen-ui.mjs +2337 -0
- package/fesm2022/ryzen-ui.mjs.map +1 -0
- package/index.d.ts +995 -0
- package/package.json +53 -0
|
@@ -0,0 +1,2337 @@
|
|
|
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.--rz-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<label class=\"rz-cb-field\" [class.is-disabled]=\"disabled()\">\n <span\n class=\"rz-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=\"rz-cb-indet\" style=\"background:white\"></span>\n }\n </span>\n\n @if (label()) {\n <span class=\"rz-cb-label\">{{ label() }}</span>\n }\n</label>\n\n@if (hint() && !error()) {\n <span class=\"rz-cb-msg rz-cb-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-cb-msg rz-cb-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-primary, oklch(.32 .09 258));--rz-bg: var(--color-surface, oklch(.99 0 0));--rz-border: var(--color-border, oklch(.83 .015 260));--rz-text: var(--color-text, oklch(.14 .01 260));--rz-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\"]){--rz-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--rz-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--rz-accent: var(--color-info, oklch(.55 .15 235))}.rz-cb-field{display:inline-flex;align-items:center;gap:.5rem;cursor:pointer}.rz-cb-field.is-disabled{opacity:.5;cursor:not-allowed}.rz-cb-box{display:inline-flex;align-items:center;justify-content:center;border:2px solid var(--rz-border);border-radius:4px;background:var(--rz-bg);transition:all .15s ease;flex-shrink:0}.rz-cb-box.is-checked,.rz-cb-box.is-indeterminate{background:var(--rz-accent);border-color:var(--rz-accent)}.rz-cb-box:focus-visible{outline:2px solid var(--rz-accent);outline-offset:2px}:host([data-size=\"sm\"]) .rz-cb-box{width:1rem;height:1rem;font-size:.625rem}:host([data-size=\"md\"]) .rz-cb-box{width:1.25rem;height:1.25rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-cb-box{width:1.5rem;height:1.5rem;font-size:.875rem}.rz-cb-indet{display:block;width:.5rem;height:.125rem;border-radius:9999px}.rz-cb-label{font-family:var(--font-sans);-webkit-user-select:none;user-select:none;color:var(--rz-text)}:host([data-size=\"sm\"]) .rz-cb-label{font-size:.75rem}:host([data-size=\"md\"]) .rz-cb-label{font-size:.875rem}:host([data-size=\"lg\"]) .rz-cb-label{font-size:1rem}:host(.has-error) .rz-cb-box{border-color:var(--color-danger, oklch(.55 .25 25))}.rz-cb-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-cb-hint{color:var(--color-text-muted)}.rz-cb-error{color:var(--color-danger)}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-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.--rz-accent]': '_rawAccent',
|
|
57
|
+
'[style.width]': '_width',
|
|
58
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<label class=\"rz-cb-field\" [class.is-disabled]=\"disabled()\">\n <span\n class=\"rz-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=\"rz-cb-indet\" style=\"background:white\"></span>\n }\n </span>\n\n @if (label()) {\n <span class=\"rz-cb-label\">{{ label() }}</span>\n }\n</label>\n\n@if (hint() && !error()) {\n <span class=\"rz-cb-msg rz-cb-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-cb-msg rz-cb-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-primary, oklch(.32 .09 258));--rz-bg: var(--color-surface, oklch(.99 0 0));--rz-border: var(--color-border, oklch(.83 .015 260));--rz-text: var(--color-text, oklch(.14 .01 260));--rz-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\"]){--rz-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--rz-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--rz-accent: var(--color-info, oklch(.55 .15 235))}.rz-cb-field{display:inline-flex;align-items:center;gap:.5rem;cursor:pointer}.rz-cb-field.is-disabled{opacity:.5;cursor:not-allowed}.rz-cb-box{display:inline-flex;align-items:center;justify-content:center;border:2px solid var(--rz-border);border-radius:4px;background:var(--rz-bg);transition:all .15s ease;flex-shrink:0}.rz-cb-box.is-checked,.rz-cb-box.is-indeterminate{background:var(--rz-accent);border-color:var(--rz-accent)}.rz-cb-box:focus-visible{outline:2px solid var(--rz-accent);outline-offset:2px}:host([data-size=\"sm\"]) .rz-cb-box{width:1rem;height:1rem;font-size:.625rem}:host([data-size=\"md\"]) .rz-cb-box{width:1.25rem;height:1.25rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-cb-box{width:1.5rem;height:1.5rem;font-size:.875rem}.rz-cb-indet{display:block;width:.5rem;height:.125rem;border-radius:9999px}.rz-cb-label{font-family:var(--font-sans);-webkit-user-select:none;user-select:none;color:var(--rz-text)}:host([data-size=\"sm\"]) .rz-cb-label{font-size:.75rem}:host([data-size=\"md\"]) .rz-cb-label{font-size:.875rem}:host([data-size=\"lg\"]) .rz-cb-label{font-size:1rem}:host(.has-error) .rz-cb-box{border-color:var(--color-danger, oklch(.55 .25 25))}.rz-cb-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-cb-hint{color:var(--color-text-muted)}.rz-cb-error{color:var(--color-danger)}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-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
|
+
/* ── actions ── */
|
|
192
|
+
_onTriggerClick(event) {
|
|
193
|
+
if (this.disabled())
|
|
194
|
+
return;
|
|
195
|
+
if (this._isOpen()) {
|
|
196
|
+
this._close();
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
this._open();
|
|
200
|
+
}
|
|
201
|
+
_onPanelClick(event) {
|
|
202
|
+
event.stopPropagation();
|
|
203
|
+
}
|
|
204
|
+
_open() {
|
|
205
|
+
this._isClosing.set(false);
|
|
206
|
+
this._isOpen.set(true);
|
|
207
|
+
const d = new Date();
|
|
208
|
+
d.setHours(0, 0, 0, 0);
|
|
209
|
+
this._today.set(d);
|
|
210
|
+
this._viewMode.set('days');
|
|
211
|
+
const val = this.value();
|
|
212
|
+
if (val)
|
|
213
|
+
this._viewDate.set(new Date(val.getFullYear(), val.getMonth(), 1));
|
|
214
|
+
this._decade.set(Math.floor(this._viewDate().getFullYear() / 10) * 10);
|
|
215
|
+
const rect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
216
|
+
this._panelDirection.set(window.innerHeight - rect.bottom >= 320 ? 'down' : 'up');
|
|
217
|
+
if (this._appendToParent()) {
|
|
218
|
+
this._panelX.set(rect.left);
|
|
219
|
+
this._panelY.set(this._panelDirection() === 'down' ? rect.bottom : rect.top);
|
|
220
|
+
this._panelWidth.set(rect.width);
|
|
221
|
+
setTimeout(() => this._attachToBody());
|
|
222
|
+
}
|
|
223
|
+
const handler = (e) => this._onDocClick(e);
|
|
224
|
+
document.addEventListener('click', handler);
|
|
225
|
+
this._docClickCleanup = () => document.removeEventListener('click', handler);
|
|
226
|
+
}
|
|
227
|
+
_attachToBody() {
|
|
228
|
+
const panel = this._elementRef.nativeElement.querySelector('[data-dp-panel]');
|
|
229
|
+
if (panel) {
|
|
230
|
+
document.body.appendChild(panel);
|
|
231
|
+
this._panelEl = panel;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
_detachFromBody() {
|
|
235
|
+
if (!this._panelEl)
|
|
236
|
+
return;
|
|
237
|
+
const wrapper = this._elementRef.nativeElement.querySelector('.dp-wrapper');
|
|
238
|
+
if (wrapper && this._panelEl.parentNode !== wrapper) {
|
|
239
|
+
wrapper.appendChild(this._panelEl);
|
|
240
|
+
}
|
|
241
|
+
this._panelEl = null;
|
|
242
|
+
}
|
|
243
|
+
_close() {
|
|
244
|
+
if (!this._isOpen())
|
|
245
|
+
return;
|
|
246
|
+
this._docClickCleanup?.();
|
|
247
|
+
this._docClickCleanup = undefined;
|
|
248
|
+
if (this._closeTimer)
|
|
249
|
+
clearTimeout(this._closeTimer);
|
|
250
|
+
this._isClosing.set(true);
|
|
251
|
+
if (this._appendToParent())
|
|
252
|
+
this._detachFromBody();
|
|
253
|
+
this._closeTimer = setTimeout(() => {
|
|
254
|
+
this._isOpen.set(false);
|
|
255
|
+
this._isClosing.set(false);
|
|
256
|
+
this._viewMode.set('days');
|
|
257
|
+
this._closeTimer = null;
|
|
258
|
+
}, 150);
|
|
259
|
+
}
|
|
260
|
+
ngOnDestroy() {
|
|
261
|
+
this._docClickCleanup?.();
|
|
262
|
+
if (this._closeTimer)
|
|
263
|
+
clearTimeout(this._closeTimer);
|
|
264
|
+
if (this._panelEl && document.body.contains(this._panelEl)) {
|
|
265
|
+
document.body.removeChild(this._panelEl);
|
|
266
|
+
this._panelEl = null;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
_selectDate(date) {
|
|
270
|
+
const d = new Date(date);
|
|
271
|
+
const cfg = this.config();
|
|
272
|
+
if (cfg.minDate && d < cfg.minDate)
|
|
273
|
+
return;
|
|
274
|
+
if (cfg.maxDate && d > cfg.maxDate)
|
|
275
|
+
return;
|
|
276
|
+
if (cfg.disabledDates?.some(x => this._sameDay(x, d)))
|
|
277
|
+
return;
|
|
278
|
+
this.value.set(d);
|
|
279
|
+
this._close();
|
|
280
|
+
}
|
|
281
|
+
_selectMonth(idx) {
|
|
282
|
+
this._viewDate.set(new Date(this._year(), idx, 1));
|
|
283
|
+
this._viewMode.set('days');
|
|
284
|
+
}
|
|
285
|
+
_selectYear(year) {
|
|
286
|
+
this._viewDate.set(new Date(year, this._viewDate().getMonth(), 1));
|
|
287
|
+
this._viewMode.set('months');
|
|
288
|
+
}
|
|
289
|
+
_prevMonth() { this._viewDate.update(d => new Date(d.getFullYear(), d.getMonth() - 1, 1)); }
|
|
290
|
+
_nextMonth() { this._viewDate.update(d => new Date(d.getFullYear(), d.getMonth() + 1, 1)); }
|
|
291
|
+
_prevYear() { this._viewDate.update(d => new Date(d.getFullYear() - 1, d.getMonth(), 1)); }
|
|
292
|
+
_nextYear() { this._viewDate.update(d => new Date(d.getFullYear() + 1, d.getMonth(), 1)); }
|
|
293
|
+
_prevDecade() { this._decade.update(v => v - 10); }
|
|
294
|
+
_nextDecade() { this._decade.update(v => v + 10); }
|
|
295
|
+
_showMonths() { this._viewMode.set('months'); }
|
|
296
|
+
_showYears() {
|
|
297
|
+
this._decade.set(Math.floor(this._viewDate().getFullYear() / 10) * 10);
|
|
298
|
+
this._viewMode.set('years');
|
|
299
|
+
}
|
|
300
|
+
_prevPeriod() {
|
|
301
|
+
const m = this._viewMode();
|
|
302
|
+
if (m === 'days')
|
|
303
|
+
this._prevMonth();
|
|
304
|
+
else if (m === 'months')
|
|
305
|
+
this._prevYear();
|
|
306
|
+
else
|
|
307
|
+
this._prevDecade();
|
|
308
|
+
}
|
|
309
|
+
_nextPeriod() {
|
|
310
|
+
const m = this._viewMode();
|
|
311
|
+
if (m === 'days')
|
|
312
|
+
this._nextMonth();
|
|
313
|
+
else if (m === 'months')
|
|
314
|
+
this._nextYear();
|
|
315
|
+
else
|
|
316
|
+
this._nextDecade();
|
|
317
|
+
}
|
|
318
|
+
_goToToday() {
|
|
319
|
+
const today = new Date();
|
|
320
|
+
this._viewDate.set(new Date(today.getFullYear(), today.getMonth(), 1));
|
|
321
|
+
this._viewMode.set('days');
|
|
322
|
+
this._selectDate(today);
|
|
323
|
+
}
|
|
324
|
+
_clear(event) {
|
|
325
|
+
event.stopPropagation();
|
|
326
|
+
this.value.set(null);
|
|
327
|
+
}
|
|
328
|
+
_isCurrentMonth(idx) { return this._viewDate().getMonth() === idx; }
|
|
329
|
+
_isCurrentYear(year) { return this._viewDate().getFullYear() === year; }
|
|
330
|
+
_onDocClick(event) {
|
|
331
|
+
if (!this._isOpen())
|
|
332
|
+
return;
|
|
333
|
+
const target = event.target;
|
|
334
|
+
if (this._elementRef.nativeElement.contains(target))
|
|
335
|
+
return;
|
|
336
|
+
if (this._panelEl?.contains(target))
|
|
337
|
+
return;
|
|
338
|
+
this._close();
|
|
339
|
+
}
|
|
340
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: DatePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
341
|
+
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.--rz-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<div class=\"rz-dp-wrapper\">\n <label class=\"rz-dp-trigger\" (click)=\"_onTriggerClick($event)\">\n <input\n class=\"rz-dp-input\"\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=\"rz-dp-clear\" type=\"button\" (click)=\"_clear($event)\" aria-label=\"Clear date\">\n <i class=\"pi pi-times\"></i>\n </button>\n }\n\n <i class=\"rz-dp-icon pi pi-calendar\"></i>\n </label>\n\n @if (_isOpen() || _isClosing()) {\n <div\n data-dp-panel\n class=\"rz-dp-panel\"\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.rz-dp-fade-in]=\"_isOpen() && !_isClosing()\"\n [class.rz-dp-fade-out]=\"_isClosing()\"\n (click)=\"_onPanelClick($event)\">\n\n <div class=\"rz-dp-header\" [style.background-color]=\"_accentColorValue()\">\n <div class=\"rz-dp-nav\">\n @if (_viewMode() === 'days' && _showYearNav()) {\n <button type=\"button\" class=\"rz-dp-nav-btn\" (click)=\"_prevYear()\" aria-label=\"Previous year\">\n <i class=\"pi pi-angle-double-left\"></i>\n </button>\n }\n @if (_viewMode() !== 'years') {\n <button type=\"button\" class=\"rz-dp-nav-btn\" (click)=\"_prevPeriod()\" aria-label=\"Previous\">\n <i class=\"pi pi-angle-left\"></i>\n </button>\n }\n\n <div class=\"rz-dp-nav-title\">\n @if (_viewMode() === 'days') {\n <button type=\"button\" class=\"rz-dp-nav-link\" (click)=\"_showMonths()\">{{ _monthName() }}</button>\n <button type=\"button\" class=\"rz-dp-nav-link\" (click)=\"_showYears()\">{{ _year() }}</button>\n }\n @if (_viewMode() === 'months') {\n <button type=\"button\" class=\"rz-dp-nav-link\" (click)=\"_showYears()\">{{ _year() }}</button>\n }\n @if (_viewMode() === 'years') {\n <span class=\"rz-dp-decade-label\">{{ _decadeLabel() }}</span>\n }\n </div>\n\n @if (_viewMode() !== 'years') {\n <button type=\"button\" class=\"rz-dp-nav-btn\" (click)=\"_nextPeriod()\" aria-label=\"Next\">\n <i class=\"pi pi-angle-right\"></i>\n </button>\n }\n @if (_viewMode() === 'days' && _showYearNav()) {\n <button type=\"button\" class=\"rz-dp-nav-btn\" (click)=\"_nextYear()\" aria-label=\"Next year\">\n <i class=\"pi pi-angle-double-right\"></i>\n </button>\n }\n </div>\n\n @if (_showTodayBtn() && _viewMode() === 'days') {\n <button type=\"button\" class=\"rz-dp-today-btn\" (click)=\"_goToToday()\">\n <i class=\"pi pi-calendar-plus\"></i>\n Today\n </button>\n }\n </div>\n\n @if (_viewMode() === 'days') {\n <div class=\"rz-dp-days-view\">\n <div class=\"rz-dp-weekdays\">\n @for (day of _weekDaysOrdered(); track $index) {\n <div class=\"rz-dp-weekday-cell\">{{ day }}</div>\n }\n </div>\n <div class=\"rz-dp-days-grid\">\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=\"rz-dp-day\"\n [class.other-month]=\"!day.isCurrentMonth && !day.isSelected\"\n [class.today]=\"day.isToday && !day.isSelected\"\n [class.selected]=\"day.isSelected\"\n [class.highlighted]=\"day.isHighlighted && !day.isSelected\"\n [class.disabled]=\"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 @if (_viewMode() === 'months') {\n <div class=\"rz-dp-months-grid\">\n @for (month of _monthNames; track $index) {\n <button\n type=\"button\"\n class=\"rz-dp-month-btn\"\n [class.current]=\"_isCurrentMonth($index)\"\n (click)=\"_selectMonth($index)\"\n >{{ _monthsShort[$index] }}</button>\n }\n </div>\n }\n\n @if (_viewMode() === 'years') {\n <div class=\"rz-dp-years-view\">\n <div class=\"rz-dp-years-nav\">\n <button type=\"button\" class=\"rz-dp-nav-btn\" (click)=\"_prevDecade()\">\n <i class=\"pi pi-chevron-left\"></i>\n </button>\n <span class=\"rz-dp-decade-label\">{{ _decadeLabel() }}</span>\n <button type=\"button\" class=\"rz-dp-nav-btn\" (click)=\"_nextDecade()\">\n <i class=\"pi pi-chevron-right\"></i>\n </button>\n </div>\n <div class=\"rz-dp-years-grid\">\n @for (year of _yearsList(); track $index) {\n <button\n type=\"button\"\n class=\"rz-dp-year-btn\"\n [class.current]=\"_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=\"rz-dp-msg rz-dp-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-dp-msg rz-dp-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}", styles: [":host{--rz-accent: var(--color-primary, oklch(.32 .09 258));--rz-bg: var(--color-surface, oklch(.99 0 0));--rz-border: var(--color-border, oklch(.83 .015 260));--rz-text: var(--color-text, oklch(.14 .01 260));--rz-muted: var(--color-text-muted, oklch(.48 .01 260));--rz-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\"]){--rz-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--rz-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--rz-accent: var(--color-info, oklch(.55 .15 235))}:host.has-error .rz-dp-input{border-color:var(--color-danger)!important}:host.has-error .rz-dp-input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.rz-dp-wrapper{position:relative;overflow:visible}.rz-dp-trigger{display:flex;align-items:center;width:100%}.rz-dp-input{width:100%;outline:none;background:var(--rz-bg);border:1px solid var(--rz-border);border-radius:var(--rz-radius);color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem 2.75rem .5rem .75rem;font-size:.875rem;transition:border-color .2s ease,box-shadow .2s ease;cursor:pointer;box-sizing:border-box}.rz-dp-input::placeholder{color:var(--rz-muted)}.rz-dp-input:disabled{opacity:.5;cursor:not-allowed}.rz-dp-input:focus{border-color:var(--rz-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--rz-accent) 20%,transparent)}:host([data-size=\"sm\"]) .rz-dp-input{padding:.25rem 2.25rem .25rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-dp-input{padding:.75rem 3rem .75rem 1rem;font-size:1rem}.rz-dp-clear{position:absolute;top:50%;translate:0 -50%;inset-inline-end:2rem;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;cursor:pointer;color:var(--rz-muted);font-size:.75rem;transition:color .15s}.rz-dp-clear:hover{color:var(--rz-text)}.rz-dp-icon{position:absolute;top:50%;translate:0 -50%;inset-inline-end:.625rem;pointer-events:none;color:var(--rz-accent);font-size:1rem;line-height:1;display:flex;align-items:center;justify-content:center}:host([data-size=\"sm\"]) .rz-dp-icon{inset-inline-end:.5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-dp-icon{inset-inline-end:.75rem;font-size:1.125rem}.rz-dp-panel{left:0;z-index:50;width:100%;min-width:17.5rem;background:var(--color-surface, oklch(.99 0 0));border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:var(--radius-md, .5rem);box-shadow:0 10px 15px -3px color-mix(in srgb,var(--color-text) 10%,transparent),0 4px 6px -4px color-mix(in srgb,var(--color-text) 10%,transparent);overflow:hidden;color:var(--color-text, oklch(.14 .01 260));box-sizing:border-box}.rz-dp-panel.absolute{position:absolute}.rz-dp-header{padding:.75rem;color:#fff}.rz-dp-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:.375rem}.rz-dp-nav-btn{display:flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;padding:0;border:none;border-radius:50%;background:transparent;color:color-mix(in srgb,white 80%,transparent);cursor:pointer;transition:background .15s;font-size:.75rem;flex-shrink:0}.rz-dp-nav-btn:hover{background:color-mix(in srgb,white 20%,transparent)}.rz-dp-nav-title{display:flex;align-items:center;gap:.25rem;font-size:.875rem;font-weight:600}.rz-dp-nav-link{padding:.125rem .375rem;border:none;border-radius:.25rem;background:transparent;color:#fff;cursor:pointer;transition:background .15s}.rz-dp-nav-link:hover{background:color-mix(in srgb,white 20%,transparent)}.rz-dp-decade-label{padding:0 .375rem}.rz-dp-today-btn{width:100%;display:flex;align-items:center;justify-content:center;gap:.375rem;padding:.25rem .5rem;border:none;border-radius:.25rem;background:color-mix(in srgb,white 20%,transparent);color:#fff;font-size:.75rem;cursor:pointer;transition:background .15s}.rz-dp-today-btn:hover{background:color-mix(in srgb,white 30%,transparent)}.rz-dp-days-view{padding:.625rem;box-sizing:border-box}.rz-dp-weekdays{display:grid;grid-template-columns:repeat(7,1fr);margin-bottom:.125rem;width:100%}.rz-dp-weekday-cell{display:flex;align-items:center;justify-content:center;height:1.75rem;font-size:.75rem;font-weight:500;color:var(--color-text-muted);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);min-width:0}.rz-dp-days-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:.125rem;width:100%}.rz-dp-day{display:flex;align-items:center;justify-content:center;width:100%;aspect-ratio:1;max-width:2.5rem;margin:0 auto;padding:0;border:none;border-radius:50%;cursor:pointer;font-size:.875rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);transition:all .15s;color:var(--rz-text);min-width:0;box-sizing:border-box}.rz-dp-day.other-month{color:var(--rz-muted)}.rz-dp-day.today{font-weight:600;box-shadow:0 0 0 2px var(--rz-accent)}.rz-dp-day.selected{background:var(--rz-accent);color:#fff;font-weight:600}.rz-dp-day.highlighted{background:var(--color-surface-alt, oklch(.975 .005 260))}.rz-dp-day.disabled{opacity:.3;cursor:not-allowed}.rz-dp-day:not(.selected):not(.disabled):hover{background:var(--color-surface-alt, oklch(.975 .005 260))}.rz-dp-months-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:.5rem;padding:.75rem}.rz-dp-month-btn{padding:.5rem;border-radius:.5rem;border:none;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);transition:background .15s,color .15s;cursor:pointer;color:var(--rz-text);background:transparent}.rz-dp-month-btn.current{background:var(--rz-accent);color:#fff}.rz-dp-month-btn:not(.current):hover{background:var(--color-surface-alt, oklch(.975 .005 260))}.rz-dp-years-view{padding:.625rem}.rz-dp-years-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:.5rem;padding:0 .25rem}.rz-dp-years-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:.5rem}.rz-dp-year-btn{padding:.5rem;border-radius:.5rem;border:none;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);transition:background .15s,color .15s;cursor:pointer;color:var(--rz-text);background:transparent}.rz-dp-year-btn.current{background:var(--rz-accent);color:#fff}.rz-dp-year-btn:not(.current):hover{background:var(--color-surface-alt, oklch(.975 .005 260))}.rz-dp-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-dp-hint{color:var(--color-text-muted)}.rz-dp-error{color:var(--color-danger)}.rz-dp-fade-in{animation:rz-dp-in .2s ease}.rz-dp-fade-out{animation:rz-dp-out .15s ease forwards}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-dp-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes rz-dp-out{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
342
|
+
}
|
|
343
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: DatePickerComponent, decorators: [{
|
|
344
|
+
type: Component,
|
|
345
|
+
args: [{ selector: 'app-date-picker', imports: [], host: {
|
|
346
|
+
'[attr.data-size]': '_size',
|
|
347
|
+
'[attr.data-accent]': '_accentKey',
|
|
348
|
+
'[class.has-error]': 'error()',
|
|
349
|
+
'[style.--rz-accent]': '_rawAccent',
|
|
350
|
+
'[style.width]': '_width',
|
|
351
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"rz-dp-wrapper\">\n <label class=\"rz-dp-trigger\" (click)=\"_onTriggerClick($event)\">\n <input\n class=\"rz-dp-input\"\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=\"rz-dp-clear\" type=\"button\" (click)=\"_clear($event)\" aria-label=\"Clear date\">\n <i class=\"pi pi-times\"></i>\n </button>\n }\n\n <i class=\"rz-dp-icon pi pi-calendar\"></i>\n </label>\n\n @if (_isOpen() || _isClosing()) {\n <div\n data-dp-panel\n class=\"rz-dp-panel\"\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.rz-dp-fade-in]=\"_isOpen() && !_isClosing()\"\n [class.rz-dp-fade-out]=\"_isClosing()\"\n (click)=\"_onPanelClick($event)\">\n\n <div class=\"rz-dp-header\" [style.background-color]=\"_accentColorValue()\">\n <div class=\"rz-dp-nav\">\n @if (_viewMode() === 'days' && _showYearNav()) {\n <button type=\"button\" class=\"rz-dp-nav-btn\" (click)=\"_prevYear()\" aria-label=\"Previous year\">\n <i class=\"pi pi-angle-double-left\"></i>\n </button>\n }\n @if (_viewMode() !== 'years') {\n <button type=\"button\" class=\"rz-dp-nav-btn\" (click)=\"_prevPeriod()\" aria-label=\"Previous\">\n <i class=\"pi pi-angle-left\"></i>\n </button>\n }\n\n <div class=\"rz-dp-nav-title\">\n @if (_viewMode() === 'days') {\n <button type=\"button\" class=\"rz-dp-nav-link\" (click)=\"_showMonths()\">{{ _monthName() }}</button>\n <button type=\"button\" class=\"rz-dp-nav-link\" (click)=\"_showYears()\">{{ _year() }}</button>\n }\n @if (_viewMode() === 'months') {\n <button type=\"button\" class=\"rz-dp-nav-link\" (click)=\"_showYears()\">{{ _year() }}</button>\n }\n @if (_viewMode() === 'years') {\n <span class=\"rz-dp-decade-label\">{{ _decadeLabel() }}</span>\n }\n </div>\n\n @if (_viewMode() !== 'years') {\n <button type=\"button\" class=\"rz-dp-nav-btn\" (click)=\"_nextPeriod()\" aria-label=\"Next\">\n <i class=\"pi pi-angle-right\"></i>\n </button>\n }\n @if (_viewMode() === 'days' && _showYearNav()) {\n <button type=\"button\" class=\"rz-dp-nav-btn\" (click)=\"_nextYear()\" aria-label=\"Next year\">\n <i class=\"pi pi-angle-double-right\"></i>\n </button>\n }\n </div>\n\n @if (_showTodayBtn() && _viewMode() === 'days') {\n <button type=\"button\" class=\"rz-dp-today-btn\" (click)=\"_goToToday()\">\n <i class=\"pi pi-calendar-plus\"></i>\n Today\n </button>\n }\n </div>\n\n @if (_viewMode() === 'days') {\n <div class=\"rz-dp-days-view\">\n <div class=\"rz-dp-weekdays\">\n @for (day of _weekDaysOrdered(); track $index) {\n <div class=\"rz-dp-weekday-cell\">{{ day }}</div>\n }\n </div>\n <div class=\"rz-dp-days-grid\">\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=\"rz-dp-day\"\n [class.other-month]=\"!day.isCurrentMonth && !day.isSelected\"\n [class.today]=\"day.isToday && !day.isSelected\"\n [class.selected]=\"day.isSelected\"\n [class.highlighted]=\"day.isHighlighted && !day.isSelected\"\n [class.disabled]=\"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 @if (_viewMode() === 'months') {\n <div class=\"rz-dp-months-grid\">\n @for (month of _monthNames; track $index) {\n <button\n type=\"button\"\n class=\"rz-dp-month-btn\"\n [class.current]=\"_isCurrentMonth($index)\"\n (click)=\"_selectMonth($index)\"\n >{{ _monthsShort[$index] }}</button>\n }\n </div>\n }\n\n @if (_viewMode() === 'years') {\n <div class=\"rz-dp-years-view\">\n <div class=\"rz-dp-years-nav\">\n <button type=\"button\" class=\"rz-dp-nav-btn\" (click)=\"_prevDecade()\">\n <i class=\"pi pi-chevron-left\"></i>\n </button>\n <span class=\"rz-dp-decade-label\">{{ _decadeLabel() }}</span>\n <button type=\"button\" class=\"rz-dp-nav-btn\" (click)=\"_nextDecade()\">\n <i class=\"pi pi-chevron-right\"></i>\n </button>\n </div>\n <div class=\"rz-dp-years-grid\">\n @for (year of _yearsList(); track $index) {\n <button\n type=\"button\"\n class=\"rz-dp-year-btn\"\n [class.current]=\"_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=\"rz-dp-msg rz-dp-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-dp-msg rz-dp-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}", styles: [":host{--rz-accent: var(--color-primary, oklch(.32 .09 258));--rz-bg: var(--color-surface, oklch(.99 0 0));--rz-border: var(--color-border, oklch(.83 .015 260));--rz-text: var(--color-text, oklch(.14 .01 260));--rz-muted: var(--color-text-muted, oklch(.48 .01 260));--rz-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\"]){--rz-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--rz-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--rz-accent: var(--color-info, oklch(.55 .15 235))}:host.has-error .rz-dp-input{border-color:var(--color-danger)!important}:host.has-error .rz-dp-input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.rz-dp-wrapper{position:relative;overflow:visible}.rz-dp-trigger{display:flex;align-items:center;width:100%}.rz-dp-input{width:100%;outline:none;background:var(--rz-bg);border:1px solid var(--rz-border);border-radius:var(--rz-radius);color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem 2.75rem .5rem .75rem;font-size:.875rem;transition:border-color .2s ease,box-shadow .2s ease;cursor:pointer;box-sizing:border-box}.rz-dp-input::placeholder{color:var(--rz-muted)}.rz-dp-input:disabled{opacity:.5;cursor:not-allowed}.rz-dp-input:focus{border-color:var(--rz-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--rz-accent) 20%,transparent)}:host([data-size=\"sm\"]) .rz-dp-input{padding:.25rem 2.25rem .25rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-dp-input{padding:.75rem 3rem .75rem 1rem;font-size:1rem}.rz-dp-clear{position:absolute;top:50%;translate:0 -50%;inset-inline-end:2rem;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;cursor:pointer;color:var(--rz-muted);font-size:.75rem;transition:color .15s}.rz-dp-clear:hover{color:var(--rz-text)}.rz-dp-icon{position:absolute;top:50%;translate:0 -50%;inset-inline-end:.625rem;pointer-events:none;color:var(--rz-accent);font-size:1rem;line-height:1;display:flex;align-items:center;justify-content:center}:host([data-size=\"sm\"]) .rz-dp-icon{inset-inline-end:.5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-dp-icon{inset-inline-end:.75rem;font-size:1.125rem}.rz-dp-panel{left:0;z-index:50;width:100%;min-width:17.5rem;background:var(--color-surface, oklch(.99 0 0));border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:var(--radius-md, .5rem);box-shadow:0 10px 15px -3px color-mix(in srgb,var(--color-text) 10%,transparent),0 4px 6px -4px color-mix(in srgb,var(--color-text) 10%,transparent);overflow:hidden;color:var(--color-text, oklch(.14 .01 260));box-sizing:border-box}.rz-dp-panel.absolute{position:absolute}.rz-dp-header{padding:.75rem;color:#fff}.rz-dp-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:.375rem}.rz-dp-nav-btn{display:flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;padding:0;border:none;border-radius:50%;background:transparent;color:color-mix(in srgb,white 80%,transparent);cursor:pointer;transition:background .15s;font-size:.75rem;flex-shrink:0}.rz-dp-nav-btn:hover{background:color-mix(in srgb,white 20%,transparent)}.rz-dp-nav-title{display:flex;align-items:center;gap:.25rem;font-size:.875rem;font-weight:600}.rz-dp-nav-link{padding:.125rem .375rem;border:none;border-radius:.25rem;background:transparent;color:#fff;cursor:pointer;transition:background .15s}.rz-dp-nav-link:hover{background:color-mix(in srgb,white 20%,transparent)}.rz-dp-decade-label{padding:0 .375rem}.rz-dp-today-btn{width:100%;display:flex;align-items:center;justify-content:center;gap:.375rem;padding:.25rem .5rem;border:none;border-radius:.25rem;background:color-mix(in srgb,white 20%,transparent);color:#fff;font-size:.75rem;cursor:pointer;transition:background .15s}.rz-dp-today-btn:hover{background:color-mix(in srgb,white 30%,transparent)}.rz-dp-days-view{padding:.625rem;box-sizing:border-box}.rz-dp-weekdays{display:grid;grid-template-columns:repeat(7,1fr);margin-bottom:.125rem;width:100%}.rz-dp-weekday-cell{display:flex;align-items:center;justify-content:center;height:1.75rem;font-size:.75rem;font-weight:500;color:var(--color-text-muted);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);min-width:0}.rz-dp-days-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:.125rem;width:100%}.rz-dp-day{display:flex;align-items:center;justify-content:center;width:100%;aspect-ratio:1;max-width:2.5rem;margin:0 auto;padding:0;border:none;border-radius:50%;cursor:pointer;font-size:.875rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);transition:all .15s;color:var(--rz-text);min-width:0;box-sizing:border-box}.rz-dp-day.other-month{color:var(--rz-muted)}.rz-dp-day.today{font-weight:600;box-shadow:0 0 0 2px var(--rz-accent)}.rz-dp-day.selected{background:var(--rz-accent);color:#fff;font-weight:600}.rz-dp-day.highlighted{background:var(--color-surface-alt, oklch(.975 .005 260))}.rz-dp-day.disabled{opacity:.3;cursor:not-allowed}.rz-dp-day:not(.selected):not(.disabled):hover{background:var(--color-surface-alt, oklch(.975 .005 260))}.rz-dp-months-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:.5rem;padding:.75rem}.rz-dp-month-btn{padding:.5rem;border-radius:.5rem;border:none;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);transition:background .15s,color .15s;cursor:pointer;color:var(--rz-text);background:transparent}.rz-dp-month-btn.current{background:var(--rz-accent);color:#fff}.rz-dp-month-btn:not(.current):hover{background:var(--color-surface-alt, oklch(.975 .005 260))}.rz-dp-years-view{padding:.625rem}.rz-dp-years-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:.5rem;padding:0 .25rem}.rz-dp-years-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:.5rem}.rz-dp-year-btn{padding:.5rem;border-radius:.5rem;border:none;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);transition:background .15s,color .15s;cursor:pointer;color:var(--rz-text);background:transparent}.rz-dp-year-btn.current{background:var(--rz-accent);color:#fff}.rz-dp-year-btn:not(.current):hover{background:var(--color-surface-alt, oklch(.975 .005 260))}.rz-dp-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-dp-hint{color:var(--color-text-muted)}.rz-dp-error{color:var(--color-danger)}.rz-dp-fade-in{animation:rz-dp-in .2s ease}.rz-dp-fade-out{animation:rz-dp-out .15s ease forwards}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-dp-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes rz-dp-out{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
352
|
+
}], 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 }] }] } });
|
|
353
|
+
|
|
354
|
+
class DropDownComponent {
|
|
355
|
+
_elementRef = inject(ElementRef);
|
|
356
|
+
_closeTimer = null;
|
|
357
|
+
_docClickCleanup;
|
|
358
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
359
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
360
|
+
placeholder = input('Select...', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
361
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
362
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
363
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
364
|
+
searchable = input(false, ...(ngDevMode ? [{ debugName: "searchable" }] : []));
|
|
365
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
366
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
367
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
368
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
369
|
+
config = input({}, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
370
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
371
|
+
_direction = computed(() => this.config().direction ?? 'up', ...(ngDevMode ? [{ debugName: "_direction" }] : []));
|
|
372
|
+
_accentKey = computed(() => {
|
|
373
|
+
const c = this.accentColor();
|
|
374
|
+
return c && isThemeColor(c) ? c : null;
|
|
375
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
376
|
+
_rawAccent = computed(() => {
|
|
377
|
+
const c = this.accentColor();
|
|
378
|
+
return c && !isThemeColor(c) ? c : null;
|
|
379
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
380
|
+
_accentColorValue = computed(() => {
|
|
381
|
+
const c = this.accentColor();
|
|
382
|
+
if (c && !isThemeColor(c))
|
|
383
|
+
return c;
|
|
384
|
+
const key = c && isThemeColor(c) ? c : 'primary';
|
|
385
|
+
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)' };
|
|
386
|
+
return `var(--color-${key}, ${fallbacks[key]})`;
|
|
387
|
+
}, ...(ngDevMode ? [{ debugName: "_accentColorValue" }] : []));
|
|
388
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
389
|
+
_normalizedOptions = computed(() => this.options().map(o => typeof o === 'string' ? { label: o, value: o } : o), ...(ngDevMode ? [{ debugName: "_normalizedOptions" }] : []));
|
|
390
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
391
|
+
_isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : []));
|
|
392
|
+
_panelDirection = signal('down', ...(ngDevMode ? [{ debugName: "_panelDirection" }] : []));
|
|
393
|
+
_panelX = signal(0, ...(ngDevMode ? [{ debugName: "_panelX" }] : []));
|
|
394
|
+
_panelY = signal(0, ...(ngDevMode ? [{ debugName: "_panelY" }] : []));
|
|
395
|
+
_panelWidth = signal(0, ...(ngDevMode ? [{ debugName: "_panelWidth" }] : []));
|
|
396
|
+
_panelEl = null;
|
|
397
|
+
_searchQuery = signal('', ...(ngDevMode ? [{ debugName: "_searchQuery" }] : []));
|
|
398
|
+
_appendToParent = computed(() => this.config().appendToParent ?? false, ...(ngDevMode ? [{ debugName: "_appendToParent" }] : []));
|
|
399
|
+
_panelFixed = computed(() => this._isOpen() && this._appendToParent() ? 'fixed' : null, ...(ngDevMode ? [{ debugName: "_panelFixed" }] : []));
|
|
400
|
+
_maxHeight = computed(() => this.config().maxHeight ?? '256px', ...(ngDevMode ? [{ debugName: "_maxHeight" }] : []));
|
|
401
|
+
_selectedLabel = computed(() => {
|
|
402
|
+
const v = this.value();
|
|
403
|
+
if (!v)
|
|
404
|
+
return '';
|
|
405
|
+
const found = this._normalizedOptions().find(o => o.value === v);
|
|
406
|
+
return found ? found.label : v;
|
|
407
|
+
}, ...(ngDevMode ? [{ debugName: "_selectedLabel" }] : []));
|
|
408
|
+
_filteredOptions = computed(() => {
|
|
409
|
+
const q = this._searchQuery().toLowerCase();
|
|
410
|
+
if (!q)
|
|
411
|
+
return this._normalizedOptions();
|
|
412
|
+
return this._normalizedOptions().filter(o => o.label.toLowerCase().includes(q));
|
|
413
|
+
}, ...(ngDevMode ? [{ debugName: "_filteredOptions" }] : []));
|
|
414
|
+
_onTriggerClick(event) {
|
|
415
|
+
if (this.disabled())
|
|
416
|
+
return;
|
|
417
|
+
if (this._isOpen()) {
|
|
418
|
+
this._close();
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
this._open();
|
|
422
|
+
}
|
|
423
|
+
_onPanelClick(event) {
|
|
424
|
+
event.stopPropagation();
|
|
425
|
+
}
|
|
426
|
+
_open() {
|
|
427
|
+
this._isClosing.set(false);
|
|
428
|
+
this._isOpen.set(true);
|
|
429
|
+
this._searchQuery.set('');
|
|
430
|
+
const rect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
431
|
+
const dir = this._direction();
|
|
432
|
+
if (dir === 'up' || dir === 'down') {
|
|
433
|
+
this._panelDirection.set(dir);
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
const panelH = Math.min(320, parseInt(this._maxHeight()));
|
|
437
|
+
this._panelDirection.set(window.innerHeight - rect.bottom >= panelH + 60 ? 'down' : 'up');
|
|
438
|
+
}
|
|
439
|
+
if (this._appendToParent()) {
|
|
440
|
+
this._panelX.set(rect.left);
|
|
441
|
+
this._panelY.set(this._panelDirection() === 'down' ? rect.bottom : rect.top);
|
|
442
|
+
this._panelWidth.set(rect.width);
|
|
443
|
+
setTimeout(() => this._attachToBody());
|
|
444
|
+
}
|
|
445
|
+
if (this.searchable()) {
|
|
446
|
+
setTimeout(() => {
|
|
447
|
+
const input = this._elementRef.nativeElement.querySelector('[data-dd-search]');
|
|
448
|
+
input?.focus();
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
const handler = (e) => this._onDocClick(e);
|
|
452
|
+
document.addEventListener('click', handler);
|
|
453
|
+
this._docClickCleanup = () => document.removeEventListener('click', handler);
|
|
454
|
+
}
|
|
455
|
+
_close() {
|
|
456
|
+
if (!this._isOpen())
|
|
457
|
+
return;
|
|
458
|
+
this._docClickCleanup?.();
|
|
459
|
+
this._docClickCleanup = undefined;
|
|
460
|
+
if (this._closeTimer)
|
|
461
|
+
clearTimeout(this._closeTimer);
|
|
462
|
+
this._isClosing.set(true);
|
|
463
|
+
if (this._appendToParent())
|
|
464
|
+
this._detachFromBody();
|
|
465
|
+
this._closeTimer = setTimeout(() => {
|
|
466
|
+
this._isOpen.set(false);
|
|
467
|
+
this._isClosing.set(false);
|
|
468
|
+
this._closeTimer = null;
|
|
469
|
+
}, 150);
|
|
470
|
+
}
|
|
471
|
+
_attachToBody() {
|
|
472
|
+
const panel = this._elementRef.nativeElement.querySelector('[data-dd-panel]');
|
|
473
|
+
if (panel) {
|
|
474
|
+
document.body.appendChild(panel);
|
|
475
|
+
this._panelEl = panel;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
_detachFromBody() {
|
|
479
|
+
if (!this._panelEl)
|
|
480
|
+
return;
|
|
481
|
+
const wrapper = this._elementRef.nativeElement.querySelector('.dd-wrapper');
|
|
482
|
+
if (wrapper && this._panelEl.parentNode !== wrapper) {
|
|
483
|
+
wrapper.appendChild(this._panelEl);
|
|
484
|
+
}
|
|
485
|
+
this._panelEl = null;
|
|
486
|
+
}
|
|
487
|
+
_selectOption(option) {
|
|
488
|
+
this.value.set(option.value);
|
|
489
|
+
this._close();
|
|
490
|
+
}
|
|
491
|
+
_clear(event) {
|
|
492
|
+
event.stopPropagation();
|
|
493
|
+
this.value.set(null);
|
|
494
|
+
}
|
|
495
|
+
_onWindowScroll() {
|
|
496
|
+
if (this._isOpen() && this._appendToParent()) {
|
|
497
|
+
this._close();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
_onDocClick(event) {
|
|
501
|
+
if (!this._isOpen())
|
|
502
|
+
return;
|
|
503
|
+
const target = event.target;
|
|
504
|
+
if (this._elementRef.nativeElement.contains(target))
|
|
505
|
+
return;
|
|
506
|
+
if (this._panelEl?.contains(target))
|
|
507
|
+
return;
|
|
508
|
+
this._close();
|
|
509
|
+
}
|
|
510
|
+
ngOnDestroy() {
|
|
511
|
+
this._docClickCleanup?.();
|
|
512
|
+
if (this._closeTimer)
|
|
513
|
+
clearTimeout(this._closeTimer);
|
|
514
|
+
if (this._panelEl && document.body.contains(this._panelEl)) {
|
|
515
|
+
document.body.removeChild(this._panelEl);
|
|
516
|
+
this._panelEl = null;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: DropDownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
520
|
+
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.--rz-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<div class=\"rz-dd-wrapper\">\n <label class=\"rz-dd-trigger\" (click)=\"_onTriggerClick($event)\">\n <input\n class=\"rz-dd-input\"\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=\"rz-dd-clear\" type=\"button\" (click)=\"_clear($event)\" aria-label=\"Clear\">\n <i class=\"pi pi-times\"></i>\n </button>\n }\n\n <i class=\"rz-dd-icon pi pi-chevron-down\" [class.is-open]=\"_isOpen()\"></i>\n </label>\n\n @if (_isOpen() || _isClosing()) {\n <div\n data-dd-panel\n class=\"rz-dd-panel\"\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.rz-dd-fade-in]=\"_isOpen() && !_isClosing()\"\n [class.rz-dd-fade-out]=\"_isClosing()\"\n (click)=\"_onPanelClick($event)\">\n\n @if (searchable()) {\n <div class=\"rz-dd-search-wrap\">\n <input\n data-dd-search\n type=\"text\"\n class=\"rz-dd-search-input\"\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=\"rz-dd-options\"\n [style.max-height]=\"_maxHeight()\"\n (scroll)=\"$event.stopPropagation()\">\n @for (option of _filteredOptions(); track option.value) {\n <button\n type=\"button\"\n class=\"rz-dd-option\"\n [class.selected]=\"option.value === value()\"\n (click)=\"_selectOption(option)\"\n >{{ option.label }}</button>\n }\n\n @if (_filteredOptions().length === 0) {\n <div class=\"rz-dd-empty\">No results found</div>\n }\n </div>\n </div>\n }\n</div>\n\n@if (hint() && !error()) {\n <span class=\"rz-dd-msg rz-dd-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-dd-msg rz-dd-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}", styles: [":host{--rz-accent: var(--color-accent, oklch(.64 .2 50));--rz-bg: var(--color-surface, oklch(.99 0 0));--rz-border: var(--color-border, oklch(.83 .015 260));--rz-text: var(--color-text, oklch(.14 .01 260));--rz-muted: var(--color-text-muted, oklch(.48 .01 260));--rz-surface: var(--color-surface-alt, oklch(.975 .005 260));--rz-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\"]){--rz-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--rz-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--rz-accent: var(--color-info, oklch(.55 .15 235))}:host.has-error .rz-dd-input{border-color:var(--color-danger, oklch(.55 .25 25))!important}:host.has-error .rz-dd-input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger, oklch(.55 .25 25)) 20%,transparent)!important}.rz-dd-wrapper{position:relative;overflow:visible}.rz-dd-trigger{display:flex;align-items:center;width:100%}.rz-dd-input{width:100%;outline:none;background:var(--rz-bg);border:1px solid var(--rz-border);border-radius:var(--rz-radius);color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem 2.75rem .5rem .75rem;font-size:.875rem;transition:border-color .2s ease,box-shadow .2s ease;cursor:pointer;box-sizing:border-box}.rz-dd-input::placeholder{color:var(--rz-muted)}.rz-dd-input:disabled{opacity:.5;cursor:not-allowed}.rz-dd-input:focus{border-color:var(--rz-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--rz-accent) 20%,transparent)}:host([data-size=\"sm\"]) .rz-dd-input{padding:.25rem 2.25rem .25rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-dd-input{padding:.75rem 3rem .75rem 1rem;font-size:1rem}.rz-dd-clear{position:absolute;top:50%;translate:0 -50%;inset-inline-end:2rem;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;cursor:pointer;color:var(--rz-muted);font-size:.75rem;transition:color .15s}.rz-dd-clear:hover{color:var(--rz-text)}.rz-dd-icon{position:absolute;top:50%;translate:0 -50%;inset-inline-end:.625rem;pointer-events:none;color:var(--rz-muted);font-size:1rem;line-height:1;display:flex;align-items:center;justify-content:center;transition:transform .2s}.rz-dd-icon.is-open{transform:rotate(180deg)}:host([data-size=\"sm\"]) .rz-dd-icon{inset-inline-end:.5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-dd-icon{inset-inline-end:.75rem;font-size:1.125rem}.rz-dd-panel{left:0;z-index:50;width:100%;min-width:15rem;background:var(--color-surface, oklch(.99 0 0));border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:var(--radius-md, .5rem);box-shadow:0 10px 15px -3px color-mix(in srgb,var(--color-text) 10%,transparent),0 4px 6px -4px color-mix(in srgb,var(--color-text) 10%,transparent);overflow:hidden;color:var(--color-text, oklch(.14 .01 260));box-sizing:border-box}.rz-dd-panel.absolute{position:absolute}.rz-dd-search-wrap{padding:.5rem .5rem 0}.rz-dd-search-input{width:100%;padding:.375rem .5rem;font-size:.875rem;border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:.25rem;outline:none;background:var(--color-surface, oklch(.99 0 0));color:var(--color-text, oklch(.14 .01 260));font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);box-sizing:border-box}.rz-dd-search-input::placeholder{color:var(--color-text-muted)}.rz-dd-search-input:focus{border-color:var(--color-accent)}.rz-dd-options{overflow-y:auto}.rz-dd-option{width:100%;text-align:left;border:none;cursor:pointer;transition:background .1s,color .1s;background:transparent;color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem .75rem;font-size:.875rem;box-sizing:border-box}.rz-dd-option:hover{background:color-mix(in srgb,var(--color-accent) 12%,var(--color-surface))}.rz-dd-option.selected{background:var(--rz-accent);color:var(--color-primary-inverse, oklch(.99 0 0));font-weight:600}:host([data-size=\"sm\"]) .rz-dd-option{padding:.375rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-dd-option{padding:.75rem 1rem;font-size:1rem}.rz-dd-empty{padding:1rem .75rem;text-align:center;font-size:.875rem;color:var(--rz-muted)}.rz-dd-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-dd-hint{color:var(--color-text-muted)}.rz-dd-error{color:var(--color-danger)}.rz-dd-fade-in{animation:rz-dd-in .2s ease}.rz-dd-fade-out{animation:rz-dd-out .15s ease forwards}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-dd-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes rz-dd-out{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
521
|
+
}
|
|
522
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: DropDownComponent, decorators: [{
|
|
523
|
+
type: Component,
|
|
524
|
+
args: [{ selector: 'app-drop-down', imports: [], host: {
|
|
525
|
+
'[attr.data-size]': '_size',
|
|
526
|
+
'[attr.data-accent]': '_accentKey',
|
|
527
|
+
'[class.has-error]': 'error()',
|
|
528
|
+
'[style.--rz-accent]': '_rawAccent',
|
|
529
|
+
'[style.width]': '_width',
|
|
530
|
+
'(window:scroll)': '_onWindowScroll()',
|
|
531
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"rz-dd-wrapper\">\n <label class=\"rz-dd-trigger\" (click)=\"_onTriggerClick($event)\">\n <input\n class=\"rz-dd-input\"\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=\"rz-dd-clear\" type=\"button\" (click)=\"_clear($event)\" aria-label=\"Clear\">\n <i class=\"pi pi-times\"></i>\n </button>\n }\n\n <i class=\"rz-dd-icon pi pi-chevron-down\" [class.is-open]=\"_isOpen()\"></i>\n </label>\n\n @if (_isOpen() || _isClosing()) {\n <div\n data-dd-panel\n class=\"rz-dd-panel\"\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.rz-dd-fade-in]=\"_isOpen() && !_isClosing()\"\n [class.rz-dd-fade-out]=\"_isClosing()\"\n (click)=\"_onPanelClick($event)\">\n\n @if (searchable()) {\n <div class=\"rz-dd-search-wrap\">\n <input\n data-dd-search\n type=\"text\"\n class=\"rz-dd-search-input\"\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=\"rz-dd-options\"\n [style.max-height]=\"_maxHeight()\"\n (scroll)=\"$event.stopPropagation()\">\n @for (option of _filteredOptions(); track option.value) {\n <button\n type=\"button\"\n class=\"rz-dd-option\"\n [class.selected]=\"option.value === value()\"\n (click)=\"_selectOption(option)\"\n >{{ option.label }}</button>\n }\n\n @if (_filteredOptions().length === 0) {\n <div class=\"rz-dd-empty\">No results found</div>\n }\n </div>\n </div>\n }\n</div>\n\n@if (hint() && !error()) {\n <span class=\"rz-dd-msg rz-dd-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-dd-msg rz-dd-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}", styles: [":host{--rz-accent: var(--color-accent, oklch(.64 .2 50));--rz-bg: var(--color-surface, oklch(.99 0 0));--rz-border: var(--color-border, oklch(.83 .015 260));--rz-text: var(--color-text, oklch(.14 .01 260));--rz-muted: var(--color-text-muted, oklch(.48 .01 260));--rz-surface: var(--color-surface-alt, oklch(.975 .005 260));--rz-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\"]){--rz-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--rz-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--rz-accent: var(--color-info, oklch(.55 .15 235))}:host.has-error .rz-dd-input{border-color:var(--color-danger, oklch(.55 .25 25))!important}:host.has-error .rz-dd-input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger, oklch(.55 .25 25)) 20%,transparent)!important}.rz-dd-wrapper{position:relative;overflow:visible}.rz-dd-trigger{display:flex;align-items:center;width:100%}.rz-dd-input{width:100%;outline:none;background:var(--rz-bg);border:1px solid var(--rz-border);border-radius:var(--rz-radius);color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem 2.75rem .5rem .75rem;font-size:.875rem;transition:border-color .2s ease,box-shadow .2s ease;cursor:pointer;box-sizing:border-box}.rz-dd-input::placeholder{color:var(--rz-muted)}.rz-dd-input:disabled{opacity:.5;cursor:not-allowed}.rz-dd-input:focus{border-color:var(--rz-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--rz-accent) 20%,transparent)}:host([data-size=\"sm\"]) .rz-dd-input{padding:.25rem 2.25rem .25rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-dd-input{padding:.75rem 3rem .75rem 1rem;font-size:1rem}.rz-dd-clear{position:absolute;top:50%;translate:0 -50%;inset-inline-end:2rem;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;cursor:pointer;color:var(--rz-muted);font-size:.75rem;transition:color .15s}.rz-dd-clear:hover{color:var(--rz-text)}.rz-dd-icon{position:absolute;top:50%;translate:0 -50%;inset-inline-end:.625rem;pointer-events:none;color:var(--rz-muted);font-size:1rem;line-height:1;display:flex;align-items:center;justify-content:center;transition:transform .2s}.rz-dd-icon.is-open{transform:rotate(180deg)}:host([data-size=\"sm\"]) .rz-dd-icon{inset-inline-end:.5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-dd-icon{inset-inline-end:.75rem;font-size:1.125rem}.rz-dd-panel{left:0;z-index:50;width:100%;min-width:15rem;background:var(--color-surface, oklch(.99 0 0));border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:var(--radius-md, .5rem);box-shadow:0 10px 15px -3px color-mix(in srgb,var(--color-text) 10%,transparent),0 4px 6px -4px color-mix(in srgb,var(--color-text) 10%,transparent);overflow:hidden;color:var(--color-text, oklch(.14 .01 260));box-sizing:border-box}.rz-dd-panel.absolute{position:absolute}.rz-dd-search-wrap{padding:.5rem .5rem 0}.rz-dd-search-input{width:100%;padding:.375rem .5rem;font-size:.875rem;border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:.25rem;outline:none;background:var(--color-surface, oklch(.99 0 0));color:var(--color-text, oklch(.14 .01 260));font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);box-sizing:border-box}.rz-dd-search-input::placeholder{color:var(--color-text-muted)}.rz-dd-search-input:focus{border-color:var(--color-accent)}.rz-dd-options{overflow-y:auto}.rz-dd-option{width:100%;text-align:left;border:none;cursor:pointer;transition:background .1s,color .1s;background:transparent;color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem .75rem;font-size:.875rem;box-sizing:border-box}.rz-dd-option:hover{background:color-mix(in srgb,var(--color-accent) 12%,var(--color-surface))}.rz-dd-option.selected{background:var(--rz-accent);color:var(--color-primary-inverse, oklch(.99 0 0));font-weight:600}:host([data-size=\"sm\"]) .rz-dd-option{padding:.375rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-dd-option{padding:.75rem 1rem;font-size:1rem}.rz-dd-empty{padding:1rem .75rem;text-align:center;font-size:.875rem;color:var(--rz-muted)}.rz-dd-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-dd-hint{color:var(--color-text-muted)}.rz-dd-error{color:var(--color-danger)}.rz-dd-fade-in{animation:rz-dd-in .2s ease}.rz-dd-fade-out{animation:rz-dd-out .15s ease forwards}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-dd-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes rz-dd-out{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
532
|
+
}], 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 }] }] } });
|
|
533
|
+
|
|
534
|
+
class FileUploadComponent {
|
|
535
|
+
files = model([], ...(ngDevMode ? [{ debugName: "files" }] : []));
|
|
536
|
+
accept = input('', ...(ngDevMode ? [{ debugName: "accept" }] : []));
|
|
537
|
+
multiple = input(true, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
538
|
+
maxSize = input(0, ...(ngDevMode ? [{ debugName: "maxSize" }] : []));
|
|
539
|
+
maxFiles = input(0, ...(ngDevMode ? [{ debugName: "maxFiles" }] : []));
|
|
540
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
541
|
+
placeholder = input('Drop files here or click to browse', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
542
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
543
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
544
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
545
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
546
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
547
|
+
_isDragOver = signal(false, ...(ngDevMode ? [{ debugName: "_isDragOver" }] : []));
|
|
548
|
+
_totalSize = computed(() => this.files().reduce((s, f) => s + f.size, 0), ...(ngDevMode ? [{ debugName: "_totalSize" }] : []));
|
|
549
|
+
_onDragOver(event) {
|
|
550
|
+
event.preventDefault();
|
|
551
|
+
event.stopPropagation();
|
|
552
|
+
if (!this.disabled())
|
|
553
|
+
this._isDragOver.set(true);
|
|
554
|
+
}
|
|
555
|
+
_onDragLeave(event) {
|
|
556
|
+
event.preventDefault();
|
|
557
|
+
event.stopPropagation();
|
|
558
|
+
this._isDragOver.set(false);
|
|
559
|
+
}
|
|
560
|
+
_onDrop(event) {
|
|
561
|
+
event.preventDefault();
|
|
562
|
+
event.stopPropagation();
|
|
563
|
+
this._isDragOver.set(false);
|
|
564
|
+
if (this.disabled())
|
|
565
|
+
return;
|
|
566
|
+
const dropped = event.dataTransfer?.files;
|
|
567
|
+
if (dropped)
|
|
568
|
+
this._addFiles(Array.from(dropped));
|
|
569
|
+
}
|
|
570
|
+
_onFileSelected(event) {
|
|
571
|
+
const input = event.target;
|
|
572
|
+
if (input.files)
|
|
573
|
+
this._addFiles(Array.from(input.files));
|
|
574
|
+
input.value = '';
|
|
575
|
+
}
|
|
576
|
+
_removeFile(index) {
|
|
577
|
+
this.files.update(f => f.filter((_, i) => i !== index));
|
|
578
|
+
}
|
|
579
|
+
_addFiles(newFiles) {
|
|
580
|
+
let current = this.files();
|
|
581
|
+
if (this.accept()) {
|
|
582
|
+
const accepted = this.accept().split(',').map(a => a.trim().toLowerCase());
|
|
583
|
+
newFiles = newFiles.filter(f => accepted.some(a => f.type.match(a.replace('*', '.*')) || f.name.toLowerCase().endsWith(a.replace('.*', ''))));
|
|
584
|
+
}
|
|
585
|
+
if (this.maxSize()) {
|
|
586
|
+
newFiles = newFiles.filter(f => f.size <= this.maxSize());
|
|
587
|
+
}
|
|
588
|
+
if (this.multiple()) {
|
|
589
|
+
const max = this.maxFiles() || Infinity;
|
|
590
|
+
const remaining = max - current.length;
|
|
591
|
+
if (remaining <= 0)
|
|
592
|
+
return;
|
|
593
|
+
newFiles = newFiles.slice(0, remaining);
|
|
594
|
+
current = [...current, ...newFiles];
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
current = newFiles.slice(0, 1);
|
|
598
|
+
}
|
|
599
|
+
this.files.set(current);
|
|
600
|
+
}
|
|
601
|
+
_formatSize(bytes) {
|
|
602
|
+
if (bytes < 1024)
|
|
603
|
+
return `${bytes} B`;
|
|
604
|
+
if (bytes < 1048576)
|
|
605
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
606
|
+
return `${(bytes / 1048576).toFixed(1)} MB`;
|
|
607
|
+
}
|
|
608
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: FileUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
609
|
+
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=\"rz-fu-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=\"rz-fu-icon pi pi-cloud-upload\"></i>\n\n @if (files().length) {\n <span class=\"rz-fu-count\">{{ files().length }} file{{ files().length !== 1 ? 's' : '' }} selected</span>\n } @else {\n <span class=\"rz-fu-placeholder\">{{ placeholder() }}</span>\n }\n\n @if (maxSize()) {\n <span class=\"rz-fu-maxsize\">Max {{ _formatSize(maxSize()) }} per file</span>\n }\n</div>\n\n@if (files().length) {\n <div class=\"rz-fu-file-list\">\n @for (file of files(); track file.name + file.size + file.lastModified; let i = $index) {\n <div class=\"rz-fu-file-item\">\n <i class=\"pi pi-file rz-fu-file-icon\"></i>\n <span class=\"rz-fu-file-name\" [title]=\"file.name\">{{ file.name }}</span>\n <span class=\"rz-fu-file-size\">{{ _formatSize(file.size) }}</span>\n <button type=\"button\" class=\"rz-fu-file-remove\" (click)=\"_removeFile(i)\" aria-label=\"Remove file\">×</button>\n </div>\n }\n </div>\n}\n\n@if (hint() && !error()) {\n <span class=\"rz-fu-msg rz-fu-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-fu-msg rz-fu-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-accent, oklch(.64 .2 50));--rz-bg: var(--color-surface, oklch(.99 0 0));--rz-border: var(--color-border, oklch(.83 .015 260));--rz-text: var(--color-text, oklch(.14 .01 260));--rz-muted: var(--color-text-muted, oklch(.48 .01 260));--rz-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}.rz-fu-drop-zone{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.375rem;padding:2rem 1rem;border:2px dashed var(--rz-border);border-radius:var(--rz-radius);background:var(--rz-bg);cursor:pointer;transition:all .2s ease;color:var(--rz-muted);text-align:center}.rz-fu-drop-zone:hover,.rz-fu-drop-zone.is-dragover{border-color:var(--rz-accent);background:color-mix(in srgb,var(--rz-accent) 6%,var(--rz-bg));color:var(--rz-text)}.rz-fu-drop-zone.is-disabled{opacity:.5;cursor:not-allowed}.rz-fu-icon{font-size:1.5rem}:host([data-size=\"sm\"]) .rz-fu-icon{font-size:1.25rem}.rz-fu-count{font-size:.75rem;font-weight:500}.rz-fu-placeholder{font-size:.75rem}.rz-fu-maxsize{font-size:.625rem;opacity:.6}.rz-fu-file-list{display:flex;flex-direction:column;gap:.25rem;margin-top:.5rem}.rz-fu-file-item{display:flex;align-items:center;gap:.5rem;padding:.375rem .5rem;border-radius:calc(var(--rz-radius) - 2px);background:color-mix(in srgb,var(--rz-accent) 6%,var(--rz-bg));font-size:.8125rem;color:var(--rz-text)}.rz-fu-file-icon{flex-shrink:0;font-size:.75rem;color:var(--rz-accent)}.rz-fu-file-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rz-fu-file-size{flex-shrink:0;font-size:.6875rem;color:var(--rz-muted)}.rz-fu-file-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(--rz-muted);font-size:.6875rem;transition:all .15s}.rz-fu-file-remove:hover{background:color-mix(in srgb,var(--color-danger) 15%,transparent);color:var(--color-danger)}.rz-fu-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-fu-hint{color:var(--color-text-muted)}.rz-fu-error{color:var(--color-danger)}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
610
|
+
}
|
|
611
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: FileUploadComponent, decorators: [{
|
|
612
|
+
type: Component,
|
|
613
|
+
args: [{ selector: 'app-file-upload', imports: [], host: {
|
|
614
|
+
'[attr.data-size]': '_size',
|
|
615
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"rz-fu-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=\"rz-fu-icon pi pi-cloud-upload\"></i>\n\n @if (files().length) {\n <span class=\"rz-fu-count\">{{ files().length }} file{{ files().length !== 1 ? 's' : '' }} selected</span>\n } @else {\n <span class=\"rz-fu-placeholder\">{{ placeholder() }}</span>\n }\n\n @if (maxSize()) {\n <span class=\"rz-fu-maxsize\">Max {{ _formatSize(maxSize()) }} per file</span>\n }\n</div>\n\n@if (files().length) {\n <div class=\"rz-fu-file-list\">\n @for (file of files(); track file.name + file.size + file.lastModified; let i = $index) {\n <div class=\"rz-fu-file-item\">\n <i class=\"pi pi-file rz-fu-file-icon\"></i>\n <span class=\"rz-fu-file-name\" [title]=\"file.name\">{{ file.name }}</span>\n <span class=\"rz-fu-file-size\">{{ _formatSize(file.size) }}</span>\n <button type=\"button\" class=\"rz-fu-file-remove\" (click)=\"_removeFile(i)\" aria-label=\"Remove file\">×</button>\n </div>\n }\n </div>\n}\n\n@if (hint() && !error()) {\n <span class=\"rz-fu-msg rz-fu-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-fu-msg rz-fu-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-accent, oklch(.64 .2 50));--rz-bg: var(--color-surface, oklch(.99 0 0));--rz-border: var(--color-border, oklch(.83 .015 260));--rz-text: var(--color-text, oklch(.14 .01 260));--rz-muted: var(--color-text-muted, oklch(.48 .01 260));--rz-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}.rz-fu-drop-zone{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.375rem;padding:2rem 1rem;border:2px dashed var(--rz-border);border-radius:var(--rz-radius);background:var(--rz-bg);cursor:pointer;transition:all .2s ease;color:var(--rz-muted);text-align:center}.rz-fu-drop-zone:hover,.rz-fu-drop-zone.is-dragover{border-color:var(--rz-accent);background:color-mix(in srgb,var(--rz-accent) 6%,var(--rz-bg));color:var(--rz-text)}.rz-fu-drop-zone.is-disabled{opacity:.5;cursor:not-allowed}.rz-fu-icon{font-size:1.5rem}:host([data-size=\"sm\"]) .rz-fu-icon{font-size:1.25rem}.rz-fu-count{font-size:.75rem;font-weight:500}.rz-fu-placeholder{font-size:.75rem}.rz-fu-maxsize{font-size:.625rem;opacity:.6}.rz-fu-file-list{display:flex;flex-direction:column;gap:.25rem;margin-top:.5rem}.rz-fu-file-item{display:flex;align-items:center;gap:.5rem;padding:.375rem .5rem;border-radius:calc(var(--rz-radius) - 2px);background:color-mix(in srgb,var(--rz-accent) 6%,var(--rz-bg));font-size:.8125rem;color:var(--rz-text)}.rz-fu-file-icon{flex-shrink:0;font-size:.75rem;color:var(--rz-accent)}.rz-fu-file-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rz-fu-file-size{flex-shrink:0;font-size:.6875rem;color:var(--rz-muted)}.rz-fu-file-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(--rz-muted);font-size:.6875rem;transition:all .15s}.rz-fu-file-remove:hover{background:color-mix(in srgb,var(--color-danger) 15%,transparent);color:var(--color-danger)}.rz-fu-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-fu-hint{color:var(--color-text-muted)}.rz-fu-error{color:var(--color-danger)}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
616
|
+
}], 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 }] }] } });
|
|
617
|
+
|
|
618
|
+
class MultiSelectComponent {
|
|
619
|
+
_elementRef = inject(ElementRef);
|
|
620
|
+
_closeTimer = null;
|
|
621
|
+
_docClickCleanup;
|
|
622
|
+
value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
623
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
624
|
+
placeholder = input('Select...', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
625
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
626
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
627
|
+
selectAll = input(true, ...(ngDevMode ? [{ debugName: "selectAll" }] : []));
|
|
628
|
+
selectAllLabel = input('Select All', ...(ngDevMode ? [{ debugName: "selectAllLabel" }] : []));
|
|
629
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
630
|
+
searchable = input(false, ...(ngDevMode ? [{ debugName: "searchable" }] : []));
|
|
631
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
632
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
633
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
634
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
635
|
+
config = input({}, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
636
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
637
|
+
_direction = computed(() => this.config().direction ?? 'auto', ...(ngDevMode ? [{ debugName: "_direction" }] : []));
|
|
638
|
+
_accentKey = computed(() => {
|
|
639
|
+
const c = this.accentColor();
|
|
640
|
+
return c && isThemeColor(c) ? c : null;
|
|
641
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
642
|
+
_rawAccent = computed(() => {
|
|
643
|
+
const c = this.accentColor();
|
|
644
|
+
return c && !isThemeColor(c) ? c : null;
|
|
645
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
646
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
647
|
+
_normalizedOptions = computed(() => this.options().map(o => typeof o === 'string' ? { label: o, value: o } : o), ...(ngDevMode ? [{ debugName: "_normalizedOptions" }] : []));
|
|
648
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
649
|
+
_isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : []));
|
|
650
|
+
_panelDirection = signal('down', ...(ngDevMode ? [{ debugName: "_panelDirection" }] : []));
|
|
651
|
+
_panelX = signal(0, ...(ngDevMode ? [{ debugName: "_panelX" }] : []));
|
|
652
|
+
_panelY = signal(0, ...(ngDevMode ? [{ debugName: "_panelY" }] : []));
|
|
653
|
+
_panelWidth = signal(0, ...(ngDevMode ? [{ debugName: "_panelWidth" }] : []));
|
|
654
|
+
_panelEl = null;
|
|
655
|
+
_searchQuery = signal('', ...(ngDevMode ? [{ debugName: "_searchQuery" }] : []));
|
|
656
|
+
_appendToParent = computed(() => this.config().appendToParent ?? false, ...(ngDevMode ? [{ debugName: "_appendToParent" }] : []));
|
|
657
|
+
_panelFixed = computed(() => this._isOpen() && this._appendToParent() ? 'fixed' : null, ...(ngDevMode ? [{ debugName: "_panelFixed" }] : []));
|
|
658
|
+
_maxHeight = computed(() => this.config().maxHeight ?? '256px', ...(ngDevMode ? [{ debugName: "_maxHeight" }] : []));
|
|
659
|
+
_selectedLabels = computed(() => {
|
|
660
|
+
const v = this.value();
|
|
661
|
+
if (!v.length)
|
|
662
|
+
return [];
|
|
663
|
+
return this._normalizedOptions().filter(o => v.includes(o.value)).map(o => o.label);
|
|
664
|
+
}, ...(ngDevMode ? [{ debugName: "_selectedLabels" }] : []));
|
|
665
|
+
_filteredOptions = computed(() => {
|
|
666
|
+
const q = this._searchQuery().toLowerCase();
|
|
667
|
+
if (!q)
|
|
668
|
+
return this._normalizedOptions();
|
|
669
|
+
return this._normalizedOptions().filter(o => o.label.toLowerCase().includes(q));
|
|
670
|
+
}, ...(ngDevMode ? [{ debugName: "_filteredOptions" }] : []));
|
|
671
|
+
_allFilteredSelected = computed(() => {
|
|
672
|
+
const v = this.value();
|
|
673
|
+
return this._filteredOptions().every(o => v.includes(o.value));
|
|
674
|
+
}, ...(ngDevMode ? [{ debugName: "_allFilteredSelected" }] : []));
|
|
675
|
+
_triggerText = computed(() => {
|
|
676
|
+
const labels = this._selectedLabels();
|
|
677
|
+
if (!labels.length)
|
|
678
|
+
return '';
|
|
679
|
+
if (labels.length === 1)
|
|
680
|
+
return labels[0];
|
|
681
|
+
return `${labels.length} selected`;
|
|
682
|
+
}, ...(ngDevMode ? [{ debugName: "_triggerText" }] : []));
|
|
683
|
+
_isSelected(val) {
|
|
684
|
+
return this.value().includes(val);
|
|
685
|
+
}
|
|
686
|
+
_optVal(option) {
|
|
687
|
+
return option.value;
|
|
688
|
+
}
|
|
689
|
+
_onTriggerClick(event) {
|
|
690
|
+
if (this.disabled())
|
|
691
|
+
return;
|
|
692
|
+
if (this._isOpen()) {
|
|
693
|
+
this._close();
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
this._open();
|
|
697
|
+
}
|
|
698
|
+
_onPanelClick(event) {
|
|
699
|
+
event.stopPropagation();
|
|
700
|
+
}
|
|
701
|
+
_onInput(event) {
|
|
702
|
+
this._searchQuery.set(event.target.value);
|
|
703
|
+
}
|
|
704
|
+
_open() {
|
|
705
|
+
this._isClosing.set(false);
|
|
706
|
+
this._isOpen.set(true);
|
|
707
|
+
this._searchQuery.set('');
|
|
708
|
+
const rect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
709
|
+
const dir = this._direction();
|
|
710
|
+
if (dir === 'up' || dir === 'down') {
|
|
711
|
+
this._panelDirection.set(dir);
|
|
712
|
+
}
|
|
713
|
+
else {
|
|
714
|
+
const panelH = Math.min(320, parseInt(this._maxHeight()));
|
|
715
|
+
this._panelDirection.set(window.innerHeight - rect.bottom >= panelH + 60 ? 'down' : 'up');
|
|
716
|
+
}
|
|
717
|
+
if (this._appendToParent()) {
|
|
718
|
+
this._panelX.set(rect.left);
|
|
719
|
+
this._panelY.set(this._panelDirection() === 'down' ? rect.bottom : rect.top);
|
|
720
|
+
this._panelWidth.set(rect.width);
|
|
721
|
+
setTimeout(() => this._attachToBody());
|
|
722
|
+
}
|
|
723
|
+
if (this.searchable()) {
|
|
724
|
+
setTimeout(() => {
|
|
725
|
+
const input = this._elementRef.nativeElement.querySelector('[data-ms-search]');
|
|
726
|
+
input?.focus();
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
const handler = (e) => this._onDocClick(e);
|
|
730
|
+
document.addEventListener('click', handler);
|
|
731
|
+
this._docClickCleanup = () => document.removeEventListener('click', handler);
|
|
732
|
+
}
|
|
733
|
+
_close() {
|
|
734
|
+
if (!this._isOpen())
|
|
735
|
+
return;
|
|
736
|
+
this._docClickCleanup?.();
|
|
737
|
+
this._docClickCleanup = undefined;
|
|
738
|
+
if (this._closeTimer)
|
|
739
|
+
clearTimeout(this._closeTimer);
|
|
740
|
+
this._isClosing.set(true);
|
|
741
|
+
if (this._appendToParent())
|
|
742
|
+
this._detachFromBody();
|
|
743
|
+
this._closeTimer = setTimeout(() => {
|
|
744
|
+
this._isOpen.set(false);
|
|
745
|
+
this._isClosing.set(false);
|
|
746
|
+
this._closeTimer = null;
|
|
747
|
+
}, 150);
|
|
748
|
+
}
|
|
749
|
+
_attachToBody() {
|
|
750
|
+
const panel = this._elementRef.nativeElement.querySelector('[data-ms-panel]');
|
|
751
|
+
if (panel) {
|
|
752
|
+
document.body.appendChild(panel);
|
|
753
|
+
this._panelEl = panel;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
_detachFromBody() {
|
|
757
|
+
if (!this._panelEl)
|
|
758
|
+
return;
|
|
759
|
+
const wrapper = this._elementRef.nativeElement.querySelector('.ms-wrapper');
|
|
760
|
+
if (wrapper && this._panelEl.parentNode !== wrapper) {
|
|
761
|
+
wrapper.appendChild(this._panelEl);
|
|
762
|
+
}
|
|
763
|
+
this._panelEl = null;
|
|
764
|
+
}
|
|
765
|
+
_toggleOption(option) {
|
|
766
|
+
const val = option.value;
|
|
767
|
+
const current = this.value();
|
|
768
|
+
if (current.includes(val)) {
|
|
769
|
+
this.value.set(current.filter(v => v !== val));
|
|
770
|
+
}
|
|
771
|
+
else {
|
|
772
|
+
this.value.set([...current, val]);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
_toggleSelectAll() {
|
|
776
|
+
if (this._allFilteredSelected()) {
|
|
777
|
+
const remove = this._filteredOptions().map(o => o.value);
|
|
778
|
+
this.value.set(this.value().filter(v => !remove.includes(v)));
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
const add = this._filteredOptions().map(o => o.value);
|
|
782
|
+
const existing = this.value();
|
|
783
|
+
this.value.set([...new Set([...existing, ...add])]);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
_removeChip(val, event) {
|
|
787
|
+
event.stopPropagation();
|
|
788
|
+
this.value.set(this.value().filter(v => v !== val));
|
|
789
|
+
}
|
|
790
|
+
_clearAll(event) {
|
|
791
|
+
event.stopPropagation();
|
|
792
|
+
this.value.set([]);
|
|
793
|
+
}
|
|
794
|
+
_onWindowScroll() {
|
|
795
|
+
if (this._isOpen() && this._appendToParent()) {
|
|
796
|
+
this._close();
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
_onDocClick(event) {
|
|
800
|
+
if (!this._isOpen())
|
|
801
|
+
return;
|
|
802
|
+
const target = event.target;
|
|
803
|
+
if (this._elementRef.nativeElement.contains(target))
|
|
804
|
+
return;
|
|
805
|
+
if (this._panelEl?.contains(target))
|
|
806
|
+
return;
|
|
807
|
+
this._close();
|
|
808
|
+
}
|
|
809
|
+
ngOnDestroy() {
|
|
810
|
+
this._docClickCleanup?.();
|
|
811
|
+
if (this._closeTimer)
|
|
812
|
+
clearTimeout(this._closeTimer);
|
|
813
|
+
if (this._panelEl && document.body.contains(this._panelEl)) {
|
|
814
|
+
document.body.removeChild(this._panelEl);
|
|
815
|
+
this._panelEl = null;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: MultiSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
819
|
+
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.--rz-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<div class=\"rz-ms-wrapper\">\n <label class=\"rz-ms-trigger\" (click)=\"_onTriggerClick($event)\">\n @let chips = _selectedLabels();\n\n <div class=\"rz-ms-field\">\n @for (label of chips; track label) {\n <span class=\"rz-ms-chip\">\n {{ label }}\n <button type=\"button\" class=\"rz-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=\"rz-ms-search-input\"\n [attr.placeholder]=\"chips.length ? '' : placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n (input)=\"_onInput($event)\"\n (click)=\"$event.stopPropagation()\"\n />\n </div>\n\n <i class=\"rz-ms-icon pi pi-chevron-down\" [class.is-open]=\"_isOpen()\"></i>\n </label>\n\n @if (_isOpen() || _isClosing()) {\n <div\n data-ms-panel\n class=\"rz-ms-panel\"\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.rz-ms-fade-in]=\"_isOpen() && !_isClosing()\"\n [class.rz-ms-fade-out]=\"_isClosing()\"\n (click)=\"_onPanelClick($event)\">\n\n @if (searchable()) {\n <div class=\"rz-ms-search-wrap\">\n <input\n data-ms-search\n type=\"text\"\n class=\"rz-ms-search-field-input\"\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=\"rz-ms-options\"\n [style.max-height]=\"_maxHeight()\"\n (scroll)=\"$event.stopPropagation()\">\n\n @if (selectAll() && _filteredOptions().length > 0) {\n <button\n type=\"button\"\n class=\"rz-ms-option\"\n (click)=\"_toggleSelectAll()\"\n >\n <span class=\"rz-ms-checkbox\" [class.checked]=\"_allFilteredSelected()\">\n @if (_allFilteredSelected()) { ✓ }\n </span>\n <span class=\"rz-ms-option-label\">{{ selectAllLabel() }}</span>\n </button>\n <div class=\"rz-ms-divider\"></div>\n }\n\n @for (option of _filteredOptions(); track option.value) {\n <button\n type=\"button\"\n class=\"rz-ms-option\"\n [class.selected]=\"_isSelected(_optVal(option))\"\n (click)=\"_toggleOption(option)\"\n >\n <span class=\"rz-ms-checkbox\" [class.checked]=\"_isSelected(_optVal(option))\">\n @if (_isSelected(_optVal(option))) { ✓ }\n </span>\n <span>{{ option.label }}</span>\n </button>\n }\n\n @if (_filteredOptions().length === 0) {\n <div class=\"rz-ms-empty\">No results found</div>\n }\n </div>\n </div>\n }\n</div>\n\n@if (hint() && !error()) {\n <span class=\"rz-ms-msg rz-ms-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-ms-msg rz-ms-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-accent, oklch(.64 .2 50));--rz-bg: var(--color-surface, oklch(.99 0 0));--rz-border: var(--color-border, oklch(.83 .015 260));--rz-text: var(--color-text, oklch(.14 .01 260));--rz-muted: var(--color-text-muted, oklch(.48 .01 260));--rz-surface: var(--color-surface-alt, oklch(.975 .005 260));--rz-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\"]){--rz-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--rz-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--rz-accent: var(--color-info, oklch(.55 .15 235))}:host.has-error .rz-ms-field{border-color:var(--color-danger, oklch(.55 .25 25))!important}:host.has-error .rz-ms-field:focus-within{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger, oklch(.55 .25 25)) 20%,transparent)!important}.rz-ms-wrapper{position:relative}.rz-ms-trigger{display:flex;align-items:center;width:100%;cursor:text}.rz-ms-field{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem;min-height:0;height:auto;cursor:pointer;width:100%;outline:none;background:var(--rz-bg);border:1px solid var(--rz-border);border-radius:var(--rz-radius);color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);transition:border-color .2s ease,box-shadow .2s ease;padding:.375rem 2.5rem .375rem .75rem;font-size:.875rem}.rz-ms-field:disabled{opacity:.5;cursor:not-allowed}:host([data-size=\"sm\"]) .rz-ms-field{padding:.25rem 2rem .25rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-ms-field{padding:.75rem 2.75rem .75rem 1rem;font-size:1rem}.rz-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(--rz-accent) 15%,transparent);color:var(--rz-accent);line-height:1.5}.rz-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}.rz-ms-chip-remove:hover{background:color-mix(in srgb,var(--rz-accent) 20%,transparent)}.rz-ms-search-input{flex:1;min-width:50px;outline:none;border:none;background:transparent;color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:0;margin:0}.rz-ms-search-input::placeholder{color:var(--rz-muted)}:host([data-size=\"sm\"]) .rz-ms-search-input{font-size:.75rem;height:1.25rem}:host([data-size=\"md\"]) .rz-ms-search-input{font-size:.875rem;height:1.5rem}:host([data-size=\"lg\"]) .rz-ms-search-input{font-size:1rem;height:1.5rem}.rz-ms-icon{position:absolute;top:50%;translate:0 -50%;right:.625rem;pointer-events:none;color:var(--rz-muted);font-size:.875rem;transition:transform .2s}.rz-ms-icon.is-open{transform:rotate(180deg)}:host([data-size=\"sm\"]) .rz-ms-icon{right:.5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-ms-icon{right:.75rem;font-size:1.125rem}.rz-ms-panel{left:0;z-index:50;width:100%;min-width:15rem;background:var(--color-surface, oklch(.99 0 0));border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:var(--radius-md, .5rem);box-shadow:0 10px 15px -3px color-mix(in srgb,var(--color-text) 10%,transparent),0 4px 6px -4px color-mix(in srgb,var(--color-text) 10%,transparent);overflow:hidden;color:var(--color-text, oklch(.14 .01 260))}.rz-ms-panel.absolute{position:absolute}.rz-ms-search-wrap{padding:.5rem .5rem 0}.rz-ms-search-field-input{width:100%;padding:.375rem .5rem;font-size:.875rem;border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:.25rem;outline:none;background:var(--color-surface, oklch(.99 0 0));color:var(--color-text, oklch(.14 .01 260));font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif)}.rz-ms-search-field-input::placeholder{color:var(--color-text-muted)}.rz-ms-search-field-input:focus{border-color:var(--color-accent)}.rz-ms-options{overflow-y:auto}.rz-ms-option{width:100%;display:flex;align-items:center;gap:.5rem;text-align:left;border:none;cursor:pointer;transition:background .1s,color .1s;background:transparent;color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem .75rem;font-size:.875rem}.rz-ms-option:hover{background:color-mix(in srgb,var(--color-accent) 12%,var(--color-surface))}.rz-ms-option.selected{background:var(--rz-accent)!important;color:var(--color-primary-inverse, oklch(.99 0 0))!important}:host([data-size=\"sm\"]) .rz-ms-option{padding:.375rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-ms-option{padding:.75rem 1rem;font-size:1rem}.rz-ms-checkbox{display:inline-flex;align-items:center;justify-content:center;width:1rem;height:1rem;border-radius:.25rem;border:1px solid var(--rz-border);font-size:.625rem;flex-shrink:0;transition:all .15s;color:transparent}.rz-ms-checkbox.checked{background:var(--rz-accent);border-color:var(--rz-accent);color:#fff}.rz-ms-option-label{font-weight:500}.rz-ms-divider{height:1px;margin:0 .5rem;background:var(--rz-border)}.rz-ms-empty{padding:1rem .75rem;text-align:center;font-size:.875rem;color:var(--rz-muted)}.rz-ms-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-ms-hint{color:var(--color-text-muted)}.rz-ms-error{color:var(--color-danger)}.rz-ms-fade-in{animation:rz-ms-in .2s ease}.rz-ms-fade-out{animation:rz-ms-out .15s ease forwards}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-ms-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes rz-ms-out{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
820
|
+
}
|
|
821
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: MultiSelectComponent, decorators: [{
|
|
822
|
+
type: Component,
|
|
823
|
+
args: [{ selector: 'app-multi-select', imports: [], host: {
|
|
824
|
+
'[attr.data-size]': '_size',
|
|
825
|
+
'[attr.data-accent]': '_accentKey',
|
|
826
|
+
'[class.has-error]': 'error()',
|
|
827
|
+
'[style.--rz-accent]': '_rawAccent',
|
|
828
|
+
'[style.width]': '_width',
|
|
829
|
+
'(window:scroll)': '_onWindowScroll()',
|
|
830
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"rz-ms-wrapper\">\n <label class=\"rz-ms-trigger\" (click)=\"_onTriggerClick($event)\">\n @let chips = _selectedLabels();\n\n <div class=\"rz-ms-field\">\n @for (label of chips; track label) {\n <span class=\"rz-ms-chip\">\n {{ label }}\n <button type=\"button\" class=\"rz-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=\"rz-ms-search-input\"\n [attr.placeholder]=\"chips.length ? '' : placeholder()\"\n [attr.disabled]=\"disabled() ? true : null\"\n (input)=\"_onInput($event)\"\n (click)=\"$event.stopPropagation()\"\n />\n </div>\n\n <i class=\"rz-ms-icon pi pi-chevron-down\" [class.is-open]=\"_isOpen()\"></i>\n </label>\n\n @if (_isOpen() || _isClosing()) {\n <div\n data-ms-panel\n class=\"rz-ms-panel\"\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.rz-ms-fade-in]=\"_isOpen() && !_isClosing()\"\n [class.rz-ms-fade-out]=\"_isClosing()\"\n (click)=\"_onPanelClick($event)\">\n\n @if (searchable()) {\n <div class=\"rz-ms-search-wrap\">\n <input\n data-ms-search\n type=\"text\"\n class=\"rz-ms-search-field-input\"\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=\"rz-ms-options\"\n [style.max-height]=\"_maxHeight()\"\n (scroll)=\"$event.stopPropagation()\">\n\n @if (selectAll() && _filteredOptions().length > 0) {\n <button\n type=\"button\"\n class=\"rz-ms-option\"\n (click)=\"_toggleSelectAll()\"\n >\n <span class=\"rz-ms-checkbox\" [class.checked]=\"_allFilteredSelected()\">\n @if (_allFilteredSelected()) { ✓ }\n </span>\n <span class=\"rz-ms-option-label\">{{ selectAllLabel() }}</span>\n </button>\n <div class=\"rz-ms-divider\"></div>\n }\n\n @for (option of _filteredOptions(); track option.value) {\n <button\n type=\"button\"\n class=\"rz-ms-option\"\n [class.selected]=\"_isSelected(_optVal(option))\"\n (click)=\"_toggleOption(option)\"\n >\n <span class=\"rz-ms-checkbox\" [class.checked]=\"_isSelected(_optVal(option))\">\n @if (_isSelected(_optVal(option))) { ✓ }\n </span>\n <span>{{ option.label }}</span>\n </button>\n }\n\n @if (_filteredOptions().length === 0) {\n <div class=\"rz-ms-empty\">No results found</div>\n }\n </div>\n </div>\n }\n</div>\n\n@if (hint() && !error()) {\n <span class=\"rz-ms-msg rz-ms-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-ms-msg rz-ms-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-accent, oklch(.64 .2 50));--rz-bg: var(--color-surface, oklch(.99 0 0));--rz-border: var(--color-border, oklch(.83 .015 260));--rz-text: var(--color-text, oklch(.14 .01 260));--rz-muted: var(--color-text-muted, oklch(.48 .01 260));--rz-surface: var(--color-surface-alt, oklch(.975 .005 260));--rz-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\"]){--rz-accent: var(--color-primary, oklch(.32 .09 258))}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary, oklch(.55 .12 40))}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent, oklch(.64 .2 50))}:host([data-accent=\"success\"]){--rz-accent: var(--color-success, oklch(.55 .18 145))}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning, oklch(.68 .18 75))}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger, oklch(.55 .22 25))}:host([data-accent=\"info\"]){--rz-accent: var(--color-info, oklch(.55 .15 235))}:host.has-error .rz-ms-field{border-color:var(--color-danger, oklch(.55 .25 25))!important}:host.has-error .rz-ms-field:focus-within{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger, oklch(.55 .25 25)) 20%,transparent)!important}.rz-ms-wrapper{position:relative}.rz-ms-trigger{display:flex;align-items:center;width:100%;cursor:text}.rz-ms-field{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem;min-height:0;height:auto;cursor:pointer;width:100%;outline:none;background:var(--rz-bg);border:1px solid var(--rz-border);border-radius:var(--rz-radius);color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);transition:border-color .2s ease,box-shadow .2s ease;padding:.375rem 2.5rem .375rem .75rem;font-size:.875rem}.rz-ms-field:disabled{opacity:.5;cursor:not-allowed}:host([data-size=\"sm\"]) .rz-ms-field{padding:.25rem 2rem .25rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-ms-field{padding:.75rem 2.75rem .75rem 1rem;font-size:1rem}.rz-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(--rz-accent) 15%,transparent);color:var(--rz-accent);line-height:1.5}.rz-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}.rz-ms-chip-remove:hover{background:color-mix(in srgb,var(--rz-accent) 20%,transparent)}.rz-ms-search-input{flex:1;min-width:50px;outline:none;border:none;background:transparent;color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:0;margin:0}.rz-ms-search-input::placeholder{color:var(--rz-muted)}:host([data-size=\"sm\"]) .rz-ms-search-input{font-size:.75rem;height:1.25rem}:host([data-size=\"md\"]) .rz-ms-search-input{font-size:.875rem;height:1.5rem}:host([data-size=\"lg\"]) .rz-ms-search-input{font-size:1rem;height:1.5rem}.rz-ms-icon{position:absolute;top:50%;translate:0 -50%;right:.625rem;pointer-events:none;color:var(--rz-muted);font-size:.875rem;transition:transform .2s}.rz-ms-icon.is-open{transform:rotate(180deg)}:host([data-size=\"sm\"]) .rz-ms-icon{right:.5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-ms-icon{right:.75rem;font-size:1.125rem}.rz-ms-panel{left:0;z-index:50;width:100%;min-width:15rem;background:var(--color-surface, oklch(.99 0 0));border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:var(--radius-md, .5rem);box-shadow:0 10px 15px -3px color-mix(in srgb,var(--color-text) 10%,transparent),0 4px 6px -4px color-mix(in srgb,var(--color-text) 10%,transparent);overflow:hidden;color:var(--color-text, oklch(.14 .01 260))}.rz-ms-panel.absolute{position:absolute}.rz-ms-search-wrap{padding:.5rem .5rem 0}.rz-ms-search-field-input{width:100%;padding:.375rem .5rem;font-size:.875rem;border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:.25rem;outline:none;background:var(--color-surface, oklch(.99 0 0));color:var(--color-text, oklch(.14 .01 260));font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif)}.rz-ms-search-field-input::placeholder{color:var(--color-text-muted)}.rz-ms-search-field-input:focus{border-color:var(--color-accent)}.rz-ms-options{overflow-y:auto}.rz-ms-option{width:100%;display:flex;align-items:center;gap:.5rem;text-align:left;border:none;cursor:pointer;transition:background .1s,color .1s;background:transparent;color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem .75rem;font-size:.875rem}.rz-ms-option:hover{background:color-mix(in srgb,var(--color-accent) 12%,var(--color-surface))}.rz-ms-option.selected{background:var(--rz-accent)!important;color:var(--color-primary-inverse, oklch(.99 0 0))!important}:host([data-size=\"sm\"]) .rz-ms-option{padding:.375rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-ms-option{padding:.75rem 1rem;font-size:1rem}.rz-ms-checkbox{display:inline-flex;align-items:center;justify-content:center;width:1rem;height:1rem;border-radius:.25rem;border:1px solid var(--rz-border);font-size:.625rem;flex-shrink:0;transition:all .15s;color:transparent}.rz-ms-checkbox.checked{background:var(--rz-accent);border-color:var(--rz-accent);color:#fff}.rz-ms-option-label{font-weight:500}.rz-ms-divider{height:1px;margin:0 .5rem;background:var(--rz-border)}.rz-ms-empty{padding:1rem .75rem;text-align:center;font-size:.875rem;color:var(--rz-muted)}.rz-ms-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-ms-hint{color:var(--color-text-muted)}.rz-ms-error{color:var(--color-danger)}.rz-ms-fade-in{animation:rz-ms-in .2s ease}.rz-ms-fade-out{animation:rz-ms-out .15s ease forwards}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-ms-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes rz-ms-out{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
831
|
+
}], 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 }] }] } });
|
|
832
|
+
|
|
833
|
+
class PasswordInputComponent {
|
|
834
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
835
|
+
placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
836
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
837
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
838
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
839
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
840
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
841
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
842
|
+
hideToggle = input(false, ...(ngDevMode ? [{ debugName: "hideToggle" }] : []));
|
|
843
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
844
|
+
visible = signal(false, ...(ngDevMode ? [{ debugName: "visible" }] : []));
|
|
845
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
846
|
+
_type = computed(() => (this.visible() ? 'text' : 'password'), ...(ngDevMode ? [{ debugName: "_type" }] : []));
|
|
847
|
+
_accentKey = computed(() => {
|
|
848
|
+
const c = this.accentColor();
|
|
849
|
+
return c && isThemeColor(c) ? c : null;
|
|
850
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
851
|
+
_rawAccent = computed(() => {
|
|
852
|
+
const c = this.accentColor();
|
|
853
|
+
return c && !isThemeColor(c) ? c : null;
|
|
854
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
855
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
856
|
+
_touched = signal(false, ...(ngDevMode ? [{ debugName: "_touched" }] : []));
|
|
857
|
+
toggleVisibility() {
|
|
858
|
+
this.visible.update((v) => !v);
|
|
859
|
+
}
|
|
860
|
+
onInput(event) {
|
|
861
|
+
this.value.set(event.target.value);
|
|
862
|
+
}
|
|
863
|
+
onBlur() {
|
|
864
|
+
this._touched.set(true);
|
|
865
|
+
}
|
|
866
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: PasswordInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
867
|
+
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.--rz-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<label class=\"rz-pw-field\">\n <input\n class=\"rz-pw-input\"\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=\"rz-pw-toggle\"\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=\"rz-pw-msg rz-pw-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-pw-msg rz-pw-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-primary);--rz-bg: var(--color-surface);--rz-border: var(--color-border);--rz-text: var(--color-text);--rz-muted: var(--color-text-muted);--rz-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\"]){--rz-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent)}:host([data-accent=\"success\"]){--rz-accent: var(--color-success)}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger)}:host([data-accent=\"info\"]){--rz-accent: var(--color-info)}:host.has-error .rz-pw-input{border-color:var(--color-danger)!important}:host.has-error .rz-pw-input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.rz-pw-field{position:relative;display:flex;align-items:center;width:100%}.rz-pw-input{width:100%;outline:none;background:var(--rz-bg);border:1px solid var(--rz-border);border-radius:var(--rz-radius);color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem 2.5rem .5rem .75rem;font-size:.875rem;transition:border-color .2s ease,box-shadow .2s ease}.rz-pw-input::placeholder{color:var(--rz-muted)}.rz-pw-input:disabled{opacity:.5;cursor:not-allowed}.rz-pw-input:focus{border-color:var(--rz-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--rz-accent) 20%,transparent)}:host([data-size=\"sm\"]) .rz-pw-input{padding:.25rem 2rem .25rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-pw-input{padding:.75rem 2.75rem .75rem 1rem;font-size:1rem}.rz-pw-toggle{position:absolute;display:flex;align-items:center;justify-content:center;padding:0;border:none;border-radius:50%;background:transparent;cursor:pointer;color:var(--rz-muted);transition:color .15s,background .15s;inset-inline-end:.375rem;width:1.5rem;height:1.5rem;font-size:.875rem;top:50%;translate:0 -50%}.rz-pw-toggle:hover{color:var(--rz-text);background:var(--color-surface-alt)}:host([data-size=\"sm\"]) .rz-pw-toggle{inset-inline-end:.25rem;width:1.25rem;height:1.25rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-pw-toggle{inset-inline-end:.5rem;width:1.5rem;height:1.5rem;font-size:1.125rem}.rz-pw-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-pw-hint{color:var(--color-text-muted)}.rz-pw-error{color:var(--color-danger)}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
868
|
+
}
|
|
869
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: PasswordInputComponent, decorators: [{
|
|
870
|
+
type: Component,
|
|
871
|
+
args: [{ selector: 'app-password-input', imports: [], host: {
|
|
872
|
+
'[attr.data-size]': '_size',
|
|
873
|
+
'[attr.data-accent]': '_accentKey',
|
|
874
|
+
'[class.has-error]': 'error()',
|
|
875
|
+
'[style.--rz-accent]': '_rawAccent',
|
|
876
|
+
'[style.width]': '_width',
|
|
877
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<label class=\"rz-pw-field\">\n <input\n class=\"rz-pw-input\"\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=\"rz-pw-toggle\"\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=\"rz-pw-msg rz-pw-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-pw-msg rz-pw-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-primary);--rz-bg: var(--color-surface);--rz-border: var(--color-border);--rz-text: var(--color-text);--rz-muted: var(--color-text-muted);--rz-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\"]){--rz-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent)}:host([data-accent=\"success\"]){--rz-accent: var(--color-success)}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger)}:host([data-accent=\"info\"]){--rz-accent: var(--color-info)}:host.has-error .rz-pw-input{border-color:var(--color-danger)!important}:host.has-error .rz-pw-input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.rz-pw-field{position:relative;display:flex;align-items:center;width:100%}.rz-pw-input{width:100%;outline:none;background:var(--rz-bg);border:1px solid var(--rz-border);border-radius:var(--rz-radius);color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem 2.5rem .5rem .75rem;font-size:.875rem;transition:border-color .2s ease,box-shadow .2s ease}.rz-pw-input::placeholder{color:var(--rz-muted)}.rz-pw-input:disabled{opacity:.5;cursor:not-allowed}.rz-pw-input:focus{border-color:var(--rz-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--rz-accent) 20%,transparent)}:host([data-size=\"sm\"]) .rz-pw-input{padding:.25rem 2rem .25rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-pw-input{padding:.75rem 2.75rem .75rem 1rem;font-size:1rem}.rz-pw-toggle{position:absolute;display:flex;align-items:center;justify-content:center;padding:0;border:none;border-radius:50%;background:transparent;cursor:pointer;color:var(--rz-muted);transition:color .15s,background .15s;inset-inline-end:.375rem;width:1.5rem;height:1.5rem;font-size:.875rem;top:50%;translate:0 -50%}.rz-pw-toggle:hover{color:var(--rz-text);background:var(--color-surface-alt)}:host([data-size=\"sm\"]) .rz-pw-toggle{inset-inline-end:.25rem;width:1.25rem;height:1.25rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-pw-toggle{inset-inline-end:.5rem;width:1.5rem;height:1.5rem;font-size:1.125rem}.rz-pw-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-pw-hint{color:var(--color-text-muted)}.rz-pw-error{color:var(--color-danger)}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
878
|
+
}], 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 }] }] } });
|
|
879
|
+
|
|
880
|
+
class SearchInputComponent {
|
|
881
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
882
|
+
placeholder = input('Search...', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
883
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
884
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
885
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
886
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
887
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
888
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
889
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
890
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
891
|
+
_accentKey = computed(() => {
|
|
892
|
+
const c = this.accentColor();
|
|
893
|
+
return c && isThemeColor(c) ? c : null;
|
|
894
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
895
|
+
_rawAccent = computed(() => {
|
|
896
|
+
const c = this.accentColor();
|
|
897
|
+
return c && !isThemeColor(c) ? c : null;
|
|
898
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
899
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
900
|
+
_touched = signal(false, ...(ngDevMode ? [{ debugName: "_touched" }] : []));
|
|
901
|
+
onInput(event) {
|
|
902
|
+
this.value.set(event.target.value);
|
|
903
|
+
}
|
|
904
|
+
onBlur() {
|
|
905
|
+
this._touched.set(true);
|
|
906
|
+
}
|
|
907
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SearchInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
908
|
+
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.--rz-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<div class=\"rz-search-field\">\n <span class=\"rz-search-icon\" aria-hidden=\"true\">\n <i class=\"pi pi-search\"></i>\n </span>\n\n <input\n class=\"rz-search-input\"\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=\"rz-search-clear\" type=\"button\" (click)=\"value.set('')\" aria-label=\"Clear search\">\n <i class=\"pi pi-times\"></i>\n </button>\n }\n</div>\n\n@if (hint() && !error()) {\n <span class=\"rz-search-msg rz-search-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-search-msg rz-search-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-primary);--rz-bg: var(--color-surface);--rz-border: var(--color-border);--rz-text: var(--color-text);--rz-muted: var(--color-text-muted);--rz-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\"]){--rz-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent)}:host([data-accent=\"success\"]){--rz-accent: var(--color-success)}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger)}:host([data-accent=\"info\"]){--rz-accent: var(--color-info)}.rz-search-field{position:relative;display:flex;align-items:center;width:100%}.rz-search-icon{position:absolute;left:.75rem;display:flex;align-items:center;pointer-events:none;z-index:1;color:var(--rz-muted);font-size:.875rem;transition:color .2s}:host([data-size=\"sm\"]) .rz-search-icon{left:.5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-search-icon{left:.875rem;font-size:1.125rem}.rz-search-input{width:100%;outline:none;background:var(--rz-bg);border:1px solid var(--rz-border);border-radius:var(--rz-radius);color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem 2.5rem;font-size:.875rem;transition:border-color .2s ease,box-shadow .2s ease}.rz-search-input::placeholder{color:var(--rz-muted)}.rz-search-input:disabled{opacity:.5;cursor:not-allowed}.rz-search-input:focus{border-color:var(--rz-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--rz-accent) 20%,transparent)}:host([data-size=\"sm\"]) .rz-search-input{padding:.25rem 2rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-search-input{padding:.75rem 2.75rem;font-size:1rem}.rz-search-input::-webkit-search-decoration,.rz-search-input::-webkit-search-cancel-button,.rz-search-input::-webkit-search-results-button,.rz-search-input::-webkit-search-results-decoration{display:none}.rz-search-clear{position:absolute;right:.5rem;display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:none;border-radius:50%;background:transparent;cursor:pointer;color:var(--rz-muted);font-size:.75rem;transition:color .15s,background .15s}.rz-search-clear:hover{color:var(--rz-text);background:var(--color-surface-alt)}.rz-search-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-search-hint{color:var(--color-text-muted)}.rz-search-error{color:var(--color-danger)}:host.has-error .rz-search-input{border-color:var(--color-danger)!important}:host.has-error .rz-search-input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
909
|
+
}
|
|
910
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SearchInputComponent, decorators: [{
|
|
911
|
+
type: Component,
|
|
912
|
+
args: [{ selector: 'app-search-input', imports: [], host: {
|
|
913
|
+
'[attr.data-size]': '_size',
|
|
914
|
+
'[attr.data-accent]': '_accentKey',
|
|
915
|
+
'[class.has-error]': 'error()',
|
|
916
|
+
'[style.--rz-accent]': '_rawAccent',
|
|
917
|
+
'[style.width]': '_width',
|
|
918
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"rz-search-field\">\n <span class=\"rz-search-icon\" aria-hidden=\"true\">\n <i class=\"pi pi-search\"></i>\n </span>\n\n <input\n class=\"rz-search-input\"\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=\"rz-search-clear\" type=\"button\" (click)=\"value.set('')\" aria-label=\"Clear search\">\n <i class=\"pi pi-times\"></i>\n </button>\n }\n</div>\n\n@if (hint() && !error()) {\n <span class=\"rz-search-msg rz-search-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-search-msg rz-search-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-primary);--rz-bg: var(--color-surface);--rz-border: var(--color-border);--rz-text: var(--color-text);--rz-muted: var(--color-text-muted);--rz-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\"]){--rz-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent)}:host([data-accent=\"success\"]){--rz-accent: var(--color-success)}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger)}:host([data-accent=\"info\"]){--rz-accent: var(--color-info)}.rz-search-field{position:relative;display:flex;align-items:center;width:100%}.rz-search-icon{position:absolute;left:.75rem;display:flex;align-items:center;pointer-events:none;z-index:1;color:var(--rz-muted);font-size:.875rem;transition:color .2s}:host([data-size=\"sm\"]) .rz-search-icon{left:.5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-search-icon{left:.875rem;font-size:1.125rem}.rz-search-input{width:100%;outline:none;background:var(--rz-bg);border:1px solid var(--rz-border);border-radius:var(--rz-radius);color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem 2.5rem;font-size:.875rem;transition:border-color .2s ease,box-shadow .2s ease}.rz-search-input::placeholder{color:var(--rz-muted)}.rz-search-input:disabled{opacity:.5;cursor:not-allowed}.rz-search-input:focus{border-color:var(--rz-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--rz-accent) 20%,transparent)}:host([data-size=\"sm\"]) .rz-search-input{padding:.25rem 2rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-search-input{padding:.75rem 2.75rem;font-size:1rem}.rz-search-input::-webkit-search-decoration,.rz-search-input::-webkit-search-cancel-button,.rz-search-input::-webkit-search-results-button,.rz-search-input::-webkit-search-results-decoration{display:none}.rz-search-clear{position:absolute;right:.5rem;display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:none;border-radius:50%;background:transparent;cursor:pointer;color:var(--rz-muted);font-size:.75rem;transition:color .15s,background .15s}.rz-search-clear:hover{color:var(--rz-text);background:var(--color-surface-alt)}.rz-search-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-search-hint{color:var(--color-text-muted)}.rz-search-error{color:var(--color-danger)}:host.has-error .rz-search-input{border-color:var(--color-danger)!important}:host.has-error .rz-search-input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
919
|
+
}], 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 }] }] } });
|
|
920
|
+
|
|
921
|
+
class TextInputComponent {
|
|
922
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
923
|
+
placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
924
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
925
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
926
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
927
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
928
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
929
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
930
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
931
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
932
|
+
_accentKey = computed(() => {
|
|
933
|
+
const c = this.accentColor();
|
|
934
|
+
return c && isThemeColor(c) ? c : null;
|
|
935
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
936
|
+
_rawAccent = computed(() => {
|
|
937
|
+
const c = this.accentColor();
|
|
938
|
+
return c && !isThemeColor(c) ? c : null;
|
|
939
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
940
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
941
|
+
_touched = signal(false, ...(ngDevMode ? [{ debugName: "_touched" }] : []));
|
|
942
|
+
onInput(event) {
|
|
943
|
+
this.value.set(event.target.value);
|
|
944
|
+
}
|
|
945
|
+
onBlur() {
|
|
946
|
+
this._touched.set(true);
|
|
947
|
+
}
|
|
948
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TextInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
949
|
+
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.--rz-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<input\n class=\"rz-text-input\"\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=\"rz-text-msg rz-text-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-text-msg rz-text-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-primary);--rz-bg: var(--color-surface);--rz-border: var(--color-border);--rz-text: var(--color-text);--rz-muted: var(--color-text-muted);--rz-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\"]){--rz-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent)}:host([data-accent=\"success\"]){--rz-accent: var(--color-success)}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger)}:host([data-accent=\"info\"]){--rz-accent: var(--color-info)}.rz-text-input{width:100%;outline:none;background:var(--rz-bg);border:1px solid var(--rz-border);border-radius:var(--rz-radius);color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem .75rem;font-size:.875rem;transition:border-color .2s ease,box-shadow .2s ease}.rz-text-input::placeholder{color:var(--rz-muted)}.rz-text-input:disabled{opacity:.5;cursor:not-allowed}.rz-text-input:focus{border-color:var(--rz-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--rz-accent) 20%,transparent)}:host([data-size=\"sm\"]) .rz-text-input{padding:.25rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-text-input{padding:.75rem 1rem;font-size:1rem}.rz-text-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-text-hint{color:var(--color-text-muted)}.rz-text-error{color:var(--color-danger)}:host.has-error .rz-text-input{border-color:var(--color-danger)!important}:host.has-error .rz-text-input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
950
|
+
}
|
|
951
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TextInputComponent, decorators: [{
|
|
952
|
+
type: Component,
|
|
953
|
+
args: [{ selector: 'app-text-input', imports: [], host: {
|
|
954
|
+
'[attr.data-size]': '_size',
|
|
955
|
+
'[attr.data-accent]': '_accentKey',
|
|
956
|
+
'[class.has-error]': 'error()',
|
|
957
|
+
'[style.--rz-accent]': '_rawAccent',
|
|
958
|
+
'[style.width]': '_width',
|
|
959
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<input\n class=\"rz-text-input\"\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=\"rz-text-msg rz-text-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-text-msg rz-text-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid value' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-primary);--rz-bg: var(--color-surface);--rz-border: var(--color-border);--rz-text: var(--color-text);--rz-muted: var(--color-text-muted);--rz-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\"]){--rz-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent)}:host([data-accent=\"success\"]){--rz-accent: var(--color-success)}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger)}:host([data-accent=\"info\"]){--rz-accent: var(--color-info)}.rz-text-input{width:100%;outline:none;background:var(--rz-bg);border:1px solid var(--rz-border);border-radius:var(--rz-radius);color:var(--rz-text);font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);padding:.5rem .75rem;font-size:.875rem;transition:border-color .2s ease,box-shadow .2s ease}.rz-text-input::placeholder{color:var(--rz-muted)}.rz-text-input:disabled{opacity:.5;cursor:not-allowed}.rz-text-input:focus{border-color:var(--rz-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--rz-accent) 20%,transparent)}:host([data-size=\"sm\"]) .rz-text-input{padding:.25rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-text-input{padding:.75rem 1rem;font-size:1rem}.rz-text-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-text-hint{color:var(--color-text-muted)}.rz-text-error{color:var(--color-danger)}:host.has-error .rz-text-input{border-color:var(--color-danger)!important}:host.has-error .rz-text-input:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--color-danger) 20%,transparent)!important}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
960
|
+
}], 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 }] }] } });
|
|
961
|
+
|
|
962
|
+
class ToggleComponent {
|
|
963
|
+
checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : []));
|
|
964
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
965
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
966
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
967
|
+
accentColor = input(null, ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
968
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
969
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
970
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
971
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
972
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
973
|
+
_accentKey = computed(() => {
|
|
974
|
+
const c = this.accentColor();
|
|
975
|
+
return c && isThemeColor(c) ? c : null;
|
|
976
|
+
}, ...(ngDevMode ? [{ debugName: "_accentKey" }] : []));
|
|
977
|
+
_rawAccent = computed(() => {
|
|
978
|
+
const c = this.accentColor();
|
|
979
|
+
return c && !isThemeColor(c) ? c : null;
|
|
980
|
+
}, ...(ngDevMode ? [{ debugName: "_rawAccent" }] : []));
|
|
981
|
+
_width = computed(() => this.width() || null, ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
982
|
+
toggle() {
|
|
983
|
+
if (this.disabled())
|
|
984
|
+
return;
|
|
985
|
+
this.checked.update(v => !v);
|
|
986
|
+
}
|
|
987
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
988
|
+
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.--rz-accent": "_rawAccent", "style.width": "_width" } }, ngImport: i0, template: "<label class=\"rz-toggle-field\">\n @if (label()) {\n <span class=\"rz-toggle-label\">{{ label() }}</span>\n }\n\n <button\n class=\"rz-toggle-track\"\n type=\"button\"\n role=\"switch\"\n [attr.aria-checked]=\"checked()\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n >\n <span class=\"rz-toggle-knob\"></span>\n </button>\n</label>\n\n@if (hint() && !error()) {\n <span class=\"rz-toggle-msg rz-toggle-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-toggle-msg rz-toggle-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-primary);--rz-toggle-bg: var(--color-text-muted);--rz-toggle-knob: var(--color-surface);--rz-toggle-knob-border: var(--color-border-light);--rz-muted: var(--color-text-muted);--rz-text: var(--color-text);--rz-radius: var(--radius-full);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\"]){--rz-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent)}:host([data-accent=\"success\"]){--rz-accent: var(--color-success)}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger)}:host([data-accent=\"info\"]){--rz-accent: var(--color-info)}.rz-toggle-field{display:inline-flex;align-items:center;gap:.625rem;cursor:default}.rz-toggle-label{font-family:var(--font-sans);font-size:.875rem;color:var(--rz-text);-webkit-user-select:none;user-select:none}:host([data-size=\"sm\"]) .rz-toggle-label{font-size:.75rem}:host([data-size=\"md\"]) .rz-toggle-label{font-size:.875rem}:host([data-size=\"lg\"]) .rz-toggle-label{font-size:1rem}.rz-toggle-track{position:relative;display:inline-flex;align-items:center;padding:3px;border:none;border-radius:var(--rz-radius);background:var(--rz-toggle-bg);cursor:pointer;transition:background .2s ease}.rz-toggle-track:focus-visible{outline:2px solid var(--rz-accent);outline-offset:2px}.rz-toggle-track:disabled{opacity:.5;cursor:not-allowed}:host([data-size=\"sm\"]) .rz-toggle-track{width:2.125rem;height:1.25rem}:host([data-size=\"md\"]) .rz-toggle-track{width:2.75rem;height:1.5rem}:host([data-size=\"lg\"]) .rz-toggle-track{width:3.25rem;height:1.75rem}.rz-toggle-knob{position:absolute;top:3px;left:3px;background:var(--rz-toggle-knob);border:1px solid var(--rz-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([data-size=\"sm\"]){--rz-toggle-knob-size: .875rem}:host([data-size=\"sm\"]) .rz-toggle-knob{width:.875rem;height:.875rem}:host([data-size=\"md\"]){--rz-toggle-knob-size: 1.125rem}:host([data-size=\"md\"]) .rz-toggle-knob{width:1.125rem;height:1.125rem}:host([data-size=\"lg\"]){--rz-toggle-knob-size: 1.375rem}:host([data-size=\"lg\"]) .rz-toggle-knob{width:1.375rem;height:1.375rem}:host(.is-checked) .rz-toggle-track{background:var(--rz-accent)}:host(.is-checked) .rz-toggle-knob{left:calc(100% - var(--rz-toggle-knob-size) - 3px)}.rz-toggle-msg{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}.rz-toggle-hint{color:var(--color-text-muted)}.rz-toggle-error{color:var(--color-danger)}:host(.has-error) .rz-toggle-track{outline:2px solid var(--color-danger)}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
989
|
+
}
|
|
990
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToggleComponent, decorators: [{
|
|
991
|
+
type: Component,
|
|
992
|
+
args: [{ selector: 'app-toggle', imports: [], host: {
|
|
993
|
+
'[attr.data-size]': '_size',
|
|
994
|
+
'[attr.data-accent]': '_accentKey',
|
|
995
|
+
'[class.has-error]': 'error()',
|
|
996
|
+
'[class.is-checked]': 'checked()',
|
|
997
|
+
'[style.--rz-accent]': '_rawAccent',
|
|
998
|
+
'[style.width]': '_width',
|
|
999
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<label class=\"rz-toggle-field\">\n @if (label()) {\n <span class=\"rz-toggle-label\">{{ label() }}</span>\n }\n\n <button\n class=\"rz-toggle-track\"\n type=\"button\"\n role=\"switch\"\n [attr.aria-checked]=\"checked()\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n >\n <span class=\"rz-toggle-knob\"></span>\n </button>\n</label>\n\n@if (hint() && !error()) {\n <span class=\"rz-toggle-msg rz-toggle-hint\" animate.enter=\"hint-enter\" animate.leave=\"hint-leave\">{{ hint() }}</span>\n}\n@if (error()) {\n <span class=\"rz-toggle-msg rz-toggle-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-primary);--rz-toggle-bg: var(--color-text-muted);--rz-toggle-knob: var(--color-surface);--rz-toggle-knob-border: var(--color-border-light);--rz-muted: var(--color-text-muted);--rz-text: var(--color-text);--rz-radius: var(--radius-full);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\"]){--rz-accent: var(--color-primary)}:host([data-accent=\"secondary\"]){--rz-accent: var(--color-secondary)}:host([data-accent=\"accent\"]){--rz-accent: var(--color-accent)}:host([data-accent=\"success\"]){--rz-accent: var(--color-success)}:host([data-accent=\"warning\"]){--rz-accent: var(--color-warning)}:host([data-accent=\"danger\"]){--rz-accent: var(--color-danger)}:host([data-accent=\"info\"]){--rz-accent: var(--color-info)}.rz-toggle-field{display:inline-flex;align-items:center;gap:.625rem;cursor:default}.rz-toggle-label{font-family:var(--font-sans);font-size:.875rem;color:var(--rz-text);-webkit-user-select:none;user-select:none}:host([data-size=\"sm\"]) .rz-toggle-label{font-size:.75rem}:host([data-size=\"md\"]) .rz-toggle-label{font-size:.875rem}:host([data-size=\"lg\"]) .rz-toggle-label{font-size:1rem}.rz-toggle-track{position:relative;display:inline-flex;align-items:center;padding:3px;border:none;border-radius:var(--rz-radius);background:var(--rz-toggle-bg);cursor:pointer;transition:background .2s ease}.rz-toggle-track:focus-visible{outline:2px solid var(--rz-accent);outline-offset:2px}.rz-toggle-track:disabled{opacity:.5;cursor:not-allowed}:host([data-size=\"sm\"]) .rz-toggle-track{width:2.125rem;height:1.25rem}:host([data-size=\"md\"]) .rz-toggle-track{width:2.75rem;height:1.5rem}:host([data-size=\"lg\"]) .rz-toggle-track{width:3.25rem;height:1.75rem}.rz-toggle-knob{position:absolute;top:3px;left:3px;background:var(--rz-toggle-knob);border:1px solid var(--rz-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([data-size=\"sm\"]){--rz-toggle-knob-size: .875rem}:host([data-size=\"sm\"]) .rz-toggle-knob{width:.875rem;height:.875rem}:host([data-size=\"md\"]){--rz-toggle-knob-size: 1.125rem}:host([data-size=\"md\"]) .rz-toggle-knob{width:1.125rem;height:1.125rem}:host([data-size=\"lg\"]){--rz-toggle-knob-size: 1.375rem}:host([data-size=\"lg\"]) .rz-toggle-knob{width:1.375rem;height:1.375rem}:host(.is-checked) .rz-toggle-track{background:var(--rz-accent)}:host(.is-checked) .rz-toggle-knob{left:calc(100% - var(--rz-toggle-knob-size) - 3px)}.rz-toggle-msg{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}.rz-toggle-hint{color:var(--color-text-muted)}.rz-toggle-error{color:var(--color-danger)}:host(.has-error) .rz-toggle-track{outline:2px solid var(--color-danger)}.hint-enter{animation:rz-hint-in .2s ease-out}.error-enter{animation:rz-error-in .25s ease-out}.hint-leave{animation:rz-hint-out .15s ease-in forwards}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-hint-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}@keyframes rz-hint-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -4px}}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
1000
|
+
}], 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 }] }] } });
|
|
1001
|
+
|
|
1002
|
+
class BadgeComponent {
|
|
1003
|
+
accentColor = input('primary', ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
1004
|
+
variant = input('filled', ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
1005
|
+
size = input('sm', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1006
|
+
dot = input(false, ...(ngDevMode ? [{ debugName: "dot" }] : []));
|
|
1007
|
+
_sizeCls = computed(() => 'rz-badge', ...(ngDevMode ? [{ debugName: "_sizeCls" }] : []));
|
|
1008
|
+
_fallback = {
|
|
1009
|
+
primary: 'oklch(0.32 0.09 258)',
|
|
1010
|
+
secondary: 'oklch(0.55 0.12 40)',
|
|
1011
|
+
accent: 'oklch(0.64 0.2 50)',
|
|
1012
|
+
success: 'oklch(0.55 0.18 145)',
|
|
1013
|
+
warning: 'oklch(0.68 0.18 75)',
|
|
1014
|
+
danger: 'oklch(0.55 0.22 25)',
|
|
1015
|
+
info: 'oklch(0.55 0.15 235)',
|
|
1016
|
+
};
|
|
1017
|
+
_resolvedColor = computed(() => {
|
|
1018
|
+
const c = this.accentColor();
|
|
1019
|
+
if (isThemeColor(c))
|
|
1020
|
+
return `var(--color-${c}, ${this._fallback[c] ?? this._fallback['primary']})`;
|
|
1021
|
+
return c;
|
|
1022
|
+
}, ...(ngDevMode ? [{ debugName: "_resolvedColor" }] : []));
|
|
1023
|
+
_subtleBg = computed(() => {
|
|
1024
|
+
const c = this.accentColor();
|
|
1025
|
+
const key = isThemeColor(c) ? c : 'primary';
|
|
1026
|
+
return `color-mix(in srgb, var(--color-${key}, ${this._fallback[key]}) 15%, var(--color-surface, oklch(0.99 0 0)))`;
|
|
1027
|
+
}, ...(ngDevMode ? [{ debugName: "_subtleBg" }] : []));
|
|
1028
|
+
_style = computed(() => {
|
|
1029
|
+
const v = this.variant();
|
|
1030
|
+
const color = this._resolvedColor();
|
|
1031
|
+
if (v === 'filled')
|
|
1032
|
+
return { backgroundColor: color, color: 'var(--color-primary-inverse,oklch(0.99 0 0))' };
|
|
1033
|
+
if (v === 'outlined')
|
|
1034
|
+
return { backgroundColor: 'transparent', color, border: `1px solid ${color}` };
|
|
1035
|
+
return { backgroundColor: this._subtleBg(), color };
|
|
1036
|
+
}, ...(ngDevMode ? [{ debugName: "_style" }] : []));
|
|
1037
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: BadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1038
|
+
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 } }, host: { properties: { "attr.data-size": "size()" } }, ngImport: i0, template: "<span class=\"rz-badge\" [style]=\"_style()\">\n @if (dot()) {\n <span class=\"rz-badge-dot\"></span>\n }\n <ng-content />\n</span>\n", styles: [":host{display:inline-flex}.rz-badge{display:inline-flex;align-items:center;gap:.25rem;font-weight:500;border-radius:var(--radius-sm, .25rem);white-space:nowrap}:host([data-size=\"sm\"]) .rz-badge{padding:.125rem .375rem;font-size:.625rem}:host([data-size=\"md\"]) .rz-badge{padding:.125rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-badge{padding:.25rem .625rem;font-size:.875rem}.rz-badge-dot{border-radius:9999px;flex-shrink:0;width:6px;height:6px;background-color:currentColor}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1039
|
+
}
|
|
1040
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: BadgeComponent, decorators: [{
|
|
1041
|
+
type: Component,
|
|
1042
|
+
args: [{ selector: 'app-badge', imports: [], host: {
|
|
1043
|
+
'[attr.data-size]': 'size()',
|
|
1044
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<span class=\"rz-badge\" [style]=\"_style()\">\n @if (dot()) {\n <span class=\"rz-badge-dot\"></span>\n }\n <ng-content />\n</span>\n", styles: [":host{display:inline-flex}.rz-badge{display:inline-flex;align-items:center;gap:.25rem;font-weight:500;border-radius:var(--radius-sm, .25rem);white-space:nowrap}:host([data-size=\"sm\"]) .rz-badge{padding:.125rem .375rem;font-size:.625rem}:host([data-size=\"md\"]) .rz-badge{padding:.125rem .5rem;font-size:.75rem}:host([data-size=\"lg\"]) .rz-badge{padding:.25rem .625rem;font-size:.875rem}.rz-badge-dot{border-radius:9999px;flex-shrink:0;width:6px;height:6px;background-color:currentColor}\n"] }]
|
|
1045
|
+
}], 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 }] }] } });
|
|
1046
|
+
|
|
1047
|
+
class BannerSliderComponent {
|
|
1048
|
+
items = input.required(...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
1049
|
+
height = input('400px', ...(ngDevMode ? [{ debugName: "height" }] : []));
|
|
1050
|
+
autoPlay = input(true, ...(ngDevMode ? [{ debugName: "autoPlay" }] : []));
|
|
1051
|
+
interval = input(5000, ...(ngDevMode ? [{ debugName: "interval" }] : []));
|
|
1052
|
+
showArrows = input(true, ...(ngDevMode ? [{ debugName: "showArrows" }] : []));
|
|
1053
|
+
showDots = input(true, ...(ngDevMode ? [{ debugName: "showDots" }] : []));
|
|
1054
|
+
overlayMode = input('left', ...(ngDevMode ? [{ debugName: "overlayMode" }] : []));
|
|
1055
|
+
ctaClick = output();
|
|
1056
|
+
_height = computed(() => this.height(), ...(ngDevMode ? [{ debugName: "_height" }] : []));
|
|
1057
|
+
_index = signal(0, ...(ngDevMode ? [{ debugName: "_index" }] : []));
|
|
1058
|
+
_overlayCls = computed(() => `overlay-${this.overlayMode()}`, ...(ngDevMode ? [{ debugName: "_overlayCls" }] : []));
|
|
1059
|
+
_timer = null;
|
|
1060
|
+
constructor() {
|
|
1061
|
+
effect(() => {
|
|
1062
|
+
if (this.autoPlay())
|
|
1063
|
+
this._startTimer();
|
|
1064
|
+
else
|
|
1065
|
+
this._stopTimer();
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
_transform = computed(() => `translateX(-${this._index() * 100}%)`, ...(ngDevMode ? [{ debugName: "_transform" }] : []));
|
|
1069
|
+
_current = computed(() => this.items()[this._index()], ...(ngDevMode ? [{ debugName: "_current" }] : []));
|
|
1070
|
+
_go(index) {
|
|
1071
|
+
const len = this.items().length;
|
|
1072
|
+
if (len < 2)
|
|
1073
|
+
return;
|
|
1074
|
+
this._index.set(((index % len) + len) % len);
|
|
1075
|
+
if (this.autoPlay())
|
|
1076
|
+
this._startTimer();
|
|
1077
|
+
}
|
|
1078
|
+
_prev() { this._go(this._index() - 1); }
|
|
1079
|
+
_next() { this._go(this._index() + 1); }
|
|
1080
|
+
_onCtaClick() {
|
|
1081
|
+
this.ctaClick.emit(this._current());
|
|
1082
|
+
}
|
|
1083
|
+
_startTimer() {
|
|
1084
|
+
this._stopTimer();
|
|
1085
|
+
this._timer = setInterval(() => this._next(), this.interval());
|
|
1086
|
+
}
|
|
1087
|
+
_stopTimer() {
|
|
1088
|
+
if (this._timer) {
|
|
1089
|
+
clearInterval(this._timer);
|
|
1090
|
+
this._timer = null;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
_xStart = 0;
|
|
1094
|
+
_onTouchStart(event) {
|
|
1095
|
+
this._xStart = event.touches[0].clientX;
|
|
1096
|
+
}
|
|
1097
|
+
_onTouchEnd(event) {
|
|
1098
|
+
const dx = event.changedTouches[0].clientX - this._xStart;
|
|
1099
|
+
if (Math.abs(dx) > 50)
|
|
1100
|
+
dx > 0 ? this._prev() : this._next();
|
|
1101
|
+
}
|
|
1102
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: BannerSliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1103
|
+
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 });
|
|
1104
|
+
}
|
|
1105
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: BannerSliderComponent, decorators: [{
|
|
1106
|
+
type: Component,
|
|
1107
|
+
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"] }]
|
|
1108
|
+
}], 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"] }] } });
|
|
1109
|
+
|
|
1110
|
+
class CarouselComponent {
|
|
1111
|
+
items = input.required(...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
1112
|
+
height = input('320px', ...(ngDevMode ? [{ debugName: "height" }] : []));
|
|
1113
|
+
autoPlay = input(true, ...(ngDevMode ? [{ debugName: "autoPlay" }] : []));
|
|
1114
|
+
interval = input(4000, ...(ngDevMode ? [{ debugName: "interval" }] : []));
|
|
1115
|
+
showArrows = input(true, ...(ngDevMode ? [{ debugName: "showArrows" }] : []));
|
|
1116
|
+
showDots = input(true, ...(ngDevMode ? [{ debugName: "showDots" }] : []));
|
|
1117
|
+
_height = computed(() => this.height(), ...(ngDevMode ? [{ debugName: "_height" }] : []));
|
|
1118
|
+
_index = signal(0, ...(ngDevMode ? [{ debugName: "_index" }] : []));
|
|
1119
|
+
_timer = null;
|
|
1120
|
+
constructor() {
|
|
1121
|
+
effect(() => {
|
|
1122
|
+
const ap = this.autoPlay();
|
|
1123
|
+
if (ap) {
|
|
1124
|
+
this._startTimer();
|
|
1125
|
+
}
|
|
1126
|
+
else {
|
|
1127
|
+
this._stopTimer();
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
_current = computed(() => this.items()[this._index()], ...(ngDevMode ? [{ debugName: "_current" }] : []));
|
|
1132
|
+
_transform = computed(() => `translateX(-${this._index() * 100}%)`, ...(ngDevMode ? [{ debugName: "_transform" }] : []));
|
|
1133
|
+
_go(index) {
|
|
1134
|
+
const len = this.items().length;
|
|
1135
|
+
if (len < 2)
|
|
1136
|
+
return;
|
|
1137
|
+
this._index.set(((index % len) + len) % len);
|
|
1138
|
+
if (this.autoPlay())
|
|
1139
|
+
this._startTimer();
|
|
1140
|
+
}
|
|
1141
|
+
_prev() { this._go(this._index() - 1); }
|
|
1142
|
+
_next() { this._go(this._index() + 1); }
|
|
1143
|
+
_startTimer() {
|
|
1144
|
+
this._stopTimer();
|
|
1145
|
+
this._timer = setInterval(() => this._next(), this.interval());
|
|
1146
|
+
}
|
|
1147
|
+
_stopTimer() {
|
|
1148
|
+
if (this._timer) {
|
|
1149
|
+
clearInterval(this._timer);
|
|
1150
|
+
this._timer = null;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
_xStart = 0;
|
|
1154
|
+
_onTouchStart(event) {
|
|
1155
|
+
this._xStart = event.touches[0].clientX;
|
|
1156
|
+
}
|
|
1157
|
+
_onTouchEnd(event) {
|
|
1158
|
+
const dx = event.changedTouches[0].clientX - this._xStart;
|
|
1159
|
+
if (Math.abs(dx) > 50) {
|
|
1160
|
+
dx > 0 ? this._prev() : this._next();
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: CarouselComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1164
|
+
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;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 });
|
|
1165
|
+
}
|
|
1166
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: CarouselComponent, decorators: [{
|
|
1167
|
+
type: Component,
|
|
1168
|
+
args: [{ selector: 'app-carousel', imports: [], host: {
|
|
1169
|
+
'[style.height]': '_height',
|
|
1170
|
+
}, 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;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"] }]
|
|
1171
|
+
}], 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 }] }] } });
|
|
1172
|
+
|
|
1173
|
+
class EmptyStateComponent {
|
|
1174
|
+
icon = input('', ...(ngDevMode ? [{ debugName: "icon" }] : []));
|
|
1175
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
1176
|
+
message = input('', ...(ngDevMode ? [{ debugName: "message" }] : []));
|
|
1177
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
1178
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: EmptyStateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1179
|
+
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=\"rz-empty\" [style.width]=\"width() || '100%'\">\n @if (icon()) {\n <div class=\"rz-empty-icon-wrap\">\n <i [class]=\"icon()\" class=\"rz-empty-icon\"></i>\n </div>\n }\n @if (title()) {\n <h3 class=\"rz-empty-title\">{{ title() }}</h3>\n }\n @if (message()) {\n <p class=\"rz-empty-message\">{{ message() }}</p>\n }\n <ng-content />\n</div>\n", styles: [":host{display:contents}.rz-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.75rem;padding:3rem 1rem;text-align:center}.rz-empty-icon-wrap{display:flex;align-items:center;justify-content:center;width:3.5rem;height:3.5rem;border-radius:9999px;background:var(--color-surface-alt, oklch(.975 .005 260))}.rz-empty-icon{font-size:1.125rem;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-empty-title{font-size:1rem;font-weight:600;color:var(--color-text, oklch(.14 .01 260))}.rz-empty-message{font-size:.875rem;color:var(--color-text-muted, oklch(.48 .01 260));max-width:20rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1180
|
+
}
|
|
1181
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: EmptyStateComponent, decorators: [{
|
|
1182
|
+
type: Component,
|
|
1183
|
+
args: [{ selector: 'app-empty-state', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"rz-empty\" [style.width]=\"width() || '100%'\">\n @if (icon()) {\n <div class=\"rz-empty-icon-wrap\">\n <i [class]=\"icon()\" class=\"rz-empty-icon\"></i>\n </div>\n }\n @if (title()) {\n <h3 class=\"rz-empty-title\">{{ title() }}</h3>\n }\n @if (message()) {\n <p class=\"rz-empty-message\">{{ message() }}</p>\n }\n <ng-content />\n</div>\n", styles: [":host{display:contents}.rz-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.75rem;padding:3rem 1rem;text-align:center}.rz-empty-icon-wrap{display:flex;align-items:center;justify-content:center;width:3.5rem;height:3.5rem;border-radius:9999px;background:var(--color-surface-alt, oklch(.975 .005 260))}.rz-empty-icon{font-size:1.125rem;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-empty-title{font-size:1rem;font-weight:600;color:var(--color-text, oklch(.14 .01 260))}.rz-empty-message{font-size:.875rem;color:var(--color-text-muted, oklch(.48 .01 260));max-width:20rem}\n"] }]
|
|
1184
|
+
}], 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 }] }] } });
|
|
1185
|
+
|
|
1186
|
+
class ImageUploadComponent {
|
|
1187
|
+
images = model([], ...(ngDevMode ? [{ debugName: "images" }] : []));
|
|
1188
|
+
multiple = input(true, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
1189
|
+
maxFiles = input(4, ...(ngDevMode ? [{ debugName: "maxFiles" }] : []));
|
|
1190
|
+
maxSize = input(2097152, ...(ngDevMode ? [{ debugName: "maxSize" }] : []));
|
|
1191
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
1192
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1193
|
+
placeholder = input('Drop images or click', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1194
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
|
|
1195
|
+
error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
1196
|
+
_size = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
1197
|
+
_isDragOver = signal(false, ...(ngDevMode ? [{ debugName: "_isDragOver" }] : []));
|
|
1198
|
+
_onDragOver(event) {
|
|
1199
|
+
event.preventDefault();
|
|
1200
|
+
event.stopPropagation();
|
|
1201
|
+
if (!this.disabled())
|
|
1202
|
+
this._isDragOver.set(true);
|
|
1203
|
+
}
|
|
1204
|
+
_onDragLeave(event) {
|
|
1205
|
+
event.preventDefault();
|
|
1206
|
+
event.stopPropagation();
|
|
1207
|
+
this._isDragOver.set(false);
|
|
1208
|
+
}
|
|
1209
|
+
_onDrop(event) {
|
|
1210
|
+
event.preventDefault();
|
|
1211
|
+
event.stopPropagation();
|
|
1212
|
+
this._isDragOver.set(false);
|
|
1213
|
+
if (this.disabled())
|
|
1214
|
+
return;
|
|
1215
|
+
const dropped = event.dataTransfer?.files;
|
|
1216
|
+
if (dropped)
|
|
1217
|
+
this._addFiles(Array.from(dropped));
|
|
1218
|
+
}
|
|
1219
|
+
_onFileSelected(event) {
|
|
1220
|
+
const input = event.target;
|
|
1221
|
+
if (input.files)
|
|
1222
|
+
this._addFiles(Array.from(input.files));
|
|
1223
|
+
input.value = '';
|
|
1224
|
+
}
|
|
1225
|
+
_removeFile(index) {
|
|
1226
|
+
const removed = this.images()[index];
|
|
1227
|
+
URL.revokeObjectURL(removed.url);
|
|
1228
|
+
this.images.update(f => f.filter((_, i) => i !== index));
|
|
1229
|
+
}
|
|
1230
|
+
_addFiles(newFiles) {
|
|
1231
|
+
const imgs = newFiles.filter(f => f.type.startsWith('image/'));
|
|
1232
|
+
if (this.maxSize()) {
|
|
1233
|
+
imgs.splice(0, imgs.length, ...imgs.filter(f => f.size <= (this.maxSize() || Infinity)));
|
|
1234
|
+
}
|
|
1235
|
+
const current = this.images();
|
|
1236
|
+
if (!this.multiple()) {
|
|
1237
|
+
current.forEach(f => URL.revokeObjectURL(f.url));
|
|
1238
|
+
if (imgs.length) {
|
|
1239
|
+
this.images.set([{ file: imgs[0], url: URL.createObjectURL(imgs[0]) }]);
|
|
1240
|
+
}
|
|
1241
|
+
else {
|
|
1242
|
+
this.images.set([]);
|
|
1243
|
+
}
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
const max = this.maxFiles() || Infinity;
|
|
1247
|
+
const remaining = max - current.length;
|
|
1248
|
+
if (remaining <= 0)
|
|
1249
|
+
return;
|
|
1250
|
+
const add = imgs.slice(0, remaining).map(f => ({ file: f, url: URL.createObjectURL(f) }));
|
|
1251
|
+
this.images.set([...current, ...add]);
|
|
1252
|
+
}
|
|
1253
|
+
_formatSize(bytes) {
|
|
1254
|
+
if (bytes < 1024)
|
|
1255
|
+
return `${bytes} B`;
|
|
1256
|
+
if (bytes < 1048576)
|
|
1257
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
1258
|
+
return `${(bytes / 1048576).toFixed(1)} MB`;
|
|
1259
|
+
}
|
|
1260
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ImageUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1261
|
+
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=\"rz-iu-preview-grid\">\n @for (img of images(); track img.url; let i = $index) {\n <div class=\"rz-iu-preview-item\">\n <img [src]=\"img.url\" [alt]=\"img.file.name\" />\n <div class=\"rz-iu-preview-overlay\">\n <button type=\"button\" class=\"rz-iu-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=\"rz-iu-add-btn\" (click)=\"_input.click()\" title=\"Add image\">\n <i class=\"pi pi-plus rz-iu-add-icon\"></i>\n <span>Add</span>\n </button>\n }\n </div>\n} @else {\n <div\n class=\"rz-iu-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 rz-iu-drop-icon\"></i>\n <span class=\"rz-iu-drop-placeholder\">{{ placeholder() }}</span>\n @if (maxSize()) {\n <span class=\"rz-iu-maxsize\">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=\"rz-iu-msg rz-iu-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-accent, oklch(.64 .2 50));--rz-bg: var(--color-surface, oklch(.99 0 0));--rz-border: var(--color-border, oklch(.83 .015 260));--rz-text: var(--color-text, oklch(.14 .01 260));--rz-muted: var(--color-text-muted, oklch(.48 .01 260));--rz-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}.rz-iu-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(--rz-border);border-radius:var(--rz-radius);background:var(--rz-bg);cursor:pointer;transition:all .2s ease;color:var(--rz-muted);text-align:center}.rz-iu-drop-zone:hover,.rz-iu-drop-zone.is-dragover{border-color:var(--rz-accent);background:color-mix(in srgb,var(--rz-accent) 6%,var(--rz-bg));color:var(--rz-text)}.rz-iu-drop-icon{font-size:1.5rem}.rz-iu-drop-placeholder{font-size:.75rem}.rz-iu-maxsize{font-size:.625rem;opacity:.6}.rz-iu-preview-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(100px,1fr));gap:.5rem}.rz-iu-preview-item{position:relative;aspect-ratio:1;border-radius:calc(var(--rz-radius) - 2px);overflow:hidden;border:1px solid var(--rz-border);background:color-mix(in srgb,var(--rz-accent) 4%,var(--rz-bg))}.rz-iu-preview-item img{width:100%;height:100%;object-fit:cover;display:block}.rz-iu-preview-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%)}.rz-iu-preview-item:hover .rz-iu-preview-overlay{opacity:1}.rz-iu-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}.rz-iu-remove-btn:hover{background:var(--color-danger, oklch(.55 .22 25))}.rz-iu-add-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;aspect-ratio:1;border:2px dashed var(--rz-border);border-radius:calc(var(--rz-radius) - 2px);background:transparent;cursor:pointer;color:var(--rz-muted);font-size:.75rem;gap:.25rem;transition:all .2s}.rz-iu-add-btn:hover{border-color:var(--rz-accent);color:var(--rz-accent);background:color-mix(in srgb,var(--rz-accent) 6%,var(--rz-bg))}.rz-iu-add-icon{font-size:1.125rem}.rz-iu-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-iu-error{color:var(--color-danger)}.error-enter{animation:rz-error-in .25s ease-out}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1262
|
+
}
|
|
1263
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ImageUploadComponent, decorators: [{
|
|
1264
|
+
type: Component,
|
|
1265
|
+
args: [{ selector: 'app-image-upload', imports: [], host: {
|
|
1266
|
+
'[attr.data-size]': '_size',
|
|
1267
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (images().length) {\n <div class=\"rz-iu-preview-grid\">\n @for (img of images(); track img.url; let i = $index) {\n <div class=\"rz-iu-preview-item\">\n <img [src]=\"img.url\" [alt]=\"img.file.name\" />\n <div class=\"rz-iu-preview-overlay\">\n <button type=\"button\" class=\"rz-iu-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=\"rz-iu-add-btn\" (click)=\"_input.click()\" title=\"Add image\">\n <i class=\"pi pi-plus rz-iu-add-icon\"></i>\n <span>Add</span>\n </button>\n }\n </div>\n} @else {\n <div\n class=\"rz-iu-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 rz-iu-drop-icon\"></i>\n <span class=\"rz-iu-drop-placeholder\">{{ placeholder() }}</span>\n @if (maxSize()) {\n <span class=\"rz-iu-maxsize\">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=\"rz-iu-msg rz-iu-error\" animate.enter=\"error-enter\" animate.leave=\"error-leave\">{{ errorMessage() || 'Invalid' }}</span>\n}\n", styles: [":host{--rz-accent: var(--color-accent, oklch(.64 .2 50));--rz-bg: var(--color-surface, oklch(.99 0 0));--rz-border: var(--color-border, oklch(.83 .015 260));--rz-text: var(--color-text, oklch(.14 .01 260));--rz-muted: var(--color-text-muted, oklch(.48 .01 260));--rz-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}.rz-iu-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(--rz-border);border-radius:var(--rz-radius);background:var(--rz-bg);cursor:pointer;transition:all .2s ease;color:var(--rz-muted);text-align:center}.rz-iu-drop-zone:hover,.rz-iu-drop-zone.is-dragover{border-color:var(--rz-accent);background:color-mix(in srgb,var(--rz-accent) 6%,var(--rz-bg));color:var(--rz-text)}.rz-iu-drop-icon{font-size:1.5rem}.rz-iu-drop-placeholder{font-size:.75rem}.rz-iu-maxsize{font-size:.625rem;opacity:.6}.rz-iu-preview-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(100px,1fr));gap:.5rem}.rz-iu-preview-item{position:relative;aspect-ratio:1;border-radius:calc(var(--rz-radius) - 2px);overflow:hidden;border:1px solid var(--rz-border);background:color-mix(in srgb,var(--rz-accent) 4%,var(--rz-bg))}.rz-iu-preview-item img{width:100%;height:100%;object-fit:cover;display:block}.rz-iu-preview-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%)}.rz-iu-preview-item:hover .rz-iu-preview-overlay{opacity:1}.rz-iu-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}.rz-iu-remove-btn:hover{background:var(--color-danger, oklch(.55 .22 25))}.rz-iu-add-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;aspect-ratio:1;border:2px dashed var(--rz-border);border-radius:calc(var(--rz-radius) - 2px);background:transparent;cursor:pointer;color:var(--rz-muted);font-size:.75rem;gap:.25rem;transition:all .2s}.rz-iu-add-btn:hover{border-color:var(--rz-accent);color:var(--rz-accent);background:color-mix(in srgb,var(--rz-accent) 6%,var(--rz-bg))}.rz-iu-add-icon{font-size:1.125rem}.rz-iu-msg{position:absolute;left:0;right:0;bottom:0;margin:0;font-size:.75rem;font-family:var(--font-sans, ui-sans-serif, system-ui, sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rz-iu-error{color:var(--color-danger)}.error-enter{animation:rz-error-in .25s ease-out}.error-leave{animation:rz-error-out .2s ease-in forwards}@keyframes rz-error-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0 0}}@keyframes rz-error-out{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}\n"] }]
|
|
1268
|
+
}], 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 }] }] } });
|
|
1269
|
+
|
|
1270
|
+
class SkeletonComponent {
|
|
1271
|
+
variant = input('text', ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
1272
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
1273
|
+
height = input('', ...(ngDevMode ? [{ debugName: "height" }] : []));
|
|
1274
|
+
count = input(1, ...(ngDevMode ? [{ debugName: "count" }] : []));
|
|
1275
|
+
borderRadius = input('', ...(ngDevMode ? [{ debugName: "borderRadius" }] : []));
|
|
1276
|
+
accentColor = input('', ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
1277
|
+
_items = computed(() => Array.from({ length: this.count() }), ...(ngDevMode ? [{ debugName: "_items" }] : []));
|
|
1278
|
+
_baseWidth = computed(() => this.width() || (this.variant() === 'circle' ? '40px' : '100%'), ...(ngDevMode ? [{ debugName: "_baseWidth" }] : []));
|
|
1279
|
+
_baseHeight = computed(() => {
|
|
1280
|
+
if (this.height())
|
|
1281
|
+
return this.height();
|
|
1282
|
+
switch (this.variant()) {
|
|
1283
|
+
case 'circle': return '40px';
|
|
1284
|
+
case 'rect': return '100px';
|
|
1285
|
+
case 'text':
|
|
1286
|
+
default: return '14px';
|
|
1287
|
+
}
|
|
1288
|
+
}, ...(ngDevMode ? [{ debugName: "_baseHeight" }] : []));
|
|
1289
|
+
_radius = computed(() => {
|
|
1290
|
+
if (this.borderRadius())
|
|
1291
|
+
return this.borderRadius();
|
|
1292
|
+
switch (this.variant()) {
|
|
1293
|
+
case 'circle': return '9999px';
|
|
1294
|
+
case 'rect': return 'var(--radius-md,0.5rem)';
|
|
1295
|
+
case 'text':
|
|
1296
|
+
default: return 'var(--radius-sm,0.25rem)';
|
|
1297
|
+
}
|
|
1298
|
+
}, ...(ngDevMode ? [{ debugName: "_radius" }] : []));
|
|
1299
|
+
_bg = computed(() => {
|
|
1300
|
+
if (this.accentColor())
|
|
1301
|
+
return `var(--color-${this.accentColor()}-bg,var(--color-surface-alt,oklch(0.975 0.005 260)))`;
|
|
1302
|
+
return 'var(--color-surface-alt,oklch(0.975 0.005 260))';
|
|
1303
|
+
}, ...(ngDevMode ? [{ debugName: "_bg" }] : []));
|
|
1304
|
+
_lineWidth(index) {
|
|
1305
|
+
if (this.width())
|
|
1306
|
+
return this.width();
|
|
1307
|
+
const total = this.count();
|
|
1308
|
+
if (total <= 1)
|
|
1309
|
+
return '100%';
|
|
1310
|
+
if (index === total - 1)
|
|
1311
|
+
return '60%';
|
|
1312
|
+
return '100%';
|
|
1313
|
+
}
|
|
1314
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SkeletonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1315
|
+
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=\"rz-sk-container\" [style.width]=\"_baseWidth()\">\n @for (item of _items(); track $index) {\n <div\n class=\"rz-sk-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}.rz-sk-container{display:flex;flex-direction:column;gap:.5rem}.rz-sk-pulse{animation:rz-skeleton-pulse 1.5s ease-in-out infinite}@keyframes rz-skeleton-pulse{0%,to{opacity:1}50%{opacity:.4}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1316
|
+
}
|
|
1317
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SkeletonComponent, decorators: [{
|
|
1318
|
+
type: Component,
|
|
1319
|
+
args: [{ selector: 'app-skeleton', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"rz-sk-container\" [style.width]=\"_baseWidth()\">\n @for (item of _items(); track $index) {\n <div\n class=\"rz-sk-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}.rz-sk-container{display:flex;flex-direction:column;gap:.5rem}.rz-sk-pulse{animation:rz-skeleton-pulse 1.5s ease-in-out infinite}@keyframes rz-skeleton-pulse{0%,to{opacity:1}50%{opacity:.4}}\n"] }]
|
|
1320
|
+
}], 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 }] }] } });
|
|
1321
|
+
|
|
1322
|
+
class TableSkeletonComponent {
|
|
1323
|
+
rows = input(5, ...(ngDevMode ? [{ debugName: "rows" }] : []));
|
|
1324
|
+
columns = input(4, ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
1325
|
+
_rowArr = computed(() => Array.from({ length: this.rows() }), ...(ngDevMode ? [{ debugName: "_rowArr" }] : []));
|
|
1326
|
+
_cols = computed(() => {
|
|
1327
|
+
const c = this.columns();
|
|
1328
|
+
if (typeof c === 'number')
|
|
1329
|
+
return Array.from({ length: c }, () => ({ shape: 'bar' }));
|
|
1330
|
+
return c.map(col => ({ shape: col.shape ?? 'bar', width: col.width }));
|
|
1331
|
+
}, ...(ngDevMode ? [{ debugName: "_cols" }] : []));
|
|
1332
|
+
_colWidth = computed(() => {
|
|
1333
|
+
const cols = this._cols();
|
|
1334
|
+
const count = cols.length;
|
|
1335
|
+
if (count === 0)
|
|
1336
|
+
return [];
|
|
1337
|
+
const defined = cols.filter(c => c.width);
|
|
1338
|
+
const definedTotal = defined.reduce((sum, c) => sum + parseFloat(c.width || '0'), 0);
|
|
1339
|
+
const undefinedCount = count - defined.length;
|
|
1340
|
+
const remainingPct = 100 - definedTotal;
|
|
1341
|
+
const eachPct = undefinedCount > 0 ? Math.floor(remainingPct / undefinedCount) : 0;
|
|
1342
|
+
return cols.map(c => c.width || `${eachPct}%`);
|
|
1343
|
+
}, ...(ngDevMode ? [{ debugName: "_colWidth" }] : []));
|
|
1344
|
+
_shapeClass(shape) {
|
|
1345
|
+
switch (shape) {
|
|
1346
|
+
case 'circle': return 'rz-ts-shape-circle';
|
|
1347
|
+
case 'action': return 'rz-ts-shape-action';
|
|
1348
|
+
default: return 'rz-ts-shape-bar';
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
_shapeSize(shape) {
|
|
1352
|
+
switch (shape) {
|
|
1353
|
+
case 'circle': return { width: '32px', height: '32px' };
|
|
1354
|
+
case 'action': return { width: '28px', height: '28px' };
|
|
1355
|
+
default: return { width: '100%', height: '14px' };
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TableSkeletonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1359
|
+
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=\"rz-ts-wrapper\">\n <table class=\"rz-ts-tbl\">\n <thead>\n <tr>\n @for (col of _cols(); track $index) {\n <th\n class=\"rz-ts-th\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.width]=\"_colWidth()[$index]\"\n >\n <div class=\"rz-ts-shimmer rz-ts-shape-bar\" 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=\"rz-ts-row\">\n @for (col of _cols(); track $index) {\n <td class=\"rz-ts-td\">\n <div\n class=\"rz-ts-shimmer\"\n [class]=\"_shapeClass(col.shape)\"\n [style]=\"_shapeSize(col.shape)\"\n [class.rz-ts-mx-auto]=\"col.shape === 'circle'\"\n ></div>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n</div>\n", styles: [":host{display:block}.rz-ts-wrapper{overflow:hidden;border-radius:var(--radius-lg, .75rem);border:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-ts-tbl{width:100%;border-collapse:collapse}.rz-ts-th,.rz-ts-td{padding:.625rem .75rem}.rz-ts-row{border-bottom:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-ts-shimmer{background:var(--color-surface-alt, oklch(.975 .005 260));animation:rz-shimmer 1.5s ease-in-out infinite}thead .rz-ts-shimmer{background:#fff3}.rz-ts-shape-circle{border-radius:9999px}.rz-ts-shape-action{border-radius:.375rem}.rz-ts-shape-bar{border-radius:var(--radius-sm, .25rem)}.rz-ts-mx-auto{margin-left:auto;margin-right:auto}@keyframes rz-shimmer{0%,to{opacity:1}50%{opacity:.4}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1360
|
+
}
|
|
1361
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TableSkeletonComponent, decorators: [{
|
|
1362
|
+
type: Component,
|
|
1363
|
+
args: [{ selector: 'app-table-skeleton', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"rz-ts-wrapper\">\n <table class=\"rz-ts-tbl\">\n <thead>\n <tr>\n @for (col of _cols(); track $index) {\n <th\n class=\"rz-ts-th\"\n [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\"\n [style.width]=\"_colWidth()[$index]\"\n >\n <div class=\"rz-ts-shimmer rz-ts-shape-bar\" 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=\"rz-ts-row\">\n @for (col of _cols(); track $index) {\n <td class=\"rz-ts-td\">\n <div\n class=\"rz-ts-shimmer\"\n [class]=\"_shapeClass(col.shape)\"\n [style]=\"_shapeSize(col.shape)\"\n [class.rz-ts-mx-auto]=\"col.shape === 'circle'\"\n ></div>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n</div>\n", styles: [":host{display:block}.rz-ts-wrapper{overflow:hidden;border-radius:var(--radius-lg, .75rem);border:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-ts-tbl{width:100%;border-collapse:collapse}.rz-ts-th,.rz-ts-td{padding:.625rem .75rem}.rz-ts-row{border-bottom:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-ts-shimmer{background:var(--color-surface-alt, oklch(.975 .005 260));animation:rz-shimmer 1.5s ease-in-out infinite}thead .rz-ts-shimmer{background:#fff3}.rz-ts-shape-circle{border-radius:9999px}.rz-ts-shape-action{border-radius:.375rem}.rz-ts-shape-bar{border-radius:var(--radius-sm, .25rem)}.rz-ts-mx-auto{margin-left:auto;margin-right:auto}@keyframes rz-shimmer{0%,to{opacity:1}50%{opacity:.4}}\n"] }]
|
|
1364
|
+
}], propDecorators: { rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }] } });
|
|
1365
|
+
|
|
1366
|
+
class TooltipComponent {
|
|
1367
|
+
_el = inject(ElementRef);
|
|
1368
|
+
text = input('', ...(ngDevMode ? [{ debugName: "text" }] : []));
|
|
1369
|
+
position = input('top', ...(ngDevMode ? [{ debugName: "position" }] : []));
|
|
1370
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
1371
|
+
alwaysShow = input(false, ...(ngDevMode ? [{ debugName: "alwaysShow" }] : []));
|
|
1372
|
+
_visible = signal(false, ...(ngDevMode ? [{ debugName: "_visible" }] : []));
|
|
1373
|
+
_tipText = computed(() => this.text() || this._el.nativeElement.textContent?.trim() || '', ...(ngDevMode ? [{ debugName: "_tipText" }] : []));
|
|
1374
|
+
_panelStyle = signal({}, ...(ngDevMode ? [{ debugName: "_panelStyle" }] : []));
|
|
1375
|
+
_onMouseEnter(event) {
|
|
1376
|
+
if (this.disabled())
|
|
1377
|
+
return;
|
|
1378
|
+
const content = this._el.nativeElement.querySelector('[data-tip-content]');
|
|
1379
|
+
if (content && !this.alwaysShow()) {
|
|
1380
|
+
if (content.scrollWidth <= content.clientWidth)
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
this._computePosition(event);
|
|
1384
|
+
this._visible.set(true);
|
|
1385
|
+
}
|
|
1386
|
+
_onMouseLeave() {
|
|
1387
|
+
this._visible.set(false);
|
|
1388
|
+
}
|
|
1389
|
+
_computePosition(event) {
|
|
1390
|
+
const el = event.currentTarget;
|
|
1391
|
+
const rect = el.getBoundingClientRect();
|
|
1392
|
+
const gap = 6;
|
|
1393
|
+
const pos = this.position();
|
|
1394
|
+
let top = 0, left = 0;
|
|
1395
|
+
if (pos === 'top') {
|
|
1396
|
+
top = rect.top - gap;
|
|
1397
|
+
left = rect.left + rect.width / 2;
|
|
1398
|
+
}
|
|
1399
|
+
else if (pos === 'bottom') {
|
|
1400
|
+
top = rect.bottom + gap;
|
|
1401
|
+
left = rect.left + rect.width / 2;
|
|
1402
|
+
}
|
|
1403
|
+
else if (pos === 'left') {
|
|
1404
|
+
top = rect.top + rect.height / 2;
|
|
1405
|
+
left = rect.left - gap;
|
|
1406
|
+
}
|
|
1407
|
+
else {
|
|
1408
|
+
top = rect.top + rect.height / 2;
|
|
1409
|
+
left = rect.right + gap;
|
|
1410
|
+
}
|
|
1411
|
+
this._panelStyle.set({ top: `${top}px`, left: `${left}px`, transform: 'translate(-50%, -50%)' });
|
|
1412
|
+
}
|
|
1413
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1414
|
+
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($event)", "mouseleave": "_onMouseLeave()" } }, ngImport: i0, template: "<div data-tip-content class=\"rz-tt-content\">\n <ng-content />\n</div>\n@if (_visible()) {\n <div class=\"rz-tt-panel\"\n [style]=\"_panelStyle()\"\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%}.rz-tt-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rz-tt-panel{position:fixed;z-index:9999;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))}.tip-enter{animation:rz-tip-in .12s ease-out}.tip-leave{animation:rz-tip-out .08s ease-in forwards}@keyframes rz-tip-in{0%{opacity:0}to{opacity:1}}@keyframes rz-tip-out{0%{opacity:1}to{opacity:0}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1415
|
+
}
|
|
1416
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
1417
|
+
type: Component,
|
|
1418
|
+
args: [{ selector: 'app-tooltip', imports: [], host: {
|
|
1419
|
+
'(mouseenter)': '_onMouseEnter($event)',
|
|
1420
|
+
'(mouseleave)': '_onMouseLeave()',
|
|
1421
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div data-tip-content class=\"rz-tt-content\">\n <ng-content />\n</div>\n@if (_visible()) {\n <div class=\"rz-tt-panel\"\n [style]=\"_panelStyle()\"\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%}.rz-tt-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rz-tt-panel{position:fixed;z-index:9999;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))}.tip-enter{animation:rz-tip-in .12s ease-out}.tip-leave{animation:rz-tip-out .08s ease-in forwards}@keyframes rz-tip-in{0%{opacity:0}to{opacity:1}}@keyframes rz-tip-out{0%{opacity:1}to{opacity:0}}\n"] }]
|
|
1422
|
+
}], 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 }] }] } });
|
|
1423
|
+
|
|
1424
|
+
class TableComponent {
|
|
1425
|
+
columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
1426
|
+
rows = input([], ...(ngDevMode ? [{ debugName: "rows" }] : []));
|
|
1427
|
+
striped = input(false, ...(ngDevMode ? [{ debugName: "striped" }] : []));
|
|
1428
|
+
hoverable = input(true, ...(ngDevMode ? [{ debugName: "hoverable" }] : []));
|
|
1429
|
+
sortable = input(false, ...(ngDevMode ? [{ debugName: "sortable" }] : []));
|
|
1430
|
+
emptyMessage = input('No data available', ...(ngDevMode ? [{ debugName: "emptyMessage" }] : []));
|
|
1431
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
1432
|
+
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
|
|
1433
|
+
searchable = input(false, ...(ngDevMode ? [{ debugName: "searchable" }] : []));
|
|
1434
|
+
filterable = input(false, ...(ngDevMode ? [{ debugName: "filterable" }] : []));
|
|
1435
|
+
skeletonRows = input(5, ...(ngDevMode ? [{ debugName: "skeletonRows" }] : []));
|
|
1436
|
+
resizable = input(false, ...(ngDevMode ? [{ debugName: "resizable" }] : []));
|
|
1437
|
+
pageable = input(false, ...(ngDevMode ? [{ debugName: "pageable" }] : []));
|
|
1438
|
+
pageSize = input(10, ...(ngDevMode ? [{ debugName: "pageSize" }] : []));
|
|
1439
|
+
pageSizeOptions = input([5, 10, 20, 50], ...(ngDevMode ? [{ debugName: "pageSizeOptions" }] : []));
|
|
1440
|
+
selectable = input(false, ...(ngDevMode ? [{ debugName: "selectable" }] : []));
|
|
1441
|
+
selectionMode = input('multiple', ...(ngDevMode ? [{ debugName: "selectionMode" }] : []));
|
|
1442
|
+
selectionKey = input('', ...(ngDevMode ? [{ debugName: "selectionKey" }] : []));
|
|
1443
|
+
stickyHeader = input(false, ...(ngDevMode ? [{ debugName: "stickyHeader" }] : []));
|
|
1444
|
+
exportable = input(false, ...(ngDevMode ? [{ debugName: "exportable" }] : []));
|
|
1445
|
+
columnToggle = input(false, ...(ngDevMode ? [{ debugName: "columnToggle" }] : []));
|
|
1446
|
+
expandable = input(false, ...(ngDevMode ? [{ debugName: "expandable" }] : []));
|
|
1447
|
+
sortChange = output();
|
|
1448
|
+
pageChange = output();
|
|
1449
|
+
selectedRows = output();
|
|
1450
|
+
rowDetail;
|
|
1451
|
+
_sortKey = signal('', ...(ngDevMode ? [{ debugName: "_sortKey" }] : []));
|
|
1452
|
+
_sortDir = signal('', ...(ngDevMode ? [{ debugName: "_sortDir" }] : []));
|
|
1453
|
+
_searchQuery = signal('', ...(ngDevMode ? [{ debugName: "_searchQuery" }] : []));
|
|
1454
|
+
_filters = signal({}, ...(ngDevMode ? [{ debugName: "_filters" }] : []));
|
|
1455
|
+
_page = signal(1, ...(ngDevMode ? [{ debugName: "_page" }] : []));
|
|
1456
|
+
_pageSize = signal(10, ...(ngDevMode ? [{ debugName: "_pageSize" }] : []));
|
|
1457
|
+
_columnWidths = signal({}, ...(ngDevMode ? [{ debugName: "_columnWidths" }] : []));
|
|
1458
|
+
_hiddenColumns = signal(new Set(), ...(ngDevMode ? [{ debugName: "_hiddenColumns" }] : []));
|
|
1459
|
+
_selectedKeys = signal(new Set(), ...(ngDevMode ? [{ debugName: "_selectedKeys" }] : []));
|
|
1460
|
+
_expandedKeys = signal(new Set(), ...(ngDevMode ? [{ debugName: "_expandedKeys" }] : []));
|
|
1461
|
+
_pageSizeOptions = computed(() => this.pageSizeOptions().map(s => ({ label: `${s} / page`, value: String(s) })), ...(ngDevMode ? [{ debugName: "_pageSizeOptions" }] : []));
|
|
1462
|
+
_columnToggleOpen = signal(false, ...(ngDevMode ? [{ debugName: "_columnToggleOpen" }] : []));
|
|
1463
|
+
_exportOpen = signal(false, ...(ngDevMode ? [{ debugName: "_exportOpen" }] : []));
|
|
1464
|
+
_resizing = null;
|
|
1465
|
+
constructor() {
|
|
1466
|
+
effect(() => { this._pageSize.set(this.pageSize()); });
|
|
1467
|
+
effect(() => {
|
|
1468
|
+
this._searchQuery();
|
|
1469
|
+
this._filters();
|
|
1470
|
+
this._page.set(1);
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
_displayColumns = computed(() => this.columns().filter(c => !this._hiddenColumns().has(c.key)), ...(ngDevMode ? [{ debugName: "_displayColumns" }] : []));
|
|
1474
|
+
_colCount = computed(() => {
|
|
1475
|
+
let count = this._displayColumns().length;
|
|
1476
|
+
if (this.selectable())
|
|
1477
|
+
count++;
|
|
1478
|
+
if (this.expandable())
|
|
1479
|
+
count++;
|
|
1480
|
+
return count;
|
|
1481
|
+
}, ...(ngDevMode ? [{ debugName: "_colCount" }] : []));
|
|
1482
|
+
_filteredRows = computed(() => {
|
|
1483
|
+
let data = this.rows();
|
|
1484
|
+
const key = this._sortKey();
|
|
1485
|
+
const dir = this._sortDir();
|
|
1486
|
+
if (key && dir) {
|
|
1487
|
+
data = [...data].sort((a, b) => {
|
|
1488
|
+
const aVal = a[key];
|
|
1489
|
+
const bVal = b[key];
|
|
1490
|
+
const direction = dir === 'asc' ? 1 : -1;
|
|
1491
|
+
if (aVal < bVal)
|
|
1492
|
+
return -1 * direction;
|
|
1493
|
+
if (aVal > bVal)
|
|
1494
|
+
return 1 * direction;
|
|
1495
|
+
return 0;
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
const query = this._searchQuery().toLowerCase().trim();
|
|
1499
|
+
if (query) {
|
|
1500
|
+
data = data.filter(row => Object.values(row).some(val => String(val).toLowerCase().includes(query)));
|
|
1501
|
+
}
|
|
1502
|
+
const filters = this._filters();
|
|
1503
|
+
for (const [fk, fv] of Object.entries(filters)) {
|
|
1504
|
+
if (fv)
|
|
1505
|
+
data = data.filter(row => String(row[fk]) === fv);
|
|
1506
|
+
}
|
|
1507
|
+
return data;
|
|
1508
|
+
}, ...(ngDevMode ? [{ debugName: "_filteredRows" }] : []));
|
|
1509
|
+
_displayRows = computed(() => {
|
|
1510
|
+
if (!this.pageable())
|
|
1511
|
+
return this._filteredRows();
|
|
1512
|
+
const total = this._filteredRows().length;
|
|
1513
|
+
const size = this._pageSize();
|
|
1514
|
+
if (total === 0)
|
|
1515
|
+
return [];
|
|
1516
|
+
const maxPage = Math.max(1, Math.ceil(total / size));
|
|
1517
|
+
const page = Math.min(this._page(), maxPage);
|
|
1518
|
+
const start = (page - 1) * size;
|
|
1519
|
+
return this._filteredRows().slice(start, start + size);
|
|
1520
|
+
}, ...(ngDevMode ? [{ debugName: "_displayRows" }] : []));
|
|
1521
|
+
_totalPages = computed(() => this.pageable() ? Math.max(1, Math.ceil(this._filteredRows().length / this._pageSize())) : 1, ...(ngDevMode ? [{ debugName: "_totalPages" }] : []));
|
|
1522
|
+
_pageInfo = computed(() => {
|
|
1523
|
+
const total = this._filteredRows().length;
|
|
1524
|
+
const page = this._page();
|
|
1525
|
+
const size = this._pageSize();
|
|
1526
|
+
const from = total > 0 ? (page - 1) * size + 1 : 0;
|
|
1527
|
+
return { from, to: Math.min(page * size, total), total };
|
|
1528
|
+
}, ...(ngDevMode ? [{ debugName: "_pageInfo" }] : []));
|
|
1529
|
+
_visiblePages = computed(() => {
|
|
1530
|
+
const total = this._totalPages();
|
|
1531
|
+
const current = this._page();
|
|
1532
|
+
const range = 5;
|
|
1533
|
+
let start = Math.max(1, current - Math.floor(range / 2));
|
|
1534
|
+
let end = Math.min(total, start + range - 1);
|
|
1535
|
+
if (end - start + 1 < range)
|
|
1536
|
+
start = Math.max(1, end - range + 1);
|
|
1537
|
+
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
1538
|
+
}, ...(ngDevMode ? [{ debugName: "_visiblePages" }] : []));
|
|
1539
|
+
_rowMeta = computed(() => {
|
|
1540
|
+
const cols = this._displayColumns();
|
|
1541
|
+
const rows = this._displayRows();
|
|
1542
|
+
const active = {};
|
|
1543
|
+
return rows.map((row, rowIndex) => cols.map(col => {
|
|
1544
|
+
const key = col.key;
|
|
1545
|
+
if (active[key] !== undefined && active[key] > 1) {
|
|
1546
|
+
active[key]--;
|
|
1547
|
+
return { visible: false, rowspan: 0 };
|
|
1548
|
+
}
|
|
1549
|
+
if (active[key] !== undefined)
|
|
1550
|
+
delete active[key];
|
|
1551
|
+
if (col.rowSpan) {
|
|
1552
|
+
const span = col.rowSpan(row, rowIndex, rows);
|
|
1553
|
+
if (span > 1) {
|
|
1554
|
+
active[key] = span;
|
|
1555
|
+
return { visible: true, rowspan: span };
|
|
1556
|
+
}
|
|
1557
|
+
if (span === 0)
|
|
1558
|
+
return { visible: false, rowspan: 0 };
|
|
1559
|
+
}
|
|
1560
|
+
return { visible: true, rowspan: 1 };
|
|
1561
|
+
}));
|
|
1562
|
+
}, ...(ngDevMode ? [{ debugName: "_rowMeta" }] : []));
|
|
1563
|
+
_skeletonCols = computed(() => this.columns().map(col => ({ shape: col.actions ? 'action' : 'bar', width: col.width })), ...(ngDevMode ? [{ debugName: "_skeletonCols" }] : []));
|
|
1564
|
+
_filterCols = computed(() => this._displayColumns().filter(c => c.filterable && c.filterOptions), ...(ngDevMode ? [{ debugName: "_filterCols" }] : []));
|
|
1565
|
+
_footerCols = computed(() => this._displayColumns().filter(c => c.footer), ...(ngDevMode ? [{ debugName: "_footerCols" }] : []));
|
|
1566
|
+
_footerText = computed(() => this._footerCols().map(c => c.footer(this._filteredRows())).join(' · '), ...(ngDevMode ? [{ debugName: "_footerText" }] : []));
|
|
1567
|
+
_sortIcon(key) {
|
|
1568
|
+
if (this._sortKey() !== key || !this._sortDir())
|
|
1569
|
+
return 'pi pi-sort-alt';
|
|
1570
|
+
return this._sortDir() === 'asc' ? 'pi pi-sort-up' : 'pi pi-sort-down';
|
|
1571
|
+
}
|
|
1572
|
+
_toggleSort(key) {
|
|
1573
|
+
if (this._sortKey() === key) {
|
|
1574
|
+
if (this._sortDir() === 'asc')
|
|
1575
|
+
this._sortDir.set('desc');
|
|
1576
|
+
else if (this._sortDir() === 'desc') {
|
|
1577
|
+
this._sortDir.set('');
|
|
1578
|
+
this._sortKey.set('');
|
|
1579
|
+
}
|
|
1580
|
+
else
|
|
1581
|
+
this._sortDir.set('asc');
|
|
1582
|
+
}
|
|
1583
|
+
else {
|
|
1584
|
+
this._sortKey.set(key);
|
|
1585
|
+
this._sortDir.set('asc');
|
|
1586
|
+
}
|
|
1587
|
+
this.sortChange.emit({ key: this._sortKey(), direction: this._sortDir() });
|
|
1588
|
+
}
|
|
1589
|
+
_onSearch(value) { this._searchQuery.set(value ?? ''); }
|
|
1590
|
+
_setFilter(key, value) {
|
|
1591
|
+
this._filters.update(f => {
|
|
1592
|
+
if (!value) {
|
|
1593
|
+
const { [key]: _, ...rest } = f;
|
|
1594
|
+
return rest;
|
|
1595
|
+
}
|
|
1596
|
+
return { ...f, [key]: value };
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
_colWidth(col) { return this._columnWidths()[col.key] || col.width || 'auto'; }
|
|
1600
|
+
_onResizeStart(event, key) {
|
|
1601
|
+
if (!this.resizable())
|
|
1602
|
+
return;
|
|
1603
|
+
const th = event.target.closest('th');
|
|
1604
|
+
if (!th)
|
|
1605
|
+
return;
|
|
1606
|
+
this._resizing = { key, startX: event.clientX, startWidth: th.offsetWidth };
|
|
1607
|
+
event.preventDefault();
|
|
1608
|
+
}
|
|
1609
|
+
_onDocMouseMove(event) {
|
|
1610
|
+
const r = this._resizing;
|
|
1611
|
+
if (!r)
|
|
1612
|
+
return;
|
|
1613
|
+
const diff = event.clientX - r.startX;
|
|
1614
|
+
this._columnWidths.update(w => ({ ...w, [r.key]: `${Math.max(50, r.startWidth + diff)}px` }));
|
|
1615
|
+
}
|
|
1616
|
+
_onDocMouseUp() { this._resizing = null; }
|
|
1617
|
+
_onDocClick(event) {
|
|
1618
|
+
const target = event.target;
|
|
1619
|
+
if (this._columnToggleOpen() && !target.closest('[data-col-toggle]')) {
|
|
1620
|
+
this._columnToggleOpen.set(false);
|
|
1621
|
+
}
|
|
1622
|
+
if (this._exportOpen() && !target.closest('[data-export-toggle]')) {
|
|
1623
|
+
this._exportOpen.set(false);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
_goToPage(page) {
|
|
1627
|
+
const p = Math.max(1, Math.min(page, this._totalPages()));
|
|
1628
|
+
this._page.set(p);
|
|
1629
|
+
this.pageChange.emit(p);
|
|
1630
|
+
}
|
|
1631
|
+
_onPageSizeChange(val) {
|
|
1632
|
+
this._pageSize.set(parseInt(val ?? '10', 10));
|
|
1633
|
+
this._page.set(1);
|
|
1634
|
+
}
|
|
1635
|
+
_isSelected(row) {
|
|
1636
|
+
const key = this.selectionKey();
|
|
1637
|
+
if (!key)
|
|
1638
|
+
return false;
|
|
1639
|
+
const val = row[key];
|
|
1640
|
+
return val != null && this._selectedKeys().has(val);
|
|
1641
|
+
}
|
|
1642
|
+
_toggleSelect(row) {
|
|
1643
|
+
const key = this.selectionKey();
|
|
1644
|
+
const val = key ? row[key] : null;
|
|
1645
|
+
if (val == null)
|
|
1646
|
+
return;
|
|
1647
|
+
this._selectedKeys.update(s => {
|
|
1648
|
+
const next = new Set(s);
|
|
1649
|
+
if (this.selectionMode() === 'single')
|
|
1650
|
+
next.clear();
|
|
1651
|
+
if (next.has(val))
|
|
1652
|
+
next.delete(val);
|
|
1653
|
+
else
|
|
1654
|
+
next.add(val);
|
|
1655
|
+
return next;
|
|
1656
|
+
});
|
|
1657
|
+
this._emitSelection();
|
|
1658
|
+
}
|
|
1659
|
+
_isAllSelected() {
|
|
1660
|
+
const rows = this._displayRows();
|
|
1661
|
+
const key = this.selectionKey();
|
|
1662
|
+
if (rows.length === 0 || !key)
|
|
1663
|
+
return false;
|
|
1664
|
+
return rows.every(row => { const val = row[key]; return val != null && this._selectedKeys().has(val); });
|
|
1665
|
+
}
|
|
1666
|
+
_toggleSelectAll() {
|
|
1667
|
+
const key = this.selectionKey();
|
|
1668
|
+
if (!key)
|
|
1669
|
+
return;
|
|
1670
|
+
if (this._isAllSelected()) {
|
|
1671
|
+
this._selectedKeys.set(new Set());
|
|
1672
|
+
}
|
|
1673
|
+
else {
|
|
1674
|
+
const keys = new Set();
|
|
1675
|
+
for (const row of this._displayRows()) {
|
|
1676
|
+
const val = row[key];
|
|
1677
|
+
if (val != null)
|
|
1678
|
+
keys.add(val);
|
|
1679
|
+
}
|
|
1680
|
+
this._selectedKeys.set(keys);
|
|
1681
|
+
}
|
|
1682
|
+
this._emitSelection();
|
|
1683
|
+
}
|
|
1684
|
+
_emitSelection() {
|
|
1685
|
+
const selected = this._selectedKeys();
|
|
1686
|
+
const key = this.selectionKey();
|
|
1687
|
+
if (!key) {
|
|
1688
|
+
this.selectedRows.emit([]);
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
this.selectedRows.emit(this.rows().filter(row => { const val = row[key]; return val != null && selected.has(val); }));
|
|
1692
|
+
}
|
|
1693
|
+
_isColumnVisible(k) { return !this._hiddenColumns().has(k); }
|
|
1694
|
+
_toggleColumn(k) { this._hiddenColumns.update(h => { const n = new Set(h); if (n.has(k))
|
|
1695
|
+
n.delete(k);
|
|
1696
|
+
else
|
|
1697
|
+
n.add(k); return n; }); }
|
|
1698
|
+
_isExpanded(index) { return this._expandedKeys().has(index); }
|
|
1699
|
+
_toggleExpand(index) { this._expandedKeys.update(s => { const n = new Set(s); if (n.has(index))
|
|
1700
|
+
n.delete(index);
|
|
1701
|
+
else
|
|
1702
|
+
n.add(index); return n; }); }
|
|
1703
|
+
_cellText(row, col) {
|
|
1704
|
+
return col.cell ? col.cell(row) : String(row[col.key] ?? '');
|
|
1705
|
+
}
|
|
1706
|
+
_cellLabel(row, col) {
|
|
1707
|
+
const text = this._cellText(row, col);
|
|
1708
|
+
if (col.maxChars && text.length > col.maxChars)
|
|
1709
|
+
return text.slice(0, col.maxChars) + '…';
|
|
1710
|
+
return text;
|
|
1711
|
+
}
|
|
1712
|
+
async _exportExcel() {
|
|
1713
|
+
const ExcelJS = (await import('exceljs')).default;
|
|
1714
|
+
const workbook = new ExcelJS.Workbook();
|
|
1715
|
+
const worksheet = workbook.addWorksheet('Sheet1');
|
|
1716
|
+
const cols = this._displayColumns();
|
|
1717
|
+
const rows = this._filteredRows();
|
|
1718
|
+
const headerRow = worksheet.addRow(cols.map(c => c.header));
|
|
1719
|
+
headerRow.font = { bold: true, color: { argb: 'FFFFFFFF' } };
|
|
1720
|
+
headerRow.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FF0D4B7C' } };
|
|
1721
|
+
headerRow.alignment = { horizontal: 'center' };
|
|
1722
|
+
for (const row of rows) {
|
|
1723
|
+
worksheet.addRow(cols.map(c => this._cellText(row, c)));
|
|
1724
|
+
}
|
|
1725
|
+
cols.forEach((_, i) => { worksheet.getColumn(i + 1).width = 22; });
|
|
1726
|
+
const buffer = await workbook.xlsx.writeBuffer();
|
|
1727
|
+
const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
1728
|
+
const url = URL.createObjectURL(blob);
|
|
1729
|
+
const a = document.createElement('a');
|
|
1730
|
+
a.href = url;
|
|
1731
|
+
a.download = `export-${new Date().toISOString().slice(0, 10)}.xlsx`;
|
|
1732
|
+
a.click();
|
|
1733
|
+
setTimeout(() => URL.revokeObjectURL(url), 2000);
|
|
1734
|
+
}
|
|
1735
|
+
async _exportPdf() {
|
|
1736
|
+
const { default: jsPDF } = await import('jspdf');
|
|
1737
|
+
const doc = new jsPDF({ orientation: 'landscape', unit: 'pt' });
|
|
1738
|
+
const cols = this._displayColumns();
|
|
1739
|
+
const rows = this._filteredRows();
|
|
1740
|
+
const pageW = doc.internal.pageSize.getWidth();
|
|
1741
|
+
const margin = 30;
|
|
1742
|
+
const rh = 18;
|
|
1743
|
+
const colW = (pageW - margin * 2) / cols.length;
|
|
1744
|
+
const maxY = doc.internal.pageSize.getHeight() - margin;
|
|
1745
|
+
let y = margin;
|
|
1746
|
+
const drawHeader = () => {
|
|
1747
|
+
doc.setFillColor(13, 75, 124);
|
|
1748
|
+
doc.rect(margin, y, pageW - margin * 2, rh, 'F');
|
|
1749
|
+
doc.setTextColor(255, 255, 255);
|
|
1750
|
+
doc.setFontSize(9);
|
|
1751
|
+
doc.setFont('Helvetica', 'bold');
|
|
1752
|
+
cols.forEach((c, i) => {
|
|
1753
|
+
doc.text(c.header, margin + i * colW + 3, y + 12);
|
|
1754
|
+
});
|
|
1755
|
+
y += rh;
|
|
1756
|
+
};
|
|
1757
|
+
drawHeader();
|
|
1758
|
+
for (const row of rows) {
|
|
1759
|
+
if (y + rh > maxY) {
|
|
1760
|
+
doc.addPage();
|
|
1761
|
+
y = margin;
|
|
1762
|
+
drawHeader();
|
|
1763
|
+
}
|
|
1764
|
+
if ((rows.indexOf(row) + 1) % 2 === 0) {
|
|
1765
|
+
doc.setFillColor(247, 248, 250);
|
|
1766
|
+
doc.rect(margin, y, pageW - margin * 2, rh, 'F');
|
|
1767
|
+
}
|
|
1768
|
+
doc.setFont('Helvetica', 'normal');
|
|
1769
|
+
doc.setFontSize(8);
|
|
1770
|
+
doc.setTextColor(50, 50, 50);
|
|
1771
|
+
cols.forEach((c, ci) => {
|
|
1772
|
+
doc.text(this._cellText(row, c), margin + ci * colW + 3, y + 12);
|
|
1773
|
+
});
|
|
1774
|
+
doc.setDrawColor(220, 220, 220);
|
|
1775
|
+
doc.line(margin, y, pageW - margin, y);
|
|
1776
|
+
y += rh;
|
|
1777
|
+
}
|
|
1778
|
+
doc.save(`export-${new Date().toISOString().slice(0, 10)}.pdf`);
|
|
1779
|
+
}
|
|
1780
|
+
_trackByIndex(index) { return index; }
|
|
1781
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1782
|
+
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=\"rz-tbl-wrapper\"\n [style.width]=\"width() || '100%'\"\n [style.border]=\"'1px solid var(--color-border-light,oklch(0.91 0.01 260))'\"\n >\n <table class=\"rz-tbl\" 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=\"rz-tbl-header-checkbox\"\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 <input type=\"checkbox\" class=\"rz-tbl-checkbox\"\n [checked]=\"_isAllSelected()\"\n (change)=\"_toggleSelectAll()\"\n />\n </th>\n }\n @if (expandable()) {\n <th class=\"rz-tbl-header-checkbox\"\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 ></th>\n }\n @for (col of _displayColumns(); track col.key) {\n <th\n class=\"rz-tbl-header\"\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.rz-tbl-sortable]=\"col.sortable && sortable()\"\n (click)=\"sortable() && col.sortable && _toggleSort(col.key)\"\n >\n {{ col.header }}\n @if (col.sortable && sortable()) {\n <i class=\"pi rz-tbl-sort-icon\" [class]=\"_sortIcon(col.key)\"></i>\n }\n @if (resizable()) {\n <div class=\"rz-tbl-resize-handle\"\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=\"rz-tbl-toolbar\">\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=\"rz-tbl-col-toggle\">\n <button\n type=\"button\"\n (click)=\"_columnToggleOpen.set(!_columnToggleOpen())\"\n class=\"rz-tbl-toolbar-btn\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n ><i class=\"pi pi-list rz-tbl-icon\"></i> Columns</button>\n @if (_columnToggleOpen()) {\n <div class=\"rz-tbl-dropdown\"\n [style.background-color]=\"'var(--color-surface,oklch(0.99 0 0))'\"\n >\n @for (col of columns(); track col.key) {\n <label class=\"rz-tbl-dropdown-label\">\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=\"rz-tbl-export-wrap\">\n <button\n type=\"button\"\n (click)=\"_exportOpen.set(!_exportOpen())\"\n class=\"rz-tbl-toolbar-btn\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n ><i class=\"pi pi-download rz-tbl-icon\"></i> Export</button>\n @if (_exportOpen()) {\n <div class=\"rz-tbl-export-dropdown\"\n [style.background-color]=\"'var(--color-surface,oklch(0.99 0 0))'\"\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=\"rz-tbl-export-opt\"\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()\" class=\"rz-tbl-empty\">{{ emptyMessage() }}</td>\n </tr>\n } @else {\n @for (row of _displayRows(); track _trackByIndex($index); let rowIndex = $index) {\n <tr\n class=\"rz-tbl-row\"\n [class.rz-tbl-row-hoverable]=\"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=\"rz-tbl-cell-center\">\n <input type=\"checkbox\" class=\"rz-tbl-checkbox\"\n [checked]=\"_isSelected(row)\"\n (change)=\"_toggleSelect(row)\"\n />\n </td>\n }\n @if (expandable()) {\n <td class=\"rz-tbl-cell-center\">\n <button\n type=\"button\"\n (click)=\"_toggleExpand(rowIndex)\"\n class=\"rz-tbl-expand-btn\"\n >\n <i class=\"pi rz-tbl-icon\" [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=\"rz-tbl-cell\"\n >\n @if (col.actions) {\n <div class=\"rz-tbl-actions\">\n @for (action of col.actions; track $index) {\n @if (!action.visible || action.visible(row)) {\n <button\n type=\"button\"\n class=\"rz-tbl-action-btn\"\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=\"rz-tbl-icon\"></i> }\n @if (action.label) { <span>{{ action.label }}</span> }\n </button>\n }\n }\n </div>\n } @else {\n <app-tooltip position=\"top\" [text]=\"_cellText(row, col)\">\n {{ _cellLabel(row, col) }}\n </app-tooltip>\n }\n </td>\n }\n }\n </tr>\n @if (expandable() && _isExpanded(rowIndex)) {\n <tr class=\"rz-tbl-row\">\n <td [attr.colspan]=\"_colCount()\" [style.padding]=\"'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=\"rz-tbl-detail\">No detail template</div>\n }\n </div>\n </td>\n </tr>\n }\n }\n @if (_footerCols().length) {\n <tr class=\"rz-tbl-footer-row\"\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=\"rz-tbl-cell\"\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=\"rz-tbl-paginator\">\n <div class=\"rz-tbl-page-info\">\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=\"rz-tbl-page-btns\">\n <button type=\"button\" (click)=\"_goToPage(1)\" [disabled]=\"_page() === 1\"\n class=\"rz-tbl-page-btn\"\n ><i class=\"pi pi-angle-double-left rz-tbl-page-icon\"></i></button>\n <button type=\"button\" (click)=\"_goToPage(_page() - 1)\" [disabled]=\"_page() === 1\"\n class=\"rz-tbl-page-btn\"\n ><i class=\"pi pi-angle-left rz-tbl-page-icon\"></i></button>\n @for (p of _visiblePages(); track p) {\n <button type=\"button\" (click)=\"_goToPage(p)\"\n class=\"rz-tbl-page-btn\"\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=\"rz-tbl-page-btn\"\n ><i class=\"pi pi-angle-right rz-tbl-page-icon\"></i></button>\n <button type=\"button\" (click)=\"_goToPage(_totalPages())\" [disabled]=\"_page() === _totalPages()\"\n class=\"rz-tbl-page-btn\"\n ><i class=\"pi pi-angle-double-right rz-tbl-page-icon\"></i></button>\n </div>\n </div>\n }\n </div>\n}\n", styles: [":host{display:contents}.rz-tbl-wrapper{overflow-x:auto;position:relative;border-radius:var(--radius-md, .5rem)}.rz-tbl{width:100%;border-collapse:collapse}.rz-tbl-header{position:relative;padding:.625rem .75rem;font-size:.75rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;white-space:nowrap}.rz-tbl-header-checkbox{padding:.625rem .75rem;font-size:.75rem;white-space:nowrap;text-align:center;width:40px}.rz-tbl-sortable{cursor:pointer;-webkit-user-select:none;user-select:none}.rz-tbl-checkbox{cursor:pointer}.rz-tbl-sort-icon{margin-left:.375rem;font-size:.625rem;vertical-align:middle}.rz-tbl-resize-handle{position:absolute;inset-inline-end:2px;top:0;bottom:0;width:6px;cursor:col-resize;z-index:10;border-inline-end:2px solid var(--color-accent, oklch(.64 .2 50));opacity:.5;transition:opacity .15s}.rz-tbl-header:hover .rz-tbl-resize-handle{opacity:1}.rz-tbl-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:.375rem}.rz-tbl-toolbar-btn{display:inline-flex;align-items:center;gap:.25rem;padding:.25rem .5rem;font-size:.75rem;border-radius:var(--radius-md, .5rem);border:1px solid var(--color-border-light, oklch(.91 .01 260));cursor:pointer;color:var(--color-text, oklch(.14 .01 260));background:transparent;transition:opacity .2s}.rz-tbl-toolbar-btn:hover{opacity:.8}.rz-tbl-icon{font-size:.625rem}.rz-tbl-col-toggle{position:relative;margin-left:auto}.rz-tbl-export-wrap{position:relative}.rz-tbl-dropdown{position:absolute;top:100%;right:0;margin-top:.25rem;min-width:140px;padding:.375rem;border-radius:var(--radius-md, .5rem);box-shadow:0 4px 12px #0000001a;z-index:50;border:1px solid var(--color-border-light, oklch(.91 .01 260));background:var(--color-surface, oklch(.99 0 0))}.rz-tbl-dropdown-label{display:flex;align-items:center;gap:.5rem;padding:.375rem .5rem;font-size:.75rem;border-radius:var(--radius-sm, .25rem);cursor:pointer;white-space:nowrap;color:var(--color-text, oklch(.14 .01 260));transition:background-color .2s}.rz-tbl-dropdown-label:hover{background-color:var(--color-surface-alt, oklch(.975 .005 260))}.rz-tbl-export-dropdown{position:absolute;top:100%;left:0;margin-top:.25rem;min-width:100px;padding:.25rem;border-radius:var(--radius-md, .5rem);box-shadow:0 4px 12px #0000001a;z-index:50;border:1px solid var(--color-border-light, oklch(.91 .01 260));background:var(--color-surface, oklch(.99 0 0))}.rz-tbl-export-opt{display:block;width:100%;text-align:left;padding:.375rem .5rem;font-size:.75rem;border-radius:var(--radius-sm, .25rem);cursor:pointer;border:none;background:transparent;color:var(--color-text, oklch(.14 .01 260));transition:background-color .2s}.rz-tbl-export-opt:hover{background-color:var(--color-surface-alt, oklch(.975 .005 260))}.rz-tbl-empty{padding:2rem .75rem;text-align:center;font-size:.875rem;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-tbl-row{border-bottom:1px solid var(--color-border-light, oklch(.91 .01 260));transition:background-color .15s}.rz-tbl-row-hoverable:hover{background-color:var(--color-surface-alt, oklch(.975 .005 260))}.rz-tbl-cell{padding:.625rem .75rem;font-size:.875rem;color:var(--color-text, oklch(.14 .01 260));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rz-tbl-cell-center{padding:.625rem .75rem;text-align:center}.rz-tbl-actions{display:flex;align-items:center;gap:.25rem}.rz-tbl-action-btn{display:inline-flex;align-items:center;justify-content:center;gap:.25rem;padding:.25rem .5rem;font-size:.75rem;border-radius:var(--radius-md, .5rem);border:none;cursor:pointer;background:transparent;transition:opacity .15s}.rz-tbl-action-btn:disabled{cursor:not-allowed}.rz-tbl-expand-btn{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;border:none;background:transparent;cursor:pointer;border-radius:var(--radius-sm, .25rem);color:var(--color-text-muted, oklch(.48 .01 260));transition:background-color .15s}.rz-tbl-expand-btn:hover{background-color:var(--color-surface-alt, oklch(.975 .005 260))}.rz-tbl-detail{padding:.75rem;font-size:.875rem;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-tbl-footer-row{border-top:2px solid var(--color-primary, oklch(.32 .09 258));font-weight:500}.rz-tbl-paginator{display:flex;align-items:center;justify-content:space-between;padding:.5rem .75rem;border-top:1px solid var(--color-border-light, oklch(.91 .01 260));background:var(--color-surface, oklch(.99 0 0))}.rz-tbl-page-info{display:flex;align-items:center;gap:.5rem;font-size:.75rem;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-tbl-page-btns{display:flex;align-items:center;gap:.125rem}.rz-tbl-page-btn{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;font-size:.75rem;border-radius:var(--radius-sm, .25rem);border:none;cursor:pointer;background:transparent;color:var(--color-text-muted, oklch(.48 .01 260));transition:background-color .15s,color .15s;font-weight:500}.rz-tbl-page-btn:disabled{opacity:.3;cursor:not-allowed}.rz-tbl-page-icon{font-size:.625rem}\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 });
|
|
1783
|
+
}
|
|
1784
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TableComponent, decorators: [{
|
|
1785
|
+
type: Component,
|
|
1786
|
+
args: [{ selector: 'app-table', imports: [SearchInputComponent, DropDownComponent, TableSkeletonComponent, NgTemplateOutlet, TooltipComponent], host: {
|
|
1787
|
+
'(document:mousemove)': '_onDocMouseMove($event)',
|
|
1788
|
+
'(document:mouseup)': '_onDocMouseUp()',
|
|
1789
|
+
'(document:click)': '_onDocClick($event)',
|
|
1790
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (loading()) {\n <app-table-skeleton [rows]=\"skeletonRows()\" [columns]=\"_skeletonCols()\" />\n} @else {\n <div class=\"rz-tbl-wrapper\"\n [style.width]=\"width() || '100%'\"\n [style.border]=\"'1px solid var(--color-border-light,oklch(0.91 0.01 260))'\"\n >\n <table class=\"rz-tbl\" 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=\"rz-tbl-header-checkbox\"\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 <input type=\"checkbox\" class=\"rz-tbl-checkbox\"\n [checked]=\"_isAllSelected()\"\n (change)=\"_toggleSelectAll()\"\n />\n </th>\n }\n @if (expandable()) {\n <th class=\"rz-tbl-header-checkbox\"\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 ></th>\n }\n @for (col of _displayColumns(); track col.key) {\n <th\n class=\"rz-tbl-header\"\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.rz-tbl-sortable]=\"col.sortable && sortable()\"\n (click)=\"sortable() && col.sortable && _toggleSort(col.key)\"\n >\n {{ col.header }}\n @if (col.sortable && sortable()) {\n <i class=\"pi rz-tbl-sort-icon\" [class]=\"_sortIcon(col.key)\"></i>\n }\n @if (resizable()) {\n <div class=\"rz-tbl-resize-handle\"\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=\"rz-tbl-toolbar\">\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=\"rz-tbl-col-toggle\">\n <button\n type=\"button\"\n (click)=\"_columnToggleOpen.set(!_columnToggleOpen())\"\n class=\"rz-tbl-toolbar-btn\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n ><i class=\"pi pi-list rz-tbl-icon\"></i> Columns</button>\n @if (_columnToggleOpen()) {\n <div class=\"rz-tbl-dropdown\"\n [style.background-color]=\"'var(--color-surface,oklch(0.99 0 0))'\"\n >\n @for (col of columns(); track col.key) {\n <label class=\"rz-tbl-dropdown-label\">\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=\"rz-tbl-export-wrap\">\n <button\n type=\"button\"\n (click)=\"_exportOpen.set(!_exportOpen())\"\n class=\"rz-tbl-toolbar-btn\"\n [style.border-color]=\"'var(--color-border-light,oklch(0.91 0.01 260))'\"\n ><i class=\"pi pi-download rz-tbl-icon\"></i> Export</button>\n @if (_exportOpen()) {\n <div class=\"rz-tbl-export-dropdown\"\n [style.background-color]=\"'var(--color-surface,oklch(0.99 0 0))'\"\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=\"rz-tbl-export-opt\"\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()\" class=\"rz-tbl-empty\">{{ emptyMessage() }}</td>\n </tr>\n } @else {\n @for (row of _displayRows(); track _trackByIndex($index); let rowIndex = $index) {\n <tr\n class=\"rz-tbl-row\"\n [class.rz-tbl-row-hoverable]=\"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=\"rz-tbl-cell-center\">\n <input type=\"checkbox\" class=\"rz-tbl-checkbox\"\n [checked]=\"_isSelected(row)\"\n (change)=\"_toggleSelect(row)\"\n />\n </td>\n }\n @if (expandable()) {\n <td class=\"rz-tbl-cell-center\">\n <button\n type=\"button\"\n (click)=\"_toggleExpand(rowIndex)\"\n class=\"rz-tbl-expand-btn\"\n >\n <i class=\"pi rz-tbl-icon\" [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=\"rz-tbl-cell\"\n >\n @if (col.actions) {\n <div class=\"rz-tbl-actions\">\n @for (action of col.actions; track $index) {\n @if (!action.visible || action.visible(row)) {\n <button\n type=\"button\"\n class=\"rz-tbl-action-btn\"\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=\"rz-tbl-icon\"></i> }\n @if (action.label) { <span>{{ action.label }}</span> }\n </button>\n }\n }\n </div>\n } @else {\n <app-tooltip position=\"top\" [text]=\"_cellText(row, col)\">\n {{ _cellLabel(row, col) }}\n </app-tooltip>\n }\n </td>\n }\n }\n </tr>\n @if (expandable() && _isExpanded(rowIndex)) {\n <tr class=\"rz-tbl-row\">\n <td [attr.colspan]=\"_colCount()\" [style.padding]=\"'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=\"rz-tbl-detail\">No detail template</div>\n }\n </div>\n </td>\n </tr>\n }\n }\n @if (_footerCols().length) {\n <tr class=\"rz-tbl-footer-row\"\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=\"rz-tbl-cell\"\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=\"rz-tbl-paginator\">\n <div class=\"rz-tbl-page-info\">\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=\"rz-tbl-page-btns\">\n <button type=\"button\" (click)=\"_goToPage(1)\" [disabled]=\"_page() === 1\"\n class=\"rz-tbl-page-btn\"\n ><i class=\"pi pi-angle-double-left rz-tbl-page-icon\"></i></button>\n <button type=\"button\" (click)=\"_goToPage(_page() - 1)\" [disabled]=\"_page() === 1\"\n class=\"rz-tbl-page-btn\"\n ><i class=\"pi pi-angle-left rz-tbl-page-icon\"></i></button>\n @for (p of _visiblePages(); track p) {\n <button type=\"button\" (click)=\"_goToPage(p)\"\n class=\"rz-tbl-page-btn\"\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=\"rz-tbl-page-btn\"\n ><i class=\"pi pi-angle-right rz-tbl-page-icon\"></i></button>\n <button type=\"button\" (click)=\"_goToPage(_totalPages())\" [disabled]=\"_page() === _totalPages()\"\n class=\"rz-tbl-page-btn\"\n ><i class=\"pi pi-angle-double-right rz-tbl-page-icon\"></i></button>\n </div>\n </div>\n }\n </div>\n}\n", styles: [":host{display:contents}.rz-tbl-wrapper{overflow-x:auto;position:relative;border-radius:var(--radius-md, .5rem)}.rz-tbl{width:100%;border-collapse:collapse}.rz-tbl-header{position:relative;padding:.625rem .75rem;font-size:.75rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;white-space:nowrap}.rz-tbl-header-checkbox{padding:.625rem .75rem;font-size:.75rem;white-space:nowrap;text-align:center;width:40px}.rz-tbl-sortable{cursor:pointer;-webkit-user-select:none;user-select:none}.rz-tbl-checkbox{cursor:pointer}.rz-tbl-sort-icon{margin-left:.375rem;font-size:.625rem;vertical-align:middle}.rz-tbl-resize-handle{position:absolute;inset-inline-end:2px;top:0;bottom:0;width:6px;cursor:col-resize;z-index:10;border-inline-end:2px solid var(--color-accent, oklch(.64 .2 50));opacity:.5;transition:opacity .15s}.rz-tbl-header:hover .rz-tbl-resize-handle{opacity:1}.rz-tbl-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:.375rem}.rz-tbl-toolbar-btn{display:inline-flex;align-items:center;gap:.25rem;padding:.25rem .5rem;font-size:.75rem;border-radius:var(--radius-md, .5rem);border:1px solid var(--color-border-light, oklch(.91 .01 260));cursor:pointer;color:var(--color-text, oklch(.14 .01 260));background:transparent;transition:opacity .2s}.rz-tbl-toolbar-btn:hover{opacity:.8}.rz-tbl-icon{font-size:.625rem}.rz-tbl-col-toggle{position:relative;margin-left:auto}.rz-tbl-export-wrap{position:relative}.rz-tbl-dropdown{position:absolute;top:100%;right:0;margin-top:.25rem;min-width:140px;padding:.375rem;border-radius:var(--radius-md, .5rem);box-shadow:0 4px 12px #0000001a;z-index:50;border:1px solid var(--color-border-light, oklch(.91 .01 260));background:var(--color-surface, oklch(.99 0 0))}.rz-tbl-dropdown-label{display:flex;align-items:center;gap:.5rem;padding:.375rem .5rem;font-size:.75rem;border-radius:var(--radius-sm, .25rem);cursor:pointer;white-space:nowrap;color:var(--color-text, oklch(.14 .01 260));transition:background-color .2s}.rz-tbl-dropdown-label:hover{background-color:var(--color-surface-alt, oklch(.975 .005 260))}.rz-tbl-export-dropdown{position:absolute;top:100%;left:0;margin-top:.25rem;min-width:100px;padding:.25rem;border-radius:var(--radius-md, .5rem);box-shadow:0 4px 12px #0000001a;z-index:50;border:1px solid var(--color-border-light, oklch(.91 .01 260));background:var(--color-surface, oklch(.99 0 0))}.rz-tbl-export-opt{display:block;width:100%;text-align:left;padding:.375rem .5rem;font-size:.75rem;border-radius:var(--radius-sm, .25rem);cursor:pointer;border:none;background:transparent;color:var(--color-text, oklch(.14 .01 260));transition:background-color .2s}.rz-tbl-export-opt:hover{background-color:var(--color-surface-alt, oklch(.975 .005 260))}.rz-tbl-empty{padding:2rem .75rem;text-align:center;font-size:.875rem;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-tbl-row{border-bottom:1px solid var(--color-border-light, oklch(.91 .01 260));transition:background-color .15s}.rz-tbl-row-hoverable:hover{background-color:var(--color-surface-alt, oklch(.975 .005 260))}.rz-tbl-cell{padding:.625rem .75rem;font-size:.875rem;color:var(--color-text, oklch(.14 .01 260));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rz-tbl-cell-center{padding:.625rem .75rem;text-align:center}.rz-tbl-actions{display:flex;align-items:center;gap:.25rem}.rz-tbl-action-btn{display:inline-flex;align-items:center;justify-content:center;gap:.25rem;padding:.25rem .5rem;font-size:.75rem;border-radius:var(--radius-md, .5rem);border:none;cursor:pointer;background:transparent;transition:opacity .15s}.rz-tbl-action-btn:disabled{cursor:not-allowed}.rz-tbl-expand-btn{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;border:none;background:transparent;cursor:pointer;border-radius:var(--radius-sm, .25rem);color:var(--color-text-muted, oklch(.48 .01 260));transition:background-color .15s}.rz-tbl-expand-btn:hover{background-color:var(--color-surface-alt, oklch(.975 .005 260))}.rz-tbl-detail{padding:.75rem;font-size:.875rem;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-tbl-footer-row{border-top:2px solid var(--color-primary, oklch(.32 .09 258));font-weight:500}.rz-tbl-paginator{display:flex;align-items:center;justify-content:space-between;padding:.5rem .75rem;border-top:1px solid var(--color-border-light, oklch(.91 .01 260));background:var(--color-surface, oklch(.99 0 0))}.rz-tbl-page-info{display:flex;align-items:center;gap:.5rem;font-size:.75rem;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-tbl-page-btns{display:flex;align-items:center;gap:.125rem}.rz-tbl-page-btn{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;font-size:.75rem;border-radius:var(--radius-sm, .25rem);border:none;cursor:pointer;background:transparent;color:var(--color-text-muted, oklch(.48 .01 260));transition:background-color .15s,color .15s;font-weight:500}.rz-tbl-page-btn:disabled{opacity:.3;cursor:not-allowed}.rz-tbl-page-icon{font-size:.625rem}\n"] }]
|
|
1791
|
+
}], 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: [{
|
|
1792
|
+
type: ContentChild,
|
|
1793
|
+
args: ['rowDetail', { read: TemplateRef, static: false }]
|
|
1794
|
+
}] } });
|
|
1795
|
+
|
|
1796
|
+
class AlertComponent {
|
|
1797
|
+
type = input('info', ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
1798
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
1799
|
+
dismissible = input(true, ...(ngDevMode ? [{ debugName: "dismissible" }] : []));
|
|
1800
|
+
showIcon = input(true, ...(ngDevMode ? [{ debugName: "showIcon" }] : []));
|
|
1801
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
1802
|
+
dismiss = output();
|
|
1803
|
+
_visible = signal(true, ...(ngDevMode ? [{ debugName: "_visible" }] : []));
|
|
1804
|
+
_isLeaving = signal(false, ...(ngDevMode ? [{ debugName: "_isLeaving" }] : []));
|
|
1805
|
+
_show = computed(() => this._visible() || this._isLeaving(), ...(ngDevMode ? [{ debugName: "_show" }] : []));
|
|
1806
|
+
_icon = computed(() => {
|
|
1807
|
+
const icons = {
|
|
1808
|
+
success: 'pi pi-check-circle',
|
|
1809
|
+
warning: 'pi pi-exclamation-triangle',
|
|
1810
|
+
danger: 'pi pi-times-circle',
|
|
1811
|
+
info: 'pi pi-info-circle',
|
|
1812
|
+
};
|
|
1813
|
+
return icons[this.type()];
|
|
1814
|
+
}, ...(ngDevMode ? [{ debugName: "_icon" }] : []));
|
|
1815
|
+
_fallback = {
|
|
1816
|
+
success: 'oklch(0.55 0.18 145)',
|
|
1817
|
+
warning: 'oklch(0.68 0.18 75)',
|
|
1818
|
+
danger: 'oklch(0.55 0.22 25)',
|
|
1819
|
+
info: 'oklch(0.55 0.15 235)',
|
|
1820
|
+
};
|
|
1821
|
+
_bg = computed(() => `var(--color-${this.type()}-bg, color-mix(in srgb, ${this._fallback[this.type()]} 15%, white))`, ...(ngDevMode ? [{ debugName: "_bg" }] : []));
|
|
1822
|
+
_border = computed(() => `var(--color-${this.type()}, ${this._fallback[this.type()]})`, ...(ngDevMode ? [{ debugName: "_border" }] : []));
|
|
1823
|
+
_dismiss() {
|
|
1824
|
+
this._isLeaving.set(true);
|
|
1825
|
+
setTimeout(() => {
|
|
1826
|
+
this._visible.set(false);
|
|
1827
|
+
this._isLeaving.set(false);
|
|
1828
|
+
this.dismiss.emit();
|
|
1829
|
+
}, 200);
|
|
1830
|
+
}
|
|
1831
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: AlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1832
|
+
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=\"rz-alert\"\n [class.rz-alert-leave]=\"_isLeaving()\"\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 [style.width]=\"width() || 'auto'\"\n role=\"alert\"\n >\n @if (showIcon()) {\n <i class=\"rz-alert-icon\" [class]=\"_icon()\" [style.color]=\"_border()\"></i>\n }\n <div class=\"rz-alert-body\">\n @if (title()) {\n <p class=\"rz-alert-title\">{{ title() }}</p>\n }\n <div class=\"rz-alert-content\"><ng-content /></div>\n </div>\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"rz-alert-close\"\n (click)=\"_dismiss()\"\n aria-label=\"Close\"\n >\n <i class=\"pi pi-times\"></i>\n </button>\n }\n </div>\n}\n", styles: [":host{display:contents}.rz-alert{display:flex;align-items:flex-start;gap:.75rem;padding:.75rem;border-radius:var(--radius-md, .5rem);border:1px solid}.rz-alert-leave{opacity:0;margin-bottom:-3rem}.rz-alert-icon{margin-top:.125rem;font-size:.875rem}.rz-alert-body{flex:1;min-width:0}.rz-alert-title{font-size:.875rem;font-weight:600;color:var(--color-text, oklch(.14 .01 260))}.rz-alert-content{font-size:.875rem;color:var(--color-text, oklch(.14 .01 260))}.rz-alert-close{display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:none;background:transparent;cursor:pointer;border-radius:9999px;color:var(--color-text-muted, oklch(.48 .01 260));flex-shrink:0}.rz-alert-close:hover{opacity:.7}.rz-alert-close i{font-size:.75rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1833
|
+
}
|
|
1834
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: AlertComponent, decorators: [{
|
|
1835
|
+
type: Component,
|
|
1836
|
+
args: [{ selector: 'app-alert', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (_show()) {\n <div\n class=\"rz-alert\"\n [class.rz-alert-leave]=\"_isLeaving()\"\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 [style.width]=\"width() || 'auto'\"\n role=\"alert\"\n >\n @if (showIcon()) {\n <i class=\"rz-alert-icon\" [class]=\"_icon()\" [style.color]=\"_border()\"></i>\n }\n <div class=\"rz-alert-body\">\n @if (title()) {\n <p class=\"rz-alert-title\">{{ title() }}</p>\n }\n <div class=\"rz-alert-content\"><ng-content /></div>\n </div>\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"rz-alert-close\"\n (click)=\"_dismiss()\"\n aria-label=\"Close\"\n >\n <i class=\"pi pi-times\"></i>\n </button>\n }\n </div>\n}\n", styles: [":host{display:contents}.rz-alert{display:flex;align-items:flex-start;gap:.75rem;padding:.75rem;border-radius:var(--radius-md, .5rem);border:1px solid}.rz-alert-leave{opacity:0;margin-bottom:-3rem}.rz-alert-icon{margin-top:.125rem;font-size:.875rem}.rz-alert-body{flex:1;min-width:0}.rz-alert-title{font-size:.875rem;font-weight:600;color:var(--color-text, oklch(.14 .01 260))}.rz-alert-content{font-size:.875rem;color:var(--color-text, oklch(.14 .01 260))}.rz-alert-close{display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:none;background:transparent;cursor:pointer;border-radius:9999px;color:var(--color-text-muted, oklch(.48 .01 260));flex-shrink:0}.rz-alert-close:hover{opacity:.7}.rz-alert-close i{font-size:.75rem}\n"] }]
|
|
1837
|
+
}], 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"] }] } });
|
|
1838
|
+
|
|
1839
|
+
class SpinnerComponent {
|
|
1840
|
+
variant = input('dual-ring', ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
1841
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1842
|
+
accentColor = input('primary', ...(ngDevMode ? [{ debugName: "accentColor" }] : []));
|
|
1843
|
+
overlay = input(false, ...(ngDevMode ? [{ debugName: "overlay" }] : []));
|
|
1844
|
+
text = input('', ...(ngDevMode ? [{ debugName: "text" }] : []));
|
|
1845
|
+
imageUrl = input('', ...(ngDevMode ? [{ debugName: "imageUrl" }] : []));
|
|
1846
|
+
_px = computed(() => {
|
|
1847
|
+
const sizes = { sm: 96, md: 144, lg: 240 };
|
|
1848
|
+
return sizes[this.size()] ?? 144;
|
|
1849
|
+
}, ...(ngDevMode ? [{ debugName: "_px" }] : []));
|
|
1850
|
+
_dims = computed(() => {
|
|
1851
|
+
const px = this._px();
|
|
1852
|
+
return {
|
|
1853
|
+
spinner: px,
|
|
1854
|
+
border: Math.max(2, Math.round(px / 6)),
|
|
1855
|
+
dualOuter: px * 2,
|
|
1856
|
+
dualInner: px,
|
|
1857
|
+
dualCenter: Math.round(px * 0.5),
|
|
1858
|
+
dot: Math.round(px * 0.45),
|
|
1859
|
+
pulse: Math.round(px * 1.8),
|
|
1860
|
+
barW: Math.max(3, Math.round(px * 0.2)),
|
|
1861
|
+
barH: px,
|
|
1862
|
+
};
|
|
1863
|
+
}, ...(ngDevMode ? [{ debugName: "_dims" }] : []));
|
|
1864
|
+
_color = computed(() => {
|
|
1865
|
+
const c = this.accentColor();
|
|
1866
|
+
if (isThemeColor(c))
|
|
1867
|
+
return `var(--color-${c}, oklch(0.32 0.09 258))`;
|
|
1868
|
+
return c;
|
|
1869
|
+
}, ...(ngDevMode ? [{ debugName: "_color" }] : []));
|
|
1870
|
+
_circleStyle = computed(() => ({
|
|
1871
|
+
width: this._dims().spinner + 'px',
|
|
1872
|
+
height: this._dims().spinner + 'px',
|
|
1873
|
+
borderWidth: this._dims().border + 'px',
|
|
1874
|
+
borderStyle: 'solid',
|
|
1875
|
+
borderColor: 'var(--color-border,oklch(0.83 0.015 260))',
|
|
1876
|
+
borderTopColor: this._color(),
|
|
1877
|
+
}), ...(ngDevMode ? [{ debugName: "_circleStyle" }] : []));
|
|
1878
|
+
_dualOuterStyle = computed(() => ({
|
|
1879
|
+
width: this._dims().dualOuter + 'px',
|
|
1880
|
+
height: this._dims().dualOuter + 'px',
|
|
1881
|
+
borderWidth: this._dims().border + 'px',
|
|
1882
|
+
borderStyle: 'solid',
|
|
1883
|
+
borderColor: 'var(--color-border,oklch(0.83 0.015 260))',
|
|
1884
|
+
borderTopColor: this._color(),
|
|
1885
|
+
}), ...(ngDevMode ? [{ debugName: "_dualOuterStyle" }] : []));
|
|
1886
|
+
_dualInnerStyle = computed(() => ({
|
|
1887
|
+
width: this._dims().dualInner + 'px',
|
|
1888
|
+
height: this._dims().dualInner + 'px',
|
|
1889
|
+
borderWidth: Math.max(2, this._dims().border - 1) + 'px',
|
|
1890
|
+
borderStyle: 'solid',
|
|
1891
|
+
borderColor: 'var(--color-border-light,oklch(0.91 0.01 260))',
|
|
1892
|
+
borderTopColor: this._color(),
|
|
1893
|
+
}), ...(ngDevMode ? [{ debugName: "_dualInnerStyle" }] : []));
|
|
1894
|
+
_imageStyle = computed(() => ({
|
|
1895
|
+
width: this._dims().dualCenter + 'px',
|
|
1896
|
+
height: this._dims().dualCenter + 'px',
|
|
1897
|
+
}), ...(ngDevMode ? [{ debugName: "_imageStyle" }] : []));
|
|
1898
|
+
_dotStyle = computed(() => ({
|
|
1899
|
+
width: this._dims().dot + 'px',
|
|
1900
|
+
height: this._dims().dot + 'px',
|
|
1901
|
+
backgroundColor: this._color(),
|
|
1902
|
+
}), ...(ngDevMode ? [{ debugName: "_dotStyle" }] : []));
|
|
1903
|
+
_pulseStyle = computed(() => ({
|
|
1904
|
+
width: this._dims().pulse + 'px',
|
|
1905
|
+
height: this._dims().pulse + 'px',
|
|
1906
|
+
backgroundColor: this._color(),
|
|
1907
|
+
}), ...(ngDevMode ? [{ debugName: "_pulseStyle" }] : []));
|
|
1908
|
+
_barStyle = computed(() => ({
|
|
1909
|
+
width: this._dims().barW + 'px',
|
|
1910
|
+
height: this._dims().barH + 'px',
|
|
1911
|
+
backgroundColor: this._color(),
|
|
1912
|
+
}), ...(ngDevMode ? [{ debugName: "_barStyle" }] : []));
|
|
1913
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1914
|
+
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 class=\"rz-spinner\"\n [class.rz-spinner-overlay]=\"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=\"rz-sp-circle\" [style]=\"_circleStyle()\"></div>\n }\n @case ('dual-ring') {\n <div class=\"rz-sp-dual\">\n <div class=\"rz-sp-dual-outer\" [style]=\"_dualOuterStyle()\"></div>\n <div class=\"rz-sp-dual-inner\" [style]=\"_dualInnerStyle()\"></div>\n @if (imageUrl()) {\n <div class=\"rz-sp-dual-center\">\n <img [src]=\"imageUrl()\" [style]=\"_imageStyle()\" alt=\"\" />\n </div>\n }\n </div>\n }\n @case ('dots') {\n <div class=\"rz-sp-dots\">\n @for (dot of [0,1,2]; track dot) {\n <div class=\"rz-sp-dot\" [style]=\"_dotStyle()\" [style.animationDelay]=\"dot * 0.15 + 's'\"></div>\n }\n </div>\n }\n @case ('pulse') {\n <div class=\"rz-sp-pulse\" [style]=\"_pulseStyle()\"></div>\n }\n @case ('bars') {\n <div class=\"rz-sp-bars\">\n @for (bar of [0,1,2,3,4]; track bar) {\n <div class=\"rz-sp-bar\" [style]=\"_barStyle()\" [style.animationDelay]=\"bar * 0.1 + 's'\"></div>\n }\n </div>\n }\n }\n\n @if (text()) {\n <p class=\"rz-sp-text\" [class.rz-sp-text-inverse]=\"overlay()\">{{ text() }}</p>\n }\n</div>\n", styles: [":host{display:contents}.rz-spinner{display:inline-flex;flex-direction:column;align-items:center;justify-content:center}.rz-spinner-overlay{display:flex;position:fixed;inset:0;z-index:50}.rz-sp-circle{border-radius:50%;border-style:solid;animation:rz-spin .8s linear infinite}.rz-sp-dual{position:relative;display:flex;align-items:center;justify-content:center}.rz-sp-dual-outer{border-radius:50%;border-style:solid;animation:rz-spin .8s linear infinite}.rz-sp-dual-inner{position:absolute;border-radius:50%;border-style:solid;animation:rz-spin-reverse 1.5s linear infinite}.rz-sp-dual-center{position:absolute;display:flex;align-items:center;justify-content:center}.rz-sp-dots{display:flex;align-items:center;gap:.375rem}.rz-sp-dot{border-radius:50%;animation:rz-dot-bounce .6s ease-in-out infinite alternate}.rz-sp-pulse{border-radius:50%;animation:rz-pulse-ring 1.5s ease-in-out infinite}.rz-sp-bars{display:flex;align-items:flex-end;gap:3px}.rz-sp-bar{border-radius:.125rem;animation:rz-bar-wave .8s ease-in-out infinite}.rz-sp-text{margin-top:.5rem;font-size:.75rem;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-sp-text-inverse{color:#fff}@keyframes rz-spin{to{transform:rotate(360deg)}}@keyframes rz-spin-reverse{to{transform:rotate(-360deg)}}@keyframes rz-dot-bounce{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes rz-pulse-ring{0%,to{transform:scale(1);opacity:.6}50%{transform:scale(1.15);opacity:1}}@keyframes rz-bar-wave{0%,to{transform:scaleY(.4)}50%{transform:scaleY(1)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1915
|
+
}
|
|
1916
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SpinnerComponent, decorators: [{
|
|
1917
|
+
type: Component,
|
|
1918
|
+
args: [{ selector: 'app-spinner', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"rz-spinner\"\n [class.rz-spinner-overlay]=\"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=\"rz-sp-circle\" [style]=\"_circleStyle()\"></div>\n }\n @case ('dual-ring') {\n <div class=\"rz-sp-dual\">\n <div class=\"rz-sp-dual-outer\" [style]=\"_dualOuterStyle()\"></div>\n <div class=\"rz-sp-dual-inner\" [style]=\"_dualInnerStyle()\"></div>\n @if (imageUrl()) {\n <div class=\"rz-sp-dual-center\">\n <img [src]=\"imageUrl()\" [style]=\"_imageStyle()\" alt=\"\" />\n </div>\n }\n </div>\n }\n @case ('dots') {\n <div class=\"rz-sp-dots\">\n @for (dot of [0,1,2]; track dot) {\n <div class=\"rz-sp-dot\" [style]=\"_dotStyle()\" [style.animationDelay]=\"dot * 0.15 + 's'\"></div>\n }\n </div>\n }\n @case ('pulse') {\n <div class=\"rz-sp-pulse\" [style]=\"_pulseStyle()\"></div>\n }\n @case ('bars') {\n <div class=\"rz-sp-bars\">\n @for (bar of [0,1,2,3,4]; track bar) {\n <div class=\"rz-sp-bar\" [style]=\"_barStyle()\" [style.animationDelay]=\"bar * 0.1 + 's'\"></div>\n }\n </div>\n }\n }\n\n @if (text()) {\n <p class=\"rz-sp-text\" [class.rz-sp-text-inverse]=\"overlay()\">{{ text() }}</p>\n }\n</div>\n", styles: [":host{display:contents}.rz-spinner{display:inline-flex;flex-direction:column;align-items:center;justify-content:center}.rz-spinner-overlay{display:flex;position:fixed;inset:0;z-index:50}.rz-sp-circle{border-radius:50%;border-style:solid;animation:rz-spin .8s linear infinite}.rz-sp-dual{position:relative;display:flex;align-items:center;justify-content:center}.rz-sp-dual-outer{border-radius:50%;border-style:solid;animation:rz-spin .8s linear infinite}.rz-sp-dual-inner{position:absolute;border-radius:50%;border-style:solid;animation:rz-spin-reverse 1.5s linear infinite}.rz-sp-dual-center{position:absolute;display:flex;align-items:center;justify-content:center}.rz-sp-dots{display:flex;align-items:center;gap:.375rem}.rz-sp-dot{border-radius:50%;animation:rz-dot-bounce .6s ease-in-out infinite alternate}.rz-sp-pulse{border-radius:50%;animation:rz-pulse-ring 1.5s ease-in-out infinite}.rz-sp-bars{display:flex;align-items:flex-end;gap:3px}.rz-sp-bar{border-radius:.125rem;animation:rz-bar-wave .8s ease-in-out infinite}.rz-sp-text{margin-top:.5rem;font-size:.75rem;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-sp-text-inverse{color:#fff}@keyframes rz-spin{to{transform:rotate(360deg)}}@keyframes rz-spin-reverse{to{transform:rotate(-360deg)}}@keyframes rz-dot-bounce{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes rz-pulse-ring{0%,to{transform:scale(1);opacity:.6}50%{transform:scale(1.15);opacity:1}}@keyframes rz-bar-wave{0%,to{transform:scaleY(.4)}50%{transform:scaleY(1)}}\n"] }]
|
|
1919
|
+
}], 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 }] }] } });
|
|
1920
|
+
|
|
1921
|
+
class ToastService {
|
|
1922
|
+
_toasts = signal([], ...(ngDevMode ? [{ debugName: "_toasts" }] : []));
|
|
1923
|
+
_counter = 0;
|
|
1924
|
+
toasts = this._toasts.asReadonly();
|
|
1925
|
+
show(type, message, config) {
|
|
1926
|
+
const id = ++this._counter;
|
|
1927
|
+
const toast = {
|
|
1928
|
+
id,
|
|
1929
|
+
type,
|
|
1930
|
+
message,
|
|
1931
|
+
title: config?.title,
|
|
1932
|
+
duration: config?.duration,
|
|
1933
|
+
};
|
|
1934
|
+
this._toasts.update(list => [...list, toast]);
|
|
1935
|
+
const ms = config?.duration ?? 4000;
|
|
1936
|
+
if (ms > 0) {
|
|
1937
|
+
setTimeout(() => this.remove(id), ms);
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
success(message, config) {
|
|
1941
|
+
this.show('success', message, config);
|
|
1942
|
+
}
|
|
1943
|
+
error(message, config) {
|
|
1944
|
+
this.show('error', message, config);
|
|
1945
|
+
}
|
|
1946
|
+
warning(message, config) {
|
|
1947
|
+
this.show('warning', message, config);
|
|
1948
|
+
}
|
|
1949
|
+
info(message, config) {
|
|
1950
|
+
this.show('info', message, config);
|
|
1951
|
+
}
|
|
1952
|
+
remove(id) {
|
|
1953
|
+
this._toasts.update(list => list.filter(t => t.id !== id));
|
|
1954
|
+
}
|
|
1955
|
+
clear() {
|
|
1956
|
+
this._toasts.set([]);
|
|
1957
|
+
}
|
|
1958
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1959
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastService, providedIn: 'root' });
|
|
1960
|
+
}
|
|
1961
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastService, decorators: [{
|
|
1962
|
+
type: Injectable,
|
|
1963
|
+
args: [{ providedIn: 'root' }]
|
|
1964
|
+
}] });
|
|
1965
|
+
|
|
1966
|
+
class ToastComponent {
|
|
1967
|
+
position = input('top-right', ...(ngDevMode ? [{ debugName: "position" }] : []));
|
|
1968
|
+
maxVisible = input(5, ...(ngDevMode ? [{ debugName: "maxVisible" }] : []));
|
|
1969
|
+
_toastService = inject(ToastService);
|
|
1970
|
+
_toasts = computed(() => this._toastService.toasts().slice(-this.maxVisible()), ...(ngDevMode ? [{ debugName: "_toasts" }] : []));
|
|
1971
|
+
_fallback = {
|
|
1972
|
+
success: 'oklch(0.55 0.18 145)',
|
|
1973
|
+
error: 'oklch(0.55 0.22 25)',
|
|
1974
|
+
warning: 'oklch(0.68 0.18 75)',
|
|
1975
|
+
info: 'oklch(0.55 0.15 235)',
|
|
1976
|
+
};
|
|
1977
|
+
_iconMap = {
|
|
1978
|
+
success: 'pi pi-check-circle',
|
|
1979
|
+
error: 'pi pi-times-circle',
|
|
1980
|
+
warning: 'pi pi-exclamation-triangle',
|
|
1981
|
+
info: 'pi pi-info-circle',
|
|
1982
|
+
};
|
|
1983
|
+
_themeKey(type) {
|
|
1984
|
+
return type === 'error' ? 'danger' : type;
|
|
1985
|
+
}
|
|
1986
|
+
_getBg(type) {
|
|
1987
|
+
return `var(--color-${this._themeKey(type)}-bg, color-mix(in srgb, ${this._fallback[type]} 15%, white))`;
|
|
1988
|
+
}
|
|
1989
|
+
_getIcon(type) {
|
|
1990
|
+
return this._iconMap[type];
|
|
1991
|
+
}
|
|
1992
|
+
_getBorder(type) {
|
|
1993
|
+
return `var(--color-${this._themeKey(type)}, ${this._fallback[type]})`;
|
|
1994
|
+
}
|
|
1995
|
+
_remove(id) {
|
|
1996
|
+
this._toastService.remove(id);
|
|
1997
|
+
}
|
|
1998
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1999
|
+
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=\"rz-toast-container\"\n [attr.data-position]=\"position()\"\n>\n @for (toast of _toasts(); track toast.id) {\n <div\n class=\"rz-toast-item rz-toast-enter\"\n [style.background-color]=\"_getBg(toast.type)\"\n [style.border-color]=\"_getBorder(toast.type)\"\n >\n <i class=\"rz-toast-icon\" [class]=\"_getIcon(toast.type)\" [style.color]=\"_getBorder(toast.type)\"></i>\n <div class=\"rz-toast-body\">\n @if (toast.title) {\n <p class=\"rz-toast-title\">{{ toast.title }}</p>\n }\n <p class=\"rz-toast-msg\">{{ toast.message }}</p>\n </div>\n <button\n type=\"button\"\n class=\"rz-toast-close\"\n (click)=\"_remove(toast.id)\"\n aria-label=\"Close\"\n >\n <i class=\"pi pi-times\"></i>\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:contents}.rz-toast-container{position:fixed;z-index:9999;display:flex;flex-direction:column;gap:.5rem;min-width:18rem;max-width:min(30rem,calc(100vw - 2rem));width:max-content;pointer-events:none}.rz-toast-container[data-position=top-right]{top:1rem;right:1rem}.rz-toast-container[data-position=top-left]{top:1rem;left:1rem}.rz-toast-container[data-position=bottom-right]{bottom:1rem;right:1rem}.rz-toast-container[data-position=bottom-left]{bottom:1rem;left:1rem}.rz-toast-item{display:flex;align-items:flex-start;gap:.75rem;padding:.75rem;border-radius:var(--radius-md, .5rem);box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;border:1px solid;pointer-events:auto}.rz-toast-icon{margin-top:.125rem;font-size:.875rem;flex-shrink:0}.rz-toast-body{flex:1;min-width:0}.rz-toast-title{font-size:.75rem;font-weight:600;color:var(--color-text, oklch(.14 .01 260))}.rz-toast-msg{font-size:.875rem;color:var(--color-text, oklch(.14 .01 260))}.rz-toast-close{display:flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;padding:0;border:none;background:transparent;cursor:pointer;border-radius:9999px;flex-shrink:0;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-toast-close:hover{opacity:.7}.rz-toast-close i{font-size:.75rem}.rz-toast-enter{animation:rz-toast-slide-in .3s ease-out}@keyframes rz-toast-slide-in{0%{opacity:0;translate:0 -8px}to{opacity:1;translate:0}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2000
|
+
}
|
|
2001
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastComponent, decorators: [{
|
|
2002
|
+
type: Component,
|
|
2003
|
+
args: [{ selector: 'app-toast', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"rz-toast-container\"\n [attr.data-position]=\"position()\"\n>\n @for (toast of _toasts(); track toast.id) {\n <div\n class=\"rz-toast-item rz-toast-enter\"\n [style.background-color]=\"_getBg(toast.type)\"\n [style.border-color]=\"_getBorder(toast.type)\"\n >\n <i class=\"rz-toast-icon\" [class]=\"_getIcon(toast.type)\" [style.color]=\"_getBorder(toast.type)\"></i>\n <div class=\"rz-toast-body\">\n @if (toast.title) {\n <p class=\"rz-toast-title\">{{ toast.title }}</p>\n }\n <p class=\"rz-toast-msg\">{{ toast.message }}</p>\n </div>\n <button\n type=\"button\"\n class=\"rz-toast-close\"\n (click)=\"_remove(toast.id)\"\n aria-label=\"Close\"\n >\n <i class=\"pi pi-times\"></i>\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:contents}.rz-toast-container{position:fixed;z-index:9999;display:flex;flex-direction:column;gap:.5rem;min-width:18rem;max-width:min(30rem,calc(100vw - 2rem));width:max-content;pointer-events:none}.rz-toast-container[data-position=top-right]{top:1rem;right:1rem}.rz-toast-container[data-position=top-left]{top:1rem;left:1rem}.rz-toast-container[data-position=bottom-right]{bottom:1rem;right:1rem}.rz-toast-container[data-position=bottom-left]{bottom:1rem;left:1rem}.rz-toast-item{display:flex;align-items:flex-start;gap:.75rem;padding:.75rem;border-radius:var(--radius-md, .5rem);box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;border:1px solid;pointer-events:auto}.rz-toast-icon{margin-top:.125rem;font-size:.875rem;flex-shrink:0}.rz-toast-body{flex:1;min-width:0}.rz-toast-title{font-size:.75rem;font-weight:600;color:var(--color-text, oklch(.14 .01 260))}.rz-toast-msg{font-size:.875rem;color:var(--color-text, oklch(.14 .01 260))}.rz-toast-close{display:flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;padding:0;border:none;background:transparent;cursor:pointer;border-radius:9999px;flex-shrink:0;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-toast-close:hover{opacity:.7}.rz-toast-close i{font-size:.75rem}.rz-toast-enter{animation:rz-toast-slide-in .3s ease-out}@keyframes rz-toast-slide-in{0%{opacity:0;translate:0 -8px}to{opacity:1;translate:0}}\n"] }]
|
|
2004
|
+
}], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], maxVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxVisible", required: false }] }] } });
|
|
2005
|
+
|
|
2006
|
+
class AccordionPanelComponent {
|
|
2007
|
+
_accordion = inject(AccordionComponent, { optional: true });
|
|
2008
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
2009
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
2010
|
+
expanded = model(false, ...(ngDevMode ? [{ debugName: "expanded" }] : []));
|
|
2011
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
2012
|
+
_isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : []));
|
|
2013
|
+
_visible = computed(() => this._isOpen() || this._isClosing(), ...(ngDevMode ? [{ debugName: "_visible" }] : []));
|
|
2014
|
+
_open() {
|
|
2015
|
+
if (this.disabled() || this._isOpen())
|
|
2016
|
+
return;
|
|
2017
|
+
if (!this._accordion?.multi()) {
|
|
2018
|
+
this._accordion?.panels().forEach(p => { if (p !== this)
|
|
2019
|
+
p._close(); });
|
|
2020
|
+
}
|
|
2021
|
+
this._isOpen.set(true);
|
|
2022
|
+
this._isClosing.set(false);
|
|
2023
|
+
this.expanded.set(true);
|
|
2024
|
+
}
|
|
2025
|
+
_close() {
|
|
2026
|
+
if (!this._isOpen() || this._isClosing())
|
|
2027
|
+
return;
|
|
2028
|
+
this._isClosing.set(true);
|
|
2029
|
+
this._isOpen.set(false);
|
|
2030
|
+
setTimeout(() => {
|
|
2031
|
+
this._isClosing.set(false);
|
|
2032
|
+
this.expanded.set(false);
|
|
2033
|
+
}, 150);
|
|
2034
|
+
}
|
|
2035
|
+
_toggle() {
|
|
2036
|
+
if (this._isOpen())
|
|
2037
|
+
this._close();
|
|
2038
|
+
else
|
|
2039
|
+
this._open();
|
|
2040
|
+
}
|
|
2041
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: AccordionPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2042
|
+
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": "'rz-acc-panel'" } }, ngImport: i0, template: "<button\n type=\"button\"\n (click)=\"_toggle()\"\n [disabled]=\"disabled()\"\n class=\"rz-acc-trigger\"\n>\n <span>{{ title() }}</span>\n <i class=\"pi pi-chevron-down rz-acc-chevron\"\n [style.transform]=\"_isOpen() ? 'rotate(180deg)' : 'rotate(0deg)'\"\n ></i>\n</button>\n@if (_visible()) {\n <div\n class=\"rz-acc-body\"\n [class.rz-acc-enter]=\"_isOpen() && !_isClosing()\"\n [class.rz-acc-leave]=\"_isClosing()\"\n >\n <div class=\"rz-acc-content\">\n <ng-content />\n </div>\n </div>\n}\n", styles: [":host{display:block}.rz-acc-panel{border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:var(--radius-md, .5rem);overflow:hidden}.rz-acc-trigger{display:inline-flex;align-items:center;justify-content:space-between;width:100%;padding:.625rem .75rem;font-size:.875rem;font-weight:500;border:none;background:transparent;cursor:pointer;color:var(--color-text, oklch(.14 .01 260));transition:background-color .15s}.rz-acc-trigger:hover{background-color:var(--color-surface-alt, oklch(.975 .005 260))}.rz-acc-trigger:disabled{cursor:not-allowed;opacity:.5}.rz-acc-chevron{font-size:.75rem;transition:transform .2s}.rz-acc-body{overflow:hidden;border-top:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-acc-content{padding:.625rem .75rem;font-size:.875rem;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-acc-enter{animation:rz-acc-slide-in .2s ease-out}.rz-acc-leave{animation:rz-acc-slide-out .15s ease-in forwards}@keyframes rz-acc-slide-in{0%{opacity:0;max-height:0}to{opacity:1;max-height:500px}}@keyframes rz-acc-slide-out{0%{opacity:1;max-height:500px}to{opacity:0;max-height:0}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2043
|
+
}
|
|
2044
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: AccordionPanelComponent, decorators: [{
|
|
2045
|
+
type: Component,
|
|
2046
|
+
args: [{ selector: 'app-accordion-panel', imports: [], host: {
|
|
2047
|
+
'[class]': "'rz-acc-panel'",
|
|
2048
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n type=\"button\"\n (click)=\"_toggle()\"\n [disabled]=\"disabled()\"\n class=\"rz-acc-trigger\"\n>\n <span>{{ title() }}</span>\n <i class=\"pi pi-chevron-down rz-acc-chevron\"\n [style.transform]=\"_isOpen() ? 'rotate(180deg)' : 'rotate(0deg)'\"\n ></i>\n</button>\n@if (_visible()) {\n <div\n class=\"rz-acc-body\"\n [class.rz-acc-enter]=\"_isOpen() && !_isClosing()\"\n [class.rz-acc-leave]=\"_isClosing()\"\n >\n <div class=\"rz-acc-content\">\n <ng-content />\n </div>\n </div>\n}\n", styles: [":host{display:block}.rz-acc-panel{border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:var(--radius-md, .5rem);overflow:hidden}.rz-acc-trigger{display:inline-flex;align-items:center;justify-content:space-between;width:100%;padding:.625rem .75rem;font-size:.875rem;font-weight:500;border:none;background:transparent;cursor:pointer;color:var(--color-text, oklch(.14 .01 260));transition:background-color .15s}.rz-acc-trigger:hover{background-color:var(--color-surface-alt, oklch(.975 .005 260))}.rz-acc-trigger:disabled{cursor:not-allowed;opacity:.5}.rz-acc-chevron{font-size:.75rem;transition:transform .2s}.rz-acc-body{overflow:hidden;border-top:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-acc-content{padding:.625rem .75rem;font-size:.875rem;color:var(--color-text-muted, oklch(.48 .01 260))}.rz-acc-enter{animation:rz-acc-slide-in .2s ease-out}.rz-acc-leave{animation:rz-acc-slide-out .15s ease-in forwards}@keyframes rz-acc-slide-in{0%{opacity:0;max-height:0}to{opacity:1;max-height:500px}}@keyframes rz-acc-slide-out{0%{opacity:1;max-height:500px}to{opacity:0;max-height:0}}\n"] }]
|
|
2049
|
+
}], 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"] }] } });
|
|
2050
|
+
|
|
2051
|
+
class AccordionComponent {
|
|
2052
|
+
multi = input(false, ...(ngDevMode ? [{ debugName: "multi" }] : []));
|
|
2053
|
+
panels = contentChildren(AccordionPanelComponent, ...(ngDevMode ? [{ debugName: "panels" }] : []));
|
|
2054
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: AccordionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2055
|
+
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 });
|
|
2056
|
+
}
|
|
2057
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: AccordionComponent, decorators: [{
|
|
2058
|
+
type: Component,
|
|
2059
|
+
args: [{
|
|
2060
|
+
selector: 'app-accordion',
|
|
2061
|
+
imports: [],
|
|
2062
|
+
template: '<ng-content />',
|
|
2063
|
+
host: { '[style.display]': "'flex'", '[style.flex-direction]': "'column'" },
|
|
2064
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2065
|
+
}]
|
|
2066
|
+
}], propDecorators: { multi: [{ type: i0.Input, args: [{ isSignal: true, alias: "multi", required: false }] }], panels: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => AccordionPanelComponent), { isSignal: true }] }] } });
|
|
2067
|
+
|
|
2068
|
+
class NavComponent {
|
|
2069
|
+
_router = inject(Router);
|
|
2070
|
+
_routerSub;
|
|
2071
|
+
items = input([], ...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
2072
|
+
brandText = input('Brand', ...(ngDevMode ? [{ debugName: "brandText" }] : []));
|
|
2073
|
+
brandIcon = input('pi pi-box', ...(ngDevMode ? [{ debugName: "brandIcon" }] : []));
|
|
2074
|
+
fixed = input(true, ...(ngDevMode ? [{ debugName: "fixed" }] : []));
|
|
2075
|
+
logout = output();
|
|
2076
|
+
_mobileOpen = signal(false, ...(ngDevMode ? [{ debugName: "_mobileOpen" }] : []));
|
|
2077
|
+
_openDropdown = signal(null, ...(ngDevMode ? [{ debugName: "_openDropdown" }] : []));
|
|
2078
|
+
_currentUrl = signal(this._router.url, ...(ngDevMode ? [{ debugName: "_currentUrl" }] : []));
|
|
2079
|
+
constructor() {
|
|
2080
|
+
this._routerSub = this._router.events
|
|
2081
|
+
.pipe(filter(e => e instanceof NavigationEnd))
|
|
2082
|
+
.subscribe(() => this._currentUrl.set(this._router.url));
|
|
2083
|
+
}
|
|
2084
|
+
_isActive(segment) {
|
|
2085
|
+
return this._currentUrl().includes(segment);
|
|
2086
|
+
}
|
|
2087
|
+
_toggleMobile() {
|
|
2088
|
+
this._mobileOpen.update(v => !v);
|
|
2089
|
+
if (!this._mobileOpen())
|
|
2090
|
+
this._openDropdown.set(null);
|
|
2091
|
+
}
|
|
2092
|
+
_toggleDropdown(name) {
|
|
2093
|
+
this._openDropdown.update(v => v === name ? null : name);
|
|
2094
|
+
}
|
|
2095
|
+
_navigate(route) {
|
|
2096
|
+
this._router.navigate([route]);
|
|
2097
|
+
this._mobileOpen.set(false);
|
|
2098
|
+
this._openDropdown.set(null);
|
|
2099
|
+
}
|
|
2100
|
+
_onDocClick() {
|
|
2101
|
+
this._openDropdown.set(null);
|
|
2102
|
+
}
|
|
2103
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: NavComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2104
|
+
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=\"rz-nav\"\n [class.rz-nav-fixed]=\"fixed()\"\n>\n <div class=\"rz-nav-brand\">\n <i [class]=\"brandIcon()\" class=\"rz-nav-brand-icon\"></i>\n <span class=\"rz-nav-brand-text\">{{ brandText() }}</span>\n </div>\n\n <button\n type=\"button\"\n (click)=\"_toggleMobile()\"\n class=\"rz-nav-mobile-btn\"\n [style.color]=\"'inherit'\"\n >\n <i class=\"pi rz-nav-mobile-icon\" [class.pi-bars]=\"!_mobileOpen()\" [class.pi-times]=\"_mobileOpen()\"></i>\n </button>\n\n <!-- Desktop -->\n <div class=\"rz-nav-desktop\">\n @for (item of items(); track item.id) {\n <div class=\"rz-nav-desk-item-wrap\" (click)=\"$event.stopPropagation()\">\n <button\n type=\"button\"\n (click)=\"item.children ? _toggleDropdown(item.id) : _navigate(item.route || '')\"\n class=\"rz-nav-desk-item\"\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=\"rz-nav-desk-item-icon\"></i> }\n <span>{{ item.label }}</span>\n @if (item.children) {\n <i class=\"pi pi-chevron-down rz-nav-desk-item-chevron\"\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=\"rz-nav-desk-dropdown\"\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=\"rz-nav-desk-dd-item\"\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=\"rz-nav-desk-dd-item-icon\"></i> }\n <span>{{ child.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n }\n </div>\n\n <!-- Mobile -->\n <div\n class=\"rz-nav-mob-panel\"\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=\"rz-nav-mob-item\"\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=\"rz-nav-mob-item-icon\"></i> }\n <span class=\"rz-nav-mob-item-label\">{{ item.label }}</span>\n @if (item.children) {\n <i class=\"pi pi-chevron-down rz-nav-mob-item-chevron\"\n [style.transform]=\"_openDropdown() === item.id ? 'rotate(180deg)' : ''\"\n ></i>\n }\n </button>\n\n @if (item.children && _openDropdown() === item.id) {\n <div class=\"rz-nav-mob-children\"\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=\"rz-nav-mob-child\"\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=\"rz-nav-mob-child-icon\"></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=\"rz-nav-logout\"\n [style.color]=\"'inherit'\"\n [style.border-color]=\"'rgba(255,255,255,0.3)'\"\n >\n <i class=\"pi pi-sign-out rz-nav-logout-icon\"></i>\n <span class=\"rz-nav-logout-text\">Logout</span>\n </button>\n</nav>\n", styles: [":host{display:contents}.rz-nav{height:4rem;z-index:50;display:flex;align-items:center;padding:0 1.25rem;gap:.75rem;background-color:var(--color-primary, oklch(.32 .09 258));color:var(--color-primary-inverse, oklch(.99 0 0))}.rz-nav-fixed{position:fixed;top:0;left:0;right:0}.rz-nav:not(.rz-nav-fixed){position:relative;border-radius:.5rem}.rz-nav-brand{display:flex;align-items:center;gap:.5rem;flex-shrink:0}.rz-nav-brand-icon{font-size:1.25rem}.rz-nav-brand-text{font-size:.875rem;font-weight:700;display:none}@media(min-width:640px){.rz-nav-brand-text{display:inline}}.rz-nav-mobile-btn{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border:none;background:transparent;cursor:pointer;border-radius:.25rem}@media(min-width:1024px){.rz-nav-mobile-btn{display:none}}.rz-nav-mobile-icon{font-size:1.125rem}.rz-nav-desktop{flex:1;display:none;align-items:center;justify-content:center;gap:.25rem}@media(min-width:1024px){.rz-nav-desktop{display:flex}}.rz-nav-desk-item-wrap{position:relative}.rz-nav-desk-item{display:inline-flex;align-items:center;gap:.375rem;padding:.5rem .75rem;border-radius:.5rem;font-size:.875rem;font-weight:500;border:none;cursor:pointer;white-space:nowrap}.rz-nav-desk-item-icon{font-size:.875rem}.rz-nav-desk-item-chevron{font-size:.625rem;transition:transform .2s}.rz-nav-desk-dropdown{position:absolute;top:100%;right:0;margin-top:.25rem;min-width:180px;display:flex;flex-direction:column;gap:.125rem;padding:.5rem;border-radius:.75rem;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;z-index:50;background-color:var(--color-surface, oklch(.99 0 0));border:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-nav-desk-dd-item{width:100%;display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-radius:.5rem;font-size:.875rem;font-weight:500;border:none;cursor:pointer;white-space:nowrap;transition:background-color .15s}.rz-nav-desk-dd-item-icon{font-size:.75rem}.rz-nav-mob-panel{position:fixed;left:0;right:0;top:4rem;display:flex;flex-direction:column;gap:.25rem;padding:1rem;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;z-index:50;background-color:var(--color-primary, oklch(.32 .09 258))}@media(min-width:1024px){.rz-nav-mob-panel{display:none}}.rz-nav-mob-item{width:100%;display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-radius:.5rem;font-size:.875rem;font-weight:500;border:none;cursor:pointer;transition:background-color .15s}.rz-nav-mob-item-icon{font-size:.875rem}.rz-nav-mob-item-label{flex:1}.rz-nav-mob-item-chevron{font-size:.75rem;transition:transform .2s}.rz-nav-mob-children{display:flex;flex-direction:column;gap:.125rem;margin-top:.25rem;margin-right:1rem}.rz-nav-mob-child{width:100%;display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-radius:.5rem;font-size:.875rem;border:none;cursor:pointer;transition:background-color .15s}.rz-nav-mob-child-icon{font-size:.75rem}.rz-nav-logout{display:inline-flex;align-items:center;gap:.375rem;padding:.5rem .75rem;border-radius:.5rem;font-size:.875rem;font-weight:500;border:1px solid;white-space:nowrap;cursor:pointer;transition:background-color .15s;flex-shrink:0}.rz-nav-logout-icon{font-size:.875rem}.rz-nav-logout-text{display:none}@media(min-width:640px){.rz-nav-logout-text{display:inline}}.nav-dd-in{animation:rz-nav-dd-in .2s ease-out}.nav-dd-out{animation:rz-nav-dd-out .15s ease-in forwards}.nav-mob-in{animation:rz-nav-mob-in .2s ease-out}.nav-mob-out{animation:rz-nav-mob-out .12s ease-in forwards}@keyframes rz-nav-dd-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0}}@keyframes rz-nav-dd-out{0%{opacity:1;translate:0}to{opacity:0;translate:0 -6px}}@keyframes rz-nav-mob-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes rz-nav-mob-out{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2105
|
+
}
|
|
2106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: NavComponent, decorators: [{
|
|
2107
|
+
type: Component,
|
|
2108
|
+
args: [{ selector: 'app-nav', imports: [], host: {
|
|
2109
|
+
'(document:click)': '_onDocClick()',
|
|
2110
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<nav\n class=\"rz-nav\"\n [class.rz-nav-fixed]=\"fixed()\"\n>\n <div class=\"rz-nav-brand\">\n <i [class]=\"brandIcon()\" class=\"rz-nav-brand-icon\"></i>\n <span class=\"rz-nav-brand-text\">{{ brandText() }}</span>\n </div>\n\n <button\n type=\"button\"\n (click)=\"_toggleMobile()\"\n class=\"rz-nav-mobile-btn\"\n [style.color]=\"'inherit'\"\n >\n <i class=\"pi rz-nav-mobile-icon\" [class.pi-bars]=\"!_mobileOpen()\" [class.pi-times]=\"_mobileOpen()\"></i>\n </button>\n\n <!-- Desktop -->\n <div class=\"rz-nav-desktop\">\n @for (item of items(); track item.id) {\n <div class=\"rz-nav-desk-item-wrap\" (click)=\"$event.stopPropagation()\">\n <button\n type=\"button\"\n (click)=\"item.children ? _toggleDropdown(item.id) : _navigate(item.route || '')\"\n class=\"rz-nav-desk-item\"\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=\"rz-nav-desk-item-icon\"></i> }\n <span>{{ item.label }}</span>\n @if (item.children) {\n <i class=\"pi pi-chevron-down rz-nav-desk-item-chevron\"\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=\"rz-nav-desk-dropdown\"\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=\"rz-nav-desk-dd-item\"\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=\"rz-nav-desk-dd-item-icon\"></i> }\n <span>{{ child.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n }\n </div>\n\n <!-- Mobile -->\n <div\n class=\"rz-nav-mob-panel\"\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=\"rz-nav-mob-item\"\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=\"rz-nav-mob-item-icon\"></i> }\n <span class=\"rz-nav-mob-item-label\">{{ item.label }}</span>\n @if (item.children) {\n <i class=\"pi pi-chevron-down rz-nav-mob-item-chevron\"\n [style.transform]=\"_openDropdown() === item.id ? 'rotate(180deg)' : ''\"\n ></i>\n }\n </button>\n\n @if (item.children && _openDropdown() === item.id) {\n <div class=\"rz-nav-mob-children\"\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=\"rz-nav-mob-child\"\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=\"rz-nav-mob-child-icon\"></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=\"rz-nav-logout\"\n [style.color]=\"'inherit'\"\n [style.border-color]=\"'rgba(255,255,255,0.3)'\"\n >\n <i class=\"pi pi-sign-out rz-nav-logout-icon\"></i>\n <span class=\"rz-nav-logout-text\">Logout</span>\n </button>\n</nav>\n", styles: [":host{display:contents}.rz-nav{height:4rem;z-index:50;display:flex;align-items:center;padding:0 1.25rem;gap:.75rem;background-color:var(--color-primary, oklch(.32 .09 258));color:var(--color-primary-inverse, oklch(.99 0 0))}.rz-nav-fixed{position:fixed;top:0;left:0;right:0}.rz-nav:not(.rz-nav-fixed){position:relative;border-radius:.5rem}.rz-nav-brand{display:flex;align-items:center;gap:.5rem;flex-shrink:0}.rz-nav-brand-icon{font-size:1.25rem}.rz-nav-brand-text{font-size:.875rem;font-weight:700;display:none}@media(min-width:640px){.rz-nav-brand-text{display:inline}}.rz-nav-mobile-btn{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border:none;background:transparent;cursor:pointer;border-radius:.25rem}@media(min-width:1024px){.rz-nav-mobile-btn{display:none}}.rz-nav-mobile-icon{font-size:1.125rem}.rz-nav-desktop{flex:1;display:none;align-items:center;justify-content:center;gap:.25rem}@media(min-width:1024px){.rz-nav-desktop{display:flex}}.rz-nav-desk-item-wrap{position:relative}.rz-nav-desk-item{display:inline-flex;align-items:center;gap:.375rem;padding:.5rem .75rem;border-radius:.5rem;font-size:.875rem;font-weight:500;border:none;cursor:pointer;white-space:nowrap}.rz-nav-desk-item-icon{font-size:.875rem}.rz-nav-desk-item-chevron{font-size:.625rem;transition:transform .2s}.rz-nav-desk-dropdown{position:absolute;top:100%;right:0;margin-top:.25rem;min-width:180px;display:flex;flex-direction:column;gap:.125rem;padding:.5rem;border-radius:.75rem;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;z-index:50;background-color:var(--color-surface, oklch(.99 0 0));border:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-nav-desk-dd-item{width:100%;display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-radius:.5rem;font-size:.875rem;font-weight:500;border:none;cursor:pointer;white-space:nowrap;transition:background-color .15s}.rz-nav-desk-dd-item-icon{font-size:.75rem}.rz-nav-mob-panel{position:fixed;left:0;right:0;top:4rem;display:flex;flex-direction:column;gap:.25rem;padding:1rem;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;z-index:50;background-color:var(--color-primary, oklch(.32 .09 258))}@media(min-width:1024px){.rz-nav-mob-panel{display:none}}.rz-nav-mob-item{width:100%;display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-radius:.5rem;font-size:.875rem;font-weight:500;border:none;cursor:pointer;transition:background-color .15s}.rz-nav-mob-item-icon{font-size:.875rem}.rz-nav-mob-item-label{flex:1}.rz-nav-mob-item-chevron{font-size:.75rem;transition:transform .2s}.rz-nav-mob-children{display:flex;flex-direction:column;gap:.125rem;margin-top:.25rem;margin-right:1rem}.rz-nav-mob-child{width:100%;display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-radius:.5rem;font-size:.875rem;border:none;cursor:pointer;transition:background-color .15s}.rz-nav-mob-child-icon{font-size:.75rem}.rz-nav-logout{display:inline-flex;align-items:center;gap:.375rem;padding:.5rem .75rem;border-radius:.5rem;font-size:.875rem;font-weight:500;border:1px solid;white-space:nowrap;cursor:pointer;transition:background-color .15s;flex-shrink:0}.rz-nav-logout-icon{font-size:.875rem}.rz-nav-logout-text{display:none}@media(min-width:640px){.rz-nav-logout-text{display:inline}}.nav-dd-in{animation:rz-nav-dd-in .2s ease-out}.nav-dd-out{animation:rz-nav-dd-out .15s ease-in forwards}.nav-mob-in{animation:rz-nav-mob-in .2s ease-out}.nav-mob-out{animation:rz-nav-mob-out .12s ease-in forwards}@keyframes rz-nav-dd-in{0%{opacity:0;translate:0 -6px}to{opacity:1;translate:0}}@keyframes rz-nav-dd-out{0%{opacity:1;translate:0}to{opacity:0;translate:0 -6px}}@keyframes rz-nav-mob-in{0%{opacity:0;translate:0 -4px}to{opacity:1;translate:0}}@keyframes rz-nav-mob-out{0%{opacity:1;translate:0}to{opacity:0;translate:0 -4px}}\n"] }]
|
|
2111
|
+
}], 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"] }] } });
|
|
2112
|
+
|
|
2113
|
+
class SidebarComponent {
|
|
2114
|
+
_router = inject(Router);
|
|
2115
|
+
_destroyRef = inject(DestroyRef);
|
|
2116
|
+
isOpen = input(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
2117
|
+
isCollapsed = input(false, ...(ngDevMode ? [{ debugName: "isCollapsed" }] : []));
|
|
2118
|
+
items = input([], ...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
2119
|
+
title = input('Menu', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
2120
|
+
width = input('280px', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
2121
|
+
activeId = input(null, ...(ngDevMode ? [{ debugName: "activeId" }] : []));
|
|
2122
|
+
toggleOpen = output();
|
|
2123
|
+
toggleCollapse = output();
|
|
2124
|
+
itemClick = output();
|
|
2125
|
+
logout = output();
|
|
2126
|
+
_expanded = signal(new Set(), ...(ngDevMode ? [{ debugName: "_expanded" }] : []));
|
|
2127
|
+
_currentUrl = signal(this._router.url, ...(ngDevMode ? [{ debugName: "_currentUrl" }] : []));
|
|
2128
|
+
_activeId = computed(() => {
|
|
2129
|
+
if (this.activeId() !== null)
|
|
2130
|
+
return this.activeId();
|
|
2131
|
+
const url = this._currentUrl();
|
|
2132
|
+
for (const item of this.items()) {
|
|
2133
|
+
if (item.route && this._router.isActive(item.route, false))
|
|
2134
|
+
return item.id;
|
|
2135
|
+
if (item.children) {
|
|
2136
|
+
for (const child of item.children) {
|
|
2137
|
+
if (child.route && this._router.isActive(child.route, false))
|
|
2138
|
+
return child.id;
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
return null;
|
|
2143
|
+
}, ...(ngDevMode ? [{ debugName: "_activeId" }] : []));
|
|
2144
|
+
_asideStyle = computed(() => ({
|
|
2145
|
+
width: this.isCollapsed() ? '64px' : this.width(),
|
|
2146
|
+
'background-color': 'var(--color-surface,oklch(0.99 0 0))',
|
|
2147
|
+
}), ...(ngDevMode ? [{ debugName: "_asideStyle" }] : []));
|
|
2148
|
+
constructor() {
|
|
2149
|
+
this._router.events
|
|
2150
|
+
.pipe(filter(e => e instanceof NavigationEnd), takeUntilDestroyed(this._destroyRef))
|
|
2151
|
+
.subscribe(() => this._currentUrl.set(this._router.url));
|
|
2152
|
+
}
|
|
2153
|
+
_isActive(id) { return this._activeId() === id; }
|
|
2154
|
+
_isExpanded(id) { return this._expanded().has(id); }
|
|
2155
|
+
_onItemClick(item) {
|
|
2156
|
+
if (item.children?.length) {
|
|
2157
|
+
this._expanded.update(s => {
|
|
2158
|
+
const n = new Set(s);
|
|
2159
|
+
if (n.has(item.id))
|
|
2160
|
+
n.delete(item.id);
|
|
2161
|
+
else
|
|
2162
|
+
n.add(item.id);
|
|
2163
|
+
return n;
|
|
2164
|
+
});
|
|
2165
|
+
}
|
|
2166
|
+
else {
|
|
2167
|
+
this.itemClick.emit(item);
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
_onBackdrop() { this.toggleOpen.emit(); }
|
|
2171
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SidebarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2172
|
+
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=\"rz-sd-header\"\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=\"rz-sd-collapse-btn\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n >\n <i class=\"pi rz-sd-collapse-icon\"\n [class.pi-th-large]=\"!isCollapsed()\"\n [class.pi-chevron-right]=\"isCollapsed()\"\n ></i>\n </button>\n\n @if (!isCollapsed()) {\n <span class=\"rz-sd-title\">{{ title() }}</span>\n }\n </div>\n\n <nav class=\"rz-sd-nav\">\n <ul class=\"rz-sd-menu\" [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=\"rz-sd-item\"\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=\"rz-sd-item-icon\"></i>\n }\n @if (!isCollapsed()) {\n <span class=\"rz-sd-item-label\">{{ item.label }}</span>\n @if (item.children?.length) {\n <i class=\"pi pi-chevron-down rz-sd-item-chevron\"\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=\"rz-sd-submenu\"\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=\"rz-sd-child\"\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=\"rz-sd-child-dot\"\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=\"rz-sd-footer\"\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=\"rz-sd-logout\"\n [class.rz-sd-logout-center]=\"isCollapsed()\"\n >\n <i class=\"pi pi-sign-out rz-sd-item-icon\"></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-aside.sd-collapsed{width:64px!important}.sd-slide-in{animation:sdSlideDown .2s ease-out}.sd-slide-out{animation:sdSlideUp .15s ease-in forwards}.rz-sd-header{display:flex;align-items:center;justify-content:space-between;flex-shrink:0;padding:0 1rem;height:3.5rem;border-bottom:1px solid}.rz-sd-collapse-btn{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border:none;background:transparent;cursor:pointer;border-radius:.25rem;transition:all .2s}.rz-sd-collapse-btn:hover,.rz-sd-collapse-btn:active{background:var(--color-accent, oklch(.64 .2 50))}.rz-sd-collapse-icon{font-size:.875rem}.rz-sd-collapse-icon:active{scale:.9}.rz-sd-title{font-size:.875rem;font-weight:600;color:var(--color-text, oklch(.14 .01 260))}.sd-close-btn{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border:none;background:transparent;cursor:pointer;border-radius:.25rem;transition:background-color .2s}.sd-close-btn:hover{background:var(--color-surface-alt, oklch(.975 .005 260))}.sd-close-btn i{font-size:.875rem}.rz-sd-nav{flex:1;overflow-y:auto;padding:.75rem}.rz-sd-menu{display:flex;flex-direction:column;gap:.25rem}.rz-sd-item{width:100%;display:flex;align-items:center;gap:.75rem;padding:.625rem .75rem;border-radius:.5rem;transition:all .15s;font-size:.875rem;font-weight:500;border:none;cursor:pointer}.rz-sd-item-icon{font-size:1rem;flex-shrink:0}.rz-sd-item-label{flex:1;text-align:right}.rz-sd-item-chevron{font-size:.75rem;transition:transform .2s}.rz-sd-submenu{margin-top:.25rem;margin-right:1.5rem;display:flex;flex-direction:column;gap:.125rem}.rz-sd-child{width:100%;display:flex;align-items:center;gap:.625rem;padding:.5rem .75rem;border-radius:.5rem;transition:all .15s;font-size:.875rem;border:none;cursor:pointer}.rz-sd-child-dot{width:.375rem;height:.375rem;border-radius:9999px;flex-shrink:0}.rz-sd-footer{flex-shrink:0;padding:.75rem;border-top:1px solid;display:flex;flex-direction:column;gap:.5rem}.rz-sd-logout{width:100%;display:flex;align-items:center;gap:.75rem;padding:.625rem .75rem;border-radius:.5rem;font-size:.875rem;font-weight:500;border:none;cursor:pointer;background-color:var(--color-danger, oklch(.57 .21 25));color:#fff;transition:opacity .2s}.rz-sd-logout:hover{opacity:.85}.rz-sd-logout-center{justify-content:center}@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 });
|
|
2173
|
+
}
|
|
2174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SidebarComponent, decorators: [{
|
|
2175
|
+
type: Component,
|
|
2176
|
+
args: [{ selector: 'app-sidebar', imports: [], host: {
|
|
2177
|
+
'[style.display]': "'contents'",
|
|
2178
|
+
}, 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=\"rz-sd-header\"\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=\"rz-sd-collapse-btn\"\n [style.color]=\"'var(--color-text-muted,oklch(0.48 0.01 260))'\"\n >\n <i class=\"pi rz-sd-collapse-icon\"\n [class.pi-th-large]=\"!isCollapsed()\"\n [class.pi-chevron-right]=\"isCollapsed()\"\n ></i>\n </button>\n\n @if (!isCollapsed()) {\n <span class=\"rz-sd-title\">{{ title() }}</span>\n }\n </div>\n\n <nav class=\"rz-sd-nav\">\n <ul class=\"rz-sd-menu\" [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=\"rz-sd-item\"\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=\"rz-sd-item-icon\"></i>\n }\n @if (!isCollapsed()) {\n <span class=\"rz-sd-item-label\">{{ item.label }}</span>\n @if (item.children?.length) {\n <i class=\"pi pi-chevron-down rz-sd-item-chevron\"\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=\"rz-sd-submenu\"\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=\"rz-sd-child\"\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=\"rz-sd-child-dot\"\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=\"rz-sd-footer\"\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=\"rz-sd-logout\"\n [class.rz-sd-logout-center]=\"isCollapsed()\"\n >\n <i class=\"pi pi-sign-out rz-sd-item-icon\"></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-aside.sd-collapsed{width:64px!important}.sd-slide-in{animation:sdSlideDown .2s ease-out}.sd-slide-out{animation:sdSlideUp .15s ease-in forwards}.rz-sd-header{display:flex;align-items:center;justify-content:space-between;flex-shrink:0;padding:0 1rem;height:3.5rem;border-bottom:1px solid}.rz-sd-collapse-btn{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border:none;background:transparent;cursor:pointer;border-radius:.25rem;transition:all .2s}.rz-sd-collapse-btn:hover,.rz-sd-collapse-btn:active{background:var(--color-accent, oklch(.64 .2 50))}.rz-sd-collapse-icon{font-size:.875rem}.rz-sd-collapse-icon:active{scale:.9}.rz-sd-title{font-size:.875rem;font-weight:600;color:var(--color-text, oklch(.14 .01 260))}.sd-close-btn{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border:none;background:transparent;cursor:pointer;border-radius:.25rem;transition:background-color .2s}.sd-close-btn:hover{background:var(--color-surface-alt, oklch(.975 .005 260))}.sd-close-btn i{font-size:.875rem}.rz-sd-nav{flex:1;overflow-y:auto;padding:.75rem}.rz-sd-menu{display:flex;flex-direction:column;gap:.25rem}.rz-sd-item{width:100%;display:flex;align-items:center;gap:.75rem;padding:.625rem .75rem;border-radius:.5rem;transition:all .15s;font-size:.875rem;font-weight:500;border:none;cursor:pointer}.rz-sd-item-icon{font-size:1rem;flex-shrink:0}.rz-sd-item-label{flex:1;text-align:right}.rz-sd-item-chevron{font-size:.75rem;transition:transform .2s}.rz-sd-submenu{margin-top:.25rem;margin-right:1.5rem;display:flex;flex-direction:column;gap:.125rem}.rz-sd-child{width:100%;display:flex;align-items:center;gap:.625rem;padding:.5rem .75rem;border-radius:.5rem;transition:all .15s;font-size:.875rem;border:none;cursor:pointer}.rz-sd-child-dot{width:.375rem;height:.375rem;border-radius:9999px;flex-shrink:0}.rz-sd-footer{flex-shrink:0;padding:.75rem;border-top:1px solid;display:flex;flex-direction:column;gap:.5rem}.rz-sd-logout{width:100%;display:flex;align-items:center;gap:.75rem;padding:.625rem .75rem;border-radius:.5rem;font-size:.875rem;font-weight:500;border:none;cursor:pointer;background-color:var(--color-danger, oklch(.57 .21 25));color:#fff;transition:opacity .2s}.rz-sd-logout:hover{opacity:.85}.rz-sd-logout-center{justify-content:center}@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"] }]
|
|
2179
|
+
}], 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"] }] } });
|
|
2180
|
+
|
|
2181
|
+
class ConfirmDialogComponent {
|
|
2182
|
+
_closeTimer = null;
|
|
2183
|
+
open = model(false, ...(ngDevMode ? [{ debugName: "open" }] : []));
|
|
2184
|
+
message = input('', ...(ngDevMode ? [{ debugName: "message" }] : []));
|
|
2185
|
+
config = input({}, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
2186
|
+
confirm = output();
|
|
2187
|
+
cancel = output();
|
|
2188
|
+
_title = computed(() => this.config().title ?? 'Confirm', ...(ngDevMode ? [{ debugName: "_title" }] : []));
|
|
2189
|
+
_confirmText = computed(() => this.config().confirmText ?? 'Confirm', ...(ngDevMode ? [{ debugName: "_confirmText" }] : []));
|
|
2190
|
+
_cancelText = computed(() => this.config().cancelText ?? 'Cancel', ...(ngDevMode ? [{ debugName: "_cancelText" }] : []));
|
|
2191
|
+
_icon = computed(() => this.config().icon ?? 'pi pi-question-circle', ...(ngDevMode ? [{ debugName: "_icon" }] : []));
|
|
2192
|
+
_confirmAccent = computed(() => {
|
|
2193
|
+
const a = this.config().confirmAccent;
|
|
2194
|
+
if (a && isThemeColor(a))
|
|
2195
|
+
return a;
|
|
2196
|
+
return 'primary';
|
|
2197
|
+
}, ...(ngDevMode ? [{ debugName: "_confirmAccent" }] : []));
|
|
2198
|
+
_closeOnBackdrop = computed(() => this.config().closeOnBackdrop ?? false, ...(ngDevMode ? [{ debugName: "_closeOnBackdrop" }] : []));
|
|
2199
|
+
_closeOnEscape = computed(() => this.config().closeOnEscape ?? true, ...(ngDevMode ? [{ debugName: "_closeOnEscape" }] : []));
|
|
2200
|
+
_confirmBg = computed(() => {
|
|
2201
|
+
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)' };
|
|
2202
|
+
const key = this._confirmAccent();
|
|
2203
|
+
return `var(--color-${key}, ${fallbacks[key] ?? fallbacks['primary']})`;
|
|
2204
|
+
}, ...(ngDevMode ? [{ debugName: "_confirmBg" }] : []));
|
|
2205
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
2206
|
+
_isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : []));
|
|
2207
|
+
_visible = computed(() => this._isOpen() || this._isClosing(), ...(ngDevMode ? [{ debugName: "_visible" }] : []));
|
|
2208
|
+
constructor() {
|
|
2209
|
+
effect(() => {
|
|
2210
|
+
if (this.open() && !this._isOpen()) {
|
|
2211
|
+
this._isOpen.set(true);
|
|
2212
|
+
this._isClosing.set(false);
|
|
2213
|
+
}
|
|
2214
|
+
else if (!this.open() && this._isOpen()) {
|
|
2215
|
+
this._startClose();
|
|
2216
|
+
}
|
|
2217
|
+
});
|
|
2218
|
+
}
|
|
2219
|
+
_startClose() {
|
|
2220
|
+
if (this._closeTimer)
|
|
2221
|
+
clearTimeout(this._closeTimer);
|
|
2222
|
+
this._isClosing.set(true);
|
|
2223
|
+
this._closeTimer = setTimeout(() => {
|
|
2224
|
+
this._isOpen.set(false);
|
|
2225
|
+
this._isClosing.set(false);
|
|
2226
|
+
this._closeTimer = null;
|
|
2227
|
+
}, 200);
|
|
2228
|
+
}
|
|
2229
|
+
ngOnDestroy() {
|
|
2230
|
+
if (this._closeTimer)
|
|
2231
|
+
clearTimeout(this._closeTimer);
|
|
2232
|
+
}
|
|
2233
|
+
_onConfirm() {
|
|
2234
|
+
this.open.set(false);
|
|
2235
|
+
this.confirm.emit();
|
|
2236
|
+
}
|
|
2237
|
+
_onCancel() {
|
|
2238
|
+
this.open.set(false);
|
|
2239
|
+
this.cancel.emit();
|
|
2240
|
+
}
|
|
2241
|
+
_onBackdropClick() {
|
|
2242
|
+
if (this._closeOnBackdrop()) {
|
|
2243
|
+
this._onCancel();
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
_onEscape(event) {
|
|
2247
|
+
if (this._closeOnEscape() && this._visible()) {
|
|
2248
|
+
event.preventDefault();
|
|
2249
|
+
this._onCancel();
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ConfirmDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2253
|
+
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=\"rz-cfm-backdrop\"\n [class.rz-cfm-backdrop-enter]=\"_isOpen() && !_isClosing()\"\n [class.rz-cfm-backdrop-leave]=\"_isClosing()\"\n (click)=\"_onBackdropClick()\"\n >\n <div\n class=\"rz-cfm-content\"\n [class.rz-cfm-panel-enter]=\"_isOpen() && !_isClosing()\"\n [class.rz-cfm-panel-leave]=\"_isClosing()\"\n (click)=\"$event.stopPropagation()\"\n >\n @if (_title()) {\n <div class=\"rz-cfm-header\">\n <h3 class=\"rz-cfm-title\">{{ _title() }}</h3>\n </div>\n }\n\n <div class=\"rz-cfm-body\">\n @if (_icon()) {\n <i class=\"{{ _icon() }} rz-cfm-icon\"></i>\n }\n <p class=\"rz-cfm-msg\">{{ message() }}</p>\n </div>\n\n <div class=\"rz-cfm-footer\">\n <button\n type=\"button\"\n class=\"rz-cfm-btn rz-cfm-btn-cancel\"\n (click)=\"_onCancel()\"\n >{{ _cancelText() }}</button>\n\n <button\n type=\"button\"\n class=\"rz-cfm-btn rz-cfm-btn-confirm\"\n [style.background-color]=\"_confirmBg()\"\n (click)=\"_onConfirm()\"\n >{{ _confirmText() }}</button>\n </div>\n </div>\n </div>\n}\n", styles: [":host{display:contents}.rz-cfm-backdrop{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;background:var(--color-backdrop, oklch(0 0 0 / .45))}.rz-cfm-backdrop-enter{animation:rz-cfm-backdrop-in .2s ease-out}.rz-cfm-backdrop-leave{animation:rz-cfm-backdrop-out .2s ease-in forwards}.rz-cfm-content{background:var(--color-surface, oklch(.99 0 0));border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:var(--radius-lg, .75rem);box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;width:100%;max-width:24rem;margin-left:1rem;margin-right:1rem;overflow:hidden;color:var(--color-text, oklch(.14 .01 260))}.rz-cfm-panel-enter{animation:rz-cfm-panel-in .2s ease-out}.rz-cfm-panel-leave{animation:rz-cfm-panel-out .18s ease-in forwards}.rz-cfm-header{display:flex;align-items:center;justify-content:space-between;padding:.75rem 1rem;border-bottom:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-cfm-title{font-size:.875rem;font-weight:600}.rz-cfm-body{display:flex;flex-direction:column;align-items:center;gap:.75rem;padding:1.5rem;text-align:center}.rz-cfm-icon{font-size:1.5rem;color:var(--color-primary, oklch(.32 .09 258))}.rz-cfm-msg{font-size:.875rem;color:var(--color-text, oklch(.14 .01 260))}.rz-cfm-footer{display:flex;align-items:center;justify-content:flex-end;gap:.5rem;padding:.75rem 1rem;border-top:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-cfm-btn{padding:.375rem .75rem;font-size:.875rem;border-radius:var(--radius-md, .5rem);cursor:pointer;transition:opacity .15s}.rz-cfm-btn-cancel{border:1px solid var(--color-border, oklch(.83 .015 260));background:transparent;color:var(--color-text, oklch(.14 .01 260))}.rz-cfm-btn-cancel:hover{background:var(--color-surface-alt, oklch(.975 .005 260))}.rz-cfm-btn-confirm{border:none;color:#fff}.rz-cfm-btn-confirm:hover{opacity:.9}@keyframes rz-cfm-backdrop-in{0%{opacity:0}to{opacity:1}}@keyframes rz-cfm-backdrop-out{0%{opacity:1}to{opacity:0}}@keyframes rz-cfm-panel-in{0%{opacity:0;scale:.95;translate:0 8px}to{opacity:1;scale:1;translate:0}}@keyframes rz-cfm-panel-out{0%{opacity:1;scale:1;translate:0}to{opacity:0;scale:.95;translate:0 8px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2254
|
+
}
|
|
2255
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ConfirmDialogComponent, decorators: [{
|
|
2256
|
+
type: Component,
|
|
2257
|
+
args: [{ selector: 'app-confirm-dialog', imports: [], host: {
|
|
2258
|
+
'(document:keydown.escape)': '_onEscape($event)',
|
|
2259
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (_visible()) {\n <div\n class=\"rz-cfm-backdrop\"\n [class.rz-cfm-backdrop-enter]=\"_isOpen() && !_isClosing()\"\n [class.rz-cfm-backdrop-leave]=\"_isClosing()\"\n (click)=\"_onBackdropClick()\"\n >\n <div\n class=\"rz-cfm-content\"\n [class.rz-cfm-panel-enter]=\"_isOpen() && !_isClosing()\"\n [class.rz-cfm-panel-leave]=\"_isClosing()\"\n (click)=\"$event.stopPropagation()\"\n >\n @if (_title()) {\n <div class=\"rz-cfm-header\">\n <h3 class=\"rz-cfm-title\">{{ _title() }}</h3>\n </div>\n }\n\n <div class=\"rz-cfm-body\">\n @if (_icon()) {\n <i class=\"{{ _icon() }} rz-cfm-icon\"></i>\n }\n <p class=\"rz-cfm-msg\">{{ message() }}</p>\n </div>\n\n <div class=\"rz-cfm-footer\">\n <button\n type=\"button\"\n class=\"rz-cfm-btn rz-cfm-btn-cancel\"\n (click)=\"_onCancel()\"\n >{{ _cancelText() }}</button>\n\n <button\n type=\"button\"\n class=\"rz-cfm-btn rz-cfm-btn-confirm\"\n [style.background-color]=\"_confirmBg()\"\n (click)=\"_onConfirm()\"\n >{{ _confirmText() }}</button>\n </div>\n </div>\n </div>\n}\n", styles: [":host{display:contents}.rz-cfm-backdrop{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;background:var(--color-backdrop, oklch(0 0 0 / .45))}.rz-cfm-backdrop-enter{animation:rz-cfm-backdrop-in .2s ease-out}.rz-cfm-backdrop-leave{animation:rz-cfm-backdrop-out .2s ease-in forwards}.rz-cfm-content{background:var(--color-surface, oklch(.99 0 0));border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:var(--radius-lg, .75rem);box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;width:100%;max-width:24rem;margin-left:1rem;margin-right:1rem;overflow:hidden;color:var(--color-text, oklch(.14 .01 260))}.rz-cfm-panel-enter{animation:rz-cfm-panel-in .2s ease-out}.rz-cfm-panel-leave{animation:rz-cfm-panel-out .18s ease-in forwards}.rz-cfm-header{display:flex;align-items:center;justify-content:space-between;padding:.75rem 1rem;border-bottom:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-cfm-title{font-size:.875rem;font-weight:600}.rz-cfm-body{display:flex;flex-direction:column;align-items:center;gap:.75rem;padding:1.5rem;text-align:center}.rz-cfm-icon{font-size:1.5rem;color:var(--color-primary, oklch(.32 .09 258))}.rz-cfm-msg{font-size:.875rem;color:var(--color-text, oklch(.14 .01 260))}.rz-cfm-footer{display:flex;align-items:center;justify-content:flex-end;gap:.5rem;padding:.75rem 1rem;border-top:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-cfm-btn{padding:.375rem .75rem;font-size:.875rem;border-radius:var(--radius-md, .5rem);cursor:pointer;transition:opacity .15s}.rz-cfm-btn-cancel{border:1px solid var(--color-border, oklch(.83 .015 260));background:transparent;color:var(--color-text, oklch(.14 .01 260))}.rz-cfm-btn-cancel:hover{background:var(--color-surface-alt, oklch(.975 .005 260))}.rz-cfm-btn-confirm{border:none;color:#fff}.rz-cfm-btn-confirm:hover{opacity:.9}@keyframes rz-cfm-backdrop-in{0%{opacity:0}to{opacity:1}}@keyframes rz-cfm-backdrop-out{0%{opacity:1}to{opacity:0}}@keyframes rz-cfm-panel-in{0%{opacity:0;scale:.95;translate:0 8px}to{opacity:1;scale:1;translate:0}}@keyframes rz-cfm-panel-out{0%{opacity:1;scale:1;translate:0}to{opacity:0;scale:.95;translate:0 8px}}\n"] }]
|
|
2260
|
+
}], 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"] }] } });
|
|
2261
|
+
|
|
2262
|
+
class ModalComponent {
|
|
2263
|
+
_closeTimer = null;
|
|
2264
|
+
open = model(false, ...(ngDevMode ? [{ debugName: "open" }] : []));
|
|
2265
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
2266
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
2267
|
+
config = input({}, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
2268
|
+
closed = output();
|
|
2269
|
+
_closeOnBackdrop = computed(() => this.config().closeOnBackdrop ?? true, ...(ngDevMode ? [{ debugName: "_closeOnBackdrop" }] : []));
|
|
2270
|
+
_closeOnEscape = computed(() => this.config().closeOnEscape ?? true, ...(ngDevMode ? [{ debugName: "_closeOnEscape" }] : []));
|
|
2271
|
+
_showClose = computed(() => this.config().showCloseButton ?? true, ...(ngDevMode ? [{ debugName: "_showClose" }] : []));
|
|
2272
|
+
_maxWidth = computed(() => this.config().maxWidth ?? '500px', ...(ngDevMode ? [{ debugName: "_maxWidth" }] : []));
|
|
2273
|
+
_width = computed(() => this.width() || this._maxWidth(), ...(ngDevMode ? [{ debugName: "_width" }] : []));
|
|
2274
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
2275
|
+
_isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : []));
|
|
2276
|
+
_visible = computed(() => this._isOpen() || this._isClosing(), ...(ngDevMode ? [{ debugName: "_visible" }] : []));
|
|
2277
|
+
constructor() {
|
|
2278
|
+
effect(() => {
|
|
2279
|
+
if (this.open() && !this._isOpen()) {
|
|
2280
|
+
this._isOpen.set(true);
|
|
2281
|
+
this._isClosing.set(false);
|
|
2282
|
+
}
|
|
2283
|
+
else if (!this.open() && this._isOpen()) {
|
|
2284
|
+
this._startClose();
|
|
2285
|
+
}
|
|
2286
|
+
});
|
|
2287
|
+
}
|
|
2288
|
+
_startClose() {
|
|
2289
|
+
if (this._closeTimer)
|
|
2290
|
+
clearTimeout(this._closeTimer);
|
|
2291
|
+
this._isClosing.set(true);
|
|
2292
|
+
this._closeTimer = setTimeout(() => {
|
|
2293
|
+
this._isOpen.set(false);
|
|
2294
|
+
this._isClosing.set(false);
|
|
2295
|
+
this.closed.emit();
|
|
2296
|
+
this._closeTimer = null;
|
|
2297
|
+
}, 200);
|
|
2298
|
+
}
|
|
2299
|
+
close() {
|
|
2300
|
+
if (this._isOpen()) {
|
|
2301
|
+
this._startClose();
|
|
2302
|
+
}
|
|
2303
|
+
this.open.set(false);
|
|
2304
|
+
}
|
|
2305
|
+
ngOnDestroy() {
|
|
2306
|
+
if (this._closeTimer)
|
|
2307
|
+
clearTimeout(this._closeTimer);
|
|
2308
|
+
}
|
|
2309
|
+
_onBackdropClick(_event) {
|
|
2310
|
+
if (this._closeOnBackdrop()) {
|
|
2311
|
+
this.close();
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
_onEscape(event) {
|
|
2315
|
+
if (this._closeOnEscape() && this._visible()) {
|
|
2316
|
+
event.preventDefault();
|
|
2317
|
+
this.close();
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2321
|
+
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=\"rz-modal-backdrop\"\n [class.rz-modal-backdrop-enter]=\"_isOpen() && !_isClosing()\"\n [class.rz-modal-backdrop-leave]=\"_isClosing()\"\n (click)=\"_onBackdropClick($event)\"\n >\n <div\n class=\"rz-modal-content\"\n [style.max-width]=\"_width()\"\n [class.rz-modal-panel-enter]=\"_isOpen() && !_isClosing()\"\n [class.rz-modal-panel-leave]=\"_isClosing()\"\n (click)=\"$event.stopPropagation()\"\n >\n @if (title() || _showClose()) {\n <div class=\"rz-modal-header\" [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\">\n <h3 class=\"rz-modal-title\">{{ title() }}</h3>\n @if (_showClose()) {\n <button\n type=\"button\"\n class=\"rz-modal-close\"\n (click)=\"close()\"\n aria-label=\"Close\"\n >\n <i class=\"pi pi-times\"></i>\n </button>\n }\n </div>\n }\n\n <div class=\"rz-modal-body\">\n <ng-content />\n </div>\n\n <div class=\"rz-modal-footer\">\n <ng-content select=\"[modal-footer]\" />\n </div>\n </div>\n </div>\n}\n", styles: [":host{display:contents}.rz-modal-backdrop{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;background:var(--color-backdrop, oklch(0 0 0 / .45))}.rz-modal-backdrop-enter{animation:rz-modal-backdrop-in .2s ease-out}.rz-modal-backdrop-leave{animation:rz-modal-backdrop-out .2s ease-in forwards}.rz-modal-content{background:var(--color-surface, oklch(.99 0 0));border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:var(--radius-lg, .75rem);box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;width:100%;margin-left:1rem;margin-right:1rem;overflow:hidden;color:var(--color-text, oklch(.14 .01 260))}.rz-modal-panel-enter{animation:rz-modal-panel-in .2s ease-out}.rz-modal-panel-leave{animation:rz-modal-panel-out .18s ease-in forwards}.rz-modal-header{display:flex;align-items:center;justify-content:space-between;padding:.75rem 1rem}.rz-modal-title{font-size:.875rem;font-weight:600;color:var(--color-primary-inverse, oklch(.99 0 0))}.rz-modal-close{display:flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;padding:0;border:none;border-radius:9999px;background:transparent;color:#fffc;cursor:pointer;transition:background-color .2s}.rz-modal-close:hover{background:#fff3}.rz-modal-close i{font-size:.75rem}.rz-modal-body{padding:1rem}.rz-modal-footer{display:flex;align-items:center;justify-content:flex-end;gap:.5rem;padding:.75rem 1rem;border-top:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-modal-footer:empty{display:none}@keyframes rz-modal-backdrop-in{0%{opacity:0}to{opacity:1}}@keyframes rz-modal-backdrop-out{0%{opacity:1}to{opacity:0}}@keyframes rz-modal-panel-in{0%{opacity:0;scale:.95;translate:0 8px}to{opacity:1;scale:1;translate:0}}@keyframes rz-modal-panel-out{0%{opacity:1;scale:1;translate:0}to{opacity:0;scale:.95;translate:0 8px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2322
|
+
}
|
|
2323
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ModalComponent, decorators: [{
|
|
2324
|
+
type: Component,
|
|
2325
|
+
args: [{ selector: 'app-modal', imports: [], host: {
|
|
2326
|
+
'(document:keydown.escape)': '_onEscape($event)',
|
|
2327
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (_visible()) {\n <div\n class=\"rz-modal-backdrop\"\n [class.rz-modal-backdrop-enter]=\"_isOpen() && !_isClosing()\"\n [class.rz-modal-backdrop-leave]=\"_isClosing()\"\n (click)=\"_onBackdropClick($event)\"\n >\n <div\n class=\"rz-modal-content\"\n [style.max-width]=\"_width()\"\n [class.rz-modal-panel-enter]=\"_isOpen() && !_isClosing()\"\n [class.rz-modal-panel-leave]=\"_isClosing()\"\n (click)=\"$event.stopPropagation()\"\n >\n @if (title() || _showClose()) {\n <div class=\"rz-modal-header\" [style.background-color]=\"'var(--color-primary,oklch(0.32 0.09 258))'\">\n <h3 class=\"rz-modal-title\">{{ title() }}</h3>\n @if (_showClose()) {\n <button\n type=\"button\"\n class=\"rz-modal-close\"\n (click)=\"close()\"\n aria-label=\"Close\"\n >\n <i class=\"pi pi-times\"></i>\n </button>\n }\n </div>\n }\n\n <div class=\"rz-modal-body\">\n <ng-content />\n </div>\n\n <div class=\"rz-modal-footer\">\n <ng-content select=\"[modal-footer]\" />\n </div>\n </div>\n </div>\n}\n", styles: [":host{display:contents}.rz-modal-backdrop{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;background:var(--color-backdrop, oklch(0 0 0 / .45))}.rz-modal-backdrop-enter{animation:rz-modal-backdrop-in .2s ease-out}.rz-modal-backdrop-leave{animation:rz-modal-backdrop-out .2s ease-in forwards}.rz-modal-content{background:var(--color-surface, oklch(.99 0 0));border:1px solid var(--color-border, oklch(.83 .015 260));border-radius:var(--radius-lg, .75rem);box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;width:100%;margin-left:1rem;margin-right:1rem;overflow:hidden;color:var(--color-text, oklch(.14 .01 260))}.rz-modal-panel-enter{animation:rz-modal-panel-in .2s ease-out}.rz-modal-panel-leave{animation:rz-modal-panel-out .18s ease-in forwards}.rz-modal-header{display:flex;align-items:center;justify-content:space-between;padding:.75rem 1rem}.rz-modal-title{font-size:.875rem;font-weight:600;color:var(--color-primary-inverse, oklch(.99 0 0))}.rz-modal-close{display:flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;padding:0;border:none;border-radius:9999px;background:transparent;color:#fffc;cursor:pointer;transition:background-color .2s}.rz-modal-close:hover{background:#fff3}.rz-modal-close i{font-size:.75rem}.rz-modal-body{padding:1rem}.rz-modal-footer{display:flex;align-items:center;justify-content:flex-end;gap:.5rem;padding:.75rem 1rem;border-top:1px solid var(--color-border-light, oklch(.91 .01 260))}.rz-modal-footer:empty{display:none}@keyframes rz-modal-backdrop-in{0%{opacity:0}to{opacity:1}}@keyframes rz-modal-backdrop-out{0%{opacity:1}to{opacity:0}}@keyframes rz-modal-panel-in{0%{opacity:0;scale:.95;translate:0 8px}to{opacity:1;scale:1;translate:0}}@keyframes rz-modal-panel-out{0%{opacity:1;scale:1;translate:0}to{opacity:0;scale:.95;translate:0 8px}}\n"] }]
|
|
2328
|
+
}], 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"] }] } });
|
|
2329
|
+
|
|
2330
|
+
// Form
|
|
2331
|
+
|
|
2332
|
+
/**
|
|
2333
|
+
* Generated bundle index. Do not edit.
|
|
2334
|
+
*/
|
|
2335
|
+
|
|
2336
|
+
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 };
|
|
2337
|
+
//# sourceMappingURL=ryzen-ui.mjs.map
|