@gridsuite/commons-ui 0.250.0 → 0.252.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/index.js +2 -1
- package/dist/components/ui/index.js +2 -1
- package/dist/components/ui/reactHookForm/constants.d.ts +1 -0
- package/dist/components/ui/reactHookForm/constants.js +2 -0
- package/dist/components/ui/reactHookForm/index.js +2 -1
- package/dist/features/index.js +5 -2
- package/dist/features/parameters/common/hook/use-tabs.d.ts +3 -1
- package/dist/features/parameters/common/hook/use-tabs.js +21 -15
- package/dist/features/parameters/dynamic-margin-calculation/constants.d.ts +0 -1
- package/dist/features/parameters/dynamic-margin-calculation/constants.js +0 -2
- package/dist/features/parameters/dynamic-margin-calculation/index.js +1 -2
- package/dist/features/parameters/dynamic-margin-calculation/loads-variations-parameters.js +2 -2
- package/dist/features/parameters/index.d.ts +1 -0
- package/dist/features/parameters/index.js +5 -2
- package/dist/features/parameters/loadflow/load-flow-parameters-utils.d.ts +3 -2
- package/dist/features/parameters/loadflow/load-flow-parameters-utils.js +22 -3
- package/dist/features/parameters/loadflow/use-load-flow-parameters-form.js +14 -29
- package/dist/features/parameters/network-visualizations/network-visualizations-parameters-dialog.js +1 -0
- package/dist/features/parameters/network-visualizations/network-visualizations-parameters-inline.js +1 -1
- package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.d.ts +3 -1
- package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.js +19 -6
- package/dist/features/parameters/security-analysis/constants.d.ts +3 -3
- package/dist/features/parameters/security-analysis/constants.js +3 -3
- package/dist/features/parameters/security-analysis/security-analysis-parameters-content.d.ts +4 -6
- package/dist/features/parameters/security-analysis/security-analysis-parameters-content.js +26 -30
- package/dist/features/parameters/security-analysis/security-analysis-parameters-dialog.js +2 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-form.js +1 -3
- package/dist/features/parameters/security-analysis/security-analysis-parameters-inline.js +4 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-utils.d.ts +2 -0
- package/dist/features/parameters/security-analysis/security-analysis-parameters-utils.js +54 -0
- package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.d.ts +8 -1
- package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.js +21 -2
- package/dist/features/parameters/sensi/sensitivity-parameters-selector.js +9 -8
- package/dist/features/parameters/short-circuit/short-circuit-icc-cluster-table-cell.js +1 -1
- package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.d.ts +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.js +27 -2
- package/dist/features/parameters/short-circuit/use-short-circuit-parameters-form.js +15 -24
- package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +19 -18
- package/dist/features/parameters/voltage-init/voltage-init-form-utils.d.ts +2 -0
- package/dist/features/parameters/voltage-init/voltage-init-form-utils.js +14 -1
- package/dist/features/parameters/voltage-init/voltage-init-parameters-dialog.js +1 -0
- package/dist/features/parameters/voltage-init/voltage-init-parameters-form.js +27 -38
- package/dist/features/parameters/voltage-init/voltage-init-parameters-inline.js +1 -1
- package/dist/features/process-configs/process-configs.type.d.ts +8 -3
- package/dist/features/process-configs/security-analysis/update-sa-process-config.js +2 -0
- package/dist/features/process-configs/security-analysis/update-sa-process-configs-utils.d.ts +6 -2
- package/dist/features/process-configs/security-analysis/update-sa-process-configs-utils.js +17 -9
- package/dist/features/process-configs/update-process-config-modifications.js +25 -2
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -42,7 +42,7 @@ import { SubmitButton } from "./ui/reactHookForm/utils/SubmitButton.js";
|
|
|
42
42
|
import { TextFieldWithAdornment } from "./ui/reactHookForm/utils/TextFieldWithAdornment.js";
|
|
43
43
|
import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./ui/reactHookForm/utils/functions.js";
|
|
44
44
|
import { HelperPreviousValue } from "./ui/reactHookForm/utils/HelperPreviousValue.js";
|
|
45
|
-
import { DESCRIPTION, DIRECTORY_ITEM, DIRECTORY_ITEM_FULL_PATH, DIRECTORY_ITEM_ID, NAME } from "./ui/reactHookForm/constants.js";
|
|
45
|
+
import { ACTIVE, DESCRIPTION, DIRECTORY_ITEM, DIRECTORY_ITEM_FULL_PATH, DIRECTORY_ITEM_ID, NAME } from "./ui/reactHookForm/constants.js";
|
|
46
46
|
import { ExpandableInput } from "./ui/reactHookForm/expandableInput/ExpandableInput.js";
|
|
47
47
|
import { CountrySelectionInput } from "./ui/reactHookForm/CountrySelectionInput.js";
|
|
48
48
|
import { CheckboxNullableInput } from "./ui/reactHookForm/CheckboxNullableInput.js";
|
|
@@ -156,6 +156,7 @@ import { ReportType } from "./composite/report/report.type.js";
|
|
|
156
156
|
import { GLOBAL_REPORT_NODE_LABEL, NETWORK_MODIFICATION } from "./composite/report/report.constant.js";
|
|
157
157
|
import { QuickSearch } from "./composite/report/QuickSearch.js";
|
|
158
158
|
export {
|
|
159
|
+
ACTIVE,
|
|
159
160
|
ActivableChip,
|
|
160
161
|
AddButton,
|
|
161
162
|
AddButtonMode,
|
|
@@ -42,7 +42,7 @@ import { SubmitButton } from "./reactHookForm/utils/SubmitButton.js";
|
|
|
42
42
|
import { TextFieldWithAdornment } from "./reactHookForm/utils/TextFieldWithAdornment.js";
|
|
43
43
|
import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./reactHookForm/utils/functions.js";
|
|
44
44
|
import { HelperPreviousValue } from "./reactHookForm/utils/HelperPreviousValue.js";
|
|
45
|
-
import { DESCRIPTION, DIRECTORY_ITEM, DIRECTORY_ITEM_FULL_PATH, DIRECTORY_ITEM_ID, NAME } from "./reactHookForm/constants.js";
|
|
45
|
+
import { ACTIVE, DESCRIPTION, DIRECTORY_ITEM, DIRECTORY_ITEM_FULL_PATH, DIRECTORY_ITEM_ID, NAME } from "./reactHookForm/constants.js";
|
|
46
46
|
import { ExpandableInput } from "./reactHookForm/expandableInput/ExpandableInput.js";
|
|
47
47
|
import { CountrySelectionInput } from "./reactHookForm/CountrySelectionInput.js";
|
|
48
48
|
import { CheckboxNullableInput } from "./reactHookForm/CheckboxNullableInput.js";
|
|
@@ -80,6 +80,7 @@ import { doesNodeHasChildren } from "./treeViewFinder/TreeViewUtils.js";
|
|
|
80
80
|
import { DirectoryItemSelector } from "./directoryItemSelector/DirectoryItemSelector.js";
|
|
81
81
|
import { CustomTablePagination } from "./tablepagination/custom-table-pagination.js";
|
|
82
82
|
export {
|
|
83
|
+
ACTIVE,
|
|
83
84
|
ActivableChip,
|
|
84
85
|
AddButton,
|
|
85
86
|
AddButtonMode,
|
|
@@ -9,3 +9,4 @@ export declare const DESCRIPTION = "description";
|
|
|
9
9
|
export declare const DIRECTORY_ITEM = "directoryItem";
|
|
10
10
|
export declare const DIRECTORY_ITEM_ID = "directoryItemId";
|
|
11
11
|
export declare const DIRECTORY_ITEM_FULL_PATH = "directoryItemFullPath";
|
|
12
|
+
export declare const ACTIVE = "active";
|
|
@@ -3,7 +3,9 @@ const DESCRIPTION = "description";
|
|
|
3
3
|
const DIRECTORY_ITEM = "directoryItem";
|
|
4
4
|
const DIRECTORY_ITEM_ID = "directoryItemId";
|
|
5
5
|
const DIRECTORY_ITEM_FULL_PATH = "directoryItemFullPath";
|
|
6
|
+
const ACTIVE = "active";
|
|
6
7
|
export {
|
|
8
|
+
ACTIVE,
|
|
7
9
|
DESCRIPTION,
|
|
8
10
|
DIRECTORY_ITEM,
|
|
9
11
|
DIRECTORY_ITEM_FULL_PATH,
|
|
@@ -41,13 +41,14 @@ import { SubmitButton } from "./utils/SubmitButton.js";
|
|
|
41
41
|
import { TextFieldWithAdornment } from "./utils/TextFieldWithAdornment.js";
|
|
42
42
|
import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./utils/functions.js";
|
|
43
43
|
import { HelperPreviousValue } from "./utils/HelperPreviousValue.js";
|
|
44
|
-
import { DESCRIPTION, DIRECTORY_ITEM, DIRECTORY_ITEM_FULL_PATH, DIRECTORY_ITEM_ID, NAME } from "./constants.js";
|
|
44
|
+
import { ACTIVE, DESCRIPTION, DIRECTORY_ITEM, DIRECTORY_ITEM_FULL_PATH, DIRECTORY_ITEM_ID, NAME } from "./constants.js";
|
|
45
45
|
import { ExpandableInput } from "./expandableInput/ExpandableInput.js";
|
|
46
46
|
import { CountrySelectionInput } from "./CountrySelectionInput.js";
|
|
47
47
|
import { CheckboxNullableInput } from "./CheckboxNullableInput.js";
|
|
48
48
|
import { directoryItemSchema, getAbsenceLabelKeyFromType } from "./directory-item-input/directory-item-utils.js";
|
|
49
49
|
import { DirectoryItemInput } from "./directory-item-input/directory-item-input.js";
|
|
50
50
|
export {
|
|
51
|
+
ACTIVE,
|
|
51
52
|
AutocompleteInput,
|
|
52
53
|
BooleanInput,
|
|
53
54
|
ButtonReadOnlyInput,
|
package/dist/features/index.js
CHANGED
|
@@ -67,8 +67,9 @@ import { COLUMNS_DEFINITIONS_HVDCS, COLUMNS_DEFINITIONS_INJECTIONS, COLUMNS_DEFI
|
|
|
67
67
|
import { DynamicSimulationInline } from "./parameters/dynamic-simulation/dynamic-simulation-inline.js";
|
|
68
68
|
import { CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME, SCENARIO_DURATION } from "./parameters/dynamic-security-analysis/constants.js";
|
|
69
69
|
import { DynamicSecurityAnalysisInline } from "./parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js";
|
|
70
|
-
import { ACCURACY,
|
|
70
|
+
import { ACCURACY, CALCULATION_TYPE, LOADS_VARIATIONS, LOAD_FILTERS, LOAD_INCREASE_START_TIME, LOAD_INCREASE_STOP_TIME, LOAD_MODELS_RULE, MARGIN_CALCULATION_START_TIME, START_TIME, STOP_TIME, VARIATION } from "./parameters/dynamic-margin-calculation/constants.js";
|
|
71
71
|
import { DynamicMarginCalculationInline } from "./parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js";
|
|
72
|
+
import { getTabIndicatorStyle, getTabStyle, parametersStyles } from "./parameters/parameters-style.js";
|
|
72
73
|
import { filledTextField, italicFontTextField, standardTextField } from "./network-modifications/common/form.utils.js";
|
|
73
74
|
import { PropertiesForm } from "./network-modifications/common/properties/PropertiesForm.js";
|
|
74
75
|
import { PropertyForm } from "./network-modifications/common/properties/PropertyForm.js";
|
|
@@ -238,7 +239,6 @@ import { getSAProcessConfigBackendFromFormData, getSAProcessConfigFormDataFromFe
|
|
|
238
239
|
import { ProcessType } from "./process-configs/process-configs.type.js";
|
|
239
240
|
export {
|
|
240
241
|
ACCURACY,
|
|
241
|
-
ACTIVE,
|
|
242
242
|
ADVANCED_PARAMETERS,
|
|
243
243
|
APPLICABILITY,
|
|
244
244
|
AUTO_EXTENSIBLE_COLUMNS,
|
|
@@ -719,6 +719,8 @@ export {
|
|
|
719
719
|
getShortCircuitEmptyFormData,
|
|
720
720
|
getShortCircuitFormData,
|
|
721
721
|
getShortCircuitFormSchema,
|
|
722
|
+
getTabIndicatorStyle,
|
|
723
|
+
getTabStyle,
|
|
722
724
|
getVoltageRegulationEmptyFormData,
|
|
723
725
|
getVoltageRegulationSchema,
|
|
724
726
|
handlePostSortRows,
|
|
@@ -765,6 +767,7 @@ export {
|
|
|
765
767
|
networkModificationTableStyles,
|
|
766
768
|
newEquipmentDeletionDto,
|
|
767
769
|
onlyStartedGeneratorsOptions,
|
|
770
|
+
parametersStyles,
|
|
768
771
|
removeUuidsFromTree,
|
|
769
772
|
sanitizeLimitNames,
|
|
770
773
|
sanitizeLimitsGroups,
|
|
@@ -2,6 +2,7 @@ import { SyntheticEvent } from 'react';
|
|
|
2
2
|
import { FieldErrors } from 'react-hook-form';
|
|
3
3
|
export type UseTabsReturn<TTabValue extends string> = {
|
|
4
4
|
selectedTab: TTabValue;
|
|
5
|
+
setSelectedTab: (selectedTab: TTabValue) => void;
|
|
5
6
|
tabsWithError: TTabValue[];
|
|
6
7
|
onTabChange: (event: SyntheticEvent, newValue: TTabValue) => void;
|
|
7
8
|
onError: (errors: FieldErrors) => void;
|
|
@@ -10,5 +11,6 @@ export type UseTabsProps<TTabValue extends string> = {
|
|
|
10
11
|
defaultTab: TTabValue;
|
|
11
12
|
tabEnum: Record<string, TTabValue>;
|
|
12
13
|
errors: FieldErrors;
|
|
14
|
+
tabFields?: Record<TTabValue, string[]>;
|
|
13
15
|
};
|
|
14
|
-
export declare function useTabs<TTabValue extends string>({ defaultTab, tabEnum, errors, }: Readonly<UseTabsProps<TTabValue>>): UseTabsReturn<TTabValue>;
|
|
16
|
+
export declare function useTabs<TTabValue extends string>({ defaultTab, tabEnum, errors, tabFields, }: Readonly<UseTabsProps<TTabValue>>): UseTabsReturn<TTabValue>;
|
|
@@ -1,43 +1,48 @@
|
|
|
1
1
|
import { useState, useCallback } from "react";
|
|
2
|
+
import { get } from "react-hook-form";
|
|
2
3
|
import { isObjectEmpty } from "../../../../utils/functions.js";
|
|
3
4
|
function useTabs({
|
|
4
5
|
defaultTab,
|
|
5
6
|
tabEnum,
|
|
6
|
-
errors
|
|
7
|
+
errors,
|
|
8
|
+
tabFields
|
|
7
9
|
}) {
|
|
8
10
|
const [selectedTab, setSelectedTab] = useState(defaultTab);
|
|
9
11
|
const [tabsWithError, setTabsWithError] = useState([]);
|
|
12
|
+
const getTabsWithError = useCallback(
|
|
13
|
+
(_errors) => {
|
|
14
|
+
const tabsHasError = [];
|
|
15
|
+
Object.values(tabEnum).forEach((tabValue) => {
|
|
16
|
+
const fields = tabFields?.[tabValue] ?? [tabValue];
|
|
17
|
+
if (fields.some((field) => get(_errors, field))) {
|
|
18
|
+
tabsHasError.push(tabValue);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return tabsHasError;
|
|
22
|
+
},
|
|
23
|
+
[tabEnum, tabFields]
|
|
24
|
+
);
|
|
10
25
|
const onTabChange = useCallback(
|
|
11
26
|
(event, newSelectedTab) => {
|
|
12
27
|
setSelectedTab(newSelectedTab);
|
|
13
28
|
if (!errors || isObjectEmpty(errors)) {
|
|
14
29
|
return;
|
|
15
30
|
}
|
|
16
|
-
const tabsHasError =
|
|
17
|
-
Object.values(tabEnum).forEach((tabValue) => {
|
|
18
|
-
if (errors?.[tabValue]) {
|
|
19
|
-
tabsHasError.push(tabValue);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
31
|
+
const tabsHasError = getTabsWithError(errors);
|
|
22
32
|
if (tabsHasError.includes(newSelectedTab)) {
|
|
23
33
|
setTabsWithError(tabsHasError.filter((errorTab) => errorTab !== newSelectedTab));
|
|
24
34
|
} else {
|
|
25
35
|
setTabsWithError(tabsHasError);
|
|
26
36
|
}
|
|
27
37
|
},
|
|
28
|
-
[errors,
|
|
38
|
+
[errors, getTabsWithError]
|
|
29
39
|
);
|
|
30
40
|
const onError = useCallback(
|
|
31
41
|
(_errors) => {
|
|
32
42
|
if (!_errors || isObjectEmpty(_errors)) {
|
|
33
43
|
return;
|
|
34
44
|
}
|
|
35
|
-
const tabsHasError =
|
|
36
|
-
Object.values(tabEnum).forEach((tabValue) => {
|
|
37
|
-
if (_errors?.[tabValue]) {
|
|
38
|
-
tabsHasError.push(tabValue);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
45
|
+
const tabsHasError = getTabsWithError(_errors);
|
|
41
46
|
if (tabsHasError.includes(selectedTab)) {
|
|
42
47
|
setTabsWithError(tabsHasError.filter((errorTab) => errorTab !== selectedTab));
|
|
43
48
|
} else if (tabsHasError.length > 0) {
|
|
@@ -45,10 +50,11 @@ function useTabs({
|
|
|
45
50
|
setTabsWithError(tabsHasError.filter((errorTab, index, arr) => errorTab !== arr[0]));
|
|
46
51
|
}
|
|
47
52
|
},
|
|
48
|
-
[
|
|
53
|
+
[getTabsWithError, selectedTab]
|
|
49
54
|
);
|
|
50
55
|
return {
|
|
51
56
|
selectedTab,
|
|
57
|
+
setSelectedTab,
|
|
52
58
|
tabsWithError,
|
|
53
59
|
onTabChange,
|
|
54
60
|
onError
|
|
@@ -9,10 +9,8 @@ const LOAD_MODELS_RULE = "loadModelsRule";
|
|
|
9
9
|
const LOADS_VARIATIONS = "loadsVariations";
|
|
10
10
|
const LOAD_FILTERS = "loadFilters";
|
|
11
11
|
const VARIATION = "variation";
|
|
12
|
-
const ACTIVE = "active";
|
|
13
12
|
export {
|
|
14
13
|
ACCURACY,
|
|
15
|
-
ACTIVE,
|
|
16
14
|
CALCULATION_TYPE,
|
|
17
15
|
LOADS_VARIATIONS,
|
|
18
16
|
LOAD_FILTERS,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ACCURACY,
|
|
1
|
+
import { ACCURACY, CALCULATION_TYPE, LOADS_VARIATIONS, LOAD_FILTERS, LOAD_INCREASE_START_TIME, LOAD_INCREASE_STOP_TIME, LOAD_MODELS_RULE, MARGIN_CALCULATION_START_TIME, START_TIME, STOP_TIME, VARIATION } from "./constants.js";
|
|
2
2
|
import { DynamicMarginCalculationInline } from "./dynamic-margin-calculation-inline.js";
|
|
3
3
|
export {
|
|
4
4
|
ACCURACY,
|
|
5
|
-
ACTIVE,
|
|
6
5
|
CALCULATION_TYPE,
|
|
7
6
|
DynamicMarginCalculationInline,
|
|
8
7
|
LOADS_VARIATIONS,
|
|
@@ -3,7 +3,7 @@ import { useMemo } from "react";
|
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { Grid2 } from "@mui/material";
|
|
5
5
|
import * as yup from "yup";
|
|
6
|
-
import { LOADS_VARIATIONS,
|
|
6
|
+
import { LOADS_VARIATIONS, VARIATION, LOAD_FILTERS, LOAD_MODELS_RULE, ACCURACY, CALCULATION_TYPE } from "./constants.js";
|
|
7
7
|
import { ID } from "../../../utils/constants/filterConstant.js";
|
|
8
8
|
import { YUP_REQUIRED } from "../../../utils/constants/translationKeys.js";
|
|
9
9
|
import "../../../utils/conversionUtils.js";
|
|
@@ -21,7 +21,7 @@ import "localized-countries/data/en";
|
|
|
21
21
|
import "notistack";
|
|
22
22
|
import "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
|
|
23
23
|
import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
|
|
24
|
-
import { NAME } from "../../../components/ui/reactHookForm/constants.js";
|
|
24
|
+
import { ACTIVE, NAME } from "../../../components/ui/reactHookForm/constants.js";
|
|
25
25
|
import "../../../components/ui/reactHookForm/numbers/RangeInput.js";
|
|
26
26
|
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
27
27
|
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
@@ -47,11 +47,11 @@ import { COLUMNS_DEFINITIONS_HVDCS, COLUMNS_DEFINITIONS_INJECTIONS, COLUMNS_DEFI
|
|
|
47
47
|
import { DynamicSimulationInline } from "./dynamic-simulation/dynamic-simulation-inline.js";
|
|
48
48
|
import { CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME, SCENARIO_DURATION } from "./dynamic-security-analysis/constants.js";
|
|
49
49
|
import { DynamicSecurityAnalysisInline } from "./dynamic-security-analysis/dynamic-security-analysis-inline.js";
|
|
50
|
-
import { ACCURACY,
|
|
50
|
+
import { ACCURACY, CALCULATION_TYPE, LOADS_VARIATIONS, LOAD_FILTERS, LOAD_INCREASE_START_TIME, LOAD_INCREASE_STOP_TIME, LOAD_MODELS_RULE, MARGIN_CALCULATION_START_TIME, START_TIME, STOP_TIME, VARIATION } from "./dynamic-margin-calculation/constants.js";
|
|
51
51
|
import { DynamicMarginCalculationInline } from "./dynamic-margin-calculation/dynamic-margin-calculation-inline.js";
|
|
52
|
+
import { getTabIndicatorStyle, getTabStyle, parametersStyles } from "./parameters-style.js";
|
|
52
53
|
export {
|
|
53
54
|
ACCURACY,
|
|
54
|
-
ACTIVE,
|
|
55
55
|
ADVANCED_PARAMETERS,
|
|
56
56
|
BALANCE_TYPE,
|
|
57
57
|
CALCULATION_TYPE,
|
|
@@ -238,11 +238,14 @@ export {
|
|
|
238
238
|
formatComputingTypeLabel,
|
|
239
239
|
getContingencyListsInfosFormSchema,
|
|
240
240
|
getLimitReductionsFormSchema,
|
|
241
|
+
getTabIndicatorStyle,
|
|
242
|
+
getTabStyle,
|
|
241
243
|
intlInitialVoltageProfileMode,
|
|
242
244
|
intlPredefinedParametersOptions,
|
|
243
245
|
isValidComputingType,
|
|
244
246
|
isValidContingencyRow,
|
|
245
247
|
onlyStartedGeneratorsOptions,
|
|
248
|
+
parametersStyles,
|
|
246
249
|
sanitizePercentageValue,
|
|
247
250
|
toFormValuesContingencyListsInfos,
|
|
248
251
|
toFormValuesLimitReductions,
|
|
@@ -4,10 +4,11 @@ import { ParameterValue } from './load-flow-parameters-type';
|
|
|
4
4
|
import * as yup from 'yup';
|
|
5
5
|
export declare enum TabValues {
|
|
6
6
|
GENERAL = "General",
|
|
7
|
+
LIMIT_REDUCTIONS = "LimitReductions",
|
|
7
8
|
ADVANCED = "Advanced",
|
|
8
|
-
PROVIDER_SPECIFIC = "ProviderSpecific"
|
|
9
|
-
LIMIT_REDUCTIONS = "LimitReductions"
|
|
9
|
+
PROVIDER_SPECIFIC = "ProviderSpecific"
|
|
10
10
|
}
|
|
11
|
+
export declare const TAB_FIELDS: Record<TabValues, string[]>;
|
|
11
12
|
export declare const getBasicLoadFlowParametersFormSchema: () => yup.ObjectSchema<{
|
|
12
13
|
phaseShifterRegulationOn: NonNullable<boolean | undefined>;
|
|
13
14
|
dc: NonNullable<boolean | undefined>;
|
|
@@ -30,9 +30,9 @@ import "mui-nested-menu";
|
|
|
30
30
|
import "react-resizable-panels";
|
|
31
31
|
import "react-papaparse";
|
|
32
32
|
import "../common/parameter-layout/parameter-layout-provider.js";
|
|
33
|
-
import { ADVANCED_PARAMETERS, COMMON_PARAMETERS } from "../common/constants.js";
|
|
33
|
+
import { ADVANCED_PARAMETERS, SPECIFIC_PARAMETERS, COMMON_PARAMETERS } from "../common/constants.js";
|
|
34
34
|
import "../common/widget/parameter-line-slider.js";
|
|
35
|
-
import { IST_FORM, LIMIT_DURATION_FORM,
|
|
35
|
+
import { LIMIT_REDUCTIONS_FORM, IST_FORM, LIMIT_DURATION_FORM, toFormValuesLimitReductions } from "../common/limitreductions/columns-definitions.js";
|
|
36
36
|
import "../common/contingency-table/contingency-table.js";
|
|
37
37
|
import "../common/contingency-table/columns-definitions.js";
|
|
38
38
|
import "@hookform/resolvers/yup";
|
|
@@ -41,11 +41,29 @@ import { DC_POWER_FACTOR, DC_USE_TRANSFORMER_RATIO, SHUNT_COMPENSATOR_VOLTAGE_CO
|
|
|
41
41
|
import { advancedParams } from "./load-flow-advanced-parameters.js";
|
|
42
42
|
var TabValues = /* @__PURE__ */ ((TabValues2) => {
|
|
43
43
|
TabValues2["GENERAL"] = "General";
|
|
44
|
+
TabValues2["LIMIT_REDUCTIONS"] = "LimitReductions";
|
|
44
45
|
TabValues2["ADVANCED"] = "Advanced";
|
|
45
46
|
TabValues2["PROVIDER_SPECIFIC"] = "ProviderSpecific";
|
|
46
|
-
TabValues2["LIMIT_REDUCTIONS"] = "LimitReductions";
|
|
47
47
|
return TabValues2;
|
|
48
48
|
})(TabValues || {});
|
|
49
|
+
const TAB_FIELDS = {
|
|
50
|
+
[
|
|
51
|
+
"General"
|
|
52
|
+
/* GENERAL */
|
|
53
|
+
]: [COMMON_PARAMETERS],
|
|
54
|
+
[
|
|
55
|
+
"ProviderSpecific"
|
|
56
|
+
/* PROVIDER_SPECIFIC */
|
|
57
|
+
]: [SPECIFIC_PARAMETERS],
|
|
58
|
+
[
|
|
59
|
+
"Advanced"
|
|
60
|
+
/* ADVANCED */
|
|
61
|
+
]: [ADVANCED_PARAMETERS],
|
|
62
|
+
[
|
|
63
|
+
"LimitReductions"
|
|
64
|
+
/* LIMIT_REDUCTIONS */
|
|
65
|
+
]: [LIMIT_REDUCTIONS_FORM]
|
|
66
|
+
};
|
|
49
67
|
const getBasicLoadFlowParametersFormSchema = () => {
|
|
50
68
|
return yup.object().shape({
|
|
51
69
|
[PHASE_SHIFTER_REGULATION_ON]: yup.boolean().required(),
|
|
@@ -133,6 +151,7 @@ function splitCommonParameters(commonParameters) {
|
|
|
133
151
|
);
|
|
134
152
|
}
|
|
135
153
|
export {
|
|
154
|
+
TAB_FIELDS,
|
|
136
155
|
TabValues,
|
|
137
156
|
getAdvancedLoadFlowParametersFormSchema,
|
|
138
157
|
getAdvancedLoadFlowParametersFormSchemaFields,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useForm } from "react-hook-form";
|
|
2
2
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
3
|
-
import { useState, useRef,
|
|
3
|
+
import { useState, useRef, useMemo, useEffect, useCallback, useEffectEvent } from "react";
|
|
4
4
|
import * as yup from "yup";
|
|
5
|
-
import {
|
|
5
|
+
import { getAdvancedLoadFlowParametersFormSchema, getCommonLoadFlowParametersFormSchema, splitCommonParameters, mapLimitReductions, TabValues, TAB_FIELDS, setLimitReductions } from "./load-flow-parameters-utils.js";
|
|
6
6
|
import "react/jsx-runtime";
|
|
7
7
|
import "@mui/material";
|
|
8
8
|
import "@mui/icons-material";
|
|
@@ -41,23 +41,19 @@ import "../common/widget/parameter-line-slider.js";
|
|
|
41
41
|
import { getLimitReductionsFormSchema, LIMIT_REDUCTIONS_FORM, toFormValuesLimitReductions } from "../common/limitreductions/columns-definitions.js";
|
|
42
42
|
import "../common/contingency-table/contingency-table.js";
|
|
43
43
|
import "../common/contingency-table/columns-definitions.js";
|
|
44
|
+
import { useTabs } from "../common/hook/use-tabs.js";
|
|
44
45
|
import "../../../components/composite/filter/HeaderFilterForm.js";
|
|
45
46
|
import { getNameElementEditorSchema, getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
|
|
46
47
|
import { PARAM_LIMIT_REDUCTION, PARAM_PROVIDER_OPENLOADFLOW } from "./constants.js";
|
|
47
48
|
import { getDefaultSpecificParamsValues, getSpecificParametersFormSchema, getAllSpecificParametersValues, formatSpecificParameters, setSpecificParameters } from "../common/utils.js";
|
|
48
49
|
const useLoadFlowParametersForm = (parametersBackend, isDeveloperMode, parametersUuid, name, description) => {
|
|
49
50
|
const { providers, params, updateParameters, specificParamsDescription, defaultLimitReductions } = parametersBackend;
|
|
50
|
-
const [selectedTab, setSelectedTab] = useState(TabValues.GENERAL);
|
|
51
51
|
const [limitReductionNumber, setLimitReductionNumber] = useState(0);
|
|
52
|
-
const [tabIndexesWithError, setTabIndexesWithError] = useState([]);
|
|
53
52
|
const [specificParametersDescriptionForProvider, setSpecificParametersDescriptionForProvider] = useState(() => {
|
|
54
53
|
return params?.provider && specificParamsDescription ? specificParamsDescription[params.provider] : [];
|
|
55
54
|
});
|
|
56
55
|
const { snackError } = useSnackMessage();
|
|
57
56
|
const previousWatchProviderRef = useRef(void 0);
|
|
58
|
-
const handleTabChange = useCallback((event, newValue) => {
|
|
59
|
-
setSelectedTab(newValue);
|
|
60
|
-
}, []);
|
|
61
57
|
const specificParametersDefaultValues = useMemo(() => {
|
|
62
58
|
return getDefaultSpecificParamsValues(specificParametersDescriptionForProvider);
|
|
63
59
|
}, [specificParametersDescriptionForProvider]);
|
|
@@ -178,29 +174,19 @@ const useLoadFlowParametersForm = (parametersBackend, isDeveloperMode, parameter
|
|
|
178
174
|
label: value
|
|
179
175
|
}));
|
|
180
176
|
}, [providers, isDeveloperMode]);
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
tabsInError.push(TabValues.PROVIDER_SPECIFIC);
|
|
193
|
-
}
|
|
194
|
-
if (errors?.[ADVANCED_PARAMETERS] && TabValues.ADVANCED !== selectedTab) {
|
|
195
|
-
tabsInError.push(TabValues.ADVANCED);
|
|
196
|
-
}
|
|
197
|
-
setTabIndexesWithError(tabsInError);
|
|
198
|
-
},
|
|
199
|
-
[selectedTab]
|
|
200
|
-
);
|
|
177
|
+
const {
|
|
178
|
+
selectedTab,
|
|
179
|
+
onTabChange: handleTabChange,
|
|
180
|
+
tabsWithError: tabIndexesWithError,
|
|
181
|
+
onError: onValidationError
|
|
182
|
+
} = useTabs({
|
|
183
|
+
defaultTab: TabValues.GENERAL,
|
|
184
|
+
tabEnum: TabValues,
|
|
185
|
+
errors: formMethods.formState.errors,
|
|
186
|
+
tabFields: TAB_FIELDS
|
|
187
|
+
});
|
|
201
188
|
const onSaveInline = useCallback(
|
|
202
189
|
(formData) => {
|
|
203
|
-
setTabIndexesWithError([]);
|
|
204
190
|
updateParameters(formatNewParams(formData));
|
|
205
191
|
},
|
|
206
192
|
[updateParameters, formatNewParams]
|
|
@@ -208,7 +194,6 @@ const useLoadFlowParametersForm = (parametersBackend, isDeveloperMode, parameter
|
|
|
208
194
|
const onSaveDialog = useCallback(
|
|
209
195
|
(formData) => {
|
|
210
196
|
if (parametersUuid) {
|
|
211
|
-
setTabIndexesWithError([]);
|
|
212
197
|
updateParameter(
|
|
213
198
|
parametersUuid,
|
|
214
199
|
formatNewParams(formData),
|
package/dist/features/parameters/network-visualizations/network-visualizations-parameters-dialog.js
CHANGED
|
@@ -62,6 +62,7 @@ function NetworkVisualizationsParametersEditionDialog({
|
|
|
62
62
|
open,
|
|
63
63
|
onClose,
|
|
64
64
|
onSave: networkVisuMethods.onSaveDialog,
|
|
65
|
+
onValidationError: networkVisuMethods.onValidationError,
|
|
65
66
|
formContext: {
|
|
66
67
|
...networkVisuMethods.formMethods,
|
|
67
68
|
validationSchema: networkVisuMethods.formSchema,
|
package/dist/features/parameters/network-visualizations/network-visualizations-parameters-inline.js
CHANGED
|
@@ -91,7 +91,7 @@ function NetworkVisualizationParametersInline({
|
|
|
91
91
|
parameterFormatter: (newParams) => newParams
|
|
92
92
|
},
|
|
93
93
|
selectParameterHandler: handleLoadParameters,
|
|
94
|
-
validateHandler: handleSubmit(networkVisuMethods.onSaveInline),
|
|
94
|
+
validateHandler: handleSubmit(networkVisuMethods.onSaveInline, networkVisuMethods.onValidationError),
|
|
95
95
|
children: /* @__PURE__ */ jsx(NetworkVisualizationParametersForm, { userProfile, networkVisuMethods })
|
|
96
96
|
}
|
|
97
97
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseFormReturn } from 'react-hook-form';
|
|
1
|
+
import { FieldErrors, UseFormReturn } from 'react-hook-form';
|
|
2
2
|
import { SyntheticEvent } from 'react';
|
|
3
3
|
import { UUID } from 'node:crypto';
|
|
4
4
|
import { NetworkVisualizationTabValues as TabValues } from './constants';
|
|
@@ -12,6 +12,8 @@ export interface UseNetworkVisualizationParametersFormReturn {
|
|
|
12
12
|
paramsLoading: boolean;
|
|
13
13
|
onSaveInline: (formData: Record<string, any>) => void;
|
|
14
14
|
onSaveDialog: (formData: Record<string, any>) => void;
|
|
15
|
+
tabIndexesWithError: TabValues[];
|
|
16
|
+
onValidationError: (errors: FieldErrors) => void;
|
|
15
17
|
}
|
|
16
18
|
type UseNetworkVisualizationParametersFormProps = {
|
|
17
19
|
parametersUuid: UUID;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useForm } from "react-hook-form";
|
|
2
2
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
3
|
-
import { useState,
|
|
3
|
+
import { useState, useMemo, useCallback, useEffect } from "react";
|
|
4
4
|
import * as yup from "yup";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "@mui/material";
|
|
@@ -39,6 +39,11 @@ import "react-papaparse";
|
|
|
39
39
|
import { NetworkVisualizationTabValues, PARAM_NAD_POSITIONS_GENERATION_MODE, PARAM_STATE_ESTIMATION, PARAM_COMPONENT_LIBRARY, PARAM_SUBSTATION_LAYOUT, PARAM_CENTER_LABEL, PARAM_DIAGONAL_LABEL, PARAM_MAP_BASEMAP, PARAM_MAP_MANUAL_REFRESH, PARAM_LINE_FLOW_MODE, PARAM_LINE_PARALLEL_PATH, PARAM_LINE_FULL_PATH } from "./constants.js";
|
|
40
40
|
import "../../../components/composite/filter/HeaderFilterForm.js";
|
|
41
41
|
import { getNameElementEditorSchema, getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
|
|
42
|
+
import "../common/parameter-layout/parameter-layout-provider.js";
|
|
43
|
+
import "../common/widget/parameter-line-slider.js";
|
|
44
|
+
import "../common/contingency-table/contingency-table.js";
|
|
45
|
+
import "../common/contingency-table/columns-definitions.js";
|
|
46
|
+
import { useTabs } from "../common/hook/use-tabs.js";
|
|
42
47
|
const useNetworkVisualizationParametersForm = ({
|
|
43
48
|
parametersUuid,
|
|
44
49
|
name,
|
|
@@ -46,12 +51,8 @@ const useNetworkVisualizationParametersForm = ({
|
|
|
46
51
|
studyUuid,
|
|
47
52
|
parameters
|
|
48
53
|
}) => {
|
|
49
|
-
const [selectedTab, setSelectedTab] = useState(NetworkVisualizationTabValues.MAP);
|
|
50
54
|
const [paramsLoading, setParamsLoading] = useState(false);
|
|
51
55
|
const { snackError } = useSnackMessage();
|
|
52
|
-
const handleTabChange = useCallback((event, newValue) => {
|
|
53
|
-
setSelectedTab(newValue);
|
|
54
|
-
}, []);
|
|
55
56
|
const formSchema = useMemo(() => {
|
|
56
57
|
return yup.object({
|
|
57
58
|
[NetworkVisualizationTabValues.MAP]: yup.object().shape({
|
|
@@ -97,6 +98,16 @@ const useNetworkVisualizationParametersForm = ({
|
|
|
97
98
|
resolver: yupResolver(formSchema)
|
|
98
99
|
});
|
|
99
100
|
const { reset } = formMethods;
|
|
101
|
+
const {
|
|
102
|
+
selectedTab,
|
|
103
|
+
onTabChange: handleTabChange,
|
|
104
|
+
tabsWithError: tabIndexesWithError,
|
|
105
|
+
onError: onValidationError
|
|
106
|
+
} = useTabs({
|
|
107
|
+
defaultTab: NetworkVisualizationTabValues.MAP,
|
|
108
|
+
tabEnum: NetworkVisualizationTabValues,
|
|
109
|
+
errors: formMethods.formState.errors
|
|
110
|
+
});
|
|
100
111
|
const onSaveInline = useCallback(
|
|
101
112
|
(formData) => {
|
|
102
113
|
if (studyUuid) {
|
|
@@ -150,7 +161,9 @@ const useNetworkVisualizationParametersForm = ({
|
|
|
150
161
|
handleTabChange,
|
|
151
162
|
paramsLoading,
|
|
152
163
|
onSaveInline,
|
|
153
|
-
onSaveDialog
|
|
164
|
+
onSaveDialog,
|
|
165
|
+
tabIndexesWithError,
|
|
166
|
+
onValidationError
|
|
154
167
|
};
|
|
155
168
|
};
|
|
156
169
|
export {
|
|
@@ -10,7 +10,7 @@ export declare const LOW_VOLTAGE_ABSOLUTE_THRESHOLD = "lowVoltageAbsoluteThresho
|
|
|
10
10
|
export declare const HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD = "highVoltageProportionalThreshold";
|
|
11
11
|
export declare const HIGH_VOLTAGE_ABSOLUTE_THRESHOLD = "highVoltageAbsoluteThreshold";
|
|
12
12
|
export declare enum TabValues {
|
|
13
|
-
Contingencies =
|
|
14
|
-
Aggravation =
|
|
15
|
-
LimitReductions =
|
|
13
|
+
Contingencies = "Contingencies",
|
|
14
|
+
Aggravation = "Aggravation",
|
|
15
|
+
LimitReductions = "LimitReductions"
|
|
16
16
|
}
|
|
@@ -4,9 +4,9 @@ const LOW_VOLTAGE_ABSOLUTE_THRESHOLD = "lowVoltageAbsoluteThreshold";
|
|
|
4
4
|
const HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD = "highVoltageProportionalThreshold";
|
|
5
5
|
const HIGH_VOLTAGE_ABSOLUTE_THRESHOLD = "highVoltageAbsoluteThreshold";
|
|
6
6
|
var TabValues = /* @__PURE__ */ ((TabValues2) => {
|
|
7
|
-
TabValues2[
|
|
8
|
-
TabValues2[
|
|
9
|
-
TabValues2[
|
|
7
|
+
TabValues2["Contingencies"] = "Contingencies";
|
|
8
|
+
TabValues2["Aggravation"] = "Aggravation";
|
|
9
|
+
TabValues2["LimitReductions"] = "LimitReductions";
|
|
10
10
|
return TabValues2;
|
|
11
11
|
})(TabValues || {});
|
|
12
12
|
export {
|
package/dist/features/parameters/security-analysis/security-analysis-parameters-content.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ForwardedRef } from 'react';
|
|
2
2
|
import { UUID } from 'node:crypto';
|
|
3
|
-
import {
|
|
3
|
+
import { ContingencyTableApi } from '../common';
|
|
4
4
|
import { ContingencyCount } from '../common/contingency-table/types';
|
|
5
|
-
import {
|
|
6
|
-
export declare function SecurityAnalysisParametersContent({
|
|
7
|
-
|
|
8
|
-
currentProvider?: string;
|
|
9
|
-
defaultLimitReductions: ILimitReductionsByVoltageLevel[];
|
|
5
|
+
import { UseSecurityAnalysisParametersFormReturn } from './use-security-analysis-parameters-form';
|
|
6
|
+
export declare function SecurityAnalysisParametersContent({ securityAnalysisMethods, showContingencyCount, fetchContingencyCount, contingencyTableApiRef, isBuiltCurrentNode, }: Readonly<{
|
|
7
|
+
securityAnalysisMethods: UseSecurityAnalysisParametersFormReturn;
|
|
10
8
|
showContingencyCount: boolean;
|
|
11
9
|
fetchContingencyCount?: (contingencyListIds: UUID[] | null, abortSignal: AbortSignal) => Promise<ContingencyCount>;
|
|
12
10
|
contingencyTableApiRef?: ForwardedRef<ContingencyTableApi>;
|