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