@egose/shadcn-theme-ng 0.0.9 → 0.0.11
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/accordion/fesm2022/accordion.mjs +55 -55
- package/accordion/fesm2022/accordion.mjs.map +1 -1
- package/accordion/index.d.ts +21 -21
- package/alert/fesm2022/alert.mjs +125 -49
- package/alert/fesm2022/alert.mjs.map +1 -1
- package/alert/index.d.ts +23 -20
- package/badge/fesm2022/badge.mjs +8 -8
- package/badge/fesm2022/badge.mjs.map +1 -1
- package/badge/index.d.ts +4 -4
- package/basic-alert/README.md +64 -0
- package/basic-alert/fesm2022/basic-alert.mjs +111 -0
- package/basic-alert/fesm2022/basic-alert.mjs.map +1 -0
- package/basic-alert/index.d.ts +14 -0
- package/button/fesm2022/button.mjs +25 -25
- package/button/fesm2022/button.mjs.map +1 -1
- package/button/index.d.ts +9 -9
- package/calendar/README.md +64 -0
- package/calendar/fesm2022/calendar.mjs +637 -0
- package/calendar/fesm2022/calendar.mjs.map +1 -0
- package/calendar/index.d.ts +111 -0
- package/confirmation-dialog/README.md +64 -0
- package/confirmation-dialog/fesm2022/confirmation-dialog.mjs +93 -0
- package/confirmation-dialog/fesm2022/confirmation-dialog.mjs.map +1 -0
- package/confirmation-dialog/index.d.ts +24 -0
- package/date-picker/README.md +64 -0
- package/date-picker/fesm2022/date-picker.mjs +599 -0
- package/date-picker/fesm2022/date-picker.mjs.map +1 -0
- package/date-picker/index.d.ts +227 -0
- package/dialog/README.md +64 -0
- package/dialog/fesm2022/dialog.mjs +278 -0
- package/dialog/fesm2022/dialog.mjs.map +1 -0
- package/dialog/index.d.ts +89 -0
- package/exports.json +1 -1
- package/form-date-picker/README.md +64 -0
- package/form-date-picker/fesm2022/form-date-picker.mjs +146 -0
- package/form-date-picker/fesm2022/form-date-picker.mjs.map +1 -0
- package/form-date-picker/index.d.ts +32 -0
- package/form-field/fesm2022/form-field.mjs +36 -34
- package/form-field/fesm2022/form-field.mjs.map +1 -1
- package/form-field/index.d.ts +16 -16
- package/form-select/README.md +64 -0
- package/form-select/fesm2022/form-select.mjs +165 -0
- package/form-select/fesm2022/form-select.mjs.map +1 -0
- package/form-select/index.d.ts +33 -0
- package/form-text-input/README.md +64 -0
- package/form-text-input/fesm2022/form-text-input.mjs +197 -0
- package/form-text-input/fesm2022/form-text-input.mjs.map +1 -0
- package/form-text-input/index.d.ts +47 -0
- package/form-textarea/README.md +64 -0
- package/form-textarea/fesm2022/form-textarea.mjs +156 -0
- package/form-textarea/fesm2022/form-textarea.mjs.map +1 -0
- package/form-textarea/index.d.ts +33 -0
- package/icon/fesm2022/icon.mjs +20 -20
- package/icon/fesm2022/icon.mjs.map +1 -1
- package/icon/index.d.ts +13 -13
- package/input/fesm2022/input.mjs +20 -20
- package/input/fesm2022/input.mjs.map +1 -1
- package/input/index.d.ts +9 -9
- package/label/fesm2022/label.mjs +16 -16
- package/label/fesm2022/label.mjs.map +1 -1
- package/label/index.d.ts +9 -9
- package/package.json +41 -15
- package/popover/README.md +64 -0
- package/popover/fesm2022/popover.mjs +69 -0
- package/popover/fesm2022/popover.mjs.map +1 -0
- package/popover/index.d.ts +30 -0
- package/radio-group/fesm2022/radio-group.mjs +30 -30
- package/radio-group/fesm2022/radio-group.mjs.map +1 -1
- package/radio-group/index.d.ts +15 -15
- package/select/fesm2022/select.mjs +108 -108
- package/select/fesm2022/select.mjs.map +1 -1
- package/select/index.d.ts +35 -35
- package/sonner/fesm2022/sonner.mjs +16 -16
- package/sonner/fesm2022/sonner.mjs.map +1 -1
- package/sonner/index.d.ts +9 -9
- package/spinner/fesm2022/spinner.mjs +17 -17
- package/spinner/fesm2022/spinner.mjs.map +1 -1
- package/spinner/index.d.ts +9 -9
- package/switch/fesm2022/switch.mjs +27 -27
- package/switch/fesm2022/switch.mjs.map +1 -1
- package/switch/index.d.ts +12 -12
- package/tabs/fesm2022/tabs.mjs +53 -53
- package/tabs/fesm2022/tabs.mjs.map +1 -1
- package/tabs/index.d.ts +21 -21
- package/tooltip/fesm2022/tooltip.mjs +22 -22
- package/tooltip/fesm2022/tooltip.mjs.map +1 -1
- package/tooltip/index.d.ts +12 -12
- package/utils/fesm2022/utils.mjs +2 -2
- package/utils/fesm2022/utils.mjs.map +1 -1
- package/utils/index.d.ts +2 -2
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, forwardRef, input, computed, booleanAttribute, linkedSignal, signal, output, ChangeDetectionStrategy, Component, numberAttribute, untracked, NgModule } from '@angular/core';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
5
|
+
import { lucideChevronDown } from '@ng-icons/lucide';
|
|
6
|
+
import { BrnPopover, BrnPopoverTrigger, BrnPopoverContent } from '@spartan-ng/brain/popover';
|
|
7
|
+
import { BrnFormFieldControl } from '@spartan-ng/brain/form-field';
|
|
8
|
+
import { HlmCalendar, HlmCalendarMulti, HlmCalendarRange } from '@egose/shadcn-theme-ng/calendar';
|
|
9
|
+
import { HlmIcon } from '@egose/shadcn-theme-ng/icon';
|
|
10
|
+
import { HlmPopoverContent } from '@egose/shadcn-theme-ng/popover';
|
|
11
|
+
import { hlm } from '@egose/shadcn-theme-ng/utils';
|
|
12
|
+
|
|
13
|
+
function getDefaultConfig$2() {
|
|
14
|
+
return {
|
|
15
|
+
formatDate: (date) => (date instanceof Date ? date.toDateString() : `${date}`),
|
|
16
|
+
transformDate: (date) => date,
|
|
17
|
+
autoCloseOnSelect: false,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const HlmDatePickerConfigToken = new InjectionToken('HlmDatePickerConfig');
|
|
21
|
+
function provideHlmDatePickerConfig(config) {
|
|
22
|
+
return { provide: HlmDatePickerConfigToken, useValue: { ...getDefaultConfig$2(), ...config } };
|
|
23
|
+
}
|
|
24
|
+
function injectHlmDatePickerConfig() {
|
|
25
|
+
const injectedConfig = inject(HlmDatePickerConfigToken, { optional: true });
|
|
26
|
+
return injectedConfig ? injectedConfig : getDefaultConfig$2();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const HLM_DATE_PICKER_VALUE_ACCESSOR = {
|
|
30
|
+
provide: NG_VALUE_ACCESSOR,
|
|
31
|
+
useExisting: forwardRef(() => HlmDatePicker),
|
|
32
|
+
multi: true,
|
|
33
|
+
};
|
|
34
|
+
let nextId$2 = 0;
|
|
35
|
+
class HlmDatePicker extends BrnFormFieldControl {
|
|
36
|
+
_config = injectHlmDatePickerConfig();
|
|
37
|
+
userClass = input('', ...(ngDevMode ? [{ debugName: "userClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
38
|
+
_computedClass = computed(() => hlm('tw:ring-offset-background tw:border-input tw:bg-background tw:hover:bg-input/50 tw:dark:bg-input/10 tw:dark:hover:bg-input/50 tw:inline-flex tw:h-9 tw:w-full tw:cursor-default tw:items-center tw:justify-between tw:gap-2 tw:whitespace-nowrap tw:rounded-md tw:border tw:px-3 tw:py-2 tw:text-left tw:text-sm tw:font-normal tw:transition-all tw:disabled:pointer-events-none tw:disabled:opacity-50', 'tw:focus-visible:ring-ring tw:focus-visible:outline-none tw:focus-visible:ring-2 tw:focus-visible:ring-offset-2', 'tw:disabled:pointer-events-none tw:disabled:opacity-50', 'tw:[&_ng-icon]:pointer-events-none tw:[&_ng-icon]:shrink-0', this.userClass()), ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
39
|
+
/** The id of the button that opens the date picker. */
|
|
40
|
+
buttonId = input(`hlm-date-picker-${nextId$2++}`, ...(ngDevMode ? [{ debugName: "buttonId" }] : []));
|
|
41
|
+
/** The minimum date that can be selected.*/
|
|
42
|
+
min = input(...(ngDevMode ? [undefined, { debugName: "min" }] : []));
|
|
43
|
+
/** The maximum date that can be selected. */
|
|
44
|
+
max = input(...(ngDevMode ? [undefined, { debugName: "max" }] : []));
|
|
45
|
+
/** Determine if the date picker is disabled. */
|
|
46
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{
|
|
47
|
+
transform: booleanAttribute,
|
|
48
|
+
}]));
|
|
49
|
+
/** The selected value. */
|
|
50
|
+
date = input(...(ngDevMode ? [undefined, { debugName: "date" }] : []));
|
|
51
|
+
_mutableDate = linkedSignal(this.date);
|
|
52
|
+
/** If true, the date picker will close when a date is selected. */
|
|
53
|
+
autoCloseOnSelect = input(this._config.autoCloseOnSelect, ...(ngDevMode ? [{ debugName: "autoCloseOnSelect", transform: booleanAttribute }] : [{
|
|
54
|
+
transform: booleanAttribute,
|
|
55
|
+
}]));
|
|
56
|
+
/** Defines how the date should be displayed in the UI. */
|
|
57
|
+
formatDate = input(this._config.formatDate, ...(ngDevMode ? [{ debugName: "formatDate" }] : []));
|
|
58
|
+
/** Defines how the date should be transformed before saving to model/form. */
|
|
59
|
+
transformDate = input(this._config.transformDate, ...(ngDevMode ? [{ debugName: "transformDate" }] : []));
|
|
60
|
+
_popoverState = signal(null, ...(ngDevMode ? [{ debugName: "_popoverState" }] : []));
|
|
61
|
+
_mutableDisabled = linkedSignal(this.disabled);
|
|
62
|
+
_formattedDate = computed(() => {
|
|
63
|
+
const date = this._mutableDate();
|
|
64
|
+
return date ? this.formatDate()(date) : undefined;
|
|
65
|
+
}, ...(ngDevMode ? [{ debugName: "_formattedDate" }] : []));
|
|
66
|
+
dateChange = output();
|
|
67
|
+
_onChange;
|
|
68
|
+
_onTouched;
|
|
69
|
+
_handleChange(value) {
|
|
70
|
+
if (this._mutableDisabled())
|
|
71
|
+
return;
|
|
72
|
+
const transformedDate = this.transformDate()(value);
|
|
73
|
+
this._mutableDate.set(transformedDate);
|
|
74
|
+
this._onChange?.(transformedDate);
|
|
75
|
+
this.dateChange.emit(transformedDate);
|
|
76
|
+
if (this.autoCloseOnSelect()) {
|
|
77
|
+
this._popoverState.set('closed');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** CONTROL VALUE ACCESSOR */
|
|
81
|
+
writeValue(value) {
|
|
82
|
+
this._mutableDate.set(value ? this.transformDate()(value) : undefined);
|
|
83
|
+
}
|
|
84
|
+
registerOnChange(fn) {
|
|
85
|
+
this._onChange = fn;
|
|
86
|
+
}
|
|
87
|
+
registerOnTouched(fn) {
|
|
88
|
+
this._onTouched = fn;
|
|
89
|
+
}
|
|
90
|
+
setDisabledState(isDisabled) {
|
|
91
|
+
this._mutableDisabled.set(isDisabled);
|
|
92
|
+
}
|
|
93
|
+
open() {
|
|
94
|
+
this._popoverState.set('open');
|
|
95
|
+
}
|
|
96
|
+
close() {
|
|
97
|
+
this._popoverState.set('closed');
|
|
98
|
+
}
|
|
99
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: HlmDatePicker, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
100
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: HlmDatePicker, isStandalone: true, selector: "hlm-date-picker", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, buttonId: { classPropertyName: "buttonId", publicName: "buttonId", 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, autoCloseOnSelect: { classPropertyName: "autoCloseOnSelect", publicName: "autoCloseOnSelect", isSignal: true, isRequired: false, transformFunction: null }, formatDate: { classPropertyName: "formatDate", publicName: "formatDate", isSignal: true, isRequired: false, transformFunction: null }, transformDate: { classPropertyName: "transformDate", publicName: "transformDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "dateChange" }, host: { classAttribute: "block" }, providers: [
|
|
101
|
+
HLM_DATE_PICKER_VALUE_ACCESSOR,
|
|
102
|
+
provideIcons({ lucideChevronDown }),
|
|
103
|
+
{
|
|
104
|
+
provide: BrnFormFieldControl,
|
|
105
|
+
useExisting: forwardRef(() => HlmDatePicker),
|
|
106
|
+
},
|
|
107
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
108
|
+
<brn-popover sideOffset="5" [state]="_popoverState()" (stateChanged)="_popoverState.set($event)">
|
|
109
|
+
<button
|
|
110
|
+
[id]="buttonId()"
|
|
111
|
+
type="button"
|
|
112
|
+
[class]="_computedClass()"
|
|
113
|
+
[disabled]="_mutableDisabled()"
|
|
114
|
+
brnPopoverTrigger
|
|
115
|
+
>
|
|
116
|
+
<span class="truncate">
|
|
117
|
+
@if (_formattedDate(); as formattedDate) {
|
|
118
|
+
{{ formattedDate }}
|
|
119
|
+
} @else {
|
|
120
|
+
<ng-content />
|
|
121
|
+
}
|
|
122
|
+
</span>
|
|
123
|
+
|
|
124
|
+
<ng-icon hlm size="sm" name="lucideChevronDown" />
|
|
125
|
+
</button>
|
|
126
|
+
|
|
127
|
+
<div hlmPopoverContent class="tw:w-auto tw:p-0" *brnPopoverContent="let ctx">
|
|
128
|
+
<hlm-calendar
|
|
129
|
+
calendarClass="tw:border-0 tw:rounded-none"
|
|
130
|
+
[date]="_mutableDate()"
|
|
131
|
+
[min]="min()"
|
|
132
|
+
[max]="max()"
|
|
133
|
+
[disabled]="_mutableDisabled()"
|
|
134
|
+
(dateChange)="_handleChange($event)"
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
</brn-popover>
|
|
138
|
+
`, isInline: true, dependencies: [{ kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: HlmIcon, selector: "ng-icon[hlm]", inputs: ["size"] }, { kind: "component", type: BrnPopover, selector: "brn-popover", inputs: ["align", "sideOffset"], exportAs: ["brnPopover"] }, { kind: "directive", type: BrnPopoverTrigger, selector: "button[brnPopoverTrigger],button[brnPopoverTriggerFor]", inputs: ["brnPopoverTriggerFor"] }, { kind: "directive", type: BrnPopoverContent, selector: "[brnPopoverContent]" }, { kind: "directive", type: HlmPopoverContent, selector: "[hlmPopoverContent],[brnPopoverContent][hlm]", inputs: ["class"] }, { kind: "component", type: HlmCalendar, selector: "hlm-calendar", inputs: ["calendarClass", "min", "max", "disabled", "date", "dateDisabled", "weekStartsOn", "defaultFocusedDate"], outputs: ["dateChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
139
|
+
}
|
|
140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: HlmDatePicker, decorators: [{
|
|
141
|
+
type: Component,
|
|
142
|
+
args: [{
|
|
143
|
+
selector: 'hlm-date-picker',
|
|
144
|
+
imports: [NgIcon, HlmIcon, BrnPopover, BrnPopoverTrigger, BrnPopoverContent, HlmPopoverContent, HlmCalendar],
|
|
145
|
+
providers: [
|
|
146
|
+
HLM_DATE_PICKER_VALUE_ACCESSOR,
|
|
147
|
+
provideIcons({ lucideChevronDown }),
|
|
148
|
+
{
|
|
149
|
+
provide: BrnFormFieldControl,
|
|
150
|
+
useExisting: forwardRef(() => HlmDatePicker),
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
template: `
|
|
154
|
+
<brn-popover sideOffset="5" [state]="_popoverState()" (stateChanged)="_popoverState.set($event)">
|
|
155
|
+
<button
|
|
156
|
+
[id]="buttonId()"
|
|
157
|
+
type="button"
|
|
158
|
+
[class]="_computedClass()"
|
|
159
|
+
[disabled]="_mutableDisabled()"
|
|
160
|
+
brnPopoverTrigger
|
|
161
|
+
>
|
|
162
|
+
<span class="truncate">
|
|
163
|
+
@if (_formattedDate(); as formattedDate) {
|
|
164
|
+
{{ formattedDate }}
|
|
165
|
+
} @else {
|
|
166
|
+
<ng-content />
|
|
167
|
+
}
|
|
168
|
+
</span>
|
|
169
|
+
|
|
170
|
+
<ng-icon hlm size="sm" name="lucideChevronDown" />
|
|
171
|
+
</button>
|
|
172
|
+
|
|
173
|
+
<div hlmPopoverContent class="tw:w-auto tw:p-0" *brnPopoverContent="let ctx">
|
|
174
|
+
<hlm-calendar
|
|
175
|
+
calendarClass="tw:border-0 tw:rounded-none"
|
|
176
|
+
[date]="_mutableDate()"
|
|
177
|
+
[min]="min()"
|
|
178
|
+
[max]="max()"
|
|
179
|
+
[disabled]="_mutableDisabled()"
|
|
180
|
+
(dateChange)="_handleChange($event)"
|
|
181
|
+
/>
|
|
182
|
+
</div>
|
|
183
|
+
</brn-popover>
|
|
184
|
+
`,
|
|
185
|
+
host: {
|
|
186
|
+
class: 'block',
|
|
187
|
+
},
|
|
188
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
189
|
+
}]
|
|
190
|
+
}] });
|
|
191
|
+
|
|
192
|
+
function getDefaultConfig$1() {
|
|
193
|
+
return {
|
|
194
|
+
formatDates: (dates) => dates.map((date) => (date instanceof Date ? date.toDateString() : `${date}`)).join(', '),
|
|
195
|
+
transformDates: (dates) => dates,
|
|
196
|
+
autoCloseOnMaxSelection: false,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
const HlmDatePickerMultiConfigToken = new InjectionToken('HlmDatePickerMultiConfig');
|
|
200
|
+
function provideHlmDatePickerMultiConfig(config) {
|
|
201
|
+
return { provide: HlmDatePickerMultiConfigToken, useValue: { ...getDefaultConfig$1(), ...config } };
|
|
202
|
+
}
|
|
203
|
+
function injectHlmDatePickerMultiConfig() {
|
|
204
|
+
const injectedConfig = inject(HlmDatePickerMultiConfigToken, { optional: true });
|
|
205
|
+
return injectedConfig ? injectedConfig : getDefaultConfig$1();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const HLM_DATE_PICKER_MUTLI_VALUE_ACCESSOR = {
|
|
209
|
+
provide: NG_VALUE_ACCESSOR,
|
|
210
|
+
useExisting: forwardRef(() => HlmDatePickerMulti),
|
|
211
|
+
multi: true,
|
|
212
|
+
};
|
|
213
|
+
let nextId$1 = 0;
|
|
214
|
+
class HlmDatePickerMulti {
|
|
215
|
+
_config = injectHlmDatePickerMultiConfig();
|
|
216
|
+
userClass = input('', ...(ngDevMode ? [{ debugName: "userClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
217
|
+
_computedClass = computed(() => hlm('tw:ring-offset-background tw:border-input tw:bg-background tw:hover:bg-accent tw:dark:bg-input/30 tw:dark:hover:bg-input/50 tw:inline-flex tw:h-9 tw:w-[280px] tw:cursor-default tw:items-center tw:justify-between tw:gap-2 tw:whitespace-nowrap tw:rounded-md tw:border tw:px-3 tw:py-2 tw:text-left tw:text-sm tw:font-normal tw:transition-all tw:disabled:pointer-events-none tw:disabled:opacity-50', 'tw:focus-visible:ring-ring tw:focus-visible:outline-none tw:focus-visible:ring-2 tw:focus-visible:ring-offset-2', 'tw:disabled:pointer-events-none tw:disabled:opacity-50', 'tw:[&_ng-icon]:pointer-events-none tw:[&_ng-icon]:shrink-0', this.userClass()), ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
218
|
+
/** The id of the button that opens the date picker. */
|
|
219
|
+
buttonId = input(`hlm-date-picker-multi-${nextId$1++}`, ...(ngDevMode ? [{ debugName: "buttonId" }] : []));
|
|
220
|
+
/** The minimum date that can be selected.*/
|
|
221
|
+
min = input(...(ngDevMode ? [undefined, { debugName: "min" }] : []));
|
|
222
|
+
/** The maximum date that can be selected. */
|
|
223
|
+
max = input(...(ngDevMode ? [undefined, { debugName: "max" }] : []));
|
|
224
|
+
/** The minimum selectable dates. */
|
|
225
|
+
minSelection = input(undefined, ...(ngDevMode ? [{ debugName: "minSelection", transform: numberAttribute }] : [{
|
|
226
|
+
transform: numberAttribute,
|
|
227
|
+
}]));
|
|
228
|
+
/** The maximum selectable dates. */
|
|
229
|
+
maxSelection = input(undefined, ...(ngDevMode ? [{ debugName: "maxSelection", transform: numberAttribute }] : [{
|
|
230
|
+
transform: numberAttribute,
|
|
231
|
+
}]));
|
|
232
|
+
/** Determine if the date picker is disabled. */
|
|
233
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{
|
|
234
|
+
transform: booleanAttribute,
|
|
235
|
+
}]));
|
|
236
|
+
/** The selected value. */
|
|
237
|
+
date = input(...(ngDevMode ? [undefined, { debugName: "date" }] : []));
|
|
238
|
+
_mutableDate = linkedSignal(this.date);
|
|
239
|
+
/** If true, the date picker will close when the max selection of dates is reached. */
|
|
240
|
+
autoCloseOnMaxSelection = input(this._config.autoCloseOnMaxSelection, ...(ngDevMode ? [{ debugName: "autoCloseOnMaxSelection", transform: booleanAttribute }] : [{
|
|
241
|
+
transform: booleanAttribute,
|
|
242
|
+
}]));
|
|
243
|
+
/** Defines how the date should be displayed in the UI. */
|
|
244
|
+
formatDates = input(this._config.formatDates, ...(ngDevMode ? [{ debugName: "formatDates" }] : []));
|
|
245
|
+
/** Defines how the date should be transformed before saving to model/form. */
|
|
246
|
+
transformDates = input(this._config.transformDates, ...(ngDevMode ? [{ debugName: "transformDates" }] : []));
|
|
247
|
+
_popoverState = signal(null, ...(ngDevMode ? [{ debugName: "_popoverState" }] : []));
|
|
248
|
+
_mutableDisabled = linkedSignal(this.disabled);
|
|
249
|
+
_formattedDate = computed(() => {
|
|
250
|
+
const dates = this._mutableDate();
|
|
251
|
+
return dates ? this.formatDates()(dates) : undefined;
|
|
252
|
+
}, ...(ngDevMode ? [{ debugName: "_formattedDate" }] : []));
|
|
253
|
+
dateChange = output();
|
|
254
|
+
_onChange;
|
|
255
|
+
_onTouched;
|
|
256
|
+
_handleChange(value) {
|
|
257
|
+
if (value === undefined)
|
|
258
|
+
return;
|
|
259
|
+
if (this._mutableDisabled())
|
|
260
|
+
return;
|
|
261
|
+
const transformedDate = this.transformDates()(value);
|
|
262
|
+
this._mutableDate.set(transformedDate);
|
|
263
|
+
this._onChange?.(transformedDate);
|
|
264
|
+
this.dateChange.emit(transformedDate);
|
|
265
|
+
if (this.autoCloseOnMaxSelection() && this._mutableDate()?.length === this.maxSelection()) {
|
|
266
|
+
this._popoverState.set('closed');
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/** CONTROL VALUE ACCESSOR */
|
|
270
|
+
writeValue(value) {
|
|
271
|
+
this._mutableDate.set(value ? this.transformDates()(value) : undefined);
|
|
272
|
+
}
|
|
273
|
+
registerOnChange(fn) {
|
|
274
|
+
this._onChange = fn;
|
|
275
|
+
}
|
|
276
|
+
registerOnTouched(fn) {
|
|
277
|
+
this._onTouched = fn;
|
|
278
|
+
}
|
|
279
|
+
setDisabledState(isDisabled) {
|
|
280
|
+
this._mutableDisabled.set(isDisabled);
|
|
281
|
+
}
|
|
282
|
+
open() {
|
|
283
|
+
this._popoverState.set('open');
|
|
284
|
+
}
|
|
285
|
+
close() {
|
|
286
|
+
this._popoverState.set('closed');
|
|
287
|
+
}
|
|
288
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: HlmDatePickerMulti, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
289
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: HlmDatePickerMulti, isStandalone: true, selector: "hlm-date-picker-multi", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, buttonId: { classPropertyName: "buttonId", publicName: "buttonId", 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 }, minSelection: { classPropertyName: "minSelection", publicName: "minSelection", isSignal: true, isRequired: false, transformFunction: null }, maxSelection: { classPropertyName: "maxSelection", publicName: "maxSelection", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, autoCloseOnMaxSelection: { classPropertyName: "autoCloseOnMaxSelection", publicName: "autoCloseOnMaxSelection", isSignal: true, isRequired: false, transformFunction: null }, formatDates: { classPropertyName: "formatDates", publicName: "formatDates", isSignal: true, isRequired: false, transformFunction: null }, transformDates: { classPropertyName: "transformDates", publicName: "transformDates", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "dateChange" }, host: { classAttribute: "block" }, providers: [HLM_DATE_PICKER_MUTLI_VALUE_ACCESSOR, provideIcons({ lucideChevronDown })], ngImport: i0, template: `
|
|
290
|
+
<brn-popover sideOffset="5" [state]="_popoverState()" (stateChanged)="_popoverState.set($event)">
|
|
291
|
+
<button
|
|
292
|
+
[id]="buttonId()"
|
|
293
|
+
type="button"
|
|
294
|
+
[class]="_computedClass()"
|
|
295
|
+
[disabled]="_mutableDisabled()"
|
|
296
|
+
brnPopoverTrigger
|
|
297
|
+
>
|
|
298
|
+
<span class="truncate">
|
|
299
|
+
@if (_formattedDate(); as formattedDate) {
|
|
300
|
+
{{ formattedDate }}
|
|
301
|
+
} @else {
|
|
302
|
+
<ng-content />
|
|
303
|
+
}
|
|
304
|
+
</span>
|
|
305
|
+
|
|
306
|
+
<ng-icon hlm size="sm" name="lucideChevronDown" />
|
|
307
|
+
</button>
|
|
308
|
+
|
|
309
|
+
<div hlmPopoverContent class="w-auto p-0" *brnPopoverContent="let ctx">
|
|
310
|
+
<hlm-calendar-multi
|
|
311
|
+
calendarClass="border-0 rounded-none"
|
|
312
|
+
[date]="_mutableDate()"
|
|
313
|
+
[min]="min()"
|
|
314
|
+
[max]="max()"
|
|
315
|
+
[minSelection]="minSelection()"
|
|
316
|
+
[maxSelection]="maxSelection()"
|
|
317
|
+
[disabled]="_mutableDisabled()"
|
|
318
|
+
(dateChange)="_handleChange($event)"
|
|
319
|
+
/>
|
|
320
|
+
</div>
|
|
321
|
+
</brn-popover>
|
|
322
|
+
`, isInline: true, dependencies: [{ kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: HlmIcon, selector: "ng-icon[hlm]", inputs: ["size"] }, { kind: "component", type: BrnPopover, selector: "brn-popover", inputs: ["align", "sideOffset"], exportAs: ["brnPopover"] }, { kind: "directive", type: BrnPopoverTrigger, selector: "button[brnPopoverTrigger],button[brnPopoverTriggerFor]", inputs: ["brnPopoverTriggerFor"] }, { kind: "directive", type: BrnPopoverContent, selector: "[brnPopoverContent]" }, { kind: "directive", type: HlmPopoverContent, selector: "[hlmPopoverContent],[brnPopoverContent][hlm]", inputs: ["class"] }, { kind: "component", type: HlmCalendarMulti, selector: "hlm-calendar-multi", inputs: ["calendarClass", "min", "max", "minSelection", "maxSelection", "disabled", "date", "dateDisabled", "weekStartsOn", "defaultFocusedDate"], outputs: ["dateChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
323
|
+
}
|
|
324
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: HlmDatePickerMulti, decorators: [{
|
|
325
|
+
type: Component,
|
|
326
|
+
args: [{
|
|
327
|
+
selector: 'hlm-date-picker-multi',
|
|
328
|
+
imports: [NgIcon, HlmIcon, BrnPopover, BrnPopoverTrigger, BrnPopoverContent, HlmPopoverContent, HlmCalendarMulti],
|
|
329
|
+
providers: [HLM_DATE_PICKER_MUTLI_VALUE_ACCESSOR, provideIcons({ lucideChevronDown })],
|
|
330
|
+
template: `
|
|
331
|
+
<brn-popover sideOffset="5" [state]="_popoverState()" (stateChanged)="_popoverState.set($event)">
|
|
332
|
+
<button
|
|
333
|
+
[id]="buttonId()"
|
|
334
|
+
type="button"
|
|
335
|
+
[class]="_computedClass()"
|
|
336
|
+
[disabled]="_mutableDisabled()"
|
|
337
|
+
brnPopoverTrigger
|
|
338
|
+
>
|
|
339
|
+
<span class="truncate">
|
|
340
|
+
@if (_formattedDate(); as formattedDate) {
|
|
341
|
+
{{ formattedDate }}
|
|
342
|
+
} @else {
|
|
343
|
+
<ng-content />
|
|
344
|
+
}
|
|
345
|
+
</span>
|
|
346
|
+
|
|
347
|
+
<ng-icon hlm size="sm" name="lucideChevronDown" />
|
|
348
|
+
</button>
|
|
349
|
+
|
|
350
|
+
<div hlmPopoverContent class="w-auto p-0" *brnPopoverContent="let ctx">
|
|
351
|
+
<hlm-calendar-multi
|
|
352
|
+
calendarClass="border-0 rounded-none"
|
|
353
|
+
[date]="_mutableDate()"
|
|
354
|
+
[min]="min()"
|
|
355
|
+
[max]="max()"
|
|
356
|
+
[minSelection]="minSelection()"
|
|
357
|
+
[maxSelection]="maxSelection()"
|
|
358
|
+
[disabled]="_mutableDisabled()"
|
|
359
|
+
(dateChange)="_handleChange($event)"
|
|
360
|
+
/>
|
|
361
|
+
</div>
|
|
362
|
+
</brn-popover>
|
|
363
|
+
`,
|
|
364
|
+
host: {
|
|
365
|
+
class: 'block',
|
|
366
|
+
},
|
|
367
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
368
|
+
}]
|
|
369
|
+
}] });
|
|
370
|
+
|
|
371
|
+
function getDefaultConfig() {
|
|
372
|
+
return {
|
|
373
|
+
formatDates: (dates) => dates
|
|
374
|
+
.filter(Boolean)
|
|
375
|
+
.map((date) => (date instanceof Date ? date.toDateString() : `${date}`))
|
|
376
|
+
.join(' - '),
|
|
377
|
+
transformDates: (dates) => dates,
|
|
378
|
+
autoCloseOnEndSelection: false,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
const HlmDateRangePickerConfigToken = new InjectionToken('HlmDateRangePickerConfig');
|
|
382
|
+
function provideHlmDateRangePickerConfig(config) {
|
|
383
|
+
return { provide: HlmDateRangePickerConfigToken, useValue: { ...getDefaultConfig(), ...config } };
|
|
384
|
+
}
|
|
385
|
+
function injectHlmDateRangePickerConfig() {
|
|
386
|
+
const injectedConfig = inject(HlmDateRangePickerConfigToken, { optional: true });
|
|
387
|
+
return injectedConfig ? injectedConfig : getDefaultConfig();
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR = {
|
|
391
|
+
provide: NG_VALUE_ACCESSOR,
|
|
392
|
+
useExisting: forwardRef(() => HlmDateRangePicker),
|
|
393
|
+
multi: true,
|
|
394
|
+
};
|
|
395
|
+
let nextId = 0;
|
|
396
|
+
class HlmDateRangePicker {
|
|
397
|
+
_config = injectHlmDateRangePickerConfig();
|
|
398
|
+
userClass = input('', ...(ngDevMode ? [{ debugName: "userClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
399
|
+
_computedClass = computed(() => hlm('tw:ring-offset-background tw:border-input tw:bg-background tw:hover:bg-accent tw:dark:bg-input/30 tw:dark:hover:bg-input/50 tw:inline-flex tw:h-9 tw:w-[280px] tw:cursor-default tw:items-center tw:justify-between tw:gap-2 tw:whitespace-nowrap tw:rounded-md tw:border tw:px-3 tw:py-2 tw:text-left tw:text-sm tw:font-normal tw:transition-all tw:disabled:pointer-events-none tw:disabled:opacity-50', 'tw:focus-visible:ring-ring tw:focus-visible:outline-none tw:focus-visible:ring-2 tw:focus-visible:ring-offset-2', 'tw:disabled:pointer-events-none tw:disabled:opacity-50', 'tw:[&_ng-icon]:pointer-events-none tw:[&_ng-icon]:shrink-0', this.userClass()), ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
400
|
+
/** The id of the button that opens the date picker. */
|
|
401
|
+
buttonId = input(`hlm-date-picker-range-${nextId++}`, ...(ngDevMode ? [{ debugName: "buttonId" }] : []));
|
|
402
|
+
/** The minimum date that can be selected.*/
|
|
403
|
+
min = input(...(ngDevMode ? [undefined, { debugName: "min" }] : []));
|
|
404
|
+
/** The maximum date that can be selected. */
|
|
405
|
+
max = input(...(ngDevMode ? [undefined, { debugName: "max" }] : []));
|
|
406
|
+
/** Determine if the date picker is disabled. */
|
|
407
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{
|
|
408
|
+
transform: booleanAttribute,
|
|
409
|
+
}]));
|
|
410
|
+
/** The selected value. */
|
|
411
|
+
date = input(...(ngDevMode ? [undefined, { debugName: "date" }] : []));
|
|
412
|
+
_mutableDate = linkedSignal(this.date);
|
|
413
|
+
_start = linkedSignal(() => this._mutableDate()?.[0]);
|
|
414
|
+
_end = linkedSignal(() => this._mutableDate()?.[1]);
|
|
415
|
+
/** If true, the date picker will close when the end date is selected */
|
|
416
|
+
autoCloseOnEndSelection = input(this._config.autoCloseOnEndSelection, ...(ngDevMode ? [{ debugName: "autoCloseOnEndSelection", transform: booleanAttribute }] : [{
|
|
417
|
+
transform: booleanAttribute,
|
|
418
|
+
}]));
|
|
419
|
+
/** Defines how the date should be displayed in the UI. */
|
|
420
|
+
formatDates = input(this._config.formatDates, ...(ngDevMode ? [{ debugName: "formatDates" }] : []));
|
|
421
|
+
/** Defines how the date should be transformed before saving to model/form. */
|
|
422
|
+
transformDates = input(this._config.transformDates, ...(ngDevMode ? [{ debugName: "transformDates" }] : []));
|
|
423
|
+
_popoverState = signal(null, ...(ngDevMode ? [{ debugName: "_popoverState" }] : []));
|
|
424
|
+
_mutableDisabled = linkedSignal(this.disabled);
|
|
425
|
+
_formattedDate = computed(() => {
|
|
426
|
+
const start = this._start();
|
|
427
|
+
const end = this._end();
|
|
428
|
+
return start || end ? this.formatDates()([start, end]) : undefined;
|
|
429
|
+
}, ...(ngDevMode ? [{ debugName: "_formattedDate" }] : []));
|
|
430
|
+
dateChange = output();
|
|
431
|
+
_onChange;
|
|
432
|
+
_onTouched;
|
|
433
|
+
_handleStartDayChange(value) {
|
|
434
|
+
this._start.set(value);
|
|
435
|
+
}
|
|
436
|
+
_handleEndDateChange(value) {
|
|
437
|
+
this._end.set(value);
|
|
438
|
+
if (this._mutableDisabled())
|
|
439
|
+
return;
|
|
440
|
+
const start = this._start();
|
|
441
|
+
if (start && value) {
|
|
442
|
+
const transformedDates = this.transformDates()([start, value]);
|
|
443
|
+
this._mutableDate.set(transformedDates);
|
|
444
|
+
this.dateChange.emit(transformedDates);
|
|
445
|
+
this._onChange?.(transformedDates);
|
|
446
|
+
if (this.autoCloseOnEndSelection()) {
|
|
447
|
+
this._popoverState.set('closed');
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
/** CONTROL VALUE ACCESSOR */
|
|
452
|
+
writeValue(value) {
|
|
453
|
+
untracked(() => {
|
|
454
|
+
if (!value) {
|
|
455
|
+
this._mutableDate.set(undefined);
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
this._mutableDate.set(this.transformDates()(value));
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
registerOnChange(fn) {
|
|
463
|
+
this._onChange = fn;
|
|
464
|
+
}
|
|
465
|
+
registerOnTouched(fn) {
|
|
466
|
+
this._onTouched = fn;
|
|
467
|
+
}
|
|
468
|
+
setDisabledState(isDisabled) {
|
|
469
|
+
this._mutableDisabled.set(isDisabled);
|
|
470
|
+
}
|
|
471
|
+
open() {
|
|
472
|
+
this._popoverState.set('open');
|
|
473
|
+
}
|
|
474
|
+
close() {
|
|
475
|
+
this._popoverState.set('closed');
|
|
476
|
+
}
|
|
477
|
+
_onClose() {
|
|
478
|
+
const dates = this._mutableDate();
|
|
479
|
+
if (this._start() && !this._end() && dates) {
|
|
480
|
+
this._start.set(dates[0]);
|
|
481
|
+
this._end.set(dates[1]);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: HlmDateRangePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
485
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: HlmDateRangePicker, isStandalone: true, selector: "hlm-date-range-picker", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, buttonId: { classPropertyName: "buttonId", publicName: "buttonId", 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, autoCloseOnEndSelection: { classPropertyName: "autoCloseOnEndSelection", publicName: "autoCloseOnEndSelection", isSignal: true, isRequired: false, transformFunction: null }, formatDates: { classPropertyName: "formatDates", publicName: "formatDates", isSignal: true, isRequired: false, transformFunction: null }, transformDates: { classPropertyName: "transformDates", publicName: "transformDates", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "dateChange" }, host: { classAttribute: "block" }, providers: [HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR, provideIcons({ lucideChevronDown })], ngImport: i0, template: `
|
|
486
|
+
<brn-popover
|
|
487
|
+
sideOffset="5"
|
|
488
|
+
[state]="_popoverState()"
|
|
489
|
+
(stateChanged)="_popoverState.set($event)"
|
|
490
|
+
(closed)="_onClose()"
|
|
491
|
+
>
|
|
492
|
+
<button
|
|
493
|
+
[id]="buttonId()"
|
|
494
|
+
type="button"
|
|
495
|
+
[class]="_computedClass()"
|
|
496
|
+
[disabled]="_mutableDisabled()"
|
|
497
|
+
brnPopoverTrigger
|
|
498
|
+
>
|
|
499
|
+
<span class="truncate">
|
|
500
|
+
@if (_formattedDate(); as formattedDate) {
|
|
501
|
+
{{ formattedDate }}
|
|
502
|
+
} @else {
|
|
503
|
+
<ng-content />
|
|
504
|
+
}
|
|
505
|
+
</span>
|
|
506
|
+
|
|
507
|
+
<ng-icon hlm size="sm" name="lucideChevronDown" />
|
|
508
|
+
</button>
|
|
509
|
+
|
|
510
|
+
<div hlmPopoverContent class="tw:w-auto tw:p-0" *brnPopoverContent="let ctx">
|
|
511
|
+
<hlm-calendar-range
|
|
512
|
+
calendarClass="tw:border-0 tw:rounded-none"
|
|
513
|
+
[startDate]="_start()"
|
|
514
|
+
[endDate]="_end()"
|
|
515
|
+
[min]="min()"
|
|
516
|
+
[max]="max()"
|
|
517
|
+
[disabled]="_mutableDisabled()"
|
|
518
|
+
(startDateChange)="_handleStartDayChange($event)"
|
|
519
|
+
(endDateChange)="_handleEndDateChange($event)"
|
|
520
|
+
/>
|
|
521
|
+
</div>
|
|
522
|
+
</brn-popover>
|
|
523
|
+
`, isInline: true, dependencies: [{ kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: HlmIcon, selector: "ng-icon[hlm]", inputs: ["size"] }, { kind: "component", type: BrnPopover, selector: "brn-popover", inputs: ["align", "sideOffset"], exportAs: ["brnPopover"] }, { kind: "directive", type: BrnPopoverTrigger, selector: "button[brnPopoverTrigger],button[brnPopoverTriggerFor]", inputs: ["brnPopoverTriggerFor"] }, { kind: "directive", type: BrnPopoverContent, selector: "[brnPopoverContent]" }, { kind: "directive", type: HlmPopoverContent, selector: "[hlmPopoverContent],[brnPopoverContent][hlm]", inputs: ["class"] }, { kind: "component", type: HlmCalendarRange, selector: "hlm-calendar-range", inputs: ["calendarClass", "min", "max", "disabled", "startDate", "endDate", "dateDisabled", "weekStartsOn", "defaultFocusedDate"], outputs: ["startDateChange", "endDateChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
524
|
+
}
|
|
525
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: HlmDateRangePicker, decorators: [{
|
|
526
|
+
type: Component,
|
|
527
|
+
args: [{
|
|
528
|
+
selector: 'hlm-date-range-picker',
|
|
529
|
+
imports: [NgIcon, HlmIcon, BrnPopover, BrnPopoverTrigger, BrnPopoverContent, HlmPopoverContent, HlmCalendarRange],
|
|
530
|
+
providers: [HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR, provideIcons({ lucideChevronDown })],
|
|
531
|
+
template: `
|
|
532
|
+
<brn-popover
|
|
533
|
+
sideOffset="5"
|
|
534
|
+
[state]="_popoverState()"
|
|
535
|
+
(stateChanged)="_popoverState.set($event)"
|
|
536
|
+
(closed)="_onClose()"
|
|
537
|
+
>
|
|
538
|
+
<button
|
|
539
|
+
[id]="buttonId()"
|
|
540
|
+
type="button"
|
|
541
|
+
[class]="_computedClass()"
|
|
542
|
+
[disabled]="_mutableDisabled()"
|
|
543
|
+
brnPopoverTrigger
|
|
544
|
+
>
|
|
545
|
+
<span class="truncate">
|
|
546
|
+
@if (_formattedDate(); as formattedDate) {
|
|
547
|
+
{{ formattedDate }}
|
|
548
|
+
} @else {
|
|
549
|
+
<ng-content />
|
|
550
|
+
}
|
|
551
|
+
</span>
|
|
552
|
+
|
|
553
|
+
<ng-icon hlm size="sm" name="lucideChevronDown" />
|
|
554
|
+
</button>
|
|
555
|
+
|
|
556
|
+
<div hlmPopoverContent class="tw:w-auto tw:p-0" *brnPopoverContent="let ctx">
|
|
557
|
+
<hlm-calendar-range
|
|
558
|
+
calendarClass="tw:border-0 tw:rounded-none"
|
|
559
|
+
[startDate]="_start()"
|
|
560
|
+
[endDate]="_end()"
|
|
561
|
+
[min]="min()"
|
|
562
|
+
[max]="max()"
|
|
563
|
+
[disabled]="_mutableDisabled()"
|
|
564
|
+
(startDateChange)="_handleStartDayChange($event)"
|
|
565
|
+
(endDateChange)="_handleEndDateChange($event)"
|
|
566
|
+
/>
|
|
567
|
+
</div>
|
|
568
|
+
</brn-popover>
|
|
569
|
+
`,
|
|
570
|
+
host: {
|
|
571
|
+
class: 'block',
|
|
572
|
+
},
|
|
573
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
574
|
+
}]
|
|
575
|
+
}] });
|
|
576
|
+
|
|
577
|
+
/*
|
|
578
|
+
* Public API Surface of date-picker
|
|
579
|
+
*/
|
|
580
|
+
const HlmDatePickerImports = [HlmDatePicker, HlmDatePickerMulti, HlmDateRangePicker];
|
|
581
|
+
class HlmDatePickerModule {
|
|
582
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: HlmDatePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
583
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: HlmDatePickerModule, imports: [HlmDatePicker, HlmDatePickerMulti, HlmDateRangePicker], exports: [HlmDatePicker, HlmDatePickerMulti, HlmDateRangePicker] });
|
|
584
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: HlmDatePickerModule, imports: [HlmDatePickerImports] });
|
|
585
|
+
}
|
|
586
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: HlmDatePickerModule, decorators: [{
|
|
587
|
+
type: NgModule,
|
|
588
|
+
args: [{
|
|
589
|
+
imports: [...HlmDatePickerImports],
|
|
590
|
+
exports: [...HlmDatePickerImports],
|
|
591
|
+
}]
|
|
592
|
+
}] });
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Generated bundle index. Do not edit.
|
|
596
|
+
*/
|
|
597
|
+
|
|
598
|
+
export { HLM_DATE_PICKER_MUTLI_VALUE_ACCESSOR, HLM_DATE_PICKER_VALUE_ACCESSOR, HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR, HlmDatePicker, HlmDatePickerImports, HlmDatePickerModule, HlmDatePickerMulti, HlmDateRangePicker, injectHlmDatePickerConfig, injectHlmDatePickerMultiConfig, injectHlmDateRangePickerConfig, provideHlmDatePickerConfig, provideHlmDatePickerMultiConfig, provideHlmDateRangePickerConfig };
|
|
599
|
+
//# sourceMappingURL=date-picker.mjs.map
|