@vinicunca/taman-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/README.md +95 -0
  2. package/dist/_virtual/_/plugin-vue/export-helper.mjs +8 -0
  3. package/dist/components/auth/index.d.ts +2 -0
  4. package/dist/components/auth/index.mjs +2 -0
  5. package/dist/components/auth/taman-auth-form.mjs +67 -0
  6. package/dist/components/auth/taman-auth-form.vue.d.ts +31 -0
  7. package/dist/components/back-to-top/index.mjs +2 -0
  8. package/dist/components/back-to-top/taman-back-to-top.mjs +70 -0
  9. package/dist/components/back-to-top/taman-back-to-top.vue.d.ts +18 -0
  10. package/dist/components/button/check-group-selection.mjs +17 -0
  11. package/dist/components/button/index.d.ts +4 -0
  12. package/dist/components/button/index.mjs +3 -0
  13. package/dist/components/button/taman-button-check-group.mjs +132 -0
  14. package/dist/components/button/taman-button-check-group.types.d.ts +22 -0
  15. package/dist/components/button/taman-button-check-group.vue.d.ts +41 -0
  16. package/dist/components/button/taman-button-icon.mjs +105 -0
  17. package/dist/components/button/taman-button-icon.vue.d.ts +17 -0
  18. package/dist/components/descriptions/index.d.ts +4 -0
  19. package/dist/components/descriptions/index.mjs +3 -0
  20. package/dist/components/descriptions/taman-description-cell.mjs +116 -0
  21. package/dist/components/descriptions/taman-description-item.mjs +10 -0
  22. package/dist/components/descriptions/taman-description-item.vue.d.ts +5 -0
  23. package/dist/components/descriptions/taman-description-row.mjs +131 -0
  24. package/dist/components/descriptions/taman-description.mjs +78 -0
  25. package/dist/components/descriptions/taman-description.types.d.ts +51 -0
  26. package/dist/components/descriptions/taman-description.vue.d.ts +23 -0
  27. package/dist/components/descriptions/use-taman-description.mjs +161 -0
  28. package/dist/components/file-upload/index.d.ts +3 -0
  29. package/dist/components/file-upload/index.mjs +2 -0
  30. package/dist/components/file-upload/taman-file-upload.mjs +88 -0
  31. package/dist/components/file-upload/taman-file-upload.types.d.ts +10 -0
  32. package/dist/components/file-upload/taman-file-upload.vue.d.ts +21 -0
  33. package/dist/components/full-screen/full-screen.mjs +27 -0
  34. package/dist/components/full-screen/full-screen.vue.d.ts +8 -0
  35. package/dist/components/full-screen/index.mjs +2 -0
  36. package/dist/components/icon/icon.mjs +27 -0
  37. package/dist/components/icon/icon.vue.d.ts +9 -0
  38. package/dist/components/icon/index.d.ts +2 -0
  39. package/dist/components/icon/index.mjs +2 -0
  40. package/dist/components/index.d.ts +34 -0
  41. package/dist/components/index.mjs +31 -0
  42. package/dist/components/input/index.d.ts +5 -0
  43. package/dist/components/input/index.mjs +4 -0
  44. package/dist/components/input/password-strength.d.ts +7 -0
  45. package/dist/components/input/password-strength.mjs +21 -0
  46. package/dist/components/input/taman-input-currency.mjs +76 -0
  47. package/dist/components/input/taman-input-currency.types.d.ts +8 -0
  48. package/dist/components/input/taman-input-currency.vue.d.ts +15 -0
  49. package/dist/components/input/taman-input-password.mjs +99 -0
  50. package/dist/components/input/taman-input-password.vue.d.ts +17 -0
  51. package/dist/components/input-date/format-calendar-input-value.mjs +26 -0
  52. package/dist/components/input-date/index.d.ts +3 -0
  53. package/dist/components/input-date/index.mjs +2 -0
  54. package/dist/components/input-date/taman-input-date.mjs +116 -0
  55. package/dist/components/input-date/taman-input-date.types.d.ts +14 -0
  56. package/dist/components/input-date/taman-input-date.vue.d.ts +21 -0
  57. package/dist/components/loading/index.d.ts +3 -0
  58. package/dist/components/loading/index.mjs +2 -0
  59. package/dist/components/loading/taman-loading.mjs +64 -0
  60. package/dist/components/loading/taman-loading.vue.d.ts +25 -0
  61. package/dist/components/loading/types.d.ts +13 -0
  62. package/dist/components/logo/index.mjs +2 -0
  63. package/dist/components/logo/taman-logo.mjs +60 -0
  64. package/dist/components/logo/taman-logo.vue.d.ts +32 -0
  65. package/dist/components/render-content/index.d.ts +2 -0
  66. package/dist/components/render-content/index.mjs +2 -0
  67. package/dist/components/render-content/render-content.mjs +42 -0
  68. package/dist/components/render-content/render-content.vue.d.ts +31 -0
  69. package/dist/components/scrollbar/index.d.ts +2 -0
  70. package/dist/components/scrollbar/index.mjs +2 -0
  71. package/dist/components/scrollbar/scrollbar.mjs +136 -0
  72. package/dist/components/scrollbar/scrollbar.vue.d.ts +50 -0
  73. package/dist/form/components/form-actions.mjs +151 -0
  74. package/dist/form/components/form-field-array.mjs +154 -0
  75. package/dist/form/components/form-field-array.types.d.ts +18 -0
  76. package/dist/form/form-render/form-render-field-collapsible.mjs +32 -0
  77. package/dist/form/form-render/form-render-field-control.mjs +44 -0
  78. package/dist/form/form-render/form-render-form-field.mjs +408 -0
  79. package/dist/form/form-render/form-render-form-label.mjs +46 -0
  80. package/dist/form/form-render/form-render-form.mjs +163 -0
  81. package/dist/form/form-render/form-render-group.mjs +89 -0
  82. package/dist/form/form-render/form-render.context.mjs +10 -0
  83. package/dist/form/form-render/form-render.dependencies.mjs +101 -0
  84. package/dist/form/form-render/form-render.helper.mjs +31 -0
  85. package/dist/form/form-render/form-render.schema.mjs +209 -0
  86. package/dist/form/form-render/index.mjs +4 -0
  87. package/dist/form/form.api.d.ts +54 -0
  88. package/dist/form/form.api.mjs +324 -0
  89. package/dist/form/form.built-ins.d.ts +36 -0
  90. package/dist/form/form.built-ins.mjs +48 -0
  91. package/dist/form/form.codec.d.ts +17 -0
  92. package/dist/form/form.codec.mjs +45 -0
  93. package/dist/form/form.config.d.ts +6 -0
  94. package/dist/form/form.config.mjs +43 -0
  95. package/dist/form/form.empty-value.d.ts +4 -0
  96. package/dist/form/form.empty-value.mjs +20 -0
  97. package/dist/form/form.field-name.mjs +25 -0
  98. package/dist/form/form.rule-registry.mjs +10 -0
  99. package/dist/form/form.runtime-field.mjs +56 -0
  100. package/dist/form/form.runtime.mjs +235 -0
  101. package/dist/form/form.schema-defaults.mjs +36 -0
  102. package/dist/form/form.types.d.ts +315 -0
  103. package/dist/form/form.use-delayed-flag.mjs +35 -0
  104. package/dist/form/form.use-form-context.mjs +44 -0
  105. package/dist/form/form.use-taman-form.d.ts +7 -0
  106. package/dist/form/form.use-taman-form.mjs +36 -0
  107. package/dist/form/index.d.ts +8 -0
  108. package/dist/form/index.mjs +6 -0
  109. package/dist/form/taman-use-form.mjs +146 -0
  110. package/dist/index.d.ts +63 -0
  111. package/dist/index.mjs +56 -0
  112. package/dist/layout/components/index.mjs +6 -0
  113. package/dist/layout/components/taman-core-button-collapse.mjs +38 -0
  114. package/dist/layout/components/taman-core-button-fixed.mjs +29 -0
  115. package/dist/layout/components/taman-core-layout-content.mjs +50 -0
  116. package/dist/layout/components/taman-core-layout-footer.mjs +38 -0
  117. package/dist/layout/components/taman-core-layout-header.mjs +48 -0
  118. package/dist/layout/components/taman-core-layout-sidebar.mjs +319 -0
  119. package/dist/layout/components/taman-core-layout-tabbar.mjs +21 -0
  120. package/dist/layout/composables/use-layout.mjs +31 -0
  121. package/dist/layout/composables/use-sidebar-drag.mjs +103 -0
  122. package/dist/layout/header-scroll-state.mjs +9 -0
  123. package/dist/layout/index.d.ts +3 -0
  124. package/dist/layout/index.mjs +2 -0
  125. package/dist/layout/taman-core-layout.d.ts +41 -0
  126. package/dist/layout/taman-core-layout.mjs +603 -0
  127. package/dist/layout/taman-core-layout.vue.d.ts +99 -0
  128. package/dist/menu/components/collapse-transition.mjs +82 -0
  129. package/dist/menu/components/index.mjs +5 -0
  130. package/dist/menu/components/normal-menu/index.d.ts +3 -0
  131. package/dist/menu/components/normal-menu/index.mjs +2 -0
  132. package/dist/menu/components/normal-menu/normal-menu.d.ts +11 -0
  133. package/dist/menu/components/normal-menu/normal-menu.mjs +50 -0
  134. package/dist/menu/components/normal-menu/normal-menu.vue.d.ts +19 -0
  135. package/dist/menu/components/taman-menu-badge-dot.mjs +23 -0
  136. package/dist/menu/components/taman-menu-badge.mjs +49 -0
  137. package/dist/menu/components/taman-menu-badge.vue.d.ts +9 -0
  138. package/dist/menu/components/taman-menu-item.mjs +124 -0
  139. package/dist/menu/components/taman-menu-root.mjs +250 -0
  140. package/dist/menu/components/taman-menu-sub-menu-content.mjs +83 -0
  141. package/dist/menu/components/taman-menu-sub-menu.mjs +216 -0
  142. package/dist/menu/composables/index.mjs +3 -0
  143. package/dist/menu/composables/use-menu-context.mjs +36 -0
  144. package/dist/menu/composables/use-menu-scroll.mjs +23 -0
  145. package/dist/menu/composables/use-menu.mjs +33 -0
  146. package/dist/menu/index.d.ts +7 -0
  147. package/dist/menu/index.mjs +5 -0
  148. package/dist/menu/menu.constants.mjs +5 -0
  149. package/dist/menu/menu.types.d.ts +63 -0
  150. package/dist/menu/menu.utils.mjs +27 -0
  151. package/dist/menu/taman-menu.mjs +41 -0
  152. package/dist/menu/taman-menu.vue.d.ts +12 -0
  153. package/dist/menu/taman-sub-menu.mjs +75 -0
  154. package/dist/popup/alert/alert-builder.d.ts +8 -0
  155. package/dist/popup/alert/alert-builder.mjs +98 -0
  156. package/dist/popup/alert/alert-overlay.mjs +55 -0
  157. package/dist/popup/alert/alert.d.ts +43 -0
  158. package/dist/popup/alert/alert.mjs +10 -0
  159. package/dist/popup/alert/alert.vue.d.ts +26 -0
  160. package/dist/popup/alert/alert2.mjs +238 -0
  161. package/dist/popup/alert/index.d.ts +4 -0
  162. package/dist/popup/alert/index.mjs +4 -0
  163. package/dist/popup/dialog/dialog.api.d.ts +23 -0
  164. package/dist/popup/dialog/dialog.api.mjs +133 -0
  165. package/dist/popup/dialog/dialog.mjs +336 -0
  166. package/dist/popup/dialog/dialog.types.d.ts +60 -0
  167. package/dist/popup/dialog/dialog.vue.d.ts +46 -0
  168. package/dist/popup/dialog/index.d.ts +4 -0
  169. package/dist/popup/dialog/index.mjs +3 -0
  170. package/dist/popup/dialog/use-dialog-draggable.mjs +93 -0
  171. package/dist/popup/dialog/use-taman-dialog.d.ts +13 -0
  172. package/dist/popup/dialog/use-taman-dialog.mjs +106 -0
  173. package/dist/popup/drawer/drawer.api.d.ts +23 -0
  174. package/dist/popup/drawer/drawer.api.mjs +124 -0
  175. package/dist/popup/drawer/drawer.mjs +277 -0
  176. package/dist/popup/drawer/drawer.types.d.ts +56 -0
  177. package/dist/popup/drawer/drawer.vue.d.ts +47 -0
  178. package/dist/popup/drawer/index.d.ts +4 -0
  179. package/dist/popup/drawer/index.mjs +3 -0
  180. package/dist/popup/drawer/use-taman-drawer.d.ts +13 -0
  181. package/dist/popup/drawer/use-taman-drawer.mjs +109 -0
  182. package/dist/popup/index.d.ts +13 -0
  183. package/dist/popup/index.mjs +11 -0
  184. package/dist/tabs/components/index.mjs +2 -0
  185. package/dist/tabs/components/taman-tabs.mjs +158 -0
  186. package/dist/tabs/components/widgets/index.d.ts +4 -0
  187. package/dist/tabs/components/widgets/index.mjs +4 -0
  188. package/dist/tabs/components/widgets/tool-more.mjs +45 -0
  189. package/dist/tabs/components/widgets/tool-more.vue.d.ts +7 -0
  190. package/dist/tabs/components/widgets/tool-refresh.mjs +25 -0
  191. package/dist/tabs/components/widgets/tool-refresh.vue.d.ts +9 -0
  192. package/dist/tabs/components/widgets/tool-screen.mjs +29 -0
  193. package/dist/tabs/components/widgets/tool-screen.vue.d.ts +12 -0
  194. package/dist/tabs/index.d.ts +8 -0
  195. package/dist/tabs/index.mjs +6 -0
  196. package/dist/tabs/strict-context-menu.d.ts +10 -0
  197. package/dist/tabs/tabs.types.d.ts +30 -0
  198. package/dist/tabs/taman-tabs-view.mjs +101 -0
  199. package/dist/tabs/taman-tabs-view.vue.d.ts +18 -0
  200. package/dist/tabs/use-tabs-drag.mjs +69 -0
  201. package/dist/tabs/use-tabs-view-scroll.mjs +114 -0
  202. package/dist/ui/alert-dialog/alert-dialog-action.mjs +21 -0
  203. package/dist/ui/alert-dialog/alert-dialog-action.vue.d.ts +16 -0
  204. package/dist/ui/alert-dialog/alert-dialog-cancel.mjs +21 -0
  205. package/dist/ui/alert-dialog/alert-dialog-cancel.vue.d.ts +16 -0
  206. package/dist/ui/alert-dialog/alert-dialog-content.mjs +111 -0
  207. package/dist/ui/alert-dialog/alert-dialog-content.vue.d.ts +49 -0
  208. package/dist/ui/alert-dialog/alert-dialog-description.mjs +30 -0
  209. package/dist/ui/alert-dialog/alert-dialog-description.vue.d.ts +20 -0
  210. package/dist/ui/alert-dialog/alert-dialog-footer.mjs +14 -0
  211. package/dist/ui/alert-dialog/alert-dialog-footer.vue.d.ts +15 -0
  212. package/dist/ui/alert-dialog/alert-dialog-header.mjs +14 -0
  213. package/dist/ui/alert-dialog/alert-dialog-header.vue.d.ts +15 -0
  214. package/dist/ui/alert-dialog/alert-dialog-overlay.mjs +29 -0
  215. package/dist/ui/alert-dialog/alert-dialog-root.mjs +23 -0
  216. package/dist/ui/alert-dialog/alert-dialog-root.vue.d.ts +23 -0
  217. package/dist/ui/alert-dialog/alert-dialog-title.mjs +30 -0
  218. package/dist/ui/alert-dialog/alert-dialog-title.vue.d.ts +20 -0
  219. package/dist/ui/alert-dialog/alert-dialog-trigger.mjs +21 -0
  220. package/dist/ui/alert-dialog/alert-dialog-trigger.vue.d.ts +16 -0
  221. package/dist/ui/alert-dialog/index.d.ts +10 -0
  222. package/dist/ui/alert-dialog/index.mjs +10 -0
  223. package/dist/ui/dialog/dialog-close.mjs +21 -0
  224. package/dist/ui/dialog/dialog-close.vue.d.ts +16 -0
  225. package/dist/ui/dialog/dialog-content.mjs +111 -0
  226. package/dist/ui/dialog/dialog-content.vue.d.ts +51 -0
  227. package/dist/ui/dialog/dialog-description.mjs +31 -0
  228. package/dist/ui/dialog/dialog-description.vue.d.ts +20 -0
  229. package/dist/ui/dialog/dialog-footer.mjs +14 -0
  230. package/dist/ui/dialog/dialog-footer.vue.d.ts +15 -0
  231. package/dist/ui/dialog/dialog-header.mjs +14 -0
  232. package/dist/ui/dialog/dialog-header.vue.d.ts +15 -0
  233. package/dist/ui/dialog/dialog-overlay.mjs +34 -0
  234. package/dist/ui/dialog/dialog-overlay.vue.d.ts +14 -0
  235. package/dist/ui/dialog/dialog-root.mjs +24 -0
  236. package/dist/ui/dialog/dialog-root.vue.d.ts +23 -0
  237. package/dist/ui/dialog/dialog-title.mjs +31 -0
  238. package/dist/ui/dialog/dialog-title.vue.d.ts +20 -0
  239. package/dist/ui/dialog/dialog-trigger.mjs +21 -0
  240. package/dist/ui/dialog/dialog-trigger.vue.d.ts +16 -0
  241. package/dist/ui/dialog/index.d.ts +10 -0
  242. package/dist/ui/dialog/index.mjs +10 -0
  243. package/dist/ui/dialog/use-dialog-state-events.mjs +60 -0
  244. package/dist/ui/form/form-control.mjs +27 -0
  245. package/dist/ui/form/form-control.vue.d.ts +15 -0
  246. package/dist/ui/form/form-description.mjs +27 -0
  247. package/dist/ui/form/form-description.vue.d.ts +19 -0
  248. package/dist/ui/form/form-field.mjs +37 -0
  249. package/dist/ui/form/form-field.vue.d.ts +27 -0
  250. package/dist/ui/form/form-item.mjs +27 -0
  251. package/dist/ui/form/form-item.vue.d.ts +19 -0
  252. package/dist/ui/form/form-label.mjs +41 -0
  253. package/dist/ui/form/form-label.vue.d.ts +20 -0
  254. package/dist/ui/form/form-message.mjs +28 -0
  255. package/dist/ui/form/form-message.vue.d.ts +9 -0
  256. package/dist/ui/form/index.d.ts +8 -0
  257. package/dist/ui/form/index.mjs +8 -0
  258. package/dist/ui/form/injection-keys.d.ts +13 -0
  259. package/dist/ui/form/injection-keys.mjs +5 -0
  260. package/dist/ui/form/use-form-field.mjs +27 -0
  261. package/dist/ui/index.d.ts +42 -0
  262. package/dist/ui/index.mjs +42 -0
  263. package/dist/ui/label/index.d.ts +2 -0
  264. package/dist/ui/label/index.mjs +2 -0
  265. package/dist/ui/label/label.mjs +31 -0
  266. package/dist/ui/label/label.vue.d.ts +20 -0
  267. package/dist/ui/scroll-area/index.d.ts +3 -0
  268. package/dist/ui/scroll-area/index.mjs +3 -0
  269. package/dist/ui/scroll-area/scroll-area.mjs +47 -0
  270. package/dist/ui/scroll-area/scroll-area.vue.d.ts +21 -0
  271. package/dist/ui/scroll-area/scroll-bar.mjs +38 -0
  272. package/dist/ui/scroll-area/scroll-bar.vue.d.ts +12 -0
  273. package/dist/ui/sheet/index.d.ts +8 -0
  274. package/dist/ui/sheet/index.mjs +8 -0
  275. package/dist/ui/sheet/sheet-close.mjs +21 -0
  276. package/dist/ui/sheet/sheet-close.vue.d.ts +16 -0
  277. package/dist/ui/sheet/sheet-content.mjs +105 -0
  278. package/dist/ui/sheet/sheet-content.vue.d.ts +48 -0
  279. package/dist/ui/sheet/sheet-description.mjs +30 -0
  280. package/dist/ui/sheet/sheet-description.vue.d.ts +20 -0
  281. package/dist/ui/sheet/sheet-footer.mjs +14 -0
  282. package/dist/ui/sheet/sheet-footer.vue.d.ts +15 -0
  283. package/dist/ui/sheet/sheet-header.mjs +14 -0
  284. package/dist/ui/sheet/sheet-header.vue.d.ts +15 -0
  285. package/dist/ui/sheet/sheet-overlay.mjs +32 -0
  286. package/dist/ui/sheet/sheet-root.mjs +24 -0
  287. package/dist/ui/sheet/sheet-root.vue.d.ts +23 -0
  288. package/dist/ui/sheet/sheet-title.mjs +31 -0
  289. package/dist/ui/sheet/sheet-title.vue.d.ts +20 -0
  290. package/dist/ui/sheet/sheet.variants.d.ts +27 -0
  291. package/dist/ui/sheet/sheet.variants.mjs +12 -0
  292. package/dist/unocss/content.d.ts +4 -0
  293. package/dist/unocss/content.mjs +9 -0
  294. package/dist/unocss/index.d.ts +2 -0
  295. package/dist/unocss/index.mjs +2 -0
  296. package/package.json +78 -0
@@ -0,0 +1,46 @@
1
+ import _sfc_main$1 from "../../components/render-content/render-content.mjs";
2
+ import _sfc_main$2 from "../../ui/form/form-label.mjs";
3
+ import "../../index.mjs";
4
+ import { createBlock, createCommentVNode, createVNode, defineComponent, normalizeClass, openBlock, renderSlot, unref, withCtx } from "vue";
5
+ import PTooltip from "pohon-ui/components/Tooltip.vue";
6
+ import { useForwardExpose } from "@vinicunca/taman-core/composables";
7
+ import PIcon from "pohon-ui/components/Icon.vue";
8
+ //#region src/form/form-render/form-render-form-label.vue
9
+ const REQUIRED_CLASS = `after:content-['*'] after:color-error after:ml-0.5 after:order-1`;
10
+ const _sfc_main = /*@__PURE__*/ defineComponent({
11
+ __name: "form-render-form-label",
12
+ props: {
13
+ class: { type: [
14
+ Boolean,
15
+ null,
16
+ String,
17
+ Object,
18
+ Array
19
+ ] },
20
+ help: { type: [Function, String] },
21
+ label: { type: [Function, String] },
22
+ required: { type: Boolean }
23
+ },
24
+ setup(__props) {
25
+ const props = __props;
26
+ const { forwardRef } = useForwardExpose();
27
+ return (_ctx, _cache) => {
28
+ return openBlock(), createBlock(unref(_sfc_main$2), {
29
+ ref: unref(forwardRef),
30
+ class: normalizeClass(["flex items-center", [props.class, props.required ? REQUIRED_CLASS : ""]])
31
+ }, {
32
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default"), __props.help ? (openBlock(), createBlock(PTooltip, {
33
+ key: 0,
34
+ class: "order-2"
35
+ }, {
36
+ content: withCtx(() => [createVNode(unref(_sfc_main$1), { content: __props.help }, null, 8, ["content"])]),
37
+ default: withCtx(() => [createVNode(PIcon, { name: "lucide:circle-question-mark" })]),
38
+ _: 1
39
+ })) : createCommentVNode("v-if", true)]),
40
+ _: 3
41
+ }, 8, ["class"]);
42
+ };
43
+ }
44
+ });
45
+ //#endregion
46
+ export { _sfc_main as default };
@@ -0,0 +1,163 @@
1
+ import { createFormFieldSchema, getFormFieldSchemas, isFormGroupSchema } from "./form-render.schema.mjs";
2
+ import { provideFormRenderProps } from "./form-render.context.mjs";
3
+ import { getBaseRules, getDefaultValueInZodStack } from "./form-render.helper.mjs";
4
+ import _sfc_main$1 from "./form-render-form-field.mjs";
5
+ import _sfc_main$2 from "./form-render-group.mjs";
6
+ import { Fragment, computed, createBlock, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, normalizeClass, normalizeProps, openBlock, reactive, renderList, renderSlot, resolveDynamicComponent, toRaw, toRefs, unref, useId, watch, withCtx } from "vue";
7
+ import { isString } from "@vinicunca/taman-core/utils";
8
+ //#region src/form/form-render/form-render-form.vue
9
+ const _hoisted_1 = ["id"];
10
+ const formComponent = "form";
11
+ const _sfc_main = /*@__PURE__*/ defineComponent({
12
+ __name: "form-render-form",
13
+ props: {
14
+ collapsed: { type: Boolean },
15
+ collapseTriggerResize: { type: Boolean },
16
+ commonConfig: { default: () => ({}) },
17
+ compact: { type: Boolean },
18
+ componentMap: {},
19
+ disabled: { type: Boolean },
20
+ form: {},
21
+ schema: {},
22
+ wrapperClass: { default: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3" },
23
+ globalCommonConfig: { default: () => ({}) }
24
+ },
25
+ emits: ["submit", "update:collapsed"],
26
+ setup(__props, { emit: __emit }) {
27
+ const props = __props;
28
+ const emits = __emit;
29
+ function getWrapperClass(gridClass = "") {
30
+ return [
31
+ "flex",
32
+ props.compact ? "gap-x-2" : "gap-x-4",
33
+ "flex-col grid",
34
+ gridClass
35
+ ];
36
+ }
37
+ const wrapperClass = computed(() => getWrapperClass(props.wrapperClass));
38
+ const formFieldSchemas = computed(() => {
39
+ return getFormFieldSchemas(props.schema ?? []);
40
+ });
41
+ provideFormRenderProps(reactive({ ...toRefs(props) }));
42
+ const shapes = computed(() => {
43
+ const resultShapes = [];
44
+ formFieldSchemas.value.forEach((schema) => {
45
+ const { fieldName } = schema;
46
+ const rules = toRaw(schema.rules);
47
+ const baseRules = getBaseRules(rules);
48
+ resultShapes.push({
49
+ default: getDefaultValueInZodStack(rules),
50
+ fieldName,
51
+ required: Boolean(rules && !isString(rules) && !rules.isOptional()),
52
+ rules: baseRules
53
+ });
54
+ });
55
+ return resultShapes;
56
+ });
57
+ const formComponentProps = computed(() => {
58
+ return props.form ? { onSubmit: props.form.handleSubmit(() => emits("submit", void 0)) } : { onSubmit: (event) => {
59
+ event.preventDefault();
60
+ emits("submit", event);
61
+ } };
62
+ });
63
+ function normalizeFieldSchema(schema, hidden = false) {
64
+ return createFormFieldSchema(schema, {
65
+ commonConfig: props.commonConfig,
66
+ globalCommonConfig: props.globalCommonConfig,
67
+ hidden
68
+ });
69
+ }
70
+ const computedSchema = computed(() => {
71
+ const result = [];
72
+ (props.schema ?? []).forEach((schema, index) => {
73
+ const hidden = Boolean(props.collapsed) && schema.collapsed === true;
74
+ if (isFormGroupSchema(schema)) {
75
+ if (schema.hide || schema.children.length === 0) return;
76
+ result.push({
77
+ ...schema,
78
+ fields: schema.children.map((field) => normalizeFieldSchema(field)),
79
+ hidden,
80
+ key: schema.name ?? `group-${index}`
81
+ });
82
+ return;
83
+ }
84
+ result.push(normalizeFieldSchema(schema, hidden));
85
+ });
86
+ return result;
87
+ });
88
+ function isNormalizedFormGroupSchema(schema) {
89
+ return isFormGroupSchema(schema);
90
+ }
91
+ const hiddenFieldNames = computed(() => {
92
+ const fieldNames = [];
93
+ (props.schema ?? []).forEach((schema) => {
94
+ if (isFormGroupSchema(schema)) {
95
+ if (schema.hide || schema.children.length === 0 || schema.collapsed !== true) return;
96
+ schema.children.forEach(({ fieldName }) => {
97
+ fieldNames.push(fieldName);
98
+ });
99
+ return;
100
+ }
101
+ if (schema.collapsed === true) fieldNames.push(schema.fieldName);
102
+ });
103
+ return fieldNames;
104
+ });
105
+ const hasInvalidHiddenField = computed(() => {
106
+ if (hiddenFieldNames.value.length === 0) return false;
107
+ const errors = props.form?.errors ?? {};
108
+ return hiddenFieldNames.value.some((fieldName) => Object.entries(errors).some(([errorFieldName, error]) => Boolean(error) && (errorFieldName === fieldName || errorFieldName.startsWith(`${fieldName}.`) || errorFieldName.startsWith(`${fieldName}[`))));
109
+ });
110
+ watch(hasInvalidHiddenField, (invalid) => {
111
+ if (invalid && props.collapsed) emits("update:collapsed", false);
112
+ });
113
+ function getGroupWrapperClass(schema) {
114
+ return getWrapperClass(schema.wrapperClass ?? props.wrapperClass);
115
+ }
116
+ const gridId = useId();
117
+ return (_ctx, _cache) => {
118
+ return openBlock(), createBlock(resolveDynamicComponent(formComponent), normalizeProps(guardReactiveProps(formComponentProps.value)), {
119
+ default: withCtx(() => [createElementVNode("div", {
120
+ id: unref(gridId),
121
+ class: normalizeClass(wrapperClass.value)
122
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(computedSchema.value, (cSchema) => {
123
+ return openBlock(), createElementBlock(Fragment, { key: isNormalizedFormGroupSchema(cSchema) ? cSchema.key : cSchema.fieldName }, [isNormalizedFormGroupSchema(cSchema) ? (openBlock(), createBlock(_sfc_main$2, {
124
+ key: 0,
125
+ "content-class": getGroupWrapperClass(cSchema),
126
+ hidden: cSchema.hidden,
127
+ schema: cSchema
128
+ }, {
129
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(cSchema.fields, (fieldSchema) => {
130
+ return openBlock(), createBlock(_sfc_main$1, mergeProps({ key: fieldSchema.fieldName }, { ref_for: true }, fieldSchema, {
131
+ class: fieldSchema.formItemClass,
132
+ rules: fieldSchema.rules
133
+ }), {
134
+ default: withCtx((slotProps) => [renderSlot(_ctx.$slots, fieldSchema.fieldName, mergeProps({ ref_for: true }, slotProps))]),
135
+ _: 2
136
+ }, 1040, ["class", "rules"]);
137
+ }), 128))]),
138
+ _: 2
139
+ }, 1032, [
140
+ "content-class",
141
+ "hidden",
142
+ "schema"
143
+ ])) : (openBlock(), createBlock(_sfc_main$1, mergeProps({
144
+ key: 1,
145
+ ref_for: true
146
+ }, cSchema, {
147
+ class: cSchema.formItemClass,
148
+ rules: cSchema.rules
149
+ }), {
150
+ default: withCtx((slotProps) => [renderSlot(_ctx.$slots, cSchema.fieldName, mergeProps({ ref_for: true }, slotProps))]),
151
+ _: 2
152
+ }, 1040, ["class", "rules"]))], 64);
153
+ }), 128)), renderSlot(_ctx.$slots, "default", {
154
+ gridId: unref(gridId),
155
+ shapes: shapes.value
156
+ })], 10, _hoisted_1)]),
157
+ _: 3
158
+ }, 16);
159
+ };
160
+ }
161
+ });
162
+ //#endregion
163
+ export { _sfc_main as default };
@@ -0,0 +1,89 @@
1
+ import _sfc_main$1 from "../../components/render-content/render-content.mjs";
2
+ import "../../index.mjs";
3
+ import { injectRenderFormProps } from "./form-render.context.mjs";
4
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderSlot, resolveDynamicComponent, unref, vShow, watch, withCtx, withDirectives } from "vue";
5
+ import PIcon from "pohon-ui/components/Icon.vue";
6
+ import PCollapsible from "pohon-ui/components/Collapsible.vue";
7
+ //#region src/form/form-render/form-render-group.vue
8
+ const _hoisted_1 = { class: "form-group-header mb-2 flex flex-1 gap-2 min-h-7 items-center" };
9
+ const _hoisted_2 = {
10
+ key: 0,
11
+ class: "form-group-title text-sm leading-6 font-medium"
12
+ };
13
+ const _hoisted_3 = {
14
+ key: 0,
15
+ class: "flex-none"
16
+ };
17
+ const _sfc_main = /*@__PURE__*/ defineComponent({
18
+ __name: "form-render-group",
19
+ props: {
20
+ contentClass: {
21
+ type: [
22
+ Boolean,
23
+ null,
24
+ String,
25
+ Object,
26
+ Array
27
+ ],
28
+ default: ""
29
+ },
30
+ hidden: {
31
+ type: Boolean,
32
+ default: false
33
+ },
34
+ schema: {}
35
+ },
36
+ setup(__props) {
37
+ const props = __props;
38
+ const formRenderProps = injectRenderFormProps();
39
+ const collapseOpen = ref(props.schema.collapsible === false || !props.schema.defaultCollapsed);
40
+ const shouldCollapsible = computed(() => {
41
+ return props.schema.collapsible !== false;
42
+ });
43
+ const hasInvalidField = computed(() => {
44
+ const errors = formRenderProps.form?.errors ?? {};
45
+ return props.schema.children.some(({ fieldName }) => Object.entries(errors).some(([errorFieldName, error]) => Boolean(error) && (errorFieldName === fieldName || errorFieldName.startsWith(`${fieldName}.`) || errorFieldName.startsWith(`${fieldName}[`))));
46
+ });
47
+ watch(hasInvalidField, (invalid) => {
48
+ if (invalid && !collapseOpen.value) collapseOpen.value = true;
49
+ });
50
+ function toggleGroup() {
51
+ if (shouldCollapsible.value) collapseOpen.value = !collapseOpen.value;
52
+ }
53
+ return (_ctx, _cache) => {
54
+ return withDirectives((openBlock(), createElementBlock("div", { class: normalizeClass(["form-group flex flex-col col-span-full w-full", props.schema.formItemClass]) }, [createElementVNode("div", _hoisted_1, [(openBlock(), createBlock(resolveDynamicComponent(shouldCollapsible.value ? "button" : "div"), {
55
+ "aria-expanded": shouldCollapsible.value ? collapseOpen.value : void 0,
56
+ "aria-label": shouldCollapsible.value && !props.schema.title ? "Toggle group" : void 0,
57
+ class: normalizeClass([[{ "focus-visible:ring-ring cursor-pointer select-none rounded-sm outline-none focus-visible:ring-2": shouldCollapsible.value }], "form-group-trigger text-left flex flex-1 gap-2 min-w-0 items-center"]),
58
+ type: shouldCollapsible.value ? "button" : void 0,
59
+ onClick: toggleGroup
60
+ }, {
61
+ default: withCtx(() => [
62
+ _cache[1] || (_cache[1] = createElementVNode("span", { class: "rounded-full bg-primary flex-none h-3.5 w-[3px]" }, null, -1)),
63
+ props.schema.title ? (openBlock(), createElementBlock("span", _hoisted_2, [createVNode(unref(_sfc_main$1), { content: props.schema.title }, null, 8, ["content"])])) : createCommentVNode("v-if", true),
64
+ shouldCollapsible.value ? (openBlock(), createBlock(PIcon, {
65
+ key: 1,
66
+ name: "lucide-chevron-down",
67
+ class: normalizeClass(["color-text-muted flex-none transition-transform", [{ "rotate-180": collapseOpen.value }]])
68
+ }, null, 8, ["class"])) : createCommentVNode("v-if", true)
69
+ ]),
70
+ _: 1
71
+ }, 8, [
72
+ "aria-expanded",
73
+ "aria-label",
74
+ "class",
75
+ "type"
76
+ ])), props.schema.extra ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(unref(_sfc_main$1), { content: props.schema.extra }, null, 8, ["content"])])) : createCommentVNode("v-if", true)]), createVNode(PCollapsible, {
77
+ open: collapseOpen.value,
78
+ "onUpdate:open": _cache[0] || (_cache[0] = ($event) => collapseOpen.value = $event),
79
+ disabled: !shouldCollapsible.value,
80
+ "unmount-on-hide": false
81
+ }, {
82
+ content: withCtx(() => [createElementVNode("div", { class: normalizeClass(props.contentClass) }, [renderSlot(_ctx.$slots, "default")], 2)]),
83
+ _: 3
84
+ }, 8, ["open", "disabled"])], 2)), [[vShow, !props.hidden]]);
85
+ };
86
+ }
87
+ });
88
+ //#endregion
89
+ export { _sfc_main as default };
@@ -0,0 +1,10 @@
1
+ import { createContext } from "../../index.mjs";
2
+ import { computed } from "vue";
3
+ //#region src/form/form-render/form-render.context.ts
4
+ const [injectRenderFormProps, provideFormRenderProps] = createContext("FormRenderProps");
5
+ function useFormContext() {
6
+ const formRenderProps = injectRenderFormProps();
7
+ return { componentMap: computed(() => formRenderProps.componentMap) };
8
+ }
9
+ //#endregion
10
+ export { injectRenderFormProps, provideFormRenderProps, useFormContext };
@@ -0,0 +1,101 @@
1
+ import { resolveFieldNamePath } from "../form.field-name.mjs";
2
+ import { injectFormProps } from "../form.use-form-context.mjs";
3
+ import { injectRenderFormProps } from "./form-render.context.mjs";
4
+ import { computed, isRef, onScopeDispose, shallowRef, watch } from "vue";
5
+ import { clone, get, isDeepEqual } from "@vinicunca/taman-core/utils";
6
+ //#region src/form/form-render/form-render.dependencies.ts
7
+ /**
8
+ * Resolve the value of the nested objects corresponding to the field name
9
+ * @param values form values
10
+ * @param fieldName field name
11
+ */
12
+ function resolveValueByFieldName(values, fieldName) {
13
+ const { rawKey } = resolveFieldNamePath(fieldName);
14
+ if (rawKey) return values[rawKey];
15
+ return get(values, fieldName);
16
+ }
17
+ function createDependencyState(patch = {}) {
18
+ return {
19
+ dynamicComponentProps: patch.componentProps ?? {},
20
+ dynamicHelp: patch.help,
21
+ dynamicHelpResolved: Reflect.has(patch, "help"),
22
+ dynamicRenderComponentContent: patch.renderComponentContent,
23
+ dynamicRenderComponentContentResolved: Reflect.has(patch, "renderComponentContent"),
24
+ dynamicRules: patch.rules,
25
+ dynamicRulesResolved: Reflect.has(patch, "rules"),
26
+ isDisabled: patch.disabled ?? false,
27
+ isIf: patch.if ?? true,
28
+ isRequired: patch.required ?? false,
29
+ isShow: patch.show ?? true
30
+ };
31
+ }
32
+ function useDependencies(getDependencies, getSchemaContext = () => ({})) {
33
+ const [extendApi] = injectFormProps();
34
+ const formApi = injectRenderFormProps().form;
35
+ if (!formApi) throw new Error("Form api is required in useDependencies");
36
+ const values = formApi.useValues();
37
+ const initialTriggerFields = getDependencies()?.triggerFields ?? [];
38
+ const initialTriggerValues = formApi.useFieldValues(initialTriggerFields);
39
+ function getController() {
40
+ const controller = isRef(extendApi) ? extendApi.value.formApi : extendApi.formApi;
41
+ if (!controller) throw new Error("formApi is required in useDependencies");
42
+ return controller;
43
+ }
44
+ const dependencyState = shallowRef(createDependencyState());
45
+ let previousDependencies;
46
+ let previousTriggerValues;
47
+ let dependencyEvaluationId = 0;
48
+ const triggerFieldValues = computed(() => {
49
+ const triggerFields = getDependencies()?.triggerFields ?? [];
50
+ if (triggerFields.length === initialTriggerFields.length && triggerFields.every((fieldName, index) => fieldName === initialTriggerFields[index])) return initialTriggerValues.value;
51
+ return triggerFields.map((dep) => {
52
+ return resolveValueByFieldName(values.value, dep);
53
+ });
54
+ });
55
+ function resetConditionState() {
56
+ dependencyState.value = createDependencyState();
57
+ }
58
+ watch([triggerFieldValues, getDependencies], async ([currentTriggerValues, dependencies]) => {
59
+ if (!dependencies || !dependencies?.triggerFields?.length) {
60
+ dependencyEvaluationId += 1;
61
+ previousDependencies = dependencies;
62
+ previousTriggerValues = void 0;
63
+ resetConditionState();
64
+ return;
65
+ }
66
+ if (dependencies === previousDependencies && previousTriggerValues && isDeepEqual(currentTriggerValues, previousTriggerValues)) return;
67
+ previousDependencies = dependencies;
68
+ previousTriggerValues = clone(currentTriggerValues);
69
+ const currentEvaluationId = ++dependencyEvaluationId;
70
+ const context = {
71
+ actions: formApi,
72
+ controller: getController(),
73
+ schema: {
74
+ ...getSchemaContext(),
75
+ rootValues: values.value
76
+ },
77
+ values: values.value
78
+ };
79
+ const patch = await dependencies.resolve(context);
80
+ if (currentEvaluationId !== dependencyEvaluationId) return;
81
+ dependencyState.value = createDependencyState(patch);
82
+ }, { immediate: true });
83
+ onScopeDispose(() => {
84
+ dependencyEvaluationId += 1;
85
+ });
86
+ return {
87
+ dynamicComponentProps: computed(() => dependencyState.value.dynamicComponentProps),
88
+ dynamicHelp: computed(() => dependencyState.value.dynamicHelp),
89
+ dynamicHelpResolved: computed(() => dependencyState.value.dynamicHelpResolved),
90
+ dynamicRenderComponentContent: computed(() => dependencyState.value.dynamicRenderComponentContent),
91
+ dynamicRenderComponentContentResolved: computed(() => dependencyState.value.dynamicRenderComponentContentResolved),
92
+ dynamicRules: computed(() => dependencyState.value.dynamicRules),
93
+ dynamicRulesResolved: computed(() => dependencyState.value.dynamicRulesResolved),
94
+ isDisabled: computed(() => dependencyState.value.isDisabled),
95
+ isIf: computed(() => dependencyState.value.isIf),
96
+ isRequired: computed(() => dependencyState.value.isRequired),
97
+ isShow: computed(() => dependencyState.value.isShow)
98
+ };
99
+ }
100
+ //#endregion
101
+ export { useDependencies as default };
@@ -0,0 +1,31 @@
1
+ import { toRaw } from "vue";
2
+ import { isString } from "@vinicunca/taman-core/utils";
3
+ import { ZodPipe } from "zod";
4
+ //#region src/form/form-render/form-render.helper.ts
5
+ /**
6
+ * Get the lowest level Zod type.
7
+ * This will unpack optionals, refinements, etc.
8
+ */
9
+ function getBaseRules(schema) {
10
+ if (!schema || isString(schema)) return null;
11
+ const rawSchema = toRaw(schema);
12
+ if (rawSchema instanceof ZodPipe) return getBaseRules(rawSchema.in);
13
+ if (rawSchema._zod?.def?.type === "array") return rawSchema;
14
+ const unwrappedSchema = rawSchema.unwrap?.();
15
+ if (unwrappedSchema && unwrappedSchema !== rawSchema) return getBaseRules(unwrappedSchema);
16
+ return rawSchema;
17
+ }
18
+ /**
19
+ * Search for a "ZodDefault" in the Zod stack and return its value.
20
+ */
21
+ function getDefaultValueInZodStack(schema) {
22
+ if (!schema || isString(schema)) return;
23
+ try {
24
+ const result = toRaw(schema).safeParse(void 0);
25
+ return result.success ? result.data : void 0;
26
+ } catch {
27
+ return;
28
+ }
29
+ }
30
+ //#endregion
31
+ export { getBaseRules, getDefaultValueInZodStack };
@@ -0,0 +1,209 @@
1
+ import { resolveChildUpdateFieldName } from "../form.field-name.mjs";
2
+ import { get, isFunctionType, mergeWithArrayOverride } from "@vinicunca/taman-core/utils";
3
+ //#region src/form/form-render/form-render.schema.ts
4
+ function createSchemaContext(baseContext, values) {
5
+ const rootValues = values;
6
+ return {
7
+ ...baseContext,
8
+ rootValues,
9
+ row: baseContext.rowPath && rootValues ? get(rootValues, baseContext.rowPath) : void 0
10
+ };
11
+ }
12
+ function scopeRowFieldName(rowPath, fieldName) {
13
+ if (!fieldName) return fieldName;
14
+ if (fieldName.startsWith("$root.")) return fieldName.slice(6);
15
+ if (fieldName.startsWith("$row.")) return `${rowPath}.${fieldName.slice(5)}`;
16
+ if (fieldName === rowPath || fieldName.startsWith(`${rowPath}.`)) return fieldName;
17
+ return `${rowPath}.${fieldName}`;
18
+ }
19
+ function wrapSchemaContextRender(render, baseContext) {
20
+ if (!isFunctionType(render)) return render;
21
+ return (() => render(baseContext));
22
+ }
23
+ function wrapCommonConfig(commonConfig, baseContext) {
24
+ if (!commonConfig || !isFunctionType(commonConfig.componentProps)) return commonConfig;
25
+ return {
26
+ ...commonConfig,
27
+ componentProps: wrapSchemaContextRender(commonConfig.componentProps, baseContext)
28
+ };
29
+ }
30
+ function scopeDependencies(dependencies, baseContext) {
31
+ if (!dependencies) return dependencies;
32
+ const rowPath = baseContext.rowPath;
33
+ if (!rowPath) return dependencies;
34
+ const triggerFields = dependencies.triggerFields?.map((fieldName) => scopeRowFieldName(rowPath, fieldName)) ?? [];
35
+ const resolve = dependencies.resolve;
36
+ return {
37
+ resolve(context) {
38
+ return resolve({
39
+ ...context,
40
+ schema: createSchemaContext(baseContext, context.values)
41
+ });
42
+ },
43
+ triggerFields
44
+ };
45
+ }
46
+ function createArrayComponentProps(schema, options) {
47
+ const componentProps = schema.componentProps;
48
+ const arrayProps = "arrayProps" in schema ? schema.arrayProps : void 0;
49
+ const children = getFormArraySchemaChildren(schema);
50
+ const commonConfig = options.commonConfig;
51
+ const globalCommonConfig = options.globalCommonConfig;
52
+ const schemaProps = children.length > 0 ? { schema: children } : {};
53
+ if (isFunctionType(componentProps)) return () => ({
54
+ ...arrayProps,
55
+ ...componentProps({ fieldName: schema.fieldName }),
56
+ commonConfig,
57
+ globalCommonConfig,
58
+ ...schemaProps
59
+ });
60
+ return {
61
+ ...arrayProps,
62
+ ...componentProps,
63
+ commonConfig,
64
+ globalCommonConfig,
65
+ ...schemaProps
66
+ };
67
+ }
68
+ function createArrayFieldSchema(schema, options) {
69
+ const restSchema = { ...schema };
70
+ Reflect.deleteProperty(restSchema, "arrayProps");
71
+ Reflect.deleteProperty(restSchema, "children");
72
+ Reflect.deleteProperty(restSchema, "type");
73
+ return {
74
+ ...restSchema,
75
+ component: "TamanFormFieldArray",
76
+ componentProps: createArrayComponentProps(schema, options)
77
+ };
78
+ }
79
+ function isFormGroupSchema(schema) {
80
+ return "type" in schema && schema.type === "group";
81
+ }
82
+ /**
83
+ * Expand groups to get all field schemas in the form
84
+ */
85
+ function getFormFieldSchemas(schemas) {
86
+ return schemas.flatMap((schema) => isFormGroupSchema(schema) ? schema.children : [schema]);
87
+ }
88
+ function setSchemaChildren(schema, children) {
89
+ if ("children" in schema && Array.isArray(schema.children)) return {
90
+ ...schema,
91
+ children
92
+ };
93
+ if (!isFunctionType(schema.componentProps) && schema.componentProps && Array.isArray(schema.componentProps.schema)) return {
94
+ ...schema,
95
+ componentProps: {
96
+ ...schema.componentProps,
97
+ schema: children
98
+ }
99
+ };
100
+ return schema;
101
+ }
102
+ function getFormArraySchemaChildren(schema) {
103
+ if ("children" in schema && Array.isArray(schema.children)) return schema.children;
104
+ const componentProps = schema.componentProps;
105
+ if (!isFunctionType(componentProps) && componentProps && Array.isArray(componentProps.schema)) return componentProps.schema;
106
+ return [];
107
+ }
108
+ function isFormArraySchema(schema) {
109
+ return "type" in schema && schema.type === "array" || schema.component === "TamanFormFieldArray" || getFormArraySchemaChildren(schema).length > 0;
110
+ }
111
+ function resolveArrayChildFieldName(rowPath, fieldName) {
112
+ return scopeRowFieldName(rowPath, fieldName);
113
+ }
114
+ function updateFormSchemaList(currentSchema, updated) {
115
+ return currentSchema.map((schema) => {
116
+ if (isFormGroupSchema(schema)) return setSchemaChildren(schema, updateFormSchemaList(schema.children ?? [], updated));
117
+ const { fieldName: schemaFieldName } = schema;
118
+ if (!schemaFieldName) return schema;
119
+ const exactUpdatedData = updated.find((item) => item.fieldName === schemaFieldName);
120
+ if (exactUpdatedData) return mergeWithArrayOverride(exactUpdatedData, schema);
121
+ const children = getFormArraySchemaChildren(schema);
122
+ if (children.length === 0) return schema;
123
+ const childUpdates = updated.flatMap((item) => {
124
+ const fieldName = item.fieldName ? resolveChildUpdateFieldName(schemaFieldName, item.fieldName) : void 0;
125
+ return fieldName ? [{
126
+ ...item,
127
+ fieldName
128
+ }] : [];
129
+ });
130
+ if (childUpdates.length === 0) return schema;
131
+ return setSchemaChildren(schema, updateFormSchemaList(children, childUpdates));
132
+ });
133
+ }
134
+ /**
135
+ * Remove schema by field name, handle the fields inside the group, and keep the group shell
136
+ */
137
+ function removeFormSchemaByFields(currentSchema, fields) {
138
+ const fieldSet = new Set(fields);
139
+ const result = [];
140
+ for (const schema of currentSchema) {
141
+ if (isFormGroupSchema(schema)) {
142
+ result.push(setSchemaChildren(schema, removeFormSchemaByFields(schema.children ?? [], fields)));
143
+ continue;
144
+ }
145
+ if (!schema.fieldName || !fieldSet.has(schema.fieldName)) result.push(schema);
146
+ }
147
+ return result;
148
+ }
149
+ function createFormFieldSchema(schema, options = {}) {
150
+ const { componentProps = {}, controlClass = "", disabled, formFieldProps = {}, formItemClass = "", hideLabel = false, hideMessage = false, hideRequiredMark = false, labelClass = "", modelPropName = "", wrapperClass = "" } = mergeWithArrayOverride(options.commonConfig ?? {}, options.globalCommonConfig ?? {});
151
+ const normalizedSchema = isFormArraySchema(schema) ? createArrayFieldSchema(schema, options) : schema;
152
+ const commonComponentProps = isFunctionType(componentProps) ? componentProps({ fieldName: normalizedSchema.fieldName }) : componentProps;
153
+ let resolvedSchemaFormItemClass = normalizedSchema.formItemClass;
154
+ if (isFunctionType(normalizedSchema.formItemClass)) try {
155
+ resolvedSchemaFormItemClass = normalizedSchema.formItemClass();
156
+ } catch (error) {
157
+ console.error("Error calling formItemClass function:", error);
158
+ resolvedSchemaFormItemClass = "";
159
+ }
160
+ return {
161
+ hideMessage,
162
+ hideRequiredMark,
163
+ modelPropName,
164
+ wrapperClass,
165
+ ...normalizedSchema,
166
+ commonComponentProps,
167
+ componentProps: normalizedSchema.componentProps,
168
+ controlClass: [controlClass, normalizedSchema.controlClass].filter(Boolean).join(" "),
169
+ formFieldProps: {
170
+ ...formFieldProps,
171
+ ...normalizedSchema.formFieldProps
172
+ },
173
+ formItemClass: [
174
+ "shrink-0",
175
+ formItemClass,
176
+ resolvedSchemaFormItemClass
177
+ ].filter(Boolean).join(" "),
178
+ hidden: Boolean(options.hidden),
179
+ labelClass: [labelClass, normalizedSchema.labelClass].filter(Boolean).join(" "),
180
+ disabled: options.disabled ?? normalizedSchema.disabled ?? disabled,
181
+ hideLabel: options.forceHideLabel ?? normalizedSchema.hideLabel ?? hideLabel
182
+ };
183
+ }
184
+ function createArrayChildSchema(schema, options) {
185
+ const rowPath = `${options.arrayField}[${options.index}]`;
186
+ const fieldName = resolveArrayChildFieldName(rowPath, schema.fieldName);
187
+ const baseContext = {
188
+ arrayField: options.arrayField,
189
+ fieldName,
190
+ originalFieldName: schema.fieldName,
191
+ rowIndex: options.index,
192
+ rowPath
193
+ };
194
+ return createFormFieldSchema({
195
+ ...schema,
196
+ componentProps: wrapSchemaContextRender(schema.componentProps, baseContext),
197
+ dependencies: scopeDependencies(schema.dependencies, baseContext),
198
+ fieldName,
199
+ help: wrapSchemaContextRender(schema.help, baseContext),
200
+ renderComponentContent: wrapSchemaContextRender(schema.renderComponentContent, baseContext)
201
+ }, {
202
+ commonConfig: wrapCommonConfig(options.commonConfig, baseContext),
203
+ disabled: options.disabled || schema.disabled,
204
+ forceHideLabel: true,
205
+ globalCommonConfig: wrapCommonConfig(options.globalCommonConfig, baseContext)
206
+ });
207
+ }
208
+ //#endregion
209
+ export { createArrayChildSchema, createFormFieldSchema, getFormArraySchemaChildren, getFormFieldSchemas, isFormArraySchema, isFormGroupSchema, removeFormSchemaByFields, resolveArrayChildFieldName, updateFormSchemaList };
@@ -0,0 +1,4 @@
1
+ import "./form-render-form-label.mjs";
2
+ import "./form-render-form-field.mjs";
3
+ import _sfc_main$2 from "./form-render-form.mjs";
4
+ export { _sfc_main$2 as FormRenderForm };