@xbeeant/form-engine-designer 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +69 -0
  2. package/dist/es/Canvas.js +636 -0
  3. package/dist/es/Canvas.js.map +1 -0
  4. package/dist/es/Designer.js +162 -0
  5. package/dist/es/Designer.js.map +1 -0
  6. package/dist/es/DesignerContext.js +97 -0
  7. package/dist/es/DesignerContext.js.map +1 -0
  8. package/dist/es/Palette.js +148 -0
  9. package/dist/es/Palette.js.map +1 -0
  10. package/dist/es/PropertyPanel.js +294 -0
  11. package/dist/es/PropertyPanel.js.map +1 -0
  12. package/dist/es/ResizablePanel.js +103 -0
  13. package/dist/es/ResizablePanel.js.map +1 -0
  14. package/dist/es/catalog.js +514 -0
  15. package/dist/es/catalog.js.map +1 -0
  16. package/dist/es/form-engine-designer.css +1 -0
  17. package/dist/es/index.js +20 -0
  18. package/dist/es/index.js.map +1 -0
  19. package/dist/es/property/basic-property.js +115 -0
  20. package/dist/es/property/basic-property.js.map +1 -0
  21. package/dist/es/react/src/components/FormController.js +154 -0
  22. package/dist/es/react/src/components/FormController.js.map +1 -0
  23. package/dist/es/react/src/components/NexusField.js +99 -0
  24. package/dist/es/react/src/components/NexusField.js.map +1 -0
  25. package/dist/es/react/src/components/NexusForm.js +121 -0
  26. package/dist/es/react/src/components/NexusForm.js.map +1 -0
  27. package/dist/es/react/src/components/NexusFormProvider.js +19 -0
  28. package/dist/es/react/src/components/NexusFormProvider.js.map +1 -0
  29. package/dist/es/react/src/components/NexusLayout.js +49 -0
  30. package/dist/es/react/src/components/NexusLayout.js.map +1 -0
  31. package/dist/es/react/src/components/NexusObject.js +65 -0
  32. package/dist/es/react/src/components/NexusObject.js.map +1 -0
  33. package/dist/es/react/src/contexts/FieldInheritContext.js +6 -0
  34. package/dist/es/react/src/contexts/FieldInheritContext.js.map +1 -0
  35. package/dist/es/react/src/contexts/GridContext.js +6 -0
  36. package/dist/es/react/src/contexts/GridContext.js.map +1 -0
  37. package/dist/es/react/src/contexts/LayoutConfigContext.js +6 -0
  38. package/dist/es/react/src/contexts/LayoutConfigContext.js.map +1 -0
  39. package/dist/es/react/src/contexts/NexusContext.js +13 -0
  40. package/dist/es/react/src/contexts/NexusContext.js.map +1 -0
  41. package/dist/es/react/src/hooks/useForm.js +10 -0
  42. package/dist/es/react/src/hooks/useForm.js.map +1 -0
  43. package/dist/es/react/src/utils/renderTreeNode.js +18 -0
  44. package/dist/es/react/src/utils/renderTreeNode.js.map +1 -0
  45. package/dist/es/react/src/utils/resolveColSpan.js +10 -0
  46. package/dist/es/react/src/utils/resolveColSpan.js.map +1 -0
  47. package/dist/es/schemaUtils.js +286 -0
  48. package/dist/es/schemaUtils.js.map +1 -0
  49. package/dist/es/schemaUtils.test.js +188 -0
  50. package/dist/es/schemaUtils.test.js.map +1 -0
  51. package/dist/es/types.js +2 -0
  52. package/dist/es/types.js.map +1 -0
  53. package/dist/es/vite-env.d.js +2 -0
  54. package/dist/es/vite-env.d.js.map +1 -0
  55. package/dist/es/widgets/BindEditor.js +67 -0
  56. package/dist/es/widgets/BindEditor.js.map +1 -0
  57. package/dist/es/widgets/CodeEditor.js +84 -0
  58. package/dist/es/widgets/CodeEditor.js.map +1 -0
  59. package/dist/es/widgets/DefaultEditor.js +55 -0
  60. package/dist/es/widgets/DefaultEditor.js.map +1 -0
  61. package/dist/es/widgets/DependenciesEditor.js +36 -0
  62. package/dist/es/widgets/DependenciesEditor.js.map +1 -0
  63. package/dist/es/widgets/EnumEditor.js +49 -0
  64. package/dist/es/widgets/EnumEditor.js.map +1 -0
  65. package/dist/es/widgets/ExpressionBuilder.js +367 -0
  66. package/dist/es/widgets/ExpressionBuilder.js.map +1 -0
  67. package/dist/es/widgets/ExpressionSwitch.js +47 -0
  68. package/dist/es/widgets/ExpressionSwitch.js.map +1 -0
  69. package/dist/es/widgets/OptionsEditor.js +102 -0
  70. package/dist/es/widgets/OptionsEditor.js.map +1 -0
  71. package/dist/es/widgets/ReactionsEditor.js +401 -0
  72. package/dist/es/widgets/ReactionsEditor.js.map +1 -0
  73. package/dist/es/widgets/RemoteDataEditor.js +314 -0
  74. package/dist/es/widgets/RemoteDataEditor.js.map +1 -0
  75. package/dist/es/widgets/ValidateEditor.js +118 -0
  76. package/dist/es/widgets/ValidateEditor.js.map +1 -0
  77. package/dist/es/widgets/expressionModel.js +340 -0
  78. package/dist/es/widgets/expressionModel.js.map +1 -0
  79. package/dist/es/widgets/expressionModel.test.js +193 -0
  80. package/dist/es/widgets/expressionModel.test.js.map +1 -0
  81. package/dist/es/widgets/index.js +57 -0
  82. package/dist/es/widgets/index.js.map +1 -0
  83. package/dist/es/widgets/reactionsModel.js +107 -0
  84. package/dist/es/widgets/reactionsModel.js.map +1 -0
  85. package/dist/es/widgets/useFormDataFields.js +16 -0
  86. package/dist/es/widgets/useFormDataFields.js.map +1 -0
  87. package/package.json +62 -0
  88. package/src/Canvas.tsx +1111 -0
  89. package/src/Designer.css +206 -0
  90. package/src/Designer.tsx +254 -0
  91. package/src/DesignerContext.tsx +192 -0
  92. package/src/Palette.tsx +261 -0
  93. package/src/PropertyPanel.tsx +486 -0
  94. package/src/ResizablePanel.tsx +210 -0
  95. package/src/catalog.ts +526 -0
  96. package/src/index.ts +25 -0
  97. package/src/property/basic-property.ts +126 -0
  98. package/src/schemaUtils.test.ts +261 -0
  99. package/src/schemaUtils.ts +627 -0
  100. package/src/types.ts +38 -0
  101. package/src/vite-env.d.ts +1 -0
  102. package/src/widgets/BindEditor.tsx +105 -0
  103. package/src/widgets/CodeEditor.tsx +114 -0
  104. package/src/widgets/DefaultEditor.tsx +73 -0
  105. package/src/widgets/DependenciesEditor.tsx +56 -0
  106. package/src/widgets/EnumEditor.tsx +66 -0
  107. package/src/widgets/ExpressionBuilder.tsx +509 -0
  108. package/src/widgets/ExpressionSwitch.tsx +62 -0
  109. package/src/widgets/OptionsEditor.tsx +141 -0
  110. package/src/widgets/ReactionsEditor.tsx +532 -0
  111. package/src/widgets/RemoteDataEditor.tsx +382 -0
  112. package/src/widgets/ValidateEditor.tsx +162 -0
  113. package/src/widgets/expressionModel.test.ts +262 -0
  114. package/src/widgets/expressionModel.ts +573 -0
  115. package/src/widgets/index.ts +45 -0
  116. package/src/widgets/reactionsModel.ts +190 -0
  117. package/src/widgets/useFormDataFields.ts +21 -0
@@ -0,0 +1,49 @@
1
+ import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
+ import { useContext as y, useMemo as f } from "react";
3
+ import { GridContext as h } from "../contexts/GridContext.js";
4
+ import { LayoutConfigContext as p } from "../contexts/LayoutConfigContext.js";
5
+ import { useNexusContext as v } from "../contexts/NexusContext.js";
6
+ import { renderTreeNode as x } from "../utils/renderTreeNode.js";
7
+ import { resolveColSpan as C } from "../utils/resolveColSpan.js";
8
+ function O({ node: t }) {
9
+ const { engine: n } = v(), r = n.getLayout(t.type), i = t.children.map(
10
+ (c, d) => x(c, d)
11
+ ), a = y(h), l = C(t.props.colSpan, a), o = {
12
+ ...l ? { gridColumn: `span ${l}` } : {},
13
+ ...t.props.width ? { width: t.props.width, flexShrink: 0 } : {}
14
+ }, s = f(
15
+ () => ({ removeHidden: t.props.removeHidden }),
16
+ [t.props.removeHidden]
17
+ );
18
+ if (!r)
19
+ return /* @__PURE__ */ e(p.Provider, { value: s, children: /* @__PURE__ */ u(
20
+ "div",
21
+ {
22
+ "data-nexus-layout": t.type,
23
+ className: "mb-4",
24
+ style: Object.keys(o).length > 0 ? o : void 0,
25
+ children: [
26
+ t.title && /* @__PURE__ */ e("div", { className: "mb-2 font-bold", children: t.title }),
27
+ i
28
+ ]
29
+ }
30
+ ) });
31
+ const {
32
+ displayType: g,
33
+ labelWidth: w,
34
+ colSpan: b,
35
+ width: S,
36
+ ...m
37
+ } = t.props;
38
+ return /* @__PURE__ */ e(p.Provider, { value: s, children: /* @__PURE__ */ e(
39
+ "div",
40
+ {
41
+ style: Object.keys(o).length > 0 ? o : void 0,
42
+ children: /* @__PURE__ */ e(r, { ...m, node: t, title: t.title, children: i })
43
+ }
44
+ ) });
45
+ }
46
+ export {
47
+ O as NexusLayout
48
+ };
49
+ //# sourceMappingURL=NexusLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NexusLayout.js","sources":["../../../../../../react/src/components/NexusLayout.tsx"],"sourcesContent":["import type { RenderLayoutNode } from '@xbeeant/form-engine';\nimport type { CSSProperties } from 'react';\nimport { useContext, useMemo } from 'react';\n\nimport { GridContext } from '../contexts/GridContext';\nimport {\n LayoutConfigContext,\n type LayoutConfigContextValue,\n} from '../contexts/LayoutConfigContext';\nimport { useNexusContext } from '../contexts/NexusContext';\nimport { renderTreeNode } from '../utils/renderTreeNode';\nimport { resolveColSpan } from '../utils/resolveColSpan';\n\ninterface NexusLayoutProps {\n node: RenderLayoutNode;\n}\n\n/**\n * NexusLayout — 布局容器渲染器\n */\nexport function NexusLayout({ node }: NexusLayoutProps) {\n const { engine } = useNexusContext();\n\n const LayoutComponent = engine.getLayout(node.type);\n\n const children = node.children.map((child, index) =>\n renderTreeNode(child, index),\n );\n\n // 布局容器在父 Grid/Flex 中的跨列/宽度(与 NexusField wrapper 一致)\n const gridCtx = useContext(GridContext);\n const effectiveColSpan = resolveColSpan(node.props.colSpan, gridCtx);\n const wrapperStyle: CSSProperties = {\n ...(effectiveColSpan ? { gridColumn: `span ${effectiveColSpan}` } : {}),\n ...(node.props.width ? { width: node.props.width, flexShrink: 0 } : {}),\n };\n\n const layoutConfigValue = useMemo<LayoutConfigContextValue>(\n () => ({ removeHidden: node.props.removeHidden }),\n [node.props.removeHidden],\n );\n\n if (!LayoutComponent) {\n return (\n <LayoutConfigContext.Provider value={layoutConfigValue}>\n <div\n data-nexus-layout={node.type}\n className='mb-4'\n style={\n Object.keys(wrapperStyle).length > 0 ? wrapperStyle : undefined\n }\n >\n {node.title && <div className='mb-2 font-bold'>{node.title}</div>}\n {children}\n </div>\n </LayoutConfigContext.Provider>\n );\n }\n\n // 剥离布局配置属性(displayType / labelWidth / colSpan / width 是布局配置,\n // 不应透传到布局组件的 DOM 元素,否则触发 React unknown prop 警告)\n const {\n displayType: _dt,\n labelWidth: _lw,\n colSpan: _csp,\n width: _w,\n ...layoutProps\n } = node.props;\n\n return (\n <LayoutConfigContext.Provider value={layoutConfigValue}>\n <div\n style={Object.keys(wrapperStyle).length > 0 ? wrapperStyle : undefined}\n >\n <LayoutComponent {...layoutProps} node={node} title={node.title}>\n {children}\n </LayoutComponent>\n </div>\n </LayoutConfigContext.Provider>\n );\n}\n"],"names":["NexusLayout","node","engine","useNexusContext","LayoutComponent","children","child","index","renderTreeNode","gridCtx","useContext","GridContext","effectiveColSpan","resolveColSpan","wrapperStyle","layoutConfigValue","useMemo","jsx","LayoutConfigContext","jsxs","_dt","_lw","_csp","_w","layoutProps"],"mappings":";;;;;;;AAoBO,SAASA,EAAY,EAAE,MAAAC,KAA0B;AACtD,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAAA,GAEbC,IAAkBF,EAAO,UAAUD,EAAK,IAAI,GAE5CI,IAAWJ,EAAK,SAAS;AAAA,IAAI,CAACK,GAAOC,MACzCC,EAAeF,GAAOC,CAAK;AAAA,EAAA,GAIvBE,IAAUC,EAAWC,CAAW,GAChCC,IAAmBC,EAAeZ,EAAK,MAAM,SAASQ,CAAO,GAC7DK,IAA8B;AAAA,IAClC,GAAIF,IAAmB,EAAE,YAAY,QAAQA,CAAgB,GAAA,IAAO,CAAA;AAAA,IACpE,GAAIX,EAAK,MAAM,QAAQ,EAAE,OAAOA,EAAK,MAAM,OAAO,YAAY,MAAM,CAAA;AAAA,EAAC,GAGjEc,IAAoBC;AAAA,IACxB,OAAO,EAAE,cAAcf,EAAK,MAAM,aAAA;AAAA,IAClC,CAACA,EAAK,MAAM,YAAY;AAAA,EAAA;AAG1B,MAAI,CAACG;AACH,WACE,gBAAAa,EAACC,EAAoB,UAApB,EAA6B,OAAOH,GACnC,UAAA,gBAAAI;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,qBAAmBlB,EAAK;AAAA,QACxB,WAAU;AAAA,QACV,OACE,OAAO,KAAKa,CAAY,EAAE,SAAS,IAAIA,IAAe;AAAA,QAGvD,UAAA;AAAA,UAAAb,EAAK,SAAS,gBAAAgB,EAAC,OAAA,EAAI,WAAU,kBAAkB,YAAK,OAAM;AAAA,UAC1DZ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAEL;AAMJ,QAAM;AAAA,IACJ,aAAae;AAAA,IACb,YAAYC;AAAA,IACZ,SAASC;AAAA,IACT,OAAOC;AAAA,IACP,GAAGC;AAAA,EAAA,IACDvB,EAAK;AAET,SACE,gBAAAgB,EAACC,EAAoB,UAApB,EAA6B,OAAOH,GACnC,UAAA,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO,OAAO,KAAKH,CAAY,EAAE,SAAS,IAAIA,IAAe;AAAA,MAE7D,UAAA,gBAAAG,EAACb,KAAiB,GAAGoB,GAAa,MAAAvB,GAAY,OAAOA,EAAK,OACvD,UAAAI,EAAA,CACH;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -0,0 +1,65 @@
1
+ import { jsx as r, jsxs as u } from "react/jsx-runtime";
2
+ import { useContext as g, useSyncExternalStore as v, useState as x } from "react";
3
+ import { FieldInheritContext as h } from "../contexts/FieldInheritContext.js";
4
+ import { useNexusContext as y } from "../contexts/NexusContext.js";
5
+ import { renderTreeNode as C } from "../utils/renderTreeNode.js";
6
+ function O({ node: e }) {
7
+ const { engine: i, config: a } = y(), s = g(h);
8
+ v(
9
+ (t) => i.subscribeField(e.dataPath, t),
10
+ () => i.getFieldVersion(e.dataPath),
11
+ () => i.getFieldVersion(e.dataPath)
12
+ );
13
+ const n = i.getFieldState(e.dataPath), [o, m] = x(!1), l = (a.column ?? 1) > 1, d = l ? { gridTemplateColumns: `repeat(${a.column}, 1fr)` } : {}, c = {
14
+ disabled: s.disabled ?? (n?.disabled === !0 ? !0 : void 0),
15
+ readOnly: s.readOnly ?? (n?.readOnly === !0 ? !0 : void 0),
16
+ visible: s.visible === !1 || n?.visible === !1 ? !1 : void 0
17
+ }, p = c.visible === !1, b = () => m((t) => !t);
18
+ return /* @__PURE__ */ r(h.Provider, { value: c, children: /* @__PURE__ */ u(
19
+ "div",
20
+ {
21
+ "data-nexus-object": e.dataPath,
22
+ className: `mb-4 ${p ? "hidden" : ""}`,
23
+ children: [
24
+ e.title && /* @__PURE__ */ u(
25
+ "div",
26
+ {
27
+ onClick: b,
28
+ className: "flex gap-1 mb-2 cursor-pointer select-none border-none bg-transparent p-0 font-bold",
29
+ children: [
30
+ /* @__PURE__ */ r(
31
+ "svg",
32
+ {
33
+ width: "12",
34
+ height: "12",
35
+ viewBox: "0 0 24 24",
36
+ fill: "none",
37
+ stroke: "currentColor",
38
+ strokeWidth: "2",
39
+ strokeLinecap: "round",
40
+ strokeLinejoin: "round",
41
+ className: `align-middle transition-transform duration-200 ease-in-out ${o ? "rotate-0" : "rotate-90"}`,
42
+ "aria-hidden": "true",
43
+ children: /* @__PURE__ */ r("polyline", { points: "9 18 15 12 9 6" })
44
+ }
45
+ ),
46
+ e.title
47
+ ]
48
+ }
49
+ ),
50
+ /* @__PURE__ */ r(
51
+ "div",
52
+ {
53
+ className: `${l ? "grid gap-x-4" : ""} ${o ? "hidden" : ""}`,
54
+ style: Object.keys(d).length > 0 ? d : void 0,
55
+ children: e.children.map((t, f) => C(t, f))
56
+ }
57
+ )
58
+ ]
59
+ }
60
+ ) });
61
+ }
62
+ export {
63
+ O as NexusObject
64
+ };
65
+ //# sourceMappingURL=NexusObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NexusObject.js","sources":["../../../../../../react/src/components/NexusObject.tsx"],"sourcesContent":["import type { RenderObjectNode } from '@xbeeant/form-engine';\nimport type { CSSProperties } from 'react';\nimport { useContext, useState, useSyncExternalStore } from 'react';\n\nimport { FieldInheritContext } from '../contexts/FieldInheritContext';\nimport { useNexusContext } from '../contexts/NexusContext';\nimport { renderTreeNode } from '../utils/renderTreeNode';\n\ninterface NexusObjectProps {\n node: RenderObjectNode;\n}\n\n/**\n * NexusObject — 数据对象容器(可折叠,支持 disabled/hidden/readOnly 属性配置)\n *\n * 点击 title 折叠/展开 children。\n * 折叠时仅以 display:none 隐藏 children,并不销毁(字段状态与订阅保持存活)。\n *\n * 属性继承:容器自身(Schema 布尔值 / 表达式 / setFieldState)配置的\n * disabled / readOnly / hidden 会经 FieldInheritContext 下发给子树,\n * 子树中的字段继承对应状态(disabled/readOnly 仅父级激活时生效)。\n */\nexport function NexusObject({ node }: NexusObjectProps) {\n const { engine, config } = useNexusContext();\n const parentInherit = useContext(FieldInheritContext);\n // 按路径精准订阅:自身 disabled/readOnly/visible 变化时重渲染并下发新上下文\n useSyncExternalStore(\n (onStoreChange) => engine.subscribeField(node.dataPath, onStoreChange),\n () => engine.getFieldVersion(node.dataPath),\n () => engine.getFieldVersion(node.dataPath),\n );\n const state = engine.getFieldState(node.dataPath);\n const [collapsed, setCollapsed] = useState(false);\n const isGrid = (config.column ?? 1) > 1;\n const gridStyle: CSSProperties = isGrid\n ? { gridTemplateColumns: `repeat(${config.column}, 1fr)` }\n : {};\n\n // 合并继承属性:父级已激活的状态不可被当前容器覆盖;\n // disabled/readOnly 仅携带 true(父级关闭状态不压制子级显式启用)\n const inherit = {\n disabled:\n parentInherit.disabled ?? (state?.disabled === true ? true : undefined),\n readOnly:\n parentInherit.readOnly ?? (state?.readOnly === true ? true : undefined),\n visible:\n parentInherit.visible === false || state?.visible === false\n ? false\n : undefined,\n };\n const hidden = inherit.visible === false;\n\n const toggleCollapsed = () => setCollapsed((prev) => !prev);\n\n return (\n <FieldInheritContext.Provider value={inherit}>\n <div\n data-nexus-object={node.dataPath}\n className={`mb-4 ${hidden ? 'hidden' : ''}`}\n >\n {node.title && (\n <div\n onClick={toggleCollapsed}\n className='flex gap-1 mb-2 cursor-pointer select-none border-none bg-transparent p-0 font-bold'\n >\n <svg\n width='12'\n height='12'\n viewBox='0 0 24 24'\n fill='none'\n stroke='currentColor'\n strokeWidth='2'\n strokeLinecap='round'\n strokeLinejoin='round'\n className={`align-middle transition-transform duration-200 ease-in-out ${collapsed ? 'rotate-0' : 'rotate-90'}`}\n aria-hidden='true'\n >\n <polyline points='9 18 15 12 9 6' />\n </svg>\n {node.title}\n </div>\n )}\n {/* 折叠时隐藏但不卸载 children,保持字段状态与校验订阅 */}\n <div\n className={`${isGrid ? 'grid gap-x-4' : ''} ${collapsed ? 'hidden' : ''}`}\n style={Object.keys(gridStyle).length > 0 ? gridStyle : undefined}\n >\n {node.children.map((child, index) => renderTreeNode(child, index))}\n </div>\n </div>\n </FieldInheritContext.Provider>\n );\n}\n"],"names":["NexusObject","node","engine","config","useNexusContext","parentInherit","useContext","FieldInheritContext","useSyncExternalStore","onStoreChange","state","collapsed","setCollapsed","useState","isGrid","gridStyle","inherit","hidden","toggleCollapsed","prev","jsx","jsxs","child","index","renderTreeNode"],"mappings":";;;;;AAsBO,SAASA,EAAY,EAAE,MAAAC,KAA0B;AACtD,QAAM,EAAE,QAAAC,GAAQ,QAAAC,EAAA,IAAWC,EAAA,GACrBC,IAAgBC,EAAWC,CAAmB;AAEpD,EAAAC;AAAA,IACE,CAACC,MAAkBP,EAAO,eAAeD,EAAK,UAAUQ,CAAa;AAAA,IACrE,MAAMP,EAAO,gBAAgBD,EAAK,QAAQ;AAAA,IAC1C,MAAMC,EAAO,gBAAgBD,EAAK,QAAQ;AAAA,EAAA;AAE5C,QAAMS,IAAQR,EAAO,cAAcD,EAAK,QAAQ,GAC1C,CAACU,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1CC,KAAUX,EAAO,UAAU,KAAK,GAChCY,IAA2BD,IAC7B,EAAE,qBAAqB,UAAUX,EAAO,MAAM,SAAA,IAC9C,CAAA,GAIEa,IAAU;AAAA,IACd,UACEX,EAAc,aAAaK,GAAO,aAAa,KAAO,KAAO;AAAA,IAC/D,U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AEJ;AAEJ;"}
@@ -0,0 +1,6 @@
1
+ import { createContext as t } from "react";
2
+ const o = t({});
3
+ export {
4
+ o as FieldInheritContext
5
+ };
6
+ //# sourceMappingURL=FieldInheritContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldInheritContext.js","sources":["../../../../../../react/src/contexts/FieldInheritContext.ts"],"sourcesContent":["import { createContext } from 'react';\n\n/**\n * 字段继承上下文 — 数据对象容器(NexusObject)向下游字段下发继承属性\n *\n * 语义:\n * - 仅「激活」状态被下发:disabled/readOnly 只在父容器显式启用时\n * 携带 true(父级未设置时上下文不存在该键),子字段自行合并\n * - visible 为 false 表示祖先对象容器隐藏,子树整体不可见\n * - 合并优先级:祖先(已激活) > 字段自身状态 > 默认值\n */\nexport interface FieldInheritValue {\n /** 祖先对象容器禁用(仅 true 存在) */\n disabled?: boolean;\n /** 祖先对象容器只读(仅 true 存在) */\n readOnly?: boolean;\n /** 祖先对象容器隐藏 → 子树不可见(false 存在时子树全部隐藏) */\n visible?: boolean;\n}\n\nexport const FieldInheritContext = createContext<FieldInheritValue>({});\n"],"names":["FieldInheritContext","createContext"],"mappings":";AAoBO,MAAMA,IAAsBC,EAAiC,CAAA,CAAE;"}
@@ -0,0 +1,6 @@
1
+ import { createContext as t } from "react";
2
+ const e = t(null);
3
+ export {
4
+ e as GridContext
5
+ };
6
+ //# sourceMappingURL=GridContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GridContext.js","sources":["../../../../../../react/src/contexts/GridContext.ts"],"sourcesContent":["import { createContext } from 'react';\n\n// 子项未显式设置 colSpan 时使用此默认值\nexport interface GridContextValue {\n /** 当前 grid 的列数(tailwind colSpan 基准) */\n column: number;\n}\nexport const GridContext = createContext<GridContextValue | null>(null);\n"],"names":["GridContext","createContext"],"mappings":";AAOO,MAAMA,IAAcC,EAAuC,IAAI;"}
@@ -0,0 +1,6 @@
1
+ import { createContext as t } from "react";
2
+ const e = t({});
3
+ export {
4
+ e as LayoutConfigContext
5
+ };
6
+ //# sourceMappingURL=LayoutConfigContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LayoutConfigContext.js","sources":["../../../../../../react/src/contexts/LayoutConfigContext.ts"],"sourcesContent":["import { createContext } from 'react';\n\nexport interface LayoutConfigContextValue {\n removeHidden?: boolean;\n}\nexport const LayoutConfigContext = createContext<LayoutConfigContextValue>({});\n"],"names":["LayoutConfigContext","createContext"],"mappings":";AAKO,MAAMA,IAAsBC,EAAwC,CAAA,CAAE;"}
@@ -0,0 +1,13 @@
1
+ import { useContext as t, createContext as o } from "react";
2
+ const r = o(null);
3
+ function u() {
4
+ const e = t(r);
5
+ if (!e)
6
+ throw new Error("[NexusField] Must be used within <NexusFormProvider>");
7
+ return e;
8
+ }
9
+ export {
10
+ r as NexusContext,
11
+ u as useNexusContext
12
+ };
13
+ //# sourceMappingURL=NexusContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NexusContext.js","sources":["../../../../../../react/src/contexts/NexusContext.ts"],"sourcesContent":["import type { NexusEngine } from '@xbeeant/form-engine';\nimport { createContext, type ReactNode, useContext } from 'react';\n\nimport type { FormController } from '../components/FormController';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Form 布局配置\n// ────────────────────────────────────────────────────────────────────────────\n\nexport interface NexusFormConfig {\n /** label 列配置(由 ui 层 Form.Item 消费) */\n labelCol?: Record<string, unknown>;\n /** label 宽度(px 或 %),快捷方式 — 映射到 labelCol.style.width */\n labelWidth?: number | string;\n /** 是否显示冒号 */\n colon?: boolean | ReactNode;\n /** 是否显示 label(默认 true) */\n label?: boolean;\n /** 表单布局方向 */\n displayType?: 'row' | 'column' | 'inline';\n /** 整个表单只读,所有字段以文本展示 */\n readOnly?: boolean;\n /** 表单每行显示多少列 */\n column?: number;\n}\n\ninterface NexusContextValue {\n engine: NexusEngine;\n config: NexusFormConfig;\n form: FormController;\n}\n\nexport const NexusContext = createContext<NexusContextValue | null>(null);\n\nexport function useNexusContext(): NexusContextValue {\n const ctx = useContext(NexusContext);\n if (!ctx) {\n throw new Error('[NexusField] Must be used within <NexusFormProvider>');\n }\n return ctx;\n}\n"],"names":["NexusContext","createContext","useNexusContext","ctx","useContext"],"mappings":";AAgCO,MAAMA,IAAeC,EAAwC,IAAI;AAEjE,SAASC,IAAqC;AACnD,QAAMC,IAAMC,EAAWJ,CAAY;AACnC,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,sDAAsD;AAExE,SAAOA;AACT;"}
@@ -0,0 +1,10 @@
1
+ import { useRef as e } from "react";
2
+ import { FormController as n } from "../components/FormController.js";
3
+ function f(o) {
4
+ const r = e(null);
5
+ return r.current || (r.current = new n(o)), [r.current];
6
+ }
7
+ export {
8
+ f as useForm
9
+ };
10
+ //# sourceMappingURL=useForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useForm.js","sources":["../../../../../../react/src/hooks/useForm.ts"],"sourcesContent":["import type { NexusEngine } from '@xbeeant/form-engine';\nimport { useRef } from 'react';\n\nimport { FormController } from '../components/FormController';\n\n/**\n * useForm — 创建 Form 实例\n */\nexport function useForm(engine?: NexusEngine): [FormController] {\n const formRef = useRef<FormController | null>(null);\n if (!formRef.current) {\n formRef.current = new FormController(engine);\n }\n return [formRef.current];\n}\n"],"names":["useForm","engine","formRef","useRef","FormController"],"mappings":";;AAQO,SAASA,EAAQC,GAAwC;AAC9D,QAAMC,IAAUC,EAA8B,IAAI;AAClD,SAAKD,EAAQ,YACXA,EAAQ,UAAU,IAAIE,EAAeH,CAAM,IAEtC,CAACC,EAAQ,OAAO;AACzB;"}
@@ -0,0 +1,18 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { NexusField as e } from "../components/NexusField.js";
3
+ import { NexusLayout as u } from "../components/NexusLayout.js";
4
+ import { NexusObject as y } from "../components/NexusObject.js";
5
+ function p(t, a) {
6
+ return t.type === "field" ? /* @__PURE__ */ r(
7
+ e,
8
+ {
9
+ dataPath: t.dataPath,
10
+ layoutKey: t.layoutKey
11
+ },
12
+ t.layoutKey || t.dataPath
13
+ ) : t.type === "object" ? /* @__PURE__ */ r(y, { node: t }, `object-${t.layoutKey}-${a}`) : /* @__PURE__ */ r(u, { node: t }, `layout-${t.type}-${a}`);
14
+ }
15
+ export {
16
+ p as renderTreeNode
17
+ };
18
+ //# sourceMappingURL=renderTreeNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderTreeNode.js","sources":["../../../../../../react/src/utils/renderTreeNode.tsx"],"sourcesContent":["import type { RenderTreeNode } from '@xbeeant/form-engine';\nimport type { ReactElement } from 'react';\n\nimport { NexusField } from '../components/NexusField';\nimport { NexusLayout } from '../components/NexusLayout';\nimport { NexusObject } from '../components/NexusObject';\n\n/**\n * renderTreeNode — 递归渲染\n */\nexport function renderTreeNode(\n node: RenderTreeNode,\n index: number,\n): ReactElement {\n if (node.type === 'field') {\n return (\n <NexusField\n key={node.layoutKey || node.dataPath}\n dataPath={node.dataPath}\n layoutKey={node.layoutKey}\n />\n );\n }\n if (node.type === 'object') {\n return (\n <NexusObject key={`object-${node.layoutKey}-${index}`} node={node} />\n );\n }\n return <NexusLayout key={`layout-${node.type}-${index}`} node={node} />;\n}\n"],"names":["renderTreeNode","node","index","jsx","NexusField","NexusObject","NexusLayout"],"mappings":";;;;AAUO,SAASA,EACdC,GACAC,GACc;AACd,SAAID,EAAK,SAAS,UAEd,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MAEC,UAAUH,EAAK;AAAA,MACf,WAAWA,EAAK;AAAA,IAAA;AAAA,IAFXA,EAAK,aAAaA,EAAK;AAAA,EAAA,IAM9BA,EAAK,SAAS,WAEd,gBAAAE,EAACE,KAAsD,MAAAJ,KAArC,UAAUA,EAAK,SAAS,IAAIC,CAAK,EAAgB,IAGhE,gBAAAC,EAACG,KAAiD,MAAAL,KAAhC,UAAUA,EAAK,IAAI,IAAIC,CAAK,EAAgB;AACvE;"}
@@ -0,0 +1,10 @@
1
+ function u(o, n) {
2
+ if (o !== void 0)
3
+ return o;
4
+ if (n && n.column > 0)
5
+ return Math.max(1, Math.round(n.column / 24));
6
+ }
7
+ export {
8
+ u as resolveColSpan
9
+ };
10
+ //# sourceMappingURL=resolveColSpan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveColSpan.js","sources":["../../../../../../react/src/utils/resolveColSpan.ts"],"sourcesContent":["import type { GridContextValue } from '../contexts/GridContext';\n\n/**\n * resolveColSpan — 统一解析子项在父 Grid 中的跨列数\n */\nexport function resolveColSpan(\n colSpan: number | undefined,\n gridCtx: GridContextValue | null,\n): number | undefined {\n if (colSpan !== undefined) {\n return colSpan;\n }\n\n // 在 grid 容器内:把 24 栅格语义缩放到当前 column\n if (gridCtx && gridCtx.column > 0) {\n return Math.max(1, Math.round(gridCtx.column / 24));\n }\n}\n"],"names":["resolveColSpan","colSpan","gridCtx"],"mappings":"AAKO,SAASA,EACdC,GACAC,GACoB;AACpB,MAAID,MAAY;AACd,WAAOA;AAIT,MAAIC,KAAWA,EAAQ,SAAS;AAC9B,WAAO,KAAK,IAAI,GAAG,KAAK,MAAMA,EAAQ,SAAS,EAAE,CAAC;AAEtD;"}
@@ -0,0 +1,286 @@
1
+ import { isDeepEqual as N, isDataArray as S, isDataObject as j, isDataField as k, isLayoutNode as x } from "@xbeeant/form-engine";
2
+ const w = typeof structuredClone == "function";
3
+ function g(e) {
4
+ return w ? structuredClone(e) : JSON.parse(JSON.stringify(e));
5
+ }
6
+ function v(e, t) {
7
+ if (t.length === 0)
8
+ return;
9
+ let r = e[t[0]];
10
+ for (let o = 1; o < t.length; o++) {
11
+ if (!r)
12
+ return;
13
+ const n = O(r);
14
+ if (!n)
15
+ return;
16
+ r = n[t[o]];
17
+ }
18
+ return r;
19
+ }
20
+ function O(e) {
21
+ if ("properties" in e)
22
+ return e.properties;
23
+ if ("items" in e && e.items.type === "object")
24
+ return e.items.properties;
25
+ }
26
+ function E(e) {
27
+ return "properties" in e || "items" in e;
28
+ }
29
+ function C(e) {
30
+ return A(e).map((t) => t.value);
31
+ }
32
+ function A(e) {
33
+ const t = [], r = (n, i, l) => {
34
+ const s = i ? `${i}.${l}` : l, u = n.title || l;
35
+ if (S(n)) {
36
+ t.push({ value: s, label: u });
37
+ const c = n.items;
38
+ c && typeof c == "object" && (j(c) ? o(c.properties, `${s}[0]`) : k(c) && t.push({ value: `${s}[0]`, label: c.title || "项" }));
39
+ return;
40
+ }
41
+ if (k(n)) {
42
+ t.push({ value: s, label: u });
43
+ return;
44
+ }
45
+ if (j(n)) {
46
+ o(n.properties, s);
47
+ return;
48
+ }
49
+ x(n) && o(n.properties, i);
50
+ }, o = (n, i) => {
51
+ if (n)
52
+ for (const [l, s] of Object.entries(n))
53
+ r(s, i, l);
54
+ };
55
+ return o(e.properties, ""), t;
56
+ }
57
+ function y(e, t) {
58
+ if (t.length === 0)
59
+ return e.properties;
60
+ const r = v(e.properties, t);
61
+ if (r)
62
+ return O(r);
63
+ }
64
+ function D(e, t, r, o) {
65
+ const n = g(e), i = y(n, t);
66
+ return i && (i[r] = o), n;
67
+ }
68
+ function F(e, t) {
69
+ if (t.length === 0)
70
+ return e;
71
+ const r = g(e), o = t.slice(0, -1), n = t[t.length - 1], i = y(r, o);
72
+ return i && delete i[n], r;
73
+ }
74
+ function L(e, t, r) {
75
+ if (t.length === 0)
76
+ return e;
77
+ const o = g(e), n = v(o.properties, t);
78
+ return n && Object.assign(n, r), o;
79
+ }
80
+ function _(e, t, r, o) {
81
+ if (t.length === 0)
82
+ return e;
83
+ const n = g(e), i = t[t.length - 1], l = t.slice(0, -1), s = y(n, l);
84
+ if (!s || !(i in s))
85
+ return n;
86
+ const u = s[i], c = y(n, r);
87
+ if (!c)
88
+ return n;
89
+ const d = s === c, f = Object.entries(c);
90
+ delete s[i];
91
+ let p = o;
92
+ if (p === void 0)
93
+ p = f.filter(([a]) => a !== i).length;
94
+ else if (d) {
95
+ const a = f.findIndex(([b]) => b === i);
96
+ a !== -1 && a < p && (p -= 1);
97
+ }
98
+ const m = f.filter(([a]) => a !== i), P = p < 0 ? 0 : p > m.length ? m.length : p;
99
+ m.splice(P, 0, [i, u]);
100
+ for (const a of Object.keys(c))
101
+ delete c[a];
102
+ for (const [a, b] of m)
103
+ c[a] = b;
104
+ return n;
105
+ }
106
+ function $(e, t, r) {
107
+ if (t.length === 0)
108
+ return { schema: e, newPath: t };
109
+ const o = t[t.length - 1];
110
+ if (o === r)
111
+ return { schema: e, newPath: t };
112
+ const n = t.slice(0, -1), i = g(e), l = y(i, n);
113
+ if (!l || !(o in l))
114
+ return { schema: e, newPath: t };
115
+ if (r in l)
116
+ return { schema: e, newPath: t };
117
+ const s = Object.entries(l), u = s.findIndex(([f]) => f === o);
118
+ for (const f of Object.keys(l))
119
+ delete l[f];
120
+ const c = [];
121
+ for (let f = 0; f < s.length; f++) {
122
+ const [p, m] = s[f];
123
+ f === u ? c.push([r, m]) : c.push([p, m]);
124
+ }
125
+ for (const [f, p] of c)
126
+ l[f] = p;
127
+ const d = [...n, r];
128
+ return { schema: i, newPath: d };
129
+ }
130
+ const h = /* @__PURE__ */ new Set([
131
+ // BaseSchemaNode
132
+ "title",
133
+ "description",
134
+ "required",
135
+ "rules",
136
+ "reactions",
137
+ "bind",
138
+ "validate",
139
+ "dependencies",
140
+ "default",
141
+ "props",
142
+ "className",
143
+ "style",
144
+ "disabled",
145
+ "readOnly",
146
+ "readOnlyWidget",
147
+ "hidden",
148
+ "width",
149
+ "order",
150
+ "extra",
151
+ "colSpan",
152
+ "displayType",
153
+ "labelWidth",
154
+ "column",
155
+ // DataFieldSchema
156
+ "type",
157
+ "widget",
158
+ "enum",
159
+ "enumNames",
160
+ "placeholder",
161
+ // 远程数据配置(远程数据组件的顶层扩展属性)
162
+ "remoteData",
163
+ // 注意:'format' 不在 schema 级列表中——
164
+ // 属性面板编辑的 format 是 antd 控件的「显示格式」(date/time 系列),
165
+ // 必须写入 node.props 才能经 state.props 透传到 widget;
166
+ // JSON Schema 的校验语义(format: 'email' | 'url')由 Parser 直接读 node.format,
167
+ // 与属性面板写回路径互不干扰。
168
+ // 字段级校验约束
169
+ "pattern",
170
+ "min",
171
+ "max",
172
+ // DataObjectSchema
173
+ "properties",
174
+ // DataArraySchema
175
+ "items",
176
+ // LayoutBaseProps extras
177
+ "gap",
178
+ "bordered",
179
+ "span",
180
+ "direction",
181
+ "align",
182
+ "justify",
183
+ "wrap",
184
+ // Designer internals
185
+ "_lockedKey"
186
+ ]);
187
+ function q(e) {
188
+ const t = { ...e };
189
+ if (e.props && typeof e.props == "object" && Object.assign(t, e.props), t.options === void 0 && Array.isArray(e.enum) && e.enum.length > 0) {
190
+ const r = Array.isArray(e.enumNames) ? e.enumNames : [];
191
+ t.options = e.enum.map((o, n) => ({
192
+ value: o,
193
+ label: r[n] == null ? String(o) : String(r[n])
194
+ }));
195
+ }
196
+ return t;
197
+ }
198
+ function M(e) {
199
+ const t = {};
200
+ let r = null;
201
+ for (const [o, n] of Object.entries(e))
202
+ h.has(o) ? t[o] = n : (r || (r = {}), r[o] = n);
203
+ return r && (t.props = r), t;
204
+ }
205
+ function T(e, t) {
206
+ const r = {};
207
+ for (const o of t)
208
+ o in e && (r[o] = e[o]);
209
+ return r;
210
+ }
211
+ function W(e, t, r) {
212
+ const o = {};
213
+ for (const [n, i] of Object.entries(t)) {
214
+ if (i == null || i === "") {
215
+ r?.has(n) && (o[n] = void 0);
216
+ continue;
217
+ }
218
+ N(e[n], i) || (o[n] = i);
219
+ }
220
+ return o;
221
+ }
222
+ function J(e, t, r) {
223
+ if (t.length === 0)
224
+ return e;
225
+ const o = g(e), n = v(o.properties, t);
226
+ if (!n)
227
+ return o;
228
+ const i = n;
229
+ if (Array.isArray(r.options)) {
230
+ const s = [], u = [];
231
+ for (const c of r.options)
232
+ if (c && typeof c == "object") {
233
+ const d = c;
234
+ s.push(d.value), u.push(
235
+ d.label == null ? String(d.value ?? "") : String(d.label)
236
+ );
237
+ } else
238
+ s.push(c), u.push(String(c));
239
+ i.enum = s, i.enumNames = u;
240
+ }
241
+ for (const [s, u] of Object.entries(r))
242
+ h.has(s) && (u === void 0 ? delete i[s] : i[s] = u);
243
+ const l = {};
244
+ for (const [s, u] of Object.entries(r))
245
+ h.has(s) || (l[s] = u);
246
+ if (Object.keys(l).length > 0) {
247
+ const u = { ...i.props && typeof i.props == "object" ? i.props : {}, ...l };
248
+ for (const c of Object.keys(l))
249
+ l[c] === void 0 && delete u[c];
250
+ i.props = u;
251
+ }
252
+ return o;
253
+ }
254
+ function K(e, t) {
255
+ const r = "abcdefghijklmnopqrstuvwxyz0123456789";
256
+ let o = "";
257
+ do {
258
+ o = "";
259
+ for (let n = 0; n < 8; n++)
260
+ o += r[Math.floor(Math.random() * r.length)];
261
+ } while (o in e);
262
+ return o;
263
+ }
264
+ function V(e, t) {
265
+ return e.title || t || e.type || "";
266
+ }
267
+ export {
268
+ D as addChildToSchema,
269
+ A as collectDataFieldOptions,
270
+ C as collectDataFieldPaths,
271
+ W as diffPropertyPatch,
272
+ T as extractFormLevelConfig,
273
+ q as flattenNodeForPropertyEditor,
274
+ K as generateKey,
275
+ v as getNodeAtProperties,
276
+ V as getNodeLabel,
277
+ O as getPropertiesOf,
278
+ E as isContainerNode,
279
+ _ as moveNodeInSchema,
280
+ M as nestPatchForNode,
281
+ F as removeNodeFromSchema,
282
+ $ as renameNodeInSchema,
283
+ L as updateNodeInSchema,
284
+ J as updateNodeWithNesting
285
+ };
286
+ //# sourceMappingURL=schemaUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaUtils.js","sources":["../../src/schemaUtils.ts"],"sourcesContent":["// ============================================================================\n// @xbeeant/form-engine-designer — Schema 树操作工具(不可变)\n// ============================================================================\n// 路径 path 为 property key 的数组,例如 ['card1', 'username']\n// 表示 schema.properties.card1.properties.username\n\nimport {\n isDataArray,\n isDataField,\n isDataObject,\n isDeepEqual,\n isLayoutNode,\n type NexusSchema,\n type SchemaNode,\n} from '@xbeeant/form-engine';\n\n// ────────────────────────────────────────────────────────────────────────────\n// 深拷贝\n// Schema 通常是纯 JSON,但 rules.pattern 可能为 RegExp(JSON 序列化会丢失),\n// 因此优先使用 structuredClone(保留 RegExp/Date/Map/Set),环境不支持时回退到序列化。\n// ────────────────────────────────────────────────────────────────────────────\n\nconst _hasStructuredClone = typeof structuredClone === 'function';\n\nfunction clone<T>(value: T): T {\n if (_hasStructuredClone) {\n return structuredClone(value) as T;\n }\n return JSON.parse(JSON.stringify(value)) as T;\n}\n\n// ────────────────────────────────────────────────────────────────────────────\n// 节点访问\n// ────────────────────────────────────────────────────────────────────────────\n\n/**\n * 从一个 properties 记录按路径段遍历,返回路径终点的节点\n */\nexport function getNodeAtProperties(\n props: Record<string, SchemaNode>,\n path: string[],\n): SchemaNode | undefined {\n if (path.length === 0) {\n return undefined;\n }\n let current: SchemaNode | undefined = props[path[0]];\n for (let i = 1; i < path.length; i++) {\n if (!current) {\n return undefined;\n }\n const childProps = getPropertiesOf(current);\n if (!childProps) {\n return undefined;\n }\n current = childProps[path[i]];\n }\n return current;\n}\n\n/**\n * 获取一个节点的子 properties:\n * - object / layout / pane:返回 node.properties\n * - array:items 为 object 时返回 items.properties\n */\nexport function getPropertiesOf(\n node: SchemaNode,\n): Record<string, SchemaNode> | undefined {\n if ('properties' in node) {\n return node.properties;\n }\n if ('items' in node && node.items.type === 'object') {\n return node.items.properties;\n }\n return undefined;\n}\n\n/**\n * 是否为容器节点(拥有 properties 或 items)\n */\nexport function isContainerNode(node: SchemaNode): boolean {\n return 'properties' in node || 'items' in node;\n}\n\n/**\n * 收集 schema 中所有会进入 formData 数据路径的字段路径(供变量选择器 / 依赖选择使用)\n * 遵循 §2 路径计算规则:\n * - 数据节点:Key 进入路径(对象/数组透传子字段,数组项子字段以 `key[0].sub` 表示)\n * - 布局节点:Key 被丢弃,路径透传父级\n * - 带 widget 的 object(子表单)视为叶子字段\n */\nexport function collectDataFieldPaths(schema: NexusSchema): string[] {\n return collectDataFieldOptions(schema).map((o) => o.value);\n}\n\n/**\n * 收集 schema 中所有会进入 formData 数据路径的字段(供变量选择器 / 依赖选择使用)\n * 返回「路径 + 字段标题」对:依赖字段(dependencies)等选择器显示字段名称\n * (title || key),提交/存储时使用路径 key\n */\nexport function collectDataFieldOptions(\n schema: NexusSchema,\n): Array<{ value: string; label: string }> {\n const result: Array<{ value: string; label: string }> = [];\n const walk = (node: SchemaNode, parentPath: string, key: string): void => {\n // 数据节点路径 = 父路径 + 自身 key;布局节点不计算(Key 被丢弃)\n const ownPath = parentPath ? `${parentPath}.${key}` : key;\n const title = node.title || key;\n if (isDataArray(node)) {\n result.push({ value: ownPath, label: title });\n const items = node.items;\n if (items && typeof items === 'object') {\n if (isDataObject(items)) {\n walkProperties(items.properties, `${ownPath}[0]`);\n } else if (isDataField(items)) {\n result.push({ value: `${ownPath}[0]`, label: items.title || '项' });\n }\n }\n return;\n }\n if (isDataField(node)) {\n result.push({ value: ownPath, label: title });\n return;\n }\n if (isDataObject(node)) {\n walkProperties(node.properties, ownPath);\n return;\n }\n if (isLayoutNode(node)) {\n // 布局节点 Key 不进入路径:子节点沿用父路径\n walkProperties(node.properties, parentPath);\n }\n };\n\n const walkProperties = (\n props: Record<string, SchemaNode> | undefined,\n parentPath: string,\n ): void => {\n if (!props) {\n return;\n }\n for (const [key, child] of Object.entries(props)) {\n walk(child, parentPath, key);\n }\n };\n\n walkProperties(schema.properties, '');\n return result;\n}\n\n// 获取指定父路径下的 properties 记录(用于增删改)\nfunction getPropertiesAt(\n schema: NexusSchema,\n parentPath: string[],\n): Record<string, SchemaNode> | undefined {\n if (parentPath.length === 0) {\n return schema.properties;\n }\n const parent = getNodeAtProperties(schema.properties, parentPath);\n if (!parent) {\n return undefined;\n }\n return getPropertiesOf(parent);\n}\n\n// ────────────────────────────────────────────────────────────────────────────\n// 增删改\n// ────────────────────────────────────────────────────────────────────────────\n\n/**\n * 在 parentPath 下新增一个子节点(深拷贝后写入)\n * parentPath 为空时添加到根 properties\n */\nexport function addChildToSchema(\n schema: NexusSchema,\n parentPath: string[],\n key: string,\n node: SchemaNode,\n): NexusSchema {\n const next = clone(schema);\n const props = getPropertiesAt(next, parentPath);\n if (props) {\n props[key] = node;\n }\n return next;\n}\n\n/**\n * 移除路径终点节点\n */\nexport function removeNodeFromSchema(\n schema: NexusSchema,\n path: string[],\n): NexusSchema {\n if (path.length === 0) {\n return schema;\n }\n const next = clone(schema);\n const parentPath = path.slice(0, -1);\n const key = path[path.length - 1];\n const props = getPropertiesAt(next, parentPath);\n if (props) {\n delete props[key];\n }\n return next;\n}\n\n/**\n * 将 patch 浅合并到路径终点节点\n */\nexport function updateNodeInSchema(\n schema: NexusSchema,\n path: string[],\n patch: Record<string, unknown>,\n): NexusSchema {\n if (path.length === 0) {\n return schema;\n }\n const next = clone(schema);\n const node = getNodeAtProperties(next.properties, path);\n if (node) {\n Object.assign(node, patch);\n }\n return next;\n}\n\n/**\n * 将 fromPath 节点移动到 toParentPath 下\n * insertIndex 指定在目标父级中的最终位置(基于最终顺序),省略则追加到末尾\n */\nexport function moveNodeInSchema(\n schema: NexusSchema,\n fromPath: string[],\n toParentPath: string[],\n insertIndex?: number,\n): NexusSchema {\n if (fromPath.length === 0) {\n return schema;\n }\n const next = clone(schema);\n const fromKey = fromPath[fromPath.length - 1];\n const fromParentPath = fromPath.slice(0, -1);\n\n const fromProps = getPropertiesAt(next, fromParentPath);\n if (!fromProps || !(fromKey in fromProps)) {\n return next;\n }\n const node = fromProps[fromKey];\n\n const toProps = getPropertiesAt(next, toParentPath);\n if (!toProps) {\n return next;\n }\n\n const sameParent = fromProps === toProps;\n // 目标父级删除前的快照\n const toEntries = Object.entries(toProps);\n\n // 从原父级移除\n delete fromProps[fromKey];\n\n let finalIndex = insertIndex;\n if (finalIndex === undefined) {\n finalIndex = toEntries.filter(([k]) => k !== fromKey).length;\n } else if (sameParent) {\n // 同一父级内移动:删除会让 fromKey 之后项索引前移\n const fromIndexInTo = toEntries.findIndex(([k]) => k === fromKey);\n if (fromIndexInTo !== -1 && fromIndexInTo < finalIndex) {\n finalIndex -= 1;\n }\n }\n\n const updatedEntries = toEntries.filter(([k]) => k !== fromKey);\n const clamped =\n finalIndex < 0\n ? 0\n : finalIndex > updatedEntries.length\n ? updatedEntries.length\n : finalIndex;\n updatedEntries.splice(clamped, 0, [fromKey, node]);\n\n // 重建目标 properties,保留插入顺序\n for (const k of Object.keys(toProps)) {\n delete toProps[k];\n }\n for (const [k, v] of updatedEntries) {\n toProps[k] = v;\n }\n return next;\n}\n\n/**\n * 重命名节点的 key(schema 结构级操作:删除旧 key + 添加新 key)\n * - newKey 已存在时返回原 schema,不覆盖\n * - 重命名后自动更新选中路径\n */\nexport function renameNodeInSchema(\n schema: NexusSchema,\n path: string[],\n newKey: string,\n): { schema: NexusSchema; newPath: string[] } {\n if (path.length === 0) {\n return { schema, newPath: path };\n }\n const oldKey = path[path.length - 1];\n if (oldKey === newKey) {\n return { schema, newPath: path };\n }\n const parentPath = path.slice(0, -1);\n const next = clone(schema);\n const props = getPropertiesAt(next, parentPath);\n if (!props || !(oldKey in props)) {\n return { schema, newPath: path };\n }\n // 新 key 已存在则放弃,不覆盖\n if (newKey in props) {\n return { schema, newPath: path };\n }\n const entries = Object.entries(props);\n const oldIndex = entries.findIndex(([k]) => k === oldKey);\n\n // 重建:删除旧 key,在原位置插入新 key\n for (const k of Object.keys(props)) {\n delete props[k];\n }\n const updated: Array<[string, SchemaNode]> = [];\n for (let i = 0; i < entries.length; i++) {\n const [k, v] = entries[i];\n if (i === oldIndex) {\n updated.push([newKey, v]);\n } else {\n updated.push([k, v]);\n }\n }\n for (const [k, v] of updated) {\n props[k] = v;\n }\n\n const newPath = [...parentPath, newKey];\n return { schema: next, newPath };\n}\n\n// ────────────────────────────────────────────────────────────────────────────\n// 工具\n// ────────────────────────────────────────────────────────────────────────────\n\n/**\n * Schema 节点的顶层关键字段(非 UI 组件属性)。\n * 这些属性直接写在 schema node 上,而非嵌套在 props 对象内。\n */\nconst SCHEMA_LEVEL_KEYS = new Set([\n // BaseSchemaNode\n 'title',\n 'description',\n 'required',\n 'rules',\n 'reactions',\n 'bind',\n 'validate',\n 'dependencies',\n 'default',\n 'props',\n 'className',\n 'style',\n 'disabled',\n 'readOnly',\n 'readOnlyWidget',\n 'hidden',\n 'width',\n 'order',\n 'extra',\n 'colSpan',\n 'displayType',\n 'labelWidth',\n 'column',\n // DataFieldSchema\n 'type',\n 'widget',\n 'enum',\n 'enumNames',\n 'placeholder',\n // 远程数据配置(远程数据组件的顶层扩展属性)\n 'remoteData',\n // 注意:'format' 不在 schema 级列表中——\n // 属性面板编辑的 format 是 antd 控件的「显示格式」(date/time 系列),\n // 必须写入 node.props 才能经 state.props 透传到 widget;\n // JSON Schema 的校验语义(format: 'email' | 'url')由 Parser 直接读 node.format,\n // 与属性面板写回路径互不干扰。\n // 字段级校验约束\n 'pattern',\n 'min',\n 'max',\n // DataObjectSchema\n 'properties',\n // DataArraySchema\n 'items',\n // LayoutBaseProps extras\n 'gap',\n 'bordered',\n 'span',\n 'direction',\n 'align',\n 'justify',\n 'wrap',\n // Designer internals\n '_lockedKey',\n]);\n\n/**\n * 读取节点用于属性面板的初始值:\n * - 直接保留 schema 级属性\n * - 扁平化 props 与 schema 级属性同一平面暴露给表单,\n * - 当节点使用 enum/enumNames(canonical 选项格式)而未显式配置 props.options 时,\n * 合成 options 供 value/label 编辑器回显\n */\nexport function flattenNodeForPropertyEditor(\n node: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = { ...node };\n // 再展开 props(新统一格式)高优先级\n if (node.props && typeof node.props === 'object') {\n Object.assign(result, node.props as Record<string, unknown>);\n }\n if (\n result.options === undefined &&\n Array.isArray(node.enum) &&\n node.enum.length > 0\n ) {\n const names = Array.isArray(node.enumNames)\n ? (node.enumNames as unknown[])\n : [];\n result.options = (node.enum as unknown[]).map((value, index) => ({\n value,\n label: names[index] == null ? String(value) : String(names[index]),\n }));\n }\n return result;\n}\n\n/**\n * 将属性面板返回的 flat patch 拆分:\n * - schema 级属性 → 直接写在节点上\n * - 其余(UI 组件属性)→ 合并写入 node.props 对象(统一入口)\n */\nexport function nestPatchForNode(\n patch: Record<string, unknown>,\n): Record<string, unknown> {\n const schemaPatch: Record<string, unknown> = {};\n let propsPatch: Record<string, unknown> | null = null;\n\n for (const [key, value] of Object.entries(patch)) {\n if (SCHEMA_LEVEL_KEYS.has(key)) {\n schemaPatch[key] = value;\n } else {\n if (!propsPatch) {\n propsPatch = {};\n }\n propsPatch[key] = value;\n }\n }\n\n if (propsPatch) {\n // UI 组件属性统一写入 props\n schemaPatch.props = propsPatch;\n }\n\n return schemaPatch;\n}\n\n/**\n * 从 NexusSchema 顶层提取表单级配置(供属性面板 form-level 编辑器作为 initialValues)\n *\n * 只提取 schema 顶层可配置键(displayType/labelWidth/colon/label/readOnly/column 等),\n * 而非整个 schema 对象——整个 schema 含 properties 与嵌套字段定义,\n * 不属于表单级配置的取值来源,直接作为 initialValues 是错误的。\n *\n * @param schema 被编辑的 NexusSchema\n * @param keys 表单级可编辑键集合(对应属性面板 formLevelProps 的 key)\n * @returns 仅包含 schema 中存在的表单级配置\n */\nexport function extractFormLevelConfig(\n schema: Record<string, unknown>,\n keys: readonly string[],\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const key of keys) {\n if (key in schema) {\n result[key] = schema[key];\n }\n }\n return result;\n}\n\n/**\n * 计算属性表单 allValues → 节点 patch 的差异:\n * - 空字符串(undefined / null / '')默认视为「未赋值」,不写回 Schema——\n * 属性表单会把未触碰的字符串字段初始化为 '',若写回会污染 Schema\n * (如 bind:'' 被引擎当作 bind 路径导致数据 key 丢失、hidden:''/required:''\n * 被当作空表达式联动),因此空值统一跳过\n * - 但当字段被用户实际改动过(changedFields 包含该 key,即用户主动清空)时,\n * 空值以 undefined 写回,由 updateNodeWithNesting 执行删除(清空属性)\n * - 跳过与初始值深相等的字段(未触碰的字段不重复写回)\n *\n * @param initialValues 节点当前的扁平值(flattenNodeForPropertyEditor 输出)\n * @param allValues 属性表单当前全部值\n * @param changedFields 本表单实例中用户实际改动过的字段集合('#' watcher 第三参累计)\n * @returns 需要写回节点的 patch(未改动字段不含任何空值;主动清空的字段值为 undefined)\n */\nexport function diffPropertyPatch(\n initialValues: Record<string, unknown>,\n allValues: Record<string, unknown>,\n changedFields?: ReadonlySet<string>,\n): Record<string, unknown> {\n const patch: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(allValues)) {\n if (value === undefined || value === null || value === '') {\n if (changedFields?.has(key)) {\n patch[key] = undefined;\n }\n continue;\n }\n if (isDeepEqual(initialValues[key], value)) {\n continue;\n }\n patch[key] = value;\n }\n return patch;\n}\n\n/**\n * 合并 props patch 到已存在的 props 中(UI 组件属性统一入口),\n * 而不是整体覆盖,避免修改一个属性时丢失其它属性。\n */\nexport function updateNodeWithNesting(\n schema: NexusSchema,\n path: string[],\n flatPatch: Record<string, unknown>,\n): NexusSchema {\n if (path.length === 0) {\n return schema;\n }\n const next = clone(schema);\n const node = getNodeAtProperties(next.properties, path);\n if (!node) {\n return next;\n }\n const nodeRec = node as unknown as Record<string, unknown>;\n\n // value/label 选项编辑器:同步写出 canonical 的 enum + enumNames,\n // 使选项同时作用于控件展示、校验(enum 规则)与只读回显\n if (Array.isArray(flatPatch.options)) {\n const enumValues: unknown[] = [];\n const enumLabels: string[] = [];\n for (const item of flatPatch.options as unknown[]) {\n if (item && typeof item === 'object') {\n const rec = item as { value?: unknown; label?: unknown };\n enumValues.push(rec.value);\n enumLabels.push(\n rec.label == null ? String(rec.value ?? '') : String(rec.label),\n );\n } else {\n enumValues.push(item);\n enumLabels.push(String(item));\n }\n }\n nodeRec.enum = enumValues;\n nodeRec.enumNames = enumLabels;\n }\n\n // schema 级属性直接覆盖(undefined 视为清空,删除该 key)\n for (const [key, value] of Object.entries(flatPatch)) {\n if (SCHEMA_LEVEL_KEYS.has(key)) {\n if (value === undefined) {\n delete (nodeRec as Record<string, unknown>)[key];\n } else {\n (nodeRec as Record<string, unknown>)[key] = value;\n }\n }\n }\n\n // UI 组件属性:只合并进 props(统一入口);\n const uiProps: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(flatPatch)) {\n if (!SCHEMA_LEVEL_KEYS.has(key)) {\n uiProps[key] = value;\n }\n }\n if (Object.keys(uiProps).length > 0) {\n const oldProps =\n nodeRec.props && typeof nodeRec.props === 'object'\n ? (nodeRec.props as Record<string, unknown>)\n : {};\n const mergedProps = { ...oldProps, ...uiProps };\n // undefined 视为清空:从 props 中删除该属性,而非写入 undefined 残留\n for (const key of Object.keys(uiProps)) {\n if (uiProps[key] === undefined) {\n delete mergedProps[key];\n }\n }\n nodeRec.props = mergedProps;\n }\n return next;\n}\n\n/**\n * 生成唯一 property key:8 位随机字符 [a-z0-9],确保不与已有 key 冲突\n */\nexport function generateKey(\n _props: Record<string, SchemaNode>,\n _base: string,\n): string {\n const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';\n let key = '';\n do {\n key = '';\n for (let i = 0; i < 8; i++) {\n key += chars[Math.floor(Math.random() * chars.length)];\n }\n } while (key in _props);\n return key;\n}\n\n/**\n * 节点显示标签:title || key || type\n */\nexport function getNodeLabel(node: SchemaNode, key: string): string {\n return node.title || key || node.type || '';\n}\n"],"names":["_hasStructuredClone","clone","value","getNodeAtProperties","props","path","current","i","childProps","getPropertiesOf","node","isContainerNode","collectDataFieldPaths","schema","collectDataFieldOptions","o","result","walk","parentPath","key","ownPath","title","isDataArray","items","isDataObject","walkProperties","isDataField","isLayoutNode","child","getPropertiesAt","parent","addChildToSchema","next","removeNodeFromSchema","updateNodeInSchema","patch","moveNodeInSchema","fromPath","toParentPath","insertIndex","fromKey","fromParentPath","fromProps","toProps","sameParent","toEntries","finalIndex","k","fromIndexInTo","updatedEntries","clamped","v","renameNodeInSchema","newKey","oldKey","entries","oldIndex","updated","newPath","SCHEMA_LEVEL_KEYS","flattenNodeForPropertyEditor","names","index","nestPatchForNode","schemaPatch","propsPatch","extractFormLevelConfig","keys","diffPropertyPatch","initialValues","allValues","changedFields","isDeepEqual","updateNodeWithNesting","flatPatch","nodeRec","enumValues","enumLabels","item","rec","uiProps","mergedProps","generateKey","_props","_base","chars","getNodeLabel"],"mappings":";AAsBA,MAAMA,IAAsB,OAAO,mBAAoB;AAEvD,SAASC,EAASC,GAAa;AAC7B,SAAIF,IACK,gBAAgBE,CAAK,IAEvB,KAAK,MAAM,KAAK,UAAUA,CAAK,CAAC;AACzC;AASO,SAASC,EACdC,GACAC,GACwB;AACxB,MAAIA,EAAK,WAAW;AAClB;AAEF,MAAIC,IAAkCF,EAAMC,EAAK,CAAC,CAAC;AACnD,WAASE,IAAI,GAAGA,IAAIF,EAAK,QAAQE,KAAK;AACpC,QAAI,CAACD;AACH;AAEF,UAAME,IAAaC,EAAgBH,CAAO;AAC1C,QAAI,CAACE;AACH;AAEF,IAAAF,IAAUE,EAAWH,EAAKE,CAAC,CAAC;AAAA,EAC9B;AACA,SAAOD;AACT;AAOO,SAASG,EACdC,GACwC;AACxC,MAAI,gBAAgBA;AAClB,WAAOA,EAAK;AAEd,MAAI,WAAWA,KAAQA,EAAK,MAAM,SAAS;AACzC,WAAOA,EAAK,MAAM;AAGtB;AAKO,SAASC,EAAgBD,GAA2B;AACzD,SAAO,gBAAgBA,KAAQ,WAAWA;AAC5C;AASO,SAASE,EAAsBC,GAA+B;AACnE,SAAOC,EAAwBD,CAAM,EAAE,IAAI,CAACE,MAAMA,EAAE,KAAK;AAC3D;AAOO,SAASD,EACdD,GACyC;AACzC,QAAMG,IAAkD,CAAA,GAClDC,IAAO,CAACP,GAAkBQ,GAAoBC,MAAsB;AAExE,UAAMC,IAAUF,IAAa,GAAGA,CAAU,IAAIC,CAAG,KAAKA,GAChDE,IAAQX,EAAK,SAASS;AAC5B,QAAIG,EAAYZ,CAAI,GAAG;AACrB,MAAAM,EAAO,KAAK,EAAE,OAAOI,GAAS,OAAOC,GAAO;AAC5C,YAAME,IAAQb,EAAK;AACnB,MAAIa,KAAS,OAAOA,KAAU,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