@m3ui-vue/m3ui-vue 0.8.8 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -5
- package/dist/API.md +3661 -0
- package/dist/MIcon-CaEooCmZ.js.map +1 -1
- package/dist/{MMenuItem-5xojJYAL.js → MTextField-pJU1vFaR.js} +374 -364
- package/dist/MTextField-pJU1vFaR.js.map +1 -0
- package/dist/api.json +1 -0
- package/dist/barcode.js +9 -11
- package/dist/barcode.js.map +1 -1
- package/dist/chart.js.map +1 -1
- package/dist/code-editor.js +2 -2
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAbsolute.vue.d.ts +12 -0
- package/dist/components/MAlert.vue.d.ts +4 -0
- package/dist/components/MAppBar.vue.d.ts +12 -0
- package/dist/components/MAppLayout.vue.d.ts +2 -0
- package/dist/components/MAspectRatio.vue.d.ts +1 -0
- package/dist/components/MAutocomplete.vue.d.ts +18 -0
- package/dist/components/MAvatar.vue.d.ts +3 -0
- package/dist/components/MBadge.vue.d.ts +6 -0
- package/dist/components/MBar.vue.d.ts +5 -0
- package/dist/components/MBarcode.vue.d.ts +9 -0
- package/dist/components/MBottomSheet.vue.d.ts +3 -0
- package/dist/components/MBox.vue.d.ts +6 -0
- package/dist/components/MBreadcrumbs.vue.d.ts +2 -0
- package/dist/components/MButton.vue.d.ts +14 -4
- package/dist/components/MButtonGroup.vue.d.ts +7 -0
- package/dist/components/MCalendar.vue.d.ts +8 -0
- package/dist/components/MCard.vue.d.ts +17 -0
- package/dist/components/MCarousel.vue.d.ts +61 -36
- package/dist/components/MCenter.vue.d.ts +1 -0
- package/dist/components/MChart.vue.d.ts +7 -0
- package/dist/components/MChatBubble.vue.d.ts +10 -0
- package/dist/components/MCheckbox.vue.d.ts +5 -0
- package/dist/components/MChip.vue.d.ts +9 -0
- package/dist/components/MCircleProgressBar.vue.d.ts +7 -0
- package/dist/components/MCodeEditor.vue.d.ts +9 -0
- package/dist/components/MColorPicker.vue.d.ts +8 -0
- package/dist/components/MColorPickerModal.vue.d.ts +4 -0
- package/dist/components/MCommandPalette.vue.d.ts +8 -0
- package/dist/components/MConfirmDialog.vue.d.ts +7 -0
- package/dist/components/MContainer.vue.d.ts +4 -0
- package/dist/components/MContextMenu.vue.d.ts +3 -6
- package/dist/components/MCopyButton.vue.d.ts +10 -0
- package/dist/components/MDataTable.vue.d.ts +33 -12
- package/dist/components/MDatePicker.vue.d.ts +16 -0
- package/dist/components/MDatePickerModal.vue.d.ts +9 -0
- package/dist/components/MDateRangePicker.vue.d.ts +18 -0
- package/dist/components/MDateRangePickerModal.vue.d.ts +9 -0
- package/dist/components/MDialog.vue.d.ts +10 -6
- package/dist/components/MDivider.vue.d.ts +6 -0
- package/dist/components/MDragDropList.vue.d.ts +6 -0
- package/dist/components/MEmoji.vue.d.ts +6 -0
- package/dist/components/MEmojiButton.vue.d.ts +5 -0
- package/dist/components/MEmojiSelector.vue.d.ts +21 -5
- package/dist/components/MEmptyState.vue.d.ts +4 -0
- package/dist/components/MExpansionPanel.vue.d.ts +9 -0
- package/dist/components/MExportButton.vue.d.ts +8 -0
- package/dist/components/MFab.vue.d.ts +9 -0
- package/dist/components/MFabMenu.vue.d.ts +15 -1
- package/dist/components/MFileUpload.vue.d.ts +8 -0
- package/dist/components/MFixed.vue.d.ts +10 -0
- package/dist/components/MFlex.vue.d.ts +7 -1
- package/dist/components/MFooter.vue.d.ts +11 -0
- package/dist/components/MFullscreen.vue.d.ts +2 -0
- package/dist/components/MGrid.vue.d.ts +7 -0
- package/dist/components/MHotkeys.vue.d.ts +4 -0
- package/dist/components/MIcon.vue.d.ts +2 -0
- package/dist/components/MIconButton.vue.d.ts +10 -0
- package/dist/components/MInfiniteScroll.vue.d.ts +6 -0
- package/dist/components/MJsonEditor.vue.d.ts +8 -0
- package/dist/components/MJsonViewer.vue.d.ts +4 -0
- package/dist/components/MKanban.vue.d.ts +2 -0
- package/dist/components/MKbd.vue.d.ts +2 -0
- package/dist/components/MLightbox.vue.d.ts +19 -5
- package/dist/components/MList.vue.d.ts +7 -0
- package/dist/components/MListItem.vue.d.ts +24 -0
- package/dist/components/MListSubheader.vue.d.ts +6 -0
- package/dist/components/MLoadingIndicator.vue.d.ts +10 -0
- package/dist/components/MLoadingOverlay.vue.d.ts +5 -0
- package/dist/components/MMarkdown.vue.d.ts +3 -0
- package/dist/components/MMaskField.vue.d.ts +15 -0
- package/dist/components/MMasonry.vue.d.ts +5 -0
- package/dist/components/MMenu.vue.d.ts +3 -6
- package/dist/components/MMenuDivider.vue.d.ts +4 -0
- package/dist/components/MMenuItem.vue.d.ts +5 -0
- package/dist/components/MMultiAutocomplete.vue.d.ts +20 -0
- package/dist/components/MMultiSelect.vue.d.ts +21 -0
- package/dist/components/MNavigationBar.vue.d.ts +2 -0
- package/dist/components/MNavigationDrawer.vue.d.ts +11 -0
- package/dist/components/MNavigationRail.vue.d.ts +9 -6
- package/dist/components/MNavigationSuite.vue.d.ts +5 -3
- package/dist/components/MNumberField.vue.d.ts +17 -0
- package/dist/components/MOverlay.vue.d.ts +3 -0
- package/dist/components/MPageProgress.vue.d.ts +3 -0
- package/dist/components/MPagination.vue.d.ts +3 -0
- package/dist/components/MPasswordMeter.vue.d.ts +1 -0
- package/dist/components/MPinInput.vue.d.ts +11 -0
- package/dist/components/MProgressBar.vue.d.ts +6 -0
- package/dist/components/MPullToRefresh.vue.d.ts +8 -0
- package/dist/components/MQRCode.vue.d.ts +6 -0
- package/dist/components/MRadio.vue.d.ts +5 -0
- package/dist/components/MRadioGroup.vue.d.ts +6 -0
- package/dist/components/MRating.vue.d.ts +11 -0
- package/dist/components/MRelativeTime.vue.d.ts +1 -0
- package/dist/components/MResponsive.vue.d.ts +3 -0
- package/dist/components/MResult.vue.d.ts +6 -0
- package/dist/components/MRichTextEditor.vue.d.ts +8 -0
- package/dist/components/MScheduler.vue.d.ts +48 -1
- package/dist/components/MScrollable.vue.d.ts +3 -0
- package/dist/components/MSearchBar.vue.d.ts +6 -0
- package/dist/components/MSection.vue.d.ts +5 -0
- package/dist/components/MSegmentedButton.vue.d.ts +5 -0
- package/dist/components/MSelect.vue.d.ts +17 -0
- package/dist/components/MShader.vue.d.ts +1 -0
- package/dist/components/MShape.vue.d.ts +1 -1
- package/dist/components/MShortNavigationBar.vue.d.ts +8 -9
- package/dist/components/MSideSheet.vue.d.ts +3 -0
- package/dist/components/MSignaturePad.vue.d.ts +7 -0
- package/dist/components/MSimpleCarousel.vue.d.ts +12 -2
- package/dist/components/MSkeleton.vue.d.ts +8 -0
- package/dist/components/MSlider.vue.d.ts +15 -1
- package/dist/components/MSnackbar.vue.d.ts +1 -0
- package/dist/components/MSpinner.vue.d.ts +6 -0
- package/dist/components/MSplitButton.vue.d.ts +7 -0
- package/dist/components/MSplitter.vue.d.ts +4 -0
- package/dist/components/MSpotlightSearch.vue.d.ts +18 -0
- package/dist/components/MStack.vue.d.ts +8 -1
- package/dist/components/MStatCard.vue.d.ts +7 -0
- package/dist/components/MStepper.vue.d.ts +7 -0
- package/dist/components/MSticky.vue.d.ts +2 -0
- package/dist/components/MSubtitle.vue.d.ts +4 -0
- package/dist/components/MSwitch.vue.d.ts +5 -6
- package/dist/components/MTable.vue.d.ts +17 -4
- package/dist/components/MTabs.vue.d.ts +6 -0
- package/dist/components/MTagInput.vue.d.ts +17 -0
- package/dist/components/MTerminal.vue.d.ts +4 -0
- package/dist/components/MText.vue.d.ts +10 -0
- package/dist/components/MTextField.vue.d.ts +18 -0
- package/dist/components/MTimePicker.vue.d.ts +10 -0
- package/dist/components/MTimePickerModal.vue.d.ts +5 -0
- package/dist/components/MTimeline.vue.d.ts +3 -0
- package/dist/components/MTitle.vue.d.ts +4 -0
- package/dist/components/MToggleButton.vue.d.ts +4 -0
- package/dist/components/MToolbar.vue.d.ts +6 -1
- package/dist/components/MTooltip.vue.d.ts +7 -0
- package/dist/components/MTopAppBar.vue.d.ts +8 -0
- package/dist/components/MTour.vue.d.ts +5 -0
- package/dist/components/MTransferList.vue.d.ts +11 -0
- package/dist/components/MTree.vue.d.ts +11 -0
- package/dist/components/MTreeTable.vue.d.ts +7 -0
- package/dist/components/MVirtualTable.vue.d.ts +6 -0
- package/dist/components/MWindow.vue.d.ts +33 -1
- package/dist/composables/_carouselStrategy.d.ts +101 -0
- package/dist/composables/useLocale.d.ts +21 -0
- package/dist/data/emoji-names/emoji-names-de.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-en.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-es.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-fr.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-ja.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-ko.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-pt.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-zh.d.ts +2 -0
- package/dist/data/emojis.d.ts +7 -1
- package/dist/emoji-names-de-BphO5XpV.js +1877 -0
- package/dist/emoji-names-de-BphO5XpV.js.map +1 -0
- package/dist/emoji-names-en-9ZvMRvzi.js +1877 -0
- package/dist/emoji-names-en-9ZvMRvzi.js.map +1 -0
- package/dist/emoji-names-es-DvfWU3Pj.js +1877 -0
- package/dist/emoji-names-es-DvfWU3Pj.js.map +1 -0
- package/dist/emoji-names-fr-B-jhUlsP.js +1877 -0
- package/dist/emoji-names-fr-B-jhUlsP.js.map +1 -0
- package/dist/emoji-names-ja-l8cMFJo1.js +1877 -0
- package/dist/emoji-names-ja-l8cMFJo1.js.map +1 -0
- package/dist/emoji-names-ko-YP-o9G0c.js +1877 -0
- package/dist/emoji-names-ko-YP-o9G0c.js.map +1 -0
- package/dist/emoji-names-pt-DGj_Js4M.js +1877 -0
- package/dist/emoji-names-pt-DGj_Js4M.js.map +1 -0
- package/dist/emoji-names-zh-Dzecwtw_.js +1877 -0
- package/dist/emoji-names-zh-Dzecwtw_.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/locales/index.js +140 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +6642 -5160
- package/dist/m3ui.js.map +1 -1
- package/dist/markdown.js +1 -1
- package/dist/markdown.js.map +1 -1
- package/dist/plugin.d.ts +6 -0
- package/dist/qrcode.js.map +1 -1
- package/dist/rich-text-editor.js +10 -10
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/terminal.js +34 -27
- package/dist/terminal.js.map +1 -1
- package/dist/{useLocale-D3ZWZ8jY.js → useLocale-Drihe5G2.js} +33 -11
- package/dist/useLocale-Drihe5G2.js.map +1 -0
- package/package.json +4 -2
- package/src/__tests__/MCarousel.test.ts +183 -21
- package/src/__tests__/MDialog.test.ts +18 -0
- package/src/__tests__/MEmojiSelector.test.ts +138 -0
- package/src/__tests__/MHotkeys.test.ts +57 -0
- package/src/__tests__/MLightbox.test.ts +313 -5
- package/src/__tests__/MScheduler.test.ts +122 -0
- package/src/__tests__/MTerminal.test.ts +63 -0
- package/src/__tests__/attrsFallthrough.test.ts +65 -0
- package/src/__tests__/hostLocale.test.ts +57 -0
- package/src/__tests__/plugin.test.ts +28 -1
- package/src/components/MAbsolute.vue +18 -0
- package/src/components/MAlert.vue +12 -0
- package/src/components/MAppBar.vue +12 -0
- package/src/components/MAppLayout.vue +11 -0
- package/src/components/MAspectRatio.vue +6 -0
- package/src/components/MAutocomplete.vue +24 -0
- package/src/components/MAvatar.vue +12 -1
- package/src/components/MBadge.vue +11 -0
- package/src/components/MBar.vue +19 -0
- package/src/components/MBarcode.vue +18 -2
- package/src/components/MBottomSheet.vue +13 -1
- package/src/components/MBox.vue +12 -0
- package/src/components/MBreadcrumbs.vue +7 -0
- package/src/components/MButton.vue +22 -4
- package/src/components/MButtonGroup.vue +13 -0
- package/src/components/MCalendar.vue +14 -0
- package/src/components/MCard.vue +26 -0
- package/src/components/MCarousel.vue +542 -200
- package/src/components/MCenter.vue +6 -0
- package/src/components/MChart.vue +12 -0
- package/src/components/MChatBubble.vue +17 -0
- package/src/components/MCheckbox.vue +11 -0
- package/src/components/MChip.vue +17 -0
- package/src/components/MCircleProgressBar.vue +13 -0
- package/src/components/MCodeEditor.vue +18 -2
- package/src/components/MColorPicker.vue +13 -0
- package/src/components/MColorPickerModal.vue +12 -0
- package/src/components/MCommandPalette.vue +17 -1
- package/src/components/MConfirmDialog.vue +15 -0
- package/src/components/MContainer.vue +9 -0
- package/src/components/MContextMenu.vue +20 -7
- package/src/components/MCopyButton.vue +16 -0
- package/src/components/MDataTable.vue +58 -12
- package/src/components/MDatePicker.vue +21 -0
- package/src/components/MDatePickerModal.vue +17 -1
- package/src/components/MDateRangePicker.vue +23 -0
- package/src/components/MDateRangePickerModal.vue +17 -1
- package/src/components/MDialog.vue +43 -10
- package/src/components/MDivider.vue +6 -0
- package/src/components/MDragDropList.vue +18 -0
- package/src/components/MEmoji.vue +6 -0
- package/src/components/MEmojiButton.vue +11 -0
- package/src/components/MEmojiSelector.vue +486 -78
- package/src/components/MEmptyState.vue +9 -0
- package/src/components/MExpansionPanel.vue +17 -0
- package/src/components/MExportButton.vue +15 -0
- package/src/components/MFab.vue +20 -1
- package/src/components/MFabMenu.vue +20 -0
- package/src/components/MFileUpload.vue +19 -0
- package/src/components/MFixed.vue +16 -0
- package/src/components/MFlex.vue +11 -0
- package/src/components/MFooter.vue +11 -0
- package/src/components/MFullscreen.vue +8 -0
- package/src/components/MGrid.vue +12 -0
- package/src/components/MHotkeys.vue +20 -13
- package/src/components/MIcon.vue +10 -1
- package/src/components/MIconButton.vue +13 -0
- package/src/components/MInfiniteScroll.vue +16 -0
- package/src/components/MJsonEditor.vue +13 -0
- package/src/components/MJsonViewer.vue +7 -0
- package/src/components/MKanban.vue +18 -0
- package/src/components/MKbd.vue +6 -0
- package/src/components/MLightbox.vue +766 -268
- package/src/components/MList.vue +15 -0
- package/src/components/MListDetail.vue +11 -0
- package/src/components/MListItem.vue +37 -0
- package/src/components/MListSubheader.vue +6 -0
- package/src/components/MLoadingIndicator.vue +15 -0
- package/src/components/MLoadingOverlay.vue +18 -1
- package/src/components/MMarkdown.vue +7 -0
- package/src/components/MMaskField.vue +21 -0
- package/src/components/MMasonry.vue +11 -0
- package/src/components/MMenu.vue +19 -7
- package/src/components/MMenuDivider.vue +4 -0
- package/src/components/MMenuItem.vue +16 -0
- package/src/components/MMultiAutocomplete.vue +26 -0
- package/src/components/MMultiSelect.vue +27 -0
- package/src/components/MNavigationBar.vue +7 -0
- package/src/components/MNavigationDrawer.vue +30 -1
- package/src/components/MNavigationRail.vue +27 -6
- package/src/components/MNavigationSuite.vue +20 -3
- package/src/components/MNotificationHost.vue +3 -0
- package/src/components/MNumberField.vue +24 -0
- package/src/components/MOverlay.vue +11 -0
- package/src/components/MPageProgress.vue +7 -0
- package/src/components/MPagination.vue +15 -1
- package/src/components/MPasswordMeter.vue +7 -0
- package/src/components/MPinInput.vue +19 -0
- package/src/components/MProgressBar.vue +9 -0
- package/src/components/MPullToRefresh.vue +17 -0
- package/src/components/MQRCode.vue +12 -0
- package/src/components/MRadio.vue +11 -0
- package/src/components/MRadioGroup.vue +11 -0
- package/src/components/MRating.vue +19 -0
- package/src/components/MRelative.vue +8 -0
- package/src/components/MRelativeTime.vue +6 -0
- package/src/components/MResponsive.vue +9 -0
- package/src/components/MResult.vue +14 -0
- package/src/components/MRichTextEditor.vue +14 -0
- package/src/components/MScheduler.vue +303 -115
- package/src/components/MScrollable.vue +8 -0
- package/src/components/MSearchBar.vue +17 -0
- package/src/components/MSection.vue +13 -0
- package/src/components/MSegmentedButton.vue +10 -0
- package/src/components/MSelect.vue +22 -0
- package/src/components/MShader.vue +13 -0
- package/src/components/MShape.vue +6 -0
- package/src/components/MShortNavigationBar.vue +23 -9
- package/src/components/MSideSheet.vue +14 -1
- package/src/components/MSignaturePad.vue +15 -0
- package/src/components/MSimpleCarousel.vue +18 -0
- package/src/components/MSkeleton.vue +8 -0
- package/src/components/MSlider.vue +21 -0
- package/src/components/MSnackbar.vue +5 -0
- package/src/components/MSpacer.vue +6 -0
- package/src/components/MSpinner.vue +10 -0
- package/src/components/MSplitButton.vue +17 -1
- package/src/components/MSplitter.vue +10 -0
- package/src/components/MSpotlightSearch.vue +28 -1
- package/src/components/MStack.vue +12 -0
- package/src/components/MStatCard.vue +13 -0
- package/src/components/MStepper.vue +12 -0
- package/src/components/MSticky.vue +7 -0
- package/src/components/MSubtitle.vue +9 -0
- package/src/components/MSupportingPane.vue +10 -0
- package/src/components/MSwitch.vue +14 -6
- package/src/components/MTable.vue +33 -4
- package/src/components/MTabs.vue +12 -0
- package/src/components/MTagInput.vue +23 -0
- package/src/components/MTerminal.vue +33 -10
- package/src/components/MText.vue +15 -0
- package/src/components/MTextField.vue +26 -0
- package/src/components/MTimePicker.vue +15 -0
- package/src/components/MTimePickerModal.vue +13 -1
- package/src/components/MTimeline.vue +7 -0
- package/src/components/MTitle.vue +9 -0
- package/src/components/MToggleButton.vue +12 -0
- package/src/components/MToolbar.vue +12 -0
- package/src/components/MTooltip.vue +18 -0
- package/src/components/MTopAppBar.vue +18 -0
- package/src/components/MTour.vue +15 -2
- package/src/components/MTransferList.vue +24 -0
- package/src/components/MTree.vue +11 -0
- package/src/components/MTreeTable.vue +15 -0
- package/src/components/MVirtualTable.vue +12 -0
- package/src/components/MWindow.vue +34 -0
- package/src/composables/_carouselStrategy.ts +712 -0
- package/src/composables/useLocale.ts +54 -3
- package/src/data/emoji-names/emoji-names-de.ts +1875 -0
- package/src/data/emoji-names/emoji-names-en.ts +1875 -0
- package/src/data/emoji-names/emoji-names-es.ts +1875 -0
- package/src/data/emoji-names/emoji-names-fr.ts +1875 -0
- package/src/data/emoji-names/emoji-names-ja.ts +1875 -0
- package/src/data/emoji-names/emoji-names-ko.ts +1875 -0
- package/src/data/emoji-names/emoji-names-pt.ts +1875 -0
- package/src/data/emoji-names/emoji-names-zh.ts +1875 -0
- package/src/data/emojis.ts +29 -198
- package/src/index.ts +2 -2
- package/src/locales/de.ts +19 -0
- package/src/locales/es.ts +19 -0
- package/src/locales/fr.ts +19 -0
- package/src/locales/ja.ts +19 -0
- package/src/locales/ko.ts +19 -0
- package/src/locales/pt.ts +19 -0
- package/src/locales/zh.ts +19 -0
- package/src/plugin.ts +14 -2
- package/dist/MMenuItem-5xojJYAL.js.map +0 -1
- package/dist/useLocale-D3ZWZ8jY.js.map +0 -1
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* A week or day calendar grid. Events sit at their exact times, overlapping ones share the width, and anything
|
|
4
|
+
* that lasts all day or spans several days runs across the all-day row. Click a day header to open that day.
|
|
5
|
+
* Dates and times follow the app's locale.
|
|
6
|
+
*
|
|
7
|
+
* @slot event Content of each event block; allDay is true in the all-day row
|
|
8
|
+
* @event eventClick An event (in the grid or the all-day row) was clicked
|
|
9
|
+
* @event slotClick An empty spot in the grid was clicked
|
|
10
|
+
* @event update:date Navigation changed the date shown (YYYY-MM-DD)
|
|
11
|
+
* @event update:view The Day/Week toggle (or a day header) changed the view
|
|
12
|
+
*/
|
|
13
|
+
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
3
14
|
import MIconButton from './MIconButton.vue'
|
|
4
15
|
import { useLocale } from '../composables/useLocale'
|
|
5
16
|
|
|
@@ -8,129 +19,260 @@ const locale = useLocale()
|
|
|
8
19
|
export interface SchedulerEvent {
|
|
9
20
|
id: string | number
|
|
10
21
|
title: string
|
|
22
|
+
/**
|
|
23
|
+
* Start: a datetime (`2026-10-17T09:30`, or ISO with a zone). For an all-day event, a date
|
|
24
|
+
* (`2026-10-17`).
|
|
25
|
+
*/
|
|
11
26
|
start: string
|
|
27
|
+
/** End: a datetime (exclusive). For an all-day event, the last day (inclusive). */
|
|
12
28
|
end: string
|
|
29
|
+
/** Shown in the all-day row instead of the time grid. Events that span days go there too. */
|
|
30
|
+
allDay?: boolean
|
|
13
31
|
color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success'
|
|
14
32
|
}
|
|
15
33
|
|
|
16
34
|
const props = withDefaults(
|
|
17
35
|
defineProps<{
|
|
36
|
+
/** Events to show (see `SchedulerEvent`) */
|
|
18
37
|
events?: SchedulerEvent[]
|
|
38
|
+
/** 'week' or 'day'; use v-model:view to follow the header's toggle. */
|
|
19
39
|
view?: 'week' | 'day'
|
|
40
|
+
/** The date shown (`YYYY-MM-DD`), today by default; use v-model:date to follow navigation. */
|
|
41
|
+
date?: string
|
|
42
|
+
/** First visible hour */
|
|
20
43
|
startHour?: number
|
|
44
|
+
/** Hour the grid ends at */
|
|
21
45
|
endHour?: number
|
|
46
|
+
/** First day of the week: 0 = Sunday, 1 = Monday. */
|
|
47
|
+
weekStartsOn?: 0 | 1
|
|
48
|
+
/** Height of one hour row, in px. */
|
|
49
|
+
hourHeight?: number
|
|
50
|
+
/** A line across today's column at the current time. */
|
|
51
|
+
nowIndicator?: boolean
|
|
52
|
+
/** Locale for dates and times (Intl). Falls back to the app's configured locale */
|
|
22
53
|
locale?: string
|
|
54
|
+
/** Aria label of the previous button (defaults to the locale string) */
|
|
23
55
|
prevLabel?: string
|
|
56
|
+
/** Aria label of the next button (defaults to the locale string) */
|
|
24
57
|
nextLabel?: string
|
|
58
|
+
/** Label of the Today button (defaults to the locale string) */
|
|
25
59
|
todayLabel?: string
|
|
60
|
+
/** Label of the Day toggle (defaults to the locale string) */
|
|
26
61
|
dayViewLabel?: string
|
|
62
|
+
/** Label of the Week toggle (defaults to the locale string) */
|
|
27
63
|
weekViewLabel?: string
|
|
64
|
+
/** Label of the all-day row (defaults to the locale string) */
|
|
65
|
+
allDayLabel?: string
|
|
28
66
|
}>(),
|
|
29
67
|
{
|
|
30
68
|
events: () => [],
|
|
31
69
|
view: 'week',
|
|
32
70
|
startHour: 7,
|
|
33
71
|
endHour: 22,
|
|
72
|
+
weekStartsOn: 1,
|
|
73
|
+
hourHeight: 56,
|
|
74
|
+
nowIndicator: true,
|
|
34
75
|
},
|
|
35
76
|
)
|
|
36
77
|
|
|
37
78
|
// Falls back to the app's own configured locale (via createM3UI/useLocale) rather than a
|
|
38
|
-
// fixed default, matching the pattern MRelativeTime already uses
|
|
39
|
-
// to a hardcoded 'es-ES' regardless of what locale the app actually provided.
|
|
79
|
+
// fixed default, matching the pattern MRelativeTime already uses.
|
|
40
80
|
const resolvedLocale = computed(() => props.locale ?? locale.lang)
|
|
41
81
|
|
|
42
82
|
const emit = defineEmits<{
|
|
43
83
|
eventClick: [SchedulerEvent]
|
|
44
84
|
slotClick: [{ date: string; hour: number }]
|
|
85
|
+
'update:date': [string]
|
|
86
|
+
'update:view': ['week' | 'day']
|
|
45
87
|
}>()
|
|
46
88
|
|
|
47
|
-
|
|
48
|
-
|
|
89
|
+
defineSlots<{
|
|
90
|
+
/** Content of an event block. */
|
|
91
|
+
event?: (scope: { event: SchedulerEvent; allDay: boolean }) => unknown
|
|
92
|
+
}>()
|
|
49
93
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
)
|
|
94
|
+
// ── Dates ─────────────────────────────────────────────────────────────────────────────────────
|
|
95
|
+
|
|
96
|
+
/** A date-only string is local midnight (`new Date('2026-10-17')` alone would be UTC). */
|
|
97
|
+
function parse(s: string) {
|
|
98
|
+
return /^\d{4}-\d{2}-\d{2}$/.test(s) ? new Date(`${s}T00:00`) : new Date(s)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function fmt(d: Date) {
|
|
102
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function addDays(d: Date, n: number) {
|
|
106
|
+
const out = new Date(d)
|
|
107
|
+
out.setDate(out.getDate() + n)
|
|
108
|
+
return out
|
|
109
|
+
}
|
|
53
110
|
|
|
54
111
|
function startOfWeek(d: Date) {
|
|
55
112
|
const dt = new Date(d)
|
|
56
|
-
const day = dt.getDay()
|
|
57
|
-
const diff = day === 0 ? -6 : 1 - day
|
|
58
|
-
dt.setDate(dt.getDate() + diff)
|
|
59
113
|
dt.setHours(0, 0, 0, 0)
|
|
60
|
-
|
|
114
|
+
const diff = (dt.getDay() - props.weekStartsOn + 7) % 7
|
|
115
|
+
return addDays(dt, -diff)
|
|
61
116
|
}
|
|
62
117
|
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
d.setDate(d.getDate() + i)
|
|
68
|
-
return d
|
|
69
|
-
})
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
const visibleDays = computed(() =>
|
|
73
|
-
currentView.value === 'day' ? [currentDate.value] : weekDays.value,
|
|
74
|
-
)
|
|
118
|
+
const currentDate = ref(props.date ? parse(props.date) : new Date())
|
|
119
|
+
const currentView = ref(props.view)
|
|
120
|
+
watch(() => props.date, (d) => d && fmt(parse(d)) !== fmt(currentDate.value) && (currentDate.value = parse(d)))
|
|
121
|
+
watch(() => props.view, (v) => (currentView.value = v))
|
|
75
122
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
123
|
+
function setDate(d: Date) {
|
|
124
|
+
currentDate.value = d
|
|
125
|
+
emit('update:date', fmt(d))
|
|
126
|
+
}
|
|
80
127
|
|
|
81
|
-
function
|
|
82
|
-
|
|
128
|
+
function setView(v: 'week' | 'day') {
|
|
129
|
+
currentView.value = v
|
|
130
|
+
emit('update:view', v)
|
|
83
131
|
}
|
|
84
132
|
|
|
133
|
+
const visibleDays = computed(() => {
|
|
134
|
+
if (currentView.value === 'day') {
|
|
135
|
+
const d = new Date(currentDate.value)
|
|
136
|
+
d.setHours(0, 0, 0, 0)
|
|
137
|
+
return [d]
|
|
138
|
+
}
|
|
139
|
+
const start = startOfWeek(currentDate.value)
|
|
140
|
+
return Array.from({ length: 7 }, (_, i) => addDays(start, i))
|
|
141
|
+
})
|
|
142
|
+
const visibleKeys = computed(() => visibleDays.value.map(fmt))
|
|
143
|
+
|
|
144
|
+
const now = ref(new Date())
|
|
145
|
+
let nowTimer: ReturnType<typeof setInterval> | null = null
|
|
146
|
+
onMounted(() => (nowTimer = setInterval(() => (now.value = new Date()), 60_000)))
|
|
147
|
+
onBeforeUnmount(() => nowTimer && clearInterval(nowTimer))
|
|
148
|
+
const todayKey = computed(() => fmt(now.value))
|
|
149
|
+
|
|
85
150
|
const dayFormat = computed(() => new Intl.DateTimeFormat(resolvedLocale.value, { weekday: 'short' }))
|
|
86
151
|
const dateFormat = computed(() => new Intl.DateTimeFormat(resolvedLocale.value, { day: 'numeric' }))
|
|
152
|
+
const timeFormat = computed(() => new Intl.DateTimeFormat(resolvedLocale.value, { hour: '2-digit', minute: '2-digit' }))
|
|
87
153
|
|
|
88
154
|
const headerLabel = computed(() => {
|
|
89
155
|
if (currentView.value === 'day') {
|
|
90
156
|
return new Intl.DateTimeFormat(resolvedLocale.value, { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' })
|
|
91
157
|
.format(currentDate.value)
|
|
92
158
|
}
|
|
93
|
-
const start =
|
|
94
|
-
const end =
|
|
159
|
+
const start = visibleDays.value[0]!
|
|
160
|
+
const end = visibleDays.value[6]!
|
|
95
161
|
const f = new Intl.DateTimeFormat(resolvedLocale.value, { day: 'numeric', month: 'short' })
|
|
96
162
|
return `${f.format(start)} – ${f.format(end)}, ${end.getFullYear()}`
|
|
97
163
|
})
|
|
98
164
|
|
|
99
165
|
function navigate(delta: number) {
|
|
100
|
-
|
|
101
|
-
if (currentView.value === 'week') d.setDate(d.getDate() + delta * 7)
|
|
102
|
-
else d.setDate(d.getDate() + delta)
|
|
103
|
-
currentDate.value = d
|
|
166
|
+
setDate(addDays(currentDate.value, delta * (currentView.value === 'week' ? 7 : 1)))
|
|
104
167
|
}
|
|
105
168
|
|
|
106
|
-
function
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return props.events.filter((ev) => {
|
|
111
|
-
const start = new Date(ev.start)
|
|
112
|
-
const end = new Date(ev.end)
|
|
113
|
-
const evDay = fmt(start)
|
|
114
|
-
if (evDay !== dayStr) return false
|
|
115
|
-
const evStartHour = start.getHours()
|
|
116
|
-
const evEndHour = end.getHours() + (end.getMinutes() > 0 ? 1 : 0)
|
|
117
|
-
return hour >= evStartHour && hour < evEndHour
|
|
118
|
-
})
|
|
169
|
+
function openDay(d: Date) {
|
|
170
|
+
if (currentView.value === 'day') return
|
|
171
|
+
setDate(d)
|
|
172
|
+
setView('day')
|
|
119
173
|
}
|
|
120
174
|
|
|
121
|
-
|
|
122
|
-
|
|
175
|
+
// ── Layout ────────────────────────────────────────────────────────────────────────────────────
|
|
176
|
+
|
|
177
|
+
const hours = computed(() => Array.from({ length: props.endHour - props.startHour }, (_, i) => props.startHour + i))
|
|
178
|
+
const gridStyle = computed(() => ({
|
|
179
|
+
gridTemplateColumns: `4rem repeat(${visibleDays.value.length}, ${currentView.value === 'week' ? 'minmax(5.5rem, 1fr)' : 'minmax(0, 1fr)'})`,
|
|
180
|
+
}))
|
|
181
|
+
|
|
182
|
+
/** Everything that doesn't fit in one day's time grid goes to the all-day row. */
|
|
183
|
+
function isBandEvent(ev: SchedulerEvent) {
|
|
184
|
+
if (ev.allDay) return true
|
|
185
|
+
const start = parse(ev.start)
|
|
186
|
+
const lastInstant = new Date(parse(ev.end).getTime() - 1)
|
|
187
|
+
return fmt(start) !== fmt(lastInstant)
|
|
123
188
|
}
|
|
124
189
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
190
|
+
interface Bar { event: SchedulerEvent; from: number; to: number; lane: number; clippedStart: boolean; clippedEnd: boolean }
|
|
191
|
+
|
|
192
|
+
const bars = computed<Bar[]>(() => {
|
|
193
|
+
const keys = visibleKeys.value
|
|
194
|
+
const first = keys[0]!
|
|
195
|
+
const last = keys[keys.length - 1]!
|
|
196
|
+
const placed: Bar[] = []
|
|
197
|
+
const laneEnds: number[] = []
|
|
198
|
+
const candidates = props.events
|
|
199
|
+
.filter(isBandEvent)
|
|
200
|
+
.map((event) => {
|
|
201
|
+
const startKey = fmt(parse(event.start))
|
|
202
|
+
const endKey = event.allDay ? fmt(parse(event.end)) : fmt(new Date(parse(event.end).getTime() - 1))
|
|
203
|
+
return { event, startKey, endKey }
|
|
204
|
+
})
|
|
205
|
+
.filter(({ startKey, endKey }) => endKey >= first && startKey <= last)
|
|
206
|
+
.sort((a, b) => a.startKey.localeCompare(b.startKey) || b.endKey.localeCompare(a.endKey))
|
|
207
|
+
for (const { event, startKey, endKey } of candidates) {
|
|
208
|
+
const from = startKey < first ? 0 : keys.indexOf(startKey)
|
|
209
|
+
const to = endKey > last ? keys.length - 1 : keys.indexOf(endKey)
|
|
210
|
+
let lane = laneEnds.findIndex((end) => end < from)
|
|
211
|
+
if (lane === -1) lane = laneEnds.length
|
|
212
|
+
laneEnds[lane] = to
|
|
213
|
+
placed.push({ event, from, to, lane, clippedStart: startKey < first, clippedEnd: endKey > last })
|
|
214
|
+
}
|
|
215
|
+
return placed
|
|
216
|
+
})
|
|
217
|
+
const laneCount = computed(() => bars.value.reduce((n, b) => Math.max(n, b.lane + 1), 0))
|
|
218
|
+
|
|
219
|
+
interface Block { event: SchedulerEvent; top: number; height: number; column: number; columns: number; minutes: number }
|
|
220
|
+
|
|
221
|
+
/** Timed events of one day, placed in side-by-side columns where they overlap. */
|
|
222
|
+
function blocksFor(day: Date): Block[] {
|
|
223
|
+
const key = fmt(day)
|
|
224
|
+
const lo = props.startHour * 60
|
|
225
|
+
const hi = props.endHour * 60
|
|
226
|
+
const items = props.events
|
|
227
|
+
.filter((ev) => !isBandEvent(ev) && fmt(parse(ev.start)) === key)
|
|
228
|
+
.map((event) => {
|
|
229
|
+
const s = parse(event.start)
|
|
230
|
+
const e = parse(event.end)
|
|
231
|
+
const startMin = s.getHours() * 60 + s.getMinutes()
|
|
232
|
+
const endMin = fmt(e) === key ? e.getHours() * 60 + e.getMinutes() : 24 * 60
|
|
233
|
+
return { event, startMin, endMin: Math.max(endMin, startMin + 15) }
|
|
234
|
+
})
|
|
235
|
+
.filter((it) => it.endMin > lo && it.startMin < hi)
|
|
236
|
+
.sort((a, b) => a.startMin - b.startMin || b.endMin - a.endMin)
|
|
237
|
+
|
|
238
|
+
const blocks: Block[] = []
|
|
239
|
+
let cluster: { item: (typeof items)[number]; column: number }[] = []
|
|
240
|
+
let clusterEnd = -1
|
|
241
|
+
const flush = () => {
|
|
242
|
+
const columns = cluster.reduce((n, c) => Math.max(n, c.column + 1), 0)
|
|
243
|
+
for (const { item, column } of cluster) {
|
|
244
|
+
const top = ((Math.max(item.startMin, lo) - lo) / 60) * props.hourHeight
|
|
245
|
+
const bottom = ((Math.min(item.endMin, hi) - lo) / 60) * props.hourHeight
|
|
246
|
+
blocks.push({ event: item.event, top, height: Math.max(bottom - top, 20), column, columns, minutes: item.endMin - item.startMin })
|
|
247
|
+
}
|
|
248
|
+
cluster = []
|
|
249
|
+
}
|
|
250
|
+
for (const item of items) {
|
|
251
|
+
if (item.startMin >= clusterEnd && cluster.length) flush()
|
|
252
|
+
const taken = new Set(cluster.filter((c) => c.item.endMin > item.startMin).map((c) => c.column))
|
|
253
|
+
let column = 0
|
|
254
|
+
while (taken.has(column)) column++
|
|
255
|
+
cluster.push({ item, column })
|
|
256
|
+
clusterEnd = Math.max(clusterEnd, item.endMin)
|
|
257
|
+
}
|
|
258
|
+
if (cluster.length) flush()
|
|
259
|
+
return blocks
|
|
129
260
|
}
|
|
130
261
|
|
|
262
|
+
const nowTop = computed(() => {
|
|
263
|
+
const min = now.value.getHours() * 60 + now.value.getMinutes()
|
|
264
|
+
if (min < props.startHour * 60 || min >= props.endHour * 60) return null
|
|
265
|
+
return ((min - props.startHour * 60) / 60) * props.hourHeight
|
|
266
|
+
})
|
|
267
|
+
|
|
131
268
|
function timeLabel(ev: SchedulerEvent) {
|
|
132
|
-
|
|
133
|
-
|
|
269
|
+
return `${timeFormat.value.format(parse(ev.start))} – ${timeFormat.value.format(parse(ev.end))}`
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function onColumnClick(e: MouseEvent, day: Date) {
|
|
273
|
+
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect()
|
|
274
|
+
const hour = Math.min(props.startHour + Math.floor((e.clientY - rect.top) / props.hourHeight), props.endHour - 1)
|
|
275
|
+
emit('slotClick', { date: fmt(day), hour: Math.max(hour, props.startHour) })
|
|
134
276
|
}
|
|
135
277
|
|
|
136
278
|
const eventColors: Record<string, string> = {
|
|
@@ -145,14 +287,14 @@ const eventColors: Record<string, string> = {
|
|
|
145
287
|
<template>
|
|
146
288
|
<div class="flex flex-col overflow-hidden rounded-lg border border-outline-variant">
|
|
147
289
|
<!-- Header -->
|
|
148
|
-
<div class="flex items-center justify-between border-b border-outline-variant bg-surface-container px-4 py-3">
|
|
290
|
+
<div class="flex flex-wrap items-center justify-between gap-2 border-b border-outline-variant bg-surface-container px-4 py-3">
|
|
149
291
|
<div class="flex items-center gap-1">
|
|
150
292
|
<MIconButton icon="chevron_left" :label="prevLabel ?? locale.previous" :size="36" @click="navigate(-1)" />
|
|
151
293
|
<MIconButton icon="chevron_right" :label="nextLabel ?? locale.next" :size="36" @click="navigate(1)" />
|
|
152
294
|
<button
|
|
153
295
|
type="button"
|
|
154
296
|
class="ml-2 cursor-pointer rounded-full border border-outline px-3 py-1 text-label-medium text-on-surface transition-colors hover:bg-on-surface/8"
|
|
155
|
-
@click="
|
|
297
|
+
@click="setDate(new Date())"
|
|
156
298
|
>
|
|
157
299
|
{{ todayLabel ?? locale.today }}
|
|
158
300
|
</button>
|
|
@@ -167,71 +309,117 @@ const eventColors: Record<string, string> = {
|
|
|
167
309
|
type="button"
|
|
168
310
|
class="cursor-pointer rounded-full px-3 py-1 text-label-medium transition-all duration-150"
|
|
169
311
|
:class="currentView === v ? 'bg-secondary-container text-on-secondary-container shadow-elevation-1' : 'text-on-surface-variant hover:bg-on-surface/8'"
|
|
170
|
-
@click="
|
|
312
|
+
@click="setView(v)"
|
|
171
313
|
>
|
|
172
314
|
{{ v === 'day' ? (dayViewLabel ?? locale.dayView) : (weekViewLabel ?? locale.weekView) }}
|
|
173
315
|
</button>
|
|
174
316
|
</div>
|
|
175
317
|
</div>
|
|
176
318
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
<table class="w-full border-collapse">
|
|
319
|
+
<div class="min-h-0 flex-1 overflow-auto">
|
|
320
|
+
<div class="min-w-fit">
|
|
180
321
|
<!-- Day headers -->
|
|
181
|
-
<
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
322
|
+
<div class="sticky top-0 z-20 grid border-b border-outline-variant bg-surface-container" :style="gridStyle">
|
|
323
|
+
<div class="border-r border-outline-variant" />
|
|
324
|
+
<button
|
|
325
|
+
v-for="day in visibleDays"
|
|
326
|
+
:key="fmt(day)"
|
|
327
|
+
type="button"
|
|
328
|
+
class="border-r border-outline-variant px-2 py-2 text-center last:border-r-0"
|
|
329
|
+
:class="[fmt(day) === todayKey ? 'bg-primary-container/30' : '', currentView === 'week' ? 'cursor-pointer hover:bg-on-surface/8' : 'cursor-default']"
|
|
330
|
+
:tabindex="currentView === 'week' ? 0 : -1"
|
|
331
|
+
@click="openDay(day)"
|
|
332
|
+
>
|
|
333
|
+
<span class="block text-label-small uppercase text-on-surface-variant">{{ dayFormat.format(day) }}</span>
|
|
334
|
+
<span
|
|
335
|
+
class="mx-auto mt-0.5 flex h-8 w-8 items-center justify-center rounded-full text-title-medium"
|
|
336
|
+
:class="fmt(day) === todayKey ? 'bg-primary font-medium text-on-primary' : 'text-on-surface'"
|
|
337
|
+
>
|
|
338
|
+
{{ dateFormat.format(day) }}
|
|
339
|
+
</span>
|
|
340
|
+
</button>
|
|
341
|
+
</div>
|
|
342
|
+
|
|
343
|
+
<!-- All-day row: all-day events and events spanning several days -->
|
|
344
|
+
<div v-if="laneCount" class="grid border-b border-outline-variant" :style="gridStyle" data-scheduler-all-day>
|
|
345
|
+
<div class="flex items-start justify-end border-r border-outline-variant px-2 py-1.5 text-right text-label-small text-on-surface-variant">
|
|
346
|
+
{{ allDayLabel ?? locale.allDay }}
|
|
347
|
+
</div>
|
|
348
|
+
<div
|
|
349
|
+
class="grid gap-y-1 py-1"
|
|
350
|
+
:style="{ gridColumn: `2 / span ${visibleDays.length}`, gridTemplateColumns: `repeat(${visibleDays.length}, minmax(0, 1fr))`, gridTemplateRows: `repeat(${laneCount}, 1.5rem)` }"
|
|
351
|
+
>
|
|
352
|
+
<button
|
|
353
|
+
v-for="bar in bars"
|
|
354
|
+
:key="bar.event.id"
|
|
355
|
+
type="button"
|
|
356
|
+
class="mx-0.5 flex min-w-0 cursor-pointer items-center overflow-hidden border-l-[3px] px-2 text-left text-label-small font-medium transition-opacity hover:opacity-90"
|
|
357
|
+
:class="[eventColors[bar.event.color ?? 'primary'], bar.clippedStart ? 'rounded-r border-l-0' : 'rounded', bar.clippedEnd ? 'rounded-r-none' : '']"
|
|
358
|
+
:style="{ gridColumn: `${bar.from + 1} / ${bar.to + 2}`, gridRow: bar.lane + 1 }"
|
|
359
|
+
:aria-label="bar.event.title"
|
|
360
|
+
data-scheduler-bar
|
|
361
|
+
@click="emit('eventClick', bar.event)"
|
|
189
362
|
>
|
|
190
|
-
<
|
|
191
|
-
|
|
192
|
-
class="
|
|
193
|
-
|
|
194
|
-
>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
363
|
+
<slot name="event" :event="bar.event" :all-day="true">
|
|
364
|
+
<span v-if="bar.clippedStart" aria-hidden="true" class="mr-1">‹</span>
|
|
365
|
+
<span class="truncate">{{ bar.event.title }}</span>
|
|
366
|
+
<span v-if="bar.clippedEnd" aria-hidden="true" class="ml-auto pl-1">›</span>
|
|
367
|
+
</slot>
|
|
368
|
+
</button>
|
|
369
|
+
</div>
|
|
370
|
+
</div>
|
|
371
|
+
|
|
372
|
+
<!-- Time grid -->
|
|
373
|
+
<div class="grid" :style="gridStyle">
|
|
374
|
+
<div class="border-r border-outline-variant">
|
|
375
|
+
<div v-for="hour in hours" :key="hour" class="relative pr-2 text-right" :style="{ height: `${hourHeight}px` }">
|
|
376
|
+
<span v-if="hour !== startHour" class="relative -top-2 text-label-small text-on-surface-variant">{{ String(hour).padStart(2, '0') }}:00</span>
|
|
377
|
+
</div>
|
|
378
|
+
</div>
|
|
379
|
+
|
|
380
|
+
<div
|
|
381
|
+
v-for="day in visibleDays"
|
|
382
|
+
:key="fmt(day)"
|
|
383
|
+
class="relative cursor-pointer border-r border-outline-variant/50 last:border-r-0"
|
|
384
|
+
:class="fmt(day) === todayKey ? 'bg-primary-container/5' : ''"
|
|
385
|
+
:data-scheduler-day="fmt(day)"
|
|
386
|
+
@click="onColumnClick($event, day)"
|
|
387
|
+
>
|
|
388
|
+
<div v-for="hour in hours" :key="hour" class="border-b border-outline-variant/50" :style="{ height: `${hourHeight}px` }" />
|
|
389
|
+
|
|
390
|
+
<button
|
|
391
|
+
v-for="b in blocksFor(day)"
|
|
392
|
+
:key="b.event.id"
|
|
393
|
+
type="button"
|
|
394
|
+
class="absolute z-5 cursor-pointer overflow-hidden rounded border-l-[3px] px-2 py-1 text-left transition-opacity hover:opacity-90"
|
|
395
|
+
:class="eventColors[b.event.color ?? 'primary']"
|
|
396
|
+
:style="{
|
|
397
|
+
top: `${b.top + 1}px`,
|
|
398
|
+
height: `${b.height - 2}px`,
|
|
399
|
+
left: `calc(${(b.column / b.columns) * 100}% + 2px)`,
|
|
400
|
+
width: `calc(${100 / b.columns}% - 4px)`,
|
|
401
|
+
}"
|
|
402
|
+
:aria-label="`${b.event.title}, ${timeLabel(b.event)}`"
|
|
403
|
+
data-scheduler-event
|
|
404
|
+
@click.stop="emit('eventClick', b.event)"
|
|
217
405
|
>
|
|
218
|
-
<
|
|
219
|
-
<
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
</
|
|
232
|
-
</
|
|
233
|
-
</
|
|
234
|
-
</
|
|
406
|
+
<slot name="event" :event="b.event" :all-day="false">
|
|
407
|
+
<p class="truncate text-label-small font-medium">{{ b.event.title }}</p>
|
|
408
|
+
<p v-if="b.minutes >= 45" class="truncate text-label-small opacity-70">{{ timeLabel(b.event) }}</p>
|
|
409
|
+
</slot>
|
|
410
|
+
</button>
|
|
411
|
+
|
|
412
|
+
<div
|
|
413
|
+
v-if="nowIndicator && fmt(day) === todayKey && nowTop !== null"
|
|
414
|
+
class="pointer-events-none absolute inset-x-0 z-10 h-0.5 bg-error"
|
|
415
|
+
:style="{ top: `${nowTop}px` }"
|
|
416
|
+
data-scheduler-now
|
|
417
|
+
>
|
|
418
|
+
<span class="absolute -top-1 -left-1 h-2.5 w-2.5 rounded-full bg-error" />
|
|
419
|
+
</div>
|
|
420
|
+
</div>
|
|
421
|
+
</div>
|
|
422
|
+
</div>
|
|
235
423
|
</div>
|
|
236
424
|
</div>
|
|
237
425
|
</template>
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A constrained scroll area — vertical, horizontal, or both directions.
|
|
4
|
+
*
|
|
5
|
+
* @slot default The scrolling content.
|
|
6
|
+
*/
|
|
2
7
|
import { computed } from 'vue'
|
|
3
8
|
|
|
4
9
|
const props = withDefaults(
|
|
5
10
|
defineProps<{
|
|
11
|
+
/** Scroll direction */
|
|
6
12
|
direction?: 'vertical' | 'horizontal' | 'both'
|
|
13
|
+
/** Fixed height (CSS value) */
|
|
7
14
|
height?: string
|
|
15
|
+
/** Maximum height (CSS value) */
|
|
8
16
|
maxHeight?: string
|
|
9
17
|
}>(),
|
|
10
18
|
{ direction: 'vertical' },
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A collapsed search field that expands into a docked panel or a fullscreen overlay, with results shown below
|
|
4
|
+
* the input.
|
|
5
|
+
*
|
|
6
|
+
* @slot leading Overrides the collapsed bar's leading icon
|
|
7
|
+
* @slot trailing Trailing content in both the collapsed bar and the expanded header (e.g. an avatar)
|
|
8
|
+
* @slot default Results/suggestions content, shown below the input while expanded
|
|
9
|
+
* @event update:modelValue Emitted on every input change — powers v-model
|
|
10
|
+
* @event search Emitted when Enter is pressed in the input, with the current query
|
|
11
|
+
* @event update:expanded Emitted when the expanded state changes — powers v-model:expanded
|
|
12
|
+
*/
|
|
2
13
|
import { computed, ref, watch, onMounted, onUnmounted, nextTick, useId } from 'vue'
|
|
3
14
|
import MIcon from './MIcon.vue'
|
|
4
15
|
import MIconButton from './MIconButton.vue'
|
|
@@ -11,14 +22,17 @@ defineOptions({ inheritAttrs: false })
|
|
|
11
22
|
|
|
12
23
|
const props = withDefaults(
|
|
13
24
|
defineProps<{
|
|
25
|
+
/** Search query (v-model) */
|
|
14
26
|
modelValue?: string
|
|
15
27
|
/** Controls the expanded/collapsed state — also works uncontrolled if omitted. */
|
|
16
28
|
expanded?: boolean
|
|
29
|
+
/** Defaults to the locale's "Search..." */
|
|
17
30
|
placeholder?: string
|
|
18
31
|
/** 'docked' grows into a rounded panel anchored below the bar (default).
|
|
19
32
|
* 'fullscreen' takes over the whole viewport, matching M3's mobile
|
|
20
33
|
* search pattern — the leading icon becomes a back button either way. */
|
|
21
34
|
variant?: 'docked' | 'fullscreen'
|
|
35
|
+
/** Icon shown in the collapsed bar */
|
|
22
36
|
leadingIcon?: string
|
|
23
37
|
/** Which side of the *collapsed* bar the leading icon sits on. The
|
|
24
38
|
* expanded panel's back button always stays at the start regardless —
|
|
@@ -27,8 +41,11 @@ const props = withDefaults(
|
|
|
27
41
|
/** Centers the input/placeholder text instead of the M3-standard start
|
|
28
42
|
* alignment (an iOS-style look some apps use for the collapsed bar). */
|
|
29
43
|
textAlign?: 'start' | 'center'
|
|
44
|
+
/** Shows a spinner in the expanded header instead of the clear button */
|
|
30
45
|
loading?: boolean
|
|
46
|
+
/** Shows a clear (×) button once there is a query */
|
|
31
47
|
clearable?: boolean
|
|
48
|
+
/** Disables the collapsed bar */
|
|
32
49
|
disabled?: boolean
|
|
33
50
|
}>(),
|
|
34
51
|
{
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A titled content section with optional subtitle, header actions, and divider.
|
|
4
|
+
*
|
|
5
|
+
* @slot title Custom title content (overrides title prop)
|
|
6
|
+
* @slot subtitle Custom subtitle content (overrides subtitle prop)
|
|
7
|
+
* @slot actions Action buttons displayed in the header row
|
|
8
|
+
* @slot default Main section content
|
|
9
|
+
*/
|
|
2
10
|
import { computed } from 'vue'
|
|
3
11
|
import type { TextVariant } from './MText.vue'
|
|
4
12
|
|
|
5
13
|
const props = withDefaults(
|
|
6
14
|
defineProps<{
|
|
15
|
+
/** Section title text */
|
|
7
16
|
title?: string
|
|
17
|
+
/** Section subtitle text */
|
|
8
18
|
subtitle?: string
|
|
19
|
+
/** Show divider below header */
|
|
9
20
|
divider?: boolean
|
|
21
|
+
/** Gap between header and content */
|
|
10
22
|
gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
23
|
+
/** Typography variant for the title */
|
|
11
24
|
titleVariant?: TextVariant
|
|
12
25
|
}>(),
|
|
13
26
|
{ gap: 'md', divider: false, titleVariant: 'title-large' },
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A row of joined segments for choosing between a small set of related options — single or multi select.
|
|
4
|
+
*
|
|
5
|
+
* @event update:modelValue Emitted on selection change — powers v-model
|
|
6
|
+
*/
|
|
2
7
|
import MIcon from './MIcon.vue'
|
|
3
8
|
|
|
4
9
|
export interface SegmentedOption {
|
|
@@ -9,10 +14,15 @@ export interface SegmentedOption {
|
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
withDefaults(defineProps<{
|
|
17
|
+
/** Selected value(s) */
|
|
12
18
|
modelValue: string | number | (string | number)[]
|
|
19
|
+
/** The options to choose from; see `SegmentedOption`. */
|
|
13
20
|
options: SegmentedOption[]
|
|
21
|
+
/** Allow multiple selections */
|
|
14
22
|
multiSelect?: boolean
|
|
23
|
+
/** Button density */
|
|
15
24
|
density?: 'default' | 'comfortable' | 'compact'
|
|
25
|
+
/** Selected segment color */
|
|
16
26
|
color?: 'primary' | 'secondary' | 'tertiary'
|
|
17
27
|
}>(), { multiSelect: false, density: 'default', color: 'primary' })
|
|
18
28
|
|