@movk/nuxt 1.2.0 → 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 (293) hide show
  1. package/.nuxt/movk-ui.css +3 -0
  2. package/README.md +74 -79
  3. package/dist/module.d.mts +57 -1
  4. package/dist/module.json +2 -2
  5. package/dist/module.mjs +120 -126
  6. package/dist/runtime/components/AutoForm.d.vue.ts +10 -30
  7. package/dist/runtime/components/AutoForm.vue +114 -125
  8. package/dist/runtime/components/AutoForm.vue.d.ts +10 -30
  9. package/dist/runtime/components/ColorChooser.d.vue.ts +21 -22
  10. package/dist/runtime/components/ColorChooser.vue +304 -27
  11. package/dist/runtime/components/ColorChooser.vue.d.ts +21 -22
  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 +20 -33
  16. package/dist/runtime/components/DatePicker.vue +173 -65
  17. package/dist/runtime/components/DatePicker.vue.d.ts +20 -33
  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 +21 -149
  28. package/dist/runtime/components/SearchForm.vue +211 -153
  29. package/dist/runtime/components/SearchForm.vue.d.ts +21 -149
  30. package/dist/runtime/components/SlideVerify.d.vue.ts +31 -70
  31. package/dist/runtime/components/SlideVerify.vue +117 -90
  32. package/dist/runtime/components/SlideVerify.vue.d.ts +31 -70
  33. package/dist/runtime/components/StarRating.d.vue.ts +38 -87
  34. package/dist/runtime/components/StarRating.vue +118 -74
  35. package/dist/runtime/components/StarRating.vue.d.ts +38 -87
  36. package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +11 -15
  37. package/dist/runtime/components/input/AsPhoneNumberInput.vue +22 -9
  38. package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +11 -15
  39. package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +11 -13
  40. package/dist/runtime/components/input/WithCharacterLimit.vue +23 -11
  41. package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +11 -13
  42. package/dist/runtime/components/input/WithClear.d.vue.ts +13 -11
  43. package/dist/runtime/components/input/WithClear.vue +27 -8
  44. package/dist/runtime/components/input/WithClear.vue.d.ts +13 -11
  45. package/dist/runtime/components/input/WithCopy.d.vue.ts +13 -13
  46. package/dist/runtime/components/input/WithCopy.vue +25 -8
  47. package/dist/runtime/components/input/WithCopy.vue.d.ts +13 -13
  48. package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +13 -16
  49. package/dist/runtime/components/input/WithFloatingLabel.vue +35 -27
  50. package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +13 -16
  51. package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +11 -7
  52. package/dist/runtime/components/input/WithPasswordToggle.vue +24 -7
  53. package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +11 -7
  54. package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +8 -1
  55. package/dist/runtime/components/theme-picker/ThemePicker.vue +27 -12
  56. package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +8 -1
  57. package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +9 -4
  58. package/dist/runtime/components/theme-picker/ThemePickerButton.vue +4 -0
  59. package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +9 -4
  60. package/dist/runtime/composables/index.d.ts +9 -8
  61. package/dist/runtime/composables/index.js +1 -0
  62. package/dist/runtime/composables/useApiFetch.d.ts +10 -5
  63. package/dist/runtime/composables/useApiFetch.js +20 -2
  64. package/dist/runtime/composables/useAutoForm.d.ts +4 -4
  65. package/dist/runtime/composables/useAutoForm.js +23 -9
  66. package/dist/runtime/composables/useClientApiFetch.d.ts +3 -2
  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 +142 -40
  71. package/dist/runtime/composables/useLazyApiFetch.d.ts +3 -2
  72. package/dist/runtime/composables/useMessageBox.d.ts +6 -0
  73. package/dist/runtime/composables/useMessageBox.js +16 -0
  74. package/dist/runtime/composables/useTheme.d.ts +26 -16
  75. package/dist/runtime/composables/useTheme.js +98 -71
  76. package/dist/runtime/composables/useUploadWithProgress.d.ts +23 -29
  77. package/dist/runtime/composables/useUploadWithProgress.js +78 -67
  78. package/dist/runtime/domains/api/auth.d.ts +2 -0
  79. package/dist/runtime/domains/api/auth.js +31 -0
  80. package/dist/runtime/domains/api/endpoint-config.d.ts +11 -0
  81. package/dist/runtime/domains/api/endpoint-config.js +17 -0
  82. package/dist/runtime/domains/api/errors.d.ts +2 -0
  83. package/dist/runtime/domains/api/errors.js +10 -0
  84. package/dist/runtime/domains/api/fetch-key.d.ts +20 -0
  85. package/dist/runtime/domains/api/fetch-key.js +23 -0
  86. package/dist/runtime/domains/api/interceptors/error.d.ts +13 -0
  87. package/dist/runtime/domains/api/interceptors/error.js +49 -0
  88. package/dist/runtime/domains/api/interceptors/request.d.ts +12 -0
  89. package/dist/runtime/domains/api/interceptors/request.js +46 -0
  90. package/dist/runtime/domains/api/interceptors/response.d.ts +17 -0
  91. package/dist/runtime/domains/api/interceptors/response.js +27 -0
  92. package/dist/runtime/domains/api/response.d.ts +4 -0
  93. package/dist/runtime/domains/api/response.js +14 -0
  94. package/dist/runtime/domains/api/toast.d.ts +15 -0
  95. package/dist/runtime/domains/api/toast.js +46 -0
  96. package/dist/runtime/domains/api/transfer.d.ts +69 -0
  97. package/dist/runtime/domains/api/transfer.js +81 -0
  98. package/dist/runtime/domains/auto-form/actions.d.ts +2 -0
  99. package/dist/runtime/domains/auto-form/actions.js +4 -0
  100. package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +13 -0
  101. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererArray.vue → domains/auto-form/components/Array.vue} +25 -29
  102. package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +13 -0
  103. package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +11 -0
  104. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererChildren.vue → domains/auto-form/components/Children.vue} +18 -18
  105. package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +11 -0
  106. package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +11 -0
  107. package/dist/runtime/domains/auto-form/components/Field.vue +56 -0
  108. package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +11 -0
  109. package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +11 -0
  110. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererLayout.vue → domains/auto-form/components/Layout.vue} +24 -25
  111. package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +11 -0
  112. package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +11 -0
  113. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererNested.vue → domains/auto-form/components/Nested.vue} +17 -21
  114. package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +11 -0
  115. package/dist/runtime/domains/auto-form/controls.d.ts +41 -0
  116. package/dist/runtime/{auto-form → domains/auto-form}/controls.js +27 -24
  117. package/dist/runtime/{auto-form/field-utils.d.ts → domains/auto-form/fields.d.ts} +3 -1
  118. package/dist/runtime/{auto-form/field-utils.js → domains/auto-form/fields.js} +18 -2
  119. package/dist/runtime/{auto-form → domains/auto-form}/metadata.js +1 -1
  120. package/dist/runtime/domains/auto-form/provider.d.ts +62 -0
  121. package/dist/runtime/{auto-form → domains/auto-form}/provider.js +6 -3
  122. package/dist/runtime/{auto-form/reactive-utils.d.ts → domains/auto-form/reactive.d.ts} +5 -5
  123. package/dist/runtime/{auto-form/reactive-utils.js → domains/auto-form/reactive.js} +1 -1
  124. package/dist/runtime/{auto-form/schema-introspector.d.ts → domains/auto-form/schema.d.ts} +2 -2
  125. package/dist/runtime/{auto-form/schema-introspector.js → domains/auto-form/schema.js} +1 -1
  126. package/dist/runtime/domains/data-table/columns/constants.d.ts +50 -0
  127. package/dist/runtime/domains/data-table/columns/constants.js +19 -0
  128. package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +4 -0
  129. package/dist/runtime/domains/data-table/columns/resolve-columns.js +59 -0
  130. package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +9 -0
  131. package/dist/runtime/domains/data-table/columns/resolve-data-column.js +164 -0
  132. package/dist/runtime/domains/data-table/columns/resolve-group-column.d.ts +4 -0
  133. package/dist/runtime/domains/data-table/columns/resolve-group-column.js +19 -0
  134. package/dist/runtime/domains/data-table/columns/resolve-special-columns.d.ts +8 -0
  135. package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +232 -0
  136. package/dist/runtime/domains/data-table/columns/style.d.ts +11 -0
  137. package/dist/runtime/domains/data-table/columns/style.js +67 -0
  138. package/dist/runtime/domains/data-table/columns/utils.d.ts +6 -0
  139. package/dist/runtime/domains/data-table/columns/utils.js +16 -0
  140. package/dist/runtime/domains/data-table/components/ActionConfirm.d.vue.ts +10 -0
  141. package/dist/runtime/domains/data-table/components/ActionConfirm.vue +39 -0
  142. package/dist/runtime/domains/data-table/components/ActionConfirm.vue.d.ts +10 -0
  143. package/dist/runtime/domains/data-table/components/ActionsCell.d.vue.ts +11 -0
  144. package/dist/runtime/domains/data-table/components/ActionsCell.vue +91 -0
  145. package/dist/runtime/domains/data-table/components/ActionsCell.vue.d.ts +11 -0
  146. package/dist/runtime/domains/data-table/components/CellTooltip.d.vue.ts +9 -0
  147. package/dist/runtime/domains/data-table/components/CellTooltip.vue +40 -0
  148. package/dist/runtime/domains/data-table/components/CellTooltip.vue.d.ts +9 -0
  149. package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +26 -0
  150. package/dist/runtime/domains/data-table/components/Pagination.vue +132 -0
  151. package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +26 -0
  152. package/dist/runtime/domains/data-table/indent.d.ts +8 -0
  153. package/dist/runtime/domains/data-table/indent.js +19 -0
  154. package/dist/runtime/domains/data-table/tree-selection.d.ts +9 -0
  155. package/dist/runtime/domains/data-table/tree-selection.js +76 -0
  156. package/dist/runtime/{utils/theme.d.ts → domains/theme/theme-icons.d.ts} +0 -1
  157. package/dist/runtime/index.css +1 -0
  158. package/dist/runtime/plugins/api.factory.js +17 -117
  159. package/dist/runtime/plugins/theme.js +49 -27
  160. package/dist/runtime/types/api/config.d.ts +127 -0
  161. package/dist/runtime/types/api/fetch.d.ts +50 -0
  162. package/dist/runtime/types/api/index.d.ts +5 -0
  163. package/dist/runtime/types/api/module.d.ts +94 -0
  164. package/dist/runtime/types/api/response.d.ts +62 -0
  165. package/dist/runtime/types/api/response.js +0 -0
  166. package/dist/runtime/types/api/transfer.d.ts +32 -0
  167. package/dist/runtime/types/api/transfer.js +0 -0
  168. package/dist/runtime/types/app.config.d.ts +6 -0
  169. package/dist/runtime/types/auto-form/base.d.ts +26 -0
  170. package/dist/runtime/types/auto-form/base.js +0 -0
  171. package/dist/runtime/types/auto-form/component.d.ts +28 -0
  172. package/dist/runtime/types/auto-form/component.js +0 -0
  173. package/dist/runtime/types/auto-form/controls.d.ts +45 -0
  174. package/dist/runtime/types/auto-form/controls.js +0 -0
  175. package/dist/runtime/types/auto-form/fields.d.ts +68 -0
  176. package/dist/runtime/types/auto-form/fields.js +0 -0
  177. package/dist/runtime/types/auto-form/index.d.ts +7 -0
  178. package/dist/runtime/types/auto-form/index.js +0 -0
  179. package/dist/runtime/types/auto-form/search-form.d.ts +84 -0
  180. package/dist/runtime/types/auto-form/search-form.js +0 -0
  181. package/dist/runtime/types/auto-form/slots.d.ts +85 -0
  182. package/dist/runtime/types/auto-form/slots.js +0 -0
  183. package/dist/runtime/types/auto-form/zod-factory.d.ts +127 -0
  184. package/dist/runtime/types/auto-form/zod-factory.js +0 -0
  185. package/dist/runtime/types/components/color-chooser.d.ts +109 -0
  186. package/dist/runtime/types/components/color-chooser.js +0 -0
  187. package/dist/runtime/types/components/date-picker.d.ts +41 -0
  188. package/dist/runtime/types/components/date-picker.js +0 -0
  189. package/dist/runtime/types/components/index.d.ts +8 -0
  190. package/dist/runtime/types/components/index.js +0 -0
  191. package/dist/runtime/types/components/input/as-phone-number-input.d.ts +17 -0
  192. package/dist/runtime/types/components/input/as-phone-number-input.js +0 -0
  193. package/dist/runtime/types/components/input/index.d.ts +6 -0
  194. package/dist/runtime/types/components/input/index.js +0 -0
  195. package/dist/runtime/types/components/input/with-character-limit.d.ts +11 -0
  196. package/dist/runtime/types/components/input/with-character-limit.js +0 -0
  197. package/dist/runtime/types/components/input/with-clear.d.ts +10 -0
  198. package/dist/runtime/types/components/input/with-clear.js +0 -0
  199. package/dist/runtime/types/components/input/with-copy.d.ts +11 -0
  200. package/dist/runtime/types/components/input/with-copy.js +0 -0
  201. package/dist/runtime/types/components/input/with-floating-label.d.ts +12 -0
  202. package/dist/runtime/types/components/input/with-floating-label.js +0 -0
  203. package/dist/runtime/types/components/input/with-password-toggle.d.ts +7 -0
  204. package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
  205. package/dist/runtime/types/components/message-box.d.ts +69 -0
  206. package/dist/runtime/types/components/message-box.js +0 -0
  207. package/dist/runtime/types/components/pill-group.d.ts +103 -0
  208. package/dist/runtime/types/components/pill-group.js +0 -0
  209. package/dist/runtime/types/components/popconfirm.d.ts +74 -0
  210. package/dist/runtime/types/components/popconfirm.js +0 -0
  211. package/dist/runtime/types/components/slide-verify.d.ts +54 -0
  212. package/dist/runtime/types/components/slide-verify.js +0 -0
  213. package/dist/runtime/types/components/star-rating.d.ts +55 -0
  214. package/dist/runtime/types/components/star-rating.js +0 -0
  215. package/dist/runtime/types/data-table/columns.d.ts +236 -0
  216. package/dist/runtime/types/data-table/columns.js +6 -0
  217. package/dist/runtime/types/data-table/component.d.ts +190 -0
  218. package/dist/runtime/types/data-table/component.js +0 -0
  219. package/dist/runtime/types/data-table/contexts.d.ts +44 -0
  220. package/dist/runtime/types/data-table/contexts.js +0 -0
  221. package/dist/runtime/types/data-table/index.d.ts +6 -0
  222. package/dist/runtime/types/data-table/index.js +1 -0
  223. package/dist/runtime/types/data-table/pagination.d.ts +87 -0
  224. package/dist/runtime/types/data-table/pagination.js +0 -0
  225. package/dist/runtime/types/index.d.ts +6 -5
  226. package/dist/runtime/types/index.js +5 -5
  227. package/dist/runtime/types/shared.d.ts +5 -0
  228. package/dist/runtime/types/shared.js +0 -0
  229. package/dist/runtime/types/zod.d.ts +11 -10
  230. package/dist/runtime/utils/extend-theme.d.ts +19 -0
  231. package/dist/runtime/utils/extend-theme.js +44 -0
  232. package/dist/runtime/utils/form-control.d.ts +33 -0
  233. package/dist/runtime/utils/form-control.js +54 -0
  234. package/dist/runtime/utils/meta.d.ts +2 -5
  235. package/dist/runtime/utils/meta.js +1 -3
  236. package/dist/runtime/utils/theme-defaults.d.ts +27 -0
  237. package/dist/runtime/utils/theme-defaults.js +28 -0
  238. package/dist/runtime/utils/tv.d.ts +1 -0
  239. package/dist/runtime/utils/tv.js +4 -0
  240. package/dist/runtime/vue/composables/useSiteConfig.d.ts +13 -0
  241. package/dist/runtime/vue/composables/useSiteConfig.js +11 -0
  242. package/dist/runtime/vue/plugins/theme.d.ts +6 -0
  243. package/dist/runtime/vue/plugins/theme.js +14 -0
  244. package/dist/runtime/vue/stubs/base.d.ts +2 -0
  245. package/dist/runtime/vue/stubs/base.js +2 -0
  246. package/dist/runtime/vue/stubs/inertia.d.ts +2 -0
  247. package/dist/runtime/vue/stubs/inertia.js +2 -0
  248. package/dist/runtime/vue/stubs/movk-extra.d.ts +2 -0
  249. package/dist/runtime/vue/stubs/movk-extra.js +2 -0
  250. package/dist/runtime/vue/stubs/none.d.ts +2 -0
  251. package/dist/runtime/vue/stubs/none.js +2 -0
  252. package/dist/runtime/vue/stubs/vue-router.d.ts +2 -0
  253. package/dist/runtime/vue/stubs/vue-router.js +2 -0
  254. package/dist/shared/nuxt.DfBEyjld.mjs +667 -0
  255. package/dist/types.d.mts +2 -6
  256. package/dist/unplugin.d.mts +28 -0
  257. package/dist/unplugin.mjs +292 -0
  258. package/dist/vite.d.mts +12 -0
  259. package/dist/vite.mjs +20 -0
  260. package/package.json +75 -36
  261. package/vue-plugin.d.ts +5 -0
  262. package/dist/runtime/auto-form/controls.d.ts +0 -221
  263. package/dist/runtime/auto-form/provider.d.ts +0 -27
  264. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +0 -28
  265. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +0 -28
  266. package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.d.vue.ts +0 -26
  267. package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.vue.d.ts +0 -26
  268. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +0 -26
  269. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue +0 -55
  270. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +0 -26
  271. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +0 -26
  272. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +0 -26
  273. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +0 -26
  274. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +0 -26
  275. package/dist/runtime/constants/api-defaults.d.ts +0 -9
  276. package/dist/runtime/constants/api-defaults.js +0 -32
  277. package/dist/runtime/constants/grid-cols.d.ts +0 -7
  278. package/dist/runtime/constants/grid-cols.js +0 -44
  279. package/dist/runtime/style.css +0 -1
  280. package/dist/runtime/types/api.d.ts +0 -349
  281. package/dist/runtime/types/auto-form.d.ts +0 -259
  282. package/dist/runtime/types/module.d.ts +0 -96
  283. package/dist/runtime/types/theme.d.ts +0 -2
  284. package/dist/runtime/utils/api-utils.d.ts +0 -58
  285. package/dist/runtime/utils/api-utils.js +0 -98
  286. /package/dist/runtime/{constants/auto-form.d.ts → domains/auto-form/constants.d.ts} +0 -0
  287. /package/dist/runtime/{constants/auto-form.js → domains/auto-form/constants.js} +0 -0
  288. /package/dist/runtime/{auto-form → domains/auto-form}/metadata.d.ts +0 -0
  289. /package/dist/runtime/{utils/theme.js → domains/theme/theme-icons.js} +0 -0
  290. /package/dist/runtime/types/{api.js → api/config.js} +0 -0
  291. /package/dist/runtime/types/{auto-form.js → api/fetch.js} +0 -0
  292. /package/dist/runtime/types/{module.js → api/index.js} +0 -0
  293. /package/dist/runtime/types/{theme.js → api/module.js} +0 -0
@@ -1,164 +1,36 @@
1
- import type { ButtonProps, FormProps, InferInput } from '@nuxt/ui';
1
+ import type { ComponentConfig, InferInput } from '@nuxt/ui';
2
2
  import type { z } from 'zod';
3
- import type { ZodAutoFormFieldMeta } from '../types/zod.js';
4
- import type { AutoFormControls } from '../types/auto-form.js';
5
- export interface SearchFormProps<S extends z.ZodObject, T extends boolean = true, N extends boolean = false> extends FormProps<S, T, N> {
6
- /**
7
- * Zod 对象 schema,定义搜索字段
8
- */
9
- schema: S;
10
- /**
11
- * 网格列数
12
- * @defaultValue 3
13
- */
14
- cols?: number | {
15
- sm?: number;
16
- md?: number;
17
- lg?: number;
18
- xl?: number;
19
- };
20
- /**
21
- * 可见行数(折叠时显示的行数)
22
- * @defaultValue 1
23
- */
24
- visibleRows?: number;
25
- /**
26
- * 自定义控件映射(复用 AutoForm 的控件系统)
27
- */
28
- controls?: AutoFormControls;
29
- /**
30
- * 全局字段元数据
31
- */
32
- globalMeta?: ZodAutoFormFieldMeta;
33
- /**
34
- * 搜索按钮属性
35
- */
36
- searchButtonProps?: ButtonProps;
37
- /**
38
- * 重置按钮属性
39
- */
40
- resetButtonProps?: ButtonProps;
41
- /**
42
- * 搜索按钮文本
43
- * @defaultValue '搜索'
44
- */
45
- searchText?: string;
46
- /**
47
- * 重置按钮文本
48
- * @defaultValue '重置'
49
- */
50
- resetText?: string;
51
- /**
52
- * 是否显示搜索按钮
53
- * @defaultValue true
54
- */
55
- showSearchButton?: boolean;
56
- /**
57
- * 是否显示重置按钮
58
- * @defaultValue true
59
- */
60
- showResetButton?: boolean;
61
- /**
62
- * 搜索按钮加载状态
63
- * @defaultValue false
64
- */
65
- loading?: boolean;
66
- /**
67
- * 展开/收起按钮图标
68
- * @defaultValue 'i-lucide-chevron-down'
69
- */
70
- icon?: string;
71
- /**
72
- * 展开按钮文本
73
- * @defaultValue '展开'
74
- */
75
- expandText?: string;
76
- /**
77
- * 收起按钮文本
78
- * @defaultValue '收起'
79
- */
80
- collapseText?: string;
81
- /**
82
- * 默认展开状态
83
- * @defaultValue false
84
- */
85
- defaultExpanded?: boolean;
86
- /**
87
- * 网格间距
88
- * @defaultValue 'gap-4'
89
- */
90
- gap?: string;
91
- }
92
- export interface SearchFormActionSlots {
93
- /** 替换默认按钮区域 */
94
- actions: (props: {
95
- expanded: boolean;
96
- toggle: () => void;
97
- search: () => void;
98
- reset: () => void;
99
- loading: boolean;
100
- }) => any;
101
- /** 追加在默认按钮后面 */
102
- extraActions: (props: {
103
- expanded: boolean;
104
- }) => any;
105
- }
106
- declare const __VLS_export: <S extends z.ZodObject, T extends boolean = true, N extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
107
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(SearchFormProps<S, T, N> & {
3
+ import type { AppConfig } from 'nuxt/schema';
4
+ import theme from '#build/movk-ui/search-form';
5
+ import type { SearchFormProps, SearchFormSlots } from '../types/auto-form/search-form';
6
+ declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
7
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(SearchFormProps<S> & {
8
+ ui?: ComponentConfig<typeof theme, AppConfig, "searchForm">["slots"];
9
+ } & {
108
10
  modelValue?: Partial<InferInput<S>>;
11
+ expanded?: boolean;
109
12
  }) & {
110
- [x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
13
+ onError?: ((event: import("@nuxt/ui").FormErrorEvent) => any) | undefined;
14
+ onClear?: (() => any) | undefined;
15
+ onReset?: (() => any) | undefined;
16
+ "onUpdate:modelValue"?: ((value: Partial<InferInput<S>>) => any) | undefined;
17
+ onExpand?: ((expanded: boolean) => any) | undefined;
18
+ "onUpdate:expanded"?: ((value: boolean | undefined) => any) | undefined;
111
19
  }> & (typeof globalThis extends {
112
20
  __VLS_PROPS_FALLBACK: infer P;
113
21
  } ? P : {});
114
22
  expose: (exposed: import("vue").ShallowUnwrapRef<{
115
- formRef: any;
23
+ formRef: Readonly<import("vue").ShallowRef<any, any>>;
24
+ submit: () => void;
116
25
  reset: () => void;
117
26
  clear: () => void;
118
- expanded: any;
27
+ setBaseline: (value?: Partial<InferInput<S>>) => void;
28
+ expanded: import("vue").WritableComputedRef<boolean, boolean>;
119
29
  toggle: () => void;
120
30
  }>) => void;
121
31
  attrs: any;
122
- slots: SearchFormActionSlots & Record<string, (props: import("../types/index.js").AutoFormFieldContext<Partial<InferInput<S>>, string>) => unknown> & {
123
- "field-label": (props: {
124
- label?: string;
125
- } & import("../types/index.js").AutoFormFieldContext<Partial<InferInput<S>>, string>) => unknown;
126
- "field-hint": (props: {
127
- hint?: string;
128
- } & import("../types/index.js").AutoFormFieldContext<Partial<InferInput<S>>, string>) => unknown;
129
- "field-description": (props: {
130
- description?: string;
131
- } & import("../types/index.js").AutoFormFieldContext<Partial<InferInput<S>>, string>) => unknown;
132
- "field-help": (props: {
133
- help?: string;
134
- } & import("../types/index.js").AutoFormFieldContext<Partial<InferInput<S>>, string>) => unknown;
135
- "field-error": (props: {
136
- error?: boolean | string;
137
- } & import("../types/index.js").AutoFormFieldContext<Partial<InferInput<S>>, string>) => unknown;
138
- "field-default": (props: {
139
- error?: boolean | string;
140
- } & import("../types/index.js").AutoFormFieldContext<Partial<InferInput<S>>, string>) => unknown;
141
- } & { [Key in `field-label:${{ [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_2 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_2]> extends true ? K_2 | `${K_2}.${{ [K_3 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_2]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_2]>[K_3]> extends true ? K_3 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_2]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string]}` | `field-label:${Exclude<{ [K_1 in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K_1]> extends true ? K_1 | `${K_1}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K_1]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]>[K_4]> extends true ? K_4 : K_4; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> & string]}` : K_3; }[keyof NonNullable<Partial<InferInput<S>>[K_1]> & string]}` : K_1; }[keyof InferInput<S> & string], { [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]>[K_4]> extends true ? K_4 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string]>}` | `field-hint:${{ [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]>[K_4]> extends true ? K_4 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string]}` | `field-hint:${Exclude<{ [K_1 in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K_1]> extends true ? K_1 | `${K_1}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K_1]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]>[K_4]> extends true ? K_4 : K_4; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> & string]}` : K_3; }[keyof NonNullable<Partial<InferInput<S>>[K_1]> & string]}` : K_1; }[keyof InferInput<S> & string], { [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]>[K_4]> extends true ? K_4 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string]>}` | `field-description:${{ [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]>[K_4]> extends true ? K_4 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string]}` | `field-description:${Exclude<{ [K_1 in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K_1]> extends true ? K_1 | `${K_1}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K_1]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]>[K_4]> extends true ? K_4 : K_4; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> & string]}` : K_3; }[keyof NonNullable<Partial<InferInput<S>>[K_1]> & string]}` : K_1; }[keyof InferInput<S> & string], { [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]>[K_4]> extends true ? K_4 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string]>}` | `field-help:${{ [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]>[K_4]> extends true ? K_4 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string]}` | `field-help:${Exclude<{ [K_1 in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K_1]> extends true ? K_1 | `${K_1}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K_1]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]>[K_4]> extends true ? K_4 : K_4; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> & string]}` : K_3; }[keyof NonNullable<Partial<InferInput<S>>[K_1]> & string]}` : K_1; }[keyof InferInput<S> & string], { [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]>[K_4]> extends true ? K_4 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string]>}` | `field-error:${{ [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]>[K_4]> extends true ? K_4 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string]}` | `field-error:${Exclude<{ [K_1 in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K_1]> extends true ? K_1 | `${K_1}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K_1]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]>[K_4]> extends true ? K_4 : K_4; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> & string]}` : K_3; }[keyof NonNullable<Partial<InferInput<S>>[K_1]> & string]}` : K_1; }[keyof InferInput<S> & string], { [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]>[K_4]> extends true ? K_4 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string]>}` | `field-default:${{ [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]>[K_4]> extends true ? K_4 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string]}` | `field-default:${Exclude<{ [K_1 in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K_1]> extends true ? K_1 | `${K_1}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K_1]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]>[K_4]> extends true ? K_4 : K_4; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_1]>[K_3]> & string]}` : K_3; }[keyof NonNullable<Partial<InferInput<S>>[K_1]> & string]}` : K_1; }[keyof InferInput<S> & string], { [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]>[K_4]> extends true ? K_4 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string]>}`]: Key extends `field-${infer K_2 extends keyof import("../types/index.js").AutoFormFieldSlots}:${infer P extends { [K_3 in keyof T_1 & string]: import("@movk/core").IsPlainObject<T_1[K_3]> extends true ? K_3 | `${K_3}.${{ [K_5 in keyof NonNullable<T_1[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<T_1[K_3]>[K_5]> extends true ? K_5 | `${K_5}.${{ [K_6 in keyof NonNullable<NonNullable<T_1[K_3]>[K_5]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<T_1[K_3]>[K_5]>[K_6]> extends true ? K_6 : never; }[keyof NonNullable<NonNullable<T_1[K_3]>[K_5]> & string]}` : never; }[keyof NonNullable<T_1[K_3]> & string]}` : never; }[keyof T_1 & string] | (string & import("@movk/core").NonObjectFieldKeys<T_1>)}` ? (props: {
142
- label: {
143
- label?: string;
144
- };
145
- hint: {
146
- hint?: string;
147
- };
148
- description: {
149
- description?: string;
150
- };
151
- help: {
152
- help?: string;
153
- };
154
- error: {
155
- error?: boolean | string;
156
- };
157
- default: {
158
- error?: boolean | string;
159
- };
160
- }[K_2] & import("../types/index.js").AutoFormFieldContext<Partial<InferInput<S>>, P>) => unknown : never; } & { [P in { [K in keyof InferInput<S> & string]: import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K]> extends true ? K | `${K}.${{ [K_3 in keyof NonNullable<Partial<InferInput<S>>[K]> & string]: import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K]>[K_3]> extends true ? K_3 | `${K_3}.${{ [K_4 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]: import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]>[K_4]> extends true ? K_4 : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K]>[K_3]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K]> & string]}` : never; }[keyof InferInput<S> & string] | { [K_2 in keyof InferInput<S> & string]: NonNullable<Partial<InferInput<S>>[K_2]> extends any[] ? K_2 : import("@movk/core").IsPlainObject<Partial<InferInput<S>>[K_2]> extends true ? `${K_2}.${{ [K_4 in keyof NonNullable<Partial<InferInput<S>>[K_2]> & string]: NonNullable<NonNullable<Partial<InferInput<S>>[K_2]>[K_4]> extends any[] ? K_4 : import("@movk/core").IsPlainObject<NonNullable<Partial<InferInput<S>>[K_2]>[K_4]> extends true ? `${K_4}.${{ [K_5 in keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_2]>[K_4]> & string]: NonNullable<NonNullable<NonNullable<Partial<InferInput<S>>[K_2]>[K_4]>[K_5]> extends any[] ? K_5 : import("@movk/core").IsPlainObject<NonNullable<NonNullable<Partial<InferInput<S>>[K_2]>[K_4]>[K_5]> extends true ? never : never; }[keyof NonNullable<NonNullable<Partial<InferInput<S>>[K_2]>[K_4]> & string]}` : never; }[keyof NonNullable<Partial<InferInput<S>>[K_2]> & string]}` : never; }[keyof InferInput<S> & string] as `field-content:${P}` | `field-before:${P}` | `field-after:${P}`]: (props: import("../types/index.js").AutoFormFieldContext<Partial<InferInput<S>>, P>) => unknown; };
161
- emit: any & ((event: "update:modelValue", value: Partial<InferInput<S>> | undefined) => void);
32
+ slots: SearchFormSlots<S>;
33
+ emit: (((evt: "error", event: import("@nuxt/ui").FormErrorEvent) => void) & ((evt: "clear") => void) & ((evt: "reset") => void) & ((evt: "expand", expanded: boolean) => void) & ((evt: "update:expanded", expanded: boolean) => void)) & (((event: "update:modelValue", value: Partial<InferInput<S>>) => void) & ((event: "update:expanded", value: boolean | undefined) => void));
162
34
  }>) => import("vue").VNode & {
163
35
  __ctx?: Awaited<typeof __VLS_setup>;
164
36
  };
@@ -1,216 +1,274 @@
1
1
  <script setup>
2
2
  import { UButton, UCollapsible, UForm } from "#components";
3
- import { computed, ref, useTemplateRef, watch } from "vue";
4
- import { useAutoFormProvider } from "../auto-form/provider";
5
- import { extractPureSchema, introspectSchema } from "../auto-form/schema-introspector";
6
- import { useAutoForm } from "../composables/useAutoForm";
7
- import AutoFormRendererField from "./auto-form-renderer/AutoFormRendererField.vue";
8
- import { useAppConfig } from "#app";
9
- import { resolveGridClasses, resolveMaxCols } from "../constants/grid-cols";
10
- const {
11
- schema,
12
- controls,
13
- globalMeta,
14
- cols = 3,
15
- visibleRows = 1,
16
- icon = "i-lucide-chevron-down",
17
- expandText = "\u5C55\u5F00",
18
- collapseText = "\u6536\u8D77",
19
- defaultExpanded = false,
20
- gap = "gap-4",
21
- searchText = "\u641C\u7D22",
22
- resetText = "\u91CD\u7F6E",
23
- searchButtonProps,
24
- resetButtonProps,
25
- showSearchButton = true,
26
- showResetButton = true,
27
- loading = false,
28
- state: _state,
29
- ...restProps
30
- } = defineProps({
3
+ import { computed, onMounted, ref, toRaw, unref, useAttrs, useTemplateRef, watch } from "vue";
4
+ import { deepClone, isFunction } from "@movk/core";
5
+ import { useAutoFormProvider } from "../domains/auto-form/provider";
6
+ import { extractPureSchema, introspectSchema } from "../domains/auto-form/schema";
7
+ import { applyFieldDefaults } from "../domains/auto-form/fields";
8
+ import { DEFAULT_CONTROLS } from "../domains/auto-form/controls";
9
+ import { DEFAULT_SEARCH_ACTIONS } from "../domains/auto-form/actions";
10
+ import AutoFormRendererField from "../domains/auto-form/components/Field.vue";
11
+ import { useAppConfig } from "#imports";
12
+ import theme from "#build/movk-ui/search-form";
13
+ import { useExtendedTv } from "../utils/extend-theme";
14
+ const props = defineProps({
15
+ cols: { type: [Number, Object], required: false, default: 3 },
16
+ visibleRows: { type: Number, required: false, default: 1 },
17
+ actions: { type: Array, required: false },
18
+ loading: { type: Boolean, required: false },
19
+ collapseButtonProps: { type: Object, required: false },
20
+ icon: { type: null, required: false, default: "i-lucide-chevron-down" },
21
+ expandText: { type: String, required: false, default: "\u5C55\u5F00" },
22
+ collapseText: { type: String, required: false, default: "\u6536\u8D77" },
23
+ expanded: { type: Boolean, required: false },
24
+ defaultExpanded: { type: Boolean, required: false, default: false },
31
25
  schema: { type: null, required: true },
32
- cols: { type: [Number, Object], required: false },
33
- visibleRows: { type: Number, required: false },
34
26
  controls: { type: Object, required: false },
35
27
  globalMeta: { type: Object, required: false },
36
- searchButtonProps: { type: Object, required: false },
37
- resetButtonProps: { type: Object, required: false },
38
- searchText: { type: String, required: false },
39
- resetText: { type: String, required: false },
40
- showSearchButton: { type: Boolean, required: false },
41
- showResetButton: { type: Boolean, required: false },
42
- loading: { type: Boolean, required: false },
43
- icon: { type: String, required: false },
44
- expandText: { type: String, required: false },
45
- collapseText: { type: String, required: false },
46
- defaultExpanded: { type: Boolean, required: false },
47
- gap: { type: String, required: false },
48
- id: { type: [String, Number], required: false },
49
- state: { type: null, required: false },
50
- validate: { type: Function, required: false },
51
- validateOn: { type: Array, required: false },
52
- disabled: { type: Boolean, required: false },
53
- name: { type: null, required: false },
54
- validateOnInputDelay: { type: Number, required: false },
55
- transform: { type: null, required: false },
56
- nested: { type: Boolean, required: false },
57
- loadingAuto: { type: Boolean, required: false },
28
+ loadingAuto: { type: Boolean, required: false, default: true },
29
+ validateOn: { type: Array, required: false, default: () => [] },
58
30
  class: { type: null, required: false },
59
- ui: { type: Object, required: false },
60
- onSubmit: { type: Function, required: false }
31
+ ui: { type: Object, required: false }
61
32
  });
62
- const emit = defineEmits(["search", "reset", "expand"]);
63
- const modelValue = defineModel({ type: Object });
64
- const _slots = defineSlots();
33
+ const modelValue = defineModel({ type: Object, ...{ default: () => ({}) } });
34
+ const expandedModel = defineModel("expanded", { type: Boolean });
35
+ const emits = defineEmits(["reset", "clear", "expand", "update:expanded", "error"]);
36
+ const slots = defineSlots();
65
37
  defineOptions({ inheritAttrs: false });
66
- const state = ref(modelValue.value ?? _state ?? {});
67
- const initialState = { ...modelValue.value ?? _state ?? {} };
68
- watch(() => state.value, (val) => {
69
- if (val !== modelValue.value) {
70
- modelValue.value = val;
38
+ const attrs = useAttrs();
39
+ let baseline = deepClone(toRaw(modelValue.value));
40
+ const appConfig = useAppConfig();
41
+ const formRef = useTemplateRef("formRef");
42
+ const internalExpanded = ref(props.defaultExpanded ?? false);
43
+ const expanded = computed({
44
+ get: () => expandedModel.value ?? internalExpanded.value,
45
+ set: (val) => {
46
+ internalExpanded.value = val;
47
+ if (expandedModel.value !== void 0) {
48
+ expandedModel.value = val;
49
+ }
71
50
  }
72
- }, { deep: true });
73
- watch(() => modelValue.value, (val) => {
74
- if (val !== void 0 && val !== state.value) {
75
- state.value = val ?? {};
51
+ });
52
+ const { baseUi, extraUi } = useExtendedTv(
53
+ { slots: { base: "" } },
54
+ theme,
55
+ () => appConfig.movk?.searchForm,
56
+ () => ({
57
+ ui: {
58
+ ...props.ui,
59
+ root: [props.ui?.root, props.class]
60
+ }
61
+ })
62
+ );
63
+ function maxCols(cols) {
64
+ if (typeof cols === "number") return cols;
65
+ if (!cols) return 1;
66
+ return Math.max(cols.sm ?? 1, cols.md ?? 1, cols.lg ?? 1, cols.xl ?? 1);
67
+ }
68
+ const gridStyle = computed(() => {
69
+ const c = props.cols;
70
+ const vars = {};
71
+ if (typeof c === "number") {
72
+ vars["--m-search-cols"] = String(c);
73
+ } else if (c) {
74
+ const base = c.sm ?? c.md ?? c.lg ?? c.xl ?? 1;
75
+ vars["--m-search-cols"] = String(base);
76
+ if (c.sm !== void 0) vars["--m-search-cols-sm"] = String(c.sm);
77
+ if (c.md !== void 0) vars["--m-search-cols-md"] = String(c.md);
78
+ if (c.lg !== void 0) vars["--m-search-cols-lg"] = String(c.lg);
79
+ if (c.xl !== void 0) vars["--m-search-cols-xl"] = String(c.xl);
76
80
  }
81
+ return vars;
77
82
  });
78
- const appConfig = useAppConfig();
79
- const formRef = useTemplateRef("formRef");
80
- const expanded = ref(defaultExpanded);
81
- const { DEFAULT_CONTROLS } = useAutoForm();
82
- useAutoFormProvider(state, _slots);
83
- const showActionsCell = computed(() => showSearchButton || showResetButton || !!_slots.actions || !!_slots.extraActions);
84
- const pureSchema = computed(() => schema ? extractPureSchema(schema) : schema);
85
- const controlsMapping = computed(() => ({
86
- ...DEFAULT_CONTROLS,
87
- ...controls
88
- }));
89
- const fields = computed(() => {
90
- if (!schema) return [];
91
- return introspectSchema(schema, controlsMapping.value, "", globalMeta);
83
+ useAutoFormProvider(modelValue, slots);
84
+ const resolvedButtonSize = computed(() => {
85
+ const size = props.globalMeta?.size;
86
+ if (size === void 0 || isFunction(size)) return void 0;
87
+ return unref(size);
88
+ });
89
+ const pureSchema = computed(() => extractPureSchema(props.schema));
90
+ const controlsMapping = computed(() => ({ ...DEFAULT_CONTROLS, ...props.controls }));
91
+ const fields = computed(() => introspectSchema(props.schema, controlsMapping.value, "", props.globalMeta));
92
+ const actionsBag = { toggle, search: submit, reset, clear };
93
+ function buildSlotProps(errors, loading) {
94
+ return {
95
+ ...actionsBag,
96
+ expanded: expanded.value,
97
+ loading: props.loading || loading,
98
+ state: modelValue.value,
99
+ errors
100
+ };
101
+ }
102
+ function resolveActions(slotCtx) {
103
+ const list = props.actions ?? DEFAULT_SEARCH_ACTIONS;
104
+ return list.filter((action) => {
105
+ if (action.visible === void 0) return true;
106
+ if (typeof action.visible === "function") {
107
+ return action.visible(slotCtx);
108
+ }
109
+ return action.visible;
110
+ });
111
+ }
112
+ const showActionsCell = computed(() => {
113
+ const list = props.actions ?? DEFAULT_SEARCH_ACTIONS;
114
+ return list.length > 0 || !!slots.actions || !!slots.extraActions;
92
115
  });
93
- const gridClass = computed(() => resolveGridClasses(cols, gap));
94
116
  const visibleCount = computed(() => {
95
- const base = resolveMaxCols(cols) * visibleRows;
96
- return Math.max(0, showActionsCell.value ? base - 1 : base);
117
+ const total = maxCols(props.cols) * props.visibleRows;
118
+ if (!showActionsCell.value) return total;
119
+ if (maxCols(props.cols) <= 1) return total;
120
+ return Math.max(0, total - 1);
97
121
  });
98
122
  const visibleFields = computed(() => fields.value.slice(0, visibleCount.value));
99
123
  const collapsedFields = computed(() => fields.value.slice(visibleCount.value));
100
124
  const needsCollapse = computed(() => collapsedFields.value.length > 0);
101
125
  function toggle() {
102
- expanded.value = !expanded.value;
103
- emit("expand", expanded.value);
126
+ const next = !expanded.value;
127
+ expanded.value = next;
128
+ emits("expand", next);
129
+ emits("update:expanded", next);
104
130
  }
105
- function handleSearch() {
106
- emit("search", { ...state.value });
107
- }
108
- function triggerSearch() {
131
+ function submit() {
109
132
  formRef.value?.submit();
110
133
  }
111
134
  function clear() {
112
- state.value = {};
135
+ modelValue.value = {};
113
136
  formRef.value?.clear();
137
+ emits("clear");
114
138
  }
115
139
  function reset() {
116
- state.value = { ...initialState };
140
+ modelValue.value = deepClone(baseline);
141
+ applyFieldDefaults(fields.value, modelValue.value);
117
142
  formRef.value?.clear();
118
- emit("reset");
143
+ emits("reset");
144
+ }
145
+ function setBaseline(value) {
146
+ baseline = deepClone(toRaw(value ?? modelValue.value));
147
+ }
148
+ function handleAction(action, ctx) {
149
+ if (action.onClick) {
150
+ action.onClick(ctx);
151
+ return;
152
+ }
153
+ if (action.type === "submit") return;
154
+ if (action.key === "reset") reset();
155
+ else if (action.key === "search") submit();
156
+ }
157
+ function actionLoading(action, ctx) {
158
+ if (action.key === "search" || action.type === "submit") return ctx.loading;
159
+ return false;
119
160
  }
161
+ watch(() => fields.value, () => {
162
+ applyFieldDefaults(fields.value, modelValue.value);
163
+ }, { flush: "post" });
164
+ watch(() => props.schema, () => {
165
+ formRef.value?.clear();
166
+ });
167
+ onMounted(() => {
168
+ applyFieldDefaults(fields.value, modelValue.value);
169
+ setBaseline();
170
+ });
120
171
  defineExpose({
121
172
  formRef,
173
+ submit,
122
174
  reset,
123
175
  clear,
176
+ setBaseline,
124
177
  expanded,
125
178
  toggle
126
179
  });
127
180
  </script>
128
181
 
129
182
  <template>
130
- <UForm
131
- ref="formRef"
132
- :state="state"
133
- :schema="pureSchema"
134
- v-bind="restProps"
135
- @submit="handleSearch"
136
- >
137
- <template #default="{ errors, loading: formLoading }">
138
- <div class="group/search pb-6 -mb-6">
139
- <div class="relative">
140
- <div :class="gridClass">
183
+ <div :class="extraUi.root" data-slot="root">
184
+ <UForm
185
+ ref="formRef"
186
+ :state="modelValue"
187
+ :schema="pureSchema"
188
+ :loading-auto="props.loadingAuto"
189
+ :validate-on="props.validateOn"
190
+ :ui="baseUi"
191
+ data-slot="form"
192
+ v-bind="attrs"
193
+ @error="emits('error', $event)"
194
+ >
195
+ <template #default="{ errors, loading }">
196
+ <div v-if="$slots.header" :class="extraUi.header" data-slot="header">
197
+ <slot name="header" v-bind="buildSlotProps(errors, loading)" />
198
+ </div>
199
+
200
+ <div :class="extraUi.visible" data-slot="visible">
201
+ <div :class="extraUi.grid" :style="gridStyle" data-slot="grid">
141
202
  <AutoFormRendererField
142
203
  v-for="field in visibleFields"
143
204
  :key="field.path"
144
205
  :field="field"
145
- :schema="schema"
146
- :extra-props="{ errors, loading: formLoading }"
206
+ :schema="props.schema"
207
+ :extra-props="{ errors, loading, state: modelValue }"
147
208
  />
148
209
 
149
210
  <slot
150
211
  v-if="showActionsCell"
151
212
  name="actions"
152
- :expanded="expanded"
153
- :toggle="toggle"
154
- :search="triggerSearch"
155
- :reset="reset"
156
- :loading="loading"
213
+ v-bind="buildSlotProps(errors, loading)"
157
214
  >
158
- <div class="flex items-end gap-2 justify-end">
159
- <UButton
160
- v-if="showSearchButton"
161
- type="submit"
162
- icon="i-lucide-search"
163
- :label="searchText"
164
- :loading="loading"
165
- v-bind="searchButtonProps"
166
- />
167
- <UButton
168
- v-if="showResetButton"
169
- :label="resetText"
170
- color="neutral"
171
- variant="outline"
172
- icon="i-lucide-rotate-ccw"
173
- v-bind="resetButtonProps"
174
- @click="reset"
175
- />
176
- <slot name="extraActions" :expanded="expanded" />
215
+ <div :class="extraUi.actions" data-slot="actions">
216
+ <template v-for="action in resolveActions(buildSlotProps(errors, loading))" :key="action.key">
217
+ <UButton
218
+ :label="action.label"
219
+ :type="action.type"
220
+ :icon="action.icon"
221
+ :color="action.color"
222
+ :variant="action.variant"
223
+ :loading="actionLoading(action, buildSlotProps(errors, loading))"
224
+ :size="resolvedButtonSize"
225
+ v-bind="action"
226
+ @click="handleAction(action, buildSlotProps(errors, loading))"
227
+ />
228
+ </template>
229
+ <slot name="extraActions" v-bind="buildSlotProps(errors, loading)" />
177
230
  </div>
178
231
  </slot>
179
232
  </div>
180
-
181
- <div
182
- v-if="needsCollapse"
183
- class="absolute inset-x-0 top-full flex justify-center pointer-events-none z-10"
184
- >
185
- <UButton
186
- :icon="icon || appConfig.ui.icons.chevronDown"
187
- color="neutral"
188
- size="xs"
189
- variant="ghost"
190
- :data-state="expanded ? 'open' : 'closed'"
191
- :label="expanded ? collapseText : expandText"
192
- tabindex="-1"
193
- class="group pointer-events-auto opacity-30 group-hover/search:opacity-100 transition-opacity duration-200"
194
- :ui="{ leadingIcon: 'size-3.5 group-data-[state=open]:rotate-180 transition-transform duration-200' }"
195
- @click="toggle"
196
- />
197
- </div>
198
233
  </div>
199
234
 
200
235
  <UCollapsible v-if="needsCollapse" v-model:open="expanded">
201
236
  <template #content>
202
- <div :class="gridClass" class="mt-4">
237
+ <div :class="[extraUi.grid, extraUi.collapsed]" :style="gridStyle" data-slot="collapsed">
203
238
  <AutoFormRendererField
204
239
  v-for="field in collapsedFields"
205
240
  :key="field.path"
206
241
  :field="field"
207
- :schema="schema"
208
- :extra-props="{ errors, loading: formLoading }"
242
+ :schema="props.schema"
243
+ :extra-props="{ errors, loading, state: modelValue }"
209
244
  />
210
245
  </div>
211
246
  </template>
212
247
  </UCollapsible>
213
- </div>
214
- </template>
215
- </UForm>
248
+
249
+ <div v-if="needsCollapse" :class="extraUi.toggleWrapper" data-slot="toggle-wrapper">
250
+ <UButton
251
+ :icon="icon"
252
+ color="neutral"
253
+ :size="resolvedButtonSize"
254
+ variant="ghost"
255
+ :data-state="expanded ? 'open' : 'closed'"
256
+ :label="expanded ? collapseText : expandText"
257
+ tabindex="-1"
258
+ :class="extraUi.toggle"
259
+ v-bind="collapseButtonProps"
260
+ :ui="{
261
+ ...collapseButtonProps?.ui ?? {},
262
+ leadingIcon: [collapseButtonProps?.ui?.leadingIcon, extraUi.toggleIcon].filter(Boolean).join(' ')
263
+ }"
264
+ @click="toggle"
265
+ />
266
+ </div>
267
+
268
+ <div v-if="$slots.footer" :class="extraUi.footer" data-slot="footer">
269
+ <slot name="footer" v-bind="buildSlotProps(errors, loading)" />
270
+ </div>
271
+ </template>
272
+ </UForm>
273
+ </div>
216
274
  </template>