@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,182 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
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); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
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; }
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
import $i18n from "../../i18n";
|
|
14
|
+
import { generateUniqueName } from "../../utils";
|
|
15
|
+
import uniqueId from "../../utils/unique-id";
|
|
16
|
+
import { Button } from '@agentscope-ai/design';
|
|
17
|
+
import { SparkDeleteLine, SparkPlusLine } from '@agentscope-ai/icons';
|
|
18
|
+
import { Flex } from 'antd';
|
|
19
|
+
import classNames from 'classnames';
|
|
20
|
+
import React, { memo, useCallback } from 'react';
|
|
21
|
+
import BranchTitleHeader from "../branch-title-header";
|
|
22
|
+
import ConditionItem from "../condition-item";
|
|
23
|
+
import "./index.less";
|
|
24
|
+
export default /*#__PURE__*/memo(function JudgeForm(props) {
|
|
25
|
+
var _props$value = props.value,
|
|
26
|
+
value = _props$value === void 0 ? [] : _props$value,
|
|
27
|
+
onChange = props.onChange,
|
|
28
|
+
disabled = props.disabled,
|
|
29
|
+
areaStyle = props.areaStyle;
|
|
30
|
+
var changeBranchItem = useCallback(function (id, payload) {
|
|
31
|
+
onChange(value.map(function (item) {
|
|
32
|
+
return item.id === id ? _objectSpread(_objectSpread({}, item), payload) : item;
|
|
33
|
+
}));
|
|
34
|
+
}, [value, onChange]);
|
|
35
|
+
var changeConditionItem = useCallback(function (branchId, condIndex, payload) {
|
|
36
|
+
var _value$find;
|
|
37
|
+
changeBranchItem(branchId, {
|
|
38
|
+
conditions: ((_value$find = value.find(function (item) {
|
|
39
|
+
return item.id === branchId;
|
|
40
|
+
})) === null || _value$find === void 0 || (_value$find = _value$find.conditions) === null || _value$find === void 0 ? void 0 : _value$find.map(function (item, index) {
|
|
41
|
+
return index === condIndex ? _objectSpread(_objectSpread({}, item), payload) : item;
|
|
42
|
+
})) || []
|
|
43
|
+
});
|
|
44
|
+
}, [value, changeBranchItem]);
|
|
45
|
+
var addBranchItem = useCallback(function () {
|
|
46
|
+
onChange([].concat(_toConsumableArray(value), [{
|
|
47
|
+
id: uniqueId(4),
|
|
48
|
+
label: generateUniqueName($i18n.get({
|
|
49
|
+
id: 'spark-flow.JudgeForm.index.newConditionGroup',
|
|
50
|
+
dm: '新条件组'
|
|
51
|
+
}), value.map(function (item) {
|
|
52
|
+
return item.label;
|
|
53
|
+
})),
|
|
54
|
+
logic: 'and',
|
|
55
|
+
conditions: [{
|
|
56
|
+
left: {
|
|
57
|
+
value_from: 'refer',
|
|
58
|
+
type: 'String',
|
|
59
|
+
value: void 0
|
|
60
|
+
},
|
|
61
|
+
right: {
|
|
62
|
+
value_from: 'input',
|
|
63
|
+
type: 'String',
|
|
64
|
+
value: void 0
|
|
65
|
+
},
|
|
66
|
+
operator: void 0
|
|
67
|
+
}]
|
|
68
|
+
}]));
|
|
69
|
+
}, [value]);
|
|
70
|
+
var addConditionItem = useCallback(function (branchId) {
|
|
71
|
+
var targetBranch = value.find(function (item) {
|
|
72
|
+
return item.id === branchId;
|
|
73
|
+
});
|
|
74
|
+
if (!targetBranch) return;
|
|
75
|
+
changeBranchItem(branchId, {
|
|
76
|
+
conditions: [].concat(_toConsumableArray(targetBranch.conditions || []), [{
|
|
77
|
+
left: {
|
|
78
|
+
value_from: 'refer',
|
|
79
|
+
type: 'String',
|
|
80
|
+
value: void 0
|
|
81
|
+
},
|
|
82
|
+
right: {
|
|
83
|
+
value_from: 'input',
|
|
84
|
+
type: 'String',
|
|
85
|
+
value: void 0
|
|
86
|
+
},
|
|
87
|
+
operator: void 0
|
|
88
|
+
}])
|
|
89
|
+
});
|
|
90
|
+
}, [value, changeBranchItem]);
|
|
91
|
+
var deleteConditionItem = useCallback(function (branchId, condIndex) {
|
|
92
|
+
var _value$find2;
|
|
93
|
+
changeBranchItem(branchId, {
|
|
94
|
+
conditions: ((_value$find2 = value.find(function (item) {
|
|
95
|
+
return item.id === branchId;
|
|
96
|
+
})) === null || _value$find2 === void 0 || (_value$find2 = _value$find2.conditions) === null || _value$find2 === void 0 ? void 0 : _value$find2.filter(function (_, index) {
|
|
97
|
+
return index !== condIndex;
|
|
98
|
+
})) || []
|
|
99
|
+
});
|
|
100
|
+
}, [value, changeBranchItem]);
|
|
101
|
+
var _deleteBranchItem = useCallback(function (branchId) {
|
|
102
|
+
onChange(value.filter(function (item) {
|
|
103
|
+
return item.id !== branchId;
|
|
104
|
+
}));
|
|
105
|
+
}, [value, onChange]);
|
|
106
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, value.map(function (item) {
|
|
107
|
+
if (item.id === 'default') return null;
|
|
108
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
109
|
+
key: item.id
|
|
110
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
111
|
+
key: item.id,
|
|
112
|
+
style: areaStyle,
|
|
113
|
+
className: "spark-flow-panel-form-section"
|
|
114
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
115
|
+
vertical: true,
|
|
116
|
+
gap: 16
|
|
117
|
+
}, /*#__PURE__*/React.createElement(BranchTitleHeader, {
|
|
118
|
+
data: item,
|
|
119
|
+
onChange: function onChange(payload) {
|
|
120
|
+
return changeBranchItem(item.id, payload);
|
|
121
|
+
},
|
|
122
|
+
deleteBranchItem: function deleteBranchItem() {
|
|
123
|
+
return _deleteBranchItem(item.id);
|
|
124
|
+
},
|
|
125
|
+
branches: value,
|
|
126
|
+
disabled: disabled
|
|
127
|
+
}), (item.conditions || []).map(function (condition, index) {
|
|
128
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
129
|
+
key: index,
|
|
130
|
+
gap: 8
|
|
131
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
132
|
+
className: "flex-1 flex-start"
|
|
133
|
+
}, /*#__PURE__*/React.createElement(ConditionItem, {
|
|
134
|
+
disabled: disabled,
|
|
135
|
+
onChange: function onChange(val) {
|
|
136
|
+
return changeConditionItem(item.id, index, val);
|
|
137
|
+
},
|
|
138
|
+
value: condition,
|
|
139
|
+
leftVariableList: props.leftVariableList,
|
|
140
|
+
rightVariableList: props.rightVariableList
|
|
141
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
142
|
+
className: classNames('py-[8px] flex-shrink-0', 'spark-flow-judge-form-delete-btn-wrap')
|
|
143
|
+
}, /*#__PURE__*/React.createElement(SparkDeleteLine, {
|
|
144
|
+
onClick: function onClick() {
|
|
145
|
+
deleteConditionItem(item.id, index);
|
|
146
|
+
},
|
|
147
|
+
className: disabled ? 'disabled-icon-btn' : '',
|
|
148
|
+
size: 16,
|
|
149
|
+
style: {
|
|
150
|
+
cursor: disabled ? 'not-allowed' : 'pointer'
|
|
151
|
+
}
|
|
152
|
+
})));
|
|
153
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
154
|
+
className: "pr-[24px]"
|
|
155
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
156
|
+
onClick: function onClick() {
|
|
157
|
+
return addConditionItem(item.id);
|
|
158
|
+
},
|
|
159
|
+
icon: /*#__PURE__*/React.createElement(SparkPlusLine, null),
|
|
160
|
+
type: "dashed",
|
|
161
|
+
disabled: disabled,
|
|
162
|
+
className: "spark-flow-judge-form-add-branch-btn"
|
|
163
|
+
}, $i18n.get({
|
|
164
|
+
id: 'spark-flow.JudgeForm.index.addCondition',
|
|
165
|
+
dm: '添加条件'
|
|
166
|
+
}))))));
|
|
167
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
168
|
+
style: areaStyle,
|
|
169
|
+
className: "spark-flow-panel-form-section"
|
|
170
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
171
|
+
onClick: function onClick() {
|
|
172
|
+
return addBranchItem();
|
|
173
|
+
},
|
|
174
|
+
icon: /*#__PURE__*/React.createElement(SparkPlusLine, null),
|
|
175
|
+
type: "dashed",
|
|
176
|
+
className: "spark-flow-judge-form-add-branch-btn",
|
|
177
|
+
disabled: disabled
|
|
178
|
+
}, $i18n.get({
|
|
179
|
+
id: 'spark-flow.JudgeForm.index.addConditionGroup',
|
|
180
|
+
dm: '添加条件组'
|
|
181
|
+
}))));
|
|
182
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IPointItem } from "../../types/work-flow";
|
|
2
|
+
import { SparkIconProps } from '@agentscope-ai/icons/src/utils';
|
|
3
|
+
import { TooltipPlacement } from 'antd/es/tooltip';
|
|
4
|
+
import React, { ReactNode } from 'react';
|
|
5
|
+
import './index.less';
|
|
6
|
+
export interface INodeMenuItemProps {
|
|
7
|
+
data: {
|
|
8
|
+
title: string;
|
|
9
|
+
type: string;
|
|
10
|
+
iconType: (props: SparkIconProps) => ReactNode;
|
|
11
|
+
desc: string;
|
|
12
|
+
};
|
|
13
|
+
onDragStart: (event: React.DragEvent<HTMLDivElement>, nodeType: string) => void;
|
|
14
|
+
draggable?: boolean;
|
|
15
|
+
onClick: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const NodeMenuItem: React.MemoExoticComponent<(props: INodeMenuItemProps) => React.JSX.Element>;
|
|
18
|
+
interface IProps {
|
|
19
|
+
source?: IPointItem;
|
|
20
|
+
target?: IPointItem;
|
|
21
|
+
onSelect?: (data: INodeMenuItemProps['data']) => void | boolean;
|
|
22
|
+
disableDrag?: boolean;
|
|
23
|
+
parentId?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const NodeMenu: React.MemoExoticComponent<(props: IProps) => React.JSX.Element>;
|
|
26
|
+
interface IPopoverNodeMenuProps extends IProps {
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
onOpenChange?: (open: boolean) => void;
|
|
29
|
+
placement?: TooltipPlacement;
|
|
30
|
+
disableDrag?: boolean;
|
|
31
|
+
getPopupContainer?: () => HTMLElement;
|
|
32
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
33
|
+
}
|
|
34
|
+
export declare const PopoverNodeMenu: React.MemoExoticComponent<(props: IPopoverNodeMenuProps) => React.JSX.Element>;
|
|
35
|
+
export default NodeMenu;
|
|
@@ -0,0 +1,266 @@
|
|
|
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 { useStore } from "../../flow/context";
|
|
8
|
+
import { useNodesReadOnly } from "../../hooks";
|
|
9
|
+
import { useNodesInteraction } from "../../hooks/use-nodes-interaction";
|
|
10
|
+
import $i18n from "../../i18n";
|
|
11
|
+
import { Empty, Input, Popover } from '@agentscope-ai/design';
|
|
12
|
+
import { SparkSearchLine } from '@agentscope-ai/icons';
|
|
13
|
+
import { useNodes } from '@xyflow/react';
|
|
14
|
+
import { debounce, groupBy } from 'lodash-es';
|
|
15
|
+
import React, { memo, useCallback, useEffect, useMemo, useState } from 'react';
|
|
16
|
+
import FlowIcon from "../flow-icon";
|
|
17
|
+
import "./index.less";
|
|
18
|
+
export var NodeMenuItem = /*#__PURE__*/memo(function (props) {
|
|
19
|
+
var data = props.data,
|
|
20
|
+
onDragStart = props.onDragStart;
|
|
21
|
+
var _useState = useState(false),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
open = _useState2[0],
|
|
24
|
+
setOpen = _useState2[1];
|
|
25
|
+
var _dragStart = useCallback(function (event) {
|
|
26
|
+
onDragStart(event, data.type);
|
|
27
|
+
setOpen(false);
|
|
28
|
+
}, [onDragStart, data.type]);
|
|
29
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
30
|
+
key: data.type,
|
|
31
|
+
placement: "left",
|
|
32
|
+
arrow: false,
|
|
33
|
+
onOpenChange: setOpen,
|
|
34
|
+
open: open,
|
|
35
|
+
destroyTooltipOnHide: true,
|
|
36
|
+
getPopupContainer: function getPopupContainer() {
|
|
37
|
+
return document.querySelector('.spark-flow-node-menu') || document.body;
|
|
38
|
+
},
|
|
39
|
+
content: /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: "spark-flow-node-menu-item-info"
|
|
41
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: 'cursor-pointer spark-flow-node-menu-item-info-title flex items-center gap-[8px]'
|
|
43
|
+
}, /*#__PURE__*/React.createElement(FlowIcon, {
|
|
44
|
+
nodeType: data.type
|
|
45
|
+
}), /*#__PURE__*/React.createElement("span", null, data.title)), /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: "spark-flow-node-menu-item-info-desc"
|
|
47
|
+
}, data.desc))
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
draggable: props.draggable,
|
|
50
|
+
onDragStart: _dragStart,
|
|
51
|
+
onClick: props.onClick,
|
|
52
|
+
className: 'spark-flow-node-menu-item cursor-pointer flex items-center gap-[8px] h-9'
|
|
53
|
+
}, /*#__PURE__*/React.createElement(FlowIcon, {
|
|
54
|
+
nodeType: data.type
|
|
55
|
+
}), /*#__PURE__*/React.createElement("span", null, data.title)));
|
|
56
|
+
});
|
|
57
|
+
var generateMenuList = function generateMenuList(_ref) {
|
|
58
|
+
var nodeSchemaMap = _ref.nodeSchemaMap,
|
|
59
|
+
searchValue = _ref.searchValue,
|
|
60
|
+
hasParent = _ref.hasParent,
|
|
61
|
+
parentNodeType = _ref.parentNodeType;
|
|
62
|
+
var list = [];
|
|
63
|
+
Object.keys(nodeSchemaMap).forEach(function (nodeTypeKey) {
|
|
64
|
+
if (nodeSchemaMap[nodeTypeKey].hideInMenu) return;
|
|
65
|
+
if (hasParent && nodeSchemaMap[nodeTypeKey].isGroup) return;
|
|
66
|
+
|
|
67
|
+
// 判断 disableInGroup
|
|
68
|
+
if (hasParent && nodeSchemaMap[nodeTypeKey].disableInGroup) {
|
|
69
|
+
var disableInGroup = nodeSchemaMap[nodeTypeKey].disableInGroup;
|
|
70
|
+
if (typeof disableInGroup === 'boolean') {
|
|
71
|
+
return;
|
|
72
|
+
} else if (Array.isArray(disableInGroup) && parentNodeType && disableInGroup.includes(parentNodeType)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
var nodeSchemaItem = nodeSchemaMap[nodeTypeKey];
|
|
77
|
+
if (searchValue && !nodeSchemaItem.title.toLowerCase().includes(searchValue.toLowerCase())) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
list.push({
|
|
81
|
+
title: nodeSchemaItem.title,
|
|
82
|
+
type: nodeSchemaItem.type,
|
|
83
|
+
desc: nodeSchemaItem.desc,
|
|
84
|
+
iconType: nodeSchemaItem.iconType,
|
|
85
|
+
group: nodeSchemaItem.groupLabel
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
return list;
|
|
89
|
+
};
|
|
90
|
+
export var NodeMenu = /*#__PURE__*/memo(function (props) {
|
|
91
|
+
var NodeMenuItemRenderer = useStore(function (store) {
|
|
92
|
+
return store.NodeMenuItemRenderer;
|
|
93
|
+
});
|
|
94
|
+
var nodeSchemaMap = useStore(function (store) {
|
|
95
|
+
return store.nodeSchemaMap;
|
|
96
|
+
});
|
|
97
|
+
var nodes = useNodes();
|
|
98
|
+
var _useNodesInteraction = useNodesInteraction(),
|
|
99
|
+
onAddNewNodeWithSource = _useNodesInteraction.onAddNewNodeWithSource;
|
|
100
|
+
var _useState3 = useState(''),
|
|
101
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
102
|
+
searchValue = _useState4[0],
|
|
103
|
+
setSearchValue = _useState4[1];
|
|
104
|
+
var setIsDragging = useStore(function (state) {
|
|
105
|
+
return state.setIsDragging;
|
|
106
|
+
});
|
|
107
|
+
var _useNodesReadOnly = useNodesReadOnly(),
|
|
108
|
+
nodesReadOnly = _useNodesReadOnly.nodesReadOnly;
|
|
109
|
+
var parentNode = useMemo(function () {
|
|
110
|
+
return nodes.find(function (node) {
|
|
111
|
+
return node.id === props.parentId;
|
|
112
|
+
});
|
|
113
|
+
}, [nodes, props.parentId]);
|
|
114
|
+
var _useState5 = useState(generateMenuList({
|
|
115
|
+
nodeSchemaMap: nodeSchemaMap,
|
|
116
|
+
searchValue: searchValue,
|
|
117
|
+
hasParent: !!props.parentId,
|
|
118
|
+
parentNodeType: parentNode === null || parentNode === void 0 ? void 0 : parentNode.type
|
|
119
|
+
})),
|
|
120
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
121
|
+
menuList = _useState6[0],
|
|
122
|
+
setMenuList = _useState6[1];
|
|
123
|
+
var debouncedSetMenuList = useCallback(debounce(function (params) {
|
|
124
|
+
setMenuList(generateMenuList(params));
|
|
125
|
+
}, 300), []);
|
|
126
|
+
useEffect(function () {
|
|
127
|
+
debouncedSetMenuList({
|
|
128
|
+
nodeSchemaMap: nodeSchemaMap,
|
|
129
|
+
searchValue: searchValue,
|
|
130
|
+
hasParent: !!props.parentId,
|
|
131
|
+
parentNodeType: parentNode === null || parentNode === void 0 ? void 0 : parentNode.type
|
|
132
|
+
});
|
|
133
|
+
return function () {
|
|
134
|
+
debouncedSetMenuList.cancel();
|
|
135
|
+
};
|
|
136
|
+
}, [nodeSchemaMap, searchValue, props.parentId, parentNode, debouncedSetMenuList]);
|
|
137
|
+
var groupList = useMemo(function () {
|
|
138
|
+
if (!menuList) return [];
|
|
139
|
+
var groups = groupBy(menuList, function (item) {
|
|
140
|
+
return item.group || $i18n.get({
|
|
141
|
+
id: 'spark-flow.components.NodeMenu.index.ungrouped',
|
|
142
|
+
dm: '未分组'
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
return Object.entries(groups).map(function (_ref2) {
|
|
146
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
147
|
+
group = _ref3[0],
|
|
148
|
+
items = _ref3[1];
|
|
149
|
+
return {
|
|
150
|
+
group: group,
|
|
151
|
+
items: items
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
}, [menuList]);
|
|
155
|
+
var onDragStart = useCallback(function (event, nodeType) {
|
|
156
|
+
event.dataTransfer.setData('application/reactflow', nodeType);
|
|
157
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
158
|
+
setIsDragging(true);
|
|
159
|
+
}, [setIsDragging]);
|
|
160
|
+
var onMenuItemClick = useCallback(function (data) {
|
|
161
|
+
var _nodes$find, _props$onSelect;
|
|
162
|
+
if (!props.source || nodesReadOnly) return;
|
|
163
|
+
var parentId = props.parentId || ((_nodes$find = nodes.find(function (item) {
|
|
164
|
+
var _props$source;
|
|
165
|
+
return item.id === ((_props$source = props.source) === null || _props$source === void 0 ? void 0 : _props$source.id);
|
|
166
|
+
})) === null || _nodes$find === void 0 ? void 0 : _nodes$find.parentId);
|
|
167
|
+
var isPrevent = (_props$onSelect = props.onSelect) === null || _props$onSelect === void 0 ? void 0 : _props$onSelect.call(props, data);
|
|
168
|
+
if (isPrevent !== false) {
|
|
169
|
+
onAddNewNodeWithSource({
|
|
170
|
+
type: data.type,
|
|
171
|
+
parentId: parentId
|
|
172
|
+
}, props.source, props.target);
|
|
173
|
+
}
|
|
174
|
+
}, [props.parentId, props.source, props.target, props.onSelect, nodes]);
|
|
175
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
176
|
+
className: "spark-flow-node-menu h-full flex flex-col"
|
|
177
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
178
|
+
className: "spark-flow-node-menu-search"
|
|
179
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
180
|
+
prefix: /*#__PURE__*/React.createElement(SparkSearchLine, null),
|
|
181
|
+
placeholder: $i18n.get({
|
|
182
|
+
id: 'spark-flow.components.NodeMenu.index.searchNodeName',
|
|
183
|
+
dm: '搜索节点名称'
|
|
184
|
+
}),
|
|
185
|
+
value: searchValue,
|
|
186
|
+
onChange: function onChange(e) {
|
|
187
|
+
return setSearchValue(e.target.value);
|
|
188
|
+
}
|
|
189
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
190
|
+
className: "flex-1 overflow-y-auto nowheel flex flex-col gap-[16px] px-[16px] spark-flow-node-menu-list pb-[16px]"
|
|
191
|
+
}, !groupList.length ? /*#__PURE__*/React.createElement("div", {
|
|
192
|
+
className: "full-center"
|
|
193
|
+
}, /*#__PURE__*/React.createElement(Empty, {
|
|
194
|
+
size: 204,
|
|
195
|
+
description: $i18n.get({
|
|
196
|
+
id: 'main.pages.App.components.MCPSelector.index.noSearchResult',
|
|
197
|
+
dm: '暂无搜索结果'
|
|
198
|
+
})
|
|
199
|
+
})) : groupList.map(function (groupItem, index) {
|
|
200
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
201
|
+
key: index
|
|
202
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
203
|
+
className: "spark-flow-node-menu-group-title"
|
|
204
|
+
}, groupItem.group), groupItem.items.map(function (item) {
|
|
205
|
+
return NodeMenuItemRenderer ? /*#__PURE__*/React.createElement(NodeMenuItemRenderer, {
|
|
206
|
+
onClick: function onClick() {
|
|
207
|
+
return onMenuItemClick(item);
|
|
208
|
+
},
|
|
209
|
+
draggable: !props.disableDrag && !nodesReadOnly,
|
|
210
|
+
onDragStart: onDragStart,
|
|
211
|
+
data: item,
|
|
212
|
+
key: item.type
|
|
213
|
+
}) : /*#__PURE__*/React.createElement(NodeMenuItem, {
|
|
214
|
+
onClick: function onClick() {
|
|
215
|
+
return onMenuItemClick(item);
|
|
216
|
+
},
|
|
217
|
+
draggable: !props.disableDrag && !nodesReadOnly,
|
|
218
|
+
onDragStart: onDragStart,
|
|
219
|
+
data: item,
|
|
220
|
+
key: item.type
|
|
221
|
+
});
|
|
222
|
+
}));
|
|
223
|
+
})));
|
|
224
|
+
});
|
|
225
|
+
export var PopoverNodeMenu = /*#__PURE__*/memo(function (props) {
|
|
226
|
+
var _useState7 = useState(false),
|
|
227
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
228
|
+
open = _useState8[0],
|
|
229
|
+
setOpen = _useState8[1];
|
|
230
|
+
var _useNodesReadOnly2 = useNodesReadOnly(),
|
|
231
|
+
nodesReadOnly = _useNodesReadOnly2.nodesReadOnly;
|
|
232
|
+
var closeOpen = useCallback(function () {
|
|
233
|
+
setOpen(false);
|
|
234
|
+
}, []);
|
|
235
|
+
useEffect(function () {
|
|
236
|
+
var _props$onOpenChange;
|
|
237
|
+
(_props$onOpenChange = props.onOpenChange) === null || _props$onOpenChange === void 0 || _props$onOpenChange.call(props, open);
|
|
238
|
+
}, [open]);
|
|
239
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
240
|
+
placement: props.placement || 'right',
|
|
241
|
+
trigger: "click",
|
|
242
|
+
onOpenChange: setOpen,
|
|
243
|
+
open: open && !nodesReadOnly,
|
|
244
|
+
destroyTooltipOnHide: true,
|
|
245
|
+
getPopupContainer: props.getPopupContainer || function (ele) {
|
|
246
|
+
return ele;
|
|
247
|
+
},
|
|
248
|
+
content: /*#__PURE__*/React.createElement("div", {
|
|
249
|
+
onClick: props.onClick || function (e) {
|
|
250
|
+
return e.stopPropagation();
|
|
251
|
+
},
|
|
252
|
+
className: 'spark-flow-popover-node-menu'
|
|
253
|
+
}, /*#__PURE__*/React.createElement(NodeMenu, {
|
|
254
|
+
disableDrag: props.disableDrag,
|
|
255
|
+
onSelect: function onSelect(data) {
|
|
256
|
+
var _props$onSelect2;
|
|
257
|
+
closeOpen();
|
|
258
|
+
(_props$onSelect2 = props.onSelect) === null || _props$onSelect2 === void 0 || _props$onSelect2.call(props, data);
|
|
259
|
+
},
|
|
260
|
+
source: props.source,
|
|
261
|
+
target: props.target,
|
|
262
|
+
parentId: props.parentId
|
|
263
|
+
}))
|
|
264
|
+
}, props.children);
|
|
265
|
+
});
|
|
266
|
+
export default NodeMenu;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
@import '../../index.less';
|
|
2
|
+
|
|
3
|
+
.spark-flow-drag-node-item-image {
|
|
4
|
+
padding: 16px;
|
|
5
|
+
display: flex;
|
|
6
|
+
gap: 8px;
|
|
7
|
+
align-items: center;
|
|
8
|
+
border-radius: 12px;
|
|
9
|
+
opacity: 0.7;
|
|
10
|
+
width: 320px;
|
|
11
|
+
|
|
12
|
+
&-icon-bg {
|
|
13
|
+
width: 24px;
|
|
14
|
+
height: 24px;
|
|
15
|
+
border-radius: 4px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&-title {
|
|
19
|
+
font-size: 16px;
|
|
20
|
+
font-weight: 600;
|
|
21
|
+
line-height: 24px;
|
|
22
|
+
color: e('var(--@{ant-prefix}-color-text-base)');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.spark-flow-node-menu {
|
|
27
|
+
&-group-title {
|
|
28
|
+
color: e('var(--@{ant-prefix}-color-text-tertiary)');
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
font-size: 12px;
|
|
31
|
+
line-height: 20px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&-item {
|
|
35
|
+
padding: 0 8px 0 0;
|
|
36
|
+
color: e('var(--@{ant-prefix}-color-text)');
|
|
37
|
+
font-weight: 500;
|
|
38
|
+
border-radius: 4px;
|
|
39
|
+
|
|
40
|
+
&:hover {
|
|
41
|
+
background: e('var(--@{ant-prefix}-color-fill-secondary)');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.spark-flow-node-menu-item-info {
|
|
47
|
+
max-width: 274px;
|
|
48
|
+
margin: 0 4px;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
gap: 12px;
|
|
52
|
+
|
|
53
|
+
&-title {
|
|
54
|
+
font-weight: 600;
|
|
55
|
+
line-height: 24px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&-desc {
|
|
59
|
+
font-size: 13px;
|
|
60
|
+
line-height: 20px;
|
|
61
|
+
color: e('var(--@{ant-prefix}-color-text)');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.spark-flow-node-menu-search {
|
|
66
|
+
padding: 8px 16px 16px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.spark-flow-popover-node-menu {
|
|
70
|
+
height: 400px;
|
|
71
|
+
|
|
72
|
+
.spark-flow-node-menu-list {
|
|
73
|
+
padding: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.spark-flow-node-menu-search {
|
|
77
|
+
padding: 4px 0 16px;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
type NodeResizerProps = {
|
|
4
|
+
nodeId: string;
|
|
5
|
+
icon?: JSX.Element;
|
|
6
|
+
minWidth?: number;
|
|
7
|
+
minHeight?: number;
|
|
8
|
+
maxWidth?: number;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ nodeId, icon, minWidth, minHeight, maxWidth, }: NodeResizerProps) => React.JSX.Element>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useNodesInteraction } from "../../hooks";
|
|
2
|
+
import { getCommonConfig } from '@agentscope-ai/design';
|
|
3
|
+
import { NodeResizeControl } from '@xyflow/react';
|
|
4
|
+
import React, { memo } from 'react';
|
|
5
|
+
import "./index.less";
|
|
6
|
+
var Icon = function Icon() {
|
|
7
|
+
var _getCommonConfig = getCommonConfig(),
|
|
8
|
+
antPrefix = _getCommonConfig.antPrefix;
|
|
9
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
width: "16",
|
|
12
|
+
height: "16",
|
|
13
|
+
viewBox: "0 0 16 16",
|
|
14
|
+
fill: "none"
|
|
15
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
16
|
+
d: "M5.19009 11.8398C8.26416 10.6196 10.7144 8.16562 11.9297 5.08904",
|
|
17
|
+
stroke: "var(--".concat(antPrefix, "-color-border-secondary)"),
|
|
18
|
+
strokeWidth: "2",
|
|
19
|
+
strokeLinecap: "round"
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
var NodeResizer = function NodeResizer(_ref) {
|
|
23
|
+
var nodeId = _ref.nodeId,
|
|
24
|
+
_ref$icon = _ref.icon,
|
|
25
|
+
icon = _ref$icon === void 0 ? /*#__PURE__*/React.createElement(Icon, null) : _ref$icon,
|
|
26
|
+
_ref$minWidth = _ref.minWidth,
|
|
27
|
+
minWidth = _ref$minWidth === void 0 ? 320 : _ref$minWidth,
|
|
28
|
+
_ref$minHeight = _ref.minHeight,
|
|
29
|
+
minHeight = _ref$minHeight === void 0 ? 58 : _ref$minHeight,
|
|
30
|
+
maxWidth = _ref.maxWidth;
|
|
31
|
+
var _useNodesInteraction = useNodesInteraction(),
|
|
32
|
+
onNodeResize = _useNodesInteraction.onNodeResize;
|
|
33
|
+
return /*#__PURE__*/React.createElement(NodeResizeControl, {
|
|
34
|
+
position: "bottom-right",
|
|
35
|
+
className: 'spark-flow-node-resizer',
|
|
36
|
+
onResize: function onResize(_, resizeBound) {
|
|
37
|
+
return onNodeResize(resizeBound, nodeId);
|
|
38
|
+
},
|
|
39
|
+
minWidth: minWidth,
|
|
40
|
+
minHeight: minHeight,
|
|
41
|
+
maxWidth: maxWidth
|
|
42
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: 'spark-flow-node-resizer-icon'
|
|
44
|
+
}, icon));
|
|
45
|
+
};
|
|
46
|
+
export default /*#__PURE__*/memo(NodeResizer);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IWorkFlowNodeResultItem } from "../../types/work-flow";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './index.less';
|
|
4
|
+
interface INodeResultPanelProps {
|
|
5
|
+
data: IWorkFlowNodeResultItem;
|
|
6
|
+
onNodeClick?: (nodeId: string) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: React.MemoExoticComponent<(props: INodeResultPanelProps) => React.JSX.Element>;
|
|
9
|
+
export default _default;
|