@coding-flow/flow-design 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/design-editor/components/node-icon/index.js +8 -2
- package/dist/components/design-editor/node-components/header/index.js +2 -1
- package/dist/components/design-editor/node-components/manual-title/index.d.ts +7 -0
- package/dist/components/design-editor/node-components/manual-title/index.js +89 -0
- package/dist/components/design-editor/nodes/index.js +4 -0
- package/dist/components/design-editor/nodes/manual/form-meta.d.ts +4 -0
- package/dist/components/design-editor/nodes/manual/form-meta.js +24 -0
- package/dist/components/design-editor/nodes/manual/index.d.ts +2 -0
- package/dist/components/design-editor/nodes/manual/index.js +21 -0
- package/dist/components/design-editor/nodes/manual-branch/form-meta.d.ts +4 -0
- package/dist/components/design-editor/nodes/manual-branch/form-meta.js +22 -0
- package/dist/components/design-editor/nodes/manual-branch/index.d.ts +2 -0
- package/dist/components/design-editor/nodes/manual-branch/index.js +27 -0
- package/dist/components/design-editor/nodes/parallel-branch/index.js +0 -3
- package/package.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { theme } from "antd";
|
|
4
|
-
import { ApiOutlined, AuditOutlined, BellOutlined, BranchesOutlined, ClockCircleOutlined, EditOutlined, MergeOutlined, NodeExpandOutlined, PoweroffOutlined, PullRequestOutlined, ShareAltOutlined, UserOutlined } from "@ant-design/icons";
|
|
4
|
+
import { ApiOutlined, AuditOutlined, BellOutlined, BranchesOutlined, ClockCircleOutlined, EditOutlined, MergeOutlined, NodeExpandOutlined, PoweroffOutlined, PullRequestOutlined, ShareAltOutlined, StarOutlined, UserOutlined } from "@ant-design/icons";
|
|
5
5
|
const NodeIcon = (props)=>{
|
|
6
6
|
const icon = props.type;
|
|
7
7
|
const { token } = theme.useToken();
|
|
@@ -30,6 +30,12 @@ const NodeIcon = (props)=>{
|
|
|
30
30
|
if ('HANDLE' === icon) return /*#__PURE__*/ jsx(EditOutlined, {
|
|
31
31
|
style: style
|
|
32
32
|
});
|
|
33
|
+
if ('MANUAL' === icon) return /*#__PURE__*/ jsx(UserOutlined, {
|
|
34
|
+
style: style
|
|
35
|
+
});
|
|
36
|
+
if ('MANUAL_BRANCH' === icon) return /*#__PURE__*/ jsx(UserOutlined, {
|
|
37
|
+
style: style
|
|
38
|
+
});
|
|
33
39
|
if ('INCLUSIVE' === icon) return /*#__PURE__*/ jsx(MergeOutlined, {
|
|
34
40
|
style: style
|
|
35
41
|
});
|
|
@@ -48,7 +54,7 @@ const NodeIcon = (props)=>{
|
|
|
48
54
|
if ('ROUTER' === icon) return /*#__PURE__*/ jsx(PullRequestOutlined, {
|
|
49
55
|
style: style
|
|
50
56
|
});
|
|
51
|
-
if ('START' === icon) return /*#__PURE__*/ jsx(
|
|
57
|
+
if ('START' === icon) return /*#__PURE__*/ jsx(StarOutlined, {
|
|
52
58
|
style: style
|
|
53
59
|
});
|
|
54
60
|
if ('SUB_PROCESS' === icon) return /*#__PURE__*/ jsx(ShareAltOutlined, {
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { useIsSidebar } from "../../hooks/index.js";
|
|
4
|
+
import { Flex, Input, Space, theme } from "antd";
|
|
5
|
+
import { Field, useClientContext } from "@flowgram.ai/fixed-layout-editor";
|
|
6
|
+
import { EditOutlined } from "@ant-design/icons";
|
|
7
|
+
import { NodeIcon } from "../../components/node-icon/index.js";
|
|
8
|
+
import { useNodeRenderContext } from "../../hooks/use-node-render-context.js";
|
|
9
|
+
const HeaderTitle = ({ title, onChange, readonly })=>{
|
|
10
|
+
const { token } = theme.useToken();
|
|
11
|
+
const [editTitle, setEditTitle] = useState(false);
|
|
12
|
+
const ctx = useClientContext();
|
|
13
|
+
const { playground } = ctx;
|
|
14
|
+
const canAddBranch = playground.config.readonlyOrDisabled;
|
|
15
|
+
const handleChange = useCallback((value)=>{
|
|
16
|
+
const trimmed = value.trim();
|
|
17
|
+
if (trimmed) onChange(trimmed);
|
|
18
|
+
}, [
|
|
19
|
+
onChange
|
|
20
|
+
]);
|
|
21
|
+
if (readonly || canAddBranch) return /*#__PURE__*/ jsx("span", {
|
|
22
|
+
children: title
|
|
23
|
+
});
|
|
24
|
+
if (editTitle) return /*#__PURE__*/ jsx(Input, {
|
|
25
|
+
autoFocus: true,
|
|
26
|
+
size: "small",
|
|
27
|
+
style: {
|
|
28
|
+
width: 200
|
|
29
|
+
},
|
|
30
|
+
defaultValue: title,
|
|
31
|
+
onChange: (e)=>{
|
|
32
|
+
handleChange(e.target.value);
|
|
33
|
+
},
|
|
34
|
+
onBlur: ()=>setEditTitle(false),
|
|
35
|
+
onPressEnter: (e)=>{
|
|
36
|
+
handleChange(e.target.value);
|
|
37
|
+
setEditTitle(false);
|
|
38
|
+
},
|
|
39
|
+
placeholder: "请输入标题名称"
|
|
40
|
+
});
|
|
41
|
+
return /*#__PURE__*/ jsxs(Space, {
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ jsx("span", {
|
|
44
|
+
children: title
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ jsx(EditOutlined, {
|
|
47
|
+
style: {
|
|
48
|
+
color: token.colorPrimary,
|
|
49
|
+
cursor: "pointer"
|
|
50
|
+
},
|
|
51
|
+
onClick: ()=>setEditTitle(true)
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const ManualTitle = (props)=>{
|
|
57
|
+
const { node } = useNodeRenderContext();
|
|
58
|
+
const isSidebar = useIsSidebar();
|
|
59
|
+
const iconEnable = props.iconEnable ?? true;
|
|
60
|
+
const nodeType = node.getNodeRegistry().type;
|
|
61
|
+
const headerStyle = {
|
|
62
|
+
width: "100%",
|
|
63
|
+
padding: isSidebar ? "4px 5px" : "5px",
|
|
64
|
+
borderBottom: "1px solid #f0f0f0",
|
|
65
|
+
marginBottom: 8,
|
|
66
|
+
position: "relative",
|
|
67
|
+
...props.style
|
|
68
|
+
};
|
|
69
|
+
return /*#__PURE__*/ jsx(Flex, {
|
|
70
|
+
style: headerStyle,
|
|
71
|
+
justify: "space-between",
|
|
72
|
+
align: "center",
|
|
73
|
+
children: /*#__PURE__*/ jsxs(Space, {
|
|
74
|
+
children: [
|
|
75
|
+
iconEnable && /*#__PURE__*/ jsx(NodeIcon, {
|
|
76
|
+
type: nodeType
|
|
77
|
+
}),
|
|
78
|
+
/*#__PURE__*/ jsx(Field, {
|
|
79
|
+
name: "title",
|
|
80
|
+
children: ({ field: { value, onChange } })=>/*#__PURE__*/ jsx(HeaderTitle, {
|
|
81
|
+
title: value,
|
|
82
|
+
onChange: onChange
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
export { ManualTitle };
|
|
@@ -13,6 +13,8 @@ import { ParallelBranchNodeRegistry } from "./parallel-branch/index.js";
|
|
|
13
13
|
import { RouterNodeRegistry } from "./router/index.js";
|
|
14
14
|
import { SubProcessNodeRegistry } from "./sub-process/index.js";
|
|
15
15
|
import { TriggerNodeRegistry } from "./trigger/index.js";
|
|
16
|
+
import { ManualNodeRegistry } from "./manual/index.js";
|
|
17
|
+
import { ManualBranchNodeRegistry } from "./manual-branch/index.js";
|
|
16
18
|
const FlowNodeRegistries = [
|
|
17
19
|
ApprovalNodeRegistry,
|
|
18
20
|
ConditionNodeRegistry,
|
|
@@ -22,6 +24,8 @@ const FlowNodeRegistries = [
|
|
|
22
24
|
HandleNodeRegistry,
|
|
23
25
|
InclusiveNodeRegistry,
|
|
24
26
|
InclusiveBranchNodeRegistry,
|
|
27
|
+
ManualNodeRegistry,
|
|
28
|
+
ManualBranchNodeRegistry,
|
|
25
29
|
NotifyNodeRegistry,
|
|
26
30
|
ParallelNodeRegistry,
|
|
27
31
|
ParallelBranchNodeRegistry,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FormMeta, FormRenderProps } from '@flowgram.ai/fixed-layout-editor';
|
|
2
|
+
import { FlowNodeJSON } from '../../typings';
|
|
3
|
+
export declare const renderForm: (data: FormRenderProps<FlowNodeJSON["data"]>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const formMeta: FormMeta<FlowNodeJSON['data']>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { provideJsonSchemaOutputs, syncVariableTitle } from "@flowgram.ai/form-materials";
|
|
3
|
+
import { ValidateTrigger } from "@flowgram.ai/fixed-layout-editor";
|
|
4
|
+
import { BranchAdderRender } from "../../components/branch-adder/index.js";
|
|
5
|
+
import { NodePanel } from "../../node-components/panel/index.js";
|
|
6
|
+
const renderForm = (data)=>/*#__PURE__*/ jsx(NodePanel, {
|
|
7
|
+
data: data,
|
|
8
|
+
children: /*#__PURE__*/ jsx(BranchAdderRender, {
|
|
9
|
+
buttonText: '添加条件分支',
|
|
10
|
+
addType: 'MANUAL_BRANCH'
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
const formMeta = {
|
|
14
|
+
render: renderForm,
|
|
15
|
+
validateTrigger: ValidateTrigger.onChange,
|
|
16
|
+
validate: {
|
|
17
|
+
title: ({ value })=>value ? void 0 : 'Title is required'
|
|
18
|
+
},
|
|
19
|
+
effect: {
|
|
20
|
+
title: syncVariableTitle,
|
|
21
|
+
outputs: provideJsonSchemaOutputs
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export { formMeta, renderForm };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { formMeta } from "./form-meta.js";
|
|
2
|
+
import { FlowNodeSplitType } from "@flowgram.ai/fixed-layout-editor";
|
|
3
|
+
const ManualNodeRegistry = {
|
|
4
|
+
type: 'MANUAL',
|
|
5
|
+
extend: FlowNodeSplitType.DYNAMIC_SPLIT,
|
|
6
|
+
meta: {
|
|
7
|
+
copyDisable: true,
|
|
8
|
+
addDisable: false,
|
|
9
|
+
expandable: false,
|
|
10
|
+
sidebarDisable: true,
|
|
11
|
+
style: {
|
|
12
|
+
width: '100%'
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
info: {
|
|
16
|
+
icon: 'MANUAL',
|
|
17
|
+
description: '人工控制'
|
|
18
|
+
},
|
|
19
|
+
formMeta: formMeta
|
|
20
|
+
};
|
|
21
|
+
export { ManualNodeRegistry };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FormMeta, FormRenderProps } from '@flowgram.ai/fixed-layout-editor';
|
|
2
|
+
import { FlowNodeJSON } from '../../typings';
|
|
3
|
+
export declare const renderForm: (data: FormRenderProps<FlowNodeJSON["data"]>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const formMeta: FormMeta<FlowNodeJSON['data']>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { provideJsonSchemaOutputs, syncVariableTitle } from "@flowgram.ai/form-materials";
|
|
3
|
+
import { ValidateTrigger } from "@flowgram.ai/fixed-layout-editor";
|
|
4
|
+
import { NodePanel } from "../../node-components/panel/index.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { ManualTitle } from "../../node-components/manual-title/index.js";
|
|
7
|
+
const renderForm = (data)=>/*#__PURE__*/ jsx(NodePanel, {
|
|
8
|
+
data: data,
|
|
9
|
+
children: /*#__PURE__*/ jsx(ManualTitle, {})
|
|
10
|
+
});
|
|
11
|
+
const formMeta = {
|
|
12
|
+
render: renderForm,
|
|
13
|
+
validateTrigger: ValidateTrigger.onChange,
|
|
14
|
+
validate: {
|
|
15
|
+
title: ({ value })=>value ? void 0 : 'Title is required'
|
|
16
|
+
},
|
|
17
|
+
effect: {
|
|
18
|
+
title: syncVariableTitle,
|
|
19
|
+
outputs: provideJsonSchemaOutputs
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export { formMeta, renderForm };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { formMeta } from "./form-meta.js";
|
|
2
|
+
import { nanoid } from "nanoid";
|
|
3
|
+
const ManualBranchNodeRegistry = {
|
|
4
|
+
type: 'MANUAL_BRANCH',
|
|
5
|
+
extend: 'block',
|
|
6
|
+
meta: {
|
|
7
|
+
copyDisable: true,
|
|
8
|
+
addDisable: true,
|
|
9
|
+
sidebarDisable: true
|
|
10
|
+
},
|
|
11
|
+
info: {
|
|
12
|
+
icon: 'MANUAL_BRANCH',
|
|
13
|
+
description: '分支节点'
|
|
14
|
+
},
|
|
15
|
+
formMeta: formMeta,
|
|
16
|
+
onAdd (ctx, from) {
|
|
17
|
+
return {
|
|
18
|
+
id: `manual_branch_${nanoid(5)}`,
|
|
19
|
+
type: 'MANUAL_BRANCH',
|
|
20
|
+
data: {
|
|
21
|
+
title: "条件分支节点",
|
|
22
|
+
value: 'manal Value'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export { ManualBranchNodeRegistry };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coding-flow/flow-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "flow-engine design components ",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -54,16 +54,16 @@
|
|
|
54
54
|
"nanoid": "^5.1.6",
|
|
55
55
|
"react-redux": "^9.2.0",
|
|
56
56
|
"styled-components": "^5.3.11",
|
|
57
|
-
"@coding-flow/flow-core": "0.0.
|
|
58
|
-
"@coding-flow/flow-
|
|
59
|
-
"@coding-flow/flow-
|
|
60
|
-
"@coding-flow/flow-
|
|
57
|
+
"@coding-flow/flow-core": "0.0.7",
|
|
58
|
+
"@coding-flow/flow-pc-ui": "0.0.7",
|
|
59
|
+
"@coding-flow/flow-types": "0.0.7",
|
|
60
|
+
"@coding-flow/flow-icons": "0.0.7"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/lodash-es": "^4.17.12",
|
|
64
64
|
"@types/styled-components": "^5.1.36",
|
|
65
|
-
"@coding-flow/flow-
|
|
66
|
-
"@coding-flow/flow-
|
|
65
|
+
"@coding-flow/flow-types": "0.0.7",
|
|
66
|
+
"@coding-flow/flow-core": "0.0.7"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "rslib build",
|