@gridsuite/commons-ui 0.291.0 → 0.293.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 (92) hide show
  1. package/dist/components/ui/reactHookForm/directory-item-input/directory-item-input.js +67 -26
  2. package/dist/features/index.js +32 -11
  3. package/dist/features/parameters/voltage-init/equipment-selection-parameters.js +6 -2
  4. package/dist/features/process-configs/common/FormSection.d.ts +8 -0
  5. package/dist/features/process-configs/common/FormSection.js +11 -0
  6. package/dist/features/process-configs/common/FormSubSection.d.ts +8 -0
  7. package/dist/features/process-configs/common/FormSubSection.js +11 -0
  8. package/dist/features/process-configs/common/GeneralInformationSection.d.ts +8 -0
  9. package/dist/features/process-configs/{shortcircuit/sc-process-config-edition.utils.js → common/GeneralInformationSection.js} +57 -54
  10. package/dist/features/process-configs/{security-analysis/index.d.ts → common/ModificationsSubSection.d.ts} +1 -3
  11. package/dist/features/process-configs/common/ModificationsSubSection.js +14 -0
  12. package/dist/features/process-configs/common/ProvidersParametersSubSection.d.ts +5 -0
  13. package/dist/features/process-configs/{loadflow/lf-process-config-edition.js → common/ProvidersParametersSubSection.js} +35 -26
  14. package/dist/features/process-configs/common/SpecificInformationSection.d.ts +8 -0
  15. package/dist/features/process-configs/common/SpecificInformationSection.js +25 -0
  16. package/dist/features/process-configs/common/index.d.ts +13 -1
  17. package/dist/features/process-configs/common/index.js +26 -2
  18. package/dist/features/process-configs/common/process-config-backend.type.d.ts +15 -0
  19. package/dist/features/process-configs/common/process-config-form.constants.d.ts +7 -0
  20. package/dist/features/process-configs/common/process-config-form.constants.js +39 -0
  21. package/dist/features/process-configs/common/process-config-form.schema.d.ts +29 -0
  22. package/dist/features/process-configs/{loadflow/lf-process-config-edition.utils.js → common/process-config-form.schema.js} +33 -51
  23. package/dist/features/process-configs/common/process-config-form.types.d.ts +45 -0
  24. package/dist/features/process-configs/common/process-config-mapping.d.ts +4 -0
  25. package/dist/features/process-configs/common/process-config-mapping.js +57 -0
  26. package/dist/features/process-configs/common/process-config-modifications-edition.utils.d.ts +0 -3
  27. package/dist/features/process-configs/common/process-config-modifications-edition.utils.js +0 -2
  28. package/dist/features/process-configs/common/process-config-type.definitions.d.ts +56 -0
  29. package/dist/features/process-configs/common/process-config-type.definitions.js +70 -0
  30. package/dist/features/process-configs/form/components/ProcessTypeChangeDialog.d.ts +13 -0
  31. package/dist/features/process-configs/form/components/ProcessTypeChangeDialog.js +27 -0
  32. package/dist/features/process-configs/form/components/ProcessTypeSelect.d.ts +6 -0
  33. package/dist/features/process-configs/form/components/ProcessTypeSelect.js +69 -0
  34. package/dist/features/process-configs/form/hooks/usePrefillSelection.d.ts +19 -0
  35. package/dist/features/process-configs/form/hooks/usePrefillSelection.js +51 -0
  36. package/dist/features/process-configs/form/hooks/useProcessConfigForm.d.ts +19 -0
  37. package/dist/features/process-configs/form/hooks/useProcessConfigForm.js +74 -0
  38. package/dist/features/process-configs/form/hooks/useProcessTypeGuard.d.ts +10 -0
  39. package/dist/features/process-configs/form/hooks/useProcessTypeGuard.js +67 -0
  40. package/dist/features/process-configs/form/process-config-form.d.ts +2 -0
  41. package/dist/features/process-configs/form/process-config-form.js +170 -0
  42. package/dist/features/process-configs/form/utils/form.utils.d.ts +3 -0
  43. package/dist/features/process-configs/form/utils/form.utils.js +36 -0
  44. package/dist/features/process-configs/index.d.ts +3 -5
  45. package/dist/features/process-configs/index.js +33 -12
  46. package/dist/features/process-configs/process-config-edition-dialog.d.ts +2 -0
  47. package/dist/features/process-configs/{process-config.utils.js → process-config-edition-dialog.js} +86 -26
  48. package/dist/index.js +32 -11
  49. package/dist/translations/en/businessErrorsEn.d.ts +1 -0
  50. package/dist/translations/en/businessErrorsEn.js +2 -1
  51. package/dist/translations/en/parameters.d.ts +1 -0
  52. package/dist/translations/en/parameters.js +2 -1
  53. package/dist/translations/en/processConfigEn.d.ts +18 -0
  54. package/dist/translations/en/processConfigEn.js +19 -1
  55. package/dist/translations/fr/businessErrorsFr.d.ts +1 -0
  56. package/dist/translations/fr/businessErrorsFr.js +2 -1
  57. package/dist/translations/fr/parameters.d.ts +1 -0
  58. package/dist/translations/fr/parameters.js +3 -2
  59. package/dist/translations/fr/processConfigFr.d.ts +18 -0
  60. package/dist/translations/fr/processConfigFr.js +19 -1
  61. package/package.json +1 -1
  62. package/dist/features/process-configs/lf-process-config-edition-dialog.d.ts +0 -3
  63. package/dist/features/process-configs/lf-process-config-edition-dialog.js +0 -128
  64. package/dist/features/process-configs/loadflow/index.d.ts +0 -9
  65. package/dist/features/process-configs/loadflow/index.js +0 -9
  66. package/dist/features/process-configs/loadflow/lf-process-config-edition.d.ts +0 -1
  67. package/dist/features/process-configs/loadflow/lf-process-config-edition.utils.d.ts +0 -39
  68. package/dist/features/process-configs/loadflow/lf-process-config.type.d.ts +0 -6
  69. package/dist/features/process-configs/process-config-edition.utils.d.ts +0 -13
  70. package/dist/features/process-configs/process-config.type.d.ts +0 -16
  71. package/dist/features/process-configs/process-config.type.js +0 -1
  72. package/dist/features/process-configs/process-config.utils.d.ts +0 -33
  73. package/dist/features/process-configs/sa-process-config-edition-dialog.d.ts +0 -3
  74. package/dist/features/process-configs/sa-process-config-edition-dialog.js +0 -128
  75. package/dist/features/process-configs/sc-process-config-edition-dialog.d.ts +0 -3
  76. package/dist/features/process-configs/sc-process-config-edition-dialog.js +0 -141
  77. package/dist/features/process-configs/security-analysis/index.js +0 -9
  78. package/dist/features/process-configs/security-analysis/sa-process-config-edition.d.ts +0 -1
  79. package/dist/features/process-configs/security-analysis/sa-process-config-edition.js +0 -100
  80. package/dist/features/process-configs/security-analysis/sa-process-config-edition.utils.d.ts +0 -45
  81. package/dist/features/process-configs/security-analysis/sa-process-config-edition.utils.js +0 -111
  82. package/dist/features/process-configs/security-analysis/sa-process-config.type.d.ts +0 -7
  83. package/dist/features/process-configs/security-analysis/sa-process-config.type.js +0 -1
  84. package/dist/features/process-configs/shortcircuit/index.d.ts +0 -9
  85. package/dist/features/process-configs/shortcircuit/index.js +0 -9
  86. package/dist/features/process-configs/shortcircuit/sc-process-config-edition.d.ts +0 -1
  87. package/dist/features/process-configs/shortcircuit/sc-process-config-edition.js +0 -90
  88. package/dist/features/process-configs/shortcircuit/sc-process-config-edition.utils.d.ts +0 -39
  89. package/dist/features/process-configs/shortcircuit/sc-process-config.type.d.ts +0 -6
  90. package/dist/features/process-configs/shortcircuit/sc-process-config.type.js +0 -1
  91. /package/dist/features/process-configs/{loadflow/lf-process-config.type.js → common/process-config-backend.type.js} +0 -0
  92. /package/dist/features/process-configs/{process-config-edition.utils.js → common/process-config-form.types.js} +0 -0
@@ -1,64 +1,105 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Box, Stack, Grid, Tooltip, Typography, FormHelperText, Button } from "@mui/material";
3
+ import { FolderOutlined } from "@mui/icons-material";
3
4
  import { useIntl, FormattedMessage } from "react-intl";
4
5
  import { useState, useMemo, useCallback } from "react";
5
6
  import { useController } from "react-hook-form";
6
- import { FolderOutlined } from "@mui/icons-material";
7
- import { DIRECTORY_ITEM_FULL_PATH, DIRECTORY_ITEM_ID } from "../constants.js";
8
- import { getAbsenceLabelKeyFromType } from "./directory-item-utils.js";
9
7
  import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItemSelector.js";
8
+ import { getAbsenceLabelKeyFromType } from "./directory-item-utils.js";
9
+ import { DIRECTORY_ITEM_FULL_PATH, DIRECTORY_ITEM_ID } from "../constants.js";
10
10
  function DirectoryItemInput({ name, types, ...props }) {
11
11
  const [isOpen, setIsOpen] = useState(false);
12
12
  const {
13
13
  field: { onChange, value },
14
14
  fieldState: { error }
15
15
  } = useController({ name });
16
- const nodeInfos = value;
16
+ const selectedFolder = value;
17
17
  const intl = useIntl();
18
- const breadcrumb = useMemo(() => {
19
- return nodeInfos?.[DIRECTORY_ITEM_FULL_PATH] ? nodeInfos[DIRECTORY_ITEM_FULL_PATH] : void 0;
20
- }, [nodeInfos]);
21
- const onNodeChanged = useCallback(
22
- (nodes) => {
23
- if (nodes.length > 0) {
24
- const fullPath = nodes[0]?.name;
25
- const nodeId = nodes[0]?.id;
26
- if (nodeId) {
27
- const newNodeInfos = {
28
- [DIRECTORY_ITEM_ID]: nodeId,
18
+ const path = useMemo(() => {
19
+ return selectedFolder?.[DIRECTORY_ITEM_FULL_PATH] ? selectedFolder[DIRECTORY_ITEM_FULL_PATH] : void 0;
20
+ }, [selectedFolder]);
21
+ const onSelectFolder = useCallback(
22
+ (folders) => {
23
+ const folder = folders.length > 0 ? folders[0] : void 0;
24
+ if (folder) {
25
+ const parentNames = folder.parents?.map((parent) => parent.name) ?? [];
26
+ const fullPath = [...parentNames, folder.name].join(" / ");
27
+ const folderId = folder.id;
28
+ if (folderId) {
29
+ onChange({
30
+ [DIRECTORY_ITEM_ID]: folderId,
29
31
  [DIRECTORY_ITEM_FULL_PATH]: fullPath
30
- };
31
- onChange(newNodeInfos);
32
+ });
32
33
  }
33
34
  }
34
35
  setIsOpen(false);
35
36
  },
36
37
  [onChange]
37
38
  );
39
+ const [head, tail] = useMemo(() => {
40
+ if (!path) {
41
+ return ["", ""];
42
+ }
43
+ const lastSeparatorIndex = path.lastIndexOf(" / ");
44
+ return lastSeparatorIndex === -1 ? [path, ""] : [path.slice(0, lastSeparatorIndex), path.slice(lastSeparatorIndex)];
45
+ }, [path]);
38
46
  return /* @__PURE__ */ jsxs(Box, { children: [
39
47
  /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", children: [
40
- /* @__PURE__ */ jsxs(Grid, { container: true, alignItems: "center", children: [
41
- /* @__PURE__ */ jsx(Grid, { paddingTop: 1, children: /* @__PURE__ */ jsx(FolderOutlined, {}) }),
42
- /* @__PURE__ */ jsx(Grid, { paddingTop: 1, paddingLeft: 1, children: /* @__PURE__ */ jsx(
48
+ /* @__PURE__ */ jsxs(Grid, { container: true, alignItems: "center", sx: { flex: 1, minWidth: 0 }, children: [
49
+ /* @__PURE__ */ jsx(
50
+ Grid,
51
+ {
52
+ sx: {
53
+ display: "flex",
54
+ alignItems: "center",
55
+ justifyContent: "center",
56
+ flexShrink: 0
57
+ },
58
+ children: /* @__PURE__ */ jsx(FolderOutlined, {})
59
+ }
60
+ ),
61
+ /* @__PURE__ */ jsx(Grid, { size: { xs: "grow", sm: 8 }, sx: { minWidth: 0, paddingLeft: 1 }, children: /* @__PURE__ */ jsx(
43
62
  Tooltip,
44
63
  {
45
- title: nodeInfos?.[DIRECTORY_ITEM_FULL_PATH] ?? "",
64
+ title: path ?? "",
46
65
  slotProps: {
47
66
  tooltip: {
48
67
  sx: {
49
68
  maxWidth: "none"
50
- // to override the background of text is auto cut
51
69
  }
52
70
  }
53
71
  },
54
- children: /* @__PURE__ */ jsx(Typography, { fontWeight: breadcrumb ? void 0 : "bold", noWrap: true, children: breadcrumb || /* @__PURE__ */ jsx(FormattedMessage, { id: getAbsenceLabelKeyFromType(types?.[0]) }) })
72
+ children: path ? /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", minWidth: 0, overflow: "hidden" }, "aria-label": path, children: [
73
+ /* @__PURE__ */ jsx(
74
+ Typography,
75
+ {
76
+ component: "span",
77
+ variant: "body2",
78
+ sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
79
+ children: head
80
+ }
81
+ ),
82
+ /* @__PURE__ */ jsx(Typography, { component: "span", variant: "body2", sx: { whiteSpace: "nowrap" }, children: tail })
83
+ ] }) : /* @__PURE__ */ jsx(Typography, { variant: "body2", noWrap: true, children: /* @__PURE__ */ jsx(FormattedMessage, { id: getAbsenceLabelKeyFromType(types?.[0]) }) })
55
84
  }
56
85
  ) }),
57
- /* @__PURE__ */ jsx(Grid, { paddingTop: 1, paddingLeft: 1, children: error?.message && /* @__PURE__ */ jsx(FormHelperText, { error: true, children: intl.formatMessage({ id: error?.message }) }) })
86
+ /* @__PURE__ */ jsx(Grid, { paddingTop: 1, paddingLeft: 1, children: error?.message && /* @__PURE__ */ jsx(FormHelperText, { error: true, children: intl.formatMessage({ id: error.message }) }) })
58
87
  ] }),
59
- /* @__PURE__ */ jsx(Button, { onClick: () => setIsOpen(true), variant: "contained", color: "primary", component: "label", children: /* @__PURE__ */ jsx(FormattedMessage, { id: breadcrumb ? "edit" : "Select" }) })
88
+ /* @__PURE__ */ jsx(
89
+ Button,
90
+ {
91
+ variant: "outlined",
92
+ onClick: () => setIsOpen(true),
93
+ component: "label",
94
+ sx: {
95
+ textTransform: "none",
96
+ whiteSpace: "nowrap"
97
+ },
98
+ children: /* @__PURE__ */ jsx(FormattedMessage, { id: path ? "edit" : "Select" })
99
+ }
100
+ )
60
101
  ] }),
61
- /* @__PURE__ */ jsx(DirectoryItemSelector, { open: isOpen, onClose: onNodeChanged, types, ...props })
102
+ /* @__PURE__ */ jsx(DirectoryItemSelector, { open: isOpen, onClose: onSelectFolder, types, ...props })
62
103
  ] });
63
104
  }
64
105
  export {
@@ -313,13 +313,22 @@ import { SHORTCIRCUIT_ANALYSIS_RESULT_SORT_STORE, ShortCircuitAnalysisResultTabl
313
313
  import { ShortCircuitAnalysisResult } from "./results/shortcircuit/shortcircuit-analysis-result.js";
314
314
  import { ShortCircuitAnalysisAllBusesResult } from "./results/shortcircuit/shortcircuit-analysis-all-buses-result.js";
315
315
  import { RESULTS_LOADING_DELAY } from "./results/constants.js";
316
+ import { FormSection } from "./process-configs/common/FormSection.js";
317
+ import { FormSubSection } from "./process-configs/common/FormSubSection.js";
318
+ import { GeneralInformationSection } from "./process-configs/common/GeneralInformationSection.js";
319
+ import { ModificationsSubSection } from "./process-configs/common/ModificationsSubSection.js";
320
+ import { ProvidersParametersSubSection } from "./process-configs/common/ProvidersParametersSubSection.js";
321
+ import { SpecificInformationSection } from "./process-configs/common/SpecificInformationSection.js";
316
322
  import { ProcessType } from "./process-configs/common/process-config.type.js";
317
- import { emptyProcessConfigModificationsFormData, getProcessConfigModificationsBackendFromFormData, getProcessConfigModificationsFormData, processConfigModificationsShape } from "./process-configs/common/process-config-modifications-edition.utils.js";
323
+ import { PROCESS_CONFIG_PARAMETER_FIELDS, PROCESS_CONFIG_TYPE_DEFINITIONS, getProcessConfigTypeDefinition, getProcessTypesRequiringParameter } from "./process-configs/common/process-config-type.definitions.js";
318
324
  import { ProcessConfigModificationsEdition } from "./process-configs/common/process-config-modifications-edition.js";
319
- import { getNamedProcessConfigFormData, isProcessType } from "./process-configs/process-config.utils.js";
320
- import { LFProcessConfigEditionDialog } from "./process-configs/lf-process-config-edition-dialog.js";
321
- import { SAProcessConfigEditionDialog } from "./process-configs/sa-process-config-edition-dialog.js";
322
- import { SCProcessConfigEditionDialog } from "./process-configs/sc-process-config-edition-dialog.js";
325
+ import { getProcessConfigModificationsBackendFromFormData, getProcessConfigModificationsFormData, processConfigModificationsShape } from "./process-configs/common/process-config-modifications-edition.utils.js";
326
+ import { PROCESS_CONFIG_TYPES, getProcessConfigFormDefaultValues } from "./process-configs/common/process-config-form.constants.js";
327
+ import { getProcessConfigFormSchema } from "./process-configs/common/process-config-form.schema.js";
328
+ import { getProcessConfigBackendFromFormData, getProcessConfigFormData } from "./process-configs/common/process-config-mapping.js";
329
+ import { useProcessConfigForm } from "./process-configs/form/hooks/useProcessConfigForm.js";
330
+ import { ProcessConfigForm } from "./process-configs/form/process-config-form.js";
331
+ import { ProcessConfigEditionDialog } from "./process-configs/process-config-edition-dialog.js";
323
332
  import { GlobalFilterPanel } from "./global-filter/ui/global-filter-panel.js";
324
333
  import { GlobalFilterType, isCriteriaFilter, isCriteriaFilterType } from "./global-filter/types/global-filter.type.js";
325
334
  import { LimitTypes } from "./global-filter/types/limit-violation.type.js";
@@ -434,10 +443,13 @@ export {
434
443
  FROM_COLUMN_TO_FIELD_ONE_BUS,
435
444
  FeederBayDirectionCellRenderer,
436
445
  FeederBayPositionCellRenderer,
446
+ FormSection,
447
+ FormSubSection,
437
448
  GENERAL,
438
449
  GENERAL_APPLY_MODIFICATIONS,
439
450
  GENERATORS_SELECTION_TYPE,
440
451
  GENERATOR_TAB_FIELDS,
452
+ GeneralInformationSection,
441
453
  GeneratorCreationForm,
442
454
  GeneratorDialogHeader,
443
455
  GeneratorDialogTab,
@@ -465,7 +477,6 @@ export {
465
477
  ImportRuleDialog,
466
478
  InitialVoltage,
467
479
  LEG_SIDE,
468
- LFProcessConfigEditionDialog,
469
480
  LIMIT_DURATION_FORM,
470
481
  LIMIT_REDUCTIONS_FORM,
471
482
  LINE_FLOW_MODE,
@@ -532,6 +543,7 @@ export {
532
543
  ModificationByAssignmentForm,
533
544
  ModificationByFormulaForm,
534
545
  ModificationRow,
546
+ ModificationsSubSection,
535
547
  MoveVoltageLevelFeederBaysForm,
536
548
  NAD_POSITIONS_GENERATION_MODE,
537
549
  NAD_POSITIONS_GENERATION_MODE_LABEL,
@@ -574,6 +586,9 @@ export {
574
586
  POSITION_NEW_SECTION_SIDE,
575
587
  PREV_CONNECTION_STATUS,
576
588
  PRIORITY,
589
+ PROCESS_CONFIG_PARAMETER_FIELDS,
590
+ PROCESS_CONFIG_TYPES,
591
+ PROCESS_CONFIG_TYPE_DEFINITIONS,
577
592
  PROPERTY_CSV_COLUMN_PREFIX,
578
593
  PROVIDER,
579
594
  PSTS_EQUIPMENT_TYPES,
@@ -593,11 +608,14 @@ export {
593
608
  PowerMeasurementsForm,
594
609
  PowerWithValidityForm,
595
610
  PredefinedParameters,
611
+ ProcessConfigEditionDialog,
612
+ ProcessConfigForm,
596
613
  ProcessConfigModificationsEdition,
597
614
  ProcessType,
598
615
  PropertiesForm,
599
616
  PropertyForm,
600
617
  ProviderParam,
618
+ ProvidersParametersSubSection,
601
619
  RATIO_TAP_CHANGER_POSITION,
602
620
  RATIO_TAP_CHANGER_TARGET_V,
603
621
  REACTIVE_LIMIT_TYPES,
@@ -623,9 +641,7 @@ export {
623
641
  RootNetworkCellRenderer,
624
642
  RootNetworkChipCell,
625
643
  RootNetworkHeaderRenderer,
626
- SAProcessConfigEditionDialog,
627
644
  SCENARIO_DURATION,
628
- SCProcessConfigEditionDialog,
629
645
  SELECTION_TYPE,
630
646
  SENSITIVITY_TYPES,
631
647
  SENSI_BRANCHES_TAB_FIELDS,
@@ -686,6 +702,7 @@ export {
686
702
  ShuntCompensatorSelectionForm,
687
703
  SignInCallbackHandler,
688
704
  SilentRenewCallbackHandler,
705
+ SpecificInformationSection,
689
706
  StaticVarCompensatorCreationForm,
690
707
  StaticVarCompensatorDialogHeader,
691
708
  StaticVarCompensatorDialogTab,
@@ -848,7 +865,6 @@ export {
848
865
  emptyModificationByAssignmentFormData,
849
866
  emptyModificationFormData,
850
867
  emptyMoveVoltageLevelFeederBaysFormData,
851
- emptyProcessConfigModificationsFormData,
852
868
  emptyProperties,
853
869
  emptyTabularProperties,
854
870
  equipmentDeletionDtoToForm,
@@ -952,7 +968,6 @@ export {
952
968
  getLineCharacteristicsEmptyFormData,
953
969
  getLineCharacteristicsFormData,
954
970
  getLineCharacteristicsValidationSchemaProps,
955
- getNamedProcessConfigFormData,
956
971
  getNewVoltageLevelData,
957
972
  getNoRowsMessage,
958
973
  getOptionLabel,
@@ -965,8 +980,14 @@ export {
965
980
  getPowerWithValidityEmptyFormData,
966
981
  getPowerWithValidityValidationSchema,
967
982
  getPreLoginPath,
983
+ getProcessConfigBackendFromFormData,
984
+ getProcessConfigFormData,
985
+ getProcessConfigFormDefaultValues,
986
+ getProcessConfigFormSchema,
968
987
  getProcessConfigModificationsBackendFromFormData,
969
988
  getProcessConfigModificationsFormData,
989
+ getProcessConfigTypeDefinition,
990
+ getProcessTypesRequiringParameter,
970
991
  getPropertiesFromModification,
971
992
  getPropertyAvatar,
972
993
  getPropertyValue,
@@ -1037,7 +1058,6 @@ export {
1037
1058
  isCriteriaFilterType,
1038
1059
  isEditingGlobalFilter,
1039
1060
  isFieldTypeOk,
1040
- isProcessType,
1041
1061
  isReferenceModification,
1042
1062
  isValidComputingType,
1043
1063
  isValidContingencyRow,
@@ -1156,6 +1176,7 @@ export {
1156
1176
  useNotificationsListener,
1157
1177
  useParameterLayoutContext,
1158
1178
  useParametersForm,
1179
+ useProcessConfigForm,
1159
1180
  voltageLevelCreationDtoToForm,
1160
1181
  voltageLevelCreationEmptyFormData,
1161
1182
  voltageLevelCreationFormSchema,
@@ -38,7 +38,7 @@ const equipmentsSelectionStyles = {
38
38
  marginBottom: theme.spacing(2)
39
39
  }),
40
40
  choice: (theme) => ({
41
- marginTop: theme.spacing(4)
41
+ marginTop: theme.spacing(2)
42
42
  }),
43
43
  choiceContainer: {
44
44
  paddingLeft: 1
@@ -56,7 +56,11 @@ const initialEquipmentsSelectionType = {
56
56
  };
57
57
  function EquipmentSelectionParameters() {
58
58
  return /* @__PURE__ */ jsxs(Stack, { children: [
59
- /* @__PURE__ */ jsx(Alert, { sx: equipmentsSelectionStyles.alert, severity: "info", variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "VoltageInitParametersEquipmentsSelectionAlert" }) }),
59
+ /* @__PURE__ */ jsxs(Alert, { sx: equipmentsSelectionStyles.alert, severity: "info", variant: "outlined", children: [
60
+ /* @__PURE__ */ jsx(FormattedMessage, { id: "VoltageInitParametersEquipmentsSelectionAlert" }),
61
+ /* @__PURE__ */ jsx("br", {}),
62
+ /* @__PURE__ */ jsx(FormattedMessage, { id: "VoltageInitParametersBatteriesAlert" })
63
+ ] }),
60
64
  /* @__PURE__ */ jsx(Grid, { container: true, justifyContent: "flex-end", sx: equipmentsSelectionStyles.choiceContainer, children: /* @__PURE__ */ jsx(Grid, { size: 5, sx: equipmentsSelectionStyles.choice, children: /* @__PURE__ */ jsx(
61
65
  RadioInput,
62
66
  {
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ type FormSectionProps = {
3
+ children: ReactNode;
4
+ id: string;
5
+ title: ReactNode;
6
+ };
7
+ export declare function FormSection({ children, id, title }: FormSectionProps): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Stack, Typography } from "@mui/material";
3
+ function FormSection({ children, id, title }) {
4
+ return /* @__PURE__ */ jsxs(Stack, { spacing: 2, component: "section", "aria-labelledby": id, children: [
5
+ /* @__PURE__ */ jsx(Typography, { id, variant: "h6", children: title }),
6
+ children
7
+ ] });
8
+ }
9
+ export {
10
+ FormSection
11
+ };
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ type FormSubSectionProps = {
3
+ children: ReactNode;
4
+ id: string;
5
+ title: ReactNode;
6
+ };
7
+ export declare function FormSubSection({ children, id, title }: FormSubSectionProps): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Stack, Typography } from "@mui/material";
3
+ function FormSubSection({ children, id, title }) {
4
+ return /* @__PURE__ */ jsxs(Stack, { spacing: 1.5, component: "section", "aria-labelledby": id, children: [
5
+ /* @__PURE__ */ jsx(Typography, { id, variant: "subtitle1", fontWeight: 600, children: title }),
6
+ children
7
+ ] });
8
+ }
9
+ export {
10
+ FormSubSection
11
+ };
@@ -0,0 +1,8 @@
1
+ import { UUID } from 'node:crypto';
2
+ type GeneralInformationSectionProps = {
3
+ activeDirectory?: UUID;
4
+ initialElementName?: string;
5
+ withFolderField?: boolean;
6
+ };
7
+ export declare function GeneralInformationSection({ activeDirectory, initialElementName, withFolderField, }: Readonly<GeneralInformationSectionProps>): import("react").JSX.Element;
8
+ export {};
@@ -1,29 +1,29 @@
1
- import * as yup from "yup";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Grid, Typography } from "@mui/material";
3
+ import { useIntl, FormattedMessage } from "react-intl";
4
+ import { FormSection } from "./FormSection.js";
5
+ import "@mui/icons-material";
6
+ import "../../../components/ui/overflowableText/OverflowableText.js";
2
7
  import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
3
- import { YUP_REQUIRED } from "../../../utils/constants/translationKeys.js";
4
8
  import "../../../utils/conversionUtils.js";
9
+ import { ElementType } from "../../../utils/types/elementType.js";
5
10
  import "../../../utils/types/equipmentType.js";
6
- import "react/jsx-runtime";
7
- import "@mui/icons-material";
8
- import { fetchElementNames } from "../../../services/directory.js";
9
- import { ProcessType } from "../common/process-config.type.js";
10
- import { emptyProcessConfigModificationsFormData, getProcessConfigModificationsFormData, processConfigModificationsShape, getProcessConfigModificationsBackendFromFormData } from "../common/process-config-modifications-edition.utils.js";
11
- import "react-hook-form";
12
11
  import "react";
13
- import "react-intl";
14
- import "@mui/material";
15
- import "../../../components/ui/overflowableText/OverflowableText.js";
12
+ import "react-hook-form";
16
13
  import "localized-countries";
17
14
  import "notistack";
18
15
  import "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
16
+ import "yup";
19
17
  import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
20
18
  import "../../../components/ui/reactHookForm/numbers/RangeInput.js";
19
+ import { DescriptionField } from "../../../components/ui/reactHookForm/text/DescriptionField.js";
20
+ import { UniqueNameInput } from "../../../components/ui/reactHookForm/text/UniqueNameInput.js";
21
21
  import "../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
22
22
  import "../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
23
23
  import "../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
24
+ import { DirectoryItemInput } from "../../../components/ui/reactHookForm/directory-item-input/directory-item-input.js";
24
25
  import "@hello-pangea/dnd";
25
26
  import "../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
26
- import { getNameElementEditorEmptyFormData, getNameElementEditorSchema } from "../../../components/ui/dialogs/name-element-editor/name-element-editor-utils.js";
27
27
  import "../../../components/ui/snackbarProvider/SnackbarProvider.js";
28
28
  import "../../../chunks/module.pXeJjFiM.js";
29
29
  import "react-resizable-panels";
@@ -54,48 +54,51 @@ import "../../../components/composite/report/report-viewer/log-table/log-table.j
54
54
  import "react-window";
55
55
  import "../../../components/composite/report/report-treeview/treeview-item.js";
56
56
  import "../../../components/composite/report/report-viewer/context/report-viewer-context.js";
57
- function getNamedSCProcessConfigFormSchema(initialName) {
58
- const formSchema = yup.object().shape({
59
- ...processConfigModificationsShape,
60
- [FieldConstants.SHORTCIRCUIT_PARAMETERS]: yup.array().required().of(yup.object().shape({ id: yup.string().required(), name: yup.string() })).length(1, YUP_REQUIRED)
61
- });
62
- return formSchema.concat(getNameElementEditorSchema(initialName));
63
- }
64
- function getEmptySCProcessConfigFormData(initialName, initialDescription) {
65
- return {
66
- ...getNameElementEditorEmptyFormData(initialName, initialDescription),
67
- ...emptyProcessConfigModificationsFormData,
68
- [FieldConstants.SHORTCIRCUIT_PARAMETERS]: []
69
- };
70
- }
71
- async function getNamedSCProcessConfigFormData(processConfig, name, description) {
72
- const allUuids = /* @__PURE__ */ new Set([
73
- ...processConfig.modifications.map((modification) => modification.modificationUuid),
74
- processConfig.shortCircuitParametersUuid
75
- ]);
76
- const elementNamesByUuid = await fetchElementNames(allUuids);
77
- return {
78
- name,
79
- description: description ?? void 0,
80
- ...getProcessConfigModificationsFormData(processConfig.modifications, elementNamesByUuid),
81
- [FieldConstants.SHORTCIRCUIT_PARAMETERS]: [
82
- {
83
- id: processConfig.shortCircuitParametersUuid,
84
- name: elementNamesByUuid[processConfig.shortCircuitParametersUuid]
85
- }
86
- ]
87
- };
88
- }
89
- function getSCProcessConfigBackendFromFormData(formData) {
90
- return {
91
- processType: ProcessType.SHORT_CIRCUIT,
92
- ...getProcessConfigModificationsBackendFromFormData(formData[FieldConstants.MODIFICATIONS]),
93
- shortCircuitParametersUuid: formData[FieldConstants.SHORTCIRCUIT_PARAMETERS][0].id
94
- };
57
+ function GeneralInformationSection({
58
+ activeDirectory,
59
+ initialElementName,
60
+ withFolderField = false
61
+ }) {
62
+ const intl = useIntl();
63
+ return /* @__PURE__ */ jsx(FormSection, { id: "general-information-heading", title: /* @__PURE__ */ jsx(FormattedMessage, { id: "processConfigGeneralInformation" }), children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
64
+ /* @__PURE__ */ jsxs(Grid, { size: { xs: 12, sm: 12 }, children: [
65
+ /* @__PURE__ */ jsx(
66
+ UniqueNameInput,
67
+ {
68
+ name: FieldConstants.NAME,
69
+ label: "nameProperty",
70
+ elementType: ElementType.PROCESS_CONFIG,
71
+ currentName: initialElementName,
72
+ activeDirectory,
73
+ autoFocus: true,
74
+ formProps: { size: "small" }
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsx(
78
+ DescriptionField,
79
+ {
80
+ buttonLabel: "AddDescription",
81
+ expandingTextSx: { marginTop: 1 },
82
+ buttonSx: { textTransform: "none" }
83
+ }
84
+ )
85
+ ] }),
86
+ withFolderField && /* @__PURE__ */ jsxs(Grid, { size: { xs: 12, sm: 12 }, children: [
87
+ /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "processConfigSaveDirectory" }) }),
88
+ /* @__PURE__ */ jsx(
89
+ DirectoryItemInput,
90
+ {
91
+ name: FieldConstants.DIRECTORY,
92
+ types: [ElementType.DIRECTORY],
93
+ multiSelect: false,
94
+ onlyLeaves: false,
95
+ validationButtonText: intl.formatMessage({ id: "validate" }),
96
+ title: intl.formatMessage({ id: "processConfigSaveDirectory" })
97
+ }
98
+ )
99
+ ] })
100
+ ] }) });
95
101
  }
96
102
  export {
97
- getEmptySCProcessConfigFormData,
98
- getNamedSCProcessConfigFormData,
99
- getNamedSCProcessConfigFormSchema,
100
- getSCProcessConfigBackendFromFormData
103
+ GeneralInformationSection
101
104
  };
@@ -4,6 +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 './sa-process-config.type';
8
- export * from './sa-process-config-edition';
9
- export * from './sa-process-config-edition.utils';
7
+ export declare function ModificationsSubSection(): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { FormattedMessage } from "react-intl";
3
+ import { FormSubSection } from "./FormSubSection.js";
4
+ import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
5
+ import "../../../utils/conversionUtils.js";
6
+ import "../../../utils/types/equipmentType.js";
7
+ import "@mui/icons-material";
8
+ import { ProcessConfigModificationsEdition } from "./process-config-modifications-edition.js";
9
+ function ModificationsSubSection() {
10
+ return /* @__PURE__ */ jsx(FormSubSection, { id: "modifications-heading", title: /* @__PURE__ */ jsx(FormattedMessage, { id: "process_config/modifications" }), children: /* @__PURE__ */ jsx(ProcessConfigModificationsEdition, { name: FieldConstants.MODIFICATIONS }) });
11
+ }
12
+ export {
13
+ ModificationsSubSection
14
+ };
@@ -0,0 +1,5 @@
1
+ import { Control } from 'react-hook-form';
2
+ import { ProcessConfigFormValues } from './process-config-form.types';
3
+ export declare function ProvidersParametersSubSection({ control }: Readonly<{
4
+ control: Control<ProcessConfigFormValues>;
5
+ }>): import("react").JSX.Element;
@@ -1,16 +1,13 @@
1
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { Box } from "@mui/material";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useWatch } from "react-hook-form";
3
3
  import { FormattedMessage } from "react-intl";
4
- import "../common/process-config-modifications-edition.utils.js";
5
- import { ProcessConfigModificationsEdition } from "../common/process-config-modifications-edition.js";
6
- import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
7
- import "../../../utils/conversionUtils.js";
8
- import { ElementType } from "../../../utils/types/elementType.js";
9
- import "../../../utils/types/equipmentType.js";
4
+ import { FormSubSection } from "./FormSubSection.js";
5
+ import "@mui/material";
10
6
  import "@mui/icons-material";
11
7
  import "react";
12
8
  import "../../../components/ui/overflowableText/OverflowableText.js";
13
- import "react-hook-form";
9
+ import "../../../utils/conversionUtils.js";
10
+ import "../../../utils/types/equipmentType.js";
14
11
  import "localized-countries";
15
12
  import "notistack";
16
13
  import "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
@@ -68,23 +65,35 @@ import "../../parameters/dynamic-margin-calculation/time-delay-parameters.js";
68
65
  import "../../parameters/dynamic-margin-calculation/loads-variations-parameters.js";
69
66
  import "../../parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.js";
70
67
  import "../../parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js";
71
- function LFProcessConfigEdition() {
72
- return /* @__PURE__ */ jsxs(Fragment, { children: [
73
- /* @__PURE__ */ jsx(Box, { component: "h3", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "process_config/modifications" }) }),
74
- /* @__PURE__ */ jsx(ProcessConfigModificationsEdition, { name: FieldConstants.MODIFICATIONS }),
75
- /* @__PURE__ */ jsx(Box, { component: "h3", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "process_config/providersParameters" }) }),
76
- /* @__PURE__ */ jsx(
77
- ParameterLineDirectoryItemsInput,
78
- {
79
- label: "process_config/loadflow",
80
- elementType: ElementType.LOADFLOW_PARAMETERS,
81
- name: FieldConstants.LOADFLOW_PARAMETERS,
82
- allowMultiSelect: false,
83
- hideErrorMessage: false
84
- }
85
- )
86
- ] });
68
+ import { getProcessConfigTypeDefinition } from "./process-config-type.definitions.js";
69
+ const commonDirectoryItemsInputProps = {
70
+ allowMultiSelect: false,
71
+ hideErrorMessage: false,
72
+ labelGridSize: 4,
73
+ inputGridSize: 8,
74
+ showPlaceHolder: true
75
+ };
76
+ function ProvidersParametersSubSection({ control }) {
77
+ const selectedProcessType = useWatch({ control, name: "processType" });
78
+ const definition = getProcessConfigTypeDefinition(selectedProcessType);
79
+ return /* @__PURE__ */ jsx(
80
+ FormSubSection,
81
+ {
82
+ id: "network-parameters-heading",
83
+ title: /* @__PURE__ */ jsx(FormattedMessage, { id: "process_config/providersParameters" }),
84
+ children: definition?.parameters.map(({ field, elementType, label }) => /* @__PURE__ */ jsx(
85
+ ParameterLineDirectoryItemsInput,
86
+ {
87
+ label,
88
+ elementType,
89
+ name: field,
90
+ ...commonDirectoryItemsInputProps
91
+ },
92
+ field
93
+ ))
94
+ }
95
+ );
87
96
  }
88
97
  export {
89
- LFProcessConfigEdition
98
+ ProvidersParametersSubSection
90
99
  };
@@ -0,0 +1,8 @@
1
+ import { Control } from 'react-hook-form';
2
+ import { ProcessConfigFormValues } from './process-config-form.types';
3
+ type SpecificInformationSectionProps = {
4
+ control: Control<ProcessConfigFormValues>;
5
+ onPrefill?: () => void;
6
+ };
7
+ export declare function SpecificInformationSection({ control, onPrefill }: Readonly<SpecificInformationSectionProps>): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,25 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Stack, Button } from "@mui/material";
3
+ import { FormattedMessage } from "react-intl";
4
+ import { FormSection } from "./FormSection.js";
5
+ import { ModificationsSubSection } from "./ModificationsSubSection.js";
6
+ import { ProvidersParametersSubSection } from "./ProvidersParametersSubSection.js";
7
+ function SpecificInformationSection({ control, onPrefill }) {
8
+ return /* @__PURE__ */ jsxs(
9
+ FormSection,
10
+ {
11
+ id: "specific-information-heading",
12
+ title: /* @__PURE__ */ jsxs(Stack, { component: "span", direction: "row", alignItems: "center", justifyContent: "space-between", width: "100%", children: [
13
+ /* @__PURE__ */ jsx(FormattedMessage, { id: "processConfigSpecificInformation" }),
14
+ onPrefill && /* @__PURE__ */ jsx(Button, { variant: "outlined", sx: { textTransform: "none" }, onClick: onPrefill, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "processConfigPrefill" }) })
15
+ ] }),
16
+ children: [
17
+ /* @__PURE__ */ jsx(ModificationsSubSection, {}),
18
+ /* @__PURE__ */ jsx(ProvidersParametersSubSection, { control })
19
+ ]
20
+ }
21
+ );
22
+ }
23
+ export {
24
+ SpecificInformationSection
25
+ };