@gridsuite/commons-ui 0.189.0 → 0.190.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.
Files changed (57) hide show
  1. package/dist/components/customAGGrid/cell-renderers.js +28 -26
  2. package/dist/components/dnd-table/dnd-table.js +71 -34
  3. package/dist/components/index.js +16 -6
  4. package/dist/components/inputs/index.js +2 -0
  5. package/dist/components/inputs/reactHookForm/index.js +2 -0
  6. package/dist/components/inputs/reactHookForm/selectInputs/SelectWithConfirmationInput.d.ts +9 -0
  7. package/dist/components/inputs/reactHookForm/selectInputs/SelectWithConfirmationInput.js +64 -0
  8. package/dist/components/inputs/reactHookForm/selectInputs/index.d.ts +1 -0
  9. package/dist/components/inputs/reactHookForm/selectInputs/index.js +3 -1
  10. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-constants.d.ts +16 -0
  11. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-constants.js +402 -0
  12. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-form.d.ts +12 -0
  13. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-form.js +217 -0
  14. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-utils.d.ts +21 -0
  15. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-utils.js +89 -0
  16. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment.type.d.ts +28 -0
  17. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment.type.js +12 -0
  18. package/dist/components/network-modifications/by-filter/assignment/index.d.ts +10 -0
  19. package/dist/components/network-modifications/by-filter/assignment/index.js +11 -0
  20. package/dist/components/network-modifications/by-filter/assignment/modification-by-assignment-form.d.ts +7 -0
  21. package/dist/components/network-modifications/by-filter/assignment/modification-by-assignment-form.js +89 -0
  22. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.types.d.ts +7 -0
  23. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.types.js +1 -0
  24. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.utils.d.ts +22 -0
  25. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.utils.js +55 -0
  26. package/dist/components/network-modifications/by-filter/index.d.ts +1 -0
  27. package/dist/components/network-modifications/by-filter/index.js +10 -1
  28. package/dist/components/network-modifications/hooks/index.d.ts +7 -0
  29. package/dist/components/network-modifications/hooks/index.js +4 -0
  30. package/dist/components/network-modifications/hooks/useTabsWithError.d.ts +15 -0
  31. package/dist/components/network-modifications/hooks/useTabsWithError.js +28 -0
  32. package/dist/components/network-modifications/index.d.ts +1 -0
  33. package/dist/components/network-modifications/index.js +14 -6
  34. package/dist/components/network-modifications/load/common/LoadForm.d.ts +1 -1
  35. package/dist/components/network-modifications/load/common/LoadForm.js +7 -27
  36. package/dist/components/network-modifications/load/common/index.js +2 -1
  37. package/dist/components/network-modifications/load/common/load.utils.d.ts +7 -11
  38. package/dist/components/network-modifications/load/common/load.utils.js +30 -4
  39. package/dist/components/network-modifications/load/index.js +2 -1
  40. package/dist/components/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +9 -29
  41. package/dist/components/network-modifications/voltageLevel/creation/index.js +1 -5
  42. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.d.ts +8 -12
  43. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.js +53 -5
  44. package/dist/components/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.d.ts +0 -4
  45. package/dist/components/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +0 -16
  46. package/dist/components/network-modifications/voltageLevel/index.js +1 -5
  47. package/dist/components/parameters/dynamic-margin-calculation/loads-variations-parameters.js +1 -0
  48. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -0
  49. package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +1 -0
  50. package/dist/index.js +16 -6
  51. package/dist/translations/en/networkModificationsEn.d.ts +51 -0
  52. package/dist/translations/en/networkModificationsEn.js +51 -0
  53. package/dist/translations/fr/networkModificationsFr.d.ts +51 -0
  54. package/dist/translations/fr/networkModificationsFr.js +51 -0
  55. package/dist/utils/constants/fieldConstants.d.ts +2 -0
  56. package/dist/utils/constants/fieldConstants.js +2 -0
  57. package/package.json +1 -1
@@ -0,0 +1,402 @@
1
+ import { DataType } from "./assignment.type.js";
2
+ import { SIEMENS, MEGA_VAR, MEGA_WATT, PERCENTAGE, OHM, MEGA_VOLT_AMPERE, KILO_VOLT, MICRO_SIEMENS, KILO_AMPERE } from "../../../../../utils/constants/unitsConstants.js";
3
+ import "../../../../../utils/conversionUtils.js";
4
+ import { EquipmentType, LOAD_TYPES } from "../../../../../utils/types/equipmentType.js";
5
+ import { FieldType } from "../../../../../utils/types/fieldType.js";
6
+ import "react/jsx-runtime";
7
+ import "@mui/icons-material";
8
+ import "../../../../../utils/yupConfig.js";
9
+ const FIELD_OPTIONS = {
10
+ PROPERTY: {
11
+ id: FieldType.FREE_PROPERTIES,
12
+ label: "Property",
13
+ dataType: DataType.PROPERTY
14
+ },
15
+ RATED_NOMINAL_POWER: {
16
+ id: FieldType.RATED_NOMINAL_POWER,
17
+ label: "RatedNominalPowerText",
18
+ unit: MEGA_VOLT_AMPERE,
19
+ dataType: DataType.DOUBLE,
20
+ settableToNone: true
21
+ },
22
+ MINIMUM_ACTIVE_POWER: {
23
+ id: FieldType.MINIMUM_ACTIVE_POWER,
24
+ label: "MinimumActivePowerText",
25
+ unit: MEGA_WATT,
26
+ dataType: DataType.DOUBLE
27
+ },
28
+ MAXIMUM_ACTIVE_POWER: {
29
+ id: FieldType.MAXIMUM_ACTIVE_POWER,
30
+ label: "MaximumActivePowerText",
31
+ unit: MEGA_WATT,
32
+ dataType: DataType.DOUBLE
33
+ },
34
+ ACTIVE_POWER_SET_POINT: {
35
+ id: FieldType.ACTIVE_POWER_SET_POINT,
36
+ label: "ActivePowerSetPointText",
37
+ unit: MEGA_WATT,
38
+ dataType: DataType.DOUBLE
39
+ },
40
+ REACTIVE_POWER_SET_POINT: {
41
+ id: FieldType.REACTIVE_POWER_SET_POINT,
42
+ label: "ReactivePowerSetPointText",
43
+ unit: MEGA_VAR,
44
+ dataType: DataType.DOUBLE
45
+ },
46
+ VOLTAGE_SET_POINT: {
47
+ id: FieldType.VOLTAGE_SET_POINT,
48
+ label: "GeneratorTargetV",
49
+ unit: KILO_VOLT,
50
+ dataType: DataType.DOUBLE
51
+ },
52
+ PLANNED_ACTIVE_POWER_SET_POINT: {
53
+ id: FieldType.PLANNED_ACTIVE_POWER_SET_POINT,
54
+ label: "PlannedActivePowerSetPointForm",
55
+ unit: MEGA_WATT,
56
+ dataType: DataType.DOUBLE
57
+ },
58
+ MARGINAL_COST: {
59
+ id: FieldType.MARGINAL_COST,
60
+ label: "MarginalCost",
61
+ dataType: DataType.DOUBLE
62
+ },
63
+ PLANNED_OUTAGE_RATE: {
64
+ id: FieldType.PLANNED_OUTAGE_RATE,
65
+ label: "plannedOutageRate",
66
+ dataType: DataType.DOUBLE
67
+ },
68
+ FORCED_OUTAGE_RATE: {
69
+ id: FieldType.FORCED_OUTAGE_RATE,
70
+ label: "forcedOutageRate",
71
+ dataType: DataType.DOUBLE
72
+ },
73
+ DROOP: {
74
+ id: FieldType.DROOP,
75
+ label: "ActivePowerRegulationDroop",
76
+ unit: PERCENTAGE,
77
+ dataType: DataType.DOUBLE
78
+ },
79
+ TRANSIENT_REACTANCE: {
80
+ id: FieldType.TRANSIENT_REACTANCE,
81
+ label: "TransientReactanceForm",
82
+ unit: OHM,
83
+ dataType: DataType.DOUBLE
84
+ },
85
+ STEP_UP_TRANSFORMER_REACTANCE: {
86
+ id: FieldType.STEP_UP_TRANSFORMER_REACTANCE,
87
+ label: "TransformerReactanceForm",
88
+ unit: OHM,
89
+ dataType: DataType.DOUBLE,
90
+ settableToNone: true
91
+ },
92
+ Q_PERCENT: {
93
+ id: FieldType.Q_PERCENT,
94
+ label: "ReactivePercentageVoltageRegulation",
95
+ unit: PERCENTAGE,
96
+ dataType: DataType.DOUBLE
97
+ },
98
+ VOLTAGE_REGULATOR_ON: {
99
+ id: FieldType.VOLTAGE_REGULATOR_ON,
100
+ label: "voltageRegulationOn",
101
+ dataType: DataType.BOOLEAN
102
+ },
103
+ MAXIMUM_SECTION_COUNT: {
104
+ id: FieldType.MAXIMUM_SECTION_COUNT,
105
+ label: "maximumSectionCount",
106
+ dataType: DataType.INTEGER
107
+ },
108
+ SECTION_COUNT: {
109
+ id: FieldType.SECTION_COUNT,
110
+ label: "sectionCount",
111
+ dataType: DataType.INTEGER
112
+ },
113
+ MAX_SUSCEPTANCE: {
114
+ id: FieldType.MAX_SUSCEPTANCE,
115
+ label: "maxSusceptance",
116
+ unit: SIEMENS,
117
+ dataType: DataType.DOUBLE
118
+ },
119
+ MAX_Q_AT_NOMINAL_V: {
120
+ id: FieldType.MAX_Q_AT_NOMINAL_V,
121
+ label: "maxQAtNominalV",
122
+ unit: MEGA_VAR,
123
+ dataType: DataType.DOUBLE
124
+ },
125
+ NOMINAL_VOLTAGE: {
126
+ id: FieldType.NOMINAL_VOLTAGE,
127
+ label: "NominalVoltage",
128
+ unit: KILO_VOLT,
129
+ dataType: DataType.DOUBLE
130
+ },
131
+ LOW_VOLTAGE_LIMIT: {
132
+ id: FieldType.LOW_VOLTAGE_LIMIT,
133
+ label: "LowVoltageLimit",
134
+ unit: KILO_VOLT,
135
+ settableToNone: true,
136
+ dataType: DataType.DOUBLE
137
+ },
138
+ HIGH_VOLTAGE_LIMIT: {
139
+ id: FieldType.HIGH_VOLTAGE_LIMIT,
140
+ label: "HighVoltageLimit",
141
+ unit: KILO_VOLT,
142
+ settableToNone: true,
143
+ dataType: DataType.DOUBLE
144
+ },
145
+ LOW_SHORT_CIRCUIT_CURRENT_LIMIT: {
146
+ id: FieldType.LOW_SHORT_CIRCUIT_CURRENT_LIMIT,
147
+ label: "LowShortCircuitCurrentLimit",
148
+ unit: KILO_AMPERE,
149
+ settableToNone: true,
150
+ dataType: DataType.DOUBLE
151
+ },
152
+ HIGH_SHORT_CIRCUIT_CURRENT_LIMIT: {
153
+ id: FieldType.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT,
154
+ label: "HighShortCircuitCurrentLimit",
155
+ unit: KILO_AMPERE,
156
+ settableToNone: true,
157
+ dataType: DataType.DOUBLE
158
+ },
159
+ ACTIVE_POWER: {
160
+ id: FieldType.ACTIVE_POWER,
161
+ label: "ActivePowerText",
162
+ unit: MEGA_WATT,
163
+ dataType: DataType.DOUBLE
164
+ },
165
+ REACTIVE_POWER: {
166
+ id: FieldType.REACTIVE_POWER,
167
+ label: "ReactivePowerText",
168
+ unit: MEGA_VAR,
169
+ dataType: DataType.DOUBLE
170
+ },
171
+ R: {
172
+ id: FieldType.R,
173
+ label: "SeriesResistanceText",
174
+ unit: OHM,
175
+ dataType: DataType.DOUBLE
176
+ },
177
+ X: {
178
+ id: FieldType.X,
179
+ label: "SeriesReactanceText",
180
+ unit: OHM,
181
+ dataType: DataType.DOUBLE
182
+ },
183
+ G: {
184
+ id: FieldType.G,
185
+ label: "ShuntConductanceText",
186
+ unit: MICRO_SIEMENS,
187
+ dataType: DataType.DOUBLE
188
+ },
189
+ G1: {
190
+ id: FieldType.G1,
191
+ label: "ShuntConductanceText1",
192
+ unit: MICRO_SIEMENS,
193
+ dataType: DataType.DOUBLE
194
+ },
195
+ G2: {
196
+ id: FieldType.G2,
197
+ label: "ShuntConductanceText2",
198
+ unit: MICRO_SIEMENS,
199
+ dataType: DataType.DOUBLE
200
+ },
201
+ B: {
202
+ id: FieldType.B,
203
+ label: "ShuntSusceptanceText",
204
+ unit: MICRO_SIEMENS,
205
+ dataType: DataType.DOUBLE
206
+ },
207
+ B1: {
208
+ id: FieldType.B1,
209
+ label: "ShuntSusceptanceText1",
210
+ unit: MICRO_SIEMENS,
211
+ dataType: DataType.DOUBLE
212
+ },
213
+ B2: {
214
+ id: FieldType.B2,
215
+ label: "ShuntSusceptanceText2",
216
+ unit: MICRO_SIEMENS,
217
+ dataType: DataType.DOUBLE
218
+ },
219
+ RATED_U1: {
220
+ id: FieldType.RATED_U1,
221
+ label: "RatedU1",
222
+ unit: KILO_VOLT,
223
+ dataType: DataType.DOUBLE
224
+ },
225
+ RATED_U2: {
226
+ id: FieldType.RATED_U2,
227
+ label: "RatedU2",
228
+ unit: KILO_VOLT,
229
+ dataType: DataType.DOUBLE
230
+ },
231
+ RATED_S: {
232
+ id: FieldType.RATED_S,
233
+ label: "RatedNominalPowerText",
234
+ unit: MEGA_VOLT_AMPERE,
235
+ dataType: DataType.DOUBLE,
236
+ settableToNone: true
237
+ },
238
+ TARGET_V: {
239
+ id: FieldType.TARGET_V,
240
+ label: "RatioTargetV",
241
+ unit: KILO_VOLT,
242
+ dataType: DataType.DOUBLE
243
+ },
244
+ RATIO_LOW_TAP_POSITION: {
245
+ id: FieldType.RATIO_LOW_TAP_POSITION,
246
+ label: "RatioLowTapPosition",
247
+ dataType: DataType.INTEGER
248
+ },
249
+ RATIO_TAP_POSITION: {
250
+ id: FieldType.RATIO_TAP_POSITION,
251
+ label: "RatioTapPosition",
252
+ dataType: DataType.INTEGER
253
+ },
254
+ RATIO_TARGET_DEADBAND: {
255
+ id: FieldType.RATIO_TARGET_DEADBAND,
256
+ unit: KILO_VOLT,
257
+ label: "RatioDeadBand",
258
+ dataType: DataType.DOUBLE
259
+ },
260
+ REGULATION_VALUE: {
261
+ id: FieldType.REGULATION_VALUE,
262
+ label: "PhaseRegulatingValue",
263
+ dataType: DataType.DOUBLE
264
+ },
265
+ PHASE_LOW_TAP_POSITION: {
266
+ id: FieldType.PHASE_LOW_TAP_POSITION,
267
+ label: "PhaseLowTapPosition",
268
+ dataType: DataType.INTEGER
269
+ },
270
+ PHASE_TAP_POSITION: {
271
+ id: FieldType.PHASE_TAP_POSITION,
272
+ label: "PhaseTapPosition",
273
+ dataType: DataType.INTEGER
274
+ },
275
+ PHASE_TARGET_DEADBAND: {
276
+ id: FieldType.PHASE_TARGET_DEADBAND,
277
+ label: "PhaseDeadBand",
278
+ dataType: DataType.DOUBLE
279
+ },
280
+ LOAD_TYPE: {
281
+ id: FieldType.LOAD_TYPE,
282
+ label: "loadType",
283
+ dataType: DataType.ENUM,
284
+ values: LOAD_TYPES
285
+ },
286
+ SELECTED_OPERATIONAL_LIMITS_GROUP_ID1: {
287
+ id: FieldType.SELECTED_OPERATIONAL_LIMITS_GROUP_ID1,
288
+ label: "selectedOperationalLimitsGroup1",
289
+ dataType: DataType.STRING,
290
+ settableToNone: true
291
+ },
292
+ SELECTED_OPERATIONAL_LIMITS_GROUP_ID2: {
293
+ id: FieldType.SELECTED_OPERATIONAL_LIMITS_GROUP_ID2,
294
+ label: "selectedOperationalLimitsGroup2",
295
+ dataType: DataType.STRING,
296
+ settableToNone: true
297
+ },
298
+ OPERATIONAL_LIMITS_GROUP_1_WITH_PROPERTIES: {
299
+ id: FieldType.OPERATIONAL_LIMITS_GROUP_1_WITH_PROPERTIES,
300
+ label: "operationalLimitsGroup1WithProperties",
301
+ dataType: DataType.PROPERTY
302
+ },
303
+ OPERATIONAL_LIMITS_GROUP_2_WITH_PROPERTIES: {
304
+ id: FieldType.OPERATIONAL_LIMITS_GROUP_2_WITH_PROPERTIES,
305
+ label: "operationalLimitsGroup2WithProperties",
306
+ dataType: DataType.PROPERTY
307
+ }
308
+ };
309
+ const EQUIPMENTS_FIELDS = {
310
+ [EquipmentType.SUBSTATION]: [FIELD_OPTIONS.PROPERTY],
311
+ [EquipmentType.VOLTAGE_LEVEL]: [
312
+ FIELD_OPTIONS.PROPERTY,
313
+ FIELD_OPTIONS.NOMINAL_VOLTAGE,
314
+ FIELD_OPTIONS.LOW_VOLTAGE_LIMIT,
315
+ FIELD_OPTIONS.HIGH_VOLTAGE_LIMIT,
316
+ FIELD_OPTIONS.LOW_SHORT_CIRCUIT_CURRENT_LIMIT,
317
+ FIELD_OPTIONS.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT
318
+ ],
319
+ [EquipmentType.LINE]: [
320
+ FIELD_OPTIONS.PROPERTY,
321
+ FIELD_OPTIONS.R,
322
+ FIELD_OPTIONS.X,
323
+ FIELD_OPTIONS.G1,
324
+ FIELD_OPTIONS.G2,
325
+ FIELD_OPTIONS.B1,
326
+ FIELD_OPTIONS.B2,
327
+ FIELD_OPTIONS.SELECTED_OPERATIONAL_LIMITS_GROUP_ID1,
328
+ FIELD_OPTIONS.SELECTED_OPERATIONAL_LIMITS_GROUP_ID2,
329
+ FIELD_OPTIONS.OPERATIONAL_LIMITS_GROUP_1_WITH_PROPERTIES,
330
+ FIELD_OPTIONS.OPERATIONAL_LIMITS_GROUP_2_WITH_PROPERTIES
331
+ ],
332
+ [EquipmentType.TWO_WINDINGS_TRANSFORMER]: [
333
+ FIELD_OPTIONS.PROPERTY,
334
+ FIELD_OPTIONS.R,
335
+ FIELD_OPTIONS.X,
336
+ FIELD_OPTIONS.G,
337
+ FIELD_OPTIONS.B,
338
+ FIELD_OPTIONS.RATED_U1,
339
+ FIELD_OPTIONS.RATED_U2,
340
+ FIELD_OPTIONS.RATED_S,
341
+ FIELD_OPTIONS.TARGET_V,
342
+ FIELD_OPTIONS.RATIO_LOW_TAP_POSITION,
343
+ FIELD_OPTIONS.RATIO_TAP_POSITION,
344
+ FIELD_OPTIONS.RATIO_TARGET_DEADBAND,
345
+ FIELD_OPTIONS.REGULATION_VALUE,
346
+ FIELD_OPTIONS.PHASE_LOW_TAP_POSITION,
347
+ FIELD_OPTIONS.PHASE_TAP_POSITION,
348
+ FIELD_OPTIONS.PHASE_TARGET_DEADBAND,
349
+ FIELD_OPTIONS.SELECTED_OPERATIONAL_LIMITS_GROUP_ID1,
350
+ FIELD_OPTIONS.SELECTED_OPERATIONAL_LIMITS_GROUP_ID2,
351
+ FIELD_OPTIONS.OPERATIONAL_LIMITS_GROUP_1_WITH_PROPERTIES,
352
+ FIELD_OPTIONS.OPERATIONAL_LIMITS_GROUP_2_WITH_PROPERTIES
353
+ ],
354
+ [EquipmentType.THREE_WINDINGS_TRANSFORMER]: [FIELD_OPTIONS.PROPERTY],
355
+ [EquipmentType.GENERATOR]: [
356
+ FIELD_OPTIONS.PROPERTY,
357
+ FIELD_OPTIONS.VOLTAGE_REGULATOR_ON,
358
+ FIELD_OPTIONS.RATED_NOMINAL_POWER,
359
+ FIELD_OPTIONS.MINIMUM_ACTIVE_POWER,
360
+ FIELD_OPTIONS.MAXIMUM_ACTIVE_POWER,
361
+ FIELD_OPTIONS.ACTIVE_POWER_SET_POINT,
362
+ FIELD_OPTIONS.REACTIVE_POWER_SET_POINT,
363
+ FIELD_OPTIONS.VOLTAGE_SET_POINT,
364
+ FIELD_OPTIONS.PLANNED_ACTIVE_POWER_SET_POINT,
365
+ FIELD_OPTIONS.MARGINAL_COST,
366
+ FIELD_OPTIONS.PLANNED_OUTAGE_RATE,
367
+ FIELD_OPTIONS.FORCED_OUTAGE_RATE,
368
+ FIELD_OPTIONS.DROOP,
369
+ FIELD_OPTIONS.TRANSIENT_REACTANCE,
370
+ FIELD_OPTIONS.STEP_UP_TRANSFORMER_REACTANCE,
371
+ FIELD_OPTIONS.Q_PERCENT
372
+ ],
373
+ [EquipmentType.BATTERY]: [
374
+ FIELD_OPTIONS.PROPERTY,
375
+ FIELD_OPTIONS.MINIMUM_ACTIVE_POWER,
376
+ FIELD_OPTIONS.MAXIMUM_ACTIVE_POWER,
377
+ FIELD_OPTIONS.ACTIVE_POWER_SET_POINT,
378
+ FIELD_OPTIONS.REACTIVE_POWER_SET_POINT,
379
+ FIELD_OPTIONS.DROOP,
380
+ FIELD_OPTIONS.TRANSIENT_REACTANCE,
381
+ FIELD_OPTIONS.STEP_UP_TRANSFORMER_REACTANCE
382
+ ],
383
+ [EquipmentType.LOAD]: [
384
+ FIELD_OPTIONS.PROPERTY,
385
+ FIELD_OPTIONS.LOAD_TYPE,
386
+ FIELD_OPTIONS.ACTIVE_POWER_SET_POINT,
387
+ FIELD_OPTIONS.REACTIVE_POWER_SET_POINT
388
+ ],
389
+ [EquipmentType.SHUNT_COMPENSATOR]: [
390
+ FIELD_OPTIONS.PROPERTY,
391
+ FIELD_OPTIONS.MAXIMUM_SECTION_COUNT,
392
+ FIELD_OPTIONS.SECTION_COUNT,
393
+ FIELD_OPTIONS.MAX_SUSCEPTANCE,
394
+ FIELD_OPTIONS.MAX_Q_AT_NOMINAL_V
395
+ ],
396
+ [EquipmentType.STATIC_VAR_COMPENSATOR]: [FIELD_OPTIONS.PROPERTY],
397
+ [EquipmentType.HVDC_LINE]: [FIELD_OPTIONS.PROPERTY]
398
+ };
399
+ export {
400
+ EQUIPMENTS_FIELDS,
401
+ FIELD_OPTIONS
402
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2026, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
7
+ interface AssignmentFormProps {
8
+ name: string;
9
+ index: number;
10
+ }
11
+ declare function AssignmentForm(props: Readonly<AssignmentFormProps>): import("react/jsx-runtime").JSX.Element;
12
+ export default AssignmentForm;
@@ -0,0 +1,217 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { useMemo, useCallback } from "react";
3
+ import { DensityLarge } from "@mui/icons-material";
4
+ import { useFormContext, useWatch } from "react-hook-form";
5
+ import { useIntl } from "react-intl";
6
+ import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
7
+ import "../../../../../utils/conversionUtils.js";
8
+ import { ElementType } from "../../../../../utils/types/elementType.js";
9
+ import "../../../../../utils/types/equipmentType.js";
10
+ import { FieldType } from "../../../../../utils/types/fieldType.js";
11
+ import { areIdsEqual, getIdOrValue } from "../../../../../utils/ts-utils.js";
12
+ import "../../../../../utils/yupConfig.js";
13
+ import "@mui/material";
14
+ import "localized-countries";
15
+ import "localized-countries/data/fr";
16
+ import "localized-countries/data/en";
17
+ import { usePredefinedProperties } from "../../../../../hooks/usePredefinedProperties.js";
18
+ import { usePrevious } from "../../../../../hooks/usePrevious.js";
19
+ import "notistack";
20
+ import { useFormatLabelWithUnit } from "../../../../../hooks/useFormatLabelWithUnit.js";
21
+ import "../../../../overflowableText/OverflowableText.js";
22
+ import "../../../../inputs/reactHookForm/provider/CustomFormProvider.js";
23
+ import "yup";
24
+ import { DirectoryItemsInput } from "../../../../inputs/reactHookForm/DirectoryItemsInput.js";
25
+ import "../../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
26
+ import "../../../../customAGGrid/customAggrid.js";
27
+ import "ag-grid-community";
28
+ import "react-papaparse";
29
+ import "react-csv-downloader";
30
+ import { AutocompleteInput } from "../../../../inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js";
31
+ import { SwitchInput } from "../../../../inputs/reactHookForm/booleans/SwitchInput.js";
32
+ import { FloatInput } from "../../../../inputs/reactHookForm/numbers/FloatInput.js";
33
+ import { IntegerInput } from "../../../../inputs/reactHookForm/numbers/IntegerInput.js";
34
+ import "../../../../inputs/reactHookForm/numbers/RangeInput.js";
35
+ import { SelectInput } from "../../../../inputs/reactHookForm/selectInputs/SelectInput.js";
36
+ import { TextInput } from "../../../../inputs/reactHookForm/text/TextInput.js";
37
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
38
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
39
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
40
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
41
+ import "../../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
42
+ import "@react-querybuilder/material";
43
+ import "../../../../filter/expert/expertFilterConstants.js";
44
+ import "../../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
45
+ import "uuid";
46
+ import "../../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
47
+ import "react-querybuilder";
48
+ import { DataType } from "./assignment.type.js";
49
+ import GridItem from "../../../../grid/grid-item.js";
50
+ import { EQUIPMENTS_FIELDS } from "./assignment-constants.js";
51
+ const comparatorStrIgnoreCase = (str1, str2) => {
52
+ return str1?.toLowerCase()?.localeCompare(str2?.toLowerCase());
53
+ };
54
+ function AssignmentForm(props) {
55
+ const { name, index } = props;
56
+ const { setError, setValue } = useFormContext();
57
+ const intl = useIntl();
58
+ const watchEditedField = useWatch({
59
+ name: `${name}.${index}.${FieldConstants.EDITED_FIELD}`
60
+ });
61
+ const watchEquipmentType = useWatch({
62
+ name: FieldConstants.EQUIPMENT_TYPE
63
+ });
64
+ const equipmentFields = useMemo(
65
+ () => Object.values(EQUIPMENTS_FIELDS[watchEquipmentType] ?? []),
66
+ [watchEquipmentType]
67
+ );
68
+ const networkEquipmentType = useMemo(() => {
69
+ if ([
70
+ FieldType.OPERATIONAL_LIMITS_GROUP_1_WITH_PROPERTIES,
71
+ FieldType.OPERATIONAL_LIMITS_GROUP_2_WITH_PROPERTIES
72
+ ].includes(watchEditedField)) {
73
+ return "limitsGroup";
74
+ }
75
+ return watchEquipmentType;
76
+ }, [watchEquipmentType, watchEditedField]);
77
+ const [predefinedProperties] = usePredefinedProperties(networkEquipmentType);
78
+ const dataType = useMemo(() => {
79
+ return equipmentFields?.find((fieldOption) => fieldOption?.id === watchEditedField)?.dataType;
80
+ }, [watchEditedField, equipmentFields]);
81
+ const settableToNone = useMemo(() => {
82
+ return equipmentFields?.find((fieldOption) => fieldOption?.id === watchEditedField)?.settableToNone ?? false;
83
+ }, [watchEditedField, equipmentFields]);
84
+ const watchPropertyName = useWatch({
85
+ name: `${name}.${index}.${FieldConstants.PROPERTY_NAME}`
86
+ });
87
+ const predefinedPropertiesNames = useMemo(() => {
88
+ return Object.keys(predefinedProperties ?? {}).sort(comparatorStrIgnoreCase);
89
+ }, [predefinedProperties]);
90
+ const predefinedPropertiesValues = useMemo(() => {
91
+ return [...predefinedProperties?.[watchPropertyName] ?? []].sort(comparatorStrIgnoreCase);
92
+ }, [watchPropertyName, predefinedProperties]);
93
+ const options = useMemo(() => {
94
+ return equipmentFields?.find((fieldOption) => fieldOption?.id === watchEditedField)?.values ?? [];
95
+ }, [watchEditedField, equipmentFields]);
96
+ const prevDataType = usePrevious(dataType);
97
+ if (prevDataType && prevDataType !== dataType) {
98
+ setValue(`${name}.${index}.${FieldConstants.VALUE}`, dataType === DataType.BOOLEAN ? false : null);
99
+ }
100
+ const emptyValueStr = useMemo(() => {
101
+ return intl.formatMessage({ id: "EmptyField" });
102
+ }, [intl]);
103
+ const formatLabelWithUnit = useFormatLabelWithUnit();
104
+ const renderAutoCompleteSettableToNone = useCallback(
105
+ (numberOnly) => /* @__PURE__ */ jsx(
106
+ AutocompleteInput,
107
+ {
108
+ name: `${name}.${index}.${FieldConstants.VALUE}`,
109
+ label: "ValueOrEmptyField",
110
+ options: [emptyValueStr],
111
+ size: "small",
112
+ onCheckNewValue: numberOnly ? (option) => {
113
+ if (option && option !== emptyValueStr && Number.isNaN(Number(option))) {
114
+ setError(`${name}.${index}.${FieldConstants.VALUE}`, {
115
+ message: "NumericValueOrEmptyField"
116
+ });
117
+ } else {
118
+ setError(`${name}.${index}.${FieldConstants.VALUE}`, {
119
+ message: ""
120
+ });
121
+ }
122
+ return true;
123
+ } : void 0,
124
+ getOptionLabel: (option) => typeof option !== "string" ? option?.label ?? option : option,
125
+ allowNewValue: true
126
+ }
127
+ ),
128
+ [emptyValueStr, index, name, setError]
129
+ );
130
+ const filtersField = /* @__PURE__ */ jsx(
131
+ DirectoryItemsInput,
132
+ {
133
+ name: `${name}.${index}.${FieldConstants.FILTERS}`,
134
+ equipmentTypes: [watchEquipmentType],
135
+ elementType: ElementType.FILTER,
136
+ label: "filter",
137
+ titleId: "FiltersListsSelection",
138
+ disable: !watchEquipmentType
139
+ }
140
+ );
141
+ const editedField = /* @__PURE__ */ jsx(
142
+ AutocompleteInput,
143
+ {
144
+ name: `${name}.${index}.${FieldConstants.EDITED_FIELD}`,
145
+ options: equipmentFields,
146
+ label: "EditedField",
147
+ size: "small",
148
+ inputTransform: (value) => equipmentFields.find((option) => option?.id === value) || value,
149
+ outputTransform: (option) => getIdOrValue(option) ?? null,
150
+ getOptionLabel: (option) => formatLabelWithUnit(option),
151
+ isOptionEqualToValue: areIdsEqual
152
+ }
153
+ );
154
+ const propertyNameField = /* @__PURE__ */ jsx(
155
+ AutocompleteInput,
156
+ {
157
+ name: `${name}.${index}.${FieldConstants.PROPERTY_NAME}`,
158
+ options: predefinedPropertiesNames,
159
+ label: "PropertyName",
160
+ size: "small",
161
+ allowNewValue: true
162
+ }
163
+ );
164
+ const valueField = useMemo(() => {
165
+ if (dataType === DataType.PROPERTY) {
166
+ return /* @__PURE__ */ jsx(
167
+ AutocompleteInput,
168
+ {
169
+ name: `${name}.${index}.${FieldConstants.VALUE}`,
170
+ label: "PropertyValue",
171
+ options: predefinedPropertiesValues,
172
+ size: "small",
173
+ allowNewValue: true
174
+ }
175
+ );
176
+ }
177
+ if (dataType === DataType.INTEGER) {
178
+ return /* @__PURE__ */ jsx(IntegerInput, { name: `${name}.${index}.${FieldConstants.VALUE}`, label: "Value" });
179
+ }
180
+ if (dataType === DataType.BOOLEAN) {
181
+ return /* @__PURE__ */ jsx(SwitchInput, { name: `${name}.${index}.${FieldConstants.VALUE}`, formProps: { value: false } });
182
+ }
183
+ if (dataType === DataType.ENUM) {
184
+ return /* @__PURE__ */ jsx(
185
+ SelectInput,
186
+ {
187
+ name: `${name}.${index}.${FieldConstants.VALUE}`,
188
+ label: "Value",
189
+ options,
190
+ size: "small"
191
+ }
192
+ );
193
+ }
194
+ if (dataType === DataType.STRING && settableToNone) {
195
+ return renderAutoCompleteSettableToNone();
196
+ }
197
+ if (dataType === DataType.STRING) {
198
+ return /* @__PURE__ */ jsx(TextInput, { name: `${name}.${index}.${FieldConstants.VALUE}`, label: "Value", clearable: true });
199
+ }
200
+ if (dataType === DataType.DOUBLE && settableToNone) {
201
+ return renderAutoCompleteSettableToNone(true);
202
+ }
203
+ return /* @__PURE__ */ jsx(FloatInput, { name: `${name}.${index}.${FieldConstants.VALUE}`, label: "Value" });
204
+ }, [dataType, settableToNone, name, index, predefinedPropertiesValues, options, renderAutoCompleteSettableToNone]);
205
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
206
+ /* @__PURE__ */ jsx(GridItem, { size: 3.25, children: filtersField }),
207
+ /* @__PURE__ */ jsx(GridItem, { size: 3, children: editedField }),
208
+ /* @__PURE__ */ jsxs(Fragment, { children: [
209
+ dataType === DataType.PROPERTY && /* @__PURE__ */ jsx(GridItem, { size: 2, children: propertyNameField }),
210
+ /* @__PURE__ */ jsx(GridItem, { size: 0.25, children: /* @__PURE__ */ jsx(DensityLarge, { fontSize: "small", sx: { marginTop: 1 } }) })
211
+ ] }),
212
+ /* @__PURE__ */ jsx(GridItem, { size: dataType === DataType.PROPERTY ? 2.25 : 4.25, children: valueField })
213
+ ] });
214
+ }
215
+ export {
216
+ AssignmentForm as default
217
+ };
@@ -0,0 +1,21 @@
1
+ import { yupConfig as yup } from '../../../../../utils';
2
+ import { Assignment, DataType, FieldOptionType, FieldValue } from './assignment.type';
3
+ export declare const getFieldOption: (fieldName?: string | null) => FieldOptionType | undefined;
4
+ export declare const getDataType: (fieldName?: string | null) => DataType | undefined;
5
+ export declare const getUnsettable: (fieldName?: string | null) => boolean | undefined;
6
+ export declare const getAssignmentInitialValue: () => {
7
+ filters: never[];
8
+ editedField: null;
9
+ propertyName: null;
10
+ value: null;
11
+ };
12
+ export declare function getAssignmentsSchema(emptyValueStr: string): yup.ArraySchema<{
13
+ propertyName?: string | undefined;
14
+ editedField: string;
15
+ filters: {
16
+ id: string;
17
+ name: string;
18
+ }[];
19
+ value: NonNullable<FieldValue | undefined>;
20
+ }[], yup.AnyObject, "", "">;
21
+ export declare function getAssignmentFromEditData(assignment: Assignment): Assignment;