@salesforce/ui-bundle-template-app-angular-template-b2x 11.60.0 → 11.62.1
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/dist/CHANGELOG.md +24 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/angular.json +2 -7
- package/dist/force-app/main/default/uiBundles/angularextapp/components.json +6 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/eslint.config.js +9 -1
- package/dist/force-app/main/default/uiBundles/angularextapp/package.json +16 -11
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/app.config.ts +4 -6
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/app.routes.ts +2 -2
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/alert/alert.html +9 -13
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/alert/alert.ts +16 -28
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/button/button.html +19 -10
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/button/button.ts +34 -25
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/card/card.ts +40 -50
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/collapsible/collapsible.html +38 -10
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/collapsible/collapsible.ts +6 -11
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/date-picker/date-picker.html +17 -22
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/date-picker/date-picker.ts +29 -21
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/date-range-picker/date-range-picker.html +16 -30
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/date-range-picker/date-range-picker.ts +39 -36
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/dialog/dialog.html +13 -30
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/dialog/dialog.ts +6 -21
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/dropdown-menu/dropdown-menu.html +20 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/dropdown-menu/dropdown-menu.ts +100 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/field/field.html +5 -11
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/field/field.ts +10 -18
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/field-appearance.ts +8 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/icon/icon.ts +62 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/input/input.html +32 -17
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/input/input.ts +57 -14
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/label/label.ts +8 -4
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/paginator/paginator.html +74 -10
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/paginator/paginator.ts +74 -18
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/paginator/types.ts +13 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/popover/popover.html +10 -38
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/popover/popover.ts +12 -15
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/select/select.html +34 -22
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/select/select.ts +25 -34
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/separator/separator.ts +11 -36
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/skeleton/skeleton.ts +5 -9
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/spinner/spinner.ts +14 -21
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/authentication/auth-form/auth-form.html +2 -3
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/authentication/menu/auth-menu/auth-menu.html +31 -21
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/authentication/menu/auth-menu/auth-menu.ts +6 -18
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/authentication/session/session.html +2 -2
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/authentication/submit-button/submit-button.html +8 -4
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/authentication/submit-button/submit-button.ts +4 -16
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/breadcrumb/breadcrumb.html +4 -24
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/breadcrumb/breadcrumb.ts +3 -16
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/date-filter.ts +1 -1
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/date-range-filter.html +2 -1
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/date-range-filter.ts +6 -15
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/filter-field-wrapper.html +2 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/filter-field-wrapper.ts +2 -17
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/multi-select-filter.html +2 -1
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/numeric-range-filter.ts +3 -21
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/search-filter.html +3 -3
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/search-filter.ts +9 -13
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/select-filter.html +2 -5
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/select-filter.ts +1 -15
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/text-filter.html +2 -5
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/filters/text-filter.ts +3 -17
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/pagination/pagination.ts +4 -20
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/search-bar/search-bar.html +10 -59
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/search-bar/search-bar.ts +13 -93
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/sort-control/sort-control.html +3 -29
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/object-search/sort-control/sort-control.ts +5 -12
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/pages/account-detail/account-detail-page.html +1 -23
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/pages/account-detail/account-detail-page.ts +3 -23
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/pages/account-search/account-search-page.html +1 -19
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/pages/account-search/account-search-page.ts +8 -36
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/pages/home/home.html +15 -4
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/pages/home/home.spec.ts +8 -6
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/pages/home/home.ts +56 -4
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/alert/hlm-alert-action.ts +14 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/alert/hlm-alert-description.ts +17 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/alert/hlm-alert-title.ts +17 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/alert/hlm-alert.ts +35 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/alert/index.ts +16 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/button/hlm-button.token.ts +22 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/button/hlm-button.ts +72 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/button/index.ts +6 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/calendar/hlm-calendar-multi.ts +195 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/calendar/hlm-calendar-range.ts +194 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/calendar/hlm-calendar.ts +189 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/calendar/hlm-month-year-calendar.ts +119 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/calendar/index.ts +16 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/card/hlm-card-action.ts +12 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/card/hlm-card-avatar.ts +14 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/card/hlm-card-content.ts +12 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/card/hlm-card-description.ts +12 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/card/hlm-card-footer.ts +12 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/card/hlm-card-header.ts +15 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/card/hlm-card-title.ts +12 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/card/hlm-card.token.ts +19 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/card/hlm-card.ts +22 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/card/index.ts +28 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/collapsible/hlm-collapsible-content.ts +14 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/collapsible/hlm-collapsible-trigger.ts +9 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/collapsible/hlm-collapsible.ts +15 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/collapsible/index.ts +13 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-date-multi-input.ts +104 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-date-picker-anchor.ts +23 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-date-picker-input.ts +118 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-date-picker-multi.token.ts +109 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-date-picker-multi.ts +220 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-date-picker-trigger.ts +104 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-date-picker.token.ts +69 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-date-picker.ts +203 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-date-range-input.ts +120 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-date-range-picker.token.ts +86 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-date-range-picker.ts +252 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-month-year-input.ts +105 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-month-year-picker.token.ts +89 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/hlm-month-year-picker.ts +196 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/date-picker/index.ts +38 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dialog/hlm-dialog-close.ts +9 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dialog/hlm-dialog-content.ts +74 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dialog/hlm-dialog-description.ts +17 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dialog/hlm-dialog-footer.ts +15 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dialog/hlm-dialog-header.ts +12 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dialog/hlm-dialog-overlay.ts +27 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dialog/hlm-dialog-portal.ts +8 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dialog/hlm-dialog-title.ts +14 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dialog/hlm-dialog-trigger.ts +14 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dialog/hlm-dialog.service.ts +46 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dialog/hlm-dialog.ts +24 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dialog/index.ts +35 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-checkbox-indicator.ts +21 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-checkbox.ts +54 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-focus-on-hover.ts +35 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-group.ts +14 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-item-sub-indicator.ts +19 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-item.ts +42 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-label.ts +20 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-radio-indicator.ts +21 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-radio.ts +49 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-separator.ts +12 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-shortcut.ts +15 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-sub-trigger.ts +52 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-sub.ts +53 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-token.ts +26 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu-trigger.ts +46 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/hlm-dropdown-menu.ts +57 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/dropdown-menu/index.ts +49 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/field/hlm-field-content.ts +12 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/field/hlm-field-description.ts +53 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/field/hlm-field-error.ts +100 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/field/hlm-field-group.ts +15 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/field/hlm-field-label.ts +17 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/field/hlm-field-legend.ts +19 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/field/hlm-field-separator.ts +24 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/field/hlm-field-set.ts +15 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/field/hlm-field-title.ts +15 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/field/hlm-field.ts +47 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/field/index.ts +34 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/input/hlm-input.ts +21 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/input/index.ts +5 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/input-group/hlm-input-group-addon.ts +40 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/input-group/hlm-input-group-button.ts +47 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/input-group/hlm-input-group-input.ts +17 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/input-group/hlm-input-group-text.ts +14 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/input-group/hlm-input-group.ts +18 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/input-group/index.ts +19 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/label/hlm-label.ts +17 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/label/index.ts +5 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/label/label.html +11 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/pagination/hlm-numbered-pagination-query-params.ts +191 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/pagination/hlm-numbered-pagination.ts +290 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/pagination/hlm-pagination-content.ts +12 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/pagination/hlm-pagination-ellipsis.ts +27 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/pagination/hlm-pagination-item.ts +7 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/pagination/hlm-pagination-link.ts +51 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/pagination/hlm-pagination-next.ts +65 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/pagination/hlm-pagination-previous.ts +65 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/pagination/hlm-pagination.ts +19 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/pagination/index.ts +31 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/popover/hlm-popover-content.ts +25 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/popover/hlm-popover-description.ts +12 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/popover/hlm-popover-header.ts +12 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/popover/hlm-popover-portal.ts +8 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/popover/hlm-popover-title.ts +12 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/popover/hlm-popover-trigger.ts +14 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/popover/hlm-popover.ts +23 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/popover/index.ts +25 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-content.ts +44 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-group.ts +14 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-item.ts +36 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-label.ts +14 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-multiple.ts +37 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-placeholder.ts +17 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-portal.ts +8 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-scroll-down.ts +22 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-scroll-up.ts +22 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-separator.ts +14 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-trigger.ts +59 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-value-template.ts +5 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-value.ts +18 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-values-content.ts +9 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select-values.ts +5 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/hlm-select.ts +37 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/select/index.ts +52 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/separator/hlm-separator.ts +19 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/separator/index.ts +5 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/skeleton/hlm-skeleton.ts +14 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/skeleton/index.ts +5 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/spinner/hlm-spinner.ts +26 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/spinner/index.ts +5 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/utils/hlm.ts +313 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/utils/index.ts +2 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/shared/utils/provide-spartan-hlm.ts +34 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/src/index.html +0 -1
- package/dist/force-app/main/default/uiBundles/angularextapp/src/{styles.scss → styles.css} +7 -38
- package/dist/force-app/main/default/uiBundles/angularextapp/tsconfig.json +4 -1
- package/dist/package-lock.json +2 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/_field-size.scss +0 -42
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/button/button.scss +0 -112
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/card/card.scss +0 -34
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/date-picker/date-picker.scss +0 -36
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/date-range-picker/date-range-picker.scss +0 -33
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/input/input.scss +0 -35
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/label/label.html +0 -3
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/select/select.scss +0 -35
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/separator/separator.html +0 -1
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/separator/separator.scss +0 -23
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/skeleton/skeleton.html +0 -1
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/components/ui/skeleton/skeleton.scss +0 -28
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/authentication/submit-button/submit-button.scss +0 -17
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/pages/account-detail/account-detail-page.scss +0 -7
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/pages/home/home-page.html +0 -18
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/pages/home/home-page.ts +0 -47
- package/dist/force-app/main/default/uiBundles/angularextapp/src/theme.scss +0 -39
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import {
|
|
2
|
+
booleanAttribute,
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
inject,
|
|
7
|
+
input,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
10
|
+
import { lucideCalendar, lucideX } from '@ng-icons/lucide';
|
|
11
|
+
import {
|
|
12
|
+
BrnDateInput,
|
|
13
|
+
type BrnDatePickerTriggerBase,
|
|
14
|
+
provideBrnDatePickerTrigger,
|
|
15
|
+
} from '@spartan-ng/brain/date-picker';
|
|
16
|
+
import { BrnFieldControl } from '@spartan-ng/brain/field';
|
|
17
|
+
import type { BooleanInput } from '@angular/cdk/coercion';
|
|
18
|
+
import { HlmInputGroup, HlmInputGroupImports } from '@spartan-ng/styles/input-group';
|
|
19
|
+
import { injectHlmDateRangePickerConfig } from './hlm-date-range-picker.token';
|
|
20
|
+
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'hlm-date-range-input',
|
|
23
|
+
imports: [HlmInputGroupImports, NgIcon],
|
|
24
|
+
providers: [
|
|
25
|
+
provideIcons({ lucideCalendar, lucideX }),
|
|
26
|
+
provideBrnDatePickerTrigger(HlmDateRangeInput),
|
|
27
|
+
],
|
|
28
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
|
+
hostDirectives: [HlmInputGroup],
|
|
30
|
+
template: `
|
|
31
|
+
<input
|
|
32
|
+
#input
|
|
33
|
+
hlmInputGroupInput
|
|
34
|
+
[value]="_inputValue()"
|
|
35
|
+
[id]="inputId()"
|
|
36
|
+
[placeholder]="placeholder()"
|
|
37
|
+
[disabled]="_disabled()"
|
|
38
|
+
[readonly]="readonly()"
|
|
39
|
+
[forceInvalid]="forceInvalid()"
|
|
40
|
+
[attr.aria-invalid]="_ariaInvalid()"
|
|
41
|
+
[attr.data-invalid]="_ariaInvalid()"
|
|
42
|
+
[attr.data-touched]="_touched?.() ? 'true' : null"
|
|
43
|
+
[attr.data-dirty]="_dirty?.() ? 'true' : null"
|
|
44
|
+
[attr.data-matches-spartan-invalid]="_spartanInvalid() ? 'true' : null"
|
|
45
|
+
(click)="_handleClick(); readonly() && _popover().open()"
|
|
46
|
+
(keydown.arrowDown)="_open()"
|
|
47
|
+
(keydown.enter)="_handleEnter($event); readonly() && _popover().open()"
|
|
48
|
+
(keydown.space)="readonly() && _popover().open()"
|
|
49
|
+
(input)="_handleInputChange($event)"
|
|
50
|
+
(focus)="_handleFocus()"
|
|
51
|
+
(blur)="_handleBlur()"
|
|
52
|
+
/>
|
|
53
|
+
<hlm-input-group-addon align="inline-end">
|
|
54
|
+
@if (_showClearButton() && !readonly()) {
|
|
55
|
+
<button
|
|
56
|
+
hlmInputGroupButton
|
|
57
|
+
size="icon-xs"
|
|
58
|
+
variant="ghost"
|
|
59
|
+
[attr.aria-label]="clearAriaLabel()"
|
|
60
|
+
(click)="_clear()"
|
|
61
|
+
[disabled]="_disabled()"
|
|
62
|
+
>
|
|
63
|
+
<ng-icon name="lucideX" />
|
|
64
|
+
</button>
|
|
65
|
+
}
|
|
66
|
+
<button
|
|
67
|
+
hlmInputGroupButton
|
|
68
|
+
size="icon-xs"
|
|
69
|
+
[attr.aria-label]="calendarAriaLabel()"
|
|
70
|
+
(click)="_popover().open()"
|
|
71
|
+
[disabled]="_disabled()"
|
|
72
|
+
>
|
|
73
|
+
<ng-icon name="lucideCalendar" />
|
|
74
|
+
</button>
|
|
75
|
+
</hlm-input-group-addon>
|
|
76
|
+
`,
|
|
77
|
+
})
|
|
78
|
+
export class HlmDateRangeInput<T> extends BrnDateInput<[T, T]> implements BrnDatePickerTriggerBase {
|
|
79
|
+
private readonly _config = injectHlmDateRangePickerConfig<T>();
|
|
80
|
+
private readonly _fieldControl = inject(BrnFieldControl, { optional: true });
|
|
81
|
+
|
|
82
|
+
/** When true, typing is blocked but the calendar toggle still works. */
|
|
83
|
+
public readonly readonly = input<boolean, BooleanInput>(false, { transform: booleanAttribute });
|
|
84
|
+
|
|
85
|
+
private readonly _invalid = this._fieldControl?.invalid;
|
|
86
|
+
protected readonly _spartanInvalid = computed(
|
|
87
|
+
() => this.forceInvalid() || this._fieldControl?.spartanInvalid(),
|
|
88
|
+
);
|
|
89
|
+
protected readonly _dirty = this._fieldControl?.dirty;
|
|
90
|
+
protected readonly _touched = this._fieldControl?.touched;
|
|
91
|
+
|
|
92
|
+
protected readonly _ariaInvalid = computed(() => (this._invalid?.() ? 'true' : null));
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Parses input text into a date range. Return `null` for invalid
|
|
96
|
+
* input - the picker's range is cleared while the text is preserved so
|
|
97
|
+
* the user can fix it.
|
|
98
|
+
*
|
|
99
|
+
* Defaults to `parseDate` from `HlmDateRangePickerConfig`.
|
|
100
|
+
*/
|
|
101
|
+
public readonly parseDate = input<(value: string) => [T, T] | null>(this._config.parseDate);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Formats the current range into the input/edit format shown while the
|
|
105
|
+
* input is focused. On blur the picker's display format is restored.
|
|
106
|
+
*
|
|
107
|
+
* Defaults to `formatInputDates` from `HlmDateRangePickerConfig`.
|
|
108
|
+
*/
|
|
109
|
+
public readonly formatInputDates = input<(dates: [T | null, T | null]) => string>(
|
|
110
|
+
this._config.formatInputDates,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
protected override parseValue(value: string): [T, T] | null {
|
|
114
|
+
return this.parseDate()(value);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
protected override formatInputValue(value: [T, T]): string {
|
|
118
|
+
return this.formatInputDates()(value);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { inject, InjectionToken, type ValueProvider } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
export interface HlmDateRangePickerConfig<T> {
|
|
4
|
+
/**
|
|
5
|
+
* If true, the date picker will close when the max selection of dates is reached.
|
|
6
|
+
*/
|
|
7
|
+
autoCloseOnEndSelection: boolean;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Defines how the date should be displayed in the UI.
|
|
11
|
+
*
|
|
12
|
+
* @param dates
|
|
13
|
+
* @returns formatted date
|
|
14
|
+
*/
|
|
15
|
+
formatDates: (dates: [T | null, T | null]) => string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Defines how the range should be displayed while the input is focused,
|
|
19
|
+
* i.e. the format the user is expected to type in.
|
|
20
|
+
*
|
|
21
|
+
* @param dates
|
|
22
|
+
* @returns formatted range in the input/edit format
|
|
23
|
+
*/
|
|
24
|
+
formatInputDates: (dates: [T | null, T | null]) => string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Defines how the date should be transformed before saving to model/form.
|
|
28
|
+
*
|
|
29
|
+
* @param dates
|
|
30
|
+
* @returns transformed date
|
|
31
|
+
*/
|
|
32
|
+
transformDates: (dates: [T, T]) => [T, T];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Parse a user-entered string into a date range.
|
|
36
|
+
*
|
|
37
|
+
* @param value the raw string from the input
|
|
38
|
+
* @returns the parsed range, or `null` when the value can't be parsed
|
|
39
|
+
*/
|
|
40
|
+
parseDate: (value: string) => [T, T] | null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getDefaultConfig<T>(): HlmDateRangePickerConfig<T> {
|
|
44
|
+
return {
|
|
45
|
+
formatDates: (dates) =>
|
|
46
|
+
dates
|
|
47
|
+
.filter(Boolean)
|
|
48
|
+
.map((date) => (date instanceof Date ? date.toDateString() : `${date}`))
|
|
49
|
+
.join(' - '),
|
|
50
|
+
formatInputDates: (dates) =>
|
|
51
|
+
dates
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.map((date) => (date instanceof Date ? date.toDateString() : `${date}`))
|
|
54
|
+
.join(' - '),
|
|
55
|
+
transformDates: (dates) => dates,
|
|
56
|
+
autoCloseOnEndSelection: false,
|
|
57
|
+
parseDate: (value) => {
|
|
58
|
+
if (typeof value !== 'string') return null;
|
|
59
|
+
|
|
60
|
+
const parts = value.split(' - ').map((part) => part.trim());
|
|
61
|
+
if (parts.length === 0 || parts.length > 2) return null;
|
|
62
|
+
|
|
63
|
+
const start = new Date(parts[0]);
|
|
64
|
+
if (isNaN(start.getTime())) return null;
|
|
65
|
+
|
|
66
|
+
const end = parts.length === 2 ? new Date(parts[1]) : start;
|
|
67
|
+
|
|
68
|
+
return [start, isNaN(end.getTime()) ? start : end] as [T, T];
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const HlmDateRangePickerConfigToken = new InjectionToken<HlmDateRangePickerConfig<unknown>>(
|
|
74
|
+
'HlmDateRangePickerConfig',
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
export function provideHlmDateRangePickerConfig<T>(
|
|
78
|
+
config: Partial<HlmDateRangePickerConfig<T>>,
|
|
79
|
+
): ValueProvider {
|
|
80
|
+
return { provide: HlmDateRangePickerConfigToken, useValue: { ...getDefaultConfig(), ...config } };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function injectHlmDateRangePickerConfig<T>(): HlmDateRangePickerConfig<T> {
|
|
84
|
+
const injectedConfig = inject(HlmDateRangePickerConfigToken, { optional: true });
|
|
85
|
+
return injectedConfig ? (injectedConfig as HlmDateRangePickerConfig<T>) : getDefaultConfig();
|
|
86
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import type { BooleanInput } from '@angular/cdk/coercion';
|
|
2
|
+
import {
|
|
3
|
+
booleanAttribute,
|
|
4
|
+
ChangeDetectionStrategy,
|
|
5
|
+
Component,
|
|
6
|
+
computed,
|
|
7
|
+
contentChild,
|
|
8
|
+
forwardRef,
|
|
9
|
+
input,
|
|
10
|
+
linkedSignal,
|
|
11
|
+
output,
|
|
12
|
+
signal,
|
|
13
|
+
untracked,
|
|
14
|
+
viewChild,
|
|
15
|
+
} from '@angular/core';
|
|
16
|
+
import { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
17
|
+
import {
|
|
18
|
+
type BrnDatePickerBase,
|
|
19
|
+
BrnDatePickerTriggerToken,
|
|
20
|
+
provideBrnDatePicker,
|
|
21
|
+
} from '@spartan-ng/brain/date-picker';
|
|
22
|
+
import { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';
|
|
23
|
+
import type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';
|
|
24
|
+
import type { BrnOverlayState } from '@spartan-ng/brain/overlay';
|
|
25
|
+
import { BrnPopover, type BrnPopoverAlign } from '@spartan-ng/brain/popover';
|
|
26
|
+
import { HlmCalendarRange } from '@spartan-ng/styles/calendar';
|
|
27
|
+
import { HlmPopoverImports } from '@spartan-ng/styles/popover';
|
|
28
|
+
import { injectHlmDateRangePickerConfig } from './hlm-date-range-picker.token';
|
|
29
|
+
|
|
30
|
+
export const HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR = {
|
|
31
|
+
provide: NG_VALUE_ACCESSOR,
|
|
32
|
+
useExisting: forwardRef(() => HlmDateRangePicker),
|
|
33
|
+
multi: true,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
@Component({
|
|
37
|
+
selector: 'hlm-date-range-picker',
|
|
38
|
+
imports: [HlmPopoverImports, HlmCalendarRange],
|
|
39
|
+
providers: [
|
|
40
|
+
HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR,
|
|
41
|
+
provideBrnDatePicker(HlmDateRangePicker),
|
|
42
|
+
provideBrnLabelable(HlmDateRangePicker),
|
|
43
|
+
],
|
|
44
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
45
|
+
hostDirectives: [BrnFieldControl],
|
|
46
|
+
host: { class: 'block' },
|
|
47
|
+
template: `
|
|
48
|
+
<hlm-popover
|
|
49
|
+
[align]="align()"
|
|
50
|
+
sideOffset="5"
|
|
51
|
+
[state]="_popoverState()"
|
|
52
|
+
(stateChanged)="_onStateChange($event)"
|
|
53
|
+
>
|
|
54
|
+
<ng-content />
|
|
55
|
+
|
|
56
|
+
<hlm-popover-content class="w-fit p-0" *hlmPopoverPortal="let ctx">
|
|
57
|
+
<ng-content select="[hlmDatePickerHeader]" />
|
|
58
|
+
<hlm-calendar-range
|
|
59
|
+
class="rounded-none border-0"
|
|
60
|
+
[startDate]="_start()"
|
|
61
|
+
[captionLayout]="captionLayout()"
|
|
62
|
+
[endDate]="_end()"
|
|
63
|
+
[min]="minDate()"
|
|
64
|
+
[max]="maxDate()"
|
|
65
|
+
[disabled]="_disabled()"
|
|
66
|
+
(startDateChange)="_handleStartDayChange($event)"
|
|
67
|
+
(endDateChange)="_handleEndDateChange($event)"
|
|
68
|
+
/>
|
|
69
|
+
<ng-content select="[hlmDatePickerFooter]" />
|
|
70
|
+
</hlm-popover-content>
|
|
71
|
+
</hlm-popover>
|
|
72
|
+
`,
|
|
73
|
+
})
|
|
74
|
+
export class HlmDateRangePicker<T> implements BrnDatePickerBase<[T, T]>, ControlValueAccessor {
|
|
75
|
+
private readonly _config = injectHlmDateRangePickerConfig<T>();
|
|
76
|
+
|
|
77
|
+
public readonly popover = viewChild.required(BrnPopover);
|
|
78
|
+
|
|
79
|
+
private readonly _trigger = contentChild(BrnDatePickerTriggerToken);
|
|
80
|
+
|
|
81
|
+
public readonly align = input<BrnPopoverAlign>('center');
|
|
82
|
+
|
|
83
|
+
/** Show dropdowns to navigate between months or years. */
|
|
84
|
+
public readonly captionLayout = input<
|
|
85
|
+
'dropdown' | 'label' | 'dropdown-months' | 'dropdown-years'
|
|
86
|
+
>('label');
|
|
87
|
+
|
|
88
|
+
/** The minimum date that can be selected.*/
|
|
89
|
+
public readonly minDate = input<T>();
|
|
90
|
+
|
|
91
|
+
/** The maximum date that can be selected. */
|
|
92
|
+
public readonly maxDate = input<T>();
|
|
93
|
+
|
|
94
|
+
/** Determine if the date picker is disabled. */
|
|
95
|
+
public readonly disabled = input<boolean, BooleanInput>(false, {
|
|
96
|
+
transform: booleanAttribute,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
/** The selected value. */
|
|
100
|
+
public readonly date = input<[T, T]>();
|
|
101
|
+
|
|
102
|
+
protected readonly _mutableDate = linkedSignal(this.date);
|
|
103
|
+
|
|
104
|
+
protected readonly _start = linkedSignal(() => this._mutableDate()?.[0]);
|
|
105
|
+
protected readonly _end = linkedSignal(() => this._mutableDate()?.[1]);
|
|
106
|
+
|
|
107
|
+
/** If true, the date picker will close when the end date is selected */
|
|
108
|
+
public readonly autoCloseOnEndSelection = input<boolean, BooleanInput>(
|
|
109
|
+
this._config.autoCloseOnEndSelection,
|
|
110
|
+
{
|
|
111
|
+
transform: booleanAttribute,
|
|
112
|
+
},
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
/** Defines how the date should be displayed in the UI. */
|
|
116
|
+
public readonly formatDates = input<(dates: [T | null, T | null]) => string>(
|
|
117
|
+
this._config.formatDates,
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
/** Defines how the date should be transformed before saving to model/form. */
|
|
121
|
+
public readonly transformDates = input<(date: [T, T]) => [T, T]>(this._config.transformDates);
|
|
122
|
+
|
|
123
|
+
protected readonly _popoverState = signal<BrnOverlayState | null>(null);
|
|
124
|
+
|
|
125
|
+
protected readonly _disabled = linkedSignal(this.disabled);
|
|
126
|
+
|
|
127
|
+
/** @internal The disabled state as a readonly signal */
|
|
128
|
+
public readonly disabledState = this._disabled.asReadonly();
|
|
129
|
+
|
|
130
|
+
public readonly formattedDate = computed(() => {
|
|
131
|
+
const start = this._start();
|
|
132
|
+
const end = this._end();
|
|
133
|
+
return start || end ? this.formatDates()([start ?? null, end ?? null]) : undefined;
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
public readonly dateChange = output<[T, T] | null>();
|
|
137
|
+
|
|
138
|
+
public readonly labelableId = computed(() => this._trigger()?.triggerId());
|
|
139
|
+
|
|
140
|
+
public readonly hasDate = computed(() => !!this._start() || !!this._end());
|
|
141
|
+
|
|
142
|
+
/** @internal The current raw value, used by inputs to reformat on focus. */
|
|
143
|
+
public readonly value = computed(() => this._mutableDate() ?? null);
|
|
144
|
+
|
|
145
|
+
protected _onChange?: ChangeFn<[T, T] | null>;
|
|
146
|
+
protected _onTouched?: TouchFn;
|
|
147
|
+
|
|
148
|
+
protected _onStateChange(state: BrnOverlayState) {
|
|
149
|
+
this._popoverState.set(state);
|
|
150
|
+
if (state === 'closed') {
|
|
151
|
+
this._onClose();
|
|
152
|
+
this._onTouched?.();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
protected _handleStartDayChange(value: T | undefined) {
|
|
157
|
+
this._start.set(value);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
protected _handleEndDateChange(value: T | undefined): void {
|
|
161
|
+
this._end.set(value);
|
|
162
|
+
if (this._disabled()) return;
|
|
163
|
+
|
|
164
|
+
const start = this._start();
|
|
165
|
+
if (start && value) {
|
|
166
|
+
const transformedDates = this.transformDates()([start, value]);
|
|
167
|
+
this._mutableDate.set(transformedDates);
|
|
168
|
+
this.dateChange.emit(transformedDates);
|
|
169
|
+
this._onChange?.(transformedDates);
|
|
170
|
+
|
|
171
|
+
if (this.autoCloseOnEndSelection()) {
|
|
172
|
+
this._popoverState.set('closed');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Commit a range to the picker. Updates the internal model, notifies form
|
|
179
|
+
* controls, and emits `dateChange`. Intended to be called from a text input
|
|
180
|
+
* that parses user-entered values. Pass `null` to clear the range.
|
|
181
|
+
*/
|
|
182
|
+
public updateDate(value: [T, T] | null) {
|
|
183
|
+
if (this._disabled()) return;
|
|
184
|
+
|
|
185
|
+
if (!value) {
|
|
186
|
+
this._mutableDate.set(undefined);
|
|
187
|
+
this._start.set(undefined);
|
|
188
|
+
this._end.set(undefined);
|
|
189
|
+
this._onChange?.(null);
|
|
190
|
+
this.dateChange.emit(null);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const transformedDates = this.transformDates()(value);
|
|
195
|
+
this._mutableDate.set(transformedDates);
|
|
196
|
+
this._start.set(transformedDates[0]);
|
|
197
|
+
this._end.set(transformedDates[1]);
|
|
198
|
+
this._onChange?.(transformedDates);
|
|
199
|
+
this.dateChange.emit(transformedDates);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
public touched(): void {
|
|
203
|
+
this._onTouched?.();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** CONTROL VALUE ACCESSOR */
|
|
207
|
+
public writeValue(value: [T, T] | null): void {
|
|
208
|
+
untracked(() => {
|
|
209
|
+
if (!value) {
|
|
210
|
+
this._mutableDate.set(undefined);
|
|
211
|
+
} else {
|
|
212
|
+
this._mutableDate.set(this.transformDates()(value));
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
public registerOnChange(fn: ChangeFn<[T, T] | null>): void {
|
|
218
|
+
this._onChange = fn;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
public registerOnTouched(fn: TouchFn): void {
|
|
222
|
+
this._onTouched = fn;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
public setDisabledState(isDisabled: boolean): void {
|
|
226
|
+
this._disabled.set(isDisabled);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
public open() {
|
|
230
|
+
this._popoverState.set('open');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
public close() {
|
|
234
|
+
this._popoverState.set('closed');
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
public reset() {
|
|
238
|
+
this._mutableDate.set(undefined);
|
|
239
|
+
this._start.set(undefined);
|
|
240
|
+
this._end.set(undefined);
|
|
241
|
+
this._onChange?.(null);
|
|
242
|
+
this.dateChange.emit(null);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
protected _onClose(): void {
|
|
246
|
+
const dates = this._mutableDate();
|
|
247
|
+
if (this._start() && !this._end() && dates) {
|
|
248
|
+
this._start.set(dates[0]);
|
|
249
|
+
this._end.set(dates[1]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
2
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
3
|
+
import { lucideCalendar, lucideX } from '@ng-icons/lucide';
|
|
4
|
+
import {
|
|
5
|
+
BrnDateInput,
|
|
6
|
+
type BrnDatePickerTriggerBase,
|
|
7
|
+
provideBrnDatePickerTrigger,
|
|
8
|
+
} from '@spartan-ng/brain/date-picker';
|
|
9
|
+
import { BrnFieldControl } from '@spartan-ng/brain/field';
|
|
10
|
+
import { HlmInputGroup, HlmInputGroupImports } from '@spartan-ng/styles/input-group';
|
|
11
|
+
import { injectHlmMonthYearPickerConfig } from './hlm-month-year-picker.token';
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'hlm-month-year-input',
|
|
15
|
+
imports: [HlmInputGroupImports, NgIcon],
|
|
16
|
+
providers: [
|
|
17
|
+
provideIcons({ lucideCalendar, lucideX }),
|
|
18
|
+
provideBrnDatePickerTrigger(HlmMonthYearInput),
|
|
19
|
+
],
|
|
20
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
+
hostDirectives: [HlmInputGroup],
|
|
22
|
+
template: `
|
|
23
|
+
<input
|
|
24
|
+
#input
|
|
25
|
+
hlmInputGroupInput
|
|
26
|
+
[value]="_inputValue()"
|
|
27
|
+
[id]="inputId()"
|
|
28
|
+
[placeholder]="placeholder()"
|
|
29
|
+
[disabled]="_disabled()"
|
|
30
|
+
[forceInvalid]="forceInvalid()"
|
|
31
|
+
[attr.aria-invalid]="_ariaInvalid()"
|
|
32
|
+
[attr.data-invalid]="_ariaInvalid()"
|
|
33
|
+
[attr.data-touched]="_touched?.() ? 'true' : null"
|
|
34
|
+
[attr.data-dirty]="_dirty?.() ? 'true' : null"
|
|
35
|
+
[attr.data-matches-spartan-invalid]="_spartanInvalid() ? 'true' : null"
|
|
36
|
+
(click)="_handleClick()"
|
|
37
|
+
(keydown.arrowDown)="_open()"
|
|
38
|
+
(keydown.enter)="_handleEnter($event)"
|
|
39
|
+
(input)="_handleInputChange($event)"
|
|
40
|
+
(focus)="_handleFocus()"
|
|
41
|
+
(blur)="_handleBlur()"
|
|
42
|
+
/>
|
|
43
|
+
<hlm-input-group-addon align="inline-end">
|
|
44
|
+
@if (_showClearButton()) {
|
|
45
|
+
<button
|
|
46
|
+
hlmInputGroupButton
|
|
47
|
+
size="icon-xs"
|
|
48
|
+
variant="ghost"
|
|
49
|
+
[attr.aria-label]="clearAriaLabel()"
|
|
50
|
+
(click)="_clear()"
|
|
51
|
+
[disabled]="_disabled()"
|
|
52
|
+
>
|
|
53
|
+
<ng-icon name="lucideX" />
|
|
54
|
+
</button>
|
|
55
|
+
}
|
|
56
|
+
<button
|
|
57
|
+
hlmInputGroupButton
|
|
58
|
+
size="icon-xs"
|
|
59
|
+
[attr.aria-label]="calendarAriaLabel()"
|
|
60
|
+
(click)="_popover().open()"
|
|
61
|
+
[disabled]="_disabled()"
|
|
62
|
+
>
|
|
63
|
+
<ng-icon name="lucideCalendar" />
|
|
64
|
+
</button>
|
|
65
|
+
</hlm-input-group-addon>
|
|
66
|
+
`,
|
|
67
|
+
})
|
|
68
|
+
export class HlmMonthYearInput<T> extends BrnDateInput<T> implements BrnDatePickerTriggerBase {
|
|
69
|
+
private readonly _config = injectHlmMonthYearPickerConfig<T>();
|
|
70
|
+
private readonly _fieldControl = inject(BrnFieldControl, { optional: true });
|
|
71
|
+
|
|
72
|
+
private readonly _invalid = this._fieldControl?.invalid;
|
|
73
|
+
protected readonly _spartanInvalid = computed(
|
|
74
|
+
() => this.forceInvalid() || this._fieldControl?.spartanInvalid(),
|
|
75
|
+
);
|
|
76
|
+
protected readonly _dirty = this._fieldControl?.dirty;
|
|
77
|
+
protected readonly _touched = this._fieldControl?.touched;
|
|
78
|
+
|
|
79
|
+
protected readonly _ariaInvalid = computed(() => (this._invalid?.() ? 'true' : null));
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Parses input text into a date value. Return `null` for invalid
|
|
83
|
+
* input - the picker's date is cleared while the text is preserved so
|
|
84
|
+
* the user can fix it.
|
|
85
|
+
*
|
|
86
|
+
* Defaults to `parseDate` from `HlmMonthYearPickerConfig`.
|
|
87
|
+
*/
|
|
88
|
+
public readonly parseDate = input<(value: string) => T | null>(this._config.parseDate);
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Formats the current date into the input/edit format shown while the
|
|
92
|
+
* input is focused. On blur the picker's display format is restored.
|
|
93
|
+
*
|
|
94
|
+
* Defaults to `formatInputDate` from `HlmMonthYearPickerConfig`.
|
|
95
|
+
*/
|
|
96
|
+
public readonly formatInputDate = input<(date: T) => string>(this._config.formatInputDate);
|
|
97
|
+
|
|
98
|
+
protected override parseValue(value: string): T | null {
|
|
99
|
+
return this.parseDate()(value);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
protected override formatInputValue(value: T): string {
|
|
103
|
+
return this.formatInputDate()(value);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { inject, InjectionToken, type ValueProvider } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
export interface HlmMonthYearPickerConfig<T> {
|
|
4
|
+
/**
|
|
5
|
+
* If true, the date picker will close when a date is selected.
|
|
6
|
+
*/
|
|
7
|
+
autoCloseOnSelect: boolean;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Defines how the date should be displayed in the UI.
|
|
11
|
+
*
|
|
12
|
+
* @param date
|
|
13
|
+
* @returns formatted date
|
|
14
|
+
*/
|
|
15
|
+
formatDate: (date: T) => string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Defines how the date should be displayed while the input is focused,
|
|
19
|
+
* i.e. the format the user is expected to type in.
|
|
20
|
+
*
|
|
21
|
+
* @param date
|
|
22
|
+
* @returns formatted date in the input/edit format
|
|
23
|
+
*/
|
|
24
|
+
formatInputDate: (date: T) => string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Defines how the date should be transformed before saving to model/form.
|
|
28
|
+
*
|
|
29
|
+
* @param date
|
|
30
|
+
* @returns transformed date
|
|
31
|
+
*/
|
|
32
|
+
transformDate: (date: T) => T;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Parse a user-entered string into a date.
|
|
36
|
+
*
|
|
37
|
+
* @param value the raw string from the input
|
|
38
|
+
* @returns the parsed date, or `null` when the value can't be parsed
|
|
39
|
+
*/
|
|
40
|
+
parseDate: (value: string) => T | null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const mmYYYY = <T>(date: T) => {
|
|
44
|
+
if (!(date instanceof Date)) return `${date}`;
|
|
45
|
+
|
|
46
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
47
|
+
const year = date.getFullYear();
|
|
48
|
+
|
|
49
|
+
return `${month}/${year}`;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
function getDefaultConfig<T>(): HlmMonthYearPickerConfig<T> {
|
|
53
|
+
return {
|
|
54
|
+
formatDate: mmYYYY,
|
|
55
|
+
formatInputDate: mmYYYY,
|
|
56
|
+
transformDate: (date) => date,
|
|
57
|
+
parseDate: (value) => {
|
|
58
|
+
if (typeof value !== 'string') return null;
|
|
59
|
+
|
|
60
|
+
const match = value.match(/^(\d{2})\/(\d{4})$/);
|
|
61
|
+
if (!match) return null;
|
|
62
|
+
|
|
63
|
+
const month = Number(match[1]);
|
|
64
|
+
const year = Number(match[2]);
|
|
65
|
+
|
|
66
|
+
if (month < 1 || month > 12) return null;
|
|
67
|
+
|
|
68
|
+
const date = new Date(year, month - 1, 1);
|
|
69
|
+
|
|
70
|
+
return date as T;
|
|
71
|
+
},
|
|
72
|
+
autoCloseOnSelect: false,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const HlmMonthYearPickerConfigToken = new InjectionToken<HlmMonthYearPickerConfig<unknown>>(
|
|
77
|
+
'HlmMonthYearPickerConfig',
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
export function provideHlmMonthYearPickerConfig<T>(
|
|
81
|
+
config: Partial<HlmMonthYearPickerConfig<T>>,
|
|
82
|
+
): ValueProvider {
|
|
83
|
+
return { provide: HlmMonthYearPickerConfigToken, useValue: { ...getDefaultConfig(), ...config } };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function injectHlmMonthYearPickerConfig<T>(): HlmMonthYearPickerConfig<T> {
|
|
87
|
+
const injectedConfig = inject(HlmMonthYearPickerConfigToken, { optional: true });
|
|
88
|
+
return injectedConfig ? (injectedConfig as HlmMonthYearPickerConfig<T>) : getDefaultConfig();
|
|
89
|
+
}
|