@gridsuite/commons-ui 0.280.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 (207) 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/dialogs/elementSaveDialog/ElementSaveDialog.d.ts +6 -1
  7. package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js +29 -5
  8. package/dist/components/ui/directoryItemSelector/DirectoryItemSelector.js +1 -0
  9. package/dist/components/ui/reactHookForm/booleans/RadioInput.d.ts +1 -0
  10. package/dist/components/ui/reactHookForm/booleans/RadioInput.js +2 -1
  11. package/dist/features/index.js +92 -12
  12. package/dist/features/network-modification-table/network-modifications-table.js +1 -0
  13. package/dist/features/network-modification-table/renderers/reference-link-cell.js +1 -1
  14. package/dist/features/network-modification-table/renderers/root-network-chip-cell.js +1 -0
  15. package/dist/features/network-modification-table/renderers/switch-cell.js +1 -0
  16. package/dist/features/network-modification-table/row/drag-row-clone.js +1 -0
  17. package/dist/features/network-modification-table/use-modifications-drag-and-drop.js +1 -0
  18. package/dist/features/network-modifications/battery/modification/BatteryDialogTabs.d.ts +3 -3
  19. package/dist/features/network-modifications/battery/modification/BatteryDialogTabs.js +2 -2
  20. package/dist/features/network-modifications/battery/modification/BatteryModificationForm.d.ts +4 -1
  21. package/dist/features/network-modifications/battery/modification/BatteryModificationForm.js +7 -11
  22. package/dist/features/network-modifications/generator/modification/GeneratorDialogTabs.d.ts +3 -3
  23. package/dist/features/network-modifications/generator/modification/GeneratorDialogTabs.js +2 -2
  24. package/dist/features/network-modifications/generator/modification/GeneratorModificationForm.d.ts +4 -1
  25. package/dist/features/network-modifications/generator/modification/GeneratorModificationForm.js +4 -8
  26. package/dist/features/network-modifications/index.d.ts +1 -1
  27. package/dist/features/network-modifications/index.js +81 -6
  28. package/dist/features/network-modifications/line/common/LineDialogTabs.d.ts +3 -3
  29. package/dist/features/network-modifications/line/common/LineDialogTabs.js +2 -2
  30. package/dist/features/network-modifications/line/common/LineForm.d.ts +4 -1
  31. package/dist/features/network-modifications/line/common/LineForm.js +7 -11
  32. package/dist/features/network-modifications/line/common/line.utils.d.ts +1 -1
  33. package/dist/features/network-modifications/load/common/LoadDialogTabs.d.ts +3 -3
  34. package/dist/features/network-modifications/load/common/LoadDialogTabs.js +2 -2
  35. package/dist/features/network-modifications/load/common/LoadForm.d.ts +4 -1
  36. package/dist/features/network-modifications/load/common/LoadForm.js +7 -11
  37. package/dist/features/network-modifications/static-var-compensator/common/static-var-compensator-dialog-tabs.d.ts +3 -2
  38. package/dist/features/network-modifications/static-var-compensator/common/static-var-compensator-dialog-tabs.js +2 -2
  39. package/dist/features/network-modifications/static-var-compensator/creation/static-var-compensator-creation-form.d.ts +4 -1
  40. package/dist/features/network-modifications/static-var-compensator/creation/static-var-compensator-creation-form.js +8 -11
  41. package/dist/features/network-modifications/tabular/TabularForm.d.ts +22 -0
  42. package/dist/features/network-modifications/tabular/TabularForm.js +536 -0
  43. package/dist/features/network-modifications/tabular/index.d.ts +7 -0
  44. package/dist/features/network-modifications/tabular/index.js +65 -0
  45. package/dist/features/network-modifications/tabular/properties/DefineTabularPropertiesDialog.d.ts +12 -0
  46. package/dist/features/network-modifications/tabular/properties/DefineTabularPropertiesDialog.js +123 -0
  47. package/dist/features/network-modifications/tabular/properties/TabularPropertiesForm.d.ts +1 -0
  48. package/dist/features/network-modifications/tabular/properties/TabularPropertiesForm.js +87 -0
  49. package/dist/features/network-modifications/tabular/properties/TabularPropertyForm.d.ts +5 -0
  50. package/dist/features/network-modifications/tabular/properties/TabularPropertyForm.js +91 -0
  51. package/dist/features/network-modifications/tabular/properties/index.d.ts +4 -0
  52. package/dist/features/network-modifications/tabular/properties/index.js +13 -0
  53. package/dist/features/network-modifications/tabular/properties/tabularProperty.utils.d.ts +26 -0
  54. package/dist/features/network-modifications/tabular/properties/tabularProperty.utils.js +50 -0
  55. package/dist/features/network-modifications/tabular/tabular.constants.d.ts +59 -0
  56. package/dist/features/network-modifications/tabular/tabular.constants.js +75 -0
  57. package/dist/features/network-modifications/tabular/tabular.types.d.ts +41 -0
  58. package/dist/features/network-modifications/tabular/tabular.types.js +8 -0
  59. package/dist/features/network-modifications/tabular/tabular.utils.d.ts +68 -0
  60. package/dist/features/network-modifications/tabular/tabular.utils.js +301 -0
  61. package/dist/features/network-modifications/tabular/tabularCreation.utils.d.ts +25 -0
  62. package/dist/features/network-modifications/tabular/tabularCreation.utils.js +276 -0
  63. package/dist/features/network-modifications/tabular/tabularModification.utils.d.ts +43 -0
  64. package/dist/features/network-modifications/tabular/tabularModification.utils.js +406 -0
  65. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabs.d.ts +3 -3
  66. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabs.js +2 -2
  67. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerForm.d.ts +4 -1
  68. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerForm.js +7 -11
  69. package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.d.ts +4 -7
  70. package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +16 -19
  71. package/dist/features/network-modifications/voltageLevel/creation/index.d.ts +1 -1
  72. package/dist/features/network-modifications/voltageLevel/creation/index.js +3 -1
  73. package/dist/features/network-modifications/voltageLevel/index.d.ts +2 -1
  74. package/dist/features/network-modifications/voltageLevel/index.js +18 -4
  75. package/dist/features/network-modifications/voltageLevel/topology/{CreateVoltageLevelTopologyForm.d.ts → creation/CreateVoltageLevelTopologyForm.d.ts} +1 -1
  76. package/dist/features/network-modifications/voltageLevel/topology/{CreateVoltageLevelTopologyForm.js → creation/CreateVoltageLevelTopologyForm.js} +38 -38
  77. package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.types.d.ts → creation/voltageLevelTopologyCreation.types.d.ts} +1 -1
  78. package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.utils.d.ts → creation/voltageLevelTopologyCreation.utils.d.ts} +1 -1
  79. package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.utils.js → creation/voltageLevelTopologyCreation.utils.js} +5 -5
  80. package/dist/features/network-modifications/voltageLevel/topology/modification/ConnectionCellRender.d.ts +6 -0
  81. package/dist/features/network-modifications/voltageLevel/topology/modification/ConnectionCellRender.js +80 -0
  82. package/dist/features/network-modifications/voltageLevel/topology/modification/VoltageLevelTopologyModificationForm.d.ts +10 -0
  83. package/dist/features/network-modifications/voltageLevel/topology/modification/VoltageLevelTopologyModificationForm.js +284 -0
  84. package/dist/features/network-modifications/voltageLevel/topology/modification/constants.d.ts +10 -0
  85. package/dist/features/network-modifications/voltageLevel/topology/modification/constants.js +10 -0
  86. package/dist/features/network-modifications/{hooks → voltageLevel/topology/modification}/index.d.ts +4 -1
  87. package/dist/features/network-modifications/voltageLevel/topology/modification/index.js +14 -0
  88. package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.types.d.ts +28 -0
  89. package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.types.js +1 -0
  90. package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.utils.d.ts +29 -0
  91. package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.utils.js +124 -0
  92. package/dist/features/parameters/common/hook/index.d.ts +0 -1
  93. package/dist/features/parameters/common/hook/index.js +1 -3
  94. package/dist/features/parameters/common/index.d.ts +1 -0
  95. package/dist/features/parameters/common/index.js +3 -3
  96. package/dist/features/parameters/common/parameter-field.d.ts +2 -2
  97. package/dist/features/parameters/common/parameter-field.js +1 -1
  98. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.d.ts +1 -1
  99. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +1 -1
  100. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +10 -10
  101. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.d.ts +1 -0
  102. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.js +2 -0
  103. package/dist/features/parameters/dynamic-margin-calculation/loads-variations-parameters.js +1 -1
  104. package/dist/features/parameters/dynamic-margin-calculation/time-delay-parameters.js +1 -1
  105. package/dist/features/parameters/dynamic-security-analysis/contingency-parameters.js +1 -1
  106. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +9 -9
  107. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.d.ts +1 -1
  108. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +1 -1
  109. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis.type.d.ts +1 -0
  110. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis.type.js +2 -0
  111. package/dist/features/parameters/dynamic-security-analysis/scenario-parameters.js +1 -1
  112. package/dist/features/parameters/dynamic-simulation/curve/dialog/curve-preview.js +1 -0
  113. package/dist/features/parameters/dynamic-simulation/curve/dialog/equipment-filter.js +1 -0
  114. package/dist/features/parameters/dynamic-simulation/dynamic-simulation-inline.js +9 -9
  115. package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.d.ts +1 -1
  116. package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.js +1 -1
  117. package/dist/features/parameters/dynamic-simulation/dynamic-simulation.type.d.ts +1 -0
  118. package/dist/features/parameters/dynamic-simulation/dynamic-simulation.type.js +2 -0
  119. package/dist/features/parameters/dynamic-simulation/network/network-parameters.js +1 -1
  120. package/dist/features/parameters/dynamic-simulation/solver/common-solver/common-solver-parameters.js +1 -1
  121. package/dist/features/parameters/dynamic-simulation/solver/ida-solver/ida-solver-parameters.js +1 -1
  122. package/dist/features/parameters/dynamic-simulation/solver/sim-solver/simplified-solver-parameters.js +1 -1
  123. package/dist/features/parameters/dynamic-simulation/solver/solver-parameters.js +1 -1
  124. package/dist/features/parameters/dynamic-simulation/time-delay/time-delay-parameters.js +1 -1
  125. package/dist/features/parameters/index.js +12 -7
  126. package/dist/features/parameters/loadflow/load-flow-advanced-parameters.js +1 -1
  127. package/dist/features/parameters/loadflow/load-flow-general-parameters.js +1 -1
  128. package/dist/features/parameters/loadflow/load-flow-parameters-inline.js +6 -6
  129. package/dist/features/parameters/loadflow/load-flow-parameters-utils.d.ts +1 -0
  130. package/dist/features/parameters/loadflow/load-flow-parameters-utils.js +2 -0
  131. package/dist/features/parameters/loadflow/load-flow-provider-specific-parameters.js +1 -1
  132. package/dist/features/parameters/loadflow/use-load-flow-parameters-form.js +3 -3
  133. package/dist/features/parameters/network-visualizations/constants.d.ts +1 -0
  134. package/dist/features/parameters/network-visualizations/constants.js +2 -0
  135. package/dist/features/parameters/network-visualizations/index.js +2 -1
  136. package/dist/features/parameters/network-visualizations/network-visualizations-parameters-inline.js +6 -6
  137. package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.js +3 -7
  138. package/dist/features/parameters/pcc-min/pcc-min-parameters-inline.js +6 -6
  139. package/dist/features/parameters/security-analysis/constants.d.ts +1 -0
  140. package/dist/features/parameters/security-analysis/constants.js +2 -0
  141. package/dist/features/parameters/security-analysis/index.js +2 -1
  142. package/dist/features/parameters/security-analysis/security-analysis-parameters-content.js +1 -1
  143. package/dist/features/parameters/security-analysis/security-analysis-parameters-dialog.js +1 -1
  144. package/dist/features/parameters/security-analysis/security-analysis-parameters-inline.js +6 -6
  145. package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.js +3 -3
  146. package/dist/features/parameters/sensi/columns-definitions.d.ts +2 -0
  147. package/dist/features/parameters/sensi/columns-definitions.js +36 -1
  148. package/dist/features/parameters/sensi/index.js +3 -1
  149. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-dialog.js +1 -1
  150. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-form.js +2 -1
  151. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-inline.js +10 -7
  152. package/dist/features/parameters/sensi/sensitivity-parameters-selector.d.ts +3 -1
  153. package/dist/features/parameters/sensi/sensitivity-parameters-selector.js +19 -35
  154. package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.d.ts +9 -1
  155. package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.js +29 -1
  156. package/dist/features/parameters/short-circuit/short-circuit-parameters-inline.js +6 -6
  157. package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.d.ts +1 -0
  158. package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.js +2 -0
  159. package/dist/features/parameters/short-circuit/use-short-circuit-parameters-form.js +3 -3
  160. package/dist/features/parameters/voltage-init/constants.d.ts +1 -0
  161. package/dist/features/parameters/voltage-init/constants.js +2 -0
  162. package/dist/features/parameters/voltage-init/index.js +2 -1
  163. package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -8
  164. package/dist/features/parameters/voltage-init/voltage-init-parameters-inline.js +6 -6
  165. package/dist/features/process-configs/loadflow/lf-process-config-edition.js +7 -1
  166. package/dist/features/process-configs/security-analysis/sa-process-config-edition.js +7 -1
  167. package/dist/features/process-configs/shortcircuit/sc-process-config-edition.js +7 -1
  168. package/dist/features/results/loadflow/limit-violation-result.js +1 -1
  169. package/dist/features/results/shortcircuit/shortcircuit-analysis-result.js +1 -1
  170. package/dist/features/side-bar/AppSideBarHeader.js +20 -5
  171. package/dist/features/side-bar/EnvironmentChip.d.ts +13 -0
  172. package/dist/features/side-bar/EnvironmentChip.js +49 -0
  173. package/dist/hooks/index.d.ts +1 -0
  174. package/dist/hooks/index.js +3 -1
  175. package/dist/hooks/use-tabs.d.ts +33 -0
  176. package/dist/hooks/use-tabs.js +55 -0
  177. package/dist/index.js +97 -13
  178. package/dist/services/appsMetadata.d.ts +2 -0
  179. package/dist/services/directory.d.ts +1 -1
  180. package/dist/services/directory.js +6 -2
  181. package/dist/services/index.js +2 -1
  182. package/dist/services/userAdmin.d.ts +2 -1
  183. package/dist/services/userAdmin.js +9 -1
  184. package/dist/translations/en/businessErrorsEn.d.ts +1 -0
  185. package/dist/translations/en/businessErrorsEn.js +1 -0
  186. package/dist/translations/en/networkModificationsEn.d.ts +85 -0
  187. package/dist/translations/en/networkModificationsEn.js +91 -1
  188. package/dist/translations/fr/businessErrorsFr.d.ts +1 -0
  189. package/dist/translations/fr/businessErrorsFr.js +1 -0
  190. package/dist/translations/fr/networkModificationsFr.d.ts +85 -0
  191. package/dist/translations/fr/networkModificationsFr.js +91 -1
  192. package/dist/utils/constants/index.js +2 -1
  193. package/dist/utils/constants/notificationsProvider.d.ts +1 -0
  194. package/dist/utils/constants/notificationsProvider.js +1 -0
  195. package/dist/utils/constants/translationKeys.d.ts +1 -0
  196. package/dist/utils/constants/translationKeys.js +2 -0
  197. package/dist/utils/index.js +2 -1
  198. package/dist/utils/types/types.d.ts +4 -0
  199. package/package.json +1 -1
  200. package/dist/features/network-modifications/hooks/index.js +0 -4
  201. package/dist/features/network-modifications/hooks/useTabsWithError.d.ts +0 -15
  202. package/dist/features/network-modifications/hooks/useTabsWithError.js +0 -28
  203. package/dist/features/parameters/common/hook/use-tabs.d.ts +0 -16
  204. package/dist/features/parameters/common/hook/use-tabs.js +0 -65
  205. /package/dist/features/network-modifications/voltageLevel/topology/{index.d.ts → creation/index.d.ts} +0 -0
  206. /package/dist/features/network-modifications/voltageLevel/topology/{index.js → creation/index.js} +0 -0
  207. /package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.types.js → creation/voltageLevelTopologyCreation.types.js} +0 -0
@@ -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
  ] });
@@ -0,0 +1,22 @@
1
+ import { ReactNode } from 'react';
2
+ import { EquipmentType } from '../../../utils';
3
+ import { PredefinedEquipmentProperties, TabularModificationType } from './tabular.types';
4
+ /** Context handed over to the host application when it renders its own actions in the form. */
5
+ export interface TabularFormActionsContext {
6
+ dialogMode: TabularModificationType;
7
+ equipmentType: EquipmentType;
8
+ csvColumns: string[];
9
+ commentLines: string[][];
10
+ predefinedEquipmentProperties: PredefinedEquipmentProperties;
11
+ }
12
+ export interface TabularFormProps {
13
+ dialogMode: TabularModificationType;
14
+ dataFetching?: boolean;
15
+ /**
16
+ * Application specific actions rendered next to the CSV template buttons.
17
+ */
18
+ renderActions?: (context: TabularFormActionsContext) => ReactNode;
19
+ /** Display the name of the CSV file the table was imported from. */
20
+ showCsvFileName?: boolean;
21
+ }
22
+ export declare function TabularForm({ dialogMode, dataFetching, renderActions, showCsvFileName, }: Readonly<TabularFormProps>): import("react").JSX.Element;
@@ -0,0 +1,536 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { useState, useRef, useCallback, useMemo, useEffect } from "react";
3
+ import { useIntl, FormattedMessage } from "react-intl";
4
+ import { useFormContext, useWatch } from "react-hook-form";
5
+ import { Stack, Grid, Button, Alert } from "@mui/material";
6
+ import { v4 } from "uuid";
7
+ import "@mui/icons-material";
8
+ import "../../../components/ui/overflowableText/OverflowableText.js";
9
+ import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
10
+ import "../../../utils/conversionUtils.js";
11
+ import { EquipmentType } from "../../../utils/types/equipmentType.js";
12
+ import { hasNonEmptyRows } from "../../../utils/functions.js";
13
+ import { transformIfFrenchNumber } from "../../../utils/langs.js";
14
+ import { useStateBoolean } from "../../../hooks/customStates/useStateBoolean.js";
15
+ import { fetchStudyMetadata } from "../../../services/appsMetadata.js";
16
+ import "localized-countries";
17
+ import "localized-countries/data/fr";
18
+ import "localized-countries/data/en";
19
+ import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
20
+ import "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
21
+ import "yup";
22
+ import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
23
+ import { AutocompleteInput } from "../../../components/ui/reactHookForm/autocompleteInputs/AutocompleteInput.js";
24
+ import "../../../components/ui/reactHookForm/numbers/RangeInput.js";
25
+ import { InputWithPopupConfirmation } from "../../../components/ui/reactHookForm/selectInputs/InputWithPopupConfirmation.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/arrows_input.svg?react";
29
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
30
+ import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
31
+ import "../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
32
+ import "../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
33
+ import "../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
34
+ import "@hello-pangea/dnd";
35
+ import "../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
36
+ import "../../../components/ui/snackbarProvider/SnackbarProvider.js";
37
+ import "mui-nested-menu";
38
+ import "react-resizable-panels";
39
+ import { CsvDownloadButton } from "../../../components/ui/csvDownloader/csv-download-button.js";
40
+ import { CsvPicker } from "../../../components/ui/csvPicker/csv-picker.js";
41
+ import "react-dom";
42
+ import "autosuggest-highlight/match";
43
+ import "autosuggest-highlight/parse";
44
+ import "clsx";
45
+ import "../../../components/composite/filter/FilterCreationDialog.js";
46
+ import "../../../components/composite/filter/HeaderFilterForm.js";
47
+ import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
48
+ import "../../../components/composite/filter/expert/ExpertFilterForm.js";
49
+ import "../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
50
+ import "../../../components/composite/filter/expert/expertFilterConstants.js";
51
+ import "react-querybuilder";
52
+ import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
53
+ import "../../../components/composite/filter/utils/filterFormUtils.js";
54
+ import "@react-querybuilder/material";
55
+ import "../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
56
+ import "../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
57
+ import "../../../components/composite/agGridTable/BottomTableButtons.js";
58
+ import { CustomAgGridTable } from "../../../components/composite/agGridTable/CustomAgGridTable.js";
59
+ import { NumericEditor, suppressNonNumericKeyboardEvent } from "../../../components/composite/agGridTable/cellEditors/numericEditor.js";
60
+ import "../../../components/composite/customAGGrid/customAggrid.js";
61
+ import { DefaultCellRenderer } from "../../../components/composite/customAGGrid/cell-renderers.js";
62
+ import "../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
63
+ import "mathjs";
64
+ import "../../../components/composite/report/report-viewer/log-table/log-table.js";
65
+ import "react-window";
66
+ import "../../../components/composite/report/report-treeview/treeview-item.js";
67
+ import "../../../components/composite/report/report-viewer/context/report-viewer-context.js";
68
+ import { AGGRID_LOCALES } from "../../../translations/not-intl/aggrid-locales.js";
69
+ import { DefineTabularPropertiesDialog } from "./properties/DefineTabularPropertiesDialog.js";
70
+ import { TabularFieldConstants, PROPERTY_CSV_COLUMN_PREFIX, TABULAR_BOOLEAN, TABULAR_ENUM, TABULAR_NUMBER } from "./tabular.constants.js";
71
+ import "../common/properties/propertyUtils.js";
72
+ import "../common/regulatingTerminal/RegulatingTerminalForm.js";
73
+ import "@mui/material/colors";
74
+ import "@mui/x-charts";
75
+ import "../common/currentLimits/limitsPane.utils.js";
76
+ import "./properties/tabularProperty.utils.js";
77
+ import { TABULAR_CREATION_FIELDS } from "./tabularCreation.utils.js";
78
+ import { TABULAR_MODIFICATION_FIELDS } from "./tabularModification.utils.js";
79
+ import { TabularModificationType } from "./tabular.types.js";
80
+ import { isFieldTypeOk, setFieldTypeError, getSelectedTabularPropertyNames, generateCommentLines, sanitizeRowValue } from "./tabular.utils.js";
81
+ function TabularForm({
82
+ dialogMode,
83
+ dataFetching = false,
84
+ renderActions,
85
+ showCsvFileName = true
86
+ }) {
87
+ const intl = useIntl();
88
+ const language = intl.locale;
89
+ const { snackWarning } = useSnackMessage();
90
+ const [isFetching, setIsFetching] = useState(dataFetching);
91
+ const { setValue, clearErrors, setError, getValues } = useFormContext();
92
+ const tableRef = useRef(null);
93
+ const propertiesDialogOpen = useStateBoolean(false);
94
+ const [predefinedEquipmentProperties, setPredefinedEquipmentProperties] = useState(
95
+ {}
96
+ );
97
+ const getTypeLabel = useCallback((type) => intl.formatMessage({ id: type }), [intl]);
98
+ const equipmentType = useWatch({
99
+ name: FieldConstants.TYPE
100
+ });
101
+ const tabularProperties = useWatch({
102
+ name: TabularFieldConstants.TABULAR_PROPERTIES
103
+ });
104
+ const watchFileName = useWatch({
105
+ name: TabularFieldConstants.CSV_FILENAME
106
+ });
107
+ const csvFields = useMemo(() => {
108
+ const fields = dialogMode === TabularModificationType.CREATION ? TABULAR_CREATION_FIELDS : TABULAR_MODIFICATION_FIELDS;
109
+ return fields[equipmentType] ?? [];
110
+ }, [equipmentType, dialogMode]);
111
+ const [selectedFile, setSelectedFile] = useState();
112
+ const [fileErrorMessage, setFileErrorMessage] = useState();
113
+ const [fileWarningMessage, setFileWarningMessage] = useState();
114
+ const parseConfig = useMemo(
115
+ () => ({
116
+ dynamicTyping: (field) => (
117
+ // "property_*" (user added property) columns should remain as strings
118
+ typeof field !== "string" || !field.startsWith(PROPERTY_CSV_COLUMN_PREFIX)
119
+ ),
120
+ transform: (value, field) => {
121
+ if (typeof field === "string" && field.startsWith(PROPERTY_CSV_COLUMN_PREFIX)) {
122
+ return value;
123
+ }
124
+ return transformIfFrenchNumber(value, language);
125
+ }
126
+ }),
127
+ [language]
128
+ );
129
+ const handleBooleanValue = useCallback(
130
+ (key, value, fieldDef) => {
131
+ if (fieldDef?.type !== TABULAR_BOOLEAN) {
132
+ return false;
133
+ }
134
+ if (fieldDef.required && typeof value !== "boolean") {
135
+ setFileWarningMessage(
136
+ intl.formatMessage({ id: "WrongBooleanValueWarning" }, { field: intl.formatMessage({ id: key }) })
137
+ );
138
+ }
139
+ return true;
140
+ },
141
+ [intl]
142
+ );
143
+ const handleTabularCreationParsingError = useCallback(
144
+ (results) => {
145
+ let requiredFieldNameInError = "";
146
+ let requiredDependantFieldNameInError = "";
147
+ let dependantFieldNameInError = "";
148
+ let fieldTypeInError = "";
149
+ let expectedTypeForFieldInError = "";
150
+ let expectedValues;
151
+ if (results.data.flatMap(
152
+ (result) => Object.entries(result).map(([key, value]) => [
153
+ result,
154
+ key,
155
+ value
156
+ ])
157
+ ).some(([result, key, value]) => {
158
+ const fieldDef = csvFields.find((field) => field.id === key);
159
+ if (handleBooleanValue(key, value, fieldDef)) {
160
+ return false;
161
+ }
162
+ if (fieldDef !== void 0 && fieldDef.required && (value === void 0 || value === null)) {
163
+ requiredFieldNameInError = key;
164
+ return true;
165
+ }
166
+ if (fieldDef?.requiredIf) {
167
+ const dependentValue = result[fieldDef.requiredIf.id];
168
+ if (dependentValue !== void 0 && dependentValue !== null && (value === void 0 || value === null)) {
169
+ dependantFieldNameInError = key;
170
+ requiredDependantFieldNameInError = fieldDef.requiredIf.id;
171
+ return true;
172
+ }
173
+ }
174
+ if (!isFieldTypeOk(value, fieldDef)) {
175
+ fieldTypeInError = key;
176
+ expectedTypeForFieldInError = fieldDef?.type ?? "";
177
+ expectedValues = fieldDef?.options;
178
+ return true;
179
+ }
180
+ return false;
181
+ })) {
182
+ if (requiredFieldNameInError !== "") {
183
+ setError(TabularFieldConstants.MODIFICATIONS_TABLE, {
184
+ type: "custom",
185
+ message: intl.formatMessage(
186
+ { id: "FieldRequired" },
187
+ { requiredFieldNameInError: intl.formatMessage({ id: requiredFieldNameInError }) }
188
+ )
189
+ });
190
+ } else if (dependantFieldNameInError !== "" && requiredDependantFieldNameInError !== "") {
191
+ setError(TabularFieldConstants.MODIFICATIONS_TABLE, {
192
+ type: "custom",
193
+ message: intl.formatMessage(
194
+ { id: "DependantFieldMissing" },
195
+ {
196
+ requiredField: intl.formatMessage({ id: dependantFieldNameInError }),
197
+ dependantField: intl.formatMessage({ id: requiredDependantFieldNameInError })
198
+ }
199
+ )
200
+ });
201
+ } else if (fieldTypeInError !== "") {
202
+ setFieldTypeError(
203
+ intl.formatMessage({ id: fieldTypeInError }),
204
+ expectedTypeForFieldInError,
205
+ TabularFieldConstants.MODIFICATIONS_TABLE,
206
+ setError,
207
+ intl,
208
+ expectedValues
209
+ );
210
+ }
211
+ }
212
+ if (equipmentType === EquipmentType.SHUNT_COMPENSATOR && results.data.some(
213
+ (creation) => creation.maxSusceptance != null && (creation.shuntCompensatorType || creation.maxQAtNominalV != null)
214
+ )) {
215
+ snackWarning({
216
+ messageId: "TabularCreationShuntWarning"
217
+ });
218
+ }
219
+ },
220
+ [csvFields, equipmentType, handleBooleanValue, intl, setError, snackWarning]
221
+ );
222
+ const handleTabularModificationParsingError = useCallback(
223
+ (results) => {
224
+ let fieldTypeInError = "";
225
+ let expectedTypeForFieldInError = "";
226
+ let expectedValues;
227
+ if (results.data.flatMap(Object.entries).some(([key, value]) => {
228
+ const fieldDef = csvFields.find((field) => field.id === key);
229
+ if (handleBooleanValue(key, value, fieldDef)) {
230
+ return false;
231
+ }
232
+ if (!isFieldTypeOk(value, fieldDef)) {
233
+ fieldTypeInError = key;
234
+ expectedTypeForFieldInError = fieldDef?.type ?? "";
235
+ expectedValues = fieldDef?.options;
236
+ return true;
237
+ }
238
+ return false;
239
+ })) {
240
+ setFieldTypeError(
241
+ intl.formatMessage({ id: fieldTypeInError }),
242
+ expectedTypeForFieldInError,
243
+ TabularFieldConstants.MODIFICATIONS_TABLE,
244
+ setError,
245
+ intl,
246
+ expectedValues
247
+ );
248
+ }
249
+ if (equipmentType === EquipmentType.SHUNT_COMPENSATOR && results.data.some(
250
+ (modification) => modification.maxSusceptance != null && (modification.shuntCompensatorType || modification.maxQAtNominalV != null)
251
+ )) {
252
+ snackWarning({ messageId: "TabularModificationShuntWarning" });
253
+ }
254
+ },
255
+ [equipmentType, csvFields, handleBooleanValue, setError, intl, snackWarning]
256
+ );
257
+ const selectedProperties = useMemo(
258
+ () => getSelectedTabularPropertyNames(tabularProperties),
259
+ [tabularProperties]
260
+ );
261
+ const csvColumns = useMemo(() => {
262
+ return csvFields.map((field) => field.id).concat(selectedProperties.map((propertyName) => PROPERTY_CSV_COLUMN_PREFIX + propertyName));
263
+ }, [csvFields, selectedProperties]);
264
+ const requiredColumns = useMemo(
265
+ () => csvFields.filter((field) => field.required).map((field) => field.id),
266
+ [csvFields]
267
+ );
268
+ const commentLines = useMemo(() => {
269
+ return generateCommentLines({
270
+ fields: csvFields,
271
+ selectedProperties,
272
+ intl,
273
+ equipmentType,
274
+ language,
275
+ formType: dialogMode,
276
+ predefinedEquipmentProperties
277
+ });
278
+ }, [csvFields, selectedProperties, intl, equipmentType, language, dialogMode, predefinedEquipmentProperties]);
279
+ const getTemplateData = useCallback(() => [csvColumns, ...commentLines], [csvColumns, commentLines]);
280
+ const getTableData = useCallback(() => {
281
+ const rows = getValues(TabularFieldConstants.MODIFICATIONS_TABLE) ?? [];
282
+ return [...getTemplateData(), ...rows.map((row) => csvColumns.map((col) => row[col] ?? ""))];
283
+ }, [csvColumns, getValues, getTemplateData]);
284
+ const csvProps = useMemo(
285
+ () => ({
286
+ fileName: `${equipmentType}${dialogMode === TabularModificationType.CREATION ? "_creation" : "_modification"}_template`,
287
+ language,
288
+ getTableData
289
+ }),
290
+ [equipmentType, dialogMode, language, getTableData]
291
+ );
292
+ const getDataFromCsvFile = useCallback(
293
+ (results, file) => {
294
+ clearErrors(TabularFieldConstants.MODIFICATIONS_TABLE);
295
+ setFileWarningMessage(void 0);
296
+ if (dialogMode === TabularModificationType.CREATION) {
297
+ handleTabularCreationParsingError(results);
298
+ } else {
299
+ handleTabularModificationParsingError(results);
300
+ }
301
+ setValue(TabularFieldConstants.CSV_FILENAME, file.name);
302
+ return results.data.map((row) => {
303
+ const sanitizedRow = {
304
+ [FieldConstants.AG_GRID_ROW_UUID]: v4()
305
+ };
306
+ Object.entries(row).forEach(([key, value]) => {
307
+ sanitizedRow[key] = sanitizeRowValue(
308
+ value,
309
+ csvFields.find((field) => field.id === key)
310
+ );
311
+ });
312
+ return sanitizedRow;
313
+ });
314
+ },
315
+ [
316
+ clearErrors,
317
+ csvFields,
318
+ dialogMode,
319
+ handleTabularCreationParsingError,
320
+ handleTabularModificationParsingError,
321
+ setValue
322
+ ]
323
+ );
324
+ useEffect(() => {
325
+ fetchStudyMetadata().then((studyMetadata) => {
326
+ setPredefinedEquipmentProperties(studyMetadata?.predefinedEquipmentProperties ?? {});
327
+ });
328
+ }, []);
329
+ useEffect(() => {
330
+ if (!showCsvFileName) {
331
+ return;
332
+ }
333
+ setSelectedFile(watchFileName ? new File([], watchFileName) : void 0);
334
+ }, [watchFileName, showCsvFileName]);
335
+ useEffect(() => {
336
+ setIsFetching(dataFetching);
337
+ }, [dataFetching]);
338
+ const typesOptions = useMemo(() => {
339
+ return Object.keys(
340
+ dialogMode === TabularModificationType.CREATION ? TABULAR_CREATION_FIELDS : TABULAR_MODIFICATION_FIELDS
341
+ );
342
+ }, [dialogMode]);
343
+ const resetOnTypeChange = useCallback(() => {
344
+ setValue(TabularFieldConstants.CSV_FILENAME, void 0);
345
+ setValue(TabularFieldConstants.TABULAR_PROPERTIES, []);
346
+ setSelectedFile(void 0);
347
+ setFileErrorMessage(void 0);
348
+ setFileWarningMessage(void 0);
349
+ clearErrors(TabularFieldConstants.MODIFICATIONS_TABLE);
350
+ tableRef.current?.replace([]);
351
+ }, [clearErrors, setValue]);
352
+ const equipmentTypeField = /* @__PURE__ */ jsx(
353
+ InputWithPopupConfirmation,
354
+ {
355
+ Input: AutocompleteInput,
356
+ name: FieldConstants.TYPE,
357
+ label: "Type",
358
+ options: typesOptions,
359
+ getOptionLabel: (option) => getTypeLabel(option),
360
+ size: "small",
361
+ formProps: { variant: "outlined" },
362
+ shouldOpenPopup: () => hasNonEmptyRows(getValues(TabularFieldConstants.MODIFICATIONS_TABLE)),
363
+ onValueChange: resetOnTypeChange,
364
+ message: "changeTypeMessage",
365
+ validateButtonLabel: "button.changeType"
366
+ }
367
+ );
368
+ const defaultColDef = useMemo(
369
+ () => ({
370
+ sortable: true,
371
+ resizable: false,
372
+ lockPinned: true,
373
+ wrapHeaderText: true,
374
+ autoHeaderHeight: true,
375
+ cellRenderer: DefaultCellRenderer
376
+ }),
377
+ []
378
+ );
379
+ const columnDefs = useMemo(() => {
380
+ return csvFields.map((field) => {
381
+ const columnDef = {
382
+ field: field.id,
383
+ headerName: intl.formatMessage({ id: field.id }) + (field.required ? " (*)" : ""),
384
+ editable: true,
385
+ singleClickEdit: true
386
+ };
387
+ if (field.id === TabularFieldConstants.EQUIPMENT_ID) {
388
+ columnDef.pinned = true;
389
+ }
390
+ switch (field.type) {
391
+ case TABULAR_BOOLEAN:
392
+ columnDef.cellDataType = TABULAR_BOOLEAN;
393
+ break;
394
+ case TABULAR_NUMBER:
395
+ columnDef.cellDataType = TABULAR_NUMBER;
396
+ columnDef.cellEditor = NumericEditor;
397
+ columnDef.cellEditorParams = { allowNegativeValues: true };
398
+ columnDef.suppressKeyboardEvent = suppressNonNumericKeyboardEvent;
399
+ break;
400
+ case TABULAR_ENUM:
401
+ columnDef.cellDataType = "text";
402
+ columnDef.cellEditor = "agSelectCellEditor";
403
+ columnDef.cellEditorParams = { values: [null, ...field.options ?? []] };
404
+ break;
405
+ }
406
+ return columnDef;
407
+ }).concat(
408
+ selectedProperties.map((propertyName) => ({
409
+ field: PROPERTY_CSV_COLUMN_PREFIX + propertyName,
410
+ headerName: propertyName,
411
+ // property values are always kept as strings (see parseConfig)
412
+ cellDataType: "text",
413
+ editable: true,
414
+ singleClickEdit: true
415
+ }))
416
+ );
417
+ }, [csvFields, selectedProperties, intl]);
418
+ const makeDefaultRowData = useCallback(() => {
419
+ const row = { [FieldConstants.AG_GRID_ROW_UUID]: v4() };
420
+ csvFields.forEach((field) => {
421
+ row[field.id] = null;
422
+ });
423
+ selectedProperties.forEach((propertyName) => {
424
+ row[PROPERTY_CSV_COLUMN_PREFIX + propertyName] = null;
425
+ });
426
+ return row;
427
+ }, [csvFields, selectedProperties]);
428
+ const onPropertiesChange = (formData) => {
429
+ const newSelectedProperties = getSelectedTabularPropertyNames(
430
+ formData[TabularFieldConstants.TABULAR_PROPERTIES]
431
+ );
432
+ if (newSelectedProperties.toString() !== selectedProperties.toString()) {
433
+ clearErrors(TabularFieldConstants.MODIFICATIONS_TABLE);
434
+ const removedPropertyColumns = selectedProperties.filter((name) => !newSelectedProperties.includes(name)).map((name) => PROPERTY_CSV_COLUMN_PREFIX + name);
435
+ const addedPropertyColumns = newSelectedProperties.filter((name) => !selectedProperties.includes(name)).map((name) => PROPERTY_CSV_COLUMN_PREFIX + name);
436
+ const currentRows = getValues(TabularFieldConstants.MODIFICATIONS_TABLE) ?? [];
437
+ const updatedRows = currentRows.map((row) => {
438
+ const newRow = { ...row };
439
+ removedPropertyColumns.forEach((col) => {
440
+ delete newRow[col];
441
+ });
442
+ addedPropertyColumns.forEach((col) => {
443
+ newRow[col] = null;
444
+ });
445
+ return newRow;
446
+ });
447
+ tableRef.current?.replace(updatedRows);
448
+ }
449
+ setValue(TabularFieldConstants.TABULAR_PROPERTIES, formData[TabularFieldConstants.TABULAR_PROPERTIES], {
450
+ shouldDirty: true
451
+ });
452
+ };
453
+ return /* @__PURE__ */ jsxs(Stack, { spacing: 2, paddingTop: 1, sx: { height: "100%" }, children: [
454
+ /* @__PURE__ */ jsx(Grid, { sx: { width: 400, maxWidth: "100%" }, children: equipmentTypeField }),
455
+ equipmentType && /* @__PURE__ */ jsxs(Fragment, { children: [
456
+ /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, justifyContent: "space-between", alignItems: "center", children: [
457
+ /* @__PURE__ */ jsxs(Grid, { container: true, alignItems: "center", children: [
458
+ /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(
459
+ Button,
460
+ {
461
+ variant: "contained",
462
+ onClick: () => {
463
+ propertiesDialogOpen.setTrue();
464
+ },
465
+ children: /* @__PURE__ */ jsx(FormattedMessage, { id: "DefinePropertiesButton" })
466
+ }
467
+ ) }),
468
+ /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(
469
+ CsvDownloadButton,
470
+ {
471
+ data: getTemplateData,
472
+ fileName: csvProps.fileName,
473
+ language,
474
+ labelId: "GenerateCSV",
475
+ variant: "contained"
476
+ }
477
+ ) }),
478
+ renderActions?.({
479
+ dialogMode,
480
+ equipmentType,
481
+ csvColumns,
482
+ commentLines,
483
+ predefinedEquipmentProperties
484
+ })
485
+ ] }),
486
+ /* @__PURE__ */ jsx(Grid, { sx: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ jsx(
487
+ CsvPicker,
488
+ {
489
+ label: "UploadCSV",
490
+ requiredColumns,
491
+ language,
492
+ parseConfig,
493
+ selectedFile: showCsvFileName ? selectedFile : void 0,
494
+ onFileChange: setSelectedFile,
495
+ onFileError: setFileErrorMessage,
496
+ getTableData: () => getValues(TabularFieldConstants.MODIFICATIONS_TABLE),
497
+ onReplace: (results, file) => tableRef.current?.replace(getDataFromCsvFile(results, file)),
498
+ onAppend: (results, file) => tableRef.current?.append(getDataFromCsvFile(results, file))
499
+ }
500
+ ) })
501
+ ] }),
502
+ fileErrorMessage && /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(Alert, { severity: "error", children: fileErrorMessage }) }),
503
+ fileWarningMessage && /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(Alert, { severity: "warning", children: fileWarningMessage }) }),
504
+ /* @__PURE__ */ jsx(Grid, { sx: { flexGrow: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsx(
505
+ CustomAgGridTable,
506
+ {
507
+ ref: tableRef,
508
+ name: TabularFieldConstants.MODIFICATIONS_TABLE,
509
+ columnDefs,
510
+ defaultColDef,
511
+ makeDefaultRowData,
512
+ loading: isFetching,
513
+ pagination: true,
514
+ rowSelection: {
515
+ mode: "multiRow"
516
+ },
517
+ overrideLocales: AGGRID_LOCALES,
518
+ csvProps
519
+ }
520
+ ) })
521
+ ] }),
522
+ /* @__PURE__ */ jsx(
523
+ DefineTabularPropertiesDialog,
524
+ {
525
+ open: propertiesDialogOpen,
526
+ equipmentType,
527
+ currentProperties: tabularProperties,
528
+ predefinedEquipmentProperties,
529
+ onValidate: onPropertiesChange
530
+ }
531
+ )
532
+ ] });
533
+ }
534
+ export {
535
+ TabularForm
536
+ };
@@ -0,0 +1,7 @@
1
+ export * from './properties';
2
+ export * from './tabular.constants';
3
+ export * from './tabular.types';
4
+ export * from './tabular.utils';
5
+ export * from './tabularCreation.utils';
6
+ export * from './tabularModification.utils';
7
+ export * from './TabularForm';