@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,15 +0,0 @@
1
- import { FieldConstants } from '../../../utils';
2
- type TabFieldsMap<T extends number> = Readonly<Partial<Record<T, FieldConstants[]>>>;
3
- /**
4
- * Manages tab navigation with automatic error highlighting for react-hook-form-based tabbed forms.
5
- *
6
- * @param tabFields - Maps each tab index to the field names it owns. Must be a module-level
7
- * constant to remain stable across renders.
8
- * @param initialTab - The tab to show on first render.
9
- */
10
- export declare function useTabsWithError<T extends number>(tabFields: TabFieldsMap<T>, initialTab: T): {
11
- tabIndex: T;
12
- setTabIndex: (tab: T) => void;
13
- tabIndexesWithError: T[];
14
- };
15
- export {};
@@ -1,28 +0,0 @@
1
- import { useState, useRef, useEffect, useCallback } from "react";
2
- import { useFormState } from "react-hook-form";
3
- function useTabsWithError(tabFields, initialTab) {
4
- const { errors, submitCount } = useFormState();
5
- const [tabIndex, setTabIndex] = useState(initialTab);
6
- const tabIndexRef = useRef(tabIndex);
7
- const tabIndexesWithError = Object.keys(tabFields).map(Number).filter(
8
- (tab) => tabFields[tab].some((field) => errors[field] !== void 0)
9
- );
10
- const tabIndexesWithErrorRef = useRef(tabIndexesWithError);
11
- tabIndexesWithErrorRef.current = tabIndexesWithError;
12
- useEffect(() => {
13
- const tabs = tabIndexesWithErrorRef.current;
14
- if (tabs.length > 0 && !tabs.includes(tabIndexRef.current)) {
15
- const tab = tabs[0];
16
- tabIndexRef.current = tab;
17
- setTabIndex(tab);
18
- }
19
- }, [submitCount]);
20
- const handleSetTabIndex = useCallback((tab) => {
21
- tabIndexRef.current = tab;
22
- setTabIndex(tab);
23
- }, []);
24
- return { tabIndex, setTabIndex: handleSetTabIndex, tabIndexesWithError };
25
- }
26
- export {
27
- useTabsWithError
28
- };
@@ -1,16 +0,0 @@
1
- import { SyntheticEvent } from 'react';
2
- import { FieldErrors } from 'react-hook-form';
3
- export type UseTabsReturn<TTabValue extends string> = {
4
- selectedTab: TTabValue;
5
- setSelectedTab: (selectedTab: TTabValue) => void;
6
- tabsWithError: TTabValue[];
7
- onTabChange: (event: SyntheticEvent, newValue: TTabValue) => void;
8
- onError: (errors: FieldErrors) => void;
9
- };
10
- export type UseTabsProps<TTabValue extends string> = {
11
- defaultTab: TTabValue;
12
- tabEnum: Record<string, TTabValue>;
13
- errors: FieldErrors;
14
- tabFields?: Record<TTabValue, string[]>;
15
- };
16
- export declare function useTabs<TTabValue extends string>({ defaultTab, tabEnum, errors, tabFields, }: Readonly<UseTabsProps<TTabValue>>): UseTabsReturn<TTabValue>;
@@ -1,65 +0,0 @@
1
- import { useState, useCallback } from "react";
2
- import { get } from "react-hook-form";
3
- import { isObjectEmpty } from "../../../../utils/functions.js";
4
- function useTabs({
5
- defaultTab,
6
- tabEnum,
7
- errors,
8
- tabFields
9
- }) {
10
- const [selectedTab, setSelectedTab] = useState(defaultTab);
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
- );
25
- const onTabChange = useCallback(
26
- (event, newSelectedTab) => {
27
- setSelectedTab(newSelectedTab);
28
- if (!errors || isObjectEmpty(errors)) {
29
- return;
30
- }
31
- const tabsHasError = getTabsWithError(errors);
32
- if (tabsHasError.includes(newSelectedTab)) {
33
- setTabsWithError(tabsHasError.filter((errorTab) => errorTab !== newSelectedTab));
34
- } else {
35
- setTabsWithError(tabsHasError);
36
- }
37
- },
38
- [errors, getTabsWithError]
39
- );
40
- const onError = useCallback(
41
- (_errors) => {
42
- if (!_errors || isObjectEmpty(_errors)) {
43
- return;
44
- }
45
- const tabsHasError = getTabsWithError(_errors);
46
- if (tabsHasError.includes(selectedTab)) {
47
- setTabsWithError(tabsHasError.filter((errorTab) => errorTab !== selectedTab));
48
- } else if (tabsHasError.length > 0) {
49
- setSelectedTab(tabsHasError[0]);
50
- setTabsWithError(tabsHasError.filter((errorTab, index, arr) => errorTab !== arr[0]));
51
- }
52
- },
53
- [getTabsWithError, selectedTab]
54
- );
55
- return {
56
- selectedTab,
57
- setSelectedTab,
58
- tabsWithError,
59
- onTabChange,
60
- onError
61
- };
62
- }
63
- export {
64
- useTabs
65
- };