@gridsuite/commons-ui 0.46.0 → 0.48.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 (271) hide show
  1. package/README.md +0 -17
  2. package/dist/components/AuthenticationRouter/AuthenticationRouter.d.ts +10 -0
  3. package/dist/components/AuthenticationRouter/AuthenticationRouter.js +147 -0
  4. package/dist/components/AuthenticationRouter/index.d.ts +1 -0
  5. package/dist/components/CardErrorBoundary/card-error-boundary.d.ts +18 -0
  6. package/dist/components/CardErrorBoundary/card-error-boundary.js +110 -0
  7. package/dist/components/CardErrorBoundary/index.d.ts +1 -0
  8. package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +22 -0
  9. package/dist/components/DirectoryItemSelector/directory-item-selector.js +254 -0
  10. package/dist/components/ElementSearchDialog/element-search-dialog.d.ts +16 -0
  11. package/dist/components/ElementSearchDialog/element-search-dialog.js +139 -0
  12. package/dist/components/ElementSearchDialog/equipment-item.d.ts +16 -0
  13. package/dist/components/ElementSearchDialog/equipment-item.js +77 -0
  14. package/dist/components/ElementSearchDialog/index.d.ts +2 -0
  15. package/dist/components/ElementSearchDialog/tag-renderer.d.ts +11 -0
  16. package/dist/components/ElementSearchDialog/tag-renderer.js +34 -0
  17. package/dist/components/FlatParameters/FlatParameters.d.ts +10 -0
  18. package/dist/components/FlatParameters/FlatParameters.js +411 -0
  19. package/dist/components/FlatParameters/index.d.ts +1 -0
  20. package/dist/components/Login/Login.d.ts +5 -0
  21. package/dist/components/Login/Login.js +78 -0
  22. package/dist/components/Login/Logout.d.ts +5 -0
  23. package/dist/components/Login/Logout.js +69 -0
  24. package/dist/components/Login/index.d.ts +1 -0
  25. package/dist/components/MuiVirtualizedTable/ColumnHeader.d.ts +4 -0
  26. package/dist/components/MuiVirtualizedTable/ColumnHeader.js +127 -0
  27. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.d.ts +104 -0
  28. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +548 -0
  29. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +131 -0
  30. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +790 -0
  31. package/dist/components/MuiVirtualizedTable/index.d.ts +2 -0
  32. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.d.ts +10 -0
  33. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +87 -0
  34. package/dist/components/MultipleSelectionDialog/index.d.ts +1 -0
  35. package/dist/components/OverflowableText/index.d.ts +1 -0
  36. package/dist/components/OverflowableText/overflowable-text.d.ts +2 -0
  37. package/dist/components/OverflowableText/overflowable-text.js +87 -0
  38. package/dist/components/ReportViewer/filter-button.d.ts +1 -0
  39. package/dist/components/ReportViewer/filter-button.js +64 -0
  40. package/dist/components/ReportViewer/index.d.ts +1 -0
  41. package/dist/components/ReportViewer/log-report-item.d.ts +68 -0
  42. package/dist/components/ReportViewer/log-report-item.js +95 -0
  43. package/dist/components/ReportViewer/log-report.d.ts +21 -0
  44. package/dist/components/ReportViewer/log-report.js +49 -0
  45. package/dist/components/ReportViewer/log-table.d.ts +8 -0
  46. package/dist/components/ReportViewer/log-table.js +131 -0
  47. package/dist/components/ReportViewer/multi-select-list.d.ts +1 -0
  48. package/dist/components/ReportViewer/multi-select-list.js +40 -0
  49. package/dist/components/ReportViewer/report-item.d.ts +13 -0
  50. package/dist/components/ReportViewer/report-item.js +112 -0
  51. package/dist/components/ReportViewer/report-tree-view-context.d.ts +2 -0
  52. package/dist/components/ReportViewer/report-tree-view-context.js +8 -0
  53. package/dist/components/ReportViewer/report-viewer.d.ts +4 -0
  54. package/dist/components/ReportViewer/report-viewer.js +158 -0
  55. package/dist/components/ReportViewerDialog/index.d.ts +1 -0
  56. package/dist/components/ReportViewerDialog/report-viewer-dialog.d.ts +1 -0
  57. package/dist/components/ReportViewerDialog/report-viewer-dialog.js +61 -0
  58. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +5 -0
  59. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +13 -0
  60. package/dist/components/SignInCallbackHandler/index.d.ts +1 -0
  61. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +5 -0
  62. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +16 -0
  63. package/dist/components/SilentRenewCallbackHandler/index.d.ts +1 -0
  64. package/dist/components/SnackbarProvider/SnackbarProvider.d.ts +3 -0
  65. package/dist/components/SnackbarProvider/SnackbarProvider.js +28 -0
  66. package/dist/components/SnackbarProvider/index.d.ts +1 -0
  67. package/dist/components/TopBar/AboutDialog.d.ts +24 -0
  68. package/dist/components/TopBar/AboutDialog.js +467 -0
  69. package/dist/components/TopBar/GridLogo.d.ts +34 -0
  70. package/dist/components/TopBar/GridLogo.js +71 -0
  71. package/dist/components/TopBar/TopBar.d.ts +53 -0
  72. package/dist/components/TopBar/TopBar.js +679 -0
  73. package/dist/components/TopBar/index.d.ts +3 -0
  74. package/dist/components/TreeViewFinder/TreeViewFinder.d.ts +57 -0
  75. package/dist/components/TreeViewFinder/TreeViewFinder.js +288 -0
  76. package/dist/components/TreeViewFinder/index.d.ts +1 -0
  77. package/dist/components/react-hook-form/autocomplete-input.d.ts +30 -0
  78. package/dist/components/react-hook-form/autocomplete-input.js +96 -0
  79. package/dist/components/react-hook-form/booleans/boolean-input.d.ts +16 -0
  80. package/dist/components/react-hook-form/booleans/boolean-input.js +49 -0
  81. package/dist/components/react-hook-form/booleans/checkbox-input.d.ts +14 -0
  82. package/dist/components/react-hook-form/booleans/checkbox-input.js +24 -0
  83. package/dist/components/react-hook-form/booleans/switch-input.d.ts +14 -0
  84. package/dist/components/react-hook-form/booleans/switch-input.js +24 -0
  85. package/dist/components/react-hook-form/directory-items-input.d.ts +28 -0
  86. package/dist/components/react-hook-form/directory-items-input.js +185 -0
  87. package/dist/components/react-hook-form/error-management/error-input.d.ts +5 -0
  88. package/dist/components/react-hook-form/error-management/error-input.js +42 -0
  89. package/dist/components/react-hook-form/error-management/field-error-alert.d.ts +4 -0
  90. package/dist/components/react-hook-form/error-management/field-error-alert.js +9 -0
  91. package/dist/components/react-hook-form/error-management/mid-form-error.d.ts +4 -0
  92. package/dist/components/react-hook-form/error-management/mid-form-error.js +20 -0
  93. package/dist/components/react-hook-form/numbers/float-input.d.ts +18 -0
  94. package/dist/components/react-hook-form/numbers/float-input.js +51 -0
  95. package/dist/components/react-hook-form/numbers/integer-input.d.ts +18 -0
  96. package/dist/components/react-hook-form/numbers/integer-input.js +36 -0
  97. package/dist/components/react-hook-form/numbers/utils.d.ts +2 -0
  98. package/dist/components/react-hook-form/numbers/utils.js +10 -0
  99. package/dist/components/react-hook-form/radio-input.d.ts +18 -0
  100. package/dist/components/react-hook-form/radio-input.js +44 -0
  101. package/{es/components/MultipleSelectionDialog/index.js → dist/components/react-hook-form/raw-read-only-input.d.ts} +3 -2
  102. package/dist/components/react-hook-form/raw-read-only-input.js +10 -0
  103. package/dist/components/react-hook-form/select-input.d.ts +17 -0
  104. package/dist/components/react-hook-form/select-input.js +31 -0
  105. package/dist/components/react-hook-form/slider-input.d.ts +21 -0
  106. package/dist/components/react-hook-form/slider-input.js +43 -0
  107. package/dist/components/react-hook-form/text-input.d.ts +33 -0
  108. package/dist/components/react-hook-form/text-input.js +94 -0
  109. package/dist/components/react-hook-form/utils/cancel-button.d.ts +10 -0
  110. package/dist/components/react-hook-form/utils/cancel-button.js +16 -0
  111. package/dist/components/react-hook-form/utils/field-label.d.ts +6 -0
  112. package/dist/components/react-hook-form/utils/field-label.js +12 -0
  113. package/dist/components/react-hook-form/utils/functions.d.ts +11 -0
  114. package/dist/components/react-hook-form/utils/functions.js +41 -0
  115. package/dist/components/react-hook-form/utils/submit-button.d.ts +10 -0
  116. package/dist/components/react-hook-form/utils/submit-button.js +23 -0
  117. package/dist/components/react-hook-form/utils/text-field-with-adornment.d.ts +12 -0
  118. package/dist/components/react-hook-form/utils/text-field-with-adornment.js +96 -0
  119. package/{es/components/translations/report-viewer-fr.js → dist/components/translations/card-error-boundary-en.d.ts} +5 -6
  120. package/dist/components/translations/card-error-boundary-en.js +8 -0
  121. package/dist/components/translations/card-error-boundary-fr.d.ts +12 -0
  122. package/dist/components/translations/card-error-boundary-fr.js +8 -0
  123. package/dist/components/translations/common-button-en.d.ts +5 -0
  124. package/dist/components/translations/common-button-en.js +7 -0
  125. package/dist/components/translations/common-button-fr.d.ts +5 -0
  126. package/dist/components/translations/common-button-fr.js +7 -0
  127. package/{es/components/translations/element-search-en.js → dist/components/translations/element-search-en.d.ts} +4 -5
  128. package/dist/components/translations/element-search-en.js +7 -0
  129. package/dist/components/translations/element-search-fr.d.ts +11 -0
  130. package/dist/components/translations/element-search-fr.js +7 -0
  131. package/dist/components/translations/equipment-search-en.d.ts +25 -0
  132. package/dist/components/translations/equipment-search-en.js +21 -0
  133. package/dist/components/translations/equipment-search-fr.d.ts +25 -0
  134. package/dist/components/translations/equipment-search-fr.js +21 -0
  135. package/{es/components/translations/flat-parameters-en.js → dist/components/translations/flat-parameters-en.d.ts} +5 -6
  136. package/dist/components/translations/flat-parameters-en.js +8 -0
  137. package/{es/components/translations/common-button-en.js → dist/components/translations/flat-parameters-fr.d.ts} +5 -5
  138. package/dist/components/translations/flat-parameters-fr.js +8 -0
  139. package/dist/components/translations/login-en.d.ts +18 -0
  140. package/dist/components/translations/login-en.js +14 -0
  141. package/dist/components/translations/login-fr.d.ts +18 -0
  142. package/dist/components/translations/login-fr.js +14 -0
  143. package/{es/components/translations/flat-parameters-fr.js → dist/components/translations/multiple-selection-dialog-en.d.ts} +5 -6
  144. package/dist/components/translations/multiple-selection-dialog-en.js +8 -0
  145. package/{es/components/translations/common-button-fr.js → dist/components/translations/multiple-selection-dialog-fr.d.ts} +5 -5
  146. package/dist/components/translations/multiple-selection-dialog-fr.js +8 -0
  147. package/{es/components/translations/report-viewer-en.js → dist/components/translations/report-viewer-en.d.ts} +5 -6
  148. package/dist/components/translations/report-viewer-en.js +8 -0
  149. package/{es/components/translations/element-search-fr.js → dist/components/translations/report-viewer-fr.d.ts} +5 -5
  150. package/dist/components/translations/report-viewer-fr.js +8 -0
  151. package/{es/components/translations/table-en.js → dist/components/translations/table-en.d.ts} +3 -4
  152. package/dist/components/translations/table-en.js +6 -0
  153. package/{es/components/translations/table-fr.js → dist/components/translations/table-fr.d.ts} +3 -4
  154. package/dist/components/translations/table-fr.js +6 -0
  155. package/dist/components/translations/top-bar-en.d.ts +31 -0
  156. package/dist/components/translations/top-bar-en.js +27 -0
  157. package/dist/components/translations/top-bar-fr.d.ts +31 -0
  158. package/dist/components/translations/top-bar-fr.js +27 -0
  159. package/dist/components/translations/treeview-finder-en.d.ts +16 -0
  160. package/dist/components/translations/treeview-finder-en.js +12 -0
  161. package/dist/components/translations/treeview-finder-fr.d.ts +16 -0
  162. package/dist/components/translations/treeview-finder-fr.js +12 -0
  163. package/dist/hooks/useDebounce.d.ts +1 -0
  164. package/dist/hooks/useDebounce.js +17 -0
  165. package/{es/components/ElementSearchDialog/index.js → dist/hooks/useIntlRef.d.ts} +2 -2
  166. package/dist/hooks/useIntlRef.js +13 -0
  167. package/dist/hooks/useSnackMessage.d.ts +5 -0
  168. package/dist/hooks/useSnackMessage.js +81 -0
  169. package/dist/index.d.ts +234 -0
  170. package/dist/index.js +158 -0
  171. package/dist/utils/AuthService.d.ts +9 -0
  172. package/dist/utils/AuthService.js +336 -0
  173. package/dist/utils/ElementType.d.ts +13 -0
  174. package/dist/utils/ElementType.js +42 -0
  175. package/dist/utils/EquipmentType.d.ts +136 -0
  176. package/dist/utils/EquipmentType.js +132 -0
  177. package/dist/utils/UserManagerMock.d.ts +34 -0
  178. package/dist/utils/UserManagerMock.js +85 -0
  179. package/dist/utils/actions.d.ts +50 -0
  180. package/dist/utils/actions.js +71 -0
  181. package/{es/components/CardErrorBoundary/index.js → dist/utils/algos.d.ts} +1 -1
  182. package/dist/utils/algos.js +24 -0
  183. package/dist/utils/styles.d.ts +5 -0
  184. package/dist/utils/styles.js +13 -0
  185. package/package.json +36 -21
  186. package/es/components/AuthenticationRouter/AuthenticationRouter.js +0 -102
  187. package/es/components/AuthenticationRouter/index.js +0 -7
  188. package/es/components/CardErrorBoundary/card-error-boundary.js +0 -138
  189. package/es/components/ElementSearchDialog/element-search-dialog.js +0 -153
  190. package/es/components/ElementSearchDialog/equipment-item.js +0 -63
  191. package/es/components/ElementSearchDialog/tag-renderer.js +0 -29
  192. package/es/components/FlatParameters/FlatParameters.js +0 -448
  193. package/es/components/FlatParameters/index.js +0 -8
  194. package/es/components/Login/Login.js +0 -79
  195. package/es/components/Login/Logout.js +0 -78
  196. package/es/components/Login/index.js +0 -7
  197. package/es/components/MuiVirtualizedTable/ColumnHeader.js +0 -125
  198. package/es/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +0 -619
  199. package/es/components/MuiVirtualizedTable/MuiVirtualizedTable.js +0 -780
  200. package/es/components/MuiVirtualizedTable/index.js +0 -9
  201. package/es/components/MultipleSelectionDialog/MultipleSelectionDialog.js +0 -95
  202. package/es/components/OverflowableText/index.js +0 -7
  203. package/es/components/OverflowableText/overflowable-text.js +0 -81
  204. package/es/components/ReportViewer/filter-button.js +0 -77
  205. package/es/components/ReportViewer/index.js +0 -7
  206. package/es/components/ReportViewer/log-report-item.js +0 -97
  207. package/es/components/ReportViewer/log-report.js +0 -63
  208. package/es/components/ReportViewer/log-table.js +0 -130
  209. package/es/components/ReportViewer/multi-select-list.js +0 -56
  210. package/es/components/ReportViewer/report-item.js +0 -131
  211. package/es/components/ReportViewer/report-tree-view-context.js +0 -13
  212. package/es/components/ReportViewer/report-viewer.js +0 -167
  213. package/es/components/ReportViewerDialog/index.js +0 -7
  214. package/es/components/ReportViewerDialog/report-viewer-dialog.js +0 -67
  215. package/es/components/SignInCallbackHandler/SignInCallbackHandler.js +0 -19
  216. package/es/components/SignInCallbackHandler/index.js +0 -7
  217. package/es/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +0 -19
  218. package/es/components/SilentRenewCallbackHandler/index.js +0 -7
  219. package/es/components/SnackbarProvider/SnackbarProvider.js +0 -39
  220. package/es/components/SnackbarProvider/index.js +0 -7
  221. package/es/components/TopBar/AboutDialog.js +0 -456
  222. package/es/components/TopBar/GridLogo.js +0 -73
  223. package/es/components/TopBar/TopBar.js +0 -487
  224. package/es/components/TopBar/index.js +0 -9
  225. package/es/components/TreeViewFinder/TreeViewFinder.js +0 -341
  226. package/es/components/TreeViewFinder/index.js +0 -7
  227. package/es/components/images/powsybl_logo.svg +0 -35
  228. package/es/components/react-hook-form/autocomplete-input.js +0 -110
  229. package/es/components/react-hook-form/booleans/boolean-input.js +0 -56
  230. package/es/components/react-hook-form/booleans/checkbox-input.js +0 -28
  231. package/es/components/react-hook-form/booleans/switch-input.js +0 -28
  232. package/es/components/react-hook-form/error-management/error-input.js +0 -50
  233. package/es/components/react-hook-form/error-management/field-error-alert.js +0 -22
  234. package/es/components/react-hook-form/error-management/mid-form-error.js +0 -25
  235. package/es/components/react-hook-form/numbers/float-input.js +0 -105
  236. package/es/components/react-hook-form/numbers/integer-input.js +0 -35
  237. package/es/components/react-hook-form/numbers/utils.js +0 -6
  238. package/es/components/react-hook-form/radio-input.js +0 -55
  239. package/es/components/react-hook-form/select-input.js +0 -40
  240. package/es/components/react-hook-form/slider-input.js +0 -48
  241. package/es/components/react-hook-form/text-input.js +0 -100
  242. package/es/components/react-hook-form/utils/cancel-button.js +0 -28
  243. package/es/components/react-hook-form/utils/field-label.js +0 -15
  244. package/es/components/react-hook-form/utils/functions.js +0 -42
  245. package/es/components/react-hook-form/utils/submit-button.js +0 -29
  246. package/es/components/react-hook-form/utils/text-field-with-adornment.js +0 -92
  247. package/es/components/translations/card-error-boundary-en.js +0 -13
  248. package/es/components/translations/card-error-boundary-fr.js +0 -13
  249. package/es/components/translations/equipment-search-en.js +0 -26
  250. package/es/components/translations/equipment-search-fr.js +0 -26
  251. package/es/components/translations/inputs-en.js +0 -25
  252. package/es/components/translations/inputs-fr.js +0 -25
  253. package/es/components/translations/login-en.js +0 -19
  254. package/es/components/translations/login-fr.js +0 -19
  255. package/es/components/translations/multiple-selection-dialog-en.js +0 -13
  256. package/es/components/translations/multiple-selection-dialog-fr.js +0 -13
  257. package/es/components/translations/top-bar-en.js +0 -32
  258. package/es/components/translations/top-bar-fr.js +0 -32
  259. package/es/components/translations/treeview-finder-en.js +0 -17
  260. package/es/components/translations/treeview-finder-fr.js +0 -17
  261. package/es/hooks/useDebounce.js +0 -26
  262. package/es/hooks/useIntlRef.js +0 -22
  263. package/es/hooks/useSnackMessage.js +0 -81
  264. package/es/index.js +0 -71
  265. package/es/utils/AuthService.js +0 -312
  266. package/es/utils/ElementType.js +0 -53
  267. package/es/utils/EquipmentType.js +0 -133
  268. package/es/utils/UserManagerMock.js +0 -81
  269. package/es/utils/actions.js +0 -65
  270. package/es/utils/algos.js +0 -29
  271. package/es/utils/styles.js +0 -35
@@ -0,0 +1,2 @@
1
+ export { default, generateMuiVirtualizedTableClass } from "./MuiVirtualizedTable";
2
+ export { KeyedColumnsRowIndexer, CHANGE_WAYS } from "./KeyedColumnsRowIndexer";
@@ -0,0 +1,10 @@
1
+ export default MultipleSelectionDialog;
2
+ declare function MultipleSelectionDialog({ options, selectedOptions, open, getOptionLabel, handleClose, handleValidate, titleId, }: {
3
+ options: any;
4
+ selectedOptions: any;
5
+ open: any;
6
+ getOptionLabel: any;
7
+ handleClose: any;
8
+ handleValidate: any;
9
+ titleId: any;
10
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,87 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Dialog, DialogTitle, DialogContent, Grid, FormControlLabel, Checkbox, List, DialogActions, Button } from "@mui/material";
3
+ import { FormattedMessage } from "react-intl";
4
+ import React, { useState } from "react";
5
+ const MultipleSelectionDialog = ({
6
+ options,
7
+ selectedOptions,
8
+ open,
9
+ getOptionLabel,
10
+ handleClose,
11
+ handleValidate,
12
+ titleId
13
+ }) => {
14
+ const [selectedIds, setSelectedIds] = useState(selectedOptions ?? []);
15
+ const handleSelectAll = () => {
16
+ if (selectedIds.length !== options.length) {
17
+ setSelectedIds(options);
18
+ } else {
19
+ setSelectedIds([]);
20
+ }
21
+ };
22
+ const handleOptionSelection = (option) => {
23
+ setSelectedIds((oldValues) => {
24
+ if (oldValues.includes(option)) {
25
+ return oldValues.filter((o) => o !== option);
26
+ }
27
+ return [...oldValues, option];
28
+ });
29
+ };
30
+ return /* @__PURE__ */ jsxs(Dialog, { open, children: [
31
+ /* @__PURE__ */ jsx(DialogTitle, { children: titleId }),
32
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, flexDirection: "column", children: [
33
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
34
+ FormControlLabel,
35
+ {
36
+ label: /* @__PURE__ */ jsx(
37
+ FormattedMessage,
38
+ {
39
+ id: "multiple_selection_dialog/selectAll"
40
+ }
41
+ ),
42
+ control: /* @__PURE__ */ jsx(
43
+ Checkbox,
44
+ {
45
+ checked: selectedIds.length === options.length,
46
+ indeterminate: !!selectedIds.length && selectedIds.length !== options.length,
47
+ onChange: handleSelectAll
48
+ }
49
+ )
50
+ }
51
+ ) }),
52
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(List, { children: options.map((option) => {
53
+ const optionId = (option == null ? void 0 : option.id) ?? option;
54
+ const label = getOptionLabel(option);
55
+ return /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
56
+ FormControlLabel,
57
+ {
58
+ label,
59
+ control: /* @__PURE__ */ jsx(
60
+ Checkbox,
61
+ {
62
+ checked: selectedIds.includes(
63
+ optionId
64
+ ),
65
+ onChange: () => handleOptionSelection(
66
+ optionId
67
+ )
68
+ }
69
+ )
70
+ }
71
+ ) }) }, optionId);
72
+ }) }) })
73
+ ] }) }),
74
+ /* @__PURE__ */ jsxs(DialogActions, { children: [
75
+ /* @__PURE__ */ jsx(Button, { onClick: () => handleClose(), children: /* @__PURE__ */ jsx(FormattedMessage, { id: "multiple_selection_dialog/cancel" }) }),
76
+ /* @__PURE__ */ jsx(Button, { onClick: () => handleValidate(selectedIds), children: /* @__PURE__ */ jsx(
77
+ FormattedMessage,
78
+ {
79
+ id: "multiple_selection_dialog/validate"
80
+ }
81
+ ) })
82
+ ] })
83
+ ] });
84
+ };
85
+ export {
86
+ MultipleSelectionDialog as default
87
+ };
@@ -0,0 +1 @@
1
+ export { default } from "./MultipleSelectionDialog";
@@ -0,0 +1 @@
1
+ export { default } from "./overflowable-text";
@@ -0,0 +1,2 @@
1
+ export const OverflowableText: import("@emotion/styled").StyledComponent<any, {}, {}>;
2
+ export default OverflowableText;
@@ -0,0 +1,87 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useRef, useState, useCallback, useLayoutEffect } from "react";
3
+ import { Tooltip, Box } from "@mui/material";
4
+ import PropTypes from "prop-types";
5
+ import { styled } from "@mui/system";
6
+ const overflowStyle = {
7
+ overflow: {
8
+ display: "inline-block",
9
+ whiteSpace: "pre",
10
+ textOverflow: "ellipsis",
11
+ overflow: "hidden"
12
+ },
13
+ tooltip: {
14
+ whiteSpace: "pre",
15
+ width: "fit-content",
16
+ maxWidth: "fit-content"
17
+ }
18
+ };
19
+ const OverflowableText = styled(
20
+ ({ text, tooltipStyle, tooltipSx, className, children, ...props }) => {
21
+ var _a, _b;
22
+ const element = useRef();
23
+ const [overflowed, setOverflowed] = useState(false);
24
+ const checkOverflow = useCallback(() => {
25
+ if (!element.current) {
26
+ return;
27
+ }
28
+ setOverflowed(
29
+ element.current.scrollWidth > element.current.clientWidth
30
+ );
31
+ }, [setOverflowed, element]);
32
+ useLayoutEffect(() => {
33
+ checkOverflow();
34
+ }, [
35
+ checkOverflow,
36
+ text,
37
+ (_a = element.current) == null ? void 0 : _a.scrollWidth,
38
+ (_b = element.current) == null ? void 0 : _b.clientWidth
39
+ ]);
40
+ const defaultTooltipSx = !tooltipStyle ? overflowStyle.tooltip : false;
41
+ const finalTooltipSx = tooltipSx || defaultTooltipSx;
42
+ const tooltipStyleProps = {
43
+ ...tooltipStyle && { classes: { tooltip: tooltipStyle } },
44
+ ...finalTooltipSx && {
45
+ slotProps: { tooltip: { sx: finalTooltipSx } }
46
+ }
47
+ };
48
+ return /* @__PURE__ */ jsx(
49
+ Tooltip,
50
+ {
51
+ title: text || "",
52
+ disableHoverListener: !overflowed,
53
+ ...tooltipStyleProps,
54
+ children: /* @__PURE__ */ jsx(
55
+ Box,
56
+ {
57
+ ...props,
58
+ ref: element,
59
+ children: children || text,
60
+ className,
61
+ sx: overflowStyle.overflow
62
+ }
63
+ )
64
+ }
65
+ );
66
+ }
67
+ )({});
68
+ OverflowableText.propTypes = {
69
+ children: PropTypes.array,
70
+ text: PropTypes.oneOfType([
71
+ PropTypes.string,
72
+ PropTypes.number,
73
+ PropTypes.node
74
+ ]),
75
+ tooltipStyle: PropTypes.string,
76
+ tooltipSx: PropTypes.object,
77
+ sx: PropTypes.oneOfType([
78
+ PropTypes.object,
79
+ PropTypes.array,
80
+ PropTypes.func
81
+ ]),
82
+ className: PropTypes.string
83
+ };
84
+ export {
85
+ OverflowableText,
86
+ OverflowableText as default
87
+ };
@@ -0,0 +1 @@
1
+ export function FilterButton({ selectedItems, setSelectedItems }: Object): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,64 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState, useMemo } from "react";
3
+ import { Box, IconButton } from "@mui/material";
4
+ import { Menu } from "@mui/icons-material";
5
+ import { MultiSelectList } from "./multi-select-list.js";
6
+ const styles = {
7
+ notificationDot: {
8
+ height: "6px",
9
+ width: "6px",
10
+ backgroundColor: "#cc70a0",
11
+ borderRadius: "50%",
12
+ position: "absolute",
13
+ top: "5px",
14
+ left: "23px"
15
+ },
16
+ container: {
17
+ position: "relative"
18
+ },
19
+ icon: {
20
+ width: "0.7em",
21
+ height: "0.7em"
22
+ }
23
+ };
24
+ const FilterButton = ({ selectedItems, setSelectedItems }) => {
25
+ const [initialState] = useState(selectedItems);
26
+ const [anchorEl, setAnchorEl] = useState();
27
+ const handleClick = (event) => {
28
+ setAnchorEl(event.currentTarget);
29
+ };
30
+ const handleClose = () => {
31
+ setAnchorEl(null);
32
+ };
33
+ const handleChange = (event) => {
34
+ setSelectedItems((previousSelection) => {
35
+ return {
36
+ ...previousSelection,
37
+ [event.target.name]: !selectedItems[event.target.name]
38
+ };
39
+ });
40
+ };
41
+ const isInitialStateModified = useMemo(() => {
42
+ return Object.keys(selectedItems).some(
43
+ (key) => initialState[key] !== selectedItems[key]
44
+ );
45
+ }, [initialState, selectedItems]);
46
+ return /* @__PURE__ */ jsxs(Box, { sx: styles.container, children: [
47
+ /* @__PURE__ */ jsxs(IconButton, { onClick: handleClick, children: [
48
+ /* @__PURE__ */ jsx(Menu, { sx: styles.icon }),
49
+ isInitialStateModified && /* @__PURE__ */ jsx(Box, { sx: styles.notificationDot })
50
+ ] }),
51
+ /* @__PURE__ */ jsx(
52
+ MultiSelectList,
53
+ {
54
+ selectedItems,
55
+ handleChange,
56
+ handleClose,
57
+ anchor: anchorEl
58
+ }
59
+ )
60
+ ] });
61
+ };
62
+ export {
63
+ FilterButton
64
+ };
@@ -0,0 +1 @@
1
+ export { default } from "./report-viewer";
@@ -0,0 +1,68 @@
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
+ */
7
+ export default class LogReportItem {
8
+ static SEVERITY: {
9
+ UNKNOWN: {
10
+ name: string;
11
+ level: number;
12
+ colorName: string;
13
+ colorHexCode: string;
14
+ };
15
+ INFO: {
16
+ name: string;
17
+ level: number;
18
+ colorName: string;
19
+ colorHexCode: string;
20
+ };
21
+ WARN: {
22
+ name: string;
23
+ level: number;
24
+ colorName: string;
25
+ colorHexCode: string;
26
+ };
27
+ ERROR: {
28
+ name: string;
29
+ level: number;
30
+ colorName: string;
31
+ colorHexCode: string;
32
+ };
33
+ FATAL: {
34
+ name: string;
35
+ level: number;
36
+ colorName: string;
37
+ colorHexCode: string;
38
+ };
39
+ };
40
+ static resolveTemplateMessage(templateMessage: any, templateValues: any): any;
41
+ constructor(jsonReport: any, reportId: any);
42
+ key: any;
43
+ log: any;
44
+ reportId: any;
45
+ severity: {
46
+ name: string;
47
+ level: number;
48
+ colorName: string;
49
+ colorHexCode: string;
50
+ };
51
+ getLog(): any;
52
+ getReportId(): any;
53
+ getSeverity(): {
54
+ name: string;
55
+ level: number;
56
+ colorName: string;
57
+ colorHexCode: string;
58
+ };
59
+ getSeverityName(): string;
60
+ getColorName(): string;
61
+ getColorHexCode(): string;
62
+ initSeverity(jsonSeverity: any): {
63
+ name: string;
64
+ level: number;
65
+ colorName: string;
66
+ colorHexCode: string;
67
+ };
68
+ }
@@ -0,0 +1,95 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ const _LogReportItem = class _LogReportItem {
8
+ static resolveTemplateMessage(templateMessage, templateValues) {
9
+ const templateVars = {};
10
+ for (const [key, value] of Object.entries(templateValues)) {
11
+ templateVars[key] = value.value;
12
+ }
13
+ return templateMessage.replace(/\${([^{}]*)}/g, function(a, b) {
14
+ let r = templateVars[b];
15
+ return typeof r === "string" || typeof r === "number" ? r : a;
16
+ });
17
+ }
18
+ constructor(jsonReport, reportId) {
19
+ this.key = jsonReport.reportKey;
20
+ this.log = _LogReportItem.resolveTemplateMessage(
21
+ jsonReport.defaultMessage,
22
+ jsonReport.values
23
+ );
24
+ this.reportId = reportId;
25
+ this.severity = this.initSeverity(jsonReport.values.reportSeverity);
26
+ }
27
+ getLog() {
28
+ return this.log;
29
+ }
30
+ getReportId() {
31
+ return this.reportId;
32
+ }
33
+ getSeverity() {
34
+ return this.severity;
35
+ }
36
+ getSeverityName() {
37
+ return this.severity.name;
38
+ }
39
+ getColorName() {
40
+ return this.severity.colorName;
41
+ }
42
+ getColorHexCode() {
43
+ return this.severity.colorHexCode;
44
+ }
45
+ initSeverity(jsonSeverity) {
46
+ let severity = _LogReportItem.SEVERITY.UNKNOWN;
47
+ if (!jsonSeverity) {
48
+ return severity;
49
+ }
50
+ Object.values(_LogReportItem.SEVERITY).some((value) => {
51
+ let severityFound = jsonSeverity.value.includes(value.name);
52
+ if (severityFound) {
53
+ severity = value;
54
+ }
55
+ return severityFound;
56
+ });
57
+ return severity;
58
+ }
59
+ };
60
+ __publicField(_LogReportItem, "SEVERITY", {
61
+ UNKNOWN: {
62
+ name: "UNKNOWN",
63
+ level: 0,
64
+ colorName: "cornflowerblue",
65
+ colorHexCode: "#6495ED"
66
+ },
67
+ INFO: {
68
+ name: "INFO",
69
+ level: 1,
70
+ colorName: "mediumseagreen",
71
+ colorHexCode: "#3CB371"
72
+ },
73
+ WARN: {
74
+ name: "WARN",
75
+ level: 2,
76
+ colorName: "orange",
77
+ colorHexCode: "#FFA500"
78
+ },
79
+ ERROR: {
80
+ name: "ERROR",
81
+ level: 3,
82
+ colorName: "crimson",
83
+ colorHexCode: "#DC143C"
84
+ },
85
+ FATAL: {
86
+ name: "FATAL",
87
+ level: 4,
88
+ colorName: "mediumorchid",
89
+ colorHexCode: "#BA55D3"
90
+ }
91
+ });
92
+ let LogReportItem = _LogReportItem;
93
+ export {
94
+ LogReportItem as default
95
+ };
@@ -0,0 +1,21 @@
1
+ export default class LogReport {
2
+ constructor(jsonReporter: any, parentReportId: any);
3
+ id: any;
4
+ key: any;
5
+ title: any;
6
+ subReports: any[];
7
+ logs: any[];
8
+ parentReportId: any;
9
+ getId(): any;
10
+ getTitle(): any;
11
+ getSubReports(): any[];
12
+ getLogs(): any[];
13
+ getAllLogs(): any[];
14
+ init(jsonReporter: any): void;
15
+ getHighestSeverity(currentSeverity?: {
16
+ name: string;
17
+ level: number;
18
+ colorName: string;
19
+ colorHexCode: string;
20
+ }): any;
21
+ }
@@ -0,0 +1,49 @@
1
+ import LogReportItem from "./log-report-item.js";
2
+ import { v4 } from "uuid";
3
+ class LogReport {
4
+ constructor(jsonReporter, parentReportId) {
5
+ this.id = v4();
6
+ this.key = jsonReporter.taskKey;
7
+ this.title = LogReportItem.resolveTemplateMessage(
8
+ jsonReporter.defaultName,
9
+ jsonReporter.taskValues
10
+ );
11
+ this.subReports = [];
12
+ this.logs = [];
13
+ this.parentReportId = parentReportId;
14
+ this.init(jsonReporter);
15
+ }
16
+ getId() {
17
+ return this.id;
18
+ }
19
+ getTitle() {
20
+ return this.title;
21
+ }
22
+ getSubReports() {
23
+ return this.subReports;
24
+ }
25
+ getLogs() {
26
+ return this.logs;
27
+ }
28
+ getAllLogs() {
29
+ return this.getLogs().concat(
30
+ this.getSubReports().flatMap((r) => r.getAllLogs())
31
+ );
32
+ }
33
+ init(jsonReporter) {
34
+ jsonReporter.subReporters.map(
35
+ (value) => this.subReports.push(new LogReport(value, this.id))
36
+ );
37
+ jsonReporter.reports.map(
38
+ (value) => this.logs.push(new LogReportItem(value, this.id))
39
+ );
40
+ }
41
+ getHighestSeverity(currentSeverity = LogReportItem.SEVERITY.UNKNOWN) {
42
+ let reduceFct = (p, c) => p.level < c.level ? c : p;
43
+ let highestSeverity = this.getLogs().map((r) => r.getSeverity()).reduce(reduceFct, currentSeverity);
44
+ return this.getSubReports().map((r) => r.getHighestSeverity(highestSeverity)).reduce(reduceFct, highestSeverity);
45
+ }
46
+ }
47
+ export {
48
+ LogReport as default
49
+ };
@@ -0,0 +1,8 @@
1
+ declare const _default: React.MemoExoticComponent<({ logs, onRowClick, selectedSeverity, setSelectedSeverity, }: {
2
+ logs: any;
3
+ onRowClick: any;
4
+ selectedSeverity: any;
5
+ setSelectedSeverity: any;
6
+ }) => import("react/jsx-runtime").JSX.Element>;
7
+ export default _default;
8
+ import React from 'react';
@@ -0,0 +1,131 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { memo, useState, useEffect, useCallback } from "react";
3
+ import { useIntl } from "react-intl";
4
+ import { useTheme, TableCell } from "@mui/material";
5
+ import { styled } from "@mui/system";
6
+ import MuiVirtualizedTable from "../MuiVirtualizedTable/MuiVirtualizedTable.js";
7
+ import { FilterButton } from "./filter-button.js";
8
+ const SEVERITY_COLUMN_FIXED_WIDTH = 115;
9
+ const styles = {
10
+ flexContainer: {
11
+ display: "flex",
12
+ alignItems: "center",
13
+ boxSizing: "border-box"
14
+ },
15
+ table: (theme) => ({
16
+ // temporary right-to-left patch, waiting for
17
+ // https://github.com/bvaughn/react-virtualized/issues/454
18
+ "& .ReactVirtualized__Table__headerRow": {
19
+ flip: false,
20
+ paddingRight: theme.direction === "rtl" ? "0 !important" : void 0
21
+ }
22
+ }),
23
+ header: { variant: "header" }
24
+ };
25
+ const VirtualizedTable = styled(MuiVirtualizedTable)(styles);
26
+ const LogTable = ({
27
+ logs,
28
+ onRowClick,
29
+ selectedSeverity,
30
+ setSelectedSeverity
31
+ }) => {
32
+ const intl = useIntl();
33
+ const theme = useTheme();
34
+ const [selectedRowIndex, setSelectedRowIndex] = useState(-1);
35
+ const severityCellRender = (cellData) => {
36
+ return /* @__PURE__ */ jsx(
37
+ TableCell,
38
+ {
39
+ component: "div",
40
+ variant: "body",
41
+ style: {
42
+ display: "flex",
43
+ flex: "1",
44
+ backgroundColor: cellData.rowData.backgroundColor
45
+ },
46
+ align: "center",
47
+ children: cellData.rowData.severity
48
+ }
49
+ );
50
+ };
51
+ const COLUMNS_DEFINITIONS = [
52
+ {
53
+ label: intl.formatMessage({ id: "report_viewer/severity" }).toUpperCase(),
54
+ id: "severity",
55
+ dataKey: "severity",
56
+ maxWidth: SEVERITY_COLUMN_FIXED_WIDTH,
57
+ minWidth: SEVERITY_COLUMN_FIXED_WIDTH,
58
+ cellRenderer: severityCellRender,
59
+ extra: /* @__PURE__ */ jsx(
60
+ FilterButton,
61
+ {
62
+ selectedItems: selectedSeverity,
63
+ setSelectedItems: setSelectedSeverity
64
+ }
65
+ )
66
+ },
67
+ {
68
+ label: intl.formatMessage({ id: "report_viewer/message" }).toUpperCase(),
69
+ id: "message",
70
+ dataKey: "message"
71
+ }
72
+ ];
73
+ const generateTableColumns = () => {
74
+ return Object.values(COLUMNS_DEFINITIONS).map((c) => {
75
+ return c;
76
+ });
77
+ };
78
+ const generateTableRows = () => {
79
+ return logs.map((log) => {
80
+ return {
81
+ severity: log.getSeverityName(),
82
+ message: log.getLog(),
83
+ backgroundColor: log.getColorName(),
84
+ reportId: log.getReportId()
85
+ };
86
+ });
87
+ };
88
+ const handleRowClick = (event) => {
89
+ setSelectedRowIndex(event.index);
90
+ onRowClick(event.rowData);
91
+ };
92
+ const rowStyleFormat = (row) => {
93
+ if (row.index < 0) {
94
+ return;
95
+ }
96
+ if (selectedRowIndex === row.index) {
97
+ return {
98
+ backgroundColor: theme.palette.action.selected
99
+ };
100
+ }
101
+ };
102
+ useEffect(() => {
103
+ setSelectedRowIndex(-1);
104
+ }, [logs]);
105
+ const filter = useCallback(
106
+ (row) => {
107
+ return row.severity && Object.entries(selectedSeverity).some(
108
+ ([key, value]) => key === row.severity && value
109
+ );
110
+ },
111
+ [selectedSeverity]
112
+ );
113
+ return (
114
+ //TODO do we need to useMemo/useCallback these props to avoid rerenders ?
115
+ /* @__PURE__ */ jsx(
116
+ VirtualizedTable,
117
+ {
118
+ columns: generateTableColumns(),
119
+ rows: generateTableRows(),
120
+ sortable: false,
121
+ onRowClick: handleRowClick,
122
+ rowStyle: rowStyleFormat,
123
+ filter
124
+ }
125
+ )
126
+ );
127
+ };
128
+ const LogTable$1 = memo(LogTable);
129
+ export {
130
+ LogTable$1 as default
131
+ };
@@ -0,0 +1 @@
1
+ export function MultiSelectList({ selectedItems, handleChange, handleClose, anchor, }: Object): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,40 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Menu, MenuItem, FormControlLabel, Checkbox } from "@mui/material";
4
+ const styles = {
5
+ label: {
6
+ width: "100%",
7
+ margin: 0
8
+ },
9
+ menuItem: {
10
+ padding: "0 10px 0 0"
11
+ }
12
+ };
13
+ const MultiSelectList = ({
14
+ selectedItems,
15
+ handleChange,
16
+ handleClose,
17
+ anchor
18
+ }) => {
19
+ const open = Boolean(anchor);
20
+ return /* @__PURE__ */ jsx(Menu, { open, onClose: handleClose, anchorEl: anchor, children: Object.entries(selectedItems).map(([key, value]) => {
21
+ return /* @__PURE__ */ jsx(MenuItem, { sx: styles.menuItem, children: /* @__PURE__ */ jsx(
22
+ FormControlLabel,
23
+ {
24
+ control: /* @__PURE__ */ jsx(
25
+ Checkbox,
26
+ {
27
+ checked: value,
28
+ onChange: handleChange,
29
+ name: key
30
+ }
31
+ ),
32
+ label: key,
33
+ sx: styles.label
34
+ }
35
+ ) }, key);
36
+ }) });
37
+ };
38
+ export {
39
+ MultiSelectList
40
+ };