@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
package/README.en.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  English | [简体中文](./README.md)
4
4
 
5
- > A UI engineering toolkit built on top of Nuxt UI — Schema-driven AutoForm (Zod v4), a full-featured DataTable, standalone components and Composables. Get the complete capability set in Nuxt 4, including API integration with authentication and progress tracking; its UI, forms, tables, and theming also work directly in plain Vue + Vite projects through a Vite plugin (the API integration domain is Nuxt-only).
5
+ > An application toolkit for Nuxt and Vue. Generate forms from Zod schemas with AutoForm, build tables from column definitions with DataTable, and add standalone components and composables as needed. Nuxt projects can also integrate API requests, authentication, and file transfers.
6
6
 
7
7
  [![Install MCP in Cursor](https://nuxt.mhaibaraai.cn/mcp/badge.svg)](https://nuxt.mhaibaraai.cn/mcp/deeplink)
8
8
  [![Install MCP in VS Code](https://nuxt.mhaibaraai.cn/mcp/badge.svg?ide=vscode)](https://nuxt.mhaibaraai.cn/mcp/deeplink?ide=vscode)
@@ -18,11 +18,11 @@ English | [简体中文](./README.md)
18
18
 
19
19
  ## ✨ Features
20
20
 
21
- Movk Nuxt is a UI engineering toolkit built on top of Nuxt UI, offering two ways to use it: the complete capability set with API integration in **Nuxt 4**, or its UI layer in plain **Vue + Vite** projects through a **Vite plugin**. The supported frameworks for each capability are:
21
+ Forms, tables, components, and theming build on Nuxt UI. Use them in **Nuxt 4** or with the plugins for **Vue + Vite**. API integration is available in **Nuxt 4**.
22
22
 
23
23
  - **AutoForm — Schema-driven forms** (✅ Nuxt | ✅ Vue + Vite) - Built on Zod v4 with a "define-is-render" model: a single Schema declares the data structure, validation rules, and UI configuration at once, automatically generating a complete form interface.
24
24
  - **DataTable — Data table** (✅ Nuxt | ✅ Vue + Vite) - Wraps TanStack Table, covering data columns, special columns (selection / index / expand / actions), tree-structured data, row interactions, appearance customization, pagination, and load-more.
25
- - **Standalone component library** (✅ Nuxt | ✅ Vue + Vite) - General-purpose UI components such as DatePicker, PillGroup, SearchForm, Tree, WithCopy, and ThemePicker, usable on their own without AutoForm.
25
+ - **Standalone component library** (✅ Nuxt | ✅ Vue + Vite) - General-purpose UI components such as DatePicker, SearchForm, Tree, MessageBox, and ThemePicker, usable on their own without AutoForm.
26
26
  - **Theming and Composables** (✅ Nuxt | ✅ Vue + Vite) - Non-server composition functions such as useTheme (theme read/write and export), useMessageBox (imperative dialogs), and useDateFormatter (i18n dates).
27
27
  - **API integration system** (✅ Nuxt | ❌ Vue + Vite) - The useApiFetch / useLazyApiFetch / useClientApiFetch trio plus useUploadWithProgress / useDownloadWithProgress, providing multi-endpoint support, automatic authentication, business status-code checks, data unwrapping, Toast notifications, and progress monitoring; **depends on the Nuxt server runtime and is available in Nuxt mode only**.
28
28
  - **Type safety** - Full TypeScript type inference, from Schema to form data, with component prop callbacks and event handler types derivable via indexed access.
@@ -30,8 +30,18 @@ Movk Nuxt is a UI engineering toolkit built on top of Nuxt UI, offering two ways
30
30
 
31
31
  ## 🚀 Getting Started
32
32
 
33
+ ### Use a Template
34
+
35
+ ```bash
36
+ npm create nuxt@latest -- -t gh:mhaibaraai/movk-nuxt-starter
37
+ ```
38
+
39
+ Or create a repository from the [Movk Nuxt Starter](https://github.com/mhaibaraai/movk-nuxt-starter) template on GitHub.
40
+
33
41
  ### Installation
34
42
 
43
+ Requires `@nuxt/ui >=4.13.0`.
44
+
35
45
  ```bash
36
46
  # pnpm
37
47
  pnpm add @movk/nuxt @nuxt/ui zod
@@ -113,7 +123,7 @@ const schema = afz.object({
113
123
  })
114
124
 
115
125
  // Type inference
116
- type Schema = z.output<typeof schema>
126
+ type Schema = z.input<typeof schema>
117
127
 
118
128
  // Form state
119
129
  const form = ref<Partial<Schema>>({})
@@ -125,7 +135,7 @@ async function onSubmit(event: FormSubmitEvent<Schema>) {
125
135
  </script>
126
136
 
127
137
  <template>
128
- <MAutoForm :schema="schema" :state="form" @submit="onSubmit" />
138
+ <MAutoForm :schema="schema" v-model="form" @submit="onSubmit" />
129
139
  </template>
130
140
  ```
131
141
 
@@ -276,7 +286,7 @@ Movk Nuxt adopts a clear layered architecture:
276
286
 
277
287
  - **Core Systems** - AutoForm (Schema-driven forms), DataTable (data table)
278
288
  - **API System** - useApiFetch / useLazyApiFetch / useClientApiFetch, useUploadWithProgress, useDownloadWithProgress, providing a complete API request solution
279
- - **Standalone Components** - Standalone UI components such as DatePicker, PillGroup, SearchForm, Tree, WithCopy, and ThemePicker
289
+ - **Standalone Components** - Standalone UI components such as DatePicker, SearchForm, Tree, MessageBox, and ThemePicker
280
290
  - **Composables** - General-purpose composition functions such as useDateFormatter, useTheme, useMessageBox, and useAutoForm
281
291
  - **Foundation** - Built on [Nuxt UI](https://ui.nuxt.com), [Zod v4](https://zod.dev), [VueUse](https://vueuse.org), and [TanStack Table](https://tanstack.com/table)
282
292
 
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  简体中文 | [English](./README.en.md)
4
4
 
5
- > 构建在 Nuxt UI 之上的 UI 工程套件 —— Schema 驱动的 AutoForm(Zod v4)、功能完备的 DataTable、独立组件与 Composables。在 Nuxt 4 中获得含认证与进度追踪的 API 集成在内的完整能力;其 UI、表单、表格与主题亦可经 Vite 插件直接用于纯 Vue + Vite 项目(API 集成域仅 Nuxt)。
5
+ > 面向 Nuxt 与 Vue 的应用开发工具包。用 AutoForm 从 Zod Schema 生成表单,用 DataTable 的列配置构建表格,再按需加入独立组件和组合式函数。Nuxt 项目还可统一处理 API 请求、认证和文件传输。
6
6
 
7
7
  [![Install MCP in Cursor](https://nuxt.mhaibaraai.cn/mcp/badge.svg)](https://nuxt.mhaibaraai.cn/mcp/deeplink)
8
8
  [![Install MCP in VS Code](https://nuxt.mhaibaraai.cn/mcp/badge.svg?ide=vscode)](https://nuxt.mhaibaraai.cn/mcp/deeplink?ide=vscode)
@@ -18,11 +18,11 @@
18
18
 
19
19
  ## ✨ 特性
20
20
 
21
- Movk Nuxt 是构建在 Nuxt UI 之上的 UI 工程套件,提供两种使用方式:在 **Nuxt 4** 中享受含 API 集成的完整能力,或经 **Vite 插件**在纯 **Vue + Vite** 项目中使用其 UI 层。各能力的可用框架如下:
21
+ 表单、表格、组件和主题基于 Nuxt UI,可在 **Nuxt 4** 中使用,也可通过插件接入 **Vue + Vite**。API 集成适用于 **Nuxt 4**。
22
22
 
23
23
  - **AutoForm — Schema 驱动表单**(✅ Nuxt | ✅ Vue + Vite)- 基于 Zod v4 的「定义即渲染」,一份 Schema 同时声明数据结构、验证规则和 UI 配置,自动生成完整表单界面。
24
24
  - **DataTable — 数据表格**(✅ Nuxt | ✅ Vue + Vite)- 基于 TanStack Table 封装,覆盖数据列、特殊列(选择/索引/展开/操作)、树形数据、行交互、外观定制、分页与加载更多。
25
- - **独立组件库**(✅ Nuxt | ✅ Vue + Vite)- DatePicker、PillGroup、SearchForm、Tree、WithCopy、ThemePicker 等通用 UI 组件,无需依赖 AutoForm 即可独立使用。
25
+ - **独立组件库**(✅ Nuxt | ✅ Vue + Vite)- DatePicker、SearchForm、Tree、MessageBox、ThemePicker 等通用 UI 组件,无需依赖 AutoForm 即可独立使用。
26
26
  - **主题与 Composables**(✅ Nuxt | ✅ Vue + Vite)- useTheme(主题读写与导出)、useMessageBox(命令式弹窗)、useDateFormatter(国际化日期)等非服务端组合式函数。
27
27
  - **API 集成系统**(✅ Nuxt | ❌ Vue + Vite)- useApiFetch / useLazyApiFetch / useClientApiFetch 三件套 + useUploadWithProgress / useDownloadWithProgress,提供多端点、自动认证、业务状态码检查、数据解包、Toast 提示和进度监控;**依赖 Nuxt 服务端运行时,仅 Nuxt 模式可用**。
28
28
  - **类型安全** - 完整的 TypeScript 类型推断,从 Schema 到表单数据,组件 prop 回调与事件处理类型可索引访问派生。
@@ -30,8 +30,18 @@ Movk Nuxt 是构建在 Nuxt UI 之上的 UI 工程套件,提供两种使用方
30
30
 
31
31
  ## 🚀 快速开始
32
32
 
33
+ ### 使用模版
34
+
35
+ ```bash
36
+ npm create nuxt@latest -- -t gh:mhaibaraai/movk-nuxt-starter
37
+ ```
38
+
39
+ 或在 GitHub 上使用 [Movk Nuxt Starter](https://github.com/mhaibaraai/movk-nuxt-starter) 模版创建仓库。
40
+
33
41
  ### 安装
34
42
 
43
+ 需要 `@nuxt/ui >=4.13.0`。
44
+
35
45
  ```bash
36
46
  # pnpm
37
47
  pnpm add @movk/nuxt @nuxt/ui zod
@@ -113,7 +123,7 @@ const schema = afz.object({
113
123
  })
114
124
 
115
125
  // 类型推导
116
- type Schema = z.output<typeof schema>
126
+ type Schema = z.input<typeof schema>
117
127
 
118
128
  // 表单状态
119
129
  const form = ref<Partial<Schema>>({})
@@ -125,7 +135,7 @@ async function onSubmit(event: FormSubmitEvent<Schema>) {
125
135
  </script>
126
136
 
127
137
  <template>
128
- <MAutoForm :schema="schema" :state="form" @submit="onSubmit" />
138
+ <MAutoForm :schema="schema" v-model="form" @submit="onSubmit" />
129
139
  </template>
130
140
  ```
131
141
 
@@ -276,7 +286,7 @@ Movk Nuxt 采用清晰的分层架构:
276
286
 
277
287
  - **Core Systems** - AutoForm(Schema 驱动表单)、DataTable(数据表格)
278
288
  - **API System** - useApiFetch / useLazyApiFetch / useClientApiFetch、useUploadWithProgress、useDownloadWithProgress,提供完整的 API 请求方案
279
- - **Standalone Components** - DatePicker、PillGroup、SearchForm、Tree、WithCopy、ThemePicker 等独立 UI 组件
289
+ - **Standalone Components** - DatePicker、SearchForm、Tree、MessageBox、ThemePicker 等独立 UI 组件
280
290
  - **Composables** - useDateFormatter、useTheme、useMessageBox、useAutoForm 等通用组合式函数
281
291
  - **Foundation** - 基于 [Nuxt UI](https://ui.nuxt.com)、[Zod v4](https://zod.dev)、[VueUse](https://vueuse.org)、[TanStack Table](https://tanstack.com/table)
282
292
 
package/dist/module.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { MovkApiFullConfig } from '../dist/runtime/types/api/module.js';
2
+ import { MovkZodOptions } from '../dist/runtime/types/zod-config.js';
2
3
  import { MovkFontFamily, ThemeFontOption } from '../dist/runtime/domains/theme/theme-font.js';
3
4
  import { ModuleOptions as ModuleOptions$1 } from '@nuxt/ui';
4
5
  import { NuxtModule } from 'nuxt/schema';
@@ -15,6 +16,11 @@ interface ModuleOptions {
15
16
  prefix?: string;
16
17
  /** API 模块配置 */
17
18
  api?: MovkApiFullConfig;
19
+ /**
20
+ * zod 校验文案本地化。全局配置使用固定语言或 fallback,当前应用的表单可另外覆盖错误映射
21
+ * @defaultValue false
22
+ */
23
+ zod?: MovkZodOptions | false;
18
24
  /** 图标模块配置 */
19
25
  icon?: {
20
26
  /**
package/dist/module.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@movk/nuxt",
3
- "version": "1.8.3",
3
+ "version": "2.0.0-beta.1",
4
4
  "configKey": "movk",
5
5
  "compatibility": {
6
- "nuxt": ">=4.4.2"
6
+ "nuxt": "^4.6.4"
7
7
  },
8
8
  "builder": {
9
- "@nuxt/module-builder": "1.0.3",
9
+ "@nuxt/module-builder": "1.0.4",
10
10
  "unbuild": "3.6.1"
11
11
  }
12
12
  }
package/dist/module.mjs CHANGED
@@ -1,21 +1,24 @@
1
1
  import { resolveAlias, useLogger, addPlugin, defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
2
2
  import defu, { defu as defu$1 } from 'defu';
3
- import { U as UI_COMPONENTS, r as resolveMovkIcons, f as formatMissingCollections, a as addTemplates } from './shared/nuxt.DfVF6ZZv.mjs';
3
+ import { i as includeMovkUiComponents, r as resolveMovkIcons, f as formatMissingCollections, a as addTemplates } from './shared/nuxt.CbmfnBRt.mjs';
4
4
  import { getPackageJsonMetadata } from '../dist/runtime/utils/meta.js';
5
5
  import { kebabCase } from 'scule';
6
6
  import { updateSiteConfig } from 'nuxt-site-config/kit';
7
7
  import { readFile } from 'node:fs/promises';
8
- import { getDefaultConfig } from '../dist/runtime/utils/theme-defaults.js';
8
+ import { getDefaultConfig, UI_COLOR_DEFAULTS } from '../dist/runtime/utils/theme-defaults.js';
9
9
  import { resolveFontSource, resolveFontLinks, resolveFontWarning } from '../dist/runtime/domains/theme/theme-font.js';
10
10
  export * from '../dist/runtime/types/index.js';
11
11
  import 'node:url';
12
+ import '../dist/runtime/domains/zod/locale-map.js';
12
13
  import 'node:fs';
13
14
  import 'node:module';
14
15
  import 'pathe';
15
16
  import 'tinyglobby';
16
17
 
17
18
  const name = "@movk/nuxt";
18
- const version = "1.8.3";
19
+ const version = "2.0.0-beta.1";
20
+ const peerDependencies = {
21
+ "@nuxt/ui": ">=4.13.0"};
19
22
 
20
23
  const MOVK_CSS_IMPORT = /@import\s+["']@movk\/nuxt["']/;
21
24
  async function checkMovkCss(nuxt) {
@@ -118,17 +121,7 @@ function addTheme(nuxt, resolve, theme) {
118
121
  getDefaultConfig(theme)
119
122
  );
120
123
  nuxt.options.appConfig.ui = defu(
121
- {
122
- colors: {
123
- primary: "blue",
124
- secondary: "blue",
125
- success: "green",
126
- info: "blue",
127
- warning: "yellow",
128
- error: "red",
129
- neutral: "slate"
130
- }
131
- },
124
+ { colors: { ...UI_COLOR_DEFAULTS } },
132
125
  nuxt.options.appConfig.ui || {}
133
126
  );
134
127
  addPlugin({
@@ -154,10 +147,10 @@ function resolveModuleDependencies(nuxt) {
154
147
  ui.fonts ??= false;
155
148
  return {
156
149
  "@nuxt/image": { version: ">=2.0.0" },
157
- "@nuxt/ui": { version: ">=4.6.0" },
150
+ "@nuxt/ui": { version: peerDependencies["@nuxt/ui"] },
158
151
  "@vueuse/nuxt": { version: ">=14.2.1" },
159
152
  ...usesSessionAuth(options.movk?.api) && { "nuxt-auth-utils": { version: ">=0.5.29" } },
160
- "nuxt-site-config": { version: ">=4.0.8" }
153
+ "nuxt-site-config": { version: "^5.0.3" }
161
154
  };
162
155
  }
163
156
  function usesSessionAuth(api) {
@@ -168,7 +161,7 @@ const movkModule = defineNuxtModule({
168
161
  name,
169
162
  version,
170
163
  configKey: "movk",
171
- compatibility: { nuxt: ">=4.4.2" }
164
+ compatibility: { nuxt: "^4.6.4" }
172
165
  },
173
166
  defaults: defaultOptions,
174
167
  moduleDependencies: resolveModuleDependencies,
@@ -176,15 +169,12 @@ const movkModule = defineNuxtModule({
176
169
  const { resolve } = createResolver(import.meta.url);
177
170
  nuxt.options.movk = options;
178
171
  nuxt.options.alias["#movk"] = resolve("./runtime");
179
- const movkUiDeps = UI_COMPONENTS.map((name2) => name2.slice(1));
180
172
  const uiOptions = nuxt.options;
181
173
  const ui = uiOptions.ui ??= {};
182
174
  const experimental = ui.experimental ??= {};
183
175
  const detection = experimental.componentDetection;
184
- if (detection === true) {
185
- experimental.componentDetection = movkUiDeps;
186
- } else if (Array.isArray(detection)) {
187
- experimental.componentDetection = [.../* @__PURE__ */ new Set([...detection, ...movkUiDeps])];
176
+ if (detection) {
177
+ experimental.componentDetection = includeMovkUiComponents(detection);
188
178
  }
189
179
  const componentIgnore = [];
190
180
  if (options.theme?.enabled === false) {
@@ -219,6 +209,9 @@ const movkModule = defineNuxtModule({
219
209
  nuxt.options.runtimeConfig.public.movkApi = publicConfig;
220
210
  addPlugin({ src: resolve("runtime/plugins/api.factory"), mode: "all" });
221
211
  }
212
+ if (options.zod) {
213
+ addPlugin({ src: resolve("runtime/plugins/zod"), mode: "all" });
214
+ }
222
215
  const meta = await getPackageJsonMetadata(nuxt.options.rootDir);
223
216
  nuxt.hook("modules:done", async () => {
224
217
  const site = defu$1(nuxt.options.site, {
@@ -6,19 +6,33 @@ import type { AppConfig } from 'nuxt/schema';
6
6
  declare const __VLS_export: <S extends z.ZodObject, T extends boolean = true, N 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<{
7
7
  props: import("vue").PublicProps & __VLS_PrettifyLocal<(AutoFormProps<S, T, N> & {
8
8
  ui?: ComponentConfig<typeof theme, AppConfig, "autoForm">["slots"];
9
+ } & {
10
+ modelValue?: N extends false ? Partial<InferInput<S>> : never;
9
11
  }) & {
10
12
  onError?: ((args_0: import("@nuxt/ui").FormErrorEvent) => any) | undefined;
13
+ onClear?: ((state: Partial<z.core.input<S>>) => any) | undefined;
14
+ onReset?: ((state: Partial<z.core.input<S>>) => any) | undefined;
15
+ "onUpdate:modelValue"?: ((value: (N extends false ? Partial<InferInput<S>> : never) | undefined) => any) | undefined;
11
16
  }> & (typeof globalThis extends {
12
17
  __VLS_PROPS_FALLBACK: infer P;
13
18
  } ? P : {});
14
19
  expose: (exposed: import("vue").ShallowUnwrapRef<{
15
20
  formRef: Readonly<import("vue").ShallowRef<any, any>>;
21
+ submit: () => Promise<any>;
22
+ validate: any;
16
23
  reset: () => void;
17
24
  clear: () => void;
25
+ setBaseline: (value?: {
26
+ [x: string]: any;
27
+ }) => void;
28
+ isDirty: import("vue").ComputedRef<boolean>;
29
+ dirtyFields: import("vue").ComputedRef<string[]>;
30
+ getFieldValue: (path: string) => unknown;
31
+ setFieldValue: (path: string, value: unknown) => void;
18
32
  }>) => void;
19
33
  attrs: any;
20
34
  slots: AutoFormSlots<N extends false ? Partial<InferInput<S>> : never>;
21
- emit: (evt: "error", args_0: import("@nuxt/ui").FormErrorEvent) => void;
35
+ emit: (((evt: "error", args_0: import("@nuxt/ui").FormErrorEvent) => void) & ((evt: "clear", state: Partial<z.core.input<S>>) => void) & ((evt: "reset", state: Partial<z.core.input<S>>) => void)) & ((event: "update:modelValue", value: (N extends false ? Partial<InferInput<S>> : never) | undefined) => void);
22
36
  }>) => import("vue").VNode & {
23
37
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
24
38
  };
@@ -1,18 +1,17 @@
1
1
  <script setup>
2
2
  import { UForm } from "#components";
3
- import { computed, onMounted, ref, toRaw, unref, useAttrs, useTemplateRef } from "vue";
4
- import { deepClone, isFunction } from "@movk/core";
5
- import { useAutoFormProvider } from "../domains/auto-form/provider";
6
- import { applyFieldDefaults, classifyFields } from "../domains/auto-form/fields";
7
- import { extractPureSchema, introspectSchema, omitFields } from "../domains/auto-form/schema";
8
- import { DEFAULT_CONTROLS } from "../domains/auto-form/controls";
3
+ import { computed, ref, useAttrs, useTemplateRef } from "vue";
4
+ import { classifyFields } from "../domains/auto-form/fields";
5
+ import { useAutoFormCore } from "../domains/auto-form/useAutoFormCore";
9
6
  import AutoFormRendererChildren from "../domains/auto-form/components/Children.vue";
10
7
  import AutoFormRendererField from "../domains/auto-form/components/Field.vue";
11
8
  import { useExtendedTv } from "../utils/extend-theme";
9
+ import { useMovkLocale } from "../composables/useMovkLocale";
12
10
  import theme from "#build/movk-ui/auto-form";
13
11
  import { useAppConfig } from "#imports";
14
12
  const props = defineProps({
15
13
  state: { type: null, required: false },
14
+ loading: { type: Boolean, required: false },
16
15
  submit: { type: Boolean, required: false, default: true },
17
16
  submitButtonProps: { type: Object, required: false },
18
17
  addButtonProps: { type: Object, required: false },
@@ -21,38 +20,35 @@ const props = defineProps({
21
20
  globalMeta: { type: Object, required: false },
22
21
  loadingAuto: { type: Boolean, required: false, default: true },
23
22
  validateOn: { type: Array, required: false, default: () => [] },
23
+ hiddenValue: { type: String, required: false },
24
+ onSubmit: { type: Function, required: false },
24
25
  class: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
25
26
  ui: { type: Object, required: false }
26
27
  });
27
- const emits = defineEmits(["error"]);
28
+ const modelValue = defineModel({ type: null });
29
+ const emits = defineEmits(["error", "reset", "clear"]);
28
30
  const slots = defineSlots();
29
31
  defineOptions({ inheritAttrs: false });
30
32
  const attrs = useAttrs();
33
+ const { t } = useMovkLocale();
31
34
  const appConfig = useAppConfig();
32
- const initialState = deepClone(toRaw(props.state ?? {}));
33
- const stateModel = ref(props.state ?? {});
35
+ if (import.meta.dev && props.state !== void 0) {
36
+ console.warn("[AutoForm] The `state` prop is deprecated, use `v-model` instead.");
37
+ }
38
+ const localState = ref({});
39
+ const stateModel = computed(() => modelValue.value ?? props.state ?? localState.value);
34
40
  const formRef = useTemplateRef("formRef");
35
- const { resolveFieldProp } = useAutoFormProvider(stateModel, slots);
36
- const resolvedButtonSize = computed(() => {
37
- const size = props.globalMeta?.size;
38
- if (size === void 0 || isFunction(size)) return void 0;
39
- return unref(size);
40
- });
41
- const controlsMapping = computed(() => ({ ...DEFAULT_CONTROLS, ...props.controls }));
42
- const fields = computed(() => props.schema ? introspectSchema(props.schema, controlsMapping.value, "", props.globalMeta) : []);
43
- const visibleFields = computed(
44
- () => fields.value.filter(
45
- (field) => field && (field.meta?.if === void 0 || resolveFieldProp(field, "if") === true)
46
- )
47
- );
48
- const pureSchema = computed(() => {
49
- if (!props.schema) return props.schema;
50
- const base = extractPureSchema(props.schema);
51
- const hiddenKeys = fields.value.filter((field) => field?.meta?.if !== void 0 && resolveFieldProp(field, "if") !== true).map((field) => field.path);
52
- return omitFields(base, hiddenKeys);
41
+ const core = useAutoFormCore({
42
+ schema: () => props.schema,
43
+ controls: () => props.controls,
44
+ globalMeta: () => props.globalMeta,
45
+ hiddenValue: () => props.hiddenValue,
46
+ model: stateModel,
47
+ slots,
48
+ addButtonProps: () => props.addButtonProps
53
49
  });
50
+ const { visibleFields, validationSchema, resolvedButtonSize } = core;
54
51
  const renderData = computed(() => {
55
- if (!fields.value.length) return null;
56
52
  const classified = classifyFields(visibleFields.value);
57
53
  return {
58
54
  ...classified,
@@ -72,24 +68,28 @@ const { extendUi } = useExtendedTv(
72
68
  })
73
69
  );
74
70
  function reset() {
75
- const target = stateModel.value;
76
- for (const key of Object.keys(target)) Reflect.deleteProperty(target, key);
77
- Object.assign(target, deepClone(initialState));
78
- applyFieldDefaults(fields.value, target);
71
+ const next = core.reset();
79
72
  formRef.value?.clear();
73
+ emits("reset", next);
80
74
  }
81
75
  function clear() {
82
- const target = stateModel.value;
83
- for (const key of Object.keys(target)) Reflect.deleteProperty(target, key);
76
+ const next = core.clear();
84
77
  formRef.value?.clear();
78
+ emits("clear", next);
85
79
  }
86
- onMounted(() => {
87
- applyFieldDefaults(fields.value, stateModel.value);
88
- });
80
+ const submit = async () => formRef.value?.submit();
81
+ const validate = ((...args) => formRef.value?.validate(...args));
89
82
  defineExpose({
90
83
  formRef,
84
+ submit,
85
+ validate,
91
86
  reset,
92
- clear
87
+ clear,
88
+ setBaseline: core.setBaseline,
89
+ isDirty: core.isDirty,
90
+ dirtyFields: core.dirtyFields,
91
+ getFieldValue: core.getFieldValue,
92
+ setFieldValue: core.setFieldValue
93
93
  });
94
94
  </script>
95
95
 
@@ -101,29 +101,28 @@ defineExpose({
101
101
  }"
102
102
  >
103
103
  <UForm
104
- v-if="renderData"
105
104
  ref="formRef"
106
105
  :state="stateModel"
107
- :schema="pureSchema"
106
+ :schema="validationSchema"
108
107
  :loading-auto="props.loadingAuto"
109
108
  :validate-on="props.validateOn"
110
109
  data-slot="form"
111
110
  v-bind="attrs"
111
+ :on-submit="props.onSubmit"
112
112
  :ui="{
113
113
  base: extendUi.base
114
114
  }"
115
115
  @error="emits('error', $event)"
116
116
  >
117
- <template #default="{ errors, loading }">
117
+ <template #default="{ errors, loading: submitting }">
118
118
  <div v-if="$slots.header" :class="extendUi.header" data-slot="header">
119
- <slot name="header" v-bind="{ errors, loading, fields: visibleFields, state: stateModel }" />
119
+ <slot name="header" v-bind="{ errors, loading: props.loading || submitting, fields: visibleFields, state: stateModel }" />
120
120
  </div>
121
121
 
122
122
  <template v-if="renderData.hasComplexFields">
123
123
  <AutoFormRendererChildren
124
124
  :fields="renderData.allFields"
125
- :schema="schema"
126
- :extra-props="{ errors, loading }"
125
+ :extra-props="{ errors, loading: props.loading || submitting }"
127
126
  />
128
127
  </template>
129
128
 
@@ -132,22 +131,21 @@ defineExpose({
132
131
  v-for="field in renderData.flatFields"
133
132
  :key="field.path"
134
133
  :field="field"
135
- :schema="schema"
136
- :extra-props="{ errors, loading }"
134
+ :extra-props="{ errors, loading: props.loading || submitting }"
137
135
  />
138
136
  </template>
139
137
 
140
138
  <div v-if="$slots.footer" :class="extendUi.footer" data-slot="footer">
141
- <slot name="footer" v-bind="{ errors, loading, fields: visibleFields, state: stateModel }" />
139
+ <slot name="footer" v-bind="{ errors, loading: props.loading || submitting, fields: visibleFields, state: stateModel }" />
142
140
  </div>
143
141
 
144
142
  <div v-if="props.submit" :class="extendUi.actions" data-slot="submit">
145
- <slot name="submit" v-bind="{ errors, loading, fields: visibleFields, state: stateModel }">
143
+ <slot name="submit" v-bind="{ errors, loading: props.loading || submitting, fields: visibleFields, state: stateModel }">
146
144
  <UButton
147
145
  type="submit"
148
- label="提交"
146
+ :label="t('autoForm.submit')"
149
147
  block
150
- :loading="loading"
148
+ :loading="props.loading || submitting"
151
149
  :loading-auto="props.loadingAuto"
152
150
  :size="resolvedButtonSize"
153
151
  :disabled="attrs.disabled"
@@ -6,19 +6,33 @@ import type { AppConfig } from 'nuxt/schema';
6
6
  declare const __VLS_export: <S extends z.ZodObject, T extends boolean = true, N 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<{
7
7
  props: import("vue").PublicProps & __VLS_PrettifyLocal<(AutoFormProps<S, T, N> & {
8
8
  ui?: ComponentConfig<typeof theme, AppConfig, "autoForm">["slots"];
9
+ } & {
10
+ modelValue?: N extends false ? Partial<InferInput<S>> : never;
9
11
  }) & {
10
12
  onError?: ((args_0: import("@nuxt/ui").FormErrorEvent) => any) | undefined;
13
+ onClear?: ((state: Partial<z.core.input<S>>) => any) | undefined;
14
+ onReset?: ((state: Partial<z.core.input<S>>) => any) | undefined;
15
+ "onUpdate:modelValue"?: ((value: (N extends false ? Partial<InferInput<S>> : never) | undefined) => any) | undefined;
11
16
  }> & (typeof globalThis extends {
12
17
  __VLS_PROPS_FALLBACK: infer P;
13
18
  } ? P : {});
14
19
  expose: (exposed: import("vue").ShallowUnwrapRef<{
15
20
  formRef: Readonly<import("vue").ShallowRef<any, any>>;
21
+ submit: () => Promise<any>;
22
+ validate: any;
16
23
  reset: () => void;
17
24
  clear: () => void;
25
+ setBaseline: (value?: {
26
+ [x: string]: any;
27
+ }) => void;
28
+ isDirty: import("vue").ComputedRef<boolean>;
29
+ dirtyFields: import("vue").ComputedRef<string[]>;
30
+ getFieldValue: (path: string) => unknown;
31
+ setFieldValue: (path: string, value: unknown) => void;
18
32
  }>) => void;
19
33
  attrs: any;
20
34
  slots: AutoFormSlots<N extends false ? Partial<InferInput<S>> : never>;
21
- emit: (evt: "error", args_0: import("@nuxt/ui").FormErrorEvent) => void;
35
+ emit: (((evt: "error", args_0: import("@nuxt/ui").FormErrorEvent) => void) & ((evt: "clear", state: Partial<z.core.input<S>>) => void) & ((evt: "reset", state: Partial<z.core.input<S>>) => void)) & ((event: "update:modelValue", value: (N extends false ? Partial<InferInput<S>> : never) | undefined) => void);
22
36
  }>) => import("vue").VNode & {
23
37
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
24
38
  };
@@ -1,4 +1,4 @@
1
- import type { ColumnPinningState, ColumnSizingState, ExpandedState, PaginationState, RowPinningState, RowSelectionState, SortingState, VisibilityState } from '@tanstack/vue-table';
1
+ import type { ColumnOrderState, ColumnPinningState, ColumnSizingState, ExpandedState, PaginationState, RowPinningState, RowSelectionState, SortingState, VisibilityState } from '@tanstack/vue-table';
2
2
  import type { TableData } from '@nuxt/ui';
3
3
  import type { DataTableExposed, DataTableProps, DataTableSlots } from '../types/data-table/component';
4
4
  import type { DataTablePaginationUi } from '../types/data-table/pagination';
@@ -20,6 +20,7 @@ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Await
20
20
  rowSelection?: RowSelectionState;
21
21
  rowPinning?: RowPinningState;
22
22
  sorting?: SortingState;
23
+ columnOrder?: ColumnOrderState;
23
24
  expanded?: ExpandedState;
24
25
  columnVisibilityKeys?: string[];
25
26
  columnVisibilityExcludeKeys?: string[];
@@ -33,6 +34,7 @@ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Await
33
34
  "onUpdate:rowSelection"?: ((value: RowSelectionState | undefined) => any) | undefined;
34
35
  "onUpdate:rowPinning"?: ((value: RowPinningState) => any) | undefined;
35
36
  "onUpdate:sorting"?: ((value: SortingState) => any) | undefined;
37
+ "onUpdate:columnOrder"?: ((value: ColumnOrderState | undefined) => any) | undefined;
36
38
  "onUpdate:expanded"?: ((value: ExpandedState | undefined) => any) | undefined;
37
39
  "onUpdate:columnVisibilityKeys"?: ((value: string[] | undefined) => any) | undefined;
38
40
  "onUpdate:columnVisibilityExcludeKeys"?: ((value: string[] | undefined) => any) | undefined;
@@ -44,7 +46,7 @@ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Await
44
46
  expose: (exposed: import("vue").ShallowUnwrapRef<DataTableExposed<T>>) => void;
45
47
  attrs: any;
46
48
  slots: DataTableSlots<T>;
47
- emit: ((event: "update:pagination", value: PaginationState | undefined) => void) & ((event: "update:columnVisibility", value: VisibilityState | undefined) => void) & ((event: "update:columnPinning", value: ColumnPinningState | undefined) => void) & ((event: "update:columnSizing", value: ColumnSizingState | undefined) => void) & ((event: "update:rowSelection", value: RowSelectionState | undefined) => void) & ((event: "update:rowPinning", value: RowPinningState) => void) & ((event: "update:sorting", value: SortingState) => void) & ((event: "update:expanded", value: ExpandedState | undefined) => void) & ((event: "update:columnVisibilityKeys", value: string[] | undefined) => void) & ((event: "update:columnVisibilityExcludeKeys", value: string[] | undefined) => void) & ((event: "update:rowSelectionKeys", value: string[] | undefined) => void) & ((event: "update:expandedKeys", value: string[] | undefined) => void);
49
+ emit: ((event: "update:pagination", value: PaginationState | undefined) => void) & ((event: "update:columnVisibility", value: VisibilityState | undefined) => void) & ((event: "update:columnPinning", value: ColumnPinningState | undefined) => void) & ((event: "update:columnSizing", value: ColumnSizingState | undefined) => void) & ((event: "update:rowSelection", value: RowSelectionState | undefined) => void) & ((event: "update:rowPinning", value: RowPinningState) => void) & ((event: "update:sorting", value: SortingState) => void) & ((event: "update:columnOrder", value: ColumnOrderState | undefined) => void) & ((event: "update:expanded", value: ExpandedState | undefined) => void) & ((event: "update:columnVisibilityKeys", value: string[] | undefined) => void) & ((event: "update:columnVisibilityExcludeKeys", value: string[] | undefined) => void) & ((event: "update:rowSelectionKeys", value: string[] | undefined) => void) & ((event: "update:expandedKeys", value: string[] | undefined) => void);
48
50
  }>) => import("vue").VNode & {
49
51
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
50
52
  };