@gridsuite/commons-ui 0.58.0 → 0.59.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 (182) hide show
  1. package/dist/chunks/{criteria-based-filter-edition-dialog.CbhgOSRk.js → criteria-based-filter-edition-dialog.p2pUWzxc.js} +20 -65
  2. package/dist/components/AuthenticationRouter/AuthenticationRouter.d.ts +28 -9
  3. package/dist/components/AuthenticationRouter/AuthenticationRouter.js +1 -1
  4. package/dist/components/AuthenticationRouter/index.d.ts +6 -0
  5. package/dist/components/CardErrorBoundary/card-error-boundary.d.ts +27 -13
  6. package/dist/components/CardErrorBoundary/card-error-boundary.js +7 -6
  7. package/dist/components/CardErrorBoundary/index.d.ts +6 -0
  8. package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +0 -4
  9. package/dist/components/DirectoryItemSelector/directory-item-selector.js +13 -26
  10. package/dist/components/ElementSearchDialog/equipment-item.d.ts +25 -16
  11. package/dist/components/ElementSearchDialog/equipment-item.js +5 -5
  12. package/dist/components/ElementSearchDialog/index.d.ts +6 -0
  13. package/dist/components/ElementSearchDialog/tag-renderer.d.ts +20 -10
  14. package/dist/components/ElementSearchDialog/tag-renderer.js +6 -11
  15. package/dist/components/FlatParameters/FlatParameters.d.ts +29 -9
  16. package/dist/components/FlatParameters/FlatParameters.js +3 -3
  17. package/dist/components/FlatParameters/index.d.ts +6 -0
  18. package/dist/components/Login/Login.d.ts +11 -4
  19. package/dist/components/Login/Logout.d.ts +11 -4
  20. package/dist/components/Login/index.d.ts +6 -0
  21. package/dist/components/MuiVirtualizedTable/ColumnHeader.d.ts +25 -2
  22. package/dist/components/MuiVirtualizedTable/ColumnHeader.js +68 -59
  23. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.d.ts +72 -61
  24. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +69 -83
  25. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +93 -113
  26. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +84 -106
  27. package/dist/components/MuiVirtualizedTable/index.d.ts +7 -1
  28. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.d.ts +16 -9
  29. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +1 -1
  30. package/dist/components/MultipleSelectionDialog/index.d.ts +6 -0
  31. package/dist/components/OverflowableText/index.d.ts +6 -0
  32. package/dist/components/OverflowableText/overflowable-text.d.ts +11 -1
  33. package/dist/components/OverflowableText/overflowable-text.js +1 -18
  34. package/dist/components/ReportViewer/filter-button.d.ts +11 -1
  35. package/dist/components/ReportViewer/filter-button.js +5 -2
  36. package/dist/components/ReportViewer/index.d.ts +6 -0
  37. package/dist/components/ReportViewer/log-report-item.d.ts +14 -64
  38. package/dist/components/ReportViewer/log-report-item.js +13 -47
  39. package/dist/components/ReportViewer/log-report.d.ts +16 -17
  40. package/dist/components/ReportViewer/log-report.js +2 -1
  41. package/dist/components/ReportViewer/log-severity.d.ts +13 -0
  42. package/dist/components/ReportViewer/log-severity.js +35 -0
  43. package/dist/components/ReportViewer/log-table.d.ts +9 -6
  44. package/dist/components/ReportViewer/log-table.js +6 -4
  45. package/dist/components/ReportViewer/multi-select-list.d.ts +17 -1
  46. package/dist/components/ReportViewer/report-item.d.ts +12 -12
  47. package/dist/components/ReportViewer/report-item.js +0 -7
  48. package/dist/components/ReportViewer/report-tree-view-context.d.ts +11 -1
  49. package/dist/components/ReportViewer/report-viewer.d.ts +7 -4
  50. package/dist/components/ReportViewer/report-viewer.js +8 -6
  51. package/dist/components/ReportViewer/report.type.d.ts +22 -0
  52. package/dist/components/ReportViewer/report.type.js +1 -0
  53. package/dist/components/ReportViewerDialog/index.d.ts +6 -0
  54. package/dist/components/ReportViewerDialog/report-viewer-dialog.d.ts +9 -1
  55. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +7 -4
  56. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +4 -1
  57. package/dist/components/SignInCallbackHandler/index.d.ts +6 -0
  58. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +7 -4
  59. package/dist/components/SilentRenewCallbackHandler/index.d.ts +6 -0
  60. package/dist/components/SnackbarProvider/SnackbarProvider.d.ts +3 -1
  61. package/dist/components/SnackbarProvider/SnackbarProvider.js +9 -7
  62. package/dist/components/SnackbarProvider/index.d.ts +6 -0
  63. package/dist/components/TopBar/AboutDialog.d.ts +30 -23
  64. package/dist/components/TopBar/AboutDialog.js +4 -22
  65. package/dist/components/TopBar/GridLogo.d.ts +13 -32
  66. package/dist/components/TopBar/GridLogo.js +12 -15
  67. package/dist/components/TopBar/TopBar.d.ts +52 -51
  68. package/dist/components/TopBar/TopBar.js +389 -380
  69. package/dist/components/TopBar/TopBar.test.d.ts +6 -0
  70. package/dist/components/TopBar/index.d.ts +6 -0
  71. package/dist/components/dialogs/modify-element-selection.d.ts +1 -1
  72. package/dist/components/dialogs/modify-element-selection.js +5 -14
  73. package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.d.ts +1 -1
  74. package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +1 -1
  75. package/dist/components/filter/criteria-based/filter-free-properties.d.ts +1 -1
  76. package/dist/components/filter/criteria-based/filter-property.d.ts +1 -1
  77. package/dist/components/filter/expert/expert-filter-constants.d.ts +22 -1
  78. package/dist/components/filter/expert/expert-filter-constants.js +39 -10
  79. package/dist/components/filter/expert/expert-filter-edition-dialog.d.ts +0 -6
  80. package/dist/components/filter/expert/expert-filter-edition-dialog.js +1 -2
  81. package/dist/components/filter/expert/expert-filter-form.js +1 -1
  82. package/dist/components/filter/expert/expert-filter.type.d.ts +4 -1
  83. package/dist/components/filter/expert/expert-filter.type.js +3 -0
  84. package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +1 -1
  85. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +1 -1
  86. package/dist/components/filter/filter-creation-dialog.d.ts +0 -7
  87. package/dist/components/filter/filter-creation-dialog.js +1 -2
  88. package/dist/components/filter/filter-form.js +1 -1
  89. package/dist/components/filter/utils/filter-form-utils.js +11 -18
  90. package/dist/components/inputs/react-hook-form/ag-grid-table/bottom-right-buttons.js +1 -1
  91. package/dist/components/inputs/react-hook-form/ag-grid-table/csv-uploader/csv-uploader.js +5 -13
  92. package/dist/components/inputs/react-hook-form/ag-grid-table/custom-ag-grid-table.js +1 -1
  93. package/dist/components/inputs/react-hook-form/autocomplete-inputs/autocomplete-input.d.ts +1 -1
  94. package/dist/components/inputs/react-hook-form/booleans/boolean-input.d.ts +9 -15
  95. package/dist/components/inputs/react-hook-form/booleans/boolean-input.js +0 -7
  96. package/dist/components/inputs/react-hook-form/booleans/checkbox-input.d.ts +8 -13
  97. package/dist/components/inputs/react-hook-form/booleans/checkbox-input.js +0 -6
  98. package/dist/components/inputs/react-hook-form/booleans/switch-input.d.ts +8 -13
  99. package/dist/components/inputs/react-hook-form/booleans/switch-input.js +0 -6
  100. package/dist/components/inputs/react-hook-form/directory-items-input.d.ts +0 -2
  101. package/dist/components/inputs/react-hook-form/directory-items-input.js +10 -14
  102. package/dist/components/inputs/react-hook-form/error-management/mid-form-error.d.ts +5 -3
  103. package/dist/components/inputs/react-hook-form/numbers/integer-input.d.ts +3 -20
  104. package/dist/components/inputs/react-hook-form/numbers/integer-input.js +1 -4
  105. package/dist/components/inputs/react-hook-form/range-input.d.ts +1 -1
  106. package/dist/components/inputs/react-hook-form/select-inputs/countries-input.js +12 -1
  107. package/dist/components/inputs/react-hook-form/select-inputs/select-input.d.ts +1 -1
  108. package/dist/components/inputs/react-hook-form/slider-input.d.ts +7 -20
  109. package/dist/components/inputs/react-hook-form/slider-input.js +4 -12
  110. package/dist/components/inputs/react-hook-form/text-input.d.ts +1 -1
  111. package/dist/components/inputs/react-hook-form/unique-name-input.d.ts +1 -1
  112. package/dist/components/inputs/react-hook-form/utils/text-field-with-adornment.d.ts +1 -1
  113. package/dist/components/inputs/react-query-builder/custom-react-query-builder.js +1 -1
  114. package/dist/components/inputs/react-query-builder/element-value-editor.js +7 -14
  115. package/dist/components/inputs/react-query-builder/remove-button.js +1 -1
  116. package/dist/components/inputs/react-query-builder/value-editor.js +1 -1
  117. package/dist/components/translations/card-error-boundary-en.d.ts +1 -1
  118. package/dist/components/translations/card-error-boundary-fr.d.ts +1 -1
  119. package/dist/components/translations/common-button-en.d.ts +10 -4
  120. package/dist/components/translations/common-button-fr.d.ts +10 -4
  121. package/dist/components/translations/directory-items-input-en.d.ts +1 -1
  122. package/dist/components/translations/directory-items-input-fr.d.ts +1 -1
  123. package/dist/components/translations/element-search-en.d.ts +1 -1
  124. package/dist/components/translations/element-search-fr.d.ts +1 -1
  125. package/dist/components/translations/equipment-search-en.d.ts +1 -1
  126. package/dist/components/translations/equipment-search-fr.d.ts +1 -1
  127. package/dist/components/translations/filter-en.d.ts +27 -21
  128. package/dist/components/translations/filter-en.js +2 -1
  129. package/dist/components/translations/filter-expert-en.d.ts +73 -0
  130. package/dist/components/translations/filter-expert-en.js +69 -0
  131. package/dist/components/translations/filter-expert-fr.d.ts +73 -0
  132. package/dist/components/translations/filter-expert-fr.js +69 -0
  133. package/dist/components/translations/filter-fr.d.ts +27 -21
  134. package/dist/components/translations/filter-fr.js +2 -1
  135. package/dist/components/translations/flat-parameters-en.d.ts +1 -1
  136. package/dist/components/translations/flat-parameters-fr.d.ts +1 -1
  137. package/dist/components/translations/inputs-en.d.ts +1 -1
  138. package/dist/components/translations/inputs-fr.d.ts +1 -1
  139. package/dist/components/translations/login-en.d.ts +1 -1
  140. package/dist/components/translations/login-fr.d.ts +1 -1
  141. package/dist/components/translations/multiple-selection-dialog-en.d.ts +1 -1
  142. package/dist/components/translations/multiple-selection-dialog-fr.d.ts +1 -1
  143. package/dist/components/translations/report-viewer-en.d.ts +1 -1
  144. package/dist/components/translations/report-viewer-fr.d.ts +1 -1
  145. package/dist/components/translations/table-en.d.ts +1 -1
  146. package/dist/components/translations/table-fr.d.ts +1 -1
  147. package/dist/components/translations/top-bar-en.d.ts +1 -1
  148. package/dist/components/translations/top-bar-fr.d.ts +1 -1
  149. package/dist/components/translations/treeview-finder-en.d.ts +1 -1
  150. package/dist/components/translations/treeview-finder-fr.d.ts +1 -1
  151. package/dist/hooks/localized-countries-hook.d.ts +10 -4
  152. package/dist/hooks/localized-countries-hook.js +1 -1
  153. package/dist/hooks/predefined-properties-hook.d.ts +1 -15
  154. package/dist/hooks/predefined-properties-hook.js +8 -16
  155. package/dist/index.d.ts +63 -217
  156. package/dist/index.js +102 -77
  157. package/dist/redux/actions.d.ts +33 -29
  158. package/dist/services/apps-metadata.d.ts +32 -0
  159. package/dist/services/apps-metadata.js +26 -0
  160. package/dist/services/directory.d.ts +6 -0
  161. package/dist/services/directory.js +42 -0
  162. package/dist/services/explore.d.ts +2 -0
  163. package/dist/services/explore.js +29 -1
  164. package/dist/services/index.d.ts +16 -0
  165. package/dist/services/index.js +20 -0
  166. package/dist/services/utils.d.ts +1 -0
  167. package/dist/services/utils.js +5 -1
  168. package/dist/utils/AuthService.d.ts +20 -9
  169. package/dist/utils/AuthService.js +29 -13
  170. package/dist/utils/ElementIcon.d.ts +4 -1
  171. package/dist/utils/UserManagerMock.d.ts +14 -14
  172. package/dist/utils/UserManagerMock.js +9 -15
  173. package/dist/utils/algos.d.ts +1 -1
  174. package/dist/utils/equipment-types-for-predefined-properties-mapper.d.ts +1 -1
  175. package/dist/utils/functions.d.ts +0 -1
  176. package/dist/utils/functions.js +1 -3
  177. package/dist/utils/styles.d.ts +5 -3
  178. package/dist/utils/styles.js +4 -1
  179. package/dist/utils/types.d.ts +13 -3
  180. package/package.json +2 -1
  181. package/dist/components/filter/filter-context.d.ts +0 -13
  182. package/dist/components/filter/filter-context.js +0 -11
@@ -1,6 +1,6 @@
1
1
  import '../assets/criteria-based-filter-edition-dialog.css';
2
2
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
3
- import React, { useState, useMemo, useEffect, useCallback, useContext } from "react";
3
+ import React, { useState, useMemo, useEffect, useCallback } from "react";
4
4
  import { FieldConstants } from "../utils/field-constants.js";
5
5
  import { backToFrontTweak, frontToBackTweak } from "../components/filter/criteria-based/criteria-based-filter-utils.js";
6
6
  import CustomMuiDialog from "../components/dialogs/custom-mui-dialog.js";
@@ -30,9 +30,8 @@ import CsvDownloader from "react-csv-downloader";
30
30
  import Alert from "@mui/material/Alert";
31
31
  import "../components/TreeViewFinder/TreeViewFinder.js";
32
32
  import "../components/TopBar/TopBar.js";
33
- import "../components/TopBar/GridLogo.js";
34
- import "../components/TopBar/AboutDialog.js";
35
- import "../components/SnackbarProvider/SnackbarProvider.js";
33
+ import "@mui/lab";
34
+ import "notistack";
36
35
  import "react-router-dom";
37
36
  import "../utils/AuthService.js";
38
37
  import "../components/MuiVirtualizedTable/MuiVirtualizedTable.js";
@@ -42,23 +41,16 @@ import "../components/ReportViewer/log-table.js";
42
41
  import "../components/ReportViewer/report-tree-view-context.js";
43
42
  import "@mui/x-tree-view";
44
43
  import "../components/OverflowableText/overflowable-text.js";
45
- import "../components/ElementSearchDialog/tag-renderer.js";
44
+ import "clsx";
46
45
  import "../components/inputs/react-hook-form/utils/submit-button.js";
47
46
  import CancelButton from "../components/inputs/react-hook-form/utils/cancel-button.js";
48
47
  import "../components/inputs/react-hook-form/provider/custom-form-provider.js";
49
48
  import "../components/dialogs/description-modification-dialog.js";
50
- import { FilterContext } from "../components/filter/filter-context.js";
51
- import "notistack";
52
49
  import * as yup from "yup";
53
50
  import "../components/dialogs/popup-confirmation-dialog.js";
54
51
  import "autosuggest-highlight/match";
55
52
  import "autosuggest-highlight/parse";
56
- import "clsx";
57
53
  import "../components/CardErrorBoundary/card-error-boundary.js";
58
- import "../components/inputs/react-hook-form/slider-input.js";
59
- import "../components/inputs/react-hook-form/numbers/integer-input.js";
60
- import "../components/inputs/react-hook-form/booleans/checkbox-input.js";
61
- import "../components/inputs/react-hook-form/booleans/switch-input.js";
62
54
  import "@mui/icons-material/Folder";
63
55
  import { saveExplicitNamingFilter, saveCriteriaBasedFilter, saveExpertFilter } from "../components/filter/utils/filter-api.js";
64
56
  import { formatQuery, QueryBuilder } from "react-querybuilder";
@@ -76,12 +68,12 @@ import TranslatedValueEditor from "../components/inputs/react-query-builder/tran
76
68
  import TextValueEditor from "../components/inputs/react-query-builder/text-value-editor.js";
77
69
  import Box from "@mui/material/Box";
78
70
  import { Generator, Load, VoltageLevel, Substation, noSelectionForCopy as noSelectionForCopy$1 } from "../utils/equipment-types.js";
71
+ import { fetchElementsInfos, saveFilter } from "../services/explore.js";
79
72
  import { useCustomFormContext } from "../components/inputs/react-hook-form/provider/use-custom-form-context.js";
80
73
  import DirectoryItemsInput from "../components/inputs/react-hook-form/directory-items-input.js";
81
74
  import { DISTRIBUTION_KEY, FilterType } from "../components/filter/constants/filter-constants.js";
82
75
  import { FetchStatus } from "../utils/FetchStatus.js";
83
76
  import PropTypes from "prop-types";
84
- import { saveFilter } from "../services/explore.js";
85
77
  import "./filter-properties.B7-q_yPf.js";
86
78
  import "../components/inputs/react-hook-form/range-input.js";
87
79
  import "../components/inputs/react-hook-form/select-inputs/mui-select-input.js";
@@ -833,10 +825,9 @@ const RemoveButton = (props) => {
833
825
  };
834
826
  const ElementValueEditor = (props) => {
835
827
  const { setValue } = useCustomFormContext();
836
- const { fetchElementsInfos } = useContext(FilterContext);
837
828
  useEffect(() => {
838
829
  if (props.defaultValue && Array.isArray(props.defaultValue) && props.defaultValue.length > 0 && props.defaultValue[0].length > 0 && validate(props.defaultValue[0])) {
839
- fetchElementsInfos && fetchElementsInfos(props.defaultValue).then(
830
+ fetchElementsInfos(props.defaultValue).then(
840
831
  (childrenWithMetadata) => {
841
832
  setValue(
842
833
  props.name,
@@ -851,13 +842,7 @@ const ElementValueEditor = (props) => {
851
842
  }
852
843
  );
853
844
  }
854
- }, [
855
- props.name,
856
- props.defaultValue,
857
- props.elementType,
858
- setValue,
859
- fetchElementsInfos
860
- ]);
845
+ }, [props.name, props.defaultValue, props.elementType, setValue]);
861
846
  return /* @__PURE__ */ jsx(
862
847
  DirectoryItemsInput,
863
848
  {
@@ -935,10 +920,12 @@ const ValueEditor = (props) => {
935
920
  );
936
921
  } else if (props.field === FieldType.ID || props.field === FieldType.NAME || props.field === FieldType.VOLTAGE_LEVEL_ID || props.field === FieldType.VOLTAGE_LEVEL_ID_1 || props.field === FieldType.VOLTAGE_LEVEL_ID_2) {
937
922
  return /* @__PURE__ */ jsx(TextValueEditor, { ...props });
938
- } else if (props.field === FieldType.PROPERTY || props.field === FieldType.SUBSTATION_PROPERTY || props.field === FieldType.SUBSTATION_PROPERTY_1 || props.field === FieldType.SUBSTATION_PROPERTY_2) {
923
+ } else if (props.field === FieldType.PROPERTY || props.field === FieldType.SUBSTATION_PROPERTY || props.field === FieldType.SUBSTATION_PROPERTY_1 || props.field === FieldType.SUBSTATION_PROPERTY_2 || props.field === FieldType.VOLTAGE_LEVEL_PROPERTY || props.field === FieldType.VOLTAGE_LEVEL_PROPERTY_1 || props.field === FieldType.VOLTAGE_LEVEL_PROPERTY_2) {
939
924
  let equipmentType;
940
925
  if (props.field === FieldType.SUBSTATION_PROPERTY || props.field === FieldType.SUBSTATION_PROPERTY_1 || props.field === FieldType.SUBSTATION_PROPERTY_2) {
941
926
  equipmentType = Substation.type;
927
+ } else if (props.field === FieldType.VOLTAGE_LEVEL_PROPERTY || props.field === FieldType.VOLTAGE_LEVEL_PROPERTY_1 || props.field === FieldType.VOLTAGE_LEVEL_PROPERTY_2) {
928
+ equipmentType = VoltageLevel.type;
942
929
  } else {
943
930
  equipmentType = getValues(FieldConstants.EQUIPMENT_TYPE);
944
931
  }
@@ -1218,13 +1205,8 @@ const FilterCreationDialog = ({
1218
1205
  open,
1219
1206
  onClose,
1220
1207
  activeDirectory,
1221
- fetchAppsAndUrls,
1222
1208
  elementExists,
1223
1209
  language,
1224
- fetchDirectoryContent,
1225
- fetchRootFolders,
1226
- fetchElementsInfos,
1227
- fetchPath,
1228
1210
  sourceFilterForExplicitNamingConversion = void 0
1229
1211
  }) => {
1230
1212
  var _a;
@@ -1300,24 +1282,12 @@ const FilterCreationDialog = ({
1300
1282
  disabledSave: !!nameError || !!isValidating,
1301
1283
  language,
1302
1284
  children: /* @__PURE__ */ jsx(
1303
- FilterContext.Provider,
1285
+ FilterForm,
1304
1286
  {
1305
- value: {
1306
- fetchDirectoryContent,
1307
- fetchRootFolders,
1308
- fetchElementsInfos,
1309
- fetchAppsAndUrls,
1310
- fetchPath
1311
- },
1312
- children: /* @__PURE__ */ jsx(
1313
- FilterForm,
1314
- {
1315
- creation: true,
1316
- activeDirectory,
1317
- elementExists,
1318
- sourceFilterForExplicitNamingConversion
1319
- }
1320
- )
1287
+ creation: true,
1288
+ activeDirectory,
1289
+ elementExists,
1290
+ sourceFilterForExplicitNamingConversion
1321
1291
  }
1322
1292
  )
1323
1293
  }
@@ -1341,11 +1311,7 @@ const ExpertFilterEditionDialog = ({
1341
1311
  setSelectionForCopy,
1342
1312
  activeDirectory,
1343
1313
  elementExists,
1344
- language,
1345
- fetchDirectoryContent,
1346
- fetchRootFolders,
1347
- fetchElementsInfos,
1348
- fetchAppsAndUrls
1314
+ language
1349
1315
  }) => {
1350
1316
  var _a;
1351
1317
  const { snackError } = useSnackMessage();
@@ -1429,22 +1395,11 @@ const ExpertFilterEditionDialog = ({
1429
1395
  disabledSave: !!nameError || !!isValidating,
1430
1396
  isDataFetching: dataFetchStatus === FetchStatus.FETCHING,
1431
1397
  language,
1432
- children: /* @__PURE__ */ jsx(
1433
- FilterContext.Provider,
1398
+ children: isDataReady && /* @__PURE__ */ jsx(
1399
+ FilterForm,
1434
1400
  {
1435
- value: {
1436
- fetchDirectoryContent,
1437
- fetchRootFolders,
1438
- fetchElementsInfos,
1439
- fetchAppsAndUrls
1440
- },
1441
- children: isDataReady && /* @__PURE__ */ jsx(
1442
- FilterForm,
1443
- {
1444
- activeDirectory,
1445
- elementExists
1446
- }
1447
- )
1401
+ activeDirectory,
1402
+ elementExists
1448
1403
  }
1449
1404
  )
1450
1405
  }
@@ -1,10 +1,29 @@
1
+ import { UserManager } from 'oidc-client';
2
+ import { Dispatch } from 'react';
3
+
4
+ export interface AuthenticationRouterProps {
5
+ userManager: {
6
+ instance: UserManager;
7
+ error: string;
8
+ };
9
+ signInCallbackError: {
10
+ message: string;
11
+ };
12
+ authenticationRouterError: {
13
+ userName: string;
14
+ userValidationError?: {
15
+ error: Error;
16
+ };
17
+ logoutError?: {
18
+ error: Error;
19
+ };
20
+ unauthorizedUserInfo?: string;
21
+ error: string;
22
+ };
23
+ showAuthenticationRouterLogin: boolean;
24
+ dispatch: Dispatch<unknown>;
25
+ navigate: () => void;
26
+ location: Location;
27
+ }
28
+ declare const AuthenticationRouter: ({ userManager, signInCallbackError, authenticationRouterError, showAuthenticationRouterLogin, dispatch, navigate, location, }: AuthenticationRouterProps) => import("react/jsx-runtime").JSX.Element;
1
29
  export default AuthenticationRouter;
2
- declare function AuthenticationRouter({ userManager, signInCallbackError, authenticationRouterError, showAuthenticationRouterLogin, dispatch, navigate, location, }: {
3
- userManager: any;
4
- signInCallbackError: any;
5
- authenticationRouterError: any;
6
- showAuthenticationRouterLogin: any;
7
- dispatch: any;
8
- navigate: any;
9
- location: any;
10
- }): import("react/jsx-runtime").JSX.Element;
@@ -88,7 +88,7 @@ const AuthenticationRouter = ({
88
88
  Logout,
89
89
  {
90
90
  disabled: userManager.instance === null,
91
- onLogoutClick: () => logout(location, userManager.instance)
91
+ onLogoutClick: () => logout(dispatch, userManager.instance)
92
92
  }
93
93
  ) }),
94
94
  /* @__PURE__ */ jsxs(Grid, { item: true, xs: 4, children: [
@@ -1 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2020, 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
+ */
1
7
  export { default } from './AuthenticationRouter';
@@ -1,18 +1,32 @@
1
- import { Component } from 'react';
2
- export default CardErrorBoundary;
3
- declare class CardErrorBoundary extends Component<any, any, any> {
4
- static getDerivedStateFromError(error: any): {
5
- hasError: boolean;
6
- error: any;
7
- };
8
- constructor(props: any);
9
- state: {
1
+ import { Component, ErrorInfo, ReactNode } from 'react';
2
+ import { IconButtonProps } from '@mui/material';
3
+
4
+ export interface ExpandMoreProps extends IconButtonProps {
5
+ expand: boolean;
6
+ }
7
+ interface Props {
8
+ children?: ReactNode;
9
+ }
10
+ type CardErrorBoundaryStateError = {
11
+ hasError: true;
12
+ error: Error;
13
+ };
14
+ type CardErrorBoundaryStateSuccess = {
15
+ hasError: false;
16
+ };
17
+ type CardErrorBoundaryState = (CardErrorBoundaryStateError | CardErrorBoundaryStateSuccess) & {
18
+ expanded: boolean;
19
+ };
20
+ declare class CardErrorBoundary extends Component<Props, CardErrorBoundaryState> {
21
+ state: CardErrorBoundaryState;
22
+ constructor(props: Props);
23
+ static getDerivedStateFromError(error: Error): {
10
24
  hasError: boolean;
11
- expanded: boolean;
12
- error: undefined;
25
+ error: Error;
13
26
  };
27
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
14
28
  handleExpandClick(): void;
15
29
  handleReloadClick(): void;
16
- componentDidCatch(error: any, errorInfo: any): void;
17
- render(): any;
30
+ render(): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | null | undefined;
18
31
  }
32
+ export default CardErrorBoundary;
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Component } from "react";
3
- import { styled, IconButton, Box, Card, CardHeader, CardContent, Typography, CardActions, Collapse } from "@mui/material";
4
2
  import { Replay, ExpandMore as ExpandMore$1 } from "@mui/icons-material";
3
+ import { styled, IconButton, Box, Card, CardHeader, CardContent, Typography, CardActions, Collapse } from "@mui/material";
4
+ import { Component } from "react";
5
5
  import { FormattedMessage } from "react-intl";
6
6
  const ExpandMore = styled((props) => {
7
7
  const { expand, ...other } = props;
@@ -18,8 +18,7 @@ class CardErrorBoundary extends Component {
18
18
  super(props);
19
19
  this.state = {
20
20
  hasError: false,
21
- expanded: false,
22
- error: void 0
21
+ expanded: false
23
22
  };
24
23
  this.handleExpandClick = this.handleExpandClick.bind(this);
25
24
  this.handleReloadClick = this.handleReloadClick.bind(this);
@@ -31,10 +30,12 @@ class CardErrorBoundary extends Component {
31
30
  console.error("CardErrorBoundary caught: ", error, errorInfo);
32
31
  }
33
32
  handleExpandClick() {
34
- this.setState((state) => ({ expanded: !state.expanded }));
33
+ this.setState((state) => ({
34
+ expanded: !state.expanded
35
+ }));
35
36
  }
36
37
  handleReloadClick() {
37
- this.setState((state) => ({
38
+ this.setState((_) => ({
38
39
  hasError: false,
39
40
  expanded: false,
40
41
  error: void 0
@@ -1 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2022, 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
+ */
1
7
  export { default } from './card-error-boundary';
@@ -1,4 +1,3 @@
1
- import { ElementAttributes } from '../../utils/types.ts';
2
1
  import { UUID } from 'crypto';
3
2
  import { TreeViewFinderProps } from '../TreeViewFinder/TreeViewFinder';
4
3
  import { FunctionComponent } from 'react';
@@ -8,9 +7,6 @@ interface DirectoryItemSelectorProps extends TreeViewFinderProps {
8
7
  types: string[];
9
8
  equipmentTypes?: string[];
10
9
  itemFilter?: any;
11
- fetchDirectoryContent?: (directoryUuid: UUID, elementTypes: string[]) => Promise<ElementAttributes[]>;
12
- fetchRootFolders?: (types: string[]) => Promise<ElementAttributes[]>;
13
- fetchElementsInfos?: (ids: UUID[], elementTypes: string[], equipmentTypes: string[]) => Promise<ElementAttributes[]>;
14
10
  classes?: any;
15
11
  contentText?: string;
16
12
  defaultExpanded?: string[];
@@ -4,6 +4,8 @@ import { getFileIcon } from "../../utils/ElementIcon.js";
4
4
  import { ElementType } from "../../utils/ElementType.js";
5
5
  import TreeViewFinder from "../TreeViewFinder/TreeViewFinder.js";
6
6
  import { useSnackMessage } from "../../hooks/useSnackMessage.js";
7
+ import { fetchElementsInfos } from "../../services/explore.js";
8
+ import { fetchRootFolders, fetchDirectoryContent } from "../../services/directory.js";
7
9
  const styles = {
8
10
  icon: (theme) => ({
9
11
  marginRight: theme.spacing(1),
@@ -16,9 +18,6 @@ const DirectoryItemSelector = ({
16
18
  types,
17
19
  equipmentTypes,
18
20
  itemFilter,
19
- fetchDirectoryContent,
20
- fetchRootFolders,
21
- fetchElementsInfos,
22
21
  expanded,
23
22
  ...otherTreeViewFinderProps
24
23
  }) => {
@@ -77,7 +76,7 @@ const DirectoryItemSelector = ({
77
76
  [convertRoots]
78
77
  );
79
78
  const updateRootDirectories = useCallback(() => {
80
- fetchRootFolders && fetchRootFolders(types).then((data2) => {
79
+ fetchRootFolders(types).then((data2) => {
81
80
  let [nrs, mdr] = updatedTree(
82
81
  rootsRef.current,
83
82
  nodeMap.current,
@@ -93,30 +92,26 @@ const DirectoryItemSelector = ({
93
92
  headerId: "DirectoryItemSelector"
94
93
  });
95
94
  });
96
- }, [convertRoots, types, snackError, fetchRootFolders]);
95
+ }, [convertRoots, types, snackError]);
97
96
  const fetchDirectory = useCallback(
98
97
  (nodeId) => {
99
98
  const typeList = types.includes(ElementType.DIRECTORY) ? [] : types;
100
- fetchDirectoryContent && fetchDirectoryContent(nodeId, typeList).then((children) => {
99
+ fetchDirectoryContent(nodeId, typeList).then((children) => {
101
100
  const childrenMatchedTypes = children.filter(
102
101
  (item) => contentFilter().has(item.type)
103
102
  );
104
103
  if (childrenMatchedTypes.length > 0 && equipmentTypes && equipmentTypes.length > 0) {
105
- fetchElementsInfos && fetchElementsInfos(
106
- childrenMatchedTypes.map(
107
- (e) => e.elementUuid
108
- ),
104
+ fetchElementsInfos(
105
+ childrenMatchedTypes.map((e) => e.elementUuid),
109
106
  types,
110
107
  equipmentTypes
111
108
  ).then((childrenWithMetadata) => {
112
- const children2 = itemFilter ? childrenWithMetadata.filter(
113
- (val) => {
114
- if (val.type === ElementType.DIRECTORY) {
115
- return true;
116
- }
117
- return itemFilter(val);
109
+ const children2 = itemFilter ? childrenWithMetadata.filter((val) => {
110
+ if (val.type === ElementType.DIRECTORY) {
111
+ return true;
118
112
  }
119
- ) : childrenWithMetadata;
113
+ return itemFilter(val);
114
+ }) : childrenWithMetadata;
120
115
  addToDirectory(nodeId, children2);
121
116
  });
122
117
  } else {
@@ -128,15 +123,7 @@ const DirectoryItemSelector = ({
128
123
  );
129
124
  });
130
125
  },
131
- [
132
- types,
133
- equipmentTypes,
134
- itemFilter,
135
- contentFilter,
136
- addToDirectory,
137
- fetchDirectoryContent,
138
- fetchElementsInfos
139
- ]
126
+ [types, equipmentTypes, itemFilter, contentFilter, addToDirectory]
140
127
  );
141
128
  useEffect(() => {
142
129
  if (open) {
@@ -1,16 +1,25 @@
1
- export function EquipmentItem({ inputValue, suffixRenderer, element, showsJustText, ...props }: {
2
- [x: string]: any;
3
- inputValue: any;
4
- suffixRenderer?: {
5
- ({ props, element }: {
6
- props: any;
7
- element: any;
8
- }): import("react/jsx-runtime").JSX.Element;
9
- propTypes: {
10
- element: import('prop-types').Requireable<object>;
11
- props: import('prop-types').Requireable<object>;
12
- };
13
- } | undefined;
14
- element: any;
15
- showsJustText?: boolean | undefined;
16
- }): import("react/jsx-runtime").JSX.Element;
1
+ import { SxProps } from '@mui/material';
2
+ import { EquipmentInfos } from '../../utils/EquipmentType';
3
+ import { TagRenderer } from './index';
4
+
5
+ export interface EquipmentItemProps {
6
+ inputValue: string;
7
+ suffixRenderer: typeof TagRenderer;
8
+ element: EquipmentInfos;
9
+ showsJustText: boolean;
10
+ classes?: {
11
+ result?: string;
12
+ equipmentOption?: string;
13
+ equipmentTag?: string;
14
+ equipmentTypeTag?: string;
15
+ equipmentVlTag?: string;
16
+ };
17
+ styles?: {
18
+ result?: SxProps;
19
+ equipmentOption?: SxProps;
20
+ equipmentTag?: SxProps;
21
+ equipmentTypeTag?: SxProps;
22
+ equipmentVlTag?: SxProps;
23
+ };
24
+ }
25
+ export declare const EquipmentItem: ({ inputValue, suffixRenderer, element, showsJustText, ...props }: EquipmentItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -7,8 +7,8 @@ import { TagRenderer } from "./tag-renderer.js";
7
7
  import match from "autosuggest-highlight/match";
8
8
  import parse from "autosuggest-highlight/parse";
9
9
  import clsx from "clsx";
10
- import { OverflowableText } from "../OverflowableText/overflowable-text.js";
11
10
  import { EQUIPMENT_TYPE } from "../../utils/EquipmentType.js";
11
+ import { OverflowableText } from "../OverflowableText/overflowable-text.js";
12
12
  import { mergeSx } from "../../utils/styles.js";
13
13
  const EquipmentItem = ({
14
14
  inputValue,
@@ -17,7 +17,7 @@ const EquipmentItem = ({
17
17
  showsJustText = false,
18
18
  ...props
19
19
  }) => {
20
- var _a, _b, _c, _d, _e, _f, _g, _h;
20
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
21
21
  let matches = match(element.label, inputValue, {
22
22
  insideWords: true,
23
23
  findAllOccurrences: true
@@ -44,7 +44,7 @@ const EquipmentItem = ({
44
44
  children: /* @__PURE__ */ jsx(
45
45
  FormattedMessage,
46
46
  {
47
- id: EQUIPMENT_TYPE[element.type].tagLabel
47
+ id: (_g = EQUIPMENT_TYPE[element.type]) == null ? void 0 : _g.tagLabel
48
48
  }
49
49
  )
50
50
  }
@@ -53,8 +53,8 @@ const EquipmentItem = ({
53
53
  OverflowableText,
54
54
  {
55
55
  text: parts.map((e) => e.text).join(),
56
- className: (_g = props.classes) == null ? void 0 : _g.result,
57
- sx: (_h = props.styles) == null ? void 0 : _h.result,
56
+ className: (_h = props.classes) == null ? void 0 : _h.result,
57
+ sx: (_i = props.styles) == null ? void 0 : _i.result,
58
58
  children: parts.map((part, index) => /* @__PURE__ */ jsx(
59
59
  "span",
60
60
  {
@@ -1,2 +1,8 @@
1
+ /**
2
+ * Copyright (c) 2021, 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
+ */
1
7
  export { default } from './element-search-dialog';
2
8
  export { TagRenderer } from './tag-renderer';
@@ -1,11 +1,21 @@
1
- import { default as PropTypes } from 'prop-types';
2
- export function TagRenderer({ props, element }: {
3
- props: any;
4
- element: any;
5
- }): import("react/jsx-runtime").JSX.Element;
6
- export namespace TagRenderer {
7
- namespace propTypes {
8
- let element: PropTypes.Requireable<object>;
9
- let props: PropTypes.Requireable<object>;
10
- }
1
+ import { SxProps } from '@mui/material';
2
+ import { EquipmentType } from '../../utils/EquipmentType';
3
+
4
+ interface TagRendererProps {
5
+ props: {
6
+ classes?: {
7
+ equipmentTag?: string;
8
+ equipmentVlTag?: string;
9
+ };
10
+ styles?: {
11
+ equipmentTag?: SxProps;
12
+ equipmentVlTag?: SxProps;
13
+ };
14
+ };
15
+ element: {
16
+ type: EquipmentType;
17
+ voltageLevelLabel?: string;
18
+ };
11
19
  }
20
+ export declare const TagRenderer: ({ props, element }: TagRendererProps) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -2,32 +2,27 @@ import { jsx, Fragment } from "react/jsx-runtime";
2
2
  import { OverflowableText } from "../OverflowableText/overflowable-text.js";
3
3
  import clsx from "clsx";
4
4
  import { EQUIPMENT_TYPE } from "../../utils/EquipmentType.js";
5
- import PropTypes from "prop-types";
6
5
  import { mergeSx } from "../../utils/styles.js";
7
6
  const TagRenderer = ({ props, element }) => {
8
- var _a, _b, _c, _d;
9
- if (element.type !== EQUIPMENT_TYPE.SUBSTATION.name && element.type !== EQUIPMENT_TYPE.VOLTAGE_LEVEL.name) {
7
+ var _a, _b, _c, _d, _e, _f;
8
+ if (element.type !== ((_a = EQUIPMENT_TYPE.SUBSTATION) == null ? void 0 : _a.name) && element.type !== ((_b = EQUIPMENT_TYPE.VOLTAGE_LEVEL) == null ? void 0 : _b.name)) {
10
9
  return /* @__PURE__ */ jsx(
11
10
  OverflowableText,
12
11
  {
13
12
  text: element.voltageLevelLabel,
14
13
  className: clsx(
15
- (_a = props.classes) == null ? void 0 : _a.equipmentTag,
16
- (_b = props.classes) == null ? void 0 : _b.equipmentVlTag
14
+ (_c = props.classes) == null ? void 0 : _c.equipmentTag,
15
+ (_d = props.classes) == null ? void 0 : _d.equipmentVlTag
17
16
  ),
18
17
  sx: mergeSx(
19
- (_c = props.styles) == null ? void 0 : _c.equipmentTag,
20
- (_d = props.styles) == null ? void 0 : _d.equipmentVlTag
18
+ (_e = props.styles) == null ? void 0 : _e.equipmentTag,
19
+ (_f = props.styles) == null ? void 0 : _f.equipmentVlTag
21
20
  )
22
21
  }
23
22
  );
24
23
  }
25
24
  return /* @__PURE__ */ jsx(Fragment, {});
26
25
  };
27
- TagRenderer.propTypes = {
28
- element: PropTypes.object,
29
- props: PropTypes.object
30
- };
31
26
  export {
32
27
  TagRenderer
33
28
  };
@@ -1,10 +1,30 @@
1
- export function extractDefault(paramDescription: any): any;
2
- export function FlatParameters({ paramsAsArray, initValues, onChange, variant, showSeparator, selectionWithDialog, }: {
3
- paramsAsArray: any;
4
- initValues: any;
5
- onChange: any;
6
- variant?: string | undefined;
7
- showSeparator?: boolean | undefined;
8
- selectionWithDialog?: ((param: any) => boolean) | undefined;
9
- }): import("react/jsx-runtime").JSX.Element;
1
+ import { TextFieldProps } from '@mui/material';
2
+
3
+ export declare function extractDefault(paramDescription: any): any;
4
+ export type Parameter = {
5
+ type: 'BOOLEAN' | 'DOUBLE' | 'INTEGER' | 'STRING_LIST' | 'STRING';
6
+ description?: string;
7
+ name: string;
8
+ possibleValues: any;
9
+ defaultValue: any;
10
+ };
11
+ export interface FlatParametersProps {
12
+ paramsAsArray: Parameter[];
13
+ initValues: Record<string, string>;
14
+ onChange: (paramName: string, value: unknown, isInEdition: boolean) => void;
15
+ variant: TextFieldProps['variant'];
16
+ showSeparator?: boolean;
17
+ selectionWithDialog?: (param: Parameter) => boolean;
18
+ }
19
+ /**
20
+ * Present a "list" of independently editable parameters according to
21
+ * their description, as given by paramsAsArray, with current values as in initValues.
22
+ * @param paramsAsArray [{type,name,possibleValues,defaultValue}]
23
+ * @param initValues {k:v}
24
+ * @param onChange (paramName, newValue, isInEdition)
25
+ * @param variant style variant for TextField, Autocomplete and Select parameter fields
26
+ * @param showSeparator if true, a separator is added between parameters
27
+ * @param selectionWithDialog {(param: {}) => boolean} if true, param with multiple options use dialog for selection
28
+ */
29
+ export declare const FlatParameters: ({ paramsAsArray, initValues, onChange, variant, showSeparator, selectionWithDialog, }: FlatParametersProps) => import("react/jsx-runtime").JSX.Element;
10
30
  export default FlatParameters;
@@ -42,10 +42,10 @@ function extractDefault(paramDescription) {
42
42
  return d;
43
43
  }
44
44
  const mo = ListRE.exec(d);
45
- if ((mo == null ? void 0 : mo.length) > 1) {
46
- return mo[1].split(sepRE).map((s) => s.trim()).filter((s) => !!s);
45
+ if (mo === null || mo.length <= 1) {
46
+ return [];
47
47
  }
48
- return [];
48
+ return mo[1].split(sepRE).map((s) => s.trim()).filter((s) => !!s);
49
49
  }
50
50
  return d ?? null;
51
51
  }
@@ -1 +1,7 @@
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
+ */
1
7
  export { default } from './FlatParameters';