@maggioli-design-system/magma 1.11.7 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/magma-components.cjs.js +1 -1
- package/dist/cjs/mds-accordion-item.cjs.entry.js +1 -1
- package/dist/cjs/mds-accordion-timer-item.cjs.entry.js +1 -1
- package/dist/cjs/mds-accordion-timer.cjs.entry.js +1 -1
- package/dist/cjs/mds-accordion.cjs.entry.js +1 -1
- package/dist/cjs/mds-author.cjs.entry.js +2 -2
- package/dist/cjs/mds-avatar-stack-item.cjs.entry.js +1 -1
- package/dist/cjs/mds-avatar-stack.cjs.entry.js +1 -1
- package/dist/cjs/mds-avatar.cjs.entry.js +1 -1
- package/dist/cjs/mds-badge.cjs.entry.js +1 -1
- package/dist/cjs/mds-banner_3.cjs.entry.js +6 -6
- package/dist/cjs/mds-benchmark-bar.cjs.entry.js +1 -1
- package/dist/cjs/mds-bibliography.cjs.entry.js +7 -7
- package/dist/cjs/mds-breadcrumb-item.cjs.entry.js +1 -1
- package/dist/cjs/mds-breadcrumb.cjs.entry.js +2 -2
- package/dist/cjs/mds-button-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/mds-button-group.cjs.entry.js +1 -1
- package/dist/cjs/mds-button_3.cjs.entry.js +2 -2
- package/dist/cjs/mds-calendar_2.cjs.entry.js +246 -128
- package/dist/cjs/mds-card-content.cjs.entry.js +1 -1
- package/dist/cjs/mds-card-footer.cjs.entry.js +1 -1
- package/dist/cjs/mds-card-header.cjs.entry.js +1 -1
- package/dist/cjs/mds-card-media.cjs.entry.js +1 -1
- package/dist/cjs/mds-card.cjs.entry.js +1 -1
- package/dist/cjs/mds-details.cjs.entry.js +1 -1
- package/dist/cjs/mds-dropdown.cjs.entry.js +2 -2
- package/dist/cjs/mds-emoji.cjs.entry.js +1 -1
- package/dist/cjs/mds-entity.cjs.entry.js +4 -4
- package/dist/cjs/mds-file-preview.cjs.entry.js +2 -2
- package/dist/cjs/mds-file.cjs.entry.js +3 -3
- package/dist/cjs/mds-filter-item.cjs.entry.js +1 -1
- package/dist/cjs/mds-filter.cjs.entry.js +1 -1
- package/dist/cjs/mds-header-bar.cjs.entry.js +3 -3
- package/dist/cjs/mds-header.cjs.entry.js +2 -2
- package/dist/cjs/mds-horizontal-scroll.cjs.entry.js +1 -1
- package/dist/cjs/mds-hr.cjs.entry.js +1 -1
- package/dist/cjs/mds-input-date-range.cjs.entry.js +197 -55
- package/dist/cjs/mds-input-date.cjs.entry.js +16 -10
- package/dist/cjs/mds-input.cjs.entry.js +9 -9
- package/dist/collection/components/mds-accordion/mds-accordion.js +1 -1
- package/dist/collection/components/mds-accordion-item/mds-accordion-item.js +1 -1
- package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.js +1 -1
- package/dist/collection/components/mds-accordion-timer-item/mds-accordion-timer-item.js +1 -1
- package/dist/collection/components/mds-author/mds-author.js +2 -2
- package/dist/collection/components/mds-avatar/mds-avatar.js +1 -1
- package/dist/collection/components/mds-avatar-stack/mds-avatar-stack.js +1 -1
- package/dist/collection/components/mds-avatar-stack-item/mds-avatar-stack-item.js +1 -1
- package/dist/collection/components/mds-badge/mds-badge.js +1 -1
- package/dist/collection/components/mds-banner/mds-banner.js +2 -2
- package/dist/collection/components/mds-benchmark-bar/mds-benchmark-bar.js +1 -1
- package/dist/collection/components/mds-bibliography/mds-bibliography.js +7 -7
- package/dist/collection/components/mds-breadcrumb/mds-breadcrumb.js +2 -2
- package/dist/collection/components/mds-breadcrumb-item/mds-breadcrumb-item.js +1 -1
- package/dist/collection/components/mds-button/mds-button.js +1 -1
- package/dist/collection/components/mds-button-dropdown/mds-button-dropdown.js +1 -1
- package/dist/collection/components/mds-button-group/mds-button-group.js +1 -1
- package/dist/collection/components/mds-calendar/mds-calendar.css +50 -7
- package/dist/collection/components/mds-calendar/mds-calendar.js +413 -128
- package/dist/collection/components/mds-calendar-cell/mds-calendar-cell.js +1 -1
- package/dist/collection/components/mds-card/mds-card.js +1 -1
- package/dist/collection/components/mds-card-content/mds-card-content.js +1 -1
- package/dist/collection/components/mds-card-footer/mds-card-footer.js +1 -1
- package/dist/collection/components/mds-card-header/mds-card-header.js +1 -1
- package/dist/collection/components/mds-card-media/mds-card-media.js +1 -1
- package/dist/collection/components/mds-chip/mds-chip.js +3 -3
- package/dist/collection/components/mds-details/mds-details.js +1 -1
- package/dist/collection/components/mds-dropdown/mds-dropdown.js +2 -2
- package/dist/collection/components/mds-emoji/mds-emoji.js +1 -1
- package/dist/collection/components/mds-entity/mds-entity.js +4 -4
- package/dist/collection/components/mds-file/mds-file.js +3 -3
- package/dist/collection/components/mds-file-preview/mds-file-preview.js +2 -2
- package/dist/collection/components/mds-filter/mds-filter.js +1 -1
- package/dist/collection/components/mds-filter-item/mds-filter-item.js +1 -1
- package/dist/collection/components/mds-header/mds-header.js +2 -2
- package/dist/collection/components/mds-header-bar/mds-header-bar.js +3 -3
- package/dist/collection/components/mds-help/mds-help.js +1 -1
- package/dist/collection/components/mds-horizontal-scroll/mds-horizontal-scroll.js +1 -1
- package/dist/collection/components/mds-hr/mds-hr.js +1 -1
- package/dist/collection/components/mds-icon/mds-icon.js +1 -1
- package/dist/collection/components/mds-input/mds-input.js +9 -9
- package/dist/collection/components/mds-input-date/mds-input-date.js +19 -11
- package/dist/collection/components/mds-input-date-range/mds-input-date-range.css +33 -1
- package/dist/collection/components/mds-input-date-range/mds-input-date-range.js +220 -70
- package/dist/collection/components/mds-input-date-range/test/mds-input-date-range.stories.js +10 -0
- package/dist/collection/components/mds-keyboard-key/mds-keyboard-key.js +1 -1
- package/dist/components/mds-accordion-item.js +1 -1
- package/dist/components/mds-accordion-timer-item.js +1 -1
- package/dist/components/mds-accordion-timer.js +1 -1
- package/dist/components/mds-accordion.js +1 -1
- package/dist/components/mds-author.js +2 -2
- package/dist/components/mds-avatar-stack-item2.js +1 -1
- package/dist/components/mds-avatar-stack.js +1 -1
- package/dist/components/mds-avatar2.js +1 -1
- package/dist/components/mds-badge2.js +1 -1
- package/dist/components/mds-banner2.js +2 -2
- package/dist/components/mds-benchmark-bar.js +1 -1
- package/dist/components/mds-bibliography.js +7 -7
- package/dist/components/mds-breadcrumb-item.js +1 -1
- package/dist/components/mds-breadcrumb.js +2 -2
- package/dist/components/mds-button-dropdown.js +1 -1
- package/dist/components/mds-button-group.js +1 -1
- package/dist/components/mds-button2.js +1 -1
- package/dist/components/mds-calendar-cell2.js +1 -1
- package/dist/components/mds-calendar2.js +256 -128
- package/dist/components/mds-card-content.js +1 -1
- package/dist/components/mds-card-footer.js +1 -1
- package/dist/components/mds-card-header.js +1 -1
- package/dist/components/mds-card-media.js +1 -1
- package/dist/components/mds-card.js +1 -1
- package/dist/components/mds-chip2.js +3 -3
- package/dist/components/mds-details.js +1 -1
- package/dist/components/mds-dropdown2.js +2 -2
- package/dist/components/mds-emoji.js +1 -1
- package/dist/components/mds-entity.js +4 -4
- package/dist/components/mds-file-preview2.js +2 -2
- package/dist/components/mds-file.js +3 -3
- package/dist/components/mds-filter-item2.js +1 -1
- package/dist/components/mds-filter.js +1 -1
- package/dist/components/mds-header-bar.js +3 -3
- package/dist/components/mds-header.js +2 -2
- package/dist/components/mds-help2.js +1 -1
- package/dist/components/mds-horizontal-scroll.js +1 -1
- package/dist/components/mds-hr.js +1 -1
- package/dist/components/mds-icon2.js +1 -1
- package/dist/components/mds-input-date-range.js +199 -55
- package/dist/components/mds-input-date.js +17 -10
- package/dist/components/mds-input2.js +9 -9
- package/dist/documentation.json +238 -32
- package/dist/esm/loader.js +1 -1
- package/dist/esm/magma-components.js +1 -1
- package/dist/esm/mds-accordion-item.entry.js +1 -1
- package/dist/esm/mds-accordion-timer-item.entry.js +1 -1
- package/dist/esm/mds-accordion-timer.entry.js +1 -1
- package/dist/esm/mds-accordion.entry.js +1 -1
- package/dist/esm/mds-author.entry.js +2 -2
- package/dist/esm/mds-avatar-stack-item.entry.js +1 -1
- package/dist/esm/mds-avatar-stack.entry.js +1 -1
- package/dist/esm/mds-avatar.entry.js +1 -1
- package/dist/esm/mds-badge.entry.js +1 -1
- package/dist/esm/mds-banner_3.entry.js +6 -6
- package/dist/esm/mds-benchmark-bar.entry.js +1 -1
- package/dist/esm/mds-bibliography.entry.js +7 -7
- package/dist/esm/mds-breadcrumb-item.entry.js +1 -1
- package/dist/esm/mds-breadcrumb.entry.js +2 -2
- package/dist/esm/mds-button-dropdown.entry.js +1 -1
- package/dist/esm/mds-button-group.entry.js +1 -1
- package/dist/esm/mds-button_3.entry.js +2 -2
- package/dist/esm/mds-calendar_2.entry.js +246 -128
- package/dist/esm/mds-card-content.entry.js +1 -1
- package/dist/esm/mds-card-footer.entry.js +1 -1
- package/dist/esm/mds-card-header.entry.js +1 -1
- package/dist/esm/mds-card-media.entry.js +1 -1
- package/dist/esm/mds-card.entry.js +1 -1
- package/dist/esm/mds-details.entry.js +1 -1
- package/dist/esm/mds-dropdown.entry.js +2 -2
- package/dist/esm/mds-emoji.entry.js +1 -1
- package/dist/esm/mds-entity.entry.js +4 -4
- package/dist/esm/mds-file-preview.entry.js +2 -2
- package/dist/esm/mds-file.entry.js +3 -3
- package/dist/esm/mds-filter-item.entry.js +1 -1
- package/dist/esm/mds-filter.entry.js +1 -1
- package/dist/esm/mds-header-bar.entry.js +3 -3
- package/dist/esm/mds-header.entry.js +2 -2
- package/dist/esm/mds-horizontal-scroll.entry.js +1 -1
- package/dist/esm/mds-hr.entry.js +1 -1
- package/dist/esm/mds-input-date-range.entry.js +197 -55
- package/dist/esm/mds-input-date.entry.js +16 -10
- package/dist/esm/mds-input.entry.js +9 -9
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/magma-components.js +1 -1
- package/dist/esm-es5/mds-accordion-item.entry.js +1 -1
- package/dist/esm-es5/mds-accordion-timer-item.entry.js +1 -1
- package/dist/esm-es5/mds-accordion-timer.entry.js +1 -1
- package/dist/esm-es5/mds-accordion.entry.js +1 -1
- package/dist/esm-es5/mds-author.entry.js +1 -1
- package/dist/esm-es5/mds-avatar-stack-item.entry.js +1 -1
- package/dist/esm-es5/mds-avatar-stack.entry.js +1 -1
- package/dist/esm-es5/mds-avatar.entry.js +1 -1
- package/dist/esm-es5/mds-badge.entry.js +1 -1
- package/dist/esm-es5/mds-banner_3.entry.js +1 -1
- package/dist/esm-es5/mds-benchmark-bar.entry.js +1 -1
- package/dist/esm-es5/mds-bibliography.entry.js +1 -1
- package/dist/esm-es5/mds-breadcrumb-item.entry.js +1 -1
- package/dist/esm-es5/mds-breadcrumb.entry.js +1 -1
- package/dist/esm-es5/mds-button-dropdown.entry.js +1 -1
- package/dist/esm-es5/mds-button-group.entry.js +1 -1
- package/dist/esm-es5/mds-button_3.entry.js +1 -1
- package/dist/esm-es5/mds-calendar_2.entry.js +1 -1
- package/dist/esm-es5/mds-card-content.entry.js +1 -1
- package/dist/esm-es5/mds-card-footer.entry.js +1 -1
- package/dist/esm-es5/mds-card-header.entry.js +1 -1
- package/dist/esm-es5/mds-card-media.entry.js +1 -1
- package/dist/esm-es5/mds-card.entry.js +1 -1
- package/dist/esm-es5/mds-details.entry.js +1 -1
- package/dist/esm-es5/mds-dropdown.entry.js +1 -1
- package/dist/esm-es5/mds-emoji.entry.js +2 -2
- package/dist/esm-es5/mds-entity.entry.js +1 -1
- package/dist/esm-es5/mds-file-preview.entry.js +1 -1
- package/dist/esm-es5/mds-file.entry.js +1 -1
- package/dist/esm-es5/mds-filter-item.entry.js +1 -1
- package/dist/esm-es5/mds-filter.entry.js +1 -1
- package/dist/esm-es5/mds-header-bar.entry.js +1 -1
- package/dist/esm-es5/mds-header.entry.js +1 -1
- package/dist/esm-es5/mds-horizontal-scroll.entry.js +1 -1
- package/dist/esm-es5/mds-hr.entry.js +1 -1
- package/dist/esm-es5/mds-input-date-range.entry.js +1 -1
- package/dist/esm-es5/mds-input-date.entry.js +1 -1
- package/dist/esm-es5/mds-input.entry.js +1 -1
- package/dist/hydrate/index.js +539 -262
- package/dist/hydrate/index.mjs +539 -262
- package/dist/magma-components/magma-components.esm.js +1 -1
- package/dist/magma-components/{p-e3b0adb8.entry.js → p-02c9dffb.entry.js} +1 -1
- package/dist/magma-components/{p-e8626e7a.system.entry.js → p-03b5bdae.system.entry.js} +1 -1
- package/dist/magma-components/{p-fec5168f.entry.js → p-09b27f6e.entry.js} +1 -1
- package/dist/magma-components/p-09cbad84.system.entry.js +1 -0
- package/dist/magma-components/{p-0c3b813d.entry.js → p-0a9db9fc.entry.js} +1 -1
- package/dist/magma-components/{p-beeaec1c.entry.js → p-10957e40.entry.js} +1 -1
- package/dist/magma-components/{p-42f5037a.entry.js → p-14cad758.entry.js} +1 -1
- package/dist/magma-components/{p-35d85970.entry.js → p-188c906e.entry.js} +1 -1
- package/dist/magma-components/{p-91e16169.system.entry.js → p-191e79c8.system.entry.js} +1 -1
- package/dist/magma-components/{p-1a8d42d1.system.entry.js → p-1c37f4ce.system.entry.js} +1 -1
- package/dist/magma-components/{p-30648e76.system.entry.js → p-1cd6c3fe.system.entry.js} +1 -1
- package/dist/magma-components/{p-c3ae9ba7.system.entry.js → p-1f52a479.system.entry.js} +1 -1
- package/dist/magma-components/p-20e0f9e3.entry.js +1 -0
- package/dist/magma-components/p-26cd6ec8.system.js +1 -1
- package/dist/magma-components/{p-237d60e2.system.entry.js → p-2910fa0c.system.entry.js} +1 -1
- package/dist/magma-components/{p-d95c9d2e.system.entry.js → p-2d947462.system.entry.js} +1 -1
- package/dist/magma-components/{p-0b25be9f.entry.js → p-342a07c7.entry.js} +1 -1
- package/dist/magma-components/{p-b228a186.system.entry.js → p-39d9f24d.system.entry.js} +1 -1
- package/dist/magma-components/{p-27cb23f6.entry.js → p-3a57f53d.entry.js} +1 -1
- package/dist/magma-components/{p-0689710c.system.entry.js → p-3b267a52.system.entry.js} +1 -1
- package/dist/magma-components/{p-224f80f4.entry.js → p-3bf7d52c.entry.js} +1 -1
- package/dist/magma-components/{p-2de8157b.system.entry.js → p-432be440.system.entry.js} +1 -1
- package/dist/magma-components/{p-5eca660e.system.entry.js → p-43a2f192.system.entry.js} +1 -1
- package/dist/magma-components/{p-eaf4805a.entry.js → p-48a2e8e4.entry.js} +1 -1
- package/dist/magma-components/{p-ff674ef9.entry.js → p-4ab9c985.entry.js} +1 -1
- package/dist/magma-components/{p-40eeffe8.entry.js → p-4b76248b.entry.js} +1 -1
- package/dist/magma-components/{p-11df77b3.entry.js → p-4cf97724.entry.js} +1 -1
- package/dist/magma-components/{p-0e2b6dd3.system.entry.js → p-5359bf5e.system.entry.js} +1 -1
- package/dist/magma-components/{p-536b4c16.entry.js → p-5619ed51.entry.js} +1 -1
- package/dist/magma-components/{p-d738a403.system.entry.js → p-5edd2f30.system.entry.js} +1 -1
- package/dist/magma-components/{p-033e85f1.entry.js → p-606cd4bb.entry.js} +1 -1
- package/dist/magma-components/{p-e9ade624.system.entry.js → p-61c35e05.system.entry.js} +1 -1
- package/dist/magma-components/{p-6e680417.system.entry.js → p-68a7d370.system.entry.js} +1 -1
- package/dist/magma-components/{p-409c9518.system.entry.js → p-7244ca7a.system.entry.js} +1 -1
- package/dist/magma-components/{p-a9d6984e.entry.js → p-726cd93c.entry.js} +1 -1
- package/dist/magma-components/{p-c2798c9a.system.entry.js → p-7359e097.system.entry.js} +1 -1
- package/dist/magma-components/{p-723fbfb0.entry.js → p-78088de2.entry.js} +1 -1
- package/dist/magma-components/{p-83b2ee17.entry.js → p-7ae676db.entry.js} +1 -1
- package/dist/magma-components/{p-6d3ea2b6.entry.js → p-7b788f04.entry.js} +1 -1
- package/dist/magma-components/{p-b727c3a6.system.entry.js → p-80518658.system.entry.js} +1 -1
- package/dist/magma-components/{p-f6ef6105.entry.js → p-8314f381.entry.js} +1 -1
- package/dist/magma-components/{p-86f45462.entry.js → p-8469b603.entry.js} +1 -1
- package/dist/magma-components/{p-09aaa62b.system.entry.js → p-855f1617.system.entry.js} +1 -1
- package/dist/magma-components/{p-cae0e727.entry.js → p-89757b16.entry.js} +1 -1
- package/dist/magma-components/{p-60342fa8.system.entry.js → p-8bc52935.system.entry.js} +1 -1
- package/dist/magma-components/{p-6b4bf0df.entry.js → p-8f091ceb.entry.js} +1 -1
- package/dist/magma-components/{p-8859d528.entry.js → p-94fb14aa.entry.js} +1 -1
- package/dist/magma-components/{p-755dff75.system.entry.js → p-9b7e1f4b.system.entry.js} +1 -1
- package/dist/magma-components/{p-dfdc83ab.entry.js → p-9d5ab31c.entry.js} +1 -1
- package/dist/magma-components/{p-ddd59ddb.system.entry.js → p-9d86dd4c.system.entry.js} +1 -1
- package/dist/magma-components/{p-9e08e8f1.system.entry.js → p-a776c78c.system.entry.js} +1 -1
- package/dist/magma-components/{p-854848ca.entry.js → p-aacb6b47.entry.js} +1 -1
- package/dist/magma-components/{p-bdc49c99.entry.js → p-b4bad440.entry.js} +1 -1
- package/dist/magma-components/{p-3095eab8.system.entry.js → p-b7aae63a.system.entry.js} +1 -1
- package/dist/magma-components/{p-03cadeb4.system.entry.js → p-b7b0f420.system.entry.js} +1 -1
- package/dist/magma-components/{p-788e95ce.entry.js → p-ba8142cf.entry.js} +1 -1
- package/dist/magma-components/{p-84cf6604.system.entry.js → p-be5a7e23.system.entry.js} +1 -1
- package/dist/magma-components/{p-61e3603c.system.entry.js → p-c3304189.system.entry.js} +1 -1
- package/dist/magma-components/{p-a201cbab.entry.js → p-c372fe03.entry.js} +1 -1
- package/dist/magma-components/{p-b4baf323.entry.js → p-c5730248.entry.js} +1 -1
- package/dist/magma-components/{p-3e50c4ab.entry.js → p-c5d2cd00.entry.js} +1 -1
- package/dist/magma-components/p-c6785782.entry.js +1 -0
- package/dist/magma-components/p-ca4ee5b5.system.entry.js +1 -0
- package/dist/magma-components/p-d7cf7569.entry.js +1 -0
- package/dist/magma-components/{p-6d1ce884.system.entry.js → p-d98a34dc.system.entry.js} +1 -1
- package/dist/magma-components/{p-2b3517af.system.entry.js → p-d99f38a7.system.entry.js} +1 -1
- package/dist/magma-components/{p-3c2df04e.system.entry.js → p-dd7b9422.system.entry.js} +1 -1
- package/dist/magma-components/{p-58b77d4f.entry.js → p-e0bd7509.entry.js} +1 -1
- package/dist/magma-components/{p-a786264e.system.entry.js → p-e32a0ec8.system.entry.js} +1 -1
- package/dist/magma-components/{p-12527b99.system.entry.js → p-ef488f9f.system.entry.js} +1 -1
- package/dist/magma-components/{p-70223843.system.entry.js → p-f250731c.system.entry.js} +1 -1
- package/dist/magma-components/{p-8de607ef.entry.js → p-f2e7d2f0.entry.js} +1 -1
- package/dist/magma-components/{p-a9c9e071.system.entry.js → p-f349e728.system.entry.js} +1 -1
- package/dist/magma-components/{p-1c2b1a44.system.entry.js → p-f584c1d7.system.entry.js} +1 -1
- package/dist/magma-components/{p-f5f97018.entry.js → p-fd25f69a.entry.js} +1 -1
- package/dist/magma-components/{p-977d3bf0.entry.js → p-fe3879f3.entry.js} +1 -1
- package/dist/magma-components/{p-50b07c72.system.entry.js → p-ff8d8818.system.entry.js} +1 -1
- package/dist/stats.json +790 -377
- package/dist/types/components/mds-calendar/mds-calendar.d.ts +43 -1
- package/dist/types/components/mds-input-date/mds-input-date.d.ts +1 -0
- package/dist/types/components/mds-input-date-range/mds-input-date-range.d.ts +23 -4
- package/dist/types/components/mds-input-date-range/test/mds-input-date-range.stories.d.ts +12 -0
- package/dist/types/components.d.ts +94 -6
- package/package.json +4 -4
- package/dist/magma-components/p-3da97c74.system.entry.js +0 -1
- package/dist/magma-components/p-643fd688.entry.js +0 -1
- package/dist/magma-components/p-80b11d2e.entry.js +0 -1
- package/dist/magma-components/p-e1f3cc6d.entry.js +0 -1
- package/dist/magma-components/p-ead9e4c4.system.entry.js +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* global HTMLMdsCalendarElement, HTMLMdsCalendarCellElement, NodeListOf */
|
|
2
|
+
import { Host, h, } from "@stencil/core";
|
|
2
3
|
import miBaselineForwardIos from "@icon/mi/baseline/arrow-forward-ios.svg";
|
|
3
4
|
import miBaselineBackIosNew from "@icon/mi/baseline/arrow-back-ios-new.svg";
|
|
4
5
|
import { DateTime } from "luxon";
|
|
@@ -23,6 +24,34 @@ export class MdsCalendar {
|
|
|
23
24
|
el: {},
|
|
24
25
|
});
|
|
25
26
|
this.rangePicker = true;
|
|
27
|
+
/**
|
|
28
|
+
* Shows the previous navigation button in the calendar header.
|
|
29
|
+
*/
|
|
30
|
+
this.showPreviousButton = true;
|
|
31
|
+
/**
|
|
32
|
+
* Shows the next navigation button in the calendar header.
|
|
33
|
+
*/
|
|
34
|
+
this.showNextButton = true;
|
|
35
|
+
/**
|
|
36
|
+
* Disables switching to month or year selection views from the calendar header.
|
|
37
|
+
*/
|
|
38
|
+
this.disableMonthYearSelection = false;
|
|
39
|
+
/**
|
|
40
|
+
* Shows the preselection area above the calendar view.
|
|
41
|
+
*/
|
|
42
|
+
this.showPreselection = false;
|
|
43
|
+
/**
|
|
44
|
+
* Specifies the date used to determine the visible month without changing the selection.
|
|
45
|
+
* @description It's in ISO format (YYYY-MM-DD).
|
|
46
|
+
* @example '2023-10-01'
|
|
47
|
+
*/
|
|
48
|
+
this.viewDate = null;
|
|
49
|
+
/**
|
|
50
|
+
* Specifies the date used to preview the range selection across multiple visible calendars.
|
|
51
|
+
* @description It's in ISO format (YYYY-MM-DD).
|
|
52
|
+
* @example '2023-10-15'
|
|
53
|
+
*/
|
|
54
|
+
this.hoverDate = null;
|
|
26
55
|
/**
|
|
27
56
|
* Specifies the start date of the selection
|
|
28
57
|
* @description It's in ISO format (YYYY-MM-DD).
|
|
@@ -51,6 +80,47 @@ export class MdsCalendar {
|
|
|
51
80
|
this.internalEndDate = this.endDate;
|
|
52
81
|
this.currentMonth = '';
|
|
53
82
|
this.currentYear = '';
|
|
83
|
+
this.handleMouseOver = (event) => {
|
|
84
|
+
const target = event.target;
|
|
85
|
+
if (!target.matches('mds-calendar-cell') ||
|
|
86
|
+
!this.rangePicker ||
|
|
87
|
+
!this.internalStartDate ||
|
|
88
|
+
this.internalEndDate) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const hoverDate = target.getAttribute('date');
|
|
92
|
+
if (hoverDate) {
|
|
93
|
+
this.hoverEmitter.emit({ hoverDate });
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
this.handleMouseLeave = () => {
|
|
97
|
+
if (!this.rangePicker || !this.internalStartDate || this.internalEndDate || !this.hoverDate) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.hoverEmitter.emit({ hoverDate: null });
|
|
101
|
+
};
|
|
102
|
+
this.handleMonthActionClick = (event) => {
|
|
103
|
+
event.stopPropagation();
|
|
104
|
+
if (this.disableMonthYearSelection) {
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this.currentView = this.currentView === 'months' ? 'calendar' : 'months';
|
|
109
|
+
requestAnimationFrame(() => {
|
|
110
|
+
this.updateCalendar().then(() => this.setDates());
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
this.handleYearActionClick = (event) => {
|
|
114
|
+
event.stopPropagation();
|
|
115
|
+
if (this.disableMonthYearSelection) {
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
this.currentView = this.currentView === 'years' ? 'calendar' : 'years';
|
|
120
|
+
requestAnimationFrame(() => {
|
|
121
|
+
this.updateCalendar().then(() => this.setDates());
|
|
122
|
+
});
|
|
123
|
+
};
|
|
54
124
|
}
|
|
55
125
|
async updateLang() {
|
|
56
126
|
this.language = this.t.lang(this.host);
|
|
@@ -58,14 +128,25 @@ export class MdsCalendar {
|
|
|
58
128
|
handleStartDate(newValue) {
|
|
59
129
|
if (newValue !== null && newValue !== '') {
|
|
60
130
|
this.internalStartDate = sanitizeISO8601Date(newValue === null || newValue === void 0 ? void 0 : newValue.toString());
|
|
131
|
+
this.startDateTime = DateTime.fromISO(this.internalStartDate);
|
|
132
|
+
this.startDateIdentifier = this.startDateTime.toISODate();
|
|
61
133
|
if (this.internalEndDate) {
|
|
62
|
-
const startDateTime = DateTime.fromISO(this.internalStartDate);
|
|
63
134
|
const endDateTime = DateTime.fromISO(this.internalEndDate);
|
|
64
|
-
if (startDateTime > endDateTime) {
|
|
135
|
+
if (this.startDateTime > endDateTime) {
|
|
65
136
|
console.warn('startDate is after endDate, swapping values');
|
|
66
137
|
return;
|
|
67
138
|
}
|
|
68
139
|
}
|
|
140
|
+
else if (this.rangePicker) {
|
|
141
|
+
this.isFirstClick = false;
|
|
142
|
+
}
|
|
143
|
+
this.updateDates();
|
|
144
|
+
}
|
|
145
|
+
else if (newValue === null || newValue === '') {
|
|
146
|
+
this.internalStartDate = null;
|
|
147
|
+
this.startDateIdentifier = null;
|
|
148
|
+
this.startDateTime = null;
|
|
149
|
+
this.isFirstClick = true;
|
|
69
150
|
this.updateDates();
|
|
70
151
|
}
|
|
71
152
|
}
|
|
@@ -76,21 +157,48 @@ export class MdsCalendar {
|
|
|
76
157
|
}
|
|
77
158
|
else if (newValue !== null && newValue !== '') {
|
|
78
159
|
this.internalEndDate = sanitizeISO8601Date(newValue === null || newValue === void 0 ? void 0 : newValue.toString());
|
|
160
|
+
this.endDateTime = DateTime.fromISO(this.internalEndDate);
|
|
161
|
+
this.endDateIdentifier = this.endDateTime.toISODate();
|
|
79
162
|
if (this.internalStartDate) {
|
|
80
163
|
const startDateTime = DateTime.fromISO(this.internalStartDate);
|
|
81
|
-
|
|
82
|
-
if (startDateTime > endDateTime) {
|
|
164
|
+
if (startDateTime > this.endDateTime) {
|
|
83
165
|
console.warn('startDate is after endDate, swapping values');
|
|
84
166
|
return;
|
|
85
167
|
}
|
|
86
168
|
}
|
|
87
169
|
this.updateDates();
|
|
88
170
|
}
|
|
171
|
+
else if (newValue === null || newValue === '') {
|
|
172
|
+
this.internalEndDate = null;
|
|
173
|
+
this.endDateIdentifier = null;
|
|
174
|
+
this.endDateTime = null;
|
|
175
|
+
this.updateDates();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
handleViewDate(newValue) {
|
|
179
|
+
if (newValue !== null && newValue !== '') {
|
|
180
|
+
const viewDate = DateTime.fromISO(newValue.toString());
|
|
181
|
+
if (viewDate.isValid) {
|
|
182
|
+
this.currentDate = viewDate;
|
|
183
|
+
this.updateCalendar().then(() => {
|
|
184
|
+
requestAnimationFrame(() => this.setDates());
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
handleHoverDate() {
|
|
190
|
+
requestAnimationFrame(() => this.setDates());
|
|
89
191
|
}
|
|
90
192
|
componentWillLoad() {
|
|
91
193
|
var _a, _b;
|
|
92
194
|
this.language = this.t.lang(this.host);
|
|
93
|
-
if (this.
|
|
195
|
+
if (this.viewDate) {
|
|
196
|
+
const viewDate = DateTime.fromISO(this.viewDate.toString());
|
|
197
|
+
if (viewDate.isValid) {
|
|
198
|
+
this.currentDate = viewDate;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
else if (this.internalStartDate) {
|
|
94
202
|
this.internalStartDate = sanitizeISO8601Date((_a = this.internalStartDate) === null || _a === void 0 ? void 0 : _a.toString());
|
|
95
203
|
this.startDateTime = DateTime.fromISO(this.internalStartDate);
|
|
96
204
|
if (this.startDateTime.isValid) {
|
|
@@ -104,40 +212,33 @@ export class MdsCalendar {
|
|
|
104
212
|
this.updateCalendar();
|
|
105
213
|
}
|
|
106
214
|
componentDidLoad() {
|
|
107
|
-
var _a, _b, _c;
|
|
108
|
-
this.hasPreselection =
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.handleHover(target);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
215
|
+
var _a, _b, _c, _d, _e;
|
|
216
|
+
this.hasPreselection =
|
|
217
|
+
((_a = this.host) === null || _a === void 0 ? void 0 : _a.querySelector('.date-preselection--has-preselection')) !== null;
|
|
218
|
+
(_c = (_b = this.host) === null || _b === void 0 ? void 0 : _b.shadowRoot) === null || _c === void 0 ? void 0 : _c.addEventListener('mouseover', this.handleMouseOver);
|
|
219
|
+
(_e = (_d = this.host) === null || _d === void 0 ? void 0 : _d.shadowRoot) === null || _e === void 0 ? void 0 : _e.addEventListener('mouseleave', this.handleMouseLeave);
|
|
115
220
|
this.setDates();
|
|
116
221
|
}
|
|
117
222
|
disconnectedCallback() {
|
|
118
|
-
var _a, _b;
|
|
119
|
-
(_b = (_a = this.host) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseover',
|
|
120
|
-
|
|
121
|
-
if (target.matches('mds-calendar-cell') && this.startDateIdentifier && this.rangePicker) {
|
|
122
|
-
this.handleHover(target);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
223
|
+
var _a, _b, _c, _d;
|
|
224
|
+
(_b = (_a = this.host) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseover', this.handleMouseOver);
|
|
225
|
+
(_d = (_c = this.host) === null || _c === void 0 ? void 0 : _c.shadowRoot) === null || _d === void 0 ? void 0 : _d.removeEventListener('mouseleave', this.handleMouseLeave);
|
|
125
226
|
}
|
|
126
227
|
async updateCurrentDate(date) {
|
|
127
228
|
this.currentDate = DateTime.fromISO(date);
|
|
229
|
+
await this.updateCalendar();
|
|
230
|
+
await new Promise(resolve => {
|
|
231
|
+
requestAnimationFrame(() => {
|
|
232
|
+
this.setDates();
|
|
233
|
+
resolve();
|
|
234
|
+
});
|
|
235
|
+
});
|
|
128
236
|
return Promise.resolve();
|
|
129
237
|
}
|
|
130
238
|
updateDates() {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
else if (this.internalStartDate && !this.rangePicker) {
|
|
137
|
-
this.updateCalendar().then(() => {
|
|
138
|
-
requestAnimationFrame(() => this.setDates());
|
|
139
|
-
});
|
|
140
|
-
}
|
|
239
|
+
this.updateCalendar().then(() => {
|
|
240
|
+
requestAnimationFrame(() => this.setDates());
|
|
241
|
+
});
|
|
141
242
|
}
|
|
142
243
|
async updateCalendar() {
|
|
143
244
|
try {
|
|
@@ -159,25 +260,45 @@ export class MdsCalendar {
|
|
|
159
260
|
const { shadowRoot } = calendar;
|
|
160
261
|
if (!shadowRoot)
|
|
161
262
|
return;
|
|
162
|
-
const calendarCells = shadowRoot.querySelectorAll('mds-calendar-cell[selection]');
|
|
163
|
-
if (this.
|
|
164
|
-
if (this.
|
|
165
|
-
this.
|
|
263
|
+
const calendarCells = shadowRoot.querySelectorAll('mds-calendar-cell[selection], mds-calendar-cell[preview]');
|
|
264
|
+
if (this.rangePicker) {
|
|
265
|
+
if (this.hoverDate && !this.internalEndDate) {
|
|
266
|
+
this.setHoverSelection(calendarCells, shadowRoot);
|
|
166
267
|
}
|
|
167
268
|
else {
|
|
168
|
-
this.
|
|
269
|
+
this.setRangeSelection(calendarCells, shadowRoot);
|
|
169
270
|
}
|
|
170
271
|
}
|
|
272
|
+
else {
|
|
273
|
+
this.setSingleSelection(calendarCells, shadowRoot);
|
|
274
|
+
}
|
|
171
275
|
}
|
|
172
|
-
|
|
276
|
+
clearSelectionState(calendarCells) {
|
|
173
277
|
calendarCells.forEach(day => {
|
|
174
278
|
day.removeAttribute('selection');
|
|
175
279
|
day.removeAttribute('preview');
|
|
176
280
|
});
|
|
177
|
-
|
|
281
|
+
}
|
|
282
|
+
setRangeSelection(calendarCells, shadowRoot) {
|
|
283
|
+
this.clearSelectionState(calendarCells);
|
|
284
|
+
if (!this.internalStartDate)
|
|
178
285
|
return;
|
|
179
286
|
this.startDateTime = DateTime.fromISO(this.internalStartDate.toString());
|
|
287
|
+
if (!this.internalEndDate) {
|
|
288
|
+
this.startDateIdentifier = this.startDateTime.toISODate();
|
|
289
|
+
this.isFirstClick = false;
|
|
290
|
+
const cells = shadowRoot.querySelectorAll('mds-calendar-cell');
|
|
291
|
+
cells.forEach(cell => {
|
|
292
|
+
if (cell.getAttribute('date') === this.startDateTime.toFormat('yyyy-MM-dd')) {
|
|
293
|
+
cell.setAttribute('selection', 'single');
|
|
294
|
+
cell.setAttribute('preview', 'true');
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
180
299
|
this.endDateTime = DateTime.fromISO(this.internalEndDate.toString());
|
|
300
|
+
this.startDateIdentifier = this.startDateTime.toISODate();
|
|
301
|
+
this.endDateIdentifier = this.endDateTime.toISODate();
|
|
181
302
|
const cells = shadowRoot.querySelectorAll('mds-calendar-cell');
|
|
182
303
|
if (cells) {
|
|
183
304
|
let isBetweenDates;
|
|
@@ -204,10 +325,48 @@ export class MdsCalendar {
|
|
|
204
325
|
}
|
|
205
326
|
}
|
|
206
327
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
328
|
+
setHoverSelection(calendarCells, shadowRoot) {
|
|
329
|
+
this.clearSelectionState(calendarCells);
|
|
330
|
+
if (!this.internalStartDate || !this.hoverDate) {
|
|
331
|
+
this.setRangeSelection(calendarCells, shadowRoot);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const startDate = DateTime.fromISO(this.internalStartDate);
|
|
335
|
+
const hoverDate = DateTime.fromISO(this.hoverDate);
|
|
336
|
+
if (!startDate.isValid || !hoverDate.isValid) {
|
|
337
|
+
this.setRangeSelection(calendarCells, shadowRoot);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const isForwardSelection = startDate <= hoverDate;
|
|
341
|
+
const cells = Array.from(shadowRoot.querySelectorAll('mds-calendar-cell'));
|
|
342
|
+
cells.forEach(cell => {
|
|
343
|
+
const cellDateString = cell.getAttribute('date');
|
|
344
|
+
if (!cellDateString)
|
|
345
|
+
return;
|
|
346
|
+
const cellDate = DateTime.fromISO(cellDateString);
|
|
347
|
+
if (!cellDate.isValid)
|
|
348
|
+
return;
|
|
349
|
+
const isInRange = isForwardSelection
|
|
350
|
+
? cellDate >= startDate && cellDate <= hoverDate
|
|
351
|
+
: cellDate >= hoverDate && cellDate <= startDate;
|
|
352
|
+
if (!isInRange)
|
|
353
|
+
return;
|
|
354
|
+
cell.setAttribute('preview', 'true');
|
|
355
|
+
let selectionType = 'middle';
|
|
356
|
+
if (startDate.equals(hoverDate) && cellDate.equals(startDate)) {
|
|
357
|
+
selectionType = 'single';
|
|
358
|
+
}
|
|
359
|
+
else if (cellDate.equals(startDate)) {
|
|
360
|
+
selectionType = isForwardSelection ? 'start' : 'end';
|
|
361
|
+
}
|
|
362
|
+
else if (cellDate.equals(hoverDate)) {
|
|
363
|
+
selectionType = isForwardSelection ? 'end' : 'start';
|
|
364
|
+
}
|
|
365
|
+
cell.setAttribute('selection', selectionType);
|
|
210
366
|
});
|
|
367
|
+
}
|
|
368
|
+
setSingleSelection(calendarCells, shadowRoot) {
|
|
369
|
+
this.clearSelectionState(calendarCells);
|
|
211
370
|
if (!this.internalStartDate)
|
|
212
371
|
return;
|
|
213
372
|
this.startDateTime = DateTime.fromISO(this.internalStartDate.toString());
|
|
@@ -229,6 +388,10 @@ export class MdsCalendar {
|
|
|
229
388
|
this.updateCalendar().then(() => {
|
|
230
389
|
requestAnimationFrame(() => this.setDates());
|
|
231
390
|
});
|
|
391
|
+
this.navigationEmitter.emit({
|
|
392
|
+
currentDate: this.currentDate.toISODate(),
|
|
393
|
+
delta,
|
|
394
|
+
});
|
|
232
395
|
}
|
|
233
396
|
calculateWeekDaysInMonth() {
|
|
234
397
|
const startOfMonth = this.currentDate.startOf('month');
|
|
@@ -253,6 +416,17 @@ export class MdsCalendar {
|
|
|
253
416
|
}
|
|
254
417
|
handleRange(element, dayInfo) {
|
|
255
418
|
var _a, _b;
|
|
419
|
+
const pendingStartDate = this.startDate || this.host.getAttribute('start-date');
|
|
420
|
+
if (this.rangePicker &&
|
|
421
|
+
pendingStartDate &&
|
|
422
|
+
!this.endDate &&
|
|
423
|
+
!this.internalEndDate &&
|
|
424
|
+
this.isFirstClick) {
|
|
425
|
+
this.internalStartDate = sanitizeISO8601Date(pendingStartDate.toString());
|
|
426
|
+
this.startDateTime = DateTime.fromISO(this.internalStartDate);
|
|
427
|
+
this.startDateIdentifier = this.startDateTime.toISODate();
|
|
428
|
+
this.isFirstClick = false;
|
|
429
|
+
}
|
|
256
430
|
const resetSelection = () => {
|
|
257
431
|
this.internalStartDate = null;
|
|
258
432
|
this.internalEndDate = null;
|
|
@@ -289,14 +463,16 @@ export class MdsCalendar {
|
|
|
289
463
|
element.setAttribute('selection', 'single');
|
|
290
464
|
element.setAttribute('preview', 'true');
|
|
291
465
|
});
|
|
466
|
+
this.datesEmitter.emit({ startDate: this.internalStartDate });
|
|
292
467
|
return;
|
|
293
468
|
}
|
|
294
469
|
const calendar = this.host;
|
|
295
470
|
const mdsCalendarCellElements = (_a = calendar === null || calendar === void 0 ? void 0 : calendar.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('mds-calendar-cell');
|
|
296
|
-
const startDateElementIndex = Array.from(mdsCalendarCellElements !== null && mdsCalendarCellElements !== void 0 ? mdsCalendarCellElements : [])
|
|
297
|
-
.findIndex((cell) => cell.getAttribute('date') === this.startDateIdentifier);
|
|
471
|
+
const startDateElementIndex = Array.from(mdsCalendarCellElements !== null && mdsCalendarCellElements !== void 0 ? mdsCalendarCellElements : []).findIndex((cell) => cell.getAttribute('date') === this.startDateIdentifier);
|
|
298
472
|
const elementIndex = Array.from(mdsCalendarCellElements !== null && mdsCalendarCellElements !== void 0 ? mdsCalendarCellElements : []).indexOf(element);
|
|
299
|
-
if (this.startDateIdentifier &&
|
|
473
|
+
if (this.startDateIdentifier &&
|
|
474
|
+
DateTime.fromISO(this.startDateIdentifier) <
|
|
475
|
+
DateTime.fromISO(element.getAttribute('date'))) {
|
|
300
476
|
this.endDateIdentifier = element.getAttribute('date');
|
|
301
477
|
this.endDateTime = dayInfo;
|
|
302
478
|
this.internalEndDate = this.endDateTime.toISO().split('T')[0];
|
|
@@ -322,66 +498,6 @@ export class MdsCalendar {
|
|
|
322
498
|
this.checkPreselectionsEmitter.emit();
|
|
323
499
|
}
|
|
324
500
|
}
|
|
325
|
-
handleHover(element) {
|
|
326
|
-
var _a, _b;
|
|
327
|
-
const typedElement = element;
|
|
328
|
-
const startDate = DateTime.fromISO(this.internalStartDate);
|
|
329
|
-
if (!startDate.isValid || this.endDateIdentifier !== null)
|
|
330
|
-
return;
|
|
331
|
-
const calendar = this.host;
|
|
332
|
-
const mdsCalendarCellElements = Array.from((_b = (_a = calendar === null || calendar === void 0 ? void 0 : calendar.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('mds-calendar-cell')) !== null && _b !== void 0 ? _b : []);
|
|
333
|
-
const hoveredDateStr = typedElement.getAttribute('date');
|
|
334
|
-
if (!hoveredDateStr)
|
|
335
|
-
return;
|
|
336
|
-
const hoveredDate = DateTime.fromISO(hoveredDateStr);
|
|
337
|
-
if (!hoveredDate.isValid)
|
|
338
|
-
return;
|
|
339
|
-
const startTypedElement = mdsCalendarCellElements.find(cell => cell.getAttribute('date') === this.internalStartDate);
|
|
340
|
-
mdsCalendarCellElements.forEach(cell => {
|
|
341
|
-
cell.removeAttribute('preview');
|
|
342
|
-
cell.removeAttribute('selection');
|
|
343
|
-
});
|
|
344
|
-
typedElement.setAttribute('preview', 'true');
|
|
345
|
-
const typedDateStr = typedElement.getAttribute('date');
|
|
346
|
-
if (typedDateStr) {
|
|
347
|
-
const typedDate = DateTime.fromISO(typedDateStr);
|
|
348
|
-
if (typedDate.isValid && startTypedElement) {
|
|
349
|
-
if (startDate < typedDate) {
|
|
350
|
-
startTypedElement.setAttribute('selection', 'start');
|
|
351
|
-
}
|
|
352
|
-
else if (startDate > typedDate) {
|
|
353
|
-
startTypedElement.setAttribute('selection', 'end');
|
|
354
|
-
typedElement.setAttribute('selection', 'start');
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
typedElement.setAttribute('selection', 'single');
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
if (startDate.equals(hoveredDate)) {
|
|
362
|
-
typedElement.setAttribute('selection', 'single');
|
|
363
|
-
}
|
|
364
|
-
else {
|
|
365
|
-
const [start, end] = startDate < hoveredDate ? [startDate, hoveredDate] : [hoveredDate, startDate];
|
|
366
|
-
mdsCalendarCellElements.forEach(cell => {
|
|
367
|
-
const cellDateStr = cell.getAttribute('date');
|
|
368
|
-
if (!cellDateStr)
|
|
369
|
-
return;
|
|
370
|
-
const cellDate = DateTime.fromISO(cellDateStr);
|
|
371
|
-
if (!cellDate.isValid)
|
|
372
|
-
return;
|
|
373
|
-
if (cellDate >= start && cellDate <= end) {
|
|
374
|
-
cell.setAttribute('preview', 'true');
|
|
375
|
-
let selectionType = 'middle';
|
|
376
|
-
if (cellDate.equals(start))
|
|
377
|
-
selectionType = 'start';
|
|
378
|
-
if (cellDate.equals(end))
|
|
379
|
-
selectionType = 'end';
|
|
380
|
-
cell.setAttribute('selection', selectionType);
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
501
|
handleSingleSelection(element, dayInfo) {
|
|
386
502
|
var _a;
|
|
387
503
|
const calendar = this.host;
|
|
@@ -398,7 +514,8 @@ export class MdsCalendar {
|
|
|
398
514
|
}
|
|
399
515
|
}
|
|
400
516
|
render() {
|
|
401
|
-
return (h(Host, { key: '
|
|
517
|
+
return (h(Host, { key: '271209054e3f86d3c167ab6f2d84c801619f7fdb' }, h("div", { key: '084902141f92f15f4b62ec34fc826b939f0ff05b', class: clsx('calendar-preselection', (this.showPreselection || this.hasPreselection) &&
|
|
518
|
+
'calendar-preselection--has-preselection') }, h("slot", { key: '986c1168978cc658b3a7409adafac5651cae7c77', name: "preselection" })), h("div", { key: 'bbb9882d52d1fd89758704604c3a52016535561e', class: "calendar-view" }, h("nav", { key: '9f993a0c44e484303716cef6530d9d95e84226a1' }, this.showPreviousButton && (h("mds-button", { key: 'f78027217275a9f0896fdfaa2ed99fd10064f581', class: "action-back", icon: miBaselineBackIosNew, variant: "dark", tone: "quiet", onClick: event => {
|
|
402
519
|
if (this.currentView === 'calendar') {
|
|
403
520
|
event.stopPropagation();
|
|
404
521
|
this.changeMonth(-1);
|
|
@@ -410,19 +527,7 @@ export class MdsCalendar {
|
|
|
410
527
|
else {
|
|
411
528
|
event.stopPropagation();
|
|
412
529
|
}
|
|
413
|
-
} }), h("div", { key: '
|
|
414
|
-
event.stopPropagation();
|
|
415
|
-
this.currentView = this.currentView === 'months' ? 'calendar' : 'months';
|
|
416
|
-
requestAnimationFrame(() => {
|
|
417
|
-
this.updateCalendar().then(() => this.setDates());
|
|
418
|
-
});
|
|
419
|
-
} }, this.currentMonth), (this.currentView === 'calendar' || this.currentView === 'years') && h("mds-button", { key: 'd79d4de0219d05724b173290fa39a034324d950b', class: "action-year", variant: "dark", tone: "quiet", onClick: event => {
|
|
420
|
-
event.stopPropagation();
|
|
421
|
-
this.currentView = this.currentView === 'years' ? 'calendar' : 'years';
|
|
422
|
-
requestAnimationFrame(() => {
|
|
423
|
-
this.updateCalendar().then(() => this.setDates());
|
|
424
|
-
});
|
|
425
|
-
} }, this.currentYear)), h("mds-button", { key: '596683e3960b61627fbe8d774db076e2297cd99a', class: "action-forward", icon: miBaselineForwardIos, variant: "dark", tone: "quiet", onClick: event => {
|
|
530
|
+
} })), h("div", { key: 'e2916642b7072db24f8e800fb033260a9c2a3dcd', class: "select-month-or-year" }, (this.currentView === 'calendar' || this.currentView === 'months') && (h("mds-button", { key: '112c7d69205f2c57587a4ba12ecd7b445ef66170', class: "action-month", truncate: "none", variant: "dark", tone: "quiet", onClick: this.handleMonthActionClick }, this.currentMonth)), (this.currentView === 'calendar' || this.currentView === 'years') && (h("mds-button", { key: '91f990cfdafb34e3983f7e375e695dce5fde11fd', class: "action-year", truncate: "none", variant: "dark", tone: "quiet", onClick: this.handleYearActionClick }, this.currentYear))), this.showNextButton && (h("mds-button", { key: 'd297451100785c186b8ae054fa0203007f218cb7', class: "action-forward", icon: miBaselineForwardIos, variant: "dark", tone: "quiet", onClick: event => {
|
|
426
531
|
if (this.currentView === 'calendar') {
|
|
427
532
|
event.stopPropagation();
|
|
428
533
|
this.changeMonth(1);
|
|
@@ -434,11 +539,15 @@ export class MdsCalendar {
|
|
|
434
539
|
else {
|
|
435
540
|
event.stopPropagation();
|
|
436
541
|
}
|
|
437
|
-
} })), this.currentView === 'calendar' && (h("section", { key: '
|
|
438
|
-
if (this.min &&
|
|
542
|
+
} }))), this.currentView === 'calendar' && (h("section", { key: 'bf8eba9f66065c91d0f4feac4ddbc93c1fc63ad4', class: "month-view" }, h("header", { key: 'c90bf7ed93129ab8bfc3ecaab99fb2d012adab39', class: "month-view__days-names" }, this.weekdays.map(day => (h("mds-button", { class: "week-day-name", variant: "dark", tone: "quiet" }, day)))), h("div", { key: '6b5fb95ad179b38fefe0986b48a3a12a287ccf61', class: "month-view__cells" }, this.weekDaysinMonth.map((dayInfo, index) => (h("mds-calendar-cell", { key: index, today: DateTime.now().toFormat('yyyy-MM-dd') === dayInfo.date.toFormat('yyyy-MM-dd'), date: dayInfo.date.toFormat('yyyy-MM-dd'), month: dayInfo.isCurrentMonth ? 'current' : 'other', disabled: (() => {
|
|
543
|
+
if (this.min &&
|
|
544
|
+
this.min !== '' &&
|
|
545
|
+
dayInfo.date < DateTime.fromISO(this.min)) {
|
|
439
546
|
return true;
|
|
440
547
|
}
|
|
441
|
-
if (this.max &&
|
|
548
|
+
if (this.max &&
|
|
549
|
+
this.max !== '' &&
|
|
550
|
+
dayInfo.date > DateTime.fromISO(this.max)) {
|
|
442
551
|
return true;
|
|
443
552
|
}
|
|
444
553
|
return undefined;
|
|
@@ -449,9 +558,15 @@ export class MdsCalendar {
|
|
|
449
558
|
this.handleRange(target, dayInfo.date);
|
|
450
559
|
else
|
|
451
560
|
this.handleSingleSelection(target, dayInfo.date);
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
|
|
561
|
+
}, title: dayInfo.date
|
|
562
|
+
.setLocale(this.language)
|
|
563
|
+
.toFormat('cccc d LLLL')
|
|
564
|
+
.replace(/^./, char => char.toUpperCase()) }, dayInfo.date.toFormat('dd'))))))), this.currentView === 'months' && (h("section", { key: '5353ed4497b33fb5260cf6c2d1f087b228a0cda3', class: "month-selection" }, h("header", { key: '70247928e4a74589900b0acd3b8d02686e41a4d1', class: "month-view__month-names" }, Array.from({ length: 12 }).map((_, index) => {
|
|
565
|
+
const monthName = DateTime.local()
|
|
566
|
+
.set({ month: index + 1 })
|
|
567
|
+
.setLocale(this.language)
|
|
568
|
+
.toFormat('MMMM');
|
|
569
|
+
return (h("mds-button", { class: "action", variant: "dark", tone: "quiet", onClick: event => {
|
|
455
570
|
event.stopPropagation();
|
|
456
571
|
this.currentDate = this.currentDate.set({ month: index + 1 });
|
|
457
572
|
this.currentMonth = this.currentDate.toFormat('MMMM');
|
|
@@ -460,9 +575,9 @@ export class MdsCalendar {
|
|
|
460
575
|
requestAnimationFrame(() => this.setDates());
|
|
461
576
|
});
|
|
462
577
|
} }, monthName));
|
|
463
|
-
})))), this.currentView === 'years' && (h("section", { key: '
|
|
578
|
+
})))), this.currentView === 'years' && (h("section", { key: '99dca1c5f3ce083cb3bb117ce8bb705faa83e19c', class: "year-selection" }, h("header", { key: '7d479a8c05815560306486bf0825a521c971a6e4', class: "month-view__years" }, Array.from({ length: 12 }).map((_, index) => {
|
|
464
579
|
const year = this.selectedYear + index;
|
|
465
|
-
return (h("mds-button", { class:
|
|
580
|
+
return (h("mds-button", { class: "action", variant: "dark", tone: "quiet", onClick: event => {
|
|
466
581
|
event.stopPropagation();
|
|
467
582
|
this.currentDate = this.currentDate.set({ year });
|
|
468
583
|
this.currentYear = year.toString();
|
|
@@ -507,6 +622,138 @@ export class MdsCalendar {
|
|
|
507
622
|
"reflect": false,
|
|
508
623
|
"defaultValue": "true"
|
|
509
624
|
},
|
|
625
|
+
"showPreviousButton": {
|
|
626
|
+
"type": "boolean",
|
|
627
|
+
"mutable": false,
|
|
628
|
+
"complexType": {
|
|
629
|
+
"original": "boolean",
|
|
630
|
+
"resolved": "boolean",
|
|
631
|
+
"references": {}
|
|
632
|
+
},
|
|
633
|
+
"required": false,
|
|
634
|
+
"optional": false,
|
|
635
|
+
"docs": {
|
|
636
|
+
"tags": [],
|
|
637
|
+
"text": "Shows the previous navigation button in the calendar header."
|
|
638
|
+
},
|
|
639
|
+
"getter": false,
|
|
640
|
+
"setter": false,
|
|
641
|
+
"attribute": "show-previous-button",
|
|
642
|
+
"reflect": false,
|
|
643
|
+
"defaultValue": "true"
|
|
644
|
+
},
|
|
645
|
+
"showNextButton": {
|
|
646
|
+
"type": "boolean",
|
|
647
|
+
"mutable": false,
|
|
648
|
+
"complexType": {
|
|
649
|
+
"original": "boolean",
|
|
650
|
+
"resolved": "boolean",
|
|
651
|
+
"references": {}
|
|
652
|
+
},
|
|
653
|
+
"required": false,
|
|
654
|
+
"optional": false,
|
|
655
|
+
"docs": {
|
|
656
|
+
"tags": [],
|
|
657
|
+
"text": "Shows the next navigation button in the calendar header."
|
|
658
|
+
},
|
|
659
|
+
"getter": false,
|
|
660
|
+
"setter": false,
|
|
661
|
+
"attribute": "show-next-button",
|
|
662
|
+
"reflect": false,
|
|
663
|
+
"defaultValue": "true"
|
|
664
|
+
},
|
|
665
|
+
"disableMonthYearSelection": {
|
|
666
|
+
"type": "boolean",
|
|
667
|
+
"mutable": false,
|
|
668
|
+
"complexType": {
|
|
669
|
+
"original": "boolean",
|
|
670
|
+
"resolved": "boolean",
|
|
671
|
+
"references": {}
|
|
672
|
+
},
|
|
673
|
+
"required": false,
|
|
674
|
+
"optional": false,
|
|
675
|
+
"docs": {
|
|
676
|
+
"tags": [],
|
|
677
|
+
"text": "Disables switching to month or year selection views from the calendar header."
|
|
678
|
+
},
|
|
679
|
+
"getter": false,
|
|
680
|
+
"setter": false,
|
|
681
|
+
"attribute": "disable-month-year-selection",
|
|
682
|
+
"reflect": false,
|
|
683
|
+
"defaultValue": "false"
|
|
684
|
+
},
|
|
685
|
+
"showPreselection": {
|
|
686
|
+
"type": "boolean",
|
|
687
|
+
"mutable": false,
|
|
688
|
+
"complexType": {
|
|
689
|
+
"original": "boolean",
|
|
690
|
+
"resolved": "boolean",
|
|
691
|
+
"references": {}
|
|
692
|
+
},
|
|
693
|
+
"required": false,
|
|
694
|
+
"optional": false,
|
|
695
|
+
"docs": {
|
|
696
|
+
"tags": [],
|
|
697
|
+
"text": "Shows the preselection area above the calendar view."
|
|
698
|
+
},
|
|
699
|
+
"getter": false,
|
|
700
|
+
"setter": false,
|
|
701
|
+
"attribute": "show-preselection",
|
|
702
|
+
"reflect": false,
|
|
703
|
+
"defaultValue": "false"
|
|
704
|
+
},
|
|
705
|
+
"viewDate": {
|
|
706
|
+
"type": "string",
|
|
707
|
+
"mutable": false,
|
|
708
|
+
"complexType": {
|
|
709
|
+
"original": "string | null",
|
|
710
|
+
"resolved": "null | string",
|
|
711
|
+
"references": {}
|
|
712
|
+
},
|
|
713
|
+
"required": false,
|
|
714
|
+
"optional": false,
|
|
715
|
+
"docs": {
|
|
716
|
+
"tags": [{
|
|
717
|
+
"name": "description",
|
|
718
|
+
"text": "It's in ISO format (YYYY-MM-DD)."
|
|
719
|
+
}, {
|
|
720
|
+
"name": "example",
|
|
721
|
+
"text": "'2023-10-01'"
|
|
722
|
+
}],
|
|
723
|
+
"text": "Specifies the date used to determine the visible month without changing the selection."
|
|
724
|
+
},
|
|
725
|
+
"getter": false,
|
|
726
|
+
"setter": false,
|
|
727
|
+
"attribute": "view-date",
|
|
728
|
+
"reflect": true,
|
|
729
|
+
"defaultValue": "null"
|
|
730
|
+
},
|
|
731
|
+
"hoverDate": {
|
|
732
|
+
"type": "string",
|
|
733
|
+
"mutable": false,
|
|
734
|
+
"complexType": {
|
|
735
|
+
"original": "string | null",
|
|
736
|
+
"resolved": "null | string",
|
|
737
|
+
"references": {}
|
|
738
|
+
},
|
|
739
|
+
"required": false,
|
|
740
|
+
"optional": false,
|
|
741
|
+
"docs": {
|
|
742
|
+
"tags": [{
|
|
743
|
+
"name": "description",
|
|
744
|
+
"text": "It's in ISO format (YYYY-MM-DD)."
|
|
745
|
+
}, {
|
|
746
|
+
"name": "example",
|
|
747
|
+
"text": "'2023-10-15'"
|
|
748
|
+
}],
|
|
749
|
+
"text": "Specifies the date used to preview the range selection across multiple visible calendars."
|
|
750
|
+
},
|
|
751
|
+
"getter": false,
|
|
752
|
+
"setter": false,
|
|
753
|
+
"attribute": "hover-date",
|
|
754
|
+
"reflect": true,
|
|
755
|
+
"defaultValue": "null"
|
|
756
|
+
},
|
|
510
757
|
"startDate": {
|
|
511
758
|
"type": "string",
|
|
512
759
|
"mutable": false,
|
|
@@ -626,7 +873,9 @@ export class MdsCalendar {
|
|
|
626
873
|
"selectedYear": {},
|
|
627
874
|
"language": {},
|
|
628
875
|
"internalStartDate": {},
|
|
629
|
-
"internalEndDate": {}
|
|
876
|
+
"internalEndDate": {},
|
|
877
|
+
"currentMonth": {},
|
|
878
|
+
"currentYear": {}
|
|
630
879
|
};
|
|
631
880
|
}
|
|
632
881
|
static get events() {
|
|
@@ -641,10 +890,40 @@ export class MdsCalendar {
|
|
|
641
890
|
"text": ""
|
|
642
891
|
},
|
|
643
892
|
"complexType": {
|
|
644
|
-
"original": "{startDate: string
|
|
893
|
+
"original": "{\n startDate: string,\n endDate?: string\n }",
|
|
645
894
|
"resolved": "{ startDate: string; endDate?: string | undefined; }",
|
|
646
895
|
"references": {}
|
|
647
896
|
}
|
|
897
|
+
}, {
|
|
898
|
+
"method": "navigationEmitter",
|
|
899
|
+
"name": "mdsCalendarNavigate",
|
|
900
|
+
"bubbles": true,
|
|
901
|
+
"cancelable": true,
|
|
902
|
+
"composed": true,
|
|
903
|
+
"docs": {
|
|
904
|
+
"tags": [],
|
|
905
|
+
"text": ""
|
|
906
|
+
},
|
|
907
|
+
"complexType": {
|
|
908
|
+
"original": "{\n currentDate: string,\n delta: number\n }",
|
|
909
|
+
"resolved": "{ currentDate: string; delta: number; }",
|
|
910
|
+
"references": {}
|
|
911
|
+
}
|
|
912
|
+
}, {
|
|
913
|
+
"method": "hoverEmitter",
|
|
914
|
+
"name": "mdsCalendarHover",
|
|
915
|
+
"bubbles": true,
|
|
916
|
+
"cancelable": true,
|
|
917
|
+
"composed": true,
|
|
918
|
+
"docs": {
|
|
919
|
+
"tags": [],
|
|
920
|
+
"text": ""
|
|
921
|
+
},
|
|
922
|
+
"complexType": {
|
|
923
|
+
"original": "{\n hoverDate: string | null\n }",
|
|
924
|
+
"resolved": "{ hoverDate: string | null; }",
|
|
925
|
+
"references": {}
|
|
926
|
+
}
|
|
648
927
|
}, {
|
|
649
928
|
"method": "checkPreselectionsEmitter",
|
|
650
929
|
"name": "mdsCalendarPreselect",
|
|
@@ -712,6 +991,12 @@ export class MdsCalendar {
|
|
|
712
991
|
}, {
|
|
713
992
|
"propName": "endDate",
|
|
714
993
|
"methodName": "handleEndDate"
|
|
994
|
+
}, {
|
|
995
|
+
"propName": "viewDate",
|
|
996
|
+
"methodName": "handleViewDate"
|
|
997
|
+
}, {
|
|
998
|
+
"propName": "hoverDate",
|
|
999
|
+
"methodName": "handleHoverDate"
|
|
715
1000
|
}];
|
|
716
1001
|
}
|
|
717
1002
|
}
|