@gridsuite/commons-ui 0.193.0 → 0.195.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 (112) hide show
  1. package/dist/components/directoryItemSelector/DirectoryItemSelector.js +0 -1
  2. package/dist/components/dnd-table-v2/deletable-table-row.d.ts +7 -0
  3. package/dist/components/dnd-table-v2/deletable-table-row.js +37 -0
  4. package/dist/components/dnd-table-v2/dnd-table-add-rows-dialog.d.ts +13 -0
  5. package/dist/components/dnd-table-v2/dnd-table-add-rows-dialog.js +75 -0
  6. package/dist/components/dnd-table-v2/dnd-table-bottom-left-buttons.d.ts +17 -0
  7. package/dist/components/dnd-table-v2/dnd-table-bottom-left-buttons.js +48 -0
  8. package/dist/components/dnd-table-v2/dnd-table-bottom-right-buttons.d.ts +17 -0
  9. package/dist/components/dnd-table-v2/dnd-table-bottom-right-buttons.js +103 -0
  10. package/dist/components/dnd-table-v2/dnd-table-row.d.ts +23 -0
  11. package/dist/components/dnd-table-v2/dnd-table-row.js +183 -0
  12. package/dist/components/dnd-table-v2/dnd-table-utils.d.ts +2 -0
  13. package/dist/components/dnd-table-v2/dnd-table-utils.js +10 -0
  14. package/dist/components/dnd-table-v2/dnd-table.d.ts +32 -0
  15. package/dist/components/dnd-table-v2/dnd-table.js +381 -0
  16. package/dist/components/dnd-table-v2/dnd-table.type.d.ts +70 -0
  17. package/dist/components/dnd-table-v2/dnd-table.type.js +19 -0
  18. package/dist/components/dnd-table-v2/index.d.ts +12 -0
  19. package/dist/components/dnd-table-v2/index.js +16 -0
  20. package/dist/components/index.js +3 -8
  21. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +1 -2
  22. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +2 -5
  23. package/dist/components/inputs/reactHookForm/booleans/BooleanInput.js +6 -4
  24. package/dist/components/inputs/reactQueryBuilder/OperatorSelector.js +0 -1
  25. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-form.js +72 -53
  26. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-utils.d.ts +1 -0
  27. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-utils.js +8 -5
  28. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.utils.js +5 -5
  29. package/dist/components/parameters/common/contingency-table/columns-definitions.d.ts +4 -3
  30. package/dist/components/parameters/common/contingency-table/columns-definitions.js +23 -15
  31. package/dist/components/parameters/common/contingency-table/contingency-table.d.ts +2 -1
  32. package/dist/components/parameters/common/contingency-table/contingency-table.js +45 -44
  33. package/dist/components/parameters/common/contingency-table/index.js +2 -2
  34. package/dist/components/parameters/common/index.js +2 -2
  35. package/dist/components/parameters/common/parameter-field.js +2 -0
  36. package/dist/components/parameters/common/parameter-table/table-cell.js +1 -1
  37. package/dist/components/parameters/common/parameter-table-field/constants.d.ts +10 -0
  38. package/dist/components/parameters/common/parameter-table-field/constants.js +10 -0
  39. package/dist/components/parameters/common/{parameter-table → parameter-table-field}/index.d.ts +2 -3
  40. package/dist/components/parameters/common/parameter-table-field/index.js +9 -0
  41. package/dist/components/parameters/common/parameter-table-field/parameter-table-field.d.ts +11 -0
  42. package/dist/components/parameters/common/parameter-table-field/parameter-table-field.js +121 -0
  43. package/dist/components/parameters/common/parameters-edition-dialog-props.d.ts +1 -1
  44. package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +2 -0
  45. package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +2 -0
  46. package/dist/components/parameters/dynamic-margin-calculation/loads-variations-parameters.js +7 -6
  47. package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js +2 -0
  48. package/dist/components/parameters/dynamic-security-analysis/contingency-parameters.js +2 -0
  49. package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +2 -0
  50. package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +2 -0
  51. package/dist/components/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js +2 -0
  52. package/dist/components/parameters/dynamic-simulation/dynamic-simulation-inline.js +2 -0
  53. package/dist/components/parameters/dynamic-simulation/dynamic-simulation-parameters-form.js +2 -0
  54. package/dist/components/parameters/dynamic-simulation/mapping/mapping-parameters.js +0 -1
  55. package/dist/components/parameters/dynamic-simulation/use-dynamic-simulation-parameters-form.js +2 -0
  56. package/dist/components/parameters/index.js +3 -8
  57. package/dist/components/parameters/loadflow/load-flow-general-parameters.js +2 -0
  58. package/dist/components/parameters/loadflow/load-flow-parameters-content.js +2 -0
  59. package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +2 -0
  60. package/dist/components/parameters/loadflow/load-flow-parameters-header.js +2 -0
  61. package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +3 -1
  62. package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +2 -0
  63. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +2 -0
  64. package/dist/components/parameters/network-visualizations/map-parameters.js +2 -0
  65. package/dist/components/parameters/network-visualizations/network-visualizations-form.js +2 -0
  66. package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +3 -1
  67. package/dist/components/parameters/network-visualizations/single-line-diagram-parameters.js +2 -0
  68. package/dist/components/parameters/pcc-min/pcc-min-parameters-form.js +2 -0
  69. package/dist/components/parameters/pcc-min/pcc-min-parameters-inline.js +3 -1
  70. package/dist/components/parameters/security-analysis/columns-definitions.js +2 -0
  71. package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.js +3 -1
  72. package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +5 -4
  73. package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +2 -0
  74. package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.js +2 -0
  75. package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +2 -0
  76. package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.d.ts +1 -1
  77. package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +7 -3
  78. package/dist/components/parameters/sensi/columns-definitions.d.ts +7 -180
  79. package/dist/components/parameters/sensi/columns-definitions.js +81 -73
  80. package/dist/components/parameters/sensi/index.js +1 -6
  81. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-dialog.js +3 -1
  82. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +4 -2
  83. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.js +2 -0
  84. package/dist/components/parameters/sensi/sensitivity-parameters-selector.js +52 -51
  85. package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.d.ts +2 -2
  86. package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +41 -61
  87. package/dist/components/parameters/sensi/utils.d.ts +4 -4
  88. package/dist/components/parameters/sensi/utils.js +8 -6
  89. package/dist/components/parameters/short-circuit/short-circuit-general-tab-panel.js +2 -0
  90. package/dist/components/parameters/short-circuit/short-circuit-parameters-content.js +2 -0
  91. package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +2 -0
  92. package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +3 -1
  93. package/dist/components/parameters/short-circuit/short-circuit-parameters-utils.js +2 -0
  94. package/dist/components/parameters/short-circuit/short-circuit-power-electronics-tab-panel.js +2 -0
  95. package/dist/components/parameters/short-circuit/short-circuit-study-area-tab-panel.js +2 -0
  96. package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +2 -0
  97. package/dist/components/parameters/voltage-init/equipment-selection-parameters.js +2 -0
  98. package/dist/components/parameters/voltage-init/general-parameters.js +2 -0
  99. package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +2 -0
  100. package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +3 -1
  101. package/dist/components/parameters/voltage-init/voltage-limits-parameters.js +17 -31
  102. package/dist/hooks/index.d.ts +0 -1
  103. package/dist/hooks/index.js +0 -2
  104. package/dist/index.js +3 -10
  105. package/package.json +1 -1
  106. package/dist/components/parameters/common/parameter-dnd-table-field.d.ts +0 -9
  107. package/dist/components/parameters/common/parameter-dnd-table-field.js +0 -86
  108. package/dist/components/parameters/common/parameter-table/index.js +0 -10
  109. package/dist/hooks/use-create-row-data.d.ts +0 -4
  110. package/dist/hooks/use-create-row-data.js +0 -19
  111. /package/dist/components/parameters/sensi/{sensitivity-Flow-parameters.d.ts → sensitivity-parameters-fields.d.ts} +0 -0
  112. /package/dist/components/parameters/sensi/{sensitivity-Flow-parameters.js → sensitivity-parameters-fields.js} +0 -0
@@ -0,0 +1,381 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { createPortal } from "react-dom";
3
+ import { useState, useCallback, useRef, useMemo } from "react";
4
+ import { useFormContext, useWatch } from "react-hook-form";
5
+ import { Grid, TableContainer, Table, TableHead, TableRow, TableCell, Box, Tooltip, IconButton, TableBody, Checkbox } from "@mui/material";
6
+ import { DragDropContext, Droppable, Draggable } from "@hello-pangea/dnd";
7
+ import { useIntl } from "react-intl";
8
+ import { AddCircle } from "@mui/icons-material";
9
+ import { MAX_ROWS_NUMBER, SELECTED } from "./dnd-table.type.js";
10
+ import { DndTableBottomLeftButtons } from "./dnd-table-bottom-left-buttons.js";
11
+ import { DndTableBottomRightButtons } from "./dnd-table-bottom-right-buttons.js";
12
+ import { DndTableAddRowsDialog } from "./dnd-table-add-rows-dialog.js";
13
+ import "../overflowableText/OverflowableText.js";
14
+ import "../../utils/conversionUtils.js";
15
+ import "../../utils/types/equipmentType.js";
16
+ import { mergeSx } from "../../utils/styles.js";
17
+ import "../../utils/yupConfig.js";
18
+ import "localized-countries";
19
+ import "localized-countries/data/fr";
20
+ import "localized-countries/data/en";
21
+ import "notistack";
22
+ import "../inputs/reactHookForm/provider/CustomFormProvider.js";
23
+ import "yup";
24
+ import { ErrorInput } from "../inputs/reactHookForm/errorManagement/ErrorInput.js";
25
+ import { FieldErrorAlert } from "../inputs/reactHookForm/errorManagement/FieldErrorAlert.js";
26
+ import "../treeViewFinder/TreeViewFinder.js";
27
+ import "../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
28
+ import "../customAGGrid/customAggrid.js";
29
+ import "ag-grid-community";
30
+ import "react-papaparse";
31
+ import "react-csv-downloader";
32
+ import "../inputs/reactHookForm/numbers/RangeInput.js";
33
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
34
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
35
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
36
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
37
+ import "../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
38
+ import "../inputs/reactHookForm/expandableInput/ExpandableInput.js";
39
+ import "@react-querybuilder/material";
40
+ import "../filter/expert/expertFilterConstants.js";
41
+ import "../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
42
+ import "uuid";
43
+ import "../inputs/reactQueryBuilder/PropertyValueEditor.js";
44
+ import "react-querybuilder";
45
+ import { DndTableRow } from "./dnd-table-row.js";
46
+ const styles = {
47
+ columnsStyle: {
48
+ display: "inline-flex",
49
+ justifyContent: "space-between",
50
+ alignItems: "center",
51
+ margin: 1,
52
+ textTransform: "none"
53
+ }
54
+ };
55
+ function MultiCheckbox({
56
+ arrayFormName,
57
+ handleClickCheck,
58
+ handleClickUncheck,
59
+ ...props
60
+ }) {
61
+ const arrayToWatch = useWatch({
62
+ name: arrayFormName
63
+ });
64
+ const allRowSelected = useMemo(
65
+ () => arrayToWatch ? arrayToWatch?.every((row) => row[SELECTED]) : false,
66
+ [arrayToWatch]
67
+ );
68
+ const someRowSelected = useMemo(
69
+ () => arrayToWatch ? arrayToWatch?.some((row) => row[SELECTED]) : false,
70
+ [arrayToWatch]
71
+ );
72
+ return /* @__PURE__ */ jsx(
73
+ Checkbox,
74
+ {
75
+ checked: arrayToWatch?.length > 0 && allRowSelected,
76
+ indeterminate: someRowSelected && !allRowSelected,
77
+ onChange: (event) => {
78
+ if (event.target.checked) {
79
+ handleClickCheck();
80
+ } else {
81
+ handleClickUncheck();
82
+ }
83
+ },
84
+ ...props
85
+ }
86
+ );
87
+ }
88
+ function DndTable(props) {
89
+ const {
90
+ name,
91
+ useFieldArrayOutput,
92
+ columnsDefinition,
93
+ tableHeight,
94
+ allowedToAddRows = () => Promise.resolve(true),
95
+ createRows,
96
+ disabled = false,
97
+ withResetButton = false,
98
+ withAddRowsDialog = true,
99
+ previousValues,
100
+ disableTableCell,
101
+ getPreviousValue,
102
+ isValueModified,
103
+ disableAddingRows = false,
104
+ showMoveArrow = true,
105
+ disableDragAndDrop = false,
106
+ handleUploadButton = void 0,
107
+ uploadButtonMessageId = void 0,
108
+ handleResetButton = void 0,
109
+ resetButtonMessageId = void 0,
110
+ maxRows = MAX_ROWS_NUMBER,
111
+ disabledDeletion,
112
+ multiselect,
113
+ onChange,
114
+ onDelete
115
+ } = props;
116
+ const intl = useIntl();
117
+ const { getValues, setValue, setError, clearErrors } = useFormContext();
118
+ const {
119
+ fields: currentRows,
120
+ // don't use it to access form data ! check doc
121
+ move,
122
+ swap,
123
+ append,
124
+ remove
125
+ } = useFieldArrayOutput;
126
+ const [openAddRowsDialog, setOpenAddRowsDialog] = useState(false);
127
+ const addNewRows = (numberOfRows) => {
128
+ if (currentRows.length + numberOfRows > maxRows) {
129
+ setError(name, {
130
+ type: "custom",
131
+ message: intl.formatMessage(
132
+ {
133
+ id: "MaximumRowNumberError"
134
+ },
135
+ {
136
+ value: maxRows
137
+ }
138
+ )
139
+ });
140
+ return;
141
+ }
142
+ clearErrors(name);
143
+ const rowsToAdd = createRows?.(numberOfRows).map((row) => {
144
+ return { ...row, [SELECTED]: false };
145
+ });
146
+ if (rowsToAdd) {
147
+ append(rowsToAdd);
148
+ }
149
+ };
150
+ const handleAddRowsButton = () => {
151
+ allowedToAddRows().then((isAllowed) => {
152
+ if (isAllowed) {
153
+ if (withAddRowsDialog) {
154
+ setOpenAddRowsDialog(true);
155
+ } else {
156
+ addNewRows(1);
157
+ }
158
+ }
159
+ });
160
+ };
161
+ const handleCloseAddRowsDialog = () => {
162
+ setOpenAddRowsDialog(false);
163
+ };
164
+ const deleteSelectedRows = () => {
165
+ const currentRowsValues = getValues(name);
166
+ const rowsToDelete = [];
167
+ for (let i = 0; i < currentRowsValues.length; i++) {
168
+ if (currentRowsValues[i][SELECTED]) {
169
+ rowsToDelete.push(i);
170
+ }
171
+ }
172
+ const removedRows = rowsToDelete.map((index) => currentRowsValues[index]);
173
+ remove(rowsToDelete);
174
+ onDelete?.(removedRows);
175
+ };
176
+ const handleDeleteRow = useCallback(
177
+ (index) => {
178
+ const removedRow = getValues(name)[index];
179
+ remove(index);
180
+ onDelete?.([removedRow]);
181
+ },
182
+ [onDelete, getValues, name, remove]
183
+ );
184
+ const selectAllRows = () => {
185
+ for (let i = 0; i < currentRows.length; i++) {
186
+ setValue(`${name}[${i}].${SELECTED}`, true);
187
+ }
188
+ };
189
+ const unselectAllRows = () => {
190
+ for (let i = 0; i < currentRows.length; i++) {
191
+ setValue(`${name}[${i}].${SELECTED}`, false);
192
+ }
193
+ };
194
+ const moveUpSelectedRows = () => {
195
+ const currentRowsValues = getValues(name);
196
+ if (currentRowsValues[0][SELECTED]) {
197
+ return;
198
+ }
199
+ for (let i = 1; i < currentRowsValues.length; i++) {
200
+ if (currentRowsValues[i][SELECTED]) {
201
+ swap(i - 1, i);
202
+ }
203
+ }
204
+ };
205
+ const moveDownSelectedRows = () => {
206
+ const currentRowsValues = getValues(name);
207
+ if (currentRowsValues[currentRowsValues.length - 1][SELECTED]) {
208
+ return;
209
+ }
210
+ for (let i = currentRowsValues.length - 2; i >= 0; i--) {
211
+ if (currentRowsValues[i][SELECTED]) {
212
+ swap(i, i + 1);
213
+ }
214
+ }
215
+ };
216
+ const snapshotCellWidthsRef = useRef([]);
217
+ const cellIdxRef = useRef(0);
218
+ const onBeforeDragStart = useCallback((start) => {
219
+ const row = document.querySelector(`[data-rfd-draggable-id="${start.draggableId}"]`);
220
+ if (row) {
221
+ snapshotCellWidthsRef.current = Array.from(row.cells, (cell) => cell.offsetWidth);
222
+ }
223
+ }, []);
224
+ const nextSnapshotCellWidthSx = useCallback((isDragging) => {
225
+ const cellWidths = snapshotCellWidthsRef.current;
226
+ const cellIdx = cellIdxRef.current;
227
+ if (!isDragging || cellWidths[cellIdx] == null) {
228
+ return void 0;
229
+ }
230
+ cellIdxRef.current += 1;
231
+ return { width: cellWidths[cellIdx], boxSizing: "border-box" };
232
+ }, []);
233
+ const onDragEnd = (result) => {
234
+ snapshotCellWidthsRef.current = [];
235
+ if (!result.destination) {
236
+ return;
237
+ }
238
+ move(result.source.index, result.destination.index);
239
+ };
240
+ function renderTableHead() {
241
+ return /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
242
+ !disableDragAndDrop && /* @__PURE__ */ jsx(TableCell, { sx: { width: "3%" } }),
243
+ multiselect && /* @__PURE__ */ jsx(TableCell, { sx: { width: "5%", textAlign: "center" }, children: /* @__PURE__ */ jsx(
244
+ MultiCheckbox,
245
+ {
246
+ arrayFormName: name,
247
+ handleClickCheck: selectAllRows,
248
+ handleClickUncheck: unselectAllRows,
249
+ disabled: disabled || currentRows.length === 0
250
+ }
251
+ ) }),
252
+ columnsDefinition.map((column) => /* @__PURE__ */ jsx(
253
+ TableCell,
254
+ {
255
+ sx: mergeSx(
256
+ { width: column.width, maxWidth: column.maxWidth, textAlign: "left" },
257
+ column.sxHeader
258
+ ),
259
+ children: /* @__PURE__ */ jsxs(Box, { sx: styles.columnsStyle, children: [
260
+ column.label,
261
+ column.extra
262
+ ] })
263
+ },
264
+ column.dataKey
265
+ )),
266
+ !disableAddingRows && !multiselect && /* @__PURE__ */ jsx(TableCell, { sx: { width: "5rem", textAlign: "center" }, children: /* @__PURE__ */ jsx(
267
+ Tooltip,
268
+ {
269
+ title: intl.formatMessage({
270
+ id: "AddRows"
271
+ }),
272
+ children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconButton, { disabled: disableAddingRows, onClick: handleAddRowsButton, children: /* @__PURE__ */ jsx(AddCircle, {}) }) })
273
+ }
274
+ ) })
275
+ ] }) });
276
+ }
277
+ const handleChangeRow = useCallback(
278
+ (index) => {
279
+ onChange?.(getValues(name)[index]);
280
+ },
281
+ [getValues, name, onChange]
282
+ );
283
+ function renderTableBody(providedDroppable) {
284
+ return /* @__PURE__ */ jsxs(TableBody, { children: [
285
+ currentRows.map((row, index) => /* @__PURE__ */ jsx(
286
+ Draggable,
287
+ {
288
+ draggableId: row.id.toString(),
289
+ index,
290
+ isDragDisabled: disableDragAndDrop,
291
+ children: (provided, snapshot) => {
292
+ cellIdxRef.current = 0;
293
+ const tableRow = /* @__PURE__ */ jsx(
294
+ DndTableRow,
295
+ {
296
+ provided,
297
+ snapshot,
298
+ rowId: row.id,
299
+ tableName: name,
300
+ columnsDefinition,
301
+ index,
302
+ disableDragAndDrop,
303
+ disabled,
304
+ previousValues,
305
+ disableTableCell,
306
+ getPreviousValue,
307
+ isValueModified,
308
+ disabledDeletion,
309
+ onChangeRow: handleChangeRow,
310
+ onDeleteRow: handleDeleteRow,
311
+ multiselect,
312
+ nextSnapshotCellWidthSx
313
+ }
314
+ );
315
+ return snapshot.isDragging ? createPortal(tableRow, document.body) : tableRow;
316
+ }
317
+ },
318
+ row.id
319
+ )),
320
+ providedDroppable.placeholder
321
+ ] });
322
+ }
323
+ return /* @__PURE__ */ jsxs(Grid, { item: true, container: true, spacing: 1, children: [
324
+ /* @__PURE__ */ jsxs(Grid, { item: true, container: true, children: [
325
+ /* @__PURE__ */ jsx(DragDropContext, { onBeforeDragStart, onDragEnd, children: /* @__PURE__ */ jsx(Droppable, { droppableId: "tapTable", isDropDisabled: disabled, children: (provided) => /* @__PURE__ */ jsx(
326
+ TableContainer,
327
+ {
328
+ ref: provided.innerRef,
329
+ ...provided.droppableProps,
330
+ sx: {
331
+ height: tableHeight,
332
+ border: "solid 1px rgba(0,0,0,0.1)"
333
+ },
334
+ children: /* @__PURE__ */ jsxs(Table, { stickyHeader: true, size: "small", padding: "none", children: [
335
+ renderTableHead(),
336
+ renderTableBody(provided)
337
+ ] })
338
+ }
339
+ ) }) }),
340
+ /* @__PURE__ */ jsx(ErrorInput, { name, InputField: FieldErrorAlert })
341
+ ] }),
342
+ /* @__PURE__ */ jsxs(Grid, { container: true, item: true, children: [
343
+ handleResetButton && handleUploadButton && resetButtonMessageId && uploadButtonMessageId ? /* @__PURE__ */ jsx(
344
+ DndTableBottomLeftButtons,
345
+ {
346
+ withResetButton,
347
+ disableUploadButton: disableAddingRows,
348
+ disabled,
349
+ handleUploadButton,
350
+ uploadButtonMessageId,
351
+ handleResetButton,
352
+ resetButtonMessageId
353
+ }
354
+ ) : null,
355
+ multiselect && /* @__PURE__ */ jsx(
356
+ DndTableBottomRightButtons,
357
+ {
358
+ arrayFormName: name,
359
+ handleAddButton: handleAddRowsButton,
360
+ handleDeleteButton: deleteSelectedRows,
361
+ handleMoveUpButton: moveUpSelectedRows,
362
+ handleMoveDownButton: moveDownSelectedRows,
363
+ disableAddingRows,
364
+ showMoveArrow,
365
+ disabled
366
+ }
367
+ )
368
+ ] }),
369
+ /* @__PURE__ */ jsx(
370
+ DndTableAddRowsDialog,
371
+ {
372
+ open: openAddRowsDialog,
373
+ handleAddButton: addNewRows,
374
+ onClose: handleCloseAddRowsDialog
375
+ }
376
+ )
377
+ ] });
378
+ }
379
+ export {
380
+ DndTable
381
+ };
@@ -0,0 +1,70 @@
1
+ import { JSX, ReactNode } from 'react';
2
+ import { SxProps, Theme } from '@mui/material';
3
+ import { ElementType } from '../../utils/types/elementType';
4
+ import { EquipmentType } from '../../utils/types/equipmentType';
5
+ import { Option } from '../../utils/types/types';
6
+ export declare const SELECTED = "selected";
7
+ export declare const MAX_ROWS_NUMBER = 100;
8
+ export declare enum DndColumnType {
9
+ TEXT = "TEXT",
10
+ NUMERIC = "NUMERIC",
11
+ AUTOCOMPLETE = "AUTOCOMPLETE",
12
+ SELECT = "SELECT",
13
+ CHIP_ITEMS = "CHIP_ITEMS",
14
+ DIRECTORY_ITEMS = "DIRECTORY_ITEMS",
15
+ SWITCH = "SWITCH",
16
+ DESCRIPTIONS = "DESCRIPTIONS",
17
+ CUSTOM = "CUSTOM"
18
+ }
19
+ export interface ColumnBase {
20
+ dataKey: string;
21
+ maxWidth?: number | string;
22
+ width?: number | string;
23
+ label?: string;
24
+ sxHeader?: SxProps<Theme>;
25
+ extra?: JSX.Element;
26
+ editable?: boolean;
27
+ type: DndColumnType;
28
+ initialValue?: any;
29
+ shouldHandleOnChangeCell?: boolean;
30
+ }
31
+ export interface ColumnText extends ColumnBase {
32
+ type: DndColumnType.TEXT;
33
+ showErrorMsg?: boolean;
34
+ }
35
+ export interface ColumnNumeric extends ColumnBase {
36
+ type: DndColumnType.NUMERIC;
37
+ adornment?: {
38
+ text: string;
39
+ };
40
+ clearable?: boolean;
41
+ textAlign?: 'right' | 'left';
42
+ }
43
+ export interface ColumnAutocomplete extends ColumnBase {
44
+ type: DndColumnType.AUTOCOMPLETE;
45
+ options: Option[];
46
+ }
47
+ export interface ColumnSelect extends ColumnBase {
48
+ type: DndColumnType.SELECT;
49
+ options: Option[];
50
+ }
51
+ export interface ColumnDirectoryItem extends ColumnBase {
52
+ type: DndColumnType.DIRECTORY_ITEMS;
53
+ equipmentTypes: EquipmentType[];
54
+ elementType: ElementType;
55
+ titleId: string;
56
+ }
57
+ export interface ColumnChipsItem extends ColumnBase {
58
+ type: DndColumnType.CHIP_ITEMS;
59
+ }
60
+ export interface ColumnSwitchItem extends ColumnBase {
61
+ type: DndColumnType.SWITCH;
62
+ }
63
+ export interface ColumnDescriptions extends ColumnBase {
64
+ type: DndColumnType.DESCRIPTIONS;
65
+ }
66
+ export interface ColumnCustom extends ColumnBase {
67
+ type: DndColumnType.CUSTOM;
68
+ component: (rowIndex: number) => ReactNode;
69
+ }
70
+ export type DndColumn = ColumnNumeric | ColumnAutocomplete | ColumnSelect | ColumnText | ColumnDirectoryItem | ColumnChipsItem | ColumnSwitchItem | ColumnDescriptions | ColumnCustom;
@@ -0,0 +1,19 @@
1
+ const SELECTED = "selected";
2
+ const MAX_ROWS_NUMBER = 100;
3
+ var DndColumnType = /* @__PURE__ */ ((DndColumnType2) => {
4
+ DndColumnType2["TEXT"] = "TEXT";
5
+ DndColumnType2["NUMERIC"] = "NUMERIC";
6
+ DndColumnType2["AUTOCOMPLETE"] = "AUTOCOMPLETE";
7
+ DndColumnType2["SELECT"] = "SELECT";
8
+ DndColumnType2["CHIP_ITEMS"] = "CHIP_ITEMS";
9
+ DndColumnType2["DIRECTORY_ITEMS"] = "DIRECTORY_ITEMS";
10
+ DndColumnType2["SWITCH"] = "SWITCH";
11
+ DndColumnType2["DESCRIPTIONS"] = "DESCRIPTIONS";
12
+ DndColumnType2["CUSTOM"] = "CUSTOM";
13
+ return DndColumnType2;
14
+ })(DndColumnType || {});
15
+ export {
16
+ DndColumnType,
17
+ MAX_ROWS_NUMBER,
18
+ SELECTED
19
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2025, 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
+ export * from './dnd-table';
8
+ export * from './dnd-table.type';
9
+ export * from './dnd-table-utils';
10
+ export * from './dnd-table-add-rows-dialog';
11
+ export * from './dnd-table-bottom-left-buttons';
12
+ export * from './dnd-table-bottom-right-buttons';
@@ -0,0 +1,16 @@
1
+ import { DndTable } from "./dnd-table.js";
2
+ import { DndColumnType, MAX_ROWS_NUMBER, SELECTED } from "./dnd-table.type.js";
3
+ import { getDefaultRowData } from "./dnd-table-utils.js";
4
+ import { DndTableAddRowsDialog } from "./dnd-table-add-rows-dialog.js";
5
+ import { DndTableBottomLeftButtons } from "./dnd-table-bottom-left-buttons.js";
6
+ import { DndTableBottomRightButtons } from "./dnd-table-bottom-right-buttons.js";
7
+ export {
8
+ DndColumnType,
9
+ DndTable,
10
+ DndTableAddRowsDialog,
11
+ DndTableBottomLeftButtons,
12
+ DndTableBottomRightButtons,
13
+ MAX_ROWS_NUMBER,
14
+ SELECTED,
15
+ getDefaultRowData
16
+ };
@@ -159,7 +159,7 @@ import { LimitReductionsTableForm } from "./parameters/common/limitreductions/li
159
159
  import { LimitReductionTableRow } from "./parameters/common/limitreductions/limit-reduction-table-row.js";
160
160
  import { LimitReductionTableCell } from "./parameters/common/limitreductions/limit-reduction-table-cell.js";
161
161
  import { ContingencyTable } from "./parameters/common/contingency-table/contingency-table.js";
162
- import { COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS, ParamContingencyLists, getContingencyListsInfosFormSchema, toFormValuesContingencyListsInfos } from "./parameters/common/contingency-table/columns-definitions.js";
162
+ import { COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS, getContingencyListsInfosFormSchema, isValidContingencyRow, toFormValuesContingencyListsInfos } from "./parameters/common/contingency-table/columns-definitions.js";
163
163
  import { useTabs } from "./parameters/common/hook/use-tabs.js";
164
164
  import { useParametersForm } from "./parameters/common/hook/use-parameters-form.js";
165
165
  import { CENTER_LABEL, COMPONENT_LIBRARY, DIAGONAL_LABEL, INTL_LINE_FLOW_MODE_OPTIONS, INTL_SUBSTATION_LAYOUT_OPTIONS, LINE_FLOW_MODE, LineFlowMode, MAP_BASE_MAP, MAP_MANUAL_REFRESH, NAD_POSITIONS_GENERATION_MODE, NAD_POSITIONS_GENERATION_MODE_LABEL, NetworkVisualizationTabValues, PARAM_CENTER_LABEL, PARAM_COMPONENT_LIBRARY, PARAM_DIAGONAL_LABEL, PARAM_LINE_FLOW_MODE, PARAM_LINE_FULL_PATH, PARAM_LINE_PARALLEL_PATH, PARAM_MAP_BASEMAP, PARAM_MAP_MANUAL_REFRESH, PARAM_NAD_POSITIONS_GENERATION_MODE, PARAM_SUBSTATION_LAYOUT, SUBSTATION_LAYOUT } from "./parameters/network-visualizations/constants.js";
@@ -182,7 +182,7 @@ import { SecurityAnalysisParametersInline } from "./parameters/security-analysis
182
182
  import { SecurityAnalysisParametersDialog } from "./parameters/security-analysis/security-analysis-parameters-dialog.js";
183
183
  import { SensitivityAnalysisParametersInline } from "./parameters/sensi/sensitivity-analysis-parameters-inline.js";
184
184
  import { SensitivityAnalysisParametersDialog } from "./parameters/sensi/sensitivity-analysis-parameters-dialog.js";
185
- import { COLUMNS_DEFINITIONS_HVDCS, COLUMNS_DEFINITIONS_INJECTIONS, COLUMNS_DEFINITIONS_INJECTIONS_SET, COLUMNS_DEFINITIONS_NODES, COLUMNS_DEFINITIONS_PSTS, EQUIPMENTS_IN_VOLTAGE_REGULATION_TYPES, HVDC_EQUIPMENT_TYPES, INJECTIONS_EQUIPMENT_TYPES, INJECTION_DISTRIBUTION_TYPES, MONITORED_BRANCHES_EQUIPMENT_TYPES, MONITORED_VOLTAGE_LEVELS_EQUIPMENT_TYPES, PSTS_EQUIPMENT_TYPES, SENSITIVITY_TYPES, SensiBranchesTabValues, SensiHvdcs, SensiInjection, SensiInjectionsSet, SensiNodes, SensiPsts, SensiTabValues } from "./parameters/sensi/columns-definitions.js";
185
+ import { COLUMNS_DEFINITIONS_HVDCS, COLUMNS_DEFINITIONS_INJECTIONS, COLUMNS_DEFINITIONS_INJECTIONS_SET, COLUMNS_DEFINITIONS_NODES, COLUMNS_DEFINITIONS_PSTS, EQUIPMENTS_IN_VOLTAGE_REGULATION_TYPES, HVDC_EQUIPMENT_TYPES, INJECTIONS_EQUIPMENT_TYPES, INJECTION_DISTRIBUTION_TYPES, MONITORED_BRANCHES_EQUIPMENT_TYPES, MONITORED_VOLTAGE_LEVELS_EQUIPMENT_TYPES, PSTS_EQUIPMENT_TYPES, SENSITIVITY_TYPES, SensiBranchesTabValues, SensiTabValues } from "./parameters/sensi/columns-definitions.js";
186
186
  import { DynamicSimulationInline } from "./parameters/dynamic-simulation/dynamic-simulation-inline.js";
187
187
  import { CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME, SCENARIO_DURATION } from "./parameters/dynamic-security-analysis/constants.js";
188
188
  import { DynamicSecurityAnalysisInline } from "./parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js";
@@ -496,7 +496,6 @@ export {
496
496
  PRIORITY,
497
497
  PROVIDER,
498
498
  PSTS_EQUIPMENT_TYPES,
499
- ParamContingencyLists,
500
499
  ParameterFloat,
501
500
  ParameterGroup,
502
501
  ParameterLineDirectoryItemsInput,
@@ -562,11 +561,6 @@ export {
562
561
  SelectInput,
563
562
  SelectWithConfirmationInput,
564
563
  SensiBranchesTabValues,
565
- SensiHvdcs,
566
- SensiInjection,
567
- SensiInjectionsSet,
568
- SensiNodes,
569
- SensiPsts,
570
564
  SensiTabValues,
571
565
  SensitivityAnalysisParametersDialog,
572
566
  SensitivityAnalysisParametersInline,
@@ -719,6 +713,7 @@ export {
719
713
  isFloatNumber,
720
714
  isIntegerNumber,
721
715
  isValidComputingType,
716
+ isValidContingencyRow,
722
717
  italicFontTextField,
723
718
  loadCreationDtoToForm,
724
719
  loadCreationEmptyFormData,
@@ -9,7 +9,6 @@ export interface DirectoryItemsInputProps<CP extends OverflowableChipProps = Ove
9
9
  itemFilter?: (val: ElementAttributes) => boolean;
10
10
  titleId?: string;
11
11
  hideErrorMessage?: boolean;
12
- onRowChanged?: (a: boolean) => void;
13
12
  onChange?: (e: any, action?: ArrayAction, element?: any) => void;
14
13
  disable?: boolean;
15
14
  allowMultiSelect?: boolean;
@@ -23,4 +22,4 @@ export declare function DirectoryItemsInput<CP extends OverflowableChipProps = O
23
22
  equipmentTypes, // Mostly used for filters, it allows the user to get elements of specific equipment only
24
23
  itemFilter, // Used to further filter the results displayed according to specific requirement
25
24
  titleId, // title of directory item selector dialogue
26
- hideErrorMessage, onRowChanged, onChange, disable, allowMultiSelect, labelRequiredFromContext, ChipComponent, chipProps, fullHeight, fullWidth, }: Readonly<DirectoryItemsInputProps<CP>>): import("react/jsx-runtime").JSX.Element;
25
+ hideErrorMessage, onChange, disable, allowMultiSelect, labelRequiredFromContext, ChipComponent, chipProps, fullHeight, fullWidth, }: Readonly<DirectoryItemsInputProps<CP>>): import("react/jsx-runtime").JSX.Element;
@@ -63,7 +63,6 @@ function DirectoryItemsInput({
63
63
  titleId,
64
64
  // title of directory item selector dialogue
65
65
  hideErrorMessage,
66
- onRowChanged,
67
66
  onChange,
68
67
  disable = false,
69
68
  allowMultiSelect = true,
@@ -114,14 +113,13 @@ function DirectoryItemsInput({
114
113
  });
115
114
  } else {
116
115
  append(otherElementAttributes);
117
- onRowChanged?.(true);
118
116
  onChange?.(getValues(name), ArrayAction.ADD, otherElementAttributes);
119
117
  }
120
118
  });
121
119
  setDirectoryItemSelectorOpen(false);
122
120
  setSelected([]);
123
121
  },
124
- [append, getValues, snackError, name, onRowChanged, onChange, selected, remove]
122
+ [append, getValues, snackError, name, onChange, selected, remove]
125
123
  );
126
124
  const handleDeleteChip = useCallback(
127
125
  (event, index) => {
@@ -129,10 +127,9 @@ function DirectoryItemsInput({
129
127
  const elemToRemove = getValues(name)[index];
130
128
  remove(index);
131
129
  const newElems = getValues(name);
132
- onRowChanged?.(true);
133
130
  onChange?.(newElems, ArrayAction.REMOVE, elemToRemove);
134
131
  },
135
- [onRowChanged, remove, getValues, name, onChange]
132
+ [remove, getValues, name, onChange]
136
133
  );
137
134
  const openItemsSelector = useCallback(
138
135
  (index) => {
@@ -10,15 +10,17 @@ function BooleanInput({
10
10
  Input,
11
11
  ...props
12
12
  }) {
13
+ const { onChange, ...otherFormProps } = formProps ?? { onChange: void 0 };
13
14
  const {
14
- field: { onChange, value, ref }
15
+ field: { onChange: onChangeRhf, value, ref }
15
16
  } = useController({ name });
16
17
  const intl = useIntl();
17
18
  const handleChangeValue = useCallback(
18
19
  (event) => {
19
- onChange(event.target.checked);
20
+ onChangeRhf(event.target.checked);
21
+ onChange?.(event, event.target.checked);
20
22
  },
21
- [onChange]
23
+ [onChange, onChangeRhf]
22
24
  );
23
25
  const CustomInput = /* @__PURE__ */ jsx(
24
26
  Input,
@@ -27,7 +29,7 @@ function BooleanInput({
27
29
  onChange: handleChangeValue,
28
30
  inputRef: ref,
29
31
  inputProps: { "aria-label": "primary checkbox" },
30
- ...formProps,
32
+ ...otherFormProps,
31
33
  ...props
32
34
  }
33
35
  );
@@ -12,7 +12,6 @@ import "localized-countries/data/fr";
12
12
  import "localized-countries/data/en";
13
13
  import "notistack";
14
14
  import { useSelectAppearance } from "../../../hooks/useSelectAppearance.js";
15
- import "react-hook-form";
16
15
  function OperatorSelector(props) {
17
16
  const { options } = props;
18
17
  const selectAppearance = useSelectAppearance(options?.length || 0);