@flowgram.ai/form-materials 0.5.5 → 0.5.7

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 (208) hide show
  1. package/dist/cjs/components/batch-outputs/index.js +5 -3
  2. package/dist/cjs/components/batch-outputs/styles.css +13 -0
  3. package/dist/cjs/components/blur-input/index.js +4 -1
  4. package/dist/cjs/components/code-editor/editor.js +16 -12
  5. package/dist/cjs/components/code-editor/styles.css +4 -0
  6. package/dist/cjs/components/code-editor-mini/index.js +2 -16
  7. package/dist/cjs/components/condition-context/hooks/use-condition.js +17 -1
  8. package/dist/cjs/components/condition-row/index.js +26 -12
  9. package/dist/cjs/components/condition-row/styles.css +19 -0
  10. package/dist/cjs/components/coze-editor-extensions/extensions/inputs-tree.js +2 -2
  11. package/dist/cjs/components/coze-editor-extensions/extensions/variable-tag.js +44 -15
  12. package/dist/{esm/components/coze-editor-extensions/styles.mjs → cjs/components/coze-editor-extensions/styles.css} +19 -18
  13. package/dist/cjs/components/db-condition-row/index.js +29 -14
  14. package/dist/cjs/components/db-condition-row/styles.css +30 -0
  15. package/dist/cjs/components/display-inputs-values/index.js +3 -2
  16. package/dist/cjs/components/display-inputs-values/styles.css +6 -0
  17. package/dist/cjs/components/display-outputs/index.js +5 -4
  18. package/dist/cjs/components/display-outputs/styles.css +6 -0
  19. package/dist/cjs/components/display-schema-tag/index.js +7 -4
  20. package/dist/cjs/components/display-schema-tag/styles.css +21 -0
  21. package/dist/cjs/components/display-schema-tree/index.js +12 -7
  22. package/dist/cjs/components/display-schema-tree/styles.css +64 -0
  23. package/dist/cjs/components/dynamic-value-input/index.js +9 -5
  24. package/dist/{esm/components/dynamic-value-input/styles.mjs → cjs/components/dynamic-value-input/styles.css} +23 -30
  25. package/dist/cjs/components/inputs-values/index.js +5 -3
  26. package/dist/cjs/components/inputs-values/styles.css +13 -0
  27. package/dist/cjs/components/inputs-values-tree/icon.js +70 -0
  28. package/dist/cjs/components/inputs-values-tree/index.js +3 -2
  29. package/dist/cjs/components/inputs-values-tree/row.js +19 -15
  30. package/dist/cjs/components/inputs-values-tree/styles.css +85 -0
  31. package/dist/cjs/components/json-schema-editor/default-value.js +2 -2
  32. package/dist/cjs/components/json-schema-editor/icon.js +70 -0
  33. package/dist/cjs/components/json-schema-editor/index.js +37 -25
  34. package/dist/cjs/components/json-schema-editor/styles.css +113 -0
  35. package/dist/cjs/components/prompt-editor/editor.js +16 -6
  36. package/dist/cjs/components/prompt-editor/styles.css +10 -0
  37. package/dist/cjs/components/prompt-editor-with-inputs/index.js +16 -26
  38. package/dist/cjs/components/prompt-editor-with-variables/index.js +17 -26
  39. package/dist/cjs/components/variable-selector/context.js +7 -3
  40. package/dist/cjs/components/variable-selector/index.js +16 -10
  41. package/dist/{esm/components/variable-selector/styles.mjs → cjs/components/variable-selector/styles.css} +37 -29
  42. package/dist/cjs/components/variable-selector/use-variable-tree.js +3 -1
  43. package/dist/cjs/effects/validate-when-variable-sync/index.js +3 -3
  44. package/dist/cjs/shared/inject-material/index.js +1 -1
  45. package/dist/esm/components/batch-outputs/index.mjs +5 -3
  46. package/dist/esm/components/batch-outputs/styles.css +13 -0
  47. package/dist/esm/components/blur-input/index.mjs +4 -1
  48. package/dist/esm/components/code-editor/editor.mjs +16 -11
  49. package/dist/esm/components/code-editor/styles.css +4 -0
  50. package/dist/esm/components/code-editor-mini/index.mjs +2 -6
  51. package/dist/esm/components/condition-context/hooks/use-condition.mjs +18 -2
  52. package/dist/esm/components/condition-row/index.mjs +26 -12
  53. package/dist/esm/components/condition-row/styles.css +19 -0
  54. package/dist/esm/components/coze-editor-extensions/extensions/inputs-tree.mjs +3 -3
  55. package/dist/esm/components/coze-editor-extensions/extensions/variable-tag.mjs +45 -16
  56. package/dist/esm/components/coze-editor-extensions/styles.css +37 -0
  57. package/dist/esm/components/db-condition-row/index.mjs +29 -14
  58. package/dist/esm/components/db-condition-row/styles.css +30 -0
  59. package/dist/esm/components/display-inputs-values/index.mjs +3 -2
  60. package/dist/esm/components/display-inputs-values/styles.css +6 -0
  61. package/dist/esm/components/display-outputs/index.mjs +5 -4
  62. package/dist/esm/components/display-outputs/styles.css +6 -0
  63. package/dist/esm/components/display-schema-tag/index.mjs +8 -5
  64. package/dist/esm/components/display-schema-tag/styles.css +21 -0
  65. package/dist/esm/components/display-schema-tree/index.mjs +12 -7
  66. package/dist/esm/components/display-schema-tree/styles.css +64 -0
  67. package/dist/esm/components/dynamic-value-input/index.mjs +9 -5
  68. package/dist/esm/components/dynamic-value-input/styles.css +48 -0
  69. package/dist/esm/components/inputs-values/index.mjs +5 -3
  70. package/dist/esm/components/inputs-values/styles.css +13 -0
  71. package/dist/esm/components/inputs-values-tree/icon.mjs +26 -0
  72. package/dist/esm/components/inputs-values-tree/index.mjs +3 -2
  73. package/dist/esm/components/inputs-values-tree/row.mjs +18 -14
  74. package/dist/esm/components/inputs-values-tree/styles.css +85 -0
  75. package/dist/esm/components/json-schema-editor/default-value.mjs +2 -2
  76. package/dist/esm/components/json-schema-editor/icon.mjs +26 -0
  77. package/dist/esm/components/json-schema-editor/index.mjs +36 -24
  78. package/dist/esm/components/json-schema-editor/styles.css +113 -0
  79. package/dist/esm/components/prompt-editor/editor.mjs +16 -6
  80. package/dist/esm/components/prompt-editor/styles.css +10 -0
  81. package/dist/esm/components/prompt-editor-with-inputs/index.mjs +12 -4
  82. package/dist/esm/components/prompt-editor-with-variables/index.mjs +13 -4
  83. package/dist/esm/components/variable-selector/context.mjs +7 -3
  84. package/dist/esm/components/variable-selector/index.mjs +17 -11
  85. package/{src/components/variable-selector/styles.tsx → dist/esm/components/variable-selector/styles.css} +35 -38
  86. package/dist/esm/components/variable-selector/use-variable-tree.mjs +3 -1
  87. package/dist/esm/effects/validate-when-variable-sync/index.mjs +3 -3
  88. package/dist/esm/shared/inject-material/index.mjs +1 -1
  89. package/dist/tsconfig.tsbuildinfo +1 -1
  90. package/dist/types/components/batch-outputs/index.d.ts +1 -0
  91. package/dist/types/components/code-editor/editor.d.ts +1 -0
  92. package/dist/types/components/condition-context/hooks/use-condition.d.ts +16 -1
  93. package/dist/types/components/condition-row/index.d.ts +5 -1
  94. package/dist/types/components/coze-editor-extensions/extensions/variable-tag.d.ts +1 -0
  95. package/dist/types/components/db-condition-row/index.d.ts +4 -0
  96. package/dist/types/components/db-condition-row/types.d.ts +0 -1
  97. package/dist/types/components/display-inputs-values/index.d.ts +1 -0
  98. package/dist/types/components/display-outputs/index.d.ts +1 -0
  99. package/dist/types/components/display-schema-tag/index.d.ts +1 -0
  100. package/dist/types/components/display-schema-tree/index.d.ts +1 -0
  101. package/dist/types/components/dynamic-value-input/index.d.ts +1 -0
  102. package/dist/types/components/inputs-values/index.d.ts +1 -0
  103. package/dist/types/components/inputs-values-tree/icon.d.ts +6 -0
  104. package/dist/types/components/inputs-values-tree/index.d.ts +1 -0
  105. package/dist/types/components/inputs-values-tree/row.d.ts +1 -0
  106. package/dist/types/components/json-schema-editor/icon.d.ts +6 -0
  107. package/dist/types/components/json-schema-editor/index.d.ts +1 -0
  108. package/dist/types/components/prompt-editor/editor.d.ts +1 -0
  109. package/dist/types/components/prompt-editor-with-inputs/index.d.ts +7 -2
  110. package/dist/types/components/prompt-editor-with-variables/index.d.ts +5 -2
  111. package/dist/types/components/variable-selector/context.d.ts +16 -3
  112. package/dist/types/components/variable-selector/index.d.ts +1 -0
  113. package/package.json +7 -10
  114. package/src/components/batch-outputs/index.tsx +5 -5
  115. package/src/components/batch-outputs/{styles.tsx → styles.css} +4 -6
  116. package/src/components/blur-input/index.tsx +4 -1
  117. package/src/components/code-editor/editor.tsx +19 -14
  118. package/src/components/code-editor/styles.css +11 -0
  119. package/src/components/code-editor-mini/index.tsx +2 -9
  120. package/src/components/condition-context/hooks/use-condition.tsx +51 -7
  121. package/src/components/condition-row/index.tsx +27 -22
  122. package/src/components/condition-row/{styles.tsx → styles.css} +10 -11
  123. package/src/components/coze-editor-extensions/extensions/inputs-tree.tsx +3 -3
  124. package/src/components/coze-editor-extensions/extensions/variable-tag.tsx +35 -22
  125. package/src/components/coze-editor-extensions/{styles.tsx → styles.css} +8 -11
  126. package/src/components/db-condition-row/index.tsx +29 -26
  127. package/src/components/db-condition-row/{styles.tsx → styles.css} +14 -16
  128. package/src/components/db-condition-row/types.ts +0 -1
  129. package/src/components/display-inputs-values/index.tsx +3 -3
  130. package/src/components/display-inputs-values/{styles.ts → styles.css} +2 -4
  131. package/src/components/display-outputs/index.tsx +5 -5
  132. package/src/components/display-outputs/{styles.ts → styles.css} +2 -4
  133. package/src/components/display-schema-tag/index.tsx +7 -7
  134. package/src/components/display-schema-tag/{styles.ts → styles.css} +7 -10
  135. package/src/components/display-schema-tree/index.tsx +10 -10
  136. package/src/components/display-schema-tree/{styles.tsx → styles.css} +18 -24
  137. package/src/components/dynamic-value-input/index.tsx +6 -6
  138. package/src/components/dynamic-value-input/{styles.tsx → styles.css} +8 -12
  139. package/src/components/inputs-values/index.tsx +5 -5
  140. package/src/components/inputs-values/{styles.tsx → styles.css} +4 -6
  141. package/src/components/inputs-values-tree/icon.tsx +28 -0
  142. package/src/components/inputs-values-tree/index.tsx +3 -3
  143. package/src/components/inputs-values-tree/row.tsx +25 -27
  144. package/src/components/inputs-values-tree/styles.css +94 -0
  145. package/src/components/json-schema-editor/default-value.tsx +2 -4
  146. package/src/components/json-schema-editor/icon.tsx +28 -0
  147. package/src/components/json-schema-editor/index.tsx +45 -50
  148. package/src/components/json-schema-editor/styles.css +135 -0
  149. package/src/components/prompt-editor/editor.tsx +18 -7
  150. package/src/components/prompt-editor/styles.css +14 -0
  151. package/src/components/prompt-editor-with-inputs/index.tsx +18 -5
  152. package/src/components/prompt-editor-with-variables/index.tsx +13 -5
  153. package/src/components/variable-selector/context.tsx +22 -2
  154. package/src/components/variable-selector/index.tsx +24 -14
  155. package/src/components/variable-selector/styles.css +70 -0
  156. package/src/components/variable-selector/use-variable-tree.tsx +9 -1
  157. package/src/effects/validate-when-variable-sync/index.ts +7 -3
  158. package/src/shared/inject-material/index.tsx +1 -1
  159. package/dist/cjs/components/batch-outputs/styles.js +0 -60
  160. package/dist/cjs/components/condition-row/styles.js +0 -78
  161. package/dist/cjs/components/coze-editor-extensions/styles.js +0 -89
  162. package/dist/cjs/components/db-condition-row/styles.js +0 -94
  163. package/dist/cjs/components/display-inputs-values/styles.js +0 -51
  164. package/dist/cjs/components/display-outputs/styles.js +0 -51
  165. package/dist/cjs/components/display-schema-tag/styles.js +0 -71
  166. package/dist/cjs/components/display-schema-tree/styles.js +0 -135
  167. package/dist/cjs/components/dynamic-value-input/styles.js +0 -108
  168. package/dist/cjs/components/inputs-values/styles.js +0 -60
  169. package/dist/cjs/components/inputs-values-tree/styles.js +0 -177
  170. package/dist/cjs/components/json-schema-editor/styles.js +0 -231
  171. package/dist/cjs/components/prompt-editor/styles.js +0 -55
  172. package/dist/cjs/components/prompt-editor-with-inputs/editor.js +0 -47
  173. package/dist/cjs/components/prompt-editor-with-variables/editor.js +0 -48
  174. package/dist/cjs/components/variable-selector/styles.js +0 -114
  175. package/dist/esm/components/batch-outputs/styles.mjs +0 -13
  176. package/dist/esm/components/condition-row/styles.mjs +0 -22
  177. package/dist/esm/components/db-condition-row/styles.mjs +0 -32
  178. package/dist/esm/components/display-inputs-values/styles.mjs +0 -7
  179. package/dist/esm/components/display-outputs/styles.mjs +0 -7
  180. package/dist/esm/components/display-schema-tag/styles.mjs +0 -21
  181. package/dist/esm/components/display-schema-tree/styles.mjs +0 -79
  182. package/dist/esm/components/inputs-values/styles.mjs +0 -13
  183. package/dist/esm/components/inputs-values-tree/styles.mjs +0 -105
  184. package/dist/esm/components/json-schema-editor/styles.mjs +0 -138
  185. package/dist/esm/components/prompt-editor/styles.mjs +0 -11
  186. package/dist/esm/components/prompt-editor-with-inputs/editor.mjs +0 -13
  187. package/dist/esm/components/prompt-editor-with-variables/editor.mjs +0 -14
  188. package/dist/types/components/batch-outputs/styles.d.ts +0 -6
  189. package/dist/types/components/condition-row/styles.d.ts +0 -9
  190. package/dist/types/components/coze-editor-extensions/styles.d.ts +0 -9
  191. package/dist/types/components/db-condition-row/styles.d.ts +0 -12
  192. package/dist/types/components/display-inputs-values/styles.d.ts +0 -5
  193. package/dist/types/components/display-outputs/styles.d.ts +0 -5
  194. package/dist/types/components/display-schema-tag/styles.d.ts +0 -8
  195. package/dist/types/components/display-schema-tree/styles.d.ts +0 -11
  196. package/dist/types/components/dynamic-value-input/styles.d.ts +0 -8
  197. package/dist/types/components/inputs-values/styles.d.ts +0 -6
  198. package/dist/types/components/inputs-values-tree/styles.d.ts +0 -23
  199. package/dist/types/components/json-schema-editor/styles.d.ts +0 -30
  200. package/dist/types/components/prompt-editor/styles.d.ts +0 -7
  201. package/dist/types/components/prompt-editor-with-inputs/editor.d.ts +0 -11
  202. package/dist/types/components/prompt-editor-with-variables/editor.d.ts +0 -9
  203. package/dist/types/components/variable-selector/styles.d.ts +0 -14
  204. package/src/components/inputs-values-tree/styles.tsx +0 -128
  205. package/src/components/json-schema-editor/styles.tsx +0 -168
  206. package/src/components/prompt-editor/styles.tsx +0 -18
  207. package/src/components/prompt-editor-with-inputs/editor.tsx +0 -25
  208. package/src/components/prompt-editor-with-variables/editor.tsx +0 -20
@@ -5,9 +5,24 @@
5
5
  import { IJsonSchema } from '@flowgram.ai/json-schema';
6
6
  import { IConditionRule, ConditionOpConfigs } from '../types';
7
7
  interface HooksParams {
8
+ /**
9
+ * Left schema of condition
10
+ */
8
11
  leftSchema?: IJsonSchema;
12
+ /**
13
+ * Operator of condition
14
+ */
9
15
  operator?: string;
10
16
  /**
17
+ * If op is not in opOptionList, clear it
18
+ */
19
+ onClearOp?: () => void;
20
+ /**
21
+ * If targetSchema updated, clear it
22
+ */
23
+ onClearRight?: () => void;
24
+ /**
25
+ * @deprecated use ConditionProvider instead
11
26
  * custom rule config
12
27
  */
13
28
  ruleConfig?: {
@@ -15,7 +30,7 @@ interface HooksParams {
15
30
  rules?: Record<string, IConditionRule>;
16
31
  };
17
32
  }
18
- export declare function useCondition({ leftSchema, operator, ruleConfig }: HooksParams): {
33
+ export declare function useCondition({ leftSchema, operator, onClearOp, onClearRight, ruleConfig, }: HooksParams): {
19
34
  rule: IConditionRule | undefined;
20
35
  opConfig: import("..").ConditionOpConfig;
21
36
  opOptionList: {
@@ -5,15 +5,19 @@
5
5
  import React from 'react';
6
6
  import { IConditionRule, ConditionOpConfigs } from '../condition-context';
7
7
  import { ConditionRowValueType } from './types';
8
+ import './styles.css';
8
9
  interface PropTypes {
9
10
  value?: ConditionRowValueType;
10
11
  onChange: (value?: ConditionRowValueType) => void;
11
12
  style?: React.CSSProperties;
12
13
  readonly?: boolean;
14
+ /**
15
+ * @deprecated use ConditionContext instead to pass ruleConfig to multiple
16
+ */
13
17
  ruleConfig?: {
14
18
  ops?: ConditionOpConfigs;
15
19
  rules?: Record<string, IConditionRule>;
16
20
  };
17
21
  }
18
- export declare function ConditionRow({ style, value, onChange, readonly, ruleConfig, }: PropTypes): React.JSX.Element;
22
+ export declare function ConditionRow({ style, value, onChange, readonly, ruleConfig }: PropTypes): React.JSX.Element;
19
23
  export { type ConditionRowValueType };
@@ -2,4 +2,5 @@
2
2
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
3
  * SPDX-License-Identifier: MIT
4
4
  */
5
+ import '../styles.css';
5
6
  export declare function VariableTagInject(): null;
@@ -5,12 +5,16 @@
5
5
  import React from 'react';
6
6
  import { type ConditionOpConfigs, type IConditionRule } from '../condition-context';
7
7
  import { DBConditionOptionType, DBConditionRowValueType } from './types';
8
+ import './styles.css';
8
9
  interface PropTypes {
9
10
  value?: DBConditionRowValueType;
10
11
  onChange: (value?: DBConditionRowValueType) => void;
11
12
  style?: React.CSSProperties;
12
13
  options?: DBConditionOptionType[];
13
14
  readonly?: boolean;
15
+ /**
16
+ * @deprecated use ConditionContext instead to pass ruleConfig to multiple
17
+ */
14
18
  ruleConfig?: {
15
19
  ops?: ConditionOpConfigs;
16
20
  rules?: Record<string, IConditionRule>;
@@ -6,7 +6,6 @@ import { IJsonSchema } from '@flowgram.ai/json-schema';
6
6
  import { IFlowConstantRefValue } from '../../shared';
7
7
  export interface DBConditionRowValueType {
8
8
  left?: string;
9
- schema?: IJsonSchema;
10
9
  operator?: string;
11
10
  right?: IFlowConstantRefValue;
12
11
  }
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import { IInputsValues } from '../../shared/flow-value';
7
+ import './styles.css';
7
8
  interface PropsType {
8
9
  value?: IInputsValues;
9
10
  showIconInTree?: boolean;
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import { IJsonSchema, JsonSchemaTypeManager } from '@flowgram.ai/json-schema';
7
+ import './styles.css';
7
8
  interface PropsType {
8
9
  value?: IJsonSchema;
9
10
  showIconInTree?: boolean;
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import { IJsonSchema } from '@flowgram.ai/json-schema';
7
+ import './styles.css';
7
8
  interface PropsType {
8
9
  title?: JSX.Element | string;
9
10
  value?: IJsonSchema;
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import { type IJsonSchema, type JsonSchemaTypeManager } from '@flowgram.ai/json-schema';
7
+ import './styles.css';
7
8
  interface PropsType {
8
9
  value?: IJsonSchema;
9
10
  parentKey?: string;
@@ -6,6 +6,7 @@ import React from 'react';
6
6
  import { IJsonSchema } from '@flowgram.ai/json-schema';
7
7
  import { IFlowConstantRefValue } from '../../shared';
8
8
  import { ConstantInputStrategy } from '../constant-input';
9
+ import './styles.css';
9
10
  interface PropsType {
10
11
  value?: IFlowConstantRefValue;
11
12
  onChange: (value?: IFlowConstantRefValue) => void;
@@ -4,4 +4,5 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import { PropsType } from './types';
7
+ import './styles.css';
7
8
  export declare function InputsValues({ value, onChange, style, readonly, constantProps, schema, hasError, }: PropsType): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+ import React from 'react';
6
+ export declare const IconAddChildren: () => React.JSX.Element;
@@ -4,4 +4,5 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import { PropsType } from './types';
7
+ import './styles.css';
7
8
  export declare function InputsValuesTree(props: PropsType): React.JSX.Element;
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import { PropsType } from './types';
7
+ import './styles.css';
7
8
  export declare function InputValueRow(props: {
8
9
  keyName?: string;
9
10
  value?: any;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+ import React from 'react';
6
+ export declare const IconAddChildren: () => React.JSX.Element;
@@ -5,6 +5,7 @@
5
5
  import React from 'react';
6
6
  import { IJsonSchema } from '@flowgram.ai/json-schema';
7
7
  import { ConfigType } from './types';
8
+ import './styles.css';
8
9
  export declare function JsonSchemaEditor(props: {
9
10
  value?: IJsonSchema;
10
11
  onChange?: (value: IJsonSchema) => void;
@@ -6,6 +6,7 @@ import React from 'react';
6
6
  import { InferValues } from '@flowgram.ai/coze-editor/react';
7
7
  import preset from '@flowgram.ai/coze-editor/preset-prompt';
8
8
  import { PropsType } from './types';
9
+ import './styles.css';
9
10
  type Preset = typeof preset;
10
11
  type Options = Partial<InferValues<Preset[number]>>;
11
12
  export interface PromptEditorPropsType extends PropsType {
@@ -2,5 +2,10 @@
2
2
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
3
  * SPDX-License-Identifier: MIT
4
4
  */
5
- export declare const PromptEditorWithInputs: import("react").LazyExoticComponent<typeof import("./editor").PromptEditorWithInputs>;
6
- export type { PromptEditorWithInputsProps } from './editor';
5
+ import React from 'react';
6
+ import type { IInputsValues } from '../../shared/flow-value';
7
+ import { PromptEditorPropsType } from '../prompt-editor';
8
+ export interface PromptEditorWithInputsProps extends PromptEditorPropsType {
9
+ inputsValues: IInputsValues;
10
+ }
11
+ export declare function PromptEditorWithInputs({ inputsValues, ...restProps }: PromptEditorWithInputsProps): React.JSX.Element;
@@ -2,5 +2,8 @@
2
2
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
3
  * SPDX-License-Identifier: MIT
4
4
  */
5
- export declare const PromptEditorWithVariables: import("react").LazyExoticComponent<typeof import("./editor").PromptEditorWithVariables>;
6
- export type { PromptEditorWithVariablesProps } from './editor';
5
+ import React from 'react';
6
+ import { PromptEditorPropsType } from '../prompt-editor';
7
+ export interface PromptEditorWithVariablesProps extends PromptEditorPropsType {
8
+ }
9
+ export declare function PromptEditorWithVariables(props: PromptEditorWithVariablesProps): React.JSX.Element;
@@ -3,14 +3,27 @@
3
3
  * SPDX-License-Identifier: MIT
4
4
  */
5
5
  import React from 'react';
6
+ import { IJsonSchema } from '@flowgram.ai/json-schema';
6
7
  import { BaseVariableField } from '@flowgram.ai/editor';
8
+ type VariableField = BaseVariableField<{
9
+ icon?: string | JSX.Element;
10
+ title?: string;
11
+ disabled?: boolean;
12
+ }>;
7
13
  export declare const VariableSelectorContext: React.Context<{
8
- skipVariable?: (variable?: BaseVariableField) => boolean;
14
+ includeSchema?: IJsonSchema | IJsonSchema[];
15
+ excludeSchema?: IJsonSchema | IJsonSchema[];
16
+ skipVariable?: (variable: VariableField) => boolean;
9
17
  }>;
10
18
  export declare const useVariableSelectorContext: () => {
11
- skipVariable?: (variable?: BaseVariableField) => boolean;
19
+ includeSchema?: IJsonSchema | IJsonSchema[];
20
+ excludeSchema?: IJsonSchema | IJsonSchema[];
21
+ skipVariable?: (variable: VariableField) => boolean;
12
22
  };
13
- export declare const VariableSelectorProvider: ({ children, skipVariable, }: {
23
+ export declare const VariableSelectorProvider: ({ children, skipVariable, includeSchema, excludeSchema, }: {
14
24
  skipVariable?: (variable?: BaseVariableField) => boolean;
25
+ includeSchema?: IJsonSchema | IJsonSchema[];
26
+ excludeSchema?: IJsonSchema | IJsonSchema[];
15
27
  children: React.ReactNode;
16
28
  }) => React.JSX.Element;
29
+ export {};
@@ -6,6 +6,7 @@ import React from 'react';
6
6
  import { IJsonSchema } from '@flowgram.ai/json-schema';
7
7
  import { type TriggerRenderProps } from '@douyinfe/semi-ui/lib/es/treeSelect';
8
8
  import { useVariableTree } from './use-variable-tree';
9
+ import './styles.css';
9
10
  export interface VariableSelectorProps {
10
11
  value?: string[];
11
12
  config?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowgram.ai/form-materials",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "homepage": "https://flowgram.ai/",
5
5
  "repository": "https://github.com/bytedance/flowgram.ai",
6
6
  "license": "MIT",
@@ -67,9 +67,9 @@
67
67
  "@codemirror/view": "~6.38.0",
68
68
  "@codemirror/state": "~6.5.2",
69
69
  "zod": "^3.24.4",
70
- "@flowgram.ai/editor": "0.5.5",
71
- "@flowgram.ai/coze-editor": "0.5.5",
72
- "@flowgram.ai/json-schema": "0.5.5"
70
+ "@flowgram.ai/json-schema": "0.5.7",
71
+ "@flowgram.ai/editor": "0.5.7",
72
+ "@flowgram.ai/coze-editor": "0.5.7"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/lodash-es": "^4.17.12",
@@ -77,24 +77,21 @@
77
77
  "@types/react": "^18",
78
78
  "@types/react-dom": "^18",
79
79
  "@types/inquirer": "^9.0.9",
80
- "@types/styled-components": "^5",
81
80
  "eslint": "^8.54.0",
82
81
  "react": "^18",
83
82
  "react-dom": "^18",
84
- "styled-components": "^5",
85
83
  "typescript": "^5.8.3",
86
84
  "vitest": "^3.2.4",
87
85
  "@rslib/core": "~0.12.4",
88
86
  "cross-env": "~7.0.3",
89
87
  "@rsbuild/plugin-react": "^1.1.1",
90
88
  "date-fns": "~4.1.0",
91
- "@flowgram.ai/ts-config": "0.5.5",
92
- "@flowgram.ai/eslint-config": "0.5.5"
89
+ "@flowgram.ai/eslint-config": "0.5.7",
90
+ "@flowgram.ai/ts-config": "0.5.7"
93
91
  },
94
92
  "peerDependencies": {
95
93
  "react": ">=16.8",
96
- "react-dom": ">=16.8",
97
- "styled-components": ">=5"
94
+ "react-dom": ">=16.8"
98
95
  },
99
96
  "publishConfig": {
100
97
  "access": "public",
@@ -13,7 +13,7 @@ import { useObjectList } from '@/hooks';
13
13
  import { InjectVariableSelector } from '@/components/variable-selector';
14
14
 
15
15
  import { PropsType } from './types';
16
- import { UIRow, UIRows } from './styles';
16
+ import './styles.css';
17
17
 
18
18
  export function BatchOutputs(props: PropsType) {
19
19
  const { readonly, style } = props;
@@ -22,9 +22,9 @@ export function BatchOutputs(props: PropsType) {
22
22
 
23
23
  return (
24
24
  <div>
25
- <UIRows style={style}>
25
+ <div className="gedit-m-batch-outputs-rows" style={style}>
26
26
  {list.map((item) => (
27
- <UIRow key={item.id}>
27
+ <div className="gedit-m-batch-outputs-row" key={item.id}>
28
28
  <Input
29
29
  style={{ width: 100 }}
30
30
  disabled={readonly}
@@ -44,9 +44,9 @@ export function BatchOutputs(props: PropsType) {
44
44
  size="small"
45
45
  onClick={() => remove(item.id)}
46
46
  />
47
- </UIRow>
47
+ </div>
48
48
  ))}
49
- </UIRows>
49
+ </div>
50
50
  <Button disabled={readonly} icon={<IconPlus />} size="small" onClick={() => add()}>
51
51
  {I18n.t('Add')}
52
52
  </Button>
@@ -3,17 +3,15 @@
3
3
  * SPDX-License-Identifier: MIT
4
4
  */
5
5
 
6
- import styled from 'styled-components';
7
-
8
- export const UIRows = styled.div`
6
+ .gedit-m-batch-outputs-rows {
9
7
  display: flex;
10
8
  flex-direction: column;
11
9
  gap: 10px;
12
10
  margin-bottom: 10px;
13
- `;
11
+ }
14
12
 
15
- export const UIRow = styled.div`
13
+ .gedit-m-batch-outputs-row {
16
14
  display: flex;
17
15
  align-items: center;
18
16
  gap: 5px;
19
- `;
17
+ }
@@ -30,7 +30,10 @@ export function BlurInput(props: InputProps) {
30
30
  onChange={(value) => {
31
31
  setValue(value);
32
32
  }}
33
- onBlur={(e) => props.onChange?.(value, e)}
33
+ onBlur={(e) => {
34
+ props.onChange?.(value, e);
35
+ props.onBlur?.(e);
36
+ }}
34
37
  />
35
38
  );
36
39
  }
@@ -5,7 +5,6 @@
5
5
 
6
6
  import React, { useEffect, useRef } from 'react';
7
7
 
8
- import styled, { css } from 'styled-components';
9
8
  import {
10
9
  ActiveLinePlaceholder,
11
10
  createRenderer,
@@ -17,6 +16,8 @@ import { EditorView } from '@codemirror/view';
17
16
 
18
17
  import { getSuffixByLanguageId } from './utils';
19
18
 
19
+ import './styles.css';
20
+
20
21
  const OriginCodeEditor = createRenderer(preset, [
21
22
  EditorView.theme({
22
23
  '&.cm-focused': {
@@ -25,13 +26,7 @@ const OriginCodeEditor = createRenderer(preset, [
25
26
  }),
26
27
  ]);
27
28
 
28
- const UIContainer = styled.div<{ $mini?: boolean }>`
29
- ${({ $mini }) =>
30
- $mini &&
31
- css`
32
- height: 24px;
33
- `}
34
- `;
29
+ // CSS styles are in styles.css
35
30
 
36
31
  type Preset = typeof preset;
37
32
  type Options = Partial<InferValues<Preset[number]>>;
@@ -62,18 +57,28 @@ export function BaseCodeEditor({
62
57
  }: CodeEditorPropsType) {
63
58
  const editorRef = useRef<EditorAPI | null>(null);
64
59
 
60
+ const editorValue = String(value || '');
61
+
65
62
  useEffect(() => {
66
63
  // listen to value change
67
- if (editorRef.current?.getValue() !== value) {
68
- editorRef.current?.setValue(String(value || ''));
64
+ if (editorRef.current?.getValue() !== editorValue) {
65
+ // apply updates on readonly mode
66
+ const editorView = editorRef.current?.$view;
67
+ editorView?.dispatch({
68
+ changes: {
69
+ from: 0,
70
+ to: editorView?.state.doc.length,
71
+ insert: editorValue,
72
+ },
73
+ });
69
74
  }
70
- }, [value]);
75
+ }, [editorValue]);
71
76
 
72
77
  return (
73
- <UIContainer $mini={mini}>
78
+ <div className={`gedit-m-code-editor-container ${mini ? 'mini' : ''}`}>
74
79
  <EditorProvider>
75
80
  <OriginCodeEditor
76
- defaultValue={String(value || '')}
81
+ defaultValue={editorValue}
77
82
  options={{
78
83
  uri: `file:///untitled${getSuffixByLanguageId(languageId)}`,
79
84
  languageId,
@@ -101,6 +106,6 @@ export function BaseCodeEditor({
101
106
  {children}
102
107
  </OriginCodeEditor>
103
108
  </EditorProvider>
104
- </UIContainer>
109
+ </div>
105
110
  );
106
111
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .gedit-m-code-editor-container {
7
+ }
8
+
9
+ .gedit-m-code-editor-container.mini {
10
+ height: 24px;
11
+ }
@@ -5,21 +5,14 @@
5
5
 
6
6
  import React from 'react';
7
7
 
8
- import styled from 'styled-components';
9
-
10
8
  import { CodeEditor, type CodeEditorPropsType } from '@/components/code-editor';
11
9
 
12
- const UIMini = styled.div`
13
- .ͼ1 .cm-content {
14
- }
15
- `;
16
-
17
10
  /**
18
11
  * @deprecated use mini in CodeEditorPropsType instead
19
12
  */
20
13
  export function CodeEditorMini(props: CodeEditorPropsType) {
21
14
  return (
22
- <UIMini>
15
+ <div className="gedit-m-code-editor-mini">
23
16
  <CodeEditor
24
17
  {...props}
25
18
  options={{
@@ -29,6 +22,6 @@ export function CodeEditorMini(props: CodeEditorPropsType) {
29
22
  ...(props.options || {}),
30
23
  }}
31
24
  />
32
- </UIMini>
25
+ </div>
33
26
  );
34
27
  }
@@ -3,7 +3,7 @@
3
3
  * SPDX-License-Identifier: MIT
4
4
  */
5
5
 
6
- import { useMemo } from 'react';
6
+ import { useEffect, useMemo, useRef } from 'react';
7
7
 
8
8
  import { IJsonSchema } from '@flowgram.ai/json-schema';
9
9
  import { I18n } from '@flowgram.ai/editor';
@@ -14,10 +14,28 @@ import { IConditionRule, ConditionOpConfigs } from '../types';
14
14
  import { useConditionContext } from '../context';
15
15
 
16
16
  interface HooksParams {
17
+ /**
18
+ * Left schema of condition
19
+ */
17
20
  leftSchema?: IJsonSchema;
21
+
22
+ /**
23
+ * Operator of condition
24
+ */
18
25
  operator?: string;
19
26
 
20
27
  /**
28
+ * If op is not in opOptionList, clear it
29
+ */
30
+ onClearOp?: () => void;
31
+
32
+ /**
33
+ * If targetSchema updated, clear it
34
+ */
35
+ onClearRight?: () => void;
36
+
37
+ /**
38
+ * @deprecated use ConditionProvider instead
21
39
  * custom rule config
22
40
  */
23
41
  ruleConfig?: {
@@ -26,26 +44,32 @@ interface HooksParams {
26
44
  };
27
45
  }
28
46
 
29
- export function useCondition({ leftSchema, operator, ruleConfig }: HooksParams) {
47
+ export function useCondition({
48
+ leftSchema,
49
+ operator,
50
+ onClearOp,
51
+ onClearRight,
52
+ ruleConfig,
53
+ }: HooksParams) {
30
54
  const typeManager = useTypeManager();
31
55
  const { rules: contextRules, ops: contextOps } = useConditionContext();
32
56
 
33
- // 合并用户规则和上下文规则
57
+ // Merge user rules and context rules
34
58
  const userRules = useMemo(
35
59
  () => ruleConfig?.rules || contextRules || {},
36
60
  [contextRules, ruleConfig?.rules]
37
61
  );
38
62
 
39
- // 合并用户操作符和上下文操作符
63
+ // Merge user operators and context operators
40
64
  const allOps = useMemo(() => ruleConfig?.ops || contextOps || {}, [contextOps, ruleConfig?.ops]);
41
65
 
42
- // 获取类型配置
66
+ // Get type configuration
43
67
  const config = useMemo(
44
68
  () => (leftSchema ? typeManager.getTypeBySchema(leftSchema) : undefined),
45
69
  [leftSchema, typeManager]
46
70
  );
47
71
 
48
- // 计算规则
72
+ // Calculate rule
49
73
  const rule = useMemo(() => {
50
74
  if (!config) {
51
75
  return undefined;
@@ -59,7 +83,7 @@ export function useCondition({ leftSchema, operator, ruleConfig }: HooksParams)
59
83
  return config.conditionRule;
60
84
  }, [userRules, leftSchema, config]);
61
85
 
62
- // 计算操作符选项列表
86
+ // Calculate operator option list
63
87
  const opOptionList = useMemo(
64
88
  () =>
65
89
  Object.keys(rule || {})
@@ -72,6 +96,16 @@ export function useCondition({ leftSchema, operator, ruleConfig }: HooksParams)
72
96
  [rule, allOps]
73
97
  );
74
98
 
99
+ // When op not in list, clear it
100
+ useEffect(() => {
101
+ if (!operator || !rule) {
102
+ return;
103
+ }
104
+ if (!opOptionList.find((item) => item.value === operator)) {
105
+ onClearOp?.();
106
+ }
107
+ }, [operator, opOptionList, onClearOp]);
108
+
75
109
  // get target schema
76
110
  const targetSchema = useMemo(() => {
77
111
  const targetType: string | IJsonSchema | null = rule?.[operator || ''] || null;
@@ -87,6 +121,16 @@ export function useCondition({ leftSchema, operator, ruleConfig }: HooksParams)
87
121
  return targetType;
88
122
  }, [rule, operator]);
89
123
 
124
+ const prevTargetSchemaRef = useRef<IJsonSchema | undefined>(undefined);
125
+
126
+ // When type of target schema updated, clear it
127
+ useEffect(() => {
128
+ if (prevTargetSchemaRef.current?.type !== targetSchema?.type) {
129
+ onClearRight?.();
130
+ }
131
+ prevTargetSchemaRef.current = targetSchema;
132
+ }, [targetSchema, onClearRight]);
133
+
90
134
  // get current operator config
91
135
  const opConfig = useMemo(() => allOps[operator || ''], [operator, allOps]);
92
136