@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,155 @@
|
|
|
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 _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; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
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); }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
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."); }
|
|
7
|
+
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); }
|
|
8
|
+
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; }
|
|
9
|
+
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; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import { useStore } from "../../flow/context";
|
|
12
|
+
import $i18n from "../../i18n";
|
|
13
|
+
import { Pagination } from '@agentscope-ai/design';
|
|
14
|
+
import { SparkUpLine } from '@agentscope-ai/icons';
|
|
15
|
+
import { Typography } from 'antd';
|
|
16
|
+
import classNames from 'classnames';
|
|
17
|
+
import React, { memo, useMemo, useState } from 'react';
|
|
18
|
+
import "./index.less";
|
|
19
|
+
var statusNameMap = {
|
|
20
|
+
success: $i18n.get({
|
|
21
|
+
id: 'spark-flow.components.NodeResultPanel.index.success',
|
|
22
|
+
dm: '成功'
|
|
23
|
+
}),
|
|
24
|
+
executing: $i18n.get({
|
|
25
|
+
id: 'spark-flow.components.NodeResultPanel.index.executing',
|
|
26
|
+
dm: '执行中'
|
|
27
|
+
}),
|
|
28
|
+
skip: $i18n.get({
|
|
29
|
+
id: 'spark-flow.components.NodeResultPanel.index.skipped',
|
|
30
|
+
dm: '跳过'
|
|
31
|
+
}),
|
|
32
|
+
fail: $i18n.get({
|
|
33
|
+
id: 'spark-flow.components.NodeResultPanel.index.failed',
|
|
34
|
+
dm: '失败'
|
|
35
|
+
}),
|
|
36
|
+
stop: $i18n.get({
|
|
37
|
+
id: 'spark-flow.components.NodeResultPanel.index.stopped',
|
|
38
|
+
dm: '停止'
|
|
39
|
+
}),
|
|
40
|
+
wait: $i18n.get({
|
|
41
|
+
id: 'spark-flow.components.NodeResultPanel.index.paused',
|
|
42
|
+
dm: '暂停'
|
|
43
|
+
})
|
|
44
|
+
};
|
|
45
|
+
var ResultContent = function ResultContent(props) {
|
|
46
|
+
var _slots$nodeResultCont;
|
|
47
|
+
var input = props.input,
|
|
48
|
+
output = props.output,
|
|
49
|
+
className = props.className;
|
|
50
|
+
var slots = useStore(function (state) {
|
|
51
|
+
return state.slots;
|
|
52
|
+
});
|
|
53
|
+
var resultContent = ((_slots$nodeResultCont = slots.nodeResultContentRenderer) === null || _slots$nodeResultCont === void 0 ? void 0 : _slots$nodeResultCont.call(slots, props)) || null;
|
|
54
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: classNames('spark-flow-node-result-content', className)
|
|
56
|
+
}, resultContent || /*#__PURE__*/React.createElement(React.Fragment, null, !!input && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: "spark-flow-node-result-content-title"
|
|
58
|
+
}, $i18n.get({
|
|
59
|
+
id: 'spark-flow.components.NodeResultPanel.index.input',
|
|
60
|
+
dm: '输入'
|
|
61
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: "spark-flow-node-result-content-area"
|
|
63
|
+
}, input)), !!output && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: "spark-flow-node-result-content-title"
|
|
65
|
+
}, $i18n.get({
|
|
66
|
+
id: 'spark-flow.components.NodeResultPanel.index.output',
|
|
67
|
+
dm: '输出'
|
|
68
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "spark-flow-node-result-content-area"
|
|
70
|
+
}, output))));
|
|
71
|
+
};
|
|
72
|
+
var NodeResultPanel = function NodeResultPanel(props) {
|
|
73
|
+
var _useState = useState(false),
|
|
74
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
75
|
+
expand = _useState2[0],
|
|
76
|
+
setExpand = _useState2[1];
|
|
77
|
+
var isBatch = props.data.is_batch && !!props.data.batches;
|
|
78
|
+
var _useState3 = useState(1),
|
|
79
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
80
|
+
batchIndex = _useState4[0],
|
|
81
|
+
setBatchIndex = _useState4[1];
|
|
82
|
+
var inputContent = useMemo(function () {
|
|
83
|
+
if (isBatch) {
|
|
84
|
+
var _props$data$batches;
|
|
85
|
+
return (_props$data$batches = props.data.batches[batchIndex - 1]) === null || _props$data$batches === void 0 ? void 0 : _props$data$batches.input;
|
|
86
|
+
}
|
|
87
|
+
return props.data.input;
|
|
88
|
+
}, [props.data, batchIndex]);
|
|
89
|
+
var outputContent = useMemo(function () {
|
|
90
|
+
if (isBatch) {
|
|
91
|
+
var _props$data$batches2;
|
|
92
|
+
return (_props$data$batches2 = props.data.batches[batchIndex - 1]) === null || _props$data$batches2 === void 0 ? void 0 : _props$data$batches2.output;
|
|
93
|
+
}
|
|
94
|
+
return props.data.output;
|
|
95
|
+
}, [props.data, batchIndex]);
|
|
96
|
+
var errorInfoContent = useMemo(function () {
|
|
97
|
+
if (isBatch) {
|
|
98
|
+
var _props$data$batches3;
|
|
99
|
+
return (_props$data$batches3 = props.data.batches[batchIndex - 1]) === null || _props$data$batches3 === void 0 ? void 0 : _props$data$batches3.error_info;
|
|
100
|
+
}
|
|
101
|
+
return props.data.error_info;
|
|
102
|
+
}, [props.data, batchIndex]);
|
|
103
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
104
|
+
onClick: function onClick(e) {
|
|
105
|
+
e.stopPropagation();
|
|
106
|
+
},
|
|
107
|
+
className: classNames("spark-flow-node-result-panel nodrag spark-flow-node-result-panel-".concat(props.data.node_status), _defineProperty({}, 'spark-flow-node-result-panel-hidden', !expand))
|
|
108
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
109
|
+
className: "spark-flow-node-result-header flex flex-col gap-[4px]",
|
|
110
|
+
onClick: function onClick(e) {
|
|
111
|
+
e.stopPropagation();
|
|
112
|
+
}
|
|
113
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
className: "flex-justify-between",
|
|
115
|
+
onClick: function onClick(e) {
|
|
116
|
+
setExpand(!expand);
|
|
117
|
+
}
|
|
118
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
119
|
+
className: "flex-center gap-[8px]"
|
|
120
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
121
|
+
className: "spark-flow-node-result-status"
|
|
122
|
+
}, statusNameMap[props.data.node_status]), /*#__PURE__*/React.createElement("span", {
|
|
123
|
+
className: "spark-flow-node-result-time"
|
|
124
|
+
}, props.data.node_exec_time)), props.data.node_status !== 'skip' && /*#__PURE__*/React.createElement(SparkUpLine, {
|
|
125
|
+
className: "text-base spark-flow-node-result-expand-icon"
|
|
126
|
+
})), expand && isBatch && /*#__PURE__*/React.createElement(Pagination, {
|
|
127
|
+
current: batchIndex,
|
|
128
|
+
total: props.data.batches.length,
|
|
129
|
+
pageSize: 1,
|
|
130
|
+
onChange: function onChange(page) {
|
|
131
|
+
return setBatchIndex(page);
|
|
132
|
+
},
|
|
133
|
+
simple: true
|
|
134
|
+
// @ts-ignore
|
|
135
|
+
,
|
|
136
|
+
hideTips: true,
|
|
137
|
+
hideSwitchButton: true,
|
|
138
|
+
onClick: function onClick(e) {
|
|
139
|
+
return e.stopPropagation();
|
|
140
|
+
}
|
|
141
|
+
}), expand && props.data.node_status === 'fail' && /*#__PURE__*/React.createElement(Typography.Text, {
|
|
142
|
+
ellipsis: {
|
|
143
|
+
tooltip: {
|
|
144
|
+
title: errorInfoContent,
|
|
145
|
+
destroyTooltipOnHide: true
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
className: 'spark-flow-node-result-error-info'
|
|
149
|
+
}, errorInfoContent)), expand && (!!inputContent || !!outputContent) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ResultContent, {
|
|
150
|
+
input: inputContent,
|
|
151
|
+
output: outputContent,
|
|
152
|
+
className: "nowheel"
|
|
153
|
+
})));
|
|
154
|
+
};
|
|
155
|
+
export default /*#__PURE__*/memo(NodeResultPanel);
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
@import '../../index.less';
|
|
2
|
+
|
|
3
|
+
.spark-flow-node-result-panel {
|
|
4
|
+
max-height: 30vh;
|
|
5
|
+
padding: 0 8px 8px;
|
|
6
|
+
border-radius: 12px;
|
|
7
|
+
position: absolute;
|
|
8
|
+
left: 0;
|
|
9
|
+
top: calc(100% + 10px);
|
|
10
|
+
width: 100%;
|
|
11
|
+
cursor: initial !important;
|
|
12
|
+
transition: 0.4s ease-in-out;
|
|
13
|
+
z-index: 1;
|
|
14
|
+
|
|
15
|
+
* {
|
|
16
|
+
cursor: initial;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.spark-flow-node-result-status,
|
|
20
|
+
.spark-flow-node-result-time {
|
|
21
|
+
line-height: 24px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.spark-flow-node-result-status {
|
|
25
|
+
font-size: 14px;
|
|
26
|
+
font-weight: 500;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.spark-flow-node-result-time {
|
|
30
|
+
font-size: 12px;
|
|
31
|
+
font-family: Menlo, monospace;
|
|
32
|
+
color: e('var(--@{ant-prefix}-color-text-tertiary)');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.spark-flow-node-result-header {
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
padding: 8px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.spark-flow-node-result-expand-icon {
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
transition: 0.3s ease-in-out;
|
|
43
|
+
|
|
44
|
+
svg {
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.spark-flow-node-result-panel-success {
|
|
50
|
+
background: e('var(--@{ant-prefix}-color-success-bg)');
|
|
51
|
+
border: 1px solid e('var(--@{ant-prefix}-color-success-border)');
|
|
52
|
+
|
|
53
|
+
.spark-flow-node-result-status {
|
|
54
|
+
color: e('var(--@{ant-prefix}-color-success)');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&.spark-flow-node-result-panel-fail {
|
|
59
|
+
background: e('var(--@{ant-prefix}-color-error-bg)');
|
|
60
|
+
border: 1px solid e('var(--@{ant-prefix}-color-error-border)');
|
|
61
|
+
|
|
62
|
+
.spark-flow-node-result-status {
|
|
63
|
+
color: e('var(--@{ant-prefix}-color-error)');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.spark-flow-node-result-panel-executing {
|
|
68
|
+
background: e('var(--@{ant-prefix}-color-info-bg)');
|
|
69
|
+
border: 1px solid e('var(--@{ant-prefix}-color-info-border)');
|
|
70
|
+
|
|
71
|
+
.spark-flow-node-result-status {
|
|
72
|
+
color: e('var(--@{ant-prefix}-color-info)');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
&.spark-flow-node-result-panel-skip,
|
|
76
|
+
&.spark-flow-node-result-panel-wait,
|
|
77
|
+
&.spark-flow-node-result-panel-stop {
|
|
78
|
+
border: 1px solid e('var(--@{ant-prefix}-color-border-secondary)');
|
|
79
|
+
background-color: e('var(--@{ant-prefix}-color-bg-layout)');
|
|
80
|
+
|
|
81
|
+
.spark-flow-node-result-status {
|
|
82
|
+
color: e('var(--@{ant-prefix}-color-text-secondary)');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&.spark-flow-node-result-panel-hidden {
|
|
87
|
+
padding-bottom: 0;
|
|
88
|
+
|
|
89
|
+
.spark-flow-node-result-expand-icon {
|
|
90
|
+
transform: rotate(180deg);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// 当节点被选中时,提升NodeResultPanel的z-index
|
|
96
|
+
.react-flow__node.selected .spark-flow-node-result-panel {
|
|
97
|
+
z-index: 1001;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.spark-flow-node-result-error-info {
|
|
101
|
+
font-size: 12px;
|
|
102
|
+
line-height: 20px;
|
|
103
|
+
color: e('var(--@{ant-prefix}-color-text-secondary)');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.park-flow-node-result-content-title {
|
|
107
|
+
font-size: 13px;
|
|
108
|
+
font-weight: 500;
|
|
109
|
+
line-height: 20px;
|
|
110
|
+
color: e('var(--@{ant-prefix}-color-text)');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.spark-flow-node-result-content-area {
|
|
114
|
+
font-size: 12px;
|
|
115
|
+
line-height: 18px;
|
|
116
|
+
color: e('var(--@{ant-prefix}-color-text-secondary)');
|
|
117
|
+
border-radius: 6px;
|
|
118
|
+
padding: 6px 8px;
|
|
119
|
+
background: e('var(--@{ant-prefix}-color-fill-tertiary)');
|
|
120
|
+
word-break: break-all;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.spark-flow-node-result-content {
|
|
124
|
+
padding: 8px;
|
|
125
|
+
border-radius: 8px;
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
gap: 8px;
|
|
129
|
+
background: e('var(--@{ant-prefix}-color-bg-base)');
|
|
130
|
+
height: calc(30vh - 80px);
|
|
131
|
+
overflow-y: auto;
|
|
132
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
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."); }
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
12
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
+
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."); }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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; } }
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
import { useStore } from "../../flow/context";
|
|
19
|
+
import { useNodesInteraction } from "../../hooks";
|
|
20
|
+
import $i18n from "../../i18n";
|
|
21
|
+
import { Input } from '@agentscope-ai/design';
|
|
22
|
+
import { SparkDownLine, SparkSearchLine } from '@agentscope-ai/icons';
|
|
23
|
+
import { useStore as useReactFlowStore } from '@xyflow/react';
|
|
24
|
+
import { Tree } from 'antd';
|
|
25
|
+
import { debounce } from 'lodash-es';
|
|
26
|
+
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
27
|
+
import "./index.less";
|
|
28
|
+
var HighlightText = function HighlightText(_ref) {
|
|
29
|
+
var text = _ref.text,
|
|
30
|
+
keyword = _ref.keyword;
|
|
31
|
+
if (!keyword) return /*#__PURE__*/React.createElement(React.Fragment, null, text);
|
|
32
|
+
var parts = text.split(new RegExp("(".concat(keyword, ")"), 'gi'));
|
|
33
|
+
return /*#__PURE__*/React.createElement("span", null, parts.map(function (part, i) {
|
|
34
|
+
return part.toLowerCase() === keyword.toLowerCase() ? /*#__PURE__*/React.createElement("span", {
|
|
35
|
+
key: i,
|
|
36
|
+
className: "bg-yellow-200"
|
|
37
|
+
}, part) : part;
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
export default /*#__PURE__*/memo(function NodeTree() {
|
|
41
|
+
var nodes = useReactFlowStore(function (store) {
|
|
42
|
+
return store.nodes;
|
|
43
|
+
});
|
|
44
|
+
var nodeSchemaMap = useStore(function (store) {
|
|
45
|
+
return store.nodeSchemaMap;
|
|
46
|
+
});
|
|
47
|
+
var _useNodesInteraction = useNodesInteraction(),
|
|
48
|
+
handleNodeClickByNodeId = _useNodesInteraction.handleNodeClickByNodeId;
|
|
49
|
+
var _useState = useState(''),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
searchValue = _useState2[0],
|
|
52
|
+
setSearchValue = _useState2[1];
|
|
53
|
+
var _useState3 = useState([]),
|
|
54
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
55
|
+
expandedKeys = _useState4[0],
|
|
56
|
+
setExpandedKeys = _useState4[1];
|
|
57
|
+
var findParentKeys = function findParentKeys(nodes, targetKey) {
|
|
58
|
+
var parentKeys = [];
|
|
59
|
+
var findParent = function findParent(items, parentId) {
|
|
60
|
+
var _iterator = _createForOfIteratorHelper(items),
|
|
61
|
+
_step;
|
|
62
|
+
try {
|
|
63
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
64
|
+
var item = _step.value;
|
|
65
|
+
if (item.key === targetKey) {
|
|
66
|
+
if (parentId) parentKeys.push(parentId);
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
if (item.children) {
|
|
70
|
+
if (findParent(item.children, item.key)) {
|
|
71
|
+
if (parentId) parentKeys.push(parentId);
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch (err) {
|
|
77
|
+
_iterator.e(err);
|
|
78
|
+
} finally {
|
|
79
|
+
_iterator.f();
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
};
|
|
83
|
+
findParent(nodes);
|
|
84
|
+
return parentKeys;
|
|
85
|
+
};
|
|
86
|
+
var filterNodes = useMemo(function () {
|
|
87
|
+
return nodes.map(function (item) {
|
|
88
|
+
return {
|
|
89
|
+
title: /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "spark-flow-node-tree-sub-title"
|
|
91
|
+
}, /*#__PURE__*/React.createElement(HighlightText, {
|
|
92
|
+
text: item.data.label,
|
|
93
|
+
keyword: searchValue
|
|
94
|
+
})),
|
|
95
|
+
key: item.id,
|
|
96
|
+
type: item.type,
|
|
97
|
+
parentId: item.parentId,
|
|
98
|
+
label: item.data.label
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
}, [nodes, searchValue]);
|
|
102
|
+
var treeData = useMemo(function () {
|
|
103
|
+
var newTree = [];
|
|
104
|
+
var subFlowNodesMap = {};
|
|
105
|
+
filterNodes.forEach(function (item) {
|
|
106
|
+
if (item.parentId) {
|
|
107
|
+
subFlowNodesMap[item.parentId] = [].concat(_toConsumableArray(subFlowNodesMap[item.parentId] || []), [item]);
|
|
108
|
+
} else {
|
|
109
|
+
newTree.push(item);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
newTree = newTree.map(function (item) {
|
|
113
|
+
if (['Iterator', 'Parallel'].includes(item.type)) {
|
|
114
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
115
|
+
children: subFlowNodesMap[item.key]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return item;
|
|
119
|
+
});
|
|
120
|
+
var categoryMap = {};
|
|
121
|
+
newTree.forEach(function (item) {
|
|
122
|
+
if (categoryMap[item.type]) {
|
|
123
|
+
categoryMap[item.type].push(item);
|
|
124
|
+
} else {
|
|
125
|
+
categoryMap[item.type] = [item];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return Object.keys(categoryMap).map(function (itemKey) {
|
|
129
|
+
var _nodeSchemaMap$itemKe;
|
|
130
|
+
return {
|
|
131
|
+
title: /*#__PURE__*/React.createElement("div", {
|
|
132
|
+
className: "flex items-center spark-flow-node-tree-title"
|
|
133
|
+
}, (_nodeSchemaMap$itemKe = nodeSchemaMap[itemKey]) === null || _nodeSchemaMap$itemKe === void 0 ? void 0 : _nodeSchemaMap$itemKe.iconType({
|
|
134
|
+
size: 20
|
|
135
|
+
}), /*#__PURE__*/React.createElement(HighlightText, {
|
|
136
|
+
text: nodeSchemaMap[itemKey].title,
|
|
137
|
+
keyword: searchValue
|
|
138
|
+
})),
|
|
139
|
+
key: itemKey,
|
|
140
|
+
children: categoryMap[itemKey],
|
|
141
|
+
renderType: itemKey,
|
|
142
|
+
selectable: false,
|
|
143
|
+
label: nodeSchemaMap[itemKey].title
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
}, [filterNodes, nodeSchemaMap, searchValue]);
|
|
147
|
+
var getAllKeys = function getAllKeys(nodes) {
|
|
148
|
+
var keys = [];
|
|
149
|
+
var traverse = function traverse(items) {
|
|
150
|
+
items.forEach(function (item) {
|
|
151
|
+
keys.push(item.key);
|
|
152
|
+
if (item.children) {
|
|
153
|
+
traverse(item.children);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
traverse(nodes);
|
|
158
|
+
return keys;
|
|
159
|
+
};
|
|
160
|
+
var updateExpandedKeys = useCallback(function (value) {
|
|
161
|
+
if (!value) {
|
|
162
|
+
setExpandedKeys(getAllKeys(treeData));
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
var matchedKeys = filterNodes.filter(function (node) {
|
|
166
|
+
return node.label.toLowerCase().includes(value.toLowerCase());
|
|
167
|
+
}).map(function (node) {
|
|
168
|
+
return node.key;
|
|
169
|
+
});
|
|
170
|
+
var parentKeys = matchedKeys.reduce(function (acc, key) {
|
|
171
|
+
return [].concat(_toConsumableArray(acc), _toConsumableArray(findParentKeys(treeData, key)));
|
|
172
|
+
}, []);
|
|
173
|
+
setExpandedKeys(Array.from(new Set([].concat(_toConsumableArray(matchedKeys), _toConsumableArray(parentKeys)))));
|
|
174
|
+
}, [filterNodes, treeData]);
|
|
175
|
+
var debouncedUpdateExpandedKeys = useMemo(function () {
|
|
176
|
+
return debounce(updateExpandedKeys, 300);
|
|
177
|
+
}, [updateExpandedKeys]);
|
|
178
|
+
React.useEffect(function () {
|
|
179
|
+
debouncedUpdateExpandedKeys(searchValue);
|
|
180
|
+
return function () {
|
|
181
|
+
debouncedUpdateExpandedKeys.cancel();
|
|
182
|
+
};
|
|
183
|
+
}, [searchValue, debouncedUpdateExpandedKeys]);
|
|
184
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
185
|
+
className: "spark-flow-node-tree h-full flex flex-col"
|
|
186
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
187
|
+
className: "spark-flow-node-tree-search flex-shrink-0"
|
|
188
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
189
|
+
placeholder: $i18n.get({
|
|
190
|
+
id: 'spark-flow.components.NodeTree.index.searchNodeName',
|
|
191
|
+
dm: '搜索节点名称'
|
|
192
|
+
}),
|
|
193
|
+
prefix: /*#__PURE__*/React.createElement(SparkSearchLine, null),
|
|
194
|
+
value: searchValue,
|
|
195
|
+
onChange: function onChange(e) {
|
|
196
|
+
return setSearchValue(e.target.value);
|
|
197
|
+
}
|
|
198
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
199
|
+
className: "flex-1 overflow-y-auto px-[16px]"
|
|
200
|
+
}, /*#__PURE__*/React.createElement(Tree, {
|
|
201
|
+
expandedKeys: expandedKeys,
|
|
202
|
+
onExpand: function onExpand(keys) {
|
|
203
|
+
return setExpandedKeys(keys);
|
|
204
|
+
},
|
|
205
|
+
switcherIcon: /*#__PURE__*/React.createElement(SparkDownLine, null),
|
|
206
|
+
treeData: treeData,
|
|
207
|
+
onSelect: function onSelect(_ref2) {
|
|
208
|
+
var _ref3 = _slicedToArray(_ref2, 1),
|
|
209
|
+
key = _ref3[0];
|
|
210
|
+
handleNodeClickByNodeId(key);
|
|
211
|
+
}
|
|
212
|
+
})));
|
|
213
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@import '../../index.less';
|
|
2
|
+
|
|
3
|
+
.spark-flow-node-tree {
|
|
4
|
+
.@{ant-prefix}-tree {
|
|
5
|
+
background: transparent;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.@{ant-prefix}-tree-switcher,
|
|
9
|
+
.@{ant-prefix}-tree-switcher::before {
|
|
10
|
+
width: 16px;
|
|
11
|
+
height: 16px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.@{ant-prefix}-tree-switcher {
|
|
15
|
+
align-self: center;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
|
|
20
|
+
&::before {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.@{ant-prefix}-tree-switcher-icon {
|
|
25
|
+
font-size: 16px;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.@{ant-prefix}-tree-node-content-wrapper {
|
|
30
|
+
padding: 0;
|
|
31
|
+
|
|
32
|
+
&:hover,
|
|
33
|
+
&.@{ant-prefix}-tree-node-selected {
|
|
34
|
+
background: transparent;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.spark-flow-node-tree-title {
|
|
40
|
+
gap: 6px;
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
color: e('var(--@{ant-prefix}-color-text)');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.spark-flow-node-tree-sub-title {
|
|
46
|
+
color: e('var(--@{ant-prefix}-color-text-secondary)');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.spark-flow-node-tree-search {
|
|
50
|
+
padding: 8px 16px 16px;
|
|
51
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { INodeDataOutputParamItem } from "../../types/work-flow";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export declare const OutputParamsTreeNode: React.MemoExoticComponent<(props: {
|
|
5
|
+
data: INodeDataOutputParamItem;
|
|
6
|
+
}) => React.JSX.Element>;
|
|
7
|
+
declare const _default: React.NamedExoticComponent<{
|
|
8
|
+
data: INodeDataOutputParamItem[];
|
|
9
|
+
}>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Typography } from 'antd';
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
|
+
import "./index.less";
|
|
4
|
+
export var OutputParamsTreeNode = /*#__PURE__*/memo(function (props) {
|
|
5
|
+
var _props$data$propertie;
|
|
6
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7
|
+
className: "spark-flow-output-params-tree-node"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
className: "spark-flow-output-params-tree-node-label"
|
|
10
|
+
}, /*#__PURE__*/React.createElement(Typography.Text, {
|
|
11
|
+
ellipsis: {
|
|
12
|
+
tooltip: props.data.key
|
|
13
|
+
}
|
|
14
|
+
}, props.data.key), /*#__PURE__*/React.createElement("span", {
|
|
15
|
+
className: "spark-flow-output-params-tree-node-desc"
|
|
16
|
+
}, props.data.type)), /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
className: "spark-flow-output-params-tree-node-desc"
|
|
18
|
+
}, props.data.desc), !!((_props$data$propertie = props.data.properties) !== null && _props$data$propertie !== void 0 && _props$data$propertie.length) && /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: "spark-flow-output-params-tree-node-properties"
|
|
20
|
+
}, props.data.properties.map(function (property, index) {
|
|
21
|
+
return /*#__PURE__*/React.createElement(OutputParamsTreeNode, {
|
|
22
|
+
key: index,
|
|
23
|
+
data: property
|
|
24
|
+
});
|
|
25
|
+
})));
|
|
26
|
+
});
|
|
27
|
+
export default /*#__PURE__*/memo(function OutputParamsTree(props) {
|
|
28
|
+
return /*#__PURE__*/React.createElement("div", null, props.data.map(function (item, index) {
|
|
29
|
+
return /*#__PURE__*/React.createElement(OutputParamsTreeNode, {
|
|
30
|
+
key: index,
|
|
31
|
+
data: item
|
|
32
|
+
});
|
|
33
|
+
}));
|
|
34
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@import '../../index.less';
|
|
2
|
+
.spark-flow-output-params-tree-node {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: 4px;
|
|
6
|
+
|
|
7
|
+
.spark-flow-output-params-tree-node-label {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: 4px;
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
font-size: 14px;
|
|
13
|
+
color: e('var(--@{ant-prefix}-color-text)');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.spark-flow-output-params-tree-node-desc {
|
|
17
|
+
font-size: 12px;
|
|
18
|
+
line-height: 20px;
|
|
19
|
+
color: e('var(--@{ant-prefix}-color-text-tertiary)');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.spark-flow-output-params-tree-node-properties {
|
|
24
|
+
margin-left: 6px;
|
|
25
|
+
padding-left: 8px;
|
|
26
|
+
border-left: 1px solid e('var(--@{ant-prefix}-color-border-secondary)');
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { INodeDataInputParamItem, INodeDataOutputParamItem } from "../../types/work-flow";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export interface IScriptCodeMirrorProps {
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (value: string) => void;
|
|
7
|
+
inputParams: INodeDataInputParamItem[];
|
|
8
|
+
outputParams: INodeDataOutputParamItem[];
|
|
9
|
+
language: 'javascript' | 'python';
|
|
10
|
+
theme?: 'light' | 'dark';
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: React.NamedExoticComponent<IScriptCodeMirrorProps>;
|
|
14
|
+
export default _default;
|