@gridsuite/commons-ui 0.168.0 → 0.170.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 (64) hide show
  1. package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.d.ts +4 -9
  2. package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +39 -54
  3. package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js +1 -3
  4. package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +1 -2
  5. package/dist/components/filter/FilterCreationDialog.js +7 -5
  6. package/dist/components/filter/expert/ExpertFilterEditionDialog.js +7 -5
  7. package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +7 -5
  8. package/dist/components/index.js +8 -2
  9. package/dist/components/inputs/reactHookForm/text/TextInput.js +1 -1
  10. package/dist/components/inputs/reactHookForm/utils/TextFieldWithAdornment.js +1 -1
  11. package/dist/components/network-modifications/common/properties/propertyUtils.d.ts +1 -1
  12. package/dist/components/network-modifications/common/properties/propertyUtils.js +2 -2
  13. package/dist/components/network-modifications/index.js +7 -0
  14. package/dist/components/network-modifications/substation/index.d.ts +1 -0
  15. package/dist/components/network-modifications/substation/index.js +8 -1
  16. package/dist/components/network-modifications/substation/modification/SubstationModificationForm.d.ts +6 -0
  17. package/dist/components/network-modifications/substation/modification/SubstationModificationForm.js +89 -0
  18. package/dist/components/network-modifications/substation/modification/index.d.ts +9 -0
  19. package/dist/components/network-modifications/substation/modification/index.js +9 -0
  20. package/dist/components/network-modifications/substation/modification/substationModification.types.d.ts +17 -0
  21. package/dist/components/network-modifications/substation/modification/substationModification.types.js +1 -0
  22. package/dist/components/network-modifications/substation/modification/substationModification.utils.d.ts +24 -0
  23. package/dist/components/network-modifications/substation/modification/substationModification.utils.js +42 -0
  24. package/dist/components/parameters/index.js +1 -2
  25. package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +6 -4
  26. package/dist/components/parameters/network-visualizations/network-visualizations-parameters-dialog.js +6 -4
  27. package/dist/components/parameters/pcc-min/pcc-min-parameters-dialog.js +6 -4
  28. package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.js +6 -4
  29. package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +3 -0
  30. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-dialog.js +6 -4
  31. package/dist/components/parameters/short-circuit/columns-definition.js +22 -22
  32. package/dist/components/parameters/short-circuit/constants.d.ts +0 -1
  33. package/dist/components/parameters/short-circuit/constants.js +0 -2
  34. package/dist/components/parameters/short-circuit/index.js +1 -2
  35. package/dist/components/parameters/short-circuit/short-circuit-fields.js +5 -8
  36. package/dist/components/parameters/short-circuit/short-circuit-icc-cluster-table-cell.js +1 -1
  37. package/dist/components/parameters/short-circuit/short-circuit-icc-cluster-table.js +2 -2
  38. package/dist/components/parameters/short-circuit/short-circuit-icc-material-table.js +3 -2
  39. package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +6 -4
  40. package/dist/components/parameters/short-circuit/short-circuit-parameters-utils.js +5 -5
  41. package/dist/components/parameters/short-circuit/short-circuit-parameters.type.d.ts +6 -6
  42. package/dist/components/parameters/voltage-init/voltage-init-parameters-dialog.js +6 -4
  43. package/dist/index.js +12 -3
  44. package/dist/translations/en/businessErrorsEn.d.ts +1 -0
  45. package/dist/translations/en/businessErrorsEn.js +1 -0
  46. package/dist/translations/en/networkModificationsEn.d.ts +2 -0
  47. package/dist/translations/en/networkModificationsEn.js +2 -0
  48. package/dist/translations/en/parameters.d.ts +0 -3
  49. package/dist/translations/en/parameters.js +0 -3
  50. package/dist/translations/fr/businessErrorsFr.d.ts +1 -0
  51. package/dist/translations/fr/businessErrorsFr.js +1 -0
  52. package/dist/translations/fr/networkModificationsFr.d.ts +2 -0
  53. package/dist/translations/fr/networkModificationsFr.js +2 -0
  54. package/dist/translations/fr/parameters.d.ts +0 -3
  55. package/dist/translations/fr/parameters.js +0 -3
  56. package/dist/utils/conversionUtils.d.ts +2 -0
  57. package/dist/utils/conversionUtils.js +6 -0
  58. package/dist/utils/index.js +4 -1
  59. package/dist/utils/types/index.d.ts +1 -0
  60. package/dist/utils/types/index.js +2 -0
  61. package/dist/utils/types/metadata.d.ts +1 -0
  62. package/dist/utils/types/network-modification-types.d.ts +14 -0
  63. package/dist/utils/types/network-modification-types.js +8 -0
  64. package/package.json +1 -1
@@ -1,25 +1,20 @@
1
1
  import { MouseEvent, ReactNode } from 'react';
2
- import { FieldErrors, FieldValues, SubmitHandler, UseFormReturn } from 'react-hook-form';
2
+ import { FieldErrors, FieldValues, SubmitHandler } from 'react-hook-form';
3
3
  import { DialogProps } from '@mui/material';
4
- import { ObjectSchema } from 'yup';
5
- import { GsLang } from '../../../utils';
4
+ import { MergedFormContextProps } from '../../inputs/reactHookForm/provider/CustomFormProvider';
6
5
  export type CustomMuiDialogProps<T extends FieldValues = FieldValues> = DialogProps & {
7
6
  open: boolean;
8
- formSchema: ObjectSchema<T>;
9
- formMethods: UseFormReturn<T>;
7
+ formContext: MergedFormContextProps<T>;
10
8
  onClose: (event?: MouseEvent) => void;
11
9
  onSave: SubmitHandler<T>;
12
10
  onValidationError?: (errors: FieldErrors) => void;
13
11
  titleId: string;
14
12
  disabledSave?: boolean;
15
- removeOptional?: boolean;
16
13
  onCancel?: () => void;
17
14
  children: ReactNode;
18
15
  isDataFetching?: boolean;
19
- language?: GsLang;
20
16
  confirmationMessageKey?: string;
21
17
  unscrollableFullHeight?: boolean;
22
- isDeveloperMode?: boolean;
23
18
  };
24
19
  /**
25
20
  * all those styles are made to work with each other in order to control the scroll behavior:
@@ -53,4 +48,4 @@ export declare const unscrollableDialogStyles: {
53
48
  readonly padding: 1;
54
49
  };
55
50
  };
56
- export declare function CustomMuiDialog<T extends FieldValues = FieldValues>({ open, formSchema, formMethods, onClose, onSave, isDataFetching, onValidationError, titleId, disabledSave, removeOptional, onCancel, children, language, isDeveloperMode, confirmationMessageKey, unscrollableFullHeight, ...dialogProps }: Readonly<CustomMuiDialogProps<T>>): import("react/jsx-runtime").JSX.Element;
51
+ export declare function CustomMuiDialog<T extends FieldValues = FieldValues>({ open, formContext, onClose, onSave, isDataFetching, onValidationError, titleId, disabledSave, onCancel, children, confirmationMessageKey, unscrollableFullHeight, ...dialogProps }: Readonly<CustomMuiDialogProps<T>>): import("react/jsx-runtime").JSX.Element;
@@ -40,26 +40,21 @@ const unscrollableDialogStyles = {
40
40
  };
41
41
  function CustomMuiDialog({
42
42
  open,
43
- formSchema,
44
- formMethods,
43
+ formContext,
45
44
  onClose,
46
45
  onSave,
47
46
  isDataFetching = false,
48
47
  onValidationError,
49
48
  titleId,
50
49
  disabledSave,
51
- removeOptional = false,
52
50
  onCancel,
53
51
  children,
54
- language,
55
- isDeveloperMode,
56
52
  confirmationMessageKey,
57
53
  unscrollableFullHeight = false,
58
54
  ...dialogProps
59
55
  }) {
60
56
  const [openConfirmationPopup, setOpenConfirmationPopup] = useState(false);
61
57
  const [validatedData, setValidatedData] = useState();
62
- const { handleSubmit } = formMethods;
63
58
  const handleCancel = useCallback(
64
59
  (event) => {
65
60
  onCancel?.();
@@ -103,54 +98,44 @@ function CustomMuiDialog({
103
98
  },
104
99
  [onValidationError]
105
100
  );
106
- return /* @__PURE__ */ jsxs(
107
- CustomFormProvider,
108
- {
109
- ...formMethods,
110
- validationSchema: formSchema,
111
- removeOptional,
112
- language,
113
- isDeveloperMode,
114
- children: [
115
- /* @__PURE__ */ jsxs(
116
- Dialog,
117
- {
118
- sx: unscrollableFullHeight ? unscrollableDialogStyles.fullHeightDialog : styles.dialogPaper,
119
- open,
120
- onClose: handleClose,
121
- fullWidth: true,
122
- ...dialogProps,
123
- children: [
124
- isDataFetching && /* @__PURE__ */ jsx(LinearProgress, {}),
125
- /* @__PURE__ */ jsx(DialogTitle, { "data-testid": "DialogTitle", children: /* @__PURE__ */ jsx(FormattedMessage, { id: titleId }) }),
126
- /* @__PURE__ */ jsx(DialogContent, { sx: unscrollableFullHeight ? unscrollableDialogStyles.unscrollableContainer : null, children }),
127
- /* @__PURE__ */ jsxs(DialogActions, { children: [
128
- /* @__PURE__ */ jsx(CancelButton, { onClick: handleCancel, "data-testid": "CancelButton" }),
129
- /* @__PURE__ */ jsx(
130
- SubmitButton,
131
- {
132
- variant: "outlined",
133
- disabled: disabledSave,
134
- onClick: handleSubmit(handleValidate, handleValidationError),
135
- "data-testid": "ValidateButton"
136
- }
137
- )
138
- ] })
139
- ]
140
- }
141
- ),
142
- confirmationMessageKey && /* @__PURE__ */ jsx(
143
- PopupConfirmationDialog,
144
- {
145
- message: confirmationMessageKey,
146
- openConfirmationPopup,
147
- setOpenConfirmationPopup,
148
- handlePopupConfirmation
149
- }
150
- )
151
- ]
152
- }
153
- );
101
+ return /* @__PURE__ */ jsxs(CustomFormProvider, { ...formContext, children: [
102
+ /* @__PURE__ */ jsxs(
103
+ Dialog,
104
+ {
105
+ sx: unscrollableFullHeight ? unscrollableDialogStyles.fullHeightDialog : styles.dialogPaper,
106
+ open,
107
+ onClose: handleClose,
108
+ fullWidth: true,
109
+ ...dialogProps,
110
+ children: [
111
+ isDataFetching && /* @__PURE__ */ jsx(LinearProgress, {}),
112
+ /* @__PURE__ */ jsx(DialogTitle, { "data-testid": "DialogTitle", children: /* @__PURE__ */ jsx(FormattedMessage, { id: titleId }) }),
113
+ /* @__PURE__ */ jsx(DialogContent, { sx: unscrollableFullHeight ? unscrollableDialogStyles.unscrollableContainer : null, children }),
114
+ /* @__PURE__ */ jsxs(DialogActions, { children: [
115
+ /* @__PURE__ */ jsx(CancelButton, { onClick: handleCancel, "data-testid": "CancelButton" }),
116
+ /* @__PURE__ */ jsx(
117
+ SubmitButton,
118
+ {
119
+ variant: "outlined",
120
+ disabled: disabledSave,
121
+ onClick: formContext?.handleSubmit(handleValidate, handleValidationError),
122
+ "data-testid": "ValidateButton"
123
+ }
124
+ )
125
+ ] })
126
+ ]
127
+ }
128
+ ),
129
+ confirmationMessageKey && /* @__PURE__ */ jsx(
130
+ PopupConfirmationDialog,
131
+ {
132
+ message: confirmationMessageKey,
133
+ openConfirmationPopup,
134
+ setOpenConfirmationPopup,
135
+ handlePopupConfirmation
136
+ }
137
+ )
138
+ ] });
154
139
  }
155
140
  export {
156
141
  CustomMuiDialog,
@@ -55,10 +55,8 @@ function DescriptionModificationDialog({
55
55
  open,
56
56
  onClose: onCancel,
57
57
  onSave: onSubmit,
58
- formSchema: schema,
59
- formMethods: methods,
58
+ formContext: { ...methods, validationSchema: schema, removeOptional: true },
60
59
  titleId: "description",
61
- removeOptional: true,
62
60
  children: /* @__PURE__ */ jsx(Box, { paddingTop: 1, children: /* @__PURE__ */ jsx(
63
61
  ExpandingTextField,
64
62
  {
@@ -221,8 +221,7 @@ function ElementSaveDialog({
221
221
  titleId,
222
222
  onSave: onSubmit,
223
223
  disabledSave: disableSave,
224
- formSchema: schema,
225
- formMethods,
224
+ formContext: { ...formMethods, validationSchema: schema },
226
225
  children: [
227
226
  /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, marginTop: "auto", direction: "column", children: [
228
227
  !createOnlyMode && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
@@ -99,13 +99,15 @@ function FilterCreationDialog({
99
99
  open,
100
100
  onClose,
101
101
  onSave: onSubmit,
102
- formSchema,
103
- formMethods,
102
+ formContext: {
103
+ ...formMethods,
104
+ validationSchema: formSchema,
105
+ removeOptional: true,
106
+ language,
107
+ isDeveloperMode
108
+ },
104
109
  titleId,
105
- removeOptional: true,
106
110
  disabledSave: !!nameError || !!isValidating,
107
- language,
108
- isDeveloperMode,
109
111
  unscrollableFullHeight: true,
110
112
  children: /* @__PURE__ */ jsx(
111
113
  FilterForm,
@@ -92,14 +92,16 @@ function ExpertFilterEditionDialog({
92
92
  open,
93
93
  onClose,
94
94
  onSave: onSubmit,
95
- formSchema,
96
- formMethods,
95
+ formContext: {
96
+ ...formMethods,
97
+ validationSchema: formSchema,
98
+ removeOptional: true,
99
+ language,
100
+ isDeveloperMode
101
+ },
97
102
  titleId,
98
- removeOptional: true,
99
103
  disabledSave: !!nameError || !!isValidating,
100
104
  isDataFetching: dataFetchStatus === FetchStatus.FETCHING,
101
- language,
102
- isDeveloperMode,
103
105
  unscrollableFullHeight: true,
104
106
  children: isDataReady && /* @__PURE__ */ jsx(FilterForm, { activeDirectory, filterType: FilterType.EXPERT, isEditing: true })
105
107
  }
@@ -95,14 +95,16 @@ function ExplicitNamingFilterEditionDialog({
95
95
  open,
96
96
  onClose,
97
97
  onSave: onSubmit,
98
- formSchema,
99
- formMethods,
98
+ formContext: {
99
+ ...formMethods,
100
+ validationSchema: formSchema,
101
+ removeOptional: true,
102
+ language,
103
+ isDeveloperMode
104
+ },
100
105
  titleId,
101
- removeOptional: true,
102
106
  disabledSave: !!nameError || !!isValidating,
103
107
  isDataFetching: dataFetchStatus === FetchStatus.FETCHING,
104
- language,
105
- isDeveloperMode,
106
108
  unscrollableFullHeight: true,
107
109
  children: isDataReady && /* @__PURE__ */ jsx(FilterForm, { activeDirectory, filterType: FilterType.EXPLICIT_NAMING, isEditing: true })
108
110
  }
@@ -160,7 +160,7 @@ import { NetworkVisualizationsParametersEditionDialog } from "./parameters/netwo
160
160
  import { BALANCE_TYPE, CONNECTED_MODE, COUNTRIES_TO_BALANCE, DC, DC_POWER_FACTOR, DC_USE_TRANSFORMER_RATIO, DEFAULT_LIMIT_REDUCTION_VALUE, DISTRIBUTED_SLACK, HVDC_AC_EMULATION, MAX_VALUE_ALLOWED_FOR_LIMIT_REDUCTION, MIN_VALUE_ALLOWED_FOR_LIMIT_REDUCTION, PARAM_LIMIT_REDUCTION, PARAM_PROVIDER_OPENLOADFLOW, PHASE_SHIFTER_REGULATION_ON, READ_SLACK_BUS, SHUNT_COMPENSATOR_VOLTAGE_CONTROL_ON, TWT_SPLIT_SHUNT_ADMITTANCE, USE_REACTIVE_LIMITS, VOLTAGE_INIT_MODE, WRITE_SLACK_BUS, alertThresholdMarks } from "./parameters/loadflow/constants.js";
161
161
  import { LoadFlowParametersInline } from "./parameters/loadflow/load-flow-parameters-inline.js";
162
162
  import { LoadFlowParametersEditionDialog } from "./parameters/loadflow/load-flow-parameters-dialog.js";
163
- import { InitialVoltage, PredefinedParameters, SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, SHORT_CIRCUIT_MODEL_POWER_ELECTRONICS, SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER, SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTER, SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS, SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS, SHORT_CIRCUIT_PREDEFINED_PARAMS, SHORT_CIRCUIT_VOLTAGE_RANGES, SHORT_CIRCUIT_WITH_FEEDER_RESULT, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, intlInitialVoltageProfileMode, intlPredefinedParametersOptions, onlyStartedGeneratorsOptions } from "./parameters/short-circuit/constants.js";
163
+ import { InitialVoltage, PredefinedParameters, SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, SHORT_CIRCUIT_MODEL_POWER_ELECTRONICS, SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER, SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS, SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS, SHORT_CIRCUIT_PREDEFINED_PARAMS, SHORT_CIRCUIT_VOLTAGE_RANGES, SHORT_CIRCUIT_WITH_FEEDER_RESULT, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, intlInitialVoltageProfileMode, intlPredefinedParametersOptions, onlyStartedGeneratorsOptions } from "./parameters/short-circuit/constants.js";
164
164
  import { ShortCircuitParametersInLine } from "./parameters/short-circuit/short-circuit-parameters-inline.js";
165
165
  import { ShortCircuitParametersEditionDialog } from "./parameters/short-circuit/short-circuit-parameters-dialog.js";
166
166
  import { DEFAULT_GENERAL_APPLY_MODIFICATIONS, DEFAULT_REACTIVE_SLACKS_THRESHOLD, DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, DEFAULT_UPDATE_BUS_VOLTAGE, GENERAL, GENERAL_APPLY_MODIFICATIONS, GENERATORS_SELECTION_TYPE, HIGH_VOLTAGE_LIMIT, LEG_SIDE, LOW_VOLTAGE_LIMIT, PRIORITY, RATIO_TAP_CHANGER_POSITION, RATIO_TAP_CHANGER_TARGET_V, REACTIVE_SLACKS_THRESHOLD, SELECTION_TYPE, SHUNT_COMPENSATORS_SELECTION_TYPE, SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, TRANSFORMERS_SELECTION_TYPE, UPDATE_BUS_VOLTAGE, VARIABLE_Q_GENERATORS, VARIABLE_SHUNT_COMPENSATORS, VARIABLE_TRANSFORMERS, VOLTAGE_LIMITS_DEFAULT, VOLTAGE_LIMITS_MODIFICATION, VoltageInitTabValues } from "./parameters/voltage-init/constants.js";
@@ -186,6 +186,8 @@ import { copyEquipmentPropertiesForCreation, createPropertyModification, creatio
186
186
  import { filledTextField, italicFontTextField, standardTextField } from "./network-modifications/common/form.utils.js";
187
187
  import { SubstationCreationForm } from "./network-modifications/substation/creation/SubstationCreationForm.js";
188
188
  import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./network-modifications/substation/creation/substationCreation.utils.js";
189
+ import { SubstationModificationForm } from "./network-modifications/substation/modification/SubstationModificationForm.js";
190
+ import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./network-modifications/substation/modification/substationModification.utils.js";
189
191
  export {
190
192
  ACCURACY,
191
193
  ACTIVE,
@@ -444,7 +446,6 @@ export {
444
446
  SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE,
445
447
  SHORT_CIRCUIT_MODEL_POWER_ELECTRONICS,
446
448
  SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER,
447
- SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTER,
448
449
  SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS,
449
450
  SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS,
450
451
  SHORT_CIRCUIT_PREDEFINED_PARAMS,
@@ -486,6 +487,7 @@ export {
486
487
  SubmitButton,
487
488
  SubstationCreationForm,
488
489
  SubstationLayout,
490
+ SubstationModificationForm,
489
491
  SwitchInput,
490
492
  SwitchWithLabel,
491
493
  TAB_INFO,
@@ -584,6 +586,10 @@ export {
584
586
  substationCreationEmptyFormData,
585
587
  substationCreationFormSchema,
586
588
  substationCreationFormToDto,
589
+ substationModificationDtoToForm,
590
+ substationModificationEmptyFormData,
591
+ substationModificationFormSchema,
592
+ substationModificationFormToDto,
587
593
  testQuery,
588
594
  toFloatOrNullValue,
589
595
  toFormValuesLimitReductions,
@@ -69,7 +69,7 @@ function TextInput({
69
69
  disabled,
70
70
  InputProps: {
71
71
  endAdornment: /* @__PURE__ */ jsxs(InputAdornment, { position: "end", children: [
72
- clearable && transformedValue !== void 0 && transformedValue !== "" && /* @__PURE__ */ jsx(IconButton, { onClick: handleClearValue, children: /* @__PURE__ */ jsx(Clear, {}) }),
72
+ clearable && transformedValue !== void 0 && transformedValue !== "" && /* @__PURE__ */ jsx(IconButton, { onClick: handleClearValue, size: "small", children: /* @__PURE__ */ jsx(Clear, { fontSize: "small" }) }),
73
73
  customAdornment && { ...customAdornment }
74
74
  ] })
75
75
  },
@@ -21,7 +21,7 @@ function TextFieldWithAdornment(props) {
21
21
  }, []);
22
22
  const getClearAdornment = useCallback(
23
23
  (position) => {
24
- return /* @__PURE__ */ jsx(InputAdornment, { position, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleClearValue, children: /* @__PURE__ */ jsx(Clear, {}) }) });
24
+ return /* @__PURE__ */ jsx(InputAdornment, { position, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleClearValue, size: "small", children: /* @__PURE__ */ jsx(Clear, { fontSize: "small" }) }) });
25
25
  },
26
26
  [handleClearValue]
27
27
  );
@@ -8,7 +8,7 @@ export declare const emptyProperties: Properties;
8
8
  export declare const createPropertyModification: (name: string, value: string | null) => Property;
9
9
  export declare const initializedProperty: () => Property;
10
10
  export declare const getFilledPropertiesFromModification: (properties: Property[] | undefined | null) => FilledProperty[];
11
- export declare const getPropertiesFromModification: (properties: Property[] | undefined | null) => Properties;
11
+ export declare const getPropertiesFromModification: (properties: Property[] | undefined | null, includePreviousValue?: boolean) => Properties;
12
12
  export declare const copyEquipmentPropertiesForCreation: (equipmentInfos: EquipmentWithProperties) => Properties;
13
13
  export declare const mergeModificationAndEquipmentProperties: (modificationProperties: Property[], equipment: EquipmentWithProperties) => Property[];
14
14
  export declare function getConcatenatedProperties(equipment: EquipmentWithProperties, getValues: (name: string) => any, id?: string): any;
@@ -41,13 +41,13 @@ const getFilledPropertiesFromModification = (properties) => {
41
41
  };
42
42
  }) ?? [];
43
43
  };
44
- const getPropertiesFromModification = (properties) => {
44
+ const getPropertiesFromModification = (properties, includePreviousValue = true) => {
45
45
  return {
46
46
  [FieldConstants.ADDITIONAL_PROPERTIES]: properties ? properties.map((p) => {
47
47
  return {
48
48
  [FieldConstants.NAME]: p[FieldConstants.NAME],
49
49
  [FieldConstants.VALUE]: p[FieldConstants.VALUE],
50
- [FieldConstants.PREVIOUS_VALUE]: p[FieldConstants.PREVIOUS_VALUE],
50
+ [FieldConstants.PREVIOUS_VALUE]: includePreviousValue ? p[FieldConstants.PREVIOUS_VALUE] : void 0,
51
51
  [FieldConstants.ADDED]: p[FieldConstants.ADDED],
52
52
  [FieldConstants.DELETION_MARK]: p[FieldConstants.DELETION_MARK]
53
53
  };
@@ -4,10 +4,13 @@ import { copyEquipmentPropertiesForCreation, createPropertyModification, creatio
4
4
  import { filledTextField, italicFontTextField, standardTextField } from "./common/form.utils.js";
5
5
  import { SubstationCreationForm } from "./substation/creation/SubstationCreationForm.js";
6
6
  import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./substation/creation/substationCreation.utils.js";
7
+ import { SubstationModificationForm } from "./substation/modification/SubstationModificationForm.js";
8
+ import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./substation/modification/substationModification.utils.js";
7
9
  export {
8
10
  PropertiesForm,
9
11
  PropertyForm,
10
12
  SubstationCreationForm,
13
+ SubstationModificationForm,
11
14
  copyEquipmentPropertiesForCreation,
12
15
  createPropertyModification,
13
16
  creationPropertiesSchema,
@@ -27,5 +30,9 @@ export {
27
30
  substationCreationEmptyFormData,
28
31
  substationCreationFormSchema,
29
32
  substationCreationFormToDto,
33
+ substationModificationDtoToForm,
34
+ substationModificationEmptyFormData,
35
+ substationModificationFormSchema,
36
+ substationModificationFormToDto,
30
37
  toModificationProperties
31
38
  };
@@ -5,3 +5,4 @@
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
7
  export * from './creation';
8
+ export * from './modification';
@@ -1,9 +1,16 @@
1
1
  import { SubstationCreationForm } from "./creation/SubstationCreationForm.js";
2
2
  import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./creation/substationCreation.utils.js";
3
+ import { SubstationModificationForm } from "./modification/SubstationModificationForm.js";
4
+ import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./modification/substationModification.utils.js";
3
5
  export {
4
6
  SubstationCreationForm,
7
+ SubstationModificationForm,
5
8
  substationCreationDtoToForm,
6
9
  substationCreationEmptyFormData,
7
10
  substationCreationFormSchema,
8
- substationCreationFormToDto
11
+ substationCreationFormToDto,
12
+ substationModificationDtoToForm,
13
+ substationModificationEmptyFormData,
14
+ substationModificationFormSchema,
15
+ substationModificationFormToDto
9
16
  };
@@ -0,0 +1,6 @@
1
+ import { SubstationModificationInfos } from './substationModification.types';
2
+ interface SubstationModificationFormProps {
3
+ substationToModify?: SubstationModificationInfos | null;
4
+ }
5
+ export declare function SubstationModificationForm({ substationToModify }: Readonly<SubstationModificationFormProps>): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,89 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { TextField, Grid } from "@mui/material";
3
+ import { useIntl } from "react-intl";
4
+ import { useWatch } from "react-hook-form";
5
+ import GridItem from "../../../grid/grid-item.js";
6
+ import "../../../overflowableText/OverflowableText.js";
7
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
8
+ import "../../../../utils/conversionUtils.js";
9
+ import "../../../../utils/types/equipmentType.js";
10
+ import "@mui/icons-material";
11
+ import "../../../../utils/yupConfig.js";
12
+ import "react";
13
+ import { useLocalizedCountries } from "../../../../hooks/useLocalizedCountries.js";
14
+ import "notistack";
15
+ import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
16
+ import "yup";
17
+ import "../../../treeViewFinder/TreeViewFinder.js";
18
+ import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
19
+ import "../../../customAGGrid/customAggrid.js";
20
+ import "ag-grid-community";
21
+ import "react-papaparse";
22
+ import "react-csv-downloader";
23
+ import { TextInput } from "../../../inputs/reactHookForm/text/TextInput.js";
24
+ import "../../../inputs/reactHookForm/numbers/RangeInput.js";
25
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
26
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
27
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
28
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
29
+ import "../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
30
+ import { CountrySelectionInput } from "../../../inputs/reactHookForm/CountrySelectionInput.js";
31
+ import "@react-querybuilder/material";
32
+ import "../../../filter/expert/expertFilterConstants.js";
33
+ import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
34
+ import "uuid";
35
+ import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
36
+ import "react-querybuilder";
37
+ import { PropertiesForm } from "../../common/properties/PropertiesForm.js";
38
+ import { filledTextField } from "../../common/form.utils.js";
39
+ import "../../common/properties/propertyUtils.js";
40
+ function SubstationModificationForm({ substationToModify }) {
41
+ const { locale } = useIntl();
42
+ const { translate } = useLocalizedCountries(locale);
43
+ const equipmentId = useWatch({ name: FieldConstants.EQUIPMENT_ID });
44
+ const substationIdField = /* @__PURE__ */ jsx(
45
+ TextField,
46
+ {
47
+ size: "small",
48
+ fullWidth: true,
49
+ label: "ID",
50
+ value: equipmentId ?? "",
51
+ InputProps: {
52
+ readOnly: true
53
+ },
54
+ disabled: true,
55
+ ...filledTextField
56
+ }
57
+ );
58
+ const substationNameField = /* @__PURE__ */ jsx(
59
+ TextInput,
60
+ {
61
+ name: FieldConstants.EQUIPMENT_NAME,
62
+ label: "Name",
63
+ formProps: filledTextField,
64
+ previousValue: substationToModify?.name,
65
+ clearable: true
66
+ }
67
+ );
68
+ const substationCountryField = /* @__PURE__ */ jsx(
69
+ CountrySelectionInput,
70
+ {
71
+ name: FieldConstants.COUNTRY,
72
+ label: "Country",
73
+ formProps: filledTextField,
74
+ size: "small",
75
+ previousValue: substationToModify?.country ? translate(substationToModify.country) : ""
76
+ }
77
+ );
78
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
79
+ /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
80
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: substationIdField }),
81
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: substationNameField }),
82
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: substationCountryField })
83
+ ] }),
84
+ /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "substation", isModification: true })
85
+ ] });
86
+ }
87
+ export {
88
+ SubstationModificationForm
89
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) 2026, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
7
+ export * from './SubstationModificationForm';
8
+ export * from './substationModification.types';
9
+ export * from './substationModification.utils';
@@ -0,0 +1,9 @@
1
+ import { SubstationModificationForm } from "./SubstationModificationForm.js";
2
+ import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./substationModification.utils.js";
3
+ export {
4
+ SubstationModificationForm,
5
+ substationModificationDtoToForm,
6
+ substationModificationEmptyFormData,
7
+ substationModificationFormSchema,
8
+ substationModificationFormToDto
9
+ };
@@ -0,0 +1,17 @@
1
+ import { UUID } from 'node:crypto';
2
+ import { AttributeModification, ModificationType } from '../../../../utils';
3
+ import { Property } from '../../common';
4
+ export interface SubstationModificationInfos {
5
+ id: string;
6
+ name?: string;
7
+ country: string | null;
8
+ properties?: Record<string, string>;
9
+ }
10
+ export interface SubstationModificationDto {
11
+ uuid?: UUID;
12
+ equipmentId: string;
13
+ equipmentName?: AttributeModification<string> | null;
14
+ country: AttributeModification<string> | null;
15
+ properties?: Property[] | null;
16
+ type?: ModificationType;
17
+ }
@@ -0,0 +1,24 @@
1
+ import { default as yup } from '../../../../utils/yupConfig';
2
+ import { SubstationModificationDto } from './substationModification.types';
3
+ export declare const substationModificationFormSchema: yup.ObjectSchema<{
4
+ equipmentID: string;
5
+ equipmentName: string | null | undefined;
6
+ country: string | null | undefined;
7
+ } & {
8
+ AdditionalProperties: {
9
+ previousValue?: string | null | undefined;
10
+ value?: string | null | undefined;
11
+ added: NonNullable<boolean | undefined>;
12
+ deletionMark: NonNullable<boolean | undefined>;
13
+ name: string;
14
+ }[] | undefined;
15
+ }, yup.AnyObject, {
16
+ equipmentID: undefined;
17
+ equipmentName: undefined;
18
+ country: undefined;
19
+ AdditionalProperties: "";
20
+ }, "">;
21
+ export type SubstationModificationFormData = yup.InferType<typeof substationModificationFormSchema>;
22
+ export declare const substationModificationEmptyFormData: SubstationModificationFormData;
23
+ export declare const substationModificationFormToDto: (formData: SubstationModificationFormData) => SubstationModificationDto;
24
+ export declare const substationModificationDtoToForm: (substationDto: SubstationModificationDto, includePreviousValues?: boolean) => SubstationModificationFormData;
@@ -0,0 +1,42 @@
1
+ import "../../../../utils/yupConfig.js";
2
+ import { modificationPropertiesSchema, toModificationProperties, getPropertiesFromModification } from "../../common/properties/propertyUtils.js";
3
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
4
+ import { toModificationOperation } from "../../../../utils/conversionUtils.js";
5
+ import "../../../../utils/types/equipmentType.js";
6
+ import { ModificationType } from "../../../../utils/types/modificationType.js";
7
+ import "react/jsx-runtime";
8
+ import "@mui/icons-material";
9
+ import { sanitizeString } from "../../../../utils/ts-utils.js";
10
+ import * as yup from "yup";
11
+ const substationModificationFormSchema = yup.object().shape({
12
+ [FieldConstants.EQUIPMENT_ID]: yup.string().required(),
13
+ [FieldConstants.EQUIPMENT_NAME]: yup.string().nullable(),
14
+ [FieldConstants.COUNTRY]: yup.string().nullable()
15
+ }).concat(modificationPropertiesSchema);
16
+ const substationModificationEmptyFormData = {
17
+ equipmentID: "",
18
+ equipmentName: "",
19
+ country: null,
20
+ AdditionalProperties: []
21
+ };
22
+ const substationModificationFormToDto = (formData) => ({
23
+ type: ModificationType.SUBSTATION_MODIFICATION,
24
+ equipmentId: formData.equipmentID,
25
+ equipmentName: toModificationOperation(sanitizeString(formData.equipmentName)),
26
+ country: toModificationOperation(formData.country ?? null),
27
+ properties: toModificationProperties(formData)
28
+ });
29
+ const substationModificationDtoToForm = (substationDto, includePreviousValues = true) => {
30
+ return {
31
+ equipmentID: substationDto.equipmentId,
32
+ equipmentName: substationDto.equipmentName?.value ?? "",
33
+ country: substationDto.country?.value ?? null,
34
+ ...getPropertiesFromModification(substationDto?.properties, includePreviousValues)
35
+ };
36
+ };
37
+ export {
38
+ substationModificationDtoToForm,
39
+ substationModificationEmptyFormData,
40
+ substationModificationFormSchema,
41
+ substationModificationFormToDto
42
+ };
@@ -23,7 +23,7 @@ import { NetworkVisualizationsParametersEditionDialog } from "./network-visualiz
23
23
  import { BALANCE_TYPE, CONNECTED_MODE, COUNTRIES_TO_BALANCE, DC, DC_POWER_FACTOR, DC_USE_TRANSFORMER_RATIO, DEFAULT_LIMIT_REDUCTION_VALUE, DISTRIBUTED_SLACK, HVDC_AC_EMULATION, MAX_VALUE_ALLOWED_FOR_LIMIT_REDUCTION, MIN_VALUE_ALLOWED_FOR_LIMIT_REDUCTION, PARAM_LIMIT_REDUCTION, PARAM_PROVIDER_OPENLOADFLOW, PHASE_SHIFTER_REGULATION_ON, READ_SLACK_BUS, SHUNT_COMPENSATOR_VOLTAGE_CONTROL_ON, TWT_SPLIT_SHUNT_ADMITTANCE, USE_REACTIVE_LIMITS, VOLTAGE_INIT_MODE, WRITE_SLACK_BUS, alertThresholdMarks } from "./loadflow/constants.js";
24
24
  import { LoadFlowParametersInline } from "./loadflow/load-flow-parameters-inline.js";
25
25
  import { LoadFlowParametersEditionDialog } from "./loadflow/load-flow-parameters-dialog.js";
26
- import { InitialVoltage, PredefinedParameters, SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, SHORT_CIRCUIT_MODEL_POWER_ELECTRONICS, SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER, SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTER, SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS, SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS, SHORT_CIRCUIT_PREDEFINED_PARAMS, SHORT_CIRCUIT_VOLTAGE_RANGES, SHORT_CIRCUIT_WITH_FEEDER_RESULT, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, intlInitialVoltageProfileMode, intlPredefinedParametersOptions, onlyStartedGeneratorsOptions } from "./short-circuit/constants.js";
26
+ import { InitialVoltage, PredefinedParameters, SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, SHORT_CIRCUIT_MODEL_POWER_ELECTRONICS, SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER, SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS, SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS, SHORT_CIRCUIT_PREDEFINED_PARAMS, SHORT_CIRCUIT_VOLTAGE_RANGES, SHORT_CIRCUIT_WITH_FEEDER_RESULT, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, intlInitialVoltageProfileMode, intlPredefinedParametersOptions, onlyStartedGeneratorsOptions } from "./short-circuit/constants.js";
27
27
  import { ShortCircuitParametersInLine } from "./short-circuit/short-circuit-parameters-inline.js";
28
28
  import { ShortCircuitParametersEditionDialog } from "./short-circuit/short-circuit-parameters-dialog.js";
29
29
  import { DEFAULT_GENERAL_APPLY_MODIFICATIONS, DEFAULT_REACTIVE_SLACKS_THRESHOLD, DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, DEFAULT_UPDATE_BUS_VOLTAGE, GENERAL, GENERAL_APPLY_MODIFICATIONS, GENERATORS_SELECTION_TYPE, HIGH_VOLTAGE_LIMIT, LEG_SIDE, LOW_VOLTAGE_LIMIT, PRIORITY, RATIO_TAP_CHANGER_POSITION, RATIO_TAP_CHANGER_TARGET_V, REACTIVE_SLACKS_THRESHOLD, SELECTION_TYPE, SHUNT_COMPENSATORS_SELECTION_TYPE, SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, TRANSFORMERS_SELECTION_TYPE, UPDATE_BUS_VOLTAGE, VARIABLE_Q_GENERATORS, VARIABLE_SHUNT_COMPENSATORS, VARIABLE_TRANSFORMERS, VOLTAGE_LIMITS_DEFAULT, VOLTAGE_LIMITS_MODIFICATION, VoltageInitTabValues } from "./voltage-init/constants.js";
@@ -163,7 +163,6 @@ export {
163
163
  SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE,
164
164
  SHORT_CIRCUIT_MODEL_POWER_ELECTRONICS,
165
165
  SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER,
166
- SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTER,
167
166
  SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS,
168
167
  SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS,
169
168
  SHORT_CIRCUIT_PREDEFINED_PARAMS,