@sdcorejs/angular 22.3.4 → 22.3.6
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/assets/STYLE-GUIDE.md +78 -1
- package/assets/THEME.md +45 -3
- package/assets/scss/core/_popover-panel.scss +90 -0
- package/assets/scss/core/form.scss +5 -2
- package/assets/scss/core/utilities/_grid.scss +15 -0
- package/assets/scss/core/utilities/_sizing.scss +4 -0
- package/assets/scss/themes/_component-tokens.scss +9 -4
- package/assets/scss/themes/_semantic.scss +6 -5
- package/fesm2022/sdcorejs-angular-components-anchor.mjs +64 -3
- package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +14 -6
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-calendar.mjs +2565 -0
- package/fesm2022/sdcorejs-angular-components-calendar.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-card.mjs +521 -23
- package/fesm2022/sdcorejs-angular-components-card.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +4 -18
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +7 -7
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-kanban.mjs +849 -157
- package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +66 -14
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +1528 -375
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs +78 -2
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-scheduler.mjs +2006 -0
- package/fesm2022/sdcorejs-angular-components-scheduler.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +126 -26
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab.mjs +31 -2
- package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +6215 -3830
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-timeline.mjs +501 -0
- package/fesm2022/sdcorejs-angular-components-timeline.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-tree.mjs +613 -36
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +2 -4
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components.mjs +3 -1
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +110 -22
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +142 -43
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +71 -22
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-directives.mjs +4 -3
- package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +23 -4
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +812 -52
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-SJIWI1dX.mjs → sdcorejs-angular-modules-generic-generic-configuration.page-j_thIw4L.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-SJIWI1dX.mjs.map → sdcorejs-angular-modules-generic-generic-configuration.page-j_thIw4L.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-BPhMLVbv.mjs → sdcorejs-angular-modules-generic-generic-form-host.page-DLsJ_8NR.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-BPhMLVbv.mjs.map → sdcorejs-angular-modules-generic-generic-form-host.page-DLsJ_8NR.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-aGhowe9Y.mjs → sdcorejs-angular-modules-generic-generic-list.page-CkYR7Y-b.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-aGhowe9Y.mjs.map → sdcorejs-angular-modules-generic-generic-list.page-CkYR7Y-b.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-N8_oGpqD.mjs → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-Ddytu3Gb.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-N8_oGpqD.mjs.map → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-Ddytu3Gb.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +17 -8
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-C2o5xPVB.mjs → sdcorejs-angular-modules-pattern-base-api.service-vMdkWmw-.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-C2o5xPVB.mjs.map → sdcorejs-angular-modules-pattern-base-api.service-vMdkWmw-.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-RBvVv88D.mjs → sdcorejs-angular-modules-pattern-create.component--cdb_2ub.mjs} +11 -7
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component--cdb_2ub.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-CxicczH7.mjs → sdcorejs-angular-modules-pattern-create.component-BmKRynOI.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-CxicczH7.mjs.map → sdcorejs-angular-modules-pattern-create.component-BmKRynOI.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-D3MzNJ3F.mjs → sdcorejs-angular-modules-pattern-create.component-DoilYt0j.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-D3MzNJ3F.mjs.map → sdcorejs-angular-modules-pattern-create.component-DoilYt0j.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-3hWkJClX.mjs → sdcorejs-angular-modules-pattern-customer.service-DpPC-tV2.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-3hWkJClX.mjs.map → sdcorejs-angular-modules-pattern-customer.service-DpPC-tV2.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-CcpYULut.mjs → sdcorejs-angular-modules-pattern-detail.component-Bh_rvQnq.mjs} +61 -55
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-Bh_rvQnq.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-CEhbU12j.mjs → sdcorejs-angular-modules-pattern-detail.component-Dk1bomUT.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-CEhbU12j.mjs.map → sdcorejs-angular-modules-pattern-detail.component-Dk1bomUT.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-G5lHfG81.mjs → sdcorejs-angular-modules-pattern-flow.component-BarNCjsh.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-G5lHfG81.mjs.map → sdcorejs-angular-modules-pattern-flow.component-BarNCjsh.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-index.component-CosbQK0W.mjs → sdcorejs-angular-modules-pattern-index.component--rIi-QIQ.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-index.component-CosbQK0W.mjs.map → sdcorejs-angular-modules-pattern-index.component--rIi-QIQ.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-lines-table-form.component-DmmVKrgM.mjs → sdcorejs-angular-modules-pattern-lines-table-form.component-G9Li--QF.mjs} +5 -5
- package/fesm2022/{sdcorejs-angular-modules-pattern-lines-table-form.component-DmmVKrgM.mjs.map → sdcorejs-angular-modules-pattern-lines-table-form.component-G9Li--QF.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-2AZxTu9a.mjs +522 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-2AZxTu9a.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CDM4V05g.mjs +520 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CDM4V05g.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-C_pVqRcC.mjs → sdcorejs-angular-modules-pattern-list.component-DS9DROp-.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-C_pVqRcC.mjs.map → sdcorejs-angular-modules-pattern-list.component-DS9DROp-.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-CNVqk3JC.mjs → sdcorejs-angular-modules-pattern-list.component-DbF9z3da.mjs} +30 -39
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DbF9z3da.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-EaNDEtCn.mjs → sdcorejs-angular-modules-pattern-list.component-DlF3i6ai.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-EaNDEtCn.mjs.map → sdcorejs-angular-modules-pattern-list.component-DlF3i6ai.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-CFljqhjv.mjs → sdcorejs-angular-modules-pattern-mock-backend.factory-BpECki9p.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-CFljqhjv.mjs.map → sdcorejs-angular-modules-pattern-mock-backend.factory-BpECki9p.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs → sdcorejs-angular-modules-pattern-pattern-source-viewer-DuhyXsGn.mjs} +4 -22
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-DuhyXsGn.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs → sdcorejs-angular-modules-pattern-pattern-source.generated-bfpj85ke.mjs} +26 -27
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-bfpj85ke.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-DitXmlr1.mjs → sdcorejs-angular-modules-pattern-product.service-DEAQ4oro.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-DitXmlr1.mjs.map → sdcorejs-angular-modules-pattern-product.service-DEAQ4oro.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-profile.component-Dxw7Ix9d.mjs → sdcorejs-angular-modules-pattern-profile.component-D-dJk5vb.mjs} +27 -14
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-D-dJk5vb.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BxXgJVsW.mjs → sdcorejs-angular-modules-pattern-routes-Brr61WQo.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BxXgJVsW.mjs.map → sdcorejs-angular-modules-pattern-routes-Brr61WQo.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CWixJ2If.mjs → sdcorejs-angular-modules-pattern-routes-CPVcXcfq.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CWixJ2If.mjs.map → sdcorejs-angular-modules-pattern-routes-CPVcXcfq.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-w4VY9P_H.mjs → sdcorejs-angular-modules-pattern-routes-CWCtuZ4z.mjs} +8 -8
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-w4VY9P_H.mjs.map → sdcorejs-angular-modules-pattern-routes-CWCtuZ4z.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BOiWZHqg.mjs → sdcorejs-angular-modules-pattern-routes-CfXmYmCp.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BOiWZHqg.mjs.map → sdcorejs-angular-modules-pattern-routes-CfXmYmCp.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CuDWVZ4I.mjs +56 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CuDWVZ4I.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CJ-RAMa5.mjs → sdcorejs-angular-modules-pattern-routes-D8W_NHEH.mjs} +5 -5
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CJ-RAMa5.mjs.map → sdcorejs-angular-modules-pattern-routes-D8W_NHEH.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-Db0ceW1C.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-Db0ceW1C.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-C43Q4Wtq.mjs → sdcorejs-angular-modules-pattern-routes-DdmOGRpF.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-C43Q4Wtq.mjs.map → sdcorejs-angular-modules-pattern-routes-DdmOGRpF.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-BQCWgQsr.mjs → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-JWx3RaLo.mjs} +12 -12
- package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-BQCWgQsr.mjs.map → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-JWx3RaLo.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-BOjJteMd.mjs → sdcorejs-angular-modules-pattern-shell.component-DMJpUhpn.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-BOjJteMd.mjs.map → sdcorejs-angular-modules-pattern-shell.component-DMJpUhpn.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-BHDd7D8y.mjs +498 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-BHDd7D8y.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-lGwicZKW.mjs → sdcorejs-angular-modules-pattern-update.component-Bx2zgc86.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-lGwicZKW.mjs.map → sdcorejs-angular-modules-pattern-update.component-Bx2zgc86.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-CS3jlV-R.mjs → sdcorejs-angular-modules-pattern-update.component-Cb29tp1H.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-CS3jlV-R.mjs.map → sdcorejs-angular-modules-pattern-update.component-Cb29tp1H.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-CUgQPcR4.mjs → sdcorejs-angular-modules-pattern-update.component-e5BaHrDk.mjs} +9 -6
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-e5BaHrDk.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +171 -158
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-excel.mjs +34 -0
- package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-query-params.mjs +227 -0
- package/fesm2022/sdcorejs-angular-services-query-params.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs +24 -1
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs.map +1 -1
- package/modules/pattern/README.md +5 -4
- package/modules/pattern/docs/detail.md +18 -9
- package/modules/pattern/docs/drawer.md +185 -83
- package/modules/pattern/docs/header-actions.md +1 -1
- package/modules/pattern/docs/list.md +3 -3
- package/modules/pattern/docs/states.md +1 -1
- package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +12 -16
- package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +58 -29
- package/modules/pattern/features/category/pages/list/list.component.html +11 -3
- package/modules/pattern/features/category/pages/list/list.component.ts +36 -10
- package/modules/pattern/features/category/routes.ts +5 -22
- package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +7 -11
- package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.ts +70 -27
- package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.ts +9 -53
- package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +53 -19
- package/modules/pattern/features/customer/entity.resolver.ts +1 -1
- package/modules/pattern/features/customer/pages/list/list.component.html +18 -3
- package/modules/pattern/features/customer/pages/list/list.component.ts +43 -16
- package/modules/pattern/features/customer/pages/profile/profile.component.ts +17 -8
- package/modules/pattern/features/customer/routes.ts +6 -27
- package/modules/pattern/features/order/components/approval-steps/approval-steps.component.ts +37 -56
- package/modules/pattern/features/order/components/summary-cards/summary-cards.component.ts +14 -76
- package/modules/pattern/features/order/pages/create/create.component.ts +7 -3
- package/modules/pattern/features/order/pages/detail/detail.component.ts +1 -1
- package/modules/pattern/features/order/pages/update/update.component.ts +5 -2
- package/package.json +17 -5
- package/types/sdcorejs-angular-components-anchor.d.ts +6 -1
- package/types/sdcorejs-angular-components-button.d.ts +7 -1
- package/types/sdcorejs-angular-components-calendar.d.ts +1092 -0
- package/types/sdcorejs-angular-components-card.d.ts +247 -9
- package/types/sdcorejs-angular-components-kanban.d.ts +191 -74
- package/types/sdcorejs-angular-components-modal.d.ts +15 -1
- package/types/sdcorejs-angular-components-query-bar.d.ts +204 -38
- package/types/sdcorejs-angular-components-quick-action.d.ts +65 -1
- package/types/sdcorejs-angular-components-scheduler.d.ts +544 -0
- package/types/sdcorejs-angular-components-tab.d.ts +6 -1
- package/types/sdcorejs-angular-components-table.d.ts +338 -31
- package/types/sdcorejs-angular-components-timeline.d.ts +216 -0
- package/types/sdcorejs-angular-components-tree.d.ts +119 -6
- package/types/sdcorejs-angular-components.d.ts +3 -1
- package/types/sdcorejs-angular-directives.d.ts +4 -2
- package/types/sdcorejs-angular-forms-date.d.ts +2 -0
- package/types/sdcorejs-angular-forms-directives.d.ts +1 -1
- package/types/sdcorejs-angular-i18n.d.ts +159 -9
- package/types/sdcorejs-angular-modules-layout.d.ts +2 -1
- package/types/sdcorejs-angular-services-confirm.d.ts +22 -81
- package/types/sdcorejs-angular-services-excel.d.ts +59 -0
- package/types/sdcorejs-angular-services-query-params.d.ts +67 -0
- package/types/sdcorejs-angular-utilities-extensions.d.ts +10 -1
- package/fesm2022/sdcorejs-angular-components-history.mjs +0 -54
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CRc9T7rb.mjs +0 -146
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CRc9T7rb.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-Cz-MjRG0.mjs +0 -148
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-Cz-MjRG0.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-RBvVv88D.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs +0 -18
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-DzDAX3B7.mjs +0 -152
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-DzDAX3B7.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CcpYULut.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D8-WXUAE.mjs +0 -92
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D8-WXUAE.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DHTxzjRN.mjs +0 -242
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DHTxzjRN.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-CTgHdGeQ.mjs +0 -72
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-CTgHdGeQ.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BjehcQEk.mjs +0 -172
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BjehcQEk.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CNVqk3JC.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-jB3E20UF.mjs +0 -120
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-jB3E20UF.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-Dxw7Ix9d.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-BWZxOMhB.mjs +0 -74
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-BWZxOMhB.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CophQH_L.mjs +0 -100
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CophQH_L.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-BT2PzXTG.mjs +0 -135
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-BT2PzXTG.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-qmGn2tCI.mjs +0 -146
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-qmGn2tCI.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CUgQPcR4.mjs.map +0 -1
- package/modules/pattern/features/category/entity.resolver.ts +0 -27
- package/types/sdcorejs-angular-components-history.d.ts +0 -23
|
@@ -0,0 +1,2565 @@
|
|
|
1
|
+
import { CdkDrag } from '@angular/cdk/drag-drop';
|
|
2
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { InjectionToken, signal, untracked, isDevMode, computed, effect, afterNextRender, inject, TemplateRef, Directive, NgZone, ElementRef, Injector, input, model, booleanAttribute, output, contentChild, viewChild, DestroyRef, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
|
+
import { SdDataState } from '@sdcorejs/angular/components/data-state';
|
|
6
|
+
import { I18nService, SdTranslatePipe } from '@sdcorejs/angular/i18n';
|
|
7
|
+
import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
8
|
+
import { SdDateTimeService } from '@sdcorejs/angular/services/date-time';
|
|
9
|
+
import { ɵsdNormalizeCalendarDay as _sdNormalizeCalendarDay, sdSerializeTemporalValue } from '@sdcorejs/angular/forms/models';
|
|
10
|
+
import { sdTimeToMinutes } from '@sdcorejs/angular/forms/time';
|
|
11
|
+
|
|
12
|
+
// Auto-scroll while dragging (calendar.md §9.3, scheduler.md §9.3), shared with sd-scheduler through the ɵ exports of
|
|
13
|
+
// the entry point: sd-calendar scrolls its time grid vertically, sd-scheduler scrolls both axes.
|
|
14
|
+
/** Distance (px) from an edge of the visible area where auto-scroll starts, and the top speed (px per frame). */
|
|
15
|
+
const EDGE = 40;
|
|
16
|
+
const EDGE_SPEED = 16;
|
|
17
|
+
/** Speed (px per frame) on one axis: negative within 40px of the start edge, positive within 40px of the end edge. */
|
|
18
|
+
function sdCalendarEdgeSpeed(position, start, end) {
|
|
19
|
+
const before = position - start;
|
|
20
|
+
const after = end - position;
|
|
21
|
+
if (before >= 0 && before < EDGE)
|
|
22
|
+
return -Math.ceil(((EDGE - before) / EDGE) * EDGE_SPEED);
|
|
23
|
+
if (after >= 0 && after < EDGE)
|
|
24
|
+
return Math.ceil(((EDGE - after) / EDGE) * EDGE_SPEED);
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* One `requestAnimationFrame` loop outside the zone. `update` is called on every pointer move of a drag; while the
|
|
29
|
+
* pointer stays near an edge the loop scrolls and calls `onFrame` (inside the zone) after each step.
|
|
30
|
+
*/
|
|
31
|
+
class SdCalendarEdgeScroller {
|
|
32
|
+
zone;
|
|
33
|
+
#frame = 0;
|
|
34
|
+
constructor(zone) {
|
|
35
|
+
this.zone = zone;
|
|
36
|
+
}
|
|
37
|
+
update(scroller, area, pointer, axes, onFrame) {
|
|
38
|
+
if (!scroller || !area || !pointer)
|
|
39
|
+
return this.stop();
|
|
40
|
+
const dy = axes.y ? sdCalendarEdgeSpeed(pointer.y, area.top, area.bottom) : 0;
|
|
41
|
+
const dx = axes.x ? sdCalendarEdgeSpeed(pointer.x, area.left, area.right) : 0;
|
|
42
|
+
if (!dx && !dy)
|
|
43
|
+
return this.stop();
|
|
44
|
+
if (this.#frame || typeof requestAnimationFrame === 'undefined')
|
|
45
|
+
return;
|
|
46
|
+
const frame = () => {
|
|
47
|
+
this.#frame = 0;
|
|
48
|
+
scroller.scrollTop += dy;
|
|
49
|
+
scroller.scrollLeft += dx;
|
|
50
|
+
this.zone.run(onFrame);
|
|
51
|
+
};
|
|
52
|
+
this.#frame = this.zone.runOutsideAngular(() => requestAnimationFrame(frame));
|
|
53
|
+
}
|
|
54
|
+
stop() {
|
|
55
|
+
if (this.#frame && typeof cancelAnimationFrame !== 'undefined')
|
|
56
|
+
cancelAnimationFrame(this.#frame);
|
|
57
|
+
this.#frame = 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const SD_CALENDAR_CONFIGURATION = new InjectionToken('sd-calendar.configuration');
|
|
62
|
+
const WORKDAY = [
|
|
63
|
+
{ from: '08:00', to: '12:00' },
|
|
64
|
+
{ from: '13:00', to: '17:30' },
|
|
65
|
+
];
|
|
66
|
+
/** @internal Built-in defaults, shared with `sd-scheduler`. Not covered by SemVer. */
|
|
67
|
+
const ɵSD_CALENDAR_DEFAULTS = {
|
|
68
|
+
firstDayOfWeek: 1,
|
|
69
|
+
step: 30,
|
|
70
|
+
agendaDays: 14,
|
|
71
|
+
scrollTime: '08:00',
|
|
72
|
+
workingHours: { 1: WORKDAY, 2: WORKDAY, 3: WORKDAY, 4: WORKDAY, 5: WORKDAY },
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const DAY = /^(\d{4})\/(\d{2})\/(\d{2})$/;
|
|
76
|
+
const MINUTES_PER_DAY = 1440;
|
|
77
|
+
/** Slot lengths `step` accepts: the divisors of 60 a time grid can draw. */
|
|
78
|
+
const SD_CALENDAR_STEPS = [5, 10, 15, 20, 30, 60];
|
|
79
|
+
const pad = (value, length = 2) => String(value).padStart(length, '0');
|
|
80
|
+
/** Year, month and day of `'yyyy/MM/dd'`; `null` for anything else, including an impossible date. */
|
|
81
|
+
function sdCalendarDayParts(day) {
|
|
82
|
+
const match = DAY.exec(day);
|
|
83
|
+
if (!match)
|
|
84
|
+
return null;
|
|
85
|
+
const [year, month, date] = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
86
|
+
return sdCalendarDay(year, month, date) === day ? { year, month, day: date } : null;
|
|
87
|
+
}
|
|
88
|
+
/** `'yyyy/MM/dd'` of the given numbers; overflowing months and days roll over like `Date` does. */
|
|
89
|
+
function sdCalendarDay(year, month, day) {
|
|
90
|
+
// why: UTC fields carry plain calendar arithmetic (no zone, no DST); the instant itself is never used.
|
|
91
|
+
const date = new Date(0);
|
|
92
|
+
date.setUTCFullYear(year, month - 1, day);
|
|
93
|
+
return `${pad(date.getUTCFullYear(), 4)}/${pad(date.getUTCMonth() + 1)}/${pad(date.getUTCDate())}`;
|
|
94
|
+
}
|
|
95
|
+
const partsOf = (day) => {
|
|
96
|
+
const parts = sdCalendarDayParts(day);
|
|
97
|
+
if (!parts)
|
|
98
|
+
throw new Error(`[sd-calendar] invalid day "${day}"`);
|
|
99
|
+
return parts;
|
|
100
|
+
};
|
|
101
|
+
function sdCalendarAddDays(day, days) {
|
|
102
|
+
const { year, month, day: date } = partsOf(day);
|
|
103
|
+
return sdCalendarDay(year, month, date + days);
|
|
104
|
+
}
|
|
105
|
+
/** First day of the month `months` away from the month of `day`. */
|
|
106
|
+
function sdCalendarAddMonths(day, months) {
|
|
107
|
+
const { year, month } = partsOf(day);
|
|
108
|
+
return sdCalendarDay(year, month + months, 1);
|
|
109
|
+
}
|
|
110
|
+
/** The same day number `months` away, clamped to the last day of that month (month view PageUp/PageDown). */
|
|
111
|
+
function sdCalendarAddMonthsKeepDay(day, months) {
|
|
112
|
+
const { year, month, day: date } = partsOf(day);
|
|
113
|
+
const last = sdCalendarDayParts(sdCalendarDay(year, month + months + 1, 0)).day;
|
|
114
|
+
return sdCalendarDay(year, month + months, Math.min(date, last));
|
|
115
|
+
}
|
|
116
|
+
/** 0 (Sunday) – 6 (Saturday). */
|
|
117
|
+
function sdCalendarWeekday(day) {
|
|
118
|
+
const { year, month, day: date } = partsOf(day);
|
|
119
|
+
const utc = new Date(0);
|
|
120
|
+
utc.setUTCFullYear(year, month - 1, date);
|
|
121
|
+
return utc.getUTCDay();
|
|
122
|
+
}
|
|
123
|
+
/** Number of days from `from` to `to` (negative when `to` is earlier). */
|
|
124
|
+
function sdCalendarDayDiff(from, to) {
|
|
125
|
+
const epochDay = (day) => {
|
|
126
|
+
const { year, month, day: date } = partsOf(day);
|
|
127
|
+
const utc = new Date(0);
|
|
128
|
+
utc.setUTCFullYear(year, month - 1, date);
|
|
129
|
+
return Math.round(utc.getTime() / 86_400_000);
|
|
130
|
+
};
|
|
131
|
+
return epochDay(to) - epochDay(from);
|
|
132
|
+
}
|
|
133
|
+
function sdCalendarStartOfWeek(day, firstDayOfWeek) {
|
|
134
|
+
return sdCalendarAddDays(day, -((sdCalendarWeekday(day) - firstDayOfWeek + 7) % 7));
|
|
135
|
+
}
|
|
136
|
+
function sdCalendarIsWeekend(day) {
|
|
137
|
+
const weekday = sdCalendarWeekday(day);
|
|
138
|
+
return weekday === 0 || weekday === 6;
|
|
139
|
+
}
|
|
140
|
+
/** `agendaDays` kept in 1–62; not a number → 14. */
|
|
141
|
+
function sdCalendarClampAgendaDays(days) {
|
|
142
|
+
if (!Number.isFinite(days))
|
|
143
|
+
return 14;
|
|
144
|
+
return Math.min(62, Math.max(1, Math.floor(days)));
|
|
145
|
+
}
|
|
146
|
+
/** `step` when it is one of `SD_CALENDAR_STEPS`, otherwise `null`. */
|
|
147
|
+
function sdCalendarNormalizeStep(step) {
|
|
148
|
+
return SD_CALENDAR_STEPS.includes(step) ? step : null;
|
|
149
|
+
}
|
|
150
|
+
/** Granularity of moving and resizing: `min(step, 15)`. */
|
|
151
|
+
function sdCalendarMoveStep(step) {
|
|
152
|
+
return Math.min(step, 15);
|
|
153
|
+
}
|
|
154
|
+
/** Every day from `from` to `to`, both included. */
|
|
155
|
+
function sdCalendarDaysBetween(from, to) {
|
|
156
|
+
const days = [];
|
|
157
|
+
for (let day = from; day <= to; day = sdCalendarAddDays(day, 1))
|
|
158
|
+
days.push(day);
|
|
159
|
+
return days;
|
|
160
|
+
}
|
|
161
|
+
const daysBetween = sdCalendarDaysBetween;
|
|
162
|
+
/** Full weeks of the month view (4–6 rows), weekends left out when `hideWeekends`. */
|
|
163
|
+
function sdCalendarMonthWeeks(input) {
|
|
164
|
+
const first = sdCalendarAddMonths(input.date, 0);
|
|
165
|
+
const last = sdCalendarAddDays(sdCalendarAddMonths(input.date, 1), -1);
|
|
166
|
+
const weeks = [];
|
|
167
|
+
for (let start = sdCalendarStartOfWeek(first, input.firstDayOfWeek); start <= last; start = sdCalendarAddDays(start, 7)) {
|
|
168
|
+
const week = daysBetween(start, sdCalendarAddDays(start, 6));
|
|
169
|
+
weeks.push(input.hideWeekends ? week.filter(day => !sdCalendarIsWeekend(day)) : week);
|
|
170
|
+
}
|
|
171
|
+
return weeks;
|
|
172
|
+
}
|
|
173
|
+
/** Days on screen, in order. Day and agenda views ignore `hideWeekends`. */
|
|
174
|
+
function sdCalendarVisibleDays(input) {
|
|
175
|
+
switch (input.view) {
|
|
176
|
+
case 'month':
|
|
177
|
+
return sdCalendarMonthWeeks(input).flat();
|
|
178
|
+
case 'week': {
|
|
179
|
+
const start = sdCalendarStartOfWeek(input.date, input.firstDayOfWeek);
|
|
180
|
+
const week = daysBetween(start, sdCalendarAddDays(start, 6));
|
|
181
|
+
return input.hideWeekends ? week.filter(day => !sdCalendarIsWeekend(day)) : week;
|
|
182
|
+
}
|
|
183
|
+
case 'agenda':
|
|
184
|
+
return daysBetween(input.date, sdCalendarAddDays(input.date, sdCalendarClampAgendaDays(input.agendaDays) - 1));
|
|
185
|
+
default:
|
|
186
|
+
return [input.date];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/** First and last day on screen (both included) and the view. */
|
|
190
|
+
function sdCalendarVisibleRange(input) {
|
|
191
|
+
const days = sdCalendarVisibleDays(input);
|
|
192
|
+
return { from: days[0], to: days[days.length - 1], view: input.view };
|
|
193
|
+
}
|
|
194
|
+
/** Anchor day after "Previous" (`-1`) or "Next" (`1`): ±7 days, ±1 day, ±1 month on day 1, ±`agendaDays` days. */
|
|
195
|
+
function sdCalendarShiftDate(input, direction) {
|
|
196
|
+
switch (input.view) {
|
|
197
|
+
case 'month':
|
|
198
|
+
return sdCalendarAddMonths(input.date, direction);
|
|
199
|
+
case 'week':
|
|
200
|
+
return sdCalendarAddDays(input.date, 7 * direction);
|
|
201
|
+
case 'agenda':
|
|
202
|
+
return sdCalendarAddDays(input.date, sdCalendarClampAgendaDays(input.agendaDays) * direction);
|
|
203
|
+
default:
|
|
204
|
+
return sdCalendarAddDays(input.date, direction);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Columns of overlapping timed events of one day (§8.4): sorted by start, longer first on a tie; a cluster grows
|
|
209
|
+
* while an event starts before the latest end so far; each event takes the first column that is free by its
|
|
210
|
+
* start; every event of a cluster shares its column count. Output order is the sorted order (the DOM order).
|
|
211
|
+
*/
|
|
212
|
+
function sdCalendarStack(items) {
|
|
213
|
+
const order = items.map((item, index) => ({ item, index })).sort((a, b) => a.item.start - b.item.start || b.item.end - a.item.end);
|
|
214
|
+
const result = [];
|
|
215
|
+
let cluster = [];
|
|
216
|
+
let columnEnds = [];
|
|
217
|
+
let clusterEnd = -Infinity;
|
|
218
|
+
const close = () => {
|
|
219
|
+
for (const entry of cluster)
|
|
220
|
+
entry.columns = columnEnds.length;
|
|
221
|
+
result.push(...cluster);
|
|
222
|
+
cluster = [];
|
|
223
|
+
columnEnds = [];
|
|
224
|
+
clusterEnd = -Infinity;
|
|
225
|
+
};
|
|
226
|
+
for (const { item, index } of order) {
|
|
227
|
+
if (item.start >= clusterEnd)
|
|
228
|
+
close();
|
|
229
|
+
let column = columnEnds.findIndex(end => end <= item.start);
|
|
230
|
+
if (column < 0)
|
|
231
|
+
column = columnEnds.push(item.end) - 1;
|
|
232
|
+
else
|
|
233
|
+
columnEnds[column] = item.end;
|
|
234
|
+
cluster.push({ index, column, columns: 0 });
|
|
235
|
+
clusterEnd = Math.max(clusterEnd, item.end);
|
|
236
|
+
}
|
|
237
|
+
close();
|
|
238
|
+
return result;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Rows of the all-day band (§7) over `days`. Bars sort by first day, then the longer first; each takes the first
|
|
242
|
+
* row that is free at its first visible day. Rows from `maxRows` on are left out and counted per day in `more`.
|
|
243
|
+
*/
|
|
244
|
+
function sdCalendarAllDayLayout(items, days, maxRows = 3) {
|
|
245
|
+
const more = days.map(() => 0);
|
|
246
|
+
const bars = [];
|
|
247
|
+
if (!days.length)
|
|
248
|
+
return { bars, rows: 0, more };
|
|
249
|
+
const first = days[0];
|
|
250
|
+
const last = days[days.length - 1];
|
|
251
|
+
const order = items
|
|
252
|
+
.map((item, index) => ({ item, index }))
|
|
253
|
+
.sort((a, b) => (a.item.firstDay < b.item.firstDay ? -1 : a.item.firstDay > b.item.firstDay ? 1 : 0) ||
|
|
254
|
+
sdCalendarDayDiff(b.item.firstDay, b.item.lastDay) - sdCalendarDayDiff(a.item.firstDay, a.item.lastDay));
|
|
255
|
+
const rowEnds = [];
|
|
256
|
+
for (const { item, index } of order) {
|
|
257
|
+
const from = days.findIndex(day => day >= item.firstDay);
|
|
258
|
+
let to = days.length - 1;
|
|
259
|
+
while (to >= 0 && days[to] > item.lastDay)
|
|
260
|
+
to--;
|
|
261
|
+
if (from < 0 || to < from)
|
|
262
|
+
continue;
|
|
263
|
+
let row = rowEnds.findIndex(end => end < from);
|
|
264
|
+
if (row < 0)
|
|
265
|
+
row = rowEnds.push(to) - 1;
|
|
266
|
+
else
|
|
267
|
+
rowEnds[row] = to;
|
|
268
|
+
if (row >= maxRows) {
|
|
269
|
+
for (let day = from; day <= to; day++)
|
|
270
|
+
more[day]++;
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
bars.push({ index, row, from, to, clippedStart: item.firstDay < first, clippedEnd: item.lastDay > last });
|
|
274
|
+
}
|
|
275
|
+
return { bars, rows: Math.min(rowEnds.length, maxRows), more };
|
|
276
|
+
}
|
|
277
|
+
const clampMinutes = (minutes) => Math.min(MINUTES_PER_DAY, Math.max(0, minutes));
|
|
278
|
+
/** The slot of `step` minutes under `minutes`: a click or a tap. */
|
|
279
|
+
function sdCalendarSlot(minutes, step) {
|
|
280
|
+
const start = Math.min(MINUTES_PER_DAY - step, Math.floor(clampMinutes(minutes) / step) * step);
|
|
281
|
+
return { start, end: start + step };
|
|
282
|
+
}
|
|
283
|
+
/** Span swept from `anchor` to `current` minutes: `[min, max + step]`, kept inside the day. */
|
|
284
|
+
function sdCalendarSweep(anchor, current, step) {
|
|
285
|
+
const a = sdCalendarSlot(anchor, step).start;
|
|
286
|
+
const b = sdCalendarSlot(current, step).start;
|
|
287
|
+
return { start: Math.min(a, b), end: Math.min(MINUTES_PER_DAY, Math.max(a, b) + step) };
|
|
288
|
+
}
|
|
289
|
+
/** New start of a block dragged by `delta` minutes: `delta` rounded to `moveStep`, kept in `[0, 1440 − duration]`. */
|
|
290
|
+
function sdCalendarSnapMove(start, delta, duration, moveStep) {
|
|
291
|
+
const next = start + Math.round(delta / moveStep) * moveStep;
|
|
292
|
+
return Math.min(MINUTES_PER_DAY - duration, Math.max(0, next));
|
|
293
|
+
}
|
|
294
|
+
/** New end of a block whose bottom edge moved by `delta`: at least 15 minutes (one step under 15) long, at most 24:00. */
|
|
295
|
+
function sdCalendarResizeEnd(start, end, delta, step) {
|
|
296
|
+
const next = end + Math.round(delta / sdCalendarMoveStep(step)) * sdCalendarMoveStep(step);
|
|
297
|
+
return Math.min(MINUTES_PER_DAY, Math.max(start + Math.min(step, 15), next));
|
|
298
|
+
}
|
|
299
|
+
/** `'HH:mm'`; 1440 reads `'24:00'`. */
|
|
300
|
+
function sdCalendarClockText(minutes) {
|
|
301
|
+
return `${pad(Math.floor(minutes / 60))}:${pad(minutes % 60)}`;
|
|
302
|
+
}
|
|
303
|
+
/** Minutes of `'HH:mm'` as `sd-time` reads it, plus `'24:00'` for the end of the day. */
|
|
304
|
+
function sdCalendarTimeToMinutes(value) {
|
|
305
|
+
if (typeof value === 'string' && value.trim() === '24:00')
|
|
306
|
+
return MINUTES_PER_DAY;
|
|
307
|
+
return sdTimeToMinutes(value);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Working spans of a weekday, sorted. `null` hours → `null` (no shading). A weekday without hours is a day off
|
|
311
|
+
* (`[]`). A span without both ends, or whose end is not after its start, is left out.
|
|
312
|
+
*/
|
|
313
|
+
function sdCalendarWorkingRanges(hours, weekday) {
|
|
314
|
+
if (hours === null)
|
|
315
|
+
return null;
|
|
316
|
+
const spans = [];
|
|
317
|
+
for (const range of hours[weekday] ?? []) {
|
|
318
|
+
const start = sdCalendarTimeToMinutes(range.from);
|
|
319
|
+
const end = sdCalendarTimeToMinutes(range.to);
|
|
320
|
+
if (start !== null && end !== null && end > start)
|
|
321
|
+
spans.push({ start, end });
|
|
322
|
+
}
|
|
323
|
+
return spans.sort((a, b) => a.start - b.start);
|
|
324
|
+
}
|
|
325
|
+
/** Off-hours spans of a day: the complement of the working spans. `null` (no shading) → none. */
|
|
326
|
+
function sdCalendarOffSegments(working) {
|
|
327
|
+
if (working === null)
|
|
328
|
+
return [];
|
|
329
|
+
const off = [];
|
|
330
|
+
let cursor = 0;
|
|
331
|
+
for (const span of working) {
|
|
332
|
+
if (span.start > cursor)
|
|
333
|
+
off.push({ start: cursor, end: span.start });
|
|
334
|
+
cursor = Math.max(cursor, span.end);
|
|
335
|
+
}
|
|
336
|
+
if (cursor < MINUTES_PER_DAY)
|
|
337
|
+
off.push({ start: cursor, end: MINUTES_PER_DAY });
|
|
338
|
+
return off;
|
|
339
|
+
}
|
|
340
|
+
/** First `scrollTop` of the time grid: half an hour above `minutes`, never above the top. */
|
|
341
|
+
function sdCalendarInitialScroll(minutes, hourHeight) {
|
|
342
|
+
return (Math.max(0, minutes - 30) / 60) * hourHeight;
|
|
343
|
+
}
|
|
344
|
+
/** Calendar day of a date-like value, read like `sd-date` reads its model (an instant takes its day in the zone). */
|
|
345
|
+
function sdCalendarReadDay(value, clock) {
|
|
346
|
+
if (value === 'TODAY')
|
|
347
|
+
return null;
|
|
348
|
+
return _sdNormalizeCalendarDay(value, clock);
|
|
349
|
+
}
|
|
350
|
+
const WALL_CLOCK = 'yyyy/MM/dd HH:mm';
|
|
351
|
+
/**
|
|
352
|
+
* Wall-clock day and minutes of a value in the clock's zone.
|
|
353
|
+
*
|
|
354
|
+
* why: read as text (`toFormat`), not through `SdDateTimeService.toWallClock`: that carrier is a local `Date`, and a
|
|
355
|
+
* wall clock that falls in a DST gap of the browser's own zone (02:30 on a spring-forward day) would shift by an hour.
|
|
356
|
+
*/
|
|
357
|
+
function sdCalendarReadWallClock(value, clock) {
|
|
358
|
+
if (value === null || value === undefined || value === '')
|
|
359
|
+
return null;
|
|
360
|
+
const text = clock.toFormat(value, WALL_CLOCK);
|
|
361
|
+
if (!text)
|
|
362
|
+
return null;
|
|
363
|
+
return { day: text.slice(0, 10), minutes: Number(text.slice(11, 13)) * 60 + Number(text.slice(14, 16)) };
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Where an event sits (§5). `null` when a date cannot be read or a timed event does not end after its start (a
|
|
367
|
+
* timed event needs an `end`). A timed event that ends after midnight of its start day goes to the all-day row; one
|
|
368
|
+
* that ends exactly at that midnight stays in the grid with an end of 1440.
|
|
369
|
+
*/
|
|
370
|
+
function sdCalendarPlace(event, clock) {
|
|
371
|
+
if (event.allDay) {
|
|
372
|
+
const firstDay = sdCalendarReadDay(event.start, clock);
|
|
373
|
+
const hasEnd = event.end !== null && event.end !== undefined && event.end !== '';
|
|
374
|
+
const lastDay = hasEnd ? sdCalendarReadDay(event.end, clock) : firstDay;
|
|
375
|
+
if (!firstDay || !lastDay || lastDay < firstDay)
|
|
376
|
+
return null;
|
|
377
|
+
// A day read back by `sdCalendarReadDay` always parses.
|
|
378
|
+
const startInstant = clock.parse(firstDay).getTime();
|
|
379
|
+
const endInstant = clock.beginOfNextDay(lastDay).getTime();
|
|
380
|
+
return {
|
|
381
|
+
allDay: true,
|
|
382
|
+
inGrid: false,
|
|
383
|
+
startDay: firstDay,
|
|
384
|
+
startMinutes: 0,
|
|
385
|
+
endDay: lastDay,
|
|
386
|
+
endMinutes: MINUTES_PER_DAY,
|
|
387
|
+
firstDay,
|
|
388
|
+
lastDay,
|
|
389
|
+
startInstant,
|
|
390
|
+
endInstant,
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
const start = sdCalendarReadWallClock(event.start, clock);
|
|
394
|
+
const end = sdCalendarReadWallClock(event.end, clock);
|
|
395
|
+
const startInstant = clock.parse(event.start)?.getTime();
|
|
396
|
+
const endInstant = clock.parse(event.end)?.getTime();
|
|
397
|
+
const nextDay = clock.beginOfNextDay(event.start)?.getTime();
|
|
398
|
+
if (!start || !end || startInstant === undefined || endInstant === undefined || nextDay === undefined || endInstant <= startInstant)
|
|
399
|
+
return null;
|
|
400
|
+
if (endInstant <= nextDay) {
|
|
401
|
+
// Ends the same day, or exactly at midnight of the next one (24:00).
|
|
402
|
+
const endMinutes = end.day === start.day ? end.minutes : MINUTES_PER_DAY;
|
|
403
|
+
return {
|
|
404
|
+
allDay: false,
|
|
405
|
+
inGrid: true,
|
|
406
|
+
startDay: start.day,
|
|
407
|
+
startMinutes: start.minutes,
|
|
408
|
+
endDay: start.day,
|
|
409
|
+
endMinutes,
|
|
410
|
+
firstDay: start.day,
|
|
411
|
+
lastDay: start.day,
|
|
412
|
+
startInstant,
|
|
413
|
+
endInstant,
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
return {
|
|
417
|
+
allDay: false,
|
|
418
|
+
inGrid: false,
|
|
419
|
+
startDay: start.day,
|
|
420
|
+
startMinutes: start.minutes,
|
|
421
|
+
endDay: end.day,
|
|
422
|
+
endMinutes: end.minutes,
|
|
423
|
+
firstDay: start.day,
|
|
424
|
+
lastDay: end.minutes > 0 ? end.day : sdCalendarAddDays(end.day, -1),
|
|
425
|
+
startInstant,
|
|
426
|
+
endInstant,
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
/** Instant of a wall clock (`minutes` may be 1440: midnight of the next day) in the clock's zone. */
|
|
430
|
+
function instantOf(day, minutes, clock) {
|
|
431
|
+
// why: parsed from text in the zone (`parseFrom`), like the reading above, so no local carrier sits in between.
|
|
432
|
+
return clock.parseFrom(`${sdCalendarSerialize(day, minutes, clock, null).slice(0, 16)}`, WALL_CLOCK);
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Value the calendar emits for a wall clock (§5). Without `transform`: `'yyyy/MM/dd HH:mm:ss'`, or `'yyyy/MM/dd'`
|
|
436
|
+
* when `minutes` is `null` (all-day). With `transform`: the instant of that wall clock in the zone, serialized by
|
|
437
|
+
* `sdSerializeTemporalValue` like `sd-date` and `sd-datetime` (an all-day value is the start of its day).
|
|
438
|
+
*/
|
|
439
|
+
function sdCalendarSerialize(day, minutes, clock, transform) {
|
|
440
|
+
if (transform)
|
|
441
|
+
return sdSerializeTemporalValue(instantOf(day, minutes ?? 0, clock), transform);
|
|
442
|
+
if (minutes === null)
|
|
443
|
+
return day;
|
|
444
|
+
const target = minutes >= MINUTES_PER_DAY ? sdCalendarAddDays(day, 1) : day;
|
|
445
|
+
const rest = minutes % MINUTES_PER_DAY;
|
|
446
|
+
return `${target} ${pad(Math.floor(rest / 60))}:${pad(rest % 60)}:00`;
|
|
447
|
+
}
|
|
448
|
+
/** The current span of a placed event, serialized like a new one so `request.from` and `request.to` match. */
|
|
449
|
+
function sdCalendarRangeOf(placement, clock, transform) {
|
|
450
|
+
if (placement.allDay) {
|
|
451
|
+
return {
|
|
452
|
+
start: sdCalendarSerialize(placement.startDay, null, clock, transform),
|
|
453
|
+
end: sdCalendarSerialize(placement.endDay, null, clock, transform),
|
|
454
|
+
allDay: true,
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
return {
|
|
458
|
+
start: sdCalendarSerialize(placement.startDay, placement.startMinutes, clock, transform),
|
|
459
|
+
end: sdCalendarSerialize(placement.endDay, placement.endMinutes, clock, transform),
|
|
460
|
+
allDay: false,
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
/** The target of a placed event where it is now. */
|
|
464
|
+
function sdCalendarTargetOf(placement) {
|
|
465
|
+
return {
|
|
466
|
+
allDay: placement.allDay,
|
|
467
|
+
startDay: placement.startDay,
|
|
468
|
+
startMinutes: placement.startMinutes,
|
|
469
|
+
endDay: placement.endDay,
|
|
470
|
+
endMinutes: placement.endMinutes,
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
/** The target of a placement moved by whole days, its times and kind kept. */
|
|
474
|
+
function sdCalendarShiftDays(placement, days) {
|
|
475
|
+
return {
|
|
476
|
+
allDay: placement.allDay,
|
|
477
|
+
startDay: sdCalendarAddDays(placement.startDay, days),
|
|
478
|
+
startMinutes: placement.startMinutes,
|
|
479
|
+
endDay: sdCalendarAddDays(placement.endDay, days),
|
|
480
|
+
endMinutes: placement.endMinutes,
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Target of `move(id, to)` (calendar.md §4.3): `to.allDay` (default `allDay`) picks the kind. All-day: the days of
|
|
485
|
+
* `to`, the duration in days kept without `to.end`. Timed: the span of `to`, or its start with the duration kept.
|
|
486
|
+
* `null` when a value cannot be read or the end is before the start.
|
|
487
|
+
*/
|
|
488
|
+
function sdCalendarMoveTarget(placement, to, allDay, clock) {
|
|
489
|
+
if (to.allDay ?? allDay) {
|
|
490
|
+
const startDay = sdCalendarReadDay(to.start, clock);
|
|
491
|
+
if (!startDay)
|
|
492
|
+
return null;
|
|
493
|
+
const endDay = to.end
|
|
494
|
+
? sdCalendarReadDay(to.end, clock)
|
|
495
|
+
: sdCalendarAddDays(startDay, sdCalendarDayDiff(placement.firstDay, placement.lastDay));
|
|
496
|
+
return endDay && endDay >= startDay ? { allDay: true, startDay, startMinutes: 0, endDay, endMinutes: 1440 } : null;
|
|
497
|
+
}
|
|
498
|
+
if (to.end !== null && to.end !== undefined) {
|
|
499
|
+
const next = sdCalendarPlace({ id: 'move', title: 'move', start: to.start, end: to.end }, clock);
|
|
500
|
+
return next ? sdCalendarTargetOf(next) : null;
|
|
501
|
+
}
|
|
502
|
+
const start = sdCalendarReadWallClock(to.start, clock);
|
|
503
|
+
if (!start)
|
|
504
|
+
return null;
|
|
505
|
+
const total = start.minutes + Math.round((placement.endInstant - placement.startInstant) / 60_000);
|
|
506
|
+
const days = Math.floor((total - 1) / MINUTES_PER_DAY);
|
|
507
|
+
return {
|
|
508
|
+
allDay: false,
|
|
509
|
+
startDay: start.day,
|
|
510
|
+
startMinutes: start.minutes,
|
|
511
|
+
endDay: sdCalendarAddDays(start.day, days),
|
|
512
|
+
endMinutes: total - days * MINUTES_PER_DAY,
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
/** Last calendar day a target covers (an end at 00:00 belongs to the day before). */
|
|
516
|
+
function sdCalendarLastDayOf(target) {
|
|
517
|
+
if (target.allDay || target.endDay === target.startDay || target.endMinutes > 0)
|
|
518
|
+
return target.endDay;
|
|
519
|
+
return sdCalendarAddDays(target.endDay, -1);
|
|
520
|
+
}
|
|
521
|
+
/** `step`: the input, then the configuration, then 30; a length that is not a divisor of 60 falls back to 30. */
|
|
522
|
+
function sdCalendarResolveStep(value, configuration) {
|
|
523
|
+
return sdCalendarNormalizeStep(value ?? configuration?.step ?? ɵSD_CALENDAR_DEFAULTS.step) ?? 30;
|
|
524
|
+
}
|
|
525
|
+
/** `firstDayOfWeek`: the input, then the configuration, then Monday; anything but 0–6 is Monday. */
|
|
526
|
+
function sdCalendarResolveFirstDayOfWeek(value, configuration) {
|
|
527
|
+
const day = value ?? configuration?.firstDayOfWeek ?? ɵSD_CALENDAR_DEFAULTS.firstDayOfWeek;
|
|
528
|
+
return Number.isInteger(day) && day >= 0 && day <= 6 ? day : ɵSD_CALENDAR_DEFAULTS.firstDayOfWeek;
|
|
529
|
+
}
|
|
530
|
+
/** `workingHours`: the input (`null` included), then the configuration, then Monday–Friday. */
|
|
531
|
+
function sdCalendarResolveWorkingHours(value, configuration) {
|
|
532
|
+
if (value !== undefined)
|
|
533
|
+
return value;
|
|
534
|
+
const configured = configuration?.workingHours;
|
|
535
|
+
return configured !== undefined ? configured : ɵSD_CALENDAR_DEFAULTS.workingHours;
|
|
536
|
+
}
|
|
537
|
+
/** Holidays by calendar day (the input, then the configuration); an unreadable date is left out, the first one wins. */
|
|
538
|
+
function sdCalendarHolidayMap(value, configuration, clock) {
|
|
539
|
+
const map = new Map();
|
|
540
|
+
for (const holiday of value ?? configuration?.holidays ?? []) {
|
|
541
|
+
const day = sdCalendarReadDay(holiday.date, clock);
|
|
542
|
+
if (day && !map.has(day))
|
|
543
|
+
map.set(day, holiday);
|
|
544
|
+
}
|
|
545
|
+
return map;
|
|
546
|
+
}
|
|
547
|
+
/** Day of `minDate` / `maxDate`: `'TODAY'` is `today`; an empty value is no bound. */
|
|
548
|
+
function sdCalendarBoundDay(value, today, clock) {
|
|
549
|
+
if (value === null || value === undefined || value === '')
|
|
550
|
+
return null;
|
|
551
|
+
return value === 'TODAY' ? today : sdCalendarReadDay(value, clock);
|
|
552
|
+
}
|
|
553
|
+
/** `day` is before `minDay` or after `maxDay` (a `null` bound does not limit). */
|
|
554
|
+
function sdCalendarOutOfRange(day, minDay, maxDay) {
|
|
555
|
+
return (!!minDay && day < minDay) || (!!maxDay && day > maxDay);
|
|
556
|
+
}
|
|
557
|
+
/** `'yyyy/MM/dd'` of a carrier (a local `Date` whose fields are a wall clock of the zone). */
|
|
558
|
+
function sdCalendarCarrierDay(carrier) {
|
|
559
|
+
return sdCalendarDay(carrier.getFullYear(), carrier.getMonth() + 1, carrier.getDate());
|
|
560
|
+
}
|
|
561
|
+
/** Identity of a visible range; two ranges with the same key are the same range. */
|
|
562
|
+
function sdCalendarRangeKey(range) {
|
|
563
|
+
return `${range.view}|${range.from}|${range.to}`;
|
|
564
|
+
}
|
|
565
|
+
function sdCalendarSameList(a, b) {
|
|
566
|
+
return a.length === b.length && a.every((value, index) => value === b[index]);
|
|
567
|
+
}
|
|
568
|
+
/** Client point of a mouse or touch event (the first touch, or the first changed one on `touchend`). */
|
|
569
|
+
function sdCalendarPointOf(event) {
|
|
570
|
+
if ('touches' in event) {
|
|
571
|
+
const touch = event.touches[0] ?? event.changedTouches[0];
|
|
572
|
+
return touch ? { x: touch.clientX, y: touch.clientY } : null;
|
|
573
|
+
}
|
|
574
|
+
return { x: event.clientX, y: event.clientY };
|
|
575
|
+
}
|
|
576
|
+
/** Duplicate, empty or non-string ids, or an empty title: the data set is refused (calendar §5, scheduler §12). */
|
|
577
|
+
function sdCalendarInvalidItems(items) {
|
|
578
|
+
const seen = new Set();
|
|
579
|
+
for (const item of items) {
|
|
580
|
+
if (typeof item.id !== 'string' || !item.id || seen.has(item.id) || typeof item.title !== 'string' || !item.title.trim())
|
|
581
|
+
return true;
|
|
582
|
+
seen.add(item.id);
|
|
583
|
+
}
|
|
584
|
+
return false;
|
|
585
|
+
}
|
|
586
|
+
const PALETTE = new Set(['primary', 'secondary', 'info', 'success', 'warning', 'error']);
|
|
587
|
+
/** `data-color` of an item (§8.1): a palette name as is, any other CSS colour as `custom` with the value aside. */
|
|
588
|
+
function sdCalendarColor(color) {
|
|
589
|
+
const value = color ?? 'primary';
|
|
590
|
+
return PALETTE.has(value) ? { color: value, customColor: null } : { color: 'custom', customColor: value };
|
|
591
|
+
}
|
|
592
|
+
/** A day off: an `off` holiday, or a weekday without working hours (never with `null` hours). */
|
|
593
|
+
function sdCalendarIsOffDay(day, holiday, hours) {
|
|
594
|
+
if (holiday?.type === 'off')
|
|
595
|
+
return true;
|
|
596
|
+
const working = sdCalendarWorkingRanges(hours, sdCalendarWeekday(day));
|
|
597
|
+
return working !== null && working.length === 0;
|
|
598
|
+
}
|
|
599
|
+
/** Weekdays of `hours` with a range that `sdCalendarWorkingRanges` leaves out (a dev-mode warning). */
|
|
600
|
+
function sdCalendarBrokenWeekdays(hours) {
|
|
601
|
+
if (!hours)
|
|
602
|
+
return [];
|
|
603
|
+
return Object.entries(hours)
|
|
604
|
+
.filter(([weekday, ranges]) => sdCalendarWorkingRanges(hours, Number(weekday)).length !== (ranges ?? []).length)
|
|
605
|
+
.map(([weekday]) => Number(weekday));
|
|
606
|
+
}
|
|
607
|
+
/** SC-27: the selected id is no longer in the loaded items (only once the load settled). */
|
|
608
|
+
function sdCalendarSelectionGone(selected, phase, items) {
|
|
609
|
+
return selected !== null && phase === 'idle' && !items.some(item => item.id === selected);
|
|
610
|
+
}
|
|
611
|
+
/** An id inside an attribute selector. */
|
|
612
|
+
function sdCalendarCssEscape(value) {
|
|
613
|
+
return typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(value) : value.replace(/["\\]/g, '\\$&');
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
function sdCalendarFormats(locale, language) {
|
|
617
|
+
const named = language === 'en';
|
|
618
|
+
const format = (options) => new Intl.DateTimeFormat(locale, { ...options, timeZone: 'UTC' });
|
|
619
|
+
return {
|
|
620
|
+
named,
|
|
621
|
+
weekday: format({ weekday: 'long' }),
|
|
622
|
+
monthShort: format({ month: 'short' }),
|
|
623
|
+
monthLong: format({ month: 'long' }),
|
|
624
|
+
date: format(named ? { month: 'short', day: 'numeric' } : { day: '2-digit', month: '2-digit' }),
|
|
625
|
+
dateYear: format(named ? { month: 'short', day: 'numeric', year: 'numeric' } : { day: '2-digit', month: '2-digit', year: 'numeric' }),
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
/** Noon UTC of a calendar day, only to name it with `Intl` in `timeZone: 'UTC'`. */
|
|
629
|
+
function sdCalendarUtcDay(day) {
|
|
630
|
+
const { year, month, day: date } = sdCalendarDayParts(day);
|
|
631
|
+
const value = new Date(0);
|
|
632
|
+
value.setUTCFullYear(year, month - 1, date);
|
|
633
|
+
value.setUTCHours(12);
|
|
634
|
+
return value;
|
|
635
|
+
}
|
|
636
|
+
function sdCalendarWeekdayLong(formats, day) {
|
|
637
|
+
return formats.weekday.format(sdCalendarUtcDay(day));
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Short date of a day: "Oct 22" / "Oct 22, 2026" in English, otherwise the numeric parts in the order of the
|
|
641
|
+
* locale joined by "/" ("22/10/2026", "2026/10/22").
|
|
642
|
+
*
|
|
643
|
+
* why: `Intl` writes vi-VN numeric dates with "-" in current Chromium, while the design shows "22/10".
|
|
644
|
+
*/
|
|
645
|
+
function sdCalendarDateText(formats, day, withYear) {
|
|
646
|
+
const format = withYear ? formats.dateYear : formats.date;
|
|
647
|
+
if (formats.named)
|
|
648
|
+
return format.format(sdCalendarUtcDay(day));
|
|
649
|
+
return format
|
|
650
|
+
.formatToParts(sdCalendarUtcDay(day))
|
|
651
|
+
.filter(part => part.type === 'day' || part.type === 'month' || part.type === 'year')
|
|
652
|
+
.map(part => part.value)
|
|
653
|
+
.join('/');
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Toolbar title. `month` names the month of `anchor`; `day` the day `from`; `week` the days `from`–`to` in one
|
|
657
|
+
* month ("19–25 Thg 10, 2026"), and any span across months or a `range` falls back to "22/10 – 04/11/2026".
|
|
658
|
+
*/
|
|
659
|
+
function sdCalendarTitle(kind, span, formats, t) {
|
|
660
|
+
const anchor = sdCalendarDayParts(span.anchor);
|
|
661
|
+
if (kind === 'month') {
|
|
662
|
+
return t('core.component.calendar.title-month', {
|
|
663
|
+
month: anchor.month,
|
|
664
|
+
monthName: formats.monthLong.format(sdCalendarUtcDay(sdCalendarDay(anchor.year, anchor.month, 1))),
|
|
665
|
+
year: anchor.year,
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
if (kind === 'day') {
|
|
669
|
+
return t('core.component.calendar.title-day', {
|
|
670
|
+
weekday: sdCalendarWeekdayLong(formats, span.from),
|
|
671
|
+
day: anchor.day,
|
|
672
|
+
month: anchor.month,
|
|
673
|
+
monthName: formats.monthLong.format(sdCalendarUtcDay(span.from)),
|
|
674
|
+
year: anchor.year,
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
const a = sdCalendarDayParts(span.from);
|
|
678
|
+
const b = sdCalendarDayParts(span.to);
|
|
679
|
+
if (kind === 'week' && a.year === b.year && a.month === b.month) {
|
|
680
|
+
return t('core.component.calendar.title-week', {
|
|
681
|
+
from: a.day,
|
|
682
|
+
to: b.day,
|
|
683
|
+
month: a.month,
|
|
684
|
+
monthName: formats.monthShort.format(sdCalendarUtcDay(span.from)),
|
|
685
|
+
year: a.year,
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
return t('core.component.calendar.title-range', {
|
|
689
|
+
from: sdCalendarDateText(formats, span.from, a.year !== b.year),
|
|
690
|
+
to: sdCalendarDateText(formats, span.to, true),
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Live-region text of an accepted move (calendar.md §15): "resized" when only the end changed (or the move was a
|
|
695
|
+
* resize), otherwise "moved" with the new day and time.
|
|
696
|
+
*/
|
|
697
|
+
function sdCalendarMovedText(title, target, from, to, source, formats, t) {
|
|
698
|
+
if (source === 'resize' || (from.start === to.start && from.end !== to.end)) {
|
|
699
|
+
return t('core.component.calendar.resized', {
|
|
700
|
+
title,
|
|
701
|
+
start: sdCalendarClockText(target.startMinutes),
|
|
702
|
+
end: sdCalendarClockText(target.endMinutes),
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
return t('core.component.calendar.moved', {
|
|
706
|
+
title,
|
|
707
|
+
weekday: sdCalendarWeekdayLong(formats, target.startDay),
|
|
708
|
+
date: sdCalendarDateText(formats, target.startDay, false),
|
|
709
|
+
time: target.allDay ? t('core.component.calendar.all-day') : sdCalendarClockText(target.startMinutes),
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
// Host plumbing shared by sd-calendar and sd-scheduler through the ɵ exports of the entry point: the width of the host
|
|
714
|
+
// (compact layout, SC-32), the one-minute clock of the now line, and the dev-mode diagnostics.
|
|
715
|
+
/** Width of the host from a `ResizeObserver` (SC-32); `null` until known, and always without `ResizeObserver` (SSR, tests). */
|
|
716
|
+
class SdCalendarHostWidth {
|
|
717
|
+
host;
|
|
718
|
+
#width = signal(null, /* @ts-ignore */
|
|
719
|
+
...(ngDevMode ? [{ debugName: "#width" }] : /* istanbul ignore next */ []));
|
|
720
|
+
width = this.#width.asReadonly();
|
|
721
|
+
#observer;
|
|
722
|
+
constructor(host, zone) {
|
|
723
|
+
this.host = host;
|
|
724
|
+
this.#observer =
|
|
725
|
+
typeof ResizeObserver === 'undefined'
|
|
726
|
+
? null
|
|
727
|
+
: new ResizeObserver(entries => {
|
|
728
|
+
const width = entries[entries.length - 1]?.contentRect.width;
|
|
729
|
+
if (width !== undefined && width !== untracked(this.#width))
|
|
730
|
+
zone.run(() => this.#width.set(width));
|
|
731
|
+
});
|
|
732
|
+
this.#observer?.observe(host);
|
|
733
|
+
}
|
|
734
|
+
/** Width before the first observer callback, so the first render already fits a narrow host. */
|
|
735
|
+
measureOnce() {
|
|
736
|
+
if (untracked(this.#width) !== null || typeof ResizeObserver === 'undefined')
|
|
737
|
+
return;
|
|
738
|
+
const width = this.host.getBoundingClientRect().width;
|
|
739
|
+
if (width > 0)
|
|
740
|
+
this.#width.set(width);
|
|
741
|
+
}
|
|
742
|
+
disconnect() {
|
|
743
|
+
this.#observer?.disconnect();
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* Calls `tick` every minute while running, outside the zone so the timer does not run change detection; `tick` itself
|
|
748
|
+
* enters the zone.
|
|
749
|
+
*/
|
|
750
|
+
class SdCalendarMinuteTimer {
|
|
751
|
+
zone;
|
|
752
|
+
tick;
|
|
753
|
+
#timer = null;
|
|
754
|
+
constructor(zone, tick) {
|
|
755
|
+
this.zone = zone;
|
|
756
|
+
this.tick = tick;
|
|
757
|
+
}
|
|
758
|
+
/** Starts or stops the timer. */
|
|
759
|
+
run(active) {
|
|
760
|
+
if (!active)
|
|
761
|
+
return this.stop();
|
|
762
|
+
if (this.#timer !== null)
|
|
763
|
+
return;
|
|
764
|
+
this.#timer = this.zone.runOutsideAngular(() => setInterval(() => this.zone.run(this.tick), 60_000));
|
|
765
|
+
}
|
|
766
|
+
stop() {
|
|
767
|
+
if (this.#timer !== null)
|
|
768
|
+
clearInterval(this.#timer);
|
|
769
|
+
this.#timer = null;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
/** Logs a dev-mode diagnostic once per instance and key, with the component's prefix (`[sd-calendar]`). */
|
|
773
|
+
class SdCalendarReporter {
|
|
774
|
+
prefix;
|
|
775
|
+
#reported = new Set();
|
|
776
|
+
constructor(prefix) {
|
|
777
|
+
this.prefix = prefix;
|
|
778
|
+
}
|
|
779
|
+
report(level, key, message) {
|
|
780
|
+
if (!isDevMode() || this.#reported.has(key))
|
|
781
|
+
return;
|
|
782
|
+
this.#reported.add(key);
|
|
783
|
+
console[level](`${this.prefix} ${message}`);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
/** The element is laid out right-to-left. */
|
|
787
|
+
function sdCalendarIsRtl(element) {
|
|
788
|
+
return getComputedStyle(element).direction === 'rtl';
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
class SdCalendarLoader {
|
|
792
|
+
/** Items of the last successful load; updated in place by accepted creates and moves. */
|
|
793
|
+
items = signal([], /* @ts-ignore */
|
|
794
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
795
|
+
phase = signal('idle', /* @ts-ignore */
|
|
796
|
+
...(ngDevMode ? [{ debugName: "phase" }] : /* istanbul ignore next */ []));
|
|
797
|
+
/** At least one load succeeded: later loads show the progress bar only, never the skeleton. */
|
|
798
|
+
everLoaded = signal(false, /* @ts-ignore */
|
|
799
|
+
...(ngDevMode ? [{ debugName: "everLoaded" }] : /* istanbul ignore next */ []));
|
|
800
|
+
#controller = null;
|
|
801
|
+
#key = null;
|
|
802
|
+
/**
|
|
803
|
+
* Aborts the running load and calls `call` for `key`. A different key clears the items first; the same key keeps
|
|
804
|
+
* them until the result arrives. A late or aborted result is dropped. `onError` runs for a real failure only, after
|
|
805
|
+
* the items were cleared (§13).
|
|
806
|
+
*/
|
|
807
|
+
async load(key, call, onError) {
|
|
808
|
+
const keep = key === this.#key;
|
|
809
|
+
this.#controller?.abort();
|
|
810
|
+
const controller = new AbortController();
|
|
811
|
+
this.#controller = controller;
|
|
812
|
+
this.#key = key;
|
|
813
|
+
if (!keep)
|
|
814
|
+
this.items.set([]);
|
|
815
|
+
this.phase.set(keep && this.everLoaded() ? 'reloading' : 'loading');
|
|
816
|
+
let items;
|
|
817
|
+
try {
|
|
818
|
+
items = await call(controller.signal);
|
|
819
|
+
}
|
|
820
|
+
catch (error) {
|
|
821
|
+
if (this.#controller !== controller || controller.signal.aborted)
|
|
822
|
+
return;
|
|
823
|
+
this.#controller = null;
|
|
824
|
+
this.items.set([]);
|
|
825
|
+
this.phase.set('error');
|
|
826
|
+
onError(error);
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
// why: a newer key, option or reload aborted this request; its late result must not replace newer data.
|
|
830
|
+
if (this.#controller !== controller || controller.signal.aborted)
|
|
831
|
+
return;
|
|
832
|
+
this.#controller = null;
|
|
833
|
+
this.items.set(Array.isArray(items) ? items : []);
|
|
834
|
+
this.everLoaded.set(true);
|
|
835
|
+
this.phase.set('idle');
|
|
836
|
+
}
|
|
837
|
+
/** Aborts the running load (destroy). */
|
|
838
|
+
abort() {
|
|
839
|
+
this.#controller?.abort();
|
|
840
|
+
this.#controller = null;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/** Evaluates a capability flag; an omitted flag allows (SC-05, SC-06). */
|
|
845
|
+
function sdCalendarAllows(state, context) {
|
|
846
|
+
if (state === undefined)
|
|
847
|
+
return true;
|
|
848
|
+
return typeof state === 'function' ? state(context) : state;
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Calls `onMove` and classifies its answer (SC-09 … SC-13): `true` or nothing accepts, `false` rejects, `'cancel'`
|
|
852
|
+
* cancels, a throw or a rejection is an error. Any answer that arrives after `request.signal` was aborted is `aborted`.
|
|
853
|
+
*/
|
|
854
|
+
async function sdCalendarCallMove(onMove, request) {
|
|
855
|
+
let result;
|
|
856
|
+
try {
|
|
857
|
+
result = await onMove(request);
|
|
858
|
+
}
|
|
859
|
+
catch (error) {
|
|
860
|
+
return request.signal.aborted ? { kind: 'aborted' } : { kind: 'error', error };
|
|
861
|
+
}
|
|
862
|
+
// why: a range change, reload, new option, lock or destroy aborted the request; its late answer must not apply.
|
|
863
|
+
if (request.signal.aborted)
|
|
864
|
+
return { kind: 'aborted' };
|
|
865
|
+
if (result === 'cancel')
|
|
866
|
+
return { kind: 'cancelled' };
|
|
867
|
+
if (result === false)
|
|
868
|
+
return { kind: 'rejected' };
|
|
869
|
+
return { kind: 'accepted' };
|
|
870
|
+
}
|
|
871
|
+
/** One waiting create or move per component (SC-14): a second `begin` is refused until the first one ends. */
|
|
872
|
+
class SdCalendarOperation {
|
|
873
|
+
#current = signal(null, /* @ts-ignore */
|
|
874
|
+
...(ngDevMode ? [{ debugName: "#current" }] : /* istanbul ignore next */ []));
|
|
875
|
+
/** Kind of the waiting operation, or `null`. */
|
|
876
|
+
kind = computed(() => this.#current()?.kind ?? null, /* @ts-ignore */
|
|
877
|
+
...(ngDevMode ? [{ debugName: "kind" }] : /* istanbul ignore next */ []));
|
|
878
|
+
busy = computed(() => this.#current() !== null, /* @ts-ignore */
|
|
879
|
+
...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
880
|
+
/** Starts an operation and returns its signal, or `null` while another one waits. */
|
|
881
|
+
begin(kind) {
|
|
882
|
+
if (this.#current())
|
|
883
|
+
return null;
|
|
884
|
+
const controller = new AbortController();
|
|
885
|
+
this.#current.set({ kind, controller });
|
|
886
|
+
return controller.signal;
|
|
887
|
+
}
|
|
888
|
+
/** Ends the operation of `signal`; a stale signal is ignored. */
|
|
889
|
+
end(signal) {
|
|
890
|
+
if (this.#current()?.controller.signal === signal)
|
|
891
|
+
this.#current.set(null);
|
|
892
|
+
}
|
|
893
|
+
/** Aborts the waiting operation when its kind is one of `kinds` (all kinds when omitted). Returns whether it did. */
|
|
894
|
+
abort(kinds) {
|
|
895
|
+
const current = this.#current();
|
|
896
|
+
if (!current || (kinds && !kinds.includes(current.kind)))
|
|
897
|
+
return false;
|
|
898
|
+
current.controller.abort();
|
|
899
|
+
this.#current.set(null);
|
|
900
|
+
return true;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* The move pipeline after the component's own checks (calendar.md §9.5 steps 4–6): one waiting operation (SC-14), the
|
|
905
|
+
* scope bar of an occurrence, the flags once more (SC-06), `onMove` and its five results (SC-09 … SC-13), focus
|
|
906
|
+
* (SC-29, SC-30) and the live region. Shared by sd-calendar and sd-scheduler.
|
|
907
|
+
*/
|
|
908
|
+
class SdCalendarMoveRunner {
|
|
909
|
+
host;
|
|
910
|
+
constructor(host) {
|
|
911
|
+
this.host = host;
|
|
912
|
+
}
|
|
913
|
+
async run(plan) {
|
|
914
|
+
const { operation, focus } = this.host;
|
|
915
|
+
const signal = operation.begin('move');
|
|
916
|
+
if (!signal)
|
|
917
|
+
return false;
|
|
918
|
+
const follow = plan.keyboard || focus.holds(plan.id);
|
|
919
|
+
const origin = follow ? document.activeElement : null;
|
|
920
|
+
const watch = focus.track(origin);
|
|
921
|
+
try {
|
|
922
|
+
return await this.#run(plan, signal, origin, watch, follow);
|
|
923
|
+
}
|
|
924
|
+
finally {
|
|
925
|
+
watch.stop();
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
async #run(plan, signal, origin, watch, follow) {
|
|
929
|
+
const { operation, announcer, focus, t } = this.host;
|
|
930
|
+
let restore = follow;
|
|
931
|
+
let scope = plan.recurring ? 'this' : null;
|
|
932
|
+
if (plan.recurring && plan.source !== 'api') {
|
|
933
|
+
// The scope bar takes the focus, so it goes back to the item when the bar closes, after a mouse drag too.
|
|
934
|
+
restore = true;
|
|
935
|
+
// §9.6: an occurrence waits at the proposal (dashed, no sync icon) until the user picks a scope.
|
|
936
|
+
plan.show(false);
|
|
937
|
+
scope = await this.host.ask(plan.title, signal);
|
|
938
|
+
if (signal.aborted)
|
|
939
|
+
return false;
|
|
940
|
+
if (scope === null) {
|
|
941
|
+
operation.end(signal);
|
|
942
|
+
plan.show(null);
|
|
943
|
+
announcer.announce(t('core.component.calendar.cancelled'));
|
|
944
|
+
focus.restore(plan.id, origin, watch);
|
|
945
|
+
return false;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
if (!plan.allowed()) {
|
|
949
|
+
operation.end(signal);
|
|
950
|
+
plan.show(null);
|
|
951
|
+
return false;
|
|
952
|
+
}
|
|
953
|
+
const request = Object.freeze(plan.request(scope, signal));
|
|
954
|
+
this.host.band(null);
|
|
955
|
+
plan.show(true);
|
|
956
|
+
announcer.announce(t('core.component.calendar.pending', { title: plan.title }));
|
|
957
|
+
const outcome = await sdCalendarCallMove(plan.onMove, request);
|
|
958
|
+
if (outcome.kind === 'aborted')
|
|
959
|
+
return false;
|
|
960
|
+
operation.end(signal);
|
|
961
|
+
plan.show(null);
|
|
962
|
+
if (restore)
|
|
963
|
+
focus.restore(plan.id, origin, watch);
|
|
964
|
+
if (outcome.kind === 'cancelled') {
|
|
965
|
+
announcer.announce(t('core.component.calendar.cancelled'));
|
|
966
|
+
return false;
|
|
967
|
+
}
|
|
968
|
+
if (outcome.kind === 'rejected' || outcome.kind === 'error') {
|
|
969
|
+
const message = t(`core.component.calendar.${outcome.kind === 'rejected' ? 'rejected' : 'error'}`);
|
|
970
|
+
this.host.band({ id: plan.id, message });
|
|
971
|
+
announcer.announce(message);
|
|
972
|
+
plan.fail(request, outcome);
|
|
973
|
+
return false;
|
|
974
|
+
}
|
|
975
|
+
announcer.announce(plan.accept(request));
|
|
976
|
+
if (scope === 'following' || scope === 'all')
|
|
977
|
+
this.host.reload();
|
|
978
|
+
return true;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* The create pipeline after the component's own checks (calendar.md §9.2, SC-14, SC-19 … SC-21): one waiting
|
|
983
|
+
* operation, the waiting dashed block, `onCreate`, the error band without the error text, and the late answer of an
|
|
984
|
+
* aborted create dropped (SC-15). Shared by sd-calendar and sd-scheduler.
|
|
985
|
+
*/
|
|
986
|
+
class SdCalendarCreateRunner {
|
|
987
|
+
host;
|
|
988
|
+
constructor(host) {
|
|
989
|
+
this.host = host;
|
|
990
|
+
}
|
|
991
|
+
async run(plan) {
|
|
992
|
+
const { operation, announcer, t } = this.host;
|
|
993
|
+
const signal = operation.begin('create');
|
|
994
|
+
if (!signal)
|
|
995
|
+
return;
|
|
996
|
+
this.host.band(null);
|
|
997
|
+
plan.show(true);
|
|
998
|
+
let created;
|
|
999
|
+
try {
|
|
1000
|
+
created = await plan.onCreate({ ...plan.args, signal });
|
|
1001
|
+
}
|
|
1002
|
+
catch {
|
|
1003
|
+
if (signal.aborted)
|
|
1004
|
+
return;
|
|
1005
|
+
operation.end(signal);
|
|
1006
|
+
plan.show(false);
|
|
1007
|
+
const message = t('core.component.calendar.create-error');
|
|
1008
|
+
this.host.band({ id: null, message });
|
|
1009
|
+
announcer.announce(message);
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
if (signal.aborted)
|
|
1013
|
+
return;
|
|
1014
|
+
operation.end(signal);
|
|
1015
|
+
plan.show(false);
|
|
1016
|
+
if (created)
|
|
1017
|
+
plan.accept(created);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* The scope bar of a recurring move (calendar.md §9.6): it holds the one waiting question and takes the focus on its
|
|
1022
|
+
* first answer when it opens.
|
|
1023
|
+
*/
|
|
1024
|
+
class SdCalendarScopeBar {
|
|
1025
|
+
#asking = signal(null, /* @ts-ignore */
|
|
1026
|
+
...(ngDevMode ? [{ debugName: "#asking" }] : /* istanbul ignore next */ []));
|
|
1027
|
+
/** The open question, for the template: `{ title }` or `null`. */
|
|
1028
|
+
asking = this.#asking.asReadonly();
|
|
1029
|
+
constructor(host, injector) {
|
|
1030
|
+
effect(() => {
|
|
1031
|
+
if (!this.#asking())
|
|
1032
|
+
return;
|
|
1033
|
+
untracked(() => afterNextRender(() => host.querySelector('[role="alertdialog"] [data-scope="this"]')?.focus(), { injector }));
|
|
1034
|
+
}, { injector });
|
|
1035
|
+
}
|
|
1036
|
+
/** Opens the bar; resolves with the answer, `null` for Cancel. An abort of `signal` (its operation) is Cancel. */
|
|
1037
|
+
ask(title, signal) {
|
|
1038
|
+
return new Promise(answer => {
|
|
1039
|
+
const asking = { title, answer };
|
|
1040
|
+
this.#asking.set(asking);
|
|
1041
|
+
// why: an operation aborted while the bar asks (the component destroyed included) must settle, or the move never
|
|
1042
|
+
// ends and its focus watch stays on document. An old signal does not close a newer question.
|
|
1043
|
+
const cancel = () => {
|
|
1044
|
+
if (untracked(this.#asking) === asking)
|
|
1045
|
+
this.answer(null);
|
|
1046
|
+
};
|
|
1047
|
+
if (signal?.aborted)
|
|
1048
|
+
cancel();
|
|
1049
|
+
else
|
|
1050
|
+
signal?.addEventListener('abort', cancel, { once: true });
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
/** Answers and closes the bar; `null` is Cancel. Nothing happens while the bar is closed. */
|
|
1054
|
+
answer(scope) {
|
|
1055
|
+
const asking = untracked(this.#asking);
|
|
1056
|
+
if (!asking)
|
|
1057
|
+
return;
|
|
1058
|
+
this.#asking.set(null);
|
|
1059
|
+
asking.answer(scope);
|
|
1060
|
+
}
|
|
1061
|
+
/** Esc on the bar is Cancel. */
|
|
1062
|
+
onKeydown(domEvent) {
|
|
1063
|
+
if (domEvent.key !== 'Escape')
|
|
1064
|
+
return;
|
|
1065
|
+
domEvent.preventDefault();
|
|
1066
|
+
domEvent.stopPropagation();
|
|
1067
|
+
this.answer(null);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
/** Text of the one live region of a component (SC-33). */
|
|
1071
|
+
class SdCalendarAnnouncer {
|
|
1072
|
+
#text = signal('', /* @ts-ignore */
|
|
1073
|
+
...(ngDevMode ? [{ debugName: "#text" }] : /* istanbul ignore next */ []));
|
|
1074
|
+
text = this.#text.asReadonly();
|
|
1075
|
+
/** Writes the live region; the same text twice in a row gets a trailing no-break space so it is read again (R1-G9). */
|
|
1076
|
+
announce(message) {
|
|
1077
|
+
const current = untracked(this.#text);
|
|
1078
|
+
this.#text.set(current === message ? `${message}\xa0` : message);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Puts the focus back on an item after a move that started from the keyboard or the scope bar (SC-29, SC-30). The
|
|
1083
|
+
* item may first need the next range to load, so `pending()` runs again after every load.
|
|
1084
|
+
*/
|
|
1085
|
+
class SdCalendarFocusKeeper {
|
|
1086
|
+
host;
|
|
1087
|
+
injector;
|
|
1088
|
+
selector;
|
|
1089
|
+
scopeSelector;
|
|
1090
|
+
#target = null;
|
|
1091
|
+
constructor(host, injector,
|
|
1092
|
+
/** The focusable element of an item, from its id. */
|
|
1093
|
+
selector,
|
|
1094
|
+
/** The scope bar: a focus inside it is the component's own, the bar is about to be removed (R2 A-18). */
|
|
1095
|
+
scopeSelector) {
|
|
1096
|
+
this.host = host;
|
|
1097
|
+
this.injector = injector;
|
|
1098
|
+
this.selector = selector;
|
|
1099
|
+
this.scopeSelector = scopeSelector;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Watches the focus while a move waits: a focus the user puts outside `origin` and the scope bar abandons the item
|
|
1103
|
+
* (SC-30), even when that element loses the focus to `body` before the move ends (as sd-kanban, RX #4). A focus that
|
|
1104
|
+
* falls back to `body` alone (the item re-rendered or disabled) does not.
|
|
1105
|
+
*/
|
|
1106
|
+
track(origin) {
|
|
1107
|
+
let abandoned = false;
|
|
1108
|
+
const listener = (event) => {
|
|
1109
|
+
// why: focusin always targets an element (a window focus does not fire it).
|
|
1110
|
+
const target = event.target;
|
|
1111
|
+
if (target === document.body || target === origin)
|
|
1112
|
+
return;
|
|
1113
|
+
if (this.host.querySelector(this.scopeSelector)?.contains(target))
|
|
1114
|
+
return;
|
|
1115
|
+
abandoned = true;
|
|
1116
|
+
};
|
|
1117
|
+
document.addEventListener('focusin', listener, true);
|
|
1118
|
+
return { abandoned: () => abandoned, stop: () => document.removeEventListener('focusin', listener, true) };
|
|
1119
|
+
}
|
|
1120
|
+
/** Whether the focus is on the item `id` or inside it (review RX #6). */
|
|
1121
|
+
holds(id) {
|
|
1122
|
+
const active = document.activeElement;
|
|
1123
|
+
return !!active && this.host.contains(active) && !!active.closest(this.selector(id));
|
|
1124
|
+
}
|
|
1125
|
+
/** Focuses `id` unless the user moved the focus somewhere else while waiting (`origin` is where it started). */
|
|
1126
|
+
restore(id, origin, watch) {
|
|
1127
|
+
if (watch?.abandoned())
|
|
1128
|
+
return;
|
|
1129
|
+
const active = document.activeElement;
|
|
1130
|
+
const inScopeBar = !!active && !!this.host.querySelector(this.scopeSelector)?.contains(active);
|
|
1131
|
+
if (active && active !== document.body && active !== origin && active.isConnected && !inScopeBar)
|
|
1132
|
+
return;
|
|
1133
|
+
this.#target = id;
|
|
1134
|
+
this.pending();
|
|
1135
|
+
}
|
|
1136
|
+
/** Focuses the waiting item once it is rendered. */
|
|
1137
|
+
pending() {
|
|
1138
|
+
if (!this.#target)
|
|
1139
|
+
return;
|
|
1140
|
+
afterNextRender(() => {
|
|
1141
|
+
const id = this.#target;
|
|
1142
|
+
if (!id)
|
|
1143
|
+
return;
|
|
1144
|
+
const element = this.host.querySelector(this.selector(id));
|
|
1145
|
+
if (!element)
|
|
1146
|
+
return;
|
|
1147
|
+
this.#target = null;
|
|
1148
|
+
element.focus();
|
|
1149
|
+
}, { injector: this.injector });
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/** Replaces the content of an event block; frame, colour, handle and states stay. `let-event`. */
|
|
1154
|
+
class SdCalendarEventTemplateDirective {
|
|
1155
|
+
template = inject(TemplateRef);
|
|
1156
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
1157
|
+
return true;
|
|
1158
|
+
}
|
|
1159
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdCalendarEventTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1160
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.5", type: SdCalendarEventTemplateDirective, isStandalone: true, selector: "ng-template[sdCalendarEventTemplate]", ngImport: i0 });
|
|
1161
|
+
}
|
|
1162
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdCalendarEventTemplateDirective, decorators: [{
|
|
1163
|
+
type: Directive,
|
|
1164
|
+
args: [{ selector: 'ng-template[sdCalendarEventTemplate]', standalone: true }]
|
|
1165
|
+
}] });
|
|
1166
|
+
/** Replaces the part of a month cell under the day number (for example a timesheet code). `let-date`. */
|
|
1167
|
+
class SdCalendarDayCellTemplateDirective {
|
|
1168
|
+
template = inject(TemplateRef);
|
|
1169
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
1170
|
+
return true;
|
|
1171
|
+
}
|
|
1172
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdCalendarDayCellTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1173
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.5", type: SdCalendarDayCellTemplateDirective, isStandalone: true, selector: "ng-template[sdCalendarDayCellTemplate]", ngImport: i0 });
|
|
1174
|
+
}
|
|
1175
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdCalendarDayCellTemplateDirective, decorators: [{
|
|
1176
|
+
type: Directive,
|
|
1177
|
+
args: [{ selector: 'ng-template[sdCalendarDayCellTemplate]', standalone: true }]
|
|
1178
|
+
}] });
|
|
1179
|
+
/**
|
|
1180
|
+
* Content of the place column of an agenda row, shown when the host is at least 720px wide (§11). Below that width
|
|
1181
|
+
* the column, and the template, are left out. `let-event`.
|
|
1182
|
+
*/
|
|
1183
|
+
class SdCalendarAgendaItemTemplateDirective {
|
|
1184
|
+
template = inject(TemplateRef);
|
|
1185
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
1186
|
+
return true;
|
|
1187
|
+
}
|
|
1188
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdCalendarAgendaItemTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1189
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.5", type: SdCalendarAgendaItemTemplateDirective, isStandalone: true, selector: "ng-template[sdCalendarAgendaItemTemplate]", ngImport: i0 });
|
|
1190
|
+
}
|
|
1191
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdCalendarAgendaItemTemplateDirective, decorators: [{
|
|
1192
|
+
type: Directive,
|
|
1193
|
+
args: [{ selector: 'ng-template[sdCalendarAgendaItemTemplate]', standalone: true }]
|
|
1194
|
+
}] });
|
|
1195
|
+
/** Replaces the empty state of the agenda view. `let-range`. */
|
|
1196
|
+
class SdCalendarEmptyTemplateDirective {
|
|
1197
|
+
template = inject(TemplateRef);
|
|
1198
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
1199
|
+
return true;
|
|
1200
|
+
}
|
|
1201
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdCalendarEmptyTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1202
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.5", type: SdCalendarEmptyTemplateDirective, isStandalone: true, selector: "ng-template[sdCalendarEmptyTemplate]", ngImport: i0 });
|
|
1203
|
+
}
|
|
1204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdCalendarEmptyTemplateDirective, decorators: [{
|
|
1205
|
+
type: Directive,
|
|
1206
|
+
args: [{ selector: 'ng-template[sdCalendarEmptyTemplate]', standalone: true }]
|
|
1207
|
+
}] });
|
|
1208
|
+
|
|
1209
|
+
const ALL_VIEWS = ['month', 'week', 'day', 'agenda'];
|
|
1210
|
+
/** Baseline hour height (px) the content tiers of a block are measured against (§8.2). */
|
|
1211
|
+
const HOUR_HEIGHT = 48;
|
|
1212
|
+
const MINUTE = 60_000;
|
|
1213
|
+
/** Pointer travel (px) under which a press is a click (§9.1). */
|
|
1214
|
+
const CLICK_SLOP = 5;
|
|
1215
|
+
/** Horizontal travel (px) of a swipe that changes the day or week (§12). */
|
|
1216
|
+
const SWIPE = 60;
|
|
1217
|
+
/** Where the first-load skeleton draws its blocks: [day index, start minute, minutes]. */
|
|
1218
|
+
const SKELETON = [
|
|
1219
|
+
[0, 540, 60],
|
|
1220
|
+
[1, 600, 90],
|
|
1221
|
+
[2, 480, 45],
|
|
1222
|
+
[3, 780, 120],
|
|
1223
|
+
[4, 570, 60],
|
|
1224
|
+
];
|
|
1225
|
+
let nextCalendarId = 0;
|
|
1226
|
+
/** Month, week, day and agenda calendar with grouped capabilities: `dataSource`, `create` and `move` (see `sd-calendar.md`). */
|
|
1227
|
+
class SdCalendar {
|
|
1228
|
+
#clock = inject(SdDateTimeService);
|
|
1229
|
+
#i18n = inject(I18nService);
|
|
1230
|
+
#configuration = inject(SD_CALENDAR_CONFIGURATION, { optional: true });
|
|
1231
|
+
#zone = inject(NgZone);
|
|
1232
|
+
#host = inject(ElementRef);
|
|
1233
|
+
#injector = inject(Injector);
|
|
1234
|
+
#reporter = new SdCalendarReporter('[sd-calendar]');
|
|
1235
|
+
#t = (key, params) => this.#i18n.t(key, params);
|
|
1236
|
+
baseId = `sd-calendar-${nextCalendarId++}`;
|
|
1237
|
+
/** Data source and capabilities. A new object is the signal to load again. */
|
|
1238
|
+
option = input.required(/* @ts-ignore */
|
|
1239
|
+
...(ngDevMode ? [{ debugName: "option" }] : /* istanbul ignore next */ []));
|
|
1240
|
+
/** Layout on screen; one of `views`, otherwise the first of `views`. */
|
|
1241
|
+
view = model('week', /* @ts-ignore */
|
|
1242
|
+
...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
1243
|
+
/** Anchor day; the calendar writes back `'yyyy/MM/dd'` (no `transform`). Defaults to today in the zone. */
|
|
1244
|
+
date = model(undefined, /* @ts-ignore */
|
|
1245
|
+
...(ngDevMode ? [{ debugName: "date" }] : /* istanbul ignore next */ []));
|
|
1246
|
+
/** Id of the selected event; back to `null` when the event is no longer loaded. */
|
|
1247
|
+
selectedId = model(null, /* @ts-ignore */
|
|
1248
|
+
...(ngDevMode ? [{ debugName: "selectedId" }] : /* istanbul ignore next */ []));
|
|
1249
|
+
/** Views offered by the switcher, in this order. */
|
|
1250
|
+
views = input(ALL_VIEWS, /* @ts-ignore */
|
|
1251
|
+
...(ngDevMode ? [{ debugName: "views" }] : /* istanbul ignore next */ []));
|
|
1252
|
+
/** Minutes of one slot, a divisor of 60. Configuration, then 30. */
|
|
1253
|
+
step = input(undefined, /* @ts-ignore */
|
|
1254
|
+
...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
|
|
1255
|
+
/** 0–6, 0 is Sunday. Configuration, then 1. */
|
|
1256
|
+
firstDayOfWeek = input(undefined, /* @ts-ignore */
|
|
1257
|
+
...(ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []));
|
|
1258
|
+
/** Hides Saturday and Sunday in the week and month views. */
|
|
1259
|
+
hideWeekends = input(false, { ...(ngDevMode ? { debugName: "hideWeekends" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1260
|
+
/** `null` turns the off-hours shading and days off by weekday off. Configuration, then Monday–Friday. */
|
|
1261
|
+
workingHours = input(undefined, /* @ts-ignore */
|
|
1262
|
+
...(ngDevMode ? [{ debugName: "workingHours" }] : /* istanbul ignore next */ []));
|
|
1263
|
+
/** Configuration, then none. */
|
|
1264
|
+
holidays = input(undefined, /* @ts-ignore */
|
|
1265
|
+
...(ngDevMode ? [{ debugName: "holidays" }] : /* istanbul ignore next */ []));
|
|
1266
|
+
/** First day that can be shown and edited, compared as a calendar day in the zone. */
|
|
1267
|
+
minDate = input(undefined, /* @ts-ignore */
|
|
1268
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
1269
|
+
/** Last day that can be shown and edited, compared as a calendar day in the zone. */
|
|
1270
|
+
maxDate = input(undefined, /* @ts-ignore */
|
|
1271
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
1272
|
+
/** `'HH:mm'` the week and day views open at. Configuration, then the earliest working hour, then 08:00. */
|
|
1273
|
+
scrollTime = input(undefined, /* @ts-ignore */
|
|
1274
|
+
...(ngDevMode ? [{ debugName: "scrollTime" }] : /* istanbul ignore next */ []));
|
|
1275
|
+
/** Days of the agenda view, 1–62. */
|
|
1276
|
+
agendaDays = input(14, /* @ts-ignore */
|
|
1277
|
+
...(ngDevMode ? [{ debugName: "agendaDays" }] : /* istanbul ignore next */ []));
|
|
1278
|
+
/** Fades events that have ended. */
|
|
1279
|
+
dimPast = input(false, { ...(ngDevMode ? { debugName: "dimPast" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1280
|
+
/** Serialization of the values the calendar emits; see "Date values" in `sd-calendar.md`. */
|
|
1281
|
+
transform = input(undefined, /* @ts-ignore */
|
|
1282
|
+
...(ngDevMode ? [{ debugName: "transform" }] : /* istanbul ignore next */ []));
|
|
1283
|
+
/** No create, move or selection; events leave the tab order. Navigation still works. */
|
|
1284
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1285
|
+
/** No create or move. Selection and navigation still work. */
|
|
1286
|
+
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1287
|
+
/** Accessible name of the region; defaults to the translated "Calendar". */
|
|
1288
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
1289
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
1290
|
+
/** E2E scope: `data-autoid="components-calendar-{autoId}"` and derived child ids. */
|
|
1291
|
+
autoId = input(undefined, /* @ts-ignore */
|
|
1292
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1293
|
+
/** An event was clicked, tapped or activated with Enter/Space. */
|
|
1294
|
+
sdSelect = output();
|
|
1295
|
+
/** Once on init, then whenever `from`, `to` or the view on screen changes. */
|
|
1296
|
+
sdRangeChange = output();
|
|
1297
|
+
/** `onMove` accepted and the data changed. */
|
|
1298
|
+
sdMove = output();
|
|
1299
|
+
/** `onMove` rejected or failed. */
|
|
1300
|
+
sdMoveError = output();
|
|
1301
|
+
/** `onLoad` threw or rejected (never for an aborted load). */
|
|
1302
|
+
sdLoadError = output();
|
|
1303
|
+
eventTemplate = contentChild(SdCalendarEventTemplateDirective, /* @ts-ignore */
|
|
1304
|
+
...(ngDevMode ? [{ debugName: "eventTemplate" }] : /* istanbul ignore next */ []));
|
|
1305
|
+
dayCellTemplate = contentChild(SdCalendarDayCellTemplateDirective, /* @ts-ignore */
|
|
1306
|
+
...(ngDevMode ? [{ debugName: "dayCellTemplate" }] : /* istanbul ignore next */ []));
|
|
1307
|
+
agendaItemTemplate = contentChild(SdCalendarAgendaItemTemplateDirective, /* @ts-ignore */
|
|
1308
|
+
...(ngDevMode ? [{ debugName: "agendaItemTemplate" }] : /* istanbul ignore next */ []));
|
|
1309
|
+
emptyTemplate = contentChild(SdCalendarEmptyTemplateDirective, /* @ts-ignore */
|
|
1310
|
+
...(ngDevMode ? [{ debugName: "emptyTemplate" }] : /* istanbul ignore next */ []));
|
|
1311
|
+
scroller = viewChild('scroller', /* @ts-ignore */
|
|
1312
|
+
...(ngDevMode ? [{ debugName: "scroller" }] : /* istanbul ignore next */ []));
|
|
1313
|
+
gridElement = viewChild('grid', /* @ts-ignore */
|
|
1314
|
+
...(ngDevMode ? [{ debugName: "gridElement" }] : /* istanbul ignore next */ []));
|
|
1315
|
+
#loader = new SdCalendarLoader();
|
|
1316
|
+
#operation = new SdCalendarOperation();
|
|
1317
|
+
#now = signal(this.#clock.now(), /* @ts-ignore */
|
|
1318
|
+
...(ngDevMode ? [{ debugName: "#now" }] : /* istanbul ignore next */ []));
|
|
1319
|
+
#hostWidth = new SdCalendarHostWidth(this.#host.nativeElement, this.#zone);
|
|
1320
|
+
#width = this.#hostWidth.width;
|
|
1321
|
+
#timer = new SdCalendarMinuteTimer(this.#zone, () => this.#now.set(this.#clock.now()));
|
|
1322
|
+
#announcer = new SdCalendarAnnouncer();
|
|
1323
|
+
#focus = new SdCalendarFocusKeeper(this.#host.nativeElement, this.#injector, id => `[data-event-id="${sdCalendarCssEscape(id)}"][tabindex]`, '.sd-calendar__scope');
|
|
1324
|
+
#edge = new SdCalendarEdgeScroller(this.#zone);
|
|
1325
|
+
/** Move waiting for `onMove`: the event is drawn at `target` (§8.3, saving). */
|
|
1326
|
+
#moving = signal(null, /* @ts-ignore */
|
|
1327
|
+
...(ngDevMode ? [{ debugName: "#moving" }] : /* istanbul ignore next */ []));
|
|
1328
|
+
/** Scope bar of a recurring event (§9.6); it holds the one waiting operation until answered. */
|
|
1329
|
+
scopeBar = new SdCalendarScopeBar(this.#host.nativeElement, this.#injector);
|
|
1330
|
+
#ghost = signal(null, /* @ts-ignore */
|
|
1331
|
+
...(ngDevMode ? [{ debugName: "#ghost" }] : /* istanbul ignore next */ []));
|
|
1332
|
+
#failure = signal(null, /* @ts-ignore */
|
|
1333
|
+
...(ngDevMode ? [{ debugName: "#failure" }] : /* istanbul ignore next */ []));
|
|
1334
|
+
#drag = signal(null, /* @ts-ignore */
|
|
1335
|
+
...(ngDevMode ? [{ debugName: "#drag" }] : /* istanbul ignore next */ []));
|
|
1336
|
+
#resize = signal(null, /* @ts-ignore */
|
|
1337
|
+
...(ngDevMode ? [{ debugName: "#resize" }] : /* istanbul ignore next */ []));
|
|
1338
|
+
#cursor = signal(null, /* @ts-ignore */
|
|
1339
|
+
...(ngDevMode ? [{ debugName: "#cursor" }] : /* istanbul ignore next */ []));
|
|
1340
|
+
#monthFocus = signal(null, /* @ts-ignore */
|
|
1341
|
+
...(ngDevMode ? [{ debugName: "#monthFocus" }] : /* istanbul ignore next */ []));
|
|
1342
|
+
#runner = new SdCalendarMoveRunner({
|
|
1343
|
+
operation: this.#operation,
|
|
1344
|
+
announcer: this.#announcer,
|
|
1345
|
+
focus: this.#focus,
|
|
1346
|
+
t: this.#t,
|
|
1347
|
+
ask: (title, signal) => this.scopeBar.ask(title, signal),
|
|
1348
|
+
band: failure => this.#failure.set(failure),
|
|
1349
|
+
reload: () => this.reload(),
|
|
1350
|
+
});
|
|
1351
|
+
#creator = new SdCalendarCreateRunner({
|
|
1352
|
+
operation: this.#operation,
|
|
1353
|
+
announcer: this.#announcer,
|
|
1354
|
+
t: this.#t,
|
|
1355
|
+
band: failure => this.#failure.set(failure),
|
|
1356
|
+
});
|
|
1357
|
+
#emittedKey = null;
|
|
1358
|
+
#lastOption = null;
|
|
1359
|
+
/** A drag just ended: the click that follows its mouseup must not select. Reset on the next press. */
|
|
1360
|
+
#justDragged = false;
|
|
1361
|
+
#press = null;
|
|
1362
|
+
#dragSession = null;
|
|
1363
|
+
#dragPointer = null;
|
|
1364
|
+
/** Where the press that may start a drag happened (CDK's start event is the move that crossed the threshold). */
|
|
1365
|
+
#pickup = null;
|
|
1366
|
+
#resizeSession = null;
|
|
1367
|
+
#stripPress = null;
|
|
1368
|
+
/** Host narrower than 600px (§12): measured on the host, not the viewport. */
|
|
1369
|
+
compact = computed(() => {
|
|
1370
|
+
const width = this.#width();
|
|
1371
|
+
return width !== null && width < 600;
|
|
1372
|
+
}, /* @ts-ignore */
|
|
1373
|
+
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
1374
|
+
/** Host at least 720px wide: the agenda shows the place column. */
|
|
1375
|
+
wide = computed(() => (this.#width() ?? 0) >= 720, /* @ts-ignore */
|
|
1376
|
+
...(ngDevMode ? [{ debugName: "wide" }] : /* istanbul ignore next */ []));
|
|
1377
|
+
phase = this.#loader.phase.asReadonly();
|
|
1378
|
+
announcement = this.#announcer.text;
|
|
1379
|
+
failure = this.#failure.asReadonly();
|
|
1380
|
+
ghost = this.#ghost.asReadonly();
|
|
1381
|
+
dragProposal = this.#drag.asReadonly();
|
|
1382
|
+
cursor = this.#cursor.asReadonly();
|
|
1383
|
+
scopeMessageId = `${this.baseId}-scope`;
|
|
1384
|
+
busy = computed(() => this.#loader.phase() === 'loading' || this.#loader.phase() === 'reloading', /* @ts-ignore */
|
|
1385
|
+
...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
1386
|
+
skeleton = computed(() => this.#loader.phase() === 'loading' && !this.#loader.everLoaded(), /* @ts-ignore */
|
|
1387
|
+
...(ngDevMode ? [{ debugName: "skeleton" }] : /* istanbul ignore next */ []));
|
|
1388
|
+
rootAutoId = computed(() => (this.autoId() ? `components-calendar-${this.autoId()}` : null), /* @ts-ignore */
|
|
1389
|
+
...(ngDevMode ? [{ debugName: "rootAutoId" }] : /* istanbul ignore next */ []));
|
|
1390
|
+
regionLabel = computed(() => this.ariaLabel() || this.#i18n.t('core.component.calendar.label'), /* @ts-ignore */
|
|
1391
|
+
...(ngDevMode ? [{ debugName: "regionLabel" }] : /* istanbul ignore next */ []));
|
|
1392
|
+
stepValue = computed(() => sdCalendarResolveStep(this.step(), this.#configuration), /* @ts-ignore */
|
|
1393
|
+
...(ngDevMode ? [{ debugName: "stepValue" }] : /* istanbul ignore next */ []));
|
|
1394
|
+
#firstDayOfWeek = computed(() => sdCalendarResolveFirstDayOfWeek(this.firstDayOfWeek(), this.#configuration), /* @ts-ignore */
|
|
1395
|
+
...(ngDevMode ? [{ debugName: "#firstDayOfWeek" }] : /* istanbul ignore next */ []));
|
|
1396
|
+
#workingHours = computed(() => sdCalendarResolveWorkingHours(this.workingHours(), this.#configuration), /* @ts-ignore */
|
|
1397
|
+
...(ngDevMode ? [{ debugName: "#workingHours" }] : /* istanbul ignore next */ []));
|
|
1398
|
+
#holidays = computed(() => sdCalendarHolidayMap(this.holidays(), this.#configuration, this.#clock), /* @ts-ignore */
|
|
1399
|
+
...(ngDevMode ? [{ debugName: "#holidays" }] : /* istanbul ignore next */ []));
|
|
1400
|
+
today = computed(() => sdCalendarCarrierDay(this.#now()), /* @ts-ignore */
|
|
1401
|
+
...(ngDevMode ? [{ debugName: "today" }] : /* istanbul ignore next */ []));
|
|
1402
|
+
#nowMinutes = computed(() => this.#now().getHours() * 60 + this.#now().getMinutes(), /* @ts-ignore */
|
|
1403
|
+
...(ngDevMode ? [{ debugName: "#nowMinutes" }] : /* istanbul ignore next */ []));
|
|
1404
|
+
#nowInstant = computed(() => this.#clock.fromWallClock(this.#now()).getTime(), /* @ts-ignore */
|
|
1405
|
+
...(ngDevMode ? [{ debugName: "#nowInstant" }] : /* istanbul ignore next */ []));
|
|
1406
|
+
#anchor = computed(() => {
|
|
1407
|
+
const value = this.date();
|
|
1408
|
+
return (value === null || value === undefined ? null : sdCalendarReadDay(value, this.#clock)) ?? this.today();
|
|
1409
|
+
}, /* @ts-ignore */
|
|
1410
|
+
...(ngDevMode ? [{ debugName: "#anchor" }] : /* istanbul ignore next */ []));
|
|
1411
|
+
#minDay = computed(() => sdCalendarBoundDay(this.minDate(), this.today(), this.#clock), /* @ts-ignore */
|
|
1412
|
+
...(ngDevMode ? [{ debugName: "#minDay" }] : /* istanbul ignore next */ []));
|
|
1413
|
+
#maxDay = computed(() => sdCalendarBoundDay(this.maxDate(), this.today(), this.#clock), /* @ts-ignore */
|
|
1414
|
+
...(ngDevMode ? [{ debugName: "#maxDay" }] : /* istanbul ignore next */ []));
|
|
1415
|
+
/** Views of the switcher; the week button is hidden while compact (§12). */
|
|
1416
|
+
viewOptions = computed(() => {
|
|
1417
|
+
const views = this.views().length ? this.views() : ALL_VIEWS;
|
|
1418
|
+
return this.compact() ? views.filter(view => view !== 'week') : views;
|
|
1419
|
+
}, /* @ts-ignore */
|
|
1420
|
+
...(ngDevMode ? [{ debugName: "viewOptions" }] : /* istanbul ignore next */ []));
|
|
1421
|
+
activeView = computed(() => {
|
|
1422
|
+
const views = this.views().length ? this.views() : ALL_VIEWS;
|
|
1423
|
+
return views.includes(this.view()) ? this.view() : views[0];
|
|
1424
|
+
}, /* @ts-ignore */
|
|
1425
|
+
...(ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []));
|
|
1426
|
+
/** What is drawn: a compact week is drawn as a day. */
|
|
1427
|
+
displayView = computed(() => this.compact() && this.activeView() === 'week' ? 'day' : this.activeView(), /* @ts-ignore */
|
|
1428
|
+
...(ngDevMode ? [{ debugName: "displayView" }] : /* istanbul ignore next */ []));
|
|
1429
|
+
timeView = computed(() => this.displayView() === 'week' || this.displayView() === 'day', /* @ts-ignore */
|
|
1430
|
+
...(ngDevMode ? [{ debugName: "timeView" }] : /* istanbul ignore next */ []));
|
|
1431
|
+
#rangeInput = computed(() => ({
|
|
1432
|
+
view: this.displayView(),
|
|
1433
|
+
date: this.#anchor(),
|
|
1434
|
+
firstDayOfWeek: this.#firstDayOfWeek(),
|
|
1435
|
+
hideWeekends: this.hideWeekends(),
|
|
1436
|
+
agendaDays: sdCalendarClampAgendaDays(this.agendaDays()),
|
|
1437
|
+
}), /* @ts-ignore */
|
|
1438
|
+
...(ngDevMode ? [{ debugName: "#rangeInput" }] : /* istanbul ignore next */ []));
|
|
1439
|
+
visible = computed(() => sdCalendarVisibleRange(this.#rangeInput()), { ...(ngDevMode ? { debugName: "visible" } : /* istanbul ignore next */ {}), equal: (a, b) => sdCalendarRangeKey(a) === sdCalendarRangeKey(b) });
|
|
1440
|
+
days = computed(() => sdCalendarVisibleDays(this.#rangeInput()), { ...(ngDevMode ? { debugName: "days" } : /* istanbul ignore next */ {}), equal: sdCalendarSameList });
|
|
1441
|
+
/** Duplicate or empty id, or an empty title: the whole data set is refused (§5). */
|
|
1442
|
+
invalid = computed(() => sdCalendarInvalidItems(this.#loader.items()), /* @ts-ignore */
|
|
1443
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
1444
|
+
/** No create and no move (§4.1, §13): disabled, readonly, loading, load error or invalid data. */
|
|
1445
|
+
locked = computed(() => this.disabled() || this.readonly() || this.busy() || this.#loader.phase() === 'error' || this.invalid(), /* @ts-ignore */
|
|
1446
|
+
...(ngDevMode ? [{ debugName: "locked" }] : /* istanbul ignore next */ []));
|
|
1447
|
+
/** Create is on: `option.create` and not locked. */
|
|
1448
|
+
canCreate = computed(() => !!this.option().create && !this.locked(), /* @ts-ignore */
|
|
1449
|
+
...(ngDevMode ? [{ debugName: "canCreate" }] : /* istanbul ignore next */ []));
|
|
1450
|
+
#formats = computed(() => sdCalendarFormats(this.#i18n.locale(), this.#i18n.language()), /* @ts-ignore */
|
|
1451
|
+
...(ngDevMode ? [{ debugName: "#formats" }] : /* istanbul ignore next */ []));
|
|
1452
|
+
title = computed(() => {
|
|
1453
|
+
const view = this.displayView();
|
|
1454
|
+
const { from, to } = this.visible();
|
|
1455
|
+
const kind = view === 'month' || (this.compact() && view === 'day') ? 'month' : view === 'agenda' ? 'range' : view;
|
|
1456
|
+
return sdCalendarTitle(kind, { anchor: this.#anchor(), from, to }, this.#formats(), (key, params) => this.#i18n.t(key, params));
|
|
1457
|
+
}, /* @ts-ignore */
|
|
1458
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
1459
|
+
prevLabel = computed(() => this.#navLabel('prev'), /* @ts-ignore */
|
|
1460
|
+
...(ngDevMode ? [{ debugName: "prevLabel" }] : /* istanbul ignore next */ []));
|
|
1461
|
+
nextLabel = computed(() => this.#navLabel('next'), /* @ts-ignore */
|
|
1462
|
+
...(ngDevMode ? [{ debugName: "nextLabel" }] : /* istanbul ignore next */ []));
|
|
1463
|
+
prevDisabled = computed(() => {
|
|
1464
|
+
const min = this.#minDay();
|
|
1465
|
+
return !!min && sdCalendarVisibleRange({ ...this.#rangeInput(), date: sdCalendarShiftDate(this.#rangeInput(), -1) }).to < min;
|
|
1466
|
+
}, /* @ts-ignore */
|
|
1467
|
+
...(ngDevMode ? [{ debugName: "prevDisabled" }] : /* istanbul ignore next */ []));
|
|
1468
|
+
nextDisabled = computed(() => {
|
|
1469
|
+
const max = this.#maxDay();
|
|
1470
|
+
return !!max && sdCalendarVisibleRange({ ...this.#rangeInput(), date: sdCalendarShiftDate(this.#rangeInput(), 1) }).from > max;
|
|
1471
|
+
}, /* @ts-ignore */
|
|
1472
|
+
...(ngDevMode ? [{ debugName: "nextDisabled" }] : /* istanbul ignore next */ []));
|
|
1473
|
+
#reading = computed(() => {
|
|
1474
|
+
const placed = [];
|
|
1475
|
+
const unreadable = [];
|
|
1476
|
+
const moving = this.#moving();
|
|
1477
|
+
for (const event of this.#loader.items()) {
|
|
1478
|
+
const placement = sdCalendarPlace(event, this.#clock);
|
|
1479
|
+
if (!placement) {
|
|
1480
|
+
unreadable.push(event.id);
|
|
1481
|
+
continue;
|
|
1482
|
+
}
|
|
1483
|
+
if (moving?.id === event.id) {
|
|
1484
|
+
const range = sdCalendarRangeOf(moving.target, this.#clock, null);
|
|
1485
|
+
const proposed = sdCalendarPlace({ ...event, start: range.start, end: range.end, allDay: range.allDay }, this.#clock);
|
|
1486
|
+
if (proposed) {
|
|
1487
|
+
placed.push({ event, placement: proposed, pending: true, saving: moving.saving });
|
|
1488
|
+
continue;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
placed.push({ event, placement, pending: false, saving: false });
|
|
1492
|
+
}
|
|
1493
|
+
return { placed, unreadable };
|
|
1494
|
+
}, /* @ts-ignore */
|
|
1495
|
+
...(ngDevMode ? [{ debugName: "#reading" }] : /* istanbul ignore next */ []));
|
|
1496
|
+
#placed = computed(() => this.#reading().placed, /* @ts-ignore */
|
|
1497
|
+
...(ngDevMode ? [{ debugName: "#placed" }] : /* istanbul ignore next */ []));
|
|
1498
|
+
#inRange = computed(() => {
|
|
1499
|
+
const { from, to } = this.visible();
|
|
1500
|
+
return this.#placed().filter(({ placement }) => placement.lastDay >= from && placement.firstDay <= to);
|
|
1501
|
+
}, /* @ts-ignore */
|
|
1502
|
+
...(ngDevMode ? [{ debugName: "#inRange" }] : /* istanbul ignore next */ []));
|
|
1503
|
+
dayViews = computed(() => this.days().map(day => this.#dayView(day)), /* @ts-ignore */
|
|
1504
|
+
...(ngDevMode ? [{ debugName: "dayViews" }] : /* istanbul ignore next */ []));
|
|
1505
|
+
blocksByDay = computed(() => {
|
|
1506
|
+
const byDay = new Map();
|
|
1507
|
+
const days = new Set(this.days());
|
|
1508
|
+
const grouped = new Map();
|
|
1509
|
+
for (const placed of this.#inRange()) {
|
|
1510
|
+
if (!placed.placement.inGrid || !days.has(placed.placement.startDay))
|
|
1511
|
+
continue;
|
|
1512
|
+
const list = grouped.get(placed.placement.startDay) ?? [];
|
|
1513
|
+
list.push(placed);
|
|
1514
|
+
grouped.set(placed.placement.startDay, list);
|
|
1515
|
+
}
|
|
1516
|
+
for (const [day, list] of grouped) {
|
|
1517
|
+
// §8.4 step 5: a pending block is left out of the columns and drawn full width on top.
|
|
1518
|
+
const stacking = list.filter(item => !item.pending);
|
|
1519
|
+
const stacked = sdCalendarStack(stacking.map(({ placement }) => ({ start: placement.startMinutes, end: placement.endMinutes })));
|
|
1520
|
+
const views = stacked.map(({ index, column, columns }) => this.#blockView(stacking[index], column, columns));
|
|
1521
|
+
for (const item of list)
|
|
1522
|
+
if (item.pending)
|
|
1523
|
+
views.push(this.#blockView(item, 0, 1));
|
|
1524
|
+
byDay.set(day, views);
|
|
1525
|
+
}
|
|
1526
|
+
return byDay;
|
|
1527
|
+
}, /* @ts-ignore */
|
|
1528
|
+
...(ngDevMode ? [{ debugName: "blocksByDay" }] : /* istanbul ignore next */ []));
|
|
1529
|
+
allDay = computed(() => {
|
|
1530
|
+
const days = this.days();
|
|
1531
|
+
const items = this.#inRange().filter(({ placement }) => !placement.inGrid);
|
|
1532
|
+
const layout = sdCalendarAllDayLayout(items.map(({ placement }) => placement), days);
|
|
1533
|
+
const bars = layout.bars.map(bar => {
|
|
1534
|
+
const placed = items[bar.index];
|
|
1535
|
+
const item = this.#itemView(placed);
|
|
1536
|
+
const { placement } = placed;
|
|
1537
|
+
const text = placement.allDay ? placed.event.title : `${sdCalendarClockText(placement.startMinutes)} ${placed.event.title}`;
|
|
1538
|
+
const spanText = placement.firstDay === placement.lastDay
|
|
1539
|
+
? ''
|
|
1540
|
+
: `${this.#dateText(placement.firstDay, false)} – ${this.#dateText(placement.lastDay, false)}`;
|
|
1541
|
+
return {
|
|
1542
|
+
...item,
|
|
1543
|
+
row: bar.row,
|
|
1544
|
+
from: bar.from,
|
|
1545
|
+
to: bar.to,
|
|
1546
|
+
clippedStart: bar.clippedStart,
|
|
1547
|
+
clippedEnd: bar.clippedEnd,
|
|
1548
|
+
text,
|
|
1549
|
+
spanText,
|
|
1550
|
+
};
|
|
1551
|
+
});
|
|
1552
|
+
return { bars, rows: layout.rows, more: layout.more };
|
|
1553
|
+
}, /* @ts-ignore */
|
|
1554
|
+
...(ngDevMode ? [{ debugName: "allDay" }] : /* istanbul ignore next */ []));
|
|
1555
|
+
monthWeeks = computed(() => {
|
|
1556
|
+
if (this.displayView() !== 'month')
|
|
1557
|
+
return [];
|
|
1558
|
+
const input = this.#rangeInput();
|
|
1559
|
+
const anchor = sdCalendarDayParts(input.date);
|
|
1560
|
+
const seen = new Set();
|
|
1561
|
+
return sdCalendarMonthWeeks(input).map(week => this.#monthWeek(week, anchor.month, seen));
|
|
1562
|
+
}, /* @ts-ignore */
|
|
1563
|
+
...(ngDevMode ? [{ debugName: "monthWeeks" }] : /* istanbul ignore next */ []));
|
|
1564
|
+
monthHeaders = computed(() => (this.monthWeeks()[0] ?? []).map(cell => cell.day.weekdayShort), /* @ts-ignore */
|
|
1565
|
+
...(ngDevMode ? [{ debugName: "monthHeaders" }] : /* istanbul ignore next */ []));
|
|
1566
|
+
/** The month cell in the tab order (roving tabindex, §9.7). */
|
|
1567
|
+
monthFocusDay = computed(() => {
|
|
1568
|
+
const days = this.days();
|
|
1569
|
+
const focus = this.#monthFocus();
|
|
1570
|
+
if (focus && days.includes(focus))
|
|
1571
|
+
return focus;
|
|
1572
|
+
return days.includes(this.#anchor()) ? this.#anchor() : days[0];
|
|
1573
|
+
}, /* @ts-ignore */
|
|
1574
|
+
...(ngDevMode ? [{ debugName: "monthFocusDay" }] : /* istanbul ignore next */ []));
|
|
1575
|
+
agenda = computed(() => {
|
|
1576
|
+
if (this.displayView() !== 'agenda')
|
|
1577
|
+
return [];
|
|
1578
|
+
const groups = [];
|
|
1579
|
+
const seen = new Set();
|
|
1580
|
+
for (const day of this.days()) {
|
|
1581
|
+
const placed = this.#inRange()
|
|
1582
|
+
.filter(({ placement }) => placement.firstDay <= day && placement.lastDay >= day)
|
|
1583
|
+
.sort((a, b) => Number(b.placement.allDay) - Number(a.placement.allDay) || a.placement.startInstant - b.placement.startInstant);
|
|
1584
|
+
const view = this.#dayView(day);
|
|
1585
|
+
if (!placed.length && !view.holiday)
|
|
1586
|
+
continue;
|
|
1587
|
+
groups.push({
|
|
1588
|
+
day: view,
|
|
1589
|
+
heading: `${this.#weekdayLong(day)}, ${this.#dateText(day, false)}`,
|
|
1590
|
+
rows: placed.map(item => {
|
|
1591
|
+
const row = firstSegment(this.#itemView(item), seen);
|
|
1592
|
+
return { ...row, context: { $implicit: item.event, event: item.event, range: row.range, view: 'agenda', pending: item.pending } };
|
|
1593
|
+
}),
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
return groups;
|
|
1597
|
+
}, /* @ts-ignore */
|
|
1598
|
+
...(ngDevMode ? [{ debugName: "agenda" }] : /* istanbul ignore next */ []));
|
|
1599
|
+
agendaCount = computed(() => this.days().length, /* @ts-ignore */
|
|
1600
|
+
...(ngDevMode ? [{ debugName: "agendaCount" }] : /* istanbul ignore next */ []));
|
|
1601
|
+
skeletonBlocks = SKELETON;
|
|
1602
|
+
hours = Array.from({ length: 23 }, (_, index) => index + 1);
|
|
1603
|
+
zoneLabel = computed(() => {
|
|
1604
|
+
const zone = this.#clock.timeZone;
|
|
1605
|
+
const format = new Intl.DateTimeFormat('en-US', {
|
|
1606
|
+
timeZoneName: 'shortOffset',
|
|
1607
|
+
...(zone && zone !== 'local' ? { timeZone: zone } : {}),
|
|
1608
|
+
});
|
|
1609
|
+
return format.formatToParts(this.#clock.fromWallClock(this.#now())).find(part => part.type === 'timeZoneName')?.value ?? '';
|
|
1610
|
+
}, /* @ts-ignore */
|
|
1611
|
+
...(ngDevMode ? [{ debugName: "zoneLabel" }] : /* istanbul ignore next */ []));
|
|
1612
|
+
nowTop = computed(() => offsetTop(this.#nowMinutes()), /* @ts-ignore */
|
|
1613
|
+
...(ngDevMode ? [{ debugName: "nowTop" }] : /* istanbul ignore next */ []));
|
|
1614
|
+
cursorId = `${this.baseId}-cursor`;
|
|
1615
|
+
cursorLabel = computed(() => {
|
|
1616
|
+
const cursor = this.#cursor();
|
|
1617
|
+
return cursor ? this.#slotLabel(cursor.day, cursor.minutes) : '';
|
|
1618
|
+
}, /* @ts-ignore */
|
|
1619
|
+
...(ngDevMode ? [{ debugName: "cursorLabel" }] : /* istanbul ignore next */ []));
|
|
1620
|
+
gridInstructionsId = `${this.baseId}-grid-help`;
|
|
1621
|
+
eventInstructionsId = `${this.baseId}-event-help`;
|
|
1622
|
+
dragDelay = { touch: 400, mouse: 0 };
|
|
1623
|
+
constructor() {
|
|
1624
|
+
const destroyRef = inject(DestroyRef);
|
|
1625
|
+
// why: one effect owns loading and the range output, so a range emits once and only together with its load.
|
|
1626
|
+
effect(() => {
|
|
1627
|
+
untracked(() => this.#hostWidth.measureOnce());
|
|
1628
|
+
const option = this.option();
|
|
1629
|
+
const range = this.visible();
|
|
1630
|
+
untracked(() => {
|
|
1631
|
+
const key = sdCalendarRangeKey(range);
|
|
1632
|
+
if (key !== this.#emittedKey) {
|
|
1633
|
+
this.#emittedKey = key;
|
|
1634
|
+
this.sdRangeChange.emit(range);
|
|
1635
|
+
}
|
|
1636
|
+
// SC-15: a new source also aborts a waiting create; a range change or a reload aborts a waiting move only.
|
|
1637
|
+
if (this.#lastOption !== null && this.#lastOption !== option)
|
|
1638
|
+
this.#abortCreate();
|
|
1639
|
+
this.#lastOption = option;
|
|
1640
|
+
this.#startLoad(option, range);
|
|
1641
|
+
});
|
|
1642
|
+
});
|
|
1643
|
+
effect(() => {
|
|
1644
|
+
for (const id of this.#reading().unreadable) {
|
|
1645
|
+
this.#reporter.report('warn', `date:${id}`, `event "${id}" has an unreadable date or does not end after it starts; it is not shown.`);
|
|
1646
|
+
}
|
|
1647
|
+
});
|
|
1648
|
+
effect(() => {
|
|
1649
|
+
const step = this.step() ?? this.#configuration?.step;
|
|
1650
|
+
if (step !== undefined && sdCalendarNormalizeStep(step) === null) {
|
|
1651
|
+
this.#reporter.report('warn', `step:${step}`, `step ${step} is not one of 5, 10, 15, 20, 30, 60; 30 is used.`);
|
|
1652
|
+
}
|
|
1653
|
+
});
|
|
1654
|
+
effect(() => {
|
|
1655
|
+
for (const weekday of sdCalendarBrokenWeekdays(this.#workingHours())) {
|
|
1656
|
+
this.#reporter.report('warn', `hours:${weekday}`, `workingHours[${weekday}] has a range without both ends or that does not end after it starts; it is ignored.`);
|
|
1657
|
+
}
|
|
1658
|
+
});
|
|
1659
|
+
// SC-15: turning disabled or readonly on aborts a waiting move.
|
|
1660
|
+
effect(() => {
|
|
1661
|
+
if (this.disabled() || this.readonly())
|
|
1662
|
+
untracked(() => this.#abortMove());
|
|
1663
|
+
});
|
|
1664
|
+
// why: the timer only runs while today is on a time grid, and outside the zone so it does not tick change detection.
|
|
1665
|
+
const ticking = computed(() => this.timeView() && this.days().includes(this.today()), /* @ts-ignore */
|
|
1666
|
+
...(ngDevMode ? [{ debugName: "ticking" }] : /* istanbul ignore next */ []));
|
|
1667
|
+
effect(() => this.#timer.run(ticking()));
|
|
1668
|
+
// Scroll to the working day when the week or day view opens; not when the week only changes.
|
|
1669
|
+
effect(() => {
|
|
1670
|
+
if (!this.timeView())
|
|
1671
|
+
return;
|
|
1672
|
+
untracked(() => afterNextRender(() => this.#scrollToStart(), { injector: this.#injector }));
|
|
1673
|
+
});
|
|
1674
|
+
effect(() => {
|
|
1675
|
+
if (sdCalendarSelectionGone(this.selectedId(), this.#loader.phase(), this.#loader.items()))
|
|
1676
|
+
untracked(() => this.selectedId.set(null));
|
|
1677
|
+
});
|
|
1678
|
+
destroyRef.onDestroy(() => {
|
|
1679
|
+
this.#loader.abort();
|
|
1680
|
+
this.#operation.abort();
|
|
1681
|
+
this.#hostWidth.disconnect();
|
|
1682
|
+
this.#timer.stop();
|
|
1683
|
+
this.#stopEdgeScroll();
|
|
1684
|
+
document.removeEventListener('keydown', this.#onDocumentKeydown, true);
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
/** The 7-day strip of a compact week (§12). */
|
|
1688
|
+
strip = computed(() => {
|
|
1689
|
+
if (!this.compact() || this.activeView() !== 'week')
|
|
1690
|
+
return [];
|
|
1691
|
+
const anchor = this.#anchor();
|
|
1692
|
+
const placed = this.#placed();
|
|
1693
|
+
return sdCalendarVisibleDays({ ...this.#rangeInput(), view: 'week' }).map(day => {
|
|
1694
|
+
const view = this.#dayView(day);
|
|
1695
|
+
return {
|
|
1696
|
+
day,
|
|
1697
|
+
weekdayShort: view.weekdayShort,
|
|
1698
|
+
dayNumber: view.dayNumber,
|
|
1699
|
+
label: view.label,
|
|
1700
|
+
today: view.today,
|
|
1701
|
+
current: day === anchor,
|
|
1702
|
+
events: placed.some(({ placement }) => placement.firstDay <= day && placement.lastDay >= day),
|
|
1703
|
+
};
|
|
1704
|
+
});
|
|
1705
|
+
}, /* @ts-ignore */
|
|
1706
|
+
...(ngDevMode ? [{ debugName: "strip" }] : /* istanbul ignore next */ []));
|
|
1707
|
+
/** Hours printed (§16): from the earliest working hour to the latest one of the days on screen. */
|
|
1708
|
+
printHours = computed(() => {
|
|
1709
|
+
const hours = this.#workingHours();
|
|
1710
|
+
let start = 1440;
|
|
1711
|
+
let end = 0;
|
|
1712
|
+
for (const day of this.days()) {
|
|
1713
|
+
for (const span of sdCalendarWorkingRanges(hours, sdCalendarWeekday(day)) ?? []) {
|
|
1714
|
+
start = Math.min(start, span.start);
|
|
1715
|
+
end = Math.max(end, span.end);
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
return end > start ? { start: start / 60, hours: (end - start) / 60 } : { start: 0, hours: 24 };
|
|
1719
|
+
}, /* @ts-ignore */
|
|
1720
|
+
...(ngDevMode ? [{ debugName: "printHours" }] : /* istanbul ignore next */ []));
|
|
1721
|
+
/** Aborts a running load and a waiting move, then calls `onLoad` again for the range on screen. */
|
|
1722
|
+
reload() {
|
|
1723
|
+
this.#startLoad(untracked(this.option), untracked(this.visible));
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Moves an event through the pipeline of `sd-calendar.md` ("Moving"): `onMove` decides. Resolves `true` only when
|
|
1727
|
+
* accepted; `false` without `option.move`, while locked or another operation waits, for an unknown id, a refused
|
|
1728
|
+
* `movable`, the same position, a position outside `minDate`/`maxDate`, a rejection, `'cancel'` or an error.
|
|
1729
|
+
* With `source: 'api'` (the default) an occurrence of a series is moved with `scope: 'this'` and focus stays put.
|
|
1730
|
+
*/
|
|
1731
|
+
move(eventId, to, source = 'api') {
|
|
1732
|
+
const placed = untracked(this.#placed).find(item => item.event.id === eventId);
|
|
1733
|
+
const target = placed ? this.#targetOf(placed, to) : null;
|
|
1734
|
+
if (!placed || !target)
|
|
1735
|
+
return Promise.resolve(false);
|
|
1736
|
+
return this.#runMove(eventId, target, source, false);
|
|
1737
|
+
}
|
|
1738
|
+
// ---- toolbar ----
|
|
1739
|
+
setView(view) {
|
|
1740
|
+
this.view.set(view);
|
|
1741
|
+
this.#announceTitle();
|
|
1742
|
+
}
|
|
1743
|
+
shift(direction) {
|
|
1744
|
+
if (direction < 0 ? this.prevDisabled() : this.nextDisabled())
|
|
1745
|
+
return;
|
|
1746
|
+
this.date.set(sdCalendarShiftDate(this.#rangeInput(), direction));
|
|
1747
|
+
this.#announceTitle();
|
|
1748
|
+
}
|
|
1749
|
+
goToday() {
|
|
1750
|
+
this.#now.set(this.#clock.now());
|
|
1751
|
+
this.date.set(this.today());
|
|
1752
|
+
this.#announceTitle();
|
|
1753
|
+
}
|
|
1754
|
+
openDay(day) {
|
|
1755
|
+
this.date.set(day);
|
|
1756
|
+
this.view.set('day');
|
|
1757
|
+
this.#announceTitle();
|
|
1758
|
+
}
|
|
1759
|
+
dismissFailure() {
|
|
1760
|
+
this.#failure.set(null);
|
|
1761
|
+
}
|
|
1762
|
+
// ---- selection (§9.1) ----
|
|
1763
|
+
selectItem(event, domEvent) {
|
|
1764
|
+
domEvent?.stopPropagation();
|
|
1765
|
+
if (this.#justDragged) {
|
|
1766
|
+
this.#justDragged = false;
|
|
1767
|
+
return;
|
|
1768
|
+
}
|
|
1769
|
+
if (this.disabled())
|
|
1770
|
+
return;
|
|
1771
|
+
this.selectedId.set(event.id);
|
|
1772
|
+
this.sdSelect.emit(event);
|
|
1773
|
+
}
|
|
1774
|
+
/** Press on an item: a new gesture, and the pickup point of a possible drag. */
|
|
1775
|
+
onPressItem(domEvent) {
|
|
1776
|
+
this.#justDragged = false;
|
|
1777
|
+
this.#pickup = sdCalendarPointOf(domEvent);
|
|
1778
|
+
}
|
|
1779
|
+
onItemKeydown(domEvent, item) {
|
|
1780
|
+
const key = domEvent.key;
|
|
1781
|
+
if (key === 'Enter' || key === ' ') {
|
|
1782
|
+
domEvent.preventDefault();
|
|
1783
|
+
this.selectItem(item.event, domEvent);
|
|
1784
|
+
return;
|
|
1785
|
+
}
|
|
1786
|
+
if (key === 'Escape') {
|
|
1787
|
+
domEvent.preventDefault();
|
|
1788
|
+
domEvent.stopPropagation();
|
|
1789
|
+
this.selectedId.set(null);
|
|
1790
|
+
this.gridElement()?.nativeElement.focus();
|
|
1791
|
+
return;
|
|
1792
|
+
}
|
|
1793
|
+
if (!domEvent.altKey || !key.startsWith('Arrow'))
|
|
1794
|
+
return;
|
|
1795
|
+
domEvent.preventDefault();
|
|
1796
|
+
domEvent.stopPropagation();
|
|
1797
|
+
const placement = item.placement;
|
|
1798
|
+
let target = null;
|
|
1799
|
+
let resize = false;
|
|
1800
|
+
if (key === 'ArrowLeft' || key === 'ArrowRight') {
|
|
1801
|
+
target = this.#shifted(placement, (key === 'ArrowRight') !== this.#rtl() ? 1 : -1, 0);
|
|
1802
|
+
}
|
|
1803
|
+
else if (placement.inGrid) {
|
|
1804
|
+
const delta = sdCalendarMoveStep(this.stepValue()) * (key === 'ArrowDown' ? 1 : -1);
|
|
1805
|
+
resize = domEvent.shiftKey;
|
|
1806
|
+
target = resize
|
|
1807
|
+
? {
|
|
1808
|
+
...sdCalendarTargetOf(placement),
|
|
1809
|
+
endMinutes: sdCalendarResizeEnd(placement.startMinutes, placement.endMinutes, delta, this.stepValue()),
|
|
1810
|
+
}
|
|
1811
|
+
: this.#shifted(placement, 0, delta);
|
|
1812
|
+
}
|
|
1813
|
+
// why: a change of the end is a 'resize' whichever input made it, as in sd-scheduler (review RX #2).
|
|
1814
|
+
if (target)
|
|
1815
|
+
void this.#runMove(item.event.id, target, resize ? 'resize' : 'keyboard', true);
|
|
1816
|
+
}
|
|
1817
|
+
// ---- create (§9.2) ----
|
|
1818
|
+
onGridPointerDown(domEvent) {
|
|
1819
|
+
if (!domEvent.isPrimary || domEvent.button !== 0)
|
|
1820
|
+
return;
|
|
1821
|
+
const target = domEvent.target;
|
|
1822
|
+
const column = target.closest('[data-day-column]');
|
|
1823
|
+
if (!column || target.closest('[data-event-id], [data-resize-handle]'))
|
|
1824
|
+
return;
|
|
1825
|
+
this.#press = {
|
|
1826
|
+
day: column.dataset['date'],
|
|
1827
|
+
anchor: this.#minutesAt(domEvent.clientY, column),
|
|
1828
|
+
x: domEvent.clientX,
|
|
1829
|
+
y: domEvent.clientY,
|
|
1830
|
+
touch: domEvent.pointerType === 'touch',
|
|
1831
|
+
column,
|
|
1832
|
+
moved: false,
|
|
1833
|
+
};
|
|
1834
|
+
try {
|
|
1835
|
+
column.setPointerCapture(domEvent.pointerId);
|
|
1836
|
+
}
|
|
1837
|
+
catch {
|
|
1838
|
+
// why: a synthetic or already released pointer cannot be captured; the press still works without capture.
|
|
1839
|
+
}
|
|
1840
|
+
document.addEventListener('keydown', this.#onDocumentKeydown, true);
|
|
1841
|
+
}
|
|
1842
|
+
onGridPointerMove(domEvent) {
|
|
1843
|
+
const press = this.#press;
|
|
1844
|
+
if (!press)
|
|
1845
|
+
return;
|
|
1846
|
+
if (!press.moved && Math.hypot(domEvent.clientX - press.x, domEvent.clientY - press.y) < CLICK_SLOP)
|
|
1847
|
+
return;
|
|
1848
|
+
press.moved = true;
|
|
1849
|
+
// §12: on touch a vertical move scrolls; there is no sweep.
|
|
1850
|
+
if (press.touch || !this.canCreate() || this.#operation.busy() || this.#outOfRange(press.day))
|
|
1851
|
+
return;
|
|
1852
|
+
const span = sdCalendarSweep(press.anchor, this.#minutesAt(domEvent.clientY, press.column), this.stepValue());
|
|
1853
|
+
this.#ghost.set({ ...span, day: press.day, pending: false, blocked: !this.#creatable(press.day, span) });
|
|
1854
|
+
}
|
|
1855
|
+
onGridPointerUp(domEvent) {
|
|
1856
|
+
const press = this.#press;
|
|
1857
|
+
if (!press)
|
|
1858
|
+
return;
|
|
1859
|
+
this.#press = null;
|
|
1860
|
+
document.removeEventListener('keydown', this.#onDocumentKeydown, true);
|
|
1861
|
+
// §12: a horizontal touch swipe of at least 60px on the day grid moves one day.
|
|
1862
|
+
if (press.touch && domEvent && this.displayView() === 'day' && this.#swipe(press, domEvent))
|
|
1863
|
+
return;
|
|
1864
|
+
const ghost = this.#ghost();
|
|
1865
|
+
if (!this.#operation.busy())
|
|
1866
|
+
this.#ghost.set(null);
|
|
1867
|
+
// §9.1: a press on an empty slot clears the selection; with option.create it also creates there.
|
|
1868
|
+
this.selectedId.set(null);
|
|
1869
|
+
if (this.canCreate() && this.#outOfRange(press.day)) {
|
|
1870
|
+
this.#announce(this.#i18n.t('core.component.calendar.out-of-range'));
|
|
1871
|
+
return;
|
|
1872
|
+
}
|
|
1873
|
+
if (press.moved && (press.touch || !ghost))
|
|
1874
|
+
return;
|
|
1875
|
+
const span = press.moved && ghost ? { start: ghost.start, end: ghost.end } : sdCalendarSlot(press.anchor, this.stepValue());
|
|
1876
|
+
void this.#create(press.day, span);
|
|
1877
|
+
}
|
|
1878
|
+
pickDay(day) {
|
|
1879
|
+
this.date.set(day);
|
|
1880
|
+
this.#announceTitle();
|
|
1881
|
+
}
|
|
1882
|
+
onStripPointerDown(domEvent) {
|
|
1883
|
+
this.#stripPress = { x: domEvent.clientX, y: domEvent.clientY };
|
|
1884
|
+
}
|
|
1885
|
+
/** §12: a horizontal swipe of the strip moves one week. */
|
|
1886
|
+
onStripPointerUp(domEvent) {
|
|
1887
|
+
const press = this.#stripPress;
|
|
1888
|
+
this.#stripPress = null;
|
|
1889
|
+
const dx = press ? domEvent.clientX - press.x : 0;
|
|
1890
|
+
if (!press || Math.abs(dx) < SWIPE || Math.abs(dx) <= Math.abs(domEvent.clientY - press.y))
|
|
1891
|
+
return;
|
|
1892
|
+
this.date.set(sdCalendarAddDays(this.#anchor(), dx < 0 ? 7 : -7));
|
|
1893
|
+
this.#announceTitle();
|
|
1894
|
+
}
|
|
1895
|
+
onGridPointerCancel() {
|
|
1896
|
+
this.#press = null;
|
|
1897
|
+
document.removeEventListener('keydown', this.#onDocumentKeydown, true);
|
|
1898
|
+
if (!this.#operation.busy())
|
|
1899
|
+
this.#ghost.set(null);
|
|
1900
|
+
}
|
|
1901
|
+
// ---- grid keyboard (§9.7) ----
|
|
1902
|
+
onGridFocus() {
|
|
1903
|
+
if (this.#cursor())
|
|
1904
|
+
return;
|
|
1905
|
+
const days = this.days();
|
|
1906
|
+
const day = days.includes(this.#anchor()) ? this.#anchor() : days[0];
|
|
1907
|
+
const start = sdCalendarWorkingRanges(this.#workingHours(), sdCalendarWeekday(day))?.[0]?.start ??
|
|
1908
|
+
sdCalendarTimeToMinutes(ɵSD_CALENDAR_DEFAULTS.scrollTime);
|
|
1909
|
+
this.#cursor.set({ day, minutes: sdCalendarSlot(start, this.stepValue()).start });
|
|
1910
|
+
}
|
|
1911
|
+
onGridKeydown(domEvent) {
|
|
1912
|
+
if (domEvent.target !== domEvent.currentTarget)
|
|
1913
|
+
return;
|
|
1914
|
+
this.onGridFocus();
|
|
1915
|
+
const cursor = this.#cursor();
|
|
1916
|
+
const step = this.stepValue();
|
|
1917
|
+
const key = domEvent.key;
|
|
1918
|
+
let next;
|
|
1919
|
+
switch (key) {
|
|
1920
|
+
case 'ArrowUp':
|
|
1921
|
+
case 'ArrowDown':
|
|
1922
|
+
next = { day: cursor.day, minutes: Math.min(1440 - step, Math.max(0, cursor.minutes + (key === 'ArrowDown' ? step : -step))) };
|
|
1923
|
+
break;
|
|
1924
|
+
case 'ArrowLeft':
|
|
1925
|
+
case 'ArrowRight':
|
|
1926
|
+
next = { day: this.#neighbourDay(cursor.day, (key === 'ArrowRight') !== this.#rtl() ? 1 : -1), minutes: cursor.minutes };
|
|
1927
|
+
break;
|
|
1928
|
+
case 'Home':
|
|
1929
|
+
case 'End': {
|
|
1930
|
+
const working = sdCalendarWorkingRanges(this.#workingHours(), sdCalendarWeekday(cursor.day)) ?? [];
|
|
1931
|
+
const minutes = key === 'Home' ? (working[0]?.start ?? 0) : (working[working.length - 1]?.end ?? 1440) - step;
|
|
1932
|
+
next = { day: cursor.day, minutes: sdCalendarSlot(minutes, step).start };
|
|
1933
|
+
break;
|
|
1934
|
+
}
|
|
1935
|
+
case 'PageUp':
|
|
1936
|
+
case 'PageDown': {
|
|
1937
|
+
const direction = key === 'PageDown' ? 1 : -1;
|
|
1938
|
+
this.shift(direction);
|
|
1939
|
+
next = { day: sdCalendarAddDays(cursor.day, direction * (this.displayView() === 'week' ? 7 : 1)), minutes: cursor.minutes };
|
|
1940
|
+
break;
|
|
1941
|
+
}
|
|
1942
|
+
case 't':
|
|
1943
|
+
case 'T':
|
|
1944
|
+
this.goToday();
|
|
1945
|
+
next = { day: this.today(), minutes: cursor.minutes };
|
|
1946
|
+
break;
|
|
1947
|
+
case 'Enter':
|
|
1948
|
+
case ' ':
|
|
1949
|
+
domEvent.preventDefault();
|
|
1950
|
+
void this.#create(cursor.day, { start: cursor.minutes, end: Math.min(1440, cursor.minutes + step) });
|
|
1951
|
+
return;
|
|
1952
|
+
default:
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1955
|
+
domEvent.preventDefault();
|
|
1956
|
+
this.#cursor.set(next);
|
|
1957
|
+
this.#announce(this.#slotLabel(next.day, next.minutes));
|
|
1958
|
+
afterNextRender(() => this.#revealCursor(), { injector: this.#injector });
|
|
1959
|
+
}
|
|
1960
|
+
// ---- month keyboard (§9.7) ----
|
|
1961
|
+
onCellKeydown(domEvent, day) {
|
|
1962
|
+
const key = domEvent.key;
|
|
1963
|
+
if (key === 'Enter' || key === ' ') {
|
|
1964
|
+
domEvent.preventDefault();
|
|
1965
|
+
this.openDay(day);
|
|
1966
|
+
return;
|
|
1967
|
+
}
|
|
1968
|
+
const week = this.monthWeeks()
|
|
1969
|
+
.find(row => row.some(cell => cell.day.day === day))
|
|
1970
|
+
?.map(cell => cell.day.day) ?? [day];
|
|
1971
|
+
let next = null;
|
|
1972
|
+
if (key === 'ArrowLeft' || key === 'ArrowRight')
|
|
1973
|
+
next = sdCalendarAddDays(day, (key === 'ArrowRight') !== this.#rtl() ? 1 : -1);
|
|
1974
|
+
else if (key === 'ArrowUp' || key === 'ArrowDown')
|
|
1975
|
+
next = sdCalendarAddDays(day, key === 'ArrowDown' ? 7 : -7);
|
|
1976
|
+
else if (key === 'Home')
|
|
1977
|
+
next = week[0];
|
|
1978
|
+
else if (key === 'End')
|
|
1979
|
+
next = week[week.length - 1];
|
|
1980
|
+
else if (key === 'PageUp' || key === 'PageDown')
|
|
1981
|
+
next = sdCalendarAddMonthsKeepDay(day, (key === 'PageDown' ? 1 : -1) * (domEvent.shiftKey ? 12 : 1));
|
|
1982
|
+
if (!next)
|
|
1983
|
+
return;
|
|
1984
|
+
domEvent.preventDefault();
|
|
1985
|
+
const focus = next;
|
|
1986
|
+
this.#monthFocus.set(focus);
|
|
1987
|
+
if (!this.days().includes(focus))
|
|
1988
|
+
this.date.set(focus);
|
|
1989
|
+
afterNextRender(() => this.#host.nativeElement.querySelector(`[role="gridcell"][data-date="${focus}"]`)?.focus(), {
|
|
1990
|
+
injector: this.#injector,
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
// ---- drag (§9.3) ----
|
|
1994
|
+
/** Keeps the dragged element in place (the proposal is drawn instead) and records the real pointer. */
|
|
1995
|
+
constrainDrag = (point, _ref, rect) => {
|
|
1996
|
+
// why: CDK 19 reports the constrained point in cdkDragMoved, so the real pointer is kept from here.
|
|
1997
|
+
this.#dragPointer = point;
|
|
1998
|
+
return { x: rect.left, y: rect.top };
|
|
1999
|
+
};
|
|
2000
|
+
onDragStarted(start, item) {
|
|
2001
|
+
const columns = Array.from(this.#host.nativeElement.querySelectorAll('[data-day-column]')).map(column => {
|
|
2002
|
+
const rect = column.getBoundingClientRect();
|
|
2003
|
+
return { day: column.dataset['date'], left: rect.left, right: rect.right };
|
|
2004
|
+
});
|
|
2005
|
+
this.#dragSession = {
|
|
2006
|
+
id: item.event.id,
|
|
2007
|
+
placement: item.placement,
|
|
2008
|
+
title: item.event.title,
|
|
2009
|
+
color: item.color,
|
|
2010
|
+
customColor: item.customColor,
|
|
2011
|
+
start: this.#pickup ?? sdCalendarPointOf(start.event) ?? { x: 0, y: 0 },
|
|
2012
|
+
scrollTop: this.scroller()?.nativeElement.scrollTop ?? 0,
|
|
2013
|
+
columns,
|
|
2014
|
+
cancelled: false,
|
|
2015
|
+
};
|
|
2016
|
+
this.#failure.set(null);
|
|
2017
|
+
if (typeof TouchEvent !== 'undefined' && start.event instanceof TouchEvent)
|
|
2018
|
+
navigator.vibrate?.(10);
|
|
2019
|
+
document.addEventListener('keydown', this.#onDocumentKeydown, true);
|
|
2020
|
+
}
|
|
2021
|
+
onDragMoved() {
|
|
2022
|
+
this.#updateDragProposal();
|
|
2023
|
+
this.#edgeScroll();
|
|
2024
|
+
}
|
|
2025
|
+
onDragEnded(end) {
|
|
2026
|
+
end.source.reset();
|
|
2027
|
+
this.#stopEdgeScroll();
|
|
2028
|
+
document.removeEventListener('keydown', this.#onDocumentKeydown, true);
|
|
2029
|
+
const session = this.#dragSession;
|
|
2030
|
+
const proposal = this.#drag();
|
|
2031
|
+
this.#dragSession = null;
|
|
2032
|
+
this.#dragPointer = null;
|
|
2033
|
+
this.#drag.set(null);
|
|
2034
|
+
this.#justDragged = true;
|
|
2035
|
+
if (!session || !proposal || session.cancelled || proposal.outside)
|
|
2036
|
+
return;
|
|
2037
|
+
const target = {
|
|
2038
|
+
allDay: false,
|
|
2039
|
+
startDay: proposal.day,
|
|
2040
|
+
startMinutes: proposal.start,
|
|
2041
|
+
endDay: proposal.day,
|
|
2042
|
+
endMinutes: proposal.end,
|
|
2043
|
+
};
|
|
2044
|
+
void this.#runMove(session.id, target, 'drag', false);
|
|
2045
|
+
}
|
|
2046
|
+
// ---- resize (§9.4) ----
|
|
2047
|
+
onResizeDown(domEvent, item) {
|
|
2048
|
+
domEvent.stopPropagation();
|
|
2049
|
+
if (!domEvent.isPrimary || !item.movable)
|
|
2050
|
+
return;
|
|
2051
|
+
this.#resizeSession = { id: item.event.id, placement: item.placement, y: domEvent.clientY };
|
|
2052
|
+
this.#failure.set(null);
|
|
2053
|
+
try {
|
|
2054
|
+
domEvent.currentTarget.setPointerCapture(domEvent.pointerId);
|
|
2055
|
+
}
|
|
2056
|
+
catch {
|
|
2057
|
+
// why: see onGridPointerDown.
|
|
2058
|
+
}
|
|
2059
|
+
document.addEventListener('keydown', this.#onDocumentKeydown, true);
|
|
2060
|
+
}
|
|
2061
|
+
onResizeMove(domEvent) {
|
|
2062
|
+
const session = this.#resizeSession;
|
|
2063
|
+
if (!session)
|
|
2064
|
+
return;
|
|
2065
|
+
const delta = ((domEvent.clientY - session.y) / this.#hourHeight()) * 60;
|
|
2066
|
+
const end = sdCalendarResizeEnd(session.placement.startMinutes, session.placement.endMinutes, delta, this.stepValue());
|
|
2067
|
+
this.#resize.set({ id: session.id, end });
|
|
2068
|
+
}
|
|
2069
|
+
onResizeUp(domEvent) {
|
|
2070
|
+
domEvent.stopPropagation();
|
|
2071
|
+
const session = this.#resizeSession;
|
|
2072
|
+
const resize = this.#resize();
|
|
2073
|
+
this.#resizeSession = null;
|
|
2074
|
+
this.#resize.set(null);
|
|
2075
|
+
document.removeEventListener('keydown', this.#onDocumentKeydown, true);
|
|
2076
|
+
if (!session || !resize)
|
|
2077
|
+
return;
|
|
2078
|
+
void this.#runMove(session.id, { ...sdCalendarTargetOf(session.placement), endMinutes: resize.end }, 'resize', false);
|
|
2079
|
+
}
|
|
2080
|
+
/** The browser took the pointer away (a scroll or a system gesture): the live resize is dropped. */
|
|
2081
|
+
onResizeCancel() {
|
|
2082
|
+
this.#resizeSession = null;
|
|
2083
|
+
this.#resize.set(null);
|
|
2084
|
+
document.removeEventListener('keydown', this.#onDocumentKeydown, true);
|
|
2085
|
+
}
|
|
2086
|
+
/** Height of a block, following a live resize. */
|
|
2087
|
+
blockHeight(block) {
|
|
2088
|
+
const resize = this.#resize();
|
|
2089
|
+
return resize?.id === block.key ? blockHeight(resize.end - block.placement.startMinutes) : block.height;
|
|
2090
|
+
}
|
|
2091
|
+
/** Time line of a block, following a live resize. */
|
|
2092
|
+
blockTime(block) {
|
|
2093
|
+
const resize = this.#resize();
|
|
2094
|
+
if (resize?.id !== block.key)
|
|
2095
|
+
return block.timeText;
|
|
2096
|
+
return `${sdCalendarClockText(block.placement.startMinutes)} – ${sdCalendarClockText(resize.end)}`;
|
|
2097
|
+
}
|
|
2098
|
+
isDragging(id) {
|
|
2099
|
+
return this.#drag()?.id === id;
|
|
2100
|
+
}
|
|
2101
|
+
isFailed(id) {
|
|
2102
|
+
return this.#failure()?.id === id;
|
|
2103
|
+
}
|
|
2104
|
+
spanTop(minutes) {
|
|
2105
|
+
return offsetTop(minutes);
|
|
2106
|
+
}
|
|
2107
|
+
spanHeight(minutes) {
|
|
2108
|
+
return blockHeight(minutes);
|
|
2109
|
+
}
|
|
2110
|
+
clockText(minutes) {
|
|
2111
|
+
return sdCalendarClockText(minutes);
|
|
2112
|
+
}
|
|
2113
|
+
viewLabel(view) {
|
|
2114
|
+
return this.#i18n.t(`core.component.calendar.view-${view}`);
|
|
2115
|
+
}
|
|
2116
|
+
childAutoId(kind) {
|
|
2117
|
+
const root = this.rootAutoId();
|
|
2118
|
+
return root ? `${root}-${kind}` : null;
|
|
2119
|
+
}
|
|
2120
|
+
/** Name of the "+N" button of the all-day row: the visible "+2" leads it in every language (WCAG 2.5.3). */
|
|
2121
|
+
allDayMoreLabel(count, day) {
|
|
2122
|
+
const visible = this.#i18n.t('core.component.calendar.more-short', { count });
|
|
2123
|
+
const more = this.#i18n.t('core.component.calendar.more', { count });
|
|
2124
|
+
return `${more.startsWith(visible) ? more : `${visible}, ${more}`}, ${day.label}`;
|
|
2125
|
+
}
|
|
2126
|
+
blocksOf(day) {
|
|
2127
|
+
return this.blocksByDay().get(day) ?? [];
|
|
2128
|
+
}
|
|
2129
|
+
// ---- pipeline (§9.5) ----
|
|
2130
|
+
async #runMove(id, target, source, keyboard) {
|
|
2131
|
+
const move = untracked(this.option).move;
|
|
2132
|
+
if (!move || untracked(this.locked) || untracked(this.#operation.busy))
|
|
2133
|
+
return false;
|
|
2134
|
+
const placed = untracked(this.#placed).find(item => item.event.id === id);
|
|
2135
|
+
if (!placed || !sdCalendarAllows(move.movable, placed.event))
|
|
2136
|
+
return false;
|
|
2137
|
+
const transform = untracked(this.transform);
|
|
2138
|
+
const from = sdCalendarRangeOf(placed.placement, this.#clock, transform);
|
|
2139
|
+
const to = sdCalendarRangeOf(target, this.#clock, transform);
|
|
2140
|
+
if (from.start === to.start && from.end === to.end && from.allDay === to.allDay)
|
|
2141
|
+
return false;
|
|
2142
|
+
if (this.#outOfRange(target.startDay) || this.#outOfRange(sdCalendarLastDayOf(target))) {
|
|
2143
|
+
this.#announce(this.#i18n.t('core.component.calendar.out-of-range'));
|
|
2144
|
+
return false;
|
|
2145
|
+
}
|
|
2146
|
+
const { event } = placed;
|
|
2147
|
+
return this.#runner.run({
|
|
2148
|
+
id,
|
|
2149
|
+
title: event.title,
|
|
2150
|
+
recurring: !!event.occurrence,
|
|
2151
|
+
source,
|
|
2152
|
+
keyboard,
|
|
2153
|
+
// SC-06: the flag is evaluated once more right before the callback.
|
|
2154
|
+
allowed: () => sdCalendarAllows(move.movable, event),
|
|
2155
|
+
request: (scope, signal) => ({ event, from, to, source, scope, signal }),
|
|
2156
|
+
onMove: move.onMove,
|
|
2157
|
+
show: saving => this.#moving.set(saving === null ? null : { id, target, saving }),
|
|
2158
|
+
accept: request => {
|
|
2159
|
+
const moved = { ...event, start: to.start, end: to.end, allDay: to.allDay };
|
|
2160
|
+
this.#loader.items.update(items => items.map(item => (item.id === event.id ? moved : item)));
|
|
2161
|
+
const visible = untracked(this.visible);
|
|
2162
|
+
if (target.startDay < visible.from || target.startDay > visible.to)
|
|
2163
|
+
this.date.set(target.startDay);
|
|
2164
|
+
this.sdMove.emit(request);
|
|
2165
|
+
return sdCalendarMovedText(event.title, target, from, to, source, this.#formats(), this.#t);
|
|
2166
|
+
},
|
|
2167
|
+
fail: (request, outcome) => this.sdMoveError.emit(outcome.kind === 'error' ? { request, reason: 'error', error: outcome.error } : { request, reason: 'rejected' }),
|
|
2168
|
+
});
|
|
2169
|
+
}
|
|
2170
|
+
async #create(day, span) {
|
|
2171
|
+
const create = untracked(this.option).create;
|
|
2172
|
+
if (!create || untracked(this.locked) || untracked(this.#operation.busy))
|
|
2173
|
+
return;
|
|
2174
|
+
if (this.#outOfRange(day)) {
|
|
2175
|
+
this.#announce(this.#i18n.t('core.component.calendar.out-of-range'));
|
|
2176
|
+
return;
|
|
2177
|
+
}
|
|
2178
|
+
const range = this.#createRange(day, span);
|
|
2179
|
+
if (!sdCalendarAllows(create.creatable, range))
|
|
2180
|
+
return;
|
|
2181
|
+
await this.#creator.run({
|
|
2182
|
+
args: range,
|
|
2183
|
+
onCreate: create.onCreate,
|
|
2184
|
+
show: waiting => this.#ghost.set(waiting ? { day, start: span.start, end: span.end, pending: true, blocked: false } : null),
|
|
2185
|
+
accept: event => {
|
|
2186
|
+
this.#loader.items.update(items => [...items, event]);
|
|
2187
|
+
this.selectedId.set(event.id);
|
|
2188
|
+
},
|
|
2189
|
+
});
|
|
2190
|
+
}
|
|
2191
|
+
#createRange(day, span) {
|
|
2192
|
+
return sdCalendarRangeOf({ allDay: false, startDay: day, startMinutes: span.start, endDay: day, endMinutes: span.end }, this.#clock, untracked(this.transform));
|
|
2193
|
+
}
|
|
2194
|
+
#creatable(day, span) {
|
|
2195
|
+
return sdCalendarAllows(untracked(this.option).create?.creatable, this.#createRange(day, span));
|
|
2196
|
+
}
|
|
2197
|
+
#startLoad(option, range) {
|
|
2198
|
+
this.#abortMove();
|
|
2199
|
+
// R1-G8: "now" may be stale when the minute timer is off (month, agenda); refresh it with every load.
|
|
2200
|
+
this.#now.set(this.#clock.now());
|
|
2201
|
+
void this.#loader
|
|
2202
|
+
.load(sdCalendarRangeKey(range), signal => option.dataSource.onLoad({ from: range.from, to: range.to, view: range.view, signal }), error => {
|
|
2203
|
+
this.#announce(this.#i18n.t('core.component.calendar.load-error'));
|
|
2204
|
+
this.sdLoadError.emit(error);
|
|
2205
|
+
})
|
|
2206
|
+
.then(() => this.#focus.pending());
|
|
2207
|
+
}
|
|
2208
|
+
#abortMove() {
|
|
2209
|
+
if (!this.#operation.abort(['move']))
|
|
2210
|
+
return;
|
|
2211
|
+
this.#moving.set(null);
|
|
2212
|
+
this.scopeBar.answer(null);
|
|
2213
|
+
}
|
|
2214
|
+
#abortCreate() {
|
|
2215
|
+
if (this.#operation.abort(['create']))
|
|
2216
|
+
this.#ghost.set(null);
|
|
2217
|
+
}
|
|
2218
|
+
#targetOf(placed, to) {
|
|
2219
|
+
return sdCalendarMoveTarget(placed.placement, to, !!placed.event.allDay, this.#clock);
|
|
2220
|
+
}
|
|
2221
|
+
#shifted(placement, days, minutes) {
|
|
2222
|
+
if (placement.inGrid) {
|
|
2223
|
+
const duration = placement.endMinutes - placement.startMinutes;
|
|
2224
|
+
const start = minutes
|
|
2225
|
+
? sdCalendarSnapMove(placement.startMinutes, minutes, duration, sdCalendarMoveStep(this.stepValue()))
|
|
2226
|
+
: placement.startMinutes;
|
|
2227
|
+
const day = sdCalendarAddDays(placement.startDay, days);
|
|
2228
|
+
return { allDay: false, startDay: day, startMinutes: start, endDay: day, endMinutes: start + duration };
|
|
2229
|
+
}
|
|
2230
|
+
return sdCalendarShiftDays(placement, days);
|
|
2231
|
+
}
|
|
2232
|
+
#updateDragProposal() {
|
|
2233
|
+
const session = this.#dragSession;
|
|
2234
|
+
const pointer = this.#dragPointer;
|
|
2235
|
+
if (!session || !pointer || session.cancelled)
|
|
2236
|
+
return;
|
|
2237
|
+
const { columns, placement } = session;
|
|
2238
|
+
const grid = this.gridElement()?.nativeElement.getBoundingClientRect();
|
|
2239
|
+
const outside = !grid || pointer.x < grid.left || pointer.x > grid.right || pointer.y < grid.top || pointer.y > grid.bottom;
|
|
2240
|
+
let column = columns.findIndex(item => pointer.x >= item.left && pointer.x < item.right);
|
|
2241
|
+
if (column < 0)
|
|
2242
|
+
column = pointer.x < (columns[0]?.left ?? 0) ? 0 : columns.length - 1;
|
|
2243
|
+
const scrolled = (this.scroller()?.nativeElement.scrollTop ?? 0) - session.scrollTop;
|
|
2244
|
+
const delta = ((pointer.y - session.start.y + scrolled) / this.#hourHeight()) * 60;
|
|
2245
|
+
const duration = placement.endMinutes - placement.startMinutes;
|
|
2246
|
+
const start = sdCalendarSnapMove(placement.startMinutes, delta, duration, sdCalendarMoveStep(this.stepValue()));
|
|
2247
|
+
const day = columns[column]?.day ?? placement.startDay;
|
|
2248
|
+
const { title, color, customColor } = session;
|
|
2249
|
+
this.#drag.set({ id: session.id, day, start, end: start + duration, title, outside, color, customColor });
|
|
2250
|
+
}
|
|
2251
|
+
/** Scrolls while the pointer is within 40px of the top or bottom of the scroll area, faster closer to it (§9.3). */
|
|
2252
|
+
#edgeScroll() {
|
|
2253
|
+
const scroller = this.scroller()?.nativeElement;
|
|
2254
|
+
this.#edge.update(scroller, scroller?.getBoundingClientRect() ?? null, this.#dragPointer, { x: false, y: true }, () => {
|
|
2255
|
+
if (!this.#dragSession)
|
|
2256
|
+
return;
|
|
2257
|
+
this.#updateDragProposal();
|
|
2258
|
+
this.#edgeScroll();
|
|
2259
|
+
});
|
|
2260
|
+
}
|
|
2261
|
+
#stopEdgeScroll() {
|
|
2262
|
+
this.#edge.stop();
|
|
2263
|
+
}
|
|
2264
|
+
/** Esc cancels a sweep, a drag or a resize. */
|
|
2265
|
+
#onDocumentKeydown = (domEvent) => {
|
|
2266
|
+
if (domEvent.key !== 'Escape')
|
|
2267
|
+
return;
|
|
2268
|
+
this.#zone.run(() => {
|
|
2269
|
+
if (this.#press) {
|
|
2270
|
+
this.#press = null;
|
|
2271
|
+
if (!this.#operation.busy())
|
|
2272
|
+
this.#ghost.set(null);
|
|
2273
|
+
}
|
|
2274
|
+
if (this.#dragSession) {
|
|
2275
|
+
this.#dragSession.cancelled = true;
|
|
2276
|
+
this.#drag.set(null);
|
|
2277
|
+
}
|
|
2278
|
+
if (this.#resizeSession) {
|
|
2279
|
+
this.#resizeSession = null;
|
|
2280
|
+
this.#resize.set(null);
|
|
2281
|
+
}
|
|
2282
|
+
});
|
|
2283
|
+
// A cancelled sweep or resize has nothing left to end it, so the listener goes now; a drag ends on its drop.
|
|
2284
|
+
if (!this.#press && !this.#dragSession && !this.#resizeSession) {
|
|
2285
|
+
document.removeEventListener('keydown', this.#onDocumentKeydown, true);
|
|
2286
|
+
}
|
|
2287
|
+
};
|
|
2288
|
+
#restoreFocus(id, origin) {
|
|
2289
|
+
this.#focus.restore(id, origin);
|
|
2290
|
+
}
|
|
2291
|
+
#revealCursor() {
|
|
2292
|
+
const scroller = this.scroller()?.nativeElement;
|
|
2293
|
+
const cursor = this.#cursor();
|
|
2294
|
+
if (!scroller || !cursor)
|
|
2295
|
+
return;
|
|
2296
|
+
const hour = this.#hourHeight();
|
|
2297
|
+
const head = scroller.querySelector('[data-head]')?.offsetHeight ?? 0;
|
|
2298
|
+
const top = (cursor.minutes / 60) * hour;
|
|
2299
|
+
const bottom = top + (this.stepValue() / 60) * hour;
|
|
2300
|
+
if (top < scroller.scrollTop)
|
|
2301
|
+
scroller.scrollTop = top;
|
|
2302
|
+
else if (head + bottom > scroller.scrollTop + scroller.clientHeight)
|
|
2303
|
+
scroller.scrollTop = head + bottom - scroller.clientHeight;
|
|
2304
|
+
}
|
|
2305
|
+
#neighbourDay(day, direction) {
|
|
2306
|
+
const days = this.days();
|
|
2307
|
+
const next = days[days.indexOf(day) + direction];
|
|
2308
|
+
if (next)
|
|
2309
|
+
return next;
|
|
2310
|
+
this.shift(direction);
|
|
2311
|
+
const shifted = this.days();
|
|
2312
|
+
return direction > 0 ? shifted[0] : shifted[shifted.length - 1];
|
|
2313
|
+
}
|
|
2314
|
+
/** Moves one day for a horizontal swipe; returns whether the press was one. */
|
|
2315
|
+
#swipe(press, domEvent) {
|
|
2316
|
+
const dx = domEvent.clientX - press.x;
|
|
2317
|
+
if (Math.abs(dx) < SWIPE || Math.abs(dx) <= Math.abs(domEvent.clientY - press.y))
|
|
2318
|
+
return false;
|
|
2319
|
+
this.date.set(sdCalendarAddDays(this.#anchor(), dx < 0 ? 1 : -1));
|
|
2320
|
+
this.#announceTitle();
|
|
2321
|
+
return true;
|
|
2322
|
+
}
|
|
2323
|
+
#minutesAt(clientY, column) {
|
|
2324
|
+
const rect = column.getBoundingClientRect();
|
|
2325
|
+
return Math.min(1439, Math.max(0, ((clientY - rect.top) / this.#hourHeight()) * 60));
|
|
2326
|
+
}
|
|
2327
|
+
#hourHeight() {
|
|
2328
|
+
return parseFloat(getComputedStyle(this.#host.nativeElement).getPropertyValue('--sd-calendar-hour-height')) || HOUR_HEIGHT;
|
|
2329
|
+
}
|
|
2330
|
+
#rtl() {
|
|
2331
|
+
return sdCalendarIsRtl(this.#host.nativeElement);
|
|
2332
|
+
}
|
|
2333
|
+
#outOfRange(day) {
|
|
2334
|
+
return sdCalendarOutOfRange(day, untracked(this.#minDay), untracked(this.#maxDay));
|
|
2335
|
+
}
|
|
2336
|
+
#slotLabel(day, minutes) {
|
|
2337
|
+
return this.#i18n.t('core.component.calendar.slot-label', {
|
|
2338
|
+
weekday: this.#weekdayLong(day),
|
|
2339
|
+
date: this.#dateText(day, false),
|
|
2340
|
+
time: sdCalendarClockText(minutes),
|
|
2341
|
+
});
|
|
2342
|
+
}
|
|
2343
|
+
#scrollToStart() {
|
|
2344
|
+
const element = this.scroller()?.nativeElement;
|
|
2345
|
+
if (!element)
|
|
2346
|
+
return;
|
|
2347
|
+
const minutes = sdCalendarTimeToMinutes(this.scrollTime() ?? this.#configuration?.scrollTime) ?? this.#earliestWorkingMinute();
|
|
2348
|
+
element.scrollTop = sdCalendarInitialScroll(minutes, this.#hourHeight());
|
|
2349
|
+
}
|
|
2350
|
+
#earliestWorkingMinute() {
|
|
2351
|
+
const hours = this.#workingHours();
|
|
2352
|
+
const starts = this.days()
|
|
2353
|
+
.map(day => sdCalendarWorkingRanges(hours, sdCalendarWeekday(day))?.[0]?.start)
|
|
2354
|
+
.filter((start) => start !== undefined);
|
|
2355
|
+
return starts.length ? Math.min(...starts) : sdCalendarTimeToMinutes(ɵSD_CALENDAR_DEFAULTS.scrollTime);
|
|
2356
|
+
}
|
|
2357
|
+
#announceTitle() {
|
|
2358
|
+
this.#announce(untracked(this.title));
|
|
2359
|
+
}
|
|
2360
|
+
#announce(message) {
|
|
2361
|
+
this.#announcer.announce(message);
|
|
2362
|
+
}
|
|
2363
|
+
#navLabel(direction) {
|
|
2364
|
+
const view = this.displayView();
|
|
2365
|
+
if (view === 'agenda') {
|
|
2366
|
+
return this.#i18n.t(`core.component.calendar.${direction}-agenda`, { count: sdCalendarClampAgendaDays(this.agendaDays()) });
|
|
2367
|
+
}
|
|
2368
|
+
return this.#i18n.t(`core.component.calendar.${direction}-${view}`);
|
|
2369
|
+
}
|
|
2370
|
+
#weekdayLong(day) {
|
|
2371
|
+
return sdCalendarWeekdayLong(this.#formats(), day);
|
|
2372
|
+
}
|
|
2373
|
+
#dateText(day, withYear) {
|
|
2374
|
+
return sdCalendarDateText(this.#formats(), day, withYear);
|
|
2375
|
+
}
|
|
2376
|
+
#dayView(day) {
|
|
2377
|
+
const weekday = sdCalendarWeekday(day);
|
|
2378
|
+
const holiday = this.#holidays().get(day) ?? null;
|
|
2379
|
+
const working = sdCalendarWorkingRanges(this.#workingHours(), weekday);
|
|
2380
|
+
const off = sdCalendarIsOffDay(day, holiday, this.#workingHours());
|
|
2381
|
+
const min = this.#minDay();
|
|
2382
|
+
const max = this.#maxDay();
|
|
2383
|
+
return {
|
|
2384
|
+
day,
|
|
2385
|
+
dayNumber: sdCalendarDayParts(day).day,
|
|
2386
|
+
weekdayShort: this.#i18n.t(`core.component.calendar.weekday-short-${weekday}`),
|
|
2387
|
+
label: `${this.#weekdayLong(day)} ${this.#dateText(day, false)}`,
|
|
2388
|
+
today: day === this.today(),
|
|
2389
|
+
off,
|
|
2390
|
+
outOfRange: (!!min && day < min) || (!!max && day > max),
|
|
2391
|
+
holiday,
|
|
2392
|
+
offSegments: off ? [] : sdCalendarOffSegments(working),
|
|
2393
|
+
};
|
|
2394
|
+
}
|
|
2395
|
+
#itemView(placed) {
|
|
2396
|
+
const { event, placement } = placed;
|
|
2397
|
+
const { color, customColor } = sdCalendarColor(event.color);
|
|
2398
|
+
const start = sdCalendarClockText(placement.startMinutes);
|
|
2399
|
+
const end = sdCalendarClockText(placement.endMinutes);
|
|
2400
|
+
const recurring = !!event.occurrence;
|
|
2401
|
+
let label;
|
|
2402
|
+
if (placement.allDay) {
|
|
2403
|
+
label = this.#i18n.t('core.component.calendar.event-label-all-day', {
|
|
2404
|
+
title: event.title,
|
|
2405
|
+
from: this.#dateText(placement.firstDay, false),
|
|
2406
|
+
to: this.#dateText(placement.lastDay, false),
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
else {
|
|
2410
|
+
label = this.#i18n.t('core.component.calendar.event-label', {
|
|
2411
|
+
title: event.title,
|
|
2412
|
+
weekday: this.#weekdayLong(placement.startDay),
|
|
2413
|
+
date: this.#dateText(placement.startDay, false),
|
|
2414
|
+
start,
|
|
2415
|
+
end: placement.inGrid ? end : `${this.#dateText(placement.endDay, false)} ${end}`,
|
|
2416
|
+
});
|
|
2417
|
+
}
|
|
2418
|
+
if (recurring)
|
|
2419
|
+
label = `${label}, ${this.#i18n.t('core.component.calendar.recurring')}`;
|
|
2420
|
+
const root = this.rootAutoId();
|
|
2421
|
+
const move = this.option().move;
|
|
2422
|
+
return {
|
|
2423
|
+
key: event.id,
|
|
2424
|
+
event,
|
|
2425
|
+
placement,
|
|
2426
|
+
range: sdCalendarRangeOf(placement, this.#clock, this.transform()),
|
|
2427
|
+
label,
|
|
2428
|
+
autoId: root ? `${root}-event-${encodeURIComponent(event.id)}` : null,
|
|
2429
|
+
color,
|
|
2430
|
+
customColor,
|
|
2431
|
+
recurring,
|
|
2432
|
+
past: this.dimPast() && placement.endInstant <= this.#nowInstant(),
|
|
2433
|
+
pending: placed.pending,
|
|
2434
|
+
saving: placed.saving,
|
|
2435
|
+
movable: !!move && !this.locked() && sdCalendarAllows(move.movable, event),
|
|
2436
|
+
timeText: placement.allDay ? this.#i18n.t('core.component.calendar.all-day') : `${start} – ${end}`,
|
|
2437
|
+
};
|
|
2438
|
+
}
|
|
2439
|
+
#blockView(placed, column, columns) {
|
|
2440
|
+
const item = this.#itemView(placed);
|
|
2441
|
+
const { startMinutes, endMinutes } = placed.placement;
|
|
2442
|
+
const pixels = Math.max(((endMinutes - startMinutes) / 60) * HOUR_HEIGHT - 2, 16);
|
|
2443
|
+
const size = pixels >= 62 ? 'lg' : pixels >= 34 ? 'md' : pixels >= 20 ? 'sm' : 'xs';
|
|
2444
|
+
return {
|
|
2445
|
+
...item,
|
|
2446
|
+
top: `calc(${offsetTop(startMinutes)} + 1px)`,
|
|
2447
|
+
height: blockHeight(endMinutes - startMinutes),
|
|
2448
|
+
column,
|
|
2449
|
+
columns,
|
|
2450
|
+
size,
|
|
2451
|
+
context: {
|
|
2452
|
+
$implicit: placed.event,
|
|
2453
|
+
event: placed.event,
|
|
2454
|
+
range: item.range,
|
|
2455
|
+
view: this.displayView(),
|
|
2456
|
+
compact: pixels < 34,
|
|
2457
|
+
pending: placed.pending,
|
|
2458
|
+
},
|
|
2459
|
+
};
|
|
2460
|
+
}
|
|
2461
|
+
/** Cells of one month row; `seen` carries the events that already have their `data-autoid` (first segment only). */
|
|
2462
|
+
#monthWeek(week, month, seen) {
|
|
2463
|
+
const placed = this.#inRange().filter(({ placement }) => placement.lastDay >= week[0] && placement.firstDay <= week[week.length - 1]);
|
|
2464
|
+
const spanning = placed.filter(({ placement }) => !placement.inGrid);
|
|
2465
|
+
const layout = sdCalendarAllDayLayout(spanning.map(({ placement }) => placement), week, Number.POSITIVE_INFINITY);
|
|
2466
|
+
return week.map((day, column) => {
|
|
2467
|
+
const view = this.#dayView(day);
|
|
2468
|
+
const slots = [];
|
|
2469
|
+
for (const bar of layout.bars) {
|
|
2470
|
+
if (bar.from > column || bar.to < column)
|
|
2471
|
+
continue;
|
|
2472
|
+
const item = firstSegment(this.#itemView(spanning[bar.index]), seen);
|
|
2473
|
+
const { placement, event } = spanning[bar.index];
|
|
2474
|
+
slots[bar.row] = {
|
|
2475
|
+
key: `${event.id}`,
|
|
2476
|
+
item,
|
|
2477
|
+
bar: true,
|
|
2478
|
+
showTitle: column === bar.from,
|
|
2479
|
+
joinStart: placement.firstDay < day,
|
|
2480
|
+
joinEnd: placement.lastDay > day,
|
|
2481
|
+
text: placement.allDay ? event.title : `${sdCalendarClockText(placement.startMinutes)} ${event.title}`,
|
|
2482
|
+
};
|
|
2483
|
+
}
|
|
2484
|
+
const lines = Array.from(slots, (slot, row) => slot ?? { key: `gap-${row}`, item: null, bar: false, showTitle: false, joinStart: false, joinEnd: false, text: '' });
|
|
2485
|
+
const timed = placed
|
|
2486
|
+
.filter(({ placement }) => placement.inGrid && placement.startDay === day)
|
|
2487
|
+
.sort((a, b) => a.placement.startMinutes - b.placement.startMinutes);
|
|
2488
|
+
for (const entry of timed) {
|
|
2489
|
+
lines.push({
|
|
2490
|
+
key: entry.event.id,
|
|
2491
|
+
item: firstSegment(this.#itemView(entry), seen),
|
|
2492
|
+
bar: false,
|
|
2493
|
+
showTitle: true,
|
|
2494
|
+
joinStart: false,
|
|
2495
|
+
joinEnd: false,
|
|
2496
|
+
text: `${sdCalendarClockText(entry.placement.startMinutes)} ${entry.event.title}`,
|
|
2497
|
+
});
|
|
2498
|
+
}
|
|
2499
|
+
const limit = view.holiday ? 2 : 3;
|
|
2500
|
+
const real = lines.filter(line => line.item).length;
|
|
2501
|
+
const shown = lines.length > limit ? lines.slice(0, limit - 1) : lines;
|
|
2502
|
+
const more = real - shown.filter(line => line.item).length;
|
|
2503
|
+
const events = placed.filter(({ placement }) => placement.firstDay <= day && placement.lastDay >= day).map(({ event }) => event);
|
|
2504
|
+
const label = view.holiday
|
|
2505
|
+
? this.#i18n.t('core.component.calendar.day-label-holiday', {
|
|
2506
|
+
weekday: this.#weekdayLong(day),
|
|
2507
|
+
date: this.#dateText(day, false),
|
|
2508
|
+
holiday: view.holiday.label,
|
|
2509
|
+
count: events.length,
|
|
2510
|
+
})
|
|
2511
|
+
: this.#i18n.t('core.component.calendar.day-label', {
|
|
2512
|
+
weekday: this.#weekdayLong(day),
|
|
2513
|
+
date: this.#dateText(day, false),
|
|
2514
|
+
count: events.length,
|
|
2515
|
+
});
|
|
2516
|
+
const inMonth = sdCalendarDayParts(day).month === month;
|
|
2517
|
+
const dots = new Map();
|
|
2518
|
+
for (const event of events) {
|
|
2519
|
+
const color = event.color ?? 'primary';
|
|
2520
|
+
if (dots.size < 3 && !dots.has(color))
|
|
2521
|
+
dots.set(color, sdCalendarColor(color));
|
|
2522
|
+
}
|
|
2523
|
+
return {
|
|
2524
|
+
day: view,
|
|
2525
|
+
inMonth,
|
|
2526
|
+
label,
|
|
2527
|
+
lines: shown,
|
|
2528
|
+
more,
|
|
2529
|
+
dots: [...dots.values()],
|
|
2530
|
+
context: { $implicit: day, date: day, events, holiday: view.holiday, today: view.today, inMonth, off: view.off },
|
|
2531
|
+
};
|
|
2532
|
+
});
|
|
2533
|
+
}
|
|
2534
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdCalendar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2535
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdCalendar, isStandalone: true, selector: "sd-calendar", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: true, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, selectedId: { classPropertyName: "selectedId", publicName: "selectedId", isSignal: true, isRequired: false, transformFunction: null }, views: { classPropertyName: "views", publicName: "views", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, hideWeekends: { classPropertyName: "hideWeekends", publicName: "hideWeekends", isSignal: true, isRequired: false, transformFunction: null }, workingHours: { classPropertyName: "workingHours", publicName: "workingHours", isSignal: true, isRequired: false, transformFunction: null }, holidays: { classPropertyName: "holidays", publicName: "holidays", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, scrollTime: { classPropertyName: "scrollTime", publicName: "scrollTime", isSignal: true, isRequired: false, transformFunction: null }, agendaDays: { classPropertyName: "agendaDays", publicName: "agendaDays", isSignal: true, isRequired: false, transformFunction: null }, dimPast: { classPropertyName: "dimPast", publicName: "dimPast", isSignal: true, isRequired: false, transformFunction: null }, transform: { classPropertyName: "transform", publicName: "transform", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { view: "viewChange", date: "dateChange", selectedId: "selectedIdChange", sdSelect: "sdSelect", sdRangeChange: "sdRangeChange", sdMove: "sdMove", sdMoveError: "sdMoveError", sdLoadError: "sdLoadError" }, queries: [{ propertyName: "eventTemplate", first: true, predicate: SdCalendarEventTemplateDirective, descendants: true, isSignal: true }, { propertyName: "dayCellTemplate", first: true, predicate: SdCalendarDayCellTemplateDirective, descendants: true, isSignal: true }, { propertyName: "agendaItemTemplate", first: true, predicate: SdCalendarAgendaItemTemplateDirective, descendants: true, isSignal: true }, { propertyName: "emptyTemplate", first: true, predicate: SdCalendarEmptyTemplateDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "scroller", first: true, predicate: ["scroller"], descendants: true, isSignal: true }, { propertyName: "gridElement", first: true, predicate: ["grid"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _view = displayView();\n@let _disabled = disabled();\n@let _selected = selectedId();\n@let _failure = failure();\n<section\n class=\"sd-calendar\"\n role=\"region\"\n [class.sd-calendar--compact]=\"compact()\"\n [attr.data-compact]=\"compact() || null\"\n [attr.aria-label]=\"regionLabel()\"\n [attr.data-autoid]=\"rootAutoId()\"\n [attr.data-view]=\"activeView()\"\n [attr.data-display]=\"_view\"\n [attr.data-from]=\"visible().from\"\n [attr.data-to]=\"visible().to\">\n <header class=\"sd-calendar__toolbar\">\n <div class=\"sd-calendar__nav\">\n <button type=\"button\" class=\"sd-calendar__today\" data-action=\"today\" [attr.data-autoid]=\"childAutoId('today')\" (click)=\"goToday()\">\n {{ 'core.component.calendar.today' | sdTranslate }}\n </button>\n <button\n type=\"button\"\n class=\"sd-calendar__icon-button\"\n data-action=\"prev\"\n [attr.aria-label]=\"prevLabel()\"\n [attr.data-autoid]=\"childAutoId('prev')\"\n [disabled]=\"prevDisabled()\"\n (click)=\"shift(-1)\">\n <sd-icon name=\"chevron_left\" size=\"22px\" aria-hidden=\"true\" />\n </button>\n <button\n type=\"button\"\n class=\"sd-calendar__icon-button\"\n data-action=\"next\"\n [attr.aria-label]=\"nextLabel()\"\n [attr.data-autoid]=\"childAutoId('next')\"\n [disabled]=\"nextDisabled()\"\n (click)=\"shift(1)\">\n <sd-icon name=\"chevron_right\" size=\"22px\" aria-hidden=\"true\" />\n </button>\n </div>\n <div class=\"sd-calendar__title\" data-title>{{ title() }}</div>\n <div class=\"sd-calendar__views\" role=\"group\" [attr.aria-label]=\"'core.component.calendar.views' | sdTranslate\">\n @for (option of viewOptions(); track option) {\n <button\n type=\"button\"\n class=\"sd-calendar__view\"\n [attr.data-view-option]=\"option\"\n [attr.data-autoid]=\"childAutoId('view-' + option)\"\n [attr.aria-pressed]=\"option === _view\"\n (click)=\"setView(option)\">\n {{ viewLabel(option) }}\n </button>\n }\n </div>\n </header>\n\n @if (busy()) {\n <div class=\"sd-calendar__progress\" role=\"progressbar\" [attr.aria-label]=\"'core.component.calendar.label' | sdTranslate\">\n <span class=\"sd-calendar__progress-bar\"></span>\n </div>\n }\n @if (phase() === 'error') {\n <div class=\"sd-calendar__band\" data-band=\"load-error\">\n <sd-icon class=\"sd-calendar__band-icon\" name=\"error\" size=\"18px\" aria-hidden=\"true\" />\n <span class=\"sd-calendar__band-text\">{{ 'core.component.calendar.load-error' | sdTranslate }}</span>\n <button type=\"button\" class=\"sd-calendar__band-button\" data-action=\"retry\" [attr.data-autoid]=\"childAutoId('retry')\" (click)=\"reload()\">\n {{ 'core.common.retry' | sdTranslate }}\n </button>\n </div>\n }\n @if (_failure) {\n <div class=\"sd-calendar__band\" data-band=\"move-error\">\n <sd-icon class=\"sd-calendar__band-icon\" name=\"error\" size=\"18px\" aria-hidden=\"true\" />\n <span class=\"sd-calendar__band-text\">{{ _failure.message }}</span>\n <button type=\"button\" class=\"sd-calendar__band-button\" data-action=\"dismiss\" [attr.data-autoid]=\"childAutoId('dismiss')\" (click)=\"dismissFailure()\">\n {{ 'core.common.dismiss' | sdTranslate }}\n </button>\n </div>\n }\n @if (strip().length) {\n <div class=\"sd-calendar__strip\" data-day-strip (pointerdown)=\"onStripPointerDown($event)\" (pointerup)=\"onStripPointerUp($event)\">\n @for (cell of strip(); track cell.day) {\n <button\n type=\"button\"\n class=\"sd-calendar__strip-day\"\n [attr.data-date]=\"cell.day\"\n [attr.data-today]=\"cell.today || null\"\n [attr.aria-current]=\"cell.current ? 'date' : null\"\n [attr.aria-label]=\"cell.label\"\n (click)=\"pickDay(cell.day)\">\n <span class=\"sd-calendar__strip-weekday\">{{ cell.weekdayShort }}</span>\n <span class=\"sd-calendar__strip-number\">{{ cell.dayNumber }}</span>\n @if (cell.events) {\n <span class=\"sd-calendar__strip-dot\" data-dot aria-hidden=\"true\"></span>\n } @else {\n <span class=\"sd-calendar__strip-dot sd-calendar__strip-dot--empty\" aria-hidden=\"true\"></span>\n }\n </button>\n }\n </div>\n }\n <div class=\"sd-calendar__status sd-visually-hidden\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</div>\n <span class=\"sd-visually-hidden\" [id]=\"gridInstructionsId\">{{ 'core.component.calendar.grid-instructions' | sdTranslate }}</span>\n <span class=\"sd-visually-hidden\" [id]=\"eventInstructionsId\">{{ 'core.component.calendar.event-instructions' | sdTranslate }}</span>\n @if (scopeBar.asking(); as _ask) {\n <div class=\"sd-calendar__scope\" role=\"alertdialog\" [attr.aria-labelledby]=\"scopeMessageId\" (keydown)=\"scopeBar.onKeydown($event)\">\n <p class=\"sd-calendar__scope-message\" [id]=\"scopeMessageId\">\n {{ 'core.component.calendar.scope-message' | sdTranslate: { title: _ask.title } }}\n </p>\n <div class=\"sd-calendar__scope-actions\">\n <button type=\"button\" class=\"sd-calendar__scope-button\" data-scope=\"this\" [attr.data-autoid]=\"childAutoId('scope-this')\" (click)=\"scopeBar.answer('this')\">\n {{ 'core.component.calendar.scope-this' | sdTranslate }}\n </button>\n <button\n type=\"button\"\n class=\"sd-calendar__scope-button\"\n data-scope=\"following\"\n [attr.data-autoid]=\"childAutoId('scope-following')\"\n (click)=\"scopeBar.answer('following')\">\n {{ 'core.component.calendar.scope-following' | sdTranslate }}\n </button>\n <button type=\"button\" class=\"sd-calendar__scope-button\" data-scope=\"all\" [attr.data-autoid]=\"childAutoId('scope-all')\" (click)=\"scopeBar.answer('all')\">\n {{ 'core.component.calendar.scope-all' | sdTranslate }}\n </button>\n <button\n type=\"button\"\n class=\"sd-calendar__scope-button sd-calendar__scope-button--cancel\"\n data-scope=\"cancel\"\n [attr.data-autoid]=\"childAutoId('scope-cancel')\"\n (click)=\"scopeBar.answer(null)\">\n {{ 'core.common.cancel' | sdTranslate }}\n </button>\n </div>\n </div>\n }\n\n @if (invalid()) {\n <sd-data-state class=\"sd-calendar__invalid\" state=\"error\" compact [title]=\"'core.component.calendar.invalid-data' | sdTranslate\" />\n } @else if (_view === 'week' || _view === 'day') {\n @let _days = dayViews();\n @let _allDay = allDay();\n @let _ghost = ghost();\n @let _proposal = dragProposal();\n @let _cursor = cursor();\n <div\n #scroller\n class=\"sd-calendar__scroller\"\n data-region=\"scroller\"\n [style.--sd-calendar-days]=\"_days.length\"\n [style.--sd-calendar-print-start]=\"printHours().start\"\n [style.--sd-calendar-print-hours]=\"printHours().hours\">\n <div class=\"sd-calendar__head\" data-head>\n @if (_view === 'week') {\n <div class=\"sd-calendar__day-headers\">\n <div class=\"sd-calendar__corner\" data-zone>{{ zoneLabel() }}</div>\n @for (day of _days; track day.day) {\n <div class=\"sd-calendar__day-header\" data-day-header [attr.data-date]=\"day.day\" [attr.data-today]=\"day.today || null\">\n <span class=\"sd-calendar__weekday\">{{ day.weekdayShort }}</span>\n <button type=\"button\" class=\"sd-calendar__day-number\" [attr.aria-label]=\"day.label\" (click)=\"openDay(day.day)\">\n {{ day.dayNumber }}\n </button>\n @if (day.holiday; as holiday) {\n <span class=\"sd-calendar__holiday\" [attr.data-holiday]=\"holiday.type\" [attr.title]=\"holiday.label\">{{ holiday.label }}</span>\n }\n </div>\n }\n </div>\n }\n <div class=\"sd-calendar__all-day\">\n <div class=\"sd-calendar__all-day-label\">\n @if (_view === 'day') {\n <span class=\"sd-calendar__zone\" data-zone>{{ zoneLabel() }}</span>\n }\n {{ 'core.component.calendar.all-day' | sdTranslate }}\n </div>\n <div class=\"sd-calendar__all-day-grid\">\n @for (bar of _allDay.bars; track bar.key) {\n <div\n class=\"sd-calendar__bar\"\n role=\"button\"\n [attr.tabindex]=\"_disabled ? -1 : 0\"\n [attr.aria-label]=\"bar.label\"\n [attr.aria-describedby]=\"eventInstructionsId\"\n [attr.data-event-id]=\"bar.event.id\"\n [attr.data-autoid]=\"bar.autoId\"\n [attr.data-start]=\"bar.range.start\"\n [attr.data-end]=\"bar.range.end\"\n [attr.data-all-day]=\"bar.placement.allDay\"\n [attr.data-color]=\"bar.color\"\n [attr.data-past]=\"bar.past || null\"\n [attr.data-pending]=\"bar.pending || null\"\n [attr.data-selected]=\"bar.key === _selected || null\"\n [attr.data-failed]=\"isFailed(bar.key) || null\"\n [attr.data-clipped-start]=\"bar.clippedStart || null\"\n [attr.data-clipped-end]=\"bar.clippedEnd || null\"\n [style.--sd-calendar-event-color]=\"bar.customColor\"\n [style.grid-column]=\"bar.from + 1 + ' / ' + (bar.to + 2)\"\n [style.grid-row]=\"bar.row + 1\"\n (click)=\"selectItem(bar.event, $event)\"\n (keydown)=\"onItemKeydown($event, bar)\">\n @if (bar.clippedStart) {\n <sd-icon class=\"sd-calendar__clip\" name=\"chevron_left\" size=\"16px\" aria-hidden=\"true\" />\n }\n <span class=\"sd-calendar__dot\" aria-hidden=\"true\"></span>\n @if (bar.recurring) {\n <sd-icon class=\"sd-calendar__repeat\" name=\"repeat\" size=\"13px\" aria-hidden=\"true\" />\n }\n <span class=\"sd-calendar__bar-title\">{{ bar.text }}</span>\n @if (bar.saving) {\n <sd-icon class=\"sd-calendar__sync\" name=\"sync\" size=\"14px\" aria-hidden=\"true\" />\n }\n @if (_view === 'day' && bar.spanText) {\n <span class=\"sd-calendar__bar-span\">{{ bar.spanText }}</span>\n }\n @if (bar.clippedEnd) {\n <sd-icon class=\"sd-calendar__clip\" name=\"chevron_right\" size=\"16px\" aria-hidden=\"true\" />\n }\n </div>\n }\n @for (count of _allDay.more; track $index) {\n @if (count) {\n <button\n type=\"button\"\n class=\"sd-calendar__more\"\n data-more\n [attr.data-date]=\"_days[$index].day\"\n [style.grid-column]=\"$index + 1\"\n [style.grid-row]=\"_allDay.rows + 1\"\n [attr.aria-label]=\"allDayMoreLabel(count, _days[$index])\"\n (click)=\"openDay(_days[$index].day)\">\n {{ 'core.component.calendar.more-short' | sdTranslate: { count } }}\n </button>\n }\n }\n </div>\n </div>\n </div>\n <div class=\"sd-calendar__body\">\n <div class=\"sd-calendar__gutter\" aria-hidden=\"true\">\n @for (hour of hours; track hour) {\n <span class=\"sd-calendar__hour\" [style.top]=\"'calc(var(--sd-calendar-hour-height) * ' + hour + ')'\">{{ hour < 10 ? '0' + hour : hour }}:00</span>\n }\n </div>\n <div\n #grid\n class=\"sd-calendar__columns\"\n data-region=\"time-grid\"\n role=\"group\"\n tabindex=\"0\"\n [class.sd-calendar__columns--create]=\"canCreate()\"\n [class.sd-calendar__columns--blocked]=\"!!ghost()?.blocked\"\n [attr.aria-label]=\"title()\"\n [attr.aria-describedby]=\"gridInstructionsId\"\n [attr.aria-activedescendant]=\"_cursor ? cursorId : null\"\n [attr.aria-busy]=\"busy() || null\"\n [attr.aria-disabled]=\"_disabled || null\"\n (focus)=\"onGridFocus()\"\n (keydown)=\"onGridKeydown($event)\"\n (pointerdown)=\"onGridPointerDown($event)\"\n (pointermove)=\"onGridPointerMove($event)\"\n (pointerup)=\"onGridPointerUp($event)\"\n (pointercancel)=\"onGridPointerCancel()\">\n @for (day of _days; track day.day; let column = $index) {\n <div\n class=\"sd-calendar__column\"\n data-day-column\n [attr.data-date]=\"day.day\"\n [attr.data-today]=\"day.today || null\"\n [attr.data-off]=\"day.off || null\"\n [attr.data-out-of-range]=\"day.outOfRange || null\">\n @for (segment of day.offSegments; track segment.start) {\n <div\n class=\"sd-calendar__off\"\n data-off-hours\n aria-hidden=\"true\"\n [style.top]=\"spanTop(segment.start)\"\n [style.height]=\"'calc(var(--sd-calendar-hour-height) * ' + (segment.end - segment.start) / 60 + ')'\"></div>\n }\n @if (skeleton()) {\n @for (shape of skeletonBlocks; track $index) {\n @if (shape[0] === column) {\n <div class=\"sd-calendar__skeleton\" data-skeleton aria-hidden=\"true\" [style.top]=\"spanTop(shape[1])\" [style.height]=\"spanHeight(shape[2])\"></div>\n }\n }\n }\n @if (_cursor && _cursor.day === day.day) {\n <div\n class=\"sd-calendar__cursor\"\n data-cursor\n [id]=\"cursorId\"\n [attr.aria-label]=\"cursorLabel()\"\n [style.top]=\"spanTop(_cursor.minutes)\"\n [style.height]=\"'calc(var(--sd-calendar-hour-height) * ' + stepValue() / 60 + ')'\">\n {{ clockText(_cursor.minutes) }}\n </div>\n }\n @for (block of blocksOf(day.day); track block.key) {\n <div\n class=\"sd-calendar__event\"\n role=\"button\"\n cdkDrag\n [cdkDragDisabled]=\"!block.movable\"\n [cdkDragStartDelay]=\"dragDelay\"\n [cdkDragConstrainPosition]=\"constrainDrag\"\n [attr.tabindex]=\"_disabled ? -1 : 0\"\n [attr.aria-label]=\"block.label\"\n [attr.aria-describedby]=\"eventInstructionsId\"\n [attr.data-event-id]=\"block.event.id\"\n [attr.data-autoid]=\"block.autoId\"\n [attr.data-start]=\"block.range.start\"\n [attr.data-end]=\"block.range.end\"\n [attr.data-all-day]=\"false\"\n [attr.data-color]=\"block.color\"\n [attr.data-size]=\"block.size\"\n [attr.data-past]=\"block.past || null\"\n [attr.data-pending]=\"block.pending || null\"\n [attr.data-selected]=\"block.key === _selected || null\"\n [attr.data-failed]=\"isFailed(block.key) || null\"\n [attr.data-dragging]=\"isDragging(block.key) || null\"\n [attr.data-movable]=\"block.movable || null\"\n [style.--sd-calendar-event-color]=\"block.customColor\"\n [style.--sd-calendar-column]=\"block.column\"\n [style.--sd-calendar-columns]=\"block.columns\"\n [style.top]=\"block.top\"\n [style.height]=\"blockHeight(block)\"\n (cdkDragStarted)=\"onDragStarted($event, block)\"\n (cdkDragMoved)=\"onDragMoved()\"\n (cdkDragEnded)=\"onDragEnded($event)\"\n (mousedown)=\"onPressItem($event)\"\n (touchstart)=\"onPressItem($event)\"\n (click)=\"selectItem(block.event, $event)\"\n (keydown)=\"onItemKeydown($event, block)\">\n <span class=\"sd-calendar__dot\" aria-hidden=\"true\"></span>\n @if (eventTemplate(); as _template) {\n <div class=\"sd-calendar__event-content\">\n <ng-container [ngTemplateOutlet]=\"_template.template\" [ngTemplateOutletContext]=\"block.context\" />\n </div>\n } @else {\n <div class=\"sd-calendar__event-content\">\n <span class=\"sd-calendar__event-title\">\n @if (block.recurring) {\n <sd-icon class=\"sd-calendar__repeat\" name=\"repeat\" size=\"13px\" aria-hidden=\"true\" />\n }\n {{ block.event.title }}@if (block.size === 'sm' || block.size === 'xs') {\n <span>, {{ block.timeText.slice(0, 5) }}</span>\n }\n </span>\n @if (block.size === 'lg' || block.size === 'md') {\n <span class=\"sd-calendar__event-time\">{{ blockTime(block) }}</span>\n }\n </div>\n }\n @if (block.saving) {\n <sd-icon class=\"sd-calendar__sync\" name=\"sync\" size=\"14px\" aria-hidden=\"true\" />\n }\n @if (block.movable) {\n <div\n class=\"sd-calendar__resize\"\n data-resize-handle\n aria-hidden=\"true\"\n (mousedown)=\"$event.stopPropagation()\"\n (touchstart)=\"$event.stopPropagation()\"\n (pointerdown)=\"onResizeDown($event, block)\"\n (pointermove)=\"onResizeMove($event)\"\n (pointerup)=\"onResizeUp($event)\"\n (pointercancel)=\"onResizeCancel()\"></div>\n }\n </div>\n }\n @if (_ghost && _ghost.day === day.day) {\n <div\n class=\"sd-calendar__ghost\"\n data-create-ghost\n aria-hidden=\"true\"\n [attr.data-pending]=\"_ghost.pending || null\"\n [attr.data-blocked]=\"_ghost.blocked || null\"\n [style.top]=\"spanTop(_ghost.start)\"\n [style.height]=\"spanHeight(_ghost.end - _ghost.start)\">\n <span class=\"sd-calendar__event-title\">{{ 'core.component.calendar.new-event' | sdTranslate }}</span>\n <span class=\"sd-calendar__event-time\">{{ clockText(_ghost.start) }} \u2013 {{ clockText(_ghost.end) }}</span>\n @if (_ghost.pending) {\n <sd-icon class=\"sd-calendar__sync\" name=\"sync\" size=\"14px\" aria-hidden=\"true\" />\n }\n </div>\n }\n @if (_proposal && !_proposal.outside && _proposal.day === day.day) {\n <div\n class=\"sd-calendar__proposal\"\n data-drag-proposal\n aria-hidden=\"true\"\n [attr.data-color]=\"_proposal.color\"\n [style.--sd-calendar-event-color]=\"_proposal.customColor\"\n [style.top]=\"spanTop(_proposal.start)\"\n [style.height]=\"spanHeight(_proposal.end - _proposal.start)\">\n <span class=\"sd-calendar__dot\" aria-hidden=\"true\"></span>\n <div class=\"sd-calendar__event-content\">\n <span class=\"sd-calendar__event-title\">{{ _proposal.title }}</span>\n <span class=\"sd-calendar__event-time\">{{ clockText(_proposal.start) }} \u2013 {{ clockText(_proposal.end) }}</span>\n </div>\n </div>\n }\n @if (day.today) {\n <div class=\"sd-calendar__now\" data-now aria-hidden=\"true\" [style.top]=\"nowTop()\"></div>\n }\n </div>\n }\n </div>\n </div>\n </div>\n } @else if (_view === 'month') {\n <div\n class=\"sd-calendar__month\"\n role=\"grid\"\n [style.--sd-calendar-month-columns]=\"monthHeaders().length\"\n [attr.aria-label]=\"title()\"\n [attr.aria-busy]=\"busy() || null\"\n [attr.aria-disabled]=\"_disabled || null\">\n <div class=\"sd-calendar__month-head\" role=\"row\">\n @for (weekday of monthHeaders(); track $index) {\n <div class=\"sd-calendar__month-weekday\" role=\"columnheader\">{{ weekday }}</div>\n }\n </div>\n @for (week of monthWeeks(); track $index) {\n <div class=\"sd-calendar__month-row\" role=\"row\">\n @for (cell of week; track cell.day.day) {\n <div\n class=\"sd-calendar__cell\"\n role=\"gridcell\"\n [attr.tabindex]=\"cell.day.day === monthFocusDay() ? 0 : -1\"\n [attr.aria-label]=\"cell.label\"\n [attr.data-date]=\"cell.day.day\"\n [attr.data-today]=\"cell.day.today || null\"\n [attr.data-off]=\"cell.day.off || null\"\n [attr.data-out-of-month]=\"!cell.inMonth || null\"\n [attr.data-out-of-range]=\"cell.day.outOfRange || null\"\n (click)=\"openDay(cell.day.day)\"\n (keydown)=\"onCellKeydown($event, cell.day.day)\">\n <div class=\"sd-calendar__cell-head\">\n <span class=\"sd-calendar__cell-number\">{{ cell.day.dayNumber }}</span>\n @if (!compact() && cell.day.holiday; as holiday) {\n <span class=\"sd-calendar__cell-holiday\" [attr.data-holiday]=\"holiday.type\" [attr.title]=\"holiday.label\">{{ holiday.label }}</span>\n }\n </div>\n @if (compact()) {\n <div class=\"sd-calendar__cell-dots\" aria-hidden=\"true\">\n @for (dot of cell.dots; track dot.color + (dot.customColor ?? '')) {\n <span class=\"sd-calendar__cell-dot\" data-dot [attr.data-color]=\"dot.color\" [style.--sd-calendar-event-color]=\"dot.customColor\"></span>\n }\n </div>\n } @else {\n @if (dayCellTemplate(); as _template) {\n <ng-container [ngTemplateOutlet]=\"_template.template\" [ngTemplateOutletContext]=\"cell.context\" />\n } @else {\n @for (line of cell.lines; track line.key) {\n @if (line.item; as item) {\n <!-- why: chips stay out of the tab order (\u00A79.7); the cell is the keyboard target and opens the day. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"sd-calendar__chip\"\n [class.sd-calendar__chip--bar]=\"line.bar\"\n [attr.data-event-id]=\"item.event.id\"\n [attr.data-autoid]=\"item.autoId\"\n [attr.data-color]=\"item.color\"\n [attr.data-past]=\"item.past || null\"\n [attr.data-selected]=\"item.key === _selected || null\"\n [attr.data-join-start]=\"line.joinStart || null\"\n [attr.data-join-end]=\"line.joinEnd || null\"\n [attr.title]=\"item.label\"\n [style.--sd-calendar-event-color]=\"item.customColor\"\n (click)=\"selectItem(item.event, $event)\">\n @if (line.showTitle) {\n <span class=\"sd-calendar__dot\" aria-hidden=\"true\"></span>\n <span class=\"sd-calendar__chip-text\">{{ line.text }}</span>\n }\n </div>\n } @else {\n <div class=\"sd-calendar__chip sd-calendar__chip--gap\" aria-hidden=\"true\"></div>\n }\n }\n @if (cell.more) {\n <button\n type=\"button\"\n class=\"sd-calendar__month-more\"\n data-more\n tabindex=\"-1\"\n [attr.data-date]=\"cell.day.day\"\n (click)=\"$event.stopPropagation(); openDay(cell.day.day)\">\n {{ 'core.component.calendar.more' | sdTranslate: { count: cell.more } }}\n </button>\n }\n }\n }\n </div>\n }\n </div>\n }\n </div>\n } @else {\n <div class=\"sd-calendar__agenda\" [attr.aria-busy]=\"busy() || null\">\n @for (group of agenda(); track group.day.day) {\n <div class=\"sd-calendar__agenda-day\" role=\"group\" data-agenda-day [attr.data-date]=\"group.day.day\" [attr.aria-label]=\"group.heading\">\n <div class=\"sd-calendar__agenda-heading\" [attr.data-today]=\"group.day.today || null\">\n <span>{{ group.heading }}</span>\n @if (group.day.today) {\n <span class=\"sd-calendar__agenda-today\">{{ 'core.component.calendar.today' | sdTranslate }}</span>\n }\n @if (group.day.holiday; as holiday) {\n <span class=\"sd-calendar__agenda-holiday\" [attr.data-holiday]=\"holiday.type\">{{ holiday.label }}</span>\n }\n </div>\n <div class=\"sd-calendar__agenda-rows\">\n @for (row of group.rows; track row.key) {\n <div\n class=\"sd-calendar__agenda-row\"\n role=\"button\"\n [attr.tabindex]=\"_disabled ? -1 : 0\"\n [attr.aria-label]=\"row.label\"\n [attr.data-event-id]=\"row.event.id\"\n [attr.data-autoid]=\"row.autoId\"\n [attr.data-color]=\"row.color\"\n [attr.data-past]=\"row.past || null\"\n [attr.data-pending]=\"row.pending || null\"\n [attr.data-selected]=\"row.key === _selected || null\"\n [style.--sd-calendar-event-color]=\"row.customColor\"\n (click)=\"selectItem(row.event, $event)\"\n (keydown)=\"onItemKeydown($event, row)\">\n <span class=\"sd-calendar__agenda-time\">{{ row.timeText }}</span>\n <span class=\"sd-calendar__agenda-title\">\n <span class=\"sd-calendar__dot\" aria-hidden=\"true\"></span>\n <span class=\"sd-calendar__agenda-text\">{{ row.event.title }}</span>\n @if (row.recurring) {\n <sd-icon class=\"sd-calendar__repeat\" name=\"repeat\" size=\"15px\" aria-hidden=\"true\" />\n }\n </span>\n @if (wide() && agendaItemTemplate(); as _template) {\n <span class=\"sd-calendar__agenda-place\" data-agenda-place>\n <ng-container [ngTemplateOutlet]=\"_template.template\" [ngTemplateOutletContext]=\"row.context\" />\n </span>\n }\n </div>\n }\n </div>\n </div>\n } @empty {\n @if (!busy()) {\n @if (emptyTemplate(); as _empty) {\n <ng-container [ngTemplateOutlet]=\"_empty.template\" [ngTemplateOutletContext]=\"{ $implicit: visible() }\" />\n } @else {\n <div class=\"sd-calendar__empty\">\n <sd-icon class=\"sd-calendar__empty-icon\" name=\"event_available\" size=\"28px\" aria-hidden=\"true\" />\n <p class=\"sd-calendar__empty-text\" data-empty>\n {{ 'core.component.calendar.empty-agenda' | sdTranslate: { count: agendaCount() } }}\n </p>\n </div>\n }\n }\n }\n </div>\n }\n</section>\n", styles: [":host{--sd-calendar-hour-height: 48px;--sd-calendar-gutter-width: 56px;--sd-calendar-event-radius: var(--sd-radius-6, 6px);display:block;min-width:0;text-align:start}.sd-calendar{--sd-calendar-reserve: 8px;position:relative;display:flex;flex-direction:column;box-sizing:border-box;height:100%;overflow:hidden;border:1px solid var(--sd-border, #c4c6d0);border-radius:var(--sd-radius-12, 12px);background:var(--sd-surface, #fdfbff);color:var(--sd-text, #1a1b1f);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.sd-calendar[data-display=day]{--sd-calendar-reserve: 24px}.sd-calendar__toolbar{display:flex;flex:none;align-items:center;gap:12px;height:56px;padding-block:0;padding-inline:14px 12px;border-bottom:1px solid var(--sd-calendar-line, #dedee5)}.sd-calendar__nav{display:flex;flex:none;align-items:center;gap:4px}.sd-calendar__today{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__today:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__today{height:var(--sd-control-height-sm, 32px);margin-inline-end:4px;padding:0 14px;border:1px solid var(--sd-border, #c4c6d0);border-radius:var(--sd-radius-8, 8px);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__icon-button{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__icon-button{display:inline-flex;align-items:center;justify-content:center;width:var(--sd-control-height-sm, 32px);height:var(--sd-control-height-sm, 32px);border-radius:var(--sd-radius-999, 999px);color:var(--sd-text-secondary, #44474f)}.sd-calendar__icon-button:disabled{cursor:default;opacity:.38}.sd-calendar__title{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;font-size:var(--sd-font-size-18, 18px);line-height:var(--sd-line-height-24, 24px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__views{display:flex;flex:none;overflow:hidden;border:1px solid var(--sd-border, #c4c6d0);border-radius:var(--sd-radius-8, 8px)}.sd-calendar__view{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__view:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__view{height:30px;padding:0 12px;font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__view+.sd-calendar__view{border-inline-start:1px solid var(--sd-border, #c4c6d0)}.sd-calendar__view[aria-pressed=true]{background:var(--sd-primary-light, #dbe8f5);color:var(--sd-text, #1a1b1f)}.sd-calendar__view:focus-visible{outline-offset:-2px}@media(hover:hover){.sd-calendar__today:hover,.sd-calendar__icon-button:not(:disabled):hover,.sd-calendar__view:not([aria-pressed=true]):hover{background:color-mix(in srgb,var(--sd-text, #1a1b1f) 6%,transparent)}}.sd-calendar__progress{position:relative;flex:none;height:2px;overflow:hidden;background:var(--sd-primary-light, #dbe8f5)}.sd-calendar__progress-bar{position:absolute;inset:0 auto 0 0;width:40%;background:var(--sd-primary, #005cbb);animation:sd-calendar-progress 1.2s ease-in-out infinite}@keyframes sd-calendar-progress{0%{transform:translate(-100%)}to{transform:translate(250%)}}.sd-calendar__band{display:flex;flex:none;align-items:center;gap:8px;padding:8px 10px;border-bottom:1px solid color-mix(in srgb,var(--sd-error, #ba1a1a) 28%,var(--sd-surface, #fdfbff));background:var(--sd-status-error-bg, #f5dfdf);color:var(--sd-status-error-fg, #9c1616);font-size:var(--sd-font-size-13, 13px)}.sd-calendar__band-icon{flex:none;color:var(--sd-error, #ba1a1a)}.sd-calendar__band-text{flex:1;min-width:0}.sd-calendar__band-button{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__band-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__band-button{flex:none;height:28px;padding:0 12px;border:1px solid var(--sd-error, #ba1a1a);border-radius:var(--sd-radius-8, 8px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__status{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.sd-calendar__invalid{flex:1;min-height:0}.sd-calendar__scroller{position:relative;flex:1 1 620px;min-height:0;overflow:auto;overflow-anchor:none}.sd-calendar__head{position:sticky;top:0;z-index:5;background:var(--sd-surface, #fdfbff)}.sd-calendar__day-headers{display:grid;grid-template-columns:var(--sd-calendar-gutter-width) repeat(var(--sd-calendar-days),minmax(0,1fr));height:72px}.sd-calendar__day-header{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-width:0;border-inline-start:1px solid var(--sd-calendar-line, #dedee5)}.sd-calendar__weekday{color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-14, 14px);font-weight:var(--sd-font-weight-medium, 500);letter-spacing:.04em}[data-today]>.sd-calendar__weekday{color:var(--sd-calendar-today, #005cbb)}.sd-calendar__day-number{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__day-number:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__day-number{width:32px;height:32px;border-radius:var(--sd-radius-999, 999px);font-size:var(--sd-font-size-18, 18px);font-weight:var(--sd-font-weight-medium, 500)}[data-today]>.sd-calendar__day-number{background:var(--sd-calendar-today, #005cbb);color:var(--sd-primary-contrast, #ffffff)}.sd-calendar__holiday{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:100%;padding:0 4px;box-sizing:border-box;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-14, 14px)}.sd-calendar__holiday[data-holiday=off]{color:var(--sd-error, #ba1a1a)}.sd-calendar__corner,.sd-calendar__zone{display:block;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-14, 14px);text-align:end}.sd-calendar__corner{align-self:end;padding-block:0 6px;padding-inline:0 8px}.sd-calendar__all-day{display:grid;grid-template-columns:var(--sd-calendar-gutter-width) minmax(0,1fr);min-height:30px;border-top:1px solid var(--sd-calendar-line, #dedee5);border-bottom:1px solid var(--sd-border, #c4c6d0)}.sd-calendar__all-day-label{padding-block:8px 0;padding-inline:0 8px;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-14, 14px);text-align:end}.sd-calendar__all-day-grid{display:grid;-webkit-user-select:none;user-select:none;grid-template-columns:repeat(var(--sd-calendar-days),minmax(0,1fr));grid-auto-rows:22px;gap:2px 0;padding:4px 0}.sd-calendar__bar{display:flex;align-items:center;gap:4px;min-width:0;margin:0 2px;padding:0 6px;border:1px solid var(--sd-calendar-event-border);border-radius:var(--sd-radius-4, 4px);background:var(--sd-calendar-event-bg);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);font-weight:600;cursor:pointer}.sd-calendar__bar[data-clipped-start]{border-start-start-radius:0;border-end-start-radius:0}.sd-calendar__bar[data-clipped-end]{border-start-end-radius:0;border-end-end-radius:0}.sd-calendar__bar-title{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0}.sd-calendar__bar-span{flex:none;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);font-weight:400}.sd-calendar__clip{flex:none;color:var(--sd-text-secondary, #44474f)}.sd-calendar__more{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__more:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__more{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:0 6px;color:var(--sd-primary, #005cbb);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-medium, 500);text-align:start}.sd-calendar__body{display:grid;grid-template-columns:var(--sd-calendar-gutter-width) minmax(0,1fr)}.sd-calendar__gutter{position:relative;height:calc(var(--sd-calendar-hour-height) * 24)}.sd-calendar__hour{position:absolute;inset-inline-end:8px;margin-top:-7px;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-14, 14px)}.sd-calendar__columns{position:relative;display:grid;-webkit-user-select:none;user-select:none;grid-template-columns:repeat(var(--sd-calendar-days),minmax(0,1fr));height:calc(var(--sd-calendar-hour-height) * 24)}.sd-calendar__columns:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px);outline-offset:-2px}.sd-calendar__column{position:relative;min-width:0;border-inline-start:1px solid var(--sd-calendar-line, #dedee5);background-image:linear-gradient(to bottom,transparent calc(100% - 1px),var(--sd-calendar-line, #dedee5) calc(100% - 1px)),linear-gradient(to bottom,transparent calc(50% - 1px),var(--sd-calendar-line-half, #efeef3) calc(50% - 1px),var(--sd-calendar-line-half, #efeef3) 50%,transparent 50%);background-size:100% var(--sd-calendar-hour-height)}.sd-calendar__column[data-off],.sd-calendar__column[data-out-of-range]{background-color:var(--sd-calendar-off-hours, #f3f3f7)}.sd-calendar__column[data-out-of-range]{cursor:not-allowed}.sd-calendar__off{position:absolute;inset-inline-end:0;inset-inline-start:0;background:var(--sd-calendar-off-hours, #f3f3f7);pointer-events:none}.sd-calendar__now{position:absolute;inset-inline-end:0;inset-inline-start:0;z-index:4;height:2px;background:var(--sd-calendar-now, #ba1a1a);pointer-events:none}.sd-calendar__now:before{position:absolute;top:-4px;inset-inline-start:-5px;width:10px;height:10px;border-radius:var(--sd-radius-999, 999px);background:inherit;content:\"\"}.sd-calendar__skeleton{position:absolute;inset-inline-end:var(--sd-calendar-reserve);inset-inline-start:2px;border-radius:var(--sd-radius-6, 6px);background:var(--sd-surface-muted, #e7e8ed)}.sd-calendar__event,.sd-calendar__bar,.sd-calendar__chip,.sd-calendar__agenda-row,.sd-calendar__cell-dot,.sd-calendar__proposal{--sd-calendar-event-bg: color-mix(in srgb, var(--sd-calendar-event-color) 14%, var(--sd-surface, #fdfbff));--sd-calendar-event-border: color-mix(in srgb, var(--sd-calendar-event-color) 28%, var(--sd-surface, #fdfbff));--sd-calendar-event-dot: var(--sd-calendar-event-color)}.sd-calendar__event[data-color=primary],.sd-calendar__bar[data-color=primary],.sd-calendar__chip[data-color=primary],.sd-calendar__agenda-row[data-color=primary],.sd-calendar__cell-dot[data-color=primary],.sd-calendar__proposal[data-color=primary]{--sd-calendar-event-color: var(--sd-primary, #005cbb);--sd-calendar-event-bg: var(--sd-primary-light, #dbe8f5)}.sd-calendar__event[data-color=secondary],.sd-calendar__bar[data-color=secondary],.sd-calendar__chip[data-color=secondary],.sd-calendar__agenda-row[data-color=secondary],.sd-calendar__cell-dot[data-color=secondary],.sd-calendar__proposal[data-color=secondary]{--sd-calendar-event-color: var(--sd-secondary, #5c6270);--sd-calendar-event-bg: var(--sd-secondary-light, #ebecee)}.sd-calendar__event[data-color=info],.sd-calendar__bar[data-color=info],.sd-calendar__chip[data-color=info],.sd-calendar__agenda-row[data-color=info],.sd-calendar__cell-dot[data-color=info],.sd-calendar__proposal[data-color=info]{--sd-calendar-event-color: var(--sd-info, #006a6a);--sd-calendar-event-bg: var(--sd-info-light, #dbeaea)}.sd-calendar__event[data-color=success],.sd-calendar__bar[data-color=success],.sd-calendar__chip[data-color=success],.sd-calendar__agenda-row[data-color=success],.sd-calendar__cell-dot[data-color=success],.sd-calendar__proposal[data-color=success]{--sd-calendar-event-color: var(--sd-success, #2e7d32);--sd-calendar-event-bg: var(--sd-success-light, #e2ede2)}.sd-calendar__event[data-color=warning],.sd-calendar__bar[data-color=warning],.sd-calendar__chip[data-color=warning],.sd-calendar__agenda-row[data-color=warning],.sd-calendar__cell-dot[data-color=warning],.sd-calendar__proposal[data-color=warning]{--sd-calendar-event-color: var(--sd-warning, #a66300);--sd-calendar-event-bg: var(--sd-warning-light, #f3e9db)}.sd-calendar__event[data-color=error],.sd-calendar__bar[data-color=error],.sd-calendar__chip[data-color=error],.sd-calendar__agenda-row[data-color=error],.sd-calendar__cell-dot[data-color=error],.sd-calendar__proposal[data-color=error]{--sd-calendar-event-color: var(--sd-error, #ba1a1a);--sd-calendar-event-bg: var(--sd-error-light, #f5dfdf)}.sd-calendar__event[data-past],.sd-calendar__bar[data-past],.sd-calendar__chip[data-past],.sd-calendar__agenda-row[data-past],.sd-calendar__cell-dot[data-past],.sd-calendar__proposal[data-past]{--sd-calendar-event-dot: color-mix(in srgb, var(--sd-calendar-event-color) 45%, var(--sd-surface, #fdfbff))}.sd-calendar__event[data-past],.sd-calendar__bar[data-past],.sd-calendar__chip--bar[data-past]{border-color:color-mix(in srgb,var(--sd-calendar-event-border) 50%,var(--sd-surface, #fdfbff));background:color-mix(in srgb,var(--sd-calendar-event-bg) 45%,var(--sd-surface, #fdfbff))}.sd-calendar__dot{flex:none;width:6px;height:6px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-calendar-event-dot)}.sd-calendar__repeat{flex:none;vertical-align:-2px;color:var(--sd-text-secondary, #44474f)}.sd-calendar__event{position:absolute;inset-inline-start:calc(2px + (100% - 2px - var(--sd-calendar-reserve)) * var(--sd-calendar-column) / var(--sd-calendar-columns));z-index:1;display:flex;align-items:flex-start;gap:4px;box-sizing:border-box;width:calc((100% - 2px - var(--sd-calendar-reserve)) / var(--sd-calendar-columns));padding:2px 6px;overflow:hidden;border:1px solid var(--sd-calendar-event-border);border-radius:var(--sd-calendar-event-radius);background:var(--sd-calendar-event-bg);color:var(--sd-text, #1a1b1f);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);cursor:pointer;transition:box-shadow .15s,background-color .15s}.sd-calendar__event>.sd-calendar__dot{margin-top:5px}.sd-calendar__event[data-size=sm],.sd-calendar__event[data-size=xs]{align-items:center;padding:0 6px}.sd-calendar__event[data-size=sm]>.sd-calendar__dot,.sd-calendar__event[data-size=xs]>.sd-calendar__dot{margin-top:0}.sd-calendar__event[data-size=xs]{font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-14, 14px)}.sd-calendar__event[data-selected],.sd-calendar__bar[data-selected]{z-index:2;border-color:var(--sd-calendar-event-color);box-shadow:var(--sd-shadow-md)}.sd-calendar__event:focus-visible,.sd-calendar__bar:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}@media(hover:hover){.sd-calendar__event:hover,.sd-calendar__bar:hover{background:color-mix(in srgb,var(--sd-calendar-event-color) 7%,var(--sd-calendar-event-bg));box-shadow:var(--sd-shadow-sm)}}.sd-calendar__event-content{display:flex;flex:1;flex-direction:column;min-width:0}.sd-calendar__event-title{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:600}.sd-calendar__event-time{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--sd-text-secondary, #44474f)}.sd-calendar__month{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;overflow:auto}.sd-calendar__month-head,.sd-calendar__month-row{display:grid;grid-template-columns:repeat(var(--sd-calendar-month-columns, 7),minmax(0,1fr))}.sd-calendar__month-weekday{padding:8px 8px 6px;border-bottom:1px solid var(--sd-calendar-line, #dedee5);color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__month-row{flex:1 0 auto}.sd-calendar__cell{display:flex;flex-direction:column;gap:2px;min-width:0;min-height:104px;box-sizing:border-box;padding:4px;border-bottom:1px solid var(--sd-calendar-line, #dedee5);border-inline-start:1px solid var(--sd-calendar-line, #dedee5);cursor:pointer}.sd-calendar__cell[data-off]{background:var(--sd-calendar-off-hours, #f3f3f7)}.sd-calendar__cell[data-out-of-range]{background:var(--sd-calendar-off-hours, #f3f3f7);cursor:not-allowed}.sd-calendar__cell:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px);outline-offset:-2px}.sd-calendar__cell-head{display:flex;align-items:center;gap:4px;min-width:0}.sd-calendar__cell-number{display:inline-flex;flex:none;align-items:center;justify-content:center;width:26px;height:26px;border-radius:var(--sd-radius-999, 999px);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500)}[data-out-of-month] .sd-calendar__cell-number{color:var(--sd-border-strong, #74777f)}[data-today] .sd-calendar__cell-number{background:var(--sd-calendar-today, #005cbb);color:var(--sd-primary-contrast, #ffffff)}.sd-calendar__cell-holiday{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px)}.sd-calendar__cell-holiday[data-holiday=off]{color:var(--sd-error, #ba1a1a)}.sd-calendar__chip{display:flex;align-items:center;gap:4px;min-width:0;height:20px;padding:0 4px;border-radius:var(--sd-radius-4, 4px);font-size:var(--sd-font-size-12, 12px);line-height:20px}.sd-calendar__chip--bar{background:var(--sd-calendar-event-bg)}.sd-calendar__chip--bar[data-join-start]{margin-inline-start:-5px;border-start-start-radius:0;border-end-start-radius:0}.sd-calendar__chip--bar[data-join-end]{margin-inline-end:-5px;border-start-end-radius:0;border-end-end-radius:0}.sd-calendar__chip-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0}.sd-calendar__month-more{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__month-more:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__month-more{align-self:flex-start;padding:0 4px;color:var(--sd-primary, #005cbb);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__agenda{flex:1 1 auto;min-height:0;overflow:auto}.sd-calendar__agenda-day{display:grid;grid-template-columns:120px minmax(0,1fr);gap:4px 12px;padding-block:10px;padding-inline:16px 12px;border-bottom:1px solid var(--sd-calendar-line, #dedee5)}.sd-calendar__agenda-heading{display:flex;flex-direction:column;font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__agenda-heading[data-today]{color:var(--sd-primary, #005cbb)}.sd-calendar__agenda-today{font-size:var(--sd-font-size-12, 12px);font-weight:400}.sd-calendar__agenda-holiday{color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-12, 12px);font-weight:400}.sd-calendar__agenda-holiday[data-holiday=off]{color:var(--sd-error, #ba1a1a)}.sd-calendar__agenda-rows{display:flex;flex-direction:column;gap:2px;min-width:0}.sd-calendar__agenda-row{display:grid;grid-template-columns:92px minmax(0,1fr);align-items:center;min-height:32px;padding:2px 8px;border-radius:var(--sd-radius-8, 8px);cursor:pointer}.sd-calendar__agenda-row:has(.sd-calendar__agenda-place){grid-template-columns:92px minmax(0,1fr) minmax(0,.6fr)}.sd-calendar__agenda-row[data-selected]{background:var(--sd-primary-light, #dbe8f5)}.sd-calendar__agenda-row:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__agenda-row>.sd-calendar__agenda-title .sd-calendar__dot{width:8px;height:8px}@media(hover:hover){.sd-calendar__agenda-row:not([data-selected]):hover{background:color-mix(in srgb,var(--sd-text, #1a1b1f) 4%,transparent)}}.sd-calendar__agenda-time{color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-13, 13px)}.sd-calendar__agenda-title{display:flex;align-items:center;gap:8px;min-width:0;font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__agenda-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0}.sd-calendar__agenda-place{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-13, 13px)}.sd-calendar__empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;height:152px;color:var(--sd-text-secondary, #44474f)}.sd-calendar__empty-icon{color:var(--sd-border-strong, #74777f)}.sd-calendar__empty-text{margin:0;font-size:var(--sd-font-size-14, 14px)}.sd-calendar__columns--create .sd-calendar__column:not([data-out-of-range]){cursor:cell}.sd-calendar__columns--blocked,.sd-calendar__columns--blocked .sd-calendar__column:not([data-out-of-range]){cursor:not-allowed}.sd-calendar__icon-button sd-icon:dir(rtl),.sd-calendar__clip:dir(rtl),.sd-calendar__progress:dir(rtl){transform:scaleX(-1)}.sd-calendar__event[data-movable]{touch-action:none}.sd-calendar__event[data-pending],.sd-calendar__bar[data-pending]{inset-inline-start:2px;z-index:3;width:calc(100% - 2px - var(--sd-calendar-reserve));border:1px dashed var(--sd-calendar-event-color)}.sd-calendar__event[data-dragging]{border:1px dashed var(--sd-calendar-event-border);background:transparent;box-shadow:none;opacity:.55}.sd-calendar__event[data-failed],.sd-calendar__bar[data-failed]{outline:2px solid var(--sd-error, #ba1a1a);outline-offset:1px}.sd-calendar__sync{flex:none;color:var(--sd-calendar-event-color, var(--sd-primary, #005cbb));animation:sd-calendar-spin 1s linear infinite}@keyframes sd-calendar-spin{to{transform:rotate(360deg)}}.sd-calendar__resize{position:absolute;inset-inline-end:0;bottom:0;inset-inline-start:0;height:8px;cursor:ns-resize;touch-action:none}.sd-calendar__resize:after{position:absolute;bottom:3px;inset-inline-start:50%;width:16px;height:3px;margin-inline-start:-8px;border-radius:var(--sd-radius-2, 2px);background:var(--sd-calendar-event-color);content:\"\";opacity:0}@media(hover:hover){.sd-calendar__event:hover .sd-calendar__resize:after{opacity:1}}@media(pointer:coarse){.sd-calendar__event:not([data-selected]) .sd-calendar__resize{display:none}.sd-calendar__event[data-selected] .sd-calendar__resize{height:24px}.sd-calendar__event[data-selected] .sd-calendar__resize:after{width:24px;height:6px;margin-inline-start:-12px;opacity:1}}.sd-calendar__ghost,.sd-calendar__proposal{position:absolute;inset-inline-end:var(--sd-calendar-reserve);inset-inline-start:2px;z-index:4;display:flex;flex-direction:column;box-sizing:border-box;padding:2px 6px;overflow:hidden;border-radius:var(--sd-calendar-event-radius);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);pointer-events:none}.sd-calendar__ghost{border:1px dashed var(--sd-primary, #005cbb);background:color-mix(in srgb,var(--sd-primary-light, #dbe8f5) 92%,transparent)}.sd-calendar__ghost[data-blocked]{border-color:var(--sd-border-strong, #74777f)}.sd-calendar__proposal{flex-direction:row;align-items:flex-start;gap:4px;border:1px solid var(--sd-calendar-event-color);background:var(--sd-calendar-event-bg);box-shadow:var(--sd-shadow-lg)}.sd-calendar__proposal>.sd-calendar__dot{margin-top:5px}.sd-calendar__cursor{position:absolute;inset-inline-end:0;inset-inline-start:0;z-index:2;display:none;box-sizing:border-box;padding:0 4px;border:2px solid var(--sd-focus-ring-color, #005cbb);border-radius:var(--sd-radius-4, 4px);background:color-mix(in srgb,var(--sd-primary, #005cbb) 8%,transparent);font-size:var(--sd-font-size-11, 11px);pointer-events:none}.sd-calendar__columns:focus-visible .sd-calendar__cursor{display:block}.sd-calendar__columns:focus-visible{outline:none}.sd-calendar__chip{cursor:pointer}@media(prefers-reduced-motion:reduce){.sd-calendar__sync{animation:none}}.sd-calendar__scope{position:absolute;inset-inline-end:12px;bottom:12px;inset-inline-start:12px;z-index:10;padding:12px 14px;border-radius:var(--sd-radius-10, 10px);background:var(--sd-surface-inverse, #1a1b1f);box-shadow:var(--sd-shadow-lg);color:var(--sd-surface, #fdfbff);font-size:var(--sd-font-size-14, 14px)}.sd-calendar__scope-message{margin:0 0 10px}.sd-calendar__scope-actions{display:flex;flex-wrap:wrap;gap:8px}.sd-calendar__scope-button{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__scope-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__scope-button{height:36px;padding:0 10px;border-radius:var(--sd-radius-6, 6px);color:var(--sd-primary-light, #dbe8f5);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__scope-button--cancel{color:var(--sd-surface, #fdfbff)}@media(hover:hover){.sd-calendar__scope-button:hover{background:color-mix(in srgb,var(--sd-surface, #fdfbff) 12%,transparent)}}@media(pointer:coarse){.sd-calendar__today,.sd-calendar__band-button,.sd-calendar__scope-button{min-height:var(--sd-control-height-coarse, 44px)}.sd-calendar__icon-button{min-width:var(--sd-control-height-coarse, 44px);min-height:var(--sd-control-height-coarse, 44px)}.sd-calendar__view{min-height:calc(var(--sd-control-height-coarse, 44px) - 2px)}}.sd-calendar--compact{--sd-calendar-gutter-width: 48px;--sd-calendar-reserve: 16px}.sd-calendar--compact .sd-calendar__band-button,.sd-calendar--compact .sd-calendar__scope-button{min-height:var(--sd-control-height-coarse, 44px)}.sd-calendar--compact[data-display=day]{--sd-calendar-reserve: 16px}.sd-calendar--compact .sd-calendar__toolbar{flex-wrap:wrap;gap:8px;height:auto;padding:8px 12px}.sd-calendar--compact .sd-calendar__title{order:-2;flex:1 1 0}.sd-calendar--compact .sd-calendar__nav{order:-1}.sd-calendar--compact .sd-calendar__today,.sd-calendar--compact .sd-calendar__icon-button{height:var(--sd-control-height-coarse, 44px)}.sd-calendar--compact .sd-calendar__icon-button{width:var(--sd-control-height-coarse, 44px)}.sd-calendar--compact .sd-calendar__views{flex:1 0 100%}.sd-calendar--compact .sd-calendar__view{flex:1;height:42px}.sd-calendar--compact .sd-calendar__cell{align-items:center;min-height:56px}.sd-calendar--compact .sd-calendar__cell-number{width:32px;height:32px}.sd-calendar--compact .sd-calendar__agenda-day{grid-template-columns:minmax(0,1fr)}.sd-calendar--compact .sd-calendar__agenda-row{grid-template-columns:minmax(0,1fr);min-height:44px}.sd-calendar--compact .sd-calendar__agenda-row>.sd-calendar__agenda-time{order:1;font-size:var(--sd-font-size-12, 12px)}.sd-calendar__strip{display:grid;flex:none;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px;padding:4px 8px 6px;border-top:1px solid var(--sd-calendar-line, #dedee5);border-bottom:1px solid var(--sd-calendar-line, #dedee5);touch-action:pan-y}.sd-calendar__strip-day{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__strip-day:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__strip-day{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;height:56px;border-radius:var(--sd-radius-12, 12px)}.sd-calendar__strip-day[data-today]:not([aria-current]){border:1px solid var(--sd-primary, #005cbb);color:var(--sd-primary, #005cbb)}.sd-calendar__strip-day[aria-current=date]{background:var(--sd-primary, #005cbb);color:var(--sd-primary-contrast, #ffffff)}.sd-calendar__strip-weekday{font-size:var(--sd-font-size-11, 11px)}.sd-calendar__strip-number{font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__strip-dot{width:4px;height:4px;border-radius:var(--sd-radius-999, 999px);background:currentColor}.sd-calendar__strip-dot--empty{visibility:hidden}.sd-calendar__cell-dots{display:flex;gap:3px}.sd-calendar__cell-dot{width:6px;height:6px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-calendar-event-color)}.sd-calendar--compact .sd-calendar__columns{touch-action:pan-y}@media(prefers-reduced-motion:reduce){.sd-calendar__event,.sd-calendar__bar{transition:none}}@media(forced-colors:active){.sd-calendar__event,.sd-calendar__bar,.sd-calendar__chip--bar{border-color:CanvasText}.sd-calendar__event[data-selected],.sd-calendar__bar[data-selected]{border:2px solid Highlight;border-color:Highlight}.sd-calendar__event[data-pending],.sd-calendar__bar[data-pending],.sd-calendar__ghost{border-color:Highlight}.sd-calendar__now{background-color:Highlight}.sd-calendar{border-color:CanvasText}}@media print{.sd-calendar__nav,.sd-calendar__views,.sd-calendar__progress,.sd-calendar__band,.sd-calendar__strip,.sd-calendar__scope{display:none}.sd-calendar,.sd-calendar__scroller{height:auto;overflow:visible}.sd-calendar__head{position:static}.sd-calendar__body{height:calc(var(--sd-calendar-hour-height) * var(--sd-calendar-print-hours, 24));overflow:hidden}.sd-calendar__gutter,.sd-calendar__columns{margin-top:calc(var(--sd-calendar-hour-height) * var(--sd-calendar-print-start, 0) * -1)}.sd-calendar__event{border:1px solid var(--sd-calendar-event-color);background:transparent;break-inside:avoid}}\n"], dependencies: [{ kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SdDataState, selector: "sd-data-state", inputs: ["state", "title", "message", "icon", "fontSet", "iconShape", "retryable", "retryLabel", "actionLabel", "compact", "fullPage"], outputs: ["sdRetry", "sdAction"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2536
|
+
}
|
|
2537
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdCalendar, decorators: [{
|
|
2538
|
+
type: Component,
|
|
2539
|
+
args: [{ selector: 'sd-calendar', standalone: true, imports: [CdkDrag, NgTemplateOutlet, SdDataState, SdIcon, SdTranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let _view = displayView();\n@let _disabled = disabled();\n@let _selected = selectedId();\n@let _failure = failure();\n<section\n class=\"sd-calendar\"\n role=\"region\"\n [class.sd-calendar--compact]=\"compact()\"\n [attr.data-compact]=\"compact() || null\"\n [attr.aria-label]=\"regionLabel()\"\n [attr.data-autoid]=\"rootAutoId()\"\n [attr.data-view]=\"activeView()\"\n [attr.data-display]=\"_view\"\n [attr.data-from]=\"visible().from\"\n [attr.data-to]=\"visible().to\">\n <header class=\"sd-calendar__toolbar\">\n <div class=\"sd-calendar__nav\">\n <button type=\"button\" class=\"sd-calendar__today\" data-action=\"today\" [attr.data-autoid]=\"childAutoId('today')\" (click)=\"goToday()\">\n {{ 'core.component.calendar.today' | sdTranslate }}\n </button>\n <button\n type=\"button\"\n class=\"sd-calendar__icon-button\"\n data-action=\"prev\"\n [attr.aria-label]=\"prevLabel()\"\n [attr.data-autoid]=\"childAutoId('prev')\"\n [disabled]=\"prevDisabled()\"\n (click)=\"shift(-1)\">\n <sd-icon name=\"chevron_left\" size=\"22px\" aria-hidden=\"true\" />\n </button>\n <button\n type=\"button\"\n class=\"sd-calendar__icon-button\"\n data-action=\"next\"\n [attr.aria-label]=\"nextLabel()\"\n [attr.data-autoid]=\"childAutoId('next')\"\n [disabled]=\"nextDisabled()\"\n (click)=\"shift(1)\">\n <sd-icon name=\"chevron_right\" size=\"22px\" aria-hidden=\"true\" />\n </button>\n </div>\n <div class=\"sd-calendar__title\" data-title>{{ title() }}</div>\n <div class=\"sd-calendar__views\" role=\"group\" [attr.aria-label]=\"'core.component.calendar.views' | sdTranslate\">\n @for (option of viewOptions(); track option) {\n <button\n type=\"button\"\n class=\"sd-calendar__view\"\n [attr.data-view-option]=\"option\"\n [attr.data-autoid]=\"childAutoId('view-' + option)\"\n [attr.aria-pressed]=\"option === _view\"\n (click)=\"setView(option)\">\n {{ viewLabel(option) }}\n </button>\n }\n </div>\n </header>\n\n @if (busy()) {\n <div class=\"sd-calendar__progress\" role=\"progressbar\" [attr.aria-label]=\"'core.component.calendar.label' | sdTranslate\">\n <span class=\"sd-calendar__progress-bar\"></span>\n </div>\n }\n @if (phase() === 'error') {\n <div class=\"sd-calendar__band\" data-band=\"load-error\">\n <sd-icon class=\"sd-calendar__band-icon\" name=\"error\" size=\"18px\" aria-hidden=\"true\" />\n <span class=\"sd-calendar__band-text\">{{ 'core.component.calendar.load-error' | sdTranslate }}</span>\n <button type=\"button\" class=\"sd-calendar__band-button\" data-action=\"retry\" [attr.data-autoid]=\"childAutoId('retry')\" (click)=\"reload()\">\n {{ 'core.common.retry' | sdTranslate }}\n </button>\n </div>\n }\n @if (_failure) {\n <div class=\"sd-calendar__band\" data-band=\"move-error\">\n <sd-icon class=\"sd-calendar__band-icon\" name=\"error\" size=\"18px\" aria-hidden=\"true\" />\n <span class=\"sd-calendar__band-text\">{{ _failure.message }}</span>\n <button type=\"button\" class=\"sd-calendar__band-button\" data-action=\"dismiss\" [attr.data-autoid]=\"childAutoId('dismiss')\" (click)=\"dismissFailure()\">\n {{ 'core.common.dismiss' | sdTranslate }}\n </button>\n </div>\n }\n @if (strip().length) {\n <div class=\"sd-calendar__strip\" data-day-strip (pointerdown)=\"onStripPointerDown($event)\" (pointerup)=\"onStripPointerUp($event)\">\n @for (cell of strip(); track cell.day) {\n <button\n type=\"button\"\n class=\"sd-calendar__strip-day\"\n [attr.data-date]=\"cell.day\"\n [attr.data-today]=\"cell.today || null\"\n [attr.aria-current]=\"cell.current ? 'date' : null\"\n [attr.aria-label]=\"cell.label\"\n (click)=\"pickDay(cell.day)\">\n <span class=\"sd-calendar__strip-weekday\">{{ cell.weekdayShort }}</span>\n <span class=\"sd-calendar__strip-number\">{{ cell.dayNumber }}</span>\n @if (cell.events) {\n <span class=\"sd-calendar__strip-dot\" data-dot aria-hidden=\"true\"></span>\n } @else {\n <span class=\"sd-calendar__strip-dot sd-calendar__strip-dot--empty\" aria-hidden=\"true\"></span>\n }\n </button>\n }\n </div>\n }\n <div class=\"sd-calendar__status sd-visually-hidden\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</div>\n <span class=\"sd-visually-hidden\" [id]=\"gridInstructionsId\">{{ 'core.component.calendar.grid-instructions' | sdTranslate }}</span>\n <span class=\"sd-visually-hidden\" [id]=\"eventInstructionsId\">{{ 'core.component.calendar.event-instructions' | sdTranslate }}</span>\n @if (scopeBar.asking(); as _ask) {\n <div class=\"sd-calendar__scope\" role=\"alertdialog\" [attr.aria-labelledby]=\"scopeMessageId\" (keydown)=\"scopeBar.onKeydown($event)\">\n <p class=\"sd-calendar__scope-message\" [id]=\"scopeMessageId\">\n {{ 'core.component.calendar.scope-message' | sdTranslate: { title: _ask.title } }}\n </p>\n <div class=\"sd-calendar__scope-actions\">\n <button type=\"button\" class=\"sd-calendar__scope-button\" data-scope=\"this\" [attr.data-autoid]=\"childAutoId('scope-this')\" (click)=\"scopeBar.answer('this')\">\n {{ 'core.component.calendar.scope-this' | sdTranslate }}\n </button>\n <button\n type=\"button\"\n class=\"sd-calendar__scope-button\"\n data-scope=\"following\"\n [attr.data-autoid]=\"childAutoId('scope-following')\"\n (click)=\"scopeBar.answer('following')\">\n {{ 'core.component.calendar.scope-following' | sdTranslate }}\n </button>\n <button type=\"button\" class=\"sd-calendar__scope-button\" data-scope=\"all\" [attr.data-autoid]=\"childAutoId('scope-all')\" (click)=\"scopeBar.answer('all')\">\n {{ 'core.component.calendar.scope-all' | sdTranslate }}\n </button>\n <button\n type=\"button\"\n class=\"sd-calendar__scope-button sd-calendar__scope-button--cancel\"\n data-scope=\"cancel\"\n [attr.data-autoid]=\"childAutoId('scope-cancel')\"\n (click)=\"scopeBar.answer(null)\">\n {{ 'core.common.cancel' | sdTranslate }}\n </button>\n </div>\n </div>\n }\n\n @if (invalid()) {\n <sd-data-state class=\"sd-calendar__invalid\" state=\"error\" compact [title]=\"'core.component.calendar.invalid-data' | sdTranslate\" />\n } @else if (_view === 'week' || _view === 'day') {\n @let _days = dayViews();\n @let _allDay = allDay();\n @let _ghost = ghost();\n @let _proposal = dragProposal();\n @let _cursor = cursor();\n <div\n #scroller\n class=\"sd-calendar__scroller\"\n data-region=\"scroller\"\n [style.--sd-calendar-days]=\"_days.length\"\n [style.--sd-calendar-print-start]=\"printHours().start\"\n [style.--sd-calendar-print-hours]=\"printHours().hours\">\n <div class=\"sd-calendar__head\" data-head>\n @if (_view === 'week') {\n <div class=\"sd-calendar__day-headers\">\n <div class=\"sd-calendar__corner\" data-zone>{{ zoneLabel() }}</div>\n @for (day of _days; track day.day) {\n <div class=\"sd-calendar__day-header\" data-day-header [attr.data-date]=\"day.day\" [attr.data-today]=\"day.today || null\">\n <span class=\"sd-calendar__weekday\">{{ day.weekdayShort }}</span>\n <button type=\"button\" class=\"sd-calendar__day-number\" [attr.aria-label]=\"day.label\" (click)=\"openDay(day.day)\">\n {{ day.dayNumber }}\n </button>\n @if (day.holiday; as holiday) {\n <span class=\"sd-calendar__holiday\" [attr.data-holiday]=\"holiday.type\" [attr.title]=\"holiday.label\">{{ holiday.label }}</span>\n }\n </div>\n }\n </div>\n }\n <div class=\"sd-calendar__all-day\">\n <div class=\"sd-calendar__all-day-label\">\n @if (_view === 'day') {\n <span class=\"sd-calendar__zone\" data-zone>{{ zoneLabel() }}</span>\n }\n {{ 'core.component.calendar.all-day' | sdTranslate }}\n </div>\n <div class=\"sd-calendar__all-day-grid\">\n @for (bar of _allDay.bars; track bar.key) {\n <div\n class=\"sd-calendar__bar\"\n role=\"button\"\n [attr.tabindex]=\"_disabled ? -1 : 0\"\n [attr.aria-label]=\"bar.label\"\n [attr.aria-describedby]=\"eventInstructionsId\"\n [attr.data-event-id]=\"bar.event.id\"\n [attr.data-autoid]=\"bar.autoId\"\n [attr.data-start]=\"bar.range.start\"\n [attr.data-end]=\"bar.range.end\"\n [attr.data-all-day]=\"bar.placement.allDay\"\n [attr.data-color]=\"bar.color\"\n [attr.data-past]=\"bar.past || null\"\n [attr.data-pending]=\"bar.pending || null\"\n [attr.data-selected]=\"bar.key === _selected || null\"\n [attr.data-failed]=\"isFailed(bar.key) || null\"\n [attr.data-clipped-start]=\"bar.clippedStart || null\"\n [attr.data-clipped-end]=\"bar.clippedEnd || null\"\n [style.--sd-calendar-event-color]=\"bar.customColor\"\n [style.grid-column]=\"bar.from + 1 + ' / ' + (bar.to + 2)\"\n [style.grid-row]=\"bar.row + 1\"\n (click)=\"selectItem(bar.event, $event)\"\n (keydown)=\"onItemKeydown($event, bar)\">\n @if (bar.clippedStart) {\n <sd-icon class=\"sd-calendar__clip\" name=\"chevron_left\" size=\"16px\" aria-hidden=\"true\" />\n }\n <span class=\"sd-calendar__dot\" aria-hidden=\"true\"></span>\n @if (bar.recurring) {\n <sd-icon class=\"sd-calendar__repeat\" name=\"repeat\" size=\"13px\" aria-hidden=\"true\" />\n }\n <span class=\"sd-calendar__bar-title\">{{ bar.text }}</span>\n @if (bar.saving) {\n <sd-icon class=\"sd-calendar__sync\" name=\"sync\" size=\"14px\" aria-hidden=\"true\" />\n }\n @if (_view === 'day' && bar.spanText) {\n <span class=\"sd-calendar__bar-span\">{{ bar.spanText }}</span>\n }\n @if (bar.clippedEnd) {\n <sd-icon class=\"sd-calendar__clip\" name=\"chevron_right\" size=\"16px\" aria-hidden=\"true\" />\n }\n </div>\n }\n @for (count of _allDay.more; track $index) {\n @if (count) {\n <button\n type=\"button\"\n class=\"sd-calendar__more\"\n data-more\n [attr.data-date]=\"_days[$index].day\"\n [style.grid-column]=\"$index + 1\"\n [style.grid-row]=\"_allDay.rows + 1\"\n [attr.aria-label]=\"allDayMoreLabel(count, _days[$index])\"\n (click)=\"openDay(_days[$index].day)\">\n {{ 'core.component.calendar.more-short' | sdTranslate: { count } }}\n </button>\n }\n }\n </div>\n </div>\n </div>\n <div class=\"sd-calendar__body\">\n <div class=\"sd-calendar__gutter\" aria-hidden=\"true\">\n @for (hour of hours; track hour) {\n <span class=\"sd-calendar__hour\" [style.top]=\"'calc(var(--sd-calendar-hour-height) * ' + hour + ')'\">{{ hour < 10 ? '0' + hour : hour }}:00</span>\n }\n </div>\n <div\n #grid\n class=\"sd-calendar__columns\"\n data-region=\"time-grid\"\n role=\"group\"\n tabindex=\"0\"\n [class.sd-calendar__columns--create]=\"canCreate()\"\n [class.sd-calendar__columns--blocked]=\"!!ghost()?.blocked\"\n [attr.aria-label]=\"title()\"\n [attr.aria-describedby]=\"gridInstructionsId\"\n [attr.aria-activedescendant]=\"_cursor ? cursorId : null\"\n [attr.aria-busy]=\"busy() || null\"\n [attr.aria-disabled]=\"_disabled || null\"\n (focus)=\"onGridFocus()\"\n (keydown)=\"onGridKeydown($event)\"\n (pointerdown)=\"onGridPointerDown($event)\"\n (pointermove)=\"onGridPointerMove($event)\"\n (pointerup)=\"onGridPointerUp($event)\"\n (pointercancel)=\"onGridPointerCancel()\">\n @for (day of _days; track day.day; let column = $index) {\n <div\n class=\"sd-calendar__column\"\n data-day-column\n [attr.data-date]=\"day.day\"\n [attr.data-today]=\"day.today || null\"\n [attr.data-off]=\"day.off || null\"\n [attr.data-out-of-range]=\"day.outOfRange || null\">\n @for (segment of day.offSegments; track segment.start) {\n <div\n class=\"sd-calendar__off\"\n data-off-hours\n aria-hidden=\"true\"\n [style.top]=\"spanTop(segment.start)\"\n [style.height]=\"'calc(var(--sd-calendar-hour-height) * ' + (segment.end - segment.start) / 60 + ')'\"></div>\n }\n @if (skeleton()) {\n @for (shape of skeletonBlocks; track $index) {\n @if (shape[0] === column) {\n <div class=\"sd-calendar__skeleton\" data-skeleton aria-hidden=\"true\" [style.top]=\"spanTop(shape[1])\" [style.height]=\"spanHeight(shape[2])\"></div>\n }\n }\n }\n @if (_cursor && _cursor.day === day.day) {\n <div\n class=\"sd-calendar__cursor\"\n data-cursor\n [id]=\"cursorId\"\n [attr.aria-label]=\"cursorLabel()\"\n [style.top]=\"spanTop(_cursor.minutes)\"\n [style.height]=\"'calc(var(--sd-calendar-hour-height) * ' + stepValue() / 60 + ')'\">\n {{ clockText(_cursor.minutes) }}\n </div>\n }\n @for (block of blocksOf(day.day); track block.key) {\n <div\n class=\"sd-calendar__event\"\n role=\"button\"\n cdkDrag\n [cdkDragDisabled]=\"!block.movable\"\n [cdkDragStartDelay]=\"dragDelay\"\n [cdkDragConstrainPosition]=\"constrainDrag\"\n [attr.tabindex]=\"_disabled ? -1 : 0\"\n [attr.aria-label]=\"block.label\"\n [attr.aria-describedby]=\"eventInstructionsId\"\n [attr.data-event-id]=\"block.event.id\"\n [attr.data-autoid]=\"block.autoId\"\n [attr.data-start]=\"block.range.start\"\n [attr.data-end]=\"block.range.end\"\n [attr.data-all-day]=\"false\"\n [attr.data-color]=\"block.color\"\n [attr.data-size]=\"block.size\"\n [attr.data-past]=\"block.past || null\"\n [attr.data-pending]=\"block.pending || null\"\n [attr.data-selected]=\"block.key === _selected || null\"\n [attr.data-failed]=\"isFailed(block.key) || null\"\n [attr.data-dragging]=\"isDragging(block.key) || null\"\n [attr.data-movable]=\"block.movable || null\"\n [style.--sd-calendar-event-color]=\"block.customColor\"\n [style.--sd-calendar-column]=\"block.column\"\n [style.--sd-calendar-columns]=\"block.columns\"\n [style.top]=\"block.top\"\n [style.height]=\"blockHeight(block)\"\n (cdkDragStarted)=\"onDragStarted($event, block)\"\n (cdkDragMoved)=\"onDragMoved()\"\n (cdkDragEnded)=\"onDragEnded($event)\"\n (mousedown)=\"onPressItem($event)\"\n (touchstart)=\"onPressItem($event)\"\n (click)=\"selectItem(block.event, $event)\"\n (keydown)=\"onItemKeydown($event, block)\">\n <span class=\"sd-calendar__dot\" aria-hidden=\"true\"></span>\n @if (eventTemplate(); as _template) {\n <div class=\"sd-calendar__event-content\">\n <ng-container [ngTemplateOutlet]=\"_template.template\" [ngTemplateOutletContext]=\"block.context\" />\n </div>\n } @else {\n <div class=\"sd-calendar__event-content\">\n <span class=\"sd-calendar__event-title\">\n @if (block.recurring) {\n <sd-icon class=\"sd-calendar__repeat\" name=\"repeat\" size=\"13px\" aria-hidden=\"true\" />\n }\n {{ block.event.title }}@if (block.size === 'sm' || block.size === 'xs') {\n <span>, {{ block.timeText.slice(0, 5) }}</span>\n }\n </span>\n @if (block.size === 'lg' || block.size === 'md') {\n <span class=\"sd-calendar__event-time\">{{ blockTime(block) }}</span>\n }\n </div>\n }\n @if (block.saving) {\n <sd-icon class=\"sd-calendar__sync\" name=\"sync\" size=\"14px\" aria-hidden=\"true\" />\n }\n @if (block.movable) {\n <div\n class=\"sd-calendar__resize\"\n data-resize-handle\n aria-hidden=\"true\"\n (mousedown)=\"$event.stopPropagation()\"\n (touchstart)=\"$event.stopPropagation()\"\n (pointerdown)=\"onResizeDown($event, block)\"\n (pointermove)=\"onResizeMove($event)\"\n (pointerup)=\"onResizeUp($event)\"\n (pointercancel)=\"onResizeCancel()\"></div>\n }\n </div>\n }\n @if (_ghost && _ghost.day === day.day) {\n <div\n class=\"sd-calendar__ghost\"\n data-create-ghost\n aria-hidden=\"true\"\n [attr.data-pending]=\"_ghost.pending || null\"\n [attr.data-blocked]=\"_ghost.blocked || null\"\n [style.top]=\"spanTop(_ghost.start)\"\n [style.height]=\"spanHeight(_ghost.end - _ghost.start)\">\n <span class=\"sd-calendar__event-title\">{{ 'core.component.calendar.new-event' | sdTranslate }}</span>\n <span class=\"sd-calendar__event-time\">{{ clockText(_ghost.start) }} \u2013 {{ clockText(_ghost.end) }}</span>\n @if (_ghost.pending) {\n <sd-icon class=\"sd-calendar__sync\" name=\"sync\" size=\"14px\" aria-hidden=\"true\" />\n }\n </div>\n }\n @if (_proposal && !_proposal.outside && _proposal.day === day.day) {\n <div\n class=\"sd-calendar__proposal\"\n data-drag-proposal\n aria-hidden=\"true\"\n [attr.data-color]=\"_proposal.color\"\n [style.--sd-calendar-event-color]=\"_proposal.customColor\"\n [style.top]=\"spanTop(_proposal.start)\"\n [style.height]=\"spanHeight(_proposal.end - _proposal.start)\">\n <span class=\"sd-calendar__dot\" aria-hidden=\"true\"></span>\n <div class=\"sd-calendar__event-content\">\n <span class=\"sd-calendar__event-title\">{{ _proposal.title }}</span>\n <span class=\"sd-calendar__event-time\">{{ clockText(_proposal.start) }} \u2013 {{ clockText(_proposal.end) }}</span>\n </div>\n </div>\n }\n @if (day.today) {\n <div class=\"sd-calendar__now\" data-now aria-hidden=\"true\" [style.top]=\"nowTop()\"></div>\n }\n </div>\n }\n </div>\n </div>\n </div>\n } @else if (_view === 'month') {\n <div\n class=\"sd-calendar__month\"\n role=\"grid\"\n [style.--sd-calendar-month-columns]=\"monthHeaders().length\"\n [attr.aria-label]=\"title()\"\n [attr.aria-busy]=\"busy() || null\"\n [attr.aria-disabled]=\"_disabled || null\">\n <div class=\"sd-calendar__month-head\" role=\"row\">\n @for (weekday of monthHeaders(); track $index) {\n <div class=\"sd-calendar__month-weekday\" role=\"columnheader\">{{ weekday }}</div>\n }\n </div>\n @for (week of monthWeeks(); track $index) {\n <div class=\"sd-calendar__month-row\" role=\"row\">\n @for (cell of week; track cell.day.day) {\n <div\n class=\"sd-calendar__cell\"\n role=\"gridcell\"\n [attr.tabindex]=\"cell.day.day === monthFocusDay() ? 0 : -1\"\n [attr.aria-label]=\"cell.label\"\n [attr.data-date]=\"cell.day.day\"\n [attr.data-today]=\"cell.day.today || null\"\n [attr.data-off]=\"cell.day.off || null\"\n [attr.data-out-of-month]=\"!cell.inMonth || null\"\n [attr.data-out-of-range]=\"cell.day.outOfRange || null\"\n (click)=\"openDay(cell.day.day)\"\n (keydown)=\"onCellKeydown($event, cell.day.day)\">\n <div class=\"sd-calendar__cell-head\">\n <span class=\"sd-calendar__cell-number\">{{ cell.day.dayNumber }}</span>\n @if (!compact() && cell.day.holiday; as holiday) {\n <span class=\"sd-calendar__cell-holiday\" [attr.data-holiday]=\"holiday.type\" [attr.title]=\"holiday.label\">{{ holiday.label }}</span>\n }\n </div>\n @if (compact()) {\n <div class=\"sd-calendar__cell-dots\" aria-hidden=\"true\">\n @for (dot of cell.dots; track dot.color + (dot.customColor ?? '')) {\n <span class=\"sd-calendar__cell-dot\" data-dot [attr.data-color]=\"dot.color\" [style.--sd-calendar-event-color]=\"dot.customColor\"></span>\n }\n </div>\n } @else {\n @if (dayCellTemplate(); as _template) {\n <ng-container [ngTemplateOutlet]=\"_template.template\" [ngTemplateOutletContext]=\"cell.context\" />\n } @else {\n @for (line of cell.lines; track line.key) {\n @if (line.item; as item) {\n <!-- why: chips stay out of the tab order (\u00A79.7); the cell is the keyboard target and opens the day. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"sd-calendar__chip\"\n [class.sd-calendar__chip--bar]=\"line.bar\"\n [attr.data-event-id]=\"item.event.id\"\n [attr.data-autoid]=\"item.autoId\"\n [attr.data-color]=\"item.color\"\n [attr.data-past]=\"item.past || null\"\n [attr.data-selected]=\"item.key === _selected || null\"\n [attr.data-join-start]=\"line.joinStart || null\"\n [attr.data-join-end]=\"line.joinEnd || null\"\n [attr.title]=\"item.label\"\n [style.--sd-calendar-event-color]=\"item.customColor\"\n (click)=\"selectItem(item.event, $event)\">\n @if (line.showTitle) {\n <span class=\"sd-calendar__dot\" aria-hidden=\"true\"></span>\n <span class=\"sd-calendar__chip-text\">{{ line.text }}</span>\n }\n </div>\n } @else {\n <div class=\"sd-calendar__chip sd-calendar__chip--gap\" aria-hidden=\"true\"></div>\n }\n }\n @if (cell.more) {\n <button\n type=\"button\"\n class=\"sd-calendar__month-more\"\n data-more\n tabindex=\"-1\"\n [attr.data-date]=\"cell.day.day\"\n (click)=\"$event.stopPropagation(); openDay(cell.day.day)\">\n {{ 'core.component.calendar.more' | sdTranslate: { count: cell.more } }}\n </button>\n }\n }\n }\n </div>\n }\n </div>\n }\n </div>\n } @else {\n <div class=\"sd-calendar__agenda\" [attr.aria-busy]=\"busy() || null\">\n @for (group of agenda(); track group.day.day) {\n <div class=\"sd-calendar__agenda-day\" role=\"group\" data-agenda-day [attr.data-date]=\"group.day.day\" [attr.aria-label]=\"group.heading\">\n <div class=\"sd-calendar__agenda-heading\" [attr.data-today]=\"group.day.today || null\">\n <span>{{ group.heading }}</span>\n @if (group.day.today) {\n <span class=\"sd-calendar__agenda-today\">{{ 'core.component.calendar.today' | sdTranslate }}</span>\n }\n @if (group.day.holiday; as holiday) {\n <span class=\"sd-calendar__agenda-holiday\" [attr.data-holiday]=\"holiday.type\">{{ holiday.label }}</span>\n }\n </div>\n <div class=\"sd-calendar__agenda-rows\">\n @for (row of group.rows; track row.key) {\n <div\n class=\"sd-calendar__agenda-row\"\n role=\"button\"\n [attr.tabindex]=\"_disabled ? -1 : 0\"\n [attr.aria-label]=\"row.label\"\n [attr.data-event-id]=\"row.event.id\"\n [attr.data-autoid]=\"row.autoId\"\n [attr.data-color]=\"row.color\"\n [attr.data-past]=\"row.past || null\"\n [attr.data-pending]=\"row.pending || null\"\n [attr.data-selected]=\"row.key === _selected || null\"\n [style.--sd-calendar-event-color]=\"row.customColor\"\n (click)=\"selectItem(row.event, $event)\"\n (keydown)=\"onItemKeydown($event, row)\">\n <span class=\"sd-calendar__agenda-time\">{{ row.timeText }}</span>\n <span class=\"sd-calendar__agenda-title\">\n <span class=\"sd-calendar__dot\" aria-hidden=\"true\"></span>\n <span class=\"sd-calendar__agenda-text\">{{ row.event.title }}</span>\n @if (row.recurring) {\n <sd-icon class=\"sd-calendar__repeat\" name=\"repeat\" size=\"15px\" aria-hidden=\"true\" />\n }\n </span>\n @if (wide() && agendaItemTemplate(); as _template) {\n <span class=\"sd-calendar__agenda-place\" data-agenda-place>\n <ng-container [ngTemplateOutlet]=\"_template.template\" [ngTemplateOutletContext]=\"row.context\" />\n </span>\n }\n </div>\n }\n </div>\n </div>\n } @empty {\n @if (!busy()) {\n @if (emptyTemplate(); as _empty) {\n <ng-container [ngTemplateOutlet]=\"_empty.template\" [ngTemplateOutletContext]=\"{ $implicit: visible() }\" />\n } @else {\n <div class=\"sd-calendar__empty\">\n <sd-icon class=\"sd-calendar__empty-icon\" name=\"event_available\" size=\"28px\" aria-hidden=\"true\" />\n <p class=\"sd-calendar__empty-text\" data-empty>\n {{ 'core.component.calendar.empty-agenda' | sdTranslate: { count: agendaCount() } }}\n </p>\n </div>\n }\n }\n }\n </div>\n }\n</section>\n", styles: [":host{--sd-calendar-hour-height: 48px;--sd-calendar-gutter-width: 56px;--sd-calendar-event-radius: var(--sd-radius-6, 6px);display:block;min-width:0;text-align:start}.sd-calendar{--sd-calendar-reserve: 8px;position:relative;display:flex;flex-direction:column;box-sizing:border-box;height:100%;overflow:hidden;border:1px solid var(--sd-border, #c4c6d0);border-radius:var(--sd-radius-12, 12px);background:var(--sd-surface, #fdfbff);color:var(--sd-text, #1a1b1f);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.sd-calendar[data-display=day]{--sd-calendar-reserve: 24px}.sd-calendar__toolbar{display:flex;flex:none;align-items:center;gap:12px;height:56px;padding-block:0;padding-inline:14px 12px;border-bottom:1px solid var(--sd-calendar-line, #dedee5)}.sd-calendar__nav{display:flex;flex:none;align-items:center;gap:4px}.sd-calendar__today{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__today:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__today{height:var(--sd-control-height-sm, 32px);margin-inline-end:4px;padding:0 14px;border:1px solid var(--sd-border, #c4c6d0);border-radius:var(--sd-radius-8, 8px);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__icon-button{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__icon-button{display:inline-flex;align-items:center;justify-content:center;width:var(--sd-control-height-sm, 32px);height:var(--sd-control-height-sm, 32px);border-radius:var(--sd-radius-999, 999px);color:var(--sd-text-secondary, #44474f)}.sd-calendar__icon-button:disabled{cursor:default;opacity:.38}.sd-calendar__title{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;font-size:var(--sd-font-size-18, 18px);line-height:var(--sd-line-height-24, 24px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__views{display:flex;flex:none;overflow:hidden;border:1px solid var(--sd-border, #c4c6d0);border-radius:var(--sd-radius-8, 8px)}.sd-calendar__view{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__view:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__view{height:30px;padding:0 12px;font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__view+.sd-calendar__view{border-inline-start:1px solid var(--sd-border, #c4c6d0)}.sd-calendar__view[aria-pressed=true]{background:var(--sd-primary-light, #dbe8f5);color:var(--sd-text, #1a1b1f)}.sd-calendar__view:focus-visible{outline-offset:-2px}@media(hover:hover){.sd-calendar__today:hover,.sd-calendar__icon-button:not(:disabled):hover,.sd-calendar__view:not([aria-pressed=true]):hover{background:color-mix(in srgb,var(--sd-text, #1a1b1f) 6%,transparent)}}.sd-calendar__progress{position:relative;flex:none;height:2px;overflow:hidden;background:var(--sd-primary-light, #dbe8f5)}.sd-calendar__progress-bar{position:absolute;inset:0 auto 0 0;width:40%;background:var(--sd-primary, #005cbb);animation:sd-calendar-progress 1.2s ease-in-out infinite}@keyframes sd-calendar-progress{0%{transform:translate(-100%)}to{transform:translate(250%)}}.sd-calendar__band{display:flex;flex:none;align-items:center;gap:8px;padding:8px 10px;border-bottom:1px solid color-mix(in srgb,var(--sd-error, #ba1a1a) 28%,var(--sd-surface, #fdfbff));background:var(--sd-status-error-bg, #f5dfdf);color:var(--sd-status-error-fg, #9c1616);font-size:var(--sd-font-size-13, 13px)}.sd-calendar__band-icon{flex:none;color:var(--sd-error, #ba1a1a)}.sd-calendar__band-text{flex:1;min-width:0}.sd-calendar__band-button{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__band-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__band-button{flex:none;height:28px;padding:0 12px;border:1px solid var(--sd-error, #ba1a1a);border-radius:var(--sd-radius-8, 8px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__status{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.sd-calendar__invalid{flex:1;min-height:0}.sd-calendar__scroller{position:relative;flex:1 1 620px;min-height:0;overflow:auto;overflow-anchor:none}.sd-calendar__head{position:sticky;top:0;z-index:5;background:var(--sd-surface, #fdfbff)}.sd-calendar__day-headers{display:grid;grid-template-columns:var(--sd-calendar-gutter-width) repeat(var(--sd-calendar-days),minmax(0,1fr));height:72px}.sd-calendar__day-header{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-width:0;border-inline-start:1px solid var(--sd-calendar-line, #dedee5)}.sd-calendar__weekday{color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-14, 14px);font-weight:var(--sd-font-weight-medium, 500);letter-spacing:.04em}[data-today]>.sd-calendar__weekday{color:var(--sd-calendar-today, #005cbb)}.sd-calendar__day-number{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__day-number:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__day-number{width:32px;height:32px;border-radius:var(--sd-radius-999, 999px);font-size:var(--sd-font-size-18, 18px);font-weight:var(--sd-font-weight-medium, 500)}[data-today]>.sd-calendar__day-number{background:var(--sd-calendar-today, #005cbb);color:var(--sd-primary-contrast, #ffffff)}.sd-calendar__holiday{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:100%;padding:0 4px;box-sizing:border-box;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-14, 14px)}.sd-calendar__holiday[data-holiday=off]{color:var(--sd-error, #ba1a1a)}.sd-calendar__corner,.sd-calendar__zone{display:block;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-14, 14px);text-align:end}.sd-calendar__corner{align-self:end;padding-block:0 6px;padding-inline:0 8px}.sd-calendar__all-day{display:grid;grid-template-columns:var(--sd-calendar-gutter-width) minmax(0,1fr);min-height:30px;border-top:1px solid var(--sd-calendar-line, #dedee5);border-bottom:1px solid var(--sd-border, #c4c6d0)}.sd-calendar__all-day-label{padding-block:8px 0;padding-inline:0 8px;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-14, 14px);text-align:end}.sd-calendar__all-day-grid{display:grid;-webkit-user-select:none;user-select:none;grid-template-columns:repeat(var(--sd-calendar-days),minmax(0,1fr));grid-auto-rows:22px;gap:2px 0;padding:4px 0}.sd-calendar__bar{display:flex;align-items:center;gap:4px;min-width:0;margin:0 2px;padding:0 6px;border:1px solid var(--sd-calendar-event-border);border-radius:var(--sd-radius-4, 4px);background:var(--sd-calendar-event-bg);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);font-weight:600;cursor:pointer}.sd-calendar__bar[data-clipped-start]{border-start-start-radius:0;border-end-start-radius:0}.sd-calendar__bar[data-clipped-end]{border-start-end-radius:0;border-end-end-radius:0}.sd-calendar__bar-title{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0}.sd-calendar__bar-span{flex:none;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);font-weight:400}.sd-calendar__clip{flex:none;color:var(--sd-text-secondary, #44474f)}.sd-calendar__more{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__more:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__more{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:0 6px;color:var(--sd-primary, #005cbb);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-medium, 500);text-align:start}.sd-calendar__body{display:grid;grid-template-columns:var(--sd-calendar-gutter-width) minmax(0,1fr)}.sd-calendar__gutter{position:relative;height:calc(var(--sd-calendar-hour-height) * 24)}.sd-calendar__hour{position:absolute;inset-inline-end:8px;margin-top:-7px;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-14, 14px)}.sd-calendar__columns{position:relative;display:grid;-webkit-user-select:none;user-select:none;grid-template-columns:repeat(var(--sd-calendar-days),minmax(0,1fr));height:calc(var(--sd-calendar-hour-height) * 24)}.sd-calendar__columns:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px);outline-offset:-2px}.sd-calendar__column{position:relative;min-width:0;border-inline-start:1px solid var(--sd-calendar-line, #dedee5);background-image:linear-gradient(to bottom,transparent calc(100% - 1px),var(--sd-calendar-line, #dedee5) calc(100% - 1px)),linear-gradient(to bottom,transparent calc(50% - 1px),var(--sd-calendar-line-half, #efeef3) calc(50% - 1px),var(--sd-calendar-line-half, #efeef3) 50%,transparent 50%);background-size:100% var(--sd-calendar-hour-height)}.sd-calendar__column[data-off],.sd-calendar__column[data-out-of-range]{background-color:var(--sd-calendar-off-hours, #f3f3f7)}.sd-calendar__column[data-out-of-range]{cursor:not-allowed}.sd-calendar__off{position:absolute;inset-inline-end:0;inset-inline-start:0;background:var(--sd-calendar-off-hours, #f3f3f7);pointer-events:none}.sd-calendar__now{position:absolute;inset-inline-end:0;inset-inline-start:0;z-index:4;height:2px;background:var(--sd-calendar-now, #ba1a1a);pointer-events:none}.sd-calendar__now:before{position:absolute;top:-4px;inset-inline-start:-5px;width:10px;height:10px;border-radius:var(--sd-radius-999, 999px);background:inherit;content:\"\"}.sd-calendar__skeleton{position:absolute;inset-inline-end:var(--sd-calendar-reserve);inset-inline-start:2px;border-radius:var(--sd-radius-6, 6px);background:var(--sd-surface-muted, #e7e8ed)}.sd-calendar__event,.sd-calendar__bar,.sd-calendar__chip,.sd-calendar__agenda-row,.sd-calendar__cell-dot,.sd-calendar__proposal{--sd-calendar-event-bg: color-mix(in srgb, var(--sd-calendar-event-color) 14%, var(--sd-surface, #fdfbff));--sd-calendar-event-border: color-mix(in srgb, var(--sd-calendar-event-color) 28%, var(--sd-surface, #fdfbff));--sd-calendar-event-dot: var(--sd-calendar-event-color)}.sd-calendar__event[data-color=primary],.sd-calendar__bar[data-color=primary],.sd-calendar__chip[data-color=primary],.sd-calendar__agenda-row[data-color=primary],.sd-calendar__cell-dot[data-color=primary],.sd-calendar__proposal[data-color=primary]{--sd-calendar-event-color: var(--sd-primary, #005cbb);--sd-calendar-event-bg: var(--sd-primary-light, #dbe8f5)}.sd-calendar__event[data-color=secondary],.sd-calendar__bar[data-color=secondary],.sd-calendar__chip[data-color=secondary],.sd-calendar__agenda-row[data-color=secondary],.sd-calendar__cell-dot[data-color=secondary],.sd-calendar__proposal[data-color=secondary]{--sd-calendar-event-color: var(--sd-secondary, #5c6270);--sd-calendar-event-bg: var(--sd-secondary-light, #ebecee)}.sd-calendar__event[data-color=info],.sd-calendar__bar[data-color=info],.sd-calendar__chip[data-color=info],.sd-calendar__agenda-row[data-color=info],.sd-calendar__cell-dot[data-color=info],.sd-calendar__proposal[data-color=info]{--sd-calendar-event-color: var(--sd-info, #006a6a);--sd-calendar-event-bg: var(--sd-info-light, #dbeaea)}.sd-calendar__event[data-color=success],.sd-calendar__bar[data-color=success],.sd-calendar__chip[data-color=success],.sd-calendar__agenda-row[data-color=success],.sd-calendar__cell-dot[data-color=success],.sd-calendar__proposal[data-color=success]{--sd-calendar-event-color: var(--sd-success, #2e7d32);--sd-calendar-event-bg: var(--sd-success-light, #e2ede2)}.sd-calendar__event[data-color=warning],.sd-calendar__bar[data-color=warning],.sd-calendar__chip[data-color=warning],.sd-calendar__agenda-row[data-color=warning],.sd-calendar__cell-dot[data-color=warning],.sd-calendar__proposal[data-color=warning]{--sd-calendar-event-color: var(--sd-warning, #a66300);--sd-calendar-event-bg: var(--sd-warning-light, #f3e9db)}.sd-calendar__event[data-color=error],.sd-calendar__bar[data-color=error],.sd-calendar__chip[data-color=error],.sd-calendar__agenda-row[data-color=error],.sd-calendar__cell-dot[data-color=error],.sd-calendar__proposal[data-color=error]{--sd-calendar-event-color: var(--sd-error, #ba1a1a);--sd-calendar-event-bg: var(--sd-error-light, #f5dfdf)}.sd-calendar__event[data-past],.sd-calendar__bar[data-past],.sd-calendar__chip[data-past],.sd-calendar__agenda-row[data-past],.sd-calendar__cell-dot[data-past],.sd-calendar__proposal[data-past]{--sd-calendar-event-dot: color-mix(in srgb, var(--sd-calendar-event-color) 45%, var(--sd-surface, #fdfbff))}.sd-calendar__event[data-past],.sd-calendar__bar[data-past],.sd-calendar__chip--bar[data-past]{border-color:color-mix(in srgb,var(--sd-calendar-event-border) 50%,var(--sd-surface, #fdfbff));background:color-mix(in srgb,var(--sd-calendar-event-bg) 45%,var(--sd-surface, #fdfbff))}.sd-calendar__dot{flex:none;width:6px;height:6px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-calendar-event-dot)}.sd-calendar__repeat{flex:none;vertical-align:-2px;color:var(--sd-text-secondary, #44474f)}.sd-calendar__event{position:absolute;inset-inline-start:calc(2px + (100% - 2px - var(--sd-calendar-reserve)) * var(--sd-calendar-column) / var(--sd-calendar-columns));z-index:1;display:flex;align-items:flex-start;gap:4px;box-sizing:border-box;width:calc((100% - 2px - var(--sd-calendar-reserve)) / var(--sd-calendar-columns));padding:2px 6px;overflow:hidden;border:1px solid var(--sd-calendar-event-border);border-radius:var(--sd-calendar-event-radius);background:var(--sd-calendar-event-bg);color:var(--sd-text, #1a1b1f);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);cursor:pointer;transition:box-shadow .15s,background-color .15s}.sd-calendar__event>.sd-calendar__dot{margin-top:5px}.sd-calendar__event[data-size=sm],.sd-calendar__event[data-size=xs]{align-items:center;padding:0 6px}.sd-calendar__event[data-size=sm]>.sd-calendar__dot,.sd-calendar__event[data-size=xs]>.sd-calendar__dot{margin-top:0}.sd-calendar__event[data-size=xs]{font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-14, 14px)}.sd-calendar__event[data-selected],.sd-calendar__bar[data-selected]{z-index:2;border-color:var(--sd-calendar-event-color);box-shadow:var(--sd-shadow-md)}.sd-calendar__event:focus-visible,.sd-calendar__bar:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}@media(hover:hover){.sd-calendar__event:hover,.sd-calendar__bar:hover{background:color-mix(in srgb,var(--sd-calendar-event-color) 7%,var(--sd-calendar-event-bg));box-shadow:var(--sd-shadow-sm)}}.sd-calendar__event-content{display:flex;flex:1;flex-direction:column;min-width:0}.sd-calendar__event-title{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:600}.sd-calendar__event-time{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--sd-text-secondary, #44474f)}.sd-calendar__month{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;overflow:auto}.sd-calendar__month-head,.sd-calendar__month-row{display:grid;grid-template-columns:repeat(var(--sd-calendar-month-columns, 7),minmax(0,1fr))}.sd-calendar__month-weekday{padding:8px 8px 6px;border-bottom:1px solid var(--sd-calendar-line, #dedee5);color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__month-row{flex:1 0 auto}.sd-calendar__cell{display:flex;flex-direction:column;gap:2px;min-width:0;min-height:104px;box-sizing:border-box;padding:4px;border-bottom:1px solid var(--sd-calendar-line, #dedee5);border-inline-start:1px solid var(--sd-calendar-line, #dedee5);cursor:pointer}.sd-calendar__cell[data-off]{background:var(--sd-calendar-off-hours, #f3f3f7)}.sd-calendar__cell[data-out-of-range]{background:var(--sd-calendar-off-hours, #f3f3f7);cursor:not-allowed}.sd-calendar__cell:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px);outline-offset:-2px}.sd-calendar__cell-head{display:flex;align-items:center;gap:4px;min-width:0}.sd-calendar__cell-number{display:inline-flex;flex:none;align-items:center;justify-content:center;width:26px;height:26px;border-radius:var(--sd-radius-999, 999px);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500)}[data-out-of-month] .sd-calendar__cell-number{color:var(--sd-border-strong, #74777f)}[data-today] .sd-calendar__cell-number{background:var(--sd-calendar-today, #005cbb);color:var(--sd-primary-contrast, #ffffff)}.sd-calendar__cell-holiday{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-11, 11px)}.sd-calendar__cell-holiday[data-holiday=off]{color:var(--sd-error, #ba1a1a)}.sd-calendar__chip{display:flex;align-items:center;gap:4px;min-width:0;height:20px;padding:0 4px;border-radius:var(--sd-radius-4, 4px);font-size:var(--sd-font-size-12, 12px);line-height:20px}.sd-calendar__chip--bar{background:var(--sd-calendar-event-bg)}.sd-calendar__chip--bar[data-join-start]{margin-inline-start:-5px;border-start-start-radius:0;border-end-start-radius:0}.sd-calendar__chip--bar[data-join-end]{margin-inline-end:-5px;border-start-end-radius:0;border-end-end-radius:0}.sd-calendar__chip-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0}.sd-calendar__month-more{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__month-more:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__month-more{align-self:flex-start;padding:0 4px;color:var(--sd-primary, #005cbb);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__agenda{flex:1 1 auto;min-height:0;overflow:auto}.sd-calendar__agenda-day{display:grid;grid-template-columns:120px minmax(0,1fr);gap:4px 12px;padding-block:10px;padding-inline:16px 12px;border-bottom:1px solid var(--sd-calendar-line, #dedee5)}.sd-calendar__agenda-heading{display:flex;flex-direction:column;font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__agenda-heading[data-today]{color:var(--sd-primary, #005cbb)}.sd-calendar__agenda-today{font-size:var(--sd-font-size-12, 12px);font-weight:400}.sd-calendar__agenda-holiday{color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-12, 12px);font-weight:400}.sd-calendar__agenda-holiday[data-holiday=off]{color:var(--sd-error, #ba1a1a)}.sd-calendar__agenda-rows{display:flex;flex-direction:column;gap:2px;min-width:0}.sd-calendar__agenda-row{display:grid;grid-template-columns:92px minmax(0,1fr);align-items:center;min-height:32px;padding:2px 8px;border-radius:var(--sd-radius-8, 8px);cursor:pointer}.sd-calendar__agenda-row:has(.sd-calendar__agenda-place){grid-template-columns:92px minmax(0,1fr) minmax(0,.6fr)}.sd-calendar__agenda-row[data-selected]{background:var(--sd-primary-light, #dbe8f5)}.sd-calendar__agenda-row:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__agenda-row>.sd-calendar__agenda-title .sd-calendar__dot{width:8px;height:8px}@media(hover:hover){.sd-calendar__agenda-row:not([data-selected]):hover{background:color-mix(in srgb,var(--sd-text, #1a1b1f) 4%,transparent)}}.sd-calendar__agenda-time{color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-13, 13px)}.sd-calendar__agenda-title{display:flex;align-items:center;gap:8px;min-width:0;font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__agenda-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0}.sd-calendar__agenda-place{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-13, 13px)}.sd-calendar__empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;height:152px;color:var(--sd-text-secondary, #44474f)}.sd-calendar__empty-icon{color:var(--sd-border-strong, #74777f)}.sd-calendar__empty-text{margin:0;font-size:var(--sd-font-size-14, 14px)}.sd-calendar__columns--create .sd-calendar__column:not([data-out-of-range]){cursor:cell}.sd-calendar__columns--blocked,.sd-calendar__columns--blocked .sd-calendar__column:not([data-out-of-range]){cursor:not-allowed}.sd-calendar__icon-button sd-icon:dir(rtl),.sd-calendar__clip:dir(rtl),.sd-calendar__progress:dir(rtl){transform:scaleX(-1)}.sd-calendar__event[data-movable]{touch-action:none}.sd-calendar__event[data-pending],.sd-calendar__bar[data-pending]{inset-inline-start:2px;z-index:3;width:calc(100% - 2px - var(--sd-calendar-reserve));border:1px dashed var(--sd-calendar-event-color)}.sd-calendar__event[data-dragging]{border:1px dashed var(--sd-calendar-event-border);background:transparent;box-shadow:none;opacity:.55}.sd-calendar__event[data-failed],.sd-calendar__bar[data-failed]{outline:2px solid var(--sd-error, #ba1a1a);outline-offset:1px}.sd-calendar__sync{flex:none;color:var(--sd-calendar-event-color, var(--sd-primary, #005cbb));animation:sd-calendar-spin 1s linear infinite}@keyframes sd-calendar-spin{to{transform:rotate(360deg)}}.sd-calendar__resize{position:absolute;inset-inline-end:0;bottom:0;inset-inline-start:0;height:8px;cursor:ns-resize;touch-action:none}.sd-calendar__resize:after{position:absolute;bottom:3px;inset-inline-start:50%;width:16px;height:3px;margin-inline-start:-8px;border-radius:var(--sd-radius-2, 2px);background:var(--sd-calendar-event-color);content:\"\";opacity:0}@media(hover:hover){.sd-calendar__event:hover .sd-calendar__resize:after{opacity:1}}@media(pointer:coarse){.sd-calendar__event:not([data-selected]) .sd-calendar__resize{display:none}.sd-calendar__event[data-selected] .sd-calendar__resize{height:24px}.sd-calendar__event[data-selected] .sd-calendar__resize:after{width:24px;height:6px;margin-inline-start:-12px;opacity:1}}.sd-calendar__ghost,.sd-calendar__proposal{position:absolute;inset-inline-end:var(--sd-calendar-reserve);inset-inline-start:2px;z-index:4;display:flex;flex-direction:column;box-sizing:border-box;padding:2px 6px;overflow:hidden;border-radius:var(--sd-calendar-event-radius);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);pointer-events:none}.sd-calendar__ghost{border:1px dashed var(--sd-primary, #005cbb);background:color-mix(in srgb,var(--sd-primary-light, #dbe8f5) 92%,transparent)}.sd-calendar__ghost[data-blocked]{border-color:var(--sd-border-strong, #74777f)}.sd-calendar__proposal{flex-direction:row;align-items:flex-start;gap:4px;border:1px solid var(--sd-calendar-event-color);background:var(--sd-calendar-event-bg);box-shadow:var(--sd-shadow-lg)}.sd-calendar__proposal>.sd-calendar__dot{margin-top:5px}.sd-calendar__cursor{position:absolute;inset-inline-end:0;inset-inline-start:0;z-index:2;display:none;box-sizing:border-box;padding:0 4px;border:2px solid var(--sd-focus-ring-color, #005cbb);border-radius:var(--sd-radius-4, 4px);background:color-mix(in srgb,var(--sd-primary, #005cbb) 8%,transparent);font-size:var(--sd-font-size-11, 11px);pointer-events:none}.sd-calendar__columns:focus-visible .sd-calendar__cursor{display:block}.sd-calendar__columns:focus-visible{outline:none}.sd-calendar__chip{cursor:pointer}@media(prefers-reduced-motion:reduce){.sd-calendar__sync{animation:none}}.sd-calendar__scope{position:absolute;inset-inline-end:12px;bottom:12px;inset-inline-start:12px;z-index:10;padding:12px 14px;border-radius:var(--sd-radius-10, 10px);background:var(--sd-surface-inverse, #1a1b1f);box-shadow:var(--sd-shadow-lg);color:var(--sd-surface, #fdfbff);font-size:var(--sd-font-size-14, 14px)}.sd-calendar__scope-message{margin:0 0 10px}.sd-calendar__scope-actions{display:flex;flex-wrap:wrap;gap:8px}.sd-calendar__scope-button{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__scope-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__scope-button{height:36px;padding:0 10px;border-radius:var(--sd-radius-6, 6px);color:var(--sd-primary-light, #dbe8f5);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__scope-button--cancel{color:var(--sd-surface, #fdfbff)}@media(hover:hover){.sd-calendar__scope-button:hover{background:color-mix(in srgb,var(--sd-surface, #fdfbff) 12%,transparent)}}@media(pointer:coarse){.sd-calendar__today,.sd-calendar__band-button,.sd-calendar__scope-button{min-height:var(--sd-control-height-coarse, 44px)}.sd-calendar__icon-button{min-width:var(--sd-control-height-coarse, 44px);min-height:var(--sd-control-height-coarse, 44px)}.sd-calendar__view{min-height:calc(var(--sd-control-height-coarse, 44px) - 2px)}}.sd-calendar--compact{--sd-calendar-gutter-width: 48px;--sd-calendar-reserve: 16px}.sd-calendar--compact .sd-calendar__band-button,.sd-calendar--compact .sd-calendar__scope-button{min-height:var(--sd-control-height-coarse, 44px)}.sd-calendar--compact[data-display=day]{--sd-calendar-reserve: 16px}.sd-calendar--compact .sd-calendar__toolbar{flex-wrap:wrap;gap:8px;height:auto;padding:8px 12px}.sd-calendar--compact .sd-calendar__title{order:-2;flex:1 1 0}.sd-calendar--compact .sd-calendar__nav{order:-1}.sd-calendar--compact .sd-calendar__today,.sd-calendar--compact .sd-calendar__icon-button{height:var(--sd-control-height-coarse, 44px)}.sd-calendar--compact .sd-calendar__icon-button{width:var(--sd-control-height-coarse, 44px)}.sd-calendar--compact .sd-calendar__views{flex:1 0 100%}.sd-calendar--compact .sd-calendar__view{flex:1;height:42px}.sd-calendar--compact .sd-calendar__cell{align-items:center;min-height:56px}.sd-calendar--compact .sd-calendar__cell-number{width:32px;height:32px}.sd-calendar--compact .sd-calendar__agenda-day{grid-template-columns:minmax(0,1fr)}.sd-calendar--compact .sd-calendar__agenda-row{grid-template-columns:minmax(0,1fr);min-height:44px}.sd-calendar--compact .sd-calendar__agenda-row>.sd-calendar__agenda-time{order:1;font-size:var(--sd-font-size-12, 12px)}.sd-calendar__strip{display:grid;flex:none;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px;padding:4px 8px 6px;border-top:1px solid var(--sd-calendar-line, #dedee5);border-bottom:1px solid var(--sd-calendar-line, #dedee5);touch-action:pan-y}.sd-calendar__strip-day{margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sd-calendar__strip-day:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, #005cbb);outline-offset:var(--sd-focus-ring-offset, 2px)}.sd-calendar__strip-day{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;height:56px;border-radius:var(--sd-radius-12, 12px)}.sd-calendar__strip-day[data-today]:not([aria-current]){border:1px solid var(--sd-primary, #005cbb);color:var(--sd-primary, #005cbb)}.sd-calendar__strip-day[aria-current=date]{background:var(--sd-primary, #005cbb);color:var(--sd-primary-contrast, #ffffff)}.sd-calendar__strip-weekday{font-size:var(--sd-font-size-11, 11px)}.sd-calendar__strip-number{font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-medium, 500)}.sd-calendar__strip-dot{width:4px;height:4px;border-radius:var(--sd-radius-999, 999px);background:currentColor}.sd-calendar__strip-dot--empty{visibility:hidden}.sd-calendar__cell-dots{display:flex;gap:3px}.sd-calendar__cell-dot{width:6px;height:6px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-calendar-event-color)}.sd-calendar--compact .sd-calendar__columns{touch-action:pan-y}@media(prefers-reduced-motion:reduce){.sd-calendar__event,.sd-calendar__bar{transition:none}}@media(forced-colors:active){.sd-calendar__event,.sd-calendar__bar,.sd-calendar__chip--bar{border-color:CanvasText}.sd-calendar__event[data-selected],.sd-calendar__bar[data-selected]{border:2px solid Highlight;border-color:Highlight}.sd-calendar__event[data-pending],.sd-calendar__bar[data-pending],.sd-calendar__ghost{border-color:Highlight}.sd-calendar__now{background-color:Highlight}.sd-calendar{border-color:CanvasText}}@media print{.sd-calendar__nav,.sd-calendar__views,.sd-calendar__progress,.sd-calendar__band,.sd-calendar__strip,.sd-calendar__scope{display:none}.sd-calendar,.sd-calendar__scroller{height:auto;overflow:visible}.sd-calendar__head{position:static}.sd-calendar__body{height:calc(var(--sd-calendar-hour-height) * var(--sd-calendar-print-hours, 24));overflow:hidden}.sd-calendar__gutter,.sd-calendar__columns{margin-top:calc(var(--sd-calendar-hour-height) * var(--sd-calendar-print-start, 0) * -1)}.sd-calendar__event{border:1px solid var(--sd-calendar-event-color);background:transparent;break-inside:avoid}}\n"] }]
|
|
2540
|
+
}], ctorParameters: () => [], propDecorators: { option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: true }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }, { type: i0.Output, args: ["viewChange"] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }, { type: i0.Output, args: ["dateChange"] }], selectedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedId", required: false }] }, { type: i0.Output, args: ["selectedIdChange"] }], views: [{ type: i0.Input, args: [{ isSignal: true, alias: "views", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], hideWeekends: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideWeekends", required: false }] }], workingHours: [{ type: i0.Input, args: [{ isSignal: true, alias: "workingHours", required: false }] }], holidays: [{ type: i0.Input, args: [{ isSignal: true, alias: "holidays", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], scrollTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollTime", required: false }] }], agendaDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "agendaDays", required: false }] }], dimPast: [{ type: i0.Input, args: [{ isSignal: true, alias: "dimPast", required: false }] }], transform: [{ type: i0.Input, args: [{ isSignal: true, alias: "transform", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], sdSelect: [{ type: i0.Output, args: ["sdSelect"] }], sdRangeChange: [{ type: i0.Output, args: ["sdRangeChange"] }], sdMove: [{ type: i0.Output, args: ["sdMove"] }], sdMoveError: [{ type: i0.Output, args: ["sdMoveError"] }], sdLoadError: [{ type: i0.Output, args: ["sdLoadError"] }], eventTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdCalendarEventTemplateDirective), { isSignal: true }] }], dayCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdCalendarDayCellTemplateDirective), { isSignal: true }] }], agendaItemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdCalendarAgendaItemTemplateDirective), { isSignal: true }] }], emptyTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdCalendarEmptyTemplateDirective), { isSignal: true }] }], scroller: [{ type: i0.ViewChild, args: ['scroller', { isSignal: true }] }], gridElement: [{ type: i0.ViewChild, args: ['grid', { isSignal: true }] }] } });
|
|
2541
|
+
/**
|
|
2542
|
+
* Keeps `data-autoid` on the first segment of an event only: a multi-day event repeats in month cells and agenda days,
|
|
2543
|
+
* and an E2E selector must stay unique (R1-G5).
|
|
2544
|
+
*/
|
|
2545
|
+
function firstSegment(item, seen) {
|
|
2546
|
+
if (!item.autoId)
|
|
2547
|
+
return item;
|
|
2548
|
+
if (seen.has(item.key))
|
|
2549
|
+
return { ...item, autoId: null };
|
|
2550
|
+
seen.add(item.key);
|
|
2551
|
+
return item;
|
|
2552
|
+
}
|
|
2553
|
+
function offsetTop(minutes) {
|
|
2554
|
+
return `calc(var(--sd-calendar-hour-height) * ${minutes / 60})`;
|
|
2555
|
+
}
|
|
2556
|
+
function blockHeight(minutes) {
|
|
2557
|
+
return `max(calc(var(--sd-calendar-hour-height) * ${minutes / 60} - 2px), 16px)`;
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
/**
|
|
2561
|
+
* Generated bundle index. Do not edit.
|
|
2562
|
+
*/
|
|
2563
|
+
|
|
2564
|
+
export { SD_CALENDAR_CONFIGURATION, SdCalendar, SdCalendarAgendaItemTemplateDirective, SdCalendarDayCellTemplateDirective, SdCalendarEmptyTemplateDirective, SdCalendarEventTemplateDirective, ɵSD_CALENDAR_DEFAULTS, SD_CALENDAR_STEPS as ɵSD_CALENDAR_STEPS, SdCalendarAnnouncer as ɵSdCalendarAnnouncer, SdCalendarCreateRunner as ɵSdCalendarCreateRunner, SdCalendarEdgeScroller as ɵSdCalendarEdgeScroller, SdCalendarFocusKeeper as ɵSdCalendarFocusKeeper, SdCalendarHostWidth as ɵSdCalendarHostWidth, SdCalendarLoader as ɵSdCalendarLoader, SdCalendarMinuteTimer as ɵSdCalendarMinuteTimer, SdCalendarMoveRunner as ɵSdCalendarMoveRunner, SdCalendarOperation as ɵSdCalendarOperation, SdCalendarReporter as ɵSdCalendarReporter, SdCalendarScopeBar as ɵSdCalendarScopeBar, sdCalendarAddDays as ɵsdCalendarAddDays, sdCalendarAddMonths as ɵsdCalendarAddMonths, sdCalendarAddMonthsKeepDay as ɵsdCalendarAddMonthsKeepDay, sdCalendarAllDayLayout as ɵsdCalendarAllDayLayout, sdCalendarAllows as ɵsdCalendarAllows, sdCalendarBoundDay as ɵsdCalendarBoundDay, sdCalendarBrokenWeekdays as ɵsdCalendarBrokenWeekdays, sdCalendarCallMove as ɵsdCalendarCallMove, sdCalendarCarrierDay as ɵsdCalendarCarrierDay, sdCalendarClampAgendaDays as ɵsdCalendarClampAgendaDays, sdCalendarClockText as ɵsdCalendarClockText, sdCalendarColor as ɵsdCalendarColor, sdCalendarCssEscape as ɵsdCalendarCssEscape, sdCalendarDateText as ɵsdCalendarDateText, sdCalendarDay as ɵsdCalendarDay, sdCalendarDayDiff as ɵsdCalendarDayDiff, sdCalendarDayParts as ɵsdCalendarDayParts, sdCalendarDaysBetween as ɵsdCalendarDaysBetween, sdCalendarEdgeSpeed as ɵsdCalendarEdgeSpeed, sdCalendarFormats as ɵsdCalendarFormats, sdCalendarHolidayMap as ɵsdCalendarHolidayMap, sdCalendarInitialScroll as ɵsdCalendarInitialScroll, sdCalendarInvalidItems as ɵsdCalendarInvalidItems, sdCalendarIsOffDay as ɵsdCalendarIsOffDay, sdCalendarIsRtl as ɵsdCalendarIsRtl, sdCalendarIsWeekend as ɵsdCalendarIsWeekend, sdCalendarLastDayOf as ɵsdCalendarLastDayOf, sdCalendarMonthWeeks as ɵsdCalendarMonthWeeks, sdCalendarMoveStep as ɵsdCalendarMoveStep, sdCalendarMoveTarget as ɵsdCalendarMoveTarget, sdCalendarMovedText as ɵsdCalendarMovedText, sdCalendarNormalizeStep as ɵsdCalendarNormalizeStep, sdCalendarOffSegments as ɵsdCalendarOffSegments, sdCalendarOutOfRange as ɵsdCalendarOutOfRange, sdCalendarPlace as ɵsdCalendarPlace, sdCalendarPointOf as ɵsdCalendarPointOf, sdCalendarRangeKey as ɵsdCalendarRangeKey, sdCalendarRangeOf as ɵsdCalendarRangeOf, sdCalendarReadDay as ɵsdCalendarReadDay, sdCalendarReadWallClock as ɵsdCalendarReadWallClock, sdCalendarResizeEnd as ɵsdCalendarResizeEnd, sdCalendarResolveFirstDayOfWeek as ɵsdCalendarResolveFirstDayOfWeek, sdCalendarResolveStep as ɵsdCalendarResolveStep, sdCalendarResolveWorkingHours as ɵsdCalendarResolveWorkingHours, sdCalendarSameList as ɵsdCalendarSameList, sdCalendarSelectionGone as ɵsdCalendarSelectionGone, sdCalendarSerialize as ɵsdCalendarSerialize, sdCalendarShiftDate as ɵsdCalendarShiftDate, sdCalendarShiftDays as ɵsdCalendarShiftDays, sdCalendarSlot as ɵsdCalendarSlot, sdCalendarSnapMove as ɵsdCalendarSnapMove, sdCalendarStack as ɵsdCalendarStack, sdCalendarStartOfWeek as ɵsdCalendarStartOfWeek, sdCalendarSweep as ɵsdCalendarSweep, sdCalendarTargetOf as ɵsdCalendarTargetOf, sdCalendarTimeToMinutes as ɵsdCalendarTimeToMinutes, sdCalendarTitle as ɵsdCalendarTitle, sdCalendarUtcDay as ɵsdCalendarUtcDay, sdCalendarVisibleDays as ɵsdCalendarVisibleDays, sdCalendarVisibleRange as ɵsdCalendarVisibleRange, sdCalendarWeekday as ɵsdCalendarWeekday, sdCalendarWeekdayLong as ɵsdCalendarWeekdayLong, sdCalendarWorkingRanges as ɵsdCalendarWorkingRanges };
|
|
2565
|
+
//# sourceMappingURL=sdcorejs-angular-components-calendar.mjs.map
|