@agentscope-ai/flow 0.0.1
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/README.zh-CN.md +67 -0
- package/dist/components/base-node/index.d.ts +27 -0
- package/dist/components/base-node/index.js +320 -0
- package/dist/components/base-node/index.less +258 -0
- package/dist/components/branch-title-header/index.d.ts +12 -0
- package/dist/components/branch-title-header/index.js +176 -0
- package/dist/components/branch-title-header/index.less +28 -0
- package/dist/components/check-list-btn/index.d.ts +4 -0
- package/dist/components/check-list-btn/index.js +144 -0
- package/dist/components/check-list-btn/index.less +113 -0
- package/dist/components/code-input/index.d.ts +24 -0
- package/dist/components/code-input/index.js +356 -0
- package/dist/components/code-input/index.less +87 -0
- package/dist/components/condition-item/index.d.ts +13 -0
- package/dist/components/condition-item/index.js +185 -0
- package/dist/components/condition-item/index.less +23 -0
- package/dist/components/custom-connection-line/index.d.ts +4 -0
- package/dist/components/custom-connection-line/index.js +28 -0
- package/dist/components/custom-handle/source-handle.d.ts +10 -0
- package/dist/components/custom-handle/source-handle.js +45 -0
- package/dist/components/custom-handle/target-handle.d.ts +6 -0
- package/dist/components/custom-handle/target-handle.js +21 -0
- package/dist/components/custom-inputs-control/index.d.ts +56 -0
- package/dist/components/custom-inputs-control/index.js +366 -0
- package/dist/components/custom-inputs-control/index.less +28 -0
- package/dist/components/custom-outputs-form/index.d.ts +24 -0
- package/dist/components/custom-outputs-form/index.js +346 -0
- package/dist/components/custom-outputs-form/index.less +51 -0
- package/dist/components/drag-panel/index.d.ts +10 -0
- package/dist/components/drag-panel/index.js +79 -0
- package/dist/components/drag-panel/index.less +23 -0
- package/dist/components/draggable-with-handle/index.d.ts +13 -0
- package/dist/components/draggable-with-handle/index.js +81 -0
- package/dist/components/draggable-with-handle/index.less +23 -0
- package/dist/components/flow-aside/index.d.ts +4 -0
- package/dist/components/flow-aside/index.js +62 -0
- package/dist/components/flow-aside/index.less +84 -0
- package/dist/components/flow-base-edge/index.d.ts +5 -0
- package/dist/components/flow-base-edge/index.js +226 -0
- package/dist/components/flow-base-edge/index.less +28 -0
- package/dist/components/flow-base-edge/linear-gradient-svg.d.ts +21 -0
- package/dist/components/flow-base-edge/linear-gradient-svg.js +32 -0
- package/dist/components/flow-icon/index.d.ts +9 -0
- package/dist/components/flow-icon/index.js +30 -0
- package/dist/components/flow-icon/index.less +20 -0
- package/dist/components/flow-mini-map/index.d.ts +4 -0
- package/dist/components/flow-mini-map/index.js +26 -0
- package/dist/components/flow-mini-map/index.less +22 -0
- package/dist/components/flow-panel/config-panel.d.ts +15 -0
- package/dist/components/flow-panel/config-panel.js +303 -0
- package/dist/components/flow-panel/index.d.ts +7 -0
- package/dist/components/flow-panel/index.js +7 -0
- package/dist/components/flow-panel/index.less +85 -0
- package/dist/components/flow-panel/panel-container.d.ts +12 -0
- package/dist/components/flow-panel/panel-container.js +25 -0
- package/dist/components/flow-tools/add-node-btn.d.ts +3 -0
- package/dist/components/flow-tools/add-node-btn.js +26 -0
- package/dist/components/flow-tools/history-btn.d.ts +3 -0
- package/dist/components/flow-tools/history-btn.js +59 -0
- package/dist/components/flow-tools/index.d.ts +4 -0
- package/dist/components/flow-tools/index.js +29 -0
- package/dist/components/flow-tools/index.less +82 -0
- package/dist/components/flow-tools/layout-btn.d.ts +3 -0
- package/dist/components/flow-tools/layout-btn.js +27 -0
- package/dist/components/flow-tools/mini-map-btn.d.ts +3 -0
- package/dist/components/flow-tools/mini-map-btn.js +32 -0
- package/dist/components/flow-tools/scale-btn.d.ts +3 -0
- package/dist/components/flow-tools/scale-btn.js +101 -0
- package/dist/components/flow-tools/short-key-btn.d.ts +3 -0
- package/dist/components/flow-tools/short-key-btn.js +38 -0
- package/dist/components/flow-tools/short-key-content.d.ts +4 -0
- package/dist/components/flow-tools/short-key-content.js +153 -0
- package/dist/components/flow-tools/short-key-content.less +38 -0
- package/dist/components/flow-tools/touch-mode-btn.d.ts +3 -0
- package/dist/components/flow-tools/touch-mode-btn.js +89 -0
- package/dist/components/input-text-area/index.d.ts +16 -0
- package/dist/components/input-text-area/index.js +74 -0
- package/dist/components/input-text-area/index.less +30 -0
- package/dist/components/judge-form/index.d.ts +13 -0
- package/dist/components/judge-form/index.js +182 -0
- package/dist/components/judge-form/index.less +11 -0
- package/dist/components/node-menu/index.d.ts +35 -0
- package/dist/components/node-menu/index.js +266 -0
- package/dist/components/node-menu/index.less +79 -0
- package/dist/components/node-resizer/index.d.ts +11 -0
- package/dist/components/node-resizer/index.js +46 -0
- package/dist/components/node-resizer/index.less +12 -0
- package/dist/components/node-result-panel/index.d.ts +9 -0
- package/dist/components/node-result-panel/index.js +155 -0
- package/dist/components/node-result-panel/index.less +132 -0
- package/dist/components/node-tree/index.d.ts +4 -0
- package/dist/components/node-tree/index.js +213 -0
- package/dist/components/node-tree/index.less +51 -0
- package/dist/components/output-params-tree/index.d.ts +10 -0
- package/dist/components/output-params-tree/index.js +34 -0
- package/dist/components/output-params-tree/index.less +27 -0
- package/dist/components/script-code-mirror/index.d.ts +14 -0
- package/dist/components/script-code-mirror/index.js +162 -0
- package/dist/components/script-code-mirror/index.less +11 -0
- package/dist/components/script-edit-modal/index.d.ts +30 -0
- package/dist/components/script-edit-modal/index.js +84 -0
- package/dist/components/script-edit-modal/index.less +24 -0
- package/dist/components/select-with-desc/index.d.ts +5 -0
- package/dist/components/select-with-desc/index.js +20 -0
- package/dist/components/select-with-desc/index.less +11 -0
- package/dist/components/task-status/index.d.ts +4 -0
- package/dist/components/task-status/index.js +209 -0
- package/dist/components/task-status/index.less +65 -0
- package/dist/components/var-input-text-area/index.d.ts +17 -0
- package/dist/components/var-input-text-area/index.js +211 -0
- package/dist/components/var-input-text-area/index.less +64 -0
- package/dist/components/var-type-prefix/index.d.ts +17 -0
- package/dist/components/var-type-prefix/index.js +21 -0
- package/dist/components/variable-input/index.d.ts +24 -0
- package/dist/components/variable-input/index.js +163 -0
- package/dist/components/variable-input/index.less +13 -0
- package/dist/components/variable-tree-select/index.d.ts +33 -0
- package/dist/components/variable-tree-select/index.js +160 -0
- package/dist/components/variable-tree-select/index.less +61 -0
- package/dist/constant/index.d.ts +61 -0
- package/dist/constant/index.js +515 -0
- package/dist/flow/animate.css +5 -0
- package/dist/flow/context.d.ts +12 -0
- package/dist/flow/context.js +44 -0
- package/dist/flow/index.d.ts +13 -0
- package/dist/flow/index.js +162 -0
- package/dist/flow/index.less +72 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.js +10 -0
- package/dist/hooks/use-edges-interaction.d.ts +11 -0
- package/dist/hooks/use-edges-interaction.js +125 -0
- package/dist/hooks/use-flow-debug-interaction.d.ts +5 -0
- package/dist/hooks/use-flow-debug-interaction.js +23 -0
- package/dist/hooks/use-flow-interaction.d.ts +12 -0
- package/dist/hooks/use-flow-interaction.js +173 -0
- package/dist/hooks/use-flow-key-press.d.ts +1 -0
- package/dist/hooks/use-flow-key-press.js +32 -0
- package/dist/hooks/use-flow-save.d.ts +5 -0
- package/dist/hooks/use-flow-save.js +47 -0
- package/dist/hooks/use-flow-view-port.d.ts +7 -0
- package/dist/hooks/use-flow-view-port.js +46 -0
- package/dist/hooks/use-history.d.ts +21 -0
- package/dist/hooks/use-history.js +80 -0
- package/dist/hooks/use-nodes-interaction.d.ts +34 -0
- package/dist/hooks/use-nodes-interaction.js +777 -0
- package/dist/hooks/use-nodes-output-params.d.ts +31 -0
- package/dist/hooks/use-nodes-output-params.js +300 -0
- package/dist/hooks/use-nodes-update.d.ts +9 -0
- package/dist/hooks/use-nodes-update.js +38 -0
- package/dist/hooks/use-work-flow.d.ts +4 -0
- package/dist/hooks/use-work-flow.js +21 -0
- package/dist/i18n/i18n.d.ts +62 -0
- package/dist/i18n/i18n.js +111 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.js +12 -0
- package/dist/i18n/locales/en-us.json +327 -0
- package/dist/i18n/locales/ja-jp.json +300 -0
- package/dist/i18n/locales/zh-cn.json +327 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +47 -0
- package/dist/index.less +1 -0
- package/dist/store/index.d.ts +70 -0
- package/dist/store/index.js +146 -0
- package/dist/tailwind.css +28 -0
- package/dist/types/work-flow.d.ts +188 -0
- package/dist/types/work-flow.js +1 -0
- package/dist/utils/default-values.d.ts +2 -0
- package/dist/utils/default-values.js +16 -0
- package/dist/utils/index.d.ts +39 -0
- package/dist/utils/index.js +273 -0
- package/dist/utils/unique-id.d.ts +2 -0
- package/dist/utils/unique-id.js +39 -0
- package/dist/utils/work-flow.d.ts +17 -0
- package/dist/utils/work-flow.js +44 -0
- package/package.json +78 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import $i18n from "../../i18n";
|
|
8
|
+
import { Select } from '@agentscope-ai/design';
|
|
9
|
+
import { SparkDeleteLine, SparkEditLine, SparkFalseLine, SparkTrueLine } from '@agentscope-ai/icons';
|
|
10
|
+
import { useSetState } from 'ahooks';
|
|
11
|
+
import { Flex, Input, message, Typography } from 'antd';
|
|
12
|
+
import React, { memo, useCallback, useRef } from 'react';
|
|
13
|
+
import "./index.less";
|
|
14
|
+
export default /*#__PURE__*/memo(function BranchTitleHeader(props) {
|
|
15
|
+
var _useSetState = useSetState({
|
|
16
|
+
isEdit: false,
|
|
17
|
+
tempName: props.data.label
|
|
18
|
+
}),
|
|
19
|
+
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
20
|
+
state = _useSetState2[0],
|
|
21
|
+
setState = _useSetState2[1];
|
|
22
|
+
var isComposingRef = useRef(false);
|
|
23
|
+
var handleSure = function handleSure() {
|
|
24
|
+
if (!state.tempName) {
|
|
25
|
+
message.warning($i18n.get({
|
|
26
|
+
id: 'spark-flow.BranchTitleHeader.index.conditionGroupNameEmpty',
|
|
27
|
+
dm: '条件组名称不能为空'
|
|
28
|
+
}));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (props.branches.some(function (item) {
|
|
32
|
+
return item.label === state.tempName && item.id !== props.data.id;
|
|
33
|
+
})) {
|
|
34
|
+
message.warning($i18n.get({
|
|
35
|
+
id: 'spark-flow.BranchTitleHeader.index.conditionGroupNameExists',
|
|
36
|
+
dm: '条件组名称已存在'
|
|
37
|
+
}));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
props.onChange({
|
|
41
|
+
label: state.tempName
|
|
42
|
+
});
|
|
43
|
+
setState({
|
|
44
|
+
isEdit: false
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// handle Chinese input start event
|
|
49
|
+
var handleCompositionStart = useCallback(function () {
|
|
50
|
+
isComposingRef.current = true;
|
|
51
|
+
}, []);
|
|
52
|
+
|
|
53
|
+
// handle Chinese input end event
|
|
54
|
+
var handleCompositionEnd = useCallback(function () {
|
|
55
|
+
isComposingRef.current = false;
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
// handle enter event
|
|
59
|
+
var handlePressEnter = useCallback(function (e) {
|
|
60
|
+
// if Chinese input is ongoing, do not handle enter event
|
|
61
|
+
if (isComposingRef.current) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// trigger confirm operation
|
|
66
|
+
handleSure();
|
|
67
|
+
|
|
68
|
+
// prevent default behavior (such as form submission)
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
}, [handleSure]);
|
|
71
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
72
|
+
justify: "space-between"
|
|
73
|
+
}, state.isEdit ? /*#__PURE__*/React.createElement(Flex, {
|
|
74
|
+
className: "flex-1",
|
|
75
|
+
gap: 8,
|
|
76
|
+
align: "center"
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
78
|
+
onCompositionStart: handleCompositionStart,
|
|
79
|
+
onCompositionEnd: handleCompositionEnd,
|
|
80
|
+
onPressEnter: handlePressEnter,
|
|
81
|
+
value: state.tempName,
|
|
82
|
+
onChange: function onChange(e) {
|
|
83
|
+
return setState({
|
|
84
|
+
tempName: e.target.value
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
placeholder: $i18n.get({
|
|
88
|
+
id: 'spark-flow.BranchTitleHeader.index.enterConditionGroupName',
|
|
89
|
+
dm: '请输入条件组名称'
|
|
90
|
+
})
|
|
91
|
+
}), /*#__PURE__*/React.createElement(SparkTrueLine, {
|
|
92
|
+
onClick: handleSure,
|
|
93
|
+
style: {
|
|
94
|
+
cursor: 'pointer'
|
|
95
|
+
},
|
|
96
|
+
className: "spark-flow-name-input-ok-btn"
|
|
97
|
+
}), /*#__PURE__*/React.createElement(SparkFalseLine, {
|
|
98
|
+
onClick: function onClick() {
|
|
99
|
+
return setState({
|
|
100
|
+
isEdit: false,
|
|
101
|
+
tempName: props.data.label
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
style: {
|
|
105
|
+
cursor: 'pointer'
|
|
106
|
+
}
|
|
107
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Flex, {
|
|
108
|
+
align: "center",
|
|
109
|
+
gap: 16
|
|
110
|
+
}, /*#__PURE__*/React.createElement(Typography.Text, {
|
|
111
|
+
ellipsis: {
|
|
112
|
+
tooltip: props.data.label
|
|
113
|
+
},
|
|
114
|
+
style: {
|
|
115
|
+
maxWidth: 120
|
|
116
|
+
},
|
|
117
|
+
className: "spark-flow-panel-form-title"
|
|
118
|
+
}, props.data.label), /*#__PURE__*/React.createElement(Flex, {
|
|
119
|
+
align: "center",
|
|
120
|
+
gap: 4,
|
|
121
|
+
className: "text-[12px]"
|
|
122
|
+
}, /*#__PURE__*/React.createElement("span", null, $i18n.get({
|
|
123
|
+
id: 'spark-flow.BranchTitleHeader.index.whenSatisfy',
|
|
124
|
+
dm: '当满足以下'
|
|
125
|
+
})), /*#__PURE__*/React.createElement(Select, {
|
|
126
|
+
disabled: props.disabled,
|
|
127
|
+
className: "spark-flow-logic-selector",
|
|
128
|
+
value: props.data.logic,
|
|
129
|
+
onChange: function onChange(val) {
|
|
130
|
+
return props.onChange({
|
|
131
|
+
logic: val
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
options: [{
|
|
135
|
+
label: $i18n.get({
|
|
136
|
+
id: 'spark-flow.BranchTitleHeader.index.all',
|
|
137
|
+
dm: '所有'
|
|
138
|
+
}),
|
|
139
|
+
value: 'and'
|
|
140
|
+
}, {
|
|
141
|
+
label: $i18n.get({
|
|
142
|
+
id: 'spark-flow.BranchTitleHeader.index.any',
|
|
143
|
+
dm: '任意'
|
|
144
|
+
}),
|
|
145
|
+
value: 'or'
|
|
146
|
+
}],
|
|
147
|
+
popupMatchSelectWidth: false,
|
|
148
|
+
size: "small",
|
|
149
|
+
variant: "borderless"
|
|
150
|
+
}), /*#__PURE__*/React.createElement("span", null, $i18n.get({
|
|
151
|
+
id: 'spark-flow.BranchTitleHeader.index.conditions',
|
|
152
|
+
dm: '条件时'
|
|
153
|
+
})))), /*#__PURE__*/React.createElement(Flex, {
|
|
154
|
+
gap: 12
|
|
155
|
+
}, /*#__PURE__*/React.createElement(SparkEditLine, {
|
|
156
|
+
className: props.disabled ? 'disabled-icon-btn' : '',
|
|
157
|
+
onClick: function onClick() {
|
|
158
|
+
if (props.disabled) return;
|
|
159
|
+
setState({
|
|
160
|
+
isEdit: true,
|
|
161
|
+
tempName: props.data.label
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
size: 16,
|
|
165
|
+
style: {
|
|
166
|
+
cursor: props.disabled ? 'not-allowed' : 'pointer'
|
|
167
|
+
}
|
|
168
|
+
}), /*#__PURE__*/React.createElement(SparkDeleteLine, {
|
|
169
|
+
onClick: props.disabled ? void 0 : props.deleteBranchItem,
|
|
170
|
+
className: props.disabled ? 'disabled-icon-btn' : '',
|
|
171
|
+
size: 16,
|
|
172
|
+
style: {
|
|
173
|
+
cursor: props.disabled ? 'not-allowed' : 'pointer'
|
|
174
|
+
}
|
|
175
|
+
}))));
|
|
176
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@import '../../index.less';
|
|
2
|
+
|
|
3
|
+
.spark-flow-name-input-ok-btn {
|
|
4
|
+
color: e('var(--@{ant-prefix}-color-teal)');
|
|
5
|
+
|
|
6
|
+
&:hover {
|
|
7
|
+
color: e('var(--@{ant-prefix}-color-teal)');
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.spark-flow-logic-selector {
|
|
12
|
+
.@{ant-prefix}-select-selection-item {
|
|
13
|
+
font-size: 12px;
|
|
14
|
+
font-weight: 500;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.@{ant-prefix}-select-selector {
|
|
18
|
+
padding: 0 !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.@{ant-prefix}-select-selection-search, .@{ant-prefix}-select-selection-item {
|
|
22
|
+
padding-right: 12px !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.@{ant-prefix}-select-arrow {
|
|
26
|
+
right: 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { useStore } from "../../flow/context";
|
|
2
|
+
import { useNodesInteraction } from "../../hooks";
|
|
3
|
+
import $i18n from "../../i18n";
|
|
4
|
+
import { Empty, IconButton } from '@agentscope-ai/design';
|
|
5
|
+
import { SparkFalseLine, SparkOrganizeAnswerFill, SparkWarningCircleLine } from '@agentscope-ai/icons';
|
|
6
|
+
import { useStore as useFlowStore } from '@xyflow/react';
|
|
7
|
+
import { Badge, Popover, Typography } from 'antd';
|
|
8
|
+
import { debounce } from 'lodash-es';
|
|
9
|
+
import React, { memo, useCallback, useEffect, useMemo } from 'react';
|
|
10
|
+
import FlowIcon from "../flow-icon";
|
|
11
|
+
import "./index.less";
|
|
12
|
+
export default /*#__PURE__*/memo(function CheckListBtn() {
|
|
13
|
+
var showCheckList = useStore(function (state) {
|
|
14
|
+
return state.showCheckList;
|
|
15
|
+
});
|
|
16
|
+
var setShowCheckList = useStore(function (state) {
|
|
17
|
+
return state.setShowCheckList;
|
|
18
|
+
});
|
|
19
|
+
var nodes = useFlowStore(function (store) {
|
|
20
|
+
return store.nodes;
|
|
21
|
+
});
|
|
22
|
+
var edges = useFlowStore(function (store) {
|
|
23
|
+
return store.edges;
|
|
24
|
+
});
|
|
25
|
+
var nodeSchemaMap = useStore(function (store) {
|
|
26
|
+
return store.nodeSchemaMap;
|
|
27
|
+
});
|
|
28
|
+
var checkList = useStore(function (state) {
|
|
29
|
+
return state.checkList;
|
|
30
|
+
});
|
|
31
|
+
var setCheckList = useStore(function (state) {
|
|
32
|
+
return state.setCheckList;
|
|
33
|
+
});
|
|
34
|
+
var _useNodesInteraction = useNodesInteraction(),
|
|
35
|
+
handleNodeClickByNodeId = _useNodesInteraction.handleNodeClickByNodeId;
|
|
36
|
+
var checkNodesList = useCallback(function () {
|
|
37
|
+
var list = [];
|
|
38
|
+
nodes.forEach(function (item) {
|
|
39
|
+
var nodeInfo = nodeSchemaMap[item.type];
|
|
40
|
+
if (!(nodeInfo !== null && nodeInfo !== void 0 && nodeInfo.checkValid)) return;
|
|
41
|
+
var error_msgs = nodeInfo.checkValid(item.data);
|
|
42
|
+
if (error_msgs.length > 0) {
|
|
43
|
+
list.push({
|
|
44
|
+
node_id: item.id,
|
|
45
|
+
error_msgs: error_msgs,
|
|
46
|
+
node_type: item.type,
|
|
47
|
+
node_name: item.data.label
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
setCheckList(list);
|
|
52
|
+
}, [nodes, edges, nodeSchemaMap, setCheckList]);
|
|
53
|
+
var debouncedCheckNodesList = useMemo(function () {
|
|
54
|
+
return debounce(checkNodesList, 300);
|
|
55
|
+
}, [checkNodesList]);
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
debouncedCheckNodesList();
|
|
58
|
+
return function () {
|
|
59
|
+
debouncedCheckNodesList.cancel();
|
|
60
|
+
};
|
|
61
|
+
}, [nodes, edges, debouncedCheckNodesList]);
|
|
62
|
+
var memoCheckList = useMemo(function () {
|
|
63
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: "spark-flow-check-list-header flex-justify-between"
|
|
65
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
66
|
+
className: "spark-flow-check-list-header-title"
|
|
67
|
+
}, $i18n.get({
|
|
68
|
+
id: 'spark-flow.components.CheckListBtn.index.checklistVar1',
|
|
69
|
+
dm: '检查清单 · {var1}'
|
|
70
|
+
}, {
|
|
71
|
+
var1: "".concat(checkList.length)
|
|
72
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "p-[4px] cursor-pointer"
|
|
74
|
+
}, /*#__PURE__*/React.createElement(SparkFalseLine, {
|
|
75
|
+
onClick: function onClick() {
|
|
76
|
+
return setShowCheckList(false);
|
|
77
|
+
},
|
|
78
|
+
className: "spark-flow-operator-icon-with-bg"
|
|
79
|
+
}))), !checkList.length ? /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
className: "spark-flow-check-list-empty flex flex-col items-center"
|
|
81
|
+
}, /*#__PURE__*/React.createElement(Empty, {
|
|
82
|
+
description: $i18n.get({
|
|
83
|
+
id: 'spark-flow.components.CheckListBtn.index.allResolved',
|
|
84
|
+
dm: '所有清单项已解决'
|
|
85
|
+
}),
|
|
86
|
+
type: "success"
|
|
87
|
+
})) : /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "spark-flow-check-list-content px-[8px] pb-[8px] overflow-y-auto flex flex-col gap-[8px]"
|
|
89
|
+
}, checkList.map(function (item) {
|
|
90
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
onClick: function onClick() {
|
|
92
|
+
handleNodeClickByNodeId(item.node_id);
|
|
93
|
+
setShowCheckList(false);
|
|
94
|
+
},
|
|
95
|
+
key: item.node_id,
|
|
96
|
+
className: "spark-flow-node-check-container"
|
|
97
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: "spark-flow-node-check-container-header"
|
|
99
|
+
}, /*#__PURE__*/React.createElement(FlowIcon, {
|
|
100
|
+
size: "small",
|
|
101
|
+
nodeType: item.node_type
|
|
102
|
+
}), /*#__PURE__*/React.createElement(Typography.Text, {
|
|
103
|
+
ellipsis: {
|
|
104
|
+
tooltip: item.node_name
|
|
105
|
+
},
|
|
106
|
+
className: "spark-flow-node-check-container-header-title"
|
|
107
|
+
}, item.node_name)), /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: "spark-flow-node-check-container-content"
|
|
109
|
+
}, item.error_msgs.map(function (msg, index) {
|
|
110
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
111
|
+
className: "spark-flow-node-check-container-content-item",
|
|
112
|
+
key: index
|
|
113
|
+
}, /*#__PURE__*/React.createElement(SparkWarningCircleLine, {
|
|
114
|
+
size: 16,
|
|
115
|
+
className: "spark-flow-node-check-container-content-item-icon"
|
|
116
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
117
|
+
className: "spark-flow-node-check-container-content-item-title"
|
|
118
|
+
}, msg.label), /*#__PURE__*/React.createElement("span", {
|
|
119
|
+
className: "spark-flow-node-check-container-content-item-error"
|
|
120
|
+
}, msg.error));
|
|
121
|
+
})));
|
|
122
|
+
})));
|
|
123
|
+
}, [showCheckList, checkList]);
|
|
124
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
125
|
+
getPopupContainer: function getPopupContainer(ele) {
|
|
126
|
+
return ele;
|
|
127
|
+
},
|
|
128
|
+
content: memoCheckList,
|
|
129
|
+
trigger: 'click',
|
|
130
|
+
placement: "bottomRight",
|
|
131
|
+
open: showCheckList,
|
|
132
|
+
onOpenChange: setShowCheckList
|
|
133
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
134
|
+
className: "spark-flow-check-list-btn"
|
|
135
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
136
|
+
className: "spark-flow-check-list-btn-child",
|
|
137
|
+
icon: /*#__PURE__*/React.createElement(SparkOrganizeAnswerFill, null)
|
|
138
|
+
}, !!checkList.length && /*#__PURE__*/React.createElement(Badge, {
|
|
139
|
+
className: "spark-flow-check-list-btn-count",
|
|
140
|
+
showZero: true,
|
|
141
|
+
count: checkList.length,
|
|
142
|
+
color: "orange"
|
|
143
|
+
}))));
|
|
144
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
@import '../../index.less';
|
|
2
|
+
|
|
3
|
+
.spark-flow-check-list-btn {
|
|
4
|
+
.@{ant-prefix}-popover .@{ant-prefix}-popover-inner {
|
|
5
|
+
padding: 0;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.spark-flow-check-list-header {
|
|
10
|
+
height: 44px;
|
|
11
|
+
padding: 0 12px 0 16px;
|
|
12
|
+
gap: 16px;
|
|
13
|
+
|
|
14
|
+
&-title {
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
font-weight: 500;
|
|
17
|
+
line-height: 20px;
|
|
18
|
+
color: e('var(--@{ant-prefix}-color-text)');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.spark-flow-check-list-btn-child {
|
|
23
|
+
position: relative;
|
|
24
|
+
width: 32px;
|
|
25
|
+
|
|
26
|
+
.spark-flow-check-list-btn-count {
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: -8px;
|
|
29
|
+
right: -8px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.spark-flow-check-list-content {
|
|
34
|
+
max-height: calc(75vh - 44px);
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.spark-flow-node-check-container {
|
|
39
|
+
border-radius: 6px;
|
|
40
|
+
width: 304px;
|
|
41
|
+
background: e('var(--@{ant-prefix}-color-bg-white)');
|
|
42
|
+
border: 1px solid e('var(--@{ant-prefix}-color-border-secondary)');
|
|
43
|
+
transition: 0.4s ease-in-out;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
|
|
46
|
+
&:hover {
|
|
47
|
+
box-shadow: e('var(--@{ant-prefix}-box-shadow)');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&-header {
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
padding: 6px 12px;
|
|
54
|
+
gap: 6px;
|
|
55
|
+
border-radius: 6px 6px 0 0;
|
|
56
|
+
background: e('var(--@{ant-prefix}-color-fill-tertiary)');
|
|
57
|
+
|
|
58
|
+
* {
|
|
59
|
+
flex-shrink: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&-title {
|
|
63
|
+
flex: 1;
|
|
64
|
+
font-size: 12px;
|
|
65
|
+
font-weight: 500;
|
|
66
|
+
line-height: 20px;
|
|
67
|
+
color: e('var(--@{ant-prefix}-color-text-secondary)');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&-content {
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
padding: 8px 12px;
|
|
75
|
+
gap: 4px;
|
|
76
|
+
|
|
77
|
+
&-item {
|
|
78
|
+
display: flex;
|
|
79
|
+
gap: 6px;
|
|
80
|
+
align-items: center;
|
|
81
|
+
|
|
82
|
+
&-icon {
|
|
83
|
+
color: e('var(--@{ant-prefix}-color-warning)');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&-title {
|
|
87
|
+
font-size: 12px;
|
|
88
|
+
font-weight: 500;
|
|
89
|
+
line-height: 20px;
|
|
90
|
+
color: e('var(--@{ant-prefix}-color-text)');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&-error {
|
|
94
|
+
font-size: 12px;
|
|
95
|
+
line-height: 20px;
|
|
96
|
+
color: e('var(--@{ant-prefix}-color-text)');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.spark-flow-check-list-empty {
|
|
103
|
+
gap: 8px;
|
|
104
|
+
width: 320px;
|
|
105
|
+
padding: 58px 0 70px;
|
|
106
|
+
|
|
107
|
+
&-title {
|
|
108
|
+
font-size: 16px;
|
|
109
|
+
font-weight: 500;
|
|
110
|
+
line-height: 24px;
|
|
111
|
+
color: e('var(--@{ant-prefix}-color-text)');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IValueType } from "../../types/work-flow";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './index.less';
|
|
4
|
+
interface CodeInputProps {
|
|
5
|
+
value?: string;
|
|
6
|
+
onChange?: (value: string) => void;
|
|
7
|
+
type: IValueType;
|
|
8
|
+
height?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
isCompact?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
onErrorChange?: (hasErrors: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const CodeInputModal: ({ value, onOk, type, onClose, disabled, onErrorChange, }: {
|
|
16
|
+
value?: string | undefined;
|
|
17
|
+
onOk: (value?: string) => void;
|
|
18
|
+
type: IValueType;
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
disabled?: boolean | undefined;
|
|
21
|
+
onErrorChange?: ((hasErrors: boolean) => void) | undefined;
|
|
22
|
+
}) => React.JSX.Element;
|
|
23
|
+
declare const CodeInput: React.FC<CodeInputProps>;
|
|
24
|
+
export default CodeInput;
|