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
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { Button, Card, Checkbox, Col, Divider, InputNumber, Radio, Row, Space, theme } from "antd";
|
|
3
|
+
import i18n from "d2core/i18n/i18n";
|
|
4
|
+
import { EdaPeriodType, EdaPeriodValueType } from "../../constants/edaTypes";
|
|
5
|
+
import { isEqual } from "lodash";
|
|
6
|
+
import { IntervalInput } from "./intervalInput";
|
|
7
|
+
import { LocaleHolder } from "d2core/i18n/localeHolder";
|
|
8
|
+
import { FullPeriodType } from "./types";
|
|
9
|
+
import { toFullPeriodType } from "./utils";
|
|
10
|
+
import EnumValuePicker from "d2coreui/components/picker/enumValuePicker";
|
|
11
|
+
import dayjs from "d2core/dayjs";
|
|
12
|
+
export const DescriptiveVectorDetailPanel = ({ data, onChange }) => {
|
|
13
|
+
const { token } = theme.useToken();
|
|
14
|
+
const [periodType, setPeriodType] = useState(toFullPeriodType(data));
|
|
15
|
+
const [modifiedData, setModifiedData] = useState({ ...data });
|
|
16
|
+
const fullMask = useMemo(() => LocaleHolder.getDateTimeFormat(true, false, false), []);
|
|
17
|
+
const dateMask = useMemo(() => LocaleHolder.getDateFormat(false), []);
|
|
18
|
+
const modified = !isEqual(modifiedData, data) || periodType !== toFullPeriodType(data);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setPeriodType(toFullPeriodType(data));
|
|
21
|
+
setModifiedData({ ...data });
|
|
22
|
+
}, [data]);
|
|
23
|
+
return (React.createElement(Space, { style: { width: "100%", padding: `${token.paddingXXS}px`, overflowY: "auto" }, direction: "vertical" },
|
|
24
|
+
React.createElement(Card, { title: i18n("Period Type") + ":" },
|
|
25
|
+
React.createElement(Radio.Group, { value: periodType, style: { display: 'flex', flexDirection: 'column', gap: '4px' }, onChange: (e) => {
|
|
26
|
+
const period = e.target.value;
|
|
27
|
+
let from;
|
|
28
|
+
let to;
|
|
29
|
+
switch (period) {
|
|
30
|
+
case FullPeriodType.Base:
|
|
31
|
+
case FullPeriodType.Interval:
|
|
32
|
+
from = dayjs().startOf('year');
|
|
33
|
+
to = dayjs().endOf('year').millisecond(0);
|
|
34
|
+
break;
|
|
35
|
+
case FullPeriodType.Day:
|
|
36
|
+
from = dayjs().year(2000).startOf('year');
|
|
37
|
+
to = dayjs().year(2000).startOf('year').endOf('day').millisecond(0);
|
|
38
|
+
break;
|
|
39
|
+
case FullPeriodType.Week:
|
|
40
|
+
from = dayjs().year(2002).startOf('year');
|
|
41
|
+
to = dayjs().year(2002).startOf('year').second(6);
|
|
42
|
+
break;
|
|
43
|
+
case FullPeriodType.YearQuarter:
|
|
44
|
+
from = dayjs().year(1972).startOf('year');
|
|
45
|
+
to = dayjs().year(1972).startOf('year').month(9);
|
|
46
|
+
break;
|
|
47
|
+
case FullPeriodType.YearMonth:
|
|
48
|
+
from = dayjs().year(1973).startOf('year');
|
|
49
|
+
to = dayjs().year(1973).startOf('year').month(11);
|
|
50
|
+
break;
|
|
51
|
+
case FullPeriodType.YearWeek:
|
|
52
|
+
from = dayjs().year(1974).startOf('year').second(1);
|
|
53
|
+
to = dayjs().year(1974).startOf('year').second(52);
|
|
54
|
+
break;
|
|
55
|
+
case FullPeriodType.YearDay:
|
|
56
|
+
from = dayjs().year(1975).startOf('year');
|
|
57
|
+
to = dayjs().year(1975).startOf('year').endOf('year').millisecond(0);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
setPeriodType(period);
|
|
61
|
+
setModifiedData((prev) => ({ ...prev, periodType: toEdaPeriodType(period), timeFrom: from, timeTo: to }));
|
|
62
|
+
} },
|
|
63
|
+
React.createElement(Radio, { value: FullPeriodType.Base }, i18n("Basic (value in every moment)")),
|
|
64
|
+
React.createElement(Divider, { style: { margin: 0 } }),
|
|
65
|
+
React.createElement(Radio, { value: FullPeriodType.Interval }, i18n("Interval")),
|
|
66
|
+
React.createElement(Divider, { style: { margin: 0 } }),
|
|
67
|
+
React.createElement(Radio, { value: FullPeriodType.YearQuarter }, i18n("Quarter of the year (I., II., III, IV.)")),
|
|
68
|
+
React.createElement(Radio, { value: FullPeriodType.YearMonth }, i18n("Month of the year (January - December)")),
|
|
69
|
+
React.createElement(Radio, { value: FullPeriodType.YearWeek }, i18n("Week of the year (1. - 52.)")),
|
|
70
|
+
React.createElement(Radio, { value: FullPeriodType.YearDay }, i18n("Date in year (1.1. - 31.12.)")),
|
|
71
|
+
React.createElement(Divider, { style: { margin: 0 } }),
|
|
72
|
+
React.createElement(Radio, { value: FullPeriodType.Week }, i18n("Day in week (Monday - Sunday)")),
|
|
73
|
+
React.createElement(Divider, { style: { margin: 0 } }),
|
|
74
|
+
React.createElement(Radio, { value: FullPeriodType.Day }, i18n("Time during the day (00:00 - 23:59)")))),
|
|
75
|
+
periodType !== FullPeriodType.Base && (React.createElement(Card, null,
|
|
76
|
+
React.createElement(Row, { gutter: [8, 8] },
|
|
77
|
+
React.createElement(Col, { span: 8 },
|
|
78
|
+
getIntervalDescription(periodType),
|
|
79
|
+
":"),
|
|
80
|
+
React.createElement(Col, { span: 16 },
|
|
81
|
+
React.createElement(Row, { gutter: [8, 8] },
|
|
82
|
+
React.createElement(Col, { span: 6 },
|
|
83
|
+
i18n("From"),
|
|
84
|
+
":"),
|
|
85
|
+
React.createElement(Col, { span: 18 },
|
|
86
|
+
React.createElement(IntervalInput, { value: modifiedData.timeFrom, fullMask: fullMask, dateMask: dateMask, periodType: periodType, onChange: (value) => {
|
|
87
|
+
setModifiedData((prev) => ({ ...prev, timeFrom: value }));
|
|
88
|
+
} })),
|
|
89
|
+
React.createElement(Col, { span: 6 },
|
|
90
|
+
i18n("To"),
|
|
91
|
+
":"),
|
|
92
|
+
React.createElement(Col, { span: 18 },
|
|
93
|
+
React.createElement(IntervalInput, { value: modifiedData.timeTo, fullMask: fullMask, dateMask: dateMask, periodType: periodType, onChange: (value) => {
|
|
94
|
+
setModifiedData((prev) => ({ ...prev, timeTo: value }));
|
|
95
|
+
} }))))))),
|
|
96
|
+
React.createElement(Card, null,
|
|
97
|
+
React.createElement(Row, { gutter: [8, 8] },
|
|
98
|
+
React.createElement(Col, { span: 8 },
|
|
99
|
+
i18n("Operation Type"),
|
|
100
|
+
":"),
|
|
101
|
+
React.createElement(Col, { span: 16 },
|
|
102
|
+
React.createElement(EnumValuePicker, { style: { width: "100%" }, value: modifiedData.valueType, values: EdaPeriodValueType, translateValue: true, translationPrefix: "EdaPeriodValueType_", onChange: (value) => {
|
|
103
|
+
setModifiedData((prev) => ({ ...prev, valueType: value }));
|
|
104
|
+
} })),
|
|
105
|
+
React.createElement(Col, { span: 8 },
|
|
106
|
+
i18n("Value"),
|
|
107
|
+
":"),
|
|
108
|
+
React.createElement(Col, { span: 16 },
|
|
109
|
+
React.createElement(InputNumber, { value: modifiedData.value, style: { width: "100%" }, onChange: (value) => {
|
|
110
|
+
if (value !== null) {
|
|
111
|
+
setModifiedData((prev) => ({ ...prev, value: value }));
|
|
112
|
+
}
|
|
113
|
+
} })),
|
|
114
|
+
modifiedData.valueType === EdaPeriodValueType.Interpolation && (React.createElement(React.Fragment, null,
|
|
115
|
+
React.createElement(Col, { span: 8 },
|
|
116
|
+
i18n("To"),
|
|
117
|
+
":"),
|
|
118
|
+
React.createElement(Col, { span: 16 },
|
|
119
|
+
React.createElement(InputNumber, { value: modifiedData.value2, style: { width: "100%" }, onChange: (value) => {
|
|
120
|
+
if (value !== null) {
|
|
121
|
+
setModifiedData((prev) => ({ ...prev, value2: value }));
|
|
122
|
+
}
|
|
123
|
+
} })))))),
|
|
124
|
+
React.createElement(Card, null,
|
|
125
|
+
React.createElement(Row, { gutter: [8, 8] },
|
|
126
|
+
React.createElement(Col, { span: 12 },
|
|
127
|
+
React.createElement(Checkbox, { checked: modifiedData.valid, onChange: (e) => {
|
|
128
|
+
setModifiedData((prev) => ({ ...prev, valid: e.target.checked }));
|
|
129
|
+
} }, i18n("Valid entry"))),
|
|
130
|
+
React.createElement(Col, { span: 12 },
|
|
131
|
+
i18n("Supplement number"),
|
|
132
|
+
": ",
|
|
133
|
+
modifiedData.supplement))),
|
|
134
|
+
React.createElement("div", { style: { display: "flex", justifyContent: "flex-end" } },
|
|
135
|
+
React.createElement(Button, { type: "primary", disabled: !modified, onClick: () => onChange(modifiedData) }, i18n("Change")))));
|
|
136
|
+
};
|
|
137
|
+
function getIntervalDescription(periodType) {
|
|
138
|
+
switch (periodType) {
|
|
139
|
+
case FullPeriodType.Base:
|
|
140
|
+
return "";
|
|
141
|
+
case FullPeriodType.Interval:
|
|
142
|
+
case FullPeriodType.YearQuarter:
|
|
143
|
+
case FullPeriodType.YearMonth:
|
|
144
|
+
case FullPeriodType.YearWeek:
|
|
145
|
+
return i18n("Annual period");
|
|
146
|
+
case FullPeriodType.Day:
|
|
147
|
+
return i18n("Interval");
|
|
148
|
+
case FullPeriodType.Week:
|
|
149
|
+
return i18n("Daily");
|
|
150
|
+
case FullPeriodType.YearDay:
|
|
151
|
+
return i18n("On the days");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function toEdaPeriodType(period) {
|
|
155
|
+
switch (period) {
|
|
156
|
+
case FullPeriodType.Base:
|
|
157
|
+
return EdaPeriodType.Base;
|
|
158
|
+
case FullPeriodType.Interval:
|
|
159
|
+
return EdaPeriodType.Interval;
|
|
160
|
+
case FullPeriodType.Day:
|
|
161
|
+
return EdaPeriodType.Day;
|
|
162
|
+
case FullPeriodType.Week:
|
|
163
|
+
return EdaPeriodType.Week;
|
|
164
|
+
case FullPeriodType.YearDay:
|
|
165
|
+
case FullPeriodType.YearMonth:
|
|
166
|
+
case FullPeriodType.YearQuarter:
|
|
167
|
+
case FullPeriodType.YearWeek:
|
|
168
|
+
return EdaPeriodType.Year;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=descriptiveVectorDetailPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptiveVectorDetailPanel.js","sourceRoot":"","sources":["../../../../../../../coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/descriptiveVectorDetailPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAK,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,MAAM,CAAC;AACjG,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAC,aAAa,EAAE,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAoB,cAAc,EAAC,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AACzC,OAAO,eAAe,MAAM,4CAA4C,CAAC;AACzE,OAAO,KAAK,MAAM,cAAc,CAAC;AAOjC,MAAM,CAAC,MAAM,4BAA4B,GAAc,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAE,EAAE;IACxE,MAAM,EAAC,KAAK,EAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IAEjC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAiB,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IACrF,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAoB,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QACzB,KAAK,cAAc,CAAC,OAAO;YACvB,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;AACL,CAAC;AAED,SAAS,eAAe,CAAC,MAAsB;IAC3C,QAAQ,MAAM,EAAE,CAAC;QACb,KAAK,cAAc,CAAC,IAAI;YACpB,OAAO,aAAa,CAAC,IAAI,CAAC;QAC9B,KAAK,cAAc,CAAC,QAAQ;YACxB,OAAO,aAAa,CAAC,QAAQ,CAAC;QAClC,KAAK,cAAc,CAAC,GAAG;YACnB,OAAO,aAAa,CAAC,GAAG,CAAC;QAC7B,KAAK,cAAc,CAAC,IAAI;YACpB,OAAO,aAAa,CAAC,IAAI,CAAC;QAC9B,KAAK,cAAc,CAAC,OAAO,CAAC;QAC5B,KAAK,cAAc,CAAC,SAAS,CAAC;QAC9B,KAAK,cAAc,CAAC,WAAW,CAAC;QAChC,KAAK,cAAc,CAAC,QAAQ;YACxB,OAAO,aAAa,CAAC,IAAI,CAAC;IAClC,CAAC;AACL,CAAC","sourcesContent":["import React, {FC, useEffect, useMemo, useState} from \"react\";\r\nimport {Button, Card, Checkbox, Col, Divider, InputNumber, Radio, Row, Space, theme} from \"antd\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {EdaPeriodType, EdaPeriodValueType} from \"../../constants/edaTypes\";\r\nimport {isEqual} from \"lodash\";\r\nimport {IntervalInput} from \"./intervalInput\";\r\nimport {LocaleHolder} from \"d2core/i18n/localeHolder\";\r\nimport {DescriptiveVector, FullPeriodType} from \"./types\";\r\nimport {toFullPeriodType} from \"./utils\";\r\nimport EnumValuePicker from \"d2coreui/components/picker/enumValuePicker\";\r\nimport dayjs from \"d2core/dayjs\";\r\n\r\ninterface Props {\r\n data: DescriptiveVector\r\n onChange: (data: DescriptiveVector) => void\r\n}\r\n\r\nexport const DescriptiveVectorDetailPanel: FC<Props> = ({data, onChange}) => {\r\n const {token} = theme.useToken();\r\n\r\n const [periodType, setPeriodType] = useState<FullPeriodType>(toFullPeriodType(data));\r\n const [modifiedData, setModifiedData] = useState<DescriptiveVector>({...data});\r\n\r\n const fullMask = useMemo(() => LocaleHolder.getDateTimeFormat(true, false, false), []);\r\n const dateMask = useMemo(() => LocaleHolder.getDateFormat(false), []);\r\n\r\n const modified = !isEqual(modifiedData, data) || periodType !== toFullPeriodType(data);\r\n\r\n useEffect(() => {\r\n setPeriodType(toFullPeriodType(data));\r\n setModifiedData({...data});\r\n }, [data]);\r\n\r\n return (\r\n <Space style={{width: \"100%\", padding: `${token.paddingXXS}px`, overflowY: \"auto\"}} direction={\"vertical\"}>\r\n <Card title={i18n(\"Period Type\") + \":\"}>\r\n <Radio.Group\r\n value={periodType}\r\n style={{display: 'flex', flexDirection: 'column', gap: '4px'}}\r\n onChange={(e) => {\r\n const period = e.target.value as FullPeriodType;\r\n let from: dayjs.Dayjs;\r\n let to: dayjs.Dayjs;\r\n\r\n switch (period) {\r\n case FullPeriodType.Base:\r\n case FullPeriodType.Interval:\r\n from = dayjs().startOf('year');\r\n to = dayjs().endOf('year').millisecond(0);\r\n break;\r\n case FullPeriodType.Day:\r\n from = dayjs().year(2000).startOf('year');\r\n to = dayjs().year(2000).startOf('year').endOf('day').millisecond(0);\r\n break;\r\n case FullPeriodType.Week:\r\n from = dayjs().year(2002).startOf('year');\r\n to = dayjs().year(2002).startOf('year').second(6);\r\n break;\r\n case FullPeriodType.YearQuarter:\r\n from = dayjs().year(1972).startOf('year');\r\n to = dayjs().year(1972).startOf('year').month(9);\r\n break;\r\n case FullPeriodType.YearMonth:\r\n from = dayjs().year(1973).startOf('year');\r\n to = dayjs().year(1973).startOf('year').month(11);\r\n break;\r\n case FullPeriodType.YearWeek:\r\n from = dayjs().year(1974).startOf('year').second(1);\r\n to = dayjs().year(1974).startOf('year').second(52);\r\n break;\r\n case FullPeriodType.YearDay:\r\n from = dayjs().year(1975).startOf('year');\r\n to = dayjs().year(1975).startOf('year').endOf('year').millisecond(0);\r\n break;\r\n }\r\n\r\n setPeriodType(period);\r\n setModifiedData((prev): DescriptiveVector => ({...prev, periodType: toEdaPeriodType(period), timeFrom: from, timeTo: to}));\r\n }}\r\n >\r\n <Radio value={FullPeriodType.Base}>{i18n(\"Basic (value in every moment)\")}</Radio>\r\n <Divider style={{margin: 0}}/>\r\n <Radio value={FullPeriodType.Interval}>{i18n(\"Interval\")}</Radio>\r\n <Divider style={{margin: 0}}/>\r\n <Radio value={FullPeriodType.YearQuarter}>{i18n(\"Quarter of the year (I., II., III, IV.)\")}</Radio>\r\n <Radio value={FullPeriodType.YearMonth}>{i18n(\"Month of the year (January - December)\")}</Radio>\r\n <Radio value={FullPeriodType.YearWeek}>{i18n(\"Week of the year (1. - 52.)\")}</Radio>\r\n <Radio value={FullPeriodType.YearDay}>{i18n(\"Date in year (1.1. - 31.12.)\")}</Radio>\r\n <Divider style={{margin: 0}}/>\r\n <Radio value={FullPeriodType.Week}>{i18n(\"Day in week (Monday - Sunday)\")}</Radio>\r\n <Divider style={{margin: 0}}/>\r\n <Radio value={FullPeriodType.Day}>{i18n(\"Time during the day (00:00 - 23:59)\")}</Radio>\r\n </Radio.Group>\r\n </Card>\r\n {periodType !== FullPeriodType.Base && (\r\n <Card>\r\n <Row gutter={[8, 8]}>\r\n <Col span={8}>\r\n {getIntervalDescription(periodType)}:\r\n </Col>\r\n <Col span={16}>\r\n <Row gutter={[8, 8]}>\r\n <Col span={6}>{i18n(\"From\")}:</Col>\r\n <Col span={18}>\r\n <IntervalInput\r\n value={modifiedData.timeFrom}\r\n fullMask={fullMask}\r\n dateMask={dateMask}\r\n periodType={periodType}\r\n onChange={(value) => {\r\n setModifiedData((prev): DescriptiveVector => ({...prev, timeFrom: value}))\r\n }}\r\n />\r\n </Col>\r\n\r\n <Col span={6}>{i18n(\"To\")}:</Col>\r\n <Col span={18}>\r\n <IntervalInput\r\n value={modifiedData.timeTo}\r\n fullMask={fullMask}\r\n dateMask={dateMask}\r\n periodType={periodType}\r\n onChange={(value) => {\r\n setModifiedData((prev): DescriptiveVector => ({...prev, timeTo: value}))\r\n }}\r\n />\r\n </Col>\r\n </Row>\r\n </Col>\r\n </Row>\r\n </Card>\r\n )}\r\n <Card>\r\n <Row gutter={[8, 8]}>\r\n <Col span={8}>{i18n(\"Operation Type\")}:</Col>\r\n <Col span={16}>\r\n <EnumValuePicker\r\n style={{width: \"100%\"}}\r\n value={modifiedData.valueType}\r\n values={EdaPeriodValueType}\r\n translateValue\r\n translationPrefix={\"EdaPeriodValueType_\"}\r\n onChange={(value) => {\r\n setModifiedData((prev): DescriptiveVector => ({...prev, valueType: value as number}))\r\n }}\r\n />\r\n </Col>\r\n\r\n <Col span={8}>{i18n(\"Value\")}:</Col>\r\n <Col span={16}>\r\n <InputNumber\r\n value={modifiedData.value}\r\n style={{width: \"100%\"}}\r\n onChange={(value) => {\r\n if (value !== null) {\r\n setModifiedData((prev) => ({...prev, value: value}));\r\n }\r\n }}\r\n />\r\n </Col>\r\n\r\n {modifiedData.valueType === EdaPeriodValueType.Interpolation && (\r\n <>\r\n <Col span={8}>{i18n(\"To\")}:</Col>\r\n <Col span={16}>\r\n <InputNumber\r\n value={modifiedData.value2}\r\n style={{width: \"100%\"}}\r\n onChange={(value) => {\r\n if (value !== null) {\r\n setModifiedData((prev) => ({...prev, value2: value}));\r\n }\r\n }}\r\n />\r\n </Col>\r\n </>\r\n )}\r\n </Row>\r\n </Card>\r\n <Card>\r\n <Row gutter={[8, 8]}>\r\n <Col span={12}>\r\n <Checkbox\r\n checked={modifiedData.valid}\r\n onChange={(e) => {\r\n setModifiedData((prev): DescriptiveVector => ({...prev, valid: e.target.checked}));\r\n }}\r\n >\r\n {i18n(\"Valid entry\")}\r\n </Checkbox>\r\n </Col>\r\n <Col span={12}>{i18n(\"Supplement number\")}: {modifiedData.supplement}</Col>\r\n </Row>\r\n </Card>\r\n <div style={{display: \"flex\", justifyContent: \"flex-end\"}}>\r\n <Button\r\n type={\"primary\"}\r\n disabled={!modified}\r\n onClick={() => onChange(modifiedData)}\r\n >\r\n {i18n(\"Change\")}\r\n </Button>\r\n </div>\r\n </Space>\r\n );\r\n}\r\n\r\nfunction getIntervalDescription(periodType: FullPeriodType) {\r\n switch (periodType) {\r\n case FullPeriodType.Base:\r\n return \"\";\r\n case FullPeriodType.Interval:\r\n case FullPeriodType.YearQuarter:\r\n case FullPeriodType.YearMonth:\r\n case FullPeriodType.YearWeek:\r\n return i18n(\"Annual period\");\r\n case FullPeriodType.Day:\r\n return i18n(\"Interval\");\r\n case FullPeriodType.Week:\r\n return i18n(\"Daily\");\r\n case FullPeriodType.YearDay:\r\n return i18n(\"On the days\");\r\n }\r\n}\r\n\r\nfunction toEdaPeriodType(period: FullPeriodType): EdaPeriodType {\r\n switch (period) {\r\n case FullPeriodType.Base:\r\n return EdaPeriodType.Base;\r\n case FullPeriodType.Interval:\r\n return EdaPeriodType.Interval;\r\n case FullPeriodType.Day:\r\n return EdaPeriodType.Day;\r\n case FullPeriodType.Week:\r\n return EdaPeriodType.Week;\r\n case FullPeriodType.YearDay:\r\n case FullPeriodType.YearMonth:\r\n case FullPeriodType.YearQuarter:\r\n case FullPeriodType.YearWeek:\r\n return EdaPeriodType.Year;\r\n }\r\n}"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { EdaSamplingType } from "../../constants/edaTypes";
|
|
3
|
+
import dayjs from "d2core/dayjs";
|
|
4
|
+
import { VectorValuesData } from "../../../../../api/eda/edaManagerApi";
|
|
5
|
+
interface Props {
|
|
6
|
+
displayData: Record<number, {
|
|
7
|
+
data: VectorValuesData;
|
|
8
|
+
}>;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
params: {
|
|
11
|
+
bt: dayjs.Dayjs;
|
|
12
|
+
et: dayjs.Dayjs;
|
|
13
|
+
sampling: EdaSamplingType;
|
|
14
|
+
};
|
|
15
|
+
onParamsChange: (params: {
|
|
16
|
+
bt: dayjs.Dayjs;
|
|
17
|
+
et: dayjs.Dayjs;
|
|
18
|
+
sampling: EdaSamplingType;
|
|
19
|
+
}) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const GraphPanel: FC<Props>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
2
|
+
import { Card, Space } from "antd";
|
|
3
|
+
import { createStyles } from "antd-style";
|
|
4
|
+
import { EdaLoadingOverlay } from "../../components/edaLoadingOverlay";
|
|
5
|
+
import { EdaSampleRangePickerPanel } from "../../components/edaSampleRangePickerPanel";
|
|
6
|
+
import { EdaChartViewer } from "../../components/edaChartViewer";
|
|
7
|
+
import { getOrigModifiedVectors } from "./utils";
|
|
8
|
+
const useStyles = createStyles(({ css, token }) => {
|
|
9
|
+
return {
|
|
10
|
+
baseLayout: css `
|
|
11
|
+
display: flex;
|
|
12
|
+
height: 100%;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
border-top-left-radius: 0;
|
|
16
|
+
border-top-right-radius: 0;
|
|
17
|
+
|
|
18
|
+
> .ant-card-body {
|
|
19
|
+
height: 100%;
|
|
20
|
+
padding: ${token.paddingXS}px;
|
|
21
|
+
|
|
22
|
+
> div {
|
|
23
|
+
height: 100%;
|
|
24
|
+
overflow-x: hidden;
|
|
25
|
+
overflow-y: auto;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.eda-detail-no-data {
|
|
30
|
+
padding: ${token.padding}px;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center !important;
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ant-space-item:last-child {
|
|
39
|
+
height: 100%;
|
|
40
|
+
}
|
|
41
|
+
`,
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
export const GraphPanel = ({ displayData, isLoading, params, onParamsChange }) => {
|
|
45
|
+
const { styles } = useStyles();
|
|
46
|
+
const vectors = useMemo(() => getOrigModifiedVectors(), []);
|
|
47
|
+
const [visibleVectors, setVisibleVectors] = useState(new Set([0, 1]));
|
|
48
|
+
const handleRangeChange = useCallback((bt, et, sampling) => onParamsChange({ bt, et, sampling }), []);
|
|
49
|
+
const handleToggleVisibility = useCallback((id, visible) => {
|
|
50
|
+
setVisibleVectors((prev) => {
|
|
51
|
+
const next = new Set(prev);
|
|
52
|
+
if (visible) {
|
|
53
|
+
next.add(id);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
next.delete(id);
|
|
57
|
+
}
|
|
58
|
+
return next;
|
|
59
|
+
});
|
|
60
|
+
}, []);
|
|
61
|
+
const handleToggleAllVisibility = useCallback((visible) => {
|
|
62
|
+
if (visible) {
|
|
63
|
+
setVisibleVectors(new Set([0, 1]));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
setVisibleVectors(new Set());
|
|
67
|
+
}
|
|
68
|
+
}, []);
|
|
69
|
+
return (React.createElement(Card, { className: styles.baseLayout },
|
|
70
|
+
isLoading && React.createElement(EdaLoadingOverlay, null),
|
|
71
|
+
React.createElement(Space, { direction: "vertical", style: { width: "100%", height: "100%" } },
|
|
72
|
+
React.createElement(EdaSampleRangePickerPanel, { bt: params.bt, et: params.et, sampling: params.sampling, totalCount: 1, pageSize: 1, loading: isLoading, page: 1, onChangeRange: handleRangeChange, onChangePage: () => { }, onChangeVectors: () => { } }),
|
|
73
|
+
React.createElement(EdaChartViewer, { vectors: vectors, data: displayData, visibleVectors: visibleVectors, isDataInitialized: true, onToggleVisibility: handleToggleVisibility, onToggleAllVisibility: handleToggleAllVisibility }))));
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=graphPanel.js.map
|
package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/graphPanel.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphPanel.js","sourceRoot":"","sources":["../../../../../../../coreui/components/edaManagerCom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,EAAE,iBAAiB,EAChC,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC,EACtB,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC,GAC3B;YACF,oBAAC,cAAc,IACX,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,EACjB,cAAc,EAAE,cAAc,EAC9B,iBAAiB,QACjB,kBAAkB,EAAE,sBAAsB,EAC1C,qBAAqB,EAAE,yBAAyB,GAClD,CACE,CACL,CACV,CAAC;AACN,CAAC,CAAA","sourcesContent":["import React, {FC, useCallback, useMemo, useState} from \"react\";\r\nimport {Card, Space} from \"antd\";\r\nimport {createStyles} from \"antd-style\";\r\nimport {EdaLoadingOverlay} from \"../../components/edaLoadingOverlay\";\r\nimport {EdaSampleRangePickerPanel} from \"../../components/edaSampleRangePickerPanel\";\r\nimport {EdaSamplingType} from \"../../constants/edaTypes\";\r\nimport dayjs from \"d2core/dayjs\";\r\nimport {VectorValuesData} from \"../../../../../api/eda/edaManagerApi\";\r\nimport {EdaChartViewer} from \"../../components/edaChartViewer\";\r\nimport {getOrigModifiedVectors} from \"./utils\";\r\n\r\nconst useStyles = createStyles(({css, token}) => {\r\n return {\r\n baseLayout: css`\r\n display: flex;\r\n height: 100%;\r\n flex-direction: column;\r\n justify-content: space-between;\r\n border-top-left-radius: 0;\r\n border-top-right-radius: 0;\r\n\r\n > .ant-card-body {\r\n height: 100%;\r\n padding: ${token.paddingXS}px;\r\n\r\n > div {\r\n height: 100%;\r\n overflow-x: hidden;\r\n overflow-y: auto;\r\n }\r\n }\r\n\r\n .eda-detail-no-data {\r\n padding: ${token.padding}px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center !important;\r\n width: 100%;\r\n height: 100%;\r\n }\r\n\r\n .ant-space-item:last-child {\r\n height: 100%;\r\n }\r\n `,\r\n }\r\n});\r\n\r\ninterface Props {\r\n displayData: Record<number, {data: VectorValuesData}>;\r\n isLoading: boolean;\r\n params: { bt: dayjs.Dayjs; et: dayjs.Dayjs; sampling: EdaSamplingType };\r\n onParamsChange: (params: { bt: dayjs.Dayjs; et: dayjs.Dayjs; sampling: EdaSamplingType }) => void;\r\n}\r\n\r\nexport const GraphPanel: FC<Props> = ({displayData, isLoading, params, onParamsChange}) => {\r\n const {styles} = useStyles();\r\n\r\n const vectors = useMemo(() => getOrigModifiedVectors(), []);\r\n const [visibleVectors, setVisibleVectors] = useState<Set<number>>(new Set([0, 1]));\r\n\r\n const handleRangeChange = useCallback((bt: dayjs.Dayjs, et: dayjs.Dayjs, sampling: EdaSamplingType) => onParamsChange({bt, et, sampling}), []);\r\n\r\n const handleToggleVisibility = useCallback((id: number, visible: boolean) => {\r\n setVisibleVectors((prev) => {\r\n const next = new Set(prev);\r\n\r\n if (visible) {\r\n next.add(id);\r\n } else {\r\n next.delete(id);\r\n }\r\n\r\n return next;\r\n });\r\n }, []);\r\n\r\n const handleToggleAllVisibility = useCallback((visible: boolean) => {\r\n if (visible) {\r\n setVisibleVectors(new Set([0, 1]));\r\n } else {\r\n setVisibleVectors(new Set());\r\n }\r\n }, []);\r\n\r\n return (\r\n <Card className={styles.baseLayout}>\r\n {isLoading && <EdaLoadingOverlay/>}\r\n <Space direction=\"vertical\" style={{width: \"100%\", height: \"100%\"}}>\r\n <EdaSampleRangePickerPanel\r\n bt={params.bt}\r\n et={params.et}\r\n sampling={params.sampling}\r\n totalCount={1}\r\n pageSize={1}\r\n loading={isLoading}\r\n page={1}\r\n onChangeRange={handleRangeChange}\r\n onChangePage={() => {}}\r\n onChangeVectors={() => {}}\r\n />\r\n <EdaChartViewer\r\n vectors={vectors}\r\n data={displayData}\r\n visibleVectors={visibleVectors}\r\n isDataInitialized\r\n onToggleVisibility={handleToggleVisibility}\r\n onToggleAllVisibility={handleToggleAllVisibility}\r\n />\r\n </Space>\r\n </Card>\r\n );\r\n}"]}
|
package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/intervalInput.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import dayjs from "d2core/dayjs";
|
|
3
|
+
import { FullPeriodType } from "./types";
|
|
4
|
+
interface Props {
|
|
5
|
+
value: dayjs.Dayjs;
|
|
6
|
+
fullMask: string;
|
|
7
|
+
dateMask: string;
|
|
8
|
+
periodType: FullPeriodType;
|
|
9
|
+
onChange: (value: dayjs.Dayjs) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const IntervalInput: FC<Props>;
|
|
12
|
+
export {};
|
package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/intervalInput.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DatePicker, InputNumber, TimePicker } from "antd";
|
|
3
|
+
import DateTimeInput from "d2coreui/components/date/dateTimeInput";
|
|
4
|
+
import EnumValuePicker from "d2coreui/components/picker/enumValuePicker";
|
|
5
|
+
import { DaysInWeek, FullPeriodType, MonthsInYear, QuarterType, YearPeriodType } from "./types";
|
|
6
|
+
export const IntervalInput = ({ value, fullMask, dateMask, periodType, onChange }) => {
|
|
7
|
+
switch (periodType) {
|
|
8
|
+
case FullPeriodType.Day:
|
|
9
|
+
return (React.createElement(TimePicker, { value: value, style: { width: "100%" }, onChange: onChange, allowClear: false, showSecond: false }));
|
|
10
|
+
case FullPeriodType.Interval:
|
|
11
|
+
return (React.createElement(DateTimeInput, { value: value, mask: fullMask, allowClear: false, style: { width: "100%" }, onChange: (t) => {
|
|
12
|
+
if (t !== null) {
|
|
13
|
+
onChange(t);
|
|
14
|
+
}
|
|
15
|
+
} }));
|
|
16
|
+
case FullPeriodType.Week: {
|
|
17
|
+
const v = value.second();
|
|
18
|
+
return (React.createElement(EnumValuePicker, { values: DaysInWeek, translateValue: true, value: v, style: { width: "100%" }, onChange: (val) => {
|
|
19
|
+
onChange(value.second(val));
|
|
20
|
+
} }));
|
|
21
|
+
}
|
|
22
|
+
case FullPeriodType.YearQuarter: {
|
|
23
|
+
const v = Number(value.format("Q"));
|
|
24
|
+
return (React.createElement(EnumValuePicker, { values: QuarterType, translateValue: true, translationPrefix: "QuarterType_", value: v, style: { width: "100%" }, onChange: (val) => {
|
|
25
|
+
const targetQuarter = val;
|
|
26
|
+
const monthOffset = value.month() % 3;
|
|
27
|
+
const targetMonth = ((targetQuarter - 1) * 3) + monthOffset;
|
|
28
|
+
onChange(value.month(targetMonth));
|
|
29
|
+
} }));
|
|
30
|
+
}
|
|
31
|
+
case FullPeriodType.YearMonth: {
|
|
32
|
+
const v = value.month();
|
|
33
|
+
return (React.createElement(EnumValuePicker, { values: MonthsInYear, translateValue: true, value: v, style: { width: "100%" }, onChange: (val) => {
|
|
34
|
+
onChange(value.month(val));
|
|
35
|
+
} }));
|
|
36
|
+
}
|
|
37
|
+
case FullPeriodType.YearWeek: {
|
|
38
|
+
return (React.createElement(InputNumber, { value: value.second(), min: 1, max: 52, style: { width: "100%" }, onChange: (val) => {
|
|
39
|
+
if (val) {
|
|
40
|
+
onChange(value.second(val));
|
|
41
|
+
}
|
|
42
|
+
} }));
|
|
43
|
+
}
|
|
44
|
+
case FullPeriodType.YearDay: {
|
|
45
|
+
return (React.createElement(DatePicker, { format: dateMask, value: value, style: { width: "100%" }, allowClear: false, onChange: (val) => {
|
|
46
|
+
onChange(val.year(YearPeriodType.Day));
|
|
47
|
+
} }));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return React.createElement(React.Fragment, null);
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=intervalInput.js.map
|
package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/intervalInput.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intervalInput.js","sourceRoot":"","sources":["../../../../../../../coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/intervalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAW,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAC,UAAU,EAAE,WAAW,EAAE,UAAU,EAAC,MA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,GAAG,EAAE,CAAC,EACN,GAAG,EAAE,EAAE,EACP,KAAK,EAAE,EAAC,KAAK,EAAE,MAAM,EAAC,EACtB,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;oBACd,IAAI,GAAG,EAAE,CAAC;wBACN,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;oBAChC,CAAC;gBACL,CAAC,GACH,CACL,CAAC;QACN,CAAC;QACD,KAAK,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;YAC1B,OAAO,CACH,oBAAC,UAAU,IACP,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,EAAC,KAAK,EAAE,MAAM,EAAC,EACtB,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;oBACd,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC3C,CAAC,GACH,CACL,CAAC;QACN,CAAC;IACL,CAAC;IAED,OAAO,yCAAK,CAAA;AAChB,CAAC,CAAA","sourcesContent":["import React, {FC} from \"react\";\r\nimport dayjs from \"d2core/dayjs\";\r\nimport {DatePicker, InputNumber, TimePicker} from \"antd\";\r\nimport DateTimeInput from \"d2coreui/components/date/dateTimeInput\";\r\nimport EnumValuePicker from \"d2coreui/components/picker/enumValuePicker\";\r\nimport {DaysInWeek, FullPeriodType, MonthsInYear, QuarterType, YearPeriodType} from \"./types\";\r\n\r\ninterface Props {\r\n value: dayjs.Dayjs\r\n fullMask: string\r\n dateMask: string\r\n periodType: FullPeriodType\r\n onChange: (value: dayjs.Dayjs) => void\r\n}\r\n\r\nexport const IntervalInput: FC<Props> = ({value, fullMask, dateMask, periodType, onChange}) => {\r\n switch (periodType) {\r\n case FullPeriodType.Day:\r\n return (\r\n <TimePicker\r\n value={value}\r\n style={{width: \"100%\"}}\r\n onChange={onChange}\r\n allowClear={false}\r\n showSecond={false}\r\n />\r\n );\r\n case FullPeriodType.Interval:\r\n return (\r\n <DateTimeInput\r\n value={value}\r\n mask={fullMask}\r\n allowClear={false}\r\n style={{width: \"100%\"}}\r\n onChange={(t) => {\r\n if (t !== null) {\r\n onChange(t);\r\n }\r\n }}\r\n />\r\n );\r\n case FullPeriodType.Week: {\r\n const v = value.second();\r\n return (\r\n <EnumValuePicker\r\n values={DaysInWeek}\r\n translateValue\r\n value={v}\r\n style={{width: \"100%\"}}\r\n onChange={(val) => {\r\n onChange(value.second(val as number));\r\n }}\r\n />\r\n );\r\n }\r\n case FullPeriodType.YearQuarter: {\r\n const v = Number(value.format(\"Q\"));\r\n return (\r\n <EnumValuePicker\r\n values={QuarterType}\r\n translateValue\r\n translationPrefix={\"QuarterType_\"}\r\n value={v}\r\n style={{width: \"100%\"}}\r\n onChange={(val) => {\r\n const targetQuarter = val as number;\r\n const monthOffset = value.month() % 3;\r\n const targetMonth = ((targetQuarter - 1) * 3) + monthOffset;\r\n\r\n onChange(value.month(targetMonth));\r\n }}\r\n />\r\n )\r\n }\r\n case FullPeriodType.YearMonth: {\r\n const v = value.month();\r\n return (\r\n <EnumValuePicker\r\n values={MonthsInYear}\r\n translateValue\r\n value={v}\r\n style={{width: \"100%\"}}\r\n onChange={(val) => {\r\n onChange(value.month(val as number));\r\n }}\r\n />\r\n );\r\n }\r\n case FullPeriodType.YearWeek: {\r\n return (\r\n <InputNumber\r\n value={value.second()}\r\n min={1}\r\n max={52}\r\n style={{width: \"100%\"}}\r\n onChange={(val) => {\r\n if (val) {\r\n onChange(value.second(val));\r\n }\r\n }}\r\n />\r\n );\r\n }\r\n case FullPeriodType.YearDay: {\r\n return (\r\n <DatePicker\r\n format={dateMask}\r\n value={value}\r\n style={{width: \"100%\"}}\r\n allowClear={false}\r\n onChange={(val) => {\r\n onChange(val.year(YearPeriodType.Day));\r\n }}\r\n />\r\n );\r\n }\r\n }\r\n\r\n return <></>\r\n}"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { VectorValuesData } from "../../../../../api/eda/edaManagerApi";
|
|
3
|
+
import dayjs from "d2core/dayjs";
|
|
4
|
+
import { EdaSamplingType } from "../../constants/edaTypes";
|
|
5
|
+
interface Props {
|
|
6
|
+
displayData: Record<number, {
|
|
7
|
+
data: VectorValuesData;
|
|
8
|
+
}>;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
params: {
|
|
11
|
+
bt: dayjs.Dayjs;
|
|
12
|
+
et: dayjs.Dayjs;
|
|
13
|
+
sampling: EdaSamplingType;
|
|
14
|
+
};
|
|
15
|
+
onParamsChange: (params: {
|
|
16
|
+
bt: dayjs.Dayjs;
|
|
17
|
+
et: dayjs.Dayjs;
|
|
18
|
+
sampling: EdaSamplingType;
|
|
19
|
+
}) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const TablePanel: FC<Props>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from "react";
|
|
2
|
+
import { createStyles } from "antd-style";
|
|
3
|
+
import { Card, Empty, Space, theme } from "antd";
|
|
4
|
+
import { EdaLoadingOverlay } from "../../components/edaLoadingOverlay";
|
|
5
|
+
import { EdaSampleRangePickerPanel } from "../../components/edaSampleRangePickerPanel";
|
|
6
|
+
import i18n from "d2core/i18n/i18n";
|
|
7
|
+
import ExtendedDataGrid from "d2coreui/components/grid/extendedDataGrid";
|
|
8
|
+
import { formatValue } from "../../utils/utils";
|
|
9
|
+
import { getOrigModifiedVectors } from "./utils";
|
|
10
|
+
import { useEdaConfig } from "../../context/edaConfigContext";
|
|
11
|
+
const useStyles = createStyles(({ css, token }) => {
|
|
12
|
+
return {
|
|
13
|
+
baseLayout: css `
|
|
14
|
+
display: flex;
|
|
15
|
+
height: 100%;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
border-top-left-radius: 0;
|
|
19
|
+
border-top-right-radius: 0;
|
|
20
|
+
|
|
21
|
+
> .ant-card-body {
|
|
22
|
+
height: 100%;
|
|
23
|
+
padding: ${token.paddingXS}px;
|
|
24
|
+
|
|
25
|
+
> div {
|
|
26
|
+
height: 100%;
|
|
27
|
+
overflow-x: hidden;
|
|
28
|
+
overflow-y: auto;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.eda-detail-no-data {
|
|
33
|
+
padding: ${token.padding}px;
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center !important;
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: 100%;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ant-space-item:last-child {
|
|
42
|
+
height: 100%;
|
|
43
|
+
}
|
|
44
|
+
`,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
export const TablePanel = ({ displayData, isLoading, params, onParamsChange }) => {
|
|
48
|
+
const { token } = theme.useToken();
|
|
49
|
+
const { styles } = useStyles();
|
|
50
|
+
const { table } = useEdaConfig();
|
|
51
|
+
const vectors = useMemo(() => getOrigModifiedVectors(), []);
|
|
52
|
+
const tablePanelStyle = useMemo(() => ({ marginTop: token.paddingXXS }), [token.paddingXXS]);
|
|
53
|
+
const panelStyle = useMemo(() => ({ padding: `0, ${token.paddingXXS}px` }), [token.paddingXXS]);
|
|
54
|
+
const getRowStyle = useCallback((params) => {
|
|
55
|
+
if (params.node.isRowPinned()) {
|
|
56
|
+
return { backgroundColor: token.colorFillAlter };
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
}, [token.colorFillAlter]);
|
|
60
|
+
const handleRangeChange = useCallback((bt, et, sampling) => onParamsChange({ bt, et, sampling }), []);
|
|
61
|
+
const tableData = useMemo(() => {
|
|
62
|
+
const ids = Object.keys(displayData).map(Number);
|
|
63
|
+
const rowByTime = new Map();
|
|
64
|
+
for (const id of ids) {
|
|
65
|
+
const vectorPoints = displayData[id]?.data?.data || [];
|
|
66
|
+
for (const point of vectorPoints) {
|
|
67
|
+
const time = point.val.valueTime;
|
|
68
|
+
if (time === undefined)
|
|
69
|
+
continue;
|
|
70
|
+
let row = rowByTime.get(time);
|
|
71
|
+
if (!row) {
|
|
72
|
+
row = {
|
|
73
|
+
id: time,
|
|
74
|
+
time: time
|
|
75
|
+
};
|
|
76
|
+
rowByTime.set(time, row);
|
|
77
|
+
}
|
|
78
|
+
row[id] = point.val;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return Array.from(rowByTime.values()).sort((a, b) => (a.time || 0) - (b.time || 0));
|
|
82
|
+
}, [displayData]);
|
|
83
|
+
const columnDefs = useMemo(() => {
|
|
84
|
+
if (!vectors) {
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
const columns = [
|
|
88
|
+
{
|
|
89
|
+
field: "time",
|
|
90
|
+
colId: "time",
|
|
91
|
+
type: ["dateTimeColumn"],
|
|
92
|
+
headerName: i18n("Vector Time"),
|
|
93
|
+
group: i18n("Basic Columns")
|
|
94
|
+
},
|
|
95
|
+
...vectors.map((v) => ({
|
|
96
|
+
field: `${v.ID}.value`,
|
|
97
|
+
colId: String(v.ID),
|
|
98
|
+
type: ["alignRight"],
|
|
99
|
+
valueFormatter: (props) => formatValue(props.value, v.RoundingType, v.RoundingPlaces),
|
|
100
|
+
headerName: v.DisplayName,
|
|
101
|
+
headerTooltip: v.DisplayName,
|
|
102
|
+
group: i18n("Basic Columns"),
|
|
103
|
+
}))
|
|
104
|
+
];
|
|
105
|
+
return table?.detailTable?.modifyColumns ? table.detailTable.modifyColumns(columns) : columns;
|
|
106
|
+
}, [vectors, table?.detailTable?.modifyColumns]);
|
|
107
|
+
return (React.createElement(Card, { className: styles.baseLayout },
|
|
108
|
+
isLoading && React.createElement(EdaLoadingOverlay, null),
|
|
109
|
+
React.createElement(Space, { direction: "vertical", style: { width: "100%", height: "100%" } },
|
|
110
|
+
React.createElement(EdaSampleRangePickerPanel, { bt: params.bt, et: params.et, sampling: params.sampling, totalCount: 1, pageSize: 1, loading: isLoading, page: 1, onChangeRange: handleRangeChange, onChangePage: () => { }, onChangeVectors: () => { } }),
|
|
111
|
+
React.createElement("div", { style: { height: '100%' } },
|
|
112
|
+
React.createElement(ExtendedDataGrid, { columnDefs: columnDefs, onLoadData: handleLoadData, defaultGridConfiguration: {
|
|
113
|
+
pageSize: -1,
|
|
114
|
+
}, rowData: tableData, tablePanelStyle: tablePanelStyle, panelStyle: panelStyle, settingsMenu: { renderer: handleSettingsMenu }, toolbar: {
|
|
115
|
+
hideRecordCount: true,
|
|
116
|
+
}, search: {
|
|
117
|
+
hidden: true,
|
|
118
|
+
searchButtonHidden: true,
|
|
119
|
+
}, noRecordsOverlayRenderer: renderNoRecordsOverlay, getRowStyle: getRowStyle, rowSelection: "multiple", stopEditingWhenCellsLoseFocus: true, enterNavigatesVerticallyAfterEdit: true })))));
|
|
120
|
+
};
|
|
121
|
+
function handleLoadData(callback) {
|
|
122
|
+
callback(1);
|
|
123
|
+
}
|
|
124
|
+
function renderNoRecordsOverlay() {
|
|
125
|
+
return React.createElement(Empty, { description: i18n("No records found."), styles: { image: { height: "8vh" } } });
|
|
126
|
+
}
|
|
127
|
+
function handleSettingsMenu(menuElements) {
|
|
128
|
+
return menuElements.filter((e) => !["columnFilter", "columnsConfig"].includes(e.key));
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=tablePanel.js.map
|
package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/tablePanel.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tablePanel.js","sourceRoot":"","sources":["../../../../../../../coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/tablePanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAK,WAAW,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAItD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,IAAI,E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wBACJ,MAAM,EAAE,IAAI;wBACZ,kBAAkB,EAAE,IAAI;qBAC3B,EACD,wBAAwB,EAAE,sBAAsB,EAChD,WAAW,EAAE,WAAW,EACxB,YAAY,EAAC,UAAU,EACvB,6BAA6B,QAC7B,iCAAiC,SACnC,CACA,CACF,CACL,CACV,CAAC;AACN,CAAC,CAAA;AAED,SAAS,cAAc,CAAC,QAA6B;IACjD,QAAQ,CAAC,CAAC,CAAC,CAAC;AAChB,CAAC;AAED,SAAS,sBAAsB;IAC3B,OAAO,oBAAC,KAAK,IAAC,WAAW,EAAE,IAAI,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC,EAAC,GAAG,CAAC;AAC9F,CAAC;AAED,SAAS,kBAAkB,CAAC,YAA2B;IACnD,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAa,CAAC,CAAC,CAAC;AACpG,CAAC","sourcesContent":["import React, {FC, useCallback, useMemo} from \"react\";\r\nimport {VectorValuesData} from \"../../../../../api/eda/edaManagerApi\";\r\nimport dayjs from \"d2core/dayjs\";\r\nimport {EdaSamplingType} from \"../../constants/edaTypes\";\r\nimport {createStyles} from \"antd-style\";\r\nimport {Card, Empty, Space, theme} from \"antd\";\r\nimport {EdaLoadingOverlay} from \"../../components/edaLoadingOverlay\";\r\nimport {EdaSampleRangePickerPanel} from \"../../components/edaSampleRangePickerPanel\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {UnixTime} from \"d2jsapi\";\r\nimport {UnivalValue} from \"d2jsapi/dist/unival\";\r\nimport ExtendedDataGrid from \"d2coreui/components/grid/extendedDataGrid\";\r\nimport {DataGridColDef, MenuElement} from \"d2coreui/components/grid/dataGrid\";\r\nimport {formatValue} from \"../../utils/utils\";\r\nimport {getOrigModifiedVectors} from \"./utils\";\r\nimport {useEdaConfig} from \"../../context/edaConfigContext\";\r\n\r\nconst useStyles = createStyles(({css, token}) => {\r\n return {\r\n baseLayout: css`\r\n display: flex;\r\n height: 100%;\r\n flex-direction: column;\r\n justify-content: space-between;\r\n border-top-left-radius: 0;\r\n border-top-right-radius: 0;\r\n\r\n > .ant-card-body {\r\n height: 100%;\r\n padding: ${token.paddingXS}px;\r\n\r\n > div {\r\n height: 100%;\r\n overflow-x: hidden;\r\n overflow-y: auto;\r\n }\r\n }\r\n\r\n .eda-detail-no-data {\r\n padding: ${token.padding}px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center !important;\r\n width: 100%;\r\n height: 100%;\r\n }\r\n\r\n .ant-space-item:last-child {\r\n height: 100%;\r\n }\r\n `,\r\n }\r\n});\r\n\r\ninterface GridRow {\r\n id: number\r\n time?: UnixTime\r\n\r\n [id: number]: UnivalValue\r\n}\r\n\r\ninterface Props {\r\n displayData: Record<number, { data: VectorValuesData }>;\r\n isLoading: boolean;\r\n params: { bt: dayjs.Dayjs; et: dayjs.Dayjs; sampling: EdaSamplingType };\r\n onParamsChange: (params: { bt: dayjs.Dayjs; et: dayjs.Dayjs; sampling: EdaSamplingType }) => void;\r\n}\r\n\r\nexport const TablePanel: FC<Props> = ({displayData, isLoading, params, onParamsChange}) => {\r\n const {token} = theme.useToken();\r\n const {styles} = useStyles();\r\n const {table} = useEdaConfig();\r\n\r\n const vectors = useMemo(() => getOrigModifiedVectors(), []);\r\n\r\n const tablePanelStyle = useMemo(() => ({marginTop: token.paddingXXS}), [token.paddingXXS]);\r\n const panelStyle = useMemo(() => ({padding: `0, ${token.paddingXXS}px`}), [token.paddingXXS]);\r\n\r\n const getRowStyle = useCallback((params: any) => {\r\n if (params.node.isRowPinned()) {\r\n return {backgroundColor: token.colorFillAlter};\r\n }\r\n\r\n return undefined;\r\n }, [token.colorFillAlter]);\r\n\r\n const handleRangeChange = useCallback((bt: dayjs.Dayjs, et: dayjs.Dayjs, sampling: EdaSamplingType) => onParamsChange({bt, et, sampling}), []);\r\n\r\n const tableData = useMemo(() => {\r\n const ids = Object.keys(displayData).map(Number);\r\n const rowByTime = new Map<number, GridRow>();\r\n\r\n for (const id of ids) {\r\n const vectorPoints = displayData[id]?.data?.data || [];\r\n\r\n for (const point of vectorPoints) {\r\n const time = point.val.valueTime;\r\n\r\n if (time === undefined) continue;\r\n\r\n let row = rowByTime.get(time);\r\n\r\n if (!row) {\r\n row = {\r\n id: time,\r\n time: time\r\n }\r\n rowByTime.set(time, row);\r\n }\r\n\r\n row[id] = point.val;\r\n }\r\n }\r\n\r\n return Array.from(rowByTime.values()).sort((a, b) => (a.time || 0) - (b.time || 0));\r\n }, [displayData]);\r\n\r\n const columnDefs = useMemo(() => {\r\n if (!vectors) {\r\n return []\r\n }\r\n\r\n const columns: DataGridColDef[] = [\r\n {\r\n field: \"time\",\r\n colId: \"time\",\r\n type: [\"dateTimeColumn\"],\r\n headerName: i18n(\"Vector Time\"),\r\n group: i18n(\"Basic Columns\")\r\n },\r\n ...vectors.map((v): DataGridColDef => ({\r\n field: `${v.ID}.value`,\r\n colId: String(v.ID),\r\n type: [\"alignRight\"],\r\n valueFormatter: (props) => formatValue(props.value, v.RoundingType, v.RoundingPlaces),\r\n headerName: v.DisplayName,\r\n headerTooltip: v.DisplayName,\r\n group: i18n(\"Basic Columns\"),\r\n }))\r\n ];\r\n\r\n return table?.detailTable?.modifyColumns ? table.detailTable.modifyColumns(columns) : columns;\r\n }, [vectors, table?.detailTable?.modifyColumns]);\r\n\r\n return (\r\n <Card className={styles.baseLayout}>\r\n {isLoading && <EdaLoadingOverlay/>}\r\n <Space direction=\"vertical\" style={{width: \"100%\", height: \"100%\"}}>\r\n <EdaSampleRangePickerPanel\r\n bt={params.bt}\r\n et={params.et}\r\n sampling={params.sampling}\r\n totalCount={1}\r\n pageSize={1}\r\n loading={isLoading}\r\n page={1}\r\n onChangeRange={handleRangeChange}\r\n onChangePage={() => {}}\r\n onChangeVectors={() => {}}\r\n />\r\n <div style={{height: '100%'}}>\r\n <ExtendedDataGrid<GridRow>\r\n columnDefs={columnDefs}\r\n onLoadData={handleLoadData}\r\n defaultGridConfiguration={{\r\n pageSize: -1,\r\n }}\r\n rowData={tableData}\r\n tablePanelStyle={tablePanelStyle}\r\n panelStyle={panelStyle}\r\n settingsMenu={{renderer: handleSettingsMenu}}\r\n toolbar={{\r\n hideRecordCount: true,\r\n }}\r\n search={{\r\n hidden: true,\r\n searchButtonHidden: true,\r\n }}\r\n noRecordsOverlayRenderer={renderNoRecordsOverlay}\r\n getRowStyle={getRowStyle}\r\n rowSelection=\"multiple\"\r\n stopEditingWhenCellsLoseFocus\r\n enterNavigatesVerticallyAfterEdit\r\n />\r\n </div>\r\n </Space>\r\n </Card>\r\n );\r\n}\r\n\r\nfunction handleLoadData(callback: (v: number) => void) {\r\n callback(1);\r\n}\r\n\r\nfunction renderNoRecordsOverlay() {\r\n return <Empty description={i18n(\"No records found.\")} styles={{image: {height: \"8vh\"}}}/>;\r\n}\r\n\r\nfunction handleSettingsMenu(menuElements: MenuElement[]) {\r\n return menuElements.filter((e) => ![\"columnFilter\", \"columnsConfig\"].includes(e.key as string));\r\n}"]}
|