ngx-core-components 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/barcodes/barcode/barcode.component.d.ts +19 -0
- package/barcodes/index.d.ts +5 -0
- package/barcodes/public-api.d.ts +2 -0
- package/barcodes/qr-code/qr-code.component.d.ts +17 -0
- package/buttons/button/button.component.d.ts +17 -0
- package/buttons/button-group/button-group.component.d.ts +8 -0
- package/buttons/chip/chip.component.d.ts +19 -0
- package/buttons/dropdown-button/dropdown-button.component.d.ts +21 -0
- package/buttons/index.d.ts +5 -0
- package/buttons/public-api.d.ts +9 -0
- package/buttons/split-button/split-button.component.d.ts +22 -0
- package/charts/index.d.ts +5 -0
- package/charts/public-api.d.ts +11 -0
- package/dialog/dialog-container.component.d.ts +24 -0
- package/dialog/dialog.service.d.ts +37 -0
- package/dialog/index.d.ts +5 -0
- package/dialog/public-api.d.ts +3 -0
- package/feedback/badge/badge.component.d.ts +13 -0
- package/feedback/index.d.ts +5 -0
- package/feedback/notification/notification.service.d.ts +39 -0
- package/feedback/progress-bar/progress-bar.component.d.ts +15 -0
- package/feedback/public-api.d.ts +8 -0
- package/feedback/skeleton/skeleton.component.d.ts +11 -0
- package/fesm2022/ngx-core-components-barcodes.mjs +222 -0
- package/fesm2022/ngx-core-components-barcodes.mjs.map +1 -0
- package/fesm2022/ngx-core-components-buttons.mjs +255 -0
- package/fesm2022/ngx-core-components-buttons.mjs.map +1 -0
- package/fesm2022/ngx-core-components-charts.mjs +2313 -0
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -0
- package/fesm2022/ngx-core-components-dialog.mjs +168 -0
- package/fesm2022/ngx-core-components-dialog.mjs.map +1 -0
- package/fesm2022/ngx-core-components-feedback.mjs +286 -0
- package/fesm2022/ngx-core-components-feedback.mjs.map +1 -0
- package/fesm2022/ngx-core-components-grid.mjs +335 -0
- package/fesm2022/ngx-core-components-grid.mjs.map +1 -0
- package/fesm2022/ngx-core-components-inputs.mjs +1953 -0
- package/fesm2022/ngx-core-components-inputs.mjs.map +1 -0
- package/fesm2022/ngx-core-components-layout.mjs +407 -0
- package/fesm2022/ngx-core-components-layout.mjs.map +1 -0
- package/fesm2022/ngx-core-components-navigation.mjs +184 -0
- package/fesm2022/ngx-core-components-navigation.mjs.map +1 -0
- package/fesm2022/ngx-core-components-views.mjs +357 -0
- package/fesm2022/ngx-core-components-views.mjs.map +1 -0
- package/fesm2022/ngx-core-components.mjs +16 -3689
- package/fesm2022/ngx-core-components.mjs.map +1 -1
- package/grid/index.d.ts +5 -0
- package/grid/public-api.d.ts +2 -0
- package/inputs/autocomplete/autocomplete.component.d.ts +35 -0
- package/inputs/checkbox/checkbox.component.d.ts +21 -0
- package/inputs/color-picker/color-picker.component.d.ts +14 -0
- package/{lib/inputs → inputs}/date-picker/date-picker.component.d.ts +11 -1
- package/inputs/date-range-picker/date-range-picker.component.d.ts +24 -0
- package/{lib/inputs → inputs}/dropdown/dropdown.component.d.ts +11 -1
- package/inputs/index.d.ts +5 -0
- package/{lib/inputs → inputs}/multi-select/multi-select.component.d.ts +11 -1
- package/inputs/numeric-textbox/numeric-textbox.component.d.ts +19 -0
- package/inputs/public-api.d.ts +17 -0
- package/inputs/radio/radio-group.component.d.ts +28 -0
- package/inputs/rating/rating.component.d.ts +14 -0
- package/inputs/slider/slider.component.d.ts +26 -0
- package/inputs/switch/switch.component.d.ts +12 -0
- package/inputs/textarea/textarea.component.d.ts +18 -0
- package/{lib/inputs → inputs}/textbox/textbox.component.d.ts +12 -1
- package/inputs/time-picker/time-picker.component.d.ts +20 -0
- package/layout/accordion/accordion.component.d.ts +17 -0
- package/layout/card/card.component.d.ts +16 -0
- package/layout/index.d.ts +5 -0
- package/layout/public-api.d.ts +8 -0
- package/layout/splitter/splitter.component.d.ts +14 -0
- package/layout/stepper/stepper.component.d.ts +20 -0
- package/layout/tab-strip/tab-strip.component.d.ts +22 -0
- package/lib/tooltip/popover.component.d.ts +1 -1
- package/navigation/breadcrumb/breadcrumb.component.d.ts +14 -0
- package/navigation/index.d.ts +5 -0
- package/navigation/menu/menu.component.d.ts +20 -0
- package/navigation/public-api.d.ts +4 -0
- package/package.json +41 -1
- package/public-api.d.ts +39 -22
- package/views/index.d.ts +5 -0
- package/views/public-api.d.ts +4 -0
- /package/{lib/charts → charts}/bar-chart/bar-chart.component.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/gantt-chart.component.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/models/gantt-config.model.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/models/gantt-dependency.model.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/models/gantt-event.model.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/models/gantt-task.model.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/models/index.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/services/gantt-keyboard.service.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/services/gantt-layout.service.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/services/gantt-scale.service.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/utils/date-utils.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/utils/svg-utils.d.ts +0 -0
- /package/{lib/charts → charts}/line-chart/line-chart.component.d.ts +0 -0
- /package/{lib/charts → charts}/pie-chart/pie-chart.component.d.ts +0 -0
- /package/{lib/charts → charts}/shared/chart-utils.d.ts +0 -0
- /package/{lib/charts → charts}/sparkline/sparkline.component.d.ts +0 -0
- /package/{lib → grid}/data-grid/data-grid.component.d.ts +0 -0
- /package/{lib → views}/list-view/list-view.component.d.ts +0 -0
- /package/{lib → views}/tree-view/tree-view.component.d.ts +0 -0
|
@@ -0,0 +1,1953 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, signal, computed, forwardRef, ChangeDetectionStrategy, Component, inject, ElementRef, HostListener } from '@angular/core';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
|
|
5
|
+
class TextBoxComponent {
|
|
6
|
+
value = input('');
|
|
7
|
+
label = input('');
|
|
8
|
+
placeholder = input('');
|
|
9
|
+
type = input('text');
|
|
10
|
+
disabled = input(false);
|
|
11
|
+
readonly = input(false);
|
|
12
|
+
error = input('');
|
|
13
|
+
hint = input('');
|
|
14
|
+
valueChange = output();
|
|
15
|
+
focusChange = output();
|
|
16
|
+
isFocused = signal(false);
|
|
17
|
+
_cvaValue = signal('');
|
|
18
|
+
_cvaActive = false;
|
|
19
|
+
_onChange = () => { };
|
|
20
|
+
_onTouched = () => { };
|
|
21
|
+
/** Merges reactive-form value (CVA) with template binding (input()). CVA takes precedence. */
|
|
22
|
+
_displayValue = computed(() => this._cvaActive ? this._cvaValue() : this.value());
|
|
23
|
+
onInput(e) {
|
|
24
|
+
const v = e.target.value;
|
|
25
|
+
this._cvaValue.set(v);
|
|
26
|
+
this._onChange(v);
|
|
27
|
+
this.valueChange.emit(v);
|
|
28
|
+
}
|
|
29
|
+
onFocus() {
|
|
30
|
+
this.isFocused.set(true);
|
|
31
|
+
this.focusChange.emit(true);
|
|
32
|
+
}
|
|
33
|
+
onBlur() {
|
|
34
|
+
this.isFocused.set(false);
|
|
35
|
+
this.focusChange.emit(false);
|
|
36
|
+
this._onTouched();
|
|
37
|
+
}
|
|
38
|
+
// ControlValueAccessor
|
|
39
|
+
writeValue(val) {
|
|
40
|
+
this._cvaActive = true;
|
|
41
|
+
this._cvaValue.set(val ?? '');
|
|
42
|
+
}
|
|
43
|
+
registerOnChange(fn) {
|
|
44
|
+
this._onChange = fn;
|
|
45
|
+
}
|
|
46
|
+
registerOnTouched(fn) {
|
|
47
|
+
this._onTouched = fn;
|
|
48
|
+
}
|
|
49
|
+
setDisabledState(_isDisabled) {
|
|
50
|
+
// disabled is controlled via input() for template usage;
|
|
51
|
+
// reactive-form disable/enable is handled at the FormControl level.
|
|
52
|
+
}
|
|
53
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TextBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
54
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: TextBoxComponent, isStandalone: true, selector: "ngx-textbox", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", focusChange: "focusChange" }, providers: [
|
|
55
|
+
{
|
|
56
|
+
provide: NG_VALUE_ACCESSOR,
|
|
57
|
+
useExisting: forwardRef(() => TextBoxComponent),
|
|
58
|
+
multi: true,
|
|
59
|
+
},
|
|
60
|
+
], ngImport: i0, template: `
|
|
61
|
+
<div class="ngx-textbox" [class.focused]="isFocused()" [class.has-error]="!!error()" [class.disabled]="disabled()">
|
|
62
|
+
@if (label()) {
|
|
63
|
+
<label class="ngx-textbox-label" [class.floating]="isFocused() || !!_displayValue()">{{ label() }}</label>
|
|
64
|
+
}
|
|
65
|
+
<div class="ngx-textbox-wrap">
|
|
66
|
+
<input
|
|
67
|
+
class="ngx-textbox-input"
|
|
68
|
+
[type]="type()"
|
|
69
|
+
[value]="_displayValue()"
|
|
70
|
+
[placeholder]="isFocused() || !label() ? placeholder() : ''"
|
|
71
|
+
[disabled]="disabled()"
|
|
72
|
+
[readOnly]="readonly()"
|
|
73
|
+
[attr.aria-invalid]="!!error()"
|
|
74
|
+
(input)="onInput($event)"
|
|
75
|
+
(focus)="onFocus()"
|
|
76
|
+
(blur)="onBlur()"
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
@if (error()) {
|
|
80
|
+
<div class="ngx-textbox-error">{{ error() }}</div>
|
|
81
|
+
} @else if (hint()) {
|
|
82
|
+
<div class="ngx-textbox-hint">{{ hint() }}</div>
|
|
83
|
+
}
|
|
84
|
+
</div>
|
|
85
|
+
`, isInline: true, styles: [":host{display:block}.ngx-textbox{position:relative;font-family:inherit}.ngx-textbox-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500;transition:all .15s}.ngx-textbox-wrap{position:relative;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);transition:border-color .15s,box-shadow .15s}.focused .ngx-textbox-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.has-error .ngx-textbox-wrap{border-color:var(--ngx-input-error, #e74c3c)}.has-error.focused .ngx-textbox-wrap{box-shadow:0 0 0 2px #e74c3c2e}.disabled .ngx-textbox-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed}.ngx-textbox-input{display:block;width:100%;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);font-family:inherit}.ngx-textbox-input:disabled{cursor:not-allowed;color:#adb5bd}.ngx-textbox-error{font-size:12px;color:var(--ngx-input-error, #e74c3c);margin-top:4px}.ngx-textbox-hint{font-size:12px;color:var(--ngx-input-label, #6c757d);margin-top:4px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
86
|
+
}
|
|
87
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TextBoxComponent, decorators: [{
|
|
88
|
+
type: Component,
|
|
89
|
+
args: [{ selector: 'ngx-textbox', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
90
|
+
{
|
|
91
|
+
provide: NG_VALUE_ACCESSOR,
|
|
92
|
+
useExisting: forwardRef(() => TextBoxComponent),
|
|
93
|
+
multi: true,
|
|
94
|
+
},
|
|
95
|
+
], template: `
|
|
96
|
+
<div class="ngx-textbox" [class.focused]="isFocused()" [class.has-error]="!!error()" [class.disabled]="disabled()">
|
|
97
|
+
@if (label()) {
|
|
98
|
+
<label class="ngx-textbox-label" [class.floating]="isFocused() || !!_displayValue()">{{ label() }}</label>
|
|
99
|
+
}
|
|
100
|
+
<div class="ngx-textbox-wrap">
|
|
101
|
+
<input
|
|
102
|
+
class="ngx-textbox-input"
|
|
103
|
+
[type]="type()"
|
|
104
|
+
[value]="_displayValue()"
|
|
105
|
+
[placeholder]="isFocused() || !label() ? placeholder() : ''"
|
|
106
|
+
[disabled]="disabled()"
|
|
107
|
+
[readOnly]="readonly()"
|
|
108
|
+
[attr.aria-invalid]="!!error()"
|
|
109
|
+
(input)="onInput($event)"
|
|
110
|
+
(focus)="onFocus()"
|
|
111
|
+
(blur)="onBlur()"
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
@if (error()) {
|
|
115
|
+
<div class="ngx-textbox-error">{{ error() }}</div>
|
|
116
|
+
} @else if (hint()) {
|
|
117
|
+
<div class="ngx-textbox-hint">{{ hint() }}</div>
|
|
118
|
+
}
|
|
119
|
+
</div>
|
|
120
|
+
`, styles: [":host{display:block}.ngx-textbox{position:relative;font-family:inherit}.ngx-textbox-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500;transition:all .15s}.ngx-textbox-wrap{position:relative;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);transition:border-color .15s,box-shadow .15s}.focused .ngx-textbox-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.has-error .ngx-textbox-wrap{border-color:var(--ngx-input-error, #e74c3c)}.has-error.focused .ngx-textbox-wrap{box-shadow:0 0 0 2px #e74c3c2e}.disabled .ngx-textbox-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed}.ngx-textbox-input{display:block;width:100%;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);font-family:inherit}.ngx-textbox-input:disabled{cursor:not-allowed;color:#adb5bd}.ngx-textbox-error{font-size:12px;color:var(--ngx-input-error, #e74c3c);margin-top:4px}.ngx-textbox-hint{font-size:12px;color:var(--ngx-input-label, #6c757d);margin-top:4px}\n"] }]
|
|
121
|
+
}] });
|
|
122
|
+
|
|
123
|
+
class CheckboxComponent {
|
|
124
|
+
label = input('');
|
|
125
|
+
checked = input(false);
|
|
126
|
+
disabled = input(false);
|
|
127
|
+
indeterminate = input(false);
|
|
128
|
+
checkedChange = output();
|
|
129
|
+
_checked = signal(false);
|
|
130
|
+
_cvaActive = false;
|
|
131
|
+
_onChange = () => { };
|
|
132
|
+
_onTouched = () => { };
|
|
133
|
+
_displayChecked = computed(() => this._cvaActive ? this._checked() : this.checked());
|
|
134
|
+
toggle() {
|
|
135
|
+
if (this.disabled())
|
|
136
|
+
return;
|
|
137
|
+
const next = !this._displayChecked();
|
|
138
|
+
this._checked.set(next);
|
|
139
|
+
this._onChange(next);
|
|
140
|
+
this._onTouched();
|
|
141
|
+
this.checkedChange.emit(next);
|
|
142
|
+
}
|
|
143
|
+
// ControlValueAccessor
|
|
144
|
+
writeValue(val) {
|
|
145
|
+
this._cvaActive = true;
|
|
146
|
+
this._checked.set(!!val);
|
|
147
|
+
}
|
|
148
|
+
registerOnChange(fn) {
|
|
149
|
+
this._onChange = fn;
|
|
150
|
+
}
|
|
151
|
+
registerOnTouched(fn) {
|
|
152
|
+
this._onTouched = fn;
|
|
153
|
+
}
|
|
154
|
+
setDisabledState(_isDisabled) {
|
|
155
|
+
// disabled handled via input()
|
|
156
|
+
}
|
|
157
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
158
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: CheckboxComponent, isStandalone: true, selector: "ngx-checkbox", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange" }, providers: [
|
|
159
|
+
{
|
|
160
|
+
provide: NG_VALUE_ACCESSOR,
|
|
161
|
+
useExisting: forwardRef(() => CheckboxComponent),
|
|
162
|
+
multi: true,
|
|
163
|
+
},
|
|
164
|
+
], ngImport: i0, template: `
|
|
165
|
+
<label class="ngx-checkbox" [class.disabled]="disabled()">
|
|
166
|
+
<span class="ngx-checkbox-box" [class.checked]="_displayChecked()" [class.indeterminate]="indeterminate()" (click)="toggle()">
|
|
167
|
+
@if (_displayChecked()) {
|
|
168
|
+
<svg class="ngx-checkbox-icon" viewBox="0 0 12 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
169
|
+
<path d="M1 5L4.5 8.5L11 1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
170
|
+
</svg>
|
|
171
|
+
} @else if (indeterminate()) {
|
|
172
|
+
<span class="ngx-checkbox-dash"></span>
|
|
173
|
+
}
|
|
174
|
+
</span>
|
|
175
|
+
@if (label()) {
|
|
176
|
+
<span class="ngx-checkbox-label">{{ label() }}</span>
|
|
177
|
+
}
|
|
178
|
+
</label>
|
|
179
|
+
`, isInline: true, styles: [":host{display:inline-block}.ngx-checkbox{display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none;font-family:inherit}.ngx-checkbox.disabled{cursor:not-allowed;opacity:.55}.ngx-checkbox-box{width:18px;height:18px;flex-shrink:0;border:2px solid var(--ngx-checkbox-border, #ced4da);border-radius:var(--ngx-checkbox-radius, 3px);background:var(--ngx-checkbox-bg, #fff);display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s}.ngx-checkbox-box.checked,.ngx-checkbox-box.indeterminate{background:var(--ngx-checkbox-active, #4a90d9);border-color:var(--ngx-checkbox-active, #4a90d9);color:#fff}.ngx-checkbox-icon{width:12px;height:10px}.ngx-checkbox-dash{width:8px;height:2px;background:#fff;border-radius:1px}.ngx-checkbox-label{font-size:14px;color:var(--ngx-input-text, #212529)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
180
|
+
}
|
|
181
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
182
|
+
type: Component,
|
|
183
|
+
args: [{ selector: 'ngx-checkbox', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
184
|
+
{
|
|
185
|
+
provide: NG_VALUE_ACCESSOR,
|
|
186
|
+
useExisting: forwardRef(() => CheckboxComponent),
|
|
187
|
+
multi: true,
|
|
188
|
+
},
|
|
189
|
+
], template: `
|
|
190
|
+
<label class="ngx-checkbox" [class.disabled]="disabled()">
|
|
191
|
+
<span class="ngx-checkbox-box" [class.checked]="_displayChecked()" [class.indeterminate]="indeterminate()" (click)="toggle()">
|
|
192
|
+
@if (_displayChecked()) {
|
|
193
|
+
<svg class="ngx-checkbox-icon" viewBox="0 0 12 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
194
|
+
<path d="M1 5L4.5 8.5L11 1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
195
|
+
</svg>
|
|
196
|
+
} @else if (indeterminate()) {
|
|
197
|
+
<span class="ngx-checkbox-dash"></span>
|
|
198
|
+
}
|
|
199
|
+
</span>
|
|
200
|
+
@if (label()) {
|
|
201
|
+
<span class="ngx-checkbox-label">{{ label() }}</span>
|
|
202
|
+
}
|
|
203
|
+
</label>
|
|
204
|
+
`, styles: [":host{display:inline-block}.ngx-checkbox{display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none;font-family:inherit}.ngx-checkbox.disabled{cursor:not-allowed;opacity:.55}.ngx-checkbox-box{width:18px;height:18px;flex-shrink:0;border:2px solid var(--ngx-checkbox-border, #ced4da);border-radius:var(--ngx-checkbox-radius, 3px);background:var(--ngx-checkbox-bg, #fff);display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s}.ngx-checkbox-box.checked,.ngx-checkbox-box.indeterminate{background:var(--ngx-checkbox-active, #4a90d9);border-color:var(--ngx-checkbox-active, #4a90d9);color:#fff}.ngx-checkbox-icon{width:12px;height:10px}.ngx-checkbox-dash{width:8px;height:2px;background:#fff;border-radius:1px}.ngx-checkbox-label{font-size:14px;color:var(--ngx-input-text, #212529)}\n"] }]
|
|
205
|
+
}] });
|
|
206
|
+
|
|
207
|
+
class RadioGroupComponent {
|
|
208
|
+
options = input([]);
|
|
209
|
+
label = input('');
|
|
210
|
+
value = input(null);
|
|
211
|
+
disabled = input(false);
|
|
212
|
+
inline = input(false);
|
|
213
|
+
valueChange = output();
|
|
214
|
+
_value = signal(null);
|
|
215
|
+
_cvaActive = false;
|
|
216
|
+
_onChange = () => { };
|
|
217
|
+
_onTouched = () => { };
|
|
218
|
+
_activeValue = computed(() => this._cvaActive ? this._value() : this.value());
|
|
219
|
+
isChecked(val) {
|
|
220
|
+
return this._activeValue() === val;
|
|
221
|
+
}
|
|
222
|
+
select(opt) {
|
|
223
|
+
if (this.disabled() || opt.disabled)
|
|
224
|
+
return;
|
|
225
|
+
this._value.set(opt.value);
|
|
226
|
+
this._onChange(opt.value);
|
|
227
|
+
this._onTouched();
|
|
228
|
+
this.valueChange.emit(opt.value);
|
|
229
|
+
}
|
|
230
|
+
// ControlValueAccessor
|
|
231
|
+
writeValue(val) {
|
|
232
|
+
this._cvaActive = true;
|
|
233
|
+
this._value.set(val ?? null);
|
|
234
|
+
}
|
|
235
|
+
registerOnChange(fn) {
|
|
236
|
+
this._onChange = fn;
|
|
237
|
+
}
|
|
238
|
+
registerOnTouched(fn) {
|
|
239
|
+
this._onTouched = fn;
|
|
240
|
+
}
|
|
241
|
+
setDisabledState(_isDisabled) {
|
|
242
|
+
// disabled handled via input()
|
|
243
|
+
}
|
|
244
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: RadioGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
245
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: RadioGroupComponent, isStandalone: true, selector: "ngx-radio-group", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, providers: [
|
|
246
|
+
{
|
|
247
|
+
provide: NG_VALUE_ACCESSOR,
|
|
248
|
+
useExisting: forwardRef(() => RadioGroupComponent),
|
|
249
|
+
multi: true,
|
|
250
|
+
},
|
|
251
|
+
], ngImport: i0, template: `
|
|
252
|
+
<div
|
|
253
|
+
class="ngx-radio-group"
|
|
254
|
+
[class.inline]="inline()"
|
|
255
|
+
role="radiogroup"
|
|
256
|
+
[attr.aria-label]="label()"
|
|
257
|
+
>
|
|
258
|
+
@if (label()) {
|
|
259
|
+
<span class="ngx-radio-group-label">{{ label() }}</span>
|
|
260
|
+
}
|
|
261
|
+
@for (opt of options(); track opt.value) {
|
|
262
|
+
<label
|
|
263
|
+
class="ngx-radio"
|
|
264
|
+
[class.disabled]="disabled() || !!opt.disabled"
|
|
265
|
+
[class.checked]="isChecked(opt.value)"
|
|
266
|
+
>
|
|
267
|
+
<span
|
|
268
|
+
class="ngx-radio-btn"
|
|
269
|
+
[class.checked]="isChecked(opt.value)"
|
|
270
|
+
(click)="select(opt)"
|
|
271
|
+
role="radio"
|
|
272
|
+
[attr.aria-checked]="isChecked(opt.value)"
|
|
273
|
+
tabindex="0"
|
|
274
|
+
(keydown.enter)="select(opt)"
|
|
275
|
+
(keydown.space)="select(opt)"
|
|
276
|
+
>
|
|
277
|
+
<span class="ngx-radio-dot" [class.visible]="isChecked(opt.value)"></span>
|
|
278
|
+
</span>
|
|
279
|
+
<span class="ngx-radio-label">{{ opt.label }}</span>
|
|
280
|
+
</label>
|
|
281
|
+
}
|
|
282
|
+
</div>
|
|
283
|
+
`, isInline: true, styles: [":host{display:block}.ngx-radio-group{display:flex;flex-direction:column;gap:8px;font-family:inherit}.ngx-radio-group.inline{flex-direction:row;flex-wrap:wrap;gap:16px}.ngx-radio-group-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);font-weight:500;margin-bottom:4px}.ngx-radio{display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none}.ngx-radio.disabled{cursor:not-allowed;opacity:.55}.ngx-radio-btn{width:18px;height:18px;flex-shrink:0;border:2px solid var(--ngx-radio-border, #ced4da);border-radius:50%;background:var(--ngx-radio-bg, #fff);display:flex;align-items:center;justify-content:center;transition:border-color .15s;outline:none}.ngx-radio-btn.checked{border-color:var(--ngx-radio-active, #4a90d9)}.ngx-radio-btn:focus-visible{box-shadow:0 0 0 2px #4a90d959}.ngx-radio-dot{width:8px;height:8px;border-radius:50%;background:var(--ngx-radio-active, #4a90d9);opacity:0;transform:scale(.5);transition:opacity .15s,transform .15s}.ngx-radio-dot.visible{opacity:1;transform:scale(1)}.ngx-radio-label{font-size:14px;color:var(--ngx-input-text, #212529)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
284
|
+
}
|
|
285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: RadioGroupComponent, decorators: [{
|
|
286
|
+
type: Component,
|
|
287
|
+
args: [{ selector: 'ngx-radio-group', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
288
|
+
{
|
|
289
|
+
provide: NG_VALUE_ACCESSOR,
|
|
290
|
+
useExisting: forwardRef(() => RadioGroupComponent),
|
|
291
|
+
multi: true,
|
|
292
|
+
},
|
|
293
|
+
], template: `
|
|
294
|
+
<div
|
|
295
|
+
class="ngx-radio-group"
|
|
296
|
+
[class.inline]="inline()"
|
|
297
|
+
role="radiogroup"
|
|
298
|
+
[attr.aria-label]="label()"
|
|
299
|
+
>
|
|
300
|
+
@if (label()) {
|
|
301
|
+
<span class="ngx-radio-group-label">{{ label() }}</span>
|
|
302
|
+
}
|
|
303
|
+
@for (opt of options(); track opt.value) {
|
|
304
|
+
<label
|
|
305
|
+
class="ngx-radio"
|
|
306
|
+
[class.disabled]="disabled() || !!opt.disabled"
|
|
307
|
+
[class.checked]="isChecked(opt.value)"
|
|
308
|
+
>
|
|
309
|
+
<span
|
|
310
|
+
class="ngx-radio-btn"
|
|
311
|
+
[class.checked]="isChecked(opt.value)"
|
|
312
|
+
(click)="select(opt)"
|
|
313
|
+
role="radio"
|
|
314
|
+
[attr.aria-checked]="isChecked(opt.value)"
|
|
315
|
+
tabindex="0"
|
|
316
|
+
(keydown.enter)="select(opt)"
|
|
317
|
+
(keydown.space)="select(opt)"
|
|
318
|
+
>
|
|
319
|
+
<span class="ngx-radio-dot" [class.visible]="isChecked(opt.value)"></span>
|
|
320
|
+
</span>
|
|
321
|
+
<span class="ngx-radio-label">{{ opt.label }}</span>
|
|
322
|
+
</label>
|
|
323
|
+
}
|
|
324
|
+
</div>
|
|
325
|
+
`, styles: [":host{display:block}.ngx-radio-group{display:flex;flex-direction:column;gap:8px;font-family:inherit}.ngx-radio-group.inline{flex-direction:row;flex-wrap:wrap;gap:16px}.ngx-radio-group-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);font-weight:500;margin-bottom:4px}.ngx-radio{display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none}.ngx-radio.disabled{cursor:not-allowed;opacity:.55}.ngx-radio-btn{width:18px;height:18px;flex-shrink:0;border:2px solid var(--ngx-radio-border, #ced4da);border-radius:50%;background:var(--ngx-radio-bg, #fff);display:flex;align-items:center;justify-content:center;transition:border-color .15s;outline:none}.ngx-radio-btn.checked{border-color:var(--ngx-radio-active, #4a90d9)}.ngx-radio-btn:focus-visible{box-shadow:0 0 0 2px #4a90d959}.ngx-radio-dot{width:8px;height:8px;border-radius:50%;background:var(--ngx-radio-active, #4a90d9);opacity:0;transform:scale(.5);transition:opacity .15s,transform .15s}.ngx-radio-dot.visible{opacity:1;transform:scale(1)}.ngx-radio-label{font-size:14px;color:var(--ngx-input-text, #212529)}\n"] }]
|
|
326
|
+
}] });
|
|
327
|
+
|
|
328
|
+
class DropdownComponent {
|
|
329
|
+
options = input([]);
|
|
330
|
+
value = input(null);
|
|
331
|
+
label = input('');
|
|
332
|
+
placeholder = input('Select...');
|
|
333
|
+
disabled = input(false);
|
|
334
|
+
filterable = input(false);
|
|
335
|
+
valueChange = output();
|
|
336
|
+
isOpen = signal(false);
|
|
337
|
+
filterText = signal('');
|
|
338
|
+
focusedIndex = signal(-1);
|
|
339
|
+
_cvaValue = signal(null);
|
|
340
|
+
_cvaActive = false;
|
|
341
|
+
_onChange = () => { };
|
|
342
|
+
_onTouched = () => { };
|
|
343
|
+
el = inject(ElementRef);
|
|
344
|
+
_activeValue = computed(() => this._cvaActive ? this._cvaValue() : this.value());
|
|
345
|
+
selectedLabel = computed(() => {
|
|
346
|
+
const opt = this.options().find(o => o.value === this._activeValue());
|
|
347
|
+
return opt?.label ?? '';
|
|
348
|
+
});
|
|
349
|
+
filteredOptions = computed(() => {
|
|
350
|
+
const f = this.filterText().toLowerCase();
|
|
351
|
+
return f ? this.options().filter(o => o.label.toLowerCase().includes(f)) : this.options();
|
|
352
|
+
});
|
|
353
|
+
isSelected(opt) { return opt.value === this._activeValue(); }
|
|
354
|
+
toggle() {
|
|
355
|
+
if (this.disabled())
|
|
356
|
+
return;
|
|
357
|
+
this.isOpen.update(v => !v);
|
|
358
|
+
if (!this.isOpen())
|
|
359
|
+
this.filterText.set('');
|
|
360
|
+
}
|
|
361
|
+
selectOption(opt) {
|
|
362
|
+
if (opt.disabled)
|
|
363
|
+
return;
|
|
364
|
+
this._cvaValue.set(opt.value);
|
|
365
|
+
this._onChange(opt.value);
|
|
366
|
+
this._onTouched();
|
|
367
|
+
this.valueChange.emit(opt.value);
|
|
368
|
+
this.isOpen.set(false);
|
|
369
|
+
this.filterText.set('');
|
|
370
|
+
}
|
|
371
|
+
onTriggerKey(e) {
|
|
372
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
373
|
+
e.preventDefault();
|
|
374
|
+
this.toggle();
|
|
375
|
+
}
|
|
376
|
+
if (e.key === 'Escape')
|
|
377
|
+
this.isOpen.set(false);
|
|
378
|
+
if (e.key === 'ArrowDown') {
|
|
379
|
+
e.preventDefault();
|
|
380
|
+
if (!this.isOpen())
|
|
381
|
+
this.isOpen.set(true);
|
|
382
|
+
else
|
|
383
|
+
this.moveFocus(1);
|
|
384
|
+
}
|
|
385
|
+
if (e.key === 'ArrowUp') {
|
|
386
|
+
e.preventDefault();
|
|
387
|
+
this.moveFocus(-1);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
onFilterKey(e) {
|
|
391
|
+
if (e.key === 'ArrowDown') {
|
|
392
|
+
e.preventDefault();
|
|
393
|
+
this.moveFocus(1);
|
|
394
|
+
}
|
|
395
|
+
if (e.key === 'ArrowUp') {
|
|
396
|
+
e.preventDefault();
|
|
397
|
+
this.moveFocus(-1);
|
|
398
|
+
}
|
|
399
|
+
if (e.key === 'Enter') {
|
|
400
|
+
const opts = this.filteredOptions();
|
|
401
|
+
const i = this.focusedIndex();
|
|
402
|
+
if (i >= 0 && i < opts.length)
|
|
403
|
+
this.selectOption(opts[i]);
|
|
404
|
+
}
|
|
405
|
+
if (e.key === 'Escape')
|
|
406
|
+
this.isOpen.set(false);
|
|
407
|
+
}
|
|
408
|
+
moveFocus(delta) {
|
|
409
|
+
const n = this.filteredOptions().length;
|
|
410
|
+
this.focusedIndex.update(i => Math.max(0, Math.min(n - 1, i + delta)));
|
|
411
|
+
}
|
|
412
|
+
onDocClick(e) {
|
|
413
|
+
if (!this.el.nativeElement.contains(e.target)) {
|
|
414
|
+
this.isOpen.set(false);
|
|
415
|
+
this.filterText.set('');
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
// ControlValueAccessor
|
|
419
|
+
writeValue(val) {
|
|
420
|
+
this._cvaActive = true;
|
|
421
|
+
this._cvaValue.set(val ?? null);
|
|
422
|
+
}
|
|
423
|
+
registerOnChange(fn) {
|
|
424
|
+
this._onChange = fn;
|
|
425
|
+
}
|
|
426
|
+
registerOnTouched(fn) {
|
|
427
|
+
this._onTouched = fn;
|
|
428
|
+
}
|
|
429
|
+
setDisabledState(_isDisabled) {
|
|
430
|
+
// disabled is controlled via input() for template usage.
|
|
431
|
+
}
|
|
432
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
433
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DropdownComponent, isStandalone: true, selector: "ngx-dropdown", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:click": "onDocClick($event)" } }, providers: [
|
|
434
|
+
{
|
|
435
|
+
provide: NG_VALUE_ACCESSOR,
|
|
436
|
+
useExisting: forwardRef(() => DropdownComponent),
|
|
437
|
+
multi: true,
|
|
438
|
+
},
|
|
439
|
+
], ngImport: i0, template: `
|
|
440
|
+
<div
|
|
441
|
+
class="ngx-dropdown"
|
|
442
|
+
[class.open]="isOpen()"
|
|
443
|
+
[class.disabled]="disabled()"
|
|
444
|
+
[attr.aria-expanded]="isOpen()"
|
|
445
|
+
role="combobox"
|
|
446
|
+
>
|
|
447
|
+
@if (label()) {
|
|
448
|
+
<label class="ngx-dropdown-label">{{ label() }}</label>
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
<!-- Trigger -->
|
|
452
|
+
<div
|
|
453
|
+
class="ngx-dropdown-trigger"
|
|
454
|
+
tabindex="0"
|
|
455
|
+
(click)="toggle()"
|
|
456
|
+
(keydown)="onTriggerKey($event)"
|
|
457
|
+
[attr.aria-label]="selectedLabel() || placeholder()"
|
|
458
|
+
>
|
|
459
|
+
<span class="trigger-text" [class.placeholder]="!selectedLabel()">
|
|
460
|
+
{{ selectedLabel() || placeholder() }}
|
|
461
|
+
</span>
|
|
462
|
+
<span class="trigger-arrow" [class.open]="isOpen()">▼</span>
|
|
463
|
+
</div>
|
|
464
|
+
|
|
465
|
+
<!-- Popup -->
|
|
466
|
+
@if (isOpen()) {
|
|
467
|
+
<div class="ngx-dropdown-popup" role="listbox">
|
|
468
|
+
@if (filterable()) {
|
|
469
|
+
<div class="popup-search">
|
|
470
|
+
<input
|
|
471
|
+
#filterInput
|
|
472
|
+
class="popup-search-input"
|
|
473
|
+
placeholder="Search..."
|
|
474
|
+
[value]="filterText()"
|
|
475
|
+
(input)="filterText.set($any($event.target).value)"
|
|
476
|
+
(keydown)="onFilterKey($event)"
|
|
477
|
+
/>
|
|
478
|
+
</div>
|
|
479
|
+
}
|
|
480
|
+
<div class="popup-list">
|
|
481
|
+
@for (opt of filteredOptions(); track opt.value; let i = $index) {
|
|
482
|
+
<div
|
|
483
|
+
class="popup-item"
|
|
484
|
+
[class.selected]="isSelected(opt)"
|
|
485
|
+
[class.focused]="focusedIndex() === i"
|
|
486
|
+
[class.disabled]="opt.disabled"
|
|
487
|
+
role="option"
|
|
488
|
+
[attr.aria-selected]="isSelected(opt)"
|
|
489
|
+
(click)="selectOption(opt)"
|
|
490
|
+
(mouseenter)="focusedIndex.set(i)"
|
|
491
|
+
>{{ opt.label }}</div>
|
|
492
|
+
}
|
|
493
|
+
@if (filteredOptions().length === 0) {
|
|
494
|
+
<div class="popup-empty">No results</div>
|
|
495
|
+
}
|
|
496
|
+
</div>
|
|
497
|
+
</div>
|
|
498
|
+
}
|
|
499
|
+
</div>
|
|
500
|
+
`, isInline: true, styles: [":host{display:block}.ngx-dropdown{position:relative;font-family:inherit}.ngx-dropdown-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ngx-dropdown-trigger{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;-webkit-user-select:none;user-select:none;font-size:14px;transition:border-color .15s,box-shadow .15s}.ngx-dropdown-trigger:hover{border-color:#adb5bd}.open .ngx-dropdown-trigger{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .ngx-dropdown-trigger{background:#f8f9fa;cursor:not-allowed;color:#adb5bd}.trigger-text{flex:1;color:var(--ngx-input-text, #212529)}.trigger-text.placeholder{color:#adb5bd}.trigger-arrow{font-size:10px;color:#6c757d;transition:transform .15s}.trigger-arrow.open{transform:rotate(180deg)}.ngx-dropdown-popup{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;overflow:hidden}.popup-search{padding:8px;border-bottom:1px solid var(--ngx-input-border, #ced4da)}.popup-search-input{width:100%;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:3px;font-size:13px;outline:none;font-family:inherit}.popup-list{max-height:240px;overflow-y:auto}.popup-item{padding:8px 12px;font-size:14px;cursor:pointer;color:var(--ngx-input-text, #212529);transition:background .1s}.popup-item:hover,.popup-item.focused{background:var(--ngx-input-hover-bg, #f1f3f5)}.popup-item.selected{background:var(--ngx-input-selected-bg, #e8f0fe);color:var(--ngx-input-focus, #4a90d9);font-weight:500}.popup-item.disabled{color:#adb5bd;cursor:not-allowed}.popup-item.disabled:hover{background:none}.popup-empty{padding:12px;text-align:center;color:#adb5bd;font-size:13px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
501
|
+
}
|
|
502
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DropdownComponent, decorators: [{
|
|
503
|
+
type: Component,
|
|
504
|
+
args: [{ selector: 'ngx-dropdown', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
505
|
+
{
|
|
506
|
+
provide: NG_VALUE_ACCESSOR,
|
|
507
|
+
useExisting: forwardRef(() => DropdownComponent),
|
|
508
|
+
multi: true,
|
|
509
|
+
},
|
|
510
|
+
], template: `
|
|
511
|
+
<div
|
|
512
|
+
class="ngx-dropdown"
|
|
513
|
+
[class.open]="isOpen()"
|
|
514
|
+
[class.disabled]="disabled()"
|
|
515
|
+
[attr.aria-expanded]="isOpen()"
|
|
516
|
+
role="combobox"
|
|
517
|
+
>
|
|
518
|
+
@if (label()) {
|
|
519
|
+
<label class="ngx-dropdown-label">{{ label() }}</label>
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
<!-- Trigger -->
|
|
523
|
+
<div
|
|
524
|
+
class="ngx-dropdown-trigger"
|
|
525
|
+
tabindex="0"
|
|
526
|
+
(click)="toggle()"
|
|
527
|
+
(keydown)="onTriggerKey($event)"
|
|
528
|
+
[attr.aria-label]="selectedLabel() || placeholder()"
|
|
529
|
+
>
|
|
530
|
+
<span class="trigger-text" [class.placeholder]="!selectedLabel()">
|
|
531
|
+
{{ selectedLabel() || placeholder() }}
|
|
532
|
+
</span>
|
|
533
|
+
<span class="trigger-arrow" [class.open]="isOpen()">▼</span>
|
|
534
|
+
</div>
|
|
535
|
+
|
|
536
|
+
<!-- Popup -->
|
|
537
|
+
@if (isOpen()) {
|
|
538
|
+
<div class="ngx-dropdown-popup" role="listbox">
|
|
539
|
+
@if (filterable()) {
|
|
540
|
+
<div class="popup-search">
|
|
541
|
+
<input
|
|
542
|
+
#filterInput
|
|
543
|
+
class="popup-search-input"
|
|
544
|
+
placeholder="Search..."
|
|
545
|
+
[value]="filterText()"
|
|
546
|
+
(input)="filterText.set($any($event.target).value)"
|
|
547
|
+
(keydown)="onFilterKey($event)"
|
|
548
|
+
/>
|
|
549
|
+
</div>
|
|
550
|
+
}
|
|
551
|
+
<div class="popup-list">
|
|
552
|
+
@for (opt of filteredOptions(); track opt.value; let i = $index) {
|
|
553
|
+
<div
|
|
554
|
+
class="popup-item"
|
|
555
|
+
[class.selected]="isSelected(opt)"
|
|
556
|
+
[class.focused]="focusedIndex() === i"
|
|
557
|
+
[class.disabled]="opt.disabled"
|
|
558
|
+
role="option"
|
|
559
|
+
[attr.aria-selected]="isSelected(opt)"
|
|
560
|
+
(click)="selectOption(opt)"
|
|
561
|
+
(mouseenter)="focusedIndex.set(i)"
|
|
562
|
+
>{{ opt.label }}</div>
|
|
563
|
+
}
|
|
564
|
+
@if (filteredOptions().length === 0) {
|
|
565
|
+
<div class="popup-empty">No results</div>
|
|
566
|
+
}
|
|
567
|
+
</div>
|
|
568
|
+
</div>
|
|
569
|
+
}
|
|
570
|
+
</div>
|
|
571
|
+
`, styles: [":host{display:block}.ngx-dropdown{position:relative;font-family:inherit}.ngx-dropdown-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ngx-dropdown-trigger{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;-webkit-user-select:none;user-select:none;font-size:14px;transition:border-color .15s,box-shadow .15s}.ngx-dropdown-trigger:hover{border-color:#adb5bd}.open .ngx-dropdown-trigger{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .ngx-dropdown-trigger{background:#f8f9fa;cursor:not-allowed;color:#adb5bd}.trigger-text{flex:1;color:var(--ngx-input-text, #212529)}.trigger-text.placeholder{color:#adb5bd}.trigger-arrow{font-size:10px;color:#6c757d;transition:transform .15s}.trigger-arrow.open{transform:rotate(180deg)}.ngx-dropdown-popup{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;overflow:hidden}.popup-search{padding:8px;border-bottom:1px solid var(--ngx-input-border, #ced4da)}.popup-search-input{width:100%;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:3px;font-size:13px;outline:none;font-family:inherit}.popup-list{max-height:240px;overflow-y:auto}.popup-item{padding:8px 12px;font-size:14px;cursor:pointer;color:var(--ngx-input-text, #212529);transition:background .1s}.popup-item:hover,.popup-item.focused{background:var(--ngx-input-hover-bg, #f1f3f5)}.popup-item.selected{background:var(--ngx-input-selected-bg, #e8f0fe);color:var(--ngx-input-focus, #4a90d9);font-weight:500}.popup-item.disabled{color:#adb5bd;cursor:not-allowed}.popup-item.disabled:hover{background:none}.popup-empty{padding:12px;text-align:center;color:#adb5bd;font-size:13px}\n"] }]
|
|
572
|
+
}], propDecorators: { onDocClick: [{
|
|
573
|
+
type: HostListener,
|
|
574
|
+
args: ['document:click', ['$event']]
|
|
575
|
+
}] } });
|
|
576
|
+
|
|
577
|
+
class MultiSelectComponent {
|
|
578
|
+
options = input([]);
|
|
579
|
+
values = input([]);
|
|
580
|
+
label = input('');
|
|
581
|
+
placeholder = input('Select...');
|
|
582
|
+
disabled = input(false);
|
|
583
|
+
filterable = input(false);
|
|
584
|
+
maxTags = input(Infinity);
|
|
585
|
+
valuesChange = output();
|
|
586
|
+
isOpen = signal(false);
|
|
587
|
+
filterText = signal('');
|
|
588
|
+
focusedIndex = signal(-1);
|
|
589
|
+
_cvaValues = signal([]);
|
|
590
|
+
_cvaActive = false;
|
|
591
|
+
_onChange = () => { };
|
|
592
|
+
_onTouched = () => { };
|
|
593
|
+
el = inject(ElementRef);
|
|
594
|
+
_activeValues = computed(() => this._cvaActive ? this._cvaValues() : this.values());
|
|
595
|
+
displayValues = computed(() => this._activeValues()
|
|
596
|
+
.slice(0, this.maxTags() === Infinity ? undefined : this.maxTags())
|
|
597
|
+
.map(v => ({ value: v, label: this.options().find(o => o.value === v)?.label ?? String(v) })));
|
|
598
|
+
filteredOptions = computed(() => {
|
|
599
|
+
const f = this.filterText().toLowerCase();
|
|
600
|
+
return f ? this.options().filter(o => o.label.toLowerCase().includes(f)) : this.options();
|
|
601
|
+
});
|
|
602
|
+
allSelected = computed(() => this.options().every(o => this._activeValues().includes(o.value)));
|
|
603
|
+
someSelected = computed(() => this.options().some(o => this._activeValues().includes(o.value)));
|
|
604
|
+
isChecked(opt) { return this._activeValues().includes(opt.value); }
|
|
605
|
+
toggle() {
|
|
606
|
+
if (this.disabled())
|
|
607
|
+
return;
|
|
608
|
+
this.isOpen.update(v => !v);
|
|
609
|
+
}
|
|
610
|
+
toggleOption(opt) {
|
|
611
|
+
if (opt.disabled)
|
|
612
|
+
return;
|
|
613
|
+
const cur = this._activeValues();
|
|
614
|
+
const next = cur.includes(opt.value) ? cur.filter(v => v !== opt.value) : [...cur, opt.value];
|
|
615
|
+
this._cvaValues.set(next);
|
|
616
|
+
this._onChange(next);
|
|
617
|
+
this._onTouched();
|
|
618
|
+
this.valuesChange.emit(next);
|
|
619
|
+
}
|
|
620
|
+
removeValue(val, e) {
|
|
621
|
+
e.stopPropagation();
|
|
622
|
+
const next = this._activeValues().filter(v => v !== val);
|
|
623
|
+
this._cvaValues.set(next);
|
|
624
|
+
this._onChange(next);
|
|
625
|
+
this.valuesChange.emit(next);
|
|
626
|
+
}
|
|
627
|
+
toggleAll() {
|
|
628
|
+
const next = this.allSelected() ? [] : this.options().filter(o => !o.disabled).map(o => o.value);
|
|
629
|
+
this._cvaValues.set(next);
|
|
630
|
+
this._onChange(next);
|
|
631
|
+
this.valuesChange.emit(next);
|
|
632
|
+
}
|
|
633
|
+
onTriggerKey(e) {
|
|
634
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
635
|
+
e.preventDefault();
|
|
636
|
+
this.toggle();
|
|
637
|
+
}
|
|
638
|
+
if (e.key === 'Escape')
|
|
639
|
+
this.isOpen.set(false);
|
|
640
|
+
}
|
|
641
|
+
onDocClick(e) {
|
|
642
|
+
if (!this.el.nativeElement.contains(e.target)) {
|
|
643
|
+
this.isOpen.set(false);
|
|
644
|
+
this.filterText.set('');
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
// ControlValueAccessor
|
|
648
|
+
writeValue(val) {
|
|
649
|
+
this._cvaActive = true;
|
|
650
|
+
this._cvaValues.set(Array.isArray(val) ? val : []);
|
|
651
|
+
}
|
|
652
|
+
registerOnChange(fn) {
|
|
653
|
+
this._onChange = fn;
|
|
654
|
+
}
|
|
655
|
+
registerOnTouched(fn) {
|
|
656
|
+
this._onTouched = fn;
|
|
657
|
+
}
|
|
658
|
+
setDisabledState(_isDisabled) {
|
|
659
|
+
// disabled is controlled via input() for template usage.
|
|
660
|
+
}
|
|
661
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: MultiSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
662
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: MultiSelectComponent, isStandalone: true, selector: "ngx-multi-select", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, values: { classPropertyName: "values", publicName: "values", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null }, maxTags: { classPropertyName: "maxTags", publicName: "maxTags", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valuesChange: "valuesChange" }, host: { listeners: { "document:click": "onDocClick($event)" } }, providers: [
|
|
663
|
+
{
|
|
664
|
+
provide: NG_VALUE_ACCESSOR,
|
|
665
|
+
useExisting: forwardRef(() => MultiSelectComponent),
|
|
666
|
+
multi: true,
|
|
667
|
+
},
|
|
668
|
+
], ngImport: i0, template: `
|
|
669
|
+
<div class="ngx-multi-select" [class.open]="isOpen()" [class.disabled]="disabled()" role="combobox">
|
|
670
|
+
@if (label()) {
|
|
671
|
+
<label class="ms-label">{{ label() }}</label>
|
|
672
|
+
}
|
|
673
|
+
<!-- Trigger -->
|
|
674
|
+
<div class="ms-trigger" tabindex="0" (click)="toggle()" (keydown)="onTriggerKey($event)">
|
|
675
|
+
<div class="ms-tags">
|
|
676
|
+
@for (val of displayValues(); track val.value) {
|
|
677
|
+
<span class="ms-tag">
|
|
678
|
+
{{ val.label }}
|
|
679
|
+
<button class="ms-tag-remove" (click)="removeValue(val.value, $event)" [attr.aria-label]="'Remove ' + val.label">✕</button>
|
|
680
|
+
</span>
|
|
681
|
+
}
|
|
682
|
+
@if (displayValues().length === 0) {
|
|
683
|
+
<span class="ms-placeholder">{{ placeholder() }}</span>
|
|
684
|
+
}
|
|
685
|
+
</div>
|
|
686
|
+
<span class="ms-arrow" [class.open]="isOpen()">▼</span>
|
|
687
|
+
</div>
|
|
688
|
+
|
|
689
|
+
<!-- Popup -->
|
|
690
|
+
@if (isOpen()) {
|
|
691
|
+
<div class="ms-popup">
|
|
692
|
+
@if (filterable()) {
|
|
693
|
+
<div class="ms-search">
|
|
694
|
+
<input
|
|
695
|
+
class="ms-search-input"
|
|
696
|
+
placeholder="Search..."
|
|
697
|
+
[value]="filterText()"
|
|
698
|
+
(input)="filterText.set($any($event.target).value)"
|
|
699
|
+
(click)="$event.stopPropagation()"
|
|
700
|
+
/>
|
|
701
|
+
</div>
|
|
702
|
+
}
|
|
703
|
+
<div class="ms-list">
|
|
704
|
+
<!-- Select All -->
|
|
705
|
+
<label class="ms-item ms-select-all">
|
|
706
|
+
<input
|
|
707
|
+
type="checkbox"
|
|
708
|
+
[checked]="allSelected()"
|
|
709
|
+
[indeterminate]="someSelected() && !allSelected()"
|
|
710
|
+
(change)="toggleAll()"
|
|
711
|
+
/>
|
|
712
|
+
<span>Select All</span>
|
|
713
|
+
</label>
|
|
714
|
+
<div class="ms-divider"></div>
|
|
715
|
+
@for (opt of filteredOptions(); track opt.value; let i = $index) {
|
|
716
|
+
<label
|
|
717
|
+
class="ms-item"
|
|
718
|
+
[class.checked]="isChecked(opt)"
|
|
719
|
+
[class.disabled]="opt.disabled"
|
|
720
|
+
[class.focused]="focusedIndex() === i"
|
|
721
|
+
(mouseenter)="focusedIndex.set(i)"
|
|
722
|
+
>
|
|
723
|
+
<input
|
|
724
|
+
type="checkbox"
|
|
725
|
+
[checked]="isChecked(opt)"
|
|
726
|
+
[disabled]="!!opt.disabled"
|
|
727
|
+
(change)="toggleOption(opt)"
|
|
728
|
+
(click)="$event.stopPropagation()"
|
|
729
|
+
/>
|
|
730
|
+
<span>{{ opt.label }}</span>
|
|
731
|
+
</label>
|
|
732
|
+
}
|
|
733
|
+
@if (filteredOptions().length === 0) {
|
|
734
|
+
<div class="ms-empty">No results</div>
|
|
735
|
+
}
|
|
736
|
+
</div>
|
|
737
|
+
</div>
|
|
738
|
+
}
|
|
739
|
+
</div>
|
|
740
|
+
`, isInline: true, styles: [":host{display:block}.ngx-multi-select{position:relative;font-family:inherit}.ms-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ms-trigger{display:flex;align-items:center;min-height:38px;padding:4px 8px 4px 4px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color .15s,box-shadow .15s}.ms-trigger:hover{border-color:#adb5bd}.open .ms-trigger{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .ms-trigger{background:#f8f9fa;cursor:not-allowed}.ms-tags{display:flex;flex-wrap:wrap;gap:4px;flex:1;align-items:center}.ms-tag{display:inline-flex;align-items:center;gap:4px;background:var(--ngx-input-tag-bg, #e8f0fe);color:var(--ngx-input-tag-color, #1a73e8);padding:2px 4px 2px 8px;border-radius:3px;font-size:12px}.ms-tag-remove{background:none;border:none;cursor:pointer;padding:0 2px;color:var(--ngx-input-tag-color, #1a73e8);font-size:10px;line-height:1}.ms-placeholder{color:#adb5bd;font-size:14px;padding:0 4px}.ms-arrow{font-size:10px;color:#6c757d;transition:transform .15s;margin-left:auto}.ms-arrow.open{transform:rotate(180deg)}.ms-popup{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;overflow:hidden}.ms-search{padding:8px;border-bottom:1px solid var(--ngx-input-border, #ced4da)}.ms-search-input{width:100%;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:3px;font-size:13px;outline:none;font-family:inherit}.ms-list{max-height:240px;overflow-y:auto}.ms-item{display:flex;align-items:center;gap:10px;padding:8px 12px;cursor:pointer;font-size:14px;color:var(--ngx-input-text, #212529)}.ms-item:hover,.ms-item.focused{background:#f1f3f5}.ms-item.checked{background:#f0f7ff}.ms-item.disabled{color:#adb5bd;cursor:not-allowed}.ms-item input[type=checkbox]{width:14px;height:14px;cursor:pointer;accent-color:var(--ngx-input-focus, #4a90d9)}.ms-select-all{font-weight:500}.ms-divider{height:1px;background:#eee;margin:2px 0}.ms-empty{padding:12px;text-align:center;color:#adb5bd;font-size:13px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
741
|
+
}
|
|
742
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: MultiSelectComponent, decorators: [{
|
|
743
|
+
type: Component,
|
|
744
|
+
args: [{ selector: 'ngx-multi-select', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
745
|
+
{
|
|
746
|
+
provide: NG_VALUE_ACCESSOR,
|
|
747
|
+
useExisting: forwardRef(() => MultiSelectComponent),
|
|
748
|
+
multi: true,
|
|
749
|
+
},
|
|
750
|
+
], template: `
|
|
751
|
+
<div class="ngx-multi-select" [class.open]="isOpen()" [class.disabled]="disabled()" role="combobox">
|
|
752
|
+
@if (label()) {
|
|
753
|
+
<label class="ms-label">{{ label() }}</label>
|
|
754
|
+
}
|
|
755
|
+
<!-- Trigger -->
|
|
756
|
+
<div class="ms-trigger" tabindex="0" (click)="toggle()" (keydown)="onTriggerKey($event)">
|
|
757
|
+
<div class="ms-tags">
|
|
758
|
+
@for (val of displayValues(); track val.value) {
|
|
759
|
+
<span class="ms-tag">
|
|
760
|
+
{{ val.label }}
|
|
761
|
+
<button class="ms-tag-remove" (click)="removeValue(val.value, $event)" [attr.aria-label]="'Remove ' + val.label">✕</button>
|
|
762
|
+
</span>
|
|
763
|
+
}
|
|
764
|
+
@if (displayValues().length === 0) {
|
|
765
|
+
<span class="ms-placeholder">{{ placeholder() }}</span>
|
|
766
|
+
}
|
|
767
|
+
</div>
|
|
768
|
+
<span class="ms-arrow" [class.open]="isOpen()">▼</span>
|
|
769
|
+
</div>
|
|
770
|
+
|
|
771
|
+
<!-- Popup -->
|
|
772
|
+
@if (isOpen()) {
|
|
773
|
+
<div class="ms-popup">
|
|
774
|
+
@if (filterable()) {
|
|
775
|
+
<div class="ms-search">
|
|
776
|
+
<input
|
|
777
|
+
class="ms-search-input"
|
|
778
|
+
placeholder="Search..."
|
|
779
|
+
[value]="filterText()"
|
|
780
|
+
(input)="filterText.set($any($event.target).value)"
|
|
781
|
+
(click)="$event.stopPropagation()"
|
|
782
|
+
/>
|
|
783
|
+
</div>
|
|
784
|
+
}
|
|
785
|
+
<div class="ms-list">
|
|
786
|
+
<!-- Select All -->
|
|
787
|
+
<label class="ms-item ms-select-all">
|
|
788
|
+
<input
|
|
789
|
+
type="checkbox"
|
|
790
|
+
[checked]="allSelected()"
|
|
791
|
+
[indeterminate]="someSelected() && !allSelected()"
|
|
792
|
+
(change)="toggleAll()"
|
|
793
|
+
/>
|
|
794
|
+
<span>Select All</span>
|
|
795
|
+
</label>
|
|
796
|
+
<div class="ms-divider"></div>
|
|
797
|
+
@for (opt of filteredOptions(); track opt.value; let i = $index) {
|
|
798
|
+
<label
|
|
799
|
+
class="ms-item"
|
|
800
|
+
[class.checked]="isChecked(opt)"
|
|
801
|
+
[class.disabled]="opt.disabled"
|
|
802
|
+
[class.focused]="focusedIndex() === i"
|
|
803
|
+
(mouseenter)="focusedIndex.set(i)"
|
|
804
|
+
>
|
|
805
|
+
<input
|
|
806
|
+
type="checkbox"
|
|
807
|
+
[checked]="isChecked(opt)"
|
|
808
|
+
[disabled]="!!opt.disabled"
|
|
809
|
+
(change)="toggleOption(opt)"
|
|
810
|
+
(click)="$event.stopPropagation()"
|
|
811
|
+
/>
|
|
812
|
+
<span>{{ opt.label }}</span>
|
|
813
|
+
</label>
|
|
814
|
+
}
|
|
815
|
+
@if (filteredOptions().length === 0) {
|
|
816
|
+
<div class="ms-empty">No results</div>
|
|
817
|
+
}
|
|
818
|
+
</div>
|
|
819
|
+
</div>
|
|
820
|
+
}
|
|
821
|
+
</div>
|
|
822
|
+
`, styles: [":host{display:block}.ngx-multi-select{position:relative;font-family:inherit}.ms-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ms-trigger{display:flex;align-items:center;min-height:38px;padding:4px 8px 4px 4px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color .15s,box-shadow .15s}.ms-trigger:hover{border-color:#adb5bd}.open .ms-trigger{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .ms-trigger{background:#f8f9fa;cursor:not-allowed}.ms-tags{display:flex;flex-wrap:wrap;gap:4px;flex:1;align-items:center}.ms-tag{display:inline-flex;align-items:center;gap:4px;background:var(--ngx-input-tag-bg, #e8f0fe);color:var(--ngx-input-tag-color, #1a73e8);padding:2px 4px 2px 8px;border-radius:3px;font-size:12px}.ms-tag-remove{background:none;border:none;cursor:pointer;padding:0 2px;color:var(--ngx-input-tag-color, #1a73e8);font-size:10px;line-height:1}.ms-placeholder{color:#adb5bd;font-size:14px;padding:0 4px}.ms-arrow{font-size:10px;color:#6c757d;transition:transform .15s;margin-left:auto}.ms-arrow.open{transform:rotate(180deg)}.ms-popup{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;overflow:hidden}.ms-search{padding:8px;border-bottom:1px solid var(--ngx-input-border, #ced4da)}.ms-search-input{width:100%;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:3px;font-size:13px;outline:none;font-family:inherit}.ms-list{max-height:240px;overflow-y:auto}.ms-item{display:flex;align-items:center;gap:10px;padding:8px 12px;cursor:pointer;font-size:14px;color:var(--ngx-input-text, #212529)}.ms-item:hover,.ms-item.focused{background:#f1f3f5}.ms-item.checked{background:#f0f7ff}.ms-item.disabled{color:#adb5bd;cursor:not-allowed}.ms-item input[type=checkbox]{width:14px;height:14px;cursor:pointer;accent-color:var(--ngx-input-focus, #4a90d9)}.ms-select-all{font-weight:500}.ms-divider{height:1px;background:#eee;margin:2px 0}.ms-empty{padding:12px;text-align:center;color:#adb5bd;font-size:13px}\n"] }]
|
|
823
|
+
}], propDecorators: { onDocClick: [{
|
|
824
|
+
type: HostListener,
|
|
825
|
+
args: ['document:click', ['$event']]
|
|
826
|
+
}] } });
|
|
827
|
+
|
|
828
|
+
class AutocompleteComponent {
|
|
829
|
+
options = input([]);
|
|
830
|
+
label = input('');
|
|
831
|
+
placeholder = input('Type to search...');
|
|
832
|
+
disabled = input(false);
|
|
833
|
+
error = input('');
|
|
834
|
+
minLength = input(1);
|
|
835
|
+
valueChange = output();
|
|
836
|
+
_inputText = signal('');
|
|
837
|
+
_selectedValue = signal(null);
|
|
838
|
+
isOpen = signal(false);
|
|
839
|
+
isFocused = signal(false);
|
|
840
|
+
focusedIndex = signal(-1);
|
|
841
|
+
_onChange = () => { };
|
|
842
|
+
_onTouched = () => { };
|
|
843
|
+
el = inject(ElementRef);
|
|
844
|
+
filteredOptions = computed(() => {
|
|
845
|
+
const text = this._inputText().toLowerCase();
|
|
846
|
+
if (text.length < this.minLength())
|
|
847
|
+
return [];
|
|
848
|
+
return this.options().filter(o => o.label.toLowerCase().includes(text));
|
|
849
|
+
});
|
|
850
|
+
isSelected(opt) {
|
|
851
|
+
return this._selectedValue() === opt.value;
|
|
852
|
+
}
|
|
853
|
+
onInput(e) {
|
|
854
|
+
const text = e.target.value;
|
|
855
|
+
this._inputText.set(text);
|
|
856
|
+
this._selectedValue.set(null);
|
|
857
|
+
this.isOpen.set(text.length >= this.minLength());
|
|
858
|
+
this.focusedIndex.set(-1);
|
|
859
|
+
}
|
|
860
|
+
onFocus() {
|
|
861
|
+
this.isFocused.set(true);
|
|
862
|
+
if (this._inputText().length >= this.minLength()) {
|
|
863
|
+
this.isOpen.set(true);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
onBlur() {
|
|
867
|
+
this.isFocused.set(false);
|
|
868
|
+
this._onTouched();
|
|
869
|
+
setTimeout(() => this.isOpen.set(false), 150);
|
|
870
|
+
}
|
|
871
|
+
onKeyDown(e) {
|
|
872
|
+
const n = this.filteredOptions().length;
|
|
873
|
+
if (e.key === 'ArrowDown') {
|
|
874
|
+
e.preventDefault();
|
|
875
|
+
this.focusedIndex.update(i => Math.min(n - 1, i + 1));
|
|
876
|
+
}
|
|
877
|
+
else if (e.key === 'ArrowUp') {
|
|
878
|
+
e.preventDefault();
|
|
879
|
+
this.focusedIndex.update(i => Math.max(-1, i - 1));
|
|
880
|
+
}
|
|
881
|
+
else if (e.key === 'Enter') {
|
|
882
|
+
const idx = this.focusedIndex();
|
|
883
|
+
if (idx >= 0 && idx < n)
|
|
884
|
+
this.selectOption(this.filteredOptions()[idx]);
|
|
885
|
+
}
|
|
886
|
+
else if (e.key === 'Escape') {
|
|
887
|
+
this.isOpen.set(false);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
selectOption(opt) {
|
|
891
|
+
if (opt.disabled)
|
|
892
|
+
return;
|
|
893
|
+
this._inputText.set(opt.label);
|
|
894
|
+
this._selectedValue.set(opt.value);
|
|
895
|
+
this.isOpen.set(false);
|
|
896
|
+
this._onChange(opt.value);
|
|
897
|
+
this._onTouched();
|
|
898
|
+
this.valueChange.emit(opt.value);
|
|
899
|
+
}
|
|
900
|
+
clear() {
|
|
901
|
+
this._inputText.set('');
|
|
902
|
+
this._selectedValue.set(null);
|
|
903
|
+
this.isOpen.set(false);
|
|
904
|
+
this._onChange(null);
|
|
905
|
+
this.valueChange.emit(null);
|
|
906
|
+
}
|
|
907
|
+
onDocClick(e) {
|
|
908
|
+
if (!this.el.nativeElement.contains(e.target)) {
|
|
909
|
+
this.isOpen.set(false);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
// ControlValueAccessor
|
|
913
|
+
writeValue(val) {
|
|
914
|
+
if (val === null || val === undefined) {
|
|
915
|
+
this._inputText.set('');
|
|
916
|
+
this._selectedValue.set(null);
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
const match = this.options().find(o => o.value === val);
|
|
920
|
+
this._inputText.set(match?.label ?? String(val));
|
|
921
|
+
this._selectedValue.set(val);
|
|
922
|
+
}
|
|
923
|
+
registerOnChange(fn) {
|
|
924
|
+
this._onChange = fn;
|
|
925
|
+
}
|
|
926
|
+
registerOnTouched(fn) {
|
|
927
|
+
this._onTouched = fn;
|
|
928
|
+
}
|
|
929
|
+
setDisabledState(_isDisabled) {
|
|
930
|
+
// disabled handled via input()
|
|
931
|
+
}
|
|
932
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
933
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AutocompleteComponent, isStandalone: true, selector: "ngx-autocomplete", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:click": "onDocClick($event)" } }, providers: [
|
|
934
|
+
{
|
|
935
|
+
provide: NG_VALUE_ACCESSOR,
|
|
936
|
+
useExisting: forwardRef(() => AutocompleteComponent),
|
|
937
|
+
multi: true,
|
|
938
|
+
},
|
|
939
|
+
], ngImport: i0, template: `
|
|
940
|
+
<div
|
|
941
|
+
class="ngx-autocomplete"
|
|
942
|
+
[class.open]="isOpen()"
|
|
943
|
+
[class.focused]="isFocused()"
|
|
944
|
+
[class.has-error]="!!error()"
|
|
945
|
+
[class.disabled]="disabled()"
|
|
946
|
+
>
|
|
947
|
+
@if (label()) {
|
|
948
|
+
<label class="ngx-ac-label">{{ label() }}</label>
|
|
949
|
+
}
|
|
950
|
+
<div class="ngx-ac-wrap">
|
|
951
|
+
<input
|
|
952
|
+
class="ngx-ac-input"
|
|
953
|
+
[placeholder]="placeholder()"
|
|
954
|
+
[disabled]="disabled()"
|
|
955
|
+
[value]="_inputText()"
|
|
956
|
+
(input)="onInput($event)"
|
|
957
|
+
(focus)="onFocus()"
|
|
958
|
+
(blur)="onBlur()"
|
|
959
|
+
(keydown)="onKeyDown($event)"
|
|
960
|
+
role="combobox"
|
|
961
|
+
[attr.aria-expanded]="isOpen()"
|
|
962
|
+
aria-autocomplete="list"
|
|
963
|
+
aria-haspopup="listbox"
|
|
964
|
+
/>
|
|
965
|
+
@if (_inputText()) {
|
|
966
|
+
<button class="ngx-ac-clear" (click)="clear()" aria-label="Clear">✕</button>
|
|
967
|
+
}
|
|
968
|
+
</div>
|
|
969
|
+
|
|
970
|
+
<!-- Suggestion panel — floats above DOM via absolute positioning -->
|
|
971
|
+
@if (isOpen() && filteredOptions().length > 0) {
|
|
972
|
+
<div class="ngx-ac-panel" role="listbox">
|
|
973
|
+
@for (opt of filteredOptions(); track opt.value; let i = $index) {
|
|
974
|
+
<div
|
|
975
|
+
class="ngx-ac-item"
|
|
976
|
+
[class.focused]="focusedIndex() === i"
|
|
977
|
+
[class.disabled]="opt.disabled"
|
|
978
|
+
role="option"
|
|
979
|
+
[attr.aria-selected]="isSelected(opt)"
|
|
980
|
+
(mousedown)="selectOption(opt)"
|
|
981
|
+
(mouseenter)="focusedIndex.set(i)"
|
|
982
|
+
>{{ opt.label }}</div>
|
|
983
|
+
}
|
|
984
|
+
</div>
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
@if (error()) {
|
|
988
|
+
<div class="ngx-ac-error">{{ error() }}</div>
|
|
989
|
+
}
|
|
990
|
+
</div>
|
|
991
|
+
`, isInline: true, styles: [":host{display:block}.ngx-autocomplete{position:relative;font-family:inherit}.ngx-ac-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ngx-ac-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);transition:border-color .15s,box-shadow .15s}.focused .ngx-ac-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.has-error .ngx-ac-wrap{border-color:var(--ngx-input-error, #e74c3c)}.disabled .ngx-ac-wrap{background:#f8f9fa}.ngx-ac-input{flex:1;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);font-family:inherit}.ngx-ac-input:disabled{cursor:not-allowed;color:#adb5bd}.ngx-ac-clear{padding:0 10px;background:none;border:none;cursor:pointer;color:#adb5bd;font-size:14px;line-height:1}.ngx-ac-panel{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;max-height:240px;overflow-y:auto}.ngx-ac-item{padding:8px 12px;font-size:14px;cursor:pointer;color:var(--ngx-input-text, #212529);transition:background .1s}.ngx-ac-item:hover,.ngx-ac-item.focused{background:var(--ngx-input-hover-bg, #f1f3f5)}.ngx-ac-item.disabled{color:#adb5bd;cursor:not-allowed;pointer-events:none}.ngx-ac-error{font-size:12px;color:var(--ngx-input-error, #e74c3c);margin-top:4px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
992
|
+
}
|
|
993
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AutocompleteComponent, decorators: [{
|
|
994
|
+
type: Component,
|
|
995
|
+
args: [{ selector: 'ngx-autocomplete', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
996
|
+
{
|
|
997
|
+
provide: NG_VALUE_ACCESSOR,
|
|
998
|
+
useExisting: forwardRef(() => AutocompleteComponent),
|
|
999
|
+
multi: true,
|
|
1000
|
+
},
|
|
1001
|
+
], template: `
|
|
1002
|
+
<div
|
|
1003
|
+
class="ngx-autocomplete"
|
|
1004
|
+
[class.open]="isOpen()"
|
|
1005
|
+
[class.focused]="isFocused()"
|
|
1006
|
+
[class.has-error]="!!error()"
|
|
1007
|
+
[class.disabled]="disabled()"
|
|
1008
|
+
>
|
|
1009
|
+
@if (label()) {
|
|
1010
|
+
<label class="ngx-ac-label">{{ label() }}</label>
|
|
1011
|
+
}
|
|
1012
|
+
<div class="ngx-ac-wrap">
|
|
1013
|
+
<input
|
|
1014
|
+
class="ngx-ac-input"
|
|
1015
|
+
[placeholder]="placeholder()"
|
|
1016
|
+
[disabled]="disabled()"
|
|
1017
|
+
[value]="_inputText()"
|
|
1018
|
+
(input)="onInput($event)"
|
|
1019
|
+
(focus)="onFocus()"
|
|
1020
|
+
(blur)="onBlur()"
|
|
1021
|
+
(keydown)="onKeyDown($event)"
|
|
1022
|
+
role="combobox"
|
|
1023
|
+
[attr.aria-expanded]="isOpen()"
|
|
1024
|
+
aria-autocomplete="list"
|
|
1025
|
+
aria-haspopup="listbox"
|
|
1026
|
+
/>
|
|
1027
|
+
@if (_inputText()) {
|
|
1028
|
+
<button class="ngx-ac-clear" (click)="clear()" aria-label="Clear">✕</button>
|
|
1029
|
+
}
|
|
1030
|
+
</div>
|
|
1031
|
+
|
|
1032
|
+
<!-- Suggestion panel — floats above DOM via absolute positioning -->
|
|
1033
|
+
@if (isOpen() && filteredOptions().length > 0) {
|
|
1034
|
+
<div class="ngx-ac-panel" role="listbox">
|
|
1035
|
+
@for (opt of filteredOptions(); track opt.value; let i = $index) {
|
|
1036
|
+
<div
|
|
1037
|
+
class="ngx-ac-item"
|
|
1038
|
+
[class.focused]="focusedIndex() === i"
|
|
1039
|
+
[class.disabled]="opt.disabled"
|
|
1040
|
+
role="option"
|
|
1041
|
+
[attr.aria-selected]="isSelected(opt)"
|
|
1042
|
+
(mousedown)="selectOption(opt)"
|
|
1043
|
+
(mouseenter)="focusedIndex.set(i)"
|
|
1044
|
+
>{{ opt.label }}</div>
|
|
1045
|
+
}
|
|
1046
|
+
</div>
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
@if (error()) {
|
|
1050
|
+
<div class="ngx-ac-error">{{ error() }}</div>
|
|
1051
|
+
}
|
|
1052
|
+
</div>
|
|
1053
|
+
`, styles: [":host{display:block}.ngx-autocomplete{position:relative;font-family:inherit}.ngx-ac-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ngx-ac-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);transition:border-color .15s,box-shadow .15s}.focused .ngx-ac-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.has-error .ngx-ac-wrap{border-color:var(--ngx-input-error, #e74c3c)}.disabled .ngx-ac-wrap{background:#f8f9fa}.ngx-ac-input{flex:1;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);font-family:inherit}.ngx-ac-input:disabled{cursor:not-allowed;color:#adb5bd}.ngx-ac-clear{padding:0 10px;background:none;border:none;cursor:pointer;color:#adb5bd;font-size:14px;line-height:1}.ngx-ac-panel{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;max-height:240px;overflow-y:auto}.ngx-ac-item{padding:8px 12px;font-size:14px;cursor:pointer;color:var(--ngx-input-text, #212529);transition:background .1s}.ngx-ac-item:hover,.ngx-ac-item.focused{background:var(--ngx-input-hover-bg, #f1f3f5)}.ngx-ac-item.disabled{color:#adb5bd;cursor:not-allowed;pointer-events:none}.ngx-ac-error{font-size:12px;color:var(--ngx-input-error, #e74c3c);margin-top:4px}\n"] }]
|
|
1054
|
+
}], propDecorators: { onDocClick: [{
|
|
1055
|
+
type: HostListener,
|
|
1056
|
+
args: ['document:click', ['$event']]
|
|
1057
|
+
}] } });
|
|
1058
|
+
|
|
1059
|
+
class DatePickerComponent {
|
|
1060
|
+
value = input(null);
|
|
1061
|
+
label = input('');
|
|
1062
|
+
placeholder = input('Select date...');
|
|
1063
|
+
disabled = input(false);
|
|
1064
|
+
min = input(null);
|
|
1065
|
+
max = input(null);
|
|
1066
|
+
format = input('MM/dd/yyyy');
|
|
1067
|
+
valueChange = output();
|
|
1068
|
+
WEEKDAYS = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
1069
|
+
isOpen = signal(false);
|
|
1070
|
+
viewYear = signal(new Date().getFullYear());
|
|
1071
|
+
viewMonth = signal(new Date().getMonth());
|
|
1072
|
+
_cvaValue = signal(null);
|
|
1073
|
+
_cvaActive = false;
|
|
1074
|
+
_onChange = () => { };
|
|
1075
|
+
_onTouched = () => { };
|
|
1076
|
+
el = inject(ElementRef);
|
|
1077
|
+
_activeValue = computed(() => this._cvaActive ? this._cvaValue() : this.value());
|
|
1078
|
+
displayValue = computed(() => {
|
|
1079
|
+
const v = this._activeValue();
|
|
1080
|
+
if (!v)
|
|
1081
|
+
return '';
|
|
1082
|
+
return v.toLocaleDateString('en-US', { month: '2-digit', day: '2-digit', year: 'numeric' });
|
|
1083
|
+
});
|
|
1084
|
+
monthTitle = computed(() => {
|
|
1085
|
+
const d = new Date(this.viewYear(), this.viewMonth(), 1);
|
|
1086
|
+
return d.toLocaleDateString('en-US', { month: 'long', year: 'numeric' });
|
|
1087
|
+
});
|
|
1088
|
+
calendarDays = computed(() => {
|
|
1089
|
+
const y = this.viewYear(), m = this.viewMonth();
|
|
1090
|
+
const first = new Date(y, m, 1);
|
|
1091
|
+
const last = new Date(y, m + 1, 0);
|
|
1092
|
+
const today = new Date();
|
|
1093
|
+
today.setHours(0, 0, 0, 0);
|
|
1094
|
+
const selectedTime = this._activeValue()?.setHours(0, 0, 0, 0) ?? -1;
|
|
1095
|
+
const days = [];
|
|
1096
|
+
// Leading blanks
|
|
1097
|
+
for (let i = 0; i < first.getDay(); i++) {
|
|
1098
|
+
const d = new Date(y, m, -first.getDay() + i + 1);
|
|
1099
|
+
days.push({ date: d, label: d.getDate().toString(), current: false, isToday: false, isSelected: false, disabled: true });
|
|
1100
|
+
}
|
|
1101
|
+
// Days in month
|
|
1102
|
+
for (let d = 1; d <= last.getDate(); d++) {
|
|
1103
|
+
const date = new Date(y, m, d);
|
|
1104
|
+
const isDisabled = (this.min() && date < this.min()) || (this.max() && date > this.max()) || false;
|
|
1105
|
+
days.push({
|
|
1106
|
+
date, label: d.toString(), current: true,
|
|
1107
|
+
isToday: date.getTime() === today.getTime(),
|
|
1108
|
+
isSelected: date.setHours(0, 0, 0, 0) === selectedTime,
|
|
1109
|
+
disabled: isDisabled,
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
// Trailing blanks
|
|
1113
|
+
const remaining = 42 - days.length;
|
|
1114
|
+
for (let i = 1; i <= remaining; i++) {
|
|
1115
|
+
const d = new Date(y, m + 1, i);
|
|
1116
|
+
days.push({ date: d, label: i.toString(), current: false, isToday: false, isSelected: false, disabled: true });
|
|
1117
|
+
}
|
|
1118
|
+
return days;
|
|
1119
|
+
});
|
|
1120
|
+
toggle() {
|
|
1121
|
+
if (this.disabled())
|
|
1122
|
+
return;
|
|
1123
|
+
this.isOpen.update(v => !v);
|
|
1124
|
+
if (this.isOpen() && this._activeValue()) {
|
|
1125
|
+
this.viewYear.set(this._activeValue().getFullYear());
|
|
1126
|
+
this.viewMonth.set(this._activeValue().getMonth());
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
prevMonth() {
|
|
1130
|
+
if (this.viewMonth() === 0) {
|
|
1131
|
+
this.viewMonth.set(11);
|
|
1132
|
+
this.viewYear.update(y => y - 1);
|
|
1133
|
+
}
|
|
1134
|
+
else
|
|
1135
|
+
this.viewMonth.update(m => m - 1);
|
|
1136
|
+
}
|
|
1137
|
+
nextMonth() {
|
|
1138
|
+
if (this.viewMonth() === 11) {
|
|
1139
|
+
this.viewMonth.set(0);
|
|
1140
|
+
this.viewYear.update(y => y + 1);
|
|
1141
|
+
}
|
|
1142
|
+
else
|
|
1143
|
+
this.viewMonth.update(m => m + 1);
|
|
1144
|
+
}
|
|
1145
|
+
selectDay(date) {
|
|
1146
|
+
if (!date)
|
|
1147
|
+
return;
|
|
1148
|
+
this._cvaValue.set(date);
|
|
1149
|
+
this._onChange(date);
|
|
1150
|
+
this._onTouched();
|
|
1151
|
+
this.valueChange.emit(date);
|
|
1152
|
+
this.isOpen.set(false);
|
|
1153
|
+
}
|
|
1154
|
+
selectToday() { this.selectDay(new Date()); }
|
|
1155
|
+
clearValue() {
|
|
1156
|
+
this._cvaValue.set(null);
|
|
1157
|
+
this._onChange(null);
|
|
1158
|
+
this.valueChange.emit(null);
|
|
1159
|
+
this.isOpen.set(false);
|
|
1160
|
+
}
|
|
1161
|
+
onDocClick(e) {
|
|
1162
|
+
if (!this.el.nativeElement.contains(e.target))
|
|
1163
|
+
this.isOpen.set(false);
|
|
1164
|
+
}
|
|
1165
|
+
// ControlValueAccessor
|
|
1166
|
+
writeValue(val) {
|
|
1167
|
+
this._cvaActive = true;
|
|
1168
|
+
this._cvaValue.set(val instanceof Date ? val : null);
|
|
1169
|
+
}
|
|
1170
|
+
registerOnChange(fn) {
|
|
1171
|
+
this._onChange = fn;
|
|
1172
|
+
}
|
|
1173
|
+
registerOnTouched(fn) {
|
|
1174
|
+
this._onTouched = fn;
|
|
1175
|
+
}
|
|
1176
|
+
setDisabledState(_isDisabled) {
|
|
1177
|
+
// disabled is controlled via input() for template usage.
|
|
1178
|
+
}
|
|
1179
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DatePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1180
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DatePickerComponent, isStandalone: true, selector: "ngx-date-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:click": "onDocClick($event)" } }, providers: [
|
|
1181
|
+
{
|
|
1182
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1183
|
+
useExisting: forwardRef(() => DatePickerComponent),
|
|
1184
|
+
multi: true,
|
|
1185
|
+
},
|
|
1186
|
+
], ngImport: i0, template: `
|
|
1187
|
+
<div class="ngx-date-picker" [class.open]="isOpen()" [class.disabled]="disabled()">
|
|
1188
|
+
@if (label()) {
|
|
1189
|
+
<label class="dp-label">{{ label() }}</label>
|
|
1190
|
+
}
|
|
1191
|
+
<!-- Input trigger -->
|
|
1192
|
+
<div class="dp-input-wrap" (click)="toggle()">
|
|
1193
|
+
<input
|
|
1194
|
+
class="dp-input"
|
|
1195
|
+
readonly
|
|
1196
|
+
[value]="displayValue()"
|
|
1197
|
+
[placeholder]="placeholder()"
|
|
1198
|
+
[disabled]="disabled()"
|
|
1199
|
+
/>
|
|
1200
|
+
<span class="dp-icon">📅</span>
|
|
1201
|
+
</div>
|
|
1202
|
+
|
|
1203
|
+
<!-- Calendar popup -->
|
|
1204
|
+
@if (isOpen()) {
|
|
1205
|
+
<div class="dp-popup" (click)="$event.stopPropagation()">
|
|
1206
|
+
<!-- Month/Year nav -->
|
|
1207
|
+
<div class="dp-nav">
|
|
1208
|
+
<button class="dp-nav-btn" (click)="prevMonth()">‹</button>
|
|
1209
|
+
<span class="dp-nav-title">{{ monthTitle() }}</span>
|
|
1210
|
+
<button class="dp-nav-btn" (click)="nextMonth()">›</button>
|
|
1211
|
+
</div>
|
|
1212
|
+
<!-- Weekday headers -->
|
|
1213
|
+
<div class="dp-weekdays">
|
|
1214
|
+
@for (d of WEEKDAYS; track d) {
|
|
1215
|
+
<span class="dp-wd">{{ d }}</span>
|
|
1216
|
+
}
|
|
1217
|
+
</div>
|
|
1218
|
+
<!-- Days grid -->
|
|
1219
|
+
<div class="dp-days">
|
|
1220
|
+
@for (day of calendarDays(); track day.date?.getTime() ?? $index) {
|
|
1221
|
+
<button
|
|
1222
|
+
class="dp-day"
|
|
1223
|
+
[class.other-month]="!day.current"
|
|
1224
|
+
[class.today]="day.isToday"
|
|
1225
|
+
[class.selected]="day.isSelected"
|
|
1226
|
+
[class.disabled]="day.disabled"
|
|
1227
|
+
[disabled]="day.disabled || !day.date"
|
|
1228
|
+
(click)="selectDay(day.date)"
|
|
1229
|
+
>{{ day.label }}</button>
|
|
1230
|
+
}
|
|
1231
|
+
</div>
|
|
1232
|
+
<!-- Footer -->
|
|
1233
|
+
<div class="dp-footer">
|
|
1234
|
+
<button class="dp-today-btn" (click)="selectToday()">Today</button>
|
|
1235
|
+
<button class="dp-clear-btn" (click)="clearValue()">Clear</button>
|
|
1236
|
+
</div>
|
|
1237
|
+
</div>
|
|
1238
|
+
}
|
|
1239
|
+
</div>
|
|
1240
|
+
`, isInline: true, styles: [":host{display:block}.ngx-date-picker{position:relative;font-family:inherit}.dp-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.dp-input-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;transition:border-color .15s,box-shadow .15s}.dp-input-wrap:hover{border-color:#adb5bd}.open .dp-input-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .dp-input-wrap{background:#f8f9fa;cursor:not-allowed}.dp-input{flex:1;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);cursor:pointer;font-family:inherit}.dp-icon{padding:0 12px;color:#6c757d}.dp-popup{position:absolute;top:calc(100% + 4px);left:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;padding:12px;width:260px}.dp-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.dp-nav-btn{background:none;border:none;cursor:pointer;font-size:20px;color:#6c757d;padding:2px 8px;border-radius:3px;line-height:1}.dp-nav-btn:hover{background:#f1f3f5}.dp-nav-title{font-size:14px;font-weight:600;color:var(--ngx-input-text, #212529)}.dp-weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-bottom:4px}.dp-wd{text-align:center;font-size:11px;color:#adb5bd;font-weight:600;padding:4px 0}.dp-days{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}.dp-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:13px;border:none;background:none;cursor:pointer;border-radius:50%;color:var(--ngx-input-text, #212529);transition:background .1s}.dp-day:hover:not(.disabled):not(.selected){background:#f1f3f5}.dp-day.other-month{color:#ced4da}.dp-day.today{font-weight:700;color:var(--ngx-input-focus, #4a90d9)}.dp-day.selected{background:var(--ngx-input-focus, #4a90d9);color:#fff}.dp-day.disabled{color:#ced4da;cursor:not-allowed}.dp-footer{display:flex;justify-content:space-between;margin-top:8px;padding-top:8px;border-top:1px solid #f1f3f5}.dp-today-btn,.dp-clear-btn{background:none;border:none;cursor:pointer;font-size:12px;color:var(--ngx-input-focus, #4a90d9);padding:4px 8px;border-radius:3px;font-family:inherit}.dp-today-btn:hover,.dp-clear-btn:hover{background:#f1f3f5}.dp-clear-btn{color:#6c757d}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1241
|
+
}
|
|
1242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DatePickerComponent, decorators: [{
|
|
1243
|
+
type: Component,
|
|
1244
|
+
args: [{ selector: 'ngx-date-picker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1245
|
+
{
|
|
1246
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1247
|
+
useExisting: forwardRef(() => DatePickerComponent),
|
|
1248
|
+
multi: true,
|
|
1249
|
+
},
|
|
1250
|
+
], template: `
|
|
1251
|
+
<div class="ngx-date-picker" [class.open]="isOpen()" [class.disabled]="disabled()">
|
|
1252
|
+
@if (label()) {
|
|
1253
|
+
<label class="dp-label">{{ label() }}</label>
|
|
1254
|
+
}
|
|
1255
|
+
<!-- Input trigger -->
|
|
1256
|
+
<div class="dp-input-wrap" (click)="toggle()">
|
|
1257
|
+
<input
|
|
1258
|
+
class="dp-input"
|
|
1259
|
+
readonly
|
|
1260
|
+
[value]="displayValue()"
|
|
1261
|
+
[placeholder]="placeholder()"
|
|
1262
|
+
[disabled]="disabled()"
|
|
1263
|
+
/>
|
|
1264
|
+
<span class="dp-icon">📅</span>
|
|
1265
|
+
</div>
|
|
1266
|
+
|
|
1267
|
+
<!-- Calendar popup -->
|
|
1268
|
+
@if (isOpen()) {
|
|
1269
|
+
<div class="dp-popup" (click)="$event.stopPropagation()">
|
|
1270
|
+
<!-- Month/Year nav -->
|
|
1271
|
+
<div class="dp-nav">
|
|
1272
|
+
<button class="dp-nav-btn" (click)="prevMonth()">‹</button>
|
|
1273
|
+
<span class="dp-nav-title">{{ monthTitle() }}</span>
|
|
1274
|
+
<button class="dp-nav-btn" (click)="nextMonth()">›</button>
|
|
1275
|
+
</div>
|
|
1276
|
+
<!-- Weekday headers -->
|
|
1277
|
+
<div class="dp-weekdays">
|
|
1278
|
+
@for (d of WEEKDAYS; track d) {
|
|
1279
|
+
<span class="dp-wd">{{ d }}</span>
|
|
1280
|
+
}
|
|
1281
|
+
</div>
|
|
1282
|
+
<!-- Days grid -->
|
|
1283
|
+
<div class="dp-days">
|
|
1284
|
+
@for (day of calendarDays(); track day.date?.getTime() ?? $index) {
|
|
1285
|
+
<button
|
|
1286
|
+
class="dp-day"
|
|
1287
|
+
[class.other-month]="!day.current"
|
|
1288
|
+
[class.today]="day.isToday"
|
|
1289
|
+
[class.selected]="day.isSelected"
|
|
1290
|
+
[class.disabled]="day.disabled"
|
|
1291
|
+
[disabled]="day.disabled || !day.date"
|
|
1292
|
+
(click)="selectDay(day.date)"
|
|
1293
|
+
>{{ day.label }}</button>
|
|
1294
|
+
}
|
|
1295
|
+
</div>
|
|
1296
|
+
<!-- Footer -->
|
|
1297
|
+
<div class="dp-footer">
|
|
1298
|
+
<button class="dp-today-btn" (click)="selectToday()">Today</button>
|
|
1299
|
+
<button class="dp-clear-btn" (click)="clearValue()">Clear</button>
|
|
1300
|
+
</div>
|
|
1301
|
+
</div>
|
|
1302
|
+
}
|
|
1303
|
+
</div>
|
|
1304
|
+
`, styles: [":host{display:block}.ngx-date-picker{position:relative;font-family:inherit}.dp-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.dp-input-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;transition:border-color .15s,box-shadow .15s}.dp-input-wrap:hover{border-color:#adb5bd}.open .dp-input-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .dp-input-wrap{background:#f8f9fa;cursor:not-allowed}.dp-input{flex:1;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);cursor:pointer;font-family:inherit}.dp-icon{padding:0 12px;color:#6c757d}.dp-popup{position:absolute;top:calc(100% + 4px);left:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;padding:12px;width:260px}.dp-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.dp-nav-btn{background:none;border:none;cursor:pointer;font-size:20px;color:#6c757d;padding:2px 8px;border-radius:3px;line-height:1}.dp-nav-btn:hover{background:#f1f3f5}.dp-nav-title{font-size:14px;font-weight:600;color:var(--ngx-input-text, #212529)}.dp-weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-bottom:4px}.dp-wd{text-align:center;font-size:11px;color:#adb5bd;font-weight:600;padding:4px 0}.dp-days{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}.dp-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:13px;border:none;background:none;cursor:pointer;border-radius:50%;color:var(--ngx-input-text, #212529);transition:background .1s}.dp-day:hover:not(.disabled):not(.selected){background:#f1f3f5}.dp-day.other-month{color:#ced4da}.dp-day.today{font-weight:700;color:var(--ngx-input-focus, #4a90d9)}.dp-day.selected{background:var(--ngx-input-focus, #4a90d9);color:#fff}.dp-day.disabled{color:#ced4da;cursor:not-allowed}.dp-footer{display:flex;justify-content:space-between;margin-top:8px;padding-top:8px;border-top:1px solid #f1f3f5}.dp-today-btn,.dp-clear-btn{background:none;border:none;cursor:pointer;font-size:12px;color:var(--ngx-input-focus, #4a90d9);padding:4px 8px;border-radius:3px;font-family:inherit}.dp-today-btn:hover,.dp-clear-btn:hover{background:#f1f3f5}.dp-clear-btn{color:#6c757d}\n"] }]
|
|
1305
|
+
}], propDecorators: { onDocClick: [{
|
|
1306
|
+
type: HostListener,
|
|
1307
|
+
args: ['document:click', ['$event']]
|
|
1308
|
+
}] } });
|
|
1309
|
+
|
|
1310
|
+
class SliderComponent {
|
|
1311
|
+
label = input('');
|
|
1312
|
+
min = input(0);
|
|
1313
|
+
max = input(100);
|
|
1314
|
+
step = input(1);
|
|
1315
|
+
value = signal(0);
|
|
1316
|
+
low = signal(20);
|
|
1317
|
+
high = signal(80);
|
|
1318
|
+
range = input(false);
|
|
1319
|
+
disabled = input(false);
|
|
1320
|
+
showValue = input(true);
|
|
1321
|
+
showTicks = input(false);
|
|
1322
|
+
valueChange = output();
|
|
1323
|
+
rangeChange = output();
|
|
1324
|
+
pct = computed(() => {
|
|
1325
|
+
const min = this.min();
|
|
1326
|
+
const max = this.max();
|
|
1327
|
+
const denom = Math.max(1, max - min);
|
|
1328
|
+
return ((this.clamp(this.value(), min, max) - min) / denom) * 100;
|
|
1329
|
+
});
|
|
1330
|
+
lowPct = computed(() => {
|
|
1331
|
+
const min = this.min();
|
|
1332
|
+
const max = this.max();
|
|
1333
|
+
const denom = Math.max(1, max - min);
|
|
1334
|
+
return ((this.clamp(this.low(), min, max) - min) / denom) * 100;
|
|
1335
|
+
});
|
|
1336
|
+
highPct = computed(() => {
|
|
1337
|
+
const min = this.min();
|
|
1338
|
+
const max = this.max();
|
|
1339
|
+
const denom = Math.max(1, max - min);
|
|
1340
|
+
return 100 - (((this.clamp(this.high(), min, max) - min) / denom) * 100);
|
|
1341
|
+
});
|
|
1342
|
+
clamp(v, min, max) {
|
|
1343
|
+
return Math.min(max, Math.max(min, v));
|
|
1344
|
+
}
|
|
1345
|
+
stepSize() {
|
|
1346
|
+
const step = this.step();
|
|
1347
|
+
return Number.isFinite(step) && step > 0 ? step : 1;
|
|
1348
|
+
}
|
|
1349
|
+
onInput(e) {
|
|
1350
|
+
const target = e.target;
|
|
1351
|
+
const next = this.clamp(+target.value, this.min(), this.max());
|
|
1352
|
+
target.value = String(next);
|
|
1353
|
+
this.value.set(next);
|
|
1354
|
+
this.valueChange.emit(next);
|
|
1355
|
+
}
|
|
1356
|
+
onLow(e) {
|
|
1357
|
+
const target = e.target;
|
|
1358
|
+
const min = this.min();
|
|
1359
|
+
const max = this.max();
|
|
1360
|
+
const step = this.stepSize();
|
|
1361
|
+
const currentHigh = this.clamp(this.high(), min, max);
|
|
1362
|
+
const upperBound = this.clamp(currentHigh - step, min, max);
|
|
1363
|
+
const nextLow = this.clamp(+target.value, min, upperBound);
|
|
1364
|
+
target.value = String(nextLow);
|
|
1365
|
+
this.low.set(nextLow);
|
|
1366
|
+
if (currentHigh !== this.high()) {
|
|
1367
|
+
this.high.set(currentHigh);
|
|
1368
|
+
}
|
|
1369
|
+
this.rangeChange.emit([nextLow, currentHigh]);
|
|
1370
|
+
}
|
|
1371
|
+
onHigh(e) {
|
|
1372
|
+
const target = e.target;
|
|
1373
|
+
const min = this.min();
|
|
1374
|
+
const max = this.max();
|
|
1375
|
+
const step = this.stepSize();
|
|
1376
|
+
const currentLow = this.clamp(this.low(), min, max);
|
|
1377
|
+
const lowerBound = this.clamp(currentLow + step, min, max);
|
|
1378
|
+
const nextHigh = this.clamp(+target.value, lowerBound, max);
|
|
1379
|
+
target.value = String(nextHigh);
|
|
1380
|
+
this.high.set(nextHigh);
|
|
1381
|
+
if (currentLow !== this.low()) {
|
|
1382
|
+
this.low.set(currentLow);
|
|
1383
|
+
}
|
|
1384
|
+
this.rangeChange.emit([currentLow, nextHigh]);
|
|
1385
|
+
}
|
|
1386
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1387
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: SliderComponent, isStandalone: true, selector: "ngx-slider", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, range: { classPropertyName: "range", publicName: "range", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, showTicks: { classPropertyName: "showTicks", publicName: "showTicks", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", rangeChange: "rangeChange" }, ngImport: i0, template: `
|
|
1388
|
+
<div class="ngx-slider">
|
|
1389
|
+
@if (label()) { <label class="slider-label">{{ label() }}@if (showValue()) { <span class="slider-value">{{ range() ? (low() + ' – ' + high()) : value() }}</span> }</label> }
|
|
1390
|
+
<div class="slider-track-wrap">
|
|
1391
|
+
@if (!range()) {
|
|
1392
|
+
<input type="range" class="slider-input" [min]="min()" [max]="max()" [step]="step()" [value]="value()" [disabled]="disabled()" (input)="onInput($event)" />
|
|
1393
|
+
<div class="slider-fill" [style.width.%]="pct()"></div>
|
|
1394
|
+
} @else {
|
|
1395
|
+
<div class="slider-range-container">
|
|
1396
|
+
<input type="range" class="slider-input slider-low" [min]="min()" [max]="max()" [step]="step()" [value]="low()" [disabled]="disabled()" (input)="onLow($event)" />
|
|
1397
|
+
<input type="range" class="slider-input slider-high" [min]="min()" [max]="max()" [step]="step()" [value]="high()" [disabled]="disabled()" (input)="onHigh($event)" />
|
|
1398
|
+
<div class="slider-fill-range" [style.left.%]="lowPct()" [style.right.%]="highPct()"></div>
|
|
1399
|
+
</div>
|
|
1400
|
+
}
|
|
1401
|
+
</div>
|
|
1402
|
+
@if (showTicks()) {
|
|
1403
|
+
<div class="slider-ticks">
|
|
1404
|
+
<span>{{ min() }}</span><span>{{ max() }}</span>
|
|
1405
|
+
</div>
|
|
1406
|
+
}
|
|
1407
|
+
</div>
|
|
1408
|
+
`, isInline: true, styles: [":host{display:block}.ngx-slider{width:100%}.slider-label{display:flex;justify-content:space-between;font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057);margin-bottom:8px}.slider-value{font-weight:400;color:var(--ngx-input-text, #212529)}.slider-track-wrap{position:relative;padding:10px 0}.slider-input{width:100%;-webkit-appearance:none;appearance:none;height:5px;background:transparent;border-radius:4px;outline:none;cursor:pointer;position:relative;z-index:5}.slider-input::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;border-radius:50%;background:var(--ngx-slider-thumb, #1a73e8);cursor:pointer;box-shadow:0 2px 6px #1a73e84d;border:2px solid #fff;transition:all .2s ease}.slider-input::-webkit-slider-thumb:hover{box-shadow:0 3px 10px #1a73e866;transform:scale(1.1)}.slider-input::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:var(--ngx-slider-thumb, #1a73e8);cursor:pointer;box-shadow:0 2px 6px #1a73e84d;border:2px solid #fff;transition:all .2s ease}.slider-input::-moz-range-thumb:hover{box-shadow:0 3px 10px #1a73e866;transform:scale(1.1)}.slider-input::-moz-range-track{background:transparent;border:none}.slider-input:disabled{opacity:.5;cursor:not-allowed}.slider-range-container{position:relative;height:20px;margin:8px 0}.slider-range-container:before{content:\"\";position:absolute;height:5px;background:var(--ngx-slider-track, #dee2e6);border-radius:4px;width:100%;top:50%;left:0;transform:translateY(-50%);z-index:1}.slider-range-container .slider-input{position:absolute;top:50%;left:0;transform:translateY(-50%);margin:0}.slider-range-container .slider-input::-webkit-slider-runnable-track{height:5px;background:transparent;border:none}.slider-fill{position:absolute;height:5px;background:linear-gradient(90deg,var(--ngx-slider-thumb, #1a73e8),var(--ngx-slider-thumb, #1a73e8));border-radius:4px;bottom:10px;left:0;pointer-events:none;z-index:2}.slider-fill-range{position:absolute;height:5px;background:linear-gradient(90deg,var(--ngx-slider-thumb, #1a73e8),var(--ngx-slider-thumb, #1a73e8));border-radius:4px;top:50%;transform:translateY(-50%);pointer-events:none;z-index:3}.slider-input.slider-low{position:relative;z-index:5}.slider-input.slider-high{position:relative;z-index:4}.slider-ticks{display:flex;justify-content:space-between;font-size:10px;color:#adb5bd;margin-top:4px;padding:0 5px}\n"] });
|
|
1409
|
+
}
|
|
1410
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SliderComponent, decorators: [{
|
|
1411
|
+
type: Component,
|
|
1412
|
+
args: [{ selector: 'ngx-slider', standalone: true, template: `
|
|
1413
|
+
<div class="ngx-slider">
|
|
1414
|
+
@if (label()) { <label class="slider-label">{{ label() }}@if (showValue()) { <span class="slider-value">{{ range() ? (low() + ' – ' + high()) : value() }}</span> }</label> }
|
|
1415
|
+
<div class="slider-track-wrap">
|
|
1416
|
+
@if (!range()) {
|
|
1417
|
+
<input type="range" class="slider-input" [min]="min()" [max]="max()" [step]="step()" [value]="value()" [disabled]="disabled()" (input)="onInput($event)" />
|
|
1418
|
+
<div class="slider-fill" [style.width.%]="pct()"></div>
|
|
1419
|
+
} @else {
|
|
1420
|
+
<div class="slider-range-container">
|
|
1421
|
+
<input type="range" class="slider-input slider-low" [min]="min()" [max]="max()" [step]="step()" [value]="low()" [disabled]="disabled()" (input)="onLow($event)" />
|
|
1422
|
+
<input type="range" class="slider-input slider-high" [min]="min()" [max]="max()" [step]="step()" [value]="high()" [disabled]="disabled()" (input)="onHigh($event)" />
|
|
1423
|
+
<div class="slider-fill-range" [style.left.%]="lowPct()" [style.right.%]="highPct()"></div>
|
|
1424
|
+
</div>
|
|
1425
|
+
}
|
|
1426
|
+
</div>
|
|
1427
|
+
@if (showTicks()) {
|
|
1428
|
+
<div class="slider-ticks">
|
|
1429
|
+
<span>{{ min() }}</span><span>{{ max() }}</span>
|
|
1430
|
+
</div>
|
|
1431
|
+
}
|
|
1432
|
+
</div>
|
|
1433
|
+
`, styles: [":host{display:block}.ngx-slider{width:100%}.slider-label{display:flex;justify-content:space-between;font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057);margin-bottom:8px}.slider-value{font-weight:400;color:var(--ngx-input-text, #212529)}.slider-track-wrap{position:relative;padding:10px 0}.slider-input{width:100%;-webkit-appearance:none;appearance:none;height:5px;background:transparent;border-radius:4px;outline:none;cursor:pointer;position:relative;z-index:5}.slider-input::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;border-radius:50%;background:var(--ngx-slider-thumb, #1a73e8);cursor:pointer;box-shadow:0 2px 6px #1a73e84d;border:2px solid #fff;transition:all .2s ease}.slider-input::-webkit-slider-thumb:hover{box-shadow:0 3px 10px #1a73e866;transform:scale(1.1)}.slider-input::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:var(--ngx-slider-thumb, #1a73e8);cursor:pointer;box-shadow:0 2px 6px #1a73e84d;border:2px solid #fff;transition:all .2s ease}.slider-input::-moz-range-thumb:hover{box-shadow:0 3px 10px #1a73e866;transform:scale(1.1)}.slider-input::-moz-range-track{background:transparent;border:none}.slider-input:disabled{opacity:.5;cursor:not-allowed}.slider-range-container{position:relative;height:20px;margin:8px 0}.slider-range-container:before{content:\"\";position:absolute;height:5px;background:var(--ngx-slider-track, #dee2e6);border-radius:4px;width:100%;top:50%;left:0;transform:translateY(-50%);z-index:1}.slider-range-container .slider-input{position:absolute;top:50%;left:0;transform:translateY(-50%);margin:0}.slider-range-container .slider-input::-webkit-slider-runnable-track{height:5px;background:transparent;border:none}.slider-fill{position:absolute;height:5px;background:linear-gradient(90deg,var(--ngx-slider-thumb, #1a73e8),var(--ngx-slider-thumb, #1a73e8));border-radius:4px;bottom:10px;left:0;pointer-events:none;z-index:2}.slider-fill-range{position:absolute;height:5px;background:linear-gradient(90deg,var(--ngx-slider-thumb, #1a73e8),var(--ngx-slider-thumb, #1a73e8));border-radius:4px;top:50%;transform:translateY(-50%);pointer-events:none;z-index:3}.slider-input.slider-low{position:relative;z-index:5}.slider-input.slider-high{position:relative;z-index:4}.slider-ticks{display:flex;justify-content:space-between;font-size:10px;color:#adb5bd;margin-top:4px;padding:0 5px}\n"] }]
|
|
1434
|
+
}] });
|
|
1435
|
+
|
|
1436
|
+
class SwitchComponent {
|
|
1437
|
+
checked = signal(false);
|
|
1438
|
+
onLabel = input('On');
|
|
1439
|
+
offLabel = input('Off');
|
|
1440
|
+
size = input('md');
|
|
1441
|
+
disabled = input(false);
|
|
1442
|
+
checkedChange = output();
|
|
1443
|
+
toggle() { this.checked.update(v => !v); this.checkedChange.emit(this.checked()); }
|
|
1444
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1445
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.20", type: SwitchComponent, isStandalone: true, selector: "ngx-switch", inputs: { onLabel: { classPropertyName: "onLabel", publicName: "onLabel", isSignal: true, isRequired: false, transformFunction: null }, offLabel: { classPropertyName: "offLabel", publicName: "offLabel", 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 } }, outputs: { checkedChange: "checkedChange" }, ngImport: i0, template: `
|
|
1446
|
+
<label class="ngx-switch" [class.switch-disabled]="disabled()">
|
|
1447
|
+
<span class="switch-off-label">{{ offLabel() }}</span>
|
|
1448
|
+
<span class="switch-track" [class.checked]="checked()" [class]="'size-' + size()" (click)="toggle()">
|
|
1449
|
+
<span class="switch-thumb"></span>
|
|
1450
|
+
</span>
|
|
1451
|
+
<span class="switch-on-label">{{ onLabel() }}</span>
|
|
1452
|
+
</label>
|
|
1453
|
+
`, isInline: true, styles: [":host{display:inline-block}.ngx-switch{display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none}.switch-disabled{opacity:.5;pointer-events:none}.switch-track{position:relative;border-radius:999px;background:var(--ngx-switch-off, #dee2e6);transition:background .2s;flex-shrink:0;cursor:pointer}.switch-track.size-sm{width:32px;height:18px}.switch-track.size-md{width:42px;height:24px}.switch-track.size-lg{width:54px;height:30px}.switch-track.checked{background:var(--ngx-switch-on, #1a73e8)}.switch-thumb{position:absolute;top:2px;left:2px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #0003;transition:transform .2s;pointer-events:none}.size-sm .switch-thumb{width:14px;height:14px}.size-md .switch-thumb{width:20px;height:20px}.size-lg .switch-thumb{width:26px;height:26px}.size-sm.checked .switch-thumb{transform:translate(14px)}.size-md.checked .switch-thumb{transform:translate(18px)}.size-lg.checked .switch-thumb{transform:translate(24px)}.switch-off-label,.switch-on-label{font-size:13px;color:var(--ngx-input-label, #495057)}\n"] });
|
|
1454
|
+
}
|
|
1455
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SwitchComponent, decorators: [{
|
|
1456
|
+
type: Component,
|
|
1457
|
+
args: [{ selector: 'ngx-switch', standalone: true, template: `
|
|
1458
|
+
<label class="ngx-switch" [class.switch-disabled]="disabled()">
|
|
1459
|
+
<span class="switch-off-label">{{ offLabel() }}</span>
|
|
1460
|
+
<span class="switch-track" [class.checked]="checked()" [class]="'size-' + size()" (click)="toggle()">
|
|
1461
|
+
<span class="switch-thumb"></span>
|
|
1462
|
+
</span>
|
|
1463
|
+
<span class="switch-on-label">{{ onLabel() }}</span>
|
|
1464
|
+
</label>
|
|
1465
|
+
`, styles: [":host{display:inline-block}.ngx-switch{display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none}.switch-disabled{opacity:.5;pointer-events:none}.switch-track{position:relative;border-radius:999px;background:var(--ngx-switch-off, #dee2e6);transition:background .2s;flex-shrink:0;cursor:pointer}.switch-track.size-sm{width:32px;height:18px}.switch-track.size-md{width:42px;height:24px}.switch-track.size-lg{width:54px;height:30px}.switch-track.checked{background:var(--ngx-switch-on, #1a73e8)}.switch-thumb{position:absolute;top:2px;left:2px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #0003;transition:transform .2s;pointer-events:none}.size-sm .switch-thumb{width:14px;height:14px}.size-md .switch-thumb{width:20px;height:20px}.size-lg .switch-thumb{width:26px;height:26px}.size-sm.checked .switch-thumb{transform:translate(14px)}.size-md.checked .switch-thumb{transform:translate(18px)}.size-lg.checked .switch-thumb{transform:translate(24px)}.switch-off-label,.switch-on-label{font-size:13px;color:var(--ngx-input-label, #495057)}\n"] }]
|
|
1466
|
+
}] });
|
|
1467
|
+
|
|
1468
|
+
class RatingComponent {
|
|
1469
|
+
max = input(5);
|
|
1470
|
+
label = input('');
|
|
1471
|
+
readonly = input(false);
|
|
1472
|
+
showValue = input(false);
|
|
1473
|
+
current = signal(0);
|
|
1474
|
+
hovered = signal(0);
|
|
1475
|
+
ratingChange = output();
|
|
1476
|
+
stars = () => Array.from({ length: this.max() }, (_, i) => i + 1);
|
|
1477
|
+
setRating(star) { if (!this.readonly()) {
|
|
1478
|
+
this.current.set(star);
|
|
1479
|
+
this.ratingChange.emit(star);
|
|
1480
|
+
} }
|
|
1481
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: RatingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1482
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: RatingComponent, isStandalone: true, selector: "ngx-rating", inputs: { max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ratingChange: "ratingChange" }, ngImport: i0, template: `
|
|
1483
|
+
<div class="ngx-rating" [attr.aria-label]="label() + ' rating: ' + current() + ' of ' + max()">
|
|
1484
|
+
@if (label()) { <span class="rating-label">{{ label() }}</span> }
|
|
1485
|
+
<div class="rating-stars">
|
|
1486
|
+
@for (star of stars(); track star) {
|
|
1487
|
+
<button
|
|
1488
|
+
class="rating-star"
|
|
1489
|
+
[class.filled]="(hovered() || current()) >= star"
|
|
1490
|
+
[class.hovered]="hovered() >= star"
|
|
1491
|
+
[disabled]="readonly()"
|
|
1492
|
+
type="button"
|
|
1493
|
+
[attr.aria-label]="'Rate ' + star"
|
|
1494
|
+
(mouseenter)="hovered.set(star)"
|
|
1495
|
+
(mouseleave)="hovered.set(0)"
|
|
1496
|
+
(click)="setRating(star)"
|
|
1497
|
+
>{{ (hovered() || current()) >= star ? '★' : '☆' }}</button>
|
|
1498
|
+
}
|
|
1499
|
+
</div>
|
|
1500
|
+
@if (showValue()) { <span class="rating-value">{{ current() }}/{{ max() }}</span> }
|
|
1501
|
+
</div>
|
|
1502
|
+
`, isInline: true, styles: [":host{display:inline-block}.ngx-rating{display:inline-flex;align-items:center;gap:8px}.rating-label{font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057)}.rating-stars{display:flex;gap:2px}.rating-star{background:none;border:none;cursor:pointer;font-size:22px;padding:0;line-height:1;color:var(--ngx-rating-empty, #dee2e6);transition:color .1s,transform .1s}.rating-star.filled{color:var(--ngx-rating-filled, #f39c12)}.rating-star.hovered{color:var(--ngx-rating-hover, #f1c40f);transform:scale(1.15)}.rating-star:disabled{cursor:default}.rating-value{font-size:12px;color:#6c757d}\n"] });
|
|
1503
|
+
}
|
|
1504
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: RatingComponent, decorators: [{
|
|
1505
|
+
type: Component,
|
|
1506
|
+
args: [{ selector: 'ngx-rating', standalone: true, template: `
|
|
1507
|
+
<div class="ngx-rating" [attr.aria-label]="label() + ' rating: ' + current() + ' of ' + max()">
|
|
1508
|
+
@if (label()) { <span class="rating-label">{{ label() }}</span> }
|
|
1509
|
+
<div class="rating-stars">
|
|
1510
|
+
@for (star of stars(); track star) {
|
|
1511
|
+
<button
|
|
1512
|
+
class="rating-star"
|
|
1513
|
+
[class.filled]="(hovered() || current()) >= star"
|
|
1514
|
+
[class.hovered]="hovered() >= star"
|
|
1515
|
+
[disabled]="readonly()"
|
|
1516
|
+
type="button"
|
|
1517
|
+
[attr.aria-label]="'Rate ' + star"
|
|
1518
|
+
(mouseenter)="hovered.set(star)"
|
|
1519
|
+
(mouseleave)="hovered.set(0)"
|
|
1520
|
+
(click)="setRating(star)"
|
|
1521
|
+
>{{ (hovered() || current()) >= star ? '★' : '☆' }}</button>
|
|
1522
|
+
}
|
|
1523
|
+
</div>
|
|
1524
|
+
@if (showValue()) { <span class="rating-value">{{ current() }}/{{ max() }}</span> }
|
|
1525
|
+
</div>
|
|
1526
|
+
`, styles: [":host{display:inline-block}.ngx-rating{display:inline-flex;align-items:center;gap:8px}.rating-label{font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057)}.rating-stars{display:flex;gap:2px}.rating-star{background:none;border:none;cursor:pointer;font-size:22px;padding:0;line-height:1;color:var(--ngx-rating-empty, #dee2e6);transition:color .1s,transform .1s}.rating-star.filled{color:var(--ngx-rating-filled, #f39c12)}.rating-star.hovered{color:var(--ngx-rating-hover, #f1c40f);transform:scale(1.15)}.rating-star:disabled{cursor:default}.rating-value{font-size:12px;color:#6c757d}\n"] }]
|
|
1527
|
+
}] });
|
|
1528
|
+
|
|
1529
|
+
class NumericTextBoxComponent {
|
|
1530
|
+
label = input('');
|
|
1531
|
+
min = input(-Infinity);
|
|
1532
|
+
max = input(Infinity);
|
|
1533
|
+
step = input(1);
|
|
1534
|
+
value = signal(0);
|
|
1535
|
+
disabled = input(false);
|
|
1536
|
+
placeholder = input('');
|
|
1537
|
+
prefix = input('');
|
|
1538
|
+
suffix = input('');
|
|
1539
|
+
focused = signal(false);
|
|
1540
|
+
valueChange = output();
|
|
1541
|
+
onChange(e) { const v = +e.target.value; this.setValue(v); }
|
|
1542
|
+
spin(dir) { this.setValue(this.value() + dir * this.step()); }
|
|
1543
|
+
setValue(v) { const clamped = Math.max(this.min(), Math.min(this.max(), v)); this.value.set(clamped); this.valueChange.emit(clamped); }
|
|
1544
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NumericTextBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1545
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: NumericTextBoxComponent, isStandalone: true, selector: "ngx-numeric-textbox", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", 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 }, prefix: { classPropertyName: "prefix", publicName: "prefix", isSignal: true, isRequired: false, transformFunction: null }, suffix: { classPropertyName: "suffix", publicName: "suffix", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
|
|
1546
|
+
<div class="ngx-numeric" [class.disabled]="disabled()">
|
|
1547
|
+
@if (label()) { <label class="numeric-label">{{ label() }}</label> }
|
|
1548
|
+
<div class="numeric-input-wrap" [class.focused]="focused()">
|
|
1549
|
+
@if (prefix()) { <span class="numeric-prefix">{{ prefix() }}</span> }
|
|
1550
|
+
<input
|
|
1551
|
+
type="number" class="numeric-input"
|
|
1552
|
+
[min]="min()" [max]="max()" [step]="step()"
|
|
1553
|
+
[value]="value()" [disabled]="disabled()" [placeholder]="placeholder()"
|
|
1554
|
+
(focus)="focused.set(true)" (blur)="focused.set(false)"
|
|
1555
|
+
(change)="onChange($event)"
|
|
1556
|
+
/>
|
|
1557
|
+
@if (suffix()) { <span class="numeric-suffix">{{ suffix() }}</span> }
|
|
1558
|
+
<div class="numeric-spin">
|
|
1559
|
+
<button class="spin-btn" type="button" [disabled]="disabled() || value() >= max()" (click)="spin(1)">▲</button>
|
|
1560
|
+
<button class="spin-btn" type="button" [disabled]="disabled() || value() <= min()" (click)="spin(-1)">▼</button>
|
|
1561
|
+
</div>
|
|
1562
|
+
</div>
|
|
1563
|
+
</div>
|
|
1564
|
+
`, isInline: true, styles: [":host{display:block}.ngx-numeric{width:100%}.numeric-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057);margin-bottom:4px}.numeric-input-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 6px);background:var(--ngx-input-bg, #fff);overflow:hidden;transition:border-color .15s}.numeric-input-wrap.focused{border-color:var(--ngx-input-focus, #1a73e8);box-shadow:0 0 0 2px #1a73e826}.disabled .numeric-input-wrap{opacity:.5}.numeric-input{flex:1;padding:8px 10px;border:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);outline:none;min-width:0;-moz-appearance:textfield}.numeric-input::-webkit-outer-spin-button,.numeric-input::-webkit-inner-spin-button{-webkit-appearance:none}.numeric-prefix,.numeric-suffix{padding:0 8px;color:#6c757d;font-size:12px;flex-shrink:0}.numeric-spin{display:flex;flex-direction:column;border-left:1px solid var(--ngx-input-border, #ced4da)}.spin-btn{border:none;background:transparent;cursor:pointer;font-size:8px;padding:3px 7px;color:#6c757d;flex:1;line-height:1}.spin-btn:hover:not(:disabled){background:#f1f3f5}.spin-btn:disabled{opacity:.4;cursor:not-allowed}\n"] });
|
|
1565
|
+
}
|
|
1566
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NumericTextBoxComponent, decorators: [{
|
|
1567
|
+
type: Component,
|
|
1568
|
+
args: [{ selector: 'ngx-numeric-textbox', standalone: true, template: `
|
|
1569
|
+
<div class="ngx-numeric" [class.disabled]="disabled()">
|
|
1570
|
+
@if (label()) { <label class="numeric-label">{{ label() }}</label> }
|
|
1571
|
+
<div class="numeric-input-wrap" [class.focused]="focused()">
|
|
1572
|
+
@if (prefix()) { <span class="numeric-prefix">{{ prefix() }}</span> }
|
|
1573
|
+
<input
|
|
1574
|
+
type="number" class="numeric-input"
|
|
1575
|
+
[min]="min()" [max]="max()" [step]="step()"
|
|
1576
|
+
[value]="value()" [disabled]="disabled()" [placeholder]="placeholder()"
|
|
1577
|
+
(focus)="focused.set(true)" (blur)="focused.set(false)"
|
|
1578
|
+
(change)="onChange($event)"
|
|
1579
|
+
/>
|
|
1580
|
+
@if (suffix()) { <span class="numeric-suffix">{{ suffix() }}</span> }
|
|
1581
|
+
<div class="numeric-spin">
|
|
1582
|
+
<button class="spin-btn" type="button" [disabled]="disabled() || value() >= max()" (click)="spin(1)">▲</button>
|
|
1583
|
+
<button class="spin-btn" type="button" [disabled]="disabled() || value() <= min()" (click)="spin(-1)">▼</button>
|
|
1584
|
+
</div>
|
|
1585
|
+
</div>
|
|
1586
|
+
</div>
|
|
1587
|
+
`, styles: [":host{display:block}.ngx-numeric{width:100%}.numeric-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057);margin-bottom:4px}.numeric-input-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 6px);background:var(--ngx-input-bg, #fff);overflow:hidden;transition:border-color .15s}.numeric-input-wrap.focused{border-color:var(--ngx-input-focus, #1a73e8);box-shadow:0 0 0 2px #1a73e826}.disabled .numeric-input-wrap{opacity:.5}.numeric-input{flex:1;padding:8px 10px;border:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);outline:none;min-width:0;-moz-appearance:textfield}.numeric-input::-webkit-outer-spin-button,.numeric-input::-webkit-inner-spin-button{-webkit-appearance:none}.numeric-prefix,.numeric-suffix{padding:0 8px;color:#6c757d;font-size:12px;flex-shrink:0}.numeric-spin{display:flex;flex-direction:column;border-left:1px solid var(--ngx-input-border, #ced4da)}.spin-btn{border:none;background:transparent;cursor:pointer;font-size:8px;padding:3px 7px;color:#6c757d;flex:1;line-height:1}.spin-btn:hover:not(:disabled){background:#f1f3f5}.spin-btn:disabled{opacity:.4;cursor:not-allowed}\n"] }]
|
|
1588
|
+
}] });
|
|
1589
|
+
|
|
1590
|
+
class TextareaComponent {
|
|
1591
|
+
label = input('');
|
|
1592
|
+
placeholder = input('');
|
|
1593
|
+
rows = input(4);
|
|
1594
|
+
maxlength = input(0);
|
|
1595
|
+
disabled = input(false);
|
|
1596
|
+
autoResize = input(false);
|
|
1597
|
+
hint = input('');
|
|
1598
|
+
error = input('');
|
|
1599
|
+
value = signal('');
|
|
1600
|
+
focused = signal(false);
|
|
1601
|
+
charCount = computed(() => this.value().length);
|
|
1602
|
+
valueChange = output();
|
|
1603
|
+
onInput(e) { const v = e.target.value; this.value.set(v); this.valueChange.emit(v); }
|
|
1604
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1605
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: TextareaComponent, isStandalone: true, selector: "ngx-textarea", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, autoResize: { classPropertyName: "autoResize", publicName: "autoResize", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
|
|
1606
|
+
<div class="ngx-textarea-wrap" [class.has-error]="error()">
|
|
1607
|
+
@if (label()) { <label class="textarea-label">{{ label() }}</label> }
|
|
1608
|
+
<textarea
|
|
1609
|
+
class="ngx-textarea"
|
|
1610
|
+
[rows]="rows()"
|
|
1611
|
+
[placeholder]="placeholder()"
|
|
1612
|
+
[disabled]="disabled()"
|
|
1613
|
+
[attr.maxlength]="maxlength() > 0 ? maxlength() : null"
|
|
1614
|
+
[value]="value()"
|
|
1615
|
+
[class.auto-resize]="autoResize()"
|
|
1616
|
+
(input)="onInput($event)"
|
|
1617
|
+
(focus)="focused.set(true)"
|
|
1618
|
+
(blur)="focused.set(false)"
|
|
1619
|
+
></textarea>
|
|
1620
|
+
<div class="textarea-footer">
|
|
1621
|
+
@if (error()) { <span class="textarea-error">{{ error() }}</span> }
|
|
1622
|
+
@else if (hint()) { <span class="textarea-hint">{{ hint() }}</span> }
|
|
1623
|
+
@else { <span></span> }
|
|
1624
|
+
@if (maxlength() > 0) { <span class="textarea-counter" [class.near-limit]="charCount() > maxlength() * 0.8">{{ charCount() }}/{{ maxlength() }}</span> }
|
|
1625
|
+
</div>
|
|
1626
|
+
</div>
|
|
1627
|
+
`, isInline: true, styles: [":host{display:block}.ngx-textarea-wrap{width:100%}.textarea-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057);margin-bottom:4px}.ngx-textarea{width:100%;padding:10px 12px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 6px);background:var(--ngx-input-bg, #fff);color:var(--ngx-input-text, #212529);font-size:14px;font-family:inherit;resize:vertical;transition:border-color .15s;outline:none;box-sizing:border-box}.ngx-textarea:focus{border-color:var(--ngx-input-focus, #1a73e8);box-shadow:0 0 0 2px #1a73e826}.ngx-textarea:disabled{opacity:.5;cursor:not-allowed}.has-error .ngx-textarea{border-color:var(--ngx-input-error, #e74c3c)}.textarea-footer{display:flex;justify-content:space-between;align-items:center;margin-top:4px;font-size:11px}.textarea-error{color:var(--ngx-input-error, #e74c3c)}.textarea-hint,.textarea-counter{color:#6c757d}.textarea-counter.near-limit{color:#e74c3c}\n"] });
|
|
1628
|
+
}
|
|
1629
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TextareaComponent, decorators: [{
|
|
1630
|
+
type: Component,
|
|
1631
|
+
args: [{ selector: 'ngx-textarea', standalone: true, template: `
|
|
1632
|
+
<div class="ngx-textarea-wrap" [class.has-error]="error()">
|
|
1633
|
+
@if (label()) { <label class="textarea-label">{{ label() }}</label> }
|
|
1634
|
+
<textarea
|
|
1635
|
+
class="ngx-textarea"
|
|
1636
|
+
[rows]="rows()"
|
|
1637
|
+
[placeholder]="placeholder()"
|
|
1638
|
+
[disabled]="disabled()"
|
|
1639
|
+
[attr.maxlength]="maxlength() > 0 ? maxlength() : null"
|
|
1640
|
+
[value]="value()"
|
|
1641
|
+
[class.auto-resize]="autoResize()"
|
|
1642
|
+
(input)="onInput($event)"
|
|
1643
|
+
(focus)="focused.set(true)"
|
|
1644
|
+
(blur)="focused.set(false)"
|
|
1645
|
+
></textarea>
|
|
1646
|
+
<div class="textarea-footer">
|
|
1647
|
+
@if (error()) { <span class="textarea-error">{{ error() }}</span> }
|
|
1648
|
+
@else if (hint()) { <span class="textarea-hint">{{ hint() }}</span> }
|
|
1649
|
+
@else { <span></span> }
|
|
1650
|
+
@if (maxlength() > 0) { <span class="textarea-counter" [class.near-limit]="charCount() > maxlength() * 0.8">{{ charCount() }}/{{ maxlength() }}</span> }
|
|
1651
|
+
</div>
|
|
1652
|
+
</div>
|
|
1653
|
+
`, styles: [":host{display:block}.ngx-textarea-wrap{width:100%}.textarea-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057);margin-bottom:4px}.ngx-textarea{width:100%;padding:10px 12px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 6px);background:var(--ngx-input-bg, #fff);color:var(--ngx-input-text, #212529);font-size:14px;font-family:inherit;resize:vertical;transition:border-color .15s;outline:none;box-sizing:border-box}.ngx-textarea:focus{border-color:var(--ngx-input-focus, #1a73e8);box-shadow:0 0 0 2px #1a73e826}.ngx-textarea:disabled{opacity:.5;cursor:not-allowed}.has-error .ngx-textarea{border-color:var(--ngx-input-error, #e74c3c)}.textarea-footer{display:flex;justify-content:space-between;align-items:center;margin-top:4px;font-size:11px}.textarea-error{color:var(--ngx-input-error, #e74c3c)}.textarea-hint,.textarea-counter{color:#6c757d}.textarea-counter.near-limit{color:#e74c3c}\n"] }]
|
|
1654
|
+
}] });
|
|
1655
|
+
|
|
1656
|
+
const COLORS = [
|
|
1657
|
+
'#000000', '#434343', '#666666', '#999999', '#b7b7b7', '#cccccc', '#d9d9d9', '#ffffff',
|
|
1658
|
+
'#ff0000', '#ff9900', '#ffff00', '#00ff00', '#00ffff', '#4a86e8', '#0000ff', '#9900ff',
|
|
1659
|
+
'#ff00ff', '#e06666', '#f6b26b', '#ffd966', '#93c47d', '#76d7ea', '#6fa8dc', '#8e7cc3',
|
|
1660
|
+
'#c27ba0', '#ea9999', '#f9cb9c', '#ffe599', '#b6d7a8', '#a2c4c9', '#9fc5e8', '#b4a7d6',
|
|
1661
|
+
];
|
|
1662
|
+
class ColorPickerComponent {
|
|
1663
|
+
label = input('');
|
|
1664
|
+
value = signal('#1a73e8');
|
|
1665
|
+
open = signal(false);
|
|
1666
|
+
colorChange = output();
|
|
1667
|
+
colors = COLORS;
|
|
1668
|
+
pick(color) { this.value.set(color); this.colorChange.emit(color); this.open.set(false); }
|
|
1669
|
+
onHexInput(e) { const v = e.target.value; if (/^[0-9a-fA-F]{6}$/.test(v))
|
|
1670
|
+
this.pick('#' + v); }
|
|
1671
|
+
toggleOpen() { this.open.update(v => !v); }
|
|
1672
|
+
onNativeInput(e) { const v = e.target.value; if (v)
|
|
1673
|
+
this.pick(v); }
|
|
1674
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1675
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: ColorPickerComponent, isStandalone: true, selector: "ngx-color-picker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { colorChange: "colorChange" }, ngImport: i0, template: `
|
|
1676
|
+
<div class="ngx-color-picker">
|
|
1677
|
+
@if (label()) { <label class="cp-label">{{ label() }}</label> }
|
|
1678
|
+
<div class="cp-trigger" (click)="toggleOpen()">
|
|
1679
|
+
<span class="cp-swatch" [style.background]="value()"></span>
|
|
1680
|
+
<span class="cp-hex">{{ value() }}</span>
|
|
1681
|
+
<span class="cp-arrow">▾</span>
|
|
1682
|
+
</div>
|
|
1683
|
+
@if (open()) {
|
|
1684
|
+
<div class="cp-panel">
|
|
1685
|
+
<div class="cp-swatches">
|
|
1686
|
+
@for (c of colors; track c) {
|
|
1687
|
+
<button class="cp-swatch-btn" [style.background]="c" [class.selected]="value() === c" [attr.title]="c" (click)="pick(c)"></button>
|
|
1688
|
+
}
|
|
1689
|
+
</div>
|
|
1690
|
+
<div class="cp-hex-row">
|
|
1691
|
+
<span class="cp-hex-label">#</span>
|
|
1692
|
+
<input class="cp-hex-input" type="text" [value]="value().replace('#','')" maxlength="6" placeholder="rrggbb" (change)="onHexInput($event)" />
|
|
1693
|
+
<input class="cp-native" type="color" [value]="value()" (input)="onNativeInput($event)" />
|
|
1694
|
+
</div>
|
|
1695
|
+
</div>
|
|
1696
|
+
}
|
|
1697
|
+
</div>
|
|
1698
|
+
`, isInline: true, styles: [":host{display:inline-block;position:relative}.ngx-color-picker{position:relative}.cp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057);margin-bottom:4px}.cp-trigger{display:inline-flex;align-items:center;gap:8px;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 6px);cursor:pointer;background:var(--ngx-input-bg, #fff);font-size:13px}.cp-swatch{width:18px;height:18px;border-radius:3px;border:1px solid rgba(0,0,0,.15);flex-shrink:0}.cp-hex{color:var(--ngx-input-text, #212529);font-family:monospace}.cp-arrow{font-size:10px;color:#6c757d}.cp-panel{position:absolute;top:calc(100% + 4px);left:0;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:8px;box-shadow:0 8px 32px #00000026;z-index:1000;padding:12px;min-width:200px}.cp-swatches{display:grid;grid-template-columns:repeat(8,1fr);gap:4px;margin-bottom:10px}.cp-swatch-btn{width:20px;height:20px;border:1px solid rgba(0,0,0,.12);border-radius:3px;cursor:pointer;padding:0}.cp-swatch-btn.selected{outline:2px solid #1a73e8;outline-offset:1px}.cp-hex-row{display:flex;align-items:center;gap:4px}.cp-hex-label{color:#6c757d;font-weight:600}.cp-hex-input{flex:1;padding:5px 8px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:4px;font-size:13px;font-family:monospace;outline:none}.cp-native{width:28px;height:28px;border:none;padding:0;cursor:pointer;background:none;border-radius:4px}\n"] });
|
|
1699
|
+
}
|
|
1700
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ColorPickerComponent, decorators: [{
|
|
1701
|
+
type: Component,
|
|
1702
|
+
args: [{ selector: 'ngx-color-picker', standalone: true, template: `
|
|
1703
|
+
<div class="ngx-color-picker">
|
|
1704
|
+
@if (label()) { <label class="cp-label">{{ label() }}</label> }
|
|
1705
|
+
<div class="cp-trigger" (click)="toggleOpen()">
|
|
1706
|
+
<span class="cp-swatch" [style.background]="value()"></span>
|
|
1707
|
+
<span class="cp-hex">{{ value() }}</span>
|
|
1708
|
+
<span class="cp-arrow">▾</span>
|
|
1709
|
+
</div>
|
|
1710
|
+
@if (open()) {
|
|
1711
|
+
<div class="cp-panel">
|
|
1712
|
+
<div class="cp-swatches">
|
|
1713
|
+
@for (c of colors; track c) {
|
|
1714
|
+
<button class="cp-swatch-btn" [style.background]="c" [class.selected]="value() === c" [attr.title]="c" (click)="pick(c)"></button>
|
|
1715
|
+
}
|
|
1716
|
+
</div>
|
|
1717
|
+
<div class="cp-hex-row">
|
|
1718
|
+
<span class="cp-hex-label">#</span>
|
|
1719
|
+
<input class="cp-hex-input" type="text" [value]="value().replace('#','')" maxlength="6" placeholder="rrggbb" (change)="onHexInput($event)" />
|
|
1720
|
+
<input class="cp-native" type="color" [value]="value()" (input)="onNativeInput($event)" />
|
|
1721
|
+
</div>
|
|
1722
|
+
</div>
|
|
1723
|
+
}
|
|
1724
|
+
</div>
|
|
1725
|
+
`, styles: [":host{display:inline-block;position:relative}.ngx-color-picker{position:relative}.cp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057);margin-bottom:4px}.cp-trigger{display:inline-flex;align-items:center;gap:8px;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 6px);cursor:pointer;background:var(--ngx-input-bg, #fff);font-size:13px}.cp-swatch{width:18px;height:18px;border-radius:3px;border:1px solid rgba(0,0,0,.15);flex-shrink:0}.cp-hex{color:var(--ngx-input-text, #212529);font-family:monospace}.cp-arrow{font-size:10px;color:#6c757d}.cp-panel{position:absolute;top:calc(100% + 4px);left:0;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:8px;box-shadow:0 8px 32px #00000026;z-index:1000;padding:12px;min-width:200px}.cp-swatches{display:grid;grid-template-columns:repeat(8,1fr);gap:4px;margin-bottom:10px}.cp-swatch-btn{width:20px;height:20px;border:1px solid rgba(0,0,0,.12);border-radius:3px;cursor:pointer;padding:0}.cp-swatch-btn.selected{outline:2px solid #1a73e8;outline-offset:1px}.cp-hex-row{display:flex;align-items:center;gap:4px}.cp-hex-label{color:#6c757d;font-weight:600}.cp-hex-input{flex:1;padding:5px 8px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:4px;font-size:13px;font-family:monospace;outline:none}.cp-native{width:28px;height:28px;border:none;padding:0;cursor:pointer;background:none;border-radius:4px}\n"] }]
|
|
1726
|
+
}] });
|
|
1727
|
+
|
|
1728
|
+
class TimePickerComponent {
|
|
1729
|
+
label = input('');
|
|
1730
|
+
use12h = input(false);
|
|
1731
|
+
hour = signal(9);
|
|
1732
|
+
min = signal(0);
|
|
1733
|
+
ampm = signal('AM');
|
|
1734
|
+
focused = signal(false);
|
|
1735
|
+
timeChange = output();
|
|
1736
|
+
hours = this.use12h() ? Array.from({ length: 12 }, (_, i) => i + 1) : Array.from({ length: 24 }, (_, i) => i);
|
|
1737
|
+
minutes = Array.from({ length: 60 }, (_, i) => i);
|
|
1738
|
+
displayHour = () => this.use12h() ? ((this.hour() % 12) || 12) : this.hour();
|
|
1739
|
+
pad = (n) => n.toString().padStart(2, '0');
|
|
1740
|
+
onHour(e) { this.hour.set(+e.target.value); this.emit(); }
|
|
1741
|
+
onMin(e) { this.min.set(+e.target.value); this.emit(); }
|
|
1742
|
+
onAmPm(e) { this.ampm.set(e.target.value); this.emit(); }
|
|
1743
|
+
emit() { this.timeChange.emit(`${this.pad(this.hour())}:${this.pad(this.min())}`); }
|
|
1744
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TimePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1745
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: TimePickerComponent, isStandalone: true, selector: "ngx-time-picker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, use12h: { classPropertyName: "use12h", publicName: "use12h", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { timeChange: "timeChange" }, ngImport: i0, template: `
|
|
1746
|
+
<div class="ngx-time-picker">
|
|
1747
|
+
@if (label()) { <label class="tp-label">{{ label() }}</label> }
|
|
1748
|
+
<div class="tp-input-wrap" [class.focused]="focused()">
|
|
1749
|
+
<select class="tp-select" (change)="onHour($event)" (focus)="focused.set(true)" (blur)="focused.set(false)">
|
|
1750
|
+
@for (h of hours; track h) {
|
|
1751
|
+
<option [value]="h" [selected]="h === displayHour()">{{ pad(h) }}</option>
|
|
1752
|
+
}
|
|
1753
|
+
</select>
|
|
1754
|
+
<span class="tp-sep">:</span>
|
|
1755
|
+
<select class="tp-select" (change)="onMin($event)">
|
|
1756
|
+
@for (m of minutes; track m) {
|
|
1757
|
+
<option [value]="m" [selected]="m === min()">{{ pad(m) }}</option>
|
|
1758
|
+
}
|
|
1759
|
+
</select>
|
|
1760
|
+
@if (use12h()) {
|
|
1761
|
+
<select class="tp-select tp-ampm" (change)="onAmPm($event)">
|
|
1762
|
+
<option [selected]="ampm() === 'AM'">AM</option>
|
|
1763
|
+
<option [selected]="ampm() === 'PM'">PM</option>
|
|
1764
|
+
</select>
|
|
1765
|
+
}
|
|
1766
|
+
</div>
|
|
1767
|
+
</div>
|
|
1768
|
+
`, isInline: true, styles: [":host{display:inline-block}.tp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057);margin-bottom:4px}.tp-input-wrap{display:inline-flex;align-items:center;gap:2px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 6px);background:var(--ngx-input-bg, #fff);padding:4px 10px;transition:border-color .15s}.tp-input-wrap.focused{border-color:var(--ngx-input-focus, #1a73e8);box-shadow:0 0 0 2px #1a73e826}.tp-select{border:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);outline:none;cursor:pointer;font-family:inherit}.tp-sep{color:#adb5bd;font-weight:700}.tp-ampm{margin-left:6px}\n"] });
|
|
1769
|
+
}
|
|
1770
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TimePickerComponent, decorators: [{
|
|
1771
|
+
type: Component,
|
|
1772
|
+
args: [{ selector: 'ngx-time-picker', standalone: true, template: `
|
|
1773
|
+
<div class="ngx-time-picker">
|
|
1774
|
+
@if (label()) { <label class="tp-label">{{ label() }}</label> }
|
|
1775
|
+
<div class="tp-input-wrap" [class.focused]="focused()">
|
|
1776
|
+
<select class="tp-select" (change)="onHour($event)" (focus)="focused.set(true)" (blur)="focused.set(false)">
|
|
1777
|
+
@for (h of hours; track h) {
|
|
1778
|
+
<option [value]="h" [selected]="h === displayHour()">{{ pad(h) }}</option>
|
|
1779
|
+
}
|
|
1780
|
+
</select>
|
|
1781
|
+
<span class="tp-sep">:</span>
|
|
1782
|
+
<select class="tp-select" (change)="onMin($event)">
|
|
1783
|
+
@for (m of minutes; track m) {
|
|
1784
|
+
<option [value]="m" [selected]="m === min()">{{ pad(m) }}</option>
|
|
1785
|
+
}
|
|
1786
|
+
</select>
|
|
1787
|
+
@if (use12h()) {
|
|
1788
|
+
<select class="tp-select tp-ampm" (change)="onAmPm($event)">
|
|
1789
|
+
<option [selected]="ampm() === 'AM'">AM</option>
|
|
1790
|
+
<option [selected]="ampm() === 'PM'">PM</option>
|
|
1791
|
+
</select>
|
|
1792
|
+
}
|
|
1793
|
+
</div>
|
|
1794
|
+
</div>
|
|
1795
|
+
`, styles: [":host{display:inline-block}.tp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057);margin-bottom:4px}.tp-input-wrap{display:inline-flex;align-items:center;gap:2px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 6px);background:var(--ngx-input-bg, #fff);padding:4px 10px;transition:border-color .15s}.tp-input-wrap.focused{border-color:var(--ngx-input-focus, #1a73e8);box-shadow:0 0 0 2px #1a73e826}.tp-select{border:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);outline:none;cursor:pointer;font-family:inherit}.tp-sep{color:#adb5bd;font-weight:700}.tp-ampm{margin-left:6px}\n"] }]
|
|
1796
|
+
}] });
|
|
1797
|
+
|
|
1798
|
+
class DateRangePickerComponent {
|
|
1799
|
+
label = input('');
|
|
1800
|
+
startDate = signal('');
|
|
1801
|
+
endDate = signal('');
|
|
1802
|
+
open = signal(false);
|
|
1803
|
+
picking = signal('start');
|
|
1804
|
+
viewMonth = signal(new Date().getMonth());
|
|
1805
|
+
viewYear = signal(new Date().getFullYear());
|
|
1806
|
+
rangeChange = output();
|
|
1807
|
+
weekDays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
1808
|
+
monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
1809
|
+
monthName(m) { return this.monthNames[m]; }
|
|
1810
|
+
toggleOpen() { this.open.update(v => !v); }
|
|
1811
|
+
prevMonth(e) { e.stopPropagation(); if (this.viewMonth() === 0) {
|
|
1812
|
+
this.viewMonth.set(11);
|
|
1813
|
+
this.viewYear.update(y => y - 1);
|
|
1814
|
+
}
|
|
1815
|
+
else
|
|
1816
|
+
this.viewMonth.update(m => m - 1); }
|
|
1817
|
+
nextMonth(e) { e.stopPropagation(); if (this.viewMonth() === 11) {
|
|
1818
|
+
this.viewMonth.set(0);
|
|
1819
|
+
this.viewYear.update(y => y + 1);
|
|
1820
|
+
}
|
|
1821
|
+
else
|
|
1822
|
+
this.viewMonth.update(m => m + 1); }
|
|
1823
|
+
calendarDays = computed(() => {
|
|
1824
|
+
const y = this.viewYear(), m = this.viewMonth();
|
|
1825
|
+
const first = new Date(y, m, 1).getDay();
|
|
1826
|
+
const days = [];
|
|
1827
|
+
const today = new Date();
|
|
1828
|
+
today.setHours(0, 0, 0, 0);
|
|
1829
|
+
const s = this.startDate() ? new Date(this.startDate()) : null;
|
|
1830
|
+
const e = this.endDate() ? new Date(this.endDate()) : null;
|
|
1831
|
+
for (let i = 0; i < 42; i++) {
|
|
1832
|
+
const date = new Date(y, m, i - first + 1);
|
|
1833
|
+
date.setHours(0, 0, 0, 0);
|
|
1834
|
+
const ds = date.toISOString().split('T')[0];
|
|
1835
|
+
days.push({
|
|
1836
|
+
key: ds, date, inMonth: date.getMonth() === m,
|
|
1837
|
+
isToday: date.getTime() === today.getTime(),
|
|
1838
|
+
isStart: s ? date.getTime() === s.getTime() : false,
|
|
1839
|
+
isEnd: e ? date.getTime() === e.getTime() : false,
|
|
1840
|
+
inRange: s && e ? date > s && date < e : false
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
return days;
|
|
1844
|
+
});
|
|
1845
|
+
selectDay(date, e) {
|
|
1846
|
+
e.stopPropagation();
|
|
1847
|
+
const ds = date.toISOString().split('T')[0];
|
|
1848
|
+
if (this.picking() === 'start') {
|
|
1849
|
+
this.startDate.set(ds);
|
|
1850
|
+
this.endDate.set('');
|
|
1851
|
+
this.picking.set('end');
|
|
1852
|
+
}
|
|
1853
|
+
else {
|
|
1854
|
+
if (date >= new Date(this.startDate())) {
|
|
1855
|
+
this.endDate.set(ds);
|
|
1856
|
+
this.picking.set('start');
|
|
1857
|
+
this.rangeChange.emit({ start: this.startDate(), end: ds });
|
|
1858
|
+
this.open.set(false);
|
|
1859
|
+
}
|
|
1860
|
+
else {
|
|
1861
|
+
this.startDate.set(ds);
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DateRangePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1866
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DateRangePickerComponent, isStandalone: true, selector: "ngx-date-range-picker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rangeChange: "rangeChange" }, ngImport: i0, template: `
|
|
1867
|
+
<div class="ngx-date-range-picker">
|
|
1868
|
+
@if (label()) { <label class="drp-label">{{ label() }}</label> }
|
|
1869
|
+
<div class="drp-inputs" (click)="toggleOpen()">
|
|
1870
|
+
<input class="drp-input" type="text" readonly [value]="startDate()" placeholder="Start date" />
|
|
1871
|
+
<span class="drp-sep">→</span>
|
|
1872
|
+
<input class="drp-input" type="text" readonly [value]="endDate()" placeholder="End date" />
|
|
1873
|
+
<span class="drp-icon">📅</span>
|
|
1874
|
+
</div>
|
|
1875
|
+
@if (open()) {
|
|
1876
|
+
<div class="drp-calendar-wrap">
|
|
1877
|
+
<div class="drp-calendar">
|
|
1878
|
+
<div class="cal-header">
|
|
1879
|
+
<button class="cal-nav" (click)="prevMonth($event)">‹</button>
|
|
1880
|
+
<span class="cal-title">{{ monthName(viewMonth()) }} {{ viewYear() }}</span>
|
|
1881
|
+
<button class="cal-nav" (click)="nextMonth($event)">›</button>
|
|
1882
|
+
</div>
|
|
1883
|
+
<div class="cal-grid">
|
|
1884
|
+
@for (day of weekDays; track day) { <div class="cal-weekday">{{ day }}</div> }
|
|
1885
|
+
@for (cell of calendarDays(); track cell.key) {
|
|
1886
|
+
<div
|
|
1887
|
+
class="cal-day"
|
|
1888
|
+
[class.other-month]="!cell.inMonth"
|
|
1889
|
+
[class.in-range]="cell.inRange"
|
|
1890
|
+
[class.range-start]="cell.isStart"
|
|
1891
|
+
[class.range-end]="cell.isEnd"
|
|
1892
|
+
[class.today]="cell.isToday"
|
|
1893
|
+
(click)="selectDay(cell.date, $event)"
|
|
1894
|
+
>{{ cell.date.getDate() }}</div>
|
|
1895
|
+
}
|
|
1896
|
+
</div>
|
|
1897
|
+
</div>
|
|
1898
|
+
</div>
|
|
1899
|
+
}
|
|
1900
|
+
</div>
|
|
1901
|
+
`, isInline: true, styles: [":host{display:block;position:relative}.drp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057);margin-bottom:4px}.drp-inputs{display:flex;align-items:center;gap:6px;padding:7px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 6px);cursor:pointer;background:var(--ngx-input-bg, #fff)}.drp-input{border:none;background:transparent;font-size:13px;color:var(--ngx-input-text, #212529);outline:none;cursor:pointer;width:90px}.drp-sep{color:#adb5bd}.drp-icon{font-size:14px}.drp-calendar-wrap{position:absolute;top:calc(100% + 4px);left:0;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:8px;box-shadow:0 8px 32px #00000026;z-index:1000;padding:12px}.cal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.cal-nav{background:none;border:1px solid #dee2e6;border-radius:4px;cursor:pointer;padding:3px 8px;font-size:14px}.cal-title{font-weight:600;font-size:13px}.cal-grid{display:grid;grid-template-columns:repeat(7,32px);gap:2px}.cal-weekday{text-align:center;font-size:10px;font-weight:700;color:#adb5bd;padding:4px 0}.cal-day{width:32px;height:32px;display:flex;align-items:center;justify-content:center;font-size:12px;border-radius:4px;cursor:pointer;transition:background .1s}.cal-day:hover{background:#f1f3f5}.cal-day.other-month{color:#ced4da}.cal-day.in-range{background:#e8f0fe;color:#1a73e8}.cal-day.range-start,.cal-day.range-end{background:#1a73e8;color:#fff;border-radius:50%}.cal-day.today{font-weight:700;border:1px solid #1a73e8}\n"] });
|
|
1902
|
+
}
|
|
1903
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DateRangePickerComponent, decorators: [{
|
|
1904
|
+
type: Component,
|
|
1905
|
+
args: [{ selector: 'ngx-date-range-picker', standalone: true, template: `
|
|
1906
|
+
<div class="ngx-date-range-picker">
|
|
1907
|
+
@if (label()) { <label class="drp-label">{{ label() }}</label> }
|
|
1908
|
+
<div class="drp-inputs" (click)="toggleOpen()">
|
|
1909
|
+
<input class="drp-input" type="text" readonly [value]="startDate()" placeholder="Start date" />
|
|
1910
|
+
<span class="drp-sep">→</span>
|
|
1911
|
+
<input class="drp-input" type="text" readonly [value]="endDate()" placeholder="End date" />
|
|
1912
|
+
<span class="drp-icon">📅</span>
|
|
1913
|
+
</div>
|
|
1914
|
+
@if (open()) {
|
|
1915
|
+
<div class="drp-calendar-wrap">
|
|
1916
|
+
<div class="drp-calendar">
|
|
1917
|
+
<div class="cal-header">
|
|
1918
|
+
<button class="cal-nav" (click)="prevMonth($event)">‹</button>
|
|
1919
|
+
<span class="cal-title">{{ monthName(viewMonth()) }} {{ viewYear() }}</span>
|
|
1920
|
+
<button class="cal-nav" (click)="nextMonth($event)">›</button>
|
|
1921
|
+
</div>
|
|
1922
|
+
<div class="cal-grid">
|
|
1923
|
+
@for (day of weekDays; track day) { <div class="cal-weekday">{{ day }}</div> }
|
|
1924
|
+
@for (cell of calendarDays(); track cell.key) {
|
|
1925
|
+
<div
|
|
1926
|
+
class="cal-day"
|
|
1927
|
+
[class.other-month]="!cell.inMonth"
|
|
1928
|
+
[class.in-range]="cell.inRange"
|
|
1929
|
+
[class.range-start]="cell.isStart"
|
|
1930
|
+
[class.range-end]="cell.isEnd"
|
|
1931
|
+
[class.today]="cell.isToday"
|
|
1932
|
+
(click)="selectDay(cell.date, $event)"
|
|
1933
|
+
>{{ cell.date.getDate() }}</div>
|
|
1934
|
+
}
|
|
1935
|
+
</div>
|
|
1936
|
+
</div>
|
|
1937
|
+
</div>
|
|
1938
|
+
}
|
|
1939
|
+
</div>
|
|
1940
|
+
`, styles: [":host{display:block;position:relative}.drp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #495057);margin-bottom:4px}.drp-inputs{display:flex;align-items:center;gap:6px;padding:7px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 6px);cursor:pointer;background:var(--ngx-input-bg, #fff)}.drp-input{border:none;background:transparent;font-size:13px;color:var(--ngx-input-text, #212529);outline:none;cursor:pointer;width:90px}.drp-sep{color:#adb5bd}.drp-icon{font-size:14px}.drp-calendar-wrap{position:absolute;top:calc(100% + 4px);left:0;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:8px;box-shadow:0 8px 32px #00000026;z-index:1000;padding:12px}.cal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.cal-nav{background:none;border:1px solid #dee2e6;border-radius:4px;cursor:pointer;padding:3px 8px;font-size:14px}.cal-title{font-weight:600;font-size:13px}.cal-grid{display:grid;grid-template-columns:repeat(7,32px);gap:2px}.cal-weekday{text-align:center;font-size:10px;font-weight:700;color:#adb5bd;padding:4px 0}.cal-day{width:32px;height:32px;display:flex;align-items:center;justify-content:center;font-size:12px;border-radius:4px;cursor:pointer;transition:background .1s}.cal-day:hover{background:#f1f3f5}.cal-day.other-month{color:#ced4da}.cal-day.in-range{background:#e8f0fe;color:#1a73e8}.cal-day.range-start,.cal-day.range-end{background:#1a73e8;color:#fff;border-radius:50%}.cal-day.today{font-weight:700;border:1px solid #1a73e8}\n"] }]
|
|
1941
|
+
}] });
|
|
1942
|
+
|
|
1943
|
+
/*
|
|
1944
|
+
* Public API Surface — secondary entry point: ngx-core-components/inputs
|
|
1945
|
+
*/
|
|
1946
|
+
// Text input
|
|
1947
|
+
|
|
1948
|
+
/**
|
|
1949
|
+
* Generated bundle index. Do not edit.
|
|
1950
|
+
*/
|
|
1951
|
+
|
|
1952
|
+
export { AutocompleteComponent, CheckboxComponent, ColorPickerComponent, DatePickerComponent, DateRangePickerComponent, DropdownComponent, MultiSelectComponent, NumericTextBoxComponent, RadioGroupComponent, RatingComponent, SliderComponent, SwitchComponent, TextBoxComponent, TextareaComponent, TimePickerComponent };
|
|
1953
|
+
//# sourceMappingURL=ngx-core-components-inputs.mjs.map
|