@flowgram.ai/form-materials 0.1.0-alpha.18 → 0.1.0-alpha.20
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/assign-rows/index.js +8 -2
- package/dist/cjs/components/batch-outputs/index.js +5 -3
- package/dist/cjs/components/batch-outputs/styles.css +13 -0
- package/dist/cjs/components/blur-input/index.js +5 -1
- package/dist/cjs/components/code-editor/editor.js +16 -12
- package/dist/cjs/components/code-editor/styles.css +4 -0
- package/dist/cjs/components/code-editor/theme/dark.js +1 -1
- package/dist/cjs/components/code-editor/theme/light.js +1 -1
- package/dist/cjs/components/code-editor-mini/index.js +2 -16
- package/dist/cjs/components/condition-context/hooks/use-condition.js +21 -1
- package/dist/cjs/components/condition-row/index.js +26 -12
- package/dist/cjs/components/condition-row/styles.css +19 -0
- package/dist/cjs/components/coze-editor-extensions/extensions/inputs-tree.js +2 -2
- package/dist/cjs/components/coze-editor-extensions/extensions/variable-tag.js +44 -15
- package/dist/cjs/components/coze-editor-extensions/extensions/variable-tree.js +7 -3
- package/dist/{esm/components/coze-editor-extensions/styles.mjs → cjs/components/coze-editor-extensions/styles.css} +19 -18
- package/dist/cjs/components/db-condition-row/index.js +29 -14
- package/dist/cjs/components/db-condition-row/styles.css +30 -0
- package/dist/cjs/components/display-inputs-values/index.js +3 -2
- package/dist/cjs/components/display-inputs-values/styles.css +6 -0
- package/dist/cjs/components/display-outputs/index.js +8 -6
- package/dist/cjs/components/display-outputs/styles.css +6 -0
- package/dist/cjs/components/display-schema-tag/index.js +7 -4
- package/dist/cjs/components/display-schema-tag/styles.css +21 -0
- package/dist/cjs/components/display-schema-tree/index.js +12 -7
- package/dist/cjs/components/display-schema-tree/styles.css +64 -0
- package/dist/cjs/components/dynamic-value-input/index.js +9 -5
- package/dist/{esm/components/dynamic-value-input/styles.mjs → cjs/components/dynamic-value-input/styles.css} +24 -30
- package/dist/cjs/components/index.js +5 -1
- package/dist/cjs/components/inputs-values/index.js +5 -3
- package/dist/cjs/components/inputs-values/styles.css +13 -0
- package/dist/cjs/components/inputs-values-tree/icon.js +70 -0
- package/dist/cjs/components/inputs-values-tree/index.js +4 -3
- package/dist/cjs/components/inputs-values-tree/row.js +19 -15
- package/dist/cjs/components/inputs-values-tree/styles.css +85 -0
- package/dist/cjs/components/{display-inputs-values/styles.js → json-schema-creator/index.js} +4 -19
- package/dist/cjs/components/json-schema-creator/json-input-modal.js +96 -0
- package/dist/cjs/components/{prompt-editor-with-variables/editor.js → json-schema-creator/json-schema-creator.js} +23 -11
- package/dist/cjs/components/{batch-outputs/styles.js → json-schema-creator/utils/json-to-schema.js} +35 -28
- package/dist/cjs/components/json-schema-editor/default-value.js +2 -2
- package/dist/cjs/components/json-schema-editor/hooks.js +55 -48
- package/dist/cjs/components/json-schema-editor/icon.js +70 -0
- package/dist/cjs/components/json-schema-editor/index.js +37 -25
- package/dist/cjs/components/json-schema-editor/styles.css +113 -0
- package/dist/cjs/components/prompt-editor/editor.js +16 -6
- package/dist/cjs/components/prompt-editor/styles.css +10 -0
- package/dist/cjs/components/prompt-editor-with-inputs/index.js +16 -26
- package/dist/cjs/components/prompt-editor-with-variables/index.js +17 -26
- package/dist/cjs/components/variable-selector/context.js +7 -3
- package/dist/cjs/components/variable-selector/index.js +16 -10
- package/dist/{esm/components/variable-selector/styles.mjs → cjs/components/variable-selector/styles.css} +37 -29
- package/dist/cjs/components/variable-selector/use-variable-tree.js +3 -1
- package/dist/cjs/effects/validate-when-variable-sync/index.js +3 -3
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/shared/inject-material/index.js +1 -1
- package/dist/esm/components/assign-rows/index.mjs +9 -3
- package/dist/esm/components/batch-outputs/index.mjs +5 -3
- package/dist/esm/components/batch-outputs/styles.css +13 -0
- package/dist/esm/components/blur-input/index.mjs +5 -1
- package/dist/esm/components/code-editor/editor.mjs +16 -11
- package/dist/esm/components/code-editor/styles.css +4 -0
- package/dist/esm/components/code-editor/theme/dark.mjs +1 -1
- package/dist/esm/components/code-editor/theme/light.mjs +1 -1
- package/dist/esm/components/code-editor-mini/index.mjs +2 -6
- package/dist/esm/components/condition-context/hooks/use-condition.mjs +22 -2
- package/dist/esm/components/condition-row/index.mjs +26 -12
- package/dist/esm/components/condition-row/styles.css +19 -0
- package/dist/esm/components/coze-editor-extensions/extensions/inputs-tree.mjs +3 -3
- package/dist/esm/components/coze-editor-extensions/extensions/variable-tag.mjs +45 -16
- package/dist/esm/components/coze-editor-extensions/extensions/variable-tree.mjs +8 -4
- package/dist/esm/components/coze-editor-extensions/styles.css +37 -0
- package/dist/esm/components/db-condition-row/index.mjs +29 -14
- package/dist/esm/components/db-condition-row/styles.css +30 -0
- package/dist/esm/components/display-inputs-values/index.mjs +3 -2
- package/dist/esm/components/display-inputs-values/styles.css +6 -0
- package/dist/esm/components/display-outputs/index.mjs +9 -7
- package/dist/esm/components/display-outputs/styles.css +6 -0
- package/dist/esm/components/display-schema-tag/index.mjs +8 -5
- package/dist/esm/components/display-schema-tag/styles.css +21 -0
- package/dist/esm/components/display-schema-tree/index.mjs +12 -7
- package/dist/esm/components/display-schema-tree/styles.css +64 -0
- package/dist/esm/components/dynamic-value-input/index.mjs +9 -5
- package/dist/esm/components/dynamic-value-input/styles.css +48 -0
- package/dist/esm/components/index.mjs +2 -1
- package/dist/esm/components/inputs-values/index.mjs +5 -3
- package/dist/esm/components/inputs-values/styles.css +13 -0
- package/dist/esm/components/inputs-values-tree/icon.mjs +26 -0
- package/dist/esm/components/inputs-values-tree/index.mjs +4 -3
- package/dist/esm/components/inputs-values-tree/row.mjs +18 -14
- package/dist/esm/components/inputs-values-tree/styles.css +85 -0
- package/dist/esm/components/json-schema-creator/index.mjs +2 -0
- package/dist/esm/components/json-schema-creator/json-input-modal.mjs +62 -0
- package/dist/esm/components/json-schema-creator/json-schema-creator.mjs +26 -0
- package/dist/esm/components/json-schema-creator/utils/json-to-schema.mjs +33 -0
- package/dist/esm/components/json-schema-editor/default-value.mjs +2 -2
- package/dist/esm/components/json-schema-editor/hooks.mjs +55 -48
- package/dist/esm/components/json-schema-editor/icon.mjs +26 -0
- package/dist/esm/components/json-schema-editor/index.mjs +36 -24
- package/dist/esm/components/json-schema-editor/styles.css +113 -0
- package/dist/esm/components/prompt-editor/editor.mjs +16 -6
- package/dist/esm/components/prompt-editor/styles.css +10 -0
- package/dist/esm/components/prompt-editor-with-inputs/index.mjs +12 -4
- package/dist/esm/components/prompt-editor-with-variables/index.mjs +13 -4
- package/dist/esm/components/variable-selector/context.mjs +7 -3
- package/dist/esm/components/variable-selector/index.mjs +17 -11
- package/{src/components/variable-selector/styles.tsx → dist/esm/components/variable-selector/styles.css} +35 -38
- package/dist/esm/components/variable-selector/use-variable-tree.mjs +3 -1
- package/dist/esm/effects/validate-when-variable-sync/index.mjs +3 -3
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/shared/inject-material/index.mjs +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/components/assign-rows/index.d.ts +2 -0
- package/dist/types/components/batch-outputs/index.d.ts +1 -0
- package/dist/types/components/blur-input/index.d.ts +1 -1
- package/dist/types/components/code-editor/editor.d.ts +1 -0
- package/dist/types/components/condition-context/hooks/use-condition.d.ts +16 -1
- package/dist/types/components/condition-row/index.d.ts +5 -1
- package/dist/types/components/coze-editor-extensions/extensions/inputs-tree.d.ts +3 -3
- package/dist/types/components/coze-editor-extensions/extensions/variable-tag.d.ts +1 -0
- package/dist/types/components/coze-editor-extensions/index.d.ts +1 -1
- package/dist/types/components/db-condition-row/index.d.ts +4 -0
- package/dist/types/components/db-condition-row/types.d.ts +0 -1
- package/dist/types/components/display-inputs-values/index.d.ts +3 -1
- package/dist/types/components/display-outputs/index.d.ts +3 -1
- package/dist/types/components/display-schema-tag/index.d.ts +1 -0
- package/dist/types/components/display-schema-tree/index.d.ts +1 -0
- package/dist/types/components/dynamic-value-input/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/inputs-values/index.d.ts +1 -0
- package/dist/types/components/inputs-values-tree/icon.d.ts +6 -0
- package/dist/types/components/inputs-values-tree/index.d.ts +1 -0
- package/dist/types/components/inputs-values-tree/row.d.ts +1 -0
- package/dist/types/components/inputs-values-tree/types.d.ts +3 -2
- package/dist/types/components/json-schema-creator/index.d.ts +6 -0
- package/dist/types/components/json-schema-creator/json-input-modal.d.ts +13 -0
- package/dist/types/components/json-schema-creator/json-schema-creator.d.ts +11 -0
- package/dist/types/components/json-schema-creator/utils/json-to-schema.d.ts +6 -0
- package/dist/types/components/json-schema-editor/icon.d.ts +6 -0
- package/dist/types/components/json-schema-editor/index.d.ts +1 -0
- package/dist/types/components/prompt-editor/editor.d.ts +1 -0
- package/dist/types/components/prompt-editor-with-inputs/index.d.ts +7 -2
- package/dist/types/components/prompt-editor-with-variables/index.d.ts +5 -2
- package/dist/types/components/variable-selector/context.d.ts +16 -3
- package/dist/types/components/variable-selector/index.d.ts +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/plugins/json-schema-preset/create-type-preset-plugin.d.ts +7 -3
- package/dist/types/shared/flow-value/index.d.ts +1 -1
- package/dist/types/shared/flow-value/types.d.ts +3 -0
- package/dist/types/shared/index.d.ts +1 -1
- package/package.json +7 -10
- package/src/components/assign-rows/index.tsx +7 -6
- package/src/components/batch-outputs/index.tsx +5 -5
- package/src/components/batch-outputs/{styles.tsx → styles.css} +4 -6
- package/src/components/blur-input/index.tsx +6 -2
- package/src/components/code-editor/editor.tsx +19 -14
- package/src/components/code-editor/styles.css +11 -0
- package/src/components/code-editor/theme/dark.ts +1 -1
- package/src/components/code-editor/theme/light.ts +1 -1
- package/src/components/code-editor-mini/index.tsx +2 -9
- package/src/components/condition-context/hooks/use-condition.tsx +55 -7
- package/src/components/condition-row/index.tsx +27 -22
- package/src/components/condition-row/{styles.tsx → styles.css} +11 -11
- package/src/components/coze-editor-extensions/extensions/inputs-tree.tsx +7 -6
- package/src/components/coze-editor-extensions/extensions/variable-tag.tsx +35 -22
- package/src/components/coze-editor-extensions/extensions/variable-tree.tsx +14 -4
- package/src/components/coze-editor-extensions/{styles.tsx → styles.css} +8 -11
- package/src/components/db-condition-row/index.tsx +29 -26
- package/src/components/db-condition-row/{styles.tsx → styles.css} +14 -16
- package/src/components/db-condition-row/types.ts +0 -1
- package/src/components/display-inputs-values/index.tsx +5 -4
- package/src/components/display-inputs-values/{styles.ts → styles.css} +2 -4
- package/src/components/display-outputs/index.tsx +9 -8
- package/src/components/display-outputs/{styles.ts → styles.css} +2 -4
- package/src/components/display-schema-tag/index.tsx +7 -7
- package/src/components/display-schema-tag/{styles.ts → styles.css} +7 -10
- package/src/components/display-schema-tree/index.tsx +10 -10
- package/src/components/display-schema-tree/{styles.tsx → styles.css} +18 -24
- package/src/components/dynamic-value-input/index.tsx +6 -6
- package/src/components/dynamic-value-input/{styles.tsx → styles.css} +9 -12
- package/src/components/index.ts +1 -0
- package/src/components/inputs-values/index.tsx +5 -5
- package/src/components/inputs-values/{styles.tsx → styles.css} +4 -6
- package/src/components/inputs-values-tree/icon.tsx +28 -0
- package/src/components/inputs-values-tree/index.tsx +8 -6
- package/src/components/inputs-values-tree/row.tsx +25 -27
- package/src/components/inputs-values-tree/styles.css +94 -0
- package/src/components/inputs-values-tree/types.ts +3 -2
- package/src/components/json-schema-creator/index.tsx +7 -0
- package/src/components/json-schema-creator/json-input-modal.tsx +61 -0
- package/src/components/json-schema-creator/json-schema-creator.tsx +37 -0
- package/src/components/json-schema-creator/utils/json-to-schema.ts +50 -0
- package/src/components/json-schema-editor/default-value.tsx +2 -4
- package/src/components/json-schema-editor/hooks.tsx +60 -53
- package/src/components/json-schema-editor/icon.tsx +28 -0
- package/src/components/json-schema-editor/index.tsx +45 -50
- package/src/components/json-schema-editor/styles.css +135 -0
- package/src/components/prompt-editor/editor.tsx +18 -7
- package/src/components/prompt-editor/styles.css +14 -0
- package/src/components/prompt-editor-with-inputs/index.tsx +18 -5
- package/src/components/prompt-editor-with-variables/index.tsx +13 -5
- package/src/components/variable-selector/context.tsx +22 -2
- package/src/components/variable-selector/index.tsx +24 -14
- package/src/components/variable-selector/styles.css +70 -0
- package/src/components/variable-selector/use-variable-tree.tsx +9 -1
- package/src/effects/validate-when-variable-sync/index.ts +7 -3
- package/src/index.ts +3 -0
- package/src/plugins/json-schema-preset/create-type-preset-plugin.tsx +17 -12
- package/src/shared/flow-value/index.ts +1 -0
- package/src/shared/flow-value/types.ts +4 -0
- package/src/shared/index.ts +1 -0
- package/src/shared/inject-material/index.tsx +1 -1
- package/dist/cjs/components/condition-row/styles.js +0 -77
- package/dist/cjs/components/coze-editor-extensions/styles.js +0 -89
- package/dist/cjs/components/db-condition-row/styles.js +0 -94
- package/dist/cjs/components/display-outputs/styles.js +0 -51
- package/dist/cjs/components/display-schema-tag/styles.js +0 -71
- package/dist/cjs/components/display-schema-tree/styles.js +0 -135
- package/dist/cjs/components/dynamic-value-input/styles.js +0 -107
- package/dist/cjs/components/inputs-values/styles.js +0 -60
- package/dist/cjs/components/inputs-values-tree/styles.js +0 -177
- package/dist/cjs/components/json-schema-editor/styles.js +0 -231
- package/dist/cjs/components/prompt-editor/styles.js +0 -55
- package/dist/cjs/components/prompt-editor-with-inputs/editor.js +0 -47
- package/dist/cjs/components/variable-selector/styles.js +0 -114
- package/dist/esm/components/batch-outputs/styles.mjs +0 -13
- package/dist/esm/components/condition-row/styles.mjs +0 -21
- package/dist/esm/components/db-condition-row/styles.mjs +0 -32
- package/dist/esm/components/display-inputs-values/styles.mjs +0 -7
- package/dist/esm/components/display-outputs/styles.mjs +0 -7
- package/dist/esm/components/display-schema-tag/styles.mjs +0 -21
- package/dist/esm/components/display-schema-tree/styles.mjs +0 -79
- package/dist/esm/components/inputs-values/styles.mjs +0 -13
- package/dist/esm/components/inputs-values-tree/styles.mjs +0 -105
- package/dist/esm/components/json-schema-editor/styles.mjs +0 -138
- package/dist/esm/components/prompt-editor/styles.mjs +0 -11
- package/dist/esm/components/prompt-editor-with-inputs/editor.mjs +0 -13
- package/dist/esm/components/prompt-editor-with-variables/editor.mjs +0 -14
- package/dist/types/components/batch-outputs/styles.d.ts +0 -6
- package/dist/types/components/condition-row/styles.d.ts +0 -9
- package/dist/types/components/coze-editor-extensions/styles.d.ts +0 -9
- package/dist/types/components/db-condition-row/styles.d.ts +0 -12
- package/dist/types/components/display-inputs-values/styles.d.ts +0 -5
- package/dist/types/components/display-outputs/styles.d.ts +0 -5
- package/dist/types/components/display-schema-tag/styles.d.ts +0 -8
- package/dist/types/components/display-schema-tree/styles.d.ts +0 -11
- package/dist/types/components/dynamic-value-input/styles.d.ts +0 -8
- package/dist/types/components/inputs-values/styles.d.ts +0 -6
- package/dist/types/components/inputs-values-tree/styles.d.ts +0 -23
- package/dist/types/components/json-schema-editor/styles.d.ts +0 -30
- package/dist/types/components/prompt-editor/styles.d.ts +0 -7
- package/dist/types/components/prompt-editor-with-inputs/editor.d.ts +0 -10
- package/dist/types/components/prompt-editor-with-variables/editor.d.ts +0 -9
- package/dist/types/components/variable-selector/styles.d.ts +0 -14
- package/src/components/inputs-values-tree/styles.tsx +0 -128
- package/src/components/json-schema-editor/styles.tsx +0 -168
- package/src/components/prompt-editor/styles.tsx +0 -18
- package/src/components/prompt-editor-with-inputs/editor.tsx +0 -24
- package/src/components/prompt-editor-with-variables/editor.tsx +0 -20
- package/src/shared/inject-material/README.md +0 -170
- package/src/shared/inject-material/README.zh.md +0 -174
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import styled, { css } from 'styled-components';
|
|
9
|
-
import Icon from '@douyinfe/semi-icons';
|
|
10
|
-
|
|
11
|
-
export const UIContainer = styled.div`
|
|
12
|
-
/* & .semi-input {
|
|
13
|
-
background-color: #fff;
|
|
14
|
-
border-radius: 6px;
|
|
15
|
-
height: 24px;
|
|
16
|
-
} */
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
export const UIRow = styled.div`
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
gap: 6px;
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
export const UICollapseTrigger = styled.div`
|
|
26
|
-
cursor: pointer;
|
|
27
|
-
margin-right: 5px;
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
export const UIExpandDetail = styled.div`
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
export const UILabel = styled.div`
|
|
36
|
-
font-size: 12px;
|
|
37
|
-
color: #999;
|
|
38
|
-
font-weight: 400;
|
|
39
|
-
margin-bottom: 2px;
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
|
-
export const UITreeItems = styled.div<{ $shrink?: boolean }>`
|
|
43
|
-
display: grid;
|
|
44
|
-
grid-template-columns: auto 1fr;
|
|
45
|
-
|
|
46
|
-
${({ $shrink }) =>
|
|
47
|
-
$shrink &&
|
|
48
|
-
css`
|
|
49
|
-
padding-left: 3px;
|
|
50
|
-
margin-top: 10px;
|
|
51
|
-
`}
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
export const UITreeItemLeft = styled.div<{
|
|
55
|
-
$isLast?: boolean;
|
|
56
|
-
$showLine?: boolean;
|
|
57
|
-
$showCollapse?: boolean;
|
|
58
|
-
}>`
|
|
59
|
-
grid-column: 1;
|
|
60
|
-
position: relative;
|
|
61
|
-
width: 16px;
|
|
62
|
-
|
|
63
|
-
${({ $showLine, $isLast, $showCollapse }) => {
|
|
64
|
-
let height = $isLast ? '24px' : '100%';
|
|
65
|
-
let width = $showCollapse ? '12px' : '30px';
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
$showLine &&
|
|
69
|
-
css`
|
|
70
|
-
&::before {
|
|
71
|
-
/* 竖线 */
|
|
72
|
-
content: '';
|
|
73
|
-
height: ${height};
|
|
74
|
-
position: absolute;
|
|
75
|
-
left: -14px;
|
|
76
|
-
top: -16px;
|
|
77
|
-
width: 1px;
|
|
78
|
-
background: #d9d9d9;
|
|
79
|
-
display: block;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
&::after {
|
|
83
|
-
/* 横线 */
|
|
84
|
-
content: '';
|
|
85
|
-
position: absolute;
|
|
86
|
-
left: -14px; // 横线起点和竖线对齐
|
|
87
|
-
top: 8px; // 跟随你的行高调整
|
|
88
|
-
width: ${width}; // 横线长度
|
|
89
|
-
height: 1px;
|
|
90
|
-
background: #d9d9d9;
|
|
91
|
-
display: block;
|
|
92
|
-
}
|
|
93
|
-
`
|
|
94
|
-
);
|
|
95
|
-
}}
|
|
96
|
-
`;
|
|
97
|
-
|
|
98
|
-
export const UITreeItemRight = styled.div`
|
|
99
|
-
grid-column: 2;
|
|
100
|
-
margin-bottom: 10px;
|
|
101
|
-
|
|
102
|
-
&:last-child {
|
|
103
|
-
margin-bottom: 0px;
|
|
104
|
-
}
|
|
105
|
-
`;
|
|
106
|
-
|
|
107
|
-
export const UITreeItemMain = styled.div<{}>`
|
|
108
|
-
display: flex;
|
|
109
|
-
flex-direction: column;
|
|
110
|
-
gap: 10px;
|
|
111
|
-
position: relative;
|
|
112
|
-
`;
|
|
113
|
-
|
|
114
|
-
export const UICollapsible = styled.div<{ $collapse?: boolean }>`
|
|
115
|
-
display: none;
|
|
116
|
-
|
|
117
|
-
${({ $collapse }) =>
|
|
118
|
-
$collapse &&
|
|
119
|
-
css`
|
|
120
|
-
display: block;
|
|
121
|
-
`}
|
|
122
|
-
`;
|
|
123
|
-
|
|
124
|
-
export const UIName = styled.div`
|
|
125
|
-
flex-grow: 1;
|
|
126
|
-
`;
|
|
127
|
-
|
|
128
|
-
export const UIType = styled.div``;
|
|
129
|
-
|
|
130
|
-
export const UIRequired = styled.div``;
|
|
131
|
-
|
|
132
|
-
export const UIActions = styled.div`
|
|
133
|
-
white-space: nowrap;
|
|
134
|
-
`;
|
|
135
|
-
|
|
136
|
-
const iconAddChildrenSvg = (
|
|
137
|
-
<svg
|
|
138
|
-
className="icon-icon icon-icon-coz_add_node "
|
|
139
|
-
width="1em"
|
|
140
|
-
height="1em"
|
|
141
|
-
viewBox="0 0 24 24"
|
|
142
|
-
fill="currentColor"
|
|
143
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
144
|
-
>
|
|
145
|
-
<path
|
|
146
|
-
fillRule="evenodd"
|
|
147
|
-
clipRule="evenodd"
|
|
148
|
-
d="M11 6.49988C11 8.64148 9.50397 10.4337 7.49995 10.8884V15.4998C7.49995 16.0521 7.94767 16.4998 8.49995 16.4998H11.208C11.0742 16.8061 11 17.1443 11 17.4998C11 17.8554 11.0742 18.1936 11.208 18.4998H8.49995C6.8431 18.4998 5.49995 17.1567 5.49995 15.4998V10.8884C3.49599 10.4336 2 8.64145 2 6.49988C2 4.0146 4.01472 1.99988 6.5 1.99988C8.98528 1.99988 11 4.0146 11 6.49988ZM6.5 8.99988C7.88071 8.99988 9 7.88059 9 6.49988C9 5.11917 7.88071 3.99988 6.5 3.99988C5.11929 3.99988 4 5.11917 4 6.49988C4 7.88059 5.11929 8.99988 6.5 8.99988Z"
|
|
149
|
-
></path>
|
|
150
|
-
<path d="M17.5 12.4999C18.0523 12.4999 18.5 12.9476 18.5 13.4999V16.4999H21.5C22.0523 16.4999 22.5 16.9476 22.5 17.4999C22.5 18.0522 22.0523 18.4999 21.5 18.4999H18.5V21.4999C18.5 22.0522 18.0523 22.4999 17.5 22.4999C16.9477 22.4999 16.5 22.0522 16.5 21.4999V18.4999H13.5C12.9477 18.4999 12.5 18.0522 12.5 17.4999C12.5 16.9476 12.9477 16.4999 13.5 16.4999H16.5V13.4999C16.5 12.9476 16.9477 12.4999 17.5 12.4999Z"></path>
|
|
151
|
-
</svg>
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
export const IconAddChildren = () => <Icon size="small" svg={iconAddChildrenSvg} />;
|
|
155
|
-
|
|
156
|
-
export const DefaultValueWrapper = styled.div`
|
|
157
|
-
margin: 0;
|
|
158
|
-
`;
|
|
159
|
-
|
|
160
|
-
export const ConstantInputWrapper = styled.div`
|
|
161
|
-
flex-grow: 1;
|
|
162
|
-
|
|
163
|
-
& .semi-tree-select,
|
|
164
|
-
& .semi-input-number,
|
|
165
|
-
& .semi-select {
|
|
166
|
-
width: 100%;
|
|
167
|
-
}
|
|
168
|
-
`;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import styled, { css } from 'styled-components';
|
|
7
|
-
|
|
8
|
-
export const UIContainer = styled.div<{ $hasError?: boolean }>`
|
|
9
|
-
background-color: var(--semi-color-fill-0);
|
|
10
|
-
padding-left: 10px;
|
|
11
|
-
padding-right: 6px;
|
|
12
|
-
|
|
13
|
-
${({ $hasError }) =>
|
|
14
|
-
$hasError &&
|
|
15
|
-
css`
|
|
16
|
-
border: 1px solid var(--semi-color-danger-6);
|
|
17
|
-
`}
|
|
18
|
-
`;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { PromptEditor, PromptEditorPropsType } from '@/components/prompt-editor';
|
|
9
|
-
import { EditorInputsTree } from '@/components/coze-editor-extensions';
|
|
10
|
-
|
|
11
|
-
export interface PromptEditorWithInputsProps extends PromptEditorPropsType {
|
|
12
|
-
inputsValues: any;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function PromptEditorWithInputs({
|
|
16
|
-
inputsValues,
|
|
17
|
-
...restProps
|
|
18
|
-
}: PromptEditorWithInputsProps) {
|
|
19
|
-
return (
|
|
20
|
-
<PromptEditor {...restProps}>
|
|
21
|
-
<EditorInputsTree inputsValues={inputsValues} />
|
|
22
|
-
</PromptEditor>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { PromptEditor, PromptEditorPropsType } from '@/components/prompt-editor';
|
|
9
|
-
import { EditorVariableTree, EditorVariableTagInject } from '@/components/coze-editor-extensions';
|
|
10
|
-
|
|
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
|
-
}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
# InjectMaterial Component
|
|
2
|
-
|
|
3
|
-
A material component wrapper with dependency injection support for implementing dynamic component replacement mechanisms.
|
|
4
|
-
|
|
5
|
-
## Why Dependency Injection Matters
|
|
6
|
-
|
|
7
|
-
### ❌ Tight Coupling: Traditional Dependency Issues
|
|
8
|
-
|
|
9
|
-
```mermaid
|
|
10
|
-
graph TD
|
|
11
|
-
A[Material A] --> B[Material B]
|
|
12
|
-
B --> D[Material D]
|
|
13
|
-
C[Material C] --> D
|
|
14
|
-
|
|
15
|
-
style D fill:#ff4757
|
|
16
|
-
style A fill:#ffa502
|
|
17
|
-
style B fill:#ffa502
|
|
18
|
-
style C fill:#ffa502
|
|
19
|
-
|
|
20
|
-
note["💥 Problem: D changes require modifications to A, B, C"]
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**Issues:** Chain reactions, high maintenance costs
|
|
24
|
-
|
|
25
|
-
### ✅ Decoupling: Dependency Injection Solution
|
|
26
|
-
|
|
27
|
-
```mermaid
|
|
28
|
-
graph TD
|
|
29
|
-
A[Material A] --> RenderKey[Material D RenderKey]
|
|
30
|
-
B[Material B] --> RenderKey
|
|
31
|
-
C[Material C] --> RenderKey
|
|
32
|
-
|
|
33
|
-
RenderKey -.-> BaseD[Origin D]
|
|
34
|
-
CustomD[Custom D] -.-> RenderKey
|
|
35
|
-
|
|
36
|
-
style RenderKey fill:#5f27cd
|
|
37
|
-
style BaseD fill:#2ed573
|
|
38
|
-
style CustomD fill:#26d0ce
|
|
39
|
-
style A fill:#a55eea
|
|
40
|
-
style B fill:#a55eea
|
|
41
|
-
style C fill:#a55eea
|
|
42
|
-
|
|
43
|
-
note2["✅ A, B, C depend on abstract interface, decoupled from D"]
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
**Benefits:** Hot-swapping, parallel development, version compatibility
|
|
47
|
-
|
|
48
|
-
## Features
|
|
49
|
-
|
|
50
|
-
- 🔧 **Dependency Injection**: Support dynamic component replacement via FlowRendererRegistry
|
|
51
|
-
- 🔄 **Smart Fallback**: Automatically use default component when no custom component is registered
|
|
52
|
-
- 🎯 **Type Safety**: Full TypeScript type inference support
|
|
53
|
-
- 📦 **Zero Configuration**: Works out of the box without additional setup
|
|
54
|
-
|
|
55
|
-
## Usage
|
|
56
|
-
|
|
57
|
-
### 1. Create Injectable Material Component
|
|
58
|
-
|
|
59
|
-
```tsx
|
|
60
|
-
import { createInjectMaterial } from '@flowgram.ai/form-materials';
|
|
61
|
-
import { VariableSelector } from './VariableSelector';
|
|
62
|
-
|
|
63
|
-
// Create injectable material wrapper component
|
|
64
|
-
const InjectVariableSelector = createInjectMaterial(VariableSelector);
|
|
65
|
-
|
|
66
|
-
// Now you can use it like a regular component
|
|
67
|
-
function MyComponent() {
|
|
68
|
-
return <InjectVariableSelector value={value} onChange={handleChange} />;
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### 2. Register Custom Components
|
|
73
|
-
|
|
74
|
-
Configure custom renderer in `use-editor-props.tsx`:
|
|
75
|
-
|
|
76
|
-
```tsx
|
|
77
|
-
import { useEditorProps } from '@flowgram.ai/editor';
|
|
78
|
-
import { YourCustomVariableSelector } from './YourCustomVariableSelector';
|
|
79
|
-
import { VariableSelector } from '@flowgram.ai/form-materials';
|
|
80
|
-
|
|
81
|
-
function useCustomEditorProps() {
|
|
82
|
-
const editorProps = useEditorProps({
|
|
83
|
-
materials: {
|
|
84
|
-
components: {
|
|
85
|
-
// Use component's renderKey or component name as key
|
|
86
|
-
[VariableSelector.renderKey]: YourCustomVariableSelector,
|
|
87
|
-
[TypeSelector.renderKey]: YourCustomTypeSelector,
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
return editorProps;
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### 3. Use Custom renderKey
|
|
97
|
-
|
|
98
|
-
If your component requires a specific renderKey:
|
|
99
|
-
|
|
100
|
-
```tsx
|
|
101
|
-
const InjectCustomComponent = createInjectMaterial(MyComponent, {
|
|
102
|
-
renderKey: 'my-custom-key'
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
// When registering
|
|
106
|
-
{
|
|
107
|
-
materials: {
|
|
108
|
-
components: {
|
|
109
|
-
'my-custom-key': MyCustomRenderer
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## Sequence Diagram
|
|
116
|
-
|
|
117
|
-
Complete component registration and rendering sequence diagram:
|
|
118
|
-
|
|
119
|
-
```mermaid
|
|
120
|
-
sequenceDiagram
|
|
121
|
-
participant App as Application
|
|
122
|
-
participant Editor as use-editor-props
|
|
123
|
-
participant Registry as FlowRendererRegistry
|
|
124
|
-
participant Inject as InjectMaterial
|
|
125
|
-
participant Default as Default Component
|
|
126
|
-
participant Custom as Custom Component
|
|
127
|
-
|
|
128
|
-
Note over App,Custom: Component Registration Phase
|
|
129
|
-
App->>Editor: Call use-editor-props()
|
|
130
|
-
Editor->>Editor: Configure materials.components
|
|
131
|
-
Editor->>Registry: Register component to FlowRendererRegistry
|
|
132
|
-
Registry->>Registry: Store mapping relationship
|
|
133
|
-
Registry-->>App: Registration complete
|
|
134
|
-
|
|
135
|
-
Note over App,Custom: Component Rendering Phase
|
|
136
|
-
App->>Inject: Render InjectMaterial component
|
|
137
|
-
Inject->>Registry: Query renderer (getRendererComponent)
|
|
138
|
-
|
|
139
|
-
alt Custom renderer exists
|
|
140
|
-
Registry-->>Inject: Return custom React component
|
|
141
|
-
Inject->>Custom: Render with custom component
|
|
142
|
-
Custom-->>App: Render custom UI
|
|
143
|
-
else No custom renderer
|
|
144
|
-
Registry-->>Inject: Return null or type mismatch
|
|
145
|
-
Inject->>Default: Render with default component
|
|
146
|
-
Default-->>App: Render default UI
|
|
147
|
-
end
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Render Key Priority
|
|
151
|
-
|
|
152
|
-
Component render key determination follows this priority order:
|
|
153
|
-
|
|
154
|
-
1. `params.renderKey` (second parameter of createInjectMaterial)
|
|
155
|
-
2. `Component.renderKey` (component's own renderKey property)
|
|
156
|
-
3. `Component.name` (component's display name)
|
|
157
|
-
4. Empty string (final fallback)
|
|
158
|
-
|
|
159
|
-
## Type Definition
|
|
160
|
-
|
|
161
|
-
```typescript
|
|
162
|
-
interface CreateInjectMaterialOptions {
|
|
163
|
-
renderKey?: string;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function createInjectMaterial<Props>(
|
|
167
|
-
Component: React.FC<Props> & { renderKey?: string },
|
|
168
|
-
params?: CreateInjectMaterialOptions
|
|
169
|
-
): React.FC<Props>
|
|
170
|
-
```
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
# InjectMaterial 组件
|
|
2
|
-
|
|
3
|
-
一个支持依赖注入的 Material 组件包装器,用于实现动态组件替换机制。
|
|
4
|
-
|
|
5
|
-
## 为什么需要依赖注入
|
|
6
|
-
|
|
7
|
-
### ❌ 紧耦合:传统依赖问题
|
|
8
|
-
|
|
9
|
-
```mermaid
|
|
10
|
-
graph TD
|
|
11
|
-
A[Material A] --> B[Material B]
|
|
12
|
-
B --> D[Material D]
|
|
13
|
-
C[Material C] --> D
|
|
14
|
-
|
|
15
|
-
style D fill:#ff4757
|
|
16
|
-
style A fill:#ffa502
|
|
17
|
-
style B fill:#ffa502
|
|
18
|
-
style C fill:#ffa502
|
|
19
|
-
|
|
20
|
-
note["💥 问题:D变更导致A、B、C全部需要修改"]
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**问题:** 连锁反应、高维护成本
|
|
24
|
-
|
|
25
|
-
### ✅ 解耦:依赖注入方案
|
|
26
|
-
|
|
27
|
-
```mermaid
|
|
28
|
-
graph TD
|
|
29
|
-
A[Material A] --> RenderKey[Material D RenderKey]
|
|
30
|
-
B[Material B] --> RenderKey
|
|
31
|
-
C[Material C] --> RenderKey
|
|
32
|
-
|
|
33
|
-
RenderKey -.-> BaseD[Origin D]
|
|
34
|
-
CustomD[Custom D] -.-> RenderKey
|
|
35
|
-
|
|
36
|
-
style RenderKey fill:#5f27cd
|
|
37
|
-
style BaseD fill:#2ed573
|
|
38
|
-
style CustomD fill:#26d0ce
|
|
39
|
-
style A fill:#a55eea
|
|
40
|
-
style B fill:#a55eea
|
|
41
|
-
style C fill:#a55eea
|
|
42
|
-
|
|
43
|
-
note2["✅ A、B、C依赖抽象接口,与D实现解耦"]
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
**优势:** 热插拔、并行开发、版本兼容
|
|
47
|
-
|
|
48
|
-
## 特性
|
|
49
|
-
|
|
50
|
-
- 🔧 **依赖注入**:通过 FlowRendererRegistry 支持动态组件替换
|
|
51
|
-
- 🔄 **智能回退**:当没有注册自定义组件时自动使用默认组件
|
|
52
|
-
- 🎯 **类型安全**:完整的 TypeScript 类型推断支持
|
|
53
|
-
- 📦 **零配置**:开箱即用,无需额外设置
|
|
54
|
-
|
|
55
|
-
## 安装
|
|
56
|
-
|
|
57
|
-
该组件是 `@flowgram.ai/form-materials` 包的一部分,无需单独安装。
|
|
58
|
-
|
|
59
|
-
## 使用
|
|
60
|
-
|
|
61
|
-
### 1. 创建可注入的 Material 组件件
|
|
62
|
-
|
|
63
|
-
```tsx
|
|
64
|
-
import { createInjectMaterial } from '@flowgram.ai/form-materials';
|
|
65
|
-
import { VariableSelector } from './VariableSelector';
|
|
66
|
-
|
|
67
|
-
// 创建可注入的Material包装组件
|
|
68
|
-
const InjectVariableSelector = createInjectMaterial(VariableSelector);
|
|
69
|
-
|
|
70
|
-
// 现在你可以像使用普通组件一样使用它
|
|
71
|
-
function MyComponent() {
|
|
72
|
-
return <InjectVariableSelector value={value} onChange={handleChange} />;
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### 2. 注册自定义组件
|
|
77
|
-
|
|
78
|
-
在 `use-editor-props.tsx` 中配置自定义渲染器:
|
|
79
|
-
|
|
80
|
-
```tsx
|
|
81
|
-
import { useEditorProps } from '@flowgram.ai/editor';
|
|
82
|
-
import { YourCustomVariableSelector } from './YourCustomVariableSelector';
|
|
83
|
-
import { VariableSelector } from '@flowgram.ai/form-materials';
|
|
84
|
-
|
|
85
|
-
function useCustomEditorProps() {
|
|
86
|
-
const editorProps = useEditorProps({
|
|
87
|
-
materials: {
|
|
88
|
-
components: {
|
|
89
|
-
// 使用组件的 renderKey 或组件名称作为键
|
|
90
|
-
[VariableSelector.renderKey]: YourCustomVariableSelector,
|
|
91
|
-
[TypeSelector.renderKey]: YourCustomTypeSelector,
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
return editorProps;
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### 3. 使用自定义 renderKey
|
|
101
|
-
|
|
102
|
-
如果你的组件需要特定的 renderKey:
|
|
103
|
-
|
|
104
|
-
```tsx
|
|
105
|
-
const InjectCustomComponent = createInjectMaterial(MyComponent, {
|
|
106
|
-
renderKey: 'my-custom-key'
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// 注册时
|
|
110
|
-
{
|
|
111
|
-
materials: {
|
|
112
|
-
components: {
|
|
113
|
-
'my-custom-key': MyCustomRenderer
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## 时序图
|
|
120
|
-
|
|
121
|
-
完整的组件注册和渲染时序图:
|
|
122
|
-
|
|
123
|
-
```mermaid
|
|
124
|
-
sequenceDiagram
|
|
125
|
-
participant App as 应用程序
|
|
126
|
-
participant Editor as use-editor-props
|
|
127
|
-
participant Registry as FlowRendererRegistry
|
|
128
|
-
participant Inject as InjectMaterial
|
|
129
|
-
participant Default as 默认组件
|
|
130
|
-
participant Custom as 自定义组件
|
|
131
|
-
|
|
132
|
-
Note over App,Custom: 组件注册阶段
|
|
133
|
-
App->>Editor: 调用 use-editor-props()
|
|
134
|
-
Editor->>Editor: 配置 materials.components
|
|
135
|
-
Editor->>Registry: 向 FlowRendererRegistry 注册组件
|
|
136
|
-
Registry->>Registry: 存储映射关系
|
|
137
|
-
Registry-->>App: 注册完成
|
|
138
|
-
|
|
139
|
-
Note over App,Custom: 组件渲染阶段
|
|
140
|
-
App->>Inject: 渲染 InjectMaterial 组件
|
|
141
|
-
Inject->>Registry: 查询渲染器 (getRendererComponent)
|
|
142
|
-
|
|
143
|
-
alt 存在自定义渲染器
|
|
144
|
-
Registry-->>Inject: 返回自定义 React 组件
|
|
145
|
-
Inject->>Custom: 使用自定义组件渲染
|
|
146
|
-
Custom-->>App: 渲染自定义 UI
|
|
147
|
-
else 无自定义渲染器
|
|
148
|
-
Registry-->>Inject: 返回 null 或类型不匹配
|
|
149
|
-
Inject->>Default: 使用默认组件渲染
|
|
150
|
-
Default-->>App: 渲染默认 UI
|
|
151
|
-
end
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
## 渲染键优先级
|
|
155
|
-
|
|
156
|
-
组件渲染键的确定遵循以下优先级顺序:
|
|
157
|
-
|
|
158
|
-
1. `params.renderKey` (createInjectMaterial 的第二个参数)
|
|
159
|
-
2. `Component.renderKey` (组件自身的 renderKey 属性)
|
|
160
|
-
3. `Component.name` (组件的显示名称)
|
|
161
|
-
4. 空字符串 (最终回退)
|
|
162
|
-
|
|
163
|
-
## 类型定义
|
|
164
|
-
|
|
165
|
-
```typescript
|
|
166
|
-
interface CreateInjectMaterialOptions {
|
|
167
|
-
renderKey?: string;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function createInjectMaterial<Props>(
|
|
171
|
-
Component: React.FC<Props> & { renderKey?: string },
|
|
172
|
-
params?: CreateInjectMaterialOptions
|
|
173
|
-
): React.FC<Props>
|
|
174
|
-
```
|