@edsis/angular 22.1.6 → 22.2.10
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 +21 -0
- package/README.md +87 -399
- package/SECURITY.md +18 -0
- package/SUPPORT.md +15 -0
- package/chart/README.md +275 -0
- package/component/README.md +89 -0
- package/component/accordion/README.md +195 -0
- package/component/alert/README.md +184 -0
- package/component/alert-dialog/README.md +255 -0
- package/component/aspect-ratio/README.md +116 -0
- package/component/avatar/README.md +182 -0
- package/component/badge/README.md +143 -0
- package/component/breadcrumb/README.md +223 -0
- package/component/button/README.md +141 -0
- package/component/button-group/README.md +214 -0
- package/component/calendar/README.md +125 -0
- package/component/card/README.md +232 -0
- package/component/carousel/README.md +276 -0
- package/component/checkbox/README.md +153 -0
- package/component/collapsible/README.md +216 -0
- package/component/combobox/README.md +202 -0
- package/component/command/README.md +287 -0
- package/component/composer/README.md +241 -0
- package/component/context-menu/README.md +268 -0
- package/component/date-picker/README.md +202 -0
- package/component/dialog/README.md +276 -0
- package/component/drawer/README.md +146 -0
- package/component/dropdown-menu/README.md +336 -0
- package/component/editor/README.md +152 -0
- package/component/empty/README.md +193 -0
- package/component/form/README.md +216 -0
- package/component/hover-card/README.md +150 -0
- package/component/icon/README.md +52 -0
- package/component/input/README.md +160 -0
- package/component/input-group/README.md +245 -0
- package/component/input-otp/README.md +331 -0
- package/component/item/README.md +254 -0
- package/component/kanban/README.md +81 -0
- package/component/kbd/README.md +141 -0
- package/component/label/README.md +137 -0
- package/component/menubar/README.md +270 -0
- package/component/native-select/README.md +176 -0
- package/component/navigation-menu/README.md +165 -0
- package/component/pagination/README.md +151 -0
- package/component/pillbox/README.md +68 -0
- package/component/popover/README.md +54 -0
- package/component/progress/README.md +160 -0
- package/component/radio/README.md +212 -0
- package/component/resizable/README.md +178 -0
- package/component/scroll-area/README.md +150 -0
- package/component/select/README.md +228 -0
- package/component/separator/README.md +175 -0
- package/component/sheet/README.md +190 -0
- package/component/skeleton/README.md +158 -0
- package/component/slider/README.md +207 -0
- package/component/spinner/README.md +160 -0
- package/component/switch/README.md +170 -0
- package/component/table/README.md +292 -0
- package/component/tabs/README.md +220 -0
- package/component/textarea/README.md +169 -0
- package/component/timeline/README.md +94 -0
- package/component/toast/README.md +173 -0
- package/component/toggle/README.md +133 -0
- package/component/toggle-group/README.md +234 -0
- package/component/tooltip/README.md +230 -0
- package/fesm2022/edsis-angular-chart-area.mjs +508 -0
- package/fesm2022/edsis-angular-chart-bar.mjs +946 -0
- package/fesm2022/edsis-angular-chart-core.mjs +1319 -0
- package/fesm2022/edsis-angular-chart-line.mjs +544 -0
- package/fesm2022/edsis-angular-chart-pie.mjs +531 -0
- package/fesm2022/edsis-angular-chart-primitives.mjs +1647 -0
- package/fesm2022/edsis-angular-chart-radar.mjs +693 -0
- package/fesm2022/edsis-angular-chart-radial.mjs +542 -0
- package/fesm2022/edsis-angular-chart-scatter.mjs +486 -0
- package/fesm2022/edsis-angular-chart.mjs +3 -0
- package/fesm2022/edsis-angular-component-accordion.mjs +513 -0
- package/fesm2022/edsis-angular-component-alert-dialog.mjs +1001 -0
- package/fesm2022/edsis-angular-component-alert.mjs +268 -0
- package/fesm2022/edsis-angular-component-aspect-ratio.mjs +80 -0
- package/fesm2022/edsis-angular-component-avatar.mjs +410 -0
- package/fesm2022/edsis-angular-component-badge.mjs +111 -0
- package/fesm2022/edsis-angular-component-breadcrumb.mjs +464 -0
- package/fesm2022/edsis-angular-component-button-group.mjs +252 -0
- package/fesm2022/edsis-angular-component-button.mjs +155 -0
- package/fesm2022/edsis-angular-component-calendar.mjs +835 -0
- package/fesm2022/edsis-angular-component-card.mjs +460 -0
- package/fesm2022/edsis-angular-component-carousel.mjs +700 -0
- package/fesm2022/edsis-angular-component-checkbox.mjs +398 -0
- package/fesm2022/edsis-angular-component-collapsible.mjs +305 -0
- package/fesm2022/edsis-angular-component-combobox.mjs +544 -0
- package/fesm2022/edsis-angular-component-command.mjs +815 -0
- package/fesm2022/edsis-angular-component-composer.mjs +840 -0
- package/fesm2022/edsis-angular-component-context-menu.mjs +197 -0
- package/fesm2022/edsis-angular-component-date-picker.mjs +798 -0
- package/fesm2022/edsis-angular-component-dialog.mjs +798 -0
- package/fesm2022/edsis-angular-component-drawer.mjs +1 -0
- package/fesm2022/edsis-angular-component-dropdown-menu.mjs +1259 -0
- package/fesm2022/edsis-angular-component-editor.mjs +1000 -0
- package/fesm2022/edsis-angular-component-empty.mjs +351 -0
- package/fesm2022/edsis-angular-component-form.mjs +821 -0
- package/fesm2022/edsis-angular-component-hover-card.mjs +486 -0
- package/fesm2022/edsis-angular-component-icon.mjs +253 -0
- package/fesm2022/edsis-angular-component-input-group.mjs +453 -0
- package/fesm2022/edsis-angular-component-input-otp.mjs +957 -0
- package/fesm2022/edsis-angular-component-input.mjs +87 -0
- package/fesm2022/edsis-angular-component-item.mjs +720 -0
- package/fesm2022/edsis-angular-component-kanban.mjs +812 -0
- package/fesm2022/edsis-angular-component-kbd.mjs +124 -0
- package/fesm2022/edsis-angular-component-label.mjs +82 -0
- package/fesm2022/edsis-angular-component-menubar.mjs +481 -0
- package/fesm2022/edsis-angular-component-native-select.mjs +168 -0
- package/fesm2022/edsis-angular-component-navigation-menu.mjs +685 -0
- package/fesm2022/edsis-angular-component-pagination.mjs +425 -0
- package/fesm2022/edsis-angular-component-pillbox.mjs +1679 -0
- package/fesm2022/edsis-angular-component-popover.mjs +292 -0
- package/fesm2022/edsis-angular-component-progress.mjs +184 -0
- package/fesm2022/edsis-angular-component-radio.mjs +491 -0
- package/fesm2022/edsis-angular-component-resizable.mjs +703 -0
- package/fesm2022/edsis-angular-component-scroll-area.mjs +133 -0
- package/fesm2022/edsis-angular-component-segmented-control.mjs +408 -0
- package/fesm2022/edsis-angular-component-select.mjs +743 -0
- package/fesm2022/edsis-angular-component-separator.mjs +102 -0
- package/fesm2022/edsis-angular-component-sheet.mjs +874 -0
- package/fesm2022/edsis-angular-component-skeleton.mjs +62 -0
- package/fesm2022/edsis-angular-component-slider.mjs +676 -0
- package/fesm2022/edsis-angular-component-spinner.mjs +157 -0
- package/fesm2022/edsis-angular-component-switch.mjs +361 -0
- package/fesm2022/edsis-angular-component-table.mjs +446 -0
- package/fesm2022/edsis-angular-component-tabs.mjs +592 -0
- package/fesm2022/edsis-angular-component-textarea.mjs +85 -0
- package/fesm2022/edsis-angular-component-timeline.mjs +619 -0
- package/fesm2022/edsis-angular-component-toast.mjs +231 -0
- package/fesm2022/edsis-angular-component-toggle-group.mjs +579 -0
- package/fesm2022/edsis-angular-component-toggle.mjs +189 -0
- package/fesm2022/edsis-angular-component-tooltip.mjs +804 -0
- package/fesm2022/edsis-angular-component-utils-core.mjs +181 -0
- package/fesm2022/edsis-angular-component-utils-overlay.mjs +54 -0
- package/fesm2022/edsis-angular-component-utils-scale.mjs +76 -0
- package/fesm2022/edsis-angular-component-utils.mjs +2 -0
- package/fesm2022/edsis-angular-component.mjs +0 -0
- package/fesm2022/edsis-angular-navigation-core.mjs +15 -0
- package/fesm2022/edsis-angular-navigation-icon.mjs +35 -0
- package/fesm2022/edsis-angular-navigation-navigation-badge-count.component-D70Ju6_f.mjs +234 -0
- package/fesm2022/edsis-angular-navigation-navigation-dockbar-menu.component-BaFnh48V.mjs +834 -0
- package/fesm2022/edsis-angular-navigation-navigation-entry-grid.component-D39W0FQZ.mjs +823 -0
- package/fesm2022/edsis-angular-navigation-navigation-flyout-menu.component-CpmsY8hb.mjs +670 -0
- package/fesm2022/edsis-angular-navigation-navigation-horizontal.component-D35IfX6r.mjs +689 -0
- package/fesm2022/edsis-angular-navigation-navigation-item.component-X6JFy-ya.mjs +1522 -0
- package/fesm2022/edsis-angular-navigation-navigation-list.component-D6Ms8H5g.mjs +346 -0
- package/fesm2022/edsis-angular-navigation-service.mjs +558 -0
- package/fesm2022/edsis-angular-navigation-types.mjs +151 -0
- package/fesm2022/edsis-angular-navigation.mjs +3338 -0
- package/fesm2022/edsis-angular-sdk.mjs +100 -0
- package/fesm2022/edsis-angular-theme-component-settings.mjs +1863 -0
- package/fesm2022/edsis-angular-theme-layout-services.mjs +252 -0
- package/fesm2022/edsis-angular-theme-layout-types.mjs +45 -0
- package/fesm2022/edsis-angular-theme-layout-wrapper.mjs +2568 -0
- package/fesm2022/edsis-angular-theme-layout.mjs +1089 -0
- package/fesm2022/edsis-angular-theme-on-fill.mjs +89 -0
- package/fesm2022/edsis-angular-theme-page-core.mjs +315 -0
- package/fesm2022/edsis-angular-theme-page-filter.mjs +409 -0
- package/fesm2022/edsis-angular-theme-page-overview.mjs +88 -0
- package/fesm2022/edsis-angular-theme-page-root.mjs +693 -0
- package/fesm2022/edsis-angular-theme-page-side.mjs +342 -0
- package/fesm2022/edsis-angular-theme-page-slots.mjs +258 -0
- package/fesm2022/edsis-angular-theme-page.mjs +7 -0
- package/fesm2022/edsis-angular-theme-shell-services.mjs +231 -0
- package/fesm2022/edsis-angular-theme-shell-types.mjs +102 -0
- package/fesm2022/edsis-angular-theme-shell.mjs +1352 -0
- package/fesm2022/edsis-angular-theme-styles.mjs +605 -0
- package/fesm2022/edsis-angular-theme.mjs +0 -0
- package/fesm2022/edsis-angular.mjs +5 -8
- package/navigation/README.md +576 -0
- package/package.json +481 -52
- package/sdk/README.md +212 -0
- package/sdk/schematics/collection.json +20 -0
- package/sdk/schematics/init/index.js +83 -0
- package/sdk/schematics/init/schema.json +19 -0
- package/sdk/schematics/ng-add/index.js +147 -0
- package/sdk/schematics/ng-add/schema.json +14 -0
- package/sdk/schematics/package.json +3 -0
- package/sdk/schematics/sdk/index.js +175 -0
- package/sdk/schematics/sdk/schema.json +19 -0
- package/sdk/sdk.config.example.json +24 -0
- package/sdk/src/config/loader.js +43 -0
- package/sdk/src/config/schema.js +59 -0
- package/sdk/src/emit/client.js +251 -0
- package/sdk/src/emit/metadata.js +310 -0
- package/sdk/src/emit/models.js +104 -0
- package/sdk/src/emit/navigation.js +56 -0
- package/sdk/src/emit/operations.js +118 -0
- package/sdk/src/emit/public-api.js +54 -0
- package/sdk/src/emit/services.js +110 -0
- package/sdk/src/engine.js +67 -0
- package/sdk/src/layout/per-domain.js +360 -0
- package/sdk/src/package.json +3 -0
- package/sdk/src/parser/bundle.js +25 -0
- package/sdk/src/parser/ir.js +429 -0
- package/sdk/src/parser/types.js +7 -0
- package/sdk/src/render/template.js +152 -0
- package/sdk/src/writer/index.js +286 -0
- package/theme/README.md +120 -0
- package/theme/component/settings/README.md +154 -0
- package/theme/layout/README.md +604 -0
- package/theme/page/README.md +505 -0
- package/theme/shell/README.md +344 -0
- package/theme/styles/README.md +251 -0
- package/theme/styles/css/base/components.css +577 -0
- package/theme/styles/css/base/index.css +14 -0
- package/theme/styles/css/base/on-fill.css +153 -0
- package/theme/styles/css/base/package.css +10 -0
- package/theme/styles/css/base/prefers-dark.css +81 -0
- package/theme/styles/css/base/print.css +62 -0
- package/theme/styles/css/base/status.css +38 -0
- package/theme/styles/css/base/tailwind.css +208 -0
- package/theme/styles/css/base/theme.css +306 -0
- package/theme/styles/css/base/tokens.css +388 -0
- package/theme/styles/css/color/amber.css +72 -0
- package/theme/styles/css/color/blue.css +72 -0
- package/theme/styles/css/color/brand.css +38 -0
- package/theme/styles/css/color/cyan.css +72 -0
- package/theme/styles/css/color/emerald.css +72 -0
- package/theme/styles/css/color/fuchsia.css +72 -0
- package/theme/styles/css/color/green.css +72 -0
- package/theme/styles/css/color/index.css +19 -0
- package/theme/styles/css/color/indigo.css +72 -0
- package/theme/styles/css/color/lime.css +72 -0
- package/theme/styles/css/color/orange.css +72 -0
- package/theme/styles/css/color/pink.css +72 -0
- package/theme/styles/css/color/purple.css +72 -0
- package/theme/styles/css/color/red.css +72 -0
- package/theme/styles/css/color/rose.css +72 -0
- package/theme/styles/css/color/sky.css +72 -0
- package/theme/styles/css/color/teal.css +72 -0
- package/theme/styles/css/color/violet.css +72 -0
- package/theme/styles/css/color/yellow.css +72 -0
- package/theme/styles/css/fonts.css +85 -0
- package/theme/styles/css/index.css +18 -0
- package/theme/styles/css/neutral/gray.css +63 -0
- package/theme/styles/css/neutral/index.css +11 -0
- package/theme/styles/css/neutral/mauve.css +63 -0
- package/theme/styles/css/neutral/mist.css +63 -0
- package/theme/styles/css/neutral/neutral.css +63 -0
- package/theme/styles/css/neutral/olive.css +63 -0
- package/theme/styles/css/neutral/slate.css +63 -0
- package/theme/styles/css/neutral/stone.css +63 -0
- package/theme/styles/css/neutral/taupe.css +63 -0
- package/theme/styles/css/neutral/zinc.css +63 -0
- package/theme/styles/css/radius/index.css +30 -0
- package/theme/styles/css/space/index.css +20 -0
- package/types/edsis-angular-chart-area.d.ts +139 -0
- package/types/edsis-angular-chart-bar.d.ts +291 -0
- package/types/edsis-angular-chart-core.d.ts +824 -0
- package/types/edsis-angular-chart-line.d.ts +148 -0
- package/types/edsis-angular-chart-pie.d.ts +207 -0
- package/types/edsis-angular-chart-primitives.d.ts +360 -0
- package/types/edsis-angular-chart-radar.d.ts +198 -0
- package/types/edsis-angular-chart-radial.d.ts +187 -0
- package/types/edsis-angular-chart-scatter.d.ts +181 -0
- package/types/edsis-angular-chart.d.ts +3 -0
- package/types/edsis-angular-component-accordion.d.ts +139 -0
- package/types/edsis-angular-component-alert-dialog.d.ts +288 -0
- package/types/edsis-angular-component-alert.d.ts +72 -0
- package/types/edsis-angular-component-aspect-ratio.d.ts +20 -0
- package/types/edsis-angular-component-avatar.d.ts +111 -0
- package/types/edsis-angular-component-badge.d.ts +36 -0
- package/types/edsis-angular-component-breadcrumb.d.ts +85 -0
- package/types/edsis-angular-component-button-group.d.ts +50 -0
- package/types/edsis-angular-component-button.d.ts +44 -0
- package/types/edsis-angular-component-calendar.d.ts +150 -0
- package/types/edsis-angular-component-card.d.ts +123 -0
- package/types/edsis-angular-component-carousel.d.ts +155 -0
- package/types/edsis-angular-component-checkbox.d.ts +100 -0
- package/types/edsis-angular-component-collapsible.d.ts +68 -0
- package/types/edsis-angular-component-combobox.d.ts +105 -0
- package/types/edsis-angular-component-command.d.ts +215 -0
- package/types/edsis-angular-component-composer.d.ts +190 -0
- package/types/edsis-angular-component-context-menu.d.ts +64 -0
- package/types/edsis-angular-component-date-picker.d.ts +199 -0
- package/types/edsis-angular-component-dialog.d.ts +231 -0
- package/types/edsis-angular-component-drawer.d.ts +2 -0
- package/types/edsis-angular-component-dropdown-menu.d.ts +370 -0
- package/types/edsis-angular-component-editor.d.ts +234 -0
- package/types/edsis-angular-component-empty.d.ts +85 -0
- package/types/edsis-angular-component-form.d.ts +223 -0
- package/types/edsis-angular-component-hover-card.d.ts +133 -0
- package/types/edsis-angular-component-icon.d.ts +90 -0
- package/types/edsis-angular-component-input-group.d.ts +98 -0
- package/types/edsis-angular-component-input-otp.d.ts +249 -0
- package/types/edsis-angular-component-input.d.ts +31 -0
- package/types/edsis-angular-component-item.d.ts +169 -0
- package/types/edsis-angular-component-kanban.d.ts +165 -0
- package/types/edsis-angular-component-kbd.d.ts +25 -0
- package/types/edsis-angular-component-label.d.ts +19 -0
- package/types/edsis-angular-component-menubar.d.ts +123 -0
- package/types/edsis-angular-component-native-select.d.ts +39 -0
- package/types/edsis-angular-component-navigation-menu.d.ts +163 -0
- package/types/edsis-angular-component-pagination.d.ts +83 -0
- package/types/edsis-angular-component-pillbox.d.ts +380 -0
- package/types/edsis-angular-component-popover.d.ts +96 -0
- package/types/edsis-angular-component-progress.d.ts +45 -0
- package/types/edsis-angular-component-radio.d.ts +137 -0
- package/types/edsis-angular-component-resizable.d.ts +166 -0
- package/types/edsis-angular-component-scroll-area.d.ts +37 -0
- package/types/edsis-angular-component-segmented-control.d.ts +102 -0
- package/types/edsis-angular-component-select.d.ts +138 -0
- package/types/edsis-angular-component-separator.d.ts +26 -0
- package/types/edsis-angular-component-sheet.d.ts +240 -0
- package/types/edsis-angular-component-skeleton.d.ts +13 -0
- package/types/edsis-angular-component-slider.d.ts +148 -0
- package/types/edsis-angular-component-spinner.d.ts +31 -0
- package/types/edsis-angular-component-switch.d.ts +101 -0
- package/types/edsis-angular-component-table.d.ts +109 -0
- package/types/edsis-angular-component-tabs.d.ts +183 -0
- package/types/edsis-angular-component-textarea.d.ts +27 -0
- package/types/edsis-angular-component-timeline.d.ts +146 -0
- package/types/edsis-angular-component-toast.d.ts +60 -0
- package/types/edsis-angular-component-toggle-group.d.ts +161 -0
- package/types/edsis-angular-component-toggle.d.ts +47 -0
- package/types/edsis-angular-component-tooltip.d.ts +233 -0
- package/types/edsis-angular-component-utils-core.d.ts +175 -0
- package/types/edsis-angular-component-utils-overlay.d.ts +17 -0
- package/types/edsis-angular-component-utils-scale.d.ts +27 -0
- package/types/edsis-angular-component-utils.d.ts +2 -0
- package/types/edsis-angular-component.d.ts +1 -0
- package/types/edsis-angular-navigation-core.d.ts +55 -0
- package/types/edsis-angular-navigation-icon.d.ts +9 -0
- package/types/edsis-angular-navigation-service.d.ts +121 -0
- package/types/edsis-angular-navigation-types.d.ts +185 -0
- package/types/edsis-angular-navigation.d.ts +862 -0
- package/types/edsis-angular-sdk.d.ts +87 -0
- package/types/edsis-angular-theme-component-settings.d.ts +205 -0
- package/types/edsis-angular-theme-layout-services.d.ts +143 -0
- package/types/edsis-angular-theme-layout-types.d.ts +36 -0
- package/types/edsis-angular-theme-layout-wrapper.d.ts +670 -0
- package/types/edsis-angular-theme-layout.d.ts +218 -0
- package/types/edsis-angular-theme-on-fill.d.ts +45 -0
- package/types/edsis-angular-theme-page-core.d.ts +151 -0
- package/types/edsis-angular-theme-page-filter.d.ts +127 -0
- package/types/edsis-angular-theme-page-overview.d.ts +28 -0
- package/types/edsis-angular-theme-page-root.d.ts +172 -0
- package/types/edsis-angular-theme-page-side.d.ts +90 -0
- package/types/edsis-angular-theme-page-slots.d.ts +61 -0
- package/types/edsis-angular-theme-page.d.ts +7 -0
- package/types/edsis-angular-theme-shell-services.d.ts +188 -0
- package/types/edsis-angular-theme-shell-types.d.ts +102 -0
- package/types/edsis-angular-theme-shell.d.ts +178 -0
- package/types/edsis-angular-theme-styles.d.ts +328 -0
- package/types/edsis-angular-theme.d.ts +1 -0
- package/types/edsis-angular.d.ts +5 -2
- package/fesm2022/edsis-angular-block-shell.mjs +0 -1329
- package/fesm2022/edsis-angular-block-shell.mjs.map +0 -1
- package/fesm2022/edsis-angular-block-themes.mjs +0 -1007
- package/fesm2022/edsis-angular-block-themes.mjs.map +0 -1
- package/fesm2022/edsis-angular-module-auth.mjs +0 -2582
- package/fesm2022/edsis-angular-module-auth.mjs.map +0 -1
- package/fesm2022/edsis-angular-platform-mfe.mjs +0 -329
- package/fesm2022/edsis-angular-platform-mfe.mjs.map +0 -1
- package/fesm2022/edsis-angular-services-runtime.mjs +0 -385
- package/fesm2022/edsis-angular-services-runtime.mjs.map +0 -1
- package/fesm2022/edsis-angular.mjs.map +0 -1
- package/types/edsis-angular-block-shell.d.ts +0 -190
- package/types/edsis-angular-block-themes.d.ts +0 -94
- package/types/edsis-angular-module-auth.d.ts +0 -533
- package/types/edsis-angular-platform-mfe.d.ts +0 -126
- package/types/edsis-angular-services-runtime.d.ts +0 -118
|
@@ -0,0 +1,835 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, Injector, afterNextRender, booleanAttribute, computed, forwardRef, inject, input, linkedSignal, model, signal, viewChild } from "@angular/core";
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
4
|
+
import { cn } from "@edsis/angular/component/utils/core";
|
|
5
|
+
function cloneDate(date) {
|
|
6
|
+
return new Date(date.getTime());
|
|
7
|
+
}
|
|
8
|
+
function sameDay(left, right) {
|
|
9
|
+
return left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth() && left.getDate() === right.getDate();
|
|
10
|
+
}
|
|
11
|
+
function startOfDay(date) {
|
|
12
|
+
const next = cloneDate(date);
|
|
13
|
+
next.setHours(0, 0, 0, 0);
|
|
14
|
+
return next;
|
|
15
|
+
}
|
|
16
|
+
function startOfMonth(date) {
|
|
17
|
+
const next = startOfDay(date);
|
|
18
|
+
next.setDate(1);
|
|
19
|
+
return next;
|
|
20
|
+
}
|
|
21
|
+
function endOfMonth(date) {
|
|
22
|
+
const next = startOfMonth(date);
|
|
23
|
+
next.setMonth(next.getMonth() + 1);
|
|
24
|
+
next.setDate(0);
|
|
25
|
+
return next;
|
|
26
|
+
}
|
|
27
|
+
function startOfWeek(date) {
|
|
28
|
+
const next = startOfDay(date);
|
|
29
|
+
next.setDate(next.getDate() - next.getDay());
|
|
30
|
+
return next;
|
|
31
|
+
}
|
|
32
|
+
function addDays(date, amount) {
|
|
33
|
+
const next = cloneDate(date);
|
|
34
|
+
next.setDate(next.getDate() + amount);
|
|
35
|
+
return next;
|
|
36
|
+
}
|
|
37
|
+
function addMonths(date, amount) {
|
|
38
|
+
const next = cloneDate(date);
|
|
39
|
+
next.setDate(1);
|
|
40
|
+
next.setMonth(next.getMonth() + amount);
|
|
41
|
+
return next;
|
|
42
|
+
}
|
|
43
|
+
function addYears(date, amount) {
|
|
44
|
+
const next = cloneDate(date);
|
|
45
|
+
next.setFullYear(next.getFullYear() + amount);
|
|
46
|
+
return next;
|
|
47
|
+
}
|
|
48
|
+
function isDateSelectable(date, min, max, filter) {
|
|
49
|
+
const time = startOfDay(date).getTime();
|
|
50
|
+
if (min && time < startOfDay(min).getTime()) return false;
|
|
51
|
+
if (max && time > startOfDay(max).getTime()) return false;
|
|
52
|
+
return filter ? filter(date) : true;
|
|
53
|
+
}
|
|
54
|
+
function formatIsoDate(date) {
|
|
55
|
+
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
56
|
+
}
|
|
57
|
+
function parseIsoDate(text) {
|
|
58
|
+
const match = text.trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
59
|
+
if (!match) return null;
|
|
60
|
+
const year = Number(match[1]);
|
|
61
|
+
const month = Number(match[2]) - 1;
|
|
62
|
+
const day = Number(match[3]);
|
|
63
|
+
const date = new Date(year, month, day);
|
|
64
|
+
return date.getFullYear() === year && date.getMonth() === month && date.getDate() === day ? date : null;
|
|
65
|
+
}
|
|
66
|
+
function monthLabel(date) {
|
|
67
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
68
|
+
month: "long",
|
|
69
|
+
year: "numeric"
|
|
70
|
+
}).format(date);
|
|
71
|
+
}
|
|
72
|
+
function yearLabel(date) {
|
|
73
|
+
return String(date.getFullYear());
|
|
74
|
+
}
|
|
75
|
+
function yearRangeLabel(startYear, count) {
|
|
76
|
+
return `${startYear} - ${startYear + count - 1}`;
|
|
77
|
+
}
|
|
78
|
+
var CalendarComponent = class CalendarComponent {
|
|
79
|
+
injector = inject(Injector);
|
|
80
|
+
surface = viewChild.required("surface", ...ngDevMode ? [{ debugName: "surface" }] : /* istanbul ignore next */ []);
|
|
81
|
+
value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
82
|
+
min = input(null, {
|
|
83
|
+
...ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {},
|
|
84
|
+
transform: (value) => value ?? null
|
|
85
|
+
});
|
|
86
|
+
max = input(null, {
|
|
87
|
+
...ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {},
|
|
88
|
+
transform: (value) => value ?? null
|
|
89
|
+
});
|
|
90
|
+
startAt = input(null, ...ngDevMode ? [{ debugName: "startAt" }] : /* istanbul ignore next */ []);
|
|
91
|
+
startView = input("month", ...ngDevMode ? [{ debugName: "startView" }] : /* istanbul ignore next */ []);
|
|
92
|
+
dateFilter = input(null, ...ngDevMode ? [{ debugName: "dateFilter" }] : /* istanbul ignore next */ []);
|
|
93
|
+
disabled = input(false, {
|
|
94
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
95
|
+
transform: booleanAttribute
|
|
96
|
+
});
|
|
97
|
+
class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
|
|
98
|
+
cvaDisabled = signal(false, ...ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []);
|
|
99
|
+
onChangeFn = () => {};
|
|
100
|
+
onTouchedFn = () => {};
|
|
101
|
+
focusDate = linkedSignal(() => cloneDate(this.value() ?? this.startAt() ?? /* @__PURE__ */ new Date()), ...ngDevMode ? [{ debugName: "focusDate" }] : /* istanbul ignore next */ []);
|
|
102
|
+
activeView = linkedSignal(() => this.startView(), ...ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []);
|
|
103
|
+
classes = computed(() => cn("calendar block w-fit", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
104
|
+
isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
105
|
+
sameDay = sameDay;
|
|
106
|
+
cloneDate = cloneDate;
|
|
107
|
+
weekdayLabels = computed(() => this.buildWeekdayLabels(), ...ngDevMode ? [{ debugName: "weekdayLabels" }] : /* istanbul ignore next */ []);
|
|
108
|
+
monthCells = computed(() => this.buildMonthCells(), ...ngDevMode ? [{ debugName: "monthCells" }] : /* istanbul ignore next */ []);
|
|
109
|
+
monthTabStopKey = computed(() => {
|
|
110
|
+
const cells = this.monthCells();
|
|
111
|
+
return cells.find((cell) => sameDay(cell.date, this.focusDate()) && !cell.disabled)?.key ?? cells.find((cell) => !cell.disabled)?.key ?? null;
|
|
112
|
+
}, ...ngDevMode ? [{ debugName: "monthTabStopKey" }] : /* istanbul ignore next */ []);
|
|
113
|
+
monthWeeks = computed(() => {
|
|
114
|
+
const cells = this.monthCells();
|
|
115
|
+
return Array.from({ length: cells.length / 7 }, (_, index) => cells.slice(index * 7, index * 7 + 7));
|
|
116
|
+
}, ...ngDevMode ? [{ debugName: "monthWeeks" }] : /* istanbul ignore next */ []);
|
|
117
|
+
yearTabStop = computed(() => {
|
|
118
|
+
const months = this.yearMonths();
|
|
119
|
+
const focusedMonth = this.focusDate().getMonth();
|
|
120
|
+
return months.find((month) => month.monthIndex === focusedMonth && !month.disabled)?.monthIndex ?? months.find((month) => !month.disabled)?.monthIndex ?? -1;
|
|
121
|
+
}, ...ngDevMode ? [{ debugName: "yearTabStop" }] : /* istanbul ignore next */ []);
|
|
122
|
+
multiYearTabStop = computed(() => {
|
|
123
|
+
const years = this.multiYearCells();
|
|
124
|
+
const focusedYear = this.focusDate().getFullYear();
|
|
125
|
+
return years.find((year) => year.year === focusedYear && !year.disabled)?.year ?? years.find((year) => !year.disabled)?.year ?? -1;
|
|
126
|
+
}, ...ngDevMode ? [{ debugName: "multiYearTabStop" }] : /* istanbul ignore next */ []);
|
|
127
|
+
dateLabel = (date) => new Intl.DateTimeFormat(void 0, { dateStyle: "long" }).format(date);
|
|
128
|
+
headerLabel = computed(() => {
|
|
129
|
+
const focus = this.focusDate();
|
|
130
|
+
switch (this.activeView()) {
|
|
131
|
+
case "year": return String(focus.getFullYear());
|
|
132
|
+
case "multi-year": return yearRangeLabel(Math.floor(focus.getFullYear() / 20) * 20, 20);
|
|
133
|
+
default: return monthLabel(focus);
|
|
134
|
+
}
|
|
135
|
+
}, ...ngDevMode ? [{ debugName: "headerLabel" }] : /* istanbul ignore next */ []);
|
|
136
|
+
yearMonths() {
|
|
137
|
+
const focus = this.focusDate();
|
|
138
|
+
const selectedMonth = this.value()?.getMonth() ?? focus.getMonth();
|
|
139
|
+
const selectedYear = this.value()?.getFullYear() ?? focus.getFullYear();
|
|
140
|
+
return Array.from({ length: 12 }, (_, monthIndex) => {
|
|
141
|
+
const candidate = new Date(focus.getFullYear(), monthIndex, 1);
|
|
142
|
+
return {
|
|
143
|
+
key: `${candidate.getFullYear()}-${monthIndex}`,
|
|
144
|
+
label: new Intl.DateTimeFormat(void 0, { month: "short" }).format(candidate),
|
|
145
|
+
monthIndex,
|
|
146
|
+
selected: monthIndex === selectedMonth && focus.getFullYear() === selectedYear,
|
|
147
|
+
disabled: !this.isMonthSelectable(candidate)
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
multiYearCells() {
|
|
152
|
+
const focusYear = this.focusDate().getFullYear();
|
|
153
|
+
const baseYear = Math.floor(focusYear / 20) * 20;
|
|
154
|
+
const selectedYear = this.value()?.getFullYear() ?? focusYear;
|
|
155
|
+
return Array.from({ length: 20 }, (_, index) => {
|
|
156
|
+
const year = baseYear + index;
|
|
157
|
+
const candidate = new Date(year, 0, 1);
|
|
158
|
+
return {
|
|
159
|
+
key: String(year),
|
|
160
|
+
year,
|
|
161
|
+
selected: year === selectedYear,
|
|
162
|
+
disabled: !this.isYearSelectable(candidate)
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
toggleView() {
|
|
167
|
+
switch (this.activeView()) {
|
|
168
|
+
case "month":
|
|
169
|
+
this.activeView.set("year");
|
|
170
|
+
break;
|
|
171
|
+
case "year":
|
|
172
|
+
this.activeView.set("multi-year");
|
|
173
|
+
break;
|
|
174
|
+
default: this.activeView.set("multi-year");
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
previous() {
|
|
178
|
+
const focus = this.focusDate();
|
|
179
|
+
switch (this.activeView()) {
|
|
180
|
+
case "year":
|
|
181
|
+
this.focusDate.set(addYears(focus, -1));
|
|
182
|
+
break;
|
|
183
|
+
case "multi-year":
|
|
184
|
+
this.focusDate.set(addYears(focus, -20));
|
|
185
|
+
break;
|
|
186
|
+
default: this.focusDate.set(addMonths(focus, -1));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
next() {
|
|
190
|
+
const focus = this.focusDate();
|
|
191
|
+
switch (this.activeView()) {
|
|
192
|
+
case "year":
|
|
193
|
+
this.focusDate.set(addYears(focus, 1));
|
|
194
|
+
break;
|
|
195
|
+
case "multi-year":
|
|
196
|
+
this.focusDate.set(addYears(focus, 20));
|
|
197
|
+
break;
|
|
198
|
+
default: this.focusDate.set(addMonths(focus, 1));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
chooseMonth(monthIndex) {
|
|
202
|
+
const next = new Date(this.focusDate().getFullYear(), monthIndex, 1);
|
|
203
|
+
this.focusDate.set(next);
|
|
204
|
+
this.activeView.set("month");
|
|
205
|
+
}
|
|
206
|
+
chooseYear(year) {
|
|
207
|
+
this.focusDate.set(new Date(year, 0, 1));
|
|
208
|
+
this.activeView.set("year");
|
|
209
|
+
}
|
|
210
|
+
focusMonth(monthIndex) {
|
|
211
|
+
const current = this.focusDate();
|
|
212
|
+
this.focusDate.set(new Date(current.getFullYear(), monthIndex, 1));
|
|
213
|
+
}
|
|
214
|
+
focusYear(year) {
|
|
215
|
+
const current = this.focusDate();
|
|
216
|
+
this.focusDate.set(new Date(year, current.getMonth(), 1));
|
|
217
|
+
}
|
|
218
|
+
selectDate(date) {
|
|
219
|
+
if (this.isDisabled() || !this.isDateSelectable(date)) return;
|
|
220
|
+
const next = cloneDate(date);
|
|
221
|
+
this.value.set(next);
|
|
222
|
+
this.focusDate.set(next);
|
|
223
|
+
this.onChangeFn(next);
|
|
224
|
+
this.onTouchedFn();
|
|
225
|
+
}
|
|
226
|
+
onMonthKeydown(event) {
|
|
227
|
+
if (this.isDisabled()) return;
|
|
228
|
+
let next = null;
|
|
229
|
+
switch (event.key) {
|
|
230
|
+
case "ArrowLeft":
|
|
231
|
+
next = addDays(this.focusDate(), -1);
|
|
232
|
+
break;
|
|
233
|
+
case "ArrowRight":
|
|
234
|
+
next = addDays(this.focusDate(), 1);
|
|
235
|
+
break;
|
|
236
|
+
case "ArrowUp":
|
|
237
|
+
next = addDays(this.focusDate(), -7);
|
|
238
|
+
break;
|
|
239
|
+
case "ArrowDown":
|
|
240
|
+
next = addDays(this.focusDate(), 7);
|
|
241
|
+
break;
|
|
242
|
+
case "Home":
|
|
243
|
+
next = startOfWeek(this.focusDate());
|
|
244
|
+
break;
|
|
245
|
+
case "End":
|
|
246
|
+
next = addDays(startOfWeek(this.focusDate()), 6);
|
|
247
|
+
break;
|
|
248
|
+
case "PageUp":
|
|
249
|
+
next = event.shiftKey ? addYears(this.focusDate(), -1) : addMonths(this.focusDate(), -1);
|
|
250
|
+
break;
|
|
251
|
+
case "PageDown":
|
|
252
|
+
next = event.shiftKey ? addYears(this.focusDate(), 1) : addMonths(this.focusDate(), 1);
|
|
253
|
+
break;
|
|
254
|
+
case "Enter":
|
|
255
|
+
case " ":
|
|
256
|
+
event.preventDefault();
|
|
257
|
+
this.selectDate(this.focusDate());
|
|
258
|
+
return;
|
|
259
|
+
default: return;
|
|
260
|
+
}
|
|
261
|
+
event.preventDefault();
|
|
262
|
+
if (next) {
|
|
263
|
+
this.focusDate.set(next);
|
|
264
|
+
afterNextRender({ read: () => this.focusDateCell(next) }, { injector: this.injector });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
onPeriodKeydown(event, columns) {
|
|
268
|
+
if (this.isDisabled()) return;
|
|
269
|
+
const cells = Array.from(event.currentTarget.querySelectorAll("button[role=\"gridcell\"]:not(:disabled)"));
|
|
270
|
+
const currentIndex = cells.indexOf(event.target);
|
|
271
|
+
if (currentIndex < 0) return;
|
|
272
|
+
let targetIndex = currentIndex;
|
|
273
|
+
switch (event.key) {
|
|
274
|
+
case "ArrowLeft":
|
|
275
|
+
targetIndex -= 1;
|
|
276
|
+
break;
|
|
277
|
+
case "ArrowRight":
|
|
278
|
+
targetIndex += 1;
|
|
279
|
+
break;
|
|
280
|
+
case "ArrowUp":
|
|
281
|
+
targetIndex -= columns;
|
|
282
|
+
break;
|
|
283
|
+
case "ArrowDown":
|
|
284
|
+
targetIndex += columns;
|
|
285
|
+
break;
|
|
286
|
+
case "Home":
|
|
287
|
+
targetIndex = 0;
|
|
288
|
+
break;
|
|
289
|
+
case "End":
|
|
290
|
+
targetIndex = cells.length - 1;
|
|
291
|
+
break;
|
|
292
|
+
case "Enter":
|
|
293
|
+
case " ":
|
|
294
|
+
event.preventDefault();
|
|
295
|
+
event.target.click();
|
|
296
|
+
return;
|
|
297
|
+
default: return;
|
|
298
|
+
}
|
|
299
|
+
event.preventDefault();
|
|
300
|
+
cells[Math.max(0, Math.min(cells.length - 1, targetIndex))]?.focus();
|
|
301
|
+
}
|
|
302
|
+
focusActiveCell() {
|
|
303
|
+
const selector = this.activeView() === "month" ? "[data-date][tabindex=\"0\"]" : this.activeView() === "year" ? "[data-month][tabindex=\"0\"]" : "[data-year][tabindex=\"0\"]";
|
|
304
|
+
this.surface().nativeElement.querySelector(selector)?.focus();
|
|
305
|
+
}
|
|
306
|
+
onFocusOut(event) {
|
|
307
|
+
const next = event.relatedTarget;
|
|
308
|
+
if (next instanceof Node && this.surface().nativeElement.contains(next)) return;
|
|
309
|
+
this.onTouchedFn();
|
|
310
|
+
}
|
|
311
|
+
writeValue(value) {
|
|
312
|
+
this.value.set(value ? cloneDate(value) : null);
|
|
313
|
+
}
|
|
314
|
+
registerOnChange(fn) {
|
|
315
|
+
this.onChangeFn = fn;
|
|
316
|
+
}
|
|
317
|
+
registerOnTouched(fn) {
|
|
318
|
+
this.onTouchedFn = fn;
|
|
319
|
+
}
|
|
320
|
+
setDisabledState(state) {
|
|
321
|
+
this.cvaDisabled.set(state);
|
|
322
|
+
}
|
|
323
|
+
buildWeekdayLabels() {
|
|
324
|
+
const start = startOfWeek(new Date(2024, 0, 7));
|
|
325
|
+
return Array.from({ length: 7 }, (_, index) => new Intl.DateTimeFormat(void 0, { weekday: "short" }).format(addDays(start, index)));
|
|
326
|
+
}
|
|
327
|
+
buildMonthCells() {
|
|
328
|
+
const focus = this.focusDate();
|
|
329
|
+
const start = startOfWeek(startOfMonth(focus));
|
|
330
|
+
const selected = this.value();
|
|
331
|
+
const now = /* @__PURE__ */ new Date();
|
|
332
|
+
return Array.from({ length: 42 }, (_, index) => {
|
|
333
|
+
const date = addDays(start, index);
|
|
334
|
+
return {
|
|
335
|
+
date,
|
|
336
|
+
key: formatIsoDate(date),
|
|
337
|
+
inMonth: date.getMonth() === focus.getMonth(),
|
|
338
|
+
disabled: !this.isDateSelectable(date),
|
|
339
|
+
selected: !!selected && sameDay(date, selected),
|
|
340
|
+
today: sameDay(date, now)
|
|
341
|
+
};
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
isDateSelectable(date) {
|
|
345
|
+
return isDateSelectable(date, this.min(), this.max(), this.dateFilter());
|
|
346
|
+
}
|
|
347
|
+
isMonthSelectable(date) {
|
|
348
|
+
return this.hasSelectableDay(startOfMonth(date), new Date(date.getFullYear(), date.getMonth() + 1, 0));
|
|
349
|
+
}
|
|
350
|
+
isYearSelectable(date) {
|
|
351
|
+
return this.hasSelectableDay(new Date(date.getFullYear(), 0, 1), new Date(date.getFullYear(), 11, 31));
|
|
352
|
+
}
|
|
353
|
+
hasSelectableDay(start, end) {
|
|
354
|
+
const last = startOfDay(end).getTime();
|
|
355
|
+
for (let day = startOfDay(start); day.getTime() <= last; day = addDays(day, 1)) if (this.isDateSelectable(day)) return true;
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
focusDateCell(date) {
|
|
359
|
+
const key = formatIsoDate(date);
|
|
360
|
+
this.surface().nativeElement.querySelector(`[data-date="${key}"]`)?.focus();
|
|
361
|
+
}
|
|
362
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
363
|
+
minVersion: "12.0.0",
|
|
364
|
+
version: "22.2.4",
|
|
365
|
+
ngImport: i0,
|
|
366
|
+
type: CalendarComponent,
|
|
367
|
+
deps: [],
|
|
368
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
369
|
+
});
|
|
370
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
371
|
+
minVersion: "17.0.0",
|
|
372
|
+
version: "22.2.4",
|
|
373
|
+
type: CalendarComponent,
|
|
374
|
+
isStandalone: true,
|
|
375
|
+
selector: "Calendar",
|
|
376
|
+
inputs: {
|
|
377
|
+
value: {
|
|
378
|
+
classPropertyName: "value",
|
|
379
|
+
publicName: "value",
|
|
380
|
+
isSignal: true,
|
|
381
|
+
isRequired: false,
|
|
382
|
+
transformFunction: null
|
|
383
|
+
},
|
|
384
|
+
min: {
|
|
385
|
+
classPropertyName: "min",
|
|
386
|
+
publicName: "min",
|
|
387
|
+
isSignal: true,
|
|
388
|
+
isRequired: false,
|
|
389
|
+
transformFunction: null
|
|
390
|
+
},
|
|
391
|
+
max: {
|
|
392
|
+
classPropertyName: "max",
|
|
393
|
+
publicName: "max",
|
|
394
|
+
isSignal: true,
|
|
395
|
+
isRequired: false,
|
|
396
|
+
transformFunction: null
|
|
397
|
+
},
|
|
398
|
+
startAt: {
|
|
399
|
+
classPropertyName: "startAt",
|
|
400
|
+
publicName: "startAt",
|
|
401
|
+
isSignal: true,
|
|
402
|
+
isRequired: false,
|
|
403
|
+
transformFunction: null
|
|
404
|
+
},
|
|
405
|
+
startView: {
|
|
406
|
+
classPropertyName: "startView",
|
|
407
|
+
publicName: "startView",
|
|
408
|
+
isSignal: true,
|
|
409
|
+
isRequired: false,
|
|
410
|
+
transformFunction: null
|
|
411
|
+
},
|
|
412
|
+
dateFilter: {
|
|
413
|
+
classPropertyName: "dateFilter",
|
|
414
|
+
publicName: "dateFilter",
|
|
415
|
+
isSignal: true,
|
|
416
|
+
isRequired: false,
|
|
417
|
+
transformFunction: null
|
|
418
|
+
},
|
|
419
|
+
disabled: {
|
|
420
|
+
classPropertyName: "disabled",
|
|
421
|
+
publicName: "disabled",
|
|
422
|
+
isSignal: true,
|
|
423
|
+
isRequired: false,
|
|
424
|
+
transformFunction: null
|
|
425
|
+
},
|
|
426
|
+
class: {
|
|
427
|
+
classPropertyName: "class",
|
|
428
|
+
publicName: "class",
|
|
429
|
+
isSignal: true,
|
|
430
|
+
isRequired: false,
|
|
431
|
+
transformFunction: null
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
outputs: { value: "valueChange" },
|
|
435
|
+
host: {
|
|
436
|
+
listeners: { "focusout": "onFocusOut($event)" },
|
|
437
|
+
properties: {
|
|
438
|
+
"class": "classes()",
|
|
439
|
+
"attr.aria-disabled": "isDisabled() ? \"true\" : null",
|
|
440
|
+
"attr.inert": "isDisabled() ? \"\" : null"
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
providers: [{
|
|
444
|
+
provide: NG_VALUE_ACCESSOR,
|
|
445
|
+
useExisting: forwardRef(() => CalendarComponent),
|
|
446
|
+
multi: true
|
|
447
|
+
}],
|
|
448
|
+
viewQueries: [{
|
|
449
|
+
propertyName: "surface",
|
|
450
|
+
first: true,
|
|
451
|
+
predicate: ["surface"],
|
|
452
|
+
descendants: true,
|
|
453
|
+
isSignal: true
|
|
454
|
+
}],
|
|
455
|
+
ngImport: i0,
|
|
456
|
+
template: `
|
|
457
|
+
<div #surface class="calendar-surface">
|
|
458
|
+
<div class="calendar-header">
|
|
459
|
+
<button
|
|
460
|
+
type="button"
|
|
461
|
+
class="calendar-nav"
|
|
462
|
+
aria-label="Previous period"
|
|
463
|
+
[disabled]="isDisabled()"
|
|
464
|
+
(click)="previous()"
|
|
465
|
+
>
|
|
466
|
+
<span aria-hidden="true">‹</span>
|
|
467
|
+
</button>
|
|
468
|
+
|
|
469
|
+
<button
|
|
470
|
+
type="button"
|
|
471
|
+
class="calendar-title"
|
|
472
|
+
[disabled]="isDisabled()"
|
|
473
|
+
(click)="toggleView()"
|
|
474
|
+
>
|
|
475
|
+
{{ headerLabel() }}
|
|
476
|
+
</button>
|
|
477
|
+
|
|
478
|
+
<button
|
|
479
|
+
type="button"
|
|
480
|
+
class="calendar-nav"
|
|
481
|
+
aria-label="Next period"
|
|
482
|
+
[disabled]="isDisabled()"
|
|
483
|
+
(click)="next()"
|
|
484
|
+
>
|
|
485
|
+
<span aria-hidden="true">›</span>
|
|
486
|
+
</button>
|
|
487
|
+
</div>
|
|
488
|
+
|
|
489
|
+
@switch (activeView()) {
|
|
490
|
+
@case ('month') {
|
|
491
|
+
<div
|
|
492
|
+
class="calendar-grid calendar-grid-month"
|
|
493
|
+
role="grid"
|
|
494
|
+
tabindex="-1"
|
|
495
|
+
aria-label="Calendar dates"
|
|
496
|
+
(keydown)="onMonthKeydown($event)"
|
|
497
|
+
>
|
|
498
|
+
<div class="calendar-weekdays" role="row">
|
|
499
|
+
@for (label of weekdayLabels(); track label) {
|
|
500
|
+
<span class="calendar-weekday" role="columnheader">{{ label }}</span>
|
|
501
|
+
}
|
|
502
|
+
</div>
|
|
503
|
+
|
|
504
|
+
<div class="calendar-days">
|
|
505
|
+
@for (week of monthWeeks(); track week[0].key) {
|
|
506
|
+
<div class="calendar-week" role="row">
|
|
507
|
+
@for (cell of week; track cell.key) {
|
|
508
|
+
<button
|
|
509
|
+
type="button"
|
|
510
|
+
role="gridcell"
|
|
511
|
+
class="calendar-cell"
|
|
512
|
+
[class.is-outside-month]="!cell.inMonth"
|
|
513
|
+
[class.is-selected]="cell.selected"
|
|
514
|
+
[disabled]="cell.disabled"
|
|
515
|
+
[attr.aria-label]="dateLabel(cell.date)"
|
|
516
|
+
[attr.data-date]="cell.key"
|
|
517
|
+
[attr.aria-selected]="cell.selected"
|
|
518
|
+
[attr.aria-current]="cell.today ? 'date' : null"
|
|
519
|
+
[class.is-today]="cell.today"
|
|
520
|
+
[attr.tabindex]="cell.key === monthTabStopKey() ? 0 : -1"
|
|
521
|
+
(click)="selectDate(cell.date)"
|
|
522
|
+
(focus)="focusDate.set(cloneDate(cell.date))"
|
|
523
|
+
>
|
|
524
|
+
{{ cell.date.getDate() }}
|
|
525
|
+
</button>
|
|
526
|
+
}
|
|
527
|
+
</div>
|
|
528
|
+
}
|
|
529
|
+
</div>
|
|
530
|
+
</div>
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
@case ('year') {
|
|
534
|
+
<div
|
|
535
|
+
class="calendar-grid"
|
|
536
|
+
role="grid"
|
|
537
|
+
tabindex="-1"
|
|
538
|
+
aria-label="Calendar months"
|
|
539
|
+
(keydown)="onPeriodKeydown($event, 3)"
|
|
540
|
+
>
|
|
541
|
+
<div class="calendar-grid-year" role="row">
|
|
542
|
+
@for (month of yearMonths(); track month.key) {
|
|
543
|
+
<button
|
|
544
|
+
type="button"
|
|
545
|
+
role="gridcell"
|
|
546
|
+
class="calendar-cell calendar-month"
|
|
547
|
+
[class.is-selected]="month.selected"
|
|
548
|
+
[disabled]="month.disabled"
|
|
549
|
+
[attr.aria-label]="month.label"
|
|
550
|
+
[attr.aria-selected]="month.selected"
|
|
551
|
+
[attr.data-month]="month.monthIndex"
|
|
552
|
+
[attr.tabindex]="month.monthIndex === yearTabStop() ? 0 : -1"
|
|
553
|
+
(click)="chooseMonth(month.monthIndex)"
|
|
554
|
+
(focus)="focusMonth(month.monthIndex)"
|
|
555
|
+
>
|
|
556
|
+
{{ month.label }}
|
|
557
|
+
</button>
|
|
558
|
+
}
|
|
559
|
+
</div>
|
|
560
|
+
</div>
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
@case ('multi-year') {
|
|
564
|
+
<div
|
|
565
|
+
class="calendar-grid"
|
|
566
|
+
role="grid"
|
|
567
|
+
tabindex="-1"
|
|
568
|
+
aria-label="Calendar years"
|
|
569
|
+
(keydown)="onPeriodKeydown($event, 4)"
|
|
570
|
+
>
|
|
571
|
+
<div class="calendar-grid-years" role="row">
|
|
572
|
+
@for (year of multiYearCells(); track year.key) {
|
|
573
|
+
<button
|
|
574
|
+
type="button"
|
|
575
|
+
role="gridcell"
|
|
576
|
+
class="calendar-cell calendar-year"
|
|
577
|
+
[class.is-selected]="year.selected"
|
|
578
|
+
[disabled]="year.disabled"
|
|
579
|
+
[attr.aria-label]="year.year"
|
|
580
|
+
[attr.aria-selected]="year.selected"
|
|
581
|
+
[attr.data-year]="year.year"
|
|
582
|
+
[attr.tabindex]="year.year === multiYearTabStop() ? 0 : -1"
|
|
583
|
+
(click)="chooseYear(year.year)"
|
|
584
|
+
(focus)="focusYear(year.year)"
|
|
585
|
+
>
|
|
586
|
+
{{ year.year }}
|
|
587
|
+
</button>
|
|
588
|
+
}
|
|
589
|
+
</div>
|
|
590
|
+
</div>
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
</div>
|
|
594
|
+
`,
|
|
595
|
+
isInline: true,
|
|
596
|
+
styles: [":host{display:block;width:fit-content;min-width:calc(var(--spacing-base) * 70);padding:calc(var(--spacing-base) * 3);border:1px solid hsl(var(--border));border-radius:var(--radius);background:hsl(var(--background));color:hsl(var(--foreground));font-family:var(--font-sans);font-size:var(--text-sm)}.calendar-surface{display:grid;gap:calc(var(--spacing-base) * 2);width:100%}.calendar-header{display:grid;grid-template-columns:2.25rem minmax(0,1fr) 2.25rem;align-items:center;gap:var(--spacing-base)}button{border:0;background:transparent;color:inherit;font:inherit}.calendar-nav,.calendar-title,.calendar-cell{display:inline-flex;align-items:center;justify-content:center;border-radius:calc(var(--radius) - .125rem);cursor:pointer;transition:background-color var(--duration-fast) var(--ease-standard),color var(--duration-fast) var(--ease-standard)}.calendar-nav{width:var(--control-height-md);height:var(--control-height-md);color:hsl(var(--muted-foreground));font-size:1.5rem;line-height:1}.calendar-title{min-height:var(--control-height-md);padding:0 calc(var(--spacing-base) * 2);font-weight:600}.calendar-nav:hover:not(:disabled),.calendar-title:hover:not(:disabled),.calendar-cell:hover:not(:disabled){background:hsl(var(--accent));color:hsl(var(--accent-foreground))}.calendar-nav:focus-visible,.calendar-title:focus-visible,.calendar-cell:focus-visible{outline:2px solid hsl(var(--ring));outline-offset:2px}.calendar-nav:disabled,.calendar-title:disabled,.calendar-cell:disabled{cursor:not-allowed;opacity:.45}.calendar-grid-month{display:grid;gap:var(--spacing-base)}.calendar-weekdays,.calendar-week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:calc(var(--spacing-base) * .5)}.calendar-days{display:grid;gap:calc(var(--spacing-base) * .5)}.calendar-weekday{display:grid;place-items:center;min-height:calc(var(--spacing-base) * 7.5);color:hsl(var(--muted-foreground));font-size:.75rem;font-weight:500}.calendar-cell{min-width:var(--control-height-md);min-height:var(--control-height-md);padding:var(--spacing-base)}.calendar-cell.is-outside-month{color:hsl(var(--muted-foreground));opacity:1}.calendar-cell.is-today:not(.is-selected){box-shadow:inset 0 0 0 1px hsl(var(--primary));font-weight:600}.calendar-cell.is-selected{background:hsl(var(--primary));color:hsl(var(--primary-foreground));font-weight:600}.calendar-cell.is-selected:hover:not(:disabled){background:hsl(var(--primary));color:hsl(var(--primary-foreground))}.calendar-grid-year,.calendar-grid-years{display:grid;gap:var(--spacing-base)}.calendar-grid-year{grid-template-columns:repeat(3,minmax(0,1fr))}.calendar-grid-years{grid-template-columns:repeat(4,minmax(0,1fr))}.calendar-month,.calendar-year{min-width:0}\n"]
|
|
597
|
+
});
|
|
598
|
+
};
|
|
599
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
600
|
+
minVersion: "12.0.0",
|
|
601
|
+
version: "22.2.4",
|
|
602
|
+
ngImport: i0,
|
|
603
|
+
type: CalendarComponent,
|
|
604
|
+
decorators: [{
|
|
605
|
+
type: Component,
|
|
606
|
+
args: [{
|
|
607
|
+
selector: "Calendar",
|
|
608
|
+
providers: [{
|
|
609
|
+
provide: NG_VALUE_ACCESSOR,
|
|
610
|
+
useExisting: forwardRef(() => CalendarComponent),
|
|
611
|
+
multi: true
|
|
612
|
+
}],
|
|
613
|
+
host: {
|
|
614
|
+
"[class]": "classes()",
|
|
615
|
+
"[attr.aria-disabled]": "isDisabled() ? \"true\" : null",
|
|
616
|
+
"[attr.inert]": "isDisabled() ? \"\" : null",
|
|
617
|
+
"(focusout)": "onFocusOut($event)"
|
|
618
|
+
},
|
|
619
|
+
template: `
|
|
620
|
+
<div #surface class="calendar-surface">
|
|
621
|
+
<div class="calendar-header">
|
|
622
|
+
<button
|
|
623
|
+
type="button"
|
|
624
|
+
class="calendar-nav"
|
|
625
|
+
aria-label="Previous period"
|
|
626
|
+
[disabled]="isDisabled()"
|
|
627
|
+
(click)="previous()"
|
|
628
|
+
>
|
|
629
|
+
<span aria-hidden="true">‹</span>
|
|
630
|
+
</button>
|
|
631
|
+
|
|
632
|
+
<button
|
|
633
|
+
type="button"
|
|
634
|
+
class="calendar-title"
|
|
635
|
+
[disabled]="isDisabled()"
|
|
636
|
+
(click)="toggleView()"
|
|
637
|
+
>
|
|
638
|
+
{{ headerLabel() }}
|
|
639
|
+
</button>
|
|
640
|
+
|
|
641
|
+
<button
|
|
642
|
+
type="button"
|
|
643
|
+
class="calendar-nav"
|
|
644
|
+
aria-label="Next period"
|
|
645
|
+
[disabled]="isDisabled()"
|
|
646
|
+
(click)="next()"
|
|
647
|
+
>
|
|
648
|
+
<span aria-hidden="true">›</span>
|
|
649
|
+
</button>
|
|
650
|
+
</div>
|
|
651
|
+
|
|
652
|
+
@switch (activeView()) {
|
|
653
|
+
@case ('month') {
|
|
654
|
+
<div
|
|
655
|
+
class="calendar-grid calendar-grid-month"
|
|
656
|
+
role="grid"
|
|
657
|
+
tabindex="-1"
|
|
658
|
+
aria-label="Calendar dates"
|
|
659
|
+
(keydown)="onMonthKeydown($event)"
|
|
660
|
+
>
|
|
661
|
+
<div class="calendar-weekdays" role="row">
|
|
662
|
+
@for (label of weekdayLabels(); track label) {
|
|
663
|
+
<span class="calendar-weekday" role="columnheader">{{ label }}</span>
|
|
664
|
+
}
|
|
665
|
+
</div>
|
|
666
|
+
|
|
667
|
+
<div class="calendar-days">
|
|
668
|
+
@for (week of monthWeeks(); track week[0].key) {
|
|
669
|
+
<div class="calendar-week" role="row">
|
|
670
|
+
@for (cell of week; track cell.key) {
|
|
671
|
+
<button
|
|
672
|
+
type="button"
|
|
673
|
+
role="gridcell"
|
|
674
|
+
class="calendar-cell"
|
|
675
|
+
[class.is-outside-month]="!cell.inMonth"
|
|
676
|
+
[class.is-selected]="cell.selected"
|
|
677
|
+
[disabled]="cell.disabled"
|
|
678
|
+
[attr.aria-label]="dateLabel(cell.date)"
|
|
679
|
+
[attr.data-date]="cell.key"
|
|
680
|
+
[attr.aria-selected]="cell.selected"
|
|
681
|
+
[attr.aria-current]="cell.today ? 'date' : null"
|
|
682
|
+
[class.is-today]="cell.today"
|
|
683
|
+
[attr.tabindex]="cell.key === monthTabStopKey() ? 0 : -1"
|
|
684
|
+
(click)="selectDate(cell.date)"
|
|
685
|
+
(focus)="focusDate.set(cloneDate(cell.date))"
|
|
686
|
+
>
|
|
687
|
+
{{ cell.date.getDate() }}
|
|
688
|
+
</button>
|
|
689
|
+
}
|
|
690
|
+
</div>
|
|
691
|
+
}
|
|
692
|
+
</div>
|
|
693
|
+
</div>
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
@case ('year') {
|
|
697
|
+
<div
|
|
698
|
+
class="calendar-grid"
|
|
699
|
+
role="grid"
|
|
700
|
+
tabindex="-1"
|
|
701
|
+
aria-label="Calendar months"
|
|
702
|
+
(keydown)="onPeriodKeydown($event, 3)"
|
|
703
|
+
>
|
|
704
|
+
<div class="calendar-grid-year" role="row">
|
|
705
|
+
@for (month of yearMonths(); track month.key) {
|
|
706
|
+
<button
|
|
707
|
+
type="button"
|
|
708
|
+
role="gridcell"
|
|
709
|
+
class="calendar-cell calendar-month"
|
|
710
|
+
[class.is-selected]="month.selected"
|
|
711
|
+
[disabled]="month.disabled"
|
|
712
|
+
[attr.aria-label]="month.label"
|
|
713
|
+
[attr.aria-selected]="month.selected"
|
|
714
|
+
[attr.data-month]="month.monthIndex"
|
|
715
|
+
[attr.tabindex]="month.monthIndex === yearTabStop() ? 0 : -1"
|
|
716
|
+
(click)="chooseMonth(month.monthIndex)"
|
|
717
|
+
(focus)="focusMonth(month.monthIndex)"
|
|
718
|
+
>
|
|
719
|
+
{{ month.label }}
|
|
720
|
+
</button>
|
|
721
|
+
}
|
|
722
|
+
</div>
|
|
723
|
+
</div>
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
@case ('multi-year') {
|
|
727
|
+
<div
|
|
728
|
+
class="calendar-grid"
|
|
729
|
+
role="grid"
|
|
730
|
+
tabindex="-1"
|
|
731
|
+
aria-label="Calendar years"
|
|
732
|
+
(keydown)="onPeriodKeydown($event, 4)"
|
|
733
|
+
>
|
|
734
|
+
<div class="calendar-grid-years" role="row">
|
|
735
|
+
@for (year of multiYearCells(); track year.key) {
|
|
736
|
+
<button
|
|
737
|
+
type="button"
|
|
738
|
+
role="gridcell"
|
|
739
|
+
class="calendar-cell calendar-year"
|
|
740
|
+
[class.is-selected]="year.selected"
|
|
741
|
+
[disabled]="year.disabled"
|
|
742
|
+
[attr.aria-label]="year.year"
|
|
743
|
+
[attr.aria-selected]="year.selected"
|
|
744
|
+
[attr.data-year]="year.year"
|
|
745
|
+
[attr.tabindex]="year.year === multiYearTabStop() ? 0 : -1"
|
|
746
|
+
(click)="chooseYear(year.year)"
|
|
747
|
+
(focus)="focusYear(year.year)"
|
|
748
|
+
>
|
|
749
|
+
{{ year.year }}
|
|
750
|
+
</button>
|
|
751
|
+
}
|
|
752
|
+
</div>
|
|
753
|
+
</div>
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
</div>
|
|
757
|
+
`,
|
|
758
|
+
styles: [":host{display:block;width:fit-content;min-width:calc(var(--spacing-base) * 70);padding:calc(var(--spacing-base) * 3);border:1px solid hsl(var(--border));border-radius:var(--radius);background:hsl(var(--background));color:hsl(var(--foreground));font-family:var(--font-sans);font-size:var(--text-sm)}.calendar-surface{display:grid;gap:calc(var(--spacing-base) * 2);width:100%}.calendar-header{display:grid;grid-template-columns:2.25rem minmax(0,1fr) 2.25rem;align-items:center;gap:var(--spacing-base)}button{border:0;background:transparent;color:inherit;font:inherit}.calendar-nav,.calendar-title,.calendar-cell{display:inline-flex;align-items:center;justify-content:center;border-radius:calc(var(--radius) - .125rem);cursor:pointer;transition:background-color var(--duration-fast) var(--ease-standard),color var(--duration-fast) var(--ease-standard)}.calendar-nav{width:var(--control-height-md);height:var(--control-height-md);color:hsl(var(--muted-foreground));font-size:1.5rem;line-height:1}.calendar-title{min-height:var(--control-height-md);padding:0 calc(var(--spacing-base) * 2);font-weight:600}.calendar-nav:hover:not(:disabled),.calendar-title:hover:not(:disabled),.calendar-cell:hover:not(:disabled){background:hsl(var(--accent));color:hsl(var(--accent-foreground))}.calendar-nav:focus-visible,.calendar-title:focus-visible,.calendar-cell:focus-visible{outline:2px solid hsl(var(--ring));outline-offset:2px}.calendar-nav:disabled,.calendar-title:disabled,.calendar-cell:disabled{cursor:not-allowed;opacity:.45}.calendar-grid-month{display:grid;gap:var(--spacing-base)}.calendar-weekdays,.calendar-week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:calc(var(--spacing-base) * .5)}.calendar-days{display:grid;gap:calc(var(--spacing-base) * .5)}.calendar-weekday{display:grid;place-items:center;min-height:calc(var(--spacing-base) * 7.5);color:hsl(var(--muted-foreground));font-size:.75rem;font-weight:500}.calendar-cell{min-width:var(--control-height-md);min-height:var(--control-height-md);padding:var(--spacing-base)}.calendar-cell.is-outside-month{color:hsl(var(--muted-foreground));opacity:1}.calendar-cell.is-today:not(.is-selected){box-shadow:inset 0 0 0 1px hsl(var(--primary));font-weight:600}.calendar-cell.is-selected{background:hsl(var(--primary));color:hsl(var(--primary-foreground));font-weight:600}.calendar-cell.is-selected:hover:not(:disabled){background:hsl(var(--primary));color:hsl(var(--primary-foreground))}.calendar-grid-year,.calendar-grid-years{display:grid;gap:var(--spacing-base)}.calendar-grid-year{grid-template-columns:repeat(3,minmax(0,1fr))}.calendar-grid-years{grid-template-columns:repeat(4,minmax(0,1fr))}.calendar-month,.calendar-year{min-width:0}\n"]
|
|
759
|
+
}]
|
|
760
|
+
}],
|
|
761
|
+
propDecorators: {
|
|
762
|
+
surface: [{
|
|
763
|
+
type: i0.ViewChild,
|
|
764
|
+
args: ["surface", { isSignal: true }]
|
|
765
|
+
}],
|
|
766
|
+
value: [{
|
|
767
|
+
type: i0.Input,
|
|
768
|
+
args: [{
|
|
769
|
+
isSignal: true,
|
|
770
|
+
alias: "value",
|
|
771
|
+
required: false
|
|
772
|
+
}]
|
|
773
|
+
}, {
|
|
774
|
+
type: i0.Output,
|
|
775
|
+
args: ["valueChange"]
|
|
776
|
+
}],
|
|
777
|
+
min: [{
|
|
778
|
+
type: i0.Input,
|
|
779
|
+
args: [{
|
|
780
|
+
isSignal: true,
|
|
781
|
+
alias: "min",
|
|
782
|
+
required: false
|
|
783
|
+
}]
|
|
784
|
+
}],
|
|
785
|
+
max: [{
|
|
786
|
+
type: i0.Input,
|
|
787
|
+
args: [{
|
|
788
|
+
isSignal: true,
|
|
789
|
+
alias: "max",
|
|
790
|
+
required: false
|
|
791
|
+
}]
|
|
792
|
+
}],
|
|
793
|
+
startAt: [{
|
|
794
|
+
type: i0.Input,
|
|
795
|
+
args: [{
|
|
796
|
+
isSignal: true,
|
|
797
|
+
alias: "startAt",
|
|
798
|
+
required: false
|
|
799
|
+
}]
|
|
800
|
+
}],
|
|
801
|
+
startView: [{
|
|
802
|
+
type: i0.Input,
|
|
803
|
+
args: [{
|
|
804
|
+
isSignal: true,
|
|
805
|
+
alias: "startView",
|
|
806
|
+
required: false
|
|
807
|
+
}]
|
|
808
|
+
}],
|
|
809
|
+
dateFilter: [{
|
|
810
|
+
type: i0.Input,
|
|
811
|
+
args: [{
|
|
812
|
+
isSignal: true,
|
|
813
|
+
alias: "dateFilter",
|
|
814
|
+
required: false
|
|
815
|
+
}]
|
|
816
|
+
}],
|
|
817
|
+
disabled: [{
|
|
818
|
+
type: i0.Input,
|
|
819
|
+
args: [{
|
|
820
|
+
isSignal: true,
|
|
821
|
+
alias: "disabled",
|
|
822
|
+
required: false
|
|
823
|
+
}]
|
|
824
|
+
}],
|
|
825
|
+
class: [{
|
|
826
|
+
type: i0.Input,
|
|
827
|
+
args: [{
|
|
828
|
+
isSignal: true,
|
|
829
|
+
alias: "class",
|
|
830
|
+
required: false
|
|
831
|
+
}]
|
|
832
|
+
}]
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
export { CalendarComponent, addDays, addMonths, addYears, cloneDate, endOfMonth, formatIsoDate, isDateSelectable, monthLabel, parseIsoDate, sameDay, startOfDay, startOfMonth, startOfWeek, yearLabel, yearRangeLabel };
|