@m3ui-vue/m3ui-vue 0.8.6 → 0.8.8

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.
Files changed (65) hide show
  1. package/README.md +4 -0
  2. package/dist/{MMenuItem-BmPLAyv5.js → MMenuItem-5xojJYAL.js} +2 -2
  3. package/dist/{MMenuItem-BmPLAyv5.js.map → MMenuItem-5xojJYAL.js.map} +1 -1
  4. package/dist/chart.js +5 -1
  5. package/dist/chart.js.map +1 -1
  6. package/dist/code-editor.js +1 -1
  7. package/dist/components/MBottomSheet.vue.d.ts +3 -3
  8. package/dist/components/MListDetail.vue.d.ts +31 -0
  9. package/dist/components/MNavigationRail.vue.d.ts +6 -3
  10. package/dist/components/MNavigationSuite.vue.d.ts +46 -0
  11. package/dist/components/MShortNavigationBar.vue.d.ts +6 -1
  12. package/dist/components/MSideSheet.vue.d.ts +4 -4
  13. package/dist/components/MSupportingPane.vue.d.ts +34 -0
  14. package/dist/components/MTransferList.vue.d.ts +55 -34
  15. package/dist/components/MWindow.vue.d.ts +39 -1
  16. package/dist/components/_MTransferPane.vue.d.ts +10 -3
  17. package/dist/composables/_useItemLink.d.ts +30 -0
  18. package/dist/composables/_useSheetMotion.d.ts +7 -0
  19. package/dist/composables/useLocale.d.ts +7 -0
  20. package/dist/composables/useWindowSizeClass.d.ts +19 -0
  21. package/dist/index.d.ts +6 -0
  22. package/dist/locales/index.js +56 -7
  23. package/dist/locales/index.js.map +1 -1
  24. package/dist/m3ui-vue.css +1 -1
  25. package/dist/m3ui.js +2399 -1899
  26. package/dist/m3ui.js.map +1 -1
  27. package/dist/rich-text-editor.js +2 -2
  28. package/dist/styles.css +1 -1
  29. package/dist/{useLocale-4afAzuuP.js → useLocale-D3ZWZ8jY.js} +9 -2
  30. package/dist/useLocale-D3ZWZ8jY.js.map +1 -0
  31. package/package.json +1 -1
  32. package/src/__tests__/MChart.test.ts +28 -0
  33. package/src/__tests__/MPagination.test.ts +37 -0
  34. package/src/__tests__/MPullToRefresh.test.ts +39 -0
  35. package/src/__tests__/MShortNavigationBar.test.ts +25 -0
  36. package/src/__tests__/MTransferList.test.ts +73 -0
  37. package/src/__tests__/MWindow.test.ts +258 -0
  38. package/src/__tests__/adaptiveLayouts.test.ts +191 -0
  39. package/src/__tests__/sheets.test.ts +76 -0
  40. package/src/components/MBottomSheet.vue +11 -57
  41. package/src/components/MChart.vue +2 -1
  42. package/src/components/MListDetail.vue +103 -0
  43. package/src/components/MNavigationRail.vue +18 -10
  44. package/src/components/MNavigationSuite.vue +89 -0
  45. package/src/components/MPagination.vue +8 -5
  46. package/src/components/MPullToRefresh.vue +13 -1
  47. package/src/components/MShortNavigationBar.vue +37 -17
  48. package/src/components/MSideSheet.vue +11 -56
  49. package/src/components/MSupportingPane.vue +70 -0
  50. package/src/components/MTransferList.vue +43 -9
  51. package/src/components/MWindow.vue +507 -108
  52. package/src/components/_MTransferPane.vue +113 -35
  53. package/src/composables/_useItemLink.ts +19 -0
  54. package/src/composables/_useSheetMotion.ts +181 -0
  55. package/src/composables/useLocale.ts +17 -0
  56. package/src/composables/useWindowSizeClass.ts +93 -0
  57. package/src/index.ts +6 -0
  58. package/src/locales/de.ts +8 -0
  59. package/src/locales/es.ts +8 -0
  60. package/src/locales/fr.ts +8 -0
  61. package/src/locales/ja.ts +8 -0
  62. package/src/locales/ko.ts +8 -0
  63. package/src/locales/pt.ts +8 -0
  64. package/src/locales/zh.ts +8 -0
  65. package/dist/useLocale-4afAzuuP.js.map +0 -1
@@ -1,11 +1,4 @@
1
- <script setup lang="ts">
2
- import { computed, ref } from 'vue'
3
- import MIconButton from './MIconButton.vue'
4
- import MTransferPane from './_MTransferPane.vue'
5
- import { useLocale } from '../composables/useLocale'
6
-
7
- const locale = useLocale()
8
-
1
+ <script lang="ts">
9
2
  export interface TransferItem {
10
3
  value: string | number
11
4
  label: string
@@ -13,12 +6,21 @@ export interface TransferItem {
13
6
  /** Optional second line under the label (an email, a role, a short description). */
14
7
  description?: string
15
8
  }
9
+ </script>
10
+
11
+ <script setup lang="ts" generic="T extends TransferItem = TransferItem">
12
+ import { computed, ref } from 'vue'
13
+ import MIconButton from './MIconButton.vue'
14
+ import MTransferPane from './_MTransferPane.vue'
15
+ import { useLocale } from '../composables/useLocale'
16
+
17
+ const locale = useLocale()
16
18
 
17
19
  type Value = string | number
18
20
 
19
21
  const props = withDefaults(defineProps<{
20
22
  modelValue: Value[]
21
- items: TransferItem[]
23
+ items: T[]
22
24
  sourceTitle?: string
23
25
  targetTitle?: string
24
26
  filterable?: boolean
@@ -30,11 +32,39 @@ const props = withDefaults(defineProps<{
30
32
  moveAllLeftLabel?: string
31
33
  /** Height of each list's scroll area (any CSS length). */
32
34
  listHeight?: string
35
+ /**
36
+ * Fully custom rows: the `#item` slot draws the whole row (no checkbox, padding, min height
37
+ * or background). The row stays clickable, focusable (Space checks it, Enter moves it) and
38
+ * animated; use the slot's `checked` to style the checked state.
39
+ */
40
+ bare?: boolean
33
41
  }>(), {
34
42
  filterable: false,
35
43
  listHeight: '280px',
44
+ bare: false,
36
45
  })
37
46
 
47
+ defineSlots<{
48
+ /**
49
+ * Custom row content. Without `bare` it replaces the icon and text, keeping the checkbox,
50
+ * highlight and hover. Buttons, links, fields and `[data-transfer-action]` elements inside
51
+ * keep their own clicks instead of checking the row.
52
+ */
53
+ item?: (props: {
54
+ /** Your item, with any extra fields it carries. */
55
+ item: T
56
+ checked: boolean
57
+ /** Which pane the row is in. */
58
+ side: 'source' | 'target'
59
+ /** Check or uncheck the row. */
60
+ toggle: () => void
61
+ /** Send just this row to the other pane. */
62
+ move: () => void
63
+ }) => unknown
64
+ 'source-empty'?: () => unknown
65
+ 'target-empty'?: () => unknown
66
+ }>()
67
+
38
68
  const emit = defineEmits<{ 'update:modelValue': [Value[]] }>()
39
69
 
40
70
  const checkedSource = ref<Set<Value>>(new Set())
@@ -131,11 +161,13 @@ function activateTarget(value: Value) {
131
161
  enter-from="end"
132
162
  :select-all-label="locale.selectAll"
133
163
  :clear-search-label="locale.clearSearch"
164
+ :bare="bare"
134
165
  @toggle="toggleSource"
135
166
  @toggle-all="toggleAllSource"
136
167
  @activate="activateSource"
137
168
  @update:search="sourceSearch = $event"
138
169
  >
170
+ <template v-if="$slots.item" #item="row"><slot name="item" v-bind="row" :item="row.item as T" side="source" /></template>
139
171
  <template v-if="$slots['source-empty']" #empty><slot name="source-empty" /></template>
140
172
  </MTransferPane>
141
173
 
@@ -187,11 +219,13 @@ function activateTarget(value: Value) {
187
219
  enter-from="start"
188
220
  :select-all-label="locale.selectAll"
189
221
  :clear-search-label="locale.clearSearch"
222
+ :bare="bare"
190
223
  @toggle="toggleTarget"
191
224
  @toggle-all="toggleAllTarget"
192
225
  @activate="activateTarget"
193
226
  @update:search="targetSearch = $event"
194
227
  >
228
+ <template v-if="$slots.item" #item="row"><slot name="item" v-bind="row" :item="row.item as T" side="target" /></template>
195
229
  <template v-if="$slots['target-empty']" #empty><slot name="target-empty" /></template>
196
230
  </MTransferPane>
197
231
  </div>