@m3ui-vue/m3ui-vue 1.10.2 → 1.11.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/README.md +19 -4
- package/dist/API.md +195 -56
- package/dist/MButton-gWoOzFWf.js +284 -0
- package/dist/MButton-gWoOzFWf.js.map +1 -0
- package/dist/MColorPickerModal-CJYMvlgK.js +466 -0
- package/dist/MColorPickerModal-CJYMvlgK.js.map +1 -0
- package/dist/MDialog-CU8EYgCC.js +226 -0
- package/dist/MDialog-CU8EYgCC.js.map +1 -0
- package/dist/{MIcon-BSsJZhK7.js → MIcon-CkUc9kuQ.js} +10 -4
- package/dist/MIcon-CkUc9kuQ.js.map +1 -0
- package/dist/MIconButton-DTFOfsTy.js +317 -0
- package/dist/MIconButton-DTFOfsTy.js.map +1 -0
- package/dist/MListItem-Cdw2FqCT.js +1306 -0
- package/dist/MListItem-Cdw2FqCT.js.map +1 -0
- package/dist/MLoadingIndicator-BxAy2x7P.js +115 -0
- package/dist/MLoadingIndicator-BxAy2x7P.js.map +1 -0
- package/dist/{MMenuItem-US0Zbglq.js → MMenuItem-CEIKYvaX.js} +216 -214
- package/dist/MMenuItem-CEIKYvaX.js.map +1 -0
- package/dist/{MPdfViewer-DL9mRsd2.js → MPdfViewer-CEfyXGq2.js} +674 -671
- package/dist/MPdfViewer-CEfyXGq2.js.map +1 -0
- package/dist/MProgressBar-BzZMxq7M.js.map +1 -1
- package/dist/MSeekBar-B3_D-PwH.js +435 -0
- package/dist/MSeekBar-B3_D-PwH.js.map +1 -0
- package/dist/{MSegmentedButton-DMou-8sG.js → MSegmentedButton-Dg07j-4r.js} +4 -4
- package/dist/{MSegmentedButton-DMou-8sG.js.map → MSegmentedButton-Dg07j-4r.js.map} +1 -1
- package/dist/{MSignaturePad-WuvE_Cyl.js → MSignaturePad-3nddtLKI.js} +2 -2
- package/dist/{MSignaturePad-WuvE_Cyl.js.map → MSignaturePad-3nddtLKI.js.map} +1 -1
- package/dist/{MSlider-7TzhFHKS.js → MSlider-BrpLbqwt.js} +4 -4
- package/dist/{MSlider-7TzhFHKS.js.map → MSlider-BrpLbqwt.js.map} +1 -1
- package/dist/{MSpinner-CkIVBuGE.js → MSpinner-CLwzDH33.js} +2 -2
- package/dist/{MSpinner-CkIVBuGE.js.map → MSpinner-CLwzDH33.js.map} +1 -1
- package/dist/{MTextField-B6_iOczK.js → MTextField-CZRizAwA.js} +136 -134
- package/dist/MTextField-CZRizAwA.js.map +1 -0
- package/dist/{_useFieldValidation-COBJ1tWr.js → _useFieldValidation-DVcqyy9g.js} +2 -2
- package/dist/{_useFieldValidation-COBJ1tWr.js.map → _useFieldValidation-DVcqyy9g.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/code-editor.js +3 -3
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAlert.vue.d.ts +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +3 -3
- package/dist/components/MAvatar.vue.d.ts +19 -1
- package/dist/components/MButton.vue.d.ts +2 -1
- package/dist/components/MChatBubble.vue.d.ts +2 -0
- package/dist/components/MCheckbox.vue.d.ts +2 -0
- package/dist/components/MDataTable.vue.d.ts +31 -3
- package/dist/components/MFlow.vue.d.ts +1 -1
- package/dist/components/MHotkeys.vue.d.ts +1 -0
- package/dist/components/MIcon.vue.d.ts +6 -0
- package/dist/components/MIconButton.vue.d.ts +5 -0
- package/dist/components/MKanban.vue.d.ts +1 -1
- package/dist/components/MLink.vue.d.ts +59 -0
- package/dist/components/MListItem.vue.d.ts +3 -1
- package/dist/components/MMapControl.vue.d.ts +1 -1
- package/dist/components/MNotificationCenter.vue.d.ts +1 -1
- package/dist/components/MNumberField.vue.d.ts +1 -1
- package/dist/components/MPagination.vue.d.ts +14 -1
- package/dist/components/MPdfSigner.vue.d.ts +2 -2
- package/dist/components/MRadio.vue.d.ts +2 -0
- package/dist/components/MRadioGroup.vue.d.ts +2 -0
- package/dist/components/MStatCard.vue.d.ts +2 -2
- package/dist/components/MSwitch.vue.d.ts +2 -0
- package/dist/components/MText.vue.d.ts +4 -2
- package/dist/components/MTextField.vue.d.ts +2 -0
- package/dist/components/_MDrawerItemList.vue.d.ts +6 -0
- package/dist/composables/_menuGroups.d.ts +10 -1
- package/dist/composables/_splitAttrs.d.ts +6 -0
- package/dist/composables/_springAnimation.d.ts +2 -2
- package/dist/composables/_useFocusTrap.d.ts +15 -0
- package/dist/composables/_usePaneResize.d.ts +1 -1
- package/dist/composables/_useSpring.d.ts +4 -4
- package/dist/composables/dynamicColor.d.ts +9 -1
- package/dist/composables/motion.d.ts +63 -0
- package/dist/composables/useConfirm.d.ts +28 -0
- package/dist/composables/useDevice.d.ts +8 -1
- package/dist/composables/useLocale.d.ts +14 -0
- package/dist/composables/useScrollReveal.d.ts +1 -1
- package/dist/composables/useTheme.d.ts +1 -0
- package/dist/composables/useToast.d.ts +7 -0
- package/dist/draw.js +556 -556
- package/dist/draw.js.map +1 -1
- package/dist/flow.js +854 -851
- package/dist/flow.js.map +1 -1
- package/dist/gantt.js +1118 -1096
- package/dist/gantt.js.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/locales/index.d.ts +1 -0
- package/dist/locales/index.js +833 -1
- package/dist/locales/index.js.map +1 -1
- package/dist/locales/pl.d.ts +2 -0
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +10327 -9796
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +860 -860
- package/dist/map.js.map +1 -1
- package/dist/{material-color-utilities-CEFytLsr.js → material-color-utilities-BZsBNIhi.js} +276 -217
- package/dist/material-color-utilities-BZsBNIhi.js.map +1 -0
- package/dist/media.js +7 -7
- package/dist/{motion-BcejVTeX.js → motion-BqYcqcim.js} +15 -5
- package/dist/motion-BqYcqcim.js.map +1 -0
- package/dist/pdf-sign.js +140 -137
- package/dist/pdf-sign.js.map +1 -1
- package/dist/pdf.js +1 -1
- package/dist/plugin.d.ts +11 -0
- package/dist/rich-text-editor.js +7 -7
- package/dist/styles/theme.css +40 -0
- package/dist/styles.css +1 -1
- package/dist/terminal.js +1 -1
- package/dist/{useLocale-YRaOT12S.js → useLocale-BjcYauXr.js} +60 -4
- package/dist/useLocale-BjcYauXr.js.map +1 -0
- package/dist/{useThemeTokens-DyAdPQB0.js → useThemeTokens-D5nr5KHf.js} +28 -27
- package/dist/useThemeTokens-D5nr5KHf.js.map +1 -0
- package/package.json +17 -2
- package/src/__tests__/MAvatarImage.test.ts +37 -0
- package/src/__tests__/MDataTableControlled.test.ts +68 -0
- package/src/__tests__/MHotkeysSequence.test.ts +53 -0
- package/src/__tests__/MIconAxes.test.ts +16 -0
- package/src/__tests__/MIconButtonWidth.test.ts +22 -0
- package/src/__tests__/MLink.test.ts +46 -0
- package/src/__tests__/MPaginationPages.test.ts +43 -0
- package/src/__tests__/MTextEmphasized.test.ts +14 -0
- package/src/__tests__/controlDescription.test.ts +34 -0
- package/src/__tests__/customColor.test.ts +27 -0
- package/src/__tests__/dynamicColor.test.ts +3 -2
- package/src/__tests__/focusTrap.test.ts +124 -0
- package/src/__tests__/formatMessage.test.ts +20 -0
- package/src/__tests__/inputAttrs.test.ts +103 -0
- package/src/__tests__/localePresets.test.ts +2 -0
- package/src/__tests__/menuGroupsRemount.test.ts +40 -0
- package/src/__tests__/menuHydration.test.ts +41 -0
- package/src/__tests__/motionPrefs.test.ts +28 -0
- package/src/__tests__/ssr.test.ts +11 -0
- package/src/__tests__/ssrToast.test.ts +20 -0
- package/src/__tests__/toastDetails.test.ts +39 -0
- package/src/__tests__/useConfirm.test.ts +47 -0
- package/src/__tests__/useTheme.test.ts +14 -0
- package/src/__tests__/warningRole.test.ts +22 -0
- package/src/components/MAlert.vue +2 -2
- package/src/components/MAnimatedNumber.vue +9 -3
- package/src/components/MAutocomplete.vue +16 -4
- package/src/components/MAvailabilityCalendar.vue +3 -3
- package/src/components/MAvatar.vue +32 -5
- package/src/components/MAvatarGroup.vue +7 -2
- package/src/components/MBottomSheet.vue +18 -2
- package/src/components/MButton.vue +18 -5
- package/src/components/MCarousel.vue +3 -3
- package/src/components/MChatBubble.vue +14 -1
- package/src/components/MCheckbox.vue +21 -4
- package/src/components/MChip.vue +4 -2
- package/src/components/MCollapse.vue +7 -1
- package/src/components/MCommandPalette.vue +6 -2
- package/src/components/MContextMenu.vue +4 -4
- package/src/components/MCreditCardInput.vue +5 -0
- package/src/components/MDashboardGrid.vue +2 -1
- package/src/components/MDataTable.vue +63 -16
- package/src/components/MDialog.vue +21 -3
- package/src/components/MDiffViewer.vue +3 -3
- package/src/components/MDrawLayers.vue +3 -3
- package/src/components/MFabMenu.vue +7 -0
- package/src/components/MFloorPlan.vue +3 -3
- package/src/components/MFloorPlanInspector.vue +3 -3
- package/src/components/MFlow.vue +9 -5
- package/src/components/MFlowControls.vue +6 -0
- package/src/components/MFormBuilder.vue +1 -1
- package/src/components/MGantt.vue +10 -10
- package/src/components/MHotkeys.vue +61 -16
- package/src/components/MIcon.vue +17 -1
- package/src/components/MIconButton.vue +29 -6
- package/src/components/MImageCropper.vue +1 -1
- package/src/components/MKanban.vue +2 -1
- package/src/components/MLightbox.vue +5 -4
- package/src/components/MLink.vue +136 -0
- package/src/components/MListDetail.vue +7 -0
- package/src/components/MListItem.vue +7 -4
- package/src/components/MLoadingIndicator.vue +2 -1
- package/src/components/MMap.vue +3 -0
- package/src/components/MMapCluster.vue +2 -2
- package/src/components/MMapControl.vue +2 -2
- package/src/components/MMapMeasure.vue +1 -1
- package/src/components/MMaskField.vue +16 -3
- package/src/components/MMenu.vue +4 -4
- package/src/components/MMenuItem.vue +2 -2
- package/src/components/MMeterGroup.vue +3 -2
- package/src/components/MMortgageCalculator.vue +3 -3
- package/src/components/MMultiAutocomplete.vue +19 -7
- package/src/components/MMultiSelect.vue +19 -7
- package/src/components/MNavigationDrawer.vue +10 -3
- package/src/components/MNavigationRail.vue +5 -1
- package/src/components/MNotificationCenter.vue +2 -1
- package/src/components/MNotificationHost.vue +3 -3
- package/src/components/MNumberField.vue +23 -6
- package/src/components/MOdontogram.vue +4 -4
- package/src/components/MOrderBook.vue +4 -0
- package/src/components/MPagination.vue +91 -12
- package/src/components/MPdfSigner.vue +3 -3
- package/src/components/MPdfViewer.vue +7 -7
- package/src/components/MPhoneInput.vue +17 -4
- package/src/components/MProductConfigurator.vue +4 -4
- package/src/components/MProgressBar.vue +5 -0
- package/src/components/MQuiz.vue +8 -5
- package/src/components/MRadio.vue +24 -5
- package/src/components/MRadioGroup.vue +3 -0
- package/src/components/MReactions.vue +2 -2
- package/src/components/MResourceTimeline.vue +3 -3
- package/src/components/MResult.vue +1 -1
- package/src/components/MScrollField.vue +1 -1
- package/src/components/MSearchField.vue +6 -5
- package/src/components/MSeatMap.vue +5 -0
- package/src/components/MSeekBar.vue +3 -2
- package/src/components/MSelect.vue +16 -4
- package/src/components/MSideSheet.vue +25 -3
- package/src/components/MSimpleCarousel.vue +2 -2
- package/src/components/MSnackbar.vue +16 -13
- package/src/components/MSparkline.vue +2 -1
- package/src/components/MSpinner.vue +8 -0
- package/src/components/MSplitter.vue +1 -1
- package/src/components/MSpotlightSearch.vue +6 -2
- package/src/components/MSpreadsheet.vue +1 -1
- package/src/components/MStatCard.vue +2 -1
- package/src/components/MSwitch.vue +21 -4
- package/src/components/MTabs.vue +2 -1
- package/src/components/MTagInput.vue +19 -6
- package/src/components/MText.vue +23 -4
- package/src/components/MTextField.vue +25 -6
- package/src/components/MTimeline.vue +5 -5
- package/src/components/MToolbar.vue +2 -2
- package/src/components/MTour.vue +3 -0
- package/src/components/MTrackingTimeline.vue +6 -0
- package/src/components/MTypewriter.vue +7 -1
- package/src/components/MWindow.vue +10 -1
- package/src/components/_MColorPanel.vue +4 -4
- package/src/components/_MComment.vue +3 -2
- package/src/components/_MFlowNodeShell.vue +1 -1
- package/src/components/_MPdfPage.vue +1 -1
- package/src/components/_MTransferPane.vue +10 -0
- package/src/composables/_effectCanvas.ts +2 -1
- package/src/composables/_menuGroups.ts +10 -1
- package/src/composables/_splitAttrs.ts +29 -0
- package/src/composables/_springAnimation.ts +3 -3
- package/src/composables/_themeTransition.ts +3 -2
- package/src/composables/_useFocusTrap.ts +142 -0
- package/src/composables/_useMenuNav.ts +3 -3
- package/src/composables/_usePaneResize.ts +2 -1
- package/src/composables/_useSheetMotion.ts +3 -4
- package/src/composables/_useSpring.ts +16 -10
- package/src/composables/cron.ts +7 -6
- package/src/composables/dynamicColor.ts +21 -2
- package/src/composables/motion.ts +27 -0
- package/src/composables/useConfirm.ts +116 -0
- package/src/composables/useDevice.ts +23 -3
- package/src/composables/useFieldBg.ts +4 -0
- package/src/composables/useLocale.ts +74 -0
- package/src/composables/useNotification.ts +3 -0
- package/src/composables/useScrollReveal.ts +3 -3
- package/src/composables/useTheme.ts +8 -2
- package/src/composables/useToast.ts +27 -4
- package/src/directives/vSparkle.ts +2 -1
- package/src/index.ts +8 -5
- package/src/locales/ar.ts +7 -0
- package/src/locales/de.ts +7 -0
- package/src/locales/es.ts +7 -0
- package/src/locales/fr.ts +7 -0
- package/src/locales/index.ts +1 -0
- package/src/locales/ja.ts +7 -0
- package/src/locales/ko.ts +7 -0
- package/src/locales/pl.ts +807 -0
- package/src/locales/pt.ts +7 -0
- package/src/locales/zh.ts +7 -0
- package/src/plugin.ts +16 -0
- package/src/styles/theme.css +40 -0
- package/dist/MButton-B9RCM06i.js +0 -171
- package/dist/MButton-B9RCM06i.js.map +0 -1
- package/dist/MColorPickerModal-ChRtcZOo.js +0 -577
- package/dist/MColorPickerModal-ChRtcZOo.js.map +0 -1
- package/dist/MDialog-dk07tify.js +0 -167
- package/dist/MDialog-dk07tify.js.map +0 -1
- package/dist/MIcon-BSsJZhK7.js.map +0 -1
- package/dist/MIconButton-CrBPZidd.js +0 -288
- package/dist/MIconButton-CrBPZidd.js.map +0 -1
- package/dist/MListItem-h9H223vx.js +0 -1239
- package/dist/MListItem-h9H223vx.js.map +0 -1
- package/dist/MLoadingIndicator-YTV1Ov5w.js +0 -114
- package/dist/MLoadingIndicator-YTV1Ov5w.js.map +0 -1
- package/dist/MMenuItem-US0Zbglq.js.map +0 -1
- package/dist/MPdfViewer-DL9mRsd2.js.map +0 -1
- package/dist/MSeekBar-JFZcoJ8y.js +0 -434
- package/dist/MSeekBar-JFZcoJ8y.js.map +0 -1
- package/dist/MTextField-B6_iOczK.js.map +0 -1
- package/dist/material-color-utilities-CEFytLsr.js.map +0 -1
- package/dist/motion-BcejVTeX.js.map +0 -1
- package/dist/useLocale-YRaOT12S.js.map +0 -1
- package/dist/useThemeTokens-DyAdPQB0.js.map +0 -1
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* @event update:modelValue The layout changed (moved, resized)
|
|
11
11
|
*/
|
|
12
12
|
import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
|
|
13
|
+
import { shouldReduceMotion } from '../composables/motion'
|
|
13
14
|
import MIcon from './MIcon.vue'
|
|
14
15
|
import { useLocale } from '../composables/useLocale'
|
|
15
16
|
import { moveItem, normalizeLayout, layoutRows, type DashboardItem } from '../composables/dashboardLayout'
|
|
@@ -133,7 +134,7 @@ function snap() {
|
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
const reduced = () =>
|
|
137
|
+
const reduced = () => shouldReduceMotion()
|
|
137
138
|
|
|
138
139
|
watch(shown, (items) => {
|
|
139
140
|
for (const item of items) if (!springs.has(item.id)) springs.set(item.id, { ...target(item), vx: 0, vy: 0, vw: 0, vh: 0 })
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
* @event rowClick Emitted with the row's data when you click a row (unless `selectOnRowClick` makes the click
|
|
13
13
|
* select it).
|
|
14
14
|
* @event fetch Emitted instead of filtering locally when serverSide is true
|
|
15
|
+
* @event update:sort Emitted when a header click changes the sort — powers v-model:sort
|
|
16
|
+
* @event update:expanded Emitted with the open rows' keys when one is toggled — powers v-model:expanded
|
|
17
|
+
* @event update:hiddenColumns Emitted when the column menu hides or shows one — powers v-model:hidden-columns
|
|
15
18
|
*/
|
|
16
19
|
import { computed, ref, useSlots, watch, onMounted } from 'vue'
|
|
17
20
|
import MCheckbox from './MCheckbox.vue'
|
|
@@ -33,9 +36,13 @@ export interface DataTableColumn {
|
|
|
33
36
|
minWidth?: string
|
|
34
37
|
align?: 'left' | 'center' | 'right'
|
|
35
38
|
pinned?: 'left' | 'right'
|
|
39
|
+
/** Starts hidden; the column menu (`columnToggle`) can show it */
|
|
36
40
|
hidden?: boolean
|
|
37
41
|
}
|
|
38
42
|
|
|
43
|
+
/** The table's sort: a column key and its direction, or `null` for the rows' own order */
|
|
44
|
+
export type DataTableSort = { key: string; dir: 'asc' | 'desc' } | null
|
|
45
|
+
|
|
39
46
|
export interface DataTableGroup {
|
|
40
47
|
key: string
|
|
41
48
|
label: string
|
|
@@ -52,8 +59,24 @@ const props = withDefaults(defineProps<{
|
|
|
52
59
|
loading?: boolean
|
|
53
60
|
/** Text when no rows (defaults to the locale string) */
|
|
54
61
|
emptyText?: string
|
|
55
|
-
/** Unique key field
|
|
56
|
-
rowKey?: string
|
|
62
|
+
/** Unique key of each row: a field name, or a function of the row (e.g. a composite key) */
|
|
63
|
+
rowKey?: string | ((row: Record<string, any>) => string | number)
|
|
64
|
+
/** Classes for a row: a string for every row, or a function of the row and its index on the page */
|
|
65
|
+
rowClass?: string | ((row: Record<string, any>, index: number) => string | string[] | Record<string, boolean> | undefined)
|
|
66
|
+
/** The table's caption, for screen readers (visually hidden): what the table lists */
|
|
67
|
+
caption?: string
|
|
68
|
+
/**
|
|
69
|
+
* The sort (v-model:sort): pass it to control or persist it (URL, storage), leave it out and the table keeps its
|
|
70
|
+
* own
|
|
71
|
+
*/
|
|
72
|
+
sort?: DataTableSort
|
|
73
|
+
/** Keys of the expanded rows (v-model:expanded); the table keeps its own when left out */
|
|
74
|
+
expanded?: (string | number)[]
|
|
75
|
+
/**
|
|
76
|
+
* Keys of the hidden columns (v-model:hidden-columns), the ones unchecked in the column menu. Left out, the table
|
|
77
|
+
* keeps its own, starting from the columns marked `hidden`
|
|
78
|
+
*/
|
|
79
|
+
hiddenColumns?: string[]
|
|
57
80
|
/**
|
|
58
81
|
* Enable row selection with checkboxes (by default only the checkbox toggles a row; clicking the row itself
|
|
59
82
|
* still emits row-click)
|
|
@@ -156,6 +179,9 @@ const emit = defineEmits<{
|
|
|
156
179
|
'update:page': [number]
|
|
157
180
|
rowClick: [Record<string, any>]
|
|
158
181
|
fetch: [DataTableFetchParams]
|
|
182
|
+
'update:sort': [DataTableSort]
|
|
183
|
+
'update:expanded': [(string | number)[]]
|
|
184
|
+
'update:hiddenColumns': [string[]]
|
|
159
185
|
}>()
|
|
160
186
|
|
|
161
187
|
const slots = useSlots()
|
|
@@ -171,22 +197,38 @@ function hasActions() { return !!slots['row-actions'] }
|
|
|
171
197
|
function hasExpand() { return props.expandable && !!slots['row-expand'] }
|
|
172
198
|
|
|
173
199
|
const search = ref('')
|
|
174
|
-
|
|
175
|
-
const
|
|
200
|
+
// Sort, expanded rows and hidden columns are controlled when their prop is passed (v-model:*), internal otherwise
|
|
201
|
+
const localSort = ref<DataTableSort>(null)
|
|
202
|
+
const sortState = computed(() => (props.sort !== undefined ? props.sort : localSort.value))
|
|
203
|
+
const sortKey = computed(() => sortState.value?.key ?? '')
|
|
204
|
+
const sortDir = computed<'asc' | 'desc' | ''>(() => sortState.value?.dir ?? '')
|
|
205
|
+
function setSort(v: DataTableSort) {
|
|
206
|
+
localSort.value = v
|
|
207
|
+
emit('update:sort', v)
|
|
208
|
+
}
|
|
176
209
|
const internalPage = ref(1)
|
|
177
|
-
const
|
|
178
|
-
const
|
|
210
|
+
const localExpanded = ref<(string | number)[]>([])
|
|
211
|
+
const expanded = computed(() => new Set(props.expanded ?? localExpanded.value))
|
|
212
|
+
// A column's own `hidden` is where it starts: the column menu can show it again
|
|
213
|
+
const localHidden = ref<string[]>(props.columns.filter((c) => c.hidden).map((c) => c.key))
|
|
214
|
+
const hiddenCols = computed(() => new Set(props.hiddenColumns ?? localHidden.value))
|
|
215
|
+
function toggleColumn(key: string) {
|
|
216
|
+
const list = [...hiddenCols.value]
|
|
217
|
+
const next = hiddenCols.value.has(key) ? list.filter((k) => k !== key) : [...list, key]
|
|
218
|
+
localHidden.value = next
|
|
219
|
+
emit('update:hiddenColumns', next)
|
|
220
|
+
}
|
|
179
221
|
const colWidths = ref<Record<string, number>>({})
|
|
180
222
|
const showColMenu = ref(false)
|
|
181
223
|
|
|
182
224
|
const visibleColumns = computed(() =>
|
|
183
|
-
props.columns.filter(c => !
|
|
225
|
+
props.columns.filter(c => !hiddenCols.value.has(c.key))
|
|
184
226
|
)
|
|
185
227
|
|
|
186
228
|
function toggleSort(key: string) {
|
|
187
|
-
if (sortKey.value !== key) {
|
|
188
|
-
else if (sortDir.value === 'asc')
|
|
189
|
-
else
|
|
229
|
+
if (sortKey.value !== key) setSort({ key, dir: 'asc' })
|
|
230
|
+
else if (sortDir.value === 'asc') setSort({ key, dir: 'desc' })
|
|
231
|
+
else setSort(null)
|
|
190
232
|
}
|
|
191
233
|
|
|
192
234
|
const currentPage = computed({
|
|
@@ -272,7 +314,9 @@ const selected = computed({
|
|
|
272
314
|
get: () => props.modelValue ?? [],
|
|
273
315
|
set: (val) => emit('update:modelValue', val),
|
|
274
316
|
})
|
|
275
|
-
function rowId(row: Record<string, any>) {
|
|
317
|
+
function rowId(row: Record<string, any>) {
|
|
318
|
+
return typeof props.rowKey === 'function' ? props.rowKey(row) : row[props.rowKey]
|
|
319
|
+
}
|
|
276
320
|
function isSelected(row: Record<string, any>) { return selected.value.some(r => rowId(r) === rowId(row)) }
|
|
277
321
|
const revealOnHover = computed(() => props.selectable && props.checkboxes === 'hover' && selected.value.length === 0)
|
|
278
322
|
// Hidden until the row (or the header row) is hovered or holds the focus; always there without hover
|
|
@@ -290,9 +334,10 @@ function toggleAll() {
|
|
|
290
334
|
|
|
291
335
|
function toggleExpand(row: Record<string, any>) {
|
|
292
336
|
const id = rowId(row)
|
|
293
|
-
const
|
|
294
|
-
next.has(id) ?
|
|
295
|
-
|
|
337
|
+
const list = [...expanded.value]
|
|
338
|
+
const next = expanded.value.has(id) ? list.filter((k) => k !== id) : [...list, id]
|
|
339
|
+
localExpanded.value = next
|
|
340
|
+
emit('update:expanded', next)
|
|
296
341
|
}
|
|
297
342
|
function isExpanded(row: Record<string, any>) { return expanded.value.has(rowId(row)) }
|
|
298
343
|
|
|
@@ -441,7 +486,7 @@ function colStyle(col: DataTableColumn) {
|
|
|
441
486
|
<label v-for="col in columns" :key="col.key" class="flex cursor-pointer items-center gap-2 px-3 py-1.5 hover:bg-on-surface/4">
|
|
442
487
|
<MCheckbox
|
|
443
488
|
:model-value="!hiddenCols.has(col.key)"
|
|
444
|
-
@update:model-value="
|
|
489
|
+
@update:model-value="toggleColumn(col.key)"
|
|
445
490
|
/>
|
|
446
491
|
<span class="text-body-small text-on-surface">{{ col.label }}</span>
|
|
447
492
|
</label>
|
|
@@ -454,6 +499,7 @@ function colStyle(col: DataTableColumn) {
|
|
|
454
499
|
<!-- Table -->
|
|
455
500
|
<div class="overflow-x-auto" :style="{ minHeight }">
|
|
456
501
|
<table class="w-full border-collapse">
|
|
502
|
+
<caption v-if="caption" class="sr-only">{{ caption }}</caption>
|
|
457
503
|
<thead :class="stickyHeader ? 'sticky top-0 z-1' : ''">
|
|
458
504
|
<tr class="group/row bg-surface-container-high">
|
|
459
505
|
<th v-if="hasExpand()" class="w-10 px-2" :class="dense ? 'py-2' : 'py-3'" />
|
|
@@ -527,9 +573,10 @@ function colStyle(col: DataTableColumn) {
|
|
|
527
573
|
|
|
528
574
|
<!-- Data rows -->
|
|
529
575
|
<template v-else>
|
|
530
|
-
<template v-for="row in visibleRows" :key="rowId(row)">
|
|
576
|
+
<template v-for="(row, ri) in visibleRows" :key="rowId(row)">
|
|
531
577
|
<tr
|
|
532
578
|
:class="[
|
|
579
|
+
typeof rowClass === 'function' ? rowClass(row, ri) : rowClass,
|
|
533
580
|
'group/row border-t border-outline-variant transition-colors duration-100',
|
|
534
581
|
'hover:bg-on-surface/4',
|
|
535
582
|
selectable && isSelected(row) ? 'bg-primary/6' : '',
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
/**
|
|
3
|
-
* The generic M3 modal shell — Escape, scroll lock, and Teleport are handled internally. Supports a centered
|
|
3
|
+
* The generic M3 modal shell — Escape, scroll lock, focus and Teleport are handled internally. Supports a centered
|
|
4
4
|
* card, a full-screen variant, and an optional icon that centers the title per spec.
|
|
5
5
|
*
|
|
6
|
+
* Focus follows the ARIA dialog pattern: on open it moves to an element with `autofocus` (or `data-autofocus`), else
|
|
7
|
+
* the first control that isn't the close button; Tab and Shift+Tab stay inside; closing returns focus to the
|
|
8
|
+
* element that opened it.
|
|
9
|
+
*
|
|
6
10
|
* @slot icon M3 AlertDialog's optional icon (Secondary color, 24dp expected). Its presence also centers the
|
|
7
11
|
* title, per spec.
|
|
8
12
|
* @slot title Overrides the title prop with custom markup
|
|
@@ -16,6 +20,7 @@ import MIconButton from './MIconButton.vue'
|
|
|
16
20
|
import { useLocale } from '../composables/useLocale'
|
|
17
21
|
import { useScrollLock } from '../composables/_useScrollLock'
|
|
18
22
|
import { useEscapeStack } from '../composables/_useEscapeStack'
|
|
23
|
+
import { focusableIn, useFocusTrap } from '../composables/_useFocusTrap'
|
|
19
24
|
|
|
20
25
|
const props = withDefaults(
|
|
21
26
|
defineProps<{
|
|
@@ -109,6 +114,17 @@ useEscapeStack(() => props.modelValue, close)
|
|
|
109
114
|
|
|
110
115
|
const titleId = `m3-dialog-${useId()}`
|
|
111
116
|
|
|
117
|
+
// Focus moves into the dialog when it opens (an `autofocus` element, else the first control that isn't the close
|
|
118
|
+
// button, else the close button, else the surface), Tab stays inside, and closing returns focus to the opener
|
|
119
|
+
const surfaceEl = ref<HTMLElement>()
|
|
120
|
+
useFocusTrap(() => surfaceEl.value, () => props.modelValue, {
|
|
121
|
+
initialFocus: () => {
|
|
122
|
+
const root = surfaceEl.value
|
|
123
|
+
if (!root) return null
|
|
124
|
+
return root.querySelector<HTMLElement>('[autofocus], [data-autofocus]') ?? focusableIn(root).find((el) => !el.closest('[data-dialog-close]'))
|
|
125
|
+
},
|
|
126
|
+
})
|
|
127
|
+
|
|
112
128
|
watch(
|
|
113
129
|
() => props.modelValue,
|
|
114
130
|
async (open) => {
|
|
@@ -149,6 +165,7 @@ onUnmounted(() => {
|
|
|
149
165
|
@click.self="close"
|
|
150
166
|
>
|
|
151
167
|
<div
|
|
168
|
+
ref="surfaceEl"
|
|
152
169
|
v-bind="$attrs"
|
|
153
170
|
class="dialog-box m3-dialog-surface flex min-w-[280px] w-full flex-col"
|
|
154
171
|
:class="sizeClasses"
|
|
@@ -183,7 +200,7 @@ onUnmounted(() => {
|
|
|
183
200
|
can silently lose to that internal `relative` instead of overriding it.
|
|
184
201
|
-->
|
|
185
202
|
<div v-if="closable && !persistent" class="absolute end-4 top-4">
|
|
186
|
-
<MIconButton icon="close" :label="closeLabel ?? locale.close" @click="close" />
|
|
203
|
+
<MIconButton icon="close" :label="closeLabel ?? locale.close" data-dialog-close @click="close" />
|
|
187
204
|
</div>
|
|
188
205
|
<!--
|
|
189
206
|
Icon slot: M3 AlertDialog's optional `icon` param (IconColor=Secondary,
|
|
@@ -231,6 +248,7 @@ onUnmounted(() => {
|
|
|
231
248
|
<Transition v-else name="m3-dialog-fs" appear>
|
|
232
249
|
<div
|
|
233
250
|
v-if="modelValue"
|
|
251
|
+
ref="surfaceEl"
|
|
234
252
|
v-bind="$attrs"
|
|
235
253
|
class="dialog-fs m3-dialog-fs-surface fixed inset-0 z-50 flex flex-col"
|
|
236
254
|
role="dialog"
|
|
@@ -243,7 +261,7 @@ onUnmounted(() => {
|
|
|
243
261
|
<slot />
|
|
244
262
|
</div>
|
|
245
263
|
<div v-else class="flex h-14 shrink-0 items-center gap-2 px-2">
|
|
246
|
-
<MIconButton v-if="!persistent" icon="close" :label="closeLabel ?? locale.close" @click="close" />
|
|
264
|
+
<MIconButton v-if="!persistent" icon="close" :label="closeLabel ?? locale.close" data-dialog-close @click="close" />
|
|
247
265
|
<h2 :id="titleId" class="flex-1 text-title-large font-medium text-on-surface">
|
|
248
266
|
<slot name="title">{{ title }}</slot>
|
|
249
267
|
</h2>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
13
13
|
import MSegmentedButton from './MSegmentedButton.vue'
|
|
14
|
-
import { useLocale } from '../composables/useLocale'
|
|
14
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
15
15
|
import { diffLines, diffStats, diffWords, type DiffLine, type DiffPart } from '../composables/textDiff'
|
|
16
16
|
|
|
17
17
|
const props = withDefaults(
|
|
@@ -178,7 +178,7 @@ const modeOptions = computed(() => [
|
|
|
178
178
|
<tr v-if="r.kind === 'fold'">
|
|
179
179
|
<td :colspan="lineNumbers ? 4 : 2" class="p-0">
|
|
180
180
|
<button type="button" class="w-full cursor-pointer bg-surface-container px-4 py-1 text-left font-sans text-label-medium text-primary hover:bg-surface-container-high" @click="unfold(r.id)">
|
|
181
|
-
⋯ {{ t.diffUnchanged
|
|
181
|
+
⋯ {{ formatMessage(t.diffUnchanged, { n: String(r.count) }, t.lang) }}
|
|
182
182
|
</button>
|
|
183
183
|
</td>
|
|
184
184
|
</tr>
|
|
@@ -210,7 +210,7 @@ const modeOptions = computed(() => [
|
|
|
210
210
|
<tr v-if="r.kind === 'fold'">
|
|
211
211
|
<td :colspan="lineNumbers ? 4 : 2" class="p-0">
|
|
212
212
|
<button type="button" class="w-full cursor-pointer bg-surface-container px-4 py-1 text-left font-sans text-label-medium text-primary hover:bg-surface-container-high" @click="unfold(r.id)">
|
|
213
|
-
⋯ {{ t.diffUnchanged
|
|
213
|
+
⋯ {{ formatMessage(t.diffUnchanged, { n: String(r.count) }, t.lang) }}
|
|
214
214
|
</button>
|
|
215
215
|
</td>
|
|
216
216
|
</tr>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { computed, inject, nextTick, ref } from 'vue'
|
|
8
8
|
import { DRAW_KEY } from '../composables/useDrawing'
|
|
9
9
|
import { drawId, type DrawLayer } from '../composables/drawGeometry'
|
|
10
|
-
import { useLocale } from '../composables/useLocale'
|
|
10
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
11
11
|
import MIconButton from './MIconButton.vue'
|
|
12
12
|
import MTooltip from './MTooltip.vue'
|
|
13
13
|
|
|
@@ -17,12 +17,12 @@ const d = draw
|
|
|
17
17
|
const locale = useLocale()
|
|
18
18
|
|
|
19
19
|
// Without layers the canvas has one implicit layer: the first edit here makes it real
|
|
20
|
-
const list = computed<DrawLayer[]>(() => (d.layers.value.length ? d.layers.value : [{ id: 'layer-1', name: locale.drawLayer
|
|
20
|
+
const list = computed<DrawLayer[]>(() => (d.layers.value.length ? d.layers.value : [{ id: 'layer-1', name: formatMessage(locale.drawLayer, { n: '1' }, locale.lang) }]))
|
|
21
21
|
const shown = computed(() => list.value.slice().reverse())
|
|
22
22
|
const set = (next: DrawLayer[]) => d.setLayers(next)
|
|
23
23
|
const patch = (id: string, p: Partial<DrawLayer>) => set(list.value.map((l) => (l.id === id ? { ...l, ...p } : l)))
|
|
24
24
|
function add() {
|
|
25
|
-
const l = { id: drawId(), name: locale.drawLayer
|
|
25
|
+
const l = { id: drawId(), name: formatMessage(locale.drawLayer, { n: String(list.value.length + 1) }, locale.lang) }
|
|
26
26
|
// Items drawn before there were layers stay on the first one
|
|
27
27
|
set([...list.value, l])
|
|
28
28
|
d.layer.value = l.id
|
|
@@ -184,4 +184,11 @@ function handleItemClick(item: FabMenuItem, close: () => void) {
|
|
|
184
184
|
transition: none;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
+
/* createM3UI({ reducedMotion: 'always' }) */
|
|
188
|
+
:root[data-m3-motion='reduce'] .m3-fabmenu-item-inner,
|
|
189
|
+
:root[data-m3-motion='reduce'] .m3-fabmenu-item-enter-active,
|
|
190
|
+
:root[data-m3-motion='reduce'] .m3-fabmenu-item-leave-active {
|
|
191
|
+
transition: none;
|
|
192
|
+
}
|
|
193
|
+
|
|
187
194
|
</style>
|
|
@@ -114,7 +114,7 @@ export interface FloorStatus {
|
|
|
114
114
|
* @event move Tables moved by a drag or the arrows, with their new positions (`{ id, x, y }[]`), to save them
|
|
115
115
|
*/
|
|
116
116
|
import { computed, onBeforeUnmount, onMounted, provide, ref, shallowRef, watch } from 'vue'
|
|
117
|
-
import { useLocale } from '../composables/useLocale'
|
|
117
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
118
118
|
import { FLOOR_PLAN_KEY, type FloorItemKind, type FloorPlanContext } from '../composables/useFloorPlan'
|
|
119
119
|
import MIcon from './MIcon.vue'
|
|
120
120
|
|
|
@@ -1846,7 +1846,7 @@ const measureLabels = computed(() => {
|
|
|
1846
1846
|
return out
|
|
1847
1847
|
})
|
|
1848
1848
|
const ariaOf = (p: (typeof placed.value)[number]) =>
|
|
1849
|
-
[p.t.label, p.status?.label, p.t.seats ? locale.floorSeats
|
|
1849
|
+
[p.t.label, p.status?.label, p.t.seats ? formatMessage(locale.floorSeats, { n: String(p.t.seats) }, locale.lang) : '', p.t.badge !== undefined ? String(p.t.badge) : '', overlapping.value.has(p.t.id) ? locale.floorOverlaps : ''].filter(Boolean).join(', ')
|
|
1850
1850
|
// A radial gradient draws its dot in the middle of each tile: moved back half a tile so the dots sit on the points
|
|
1851
1851
|
const gridStyle = computed(() => {
|
|
1852
1852
|
if (!props.editable || !props.showGrid || !props.grid) return {}
|
|
@@ -2146,7 +2146,7 @@ const gridStyle = computed(() => {
|
|
|
2146
2146
|
...(p.t.activeSeats?.includes(i + 1) && seatTaken(p.status)),
|
|
2147
2147
|
}"
|
|
2148
2148
|
:data-seat="i + 1"
|
|
2149
|
-
:aria-label="seatNumbers ? locale.floorSeatN
|
|
2149
|
+
:aria-label="seatNumbers ? formatMessage(locale.floorSeatN, { n: String(i + 1) }, locale.lang) : undefined"
|
|
2150
2150
|
@click="seatNumbers && !editable && emit('seat-click', outerOf(p.t), i + 1, $event)"
|
|
2151
2151
|
>
|
|
2152
2152
|
<span
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { computed, inject } from 'vue'
|
|
17
17
|
import { FLOOR_PLAN_KEY, floorDecorName, type FloorPlanContext } from '../composables/useFloorPlan'
|
|
18
|
-
import { useLocale } from '../composables/useLocale'
|
|
18
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
19
19
|
import type { FloorArea, FloorDecor, FloorTable, FloorWall } from './MFloorPlan.vue'
|
|
20
20
|
import MButton from './MButton.vue'
|
|
21
21
|
import MIcon from './MIcon.vue'
|
|
@@ -80,7 +80,7 @@ const sizeMin = (v: number) => (unit.value ? v / unit.value.per : v)
|
|
|
80
80
|
<div v-if="ctx" class="m3-floor-plan-inspector flex flex-col gap-3">
|
|
81
81
|
<!-- A table -->
|
|
82
82
|
<template v-if="table">
|
|
83
|
-
<div class="flex items-center gap-2 text-title-small"><MIcon name="table_restaurant" :size="18" />{{ locale.floorTableN
|
|
83
|
+
<div class="flex items-center gap-2 text-title-small"><MIcon name="table_restaurant" :size="18" />{{ formatMessage(locale.floorTableN, { label: table.label }, locale.lang) }}</div>
|
|
84
84
|
<div class="grid grid-cols-[repeat(auto-fit,minmax(9rem,1fr))] gap-3">
|
|
85
85
|
<MTextField :model-value="table.label" :label="locale.floorLabel" variant="outlined" @update:model-value="upTable({ label: String($event) })" />
|
|
86
86
|
<MNumberField :model-value="table.seats ?? 0" :label="locale.floorSeatsField" variant="outlined" :min="0" :max="40" @update:model-value="upTable({ seats: $event ?? 0, width: undefined, height: undefined })" />
|
|
@@ -106,7 +106,7 @@ const sizeMin = (v: number) => (unit.value ? v / unit.value.per : v)
|
|
|
106
106
|
|
|
107
107
|
<!-- Several tables -->
|
|
108
108
|
<template v-else-if="many">
|
|
109
|
-
<div class="flex items-center gap-2 text-title-small"><MIcon name="select_all" :size="18" />{{ locale.floorTablesPicked
|
|
109
|
+
<div class="flex items-center gap-2 text-title-small"><MIcon name="select_all" :size="18" />{{ formatMessage(locale.floorTablesPicked, { n: String(many.length) }, locale.lang) }}</div>
|
|
110
110
|
<slot name="tables" :ids="many" />
|
|
111
111
|
<div class="flex flex-wrap gap-2">
|
|
112
112
|
<MButton v-if="merging" variant="tonal" icon="join" @click="ctx.merge(many)">{{ locale.floorMerge }}</MButton>
|
package/src/components/MFlow.vue
CHANGED
|
@@ -83,7 +83,7 @@ import { layoutLayered, layoutTree, type FlowLayout, type FlowLayoutDirection, t
|
|
|
83
83
|
import { distanceToPoints, edgePathPoints, getBezierPath, getRoutedPath, getSmoothStepPath, getStepPath, getStraightPath, pointsToRoute, routePoints, smoothStepPoints, type FlowEdgePath, type FlowStepCenter } from '../composables/flowPaths'
|
|
84
84
|
import { DEFAULT_SPATIAL } from '../composables/_useSpring'
|
|
85
85
|
import { prefersReducedMotion } from '../composables/_springAnimation'
|
|
86
|
-
import { useLocale } from '../composables/useLocale'
|
|
86
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
87
87
|
import NodeShell from './_MFlowNodeShell.vue'
|
|
88
88
|
import EdgeView from './_MFlowEdge.vue'
|
|
89
89
|
import EdgeLabel from './_MFlowEdgeLabel.vue'
|
|
@@ -967,7 +967,7 @@ function applyRemove(goneNodes: Set<string>, goneEdgeIds: Set<string>) {
|
|
|
967
967
|
})
|
|
968
968
|
setSelection({ nodes: selLocal.value.nodes.filter((i) => !goneNodes.has(i)), edges: selLocal.value.edges.filter((i) => !goneEdges.has(edgeById.value.get(i)!)) })
|
|
969
969
|
emit('delete', { nodes, edges })
|
|
970
|
-
announce(locale.flowDeleted
|
|
970
|
+
announce(formatMessage(locale.flowDeleted, { count: String(nodes.length + edges.length) }, locale.lang))
|
|
971
971
|
}
|
|
972
972
|
function deleteSelection() {
|
|
973
973
|
if (locked.value) return
|
|
@@ -1860,7 +1860,7 @@ function endNodeDrag(g: Extract<Gesture, { kind: 'node' }>, e: PointerEvent) {
|
|
|
1860
1860
|
if (spliced) dragging.value = new Set()
|
|
1861
1861
|
commit({ nodes: placed, edges })
|
|
1862
1862
|
const first = nodeById.value.get(g.nodeId)
|
|
1863
|
-
if (first) announce(locale.flowMoved
|
|
1863
|
+
if (first) announce(formatMessage(locale.flowMoved, { label: nodeLabel(first) }, locale.lang))
|
|
1864
1864
|
}
|
|
1865
1865
|
dragging.value = new Set()
|
|
1866
1866
|
frozenGroups.clear()
|
|
@@ -2078,7 +2078,7 @@ function endConnection(g: Extract<Gesture, { kind: 'connect' }>, e: PointerEvent
|
|
|
2078
2078
|
addEdges({ ...props.defaultEdgeOptions, id: makeId('edge'), ...c })
|
|
2079
2079
|
const s = nodeById.value.get(c.source)
|
|
2080
2080
|
const t = nodeById.value.get(c.target)
|
|
2081
|
-
if (s && t) announce(locale.flowConnected
|
|
2081
|
+
if (s && t) announce(formatMessage(locale.flowConnected, { source: nodeLabel(s), target: nodeLabel(t) }, locale.lang))
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
2084
|
emit('connect-end', { connection: c, position, from: g.from })
|
|
@@ -2140,7 +2140,7 @@ function onKeyDown(e: KeyboardEvent) {
|
|
|
2140
2140
|
instantNext = true
|
|
2141
2141
|
commit({ nodes: nodesLocal.value.map((n) => (ids.has(n.id) ? { ...n, position: { x: n.position.x + dir[0] * step, y: n.position.y + dir[1] * step } } : n)) }, { coalesce: `move:${[...ids].join(',')}` })
|
|
2142
2142
|
const first = nodeById.value.get([...ids][0]!)
|
|
2143
|
-
if (first) announce(locale.flowMoved
|
|
2143
|
+
if (first) announce(formatMessage(locale.flowMoved, { label: nodeLabel(first) }, locale.lang))
|
|
2144
2144
|
} else if (dir && !selLocal.value.nodes.length) {
|
|
2145
2145
|
e.preventDefault()
|
|
2146
2146
|
writeViewport({ x: vp.value.x - dir[0] * 40, y: vp.value.y - dir[1] * 40, zoom: vp.value.zoom })
|
|
@@ -2392,4 +2392,8 @@ defineExpose(context as FlowContext)
|
|
|
2392
2392
|
.m3-flow-edge-animated { animation: none; }
|
|
2393
2393
|
.m3-flow-edge-line { transition: none; }
|
|
2394
2394
|
}
|
|
2395
|
+
/* createM3UI({ reducedMotion: 'always' }) */
|
|
2396
|
+
:root[data-m3-motion='reduce'] .m3-flow-edge-animated { animation: none; }
|
|
2397
|
+
:root[data-m3-motion='reduce'] .m3-flow-edge-line { transition: none; }
|
|
2398
|
+
|
|
2395
2399
|
</style>
|
|
@@ -107,4 +107,10 @@ const canDelete = computed(() => props.delete && !flow.locked.value && (deletabl
|
|
|
107
107
|
@media (prefers-reduced-motion: reduce) {
|
|
108
108
|
.m3-flow-ctl-v-enter-active, .m3-flow-ctl-v-leave-active, .m3-flow-ctl-h-enter-active, .m3-flow-ctl-h-leave-active { transition: none; }
|
|
109
109
|
}
|
|
110
|
+
/* createM3UI({ reducedMotion: 'always' }) */
|
|
111
|
+
:root[data-m3-motion='reduce'] .m3-flow-ctl-v-enter-active,
|
|
112
|
+
:root[data-m3-motion='reduce'] .m3-flow-ctl-v-leave-active,
|
|
113
|
+
:root[data-m3-motion='reduce'] .m3-flow-ctl-h-enter-active,
|
|
114
|
+
:root[data-m3-motion='reduce'] .m3-flow-ctl-h-leave-active { transition: none; }
|
|
115
|
+
|
|
110
116
|
</style>
|
|
@@ -261,7 +261,7 @@ defineExpose({
|
|
|
261
261
|
v-for="t in palette"
|
|
262
262
|
:key="t.type"
|
|
263
263
|
type="button"
|
|
264
|
-
class="flex items-center gap-2 rounded-full px-3 py-1.5 text-start text-label-large text-on-surface-variant transition-colors hover:bg-on-surface/8 focus-visible:outline-2 focus-visible:outline-
|
|
264
|
+
class="flex items-center gap-2 rounded-full px-3 py-1.5 text-start text-label-large text-on-surface-variant transition-colors hover:bg-on-surface/8 focus-visible:outline-2 focus-visible:outline-secondary @3xl:rounded-lg"
|
|
265
265
|
:data-type="t.type"
|
|
266
266
|
@click="add(t.type)"
|
|
267
267
|
>
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
import { DAY, addDays, daysBetween, defaultSnap, formatDate, parseDate, snapTime } from '../composables/_ganttTime'
|
|
56
56
|
import { arrowPath } from '../composables/flowPaths'
|
|
57
57
|
import { playSamples, prefersReducedMotion, sampleSpring } from '../composables/_springAnimation'
|
|
58
|
-
import { useLocale } from '../composables/useLocale'
|
|
58
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
59
59
|
import { useTimeAxis } from '../composables/_useTimeAxis'
|
|
60
60
|
import { holdDragCursor, releaseDragCursor } from '../composables/_dragCursor'
|
|
61
61
|
import MTimeHeader from './_MTimeHeader.vue'
|
|
@@ -568,7 +568,7 @@ function link(from: string, to: string, type: NonNullable<GanttDependency['type'
|
|
|
568
568
|
if (props.schedule === 'auto') next = scheduleTasks(next, scheduleOptions())
|
|
569
569
|
commit(next)
|
|
570
570
|
emit('link', { from, to, type })
|
|
571
|
-
announce(locale.ganttLinked
|
|
571
|
+
announce(formatMessage(locale.ganttLinked, { from: byId.value.get(from)?.name ?? from, to: byId.value.get(to)?.name ?? to }, locale.lang))
|
|
572
572
|
}
|
|
573
573
|
const scheduleOptions = (): GanttScheduleOptions => ({ calendar: props.calendar ? props.calendar : undefined })
|
|
574
574
|
|
|
@@ -606,7 +606,7 @@ async function removeTasks(ids: string[]) {
|
|
|
606
606
|
.map((t) => (t.dependencies?.some((d) => gone.has(normalizeDependency(d).id)) ? { ...t, dependencies: t.dependencies.filter((d) => !gone.has(normalizeDependency(d).id)) } : t)))
|
|
607
607
|
setSelection(selected.value.filter((id) => !gone.has(id)))
|
|
608
608
|
emit('delete', { tasks: removed })
|
|
609
|
-
announce(locale.ganttDeleted
|
|
609
|
+
announce(formatMessage(locale.ganttDeleted, { count: String(removed.length) }, locale.lang))
|
|
610
610
|
}
|
|
611
611
|
function runSchedule(options?: GanttScheduleOptions) {
|
|
612
612
|
commit(scheduleTasks(current.value, { ...scheduleOptions(), ...options }))
|
|
@@ -884,7 +884,7 @@ function moveRow(id: string, target: string, where: 'before' | 'after' | 'inside
|
|
|
884
884
|
commit(next)
|
|
885
885
|
const pos = rows.value.findIndex((r) => r.task.id === id) + 1
|
|
886
886
|
emit('change', { tasks: [moved], kind: 'reorder' })
|
|
887
|
-
nextTick(() => announce(locale.ganttReordered
|
|
887
|
+
nextTick(() => announce(formatMessage(locale.ganttReordered, { name: moved.name, pos: String(rows.value.findIndex((r) => r.task.id === id) + 1 || pos) }, locale.lang)))
|
|
888
888
|
}
|
|
889
889
|
|
|
890
890
|
function onUp(e: PointerEvent) {
|
|
@@ -929,8 +929,8 @@ function onUp(e: PointerEvent) {
|
|
|
929
929
|
const kind = g.part === 'progress' ? 'progress' : g.part === 'body' ? 'move' : 'resize'
|
|
930
930
|
emit('change', { tasks: changed, kind })
|
|
931
931
|
const lead = byNext.get(g.taskId)!
|
|
932
|
-
if (kind === 'progress') announce(locale.ganttProgressSet
|
|
933
|
-
else announce(locale.ganttMoved
|
|
932
|
+
if (kind === 'progress') announce(formatMessage(locale.ganttProgressSet, { name: lead.name, progress: String(lead.progress ?? 0) }, locale.lang))
|
|
933
|
+
else announce(formatMessage(locale.ganttMoved, { name: lead.name, start: formatShort(lead.start), end: formatShort(lead.end ?? lead.start) }, locale.lang))
|
|
934
934
|
}
|
|
935
935
|
function onCancel(e: PointerEvent) {
|
|
936
936
|
if (!gesture || gesture.id !== e.pointerId) return
|
|
@@ -1055,8 +1055,8 @@ function formatShort(s: string) {
|
|
|
1055
1055
|
function durationText(t: GanttTask) {
|
|
1056
1056
|
if (isMilestone(t)) return locale.ganttMilestone
|
|
1057
1057
|
const days = taskDays(t)
|
|
1058
|
-
if (taskSpan(t).dateOnly || days >= 1) return locale.ganttDays
|
|
1059
|
-
return locale.ganttHours
|
|
1058
|
+
if (taskSpan(t).dateOnly || days >= 1) return formatMessage(locale.ganttDays, { n: String(Math.round(days * 10) / 10) }, locale.lang)
|
|
1059
|
+
return formatMessage(locale.ganttHours, { n: String(Math.round(days * 24 * 10) / 10) }, locale.lang)
|
|
1060
1060
|
}
|
|
1061
1061
|
const columnWidths = computed(() => {
|
|
1062
1062
|
const fixed = columnList.value.reduce((s, c) => s + (c.key === 'name' && !c.width ? 0 : (c.width ?? 100)), 0)
|
|
@@ -1153,7 +1153,7 @@ function shiftTask(t: GanttTask, steps: number, endOnly: boolean) {
|
|
|
1153
1153
|
commit(next)
|
|
1154
1154
|
const moved = rollupSummaries(next).find((x) => x.id === t.id)!
|
|
1155
1155
|
emit('change', { tasks: [moved], kind: endOnly ? 'resize' : 'move' })
|
|
1156
|
-
announce(locale.ganttMoved
|
|
1156
|
+
announce(formatMessage(locale.ganttMoved, { name: moved.name, start: formatShort(moved.start), end: formatShort(moved.end ?? moved.start) }, locale.lang))
|
|
1157
1157
|
}
|
|
1158
1158
|
function onRowKey(e: KeyboardEvent, t: GanttTask) {
|
|
1159
1159
|
if (editing.value) return
|
|
@@ -1668,7 +1668,7 @@ defineExpose(context)
|
|
|
1668
1668
|
<template v-if="!isMilestone(tooltipTask) && tooltipTask.progress !== undefined"> · {{ Math.round(tooltipTask.progress) }}%</template>
|
|
1669
1669
|
</div>
|
|
1670
1670
|
<div v-if="criticalPath && criticalPathInfo.slack[tooltipTask.id] !== undefined" class="text-body-small" :class="criticalSet.has(tooltipTask.id) ? 'text-error' : 'text-on-surface-variant'">
|
|
1671
|
-
{{ criticalSet.has(tooltipTask.id) ? locale.ganttCritical : locale.ganttSlack
|
|
1671
|
+
{{ criticalSet.has(tooltipTask.id) ? locale.ganttCritical : formatMessage(locale.ganttSlack, { n: String(Math.round(criticalPathInfo.slack[tooltipTask.id]! * 10) / 10) }, locale.lang) }}
|
|
1672
1672
|
</div>
|
|
1673
1673
|
</slot>
|
|
1674
1674
|
</div>
|