@gridsuite/commons-ui 0.279.0 → 0.280.0
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/dist/components/composite/customAGGrid/separatorCellRenderer.d.ts +7 -2
- package/dist/components/composite/customAGGrid/separatorCellRenderer.js +2 -2
- package/dist/features/index.js +13 -0
- package/dist/features/network-modifications/index.js +13 -0
- package/dist/features/network-modifications/voltageLevel/common/HeaderWithTooltip.d.ts +8 -0
- package/dist/features/network-modifications/voltageLevel/common/HeaderWithTooltip.js +119 -0
- package/dist/features/network-modifications/voltageLevel/common/index.d.ts +1 -0
- package/dist/features/network-modifications/voltageLevel/common/index.js +4 -0
- package/dist/features/network-modifications/voltageLevel/index.d.ts +2 -0
- package/dist/features/network-modifications/voltageLevel/index.js +13 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/MoveVoltageLevelFeederBaysForm.d.ts +8 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/MoveVoltageLevelFeederBaysForm.js +387 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/feederBay/FeederBayDirectionCellRender.d.ts +6 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/feederBay/FeederBayDirectionCellRender.js +64 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/feederBay/FeederBayPositionCellRender.d.ts +6 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/feederBay/FeederBayPositionCellRender.js +102 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/feederBay/index.d.ts +2 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/feederBay/index.js +6 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/index.d.ts +4 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/index.js +13 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/moveVoltageLevelFeederBays.type.d.ts +36 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/moveVoltageLevelFeederBays.type.js +1 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/moveVoltageLevelFeederBays.utils.d.ts +37 -0
- package/dist/features/network-modifications/voltageLevel/moveFeederBays/moveVoltageLevelFeederBays.utils.js +86 -0
- package/dist/index.js +13 -0
- package/dist/translations/en/networkModificationsEn.d.ts +12 -0
- package/dist/translations/en/networkModificationsEn.js +13 -1
- package/dist/translations/fr/networkModificationsFr.d.ts +12 -0
- package/dist/translations/fr/networkModificationsFr.js +13 -1
- package/dist/utils/constants/fieldConstants.d.ts +7 -1
- package/dist/utils/constants/fieldConstants.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
3
|
+
import { useWatch } from "react-hook-form";
|
|
4
|
+
import { useMemo, useState, useCallback } from "react";
|
|
5
|
+
import { Box, TextField, Stack, Grid, Button } from "@mui/material";
|
|
6
|
+
import { InfoOutlined } from "@mui/icons-material";
|
|
7
|
+
import "../../../../components/ui/overflowableText/OverflowableText.js";
|
|
8
|
+
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
9
|
+
import "../../../../utils/conversionUtils.js";
|
|
10
|
+
import "../../../../utils/types/equipmentType.js";
|
|
11
|
+
import "localized-countries";
|
|
12
|
+
import "localized-countries/data/fr";
|
|
13
|
+
import "localized-countries/data/en";
|
|
14
|
+
import "notistack";
|
|
15
|
+
import "../../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
|
|
16
|
+
import { useCustomFormContext } from "../../../../components/ui/reactHookForm/provider/useCustomFormContext.js";
|
|
17
|
+
import "yup";
|
|
18
|
+
import { CustomTooltip } from "../../../../components/ui/tooltip/CustomTooltip.js";
|
|
19
|
+
import "../../../../components/ui/treeViewFinder/TreeViewFinder.js";
|
|
20
|
+
import { AutocompleteInput } from "../../../../components/ui/reactHookForm/autocompleteInputs/AutocompleteInput.js";
|
|
21
|
+
import { TextInput } from "../../../../components/ui/reactHookForm/text/TextInput.js";
|
|
22
|
+
import "../../../../components/ui/reactHookForm/numbers/RangeInput.js";
|
|
23
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
24
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
25
|
+
import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
|
|
26
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
27
|
+
import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
|
|
28
|
+
import "../../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
29
|
+
import "../../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
|
|
30
|
+
import "../../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
|
|
31
|
+
import "@hello-pangea/dnd";
|
|
32
|
+
import "../../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
33
|
+
import "../../../../components/ui/snackbarProvider/SnackbarProvider.js";
|
|
34
|
+
import "mui-nested-menu";
|
|
35
|
+
import "react-resizable-panels";
|
|
36
|
+
import "react-papaparse";
|
|
37
|
+
import "react-dom";
|
|
38
|
+
import "autosuggest-highlight/match";
|
|
39
|
+
import "autosuggest-highlight/parse";
|
|
40
|
+
import "clsx";
|
|
41
|
+
import "../../../../components/composite/filter/FilterCreationDialog.js";
|
|
42
|
+
import "../../../../components/composite/filter/HeaderFilterForm.js";
|
|
43
|
+
import "../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
|
|
44
|
+
import "../../../../components/composite/filter/expert/ExpertFilterForm.js";
|
|
45
|
+
import "../../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
|
|
46
|
+
import "../../../../components/composite/filter/expert/expertFilterConstants.js";
|
|
47
|
+
import "react-querybuilder";
|
|
48
|
+
import "uuid";
|
|
49
|
+
import "../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
50
|
+
import "../../../../components/composite/filter/utils/filterFormUtils.js";
|
|
51
|
+
import { GridItem } from "../../../../components/composite/grid/grid-item.js";
|
|
52
|
+
import "@react-querybuilder/material";
|
|
53
|
+
import "../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
54
|
+
import "../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
55
|
+
import "../../../../components/composite/agGridTable/BottomTableButtons.js";
|
|
56
|
+
import "../../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
57
|
+
import "ag-grid-community";
|
|
58
|
+
import { CustomAGGrid } from "../../../../components/composite/customAGGrid/customAggrid.js";
|
|
59
|
+
import { SeparatorCellRenderer } from "../../../../components/composite/customAGGrid/separatorCellRenderer.js";
|
|
60
|
+
import "../../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
|
|
61
|
+
import "mathjs";
|
|
62
|
+
import "../../../../components/composite/report/report-viewer/log-table/log-table.js";
|
|
63
|
+
import "react-window";
|
|
64
|
+
import "../../../../components/composite/report/report-treeview/treeview-item.js";
|
|
65
|
+
import "../../../../components/composite/report/report-viewer/context/report-viewer-context.js";
|
|
66
|
+
import { filledTextField } from "../../common/form.utils.js";
|
|
67
|
+
import "../../common/properties/propertyUtils.js";
|
|
68
|
+
import "../../common/regulatingTerminal/RegulatingTerminalForm.js";
|
|
69
|
+
import "@mui/material/colors";
|
|
70
|
+
import "@mui/x-charts";
|
|
71
|
+
import "../../common/currentLimits/limitsPane.utils.js";
|
|
72
|
+
import { FeederBayPositionCellRenderer } from "./feederBay/FeederBayPositionCellRender.js";
|
|
73
|
+
import { FeederBayDirectionCellRenderer } from "./feederBay/FeederBayDirectionCellRender.js";
|
|
74
|
+
import { HeaderWithTooltip } from "../common/HeaderWithTooltip.js";
|
|
75
|
+
const defaultColDef = {
|
|
76
|
+
sortable: false,
|
|
77
|
+
resizable: true,
|
|
78
|
+
editable: false,
|
|
79
|
+
headerClass: "centered-header",
|
|
80
|
+
suppressMovable: true
|
|
81
|
+
};
|
|
82
|
+
function MoveVoltageLevelFeederBaysForm({
|
|
83
|
+
feederBaysPreviousValues,
|
|
84
|
+
PositionDiagramPane,
|
|
85
|
+
isReady = true
|
|
86
|
+
}) {
|
|
87
|
+
const intl = useIntl();
|
|
88
|
+
const { getValues, isUpdate, isNodeBuilt } = useCustomFormContext();
|
|
89
|
+
const selectedId = useWatch({ name: FieldConstants.EQUIPMENT_ID });
|
|
90
|
+
const shouldDisableTooltip = useMemo(
|
|
91
|
+
() => isNodeBuilt === void 0 && isUpdate === void 0 ? true : !isUpdate && isNodeBuilt,
|
|
92
|
+
[isUpdate, isNodeBuilt]
|
|
93
|
+
);
|
|
94
|
+
const [isDiagramPaneOpen, setIsDiagramPaneOpen] = useState(false);
|
|
95
|
+
const groupedRowData = useMemo(() => {
|
|
96
|
+
if (!isReady || !selectedId) {
|
|
97
|
+
return void 0;
|
|
98
|
+
}
|
|
99
|
+
const feederBaysFormInfosRows = getValues(
|
|
100
|
+
FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE
|
|
101
|
+
);
|
|
102
|
+
if (!Array.isArray(feederBaysFormInfosRows)) {
|
|
103
|
+
return void 0;
|
|
104
|
+
}
|
|
105
|
+
const groups = {};
|
|
106
|
+
feederBaysFormInfosRows.forEach((row) => {
|
|
107
|
+
const key = row[FieldConstants.IS_REMOVED] ? "REMOVED" : "ACTIVE";
|
|
108
|
+
(groups[key] ??= []).push(row);
|
|
109
|
+
});
|
|
110
|
+
return Object.entries(groups).flatMap(
|
|
111
|
+
([key, rows]) => (
|
|
112
|
+
// do not show the ACTIVE group's header
|
|
113
|
+
key === "ACTIVE" ? [...rows] : [{ isGroup: true, key }, ...rows]
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
}, [isReady, getValues, selectedId]);
|
|
117
|
+
const getGroupLabel = useCallback(
|
|
118
|
+
(group) => {
|
|
119
|
+
return group.key === "REMOVED" ? intl.formatMessage({ id: "MissingConnectionsInVoltageLevel" }) : void 0;
|
|
120
|
+
},
|
|
121
|
+
[intl]
|
|
122
|
+
);
|
|
123
|
+
const renderGroupCell = useCallback(
|
|
124
|
+
({ data }) => {
|
|
125
|
+
return /* @__PURE__ */ jsx(
|
|
126
|
+
Box,
|
|
127
|
+
{
|
|
128
|
+
sx: {
|
|
129
|
+
display: "flex",
|
|
130
|
+
justifyContent: "center",
|
|
131
|
+
alignItems: "center",
|
|
132
|
+
height: "100%",
|
|
133
|
+
paddingLeft: 2
|
|
134
|
+
},
|
|
135
|
+
children: /* @__PURE__ */ jsx(SeparatorCellRenderer, { value: getGroupLabel(data) ?? "", sx: { textAlign: "center" } })
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
},
|
|
139
|
+
[getGroupLabel]
|
|
140
|
+
);
|
|
141
|
+
const voltageLevelIdField = useMemo(
|
|
142
|
+
() => /* @__PURE__ */ jsx(
|
|
143
|
+
TextField,
|
|
144
|
+
{
|
|
145
|
+
fullWidth: true,
|
|
146
|
+
label: "ID",
|
|
147
|
+
value: selectedId ?? "",
|
|
148
|
+
size: "small",
|
|
149
|
+
slotProps: {
|
|
150
|
+
input: { readOnly: true }
|
|
151
|
+
},
|
|
152
|
+
disabled: true,
|
|
153
|
+
...filledTextField
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
[selectedId]
|
|
157
|
+
);
|
|
158
|
+
const commonHeaderParams = useMemo(
|
|
159
|
+
() => ({
|
|
160
|
+
tooltipTitle: intl.formatMessage({
|
|
161
|
+
id: isNodeBuilt ? "builtNodeTooltipVlTopoModif" : "notBuiltNodeTooltipVlTopoModif"
|
|
162
|
+
}),
|
|
163
|
+
isNodeBuilt,
|
|
164
|
+
disabledTooltip: shouldDisableTooltip
|
|
165
|
+
}),
|
|
166
|
+
[intl, isNodeBuilt, shouldDisableTooltip]
|
|
167
|
+
);
|
|
168
|
+
const renderEquipmentIdCell = useCallback(
|
|
169
|
+
({ data }) => {
|
|
170
|
+
const watchTable = getValues(FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE);
|
|
171
|
+
const formIndex = watchTable?.findIndex((item) => item.rowId === data.rowId) ?? -1;
|
|
172
|
+
return /* @__PURE__ */ jsx(
|
|
173
|
+
TextInput,
|
|
174
|
+
{
|
|
175
|
+
name: `${FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE}[${formIndex}].${FieldConstants.EQUIPMENT_ID}`,
|
|
176
|
+
formProps: {
|
|
177
|
+
disabled: data.isRemoved,
|
|
178
|
+
size: "small",
|
|
179
|
+
variant: "outlined",
|
|
180
|
+
sx: {
|
|
181
|
+
paddingTop: "1rem",
|
|
182
|
+
"& input": {
|
|
183
|
+
textAlign: "center"
|
|
184
|
+
},
|
|
185
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
186
|
+
border: "unset"
|
|
187
|
+
// Remove the border
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
},
|
|
194
|
+
[getValues]
|
|
195
|
+
);
|
|
196
|
+
const renderConnectionNameCell = useCallback(
|
|
197
|
+
({ data }) => {
|
|
198
|
+
const watchTable = getValues(FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE);
|
|
199
|
+
const formIndex = watchTable?.findIndex((item) => item.rowId === data.rowId) ?? -1;
|
|
200
|
+
const previousValue = feederBaysPreviousValues?.find((item) => item.rowId === data.rowId)?.connectablePositionInfos.connectionName ?? "";
|
|
201
|
+
return /* @__PURE__ */ jsx(
|
|
202
|
+
TextInput,
|
|
203
|
+
{
|
|
204
|
+
name: `${FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE}[${formIndex}].${FieldConstants.CONNECTION_NAME}`,
|
|
205
|
+
formProps: {
|
|
206
|
+
disabled: data.isRemoved,
|
|
207
|
+
size: "small",
|
|
208
|
+
variant: "outlined",
|
|
209
|
+
sx: {
|
|
210
|
+
paddingTop: "1rem",
|
|
211
|
+
"& input": {
|
|
212
|
+
textAlign: "center"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
previousValue
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
},
|
|
220
|
+
[feederBaysPreviousValues, getValues]
|
|
221
|
+
);
|
|
222
|
+
const renderBusbarSectionCell = useCallback(
|
|
223
|
+
({ data }) => {
|
|
224
|
+
const watchTable = getValues(FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE);
|
|
225
|
+
const formIndex = watchTable?.findIndex((item) => item.rowId === data.rowId) ?? -1;
|
|
226
|
+
const busBarSectionIds = getValues(
|
|
227
|
+
`${FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE}[${formIndex}].${FieldConstants.BUSBAR_SECTION_IDS}`
|
|
228
|
+
);
|
|
229
|
+
const previousValue = feederBaysPreviousValues?.find((item) => item.rowId === data.rowId)?.busbarSectionId ?? void 0;
|
|
230
|
+
return /* @__PURE__ */ jsx(
|
|
231
|
+
AutocompleteInput,
|
|
232
|
+
{
|
|
233
|
+
name: `${FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE}[${formIndex}].${FieldConstants.BUSBAR_SECTION_ID}`,
|
|
234
|
+
forcePopupIcon: busBarSectionIds?.length > 0,
|
|
235
|
+
options: busBarSectionIds,
|
|
236
|
+
size: "small",
|
|
237
|
+
sx: { padding: "1rem" },
|
|
238
|
+
disabled: data.isRemoved,
|
|
239
|
+
disableClearable: true,
|
|
240
|
+
previousValue,
|
|
241
|
+
allowNewValue: busBarSectionIds?.length === 0
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
},
|
|
245
|
+
[feederBaysPreviousValues, getValues]
|
|
246
|
+
);
|
|
247
|
+
const renderConnectionDirectionCell = useCallback(
|
|
248
|
+
({ data }) => {
|
|
249
|
+
const watchTable = getValues(FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE);
|
|
250
|
+
const formIndex = watchTable?.findIndex((item) => item.rowId === data.rowId) ?? -1;
|
|
251
|
+
return FeederBayDirectionCellRenderer({
|
|
252
|
+
name: `${FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE}[${formIndex}].${FieldConstants.CONNECTION_DIRECTION}`,
|
|
253
|
+
disabled: data.isRemoved
|
|
254
|
+
});
|
|
255
|
+
},
|
|
256
|
+
[getValues]
|
|
257
|
+
);
|
|
258
|
+
const renderConnectionPositionCell = useCallback(
|
|
259
|
+
({ data }) => {
|
|
260
|
+
const watchTable = getValues(FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE);
|
|
261
|
+
const formIndex = watchTable?.findIndex((item) => item.rowId === data.rowId) ?? -1;
|
|
262
|
+
return /* @__PURE__ */ jsx(
|
|
263
|
+
FeederBayPositionCellRenderer,
|
|
264
|
+
{
|
|
265
|
+
name: `${FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE}[${formIndex}].${FieldConstants.CONNECTION_POSITION}`,
|
|
266
|
+
disabled: data.isRemoved
|
|
267
|
+
},
|
|
268
|
+
data.rowId
|
|
269
|
+
);
|
|
270
|
+
},
|
|
271
|
+
[getValues]
|
|
272
|
+
);
|
|
273
|
+
const columnDefs = useMemo(
|
|
274
|
+
() => [
|
|
275
|
+
{
|
|
276
|
+
field: FieldConstants.EQUIPMENT_ID,
|
|
277
|
+
filter: true,
|
|
278
|
+
flex: 2,
|
|
279
|
+
cellRenderer: renderEquipmentIdCell,
|
|
280
|
+
headerComponent: HeaderWithTooltip,
|
|
281
|
+
headerComponentParams: {
|
|
282
|
+
displayName: intl.formatMessage({ id: "equipmentID" }),
|
|
283
|
+
...commonHeaderParams
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
field: FieldConstants.CONNECTION_NAME,
|
|
288
|
+
filter: true,
|
|
289
|
+
flex: 2,
|
|
290
|
+
cellRenderer: renderConnectionNameCell,
|
|
291
|
+
headerComponent: HeaderWithTooltip,
|
|
292
|
+
headerComponentParams: {
|
|
293
|
+
displayName: intl.formatMessage({ id: "Feeders" }),
|
|
294
|
+
...commonHeaderParams
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
field: FieldConstants.BUSBAR_SECTION_ID,
|
|
299
|
+
filter: true,
|
|
300
|
+
flex: 2,
|
|
301
|
+
cellRenderer: renderBusbarSectionCell,
|
|
302
|
+
headerComponent: HeaderWithTooltip,
|
|
303
|
+
headerComponentParams: {
|
|
304
|
+
displayName: intl.formatMessage({ id: "BusBarBus" }),
|
|
305
|
+
...commonHeaderParams
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
field: FieldConstants.CONNECTION_DIRECTION,
|
|
310
|
+
filter: true,
|
|
311
|
+
flex: 2,
|
|
312
|
+
cellRenderer: renderConnectionDirectionCell,
|
|
313
|
+
headerComponent: HeaderWithTooltip,
|
|
314
|
+
headerComponentParams: {
|
|
315
|
+
displayName: intl.formatMessage({ id: "connectionDirection" }),
|
|
316
|
+
...commonHeaderParams
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
field: FieldConstants.CONNECTION_POSITION,
|
|
321
|
+
filter: true,
|
|
322
|
+
flex: 2,
|
|
323
|
+
cellRenderer: renderConnectionPositionCell,
|
|
324
|
+
headerComponent: HeaderWithTooltip,
|
|
325
|
+
headerComponentParams: {
|
|
326
|
+
displayName: intl.formatMessage({ id: FieldConstants.CONNECTION_POSITION }),
|
|
327
|
+
...commonHeaderParams
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
],
|
|
331
|
+
[
|
|
332
|
+
renderEquipmentIdCell,
|
|
333
|
+
intl,
|
|
334
|
+
renderConnectionNameCell,
|
|
335
|
+
commonHeaderParams,
|
|
336
|
+
renderBusbarSectionCell,
|
|
337
|
+
renderConnectionDirectionCell,
|
|
338
|
+
renderConnectionPositionCell
|
|
339
|
+
]
|
|
340
|
+
);
|
|
341
|
+
const enableDiagramPane = isNodeBuilt && PositionDiagramPane;
|
|
342
|
+
const diagramToolTip = enableDiagramPane ? /* @__PURE__ */ jsx(CustomTooltip, { sx: { paddingLeft: 1 }, title: intl.formatMessage({ id: "builtNodeTooltipForDiagram" }), children: /* @__PURE__ */ jsx(InfoOutlined, { color: "info", fontSize: "medium" }) }) : null;
|
|
343
|
+
return /* @__PURE__ */ jsxs(Stack, { sx: { height: "100%", width: "auto" }, children: [
|
|
344
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, sx: { width: "100%" }, children: [
|
|
345
|
+
/* @__PURE__ */ jsx(Grid, { size: 4, children: voltageLevelIdField }),
|
|
346
|
+
enableDiagramPane && /* @__PURE__ */ jsxs(GridItem, { size: 3, children: [
|
|
347
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => setIsDiagramPaneOpen(true), variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "CreateCouplingDeviceDiagramButton" }) }),
|
|
348
|
+
diagramToolTip
|
|
349
|
+
] })
|
|
350
|
+
] }),
|
|
351
|
+
/* @__PURE__ */ jsx(Grid, { paddingTop: 2, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "moveFeederBaysSections" }) }),
|
|
352
|
+
/* @__PURE__ */ jsx(Box, { sx: { pt: 1, flex: 1, minHeight: 0 }, children: /* @__PURE__ */ jsx(
|
|
353
|
+
CustomAGGrid,
|
|
354
|
+
{
|
|
355
|
+
rowData: groupedRowData,
|
|
356
|
+
defaultColDef,
|
|
357
|
+
columnDefs,
|
|
358
|
+
suppressMovableColumns: true,
|
|
359
|
+
suppressCellFocus: true,
|
|
360
|
+
animateRows: false,
|
|
361
|
+
domLayout: "normal",
|
|
362
|
+
headerHeight: 48,
|
|
363
|
+
rowHeight: 85,
|
|
364
|
+
rowStyle: { border: "none" },
|
|
365
|
+
suppressRowHoverHighlight: true,
|
|
366
|
+
getRowHeight: (rowParam) => {
|
|
367
|
+
return rowParam.node.data?.isGroup ? 48 : void 0;
|
|
368
|
+
},
|
|
369
|
+
isFullWidthRow: (rowParam) => {
|
|
370
|
+
return rowParam.rowNode.data?.isGroup;
|
|
371
|
+
},
|
|
372
|
+
fullWidthCellRenderer: renderGroupCell
|
|
373
|
+
}
|
|
374
|
+
) }),
|
|
375
|
+
PositionDiagramPane && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
376
|
+
PositionDiagramPane,
|
|
377
|
+
{
|
|
378
|
+
open: isDiagramPaneOpen,
|
|
379
|
+
onClose: () => setIsDiagramPaneOpen(false),
|
|
380
|
+
voltageLevelId: selectedId
|
|
381
|
+
}
|
|
382
|
+
) })
|
|
383
|
+
] });
|
|
384
|
+
}
|
|
385
|
+
export {
|
|
386
|
+
MoveVoltageLevelFeederBaysForm
|
|
387
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useCallback } from "react";
|
|
3
|
+
import { useFormContext, useController } from "react-hook-form";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
import { ToggleButton, IconButton } from "@mui/material";
|
|
6
|
+
import { HorizontalRule, ArrowDownward, ArrowUpward } from "@mui/icons-material";
|
|
7
|
+
const styles = {
|
|
8
|
+
container: {
|
|
9
|
+
display: "flex",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
width: "100%",
|
|
13
|
+
height: "100%",
|
|
14
|
+
border: "none",
|
|
15
|
+
"&.Mui-disabled": {
|
|
16
|
+
border: "none"
|
|
17
|
+
},
|
|
18
|
+
gap: 2,
|
|
19
|
+
padding: "1rem",
|
|
20
|
+
"&:hover": {
|
|
21
|
+
backgroundColor: "transparent"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const CONNECTION_DIRECTIONS_VALUES = {
|
|
26
|
+
TOP: { id: "TOP", label: "Top" },
|
|
27
|
+
BOTTOM: { id: "BOTTOM", label: "Bottom" },
|
|
28
|
+
UNDEFINED: { id: "UNDEFINED", label: "Undefined" }
|
|
29
|
+
};
|
|
30
|
+
const DIRECTION_CYCLE = {
|
|
31
|
+
[CONNECTION_DIRECTIONS_VALUES.TOP.id]: CONNECTION_DIRECTIONS_VALUES.BOTTOM.id,
|
|
32
|
+
[CONNECTION_DIRECTIONS_VALUES.BOTTOM.id]: CONNECTION_DIRECTIONS_VALUES.UNDEFINED.id,
|
|
33
|
+
[CONNECTION_DIRECTIONS_VALUES.UNDEFINED.id]: CONNECTION_DIRECTIONS_VALUES.TOP.id
|
|
34
|
+
};
|
|
35
|
+
const DIRECTION_ICONS = {
|
|
36
|
+
[CONNECTION_DIRECTIONS_VALUES.TOP.id]: /* @__PURE__ */ jsx(ArrowUpward, {}),
|
|
37
|
+
[CONNECTION_DIRECTIONS_VALUES.BOTTOM.id]: /* @__PURE__ */ jsx(ArrowDownward, {})
|
|
38
|
+
};
|
|
39
|
+
function FeederBayDirectionCellRenderer({ name, disabled }) {
|
|
40
|
+
const { setValue } = useFormContext();
|
|
41
|
+
const {
|
|
42
|
+
field: { value }
|
|
43
|
+
} = useController({ name });
|
|
44
|
+
const intl = useIntl();
|
|
45
|
+
const translatedLabel = useMemo(() => {
|
|
46
|
+
const valueToFind = value ?? "UNDEFINED";
|
|
47
|
+
const direction = Object.values(CONNECTION_DIRECTIONS_VALUES).find((dir) => dir.id === valueToFind);
|
|
48
|
+
return direction ? intl.formatMessage({ id: direction.label }) : "";
|
|
49
|
+
}, [intl, value]);
|
|
50
|
+
const handleClick = useCallback(() => {
|
|
51
|
+
const newValue = DIRECTION_CYCLE[value] || CONNECTION_DIRECTIONS_VALUES.TOP.id;
|
|
52
|
+
setValue(name, newValue, {
|
|
53
|
+
shouldDirty: true,
|
|
54
|
+
shouldTouch: true
|
|
55
|
+
});
|
|
56
|
+
}, [value, setValue, name]);
|
|
57
|
+
return /* @__PURE__ */ jsxs(ToggleButton, { value, onClick: handleClick, disabled, size: "small", sx: styles.container, children: [
|
|
58
|
+
/* @__PURE__ */ jsx(IconButton, { onClick: handleClick, size: "small", disabled, children: DIRECTION_ICONS[value] || /* @__PURE__ */ jsx(HorizontalRule, {}) }),
|
|
59
|
+
/* @__PURE__ */ jsx("span", { children: translatedLabel })
|
|
60
|
+
] });
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
FeederBayDirectionCellRenderer
|
|
64
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useFormContext, useController, useWatch } from "react-hook-form";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { Typography } from "@mui/material";
|
|
5
|
+
import { FormattedMessage } from "react-intl";
|
|
6
|
+
import "@mui/icons-material";
|
|
7
|
+
import "../../../../../components/ui/overflowableText/OverflowableText.js";
|
|
8
|
+
import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
|
|
9
|
+
import "../../../../../utils/conversionUtils.js";
|
|
10
|
+
import "../../../../../utils/types/equipmentType.js";
|
|
11
|
+
import "localized-countries";
|
|
12
|
+
import "localized-countries/data/fr";
|
|
13
|
+
import "localized-countries/data/en";
|
|
14
|
+
import "notistack";
|
|
15
|
+
import "../../../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
|
|
16
|
+
import "yup";
|
|
17
|
+
import "../../../../../components/ui/treeViewFinder/TreeViewFinder.js";
|
|
18
|
+
import { IntegerInput } from "../../../../../components/ui/reactHookForm/numbers/IntegerInput.js";
|
|
19
|
+
import "../../../../../components/ui/reactHookForm/numbers/RangeInput.js";
|
|
20
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
21
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
22
|
+
import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
|
|
23
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
24
|
+
import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
|
|
25
|
+
import "../../../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
26
|
+
import "../../../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
|
|
27
|
+
import "../../../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
|
|
28
|
+
import "@hello-pangea/dnd";
|
|
29
|
+
import "../../../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
30
|
+
import "../../../../../components/ui/snackbarProvider/SnackbarProvider.js";
|
|
31
|
+
import "mui-nested-menu";
|
|
32
|
+
import "react-resizable-panels";
|
|
33
|
+
import "react-papaparse";
|
|
34
|
+
import "react-dom";
|
|
35
|
+
import "autosuggest-highlight/match";
|
|
36
|
+
import "autosuggest-highlight/parse";
|
|
37
|
+
import "clsx";
|
|
38
|
+
import "../../../../../components/composite/filter/FilterCreationDialog.js";
|
|
39
|
+
import "../../../../../components/composite/filter/HeaderFilterForm.js";
|
|
40
|
+
import "../../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
|
|
41
|
+
import "../../../../../components/composite/filter/expert/ExpertFilterForm.js";
|
|
42
|
+
import "../../../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
|
|
43
|
+
import "../../../../../components/composite/filter/expert/expertFilterConstants.js";
|
|
44
|
+
import "react-querybuilder";
|
|
45
|
+
import "uuid";
|
|
46
|
+
import "../../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
47
|
+
import "../../../../../components/composite/filter/utils/filterFormUtils.js";
|
|
48
|
+
import "@react-querybuilder/material";
|
|
49
|
+
import "../../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
50
|
+
import "../../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
51
|
+
import "../../../../../components/composite/agGridTable/BottomTableButtons.js";
|
|
52
|
+
import "../../../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
53
|
+
import "ag-grid-community";
|
|
54
|
+
import "../../../../../components/composite/customAGGrid/customAggrid.js";
|
|
55
|
+
import "../../../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
|
|
56
|
+
import "mathjs";
|
|
57
|
+
import "../../../../../components/composite/report/report-viewer/log-table/log-table.js";
|
|
58
|
+
import "react-window";
|
|
59
|
+
import "../../../../../components/composite/report/report-treeview/treeview-item.js";
|
|
60
|
+
import "../../../../../components/composite/report/report-viewer/context/report-viewer-context.js";
|
|
61
|
+
function FeederBayPositionCellRenderer({ name, disabled }) {
|
|
62
|
+
const { control } = useFormContext();
|
|
63
|
+
const {
|
|
64
|
+
field: { value }
|
|
65
|
+
} = useController({ name, control });
|
|
66
|
+
const allPositions = useWatch({
|
|
67
|
+
control,
|
|
68
|
+
name: FieldConstants.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE
|
|
69
|
+
});
|
|
70
|
+
const isDuplicate = useMemo(() => {
|
|
71
|
+
if (value == null || !allPositions?.length) return false;
|
|
72
|
+
const count = allPositions.filter(
|
|
73
|
+
(item) => !item.isRemoved && item.connectionPosition === value
|
|
74
|
+
).length;
|
|
75
|
+
return count > 1;
|
|
76
|
+
}, [value, allPositions]);
|
|
77
|
+
return /* @__PURE__ */ jsx("div", { style: { position: "relative" }, children: /* @__PURE__ */ jsx(
|
|
78
|
+
IntegerInput,
|
|
79
|
+
{
|
|
80
|
+
name,
|
|
81
|
+
formProps: {
|
|
82
|
+
disabled,
|
|
83
|
+
size: "small",
|
|
84
|
+
variant: "outlined",
|
|
85
|
+
helperText: isDuplicate && /* @__PURE__ */ jsx(Typography, { variant: "caption", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "DuplicatedPositionsWarning" }) }),
|
|
86
|
+
FormHelperTextProps: {
|
|
87
|
+
sx: {
|
|
88
|
+
ml: "auto",
|
|
89
|
+
color: (theme) => isDuplicate ? theme.palette.warning.main : theme.palette.text.secondary
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
sx: {
|
|
93
|
+
padding: "1rem",
|
|
94
|
+
"& input": { textAlign: "center" }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
) });
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
FeederBayPositionCellRenderer
|
|
102
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FeederBayPositionCellRenderer } from "./feederBay/FeederBayPositionCellRender.js";
|
|
2
|
+
import { FeederBayDirectionCellRenderer } from "./feederBay/FeederBayDirectionCellRender.js";
|
|
3
|
+
import { emptyMoveVoltageLevelFeederBaysFormData, moveVoltageLevelFeederBaysDtoToForm, moveVoltageLevelFeederBaysFormSchema, moveVoltageLevelFeederBaysFormToDto } from "./moveVoltageLevelFeederBays.utils.js";
|
|
4
|
+
import { MoveVoltageLevelFeederBaysForm } from "./MoveVoltageLevelFeederBaysForm.js";
|
|
5
|
+
export {
|
|
6
|
+
FeederBayDirectionCellRenderer,
|
|
7
|
+
FeederBayPositionCellRenderer,
|
|
8
|
+
MoveVoltageLevelFeederBaysForm,
|
|
9
|
+
emptyMoveVoltageLevelFeederBaysFormData,
|
|
10
|
+
moveVoltageLevelFeederBaysDtoToForm,
|
|
11
|
+
moveVoltageLevelFeederBaysFormSchema,
|
|
12
|
+
moveVoltageLevelFeederBaysFormToDto
|
|
13
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ConnectablePositionInfos } from '../../common';
|
|
2
|
+
import { ModificationType } from '../../../../utils';
|
|
3
|
+
export type FeederBaysFormInfos = {
|
|
4
|
+
equipmentId: string | null;
|
|
5
|
+
busbarSectionId: string | null;
|
|
6
|
+
busbarSectionIds: string[] | null;
|
|
7
|
+
connectionSide: string | null;
|
|
8
|
+
connectionName: string | null;
|
|
9
|
+
connectionDirection: string | null;
|
|
10
|
+
connectionPosition: number | null;
|
|
11
|
+
isRemoved: boolean;
|
|
12
|
+
rowId: string | null;
|
|
13
|
+
};
|
|
14
|
+
export type FeederBayInfos = {
|
|
15
|
+
busbarSectionId: string;
|
|
16
|
+
connectionSide: string | null;
|
|
17
|
+
connectablePositionInfos: ConnectablePositionInfos;
|
|
18
|
+
};
|
|
19
|
+
export type FeederBays = (FeederBayInfos & {
|
|
20
|
+
equipmentId: string;
|
|
21
|
+
rowId: string;
|
|
22
|
+
})[];
|
|
23
|
+
export interface MoveVoltageLevelFeederBaysDto {
|
|
24
|
+
type: ModificationType.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS;
|
|
25
|
+
uuid?: string;
|
|
26
|
+
voltageLevelId: string;
|
|
27
|
+
feederBays: MoveFeederBayDto[];
|
|
28
|
+
}
|
|
29
|
+
export interface MoveFeederBayDto {
|
|
30
|
+
equipmentId: string;
|
|
31
|
+
busbarSectionId: string;
|
|
32
|
+
connectionSide: string | null;
|
|
33
|
+
connectionPosition: string | null;
|
|
34
|
+
connectionName: string | null;
|
|
35
|
+
connectionDirection: string | null;
|
|
36
|
+
}
|