@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
@@ -1,548 +0,0 @@
1
- import type { CollapsibleRootProps, DateRange } from 'reka-ui';
2
- import type { ClassNameValue } from 'tailwind-merge';
3
- import type { z } from 'zod/v4';
4
- import type { ArrayFieldKeys, ComponentProps, OmitByKey, ComponentSlots, GetFieldValue, IsComponent, NonObjectFieldKeys, ObjectFieldKeys, ReactiveValue, Suggest } from '@movk/core';
5
- import type { FormError } from '@nuxt/ui';
6
- import type { AUTOFORM_META } from '../constants/auto-form.js';
7
- import type { CalendarDate, DateValue, Time } from '@internationalized/date';
8
- import type { ZodAutoFormFieldMeta } from './zod.js';
9
- type FieldValueType<S, P extends string> = P extends string ? (string extends P ? S[keyof S] : GetFieldValue<S, P>) : S[keyof S];
10
- type NonUndefinedFieldValue<S, P extends string> = Exclude<FieldValueType<S, P>, undefined>;
11
- /**
12
- * 相对路径类型 - 根据字段值类型自动推断可用路径
13
- * @template T - 字段值类型
14
- * @description
15
- * - 对象类型:返回对象的键('name' | 'email' | 'bio')
16
- * - 数组类型:返回 string(支持任意索引路径如 '[0].title')
17
- */
18
- type RelativePath<T> = T extends readonly any[] ? string : T extends Record<string, any> ? Extract<keyof T, string> : string;
19
- /**
20
- * 表单字段上下文
21
- * @template S - 表单数据类型
22
- * @template P - 字段路径
23
- */
24
- export interface AutoFormFieldContext<S = any, P extends string = string> {
25
- /** 表单数据 */
26
- readonly state: S;
27
- /** 字段路径 */
28
- readonly path: P;
29
- /** 字段值(可能为 undefined) */
30
- readonly value: FieldValueType<S, P>;
31
- /**
32
- * 设置字段值的回调函数
33
- * @description 支持多种调用方式:
34
- * 1. setValue(value) - 设置当前字段的整个值
35
- * 2. setValue(key, value) - 设置子字段值(对象)或元素属性(数组)
36
- * 3. setValue(path, value) - 设置任意路径的值(字符串回退)
37
- * @example
38
- * // 对象字段 profile: { name, email, bio }
39
- * setValue({ name: '张三', email: 'test@example.com' }) // 设置整个对象
40
- * setValue('name', '张三') // key 自动推断为 'name' | 'email' | 'bio'
41
- *
42
- * // 数组字段 tasks: [{ title, priority, completed }]
43
- * setValue([...tasks, newTask]) // 设置整个数组
44
- * setValue('[0].title', '新标题') // 使用索引路径字符串
45
- *
46
- * // 或者在遍历中直接使用属性名(推荐)
47
- * v-for="(task, index) in tasks"
48
- * setValue(`[${index}].title`, value) // 动态索引
49
- */
50
- setValue: {
51
- (value: FieldValueType<S, P>): void;
52
- <K extends RelativePath<NonUndefinedFieldValue<S, P>>>(relativePath: K extends never ? string : K, value: any): void;
53
- (relativePath: string, value: any): void;
54
- };
55
- /** 字段错误列表 */
56
- readonly errors: unknown[];
57
- /** 表单提交加载状态 */
58
- readonly loading: boolean;
59
- /** 字段折叠状态 */
60
- readonly open?: boolean;
61
- /** 数组元素下标 */
62
- readonly count?: number;
63
- }
64
- /**
65
- * 表单字段插槽定义 - 支持自定义渲染各个部分
66
- */
67
- export interface AutoFormFieldSlots {
68
- label: (props: {
69
- label?: string;
70
- } & AutoFormFieldContext) => unknown;
71
- hint: (props: {
72
- hint?: string;
73
- } & AutoFormFieldContext) => unknown;
74
- description: (props: {
75
- description?: string;
76
- } & AutoFormFieldContext) => unknown;
77
- help: (props: {
78
- help?: string;
79
- } & AutoFormFieldContext) => unknown;
80
- error: (props: {
81
- error?: boolean | string;
82
- } & AutoFormFieldContext) => unknown;
83
- default: (props: {
84
- error?: boolean | string;
85
- } & AutoFormFieldContext) => unknown;
86
- }
87
- type DynamicFieldSlotKeys = keyof AutoFormFieldSlots;
88
- type SlotTypeExtraProps<SlotType extends DynamicFieldSlotKeys> = SlotType extends 'label' ? {
89
- label?: string;
90
- } : SlotType extends 'hint' ? {
91
- hint?: string;
92
- } : SlotType extends 'description' ? {
93
- description?: string;
94
- } : SlotType extends 'help' ? {
95
- help?: string;
96
- } : SlotType extends 'error' ? {
97
- error?: boolean | string;
98
- } : SlotType extends 'default' ? {
99
- error?: boolean | string;
100
- } : {};
101
- type FieldSlotFunction<T, K extends DynamicFieldSlotKeys, P extends string> = (props: SlotTypeExtraProps<K> & AutoFormFieldContext<T, P>) => unknown;
102
- type FieldSlotsMapping<T, K extends DynamicFieldSlotKeys, P extends string> = {
103
- [Path in P as `field-${K}:${Path}`]: FieldSlotFunction<T, K, Path>;
104
- };
105
- /**
106
- * 动态表单插槽类型
107
- * @template T - 表单数据类型
108
- *
109
- * 插槽命名:
110
- * - 通用:`field-{slotType}`
111
- * - 字段:`field-{slotType}:{fieldKey}` - 精确推导字段类型
112
- * - 嵌套:`field-{content|before|after}:{objectKey|arrayKey}`
113
- */
114
- export type DynamicFormSlots<T> = Record<string, (props: AutoFormFieldContext<T>) => unknown> & {
115
- [K in DynamicFieldSlotKeys as `field-${K}`]: (props: SlotTypeExtraProps<K> & AutoFormFieldContext<T>) => unknown;
116
- } & FieldSlotsMapping<T, 'label', NonObjectFieldKeys<T>> & FieldSlotsMapping<T, 'hint', NonObjectFieldKeys<T>> & FieldSlotsMapping<T, 'description', NonObjectFieldKeys<T>> & FieldSlotsMapping<T, 'help', NonObjectFieldKeys<T>> & FieldSlotsMapping<T, 'error', NonObjectFieldKeys<T>> & FieldSlotsMapping<T, 'default', NonObjectFieldKeys<T>> & FieldSlotsMapping<T, 'label', ObjectFieldKeys<T>> & FieldSlotsMapping<T, 'hint', ObjectFieldKeys<T>> & FieldSlotsMapping<T, 'description', ObjectFieldKeys<T>> & FieldSlotsMapping<T, 'help', ObjectFieldKeys<T>> & FieldSlotsMapping<T, 'error', ObjectFieldKeys<T>> & FieldSlotsMapping<T, 'default', ObjectFieldKeys<T>> & {
117
- [P in ObjectFieldKeys<T> | ArrayFieldKeys<T> as `field-${'content' | 'before' | 'after'}:${P}`]: (props: AutoFormFieldContext<T, P>) => unknown;
118
- };
119
- /**
120
- * 表单级插槽属性
121
- * @template T - 表单对象类型
122
- */
123
- export interface AutoFormSlotProps<T extends object> {
124
- /** 表单错误列表 */
125
- errors: FormError[];
126
- /** 表单提交加载状态 */
127
- loading: boolean;
128
- /** 字段配置列表 */
129
- fields: AutoFormField[];
130
- /** 表单当前状态 */
131
- state: T;
132
- }
133
- /**
134
- * 控件元数据统一模型 - 支持响应式属性
135
- * @template C - 组件类型
136
- */
137
- export interface AutoFormControlsMeta<C extends IsComponent = IsComponent> {
138
- /** 控件类型(从注册的控件中选择) */
139
- type?: string;
140
- /** 控件组件(直接传入组件实例时使用) */
141
- component?: C;
142
- /** 控件属性(支持响应式函数) */
143
- controlProps?: ReactiveValue<ComponentProps<C>, AutoFormFieldContext>;
144
- /** 控件插槽(支持部分覆盖,支持响应式函数) */
145
- controlSlots?: ReactiveValue<Partial<ComponentSlots<C>>, AutoFormFieldContext> | Record<string, unknown>;
146
- /** Zod 验证错误消息 */
147
- error?: string;
148
- }
149
- /**
150
- * 控件实例配置 - 运行时使用的简化版本
151
- * @template C - 组件类型
152
- */
153
- export interface AutoFormControl<C extends IsComponent = IsComponent> {
154
- /** 控件组件实例 */
155
- component: C;
156
- /** 控件静态属性 */
157
- controlProps?: ComponentProps<C>;
158
- /** 控件静态插槽 */
159
- controlSlots?: Partial<ComponentSlots<C>>;
160
- }
161
- /**
162
- * 控件注册表类型 - 字符串键映射到控件配置
163
- */
164
- export type AutoFormControls = Record<string, AutoFormControl>;
165
- /**
166
- * 自动表单布局配置 - 支持自定义布局容器
167
- * @template C - 布局组件类型
168
- */
169
- export interface AutoFormLayoutConfig<C extends IsComponent = IsComponent> {
170
- /** 布局容器组件 */
171
- component?: C;
172
- /** 布局组件属性(根据组件类型自动推断,支持响应式) */
173
- props?: ReactiveValue<ComponentProps<C>, AutoFormFieldContext>;
174
- /** 布局组件 CSS 类名(支持响应式) */
175
- class?: ReactiveValue<ClassNameValue, AutoFormFieldContext>;
176
- /** 布局组件插槽(根据组件类型自动推断,支持响应式) */
177
- slots?: ReactiveValue<Partial<ComponentSlots<C>>, AutoFormFieldContext>;
178
- /** 布局内的字段定义(类似 z.object() 的 shape) */
179
- fields: Record<string, z.ZodType>;
180
- /** 所有字段统一渲染到的插槽名称(支持响应式) */
181
- fieldSlot?: ReactiveValue<keyof ComponentSlots<C> & string, AutoFormFieldContext>;
182
- /** 字段到插槽的映射关系(支持响应式,优先级高于 fieldSlot) */
183
- fieldSlots?: ReactiveValue<Partial<Record<string, keyof ComponentSlots<C> & string>>, AutoFormFieldContext>;
184
- }
185
- /**
186
- * 合并后的元数据类型 - 包含全局元数据、控件元数据、布局和覆写
187
- */
188
- export type AutoFormMergeMeta = ZodAutoFormFieldMeta & AutoFormControlsMeta & {
189
- /** 已映射的控件实例(运行时生成) */
190
- mapped?: AutoFormControl;
191
- /** 布局配置 */
192
- layout?: AutoFormLayoutConfig;
193
- /** 覆写元数据(优先级最高) */
194
- overwrite?: AutoFormControlsMeta;
195
- };
196
- /**
197
- * 自动表单字段配置 - 描述单个表单字段的完整信息
198
- */
199
- export interface AutoFormField {
200
- /** 字段路径(点分隔符格式) */
201
- path: string;
202
- /** 字段的 Zod schema 定义 */
203
- schema: z.ZodType;
204
- /** 字段元数据(包含控件配置、布局等) */
205
- meta: AutoFormMergeMeta;
206
- /** 字段装饰器信息(可选性、只读、默认值等) */
207
- decorators: {
208
- /** 是否为可选字段 */
209
- isOptional?: boolean;
210
- /** 是否为只读字段 */
211
- isReadonly?: boolean;
212
- /** 默认值 */
213
- defaultValue?: unknown;
214
- /** 字段描述 */
215
- description?: string;
216
- };
217
- /** 子字段列表(仅对象类型字段有效) */
218
- children?: AutoFormField[];
219
- /** 数组元素模板(仅数组类型字段有效) */
220
- arrayElement?: AutoFormField;
221
- }
222
- /**
223
- * 嵌套字段折叠配置 - 控制对象/数组字段的展开/收起行为
224
- */
225
- export interface AutoFormNestedCollapsible extends Pick<CollapsibleRootProps, 'defaultOpen' | 'open' | 'disabled' | 'unmountOnHide'> {
226
- /**
227
- * 是否启用折叠功能
228
- * @defaultValue true
229
- * @description 当设置为 false 时将直接渲染内容,不使用折叠组件
230
- */
231
- enabled?: boolean;
232
- /**
233
- * 渲染的元素或组件类型
234
- * @defaultValue 'div'
235
- */
236
- as?: unknown;
237
- /** CSS 类名 */
238
- class?: unknown;
239
- /** UI 配置 */
240
- ui?: {
241
- /** 根元素类名 */
242
- root?: ClassNameValue;
243
- /** 内容区域类名 */
244
- content?: ClassNameValue;
245
- };
246
- }
247
- /**
248
- * 提取对象的已知键(剔除索引签名)
249
- * @template T - 源对象类型
250
- */
251
- type KnownKeys<T> = {
252
- [K in keyof T]-?: string extends K ? never : number extends K ? never : symbol extends K ? never : K;
253
- }[keyof T];
254
- type KeysOf<T> = Extract<keyof T, string>;
255
- /**
256
- * 提取控件类型键的简化类型
257
- * @template TControls - 控件注册表类型
258
- */
259
- type ControlTypeKey<TControls> = KnownKeys<TControls> & keyof TControls & string;
260
- /**
261
- * 排除 component 和 type 的控件元数据
262
- * @template T - 组件类型
263
- */
264
- type OmitControlMeta<T extends IsComponent> = OmitByKey<AutoFormControlsMeta<T>, 'component' | 'type'>;
265
- /**
266
- * 根据控件类型键获取对应的元数据类型
267
- * @template TControls - 控件注册表类型
268
- * @template K - 控件类型键
269
- */
270
- type MetaByType<TControls, K extends keyof TControls> = TControls[K] extends AutoFormControl<infer C> ? OmitControlMeta<C> : OmitControlMeta<IsComponent>;
271
- /**
272
- * 根据 Zod 类型字符串获取对应的元数据类型
273
- * @template TControls - 控件注册表类型
274
- * @template TZod - Zod 类型名称
275
- */
276
- type MetaByZod<TControls, TZod extends string> = TZod extends KnownKeys<TControls> ? TControls[TZod] extends AutoFormControl<infer C> ? OmitControlMeta<C> : OmitControlMeta<IsComponent> : OmitControlMeta<IsComponent>;
277
- /**
278
- * 联合类型转交叉类型
279
- * @template U - 联合类型
280
- * @description 此类型可能导致大型联合类型的性能问题,建议限制联合成员数量
281
- */
282
- type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
283
- /**
284
- * 布局标记类型 - 用于类型层面识别布局字段
285
- * @template Fields - 布局内的字段定义
286
- * @description 运行时会被替换为 ZodCustom,仅用于类型推导
287
- */
288
- interface LayoutFieldMarker<Fields extends Record<string, z.ZodType>> extends z.ZodType<AutoFormLayoutConfig<any>, any, any> {
289
- __brand: typeof AUTOFORM_META.LAYOUT_KEY;
290
- fields: Fields;
291
- }
292
- /**
293
- * 递归展开布局字段 - 移除布局标记并合并 fields
294
- * @template S - Shape 类型
295
- * @template Depth - 当前递归深度(内部使用)
296
- * @description 递归深度限制为 5 层,超过后将停止展开并保留原类型
297
- */
298
- type ExtractLayoutShape<S extends Record<string, any>, Depth extends number[] = []> = Depth['length'] extends 5 ? S : {
299
- [K in keyof S as S[K] extends LayoutFieldMarker<any> ? never : K]: S[K];
300
- } & UnionToIntersection<{
301
- [K in keyof S]: S[K] extends LayoutFieldMarker<infer F> ? ExtractLayoutShape<F, [...Depth, 1]> : {};
302
- }[keyof S]>;
303
- /**
304
- * 合并默认控件和自定义控件
305
- * @template TControls - 自定义控件
306
- * @template DFTC - 默认控件
307
- */
308
- type WithDefaultControls<TControls, DFTC> = TControls & DFTC;
309
- /**
310
- * 对象工厂元数据类型 - 基础元数据
311
- */
312
- type ObjectMetaBase<TC extends AutoFormControls, DFTC extends AutoFormControls> = {
313
- component?: never;
314
- type?: never;
315
- } & MetaByZod<WithDefaultControls<TC, DFTC>, 'object'>;
316
- /**
317
- * 对象工厂元数据类型 - 带 type
318
- */
319
- type ObjectMetaWithType<TC extends AutoFormControls, DFTC extends AutoFormControls, K extends ControlTypeKey<WithDefaultControls<TC, DFTC>>> = {
320
- type: Suggest<K>;
321
- component?: never;
322
- } & MetaByType<WithDefaultControls<TC, DFTC>, K>;
323
- /**
324
- * 对象工厂元数据类型 - 带 component
325
- */
326
- type ObjectMetaWithComponent<C extends IsComponent> = {
327
- component: C;
328
- type?: never;
329
- } & OmitControlMeta<C>;
330
- /**
331
- * 对象工厂柯里化签名
332
- */
333
- type ObjectFactoryCurried<TC extends AutoFormControls, DFTC extends AutoFormControls, T extends object, Mode extends z.core.$strip | z.core.$loose | z.core.$strict> = {
334
- <S extends Record<string, any>>(shape: S & Partial<Record<KeysOf<T>, any>>, meta?: ObjectMetaBase<TC, DFTC>): z.ZodObject<ExtractLayoutShape<S>, Mode>;
335
- <S extends Record<string, any>, K extends ControlTypeKey<WithDefaultControls<TC, DFTC>>>(shape: S & Partial<Record<KeysOf<T>, any>>, meta?: ObjectMetaWithType<TC, DFTC, K>): z.ZodObject<ExtractLayoutShape<S>, Mode>;
336
- <S extends Record<string, any>, C extends IsComponent>(shape: S & Partial<Record<KeysOf<T>, any>>, meta?: ObjectMetaWithComponent<C>): z.ZodObject<ExtractLayoutShape<S>, Mode>;
337
- };
338
- /**
339
- * 对象工厂直接调用签名
340
- */
341
- type ObjectFactoryDirect<TC extends AutoFormControls, DFTC extends AutoFormControls, Mode extends z.core.$strip | z.core.$loose | z.core.$strict> = {
342
- <S extends Record<string, any>>(shape: S, meta?: ObjectMetaBase<TC, DFTC>): z.ZodObject<ExtractLayoutShape<S>, Mode>;
343
- <S extends Record<string, any>, K extends ControlTypeKey<WithDefaultControls<TC, DFTC>>>(shape: S, meta?: ObjectMetaWithType<TC, DFTC, K>): z.ZodObject<ExtractLayoutShape<S>, Mode>;
344
- <S extends Record<string, any>, C extends IsComponent>(shape: S, meta?: ObjectMetaWithComponent<C>): z.ZodObject<ExtractLayoutShape<S>, Mode>;
345
- };
346
- /**
347
- * 基础工厂方法类型 - 支持多种调用方式
348
- * @template TControls - 控件注册表
349
- * @template TZod - Zod 类型名称
350
- * @template TResult - 返回类型
351
- * @template TExtraParams - 额外参数(如数组的元素 schema)
352
- *
353
- * 支持四种调用方式:
354
- * 1. 传入错误消息字符串
355
- * 2. 传入基础元数据对象
356
- * 3. 传入带 type 的元数据(指定控件类型)
357
- * 4. 传入带 component 的元数据(直接指定组件)
358
- */
359
- export type AutoFormFactoryMethod<TControls, TZod extends string, TResult, TExtraParams extends unknown[] = []> = {
360
- /** 调用方式 1: 仅传入错误消息或额外参数 */
361
- (...args: [...TExtraParams, string?]): TResult;
362
- /** 调用方式 2: 传入基础元数据(不指定 type 或 component) */
363
- (...args: [...TExtraParams, ({
364
- component?: never;
365
- type?: never;
366
- } & MetaByZod<TControls, TZod>)?]): TResult;
367
- /** 调用方式 3: 传入带 type 的元数据 */
368
- <K extends ControlTypeKey<TControls>>(...args: [...TExtraParams, ({
369
- type: Suggest<K>;
370
- component?: never;
371
- } & MetaByType<TControls, K>)?]): TResult;
372
- /** 调用方式 4: 传入带 component 的元数据 */
373
- <C extends IsComponent>(...args: [...TExtraParams, ({
374
- component: C;
375
- type?: never;
376
- } & OmitControlMeta<C>)?]): TResult;
377
- };
378
- /**
379
- * 类型化的 Zod 工厂接口 - 提供类型安全的 schema 构建方法
380
- * @template TC - 自定义控件注册表
381
- * @template DFTC - 默认控件注册表
382
- *
383
- * @description 此接口提供了一套类型安全的 API 来构建 Zod schema,
384
- * 支持自动推导控件类型和元数据,并与 AutoForm 无缝集成
385
- */
386
- export interface TypedZodFactory<TC extends AutoFormControls, DFTC extends AutoFormControls> {
387
- /** 字符串类型工厂 */
388
- string: AutoFormFactoryMethod<WithDefaultControls<TC, DFTC>, 'string', z.ZodString>;
389
- /** 数字类型工厂 */
390
- number: AutoFormFactoryMethod<WithDefaultControls<TC, DFTC>, 'number', z.ZodNumber>;
391
- /** 布尔类型工厂 */
392
- boolean: AutoFormFactoryMethod<WithDefaultControls<TC, DFTC>, 'boolean', z.ZodBoolean>;
393
- /** 文件类型工厂 */
394
- file: AutoFormFactoryMethod<WithDefaultControls<TC, DFTC>, 'file', z.ZodType<File>>;
395
- /** 电子邮件验证工厂 */
396
- email: AutoFormFactoryMethod<WithDefaultControls<TC, DFTC>, 'string', z.ZodString>;
397
- /** URL 验证工厂 */
398
- url: AutoFormFactoryMethod<WithDefaultControls<TC, DFTC>, 'string', z.ZodString>;
399
- /** UUID 验证工厂 */
400
- uuid: AutoFormFactoryMethod<WithDefaultControls<TC, DFTC>, 'string', z.ZodString>;
401
- /**
402
- * 枚举类型工厂 - 支持字符串数组或枚举对象
403
- * @description 重载顺序:空数组 > 字符串数组 > 枚举对象
404
- */
405
- enum: {
406
- (values: [], overwrite?: MetaByZod<WithDefaultControls<TC, DFTC>, 'enum'>): z.ZodString;
407
- <K extends ControlTypeKey<WithDefaultControls<TC, DFTC>>>(values: [], overwrite?: {
408
- type: Suggest<K>;
409
- component?: never;
410
- } & MetaByType<WithDefaultControls<TC, DFTC>, K>): z.ZodString;
411
- <C extends IsComponent>(values: [], overwrite?: {
412
- component: C;
413
- type?: never;
414
- } & OmitControlMeta<C>): z.ZodString;
415
- <const T extends ReadonlyArray<string>>(values: T, overwrite?: MetaByZod<WithDefaultControls<TC, DFTC>, 'enum'>): z.ZodEnum<z.core.util.ToEnum<T[number]>>;
416
- <const T extends ReadonlyArray<string>, K extends ControlTypeKey<WithDefaultControls<TC, DFTC>>>(values: T, overwrite?: {
417
- type: Suggest<K>;
418
- component?: never;
419
- } & MetaByType<WithDefaultControls<TC, DFTC>, K>): z.ZodEnum<z.core.util.ToEnum<T[number]>>;
420
- <const T extends ReadonlyArray<string>, C extends IsComponent>(values: T, overwrite?: {
421
- component: C;
422
- type?: never;
423
- } & OmitControlMeta<C>): z.ZodEnum<z.core.util.ToEnum<T[number]>>;
424
- <const T extends z.core.util.EnumLike>(values: T, overwrite?: MetaByZod<WithDefaultControls<TC, DFTC>, 'enum'>): z.ZodEnum<T>;
425
- <const T extends z.core.util.EnumLike, K extends ControlTypeKey<WithDefaultControls<TC, DFTC>>>(values: T, overwrite?: {
426
- type: Suggest<K>;
427
- component?: never;
428
- } & MetaByType<WithDefaultControls<TC, DFTC>, K>): z.ZodEnum<T>;
429
- <const T extends z.core.util.EnumLike, C extends IsComponent>(values: T, overwrite?: {
430
- component: C;
431
- type?: never;
432
- } & OmitControlMeta<C>): z.ZodEnum<T>;
433
- };
434
- /**
435
- * 日期类型工厂 - 用于 DatePicker/Calendar
436
- * 支持 CalendarDate、DateRange、CalendarDate[]
437
- * @template T - 日期值类型(默认 CalendarDate)
438
- */
439
- calendarDate: {
440
- <T extends DateValue | DateRange | DateValue[] = CalendarDate>(meta?: ({
441
- component?: never;
442
- type?: never;
443
- } & MetaByZod<WithDefaultControls<TC, DFTC>, 'date'>)): z.ZodType<T>;
444
- <K extends ControlTypeKey<WithDefaultControls<TC, DFTC>>, T extends DateValue | DateRange | DateValue[] = CalendarDate>(meta?: {
445
- type: Suggest<K>;
446
- component?: never;
447
- } & MetaByType<WithDefaultControls<TC, DFTC>, K>): z.ZodType<T>;
448
- <C extends IsComponent, T extends DateValue | DateRange | DateValue[] = CalendarDate>(meta?: {
449
- component: C;
450
- type?: never;
451
- } & OmitControlMeta<C>): z.ZodType<T>;
452
- };
453
- /**
454
- * 输入日期工厂 - 用于 UInputDate 组件
455
- * 返回 CalendarDate 类型
456
- */
457
- inputDate: AutoFormFactoryMethod<WithDefaultControls<TC, DFTC>, 'inputDate', z.ZodType<CalendarDate>>;
458
- /**
459
- * 输入时间工厂 - 用于 UInputTime 组件
460
- * 返回 Time 类型
461
- */
462
- inputTime: AutoFormFactoryMethod<WithDefaultControls<TC, DFTC>, 'inputTime', z.ZodType<Time>>;
463
- /**
464
- * ISO 日期时间字符串工厂
465
- * 验证 ISO 8601 格式(如 "2025-12-01T06:15:00Z")
466
- */
467
- isoDatetime: AutoFormFactoryMethod<WithDefaultControls<TC, DFTC>, 'string', z.ZodType<string>>;
468
- /**
469
- * ISO 日期字符串工厂
470
- * 验证 YYYY-MM-DD 格式(如 "2025-12-01")
471
- */
472
- isoDate: AutoFormFactoryMethod<WithDefaultControls<TC, DFTC>, 'string', z.ZodType<string>>;
473
- /**
474
- * ISO 时间字符串工厂
475
- * 验证 HH:MM[:SS[.s+]] 格式(如 "14:30:00")
476
- */
477
- isoTime: AutoFormFactoryMethod<WithDefaultControls<TC, DFTC>, 'string', z.ZodType<string>>;
478
- /**
479
- * 数组类型工厂
480
- * @template T - 数组元素的 Zod 类型
481
- */
482
- array: {
483
- <T extends z.ZodType>(schema: T, overwrite?: never): z.ZodArray<T>;
484
- <T extends z.ZodType, K extends ControlTypeKey<WithDefaultControls<TC, DFTC>>>(schema: T, overwrite?: {
485
- type: Suggest<K>;
486
- component?: never;
487
- } & MetaByType<WithDefaultControls<TC, DFTC>, K>): z.ZodArray<T>;
488
- <T extends z.ZodType, C extends IsComponent>(schema: T, overwrite?: {
489
- component: C;
490
- type?: never;
491
- } & OmitControlMeta<C>): z.ZodArray<T>;
492
- };
493
- /**
494
- * 元组类型工厂
495
- * @template T - 元组元素的 Zod 类型数组
496
- */
497
- tuple: {
498
- <T extends readonly [z.ZodType, ...z.ZodType[]]>(schemas: T, overwrite?: never): z.ZodTuple<T>;
499
- <T extends readonly [z.ZodType, ...z.ZodType[]], K extends ControlTypeKey<WithDefaultControls<TC, DFTC>>>(schemas: T, overwrite?: {
500
- type: Suggest<K>;
501
- component?: never;
502
- } & MetaByType<WithDefaultControls<TC, DFTC>, K>): z.ZodTuple<T>;
503
- <T extends readonly [z.ZodType, ...z.ZodType[]], C extends IsComponent>(schemas: T, overwrite?: {
504
- component: C;
505
- type?: never;
506
- } & OmitControlMeta<C>): z.ZodTuple<T>;
507
- };
508
- /**
509
- * 布局工厂 - 创建表单布局容器
510
- * @template C - 布局组件类型
511
- * @template Fields - 布局内字段定义
512
- * @returns 布局标记类型(运行时为 ZodCustom)
513
- */
514
- layout: <C extends IsComponent = IsComponent, Fields extends Record<string, z.ZodType> = Record<string, z.ZodType>>(config: Omit<AutoFormLayoutConfig<C>, 'fields'> & {
515
- fields: Fields;
516
- }) => LayoutFieldMarker<Fields>;
517
- /**
518
- * 对象工厂 - 支持柯里化和直接调用
519
- * @description
520
- * - 柯里化: afz.object<State>()({ name: afz.string() }, { type: 'input' })
521
- * - 直接调用: afz.object({ name: afz.string() }, { type: 'input' })
522
- */
523
- object: {
524
- <T extends object>(): ObjectFactoryCurried<TC, DFTC, T, z.core.$strip>;
525
- <S extends Record<string, any>>(shape: S, meta?: ObjectMetaBase<TC, DFTC>): z.ZodObject<ExtractLayoutShape<S>, z.core.$strip>;
526
- <S extends Record<string, any>, K extends ControlTypeKey<WithDefaultControls<TC, DFTC>>>(shape: S, meta?: ObjectMetaWithType<TC, DFTC, K>): z.ZodObject<ExtractLayoutShape<S>, z.core.$strip>;
527
- <S extends Record<string, any>, C extends IsComponent>(shape: S, meta?: ObjectMetaWithComponent<C>): z.ZodObject<ExtractLayoutShape<S>, z.core.$strip>;
528
- } & ObjectFactoryDirect<TC, DFTC, z.core.$strip>;
529
- /**
530
- * 松散对象工厂 - 允许额外属性
531
- */
532
- looseObject: {
533
- <T extends object>(): ObjectFactoryCurried<TC, DFTC, T, z.core.$loose>;
534
- <S extends Record<string, any>>(shape: S, meta?: ObjectMetaBase<TC, DFTC>): z.ZodObject<ExtractLayoutShape<S>, z.core.$loose>;
535
- <S extends Record<string, any>, K extends ControlTypeKey<WithDefaultControls<TC, DFTC>>>(shape: S, meta?: ObjectMetaWithType<TC, DFTC, K>): z.ZodObject<ExtractLayoutShape<S>, z.core.$loose>;
536
- <S extends Record<string, any>, C extends IsComponent>(shape: S, meta?: ObjectMetaWithComponent<C>): z.ZodObject<ExtractLayoutShape<S>, z.core.$loose>;
537
- } & ObjectFactoryDirect<TC, DFTC, z.core.$loose>;
538
- /**
539
- * 严格对象工厂 - 禁止额外属性
540
- */
541
- strictObject: {
542
- <T extends object>(): ObjectFactoryCurried<TC, DFTC, T, z.core.$strict>;
543
- <S extends Record<string, any>>(shape: S, meta?: ObjectMetaBase<TC, DFTC>): z.ZodObject<ExtractLayoutShape<S>, z.core.$strict>;
544
- <S extends Record<string, any>, K extends ControlTypeKey<WithDefaultControls<TC, DFTC>>>(shape: S, meta?: ObjectMetaWithType<TC, DFTC, K>): z.ZodObject<ExtractLayoutShape<S>, z.core.$strict>;
545
- <S extends Record<string, any>, C extends IsComponent>(shape: S, meta?: ObjectMetaWithComponent<C>): z.ZodObject<ExtractLayoutShape<S>, z.core.$strict>;
546
- } & ObjectFactoryDirect<TC, DFTC, z.core.$strict>;
547
- }
548
- export {};
@@ -1,43 +0,0 @@
1
- import type { ButtonProps, PopoverProps, ColorPickerProps, PopoverEmits, CalendarProps, CalendarEmits, InputProps, InputEmits, InputSlots, TooltipProps, InputValue } from '@nuxt/ui';
2
- import type { OmitByKey } from '@movk/core';
3
- import type { ClassNameValue } from 'tailwind-merge';
4
- import type { DateFormatterOptions, useDateFormatter } from '../composables/useDateFormatter.js';
5
- export interface ColorChooserProps<P extends 'click' | 'hover' = 'click'> extends /** @vue-ignore */ ColorPickerProps {
6
- popoverProps?: PopoverProps<P>;
7
- buttonProps?: ButtonProps;
8
- }
9
- export type ColorChooserEmits = PopoverEmits;
10
- export type LabelFormat = 'iso' | 'formatted' | 'date' | 'timestamp' | 'unix';
11
- export type ValueType<R extends boolean, M extends boolean> = CalendarProps<R, M>['modelValue'];
12
- export interface DatePickerProps<R extends boolean, M extends boolean, P extends 'click' | 'hover' = 'click'> extends /** @vue-ignore */ OmitByKey<CalendarProps<R, M>, 'modelValue'>, DateFormatterOptions {
13
- buttonProps?: ButtonProps;
14
- popoverProps?: PopoverProps<P>;
15
- labelFormat?: LabelFormat | ((formatter: ReturnType<typeof useDateFormatter>, modelValue: ValueType<R, M>) => string);
16
- }
17
- export type DatePickerEmits<R extends boolean, M extends boolean> = PopoverEmits & CalendarEmits<R, M>;
18
- export interface WithCharacterLimitProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue'> {
19
- maxLength?: number;
20
- counterClass?: ClassNameValue;
21
- }
22
- export type WithCharacterLimitEmits<T extends InputValue = InputValue> = InputEmits<T>;
23
- export type WithCharacterLimitSlots = OmitByKey<InputSlots, 'trailing'>;
24
- export interface WithClearProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue'> {
25
- buttonProps?: ButtonProps;
26
- }
27
- export type WithClearEmits<T extends InputValue = InputValue> = InputEmits<T> & {
28
- clear: [];
29
- };
30
- export type WithClearSlots = OmitByKey<InputSlots, 'trailing'>;
31
- export interface WithCopyProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue'> {
32
- buttonProps?: ButtonProps;
33
- tooltipProps?: TooltipProps;
34
- }
35
- export type WithCopyEmits<T extends InputValue = InputValue> = InputEmits<T> & {
36
- copy: [value: string];
37
- };
38
- export type WithCopySlots = OmitByKey<InputSlots, 'trailing'>;
39
- export interface WithPasswordToggleProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'type' | 'modelValue'> {
40
- buttonProps?: ButtonProps;
41
- }
42
- export type WithPasswordToggleEmits<T extends InputValue = InputValue> = InputEmits<T>;
43
- export type WithPasswordToggleSlots = OmitByKey<InputSlots, 'trailing'>;
@@ -1,39 +0,0 @@
1
- import type { ApiClient, MovkApiPublicConfig, MovkApiPrivateConfig, MovkApiFullConfig } from './api.js';
2
- export interface ModuleOptions {
3
- /**
4
- * 组件前缀
5
- * @default 'M'
6
- */
7
- prefix?: string;
8
- /**
9
- * API 模块配置
10
- */
11
- api?: MovkApiFullConfig;
12
- }
13
- declare module '#app' {
14
- interface NuxtApp {
15
- $api: ApiClient;
16
- }
17
- }
18
- declare module 'nuxt/schema' {
19
- interface NuxtConfig {
20
- movk?: ModuleOptions;
21
- }
22
- interface NuxtOptions {
23
- movk: ModuleOptions;
24
- }
25
- interface PublicRuntimeConfig {
26
- movkApi: MovkApiPublicConfig;
27
- }
28
- interface RuntimeConfig {
29
- movkApi: MovkApiPrivateConfig;
30
- }
31
- interface AppConfig {
32
- theme: {
33
- radius: number;
34
- blackAsPrimary: boolean;
35
- font: string;
36
- icons: string;
37
- };
38
- }
39
- }