@movk/nuxt 1.1.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/.nuxt/movk-ui.css +3 -0
  2. package/README.md +75 -104
  3. package/dist/module.d.mts +59 -1
  4. package/dist/module.json +2 -2
  5. package/dist/module.mjs +136 -56
  6. package/dist/runtime/components/AutoForm.d.vue.ts +10 -31
  7. package/dist/runtime/components/AutoForm.vue +114 -148
  8. package/dist/runtime/components/AutoForm.vue.d.ts +10 -31
  9. package/dist/runtime/components/ColorChooser.d.vue.ts +20 -17
  10. package/dist/runtime/components/ColorChooser.vue +305 -31
  11. package/dist/runtime/components/ColorChooser.vue.d.ts +20 -17
  12. package/dist/runtime/components/DataTable.d.vue.ts +57 -0
  13. package/dist/runtime/components/DataTable.vue +584 -0
  14. package/dist/runtime/components/DataTable.vue.d.ts +57 -0
  15. package/dist/runtime/components/DatePicker.d.vue.ts +15 -22
  16. package/dist/runtime/components/DatePicker.vue +173 -65
  17. package/dist/runtime/components/DatePicker.vue.d.ts +15 -22
  18. package/dist/runtime/components/MessageBox.d.vue.ts +36 -0
  19. package/dist/runtime/components/MessageBox.vue +113 -0
  20. package/dist/runtime/components/MessageBox.vue.d.ts +36 -0
  21. package/dist/runtime/components/PillGroup.d.vue.ts +33 -0
  22. package/dist/runtime/components/PillGroup.vue +291 -0
  23. package/dist/runtime/components/PillGroup.vue.d.ts +33 -0
  24. package/dist/runtime/components/Popconfirm.d.vue.ts +30 -0
  25. package/dist/runtime/components/Popconfirm.vue +143 -0
  26. package/dist/runtime/components/Popconfirm.vue.d.ts +30 -0
  27. package/dist/runtime/components/SearchForm.d.vue.ts +43 -0
  28. package/dist/runtime/components/SearchForm.vue +274 -0
  29. package/dist/runtime/components/SearchForm.vue.d.ts +43 -0
  30. package/dist/runtime/components/SlideVerify.d.vue.ts +13 -79
  31. package/dist/runtime/components/SlideVerify.vue +117 -90
  32. package/dist/runtime/components/SlideVerify.vue.d.ts +13 -79
  33. package/dist/runtime/components/StarRating.d.vue.ts +25 -82
  34. package/dist/runtime/components/StarRating.vue +128 -99
  35. package/dist/runtime/components/StarRating.vue.d.ts +25 -82
  36. package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +32 -0
  37. package/dist/runtime/components/input/AsPhoneNumberInput.vue +48 -0
  38. package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +32 -0
  39. package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +13 -7
  40. package/dist/runtime/components/input/WithCharacterLimit.vue +27 -15
  41. package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +13 -7
  42. package/dist/runtime/components/input/WithClear.d.vue.ts +11 -5
  43. package/dist/runtime/components/input/WithClear.vue +29 -10
  44. package/dist/runtime/components/input/WithClear.vue.d.ts +11 -5
  45. package/dist/runtime/components/input/WithCopy.d.vue.ts +13 -7
  46. package/dist/runtime/components/input/WithCopy.vue +28 -11
  47. package/dist/runtime/components/input/WithCopy.vue.d.ts +13 -7
  48. package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +33 -0
  49. package/dist/runtime/components/input/WithFloatingLabel.vue +75 -0
  50. package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +33 -0
  51. package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +13 -7
  52. package/dist/runtime/components/input/WithPasswordToggle.vue +27 -10
  53. package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +13 -7
  54. package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +8 -1
  55. package/dist/runtime/components/theme-picker/ThemePicker.vue +37 -28
  56. package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +8 -1
  57. package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +5 -6
  58. package/dist/runtime/components/theme-picker/ThemePickerButton.vue +4 -0
  59. package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +5 -6
  60. package/dist/runtime/composables/index.d.ts +9 -8
  61. package/dist/runtime/composables/index.js +2 -1
  62. package/dist/runtime/composables/useApiFetch.d.ts +23 -15
  63. package/dist/runtime/composables/useApiFetch.js +21 -28
  64. package/dist/runtime/composables/useAutoForm.d.ts +14 -98
  65. package/dist/runtime/composables/useAutoForm.js +55 -161
  66. package/dist/runtime/composables/useClientApiFetch.d.ts +7 -7
  67. package/dist/runtime/composables/useDateFormatter.d.ts +16 -3
  68. package/dist/runtime/composables/useDateFormatter.js +89 -30
  69. package/dist/runtime/composables/useDownloadWithProgress.d.ts +26 -27
  70. package/dist/runtime/composables/useDownloadWithProgress.js +143 -42
  71. package/dist/runtime/composables/useLazyApiFetch.d.ts +19 -0
  72. package/dist/runtime/composables/useLazyApiFetch.js +4 -0
  73. package/dist/runtime/composables/useMessageBox.d.ts +6 -0
  74. package/dist/runtime/composables/useMessageBox.js +16 -0
  75. package/dist/runtime/composables/useTheme.d.ts +21 -8
  76. package/dist/runtime/composables/useTheme.js +109 -86
  77. package/dist/runtime/composables/useUploadWithProgress.d.ts +22 -28
  78. package/dist/runtime/composables/useUploadWithProgress.js +79 -68
  79. package/dist/runtime/domains/api/auth.d.ts +2 -0
  80. package/dist/runtime/domains/api/auth.js +31 -0
  81. package/dist/runtime/domains/api/endpoint-config.d.ts +11 -0
  82. package/dist/runtime/domains/api/endpoint-config.js +17 -0
  83. package/dist/runtime/domains/api/errors.d.ts +2 -0
  84. package/dist/runtime/domains/api/errors.js +10 -0
  85. package/dist/runtime/domains/api/fetch-key.d.ts +20 -0
  86. package/dist/runtime/domains/api/fetch-key.js +23 -0
  87. package/dist/runtime/domains/api/interceptors/error.d.ts +13 -0
  88. package/dist/runtime/domains/api/interceptors/error.js +49 -0
  89. package/dist/runtime/domains/api/interceptors/request.d.ts +12 -0
  90. package/dist/runtime/domains/api/interceptors/request.js +46 -0
  91. package/dist/runtime/domains/api/interceptors/response.d.ts +17 -0
  92. package/dist/runtime/domains/api/interceptors/response.js +27 -0
  93. package/dist/runtime/domains/api/response.d.ts +4 -0
  94. package/dist/runtime/domains/api/response.js +14 -0
  95. package/dist/runtime/domains/api/toast.d.ts +15 -0
  96. package/dist/runtime/domains/api/toast.js +46 -0
  97. package/dist/runtime/domains/api/transfer.d.ts +69 -0
  98. package/dist/runtime/domains/api/transfer.js +81 -0
  99. package/dist/runtime/domains/auto-form/actions.d.ts +2 -0
  100. package/dist/runtime/domains/auto-form/actions.js +4 -0
  101. package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +13 -0
  102. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererArray.vue → domains/auto-form/components/Array.vue} +37 -48
  103. package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +13 -0
  104. package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +11 -0
  105. package/dist/runtime/domains/auto-form/components/Children.vue +50 -0
  106. package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +11 -0
  107. package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +11 -0
  108. package/dist/runtime/domains/auto-form/components/Field.vue +56 -0
  109. package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +11 -0
  110. package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +11 -0
  111. package/dist/runtime/domains/auto-form/components/Layout.vue +89 -0
  112. package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +11 -0
  113. package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +11 -0
  114. package/dist/runtime/domains/auto-form/components/Nested.vue +47 -0
  115. package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +11 -0
  116. package/dist/runtime/{constants/auto-form.d.ts → domains/auto-form/constants.d.ts} +0 -2
  117. package/dist/runtime/{constants/auto-form.js → domains/auto-form/constants.js} +0 -25
  118. package/dist/runtime/domains/auto-form/controls.d.ts +41 -0
  119. package/dist/runtime/domains/auto-form/controls.js +73 -0
  120. package/dist/runtime/{utils/field-utils.d.ts → domains/auto-form/fields.d.ts} +7 -21
  121. package/dist/runtime/{utils/field-utils.js → domains/auto-form/fields.js} +19 -4
  122. package/dist/runtime/domains/auto-form/metadata.d.ts +22 -0
  123. package/dist/runtime/domains/auto-form/metadata.js +53 -0
  124. package/dist/runtime/domains/auto-form/provider.d.ts +62 -0
  125. package/dist/runtime/{internal/useAutoFormProvider.js → domains/auto-form/provider.js} +6 -3
  126. package/dist/runtime/domains/auto-form/reactive.d.ts +12 -0
  127. package/dist/runtime/{utils/reactive-utils.js → domains/auto-form/reactive.js} +1 -1
  128. package/dist/runtime/domains/auto-form/schema.d.ts +7 -0
  129. package/dist/runtime/{utils/schema-introspector.js → domains/auto-form/schema.js} +12 -10
  130. package/dist/runtime/domains/data-table/columns/constants.d.ts +50 -0
  131. package/dist/runtime/domains/data-table/columns/constants.js +19 -0
  132. package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +4 -0
  133. package/dist/runtime/domains/data-table/columns/resolve-columns.js +59 -0
  134. package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +9 -0
  135. package/dist/runtime/domains/data-table/columns/resolve-data-column.js +164 -0
  136. package/dist/runtime/domains/data-table/columns/resolve-group-column.d.ts +4 -0
  137. package/dist/runtime/domains/data-table/columns/resolve-group-column.js +19 -0
  138. package/dist/runtime/domains/data-table/columns/resolve-special-columns.d.ts +8 -0
  139. package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +232 -0
  140. package/dist/runtime/domains/data-table/columns/style.d.ts +11 -0
  141. package/dist/runtime/domains/data-table/columns/style.js +67 -0
  142. package/dist/runtime/domains/data-table/columns/utils.d.ts +6 -0
  143. package/dist/runtime/domains/data-table/columns/utils.js +16 -0
  144. package/dist/runtime/domains/data-table/components/ActionConfirm.d.vue.ts +10 -0
  145. package/dist/runtime/domains/data-table/components/ActionConfirm.vue +39 -0
  146. package/dist/runtime/domains/data-table/components/ActionConfirm.vue.d.ts +10 -0
  147. package/dist/runtime/domains/data-table/components/ActionsCell.d.vue.ts +11 -0
  148. package/dist/runtime/domains/data-table/components/ActionsCell.vue +91 -0
  149. package/dist/runtime/domains/data-table/components/ActionsCell.vue.d.ts +11 -0
  150. package/dist/runtime/domains/data-table/components/CellTooltip.d.vue.ts +9 -0
  151. package/dist/runtime/domains/data-table/components/CellTooltip.vue +40 -0
  152. package/dist/runtime/domains/data-table/components/CellTooltip.vue.d.ts +9 -0
  153. package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +26 -0
  154. package/dist/runtime/domains/data-table/components/Pagination.vue +132 -0
  155. package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +26 -0
  156. package/dist/runtime/domains/data-table/indent.d.ts +8 -0
  157. package/dist/runtime/domains/data-table/indent.js +19 -0
  158. package/dist/runtime/domains/data-table/tree-selection.d.ts +9 -0
  159. package/dist/runtime/domains/data-table/tree-selection.js +76 -0
  160. package/dist/runtime/{utils/theme.d.ts → domains/theme/theme-icons.d.ts} +0 -1
  161. package/dist/runtime/index.css +1 -0
  162. package/dist/runtime/plugins/api.factory.js +28 -171
  163. package/dist/runtime/plugins/theme.js +72 -70
  164. package/dist/runtime/types/api/config.d.ts +127 -0
  165. package/dist/runtime/types/api/fetch.d.ts +50 -0
  166. package/dist/runtime/types/api/index.d.ts +5 -0
  167. package/dist/runtime/types/api/module.d.ts +94 -0
  168. package/dist/runtime/types/api/response.d.ts +62 -0
  169. package/dist/runtime/types/api/transfer.d.ts +32 -0
  170. package/dist/runtime/types/api/transfer.js +0 -0
  171. package/dist/runtime/types/app.config.d.ts +6 -0
  172. package/dist/runtime/types/auto-form/base.d.ts +26 -0
  173. package/dist/runtime/types/auto-form/base.js +0 -0
  174. package/dist/runtime/types/auto-form/component.d.ts +28 -0
  175. package/dist/runtime/types/auto-form/component.js +0 -0
  176. package/dist/runtime/types/auto-form/controls.d.ts +45 -0
  177. package/dist/runtime/types/auto-form/controls.js +0 -0
  178. package/dist/runtime/types/auto-form/fields.d.ts +68 -0
  179. package/dist/runtime/types/auto-form/fields.js +0 -0
  180. package/dist/runtime/types/auto-form/index.d.ts +7 -0
  181. package/dist/runtime/types/auto-form/index.js +0 -0
  182. package/dist/runtime/types/auto-form/search-form.d.ts +84 -0
  183. package/dist/runtime/types/auto-form/search-form.js +0 -0
  184. package/dist/runtime/types/auto-form/slots.d.ts +85 -0
  185. package/dist/runtime/types/auto-form/slots.js +0 -0
  186. package/dist/runtime/types/auto-form/zod-factory.d.ts +127 -0
  187. package/dist/runtime/types/auto-form/zod-factory.js +0 -0
  188. package/dist/runtime/types/components/color-chooser.d.ts +109 -0
  189. package/dist/runtime/types/components/color-chooser.js +0 -0
  190. package/dist/runtime/types/components/date-picker.d.ts +41 -0
  191. package/dist/runtime/types/components/date-picker.js +0 -0
  192. package/dist/runtime/types/components/index.d.ts +8 -0
  193. package/dist/runtime/types/components/index.js +0 -0
  194. package/dist/runtime/types/components/input/as-phone-number-input.d.ts +17 -0
  195. package/dist/runtime/types/components/input/as-phone-number-input.js +0 -0
  196. package/dist/runtime/types/components/input/index.d.ts +6 -0
  197. package/dist/runtime/types/components/input/index.js +0 -0
  198. package/dist/runtime/types/components/input/with-character-limit.d.ts +11 -0
  199. package/dist/runtime/types/components/input/with-character-limit.js +0 -0
  200. package/dist/runtime/types/components/input/with-clear.d.ts +10 -0
  201. package/dist/runtime/types/components/input/with-clear.js +0 -0
  202. package/dist/runtime/types/components/input/with-copy.d.ts +11 -0
  203. package/dist/runtime/types/components/input/with-copy.js +0 -0
  204. package/dist/runtime/types/components/input/with-floating-label.d.ts +12 -0
  205. package/dist/runtime/types/components/input/with-floating-label.js +0 -0
  206. package/dist/runtime/types/components/input/with-password-toggle.d.ts +7 -0
  207. package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
  208. package/dist/runtime/types/components/message-box.d.ts +69 -0
  209. package/dist/runtime/types/components/message-box.js +0 -0
  210. package/dist/runtime/types/components/pill-group.d.ts +103 -0
  211. package/dist/runtime/types/components/pill-group.js +0 -0
  212. package/dist/runtime/types/components/popconfirm.d.ts +74 -0
  213. package/dist/runtime/types/components/popconfirm.js +0 -0
  214. package/dist/runtime/types/components/slide-verify.d.ts +54 -0
  215. package/dist/runtime/types/components/slide-verify.js +0 -0
  216. package/dist/runtime/types/components/star-rating.d.ts +55 -0
  217. package/dist/runtime/types/components/star-rating.js +0 -0
  218. package/dist/runtime/types/data-table/columns.d.ts +236 -0
  219. package/dist/runtime/types/data-table/columns.js +6 -0
  220. package/dist/runtime/types/data-table/component.d.ts +190 -0
  221. package/dist/runtime/types/data-table/component.js +0 -0
  222. package/dist/runtime/types/data-table/contexts.d.ts +44 -0
  223. package/dist/runtime/types/data-table/contexts.js +0 -0
  224. package/dist/runtime/types/data-table/index.d.ts +6 -0
  225. package/dist/runtime/types/data-table/index.js +1 -0
  226. package/dist/runtime/types/data-table/pagination.d.ts +87 -0
  227. package/dist/runtime/types/data-table/pagination.js +0 -0
  228. package/dist/runtime/types/index.d.ts +6 -5
  229. package/dist/runtime/types/index.js +5 -5
  230. package/dist/runtime/types/shared.d.ts +5 -0
  231. package/dist/runtime/types/shared.js +0 -0
  232. package/dist/runtime/types/zod.d.ts +19 -17
  233. package/dist/runtime/utils/extend-theme.d.ts +19 -0
  234. package/dist/runtime/utils/extend-theme.js +44 -0
  235. package/dist/runtime/utils/form-control.d.ts +33 -0
  236. package/dist/runtime/utils/form-control.js +54 -0
  237. package/dist/runtime/utils/meta.d.ts +4 -0
  238. package/dist/runtime/utils/meta.js +14 -0
  239. package/dist/runtime/utils/theme-defaults.d.ts +27 -0
  240. package/dist/runtime/utils/theme-defaults.js +28 -0
  241. package/dist/runtime/utils/tv.d.ts +1 -0
  242. package/dist/runtime/utils/tv.js +4 -0
  243. package/dist/runtime/vue/composables/useSiteConfig.d.ts +13 -0
  244. package/dist/runtime/vue/composables/useSiteConfig.js +11 -0
  245. package/dist/runtime/vue/plugins/theme.d.ts +6 -0
  246. package/dist/runtime/vue/plugins/theme.js +14 -0
  247. package/dist/runtime/vue/stubs/base.d.ts +2 -0
  248. package/dist/runtime/vue/stubs/base.js +2 -0
  249. package/dist/runtime/vue/stubs/inertia.d.ts +2 -0
  250. package/dist/runtime/vue/stubs/inertia.js +2 -0
  251. package/dist/runtime/vue/stubs/movk-extra.d.ts +2 -0
  252. package/dist/runtime/vue/stubs/movk-extra.js +2 -0
  253. package/dist/runtime/vue/stubs/none.d.ts +2 -0
  254. package/dist/runtime/vue/stubs/none.js +2 -0
  255. package/dist/runtime/vue/stubs/vue-router.d.ts +2 -0
  256. package/dist/runtime/vue/stubs/vue-router.js +2 -0
  257. package/dist/shared/nuxt.DfBEyjld.mjs +667 -0
  258. package/dist/types.d.mts +2 -6
  259. package/dist/unplugin.d.mts +28 -0
  260. package/dist/unplugin.mjs +292 -0
  261. package/dist/vite.d.mts +12 -0
  262. package/dist/vite.mjs +20 -0
  263. package/package.json +82 -42
  264. package/vue-plugin.d.ts +5 -0
  265. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +0 -20
  266. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +0 -20
  267. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +0 -20
  268. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue +0 -55
  269. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +0 -20
  270. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +0 -20
  271. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue +0 -125
  272. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +0 -20
  273. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +0 -20
  274. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue +0 -105
  275. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +0 -20
  276. package/dist/runtime/composables/useApiAuth.d.ts +0 -47
  277. package/dist/runtime/composables/useApiAuth.js +0 -66
  278. package/dist/runtime/internal/useAutoFormProvider.d.ts +0 -50
  279. package/dist/runtime/schemas/api.d.ts +0 -590
  280. package/dist/runtime/schemas/api.js +0 -228
  281. package/dist/runtime/server/api/_movk/session.post.d.ts +0 -10
  282. package/dist/runtime/server/api/_movk/session.post.js +0 -18
  283. package/dist/runtime/style.css +0 -1
  284. package/dist/runtime/types/api.d.ts +0 -218
  285. package/dist/runtime/types/auth.d.ts +0 -34
  286. package/dist/runtime/types/auto-form-renderer.d.ts +0 -22
  287. package/dist/runtime/types/auto-form.d.ts +0 -548
  288. package/dist/runtime/types/components.d.ts +0 -43
  289. package/dist/runtime/types/module.d.ts +0 -39
  290. package/dist/runtime/utils/api-utils.d.ts +0 -79
  291. package/dist/runtime/utils/api-utils.js +0 -127
  292. package/dist/runtime/utils/auto-form.d.ts +0 -3
  293. package/dist/runtime/utils/auto-form.js +0 -18
  294. package/dist/runtime/utils/reactive-utils.d.ts +0 -30
  295. package/dist/runtime/utils/schema-introspector.d.ts +0 -13
  296. /package/dist/runtime/{utils/theme.js → domains/theme/theme-icons.js} +0 -0
  297. /package/dist/runtime/types/{api.js → api/config.js} +0 -0
  298. /package/dist/runtime/types/{auto-form-renderer.js → api/fetch.js} +0 -0
  299. /package/dist/runtime/types/{auto-form.js → api/index.js} +0 -0
  300. /package/dist/runtime/types/{module.js → api/module.js} +0 -0
  301. /package/dist/runtime/types/{components.js → api/response.js} +0 -0
@@ -0,0 +1,62 @@
1
+ import type { Toast } from '@nuxt/ui/composables';
2
+ declare module 'ofetch' {
3
+ interface FetchOptions {
4
+ context?: ApiFetchContext;
5
+ }
6
+ }
7
+ /**
8
+ * API 请求扩展上下文
9
+ * @description 通过 fetch options 的 context 字段传递的额外配置
10
+ */
11
+ export interface ApiFetchContext {
12
+ /** Toast 提示配置,设置为 false 禁用提示 */
13
+ toast?: RequestToastOptions | false;
14
+ /**
15
+ * 是否跳过业务状态码检查
16
+ * @description 仅跳过 code 校验,**仍按 dataKey 解包**业务数据。与 skipUnwrap 正交。
17
+ */
18
+ skipBusinessCheck?: boolean;
19
+ /**
20
+ * 是否跳过数据解包
21
+ * @description 为 true 时拦截器不重写 response._data,调用方拿到原始响应。与 skipBusinessCheck 正交。
22
+ */
23
+ skipUnwrap?: boolean;
24
+ }
25
+ /**
26
+ * 请求级别的 Toast 提示选项
27
+ * @description 用于单个请求的 Toast 配置,可覆盖全局配置
28
+ */
29
+ export interface RequestToastOptions {
30
+ /** 成功提示配置,设置为 false 禁用成功提示 */
31
+ success?: Partial<Toast> | false;
32
+ /** 错误提示配置,设置为 false 禁用错误提示 */
33
+ error?: Partial<Toast> | false;
34
+ /** 自定义成功消息 */
35
+ successMessage?: string;
36
+ /** 自定义错误消息 */
37
+ errorMessage?: string;
38
+ }
39
+ /**
40
+ * API 响应数据结构
41
+ * @description 字段名通过 ApiResponseConfig 的 codeKey/messageKey/dataKey 配置化读取
42
+ */
43
+ export interface ApiResponse {
44
+ code?: number | string;
45
+ message?: string;
46
+ msg?: string;
47
+ data?: unknown;
48
+ status?: number;
49
+ [key: string]: unknown;
50
+ }
51
+ /**
52
+ * API 错误对象
53
+ * @description 扩展标准 Error,包含业务响应和状态码信息
54
+ */
55
+ export interface ApiError extends Error {
56
+ /** HTTP 或业务状态码 */
57
+ statusCode?: number;
58
+ /** 原始 API 响应数据 */
59
+ response?: ApiResponse;
60
+ /** 是否为业务逻辑错误(非 HTTP 错误) */
61
+ isBusinessError: boolean;
62
+ }
@@ -0,0 +1,32 @@
1
+ import type { MovkApiEndpointName } from './fetch';
2
+ import type { ApiError, RequestToastOptions } from './response';
3
+ /**
4
+ * 传输状态
5
+ * @description idle 初始;pending 进行中;success 成功;error 失败;aborted 已中止
6
+ */
7
+ export type TransferStatus = 'idle' | 'pending' | 'success' | 'error' | 'aborted';
8
+ /**
9
+ * 传输结果(命令式调用返回值)
10
+ * @description data/error 二选一;aborted 标记是否被 abort 取消
11
+ */
12
+ export interface TransferResult<T = unknown> {
13
+ /** 业务数据(已按 dataKey 解包);失败或中止时为 null */
14
+ data: T | null;
15
+ /** 错误对象;成功或中止时为 null */
16
+ error: ApiError | Error | null;
17
+ /** 是否因调用方主动 abort 而结束 */
18
+ aborted: boolean;
19
+ }
20
+ /**
21
+ * 传输请求公共选项
22
+ */
23
+ export interface TransferRequestOptions {
24
+ /** 端点名称,未指定时使用 defaultEndpoint */
25
+ endpoint?: MovkApiEndpointName;
26
+ /** 额外的请求头(覆盖同名 auth 头) */
27
+ headers?: Record<string, string>;
28
+ /** Toast 配置,设置为 false 整体禁用 */
29
+ toast?: RequestToastOptions | false;
30
+ /** 跳过业务码校验(仍按 dataKey 解包),与 useApiFetch.skipBusinessCheck 同义 */
31
+ skipBusinessCheck?: boolean;
32
+ }
File without changes
@@ -0,0 +1,6 @@
1
+ declare module '#build/app.config' {
2
+ import type { AppConfig } from '@nuxt/schema'
3
+
4
+ const _default: AppConfig
5
+ export default _default
6
+ }
@@ -0,0 +1,26 @@
1
+ import type { FormProps } from '@nuxt/ui';
2
+ import type { z } from 'zod';
3
+ import type { OmitByKey } from '@movk/core';
4
+ import type { AutoFormControls } from './controls';
5
+ import type { ZodAutoFormFieldMeta } from '../zod';
6
+ import type { ClassNameValue } from '../shared';
7
+ export interface BaseAutoFormProps<S extends z.ZodObject, T extends boolean = true, N extends boolean = false> extends /** @vue-ignore */ OmitByKey<FormProps<S, T, N>, 'schema' | 'state' | 'loadingAuto' | 'validateOn' | 'ui'> {
8
+ /** Zod 对象 schema,定义表单字段 */
9
+ schema: S;
10
+ /** 自定义控件映射 */
11
+ controls?: AutoFormControls;
12
+ /** 全局字段元数据配置 */
13
+ globalMeta?: ZodAutoFormFieldMeta;
14
+ /**
15
+ * 是否启用自动 loading 功能。
16
+ * @defaultValue true
17
+ */
18
+ loadingAuto?: FormProps<S, T, N>['loadingAuto'];
19
+ /**
20
+ * 表单验证时机,详见 UForm 的 validateOn 属性
21
+ * @defaultValue []
22
+ */
23
+ validateOn?: FormProps<S, T, N>['validateOn'];
24
+ class?: ClassNameValue;
25
+ ui?: Record<string, ClassNameValue>;
26
+ }
File without changes
@@ -0,0 +1,28 @@
1
+ import type { ButtonProps, FormProps, FormSubmitEvent, FormData, FormErrorEvent } from '@nuxt/ui';
2
+ import type { z } from 'zod';
3
+ import type { BaseAutoFormProps } from './base';
4
+ import type { AutoFormSlotProps, DynamicFormSlots } from './slots';
5
+ import type { VNode } from 'vue';
6
+ export interface AutoFormProps<S extends z.ZodObject = z.ZodObject, T extends boolean = true, N extends boolean = false> extends BaseAutoFormProps<S, T, N> {
7
+ /** 表单的状态对象。 */
8
+ state?: FormProps<S, T, N>['state'];
9
+ /**
10
+ * 是否显示默认提交按钮
11
+ * @defaultValue true
12
+ */
13
+ submit?: boolean;
14
+ /** 提交按钮属性 */
15
+ submitButtonProps?: ButtonProps;
16
+ /** 数组字段添加按钮属性 */
17
+ addButtonProps?: ButtonProps;
18
+ }
19
+ export type AutoFormSubmitHandler<S extends z.ZodObject, T extends boolean = true> = (event: FormSubmitEvent<FormData<S, T>>) => void;
20
+ export type AutoFormErrorHandler = (event: FormErrorEvent) => void;
21
+ export interface AutoFormEmits {
22
+ error: [FormErrorEvent];
23
+ }
24
+ export type AutoFormSlots<T extends object> = {
25
+ header(props: AutoFormSlotProps<T>): VNode[];
26
+ footer(props: AutoFormSlotProps<T>): VNode[];
27
+ submit(props: AutoFormSlotProps<T>): VNode[];
28
+ } & DynamicFormSlots<T>;
File without changes
@@ -0,0 +1,45 @@
1
+ import type { z } from 'zod';
2
+ import type { ComponentProps, ComponentSlots, IsComponent, ReactiveValue } from '@movk/core';
3
+ import type { ClassNameValue } from '../shared';
4
+ import type { ZodAutoFormFieldMeta } from '../zod';
5
+ import type { AutoFormFieldContext } from './fields';
6
+ /** 幻影类型哨兵:标记 P/S 未被覆写 */
7
+ export type _Unset = {
8
+ readonly __brand: 'AutoFormControlUnset';
9
+ };
10
+ export interface AutoFormControl<C extends IsComponent = IsComponent, _P = _Unset, _S = _Unset> {
11
+ component: C;
12
+ controlProps?: ComponentProps<C>;
13
+ controlSlots?: Partial<ComponentSlots<C>>;
14
+ }
15
+ export type AutoFormControlProps = Partial<Record<string, unknown>>;
16
+ export type AutoFormControlSlots = Partial<Record<string, unknown>>;
17
+ export type AutoFormControls = Record<string, AutoFormControl<IsComponent, AutoFormControlProps, AutoFormControlSlots>>;
18
+ export interface AutoFormControlsMeta<C extends IsComponent = IsComponent> {
19
+ type?: string;
20
+ component?: C;
21
+ controlProps?: ReactiveValue<ComponentProps<C>, AutoFormFieldContext>;
22
+ controlSlots?: ReactiveValue<Partial<ComponentSlots<C>>, AutoFormFieldContext> | Record<string, unknown>;
23
+ error?: string;
24
+ }
25
+ export interface AutoFormRuntimeControlsMeta {
26
+ type?: string;
27
+ component?: IsComponent;
28
+ controlProps?: ReactiveValue<AutoFormControlProps, AutoFormFieldContext>;
29
+ controlSlots?: ReactiveValue<AutoFormControlSlots, AutoFormFieldContext> | Record<string, unknown>;
30
+ error?: string;
31
+ }
32
+ export interface AutoFormLayoutConfig<C extends IsComponent = IsComponent> {
33
+ component?: C;
34
+ props?: ReactiveValue<ComponentProps<C>, AutoFormFieldContext>;
35
+ class?: ReactiveValue<ClassNameValue, AutoFormFieldContext>;
36
+ slots?: ReactiveValue<Partial<ComponentSlots<C>>, AutoFormFieldContext>;
37
+ fields: Record<string, z.ZodType>;
38
+ fieldSlot?: ReactiveValue<keyof ComponentSlots<C> & string, AutoFormFieldContext>;
39
+ fieldSlots?: ReactiveValue<Partial<Record<string, keyof ComponentSlots<C> & string>>, AutoFormFieldContext>;
40
+ }
41
+ export type AutoFormMergeMeta = ZodAutoFormFieldMeta & AutoFormRuntimeControlsMeta & {
42
+ mapped?: AutoFormControl;
43
+ layout?: AutoFormLayoutConfig;
44
+ overwrite?: AutoFormRuntimeControlsMeta;
45
+ };
File without changes
@@ -0,0 +1,68 @@
1
+ import type { CollapsibleRootProps } from 'reka-ui';
2
+ import type { ClassNameValue } from '../shared';
3
+ import type { GetFieldValue } from '@movk/core';
4
+ type FieldValueType<S, P extends string> = P extends string ? (string extends P ? S[keyof S] : GetFieldValue<S, P>) : S[keyof S];
5
+ type NonUndefinedFieldValue<S, P extends string> = Exclude<FieldValueType<S, P>, undefined>;
6
+ type RelativePath<T> = T extends readonly any[] ? string : T extends Record<string, any> ? Extract<keyof T, string> : string;
7
+ type _SetValueRelKey<S, P extends string> = RelativePath<NonUndefinedFieldValue<S, P>>;
8
+ export interface AutoFormFieldContext<S = any, P extends string = string> {
9
+ readonly state: S;
10
+ readonly path: P;
11
+ readonly value: FieldValueType<S, P>;
12
+ /**
13
+ * @example
14
+ * setValue({ name: '张三', email: 'test@example.com' }) // 设置整个对象
15
+ * setValue('name', '张三') // key 自动推断
16
+ * setValue('[0].title', '新标题') // 数组索引路径
17
+ */
18
+ setValue: {
19
+ (value: FieldValueType<S, P>): void;
20
+ <K extends _SetValueRelKey<S, P>>(relativePath: K extends never ? string : K, value: any): void;
21
+ (relativePath: string, value: any): void;
22
+ };
23
+ readonly errors: unknown[];
24
+ readonly loading: boolean;
25
+ readonly open?: boolean;
26
+ readonly count?: number;
27
+ }
28
+ export interface ResolvedAutoFormFieldContext {
29
+ readonly state: Record<string, any>;
30
+ readonly path: string;
31
+ readonly value: any;
32
+ setValue: (valueOrPathOrUpdater: any, value?: any) => void;
33
+ readonly errors: unknown[];
34
+ readonly loading: boolean;
35
+ readonly open?: boolean;
36
+ readonly count?: number;
37
+ readonly extraProps?: Record<string, unknown>;
38
+ }
39
+ export interface AutoFormFieldSlots {
40
+ label: (props: {
41
+ label?: string;
42
+ } & AutoFormFieldContext) => unknown;
43
+ hint: (props: {
44
+ hint?: string;
45
+ } & AutoFormFieldContext) => unknown;
46
+ description: (props: {
47
+ description?: string;
48
+ } & AutoFormFieldContext) => unknown;
49
+ help: (props: {
50
+ help?: string;
51
+ } & AutoFormFieldContext) => unknown;
52
+ error: (props: {
53
+ error?: boolean | string;
54
+ } & AutoFormFieldContext) => unknown;
55
+ default: (props: {
56
+ error?: boolean | string;
57
+ } & AutoFormFieldContext) => unknown;
58
+ }
59
+ export interface AutoFormNestedCollapsible extends Pick<CollapsibleRootProps, 'defaultOpen' | 'open' | 'disabled' | 'unmountOnHide'> {
60
+ enabled?: boolean;
61
+ as?: unknown;
62
+ class?: unknown;
63
+ ui?: {
64
+ root?: ClassNameValue;
65
+ content?: ClassNameValue;
66
+ };
67
+ }
68
+ export {};
File without changes
@@ -0,0 +1,7 @@
1
+ export type { AutoFormFieldContext, AutoFormFieldSlots, AutoFormNestedCollapsible, ResolvedAutoFormFieldContext } from './fields';
2
+ export type { AutoFormControl, AutoFormControlProps, AutoFormControlSlots, AutoFormControls, AutoFormLayoutConfig, AutoFormMergeMeta } from './controls';
3
+ export type { AutoFormField, AutoFormSlotProps, DynamicFormSlots } from './slots';
4
+ export type { TypedZodFactory } from './zod-factory';
5
+ export type { BaseAutoFormProps } from './base';
6
+ export type { AutoFormEmits, AutoFormProps, AutoFormSlots, AutoFormErrorHandler, AutoFormSubmitHandler } from './component';
7
+ export type { SearchFormEmits, SearchFormProps, SearchFormSlots, SearchFormAction, SearchFormSlotProps } from './search-form';
File without changes
@@ -0,0 +1,84 @@
1
+ import type { ButtonProps, FormError, FormErrorEvent, IconProps, InferInput } from '@nuxt/ui';
2
+ import type { z } from 'zod';
3
+ import type { Suggest } from '@movk/core';
4
+ import type { BaseAutoFormProps } from './base';
5
+ import type { DynamicFormSlots } from './slots';
6
+ import type { VNode } from 'vue';
7
+ export interface SearchFormSlotProps<S extends z.ZodObject> {
8
+ expanded: boolean;
9
+ loading: boolean;
10
+ state: Partial<InferInput<S>>;
11
+ errors: FormError[];
12
+ toggle: () => void;
13
+ search: () => void;
14
+ reset: () => void;
15
+ clear: () => void;
16
+ }
17
+ export interface SearchFormAction extends /** @vue-ignore */ Omit<ButtonProps, 'onClick'> {
18
+ key: Suggest<'search' | 'reset'>;
19
+ label?: string;
20
+ visible?: boolean | ((ctx: SearchFormSlotProps<z.ZodObject>) => boolean);
21
+ onClick?: (ctx: SearchFormSlotProps<z.ZodObject>) => void;
22
+ }
23
+ export interface SearchFormProps<S extends z.ZodObject> extends BaseAutoFormProps<S> {
24
+ /**
25
+ * 网格列数
26
+ * @defaultValue 3
27
+ */
28
+ cols?: number | {
29
+ sm?: number;
30
+ md?: number;
31
+ lg?: number;
32
+ xl?: number;
33
+ };
34
+ /**
35
+ * 可见行数(折叠时显示的行数)
36
+ * @defaultValue 1
37
+ */
38
+ visibleRows?: number;
39
+ /**
40
+ * 动作按钮配置;不传时使用默认 [search, reset];传 [] 则关闭所有内置按钮
41
+ * @defaultValue [{ key: 'search', ... }, { key: 'reset', ... }]
42
+ */
43
+ actions?: SearchFormAction[];
44
+ /** 搜索按钮加载状态(作用于 type==='submit' 或 key==='search' 的按钮) */
45
+ loading?: boolean;
46
+ /** 收起按钮属性 */
47
+ collapseButtonProps?: ButtonProps;
48
+ /**
49
+ * 展开/收起按钮图标
50
+ * @IconifyIcon
51
+ * @defaultValue 'i-lucide-chevron-down'
52
+ */
53
+ icon?: IconProps['name'];
54
+ /**
55
+ * 展开按钮文本
56
+ * @defaultValue '展开'
57
+ */
58
+ expandText?: string;
59
+ /**
60
+ * 收起按钮文本
61
+ * @defaultValue '收起'
62
+ */
63
+ collapseText?: string;
64
+ /** 受控展开状态;优先级高于 defaultExpanded */
65
+ expanded?: boolean;
66
+ /**
67
+ * 默认展开状态
68
+ * @defaultValue false
69
+ */
70
+ defaultExpanded?: boolean;
71
+ }
72
+ export interface SearchFormEmits {
73
+ 'reset': [];
74
+ 'clear': [];
75
+ 'expand': [expanded: boolean];
76
+ 'update:expanded': [expanded: boolean];
77
+ 'error': [event: FormErrorEvent];
78
+ }
79
+ export type SearchFormSlots<S extends z.ZodObject> = {
80
+ header(props: SearchFormSlotProps<S>): VNode[];
81
+ footer(props: SearchFormSlotProps<S>): VNode[];
82
+ actions(props: SearchFormSlotProps<S>): VNode[];
83
+ extraActions(props: SearchFormSlotProps<S>): VNode[];
84
+ } & DynamicFormSlots<Partial<InferInput<S>>>;
File without changes
@@ -0,0 +1,85 @@
1
+ import type { z } from 'zod';
2
+ import type { FormError } from '@nuxt/ui';
3
+ import type { ArrayFieldKeys, NonObjectFieldKeys, ObjectFieldKeys } from '@movk/core';
4
+ import type { AutoFormFieldContext, AutoFormFieldSlots } from './fields';
5
+ import type { AutoFormMergeMeta } from './controls';
6
+ import type { VNode } from 'vue';
7
+ export interface AutoFormField {
8
+ path: string;
9
+ schema: z.ZodType;
10
+ meta: AutoFormMergeMeta;
11
+ decorators: {
12
+ isOptional?: boolean;
13
+ isReadonly?: boolean;
14
+ defaultValue?: unknown;
15
+ description?: string;
16
+ };
17
+ children?: AutoFormField[];
18
+ arrayElement?: AutoFormField;
19
+ }
20
+ export interface AutoFormSlotProps<T extends object> {
21
+ errors: FormError[];
22
+ loading: boolean;
23
+ fields: AutoFormField[];
24
+ state: T;
25
+ }
26
+ /** 插槽附加 props 查找表 */
27
+ type SlotExtraPropsMap = {
28
+ label: {
29
+ label?: string;
30
+ };
31
+ hint: {
32
+ hint?: string;
33
+ };
34
+ description: {
35
+ description?: string;
36
+ };
37
+ help: {
38
+ help?: string;
39
+ };
40
+ error: {
41
+ error?: boolean | string;
42
+ };
43
+ default: {
44
+ error?: boolean | string;
45
+ };
46
+ };
47
+ type _FormGenericSlots<T> = {
48
+ [K in keyof AutoFormFieldSlots as `field-${K}`]: (props: SlotExtraPropsMap[K] & AutoFormFieldContext<T>) => VNode[];
49
+ };
50
+ type _FieldPath<T> = string & (NonObjectFieldKeys<T> | ObjectFieldKeys<T>);
51
+ type _NestedPath<T> = string & (ObjectFieldKeys<T> | ArrayFieldKeys<T>);
52
+ type _SlotEntry = {
53
+ key: PropertyKey;
54
+ props: unknown;
55
+ };
56
+ type _EntryToSlots<E extends _SlotEntry> = {
57
+ [Entry in E as Entry['key']]: (props: Entry['props']) => VNode[];
58
+ };
59
+ type _FormKeyedSlotEntry<T> = {
60
+ [K in keyof AutoFormFieldSlots]: {
61
+ [P in _FieldPath<T>]: {
62
+ key: `field-${K}:${P}`;
63
+ props: SlotExtraPropsMap[K] & AutoFormFieldContext<T, P>;
64
+ };
65
+ }[_FieldPath<T>];
66
+ }[keyof AutoFormFieldSlots];
67
+ type _NestedSlotName = 'content' | 'before' | 'after';
68
+ type _FormNestedSlotEntry<T> = {
69
+ [P in _NestedPath<T>]: {
70
+ key: `field-${_NestedSlotName}:${P}`;
71
+ props: AutoFormFieldContext<T, P>;
72
+ };
73
+ }[_NestedPath<T>];
74
+ type _FormKeyedSlots<T> = _EntryToSlots<_FormKeyedSlotEntry<T>>;
75
+ type _FormNestedSlots<T> = _EntryToSlots<_FormNestedSlotEntry<T>>;
76
+ /**
77
+ * 动态表单插槽类型
78
+ *
79
+ * 插槽命名:
80
+ * - 通用:`field-{slotType}`
81
+ * - 字段:`field-{slotType}:{fieldKey}` — 精确推导字段类型
82
+ * - 嵌套:`field-{content|before|after}:{objectKey|arrayKey}`
83
+ */
84
+ export type DynamicFormSlots<T> = _FormGenericSlots<T> & _FormKeyedSlots<T> & _FormNestedSlots<T>;
85
+ export {};
File without changes
@@ -0,0 +1,127 @@
1
+ import type { z } from 'zod';
2
+ import type { DateRange } from 'reka-ui';
3
+ import type { CalendarDate, DateValue, Time } from '@internationalized/date';
4
+ import type { ComponentProps, ComponentSlots, IsAny, IsComponent, KnownKeys, OmitByKey, Prettify, ReactiveValue, UnionToIntersection, WidenLiteral } from '@movk/core';
5
+ import type { AutoFormFieldContext } from './fields';
6
+ import type { AutoFormControl, AutoFormControls, AutoFormControlsMeta, _Unset, AutoFormLayoutConfig } from './controls';
7
+ import type { AUTOFORM_META } from '../../domains/auto-form/constants';
8
+ interface LayoutFieldMarker<Fields extends Record<string, z.ZodType>> extends z.ZodType<AutoFormLayoutConfig, any, any> {
9
+ __brand: typeof AUTOFORM_META.LAYOUT_KEY;
10
+ fields: Fields;
11
+ }
12
+ type LayoutRestShape<S extends Record<string, any>> = {
13
+ [P in keyof S as S[P] extends LayoutFieldMarker<any> ? never : P]: S[P];
14
+ };
15
+ type LayoutFieldShape<S extends Record<string, any>> = UnionToIntersection<{
16
+ [P in keyof S]: S[P] extends LayoutFieldMarker<infer Fields> ? ExtractLayoutShape<Fields> : {};
17
+ }[keyof S]>;
18
+ type _HasLayoutMarker<S> = {
19
+ [P in keyof S]: S[P] extends LayoutFieldMarker<any> ? true : never;
20
+ }[keyof S] extends never ? false : true;
21
+ type ExtractLayoutShape<S extends Record<string, any>> = _HasLayoutMarker<S> extends true ? LayoutRestShape<S> & LayoutFieldShape<S> : S;
22
+ type StrictComponentProps<C extends IsComponent> = {
23
+ [K in keyof ComponentProps<C> as {} extends Record<K, unknown> ? never : K]: ComponentProps<C>[K];
24
+ };
25
+ type StrictComponentSlots<C extends IsComponent> = IsAny<ComponentSlots<C>> extends true ? {} : ComponentSlots<C>;
26
+ type ControlKey<TControls extends AutoFormControls> = Extract<KnownKeys<TControls>, string>;
27
+ type ControlEntryByKey<TControls extends AutoFormControls, K extends string> = K extends keyof TControls ? TControls[K] : never;
28
+ type _WidenForFactory<T> = {
29
+ [K in keyof T]+?: WidenLiteral<T[K]>;
30
+ };
31
+ type _IsUnsetLike<P> = [P] extends [_Unset] ? true : IsAny<P> extends true ? true : [unknown] extends [P] ? true : [keyof P] extends [never] ? true : false;
32
+ type ResolveControlProps<C extends IsComponent, P> = _IsUnsetLike<P> extends true ? StrictComponentProps<C> : Prettify<_WidenForFactory<P> & {}>;
33
+ type ExtractControlProps<T> = T extends AutoFormControl<infer C, infer P, any> ? ResolveControlProps<C, P> : T extends {
34
+ component: infer C extends IsComponent;
35
+ } ? StrictComponentProps<C> : {};
36
+ type ResolveControlSlots<C extends IsComponent, S> = _IsUnsetLike<S> extends true ? StrictComponentSlots<C> : S;
37
+ type ExtractControlSlots<T> = T extends AutoFormControl<infer C, any, infer S> ? ResolveControlSlots<C, S> : T extends {
38
+ component: infer C extends IsComponent;
39
+ } ? StrictComponentSlots<C> : {};
40
+ type FallbackToRecordIfEmpty<T> = [keyof T] extends [never] ? Record<string, unknown> : Prettify<T & {}>;
41
+ type ControlPropsByKey<TControls extends AutoFormControls, K extends ControlKey<TControls>> = FallbackToRecordIfEmpty<ExtractControlProps<ControlEntryByKey<TControls, K>>>;
42
+ type ControlSlotsByKey<TControls extends AutoFormControls, K extends ControlKey<TControls>> = Partial<ExtractControlSlots<ControlEntryByKey<TControls, K>>>;
43
+ type MetaPropsFor<TControls extends AutoFormControls, K extends ControlKey<TControls>> = {
44
+ controlProps?: ReactiveValue<ControlPropsByKey<TControls, K>, AutoFormFieldContext>;
45
+ controlSlots?: ReactiveValue<ControlSlotsByKey<TControls, K>, AutoFormFieldContext> | Record<string, unknown>;
46
+ error?: string;
47
+ };
48
+ type MetaByControlKey<TControls extends AutoFormControls, K extends ControlKey<TControls>> = {
49
+ type: K;
50
+ component?: never;
51
+ } & MetaPropsFor<TControls, K>;
52
+ type MetaByComponent<C extends IsComponent> = {
53
+ component: C;
54
+ type?: never;
55
+ } & OmitByKey<AutoFormControlsMeta<C>, 'component' | 'type'>;
56
+ type MetaByDefaultIfExists<TControls extends AutoFormControls, TDefaultKey extends string> = TDefaultKey extends ControlKey<TControls> ? {
57
+ component?: never;
58
+ type?: never;
59
+ } & MetaPropsFor<TControls, TDefaultKey> : never;
60
+ type AutoFormFactoryMethod<TControls extends AutoFormControls, TResult, TDefaultKey extends string, TExtraArgs extends unknown[] = []> = _FactoryMetaOverloads<TControls, TResult, TDefaultKey, TExtraArgs> & {
61
+ (...args: [...TExtraArgs, string?]): TResult;
62
+ };
63
+ type _FactoryMetaOverloads<TControls extends AutoFormControls, TResult, TDefaultKey extends string, TExtraArgs extends unknown[] = []> = {
64
+ <K extends ControlKey<TControls>>(...args: [...TExtraArgs, MetaByControlKey<TControls, K>]): TResult;
65
+ (...args: [...TExtraArgs, MetaByDefaultIfExists<TControls, TDefaultKey>]): TResult;
66
+ <C extends IsComponent>(...args: [...TExtraArgs, MetaByComponent<C>]): TResult;
67
+ };
68
+ type EnumValues = readonly string[] | z.core.util.EnumLike;
69
+ type EnumFactoryResult<T extends EnumValues> = T extends readonly [] ? z.ZodString : T extends readonly [string, ...string[]] ? z.ZodEnum<z.core.util.ToEnum<T[number]>> : T extends readonly string[] ? z.ZodEnum<z.core.util.ToEnum<T[number]>> : T extends z.core.util.EnumLike ? z.ZodEnum<T> : z.ZodString;
70
+ type EnumFactory<TControls extends AutoFormControls> = {
71
+ <const T extends EnumValues, K extends ControlKey<TControls>>(values: T, overwrite?: MetaByControlKey<TControls, K>): EnumFactoryResult<T>;
72
+ <const T extends EnumValues>(values: T, overwrite: MetaByDefaultIfExists<TControls, 'enum'>): EnumFactoryResult<T>;
73
+ <const T extends EnumValues, C extends IsComponent>(values: T, overwrite: MetaByComponent<C>): EnumFactoryResult<T>;
74
+ };
75
+ type CalendarDateFactory<TControls extends AutoFormControls> = {
76
+ <T extends DateValue | DateRange | DateValue[] = CalendarDate, K extends ControlKey<TControls> = ControlKey<TControls>>(meta?: MetaByControlKey<TControls, K>): z.ZodType<T>;
77
+ <T extends DateValue | DateRange | DateValue[] = CalendarDate>(meta: MetaByDefaultIfExists<TControls, 'calendarDate'>): z.ZodType<T>;
78
+ <C extends IsComponent, T extends DateValue | DateRange | DateValue[] = CalendarDate>(meta: MetaByComponent<C>): z.ZodType<T>;
79
+ };
80
+ type ArrayFactory<TControls extends AutoFormControls> = {
81
+ <T extends z.ZodType, K extends ControlKey<TControls>>(schema: T, overwrite?: MetaByControlKey<TControls, K>): z.ZodArray<T>;
82
+ <T extends z.ZodType>(schema: T, overwrite: MetaByDefaultIfExists<TControls, 'array'>): z.ZodArray<T>;
83
+ <T extends z.ZodType, C extends IsComponent>(schema: T, overwrite: MetaByComponent<C>): z.ZodArray<T>;
84
+ };
85
+ type TupleFactory<TControls extends AutoFormControls> = {
86
+ <T extends readonly [z.ZodType, ...z.ZodType[]], K extends ControlKey<TControls>>(schemas: T, overwrite?: MetaByControlKey<TControls, K>): z.ZodTuple<T>;
87
+ <T extends readonly [z.ZodType, ...z.ZodType[]]>(schemas: T, overwrite: MetaByDefaultIfExists<TControls, 'tuple'>): z.ZodTuple<T>;
88
+ <T extends readonly [z.ZodType, ...z.ZodType[]], C extends IsComponent>(schemas: T, overwrite: MetaByComponent<C>): z.ZodTuple<T>;
89
+ };
90
+ type ObjectFactoryResult<S extends Record<string, z.ZodType>, Mode extends z.core.$strip | z.core.$loose | z.core.$strict> = z.ZodObject<ExtractLayoutShape<S>, Mode>;
91
+ /** 对象工厂重载 */
92
+ type ObjectFactoryOverloads<TControls extends AutoFormControls, Mode extends z.core.$strip | z.core.$loose | z.core.$strict, TDefaultKey extends string, ShapeConstraint = {}> = {
93
+ <S extends Record<string, z.ZodType>, K extends ControlKey<TControls>>(shape: S & ShapeConstraint, meta?: MetaByControlKey<TControls, K>): ObjectFactoryResult<S, Mode>;
94
+ <S extends Record<string, z.ZodType>>(shape: S & ShapeConstraint, meta: MetaByDefaultIfExists<TControls, TDefaultKey>): ObjectFactoryResult<S, Mode>;
95
+ <S extends Record<string, z.ZodType>, C extends IsComponent>(shape: S & ShapeConstraint, meta: MetaByComponent<C>): ObjectFactoryResult<S, Mode>;
96
+ };
97
+ export interface TypedZodFactory<TControls extends AutoFormControls> {
98
+ string: AutoFormFactoryMethod<TControls, z.ZodString, 'string'>;
99
+ number: AutoFormFactoryMethod<TControls, z.ZodNumber, 'number'>;
100
+ boolean: AutoFormFactoryMethod<TControls, z.ZodBoolean, 'boolean'>;
101
+ file: AutoFormFactoryMethod<TControls, z.ZodType<File>, 'file'>;
102
+ email: AutoFormFactoryMethod<TControls, z.ZodString, 'string'>;
103
+ url: AutoFormFactoryMethod<TControls, z.ZodString, 'string'>;
104
+ uuid: AutoFormFactoryMethod<TControls, z.ZodString, 'string'>;
105
+ enum: EnumFactory<TControls>;
106
+ calendarDate: CalendarDateFactory<TControls>;
107
+ inputDate: AutoFormFactoryMethod<TControls, z.ZodType<CalendarDate>, 'inputDate'>;
108
+ inputTime: AutoFormFactoryMethod<TControls, z.ZodType<Time>, 'inputTime'>;
109
+ isoDatetime: AutoFormFactoryMethod<TControls, z.ZodType<string>, 'string'>;
110
+ isoDate: AutoFormFactoryMethod<TControls, z.ZodType<string>, 'string'>;
111
+ isoTime: AutoFormFactoryMethod<TControls, z.ZodType<string>, 'string'>;
112
+ array: ArrayFactory<TControls>;
113
+ tuple: TupleFactory<TControls>;
114
+ layout: <C extends IsComponent = IsComponent, Fields extends Record<string, z.ZodType> = Record<string, z.ZodType>>(config: Omit<AutoFormLayoutConfig<C>, 'fields'> & {
115
+ fields: Fields;
116
+ }) => LayoutFieldMarker<Fields>;
117
+ object: {
118
+ <T extends object>(): ObjectFactoryOverloads<TControls, z.core.$strip, 'object', Partial<Record<Extract<keyof T, string>, z.ZodType>>>;
119
+ } & ObjectFactoryOverloads<TControls, z.core.$strip, 'object'>;
120
+ looseObject: {
121
+ <T extends object>(): ObjectFactoryOverloads<TControls, z.core.$loose, 'looseObject', Partial<Record<Extract<keyof T, string>, z.ZodType>>>;
122
+ } & ObjectFactoryOverloads<TControls, z.core.$loose, 'looseObject'>;
123
+ strictObject: {
124
+ <T extends object>(): ObjectFactoryOverloads<TControls, z.core.$strict, 'strictObject', Partial<Record<Extract<keyof T, string>, z.ZodType>>>;
125
+ } & ObjectFactoryOverloads<TControls, z.core.$strict, 'strictObject'>;
126
+ }
127
+ export {};
File without changes