@movk/nuxt 1.8.3 → 2.0.0-beta.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.
Files changed (274) hide show
  1. package/README.en.md +16 -6
  2. package/README.md +16 -6
  3. package/dist/module.d.mts +6 -0
  4. package/dist/module.json +3 -3
  5. package/dist/module.mjs +15 -22
  6. package/dist/runtime/components/AutoForm.d.vue.ts +15 -1
  7. package/dist/runtime/components/AutoForm.vue +48 -50
  8. package/dist/runtime/components/AutoForm.vue.d.ts +15 -1
  9. package/dist/runtime/components/DataTable.d.vue.ts +4 -2
  10. package/dist/runtime/components/DataTable.vue +166 -174
  11. package/dist/runtime/components/DataTable.vue.d.ts +4 -2
  12. package/dist/runtime/components/DatePicker.d.vue.ts +6 -5
  13. package/dist/runtime/components/DatePicker.vue +96 -43
  14. package/dist/runtime/components/DatePicker.vue.d.ts +6 -5
  15. package/dist/runtime/components/MessageBox.d.vue.ts +1 -5
  16. package/dist/runtime/components/MessageBox.vue +9 -7
  17. package/dist/runtime/components/MessageBox.vue.d.ts +1 -5
  18. package/dist/runtime/components/SearchForm.d.vue.ts +12 -4
  19. package/dist/runtime/components/SearchForm.vue +130 -120
  20. package/dist/runtime/components/SearchForm.vue.d.ts +12 -4
  21. package/dist/runtime/components/Tree.d.vue.ts +3 -1
  22. package/dist/runtime/components/Tree.vue +102 -140
  23. package/dist/runtime/components/Tree.vue.d.ts +3 -1
  24. package/dist/runtime/components/theme-picker/ThemePicker.vue +5 -3
  25. package/dist/runtime/components/theme-picker/ThemePickerButton.vue +15 -6
  26. package/dist/runtime/composables/index.d.ts +1 -0
  27. package/dist/runtime/composables/index.js +1 -0
  28. package/dist/runtime/composables/useApiFetch.d.ts +7 -7
  29. package/dist/runtime/composables/useApiFetch.js +5 -23
  30. package/dist/runtime/composables/useAutoForm.js +2 -2
  31. package/dist/runtime/composables/useClientApiFetch.d.ts +5 -5
  32. package/dist/runtime/composables/useDateFormatter.d.ts +32 -34
  33. package/dist/runtime/composables/useDateFormatter.js +75 -232
  34. package/dist/runtime/composables/useDownloadWithProgress.d.ts +11 -8
  35. package/dist/runtime/composables/useDownloadWithProgress.js +49 -132
  36. package/dist/runtime/composables/useMessageBox.js +3 -2
  37. package/dist/runtime/composables/useMovkLocale.d.ts +16 -0
  38. package/dist/runtime/composables/useMovkLocale.js +20 -0
  39. package/dist/runtime/composables/useTheme.js +8 -18
  40. package/dist/runtime/composables/useUploadWithProgress.d.ts +9 -6
  41. package/dist/runtime/composables/useUploadWithProgress.js +50 -84
  42. package/dist/runtime/domains/ai/chat-transport.js +1 -0
  43. package/dist/runtime/domains/api/adapters/xhr.d.ts +17 -0
  44. package/dist/runtime/domains/api/adapters/xhr.js +55 -0
  45. package/dist/runtime/domains/api/auth.d.ts +4 -1
  46. package/dist/runtime/domains/api/auth.js +6 -7
  47. package/dist/runtime/domains/api/client.d.ts +13 -0
  48. package/dist/runtime/domains/api/client.js +35 -0
  49. package/dist/runtime/domains/api/download.d.ts +10 -0
  50. package/dist/runtime/domains/api/download.js +28 -0
  51. package/dist/runtime/domains/api/errors.d.ts +20 -2
  52. package/dist/runtime/domains/api/errors.js +61 -8
  53. package/dist/runtime/domains/api/fetch-key.d.ts +2 -2
  54. package/dist/runtime/domains/api/fetch-key.js +4 -4
  55. package/dist/runtime/domains/api/interceptors/request.d.ts +2 -6
  56. package/dist/runtime/domains/api/interceptors/request.js +3 -2
  57. package/dist/runtime/domains/api/interceptors/response.d.ts +8 -14
  58. package/dist/runtime/domains/api/interceptors/response.js +34 -25
  59. package/dist/runtime/domains/api/report.d.ts +25 -0
  60. package/dist/runtime/domains/api/report.js +51 -0
  61. package/dist/runtime/domains/api/response.d.ts +29 -4
  62. package/dist/runtime/domains/api/response.js +27 -6
  63. package/dist/runtime/domains/api/session.d.ts +1 -1
  64. package/dist/runtime/domains/api/session.js +1 -1
  65. package/dist/runtime/domains/api/stream.d.ts +2 -1
  66. package/dist/runtime/domains/api/stream.js +2 -1
  67. package/dist/runtime/domains/api/toast.d.ts +6 -3
  68. package/dist/runtime/domains/api/toast.js +7 -7
  69. package/dist/runtime/domains/auto-form/actions.d.ts +2 -1
  70. package/dist/runtime/domains/auto-form/actions.js +6 -4
  71. package/dist/runtime/domains/auto-form/array-ops.d.ts +3 -0
  72. package/dist/runtime/domains/auto-form/array-ops.js +9 -0
  73. package/dist/runtime/domains/auto-form/async-items.d.ts +10 -0
  74. package/dist/runtime/domains/auto-form/async-items.js +42 -0
  75. package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +0 -4
  76. package/dist/runtime/domains/auto-form/components/Array.vue +81 -73
  77. package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +0 -4
  78. package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +0 -2
  79. package/dist/runtime/domains/auto-form/components/Children.vue +0 -5
  80. package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +0 -2
  81. package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +0 -2
  82. package/dist/runtime/domains/auto-form/components/Field.vue +9 -2
  83. package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +0 -2
  84. package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +0 -2
  85. package/dist/runtime/domains/auto-form/components/Layout.vue +3 -6
  86. package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +0 -2
  87. package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +0 -2
  88. package/dist/runtime/domains/auto-form/components/Nested.vue +5 -9
  89. package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +0 -2
  90. package/dist/runtime/domains/auto-form/controls.d.ts +5 -572
  91. package/dist/runtime/domains/auto-form/controls.js +7 -20
  92. package/dist/runtime/domains/auto-form/fields.d.ts +21 -4
  93. package/dist/runtime/domains/auto-form/fields.js +52 -40
  94. package/dist/runtime/domains/auto-form/provider.d.ts +15 -6
  95. package/dist/runtime/domains/auto-form/provider.js +24 -10
  96. package/dist/runtime/domains/auto-form/schema.d.ts +9 -4
  97. package/dist/runtime/domains/auto-form/schema.js +91 -50
  98. package/dist/runtime/domains/auto-form/search-query.d.ts +10 -0
  99. package/dist/runtime/domains/auto-form/search-query.js +57 -0
  100. package/dist/runtime/domains/auto-form/useAutoFormCore.d.ts +62 -0
  101. package/dist/runtime/domains/auto-form/useAutoFormCore.js +108 -0
  102. package/dist/runtime/domains/auto-form/useSearchQuerySync.d.ts +11 -0
  103. package/dist/runtime/domains/auto-form/useSearchQuerySync.js +64 -0
  104. package/dist/runtime/domains/data-table/columns/constants.d.ts +2 -0
  105. package/dist/runtime/domains/data-table/columns/constants.js +1 -1
  106. package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +2 -1
  107. package/dist/runtime/domains/data-table/columns/resolve-columns.js +3 -2
  108. package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +7 -2
  109. package/dist/runtime/domains/data-table/columns/resolve-data-column.js +10 -5
  110. package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +14 -8
  111. package/dist/runtime/domains/data-table/components/ColumnSettings.d.vue.ts +20 -0
  112. package/dist/runtime/domains/data-table/components/ColumnSettings.vue +63 -0
  113. package/dist/runtime/domains/data-table/components/ColumnSettings.vue.d.ts +20 -0
  114. package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +2 -8
  115. package/dist/runtime/domains/data-table/components/Pagination.vue +34 -36
  116. package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +2 -8
  117. package/dist/runtime/domains/data-table/export.d.ts +23 -0
  118. package/dist/runtime/domains/data-table/export.js +43 -0
  119. package/dist/runtime/domains/data-table/load-more.d.ts +8 -0
  120. package/dist/runtime/domains/data-table/load-more.js +14 -0
  121. package/dist/runtime/domains/data-table/pagination.d.ts +29 -0
  122. package/dist/runtime/domains/data-table/pagination.js +42 -0
  123. package/dist/runtime/domains/data-table/persist.d.ts +12 -0
  124. package/dist/runtime/domains/data-table/persist.js +41 -0
  125. package/dist/runtime/domains/data-table/state/keys.d.ts +11 -0
  126. package/dist/runtime/domains/data-table/state/keys.js +44 -0
  127. package/dist/runtime/domains/data-table/state/models.d.ts +5 -0
  128. package/dist/runtime/domains/data-table/state/models.js +38 -0
  129. package/dist/runtime/domains/data-table/tree-layout.d.ts +13 -0
  130. package/dist/runtime/domains/data-table/tree-layout.js +30 -0
  131. package/dist/runtime/domains/theme/theme-color.d.ts +3 -0
  132. package/dist/runtime/domains/theme/theme-color.js +16 -0
  133. package/dist/runtime/domains/theme/theme-fouc.d.ts +5 -0
  134. package/dist/runtime/domains/theme/theme-fouc.js +43 -0
  135. package/dist/runtime/domains/tree/components/TreeToolbar.d.vue.ts +7 -5
  136. package/dist/runtime/domains/tree/components/TreeToolbar.vue +6 -4
  137. package/dist/runtime/domains/tree/components/TreeToolbar.vue.d.ts +7 -5
  138. package/dist/runtime/domains/tree/tree-disabled.d.ts +5 -0
  139. package/dist/runtime/domains/tree/tree-disabled.js +15 -0
  140. package/dist/runtime/domains/tree/tree-lazy.d.ts +8 -0
  141. package/dist/runtime/domains/tree/tree-lazy.js +19 -1
  142. package/dist/runtime/domains/tree/tree-search.d.ts +3 -1
  143. package/dist/runtime/domains/tree/tree-search.js +4 -0
  144. package/dist/runtime/domains/tree/useTreeLazy.d.ts +22 -0
  145. package/dist/runtime/domains/tree/useTreeLazy.js +57 -0
  146. package/dist/runtime/domains/tree/useTreeSearch.d.ts +27 -0
  147. package/dist/runtime/domains/tree/useTreeSearch.js +59 -0
  148. package/dist/runtime/domains/tree/useTreeSelection.d.ts +31 -0
  149. package/dist/runtime/domains/tree/useTreeSelection.js +89 -0
  150. package/dist/runtime/domains/zod/apply.d.ts +23 -0
  151. package/dist/runtime/domains/zod/apply.js +26 -0
  152. package/dist/runtime/domains/zod/error-map.d.ts +13 -0
  153. package/dist/runtime/domains/zod/error-map.js +19 -0
  154. package/dist/runtime/domains/zod/locale-map.d.ts +5 -0
  155. package/dist/runtime/domains/zod/locale-map.js +17 -0
  156. package/dist/runtime/domains/zod/sync.d.ts +12 -0
  157. package/dist/runtime/domains/zod/sync.js +30 -0
  158. package/dist/runtime/locale/en.d.ts +74 -0
  159. package/dist/runtime/locale/en.js +73 -0
  160. package/dist/runtime/locale/index.d.ts +8 -0
  161. package/dist/runtime/locale/index.js +15 -0
  162. package/dist/runtime/locale/zh_cn.d.ts +74 -0
  163. package/dist/runtime/locale/zh_cn.js +73 -0
  164. package/dist/runtime/plugins/api.factory.js +5 -22
  165. package/dist/runtime/plugins/theme.js +4 -42
  166. package/dist/runtime/plugins/zod.d.ts +2 -0
  167. package/dist/runtime/plugins/zod.js +16 -0
  168. package/dist/runtime/types/api/config.d.ts +12 -0
  169. package/dist/runtime/types/api/fetch.d.ts +3 -16
  170. package/dist/runtime/types/api/index.d.ts +1 -1
  171. package/dist/runtime/types/api/response.d.ts +33 -19
  172. package/dist/runtime/types/api/stream.d.ts +2 -3
  173. package/dist/runtime/types/api/transfer.d.ts +3 -7
  174. package/dist/runtime/types/auto-form/base.d.ts +9 -1
  175. package/dist/runtime/types/auto-form/component.d.ts +31 -3
  176. package/dist/runtime/types/auto-form/fields.d.ts +15 -1
  177. package/dist/runtime/types/auto-form/index.d.ts +3 -3
  178. package/dist/runtime/types/auto-form/search-form.d.ts +26 -12
  179. package/dist/runtime/types/auto-form/zod-factory.d.ts +2 -2
  180. package/dist/runtime/types/components/date-picker.d.ts +14 -3
  181. package/dist/runtime/types/components/index.d.ts +1 -6
  182. package/dist/runtime/types/components/message-box.d.ts +5 -18
  183. package/dist/runtime/types/components/tree.d.ts +17 -14
  184. package/dist/runtime/types/data-table/columns.d.ts +6 -14
  185. package/dist/runtime/types/data-table/component.d.ts +42 -1
  186. package/dist/runtime/types/data-table/index.d.ts +1 -1
  187. package/dist/runtime/types/data-table/pagination.d.ts +7 -8
  188. package/dist/runtime/types/index.d.ts +2 -0
  189. package/dist/runtime/types/locale.d.ts +82 -0
  190. package/dist/runtime/types/shared.d.ts +13 -0
  191. package/dist/runtime/types/zod-config.d.ts +38 -0
  192. package/dist/runtime/types/zod.d.ts +9 -1
  193. package/dist/runtime/utils/date/convert.d.ts +29 -0
  194. package/dist/runtime/utils/date/convert.js +93 -0
  195. package/dist/runtime/utils/date/guards.d.ts +10 -0
  196. package/dist/runtime/utils/date/guards.js +18 -0
  197. package/dist/runtime/utils/extend-theme.js +2 -1
  198. package/dist/runtime/utils/form-control.d.ts +0 -12
  199. package/dist/runtime/utils/form-control.js +3 -39
  200. package/dist/runtime/utils/interpolate.d.ts +2 -0
  201. package/dist/runtime/utils/interpolate.js +4 -0
  202. package/dist/runtime/utils/theme-defaults.d.ts +10 -0
  203. package/dist/runtime/utils/theme-defaults.js +9 -0
  204. package/dist/runtime/utils/tree-selection.d.ts +2 -15
  205. package/dist/runtime/utils/tv.d.ts +1 -1
  206. package/dist/runtime/vue/plugins/zod.d.ts +7 -0
  207. package/dist/runtime/vue/plugins/zod.js +12 -0
  208. package/dist/shared/{nuxt.DfVF6ZZv.mjs → nuxt.CbmfnBRt.mjs} +82 -236
  209. package/dist/unplugin.d.mts +3 -2
  210. package/dist/unplugin.mjs +22 -22
  211. package/dist/vite.d.mts +1 -0
  212. package/dist/vite.mjs +2 -1
  213. package/package.json +39 -34
  214. package/vue-plugin.d.ts +7 -1
  215. package/dist/runtime/components/ColorChooser.d.vue.ts +0 -36
  216. package/dist/runtime/components/ColorChooser.vue +0 -328
  217. package/dist/runtime/components/ColorChooser.vue.d.ts +0 -36
  218. package/dist/runtime/components/PillGroup.d.vue.ts +0 -33
  219. package/dist/runtime/components/PillGroup.vue +0 -291
  220. package/dist/runtime/components/PillGroup.vue.d.ts +0 -33
  221. package/dist/runtime/components/Popconfirm.d.vue.ts +0 -30
  222. package/dist/runtime/components/Popconfirm.vue +0 -143
  223. package/dist/runtime/components/Popconfirm.vue.d.ts +0 -30
  224. package/dist/runtime/components/SlideVerify.d.vue.ts +0 -41
  225. package/dist/runtime/components/SlideVerify.vue +0 -174
  226. package/dist/runtime/components/SlideVerify.vue.d.ts +0 -41
  227. package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +0 -32
  228. package/dist/runtime/components/input/AsPhoneNumberInput.vue +0 -48
  229. package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +0 -32
  230. package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +0 -32
  231. package/dist/runtime/components/input/WithCharacterLimit.vue +0 -54
  232. package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +0 -32
  233. package/dist/runtime/components/input/WithClear.d.vue.ts +0 -33
  234. package/dist/runtime/components/input/WithClear.vue +0 -60
  235. package/dist/runtime/components/input/WithClear.vue.d.ts +0 -33
  236. package/dist/runtime/components/input/WithCopy.d.vue.ts +0 -33
  237. package/dist/runtime/components/input/WithCopy.vue +0 -66
  238. package/dist/runtime/components/input/WithCopy.vue.d.ts +0 -33
  239. package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +0 -33
  240. package/dist/runtime/components/input/WithFloatingLabel.vue +0 -75
  241. package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +0 -33
  242. package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +0 -32
  243. package/dist/runtime/components/input/WithPasswordToggle.vue +0 -61
  244. package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +0 -32
  245. package/dist/runtime/domains/api/interceptors/compose.d.ts +0 -24
  246. package/dist/runtime/domains/api/interceptors/compose.js +0 -18
  247. package/dist/runtime/domains/api/interceptors/error.d.ts +0 -13
  248. package/dist/runtime/domains/api/interceptors/error.js +0 -26
  249. package/dist/runtime/domains/api/interceptors/unauthorized.d.ts +0 -12
  250. package/dist/runtime/domains/api/interceptors/unauthorized.js +0 -34
  251. package/dist/runtime/domains/api/transfer.d.ts +0 -69
  252. package/dist/runtime/domains/api/transfer.js +0 -87
  253. package/dist/runtime/types/components/color-chooser.d.ts +0 -109
  254. package/dist/runtime/types/components/input/as-phone-number-input.d.ts +0 -17
  255. package/dist/runtime/types/components/input/index.d.ts +0 -6
  256. package/dist/runtime/types/components/input/index.js +0 -0
  257. package/dist/runtime/types/components/input/with-character-limit.d.ts +0 -11
  258. package/dist/runtime/types/components/input/with-character-limit.js +0 -0
  259. package/dist/runtime/types/components/input/with-clear.d.ts +0 -10
  260. package/dist/runtime/types/components/input/with-clear.js +0 -0
  261. package/dist/runtime/types/components/input/with-copy.d.ts +0 -11
  262. package/dist/runtime/types/components/input/with-copy.js +0 -0
  263. package/dist/runtime/types/components/input/with-floating-label.d.ts +0 -12
  264. package/dist/runtime/types/components/input/with-floating-label.js +0 -0
  265. package/dist/runtime/types/components/input/with-password-toggle.d.ts +0 -7
  266. package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
  267. package/dist/runtime/types/components/pill-group.d.ts +0 -103
  268. package/dist/runtime/types/components/pill-group.js +0 -0
  269. package/dist/runtime/types/components/popconfirm.d.ts +0 -74
  270. package/dist/runtime/types/components/popconfirm.js +0 -0
  271. package/dist/runtime/types/components/slide-verify.d.ts +0 -54
  272. package/dist/runtime/types/components/slide-verify.js +0 -0
  273. /package/dist/runtime/types/{components/color-chooser.js → locale.js} +0 -0
  274. /package/dist/runtime/types/{components/input/as-phone-number-input.js → zod-config.js} +0 -0
@@ -1,291 +0,0 @@
1
- <script setup>
2
- import { computed, ref } from "vue";
3
- import { FieldGroupReset } from "@nuxt/ui/composables/useFieldGroup";
4
- import { UButton } from "#components";
5
- import { useAppConfig } from "#imports";
6
- import { createEqualsBy, getPath } from "@movk/core";
7
- import theme from "#build/movk-ui/pill-group";
8
- import { useExtendedTv } from "../utils/extend-theme";
9
- import { useFieldControl } from "../utils/form-control";
10
- const props = defineProps({
11
- items: { type: Array, required: false },
12
- valueKey: { type: null, required: false },
13
- labelKey: { type: null, required: false, default: "label" },
14
- descriptionKey: { type: null, required: false, default: "description" },
15
- by: { type: [String, Function], required: false },
16
- orientation: { type: String, required: false, default: "horizontal" },
17
- size: { type: null, required: false },
18
- color: { type: null, required: false },
19
- activeVariant: { type: null, required: false, default: "solid" },
20
- inactiveVariant: { type: null, required: false, default: "soft" },
21
- disabled: { type: Boolean, required: false },
22
- multiple: { type: Boolean, required: false },
23
- deselectable: { type: Boolean, required: false, default: false },
24
- max: { type: Number, required: false },
25
- min: { type: Number, required: false },
26
- defaultValue: { type: null, required: false },
27
- modelValue: { type: null, required: false },
28
- class: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
29
- ui: { type: Object, required: false }
30
- });
31
- const modelValue = defineModel({ type: null });
32
- const emits = defineEmits(["blur", "focus", "change", "update:modelValue", "select"]);
33
- const slots = defineSlots();
34
- const appConfig = useAppConfig();
35
- const {
36
- id,
37
- size: effectiveSize,
38
- color: effectiveColor,
39
- disabled: effectiveDisabled,
40
- fieldGroupOrientation,
41
- ariaAttrs,
42
- emitFormChange,
43
- emitFormFocus,
44
- emitFormBlur,
45
- emitFormInput
46
- } = useFieldControl(props);
47
- const focusWithin = ref(false);
48
- const { extendUi } = useExtendedTv(
49
- { slots: {} },
50
- theme,
51
- () => appConfig.movk?.pillGroup,
52
- () => ({
53
- ui: {
54
- ...props.ui,
55
- root: [props.ui?.root, props.class]
56
- },
57
- variants: {
58
- orientation: props.orientation,
59
- fieldGroup: fieldGroupOrientation.value
60
- }
61
- })
62
- );
63
- function isSelectItem(item) {
64
- return typeof item === "object" && item !== null;
65
- }
66
- function getItemValue(item) {
67
- if (!isSelectItem(item)) return item;
68
- if (!props.valueKey) return item;
69
- return getPath(item, props.valueKey);
70
- }
71
- function getItemKey(item, idx) {
72
- if (!isSelectItem(item)) return `v:${String(item)}`;
73
- if (props.valueKey) {
74
- const v = getPath(item, props.valueKey);
75
- if (v != null && typeof v !== "object") return `v:${String(v)}`;
76
- }
77
- const valueField = getPath(item, "value");
78
- if (valueField != null && typeof valueField !== "object") return `v:${String(valueField)}`;
79
- const label = getPath(item, props.labelKey ?? "label");
80
- if (label) return `l:${label}`;
81
- return `i:${idx}`;
82
- }
83
- function getItemLabel(item) {
84
- if (!isSelectItem(item)) return String(item);
85
- const label = getPath(item, props.labelKey ?? "label");
86
- if (label != null) return String(label);
87
- const value = getPath(item, "value");
88
- return value != null ? String(value) : "";
89
- }
90
- function getItemDescription(item) {
91
- if (!isSelectItem(item)) return void 0;
92
- const desc = getPath(item, props.descriptionKey ?? "description");
93
- return desc == null ? void 0 : String(desc);
94
- }
95
- const itemEquals = computed(() => createEqualsBy({
96
- by: props.by,
97
- keys: [props.valueKey, "value", props.labelKey ?? "label"]
98
- }));
99
- const selectedArray = computed(() => {
100
- if (!props.multiple) return [];
101
- const v = modelValue.value;
102
- return Array.isArray(v) ? v : [];
103
- });
104
- const selectedKeyMap = computed(() => {
105
- if (!props.multiple || !props.by || typeof props.by !== "string") return null;
106
- const m = /* @__PURE__ */ new Map();
107
- for (const v of selectedArray.value) {
108
- const key = isSelectItem(v) ? getPath(v, props.by) : v;
109
- m.set(key, true);
110
- }
111
- return m;
112
- });
113
- function isSelected(item) {
114
- const target = getItemValue(item);
115
- if (props.multiple) {
116
- if (selectedKeyMap.value) {
117
- const key = isSelectItem(target) ? getPath(target, props.by) : target;
118
- return selectedKeyMap.value.has(key);
119
- }
120
- return selectedArray.value.some((v) => itemEquals.value(v, target));
121
- }
122
- if (modelValue.value === void 0) return false;
123
- return itemEquals.value(modelValue.value, target);
124
- }
125
- function isItemDisabled(item) {
126
- return isSelectItem(item) && item.disabled === true;
127
- }
128
- const reachedMax = computed(
129
- () => !!(props.multiple && props.max != null && selectedArray.value.length >= props.max)
130
- );
131
- function isItemLocked(item) {
132
- return reachedMax.value && !isSelected(item);
133
- }
134
- function isClickBlocked(item) {
135
- if (!props.multiple || props.min == null) return false;
136
- return isSelected(item) && selectedArray.value.length <= props.min;
137
- }
138
- function emitSelect(item, index, selected) {
139
- emits("select", {
140
- item,
141
- value: getItemValue(item),
142
- selected,
143
- index
144
- });
145
- }
146
- function handleClick(e, item, index) {
147
- if (effectiveDisabled.value || isItemDisabled(item)) return;
148
- if (props.multiple && (isItemLocked(item) || isClickBlocked(item))) return;
149
- if (isSelectItem(item) && typeof item.onSelect === "function") {
150
- item.onSelect(e);
151
- }
152
- if (props.multiple) {
153
- const arr = selectedArray.value;
154
- const target = getItemValue(item);
155
- const wasSelected = isSelected(item);
156
- const next = wasSelected ? arr.filter((v) => !itemEquals.value(v, target)) : [...arr, target];
157
- modelValue.value = next;
158
- emits("change", next);
159
- emitSelect(item, index, !wasSelected);
160
- } else {
161
- const next = getItemValue(item);
162
- const wasSelected = isSelected(item);
163
- const finalValue = props.deselectable && wasSelected ? void 0 : next;
164
- if (itemEquals.value(modelValue.value, finalValue)) return;
165
- modelValue.value = finalValue;
166
- emits("change", finalValue);
167
- emitSelect(item, index, !wasSelected);
168
- }
169
- emitFormChange();
170
- emitFormInput();
171
- }
172
- function isDisabledItem(item) {
173
- return effectiveDisabled.value || isItemDisabled(item) || isItemLocked(item);
174
- }
175
- function handleFocusIn() {
176
- if (focusWithin.value) return;
177
- focusWithin.value = true;
178
- emitFormFocus();
179
- }
180
- function handleFocusOut(event) {
181
- const nextTarget = event.relatedTarget;
182
- if (nextTarget instanceof Node && event.currentTarget.contains(nextTarget)) return;
183
- focusWithin.value = false;
184
- emitFormBlur();
185
- }
186
- function hasLeading(item) {
187
- return isSelectItem(item) && (!!item.icon || !!item.avatar);
188
- }
189
- </script>
190
-
191
- <template>
192
- <div :class="extendUi.root" data-slot="root">
193
- <FieldGroupReset>
194
- <slot name="leading" :model-value="modelValue" :items="items ?? []" />
195
-
196
- <slot :model-value="modelValue" :items="items ?? []">
197
- <div
198
- :id="id"
199
- :role="props.multiple ? 'group' : void 0"
200
- :class="extendUi.list"
201
- data-slot="list"
202
- v-bind="ariaAttrs"
203
- @focusin="handleFocusIn"
204
- @focusout="handleFocusOut"
205
- >
206
- <template v-for="(item, idx) in items" :key="getItemKey(item, idx)">
207
- <slot
208
- name="item"
209
- :item="item"
210
- :index="idx"
211
- :selected="isSelected(item)"
212
- >
213
- <UButton
214
- :color="isSelectItem(item) && item.color ? item.color : effectiveColor"
215
- :size="effectiveSize"
216
- :disabled="isDisabledItem(item)"
217
- :variant="isSelected(item) ? isSelectItem(item) && item.variant ? item.variant : props.activeVariant : props.inactiveVariant"
218
- :class="[extendUi.item, isSelectItem(item) ? item.class : void 0]"
219
- @click="handleClick($event, item, idx)"
220
- >
221
- <span
222
- v-if="!!slots['item-leading'] || hasLeading(item)"
223
- :class="extendUi.leading"
224
- data-slot="leading"
225
- >
226
- <slot
227
- name="item-leading"
228
- :item="item"
229
- :index="idx"
230
- :selected="isSelected(item)"
231
- >
232
- <UIcon
233
- v-if="isSelectItem(item) && item.icon"
234
- :name="item.icon"
235
- :class="extendUi.leadingIcon"
236
- />
237
- <UAvatar
238
- v-else-if="isSelectItem(item) && item.avatar"
239
- v-bind="item.avatar"
240
- />
241
- </slot>
242
- </span>
243
-
244
- <span :class="extendUi.itemWrapper">
245
- <span :class="extendUi.itemLabel">
246
- <slot
247
- name="item-label"
248
- :item="item"
249
- :index="idx"
250
- :selected="isSelected(item)"
251
- >
252
- {{ getItemLabel(item) }}
253
- </slot>
254
- </span>
255
- <span
256
- v-if="getItemDescription(item) || !!slots['item-description']"
257
- :class="extendUi.itemDescription"
258
- >
259
- <slot
260
- name="item-description"
261
- :item="item"
262
- :index="idx"
263
- :selected="isSelected(item)"
264
- >
265
- {{ getItemDescription(item) }}
266
- </slot>
267
- </span>
268
- </span>
269
-
270
- <span
271
- v-if="!!slots['item-trailing']"
272
- :class="extendUi.trailing"
273
- data-slot="trailing"
274
- >
275
- <slot
276
- name="item-trailing"
277
- :item="item"
278
- :index="idx"
279
- :selected="isSelected(item)"
280
- />
281
- </span>
282
- </UButton>
283
- </slot>
284
- </template>
285
- </div>
286
- </slot>
287
-
288
- <slot name="trailing" :model-value="modelValue" :items="items ?? []" />
289
- </FieldGroupReset>
290
- </div>
291
- </template>
@@ -1,33 +0,0 @@
1
- import type { GetItemKeys, GetModelValue } from '@nuxt/ui';
2
- import type { PillGroupProps, PillGroupSlots, PillItem } from '../types/components/pill-group';
3
- declare const __VLS_export: <T extends PillItem, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(PillGroupProps<T, VK, M> & {
5
- orientation?: string | number | symbol;
6
- ui?: {
7
- [x: string]: import("@nuxt/ui").SlotClass;
8
- };
9
- } & {
10
- modelValue?: GetModelValue<T, VK, M>;
11
- }) & {
12
- onBlur?: ((event: FocusEvent) => any) | undefined;
13
- onChange?: ((value: GetModelValue<T, VK, M, undefined>) => any) | undefined;
14
- onFocus?: ((event: FocusEvent) => any) | undefined;
15
- onSelect?: ((payload: import("../types").PillSelectPayload<T>) => any) | undefined;
16
- "onUpdate:modelValue"?: ((value: GetModelValue<T, VK, M, undefined> | undefined) => any) | undefined;
17
- }> & (typeof globalThis extends {
18
- __VLS_PROPS_FALLBACK: infer P;
19
- } ? P : {});
20
- expose: (exposed: {}) => void;
21
- attrs: any;
22
- slots: PillGroupSlots<T, VK, M>;
23
- emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", value: GetModelValue<T, VK, M, undefined>) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "select", payload: import("../types").PillSelectPayload<T>) => void) & ((evt: "update:modelValue", value: GetModelValue<T, VK, M, undefined>) => void)) & ((event: "update:modelValue", value: GetModelValue<T, VK, M> | undefined) => void);
24
- }>) => import("vue").VNode & {
25
- __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
26
- };
27
- declare const _default: typeof __VLS_export;
28
- export default _default;
29
- type __VLS_PrettifyLocal<T> = (T extends any ? {
30
- [K in keyof T]: T[K];
31
- } : {
32
- [K in keyof T as K]: T[K];
33
- }) & {};
@@ -1,30 +0,0 @@
1
- import type { ComponentConfig } from '@nuxt/ui';
2
- import theme from '#build/movk-ui/popconfirm';
3
- import popoverTheme from '#build/ui/popover';
4
- import type { AppConfig } from 'nuxt/schema';
5
- import type { PopconfirmProps, PopconfirmSlots } from '../types/components/popconfirm';
6
- declare const __VLS_export: <M extends "click" | "hover">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
7
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(PopconfirmProps<"click" | "hover"> & {
8
- type?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "popconfirm">["variants"]["type"];
9
- ui?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "popconfirm">["slots"];
10
- }) & {
11
- onError?: ((error: unknown) => any) | undefined;
12
- onCancel?: (() => any) | undefined;
13
- onConfirm?: (() => any) | undefined;
14
- }> & (typeof globalThis extends {
15
- __VLS_PROPS_FALLBACK: infer P;
16
- } ? P : {});
17
- expose: (exposed: {}) => void;
18
- attrs: any;
19
- slots: PopconfirmSlots<"click" | "hover">;
20
- emit: ((evt: "error", error: unknown) => void) & ((evt: "cancel") => void) & ((evt: "confirm") => void);
21
- }>) => import("vue").VNode & {
22
- __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
23
- };
24
- declare const _default: typeof __VLS_export;
25
- export default _default;
26
- type __VLS_PrettifyLocal<T> = (T extends any ? {
27
- [K in keyof T]: T[K];
28
- } : {
29
- [K in keyof T as K]: T[K];
30
- }) & {};
@@ -1,143 +0,0 @@
1
- <script setup>
2
- import { isObject } from "@movk/core";
3
- import { UPopover, UButton, UIcon } from "#components";
4
- import { computed, ref, useAttrs } from "vue";
5
- import { useAppConfig } from "#imports";
6
- import { useExtendedTv } from "../utils/extend-theme";
7
- import theme from "#build/movk-ui/popconfirm";
8
- import popoverTheme from "#build/ui/popover";
9
- const props = defineProps({
10
- title: { type: String, required: false, default: "\u786E\u8BA4\u64CD\u4F5C" },
11
- description: { type: String, required: false, default: "\u8BF7\u786E\u8BA4\u662F\u5426\u6267\u884C\u6B64\u64CD\u4F5C?" },
12
- type: { type: String, required: false, default: "neutral" },
13
- icon: { type: null, required: false, default: "i-lucide-circle-question-mark" },
14
- arrow: { type: Boolean, required: false, default: true },
15
- confirmButton: { type: null, required: false },
16
- cancelButton: { type: [Object, Boolean], required: false, default: true },
17
- dismissible: { type: Boolean, required: false },
18
- onConfirm: { type: Function, required: false },
19
- ui: { type: Object, required: false }
20
- });
21
- const emits = defineEmits(["confirm", "cancel", "error"]);
22
- const slots = defineSlots();
23
- defineOptions({ inheritAttrs: false });
24
- const attrs = useAttrs();
25
- const appConfig = useAppConfig();
26
- const openState = ref(false);
27
- const { baseUi, extraUi } = useExtendedTv(
28
- popoverTheme,
29
- theme,
30
- () => appConfig.movk?.popconfirm,
31
- () => ({ ui: props.ui, variants: { type: props.type } })
32
- );
33
- const confirmLoading = ref(false);
34
- const iconMap = {
35
- primary: "i-lucide-bell",
36
- info: "i-lucide-info",
37
- success: "i-lucide-circle-check",
38
- warning: "i-lucide-triangle-alert",
39
- error: "i-lucide-circle-x",
40
- neutral: "i-lucide-circle-question-mark"
41
- };
42
- const resolvedIcon = computed(() => props.icon ?? iconMap[props.type]);
43
- const cancelButtonAttrs = computed(() => ({
44
- color: "neutral",
45
- size: "xs",
46
- label: "\u53D6\u6D88",
47
- variant: "soft",
48
- ...isObject(props.cancelButton) ? props.cancelButton : {}
49
- }));
50
- const confirmButtonAttrs = computed(() => ({
51
- color: "primary",
52
- size: "xs",
53
- label: "\u786E\u8BA4",
54
- ...props.confirmButton ?? {}
55
- }));
56
- function handleCancel(close) {
57
- if (confirmLoading.value) return;
58
- emits("cancel");
59
- close();
60
- }
61
- async function handleConfirm(close) {
62
- if (confirmLoading.value) return;
63
- try {
64
- const result = props.onConfirm?.();
65
- if (result instanceof Promise) {
66
- confirmLoading.value = true;
67
- await result;
68
- }
69
- emits("confirm");
70
- close();
71
- } catch (err) {
72
- emits("error", err);
73
- } finally {
74
- confirmLoading.value = false;
75
- }
76
- }
77
- </script>
78
-
79
- <template>
80
- <UPopover
81
- v-bind="attrs"
82
- v-model:open="openState"
83
- :dismissible="props.dismissible"
84
- :arrow="props.arrow"
85
- :ui="baseUi"
86
- >
87
- <template #default="{ open }">
88
- <slot :open="open" />
89
- </template>
90
-
91
- <template #content="{ close }">
92
- <div
93
- v-if="!!slots.header || (props.title || !!slots.title) || (props.description || !!slots.description)"
94
- data-slot="header"
95
- :class="extraUi.header"
96
- >
97
- <slot name="header" :close="close">
98
- <span
99
- v-if="props.title || !!slots.title"
100
- data-slot="title"
101
- :class="extraUi.title"
102
- >
103
- <slot name="title" :close="close">
104
- <UIcon :name="resolvedIcon" :class="extraUi.icon" />
105
- {{ props.title }}
106
- </slot>
107
- </span>
108
-
109
- <p
110
- v-if="props.description || !!slots.description"
111
- data-slot="description"
112
- :class="extraUi.description"
113
- >
114
- <slot name="description" :close="close">
115
- {{ props.description }}
116
- </slot>
117
- </p>
118
- </slot>
119
-
120
- <slot name="actions" :close="close" />
121
- </div>
122
-
123
- <div v-if="!!slots.body" data-slot="body" :class="extraUi.body">
124
- <slot name="body" :close="close" />
125
- </div>
126
-
127
- <div data-slot="footer" :class="extraUi.footer">
128
- <slot name="footer" :close="close">
129
- <UButton
130
- v-if="props.cancelButton !== false"
131
- v-bind="cancelButtonAttrs"
132
- @click="handleCancel(close)"
133
- />
134
- <UButton
135
- v-bind="confirmButtonAttrs"
136
- :loading="confirmLoading"
137
- @click="handleConfirm(close)"
138
- />
139
- </slot>
140
- </div>
141
- </template>
142
- </UPopover>
143
- </template>
@@ -1,30 +0,0 @@
1
- import type { ComponentConfig } from '@nuxt/ui';
2
- import theme from '#build/movk-ui/popconfirm';
3
- import popoverTheme from '#build/ui/popover';
4
- import type { AppConfig } from 'nuxt/schema';
5
- import type { PopconfirmProps, PopconfirmSlots } from '../types/components/popconfirm';
6
- declare const __VLS_export: <M extends "click" | "hover">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
7
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(PopconfirmProps<"click" | "hover"> & {
8
- type?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "popconfirm">["variants"]["type"];
9
- ui?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "popconfirm">["slots"];
10
- }) & {
11
- onError?: ((error: unknown) => any) | undefined;
12
- onCancel?: (() => any) | undefined;
13
- onConfirm?: (() => any) | undefined;
14
- }> & (typeof globalThis extends {
15
- __VLS_PROPS_FALLBACK: infer P;
16
- } ? P : {});
17
- expose: (exposed: {}) => void;
18
- attrs: any;
19
- slots: PopconfirmSlots<"click" | "hover">;
20
- emit: ((evt: "error", error: unknown) => void) & ((evt: "cancel") => void) & ((evt: "confirm") => void);
21
- }>) => import("vue").VNode & {
22
- __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
23
- };
24
- declare const _default: typeof __VLS_export;
25
- export default _default;
26
- type __VLS_PrettifyLocal<T> = (T extends any ? {
27
- [K in keyof T]: T[K];
28
- } : {
29
- [K in keyof T as K]: T[K];
30
- }) & {};
@@ -1,41 +0,0 @@
1
- import theme from '#build/movk-ui/slide-verify';
2
- import type { ComponentConfig } from '@nuxt/ui';
3
- import type { AppConfig } from 'nuxt/schema';
4
- import type { SlideVerifyProps, SlideVerifySlots } from '../types/components/slide-verify';
5
- type __VLS_Props = SlideVerifyProps & {
6
- size?: ComponentConfig<typeof theme, AppConfig, 'slideVerify'>['variants']['size'];
7
- ui?: ComponentConfig<typeof theme, AppConfig, 'slideVerify'>['slots'];
8
- };
9
- type __VLS_Slots = SlideVerifySlots;
10
- declare function reset(): void;
11
- type __VLS_ModelProps = {
12
- modelValue?: boolean;
13
- };
14
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
15
- declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
16
- reset: typeof reset;
17
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
- success: () => any;
19
- "update:modelValue": (value: boolean) => any;
20
- dragStart: () => any;
21
- dragEnd: (success: boolean) => any;
22
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
- onSuccess?: (() => any) | undefined;
24
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
25
- onDragStart?: (() => any) | undefined;
26
- onDragEnd?: ((success: boolean) => any) | undefined;
27
- }>, {
28
- icon: any;
29
- text: string;
30
- successText: string;
31
- successIcon: any;
32
- threshold: number;
33
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
35
- declare const _default: typeof __VLS_export;
36
- export default _default;
37
- type __VLS_WithSlots<T, S> = T & {
38
- new (): {
39
- $slots: S;
40
- };
41
- };