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

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,48 +30,73 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
30
  const external_react_namespaceObject = require("react");
31
31
  const editor_namespaceObject = require("@flowgram.ai/editor");
32
32
  const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
33
- const index_js_namespaceObject = require("../dynamic-value-input/index.js");
33
+ const semi_icons_namespaceObject = require("@douyinfe/semi-icons");
34
+ const index_js_namespaceObject = require("../../plugins/index.js");
35
+ const external_dynamic_value_input_index_js_namespaceObject = require("../dynamic-value-input/index.js");
36
+ const external_condition_context_index_js_namespaceObject = require("../condition-context/index.js");
34
37
  const external_styles_js_namespaceObject = require("./styles.js");
35
- const use_op_js_namespaceObject = require("./hooks/use-op.js");
36
- const use_left_js_namespaceObject = require("./hooks/use-left.js");
37
38
  const defaultRuleConfig = {
38
39
  ops: {},
39
40
  rules: {}
40
41
  };
41
42
  function DBConditionRow({ style, value, onChange, readonly, options, ruleConfig = defaultRuleConfig }) {
42
43
  const { left, operator, right } = value || {};
43
- const { rule, renderDBOptionSelect } = (0, use_left_js_namespaceObject.useLeft)({
44
+ const typeManager = (0, index_js_namespaceObject.useTypeManager)();
45
+ const leftSchema = (0, external_react_namespaceObject.useMemo)(()=>options?.find((item)=>item.value === left)?.schema, [
44
46
  left,
45
- options,
46
- onChange: (leftKey)=>onChange({
47
- ...value,
48
- left: leftKey
49
- }),
50
- readonly,
51
- userRules: ruleConfig.rules
52
- });
53
- const { renderOpSelect, opConfig } = (0, use_op_js_namespaceObject.useOp)({
54
- rule,
55
- op: operator,
56
- onChange: (v)=>onChange({
57
- ...value,
58
- operator: v
59
- }),
60
- readonly,
61
- userOps: ruleConfig.ops
62
- });
63
- const targetSchema = (0, external_react_namespaceObject.useMemo)(()=>{
64
- const targetType = rule?.[operator || ''] || null;
65
- return targetType ? {
66
- type: targetType,
67
- extra: {
68
- weak: true
69
- }
70
- } : null;
71
- }, [
72
- rule,
73
- opConfig
47
+ options
74
48
  ]);
49
+ const { opConfig, rule, opOptionList, targetSchema } = (0, external_condition_context_index_js_namespaceObject.useCondition)({
50
+ leftSchema,
51
+ operator,
52
+ ruleConfig
53
+ });
54
+ const renderDBOptionSelect = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_styles_js_namespaceObject.UISelect, {
55
+ disabled: readonly,
56
+ size: "small",
57
+ style: {
58
+ width: '100%'
59
+ },
60
+ value: left,
61
+ onChange: (v)=>onChange({
62
+ ...value,
63
+ left: v
64
+ }),
65
+ optionList: options?.map((item)=>({
66
+ label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_styles_js_namespaceObject.UIOptionLabel, {
67
+ children: [
68
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Icon, {
69
+ size: "small",
70
+ svg: typeManager.getDisplayIcon(item.schema)
71
+ }),
72
+ item.label
73
+ ]
74
+ }),
75
+ value: item.value
76
+ })) || []
77
+ });
78
+ const renderOpSelect = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Select, {
79
+ style: {
80
+ height: 22
81
+ },
82
+ disabled: readonly,
83
+ size: "small",
84
+ value: operator,
85
+ optionList: opOptionList,
86
+ onChange: (v)=>{
87
+ onChange({
88
+ ...value,
89
+ operator: v
90
+ });
91
+ },
92
+ triggerRender: ({ value })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Button, {
93
+ size: "small",
94
+ disabled: !rule,
95
+ children: opConfig?.abbreviation || /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_icons_namespaceObject.IconChevronDownStroked, {
96
+ size: "small"
97
+ })
98
+ })
99
+ });
75
100
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_styles_js_namespaceObject.UIContainer, {
76
101
  style: style,
77
102
  children: [
@@ -84,7 +109,7 @@ function DBConditionRow({ style, value, onChange, readonly, options, ruleConfig
84
109
  children: renderDBOptionSelect()
85
110
  }),
86
111
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_styles_js_namespaceObject.UIRight, {
87
- children: targetSchema ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.InjectDynamicValueInput, {
112
+ children: targetSchema ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dynamic_value_input_index_js_namespaceObject.InjectDynamicValueInput, {
88
113
  readonly: readonly || !rule,
89
114
  value: right,
90
115
  schema: targetSchema,
@@ -38,7 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
38
38
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
39
39
  const external_react_namespaceObject = require("react");
40
40
  var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
41
- const index_js_namespaceObject = require("../../plugins/index.js");
41
+ const json_schema_namespaceObject = require("@flowgram.ai/json-schema");
42
42
  const external_styles_js_namespaceObject = require("./styles.js");
43
43
  function DisplaySchemaTree(props) {
44
44
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SchemaTree, {
@@ -47,7 +47,7 @@ function DisplaySchemaTree(props) {
47
47
  }
48
48
  function SchemaTree(props) {
49
49
  const { value: schema = {}, drilldown = true, depth = 0, showIcon = true, parentKey = '' } = props || {};
50
- const typeManager = (0, index_js_namespaceObject.useTypeManager)();
50
+ const typeManager = (0, json_schema_namespaceObject.useTypeManager)();
51
51
  const config = typeManager.getTypeBySchema(schema);
52
52
  const title = typeManager.getComplexText(schema);
53
53
  const icon = typeManager?.getDisplayIcon(schema);
@@ -25,6 +25,7 @@ var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  BatchVariableSelector: ()=>external_batch_variable_selector_index_js_namespaceObject.BatchVariableSelector,
28
+ JsonCodeEditor: ()=>external_code_editor_index_js_namespaceObject.JsonCodeEditor,
28
29
  AssignRow: ()=>index_js_namespaceObject.AssignRow,
29
30
  TypeSelector: ()=>external_type_selector_index_js_namespaceObject.TypeSelector,
30
31
  CodeEditorMini: ()=>external_code_editor_mini_index_js_namespaceObject.CodeEditorMini,
@@ -32,27 +33,40 @@ __webpack_require__.d(__webpack_exports__, {
32
33
  DynamicValueInput: ()=>external_dynamic_value_input_index_js_namespaceObject.DynamicValueInput,
33
34
  AssignRows: ()=>external_assign_rows_index_js_namespaceObject.AssignRows,
34
35
  ConditionRow: ()=>external_condition_row_index_js_namespaceObject.ConditionRow,
36
+ EditorInputsTree: ()=>external_coze_editor_extensions_index_js_namespaceObject.EditorInputsTree,
37
+ ConditionProvider: ()=>external_condition_context_index_js_namespaceObject.ConditionProvider,
35
38
  InjectDynamicValueInput: ()=>external_dynamic_value_input_index_js_namespaceObject.InjectDynamicValueInput,
36
- PromptEditorWithVariables: ()=>external_prompt_editor_with_variables_index_js_namespaceObject.PromptEditorWithVariables,
37
39
  JsonEditorWithVariables: ()=>external_json_editor_with_variables_index_js_namespaceObject.JsonEditorWithVariables,
38
40
  InjectVariableSelector: ()=>external_variable_selector_index_js_namespaceObject.InjectVariableSelector,
41
+ PromptEditorWithVariables: ()=>external_prompt_editor_with_variables_index_js_namespaceObject.PromptEditorWithVariables,
39
42
  DisplayOutputs: ()=>external_display_outputs_index_js_namespaceObject.DisplayOutputs,
43
+ BaseCodeEditor: ()=>external_code_editor_index_js_namespaceObject.BaseCodeEditor,
44
+ useConditionContext: ()=>external_condition_context_index_js_namespaceObject.useConditionContext,
40
45
  DisplaySchemaTree: ()=>external_display_schema_tree_index_js_namespaceObject.DisplaySchemaTree,
46
+ useCondition: ()=>external_condition_context_index_js_namespaceObject.useCondition,
41
47
  PromptEditor: ()=>external_prompt_editor_index_js_namespaceObject.PromptEditor,
42
48
  ConstantInput: ()=>external_constant_input_index_js_namespaceObject.ConstantInput,
43
49
  BlurInput: ()=>external_blur_input_index_js_namespaceObject.BlurInput,
44
50
  DisplaySchemaTag: ()=>external_display_schema_tag_index_js_namespaceObject.DisplaySchemaTag,
51
+ ConditionPresetOp: ()=>external_condition_context_index_js_namespaceObject.ConditionPresetOp,
45
52
  InputsValues: ()=>external_inputs_values_index_js_namespaceObject.InputsValues,
46
- useVariableTree: ()=>external_variable_selector_index_js_namespaceObject.useVariableTree,
53
+ PythonCodeEditor: ()=>external_code_editor_index_js_namespaceObject.PythonCodeEditor,
54
+ SQLCodeEditor: ()=>external_code_editor_index_js_namespaceObject.SQLCodeEditor,
47
55
  InjectTypeSelector: ()=>external_type_selector_index_js_namespaceObject.InjectTypeSelector,
56
+ ShellCodeEditor: ()=>external_code_editor_index_js_namespaceObject.ShellCodeEditor,
48
57
  VariableSelectorProvider: ()=>external_variable_selector_index_js_namespaceObject.VariableSelectorProvider,
58
+ useVariableTree: ()=>external_variable_selector_index_js_namespaceObject.useVariableTree,
49
59
  DisplayFlowValue: ()=>external_display_flow_value_index_js_namespaceObject.DisplayFlowValue,
50
60
  JsonSchemaEditor: ()=>external_json_schema_editor_index_js_namespaceObject.JsonSchemaEditor,
51
- PromptEditorWithInputs: ()=>external_prompt_editor_with_inputs_index_js_namespaceObject.PromptEditorWithInputs,
61
+ EditorVariableTagInject: ()=>external_coze_editor_extensions_index_js_namespaceObject.EditorVariableTagInject,
52
62
  InputsValuesTree: ()=>external_inputs_values_tree_index_js_namespaceObject.InputsValuesTree,
53
- parseTypeSelectValue: ()=>external_type_selector_index_js_namespaceObject.parseTypeSelectValue,
63
+ PromptEditorWithInputs: ()=>external_prompt_editor_with_inputs_index_js_namespaceObject.PromptEditorWithInputs,
64
+ SQLEditorWithVariables: ()=>external_sql_editor_with_variables_index_js_namespaceObject.SQLEditorWithVariables,
65
+ TypeScriptCodeEditor: ()=>external_code_editor_index_js_namespaceObject.TypeScriptCodeEditor,
54
66
  CodeEditor: ()=>external_code_editor_index_js_namespaceObject.CodeEditor,
55
67
  DisplayInputsValueAllInTag: ()=>external_display_inputs_values_index_js_namespaceObject.DisplayInputsValueAllInTag,
68
+ parseTypeSelectValue: ()=>external_type_selector_index_js_namespaceObject.parseTypeSelectValue,
69
+ EditorVariableTree: ()=>external_coze_editor_extensions_index_js_namespaceObject.EditorVariableTree,
56
70
  getTypeSelectValue: ()=>external_type_selector_index_js_namespaceObject.getTypeSelectValue,
57
71
  DisplayInputsValues: ()=>external_display_inputs_values_index_js_namespaceObject.DisplayInputsValues,
58
72
  BatchOutputs: ()=>external_batch_outputs_index_js_namespaceObject.BatchOutputs,
@@ -65,8 +79,10 @@ const external_batch_variable_selector_index_js_namespaceObject = require("./bat
65
79
  const external_blur_input_index_js_namespaceObject = require("./blur-input/index.js");
66
80
  const external_code_editor_index_js_namespaceObject = require("./code-editor/index.js");
67
81
  const external_code_editor_mini_index_js_namespaceObject = require("./code-editor-mini/index.js");
82
+ const external_condition_context_index_js_namespaceObject = require("./condition-context/index.js");
68
83
  const external_condition_row_index_js_namespaceObject = require("./condition-row/index.js");
69
84
  const external_constant_input_index_js_namespaceObject = require("./constant-input/index.js");
85
+ const external_coze_editor_extensions_index_js_namespaceObject = require("./coze-editor-extensions/index.js");
70
86
  const external_db_condition_row_index_js_namespaceObject = require("./db-condition-row/index.js");
71
87
  const external_display_flow_value_index_js_namespaceObject = require("./display-flow-value/index.js");
72
88
  const external_display_inputs_values_index_js_namespaceObject = require("./display-inputs-values/index.js");
@@ -81,15 +97,19 @@ const external_json_schema_editor_index_js_namespaceObject = require("./json-sch
81
97
  const external_prompt_editor_index_js_namespaceObject = require("./prompt-editor/index.js");
82
98
  const external_prompt_editor_with_inputs_index_js_namespaceObject = require("./prompt-editor-with-inputs/index.js");
83
99
  const external_prompt_editor_with_variables_index_js_namespaceObject = require("./prompt-editor-with-variables/index.js");
100
+ const external_sql_editor_with_variables_index_js_namespaceObject = require("./sql-editor-with-variables/index.js");
84
101
  const external_type_selector_index_js_namespaceObject = require("./type-selector/index.js");
85
102
  const external_variable_selector_index_js_namespaceObject = require("./variable-selector/index.js");
86
103
  exports.AssignRow = __webpack_exports__.AssignRow;
87
104
  exports.AssignRows = __webpack_exports__.AssignRows;
105
+ exports.BaseCodeEditor = __webpack_exports__.BaseCodeEditor;
88
106
  exports.BatchOutputs = __webpack_exports__.BatchOutputs;
89
107
  exports.BatchVariableSelector = __webpack_exports__.BatchVariableSelector;
90
108
  exports.BlurInput = __webpack_exports__.BlurInput;
91
109
  exports.CodeEditor = __webpack_exports__.CodeEditor;
92
110
  exports.CodeEditorMini = __webpack_exports__.CodeEditorMini;
111
+ exports.ConditionPresetOp = __webpack_exports__.ConditionPresetOp;
112
+ exports.ConditionProvider = __webpack_exports__.ConditionProvider;
93
113
  exports.ConditionRow = __webpack_exports__.ConditionRow;
94
114
  exports.ConstantInput = __webpack_exports__.ConstantInput;
95
115
  exports.DBConditionRow = __webpack_exports__.DBConditionRow;
@@ -100,30 +120,44 @@ exports.DisplayOutputs = __webpack_exports__.DisplayOutputs;
100
120
  exports.DisplaySchemaTag = __webpack_exports__.DisplaySchemaTag;
101
121
  exports.DisplaySchemaTree = __webpack_exports__.DisplaySchemaTree;
102
122
  exports.DynamicValueInput = __webpack_exports__.DynamicValueInput;
123
+ exports.EditorInputsTree = __webpack_exports__.EditorInputsTree;
124
+ exports.EditorVariableTagInject = __webpack_exports__.EditorVariableTagInject;
125
+ exports.EditorVariableTree = __webpack_exports__.EditorVariableTree;
103
126
  exports.InjectDynamicValueInput = __webpack_exports__.InjectDynamicValueInput;
104
127
  exports.InjectTypeSelector = __webpack_exports__.InjectTypeSelector;
105
128
  exports.InjectVariableSelector = __webpack_exports__.InjectVariableSelector;
106
129
  exports.InputsValues = __webpack_exports__.InputsValues;
107
130
  exports.InputsValuesTree = __webpack_exports__.InputsValuesTree;
131
+ exports.JsonCodeEditor = __webpack_exports__.JsonCodeEditor;
108
132
  exports.JsonEditorWithVariables = __webpack_exports__.JsonEditorWithVariables;
109
133
  exports.JsonSchemaEditor = __webpack_exports__.JsonSchemaEditor;
110
134
  exports.PromptEditor = __webpack_exports__.PromptEditor;
111
135
  exports.PromptEditorWithInputs = __webpack_exports__.PromptEditorWithInputs;
112
136
  exports.PromptEditorWithVariables = __webpack_exports__.PromptEditorWithVariables;
137
+ exports.PythonCodeEditor = __webpack_exports__.PythonCodeEditor;
138
+ exports.SQLCodeEditor = __webpack_exports__.SQLCodeEditor;
139
+ exports.SQLEditorWithVariables = __webpack_exports__.SQLEditorWithVariables;
140
+ exports.ShellCodeEditor = __webpack_exports__.ShellCodeEditor;
141
+ exports.TypeScriptCodeEditor = __webpack_exports__.TypeScriptCodeEditor;
113
142
  exports.TypeSelector = __webpack_exports__.TypeSelector;
114
143
  exports.VariableSelector = __webpack_exports__.VariableSelector;
115
144
  exports.VariableSelectorProvider = __webpack_exports__.VariableSelectorProvider;
116
145
  exports.getTypeSelectValue = __webpack_exports__.getTypeSelectValue;
117
146
  exports.parseTypeSelectValue = __webpack_exports__.parseTypeSelectValue;
147
+ exports.useCondition = __webpack_exports__.useCondition;
148
+ exports.useConditionContext = __webpack_exports__.useConditionContext;
118
149
  exports.useVariableTree = __webpack_exports__.useVariableTree;
119
150
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
120
151
  "AssignRow",
121
152
  "AssignRows",
153
+ "BaseCodeEditor",
122
154
  "BatchOutputs",
123
155
  "BatchVariableSelector",
124
156
  "BlurInput",
125
157
  "CodeEditor",
126
158
  "CodeEditorMini",
159
+ "ConditionPresetOp",
160
+ "ConditionProvider",
127
161
  "ConditionRow",
128
162
  "ConstantInput",
129
163
  "DBConditionRow",
@@ -134,21 +168,32 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
134
168
  "DisplaySchemaTag",
135
169
  "DisplaySchemaTree",
136
170
  "DynamicValueInput",
171
+ "EditorInputsTree",
172
+ "EditorVariableTagInject",
173
+ "EditorVariableTree",
137
174
  "InjectDynamicValueInput",
138
175
  "InjectTypeSelector",
139
176
  "InjectVariableSelector",
140
177
  "InputsValues",
141
178
  "InputsValuesTree",
179
+ "JsonCodeEditor",
142
180
  "JsonEditorWithVariables",
143
181
  "JsonSchemaEditor",
144
182
  "PromptEditor",
145
183
  "PromptEditorWithInputs",
146
184
  "PromptEditorWithVariables",
185
+ "PythonCodeEditor",
186
+ "SQLCodeEditor",
187
+ "SQLEditorWithVariables",
188
+ "ShellCodeEditor",
189
+ "TypeScriptCodeEditor",
147
190
  "TypeSelector",
148
191
  "VariableSelector",
149
192
  "VariableSelectorProvider",
150
193
  "getTypeSelectValue",
151
194
  "parseTypeSelectValue",
195
+ "useCondition",
196
+ "useConditionContext",
152
197
  "useVariableTree"
153
198
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
154
199
  Object.defineProperty(exports, '__esModule', {
@@ -30,9 +30,11 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
30
  require("react");
31
31
  const editor_namespaceObject = require("@flowgram.ai/editor");
32
32
  const preset_code_namespaceObject = require("@flowgram.ai/coze-editor/preset-code");
33
- const index_js_namespaceObject = require("../code-editor/index.js");
34
- const variable_tree_js_namespaceObject = require("./extensions/variable-tree.js");
35
- const variable_tag_js_namespaceObject = require("./extensions/variable-tag.js");
33
+ const index_js_namespaceObject = require("../coze-editor-extensions/index.js");
34
+ const external_code_editor_index_js_namespaceObject = require("../code-editor/index.js");
35
+ const TRIGGER_CHARACTERS = [
36
+ '@'
37
+ ];
36
38
  function findAllMatches(inputString, regex) {
37
39
  const globalRegex = new RegExp(regex, regex.flags.includes('g') ? regex.flags : regex.flags + 'g');
38
40
  let match;
@@ -58,8 +60,7 @@ const transformer = (0, preset_code_namespaceObject.transformerCreator)((text)=>
58
60
  return text;
59
61
  });
60
62
  function JsonEditorWithVariables(props) {
61
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_js_namespaceObject.CodeEditor, {
62
- languageId: "json",
63
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_code_editor_index_js_namespaceObject.JsonCodeEditor, {
63
64
  activeLinePlaceholder: editor_namespaceObject.I18n.t("Press '@' to Select variable"),
64
65
  ...props,
65
66
  options: {
@@ -67,8 +68,10 @@ function JsonEditorWithVariables(props) {
67
68
  ...props.options || {}
68
69
  },
69
70
  children: [
70
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(variable_tree_js_namespaceObject.VariableTree, {}),
71
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(variable_tag_js_namespaceObject.VariableTagInject, {})
71
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.EditorVariableTree, {
72
+ triggerCharacters: TRIGGER_CHARACTERS
73
+ }),
74
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.EditorVariableTagInject, {})
72
75
  ]
73
76
  });
74
77
  }
@@ -29,11 +29,11 @@ __webpack_require__.d(__webpack_exports__, {
29
29
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
30
  require("react");
31
31
  const index_js_namespaceObject = require("../prompt-editor/index.js");
32
- const inputs_tree_js_namespaceObject = require("./extensions/inputs-tree.js");
32
+ const external_coze_editor_extensions_index_js_namespaceObject = require("../coze-editor-extensions/index.js");
33
33
  function PromptEditorWithInputs({ inputsValues, ...restProps }) {
34
34
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.PromptEditor, {
35
35
  ...restProps,
36
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(inputs_tree_js_namespaceObject.InputsTree, {
36
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_coze_editor_extensions_index_js_namespaceObject.EditorInputsTree, {
37
37
  inputsValues: inputsValues
38
38
  })
39
39
  });
@@ -29,14 +29,13 @@ __webpack_require__.d(__webpack_exports__, {
29
29
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
30
  require("react");
31
31
  const index_js_namespaceObject = require("../prompt-editor/index.js");
32
- const variable_tree_js_namespaceObject = require("./extensions/variable-tree.js");
33
- const variable_tag_js_namespaceObject = require("./extensions/variable-tag.js");
32
+ const external_coze_editor_extensions_index_js_namespaceObject = require("../coze-editor-extensions/index.js");
34
33
  function PromptEditorWithVariables(props) {
35
34
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_js_namespaceObject.PromptEditor, {
36
35
  ...props,
37
36
  children: [
38
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(variable_tree_js_namespaceObject.VariableTree, {}),
39
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(variable_tag_js_namespaceObject.VariableTagInject, {})
37
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_coze_editor_extensions_index_js_namespaceObject.EditorVariableTree, {}),
38
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_coze_editor_extensions_index_js_namespaceObject.EditorVariableTagInject, {})
40
39
  ]
41
40
  });
42
41
  }
@@ -24,44 +24,29 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- useRule: ()=>useRule
27
+ SQLEditorWithVariables: ()=>SQLEditorWithVariables
28
28
  });
29
- const external_react_namespaceObject = require("react");
30
- const json_schema_namespaceObject = require("@flowgram.ai/json-schema");
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ require("react");
31
31
  const editor_namespaceObject = require("@flowgram.ai/editor");
32
- const external_constants_js_namespaceObject = require("../constants.js");
33
- function useRule(left, userRules) {
34
- const available = (0, editor_namespaceObject.useScopeAvailable)();
35
- const rules = (0, external_react_namespaceObject.useMemo)(()=>({
36
- ...external_constants_js_namespaceObject.defaultRules,
37
- ...userRules || {}
38
- }), [
39
- userRules
40
- ]);
41
- const variable = (0, external_react_namespaceObject.useMemo)(()=>{
42
- if (!left) return;
43
- return available.getByKeyPath(left.content);
44
- }, [
45
- available,
46
- left
47
- ]);
48
- const rule = (0, external_react_namespaceObject.useMemo)(()=>{
49
- if (!variable) return;
50
- const schema = json_schema_namespaceObject.JsonSchemaUtils.astToSchema(variable.type, {
51
- drilldown: false
52
- });
53
- return rules[schema?.type];
54
- }, [
55
- variable?.type,
56
- rules
57
- ]);
58
- return {
59
- rule
60
- };
32
+ const index_js_namespaceObject = require("../coze-editor-extensions/index.js");
33
+ const external_code_editor_index_js_namespaceObject = require("../code-editor/index.js");
34
+ function SQLEditorWithVariables(props) {
35
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_code_editor_index_js_namespaceObject.SQLCodeEditor, {
36
+ activeLinePlaceholder: editor_namespaceObject.I18n.t("Press '@' to Select variable"),
37
+ ...props,
38
+ options: {
39
+ ...props.options || {}
40
+ },
41
+ children: [
42
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.EditorVariableTree, {}),
43
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.EditorVariableTagInject, {})
44
+ ]
45
+ });
61
46
  }
62
- exports.useRule = __webpack_exports__.useRule;
47
+ exports.SQLEditorWithVariables = __webpack_exports__.SQLEditorWithVariables;
63
48
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
64
- "useRule"
49
+ "SQLEditorWithVariables"
65
50
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
66
51
  Object.defineProperty(exports, '__esModule', {
67
52
  value: true
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __webpack_modules__ = {
3
+ "./editor": function(module) {
4
+ module.exports = import("./editor.js").then(function(module) {
5
+ return module;
6
+ });
7
+ }
8
+ };
9
+ var __webpack_module_cache__ = {};
10
+ function __webpack_require__(moduleId) {
11
+ var cachedModule = __webpack_module_cache__[moduleId];
12
+ if (void 0 !== cachedModule) return cachedModule.exports;
13
+ var module = __webpack_module_cache__[moduleId] = {
14
+ exports: {}
15
+ };
16
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
17
+ return module.exports;
18
+ }
19
+ (()=>{
20
+ __webpack_require__.d = (exports1, definition)=>{
21
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
22
+ enumerable: true,
23
+ get: definition[key]
24
+ });
25
+ };
26
+ })();
27
+ (()=>{
28
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
29
+ })();
30
+ (()=>{
31
+ __webpack_require__.r = (exports1)=>{
32
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
33
+ value: 'Module'
34
+ });
35
+ Object.defineProperty(exports1, '__esModule', {
36
+ value: true
37
+ });
38
+ };
39
+ })();
40
+ var __webpack_exports__ = {};
41
+ (()=>{
42
+ __webpack_require__.r(__webpack_exports__);
43
+ __webpack_require__.d(__webpack_exports__, {
44
+ SQLEditorWithVariables: ()=>SQLEditorWithVariables
45
+ });
46
+ const index_js_namespaceObject = require("../../shared/index.js");
47
+ const SQLEditorWithVariables = (0, index_js_namespaceObject.lazySuspense)(()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./editor")).then((module)=>({
48
+ default: module.SQLEditorWithVariables
49
+ })));
50
+ })();
51
+ exports.SQLEditorWithVariables = __webpack_exports__.SQLEditorWithVariables;
52
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
53
+ "SQLEditorWithVariables"
54
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
55
+ Object.defineProperty(exports, '__esModule', {
56
+ value: true
57
+ });
@@ -31,9 +31,9 @@ __webpack_require__.d(__webpack_exports__, {
31
31
  });
32
32
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
33
33
  const external_react_namespaceObject = require("react");
34
+ const json_schema_namespaceObject = require("@flowgram.ai/json-schema");
34
35
  const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
35
36
  const index_js_namespaceObject = require("../../shared/inject-material/index.js");
36
- const external_plugins_index_js_namespaceObject = require("../../plugins/index.js");
37
37
  const labelStyle = {
38
38
  display: 'flex',
39
39
  alignItems: 'center',
@@ -63,7 +63,7 @@ function TypeSelector(props) {
63
63
  const selectValue = (0, external_react_namespaceObject.useMemo)(()=>getTypeSelectValue(value), [
64
64
  value
65
65
  ]);
66
- const typeManager = (0, external_plugins_index_js_namespaceObject.useTypeManager)();
66
+ const typeManager = (0, json_schema_namespaceObject.useTypeManager)();
67
67
  const icon = typeManager.getDisplayIcon(value || {});
68
68
  const options = (0, external_react_namespaceObject.useMemo)(()=>typeManager.getTypeRegistriesWithParentType().map((_type)=>{
69
69
  const isArray = 'array' === _type.type;
@@ -31,10 +31,9 @@ const external_react_namespaceObject = require("react");
31
31
  const json_schema_namespaceObject = require("@flowgram.ai/json-schema");
32
32
  const editor_namespaceObject = require("@flowgram.ai/editor");
33
33
  const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
34
- const index_js_namespaceObject = require("../../plugins/index.js");
35
34
  function useVariableTree(params) {
36
35
  const { includeSchema, excludeSchema, skipVariable } = params;
37
- const typeManager = (0, index_js_namespaceObject.useTypeManager)();
36
+ const typeManager = (0, json_schema_namespaceObject.useTypeManager)();
38
37
  const variables = (0, editor_namespaceObject.useAvailableVariables)();
39
38
  const getVariableTypeIcon = (0, external_react_namespaceObject.useCallback)((variable)=>{
40
39
  if (variable.meta?.icon) {
@@ -33,7 +33,7 @@ const provideBatchInputEffect = (0, editor_namespaceObject.createEffectFromVaria
33
33
  editor_namespaceObject.ASTFactory.createVariableDeclaration({
34
34
  key: `${ctx.node.id}_locals`,
35
35
  meta: {
36
- title: (0, editor_namespaceObject.getNodeForm)(ctx.node)?.getValueIn('title'),
36
+ title: ctx.node.form?.getValueIn('title'),
37
37
  icon: ctx.node.getNodeRegistry().info?.icon
38
38
  },
39
39
  type: editor_namespaceObject.ASTFactory.createObject({
@@ -33,7 +33,7 @@ const provideJsonSchemaOutputs = (0, editor_namespaceObject.createEffectFromVari
33
33
  editor_namespaceObject.ASTFactory.createVariableDeclaration({
34
34
  key: `${ctx.node.id}`,
35
35
  meta: {
36
- title: (0, editor_namespaceObject.getNodeForm)(ctx.node)?.getValueIn('title') || ctx.node.id,
36
+ title: ctx.node.form?.getValueIn('title') || ctx.node.id,
37
37
  icon: ctx.node.getNodeRegistry().info?.icon
38
38
  },
39
39
  type: json_schema_namespaceObject.JsonSchemaUtils.schemaToAST(value)
@@ -27,13 +27,15 @@ __webpack_require__.d(__webpack_exports__, {
27
27
  createBatchOutputsFormPlugin: ()=>createBatchOutputsFormPlugin,
28
28
  provideBatchOutputsEffect: ()=>provideBatchOutputsEffect
29
29
  });
30
+ const external_lodash_es_namespaceObject = require("lodash-es");
31
+ const json_schema_namespaceObject = require("@flowgram.ai/json-schema");
30
32
  const editor_namespaceObject = require("@flowgram.ai/editor");
31
33
  const provideBatchOutputsEffect = (0, editor_namespaceObject.createEffectFromVariableProvider)({
32
34
  parse: (value, ctx)=>[
33
35
  editor_namespaceObject.ASTFactory.createVariableDeclaration({
34
36
  key: `${ctx.node.id}`,
35
37
  meta: {
36
- title: (0, editor_namespaceObject.getNodeForm)(ctx.node)?.getValueIn('title'),
38
+ title: ctx.node.form?.getValueIn('title'),
37
39
  icon: ctx.node.getNodeRegistry().info?.icon
38
40
  },
39
41
  type: editor_namespaceObject.ASTFactory.createObject({
@@ -51,10 +53,15 @@ const provideBatchOutputsEffect = (0, editor_namespaceObject.createEffectFromVar
51
53
  });
52
54
  const createBatchOutputsFormPlugin = (0, editor_namespaceObject.defineFormPluginCreator)({
53
55
  name: 'batch-outputs-plugin',
54
- onSetupFormMeta ({ mergeEffect }, { outputKey }) {
56
+ onSetupFormMeta ({ mergeEffect, addFormatOnSubmit }, { outputKey, inferTargetKey }) {
55
57
  mergeEffect({
56
58
  [outputKey]: provideBatchOutputsEffect
57
59
  });
60
+ if (inferTargetKey) addFormatOnSubmit((formData, ctx)=>{
61
+ const outputVariable = (0, editor_namespaceObject.getNodeScope)(ctx.node).output.variables?.[0];
62
+ if (outputVariable?.type) (0, external_lodash_es_namespaceObject.set)(formData, inferTargetKey, json_schema_namespaceObject.JsonSchemaUtils.astToSchema(outputVariable?.type));
63
+ return formData;
64
+ });
58
65
  },
59
66
  onInit (ctx, { outputKey }) {
60
67
  const chainTransformService = ctx.node.getService(editor_namespaceObject.ScopeChainTransformService);
@@ -40,7 +40,7 @@ const createInferAssignPlugin = (0, editor_namespaceObject.defineFormPluginCreat
40
40
  editor_namespaceObject.ASTFactory.createVariableDeclaration({
41
41
  key: `${ctx.node.id}`,
42
42
  meta: {
43
- title: (0, editor_namespaceObject.getNodeForm)(ctx.node)?.getValueIn('title'),
43
+ title: ctx.node.form?.getValueIn('title'),
44
44
  icon: ctx.node.getNodeRegistry().info?.icon
45
45
  },
46
46
  type: editor_namespaceObject.ASTFactory.createObject({
@@ -27,13 +27,40 @@ __webpack_require__.d(__webpack_exports__, {
27
27
  createInferInputsPlugin: ()=>createInferInputsPlugin
28
28
  });
29
29
  const external_lodash_es_namespaceObject = require("lodash-es");
30
+ const external_immer_namespaceObject = require("immer");
30
31
  const editor_namespaceObject = require("@flowgram.ai/editor");
31
32
  const index_js_namespaceObject = require("../../shared/index.js");
33
+ const { produce } = new external_immer_namespaceObject.Immer({
34
+ autoFreeze: false
35
+ });
32
36
  const createInferInputsPlugin = (0, editor_namespaceObject.defineFormPluginCreator)({
33
- onSetupFormMeta ({ addFormatOnSubmit }, { sourceKey, targetKey, scope }) {
37
+ onSetupFormMeta ({ addFormatOnSubmit, addFormatOnInit }, { sourceKey, targetKey, scope, ignoreConstantSchema }) {
34
38
  if (!sourceKey || !targetKey) return;
35
- addFormatOnSubmit((formData, ctx)=>{
36
- (0, external_lodash_es_namespaceObject.set)(formData, targetKey, index_js_namespaceObject.FlowValueUtils.inferJsonSchema((0, external_lodash_es_namespaceObject.get)(formData, sourceKey), 'private' === scope ? (0, editor_namespaceObject.getNodePrivateScope)(ctx.node) : (0, editor_namespaceObject.getNodeScope)(ctx.node)));
39
+ addFormatOnSubmit((formData, ctx)=>produce(formData, (draft)=>{
40
+ const sourceData = (0, external_lodash_es_namespaceObject.get)(formData, sourceKey);
41
+ (0, external_lodash_es_namespaceObject.set)(draft, targetKey, index_js_namespaceObject.FlowValueUtils.inferJsonSchema(sourceData, 'private' === scope ? (0, editor_namespaceObject.getNodePrivateScope)(ctx.node) : (0, editor_namespaceObject.getNodeScope)(ctx.node)));
42
+ if (ignoreConstantSchema) {
43
+ for (const { value, path } of index_js_namespaceObject.FlowValueUtils.traverse(sourceData, {
44
+ includeTypes: [
45
+ 'constant'
46
+ ]
47
+ }))if (index_js_namespaceObject.FlowValueUtils.isConstant(value) && value?.schema) (0, external_lodash_es_namespaceObject.set)(formData, `${sourceKey}.${path}`, (0, external_lodash_es_namespaceObject.omit)(value, [
48
+ 'schema'
49
+ ]));
50
+ }
51
+ }));
52
+ if (ignoreConstantSchema) addFormatOnInit((formData, ctx)=>{
53
+ const targetSchema = (0, external_lodash_es_namespaceObject.get)(formData, targetKey);
54
+ if (!targetSchema) return formData;
55
+ for (const { value, pathArr } of index_js_namespaceObject.FlowValueUtils.traverse((0, external_lodash_es_namespaceObject.get)(formData, sourceKey), {
56
+ includeTypes: [
57
+ 'constant'
58
+ ]
59
+ }))if (index_js_namespaceObject.FlowValueUtils.isConstant(value) && !value?.schema) {
60
+ const schemaPath = pathArr.map((_item)=>`properties.${_item}`).join('.');
61
+ const schema = (0, external_lodash_es_namespaceObject.get)(targetSchema, schemaPath);
62
+ if (schema) (0, external_lodash_es_namespaceObject.set)(value, 'schema', schema);
63
+ }
37
64
  return formData;
38
65
  });
39
66
  }