@movk/nuxt 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +119 -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 +96 -35
  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 -14
  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 +681 -0
  116. package/dist/runtime/{auto-form → domains/auto-form}/controls.js +28 -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 +9 -5
  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} +7 -2
  125. package/dist/runtime/{auto-form/schema-introspector.js → domains/auto-form/schema.js} +14 -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 +196 -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 +68 -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 -37
  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,13 +1,14 @@
1
- import WithClear from "../components/input/WithClear.vue";
2
- import WithPasswordToggle from "../components/input/WithPasswordToggle.vue";
3
- import WithCopy from "../components/input/WithCopy.vue";
4
- import WithCharacterLimit from "../components/input/WithCharacterLimit.vue";
5
- import AsPhoneNumberInput from "../components/input/AsPhoneNumberInput.vue";
6
- import WithFloatingLabel from "../components/input/WithFloatingLabel.vue";
7
- import DatePicker from "../components/DatePicker.vue";
8
- import ColorChooser from "../components/ColorChooser.vue";
9
- import StarRating from "../components/StarRating.vue";
10
- import SlideVerify from "../components/SlideVerify.vue";
1
+ import WithClear from "../../components/input/WithClear.vue";
2
+ import WithPasswordToggle from "../../components/input/WithPasswordToggle.vue";
3
+ import WithCopy from "../../components/input/WithCopy.vue";
4
+ import WithCharacterLimit from "../../components/input/WithCharacterLimit.vue";
5
+ import AsPhoneNumberInput from "../../components/input/AsPhoneNumberInput.vue";
6
+ import WithFloatingLabel from "../../components/input/WithFloatingLabel.vue";
7
+ import DatePicker from "../../components/DatePicker.vue";
8
+ import ColorChooser from "../../components/ColorChooser.vue";
9
+ import StarRating from "../../components/StarRating.vue";
10
+ import SlideVerify from "../../components/SlideVerify.vue";
11
+ import PillGroup from "../../components/PillGroup.vue";
11
12
  import {
12
13
  UInput,
13
14
  UInputNumber,
@@ -24,7 +25,8 @@ import {
24
25
  UCheckboxGroup,
25
26
  URadioGroup,
26
27
  UInputDate,
27
- UInputTime
28
+ UInputTime,
29
+ UListbox
28
30
  } from "#components";
29
31
  const DEFAULT_CONTROL_PROPS = { class: "w-full" };
30
32
  export function defineControl(e) {
@@ -44,27 +46,29 @@ const DEFAULT_CONTROL_COMPONENTS = {
44
46
  boolean: UCheckbox,
45
47
  enum: USelect,
46
48
  file: UFileUpload,
49
+ // reka-ui 未公开导出 Calendar 相关类型,收宽避免声明发射 TS2883(详见 AGENTS.md)
47
50
  calendarDate: DatePicker,
48
- datePicker: DatePicker,
49
- switch: USwitch,
50
- textarea: UTextarea,
51
- slider: USlider,
52
- pinInput: UPinInput,
53
- inputTags: UInputTags,
54
- selectMenu: USelectMenu,
55
- inputMenu: UInputMenu,
56
- checkboxGroup: UCheckboxGroup,
57
- radioGroup: URadioGroup,
58
51
  inputDate: UInputDate,
59
52
  inputTime: UInputTime,
60
53
  withClear: WithClear,
61
54
  withPasswordToggle: WithPasswordToggle,
62
55
  withCopy: WithCopy,
63
56
  withCharacterLimit: WithCharacterLimit,
64
- asPhoneNumberInput: AsPhoneNumberInput,
65
57
  withFloatingLabel: WithFloatingLabel,
66
- colorChooser: ColorChooser,
58
+ asPhoneNumberInput: AsPhoneNumberInput,
59
+ textarea: UTextarea,
60
+ switch: USwitch,
61
+ slider: USlider,
62
+ selectMenu: USelectMenu,
63
+ inputMenu: UInputMenu,
64
+ checkboxGroup: UCheckboxGroup,
65
+ radioGroup: URadioGroup,
66
+ inputTags: UInputTags,
67
+ pinInput: UPinInput,
68
+ listbox: UListbox,
67
69
  starRating: StarRating,
68
- slideVerify: SlideVerify
70
+ colorChooser: ColorChooser,
71
+ slideVerify: SlideVerify,
72
+ pillGroup: PillGroup
69
73
  };
70
74
  export const DEFAULT_CONTROLS = createControlMap(DEFAULT_CONTROL_COMPONENTS);
@@ -1,5 +1,7 @@
1
1
  import type { VNode } from 'vue';
2
- import type { AutoFormField } from '../types/auto-form.js';
2
+ import type { AutoFormField } from '../../types/auto-form';
3
+ /** 沿字段树回填带 defaultValue 的叶子节点,已存在值的路径不覆盖 */
4
+ export declare function applyFieldDefaults(fields: AutoFormField[], target: Record<string, any>): void;
3
5
  /** 将字段列表分类为叶子/嵌套/数组/布局四组 */
4
6
  export declare function classifyFields(fields: AutoFormField[]): {
5
7
  leafFields: AutoFormField[];
@@ -1,7 +1,23 @@
1
1
  import { UButton, UIcon } from "#components";
2
2
  import { h } from "vue";
3
- import { setPath } from "@movk/core";
4
- import { AUTOFORM_META } from "../constants/auto-form.js";
3
+ import { getPath, setPath } from "@movk/core";
4
+ import { AUTOFORM_META } from "./constants.js";
5
+ export function applyFieldDefaults(fields, target) {
6
+ if (!fields.length) return;
7
+ const updates = [];
8
+ function collect(items) {
9
+ for (const field of items) {
10
+ if (field?.decorators?.defaultValue !== void 0 && getPath(target, field.path) === void 0) {
11
+ updates.push({ path: field.path, value: field.decorators.defaultValue });
12
+ }
13
+ if (field?.children && Array.isArray(field.children) && field.children.length > 0) {
14
+ collect(field.children);
15
+ }
16
+ }
17
+ }
18
+ collect(fields);
19
+ for (const { path, value } of updates) setPath(target, path, value);
20
+ }
5
21
  export function classifyFields(fields) {
6
22
  const leafFields = [];
7
23
  const nestedFields = [];
@@ -1,5 +1,5 @@
1
1
  import { isObject } from "@movk/core";
2
- import { AUTOFORM_META } from "../constants/auto-form.js";
2
+ import { AUTOFORM_META } from "./constants.js";
3
3
  export function applyMeta(schema, meta) {
4
4
  const normalizedMeta = isObject(meta) ? meta : {};
5
5
  return schema.meta(normalizedMeta);
@@ -0,0 +1,62 @@
1
+ import type { Ref } from 'vue';
2
+ import type { ReactiveValue } from '@movk/core';
3
+ import type { AutoFormField, AutoFormMergeMeta, ResolvedAutoFormFieldContext } from '../../types/auto-form';
4
+ type _ResolveReactive<T> = T extends ReactiveValue<infer V, any> ? V : T;
5
+ type ResolvedMetaValue<K extends keyof AutoFormMergeMeta> = _ResolveReactive<NonNullable<AutoFormMergeMeta[K]>>;
6
+ /** 初始化表单上下文工厂并通过 provide 注入给所有子渲染器 */
7
+ export declare function useAutoFormProvider(state: Ref<any>, slots: Record<string, any>): {
8
+ createFieldContext: (field: AutoFormField, extraProps?: Record<string, any>) => ResolvedAutoFormFieldContext;
9
+ createSlotProps: (field: AutoFormField, extraProps?: Record<string, any>) => ResolvedAutoFormFieldContext;
10
+ resolveFieldProp: {
11
+ <K extends keyof AutoFormMergeMeta>(field: AutoFormField, prop: K, defaultValue?: ResolvedMetaValue<K>, extraProps?: Record<string, any>): ResolvedMetaValue<K> | undefined;
12
+ <T>(field: AutoFormField, prop: keyof AutoFormMergeMeta, defaultValue?: T, extraProps?: Record<string, any>): T | undefined;
13
+ };
14
+ renderFieldSlot: (fn?: (props?: any) => any, slotProps?: any) => any;
15
+ getResolvedFieldSlots: (field: AutoFormField, extraProps?: Record<string, any>) => Record<string, ((props?: any) => any) | undefined> | undefined;
16
+ renderControl: (field: AutoFormField, extraProps?: Record<string, any>) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
17
+ [key: string]: any;
18
+ }> | null;
19
+ createSlotResolver: (field: AutoFormField, extraProps?: Record<string, any>) => {
20
+ hasSlot(name: string): boolean;
21
+ renderSlot(name: string, slotProps: any): any;
22
+ };
23
+ createFormFieldSlots: (field: AutoFormField, slotResolver: ReturnType<(field: AutoFormField, extraProps?: Record<string, any>) => {
24
+ hasSlot(name: string): boolean;
25
+ renderSlot(name: string, slotProps: any): any;
26
+ }>, extraProps?: Record<string, any>) => Record<string, any>;
27
+ createCollapsibleEnhancer: (field: AutoFormField, extraProps?: Record<string, any>) => {
28
+ collapsibleConfig: import("vue").ComputedRef<import("../../types").AutoFormNestedCollapsible | undefined>;
29
+ shouldShowCollapsible: import("vue").ComputedRef<boolean>;
30
+ isHidden: import("vue").ComputedRef<boolean | undefined>;
31
+ enhancedField: import("vue").ComputedRef<AutoFormField>;
32
+ };
33
+ };
34
+ /** 注入表单上下文,必须在 AutoForm 子渲染器中调用 */
35
+ export declare function useAutoFormInjector(): {
36
+ createFieldContext: (field: AutoFormField, extraProps?: Record<string, any>) => ResolvedAutoFormFieldContext;
37
+ createSlotProps: (field: AutoFormField, extraProps?: Record<string, any>) => ResolvedAutoFormFieldContext;
38
+ resolveFieldProp: {
39
+ <K extends keyof AutoFormMergeMeta>(field: AutoFormField, prop: K, defaultValue?: ResolvedMetaValue<K>, extraProps?: Record<string, any>): ResolvedMetaValue<K> | undefined;
40
+ <T>(field: AutoFormField, prop: keyof AutoFormMergeMeta, defaultValue?: T, extraProps?: Record<string, any>): T | undefined;
41
+ };
42
+ renderFieldSlot: (fn?: (props?: any) => any, slotProps?: any) => any;
43
+ getResolvedFieldSlots: (field: AutoFormField, extraProps?: Record<string, any>) => Record<string, ((props?: any) => any) | undefined> | undefined;
44
+ renderControl: (field: AutoFormField, extraProps?: Record<string, any>) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
45
+ [key: string]: any;
46
+ }> | null;
47
+ createSlotResolver: (field: AutoFormField, extraProps?: Record<string, any>) => {
48
+ hasSlot(name: string): boolean;
49
+ renderSlot(name: string, slotProps: any): any;
50
+ };
51
+ createFormFieldSlots: (field: AutoFormField, slotResolver: ReturnType<(field: AutoFormField, extraProps?: Record<string, any>) => {
52
+ hasSlot(name: string): boolean;
53
+ renderSlot(name: string, slotProps: any): any;
54
+ }>, extraProps?: Record<string, any>) => Record<string, any>;
55
+ createCollapsibleEnhancer: (field: AutoFormField, extraProps?: Record<string, any>) => {
56
+ collapsibleConfig: import("vue").ComputedRef<import("../../types").AutoFormNestedCollapsible | undefined>;
57
+ shouldShowCollapsible: import("vue").ComputedRef<boolean>;
58
+ isHidden: import("vue").ComputedRef<boolean | undefined>;
59
+ enhancedField: import("vue").ComputedRef<AutoFormField>;
60
+ };
61
+ };
62
+ export {};
@@ -2,7 +2,7 @@ import { UIcon } from "#components";
2
2
  import defu from "defu";
3
3
  import { computed, h, inject, isVNode, provide, resolveDynamicComponent, unref } from "vue";
4
4
  import { getPath, setPath } from "@movk/core";
5
- import { enhanceEventProps, resolveReactiveValue } from "./reactive-utils.js";
5
+ import { enhanceEventProps, resolveReactiveValue } from "./reactive.js";
6
6
  const AUTO_FORM_CONTEXT_KEY = Symbol("AUTO_FORM_CONTEXT_KEY");
7
7
  export function useAutoFormProvider(state, slots) {
8
8
  function createFieldContext(field, extraProps) {
@@ -17,7 +17,8 @@ export function useAutoFormProvider(state, slots) {
17
17
  },
18
18
  setValue: (pathOrValue, value) => {
19
19
  if (value === void 0) {
20
- setPath(state.value, path, pathOrValue);
20
+ const nextValue = typeof pathOrValue === "function" ? pathOrValue(getPath(state.value, path)) : pathOrValue;
21
+ setPath(state.value, path, nextValue);
21
22
  } else {
22
23
  const relativePath = String(pathOrValue);
23
24
  let fullPath;
@@ -78,10 +79,12 @@ export function useAutoFormProvider(state, slots) {
78
79
  const context = createFieldContext(field, extraProps);
79
80
  const resolvedControlProps = resolveFieldProp(field, "controlProps", void 0, extraProps) || {};
80
81
  const isReadonly = field.decorators?.isReadonly;
82
+ const resolvedSize = resolveFieldProp(field, "size", void 0, extraProps);
81
83
  const finalProps = defu(
82
84
  resolvedControlProps,
83
85
  isReadonly ? { disabled: true } : {},
84
- controlMeta?.mapped?.controlProps || {}
86
+ controlMeta?.mapped?.controlProps || {},
87
+ resolvedSize !== void 0 ? { size: resolvedSize } : {}
85
88
  );
86
89
  const slots2 = defu(
87
90
  resolveFieldProp(field, "controlSlots", void 0, extraProps) || {},
@@ -95,9 +98,10 @@ export function useAutoFormProvider(state, slots) {
95
98
  {
96
99
  ...wrappedProps,
97
100
  "onUpdate:modelValue": (v) => {
98
- context.setValue(v);
101
+ const next = v === null && field.decorators?.isOptional ? void 0 : v;
102
+ context.setValue(next);
99
103
  if (typeof userOnUpdate === "function") {
100
- userOnUpdate(v, context);
104
+ userOnUpdate(next, context);
101
105
  }
102
106
  },
103
107
  "modelValue": unref(context.value)
@@ -1,11 +1,11 @@
1
- import type { ReactiveValue, AnyObject } from '@movk/core';
2
- import type { AutoFormFieldContext } from '../types/auto-form.js';
1
+ import type { AnyObject } from '@movk/core';
2
+ import type { ResolvedAutoFormFieldContext } from '../../types/auto-form';
3
3
  /** 解析单个响应式值:函数则以 context 调用,ref 则解包,否则原样返回 */
4
- export declare function resolveReactiveValue(value: ReactiveValue<any, any>, context: AutoFormFieldContext): any;
4
+ export declare function resolveReactiveValue(value: unknown, context: ResolvedAutoFormFieldContext): any;
5
5
  /** 递归解析对象/数组中所有响应式值,VNode 和 ref 不再展开以防止意外渲染 */
6
- export declare function resolveReactiveObject<T extends Record<string, any>>(obj: T, context: AutoFormFieldContext, depth?: number): T;
6
+ export declare function resolveReactiveObject<T extends Record<string, any>>(obj: T, context: ResolvedAutoFormFieldContext, depth?: number): T;
7
7
  /** 为 onXxx 事件 prop 自动追加 context 作为最后一个参数,方便用户在事件回调中访问表单状态 */
8
- export declare function enhanceEventProps(originalProps: AnyObject, ctx: AutoFormFieldContext): Record<string, any>;
8
+ export declare function enhanceEventProps(originalProps: AnyObject, ctx: ResolvedAutoFormFieldContext): Record<string, any>;
9
9
  /** 渲染任意 VNode 内容(slot 函数返回值、h() 结果等),单子节点直接返回,多个节点包入 Fragment */
10
10
  export declare function VNodeRender(props: {
11
11
  node: unknown;
@@ -1,6 +1,6 @@
1
1
  import { isFunction, isObject } from "@movk/core";
2
2
  import { Fragment, h, isRef, isVNode, unref } from "vue";
3
- import { AUTOFORM_LIMITS, AUTOFORM_PATTERNS } from "../constants/auto-form.js";
3
+ import { AUTOFORM_LIMITS, AUTOFORM_PATTERNS } from "./constants.js";
4
4
  function validateContext(context) {
5
5
  if (!context || typeof context !== "object") {
6
6
  throw new TypeError("AutoFormFieldContext must be a valid object");
@@ -1,7 +1,12 @@
1
1
  import type { z } from 'zod';
2
- import type { AutoFormControls, AutoFormField } from '../types/auto-form.js';
3
- import type { ZodAutoFormFieldMeta } from '../types/zod.js';
2
+ import type { AutoFormControls, AutoFormField } from '../../types/auto-form';
3
+ import type { ZodAutoFormFieldMeta } from '../../types/zod';
4
4
  /** 将 Zod schema 递归解析为 AutoFormField 列表(schema 遍历的核心入口) */
5
5
  export declare function introspectSchema(schema: z.ZodType, mapping: AutoFormControls, path: string, globalMeta?: ZodAutoFormFieldMeta): AutoFormField[];
6
6
  /** 将含布局标记的 schema 还原为纯字段 schema,用于 Zod 表单校验 */
7
7
  export declare function extractPureSchema<T extends z.ZodObject<any, any>>(schema: T): z.ZodObject<any, any>;
8
+ /**
9
+ * 从校验 schema 中剔除指定顶层字段。
10
+ * 用于让 meta.if 隐藏的字段不参与校验,使校验集与渲染保持一致。
11
+ */
12
+ export declare function omitFields(schema: z.ZodObject<any, any>, keys: string[]): z.ZodObject<any, any>;
@@ -2,7 +2,7 @@ import { markRaw } from "vue";
2
2
  import { z as zod } from "zod";
3
3
  import { joinPath, startCase, toPath, isFunction, isObject } from "@movk/core";
4
4
  import { getAutoFormMetadata } from "./metadata.js";
5
- import { AUTOFORM_LIMITS, AUTOFORM_META } from "../constants/auto-form.js";
5
+ import { AUTOFORM_LIMITS, AUTOFORM_META } from "./constants.js";
6
6
  function getUnwrappedSchema(schema) {
7
7
  const def = schema?.def || schema?._def;
8
8
  return def?.innerType || def?.in || def?.schema || void 0;
@@ -205,3 +205,16 @@ export function extractPureSchema(schema) {
205
205
  const pureShape = processLayoutShape(shape);
206
206
  return zod.object(pureShape);
207
207
  }
208
+ export function omitFields(schema, keys) {
209
+ const shape = schema.shape;
210
+ if (!shape || typeof shape !== "object") {
211
+ return schema;
212
+ }
213
+ const present = keys.filter((key) => key in shape);
214
+ if (!present.length) {
215
+ return schema;
216
+ }
217
+ const mask = {};
218
+ for (const key of present) mask[key] = true;
219
+ return schema.omit(mask);
220
+ }
@@ -0,0 +1,50 @@
1
+ import type { ColumnDef, ColumnMeta, ColumnPinningState, ColumnSizingState, VisibilityState } from '@tanstack/vue-table';
2
+ import type { DataTableDensityPreset, DataTableSizePreset, DataTableTreeSelectionStrategy } from '../../../types/data-table';
3
+ import type { DataTableProps } from '../../../types/data-table/component';
4
+ export declare const DENSITY_PRESETS: Record<DataTableDensityPreset, {
5
+ th?: string;
6
+ td?: string;
7
+ }>;
8
+ export declare const SIZE_PRESET_MAP: Record<DataTableSizePreset, number>;
9
+ export interface SpecialColumnDefaults {
10
+ id: string;
11
+ fixed?: 'left' | 'right';
12
+ size?: number;
13
+ align?: 'left' | 'center' | 'right';
14
+ header?: string;
15
+ tdClass?: string;
16
+ }
17
+ export type SpecialColumnType = 'selection' | 'index' | 'expand' | 'row-pinning' | 'actions';
18
+ export declare const SPECIAL_COLUMN_DEFAULTS: Record<SpecialColumnType, SpecialColumnDefaults>;
19
+ export interface ResolvedColumnState<T> {
20
+ columnDefs: ColumnDef<T, unknown>[];
21
+ initialPinning: ColumnPinningState;
22
+ initialVisibility: VisibilityState;
23
+ initialSizing: ColumnSizingState;
24
+ hasColumnPinning: boolean;
25
+ hasColumnResizing: boolean;
26
+ hasColumnSort: boolean;
27
+ hasExpandColumn: boolean;
28
+ selectionMode?: 'single' | 'multiple';
29
+ selectionStrategy?: DataTableTreeSelectionStrategy;
30
+ subRowSelection?: boolean;
31
+ allColumnIds: string[];
32
+ }
33
+ export interface ResolveContext<T> {
34
+ options: DataTableProps<T>;
35
+ density: ColumnMeta<T, unknown>['class'] | null;
36
+ pinning: ColumnPinningState;
37
+ visibility: VisibilityState;
38
+ sizing: ColumnSizingState;
39
+ flags: {
40
+ hasPinning: boolean;
41
+ hasResizing: boolean;
42
+ hasSort: boolean;
43
+ hasExpand: boolean;
44
+ };
45
+ selectionMode?: 'single' | 'multiple';
46
+ selectionStrategy?: DataTableTreeSelectionStrategy;
47
+ subRowSelection?: boolean;
48
+ nextGroupId: () => number;
49
+ allColumnIds: string[];
50
+ }
@@ -0,0 +1,19 @@
1
+ export const DENSITY_PRESETS = {
2
+ compact: { td: "px-3 py-1.5", th: "px-3 py-2" },
3
+ normal: { td: "px-4 py-2.5", th: "px-4 py-3" },
4
+ comfortable: { td: "p-4", th: "p-4" }
5
+ };
6
+ export const SIZE_PRESET_MAP = {
7
+ xs: 80,
8
+ sm: 120,
9
+ md: 180,
10
+ lg: 260,
11
+ xl: 400
12
+ };
13
+ export const SPECIAL_COLUMN_DEFAULTS = {
14
+ "selection": { id: "__selection", size: 60, align: "center" },
15
+ "index": { id: "__index", size: 60, align: "center", header: "#", tdClass: "text-muted" },
16
+ "expand": { id: "__expand", size: 60, align: "center" },
17
+ "row-pinning": { id: "__row_pinning", size: 60, align: "center" },
18
+ "actions": { id: "__actions", size: 60, header: "\u64CD\u4F5C", align: "center" }
19
+ };
@@ -0,0 +1,4 @@
1
+ import type { DataTableColumn } from '../../../types/data-table';
2
+ import type { ResolvedColumnState } from './constants';
3
+ import type { DataTableProps } from '../../../types/data-table/component';
4
+ export declare function resolveColumns<T>(columns: DataTableColumn<T>[], options: DataTableProps<T>): ResolvedColumnState<T>;
@@ -0,0 +1,59 @@
1
+ import { isDataColumn, isGroupColumn } from "../../../types/data-table/index.js";
2
+ import { isString } from "@movk/core";
3
+ import { DENSITY_PRESETS } from "./constants.js";
4
+ import { resolveDataColumn } from "./resolve-data-column.js";
5
+ import { resolveGroupColumn } from "./resolve-group-column.js";
6
+ import {
7
+ resolveActionsColumn,
8
+ resolveExpandColumn,
9
+ resolveIndexColumn,
10
+ resolveRowPinningColumn,
11
+ resolveSelectionColumn
12
+ } from "./resolve-special-columns.js";
13
+ function resolveColumn(col, ctx, inheritedFixed) {
14
+ if (isGroupColumn(col)) return resolveGroupColumn(col, ctx, resolveColumn, inheritedFixed);
15
+ if (isDataColumn(col)) return resolveDataColumn(col, ctx, inheritedFixed);
16
+ if ("type" in col) {
17
+ switch (col.type) {
18
+ case "selection":
19
+ return resolveSelectionColumn(col, ctx);
20
+ case "index":
21
+ return resolveIndexColumn(col, ctx);
22
+ case "expand":
23
+ return resolveExpandColumn(col, ctx);
24
+ case "row-pinning":
25
+ return resolveRowPinningColumn(col, ctx);
26
+ case "actions":
27
+ return resolveActionsColumn(col, ctx);
28
+ }
29
+ }
30
+ return col;
31
+ }
32
+ export function resolveColumns(columns, options) {
33
+ let groupCounter = 0;
34
+ const ctx = {
35
+ options,
36
+ density: options.density ? isString(options.density) ? DENSITY_PRESETS[options.density] : options.density : null,
37
+ pinning: { left: [], right: [] },
38
+ visibility: {},
39
+ sizing: {},
40
+ flags: { hasPinning: false, hasResizing: false, hasSort: false, hasExpand: false },
41
+ nextGroupId: () => groupCounter++,
42
+ allColumnIds: []
43
+ };
44
+ const columnDefs = columns.map((col) => resolveColumn(col, ctx));
45
+ return {
46
+ columnDefs,
47
+ initialPinning: ctx.pinning,
48
+ initialVisibility: ctx.visibility,
49
+ initialSizing: ctx.sizing,
50
+ hasColumnPinning: ctx.flags.hasPinning,
51
+ hasColumnResizing: ctx.flags.hasResizing,
52
+ hasColumnSort: ctx.flags.hasSort,
53
+ hasExpandColumn: ctx.flags.hasExpand,
54
+ selectionMode: ctx.selectionMode,
55
+ selectionStrategy: ctx.selectionStrategy,
56
+ subRowSelection: ctx.subRowSelection,
57
+ allColumnIds: ctx.allColumnIds
58
+ };
59
+ }
@@ -0,0 +1,9 @@
1
+ import type { ColumnDef, HeaderContext } from '@tanstack/vue-table';
2
+ import type { VNode } from 'vue';
3
+ import type { DataTableDataColumn } from '../../../types/data-table';
4
+ import type { ResolveContext } from './constants';
5
+ import type { DataTableProps } from '../../../types/data-table/component';
6
+ export declare function renderHeaderActions<T>(ctx: HeaderContext<T, unknown>, col: Pick<DataTableDataColumn<T>, 'pinButtonProps' | 'sortButtonProps'>, options: DataTableProps<T>, label: unknown, sortable: boolean, pinable: boolean, resizable: boolean): VNode<import("vue").RendererNode, import("vue").RendererElement, {
7
+ [key: string]: any;
8
+ }>;
9
+ export declare function resolveDataColumn<T>(col: DataTableDataColumn<T>, ctx: ResolveContext<T>, inheritedFixed?: 'left' | 'right'): ColumnDef<T, unknown>;
@@ -0,0 +1,196 @@
1
+ import { h, isVNode } from "vue";
2
+ import { resolveCallbackValue, resolveColumnFlag, resolveTemplate } from "./utils.js";
3
+ import DataTableCellTooltip from "../components/CellTooltip.vue";
4
+ import { UButton } from "#components";
5
+ import { applyBaseState, buildClassMeta, makeColumnStyle, resolveAlignClass } from "./style.js";
6
+ function buildDataCellRenderer(col, options) {
7
+ const maybeTooltip = col.tooltip !== void 0 ? !!col.tooltip : !!options.tooltip;
8
+ const maybeTruncate = col.truncate !== void 0 ? !!col.truncate : !!options.truncate;
9
+ const needCustomCell = !!(col.cell || maybeTooltip || maybeTruncate || col.emptyCell !== void 0 || options.emptyCell !== false);
10
+ if (!needCustomCell) return void 0;
11
+ return (ctx) => {
12
+ const raw = ctx.getValue();
13
+ const emptyText = col.emptyCell !== void 0 ? col.emptyCell : options.emptyCell;
14
+ if ((raw == null || raw === "") && emptyText !== false) {
15
+ return emptyText != null ? resolveTemplate(emptyText, ctx) : null;
16
+ }
17
+ const formatted = col.cell ? resolveTemplate(col.cell, ctx) : String(raw ?? "");
18
+ if (isVNode(formatted)) return formatted;
19
+ const tooltipRaw = col.tooltip !== void 0 ? col.tooltip : options.tooltip;
20
+ const tooltipVal = resolveCallbackValue(tooltipRaw, ctx);
21
+ if (tooltipVal) {
22
+ return h(DataTableCellTooltip, {
23
+ text: String(formatted ?? ""),
24
+ lines: tooltipVal === true ? void 0 : tooltipVal,
25
+ ...options.tooltipProps ?? {},
26
+ ...col.tooltipProps ?? {}
27
+ });
28
+ }
29
+ const truncateRaw = col.truncate !== void 0 ? col.truncate : options.truncate;
30
+ const truncateVal = resolveCallbackValue(truncateRaw, ctx);
31
+ if (truncateVal) {
32
+ if (truncateVal === true) {
33
+ return h("div", { class: "truncate" }, String(formatted ?? ""));
34
+ }
35
+ return h("div", {
36
+ style: {
37
+ "-webkit-line-clamp": truncateVal,
38
+ "display": "-webkit-box",
39
+ "-webkit-box-orient": "vertical",
40
+ "overflow": "hidden",
41
+ "white-space": "normal",
42
+ "word-break": "break-all"
43
+ }
44
+ }, String(formatted ?? ""));
45
+ }
46
+ return formatted;
47
+ };
48
+ }
49
+ function buildSortAction(col, options) {
50
+ return {
51
+ id: "sort",
52
+ position: "trailing",
53
+ render: (ctx) => {
54
+ const isSorted = ctx.column.getIsSorted();
55
+ const sortCtx = { isSorted, headerContext: ctx };
56
+ const icon = isSorted === "asc" ? "i-lucide-arrow-up-narrow-wide" : isSorted === "desc" ? "i-lucide-arrow-down-wide-narrow" : "i-lucide-arrow-up-down";
57
+ return h(UButton, {
58
+ size: "xs",
59
+ variant: "ghost",
60
+ color: "neutral",
61
+ class: isSorted ? "opacity-100" : "opacity-60 group-hover:opacity-100",
62
+ icon,
63
+ onClick: ctx.column.getToggleSortingHandler(),
64
+ ...resolveCallbackValue(options.sortButtonProps ?? {}, sortCtx),
65
+ ...resolveCallbackValue(col.sortButtonProps ?? {}, sortCtx)
66
+ });
67
+ }
68
+ };
69
+ }
70
+ function buildPinAction(col, options) {
71
+ return {
72
+ id: "pin",
73
+ position: "leading",
74
+ render: (ctx) => {
75
+ const pinned = ctx.column.getIsPinned();
76
+ const pinCtx = { pinned, headerContext: ctx };
77
+ return h(UButton, {
78
+ "size": "xs",
79
+ "variant": "ghost",
80
+ "color": pinned ? "primary" : "neutral",
81
+ "class": pinned ? "opacity-100" : "opacity-60 group-hover:opacity-100",
82
+ "icon": pinned ? "i-lucide-pin-off" : "i-lucide-pin",
83
+ "aria-label": pinned ? "Cancel column pin" : "Pin column",
84
+ "onClick": (event) => {
85
+ event.stopPropagation();
86
+ if (pinned === "left") {
87
+ ctx.column.pin("right");
88
+ return;
89
+ }
90
+ if (pinned === "right") {
91
+ ctx.column.pin(false);
92
+ return;
93
+ }
94
+ const th = event.target.closest("th");
95
+ if (th) {
96
+ const w = Math.ceil(th.getBoundingClientRect().width);
97
+ if (w > 0) ctx.table.setColumnSizing((prev) => ({ ...prev, [ctx.column.id]: w }));
98
+ }
99
+ ctx.column.pin("left");
100
+ },
101
+ ...resolveCallbackValue(options.pinButtonProps ?? {}, pinCtx),
102
+ ...resolveCallbackValue(col.pinButtonProps ?? {}, pinCtx)
103
+ });
104
+ }
105
+ };
106
+ }
107
+ export function renderHeaderActions(ctx, col, options, label, sortable, pinable, resizable) {
108
+ const actions = [];
109
+ if (pinable) actions.push(buildPinAction(col, options));
110
+ if (sortable) actions.push(buildSortAction(col, options));
111
+ const leading = actions.filter((a) => a.position === "leading").map((a) => a.render(ctx));
112
+ const trailing = actions.filter((a) => a.position === "trailing").map((a) => a.render(ctx));
113
+ const startResize = (e) => {
114
+ const id = ctx.column.id;
115
+ const seeded = !(id in ctx.table.getState().columnSizing);
116
+ if (seeded) {
117
+ const th = e.currentTarget?.closest("th");
118
+ const w = th ? Math.round(th.getBoundingClientRect().width) : 0;
119
+ if (w > 0) ctx.table.setColumnSizing((prev) => ({ ...prev, [id]: w }));
120
+ }
121
+ ctx.header.getResizeHandler()(e);
122
+ if (!seeded) return;
123
+ const startX = "touches" in e ? e.touches[0]?.clientX ?? 0 : e.clientX;
124
+ let moved = false;
125
+ const onMove = (ev) => {
126
+ const x = "touches" in ev ? ev.touches[0]?.clientX : ev.clientX;
127
+ if (typeof x === "number" && Math.abs(x - startX) > 2) moved = true;
128
+ };
129
+ const onEnd = () => {
130
+ if (!moved) {
131
+ ctx.table.setColumnSizing(
132
+ (prev) => Object.fromEntries(Object.entries(prev).filter(([key]) => key !== id))
133
+ );
134
+ }
135
+ window.removeEventListener("mousemove", onMove);
136
+ window.removeEventListener("mouseup", onEnd);
137
+ window.removeEventListener("touchmove", onMove);
138
+ window.removeEventListener("touchend", onEnd);
139
+ };
140
+ window.addEventListener("mousemove", onMove);
141
+ window.addEventListener("mouseup", onEnd);
142
+ window.addEventListener("touchmove", onMove);
143
+ window.addEventListener("touchend", onEnd);
144
+ };
145
+ const resizeHandle = resizable ? h("div", {
146
+ class: "absolute top-0 bottom-0 right-0 w-4 -mr-2 cursor-col-resize select-none touch-none flex items-center justify-center group/resize",
147
+ onMousedown: startResize,
148
+ onTouchstart: startResize,
149
+ onClick: (e) => e.stopPropagation()
150
+ }, [
151
+ h("div", {
152
+ class: [
153
+ "h-full transition-colors",
154
+ ctx.column.getIsResizing() ? "w-0.5 bg-primary" : "w-px opacity-50 group-hover:opacity-100 bg-(--ui-border-accented) group-hover/resize:w-0.5 group-hover/resize:bg-primary"
155
+ ].join(" ")
156
+ })
157
+ ]) : null;
158
+ const labelNode = isVNode(label) ? label : h("span", { class: "truncate" }, String(label ?? ""));
159
+ return h("div", { class: "flex items-center gap-1 relative group" }, [
160
+ ...leading,
161
+ labelNode,
162
+ ...trailing,
163
+ resizeHandle
164
+ ]);
165
+ }
166
+ export function resolveDataColumn(col, ctx, inheritedFixed) {
167
+ const { options, density } = ctx;
168
+ const id = col.accessorKey;
169
+ const effectiveSortable = resolveColumnFlag(col.sortable, options.sortable, col);
170
+ const effectivePinable = resolveColumnFlag(col.pinable, options.pinable, col);
171
+ const effectiveResizable = resolveColumnFlag(col.resizable, options.resizable, col);
172
+ ctx.flags.hasPinning ||= effectivePinable;
173
+ ctx.flags.hasResizing ||= effectiveResizable;
174
+ ctx.flags.hasSort ||= effectiveSortable;
175
+ const resolvedSize = applyBaseState(id, col.fixed ?? inheritedFixed, col.size, ctx);
176
+ if (col.visibility === false) ctx.visibility[id] = false;
177
+ ctx.allColumnIds.push(id);
178
+ const cellRenderer = buildDataCellRenderer(col, options);
179
+ const def = {
180
+ accessorKey: id,
181
+ header: effectiveSortable || effectivePinable || effectiveResizable ? (hctx) => renderHeaderActions(hctx, col, options, col.header ?? id, effectiveSortable, effectivePinable, effectiveResizable) : col.header ?? id,
182
+ ...col.minSize != null && { minSize: col.minSize },
183
+ ...col.maxSize != null && { maxSize: col.maxSize },
184
+ ...resolvedSize != null && { size: resolvedSize },
185
+ enableSorting: effectiveSortable,
186
+ enablePinning: effectivePinable,
187
+ enableResizing: effectiveResizable,
188
+ ...cellRenderer && { cell: cellRenderer },
189
+ meta: {
190
+ class: buildClassMeta(density, resolveAlignClass(col.align), effectiveResizable),
191
+ style: makeColumnStyle(col.align)
192
+ }
193
+ };
194
+ if (col._raw) Object.assign(def, col._raw);
195
+ return def;
196
+ }
@@ -0,0 +1,4 @@
1
+ import type { ColumnDef } from '@tanstack/vue-table';
2
+ import type { DataTableColumn, DataTableGroupColumn } from '../../../types/data-table';
3
+ import type { ResolveContext } from './constants';
4
+ export declare function resolveGroupColumn<T>(col: DataTableGroupColumn<T>, ctx: ResolveContext<T>, resolveChild: (col: DataTableColumn<T>, ctx: ResolveContext<T>, inheritedFixed?: 'left' | 'right') => ColumnDef<T, unknown>, inheritedFixed?: 'left' | 'right'): ColumnDef<T, unknown>;