@flowgram.ai/form-materials 0.5.4 → 0.5.6

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 (192) 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/code-editor/editor.js +16 -12
  4. package/dist/cjs/components/code-editor/styles.css +4 -0
  5. package/dist/cjs/components/code-editor-mini/index.js +2 -16
  6. package/dist/cjs/components/condition-row/index.js +14 -12
  7. package/dist/cjs/components/condition-row/styles.css +19 -0
  8. package/dist/cjs/components/coze-editor-extensions/extensions/variable-tag.js +28 -10
  9. package/dist/{esm/components/coze-editor-extensions/styles.mjs → cjs/components/coze-editor-extensions/styles.css} +19 -18
  10. package/dist/cjs/components/db-condition-row/index.js +16 -13
  11. package/dist/cjs/components/db-condition-row/styles.css +30 -0
  12. package/dist/cjs/components/display-inputs-values/index.js +3 -2
  13. package/dist/cjs/components/display-inputs-values/styles.css +6 -0
  14. package/dist/cjs/components/display-outputs/index.js +3 -2
  15. package/dist/cjs/components/display-outputs/styles.css +6 -0
  16. package/dist/cjs/components/display-schema-tag/index.js +7 -4
  17. package/dist/cjs/components/display-schema-tag/styles.css +21 -0
  18. package/dist/cjs/components/display-schema-tree/index.js +12 -7
  19. package/dist/cjs/components/display-schema-tree/styles.css +64 -0
  20. package/dist/cjs/components/dynamic-value-input/index.js +9 -5
  21. package/dist/{esm/components/dynamic-value-input/styles.mjs → cjs/components/dynamic-value-input/styles.css} +23 -30
  22. package/dist/cjs/components/inputs-values/index.js +5 -3
  23. package/dist/cjs/components/inputs-values/styles.css +13 -0
  24. package/dist/cjs/components/inputs-values-tree/icon.js +70 -0
  25. package/dist/cjs/components/inputs-values-tree/index.js +3 -2
  26. package/dist/cjs/components/inputs-values-tree/row.js +19 -15
  27. package/dist/cjs/components/inputs-values-tree/styles.css +85 -0
  28. package/dist/cjs/components/json-schema-editor/default-value.js +2 -2
  29. package/dist/cjs/components/json-schema-editor/icon.js +70 -0
  30. package/dist/cjs/components/json-schema-editor/index.js +37 -25
  31. package/dist/cjs/components/json-schema-editor/styles.css +113 -0
  32. package/dist/cjs/components/prompt-editor/editor.js +16 -6
  33. package/dist/cjs/components/prompt-editor/styles.css +10 -0
  34. package/dist/cjs/components/prompt-editor-with-inputs/index.js +16 -26
  35. package/dist/cjs/components/prompt-editor-with-variables/index.js +17 -26
  36. package/dist/cjs/components/variable-selector/context.js +7 -3
  37. package/dist/cjs/components/variable-selector/index.js +16 -10
  38. package/dist/{esm/components/variable-selector/styles.mjs → cjs/components/variable-selector/styles.css} +37 -29
  39. package/dist/cjs/components/variable-selector/use-variable-tree.js +3 -1
  40. package/dist/esm/components/batch-outputs/index.mjs +5 -3
  41. package/dist/esm/components/batch-outputs/styles.css +13 -0
  42. package/dist/esm/components/code-editor/editor.mjs +16 -11
  43. package/dist/esm/components/code-editor/styles.css +4 -0
  44. package/dist/esm/components/code-editor-mini/index.mjs +2 -6
  45. package/dist/esm/components/condition-row/index.mjs +14 -12
  46. package/dist/esm/components/condition-row/styles.css +19 -0
  47. package/dist/esm/components/coze-editor-extensions/extensions/variable-tag.mjs +29 -11
  48. package/dist/esm/components/coze-editor-extensions/styles.css +37 -0
  49. package/dist/esm/components/db-condition-row/index.mjs +16 -13
  50. package/dist/esm/components/db-condition-row/styles.css +30 -0
  51. package/dist/esm/components/display-inputs-values/index.mjs +3 -2
  52. package/dist/esm/components/display-inputs-values/styles.css +6 -0
  53. package/dist/esm/components/display-outputs/index.mjs +3 -2
  54. package/dist/esm/components/display-outputs/styles.css +6 -0
  55. package/dist/esm/components/display-schema-tag/index.mjs +8 -5
  56. package/dist/esm/components/display-schema-tag/styles.css +21 -0
  57. package/dist/esm/components/display-schema-tree/index.mjs +12 -7
  58. package/dist/esm/components/display-schema-tree/styles.css +64 -0
  59. package/dist/esm/components/dynamic-value-input/index.mjs +9 -5
  60. package/dist/esm/components/dynamic-value-input/styles.css +48 -0
  61. package/dist/esm/components/inputs-values/index.mjs +5 -3
  62. package/dist/esm/components/inputs-values/styles.css +13 -0
  63. package/dist/esm/components/inputs-values-tree/icon.mjs +26 -0
  64. package/dist/esm/components/inputs-values-tree/index.mjs +3 -2
  65. package/dist/esm/components/inputs-values-tree/row.mjs +18 -14
  66. package/dist/esm/components/inputs-values-tree/styles.css +85 -0
  67. package/dist/esm/components/json-schema-editor/default-value.mjs +2 -2
  68. package/dist/esm/components/json-schema-editor/icon.mjs +26 -0
  69. package/dist/esm/components/json-schema-editor/index.mjs +36 -24
  70. package/dist/esm/components/json-schema-editor/styles.css +113 -0
  71. package/dist/esm/components/prompt-editor/editor.mjs +16 -6
  72. package/dist/esm/components/prompt-editor/styles.css +10 -0
  73. package/dist/esm/components/prompt-editor-with-inputs/index.mjs +12 -4
  74. package/dist/esm/components/prompt-editor-with-variables/index.mjs +13 -4
  75. package/dist/esm/components/variable-selector/context.mjs +7 -3
  76. package/dist/esm/components/variable-selector/index.mjs +17 -11
  77. package/{src/components/variable-selector/styles.tsx → dist/esm/components/variable-selector/styles.css} +35 -38
  78. package/dist/esm/components/variable-selector/use-variable-tree.mjs +3 -1
  79. package/dist/tsconfig.tsbuildinfo +1 -1
  80. package/dist/types/components/batch-outputs/index.d.ts +1 -0
  81. package/dist/types/components/code-editor/editor.d.ts +1 -0
  82. package/dist/types/components/condition-row/index.d.ts +5 -1
  83. package/dist/types/components/coze-editor-extensions/extensions/variable-tag.d.ts +1 -0
  84. package/dist/types/components/db-condition-row/index.d.ts +4 -0
  85. package/dist/types/components/db-condition-row/types.d.ts +0 -1
  86. package/dist/types/components/display-inputs-values/index.d.ts +1 -0
  87. package/dist/types/components/display-outputs/index.d.ts +1 -0
  88. package/dist/types/components/display-schema-tag/index.d.ts +1 -0
  89. package/dist/types/components/display-schema-tree/index.d.ts +1 -0
  90. package/dist/types/components/dynamic-value-input/index.d.ts +1 -0
  91. package/dist/types/components/inputs-values/index.d.ts +1 -0
  92. package/dist/types/components/inputs-values-tree/icon.d.ts +6 -0
  93. package/dist/types/components/inputs-values-tree/index.d.ts +1 -0
  94. package/dist/types/components/inputs-values-tree/row.d.ts +1 -0
  95. package/dist/types/components/json-schema-editor/icon.d.ts +6 -0
  96. package/dist/types/components/json-schema-editor/index.d.ts +1 -0
  97. package/dist/types/components/prompt-editor/editor.d.ts +1 -0
  98. package/dist/types/components/prompt-editor-with-inputs/index.d.ts +7 -2
  99. package/dist/types/components/prompt-editor-with-variables/index.d.ts +5 -2
  100. package/dist/types/components/variable-selector/context.d.ts +16 -3
  101. package/dist/types/components/variable-selector/index.d.ts +1 -0
  102. package/package.json +7 -10
  103. package/src/components/batch-outputs/index.tsx +5 -5
  104. package/src/components/batch-outputs/{styles.tsx → styles.css} +4 -6
  105. package/src/components/code-editor/editor.tsx +19 -14
  106. package/src/components/code-editor/styles.css +11 -0
  107. package/src/components/code-editor-mini/index.tsx +2 -9
  108. package/src/components/condition-row/index.tsx +15 -22
  109. package/src/components/condition-row/{styles.tsx → styles.css} +10 -11
  110. package/src/components/coze-editor-extensions/extensions/variable-tag.tsx +18 -13
  111. package/src/components/coze-editor-extensions/{styles.tsx → styles.css} +8 -11
  112. package/src/components/db-condition-row/index.tsx +17 -26
  113. package/src/components/db-condition-row/{styles.tsx → styles.css} +14 -16
  114. package/src/components/db-condition-row/types.ts +0 -1
  115. package/src/components/display-inputs-values/index.tsx +3 -3
  116. package/src/components/display-inputs-values/{styles.ts → styles.css} +2 -4
  117. package/src/components/display-outputs/index.tsx +3 -3
  118. package/src/components/display-outputs/{styles.ts → styles.css} +2 -4
  119. package/src/components/display-schema-tag/index.tsx +7 -7
  120. package/src/components/display-schema-tag/{styles.ts → styles.css} +7 -10
  121. package/src/components/display-schema-tree/index.tsx +10 -10
  122. package/src/components/display-schema-tree/{styles.tsx → styles.css} +18 -24
  123. package/src/components/dynamic-value-input/index.tsx +6 -6
  124. package/src/components/dynamic-value-input/{styles.tsx → styles.css} +8 -12
  125. package/src/components/inputs-values/index.tsx +5 -5
  126. package/src/components/inputs-values/{styles.tsx → styles.css} +4 -6
  127. package/src/components/inputs-values-tree/icon.tsx +28 -0
  128. package/src/components/inputs-values-tree/index.tsx +3 -3
  129. package/src/components/inputs-values-tree/row.tsx +25 -27
  130. package/src/components/inputs-values-tree/styles.css +94 -0
  131. package/src/components/json-schema-editor/default-value.tsx +2 -4
  132. package/src/components/json-schema-editor/icon.tsx +28 -0
  133. package/src/components/json-schema-editor/index.tsx +45 -50
  134. package/src/components/json-schema-editor/styles.css +135 -0
  135. package/src/components/prompt-editor/editor.tsx +18 -7
  136. package/src/components/prompt-editor/styles.css +14 -0
  137. package/src/components/prompt-editor-with-inputs/index.tsx +18 -5
  138. package/src/components/prompt-editor-with-variables/index.tsx +13 -5
  139. package/src/components/variable-selector/context.tsx +22 -2
  140. package/src/components/variable-selector/index.tsx +24 -14
  141. package/src/components/variable-selector/styles.css +70 -0
  142. package/src/components/variable-selector/use-variable-tree.tsx +9 -1
  143. package/dist/cjs/components/batch-outputs/styles.js +0 -60
  144. package/dist/cjs/components/condition-row/styles.js +0 -78
  145. package/dist/cjs/components/coze-editor-extensions/styles.js +0 -89
  146. package/dist/cjs/components/db-condition-row/styles.js +0 -94
  147. package/dist/cjs/components/display-inputs-values/styles.js +0 -51
  148. package/dist/cjs/components/display-outputs/styles.js +0 -51
  149. package/dist/cjs/components/display-schema-tag/styles.js +0 -71
  150. package/dist/cjs/components/display-schema-tree/styles.js +0 -135
  151. package/dist/cjs/components/dynamic-value-input/styles.js +0 -108
  152. package/dist/cjs/components/inputs-values/styles.js +0 -60
  153. package/dist/cjs/components/inputs-values-tree/styles.js +0 -177
  154. package/dist/cjs/components/json-schema-editor/styles.js +0 -231
  155. package/dist/cjs/components/prompt-editor/styles.js +0 -55
  156. package/dist/cjs/components/prompt-editor-with-inputs/editor.js +0 -47
  157. package/dist/cjs/components/prompt-editor-with-variables/editor.js +0 -48
  158. package/dist/cjs/components/variable-selector/styles.js +0 -114
  159. package/dist/esm/components/batch-outputs/styles.mjs +0 -13
  160. package/dist/esm/components/condition-row/styles.mjs +0 -22
  161. package/dist/esm/components/db-condition-row/styles.mjs +0 -32
  162. package/dist/esm/components/display-inputs-values/styles.mjs +0 -7
  163. package/dist/esm/components/display-outputs/styles.mjs +0 -7
  164. package/dist/esm/components/display-schema-tag/styles.mjs +0 -21
  165. package/dist/esm/components/display-schema-tree/styles.mjs +0 -79
  166. package/dist/esm/components/inputs-values/styles.mjs +0 -13
  167. package/dist/esm/components/inputs-values-tree/styles.mjs +0 -105
  168. package/dist/esm/components/json-schema-editor/styles.mjs +0 -138
  169. package/dist/esm/components/prompt-editor/styles.mjs +0 -11
  170. package/dist/esm/components/prompt-editor-with-inputs/editor.mjs +0 -13
  171. package/dist/esm/components/prompt-editor-with-variables/editor.mjs +0 -14
  172. package/dist/types/components/batch-outputs/styles.d.ts +0 -6
  173. package/dist/types/components/condition-row/styles.d.ts +0 -9
  174. package/dist/types/components/coze-editor-extensions/styles.d.ts +0 -9
  175. package/dist/types/components/db-condition-row/styles.d.ts +0 -12
  176. package/dist/types/components/display-inputs-values/styles.d.ts +0 -5
  177. package/dist/types/components/display-outputs/styles.d.ts +0 -5
  178. package/dist/types/components/display-schema-tag/styles.d.ts +0 -8
  179. package/dist/types/components/display-schema-tree/styles.d.ts +0 -11
  180. package/dist/types/components/dynamic-value-input/styles.d.ts +0 -8
  181. package/dist/types/components/inputs-values/styles.d.ts +0 -6
  182. package/dist/types/components/inputs-values-tree/styles.d.ts +0 -23
  183. package/dist/types/components/json-schema-editor/styles.d.ts +0 -30
  184. package/dist/types/components/prompt-editor/styles.d.ts +0 -7
  185. package/dist/types/components/prompt-editor-with-inputs/editor.d.ts +0 -11
  186. package/dist/types/components/prompt-editor-with-variables/editor.d.ts +0 -9
  187. package/dist/types/components/variable-selector/styles.d.ts +0 -14
  188. package/src/components/inputs-values-tree/styles.tsx +0 -128
  189. package/src/components/json-schema-editor/styles.tsx +0 -168
  190. package/src/components/prompt-editor/styles.tsx +0 -18
  191. package/src/components/prompt-editor-with-inputs/editor.tsx +0 -25
  192. package/src/components/prompt-editor-with-variables/editor.tsx +0 -20
@@ -21,26 +21,12 @@ import { InjectTypeSelector } from '@/components/type-selector';
21
21
  import { BlurInput } from '@/components/blur-input';
22
22
 
23
23
  import { ConfigType, PropertyValueType } from './types';
24
- import {
25
- IconAddChildren,
26
- UIActions,
27
- UICollapseTrigger,
28
- UICollapsible,
29
- UIContainer,
30
- UIExpandDetail,
31
- UILabel,
32
- UITreeItems,
33
- UITreeItemLeft,
34
- UITreeItemMain,
35
- UITreeItemRight,
36
- UIRequired,
37
- UIType,
38
- } from './styles';
39
- import { UIName } from './styles';
40
- import { DefaultValueWrapper, UIRow } from './styles';
24
+ import { IconAddChildren } from './icon';
41
25
  import { usePropertiesEdit } from './hooks';
42
26
  import { DefaultValue } from './default-value';
43
27
 
28
+ import './styles.css';
29
+
44
30
  const DEFAULT = { type: 'object' };
45
31
 
46
32
  export function JsonSchemaEditor(props: {
@@ -57,8 +43,8 @@ export function JsonSchemaEditor(props: {
57
43
  );
58
44
 
59
45
  return (
60
- <UIContainer className={props.className}>
61
- <UITreeItems>
46
+ <div className="gedit-m-json-schema-editor-container">
47
+ <div className="gedit-m-json-schema-editor-tree-items">
62
48
  {propertyList.map((_property) => (
63
49
  <PropertyEdit
64
50
  readonly={readonly}
@@ -73,7 +59,7 @@ export function JsonSchemaEditor(props: {
73
59
  }}
74
60
  />
75
61
  ))}
76
- </UITreeItems>
62
+ </div>
77
63
  <Button
78
64
  disabled={readonly}
79
65
  size="small"
@@ -83,7 +69,7 @@ export function JsonSchemaEditor(props: {
83
69
  >
84
70
  {config?.addButtonText ?? I18n.t('Add')}
85
71
  </Button>
86
- </UIContainer>
72
+ </div>
87
73
  );
88
74
  }
89
75
 
@@ -119,17 +105,24 @@ function PropertyEdit(props: {
119
105
 
120
106
  return (
121
107
  <>
122
- <UITreeItemLeft $isLast={$isLast} $showLine={$level > 0} $showCollapse={showCollapse}>
108
+ <div
109
+ className={`gedit-m-json-schema-editor-tree-item-left ${$level > 0 ? 'show-line' : ''} ${
110
+ $isLast ? 'is-last' : ''
111
+ } ${showCollapse ? 'show-collapse' : ''}`}
112
+ >
123
113
  {showCollapse && (
124
- <UICollapseTrigger onClick={() => setCollapse((_collapse) => !_collapse)}>
114
+ <div
115
+ className="gedit-m-json-schema-editor-collapse-trigger"
116
+ onClick={() => setCollapse((_collapse) => !_collapse)}
117
+ >
125
118
  {collapse ? <IconChevronDown size="small" /> : <IconChevronRight size="small" />}
126
- </UICollapseTrigger>
119
+ </div>
127
120
  )}
128
- </UITreeItemLeft>
129
- <UITreeItemRight>
130
- <UITreeItemMain>
131
- <UIRow>
132
- <UIName>
121
+ </div>
122
+ <div className="gedit-m-json-schema-editor-tree-item-right">
123
+ <div className="gedit-m-json-schema-editor-tree-item-main">
124
+ <div className="gedit-m-json-schema-editor-row">
125
+ <div className="gedit-m-json-schema-editor-name">
133
126
  <BlurInput
134
127
  disabled={readonly}
135
128
  placeholder={config?.placeholder ?? I18n.t('Input Variable Name')}
@@ -137,8 +130,8 @@ function PropertyEdit(props: {
137
130
  value={name}
138
131
  onChange={(value) => onChange('name', value)}
139
132
  />
140
- </UIName>
141
- <UIType>
133
+ </div>
134
+ <div className="gedit-m-json-schema-editor-type">
142
135
  <InjectTypeSelector
143
136
  value={typeSelectorValue}
144
137
  readonly={readonly}
@@ -149,15 +142,15 @@ function PropertyEdit(props: {
149
142
  });
150
143
  }}
151
144
  />
152
- </UIType>
153
- <UIRequired>
145
+ </div>
146
+ <div className="gedit-m-json-schema-editor-required">
154
147
  <Checkbox
155
148
  disabled={readonly}
156
149
  checked={isPropertyRequired}
157
150
  onChange={(e) => onChange('isPropertyRequired', e.target.checked)}
158
151
  />
159
- </UIRequired>
160
- <UIActions>
152
+ </div>
153
+ <div className="gedit-m-json-schema-editor-actions">
161
154
  <IconButton
162
155
  disabled={readonly}
163
156
  size="small"
@@ -186,11 +179,13 @@ function PropertyEdit(props: {
186
179
  icon={<IconMinus size="small" />}
187
180
  onClick={onRemove}
188
181
  />
189
- </UIActions>
190
- </UIRow>
182
+ </div>
183
+ </div>
191
184
  {expand && (
192
- <UIExpandDetail>
193
- <UILabel>{config?.descTitle ?? I18n.t('Description')}</UILabel>
185
+ <div className="gedit-m-json-schema-editor-expand-detail">
186
+ <div className="gedit-m-json-schema-editor-label">
187
+ {config?.descTitle ?? I18n.t('Description')}
188
+ </div>
194
189
  <BlurInput
195
190
  disabled={readonly}
196
191
  size="small"
@@ -202,25 +197,25 @@ function PropertyEdit(props: {
202
197
  />
203
198
  {$level === 0 && (
204
199
  <>
205
- <UILabel style={{ marginTop: 10 }}>
200
+ <div className="gedit-m-json-schema-editor-label" style={{ marginTop: 10 }}>
206
201
  {config?.defaultValueTitle ?? I18n.t('Default Value')}
207
- </UILabel>
208
- <DefaultValueWrapper>
202
+ </div>
203
+ <div className="gedit-m-json-schema-editor-default-value-wrapper">
209
204
  <DefaultValue
210
205
  value={defaultValue}
211
206
  schema={value}
212
207
  placeholder={config?.defaultValuePlaceholder ?? I18n.t('Default Value')}
213
208
  onChange={(value) => onChange('default', value)}
214
209
  />
215
- </DefaultValueWrapper>
210
+ </div>
216
211
  </>
217
212
  )}
218
- </UIExpandDetail>
213
+ </div>
219
214
  )}
220
- </UITreeItemMain>
215
+ </div>
221
216
  {showCollapse && (
222
- <UICollapsible $collapse={collapse}>
223
- <UITreeItems $shrink={true}>
217
+ <div className={`gedit-m-json-schema-editor-collapsible ${collapse ? 'collapse' : ''}`}>
218
+ <div className="gedit-m-json-schema-editor-tree-items shrink">
224
219
  {propertyList.map((_property, index) => (
225
220
  <PropertyEdit
226
221
  readonly={readonly}
@@ -237,10 +232,10 @@ function PropertyEdit(props: {
237
232
  $isLast={index === propertyList.length - 1}
238
233
  />
239
234
  ))}
240
- </UITreeItems>
241
- </UICollapsible>
235
+ </div>
236
+ </div>
242
237
  )}
243
- </UITreeItemRight>
238
+ </div>
244
239
  </>
245
240
  );
246
241
  }
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .gedit-m-json-schema-editor-container {
7
+ /* & .semi-input {
8
+ background-color: #fff;
9
+ border-radius: 6px;
10
+ height: 24px;
11
+ } */
12
+ }
13
+
14
+ .gedit-m-json-schema-editor-row {
15
+ display: flex;
16
+ align-items: center;
17
+ gap: 6px;
18
+ }
19
+
20
+ .gedit-m-json-schema-editor-collapse-trigger {
21
+ cursor: pointer;
22
+ margin-right: 5px;
23
+ }
24
+
25
+ .gedit-m-json-schema-editor-expand-detail {
26
+ display: flex;
27
+ flex-direction: column;
28
+ }
29
+
30
+ .gedit-m-json-schema-editor-label {
31
+ font-size: 12px;
32
+ color: #999;
33
+ font-weight: 400;
34
+ margin-bottom: 2px;
35
+ }
36
+
37
+ .gedit-m-json-schema-editor-tree-items {
38
+ display: grid;
39
+ grid-template-columns: auto 1fr;
40
+ }
41
+
42
+ .gedit-m-json-schema-editor-tree-items.shrink {
43
+ padding-left: 3px;
44
+ margin-top: 10px;
45
+ }
46
+
47
+ .gedit-m-json-schema-editor-tree-item-left {
48
+ grid-column: 1;
49
+ position: relative;
50
+ width: 16px;
51
+ }
52
+
53
+ .gedit-m-json-schema-editor-tree-item-left.show-line::before {
54
+ /* 竖线 */
55
+ content: "";
56
+ height: var(--line-height, 100%);
57
+ position: absolute;
58
+ left: -14px;
59
+ top: -16px;
60
+ width: 1px;
61
+ background: #d9d9d9;
62
+ display: block;
63
+ }
64
+
65
+ .gedit-m-json-schema-editor-tree-item-left.show-line::after {
66
+ /* 横线 */
67
+ content: "";
68
+ position: absolute;
69
+ left: -14px; /* 横线起点和竖线对齐 */
70
+ top: 8px; /* 跟随你的行高调整 */
71
+ width: var(--line-width, 30px); /* 横线长度 */
72
+ height: 1px;
73
+ background: #d9d9d9;
74
+ display: block;
75
+ }
76
+
77
+ .gedit-m-json-schema-editor-tree-item-left.show-line.is-last::before {
78
+ height: 24px;
79
+ }
80
+
81
+ .gedit-m-json-schema-editor-tree-item-left.show-line.show-collapse::after {
82
+ width: 12px;
83
+ }
84
+
85
+ .gedit-m-json-schema-editor-tree-item-right {
86
+ grid-column: 2;
87
+ margin-bottom: 10px;
88
+
89
+ &:last-child {
90
+ margin-bottom: 0px;
91
+ }
92
+ }
93
+
94
+ .gedit-m-json-schema-editor-tree-item-main {
95
+ display: flex;
96
+ flex-direction: column;
97
+ gap: 10px;
98
+ position: relative;
99
+ }
100
+
101
+ .gedit-m-json-schema-editor-collapsible {
102
+ display: none;
103
+ }
104
+
105
+ .gedit-m-json-schema-editor-collapsible.collapse {
106
+ display: block;
107
+ }
108
+
109
+ .gedit-m-json-schema-editor-name {
110
+ flex-grow: 1;
111
+ }
112
+
113
+ .gedit-m-json-schema-editor-type {
114
+ }
115
+
116
+ .gedit-m-json-schema-editor-required {
117
+ }
118
+
119
+ .gedit-m-json-schema-editor-actions {
120
+ white-space: nowrap;
121
+ }
122
+
123
+ .gedit-m-json-schema-editor-default-value-wrapper {
124
+ margin: 0;
125
+ }
126
+
127
+ .gedit-m-json-schema-editor-constant-input-wrapper {
128
+ flex-grow: 1;
129
+
130
+ & .semi-tree-select,
131
+ & .semi-input-number,
132
+ & .semi-select {
133
+ width: 100%;
134
+ }
135
+ }
@@ -14,11 +14,12 @@ import {
14
14
  import preset, { EditorAPI } from '@flowgram.ai/coze-editor/preset-prompt';
15
15
 
16
16
  import { PropsType } from './types';
17
- import { UIContainer } from './styles';
18
17
  import MarkdownHighlight from './extensions/markdown';
19
18
  import LanguageSupport from './extensions/language-support';
20
19
  import JinjaHighlight from './extensions/jinja';
21
20
 
21
+ import './styles.css';
22
+
22
23
  type Preset = typeof preset;
23
24
  type Options = Partial<InferValues<Preset[number]>>;
24
25
 
@@ -42,22 +43,32 @@ export function PromptEditor(props: PromptEditorPropsType) {
42
43
 
43
44
  const editorRef = useRef<EditorAPI | null>(null);
44
45
 
46
+ const editorValue = String(value?.content || '');
47
+
45
48
  useEffect(() => {
46
49
  // listen to value change
47
- if (editorRef.current?.getValue() !== value?.content) {
48
- editorRef.current?.setValue(String(value?.content || ''));
50
+ if (editorRef.current?.getValue() !== editorValue) {
51
+ // apply updates on readonly mode
52
+ const editorView = editorRef.current?.$view;
53
+ editorView?.dispatch({
54
+ changes: {
55
+ from: 0,
56
+ to: editorView?.state.doc.length,
57
+ insert: editorValue,
58
+ },
59
+ });
49
60
  }
50
- }, [value]);
61
+ }, [editorValue]);
51
62
 
52
63
  return (
53
- <UIContainer $hasError={hasError} style={style}>
64
+ <div className={`gedit-m-prompt-editor-container ${hasError ? 'has-error' : ''}`} style={style}>
54
65
  <EditorProvider>
55
66
  <Renderer
56
67
  didMount={(editor: EditorAPI) => {
57
68
  editorRef.current = editor;
58
69
  }}
59
70
  plugins={preset}
60
- defaultValue={String(value?.content)}
71
+ defaultValue={editorValue}
61
72
  options={{
62
73
  readOnly: readonly,
63
74
  editable: !readonly,
@@ -76,6 +87,6 @@ export function PromptEditor(props: PromptEditorPropsType) {
76
87
  <JinjaHighlight />
77
88
  {children}
78
89
  </EditorProvider>
79
- </UIContainer>
90
+ </div>
80
91
  );
81
92
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .gedit-m-prompt-editor-container {
7
+ background-color: var(--semi-color-fill-0);
8
+ padding-left: 10px;
9
+ padding-right: 6px;
10
+ }
11
+
12
+ .gedit-m-prompt-editor-container.has-error {
13
+ border: 1px solid var(--semi-color-danger-6);
14
+ }
@@ -3,10 +3,23 @@
3
3
  * SPDX-License-Identifier: MIT
4
4
  */
5
5
 
6
- import { lazySuspense } from '@/shared';
6
+ import React from 'react';
7
7
 
8
- export const PromptEditorWithInputs = lazySuspense(() =>
9
- import('./editor').then((module) => ({ default: module.PromptEditorWithInputs }))
10
- );
8
+ import type { IInputsValues } from '@/shared/flow-value';
9
+ import { PromptEditor, PromptEditorPropsType } from '@/components/prompt-editor';
10
+ import { EditorInputsTree } from '@/components/coze-editor-extensions';
11
11
 
12
- export type { PromptEditorWithInputsProps } from './editor';
12
+ export interface PromptEditorWithInputsProps extends PromptEditorPropsType {
13
+ inputsValues: IInputsValues;
14
+ }
15
+
16
+ export function PromptEditorWithInputs({
17
+ inputsValues,
18
+ ...restProps
19
+ }: PromptEditorWithInputsProps) {
20
+ return (
21
+ <PromptEditor {...restProps}>
22
+ <EditorInputsTree inputsValues={inputsValues} />
23
+ </PromptEditor>
24
+ );
25
+ }
@@ -3,10 +3,18 @@
3
3
  * SPDX-License-Identifier: MIT
4
4
  */
5
5
 
6
- import { lazySuspense } from '@/shared';
6
+ import React from 'react';
7
7
 
8
- export const PromptEditorWithVariables = lazySuspense(() =>
9
- import('./editor').then((module) => ({ default: module.PromptEditorWithVariables }))
10
- );
8
+ import { PromptEditor, PromptEditorPropsType } from '@/components/prompt-editor';
9
+ import { EditorVariableTree, EditorVariableTagInject } from '@/components/coze-editor-extensions';
11
10
 
12
- export type { PromptEditorWithVariablesProps } from './editor';
11
+ export interface PromptEditorWithVariablesProps extends PromptEditorPropsType {}
12
+
13
+ export function PromptEditorWithVariables(props: PromptEditorWithVariablesProps) {
14
+ return (
15
+ <PromptEditor {...props}>
16
+ <EditorVariableTree />
17
+ <EditorVariableTagInject />
18
+ </PromptEditor>
19
+ );
20
+ }
@@ -5,10 +5,19 @@
5
5
 
6
6
  import React, { createContext, useContext, useMemo } from 'react';
7
7
 
8
+ import { IJsonSchema } from '@flowgram.ai/json-schema';
8
9
  import { BaseVariableField } from '@flowgram.ai/editor';
9
10
 
11
+ type VariableField = BaseVariableField<{
12
+ icon?: string | JSX.Element;
13
+ title?: string;
14
+ disabled?: boolean;
15
+ }>;
16
+
10
17
  export const VariableSelectorContext = createContext<{
11
- skipVariable?: (variable?: BaseVariableField) => boolean;
18
+ includeSchema?: IJsonSchema | IJsonSchema[];
19
+ excludeSchema?: IJsonSchema | IJsonSchema[];
20
+ skipVariable?: (variable: VariableField) => boolean;
12
21
  }>({});
13
22
 
14
23
  export const useVariableSelectorContext = () => useContext(VariableSelectorContext);
@@ -16,11 +25,22 @@ export const useVariableSelectorContext = () => useContext(VariableSelectorConte
16
25
  export const VariableSelectorProvider = ({
17
26
  children,
18
27
  skipVariable,
28
+ includeSchema,
29
+ excludeSchema,
19
30
  }: {
20
31
  skipVariable?: (variable?: BaseVariableField) => boolean;
32
+ includeSchema?: IJsonSchema | IJsonSchema[];
33
+ excludeSchema?: IJsonSchema | IJsonSchema[];
21
34
  children: React.ReactNode;
22
35
  }) => {
23
- const context = useMemo(() => ({ skipVariable }), [skipVariable]);
36
+ const context = useMemo(
37
+ () => ({
38
+ skipVariable,
39
+ includeSchema,
40
+ excludeSchema,
41
+ }),
42
+ [skipVariable, includeSchema, excludeSchema]
43
+ );
24
44
 
25
45
  return (
26
46
  <VariableSelectorContext.Provider value={context}>{children}</VariableSelectorContext.Provider>
@@ -9,15 +9,16 @@ import { IJsonSchema } from '@flowgram.ai/json-schema';
9
9
  import { I18n } from '@flowgram.ai/editor';
10
10
  import { type TriggerRenderProps } from '@douyinfe/semi-ui/lib/es/treeSelect';
11
11
  import { type TreeNodeData } from '@douyinfe/semi-ui/lib/es/tree';
12
- import { Popover } from '@douyinfe/semi-ui';
12
+ import { Popover, Tag, TreeSelect } from '@douyinfe/semi-ui';
13
13
  import { IconChevronDownStroked, IconIssueStroked } from '@douyinfe/semi-icons';
14
14
 
15
15
  import { createInjectMaterial } from '@/shared';
16
16
 
17
17
  import { useVariableTree } from './use-variable-tree';
18
- import { UIPopoverContent, UIRootTitle, UITag, UITreeSelect, UIVarName } from './styles';
19
18
  import { useVariableSelectorContext } from './context';
20
19
 
20
+ import './styles.css';
21
+
21
22
  export interface VariableSelectorProps {
22
23
  value?: string[];
23
24
  config?: {
@@ -75,62 +76,71 @@ export const VariableSelector = ({
75
76
 
76
77
  return (
77
78
  <>
78
- <UITreeSelect
79
+ <TreeSelect
80
+ className={`gedit-m-variable-selector-tree-select ${hasError ? 'error' : ''}`}
79
81
  dropdownMatchSelectWidth={false}
80
82
  disabled={readonly}
81
83
  treeData={treeData}
82
84
  size="small"
83
85
  value={treeValue}
84
86
  clearIcon={null}
85
- $error={hasError}
86
87
  style={style}
87
88
  validateStatus={hasError ? 'error' : undefined}
89
+ dropdownClassName="gedit-m-variable-selector-dropdown"
88
90
  onChange={(_, _config) => {
89
91
  onChange((_config as TreeNodeData).keyPath as string[]);
90
92
  }}
91
93
  renderSelectedItem={(_option: TreeNodeData) => {
92
94
  if (!_option?.keyPath) {
93
95
  return (
94
- <UITag
96
+ <Tag
97
+ className="gedit-m-variable-selector-tag"
95
98
  prefixIcon={<IconIssueStroked />}
96
99
  color="amber"
97
100
  closable={!readonly}
98
101
  onClose={() => onChange(undefined)}
99
102
  >
100
103
  {config?.notFoundContent ?? 'Undefined'}
101
- </UITag>
104
+ </Tag>
102
105
  );
103
106
  }
104
107
 
105
108
  const rootIcon = renderIcon(_option.rootMeta?.icon || _option?.icon);
106
109
 
107
110
  const rootTitle = (
108
- <UIRootTitle>
111
+ <div className="gedit-m-variable-selector-root-title">
109
112
  {_option.rootMeta?.title
110
113
  ? `${_option.rootMeta?.title} ${_option.isRoot ? '' : '-'} `
111
114
  : null}
112
- </UIRootTitle>
115
+ </div>
113
116
  );
114
117
 
115
118
  return (
116
119
  <div>
117
120
  <Popover
118
121
  content={
119
- <UIPopoverContent>
122
+ <div className="gedit-m-variable-selector-tag-pop">
120
123
  {rootIcon}
121
124
  {rootTitle}
122
- <UIVarName>{_option.keyPath.slice(1).join('.')}</UIVarName>
123
- </UIPopoverContent>
125
+ <div className="gedit-m-variable-selector-var-name">
126
+ {_option.keyPath.slice(1).join('.')}
127
+ </div>
128
+ </div>
124
129
  }
125
130
  >
126
- <UITag
131
+ <Tag
132
+ className="gedit-m-variable-selector-tag"
127
133
  prefixIcon={rootIcon}
128
134
  closable={!readonly}
129
135
  onClose={() => onChange(undefined)}
130
136
  >
131
137
  {rootTitle}
132
- {!_option.isRoot && <UIVarName $inSelector>{_option.label}</UIVarName>}
133
- </UITag>
138
+ {!_option.isRoot && (
139
+ <div className="gedit-m-variable-selector-var-name in-selector">
140
+ {_option.label}
141
+ </div>
142
+ )}
143
+ </Tag>
134
144
  </Popover>
135
145
  </div>
136
146
  );
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .gedit-m-variable-selector-root-title {
7
+ margin-right: 4px;
8
+ min-width: 20px;
9
+ overflow: hidden;
10
+ text-overflow: ellipsis;
11
+ white-space: nowrap;
12
+ color: var(--semi-color-text-2);
13
+ }
14
+
15
+ .gedit-m-variable-selector-var-name {
16
+ overflow: hidden;
17
+ text-overflow: ellipsis;
18
+ white-space: nowrap;
19
+
20
+ &.in-selector {
21
+ min-width: 50%;
22
+ }
23
+ }
24
+
25
+ .gedit-m-variable-selector-tag {
26
+ width: 100%;
27
+ display: flex;
28
+ align-items: center;
29
+ justify-content: flex-start;
30
+ margin: 0;
31
+ height: 22px;
32
+
33
+ .semi-tag-content-center {
34
+ justify-content: flex-start;
35
+ }
36
+ }
37
+
38
+ .gedit-m-variable-selector-tree-select {
39
+ outline: none;
40
+
41
+ &.error {
42
+ outline: 1px solid red;
43
+ }
44
+
45
+ .semi-tree-select-selection {
46
+ padding: 0px;
47
+ height: 22px;
48
+ }
49
+
50
+ .semi-tree-select-selection-content {
51
+ width: 100%;
52
+ }
53
+
54
+ .semi-tree-select-selection-placeholder {
55
+ padding-left: 10px;
56
+ }
57
+ }
58
+
59
+ .gedit-m-variable-selector-tag-pop {
60
+ padding: 10px;
61
+ display: inline-flex;
62
+ align-items: center;
63
+ justify-content: flex-start;
64
+ white-space: nowrap;
65
+ }
66
+
67
+ .gedit-m-variable-selector-dropdown {
68
+ max-height: 300px;
69
+ overflow: auto;
70
+ }