@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,27 @@
|
|
|
1
|
+
import { useFlowInteraction, useNodesReadOnly } from "../../hooks";
|
|
2
|
+
import $i18n from "../../i18n";
|
|
3
|
+
import { SparkCardAdditionLine } from '@agentscope-ai/icons';
|
|
4
|
+
import { Tooltip } from 'antd';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import React, { memo } from 'react';
|
|
7
|
+
export default /*#__PURE__*/memo(function LayoutBtn() {
|
|
8
|
+
var _useFlowInteraction = useFlowInteraction(),
|
|
9
|
+
onLayout = _useFlowInteraction.onLayout;
|
|
10
|
+
var _useNodesReadOnly = useNodesReadOnly(),
|
|
11
|
+
nodesReadOnly = _useNodesReadOnly.nodesReadOnly;
|
|
12
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
13
|
+
rootClassName: "spark-flow-tool-tooltip",
|
|
14
|
+
destroyTooltipOnHide: true,
|
|
15
|
+
title: $i18n.get({
|
|
16
|
+
id: 'spark-flow.components.FlowTools.LayoutBtn.optimizeLayout',
|
|
17
|
+
dm: '布局优化'
|
|
18
|
+
})
|
|
19
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
onClick: onLayout,
|
|
21
|
+
className: classNames('spark-flow-tool-icon-btn size-[32px] flex-center', {
|
|
22
|
+
'spark-flow-tool-icon-btn-disabled': nodesReadOnly
|
|
23
|
+
})
|
|
24
|
+
}, /*#__PURE__*/React.createElement(SparkCardAdditionLine, {
|
|
25
|
+
className: "text-[20px]"
|
|
26
|
+
})));
|
|
27
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
import { useStore } from "../../flow/context";
|
|
6
|
+
import $i18n from "../../i18n";
|
|
7
|
+
import { SparkFloatingLine24Px } from '@agentscope-ai/icons';
|
|
8
|
+
import { Tooltip } from 'antd';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import React, { memo } from 'react';
|
|
11
|
+
export default /*#__PURE__*/memo(function MiniMapBtn() {
|
|
12
|
+
var showMiniMap = useStore(function (state) {
|
|
13
|
+
return state.showMiniMap;
|
|
14
|
+
});
|
|
15
|
+
var setShowMiniMap = useStore(function (state) {
|
|
16
|
+
return state.setShowMiniMap;
|
|
17
|
+
});
|
|
18
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
19
|
+
rootClassName: "spark-flow-tool-tooltip",
|
|
20
|
+
title: $i18n.get({
|
|
21
|
+
id: 'spark-flow.components.FlowTools.MiniMapBtn.miniMap',
|
|
22
|
+
dm: '缩略图'
|
|
23
|
+
})
|
|
24
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
onClick: function onClick() {
|
|
26
|
+
return setShowMiniMap(!showMiniMap);
|
|
27
|
+
},
|
|
28
|
+
className: classNames('spark-flow-tool-icon-btn size-[32px] flex-center', _defineProperty({}, 'spark-flow-tool-icon-btn-active', showMiniMap))
|
|
29
|
+
}, /*#__PURE__*/React.createElement(SparkFloatingLine24Px, {
|
|
30
|
+
size: 20
|
|
31
|
+
})));
|
|
32
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useFlowInteraction } from "../../hooks";
|
|
2
|
+
import { useFlowViewPort } from "../../hooks/use-flow-view-port";
|
|
3
|
+
import $i18n from "../../i18n";
|
|
4
|
+
import { transformToMacKey } from "../../utils";
|
|
5
|
+
import { SparkAmplifyLine, SparkDefaultSizeLine, SparkReduceLine } from '@agentscope-ai/icons';
|
|
6
|
+
import { useKeyPress } from 'ahooks';
|
|
7
|
+
import { Divider, Dropdown, Tooltip } from 'antd';
|
|
8
|
+
import React, { memo } from 'react';
|
|
9
|
+
export default /*#__PURE__*/memo(function ScaleBtn() {
|
|
10
|
+
var _useFlowViewPort = useFlowViewPort(),
|
|
11
|
+
handleScale = _useFlowViewPort.handleScale,
|
|
12
|
+
scaleRate = _useFlowViewPort.scaleRate,
|
|
13
|
+
handleSetScale = _useFlowViewPort.handleSetScale;
|
|
14
|
+
var _useFlowInteraction = useFlowInteraction(),
|
|
15
|
+
autoFitView = _useFlowInteraction.autoFitView;
|
|
16
|
+
useKeyPress(["".concat(transformToMacKey('ctrl'), ".equalsign")], function (event) {
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
handleScale(1);
|
|
19
|
+
}, {
|
|
20
|
+
useCapture: true,
|
|
21
|
+
exactMatch: true
|
|
22
|
+
});
|
|
23
|
+
useKeyPress(["".concat(transformToMacKey('ctrl'), ".dash")], function (event) {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
handleScale(-1);
|
|
26
|
+
}, {
|
|
27
|
+
useCapture: true,
|
|
28
|
+
exactMatch: true
|
|
29
|
+
});
|
|
30
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
31
|
+
menu: {
|
|
32
|
+
items: [{
|
|
33
|
+
label: '200%',
|
|
34
|
+
key: '200'
|
|
35
|
+
}, {
|
|
36
|
+
label: '100%',
|
|
37
|
+
key: '100'
|
|
38
|
+
}, {
|
|
39
|
+
label: '50%',
|
|
40
|
+
key: '50'
|
|
41
|
+
}, {
|
|
42
|
+
label: $i18n.get({
|
|
43
|
+
id: 'spark-flow.components.FlowTools.ScaleBtn.autoView',
|
|
44
|
+
dm: '自适应视图'
|
|
45
|
+
}),
|
|
46
|
+
key: 'fit'
|
|
47
|
+
}],
|
|
48
|
+
onClick: function onClick(e) {
|
|
49
|
+
if (e.key === 'fit') {
|
|
50
|
+
autoFitView();
|
|
51
|
+
} else {
|
|
52
|
+
handleSetScale(parseInt(e.key) / 100);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
trigger: ['click'],
|
|
57
|
+
getPopupContainer: function getPopupContainer(ele) {
|
|
58
|
+
return ele;
|
|
59
|
+
}
|
|
60
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
61
|
+
title: $i18n.get({
|
|
62
|
+
id: 'spark-flow.components.FlowTools.ScaleBtn.scale',
|
|
63
|
+
dm: '缩放'
|
|
64
|
+
})
|
|
65
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "spark-flow-tool-icon-btn flex items-center gap-[4px]"
|
|
67
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: "p-[6px] h-[32px]"
|
|
69
|
+
}, /*#__PURE__*/React.createElement(SparkReduceLine, {
|
|
70
|
+
onClick: function onClick(e) {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
handleScale(-1);
|
|
73
|
+
},
|
|
74
|
+
size: 20,
|
|
75
|
+
className: "cursor-pointer"
|
|
76
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
77
|
+
className: 'spark-flow-tools-scale-rate'
|
|
78
|
+
}, scaleRate, "%"), /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: "p-[6px] h-[32px]"
|
|
80
|
+
}, /*#__PURE__*/React.createElement(SparkAmplifyLine, {
|
|
81
|
+
onClick: function onClick(e) {
|
|
82
|
+
e.stopPropagation();
|
|
83
|
+
handleScale(1);
|
|
84
|
+
},
|
|
85
|
+
size: 20,
|
|
86
|
+
className: "cursor-pointer"
|
|
87
|
+
}))))), /*#__PURE__*/React.createElement(Divider, {
|
|
88
|
+
type: "vertical",
|
|
89
|
+
className: "m-0"
|
|
90
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
91
|
+
title: $i18n.get({
|
|
92
|
+
id: 'spark-flow.components.FlowTools.ScaleBtn.autoView',
|
|
93
|
+
dm: '自适应视图'
|
|
94
|
+
})
|
|
95
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
onClick: autoFitView,
|
|
97
|
+
className: "spark-flow-tool-icon-btn size-[32px] flex-center"
|
|
98
|
+
}, /*#__PURE__*/React.createElement(SparkDefaultSizeLine, {
|
|
99
|
+
className: "text-[20px]"
|
|
100
|
+
}))));
|
|
101
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { SparkKeyboardLine } from '@agentscope-ai/icons';
|
|
9
|
+
import { Popover, Tooltip } from 'antd';
|
|
10
|
+
import React, { memo, useState } from 'react';
|
|
11
|
+
import ShortKeyContent from "./short-key-content";
|
|
12
|
+
export default /*#__PURE__*/memo(function ShortKeyBtn() {
|
|
13
|
+
var _useState = useState(false),
|
|
14
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15
|
+
showTip = _useState2[0],
|
|
16
|
+
setShowTip = _useState2[1];
|
|
17
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
18
|
+
placement: "top",
|
|
19
|
+
arrow: false,
|
|
20
|
+
destroyTooltipOnHide: true,
|
|
21
|
+
open: showTip,
|
|
22
|
+
onOpenChange: setShowTip,
|
|
23
|
+
content: /*#__PURE__*/React.createElement(ShortKeyContent, null),
|
|
24
|
+
trigger: "click",
|
|
25
|
+
getPopupContainer: function getPopupContainer(ele) {
|
|
26
|
+
return ele;
|
|
27
|
+
}
|
|
28
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
29
|
+
title: $i18n.get({
|
|
30
|
+
id: 'spark-flow.components.FlowTools.ShortKeyBtn.shortcutKeys',
|
|
31
|
+
dm: '快捷键'
|
|
32
|
+
})
|
|
33
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "spark-flow-tool-icon-btn size-[32px] flex-center"
|
|
35
|
+
}, /*#__PURE__*/React.createElement(SparkKeyboardLine, {
|
|
36
|
+
className: "text-[20px]"
|
|
37
|
+
}))));
|
|
38
|
+
});
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import $i18n from "../../i18n";
|
|
2
|
+
import { Tag } from '@agentscope-ai/design';
|
|
3
|
+
import React, { memo, useMemo } from 'react';
|
|
4
|
+
import { isMacOS } from "../../utils";
|
|
5
|
+
import "./short-key-content.less";
|
|
6
|
+
var ShortKeyContent = function ShortKeyContent() {
|
|
7
|
+
var isWindows = useMemo(function () {
|
|
8
|
+
return !isMacOS();
|
|
9
|
+
}, []);
|
|
10
|
+
var cmdKey = useMemo(function () {
|
|
11
|
+
return isWindows ? 'Ctrl' : $i18n.get({
|
|
12
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.command',
|
|
13
|
+
dm: '⌘'
|
|
14
|
+
});
|
|
15
|
+
}, [isWindows]);
|
|
16
|
+
var shiftKey = useMemo(function () {
|
|
17
|
+
return isWindows ? 'Shift' : $i18n.get({
|
|
18
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.shift',
|
|
19
|
+
dm: '⇧'
|
|
20
|
+
});
|
|
21
|
+
}, [isWindows]);
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: "spark-flow-short-key-container flex flex-col gap-[8px]"
|
|
24
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: "spark-flow-short-key-row flex items-center h-[20px]"
|
|
26
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: "spark-flow-short-key-name"
|
|
28
|
+
}, $i18n.get({
|
|
29
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.moveCanvas',
|
|
30
|
+
dm: '移动画布'
|
|
31
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: "spark-flow-keys-container flex items-center flex-1 justify-end"
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Tag, {
|
|
34
|
+
className: "spark-flow-command-key-label"
|
|
35
|
+
}, $i18n.get({
|
|
36
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.spacebar',
|
|
37
|
+
dm: '空格键'
|
|
38
|
+
})), /*#__PURE__*/React.createElement(Tag, {
|
|
39
|
+
className: "spark-flow-command-key-label"
|
|
40
|
+
}, $i18n.get({
|
|
41
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.drag',
|
|
42
|
+
dm: '拖拽'
|
|
43
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: "spark-flow-short-key-row flex items-center h-[20px]"
|
|
45
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: "spark-flow-short-key-name"
|
|
47
|
+
}, $i18n.get({
|
|
48
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.zoomIn',
|
|
49
|
+
dm: '放大'
|
|
50
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "spark-flow-keys-container flex items-center flex-1 justify-end"
|
|
52
|
+
}, /*#__PURE__*/React.createElement(Tag, {
|
|
53
|
+
className: "spark-flow-command-key"
|
|
54
|
+
}, cmdKey), /*#__PURE__*/React.createElement(Tag, {
|
|
55
|
+
className: "spark-flow-command-key-label"
|
|
56
|
+
}, $i18n.get({
|
|
57
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.scroll',
|
|
58
|
+
dm: '滚动'
|
|
59
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
60
|
+
className: "spark-flow-or-text text-[12px] mx-[2px]"
|
|
61
|
+
}, $i18n.get({
|
|
62
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.or',
|
|
63
|
+
dm: '或'
|
|
64
|
+
})), /*#__PURE__*/React.createElement(Tag, {
|
|
65
|
+
className: "spark-flow-command-key"
|
|
66
|
+
}, cmdKey), /*#__PURE__*/React.createElement(Tag, {
|
|
67
|
+
className: "spark-flow-command-key-label"
|
|
68
|
+
}, "+"))), /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "spark-flow-short-key-row flex items-center h-[20px]"
|
|
70
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: "spark-flow-short-key-name"
|
|
72
|
+
}, $i18n.get({
|
|
73
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.zoomOut',
|
|
74
|
+
dm: '缩小'
|
|
75
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "spark-flow-keys-container flex items-center flex-1 justify-end"
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Tag, {
|
|
78
|
+
className: "spark-flow-command-key"
|
|
79
|
+
}, cmdKey), /*#__PURE__*/React.createElement(Tag, {
|
|
80
|
+
className: "spark-flow-command-key-label"
|
|
81
|
+
}, $i18n.get({
|
|
82
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.scroll',
|
|
83
|
+
dm: '滚动'
|
|
84
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
85
|
+
className: "spark-flow-or-text text-[12px] mx-[2px]"
|
|
86
|
+
}, $i18n.get({
|
|
87
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.or',
|
|
88
|
+
dm: '或'
|
|
89
|
+
})), /*#__PURE__*/React.createElement(Tag, {
|
|
90
|
+
className: "spark-flow-command-key"
|
|
91
|
+
}, cmdKey), /*#__PURE__*/React.createElement(Tag, {
|
|
92
|
+
className: "spark-flow-command-key-label"
|
|
93
|
+
}, "-"))), /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
className: "spark-flow-short-key-row flex items-center h-[20px]"
|
|
95
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: "spark-flow-short-key-name"
|
|
97
|
+
}, $i18n.get({
|
|
98
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.undo',
|
|
99
|
+
dm: '撤销'
|
|
100
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: "spark-flow-keys-container flex items-center flex-1 justify-end"
|
|
102
|
+
}, /*#__PURE__*/React.createElement(Tag, {
|
|
103
|
+
className: "spark-flow-command-key"
|
|
104
|
+
}, cmdKey), /*#__PURE__*/React.createElement(Tag, {
|
|
105
|
+
className: "spark-flow-command-key-label"
|
|
106
|
+
}, "Z"))), /*#__PURE__*/React.createElement("div", {
|
|
107
|
+
className: "spark-flow-short-key-row flex items-center h-[20px]"
|
|
108
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
109
|
+
className: "spark-flow-short-key-name"
|
|
110
|
+
}, $i18n.get({
|
|
111
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.redo',
|
|
112
|
+
dm: '恢复'
|
|
113
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
className: "spark-flow-keys-container flex items-center flex-1 justify-end"
|
|
115
|
+
}, /*#__PURE__*/React.createElement(Tag, {
|
|
116
|
+
className: "spark-flow-command-key"
|
|
117
|
+
}, cmdKey), /*#__PURE__*/React.createElement(Tag, {
|
|
118
|
+
className: "spark-flow-command-key"
|
|
119
|
+
}, shiftKey), /*#__PURE__*/React.createElement(Tag, {
|
|
120
|
+
className: "spark-flow-command-key-label"
|
|
121
|
+
}, "Z"))), /*#__PURE__*/React.createElement("div", {
|
|
122
|
+
className: "spark-flow-short-key-row flex items-center h-[20px]"
|
|
123
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
124
|
+
className: "spark-flow-short-key-name"
|
|
125
|
+
}, $i18n.get({
|
|
126
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.delete',
|
|
127
|
+
dm: '删除'
|
|
128
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: "spark-flow-keys-container flex items-center flex-1 justify-end"
|
|
130
|
+
}, /*#__PURE__*/React.createElement(Tag, {
|
|
131
|
+
className: "spark-flow-command-key-label"
|
|
132
|
+
}, $i18n.get({
|
|
133
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.backspace',
|
|
134
|
+
dm: '退格'
|
|
135
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
136
|
+
className: "spark-flow-or-text text-[12px] mx-[2px]"
|
|
137
|
+
}, $i18n.get({
|
|
138
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.or',
|
|
139
|
+
dm: '或'
|
|
140
|
+
})), /*#__PURE__*/React.createElement(Tag, {
|
|
141
|
+
className: "spark-flow-command-key-label"
|
|
142
|
+
}, "Delete"), /*#__PURE__*/React.createElement("span", {
|
|
143
|
+
className: "spark-flow-or-text text-[12px] mx-[2px]"
|
|
144
|
+
}, $i18n.get({
|
|
145
|
+
id: 'spark-flow.components.FlowTools.ShortKeyContent.or',
|
|
146
|
+
dm: '或'
|
|
147
|
+
})), /*#__PURE__*/React.createElement(Tag, {
|
|
148
|
+
className: "spark-flow-command-key"
|
|
149
|
+
}, cmdKey), /*#__PURE__*/React.createElement(Tag, {
|
|
150
|
+
className: "spark-flow-command-key-label"
|
|
151
|
+
}, "D"))));
|
|
152
|
+
};
|
|
153
|
+
export default /*#__PURE__*/memo(ShortKeyContent);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@import '../../index.less';
|
|
2
|
+
.spark-flow-short-key-container {
|
|
3
|
+
min-width: 224px;
|
|
4
|
+
|
|
5
|
+
.spark-flow-short-key-row {
|
|
6
|
+
gap: 8px;
|
|
7
|
+
|
|
8
|
+
.spark-flow-command-key-label,
|
|
9
|
+
.spark-flow-command-key {
|
|
10
|
+
margin: 0;
|
|
11
|
+
font-size: 10px;
|
|
12
|
+
border: none;
|
|
13
|
+
color: e('var(--@{ant-prefix}-color-primary)');
|
|
14
|
+
background: e('var(--@{ant-prefix}-color-primary-bg)');
|
|
15
|
+
font-weight: normal;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.spark-flow-short-key-name {
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
line-height: 20px;
|
|
22
|
+
color: e('var(--@{ant-prefix}-color-text)');
|
|
23
|
+
margin: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.spark-flow-keys-container {
|
|
27
|
+
gap: 2px;
|
|
28
|
+
|
|
29
|
+
.spark-flow-or-text {
|
|
30
|
+
color: e('var(--@{ant-prefix}-color-text-secondary)');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.spark-flow-command-key {
|
|
34
|
+
font-family: 'Source Han Sans', sans-serif;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
import { useStore } from "../../flow/context";
|
|
6
|
+
import $i18n from "../../i18n";
|
|
7
|
+
import { SparkDownLine, SparkMouseLine, SparkTrackpadLine } from '@agentscope-ai/icons';
|
|
8
|
+
import { Popover, Tooltip } from 'antd';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import React, { memo, useMemo } from 'react';
|
|
11
|
+
var MODEL_OPTIONS = [{
|
|
12
|
+
label: $i18n.get({
|
|
13
|
+
id: 'spark-flow.components.FlowTools.TouchModeBtn.mouseFriendlyMode',
|
|
14
|
+
dm: '鼠标友好模式'
|
|
15
|
+
}),
|
|
16
|
+
desc: $i18n.get({
|
|
17
|
+
id: 'spark-flow.components.FlowTools.TouchModeBtn.mouseLeftDragCanvasZoom',
|
|
18
|
+
dm: '鼠标左键拖动画布,滚轮缩放'
|
|
19
|
+
}),
|
|
20
|
+
code: 'mouse',
|
|
21
|
+
iconType: SparkMouseLine
|
|
22
|
+
}, {
|
|
23
|
+
label: $i18n.get({
|
|
24
|
+
id: 'spark-flow.components.FlowTools.TouchModeBtn.touchpadFriendlyMode',
|
|
25
|
+
dm: '触控板友好模式'
|
|
26
|
+
}),
|
|
27
|
+
desc: $i18n.get({
|
|
28
|
+
id: 'spark-flow.components.FlowTools.TouchModeBtn.twoFingersMoveDragTwoFingersOpenZoom',
|
|
29
|
+
dm: '双指同向移动进行拖动,双指开合进行缩放'
|
|
30
|
+
}),
|
|
31
|
+
code: 'touch',
|
|
32
|
+
iconType: SparkTrackpadLine
|
|
33
|
+
}];
|
|
34
|
+
var TouchModeBtn = function TouchModeBtn() {
|
|
35
|
+
var interactiveMode = useStore(function (state) {
|
|
36
|
+
return state.interactiveMode;
|
|
37
|
+
});
|
|
38
|
+
var setInteractiveMode = useStore(function (state) {
|
|
39
|
+
return state.setInteractiveMode;
|
|
40
|
+
});
|
|
41
|
+
var memoTouchModeSelect = useMemo(function () {
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: "flex flex-col gap-[4px]"
|
|
44
|
+
}, MODEL_OPTIONS.map(function (item) {
|
|
45
|
+
var isActive = interactiveMode === item.code;
|
|
46
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
key: item.code,
|
|
48
|
+
className: classNames('flex items-center gap-[12px] spark-flow-touch-mode-select-item', _defineProperty({}, 'spark-flow-touch-mode-select-item-active', isActive)),
|
|
49
|
+
onClick: function onClick() {
|
|
50
|
+
if (isActive) return;
|
|
51
|
+
setInteractiveMode(item.code);
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: "spark-flow-touch-mode-select-item-icon flex-center size-[36px]"
|
|
55
|
+
}, item.iconType({
|
|
56
|
+
className: 'spark-flow-touch-mode-select-item-icon',
|
|
57
|
+
size: 24
|
|
58
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: "w-0 flex-1"
|
|
60
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: "spark-flow-touch-mode-select-item-label"
|
|
62
|
+
}, item.label), /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: "spark-flow-touch-mode-select-item-desc"
|
|
64
|
+
}, item.desc)));
|
|
65
|
+
}));
|
|
66
|
+
}, [interactiveMode, setInteractiveMode]);
|
|
67
|
+
var currentInteractiveMode = MODEL_OPTIONS.find(function (i) {
|
|
68
|
+
return i.code === interactiveMode;
|
|
69
|
+
});
|
|
70
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
71
|
+
placement: "top",
|
|
72
|
+
arrow: false,
|
|
73
|
+
destroyTooltipOnHide: true,
|
|
74
|
+
content: memoTouchModeSelect,
|
|
75
|
+
getPopupContainer: function getPopupContainer(ele) {
|
|
76
|
+
return ele;
|
|
77
|
+
},
|
|
78
|
+
trigger: "click"
|
|
79
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
80
|
+
title: currentInteractiveMode === null || currentInteractiveMode === void 0 ? void 0 : currentInteractiveMode.label
|
|
81
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: "spark-flow-tool-icon-btn spark-flow-touch-mode-btn-container h-[32px] flex items-center gap-[4px] p-[6px]"
|
|
83
|
+
}, currentInteractiveMode === null || currentInteractiveMode === void 0 ? void 0 : currentInteractiveMode.iconType({
|
|
84
|
+
size: 20
|
|
85
|
+
}), /*#__PURE__*/React.createElement(SparkDownLine, {
|
|
86
|
+
size: 16
|
|
87
|
+
}))));
|
|
88
|
+
};
|
|
89
|
+
export default /*#__PURE__*/memo(TouchModeBtn);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IVarTreeItem } from '../variable-tree-select';
|
|
3
|
+
import './index.less';
|
|
4
|
+
interface IInputTextAreaProps {
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (value: string) => void;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
maxLength?: number;
|
|
9
|
+
showCount?: boolean;
|
|
10
|
+
title?: React.ReactNode;
|
|
11
|
+
onDelete?: () => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
variableList: IVarTreeItem[];
|
|
14
|
+
}
|
|
15
|
+
declare const _default: React.NamedExoticComponent<IInputTextAreaProps>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
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 { SparkClearLine, SparkDeleteLine, SparkFoldLine, SparkFoldLine2 } from '@agentscope-ai/icons';
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import React, { memo, useRef, useState } from 'react';
|
|
14
|
+
import VarInputTextArea from "../var-input-text-area";
|
|
15
|
+
import "./index.less";
|
|
16
|
+
export default /*#__PURE__*/memo(function InputTextArea(props) {
|
|
17
|
+
var _useState = useState(true),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
fold = _useState2[0],
|
|
20
|
+
setFold = _useState2[1];
|
|
21
|
+
var editorRef = useRef(null);
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: classNames('spark-flow-input-text-area', _defineProperty(_defineProperty({}, 'spark-flow-input-text-area-fold', fold), 'spark-flow-input-text-area-fold-disabled', props.disabled))
|
|
24
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: "spark-flow-input-text-area-header"
|
|
26
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: "spark-flow-input-text-area-header-title"
|
|
28
|
+
}, props.title), /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: "flex gap-[8px] items-center"
|
|
30
|
+
}, /*#__PURE__*/React.createElement(SparkDeleteLine, {
|
|
31
|
+
size: 16,
|
|
32
|
+
style: {
|
|
33
|
+
cursor: props.disabled ? 'not-allowed' : 'pointer'
|
|
34
|
+
},
|
|
35
|
+
onClick: props.disabled ? undefined : props.onDelete,
|
|
36
|
+
className: props.disabled ? 'spark-flow-disabled-icon-btn' : ''
|
|
37
|
+
}), /*#__PURE__*/React.createElement(SparkClearLine, {
|
|
38
|
+
size: 16,
|
|
39
|
+
style: {
|
|
40
|
+
cursor: props.disabled ? 'not-allowed' : 'pointer'
|
|
41
|
+
},
|
|
42
|
+
onClick: props.disabled ? undefined : function () {
|
|
43
|
+
var _editorRef$current;
|
|
44
|
+
(_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 || _editorRef$current.setEditorValue('');
|
|
45
|
+
},
|
|
46
|
+
className: props.disabled ? 'spark-flow-disabled-icon-btn' : ''
|
|
47
|
+
}), fold ? /*#__PURE__*/React.createElement(SparkFoldLine, {
|
|
48
|
+
size: 16,
|
|
49
|
+
style: {
|
|
50
|
+
cursor: props.disabled ? 'not-allowed' : 'pointer'
|
|
51
|
+
},
|
|
52
|
+
onClick: props.disabled ? undefined : function () {
|
|
53
|
+
return setFold(!fold);
|
|
54
|
+
},
|
|
55
|
+
className: props.disabled ? 'spark-flow-disabled-icon-btn' : ''
|
|
56
|
+
}) : /*#__PURE__*/React.createElement(SparkFoldLine2, {
|
|
57
|
+
size: 16,
|
|
58
|
+
style: {
|
|
59
|
+
cursor: props.disabled ? 'not-allowed' : 'pointer'
|
|
60
|
+
},
|
|
61
|
+
onClick: props.disabled ? undefined : function () {
|
|
62
|
+
return setFold(!fold);
|
|
63
|
+
},
|
|
64
|
+
className: props.disabled ? 'spark-flow-disabled-icon-btn' : ''
|
|
65
|
+
}))), /*#__PURE__*/React.createElement(VarInputTextArea, {
|
|
66
|
+
ref: editorRef,
|
|
67
|
+
variableList: props.variableList,
|
|
68
|
+
disabled: props.disabled,
|
|
69
|
+
value: props.value,
|
|
70
|
+
onChange: function onChange(val) {
|
|
71
|
+
return props.onChange(val || '');
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@import '../../index.less';
|
|
2
|
+
|
|
3
|
+
.spark-flow-input-text-area {
|
|
4
|
+
border-radius: 6px;
|
|
5
|
+
border: 1px solid e('var(--@{ant-prefix}-color-border-secondary)');
|
|
6
|
+
|
|
7
|
+
&-header {
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
align-items: center;
|
|
11
|
+
background: e('var(--@{ant-prefix}-color-fill-quaternary)');
|
|
12
|
+
border-radius: 6px 6px 0 0;
|
|
13
|
+
height: 24px;
|
|
14
|
+
padding: 0 12px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.spark-flow-var-input-text-area {
|
|
18
|
+
border: none;
|
|
19
|
+
min-height: initial;
|
|
20
|
+
max-height: initial;
|
|
21
|
+
height: 180px;
|
|
22
|
+
border-radius: 6px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.spark-flow-input-text-area-fold {
|
|
26
|
+
.spark-flow-var-input-text-area {
|
|
27
|
+
height: 90px;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IBranchItem } from "../../types/work-flow";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { IVarTreeItem } from '../variable-tree-select';
|
|
4
|
+
import './index.less';
|
|
5
|
+
declare const _default: React.NamedExoticComponent<{
|
|
6
|
+
value: IBranchItem[];
|
|
7
|
+
onChange: (val: IBranchItem[]) => void;
|
|
8
|
+
leftVariableList: IVarTreeItem[];
|
|
9
|
+
rightVariableList: IVarTreeItem[];
|
|
10
|
+
disabled?: boolean | undefined;
|
|
11
|
+
areaStyle?: React.CSSProperties | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
export default _default;
|