@gridsuite/commons-ui 0.281.0 → 0.282.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/components/composite/customAGGrid/custom-aggrid-filters/hooks/use-custom-aggrid-comparator-filter.js +1 -0
  2. package/dist/components/composite/customAGGrid/hooks/use-custom-aggrid-sort.js +1 -0
  3. package/dist/components/composite/reactQueryBuilder/OperatorSelector.js +1 -0
  4. package/dist/components/composite/report/QuickSearch.js +1 -0
  5. package/dist/components/composite/report/report-viewer/log-table/log-table.js +1 -1
  6. package/dist/components/ui/directoryItemSelector/DirectoryItemSelector.js +1 -0
  7. package/dist/features/index.js +12 -9
  8. package/dist/features/network-modification-table/network-modifications-table.js +1 -0
  9. package/dist/features/network-modification-table/renderers/reference-link-cell.js +1 -1
  10. package/dist/features/network-modification-table/renderers/root-network-chip-cell.js +1 -0
  11. package/dist/features/network-modification-table/renderers/switch-cell.js +1 -0
  12. package/dist/features/network-modification-table/row/drag-row-clone.js +1 -0
  13. package/dist/features/network-modification-table/use-modifications-drag-and-drop.js +1 -0
  14. package/dist/features/network-modifications/battery/modification/BatteryDialogTabs.d.ts +3 -3
  15. package/dist/features/network-modifications/battery/modification/BatteryDialogTabs.js +2 -2
  16. package/dist/features/network-modifications/battery/modification/BatteryModificationForm.d.ts +4 -1
  17. package/dist/features/network-modifications/battery/modification/BatteryModificationForm.js +7 -11
  18. package/dist/features/network-modifications/generator/modification/GeneratorDialogTabs.d.ts +3 -3
  19. package/dist/features/network-modifications/generator/modification/GeneratorDialogTabs.js +2 -2
  20. package/dist/features/network-modifications/generator/modification/GeneratorModificationForm.d.ts +4 -1
  21. package/dist/features/network-modifications/generator/modification/GeneratorModificationForm.js +4 -8
  22. package/dist/features/network-modifications/index.d.ts +0 -1
  23. package/dist/features/network-modifications/index.js +3 -3
  24. package/dist/features/network-modifications/line/common/LineDialogTabs.d.ts +3 -3
  25. package/dist/features/network-modifications/line/common/LineDialogTabs.js +2 -2
  26. package/dist/features/network-modifications/line/common/LineForm.d.ts +4 -1
  27. package/dist/features/network-modifications/line/common/LineForm.js +7 -11
  28. package/dist/features/network-modifications/line/common/line.utils.d.ts +1 -1
  29. package/dist/features/network-modifications/load/common/LoadDialogTabs.d.ts +3 -3
  30. package/dist/features/network-modifications/load/common/LoadDialogTabs.js +2 -2
  31. package/dist/features/network-modifications/load/common/LoadForm.d.ts +4 -1
  32. package/dist/features/network-modifications/load/common/LoadForm.js +7 -11
  33. package/dist/features/network-modifications/static-var-compensator/common/static-var-compensator-dialog-tabs.d.ts +3 -2
  34. package/dist/features/network-modifications/static-var-compensator/common/static-var-compensator-dialog-tabs.js +2 -2
  35. package/dist/features/network-modifications/static-var-compensator/creation/static-var-compensator-creation-form.d.ts +4 -1
  36. package/dist/features/network-modifications/static-var-compensator/creation/static-var-compensator-creation-form.js +8 -11
  37. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabs.d.ts +3 -3
  38. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabs.js +2 -2
  39. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerForm.d.ts +4 -1
  40. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerForm.js +7 -11
  41. package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.d.ts +4 -7
  42. package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +16 -19
  43. package/dist/features/network-modifications/voltageLevel/creation/index.d.ts +1 -1
  44. package/dist/features/network-modifications/voltageLevel/creation/index.js +3 -1
  45. package/dist/features/network-modifications/voltageLevel/index.js +3 -1
  46. package/dist/features/parameters/common/hook/index.d.ts +0 -1
  47. package/dist/features/parameters/common/hook/index.js +1 -3
  48. package/dist/features/parameters/common/index.js +1 -3
  49. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.d.ts +1 -1
  50. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +4 -4
  51. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.d.ts +1 -0
  52. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.js +2 -0
  53. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +3 -3
  54. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.d.ts +1 -1
  55. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis.type.d.ts +1 -0
  56. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis.type.js +2 -0
  57. package/dist/features/parameters/dynamic-simulation/curve/dialog/curve-preview.js +1 -0
  58. package/dist/features/parameters/dynamic-simulation/curve/dialog/equipment-filter.js +1 -0
  59. package/dist/features/parameters/dynamic-simulation/dynamic-simulation-inline.js +3 -3
  60. package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.d.ts +1 -1
  61. package/dist/features/parameters/dynamic-simulation/dynamic-simulation.type.d.ts +1 -0
  62. package/dist/features/parameters/dynamic-simulation/dynamic-simulation.type.js +2 -0
  63. package/dist/features/parameters/index.js +10 -7
  64. package/dist/features/parameters/loadflow/load-flow-parameters-inline.js +1 -1
  65. package/dist/features/parameters/loadflow/load-flow-parameters-utils.d.ts +1 -0
  66. package/dist/features/parameters/loadflow/load-flow-parameters-utils.js +2 -0
  67. package/dist/features/parameters/loadflow/use-load-flow-parameters-form.js +3 -3
  68. package/dist/features/parameters/network-visualizations/constants.d.ts +1 -0
  69. package/dist/features/parameters/network-visualizations/constants.js +2 -0
  70. package/dist/features/parameters/network-visualizations/index.js +2 -1
  71. package/dist/features/parameters/network-visualizations/network-visualizations-parameters-inline.js +1 -1
  72. package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.js +3 -7
  73. package/dist/features/parameters/pcc-min/pcc-min-parameters-inline.js +1 -1
  74. package/dist/features/parameters/security-analysis/constants.d.ts +1 -0
  75. package/dist/features/parameters/security-analysis/constants.js +2 -0
  76. package/dist/features/parameters/security-analysis/index.js +2 -1
  77. package/dist/features/parameters/security-analysis/security-analysis-parameters-content.js +1 -1
  78. package/dist/features/parameters/security-analysis/security-analysis-parameters-dialog.js +1 -1
  79. package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.js +3 -3
  80. package/dist/features/parameters/sensi/columns-definitions.d.ts +2 -0
  81. package/dist/features/parameters/sensi/columns-definitions.js +36 -1
  82. package/dist/features/parameters/sensi/index.js +3 -1
  83. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-dialog.js +1 -1
  84. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-form.js +2 -1
  85. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-inline.js +4 -1
  86. package/dist/features/parameters/sensi/sensitivity-parameters-selector.d.ts +3 -1
  87. package/dist/features/parameters/sensi/sensitivity-parameters-selector.js +19 -35
  88. package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.d.ts +9 -1
  89. package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.js +29 -1
  90. package/dist/features/parameters/short-circuit/short-circuit-parameters-inline.js +1 -1
  91. package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.d.ts +1 -0
  92. package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.js +2 -0
  93. package/dist/features/parameters/short-circuit/use-short-circuit-parameters-form.js +3 -3
  94. package/dist/features/parameters/voltage-init/constants.d.ts +1 -0
  95. package/dist/features/parameters/voltage-init/constants.js +2 -0
  96. package/dist/features/parameters/voltage-init/index.js +2 -1
  97. package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -8
  98. package/dist/features/parameters/voltage-init/voltage-init-parameters-inline.js +1 -1
  99. package/dist/features/process-configs/loadflow/lf-process-config-edition.js +7 -1
  100. package/dist/features/process-configs/security-analysis/sa-process-config-edition.js +7 -1
  101. package/dist/features/process-configs/shortcircuit/sc-process-config-edition.js +7 -1
  102. package/dist/features/results/loadflow/limit-violation-result.js +1 -1
  103. package/dist/features/results/shortcircuit/shortcircuit-analysis-result.js +1 -1
  104. package/dist/hooks/index.d.ts +1 -0
  105. package/dist/hooks/index.js +3 -1
  106. package/dist/hooks/use-tabs.d.ts +33 -0
  107. package/dist/hooks/use-tabs.js +55 -0
  108. package/dist/index.js +13 -8
  109. package/package.json +1 -1
  110. package/dist/features/network-modifications/hooks/index.d.ts +0 -7
  111. package/dist/features/network-modifications/hooks/index.js +0 -4
  112. package/dist/features/network-modifications/hooks/useTabsWithError.d.ts +0 -15
  113. package/dist/features/network-modifications/hooks/useTabsWithError.js +0 -28
  114. package/dist/features/parameters/common/hook/use-tabs.d.ts +0 -16
  115. package/dist/features/parameters/common/hook/use-tabs.js +0 -65
@@ -1,36 +1,32 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Stack, Grid } from "@mui/material";
3
- import { LoadDialogTab, LOAD_TAB_FIELDS } from "./load.utils.js";
4
3
  import { LoadDialogHeader } from "./LoadDialogHeader.js";
5
4
  import { LoadDialogTabs } from "./LoadDialogTabs.js";
6
5
  import { LoadDialogTabsContent } from "./LoadDialogTabsContent.js";
7
- import { useTabsWithError } from "../../hooks/useTabsWithError.js";
8
6
  function LoadForm({
9
7
  loadToModify,
10
8
  isModification,
11
9
  voltageLevelOptions,
12
10
  fetchBusesOrBusbarSections,
13
- PositionDiagramPane
11
+ PositionDiagramPane,
12
+ useTabsReturn
14
13
  }) {
15
- const { tabIndex, setTabIndex, tabIndexesWithError } = useTabsWithError(
16
- LOAD_TAB_FIELDS,
17
- LoadDialogTab.CONNECTIVITY_TAB
18
- );
14
+ const { selectedTab, tabsWithError, onTabChange } = useTabsReturn;
19
15
  return /* @__PURE__ */ jsxs(Stack, { spacing: 2, children: [
20
16
  /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(LoadDialogHeader, { loadToModify, isModification }) }),
21
17
  /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(
22
18
  LoadDialogTabs,
23
19
  {
24
- tabIndex,
25
- tabIndexesWithError,
26
- setTabIndex,
20
+ tabIndex: selectedTab,
21
+ tabIndexesWithError: tabsWithError,
22
+ onTabChange,
27
23
  isModification
28
24
  }
29
25
  ) }),
30
26
  /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(
31
27
  LoadDialogTabsContent,
32
28
  {
33
- tabIndex,
29
+ tabIndex: selectedTab,
34
30
  loadToModify,
35
31
  isModification,
36
32
  voltageLevelOptions,
@@ -1,7 +1,8 @@
1
+ import { SyntheticEvent } from 'react';
1
2
  import { StaticVarCompensatorDialogTab } from './static-var-compensator-tab-utils';
2
3
  export interface StaticVarCompensatorCreationDialogTabsProps {
3
4
  tabIndex: number;
4
5
  tabIndexesWithError: StaticVarCompensatorDialogTab[];
5
- setTabIndex: (newValue: StaticVarCompensatorDialogTab) => void;
6
+ onTabChange: (event: SyntheticEvent<Element, Event>, newValue: number) => void;
6
7
  }
7
- export declare function StaticVarCompensatorDialogTabs({ tabIndex, tabIndexesWithError, setTabIndex, }: StaticVarCompensatorCreationDialogTabsProps): import("react").JSX.Element;
8
+ export declare function StaticVarCompensatorDialogTabs({ tabIndex, tabIndexesWithError, onTabChange, }: StaticVarCompensatorCreationDialogTabsProps): import("react").JSX.Element;
@@ -6,9 +6,9 @@ import { StaticVarCompensatorDialogTab } from "./static-var-compensator-tab-util
6
6
  function StaticVarCompensatorDialogTabs({
7
7
  tabIndex,
8
8
  tabIndexesWithError,
9
- setTabIndex
9
+ onTabChange
10
10
  }) {
11
- return /* @__PURE__ */ jsx(Grid, { container: true, sx: { width: "100%" }, children: /* @__PURE__ */ jsxs(Tabs, { value: tabIndex, onChange: (event, newValue) => setTabIndex(newValue), children: [
11
+ return /* @__PURE__ */ jsx(Grid, { container: true, sx: { width: "100%" }, children: /* @__PURE__ */ jsxs(Tabs, { value: tabIndex, onChange: onTabChange, children: [
12
12
  /* @__PURE__ */ jsx(
13
13
  Tab,
14
14
  {
@@ -1,8 +1,11 @@
1
1
  import { ConnectivityNetworkProps } from '../../common';
2
+ import { StaticVarCompensatorDialogTab } from '../common/static-var-compensator-tab-utils';
2
3
  import { EquipmentType, Identifiable } from '../../../../utils';
4
+ import { UseTabsReturn } from '../../../../hooks';
3
5
  export interface StaticVarCompensatorCreationFormProps extends ConnectivityNetworkProps {
4
6
  fetchVoltageLevelEquipments: (voltageLevelId: string) => Promise<(Identifiable & {
5
7
  type: EquipmentType;
6
8
  })[]>;
9
+ useTabsReturn: UseTabsReturn<StaticVarCompensatorDialogTab>;
7
10
  }
8
- export declare function StaticVarCompensatorCreationForm({ voltageLevelOptions, PositionDiagramPane, fetchBusesOrBusbarSections, fetchVoltageLevelEquipments, }: StaticVarCompensatorCreationFormProps): import("react").JSX.Element;
11
+ export declare function StaticVarCompensatorCreationForm({ voltageLevelOptions, PositionDiagramPane, fetchBusesOrBusbarSections, fetchVoltageLevelEquipments, useTabsReturn, }: StaticVarCompensatorCreationFormProps): import("react").JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Stack, Box } from "@mui/material";
3
- import { StaticVarCompensatorDialogTab, STATIC_VAR_COMPENSATOR_TAB_FIELDS } from "../common/static-var-compensator-tab-utils.js";
4
3
  import { StaticVarCompensatorDialogHeader } from "../common/static-var-compensator-dialog-header.js";
5
4
  import { StaticVarCompensatorDialogTabs } from "../common/static-var-compensator-dialog-tabs.js";
5
+ import "../common/static-var-compensator-tab-utils.js";
6
6
  import "yup";
7
7
  import "../../../../utils/conversionUtils.js";
8
8
  import "../../../../utils/types/equipmentType.js";
@@ -67,25 +67,22 @@ import "../../common/currentLimits/limitsPane.utils.js";
67
67
  import "../../shunt-compensator/creation/shuntCompensatorCreation.utils.js";
68
68
  import "../../shunt-compensator/modification/shuntCompensatorModification.utils.js";
69
69
  import { StaticVarCompensatorTabsContent } from "../common/static-var-compensator-tabs-content.js";
70
- import { useTabsWithError } from "../../hooks/useTabsWithError.js";
71
70
  function StaticVarCompensatorCreationForm({
72
71
  voltageLevelOptions,
73
72
  PositionDiagramPane,
74
73
  fetchBusesOrBusbarSections,
75
- fetchVoltageLevelEquipments
74
+ fetchVoltageLevelEquipments,
75
+ useTabsReturn
76
76
  }) {
77
- const { tabIndex, setTabIndex, tabIndexesWithError } = useTabsWithError(
78
- STATIC_VAR_COMPENSATOR_TAB_FIELDS,
79
- StaticVarCompensatorDialogTab.CONNECTIVITY_TAB
80
- );
77
+ const { selectedTab, tabsWithError, onTabChange } = useTabsReturn;
81
78
  return /* @__PURE__ */ jsxs(Stack, { spacing: 2, children: [
82
79
  /* @__PURE__ */ jsx(StaticVarCompensatorDialogHeader, {}),
83
80
  /* @__PURE__ */ jsx(
84
81
  StaticVarCompensatorDialogTabs,
85
82
  {
86
- tabIndex,
87
- tabIndexesWithError,
88
- setTabIndex
83
+ tabIndex: selectedTab,
84
+ tabIndexesWithError: tabsWithError,
85
+ onTabChange
89
86
  }
90
87
  ),
91
88
  /* @__PURE__ */ jsx(Box, { sx: { flexGrow: 1, overflowY: "auto", overflowX: "hidden", paddingRight: 3 }, children: /* @__PURE__ */ jsx(
@@ -95,7 +92,7 @@ function StaticVarCompensatorCreationForm({
95
92
  PositionDiagramPane,
96
93
  fetchBusesOrBusbarSections,
97
94
  fetchVoltageLevelEquipments,
98
- tabIndex
95
+ tabIndex: selectedTab
99
96
  }
100
97
  ) })
101
98
  ] });
@@ -1,9 +1,9 @@
1
- import { default as React } from 'react';
1
+ import { SyntheticEvent } from 'react';
2
2
  interface TwoWindingsTransformerDialogProps {
3
3
  tabIndex: number;
4
4
  tabIndexesWithError: number[];
5
- setTabIndex: (newTabIndex: number) => void;
5
+ onTabChange: (event: SyntheticEvent<Element, Event>, newValue: number) => void;
6
6
  isModification?: boolean;
7
7
  }
8
- export declare function TwoWindingsTransformerDialogTabs({ tabIndex, tabIndexesWithError, setTabIndex, isModification, }: Readonly<TwoWindingsTransformerDialogProps>): React.JSX.Element;
8
+ export declare function TwoWindingsTransformerDialogTabs({ tabIndex, tabIndexesWithError, onTabChange, isModification, }: Readonly<TwoWindingsTransformerDialogProps>): import("react").JSX.Element;
9
9
  export {};
@@ -11,7 +11,7 @@ import "@mui/icons-material";
11
11
  function TwoWindingsTransformerDialogTabs({
12
12
  tabIndex,
13
13
  tabIndexesWithError,
14
- setTabIndex,
14
+ onTabChange,
15
15
  isModification = false
16
16
  }) {
17
17
  const phaseTapChangerEnabledWatch = useWatch({
@@ -25,7 +25,7 @@ function TwoWindingsTransformerDialogTabs({
25
25
  {
26
26
  value: tabIndex,
27
27
  variant: "scrollable",
28
- onChange: (event, newValue) => setTabIndex(newValue),
28
+ onChange: onTabChange,
29
29
  slotProps: {
30
30
  indicator: { sx: getTabIndicatorStyle(tabIndexesWithError, tabIndex) }
31
31
  },
@@ -1,6 +1,9 @@
1
1
  import { TwoWindingsTransformerDialogHeaderProps } from './TwoWindingsTransformerDialogHeader';
2
+ import { TwoWindingsTransformerDialogTab } from './twoWindingsTransformer.utils';
2
3
  import { TwoWindingsTransformerDialogTabsContentProps } from './TwoWindingsTransformerDialogTabsContent';
4
+ import { UseTabsReturn } from '../../../../hooks';
3
5
  interface TwoWindingsTransformerFormProps extends TwoWindingsTransformerDialogHeaderProps, Omit<TwoWindingsTransformerDialogTabsContentProps, 'tabIndex' | 'isModification' | 'twtToModify'> {
6
+ useTabsReturn: UseTabsReturn<TwoWindingsTransformerDialogTab>;
4
7
  }
5
- export declare function TwoWindingsTransformerForm({ twtToModify, voltageLevelOptions, fetchBusesOrBusbarSections, PositionDiagramPane, fetchVoltageLevelEquipments, editData, isModification, }: Readonly<TwoWindingsTransformerFormProps>): import("react").JSX.Element;
8
+ export declare function TwoWindingsTransformerForm({ twtToModify, voltageLevelOptions, fetchBusesOrBusbarSections, PositionDiagramPane, fetchVoltageLevelEquipments, editData, isModification, useTabsReturn, }: Readonly<TwoWindingsTransformerFormProps>): import("react").JSX.Element;
6
9
  export {};
@@ -1,8 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Stack, Box } from "@mui/material";
3
3
  import { TwoWindingsTransformerDialogHeader } from "./TwoWindingsTransformerDialogHeader.js";
4
- import { useTabsWithError } from "../../hooks/useTabsWithError.js";
5
- import { TwoWindingsTransformerDialogTab, TWT_TAB_FIELDS } from "./twoWindingsTransformer.utils.js";
6
4
  import { TwoWindingsTransformerDialogTabs } from "./TwoWindingsTransformerDialogTabs.js";
7
5
  import { TwoWindingsTransformerDialogTabsContent } from "./TwoWindingsTransformerDialogTabsContent.js";
8
6
  function TwoWindingsTransformerForm({
@@ -12,27 +10,25 @@ function TwoWindingsTransformerForm({
12
10
  PositionDiagramPane,
13
11
  fetchVoltageLevelEquipments,
14
12
  editData,
15
- isModification = false
13
+ isModification = false,
14
+ useTabsReturn
16
15
  }) {
17
- const { tabIndex, setTabIndex, tabIndexesWithError } = useTabsWithError(
18
- TWT_TAB_FIELDS,
19
- TwoWindingsTransformerDialogTab.CONNECTIVITY_TAB
20
- );
16
+ const { selectedTab, tabsWithError, onTabChange } = useTabsReturn;
21
17
  return /* @__PURE__ */ jsxs(Stack, { spacing: 2, height: "100%", children: [
22
18
  /* @__PURE__ */ jsx(TwoWindingsTransformerDialogHeader, { twtToModify, isModification }),
23
19
  /* @__PURE__ */ jsx(
24
20
  TwoWindingsTransformerDialogTabs,
25
21
  {
26
- tabIndex,
27
- tabIndexesWithError,
28
- setTabIndex,
22
+ tabIndex: selectedTab,
23
+ tabIndexesWithError: tabsWithError,
24
+ onTabChange,
29
25
  isModification
30
26
  }
31
27
  ),
32
28
  /* @__PURE__ */ jsx(Box, { sx: { flexGrow: 1, overflowY: "auto", overflowX: "hidden", paddingRight: 3 }, children: /* @__PURE__ */ jsx(
33
29
  TwoWindingsTransformerDialogTabsContent,
34
30
  {
35
- tabIndex,
31
+ tabIndex: selectedTab,
36
32
  twtToModify,
37
33
  voltageLevelOptions,
38
34
  fetchBusesOrBusbarSections,
@@ -1,11 +1,8 @@
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
- */
1
+ import { VoltageLevelTab } from './voltageLevel.constants';
2
+ import { UseTabsReturn } from '../../../../hooks';
7
3
  export interface VoltageLevelCreationFormProps {
8
4
  substationOptions?: string[];
9
5
  showDeleteSubstationButton?: boolean;
6
+ useTabsReturn: UseTabsReturn<VoltageLevelTab>;
10
7
  }
11
- export declare function VoltageLevelCreationForm({ substationOptions, showDeleteSubstationButton, }?: VoltageLevelCreationFormProps): import("react").JSX.Element;
8
+ export declare function VoltageLevelCreationForm({ substationOptions, showDeleteSubstationButton, useTabsReturn, }: VoltageLevelCreationFormProps): import("react").JSX.Element;
@@ -31,7 +31,7 @@ import "../../../../components/ui/snackbarProvider/SnackbarProvider.js";
31
31
  import "mui-nested-menu";
32
32
  import "react-resizable-panels";
33
33
  import "react-papaparse";
34
- import { VoltageLevelTab, VOLTAGE_LEVEL_TAB_FIELDS } from "./voltageLevel.constants.js";
34
+ import { VoltageLevelTab } from "./voltageLevel.constants.js";
35
35
  import "./voltageLevelCreation.utils.js";
36
36
  import { StructureTab } from "./tabs/structureTab/StructureTab.js";
37
37
  import { SubstationTab } from "./tabs/substationTab/SubstationTab.js";
@@ -71,15 +71,12 @@ import "@mui/material/colors";
71
71
  import "@mui/x-charts";
72
72
  import "../../common/currentLimits/limitsPane.utils.js";
73
73
  import { getTabStyle, getTabIndicatorStyle } from "../../../parameters/parameters-style.js";
74
- import { useTabsWithError } from "../../hooks/useTabsWithError.js";
75
74
  function VoltageLevelCreationForm({
76
75
  substationOptions,
77
- showDeleteSubstationButton = true
78
- } = {}) {
79
- const { tabIndex, setTabIndex, tabIndexesWithError } = useTabsWithError(
80
- VOLTAGE_LEVEL_TAB_FIELDS,
81
- VoltageLevelTab.SUBSTATION_TAB
82
- );
76
+ showDeleteSubstationButton = true,
77
+ useTabsReturn
78
+ }) {
79
+ const { selectedTab, tabsWithError, onTabChange } = useTabsReturn;
83
80
  const watchHideBusBarSection = useWatch({ name: FieldConstants.HIDE_BUS_BAR_SECTION });
84
81
  return /* @__PURE__ */ jsxs(Stack, { spacing: 2, children: [
85
82
  /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
@@ -96,12 +93,12 @@ function VoltageLevelCreationForm({
96
93
  /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsxs(
97
94
  Tabs,
98
95
  {
99
- value: tabIndex,
96
+ value: selectedTab,
100
97
  variant: "scrollable",
101
- onChange: (_, newValue) => setTabIndex(newValue),
98
+ onChange: onTabChange,
102
99
  slotProps: {
103
100
  indicator: {
104
- sx: getTabIndicatorStyle(tabIndexesWithError, tabIndex)
101
+ sx: getTabIndicatorStyle(tabsWithError, selectedTab)
105
102
  }
106
103
  },
107
104
  children: [
@@ -109,21 +106,21 @@ function VoltageLevelCreationForm({
109
106
  Tab,
110
107
  {
111
108
  label: /* @__PURE__ */ jsx(FormattedMessage, { id: "SubstationTab" }),
112
- sx: getTabStyle(tabIndexesWithError, VoltageLevelTab.SUBSTATION_TAB)
109
+ sx: getTabStyle(tabsWithError, VoltageLevelTab.SUBSTATION_TAB)
113
110
  }
114
111
  ),
115
112
  /* @__PURE__ */ jsx(
116
113
  Tab,
117
114
  {
118
115
  label: /* @__PURE__ */ jsx(FormattedMessage, { id: "CharacteristicsTab" }),
119
- sx: getTabStyle(tabIndexesWithError, VoltageLevelTab.CHARACTERISTICS_TAB)
116
+ sx: getTabStyle(tabsWithError, VoltageLevelTab.CHARACTERISTICS_TAB)
120
117
  }
121
118
  ),
122
119
  /* @__PURE__ */ jsx(
123
120
  Tab,
124
121
  {
125
122
  label: /* @__PURE__ */ jsx(FormattedMessage, { id: "StructureTab" }),
126
- sx: getTabStyle(tabIndexesWithError, VoltageLevelTab.STRUCTURE_TAB),
123
+ sx: getTabStyle(tabsWithError, VoltageLevelTab.STRUCTURE_TAB),
127
124
  disabled: watchHideBusBarSection
128
125
  }
129
126
  ),
@@ -131,23 +128,23 @@ function VoltageLevelCreationForm({
131
128
  Tab,
132
129
  {
133
130
  label: /* @__PURE__ */ jsx(FormattedMessage, { id: "AdditionalInformationTab" }),
134
- sx: getTabStyle(tabIndexesWithError, VoltageLevelTab.ADDITIONAL_INFORMATION_TAB)
131
+ sx: getTabStyle(tabsWithError, VoltageLevelTab.ADDITIONAL_INFORMATION_TAB)
135
132
  }
136
133
  )
137
134
  ]
138
135
  }
139
136
  ) }),
140
137
  /* @__PURE__ */ jsxs(Grid, { children: [
141
- /* @__PURE__ */ jsx(Box, { hidden: tabIndex !== VoltageLevelTab.SUBSTATION_TAB, children: /* @__PURE__ */ jsx(
138
+ /* @__PURE__ */ jsx(Box, { hidden: selectedTab !== VoltageLevelTab.SUBSTATION_TAB, children: /* @__PURE__ */ jsx(
142
139
  SubstationTab,
143
140
  {
144
141
  substationOptions,
145
142
  showDeleteButton: showDeleteSubstationButton
146
143
  }
147
144
  ) }),
148
- /* @__PURE__ */ jsx(Box, { hidden: tabIndex !== VoltageLevelTab.CHARACTERISTICS_TAB, children: /* @__PURE__ */ jsx(CharacteristicsTab, {}) }),
149
- /* @__PURE__ */ jsx(Box, { hidden: tabIndex !== VoltageLevelTab.STRUCTURE_TAB, children: /* @__PURE__ */ jsx(StructureTab, {}) }),
150
- /* @__PURE__ */ jsx(Box, { hidden: tabIndex !== VoltageLevelTab.ADDITIONAL_INFORMATION_TAB, children: /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "voltageLevel" }) })
145
+ /* @__PURE__ */ jsx(Box, { hidden: selectedTab !== VoltageLevelTab.CHARACTERISTICS_TAB, children: /* @__PURE__ */ jsx(CharacteristicsTab, {}) }),
146
+ /* @__PURE__ */ jsx(Box, { hidden: selectedTab !== VoltageLevelTab.STRUCTURE_TAB, children: /* @__PURE__ */ jsx(StructureTab, {}) }),
147
+ /* @__PURE__ */ jsx(Box, { hidden: selectedTab !== VoltageLevelTab.ADDITIONAL_INFORMATION_TAB, children: /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "voltageLevel" }) })
151
148
  ] })
152
149
  ] });
153
150
  }
@@ -5,7 +5,7 @@
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
7
  export { SwitchesBetweenSections } from './tabs';
8
- export { MAX_SECTIONS_COUNT } from './voltageLevel.constants';
8
+ export { MAX_SECTIONS_COUNT, VOLTAGE_LEVEL_TAB_FIELDS, VoltageLevelTab } from './voltageLevel.constants';
9
9
  export * from './VoltageLevelCreationForm';
10
10
  export * from './voltageLevelCreation.utils';
11
11
  export * from './voltageLevelCreation.types';
@@ -62,7 +62,7 @@ import "../../common/regulatingTerminal/RegulatingTerminalForm.js";
62
62
  import "@mui/material/colors";
63
63
  import "@mui/x-charts";
64
64
  import "../../common/currentLimits/limitsPane.utils.js";
65
- import { MAX_SECTIONS_COUNT } from "./voltageLevel.constants.js";
65
+ import { MAX_SECTIONS_COUNT, VOLTAGE_LEVEL_TAB_FIELDS, VoltageLevelTab } from "./voltageLevel.constants.js";
66
66
  import { VoltageLevelCreationForm } from "./VoltageLevelCreationForm.js";
67
67
  import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./voltageLevelCreation.utils.js";
68
68
  import { SwitchKind } from "./voltageLevelCreation.types.js";
@@ -71,7 +71,9 @@ export {
71
71
  SWITCH_TYPE,
72
72
  SwitchKind,
73
73
  SwitchesBetweenSections,
74
+ VOLTAGE_LEVEL_TAB_FIELDS,
74
75
  VoltageLevelCreationForm,
76
+ VoltageLevelTab,
75
77
  buildNewBusbarSections,
76
78
  getCreateSwitchesEmptyFormData,
77
79
  getCreateSwitchesValidationSchema,
@@ -64,7 +64,7 @@ import "../common/regulatingTerminal/RegulatingTerminalForm.js";
64
64
  import "@mui/material/colors";
65
65
  import "@mui/x-charts";
66
66
  import "../common/currentLimits/limitsPane.utils.js";
67
- import { MAX_SECTIONS_COUNT } from "./creation/voltageLevel.constants.js";
67
+ import { MAX_SECTIONS_COUNT, VOLTAGE_LEVEL_TAB_FIELDS, VoltageLevelTab } from "./creation/voltageLevel.constants.js";
68
68
  import { VoltageLevelCreationForm } from "./creation/VoltageLevelCreationForm.js";
69
69
  import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./creation/voltageLevelCreation.utils.js";
70
70
  import { SwitchKind } from "./creation/voltageLevelCreation.types.js";
@@ -98,9 +98,11 @@ export {
98
98
  SwitchKind,
99
99
  SwitchesBetweenSections,
100
100
  TOPOLOGY_MODIFICATION_TABLE,
101
+ VOLTAGE_LEVEL_TAB_FIELDS,
101
102
  VoltageLevelCreationForm,
102
103
  VoltageLevelModificationForm,
103
104
  VoltageLevelSectionCreationForm,
105
+ VoltageLevelTab,
104
106
  VoltageLevelTopologyModificationForm,
105
107
  buildNewBusbarSections,
106
108
  couplingDeviceCreationDtoToForm,
@@ -4,5 +4,4 @@
4
4
  * License, v. 2.0. If a copy of the MPL was not distributed with this
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
- export * from './use-tabs';
8
7
  export * from './use-parameters-form';
@@ -1,6 +1,4 @@
1
- import { useTabs } from "./use-tabs.js";
2
1
  import { useParametersForm } from "./use-parameters-form.js";
3
2
  export {
4
- useParametersForm,
5
- useTabs
3
+ useParametersForm
6
4
  };
@@ -21,7 +21,6 @@ import { LimitReductionTableRow } from "./limitreductions/limit-reduction-table-
21
21
  import { LimitReductionTableCell } from "./limitreductions/limit-reduction-table-cell.js";
22
22
  import { ContingencyTable } from "./contingency-table/contingency-table.js";
23
23
  import { COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS, getContingencyListsInfosFormSchema, isValidContingencyRow, toFormValuesContingencyListsInfos } from "./contingency-table/columns-definitions.js";
24
- import { useTabs } from "./hook/use-tabs.js";
25
24
  import { useParametersForm } from "./hook/use-parameters-form.js";
26
25
  export {
27
26
  ADVANCED_PARAMETERS,
@@ -69,6 +68,5 @@ export {
69
68
  toFormValuesContingencyListsInfos,
70
69
  toFormValuesLimitReductions,
71
70
  useParameterLayoutContext,
72
- useParametersForm,
73
- useTabs
71
+ useParametersForm
74
72
  };
@@ -1,6 +1,6 @@
1
- import { UseTabsReturn } from '../common';
2
1
  import { TabValues } from './dynamic-margin-calculation.type';
3
2
  import { UseComputationParametersFormReturn } from '../common/utils';
3
+ import { UseTabsReturn } from '../../../hooks';
4
4
  type DynamicMarginCalculationFormProps = {
5
5
  dynamicMarginCalculationMethods: UseComputationParametersFormReturn;
6
6
  useTabsReturn: UseTabsReturn<TabValues>;
@@ -18,6 +18,7 @@ import "localized-countries";
18
18
  import "localized-countries/data/fr";
19
19
  import "localized-countries/data/en";
20
20
  import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
21
+ import { useTabs } from "../../../hooks/use-tabs.js";
21
22
  import { CustomFormProvider } from "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
22
23
  import "yup";
23
24
  import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
@@ -39,9 +40,8 @@ import "react-papaparse";
39
40
  import "../common/widget/parameter-line-slider.js";
40
41
  import "../common/contingency-table/contingency-table.js";
41
42
  import "../common/contingency-table/columns-definitions.js";
42
- import { useTabs } from "../common/hook/use-tabs.js";
43
43
  import "@hookform/resolvers/yup";
44
- import { TabValues } from "./dynamic-margin-calculation.type.js";
44
+ import { TabValues, TAB_VALUES } from "./dynamic-margin-calculation.type.js";
45
45
  function DynamicMarginCalculationInline({
46
46
  studyUuid,
47
47
  parametersBackend,
@@ -58,8 +58,8 @@ function DynamicMarginCalculationInline({
58
58
  const { formMethods } = dynamicMarginCalculationMethods;
59
59
  const { reset, getValues, formState, handleSubmit } = formMethods;
60
60
  const useTabsReturn = useTabs({
61
- defaultTab: Object.values(TabValues)[0],
62
- tabEnum: TabValues,
61
+ defaultTab: TabValues.TAB_TIME_DELAY,
62
+ tabValues: TAB_VALUES,
63
63
  errors: formState.errors
64
64
  });
65
65
  const onSubmit = useCallback(
@@ -8,3 +8,4 @@ export declare enum TabValues {
8
8
  TAB_TIME_DELAY = "TAB_TIME_DELAY",
9
9
  TAB_LOADS_VARIATIONS = "TAB_LOADS_VARIATIONS"
10
10
  }
11
+ export declare const TAB_VALUES: TabValues[];
@@ -3,6 +3,8 @@ var TabValues = /* @__PURE__ */ ((TabValues2) => {
3
3
  TabValues2["TAB_LOADS_VARIATIONS"] = "TAB_LOADS_VARIATIONS";
4
4
  return TabValues2;
5
5
  })(TabValues || {});
6
+ const TAB_VALUES = Object.values(TabValues);
6
7
  export {
8
+ TAB_VALUES,
7
9
  TabValues
8
10
  };
@@ -15,6 +15,7 @@ import "localized-countries";
15
15
  import "localized-countries/data/fr";
16
16
  import "localized-countries/data/en";
17
17
  import "notistack";
18
+ import { useTabs } from "../../../hooks/use-tabs.js";
18
19
  import { CustomFormProvider } from "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
19
20
  import "yup";
20
21
  import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
@@ -36,10 +37,9 @@ import "react-papaparse";
36
37
  import "../common/widget/parameter-line-slider.js";
37
38
  import "../common/contingency-table/contingency-table.js";
38
39
  import "../common/contingency-table/columns-definitions.js";
39
- import { useTabs } from "../common/hook/use-tabs.js";
40
40
  import "@hookform/resolvers/yup";
41
41
  import { DynamicSecurityAnalysisParametersForm } from "./dynamic-security-analysis-parameters-form.js";
42
- import { TabValues } from "./dynamic-security-analysis.type.js";
42
+ import { TabValues, TAB_VALUES } from "./dynamic-security-analysis.type.js";
43
43
  function DynamicSecurityAnalysisInline({
44
44
  studyUuid,
45
45
  parametersBackend,
@@ -56,7 +56,7 @@ function DynamicSecurityAnalysisInline({
56
56
  const { getValues, formState, handleSubmit } = formMethods;
57
57
  const useTabsReturn = useTabs({
58
58
  defaultTab: TabValues.SCENARIO,
59
- tabEnum: TabValues,
59
+ tabValues: TAB_VALUES,
60
60
  errors: formState.errors
61
61
  });
62
62
  const onSubmit = useCallback(
@@ -1,6 +1,6 @@
1
- import { UseTabsReturn } from '../common';
2
1
  import { TabValues } from './dynamic-security-analysis.type';
3
2
  import { UseComputationParametersFormReturn } from '../common/utils';
3
+ import { UseTabsReturn } from '../../../hooks';
4
4
  type DynamicSecurityAnalysisParametersFormProps = {
5
5
  dynamicSecurityAnalysisMethods: UseComputationParametersFormReturn;
6
6
  useTabsReturn: UseTabsReturn<TabValues>;
@@ -8,3 +8,4 @@ export declare enum TabValues {
8
8
  SCENARIO = "scenario",
9
9
  CONTINGENCY = "contingency"
10
10
  }
11
+ export declare const TAB_VALUES: TabValues[];
@@ -3,6 +3,8 @@ var TabValues = /* @__PURE__ */ ((TabValues2) => {
3
3
  TabValues2["CONTINGENCY"] = "contingency";
4
4
  return TabValues2;
5
5
  })(TabValues || {});
6
+ const TAB_VALUES = Object.values(TabValues);
6
7
  export {
8
+ TAB_VALUES,
7
9
  TabValues
8
10
  };
@@ -12,6 +12,7 @@ import "localized-countries";
12
12
  import "localized-countries/data/fr";
13
13
  import "localized-countries/data/en";
14
14
  import "notistack";
15
+ import "react-hook-form";
15
16
  import "mathjs";
16
17
  const styles = {
17
18
  grid: {
@@ -13,6 +13,7 @@ import "../../../../../utils/types/equipmentType.js";
13
13
  import "@mui/icons-material";
14
14
  import "../../../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
15
15
  import { useSnackMessage } from "../../../../../hooks/useSnackMessage.js";
16
+ import "react-hook-form";
16
17
  import "mathjs";
17
18
  const styles = {
18
19
  grid: {
@@ -17,6 +17,7 @@ import "localized-countries";
17
17
  import "localized-countries/data/fr";
18
18
  import "localized-countries/data/en";
19
19
  import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
20
+ import { useTabs } from "../../../hooks/use-tabs.js";
20
21
  import { CustomFormProvider } from "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
21
22
  import "yup";
22
23
  import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
@@ -38,10 +39,9 @@ import "react-papaparse";
38
39
  import "../common/widget/parameter-line-slider.js";
39
40
  import "../common/contingency-table/contingency-table.js";
40
41
  import "../common/contingency-table/columns-definitions.js";
41
- import { useTabs } from "../common/hook/use-tabs.js";
42
42
  import "@hookform/resolvers/yup";
43
43
  import { useDynamicSimulationParametersForm, toParamsEnriched, toFormValues } from "./use-dynamic-simulation-parameters-form.js";
44
- import { TabValues } from "./dynamic-simulation.type.js";
44
+ import { TabValues, TAB_VALUES } from "./dynamic-simulation.type.js";
45
45
  import { DynamicSimulationForm } from "./dynamic-simulation-parameters-form.js";
46
46
  import useDefaultParams from "./hook/use-default-params.js";
47
47
  function DynamicSimulationInline({
@@ -65,7 +65,7 @@ function DynamicSimulationInline({
65
65
  const { reset, getValues, formState, handleSubmit } = formMethods;
66
66
  const useTabsReturn = useTabs({
67
67
  defaultTab: TabValues.TAB_TIME_DELAY,
68
- tabEnum: TabValues,
68
+ tabValues: TAB_VALUES,
69
69
  errors: formState.errors
70
70
  });
71
71
  const onSubmit = useCallback(
@@ -1,8 +1,8 @@
1
- import { UseTabsReturn } from '../common';
2
1
  import { VoltageLevelInfos } from '../../../utils/types/equipmentType';
3
2
  import { TabValues } from './dynamic-simulation.type';
4
3
  import { ExpertFilter, IdentifiableAttributes } from '../../../components/composite/filter';
5
4
  import { UseComputationParametersFormReturn } from '../common/utils';
5
+ import { UseTabsReturn } from '../../../hooks';
6
6
  type DynamicSimulationFormProps = {
7
7
  dynamicSimulationMethods: UseComputationParametersFormReturn;
8
8
  useTabsReturn: UseTabsReturn<TabValues>;
@@ -11,3 +11,4 @@ export declare enum TabValues {
11
11
  TAB_NETWORK = "TAB_NETWORK",
12
12
  TAB_CURVE = "TAB_CURVE"
13
13
  }
14
+ export declare const TAB_VALUES: TabValues[];
@@ -6,6 +6,8 @@ var TabValues = /* @__PURE__ */ ((TabValues2) => {
6
6
  TabValues2["TAB_CURVE"] = "TAB_CURVE";
7
7
  return TabValues2;
8
8
  })(TabValues || {});
9
+ const TAB_VALUES = Object.values(TabValues);
9
10
  export {
11
+ TAB_VALUES,
10
12
  TabValues
11
13
  };