d2aura 26.0.13 → 26.0.15
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/api/eda/edaManagerApi.d.ts +54 -15
- package/api/eda/edaManagerApi.js +106 -29
- package/api/eda/edaManagerApi.js.map +1 -1
- package/api/eda/generated/events.d.ts +115 -35
- package/api/eda/generated/events.js +193 -41
- package/api/eda/generated/events.js.map +1 -1
- package/api/eda/generated/structures.d.ts +110 -33
- package/api/eda/generated/structures.js.map +1 -1
- package/core/i18n/d2aura.en.json +14 -0
- package/core/i18n/d2aura.sk.json +92 -2
- package/coreui/components/edaManager/components/detail/components/edaVectorMassChangeButton.d.ts +1 -1
- package/coreui/components/edaManager/components/detail/components/edaVectorMassChangeButton.js +2 -2
- package/coreui/components/edaManager/components/detail/components/edaVectorMassChangeButton.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaChartViewer.d.ts +14 -0
- package/coreui/components/edaManagerComponent/components/edaChartViewer.js +374 -0
- package/coreui/components/edaManagerComponent/components/edaChartViewer.js.map +1 -0
- package/coreui/components/edaManagerComponent/components/edaDataBasePanel.d.ts +4 -8
- package/coreui/components/edaManagerComponent/components/edaDataBasePanel.js +18 -75
- package/coreui/components/edaManagerComponent/components/edaDataBasePanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaDetailPanel.d.ts +5 -14
- package/coreui/components/edaManagerComponent/components/edaDetailPanel.js +80 -19
- package/coreui/components/edaManagerComponent/components/edaDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaGraphPanel.d.ts +2 -7
- package/coreui/components/edaManagerComponent/components/edaGraphPanel.js +22 -390
- package/coreui/components/edaManagerComponent/components/edaGraphPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaGroupDetailPanel.d.ts +3 -14
- package/coreui/components/edaManagerComponent/components/edaGroupDetailPanel.js +54 -67
- package/coreui/components/edaManagerComponent/components/edaGroupDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaLoadingOverlay.d.ts +7 -0
- package/coreui/components/edaManagerComponent/components/edaLoadingOverlay.js +35 -0
- package/coreui/components/edaManagerComponent/components/edaLoadingOverlay.js.map +1 -0
- package/coreui/components/edaManagerComponent/components/edaSampleRangePickerPanel.d.ts +12 -18
- package/coreui/components/edaManagerComponent/components/edaSampleRangePickerPanel.js +55 -51
- package/coreui/components/edaManagerComponent/components/edaSampleRangePickerPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaScenarioDetailPanel.d.ts +3 -14
- package/coreui/components/edaManagerComponent/components/edaScenarioDetailPanel.js +67 -81
- package/coreui/components/edaManagerComponent/components/edaScenarioDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaTablePanel.d.ts +2 -6
- package/coreui/components/edaManagerComponent/components/edaTablePanel.js +188 -110
- package/coreui/components/edaManagerComponent/components/edaTablePanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaTimeWindowPickerPanel.d.ts +2 -13
- package/coreui/components/edaManagerComponent/components/edaTimeWindowPickerPanel.js +57 -88
- package/coreui/components/edaManagerComponent/components/edaTimeWindowPickerPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaTreeView.d.ts +9 -51
- package/coreui/components/edaManagerComponent/components/edaTreeView.js +431 -262
- package/coreui/components/edaManagerComponent/components/edaTreeView.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaVectorDetailPanel.d.ts +3 -21
- package/coreui/components/edaManagerComponent/components/edaVectorDetailPanel.js +160 -179
- package/coreui/components/edaManagerComponent/components/edaVectorDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/constants/actionTypes.d.ts +5 -0
- package/coreui/components/edaManagerComponent/constants/actionTypes.js +7 -0
- package/coreui/components/edaManagerComponent/constants/actionTypes.js.map +1 -0
- package/coreui/components/edaManagerComponent/constants/edaTypes.d.ts +23 -11
- package/coreui/components/edaManagerComponent/constants/edaTypes.js +15 -0
- package/coreui/components/edaManagerComponent/constants/edaTypes.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/edaConfigContext.d.ts +26 -0
- package/coreui/components/edaManagerComponent/context/edaConfigContext.js +20 -0
- package/coreui/components/edaManagerComponent/context/edaConfigContext.js.map +1 -0
- package/coreui/components/edaManagerComponent/context/edaVectorDataContext.d.ts +10 -16
- package/coreui/components/edaManagerComponent/context/edaVectorDataContext.js +8 -1
- package/coreui/components/edaManagerComponent/context/edaVectorDataContext.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/edaVectorDataProvider.d.ts +0 -1
- package/coreui/components/edaManagerComponent/context/edaVectorDataProvider.js +90 -92
- package/coreui/components/edaManagerComponent/context/edaVectorDataProvider.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/loadingContext.d.ts +1 -1
- package/coreui/components/edaManagerComponent/context/loadingContext.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/{sharedSampleRange.d.ts → sharedSampleRangeContext.d.ts} +12 -4
- package/coreui/components/edaManagerComponent/context/sharedSampleRangeContext.js +10 -0
- package/coreui/components/edaManagerComponent/context/sharedSampleRangeContext.js.map +1 -0
- package/coreui/components/edaManagerComponent/context/useEdaActions.d.ts +9 -0
- package/coreui/components/edaManagerComponent/context/useEdaActions.js +36 -0
- package/coreui/components/edaManagerComponent/context/useEdaActions.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/controlButtons.d.ts +13 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/controlButtons.js +19 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/controlButtons.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/descriptiveVectorDetailPanel.d.ts +8 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/descriptiveVectorDetailPanel.js +171 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/descriptiveVectorDetailPanel.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/graphPanel.d.ts +22 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/graphPanel.js +75 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/graphPanel.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/intervalInput.d.ts +12 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/intervalInput.js +52 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/intervalInput.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/tablePanel.d.ts +22 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/tablePanel.js +130 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/tablePanel.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/types.d.ts +58 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/types.js +51 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/types.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/useSharedData.d.ts +18 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/useSharedData.js +74 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/useSharedData.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/utils.d.ts +38 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/utils.js +299 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/utils.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/edaDescriptiveVectorEditorDialog.d.ts +10 -0
- package/coreui/components/edaManagerComponent/dialogs/edaDescriptiveVectorEditorDialog.js +343 -0
- package/coreui/components/edaManagerComponent/dialogs/edaDescriptiveVectorEditorDialog.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/edaTableEditorDialog.d.ts +12 -0
- package/coreui/components/edaManagerComponent/dialogs/edaTableEditorDialog.js +268 -0
- package/coreui/components/edaManagerComponent/dialogs/edaTableEditorDialog.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/exportDialog.d.ts +18 -0
- package/coreui/components/edaManagerComponent/dialogs/exportDialog.js +156 -0
- package/coreui/components/edaManagerComponent/dialogs/exportDialog.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/groupVectorSelection.d.ts +12 -0
- package/coreui/components/edaManagerComponent/dialogs/groupVectorSelection.js +74 -0
- package/coreui/components/edaManagerComponent/dialogs/groupVectorSelection.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/insertVectorDialog.d.ts +16 -0
- package/coreui/components/edaManagerComponent/dialogs/insertVectorDialog.js +32 -0
- package/coreui/components/edaManagerComponent/dialogs/insertVectorDialog.js.map +1 -0
- package/coreui/components/edaManagerComponent/edaDetail.d.ts +7 -26
- package/coreui/components/edaManagerComponent/edaDetail.js +138 -106
- package/coreui/components/edaManagerComponent/edaDetail.js.map +1 -1
- package/coreui/components/edaManagerComponent/edaManager.d.ts +4 -11
- package/coreui/components/edaManagerComponent/edaManager.js +29 -22
- package/coreui/components/edaManagerComponent/edaManager.js.map +1 -1
- package/coreui/components/edaManagerComponent/edaNavigator.d.ts +6 -12
- package/coreui/components/edaManagerComponent/edaNavigator.js +36 -41
- package/coreui/components/edaManagerComponent/edaNavigator.js.map +1 -1
- package/coreui/components/edaManagerComponent/edaSelect.d.ts +4 -3
- package/coreui/components/edaManagerComponent/edaSelect.js +32 -54
- package/coreui/components/edaManagerComponent/edaSelect.js.map +1 -1
- package/coreui/components/edaManagerComponent/icons/folderRemoveOutlined.d.ts +6 -0
- package/coreui/components/edaManagerComponent/icons/folderRemoveOutlined.js +7 -0
- package/coreui/components/edaManagerComponent/icons/folderRemoveOutlined.js.map +1 -0
- package/coreui/components/edaManagerComponent/utils/export.d.ts +9 -0
- package/coreui/components/edaManagerComponent/utils/export.js +570 -0
- package/coreui/components/edaManagerComponent/utils/export.js.map +1 -0
- package/coreui/components/edaManagerComponent/utils/utils.d.ts +6 -12
- package/coreui/components/edaManagerComponent/utils/utils.js +26 -15
- package/coreui/components/edaManagerComponent/utils/utils.js.map +1 -1
- package/d2configuration/edaManager/DB.EM_EDA_FunctionPrescription.xml +65 -0
- package/d2configuration/edaManager/DB.EM_EDA_VectorScenario.xml +65 -0
- package/d2configuration/edaManager/E.EM_DETAIL_IMPL.xml +67 -1
- package/d2configuration/edaManager/E.EM_DETAIL_SQL.xml +85 -0
- package/d2configuration/edaManager/E.EM_DETAIL_UNIT.xml +143 -2
- package/d2configuration/edaManager/E.EM_NAVIGATOR_IMPL.xml +14 -6
- package/d2configuration/edaManager/E.EM_NAVIGATOR_SQL.xml +12 -1
- package/d2configuration/edaManager/E.EM_NAVIGATOR_UNIT.xml +114 -6
- package/d2configuration/edaManager/E.EM_VECTOR_IMPL.xml +30 -6
- package/d2configuration/edaManager/E.EM_VECTOR_UNIT.xml +119 -17
- package/d2configuration/edaManager/SD.EM_EDA_FunctionPrescription.xml +91 -0
- package/d2configuration/edaManager/SD.EM_EDA_PairVector.xml +454 -0
- package/d2configuration/edaManager/{SD.EM_EDA_StatVectorRec_V1.xml → SD.EM_EDA_VectorScenario.xml} +13 -36
- package/d2configuration/edaManager/{SD.EM_EDA_VectorValues.xml → SD.EM_EDA_VectorStats.xml} +39 -6
- package/d2configuration/edaManager/SD.EM_Filter_Condition.xml +1 -1
- package/package.json +5 -3
- package/coreui/components/edaManagerComponent/components/edaBasePanel.d.ts +0 -16
- package/coreui/components/edaManagerComponent/components/edaBasePanel.js +0 -85
- package/coreui/components/edaManagerComponent/components/edaBasePanel.js.map +0 -1
- package/coreui/components/edaManagerComponent/context/sharedSampleRange.js +0 -13
- package/coreui/components/edaManagerComponent/context/sharedSampleRange.js.map +0 -1
- package/d2configuration/edaManager/EDA_CancelSession.xml +0 -54
- package/d2configuration/edaManager/EDA_GetSessionId.xml +0 -54
- package/d2configuration/edaManager/EDA_ReadValuesFromVektorRec.xml +0 -54
- package/d2configuration/edaManager/EDA_StatVectorRec.xml +0 -56
- package/d2configuration/edaManager/SD.EM_EDA_ReadValuesFromVector_V1.xml +0 -168
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Tree, Typography } from "antd";
|
|
3
|
-
import { DownOutlined, FolderOpenOutlined, FunctionOutlined, LoadingOutlined, QuestionOutlined } from "@ant-design/icons";
|
|
4
|
-
import WithCss from "d2coreui/components/style/withCss";
|
|
5
|
-
import { createStyles } from "antd-style";
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
6
2
|
import { EdaVectorType } from "../constants/edaTypes";
|
|
3
|
+
import { createStyles } from "antd-style";
|
|
4
|
+
import { Dropdown, Tree, Typography } from "antd";
|
|
5
|
+
import { CheckCircleOutlined, CloseCircleOutlined, DownOutlined, FolderOpenOutlined, FunctionOutlined, LoadingOutlined, QuestionOutlined, StopOutlined } from "@ant-design/icons";
|
|
7
6
|
import { NumberFifteenFilled } from "../icons/numberFifteenFilled";
|
|
8
7
|
import { LetterHFilled } from "../icons/letterHFilled";
|
|
9
8
|
import { LetterDFilled } from "../icons/letterDFilled";
|
|
@@ -12,13 +11,14 @@ import { LetterIFilled } from "../icons/letterIFilled";
|
|
|
12
11
|
import { PairOutlined } from "../icons/pairOutlined";
|
|
13
12
|
import { PeriodicOutlined } from "../icons/periodicOutlined";
|
|
14
13
|
import i18n from "d2core/i18n/i18n";
|
|
14
|
+
import { useEdaActions } from "../context/useEdaActions";
|
|
15
15
|
const useStyles = createStyles(({ css }) => {
|
|
16
16
|
return {
|
|
17
17
|
baseLayout: css `
|
|
18
18
|
position: relative;
|
|
19
19
|
height: 100%;
|
|
20
20
|
width: 100%;
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
.ant-tree {
|
|
23
23
|
height: 100%;
|
|
24
24
|
background-color: transparent;
|
|
@@ -32,7 +32,7 @@ const useStyles = createStyles(({ css }) => {
|
|
|
32
32
|
white-space: nowrap;
|
|
33
33
|
text-overflow: ellipsis;
|
|
34
34
|
overflow: hidden;
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
.ant-tree-title {
|
|
37
37
|
white-space: nowrap;
|
|
38
38
|
}
|
|
@@ -41,10 +41,7 @@ const useStyles = createStyles(({ css }) => {
|
|
|
41
41
|
absoluteLayout: css `
|
|
42
42
|
overflow: auto;
|
|
43
43
|
position: absolute;
|
|
44
|
-
|
|
45
|
-
right: 0;
|
|
46
|
-
top: 0;
|
|
47
|
-
bottom: 0;
|
|
44
|
+
inset: 0;
|
|
48
45
|
`
|
|
49
46
|
};
|
|
50
47
|
});
|
|
@@ -53,98 +50,113 @@ export var TreeViewType;
|
|
|
53
50
|
TreeViewType["GROUP"] = "group";
|
|
54
51
|
TreeViewType["SCENARIO"] = "scenario";
|
|
55
52
|
})(TreeViewType || (TreeViewType = {}));
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this.setState({ height });
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
this.resizeObserver.observe(this.divRef.current);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async componentDidUpdate(prevProps) {
|
|
88
|
-
if (prevProps.type !== this.props.type) {
|
|
89
|
-
await this.loadData(this.props.type);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
componentWillUnmount() {
|
|
93
|
-
if (this.resizeObserver) {
|
|
94
|
-
this.resizeObserver.disconnect();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
render() {
|
|
98
|
-
const { treeData, expandedKeys, selectedKeys } = this.state;
|
|
99
|
-
return (React.createElement(WithCss, { useStyles: useStyles }, (css) => React.createElement("div", { ref: this.divRef, className: css.styles.baseLayout },
|
|
100
|
-
React.createElement("div", { className: css.styles.absoluteLayout },
|
|
101
|
-
React.createElement(Tree, { blockNode: true, showLine: true, showIcon: true, switcherIcon: React.createElement(DownOutlined, null), height: this.state.height, loadData: this.onLoadData, onExpand: this.onExpand, onDoubleClick: this.onDoubleClick, expandedKeys: expandedKeys, selectedKeys: selectedKeys, titleRender: this.titleRenderer, treeData: treeData })))));
|
|
102
|
-
}
|
|
103
|
-
titleRenderer(node) {
|
|
104
|
-
if (node.key === this.state.loading) {
|
|
105
|
-
return React.createElement(Typography.Link, null,
|
|
106
|
-
React.createElement(LoadingOutlined, null),
|
|
107
|
-
" ",
|
|
108
|
-
i18n("Loading"),
|
|
109
|
-
"...");
|
|
53
|
+
var GroupType;
|
|
54
|
+
(function (GroupType) {
|
|
55
|
+
GroupType[GroupType["GROUPS"] = -1] = "GROUPS";
|
|
56
|
+
GroupType[GroupType["OMITTED_GROUPS"] = -2] = "OMITTED_GROUPS";
|
|
57
|
+
GroupType[GroupType["OMITTED_VECTORS"] = -3] = "OMITTED_VECTORS";
|
|
58
|
+
})(GroupType || (GroupType = {}));
|
|
59
|
+
var ScenarioType;
|
|
60
|
+
(function (ScenarioType) {
|
|
61
|
+
ScenarioType[ScenarioType["SCENARIOS"] = -1] = "SCENARIOS";
|
|
62
|
+
ScenarioType[ScenarioType["OMITTED_SCENARIOS"] = -2] = "OMITTED_SCENARIOS";
|
|
63
|
+
})(ScenarioType || (ScenarioType = {}));
|
|
64
|
+
export const EdaTreeView = ({ api, type, disableVectorSelection, disableBranchSelection, showOmitted, hideVectors, hideContextMenu, onItemDoubleClick }) => {
|
|
65
|
+
const { styles } = useStyles();
|
|
66
|
+
const { triggerExportToXML, triggerIncludeToScenario, triggerIncludeToGroup, renderActionDialogs } = useEdaActions(api);
|
|
67
|
+
const childParentMap = useRef(new Map());
|
|
68
|
+
const nodeMap = useRef(new Map());
|
|
69
|
+
const [treeData, setTreeData] = useState([]);
|
|
70
|
+
const [expandedKeys, setExpandedKeys] = useState([]);
|
|
71
|
+
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
72
|
+
const [height, setHeight] = useState(0);
|
|
73
|
+
const [loadingKey, setLoadingKey] = useState();
|
|
74
|
+
const [rightClickedNode, setRightClickedNode] = useState();
|
|
75
|
+
const divRef = useCallback((node) => {
|
|
76
|
+
if (!node) {
|
|
77
|
+
return;
|
|
110
78
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return (React.createElement(Typography.Link, { onClick: () => this.onLoadData(data, key) }, i18n("Show %{n} more (of %{o})", { n: String(amount), o: String(total) })));
|
|
115
|
-
}
|
|
116
|
-
onExpand(keys) {
|
|
117
|
-
this.setState({ expandedKeys: (keys) });
|
|
118
|
-
}
|
|
119
|
-
async loadData(type) {
|
|
120
|
-
this.setState({ loading: "" });
|
|
121
|
-
try {
|
|
122
|
-
let treeData;
|
|
123
|
-
switch (type) {
|
|
124
|
-
case TreeViewType.GROUP:
|
|
125
|
-
const rootGroups = await this.props.api.getGroupChildren(undefined);
|
|
126
|
-
treeData = this.convertGroups(rootGroups.items, undefined);
|
|
127
|
-
break;
|
|
128
|
-
case TreeViewType.SCENARIO:
|
|
129
|
-
const rootScenarios = await this.props.api.getScenarioChildren(undefined);
|
|
130
|
-
treeData = this.convertScenarios(rootScenarios.items, undefined);
|
|
131
|
-
break;
|
|
79
|
+
new ResizeObserver((entries) => {
|
|
80
|
+
if (entries[0]) {
|
|
81
|
+
setHeight(entries[0].contentRect.height);
|
|
132
82
|
}
|
|
133
|
-
|
|
83
|
+
}).observe(node);
|
|
84
|
+
}, []);
|
|
85
|
+
const convertGroups = useCallback((groups, parentId) => {
|
|
86
|
+
return groups.map((group) => {
|
|
87
|
+
const node = {
|
|
88
|
+
key: group.ID,
|
|
89
|
+
title: group.DisplayName,
|
|
90
|
+
isLeaf: false,
|
|
91
|
+
icon: React.createElement(FolderOpenOutlined, null),
|
|
92
|
+
group: group,
|
|
93
|
+
};
|
|
94
|
+
childParentMap.current.set(group.ID, parentId);
|
|
95
|
+
nodeMap.current.set(group.ID, node);
|
|
96
|
+
return node;
|
|
97
|
+
});
|
|
98
|
+
}, []);
|
|
99
|
+
const convertScenarios = useCallback((scenarios, parentId) => {
|
|
100
|
+
return scenarios.map((scenario) => {
|
|
101
|
+
const node = {
|
|
102
|
+
key: scenario.ID,
|
|
103
|
+
title: scenario.DisplayName,
|
|
104
|
+
isLeaf: false,
|
|
105
|
+
icon: React.createElement(FolderOpenOutlined, null),
|
|
106
|
+
scenario: scenario,
|
|
107
|
+
};
|
|
108
|
+
childParentMap.current.set(scenario.ID, parentId);
|
|
109
|
+
nodeMap.current.set(scenario.ID, node);
|
|
110
|
+
return node;
|
|
111
|
+
});
|
|
112
|
+
}, []);
|
|
113
|
+
const convertVectors = useCallback((vectors, parentId) => {
|
|
114
|
+
return vectors.map((vector) => {
|
|
115
|
+
const id = `${parentId}_${vector.ID}`;
|
|
116
|
+
const node = {
|
|
117
|
+
key: id,
|
|
118
|
+
title: vector.DisplayName,
|
|
119
|
+
isLeaf: true,
|
|
120
|
+
icon: getVectorIcon(vector.Type),
|
|
121
|
+
vector: vector,
|
|
122
|
+
};
|
|
123
|
+
childParentMap.current.set(id, parentId);
|
|
124
|
+
nodeMap.current.set(id, node);
|
|
125
|
+
return node;
|
|
126
|
+
});
|
|
127
|
+
}, []);
|
|
128
|
+
const loadVectors = useCallback(async (data, id, nodes, vectors) => {
|
|
129
|
+
const amount = vectors.leftCount > api.pageSize ? api.pageSize : vectors.leftCount;
|
|
130
|
+
nodes.push(...convertVectors(vectors.items, id));
|
|
131
|
+
if (data.vectorOffset === undefined) {
|
|
132
|
+
data.vectorOffset = {
|
|
133
|
+
done: vectors.leftCount === 0,
|
|
134
|
+
offset: vectors.items.length,
|
|
135
|
+
total: vectors.items.length + vectors.leftCount,
|
|
136
|
+
};
|
|
134
137
|
}
|
|
135
|
-
|
|
136
|
-
|
|
138
|
+
else {
|
|
139
|
+
data.vectorOffset.done = vectors.leftCount === 0;
|
|
140
|
+
data.vectorOffset.offset += vectors.items.length;
|
|
137
141
|
}
|
|
138
|
-
|
|
139
|
-
|
|
142
|
+
if (!data.vectorOffset.done) {
|
|
143
|
+
const key = `${id}_show_more`;
|
|
144
|
+
nodes.push({
|
|
145
|
+
key: key,
|
|
146
|
+
title: renderShowMoreTitle(key, data, amount, data.vectorOffset.total),
|
|
147
|
+
isLeaf: true,
|
|
148
|
+
});
|
|
140
149
|
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
150
|
+
}, [convertVectors]);
|
|
151
|
+
const loadGroups = useCallback(async (data, id, nodes) => {
|
|
152
|
+
const isSpecialId = id < 0;
|
|
153
|
+
const requestedId = isSpecialId ? undefined : id;
|
|
154
|
+
const showOmittedGroups = isSpecialId && id === -2;
|
|
155
|
+
const showOmittedVectors = isSpecialId && id === -3;
|
|
156
|
+
if (!data.groupOffset?.done && !showOmittedVectors) {
|
|
157
|
+
const groups = await api.getGroupChildren(requestedId, data.groupOffset?.offset, showOmittedGroups);
|
|
146
158
|
const amount = groups.leftCount > api.pageSize ? api.pageSize : groups.leftCount;
|
|
147
|
-
nodes.push(...
|
|
159
|
+
nodes.push(...convertGroups(groups.items, id));
|
|
148
160
|
if (data.groupOffset === undefined) {
|
|
149
161
|
data.groupOffset = {
|
|
150
162
|
done: groups.leftCount === 0,
|
|
@@ -160,240 +172,397 @@ export class EdaTreeView extends React.Component {
|
|
|
160
172
|
const key = `${id}_show_more`;
|
|
161
173
|
nodes.push({
|
|
162
174
|
key: key,
|
|
163
|
-
title:
|
|
175
|
+
title: renderShowMoreTitle(key, data, amount, data.groupOffset.total),
|
|
164
176
|
isLeaf: true,
|
|
165
177
|
});
|
|
166
178
|
}
|
|
167
179
|
}
|
|
168
|
-
if (data.groupOffset
|
|
169
|
-
const vectors = await api.getGroupVectors(id, data.vectorOffset?.offset);
|
|
170
|
-
|
|
180
|
+
if (!hideVectors && (data.groupOffset?.done || showOmittedVectors) && !data.vectorOffset?.done && (!isSpecialId || showOmittedVectors)) {
|
|
181
|
+
const vectors = await api.getGroupVectors(id, data.vectorOffset?.offset, showOmittedVectors);
|
|
182
|
+
await loadVectors(data, id, nodes, vectors);
|
|
171
183
|
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const
|
|
184
|
+
}, [convertGroups, loadVectors]);
|
|
185
|
+
const loadScenarios = useCallback(async (data, id, nodes) => {
|
|
186
|
+
const isSpecialId = id < 0;
|
|
187
|
+
const requestedId = isSpecialId ? undefined : id;
|
|
188
|
+
const showOmittedGroups = isSpecialId && id === -2;
|
|
175
189
|
if (!data.scenarioOffset?.done) {
|
|
176
|
-
const
|
|
177
|
-
const amount =
|
|
178
|
-
nodes.push(...
|
|
190
|
+
const scenarios = await api.getScenarioChildren(requestedId, data.scenarioOffset?.offset, showOmittedGroups);
|
|
191
|
+
const amount = scenarios.leftCount > api.pageSize ? api.pageSize : scenarios.leftCount;
|
|
192
|
+
nodes.push(...convertScenarios(scenarios.items, id));
|
|
179
193
|
if (data.scenarioOffset === undefined) {
|
|
180
194
|
data.scenarioOffset = {
|
|
181
|
-
done:
|
|
182
|
-
offset:
|
|
183
|
-
total:
|
|
195
|
+
done: scenarios.leftCount === 0,
|
|
196
|
+
offset: scenarios.items.length,
|
|
197
|
+
total: scenarios.items.length + scenarios.leftCount,
|
|
184
198
|
};
|
|
185
199
|
}
|
|
186
200
|
else {
|
|
187
|
-
data.scenarioOffset.done =
|
|
188
|
-
data.scenarioOffset.offset +=
|
|
201
|
+
data.scenarioOffset.done = scenarios.leftCount === 0;
|
|
202
|
+
data.scenarioOffset.offset += scenarios.items.length;
|
|
189
203
|
}
|
|
190
204
|
if (!data.scenarioOffset.done) {
|
|
191
205
|
const key = `${id}_show_more`;
|
|
192
206
|
nodes.push({
|
|
193
207
|
key: key,
|
|
194
|
-
title:
|
|
208
|
+
title: renderShowMoreTitle(key, data, amount, data.scenarioOffset.total),
|
|
195
209
|
isLeaf: true,
|
|
196
210
|
});
|
|
197
211
|
}
|
|
198
212
|
}
|
|
199
|
-
if (data.scenarioOffset.done && !data.vectorOffset?.done) {
|
|
213
|
+
if (!hideVectors && data.scenarioOffset.done && !data.vectorOffset?.done && !isSpecialId) {
|
|
200
214
|
const vectors = await api.getScenarioVectors(id, data.vectorOffset?.offset, undefined, true);
|
|
201
|
-
|
|
215
|
+
await loadVectors(data, id, nodes, vectors);
|
|
202
216
|
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
done: vectors.leftCount === 0,
|
|
211
|
-
offset: vectors.items.length,
|
|
212
|
-
total: vectors.items.length + vectors.leftCount,
|
|
213
|
-
};
|
|
217
|
+
}, [convertScenarios, loadVectors]);
|
|
218
|
+
const updateTreeState = useCallback((data, nodes, treeData, dataId, resolve, reject) => {
|
|
219
|
+
const index = treeData.findIndex((t) => (type === TreeViewType.GROUP ? t.group?.ID : t.scenario?.ID) === dataId);
|
|
220
|
+
if (index < 0) {
|
|
221
|
+
console.warn("Failed to find index");
|
|
222
|
+
reject();
|
|
223
|
+
return;
|
|
214
224
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
225
|
+
treeData[index] = { ...data, children: treeData[index].children };
|
|
226
|
+
if (treeData[index].children) {
|
|
227
|
+
treeData[index].children.pop();
|
|
228
|
+
treeData[index].children.push(...nodes);
|
|
218
229
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
nodes.push({
|
|
222
|
-
key: key,
|
|
223
|
-
title: this.renderTitle(key, data, amount, data.vectorOffset.total),
|
|
224
|
-
isLeaf: true,
|
|
225
|
-
});
|
|
230
|
+
else {
|
|
231
|
+
treeData[index].children = nodes;
|
|
226
232
|
}
|
|
227
|
-
|
|
228
|
-
|
|
233
|
+
nodeMap.current.set(dataId, treeData[index]);
|
|
234
|
+
resolve();
|
|
235
|
+
}, [type]);
|
|
236
|
+
const onLoadData = useCallback(async (data, id) => {
|
|
229
237
|
if (data.children) {
|
|
230
238
|
return Promise.resolve();
|
|
231
239
|
}
|
|
232
|
-
|
|
240
|
+
setLoadingKey(id);
|
|
233
241
|
try {
|
|
234
|
-
const { type } = this.props;
|
|
235
242
|
let id;
|
|
236
243
|
const nodes = [];
|
|
237
244
|
switch (type) {
|
|
238
245
|
case TreeViewType.GROUP:
|
|
239
246
|
if (!data.group) {
|
|
240
247
|
console.warn("No group!");
|
|
241
|
-
|
|
248
|
+
setLoadingKey(undefined);
|
|
242
249
|
return;
|
|
243
250
|
}
|
|
244
251
|
id = data.group.ID;
|
|
245
|
-
await
|
|
252
|
+
await loadGroups(data, id, nodes);
|
|
246
253
|
break;
|
|
247
254
|
case TreeViewType.SCENARIO:
|
|
248
255
|
if (!data.scenario) {
|
|
249
256
|
console.warn("No scenario!");
|
|
250
|
-
|
|
257
|
+
setLoadingKey(undefined);
|
|
251
258
|
return;
|
|
252
259
|
}
|
|
253
260
|
id = data.scenario.ID;
|
|
254
|
-
await
|
|
261
|
+
await loadScenarios(data, id, nodes);
|
|
255
262
|
break;
|
|
256
263
|
default:
|
|
257
|
-
|
|
264
|
+
setLoadingKey(undefined);
|
|
258
265
|
return;
|
|
259
266
|
}
|
|
260
|
-
const parentId = this.childParentMap.get(id);
|
|
261
267
|
await new Promise((resolve, reject) => {
|
|
262
|
-
|
|
263
|
-
const
|
|
264
|
-
if (
|
|
265
|
-
|
|
268
|
+
setTreeData((treeData) => {
|
|
269
|
+
const parentId = childParentMap.current.get(id);
|
|
270
|
+
if (parentId !== undefined) {
|
|
271
|
+
const parentNode = nodeMap.current.get(parentId);
|
|
272
|
+
if (parentNode?.children) {
|
|
273
|
+
updateTreeState(data, nodes, parentNode.children, id, resolve, reject);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
console.warn("No parent for node", id);
|
|
277
|
+
reject();
|
|
278
|
+
}
|
|
266
279
|
}
|
|
267
280
|
else {
|
|
268
|
-
|
|
269
|
-
reject();
|
|
281
|
+
updateTreeState(data, nodes, treeData, id, resolve, reject);
|
|
270
282
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
this.updateTree(data, nodes, this.state.treeData, id, resolve, reject);
|
|
274
|
-
}
|
|
283
|
+
return [...treeData];
|
|
284
|
+
});
|
|
275
285
|
});
|
|
276
286
|
}
|
|
277
287
|
catch (e) {
|
|
278
288
|
console.warn("Failed to load tree data", e);
|
|
279
289
|
}
|
|
280
290
|
finally {
|
|
281
|
-
|
|
291
|
+
setLoadingKey(undefined);
|
|
282
292
|
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
293
|
+
}, [api, type, convertGroups, convertScenarios, updateTreeState, loadGroups, loadScenarios]);
|
|
294
|
+
const renderShowMoreTitle = (key, data, amount, total) => (React.createElement(Typography.Link, { onClick: async (e) => {
|
|
295
|
+
e.stopPropagation();
|
|
296
|
+
e.preventDefault();
|
|
297
|
+
await onLoadData(data, key);
|
|
298
|
+
} }, i18n("Show %{n} more (of %{o})", { n: String(amount), o: String(total) })));
|
|
299
|
+
useEffect(() => {
|
|
300
|
+
const initLoad = async () => {
|
|
301
|
+
setLoadingKey("");
|
|
302
|
+
try {
|
|
303
|
+
let initialData;
|
|
304
|
+
if (showOmitted) {
|
|
305
|
+
if (type === TreeViewType.GROUP) {
|
|
306
|
+
initialData = [
|
|
307
|
+
{
|
|
308
|
+
key: -1,
|
|
309
|
+
title: i18n("Vector Groups"),
|
|
310
|
+
isLeaf: false,
|
|
311
|
+
icon: React.createElement(CheckCircleOutlined, null),
|
|
312
|
+
group: {
|
|
313
|
+
ID: -1,
|
|
314
|
+
Name: "",
|
|
315
|
+
DisplayName: "",
|
|
316
|
+
Type: 0,
|
|
317
|
+
RoundingPlaces: 0,
|
|
318
|
+
RoundingType: 0,
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
key: -2,
|
|
323
|
+
title: i18n("Omitted Vector Groups"),
|
|
324
|
+
isLeaf: false,
|
|
325
|
+
icon: React.createElement(StopOutlined, null),
|
|
326
|
+
group: {
|
|
327
|
+
ID: -2,
|
|
328
|
+
Name: "",
|
|
329
|
+
DisplayName: "",
|
|
330
|
+
Type: 0,
|
|
331
|
+
RoundingPlaces: 0,
|
|
332
|
+
RoundingType: 0,
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
...!hideVectors ? [{
|
|
336
|
+
key: -3,
|
|
337
|
+
title: i18n("Omitted Vectors"),
|
|
338
|
+
isLeaf: false,
|
|
339
|
+
icon: React.createElement(CloseCircleOutlined, null),
|
|
340
|
+
group: {
|
|
341
|
+
ID: -3,
|
|
342
|
+
Name: "",
|
|
343
|
+
DisplayName: "",
|
|
344
|
+
Type: 0,
|
|
345
|
+
RoundingPlaces: 0,
|
|
346
|
+
RoundingType: 0,
|
|
347
|
+
}
|
|
348
|
+
}] : []
|
|
349
|
+
];
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
initialData = [
|
|
353
|
+
{
|
|
354
|
+
key: -1,
|
|
355
|
+
title: i18n("Scenarios"),
|
|
356
|
+
isLeaf: false,
|
|
357
|
+
icon: React.createElement(CheckCircleOutlined, null),
|
|
358
|
+
scenario: {
|
|
359
|
+
ID: -1,
|
|
360
|
+
Name: "",
|
|
361
|
+
DisplayName: "",
|
|
362
|
+
Type: 0,
|
|
363
|
+
RoundingPlaces: 0,
|
|
364
|
+
RoundingType: 0,
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
key: -2,
|
|
369
|
+
title: i18n("Omitted Scenarios"),
|
|
370
|
+
isLeaf: false,
|
|
371
|
+
icon: React.createElement(StopOutlined, null),
|
|
372
|
+
scenario: {
|
|
373
|
+
ID: -2,
|
|
374
|
+
Name: "",
|
|
375
|
+
DisplayName: "",
|
|
376
|
+
Type: 0,
|
|
377
|
+
RoundingPlaces: 0,
|
|
378
|
+
RoundingType: 0,
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
];
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
if (type === TreeViewType.GROUP) {
|
|
386
|
+
const res = await api.getGroupChildren(undefined);
|
|
387
|
+
initialData = convertGroups(res.items, undefined);
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
const res = await api.getScenarioChildren(undefined);
|
|
391
|
+
initialData = convertScenarios(res.items, undefined);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
setTreeData(initialData);
|
|
395
|
+
}
|
|
396
|
+
catch (e) {
|
|
397
|
+
console.warn("Failed to load tree data", e);
|
|
398
|
+
}
|
|
399
|
+
finally {
|
|
400
|
+
setLoadingKey(undefined);
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
initLoad();
|
|
404
|
+
}, [api, type, showOmitted, convertGroups, convertScenarios]);
|
|
405
|
+
const titleRenderer = useCallback((node) => {
|
|
406
|
+
if (node.key === loadingKey) {
|
|
407
|
+
return React.createElement(Typography.Link, null,
|
|
408
|
+
React.createElement(LoadingOutlined, null),
|
|
409
|
+
i18n("Loading"),
|
|
410
|
+
"...");
|
|
287
411
|
}
|
|
288
|
-
|
|
289
|
-
|
|
412
|
+
return node.title;
|
|
413
|
+
}, [loadingKey]);
|
|
414
|
+
const onDoubleClick = useCallback((_e, node) => {
|
|
415
|
+
const type = getType(node);
|
|
416
|
+
if (type === undefined || type.id < 0) {
|
|
417
|
+
return;
|
|
290
418
|
}
|
|
291
|
-
|
|
292
|
-
|
|
419
|
+
if (node.vector && type.type === 0 && !disableVectorSelection) {
|
|
420
|
+
onItemDoubleClick?.(type, node.vector);
|
|
421
|
+
setSelectedKeys([node.key]);
|
|
293
422
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
const { type } = this.props;
|
|
298
|
-
const index = treeData.findIndex((t) => (type === TreeViewType.GROUP ? t.group?.ID : t.scenario?.ID) === dataId);
|
|
299
|
-
if (index < 0) {
|
|
300
|
-
console.warn("Failed to find index");
|
|
301
|
-
reject();
|
|
302
|
-
return;
|
|
423
|
+
else if (node.group && type.type === 1 && !disableBranchSelection) {
|
|
424
|
+
onItemDoubleClick?.(type, node.group);
|
|
425
|
+
setSelectedKeys([node.key]);
|
|
303
426
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
treeData[index].children.push(...nodes);
|
|
427
|
+
else if (node.scenario && type.type === 2 && !disableBranchSelection) {
|
|
428
|
+
onItemDoubleClick?.(type, node.scenario);
|
|
429
|
+
setSelectedKeys([node.key]);
|
|
308
430
|
}
|
|
309
|
-
|
|
310
|
-
|
|
431
|
+
}, [onItemDoubleClick]);
|
|
432
|
+
const getMenuItems = useCallback((node) => {
|
|
433
|
+
if (typeof node.key === "number" && node.key < 0) {
|
|
434
|
+
return [];
|
|
311
435
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
title: group.DisplayName,
|
|
321
|
-
isLeaf: false,
|
|
322
|
-
icon: React.createElement(FolderOpenOutlined, null),
|
|
323
|
-
group: group,
|
|
324
|
-
};
|
|
325
|
-
data.push(node);
|
|
326
|
-
this.childParentMap.set(group.ID, parentId);
|
|
327
|
-
this.nodeMap.set(group.ID, node);
|
|
436
|
+
const result = [
|
|
437
|
+
{ key: "EXPORT_TO_XML", label: i18n("Export to XML") },
|
|
438
|
+
];
|
|
439
|
+
if (node.vector) {
|
|
440
|
+
result.push(...[
|
|
441
|
+
{ key: "INCLUDE_TO_SCENARIO", label: i18n("Include vector to scenario") },
|
|
442
|
+
{ key: "INCLUDE_TO_GROUP", label: i18n("Include vector to group") },
|
|
443
|
+
]);
|
|
328
444
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
for (let scenario of scenarios) {
|
|
334
|
-
const node = {
|
|
335
|
-
key: scenario.ID,
|
|
336
|
-
title: scenario.DisplayName,
|
|
337
|
-
isLeaf: false,
|
|
338
|
-
icon: React.createElement(FolderOpenOutlined, null),
|
|
339
|
-
scenario: scenario,
|
|
340
|
-
};
|
|
341
|
-
data.push(node);
|
|
342
|
-
this.childParentMap.set(scenario.ID, parentId);
|
|
343
|
-
this.nodeMap.set(scenario.ID, node);
|
|
445
|
+
if (node.group) {
|
|
446
|
+
result.push(...[
|
|
447
|
+
{ key: "INCLUDE_TO_GROUP", label: i18n("Include vector to group") },
|
|
448
|
+
]);
|
|
344
449
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
for (let vector of vectors) {
|
|
350
|
-
const id = `${parentId}_${vector.ID}`;
|
|
351
|
-
const node = {
|
|
352
|
-
key: id,
|
|
353
|
-
title: vector.DisplayName,
|
|
354
|
-
isLeaf: true,
|
|
355
|
-
icon: this.getVectorIcon(vector.Type),
|
|
356
|
-
vector: vector,
|
|
357
|
-
};
|
|
358
|
-
data.push(node);
|
|
359
|
-
this.childParentMap.set(id, parentId);
|
|
360
|
-
this.nodeMap.set(id, node);
|
|
450
|
+
if (node.scenario) {
|
|
451
|
+
result.push(...[
|
|
452
|
+
{ key: "INCLUDE_TO_SCENARIO", label: i18n("Include vector to scenario") },
|
|
453
|
+
]);
|
|
361
454
|
}
|
|
362
|
-
return
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
return React.createElement(LetterDFilled, null);
|
|
372
|
-
case EdaVectorType.Descriptive:
|
|
373
|
-
return React.createElement(LetterCFilled, null);
|
|
374
|
-
case EdaVectorType.Interval:
|
|
375
|
-
return React.createElement(LetterIFilled, null);
|
|
376
|
-
case EdaVectorType.FifteenMinutesCalc:
|
|
377
|
-
return React.createElement(NumberFifteenFilled, { style: { color: "orange" } });
|
|
378
|
-
case EdaVectorType.HourCalc:
|
|
379
|
-
return React.createElement(LetterHFilled, { style: { color: "orange" } });
|
|
380
|
-
case EdaVectorType.DayCalc:
|
|
381
|
-
return React.createElement(LetterDFilled, { style: { color: "orange" } });
|
|
382
|
-
case EdaVectorType.Change:
|
|
383
|
-
return React.createElement(LetterCFilled, null);
|
|
384
|
-
case EdaVectorType.ChangeCalc:
|
|
385
|
-
return React.createElement(LetterCFilled, { style: { color: "orange" } });
|
|
386
|
-
case EdaVectorType.Pair:
|
|
387
|
-
return React.createElement(PairOutlined, null);
|
|
388
|
-
case EdaVectorType.Periodic:
|
|
389
|
-
return React.createElement(PeriodicOutlined, null);
|
|
390
|
-
case EdaVectorType.PeriodicCalc:
|
|
391
|
-
return React.createElement(PeriodicOutlined, { style: { color: "orange" } });
|
|
392
|
-
case EdaVectorType.Functional:
|
|
393
|
-
return React.createElement(FunctionOutlined, null);
|
|
394
|
-
default:
|
|
395
|
-
return React.createElement(QuestionOutlined, null);
|
|
455
|
+
return result;
|
|
456
|
+
}, []);
|
|
457
|
+
const onRightClick = useCallback(({ node }) => {
|
|
458
|
+
setRightClickedNode(node);
|
|
459
|
+
}, []);
|
|
460
|
+
const handleContextMenuItemClicked = useCallback(async ({ key }) => {
|
|
461
|
+
const type = getType(rightClickedNode);
|
|
462
|
+
if (type === undefined) {
|
|
463
|
+
return;
|
|
396
464
|
}
|
|
465
|
+
switch (key) {
|
|
466
|
+
case "EXPORT_TO_XML": {
|
|
467
|
+
let data = undefined;
|
|
468
|
+
switch (type.type) {
|
|
469
|
+
case 0: {
|
|
470
|
+
const result = await api.loadVectorData(type.id);
|
|
471
|
+
if (!result) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
data = { type: type.type, data: result };
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
case 1: {
|
|
478
|
+
const result = await api.loadGroupData(type.id);
|
|
479
|
+
if (!result) {
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
data = { type: type.type, data: result };
|
|
483
|
+
break;
|
|
484
|
+
}
|
|
485
|
+
case 2: {
|
|
486
|
+
const result = await api.loadScenarioData(type.id);
|
|
487
|
+
if (!result) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
data = { type: type.type, data: result };
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
triggerExportToXML(data);
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
case "INCLUDE_TO_SCENARIO":
|
|
498
|
+
triggerIncludeToScenario(type);
|
|
499
|
+
return;
|
|
500
|
+
case "INCLUDE_TO_GROUP":
|
|
501
|
+
triggerIncludeToGroup(type);
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
}, [rightClickedNode]);
|
|
505
|
+
return (React.createElement(Dropdown, { menu: {
|
|
506
|
+
items: (rightClickedNode && !hideContextMenu) ? getMenuItems(rightClickedNode) : [],
|
|
507
|
+
onClick: handleContextMenuItemClicked,
|
|
508
|
+
}, trigger: ['contextMenu'] },
|
|
509
|
+
React.createElement("div", { ref: divRef, className: styles.baseLayout },
|
|
510
|
+
React.createElement("div", { className: styles.absoluteLayout },
|
|
511
|
+
React.createElement(Tree, { blockNode: true, showLine: true, showIcon: true, switcherIcon: React.createElement(DownOutlined, null), height: height, loadData: onLoadData, onRightClick: onRightClick, onExpand: setExpandedKeys, onDoubleClick: onDoubleClick, expandedKeys: expandedKeys, selectedKeys: selectedKeys, titleRender: titleRenderer, treeData: treeData }),
|
|
512
|
+
renderActionDialogs()))));
|
|
513
|
+
};
|
|
514
|
+
const getVectorIcon = (type) => {
|
|
515
|
+
switch (type) {
|
|
516
|
+
case EdaVectorType.FifteenMinutes:
|
|
517
|
+
return React.createElement(NumberFifteenFilled, null);
|
|
518
|
+
case EdaVectorType.Hour:
|
|
519
|
+
return React.createElement(LetterHFilled, null);
|
|
520
|
+
case EdaVectorType.Day:
|
|
521
|
+
return React.createElement(LetterDFilled, null);
|
|
522
|
+
case EdaVectorType.Descriptive:
|
|
523
|
+
return React.createElement(LetterCFilled, null);
|
|
524
|
+
case EdaVectorType.Interval:
|
|
525
|
+
return React.createElement(LetterIFilled, null);
|
|
526
|
+
case EdaVectorType.FifteenMinutesCalc:
|
|
527
|
+
return React.createElement(NumberFifteenFilled, { style: { color: "orange" } });
|
|
528
|
+
case EdaVectorType.HourCalc:
|
|
529
|
+
return React.createElement(LetterHFilled, { style: { color: "orange" } });
|
|
530
|
+
case EdaVectorType.DayCalc:
|
|
531
|
+
return React.createElement(LetterDFilled, { style: { color: "orange" } });
|
|
532
|
+
case EdaVectorType.Change:
|
|
533
|
+
return React.createElement(LetterCFilled, null);
|
|
534
|
+
case EdaVectorType.ChangeCalc:
|
|
535
|
+
return React.createElement(LetterCFilled, { style: { color: "orange" } });
|
|
536
|
+
case EdaVectorType.Pair:
|
|
537
|
+
return React.createElement(PairOutlined, null);
|
|
538
|
+
case EdaVectorType.Periodic:
|
|
539
|
+
return React.createElement(PeriodicOutlined, null);
|
|
540
|
+
case EdaVectorType.PeriodicCalc:
|
|
541
|
+
return React.createElement(PeriodicOutlined, { style: { color: "orange" } });
|
|
542
|
+
case EdaVectorType.Functional:
|
|
543
|
+
return React.createElement(FunctionOutlined, null);
|
|
544
|
+
default:
|
|
545
|
+
return React.createElement(QuestionOutlined, null);
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
const getType = (node) => {
|
|
549
|
+
let type = undefined;
|
|
550
|
+
let id = undefined;
|
|
551
|
+
if (node?.vector) {
|
|
552
|
+
type = 0;
|
|
553
|
+
id = node.vector.ID;
|
|
554
|
+
}
|
|
555
|
+
if (node?.group) {
|
|
556
|
+
type = 1;
|
|
557
|
+
id = node.group.ID;
|
|
558
|
+
}
|
|
559
|
+
if (node?.scenario) {
|
|
560
|
+
type = 2;
|
|
561
|
+
id = node.scenario.ID;
|
|
562
|
+
}
|
|
563
|
+
if (type === undefined || id === undefined) {
|
|
564
|
+
return undefined;
|
|
397
565
|
}
|
|
398
|
-
}
|
|
566
|
+
return { type, id };
|
|
567
|
+
};
|
|
399
568
|
//# sourceMappingURL=edaTreeView.js.map
|