strategy-panel 1.0.0 → 1.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.
Files changed (58) hide show
  1. package/.fatherrc.ts +26 -26
  2. package/.umirc.ts +29 -29
  3. package/README.md +33 -33
  4. package/es/assets/rhombus.svg +3 -3
  5. package/es/common/graph-common/node-element/common-element.less +117 -117
  6. package/es/common/graph-common/node-element/condition-element.d.ts +1 -0
  7. package/es/common/graph-common/node-element/condition-element.js +28 -3
  8. package/es/common/graph-common/node-element/condition-element.less +1 -2
  9. package/es/common/graph-common/node-element/logical-element.d.ts +1 -0
  10. package/es/common/graph-common/node-element/logical-element.js +28 -3
  11. package/es/common/graph-common/node-element/node-element.d.ts +1 -0
  12. package/es/common/graph-common/node-element/node-element.js +29 -4
  13. package/es/hooks/withMode.d.ts +1 -0
  14. package/es/hooks/withMode.js +16 -0
  15. package/es/pages/component-tree-panel/category-tree/index.less +36 -35
  16. package/es/pages/config-panel/components/condition-configuration/configure-modal/data-origin.js +26 -15
  17. package/es/pages/config-panel/components/condition-configuration/configure-modal/index.js +3 -6
  18. package/es/pages/config-panel/components/condition-configuration/cross-line.d.ts +1 -0
  19. package/es/pages/config-panel/components/condition-configuration/cross-line.js +3 -1
  20. package/es/pages/config-panel/components/condition-configuration/index.d.ts +1 -1
  21. package/es/pages/config-panel/components/condition-configuration/index.js +12 -9
  22. package/es/pages/config-panel/components/condition-configuration/style.less +74 -70
  23. package/es/pages/config-panel/components/time-trigger/components/cycle-time.d.ts +1 -0
  24. package/es/pages/config-panel/components/time-trigger/components/cycle-time.js +35 -20
  25. package/es/pages/config-panel/components/time-trigger/components/time-horizon.d.ts +1 -0
  26. package/es/pages/config-panel/components/time-trigger/components/time-horizon.js +12 -9
  27. package/es/pages/config-panel/components/time-trigger/delay-time.d.ts +1 -0
  28. package/es/pages/config-panel/components/time-trigger/delay-time.js +3 -1
  29. package/es/pages/config-panel/components/time-trigger/index.d.ts +1 -1
  30. package/es/pages/config-panel/components/time-trigger/index.js +15 -10
  31. package/es/pages/config-panel/components/time-trigger/interval-time.d.ts +1 -0
  32. package/es/pages/config-panel/components/time-trigger/interval-time.js +5 -2
  33. package/es/pages/config-panel/components/time-trigger/persistent-time.d.ts +1 -0
  34. package/es/pages/config-panel/components/time-trigger/persistent-time.js +3 -1
  35. package/es/pages/config-panel/components/time-trigger/timing-time.d.ts +1 -0
  36. package/es/pages/config-panel/components/time-trigger/timing-time.js +4 -1
  37. package/es/pages/config-panel/config-common.d.ts +1 -1
  38. package/es/pages/config-panel/config-common.js +9 -5
  39. package/es/pages/config-panel/index.d.ts +1 -0
  40. package/es/pages/config-panel/index.js +4 -1
  41. package/es/pages/config-panel/node-form.d.ts +1 -0
  42. package/es/pages/config-panel/node-form.js +13 -29
  43. package/es/pages/config-panel/style.less +23 -4
  44. package/es/pages/dag-canvas/canvas-content.d.ts +1 -0
  45. package/es/pages/dag-canvas/canvas-content.js +3 -1
  46. package/es/pages/dag-canvas/index.d.ts +5 -0
  47. package/es/pages/dag-canvas/index.js +3 -1
  48. package/es/pages/dag-canvas/preview.d.ts +1 -0
  49. package/es/pages/dag-canvas/preview.js +9 -1
  50. package/es/pages/index.d.ts +6 -1
  51. package/es/pages/index.js +6 -1
  52. package/es/pages/index.less +50 -50
  53. package/es/pages/rx-models/experiment-graph.d.ts +4 -4
  54. package/es/pages/rx-models/experiment-graph.js +116 -84
  55. package/es/pages/strategy-header/index.js +16 -3
  56. package/es/pages/strategy-header/style.less +22 -22
  57. package/es/typings.d.ts +14 -6
  58. package/package.json +1 -1
package/.fatherrc.ts CHANGED
@@ -1,26 +1,26 @@
1
- export default {
2
- esm: 'babel',
3
- // cjs: 'babel',
4
- // lessInBabelMode: true,
5
- // cssModules: true,
6
- extraBabelPlugins: [
7
- [
8
- 'babel-plugin-module-resolver',
9
- {
10
- root: ['./'],
11
- extensions: ['.d.ts', '.ts'],
12
- alias: {
13
- '@': './src',
14
- },
15
- },
16
- ],
17
- [
18
- 'babel-plugin-import',
19
- {
20
- libraryName: 'antd',
21
- libraryDirectory: 'es',
22
- style: true,
23
- },
24
- ],
25
- ],
26
- };
1
+ export default {
2
+ esm: 'babel',
3
+ // cjs: 'babel',
4
+ // lessInBabelMode: true,
5
+ // cssModules: true,
6
+ extraBabelPlugins: [
7
+ [
8
+ 'babel-plugin-module-resolver',
9
+ {
10
+ root: ['./'],
11
+ extensions: ['.d.ts', '.ts'],
12
+ alias: {
13
+ '@': './src',
14
+ },
15
+ },
16
+ ],
17
+ [
18
+ 'babel-plugin-import',
19
+ {
20
+ libraryName: 'antd',
21
+ libraryDirectory: 'es',
22
+ style: true,
23
+ },
24
+ ],
25
+ ],
26
+ };
package/.umirc.ts CHANGED
@@ -1,29 +1,29 @@
1
- import { defineConfig } from 'dumi';
2
- const { NODE_ENV } = process.env;
3
-
4
- const basicBabelPlugin = [
5
- [
6
- 'babel-plugin-import',
7
- {
8
- libraryName: 'antd',
9
- libraryDirectory: 'es',
10
- style: true,
11
- },
12
- ],
13
- ];
14
-
15
- const extraBabelPlugins =
16
- NODE_ENV === 'development'
17
- ? [...basicBabelPlugin]
18
- : ['babel-plugin-transform-remove-console', ...basicBabelPlugin];
19
-
20
- export default defineConfig({
21
- title: 'strategy-panel',
22
- outputPath: 'docs-dist',
23
- logo: '/logo.svg',
24
- locales: [
25
- ['zh-CN', '中文'],
26
- ['en-US', 'English'],
27
- ],
28
- extraBabelPlugins,
29
- });
1
+ import { defineConfig } from 'dumi';
2
+ const { NODE_ENV } = process.env;
3
+
4
+ const basicBabelPlugin = [
5
+ [
6
+ 'babel-plugin-import',
7
+ {
8
+ libraryName: 'antd',
9
+ libraryDirectory: 'es',
10
+ style: true,
11
+ },
12
+ ],
13
+ ];
14
+
15
+ const extraBabelPlugins =
16
+ NODE_ENV === 'development'
17
+ ? [...basicBabelPlugin]
18
+ : ['babel-plugin-transform-remove-console', ...basicBabelPlugin];
19
+
20
+ export default defineConfig({
21
+ title: 'strategy-panel',
22
+ outputPath: 'docs-dist',
23
+ logo: '/logo.svg',
24
+ locales: [
25
+ ['zh-CN', '中文'],
26
+ ['en-US', 'English'],
27
+ ],
28
+ extraBabelPlugins,
29
+ });
package/README.md CHANGED
@@ -1,33 +1,33 @@
1
- # strategy-panel
2
-
3
- ## Getting Started
4
-
5
- Install dependencies,
6
-
7
- ```bash
8
- $ npm i
9
- ```
10
-
11
- Start the dev server,
12
-
13
- ```bash
14
- $ npm start
15
- ```
16
-
17
- Build documentation,
18
-
19
- ```bash
20
- $ npm run docs:build
21
- ```
22
-
23
- Run test,
24
-
25
- ```bash
26
- $ npm test
27
- ```
28
-
29
- Build library via `father-build`,
30
-
31
- ```bash
32
- $ npm run build
33
- ```
1
+ # strategy-panel
2
+
3
+ ## Getting Started
4
+
5
+ Install dependencies,
6
+
7
+ ```bash
8
+ $ npm i
9
+ ```
10
+
11
+ Start the dev server,
12
+
13
+ ```bash
14
+ $ npm start
15
+ ```
16
+
17
+ Build documentation,
18
+
19
+ ```bash
20
+ $ npm run docs:build
21
+ ```
22
+
23
+ Run test,
24
+
25
+ ```bash
26
+ $ npm test
27
+ ```
28
+
29
+ Build library via `father-build`,
30
+
31
+ ```bash
32
+ $ npm run build
33
+ ```
@@ -1,3 +1,3 @@
1
- <svg width="100%" height="100%" preserveAspectRatio="none" viewBox="0 0 167 90" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path vector-effect="non-scaling-stroke" d="M2.10786 45L83.5 1.13597L164.892 45L83.5 88.864L2.10786 45Z" fill="#FFECC7" stroke="#FFB200" stroke-width="1"/>
3
- </svg>
1
+ <svg width="100%" height="100%" preserveAspectRatio="none" viewBox="0 0 167 90" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path vector-effect="non-scaling-stroke" d="M2.10786 45L83.5 1.13597L164.892 45L83.5 88.864L2.10786 45Z" fill="#FFECC7" stroke="#FFB200" stroke-width="1"/>
3
+ </svg>
@@ -1,117 +1,117 @@
1
- @node-element-primary-color: #00A6FF;
2
-
3
- .x6-node [magnet='true'] {
4
- cursor: crosshair;
5
- transition: none;
6
- }
7
-
8
- .x6-node [magnet='true']:hover {
9
- opacity: 1;
10
- }
11
-
12
- .x6-node [magnet='true'][port-group='in'] {
13
- cursor: move;
14
- stroke: none;
15
- }
16
-
17
- .x6-port-body > span {
18
- display: block;
19
- }
20
-
21
- .ais-port {
22
- width: 100%;
23
- height: 100%;
24
- border: 1px solid #00A6FF;
25
- border-radius: 100%;
26
- background: #fff;
27
- display: block;
28
- }
29
-
30
- .ais-port.connected {
31
- width: 0;
32
- height: 0;
33
- margin-top: 3px;
34
- margin-left: -1px;
35
- border-width: 5px 4px 0;
36
- border-style: solid;
37
- border-color: #00A6FF transparent transparent;
38
- border-radius: 0;
39
- background-color: transparent;
40
- }
41
-
42
- .x6-port-body.available {
43
- overflow: visible;
44
- }
45
-
46
- .x6-port-body.available body {
47
- overflow: visible;
48
- }
49
- .x6-port-body.available span {
50
- overflow: visible;
51
- display: block;
52
- }
53
-
54
- .x6-port-body.available body > span::before {
55
- content: ' ';
56
- float: left;
57
- width: 20px;
58
- height: 20px;
59
- margin-top: -6px;
60
- margin-left: -6px;
61
- border-radius: 50%;
62
- background-color: fade(@node-element-primary-color, 60%);
63
- box-sizing: border-box;
64
- }
65
-
66
- .x6-port-body.available body > span::after {
67
- content: ' ';
68
- float: left;
69
- clear: both;
70
- width: 10px;
71
- height: 10px;
72
- margin-top: -15px;
73
- margin-left: -1px;
74
- border-radius: 50%;
75
- background-color: #fff;
76
- border: 1px solid @node-element-primary-color;
77
- // position: relative;
78
- z-index: 10;
79
- box-sizing: border-box;
80
- // transform: translateZ(0);
81
- // position: relative
82
- }
83
-
84
- .x6-port-body.adsorbed {
85
- overflow: visible;
86
- }
87
-
88
- .x6-port-body.adsorbed body {
89
- overflow: visible;
90
- }
91
-
92
- .x6-port-body.adsorbed body > span::before {
93
- content: ' ';
94
- float: left;
95
- width: 28px;
96
- height: 28px;
97
- margin-top: -9px;
98
- margin-left: -10px;
99
- border-radius: 50%;
100
- background-color: fade(@node-element-primary-color, 60%);
101
- box-sizing: border-box;
102
- }
103
-
104
- .x6-port-body.adsorbed body > span::after {
105
- content: ' ';
106
- float: left;
107
- clear: both;
108
- width: 10px;
109
- height: 10px;
110
- margin-top: -19px;
111
- border-radius: 50%;
112
- background-color: #fff;
113
- border: 1px solid @node-element-primary-color;
114
- // position: relative;
115
- z-index: 10;
116
- box-sizing: border-box;
117
- }
1
+ @node-element-primary-color: #00A6FF;
2
+
3
+ .x6-node [magnet='true'] {
4
+ cursor: crosshair;
5
+ transition: none;
6
+ }
7
+
8
+ .x6-node [magnet='true']:hover {
9
+ opacity: 1;
10
+ }
11
+
12
+ .x6-node [magnet='true'][port-group='in'] {
13
+ cursor: move;
14
+ stroke: none;
15
+ }
16
+
17
+ .x6-port-body > span {
18
+ display: block;
19
+ }
20
+
21
+ .ais-port {
22
+ width: 100%;
23
+ height: 100%;
24
+ border: 1px solid #00A6FF;
25
+ border-radius: 100%;
26
+ background: #fff;
27
+ display: block;
28
+ }
29
+
30
+ .ais-port.connected {
31
+ width: 0;
32
+ height: 0;
33
+ margin-top: 3px;
34
+ margin-left: -1px;
35
+ border-width: 5px 4px 0;
36
+ border-style: solid;
37
+ border-color: #00A6FF transparent transparent;
38
+ border-radius: 0;
39
+ background-color: transparent;
40
+ }
41
+
42
+ .x6-port-body.available {
43
+ overflow: visible;
44
+ }
45
+
46
+ .x6-port-body.available body {
47
+ overflow: visible;
48
+ }
49
+ .x6-port-body.available span {
50
+ overflow: visible;
51
+ display: block;
52
+ }
53
+
54
+ .x6-port-body.available body > span::before {
55
+ content: ' ';
56
+ float: left;
57
+ width: 20px;
58
+ height: 20px;
59
+ margin-top: -6px;
60
+ margin-left: -6px;
61
+ border-radius: 50%;
62
+ background-color: fade(@node-element-primary-color, 60%);
63
+ box-sizing: border-box;
64
+ }
65
+
66
+ .x6-port-body.available body > span::after {
67
+ content: ' ';
68
+ float: left;
69
+ clear: both;
70
+ width: 10px;
71
+ height: 10px;
72
+ margin-top: -15px;
73
+ margin-left: -1px;
74
+ border-radius: 50%;
75
+ background-color: #fff;
76
+ border: 1px solid @node-element-primary-color;
77
+ // position: relative;
78
+ z-index: 10;
79
+ box-sizing: border-box;
80
+ // transform: translateZ(0);
81
+ // position: relative
82
+ }
83
+
84
+ .x6-port-body.adsorbed {
85
+ overflow: visible;
86
+ }
87
+
88
+ .x6-port-body.adsorbed body {
89
+ overflow: visible;
90
+ }
91
+
92
+ .x6-port-body.adsorbed body > span::before {
93
+ content: ' ';
94
+ float: left;
95
+ width: 28px;
96
+ height: 28px;
97
+ margin-top: -9px;
98
+ margin-left: -10px;
99
+ border-radius: 50%;
100
+ background-color: fade(@node-element-primary-color, 60%);
101
+ box-sizing: border-box;
102
+ }
103
+
104
+ .x6-port-body.adsorbed body > span::after {
105
+ content: ' ';
106
+ float: left;
107
+ clear: both;
108
+ width: 10px;
109
+ height: 10px;
110
+ margin-top: -19px;
111
+ border-radius: 50%;
112
+ background-color: #fff;
113
+ border: 1px solid @node-element-primary-color;
114
+ // position: relative;
115
+ z-index: 10;
116
+ box-sizing: border-box;
117
+ }
@@ -3,6 +3,7 @@ import type { Node } from '@antv/x6';
3
3
  import './condition-element.less';
4
4
  interface Props {
5
5
  node?: Node;
6
+ experimentId: string;
6
7
  }
7
8
  declare const ConditionElement: React.FC<Props>;
8
9
  export default ConditionElement;
@@ -1,23 +1,48 @@
1
1
  import "antd/es/config-provider/style";
2
2
  import _ConfigProvider from "antd/es/config-provider";
3
+
4
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
+
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
+
8
+ 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); }
9
+
10
+ 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; }
11
+
12
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
13
+
14
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
+
3
16
  import React from 'react';
4
17
  import classNames from 'classnames';
5
18
  import { ANT_PREFIX } from "../../constants/global";
6
19
  import { NodePopover } from "../node-popover";
7
20
  import { ReactSVG } from 'react-svg';
8
21
  import "./condition-element.less";
22
+ import { useExperimentGraph } from "../../../pages/rx-models/experiment-graph";
23
+ import { useObservableState } from "../../../hooks/useObservableState";
9
24
 
10
25
  var ConditionElement = function ConditionElement(props) {
11
- var node = props.node;
26
+ var node = props.node,
27
+ experimentId = props.experimentId;
12
28
  var data = (node === null || node === void 0 ? void 0 : node.getData()) || {};
13
29
  var name = data.name,
14
- selected = data.selected,
30
+ id = data.id,
15
31
  imgUrl = data.imgUrl;
32
+ var expGraph = useExperimentGraph(experimentId);
33
+
34
+ var _useObservableState = useObservableState(function () {
35
+ return expGraph.activeNodeInstance$;
36
+ }),
37
+ _useObservableState2 = _slicedToArray(_useObservableState, 1),
38
+ activeNodeInstance = _useObservableState2[0];
39
+
40
+ var nodeId = activeNodeInstance && activeNodeInstance.id;
16
41
  return /*#__PURE__*/React.createElement(_ConfigProvider, {
17
42
  prefixCls: ANT_PREFIX
18
43
  }, /*#__PURE__*/React.createElement(NodePopover, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
19
44
  className: classNames('node-rhombus-element', {
20
- selected: !!selected
45
+ selected: !!nodeId && nodeId === id
21
46
  })
22
47
  }, /*#__PURE__*/React.createElement(ReactSVG, {
23
48
  src: require("../../../assets/rhombus.svg"),
@@ -5,8 +5,6 @@
5
5
  @condition-element-height: 107px;
6
6
  @condition-element-name-max-width: 144px;
7
7
 
8
-
9
-
10
8
  .node-rhombus-element {
11
9
  display: flex;
12
10
  flex-direction: row;
@@ -57,6 +55,7 @@
57
55
  color: #ffffff;
58
56
  }
59
57
  }
58
+
60
59
  .icon {
61
60
  width: 20px;
62
61
  height: 20px;
@@ -3,6 +3,7 @@ import type { Node } from '@antv/x6';
3
3
  import './logical-element.less';
4
4
  interface Props {
5
5
  node?: Node;
6
+ experimentId: string;
6
7
  }
7
8
  declare const ConditionElement: React.FC<Props>;
8
9
  export default ConditionElement;
@@ -1,11 +1,26 @@
1
1
  import "antd/es/config-provider/style";
2
2
  import _ConfigProvider from "antd/es/config-provider";
3
+
4
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
+
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
+
8
+ 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); }
9
+
10
+ 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; }
11
+
12
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
13
+
14
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
+
3
16
  import React from 'react';
4
17
  import classNames from 'classnames';
5
18
  import { ANT_PREFIX } from "../../constants/global";
6
19
  import { NodePopover } from "../node-popover";
7
20
  import { ReactSVG } from 'react-svg';
8
21
  import "./logical-element.less";
22
+ import { useExperimentGraph } from "../../../pages/rx-models/experiment-graph";
23
+ import { useObservableState } from "../../../hooks/useObservableState";
9
24
  var operatorUrl = {
10
25
  '|': require("../../../assets/OR.svg"),
11
26
  '&': require("../../../assets/AND.svg"),
@@ -13,17 +28,27 @@ var operatorUrl = {
13
28
  };
14
29
 
15
30
  var ConditionElement = function ConditionElement(props) {
16
- var node = props.node;
31
+ var node = props.node,
32
+ experimentId = props.experimentId;
17
33
  var data = (node === null || node === void 0 ? void 0 : node.getData()) || {};
18
- var selected = data.selected,
34
+ var id = data.id,
19
35
  imgUrl = data.imgUrl,
20
36
  nodeData = data.nodeData;
21
37
  var operator = nodeData === null || nodeData === void 0 ? void 0 : nodeData.operator;
38
+ var expGraph = useExperimentGraph(experimentId);
39
+
40
+ var _useObservableState = useObservableState(function () {
41
+ return expGraph.activeNodeInstance$;
42
+ }),
43
+ _useObservableState2 = _slicedToArray(_useObservableState, 1),
44
+ activeNodeInstance = _useObservableState2[0];
45
+
46
+ var nodeId = activeNodeInstance && activeNodeInstance.id;
22
47
  return /*#__PURE__*/React.createElement(_ConfigProvider, {
23
48
  prefixCls: ANT_PREFIX
24
49
  }, /*#__PURE__*/React.createElement(NodePopover, null, /*#__PURE__*/React.createElement("div", {
25
50
  className: classNames('logical-element', {
26
- selected: !!selected
51
+ selected: !!nodeId && nodeId === id
27
52
  })
28
53
  }, /*#__PURE__*/React.createElement(ReactSVG, {
29
54
  src: operator ? (operatorUrl === null || operatorUrl === void 0 ? void 0 : operatorUrl[operator]) || imgUrl : imgUrl,
@@ -3,6 +3,7 @@ import type { Node } from '@antv/x6';
3
3
  import './node-element.less';
4
4
  interface Props {
5
5
  node?: Node;
6
+ experimentId: string;
6
7
  }
7
8
  export declare const NodeElement: React.FC<Props>;
8
9
  export {};
@@ -1,22 +1,47 @@
1
1
  import "antd/es/config-provider/style";
2
2
  import _ConfigProvider from "antd/es/config-provider";
3
+
4
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
+
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
+
8
+ 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); }
9
+
10
+ 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; }
11
+
12
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
13
+
14
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
+
3
16
  import React from 'react';
4
17
  import classNames from 'classnames';
5
18
  import { ANT_PREFIX } from "../../constants/global";
6
19
  import { NodePopover } from "../node-popover";
7
20
  import { ReactSVG } from 'react-svg';
8
21
  import "./node-element.less";
22
+ import { useExperimentGraph } from "../../../pages/rx-models/experiment-graph";
23
+ import { useObservableState } from "../../../hooks/useObservableState";
9
24
  export var NodeElement = function NodeElement(props) {
10
- var node = props.node;
25
+ var node = props.node,
26
+ experimentId = props.experimentId;
11
27
  var data = (node === null || node === void 0 ? void 0 : node.getData()) || {};
12
28
  var name = data.name,
13
- selected = data.selected,
14
- imgUrl = data.imgUrl;
29
+ imgUrl = data.imgUrl,
30
+ id = data.id;
31
+ var expGraph = useExperimentGraph(experimentId);
32
+
33
+ var _useObservableState = useObservableState(function () {
34
+ return expGraph.activeNodeInstance$;
35
+ }),
36
+ _useObservableState2 = _slicedToArray(_useObservableState, 1),
37
+ activeNodeInstance = _useObservableState2[0];
38
+
39
+ var nodeId = activeNodeInstance && activeNodeInstance.id;
15
40
  return /*#__PURE__*/React.createElement(_ConfigProvider, {
16
41
  prefixCls: ANT_PREFIX
17
42
  }, /*#__PURE__*/React.createElement(NodePopover, null, /*#__PURE__*/React.createElement("div", {
18
43
  className: classNames('node-element', {
19
- selected: !!selected
44
+ selected: !!nodeId && nodeId === id
20
45
  })
21
46
  }, /*#__PURE__*/React.createElement(ReactSVG, {
22
47
  src: imgUrl,
@@ -0,0 +1 @@
1
+ export declare function withMode(WrappedComponent: any, mode: Types.ModeType): JSX.Element;
@@ -0,0 +1,16 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+
7
+ import React from 'react';
8
+ export function withMode(WrappedComponent, mode) {
9
+ var WithModeComponent = function WithModeComponent(props) {
10
+ return /*#__PURE__*/React.createElement(WrappedComponent.type, _objectSpread({}, props));
11
+ };
12
+
13
+ return /*#__PURE__*/React.createElement(WithModeComponent, _objectSpread(_objectSpread({}, (WrappedComponent === null || WrappedComponent === void 0 ? void 0 : WrappedComponent.props) || {}), {}, {
14
+ mode: mode
15
+ }));
16
+ }