@flowgram-vue/form-materials 0.2.0

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 (177) hide show
  1. package/LICENSE +22 -0
  2. package/bin/run.sh +7 -0
  3. package/dist/index.cjs +0 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +0 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +86 -0
  9. package/src/components/assign-row/assign-row.vue +69 -0
  10. package/src/components/assign-row/index.ts +7 -0
  11. package/src/components/assign-row/types.ts +25 -0
  12. package/src/components/assign-rows/assign-rows.vue +44 -0
  13. package/src/components/assign-rows/index.ts +6 -0
  14. package/src/components/batch-outputs/batch-outputs.vue +46 -0
  15. package/src/components/batch-outputs/index.ts +6 -0
  16. package/src/components/batch-outputs/styles.css +17 -0
  17. package/src/components/batch-outputs/types.ts +23 -0
  18. package/src/components/batch-variable-selector/batch-variable-selector.vue +24 -0
  19. package/src/components/batch-variable-selector/index.ts +6 -0
  20. package/src/components/blur-input/blur-input.vue +47 -0
  21. package/src/components/blur-input/index.ts +6 -0
  22. package/src/components/code-editor/base-code-editor.vue +44 -0
  23. package/src/components/code-editor/index.ts +58 -0
  24. package/src/components/code-editor/styles.css +27 -0
  25. package/src/components/code-editor/types.ts +20 -0
  26. package/src/components/code-editor/utils.ts +24 -0
  27. package/src/components/code-editor-mini/code-editor-mini.vue +16 -0
  28. package/src/components/code-editor-mini/index.ts +6 -0
  29. package/src/components/condition-context/context.ts +45 -0
  30. package/src/components/condition-context/hooks/use-condition.ts +120 -0
  31. package/src/components/condition-context/index.ts +14 -0
  32. package/src/components/condition-context/op.ts +86 -0
  33. package/src/components/condition-context/types.ts +22 -0
  34. package/src/components/condition-row/condition-row.vue +126 -0
  35. package/src/components/condition-row/index.ts +7 -0
  36. package/src/components/condition-row/styles.css +30 -0
  37. package/src/components/condition-row/types.ts +12 -0
  38. package/src/components/constant-input/constant-input.vue +48 -0
  39. package/src/components/constant-input/index.ts +7 -0
  40. package/src/components/constant-input/types.ts +23 -0
  41. package/src/components/coze-editor-extensions/extensions/inputs-tree.vue +16 -0
  42. package/src/components/coze-editor-extensions/extensions/variable-tag.vue +10 -0
  43. package/src/components/coze-editor-extensions/extensions/variable-tree.vue +18 -0
  44. package/src/components/coze-editor-extensions/index.ts +22 -0
  45. package/src/components/coze-editor-extensions/styles.css +41 -0
  46. package/src/components/db-condition-row/db-condition-row.vue +112 -0
  47. package/src/components/db-condition-row/index.ts +7 -0
  48. package/src/components/db-condition-row/styles.css +41 -0
  49. package/src/components/db-condition-row/types.ts +20 -0
  50. package/src/components/display-flow-value/display-flow-value.vue +46 -0
  51. package/src/components/display-flow-value/index.ts +6 -0
  52. package/src/components/display-inputs-values/display-inputs-value-all-in-tag.vue +26 -0
  53. package/src/components/display-inputs-values/display-inputs-values.vue +43 -0
  54. package/src/components/display-inputs-values/index.ts +7 -0
  55. package/src/components/display-inputs-values/styles.css +10 -0
  56. package/src/components/display-outputs/display-outputs.vue +62 -0
  57. package/src/components/display-outputs/index.ts +6 -0
  58. package/src/components/display-outputs/styles.css +10 -0
  59. package/src/components/display-schema-tag/display-schema-tag.vue +41 -0
  60. package/src/components/display-schema-tag/index.ts +6 -0
  61. package/src/components/display-schema-tag/styles.css +25 -0
  62. package/src/components/display-schema-tree/display-schema-tree.vue +55 -0
  63. package/src/components/display-schema-tree/index.ts +6 -0
  64. package/src/components/display-schema-tree/styles.css +84 -0
  65. package/src/components/dynamic-value-input/dynamic-value-input.vue +145 -0
  66. package/src/components/dynamic-value-input/hooks.ts +71 -0
  67. package/src/components/dynamic-value-input/index.ts +10 -0
  68. package/src/components/dynamic-value-input/styles.css +59 -0
  69. package/src/components/index.ts +84 -0
  70. package/src/components/inputs-values/index.ts +6 -0
  71. package/src/components/inputs-values/inputs-values.vue +67 -0
  72. package/src/components/inputs-values/styles.css +17 -0
  73. package/src/components/inputs-values/types.ts +23 -0
  74. package/src/components/inputs-values-tree/hooks/use-child-list.ts +65 -0
  75. package/src/components/inputs-values-tree/index.ts +6 -0
  76. package/src/components/inputs-values-tree/inputs-values-tree.vue +59 -0
  77. package/src/components/inputs-values-tree/row.vue +139 -0
  78. package/src/components/inputs-values-tree/styles.css +94 -0
  79. package/src/components/inputs-values-tree/types.ts +23 -0
  80. package/src/components/json-editor-with-variables/index.ts +7 -0
  81. package/src/components/json-editor-with-variables/json-editor-with-variables.vue +24 -0
  82. package/src/components/json-editor-with-variables/types.ts +8 -0
  83. package/src/components/json-schema-creator/index.ts +7 -0
  84. package/src/components/json-schema-creator/json-input-modal.vue +51 -0
  85. package/src/components/json-schema-creator/json-schema-creator.vue +27 -0
  86. package/src/components/json-schema-creator/types.ts +10 -0
  87. package/src/components/json-schema-creator/utils/json-to-schema.ts +50 -0
  88. package/src/components/json-schema-editor/default-value.vue +30 -0
  89. package/src/components/json-schema-editor/hooks.ts +134 -0
  90. package/src/components/json-schema-editor/index.ts +6 -0
  91. package/src/components/json-schema-editor/json-schema-editor.vue +53 -0
  92. package/src/components/json-schema-editor/property-edit.vue +222 -0
  93. package/src/components/json-schema-editor/styles.css +135 -0
  94. package/src/components/json-schema-editor/types.ts +25 -0
  95. package/src/components/prompt-editor/index.ts +7 -0
  96. package/src/components/prompt-editor/prompt-editor.vue +40 -0
  97. package/src/components/prompt-editor/styles.css +14 -0
  98. package/src/components/prompt-editor/types.ts +20 -0
  99. package/src/components/prompt-editor-with-inputs/index.ts +7 -0
  100. package/src/components/prompt-editor-with-inputs/prompt-editor-with-inputs.vue +18 -0
  101. package/src/components/prompt-editor-with-inputs/types.ts +11 -0
  102. package/src/components/prompt-editor-with-variables/index.ts +7 -0
  103. package/src/components/prompt-editor-with-variables/prompt-editor-with-variables.vue +19 -0
  104. package/src/components/prompt-editor-with-variables/types.ts +8 -0
  105. package/src/components/sql-editor-with-variables/index.ts +7 -0
  106. package/src/components/sql-editor-with-variables/sql-editor-with-variables.vue +24 -0
  107. package/src/components/sql-editor-with-variables/types.ts +8 -0
  108. package/src/components/type-selector/index.ts +11 -0
  109. package/src/components/type-selector/type-selector.vue +79 -0
  110. package/src/components/type-selector/types.ts +33 -0
  111. package/src/components/variable-selector/context.ts +44 -0
  112. package/src/components/variable-selector/index.ts +13 -0
  113. package/src/components/variable-selector/styles.css +70 -0
  114. package/src/components/variable-selector/types.ts +22 -0
  115. package/src/components/variable-selector/use-variable-tree.ts +108 -0
  116. package/src/components/variable-selector/variable-selector.vue +139 -0
  117. package/src/effects/auto-rename-ref/index.ts +109 -0
  118. package/src/effects/index.ts +12 -0
  119. package/src/effects/listen-ref-schema-change/index.ts +56 -0
  120. package/src/effects/listen-ref-value-change/index.ts +53 -0
  121. package/src/effects/provide-batch-input/index.ts +40 -0
  122. package/src/effects/provide-json-schema-outputs/index.ts +23 -0
  123. package/src/effects/sync-variable-title/index.ts +25 -0
  124. package/src/effects/validate-when-variable-sync/index.ts +34 -0
  125. package/src/env.d.ts +12 -0
  126. package/src/form-plugins/batch-outputs-plugin/index.ts +120 -0
  127. package/src/form-plugins/index.ts +8 -0
  128. package/src/form-plugins/infer-assign-plugin/index.ts +87 -0
  129. package/src/form-plugins/infer-inputs-plugin/index.ts +85 -0
  130. package/src/hooks/index.ts +6 -0
  131. package/src/hooks/use-object-list/index.ts +161 -0
  132. package/src/index.ts +125 -0
  133. package/src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts +27 -0
  134. package/src/plugins/disable-declaration-plugin/index.ts +6 -0
  135. package/src/plugins/index.ts +16 -0
  136. package/src/plugins/json-schema-preset/create-type-preset-plugin.ts +35 -0
  137. package/src/plugins/json-schema-preset/index.ts +25 -0
  138. package/src/plugins/json-schema-preset/type-definition/array.ts +38 -0
  139. package/src/plugins/json-schema-preset/type-definition/boolean.ts +47 -0
  140. package/src/plugins/json-schema-preset/type-definition/date-time.ts +60 -0
  141. package/src/plugins/json-schema-preset/type-definition/enum.ts +31 -0
  142. package/src/plugins/json-schema-preset/type-definition/index.ts +37 -0
  143. package/src/plugins/json-schema-preset/type-definition/integer.ts +47 -0
  144. package/src/plugins/json-schema-preset/type-definition/map.ts +34 -0
  145. package/src/plugins/json-schema-preset/type-definition/number.ts +46 -0
  146. package/src/plugins/json-schema-preset/type-definition/object.ts +34 -0
  147. package/src/plugins/json-schema-preset/type-definition/string.ts +52 -0
  148. package/src/plugins/json-schema-preset/types.ts +25 -0
  149. package/src/plugins/json-schema-preset/vue.ts +38 -0
  150. package/src/shared/flow-value/index.ts +17 -0
  151. package/src/shared/flow-value/schema.ts +38 -0
  152. package/src/shared/flow-value/types.ts +49 -0
  153. package/src/shared/flow-value/utils.ts +213 -0
  154. package/src/shared/format-legacy-refs/index.ts +158 -0
  155. package/src/shared/format-legacy-refs/readme.md +38 -0
  156. package/src/shared/index.ts +32 -0
  157. package/src/shared/inject-material/index.ts +50 -0
  158. package/src/shared/lazy-suspense/index.ts +20 -0
  159. package/src/shared/polyfill-create-root/index.ts +38 -0
  160. package/src/ui/fg-button.vue +27 -0
  161. package/src/ui/fg-cascader.vue +92 -0
  162. package/src/ui/fg-checkbox.vue +25 -0
  163. package/src/ui/fg-icon-button.vue +31 -0
  164. package/src/ui/fg-input.vue +50 -0
  165. package/src/ui/fg-modal.vue +37 -0
  166. package/src/ui/fg-popover.vue +19 -0
  167. package/src/ui/fg-select.vue +81 -0
  168. package/src/ui/fg-tag.vue +37 -0
  169. package/src/ui/fg-textarea.vue +42 -0
  170. package/src/ui/fg-tree-nodes.vue +48 -0
  171. package/src/ui/fg-tree-select.vue +86 -0
  172. package/src/ui/icons.ts +60 -0
  173. package/src/ui/index.ts +20 -0
  174. package/src/ui/styles.css +277 -0
  175. package/src/ui/types.ts +36 -0
  176. package/src/validate/index.ts +6 -0
  177. package/src/validate/validate-flow-value/index.ts +62 -0
@@ -0,0 +1,145 @@
1
+ <script lang="ts">
2
+ /**
3
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+
7
+ import { defineComponent, h, type PropType, type CSSProperties } from 'vue';
8
+ import {
9
+ JsonSchemaUtils,
10
+ IJsonSchema,
11
+ useTypeManager,
12
+ type JsonSchemaTypeManager,
13
+ } from '@flowgram-vue/json-schema';
14
+
15
+ import { IFlowConstantRefValue, IFlowConstantValue } from '@/shared';
16
+ import { InjectVariableSelector } from '@/components/variable-selector';
17
+ import { TypeSelector } from '@/components/type-selector';
18
+ import { ConstantInput, type ConstantInputStrategy } from '@/components/constant-input';
19
+ import { FgIconButton, IconSetting } from '@/ui';
20
+
21
+ import { useIncludeSchema, useRefVariable, useSelectSchema } from './hooks';
22
+ import './styles.css';
23
+
24
+ const DEFAULT_VALUE: IFlowConstantValue = {
25
+ type: 'constant',
26
+ content: '',
27
+ schema: { type: 'string' },
28
+ };
29
+
30
+ const DynamicValueInputImpl = defineComponent({
31
+ name: 'DynamicValueInput',
32
+ props: {
33
+ value: { type: Object as PropType<IFlowConstantRefValue> },
34
+ onChange: { type: Function as PropType<(value?: IFlowConstantRefValue) => void>, required: true },
35
+ readonly: { type: Boolean, default: false },
36
+ hasError: { type: Boolean, default: false },
37
+ style: { type: Object as PropType<CSSProperties> },
38
+ schema: { type: Object as PropType<IJsonSchema> },
39
+ constantProps: { type: Object as PropType<{ strategies?: ConstantInputStrategy[]; schema?: IJsonSchema; [key: string]: any }> },
40
+ },
41
+ setup(props) {
42
+ const refVariable = useRefVariable(props.value);
43
+ const [selectSchema, setSelectSchema] = useSelectSchema(
44
+ props.schema,
45
+ props.constantProps,
46
+ props.value
47
+ );
48
+ const includeSchema = useIncludeSchema(props.schema);
49
+ const typeManager = useTypeManager() as JsonSchemaTypeManager;
50
+
51
+ return () => {
52
+ const renderTypeSelector = () => {
53
+ if (props.schema) {
54
+ return h(TypeSelector, { value: props.schema, readonly: true });
55
+ }
56
+ if (props.value?.type === 'ref') {
57
+ const schema = refVariable.value?.type
58
+ ? JsonSchemaUtils.astToSchema(refVariable.value?.type)
59
+ : undefined;
60
+ return h(TypeSelector, { value: schema, readonly: true });
61
+ }
62
+ return h(TypeSelector, {
63
+ value: selectSchema.value,
64
+ readonly: props.readonly,
65
+ onChange: (_v) => {
66
+ setSelectSchema(_v || { type: 'string' });
67
+ const schema = _v || { type: 'string' };
68
+ let content = typeManager.getDefaultValue(schema);
69
+ if (_v?.type === 'object') {
70
+ content = '{}';
71
+ }
72
+ if (_v?.type === 'array') {
73
+ content = '[]';
74
+ }
75
+ props.onChange?.({
76
+ type: 'constant',
77
+ content,
78
+ schema,
79
+ });
80
+ },
81
+ });
82
+ };
83
+
84
+ const renderMain = () => {
85
+ if (props.value?.type === 'ref') {
86
+ return h(InjectVariableSelector, {
87
+ style: { width: '100%' },
88
+ value: props.value?.content,
89
+ includeSchema: includeSchema.value,
90
+ readonly: props.readonly,
91
+ onChange: (_v: string[] | undefined) =>
92
+ props.onChange?.(_v ? { type: 'ref', content: _v } : DEFAULT_VALUE),
93
+ });
94
+ }
95
+
96
+ const constantSchema = props.schema || selectSchema.value || { type: 'string' };
97
+
98
+ return h(ConstantInput, {
99
+ value: props.value?.content,
100
+ schema: constantSchema,
101
+ readonly: props.readonly,
102
+ fallbackRenderer: defineComponent({
103
+ setup() {
104
+ return () =>
105
+ h(InjectVariableSelector, {
106
+ style: { width: '100%' },
107
+ includeSchema: includeSchema.value,
108
+ readonly: props.readonly,
109
+ onChange: (_v: string[] | undefined) =>
110
+ props.onChange?.(_v ? { type: 'ref', content: _v } : DEFAULT_VALUE),
111
+ });
112
+ },
113
+ }),
114
+ ...(props.constantProps || {}),
115
+ strategies: [...(props.constantProps?.strategies || [])],
116
+ onChange: (_v: unknown) =>
117
+ props.onChange?.({ type: 'constant', content: _v, schema: constantSchema }),
118
+ });
119
+ };
120
+
121
+ const renderTrigger = () =>
122
+ h(InjectVariableSelector, {
123
+ style: { width: '100%' },
124
+ value: props.value?.type === 'ref' ? props.value?.content : undefined,
125
+ includeSchema: includeSchema.value,
126
+ readonly: props.readonly,
127
+ triggerRender: () =>
128
+ h(FgIconButton, { disabled: props.readonly, icon: IconSetting() }),
129
+ onChange: (_v: string[] | undefined) => props.onChange?.({ type: 'ref', content: _v }),
130
+ });
131
+
132
+ return h('div', { class: 'gedit-m-dynamic-value-input-container', style: props.style }, [
133
+ h('div', { class: 'gedit-m-dynamic-value-input-type' }, [renderTypeSelector()]),
134
+ h('div', { class: 'gedit-m-dynamic-value-input-main' }, [renderMain()]),
135
+ h('div', { class: 'gedit-m-dynamic-value-input-trigger' }, [renderTrigger()]),
136
+ ]);
137
+ };
138
+ },
139
+ });
140
+
141
+ (DynamicValueInputImpl as typeof DynamicValueInputImpl & { renderKey: string }).renderKey =
142
+ 'dynamic-value-input-render-key';
143
+
144
+ export default DynamicValueInputImpl;
145
+ </script>
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { computed, ref, watch } from 'vue';
7
+ import { IJsonSchema } from '@flowgram-vue/json-schema';
8
+ import { useScopeAvailable } from '@flowgram-vue/variable-core';
9
+
10
+ import { IFlowConstantRefValue } from '@/shared';
11
+
12
+ export function useRefVariable(value?: IFlowConstantRefValue) {
13
+ const available = useScopeAvailable();
14
+ return computed(() => {
15
+ if (value?.type === 'ref') {
16
+ return available.value.getByKeyPath(value.content);
17
+ }
18
+ return undefined;
19
+ });
20
+ }
21
+
22
+ export function useSelectSchema(
23
+ schemaFromProps?: IJsonSchema,
24
+ constantProps?: {
25
+ schema?: IJsonSchema;
26
+ },
27
+ value?: IFlowConstantRefValue
28
+ ) {
29
+ let defaultSelectSchema = schemaFromProps || constantProps?.schema || { type: 'string' };
30
+ if (value?.type === 'constant') {
31
+ defaultSelectSchema = value?.schema || defaultSelectSchema;
32
+ }
33
+
34
+ const changeVersion = ref(0);
35
+ const effectVersion = ref(0);
36
+ const selectSchema = ref(defaultSelectSchema);
37
+
38
+ watch(
39
+ () => value,
40
+ () => {
41
+ effectVersion.value += 1;
42
+ if (changeVersion.value === effectVersion.value) {
43
+ return;
44
+ }
45
+ effectVersion.value = changeVersion.value;
46
+
47
+ if (value?.type === 'constant' && value?.schema) {
48
+ selectSchema.value = value?.schema;
49
+ }
50
+ }
51
+ );
52
+
53
+ const setSelectSchemaWithVersionUpdate = (schema: IJsonSchema) => {
54
+ selectSchema.value = schema;
55
+ changeVersion.value += 1;
56
+ };
57
+
58
+ return [selectSchema, setSelectSchemaWithVersionUpdate] as const;
59
+ }
60
+
61
+ export function useIncludeSchema(schemaFromProps?: IJsonSchema) {
62
+ return computed(() => {
63
+ if (!schemaFromProps) {
64
+ return;
65
+ }
66
+ if (schemaFromProps?.type === 'number') {
67
+ return [schemaFromProps, { type: 'integer' }];
68
+ }
69
+ return { ...schemaFromProps, extra: { weak: true, ...schemaFromProps?.extra } };
70
+ });
71
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import DynamicValueInput from './dynamic-value-input.vue';
7
+ import { createInjectMaterial } from '@/shared';
8
+
9
+ export { default as DynamicValueInput } from './dynamic-value-input.vue';
10
+ export const InjectDynamicValueInput = createInjectMaterial(DynamicValueInput);
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .gedit-m-dynamic-value-input-container {
7
+ display: flex;
8
+ align-items: center;
9
+ border-radius: 4px;
10
+ border: 1px solid var(--semi-color-border);
11
+ line-height: normal;
12
+ overflow: hidden;
13
+ background-color: var(--semi-color-fill-0);
14
+ }
15
+
16
+ .gedit-m-dynamic-value-input-main {
17
+ flex-grow: 1;
18
+ overflow: hidden;
19
+ min-width: 0;
20
+ border-left: 1px solid var(--semi-color-border);
21
+ border-right: 1px solid var(--semi-color-border);
22
+
23
+ & .semi-tree-select,
24
+ & .semi-input-number,
25
+ & .semi-select {
26
+ width: 100%;
27
+ border: none;
28
+ border-radius: 0;
29
+ }
30
+
31
+ & .semi-input-wrapper {
32
+ border: none;
33
+ border-radius: 0;
34
+ }
35
+
36
+ & .semi-input-textarea-wrapper {
37
+ border: none;
38
+ border-radius: 0;
39
+ }
40
+
41
+ & .semi-input-textarea {
42
+ padding: 2px 6px;
43
+ border: none;
44
+ border-radius: 0;
45
+ word-break: break-all;
46
+ }
47
+ }
48
+
49
+ .gedit-m-dynamic-value-input-type {
50
+ & .semi-button {
51
+ border-radius: 0;
52
+ }
53
+ }
54
+
55
+ .gedit-m-dynamic-value-input-trigger {
56
+ & .semi-button {
57
+ border-radius: 0;
58
+ }
59
+ }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export { AssignRow, type AssignValueType } from './assign-row';
7
+ export { AssignRows } from './assign-rows';
8
+ export { BatchOutputs } from './batch-outputs';
9
+ export { BatchVariableSelector } from './batch-variable-selector';
10
+ export { BlurInput } from './blur-input';
11
+ export {
12
+ BaseCodeEditor,
13
+ CodeEditor,
14
+ JsonCodeEditor,
15
+ PythonCodeEditor,
16
+ SQLCodeEditor,
17
+ ShellCodeEditor,
18
+ TypeScriptCodeEditor,
19
+ type CodeEditorPropsType,
20
+ } from './code-editor';
21
+ export { CodeEditorMini } from './code-editor-mini';
22
+ export {
23
+ ConditionPresetOp,
24
+ ConditionProvider,
25
+ type ConditionOpConfig,
26
+ type ConditionOpConfigs,
27
+ type IConditionRule,
28
+ type IConditionRuleFactory,
29
+ useCondition,
30
+ useConditionContext,
31
+ } from './condition-context';
32
+ export { ConditionRow, type ConditionRowValueType } from './condition-row';
33
+ export { ConstantInput, type ConstantInputStrategy } from './constant-input';
34
+ export {
35
+ EditorInputsTree,
36
+ EditorVariableTagInject,
37
+ EditorVariableTree,
38
+ } from './coze-editor-extensions';
39
+ export {
40
+ DBConditionRow,
41
+ type DBConditionOptionType,
42
+ type DBConditionRowValueType,
43
+ } from './db-condition-row';
44
+ export { DisplayFlowValue } from './display-flow-value';
45
+ export { DisplayInputsValueAllInTag, DisplayInputsValues } from './display-inputs-values';
46
+ export { DisplayOutputs } from './display-outputs';
47
+ export { DisplaySchemaTag } from './display-schema-tag';
48
+ export { DisplaySchemaTree } from './display-schema-tree';
49
+ export { DynamicValueInput, InjectDynamicValueInput } from './dynamic-value-input';
50
+ export { InputsValues } from './inputs-values';
51
+ export { InputsValuesTree } from './inputs-values-tree';
52
+ export {
53
+ JsonEditorWithVariables,
54
+ type JsonEditorWithVariablesProps,
55
+ } from './json-editor-with-variables';
56
+ export { JsonSchemaCreator, type JsonSchemaCreatorProps } from './json-schema-creator';
57
+ export { JsonSchemaEditor } from './json-schema-editor';
58
+ export { PromptEditor, type PromptEditorPropsType } from './prompt-editor';
59
+ export {
60
+ PromptEditorWithInputs,
61
+ type PromptEditorWithInputsProps,
62
+ } from './prompt-editor-with-inputs';
63
+ export {
64
+ PromptEditorWithVariables,
65
+ type PromptEditorWithVariablesProps,
66
+ } from './prompt-editor-with-variables';
67
+ export {
68
+ SQLEditorWithVariables,
69
+ type SQLEditorWithVariablesProps,
70
+ } from './sql-editor-with-variables';
71
+ export {
72
+ InjectTypeSelector,
73
+ TypeSelector,
74
+ getTypeSelectValue,
75
+ parseTypeSelectValue,
76
+ type TypeSelectorProps,
77
+ } from './type-selector';
78
+ export {
79
+ InjectVariableSelector,
80
+ VariableSelector,
81
+ VariableSelectorProvider,
82
+ useVariableTree,
83
+ type VariableSelectorProps,
84
+ } from './variable-selector';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export { default as InputsValues } from './inputs-values.vue';
@@ -0,0 +1,67 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+
7
+ import { I18n } from '@flowgram-vue/i18n';
8
+
9
+ import { type IFlowConstantRefValue, type IFlowValue } from '@/shared';
10
+ import { useObjectList } from '@/hooks';
11
+ import { InjectDynamicValueInput } from '@/components/dynamic-value-input';
12
+ import { BlurInput } from '@/components/blur-input';
13
+ import { FgButton, FgIconButton, IconDelete, IconPlus } from '@/ui';
14
+
15
+ import type { PropsType } from './types';
16
+ import './styles.css';
17
+
18
+ const props = defineProps<PropsType>();
19
+
20
+ const { list, updateKey, updateValue, remove, add } = useObjectList<IFlowValue | undefined>({
21
+ value: props.value,
22
+ onChange: props.onChange,
23
+ sortIndexKey: 'extra.index',
24
+ });
25
+ </script>
26
+
27
+ <template>
28
+ <div>
29
+ <div class="gedit-m-inputs-values-rows" :style="style">
30
+ <div v-for="item in list" :key="item.id" class="gedit-m-inputs-values-row">
31
+ <BlurInput
32
+ :style="{ width: '100px', minWidth: '100px', maxWidth: '100px' }"
33
+ :disabled="readonly"
34
+ :value="item.key"
35
+ :placeholder="I18n.t('Input Key')"
36
+ @change="(v) => updateKey(item.id, v)"
37
+ />
38
+ <InjectDynamicValueInput
39
+ :style="{ flexGrow: 1 }"
40
+ :readonly="readonly"
41
+ :value="item.value as IFlowConstantRefValue"
42
+ :schema="schema"
43
+ :has-error="hasError"
44
+ :constant-props="{
45
+ ...constantProps,
46
+ strategies: [...(constantProps?.strategies || [])],
47
+ }"
48
+ :on-change="(v) => updateValue(item.id, v)"
49
+ />
50
+ <FgIconButton :disabled="readonly" :icon="IconDelete()" @click="remove(item.id)" />
51
+ </div>
52
+ </div>
53
+ <FgButton
54
+ :disabled="readonly"
55
+ @click="
56
+ add({
57
+ type: 'constant',
58
+ content: '',
59
+ schema: { type: 'string' },
60
+ })
61
+ "
62
+ >
63
+ <IconPlus />
64
+ {{ I18n.t('Add') }}
65
+ </FgButton>
66
+ </div>
67
+ </template>
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .gedit-m-inputs-values-rows {
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: 10px;
10
+ margin-bottom: 10px;
11
+ }
12
+
13
+ .gedit-m-inputs-values-row {
14
+ display: flex;
15
+ align-items: flex-start;
16
+ gap: 5px;
17
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { IJsonSchema } from '@flowgram-vue/json-schema';
7
+ import type { CSSProperties } from 'vue';
8
+
9
+ import { IFlowValue } from '@/shared';
10
+ import { ConstantInputStrategy } from '@/components/constant-input';
11
+
12
+ export interface PropsType {
13
+ value?: Record<string, IFlowValue | undefined>;
14
+ onChange: (value?: Record<string, IFlowValue | undefined>) => void;
15
+ readonly?: boolean;
16
+ hasError?: boolean;
17
+ schema?: IJsonSchema;
18
+ style?: CSSProperties;
19
+ constantProps?: {
20
+ strategies?: ConstantInputStrategy[];
21
+ [key: string]: any;
22
+ };
23
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { computed, type ComputedRef } from 'vue';
7
+ import { isPlainObject } from 'lodash-es';
8
+
9
+ import { FlowValueUtils } from '@/shared';
10
+ import { useObjectList } from '@/hooks';
11
+
12
+ export function useChildList(
13
+ value?: any,
14
+ onChange?: (value: any) => void
15
+ ): {
16
+ canAddField: ComputedRef<boolean>;
17
+ hasChildren: ComputedRef<boolean>;
18
+ list: ReturnType<typeof useObjectList<any>>['list'];
19
+ add: (defaultValue?: any) => void;
20
+ updateKey: (id: string, key: string) => void;
21
+ updateValue: (id: string, value: any) => void;
22
+ remove: (id: string) => void;
23
+ } {
24
+ const canAddField = computed(() => {
25
+ if (!isPlainObject(value)) {
26
+ return false;
27
+ }
28
+ if (FlowValueUtils.isFlowValue(value)) {
29
+ return FlowValueUtils.isConstant(value) && value?.schema?.type === 'object';
30
+ }
31
+ return true;
32
+ });
33
+
34
+ const objectListValue = computed(() => {
35
+ if (isPlainObject(value)) {
36
+ if (FlowValueUtils.isFlowValue(value)) {
37
+ return undefined;
38
+ }
39
+ return value;
40
+ }
41
+ return undefined;
42
+ });
43
+
44
+ const { list, add, updateKey, updateValue, remove } = useObjectList<any>({
45
+ value: objectListValue.value,
46
+ onChange: (next) => {
47
+ onChange?.(next);
48
+ },
49
+ sortIndexKey: (item) => (FlowValueUtils.isFlowValue(item) ? 'extra.index' : ''),
50
+ });
51
+
52
+ const hasChildren = computed(
53
+ () => canAddField.value && (list.value.length > 0 || Object.keys(objectListValue.value || {}).length > 0)
54
+ );
55
+
56
+ return {
57
+ canAddField,
58
+ hasChildren,
59
+ list,
60
+ add,
61
+ updateKey,
62
+ updateValue,
63
+ remove,
64
+ };
65
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export { default as InputsValuesTree } from './inputs-values-tree.vue';
@@ -0,0 +1,59 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+
7
+ import { I18n } from '@flowgram-vue/i18n';
8
+
9
+ import { FlowValueUtils, type IFlowValue, type IInputsValues } from '@/shared';
10
+ import { useObjectList } from '@/hooks';
11
+ import { FgButton, IconPlus } from '@/ui';
12
+
13
+ import type { PropsType } from './types';
14
+ import InputValueRow from './row.vue';
15
+ import './styles.css';
16
+
17
+ const props = defineProps<PropsType>();
18
+
19
+ const { list, updateKey, updateValue, remove, add } = useObjectList<
20
+ IInputsValues | IFlowValue | undefined
21
+ >({
22
+ value: props.value,
23
+ onChange: (v) => props.onChange?.(v as IInputsValues),
24
+ sortIndexKey: (item) => (FlowValueUtils.isFlowValue(item) ? 'extra.index' : ''),
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <div>
30
+ <div class="gedit-m-inputs-values-tree-tree-items">
31
+ <InputValueRow
32
+ v-for="item in list"
33
+ :key="item.id"
34
+ :key-name="item.key"
35
+ :value="item.value"
36
+ :readonly="readonly"
37
+ :has-error="hasError"
38
+ :constant-props="constantProps"
39
+ :on-update-key="(key) => updateKey(item.id, key)"
40
+ :on-update-value="(value) => updateValue(item.id, value)"
41
+ :on-remove="() => remove(item.id)"
42
+ />
43
+ </div>
44
+ <FgButton
45
+ :style="{ marginTop: '10px', marginLeft: '16px' }"
46
+ :disabled="readonly"
47
+ @click="
48
+ add({
49
+ type: 'constant',
50
+ content: '',
51
+ schema: { type: 'string' },
52
+ })
53
+ "
54
+ >
55
+ <IconPlus />
56
+ {{ I18n.t('Add') }}
57
+ </FgButton>
58
+ </div>
59
+ </template>