@egose/shadcn-theme-ng 0.0.27 → 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/README.md +130 -13
- package/accordion/README.md +3 -0
- package/accordion/fesm2022/accordion.mjs +148 -0
- package/accordion/package.json +25 -0
- package/accordion/types/accordion.d.ts +49 -0
- package/alert/README.md +2 -63
- package/alert/fesm2022/alert.mjs +58 -53
- package/alert/package.json +25 -0
- package/alert-dialog/README.md +11 -0
- package/alert-dialog/fesm2022/alert-dialog.mjs +287 -0
- package/alert-dialog/package.json +25 -0
- package/alert-dialog/types/alert-dialog.d.ts +90 -0
- package/aspect-ratio/README.md +11 -0
- package/aspect-ratio/fesm2022/aspect-ratio.mjs +62 -0
- package/aspect-ratio/package.json +25 -0
- package/aspect-ratio/types/aspect-ratio.d.ts +21 -0
- package/autocomplete/README.md +3 -0
- package/autocomplete/fesm2022/autocomplete.mjs +391 -0
- package/autocomplete/package.json +24 -0
- package/autocomplete/types/autocomplete.d.ts +96 -0
- package/avatar/README.md +11 -0
- package/avatar/fesm2022/avatar.mjs +178 -0
- package/avatar/package.json +25 -0
- package/avatar/types/avatar.d.ts +50 -0
- package/badge/README.md +2 -63
- package/badge/fesm2022/badge.mjs +69 -63
- package/badge/package.json +25 -0
- package/basic-alert/README.md +2 -63
- package/basic-alert/fesm2022/basic-alert.mjs +14 -22
- package/basic-alert/package.json +24 -0
- package/breadcrumb/README.md +11 -0
- package/breadcrumb/fesm2022/breadcrumb.mjs +218 -0
- package/breadcrumb/package.json +25 -0
- package/breadcrumb/types/breadcrumb.d.ts +57 -0
- package/button/README.md +2 -63
- package/button/fesm2022/button.mjs +201 -177
- package/button/package.json +25 -0
- package/button/{index.d.ts → types/button.d.ts} +31 -10
- package/button-group/README.md +11 -0
- package/button-group/fesm2022/button-group.mjs +102 -0
- package/button-group/package.json +25 -0
- package/button-group/types/button-group.d.ts +30 -0
- package/calendar/README.md +2 -63
- package/calendar/fesm2022/calendar.mjs +178 -570
- package/calendar/package.json +24 -0
- package/calendar/types/calendar.d.ts +94 -0
- package/card/README.md +11 -0
- package/card/fesm2022/card.mjs +169 -0
- package/card/package.json +25 -0
- package/card/types/card.d.ts +54 -0
- package/carousel/README.md +11 -0
- package/carousel/fesm2022/carousel.mjs +267 -0
- package/carousel/package.json +25 -0
- package/carousel/types/carousel.d.ts +84 -0
- package/checkbox/README.md +3 -0
- package/checkbox/fesm2022/checkbox.mjs +113 -0
- package/checkbox/package.json +24 -0
- package/checkbox/types/checkbox.d.ts +56 -0
- package/collapsible/README.md +11 -0
- package/collapsible/fesm2022/collapsible.mjs +77 -0
- package/collapsible/package.json +25 -0
- package/collapsible/types/collapsible.d.ts +27 -0
- package/combobox/README.md +11 -0
- package/combobox/fesm2022/combobox.mjs +547 -0
- package/combobox/package.json +25 -0
- package/combobox/types/combobox.d.ts +151 -0
- package/command/README.md +11 -0
- package/command/fesm2022/command.mjs +301 -0
- package/command/package.json +25 -0
- package/command/types/command.d.ts +89 -0
- package/confirmation-dialog/README.md +3 -0
- package/confirmation-dialog/fesm2022/confirmation-dialog.mjs +79 -0
- package/confirmation-dialog/package.json +24 -0
- package/confirmation-dialog/types/confirmation-dialog.d.ts +28 -0
- package/context-menu/README.md +11 -0
- package/context-menu/fesm2022/context-menu.mjs +89 -0
- package/context-menu/package.json +25 -0
- package/context-menu/types/context-menu.d.ts +34 -0
- package/date-picker/README.md +2 -63
- package/date-picker/fesm2022/date-picker.mjs +1104 -352
- package/date-picker/package.json +24 -0
- package/date-picker/types/date-picker.d.ts +555 -0
- package/dialog/README.md +3 -0
- package/dialog/fesm2022/dialog.mjs +281 -0
- package/dialog/package.json +24 -0
- package/dialog/types/dialog.d.ts +95 -0
- package/drawer/README.md +11 -0
- package/drawer/fesm2022/drawer.mjs +261 -0
- package/drawer/package.json +25 -0
- package/drawer/types/drawer.d.ts +76 -0
- package/dropdown-menu/README.md +11 -0
- package/dropdown-menu/fesm2022/dropdown-menu.mjs +554 -0
- package/dropdown-menu/package.json +25 -0
- package/dropdown-menu/types/dropdown-menu.d.ts +180 -0
- package/empty/README.md +11 -0
- package/empty/fesm2022/empty.mjs +151 -0
- package/empty/package.json +25 -0
- package/empty/types/empty.d.ts +54 -0
- package/field/README.md +11 -0
- package/field/fesm2022/field.mjs +351 -0
- package/field/package.json +25 -0
- package/field/types/field.d.ts +107 -0
- package/form-checkbox/README.md +3 -0
- package/form-checkbox/fesm2022/form-checkbox.mjs +94 -0
- package/form-checkbox/package.json +24 -0
- package/form-checkbox/types/form-checkbox.d.ts +33 -0
- package/form-date-picker/README.md +2 -63
- package/form-date-picker/fesm2022/form-date-picker.mjs +74 -120
- package/form-date-picker/package.json +24 -0
- package/form-date-picker/{index.d.ts → types/form-date-picker.d.ts} +7 -1
- package/form-field/README.md +2 -63
- package/form-field/fesm2022/form-field.mjs +54 -28
- package/form-field/package.json +25 -0
- package/form-field/types/form-field.d.ts +46 -0
- package/form-field-simple/README.md +2 -63
- package/form-field-simple/fesm2022/form-field-simple.mjs +15 -10
- package/form-field-simple/package.json +24 -0
- package/form-searchable-multiselect/README.md +3 -0
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +98 -0
- package/form-searchable-multiselect/package.json +24 -0
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +36 -0
- package/form-select/README.md +2 -63
- package/form-select/fesm2022/form-select.mjs +85 -141
- package/form-select/package.json +24 -0
- package/form-select/{index.d.ts → types/form-select.d.ts} +7 -1
- package/form-text-input/README.md +2 -63
- package/form-text-input/fesm2022/form-text-input.mjs +86 -171
- package/form-text-input/package.json +24 -0
- package/form-text-input/{index.d.ts → types/form-text-input.d.ts} +9 -12
- package/form-textarea/README.md +2 -63
- package/form-textarea/fesm2022/form-textarea.mjs +77 -128
- package/form-textarea/package.json +24 -0
- package/form-textarea/{index.d.ts → types/form-textarea.d.ts} +8 -1
- package/hover-card/README.md +11 -0
- package/hover-card/fesm2022/hover-card.mjs +123 -0
- package/hover-card/package.json +25 -0
- package/hover-card/types/hover-card.d.ts +36 -0
- package/icon/README.md +2 -63
- package/icon/fesm2022/icon.mjs +12 -10
- package/icon/package.json +25 -0
- package/input/README.md +2 -63
- package/input/fesm2022/input.mjs +25 -70
- package/input/package.json +25 -0
- package/input/types/input.d.ts +19 -0
- package/input-group/README.md +11 -0
- package/input-group/fesm2022/input-group.mjs +199 -0
- package/input-group/package.json +25 -0
- package/input-group/types/input-group.d.ts +52 -0
- package/input-otp/README.md +11 -0
- package/input-otp/fesm2022/input-otp.mjs +141 -0
- package/input-otp/package.json +25 -0
- package/input-otp/types/input-otp.d.ts +43 -0
- package/item/README.md +11 -0
- package/item/fesm2022/item.mjs +278 -0
- package/item/package.json +25 -0
- package/item/types/item.d.ts +101 -0
- package/kbd/README.md +11 -0
- package/kbd/fesm2022/kbd.mjs +61 -0
- package/kbd/package.json +25 -0
- package/kbd/types/kbd.d.ts +22 -0
- package/label/README.md +2 -63
- package/label/fesm2022/label.mjs +12 -11
- package/label/package.json +25 -0
- package/label/{index.d.ts → types/label.d.ts} +1 -1
- package/layout-simple/README.md +3 -0
- package/layout-simple/fesm2022/layout-simple.mjs +388 -0
- package/layout-simple/package.json +24 -0
- package/layout-simple/types/layout-simple.d.ts +167 -0
- package/menu/README.md +3 -0
- package/menu/fesm2022/menu.mjs +455 -0
- package/menu/package.json +24 -0
- package/menu/types/menu.d.ts +137 -0
- package/menubar/README.md +11 -0
- package/menubar/fesm2022/menubar.mjs +108 -0
- package/menubar/package.json +25 -0
- package/menubar/types/menubar.d.ts +40 -0
- package/native-select/README.md +11 -0
- package/native-select/fesm2022/native-select.mjs +207 -0
- package/native-select/package.json +25 -0
- package/native-select/types/native-select.d.ts +70 -0
- package/navigation-menu/README.md +11 -0
- package/navigation-menu/fesm2022/navigation-menu.mjs +194 -0
- package/navigation-menu/package.json +25 -0
- package/navigation-menu/types/navigation-menu.d.ts +54 -0
- package/package.json +284 -63
- package/pagination/README.md +11 -0
- package/pagination/fesm2022/pagination.mjs +522 -0
- package/pagination/package.json +25 -0
- package/pagination/types/pagination.d.ts +192 -0
- package/popover/README.md +2 -63
- package/popover/fesm2022/popover.mjs +124 -30
- package/popover/package.json +24 -0
- package/popover/types/popover.d.ts +54 -0
- package/progress/README.md +11 -0
- package/progress/fesm2022/progress.mjs +77 -0
- package/progress/package.json +25 -0
- package/progress/types/progress.d.ts +27 -0
- package/radio-group/README.md +3 -0
- package/radio-group/fesm2022/radio-group.mjs +207 -0
- package/radio-group/package.json +25 -0
- package/radio-group/types/radio-group.d.ts +71 -0
- package/resizable/README.md +11 -0
- package/resizable/fesm2022/resizable.mjs +103 -0
- package/resizable/package.json +25 -0
- package/resizable/types/resizable.d.ts +32 -0
- package/scroll-area/README.md +11 -0
- package/scroll-area/fesm2022/scroll-area.mjs +51 -0
- package/scroll-area/package.json +25 -0
- package/scroll-area/types/scroll-area.d.ts +16 -0
- package/searchable-multiselect/README.md +3 -0
- package/searchable-multiselect/fesm2022/searchable-multiselect.mjs +136 -0
- package/searchable-multiselect/package.json +24 -0
- package/searchable-multiselect/types/searchable-multiselect.d.ts +45 -0
- package/select/README.md +2 -63
- package/select/fesm2022/select.mjs +340 -198
- package/select/package.json +25 -0
- package/select/types/select.d.ts +121 -0
- package/separator/README.md +2 -63
- package/separator/fesm2022/separator.mjs +17 -15
- package/separator/package.json +24 -0
- package/separator/{index.d.ts → types/separator.d.ts} +4 -5
- package/sheet/README.md +2 -63
- package/sheet/fesm2022/sheet.mjs +56 -61
- package/sheet/package.json +24 -0
- package/sidebar/README.md +11 -0
- package/sidebar/fesm2022/sidebar.mjs +846 -0
- package/sidebar/package.json +25 -0
- package/sidebar/types/sidebar.d.ts +237 -0
- package/skeleton/README.md +11 -0
- package/skeleton/fesm2022/skeleton.mjs +44 -0
- package/skeleton/package.json +25 -0
- package/skeleton/types/skeleton.d.ts +16 -0
- package/slider/README.md +11 -0
- package/slider/fesm2022/slider.mjs +74 -0
- package/slider/package.json +25 -0
- package/slider/types/slider.d.ts +19 -0
- package/sonner/README.md +2 -63
- package/sonner/fesm2022/sonner.mjs +34 -39
- package/sonner/package.json +25 -0
- package/spinner/README.md +2 -63
- package/spinner/fesm2022/spinner.mjs +20 -16
- package/spinner/package.json +25 -0
- package/switch/README.md +2 -63
- package/switch/fesm2022/switch.mjs +28 -27
- package/switch/package.json +25 -0
- package/table/README.md +11 -0
- package/table/fesm2022/table.mjs +211 -0
- package/table/package.json +25 -0
- package/table/types/table.d.ts +87 -0
- package/tabs/README.md +3 -0
- package/tabs/fesm2022/tabs.mjs +210 -0
- package/tabs/package.json +25 -0
- package/tabs/types/tabs.d.ts +71 -0
- package/textarea/README.md +11 -0
- package/textarea/fesm2022/textarea.mjs +47 -0
- package/textarea/package.json +25 -0
- package/textarea/types/textarea.d.ts +18 -0
- package/toggle/README.md +11 -0
- package/toggle/fesm2022/toggle.mjs +78 -0
- package/toggle/package.json +25 -0
- package/toggle/types/toggle.d.ts +27 -0
- package/toggle-group/README.md +11 -0
- package/toggle-group/fesm2022/toggle-group.mjs +117 -0
- package/toggle-group/package.json +25 -0
- package/toggle-group/types/toggle-group.d.ts +45 -0
- package/tooltip/README.md +3 -0
- package/tooltip/fesm2022/tooltip.mjs +72 -0
- package/tooltip/package.json +25 -0
- package/tooltip/types/tooltip.d.ts +22 -0
- package/typography/README.md +11 -0
- package/typography/fesm2022/typography.mjs +242 -0
- package/typography/package.json +25 -0
- package/typography/types/typography.d.ts +94 -0
- package/utils/README.md +2 -63
- package/utils/fesm2022/utils.mjs +209 -2
- package/utils/package.json +25 -0
- package/utils/types/utils.d.ts +13 -0
- package/alert/fesm2022/alert.mjs.map +0 -1
- package/badge/fesm2022/badge.mjs.map +0 -1
- package/basic-alert/fesm2022/basic-alert.mjs.map +0 -1
- package/button/fesm2022/button.mjs.map +0 -1
- package/calendar/fesm2022/calendar.mjs.map +0 -1
- package/calendar/index.d.ts +0 -111
- package/date-picker/fesm2022/date-picker.mjs.map +0 -1
- package/date-picker/index.d.ts +0 -227
- package/form-date-picker/fesm2022/form-date-picker.mjs.map +0 -1
- package/form-field/fesm2022/form-field.mjs.map +0 -1
- package/form-field/index.d.ts +0 -37
- package/form-field-simple/fesm2022/form-field-simple.mjs.map +0 -1
- package/form-select/fesm2022/form-select.mjs.map +0 -1
- package/form-text-input/fesm2022/form-text-input.mjs.map +0 -1
- package/form-textarea/fesm2022/form-textarea.mjs.map +0 -1
- package/icon/fesm2022/icon.mjs.map +0 -1
- package/input/fesm2022/input.mjs.map +0 -1
- package/input/index.d.ts +0 -41
- package/label/fesm2022/label.mjs.map +0 -1
- package/popover/fesm2022/popover.mjs.map +0 -1
- package/popover/index.d.ts +0 -30
- package/select/fesm2022/select.mjs.map +0 -1
- package/select/index.d.ts +0 -92
- package/separator/fesm2022/separator.mjs.map +0 -1
- package/sheet/fesm2022/sheet.mjs.map +0 -1
- package/sonner/fesm2022/sonner.mjs.map +0 -1
- package/spinner/fesm2022/spinner.mjs.map +0 -1
- package/switch/fesm2022/switch.mjs.map +0 -1
- package/utils/fesm2022/utils.mjs.map +0 -1
- package/utils/index.d.ts +0 -5
- /package/alert/{index.d.ts → types/alert.d.ts} +0 -0
- /package/badge/{index.d.ts → types/badge.d.ts} +0 -0
- /package/basic-alert/{index.d.ts → types/basic-alert.d.ts} +0 -0
- /package/form-field-simple/{index.d.ts → types/form-field-simple.d.ts} +0 -0
- /package/icon/{index.d.ts → types/icon.d.ts} +0 -0
- /package/sheet/{index.d.ts → types/sheet.d.ts} +0 -0
- /package/sonner/{index.d.ts → types/sonner.d.ts} +0 -0
- /package/spinner/{index.d.ts → types/spinner.d.ts} +0 -0
- /package/switch/{index.d.ts → types/switch.d.ts} +0 -0
|
@@ -1,19 +1,200 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, forwardRef,
|
|
3
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
2
|
+
import { InjectionToken, inject, input, ChangeDetectionStrategy, Component, forwardRef, viewChild, contentChild, booleanAttribute, linkedSignal, signal, computed, output, ElementRef, effect, Directive, numberAttribute, untracked, NgModule } from '@angular/core';
|
|
4
3
|
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
5
|
-
import { lucideChevronDown } from '@ng-icons/lucide';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
4
|
+
import { lucideX, lucideCalendar, lucideChevronDown } from '@ng-icons/lucide';
|
|
5
|
+
import { BrnDateInput, provideBrnDatePickerTrigger, BrnDatePickerTriggerToken, provideBrnDatePicker, injectBrnDatePicker } from '@spartan-ng/brain/date-picker';
|
|
6
|
+
import * as i1 from '@egose/shadcn-theme-ng/input-group';
|
|
7
|
+
import { HlmInputGroup, HlmInputGroupImports } from '@egose/shadcn-theme-ng/input-group';
|
|
8
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
|
+
import * as i1$1 from '@spartan-ng/brain/field';
|
|
10
|
+
import { provideBrnLabelable, BrnFieldControl, BrnFieldControlDescribedBy } from '@spartan-ng/brain/field';
|
|
11
|
+
import { BrnPopover } from '@spartan-ng/brain/popover';
|
|
12
|
+
import * as i3 from '@egose/shadcn-theme-ng/calendar';
|
|
13
|
+
import { HlmCalendar, HlmCalendarMulti, HlmCalendarRange, HlmCalendarImports } from '@egose/shadcn-theme-ng/calendar';
|
|
14
|
+
import * as i2 from '@egose/shadcn-theme-ng/popover';
|
|
15
|
+
import { HlmPopoverImports, HlmPopoverTrigger } from '@egose/shadcn-theme-ng/popover';
|
|
16
|
+
import { BrnOverlay } from '@spartan-ng/brain/overlay';
|
|
17
|
+
import * as i1$2 from '@egose/shadcn-theme-ng/button';
|
|
18
|
+
import { HlmButtonImports } from '@egose/shadcn-theme-ng/button';
|
|
11
19
|
import { hlm } from '@egose/shadcn-theme-ng/utils';
|
|
12
20
|
|
|
21
|
+
function getDefaultConfig$3() {
|
|
22
|
+
return {
|
|
23
|
+
formatDates: (dates) => dates.map((date) => (date instanceof Date ? date.toDateString() : `${date}`)).join(', '),
|
|
24
|
+
formatInputDates: (dates) => dates
|
|
25
|
+
.map((date) => {
|
|
26
|
+
if (!(date instanceof Date))
|
|
27
|
+
return `${date}`;
|
|
28
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
29
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
30
|
+
const year = date.getFullYear();
|
|
31
|
+
return `${day}/${month}/${year}`;
|
|
32
|
+
})
|
|
33
|
+
.join(', '),
|
|
34
|
+
transformDates: (dates) => dates,
|
|
35
|
+
autoCloseOnMaxSelection: false,
|
|
36
|
+
parseDate: (value) => {
|
|
37
|
+
if (typeof value !== 'string')
|
|
38
|
+
return null;
|
|
39
|
+
const parts = value.split(',').map((v) => v.trim());
|
|
40
|
+
const result = [];
|
|
41
|
+
for (const part of parts) {
|
|
42
|
+
const match = part.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
43
|
+
if (!match)
|
|
44
|
+
return null;
|
|
45
|
+
const day = Number(match[1]);
|
|
46
|
+
const month = Number(match[2]);
|
|
47
|
+
const year = Number(match[3]);
|
|
48
|
+
if (month < 1 || month > 12)
|
|
49
|
+
return null;
|
|
50
|
+
if (day < 1 || day > 31)
|
|
51
|
+
return null;
|
|
52
|
+
const date = new Date(year, month - 1, day);
|
|
53
|
+
if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
result.push(date);
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const HlmDatePickerMultiConfigToken = new InjectionToken('HlmDatePickerMultiConfig');
|
|
63
|
+
function provideHlmDatePickerMultiConfig(config) {
|
|
64
|
+
return { provide: HlmDatePickerMultiConfigToken, useValue: { ...getDefaultConfig$3(), ...config } };
|
|
65
|
+
}
|
|
66
|
+
function injectHlmDatePickerMultiConfig() {
|
|
67
|
+
const injectedConfig = inject(HlmDatePickerMultiConfigToken, { optional: true });
|
|
68
|
+
return injectedConfig ? injectedConfig : getDefaultConfig$3();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
class HlmDateMultiInput extends BrnDateInput {
|
|
72
|
+
_config = injectHlmDatePickerMultiConfig();
|
|
73
|
+
/**
|
|
74
|
+
* Parses input text into dates. Return `null` for invalid input - the
|
|
75
|
+
* picker's dates are cleared while the text is preserved so the user can
|
|
76
|
+
* fix it.
|
|
77
|
+
*
|
|
78
|
+
* Defaults to `parseDate` from `HlmDatePickerMultiConfig`.
|
|
79
|
+
*/
|
|
80
|
+
parseDate = input(this._config.parseDate, /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "parseDate" }] : /* istanbul ignore next */ []));
|
|
82
|
+
/**
|
|
83
|
+
* Formats the current dates into the input/edit format shown while the
|
|
84
|
+
* input is focused. On blur the picker's display format is restored.
|
|
85
|
+
*
|
|
86
|
+
* Defaults to `formatInputDates` from `HlmDatePickerMultiConfig`.
|
|
87
|
+
*/
|
|
88
|
+
formatInputDates = input(this._config.formatInputDates, /* @ts-ignore */
|
|
89
|
+
...(ngDevMode ? [{ debugName: "formatInputDates" }] : /* istanbul ignore next */ []));
|
|
90
|
+
parseValue(value) {
|
|
91
|
+
return this.parseDate()(value);
|
|
92
|
+
}
|
|
93
|
+
formatInputValue(value) {
|
|
94
|
+
return this.formatInputDates()(value);
|
|
95
|
+
}
|
|
96
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDateMultiInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
97
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: HlmDateMultiInput, isStandalone: true, selector: "hlm-date-multi-input", inputs: { parseDate: { classPropertyName: "parseDate", publicName: "parseDate", isSignal: true, isRequired: false, transformFunction: null }, formatInputDates: { classPropertyName: "formatInputDates", publicName: "formatInputDates", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideIcons({ lucideCalendar, lucideX }), provideBrnDatePickerTrigger(HlmDateMultiInput)], usesInheritance: true, hostDirectives: [{ directive: i1.HlmInputGroup }], ngImport: i0, template: `
|
|
98
|
+
<input
|
|
99
|
+
#input
|
|
100
|
+
hlmInputGroupInput
|
|
101
|
+
[value]="_inputValue()"
|
|
102
|
+
[id]="inputId()"
|
|
103
|
+
[placeholder]="placeholder()"
|
|
104
|
+
[disabled]="_disabled()"
|
|
105
|
+
[forceInvalid]="forceInvalid()"
|
|
106
|
+
(click)="_handleClick()"
|
|
107
|
+
(keydown.arrowDown)="_open()"
|
|
108
|
+
(keydown.enter)="_handleEnter($event)"
|
|
109
|
+
(input)="_handleInputChange($event)"
|
|
110
|
+
(focus)="_handleFocus()"
|
|
111
|
+
(blur)="_handleBlur()"
|
|
112
|
+
/>
|
|
113
|
+
<hlm-input-group-addon align="inline-end">
|
|
114
|
+
@if (_showClearButton()) {
|
|
115
|
+
<button
|
|
116
|
+
hlmInputGroupButton
|
|
117
|
+
size="icon-xs"
|
|
118
|
+
variant="ghost"
|
|
119
|
+
[attr.aria-label]="clearAriaLabel()"
|
|
120
|
+
(click)="_clear()"
|
|
121
|
+
[disabled]="_disabled()"
|
|
122
|
+
>
|
|
123
|
+
<ng-icon name="lucideX" />
|
|
124
|
+
</button>
|
|
125
|
+
}
|
|
126
|
+
<button
|
|
127
|
+
hlmInputGroupButton
|
|
128
|
+
size="icon-xs"
|
|
129
|
+
[attr.aria-label]="calendarAriaLabel()"
|
|
130
|
+
(click)="_popover().open()"
|
|
131
|
+
[disabled]="_disabled()"
|
|
132
|
+
>
|
|
133
|
+
<ng-icon name="lucideCalendar" />
|
|
134
|
+
</button>
|
|
135
|
+
</hlm-input-group-addon>
|
|
136
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1.HlmInputGroupAddon, selector: "[hlmInputGroupAddon],hlm-input-group-addon", inputs: ["align"] }, { kind: "directive", type: i1.HlmInputGroupButton, selector: "button[hlmInputGroupButton]", inputs: ["size", "type"] }, { kind: "directive", type: i1.HlmInputGroupInput, selector: "input[hlmInputGroupInput]" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
137
|
+
}
|
|
138
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDateMultiInput, decorators: [{
|
|
139
|
+
type: Component,
|
|
140
|
+
args: [{
|
|
141
|
+
selector: 'hlm-date-multi-input',
|
|
142
|
+
imports: [HlmInputGroupImports, NgIcon],
|
|
143
|
+
providers: [provideIcons({ lucideCalendar, lucideX }), provideBrnDatePickerTrigger(HlmDateMultiInput)],
|
|
144
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
145
|
+
hostDirectives: [HlmInputGroup],
|
|
146
|
+
template: `
|
|
147
|
+
<input
|
|
148
|
+
#input
|
|
149
|
+
hlmInputGroupInput
|
|
150
|
+
[value]="_inputValue()"
|
|
151
|
+
[id]="inputId()"
|
|
152
|
+
[placeholder]="placeholder()"
|
|
153
|
+
[disabled]="_disabled()"
|
|
154
|
+
[forceInvalid]="forceInvalid()"
|
|
155
|
+
(click)="_handleClick()"
|
|
156
|
+
(keydown.arrowDown)="_open()"
|
|
157
|
+
(keydown.enter)="_handleEnter($event)"
|
|
158
|
+
(input)="_handleInputChange($event)"
|
|
159
|
+
(focus)="_handleFocus()"
|
|
160
|
+
(blur)="_handleBlur()"
|
|
161
|
+
/>
|
|
162
|
+
<hlm-input-group-addon align="inline-end">
|
|
163
|
+
@if (_showClearButton()) {
|
|
164
|
+
<button
|
|
165
|
+
hlmInputGroupButton
|
|
166
|
+
size="icon-xs"
|
|
167
|
+
variant="ghost"
|
|
168
|
+
[attr.aria-label]="clearAriaLabel()"
|
|
169
|
+
(click)="_clear()"
|
|
170
|
+
[disabled]="_disabled()"
|
|
171
|
+
>
|
|
172
|
+
<ng-icon name="lucideX" />
|
|
173
|
+
</button>
|
|
174
|
+
}
|
|
175
|
+
<button
|
|
176
|
+
hlmInputGroupButton
|
|
177
|
+
size="icon-xs"
|
|
178
|
+
[attr.aria-label]="calendarAriaLabel()"
|
|
179
|
+
(click)="_popover().open()"
|
|
180
|
+
[disabled]="_disabled()"
|
|
181
|
+
>
|
|
182
|
+
<ng-icon name="lucideCalendar" />
|
|
183
|
+
</button>
|
|
184
|
+
</hlm-input-group-addon>
|
|
185
|
+
`,
|
|
186
|
+
}]
|
|
187
|
+
}], propDecorators: { parseDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "parseDate", required: false }] }], formatInputDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatInputDates", required: false }] }] } });
|
|
188
|
+
|
|
13
189
|
function getDefaultConfig$2() {
|
|
14
190
|
return {
|
|
15
191
|
formatDate: (date) => (date instanceof Date ? date.toDateString() : `${date}`),
|
|
192
|
+
formatInputDate: (date) => (date instanceof Date ? date.toDateString() : `${date}`),
|
|
16
193
|
transformDate: (date) => date,
|
|
194
|
+
parseDate: (value) => {
|
|
195
|
+
const date = new Date(value);
|
|
196
|
+
return isNaN(date.getTime()) ? null : date;
|
|
197
|
+
},
|
|
17
198
|
autoCloseOnSelect: false,
|
|
18
199
|
};
|
|
19
200
|
}
|
|
@@ -31,52 +212,90 @@ const HLM_DATE_PICKER_VALUE_ACCESSOR = {
|
|
|
31
212
|
useExisting: forwardRef(() => HlmDatePicker),
|
|
32
213
|
multi: true,
|
|
33
214
|
};
|
|
34
|
-
|
|
35
|
-
class HlmDatePicker extends BrnFormFieldControl {
|
|
215
|
+
class HlmDatePicker {
|
|
36
216
|
_config = injectHlmDatePickerConfig();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
217
|
+
popover = viewChild.required(BrnPopover, /* @ts-ignore */
|
|
218
|
+
...(ngDevMode ? [{ debugName: "popover" }] : /* istanbul ignore next */ []));
|
|
219
|
+
_trigger = contentChild(BrnDatePickerTriggerToken, /* @ts-ignore */
|
|
220
|
+
...(ngDevMode ? [{ debugName: "_trigger" }] : /* istanbul ignore next */ []));
|
|
221
|
+
/** Show dropdowns to navigate between months or years. */
|
|
222
|
+
captionLayout = input('label', /* @ts-ignore */
|
|
223
|
+
...(ngDevMode ? [{ debugName: "captionLayout" }] : /* istanbul ignore next */ []));
|
|
41
224
|
/** The minimum date that can be selected.*/
|
|
42
|
-
min = input(
|
|
225
|
+
min = input(/* @ts-ignore */
|
|
226
|
+
...(ngDevMode ? [undefined, { debugName: "min" }] : /* istanbul ignore next */ []));
|
|
43
227
|
/** The maximum date that can be selected. */
|
|
44
|
-
max = input(
|
|
228
|
+
max = input(/* @ts-ignore */
|
|
229
|
+
...(ngDevMode ? [undefined, { debugName: "max" }] : /* istanbul ignore next */ []));
|
|
45
230
|
/** Determine if the date picker is disabled. */
|
|
46
|
-
disabled = input(false, ...(ngDevMode ?
|
|
47
|
-
|
|
48
|
-
|
|
231
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
232
|
+
/** Additional interaction lock that does not write to a reactive form control. */
|
|
233
|
+
wrapperDisabled = input(false, { ...(ngDevMode ? { debugName: "wrapperDisabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
49
234
|
/** The selected value. */
|
|
50
|
-
date = input(
|
|
51
|
-
|
|
235
|
+
date = input(/* @ts-ignore */
|
|
236
|
+
...(ngDevMode ? [undefined, { debugName: "date" }] : /* istanbul ignore next */ []));
|
|
237
|
+
/** The date the calendar focuses on first open when no date is selected. */
|
|
238
|
+
defaultFocusedDate = input(/* @ts-ignore */
|
|
239
|
+
...(ngDevMode ? [undefined, { debugName: "defaultFocusedDate" }] : /* istanbul ignore next */ []));
|
|
240
|
+
_mutableDate = linkedSignal(this.date, /* @ts-ignore */
|
|
241
|
+
...(ngDevMode ? [{ debugName: "_mutableDate" }] : /* istanbul ignore next */ []));
|
|
52
242
|
/** If true, the date picker will close when a date is selected. */
|
|
53
|
-
autoCloseOnSelect = input(this._config.autoCloseOnSelect, ...(ngDevMode ?
|
|
54
|
-
transform: booleanAttribute,
|
|
55
|
-
}]));
|
|
243
|
+
autoCloseOnSelect = input(this._config.autoCloseOnSelect, { ...(ngDevMode ? { debugName: "autoCloseOnSelect" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
56
244
|
/** Defines how the date should be displayed in the UI. */
|
|
57
|
-
formatDate = input(this._config.formatDate,
|
|
245
|
+
formatDate = input(this._config.formatDate, /* @ts-ignore */
|
|
246
|
+
...(ngDevMode ? [{ debugName: "formatDate" }] : /* istanbul ignore next */ []));
|
|
58
247
|
/** Defines how the date should be transformed before saving to model/form. */
|
|
59
|
-
transformDate = input(this._config.transformDate,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
248
|
+
transformDate = input(this._config.transformDate, /* @ts-ignore */
|
|
249
|
+
...(ngDevMode ? [{ debugName: "transformDate" }] : /* istanbul ignore next */ []));
|
|
250
|
+
_popoverState = signal(null, /* @ts-ignore */
|
|
251
|
+
...(ngDevMode ? [{ debugName: "_popoverState" }] : /* istanbul ignore next */ []));
|
|
252
|
+
_formDisabled = signal(false, /* @ts-ignore */
|
|
253
|
+
...(ngDevMode ? [{ debugName: "_formDisabled" }] : /* istanbul ignore next */ []));
|
|
254
|
+
/** @internal The disabled state as a readonly signal */
|
|
255
|
+
disabledState = computed(() => this.disabled() || this.wrapperDisabled() || this._formDisabled(), /* @ts-ignore */
|
|
256
|
+
...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
|
|
257
|
+
formattedDate = computed(() => {
|
|
63
258
|
const date = this._mutableDate();
|
|
64
259
|
return date ? this.formatDate()(date) : undefined;
|
|
65
|
-
},
|
|
260
|
+
}, /* @ts-ignore */
|
|
261
|
+
...(ngDevMode ? [{ debugName: "formattedDate" }] : /* istanbul ignore next */ []));
|
|
66
262
|
dateChange = output();
|
|
263
|
+
labelableId = computed(() => this._trigger()?.triggerId(), /* @ts-ignore */
|
|
264
|
+
...(ngDevMode ? [{ debugName: "labelableId" }] : /* istanbul ignore next */ []));
|
|
265
|
+
hasDate = computed(() => !!this._mutableDate(), /* @ts-ignore */
|
|
266
|
+
...(ngDevMode ? [{ debugName: "hasDate" }] : /* istanbul ignore next */ []));
|
|
267
|
+
/** @internal The current raw value, used by inputs to reformat on focus. */
|
|
268
|
+
value = computed(() => this._mutableDate() ?? null, /* @ts-ignore */
|
|
269
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
67
270
|
_onChange;
|
|
68
271
|
_onTouched;
|
|
272
|
+
_onStateChange(state) {
|
|
273
|
+
this._popoverState.set(state);
|
|
274
|
+
if (state === 'closed')
|
|
275
|
+
this._onTouched?.();
|
|
276
|
+
}
|
|
69
277
|
_handleChange(value) {
|
|
70
|
-
if (this.
|
|
278
|
+
if (this.disabledState())
|
|
71
279
|
return;
|
|
72
|
-
|
|
73
|
-
this._mutableDate.set(transformedDate);
|
|
74
|
-
this._onChange?.(transformedDate);
|
|
75
|
-
this.dateChange.emit(transformedDate);
|
|
280
|
+
this.updateDate(value ?? null);
|
|
76
281
|
if (this.autoCloseOnSelect()) {
|
|
77
282
|
this._popoverState.set('closed');
|
|
78
283
|
}
|
|
79
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* Commit a date to the picker. Updates the internal model, notifies form
|
|
287
|
+
* controls, and emits `dateChange`. Unlike `_handleChange`, this does not
|
|
288
|
+
* close the popover - it's intended to be called from a text input that
|
|
289
|
+
* is parsing user-entered values while typing.
|
|
290
|
+
*/
|
|
291
|
+
updateDate(value) {
|
|
292
|
+
if (this.disabledState())
|
|
293
|
+
return;
|
|
294
|
+
const transformedDate = value != null ? this.transformDate()(value) : undefined;
|
|
295
|
+
this._mutableDate.set(transformedDate);
|
|
296
|
+
this._onChange?.(transformedDate ?? null);
|
|
297
|
+
this.dateChange.emit(transformedDate ?? null);
|
|
298
|
+
}
|
|
80
299
|
/** CONTROL VALUE ACCESSOR */
|
|
81
300
|
writeValue(value) {
|
|
82
301
|
this._mutableDate.set(value ? this.transformDate()(value) : undefined);
|
|
@@ -87,8 +306,11 @@ class HlmDatePicker extends BrnFormFieldControl {
|
|
|
87
306
|
registerOnTouched(fn) {
|
|
88
307
|
this._onTouched = fn;
|
|
89
308
|
}
|
|
309
|
+
touched() {
|
|
310
|
+
this._onTouched?.();
|
|
311
|
+
}
|
|
90
312
|
setDisabledState(isDisabled) {
|
|
91
|
-
this.
|
|
313
|
+
this._formDisabled.set(isDisabled);
|
|
92
314
|
}
|
|
93
315
|
open() {
|
|
94
316
|
this._popoverState.set('open');
|
|
@@ -96,169 +318,244 @@ class HlmDatePicker extends BrnFormFieldControl {
|
|
|
96
318
|
close() {
|
|
97
319
|
this._popoverState.set('closed');
|
|
98
320
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
321
|
+
reset() {
|
|
322
|
+
this._mutableDate.set(undefined);
|
|
323
|
+
this._onChange?.(null);
|
|
324
|
+
this.dateChange.emit(null);
|
|
325
|
+
}
|
|
326
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
327
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.3", type: HlmDatePicker, isStandalone: true, selector: "hlm-date-picker", inputs: { captionLayout: { classPropertyName: "captionLayout", publicName: "captionLayout", 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 }, wrapperDisabled: { classPropertyName: "wrapperDisabled", publicName: "wrapperDisabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", 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: [HLM_DATE_PICKER_VALUE_ACCESSOR, provideBrnDatePicker(HlmDatePicker), provideBrnLabelable(HlmDatePicker)], queries: [{ propertyName: "_trigger", first: true, predicate: BrnDatePickerTriggerToken, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "popover", first: true, predicate: BrnPopover, descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$1.BrnFieldControl }], ngImport: i0, template: "\n <hlm-popover sideOffset=\"5\" [state]=\"_popoverState()\" (stateChanged)=\"_onStateChange($event)\">\n <ng-content />\n\n <hlm-popover-content class=\"w-fit p-0\" *hlmPopoverPortal=\"let ctx\">\n <ng-content select=\"[hlmDatePickerHeader]\" />\n <hlm-calendar\n class=\"rounded-none border-0\"\n [captionLayout]=\"captionLayout()\"\n [date]=\"_mutableDate()\"\n [defaultFocusedDate]=\"_mutableDate() ?? defaultFocusedDate()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [disabled]=\"disabledState()\"\n (dateChange)=\"_handleChange($event)\"\n />\n <ng-content select=\"[hlmDatePickerFooter]\" />\n </hlm-popover-content>\n </hlm-popover>\n ", isInline: true, dependencies: [{ kind: "directive", type: i2.HlmPopover, selector: "[hlmPopover],hlm-popover" }, { kind: "directive", type: i2.HlmPopoverContent, selector: "[hlmPopoverContent],hlm-popover-content" }, { kind: "directive", type: i2.HlmPopoverPortal, selector: "[hlmPopoverPortal]" }, { kind: "component", type: HlmCalendar, selector: "hlm-calendar", inputs: ["captionLayout"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
328
|
+
}
|
|
329
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePicker, decorators: [{
|
|
330
|
+
type: Component,
|
|
331
|
+
args: [{
|
|
332
|
+
selector: 'hlm-date-picker',
|
|
333
|
+
imports: [HlmPopoverImports, HlmCalendar],
|
|
334
|
+
providers: [HLM_DATE_PICKER_VALUE_ACCESSOR, provideBrnDatePicker(HlmDatePicker), provideBrnLabelable(HlmDatePicker)],
|
|
335
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
336
|
+
hostDirectives: [BrnFieldControl],
|
|
337
|
+
host: { class: 'block' },
|
|
338
|
+
template: "\n <hlm-popover sideOffset=\"5\" [state]=\"_popoverState()\" (stateChanged)=\"_onStateChange($event)\">\n <ng-content />\n\n <hlm-popover-content class=\"w-fit p-0\" *hlmPopoverPortal=\"let ctx\">\n <ng-content select=\"[hlmDatePickerHeader]\" />\n <hlm-calendar\n class=\"rounded-none border-0\"\n [captionLayout]=\"captionLayout()\"\n [date]=\"_mutableDate()\"\n [defaultFocusedDate]=\"_mutableDate() ?? defaultFocusedDate()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [disabled]=\"disabledState()\"\n (dateChange)=\"_handleChange($event)\"\n />\n <ng-content select=\"[hlmDatePickerFooter]\" />\n </hlm-popover-content>\n </hlm-popover>\n ",
|
|
339
|
+
}]
|
|
340
|
+
}], propDecorators: { popover: [{ type: i0.ViewChild, args: [i0.forwardRef(() => BrnPopover), { isSignal: true }] }], _trigger: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BrnDatePickerTriggerToken), { isSignal: true }] }], captionLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionLayout", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], wrapperDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "wrapperDisabled", required: false }] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }], defaultFocusedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultFocusedDate", required: false }] }], autoCloseOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoCloseOnSelect", required: false }] }], formatDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatDate", required: false }] }], transformDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "transformDate", required: false }] }], dateChange: [{ type: i0.Output, args: ["dateChange"] }] } });
|
|
341
|
+
|
|
342
|
+
class HlmDatePickerAnchor {
|
|
343
|
+
_host = inject(ElementRef, { host: true });
|
|
344
|
+
_brnOverlay = inject(BrnOverlay, { optional: true });
|
|
345
|
+
hlmDatePickerAnchorForInput = input(undefined, { ...(ngDevMode ? { debugName: "hlmDatePickerAnchorForInput" } : /* istanbul ignore next */ {}), alias: 'hlmDatePickerAnchorFor' });
|
|
346
|
+
hlmDatePickerAnchorFor = linkedSignal(this.hlmDatePickerAnchorForInput, /* @ts-ignore */
|
|
347
|
+
...(ngDevMode ? [{ debugName: "hlmDatePickerAnchorFor" }] : /* istanbul ignore next */ []));
|
|
348
|
+
constructor() {
|
|
349
|
+
effect(() => {
|
|
350
|
+
this.hlmDatePickerAnchorFor()?.setOrigin(this._host.nativeElement);
|
|
351
|
+
});
|
|
352
|
+
this._brnOverlay?.setOrigin(this._host.nativeElement);
|
|
353
|
+
}
|
|
354
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePickerAnchor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
355
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmDatePickerAnchor, isStandalone: true, selector: "[hlmDatePickerAnchor]", inputs: { hlmDatePickerAnchorForInput: { classPropertyName: "hlmDatePickerAnchorForInput", publicName: "hlmDatePickerAnchorFor", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
356
|
+
}
|
|
357
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePickerAnchor, decorators: [{
|
|
358
|
+
type: Directive,
|
|
359
|
+
args: [{ selector: '[hlmDatePickerAnchor]' }]
|
|
360
|
+
}], ctorParameters: () => [], propDecorators: { hlmDatePickerAnchorForInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "hlmDatePickerAnchorFor", required: false }] }] } });
|
|
361
|
+
|
|
362
|
+
class HlmDatePickerInput extends BrnDateInput {
|
|
363
|
+
_config = injectHlmDatePickerConfig();
|
|
364
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
365
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
366
|
+
ariaDescribedby = input(null, /* @ts-ignore */
|
|
367
|
+
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
368
|
+
/**
|
|
369
|
+
* Parses input text into a date value. Return `null` for invalid
|
|
370
|
+
* input - the picker's date is cleared while the text is preserved so
|
|
371
|
+
* the user can fix it.
|
|
372
|
+
*
|
|
373
|
+
* Defaults to `parseDate` from `HlmDatePickerConfig`.
|
|
374
|
+
*/
|
|
375
|
+
parseDate = input(this._config.parseDate, /* @ts-ignore */
|
|
376
|
+
...(ngDevMode ? [{ debugName: "parseDate" }] : /* istanbul ignore next */ []));
|
|
377
|
+
/**
|
|
378
|
+
* Formats the current date into the input/edit format shown while the
|
|
379
|
+
* input is focused. On blur the picker's display format is restored.
|
|
380
|
+
*
|
|
381
|
+
* Defaults to `formatInputDate` from `HlmDatePickerConfig`.
|
|
382
|
+
*/
|
|
383
|
+
formatInputDate = input(this._config.formatInputDate, /* @ts-ignore */
|
|
384
|
+
...(ngDevMode ? [{ debugName: "formatInputDate" }] : /* istanbul ignore next */ []));
|
|
385
|
+
parseValue(value) {
|
|
386
|
+
return this.parseDate()(value);
|
|
387
|
+
}
|
|
388
|
+
formatInputValue(value) {
|
|
389
|
+
return this.formatInputDate()(value);
|
|
390
|
+
}
|
|
391
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePickerInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
392
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: HlmDatePickerInput, isStandalone: true, selector: "hlm-date-picker-input", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null }, parseDate: { classPropertyName: "parseDate", publicName: "parseDate", isSignal: true, isRequired: false, transformFunction: null }, formatInputDate: { classPropertyName: "formatInputDate", publicName: "formatInputDate", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideIcons({ lucideCalendar, lucideX }), provideBrnDatePickerTrigger(HlmDatePickerInput)], usesInheritance: true, hostDirectives: [{ directive: i1.HlmInputGroup }], ngImport: i0, template: `
|
|
393
|
+
<input
|
|
394
|
+
#input
|
|
395
|
+
hlmInputGroupInput
|
|
396
|
+
[value]="_inputValue()"
|
|
397
|
+
[id]="inputId()"
|
|
398
|
+
[attr.aria-label]="ariaLabel()"
|
|
399
|
+
[attr.aria-describedby]="ariaDescribedby()"
|
|
400
|
+
[placeholder]="placeholder()"
|
|
401
|
+
[disabled]="_disabled()"
|
|
402
|
+
[forceInvalid]="forceInvalid()"
|
|
403
|
+
(click)="_handleClick()"
|
|
404
|
+
(keydown.arrowDown)="_open()"
|
|
405
|
+
(keydown.enter)="_handleEnter($event)"
|
|
406
|
+
(input)="_handleInputChange($event)"
|
|
407
|
+
(focus)="_handleFocus()"
|
|
408
|
+
(blur)="_handleBlur()"
|
|
409
|
+
/>
|
|
410
|
+
<hlm-input-group-addon align="inline-end">
|
|
411
|
+
@if (_showClearButton()) {
|
|
412
|
+
<button
|
|
413
|
+
hlmInputGroupButton
|
|
414
|
+
size="icon-xs"
|
|
415
|
+
variant="ghost"
|
|
416
|
+
[attr.aria-label]="clearAriaLabel()"
|
|
417
|
+
(click)="_clear()"
|
|
418
|
+
[disabled]="_disabled()"
|
|
419
|
+
>
|
|
420
|
+
<ng-icon name="lucideX" />
|
|
421
|
+
</button>
|
|
422
|
+
}
|
|
109
423
|
<button
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
[
|
|
113
|
-
|
|
114
|
-
|
|
424
|
+
hlmInputGroupButton
|
|
425
|
+
size="icon-xs"
|
|
426
|
+
[attr.aria-label]="calendarAriaLabel()"
|
|
427
|
+
(click)="_popover().open()"
|
|
428
|
+
[disabled]="_disabled()"
|
|
115
429
|
>
|
|
116
|
-
<
|
|
117
|
-
@if (_formattedDate(); as formattedDate) {
|
|
118
|
-
{{ formattedDate }}
|
|
119
|
-
} @else {
|
|
120
|
-
<ng-content />
|
|
121
|
-
}
|
|
122
|
-
</span>
|
|
123
|
-
|
|
124
|
-
<ng-icon hlm size="sm" name="lucideChevronDown" />
|
|
430
|
+
<ng-icon name="lucideCalendar" />
|
|
125
431
|
</button>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<hlm-calendar
|
|
129
|
-
calendarClass="border-0 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: "directive", type: BrnPopover, selector: "[brnPopover],brn-popover", inputs: ["align", "sideOffset", "offsetX"], 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 });
|
|
432
|
+
</hlm-input-group-addon>
|
|
433
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1.HlmInputGroupAddon, selector: "[hlmInputGroupAddon],hlm-input-group-addon", inputs: ["align"] }, { kind: "directive", type: i1.HlmInputGroupButton, selector: "button[hlmInputGroupButton]", inputs: ["size", "type"] }, { kind: "directive", type: i1.HlmInputGroupInput, selector: "input[hlmInputGroupInput]" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
139
434
|
}
|
|
140
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
435
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePickerInput, decorators: [{
|
|
141
436
|
type: Component,
|
|
142
437
|
args: [{
|
|
143
|
-
selector: 'hlm-date-picker',
|
|
144
|
-
imports: [
|
|
145
|
-
providers: [
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
{
|
|
149
|
-
provide: BrnFormFieldControl,
|
|
150
|
-
useExisting: forwardRef(() => HlmDatePicker),
|
|
151
|
-
},
|
|
152
|
-
],
|
|
438
|
+
selector: 'hlm-date-picker-input',
|
|
439
|
+
imports: [HlmInputGroupImports, NgIcon],
|
|
440
|
+
providers: [provideIcons({ lucideCalendar, lucideX }), provideBrnDatePickerTrigger(HlmDatePickerInput)],
|
|
441
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
442
|
+
hostDirectives: [HlmInputGroup],
|
|
153
443
|
template: `
|
|
154
|
-
<
|
|
444
|
+
<input
|
|
445
|
+
#input
|
|
446
|
+
hlmInputGroupInput
|
|
447
|
+
[value]="_inputValue()"
|
|
448
|
+
[id]="inputId()"
|
|
449
|
+
[attr.aria-label]="ariaLabel()"
|
|
450
|
+
[attr.aria-describedby]="ariaDescribedby()"
|
|
451
|
+
[placeholder]="placeholder()"
|
|
452
|
+
[disabled]="_disabled()"
|
|
453
|
+
[forceInvalid]="forceInvalid()"
|
|
454
|
+
(click)="_handleClick()"
|
|
455
|
+
(keydown.arrowDown)="_open()"
|
|
456
|
+
(keydown.enter)="_handleEnter($event)"
|
|
457
|
+
(input)="_handleInputChange($event)"
|
|
458
|
+
(focus)="_handleFocus()"
|
|
459
|
+
(blur)="_handleBlur()"
|
|
460
|
+
/>
|
|
461
|
+
<hlm-input-group-addon align="inline-end">
|
|
462
|
+
@if (_showClearButton()) {
|
|
463
|
+
<button
|
|
464
|
+
hlmInputGroupButton
|
|
465
|
+
size="icon-xs"
|
|
466
|
+
variant="ghost"
|
|
467
|
+
[attr.aria-label]="clearAriaLabel()"
|
|
468
|
+
(click)="_clear()"
|
|
469
|
+
[disabled]="_disabled()"
|
|
470
|
+
>
|
|
471
|
+
<ng-icon name="lucideX" />
|
|
472
|
+
</button>
|
|
473
|
+
}
|
|
155
474
|
<button
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
[
|
|
159
|
-
|
|
160
|
-
|
|
475
|
+
hlmInputGroupButton
|
|
476
|
+
size="icon-xs"
|
|
477
|
+
[attr.aria-label]="calendarAriaLabel()"
|
|
478
|
+
(click)="_popover().open()"
|
|
479
|
+
[disabled]="_disabled()"
|
|
161
480
|
>
|
|
162
|
-
<
|
|
163
|
-
@if (_formattedDate(); as formattedDate) {
|
|
164
|
-
{{ formattedDate }}
|
|
165
|
-
} @else {
|
|
166
|
-
<ng-content />
|
|
167
|
-
}
|
|
168
|
-
</span>
|
|
169
|
-
|
|
170
|
-
<ng-icon hlm size="sm" name="lucideChevronDown" />
|
|
481
|
+
<ng-icon name="lucideCalendar" />
|
|
171
482
|
</button>
|
|
172
|
-
|
|
173
|
-
<div hlmPopoverContent class="w-auto p-0" *brnPopoverContent="let ctx">
|
|
174
|
-
<hlm-calendar
|
|
175
|
-
calendarClass="border-0 rounded-none"
|
|
176
|
-
[date]="_mutableDate()"
|
|
177
|
-
[min]="min()"
|
|
178
|
-
[max]="max()"
|
|
179
|
-
[disabled]="_mutableDisabled()"
|
|
180
|
-
(dateChange)="_handleChange($event)"
|
|
181
|
-
/>
|
|
182
|
-
</div>
|
|
183
|
-
</brn-popover>
|
|
483
|
+
</hlm-input-group-addon>
|
|
184
484
|
`,
|
|
185
|
-
host: {
|
|
186
|
-
class: 'block',
|
|
187
|
-
},
|
|
188
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
189
485
|
}]
|
|
190
|
-
}], propDecorators: {
|
|
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
|
-
}
|
|
486
|
+
}], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }], parseDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "parseDate", required: false }] }], formatInputDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatInputDate", required: false }] }] } });
|
|
207
487
|
|
|
208
488
|
const HLM_DATE_PICKER_MUTLI_VALUE_ACCESSOR = {
|
|
209
489
|
provide: NG_VALUE_ACCESSOR,
|
|
210
490
|
useExisting: forwardRef(() => HlmDatePickerMulti),
|
|
211
491
|
multi: true,
|
|
212
492
|
};
|
|
213
|
-
let nextId$1 = 0;
|
|
214
493
|
class HlmDatePickerMulti {
|
|
215
494
|
_config = injectHlmDatePickerMultiConfig();
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
495
|
+
popover = viewChild.required(BrnPopover, /* @ts-ignore */
|
|
496
|
+
...(ngDevMode ? [{ debugName: "popover" }] : /* istanbul ignore next */ []));
|
|
497
|
+
_trigger = contentChild(BrnDatePickerTriggerToken, /* @ts-ignore */
|
|
498
|
+
...(ngDevMode ? [{ debugName: "_trigger" }] : /* istanbul ignore next */ []));
|
|
499
|
+
/** Show dropdowns to navigate between months or years. */
|
|
500
|
+
captionLayout = input('label', /* @ts-ignore */
|
|
501
|
+
...(ngDevMode ? [{ debugName: "captionLayout" }] : /* istanbul ignore next */ []));
|
|
220
502
|
/** The minimum date that can be selected.*/
|
|
221
|
-
min = input(
|
|
503
|
+
min = input(/* @ts-ignore */
|
|
504
|
+
...(ngDevMode ? [undefined, { debugName: "min" }] : /* istanbul ignore next */ []));
|
|
222
505
|
/** The maximum date that can be selected. */
|
|
223
|
-
max = input(
|
|
506
|
+
max = input(/* @ts-ignore */
|
|
507
|
+
...(ngDevMode ? [undefined, { debugName: "max" }] : /* istanbul ignore next */ []));
|
|
224
508
|
/** The minimum selectable dates. */
|
|
225
|
-
minSelection = input(undefined, ...(ngDevMode ?
|
|
226
|
-
transform: numberAttribute,
|
|
227
|
-
}]));
|
|
509
|
+
minSelection = input(undefined, { ...(ngDevMode ? { debugName: "minSelection" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
228
510
|
/** The maximum selectable dates. */
|
|
229
|
-
maxSelection = input(undefined, ...(ngDevMode ?
|
|
230
|
-
transform: numberAttribute,
|
|
231
|
-
}]));
|
|
511
|
+
maxSelection = input(undefined, { ...(ngDevMode ? { debugName: "maxSelection" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
232
512
|
/** Determine if the date picker is disabled. */
|
|
233
|
-
disabled = input(false, ...(ngDevMode ?
|
|
234
|
-
transform: booleanAttribute,
|
|
235
|
-
}]));
|
|
513
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
236
514
|
/** The selected value. */
|
|
237
|
-
date = input(
|
|
238
|
-
|
|
515
|
+
date = input(/* @ts-ignore */
|
|
516
|
+
...(ngDevMode ? [undefined, { debugName: "date" }] : /* istanbul ignore next */ []));
|
|
517
|
+
_mutableDate = linkedSignal(this.date, /* @ts-ignore */
|
|
518
|
+
...(ngDevMode ? [{ debugName: "_mutableDate" }] : /* istanbul ignore next */ []));
|
|
239
519
|
/** If true, the date picker will close when the max selection of dates is reached. */
|
|
240
|
-
autoCloseOnMaxSelection = input(this._config.autoCloseOnMaxSelection, ...(ngDevMode ?
|
|
241
|
-
transform: booleanAttribute,
|
|
242
|
-
}]));
|
|
520
|
+
autoCloseOnMaxSelection = input(this._config.autoCloseOnMaxSelection, { ...(ngDevMode ? { debugName: "autoCloseOnMaxSelection" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
243
521
|
/** Defines how the date should be displayed in the UI. */
|
|
244
|
-
formatDates = input(this._config.formatDates,
|
|
522
|
+
formatDates = input(this._config.formatDates, /* @ts-ignore */
|
|
523
|
+
...(ngDevMode ? [{ debugName: "formatDates" }] : /* istanbul ignore next */ []));
|
|
245
524
|
/** Defines how the date should be transformed before saving to model/form. */
|
|
246
|
-
transformDates = input(this._config.transformDates,
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
525
|
+
transformDates = input(this._config.transformDates, /* @ts-ignore */
|
|
526
|
+
...(ngDevMode ? [{ debugName: "transformDates" }] : /* istanbul ignore next */ []));
|
|
527
|
+
_popoverState = signal(null, /* @ts-ignore */
|
|
528
|
+
...(ngDevMode ? [{ debugName: "_popoverState" }] : /* istanbul ignore next */ []));
|
|
529
|
+
_disabled = linkedSignal(this.disabled, /* @ts-ignore */
|
|
530
|
+
...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
|
|
531
|
+
/** @internal The disabled state as a readonly signal */
|
|
532
|
+
disabledState = this._disabled.asReadonly();
|
|
533
|
+
formattedDate = computed(() => {
|
|
250
534
|
const dates = this._mutableDate();
|
|
251
535
|
return dates ? this.formatDates()(dates) : undefined;
|
|
252
|
-
},
|
|
536
|
+
}, /* @ts-ignore */
|
|
537
|
+
...(ngDevMode ? [{ debugName: "formattedDate" }] : /* istanbul ignore next */ []));
|
|
253
538
|
dateChange = output();
|
|
539
|
+
labelableId = computed(() => this._trigger()?.triggerId(), /* @ts-ignore */
|
|
540
|
+
...(ngDevMode ? [{ debugName: "labelableId" }] : /* istanbul ignore next */ []));
|
|
541
|
+
hasDate = computed(() => !!this._mutableDate()?.length, /* @ts-ignore */
|
|
542
|
+
...(ngDevMode ? [{ debugName: "hasDate" }] : /* istanbul ignore next */ []));
|
|
543
|
+
/** @internal The current raw value, used by inputs to reformat on focus. */
|
|
544
|
+
value = computed(() => this._mutableDate() ?? null, /* @ts-ignore */
|
|
545
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
254
546
|
_onChange;
|
|
255
547
|
_onTouched;
|
|
548
|
+
_onStateChange(state) {
|
|
549
|
+
this._popoverState.set(state);
|
|
550
|
+
if (state === 'closed')
|
|
551
|
+
this._onTouched?.();
|
|
552
|
+
}
|
|
256
553
|
_handleChange(value) {
|
|
257
554
|
if (value === undefined)
|
|
258
555
|
return;
|
|
259
|
-
if (this.
|
|
556
|
+
if (this._disabled())
|
|
260
557
|
return;
|
|
261
|
-
const transformedDate = this.transformDates()(value);
|
|
558
|
+
const transformedDate = value !== undefined ? this.transformDates()(value) : value;
|
|
262
559
|
this._mutableDate.set(transformedDate);
|
|
263
560
|
this._onChange?.(transformedDate);
|
|
264
561
|
this.dateChange.emit(transformedDate);
|
|
@@ -266,6 +563,22 @@ class HlmDatePickerMulti {
|
|
|
266
563
|
this._popoverState.set('closed');
|
|
267
564
|
}
|
|
268
565
|
}
|
|
566
|
+
/**
|
|
567
|
+
* Commit dates to the picker. Updates the internal model, notifies form
|
|
568
|
+
* controls, and emits `dateChange`. Intended to be called from a text input
|
|
569
|
+
* that parses user-entered values. Pass `null` to clear the selection.
|
|
570
|
+
*/
|
|
571
|
+
updateDate(value) {
|
|
572
|
+
if (this._disabled())
|
|
573
|
+
return;
|
|
574
|
+
const transformedDate = value ? this.transformDates()(value) : undefined;
|
|
575
|
+
this._mutableDate.set(transformedDate);
|
|
576
|
+
this._onChange?.(transformedDate ?? []);
|
|
577
|
+
this.dateChange.emit(transformedDate ?? []);
|
|
578
|
+
}
|
|
579
|
+
touched() {
|
|
580
|
+
this._onTouched?.();
|
|
581
|
+
}
|
|
269
582
|
/** CONTROL VALUE ACCESSOR */
|
|
270
583
|
writeValue(value) {
|
|
271
584
|
this._mutableDate.set(value ? this.transformDates()(value) : undefined);
|
|
@@ -277,7 +590,7 @@ class HlmDatePickerMulti {
|
|
|
277
590
|
this._onTouched = fn;
|
|
278
591
|
}
|
|
279
592
|
setDisabledState(isDisabled) {
|
|
280
|
-
this.
|
|
593
|
+
this._disabled.set(isDisabled);
|
|
281
594
|
}
|
|
282
595
|
open() {
|
|
283
596
|
this._popoverState.set('open');
|
|
@@ -285,157 +598,306 @@ class HlmDatePickerMulti {
|
|
|
285
598
|
close() {
|
|
286
599
|
this._popoverState.set('closed');
|
|
287
600
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
<
|
|
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: "directive", type: BrnPopover, selector: "[brnPopover],brn-popover", inputs: ["align", "sideOffset", "offsetX"], 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 });
|
|
601
|
+
reset() {
|
|
602
|
+
this._mutableDate.set(undefined);
|
|
603
|
+
this._onChange?.([]);
|
|
604
|
+
this.dateChange.emit([]);
|
|
605
|
+
}
|
|
606
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePickerMulti, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
607
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.3", type: HlmDatePickerMulti, isStandalone: true, selector: "hlm-date-picker-multi", inputs: { captionLayout: { classPropertyName: "captionLayout", publicName: "captionLayout", 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: [
|
|
608
|
+
HLM_DATE_PICKER_MUTLI_VALUE_ACCESSOR,
|
|
609
|
+
provideBrnDatePicker(HlmDatePickerMulti),
|
|
610
|
+
provideBrnLabelable(HlmDatePickerMulti),
|
|
611
|
+
], queries: [{ propertyName: "_trigger", first: true, predicate: BrnDatePickerTriggerToken, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "popover", first: true, predicate: BrnPopover, descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$1.BrnFieldControl }], ngImport: i0, template: "\n <hlm-popover sideOffset=\"5\" [state]=\"_popoverState()\" (stateChanged)=\"_onStateChange($event)\">\n <ng-content />\n\n <hlm-popover-content class=\"w-fit p-0\" *hlmPopoverPortal=\"let ctx\">\n <ng-content select=\"[hlmDatePickerHeader]\" />\n <hlm-calendar-multi\n class=\"rounded-none border-0\"\n [date]=\"_mutableDate()\"\n [captionLayout]=\"captionLayout()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [minSelection]=\"minSelection()\"\n [maxSelection]=\"maxSelection()\"\n [disabled]=\"_disabled()\"\n (dateChange)=\"_handleChange($event)\"\n />\n <ng-content select=\"[hlmDatePickerFooter]\" />\n </hlm-popover-content>\n </hlm-popover>\n ", isInline: true, dependencies: [{ kind: "directive", type: i2.HlmPopover, selector: "[hlmPopover],hlm-popover" }, { kind: "directive", type: i2.HlmPopoverContent, selector: "[hlmPopoverContent],hlm-popover-content" }, { kind: "directive", type: i2.HlmPopoverPortal, selector: "[hlmPopoverPortal]" }, { kind: "component", type: HlmCalendarMulti, selector: "hlm-calendar-multi", inputs: ["captionLayout"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
323
612
|
}
|
|
324
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
613
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePickerMulti, decorators: [{
|
|
325
614
|
type: Component,
|
|
326
615
|
args: [{
|
|
327
616
|
selector: 'hlm-date-picker-multi',
|
|
328
|
-
imports: [
|
|
329
|
-
providers: [
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
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>
|
|
617
|
+
imports: [HlmPopoverImports, HlmCalendarMulti],
|
|
618
|
+
providers: [
|
|
619
|
+
HLM_DATE_PICKER_MUTLI_VALUE_ACCESSOR,
|
|
620
|
+
provideBrnDatePicker(HlmDatePickerMulti),
|
|
621
|
+
provideBrnLabelable(HlmDatePickerMulti),
|
|
622
|
+
],
|
|
623
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
624
|
+
hostDirectives: [BrnFieldControl],
|
|
625
|
+
host: { class: 'block' },
|
|
626
|
+
template: "\n <hlm-popover sideOffset=\"5\" [state]=\"_popoverState()\" (stateChanged)=\"_onStateChange($event)\">\n <ng-content />\n\n <hlm-popover-content class=\"w-fit p-0\" *hlmPopoverPortal=\"let ctx\">\n <ng-content select=\"[hlmDatePickerHeader]\" />\n <hlm-calendar-multi\n class=\"rounded-none border-0\"\n [date]=\"_mutableDate()\"\n [captionLayout]=\"captionLayout()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [minSelection]=\"minSelection()\"\n [maxSelection]=\"maxSelection()\"\n [disabled]=\"_disabled()\"\n (dateChange)=\"_handleChange($event)\"\n />\n <ng-content select=\"[hlmDatePickerFooter]\" />\n </hlm-popover-content>\n </hlm-popover>\n ",
|
|
627
|
+
}]
|
|
628
|
+
}], propDecorators: { popover: [{ type: i0.ViewChild, args: [i0.forwardRef(() => BrnPopover), { isSignal: true }] }], _trigger: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BrnDatePickerTriggerToken), { isSignal: true }] }], captionLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionLayout", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], minSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "minSelection", required: false }] }], maxSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSelection", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }], autoCloseOnMaxSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoCloseOnMaxSelection", required: false }] }], formatDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatDates", required: false }] }], transformDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "transformDates", required: false }] }], dateChange: [{ type: i0.Output, args: ["dateChange"] }] } });
|
|
349
629
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
630
|
+
class HlmDatePickerTrigger {
|
|
631
|
+
static _nextId = 0;
|
|
632
|
+
_fieldControl = inject(BrnFieldControl, { optional: true });
|
|
633
|
+
_datePicker = injectBrnDatePicker();
|
|
634
|
+
_invalid = this._fieldControl?.invalid;
|
|
635
|
+
_spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid(), /* @ts-ignore */
|
|
636
|
+
...(ngDevMode ? [{ debugName: "_spartanInvalid" }] : /* istanbul ignore next */ []));
|
|
637
|
+
_dirty = this._fieldControl?.dirty;
|
|
638
|
+
_touched = this._fieldControl?.touched;
|
|
639
|
+
_ariaInvalid = computed(() => (this._invalid?.() ? 'true' : null), /* @ts-ignore */
|
|
640
|
+
...(ngDevMode ? [{ debugName: "_ariaInvalid" }] : /* istanbul ignore next */ []));
|
|
641
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
642
|
+
_computedClass = computed(() => hlm("data-placeholder:text-muted-foreground justify-between", this.userClass()), /* @ts-ignore */
|
|
643
|
+
...(ngDevMode ? [{ debugName: "_computedClass" }] : /* istanbul ignore next */ []));
|
|
644
|
+
_isPlaceholder = computed(() => !this._datePicker.hasDate(), /* @ts-ignore */
|
|
645
|
+
...(ngDevMode ? [{ debugName: "_isPlaceholder" }] : /* istanbul ignore next */ []));
|
|
646
|
+
/** The id of the button that opens the date picker. */
|
|
647
|
+
buttonId = input(`hlm-date-picker-${++HlmDatePickerTrigger._nextId}`, /* @ts-ignore */
|
|
648
|
+
...(ngDevMode ? [{ debugName: "buttonId" }] : /* istanbul ignore next */ []));
|
|
649
|
+
/** @internal The id of the button that opens the date picker, used for labeling. */
|
|
650
|
+
triggerId = this.buttonId;
|
|
651
|
+
/** Forces the invalid state visually, regardless of form control state. */
|
|
652
|
+
forceInvalid = input(false, { ...(ngDevMode ? { debugName: "forceInvalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
653
|
+
variant = input('outline', /* @ts-ignore */
|
|
654
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
655
|
+
showTrigger = input(true, { ...(ngDevMode ? { debugName: "showTrigger" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
656
|
+
_popover = this._datePicker.popover;
|
|
657
|
+
_disabled = this._datePicker.disabledState;
|
|
658
|
+
_formattedDate = this._datePicker.formattedDate;
|
|
659
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePickerTrigger, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
660
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: HlmDatePickerTrigger, isStandalone: true, selector: "hlm-date-picker-trigger", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, buttonId: { classPropertyName: "buttonId", publicName: "buttonId", isSignal: true, isRequired: false, transformFunction: null }, forceInvalid: { classPropertyName: "forceInvalid", publicName: "forceInvalid", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, showTrigger: { classPropertyName: "showTrigger", publicName: "showTrigger", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "date-picker-trigger" } }, providers: [provideIcons({ lucideChevronDown }), provideBrnDatePickerTrigger(HlmDatePickerTrigger)], ngImport: i0, template: "\n <button\n [id]=\"buttonId()\"\n type=\"button\"\n [class]=\"_computedClass()\"\n [disabled]=\"_disabled()\"\n [attr.aria-invalid]=\"_ariaInvalid()\"\n [attr.data-invalid]=\"_ariaInvalid()\"\n [attr.data-touched]=\"_touched?.() ? 'true' : null\"\n [attr.data-dirty]=\"_dirty?.() ? 'true' : null\"\n [attr.data-matches-spartan-invalid]=\"_spartanInvalid() ? 'true' : null\"\n hlmBtn\n [variant]=\"variant()\"\n hlmPopoverTrigger\n [hlmPopoverTriggerFor]=\"_popover()\"\n brnFieldControlDescribedBy\n [attr.data-placeholder]=\"_isPlaceholder() ? '' : null\"\n >\n <span class=\"truncate\">\n @if (_formattedDate(); as formattedDate) {\n {{ formattedDate }}\n } @else {\n <ng-content />\n }\n </span>\n\n @if (showTrigger()) {\n <ng-icon name=\"lucideChevronDown\" />\n }\n </button>\n ", isInline: true, dependencies: [{ kind: "directive", type: i1$2.HlmBtn, selector: "button[hlmBtn], a[hlmBtn]", inputs: ["variant", "size", "class", "type"], exportAs: ["hlmBtn"] }, { kind: "directive", type: HlmPopoverTrigger, selector: "button[hlmPopoverTrigger],button[hlmPopoverTriggerFor]" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: BrnFieldControlDescribedBy, selector: "[brnFieldControlDescribedBy]", inputs: ["aria-describedby"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
661
|
+
}
|
|
662
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePickerTrigger, decorators: [{
|
|
663
|
+
type: Component,
|
|
664
|
+
args: [{
|
|
665
|
+
selector: 'hlm-date-picker-trigger',
|
|
666
|
+
imports: [HlmButtonImports, HlmPopoverTrigger, NgIcon, BrnFieldControlDescribedBy],
|
|
667
|
+
providers: [provideIcons({ lucideChevronDown }), provideBrnDatePickerTrigger(HlmDatePickerTrigger)],
|
|
367
668
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
669
|
+
host: { 'data-slot': 'date-picker-trigger' },
|
|
670
|
+
template: "\n <button\n [id]=\"buttonId()\"\n type=\"button\"\n [class]=\"_computedClass()\"\n [disabled]=\"_disabled()\"\n [attr.aria-invalid]=\"_ariaInvalid()\"\n [attr.data-invalid]=\"_ariaInvalid()\"\n [attr.data-touched]=\"_touched?.() ? 'true' : null\"\n [attr.data-dirty]=\"_dirty?.() ? 'true' : null\"\n [attr.data-matches-spartan-invalid]=\"_spartanInvalid() ? 'true' : null\"\n hlmBtn\n [variant]=\"variant()\"\n hlmPopoverTrigger\n [hlmPopoverTriggerFor]=\"_popover()\"\n brnFieldControlDescribedBy\n [attr.data-placeholder]=\"_isPlaceholder() ? '' : null\"\n >\n <span class=\"truncate\">\n @if (_formattedDate(); as formattedDate) {\n {{ formattedDate }}\n } @else {\n <ng-content />\n }\n </span>\n\n @if (showTrigger()) {\n <ng-icon name=\"lucideChevronDown\" />\n }\n </button>\n ",
|
|
368
671
|
}]
|
|
369
|
-
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], buttonId: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonId", required: false }] }],
|
|
672
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], buttonId: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonId", required: false }] }], forceInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "forceInvalid", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], showTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTrigger", required: false }] }] } });
|
|
370
673
|
|
|
371
|
-
function getDefaultConfig() {
|
|
674
|
+
function getDefaultConfig$1() {
|
|
372
675
|
return {
|
|
373
676
|
formatDates: (dates) => dates
|
|
374
677
|
.filter(Boolean)
|
|
375
678
|
.map((date) => (date instanceof Date ? date.toDateString() : `${date}`))
|
|
376
679
|
.join(' - '),
|
|
680
|
+
formatInputDates: (dates) => dates
|
|
681
|
+
.filter(Boolean)
|
|
682
|
+
.map((date) => (date instanceof Date ? date.toDateString() : `${date}`))
|
|
683
|
+
.join(' - '),
|
|
377
684
|
transformDates: (dates) => dates,
|
|
378
685
|
autoCloseOnEndSelection: false,
|
|
686
|
+
parseDate: (value) => {
|
|
687
|
+
if (typeof value !== 'string')
|
|
688
|
+
return null;
|
|
689
|
+
const parts = value.split(' - ').map((part) => part.trim());
|
|
690
|
+
if (parts.length === 0 || parts.length > 2)
|
|
691
|
+
return null;
|
|
692
|
+
const start = new Date(parts[0]);
|
|
693
|
+
if (isNaN(start.getTime()))
|
|
694
|
+
return null;
|
|
695
|
+
const end = parts.length === 2 ? new Date(parts[1]) : start;
|
|
696
|
+
return [start, isNaN(end.getTime()) ? start : end];
|
|
697
|
+
},
|
|
379
698
|
};
|
|
380
699
|
}
|
|
381
700
|
const HlmDateRangePickerConfigToken = new InjectionToken('HlmDateRangePickerConfig');
|
|
382
701
|
function provideHlmDateRangePickerConfig(config) {
|
|
383
|
-
return { provide: HlmDateRangePickerConfigToken, useValue: { ...getDefaultConfig(), ...config } };
|
|
702
|
+
return { provide: HlmDateRangePickerConfigToken, useValue: { ...getDefaultConfig$1(), ...config } };
|
|
384
703
|
}
|
|
385
704
|
function injectHlmDateRangePickerConfig() {
|
|
386
705
|
const injectedConfig = inject(HlmDateRangePickerConfigToken, { optional: true });
|
|
387
|
-
return injectedConfig ? injectedConfig : getDefaultConfig();
|
|
706
|
+
return injectedConfig ? injectedConfig : getDefaultConfig$1();
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
class HlmDateRangeInput extends BrnDateInput {
|
|
710
|
+
_config = injectHlmDateRangePickerConfig();
|
|
711
|
+
/**
|
|
712
|
+
* Parses input text into a date range. Return `null` for invalid
|
|
713
|
+
* input - the picker's range is cleared while the text is preserved so
|
|
714
|
+
* the user can fix it.
|
|
715
|
+
*
|
|
716
|
+
* Defaults to `parseDate` from `HlmDateRangePickerConfig`.
|
|
717
|
+
*/
|
|
718
|
+
parseDate = input(this._config.parseDate, /* @ts-ignore */
|
|
719
|
+
...(ngDevMode ? [{ debugName: "parseDate" }] : /* istanbul ignore next */ []));
|
|
720
|
+
/**
|
|
721
|
+
* Formats the current range into the input/edit format shown while the
|
|
722
|
+
* input is focused. On blur the picker's display format is restored.
|
|
723
|
+
*
|
|
724
|
+
* Defaults to `formatInputDates` from `HlmDateRangePickerConfig`.
|
|
725
|
+
*/
|
|
726
|
+
formatInputDates = input(this._config.formatInputDates, /* @ts-ignore */
|
|
727
|
+
...(ngDevMode ? [{ debugName: "formatInputDates" }] : /* istanbul ignore next */ []));
|
|
728
|
+
parseValue(value) {
|
|
729
|
+
return this.parseDate()(value);
|
|
730
|
+
}
|
|
731
|
+
formatInputValue(value) {
|
|
732
|
+
return this.formatInputDates()(value);
|
|
733
|
+
}
|
|
734
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDateRangeInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
735
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: HlmDateRangeInput, isStandalone: true, selector: "hlm-date-range-input", inputs: { parseDate: { classPropertyName: "parseDate", publicName: "parseDate", isSignal: true, isRequired: false, transformFunction: null }, formatInputDates: { classPropertyName: "formatInputDates", publicName: "formatInputDates", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideIcons({ lucideCalendar, lucideX }), provideBrnDatePickerTrigger(HlmDateRangeInput)], usesInheritance: true, hostDirectives: [{ directive: i1.HlmInputGroup }], ngImport: i0, template: `
|
|
736
|
+
<input
|
|
737
|
+
#input
|
|
738
|
+
hlmInputGroupInput
|
|
739
|
+
[value]="_inputValue()"
|
|
740
|
+
[id]="inputId()"
|
|
741
|
+
[placeholder]="placeholder()"
|
|
742
|
+
[disabled]="_disabled()"
|
|
743
|
+
[forceInvalid]="forceInvalid()"
|
|
744
|
+
(click)="_handleClick()"
|
|
745
|
+
(keydown.arrowDown)="_open()"
|
|
746
|
+
(keydown.enter)="_handleEnter($event)"
|
|
747
|
+
(input)="_handleInputChange($event)"
|
|
748
|
+
(focus)="_handleFocus()"
|
|
749
|
+
(blur)="_handleBlur()"
|
|
750
|
+
/>
|
|
751
|
+
<hlm-input-group-addon align="inline-end">
|
|
752
|
+
@if (_showClearButton()) {
|
|
753
|
+
<button
|
|
754
|
+
hlmInputGroupButton
|
|
755
|
+
size="icon-xs"
|
|
756
|
+
variant="ghost"
|
|
757
|
+
[attr.aria-label]="clearAriaLabel()"
|
|
758
|
+
(click)="_clear()"
|
|
759
|
+
[disabled]="_disabled()"
|
|
760
|
+
>
|
|
761
|
+
<ng-icon name="lucideX" />
|
|
762
|
+
</button>
|
|
763
|
+
}
|
|
764
|
+
<button
|
|
765
|
+
hlmInputGroupButton
|
|
766
|
+
size="icon-xs"
|
|
767
|
+
[attr.aria-label]="calendarAriaLabel()"
|
|
768
|
+
(click)="_popover().open()"
|
|
769
|
+
[disabled]="_disabled()"
|
|
770
|
+
>
|
|
771
|
+
<ng-icon name="lucideCalendar" />
|
|
772
|
+
</button>
|
|
773
|
+
</hlm-input-group-addon>
|
|
774
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1.HlmInputGroupAddon, selector: "[hlmInputGroupAddon],hlm-input-group-addon", inputs: ["align"] }, { kind: "directive", type: i1.HlmInputGroupButton, selector: "button[hlmInputGroupButton]", inputs: ["size", "type"] }, { kind: "directive", type: i1.HlmInputGroupInput, selector: "input[hlmInputGroupInput]" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
388
775
|
}
|
|
776
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDateRangeInput, decorators: [{
|
|
777
|
+
type: Component,
|
|
778
|
+
args: [{
|
|
779
|
+
selector: 'hlm-date-range-input',
|
|
780
|
+
imports: [HlmInputGroupImports, NgIcon],
|
|
781
|
+
providers: [provideIcons({ lucideCalendar, lucideX }), provideBrnDatePickerTrigger(HlmDateRangeInput)],
|
|
782
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
783
|
+
hostDirectives: [HlmInputGroup],
|
|
784
|
+
template: `
|
|
785
|
+
<input
|
|
786
|
+
#input
|
|
787
|
+
hlmInputGroupInput
|
|
788
|
+
[value]="_inputValue()"
|
|
789
|
+
[id]="inputId()"
|
|
790
|
+
[placeholder]="placeholder()"
|
|
791
|
+
[disabled]="_disabled()"
|
|
792
|
+
[forceInvalid]="forceInvalid()"
|
|
793
|
+
(click)="_handleClick()"
|
|
794
|
+
(keydown.arrowDown)="_open()"
|
|
795
|
+
(keydown.enter)="_handleEnter($event)"
|
|
796
|
+
(input)="_handleInputChange($event)"
|
|
797
|
+
(focus)="_handleFocus()"
|
|
798
|
+
(blur)="_handleBlur()"
|
|
799
|
+
/>
|
|
800
|
+
<hlm-input-group-addon align="inline-end">
|
|
801
|
+
@if (_showClearButton()) {
|
|
802
|
+
<button
|
|
803
|
+
hlmInputGroupButton
|
|
804
|
+
size="icon-xs"
|
|
805
|
+
variant="ghost"
|
|
806
|
+
[attr.aria-label]="clearAriaLabel()"
|
|
807
|
+
(click)="_clear()"
|
|
808
|
+
[disabled]="_disabled()"
|
|
809
|
+
>
|
|
810
|
+
<ng-icon name="lucideX" />
|
|
811
|
+
</button>
|
|
812
|
+
}
|
|
813
|
+
<button
|
|
814
|
+
hlmInputGroupButton
|
|
815
|
+
size="icon-xs"
|
|
816
|
+
[attr.aria-label]="calendarAriaLabel()"
|
|
817
|
+
(click)="_popover().open()"
|
|
818
|
+
[disabled]="_disabled()"
|
|
819
|
+
>
|
|
820
|
+
<ng-icon name="lucideCalendar" />
|
|
821
|
+
</button>
|
|
822
|
+
</hlm-input-group-addon>
|
|
823
|
+
`,
|
|
824
|
+
}]
|
|
825
|
+
}], propDecorators: { parseDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "parseDate", required: false }] }], formatInputDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatInputDates", required: false }] }] } });
|
|
389
826
|
|
|
390
827
|
const HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR = {
|
|
391
828
|
provide: NG_VALUE_ACCESSOR,
|
|
392
829
|
useExisting: forwardRef(() => HlmDateRangePicker),
|
|
393
830
|
multi: true,
|
|
394
831
|
};
|
|
395
|
-
let nextId = 0;
|
|
396
832
|
class HlmDateRangePicker {
|
|
397
833
|
_config = injectHlmDateRangePickerConfig();
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
834
|
+
popover = viewChild.required(BrnPopover, /* @ts-ignore */
|
|
835
|
+
...(ngDevMode ? [{ debugName: "popover" }] : /* istanbul ignore next */ []));
|
|
836
|
+
_trigger = contentChild(BrnDatePickerTriggerToken, /* @ts-ignore */
|
|
837
|
+
...(ngDevMode ? [{ debugName: "_trigger" }] : /* istanbul ignore next */ []));
|
|
838
|
+
/** Show dropdowns to navigate between months or years. */
|
|
839
|
+
captionLayout = input('label', /* @ts-ignore */
|
|
840
|
+
...(ngDevMode ? [{ debugName: "captionLayout" }] : /* istanbul ignore next */ []));
|
|
402
841
|
/** The minimum date that can be selected.*/
|
|
403
|
-
min = input(
|
|
842
|
+
min = input(/* @ts-ignore */
|
|
843
|
+
...(ngDevMode ? [undefined, { debugName: "min" }] : /* istanbul ignore next */ []));
|
|
404
844
|
/** The maximum date that can be selected. */
|
|
405
|
-
max = input(
|
|
845
|
+
max = input(/* @ts-ignore */
|
|
846
|
+
...(ngDevMode ? [undefined, { debugName: "max" }] : /* istanbul ignore next */ []));
|
|
406
847
|
/** Determine if the date picker is disabled. */
|
|
407
|
-
disabled = input(false, ...(ngDevMode ?
|
|
408
|
-
transform: booleanAttribute,
|
|
409
|
-
}]));
|
|
848
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
410
849
|
/** The selected value. */
|
|
411
|
-
date = input(
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
850
|
+
date = input(/* @ts-ignore */
|
|
851
|
+
...(ngDevMode ? [undefined, { debugName: "date" }] : /* istanbul ignore next */ []));
|
|
852
|
+
_mutableDate = linkedSignal(this.date, /* @ts-ignore */
|
|
853
|
+
...(ngDevMode ? [{ debugName: "_mutableDate" }] : /* istanbul ignore next */ []));
|
|
854
|
+
_start = linkedSignal(() => this._mutableDate()?.[0], /* @ts-ignore */
|
|
855
|
+
...(ngDevMode ? [{ debugName: "_start" }] : /* istanbul ignore next */ []));
|
|
856
|
+
_end = linkedSignal(() => this._mutableDate()?.[1], /* @ts-ignore */
|
|
857
|
+
...(ngDevMode ? [{ debugName: "_end" }] : /* istanbul ignore next */ []));
|
|
415
858
|
/** If true, the date picker will close when the end date is selected */
|
|
416
|
-
autoCloseOnEndSelection = input(this._config.autoCloseOnEndSelection, ...(ngDevMode ?
|
|
417
|
-
transform: booleanAttribute,
|
|
418
|
-
}]));
|
|
859
|
+
autoCloseOnEndSelection = input(this._config.autoCloseOnEndSelection, { ...(ngDevMode ? { debugName: "autoCloseOnEndSelection" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
419
860
|
/** Defines how the date should be displayed in the UI. */
|
|
420
|
-
formatDates = input(this._config.formatDates,
|
|
861
|
+
formatDates = input(this._config.formatDates, /* @ts-ignore */
|
|
862
|
+
...(ngDevMode ? [{ debugName: "formatDates" }] : /* istanbul ignore next */ []));
|
|
421
863
|
/** Defines how the date should be transformed before saving to model/form. */
|
|
422
|
-
transformDates = input(this._config.transformDates,
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
864
|
+
transformDates = input(this._config.transformDates, /* @ts-ignore */
|
|
865
|
+
...(ngDevMode ? [{ debugName: "transformDates" }] : /* istanbul ignore next */ []));
|
|
866
|
+
_popoverState = signal(null, /* @ts-ignore */
|
|
867
|
+
...(ngDevMode ? [{ debugName: "_popoverState" }] : /* istanbul ignore next */ []));
|
|
868
|
+
_disabled = linkedSignal(this.disabled, /* @ts-ignore */
|
|
869
|
+
...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
|
|
870
|
+
/** @internal The disabled state as a readonly signal */
|
|
871
|
+
disabledState = this._disabled.asReadonly();
|
|
872
|
+
formattedDate = computed(() => {
|
|
426
873
|
const start = this._start();
|
|
427
874
|
const end = this._end();
|
|
428
|
-
return start || end ? this.formatDates()([start, end]) : undefined;
|
|
429
|
-
},
|
|
875
|
+
return start || end ? this.formatDates()([start ?? null, end ?? null]) : undefined;
|
|
876
|
+
}, /* @ts-ignore */
|
|
877
|
+
...(ngDevMode ? [{ debugName: "formattedDate" }] : /* istanbul ignore next */ []));
|
|
430
878
|
dateChange = output();
|
|
879
|
+
labelableId = computed(() => this._trigger()?.triggerId(), /* @ts-ignore */
|
|
880
|
+
...(ngDevMode ? [{ debugName: "labelableId" }] : /* istanbul ignore next */ []));
|
|
881
|
+
hasDate = computed(() => !!this._start() || !!this._end(), /* @ts-ignore */
|
|
882
|
+
...(ngDevMode ? [{ debugName: "hasDate" }] : /* istanbul ignore next */ []));
|
|
883
|
+
/** @internal The current raw value, used by inputs to reformat on focus. */
|
|
884
|
+
value = computed(() => this._mutableDate() ?? null, /* @ts-ignore */
|
|
885
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
431
886
|
_onChange;
|
|
432
887
|
_onTouched;
|
|
888
|
+
_onStateChange(state) {
|
|
889
|
+
this._popoverState.set(state);
|
|
890
|
+
if (state === 'closed') {
|
|
891
|
+
this._onClose();
|
|
892
|
+
this._onTouched?.();
|
|
893
|
+
}
|
|
894
|
+
}
|
|
433
895
|
_handleStartDayChange(value) {
|
|
434
896
|
this._start.set(value);
|
|
435
897
|
}
|
|
436
898
|
_handleEndDateChange(value) {
|
|
437
899
|
this._end.set(value);
|
|
438
|
-
if (this.
|
|
900
|
+
if (this._disabled())
|
|
439
901
|
return;
|
|
440
902
|
const start = this._start();
|
|
441
903
|
if (start && value) {
|
|
@@ -448,6 +910,32 @@ class HlmDateRangePicker {
|
|
|
448
910
|
}
|
|
449
911
|
}
|
|
450
912
|
}
|
|
913
|
+
/**
|
|
914
|
+
* Commit a range to the picker. Updates the internal model, notifies form
|
|
915
|
+
* controls, and emits `dateChange`. Intended to be called from a text input
|
|
916
|
+
* that parses user-entered values. Pass `null` to clear the range.
|
|
917
|
+
*/
|
|
918
|
+
updateDate(value) {
|
|
919
|
+
if (this._disabled())
|
|
920
|
+
return;
|
|
921
|
+
if (!value) {
|
|
922
|
+
this._mutableDate.set(undefined);
|
|
923
|
+
this._start.set(undefined);
|
|
924
|
+
this._end.set(undefined);
|
|
925
|
+
this._onChange?.(null);
|
|
926
|
+
this.dateChange.emit(null);
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
const transformedDates = this.transformDates()(value);
|
|
930
|
+
this._mutableDate.set(transformedDates);
|
|
931
|
+
this._start.set(transformedDates[0]);
|
|
932
|
+
this._end.set(transformedDates[1]);
|
|
933
|
+
this._onChange?.(transformedDates);
|
|
934
|
+
this.dateChange.emit(transformedDates);
|
|
935
|
+
}
|
|
936
|
+
touched() {
|
|
937
|
+
this._onTouched?.();
|
|
938
|
+
}
|
|
451
939
|
/** CONTROL VALUE ACCESSOR */
|
|
452
940
|
writeValue(value) {
|
|
453
941
|
untracked(() => {
|
|
@@ -466,7 +954,7 @@ class HlmDateRangePicker {
|
|
|
466
954
|
this._onTouched = fn;
|
|
467
955
|
}
|
|
468
956
|
setDisabledState(isDisabled) {
|
|
469
|
-
this.
|
|
957
|
+
this._disabled.set(isDisabled);
|
|
470
958
|
}
|
|
471
959
|
open() {
|
|
472
960
|
this._popoverState.set('open');
|
|
@@ -474,6 +962,13 @@ class HlmDateRangePicker {
|
|
|
474
962
|
close() {
|
|
475
963
|
this._popoverState.set('closed');
|
|
476
964
|
}
|
|
965
|
+
reset() {
|
|
966
|
+
this._mutableDate.set(undefined);
|
|
967
|
+
this._start.set(undefined);
|
|
968
|
+
this._end.set(undefined);
|
|
969
|
+
this._onChange?.(null);
|
|
970
|
+
this.dateChange.emit(null);
|
|
971
|
+
}
|
|
477
972
|
_onClose() {
|
|
478
973
|
const dates = this._mutableDate();
|
|
479
974
|
if (this._start() && !this._end() && dates) {
|
|
@@ -481,109 +976,366 @@ class HlmDateRangePicker {
|
|
|
481
976
|
this._end.set(dates[1]);
|
|
482
977
|
}
|
|
483
978
|
}
|
|
484
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
485
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
979
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDateRangePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
980
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.3", type: HlmDateRangePicker, isStandalone: true, selector: "hlm-date-range-picker", inputs: { captionLayout: { classPropertyName: "captionLayout", publicName: "captionLayout", 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: [
|
|
981
|
+
HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR,
|
|
982
|
+
provideBrnDatePicker(HlmDateRangePicker),
|
|
983
|
+
provideBrnLabelable(HlmDateRangePicker),
|
|
984
|
+
], queries: [{ propertyName: "_trigger", first: true, predicate: BrnDatePickerTriggerToken, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "popover", first: true, predicate: BrnPopover, descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$1.BrnFieldControl }], ngImport: i0, template: "\n <hlm-popover sideOffset=\"5\" [state]=\"_popoverState()\" (stateChanged)=\"_onStateChange($event)\">\n <ng-content />\n\n <hlm-popover-content class=\"w-fit p-0\" *hlmPopoverPortal=\"let ctx\">\n <ng-content select=\"[hlmDatePickerHeader]\" />\n <hlm-calendar-range\n class=\"rounded-none border-0\"\n [startDate]=\"_start()\"\n [captionLayout]=\"captionLayout()\"\n [endDate]=\"_end()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [disabled]=\"_disabled()\"\n (startDateChange)=\"_handleStartDayChange($event)\"\n (endDateChange)=\"_handleEndDateChange($event)\"\n />\n <ng-content select=\"[hlmDatePickerFooter]\" />\n </hlm-popover-content>\n </hlm-popover>\n ", isInline: true, dependencies: [{ kind: "directive", type: i2.HlmPopover, selector: "[hlmPopover],hlm-popover" }, { kind: "directive", type: i2.HlmPopoverContent, selector: "[hlmPopoverContent],hlm-popover-content" }, { kind: "directive", type: i2.HlmPopoverPortal, selector: "[hlmPopoverPortal]" }, { kind: "component", type: HlmCalendarRange, selector: "hlm-calendar-range", inputs: ["captionLayout"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
985
|
+
}
|
|
986
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDateRangePicker, decorators: [{
|
|
987
|
+
type: Component,
|
|
988
|
+
args: [{
|
|
989
|
+
selector: 'hlm-date-range-picker',
|
|
990
|
+
imports: [HlmPopoverImports, HlmCalendarRange],
|
|
991
|
+
providers: [
|
|
992
|
+
HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR,
|
|
993
|
+
provideBrnDatePicker(HlmDateRangePicker),
|
|
994
|
+
provideBrnLabelable(HlmDateRangePicker),
|
|
995
|
+
],
|
|
996
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
997
|
+
hostDirectives: [BrnFieldControl],
|
|
998
|
+
host: { class: 'block' },
|
|
999
|
+
template: "\n <hlm-popover sideOffset=\"5\" [state]=\"_popoverState()\" (stateChanged)=\"_onStateChange($event)\">\n <ng-content />\n\n <hlm-popover-content class=\"w-fit p-0\" *hlmPopoverPortal=\"let ctx\">\n <ng-content select=\"[hlmDatePickerHeader]\" />\n <hlm-calendar-range\n class=\"rounded-none border-0\"\n [startDate]=\"_start()\"\n [captionLayout]=\"captionLayout()\"\n [endDate]=\"_end()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [disabled]=\"_disabled()\"\n (startDateChange)=\"_handleStartDayChange($event)\"\n (endDateChange)=\"_handleEndDateChange($event)\"\n />\n <ng-content select=\"[hlmDatePickerFooter]\" />\n </hlm-popover-content>\n </hlm-popover>\n ",
|
|
1000
|
+
}]
|
|
1001
|
+
}], propDecorators: { popover: [{ type: i0.ViewChild, args: [i0.forwardRef(() => BrnPopover), { isSignal: true }] }], _trigger: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BrnDatePickerTriggerToken), { isSignal: true }] }], captionLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionLayout", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }], autoCloseOnEndSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoCloseOnEndSelection", required: false }] }], formatDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatDates", required: false }] }], transformDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "transformDates", required: false }] }], dateChange: [{ type: i0.Output, args: ["dateChange"] }] } });
|
|
1002
|
+
|
|
1003
|
+
const mmYYYY = (date) => {
|
|
1004
|
+
if (!(date instanceof Date))
|
|
1005
|
+
return `${date}`;
|
|
1006
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
1007
|
+
const year = date.getFullYear();
|
|
1008
|
+
return `${month}/${year}`;
|
|
1009
|
+
};
|
|
1010
|
+
function getDefaultConfig() {
|
|
1011
|
+
return {
|
|
1012
|
+
formatDate: mmYYYY,
|
|
1013
|
+
formatInputDate: mmYYYY,
|
|
1014
|
+
transformDate: (date) => date,
|
|
1015
|
+
parseDate: (value) => {
|
|
1016
|
+
if (typeof value !== 'string')
|
|
1017
|
+
return null;
|
|
1018
|
+
const match = value.match(/^(\d{2})\/(\d{4})$/);
|
|
1019
|
+
if (!match)
|
|
1020
|
+
return null;
|
|
1021
|
+
const month = Number(match[1]);
|
|
1022
|
+
const year = Number(match[2]);
|
|
1023
|
+
if (month < 1 || month > 12)
|
|
1024
|
+
return null;
|
|
1025
|
+
const date = new Date(year, month - 1, 1);
|
|
1026
|
+
return date;
|
|
1027
|
+
},
|
|
1028
|
+
autoCloseOnSelect: false,
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
const HlmMonthYearPickerConfigToken = new InjectionToken('HlmMonthYearPickerConfig');
|
|
1032
|
+
function provideHlmMonthYearPickerConfig(config) {
|
|
1033
|
+
return { provide: HlmMonthYearPickerConfigToken, useValue: { ...getDefaultConfig(), ...config } };
|
|
1034
|
+
}
|
|
1035
|
+
function injectHlmMonthYearPickerConfig() {
|
|
1036
|
+
const injectedConfig = inject(HlmMonthYearPickerConfigToken, { optional: true });
|
|
1037
|
+
return injectedConfig ? injectedConfig : getDefaultConfig();
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
class HlmMonthYearInput extends BrnDateInput {
|
|
1041
|
+
_config = injectHlmMonthYearPickerConfig();
|
|
1042
|
+
/**
|
|
1043
|
+
* Parses input text into a date value. Return `null` for invalid
|
|
1044
|
+
* input - the picker's date is cleared while the text is preserved so
|
|
1045
|
+
* the user can fix it.
|
|
1046
|
+
*
|
|
1047
|
+
* Defaults to `parseDate` from `HlmMonthYearPickerConfig`.
|
|
1048
|
+
*/
|
|
1049
|
+
parseDate = input(this._config.parseDate, /* @ts-ignore */
|
|
1050
|
+
...(ngDevMode ? [{ debugName: "parseDate" }] : /* istanbul ignore next */ []));
|
|
1051
|
+
/**
|
|
1052
|
+
* Formats the current date into the input/edit format shown while the
|
|
1053
|
+
* input is focused. On blur the picker's display format is restored.
|
|
1054
|
+
*
|
|
1055
|
+
* Defaults to `formatInputDate` from `HlmMonthYearPickerConfig`.
|
|
1056
|
+
*/
|
|
1057
|
+
formatInputDate = input(this._config.formatInputDate, /* @ts-ignore */
|
|
1058
|
+
...(ngDevMode ? [{ debugName: "formatInputDate" }] : /* istanbul ignore next */ []));
|
|
1059
|
+
parseValue(value) {
|
|
1060
|
+
return this.parseDate()(value);
|
|
1061
|
+
}
|
|
1062
|
+
formatInputValue(value) {
|
|
1063
|
+
return this.formatInputDate()(value);
|
|
1064
|
+
}
|
|
1065
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmMonthYearInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1066
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: HlmMonthYearInput, isStandalone: true, selector: "hlm-month-year-input", inputs: { parseDate: { classPropertyName: "parseDate", publicName: "parseDate", isSignal: true, isRequired: false, transformFunction: null }, formatInputDate: { classPropertyName: "formatInputDate", publicName: "formatInputDate", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideIcons({ lucideCalendar, lucideX }), provideBrnDatePickerTrigger(HlmMonthYearInput)], usesInheritance: true, hostDirectives: [{ directive: i1.HlmInputGroup }], ngImport: i0, template: `
|
|
1067
|
+
<input
|
|
1068
|
+
#input
|
|
1069
|
+
hlmInputGroupInput
|
|
1070
|
+
[value]="_inputValue()"
|
|
1071
|
+
[id]="inputId()"
|
|
1072
|
+
[placeholder]="placeholder()"
|
|
1073
|
+
[disabled]="_disabled()"
|
|
1074
|
+
[forceInvalid]="forceInvalid()"
|
|
1075
|
+
(click)="_handleClick()"
|
|
1076
|
+
(keydown.arrowDown)="_open()"
|
|
1077
|
+
(keydown.enter)="_handleEnter($event)"
|
|
1078
|
+
(input)="_handleInputChange($event)"
|
|
1079
|
+
(focus)="_handleFocus()"
|
|
1080
|
+
(blur)="_handleBlur()"
|
|
1081
|
+
/>
|
|
1082
|
+
<hlm-input-group-addon align="inline-end">
|
|
1083
|
+
@if (_showClearButton()) {
|
|
1084
|
+
<button
|
|
1085
|
+
hlmInputGroupButton
|
|
1086
|
+
size="icon-xs"
|
|
1087
|
+
variant="ghost"
|
|
1088
|
+
[attr.aria-label]="clearAriaLabel()"
|
|
1089
|
+
(click)="_clear()"
|
|
1090
|
+
[disabled]="_disabled()"
|
|
1091
|
+
>
|
|
1092
|
+
<ng-icon name="lucideX" />
|
|
1093
|
+
</button>
|
|
1094
|
+
}
|
|
492
1095
|
<button
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
[
|
|
496
|
-
|
|
497
|
-
|
|
1096
|
+
hlmInputGroupButton
|
|
1097
|
+
size="icon-xs"
|
|
1098
|
+
[attr.aria-label]="calendarAriaLabel()"
|
|
1099
|
+
(click)="_popover().open()"
|
|
1100
|
+
[disabled]="_disabled()"
|
|
498
1101
|
>
|
|
499
|
-
<
|
|
500
|
-
@if (_formattedDate(); as formattedDate) {
|
|
501
|
-
{{ formattedDate }}
|
|
502
|
-
} @else {
|
|
503
|
-
<ng-content />
|
|
504
|
-
}
|
|
505
|
-
</span>
|
|
506
|
-
|
|
507
|
-
<ng-icon hlm size="sm" name="lucideChevronDown" />
|
|
1102
|
+
<ng-icon name="lucideCalendar" />
|
|
508
1103
|
</button>
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
<hlm-calendar-range
|
|
512
|
-
calendarClass="border-0 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: "directive", type: BrnPopover, selector: "[brnPopover],brn-popover", inputs: ["align", "sideOffset", "offsetX"], 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 });
|
|
1104
|
+
</hlm-input-group-addon>
|
|
1105
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1.HlmInputGroupAddon, selector: "[hlmInputGroupAddon],hlm-input-group-addon", inputs: ["align"] }, { kind: "directive", type: i1.HlmInputGroupButton, selector: "button[hlmInputGroupButton]", inputs: ["size", "type"] }, { kind: "directive", type: i1.HlmInputGroupInput, selector: "input[hlmInputGroupInput]" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
524
1106
|
}
|
|
525
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmMonthYearInput, decorators: [{
|
|
526
1108
|
type: Component,
|
|
527
1109
|
args: [{
|
|
528
|
-
selector: 'hlm-
|
|
529
|
-
imports: [
|
|
530
|
-
providers: [
|
|
1110
|
+
selector: 'hlm-month-year-input',
|
|
1111
|
+
imports: [HlmInputGroupImports, NgIcon],
|
|
1112
|
+
providers: [provideIcons({ lucideCalendar, lucideX }), provideBrnDatePickerTrigger(HlmMonthYearInput)],
|
|
1113
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1114
|
+
hostDirectives: [HlmInputGroup],
|
|
531
1115
|
template: `
|
|
532
|
-
<
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
1116
|
+
<input
|
|
1117
|
+
#input
|
|
1118
|
+
hlmInputGroupInput
|
|
1119
|
+
[value]="_inputValue()"
|
|
1120
|
+
[id]="inputId()"
|
|
1121
|
+
[placeholder]="placeholder()"
|
|
1122
|
+
[disabled]="_disabled()"
|
|
1123
|
+
[forceInvalid]="forceInvalid()"
|
|
1124
|
+
(click)="_handleClick()"
|
|
1125
|
+
(keydown.arrowDown)="_open()"
|
|
1126
|
+
(keydown.enter)="_handleEnter($event)"
|
|
1127
|
+
(input)="_handleInputChange($event)"
|
|
1128
|
+
(focus)="_handleFocus()"
|
|
1129
|
+
(blur)="_handleBlur()"
|
|
1130
|
+
/>
|
|
1131
|
+
<hlm-input-group-addon align="inline-end">
|
|
1132
|
+
@if (_showClearButton()) {
|
|
1133
|
+
<button
|
|
1134
|
+
hlmInputGroupButton
|
|
1135
|
+
size="icon-xs"
|
|
1136
|
+
variant="ghost"
|
|
1137
|
+
[attr.aria-label]="clearAriaLabel()"
|
|
1138
|
+
(click)="_clear()"
|
|
1139
|
+
[disabled]="_disabled()"
|
|
1140
|
+
>
|
|
1141
|
+
<ng-icon name="lucideX" />
|
|
1142
|
+
</button>
|
|
1143
|
+
}
|
|
538
1144
|
<button
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
[
|
|
542
|
-
|
|
543
|
-
|
|
1145
|
+
hlmInputGroupButton
|
|
1146
|
+
size="icon-xs"
|
|
1147
|
+
[attr.aria-label]="calendarAriaLabel()"
|
|
1148
|
+
(click)="_popover().open()"
|
|
1149
|
+
[disabled]="_disabled()"
|
|
544
1150
|
>
|
|
545
|
-
<
|
|
546
|
-
@if (_formattedDate(); as formattedDate) {
|
|
547
|
-
{{ formattedDate }}
|
|
548
|
-
} @else {
|
|
549
|
-
<ng-content />
|
|
550
|
-
}
|
|
551
|
-
</span>
|
|
552
|
-
|
|
553
|
-
<ng-icon hlm size="sm" name="lucideChevronDown" />
|
|
1151
|
+
<ng-icon name="lucideCalendar" />
|
|
554
1152
|
</button>
|
|
555
|
-
|
|
556
|
-
<div hlmPopoverContent class="w-auto p-0" *brnPopoverContent="let ctx">
|
|
557
|
-
<hlm-calendar-range
|
|
558
|
-
calendarClass="border-0 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>
|
|
1153
|
+
</hlm-input-group-addon>
|
|
569
1154
|
`,
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
1155
|
+
}]
|
|
1156
|
+
}], propDecorators: { parseDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "parseDate", required: false }] }], formatInputDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatInputDate", required: false }] }] } });
|
|
1157
|
+
|
|
1158
|
+
const HLM_MONTH_YEAR_PICKER_VALUE_ACCESSOR = {
|
|
1159
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1160
|
+
useExisting: forwardRef(() => HlmMonthYearPicker),
|
|
1161
|
+
multi: true,
|
|
1162
|
+
};
|
|
1163
|
+
class HlmMonthYearPicker {
|
|
1164
|
+
_config = injectHlmMonthYearPickerConfig();
|
|
1165
|
+
popover = viewChild.required(BrnPopover, /* @ts-ignore */
|
|
1166
|
+
...(ngDevMode ? [{ debugName: "popover" }] : /* istanbul ignore next */ []));
|
|
1167
|
+
_trigger = contentChild(BrnDatePickerTriggerToken, /* @ts-ignore */
|
|
1168
|
+
...(ngDevMode ? [{ debugName: "_trigger" }] : /* istanbul ignore next */ []));
|
|
1169
|
+
/** The minimum date that can be selected.*/
|
|
1170
|
+
min = input(/* @ts-ignore */
|
|
1171
|
+
...(ngDevMode ? [undefined, { debugName: "min" }] : /* istanbul ignore next */ []));
|
|
1172
|
+
/** The maximum date that can be selected. */
|
|
1173
|
+
max = input(/* @ts-ignore */
|
|
1174
|
+
...(ngDevMode ? [undefined, { debugName: "max" }] : /* istanbul ignore next */ []));
|
|
1175
|
+
/** Determine if the date picker is disabled. */
|
|
1176
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1177
|
+
/** The selected value. */
|
|
1178
|
+
date = input(/* @ts-ignore */
|
|
1179
|
+
...(ngDevMode ? [undefined, { debugName: "date" }] : /* istanbul ignore next */ []));
|
|
1180
|
+
/** The date the calendar focuses on first open when no date is selected. */
|
|
1181
|
+
defaultFocusedDate = input(/* @ts-ignore */
|
|
1182
|
+
...(ngDevMode ? [undefined, { debugName: "defaultFocusedDate" }] : /* istanbul ignore next */ []));
|
|
1183
|
+
_mutableDate = linkedSignal(this.date, /* @ts-ignore */
|
|
1184
|
+
...(ngDevMode ? [{ debugName: "_mutableDate" }] : /* istanbul ignore next */ []));
|
|
1185
|
+
/** If true, the date picker will close when a date is selected. */
|
|
1186
|
+
autoCloseOnSelect = input(this._config.autoCloseOnSelect, { ...(ngDevMode ? { debugName: "autoCloseOnSelect" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1187
|
+
/** Defines how the date should be displayed in the UI. */
|
|
1188
|
+
formatDate = input(this._config.formatDate, /* @ts-ignore */
|
|
1189
|
+
...(ngDevMode ? [{ debugName: "formatDate" }] : /* istanbul ignore next */ []));
|
|
1190
|
+
/** Defines how the date should be transformed before saving to model/form. */
|
|
1191
|
+
transformDate = input(this._config.transformDate, /* @ts-ignore */
|
|
1192
|
+
...(ngDevMode ? [{ debugName: "transformDate" }] : /* istanbul ignore next */ []));
|
|
1193
|
+
_popoverState = signal(null, /* @ts-ignore */
|
|
1194
|
+
...(ngDevMode ? [{ debugName: "_popoverState" }] : /* istanbul ignore next */ []));
|
|
1195
|
+
_disabled = linkedSignal(this.disabled, /* @ts-ignore */
|
|
1196
|
+
...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
|
|
1197
|
+
/** @internal The disabled state as a readonly signal */
|
|
1198
|
+
disabledState = this._disabled.asReadonly();
|
|
1199
|
+
formattedDate = computed(() => {
|
|
1200
|
+
const date = this._mutableDate();
|
|
1201
|
+
return date ? this.formatDate()(date) : undefined;
|
|
1202
|
+
}, /* @ts-ignore */
|
|
1203
|
+
...(ngDevMode ? [{ debugName: "formattedDate" }] : /* istanbul ignore next */ []));
|
|
1204
|
+
dateChange = output();
|
|
1205
|
+
labelableId = computed(() => this._trigger()?.triggerId(), /* @ts-ignore */
|
|
1206
|
+
...(ngDevMode ? [{ debugName: "labelableId" }] : /* istanbul ignore next */ []));
|
|
1207
|
+
hasDate = computed(() => !!this._mutableDate(), /* @ts-ignore */
|
|
1208
|
+
...(ngDevMode ? [{ debugName: "hasDate" }] : /* istanbul ignore next */ []));
|
|
1209
|
+
/** @internal The current raw value, used by inputs to reformat on focus. */
|
|
1210
|
+
value = computed(() => this._mutableDate() ?? null, /* @ts-ignore */
|
|
1211
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1212
|
+
_onChange;
|
|
1213
|
+
_onTouched;
|
|
1214
|
+
_onStateChange(state) {
|
|
1215
|
+
this._popoverState.set(state);
|
|
1216
|
+
if (state === 'closed')
|
|
1217
|
+
this._onTouched?.();
|
|
1218
|
+
}
|
|
1219
|
+
_handleChange(value) {
|
|
1220
|
+
if (this._disabled())
|
|
1221
|
+
return;
|
|
1222
|
+
this.updateDate(value ?? null);
|
|
1223
|
+
if (this.autoCloseOnSelect()) {
|
|
1224
|
+
this._popoverState.set('closed');
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Commit a date to the picker. Updates the internal model, notifies form
|
|
1229
|
+
* controls, and emits `dateChange`. Unlike `_handleChange`, this does not
|
|
1230
|
+
* close the popover - it's intended to be called from a text input that
|
|
1231
|
+
* is parsing user-entered values while typing.
|
|
1232
|
+
*/
|
|
1233
|
+
updateDate(value) {
|
|
1234
|
+
if (this._disabled())
|
|
1235
|
+
return;
|
|
1236
|
+
const transformedDate = value != null ? this.transformDate()(value) : undefined;
|
|
1237
|
+
this._mutableDate.set(transformedDate);
|
|
1238
|
+
this._onChange?.(transformedDate ?? null);
|
|
1239
|
+
this.dateChange.emit(transformedDate ?? null);
|
|
1240
|
+
}
|
|
1241
|
+
/** CONTROL VALUE ACCESSOR */
|
|
1242
|
+
writeValue(value) {
|
|
1243
|
+
this._mutableDate.set(value ? this.transformDate()(value) : undefined);
|
|
1244
|
+
}
|
|
1245
|
+
registerOnChange(fn) {
|
|
1246
|
+
this._onChange = fn;
|
|
1247
|
+
}
|
|
1248
|
+
registerOnTouched(fn) {
|
|
1249
|
+
this._onTouched = fn;
|
|
1250
|
+
}
|
|
1251
|
+
touched() {
|
|
1252
|
+
this._onTouched?.();
|
|
1253
|
+
}
|
|
1254
|
+
setDisabledState(isDisabled) {
|
|
1255
|
+
this._disabled.set(isDisabled);
|
|
1256
|
+
}
|
|
1257
|
+
open() {
|
|
1258
|
+
this._popoverState.set('open');
|
|
1259
|
+
}
|
|
1260
|
+
close() {
|
|
1261
|
+
this._popoverState.set('closed');
|
|
1262
|
+
}
|
|
1263
|
+
reset() {
|
|
1264
|
+
this._mutableDate.set(undefined);
|
|
1265
|
+
this._onChange?.(null);
|
|
1266
|
+
this.dateChange.emit(null);
|
|
1267
|
+
}
|
|
1268
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmMonthYearPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1269
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.3", type: HlmMonthYearPicker, isStandalone: true, selector: "hlm-month-year-picker", inputs: { 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 }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", 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: [
|
|
1270
|
+
HLM_MONTH_YEAR_PICKER_VALUE_ACCESSOR,
|
|
1271
|
+
provideBrnDatePicker(HlmMonthYearPicker),
|
|
1272
|
+
provideBrnLabelable(HlmMonthYearPicker),
|
|
1273
|
+
], queries: [{ propertyName: "_trigger", first: true, predicate: BrnDatePickerTriggerToken, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "popover", first: true, predicate: BrnPopover, descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$1.BrnFieldControl }], ngImport: i0, template: "\n <hlm-popover sideOffset=\"5\" [state]=\"_popoverState()\" (stateChanged)=\"_onStateChange($event)\">\n <ng-content />\n\n <hlm-popover-content class=\"w-fit p-0\" *hlmPopoverPortal=\"let ctx\">\n <ng-content select=\"[hlmDatePickerHeader]\" />\n <hlm-month-year-calendar\n class=\"rounded-none border-0\"\n [date]=\"_mutableDate()\"\n [defaultFocusedDate]=\"_mutableDate() ?? defaultFocusedDate()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [disabled]=\"_disabled()\"\n (dateChange)=\"_handleChange($event)\"\n />\n <ng-content select=\"[hlmDatePickerFooter]\" />\n </hlm-popover-content>\n </hlm-popover>\n ", isInline: true, dependencies: [{ kind: "directive", type: i2.HlmPopover, selector: "[hlmPopover],hlm-popover" }, { kind: "directive", type: i2.HlmPopoverContent, selector: "[hlmPopoverContent],hlm-popover-content" }, { kind: "directive", type: i2.HlmPopoverPortal, selector: "[hlmPopoverPortal]" }, { kind: "component", type: i3.HlmMonthYearCalendar, selector: "hlm-month-year-calendar" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1274
|
+
}
|
|
1275
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmMonthYearPicker, decorators: [{
|
|
1276
|
+
type: Component,
|
|
1277
|
+
args: [{
|
|
1278
|
+
selector: 'hlm-month-year-picker',
|
|
1279
|
+
imports: [HlmPopoverImports, HlmCalendarImports],
|
|
1280
|
+
providers: [
|
|
1281
|
+
HLM_MONTH_YEAR_PICKER_VALUE_ACCESSOR,
|
|
1282
|
+
provideBrnDatePicker(HlmMonthYearPicker),
|
|
1283
|
+
provideBrnLabelable(HlmMonthYearPicker),
|
|
1284
|
+
],
|
|
573
1285
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1286
|
+
hostDirectives: [BrnFieldControl],
|
|
1287
|
+
host: { class: 'block' },
|
|
1288
|
+
template: "\n <hlm-popover sideOffset=\"5\" [state]=\"_popoverState()\" (stateChanged)=\"_onStateChange($event)\">\n <ng-content />\n\n <hlm-popover-content class=\"w-fit p-0\" *hlmPopoverPortal=\"let ctx\">\n <ng-content select=\"[hlmDatePickerHeader]\" />\n <hlm-month-year-calendar\n class=\"rounded-none border-0\"\n [date]=\"_mutableDate()\"\n [defaultFocusedDate]=\"_mutableDate() ?? defaultFocusedDate()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [disabled]=\"_disabled()\"\n (dateChange)=\"_handleChange($event)\"\n />\n <ng-content select=\"[hlmDatePickerFooter]\" />\n </hlm-popover-content>\n </hlm-popover>\n ",
|
|
574
1289
|
}]
|
|
575
|
-
}], propDecorators: {
|
|
1290
|
+
}], propDecorators: { popover: [{ type: i0.ViewChild, args: [i0.forwardRef(() => BrnPopover), { isSignal: true }] }], _trigger: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BrnDatePickerTriggerToken), { isSignal: true }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }], defaultFocusedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultFocusedDate", required: false }] }], autoCloseOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoCloseOnSelect", required: false }] }], formatDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatDate", required: false }] }], transformDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "transformDate", required: false }] }], dateChange: [{ type: i0.Output, args: ["dateChange"] }] } });
|
|
576
1291
|
|
|
577
1292
|
/*
|
|
578
1293
|
* Public API Surface of date-picker
|
|
579
1294
|
*/
|
|
580
|
-
const HlmDatePickerImports = [
|
|
1295
|
+
const HlmDatePickerImports = [
|
|
1296
|
+
HlmDatePicker,
|
|
1297
|
+
HlmDatePickerAnchor,
|
|
1298
|
+
HlmDatePickerInput,
|
|
1299
|
+
HlmDatePickerMulti,
|
|
1300
|
+
HlmDateMultiInput,
|
|
1301
|
+
HlmDateRangeInput,
|
|
1302
|
+
HlmDateRangePicker,
|
|
1303
|
+
HlmDatePickerTrigger,
|
|
1304
|
+
HlmMonthYearPicker,
|
|
1305
|
+
HlmMonthYearInput,
|
|
1306
|
+
];
|
|
581
1307
|
class HlmDatePickerModule {
|
|
582
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
583
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
584
|
-
|
|
1308
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1309
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePickerModule, imports: [HlmDatePicker,
|
|
1310
|
+
HlmDatePickerAnchor,
|
|
1311
|
+
HlmDatePickerInput,
|
|
1312
|
+
HlmDatePickerMulti,
|
|
1313
|
+
HlmDateMultiInput,
|
|
1314
|
+
HlmDateRangeInput,
|
|
1315
|
+
HlmDateRangePicker,
|
|
1316
|
+
HlmDatePickerTrigger,
|
|
1317
|
+
HlmMonthYearPicker,
|
|
1318
|
+
HlmMonthYearInput], exports: [HlmDatePicker,
|
|
1319
|
+
HlmDatePickerAnchor,
|
|
1320
|
+
HlmDatePickerInput,
|
|
1321
|
+
HlmDatePickerMulti,
|
|
1322
|
+
HlmDateMultiInput,
|
|
1323
|
+
HlmDateRangeInput,
|
|
1324
|
+
HlmDateRangePicker,
|
|
1325
|
+
HlmDatePickerTrigger,
|
|
1326
|
+
HlmMonthYearPicker,
|
|
1327
|
+
HlmMonthYearInput] });
|
|
1328
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePickerModule, imports: [HlmDatePicker,
|
|
1329
|
+
HlmDatePickerInput,
|
|
1330
|
+
HlmDatePickerMulti,
|
|
1331
|
+
HlmDateMultiInput,
|
|
1332
|
+
HlmDateRangeInput,
|
|
1333
|
+
HlmDateRangePicker,
|
|
1334
|
+
HlmDatePickerTrigger,
|
|
1335
|
+
HlmMonthYearPicker,
|
|
1336
|
+
HlmMonthYearInput] });
|
|
585
1337
|
}
|
|
586
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmDatePickerModule, decorators: [{
|
|
587
1339
|
type: NgModule,
|
|
588
1340
|
args: [{
|
|
589
1341
|
imports: [...HlmDatePickerImports],
|
|
@@ -595,5 +1347,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
595
1347
|
* Generated bundle index. Do not edit.
|
|
596
1348
|
*/
|
|
597
1349
|
|
|
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
|
-
|
|
1350
|
+
export { HLM_DATE_PICKER_MUTLI_VALUE_ACCESSOR, HLM_DATE_PICKER_VALUE_ACCESSOR, HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR, HLM_MONTH_YEAR_PICKER_VALUE_ACCESSOR, HlmDateMultiInput, HlmDatePicker, HlmDatePickerAnchor, HlmDatePickerImports, HlmDatePickerInput, HlmDatePickerModule, HlmDatePickerMulti, HlmDatePickerTrigger, HlmDateRangeInput, HlmDateRangePicker, HlmMonthYearInput, HlmMonthYearPicker, injectHlmDatePickerConfig, injectHlmDatePickerMultiConfig, injectHlmDateRangePickerConfig, injectHlmMonthYearPickerConfig, provideHlmDatePickerConfig, provideHlmDatePickerMultiConfig, provideHlmDateRangePickerConfig, provideHlmMonthYearPickerConfig };
|
|
1351
|
+
|