@gridsuite/commons-ui 0.250.0 → 0.252.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/components/index.js +2 -1
  2. package/dist/components/ui/index.js +2 -1
  3. package/dist/components/ui/reactHookForm/constants.d.ts +1 -0
  4. package/dist/components/ui/reactHookForm/constants.js +2 -0
  5. package/dist/components/ui/reactHookForm/index.js +2 -1
  6. package/dist/features/index.js +5 -2
  7. package/dist/features/parameters/common/hook/use-tabs.d.ts +3 -1
  8. package/dist/features/parameters/common/hook/use-tabs.js +21 -15
  9. package/dist/features/parameters/dynamic-margin-calculation/constants.d.ts +0 -1
  10. package/dist/features/parameters/dynamic-margin-calculation/constants.js +0 -2
  11. package/dist/features/parameters/dynamic-margin-calculation/index.js +1 -2
  12. package/dist/features/parameters/dynamic-margin-calculation/loads-variations-parameters.js +2 -2
  13. package/dist/features/parameters/index.d.ts +1 -0
  14. package/dist/features/parameters/index.js +5 -2
  15. package/dist/features/parameters/loadflow/load-flow-parameters-utils.d.ts +3 -2
  16. package/dist/features/parameters/loadflow/load-flow-parameters-utils.js +22 -3
  17. package/dist/features/parameters/loadflow/use-load-flow-parameters-form.js +14 -29
  18. package/dist/features/parameters/network-visualizations/network-visualizations-parameters-dialog.js +1 -0
  19. package/dist/features/parameters/network-visualizations/network-visualizations-parameters-inline.js +1 -1
  20. package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.d.ts +3 -1
  21. package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.js +19 -6
  22. package/dist/features/parameters/security-analysis/constants.d.ts +3 -3
  23. package/dist/features/parameters/security-analysis/constants.js +3 -3
  24. package/dist/features/parameters/security-analysis/security-analysis-parameters-content.d.ts +4 -6
  25. package/dist/features/parameters/security-analysis/security-analysis-parameters-content.js +26 -30
  26. package/dist/features/parameters/security-analysis/security-analysis-parameters-dialog.js +2 -1
  27. package/dist/features/parameters/security-analysis/security-analysis-parameters-form.js +1 -3
  28. package/dist/features/parameters/security-analysis/security-analysis-parameters-inline.js +4 -1
  29. package/dist/features/parameters/security-analysis/security-analysis-parameters-utils.d.ts +2 -0
  30. package/dist/features/parameters/security-analysis/security-analysis-parameters-utils.js +54 -0
  31. package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.d.ts +8 -1
  32. package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.js +21 -2
  33. package/dist/features/parameters/sensi/sensitivity-parameters-selector.js +9 -8
  34. package/dist/features/parameters/short-circuit/short-circuit-icc-cluster-table-cell.js +1 -1
  35. package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.d.ts +1 -0
  36. package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.js +27 -2
  37. package/dist/features/parameters/short-circuit/use-short-circuit-parameters-form.js +15 -24
  38. package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +19 -18
  39. package/dist/features/parameters/voltage-init/voltage-init-form-utils.d.ts +2 -0
  40. package/dist/features/parameters/voltage-init/voltage-init-form-utils.js +14 -1
  41. package/dist/features/parameters/voltage-init/voltage-init-parameters-dialog.js +1 -0
  42. package/dist/features/parameters/voltage-init/voltage-init-parameters-form.js +27 -38
  43. package/dist/features/parameters/voltage-init/voltage-init-parameters-inline.js +1 -1
  44. package/dist/features/process-configs/process-configs.type.d.ts +8 -3
  45. package/dist/features/process-configs/security-analysis/update-sa-process-config.js +2 -0
  46. package/dist/features/process-configs/security-analysis/update-sa-process-configs-utils.d.ts +6 -2
  47. package/dist/features/process-configs/security-analysis/update-sa-process-configs-utils.js +17 -9
  48. package/dist/features/process-configs/update-process-config-modifications.js +25 -2
  49. package/dist/index.js +6 -2
  50. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Stack, Tabs, Tab, Grid2 } from "@mui/material";
3
3
  import { FormattedMessage } from "react-intl";
4
- import { parametersStyles, getTabStyle, getTabIndicatorStyle } from "../parameters-style.js";
4
+ import { parametersStyles, getTabStyle } from "../parameters-style.js";
5
5
  import "@mui/icons-material";
6
6
  import "react";
7
7
  import { TabPanel } from "../common/parameters.js";
@@ -47,43 +47,32 @@ function VoltageInitParametersForm({
47
47
  }) {
48
48
  const { selectedTab, handleTabChange, tabIndexesWithError } = voltageInitMethods;
49
49
  return /* @__PURE__ */ jsxs(Stack, { sx: parametersStyles.scrollableGrid, children: [
50
- /* @__PURE__ */ jsxs(
51
- Tabs,
52
- {
53
- value: selectedTab,
54
- variant: "scrollable",
55
- onChange: handleTabChange,
56
- TabIndicatorProps: {
57
- sx: getTabIndicatorStyle(tabIndexesWithError, selectedTab)
58
- },
59
- children: [
60
- /* @__PURE__ */ jsx(
61
- Tab,
62
- {
63
- label: /* @__PURE__ */ jsx(FormattedMessage, { id: "VoltageInitParametersGeneralTabLabel" }),
64
- value: VoltageInitTabValues.GENERAL,
65
- sx: getTabStyle(tabIndexesWithError, VoltageInitTabValues.GENERAL)
66
- }
67
- ),
68
- /* @__PURE__ */ jsx(
69
- Tab,
70
- {
71
- label: /* @__PURE__ */ jsx(FormattedMessage, { id: "VoltageLimits" }),
72
- value: VoltageInitTabValues.VOLTAGE_LIMITS,
73
- sx: getTabStyle(tabIndexesWithError, VoltageInitTabValues.VOLTAGE_LIMITS)
74
- }
75
- ),
76
- /* @__PURE__ */ jsx(
77
- Tab,
78
- {
79
- label: /* @__PURE__ */ jsx(FormattedMessage, { id: "EquipmentSelection" }),
80
- value: VoltageInitTabValues.EQUIPMENTS_SELECTION,
81
- sx: getTabStyle(tabIndexesWithError, VoltageInitTabValues.EQUIPMENTS_SELECTION)
82
- }
83
- )
84
- ]
85
- }
86
- ),
50
+ /* @__PURE__ */ jsxs(Tabs, { value: selectedTab, variant: "scrollable", onChange: handleTabChange, children: [
51
+ /* @__PURE__ */ jsx(
52
+ Tab,
53
+ {
54
+ label: /* @__PURE__ */ jsx(FormattedMessage, { id: "VoltageInitParametersGeneralTabLabel" }),
55
+ value: VoltageInitTabValues.GENERAL,
56
+ sx: getTabStyle(tabIndexesWithError, VoltageInitTabValues.GENERAL)
57
+ }
58
+ ),
59
+ /* @__PURE__ */ jsx(
60
+ Tab,
61
+ {
62
+ label: /* @__PURE__ */ jsx(FormattedMessage, { id: "VoltageLimits" }),
63
+ value: VoltageInitTabValues.VOLTAGE_LIMITS,
64
+ sx: getTabStyle(tabIndexesWithError, VoltageInitTabValues.VOLTAGE_LIMITS)
65
+ }
66
+ ),
67
+ /* @__PURE__ */ jsx(
68
+ Tab,
69
+ {
70
+ label: /* @__PURE__ */ jsx(FormattedMessage, { id: "EquipmentSelection" }),
71
+ value: VoltageInitTabValues.EQUIPMENTS_SELECTION,
72
+ sx: getTabStyle(tabIndexesWithError, VoltageInitTabValues.EQUIPMENTS_SELECTION)
73
+ }
74
+ )
75
+ ] }),
87
76
  /* @__PURE__ */ jsxs(Grid2, { container: true, children: [
88
77
  /* @__PURE__ */ jsx(TabPanel, { value: selectedTab, index: VoltageInitTabValues.GENERAL, children: /* @__PURE__ */ jsx(GeneralParameters, { withApplyModifications: !!showActionsButtons }) }),
89
78
  /* @__PURE__ */ jsx(TabPanel, { value: selectedTab, index: VoltageInitTabValues.VOLTAGE_LIMITS, children: /* @__PURE__ */ jsx(VoltageLimitsParameters, {}) }),
@@ -104,7 +104,7 @@ function VoltageInitParametersInLine({
104
104
  },
105
105
  selectParameterHandler: handleLoadParameters,
106
106
  resetHandler: resetVoltageInitParameters,
107
- validateHandler: handleSubmit(voltageInitMethods.onSaveInline),
107
+ validateHandler: handleSubmit(voltageInitMethods.onSaveInline, voltageInitMethods.onValidationError),
108
108
  children: /* @__PURE__ */ jsx(VoltageInitParametersForm, { voltageInitMethods, showActionsButtons: true })
109
109
  }
110
110
  )
@@ -4,9 +4,14 @@ export declare enum ProcessType {
4
4
  SECURITY_ANALYSIS = "SECURITY_ANALYSIS",
5
5
  LOADFLOW = "LOADFLOW"
6
6
  }
7
+ export interface ModificationInfo {
8
+ modificationUuid: UUID;
9
+ description: string | null;
10
+ active: boolean;
11
+ }
7
12
  export interface ProcessConfigBaseBackend {
8
13
  processType: ProcessType;
9
- modificationUuids: UUID[];
14
+ modifications: ModificationInfo[];
10
15
  }
11
16
  export interface SecurityAnalysisProcessConfigBackend extends ProcessConfigBaseBackend {
12
17
  processType: ProcessType.SECURITY_ANALYSIS;
@@ -18,9 +23,9 @@ export type PersistedProcessConfigBackend = {
18
23
  id: UUID;
19
24
  processConfig: ProcessConfigBackend;
20
25
  };
21
- export type SecurityAnalysisProcessConfig = Omit<SecurityAnalysisProcessConfigBackend, 'securityAnalysisParametersUuid' | 'loadflowParametersUuid' | 'modificationUuids'> & {
26
+ export type SecurityAnalysisProcessConfig = Omit<SecurityAnalysisProcessConfigBackend, 'securityAnalysisParametersUuid' | 'loadflowParametersUuid' | 'modifications'> & {
22
27
  modifications: (IdName & {
23
- enabled: boolean;
28
+ active: boolean;
24
29
  description?: string;
25
30
  })[];
26
31
  loadflowParameters: IdName;
@@ -44,7 +44,9 @@ import "../../parameters/loadflow/load-flow-parameters-context.js";
44
44
  import "../../parameters/loadflow/load-flow-advanced-parameters.js";
45
45
  import "../../parameters/loadflow/load-flow-parameters-content.js";
46
46
  import "../../parameters/short-circuit/short-circuit-parameters-content.js";
47
+ import "../../parameters/voltage-init/voltage-init-form-utils.js";
47
48
  import "react-dom";
49
+ import "../../parameters/security-analysis/security-analysis-parameters-utils.js";
48
50
  import "../../parameters/sensi/utils.js";
49
51
  import "../../parameters/sensi/columns-definitions.js";
50
52
  import "../../parameters/dynamic-simulation/use-dynamic-simulation-parameters-form.js";
@@ -14,6 +14,8 @@ export declare function getSAProcessConfigFormDataFromFetchedElement(processConf
14
14
  id: `${string}-${string}-${string}-${string}-${string}`;
15
15
  name: string | undefined;
16
16
  }[];
17
+ description: string;
18
+ active: boolean;
17
19
  }[];
18
20
  securityAnalysisParameters: import('../../..').IdName[];
19
21
  loadflowParameters: import('../../..').IdName[];
@@ -23,6 +25,8 @@ export declare const updateSAProcessConfigFormSchema: yup.ObjectSchema<{
23
25
  name: string;
24
26
  description: string | undefined;
25
27
  modifications: {
28
+ description?: string | null | undefined;
29
+ active: NonNullable<boolean | undefined>;
26
30
  modification: {
27
31
  id: string;
28
32
  name: string;
@@ -49,8 +53,8 @@ export declare function toSAProcessConfig(persistedProcessConfig: PersistedProce
49
53
  modifications: {
50
54
  id: `${string}-${string}-${string}-${string}-${string}`;
51
55
  name: string;
52
- enabled: true;
53
- description: undefined;
56
+ active: boolean;
57
+ description: string | undefined;
54
58
  }[];
55
59
  securityAnalysisParameters: {
56
60
  id: `${string}-${string}-${string}-${string}-${string}`;
@@ -12,7 +12,9 @@ function getSAProcessConfigFormDataFromFetchedElement(processConfig, name, descr
12
12
  name,
13
13
  description: description ?? void 0,
14
14
  modifications: processConfig.modifications.map((modification) => ({
15
- modification: [{ id: modification.id, name: modification.name }]
15
+ modification: [{ id: modification.id, name: modification.name }],
16
+ description: modification.description ?? "",
17
+ active: modification.active
16
18
  })),
17
19
  securityAnalysisParameters: [processConfig.securityAnalysisParameters],
18
20
  loadflowParameters: [processConfig.loadflowParameters]
@@ -23,7 +25,11 @@ function getSAProcessConfigBackendFromFormData(formData) {
23
25
  processType: ProcessType.SECURITY_ANALYSIS,
24
26
  loadflowParametersUuid: formData.loadflowParameters[0].id,
25
27
  securityAnalysisParametersUuid: formData.securityAnalysisParameters[0].id,
26
- modificationUuids: formData.modifications.map((modification) => modification.modification[0].id)
28
+ modifications: formData.modifications.map((row) => ({
29
+ modificationUuid: row.modification[0].id,
30
+ description: row.description ?? null,
31
+ active: row.active
32
+ }))
27
33
  };
28
34
  }
29
35
  const updateSAProcessConfigFormSchema = yup.object().shape({
@@ -36,7 +42,9 @@ const updateSAProcessConfigFormSchema = yup.object().shape({
36
42
  id: yup.string().required(),
37
43
  name: yup.string().required()
38
44
  }).required()
39
- ).length(1, YUP_REQUIRED)
45
+ ).length(1, YUP_REQUIRED),
46
+ description: yup.string().nullable(),
47
+ active: yup.boolean().required()
40
48
  })
41
49
  ),
42
50
  [FieldConstants.LOADFLOW_PARAMETERS]: yup.array().required().of(yup.object().shape({ id: yup.string().required(), name: yup.string().required() })).length(1, YUP_REQUIRED),
@@ -45,18 +53,18 @@ const updateSAProcessConfigFormSchema = yup.object().shape({
45
53
  async function toSAProcessConfig(persistedProcessConfig) {
46
54
  const { processConfig } = persistedProcessConfig;
47
55
  const allUuids = /* @__PURE__ */ new Set([
48
- ...processConfig.modificationUuids,
56
+ ...processConfig.modifications.map((modification) => modification.modificationUuid),
49
57
  processConfig.securityAnalysisParametersUuid,
50
58
  processConfig.loadflowParametersUuid
51
59
  ]);
52
60
  const elementNamesByUuid = await fetchElementNames(allUuids);
53
61
  return {
54
62
  processType: processConfig.processType,
55
- modifications: processConfig.modificationUuids.map((uuid) => ({
56
- id: uuid,
57
- name: elementNamesByUuid[uuid],
58
- enabled: true,
59
- description: void 0
63
+ modifications: processConfig.modifications.map((modification) => ({
64
+ id: modification.modificationUuid,
65
+ name: elementNamesByUuid[modification.modificationUuid],
66
+ active: modification.active,
67
+ description: modification.description ?? void 0
60
68
  })),
61
69
  securityAnalysisParameters: {
62
70
  id: processConfig.securityAnalysisParametersUuid,
@@ -22,6 +22,7 @@ import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
22
22
  import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
23
23
  import "@material-symbols/svg-400/outlined/add_notes.svg?react";
24
24
  import "../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
25
+ import { DESCRIPTION, ACTIVE } from "../../components/ui/reactHookForm/constants.js";
25
26
  import "../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
26
27
  import "../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
27
28
  import "../../components/ui/treeViewFinder/TreeViewFinder.js";
@@ -33,6 +34,7 @@ import "react-resizable-panels";
33
34
  import "react-papaparse";
34
35
  import { DndTable } from "../../components/composite/dnd-table/dnd-table.js";
35
36
  import { DndColumnType } from "../../components/composite/dnd-table/dnd-table.type.js";
37
+ import { getDefaultRowData } from "../../components/composite/dnd-table/dnd-table-utils.js";
36
38
  import "autosuggest-highlight/match";
37
39
  import "autosuggest-highlight/parse";
38
40
  import "clsx";
@@ -71,7 +73,7 @@ function UpdateProcessConfigModifications({ name }) {
71
73
  name: `${name}[${rowIndex}].modification`,
72
74
  allowMultiSelect: false,
73
75
  elementType: ElementType.MODIFICATION,
74
- titleId: "modifications",
76
+ titleId: "process_config/modifications",
75
77
  label: void 0
76
78
  }
77
79
  ),
@@ -86,10 +88,31 @@ function UpdateProcessConfigModifications({ name }) {
86
88
  editable: true,
87
89
  label: intl.formatMessage({ id: "process_config/modifications" }),
88
90
  component: modificationSelector
91
+ },
92
+ {
93
+ label: intl.formatMessage({ id: "description" }),
94
+ sxHeader: { textAlign: "center" },
95
+ dataKey: DESCRIPTION,
96
+ initialValue: "",
97
+ editable: true,
98
+ width: "8rem",
99
+ type: DndColumnType.DESCRIPTIONS
100
+ },
101
+ {
102
+ label: intl.formatMessage({ id: "Active" }),
103
+ sxHeader: { textAlign: "center" },
104
+ dataKey: ACTIVE,
105
+ initialValue: true,
106
+ editable: true,
107
+ width: "4rem",
108
+ type: DndColumnType.SWITCH
89
109
  }
90
110
  ];
91
111
  }, [modificationSelector, name, intl]);
92
- const createModification = () => [{ modification: [] }];
112
+ const createModification = useCallback(
113
+ () => [{ ...getDefaultRowData(columnsDefinition), modification: [] }],
114
+ [columnsDefinition]
115
+ );
93
116
  return /* @__PURE__ */ jsx(
94
117
  DndTable,
95
118
  {
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@ import { SubmitButton } from "./components/ui/reactHookForm/utils/SubmitButton.j
43
43
  import { TextFieldWithAdornment } from "./components/ui/reactHookForm/utils/TextFieldWithAdornment.js";
44
44
  import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./components/ui/reactHookForm/utils/functions.js";
45
45
  import { HelperPreviousValue } from "./components/ui/reactHookForm/utils/HelperPreviousValue.js";
46
- import { DESCRIPTION, DIRECTORY_ITEM, DIRECTORY_ITEM_FULL_PATH, DIRECTORY_ITEM_ID, NAME } from "./components/ui/reactHookForm/constants.js";
46
+ import { ACTIVE, DESCRIPTION, DIRECTORY_ITEM, DIRECTORY_ITEM_FULL_PATH, DIRECTORY_ITEM_ID, NAME } from "./components/ui/reactHookForm/constants.js";
47
47
  import { ExpandableInput } from "./components/ui/reactHookForm/expandableInput/ExpandableInput.js";
48
48
  import { CountrySelectionInput } from "./components/ui/reactHookForm/CountrySelectionInput.js";
49
49
  import { CheckboxNullableInput } from "./components/ui/reactHookForm/CheckboxNullableInput.js";
@@ -225,8 +225,9 @@ import { COLUMNS_DEFINITIONS_HVDCS, COLUMNS_DEFINITIONS_INJECTIONS, COLUMNS_DEFI
225
225
  import { DynamicSimulationInline } from "./features/parameters/dynamic-simulation/dynamic-simulation-inline.js";
226
226
  import { CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME, SCENARIO_DURATION } from "./features/parameters/dynamic-security-analysis/constants.js";
227
227
  import { DynamicSecurityAnalysisInline } from "./features/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js";
228
- import { ACCURACY, ACTIVE, CALCULATION_TYPE, LOADS_VARIATIONS, LOAD_FILTERS, LOAD_INCREASE_START_TIME, LOAD_INCREASE_STOP_TIME, LOAD_MODELS_RULE, MARGIN_CALCULATION_START_TIME, START_TIME, STOP_TIME, VARIATION } from "./features/parameters/dynamic-margin-calculation/constants.js";
228
+ import { ACCURACY, CALCULATION_TYPE, LOADS_VARIATIONS, LOAD_FILTERS, LOAD_INCREASE_START_TIME, LOAD_INCREASE_STOP_TIME, LOAD_MODELS_RULE, MARGIN_CALCULATION_START_TIME, START_TIME, STOP_TIME, VARIATION } from "./features/parameters/dynamic-margin-calculation/constants.js";
229
229
  import { DynamicMarginCalculationInline } from "./features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js";
230
+ import { getTabIndicatorStyle, getTabStyle, parametersStyles } from "./features/parameters/parameters-style.js";
230
231
  import { filledTextField, italicFontTextField, standardTextField } from "./features/network-modifications/common/form.utils.js";
231
232
  import { PropertiesForm } from "./features/network-modifications/common/properties/PropertiesForm.js";
232
233
  import { PropertyForm } from "./features/network-modifications/common/properties/PropertyForm.js";
@@ -1438,6 +1439,8 @@ export {
1438
1439
  getStudyUrlWithNodeUuid,
1439
1440
  getStudyUrlWithNodeUuidAndRootNetworkUuid,
1440
1441
  getSystemLanguage,
1442
+ getTabIndicatorStyle,
1443
+ getTabStyle,
1441
1444
  getUser,
1442
1445
  getUserToken,
1443
1446
  getVoltageInitParameters,
@@ -1528,6 +1531,7 @@ export {
1528
1531
  onlyStartedGeneratorsOptions,
1529
1532
  parametersEn,
1530
1533
  parametersFr,
1534
+ parametersStyles,
1531
1535
  parseError,
1532
1536
  parseIntData,
1533
1537
  processConfigEn,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.250.0",
3
+ "version": "0.252.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "author": "gridsuite team",
6
6
  "homepage": "https://github.com/gridsuite",