@gridsuite/commons-ui 0.193.0 → 0.194.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/directoryItemSelector/DirectoryItemSelector.js +0 -1
- package/dist/components/dnd-table-v2/deletable-table-row.d.ts +7 -0
- package/dist/components/dnd-table-v2/deletable-table-row.js +37 -0
- package/dist/components/dnd-table-v2/dnd-table-add-rows-dialog.d.ts +13 -0
- package/dist/components/dnd-table-v2/dnd-table-add-rows-dialog.js +75 -0
- package/dist/components/dnd-table-v2/dnd-table-bottom-left-buttons.d.ts +17 -0
- package/dist/components/dnd-table-v2/dnd-table-bottom-left-buttons.js +48 -0
- package/dist/components/dnd-table-v2/dnd-table-bottom-right-buttons.d.ts +17 -0
- package/dist/components/dnd-table-v2/dnd-table-bottom-right-buttons.js +103 -0
- package/dist/components/dnd-table-v2/dnd-table-row.d.ts +23 -0
- package/dist/components/dnd-table-v2/dnd-table-row.js +183 -0
- package/dist/components/dnd-table-v2/dnd-table-utils.d.ts +2 -0
- package/dist/components/dnd-table-v2/dnd-table-utils.js +10 -0
- package/dist/components/dnd-table-v2/dnd-table.d.ts +32 -0
- package/dist/components/dnd-table-v2/dnd-table.js +381 -0
- package/dist/components/dnd-table-v2/dnd-table.type.d.ts +70 -0
- package/dist/components/dnd-table-v2/dnd-table.type.js +19 -0
- package/dist/components/dnd-table-v2/index.d.ts +12 -0
- package/dist/components/dnd-table-v2/index.js +16 -0
- package/dist/components/index.js +3 -8
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +1 -2
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +2 -5
- package/dist/components/inputs/reactHookForm/booleans/BooleanInput.js +6 -4
- package/dist/components/inputs/reactQueryBuilder/OperatorSelector.js +0 -1
- package/dist/components/parameters/common/contingency-table/columns-definitions.d.ts +4 -3
- package/dist/components/parameters/common/contingency-table/columns-definitions.js +23 -15
- package/dist/components/parameters/common/contingency-table/contingency-table.d.ts +2 -1
- package/dist/components/parameters/common/contingency-table/contingency-table.js +45 -44
- package/dist/components/parameters/common/contingency-table/index.js +2 -2
- package/dist/components/parameters/common/index.js +2 -2
- package/dist/components/parameters/common/parameter-field.js +2 -0
- package/dist/components/parameters/common/parameter-table/table-cell.js +1 -1
- package/dist/components/parameters/common/parameter-table-field/constants.d.ts +10 -0
- package/dist/components/parameters/common/parameter-table-field/constants.js +10 -0
- package/dist/components/parameters/common/{parameter-table → parameter-table-field}/index.d.ts +2 -3
- package/dist/components/parameters/common/parameter-table-field/index.js +9 -0
- package/dist/components/parameters/common/parameter-table-field/parameter-table-field.d.ts +11 -0
- package/dist/components/parameters/common/parameter-table-field/parameter-table-field.js +121 -0
- package/dist/components/parameters/common/parameters-edition-dialog-props.d.ts +1 -1
- package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +2 -0
- package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +2 -0
- package/dist/components/parameters/dynamic-margin-calculation/loads-variations-parameters.js +9 -7
- package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js +2 -0
- package/dist/components/parameters/dynamic-security-analysis/contingency-parameters.js +2 -0
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +2 -0
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +2 -0
- package/dist/components/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js +2 -0
- package/dist/components/parameters/dynamic-simulation/dynamic-simulation-inline.js +2 -0
- package/dist/components/parameters/dynamic-simulation/dynamic-simulation-parameters-form.js +2 -0
- package/dist/components/parameters/dynamic-simulation/mapping/mapping-parameters.js +0 -1
- package/dist/components/parameters/dynamic-simulation/use-dynamic-simulation-parameters-form.js +2 -0
- package/dist/components/parameters/index.js +3 -8
- package/dist/components/parameters/loadflow/load-flow-general-parameters.js +2 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-content.js +2 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +2 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-header.js +2 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +3 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +2 -0
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +2 -0
- package/dist/components/parameters/network-visualizations/map-parameters.js +2 -0
- package/dist/components/parameters/network-visualizations/network-visualizations-form.js +2 -0
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +3 -1
- package/dist/components/parameters/network-visualizations/single-line-diagram-parameters.js +2 -0
- package/dist/components/parameters/pcc-min/pcc-min-parameters-form.js +2 -0
- package/dist/components/parameters/pcc-min/pcc-min-parameters-inline.js +3 -1
- package/dist/components/parameters/security-analysis/columns-definitions.js +2 -0
- package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.js +3 -1
- package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +5 -4
- package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +2 -0
- package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.js +2 -0
- package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +2 -0
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.d.ts +1 -1
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +7 -3
- package/dist/components/parameters/sensi/columns-definitions.d.ts +7 -180
- package/dist/components/parameters/sensi/columns-definitions.js +81 -73
- package/dist/components/parameters/sensi/index.js +1 -6
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-dialog.js +3 -1
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +4 -2
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.js +2 -0
- package/dist/components/parameters/sensi/sensitivity-parameters-selector.js +52 -51
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.d.ts +2 -2
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +41 -61
- package/dist/components/parameters/sensi/utils.d.ts +4 -4
- package/dist/components/parameters/sensi/utils.js +8 -6
- package/dist/components/parameters/short-circuit/short-circuit-general-tab-panel.js +2 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-content.js +2 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +2 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +3 -1
- package/dist/components/parameters/short-circuit/short-circuit-parameters-utils.js +2 -0
- package/dist/components/parameters/short-circuit/short-circuit-power-electronics-tab-panel.js +2 -0
- package/dist/components/parameters/short-circuit/short-circuit-study-area-tab-panel.js +2 -0
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +2 -0
- package/dist/components/parameters/voltage-init/equipment-selection-parameters.js +2 -0
- package/dist/components/parameters/voltage-init/general-parameters.js +2 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +2 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +3 -1
- package/dist/components/parameters/voltage-init/voltage-limits-parameters.js +17 -31
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.js +0 -2
- package/dist/index.js +3 -10
- package/package.json +1 -1
- package/dist/components/parameters/common/parameter-dnd-table-field.d.ts +0 -9
- package/dist/components/parameters/common/parameter-dnd-table-field.js +0 -86
- package/dist/components/parameters/common/parameter-table/index.js +0 -10
- package/dist/hooks/use-create-row-data.d.ts +0 -4
- package/dist/hooks/use-create-row-data.js +0 -19
- /package/dist/components/parameters/sensi/{sensitivity-Flow-parameters.d.ts → sensitivity-parameters-fields.d.ts} +0 -0
- /package/dist/components/parameters/sensi/{sensitivity-Flow-parameters.js → sensitivity-parameters-fields.js} +0 -0
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CONTINGENCY_LISTS, CONTINGENCY_LISTS_INFOS } from "../constants.js";
|
|
2
|
+
import { DESCRIPTION, ACTIVATED, NAME, ID } from "../parameter-table-field/constants.js";
|
|
2
3
|
import "react/jsx-runtime";
|
|
3
4
|
import "@mui/material";
|
|
4
|
-
import "@mui/icons-material";
|
|
5
|
-
import "react";
|
|
6
5
|
import "react-intl";
|
|
7
6
|
import "react-hook-form";
|
|
7
|
+
import "@mui/icons-material";
|
|
8
|
+
import "react";
|
|
9
|
+
import "react-dom";
|
|
10
|
+
import "@hello-pangea/dnd";
|
|
11
|
+
import { DndColumnType } from "../../../dnd-table-v2/dnd-table.type.js";
|
|
8
12
|
import "../../../overflowableText/OverflowableText.js";
|
|
9
13
|
import "../../../../utils/conversionUtils.js";
|
|
10
14
|
import { ElementType } from "../../../../utils/types/elementType.js";
|
|
@@ -35,38 +39,38 @@ import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
|
35
39
|
import "uuid";
|
|
36
40
|
import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
37
41
|
import "react-querybuilder";
|
|
38
|
-
import { CONTINGENCY_LISTS, CONTINGENCY_LISTS_INFOS } from "../constants.js";
|
|
39
42
|
const COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS = [
|
|
40
43
|
{
|
|
41
44
|
label: "ContingencyLists",
|
|
42
45
|
dataKey: CONTINGENCY_LISTS,
|
|
43
46
|
initialValue: [],
|
|
44
47
|
editable: true,
|
|
45
|
-
|
|
48
|
+
type: DndColumnType.DIRECTORY_ITEMS,
|
|
49
|
+
equipmentTypes: [],
|
|
46
50
|
elementType: ElementType.CONTINGENCY_LIST,
|
|
47
|
-
titleId: "ContingencyListsSelection"
|
|
51
|
+
titleId: "ContingencyListsSelection",
|
|
52
|
+
shouldHandleOnChangeCell: true
|
|
48
53
|
},
|
|
49
54
|
{
|
|
50
55
|
label: "description",
|
|
56
|
+
sxHeader: { textAlign: "center" },
|
|
51
57
|
dataKey: DESCRIPTION,
|
|
52
58
|
initialValue: "",
|
|
53
59
|
editable: true,
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
width: "8rem",
|
|
61
|
+
type: DndColumnType.DESCRIPTIONS
|
|
56
62
|
},
|
|
57
63
|
{
|
|
58
64
|
label: "Active",
|
|
65
|
+
sxHeader: { textAlign: "center" },
|
|
59
66
|
dataKey: ACTIVATED,
|
|
60
67
|
initialValue: true,
|
|
61
|
-
checkboxItems: true,
|
|
62
68
|
editable: true,
|
|
63
|
-
width: "4rem"
|
|
69
|
+
width: "4rem",
|
|
70
|
+
type: DndColumnType.SWITCH,
|
|
71
|
+
shouldHandleOnChangeCell: true
|
|
64
72
|
}
|
|
65
73
|
];
|
|
66
|
-
const ParamContingencyLists = {
|
|
67
|
-
columnsDef: COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS,
|
|
68
|
-
name: CONTINGENCY_LISTS_INFOS
|
|
69
|
-
};
|
|
70
74
|
const getContingencyListsInfosFormSchema = () => {
|
|
71
75
|
return yup.object().shape({
|
|
72
76
|
[CONTINGENCY_LISTS_INFOS]: yup.array().of(
|
|
@@ -95,9 +99,13 @@ const toFormValuesContingencyListsInfos = (contingencyListsInfos) => {
|
|
|
95
99
|
}))
|
|
96
100
|
};
|
|
97
101
|
};
|
|
102
|
+
const isValidContingencyRow = (row) => {
|
|
103
|
+
const contingencyLists = row?.[CONTINGENCY_LISTS];
|
|
104
|
+
return row?.[ACTIVATED] === true && Array.isArray(contingencyLists) && contingencyLists.length > 0;
|
|
105
|
+
};
|
|
98
106
|
export {
|
|
99
107
|
COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS,
|
|
100
|
-
ParamContingencyLists,
|
|
101
108
|
getContingencyListsInfosFormSchema,
|
|
109
|
+
isValidContingencyRow,
|
|
102
110
|
toFormValuesContingencyListsInfos
|
|
103
111
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UUID } from 'node:crypto';
|
|
2
2
|
import { ContingencyCount } from './types';
|
|
3
|
-
export declare function ContingencyTable({ showContingencyCount, fetchContingencyCount, isBuiltCurrentNode, }: Readonly<{
|
|
3
|
+
export declare function ContingencyTable({ name, showContingencyCount, fetchContingencyCount, isBuiltCurrentNode, }: Readonly<{
|
|
4
|
+
name: string;
|
|
4
5
|
showContingencyCount: boolean;
|
|
5
6
|
fetchContingencyCount?: (contingencyLists: UUID[] | null, abortSignal: AbortSignal) => Promise<ContingencyCount>;
|
|
6
7
|
isBuiltCurrentNode?: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useState, useCallback, useEffect } from "react";
|
|
2
|
+
import { Grid, Alert, CircularProgress } from "@mui/material";
|
|
3
|
+
import { useState, useCallback, useMemo, useEffect } from "react";
|
|
4
4
|
import { useIntl, FormattedMessage } from "react-intl";
|
|
5
|
-
import {
|
|
5
|
+
import { useFormContext } from "react-hook-form";
|
|
6
6
|
import "../../../../utils/conversionUtils.js";
|
|
7
7
|
import { snackWithFallback } from "../../../../utils/error.js";
|
|
8
8
|
import "../../../../utils/types/equipmentType.js";
|
|
@@ -13,40 +13,44 @@ import "localized-countries";
|
|
|
13
13
|
import "localized-countries/data/fr";
|
|
14
14
|
import "localized-countries/data/en";
|
|
15
15
|
import { useSnackMessage } from "../../../../hooks/useSnackMessage.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
16
|
+
import { ACTIVATED, ID } from "../parameter-table-field/constants.js";
|
|
17
|
+
import { ParameterTableField } from "../parameter-table-field/parameter-table-field.js";
|
|
18
|
+
import { CONTINGENCY_LISTS } from "../constants.js";
|
|
19
|
+
import { COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS, isValidContingencyRow } from "./columns-definitions.js";
|
|
20
|
+
const styles = {
|
|
21
|
+
alert: { color: "text.primary", paddingTop: 0, paddingBottom: 0 }
|
|
22
|
+
};
|
|
21
23
|
function ContingencyTable({
|
|
24
|
+
name,
|
|
22
25
|
showContingencyCount = false,
|
|
23
26
|
fetchContingencyCount,
|
|
24
27
|
isBuiltCurrentNode
|
|
25
28
|
}) {
|
|
26
29
|
const intl = useIntl();
|
|
27
30
|
const [simulatedContingencyCount, setSimulatedContingencyCount] = useState(null);
|
|
28
|
-
const [rowData, useFieldArrayOutput] = useCreateRowData(ParamContingencyLists);
|
|
29
|
-
const contingencyListsInfos = useWatch({ name: CONTINGENCY_LISTS_INFOS });
|
|
30
31
|
const [isLoading, setIsLoading] = useState(false);
|
|
32
|
+
const [contingencyCountRefreshTrigger, setContingencyCountRefreshTrigger] = useState(0);
|
|
31
33
|
const { snackError } = useSnackMessage();
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
);
|
|
34
|
+
const { getValues } = useFormContext();
|
|
35
|
+
const handleOnChange = useCallback(() => {
|
|
36
|
+
setContingencyCountRefreshTrigger((prevValue) => prevValue + 1);
|
|
37
|
+
}, []);
|
|
38
|
+
const columnsDefinition = useMemo(() => {
|
|
39
|
+
return COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS.map(
|
|
40
|
+
(colDef) => ({
|
|
41
|
+
...colDef,
|
|
42
|
+
label: intl.formatMessage({ id: colDef.label })
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
}, [intl]);
|
|
44
46
|
useEffect(() => {
|
|
45
47
|
if (!showContingencyCount || !isBuiltCurrentNode) {
|
|
46
48
|
setIsLoading(false);
|
|
49
|
+
setSimulatedContingencyCount(null);
|
|
47
50
|
return () => {
|
|
48
51
|
};
|
|
49
52
|
}
|
|
53
|
+
const contingencyListsInfos = getValues(name);
|
|
50
54
|
const hasNoContingencies = !contingencyListsInfos || (contingencyListsInfos.length ?? 0) === 0 || contingencyListsInfos.every(
|
|
51
55
|
(contingencyList) => !contingencyList[ACTIVATED] || (contingencyList[CONTINGENCY_LISTS]?.length ?? 0) === 0
|
|
52
56
|
);
|
|
@@ -80,26 +84,26 @@ function ContingencyTable({
|
|
|
80
84
|
controller?.abort(new Error(IGNORE_SIGNAL));
|
|
81
85
|
clearTimeout(loadingTimeoutId);
|
|
82
86
|
};
|
|
83
|
-
}, [
|
|
87
|
+
}, [
|
|
88
|
+
snackError,
|
|
89
|
+
getValues,
|
|
90
|
+
fetchContingencyCount,
|
|
91
|
+
showContingencyCount,
|
|
92
|
+
isBuiltCurrentNode,
|
|
93
|
+
name,
|
|
94
|
+
contingencyCountRefreshTrigger
|
|
95
|
+
]);
|
|
84
96
|
const renderContingencyCount = () => {
|
|
85
97
|
if (!isBuiltCurrentNode) {
|
|
86
|
-
return /* @__PURE__ */ jsx(Alert, { variant: "standard", severity: "warning", sx:
|
|
98
|
+
return /* @__PURE__ */ jsx(Alert, { variant: "standard", severity: "warning", sx: styles.alert, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "contingencyCountImpossibleOnUnbuiltNode" }) });
|
|
87
99
|
}
|
|
88
100
|
if (isLoading) {
|
|
89
|
-
return /* @__PURE__ */ jsx(
|
|
90
|
-
Alert,
|
|
91
|
-
{
|
|
92
|
-
variant: "standard",
|
|
93
|
-
icon: /* @__PURE__ */ jsx(CircularProgress, { size: 22 }),
|
|
94
|
-
severity: "info",
|
|
95
|
-
sx: { color: "text.primary" }
|
|
96
|
-
}
|
|
97
|
-
);
|
|
101
|
+
return /* @__PURE__ */ jsx(Alert, { variant: "standard", icon: /* @__PURE__ */ jsx(CircularProgress, { size: 22 }), severity: "info", sx: styles.alert });
|
|
98
102
|
}
|
|
99
103
|
if (simulatedContingencyCount?.contingencies === 0 && simulatedContingencyCount.notFoundElements === 0) {
|
|
100
|
-
return /* @__PURE__ */ jsx(Alert, { variant: "standard", severity: "error", sx:
|
|
104
|
+
return /* @__PURE__ */ jsx(Alert, { variant: "standard", severity: "error", sx: styles.alert, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "noContingency" }) });
|
|
101
105
|
}
|
|
102
|
-
return /* @__PURE__ */ jsx(Alert, { variant: "standard", icon: false, severity: "info", sx:
|
|
106
|
+
return /* @__PURE__ */ jsx(Alert, { variant: "standard", icon: false, severity: "info", sx: styles.alert, children: /* @__PURE__ */ jsx(
|
|
103
107
|
FormattedMessage,
|
|
104
108
|
{
|
|
105
109
|
id: "xContingenciesWillBeSimulatedAndYNotFound",
|
|
@@ -110,18 +114,15 @@ function ContingencyTable({
|
|
|
110
114
|
}
|
|
111
115
|
) });
|
|
112
116
|
};
|
|
113
|
-
return /* @__PURE__ */ jsxs(
|
|
117
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, direction: "column", children: [
|
|
114
118
|
/* @__PURE__ */ jsx(
|
|
115
|
-
|
|
119
|
+
ParameterTableField,
|
|
116
120
|
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
columnsDefinition: getColumnsDefinition(COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS),
|
|
121
|
+
name,
|
|
122
|
+
columnsDefinition,
|
|
120
123
|
tableHeight: 270,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
isValidParameterRow: (row) => row[CONTINGENCY_LISTS]?.length > 0
|
|
124
|
+
onChange: handleOnChange,
|
|
125
|
+
isValidRow: isValidContingencyRow
|
|
125
126
|
}
|
|
126
127
|
),
|
|
127
128
|
showContingencyCount && renderContingencyCount()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ContingencyTable } from "./contingency-table.js";
|
|
2
|
-
import { COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS,
|
|
2
|
+
import { COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS, getContingencyListsInfosFormSchema, isValidContingencyRow, toFormValuesContingencyListsInfos } from "./columns-definitions.js";
|
|
3
3
|
export {
|
|
4
4
|
COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS,
|
|
5
5
|
ContingencyTable,
|
|
6
|
-
ParamContingencyLists,
|
|
7
6
|
getContingencyListsInfosFormSchema,
|
|
7
|
+
isValidContingencyRow,
|
|
8
8
|
toFormValuesContingencyListsInfos
|
|
9
9
|
};
|
|
@@ -17,7 +17,7 @@ import { LimitReductionsTableForm } from "./limitreductions/limit-reductions-tab
|
|
|
17
17
|
import { LimitReductionTableRow } from "./limitreductions/limit-reduction-table-row.js";
|
|
18
18
|
import { LimitReductionTableCell } from "./limitreductions/limit-reduction-table-cell.js";
|
|
19
19
|
import { ContingencyTable } from "./contingency-table/contingency-table.js";
|
|
20
|
-
import { COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS,
|
|
20
|
+
import { COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS, getContingencyListsInfosFormSchema, isValidContingencyRow, toFormValuesContingencyListsInfos } from "./contingency-table/columns-definitions.js";
|
|
21
21
|
import { useTabs } from "./hook/use-tabs.js";
|
|
22
22
|
import { useParametersForm } from "./hook/use-parameters-form.js";
|
|
23
23
|
export {
|
|
@@ -48,7 +48,6 @@ export {
|
|
|
48
48
|
PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD,
|
|
49
49
|
PARAM_SA_PROVIDER,
|
|
50
50
|
PROVIDER,
|
|
51
|
-
ParamContingencyLists,
|
|
52
51
|
ParameterFloat,
|
|
53
52
|
ParameterGroup,
|
|
54
53
|
ParameterLineDirectoryItemsInput,
|
|
@@ -67,6 +66,7 @@ export {
|
|
|
67
66
|
getContingencyListsInfosFormSchema,
|
|
68
67
|
getLimitReductionsFormSchema,
|
|
69
68
|
isValidComputingType,
|
|
69
|
+
isValidContingencyRow,
|
|
70
70
|
sanitizePercentageValue,
|
|
71
71
|
toFormValuesContingencyListsInfos,
|
|
72
72
|
toFormValuesLimitReductions,
|
|
@@ -47,6 +47,8 @@ import { LineSeparator } from "./line-separator.js";
|
|
|
47
47
|
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
48
48
|
import "./widget/parameter-line-slider.js";
|
|
49
49
|
import "./limitreductions/columns-definitions.js";
|
|
50
|
+
import "react-dom";
|
|
51
|
+
import "@hello-pangea/dnd";
|
|
50
52
|
import "./contingency-table/columns-definitions.js";
|
|
51
53
|
import "@hookform/resolvers/yup";
|
|
52
54
|
import "../../filter/HeaderFilterForm.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export declare const NAME = "name";
|
|
8
|
+
export declare const ID = "id";
|
|
9
|
+
export declare const ACTIVATED = "activated";
|
|
10
|
+
export declare const DESCRIPTION = "description";
|
package/dist/components/parameters/common/{parameter-table → parameter-table-field}/index.d.ts
RENAMED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2026, RTE (http://www.rte-france.com)
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
4
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
* file, You can obtain one at
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
*/
|
|
7
7
|
export * from './constants';
|
|
8
|
-
export * from './parameter-table';
|
|
9
|
-
export * from './types';
|
|
8
|
+
export * from './parameter-table-field';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SxProps, TooltipProps } from '@mui/material';
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
import { DndTableProps } from '../../../dnd-table-v2';
|
|
4
|
+
export type ParameterDndTableFieldProps = {
|
|
5
|
+
label?: string;
|
|
6
|
+
tooltipProps?: Omit<TooltipProps, 'children'>;
|
|
7
|
+
sxContainerProps?: SxProps;
|
|
8
|
+
isValidRow?: (rowData: FieldValues) => boolean;
|
|
9
|
+
onChange?: () => void;
|
|
10
|
+
} & Omit<DndTableProps, 'useFieldArrayOutput' | 'onChange' | 'onDelete'>;
|
|
11
|
+
export declare function ParameterTableField({ name, label, columnsDefinition, tooltipProps, sxContainerProps, onChange, isValidRow, ...otherProps }: Readonly<ParameterDndTableFieldProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Grid, Typography, Tooltip } from "@mui/material";
|
|
3
|
+
import { FormattedMessage } from "react-intl";
|
|
4
|
+
import { useFieldArray, useFormContext } from "react-hook-form";
|
|
5
|
+
import { Info } from "@mui/icons-material";
|
|
6
|
+
import { useRef, useMemo, useCallback } from "react";
|
|
7
|
+
import { DndTable } from "../../../dnd-table-v2/dnd-table.js";
|
|
8
|
+
import { getDefaultRowData } from "../../../dnd-table-v2/dnd-table-utils.js";
|
|
9
|
+
import "../../../overflowableText/OverflowableText.js";
|
|
10
|
+
import "../../../../utils/conversionUtils.js";
|
|
11
|
+
import "../../../../utils/types/equipmentType.js";
|
|
12
|
+
import "../../../../utils/yupConfig.js";
|
|
13
|
+
import "localized-countries";
|
|
14
|
+
import "localized-countries/data/fr";
|
|
15
|
+
import "localized-countries/data/en";
|
|
16
|
+
import "notistack";
|
|
17
|
+
import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
18
|
+
import "yup";
|
|
19
|
+
import "../../../treeViewFinder/TreeViewFinder.js";
|
|
20
|
+
import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
21
|
+
import "../../../customAGGrid/customAggrid.js";
|
|
22
|
+
import "ag-grid-community";
|
|
23
|
+
import "react-papaparse";
|
|
24
|
+
import "react-csv-downloader";
|
|
25
|
+
import "../../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
26
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
27
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
28
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
29
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
30
|
+
import "../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
31
|
+
import "../../../inputs/reactHookForm/expandableInput/ExpandableInput.js";
|
|
32
|
+
import "@react-querybuilder/material";
|
|
33
|
+
import "../../../filter/expert/expertFilterConstants.js";
|
|
34
|
+
import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
35
|
+
import "uuid";
|
|
36
|
+
import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
37
|
+
import "react-querybuilder";
|
|
38
|
+
function ParameterTableField({
|
|
39
|
+
name,
|
|
40
|
+
label,
|
|
41
|
+
columnsDefinition,
|
|
42
|
+
tooltipProps,
|
|
43
|
+
sxContainerProps,
|
|
44
|
+
onChange,
|
|
45
|
+
isValidRow,
|
|
46
|
+
...otherProps
|
|
47
|
+
}) {
|
|
48
|
+
const useFieldArrayOutput = useFieldArray({
|
|
49
|
+
name
|
|
50
|
+
});
|
|
51
|
+
const { getValues } = useFormContext();
|
|
52
|
+
const validRowCountRef = useRef(
|
|
53
|
+
getValues(name).filter((row) => isValidRow ? isValidRow(row) : true).length
|
|
54
|
+
);
|
|
55
|
+
const newDefaultRowData = useMemo(() => {
|
|
56
|
+
return getDefaultRowData(columnsDefinition);
|
|
57
|
+
}, [columnsDefinition]);
|
|
58
|
+
const createRows = useCallback(
|
|
59
|
+
(numberOfRows) => Array.from({ length: numberOfRows }, () => ({ ...newDefaultRowData })),
|
|
60
|
+
[newDefaultRowData]
|
|
61
|
+
);
|
|
62
|
+
const { title, ...otherTooltipProps } = tooltipProps || {};
|
|
63
|
+
const handleOnChange = useCallback(
|
|
64
|
+
(changedRow) => {
|
|
65
|
+
const currentValidRowCount = getValues(name).filter(
|
|
66
|
+
(row) => isValidRow ? isValidRow(row) : true
|
|
67
|
+
).length;
|
|
68
|
+
const previousValidRowCount = validRowCountRef.current;
|
|
69
|
+
validRowCountRef.current = currentValidRowCount;
|
|
70
|
+
if (isValidRow ? isValidRow(changedRow) : true) {
|
|
71
|
+
onChange?.();
|
|
72
|
+
} else if (previousValidRowCount !== currentValidRowCount) {
|
|
73
|
+
onChange?.();
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
[isValidRow, onChange, getValues, name]
|
|
77
|
+
);
|
|
78
|
+
const handleOnDelete = useCallback(
|
|
79
|
+
(removedRows) => {
|
|
80
|
+
const wasValidRowCount = removedRows.filter(
|
|
81
|
+
(row) => isValidRow ? isValidRow(row) : true
|
|
82
|
+
).length;
|
|
83
|
+
if (wasValidRowCount > 0) {
|
|
84
|
+
validRowCountRef.current -= wasValidRowCount;
|
|
85
|
+
onChange?.();
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
[isValidRow, onChange]
|
|
89
|
+
);
|
|
90
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, sx: sxContainerProps, children: [
|
|
91
|
+
label && /* @__PURE__ */ jsxs(Grid, { container: true, alignItems: "center", paddingBottom: 2, paddingTop: 2, children: [
|
|
92
|
+
/* @__PURE__ */ jsx(Typography, { component: "span", variant: "h6", children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) }),
|
|
93
|
+
tooltipProps && /* @__PURE__ */ jsx(
|
|
94
|
+
Tooltip,
|
|
95
|
+
{
|
|
96
|
+
title: typeof title === "string" ? /* @__PURE__ */ jsx(FormattedMessage, { id: title }) : title,
|
|
97
|
+
placement: "right-start",
|
|
98
|
+
sx: { marginLeft: 1 },
|
|
99
|
+
...otherTooltipProps,
|
|
100
|
+
children: /* @__PURE__ */ jsx(Info, {})
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
] }),
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
DndTable,
|
|
106
|
+
{
|
|
107
|
+
name,
|
|
108
|
+
useFieldArrayOutput,
|
|
109
|
+
columnsDefinition,
|
|
110
|
+
createRows,
|
|
111
|
+
withAddRowsDialog: false,
|
|
112
|
+
onChange: handleOnChange,
|
|
113
|
+
onDelete: handleOnDelete,
|
|
114
|
+
...otherProps
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
] });
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
ParameterTableField
|
|
121
|
+
};
|
package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js
CHANGED
|
@@ -40,6 +40,8 @@ import "react-querybuilder";
|
|
|
40
40
|
import { getTabStyle, parametersStyles } from "../parameters-style.js";
|
|
41
41
|
import "../common/widget/parameter-line-slider.js";
|
|
42
42
|
import "../common/limitreductions/columns-definitions.js";
|
|
43
|
+
import "react-dom";
|
|
44
|
+
import "@hello-pangea/dnd";
|
|
43
45
|
import "../common/contingency-table/columns-definitions.js";
|
|
44
46
|
import { useTabs } from "../common/hook/use-tabs.js";
|
|
45
47
|
import "@hookform/resolvers/yup";
|
package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js
CHANGED
|
@@ -46,6 +46,8 @@ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
|
46
46
|
import "react-querybuilder";
|
|
47
47
|
import "../common/widget/parameter-line-slider.js";
|
|
48
48
|
import "../common/limitreductions/columns-definitions.js";
|
|
49
|
+
import "react-dom";
|
|
50
|
+
import "@hello-pangea/dnd";
|
|
49
51
|
import "../common/contingency-table/columns-definitions.js";
|
|
50
52
|
import "@hookform/resolvers/yup";
|
|
51
53
|
import "../../filter/HeaderFilterForm.js";
|
package/dist/components/parameters/dynamic-margin-calculation/loads-variations-parameters.js
CHANGED
|
@@ -40,10 +40,10 @@ import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
|
40
40
|
import "uuid";
|
|
41
41
|
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
42
42
|
import "react-querybuilder";
|
|
43
|
-
import
|
|
43
|
+
import { ParameterTableField } from "../common/parameter-table-field/parameter-table-field.js";
|
|
44
44
|
import "react-dom";
|
|
45
45
|
import "@hello-pangea/dnd";
|
|
46
|
-
import { DndColumnType } from "../../dnd-table/dnd-table.type.js";
|
|
46
|
+
import { DndColumnType } from "../../dnd-table-v2/dnd-table.type.js";
|
|
47
47
|
const formSchema = yup.object().shape({
|
|
48
48
|
[CALCULATION_TYPE]: yup.string().required(),
|
|
49
49
|
[ACCURACY]: yup.number().required(),
|
|
@@ -95,7 +95,7 @@ const params = [
|
|
|
95
95
|
],
|
|
96
96
|
sx: { width: "100%" }
|
|
97
97
|
}
|
|
98
|
-
// LOADS_VARIATIONS displayed in a separated component, i.e.,
|
|
98
|
+
// LOADS_VARIATIONS displayed in a separated component, i.e., ParameterTableField
|
|
99
99
|
];
|
|
100
100
|
const loadsVariationsColumnsDefinition = [
|
|
101
101
|
{
|
|
@@ -117,6 +117,7 @@ const loadsVariationsColumnsDefinition = [
|
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
label: "DynamicMarginCalculationLoadsActive",
|
|
120
|
+
sxHeader: { textAlign: "center" },
|
|
120
121
|
initialValue: true,
|
|
121
122
|
dataKey: ACTIVE,
|
|
122
123
|
editable: true,
|
|
@@ -126,7 +127,7 @@ const loadsVariationsColumnsDefinition = [
|
|
|
126
127
|
];
|
|
127
128
|
function LoadsVariationsParameters({ path }) {
|
|
128
129
|
const inlt = useIntl();
|
|
129
|
-
const
|
|
130
|
+
const columnsDefinition = useMemo(() => {
|
|
130
131
|
return loadsVariationsColumnsDefinition.map((colDef) => ({
|
|
131
132
|
...colDef,
|
|
132
133
|
label: inlt.formatMessage({ id: colDef.label })
|
|
@@ -138,13 +139,14 @@ function LoadsVariationsParameters({ path }) {
|
|
|
138
139
|
return /* @__PURE__ */ jsx(ParameterField, { id: path, name: param.name, type: param.type, ...otherParams }, param.name);
|
|
139
140
|
}),
|
|
140
141
|
/* @__PURE__ */ jsx(
|
|
141
|
-
|
|
142
|
+
ParameterTableField,
|
|
142
143
|
{
|
|
143
144
|
name: `${path}.${LOADS_VARIATIONS}`,
|
|
144
145
|
label: "DynamicMarginCalculationLoadsVariations",
|
|
145
146
|
tooltipProps: { title: "DynamicMarginCalculationLoadsVariations" },
|
|
146
|
-
columnsDefinition
|
|
147
|
-
tableHeight: 270
|
|
147
|
+
columnsDefinition,
|
|
148
|
+
tableHeight: 270,
|
|
149
|
+
disableDragAndDrop: true
|
|
148
150
|
}
|
|
149
151
|
)
|
|
150
152
|
] });
|
|
@@ -40,6 +40,8 @@ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
|
40
40
|
import "react-querybuilder";
|
|
41
41
|
import "../common/widget/parameter-line-slider.js";
|
|
42
42
|
import "../common/limitreductions/columns-definitions.js";
|
|
43
|
+
import "react-dom";
|
|
44
|
+
import "@hello-pangea/dnd";
|
|
43
45
|
import "../common/contingency-table/columns-definitions.js";
|
|
44
46
|
import { useParametersForm } from "../common/hook/use-parameters-form.js";
|
|
45
47
|
import { LOADS_VARIATIONS, LOAD_MODELS_RULE, ACCURACY, CALCULATION_TYPE, LOAD_INCREASE_STOP_TIME, LOAD_INCREASE_START_TIME, MARGIN_CALCULATION_START_TIME, STOP_TIME, START_TIME } from "./constants.js";
|
|
@@ -39,6 +39,8 @@ import "react-querybuilder";
|
|
|
39
39
|
import { ParameterLineDirectoryItemsInput } from "../common/widget/parameter-line-directory-items-input.js";
|
|
40
40
|
import "../common/widget/parameter-line-slider.js";
|
|
41
41
|
import "../common/limitreductions/columns-definitions.js";
|
|
42
|
+
import "react-dom";
|
|
43
|
+
import "@hello-pangea/dnd";
|
|
42
44
|
import "../common/contingency-table/columns-definitions.js";
|
|
43
45
|
import "@hookform/resolvers/yup";
|
|
44
46
|
import "../../filter/HeaderFilterForm.js";
|
package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js
CHANGED
|
@@ -43,6 +43,8 @@ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
|
43
43
|
import "react-querybuilder";
|
|
44
44
|
import "../common/widget/parameter-line-slider.js";
|
|
45
45
|
import "../common/limitreductions/columns-definitions.js";
|
|
46
|
+
import "react-dom";
|
|
47
|
+
import "@hello-pangea/dnd";
|
|
46
48
|
import "../common/contingency-table/columns-definitions.js";
|
|
47
49
|
import "@hookform/resolvers/yup";
|
|
48
50
|
import "../../filter/HeaderFilterForm.js";
|
|
@@ -42,6 +42,8 @@ import "react-querybuilder";
|
|
|
42
42
|
import { getTabStyle, parametersStyles } from "../parameters-style.js";
|
|
43
43
|
import "../common/widget/parameter-line-slider.js";
|
|
44
44
|
import "../common/limitreductions/columns-definitions.js";
|
|
45
|
+
import "react-dom";
|
|
46
|
+
import "@hello-pangea/dnd";
|
|
45
47
|
import "../common/contingency-table/columns-definitions.js";
|
|
46
48
|
import { useTabs } from "../common/hook/use-tabs.js";
|
|
47
49
|
import "@hookform/resolvers/yup";
|
|
@@ -39,6 +39,8 @@ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
|
39
39
|
import "react-querybuilder";
|
|
40
40
|
import "../common/widget/parameter-line-slider.js";
|
|
41
41
|
import "../common/limitreductions/columns-definitions.js";
|
|
42
|
+
import "react-dom";
|
|
43
|
+
import "@hello-pangea/dnd";
|
|
42
44
|
import "../common/contingency-table/columns-definitions.js";
|
|
43
45
|
import { useParametersForm } from "../common/hook/use-parameters-form.js";
|
|
44
46
|
import { SCENARIO_DURATION, CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME } from "./constants.js";
|
|
@@ -44,6 +44,8 @@ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
|
44
44
|
import "react-querybuilder";
|
|
45
45
|
import "../common/widget/parameter-line-slider.js";
|
|
46
46
|
import "../common/limitreductions/columns-definitions.js";
|
|
47
|
+
import "react-dom";
|
|
48
|
+
import "@hello-pangea/dnd";
|
|
47
49
|
import "../common/contingency-table/columns-definitions.js";
|
|
48
50
|
import "@hookform/resolvers/yup";
|
|
49
51
|
import "../../filter/HeaderFilterForm.js";
|
|
@@ -40,6 +40,8 @@ import "react-querybuilder";
|
|
|
40
40
|
import { getTabStyle, parametersStyles } from "../parameters-style.js";
|
|
41
41
|
import "../common/widget/parameter-line-slider.js";
|
|
42
42
|
import "../common/limitreductions/columns-definitions.js";
|
|
43
|
+
import "react-dom";
|
|
44
|
+
import "@hello-pangea/dnd";
|
|
43
45
|
import "../common/contingency-table/columns-definitions.js";
|
|
44
46
|
import { useTabs } from "../common/hook/use-tabs.js";
|
|
45
47
|
import "@hookform/resolvers/yup";
|
|
@@ -15,7 +15,6 @@ import "localized-countries";
|
|
|
15
15
|
import "localized-countries/data/fr";
|
|
16
16
|
import "localized-countries/data/en";
|
|
17
17
|
import { useSnackMessage } from "../../../../hooks/useSnackMessage.js";
|
|
18
|
-
import "react-hook-form";
|
|
19
18
|
function MappingParameters({ path }) {
|
|
20
19
|
const { snackError } = useSnackMessage();
|
|
21
20
|
const [mappings, setMappings] = useState([]);
|