@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.
- package/README.md +0 -17
- package/dist/components/AuthenticationRouter/AuthenticationRouter.d.ts +10 -0
- package/dist/components/AuthenticationRouter/AuthenticationRouter.js +147 -0
- package/dist/components/AuthenticationRouter/index.d.ts +1 -0
- package/dist/components/CardErrorBoundary/card-error-boundary.d.ts +18 -0
- package/dist/components/CardErrorBoundary/card-error-boundary.js +110 -0
- package/dist/components/CardErrorBoundary/index.d.ts +1 -0
- package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +22 -0
- package/dist/components/DirectoryItemSelector/directory-item-selector.js +254 -0
- package/dist/components/ElementSearchDialog/element-search-dialog.d.ts +16 -0
- package/dist/components/ElementSearchDialog/element-search-dialog.js +139 -0
- package/dist/components/ElementSearchDialog/equipment-item.d.ts +16 -0
- package/dist/components/ElementSearchDialog/equipment-item.js +77 -0
- package/dist/components/ElementSearchDialog/index.d.ts +2 -0
- package/dist/components/ElementSearchDialog/tag-renderer.d.ts +11 -0
- package/dist/components/ElementSearchDialog/tag-renderer.js +34 -0
- package/dist/components/FlatParameters/FlatParameters.d.ts +10 -0
- package/dist/components/FlatParameters/FlatParameters.js +411 -0
- package/dist/components/FlatParameters/index.d.ts +1 -0
- package/dist/components/Login/Login.d.ts +5 -0
- package/dist/components/Login/Login.js +78 -0
- package/dist/components/Login/Logout.d.ts +5 -0
- package/dist/components/Login/Logout.js +69 -0
- package/dist/components/Login/index.d.ts +1 -0
- package/dist/components/MuiVirtualizedTable/ColumnHeader.d.ts +4 -0
- package/dist/components/MuiVirtualizedTable/ColumnHeader.js +127 -0
- package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.d.ts +104 -0
- package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +548 -0
- package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +131 -0
- package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +790 -0
- package/dist/components/MuiVirtualizedTable/index.d.ts +2 -0
- package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.d.ts +10 -0
- package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +87 -0
- package/dist/components/MultipleSelectionDialog/index.d.ts +1 -0
- package/dist/components/OverflowableText/index.d.ts +1 -0
- package/dist/components/OverflowableText/overflowable-text.d.ts +2 -0
- package/dist/components/OverflowableText/overflowable-text.js +87 -0
- package/dist/components/ReportViewer/filter-button.d.ts +1 -0
- package/dist/components/ReportViewer/filter-button.js +64 -0
- package/dist/components/ReportViewer/index.d.ts +1 -0
- package/dist/components/ReportViewer/log-report-item.d.ts +68 -0
- package/dist/components/ReportViewer/log-report-item.js +95 -0
- package/dist/components/ReportViewer/log-report.d.ts +21 -0
- package/dist/components/ReportViewer/log-report.js +49 -0
- package/dist/components/ReportViewer/log-table.d.ts +8 -0
- package/dist/components/ReportViewer/log-table.js +131 -0
- package/dist/components/ReportViewer/multi-select-list.d.ts +1 -0
- package/dist/components/ReportViewer/multi-select-list.js +40 -0
- package/dist/components/ReportViewer/report-item.d.ts +13 -0
- package/dist/components/ReportViewer/report-item.js +112 -0
- package/dist/components/ReportViewer/report-tree-view-context.d.ts +2 -0
- package/dist/components/ReportViewer/report-tree-view-context.js +8 -0
- package/dist/components/ReportViewer/report-viewer.d.ts +4 -0
- package/dist/components/ReportViewer/report-viewer.js +158 -0
- package/dist/components/ReportViewerDialog/index.d.ts +1 -0
- package/dist/components/ReportViewerDialog/report-viewer-dialog.d.ts +1 -0
- package/dist/components/ReportViewerDialog/report-viewer-dialog.js +61 -0
- package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +5 -0
- package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +13 -0
- package/dist/components/SignInCallbackHandler/index.d.ts +1 -0
- package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +5 -0
- package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +16 -0
- package/dist/components/SilentRenewCallbackHandler/index.d.ts +1 -0
- package/dist/components/SnackbarProvider/SnackbarProvider.d.ts +3 -0
- package/dist/components/SnackbarProvider/SnackbarProvider.js +28 -0
- package/dist/components/SnackbarProvider/index.d.ts +1 -0
- package/dist/components/TopBar/AboutDialog.d.ts +24 -0
- package/dist/components/TopBar/AboutDialog.js +467 -0
- package/dist/components/TopBar/GridLogo.d.ts +34 -0
- package/dist/components/TopBar/GridLogo.js +71 -0
- package/dist/components/TopBar/TopBar.d.ts +53 -0
- package/dist/components/TopBar/TopBar.js +679 -0
- package/dist/components/TopBar/index.d.ts +3 -0
- package/dist/components/TreeViewFinder/TreeViewFinder.d.ts +57 -0
- package/dist/components/TreeViewFinder/TreeViewFinder.js +288 -0
- package/dist/components/TreeViewFinder/index.d.ts +1 -0
- package/dist/components/react-hook-form/autocomplete-input.d.ts +30 -0
- package/dist/components/react-hook-form/autocomplete-input.js +96 -0
- package/dist/components/react-hook-form/booleans/boolean-input.d.ts +16 -0
- package/dist/components/react-hook-form/booleans/boolean-input.js +49 -0
- package/dist/components/react-hook-form/booleans/checkbox-input.d.ts +14 -0
- package/dist/components/react-hook-form/booleans/checkbox-input.js +24 -0
- package/dist/components/react-hook-form/booleans/switch-input.d.ts +14 -0
- package/dist/components/react-hook-form/booleans/switch-input.js +24 -0
- package/dist/components/react-hook-form/directory-items-input.d.ts +28 -0
- package/dist/components/react-hook-form/directory-items-input.js +185 -0
- package/dist/components/react-hook-form/error-management/error-input.d.ts +5 -0
- package/dist/components/react-hook-form/error-management/error-input.js +42 -0
- package/dist/components/react-hook-form/error-management/field-error-alert.d.ts +4 -0
- package/dist/components/react-hook-form/error-management/field-error-alert.js +9 -0
- package/dist/components/react-hook-form/error-management/mid-form-error.d.ts +4 -0
- package/dist/components/react-hook-form/error-management/mid-form-error.js +20 -0
- package/dist/components/react-hook-form/numbers/float-input.d.ts +18 -0
- package/dist/components/react-hook-form/numbers/float-input.js +51 -0
- package/dist/components/react-hook-form/numbers/integer-input.d.ts +18 -0
- package/dist/components/react-hook-form/numbers/integer-input.js +36 -0
- package/dist/components/react-hook-form/numbers/utils.d.ts +2 -0
- package/dist/components/react-hook-form/numbers/utils.js +10 -0
- package/dist/components/react-hook-form/radio-input.d.ts +18 -0
- package/dist/components/react-hook-form/radio-input.js +44 -0
- package/{es/components/MultipleSelectionDialog/index.js → dist/components/react-hook-form/raw-read-only-input.d.ts} +3 -2
- package/dist/components/react-hook-form/raw-read-only-input.js +10 -0
- package/dist/components/react-hook-form/select-input.d.ts +17 -0
- package/dist/components/react-hook-form/select-input.js +31 -0
- package/dist/components/react-hook-form/slider-input.d.ts +21 -0
- package/dist/components/react-hook-form/slider-input.js +43 -0
- package/dist/components/react-hook-form/text-input.d.ts +33 -0
- package/dist/components/react-hook-form/text-input.js +94 -0
- package/dist/components/react-hook-form/utils/cancel-button.d.ts +10 -0
- package/dist/components/react-hook-form/utils/cancel-button.js +16 -0
- package/dist/components/react-hook-form/utils/field-label.d.ts +6 -0
- package/dist/components/react-hook-form/utils/field-label.js +12 -0
- package/dist/components/react-hook-form/utils/functions.d.ts +11 -0
- package/dist/components/react-hook-form/utils/functions.js +41 -0
- package/dist/components/react-hook-form/utils/submit-button.d.ts +10 -0
- package/dist/components/react-hook-form/utils/submit-button.js +23 -0
- package/dist/components/react-hook-form/utils/text-field-with-adornment.d.ts +12 -0
- package/dist/components/react-hook-form/utils/text-field-with-adornment.js +96 -0
- package/{es/components/translations/report-viewer-fr.js → dist/components/translations/card-error-boundary-en.d.ts} +5 -6
- package/dist/components/translations/card-error-boundary-en.js +8 -0
- package/dist/components/translations/card-error-boundary-fr.d.ts +12 -0
- package/dist/components/translations/card-error-boundary-fr.js +8 -0
- package/dist/components/translations/common-button-en.d.ts +5 -0
- package/dist/components/translations/common-button-en.js +7 -0
- package/dist/components/translations/common-button-fr.d.ts +5 -0
- package/dist/components/translations/common-button-fr.js +7 -0
- package/{es/components/translations/element-search-en.js → dist/components/translations/element-search-en.d.ts} +4 -5
- package/dist/components/translations/element-search-en.js +7 -0
- package/dist/components/translations/element-search-fr.d.ts +11 -0
- package/dist/components/translations/element-search-fr.js +7 -0
- package/dist/components/translations/equipment-search-en.d.ts +25 -0
- package/dist/components/translations/equipment-search-en.js +21 -0
- package/dist/components/translations/equipment-search-fr.d.ts +25 -0
- package/dist/components/translations/equipment-search-fr.js +21 -0
- package/{es/components/translations/flat-parameters-en.js → dist/components/translations/flat-parameters-en.d.ts} +5 -6
- package/dist/components/translations/flat-parameters-en.js +8 -0
- package/{es/components/translations/common-button-en.js → dist/components/translations/flat-parameters-fr.d.ts} +5 -5
- package/dist/components/translations/flat-parameters-fr.js +8 -0
- package/dist/components/translations/login-en.d.ts +18 -0
- package/dist/components/translations/login-en.js +14 -0
- package/dist/components/translations/login-fr.d.ts +18 -0
- package/dist/components/translations/login-fr.js +14 -0
- package/{es/components/translations/flat-parameters-fr.js → dist/components/translations/multiple-selection-dialog-en.d.ts} +5 -6
- package/dist/components/translations/multiple-selection-dialog-en.js +8 -0
- package/{es/components/translations/common-button-fr.js → dist/components/translations/multiple-selection-dialog-fr.d.ts} +5 -5
- package/dist/components/translations/multiple-selection-dialog-fr.js +8 -0
- package/{es/components/translations/report-viewer-en.js → dist/components/translations/report-viewer-en.d.ts} +5 -6
- package/dist/components/translations/report-viewer-en.js +8 -0
- package/{es/components/translations/element-search-fr.js → dist/components/translations/report-viewer-fr.d.ts} +5 -5
- package/dist/components/translations/report-viewer-fr.js +8 -0
- package/{es/components/translations/table-en.js → dist/components/translations/table-en.d.ts} +3 -4
- package/dist/components/translations/table-en.js +6 -0
- package/{es/components/translations/table-fr.js → dist/components/translations/table-fr.d.ts} +3 -4
- package/dist/components/translations/table-fr.js +6 -0
- package/dist/components/translations/top-bar-en.d.ts +31 -0
- package/dist/components/translations/top-bar-en.js +27 -0
- package/dist/components/translations/top-bar-fr.d.ts +31 -0
- package/dist/components/translations/top-bar-fr.js +27 -0
- package/dist/components/translations/treeview-finder-en.d.ts +16 -0
- package/dist/components/translations/treeview-finder-en.js +12 -0
- package/dist/components/translations/treeview-finder-fr.d.ts +16 -0
- package/dist/components/translations/treeview-finder-fr.js +12 -0
- package/dist/hooks/useDebounce.d.ts +1 -0
- package/dist/hooks/useDebounce.js +17 -0
- package/{es/components/ElementSearchDialog/index.js → dist/hooks/useIntlRef.d.ts} +2 -2
- package/dist/hooks/useIntlRef.js +13 -0
- package/dist/hooks/useSnackMessage.d.ts +5 -0
- package/dist/hooks/useSnackMessage.js +81 -0
- package/dist/index.d.ts +234 -0
- package/dist/index.js +158 -0
- package/dist/utils/AuthService.d.ts +9 -0
- package/dist/utils/AuthService.js +336 -0
- package/dist/utils/ElementType.d.ts +13 -0
- package/dist/utils/ElementType.js +42 -0
- package/dist/utils/EquipmentType.d.ts +136 -0
- package/dist/utils/EquipmentType.js +132 -0
- package/dist/utils/UserManagerMock.d.ts +34 -0
- package/dist/utils/UserManagerMock.js +85 -0
- package/dist/utils/actions.d.ts +50 -0
- package/dist/utils/actions.js +71 -0
- package/{es/components/CardErrorBoundary/index.js → dist/utils/algos.d.ts} +1 -1
- package/dist/utils/algos.js +24 -0
- package/dist/utils/styles.d.ts +5 -0
- package/dist/utils/styles.js +13 -0
- package/package.json +36 -21
- package/es/components/AuthenticationRouter/AuthenticationRouter.js +0 -102
- package/es/components/AuthenticationRouter/index.js +0 -7
- package/es/components/CardErrorBoundary/card-error-boundary.js +0 -138
- package/es/components/ElementSearchDialog/element-search-dialog.js +0 -153
- package/es/components/ElementSearchDialog/equipment-item.js +0 -63
- package/es/components/ElementSearchDialog/tag-renderer.js +0 -29
- package/es/components/FlatParameters/FlatParameters.js +0 -448
- package/es/components/FlatParameters/index.js +0 -8
- package/es/components/Login/Login.js +0 -79
- package/es/components/Login/Logout.js +0 -78
- package/es/components/Login/index.js +0 -7
- package/es/components/MuiVirtualizedTable/ColumnHeader.js +0 -125
- package/es/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +0 -619
- package/es/components/MuiVirtualizedTable/MuiVirtualizedTable.js +0 -780
- package/es/components/MuiVirtualizedTable/index.js +0 -9
- package/es/components/MultipleSelectionDialog/MultipleSelectionDialog.js +0 -95
- package/es/components/OverflowableText/index.js +0 -7
- package/es/components/OverflowableText/overflowable-text.js +0 -81
- package/es/components/ReportViewer/filter-button.js +0 -77
- package/es/components/ReportViewer/index.js +0 -7
- package/es/components/ReportViewer/log-report-item.js +0 -97
- package/es/components/ReportViewer/log-report.js +0 -63
- package/es/components/ReportViewer/log-table.js +0 -130
- package/es/components/ReportViewer/multi-select-list.js +0 -56
- package/es/components/ReportViewer/report-item.js +0 -131
- package/es/components/ReportViewer/report-tree-view-context.js +0 -13
- package/es/components/ReportViewer/report-viewer.js +0 -167
- package/es/components/ReportViewerDialog/index.js +0 -7
- package/es/components/ReportViewerDialog/report-viewer-dialog.js +0 -67
- package/es/components/SignInCallbackHandler/SignInCallbackHandler.js +0 -19
- package/es/components/SignInCallbackHandler/index.js +0 -7
- package/es/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +0 -19
- package/es/components/SilentRenewCallbackHandler/index.js +0 -7
- package/es/components/SnackbarProvider/SnackbarProvider.js +0 -39
- package/es/components/SnackbarProvider/index.js +0 -7
- package/es/components/TopBar/AboutDialog.js +0 -456
- package/es/components/TopBar/GridLogo.js +0 -73
- package/es/components/TopBar/TopBar.js +0 -487
- package/es/components/TopBar/index.js +0 -9
- package/es/components/TreeViewFinder/TreeViewFinder.js +0 -341
- package/es/components/TreeViewFinder/index.js +0 -7
- package/es/components/images/powsybl_logo.svg +0 -35
- package/es/components/react-hook-form/autocomplete-input.js +0 -110
- package/es/components/react-hook-form/booleans/boolean-input.js +0 -56
- package/es/components/react-hook-form/booleans/checkbox-input.js +0 -28
- package/es/components/react-hook-form/booleans/switch-input.js +0 -28
- package/es/components/react-hook-form/error-management/error-input.js +0 -50
- package/es/components/react-hook-form/error-management/field-error-alert.js +0 -22
- package/es/components/react-hook-form/error-management/mid-form-error.js +0 -25
- package/es/components/react-hook-form/numbers/float-input.js +0 -105
- package/es/components/react-hook-form/numbers/integer-input.js +0 -35
- package/es/components/react-hook-form/numbers/utils.js +0 -6
- package/es/components/react-hook-form/radio-input.js +0 -55
- package/es/components/react-hook-form/select-input.js +0 -40
- package/es/components/react-hook-form/slider-input.js +0 -48
- package/es/components/react-hook-form/text-input.js +0 -100
- package/es/components/react-hook-form/utils/cancel-button.js +0 -28
- package/es/components/react-hook-form/utils/field-label.js +0 -15
- package/es/components/react-hook-form/utils/functions.js +0 -42
- package/es/components/react-hook-form/utils/submit-button.js +0 -29
- package/es/components/react-hook-form/utils/text-field-with-adornment.js +0 -92
- package/es/components/translations/card-error-boundary-en.js +0 -13
- package/es/components/translations/card-error-boundary-fr.js +0 -13
- package/es/components/translations/equipment-search-en.js +0 -26
- package/es/components/translations/equipment-search-fr.js +0 -26
- package/es/components/translations/inputs-en.js +0 -25
- package/es/components/translations/inputs-fr.js +0 -25
- package/es/components/translations/login-en.js +0 -19
- package/es/components/translations/login-fr.js +0 -19
- package/es/components/translations/multiple-selection-dialog-en.js +0 -13
- package/es/components/translations/multiple-selection-dialog-fr.js +0 -13
- package/es/components/translations/top-bar-en.js +0 -32
- package/es/components/translations/top-bar-fr.js +0 -32
- package/es/components/translations/treeview-finder-en.js +0 -17
- package/es/components/translations/treeview-finder-fr.js +0 -17
- package/es/hooks/useDebounce.js +0 -26
- package/es/hooks/useIntlRef.js +0 -22
- package/es/hooks/useSnackMessage.js +0 -81
- package/es/index.js +0 -71
- package/es/utils/AuthService.js +0 -312
- package/es/utils/ElementType.js +0 -53
- package/es/utils/EquipmentType.js +0 -133
- package/es/utils/UserManagerMock.js +0 -81
- package/es/utils/actions.js +0 -65
- package/es/utils/algos.js +0 -29
- package/es/utils/styles.js +0 -35
package/README.md
CHANGED
|
@@ -11,23 +11,6 @@ If you want to test your library integration with a consumer application my-app
|
|
|
11
11
|
to build commons-ui via `npm run build` then change the commons-ui dependency in my-app's package.json from `@gridsuite/commons-ui:"^x.x.x"`
|
|
12
12
|
to `@gridsuite/commons-ui:"file:../path/to/the/commons-ui"` then type `npm install` `npm start`.
|
|
13
13
|
|
|
14
|
-
NOTE: if you have the following error:
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
Module not found: Can't resolve '@svgr/webpack'
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
You can try to temporarily regenerate a package-lock.json in the consumer application (`cd my-app/;` `rm -rf node_modules;` `rm package-lock.json;` `npm install;`). Or temporarily add
|
|
21
|
-
"@svgr/webpack" to your consummer application package.json dependencies
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@svgr/webpack": "^4.3.0",
|
|
26
|
-
...
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
and then rerun npm install.
|
|
31
14
|
|
|
32
15
|
#### For integrators
|
|
33
16
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
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;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useCallback } from "react";
|
|
3
|
+
import { Routes, Route, Navigate } from "react-router-dom";
|
|
4
|
+
import SignInCallbackHandler from "../SignInCallbackHandler/SignInCallbackHandler.js";
|
|
5
|
+
import { handleSigninCallback, handleSilentRenewCallback, login, logout } from "../../utils/AuthService.js";
|
|
6
|
+
import SilentRenewCallbackHandler from "../SilentRenewCallbackHandler/SilentRenewCallbackHandler.js";
|
|
7
|
+
import Login from "../Login/Login.js";
|
|
8
|
+
import Logout from "../Login/Logout.js";
|
|
9
|
+
import { Grid, Alert, AlertTitle } from "@mui/material";
|
|
10
|
+
import { FormattedMessage } from "react-intl";
|
|
11
|
+
const AuthenticationRouter = ({
|
|
12
|
+
userManager,
|
|
13
|
+
signInCallbackError,
|
|
14
|
+
authenticationRouterError,
|
|
15
|
+
showAuthenticationRouterLogin,
|
|
16
|
+
dispatch,
|
|
17
|
+
navigate,
|
|
18
|
+
location
|
|
19
|
+
}) => {
|
|
20
|
+
const handleSigninCallbackClosure = useCallback(
|
|
21
|
+
() => handleSigninCallback(dispatch, navigate, userManager.instance),
|
|
22
|
+
[dispatch, navigate, userManager.instance]
|
|
23
|
+
);
|
|
24
|
+
const handleSilentRenewCallbackClosure = useCallback(
|
|
25
|
+
() => handleSilentRenewCallback(userManager.instance),
|
|
26
|
+
[userManager.instance]
|
|
27
|
+
);
|
|
28
|
+
return /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsxs(
|
|
29
|
+
Grid,
|
|
30
|
+
{
|
|
31
|
+
container: true,
|
|
32
|
+
alignContent: "center",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
direction: "column",
|
|
35
|
+
children: [
|
|
36
|
+
userManager.error !== null && /* @__PURE__ */ jsxs("h1", { children: [
|
|
37
|
+
"Error : Getting userManager; ",
|
|
38
|
+
userManager.error
|
|
39
|
+
] }),
|
|
40
|
+
signInCallbackError !== null && /* @__PURE__ */ jsxs("h1", { children: [
|
|
41
|
+
"Error : SignIn Callback Error;",
|
|
42
|
+
signInCallbackError.message
|
|
43
|
+
] }),
|
|
44
|
+
/* @__PURE__ */ jsxs(Routes, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
Route,
|
|
47
|
+
{
|
|
48
|
+
path: "sign-in-callback",
|
|
49
|
+
element: /* @__PURE__ */ jsx(
|
|
50
|
+
SignInCallbackHandler,
|
|
51
|
+
{
|
|
52
|
+
userManager: userManager.instance,
|
|
53
|
+
handleSignInCallback: handleSigninCallbackClosure
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
Route,
|
|
60
|
+
{
|
|
61
|
+
path: "silent-renew-callback",
|
|
62
|
+
element: /* @__PURE__ */ jsx(
|
|
63
|
+
SilentRenewCallbackHandler,
|
|
64
|
+
{
|
|
65
|
+
userManager: userManager.instance,
|
|
66
|
+
handleSilentRenewCallback: handleSilentRenewCallbackClosure
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
Route,
|
|
73
|
+
{
|
|
74
|
+
path: "logout-callback",
|
|
75
|
+
element: /* @__PURE__ */ jsx(Navigate, { to: "/" })
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
Route,
|
|
80
|
+
{
|
|
81
|
+
path: "*",
|
|
82
|
+
element: showAuthenticationRouterLogin && authenticationRouterError == null && /* @__PURE__ */ jsx(
|
|
83
|
+
Login,
|
|
84
|
+
{
|
|
85
|
+
disabled: userManager.instance === null,
|
|
86
|
+
onLoginClick: () => login(location, userManager.instance)
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] }),
|
|
92
|
+
authenticationRouterError !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
93
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
|
|
94
|
+
Logout,
|
|
95
|
+
{
|
|
96
|
+
disabled: userManager.instance === null,
|
|
97
|
+
onLogoutClick: () => logout(location, userManager.instance)
|
|
98
|
+
}
|
|
99
|
+
) }),
|
|
100
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 4, children: [
|
|
101
|
+
authenticationRouterError.logoutError != null && /* @__PURE__ */ jsxs(Alert, { severity: "error", children: [
|
|
102
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "login/errorInLogout" }) }),
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
FormattedMessage,
|
|
105
|
+
{
|
|
106
|
+
id: "login/errorInLogoutMessage",
|
|
107
|
+
values: {
|
|
108
|
+
userName: authenticationRouterError.userName
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsx("p", { children: authenticationRouterError.logoutError.error.message })
|
|
113
|
+
] }),
|
|
114
|
+
(authenticationRouterError == null ? void 0 : authenticationRouterError.userValidationError) != null && /* @__PURE__ */ jsxs(Alert, { severity: "error", children: [
|
|
115
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "login/errorInUserValidation" }) }),
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
FormattedMessage,
|
|
118
|
+
{
|
|
119
|
+
id: "login/errorInUserValidationMessage",
|
|
120
|
+
values: {
|
|
121
|
+
userName: authenticationRouterError.userName
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ jsx("p", { children: authenticationRouterError.userValidationError.error.message })
|
|
126
|
+
] }),
|
|
127
|
+
(authenticationRouterError == null ? void 0 : authenticationRouterError.unauthorizedUserInfo) != null && /* @__PURE__ */ jsxs(Alert, { severity: "info", children: [
|
|
128
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "login/unauthorizedAccess" }) }),
|
|
129
|
+
/* @__PURE__ */ jsx(
|
|
130
|
+
FormattedMessage,
|
|
131
|
+
{
|
|
132
|
+
id: "login/unauthorizedAccessMessage",
|
|
133
|
+
values: {
|
|
134
|
+
userName: authenticationRouterError.userName
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
] })
|
|
139
|
+
] })
|
|
140
|
+
] })
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
) });
|
|
144
|
+
};
|
|
145
|
+
export {
|
|
146
|
+
AuthenticationRouter as default
|
|
147
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./AuthenticationRouter";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default CardErrorBoundary;
|
|
2
|
+
declare class CardErrorBoundary extends React.Component<any, any, any> {
|
|
3
|
+
static getDerivedStateFromError(error: any): {
|
|
4
|
+
hasError: boolean;
|
|
5
|
+
error: any;
|
|
6
|
+
};
|
|
7
|
+
constructor(props: any);
|
|
8
|
+
state: {
|
|
9
|
+
hasError: boolean;
|
|
10
|
+
expanded: boolean;
|
|
11
|
+
error: undefined;
|
|
12
|
+
};
|
|
13
|
+
handleExpandClick(): void;
|
|
14
|
+
handleReloadClick(): void;
|
|
15
|
+
componentDidCatch(error: any, errorInfo: any): void;
|
|
16
|
+
render(): any;
|
|
17
|
+
}
|
|
18
|
+
import React from 'react';
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { styled, IconButton, Box, Card, CardHeader, CardContent, Typography, CardActions, Collapse } from "@mui/material";
|
|
4
|
+
import { Replay, ExpandMore as ExpandMore$1 } from "@mui/icons-material";
|
|
5
|
+
import { FormattedMessage } from "react-intl";
|
|
6
|
+
const ExpandMore = styled((props) => {
|
|
7
|
+
const { expand, ...other } = props;
|
|
8
|
+
return /* @__PURE__ */ jsx(IconButton, { ...other });
|
|
9
|
+
})(({ theme, expand }) => ({
|
|
10
|
+
transform: !expand ? "rotate(0deg)" : "rotate(180deg)",
|
|
11
|
+
marginLeft: "auto",
|
|
12
|
+
transition: theme.transitions.create("transform", {
|
|
13
|
+
duration: theme.transitions.duration.shortest
|
|
14
|
+
})
|
|
15
|
+
}));
|
|
16
|
+
class CardErrorBoundary extends React.Component {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(props);
|
|
19
|
+
this.state = {
|
|
20
|
+
hasError: false,
|
|
21
|
+
expanded: false,
|
|
22
|
+
error: void 0
|
|
23
|
+
};
|
|
24
|
+
this.handleExpandClick = this.handleExpandClick.bind(this);
|
|
25
|
+
this.handleReloadClick = this.handleReloadClick.bind(this);
|
|
26
|
+
}
|
|
27
|
+
static getDerivedStateFromError(error) {
|
|
28
|
+
return { hasError: true, error };
|
|
29
|
+
}
|
|
30
|
+
componentDidCatch(error, errorInfo) {
|
|
31
|
+
console.error("CardErrorBoundary caught: ", error, errorInfo);
|
|
32
|
+
}
|
|
33
|
+
handleExpandClick() {
|
|
34
|
+
this.setState((state) => ({ expanded: !state.expanded }));
|
|
35
|
+
}
|
|
36
|
+
handleReloadClick() {
|
|
37
|
+
this.setState((state) => ({
|
|
38
|
+
hasError: false,
|
|
39
|
+
expanded: false,
|
|
40
|
+
error: void 0
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
if (this.state.hasError) {
|
|
45
|
+
const { error, expanded } = this.state;
|
|
46
|
+
return /* @__PURE__ */ jsx(Box, { sx: { p: 4 }, children: /* @__PURE__ */ jsxs(Card, { sx: { mx: "auto", maxWidth: 600 }, children: [
|
|
47
|
+
/* @__PURE__ */ jsx(
|
|
48
|
+
CardHeader,
|
|
49
|
+
{
|
|
50
|
+
title: /* @__PURE__ */ jsx(
|
|
51
|
+
FormattedMessage,
|
|
52
|
+
{
|
|
53
|
+
id: "card_error_boundary/title",
|
|
54
|
+
defaultMessage: "Sorry, Unexpected error :("
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children: /* @__PURE__ */ jsx(
|
|
60
|
+
FormattedMessage,
|
|
61
|
+
{
|
|
62
|
+
id: "card_error_boundary/content",
|
|
63
|
+
defaultMessage: "Please reload, or close and reopen this application, or contact support."
|
|
64
|
+
}
|
|
65
|
+
) }) }),
|
|
66
|
+
/* @__PURE__ */ jsxs(CardActions, { disableSpacing: true, children: [
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
68
|
+
IconButton,
|
|
69
|
+
{
|
|
70
|
+
onClick: this.handleReloadClick,
|
|
71
|
+
"aria-label": "reload",
|
|
72
|
+
children: /* @__PURE__ */ jsx(Replay, {})
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
ExpandMore,
|
|
77
|
+
{
|
|
78
|
+
expand: expanded,
|
|
79
|
+
onClick: this.handleExpandClick,
|
|
80
|
+
"aria-expanded": expanded,
|
|
81
|
+
"aria-label": "show more",
|
|
82
|
+
children: /* @__PURE__ */ jsx(ExpandMore$1, {})
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
] }),
|
|
86
|
+
/* @__PURE__ */ jsx(Collapse, { in: expanded, children: /* @__PURE__ */ jsxs(CardContent, { children: [
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
Typography,
|
|
89
|
+
{
|
|
90
|
+
variant: "body2",
|
|
91
|
+
color: "text.secondary",
|
|
92
|
+
children: /* @__PURE__ */ jsx(
|
|
93
|
+
FormattedMessage,
|
|
94
|
+
{
|
|
95
|
+
id: "card_error_boundary/expandederrorheader",
|
|
96
|
+
defaultMessage: "Error message (and see more information in the developper console):"
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: error.message })
|
|
102
|
+
] }) })
|
|
103
|
+
] }) });
|
|
104
|
+
}
|
|
105
|
+
return this.props.children;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
CardErrorBoundary as default
|
|
110
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./card-error-boundary";
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
*/
|
|
7
|
+
/// <reference types="node" />
|
|
8
|
+
import { FunctionComponent } from 'react';
|
|
9
|
+
import { UUID } from 'crypto';
|
|
10
|
+
interface DirectoryItemSelectorProps {
|
|
11
|
+
open: boolean;
|
|
12
|
+
onClose: any;
|
|
13
|
+
types: string[];
|
|
14
|
+
equipmentTypes?: string[];
|
|
15
|
+
title: string;
|
|
16
|
+
itemFilter?: any;
|
|
17
|
+
fetchDirectoryContent: (directoryUuid: UUID, elementTypes: string[]) => Promise<any>;
|
|
18
|
+
fetchRootFolders: (types: string[]) => Promise<any>;
|
|
19
|
+
fetchElementsInfos: (ids: UUID[], elementTypes: string[], equipmentTypes?: string[]) => Promise<any>;
|
|
20
|
+
}
|
|
21
|
+
declare const DirectoryItemSelector: FunctionComponent<DirectoryItemSelectorProps>;
|
|
22
|
+
export default DirectoryItemSelector;
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef, useCallback, useEffect } from "react";
|
|
3
|
+
import { elementType, getFileIcon } from "../../utils/ElementType.js";
|
|
4
|
+
import { useSnackMessage } from "../../hooks/useSnackMessage.js";
|
|
5
|
+
import TreeViewFinder from "../TreeViewFinder/TreeViewFinder.js";
|
|
6
|
+
const styles = {
|
|
7
|
+
icon: (theme) => ({
|
|
8
|
+
marginRight: theme.spacing(1),
|
|
9
|
+
width: "18px",
|
|
10
|
+
height: "18px"
|
|
11
|
+
})
|
|
12
|
+
};
|
|
13
|
+
const DirectoryItemSelector = ({
|
|
14
|
+
open,
|
|
15
|
+
onClose,
|
|
16
|
+
types,
|
|
17
|
+
equipmentTypes,
|
|
18
|
+
title,
|
|
19
|
+
itemFilter,
|
|
20
|
+
fetchDirectoryContent,
|
|
21
|
+
fetchRootFolders,
|
|
22
|
+
fetchElementsInfos
|
|
23
|
+
}) => {
|
|
24
|
+
const [data, setData] = useState([]);
|
|
25
|
+
const [rootDirectories, setRootDirectories] = useState([]);
|
|
26
|
+
const nodeMap = useRef({});
|
|
27
|
+
const dataRef = useRef([]);
|
|
28
|
+
dataRef.current = data;
|
|
29
|
+
const rootsRef = useRef([]);
|
|
30
|
+
rootsRef.current = rootDirectories;
|
|
31
|
+
const { snackError } = useSnackMessage();
|
|
32
|
+
const openRef = useRef();
|
|
33
|
+
openRef.current = open;
|
|
34
|
+
const contentFilter = useCallback(
|
|
35
|
+
() => /* @__PURE__ */ new Set([elementType.DIRECTORY, ...types]),
|
|
36
|
+
[types]
|
|
37
|
+
);
|
|
38
|
+
const convertChildren = useCallback((children) => {
|
|
39
|
+
return children.map((e) => {
|
|
40
|
+
return {
|
|
41
|
+
id: e.elementUuid,
|
|
42
|
+
name: e.elementName,
|
|
43
|
+
specificMetadata: e.specificMetadata,
|
|
44
|
+
icon: getFileIcon(e.type, styles.icon),
|
|
45
|
+
children: e.type === elementType.DIRECTORY ? convertChildren(e.children) : void 0,
|
|
46
|
+
childrenCount: e.type === elementType.DIRECTORY ? e.subdirectoriesCount : void 0
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
}, []);
|
|
50
|
+
const convertRoots = useCallback(
|
|
51
|
+
(newRoots) => {
|
|
52
|
+
return newRoots.map((e) => {
|
|
53
|
+
return {
|
|
54
|
+
id: e.elementUuid,
|
|
55
|
+
name: e.elementName,
|
|
56
|
+
icon: getFileIcon(e.type, styles.icon),
|
|
57
|
+
children: e.type === elementType.DIRECTORY ? convertChildren(
|
|
58
|
+
nodeMap.current[e.elementUuid].children
|
|
59
|
+
) : void 0,
|
|
60
|
+
childrenCount: e.type === elementType.DIRECTORY ? e.subdirectoriesCount : void 0
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
[convertChildren]
|
|
65
|
+
);
|
|
66
|
+
const addToDirectory = useCallback(
|
|
67
|
+
(nodeId, content) => {
|
|
68
|
+
let [nrs, mdr] = updatedTree(
|
|
69
|
+
rootsRef.current,
|
|
70
|
+
nodeMap.current,
|
|
71
|
+
nodeId,
|
|
72
|
+
content
|
|
73
|
+
);
|
|
74
|
+
setRootDirectories(nrs);
|
|
75
|
+
nodeMap.current = mdr;
|
|
76
|
+
setData(convertRoots(nrs));
|
|
77
|
+
},
|
|
78
|
+
[convertRoots]
|
|
79
|
+
);
|
|
80
|
+
const updateRootDirectories = useCallback(() => {
|
|
81
|
+
fetchRootFolders(types).then((data2) => {
|
|
82
|
+
let [nrs, mdr] = updatedTree(
|
|
83
|
+
rootsRef.current,
|
|
84
|
+
nodeMap.current,
|
|
85
|
+
null,
|
|
86
|
+
data2
|
|
87
|
+
);
|
|
88
|
+
setRootDirectories(nrs);
|
|
89
|
+
nodeMap.current = mdr;
|
|
90
|
+
setData(convertRoots(nrs));
|
|
91
|
+
}).catch((error) => {
|
|
92
|
+
snackError({
|
|
93
|
+
messageTxt: error.message,
|
|
94
|
+
headerId: "DirectoryItemSelector"
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}, [convertRoots, types, snackError, fetchRootFolders]);
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (open) {
|
|
100
|
+
updateRootDirectories();
|
|
101
|
+
}
|
|
102
|
+
}, [open, updateRootDirectories]);
|
|
103
|
+
const fetchDirectory = useCallback(
|
|
104
|
+
(nodeId) => {
|
|
105
|
+
fetchDirectoryContent(nodeId, types).then((children) => {
|
|
106
|
+
const childrenMatchedTypes = children.filter(
|
|
107
|
+
(item) => contentFilter().has(item.type)
|
|
108
|
+
);
|
|
109
|
+
if (childrenMatchedTypes.length > 0 && equipmentTypes && equipmentTypes.length > 0) {
|
|
110
|
+
fetchElementsInfos(
|
|
111
|
+
childrenMatchedTypes.map((e) => e.elementUuid),
|
|
112
|
+
types,
|
|
113
|
+
equipmentTypes
|
|
114
|
+
).then((childrenWithMetadata) => {
|
|
115
|
+
const children2 = itemFilter ? childrenWithMetadata.filter((val) => {
|
|
116
|
+
if (val.type === elementType.DIRECTORY) {
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
return itemFilter(val);
|
|
120
|
+
}) : childrenWithMetadata;
|
|
121
|
+
addToDirectory(nodeId, children2);
|
|
122
|
+
});
|
|
123
|
+
} else {
|
|
124
|
+
addToDirectory(nodeId, childrenMatchedTypes);
|
|
125
|
+
}
|
|
126
|
+
}).catch((error) => {
|
|
127
|
+
console.warn(
|
|
128
|
+
`Could not update subs (and content) of '${nodeId}' : ${error.message}`
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
[
|
|
133
|
+
types,
|
|
134
|
+
equipmentTypes,
|
|
135
|
+
itemFilter,
|
|
136
|
+
contentFilter,
|
|
137
|
+
addToDirectory,
|
|
138
|
+
fetchDirectoryContent,
|
|
139
|
+
fetchElementsInfos
|
|
140
|
+
]
|
|
141
|
+
);
|
|
142
|
+
function sortHandlingDirectories(a, b) {
|
|
143
|
+
if (a.children && !b.children) {
|
|
144
|
+
return -1;
|
|
145
|
+
} else if (b.children && !a.children) {
|
|
146
|
+
return 1;
|
|
147
|
+
}
|
|
148
|
+
return a.name.localeCompare(b.name);
|
|
149
|
+
}
|
|
150
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
151
|
+
TreeViewFinder,
|
|
152
|
+
{
|
|
153
|
+
multiselect: true,
|
|
154
|
+
onTreeBrowse: fetchDirectory,
|
|
155
|
+
data,
|
|
156
|
+
onlyLeaves: true,
|
|
157
|
+
sortMethod: sortHandlingDirectories,
|
|
158
|
+
title,
|
|
159
|
+
onClose,
|
|
160
|
+
open
|
|
161
|
+
}
|
|
162
|
+
) });
|
|
163
|
+
};
|
|
164
|
+
function updatedTree(prevRoots, prevMap, nodeId, children) {
|
|
165
|
+
var _a;
|
|
166
|
+
const nextChildren = children.sort((a, b) => a.elementName.localeCompare(b.elementName)).map((n) => {
|
|
167
|
+
let pn = prevMap[n.elementUuid];
|
|
168
|
+
if (!pn) {
|
|
169
|
+
return { ...n, children: [], parentUuid: nodeId };
|
|
170
|
+
} else if (n.elementName === pn.elementName && sameRights(n.accessRights, pn.accessRights) && n.subdirectoriesCount === pn.subdirectoriesCount && nodeId === pn.parentUuid) {
|
|
171
|
+
return pn;
|
|
172
|
+
} else {
|
|
173
|
+
if (pn.parentUuid !== nodeId) {
|
|
174
|
+
console.warn("reparent " + pn.parentUuid + " -> " + nodeId);
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
...pn,
|
|
178
|
+
elementName: n.elementName,
|
|
179
|
+
accessRights: n.accessRights,
|
|
180
|
+
subdirectoriesCount: n.subdirectoriesCount,
|
|
181
|
+
parentUuid: nodeId
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
const prevChildren = nodeId ? (_a = prevMap[nodeId]) == null ? void 0 : _a.children : prevRoots;
|
|
186
|
+
if ((prevChildren == null ? void 0 : prevChildren.length) === nextChildren.length && prevChildren.every((e, i) => e === nextChildren[i])) {
|
|
187
|
+
return [prevRoots, prevMap];
|
|
188
|
+
}
|
|
189
|
+
let nextUuids = new Set(children ? children.map((n) => n.elementUuid) : []);
|
|
190
|
+
let prevUuids = prevChildren ? prevChildren.map((n) => n.elementUuid) : [];
|
|
191
|
+
let mayNodeId = nodeId ? [nodeId] : [];
|
|
192
|
+
let nonCopyUuids = /* @__PURE__ */ new Set([
|
|
193
|
+
...nextUuids,
|
|
194
|
+
...mayNodeId,
|
|
195
|
+
...Array.prototype.concat(
|
|
196
|
+
...prevUuids.filter((u) => !nextUuids.has(u)).map(
|
|
197
|
+
(u) => flattenDownNodes(prevMap[u], (n) => n.children).map(
|
|
198
|
+
(n) => n.elementUuid
|
|
199
|
+
)
|
|
200
|
+
)
|
|
201
|
+
)
|
|
202
|
+
]);
|
|
203
|
+
const prevNode = nodeId ? prevMap[nodeId] : {};
|
|
204
|
+
const nextNode = {
|
|
205
|
+
elementUuid: nodeId,
|
|
206
|
+
parentUuid: null,
|
|
207
|
+
...prevNode,
|
|
208
|
+
children: nextChildren,
|
|
209
|
+
subdirectoriesCount: nextChildren.length
|
|
210
|
+
};
|
|
211
|
+
const nextMap = Object.fromEntries([
|
|
212
|
+
...Object.entries(prevMap).filter(([k, v], i) => !nonCopyUuids.has(k)),
|
|
213
|
+
...nextChildren.map((n) => [n.elementUuid, n]),
|
|
214
|
+
...refreshedUpNodes(prevMap, nextNode).map((n) => [n.elementUuid, n])
|
|
215
|
+
]);
|
|
216
|
+
const nextRoots = nodeId === null ? nextChildren : prevRoots.map((r) => nextMap[r.elementUuid]);
|
|
217
|
+
return [nextRoots, nextMap];
|
|
218
|
+
}
|
|
219
|
+
function sameRights(a, b) {
|
|
220
|
+
if (!a && !b) {
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
if (!a || !b) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
return a.isPrivate === b.isPrivate;
|
|
227
|
+
}
|
|
228
|
+
function flattenDownNodes(n, cef) {
|
|
229
|
+
const subs = cef(n);
|
|
230
|
+
if (subs.length === 0) {
|
|
231
|
+
return [n];
|
|
232
|
+
}
|
|
233
|
+
return Array.prototype.concat(
|
|
234
|
+
[n],
|
|
235
|
+
...subs.map((sn) => flattenDownNodes(sn, cef))
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
function refreshedUpNodes(m, nn) {
|
|
239
|
+
if (!(nn == null ? void 0 : nn.elementUuid)) {
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
if (nn.parentUuid === null) {
|
|
243
|
+
return [nn];
|
|
244
|
+
}
|
|
245
|
+
const parent = m[nn.parentUuid];
|
|
246
|
+
const nextChildren = parent.children.map(
|
|
247
|
+
(c) => c.elementUuid === nn.elementUuid ? nn : c
|
|
248
|
+
);
|
|
249
|
+
const nextParent = { ...parent, children: nextChildren };
|
|
250
|
+
return [nn, ...refreshedUpNodes(m, nextParent)];
|
|
251
|
+
}
|
|
252
|
+
export {
|
|
253
|
+
DirectoryItemSelector as default
|
|
254
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default ElementSearchDialog;
|
|
2
|
+
declare function ElementSearchDialog(props: any): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare namespace ElementSearchDialog {
|
|
4
|
+
namespace propTypes {
|
|
5
|
+
const open: PropTypes.Validator<boolean>;
|
|
6
|
+
const onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
7
|
+
const searchingLabel: PropTypes.Requireable<string>;
|
|
8
|
+
const onSearchTermChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
9
|
+
const onSelectionChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
10
|
+
const elementsFound: PropTypes.Validator<any[]>;
|
|
11
|
+
const renderElement: PropTypes.Validator<(...args: any[]) => any>;
|
|
12
|
+
const searchTermDisabled: PropTypes.Requireable<boolean>;
|
|
13
|
+
const searchTermDisableReason: PropTypes.Requireable<string>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
import PropTypes from 'prop-types';
|