@melt-js/comps-vben 0.0.0-stage → 2026.11.8-2

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 (618) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +91 -2
  3. package/hel_dist/assets/index-DaBGAjzb.js +478 -0
  4. package/hel_dist/assets/style-CcRbEt6_.css +2 -0
  5. package/hel_dist/entry.js +20 -0
  6. package/hel_dist/hel-meta.json +116 -0
  7. package/hel_dist/index.html +37 -0
  8. package/hel_proxy/entry.js +20 -0
  9. package/hel_proxy/entry.js.map +1 -0
  10. package/hel_proxy_es/entry.js +11 -0
  11. package/hel_proxy_es/entry.js.map +1 -0
  12. package/package.json +101 -3
  13. package/scripts/check-tdz.mjs +20 -0
  14. package/scripts/check.mjs +18 -0
  15. package/scripts/meta.mjs +28 -0
  16. package/scripts/prepublishOnly.mjs +42 -0
  17. package/scripts/publish-stage.mjs +25 -0
  18. package/src/common-ui/components/api-component/api-component.vue +273 -0
  19. package/src/common-ui/components/api-component/index.ts +7 -0
  20. package/src/common-ui/components/api-component/types.ts +72 -0
  21. package/src/common-ui/components/captcha/hooks/useCaptchaPoints.ts +19 -0
  22. package/src/common-ui/components/captcha/index.ts +7 -0
  23. package/src/common-ui/components/captcha/point-selection-captcha/index.vue +176 -0
  24. package/src/common-ui/components/captcha/point-selection-captcha/point-selection-captcha-card.vue +86 -0
  25. package/src/common-ui/components/captcha/slider-captcha/index.vue +254 -0
  26. package/src/common-ui/components/captcha/slider-captcha/slider-captcha-action.vue +65 -0
  27. package/src/common-ui/components/captcha/slider-captcha/slider-captcha-bar.vue +40 -0
  28. package/src/common-ui/components/captcha/slider-captcha/slider-captcha-content.vue +53 -0
  29. package/src/common-ui/components/captcha/slider-rotate-captcha/index.vue +213 -0
  30. package/src/common-ui/components/captcha/slider-translate-captcha/index.vue +311 -0
  31. package/src/common-ui/components/captcha/types.ts +210 -0
  32. package/src/common-ui/components/col-page/col-page.vue +111 -0
  33. package/src/common-ui/components/col-page/index.ts +2 -0
  34. package/src/common-ui/components/col-page/types.ts +26 -0
  35. package/src/common-ui/components/count-to/count-to.vue +123 -0
  36. package/src/common-ui/components/count-to/index.ts +2 -0
  37. package/src/common-ui/components/count-to/types.ts +53 -0
  38. package/src/common-ui/components/cropper/cropper.vue +981 -0
  39. package/src/common-ui/components/cropper/index.ts +1 -0
  40. package/src/common-ui/components/ellipsis-text/ellipsis-text.vue +232 -0
  41. package/src/common-ui/components/ellipsis-text/index.ts +1 -0
  42. package/src/common-ui/components/icon-picker/icon-picker.vue +322 -0
  43. package/src/common-ui/components/icon-picker/icons.ts +56 -0
  44. package/src/common-ui/components/icon-picker/index.ts +2 -0
  45. package/src/common-ui/components/icon-picker/types.ts +26 -0
  46. package/src/common-ui/components/index.ts +51 -0
  47. package/src/common-ui/components/json-viewer/index.ts +3 -0
  48. package/src/common-ui/components/json-viewer/index.vue +128 -0
  49. package/src/common-ui/components/json-viewer/style.scss +91 -0
  50. package/src/common-ui/components/json-viewer/types.ts +44 -0
  51. package/src/common-ui/components/loading/directive.ts +132 -0
  52. package/src/common-ui/components/loading/index.ts +3 -0
  53. package/src/common-ui/components/loading/loading.vue +39 -0
  54. package/src/common-ui/components/loading/spinner.vue +28 -0
  55. package/src/common-ui/components/page/index.ts +2 -0
  56. package/src/common-ui/components/page/page.vue +107 -0
  57. package/src/common-ui/components/page/types.ts +23 -0
  58. package/src/common-ui/components/resize/index.ts +1 -0
  59. package/src/common-ui/components/resize/resize.vue +1269 -0
  60. package/src/common-ui/components/tippy/directive.ts +100 -0
  61. package/src/common-ui/components/tippy/index.ts +67 -0
  62. package/src/common-ui/components/tree/index.ts +1 -0
  63. package/src/common-ui/components/tree/tree.vue +25 -0
  64. package/src/common-ui/index.ts +2 -0
  65. package/src/common-ui/ui/about/about.ts +14 -0
  66. package/src/common-ui/ui/about/about.vue +183 -0
  67. package/src/common-ui/ui/about/index.ts +1 -0
  68. package/src/common-ui/ui/authentication/auth-title.vue +13 -0
  69. package/src/common-ui/ui/authentication/code-login.vue +127 -0
  70. package/src/common-ui/ui/authentication/dingding-login.vue +113 -0
  71. package/src/common-ui/ui/authentication/forget-password.vue +116 -0
  72. package/src/common-ui/ui/authentication/index.ts +7 -0
  73. package/src/common-ui/ui/authentication/login-expired-modal.vue +95 -0
  74. package/src/common-ui/ui/authentication/login.vue +186 -0
  75. package/src/common-ui/ui/authentication/qrcode-login.vue +105 -0
  76. package/src/common-ui/ui/authentication/register.vue +121 -0
  77. package/src/common-ui/ui/authentication/third-party-login.vue +71 -0
  78. package/src/common-ui/ui/authentication/types.ts +70 -0
  79. package/src/common-ui/ui/dashboard/analysis/analysis-chart-card.vue +24 -0
  80. package/src/common-ui/ui/dashboard/analysis/analysis-charts-tabs.vue +40 -0
  81. package/src/common-ui/ui/dashboard/analysis/analysis-overview.vue +55 -0
  82. package/src/common-ui/ui/dashboard/analysis/index.ts +3 -0
  83. package/src/common-ui/ui/dashboard/index.ts +3 -0
  84. package/src/common-ui/ui/dashboard/typing.ts +50 -0
  85. package/src/common-ui/ui/dashboard/workbench/index.ts +5 -0
  86. package/src/common-ui/ui/dashboard/workbench/workbench-header.vue +48 -0
  87. package/src/common-ui/ui/dashboard/workbench/workbench-project.vue +73 -0
  88. package/src/common-ui/ui/dashboard/workbench/workbench-quick-nav.vue +56 -0
  89. package/src/common-ui/ui/dashboard/workbench/workbench-todo.vue +63 -0
  90. package/src/common-ui/ui/dashboard/workbench/workbench-trends.vue +64 -0
  91. package/src/common-ui/ui/fallback/fallback.ts +25 -0
  92. package/src/common-ui/ui/fallback/fallback.vue +164 -0
  93. package/src/common-ui/ui/fallback/icons/icon-403.vue +151 -0
  94. package/src/common-ui/ui/fallback/icons/icon-404.vue +154 -0
  95. package/src/common-ui/ui/fallback/icons/icon-500.vue +215 -0
  96. package/src/common-ui/ui/fallback/icons/icon-coming-soon.vue +262 -0
  97. package/src/common-ui/ui/fallback/icons/icon-offline.vue +112 -0
  98. package/src/common-ui/ui/fallback/icons/warning.svg +1 -0
  99. package/src/common-ui/ui/fallback/index.ts +2 -0
  100. package/src/common-ui/ui/index.ts +5 -0
  101. package/src/common-ui/ui/profile/base-setting.vue +58 -0
  102. package/src/common-ui/ui/profile/index.ts +6 -0
  103. package/src/common-ui/ui/profile/notification-setting.vue +52 -0
  104. package/src/common-ui/ui/profile/password-setting.vue +59 -0
  105. package/src/common-ui/ui/profile/profile.vue +64 -0
  106. package/src/common-ui/ui/profile/security-setting.vue +52 -0
  107. package/src/common-ui/ui/profile/types.ts +21 -0
  108. package/src/configs/subApp.ts +1 -0
  109. package/src/entrance/libProperties.ts +34 -0
  110. package/src/entrance/libTypes.js +9 -0
  111. package/src/form-ui/components/form-actions.vue +178 -0
  112. package/src/form-ui/components/form-field-array.vue +234 -0
  113. package/src/form-ui/config.ts +117 -0
  114. package/src/form-ui/deprecation.ts +18 -0
  115. package/src/form-ui/field-name.ts +106 -0
  116. package/src/form-ui/form-api.ts +766 -0
  117. package/src/form-ui/form-codec.ts +40 -0
  118. package/src/form-ui/form-render/context.ts +25 -0
  119. package/src/form-ui/form-render/dependencies.ts +305 -0
  120. package/src/form-ui/form-render/expandable.ts +105 -0
  121. package/src/form-ui/form-render/form-field.vue +644 -0
  122. package/src/form-ui/form-render/form-group.vue +126 -0
  123. package/src/form-ui/form-render/form-label.vue +35 -0
  124. package/src/form-ui/form-render/form.vue +205 -0
  125. package/src/form-ui/form-render/helper.ts +65 -0
  126. package/src/form-ui/form-render/index.ts +3 -0
  127. package/src/form-ui/form-render/schema.ts +534 -0
  128. package/src/form-ui/form-render/utils.ts +170 -0
  129. package/src/form-ui/form-runtime-field.ts +82 -0
  130. package/src/form-ui/form-runtime.ts +325 -0
  131. package/src/form-ui/form-value-transform.ts +235 -0
  132. package/src/form-ui/index.ts +39 -0
  133. package/src/form-ui/rule-registry.ts +17 -0
  134. package/src/form-ui/types.ts +1054 -0
  135. package/src/form-ui/use-custom-field-value.ts +124 -0
  136. package/src/form-ui/use-form-context.ts +148 -0
  137. package/src/form-ui/use-vben-form.ts +81 -0
  138. package/src/form-ui/vben-form.vue +79 -0
  139. package/src/form-ui/vben-use-form.vue +187 -0
  140. package/src/layout-ui/components/index.ts +5 -0
  141. package/src/layout-ui/components/layout-content.vue +75 -0
  142. package/src/layout-ui/components/layout-footer.vue +46 -0
  143. package/src/layout-ui/components/layout-header.vue +89 -0
  144. package/src/layout-ui/components/layout-sidebar.vue +484 -0
  145. package/src/layout-ui/components/layout-tabbar.vue +30 -0
  146. package/src/layout-ui/components/widgets/index.ts +2 -0
  147. package/src/layout-ui/components/widgets/sidebar-collapse-button.vue +25 -0
  148. package/src/layout-ui/components/widgets/sidebar-fixed-button.vue +27 -0
  149. package/src/layout-ui/header-scroll-state.ts +28 -0
  150. package/src/layout-ui/hooks/use-layout.ts +53 -0
  151. package/src/layout-ui/hooks/use-sidebar-drag.ts +152 -0
  152. package/src/layout-ui/index.ts +2 -0
  153. package/src/layout-ui/vben-layout.ts +188 -0
  154. package/src/layout-ui/vben-layout.vue +768 -0
  155. package/src/layouts/authentication/authentication.vue +196 -0
  156. package/src/layouts/authentication/form.vue +38 -0
  157. package/src/layouts/authentication/icons/slogan.vue +4568 -0
  158. package/src/layouts/authentication/index.ts +2 -0
  159. package/src/layouts/authentication/toolbar.vue +49 -0
  160. package/src/layouts/authentication/types.ts +1 -0
  161. package/src/layouts/basic/README.md +7 -0
  162. package/src/layouts/basic/content/content-spinner.vue +12 -0
  163. package/src/layouts/basic/content/content.vue +112 -0
  164. package/src/layouts/basic/content/index.ts +2 -0
  165. package/src/layouts/basic/content/use-content-spinner.ts +98 -0
  166. package/src/layouts/basic/copyright/copyright.vue +49 -0
  167. package/src/layouts/basic/copyright/index.ts +1 -0
  168. package/src/layouts/basic/footer/footer.vue +11 -0
  169. package/src/layouts/basic/footer/index.ts +1 -0
  170. package/src/layouts/basic/header/header.vue +408 -0
  171. package/src/layouts/basic/header/index.ts +1 -0
  172. package/src/layouts/basic/index.ts +1 -0
  173. package/src/layouts/basic/layout.vue +478 -0
  174. package/src/layouts/basic/menu/extra-menu.vue +41 -0
  175. package/src/layouts/basic/menu/index.ts +5 -0
  176. package/src/layouts/basic/menu/menu.vue +45 -0
  177. package/src/layouts/basic/menu/mixed-menu.vue +46 -0
  178. package/src/layouts/basic/menu/use-extra-menu.ts +179 -0
  179. package/src/layouts/basic/menu/use-mixed-menu.ts +181 -0
  180. package/src/layouts/basic/menu/use-navigation.ts +74 -0
  181. package/src/layouts/basic/tabbar/index.ts +2 -0
  182. package/src/layouts/basic/tabbar/tabbar.vue +84 -0
  183. package/src/layouts/basic/tabbar/use-tabbar.ts +229 -0
  184. package/src/layouts/basic/use-layout-scroll.ts +85 -0
  185. package/src/layouts/hooks/index.ts +98 -0
  186. package/src/layouts/iframe/iframe-router-view.vue +86 -0
  187. package/src/layouts/iframe/iframe-view.vue +3 -0
  188. package/src/layouts/iframe/index.ts +2 -0
  189. package/src/layouts/index.ts +4 -0
  190. package/src/layouts/route-cached/cached-tab-keys.ts +13 -0
  191. package/src/layouts/route-cached/index.ts +2 -0
  192. package/src/layouts/route-cached/route-cached-page.vue +36 -0
  193. package/src/layouts/route-cached/route-cached-view.vue +97 -0
  194. package/src/layouts/widgets/breadcrumb-routes.ts +41 -0
  195. package/src/layouts/widgets/breadcrumb.vue +78 -0
  196. package/src/layouts/widgets/check-updates/check-updates.vue +136 -0
  197. package/src/layouts/widgets/check-updates/index.ts +1 -0
  198. package/src/layouts/widgets/color-toggle.vue +64 -0
  199. package/src/layouts/widgets/global-search/global-search.vue +173 -0
  200. package/src/layouts/widgets/global-search/index.ts +1 -0
  201. package/src/layouts/widgets/global-search/search-panel.vue +299 -0
  202. package/src/layouts/widgets/index.ts +12 -0
  203. package/src/layouts/widgets/language-toggle.vue +48 -0
  204. package/src/layouts/widgets/layout-toggle.vue +64 -0
  205. package/src/layouts/widgets/lock-screen/index.ts +2 -0
  206. package/src/layouts/widgets/lock-screen/lock-screen-modal.vue +110 -0
  207. package/src/layouts/widgets/lock-screen/lock-screen.vue +167 -0
  208. package/src/layouts/widgets/notification/index.ts +3 -0
  209. package/src/layouts/widgets/notification/notification.vue +210 -0
  210. package/src/layouts/widgets/notification/types.ts +19 -0
  211. package/src/layouts/widgets/preferences/blocks/block.vue +22 -0
  212. package/src/layouts/widgets/preferences/blocks/checkbox-item.vue +63 -0
  213. package/src/layouts/widgets/preferences/blocks/custom/custom.vue +121 -0
  214. package/src/layouts/widgets/preferences/blocks/draggable-list.vue +138 -0
  215. package/src/layouts/widgets/preferences/blocks/general/animation.vue +56 -0
  216. package/src/layouts/widgets/preferences/blocks/general/general.vue +94 -0
  217. package/src/layouts/widgets/preferences/blocks/index.ts +21 -0
  218. package/src/layouts/widgets/preferences/blocks/input-item.vue +71 -0
  219. package/src/layouts/widgets/preferences/blocks/layout/breadcrumb.vue +61 -0
  220. package/src/layouts/widgets/preferences/blocks/layout/content.vue +53 -0
  221. package/src/layouts/widgets/preferences/blocks/layout/copyright.vue +56 -0
  222. package/src/layouts/widgets/preferences/blocks/layout/footer.vue +17 -0
  223. package/src/layouts/widgets/preferences/blocks/layout/header.vue +78 -0
  224. package/src/layouts/widgets/preferences/blocks/layout/layout.vue +112 -0
  225. package/src/layouts/widgets/preferences/blocks/layout/navigation.vue +50 -0
  226. package/src/layouts/widgets/preferences/blocks/layout/sidebar.vue +108 -0
  227. package/src/layouts/widgets/preferences/blocks/layout/tabbar.vue +106 -0
  228. package/src/layouts/widgets/preferences/blocks/layout/widget.vue +188 -0
  229. package/src/layouts/widgets/preferences/blocks/number-field-item.vue +74 -0
  230. package/src/layouts/widgets/preferences/blocks/select-item.vue +76 -0
  231. package/src/layouts/widgets/preferences/blocks/shortcut-keys/global.vue +55 -0
  232. package/src/layouts/widgets/preferences/blocks/switch-item.vue +55 -0
  233. package/src/layouts/widgets/preferences/blocks/theme/builtin.vue +162 -0
  234. package/src/layouts/widgets/preferences/blocks/theme/color-mode.vue +26 -0
  235. package/src/layouts/widgets/preferences/blocks/theme/font-size.vue +62 -0
  236. package/src/layouts/widgets/preferences/blocks/theme/radius.vue +38 -0
  237. package/src/layouts/widgets/preferences/blocks/theme/theme.vue +114 -0
  238. package/src/layouts/widgets/preferences/blocks/toggle-item.vue +46 -0
  239. package/src/layouts/widgets/preferences/icons/content-compact.vue +119 -0
  240. package/src/layouts/widgets/preferences/icons/full-content.vue +50 -0
  241. package/src/layouts/widgets/preferences/icons/header-mixed-nav.vue +202 -0
  242. package/src/layouts/widgets/preferences/icons/header-nav.vue +119 -0
  243. package/src/layouts/widgets/preferences/icons/header-sidebar-nav.vue +177 -0
  244. package/src/layouts/widgets/preferences/icons/index.ts +12 -0
  245. package/src/layouts/widgets/preferences/icons/mixed-nav.vue +161 -0
  246. package/src/layouts/widgets/preferences/icons/setting.vue +12 -0
  247. package/src/layouts/widgets/preferences/icons/sidebar-mixed-nav.vue +173 -0
  248. package/src/layouts/widgets/preferences/icons/sidebar-nav.vue +153 -0
  249. package/src/layouts/widgets/preferences/index.ts +3 -0
  250. package/src/layouts/widgets/preferences/preferences-button.vue +31 -0
  251. package/src/layouts/widgets/preferences/preferences-drawer.vue +674 -0
  252. package/src/layouts/widgets/preferences/preferences.vue +93 -0
  253. package/src/layouts/widgets/preferences/use-open-preferences.ts +16 -0
  254. package/src/layouts/widgets/theme-toggle/index.ts +1 -0
  255. package/src/layouts/widgets/theme-toggle/theme-button.vue +164 -0
  256. package/src/layouts/widgets/theme-toggle/theme-toggle.vue +83 -0
  257. package/src/layouts/widgets/timezone/index.ts +1 -0
  258. package/src/layouts/widgets/timezone/timezone-button.vue +92 -0
  259. package/src/layouts/widgets/user-dropdown/index.ts +1 -0
  260. package/src/layouts/widgets/user-dropdown/user-dropdown.vue +578 -0
  261. package/src/main.ts +17 -0
  262. package/src/menu-ui/components/collapse-transition.vue +96 -0
  263. package/src/menu-ui/components/index.ts +4 -0
  264. package/src/menu-ui/components/menu-badge-dot.vue +28 -0
  265. package/src/menu-ui/components/menu-badge.vue +57 -0
  266. package/src/menu-ui/components/menu-item.vue +140 -0
  267. package/src/menu-ui/components/menu.vue +880 -0
  268. package/src/menu-ui/components/normal-menu/index.ts +2 -0
  269. package/src/menu-ui/components/normal-menu/normal-menu.ts +27 -0
  270. package/src/menu-ui/components/normal-menu/normal-menu.vue +162 -0
  271. package/src/menu-ui/components/sub-menu-content.vue +105 -0
  272. package/src/menu-ui/components/sub-menu.vue +276 -0
  273. package/src/menu-ui/hooks/index.ts +2 -0
  274. package/src/menu-ui/hooks/use-menu-context.ts +55 -0
  275. package/src/menu-ui/hooks/use-menu-scroll.ts +46 -0
  276. package/src/menu-ui/hooks/use-menu.ts +48 -0
  277. package/src/menu-ui/index.ts +4 -0
  278. package/src/menu-ui/menu.vue +32 -0
  279. package/src/menu-ui/sub-menu.vue +71 -0
  280. package/src/menu-ui/types.ts +154 -0
  281. package/src/menu-ui/utils/index.ts +52 -0
  282. package/src/plugins/echarts/README.md +41 -0
  283. package/src/plugins/echarts/echarts-ui.vue +15 -0
  284. package/src/plugins/echarts/echarts.ts +40 -0
  285. package/src/plugins/echarts/index.ts +4 -0
  286. package/src/plugins/echarts/types.ts +28 -0
  287. package/src/plugins/echarts/use-echarts.ts +213 -0
  288. package/src/plugins/index.ts +2 -0
  289. package/src/plugins/motion/README.md +26 -0
  290. package/src/plugins/motion/index.ts +8 -0
  291. package/src/plugins/motion/types.ts +26 -0
  292. package/src/plugins/plugins-context.ts +39 -0
  293. package/src/plugins/tiptap/extensions.ts +452 -0
  294. package/src/plugins/tiptap/index.ts +4 -0
  295. package/src/plugins/tiptap/preview.vue +34 -0
  296. package/src/plugins/tiptap/style.css +112 -0
  297. package/src/plugins/tiptap/tiptap.vue +324 -0
  298. package/src/plugins/tiptap/toolbar.ts +374 -0
  299. package/src/plugins/tiptap/types.ts +87 -0
  300. package/src/plugins/tiptap/use-tiptap-toolbar.ts +176 -0
  301. package/src/plugins/types.ts +24 -0
  302. package/src/plugins/vxe-table/README.md +50 -0
  303. package/src/plugins/vxe-table/api.ts +202 -0
  304. package/src/plugins/vxe-table/extends.ts +150 -0
  305. package/src/plugins/vxe-table/index.ts +10 -0
  306. package/src/plugins/vxe-table/init.ts +151 -0
  307. package/src/plugins/vxe-table/style.css +128 -0
  308. package/src/plugins/vxe-table/types.ts +116 -0
  309. package/src/plugins/vxe-table/use-vxe-grid.ts +86 -0
  310. package/src/plugins/vxe-table/use-vxe-grid.vue +564 -0
  311. package/src/plugins/vxe-table/viewed-row/index.ts +8 -0
  312. package/src/plugins/vxe-table/viewed-row/types.ts +84 -0
  313. package/src/plugins/vxe-table/viewed-row/use-viewed-row.ts +590 -0
  314. package/src/popup-ui/alert/AlertBuilder.ts +244 -0
  315. package/src/popup-ui/alert/alert.ts +101 -0
  316. package/src/popup-ui/alert/alert.vue +220 -0
  317. package/src/popup-ui/alert/index.ts +14 -0
  318. package/src/popup-ui/drawer/drawer-api.ts +178 -0
  319. package/src/popup-ui/drawer/drawer.ts +192 -0
  320. package/src/popup-ui/drawer/drawer.vue +359 -0
  321. package/src/popup-ui/drawer/index.ts +7 -0
  322. package/src/popup-ui/drawer/use-drawer.ts +210 -0
  323. package/src/popup-ui/index.ts +3 -0
  324. package/src/popup-ui/modal/index.ts +7 -0
  325. package/src/popup-ui/modal/modal-api.ts +191 -0
  326. package/src/popup-ui/modal/modal.ts +212 -0
  327. package/src/popup-ui/modal/modal.vue +395 -0
  328. package/src/popup-ui/modal/use-modal-draggable.ts +141 -0
  329. package/src/popup-ui/modal/use-modal.ts +222 -0
  330. package/src/shadcn-ui/assets/index.css +1 -0
  331. package/src/shadcn-ui/components/avatar/avatar.vue +76 -0
  332. package/src/shadcn-ui/components/avatar/index.ts +1 -0
  333. package/src/shadcn-ui/components/back-top/back-top.vue +43 -0
  334. package/src/shadcn-ui/components/back-top/backtop.ts +38 -0
  335. package/src/shadcn-ui/components/back-top/index.ts +1 -0
  336. package/src/shadcn-ui/components/back-top/use-backtop.ts +45 -0
  337. package/src/shadcn-ui/components/breadcrumb/breadcrumb-background.vue +111 -0
  338. package/src/shadcn-ui/components/breadcrumb/breadcrumb-view.vue +39 -0
  339. package/src/shadcn-ui/components/breadcrumb/breadcrumb.vue +98 -0
  340. package/src/shadcn-ui/components/breadcrumb/index.ts +3 -0
  341. package/src/shadcn-ui/components/breadcrumb/types.ts +17 -0
  342. package/src/shadcn-ui/components/button/button-group.vue +98 -0
  343. package/src/shadcn-ui/components/button/button.ts +55 -0
  344. package/src/shadcn-ui/components/button/button.vue +42 -0
  345. package/src/shadcn-ui/components/button/check-button-group.vue +196 -0
  346. package/src/shadcn-ui/components/button/icon-button.vue +78 -0
  347. package/src/shadcn-ui/components/button/index.ts +5 -0
  348. package/src/shadcn-ui/components/checkbox/checkbox.vue +26 -0
  349. package/src/shadcn-ui/components/checkbox/index.ts +1 -0
  350. package/src/shadcn-ui/components/collapsible/collapsible-params-item.vue +123 -0
  351. package/src/shadcn-ui/components/collapsible/collapsible-params.vue +268 -0
  352. package/src/shadcn-ui/components/collapsible/collapsible.vue +79 -0
  353. package/src/shadcn-ui/components/collapsible/index.ts +4 -0
  354. package/src/shadcn-ui/components/collapsible/type.ts +22 -0
  355. package/src/shadcn-ui/components/context-menu/context-menu.vue +128 -0
  356. package/src/shadcn-ui/components/context-menu/index.ts +3 -0
  357. package/src/shadcn-ui/components/context-menu/interface.ts +42 -0
  358. package/src/shadcn-ui/components/count-to-animator/count-to-animator.vue +128 -0
  359. package/src/shadcn-ui/components/count-to-animator/index.ts +1 -0
  360. package/src/shadcn-ui/components/descriptions/descriptions-cell.vue +129 -0
  361. package/src/shadcn-ui/components/descriptions/descriptions-item.vue +57 -0
  362. package/src/shadcn-ui/components/descriptions/descriptions-row.vue +112 -0
  363. package/src/shadcn-ui/components/descriptions/descriptions.vue +91 -0
  364. package/src/shadcn-ui/components/descriptions/index.ts +4 -0
  365. package/src/shadcn-ui/components/descriptions/types.ts +93 -0
  366. package/src/shadcn-ui/components/descriptions/use-descriptions.ts +216 -0
  367. package/src/shadcn-ui/components/dropdown-menu/dropdown-menu.vue +49 -0
  368. package/src/shadcn-ui/components/dropdown-menu/dropdown-radio-menu.vue +52 -0
  369. package/src/shadcn-ui/components/dropdown-menu/index.ts +4 -0
  370. package/src/shadcn-ui/components/dropdown-menu/interface.ts +32 -0
  371. package/src/shadcn-ui/components/expandable-arrow/expandable-arrow.vue +31 -0
  372. package/src/shadcn-ui/components/expandable-arrow/index.ts +1 -0
  373. package/src/shadcn-ui/components/full-screen/full-screen.vue +41 -0
  374. package/src/shadcn-ui/components/full-screen/index.ts +1 -0
  375. package/src/shadcn-ui/components/hover-card/hover-card.vue +55 -0
  376. package/src/shadcn-ui/components/hover-card/index.ts +2 -0
  377. package/src/shadcn-ui/components/icon/icon.vue +35 -0
  378. package/src/shadcn-ui/components/icon/index.ts +1 -0
  379. package/src/shadcn-ui/components/index.ts +26 -0
  380. package/src/shadcn-ui/components/input-password/index.ts +1 -0
  381. package/src/shadcn-ui/components/input-password/input-password.vue +57 -0
  382. package/src/shadcn-ui/components/input-password/password-strength.vue +66 -0
  383. package/src/shadcn-ui/components/logo/index.ts +1 -0
  384. package/src/shadcn-ui/components/logo/logo.vue +152 -0
  385. package/src/shadcn-ui/components/pin-input/index.ts +3 -0
  386. package/src/shadcn-ui/components/pin-input/input.vue +122 -0
  387. package/src/shadcn-ui/components/pin-input/types.ts +30 -0
  388. package/src/shadcn-ui/components/popover/index.ts +1 -0
  389. package/src/shadcn-ui/components/popover/popover.vue +60 -0
  390. package/src/shadcn-ui/components/render-content/index.ts +1 -0
  391. package/src/shadcn-ui/components/render-content/render-content.vue +59 -0
  392. package/src/shadcn-ui/components/scrollbar/index.ts +1 -0
  393. package/src/shadcn-ui/components/scrollbar/scrollbar.vue +165 -0
  394. package/src/shadcn-ui/components/segmented/index.ts +3 -0
  395. package/src/shadcn-ui/components/segmented/segmented.vue +75 -0
  396. package/src/shadcn-ui/components/segmented/tabs-indicator.vue +37 -0
  397. package/src/shadcn-ui/components/segmented/types.ts +6 -0
  398. package/src/shadcn-ui/components/select/index.ts +1 -0
  399. package/src/shadcn-ui/components/select/select.vue +57 -0
  400. package/src/shadcn-ui/components/spine-text/index.ts +1 -0
  401. package/src/shadcn-ui/components/spine-text/spine-text.vue +49 -0
  402. package/src/shadcn-ui/components/spinner/index.ts +2 -0
  403. package/src/shadcn-ui/components/spinner/loading.vue +140 -0
  404. package/src/shadcn-ui/components/spinner/spinner.vue +138 -0
  405. package/src/shadcn-ui/components/table-action/action-dropdown-item.vue +116 -0
  406. package/src/shadcn-ui/components/table-action/action-item.vue +98 -0
  407. package/src/shadcn-ui/components/table-action/index.ts +3 -0
  408. package/src/shadcn-ui/components/table-action/table-action.vue +218 -0
  409. package/src/shadcn-ui/components/table-action/types.ts +75 -0
  410. package/src/shadcn-ui/components/tooltip/help-tooltip.vue +31 -0
  411. package/src/shadcn-ui/components/tooltip/index.ts +2 -0
  412. package/src/shadcn-ui/components/tooltip/tooltip.vue +44 -0
  413. package/src/shadcn-ui/components.json +15 -0
  414. package/src/shadcn-ui/index.ts +39 -0
  415. package/src/shadcn-ui/ui/accordion/Accordion.vue +16 -0
  416. package/src/shadcn-ui/ui/accordion/AccordionContent.vue +28 -0
  417. package/src/shadcn-ui/ui/accordion/AccordionItem.vue +29 -0
  418. package/src/shadcn-ui/ui/accordion/AccordionTrigger.vue +39 -0
  419. package/src/shadcn-ui/ui/accordion/index.ts +4 -0
  420. package/src/shadcn-ui/ui/alert-dialog/AlertDialog.vue +20 -0
  421. package/src/shadcn-ui/ui/alert-dialog/AlertDialogAction.vue +13 -0
  422. package/src/shadcn-ui/ui/alert-dialog/AlertDialogCancel.vue +13 -0
  423. package/src/shadcn-ui/ui/alert-dialog/AlertDialogContent.vue +101 -0
  424. package/src/shadcn-ui/ui/alert-dialog/AlertDialogDescription.vue +28 -0
  425. package/src/shadcn-ui/ui/alert-dialog/AlertDialogFooter.vue +20 -0
  426. package/src/shadcn-ui/ui/alert-dialog/AlertDialogHeader.vue +18 -0
  427. package/src/shadcn-ui/ui/alert-dialog/AlertDialogOverlay.vue +31 -0
  428. package/src/shadcn-ui/ui/alert-dialog/AlertDialogTitle.vue +26 -0
  429. package/src/shadcn-ui/ui/alert-dialog/AlertDialogTrigger.vue +13 -0
  430. package/src/shadcn-ui/ui/alert-dialog/index.ts +9 -0
  431. package/src/shadcn-ui/ui/avatar/Avatar.vue +25 -0
  432. package/src/shadcn-ui/ui/avatar/AvatarFallback.vue +31 -0
  433. package/src/shadcn-ui/ui/avatar/AvatarImage.vue +17 -0
  434. package/src/shadcn-ui/ui/avatar/index.ts +3 -0
  435. package/src/shadcn-ui/ui/badge/Badge.vue +33 -0
  436. package/src/shadcn-ui/ui/badge/badge.ts +25 -0
  437. package/src/shadcn-ui/ui/badge/index.ts +3 -0
  438. package/src/shadcn-ui/ui/breadcrumb/Breadcrumb.vue +13 -0
  439. package/src/shadcn-ui/ui/breadcrumb/BreadcrumbEllipsis.vue +25 -0
  440. package/src/shadcn-ui/ui/breadcrumb/BreadcrumbItem.vue +18 -0
  441. package/src/shadcn-ui/ui/breadcrumb/BreadcrumbLink.vue +27 -0
  442. package/src/shadcn-ui/ui/breadcrumb/BreadcrumbList.vue +23 -0
  443. package/src/shadcn-ui/ui/breadcrumb/BreadcrumbPage.vue +21 -0
  444. package/src/shadcn-ui/ui/breadcrumb/BreadcrumbSeparator.vue +24 -0
  445. package/src/shadcn-ui/ui/breadcrumb/index.ts +7 -0
  446. package/src/shadcn-ui/ui/button/Button.vue +36 -0
  447. package/src/shadcn-ui/ui/button/button.ts +35 -0
  448. package/src/shadcn-ui/ui/button/index.ts +3 -0
  449. package/src/shadcn-ui/ui/card/Card.vue +23 -0
  450. package/src/shadcn-ui/ui/card/CardAction.vue +23 -0
  451. package/src/shadcn-ui/ui/card/CardContent.vue +15 -0
  452. package/src/shadcn-ui/ui/card/CardDescription.vue +18 -0
  453. package/src/shadcn-ui/ui/card/CardFooter.vue +18 -0
  454. package/src/shadcn-ui/ui/card/CardHeader.vue +23 -0
  455. package/src/shadcn-ui/ui/card/CardTitle.vue +18 -0
  456. package/src/shadcn-ui/ui/card/index.ts +7 -0
  457. package/src/shadcn-ui/ui/checkbox/Checkbox.vue +49 -0
  458. package/src/shadcn-ui/ui/checkbox/index.ts +1 -0
  459. package/src/shadcn-ui/ui/context-menu/ContextMenu.vue +18 -0
  460. package/src/shadcn-ui/ui/context-menu/ContextMenuCheckboxItem.vue +51 -0
  461. package/src/shadcn-ui/ui/context-menu/ContextMenuContent.vue +44 -0
  462. package/src/shadcn-ui/ui/context-menu/ContextMenuGroup.vue +13 -0
  463. package/src/shadcn-ui/ui/context-menu/ContextMenuItem.vue +45 -0
  464. package/src/shadcn-ui/ui/context-menu/ContextMenuLabel.vue +32 -0
  465. package/src/shadcn-ui/ui/context-menu/ContextMenuPortal.vue +13 -0
  466. package/src/shadcn-ui/ui/context-menu/ContextMenuRadioGroup.vue +22 -0
  467. package/src/shadcn-ui/ui/context-menu/ContextMenuRadioItem.vue +51 -0
  468. package/src/shadcn-ui/ui/context-menu/ContextMenuSeparator.vue +24 -0
  469. package/src/shadcn-ui/ui/context-menu/ContextMenuShortcut.vue +20 -0
  470. package/src/shadcn-ui/ui/context-menu/ContextMenuSub.vue +16 -0
  471. package/src/shadcn-ui/ui/context-menu/ContextMenuSubContent.vue +37 -0
  472. package/src/shadcn-ui/ui/context-menu/ContextMenuSubTrigger.vue +39 -0
  473. package/src/shadcn-ui/ui/context-menu/ContextMenuTrigger.vue +15 -0
  474. package/src/shadcn-ui/ui/context-menu/index.ts +14 -0
  475. package/src/shadcn-ui/ui/dialog/Dialog.vue +16 -0
  476. package/src/shadcn-ui/ui/dialog/DialogClose.vue +13 -0
  477. package/src/shadcn-ui/ui/dialog/DialogContent.vue +149 -0
  478. package/src/shadcn-ui/ui/dialog/DialogDescription.vue +28 -0
  479. package/src/shadcn-ui/ui/dialog/DialogFooter.vue +33 -0
  480. package/src/shadcn-ui/ui/dialog/DialogHeader.vue +18 -0
  481. package/src/shadcn-ui/ui/dialog/DialogOverlay.vue +34 -0
  482. package/src/shadcn-ui/ui/dialog/DialogScrollContent.vue +69 -0
  483. package/src/shadcn-ui/ui/dialog/DialogTitle.vue +28 -0
  484. package/src/shadcn-ui/ui/dialog/DialogTrigger.vue +13 -0
  485. package/src/shadcn-ui/ui/dialog/index.ts +10 -0
  486. package/src/shadcn-ui/ui/dialog/use-dialog-state-events.ts +84 -0
  487. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenu.vue +20 -0
  488. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +51 -0
  489. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuContent.vue +50 -0
  490. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuGroup.vue +13 -0
  491. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuItem.vue +44 -0
  492. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuLabel.vue +30 -0
  493. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuRadioGroup.vue +22 -0
  494. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuRadioItem.vue +52 -0
  495. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuSeparator.vue +26 -0
  496. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuShortcut.vue +20 -0
  497. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuSub.vue +20 -0
  498. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuSubContent.vue +37 -0
  499. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuSubTrigger.vue +38 -0
  500. package/src/shadcn-ui/ui/dropdown-menu/DropdownMenuTrigger.vue +18 -0
  501. package/src/shadcn-ui/ui/dropdown-menu/index.ts +16 -0
  502. package/src/shadcn-ui/ui/form/FormControl.vue +20 -0
  503. package/src/shadcn-ui/ui/form/FormDescription.vue +23 -0
  504. package/src/shadcn-ui/ui/form/FormField.vue +35 -0
  505. package/src/shadcn-ui/ui/form/FormItem.vue +24 -0
  506. package/src/shadcn-ui/ui/form/FormLabel.vue +25 -0
  507. package/src/shadcn-ui/ui/form/FormMessage.vue +24 -0
  508. package/src/shadcn-ui/ui/form/index.ts +10 -0
  509. package/src/shadcn-ui/ui/form/injectionKeys.ts +16 -0
  510. package/src/shadcn-ui/ui/form/useFormField.ts +35 -0
  511. package/src/shadcn-ui/ui/hover-card/HoverCard.vue +16 -0
  512. package/src/shadcn-ui/ui/hover-card/HoverCardContent.vue +42 -0
  513. package/src/shadcn-ui/ui/hover-card/HoverCardTrigger.vue +13 -0
  514. package/src/shadcn-ui/ui/hover-card/index.ts +3 -0
  515. package/src/shadcn-ui/ui/index.ts +32 -0
  516. package/src/shadcn-ui/ui/input/Input.vue +54 -0
  517. package/src/shadcn-ui/ui/input/index.ts +1 -0
  518. package/src/shadcn-ui/ui/label/Label.vue +29 -0
  519. package/src/shadcn-ui/ui/label/index.ts +1 -0
  520. package/src/shadcn-ui/ui/number-field/NumberField.vue +29 -0
  521. package/src/shadcn-ui/ui/number-field/NumberFieldContent.vue +22 -0
  522. package/src/shadcn-ui/ui/number-field/NumberFieldDecrement.vue +36 -0
  523. package/src/shadcn-ui/ui/number-field/NumberFieldIncrement.vue +36 -0
  524. package/src/shadcn-ui/ui/number-field/NumberFieldInput.vue +23 -0
  525. package/src/shadcn-ui/ui/number-field/index.ts +5 -0
  526. package/src/shadcn-ui/ui/pagination/Pagination.vue +31 -0
  527. package/src/shadcn-ui/ui/pagination/PaginationContent.vue +27 -0
  528. package/src/shadcn-ui/ui/pagination/PaginationEllipsis.vue +29 -0
  529. package/src/shadcn-ui/ui/pagination/PaginationFirst.vue +50 -0
  530. package/src/shadcn-ui/ui/pagination/PaginationItem.vue +47 -0
  531. package/src/shadcn-ui/ui/pagination/PaginationLast.vue +50 -0
  532. package/src/shadcn-ui/ui/pagination/PaginationNext.vue +50 -0
  533. package/src/shadcn-ui/ui/pagination/PaginationPrevious.vue +50 -0
  534. package/src/shadcn-ui/ui/pagination/index.ts +8 -0
  535. package/src/shadcn-ui/ui/pin-input/PinInput.vue +38 -0
  536. package/src/shadcn-ui/ui/pin-input/PinInputGroup.vue +26 -0
  537. package/src/shadcn-ui/ui/pin-input/PinInputSeparator.vue +17 -0
  538. package/src/shadcn-ui/ui/pin-input/PinInputSlot.vue +31 -0
  539. package/src/shadcn-ui/ui/pin-input/index.ts +4 -0
  540. package/src/shadcn-ui/ui/popover/Popover.vue +16 -0
  541. package/src/shadcn-ui/ui/popover/PopoverAnchor.vue +13 -0
  542. package/src/shadcn-ui/ui/popover/PopoverContent.vue +44 -0
  543. package/src/shadcn-ui/ui/popover/PopoverTrigger.vue +13 -0
  544. package/src/shadcn-ui/ui/popover/index.ts +4 -0
  545. package/src/shadcn-ui/ui/progress/Progress.vue +58 -0
  546. package/src/shadcn-ui/ui/progress/index.ts +1 -0
  547. package/src/shadcn-ui/ui/radio-group/RadioGroup.vue +30 -0
  548. package/src/shadcn-ui/ui/radio-group/RadioGroupItem.vue +43 -0
  549. package/src/shadcn-ui/ui/radio-group/index.ts +2 -0
  550. package/src/shadcn-ui/ui/resizable/ResizableHandle.vue +48 -0
  551. package/src/shadcn-ui/ui/resizable/ResizablePanel.vue +32 -0
  552. package/src/shadcn-ui/ui/resizable/ResizablePanelGroup.vue +32 -0
  553. package/src/shadcn-ui/ui/resizable/index.ts +3 -0
  554. package/src/shadcn-ui/ui/scroll-area/ScrollArea.vue +40 -0
  555. package/src/shadcn-ui/ui/scroll-area/ScrollBar.vue +41 -0
  556. package/src/shadcn-ui/ui/scroll-area/index.ts +2 -0
  557. package/src/shadcn-ui/ui/select/Select.vue +16 -0
  558. package/src/shadcn-ui/ui/select/SelectContent.vue +65 -0
  559. package/src/shadcn-ui/ui/select/SelectGroup.vue +13 -0
  560. package/src/shadcn-ui/ui/select/SelectItem.vue +49 -0
  561. package/src/shadcn-ui/ui/select/SelectItemText.vue +13 -0
  562. package/src/shadcn-ui/ui/select/SelectLabel.vue +22 -0
  563. package/src/shadcn-ui/ui/select/SelectScrollDownButton.vue +33 -0
  564. package/src/shadcn-ui/ui/select/SelectScrollUpButton.vue +33 -0
  565. package/src/shadcn-ui/ui/select/SelectSeparator.vue +24 -0
  566. package/src/shadcn-ui/ui/select/SelectTrigger.vue +43 -0
  567. package/src/shadcn-ui/ui/select/SelectValue.vue +13 -0
  568. package/src/shadcn-ui/ui/select/index.ts +11 -0
  569. package/src/shadcn-ui/ui/separator/Separator.vue +33 -0
  570. package/src/shadcn-ui/ui/separator/index.ts +1 -0
  571. package/src/shadcn-ui/ui/sheet/Sheet.vue +16 -0
  572. package/src/shadcn-ui/ui/sheet/SheetClose.vue +13 -0
  573. package/src/shadcn-ui/ui/sheet/SheetContent.vue +110 -0
  574. package/src/shadcn-ui/ui/sheet/SheetDescription.vue +26 -0
  575. package/src/shadcn-ui/ui/sheet/SheetFooter.vue +16 -0
  576. package/src/shadcn-ui/ui/sheet/SheetHeader.vue +16 -0
  577. package/src/shadcn-ui/ui/sheet/SheetOverlay.vue +11 -0
  578. package/src/shadcn-ui/ui/sheet/SheetTitle.vue +26 -0
  579. package/src/shadcn-ui/ui/sheet/SheetTrigger.vue +13 -0
  580. package/src/shadcn-ui/ui/sheet/index.ts +10 -0
  581. package/src/shadcn-ui/ui/sheet/sheet.ts +24 -0
  582. package/src/shadcn-ui/ui/switch/Switch.vue +45 -0
  583. package/src/shadcn-ui/ui/switch/index.ts +1 -0
  584. package/src/shadcn-ui/ui/tabs/Tabs.vue +29 -0
  585. package/src/shadcn-ui/ui/tabs/TabsContent.vue +26 -0
  586. package/src/shadcn-ui/ui/tabs/TabsList.vue +31 -0
  587. package/src/shadcn-ui/ui/tabs/TabsTrigger.vue +33 -0
  588. package/src/shadcn-ui/ui/tabs/index.ts +5 -0
  589. package/src/shadcn-ui/ui/textarea/Textarea.vue +35 -0
  590. package/src/shadcn-ui/ui/textarea/index.ts +1 -0
  591. package/src/shadcn-ui/ui/toggle/Toggle.vue +45 -0
  592. package/src/shadcn-ui/ui/toggle/index.ts +2 -0
  593. package/src/shadcn-ui/ui/toggle/toggle.ts +27 -0
  594. package/src/shadcn-ui/ui/toggle-group/ToggleGroup.vue +64 -0
  595. package/src/shadcn-ui/ui/toggle-group/ToggleGroupItem.vue +56 -0
  596. package/src/shadcn-ui/ui/toggle-group/index.ts +2 -0
  597. package/src/shadcn-ui/ui/tooltip/Tooltip.vue +16 -0
  598. package/src/shadcn-ui/ui/tooltip/TooltipContent.vue +55 -0
  599. package/src/shadcn-ui/ui/tooltip/TooltipProvider.vue +13 -0
  600. package/src/shadcn-ui/ui/tooltip/TooltipTrigger.vue +13 -0
  601. package/src/shadcn-ui/ui/tooltip/index.ts +4 -0
  602. package/src/shadcn-ui/ui/tree/index.ts +4 -0
  603. package/src/shadcn-ui/ui/tree/tree.vue +689 -0
  604. package/src/shadcn-ui/ui/tree/types.ts +70 -0
  605. package/src/styles/index.css +9 -0
  606. package/src/tabs-ui/components/index.ts +2 -0
  607. package/src/tabs-ui/components/tabs/tabs.vue +150 -0
  608. package/src/tabs-ui/components/tabs-chrome/tabs.vue +211 -0
  609. package/src/tabs-ui/components/widgets/index.ts +3 -0
  610. package/src/tabs-ui/components/widgets/tool-more.vue +18 -0
  611. package/src/tabs-ui/components/widgets/tool-refresh.vue +18 -0
  612. package/src/tabs-ui/components/widgets/tool-screen.vue +19 -0
  613. package/src/tabs-ui/index.ts +3 -0
  614. package/src/tabs-ui/tabs-view.vue +106 -0
  615. package/src/tabs-ui/types.ts +73 -0
  616. package/src/tabs-ui/use-tabs-drag.ts +129 -0
  617. package/src/tabs-ui/use-tabs-view-scroll.ts +202 -0
  618. package/src/types/shims.d.ts +2 -0
@@ -0,0 +1,1054 @@
1
+ import type { ZodType } from 'zod';
2
+
3
+ import type { Component, HtmlHTMLAttributes, Ref, UnwrapNestedRefs } from 'vue';
4
+
5
+ import type { VbenButtonProps } from '@melt-js/comps-vben/shadcn-ui';
6
+ import type { ClassType, MaybeComputedRef } from '@melt-js/libs-vben/typings';
7
+
8
+ import type { FormApi } from './form-api';
9
+ import type { useFormLabelWidth } from './form-render/utils';
10
+
11
+ export type FormLabelWidthContext = UnwrapNestedRefs<
12
+ ReturnType<typeof useFormLabelWidth>
13
+ >;
14
+
15
+ export type FormValues = Record<string, any>;
16
+
17
+ export type FormValuePatch<T> = T extends
18
+ | ((...args: any[]) => unknown)
19
+ | Date
20
+ | readonly unknown[]
21
+ ? T
22
+ : T extends object
23
+ ? { [K in keyof T]?: FormValuePatch<T[K]> }
24
+ : T;
25
+
26
+ export interface FormCodec<
27
+ TFormValues extends FormValues = FormValues,
28
+ TSubmitValues extends FormValues = TFormValues,
29
+ > {
30
+ /** 将提交值转换为表单组件值。 */
31
+ decode: (values: Readonly<TSubmitValues>) => TFormValues;
32
+ /** 将表单组件值转换为提交值。 */
33
+ encode: (values: Readonly<TFormValues>) => TSubmitValues;
34
+ }
35
+
36
+ export type FormFieldName<TValues extends FormValues = FormValues> =
37
+ | Extract<keyof TValues, string>
38
+ | (string & {});
39
+
40
+ export type FormFieldValue<
41
+ TValues extends FormValues,
42
+ TFieldName extends string,
43
+ > = TFieldName extends keyof TValues ? TValues[TFieldName] : unknown;
44
+
45
+ export type FormLayout = 'horizontal' | 'inline' | 'vertical';
46
+
47
+ export type BaseFormComponentType =
48
+ | 'DefaultButton'
49
+ | 'PrimaryButton'
50
+ | 'VbenCheckbox'
51
+ | 'VbenFormFieldArray'
52
+ | 'VbenInput'
53
+ | 'VbenInputPassword'
54
+ | 'VbenPinInput'
55
+ | 'VbenSelect'
56
+ | (string & {});
57
+
58
+ type Breakpoints = '2xl:' | '3xl:' | '' | 'lg:' | 'md:' | 'sm:' | 'xl:';
59
+
60
+ type GridCols = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13;
61
+
62
+ export type WrapperClassType =
63
+ | `${Breakpoints}grid-cols-${GridCols}`
64
+ | (string & {});
65
+
66
+ export type FormItemClassType =
67
+ | `${Breakpoints}cols-end-${'auto' | GridCols}`
68
+ | `${Breakpoints}cols-span-${'auto' | 'full' | GridCols}`
69
+ | `${Breakpoints}cols-start-${'auto' | GridCols}`
70
+ | (string & {})
71
+ | WrapperClassType;
72
+
73
+ export interface FormFieldOptions {
74
+ asyncDebounceMs?: number;
75
+ validateOn?: readonly FormValidationTrigger[];
76
+ }
77
+
78
+ export type FormValidationTrigger = 'blur' | 'change';
79
+
80
+ export interface FormShape {
81
+ /** 默认值 */
82
+ default?: any;
83
+ /** 字段名 */
84
+ fieldName: string;
85
+ /** 是否必填 */
86
+ required?: boolean;
87
+ rules?: ZodType;
88
+ }
89
+
90
+ export interface FormRuntimeField<TValue = unknown> {
91
+ handleBlur: () => void;
92
+ handleChange: (value: TValue) => void;
93
+ state: {
94
+ meta: {
95
+ errors: unknown[];
96
+ isDirty: boolean;
97
+ isTouched: boolean;
98
+ isValid: boolean;
99
+ };
100
+ value: TValue;
101
+ };
102
+ }
103
+
104
+ export interface FormComponentField<
105
+ TValue = unknown,
106
+ TFieldName extends string = string,
107
+ > {
108
+ modelValue: TValue;
109
+ name: TFieldName;
110
+ onBlur: () => void;
111
+ onChange: (value: TValue) => void;
112
+ onInput: (value: TValue) => void;
113
+ 'onUpdate:modelValue': (value: TValue) => void;
114
+ }
115
+
116
+ export type MaybeComponentPropKey =
117
+ | 'options'
118
+ | 'placeholder'
119
+ | 'title'
120
+ | keyof HtmlHTMLAttributes
121
+ | (string & {});
122
+
123
+ export type MaybeComponentProps = { [K in MaybeComponentPropKey]?: any };
124
+
125
+ export interface FormMeta {
126
+ dirty: boolean;
127
+ submitting: boolean;
128
+ valid: boolean;
129
+ validating: boolean;
130
+ }
131
+
132
+ export interface FormRuntimeState<TValues extends FormValues = FormValues> {
133
+ errors: Record<string, string>;
134
+ meta: FormMeta;
135
+ values: TValues;
136
+ }
137
+
138
+ export interface FormValidationResult {
139
+ errors: Record<string, string>;
140
+ valid: boolean;
141
+ }
142
+
143
+ export interface FormValueSnapshot<
144
+ TFormValues extends FormValues = FormValues,
145
+ TSubmitValues extends FormValues = TFormValues,
146
+ > {
147
+ rawValues: Readonly<TFormValues>;
148
+ values: TSubmitValues;
149
+ }
150
+
151
+ export interface FormResetState<TValues extends FormValues = FormValues> {
152
+ values?: Partial<TValues>;
153
+ }
154
+
155
+ export interface FormResetOptions {
156
+ force?: boolean;
157
+ keepDefaultValues?: boolean;
158
+ }
159
+
160
+ export interface FormContextApi<TValues extends FormValues = FormValues> {
161
+ clearValidation: (
162
+ fieldNames?: FormFieldName<TValues> | FormFieldName<TValues>[],
163
+ ) => void;
164
+ readonly errors: Record<string, string>;
165
+ readonly fieldComponent: Component;
166
+ getFieldError: (fieldName: string) => string | undefined;
167
+ getFieldValue: <TFieldName extends FormFieldName<TValues>>(
168
+ fieldName: TFieldName,
169
+ ) => FormFieldValue<TValues, TFieldName>;
170
+ handleSubmit: (
171
+ callback?: (values: TValues) => Promise<void> | void,
172
+ ) => (event?: Event) => Promise<void>;
173
+ isFieldValid: (fieldName: string) => boolean;
174
+ readonly meta: FormMeta;
175
+ pushFieldValue: (fieldName: string, value: any) => void;
176
+ removeFieldValue: (fieldName: string, index: number) => Promise<void>;
177
+ reset: (
178
+ state?: FormResetState<TValues>,
179
+ options?: FormResetOptions,
180
+ ) => Promise<void>;
181
+ /** @deprecated Use `reset` instead. */
182
+ resetForm: (
183
+ state?: FormResetState<TValues>,
184
+ options?: FormResetOptions,
185
+ ) => Promise<void>;
186
+ setFieldError: (fieldName: string, error?: string) => void;
187
+ setFieldValue: <TFieldName extends FormFieldName<TValues>>(
188
+ fieldName: TFieldName,
189
+ value: FormFieldValue<TValues, NoInfer<TFieldName>>,
190
+ shouldValidate?: boolean,
191
+ ) => Promise<void>;
192
+ setValues: (
193
+ values: Partial<TValues>,
194
+ shouldValidate?: boolean,
195
+ ) => Promise<void>;
196
+ submit: () => Promise<void>;
197
+ /** @deprecated Use `submit` instead. */
198
+ submitForm: () => Promise<void>;
199
+ useFieldError: (fieldName: string) => Readonly<Ref<string | undefined>>;
200
+ useFieldValue: <TFieldName extends FormFieldName<TValues>>(
201
+ fieldName: TFieldName,
202
+ ) => Readonly<Ref<FormFieldValue<TValues, TFieldName>>>;
203
+ useFieldValues: <TFieldName extends FormFieldName<TValues>>(
204
+ fieldNames: readonly TFieldName[],
205
+ ) => Readonly<Ref<FormFieldValue<TValues, TFieldName>[]>>;
206
+ useSelector: <T>(
207
+ selector: (state: FormRuntimeState<TValues>) => T,
208
+ ) => Readonly<Ref<T>>;
209
+ useValues: () => Readonly<Ref<TValues>>;
210
+ validate: () => Promise<FormValidationResult>;
211
+ validateField: (fieldName: string) => Promise<FormValidationResult>;
212
+ readonly values: TValues;
213
+ }
214
+
215
+ /** @deprecated Use `FormContextApi` instead. */
216
+ export type FormActions<TValues extends FormValues = FormValues> =
217
+ FormContextApi<TValues>;
218
+
219
+ type ReservedFormSlotName =
220
+ | 'default'
221
+ | 'expand-after'
222
+ | 'expand-before'
223
+ | 'reset-before'
224
+ | 'submit-before';
225
+
226
+ type KnownFormFieldName<TValues extends FormValues> =
227
+ string extends Extract<keyof TValues, string>
228
+ ? never
229
+ : Exclude<Extract<keyof TValues, string>, ReservedFormSlotName>;
230
+
231
+ export interface VbenFormActionSlotProps<
232
+ TValues extends FormValues = FormValues,
233
+ T extends BaseFormComponentType = BaseFormComponentType,
234
+ P extends Record<string, any> = Record<string, never>,
235
+ TSubmitValues extends FormValues = TValues,
236
+ > {
237
+ formApi: ExtendedFormApi<TValues, T, P, TSubmitValues>;
238
+ values: TValues;
239
+ }
240
+
241
+ export interface VbenFormDefaultSlotProps<
242
+ TValues extends FormValues = FormValues,
243
+ T extends BaseFormComponentType = BaseFormComponentType,
244
+ P extends Record<string, any> = Record<string, never>,
245
+ TSubmitValues extends FormValues = TValues,
246
+ > extends VbenFormActionSlotProps<TValues, T, P, TSubmitValues> {
247
+ shapes: FormShape[];
248
+ }
249
+
250
+ export interface VbenFormFieldSlotProps<
251
+ TValues extends FormValues = FormValues,
252
+ TFieldName extends FormFieldName<TValues> = FormFieldName<TValues>,
253
+ T extends BaseFormComponentType = BaseFormComponentType,
254
+ P extends Record<string, any> = Record<string, never>,
255
+ TSubmitValues extends FormValues = TValues,
256
+ > extends VbenFormActionSlotProps<TValues, T, P, TSubmitValues> {
257
+ componentField: FormComponentField<
258
+ FormFieldValue<TValues, TFieldName>,
259
+ TFieldName
260
+ >;
261
+ componentProps: VbenFormResolvedComponentProps<
262
+ FormFieldValue<TValues, TFieldName>,
263
+ TFieldName
264
+ >;
265
+ disabled: boolean;
266
+ field: FormRuntimeField<FormFieldValue<TValues, TFieldName>>;
267
+ isInValid: boolean;
268
+ modelValue: FormFieldValue<TValues, TFieldName>;
269
+ name: TFieldName;
270
+ }
271
+
272
+ /**
273
+ * 表单值带索引签名时字段值解析不出具体类型(`unknown`),此处放宽成 `any`:
274
+ * 否则 `v-bind="slotProps.componentProps"` 喂不进任何声明了具体 model 类型的组件。
275
+ */
276
+ type LooseFieldValue<TValue> = unknown extends TValue ? any : TValue;
277
+
278
+ export type VbenFormResolvedComponentProps<
279
+ TValue = unknown,
280
+ TFieldName extends string = string,
281
+ > = MaybeComponentProps & {
282
+ disabled: boolean;
283
+ modelValue?: LooseFieldValue<TValue>;
284
+ name: TFieldName;
285
+ 'onUpdate:modelValue'?: (value: LooseFieldValue<TValue>) => void;
286
+ };
287
+
288
+ type VbenFormFieldSlots<
289
+ TValues extends FormValues,
290
+ T extends BaseFormComponentType,
291
+ P extends Record<string, any>,
292
+ TSubmitValues extends FormValues,
293
+ > =
294
+ string extends Extract<keyof TValues, string>
295
+ ? Record<
296
+ string,
297
+ | ((
298
+ props: VbenFormFieldSlotProps<
299
+ TValues,
300
+ FormFieldName<TValues>,
301
+ T,
302
+ P,
303
+ TSubmitValues
304
+ >,
305
+ ) => any)
306
+ | undefined
307
+ >
308
+ : {
309
+ [TFieldName in KnownFormFieldName<TValues>]?: (
310
+ props: VbenFormFieldSlotProps<
311
+ TValues,
312
+ TFieldName,
313
+ T,
314
+ P,
315
+ TSubmitValues
316
+ >,
317
+ ) => any;
318
+ };
319
+
320
+ export type VbenFormSlots<
321
+ TValues extends FormValues = FormValues,
322
+ T extends BaseFormComponentType = BaseFormComponentType,
323
+ P extends Record<string, any> = Record<string, never>,
324
+ TSubmitValues extends FormValues = TValues,
325
+ > = VbenFormFieldSlots<TValues, T, P, TSubmitValues> & {
326
+ default?: (
327
+ props: VbenFormDefaultSlotProps<TValues, T, P, TSubmitValues>,
328
+ ) => any;
329
+ 'expand-after'?: (
330
+ props: VbenFormActionSlotProps<TValues, T, P, TSubmitValues>,
331
+ ) => any;
332
+ 'expand-before'?: (
333
+ props: VbenFormActionSlotProps<TValues, T, P, TSubmitValues>,
334
+ ) => any;
335
+ 'reset-before'?: (
336
+ props: VbenFormActionSlotProps<TValues, T, P, TSubmitValues>,
337
+ ) => any;
338
+ 'submit-before'?: (
339
+ props: VbenFormActionSlotProps<TValues, T, P, TSubmitValues>,
340
+ ) => any;
341
+ };
342
+
343
+ export type VbenFormComponent<
344
+ TValues extends FormValues = FormValues,
345
+ T extends BaseFormComponentType = BaseFormComponentType,
346
+ P extends Record<string, any> = Record<string, never>,
347
+ TSubmitValues extends FormValues = TValues,
348
+ > = new () => {
349
+ $props: VbenFormProps<T, P, TValues, TSubmitValues>;
350
+ $slots: VbenFormSlots<TValues, T, P, TSubmitValues>;
351
+ };
352
+
353
+ export interface FormSchemaContext<TValues extends FormValues = FormValues> {
354
+ /** 数组字段名,例如 contacts */
355
+ arrayField?: string;
356
+ /** 当前真实字段名,例如 contacts[0].name */
357
+ fieldName?: string;
358
+ /** 原始 schema 字段名,例如 name */
359
+ originalFieldName?: string;
360
+ /** 表单完整值 */
361
+ rootValues?: TValues;
362
+ /** 当前行数据 */
363
+ row?: Record<string, any>;
364
+ /** 当前行索引 */
365
+ rowIndex?: number;
366
+ /** 当前行路径,例如 contacts[0] */
367
+ rowPath?: string;
368
+ }
369
+
370
+ export type CustomRenderType = (() => Component | string) | string;
371
+
372
+ // 动态渲染参数
373
+ export type CustomParamsRenderType<TValues extends FormValues = FormValues> =
374
+ | ((ctx: FormSchemaContext<TValues>) => Component | string)
375
+ | string;
376
+
377
+ export type FormSchemaRuleType =
378
+ | 'required'
379
+ | 'selectRequired'
380
+ | null
381
+ | (string & {})
382
+ | ZodType;
383
+
384
+ type FormItemDependenciesCondition<
385
+ TValues extends FormValues,
386
+ // 返回值放宽为 unknown:存量 if/show/disabled/required 回调可能返回
387
+ // 任意 truthy/falsy 值(运行时强制布尔化,对齐上游语义),只声明
388
+ // boolean 会让等价的 JS 用法在 TS 下误报——trigger 字段已用同一手法
389
+ // 放宽。
390
+ TResult = unknown,
391
+ > = (
392
+ value: Partial<TValues>,
393
+ actions: FormActions<TValues>,
394
+ controller: ExtendedFormApi<TValues>, // 在 dependencies 里提供访问extendApi的能力
395
+ ctx?: FormSchemaContext<TValues>,
396
+ ) => TResult;
397
+
398
+ type FormItemDependenciesConditionWithRules<TValues extends FormValues> = (
399
+ value: Partial<TValues>,
400
+ actions: FormActions<TValues>,
401
+ controller: ExtendedFormApi<TValues>, // 在 dependencies 里提供访问extendApi的能力
402
+ ctx?: FormSchemaContext<TValues>,
403
+ ) => FormSchemaRuleType | PromiseLike<FormSchemaRuleType>;
404
+
405
+ type FormItemDependenciesConditionWithProps<TValues extends FormValues> = (
406
+ value: Partial<TValues>,
407
+ actions: FormActions<TValues>,
408
+ controller: ExtendedFormApi<TValues>, // 在 dependencies 里提供访问extendApi的能力
409
+ ctx?: FormSchemaContext<TValues>,
410
+ ) => MaybeComponentProps | PromiseLike<MaybeComponentProps>;
411
+
412
+ interface FormItemDependenciesBase {
413
+ /**
414
+ * 触发字段
415
+ */
416
+ triggerFields: string[];
417
+ }
418
+
419
+ export interface FormDependenciesResolveContext<
420
+ TValues extends FormValues = FormValues,
421
+ > {
422
+ actions: FormActions<TValues>;
423
+ controller: ExtendedFormApi<TValues>;
424
+ schema: FormSchemaContext<TValues>;
425
+ values: Readonly<TValues>;
426
+ }
427
+
428
+ export interface FormDependenciesResolvedState {
429
+ componentProps?: MaybeComponentProps;
430
+ disabled?: boolean;
431
+ help?: CustomRenderType;
432
+ if?: boolean;
433
+ renderComponentContent?: Record<string, any>;
434
+ required?: boolean;
435
+ rules?: FormSchemaRuleType;
436
+ show?: boolean;
437
+ }
438
+
439
+ export interface FormItemDependenciesLegacy<
440
+ TValues extends FormValues = FormValues,
441
+ > extends FormItemDependenciesBase {
442
+ /**
443
+ * 组件参数
444
+ * @returns 组件参数
445
+ * @deprecated Use `dependencies.resolve` instead.
446
+ */
447
+ componentProps?: FormItemDependenciesConditionWithProps<TValues>;
448
+ /**
449
+ * 是否禁用
450
+ * @returns 是否禁用
451
+ * @deprecated Use `dependencies.resolve` instead.
452
+ */
453
+ disabled?: boolean | FormItemDependenciesCondition<TValues>;
454
+ /**
455
+ * 是否渲染(删除dom)
456
+ * @returns 是否渲染
457
+ * @deprecated Use `dependencies.resolve` instead.
458
+ */
459
+ if?: boolean | FormItemDependenciesCondition<TValues>;
460
+ /**
461
+ * 是否必填
462
+ * @returns 是否必填
463
+ * @deprecated Use `dependencies.resolve` instead.
464
+ */
465
+ required?: FormItemDependenciesCondition<TValues>;
466
+ resolve?: never;
467
+ /**
468
+ * 字段规则
469
+ * @deprecated Use `dependencies.resolve` instead.
470
+ */
471
+ rules?: FormItemDependenciesConditionWithRules<TValues>;
472
+ /**
473
+ * 是否隐藏(Css)
474
+ * @returns 是否隐藏
475
+ * @deprecated Use `dependencies.resolve` instead.
476
+ */
477
+ show?: boolean | FormItemDependenciesCondition<TValues>;
478
+ /**
479
+ * 任意触发都会执行
480
+ * @deprecated Use `dependencies.resolve` instead.
481
+ */
482
+ // 返回类型放宽为 unknown:存量 trigger 回调常为 async(返回 Promise),
483
+ // 调用方需要 await 它,异常才能在当前求值上下文被捕获(上游 #7830)。
484
+ trigger?: FormItemDependenciesCondition<TValues>;
485
+ }
486
+
487
+ export interface FormItemDependenciesResolve<
488
+ TValues extends FormValues = FormValues,
489
+ > extends FormItemDependenciesBase {
490
+ componentProps?: never;
491
+ disabled?: never;
492
+ if?: never;
493
+ required?: never;
494
+ resolve: (
495
+ context: FormDependenciesResolveContext<TValues>,
496
+ ) =>
497
+ | FormDependenciesResolvedState
498
+ | PromiseLike<FormDependenciesResolvedState | undefined>
499
+ | undefined;
500
+ rules?: never;
501
+ show?: never;
502
+ trigger?: never;
503
+ }
504
+
505
+ export type FormItemDependencies<TValues extends FormValues = FormValues> =
506
+ | FormItemDependenciesLegacy<TValues>
507
+ | FormItemDependenciesResolve<TValues>;
508
+
509
+ type ComponentProps<TValues extends FormValues = FormValues> =
510
+ | ((ctx: FormSchemaContext<TValues>) => MaybeComponentProps)
511
+ | MaybeComponentProps;
512
+
513
+ export interface FormCommonConfig<TValues extends FormValues = FormValues> {
514
+ /**
515
+ * 是否启用 change 事件兼容回退。
516
+ * 仅当组件不发送 update:*、只发送 change 时启用。
517
+ * @default false
518
+ */
519
+ changeEventFallback?: boolean;
520
+ /**
521
+ * 是否可折叠的
522
+ * @default false
523
+ */
524
+ collapsible?: boolean;
525
+ /**
526
+ * 在Label后显示一个冒号
527
+ */
528
+ colon?: boolean;
529
+ /**
530
+ * 所有表单项的props
531
+ */
532
+ componentProps?: ComponentProps<TValues>;
533
+ /**
534
+ * 所有表单项的控件样式
535
+ */
536
+ controlClass?: string;
537
+ /**
538
+ * 默认折叠
539
+ * @default false
540
+ */
541
+ defaultCollapsed?: boolean;
542
+ /**
543
+ * 所有表单项的禁用状态
544
+ * @default false
545
+ */
546
+ disabled?: boolean;
547
+ /**
548
+ * 所有表单项的空状态值,默认都是undefined,naive-ui的空状态值是null
549
+ */
550
+ emptyStateValue?: null | undefined;
551
+ /**
552
+ * 所有表单项的控件样式
553
+ * @default {}
554
+ */
555
+ formFieldProps?: FormFieldOptions;
556
+ /**
557
+ * 所有表单项的栅格布局,支持函数形式
558
+ * @default ""
559
+ */
560
+ formItemClass?: (() => string) | string;
561
+ /**
562
+ * 隐藏所有表单项label
563
+ * @default false
564
+ */
565
+ hideLabel?: boolean;
566
+ /**
567
+ * 是否隐藏必填标记
568
+ * @default false
569
+ */
570
+ hideRequiredMark?: boolean;
571
+ /**
572
+ * 所有表单项的label样式
573
+ * @default ""
574
+ */
575
+ labelClass?: string;
576
+ /**
577
+ * 所有表单项的label宽度
578
+ * 设置为 `auto` 时,水平布局下会按当前表单可见 label 的最大宽度自动对齐
579
+ */
580
+ labelWidth?: number | string;
581
+ /**
582
+ * 所有表单项的model属性名
583
+ * @default "modelValue"
584
+ */
585
+ modelPropName?: string;
586
+ /**
587
+ * 所有表单项的wrapper样式
588
+ */
589
+ wrapperClass?: string;
590
+ }
591
+
592
+ type RenderComponentContentType<TValues extends FormValues = FormValues> = (
593
+ ctx: FormSchemaContext<TValues>,
594
+ ) => Record<string, any>;
595
+
596
+ type MappedComponentProps<P, TValues extends FormValues = FormValues> =
597
+ | ((ctx: FormSchemaContext<TValues>) => P & Record<string, any>)
598
+ | (P & Record<string, any>);
599
+
600
+ /**
601
+ * 格式化 `getValues()` 输出中的当前字段值。
602
+ * - 返回 `undefined`:保留当前字段已被移除的状态,通常配合 `setValue(key, nextValue)`
603
+ * 把一个字段拆分写入到其他字段,例如 `startTime` / `endTime`
604
+ * - 返回其他值:会将当前字段恢复/写回为该返回值
605
+ * - `setValue` 回调签名为 `(key, nextValue) => void`
606
+ * @deprecated Use the form-level `codec` instead.
607
+ */
608
+ export type FormValueFormat<TValues extends FormValues = FormValues> = (
609
+ value: any,
610
+ setValue: (fieldName: string, value: any) => void,
611
+ values: TValues,
612
+ ctx?: FormSchemaContext<TValues>,
613
+ ) => any;
614
+
615
+ interface FormSchemaBody<TValues extends FormValues = FormValues> extends Omit<
616
+ FormCommonConfig<TValues>,
617
+ 'componentProps'
618
+ > {
619
+ /** 默认值 */
620
+ defaultValue?: any;
621
+ /** 依赖 */
622
+ dependencies?: FormItemDependencies<TValues>;
623
+ /** 描述 */
624
+ description?: CustomRenderType;
625
+ /** 字段名 */
626
+ fieldName: string;
627
+ /** 帮助信息 */
628
+ help?: CustomParamsRenderType<TValues>;
629
+ /** 是否隐藏表单项 */
630
+ hide?: boolean;
631
+ /** 表单项 */
632
+ label?: CustomRenderType;
633
+ // 自定义组件内部渲染
634
+ renderComponentContent?: RenderComponentContentType<TValues>;
635
+ /** 字段规则 */
636
+ rules?: FormSchemaRuleType;
637
+ /** 后缀 */
638
+ suffix?: CustomRenderType;
639
+ /**
640
+ * 获取表单值时格式化当前字段。
641
+ * - 返回值不为 `undefined` 时,会回写到当前 fieldName
642
+ * - 返回值为 `undefined` 时,可通过 setValue 写入一个或多个目标字段
643
+ * @deprecated Use the form-level `codec` instead.
644
+ */
645
+ valueFormat?: FormValueFormat<TValues>;
646
+ }
647
+
648
+ type FormSchemaDiscriminated<
649
+ T extends BaseFormComponentType,
650
+ P extends Record<string, any>,
651
+ TValues extends FormValues,
652
+ > = {
653
+ [K in Extract<keyof P, T>]: {
654
+ /** 组件 */
655
+ component: K;
656
+ /** 组件参数 */
657
+ componentProps?: MappedComponentProps<P[K], TValues>;
658
+ } & FormSchemaBody<TValues>;
659
+ }[Extract<keyof P, T>];
660
+
661
+ type FormSchemaFallback<
662
+ T extends BaseFormComponentType,
663
+ TValues extends FormValues,
664
+ > = {
665
+ /** 组件 */
666
+ component: Component | T;
667
+ /** 组件参数 */
668
+ componentProps?: ComponentProps<TValues>;
669
+ } & FormSchemaBody<TValues>;
670
+
671
+ type FormArraySchema<
672
+ T extends BaseFormComponentType,
673
+ P extends Record<string, any>,
674
+ TValues extends FormValues,
675
+ > = {
676
+ /** 内置数组编辑器参数 */
677
+ arrayProps?: Omit<
678
+ VbenFormFieldArrayProps<T, P, TValues>,
679
+ 'disabled' | 'globalCommonConfig' | 'name' | 'schema'
680
+ >;
681
+ /** 数组子字段定义 */
682
+ children: FormFieldSchema<T, P, TValues>[];
683
+ /** 兼容显式指定内置数组编辑器 */
684
+ component?: Component | T;
685
+ /** 兼容通过 componentProps 传递数组编辑器参数 */
686
+ componentProps?: ComponentProps<TValues>;
687
+ /** 数组字段标记 */
688
+ type: 'array';
689
+ } & FormSchemaBody<TValues>;
690
+
691
+ /**
692
+ * 表单分组,用于把若干字段组织成一个可折叠的区块。
693
+ * 分组本身不是字段,不参与取值与校验。
694
+ */
695
+ export interface FormGroupSchema<
696
+ T extends BaseFormComponentType = BaseFormComponentType,
697
+ P extends Record<string, any> = Record<string, never>,
698
+ TValues extends FormValues = FormValues,
699
+ > {
700
+ /** 分组内的字段定义 */
701
+ children: FormFieldSchema<T, P, TValues>[];
702
+ /**
703
+ * 是否允许折叠
704
+ * @default true
705
+ */
706
+ collapsible?: boolean;
707
+ /** 分组不是字段,禁止指定组件 */
708
+ component?: never;
709
+ /**
710
+ * 是否默认折叠
711
+ * @default false
712
+ */
713
+ defaultCollapsed?: boolean;
714
+ /** 标题右侧的附加内容 */
715
+ extra?: CustomRenderType;
716
+ /** 分组不是字段,禁止指定字段名 */
717
+ fieldName?: never;
718
+ /** 分组容器在表单栅格中的样式,默认占满一行 */
719
+ formItemClass?: FormItemClassType;
720
+ /** 是否隐藏分组 */
721
+ hide?: boolean;
722
+ /** 分组标识,用于渲染时的稳定 key,缺省按索引 */
723
+ name?: string;
724
+ /** 分组标题 */
725
+ title?: CustomRenderType;
726
+ /** 分组标记 */
727
+ type: 'group';
728
+ /** 分组内部的栅格布局,缺省继承表单的 wrapperClass */
729
+ wrapperClass?: WrapperClassType;
730
+ }
731
+
732
+ /**
733
+ * 单个表单字段的 schema(普通字段 / 数组字段)
734
+ */
735
+ export type FormFieldSchema<
736
+ T extends BaseFormComponentType = BaseFormComponentType,
737
+ P extends Record<string, any> = Record<string, never>,
738
+ TValues extends FormValues = FormValues,
739
+ > =
740
+ | FormArraySchema<T, P, TValues>
741
+ | FormSchemaDiscriminated<T, P, TValues>
742
+ | FormSchemaFallback<T, TValues>;
743
+
744
+ /**
745
+ * 表单 schema 项:字段或分组,以 `type` 区分
746
+ */
747
+ export type FormSchema<
748
+ T extends BaseFormComponentType = BaseFormComponentType,
749
+ P extends Record<string, any> = Record<string, never>,
750
+ TValues extends FormValues = FormValues,
751
+ > = FormFieldSchema<T, P, TValues> | FormGroupSchema<T, P, TValues>;
752
+
753
+ /**
754
+ * 数组编辑器(VbenFormFieldArray)的组件参数
755
+ */
756
+ export interface VbenFormFieldArrayProps<
757
+ T extends BaseFormComponentType = BaseFormComponentType,
758
+ P extends Record<string, any> = Record<string, never>,
759
+ TValues extends FormValues = FormValues,
760
+ > {
761
+ /** 操作列表头文案 */
762
+ actionText?: string;
763
+ /** 「添加」按钮文案 */
764
+ addButtonText?: string;
765
+ /** 子字段通用配置 */
766
+ commonConfig?: FormCommonConfig<TValues>;
767
+ /** 新增一行时生成的默认数据;缺省时按列定义的 fieldName 生成空对象 */
768
+ createRow?: () => Record<string, any>;
769
+ disabled?: boolean;
770
+ /** 空数据文案 */
771
+ emptyText?: string;
772
+ /** 子字段全局通用配置 */
773
+ globalCommonConfig?: FormCommonConfig<TValues>;
774
+ /** 最多行数 */
775
+ max?: number;
776
+ /** 最少行数 */
777
+ min?: number;
778
+ /** 数组字段路径,由外层 FormField 透传 */
779
+ name?: string;
780
+ /** 列定义,每一列是一个子字段(复用 FormFieldSchema) */
781
+ schema?: FormFieldSchema<T, P, TValues>[];
782
+ /** 是否显示序号列 */
783
+ showIndex?: boolean;
784
+ }
785
+
786
+ export type HandleSubmitFn<
787
+ TFormValues extends FormValues = FormValues,
788
+ TSubmitValues extends FormValues = TFormValues,
789
+ > = (
790
+ values: NoInfer<TSubmitValues>,
791
+ rawValues: Readonly<TFormValues>,
792
+ ) => Promise<void> | void;
793
+
794
+ export type HandleResetFn<TSubmitValues extends FormValues = FormValues> = (
795
+ values: TSubmitValues,
796
+ ) => Promise<void> | void;
797
+
798
+ /** @deprecated Use the form-level `codec` instead. */
799
+ export type FieldMappingTimeItem = [
800
+ string,
801
+ [string, string],
802
+ (
803
+ | ((value: any, fieldName: string) => any)
804
+ | [string, string]
805
+ | null
806
+ | string
807
+ )?,
808
+ ];
809
+
810
+ /** @deprecated Use the form-level `codec` instead. */
811
+ export type FieldMappingTime = FieldMappingTimeItem[];
812
+
813
+ /** @deprecated Use the form-level `codec` instead. */
814
+ export type ArrayToStringFields = Array<
815
+ | [string[], string?] // 嵌套数组格式,可选分隔符
816
+ | string // 单个字段,使用默认分隔符
817
+ | string[] // 简单数组格式,最后一个元素可以是分隔符
818
+ >;
819
+
820
+ export interface FormFieldProps<
821
+ T extends BaseFormComponentType = BaseFormComponentType,
822
+ TValues extends FormValues = FormValues,
823
+ > extends FormSchemaBody<TValues> {
824
+ /** 组件 */
825
+ component: Component | T;
826
+ /** 组件参数 */
827
+ componentProps?: ComponentProps<TValues>;
828
+ }
829
+
830
+ export interface FormRenderProps<
831
+ T extends BaseFormComponentType = BaseFormComponentType,
832
+ P extends Record<string, any> = Record<string, never>,
833
+ TValues extends FormValues = FormValues,
834
+ > {
835
+ /**
836
+ * 表单字段数组映射字符串配置 默认使用","
837
+ * @deprecated Use the form-level `codec` instead.
838
+ */
839
+ arrayToStringFields?: ArrayToStringFields;
840
+ /**
841
+ * 是否折叠,在showCollapseButton=true下生效
842
+ * true:折叠 false:展开
843
+ */
844
+ collapsed?: boolean;
845
+ /**
846
+ * 折叠时保持行数
847
+ * @default 1
848
+ */
849
+ collapsedRows?: number;
850
+ /**
851
+ * 是否触发resize事件
852
+ * @default false
853
+ */
854
+ collapseTriggerResize?: boolean;
855
+ /**
856
+ * 表单项通用后备配置,当子项目没配置时使用这里的配置,子项目配置优先级高于此配置
857
+ */
858
+ commonConfig?: FormCommonConfig<TValues>;
859
+ /**
860
+ * 紧凑模式(移除表单每一项底部为校验信息预留的空间)
861
+ */
862
+ compact?: boolean;
863
+ /**
864
+ * 组件v-model事件绑定
865
+ */
866
+ componentBindEventMap?: Partial<Record<BaseFormComponentType, string>>;
867
+ /**
868
+ * 组件集合
869
+ */
870
+ componentMap: Record<BaseFormComponentType, Component>;
871
+ /**
872
+ * 表单字段映射到时间格式
873
+ * @deprecated Use the form-level `codec` instead.
874
+ */
875
+ fieldMappingTime?: FieldMappingTime;
876
+ /**
877
+ * 表单实例
878
+ */
879
+ form?: FormActions<TValues>;
880
+ /**
881
+ * 表单项布局
882
+ */
883
+ layout?: FormLayout;
884
+ /**
885
+ * 表单定义
886
+ */
887
+ schema?: FormSchema<T, P, TValues>[];
888
+
889
+ /**
890
+ * 是否显示展开/折叠
891
+ */
892
+ showCollapseButton?: boolean;
893
+ /**
894
+ * 格式化日期
895
+ */
896
+
897
+ /**
898
+ * 表单栅格布局
899
+ * @default "grid-cols-1"
900
+ */
901
+ wrapperClass?: WrapperClassType;
902
+ }
903
+
904
+ export interface ActionButtonOptions extends VbenButtonProps {
905
+ [key: string]: any;
906
+ content?: MaybeComputedRef<string>;
907
+ show?: boolean;
908
+ }
909
+
910
+ export interface VbenFormProps<
911
+ T extends BaseFormComponentType = BaseFormComponentType,
912
+ P extends Record<string, any> = Record<string, never>,
913
+ TValues extends FormValues = FormValues,
914
+ TSubmitValues extends FormValues = TValues,
915
+ > extends Omit<
916
+ FormRenderProps<T, P, TValues>,
917
+ 'componentBindEventMap' | 'componentMap' | 'form'
918
+ > {
919
+ /**
920
+ * 操作按钮是否反转(提交按钮前置)
921
+ */
922
+ actionButtonsReverse?: boolean;
923
+ /**
924
+ * 操作按钮组的样式
925
+ * newLine: 在新行显示。rowEnd: 在行内显示,靠右对齐(默认)。inline: 使用grid默认样式
926
+ */
927
+ actionLayout?: 'inline' | 'newLine' | 'rowEnd';
928
+ /**
929
+ * 操作按钮组显示位置,默认靠右显示
930
+ */
931
+ actionPosition?: 'center' | 'left' | 'right';
932
+ /**
933
+ * 表单操作区域class
934
+ */
935
+ actionWrapperClass?: ClassType;
936
+ /**
937
+ * 表单字段数组映射字符串配置 默认使用","
938
+ * @deprecated Use the form-level `codec` instead.
939
+ */
940
+ arrayToStringFields?: ArrayToStringFields;
941
+
942
+ /**
943
+ * submitOnChange改变时防抖时间 | 默认300ms
944
+ */
945
+ changeDebouncedTime?: number;
946
+ /** 表单组件值与提交值之间的双向编解码器。 */
947
+ codec?: FormCodec<TValues, TSubmitValues>;
948
+ /**
949
+ * 表单字段映射
950
+ * @deprecated Use the form-level `codec` instead.
951
+ */
952
+ fieldMappingTime?: FieldMappingTime;
953
+ /**
954
+ * 表单收起展开状态变化回调
955
+ */
956
+ handleCollapsedChange?: (collapsed: boolean) => void;
957
+ /**
958
+ * 表单重置回调
959
+ */
960
+ handleReset?: HandleResetFn<NoInfer<TSubmitValues>>;
961
+ /**
962
+ * 表单提交回调
963
+ */
964
+ handleSubmit?: HandleSubmitFn<TValues, TSubmitValues>;
965
+ /**
966
+ * 表单值变化回调
967
+ */
968
+ handleValuesChange?: (
969
+ values: Readonly<TValues>,
970
+ fieldsChanged: string[],
971
+ getFormattedValues: () => TSubmitValues,
972
+ ) => void;
973
+
974
+ /**
975
+ * 重置按钮参数
976
+ */
977
+ resetButtonOptions?: ActionButtonOptions;
978
+
979
+ /**
980
+ * 验证失败时是否自动滚动到第一个错误字段
981
+ * @default false
982
+ */
983
+ scrollToFirstError?: boolean;
984
+
985
+ /**
986
+ * 是否显示默认操作按钮
987
+ * @default true
988
+ */
989
+ showDefaultActions?: boolean;
990
+
991
+ /**
992
+ * 提交按钮参数
993
+ */
994
+ submitButtonOptions?: ActionButtonOptions;
995
+
996
+ /**
997
+ * 是否在字段值改变时提交表单
998
+ * @default false
999
+ */
1000
+ submitOnChange?: boolean;
1001
+
1002
+ /**
1003
+ * 是否在回车时提交表单
1004
+ * @default false
1005
+ */
1006
+ submitOnEnter?: boolean;
1007
+ }
1008
+
1009
+ export type ExtendedFormApi<
1010
+ TValues extends FormValues = FormValues,
1011
+ T extends BaseFormComponentType = BaseFormComponentType,
1012
+ P extends Record<string, any> = Record<string, never>,
1013
+ TSubmitValues extends FormValues = TValues,
1014
+ > = FormApi<TValues, T, P, TSubmitValues> & {
1015
+ useStore: <TResult = NoInfer<VbenFormProps<T, P, TValues, TSubmitValues>>>(
1016
+ selector?: (
1017
+ state: NoInfer<VbenFormProps<T, P, TValues, TSubmitValues>>,
1018
+ ) => TResult,
1019
+ ) => Readonly<Ref<TResult>>;
1020
+ };
1021
+
1022
+ export interface VbenFormAdapterOptions<
1023
+ T extends BaseFormComponentType = BaseFormComponentType,
1024
+ > {
1025
+ config?: {
1026
+ baseModelPropName?: string;
1027
+ /**
1028
+ * 是否启用 change 事件兼容回退。
1029
+ * 仅用于只发送 change 的兼容组件。
1030
+ * @default false
1031
+ */
1032
+ changeEventFallback?: boolean;
1033
+ emptyStateValue?: null | undefined;
1034
+ modelPropNameMap?: Partial<Record<T, string>>;
1035
+ };
1036
+ /** @deprecated Use `rules` instead. */
1037
+ defineRules?: Partial<Record<string, FormRuleValidator>>;
1038
+ rules?: Partial<Record<string, FormRuleValidator>>;
1039
+ }
1040
+
1041
+ export interface FormRuleContext {
1042
+ field: {
1043
+ label?: string;
1044
+ name: string;
1045
+ };
1046
+ label?: string;
1047
+ name: string;
1048
+ }
1049
+
1050
+ export type FormRuleValidator = (
1051
+ value: any,
1052
+ params: any,
1053
+ context: FormRuleContext,
1054
+ ) => boolean | Promise<boolean | string> | string;