@gridsuite/commons-ui 0.163.0 → 0.165.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 (112) hide show
  1. package/dist/components/directoryItemSelector/DirectoryItemSelector.js +1 -1
  2. package/dist/components/dnd-table/dnd-table.js +1 -0
  3. package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +1 -1
  4. package/dist/components/filter/utils/filterApi.js +1 -1
  5. package/dist/components/index.d.ts +1 -0
  6. package/dist/components/index.js +34 -3
  7. package/dist/components/inputs/index.js +4 -0
  8. package/dist/components/inputs/reactHookForm/CountrySelectionInput.d.ts +5 -0
  9. package/dist/components/inputs/reactHookForm/CountrySelectionInput.js +27 -0
  10. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +1 -1
  11. package/dist/components/inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js +1 -1
  12. package/dist/components/inputs/reactHookForm/expandableInput/DeletableRow.d.ts +8 -0
  13. package/dist/components/inputs/reactHookForm/expandableInput/DeletableRow.js +41 -0
  14. package/dist/components/inputs/reactHookForm/expandableInput/ExpandableInput.d.ts +24 -0
  15. package/dist/components/inputs/reactHookForm/expandableInput/ExpandableInput.js +80 -0
  16. package/dist/components/inputs/reactHookForm/expandableInput/index.d.ts +7 -0
  17. package/dist/components/inputs/reactHookForm/expandableInput/index.js +4 -0
  18. package/dist/components/inputs/reactHookForm/index.d.ts +2 -0
  19. package/dist/components/inputs/reactHookForm/index.js +4 -0
  20. package/dist/components/inputs/reactHookForm/text/TextInput.js +1 -1
  21. package/dist/components/network-modifications/common/form.utils.d.ts +8 -0
  22. package/dist/components/network-modifications/common/form.utils.js +14 -0
  23. package/dist/components/network-modifications/common/index.d.ts +8 -0
  24. package/dist/components/network-modifications/common/index.js +24 -0
  25. package/dist/components/network-modifications/common/properties/PropertiesForm.d.ts +7 -0
  26. package/dist/components/network-modifications/common/properties/PropertiesForm.js +109 -0
  27. package/dist/components/network-modifications/common/properties/PropertyForm.d.ts +8 -0
  28. package/dist/components/network-modifications/common/properties/PropertyForm.js +102 -0
  29. package/dist/components/network-modifications/common/properties/index.d.ts +10 -0
  30. package/dist/components/network-modifications/common/properties/index.js +20 -0
  31. package/dist/components/network-modifications/common/properties/properties.type.d.ts +14 -0
  32. package/dist/components/network-modifications/common/properties/properties.type.js +1 -0
  33. package/dist/components/network-modifications/common/properties/propertyUtils.d.ts +38 -0
  34. package/dist/components/network-modifications/common/properties/propertyUtils.js +161 -0
  35. package/dist/components/network-modifications/index.d.ts +8 -0
  36. package/dist/components/network-modifications/index.js +31 -0
  37. package/dist/components/network-modifications/substation/creation/SubstationCreationForm.d.ts +7 -0
  38. package/dist/components/network-modifications/substation/creation/SubstationCreationForm.js +52 -0
  39. package/dist/components/network-modifications/substation/creation/index.d.ts +9 -0
  40. package/dist/components/network-modifications/substation/creation/index.js +9 -0
  41. package/dist/components/network-modifications/substation/creation/substationCreation.types.d.ts +8 -0
  42. package/dist/components/network-modifications/substation/creation/substationCreation.types.js +1 -0
  43. package/dist/components/network-modifications/substation/creation/substationCreation.utils.d.ts +24 -0
  44. package/dist/components/network-modifications/substation/creation/substationCreation.utils.js +44 -0
  45. package/dist/components/network-modifications/substation/index.d.ts +7 -0
  46. package/dist/components/network-modifications/substation/index.js +9 -0
  47. package/dist/components/parameters/common/constant.d.ts +0 -8
  48. package/dist/components/parameters/common/constant.js +1 -12
  49. package/dist/components/parameters/common/index.js +1 -3
  50. package/dist/components/parameters/common/parameters-creation-dialog.js +1 -1
  51. package/dist/components/parameters/index.js +1 -3
  52. package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +2 -2
  53. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +1 -1
  54. package/dist/components/parameters/network-visualizations/map-parameters.js +1 -1
  55. package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +1 -1
  56. package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -1
  57. package/dist/components/parameters/pcc-min/pcc-min-parameters-inline.js +1 -1
  58. package/dist/components/parameters/pcc-min/use-pcc-min-parameters-form.js +1 -1
  59. package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +2 -2
  60. package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +2 -2
  61. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.js +2 -2
  62. package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +1 -1
  63. package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +1 -1
  64. package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -1
  65. package/dist/components/parameters/voltage-init/general-parameters.js +1 -1
  66. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
  67. package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +1 -1
  68. package/dist/components/parameters/voltage-init/voltage-limits-parameters.js +5 -9
  69. package/dist/hooks/useModificationLabelComputer.d.ts +2 -1
  70. package/dist/hooks/usePredefinedProperties.js +1 -1
  71. package/dist/hooks/useSnackMessage.d.ts +1 -3
  72. package/dist/index.js +62 -6
  73. package/dist/services/index.d.ts +1 -0
  74. package/dist/services/index.js +5 -2
  75. package/dist/services/networkModification.d.ts +6 -0
  76. package/dist/services/networkModification.js +26 -0
  77. package/dist/services/security-analysis.d.ts +0 -1
  78. package/dist/services/security-analysis.js +1 -5
  79. package/dist/services/sensitivity-analysis.js +1 -2
  80. package/dist/services/study.js +7 -6
  81. package/dist/services/utils.d.ts +1 -0
  82. package/dist/services/utils.js +5 -1
  83. package/dist/translations/en/businessErrorsEn.d.ts +2 -1
  84. package/dist/translations/en/businessErrorsEn.js +2 -1
  85. package/dist/translations/en/commonButtonEn.d.ts +1 -0
  86. package/dist/translations/en/commonButtonEn.js +2 -1
  87. package/dist/translations/en/networkModificationsEn.d.ts +11 -6
  88. package/dist/translations/en/networkModificationsEn.js +18 -1
  89. package/dist/translations/fr/businessErrorsFr.d.ts +2 -1
  90. package/dist/translations/fr/businessErrorsFr.js +2 -1
  91. package/dist/translations/fr/commonButtonFr.d.ts +1 -0
  92. package/dist/translations/fr/commonButtonFr.js +2 -1
  93. package/dist/translations/fr/networkModificationsFr.d.ts +11 -6
  94. package/dist/translations/fr/networkModificationsFr.js +18 -1
  95. package/dist/utils/constants/adornments.d.ts +44 -0
  96. package/dist/utils/constants/adornments.js +58 -0
  97. package/dist/utils/constants/fieldConstants.d.ts +7 -0
  98. package/dist/utils/constants/fieldConstants.js +7 -0
  99. package/dist/utils/constants/index.d.ts +2 -0
  100. package/dist/utils/constants/index.js +16 -1
  101. package/dist/utils/constants/translationKeys.d.ts +2 -0
  102. package/dist/utils/constants/translationKeys.js +6 -0
  103. package/dist/utils/error.d.ts +2 -0
  104. package/dist/utils/error.js +27 -22
  105. package/dist/utils/index.d.ts +2 -1
  106. package/dist/utils/index.js +25 -3
  107. package/dist/utils/labelUtils.d.ts +0 -1
  108. package/dist/utils/labelUtils.js +1 -8
  109. package/dist/utils/ts-utils.d.ts +18 -0
  110. package/dist/utils/ts-utils.js +40 -0
  111. package/dist/utils/types/types.d.ts +6 -0
  112. package/package.json +1 -1
@@ -3,9 +3,9 @@ import { useState, useRef, useCallback, useEffect } from "react";
3
3
  import "../../utils/conversionUtils.js";
4
4
  import { snackWithFallback } from "../../utils/error.js";
5
5
  import { arraysContainIdenticalStrings } from "../../utils/functions.js";
6
- import { getFileIcon } from "../../utils/mapper/getFileIcon.js";
7
6
  import { ElementType } from "../../utils/types/elementType.js";
8
7
  import "../../utils/types/equipmentType.js";
8
+ import { getFileIcon } from "../../utils/mapper/getFileIcon.js";
9
9
  import "../../utils/yupConfig.js";
10
10
  import { TreeViewFinder } from "../treeViewFinder/TreeViewFinder.js";
11
11
  import "react-intl";
@@ -33,6 +33,7 @@ import "localized-countries/data/fr";
33
33
  import "localized-countries/data/en";
34
34
  import { TableNumericalInput } from "../inputs/reactHookForm/tableInputs/table-numerical-input.js";
35
35
  import { TableTextInput } from "../inputs/reactHookForm/tableInputs/table-text-input.js";
36
+ import "notistack";
36
37
  import "@react-querybuilder/material";
37
38
  import "../filter/expert/expertFilterConstants.js";
38
39
  import "../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
@@ -23,8 +23,8 @@ import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialo
23
23
  import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
24
24
  import "../../../utils/conversionUtils.js";
25
25
  import { snackWithFallback } from "../../../utils/error.js";
26
- import "@mui/icons-material";
27
26
  import "../../../utils/types/equipmentType.js";
27
+ import "@mui/icons-material";
28
28
  import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./ExplicitNamingFilterConstants.js";
29
29
  import { filterStyles } from "../HeaderFilterForm.js";
30
30
  import "../../overflowableText/OverflowableText.js";
@@ -5,9 +5,9 @@ import { DISTRIBUTION_KEY, FilterType } from "../constants/FilterConstants.js";
5
5
  import { createFilter, saveFilter } from "../../../services/explore.js";
6
6
  import "../../../utils/conversionUtils.js";
7
7
  import { catchErrorHandler } from "../../../utils/error.js";
8
+ import "../../../utils/types/equipmentType.js";
8
9
  import "react/jsx-runtime";
9
10
  import "@mui/icons-material";
10
- import "../../../utils/types/equipmentType.js";
11
11
  import "../../../utils/yupConfig.js";
12
12
  const saveExplicitNamingFilter = (tableValues, isFilterCreation, equipmentType, name, description, id, setCreateFilterErr, handleClose, activeDirectory, token) => {
13
13
  let cleanedTableValues;
@@ -29,3 +29,4 @@ export * from './parameters';
29
29
  export * from './menus';
30
30
  export * from './muiTable';
31
31
  export * from './resizablePanels';
32
+ export * from './network-modifications';
@@ -98,6 +98,8 @@ import { TextFieldWithAdornment } from "./inputs/reactHookForm/utils/TextFieldWi
98
98
  import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./inputs/reactHookForm/utils/functions.js";
99
99
  import { HelperPreviousValue } from "./inputs/reactHookForm/utils/HelperPreviousValue.js";
100
100
  import { DESCRIPTION, NAME } from "./inputs/reactHookForm/constants.js";
101
+ import { ExpandableInput } from "./inputs/reactHookForm/expandableInput/ExpandableInput.js";
102
+ import { CountrySelectionInput } from "./inputs/reactHookForm/CountrySelectionInput.js";
101
103
  import { AddButton } from "./inputs/reactQueryBuilder/AddButton.js";
102
104
  import { AutocompleteWithFavorites } from "./inputs/reactQueryBuilder/AutocompleteWithFavorites.js";
103
105
  import { CombinatorSelector } from "./inputs/reactQueryBuilder/CombinatorSelector.js";
@@ -133,7 +135,7 @@ import { ArrowsOutputIcon } from "./icons/ArrowsOutputIcon.js";
133
135
  import { LeftPanelCloseIcon } from "./icons/LeftPanelCloseIcon.js";
134
136
  import { EditNoteIcon } from "./icons/EditNoteIcon.js";
135
137
  import { ComputingType, formatComputingTypeLabel, isValidComputingType } from "./parameters/common/computing-type.js";
136
- import { COMMON_PARAMETERS, PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_PROVIDER, PROVIDER, ReactivePowerAdornment, SPECIFIC_PARAMETERS, VERSION_PARAMETER, VOLTAGE_LEVEL, VoltageAdornment } from "./parameters/common/constant.js";
138
+ import { COMMON_PARAMETERS, PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_PROVIDER, PROVIDER, SPECIFIC_PARAMETERS, VERSION_PARAMETER, VOLTAGE_LEVEL } from "./parameters/common/constant.js";
137
139
  import { LineSeparator } from "./parameters/common/line-separator.js";
138
140
  import { LabelledButton, SwitchWithLabel, TabPanel } from "./parameters/common/parameters.js";
139
141
  import { CreateParameterDialog } from "./parameters/common/parameters-creation-dialog.js";
@@ -177,6 +179,12 @@ import { CustomMenuItem, CustomNestedMenuItem } from "./menus/custom-nested-menu
177
179
  import { OverflowableTableCell } from "./muiTable/OverflowableTableCell.js";
178
180
  import { OverflowableTableCellWithCheckbox } from "./muiTable/OverflowableTableCellWithCheckbox.js";
179
181
  import { ResizeHandle } from "./resizablePanels/ResizeHandle.js";
182
+ import { PropertiesForm } from "./network-modifications/common/properties/PropertiesForm.js";
183
+ import { PropertyForm } from "./network-modifications/common/properties/PropertyForm.js";
184
+ import { copyEquipmentPropertiesForCreation, createPropertyModification, creationPropertiesSchema, emptyProperties, fetchPredefinedProperties, getConcatenatedProperties, getFilledPropertiesFromModification, getPropertiesFromModification, getPropertyValue, initializedProperty, mergeModificationAndEquipmentProperties, modificationPropertiesSchema, toModificationProperties } from "./network-modifications/common/properties/propertyUtils.js";
185
+ import { filledTextField, italicFontTextField, standardTextField } from "./network-modifications/common/form.utils.js";
186
+ import { SubstationCreationForm } from "./network-modifications/substation/creation/SubstationCreationForm.js";
187
+ import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./network-modifications/substation/creation/substationCreation.utils.js";
180
188
  export {
181
189
  AboutDialog,
182
190
  ActivableChip,
@@ -218,6 +226,7 @@ export {
218
226
  ComputingType,
219
227
  ContingencyCellRenderer,
220
228
  CountriesInput,
229
+ CountrySelectionInput,
221
230
  CountryValueEditor,
222
231
  CreateParameterDialog,
223
232
  CsvExport,
@@ -274,6 +283,7 @@ export {
274
283
  ErrorInLogoutAlert,
275
284
  ErrorInUserValidationAlert,
276
285
  ErrorInput,
286
+ ExpandableInput,
277
287
  ExpandingTextField,
278
288
  ExpertFilterEditionDialog,
279
289
  ExpertFilterForm,
@@ -395,6 +405,8 @@ export {
395
405
  PccMinParametersInLine,
396
406
  PopupConfirmationDialog,
397
407
  PredefinedParameters,
408
+ PropertiesForm,
409
+ PropertyForm,
398
410
  PropertyValueEditor,
399
411
  ProviderParam,
400
412
  RATIO_REGULATION_MODE_OPTIONS,
@@ -408,7 +420,6 @@ export {
408
420
  RangeInput,
409
421
  RangeType,
410
422
  RawReadOnlyInput,
411
- ReactivePowerAdornment,
412
423
  RemoveButton,
413
424
  ResizeHandle,
414
425
  RuleValueEditor,
@@ -455,6 +466,7 @@ export {
455
466
  SliderInput,
456
467
  SnackbarProvider,
457
468
  SubmitButton,
469
+ SubstationCreationForm,
458
470
  SubstationLayout,
459
471
  SwitchInput,
460
472
  SwitchWithLabel,
@@ -488,28 +500,37 @@ export {
488
500
  VOLTAGE_LIMITS_MODIFICATION,
489
501
  ValueEditor,
490
502
  ValueSelector,
491
- VoltageAdornment,
492
503
  VoltageInitParametersEditionDialog,
493
504
  VoltageInitParametersInLine,
494
505
  VoltageInitTabValues,
495
506
  WRITE_SLACK_BUS,
496
507
  alertThresholdMarks,
508
+ copyEquipmentPropertiesForCreation,
497
509
  countRules,
510
+ createPropertyModification,
511
+ creationPropertiesSchema,
498
512
  dispatchUser,
499
513
  doesNodeHasChildren,
514
+ emptyProperties,
500
515
  expertFilterSchema,
501
516
  explicitNamingFilterSchema,
502
517
  exportExpertRules,
503
518
  extractDefault,
519
+ fetchPredefinedProperties,
520
+ filledTextField,
504
521
  formatComputingTypeLabel,
505
522
  genHelperError,
506
523
  generateTreeViewFinderClass,
524
+ getConcatenatedProperties,
507
525
  getExpertFilterEmptyFormData,
508
526
  getExplicitNamingFilterEmptyFormData,
527
+ getFilledPropertiesFromModification,
509
528
  getLimitReductionsFormSchema,
510
529
  getNumberOfSiblings,
511
530
  getOperators,
512
531
  getPreLoginPath,
532
+ getPropertiesFromModification,
533
+ getPropertyValue,
513
534
  getRangeInputSchema,
514
535
  getSAParametersFromSchema,
515
536
  gridItem,
@@ -520,25 +541,35 @@ export {
520
541
  initializeAuthenticationDev,
521
542
  initializeAuthenticationProd,
522
543
  initializeDirectory,
544
+ initializedProperty,
523
545
  intlInitialVoltageProfileMode,
524
546
  intlPredefinedParametersOptions,
525
547
  isFieldRequired,
526
548
  isFloatNumber,
527
549
  isIntegerNumber,
528
550
  isValidComputingType,
551
+ italicFontTextField,
529
552
  login,
530
553
  logout,
554
+ mergeModificationAndEquipmentProperties,
555
+ modificationPropertiesSchema,
531
556
  onlyStartedGeneratorsOptions,
532
557
  queryValidator,
533
558
  recursiveRemove,
534
559
  sanitizePercentageValue,
535
560
  saveExpertFilter,
536
561
  saveExplicitNamingFilter,
562
+ standardTextField,
537
563
  styles,
564
+ substationCreationDtoToForm,
565
+ substationCreationEmptyFormData,
566
+ substationCreationFormSchema,
567
+ substationCreationFormToDto,
538
568
  testQuery,
539
569
  toFloatOrNullValue,
540
570
  toFormValueSaParameters,
541
571
  toFormValuesLimitReductions,
572
+ toModificationProperties,
542
573
  unscrollableDialogStyles,
543
574
  useConvertValue,
544
575
  useCsvExport,
@@ -41,6 +41,8 @@ import { TextFieldWithAdornment } from "./reactHookForm/utils/TextFieldWithAdorn
41
41
  import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./reactHookForm/utils/functions.js";
42
42
  import { HelperPreviousValue } from "./reactHookForm/utils/HelperPreviousValue.js";
43
43
  import { DESCRIPTION, NAME } from "./reactHookForm/constants.js";
44
+ import { ExpandableInput } from "./reactHookForm/expandableInput/ExpandableInput.js";
45
+ import { CountrySelectionInput } from "./reactHookForm/CountrySelectionInput.js";
44
46
  import { AddButton } from "./reactQueryBuilder/AddButton.js";
45
47
  import { AutocompleteWithFavorites } from "./reactQueryBuilder/AutocompleteWithFavorites.js";
46
48
  import { CombinatorSelector } from "./reactQueryBuilder/CombinatorSelector.js";
@@ -70,6 +72,7 @@ export {
70
72
  ChipItemsInput,
71
73
  CombinatorSelector,
72
74
  CountriesInput,
75
+ CountrySelectionInput,
73
76
  CountryValueEditor,
74
77
  CsvUploader,
75
78
  CustomAgGridTable,
@@ -82,6 +85,7 @@ export {
82
85
  DirectoryItemsInput,
83
86
  ElementValueEditor,
84
87
  ErrorInput,
88
+ ExpandableInput,
85
89
  ExpandingTextField,
86
90
  FieldErrorAlert,
87
91
  FieldLabel,
@@ -0,0 +1,5 @@
1
+ import { AutocompleteInputProps } from './autocompleteInputs';
2
+ interface CountrySelectionInputProps extends Omit<AutocompleteInputProps, 'options' | 'getOptionLabel'> {
3
+ }
4
+ export declare function CountrySelectionInput(props: Readonly<CountrySelectionInputProps>): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,27 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useIntl } from "react-intl";
3
+ import { AutocompleteInput } from "./autocompleteInputs/AutocompleteInput.js";
4
+ import "react";
5
+ import "react-hook-form";
6
+ import "../../../utils/conversionUtils.js";
7
+ import "../../../utils/types/equipmentType.js";
8
+ import "@mui/icons-material";
9
+ import "../../../utils/yupConfig.js";
10
+ import "@mui/material";
11
+ import { useLocalizedCountries } from "../../../hooks/useLocalizedCountries.js";
12
+ import "notistack";
13
+ function CountrySelectionInput(props) {
14
+ const { locale } = useIntl();
15
+ const { translate, countryCodes } = useLocalizedCountries(locale);
16
+ return /* @__PURE__ */ jsx(
17
+ AutocompleteInput,
18
+ {
19
+ options: countryCodes,
20
+ getOptionLabel: (countryCode) => translate(countryCode),
21
+ ...props
22
+ }
23
+ );
24
+ }
25
+ export {
26
+ CountrySelectionInput
27
+ };
@@ -11,8 +11,8 @@ import { MidFormError } from "./errorManagement/MidFormError.js";
11
11
  import "../../../utils/conversionUtils.js";
12
12
  import "../../../utils/types/equipmentType.js";
13
13
  import { ArrayAction } from "../../../utils/types/types.js";
14
- import { mergeSx } from "../../../utils/styles.js";
15
14
  import { getEquipmentTypeShortLabel } from "../../../utils/labelUtils.js";
15
+ import { mergeSx } from "../../../utils/styles.js";
16
16
  import "../../../utils/yupConfig.js";
17
17
  import { fetchDirectoryElementPath } from "../../../services/directory.js";
18
18
  import "localized-countries";
@@ -56,7 +56,7 @@ function AutocompleteInput({
56
56
  return /* @__PURE__ */ jsx(
57
57
  Autocomplete,
58
58
  {
59
- value: selectedValues,
59
+ value: selectedValues ?? null,
60
60
  onChange: (_, data) => handleChange(data),
61
61
  ...allowNewValue && {
62
62
  freeSolo: true,
@@ -0,0 +1,8 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export interface DeletableRowProps extends PropsWithChildren {
3
+ alignItems: string;
4
+ onClick: () => void;
5
+ deletionMark?: boolean | null;
6
+ disabledDeletion?: boolean | null;
7
+ }
8
+ export declare function DeletableRow({ alignItems, onClick, deletionMark, disabledDeletion, children, }: Readonly<DeletableRowProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { useIntl } from "react-intl";
4
+ import { Grid, Tooltip, IconButton } from "@mui/material";
5
+ import { RestoreFromTrash, Delete } from "@mui/icons-material";
6
+ function DeletableRow({
7
+ alignItems,
8
+ onClick,
9
+ deletionMark,
10
+ disabledDeletion,
11
+ children
12
+ }) {
13
+ const intl = useIntl();
14
+ const [isMouseHover, setIsMouseHover] = useState(false);
15
+ return /* @__PURE__ */ jsxs(
16
+ Grid,
17
+ {
18
+ container: true,
19
+ spacing: 2,
20
+ item: true,
21
+ alignItems,
22
+ onMouseEnter: () => setIsMouseHover(true),
23
+ onMouseLeave: () => setIsMouseHover(false),
24
+ children: [
25
+ children,
26
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 1, children: isMouseHover && !disabledDeletion && /* @__PURE__ */ jsx(
27
+ Tooltip,
28
+ {
29
+ title: intl.formatMessage({
30
+ id: deletionMark ? "button.restore" : "DeleteRows"
31
+ }),
32
+ children: /* @__PURE__ */ jsx(IconButton, { onClick, children: deletionMark ? /* @__PURE__ */ jsx(RestoreFromTrash, {}) : /* @__PURE__ */ jsx(Delete, {}) })
33
+ }
34
+ ) })
35
+ ]
36
+ }
37
+ );
38
+ }
39
+ export {
40
+ DeletableRow
41
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (c) 2023, 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 interface ExpandableInputProps {
8
+ name: string;
9
+ Field: React.ComponentType<any>;
10
+ fieldProps?: any;
11
+ addButtonLabel?: string;
12
+ initialValue?: any;
13
+ getDeletionMark?: (idx: number) => boolean;
14
+ deleteCallback?: (idx: number) => boolean;
15
+ alignItems?: string;
16
+ watchProps?: boolean;
17
+ disabled?: boolean;
18
+ disabledDeletion?: (idx: number) => boolean;
19
+ }
20
+ export declare function ExpandableInput({ name, Field, // Used to display each object of an array
21
+ fieldProps, // Props to pass to Field
22
+ addButtonLabel, initialValue, // Initial value to display when we add a new entry to array
23
+ getDeletionMark, deleteCallback, alignItems, // default value for a flex container
24
+ watchProps, disabled, disabledDeletion, }: Readonly<ExpandableInputProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,80 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useFieldArray } from "react-hook-form";
3
+ import { Grid, Button } from "@mui/material";
4
+ import { ControlPoint } from "@mui/icons-material";
5
+ import { FormattedMessage } from "react-intl";
6
+ import { DeletableRow } from "./DeletableRow.js";
7
+ import { ErrorInput } from "../errorManagement/ErrorInput.js";
8
+ import { MidFormError } from "../errorManagement/MidFormError.js";
9
+ import "../../../../utils/conversionUtils.js";
10
+ import "../../../../utils/types/equipmentType.js";
11
+ import { mergeSx } from "../../../../utils/styles.js";
12
+ import "../../../../utils/yupConfig.js";
13
+ const styles = {
14
+ button: (theme) => ({
15
+ justifyContent: "flex-start",
16
+ fontSize: "small",
17
+ marginTop: theme.spacing(1)
18
+ }),
19
+ paddingButton: (theme) => ({
20
+ paddingLeft: theme.spacing(2)
21
+ })
22
+ };
23
+ function ExpandableInput({
24
+ name,
25
+ Field,
26
+ // Used to display each object of an array
27
+ fieldProps,
28
+ // Props to pass to Field
29
+ addButtonLabel,
30
+ initialValue,
31
+ // Initial value to display when we add a new entry to array
32
+ getDeletionMark,
33
+ deleteCallback,
34
+ alignItems = "stretch",
35
+ // default value for a flex container
36
+ watchProps = true,
37
+ disabled = false,
38
+ disabledDeletion
39
+ }) {
40
+ const {
41
+ fields: values,
42
+ append,
43
+ remove
44
+ } = useFieldArray({
45
+ name
46
+ });
47
+ return /* @__PURE__ */ jsxs(Grid, { item: true, container: true, spacing: 2, children: [
48
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(ErrorInput, { name, InputField: MidFormError }) }),
49
+ watchProps && values.map((value, idx) => /* @__PURE__ */ jsx(
50
+ DeletableRow,
51
+ {
52
+ alignItems,
53
+ onClick: () => {
54
+ const shouldRemove = deleteCallback ? deleteCallback(idx) : true;
55
+ if (shouldRemove) {
56
+ remove(idx);
57
+ }
58
+ },
59
+ deletionMark: getDeletionMark?.(idx),
60
+ disabledDeletion: disabledDeletion?.(idx),
61
+ children: /* @__PURE__ */ jsx(Field, { name, index: idx, ...fieldProps })
62
+ },
63
+ value.id
64
+ )),
65
+ /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
66
+ Button,
67
+ {
68
+ disabled,
69
+ fullWidth: true,
70
+ sx: mergeSx(styles.button, styles.paddingButton),
71
+ startIcon: /* @__PURE__ */ jsx(ControlPoint, {}),
72
+ onClick: () => append(initialValue),
73
+ children: addButtonLabel && /* @__PURE__ */ jsx(FormattedMessage, { id: addButtonLabel })
74
+ }
75
+ ) })
76
+ ] });
77
+ }
78
+ export {
79
+ ExpandableInput
80
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2024, 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 './ExpandableInput';
@@ -0,0 +1,4 @@
1
+ import { ExpandableInput } from "./ExpandableInput.js";
2
+ export {
3
+ ExpandableInput
4
+ };
@@ -20,3 +20,5 @@ export * from './tableInputs';
20
20
  export * from './text';
21
21
  export * from './utils';
22
22
  export * from './constants';
23
+ export * from './expandableInput';
24
+ export * from './CountrySelectionInput';
@@ -40,6 +40,8 @@ import { TextFieldWithAdornment } from "./utils/TextFieldWithAdornment.js";
40
40
  import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./utils/functions.js";
41
41
  import { HelperPreviousValue } from "./utils/HelperPreviousValue.js";
42
42
  import { DESCRIPTION, NAME } from "./constants.js";
43
+ import { ExpandableInput } from "./expandableInput/ExpandableInput.js";
44
+ import { CountrySelectionInput } from "./CountrySelectionInput.js";
43
45
  export {
44
46
  AutocompleteInput,
45
47
  BooleanInput,
@@ -48,6 +50,7 @@ export {
48
50
  CheckboxInput,
49
51
  ChipItemsInput,
50
52
  CountriesInput,
53
+ CountrySelectionInput,
51
54
  CsvUploader,
52
55
  CustomAgGridTable,
53
56
  CustomFormContext,
@@ -57,6 +60,7 @@ export {
57
60
  DescriptionField,
58
61
  DirectoryItemsInput,
59
62
  ErrorInput,
63
+ ExpandableInput,
60
64
  ExpandingTextField,
61
65
  FieldErrorAlert,
62
66
  FieldLabel,
@@ -64,7 +64,7 @@ function TextInput({
64
64
  fullWidth: true,
65
65
  id: id ?? label,
66
66
  label: fieldLabel,
67
- value: transformedValue,
67
+ value: transformedValue ?? "",
68
68
  onChange: handleValueChanged,
69
69
  disabled,
70
70
  InputProps: {
@@ -0,0 +1,8 @@
1
+ import { FilledTextFieldProps, StandardTextFieldProps } from '@mui/material';
2
+ export declare const filledTextField: FilledTextFieldProps;
3
+ export declare const standardTextField: StandardTextFieldProps;
4
+ export declare const italicFontTextField: {
5
+ style: {
6
+ fontStyle: string;
7
+ };
8
+ };
@@ -0,0 +1,14 @@
1
+ const filledTextField = {
2
+ variant: "filled"
3
+ };
4
+ const standardTextField = {
5
+ variant: "standard"
6
+ };
7
+ const italicFontTextField = {
8
+ style: { fontStyle: "italic" }
9
+ };
10
+ export {
11
+ filledTextField,
12
+ italicFontTextField,
13
+ standardTextField
14
+ };
@@ -0,0 +1,8 @@
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 './properties';
8
+ export * from './form.utils';
@@ -0,0 +1,24 @@
1
+ import { PropertiesForm } from "./properties/PropertiesForm.js";
2
+ import { PropertyForm } from "./properties/PropertyForm.js";
3
+ import { copyEquipmentPropertiesForCreation, createPropertyModification, creationPropertiesSchema, emptyProperties, fetchPredefinedProperties, getConcatenatedProperties, getFilledPropertiesFromModification, getPropertiesFromModification, getPropertyValue, initializedProperty, mergeModificationAndEquipmentProperties, modificationPropertiesSchema, toModificationProperties } from "./properties/propertyUtils.js";
4
+ import { filledTextField, italicFontTextField, standardTextField } from "./form.utils.js";
5
+ export {
6
+ PropertiesForm,
7
+ PropertyForm,
8
+ copyEquipmentPropertiesForCreation,
9
+ createPropertyModification,
10
+ creationPropertiesSchema,
11
+ emptyProperties,
12
+ fetchPredefinedProperties,
13
+ filledTextField,
14
+ getConcatenatedProperties,
15
+ getFilledPropertiesFromModification,
16
+ getPropertiesFromModification,
17
+ getPropertyValue,
18
+ initializedProperty,
19
+ italicFontTextField,
20
+ mergeModificationAndEquipmentProperties,
21
+ modificationPropertiesSchema,
22
+ standardTextField,
23
+ toModificationProperties
24
+ };
@@ -0,0 +1,7 @@
1
+ type PropertiesFormProps = {
2
+ id?: string;
3
+ networkElementType?: string;
4
+ isModification?: boolean;
5
+ };
6
+ export declare function PropertiesForm({ id, networkElementType, isModification }: Readonly<PropertiesFormProps>): import("react/jsx-runtime").JSX.Element;
7
+ export {};