@flowgram.ai/form-materials 0.1.0-alpha.15 → 0.1.0-alpha.17

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 (272) hide show
  1. package/bin/run.sh +3 -2
  2. package/dist/cjs/components/blur-input/index.js +2 -12
  3. package/dist/cjs/components/code-editor/editor-all.js +52 -0
  4. package/dist/cjs/components/code-editor/editor-json.js +71 -0
  5. package/dist/cjs/components/code-editor/editor-python.js +63 -0
  6. package/dist/cjs/components/code-editor/editor-shell.js +63 -0
  7. package/dist/cjs/components/code-editor/editor-sql.js +71 -0
  8. package/dist/cjs/components/code-editor/editor-ts.js +80 -0
  9. package/dist/cjs/components/code-editor/editor.js +45 -57
  10. package/dist/cjs/components/code-editor/factory.js +96 -0
  11. package/dist/cjs/components/code-editor/index.js +31 -28
  12. package/dist/cjs/components/code-editor/theme/dark.js +120 -50
  13. package/dist/cjs/components/code-editor/theme/light.js +110 -61
  14. package/dist/cjs/components/code-editor/utils.js +1 -0
  15. package/dist/cjs/components/condition-context/context.js +59 -0
  16. package/dist/cjs/components/condition-context/hooks/use-condition.js +97 -0
  17. package/dist/cjs/components/condition-context/index.js +47 -0
  18. package/dist/cjs/components/condition-context/op.js +117 -0
  19. package/dist/cjs/components/condition-row/index.js +43 -26
  20. package/dist/cjs/components/condition-row/types.js +1 -35
  21. package/dist/cjs/components/{prompt-editor-with-inputs/inputs-picker.js → coze-editor-extensions/extensions/inputs-tree.js} +70 -2
  22. package/dist/cjs/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.js +4 -3
  23. package/dist/cjs/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.js +13 -7
  24. package/dist/cjs/components/coze-editor-extensions/index.js +86 -0
  25. package/dist/cjs/components/db-condition-row/index.js +59 -34
  26. package/dist/cjs/components/display-schema-tree/index.js +2 -2
  27. package/dist/cjs/components/index.js +49 -4
  28. package/dist/cjs/components/json-editor-with-variables/editor.js +10 -7
  29. package/dist/cjs/components/prompt-editor-with-inputs/editor.js +2 -2
  30. package/dist/cjs/components/prompt-editor-with-variables/editor.js +3 -4
  31. package/dist/cjs/components/{condition-row/hooks/useRule.js → sql-editor-with-variables/editor.js} +19 -34
  32. package/dist/cjs/components/sql-editor-with-variables/index.js +57 -0
  33. package/dist/cjs/components/type-selector/index.js +2 -2
  34. package/dist/cjs/components/variable-selector/use-variable-tree.js +1 -2
  35. package/dist/cjs/effects/provide-batch-input/index.js +1 -1
  36. package/dist/cjs/effects/provide-json-schema-outputs/index.js +1 -1
  37. package/dist/cjs/form-plugins/batch-outputs-plugin/index.js +9 -2
  38. package/dist/cjs/form-plugins/infer-assign-plugin/index.js +1 -1
  39. package/dist/cjs/form-plugins/infer-inputs-plugin/index.js +30 -3
  40. package/dist/cjs/index.js +44 -2
  41. package/dist/cjs/plugins/json-schema-preset/create-type-preset-plugin.js +1 -0
  42. package/dist/cjs/plugins/json-schema-preset/index.js +3 -13
  43. package/dist/cjs/{components/code-editor/init-worker.js → plugins/json-schema-preset/react.js} +18 -23
  44. package/dist/cjs/plugins/json-schema-preset/type-definition/array.js +33 -4
  45. package/dist/cjs/plugins/json-schema-preset/type-definition/boolean.js +23 -0
  46. package/dist/cjs/plugins/json-schema-preset/type-definition/date-time.js +31 -2
  47. package/dist/cjs/plugins/json-schema-preset/type-definition/index.js +9 -1
  48. package/dist/cjs/plugins/json-schema-preset/type-definition/integer.js +34 -1
  49. package/dist/cjs/plugins/json-schema-preset/type-definition/map.js +54 -0
  50. package/dist/cjs/plugins/json-schema-preset/type-definition/number.js +34 -1
  51. package/dist/cjs/plugins/json-schema-preset/type-definition/object.js +9 -4
  52. package/dist/cjs/plugins/json-schema-preset/type-definition/string.js +30 -1
  53. package/dist/cjs/plugins/json-schema-preset/types.js +18 -0
  54. package/dist/cjs/shared/flow-value/utils.js +22 -8
  55. package/dist/cjs/shared/inject-material/index.js +2 -1
  56. package/dist/esm/components/blur-input/index.mjs +2 -2
  57. package/dist/esm/components/code-editor/editor-all.mjs +18 -0
  58. package/dist/esm/components/code-editor/editor-json.mjs +16 -0
  59. package/dist/esm/components/code-editor/editor-python.mjs +8 -0
  60. package/dist/esm/components/code-editor/editor-shell.mjs +8 -0
  61. package/dist/esm/components/code-editor/editor-sql.mjs +16 -0
  62. package/dist/esm/components/code-editor/editor-ts.mjs +22 -0
  63. package/dist/esm/components/code-editor/editor.mjs +38 -33
  64. package/dist/esm/components/code-editor/factory.mjs +36 -0
  65. package/dist/esm/components/code-editor/index.mjs +8 -5
  66. package/dist/esm/components/code-editor/theme/dark.mjs +117 -50
  67. package/dist/esm/components/code-editor/theme/light.mjs +108 -62
  68. package/dist/esm/components/code-editor/utils.mjs +1 -0
  69. package/dist/esm/components/condition-context/context.mjs +19 -0
  70. package/dist/esm/components/condition-context/hooks/use-condition.mjs +63 -0
  71. package/dist/esm/components/condition-context/index.mjs +4 -0
  72. package/dist/esm/components/condition-context/op.mjs +80 -0
  73. package/dist/esm/components/condition-row/index.mjs +45 -28
  74. package/dist/esm/components/condition-row/types.mjs +0 -18
  75. package/dist/esm/components/coze-editor-extensions/extensions/inputs-tree.mjs +135 -0
  76. package/dist/esm/components/{json-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.mjs +4 -3
  77. package/dist/esm/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.mjs +13 -7
  78. package/dist/esm/components/coze-editor-extensions/index.mjs +18 -0
  79. package/dist/esm/components/db-condition-row/index.mjs +59 -34
  80. package/dist/esm/components/display-schema-tree/index.mjs +1 -1
  81. package/dist/esm/components/index.mjs +5 -2
  82. package/dist/esm/components/json-editor-with-variables/editor.mjs +10 -7
  83. package/dist/esm/components/prompt-editor-with-inputs/editor.mjs +2 -2
  84. package/dist/esm/components/prompt-editor-with-variables/editor.mjs +3 -4
  85. package/dist/esm/components/sql-editor-with-variables/editor.mjs +19 -0
  86. package/dist/esm/components/sql-editor-with-variables/index.mjs +5 -0
  87. package/dist/esm/components/type-selector/index.mjs +1 -1
  88. package/dist/esm/components/variable-selector/use-variable-tree.mjs +1 -2
  89. package/dist/esm/effects/provide-batch-input/index.mjs +2 -2
  90. package/dist/esm/effects/provide-json-schema-outputs/index.mjs +2 -2
  91. package/dist/esm/form-plugins/batch-outputs-plugin/index.mjs +10 -3
  92. package/dist/esm/form-plugins/infer-assign-plugin/index.mjs +2 -2
  93. package/dist/esm/form-plugins/infer-inputs-plugin/index.mjs +31 -4
  94. package/dist/esm/index.mjs +2 -2
  95. package/dist/esm/plugins/json-schema-preset/create-type-preset-plugin.mjs +2 -1
  96. package/dist/esm/plugins/json-schema-preset/index.mjs +3 -13
  97. package/dist/esm/plugins/json-schema-preset/react.mjs +14 -0
  98. package/dist/esm/plugins/json-schema-preset/type-definition/array.mjs +33 -4
  99. package/dist/esm/plugins/json-schema-preset/type-definition/boolean.mjs +23 -0
  100. package/dist/esm/plugins/json-schema-preset/type-definition/date-time.mjs +31 -2
  101. package/dist/esm/plugins/json-schema-preset/type-definition/index.mjs +7 -2
  102. package/dist/esm/plugins/json-schema-preset/type-definition/integer.mjs +34 -1
  103. package/dist/esm/plugins/json-schema-preset/type-definition/map.mjs +20 -0
  104. package/dist/esm/plugins/json-schema-preset/type-definition/number.mjs +34 -1
  105. package/dist/esm/plugins/json-schema-preset/type-definition/object.mjs +9 -4
  106. package/dist/esm/plugins/json-schema-preset/type-definition/string.mjs +30 -1
  107. package/dist/esm/plugins/json-schema-preset/types.mjs +0 -0
  108. package/dist/esm/shared/flow-value/utils.mjs +22 -8
  109. package/dist/esm/shared/inject-material/index.mjs +2 -1
  110. package/dist/tsconfig.tsbuildinfo +1 -1
  111. package/dist/types/components/blur-input/index.d.ts +7 -1
  112. package/dist/types/components/code-editor/editor-all.d.ts +8 -0
  113. package/dist/types/components/code-editor/editor-json.d.ts +6 -0
  114. package/dist/types/components/code-editor/editor-python.d.ts +6 -0
  115. package/dist/types/components/code-editor/editor-shell.d.ts +6 -0
  116. package/dist/types/components/code-editor/editor-sql.d.ts +6 -0
  117. package/dist/types/components/code-editor/editor-ts.d.ts +6 -0
  118. package/dist/types/components/code-editor/editor.d.ts +3 -4
  119. package/dist/types/components/code-editor/factory.d.ts +13 -0
  120. package/dist/types/components/code-editor/index.d.ts +7 -2
  121. package/dist/types/components/code-editor/theme/dark.d.ts +29 -0
  122. package/dist/types/components/code-editor/theme/light.d.ts +24 -0
  123. package/dist/types/components/code-editor/utils.d.ts +1 -1
  124. package/dist/types/components/code-editor-mini/index.d.ts +3 -0
  125. package/dist/types/components/condition-context/context.d.ts +14 -0
  126. package/dist/types/components/condition-context/hooks/use-condition.d.ts +29 -0
  127. package/dist/types/components/condition-context/index.d.ts +8 -0
  128. package/dist/types/components/condition-context/op.d.ts +22 -0
  129. package/dist/types/components/condition-context/types.d.ts +14 -0
  130. package/dist/types/components/condition-row/index.d.ts +4 -7
  131. package/dist/types/components/condition-row/types.d.ts +0 -24
  132. package/dist/types/components/{prompt-editor-with-inputs/inputs-picker.d.ts → coze-editor-extensions/extensions/inputs-tree.d.ts} +5 -0
  133. package/dist/types/components/{json-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.d.ts +3 -1
  134. package/dist/types/components/coze-editor-extensions/index.d.ts +18 -0
  135. package/dist/types/components/db-condition-row/index.d.ts +4 -3
  136. package/dist/types/components/db-condition-row/types.d.ts +0 -8
  137. package/dist/types/components/display-schema-tree/index.d.ts +1 -1
  138. package/dist/types/components/dynamic-value-input/index.d.ts +3 -1
  139. package/dist/types/components/index.d.ts +4 -1
  140. package/dist/types/components/sql-editor-with-variables/editor.d.ts +9 -0
  141. package/dist/types/components/sql-editor-with-variables/index.d.ts +6 -0
  142. package/dist/types/components/type-selector/index.d.ts +3 -1
  143. package/dist/types/components/variable-selector/index.d.ts +4 -2
  144. package/dist/types/form-plugins/batch-outputs-plugin/index.d.ts +4 -0
  145. package/dist/types/form-plugins/infer-inputs-plugin/index.d.ts +4 -0
  146. package/dist/types/index.d.ts +1 -1
  147. package/dist/types/plugins/json-schema-preset/create-type-preset-plugin.d.ts +1 -1
  148. package/dist/types/plugins/json-schema-preset/index.d.ts +3 -7
  149. package/dist/types/plugins/json-schema-preset/react.d.ts +11 -0
  150. package/dist/types/plugins/json-schema-preset/type-definition/array.d.ts +1 -1
  151. package/dist/types/plugins/json-schema-preset/type-definition/boolean.d.ts +1 -1
  152. package/dist/types/plugins/json-schema-preset/type-definition/date-time.d.ts +1 -1
  153. package/dist/types/plugins/json-schema-preset/type-definition/index.d.ts +3 -1
  154. package/dist/types/plugins/json-schema-preset/type-definition/integer.d.ts +1 -1
  155. package/dist/types/plugins/json-schema-preset/type-definition/map.d.ts +6 -0
  156. package/dist/types/plugins/json-schema-preset/type-definition/number.d.ts +1 -1
  157. package/dist/types/plugins/json-schema-preset/type-definition/object.d.ts +1 -1
  158. package/dist/types/plugins/json-schema-preset/type-definition/string.d.ts +1 -1
  159. package/dist/types/plugins/json-schema-preset/{manager.d.ts → types.d.ts} +5 -0
  160. package/dist/types/shared/flow-value/utils.d.ts +3 -1
  161. package/dist/types/shared/inject-material/index.d.ts +6 -4
  162. package/dist/types/validate/validate-flow-value/index.d.ts +1 -1
  163. package/package.json +56 -17
  164. package/src/components/blur-input/index.tsx +9 -1
  165. package/src/components/code-editor/editor-all.tsx +30 -0
  166. package/src/components/code-editor/editor-json.tsx +25 -0
  167. package/src/components/code-editor/editor-python.tsx +18 -0
  168. package/src/components/code-editor/editor-shell.tsx +18 -0
  169. package/src/components/code-editor/editor-sql.tsx +24 -0
  170. package/src/components/code-editor/editor-ts.tsx +31 -0
  171. package/src/components/code-editor/editor.tsx +45 -36
  172. package/src/components/code-editor/factory.tsx +61 -0
  173. package/src/components/code-editor/index.tsx +7 -7
  174. package/src/components/code-editor/theme/dark.ts +62 -77
  175. package/src/components/code-editor/theme/light.ts +60 -91
  176. package/src/components/code-editor/utils.ts +4 -0
  177. package/src/components/code-editor-mini/index.tsx +3 -0
  178. package/src/components/condition-context/context.tsx +28 -0
  179. package/src/components/condition-context/hooks/use-condition.tsx +99 -0
  180. package/src/components/condition-context/index.tsx +14 -0
  181. package/src/components/condition-context/op.ts +86 -0
  182. package/src/components/condition-context/types.ts +22 -0
  183. package/src/components/condition-row/index.tsx +44 -22
  184. package/src/components/condition-row/types.ts +0 -30
  185. package/src/components/{prompt-editor-with-inputs/inputs-picker.tsx → coze-editor-extensions/extensions/inputs-tree.tsx} +95 -5
  186. package/src/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.tsx +6 -3
  187. package/src/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.tsx +12 -3
  188. package/src/components/coze-editor-extensions/index.tsx +33 -0
  189. package/src/components/db-condition-row/index.tsx +76 -24
  190. package/src/components/db-condition-row/types.ts +0 -13
  191. package/src/components/display-schema-tree/index.tsx +6 -4
  192. package/src/components/index.ts +29 -1
  193. package/src/components/json-editor-with-variables/editor.tsx +7 -8
  194. package/src/components/prompt-editor-with-inputs/editor.tsx +2 -3
  195. package/src/components/prompt-editor-with-variables/editor.tsx +3 -5
  196. package/src/components/sql-editor-with-variables/editor.tsx +28 -0
  197. package/src/components/sql-editor-with-variables/index.tsx +12 -0
  198. package/src/components/type-selector/index.tsx +2 -3
  199. package/src/components/variable-selector/index.tsx +2 -2
  200. package/src/components/variable-selector/use-variable-tree.tsx +7 -4
  201. package/src/effects/provide-batch-input/index.ts +1 -2
  202. package/src/effects/provide-json-schema-outputs/index.ts +1 -2
  203. package/src/form-plugins/batch-outputs-plugin/index.ts +64 -46
  204. package/src/form-plugins/infer-assign-plugin/index.ts +1 -2
  205. package/src/form-plugins/infer-inputs-plugin/index.ts +62 -14
  206. package/src/index.ts +19 -0
  207. package/src/plugins/json-schema-preset/create-type-preset-plugin.tsx +4 -2
  208. package/src/plugins/json-schema-preset/index.tsx +4 -20
  209. package/src/plugins/json-schema-preset/react.tsx +31 -0
  210. package/src/plugins/json-schema-preset/type-definition/array.tsx +13 -4
  211. package/src/plugins/json-schema-preset/type-definition/boolean.tsx +17 -1
  212. package/src/plugins/json-schema-preset/type-definition/date-time.tsx +21 -2
  213. package/src/plugins/json-schema-preset/type-definition/index.tsx +10 -1
  214. package/src/plugins/json-schema-preset/type-definition/integer.tsx +19 -1
  215. package/src/plugins/json-schema-preset/type-definition/map.tsx +31 -0
  216. package/src/plugins/json-schema-preset/type-definition/number.tsx +19 -1
  217. package/src/plugins/json-schema-preset/type-definition/object.tsx +9 -4
  218. package/src/plugins/json-schema-preset/type-definition/string.tsx +19 -1
  219. package/src/plugins/json-schema-preset/{manager.ts → types.ts} +7 -0
  220. package/src/shared/flow-value/utils.ts +22 -9
  221. package/src/shared/inject-material/index.tsx +10 -6
  222. package/src/validate/validate-flow-value/index.tsx +1 -2
  223. package/dist/cjs/components/code-editor/language-features.js +0 -21
  224. package/dist/cjs/components/condition-row/constants.js +0 -165
  225. package/dist/cjs/components/condition-row/hooks/useOp.js +0 -78
  226. package/dist/cjs/components/db-condition-row/hooks/use-left.js +0 -86
  227. package/dist/cjs/components/db-condition-row/hooks/use-op.js +0 -79
  228. package/dist/cjs/components/json-editor-with-variables/extensions/variable-tag.js +0 -151
  229. package/dist/cjs/components/json-editor-with-variables/extensions/variable-tree.js +0 -97
  230. package/dist/cjs/components/prompt-editor-with-inputs/extensions/inputs-tree.js +0 -101
  231. package/dist/cjs/components/prompt-editor-with-variables/styles.js +0 -89
  232. package/dist/esm/components/code-editor/init-worker.mjs +0 -19
  233. package/dist/esm/components/code-editor/language-features.mjs +0 -15
  234. package/dist/esm/components/condition-row/constants.mjs +0 -128
  235. package/dist/esm/components/condition-row/hooks/useOp.mjs +0 -44
  236. package/dist/esm/components/condition-row/hooks/useRule.mjs +0 -34
  237. package/dist/esm/components/db-condition-row/hooks/use-left.mjs +0 -52
  238. package/dist/esm/components/db-condition-row/hooks/use-op.mjs +0 -45
  239. package/dist/esm/components/json-editor-with-variables/extensions/variable-tree.mjs +0 -63
  240. package/dist/esm/components/prompt-editor-with-inputs/extensions/inputs-tree.mjs +0 -67
  241. package/dist/esm/components/prompt-editor-with-inputs/inputs-picker.mjs +0 -70
  242. package/dist/esm/components/prompt-editor-with-variables/extensions/variable-tag.mjs +0 -117
  243. package/dist/esm/components/prompt-editor-with-variables/styles.mjs +0 -36
  244. package/dist/types/components/code-editor/init-worker.d.ts +0 -5
  245. package/dist/types/components/code-editor/language-features.d.ts +0 -5
  246. package/dist/types/components/condition-row/constants.d.ts +0 -7
  247. package/dist/types/components/condition-row/hooks/useOp.d.ts +0 -18
  248. package/dist/types/components/condition-row/hooks/useRule.d.ts +0 -9
  249. package/dist/types/components/db-condition-row/hooks/use-left.d.ts +0 -18
  250. package/dist/types/components/db-condition-row/hooks/use-op.d.ts +0 -18
  251. package/dist/types/components/prompt-editor-with-inputs/extensions/inputs-tree.d.ts +0 -9
  252. package/dist/types/components/prompt-editor-with-variables/extensions/variable-tag.d.ts +0 -5
  253. package/dist/types/components/prompt-editor-with-variables/extensions/variable-tree.d.ts +0 -6
  254. package/dist/types/components/prompt-editor-with-variables/styles.d.ts +0 -9
  255. package/src/components/code-editor/init-worker.ts +0 -27
  256. package/src/components/code-editor/language-features.ts +0 -23
  257. package/src/components/condition-row/constants.ts +0 -134
  258. package/src/components/condition-row/hooks/useOp.tsx +0 -56
  259. package/src/components/condition-row/hooks/useRule.ts +0 -35
  260. package/src/components/db-condition-row/hooks/use-left.tsx +0 -66
  261. package/src/components/db-condition-row/hooks/use-op.tsx +0 -59
  262. package/src/components/json-editor-with-variables/extensions/variable-tag.tsx +0 -174
  263. package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +0 -83
  264. package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +0 -94
  265. package/src/components/prompt-editor-with-variables/styles.tsx +0 -44
  266. /package/dist/cjs/{plugins/json-schema-preset/manager.js → components/condition-context/types.js} +0 -0
  267. /package/dist/cjs/components/{json-editor-with-variables → coze-editor-extensions}/styles.js +0 -0
  268. /package/dist/esm/{plugins/json-schema-preset/manager.mjs → components/condition-context/types.mjs} +0 -0
  269. /package/dist/esm/components/{json-editor-with-variables → coze-editor-extensions}/styles.mjs +0 -0
  270. /package/dist/types/components/{json-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.d.ts +0 -0
  271. /package/dist/types/components/{json-editor-with-variables → coze-editor-extensions}/styles.d.ts +0 -0
  272. /package/src/components/{json-editor-with-variables → coze-editor-extensions}/styles.tsx +0 -0
@@ -30,9 +30,10 @@ class VariableTagWidget extends WidgetType {
30
30
  color: "amber",
31
31
  children: "Unknown"
32
32
  }));
33
- const rootField = last(v.parentFields);
33
+ const rootField = last(v.parentFields) || v;
34
+ const isRoot = v === rootField;
34
35
  const rootTitle = /*#__PURE__*/ jsx(UIRootTitle, {
35
- children: rootField?.meta.title ? `${rootField.meta.title} -` : ''
36
+ children: rootField.meta?.title ? `${rootField.meta.title} ${isRoot ? '' : '-'} ` : ''
36
37
  });
37
38
  const rootIcon = this.renderIcon(rootField?.meta.icon);
38
39
  this.root.render(/*#__PURE__*/ jsx(Popover, {
@@ -49,7 +50,7 @@ class VariableTagWidget extends WidgetType {
49
50
  prefixIcon: rootIcon,
50
51
  children: [
51
52
  rootTitle,
52
- /*#__PURE__*/ jsx(UIVarName, {
53
+ !isRoot && /*#__PURE__*/ jsx(UIVarName, {
53
54
  children: v?.key
54
55
  })
55
56
  ]
@@ -3,7 +3,12 @@ import { useEffect, useState } from "react";
3
3
  import { Mention, PositionMirror, getCurrentMentionReplaceRange, useEditor } from "@flowgram.ai/coze-editor/react";
4
4
  import { Popover, Tree } from "@douyinfe/semi-ui";
5
5
  import { useVariableTree } from "../../variable-selector/index.mjs";
6
- function VariableTree() {
6
+ const DEFAULT_TRIGGER_CHARACTER = [
7
+ '{',
8
+ '{}',
9
+ '@'
10
+ ];
11
+ function VariableTree({ triggerCharacters = DEFAULT_TRIGGER_CHARACTER }) {
7
12
  const [posKey, setPosKey] = useState('');
8
13
  const [visible, setVisible] = useState(false);
9
14
  const [position, setPosition] = useState(-1);
@@ -35,11 +40,7 @@ function VariableTree() {
35
40
  return /*#__PURE__*/ jsxs(Fragment, {
36
41
  children: [
37
42
  /*#__PURE__*/ jsx(Mention, {
38
- triggerCharacters: [
39
- '{',
40
- '{}',
41
- '@'
42
- ],
43
+ triggerCharacters: triggerCharacters,
43
44
  onOpenChange: handleOpenChange
44
45
  }),
45
46
  /*#__PURE__*/ jsx(Popover, {
@@ -49,10 +50,15 @@ function VariableTree() {
49
50
  rePosKey: posKey,
50
51
  content: /*#__PURE__*/ jsx("div", {
51
52
  style: {
52
- width: 300
53
+ width: 300,
54
+ maxHeight: 300,
55
+ overflowY: 'auto'
53
56
  },
54
57
  children: /*#__PURE__*/ jsx(Tree, {
55
58
  treeData: treeData,
59
+ onExpand: (v)=>{
60
+ setPosKey(String(Math.random()));
61
+ },
56
62
  onSelect: (v)=>{
57
63
  insert(v);
58
64
  }
@@ -0,0 +1,18 @@
1
+ import { lazy } from "react";
2
+ import { createInjectMaterial } from "../../shared/index.mjs";
3
+ const EditorVariableTree = createInjectMaterial(/*#__PURE__*/ lazy(()=>import("./extensions/variable-tree.mjs").then((module)=>({
4
+ default: module.VariableTree
5
+ }))), {
6
+ renderKey: 'EditorVariableTree'
7
+ });
8
+ const EditorVariableTagInject = createInjectMaterial(/*#__PURE__*/ lazy(()=>import("./extensions/variable-tag.mjs").then((module)=>({
9
+ default: module.VariableTagInject
10
+ }))), {
11
+ renderKey: 'EditorVariableTagInject'
12
+ });
13
+ const EditorInputsTree = createInjectMaterial(/*#__PURE__*/ lazy(()=>import("./extensions/inputs-tree.mjs").then((module)=>({
14
+ default: module.InputsTree
15
+ }))), {
16
+ renderKey: 'EditorInputsTree'
17
+ });
18
+ export { EditorInputsTree, EditorVariableTagInject, EditorVariableTree };
@@ -1,49 +1,74 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useMemo } from "react";
3
3
  import { I18n } from "@flowgram.ai/editor";
4
- import { Input } from "@douyinfe/semi-ui";
4
+ import { Button, Icon, Input, Select } from "@douyinfe/semi-ui";
5
+ import { IconChevronDownStroked } from "@douyinfe/semi-icons";
6
+ import { useTypeManager } from "../../plugins/index.mjs";
5
7
  import { InjectDynamicValueInput } from "../dynamic-value-input/index.mjs";
6
- import { UIContainer, UILeft, UIOperator, UIRight, UIValues } from "./styles.mjs";
7
- import { useOp } from "./hooks/use-op.mjs";
8
- import { useLeft } from "./hooks/use-left.mjs";
8
+ import { useCondition } from "../condition-context/index.mjs";
9
+ import { UIContainer, UILeft, UIOperator, UIOptionLabel, UIRight, UISelect, UIValues } from "./styles.mjs";
9
10
  const defaultRuleConfig = {
10
11
  ops: {},
11
12
  rules: {}
12
13
  };
13
14
  function DBConditionRow({ style, value, onChange, readonly, options, ruleConfig = defaultRuleConfig }) {
14
15
  const { left, operator, right } = value || {};
15
- const { rule, renderDBOptionSelect } = useLeft({
16
+ const typeManager = useTypeManager();
17
+ const leftSchema = useMemo(()=>options?.find((item)=>item.value === left)?.schema, [
16
18
  left,
17
- options,
18
- onChange: (leftKey)=>onChange({
19
- ...value,
20
- left: leftKey
21
- }),
22
- readonly,
23
- userRules: ruleConfig.rules
24
- });
25
- const { renderOpSelect, opConfig } = useOp({
26
- rule,
27
- op: operator,
28
- onChange: (v)=>onChange({
29
- ...value,
30
- operator: v
31
- }),
32
- readonly,
33
- userOps: ruleConfig.ops
34
- });
35
- const targetSchema = useMemo(()=>{
36
- const targetType = rule?.[operator || ''] || null;
37
- return targetType ? {
38
- type: targetType,
39
- extra: {
40
- weak: true
41
- }
42
- } : null;
43
- }, [
44
- rule,
45
- opConfig
19
+ options
46
20
  ]);
21
+ const { opConfig, rule, opOptionList, targetSchema } = useCondition({
22
+ leftSchema,
23
+ operator,
24
+ ruleConfig
25
+ });
26
+ const renderDBOptionSelect = ()=>/*#__PURE__*/ jsx(UISelect, {
27
+ disabled: readonly,
28
+ size: "small",
29
+ style: {
30
+ width: '100%'
31
+ },
32
+ value: left,
33
+ onChange: (v)=>onChange({
34
+ ...value,
35
+ left: v
36
+ }),
37
+ optionList: options?.map((item)=>({
38
+ label: /*#__PURE__*/ jsxs(UIOptionLabel, {
39
+ children: [
40
+ /*#__PURE__*/ jsx(Icon, {
41
+ size: "small",
42
+ svg: typeManager.getDisplayIcon(item.schema)
43
+ }),
44
+ item.label
45
+ ]
46
+ }),
47
+ value: item.value
48
+ })) || []
49
+ });
50
+ const renderOpSelect = ()=>/*#__PURE__*/ jsx(Select, {
51
+ style: {
52
+ height: 22
53
+ },
54
+ disabled: readonly,
55
+ size: "small",
56
+ value: operator,
57
+ optionList: opOptionList,
58
+ onChange: (v)=>{
59
+ onChange({
60
+ ...value,
61
+ operator: v
62
+ });
63
+ },
64
+ triggerRender: ({ value })=>/*#__PURE__*/ jsx(Button, {
65
+ size: "small",
66
+ disabled: !rule,
67
+ children: opConfig?.abbreviation || /*#__PURE__*/ jsx(IconChevronDownStroked, {
68
+ size: "small"
69
+ })
70
+ })
71
+ });
47
72
  return /*#__PURE__*/ jsxs(UIContainer, {
48
73
  style: style,
49
74
  children: [
@@ -1,6 +1,6 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import react from "react";
3
- import { useTypeManager } from "../../plugins/index.mjs";
3
+ import { useTypeManager } from "@flowgram.ai/json-schema";
4
4
  import { HorizontalLine, TreeItem, TreeLevel, TreeRow, TreeTitle } from "./styles.mjs";
5
5
  function DisplaySchemaTree(props) {
6
6
  return /*#__PURE__*/ jsx(SchemaTree, {
@@ -3,10 +3,12 @@ import { AssignRows } from "./assign-rows/index.mjs";
3
3
  import { BatchOutputs } from "./batch-outputs/index.mjs";
4
4
  import { BatchVariableSelector } from "./batch-variable-selector/index.mjs";
5
5
  import { BlurInput } from "./blur-input/index.mjs";
6
- import { CodeEditor } from "./code-editor/index.mjs";
6
+ import { BaseCodeEditor, CodeEditor, JsonCodeEditor, PythonCodeEditor, SQLCodeEditor, ShellCodeEditor, TypeScriptCodeEditor } from "./code-editor/index.mjs";
7
7
  import { CodeEditorMini } from "./code-editor-mini/index.mjs";
8
+ import { ConditionPresetOp, ConditionProvider, useCondition, useConditionContext } from "./condition-context/index.mjs";
8
9
  import { ConditionRow } from "./condition-row/index.mjs";
9
10
  import { ConstantInput } from "./constant-input/index.mjs";
11
+ import { EditorInputsTree, EditorVariableTagInject, EditorVariableTree } from "./coze-editor-extensions/index.mjs";
10
12
  import { DBConditionRow } from "./db-condition-row/index.mjs";
11
13
  import { DisplayFlowValue } from "./display-flow-value/index.mjs";
12
14
  import { DisplayInputsValueAllInTag, DisplayInputsValues } from "./display-inputs-values/index.mjs";
@@ -21,6 +23,7 @@ import { JsonSchemaEditor } from "./json-schema-editor/index.mjs";
21
23
  import { PromptEditor } from "./prompt-editor/index.mjs";
22
24
  import { PromptEditorWithInputs } from "./prompt-editor-with-inputs/index.mjs";
23
25
  import { PromptEditorWithVariables } from "./prompt-editor-with-variables/index.mjs";
26
+ import { SQLEditorWithVariables } from "./sql-editor-with-variables/index.mjs";
24
27
  import { InjectTypeSelector, TypeSelector, getTypeSelectValue, parseTypeSelectValue } from "./type-selector/index.mjs";
25
28
  import { InjectVariableSelector, VariableSelector, VariableSelectorProvider, useVariableTree } from "./variable-selector/index.mjs";
26
- export { AssignRow, AssignRows, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonEditorWithVariables, JsonSchemaEditor, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, VariableSelectorProvider, getTypeSelectValue, parseTypeSelectValue, useVariableTree };
29
+ export { AssignRow, AssignRows, BaseCodeEditor, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionPresetOp, ConditionProvider, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, EditorInputsTree, EditorVariableTagInject, EditorVariableTree, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonCodeEditor, JsonEditorWithVariables, JsonSchemaEditor, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, PythonCodeEditor, SQLCodeEditor, SQLEditorWithVariables, ShellCodeEditor, TypeScriptCodeEditor, TypeSelector, VariableSelector, VariableSelectorProvider, getTypeSelectValue, parseTypeSelectValue, useCondition, useConditionContext, useVariableTree };
@@ -2,9 +2,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { I18n } from "@flowgram.ai/editor";
4
4
  import { transformerCreator } from "@flowgram.ai/coze-editor/preset-code";
5
- import { CodeEditor } from "../code-editor/index.mjs";
6
- import { VariableTree } from "./extensions/variable-tree.mjs";
7
- import { VariableTagInject } from "./extensions/variable-tag.mjs";
5
+ import { EditorVariableTagInject, EditorVariableTree } from "../coze-editor-extensions/index.mjs";
6
+ import { JsonCodeEditor } from "../code-editor/index.mjs";
7
+ const TRIGGER_CHARACTERS = [
8
+ '@'
9
+ ];
8
10
  function findAllMatches(inputString, regex) {
9
11
  const globalRegex = new RegExp(regex, regex.flags.includes('g') ? regex.flags : regex.flags + 'g');
10
12
  let match;
@@ -30,8 +32,7 @@ const transformer = transformerCreator((text)=>{
30
32
  return text;
31
33
  });
32
34
  function JsonEditorWithVariables(props) {
33
- return /*#__PURE__*/ jsxs(CodeEditor, {
34
- languageId: "json",
35
+ return /*#__PURE__*/ jsxs(JsonCodeEditor, {
35
36
  activeLinePlaceholder: I18n.t("Press '@' to Select variable"),
36
37
  ...props,
37
38
  options: {
@@ -39,8 +40,10 @@ function JsonEditorWithVariables(props) {
39
40
  ...props.options || {}
40
41
  },
41
42
  children: [
42
- /*#__PURE__*/ jsx(VariableTree, {}),
43
- /*#__PURE__*/ jsx(VariableTagInject, {})
43
+ /*#__PURE__*/ jsx(EditorVariableTree, {
44
+ triggerCharacters: TRIGGER_CHARACTERS
45
+ }),
46
+ /*#__PURE__*/ jsx(EditorVariableTagInject, {})
44
47
  ]
45
48
  });
46
49
  }
@@ -1,11 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { PromptEditor } from "../prompt-editor/index.mjs";
4
- import { InputsTree } from "./extensions/inputs-tree.mjs";
4
+ import { EditorInputsTree } from "../coze-editor-extensions/index.mjs";
5
5
  function PromptEditorWithInputs({ inputsValues, ...restProps }) {
6
6
  return /*#__PURE__*/ jsx(PromptEditor, {
7
7
  ...restProps,
8
- children: /*#__PURE__*/ jsx(InputsTree, {
8
+ children: /*#__PURE__*/ jsx(EditorInputsTree, {
9
9
  inputsValues: inputsValues
10
10
  })
11
11
  });
@@ -1,14 +1,13 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { PromptEditor } from "../prompt-editor/index.mjs";
4
- import { VariableTree } from "./extensions/variable-tree.mjs";
5
- import { VariableTagInject } from "./extensions/variable-tag.mjs";
4
+ import { EditorVariableTagInject, EditorVariableTree } from "../coze-editor-extensions/index.mjs";
6
5
  function PromptEditorWithVariables(props) {
7
6
  return /*#__PURE__*/ jsxs(PromptEditor, {
8
7
  ...props,
9
8
  children: [
10
- /*#__PURE__*/ jsx(VariableTree, {}),
11
- /*#__PURE__*/ jsx(VariableTagInject, {})
9
+ /*#__PURE__*/ jsx(EditorVariableTree, {}),
10
+ /*#__PURE__*/ jsx(EditorVariableTagInject, {})
12
11
  ]
13
12
  });
14
13
  }
@@ -0,0 +1,19 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "react";
3
+ import { I18n } from "@flowgram.ai/editor";
4
+ import { EditorVariableTagInject, EditorVariableTree } from "../coze-editor-extensions/index.mjs";
5
+ import { SQLCodeEditor } from "../code-editor/index.mjs";
6
+ function SQLEditorWithVariables(props) {
7
+ return /*#__PURE__*/ jsxs(SQLCodeEditor, {
8
+ activeLinePlaceholder: I18n.t("Press '@' to Select variable"),
9
+ ...props,
10
+ options: {
11
+ ...props.options || {}
12
+ },
13
+ children: [
14
+ /*#__PURE__*/ jsx(EditorVariableTree, {}),
15
+ /*#__PURE__*/ jsx(EditorVariableTagInject, {})
16
+ ]
17
+ });
18
+ }
19
+ export { SQLEditorWithVariables };
@@ -0,0 +1,5 @@
1
+ import { lazySuspense } from "../../shared/index.mjs";
2
+ const SQLEditorWithVariables = lazySuspense(()=>import("./editor.mjs").then((module)=>({
3
+ default: module.SQLEditorWithVariables
4
+ })));
5
+ export { SQLEditorWithVariables };
@@ -1,8 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useMemo } from "react";
3
+ import { useTypeManager } from "@flowgram.ai/json-schema";
3
4
  import { Cascader, Icon, IconButton } from "@douyinfe/semi-ui";
4
5
  import { createInjectMaterial } from "../../shared/inject-material/index.mjs";
5
- import { useTypeManager } from "../../plugins/index.mjs";
6
6
  const labelStyle = {
7
7
  display: 'flex',
8
8
  alignItems: 'center',
@@ -1,9 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
- import { JsonSchemaUtils } from "@flowgram.ai/json-schema";
3
+ import { JsonSchemaUtils, useTypeManager } from "@flowgram.ai/json-schema";
4
4
  import { ASTMatch, useAvailableVariables } from "@flowgram.ai/editor";
5
5
  import { Icon } from "@douyinfe/semi-ui";
6
- import { useTypeManager } from "../../plugins/index.mjs";
7
6
  function useVariableTree(params) {
8
7
  const { includeSchema, excludeSchema, skipVariable } = params;
9
8
  const typeManager = useTypeManager();
@@ -1,11 +1,11 @@
1
- import { ASTFactory, createEffectFromVariableProvider, getNodeForm } from "@flowgram.ai/editor";
1
+ import { ASTFactory, createEffectFromVariableProvider } from "@flowgram.ai/editor";
2
2
  const provideBatchInputEffect = createEffectFromVariableProvider({
3
3
  private: true,
4
4
  parse: (value, ctx)=>[
5
5
  ASTFactory.createVariableDeclaration({
6
6
  key: `${ctx.node.id}_locals`,
7
7
  meta: {
8
- title: getNodeForm(ctx.node)?.getValueIn('title'),
8
+ title: ctx.node.form?.getValueIn('title'),
9
9
  icon: ctx.node.getNodeRegistry().info?.icon
10
10
  },
11
11
  type: ASTFactory.createObject({
@@ -1,11 +1,11 @@
1
1
  import { JsonSchemaUtils } from "@flowgram.ai/json-schema";
2
- import { ASTFactory, createEffectFromVariableProvider, getNodeForm } from "@flowgram.ai/editor";
2
+ import { ASTFactory, createEffectFromVariableProvider } from "@flowgram.ai/editor";
3
3
  const provideJsonSchemaOutputs = createEffectFromVariableProvider({
4
4
  parse: (value, ctx)=>[
5
5
  ASTFactory.createVariableDeclaration({
6
6
  key: `${ctx.node.id}`,
7
7
  meta: {
8
- title: getNodeForm(ctx.node)?.getValueIn('title') || ctx.node.id,
8
+ title: ctx.node.form?.getValueIn('title') || ctx.node.id,
9
9
  icon: ctx.node.getNodeRegistry().info?.icon
10
10
  },
11
11
  type: JsonSchemaUtils.schemaToAST(value)
@@ -1,10 +1,12 @@
1
- import { ASTFactory, FlowNodeScopeType, ScopeChainTransformService, createEffectFromVariableProvider, defineFormPluginCreator, getNodeForm, getNodePrivateScope, getNodeScope } from "@flowgram.ai/editor";
1
+ import { set } from "lodash-es";
2
+ import { JsonSchemaUtils } from "@flowgram.ai/json-schema";
3
+ import { ASTFactory, FlowNodeScopeType, ScopeChainTransformService, createEffectFromVariableProvider, defineFormPluginCreator, getNodePrivateScope, getNodeScope } from "@flowgram.ai/editor";
2
4
  const provideBatchOutputsEffect = createEffectFromVariableProvider({
3
5
  parse: (value, ctx)=>[
4
6
  ASTFactory.createVariableDeclaration({
5
7
  key: `${ctx.node.id}`,
6
8
  meta: {
7
- title: getNodeForm(ctx.node)?.getValueIn('title'),
9
+ title: ctx.node.form?.getValueIn('title'),
8
10
  icon: ctx.node.getNodeRegistry().info?.icon
9
11
  },
10
12
  type: ASTFactory.createObject({
@@ -22,10 +24,15 @@ const provideBatchOutputsEffect = createEffectFromVariableProvider({
22
24
  });
23
25
  const createBatchOutputsFormPlugin = defineFormPluginCreator({
24
26
  name: 'batch-outputs-plugin',
25
- onSetupFormMeta ({ mergeEffect }, { outputKey }) {
27
+ onSetupFormMeta ({ mergeEffect, addFormatOnSubmit }, { outputKey, inferTargetKey }) {
26
28
  mergeEffect({
27
29
  [outputKey]: provideBatchOutputsEffect
28
30
  });
31
+ if (inferTargetKey) addFormatOnSubmit((formData, ctx)=>{
32
+ const outputVariable = getNodeScope(ctx.node).output.variables?.[0];
33
+ if (outputVariable?.type) set(formData, inferTargetKey, JsonSchemaUtils.astToSchema(outputVariable?.type));
34
+ return formData;
35
+ });
29
36
  },
30
37
  onInit (ctx, { outputKey }) {
31
38
  const chainTransformService = ctx.node.getService(ScopeChainTransformService);
@@ -1,6 +1,6 @@
1
1
  import { set, uniqBy } from "lodash-es";
2
2
  import { JsonSchemaUtils } from "@flowgram.ai/json-schema";
3
- import { ASTFactory, createEffectFromVariableProvider, defineFormPluginCreator, getNodeForm, getNodeScope } from "@flowgram.ai/editor";
3
+ import { ASTFactory, createEffectFromVariableProvider, defineFormPluginCreator, getNodeScope } from "@flowgram.ai/editor";
4
4
  const createInferAssignPlugin = defineFormPluginCreator({
5
5
  onSetupFormMeta ({ addFormatOnSubmit, mergeEffect }, { assignKey, outputKey }) {
6
6
  if (!assignKey || !outputKey) return;
@@ -12,7 +12,7 @@ const createInferAssignPlugin = defineFormPluginCreator({
12
12
  ASTFactory.createVariableDeclaration({
13
13
  key: `${ctx.node.id}`,
14
14
  meta: {
15
- title: getNodeForm(ctx.node)?.getValueIn('title'),
15
+ title: ctx.node.form?.getValueIn('title'),
16
16
  icon: ctx.node.getNodeRegistry().info?.icon
17
17
  },
18
18
  type: ASTFactory.createObject({
@@ -1,11 +1,38 @@
1
- import { get, set } from "lodash-es";
1
+ import { get, omit, set } from "lodash-es";
2
+ import { Immer } from "immer";
2
3
  import { defineFormPluginCreator, getNodePrivateScope, getNodeScope } from "@flowgram.ai/editor";
3
4
  import { FlowValueUtils } from "../../shared/index.mjs";
5
+ const { produce } = new Immer({
6
+ autoFreeze: false
7
+ });
4
8
  const createInferInputsPlugin = defineFormPluginCreator({
5
- onSetupFormMeta ({ addFormatOnSubmit }, { sourceKey, targetKey, scope }) {
9
+ onSetupFormMeta ({ addFormatOnSubmit, addFormatOnInit }, { sourceKey, targetKey, scope, ignoreConstantSchema }) {
6
10
  if (!sourceKey || !targetKey) return;
7
- addFormatOnSubmit((formData, ctx)=>{
8
- set(formData, targetKey, FlowValueUtils.inferJsonSchema(get(formData, sourceKey), 'private' === scope ? getNodePrivateScope(ctx.node) : getNodeScope(ctx.node)));
11
+ addFormatOnSubmit((formData, ctx)=>produce(formData, (draft)=>{
12
+ const sourceData = get(formData, sourceKey);
13
+ set(draft, targetKey, FlowValueUtils.inferJsonSchema(sourceData, 'private' === scope ? getNodePrivateScope(ctx.node) : getNodeScope(ctx.node)));
14
+ if (ignoreConstantSchema) {
15
+ for (const { value, path } of FlowValueUtils.traverse(sourceData, {
16
+ includeTypes: [
17
+ 'constant'
18
+ ]
19
+ }))if (FlowValueUtils.isConstant(value) && value?.schema) set(formData, `${sourceKey}.${path}`, omit(value, [
20
+ 'schema'
21
+ ]));
22
+ }
23
+ }));
24
+ if (ignoreConstantSchema) addFormatOnInit((formData, ctx)=>{
25
+ const targetSchema = get(formData, targetKey);
26
+ if (!targetSchema) return formData;
27
+ for (const { value, pathArr } of FlowValueUtils.traverse(get(formData, sourceKey), {
28
+ includeTypes: [
29
+ 'constant'
30
+ ]
31
+ }))if (FlowValueUtils.isConstant(value) && !value?.schema) {
32
+ const schemaPath = pathArr.map((_item)=>`properties.${_item}`).join('.');
33
+ const schema = get(targetSchema, schemaPath);
34
+ if (schema) set(value, 'schema', schema);
35
+ }
9
36
  return formData;
10
37
  });
11
38
  }
@@ -1,8 +1,8 @@
1
- import { AssignRow, AssignRows, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonEditorWithVariables, JsonSchemaEditor, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, VariableSelectorProvider, getTypeSelectValue, parseTypeSelectValue, useVariableTree } from "./components/index.mjs";
1
+ import { AssignRow, AssignRows, BaseCodeEditor, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionPresetOp, ConditionProvider, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, EditorInputsTree, EditorVariableTagInject, EditorVariableTree, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonCodeEditor, JsonEditorWithVariables, JsonSchemaEditor, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, PythonCodeEditor, SQLCodeEditor, SQLEditorWithVariables, ShellCodeEditor, TypeScriptCodeEditor, TypeSelector, VariableSelector, VariableSelectorProvider, getTypeSelectValue, parseTypeSelectValue, useCondition, useConditionContext, useVariableTree } from "./components/index.mjs";
2
2
  import { autoRenameRefEffect, listenRefSchemaChange, listenRefValueChange, provideBatchInputEffect, provideJsonSchemaOutputs, syncVariableTitle, validateWhenVariableSync } from "./effects/index.mjs";
3
3
  import { createBatchOutputsFormPlugin, createInferAssignPlugin, createInferInputsPlugin, provideBatchOutputsEffect } from "./form-plugins/index.mjs";
4
4
  import { useObjectList } from "./hooks/index.mjs";
5
5
  import { JsonSchemaTypePresetProvider, JsonSchemaUtils, createDisableDeclarationPlugin, createTypePresetPlugin, useTypeManager } from "./plugins/index.mjs";
6
6
  import { FlowValueUtils, createInjectMaterial, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, lazySuspense, polyfillCreateRoot, unstableSetCreateRoot, withSuspense } from "./shared/index.mjs";
7
7
  import { validateFlowValue } from "./validate/index.mjs";
8
- export { AssignRow, AssignRows, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, FlowValueUtils, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonEditorWithVariables, JsonSchemaEditor, JsonSchemaTypePresetProvider, JsonSchemaUtils, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, VariableSelectorProvider, autoRenameRefEffect, createBatchOutputsFormPlugin, createDisableDeclarationPlugin, createInferAssignPlugin, createInferInputsPlugin, createInjectMaterial, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, lazySuspense, listenRefSchemaChange, listenRefValueChange, parseTypeSelectValue, polyfillCreateRoot, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, unstableSetCreateRoot, useObjectList, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync, withSuspense };
8
+ export { AssignRow, AssignRows, BaseCodeEditor, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionPresetOp, ConditionProvider, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, EditorInputsTree, EditorVariableTagInject, EditorVariableTree, FlowValueUtils, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonCodeEditor, JsonEditorWithVariables, JsonSchemaEditor, JsonSchemaTypePresetProvider, JsonSchemaUtils, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, PythonCodeEditor, SQLCodeEditor, SQLEditorWithVariables, ShellCodeEditor, TypeScriptCodeEditor, TypeSelector, VariableSelector, VariableSelectorProvider, autoRenameRefEffect, createBatchOutputsFormPlugin, createDisableDeclarationPlugin, createInferAssignPlugin, createInferInputsPlugin, createInjectMaterial, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, lazySuspense, listenRefSchemaChange, listenRefValueChange, parseTypeSelectValue, polyfillCreateRoot, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, unstableSetCreateRoot, useCondition, useConditionContext, useObjectList, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync, withSuspense };
@@ -1,6 +1,7 @@
1
1
  import { BaseTypeManager, jsonSchemaContainerModule } from "@flowgram.ai/json-schema";
2
2
  import { definePluginCreator } from "@flowgram.ai/editor";
3
- import { jsonSchemaTypePreset } from "./type-definition/index.mjs";
3
+ import { initRegistries, jsonSchemaTypePreset } from "./type-definition/index.mjs";
4
+ initRegistries();
4
5
  const createTypePresetPlugin = definePluginCreator({
5
6
  onInit (ctx, opts) {
6
7
  const typeManager = ctx.get(BaseTypeManager);
@@ -1,14 +1,4 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import "react";
3
- import { JsonSchemaUtils, TypePresetProvider, useTypeManager } from "@flowgram.ai/json-schema";
4
- import { jsonSchemaTypePreset } from "./type-definition/index.mjs";
1
+ import { JsonSchemaUtils } from "@flowgram.ai/json-schema";
2
+ import { JsonSchemaTypePresetProvider, useTypeManager } from "./react.mjs";
5
3
  import { createTypePresetPlugin } from "./create-type-preset-plugin.mjs";
6
- const json_schema_preset_useTypeManager = ()=>useTypeManager();
7
- const JsonSchemaTypePresetProvider = ({ types = [], children })=>/*#__PURE__*/ jsx(TypePresetProvider, {
8
- types: [
9
- ...jsonSchemaTypePreset,
10
- ...types
11
- ],
12
- children: children
13
- });
14
- export { JsonSchemaTypePresetProvider, JsonSchemaUtils, createTypePresetPlugin, json_schema_preset_useTypeManager as useTypeManager };
4
+ export { JsonSchemaTypePresetProvider, JsonSchemaUtils, createTypePresetPlugin, useTypeManager };
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { TypePresetProvider, useTypeManager } from "@flowgram.ai/json-schema";
4
+ import { initRegistries, jsonSchemaTypePreset } from "./type-definition/index.mjs";
5
+ initRegistries();
6
+ const react_useTypeManager = ()=>useTypeManager();
7
+ const JsonSchemaTypePresetProvider = ({ types = [], children })=>/*#__PURE__*/ jsx(TypePresetProvider, {
8
+ types: [
9
+ ...jsonSchemaTypePreset,
10
+ ...types
11
+ ],
12
+ children: children
13
+ });
14
+ export { JsonSchemaTypePresetProvider, react_useTypeManager as useTypeManager };
@@ -1,15 +1,44 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { I18n } from "@flowgram.ai/editor";
4
- import { CodeEditorMini } from "../../../components/code-editor-mini/index.mjs";
4
+ import { ConditionPresetOp } from "../../../components/condition-context/op.mjs";
5
+ import { JsonCodeEditor } from "../../../components/code-editor/index.mjs";
5
6
  const arrayRegistry = {
6
7
  type: 'array',
7
- ConstantRenderer: (props)=>/*#__PURE__*/ jsx(CodeEditorMini, {
8
+ ConstantRenderer: (props)=>/*#__PURE__*/ jsx(JsonCodeEditor, {
9
+ mini: true,
8
10
  value: props.value,
9
- languageId: "json",
10
11
  onChange: (v)=>props.onChange?.(v),
11
12
  placeholder: I18n.t('Please Input Array'),
12
13
  readonly: props.readonly
13
- })
14
+ }),
15
+ conditionRule: {
16
+ [ConditionPresetOp.IS_EMPTY]: null,
17
+ [ConditionPresetOp.IS_NOT_EMPTY]: null,
18
+ [ConditionPresetOp.CONTAINS]: {
19
+ type: 'array',
20
+ extra: {
21
+ weak: true
22
+ }
23
+ },
24
+ [ConditionPresetOp.NOT_CONTAINS]: {
25
+ type: 'array',
26
+ extra: {
27
+ weak: true
28
+ }
29
+ },
30
+ [ConditionPresetOp.EQ]: {
31
+ type: 'array',
32
+ extra: {
33
+ weak: true
34
+ }
35
+ },
36
+ [ConditionPresetOp.NEQ]: {
37
+ type: 'array',
38
+ extra: {
39
+ weak: true
40
+ }
41
+ }
42
+ }
14
43
  };
15
44
  export { arrayRegistry };
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { I18n } from "@flowgram.ai/editor";
4
4
  import { Select } from "@douyinfe/semi-ui";
5
+ import { ConditionPresetOp } from "../../../components/condition-context/op.mjs";
5
6
  const booleanRegistry = {
6
7
  type: 'boolean',
7
8
  ConstantRenderer: (props)=>{
@@ -24,6 +25,28 @@ const booleanRegistry = {
24
25
  onChange: (value)=>onChange?.(!!value),
25
26
  ...rest
26
27
  });
28
+ },
29
+ conditionRule: {
30
+ [ConditionPresetOp.EQ]: {
31
+ type: 'boolean'
32
+ },
33
+ [ConditionPresetOp.NEQ]: {
34
+ type: 'boolean'
35
+ },
36
+ [ConditionPresetOp.IS_TRUE]: null,
37
+ [ConditionPresetOp.IS_FALSE]: null,
38
+ [ConditionPresetOp.IN]: {
39
+ type: 'array',
40
+ items: {
41
+ type: 'boolean'
42
+ }
43
+ },
44
+ [ConditionPresetOp.NIN]: {
45
+ type: 'array',
46
+ items: {
47
+ type: 'boolean'
48
+ }
49
+ }
27
50
  }
28
51
  };
29
52
  export { booleanRegistry };