@ojiepermana/angular 22.1.11 → 22.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -26
- package/chart/README.md +272 -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 +137 -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 +147 -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 +25 -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/ojiepermana-angular-chart-area.mjs +289 -3
- package/fesm2022/ojiepermana-angular-chart-bar.mjs +722 -3
- package/fesm2022/ojiepermana-angular-chart-core.mjs +1482 -3
- package/fesm2022/ojiepermana-angular-chart-line.mjs +294 -3
- package/fesm2022/ojiepermana-angular-chart-pie.mjs +291 -3
- package/fesm2022/ojiepermana-angular-chart-primitives.mjs +1301 -3
- package/fesm2022/ojiepermana-angular-chart-radar.mjs +421 -3
- package/fesm2022/ojiepermana-angular-chart-radial.mjs +295 -3
- package/fesm2022/ojiepermana-angular-chart-scatter.mjs +306 -3
- package/fesm2022/ojiepermana-angular-chart.mjs +12 -3
- package/fesm2022/ojiepermana-angular-component-accordion.mjs +267 -3
- package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-alert.mjs +101 -3
- package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-avatar.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-badge.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +192 -3
- package/fesm2022/ojiepermana-angular-component-button-group.mjs +95 -3
- package/fesm2022/ojiepermana-angular-component-button.mjs +73 -3
- package/fesm2022/ojiepermana-angular-component-calendar.mjs +718 -3
- package/fesm2022/ojiepermana-angular-component-card.mjs +167 -3
- package/fesm2022/ojiepermana-angular-component-carousel.mjs +326 -3
- package/fesm2022/ojiepermana-angular-component-checkbox.mjs +190 -3
- package/fesm2022/ojiepermana-angular-component-collapsible.mjs +117 -3
- package/fesm2022/ojiepermana-angular-component-combobox.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-command.mjs +351 -3
- package/fesm2022/ojiepermana-angular-component-composer.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-context-menu.mjs +158 -3
- package/fesm2022/ojiepermana-angular-component-date-picker.mjs +482 -3
- package/fesm2022/ojiepermana-angular-component-dialog.mjs +400 -3
- package/fesm2022/ojiepermana-angular-component-drawer.mjs +1 -3
- package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +689 -3
- package/fesm2022/ojiepermana-angular-component-editor.mjs +511 -3
- package/fesm2022/ojiepermana-angular-component-empty.mjs +134 -3
- package/fesm2022/ojiepermana-angular-component-form.mjs +438 -3
- package/fesm2022/ojiepermana-angular-component-hover-card.mjs +273 -3
- package/fesm2022/ojiepermana-angular-component-icon.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-input-group.mjs +176 -3
- package/fesm2022/ojiepermana-angular-component-input-otp.mjs +550 -3
- package/fesm2022/ojiepermana-angular-component-input.mjs +52 -3
- package/fesm2022/ojiepermana-angular-component-item.mjs +264 -3
- package/fesm2022/ojiepermana-angular-component-kanban.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-kbd.mjs +48 -3
- package/fesm2022/ojiepermana-angular-component-label.mjs +27 -3
- package/fesm2022/ojiepermana-angular-component-menubar.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-native-select.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +378 -3
- package/fesm2022/ojiepermana-angular-component-pagination.mjs +238 -3
- package/fesm2022/ojiepermana-angular-component-pillbox.mjs +999 -3
- package/fesm2022/ojiepermana-angular-component-popover.mjs +201 -3
- package/fesm2022/ojiepermana-angular-component-progress.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-radio.mjs +180 -3
- package/fesm2022/ojiepermana-angular-component-resizable.mjs +493 -3
- package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +51 -3
- package/fesm2022/ojiepermana-angular-component-segmented-control.mjs +227 -3
- package/fesm2022/ojiepermana-angular-component-select.mjs +609 -3
- package/fesm2022/ojiepermana-angular-component-separator.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-sheet.mjs +407 -3
- package/fesm2022/ojiepermana-angular-component-skeleton.mjs +25 -3
- package/fesm2022/ojiepermana-angular-component-slider.mjs +456 -3
- package/fesm2022/ojiepermana-angular-component-spinner.mjs +56 -3
- package/fesm2022/ojiepermana-angular-component-switch.mjs +145 -3
- package/fesm2022/ojiepermana-angular-component-table.mjs +155 -3
- package/fesm2022/ojiepermana-angular-component-tabs.mjs +315 -3
- package/fesm2022/ojiepermana-angular-component-textarea.mjs +46 -3
- package/fesm2022/ojiepermana-angular-component-timeline.mjs +237 -3
- package/fesm2022/ojiepermana-angular-component-toast.mjs +241 -3
- package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +290 -3
- package/fesm2022/ojiepermana-angular-component-toggle.mjs +76 -3
- package/fesm2022/ojiepermana-angular-component-tooltip.mjs +519 -3
- package/fesm2022/ojiepermana-angular-component-utils-core.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-utils-overlay.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-utils-scale.mjs +34 -3
- package/fesm2022/ojiepermana-angular-component-utils.mjs +3 -2
- package/fesm2022/ojiepermana-angular-component.mjs +4 -4
- package/fesm2022/ojiepermana-angular-navigation-core.mjs +21 -3
- package/fesm2022/ojiepermana-angular-navigation-icon.mjs +20 -3
- package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-CDBxQ8rk.mjs +91 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-DBQHdvGa.mjs +512 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-entry-grid.component-Cd-jh6tg.mjs +623 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-BCGvhoYj.mjs +404 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-Dk_03e-6.mjs +466 -0
- package/fesm2022/ojiepermana-angular-navigation-ojiepermana-angular-navigation-DNKU6viC.mjs +2642 -0
- package/fesm2022/ojiepermana-angular-navigation-service.mjs +725 -3
- package/fesm2022/ojiepermana-angular-navigation-types.mjs +65 -4
- package/fesm2022/ojiepermana-angular-navigation.mjs +4 -10
- package/fesm2022/ojiepermana-angular-sdk.mjs +204 -4
- package/fesm2022/ojiepermana-angular-theme-component-settings.mjs +1387 -3
- package/fesm2022/ojiepermana-angular-theme-layout-services.mjs +331 -3
- package/fesm2022/ojiepermana-angular-theme-layout-types.mjs +45 -4
- package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +1044 -3
- package/fesm2022/ojiepermana-angular-theme-layout.mjs +729 -3
- package/fesm2022/ojiepermana-angular-theme-page-core.mjs +381 -3
- package/fesm2022/ojiepermana-angular-theme-page-filter.mjs +267 -3
- package/fesm2022/ojiepermana-angular-theme-page-root.mjs +361 -3
- package/fesm2022/ojiepermana-angular-theme-page-side.mjs +198 -3
- package/fesm2022/ojiepermana-angular-theme-page-slots.mjs +110 -3
- package/fesm2022/ojiepermana-angular-theme-page.mjs +7 -2
- package/fesm2022/ojiepermana-angular-theme-shell-services.mjs +338 -3
- package/fesm2022/ojiepermana-angular-theme-shell-types.mjs +160 -4
- package/fesm2022/ojiepermana-angular-theme-shell.mjs +811 -3
- package/fesm2022/ojiepermana-angular-theme-styles.mjs +783 -3
- package/fesm2022/ojiepermana-angular-theme.mjs +4 -4
- package/fesm2022/ojiepermana-angular.mjs +6 -11
- package/navigation/README.md +374 -0
- package/package.json +81 -20
- 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 +126 -0
- package/theme/component/settings/README.md +135 -0
- package/theme/layout/README.md +539 -0
- package/theme/page/README.md +453 -0
- package/theme/shell/README.md +340 -0
- package/theme/styles/README.md +178 -0
- package/theme/styles/css/base/components.css +553 -0
- package/theme/styles/css/base/index.css +14 -0
- package/theme/styles/css/base/package.css +9 -0
- package/theme/styles/css/base/prefers-dark.css +86 -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 +165 -0
- package/theme/styles/css/base/theme.css +373 -0
- package/theme/styles/css/base/tokens.css +361 -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/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/ojiepermana-angular-chart-area.d.ts +76 -1
- package/types/ojiepermana-angular-chart-bar.d.ts +201 -1
- package/types/ojiepermana-angular-chart-core.d.ts +811 -1
- package/types/ojiepermana-angular-chart-line.d.ts +75 -1
- package/types/ojiepermana-angular-chart-pie.d.ts +131 -1
- package/types/ojiepermana-angular-chart-primitives.d.ts +291 -1
- package/types/ojiepermana-angular-chart-radar.d.ts +116 -1
- package/types/ojiepermana-angular-chart-radial.d.ts +116 -1
- package/types/ojiepermana-angular-chart-scatter.d.ts +125 -1
- package/types/ojiepermana-angular-chart.d.ts +2 -1
- package/types/ojiepermana-angular-component-accordion.d.ts +85 -1
- package/types/ojiepermana-angular-component-alert-dialog.d.ts +140 -1
- package/types/ojiepermana-angular-component-alert.d.ts +42 -1
- package/types/ojiepermana-angular-component-aspect-ratio.d.ts +12 -1
- package/types/ojiepermana-angular-component-avatar.d.ts +56 -1
- package/types/ojiepermana-angular-component-badge.d.ts +24 -1
- package/types/ojiepermana-angular-component-breadcrumb.d.ts +46 -1
- package/types/ojiepermana-angular-component-button-group.d.ts +26 -1
- package/types/ojiepermana-angular-component-button.d.ts +27 -1
- package/types/ojiepermana-angular-component-calendar.d.ts +111 -1
- package/types/ojiepermana-angular-component-card.d.ts +69 -1
- package/types/ojiepermana-angular-component-carousel.d.ts +86 -1
- package/types/ojiepermana-angular-component-checkbox.d.ts +42 -1
- package/types/ojiepermana-angular-component-collapsible.d.ts +42 -1
- package/types/ojiepermana-angular-component-combobox.d.ts +60 -1
- package/types/ojiepermana-angular-component-command.d.ts +130 -1
- package/types/ojiepermana-angular-component-composer.d.ts +90 -1
- package/types/ojiepermana-angular-component-context-menu.d.ts +54 -1
- package/types/ojiepermana-angular-component-date-picker.d.ts +109 -1
- package/types/ojiepermana-angular-component-dialog.d.ts +136 -1
- package/types/ojiepermana-angular-component-drawer.d.ts +1 -1
- package/types/ojiepermana-angular-component-dropdown-menu.d.ts +248 -1
- package/types/ojiepermana-angular-component-editor.d.ts +135 -1
- package/types/ojiepermana-angular-component-empty.d.ts +50 -1
- package/types/ojiepermana-angular-component-form.d.ts +159 -1
- package/types/ojiepermana-angular-component-hover-card.d.ts +75 -1
- package/types/ojiepermana-angular-component-icon.d.ts +89 -1
- package/types/ojiepermana-angular-component-input-group.d.ts +51 -1
- package/types/ojiepermana-angular-component-input-otp.d.ts +155 -1
- package/types/ojiepermana-angular-component-input.d.ts +21 -1
- package/types/ojiepermana-angular-component-item.d.ts +93 -1
- package/types/ojiepermana-angular-component-kanban.d.ts +70 -1
- package/types/ojiepermana-angular-component-kbd.d.ts +16 -1
- package/types/ojiepermana-angular-component-label.d.ts +11 -1
- package/types/ojiepermana-angular-component-menubar.d.ts +93 -1
- package/types/ojiepermana-angular-component-native-select.d.ts +26 -1
- package/types/ojiepermana-angular-component-navigation-menu.d.ts +104 -1
- package/types/ojiepermana-angular-component-pagination.d.ts +33 -1
- package/types/ojiepermana-angular-component-pillbox.d.ts +222 -1
- package/types/ojiepermana-angular-component-popover.d.ts +66 -1
- package/types/ojiepermana-angular-component-progress.d.ts +17 -1
- package/types/ojiepermana-angular-component-radio.d.ts +60 -1
- package/types/ojiepermana-angular-component-resizable.d.ts +117 -1
- package/types/ojiepermana-angular-component-scroll-area.d.ts +19 -1
- package/types/ojiepermana-angular-component-segmented-control.d.ts +58 -1
- package/types/ojiepermana-angular-component-select.d.ts +122 -1
- package/types/ojiepermana-angular-component-separator.d.ts +14 -1
- package/types/ojiepermana-angular-component-sheet.d.ts +130 -1
- package/types/ojiepermana-angular-component-skeleton.d.ts +10 -1
- package/types/ojiepermana-angular-component-slider.d.ts +83 -1
- package/types/ojiepermana-angular-component-spinner.d.ts +13 -1
- package/types/ojiepermana-angular-component-switch.d.ts +44 -1
- package/types/ojiepermana-angular-component-table.d.ts +57 -1
- package/types/ojiepermana-angular-component-tabs.d.ts +124 -1
- package/types/ojiepermana-angular-component-textarea.d.ts +17 -1
- package/types/ojiepermana-angular-component-timeline.d.ts +64 -1
- package/types/ojiepermana-angular-component-toast.d.ts +64 -1
- package/types/ojiepermana-angular-component-toggle-group.d.ts +90 -1
- package/types/ojiepermana-angular-component-toggle.d.ts +25 -1
- package/types/ojiepermana-angular-component-tooltip.d.ts +143 -1
- package/types/ojiepermana-angular-component-utils-core.d.ts +184 -1
- package/types/ojiepermana-angular-component-utils-overlay.d.ts +21 -1
- package/types/ojiepermana-angular-component-utils-scale.d.ts +19 -1
- package/types/ojiepermana-angular-component-utils.d.ts +2 -1
- package/types/ojiepermana-angular-component.d.ts +2 -1
- package/types/ojiepermana-angular-navigation-core.d.ts +59 -1
- package/types/ojiepermana-angular-navigation-icon.d.ts +12 -1
- package/types/ojiepermana-angular-navigation-service.d.ts +116 -1
- package/types/ojiepermana-angular-navigation-types.d.ts +144 -1
- package/types/ojiepermana-angular-navigation.d.ts +507 -1
- package/types/ojiepermana-angular-sdk.d.ts +89 -1
- package/types/ojiepermana-angular-theme-component-settings.d.ts +154 -1
- package/types/ojiepermana-angular-theme-layout-services.d.ts +147 -1
- package/types/ojiepermana-angular-theme-layout-types.d.ts +40 -1
- package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +299 -1
- package/types/ojiepermana-angular-theme-layout.d.ts +129 -1
- package/types/ojiepermana-angular-theme-page-core.d.ts +157 -1
- package/types/ojiepermana-angular-theme-page-filter.d.ts +77 -1
- package/types/ojiepermana-angular-theme-page-root.d.ts +88 -1
- package/types/ojiepermana-angular-theme-page-side.d.ts +50 -1
- package/types/ojiepermana-angular-theme-page-slots.d.ts +40 -1
- package/types/ojiepermana-angular-theme-page.d.ts +5 -1
- package/types/ojiepermana-angular-theme-shell-services.d.ts +193 -1
- package/types/ojiepermana-angular-theme-shell-types.d.ts +105 -1
- package/types/ojiepermana-angular-theme-shell.d.ts +100 -1
- package/types/ojiepermana-angular-theme-styles.d.ts +319 -1
- package/types/ojiepermana-angular-theme.d.ts +2 -1
- package/types/ojiepermana-angular.d.ts +5 -5
|
@@ -1,7 +1,722 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injector, viewChild, model, input, booleanAttribute, signal, linkedSignal, computed, afterNextRender, forwardRef, Component } from '@angular/core';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import { cn } from '@ojiepermana/angular/component/utils/core';
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
function cloneDate(date) {
|
|
7
|
+
return new Date(date.getTime());
|
|
8
|
+
}
|
|
9
|
+
function sameDay(left, right) {
|
|
10
|
+
return (left.getFullYear() === right.getFullYear() &&
|
|
11
|
+
left.getMonth() === right.getMonth() &&
|
|
12
|
+
left.getDate() === right.getDate());
|
|
13
|
+
}
|
|
14
|
+
function startOfDay(date) {
|
|
15
|
+
const next = cloneDate(date);
|
|
16
|
+
next.setHours(0, 0, 0, 0);
|
|
17
|
+
return next;
|
|
18
|
+
}
|
|
19
|
+
function startOfMonth(date) {
|
|
20
|
+
const next = startOfDay(date);
|
|
21
|
+
next.setDate(1);
|
|
22
|
+
return next;
|
|
23
|
+
}
|
|
24
|
+
function endOfMonth(date) {
|
|
25
|
+
const next = startOfMonth(date);
|
|
26
|
+
next.setMonth(next.getMonth() + 1);
|
|
27
|
+
next.setDate(0);
|
|
28
|
+
return next;
|
|
29
|
+
}
|
|
30
|
+
function startOfWeek(date) {
|
|
31
|
+
const next = startOfDay(date);
|
|
32
|
+
next.setDate(next.getDate() - next.getDay());
|
|
33
|
+
return next;
|
|
34
|
+
}
|
|
35
|
+
function addDays(date, amount) {
|
|
36
|
+
const next = cloneDate(date);
|
|
37
|
+
next.setDate(next.getDate() + amount);
|
|
38
|
+
return next;
|
|
39
|
+
}
|
|
40
|
+
function addMonths(date, amount) {
|
|
41
|
+
const next = cloneDate(date);
|
|
42
|
+
next.setDate(1);
|
|
43
|
+
next.setMonth(next.getMonth() + amount);
|
|
44
|
+
return next;
|
|
45
|
+
}
|
|
46
|
+
function addYears(date, amount) {
|
|
47
|
+
const next = cloneDate(date);
|
|
48
|
+
next.setFullYear(next.getFullYear() + amount);
|
|
49
|
+
return next;
|
|
50
|
+
}
|
|
51
|
+
function isDateSelectable(date, min, max, filter) {
|
|
52
|
+
const time = startOfDay(date).getTime();
|
|
53
|
+
if (min && time < startOfDay(min).getTime()) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (max && time > startOfDay(max).getTime()) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return filter ? filter(date) : true;
|
|
60
|
+
}
|
|
61
|
+
function formatIsoDate(date) {
|
|
62
|
+
const year = date.getFullYear();
|
|
63
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
64
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
65
|
+
return `${year}-${month}-${day}`;
|
|
66
|
+
}
|
|
67
|
+
function parseIsoDate(text) {
|
|
68
|
+
const match = text.trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
69
|
+
if (!match) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
const year = Number(match[1]);
|
|
73
|
+
const month = Number(match[2]) - 1;
|
|
74
|
+
const day = Number(match[3]);
|
|
75
|
+
const date = new Date(year, month, day);
|
|
76
|
+
return date.getFullYear() === year && date.getMonth() === month && date.getDate() === day
|
|
77
|
+
? date
|
|
78
|
+
: null;
|
|
79
|
+
}
|
|
80
|
+
function monthLabel(date) {
|
|
81
|
+
return new Intl.DateTimeFormat(undefined, { month: 'long', year: 'numeric' }).format(date);
|
|
82
|
+
}
|
|
83
|
+
function yearLabel(date) {
|
|
84
|
+
return String(date.getFullYear());
|
|
85
|
+
}
|
|
86
|
+
function yearRangeLabel(startYear, count) {
|
|
87
|
+
return `${startYear} - ${startYear + count - 1}`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
class CalendarComponent {
|
|
91
|
+
injector = inject(Injector);
|
|
92
|
+
surface = viewChild.required('surface', /* @ts-ignore */
|
|
93
|
+
...(ngDevMode ? [{ debugName: "surface" }] : /* istanbul ignore next */ []));
|
|
94
|
+
value = model(null, /* @ts-ignore */
|
|
95
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
96
|
+
min = input(null, /* @ts-ignore */
|
|
97
|
+
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
98
|
+
max = input(null, /* @ts-ignore */
|
|
99
|
+
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
100
|
+
startAt = input(null, /* @ts-ignore */
|
|
101
|
+
...(ngDevMode ? [{ debugName: "startAt" }] : /* istanbul ignore next */ []));
|
|
102
|
+
startView = input('month', /* @ts-ignore */
|
|
103
|
+
...(ngDevMode ? [{ debugName: "startView" }] : /* istanbul ignore next */ []));
|
|
104
|
+
dateFilter = input(null, /* @ts-ignore */
|
|
105
|
+
...(ngDevMode ? [{ debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
106
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
107
|
+
class = input('', /* @ts-ignore */
|
|
108
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
109
|
+
cvaDisabled = signal(false, /* @ts-ignore */
|
|
110
|
+
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
111
|
+
onChangeFn = () => { };
|
|
112
|
+
onTouchedFn = () => { };
|
|
113
|
+
focusDate = linkedSignal(() => cloneDate(this.value() ?? this.startAt() ?? new Date()), /* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "focusDate" }] : /* istanbul ignore next */ []));
|
|
115
|
+
activeView = linkedSignal(() => this.startView(), /* @ts-ignore */
|
|
116
|
+
...(ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []));
|
|
117
|
+
classes = computed(() => cn('calendar block w-fit', this.class()), /* @ts-ignore */
|
|
118
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
119
|
+
isDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
|
|
120
|
+
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
121
|
+
sameDay = sameDay;
|
|
122
|
+
cloneDate = cloneDate;
|
|
123
|
+
weekdayLabels = computed(() => this.buildWeekdayLabels(), /* @ts-ignore */
|
|
124
|
+
...(ngDevMode ? [{ debugName: "weekdayLabels" }] : /* istanbul ignore next */ []));
|
|
125
|
+
monthCells = computed(() => this.buildMonthCells(), /* @ts-ignore */
|
|
126
|
+
...(ngDevMode ? [{ debugName: "monthCells" }] : /* istanbul ignore next */ []));
|
|
127
|
+
monthTabStopKey = computed(() => {
|
|
128
|
+
const cells = this.monthCells();
|
|
129
|
+
const focused = cells.find((cell) => sameDay(cell.date, this.focusDate()) && !cell.disabled);
|
|
130
|
+
return focused?.key ?? cells.find((cell) => !cell.disabled)?.key ?? null;
|
|
131
|
+
}, /* @ts-ignore */
|
|
132
|
+
...(ngDevMode ? [{ debugName: "monthTabStopKey" }] : /* istanbul ignore next */ []));
|
|
133
|
+
monthWeeks = computed(() => {
|
|
134
|
+
const cells = this.monthCells();
|
|
135
|
+
return Array.from({ length: cells.length / 7 }, (_, index) => cells.slice(index * 7, index * 7 + 7));
|
|
136
|
+
}, /* @ts-ignore */
|
|
137
|
+
...(ngDevMode ? [{ debugName: "monthWeeks" }] : /* istanbul ignore next */ []));
|
|
138
|
+
yearTabStop = computed(() => {
|
|
139
|
+
const months = this.yearMonths();
|
|
140
|
+
const focusedMonth = this.focusDate().getMonth();
|
|
141
|
+
return (months.find((month) => month.monthIndex === focusedMonth && !month.disabled)?.monthIndex ??
|
|
142
|
+
months.find((month) => !month.disabled)?.monthIndex ??
|
|
143
|
+
-1);
|
|
144
|
+
}, /* @ts-ignore */
|
|
145
|
+
...(ngDevMode ? [{ debugName: "yearTabStop" }] : /* istanbul ignore next */ []));
|
|
146
|
+
multiYearTabStop = computed(() => {
|
|
147
|
+
const years = this.multiYearCells();
|
|
148
|
+
const focusedYear = this.focusDate().getFullYear();
|
|
149
|
+
return (years.find((year) => year.year === focusedYear && !year.disabled)?.year ??
|
|
150
|
+
years.find((year) => !year.disabled)?.year ??
|
|
151
|
+
-1);
|
|
152
|
+
}, /* @ts-ignore */
|
|
153
|
+
...(ngDevMode ? [{ debugName: "multiYearTabStop" }] : /* istanbul ignore next */ []));
|
|
154
|
+
dateLabel = (date) => new Intl.DateTimeFormat(undefined, { dateStyle: 'long' }).format(date);
|
|
155
|
+
headerLabel = computed(() => {
|
|
156
|
+
const focus = this.focusDate();
|
|
157
|
+
switch (this.activeView()) {
|
|
158
|
+
case 'year':
|
|
159
|
+
return String(focus.getFullYear());
|
|
160
|
+
case 'multi-year':
|
|
161
|
+
return yearRangeLabel(Math.floor(focus.getFullYear() / 20) * 20, 20);
|
|
162
|
+
default:
|
|
163
|
+
return monthLabel(focus);
|
|
164
|
+
}
|
|
165
|
+
}, /* @ts-ignore */
|
|
166
|
+
...(ngDevMode ? [{ debugName: "headerLabel" }] : /* istanbul ignore next */ []));
|
|
167
|
+
yearMonths() {
|
|
168
|
+
const focus = this.focusDate();
|
|
169
|
+
const selectedMonth = this.value()?.getMonth() ?? focus.getMonth();
|
|
170
|
+
const selectedYear = this.value()?.getFullYear() ?? focus.getFullYear();
|
|
171
|
+
return Array.from({ length: 12 }, (_, monthIndex) => {
|
|
172
|
+
const candidate = new Date(focus.getFullYear(), monthIndex, 1);
|
|
173
|
+
return {
|
|
174
|
+
key: `${candidate.getFullYear()}-${monthIndex}`,
|
|
175
|
+
label: new Intl.DateTimeFormat(undefined, { month: 'short' }).format(candidate),
|
|
176
|
+
monthIndex,
|
|
177
|
+
selected: monthIndex === selectedMonth && focus.getFullYear() === selectedYear,
|
|
178
|
+
disabled: !this.isMonthSelectable(candidate),
|
|
179
|
+
};
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
multiYearCells() {
|
|
183
|
+
const focusYear = this.focusDate().getFullYear();
|
|
184
|
+
const baseYear = Math.floor(focusYear / 20) * 20;
|
|
185
|
+
const selectedYear = this.value()?.getFullYear() ?? focusYear;
|
|
186
|
+
return Array.from({ length: 20 }, (_, index) => {
|
|
187
|
+
const year = baseYear + index;
|
|
188
|
+
const candidate = new Date(year, 0, 1);
|
|
189
|
+
return {
|
|
190
|
+
key: String(year),
|
|
191
|
+
year,
|
|
192
|
+
selected: year === selectedYear,
|
|
193
|
+
disabled: !this.isYearSelectable(candidate),
|
|
194
|
+
};
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
toggleView() {
|
|
198
|
+
switch (this.activeView()) {
|
|
199
|
+
case 'month':
|
|
200
|
+
this.activeView.set('year');
|
|
201
|
+
break;
|
|
202
|
+
case 'year':
|
|
203
|
+
this.activeView.set('multi-year');
|
|
204
|
+
break;
|
|
205
|
+
default:
|
|
206
|
+
this.activeView.set('multi-year');
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
previous() {
|
|
211
|
+
const focus = this.focusDate();
|
|
212
|
+
switch (this.activeView()) {
|
|
213
|
+
case 'year':
|
|
214
|
+
this.focusDate.set(addYears(focus, -1));
|
|
215
|
+
break;
|
|
216
|
+
case 'multi-year':
|
|
217
|
+
this.focusDate.set(addYears(focus, -20));
|
|
218
|
+
break;
|
|
219
|
+
default:
|
|
220
|
+
this.focusDate.set(addMonths(focus, -1));
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
next() {
|
|
225
|
+
const focus = this.focusDate();
|
|
226
|
+
switch (this.activeView()) {
|
|
227
|
+
case 'year':
|
|
228
|
+
this.focusDate.set(addYears(focus, 1));
|
|
229
|
+
break;
|
|
230
|
+
case 'multi-year':
|
|
231
|
+
this.focusDate.set(addYears(focus, 20));
|
|
232
|
+
break;
|
|
233
|
+
default:
|
|
234
|
+
this.focusDate.set(addMonths(focus, 1));
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
chooseMonth(monthIndex) {
|
|
239
|
+
const next = new Date(this.focusDate().getFullYear(), monthIndex, 1);
|
|
240
|
+
this.focusDate.set(next);
|
|
241
|
+
this.activeView.set('month');
|
|
242
|
+
}
|
|
243
|
+
chooseYear(year) {
|
|
244
|
+
this.focusDate.set(new Date(year, 0, 1));
|
|
245
|
+
this.activeView.set('year');
|
|
246
|
+
}
|
|
247
|
+
focusMonth(monthIndex) {
|
|
248
|
+
const current = this.focusDate();
|
|
249
|
+
this.focusDate.set(new Date(current.getFullYear(), monthIndex, 1));
|
|
250
|
+
}
|
|
251
|
+
focusYear(year) {
|
|
252
|
+
const current = this.focusDate();
|
|
253
|
+
this.focusDate.set(new Date(year, current.getMonth(), 1));
|
|
254
|
+
}
|
|
255
|
+
selectDate(date) {
|
|
256
|
+
if (this.isDisabled() || !this.isDateSelectable(date)) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const next = cloneDate(date);
|
|
260
|
+
this.value.set(next);
|
|
261
|
+
this.focusDate.set(next);
|
|
262
|
+
this.onChangeFn(next);
|
|
263
|
+
this.onTouchedFn();
|
|
264
|
+
}
|
|
265
|
+
onMonthKeydown(event) {
|
|
266
|
+
if (this.isDisabled()) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
let next = null;
|
|
270
|
+
switch (event.key) {
|
|
271
|
+
case 'ArrowLeft':
|
|
272
|
+
next = addDays(this.focusDate(), -1);
|
|
273
|
+
break;
|
|
274
|
+
case 'ArrowRight':
|
|
275
|
+
next = addDays(this.focusDate(), 1);
|
|
276
|
+
break;
|
|
277
|
+
case 'ArrowUp':
|
|
278
|
+
next = addDays(this.focusDate(), -7);
|
|
279
|
+
break;
|
|
280
|
+
case 'ArrowDown':
|
|
281
|
+
next = addDays(this.focusDate(), 7);
|
|
282
|
+
break;
|
|
283
|
+
case 'Home':
|
|
284
|
+
next = startOfWeek(this.focusDate());
|
|
285
|
+
break;
|
|
286
|
+
case 'End':
|
|
287
|
+
next = addDays(startOfWeek(this.focusDate()), 6);
|
|
288
|
+
break;
|
|
289
|
+
case 'PageUp':
|
|
290
|
+
next = event.shiftKey ? addYears(this.focusDate(), -1) : addMonths(this.focusDate(), -1);
|
|
291
|
+
break;
|
|
292
|
+
case 'PageDown':
|
|
293
|
+
next = event.shiftKey ? addYears(this.focusDate(), 1) : addMonths(this.focusDate(), 1);
|
|
294
|
+
break;
|
|
295
|
+
case 'Enter':
|
|
296
|
+
case ' ': {
|
|
297
|
+
event.preventDefault();
|
|
298
|
+
this.selectDate(this.focusDate());
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
default:
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
event.preventDefault();
|
|
305
|
+
if (next) {
|
|
306
|
+
this.focusDate.set(next);
|
|
307
|
+
afterNextRender({ read: () => this.focusDateCell(next) }, { injector: this.injector });
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
onPeriodKeydown(event, columns) {
|
|
311
|
+
if (this.isDisabled()) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const cells = Array.from(event.currentTarget.querySelectorAll('button[role="gridcell"]:not(:disabled)'));
|
|
315
|
+
const currentIndex = cells.indexOf(event.target);
|
|
316
|
+
if (currentIndex < 0) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
let targetIndex = currentIndex;
|
|
320
|
+
switch (event.key) {
|
|
321
|
+
case 'ArrowLeft':
|
|
322
|
+
targetIndex -= 1;
|
|
323
|
+
break;
|
|
324
|
+
case 'ArrowRight':
|
|
325
|
+
targetIndex += 1;
|
|
326
|
+
break;
|
|
327
|
+
case 'ArrowUp':
|
|
328
|
+
targetIndex -= columns;
|
|
329
|
+
break;
|
|
330
|
+
case 'ArrowDown':
|
|
331
|
+
targetIndex += columns;
|
|
332
|
+
break;
|
|
333
|
+
case 'Home':
|
|
334
|
+
targetIndex = 0;
|
|
335
|
+
break;
|
|
336
|
+
case 'End':
|
|
337
|
+
targetIndex = cells.length - 1;
|
|
338
|
+
break;
|
|
339
|
+
case 'Enter':
|
|
340
|
+
case ' ':
|
|
341
|
+
event.preventDefault();
|
|
342
|
+
event.target.click();
|
|
343
|
+
return;
|
|
344
|
+
default:
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
event.preventDefault();
|
|
348
|
+
cells[Math.max(0, Math.min(cells.length - 1, targetIndex))]?.focus();
|
|
349
|
+
}
|
|
350
|
+
/** Focus the current roving-tab-stop cell after an enclosing popup opens. */
|
|
351
|
+
focusActiveCell() {
|
|
352
|
+
const selector = this.activeView() === 'month'
|
|
353
|
+
? '[data-date][tabindex="0"]'
|
|
354
|
+
: this.activeView() === 'year'
|
|
355
|
+
? '[data-month][tabindex="0"]'
|
|
356
|
+
: '[data-year][tabindex="0"]';
|
|
357
|
+
this.surface().nativeElement.querySelector(selector)?.focus();
|
|
358
|
+
}
|
|
359
|
+
writeValue(value) {
|
|
360
|
+
this.value.set(value ? cloneDate(value) : null);
|
|
361
|
+
}
|
|
362
|
+
registerOnChange(fn) {
|
|
363
|
+
this.onChangeFn = fn;
|
|
364
|
+
}
|
|
365
|
+
registerOnTouched(fn) {
|
|
366
|
+
this.onTouchedFn = fn;
|
|
367
|
+
}
|
|
368
|
+
setDisabledState(state) {
|
|
369
|
+
this.cvaDisabled.set(state);
|
|
370
|
+
}
|
|
371
|
+
buildWeekdayLabels() {
|
|
372
|
+
const start = startOfWeek(new Date(2024, 0, 7));
|
|
373
|
+
return Array.from({ length: 7 }, (_, index) => new Intl.DateTimeFormat(undefined, { weekday: 'short' }).format(addDays(start, index)));
|
|
374
|
+
}
|
|
375
|
+
buildMonthCells() {
|
|
376
|
+
const focus = this.focusDate();
|
|
377
|
+
const monthStart = startOfMonth(focus);
|
|
378
|
+
const start = startOfWeek(monthStart);
|
|
379
|
+
const selected = this.value();
|
|
380
|
+
const now = new Date();
|
|
381
|
+
return Array.from({ length: 42 }, (_, index) => {
|
|
382
|
+
const date = addDays(start, index);
|
|
383
|
+
return {
|
|
384
|
+
date,
|
|
385
|
+
key: formatIsoDate(date),
|
|
386
|
+
inMonth: date.getMonth() === focus.getMonth(),
|
|
387
|
+
disabled: !this.isDateSelectable(date),
|
|
388
|
+
selected: !!selected && sameDay(date, selected),
|
|
389
|
+
today: sameDay(date, now),
|
|
390
|
+
};
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
isDateSelectable(date) {
|
|
394
|
+
return isDateSelectable(date, this.min(), this.max(), this.dateFilter());
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* A period is selectable when it HOLDS a selectable day.
|
|
398
|
+
*
|
|
399
|
+
* Testing only the first and last day answered a different question, and got
|
|
400
|
+
* the middle wrong: a window like 10 to 20 January excludes both ends, so
|
|
401
|
+
* January came back disabled even though eleven of its days are open. Any
|
|
402
|
+
* `dateFilter` narrower than the edges hit the same wall. Walking the days is
|
|
403
|
+
* cheap -- at most 31 here, 366 for a year -- and it stops at the first hit,
|
|
404
|
+
* which for an unconstrained calendar is the very first day.
|
|
405
|
+
*/
|
|
406
|
+
isMonthSelectable(date) {
|
|
407
|
+
return this.hasSelectableDay(startOfMonth(date), new Date(date.getFullYear(), date.getMonth() + 1, 0));
|
|
408
|
+
}
|
|
409
|
+
isYearSelectable(date) {
|
|
410
|
+
return this.hasSelectableDay(new Date(date.getFullYear(), 0, 1), new Date(date.getFullYear(), 11, 31));
|
|
411
|
+
}
|
|
412
|
+
hasSelectableDay(start, end) {
|
|
413
|
+
const last = startOfDay(end).getTime();
|
|
414
|
+
for (let day = startOfDay(start); day.getTime() <= last; day = addDays(day, 1)) {
|
|
415
|
+
if (this.isDateSelectable(day)) {
|
|
416
|
+
return true;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
focusDateCell(date) {
|
|
422
|
+
const key = formatIsoDate(date);
|
|
423
|
+
const target = this.surface().nativeElement.querySelector(`[data-date="${key}"]`);
|
|
424
|
+
target?.focus();
|
|
425
|
+
}
|
|
426
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
427
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: CalendarComponent, isStandalone: true, selector: "Calendar", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, startAt: { classPropertyName: "startAt", publicName: "startAt", isSignal: true, isRequired: false, transformFunction: null }, startView: { classPropertyName: "startView", publicName: "startView", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()", "attr.aria-disabled": "isDisabled() ? \"true\" : null", "attr.inert": "isDisabled() ? \"\" : null" } }, providers: [
|
|
428
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CalendarComponent), multi: true },
|
|
429
|
+
], viewQueries: [{ propertyName: "surface", first: true, predicate: ["surface"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
430
|
+
<div #surface class="calendar-surface">
|
|
431
|
+
<div class="calendar-header">
|
|
432
|
+
<button
|
|
433
|
+
type="button"
|
|
434
|
+
class="calendar-nav"
|
|
435
|
+
aria-label="Previous period"
|
|
436
|
+
[disabled]="isDisabled()"
|
|
437
|
+
(click)="previous()"
|
|
438
|
+
>
|
|
439
|
+
<span aria-hidden="true">‹</span>
|
|
440
|
+
</button>
|
|
441
|
+
|
|
442
|
+
<button
|
|
443
|
+
type="button"
|
|
444
|
+
class="calendar-title"
|
|
445
|
+
[disabled]="isDisabled()"
|
|
446
|
+
(click)="toggleView()"
|
|
447
|
+
>
|
|
448
|
+
{{ headerLabel() }}
|
|
449
|
+
</button>
|
|
450
|
+
|
|
451
|
+
<button
|
|
452
|
+
type="button"
|
|
453
|
+
class="calendar-nav"
|
|
454
|
+
aria-label="Next period"
|
|
455
|
+
[disabled]="isDisabled()"
|
|
456
|
+
(click)="next()"
|
|
457
|
+
>
|
|
458
|
+
<span aria-hidden="true">›</span>
|
|
459
|
+
</button>
|
|
460
|
+
</div>
|
|
461
|
+
|
|
462
|
+
@switch (activeView()) {
|
|
463
|
+
@case ('month') {
|
|
464
|
+
<div
|
|
465
|
+
class="calendar-grid calendar-grid-month"
|
|
466
|
+
role="grid"
|
|
467
|
+
tabindex="-1"
|
|
468
|
+
aria-label="Calendar dates"
|
|
469
|
+
(keydown)="onMonthKeydown($event)"
|
|
470
|
+
>
|
|
471
|
+
<div class="calendar-weekdays" role="row">
|
|
472
|
+
@for (label of weekdayLabels(); track label) {
|
|
473
|
+
<span class="calendar-weekday" role="columnheader">{{ label }}</span>
|
|
474
|
+
}
|
|
475
|
+
</div>
|
|
476
|
+
|
|
477
|
+
<div class="calendar-days">
|
|
478
|
+
@for (week of monthWeeks(); track week[0].key) {
|
|
479
|
+
<div class="calendar-week" role="row">
|
|
480
|
+
@for (cell of week; track cell.key) {
|
|
481
|
+
<button
|
|
482
|
+
type="button"
|
|
483
|
+
role="gridcell"
|
|
484
|
+
class="calendar-cell"
|
|
485
|
+
[class.is-outside-month]="!cell.inMonth"
|
|
486
|
+
[class.is-selected]="cell.selected"
|
|
487
|
+
[disabled]="cell.disabled"
|
|
488
|
+
[attr.aria-label]="dateLabel(cell.date)"
|
|
489
|
+
[attr.data-date]="cell.key"
|
|
490
|
+
[attr.aria-selected]="cell.selected"
|
|
491
|
+
[attr.aria-current]="cell.today ? 'date' : null"
|
|
492
|
+
[class.is-today]="cell.today"
|
|
493
|
+
[attr.tabindex]="cell.key === monthTabStopKey() ? 0 : -1"
|
|
494
|
+
(click)="selectDate(cell.date)"
|
|
495
|
+
(focus)="focusDate.set(cloneDate(cell.date))"
|
|
496
|
+
>
|
|
497
|
+
{{ cell.date.getDate() }}
|
|
498
|
+
</button>
|
|
499
|
+
}
|
|
500
|
+
</div>
|
|
501
|
+
}
|
|
502
|
+
</div>
|
|
503
|
+
</div>
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
@case ('year') {
|
|
507
|
+
<div
|
|
508
|
+
class="calendar-grid"
|
|
509
|
+
role="grid"
|
|
510
|
+
tabindex="-1"
|
|
511
|
+
aria-label="Calendar months"
|
|
512
|
+
(keydown)="onPeriodKeydown($event, 3)"
|
|
513
|
+
>
|
|
514
|
+
<div class="calendar-grid-year" role="row">
|
|
515
|
+
@for (month of yearMonths(); track month.key) {
|
|
516
|
+
<button
|
|
517
|
+
type="button"
|
|
518
|
+
role="gridcell"
|
|
519
|
+
class="calendar-cell calendar-month"
|
|
520
|
+
[class.is-selected]="month.selected"
|
|
521
|
+
[disabled]="month.disabled"
|
|
522
|
+
[attr.aria-label]="month.label"
|
|
523
|
+
[attr.aria-selected]="month.selected"
|
|
524
|
+
[attr.data-month]="month.monthIndex"
|
|
525
|
+
[attr.tabindex]="month.monthIndex === yearTabStop() ? 0 : -1"
|
|
526
|
+
(click)="chooseMonth(month.monthIndex)"
|
|
527
|
+
(focus)="focusMonth(month.monthIndex)"
|
|
528
|
+
>
|
|
529
|
+
{{ month.label }}
|
|
530
|
+
</button>
|
|
531
|
+
}
|
|
532
|
+
</div>
|
|
533
|
+
</div>
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
@case ('multi-year') {
|
|
537
|
+
<div
|
|
538
|
+
class="calendar-grid"
|
|
539
|
+
role="grid"
|
|
540
|
+
tabindex="-1"
|
|
541
|
+
aria-label="Calendar years"
|
|
542
|
+
(keydown)="onPeriodKeydown($event, 4)"
|
|
543
|
+
>
|
|
544
|
+
<div class="calendar-grid-years" role="row">
|
|
545
|
+
@for (year of multiYearCells(); track year.key) {
|
|
546
|
+
<button
|
|
547
|
+
type="button"
|
|
548
|
+
role="gridcell"
|
|
549
|
+
class="calendar-cell calendar-year"
|
|
550
|
+
[class.is-selected]="year.selected"
|
|
551
|
+
[disabled]="year.disabled"
|
|
552
|
+
[attr.aria-label]="year.year"
|
|
553
|
+
[attr.aria-selected]="year.selected"
|
|
554
|
+
[attr.data-year]="year.year"
|
|
555
|
+
[attr.tabindex]="year.year === multiYearTabStop() ? 0 : -1"
|
|
556
|
+
(click)="chooseYear(year.year)"
|
|
557
|
+
(focus)="focusYear(year.year)"
|
|
558
|
+
>
|
|
559
|
+
{{ year.year }}
|
|
560
|
+
</button>
|
|
561
|
+
}
|
|
562
|
+
</div>
|
|
563
|
+
</div>
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
</div>
|
|
567
|
+
`, isInline: true, 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 .15s ease,color .15s ease}.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"] });
|
|
568
|
+
}
|
|
569
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CalendarComponent, decorators: [{
|
|
570
|
+
type: Component,
|
|
571
|
+
args: [{ selector: 'Calendar', providers: [
|
|
572
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CalendarComponent), multi: true },
|
|
573
|
+
], host: {
|
|
574
|
+
'[class]': 'classes()',
|
|
575
|
+
'[attr.aria-disabled]': 'isDisabled() ? "true" : null',
|
|
576
|
+
'[attr.inert]': 'isDisabled() ? "" : null',
|
|
577
|
+
}, template: `
|
|
578
|
+
<div #surface class="calendar-surface">
|
|
579
|
+
<div class="calendar-header">
|
|
580
|
+
<button
|
|
581
|
+
type="button"
|
|
582
|
+
class="calendar-nav"
|
|
583
|
+
aria-label="Previous period"
|
|
584
|
+
[disabled]="isDisabled()"
|
|
585
|
+
(click)="previous()"
|
|
586
|
+
>
|
|
587
|
+
<span aria-hidden="true">‹</span>
|
|
588
|
+
</button>
|
|
589
|
+
|
|
590
|
+
<button
|
|
591
|
+
type="button"
|
|
592
|
+
class="calendar-title"
|
|
593
|
+
[disabled]="isDisabled()"
|
|
594
|
+
(click)="toggleView()"
|
|
595
|
+
>
|
|
596
|
+
{{ headerLabel() }}
|
|
597
|
+
</button>
|
|
598
|
+
|
|
599
|
+
<button
|
|
600
|
+
type="button"
|
|
601
|
+
class="calendar-nav"
|
|
602
|
+
aria-label="Next period"
|
|
603
|
+
[disabled]="isDisabled()"
|
|
604
|
+
(click)="next()"
|
|
605
|
+
>
|
|
606
|
+
<span aria-hidden="true">›</span>
|
|
607
|
+
</button>
|
|
608
|
+
</div>
|
|
609
|
+
|
|
610
|
+
@switch (activeView()) {
|
|
611
|
+
@case ('month') {
|
|
612
|
+
<div
|
|
613
|
+
class="calendar-grid calendar-grid-month"
|
|
614
|
+
role="grid"
|
|
615
|
+
tabindex="-1"
|
|
616
|
+
aria-label="Calendar dates"
|
|
617
|
+
(keydown)="onMonthKeydown($event)"
|
|
618
|
+
>
|
|
619
|
+
<div class="calendar-weekdays" role="row">
|
|
620
|
+
@for (label of weekdayLabels(); track label) {
|
|
621
|
+
<span class="calendar-weekday" role="columnheader">{{ label }}</span>
|
|
622
|
+
}
|
|
623
|
+
</div>
|
|
624
|
+
|
|
625
|
+
<div class="calendar-days">
|
|
626
|
+
@for (week of monthWeeks(); track week[0].key) {
|
|
627
|
+
<div class="calendar-week" role="row">
|
|
628
|
+
@for (cell of week; track cell.key) {
|
|
629
|
+
<button
|
|
630
|
+
type="button"
|
|
631
|
+
role="gridcell"
|
|
632
|
+
class="calendar-cell"
|
|
633
|
+
[class.is-outside-month]="!cell.inMonth"
|
|
634
|
+
[class.is-selected]="cell.selected"
|
|
635
|
+
[disabled]="cell.disabled"
|
|
636
|
+
[attr.aria-label]="dateLabel(cell.date)"
|
|
637
|
+
[attr.data-date]="cell.key"
|
|
638
|
+
[attr.aria-selected]="cell.selected"
|
|
639
|
+
[attr.aria-current]="cell.today ? 'date' : null"
|
|
640
|
+
[class.is-today]="cell.today"
|
|
641
|
+
[attr.tabindex]="cell.key === monthTabStopKey() ? 0 : -1"
|
|
642
|
+
(click)="selectDate(cell.date)"
|
|
643
|
+
(focus)="focusDate.set(cloneDate(cell.date))"
|
|
644
|
+
>
|
|
645
|
+
{{ cell.date.getDate() }}
|
|
646
|
+
</button>
|
|
647
|
+
}
|
|
648
|
+
</div>
|
|
649
|
+
}
|
|
650
|
+
</div>
|
|
651
|
+
</div>
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
@case ('year') {
|
|
655
|
+
<div
|
|
656
|
+
class="calendar-grid"
|
|
657
|
+
role="grid"
|
|
658
|
+
tabindex="-1"
|
|
659
|
+
aria-label="Calendar months"
|
|
660
|
+
(keydown)="onPeriodKeydown($event, 3)"
|
|
661
|
+
>
|
|
662
|
+
<div class="calendar-grid-year" role="row">
|
|
663
|
+
@for (month of yearMonths(); track month.key) {
|
|
664
|
+
<button
|
|
665
|
+
type="button"
|
|
666
|
+
role="gridcell"
|
|
667
|
+
class="calendar-cell calendar-month"
|
|
668
|
+
[class.is-selected]="month.selected"
|
|
669
|
+
[disabled]="month.disabled"
|
|
670
|
+
[attr.aria-label]="month.label"
|
|
671
|
+
[attr.aria-selected]="month.selected"
|
|
672
|
+
[attr.data-month]="month.monthIndex"
|
|
673
|
+
[attr.tabindex]="month.monthIndex === yearTabStop() ? 0 : -1"
|
|
674
|
+
(click)="chooseMonth(month.monthIndex)"
|
|
675
|
+
(focus)="focusMonth(month.monthIndex)"
|
|
676
|
+
>
|
|
677
|
+
{{ month.label }}
|
|
678
|
+
</button>
|
|
679
|
+
}
|
|
680
|
+
</div>
|
|
681
|
+
</div>
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
@case ('multi-year') {
|
|
685
|
+
<div
|
|
686
|
+
class="calendar-grid"
|
|
687
|
+
role="grid"
|
|
688
|
+
tabindex="-1"
|
|
689
|
+
aria-label="Calendar years"
|
|
690
|
+
(keydown)="onPeriodKeydown($event, 4)"
|
|
691
|
+
>
|
|
692
|
+
<div class="calendar-grid-years" role="row">
|
|
693
|
+
@for (year of multiYearCells(); track year.key) {
|
|
694
|
+
<button
|
|
695
|
+
type="button"
|
|
696
|
+
role="gridcell"
|
|
697
|
+
class="calendar-cell calendar-year"
|
|
698
|
+
[class.is-selected]="year.selected"
|
|
699
|
+
[disabled]="year.disabled"
|
|
700
|
+
[attr.aria-label]="year.year"
|
|
701
|
+
[attr.aria-selected]="year.selected"
|
|
702
|
+
[attr.data-year]="year.year"
|
|
703
|
+
[attr.tabindex]="year.year === multiYearTabStop() ? 0 : -1"
|
|
704
|
+
(click)="chooseYear(year.year)"
|
|
705
|
+
(focus)="focusYear(year.year)"
|
|
706
|
+
>
|
|
707
|
+
{{ year.year }}
|
|
708
|
+
</button>
|
|
709
|
+
}
|
|
710
|
+
</div>
|
|
711
|
+
</div>
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
</div>
|
|
715
|
+
`, 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 .15s ease,color .15s ease}.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"] }]
|
|
716
|
+
}], propDecorators: { surface: [{ type: i0.ViewChild, args: ['surface', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], startAt: [{ type: i0.Input, args: [{ isSignal: true, alias: "startAt", required: false }] }], startView: [{ type: i0.Input, args: [{ isSignal: true, alias: "startView", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4
717
|
|
|
5
718
|
/**
|
|
6
719
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
720
|
+
*/
|
|
721
|
+
|
|
722
|
+
export { CalendarComponent, addDays, addMonths, addYears, cloneDate, endOfMonth, formatIsoDate, isDateSelectable, monthLabel, parseIsoDate, sameDay, startOfDay, startOfMonth, startOfWeek, yearLabel, yearRangeLabel };
|