@gridsuite/commons-ui 0.219.2 → 0.221.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/agGridTable/CustomAgGridTable.d.ts +3 -2
- package/dist/components/composite/agGridTable/CustomAgGridTable.js +122 -127
- package/dist/components/composite/dnd-table/dnd-table.js +1 -1
- package/dist/components/composite/dnd-table/dnd-table.type.d.ts +1 -1
- package/dist/components/composite/dnd-table-v2/dnd-table-row.js +63 -55
- package/dist/components/composite/dnd-table-v2/dnd-table.type.d.ts +1 -1
- package/dist/components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js +0 -1
- package/dist/components/ui/reactHookForm/chip-items-input.d.ts +1 -1
- package/dist/components/ui/reactHookForm/tableInputs/table-numerical-input.d.ts +2 -1
- package/dist/components/ui/reactHookForm/tableInputs/table-numerical-input.js +4 -0
- package/dist/components/ui/reactHookForm/tableInputs/table-text-input.d.ts +2 -2
- package/dist/components/ui/reactHookForm/tableInputs/table-text-input.js +6 -4
- package/dist/configureYup.js +6 -1
- package/dist/features/network-modifications/battery/creation/BatteryCreationForm.js +2 -1
- package/dist/features/network-modifications/battery/creation/batteryCreation.utils.js +2 -1
- package/dist/features/network-modifications/battery/modification/BatteryDialogHeader.js +2 -1
- package/dist/features/network-modifications/battery/modification/BatteryDialogTabsContent.js +2 -1
- package/dist/features/network-modifications/battery/modification/batteryModification.utils.js +2 -1
- package/dist/features/network-modifications/common/measurements/BusbarSectionVoltageMeasurementsForm.js +2 -1
- package/dist/features/network-modifications/common/setpoints/setPoints.utils.js +1 -2
- package/dist/features/network-modifications/equipmentDeletion/EquipmentDeletionForm.js +2 -1
- package/dist/features/network-modifications/load/common/LoadDialogHeader.js +2 -1
- package/dist/features/network-modifications/load/modification/loadModification.utils.js +2 -1
- package/dist/features/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.js +2 -1
- package/dist/features/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.js +2 -1
- package/dist/features/network-modifications/shunt-compensator/modification/ShuntCompensatorModificationForm.js +2 -1
- package/dist/features/network-modifications/shunt-compensator/modification/shuntCompensatorModification.utils.js +2 -1
- package/dist/features/network-modifications/substation/creation/SubstationCreationForm.js +2 -1
- package/dist/features/network-modifications/substation/modification/SubstationModificationForm.js +2 -1
- package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +2 -1
- package/dist/features/network-modifications/voltageLevel/creation/index.js +2 -1
- package/dist/features/network-modifications/voltageLevel/creation/tabs/substationTab/SubstationCreationSection.js +2 -1
- package/dist/features/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +2 -1
- package/dist/features/network-modifications/voltageLevel/index.js +2 -1
- package/dist/features/network-modifications/voltageLevel/modification/VoltageLevelModificationForm.js +2 -1
- package/dist/features/parameters/common/contingency-table/columns-definitions.js +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/loads-variations-parameters.js +2 -2
- package/dist/features/parameters/sensi/utils.js +13 -7
- package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +2 -2
- package/dist/index.js +4 -1
- package/dist/translations/en/networkModificationsEn.d.ts +3 -0
- package/dist/translations/en/networkModificationsEn.js +4 -1
- package/dist/translations/en/parameters.d.ts +1 -0
- package/dist/translations/en/parameters.js +1 -0
- package/dist/translations/fr/networkModificationsFr.d.ts +3 -0
- package/dist/translations/fr/networkModificationsFr.js +4 -1
- package/dist/translations/fr/parameters.d.ts +1 -0
- package/dist/translations/fr/parameters.js +1 -0
- package/dist/utils/constants/index.js +4 -1
- package/dist/utils/constants/translationKeys.d.ts +3 -0
- package/dist/utils/constants/translationKeys.js +6 -0
- package/dist/utils/index.js +4 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { FieldValues, UseFieldArrayReturn } from 'react-hook-form';
|
|
1
2
|
import { CustomAGGridProps } from '../customAGGrid';
|
|
2
|
-
export type CustomAgGridTableProps = Required<Pick<CustomAGGridProps, 'columnDefs'
|
|
3
|
+
export type CustomAgGridTableProps = Required<Pick<CustomAGGridProps, 'columnDefs'>> & Pick<CustomAGGridProps, 'defaultColDef' | 'pagination' | 'paginationPageSize' | 'alwaysShowVerticalScroll' | 'stopEditingWhenCellsLoseFocus' | 'rowSelection' | 'overrideLocales' | 'loading'> & {
|
|
3
4
|
name: string;
|
|
4
5
|
makeDefaultRowData: any;
|
|
5
6
|
csvProps: unknown;
|
|
6
7
|
cssProps: unknown;
|
|
7
8
|
};
|
|
8
|
-
export declare
|
|
9
|
+
export declare const CustomAgGridTable: import('react').ForwardRefExoticComponent<Readonly<CustomAgGridTableProps> & import('react').RefAttributes<UseFieldArrayReturn<FieldValues, string>>>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback, useEffect } from "react";
|
|
2
|
+
import { forwardRef, useState, useImperativeHandle, useCallback, useEffect } from "react";
|
|
3
3
|
import { useFormContext, useFieldArray } from "react-hook-form";
|
|
4
4
|
import { useTheme, Box } from "@mui/material";
|
|
5
5
|
import { BottomRightButtons } from "./BottomRightButtons.js";
|
|
6
6
|
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
7
|
-
import { CustomAGGrid } from "../customAGGrid/customAggrid.js";
|
|
8
7
|
import "../../../utils/conversionUtils.js";
|
|
9
8
|
import "../../../utils/types/equipmentType.js";
|
|
10
9
|
import "@mui/icons-material";
|
|
10
|
+
import { CustomAGGrid } from "../customAGGrid/customAggrid.js";
|
|
11
11
|
import "react-intl";
|
|
12
12
|
const style = (customProps) => ({
|
|
13
13
|
grid: (theme) => ({
|
|
@@ -64,137 +64,132 @@ const style = (customProps) => ({
|
|
|
64
64
|
...customProps
|
|
65
65
|
})
|
|
66
66
|
});
|
|
67
|
-
|
|
68
|
-
name,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const [newRowAdded, setNewRowAdded] = useState(false);
|
|
79
|
-
const [isSortApplied, setIsSortApplied] = useState(false);
|
|
80
|
-
const { control, getValues, watch } = useFormContext();
|
|
81
|
-
const useFieldArrayOutput = useFieldArray({
|
|
82
|
-
control,
|
|
83
|
-
name
|
|
84
|
-
});
|
|
85
|
-
const { append, remove, update, swap, move } = useFieldArrayOutput;
|
|
86
|
-
const rowData = watch(name);
|
|
87
|
-
const isFirstSelected = Boolean(
|
|
88
|
-
rowData?.length && gridApi?.api.getRowNode(rowData[0][FieldConstants.AG_GRID_ROW_UUID])?.isSelected()
|
|
89
|
-
);
|
|
90
|
-
const isLastSelected = Boolean(
|
|
91
|
-
rowData?.length && gridApi?.api.getRowNode(rowData[rowData.length - 1][FieldConstants.AG_GRID_ROW_UUID])?.isSelected()
|
|
92
|
-
);
|
|
93
|
-
const noRowSelected = selectedRows.length === 0;
|
|
94
|
-
const getIndex = useCallback(
|
|
95
|
-
(val) => {
|
|
96
|
-
return getValues(name).findIndex(
|
|
97
|
-
(row) => row[FieldConstants.AG_GRID_ROW_UUID] === val[FieldConstants.AG_GRID_ROW_UUID]
|
|
98
|
-
);
|
|
99
|
-
},
|
|
100
|
-
[getValues, name]
|
|
101
|
-
);
|
|
102
|
-
const handleMoveRowUp = () => {
|
|
103
|
-
selectedRows.map((row) => getIndex(row)).sort((n1, n2) => n1 - n2).forEach((idx) => {
|
|
104
|
-
swap(idx, idx - 1);
|
|
67
|
+
const CustomAgGridTable = forwardRef(
|
|
68
|
+
function CustomAgGridTable2({ name, makeDefaultRowData, csvProps, cssProps, rowSelection, stopEditingWhenCellsLoseFocus = true, ...props }, ref) {
|
|
69
|
+
const theme = useTheme();
|
|
70
|
+
const [gridApi, setGridApi] = useState(null);
|
|
71
|
+
const [selectedRows, setSelectedRows] = useState([]);
|
|
72
|
+
const [newRowAdded, setNewRowAdded] = useState(false);
|
|
73
|
+
const [isSortApplied, setIsSortApplied] = useState(false);
|
|
74
|
+
const { control, getValues, watch } = useFormContext();
|
|
75
|
+
const useFieldArrayOutput = useFieldArray({
|
|
76
|
+
control,
|
|
77
|
+
name
|
|
105
78
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
79
|
+
const { append, remove, update, swap, move } = useFieldArrayOutput;
|
|
80
|
+
useImperativeHandle(ref, () => useFieldArrayOutput, [useFieldArrayOutput]);
|
|
81
|
+
const rowData = watch(name);
|
|
82
|
+
const isFirstSelected = Boolean(
|
|
83
|
+
rowData?.length && gridApi?.api.getRowNode(rowData[0][FieldConstants.AG_GRID_ROW_UUID])?.isSelected()
|
|
84
|
+
);
|
|
85
|
+
const isLastSelected = Boolean(
|
|
86
|
+
rowData?.length && gridApi?.api.getRowNode(rowData[rowData.length - 1][FieldConstants.AG_GRID_ROW_UUID])?.isSelected()
|
|
87
|
+
);
|
|
88
|
+
const noRowSelected = selectedRows.length === 0;
|
|
89
|
+
const getIndex = useCallback(
|
|
90
|
+
(val) => {
|
|
91
|
+
return getValues(name).findIndex(
|
|
92
|
+
(row) => row[FieldConstants.AG_GRID_ROW_UUID] === val[FieldConstants.AG_GRID_ROW_UUID]
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
[getValues, name]
|
|
96
|
+
);
|
|
97
|
+
const handleMoveRowUp = () => {
|
|
98
|
+
selectedRows.map((row) => getIndex(row)).sort((n1, n2) => n1 - n2).forEach((idx) => {
|
|
99
|
+
swap(idx, idx - 1);
|
|
119
100
|
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
gridApi.api.refreshCells({
|
|
125
|
-
force: true
|
|
101
|
+
};
|
|
102
|
+
const handleMoveRowDown = () => {
|
|
103
|
+
selectedRows.map((row) => getIndex(row)).sort((n1, n2) => n1 - n2).reverse().forEach((idx) => {
|
|
104
|
+
swap(idx, idx + 1);
|
|
126
105
|
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const onRowDataUpdated = () => {
|
|
137
|
-
setNewRowAdded(false);
|
|
138
|
-
if (gridApi?.api) {
|
|
139
|
-
const lastIndex = rowData.length - 1;
|
|
140
|
-
gridApi.api.paginationGoToLastPage();
|
|
141
|
-
gridApi.api.ensureIndexVisible(lastIndex, "bottom");
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
const onCellEditingStopped = useCallback(
|
|
145
|
-
(event) => {
|
|
146
|
-
const rowIndex = getIndex(event.data);
|
|
147
|
-
if (rowIndex === -1) {
|
|
148
|
-
return;
|
|
106
|
+
};
|
|
107
|
+
const handleDeleteRows = () => {
|
|
108
|
+
if (selectedRows.length === rowData.length) {
|
|
109
|
+
remove();
|
|
110
|
+
} else {
|
|
111
|
+
selectedRows.forEach((val) => {
|
|
112
|
+
const idx = getIndex(val);
|
|
113
|
+
remove(idx);
|
|
114
|
+
});
|
|
149
115
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
setIsSortApplied(isAnycolumnhasSort);
|
|
157
|
-
}, []);
|
|
158
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
159
|
-
/* @__PURE__ */ jsx(Box, { className: theme.aggrid.theme, sx: style(cssProps).grid, children: /* @__PURE__ */ jsx(
|
|
160
|
-
CustomAGGrid,
|
|
161
|
-
{
|
|
162
|
-
rowData,
|
|
163
|
-
onGridReady,
|
|
164
|
-
cacheOverflowSize: 10,
|
|
165
|
-
rowSelection: rowSelection ?? "multiple",
|
|
166
|
-
rowDragEntireRow: true,
|
|
167
|
-
rowDragManaged: true,
|
|
168
|
-
onRowDragEnd: (e) => move(getIndex(e.node.data), e.overIndex),
|
|
169
|
-
detailRowAutoHeight: true,
|
|
170
|
-
onSelectionChanged: () => {
|
|
171
|
-
setSelectedRows(gridApi.api.getSelectedRows());
|
|
172
|
-
},
|
|
173
|
-
onRowDataUpdated: newRowAdded ? onRowDataUpdated : void 0,
|
|
174
|
-
onCellEditingStopped,
|
|
175
|
-
onSortChanged,
|
|
176
|
-
getRowId: (row) => row.data[FieldConstants.AG_GRID_ROW_UUID],
|
|
177
|
-
theme: "legacy",
|
|
178
|
-
...props
|
|
116
|
+
};
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (gridApi) {
|
|
119
|
+
gridApi.api.refreshCells({
|
|
120
|
+
force: true
|
|
121
|
+
});
|
|
179
122
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
123
|
+
}, [gridApi, rowData]);
|
|
124
|
+
const handleAddRow = () => {
|
|
125
|
+
append(makeDefaultRowData());
|
|
126
|
+
setNewRowAdded(true);
|
|
127
|
+
};
|
|
128
|
+
const onGridReady = (params) => {
|
|
129
|
+
setGridApi(params);
|
|
130
|
+
};
|
|
131
|
+
const onRowDataUpdated = () => {
|
|
132
|
+
setNewRowAdded(false);
|
|
133
|
+
if (gridApi?.api) {
|
|
134
|
+
const lastIndex = rowData.length - 1;
|
|
135
|
+
gridApi.api.paginationGoToLastPage();
|
|
136
|
+
gridApi.api.ensureIndexVisible(lastIndex, "bottom");
|
|
194
137
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
138
|
+
};
|
|
139
|
+
const onCellEditingStopped = useCallback(
|
|
140
|
+
(event) => {
|
|
141
|
+
const rowIndex = getIndex(event.data);
|
|
142
|
+
if (rowIndex === -1) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
update(rowIndex, event.data);
|
|
146
|
+
},
|
|
147
|
+
[getIndex, update]
|
|
148
|
+
);
|
|
149
|
+
const onSortChanged = useCallback((event) => {
|
|
150
|
+
const isAnycolumnhasSort = event.api.getColumnState().some((col) => col.sort);
|
|
151
|
+
setIsSortApplied(isAnycolumnhasSort);
|
|
152
|
+
}, []);
|
|
153
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
154
|
+
/* @__PURE__ */ jsx(Box, { className: theme.aggrid.theme, sx: style(cssProps).grid, children: /* @__PURE__ */ jsx(
|
|
155
|
+
CustomAGGrid,
|
|
156
|
+
{
|
|
157
|
+
rowData,
|
|
158
|
+
onGridReady,
|
|
159
|
+
cacheOverflowSize: 10,
|
|
160
|
+
rowSelection: rowSelection ?? "multiple",
|
|
161
|
+
onRowDragMove: (e) => move(getIndex(e.node.data), e.overIndex),
|
|
162
|
+
detailRowAutoHeight: true,
|
|
163
|
+
onSelectionChanged: () => {
|
|
164
|
+
setSelectedRows(gridApi.api.getSelectedRows());
|
|
165
|
+
},
|
|
166
|
+
onRowDataUpdated: newRowAdded ? onRowDataUpdated : void 0,
|
|
167
|
+
onCellEditingStopped,
|
|
168
|
+
onSortChanged,
|
|
169
|
+
getRowId: (row) => row.data[FieldConstants.AG_GRID_ROW_UUID],
|
|
170
|
+
stopEditingWhenCellsLoseFocus,
|
|
171
|
+
theme: "legacy",
|
|
172
|
+
...props
|
|
173
|
+
}
|
|
174
|
+
) }),
|
|
175
|
+
/* @__PURE__ */ jsx(
|
|
176
|
+
BottomRightButtons,
|
|
177
|
+
{
|
|
178
|
+
name,
|
|
179
|
+
handleAddRow,
|
|
180
|
+
handleDeleteRows,
|
|
181
|
+
handleMoveRowDown,
|
|
182
|
+
handleMoveRowUp,
|
|
183
|
+
disableUp: noRowSelected || isFirstSelected || isSortApplied,
|
|
184
|
+
disableDown: noRowSelected || isLastSelected || isSortApplied,
|
|
185
|
+
disableDelete: noRowSelected,
|
|
186
|
+
csvProps,
|
|
187
|
+
useFieldArrayOutput
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] });
|
|
191
|
+
}
|
|
192
|
+
);
|
|
198
193
|
export {
|
|
199
194
|
CustomAgGridTable
|
|
200
195
|
};
|
|
@@ -118,7 +118,7 @@ function EditableTableCell({
|
|
|
118
118
|
{
|
|
119
119
|
...props,
|
|
120
120
|
name: `${arrayFormName}[${rowIndex}].${column.dataKey}`,
|
|
121
|
-
|
|
121
|
+
hideErrorMessage: column.hideErrorMessage
|
|
122
122
|
}
|
|
123
123
|
),
|
|
124
124
|
column.type === DndColumnType.AUTOCOMPLETE && /* @__PURE__ */ jsx(
|
|
@@ -20,10 +20,10 @@ export interface ColumnBase {
|
|
|
20
20
|
editable?: boolean;
|
|
21
21
|
type: DndColumnType;
|
|
22
22
|
initialValue?: any;
|
|
23
|
+
hideErrorMessage?: boolean;
|
|
23
24
|
}
|
|
24
25
|
export interface ColumnText extends ColumnBase {
|
|
25
26
|
type: DndColumnType.TEXT;
|
|
26
|
-
showErrorMsg?: boolean;
|
|
27
27
|
}
|
|
28
28
|
export interface ColumnNumeric extends ColumnBase {
|
|
29
29
|
type: DndColumnType.NUMERIC;
|
|
@@ -54,61 +54,69 @@ function EditableTableCell({
|
|
|
54
54
|
onChangeCell,
|
|
55
55
|
...props
|
|
56
56
|
}) {
|
|
57
|
-
return /* @__PURE__ */ jsxs(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
57
|
+
return /* @__PURE__ */ jsxs(
|
|
58
|
+
TableCell,
|
|
59
|
+
{
|
|
60
|
+
sx: mergeSx({ padding: 0.5, maxWidth: column.maxWidth, verticalAlign: "top" }, width),
|
|
61
|
+
children: [
|
|
62
|
+
column.type === DndColumnType.NUMERIC && /* @__PURE__ */ jsx(
|
|
63
|
+
TableNumericalInput,
|
|
64
|
+
{
|
|
65
|
+
...props,
|
|
66
|
+
name,
|
|
67
|
+
previousValue,
|
|
68
|
+
valueModified,
|
|
69
|
+
adornment: column?.adornment,
|
|
70
|
+
isClearable: column?.clearable,
|
|
71
|
+
style: {
|
|
72
|
+
textAlign: column?.textAlign
|
|
73
|
+
},
|
|
74
|
+
hideErrorMessage: column.hideErrorMessage
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
column.type === DndColumnType.TEXT && /* @__PURE__ */ jsx(TableTextInput, { ...props, name, hideErrorMessage: column.hideErrorMessage }),
|
|
78
|
+
column.type === DndColumnType.AUTOCOMPLETE && /* @__PURE__ */ jsx(
|
|
79
|
+
AutocompleteInput,
|
|
80
|
+
{
|
|
81
|
+
forcePopupIcon: true,
|
|
82
|
+
freeSolo: true,
|
|
83
|
+
name,
|
|
84
|
+
options: column.options,
|
|
85
|
+
inputTransform: (value) => value ?? "",
|
|
86
|
+
outputTransform: (value) => value,
|
|
87
|
+
size: "small"
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
column.type === DndColumnType.SELECT && /* @__PURE__ */ jsx(SelectInput, { options: column.options, name, size: "small", fullWidth: true, disableClearable: true }),
|
|
91
|
+
column.type === DndColumnType.DIRECTORY_ITEMS && /* @__PURE__ */ jsx(
|
|
92
|
+
DirectoryItemsInput,
|
|
93
|
+
{
|
|
94
|
+
name,
|
|
95
|
+
equipmentTypes: column.equipmentTypes,
|
|
96
|
+
elementType: column.elementType,
|
|
97
|
+
titleId: column.titleId,
|
|
98
|
+
hideErrorMessage: column.hideErrorMessage,
|
|
99
|
+
label: void 0,
|
|
100
|
+
onChange: (value) => column.shouldHandleOnChangeCell && onChangeCell?.(value)
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
column.type === DndColumnType.CHIP_ITEMS && /* @__PURE__ */ jsx(ChipItemsInput, { name, hideErrorMessage: column.hideErrorMessage }),
|
|
104
|
+
column.type === DndColumnType.SWITCH && /* @__PURE__ */ jsx(
|
|
105
|
+
SwitchInput,
|
|
106
|
+
{
|
|
107
|
+
name,
|
|
108
|
+
formProps: {
|
|
109
|
+
// callback to propagate a change to parent via column config
|
|
110
|
+
onChange: (_, checked) => column.shouldHandleOnChangeCell && onChangeCell?.(checked)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
column.type === DndColumnType.DESCRIPTIONS && /* @__PURE__ */ jsx(DescriptionInput, { name }),
|
|
115
|
+
column.type === DndColumnType.CUSTOM && column.component(rowIndex)
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
column.dataKey
|
|
119
|
+
);
|
|
112
120
|
}
|
|
113
121
|
function DndTableRow({
|
|
114
122
|
rowId,
|
|
@@ -27,10 +27,10 @@ export interface ColumnBase {
|
|
|
27
27
|
type: DndColumnType;
|
|
28
28
|
initialValue?: any;
|
|
29
29
|
shouldHandleOnChangeCell?: boolean;
|
|
30
|
+
hideErrorMessage?: boolean;
|
|
30
31
|
}
|
|
31
32
|
export interface ColumnText extends ColumnBase {
|
|
32
33
|
type: DndColumnType.TEXT;
|
|
33
|
-
showErrorMsg?: boolean;
|
|
34
34
|
}
|
|
35
35
|
export interface ColumnNumeric extends ColumnBase {
|
|
36
36
|
type: DndColumnType.NUMERIC;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
interface ChipItemsInputProps {
|
|
8
8
|
label?: string;
|
|
9
9
|
name: string;
|
|
10
|
-
hideErrorMessage
|
|
10
|
+
hideErrorMessage?: boolean;
|
|
11
11
|
}
|
|
12
12
|
export declare function ChipItemsInput({ label, name, hideErrorMessage }: Readonly<ChipItemsInputProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -8,5 +8,6 @@ export interface TableNumericalInputProps extends StandardTextFieldProps {
|
|
|
8
8
|
text: string;
|
|
9
9
|
};
|
|
10
10
|
isClearable?: boolean;
|
|
11
|
+
hideErrorMessage?: boolean;
|
|
11
12
|
}
|
|
12
|
-
export declare function TableNumericalInput({ name, style, inputProps, previousValue, valueModified, adornment, isClearable, ...props }: Readonly<TableNumericalInputProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function TableNumericalInput({ name, style, inputProps, previousValue, valueModified, adornment, isClearable, hideErrorMessage, ...props }: Readonly<TableNumericalInputProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,6 +6,8 @@ import { useMemo } from "react";
|
|
|
6
6
|
import "../../../../utils/conversionUtils.js";
|
|
7
7
|
import "../../../../utils/types/equipmentType.js";
|
|
8
8
|
import { validateValueIsANumber } from "../../../../utils/validation-functions.js";
|
|
9
|
+
import "react-intl";
|
|
10
|
+
import { genHelperError } from "../utils/functions.js";
|
|
9
11
|
function TableNumericalInput({
|
|
10
12
|
name,
|
|
11
13
|
style,
|
|
@@ -14,6 +16,7 @@ function TableNumericalInput({
|
|
|
14
16
|
valueModified,
|
|
15
17
|
adornment,
|
|
16
18
|
isClearable = true,
|
|
19
|
+
hideErrorMessage,
|
|
17
20
|
...props
|
|
18
21
|
}) {
|
|
19
22
|
const { trigger } = useFormContext();
|
|
@@ -100,6 +103,7 @@ function TableNumericalInput({
|
|
|
100
103
|
...inputProps
|
|
101
104
|
}
|
|
102
105
|
},
|
|
106
|
+
...hideErrorMessage ? {} : genHelperError(error?.message),
|
|
103
107
|
...props
|
|
104
108
|
}
|
|
105
109
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InputBaseComponentProps } from '@mui/material';
|
|
2
2
|
interface TableTextInputProps {
|
|
3
3
|
name: string;
|
|
4
|
-
|
|
4
|
+
hideErrorMessage?: boolean;
|
|
5
5
|
inputProps?: InputBaseComponentProps;
|
|
6
6
|
}
|
|
7
|
-
export declare function TableTextInput({ name,
|
|
7
|
+
export declare function TableTextInput({ name, hideErrorMessage, inputProps, ...props }: Readonly<TableTextInputProps>): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { TextField } from "@mui/material";
|
|
3
3
|
import { useController } from "react-hook-form";
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import "react-intl";
|
|
5
|
+
import "react";
|
|
6
|
+
import "@mui/icons-material";
|
|
7
|
+
import { genHelperError } from "../utils/functions.js";
|
|
8
|
+
function TableTextInput({ name, hideErrorMessage, inputProps, ...props }) {
|
|
6
9
|
const {
|
|
7
10
|
field: { onChange, value, ref },
|
|
8
11
|
fieldState: { error }
|
|
9
12
|
} = useController({ name });
|
|
10
|
-
const intl = useIntl();
|
|
11
13
|
const outputTransform = (str) => {
|
|
12
14
|
return str?.trim() === "" ? "" : str;
|
|
13
15
|
};
|
|
@@ -20,7 +22,6 @@ function TableTextInput({ name, showErrorMsg, inputProps, ...props }) {
|
|
|
20
22
|
value,
|
|
21
23
|
onChange: handleInputChange,
|
|
22
24
|
error: !!error?.message,
|
|
23
|
-
helperText: showErrorMsg && (error?.message ? intl.formatMessage({ id: error.message }) : ""),
|
|
24
25
|
size: "small",
|
|
25
26
|
fullWidth: true,
|
|
26
27
|
inputRef: ref,
|
|
@@ -34,6 +35,7 @@ function TableTextInput({ name, showErrorMsg, inputProps, ...props }) {
|
|
|
34
35
|
...inputProps
|
|
35
36
|
}
|
|
36
37
|
},
|
|
38
|
+
...hideErrorMessage ? {} : genHelperError(error?.message),
|
|
37
39
|
...props
|
|
38
40
|
}
|
|
39
41
|
);
|
package/dist/configureYup.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setLocale } from "yup";
|
|
2
|
-
import { YUP_REQUIRED, YUP_NOT_TYPE_NUMBER, YUP_NOT_TYPE_DEFAULT } from "./utils/constants/translationKeys.js";
|
|
2
|
+
import { YUP_POSITIVE, YUP_DEFAULT, YUP_NOT_NULL, YUP_REQUIRED, YUP_NOT_TYPE_NUMBER, YUP_NOT_TYPE_DEFAULT } from "./utils/constants/translationKeys.js";
|
|
3
3
|
import "./utils/conversionUtils.js";
|
|
4
4
|
import "./utils/types/equipmentType.js";
|
|
5
5
|
import "react/jsx-runtime";
|
|
@@ -8,12 +8,17 @@ const configureYup = () => {
|
|
|
8
8
|
setLocale({
|
|
9
9
|
mixed: {
|
|
10
10
|
required: YUP_REQUIRED,
|
|
11
|
+
notNull: YUP_NOT_NULL,
|
|
12
|
+
default: YUP_DEFAULT,
|
|
11
13
|
notType: ({ type }) => {
|
|
12
14
|
if (type === "number") {
|
|
13
15
|
return YUP_NOT_TYPE_NUMBER;
|
|
14
16
|
}
|
|
15
17
|
return YUP_NOT_TYPE_DEFAULT;
|
|
16
18
|
}
|
|
19
|
+
},
|
|
20
|
+
number: {
|
|
21
|
+
positive: YUP_POSITIVE
|
|
17
22
|
}
|
|
18
23
|
});
|
|
19
24
|
};
|
|
@@ -54,10 +54,11 @@ import "@react-querybuilder/material";
|
|
|
54
54
|
import "../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
55
55
|
import "../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
56
56
|
import "../../../../components/composite/agGridTable/BottomRightButtons.js";
|
|
57
|
-
import "../../../../components/composite/
|
|
57
|
+
import "../../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
58
58
|
import "ag-grid-community";
|
|
59
59
|
import "react-papaparse";
|
|
60
60
|
import "react-csv-downloader";
|
|
61
|
+
import "../../../../components/composite/customAGGrid/customAggrid.js";
|
|
61
62
|
import { SetPointsForm } from "../../common/setpoints/SetPointsForm.js";
|
|
62
63
|
import { ConnectivityForm } from "../../common/connectivity/ConnectivityForm.js";
|
|
63
64
|
import { ActivePowerControlForm } from "../../common/activePowerControl/ActivePowerControlForm.js";
|
|
@@ -50,10 +50,11 @@ import "@react-querybuilder/material";
|
|
|
50
50
|
import "../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
51
51
|
import "../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
52
52
|
import "../../../../components/composite/agGridTable/BottomRightButtons.js";
|
|
53
|
-
import "../../../../components/composite/
|
|
53
|
+
import "../../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
54
54
|
import "ag-grid-community";
|
|
55
55
|
import "react-papaparse";
|
|
56
56
|
import "react-csv-downloader";
|
|
57
|
+
import "../../../../components/composite/customAGGrid/customAggrid.js";
|
|
57
58
|
import { getSetPointsSchema, getSetPointsEmptyFormData } from "../../common/setpoints/setPoints.utils.js";
|
|
58
59
|
import { getActivePowerControlSchema, getActivePowerControlEmptyFormData } from "../../common/activePowerControl/activePowerControlForm.utils.js";
|
|
59
60
|
import { getShortCircuitFormSchema, getShortCircuitEmptyFormData, getShortCircuitFormData } from "../../common/shortCircuit/shortCircuitForm.utils.js";
|
|
@@ -49,10 +49,11 @@ import "@react-querybuilder/material";
|
|
|
49
49
|
import "../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
50
50
|
import "../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
51
51
|
import "../../../../components/composite/agGridTable/BottomRightButtons.js";
|
|
52
|
-
import "../../../../components/composite/
|
|
52
|
+
import "../../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
53
53
|
import "ag-grid-community";
|
|
54
54
|
import "react-papaparse";
|
|
55
55
|
import "react-csv-downloader";
|
|
56
|
+
import "../../../../components/composite/customAGGrid/customAggrid.js";
|
|
56
57
|
import "../../common/regulatingTerminal/RegulatingTerminalForm.js";
|
|
57
58
|
function BatteryDialogHeader({ batteryToModify, equipmentId }) {
|
|
58
59
|
return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
package/dist/features/network-modifications/battery/modification/BatteryDialogTabsContent.js
CHANGED
|
@@ -54,10 +54,11 @@ import "@react-querybuilder/material";
|
|
|
54
54
|
import "../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
55
55
|
import "../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
56
56
|
import "../../../../components/composite/agGridTable/BottomRightButtons.js";
|
|
57
|
-
import "../../../../components/composite/
|
|
57
|
+
import "../../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
58
58
|
import "ag-grid-community";
|
|
59
59
|
import "react-papaparse";
|
|
60
60
|
import "react-csv-downloader";
|
|
61
|
+
import "../../../../components/composite/customAGGrid/customAggrid.js";
|
|
61
62
|
import { ConnectivityForm } from "../../common/connectivity/ConnectivityForm.js";
|
|
62
63
|
import { ActivePowerControlForm } from "../../common/activePowerControl/ActivePowerControlForm.js";
|
|
63
64
|
import { ShortCircuitForm } from "../../common/shortCircuit/ShortCircuitForm.js";
|
package/dist/features/network-modifications/battery/modification/batteryModification.utils.js
CHANGED
|
@@ -50,10 +50,11 @@ import "@react-querybuilder/material";
|
|
|
50
50
|
import "../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
51
51
|
import "../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
52
52
|
import "../../../../components/composite/agGridTable/BottomRightButtons.js";
|
|
53
|
-
import "../../../../components/composite/
|
|
53
|
+
import "../../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
54
54
|
import "ag-grid-community";
|
|
55
55
|
import "react-papaparse";
|
|
56
56
|
import "react-csv-downloader";
|
|
57
|
+
import "../../../../components/composite/customAGGrid/customAggrid.js";
|
|
57
58
|
import { getSetPointsSchema, getSetPointsEmptyFormData } from "../../common/setpoints/setPoints.utils.js";
|
|
58
59
|
import { getConnectivityWithPositionSchema, getConnectivityWithPositionEmptyFormDataProps, getConnectivityFormDataProps } from "../../common/connectivity/connectivityForm.utils.js";
|
|
59
60
|
import { getActivePowerControlSchema, getActivePowerControlEmptyFormData } from "../../common/activePowerControl/activePowerControlForm.utils.js";
|