@flowgram.ai/form-materials 0.4.10 → 0.4.12
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.
- package/dist/cjs/components/blur-input/index.js +2 -12
- package/dist/cjs/components/{prompt-editor-with-inputs/inputs-picker.js → coze-editor-extensions/extensions/inputs-tree.js} +70 -2
- package/dist/cjs/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.js +10 -7
- package/dist/cjs/components/coze-editor-extensions/index.js +86 -0
- package/dist/cjs/components/display-schema-tree/index.js +2 -2
- package/dist/cjs/components/index.js +11 -1
- package/dist/cjs/components/json-editor-with-variables/editor.js +10 -6
- package/dist/cjs/components/prompt-editor-with-inputs/editor.js +2 -2
- package/dist/cjs/components/prompt-editor-with-variables/editor.js +3 -4
- package/dist/cjs/components/type-selector/index.js +2 -2
- package/dist/cjs/components/variable-selector/index.js +1 -0
- package/dist/cjs/components/variable-selector/use-variable-tree.js +1 -2
- package/dist/cjs/index.js +10 -1
- package/dist/cjs/plugins/json-schema-preset/index.js +3 -13
- package/dist/cjs/plugins/json-schema-preset/react.js +50 -0
- package/dist/cjs/shared/inject-material/index.js +2 -1
- package/dist/esm/components/blur-input/index.mjs +2 -2
- package/dist/esm/components/coze-editor-extensions/extensions/inputs-tree.mjs +135 -0
- package/dist/esm/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.mjs +10 -7
- package/dist/esm/components/coze-editor-extensions/index.mjs +18 -0
- package/dist/esm/components/display-schema-tree/index.mjs +1 -1
- package/dist/esm/components/index.mjs +2 -1
- package/dist/esm/components/json-editor-with-variables/editor.mjs +8 -4
- package/dist/esm/components/prompt-editor-with-inputs/editor.mjs +2 -2
- package/dist/esm/components/prompt-editor-with-variables/editor.mjs +3 -4
- package/dist/esm/components/type-selector/index.mjs +1 -1
- package/dist/esm/components/variable-selector/index.mjs +1 -0
- package/dist/esm/components/variable-selector/use-variable-tree.mjs +1 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/plugins/json-schema-preset/index.mjs +3 -13
- package/dist/esm/plugins/json-schema-preset/react.mjs +13 -0
- package/dist/esm/shared/inject-material/index.mjs +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/components/blur-input/index.d.ts +7 -1
- package/dist/types/components/{prompt-editor-with-inputs/inputs-picker.d.ts → coze-editor-extensions/extensions/inputs-tree.d.ts} +5 -0
- package/dist/types/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.d.ts +3 -1
- package/dist/types/components/coze-editor-extensions/index.d.ts +18 -0
- package/dist/types/components/display-schema-tree/index.d.ts +1 -1
- package/dist/types/components/dynamic-value-input/index.d.ts +3 -1
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/type-selector/index.d.ts +3 -1
- package/dist/types/components/variable-selector/index.d.ts +4 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugins/json-schema-preset/index.d.ts +3 -7
- package/dist/types/plugins/json-schema-preset/react.d.ts +11 -0
- package/dist/types/shared/inject-material/index.d.ts +6 -4
- package/dist/types/validate/validate-flow-value/index.d.ts +1 -1
- package/package.json +51 -12
- package/src/components/blur-input/index.tsx +9 -1
- package/src/components/{prompt-editor-with-inputs/inputs-picker.tsx → coze-editor-extensions/extensions/inputs-tree.tsx} +95 -5
- package/src/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.tsx +9 -3
- package/src/components/coze-editor-extensions/index.tsx +33 -0
- package/src/components/display-schema-tree/index.tsx +6 -4
- package/src/components/index.ts +5 -0
- package/src/components/json-editor-with-variables/editor.tsx +4 -4
- package/src/components/prompt-editor-with-inputs/editor.tsx +2 -3
- package/src/components/prompt-editor-with-variables/editor.tsx +3 -5
- package/src/components/type-selector/index.tsx +2 -3
- package/src/components/variable-selector/index.tsx +4 -2
- package/src/components/variable-selector/use-variable-tree.tsx +7 -4
- package/src/index.ts +3 -0
- package/src/plugins/json-schema-preset/index.tsx +4 -20
- package/src/plugins/json-schema-preset/react.tsx +28 -0
- package/src/shared/inject-material/index.tsx +10 -6
- package/src/validate/validate-flow-value/index.tsx +1 -2
- package/dist/cjs/components/json-editor-with-variables/extensions/variable-tree.js +0 -97
- package/dist/cjs/components/prompt-editor-with-inputs/extensions/inputs-tree.js +0 -101
- package/dist/cjs/components/prompt-editor-with-variables/extensions/variable-tag.js +0 -151
- package/dist/cjs/components/prompt-editor-with-variables/styles.js +0 -89
- package/dist/esm/components/json-editor-with-variables/extensions/variable-tree.mjs +0 -63
- package/dist/esm/components/prompt-editor-with-inputs/extensions/inputs-tree.mjs +0 -67
- package/dist/esm/components/prompt-editor-with-inputs/inputs-picker.mjs +0 -70
- package/dist/esm/components/prompt-editor-with-variables/extensions/variable-tag.mjs +0 -117
- package/dist/esm/components/prompt-editor-with-variables/styles.mjs +0 -36
- package/dist/types/components/json-editor-with-variables/extensions/variable-tree.d.ts +0 -6
- package/dist/types/components/prompt-editor-with-inputs/extensions/inputs-tree.d.ts +0 -9
- package/dist/types/components/prompt-editor-with-variables/extensions/variable-tag.d.ts +0 -5
- package/dist/types/components/prompt-editor-with-variables/styles.d.ts +0 -9
- package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +0 -83
- package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +0 -94
- package/src/components/prompt-editor-with-variables/extensions/variable-tag.tsx +0 -174
- package/src/components/prompt-editor-with-variables/styles.tsx +0 -44
- /package/dist/cjs/components/{json-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.js +0 -0
- /package/dist/cjs/components/{json-editor-with-variables → coze-editor-extensions}/styles.js +0 -0
- /package/dist/esm/components/{json-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.mjs +0 -0
- /package/dist/esm/components/{json-editor-with-variables → coze-editor-extensions}/styles.mjs +0 -0
- /package/dist/types/components/{json-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.d.ts +0 -0
- /package/dist/types/components/{json-editor-with-variables → coze-editor-extensions}/styles.d.ts +0 -0
- /package/src/components/{json-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.tsx +0 -0
- /package/src/components/{json-editor-with-variables → coze-editor-extensions}/styles.tsx +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { isPlainObject, last } from "lodash-es";
|
|
4
|
+
import { ASTMatch, useScopeAvailable } from "@flowgram.ai/editor";
|
|
5
|
+
import { Mention, PositionMirror, getCurrentMentionReplaceRange, useEditor } from "@flowgram.ai/coze-editor/react";
|
|
6
|
+
import { Popover, Tree } from "@douyinfe/semi-ui";
|
|
7
|
+
import { FlowValueUtils } from "../../../shared/index.mjs";
|
|
8
|
+
function InputsPicker({ inputsValues, onSelect }) {
|
|
9
|
+
const available = useScopeAvailable();
|
|
10
|
+
const getArrayDrilldown = (type, depth = 1)=>{
|
|
11
|
+
if (ASTMatch.isArray(type.items)) return getArrayDrilldown(type.items, depth + 1);
|
|
12
|
+
return {
|
|
13
|
+
type: type.items,
|
|
14
|
+
depth: depth
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const renderVariable = (variable, keyPath)=>{
|
|
18
|
+
let type = variable?.type;
|
|
19
|
+
let children;
|
|
20
|
+
if (ASTMatch.isObject(type)) children = (type.properties || []).map((_property)=>renderVariable(_property, [
|
|
21
|
+
...keyPath,
|
|
22
|
+
_property.key
|
|
23
|
+
])).filter(Boolean);
|
|
24
|
+
if (ASTMatch.isArray(type)) {
|
|
25
|
+
const drilldown = getArrayDrilldown(type);
|
|
26
|
+
if (ASTMatch.isObject(drilldown.type)) children = (drilldown.type.properties || []).map((_property)=>renderVariable(_property, [
|
|
27
|
+
...keyPath,
|
|
28
|
+
...new Array(drilldown.depth).fill('[0]'),
|
|
29
|
+
_property.key
|
|
30
|
+
])).filter(Boolean);
|
|
31
|
+
}
|
|
32
|
+
const key = keyPath.map((_key, idx)=>'[0]' === _key || 0 === idx ? _key : `.${_key}`).join('');
|
|
33
|
+
return {
|
|
34
|
+
key: key,
|
|
35
|
+
label: last(keyPath),
|
|
36
|
+
value: key,
|
|
37
|
+
children
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const getTreeData = (value, keyPath)=>{
|
|
41
|
+
const currKey = keyPath.join('.');
|
|
42
|
+
if (FlowValueUtils.isFlowValue(value)) {
|
|
43
|
+
if (FlowValueUtils.isRef(value)) {
|
|
44
|
+
const variable = available.getByKeyPath(value.content || []);
|
|
45
|
+
if (variable) return renderVariable(variable, keyPath);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
key: currKey,
|
|
49
|
+
value: currKey,
|
|
50
|
+
label: last(keyPath)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (isPlainObject(value)) return {
|
|
54
|
+
key: currKey,
|
|
55
|
+
value: currKey,
|
|
56
|
+
label: last(keyPath),
|
|
57
|
+
children: Object.entries(value).map(([key, value])=>getTreeData(value, [
|
|
58
|
+
...keyPath,
|
|
59
|
+
key
|
|
60
|
+
])).filter(Boolean)
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const treeData = useMemo(()=>Object.entries(inputsValues).map(([key, value])=>getTreeData(value, [
|
|
64
|
+
key
|
|
65
|
+
])).filter(Boolean), []);
|
|
66
|
+
return /*#__PURE__*/ jsx(Tree, {
|
|
67
|
+
treeData: treeData,
|
|
68
|
+
onSelect: (v)=>onSelect(v)
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const DEFAULT_TRIGGER_CHARACTERS = [
|
|
72
|
+
'{',
|
|
73
|
+
'{}',
|
|
74
|
+
'@'
|
|
75
|
+
];
|
|
76
|
+
function InputsTree({ inputsValues, triggerCharacters = DEFAULT_TRIGGER_CHARACTERS }) {
|
|
77
|
+
const [posKey, setPosKey] = useState('');
|
|
78
|
+
const [visible, setVisible] = useState(false);
|
|
79
|
+
const [position, setPosition] = useState(-1);
|
|
80
|
+
const editor = useEditor();
|
|
81
|
+
function insert(variablePath) {
|
|
82
|
+
const range = getCurrentMentionReplaceRange(editor.$view.state);
|
|
83
|
+
if (!range) return;
|
|
84
|
+
let { from, to } = range;
|
|
85
|
+
while('{' === editor.$view.state.doc.sliceString(from - 1, from))from--;
|
|
86
|
+
while('}' === editor.$view.state.doc.sliceString(to, to + 1))to++;
|
|
87
|
+
editor.replaceText({
|
|
88
|
+
...range,
|
|
89
|
+
text: '{{' + variablePath + '}}'
|
|
90
|
+
});
|
|
91
|
+
setVisible(false);
|
|
92
|
+
}
|
|
93
|
+
function handleOpenChange(e) {
|
|
94
|
+
setPosition(e.state.selection.main.head);
|
|
95
|
+
setVisible(e.value);
|
|
96
|
+
}
|
|
97
|
+
useEffect(()=>{
|
|
98
|
+
if (!editor) return;
|
|
99
|
+
}, [
|
|
100
|
+
editor,
|
|
101
|
+
visible
|
|
102
|
+
]);
|
|
103
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
104
|
+
children: [
|
|
105
|
+
/*#__PURE__*/ jsx(Mention, {
|
|
106
|
+
triggerCharacters: triggerCharacters,
|
|
107
|
+
onOpenChange: handleOpenChange
|
|
108
|
+
}),
|
|
109
|
+
/*#__PURE__*/ jsx(Popover, {
|
|
110
|
+
visible: visible,
|
|
111
|
+
trigger: "custom",
|
|
112
|
+
position: "topLeft",
|
|
113
|
+
rePosKey: posKey,
|
|
114
|
+
content: /*#__PURE__*/ jsx("div", {
|
|
115
|
+
style: {
|
|
116
|
+
width: 300,
|
|
117
|
+
maxHeight: 300,
|
|
118
|
+
overflowY: 'auto'
|
|
119
|
+
},
|
|
120
|
+
children: /*#__PURE__*/ jsx(InputsPicker, {
|
|
121
|
+
inputsValues: inputsValues,
|
|
122
|
+
onSelect: (v)=>{
|
|
123
|
+
insert(v);
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
}),
|
|
127
|
+
children: /*#__PURE__*/ jsx(PositionMirror, {
|
|
128
|
+
position: position,
|
|
129
|
+
onChange: ()=>setPosKey(String(Math.random()))
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
export { InputsPicker, InputsTree };
|
|
@@ -3,7 +3,12 @@ import { useEffect, useState } from "react";
|
|
|
3
3
|
import { Mention, PositionMirror, getCurrentMentionReplaceRange, useEditor } from "@flowgram.ai/coze-editor/react";
|
|
4
4
|
import { Popover, Tree } from "@douyinfe/semi-ui";
|
|
5
5
|
import { useVariableTree } from "../../variable-selector/index.mjs";
|
|
6
|
-
|
|
6
|
+
const DEFAULT_TRIGGER_CHARACTER = [
|
|
7
|
+
'{',
|
|
8
|
+
'{}',
|
|
9
|
+
'@'
|
|
10
|
+
];
|
|
11
|
+
function VariableTree({ triggerCharacters = DEFAULT_TRIGGER_CHARACTER }) {
|
|
7
12
|
const [posKey, setPosKey] = useState('');
|
|
8
13
|
const [visible, setVisible] = useState(false);
|
|
9
14
|
const [position, setPosition] = useState(-1);
|
|
@@ -35,11 +40,7 @@ function VariableTree() {
|
|
|
35
40
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
36
41
|
children: [
|
|
37
42
|
/*#__PURE__*/ jsx(Mention, {
|
|
38
|
-
triggerCharacters:
|
|
39
|
-
'{',
|
|
40
|
-
'{}',
|
|
41
|
-
'@'
|
|
42
|
-
],
|
|
43
|
+
triggerCharacters: triggerCharacters,
|
|
43
44
|
onOpenChange: handleOpenChange
|
|
44
45
|
}),
|
|
45
46
|
/*#__PURE__*/ jsx(Popover, {
|
|
@@ -49,7 +50,9 @@ function VariableTree() {
|
|
|
49
50
|
rePosKey: posKey,
|
|
50
51
|
content: /*#__PURE__*/ jsx("div", {
|
|
51
52
|
style: {
|
|
52
|
-
width: 300
|
|
53
|
+
width: 300,
|
|
54
|
+
maxHeight: 300,
|
|
55
|
+
overflowY: 'auto'
|
|
53
56
|
},
|
|
54
57
|
children: /*#__PURE__*/ jsx(Tree, {
|
|
55
58
|
treeData: treeData,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { lazy } from "react";
|
|
2
|
+
import { createInjectMaterial } from "../../shared/index.mjs";
|
|
3
|
+
const EditorVariableTree = createInjectMaterial(/*#__PURE__*/ lazy(()=>import("./extensions/variable-tree.mjs").then((module)=>({
|
|
4
|
+
default: module.VariableTree
|
|
5
|
+
}))), {
|
|
6
|
+
renderKey: 'EditorVariableTree'
|
|
7
|
+
});
|
|
8
|
+
const EditorVariableTagInject = createInjectMaterial(/*#__PURE__*/ lazy(()=>import("./extensions/variable-tag.mjs").then((module)=>({
|
|
9
|
+
default: module.VariableTagInject
|
|
10
|
+
}))), {
|
|
11
|
+
renderKey: 'EditorVariableTagInject'
|
|
12
|
+
});
|
|
13
|
+
const EditorInputsTree = createInjectMaterial(/*#__PURE__*/ lazy(()=>import("./extensions/inputs-tree.mjs").then((module)=>({
|
|
14
|
+
default: module.InputsTree
|
|
15
|
+
}))), {
|
|
16
|
+
renderKey: 'EditorInputsTree'
|
|
17
|
+
});
|
|
18
|
+
export { EditorInputsTree, EditorVariableTagInject, EditorVariableTree };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import react from "react";
|
|
3
|
-
import { useTypeManager } from "
|
|
3
|
+
import { useTypeManager } from "@flowgram.ai/json-schema";
|
|
4
4
|
import { HorizontalLine, TreeItem, TreeLevel, TreeRow, TreeTitle } from "./styles.mjs";
|
|
5
5
|
function DisplaySchemaTree(props) {
|
|
6
6
|
return /*#__PURE__*/ jsx(SchemaTree, {
|
|
@@ -7,6 +7,7 @@ import { CodeEditor } from "./code-editor/index.mjs";
|
|
|
7
7
|
import { CodeEditorMini } from "./code-editor-mini/index.mjs";
|
|
8
8
|
import { ConditionRow } from "./condition-row/index.mjs";
|
|
9
9
|
import { ConstantInput } from "./constant-input/index.mjs";
|
|
10
|
+
import { EditorInputsTree, EditorVariableTagInject, EditorVariableTree } from "./coze-editor-extensions/index.mjs";
|
|
10
11
|
import { DBConditionRow } from "./db-condition-row/index.mjs";
|
|
11
12
|
import { DisplayFlowValue } from "./display-flow-value/index.mjs";
|
|
12
13
|
import { DisplayInputsValueAllInTag, DisplayInputsValues } from "./display-inputs-values/index.mjs";
|
|
@@ -23,4 +24,4 @@ import { PromptEditorWithInputs } from "./prompt-editor-with-inputs/index.mjs";
|
|
|
23
24
|
import { PromptEditorWithVariables } from "./prompt-editor-with-variables/index.mjs";
|
|
24
25
|
import { InjectTypeSelector, TypeSelector, getTypeSelectValue, parseTypeSelectValue } from "./type-selector/index.mjs";
|
|
25
26
|
import { InjectVariableSelector, VariableSelector, VariableSelectorProvider, useVariableTree } from "./variable-selector/index.mjs";
|
|
26
|
-
export { AssignRow, AssignRows, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonEditorWithVariables, JsonSchemaEditor, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, VariableSelectorProvider, getTypeSelectValue, parseTypeSelectValue, useVariableTree };
|
|
27
|
+
export { AssignRow, AssignRows, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, EditorInputsTree, EditorVariableTagInject, EditorVariableTree, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonEditorWithVariables, JsonSchemaEditor, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, VariableSelectorProvider, getTypeSelectValue, parseTypeSelectValue, useVariableTree };
|
|
@@ -2,9 +2,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import { I18n } from "@flowgram.ai/editor";
|
|
4
4
|
import { transformerCreator } from "@flowgram.ai/coze-editor/preset-code";
|
|
5
|
+
import { EditorVariableTagInject, EditorVariableTree } from "../coze-editor-extensions/index.mjs";
|
|
5
6
|
import { CodeEditor } from "../code-editor/index.mjs";
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const TRIGGER_CHARACTERS = [
|
|
8
|
+
'@'
|
|
9
|
+
];
|
|
8
10
|
function findAllMatches(inputString, regex) {
|
|
9
11
|
const globalRegex = new RegExp(regex, regex.flags.includes('g') ? regex.flags : regex.flags + 'g');
|
|
10
12
|
let match;
|
|
@@ -39,8 +41,10 @@ function JsonEditorWithVariables(props) {
|
|
|
39
41
|
...props.options || {}
|
|
40
42
|
},
|
|
41
43
|
children: [
|
|
42
|
-
/*#__PURE__*/ jsx(
|
|
43
|
-
|
|
44
|
+
/*#__PURE__*/ jsx(EditorVariableTree, {
|
|
45
|
+
triggerCharacters: TRIGGER_CHARACTERS
|
|
46
|
+
}),
|
|
47
|
+
/*#__PURE__*/ jsx(EditorVariableTagInject, {})
|
|
44
48
|
]
|
|
45
49
|
});
|
|
46
50
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { PromptEditor } from "../prompt-editor/index.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { EditorInputsTree } from "../coze-editor-extensions/index.mjs";
|
|
5
5
|
function PromptEditorWithInputs({ inputsValues, ...restProps }) {
|
|
6
6
|
return /*#__PURE__*/ jsx(PromptEditor, {
|
|
7
7
|
...restProps,
|
|
8
|
-
children: /*#__PURE__*/ jsx(
|
|
8
|
+
children: /*#__PURE__*/ jsx(EditorInputsTree, {
|
|
9
9
|
inputsValues: inputsValues
|
|
10
10
|
})
|
|
11
11
|
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { PromptEditor } from "../prompt-editor/index.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { VariableTagInject } from "./extensions/variable-tag.mjs";
|
|
4
|
+
import { EditorVariableTagInject, EditorVariableTree } from "../coze-editor-extensions/index.mjs";
|
|
6
5
|
function PromptEditorWithVariables(props) {
|
|
7
6
|
return /*#__PURE__*/ jsxs(PromptEditor, {
|
|
8
7
|
...props,
|
|
9
8
|
children: [
|
|
10
|
-
/*#__PURE__*/ jsx(
|
|
11
|
-
/*#__PURE__*/ jsx(
|
|
9
|
+
/*#__PURE__*/ jsx(EditorVariableTree, {}),
|
|
10
|
+
/*#__PURE__*/ jsx(EditorVariableTagInject, {})
|
|
12
11
|
]
|
|
13
12
|
});
|
|
14
13
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
+
import { useTypeManager } from "@flowgram.ai/json-schema";
|
|
3
4
|
import { Cascader, Icon, IconButton } from "@douyinfe/semi-ui";
|
|
4
5
|
import { createInjectMaterial } from "../../shared/inject-material/index.mjs";
|
|
5
|
-
import { useTypeManager } from "../../plugins/index.mjs";
|
|
6
6
|
const labelStyle = {
|
|
7
7
|
display: 'flex',
|
|
8
8
|
alignItems: 'center',
|
|
@@ -34,6 +34,7 @@ const VariableSelector = ({ value, config = {}, onChange, style, readonly = fals
|
|
|
34
34
|
});
|
|
35
35
|
return icon;
|
|
36
36
|
};
|
|
37
|
+
console.log('debugger treeValue', treeValue);
|
|
37
38
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
38
39
|
children: /*#__PURE__*/ jsx(UITreeSelect, {
|
|
39
40
|
dropdownMatchSelectWidth: false,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { JsonSchemaUtils } from "@flowgram.ai/json-schema";
|
|
3
|
+
import { JsonSchemaUtils, useTypeManager } from "@flowgram.ai/json-schema";
|
|
4
4
|
import { ASTMatch, useAvailableVariables } from "@flowgram.ai/editor";
|
|
5
5
|
import { Icon } from "@douyinfe/semi-ui";
|
|
6
|
-
import { useTypeManager } from "../../plugins/index.mjs";
|
|
7
6
|
function useVariableTree(params) {
|
|
8
7
|
const { includeSchema, excludeSchema, skipVariable } = params;
|
|
9
8
|
const typeManager = useTypeManager();
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AssignRow, AssignRows, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonEditorWithVariables, JsonSchemaEditor, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, VariableSelectorProvider, getTypeSelectValue, parseTypeSelectValue, useVariableTree } from "./components/index.mjs";
|
|
1
|
+
import { AssignRow, AssignRows, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, EditorInputsTree, EditorVariableTagInject, EditorVariableTree, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonEditorWithVariables, JsonSchemaEditor, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, VariableSelectorProvider, getTypeSelectValue, parseTypeSelectValue, useVariableTree } from "./components/index.mjs";
|
|
2
2
|
import { autoRenameRefEffect, listenRefSchemaChange, listenRefValueChange, provideBatchInputEffect, provideJsonSchemaOutputs, syncVariableTitle, validateWhenVariableSync } from "./effects/index.mjs";
|
|
3
3
|
import { createBatchOutputsFormPlugin, createInferAssignPlugin, createInferInputsPlugin, provideBatchOutputsEffect } from "./form-plugins/index.mjs";
|
|
4
4
|
import { useObjectList } from "./hooks/index.mjs";
|
|
5
5
|
import { JsonSchemaTypePresetProvider, JsonSchemaUtils, createDisableDeclarationPlugin, createTypePresetPlugin, useTypeManager } from "./plugins/index.mjs";
|
|
6
6
|
import { FlowValueUtils, createInjectMaterial, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, lazySuspense, polyfillCreateRoot, unstableSetCreateRoot, withSuspense } from "./shared/index.mjs";
|
|
7
7
|
import { validateFlowValue } from "./validate/index.mjs";
|
|
8
|
-
export { AssignRow, AssignRows, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, FlowValueUtils, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonEditorWithVariables, JsonSchemaEditor, JsonSchemaTypePresetProvider, JsonSchemaUtils, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, VariableSelectorProvider, autoRenameRefEffect, createBatchOutputsFormPlugin, createDisableDeclarationPlugin, createInferAssignPlugin, createInferInputsPlugin, createInjectMaterial, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, lazySuspense, listenRefSchemaChange, listenRefValueChange, parseTypeSelectValue, polyfillCreateRoot, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, unstableSetCreateRoot, useObjectList, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync, withSuspense };
|
|
8
|
+
export { AssignRow, AssignRows, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, EditorInputsTree, EditorVariableTagInject, EditorVariableTree, FlowValueUtils, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonEditorWithVariables, JsonSchemaEditor, JsonSchemaTypePresetProvider, JsonSchemaUtils, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, VariableSelectorProvider, autoRenameRefEffect, createBatchOutputsFormPlugin, createDisableDeclarationPlugin, createInferAssignPlugin, createInferInputsPlugin, createInjectMaterial, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, lazySuspense, listenRefSchemaChange, listenRefValueChange, parseTypeSelectValue, polyfillCreateRoot, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, unstableSetCreateRoot, useObjectList, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync, withSuspense };
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "react";
|
|
3
|
-
import { JsonSchemaUtils, TypePresetProvider, useTypeManager } from "@flowgram.ai/json-schema";
|
|
4
|
-
import { jsonSchemaTypePreset } from "./type-definition/index.mjs";
|
|
1
|
+
import { JsonSchemaUtils } from "@flowgram.ai/json-schema";
|
|
2
|
+
import { JsonSchemaTypePresetProvider, useTypeManager } from "./react.mjs";
|
|
5
3
|
import { createTypePresetPlugin } from "./create-type-preset-plugin.mjs";
|
|
6
|
-
|
|
7
|
-
const JsonSchemaTypePresetProvider = ({ types = [], children })=>/*#__PURE__*/ jsx(TypePresetProvider, {
|
|
8
|
-
types: [
|
|
9
|
-
...jsonSchemaTypePreset,
|
|
10
|
-
...types
|
|
11
|
-
],
|
|
12
|
-
children: children
|
|
13
|
-
});
|
|
14
|
-
export { JsonSchemaTypePresetProvider, JsonSchemaUtils, createTypePresetPlugin, json_schema_preset_useTypeManager as useTypeManager };
|
|
4
|
+
export { JsonSchemaTypePresetProvider, JsonSchemaUtils, createTypePresetPlugin, useTypeManager };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { TypePresetProvider, useTypeManager } from "@flowgram.ai/json-schema";
|
|
4
|
+
import { jsonSchemaTypePreset } from "./type-definition/index.mjs";
|
|
5
|
+
const react_useTypeManager = ()=>useTypeManager();
|
|
6
|
+
const JsonSchemaTypePresetProvider = ({ types = [], children })=>/*#__PURE__*/ jsx(TypePresetProvider, {
|
|
7
|
+
types: [
|
|
8
|
+
...jsonSchemaTypePreset,
|
|
9
|
+
...types
|
|
10
|
+
],
|
|
11
|
+
children: children
|
|
12
|
+
});
|
|
13
|
+
export { JsonSchemaTypePresetProvider, react_useTypeManager as useTypeManager };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { FlowRendererComponentType, FlowRendererRegistry, usePlaygroundContainer } from "@flowgram.ai/editor";
|
|
3
3
|
function createInjectMaterial(Component, params) {
|
|
4
|
+
const renderKey = params?.renderKey || Component.renderKey || Component.name || '';
|
|
4
5
|
const InjectComponent = (props)=>{
|
|
5
6
|
const container = usePlaygroundContainer();
|
|
6
7
|
if (!container?.isBound(FlowRendererRegistry)) return /*#__PURE__*/ react.createElement(Component, {
|
|
7
8
|
...props
|
|
8
9
|
});
|
|
9
10
|
const rendererRegistry = container.get(FlowRendererRegistry);
|
|
10
|
-
const renderKey = params?.renderKey || Component.renderKey || Component.name || '';
|
|
11
11
|
const renderer = rendererRegistry.tryToGetRendererComponent(renderKey);
|
|
12
12
|
if (renderer?.type !== FlowRendererComponentType.REACT) return /*#__PURE__*/ react.createElement(Component, {
|
|
13
13
|
...props
|
|
@@ -16,6 +16,7 @@ function createInjectMaterial(Component, params) {
|
|
|
16
16
|
...props
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
|
+
InjectComponent.renderKey = renderKey;
|
|
19
20
|
return InjectComponent;
|
|
20
21
|
}
|
|
21
22
|
export { createInjectMaterial };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/components/index.ts","../src/components/assign-row/index.tsx","../src/components/assign-row/types.ts","../src/components/assign-rows/index.tsx","../src/components/batch-outputs/index.tsx","../src/components/batch-outputs/styles.tsx","../src/components/batch-outputs/types.ts","../src/components/batch-variable-selector/index.tsx","../src/components/blur-input/index.tsx","../src/components/code-editor/editor.tsx","../src/components/code-editor/index.tsx","../src/components/code-editor/init-worker.ts","../src/components/code-editor/language-features.ts","../src/components/code-editor/utils.ts","../src/components/code-editor/theme/dark.ts","../src/components/code-editor/theme/index.ts","../src/components/code-editor/theme/light.ts","../src/components/code-editor-mini/index.tsx","../src/components/condition-row/constants.ts","../src/components/condition-row/index.tsx","../src/components/condition-row/styles.tsx","../src/components/condition-row/types.ts","../src/components/condition-row/hooks/useOp.tsx","../src/components/condition-row/hooks/useRule.ts","../src/components/constant-input/index.tsx","../src/components/constant-input/types.ts","../src/components/db-condition-row/index.tsx","../src/components/db-condition-row/styles.tsx","../src/components/db-condition-row/types.ts","../src/components/db-condition-row/hooks/use-left.tsx","../src/components/db-condition-row/hooks/use-op.tsx","../src/components/display-flow-value/index.tsx","../src/components/display-inputs-values/index.tsx","../src/components/display-inputs-values/styles.ts","../src/components/display-outputs/index.tsx","../src/components/display-outputs/styles.ts","../src/components/display-schema-tag/index.tsx","../src/components/display-schema-tag/styles.ts","../src/components/display-schema-tree/index.tsx","../src/components/display-schema-tree/styles.tsx","../src/components/dynamic-value-input/hooks.ts","../src/components/dynamic-value-input/index.tsx","../src/components/dynamic-value-input/styles.tsx","../src/components/inputs-values/index.tsx","../src/components/inputs-values/styles.tsx","../src/components/inputs-values/types.ts","../src/components/inputs-values-tree/index.tsx","../src/components/inputs-values-tree/row.tsx","../src/components/inputs-values-tree/styles.tsx","../src/components/inputs-values-tree/types.ts","../src/components/inputs-values-tree/hooks/use-child-list.tsx","../src/components/json-editor-with-variables/editor.tsx","../src/components/json-editor-with-variables/index.tsx","../src/components/json-
|
|
1
|
+
{"root":["../src/index.ts","../src/components/index.ts","../src/components/assign-row/index.tsx","../src/components/assign-row/types.ts","../src/components/assign-rows/index.tsx","../src/components/batch-outputs/index.tsx","../src/components/batch-outputs/styles.tsx","../src/components/batch-outputs/types.ts","../src/components/batch-variable-selector/index.tsx","../src/components/blur-input/index.tsx","../src/components/code-editor/editor.tsx","../src/components/code-editor/index.tsx","../src/components/code-editor/init-worker.ts","../src/components/code-editor/language-features.ts","../src/components/code-editor/utils.ts","../src/components/code-editor/theme/dark.ts","../src/components/code-editor/theme/index.ts","../src/components/code-editor/theme/light.ts","../src/components/code-editor-mini/index.tsx","../src/components/condition-row/constants.ts","../src/components/condition-row/index.tsx","../src/components/condition-row/styles.tsx","../src/components/condition-row/types.ts","../src/components/condition-row/hooks/useOp.tsx","../src/components/condition-row/hooks/useRule.ts","../src/components/constant-input/index.tsx","../src/components/constant-input/types.ts","../src/components/coze-editor-extensions/index.tsx","../src/components/coze-editor-extensions/styles.tsx","../src/components/coze-editor-extensions/extensions/inputs-tree.tsx","../src/components/coze-editor-extensions/extensions/variable-tag.tsx","../src/components/coze-editor-extensions/extensions/variable-tree.tsx","../src/components/db-condition-row/index.tsx","../src/components/db-condition-row/styles.tsx","../src/components/db-condition-row/types.ts","../src/components/db-condition-row/hooks/use-left.tsx","../src/components/db-condition-row/hooks/use-op.tsx","../src/components/display-flow-value/index.tsx","../src/components/display-inputs-values/index.tsx","../src/components/display-inputs-values/styles.ts","../src/components/display-outputs/index.tsx","../src/components/display-outputs/styles.ts","../src/components/display-schema-tag/index.tsx","../src/components/display-schema-tag/styles.ts","../src/components/display-schema-tree/index.tsx","../src/components/display-schema-tree/styles.tsx","../src/components/dynamic-value-input/hooks.ts","../src/components/dynamic-value-input/index.tsx","../src/components/dynamic-value-input/styles.tsx","../src/components/inputs-values/index.tsx","../src/components/inputs-values/styles.tsx","../src/components/inputs-values/types.ts","../src/components/inputs-values-tree/index.tsx","../src/components/inputs-values-tree/row.tsx","../src/components/inputs-values-tree/styles.tsx","../src/components/inputs-values-tree/types.ts","../src/components/inputs-values-tree/hooks/use-child-list.tsx","../src/components/json-editor-with-variables/editor.tsx","../src/components/json-editor-with-variables/index.tsx","../src/components/json-schema-editor/default-value.tsx","../src/components/json-schema-editor/hooks.tsx","../src/components/json-schema-editor/index.tsx","../src/components/json-schema-editor/styles.tsx","../src/components/json-schema-editor/types.ts","../src/components/prompt-editor/editor.tsx","../src/components/prompt-editor/index.tsx","../src/components/prompt-editor/styles.tsx","../src/components/prompt-editor/types.tsx","../src/components/prompt-editor/extensions/jinja.tsx","../src/components/prompt-editor/extensions/language-support.tsx","../src/components/prompt-editor/extensions/markdown.tsx","../src/components/prompt-editor-with-inputs/editor.tsx","../src/components/prompt-editor-with-inputs/index.tsx","../src/components/prompt-editor-with-variables/editor.tsx","../src/components/prompt-editor-with-variables/index.tsx","../src/components/type-selector/index.tsx","../src/components/variable-selector/context.tsx","../src/components/variable-selector/index.tsx","../src/components/variable-selector/styles.tsx","../src/components/variable-selector/use-variable-tree.tsx","../src/effects/index.ts","../src/effects/auto-rename-ref/index.ts","../src/effects/listen-ref-schema-change/index.ts","../src/effects/listen-ref-value-change/index.ts","../src/effects/provide-batch-input/index.ts","../src/effects/provide-json-schema-outputs/index.ts","../src/effects/sync-variable-title/index.ts","../src/effects/validate-when-variable-sync/index.ts","../src/form-plugins/index.ts","../src/form-plugins/batch-outputs-plugin/index.ts","../src/form-plugins/infer-assign-plugin/index.ts","../src/form-plugins/infer-inputs-plugin/index.ts","../src/hooks/index.ts","../src/hooks/use-object-list/index.tsx","../src/plugins/index.ts","../src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts","../src/plugins/disable-declaration-plugin/index.tsx","../src/plugins/json-schema-preset/create-type-preset-plugin.tsx","../src/plugins/json-schema-preset/index.tsx","../src/plugins/json-schema-preset/manager.ts","../src/plugins/json-schema-preset/react.tsx","../src/plugins/json-schema-preset/type-definition/array.tsx","../src/plugins/json-schema-preset/type-definition/boolean.tsx","../src/plugins/json-schema-preset/type-definition/date-time.tsx","../src/plugins/json-schema-preset/type-definition/index.tsx","../src/plugins/json-schema-preset/type-definition/integer.tsx","../src/plugins/json-schema-preset/type-definition/number.tsx","../src/plugins/json-schema-preset/type-definition/object.tsx","../src/plugins/json-schema-preset/type-definition/string.tsx","../src/shared/index.ts","../src/shared/flow-value/index.ts","../src/shared/flow-value/schema.ts","../src/shared/flow-value/types.ts","../src/shared/flow-value/utils.ts","../src/shared/format-legacy-refs/index.ts","../src/shared/inject-material/index.tsx","../src/shared/lazy-suspense/index.tsx","../src/shared/polyfill-create-root/index.tsx","../src/validate/index.ts","../src/validate/validate-flow-value/index.tsx"],"version":"5.8.3"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
1
5
|
/**
|
|
2
6
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
7
|
* SPDX-License-Identifier: MIT
|
|
4
8
|
*/
|
|
5
9
|
import React from 'react';
|
|
6
|
-
import {
|
|
10
|
+
import { Input } from '@douyinfe/semi-ui';
|
|
11
|
+
type InputProps = React.ComponentPropsWithoutRef<typeof Input>;
|
|
7
12
|
export declare function BlurInput(props: InputProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import { IFlowValue } from '../../../shared';
|
|
6
7
|
export declare function InputsPicker({ inputsValues, onSelect, }: {
|
|
7
8
|
inputsValues: any;
|
|
8
9
|
onSelect: (v: string) => void;
|
|
9
10
|
}): React.JSX.Element;
|
|
11
|
+
export declare function InputsTree({ inputsValues, triggerCharacters, }: {
|
|
12
|
+
inputsValues: Record<string, IFlowValue>;
|
|
13
|
+
triggerCharacters?: string[];
|
|
14
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
export declare const EditorVariableTree: import("react").FC<{
|
|
6
|
+
triggerCharacters?: string[];
|
|
7
|
+
}> & {
|
|
8
|
+
renderKey?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const EditorVariableTagInject: import("react").FC<unknown> & {
|
|
11
|
+
renderKey?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const EditorInputsTree: import("react").FC<{
|
|
14
|
+
inputsValues: Record<string, import("../../shared").IFlowValue>;
|
|
15
|
+
triggerCharacters?: string[];
|
|
16
|
+
}> & {
|
|
17
|
+
renderKey?: string;
|
|
18
|
+
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { IJsonSchema, JsonSchemaTypeManager } from '@flowgram.ai/json-schema';
|
|
6
|
+
import { type IJsonSchema, type JsonSchemaTypeManager } from '@flowgram.ai/json-schema';
|
|
7
7
|
interface PropsType {
|
|
8
8
|
value?: IJsonSchema;
|
|
9
9
|
parentKey?: string;
|
|
@@ -23,5 +23,7 @@ export declare function DynamicValueInput({ value, onChange, readonly, style, sc
|
|
|
23
23
|
export declare namespace DynamicValueInput {
|
|
24
24
|
var renderKey: string;
|
|
25
25
|
}
|
|
26
|
-
export declare const InjectDynamicValueInput: React.FC<PropsType
|
|
26
|
+
export declare const InjectDynamicValueInput: React.FC<PropsType> & {
|
|
27
|
+
renderKey?: string;
|
|
28
|
+
};
|
|
27
29
|
export {};
|
|
@@ -11,6 +11,7 @@ export { CodeEditor, type CodeEditorPropsType } from './code-editor';
|
|
|
11
11
|
export { CodeEditorMini } from './code-editor-mini';
|
|
12
12
|
export { ConditionRow, type ConditionRowValueType } from './condition-row';
|
|
13
13
|
export { ConstantInput, type ConstantInputStrategy } from './constant-input';
|
|
14
|
+
export { EditorVariableTagInject, EditorVariableTree, EditorInputsTree, } from './coze-editor-extensions';
|
|
14
15
|
export { DBConditionRow, type DBConditionOptionType, type DBConditionRowValueType, } from './db-condition-row';
|
|
15
16
|
export { DisplayFlowValue } from './display-flow-value';
|
|
16
17
|
export { DisplayInputsValueAllInTag, DisplayInputsValues } from './display-inputs-values';
|
|
@@ -20,4 +20,6 @@ export declare function TypeSelector(props: TypeSelectorProps): React.JSX.Elemen
|
|
|
20
20
|
export declare namespace TypeSelector {
|
|
21
21
|
var renderKey: string;
|
|
22
22
|
}
|
|
23
|
-
export declare const InjectTypeSelector: React.FC<TypeSelectorProps
|
|
23
|
+
export declare const InjectTypeSelector: React.FC<TypeSelectorProps> & {
|
|
24
|
+
renderKey?: string;
|
|
25
|
+
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { IJsonSchema } from '@flowgram.ai/json-schema';
|
|
7
|
-
import { TriggerRenderProps } from '@douyinfe/semi-ui/lib/es/treeSelect';
|
|
7
|
+
import { type TriggerRenderProps } from '@douyinfe/semi-ui/lib/es/treeSelect';
|
|
8
8
|
import { useVariableTree } from './use-variable-tree';
|
|
9
9
|
export interface VariableSelectorProps {
|
|
10
10
|
value?: string[];
|
|
@@ -25,5 +25,7 @@ export declare const VariableSelector: {
|
|
|
25
25
|
({ value, config, onChange, style, readonly, includeSchema, excludeSchema, hasError, triggerRender, }: VariableSelectorProps): React.JSX.Element;
|
|
26
26
|
renderKey: string;
|
|
27
27
|
};
|
|
28
|
-
export declare const InjectVariableSelector: React.FC<VariableSelectorProps
|
|
28
|
+
export declare const InjectVariableSelector: React.FC<VariableSelectorProps> & {
|
|
29
|
+
renderKey?: string;
|
|
30
|
+
};
|
|
29
31
|
export { VariableSelectorProvider } from './context';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
|
-
export { AssignRow, AssignRows, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonEditorWithVariables, JsonSchemaEditor, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, VariableSelectorProvider, getTypeSelectValue, parseTypeSelectValue, type AssignValueType, type CodeEditorPropsType, type ConditionRowValueType, type ConstantInputStrategy, type DBConditionOptionType, type DBConditionRowValueType, type JsonEditorWithVariablesProps, type PromptEditorPropsType, type PromptEditorWithInputsProps, type PromptEditorWithVariablesProps, type TypeSelectorProps, type VariableSelectorProps, useVariableTree, } from './components';
|
|
5
|
+
export { AssignRow, AssignRows, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonEditorWithVariables, JsonSchemaEditor, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, VariableSelectorProvider, EditorVariableTagInject, EditorVariableTree, EditorInputsTree, getTypeSelectValue, parseTypeSelectValue, type AssignValueType, type CodeEditorPropsType, type ConditionRowValueType, type ConstantInputStrategy, type DBConditionOptionType, type DBConditionRowValueType, type JsonEditorWithVariablesProps, type PromptEditorPropsType, type PromptEditorWithInputsProps, type PromptEditorWithVariablesProps, type TypeSelectorProps, type VariableSelectorProps, useVariableTree, } from './components';
|
|
6
6
|
export { autoRenameRefEffect, listenRefSchemaChange, listenRefValueChange, provideBatchInputEffect, provideJsonSchemaOutputs, syncVariableTitle, validateWhenVariableSync, } from './effects';
|
|
7
7
|
export { createBatchOutputsFormPlugin, createInferAssignPlugin, createInferInputsPlugin, provideBatchOutputsEffect, } from './form-plugins';
|
|
8
8
|
export { useObjectList } from './hooks';
|
|
@@ -2,12 +2,8 @@
|
|
|
2
2
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { type JsonSchemaBasicType, JsonSchemaUtils, type IJsonSchema } from '@flowgram.ai/json-schema';
|
|
6
|
+
import { useTypeManager, JsonSchemaTypePresetProvider } from './react';
|
|
7
|
+
import { ConstantRendererProps, type JsonSchemaTypeRegistry } from './manager';
|
|
8
8
|
import { createTypePresetPlugin } from './create-type-preset-plugin';
|
|
9
|
-
declare const useTypeManager: () => JsonSchemaTypeManager<IJsonSchema, JsonSchemaTypeRegistry>;
|
|
10
|
-
declare const JsonSchemaTypePresetProvider: ({ types, children, }: React.PropsWithChildren<{
|
|
11
|
-
types: JsonSchemaTypeRegistry[];
|
|
12
|
-
}>) => React.JSX.Element;
|
|
13
9
|
export { createTypePresetPlugin, useTypeManager, JsonSchemaTypePresetProvider, JsonSchemaUtils, type IJsonSchema, type JsonSchemaTypeRegistry, type ConstantRendererProps, type JsonSchemaBasicType, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { type IJsonSchema, JsonSchemaTypeManager } from '@flowgram.ai/json-schema';
|
|
7
|
+
import { type JsonSchemaTypeRegistry } from './manager';
|
|
8
|
+
export declare const useTypeManager: () => JsonSchemaTypeManager<IJsonSchema, JsonSchemaTypeRegistry>;
|
|
9
|
+
export declare const JsonSchemaTypePresetProvider: ({ types, children, }: React.PropsWithChildren<{
|
|
10
|
+
types: JsonSchemaTypeRegistry[];
|
|
11
|
+
}>) => React.JSX.Element;
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
+
type WithRenderKey<T> = T & {
|
|
7
|
+
renderKey?: string;
|
|
8
|
+
};
|
|
6
9
|
/**
|
|
7
10
|
* Creates a material component wrapper with dependency injection support
|
|
8
11
|
*
|
|
@@ -39,8 +42,7 @@ import React from 'react';
|
|
|
39
42
|
* @param params.renderKey - Custom render key name, highest priority
|
|
40
43
|
* @returns Wrapper component with dependency injection support
|
|
41
44
|
*/
|
|
42
|
-
export declare function createInjectMaterial<Props>(Component: React.FC<Props>
|
|
43
|
-
renderKey?: string;
|
|
44
|
-
}, params?: {
|
|
45
|
+
export declare function createInjectMaterial<Props>(Component: WithRenderKey<React.FC<Props> | React.ExoticComponent<Props>>, params?: {
|
|
45
46
|
renderKey?: string;
|
|
46
|
-
}): React.FC<Props
|
|
47
|
+
}): WithRenderKey<React.FC<Props>>;
|
|
48
|
+
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
import { FeedbackLevel, FlowNodeEntity } from '@flowgram.ai/editor';
|
|
6
|
-
import { IFlowValue } from '../../shared';
|
|
6
|
+
import { type IFlowValue } from '../../shared';
|
|
7
7
|
interface Context {
|
|
8
8
|
node: FlowNodeEntity;
|
|
9
9
|
required?: boolean;
|