@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
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState, useCallback } from "react";
|
|
3
|
+
import { List, ListItem, Tooltip, Typography, Divider, TextField, Select, MenuItem, IconButton, Autocomplete, Chip, Switch } from "@mui/material";
|
|
4
|
+
import { Tune } from "@mui/icons-material";
|
|
5
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
6
|
+
import MultipleSelectionDialog from "../MultipleSelectionDialog/MultipleSelectionDialog.js";
|
|
7
|
+
const styles = {
|
|
8
|
+
paramList: {
|
|
9
|
+
width: "100%",
|
|
10
|
+
margin: 0
|
|
11
|
+
},
|
|
12
|
+
paramListItem: (theme) => ({
|
|
13
|
+
display: "flex",
|
|
14
|
+
justifyContent: "space-between",
|
|
15
|
+
gap: theme.spacing(2),
|
|
16
|
+
paddingLeft: 0,
|
|
17
|
+
paddingRight: 0
|
|
18
|
+
}),
|
|
19
|
+
paramName: {
|
|
20
|
+
fontWeight: "bold",
|
|
21
|
+
minWidth: "30%",
|
|
22
|
+
overflowWrap: "anywhere"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const FloatRE = /^-?\d*[.,]?\d*([eE]-?\d*)?$/;
|
|
26
|
+
const IntegerRE = /^-?\d*$/;
|
|
27
|
+
const ListRE = /^\[(.*)]$/;
|
|
28
|
+
const sepRE = /[, ]/;
|
|
29
|
+
function extractDefault(paramDescription) {
|
|
30
|
+
const d = paramDescription.defaultValue;
|
|
31
|
+
if (paramDescription.type === "BOOLEAN") {
|
|
32
|
+
return !!d;
|
|
33
|
+
}
|
|
34
|
+
if (paramDescription.type === "DOUBLE") {
|
|
35
|
+
return d - 0;
|
|
36
|
+
}
|
|
37
|
+
if (paramDescription.type === "INTEGER") {
|
|
38
|
+
return d - 0;
|
|
39
|
+
}
|
|
40
|
+
if (paramDescription.type === "STRING_LIST") {
|
|
41
|
+
if (Array.isArray(d)) {
|
|
42
|
+
return d;
|
|
43
|
+
}
|
|
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);
|
|
47
|
+
}
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
return d ?? null;
|
|
51
|
+
}
|
|
52
|
+
function longestCommonPrefix(stringList) {
|
|
53
|
+
if (!(stringList == null ? void 0 : stringList.length)) {
|
|
54
|
+
return "";
|
|
55
|
+
}
|
|
56
|
+
let prefix = stringList.reduce(
|
|
57
|
+
(acc, str) => str.length < acc.length ? str : acc
|
|
58
|
+
);
|
|
59
|
+
for (let str of stringList) {
|
|
60
|
+
while (str.slice(0, prefix.length) !== prefix) {
|
|
61
|
+
prefix = prefix.slice(0, -1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return prefix;
|
|
65
|
+
}
|
|
66
|
+
const FlatParameters = ({
|
|
67
|
+
paramsAsArray,
|
|
68
|
+
initValues,
|
|
69
|
+
onChange,
|
|
70
|
+
variant = "outlined",
|
|
71
|
+
showSeparator = false,
|
|
72
|
+
selectionWithDialog = (param) => false
|
|
73
|
+
}) => {
|
|
74
|
+
const intl = useIntl();
|
|
75
|
+
const longestPrefix = longestCommonPrefix(paramsAsArray.map((m) => m.name));
|
|
76
|
+
const lastDotIndex = longestPrefix.lastIndexOf(".");
|
|
77
|
+
const prefix = longestPrefix.slice(0, lastDotIndex + 1);
|
|
78
|
+
const [uncommitted, setUncommitted] = useState(null);
|
|
79
|
+
const [inEditionParam, setInEditionParam] = useState(null);
|
|
80
|
+
const [openSelector, setOpenSelector] = useState(false);
|
|
81
|
+
const getTranslatedValue = useCallback(
|
|
82
|
+
(prefix2, value) => {
|
|
83
|
+
return intl.formatMessage({
|
|
84
|
+
id: prefix2 + "." + value,
|
|
85
|
+
defaultMessage: value
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
[intl]
|
|
89
|
+
);
|
|
90
|
+
const getSelectionDialogName = useCallback(
|
|
91
|
+
(paramName) => {
|
|
92
|
+
const defaultMessage = intl.formatMessage({
|
|
93
|
+
id: paramName,
|
|
94
|
+
defaultMessage: paramName.slice(prefix.length)
|
|
95
|
+
});
|
|
96
|
+
return intl.formatMessage({
|
|
97
|
+
id: paramName + ".selectionDialog.name",
|
|
98
|
+
defaultMessage
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
[intl, prefix.length]
|
|
102
|
+
);
|
|
103
|
+
const sortPossibleValues = useCallback(
|
|
104
|
+
(prefix2, values) => {
|
|
105
|
+
if (values == null) {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
return values.map((value) => {
|
|
109
|
+
return {
|
|
110
|
+
id: value,
|
|
111
|
+
message: getTranslatedValue(prefix2, value)
|
|
112
|
+
};
|
|
113
|
+
}).sort((a, b) => a.message.localeCompare(b.message));
|
|
114
|
+
},
|
|
115
|
+
[getTranslatedValue]
|
|
116
|
+
);
|
|
117
|
+
const onFieldChange = useCallback(
|
|
118
|
+
(value, param) => {
|
|
119
|
+
const paramName = param.name;
|
|
120
|
+
const isInEdition = inEditionParam === paramName;
|
|
121
|
+
if (isInEdition) {
|
|
122
|
+
setUncommitted(value);
|
|
123
|
+
}
|
|
124
|
+
if (onChange) {
|
|
125
|
+
if (param.type === "STRING_LIST") {
|
|
126
|
+
onChange(
|
|
127
|
+
paramName,
|
|
128
|
+
value ? value.toString() : null,
|
|
129
|
+
isInEdition
|
|
130
|
+
);
|
|
131
|
+
} else {
|
|
132
|
+
onChange(paramName, value, isInEdition);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
[inEditionParam, onChange]
|
|
137
|
+
);
|
|
138
|
+
const onUncommitted = useCallback(
|
|
139
|
+
(param, inEdit) => {
|
|
140
|
+
if (inEdit) {
|
|
141
|
+
setInEditionParam(param.name);
|
|
142
|
+
} else {
|
|
143
|
+
if (onChange && uncommitted != null) {
|
|
144
|
+
if (!["INTEGER", "DOUBLE"].includes(param.type)) {
|
|
145
|
+
onChange(param.name, uncommitted, false);
|
|
146
|
+
} else if (uncommitted) {
|
|
147
|
+
onChange(param.name, uncommitted - 0, false);
|
|
148
|
+
} else {
|
|
149
|
+
onChange(param.name, extractDefault(param), false);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
setInEditionParam(null);
|
|
153
|
+
setUncommitted(null);
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
[uncommitted, onChange]
|
|
157
|
+
);
|
|
158
|
+
function mixInitAndDefault(param) {
|
|
159
|
+
if (param.name === inEditionParam && uncommitted !== null) {
|
|
160
|
+
return uncommitted;
|
|
161
|
+
} else if (initValues && initValues.hasOwnProperty(param.name)) {
|
|
162
|
+
if (param.type !== "STRING_LIST") {
|
|
163
|
+
return initValues[param.name];
|
|
164
|
+
}
|
|
165
|
+
const valueList = initValues[param.name];
|
|
166
|
+
if (Array.isArray(valueList)) {
|
|
167
|
+
return valueList;
|
|
168
|
+
}
|
|
169
|
+
return valueList ? valueList.split(",").map((s) => s.trim()).filter((s) => !!s) : [];
|
|
170
|
+
} else {
|
|
171
|
+
return extractDefault(param);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const outputTransformFloatString = (value) => {
|
|
175
|
+
return (value == null ? void 0 : value.replace(",", ".")) || "";
|
|
176
|
+
};
|
|
177
|
+
const getStringListValue = (allValues, selectValues) => {
|
|
178
|
+
if (!selectValues || !selectValues.length) {
|
|
179
|
+
return intl.formatMessage({ id: "flat_parameters/none" });
|
|
180
|
+
}
|
|
181
|
+
if (selectValues.length === allValues.length) {
|
|
182
|
+
return intl.formatMessage({ id: "flat_parameters/all" });
|
|
183
|
+
}
|
|
184
|
+
return intl.formatMessage({ id: "flat_parameters/some" });
|
|
185
|
+
};
|
|
186
|
+
const renderField = (param) => {
|
|
187
|
+
const fieldValue = mixInitAndDefault(param);
|
|
188
|
+
switch (param.type) {
|
|
189
|
+
case "BOOLEAN":
|
|
190
|
+
return /* @__PURE__ */ jsx(
|
|
191
|
+
Switch,
|
|
192
|
+
{
|
|
193
|
+
checked: !!fieldValue,
|
|
194
|
+
onChange: (e) => onFieldChange(e.target.checked, param)
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
case "DOUBLE":
|
|
198
|
+
const err = isNaN(fieldValue) || typeof fieldValue !== "number" && !!fieldValue && isNaN(fieldValue - 0);
|
|
199
|
+
return /* @__PURE__ */ jsx(
|
|
200
|
+
TextField,
|
|
201
|
+
{
|
|
202
|
+
size: "small",
|
|
203
|
+
sx: { width: "50%" },
|
|
204
|
+
inputProps: { style: { textAlign: "right" } },
|
|
205
|
+
value: fieldValue,
|
|
206
|
+
onFocus: () => onUncommitted(param, true),
|
|
207
|
+
onBlur: () => onUncommitted(param, false),
|
|
208
|
+
onChange: (e) => {
|
|
209
|
+
const m = FloatRE.exec(e.target.value);
|
|
210
|
+
if (m) {
|
|
211
|
+
onFieldChange(
|
|
212
|
+
outputTransformFloatString(e.target.value),
|
|
213
|
+
param
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
error: err,
|
|
218
|
+
variant
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
case "INTEGER":
|
|
222
|
+
return /* @__PURE__ */ jsx(
|
|
223
|
+
TextField,
|
|
224
|
+
{
|
|
225
|
+
size: "small",
|
|
226
|
+
sx: { width: "50%" },
|
|
227
|
+
inputProps: { style: { textAlign: "right" } },
|
|
228
|
+
value: fieldValue,
|
|
229
|
+
onFocus: () => onUncommitted(param, true),
|
|
230
|
+
onBlur: () => onUncommitted(param, false),
|
|
231
|
+
onChange: (e) => {
|
|
232
|
+
const m = IntegerRE.exec(e.target.value);
|
|
233
|
+
if (m) {
|
|
234
|
+
onFieldChange(e.target.value, param);
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
variant
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
case "STRING_LIST":
|
|
241
|
+
if (param.possibleValues) {
|
|
242
|
+
const allOptions = sortPossibleValues(
|
|
243
|
+
param.name,
|
|
244
|
+
param.possibleValues
|
|
245
|
+
).map(({ id }) => id);
|
|
246
|
+
const withDialog = selectionWithDialog(param);
|
|
247
|
+
if (withDialog) {
|
|
248
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
249
|
+
/* @__PURE__ */ jsx(
|
|
250
|
+
TextField,
|
|
251
|
+
{
|
|
252
|
+
value: getStringListValue(
|
|
253
|
+
allOptions,
|
|
254
|
+
fieldValue
|
|
255
|
+
),
|
|
256
|
+
size: "small",
|
|
257
|
+
variant,
|
|
258
|
+
InputProps: {
|
|
259
|
+
readOnly: true,
|
|
260
|
+
endAdornment: /* @__PURE__ */ jsx(
|
|
261
|
+
IconButton,
|
|
262
|
+
{
|
|
263
|
+
onClick: () => setOpenSelector(true),
|
|
264
|
+
children: /* @__PURE__ */ jsx(Tune, {})
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
/* @__PURE__ */ jsx(
|
|
271
|
+
MultipleSelectionDialog,
|
|
272
|
+
{
|
|
273
|
+
options: allOptions,
|
|
274
|
+
titleId: getSelectionDialogName(param.name),
|
|
275
|
+
open: openSelector,
|
|
276
|
+
getOptionLabel: (option) => getTranslatedValue(param.name, option),
|
|
277
|
+
selectedOptions: fieldValue,
|
|
278
|
+
handleClose: () => setOpenSelector(false),
|
|
279
|
+
handleValidate: (selectedOptions) => {
|
|
280
|
+
onFieldChange(selectedOptions, param);
|
|
281
|
+
setOpenSelector(false);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
] });
|
|
286
|
+
}
|
|
287
|
+
return /* @__PURE__ */ jsx(
|
|
288
|
+
Autocomplete,
|
|
289
|
+
{
|
|
290
|
+
fullWidth: true,
|
|
291
|
+
multiple: true,
|
|
292
|
+
size: "small",
|
|
293
|
+
options: sortPossibleValues(
|
|
294
|
+
param.name,
|
|
295
|
+
param.possibleValues
|
|
296
|
+
).map((v) => v.id),
|
|
297
|
+
getOptionLabel: (option) => getTranslatedValue(param.name, option),
|
|
298
|
+
onChange: (e, value) => onFieldChange(value, param),
|
|
299
|
+
value: fieldValue,
|
|
300
|
+
renderTags: (values, getTagProps) => {
|
|
301
|
+
return values.map((value, index) => /* @__PURE__ */ jsx(
|
|
302
|
+
Chip,
|
|
303
|
+
{
|
|
304
|
+
label: getTranslatedValue(
|
|
305
|
+
param.name,
|
|
306
|
+
value
|
|
307
|
+
),
|
|
308
|
+
...getTagProps({ index })
|
|
309
|
+
}
|
|
310
|
+
));
|
|
311
|
+
},
|
|
312
|
+
renderInput: (inputProps) => /* @__PURE__ */ jsx(TextField, { ...inputProps, variant })
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
} else {
|
|
316
|
+
return /* @__PURE__ */ jsx(
|
|
317
|
+
Autocomplete,
|
|
318
|
+
{
|
|
319
|
+
multiple: true,
|
|
320
|
+
freeSolo: true,
|
|
321
|
+
autoSelect: true,
|
|
322
|
+
sx: { width: "50%" },
|
|
323
|
+
options: [],
|
|
324
|
+
size: "small",
|
|
325
|
+
onChange: (e, value) => onFieldChange(value, param),
|
|
326
|
+
value: fieldValue,
|
|
327
|
+
renderTags: (values, getTagProps) => {
|
|
328
|
+
return values.map((value, index) => /* @__PURE__ */ jsx(
|
|
329
|
+
Chip,
|
|
330
|
+
{
|
|
331
|
+
id: "chip_" + value,
|
|
332
|
+
size: "small",
|
|
333
|
+
label: value,
|
|
334
|
+
...getTagProps({ index })
|
|
335
|
+
}
|
|
336
|
+
));
|
|
337
|
+
},
|
|
338
|
+
renderInput: (inputProps) => /* @__PURE__ */ jsx(TextField, { ...inputProps, variant })
|
|
339
|
+
}
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
case "STRING":
|
|
343
|
+
if (param.possibleValues) {
|
|
344
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
345
|
+
Select,
|
|
346
|
+
{
|
|
347
|
+
labelId: param.name,
|
|
348
|
+
value: fieldValue ?? "",
|
|
349
|
+
onChange: (ev) => {
|
|
350
|
+
onFieldChange(ev.target.value, param);
|
|
351
|
+
},
|
|
352
|
+
size: "small",
|
|
353
|
+
sx: { minWidth: "4em" },
|
|
354
|
+
variant,
|
|
355
|
+
children: sortPossibleValues(
|
|
356
|
+
param.name,
|
|
357
|
+
param.possibleValues
|
|
358
|
+
).map((value) => /* @__PURE__ */ jsx(MenuItem, { value: value.id, children: /* @__PURE__ */ jsx(Typography, { children: value.message }) }, value.id))
|
|
359
|
+
}
|
|
360
|
+
) });
|
|
361
|
+
}
|
|
362
|
+
default:
|
|
363
|
+
return /* @__PURE__ */ jsx(
|
|
364
|
+
TextField,
|
|
365
|
+
{
|
|
366
|
+
sx: { width: "50%" },
|
|
367
|
+
size: "small",
|
|
368
|
+
value: fieldValue || "",
|
|
369
|
+
onFocus: () => onUncommitted(param, true),
|
|
370
|
+
onBlur: () => onUncommitted(param, false),
|
|
371
|
+
onChange: (e) => onFieldChange(e.target.value, param),
|
|
372
|
+
variant
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
return /* @__PURE__ */ jsx(List, { sx: styles.paramList, children: paramsAsArray.map((param, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
378
|
+
/* @__PURE__ */ jsxs(ListItem, { sx: styles.paramListItem, children: [
|
|
379
|
+
/* @__PURE__ */ jsx(
|
|
380
|
+
Tooltip,
|
|
381
|
+
{
|
|
382
|
+
title: /* @__PURE__ */ jsx(
|
|
383
|
+
FormattedMessage,
|
|
384
|
+
{
|
|
385
|
+
id: param.name + ".desc",
|
|
386
|
+
defaultMessage: param.description
|
|
387
|
+
}
|
|
388
|
+
),
|
|
389
|
+
enterDelay: 1200,
|
|
390
|
+
children: /* @__PURE__ */ jsx(Typography, { sx: styles.paramName, children: /* @__PURE__ */ jsx(
|
|
391
|
+
FormattedMessage,
|
|
392
|
+
{
|
|
393
|
+
id: param.name,
|
|
394
|
+
defaultMessage: param.name.slice(
|
|
395
|
+
prefix.length
|
|
396
|
+
)
|
|
397
|
+
}
|
|
398
|
+
) })
|
|
399
|
+
},
|
|
400
|
+
param.name
|
|
401
|
+
),
|
|
402
|
+
renderField(param)
|
|
403
|
+
] }),
|
|
404
|
+
showSeparator && index !== paramsAsArray.length - 1 && /* @__PURE__ */ jsx(Divider, {})
|
|
405
|
+
] }, param.name)) });
|
|
406
|
+
};
|
|
407
|
+
export {
|
|
408
|
+
FlatParameters,
|
|
409
|
+
FlatParameters as default,
|
|
410
|
+
extractDefault
|
|
411
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./FlatParameters";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Container, Box, Avatar, Typography, Button, Link } from "@mui/material";
|
|
4
|
+
import { LockOutlined } from "@mui/icons-material";
|
|
5
|
+
import { FormattedMessage } from "react-intl";
|
|
6
|
+
const styles = {
|
|
7
|
+
paper: (theme) => ({
|
|
8
|
+
marginTop: theme.spacing(8),
|
|
9
|
+
display: "flex",
|
|
10
|
+
flexDirection: "column",
|
|
11
|
+
alignItems: "center"
|
|
12
|
+
}),
|
|
13
|
+
avatar: (theme) => ({
|
|
14
|
+
margin: theme.spacing(1),
|
|
15
|
+
backgroundColor: theme.palette.secondary.main
|
|
16
|
+
}),
|
|
17
|
+
submit: (theme) => ({
|
|
18
|
+
margin: theme.spacing(3, 0, 2),
|
|
19
|
+
borderRadius: "30px"
|
|
20
|
+
}),
|
|
21
|
+
logo: {
|
|
22
|
+
width: 64,
|
|
23
|
+
height: 64
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const Login = ({ onLoginClick, disabled }) => {
|
|
27
|
+
return /* @__PURE__ */ jsxs(Container, { component: "main", maxWidth: "xs", children: [
|
|
28
|
+
/* @__PURE__ */ jsxs(Box, { sx: styles.paper, children: [
|
|
29
|
+
/* @__PURE__ */ jsx(Avatar, { sx: styles.avatar, children: /* @__PURE__ */ jsx(LockOutlined, {}) }),
|
|
30
|
+
/* @__PURE__ */ jsxs(Typography, { component: "h1", variant: "h5", children: [
|
|
31
|
+
/* @__PURE__ */ jsx(
|
|
32
|
+
FormattedMessage,
|
|
33
|
+
{
|
|
34
|
+
id: "login/login",
|
|
35
|
+
defaultMessage: "login"
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
" ",
|
|
39
|
+
"?"
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
Button,
|
|
43
|
+
{
|
|
44
|
+
disabled,
|
|
45
|
+
fullWidth: true,
|
|
46
|
+
variant: "contained",
|
|
47
|
+
sx: styles.submit,
|
|
48
|
+
onClick: onLoginClick,
|
|
49
|
+
children: /* @__PURE__ */ jsx(
|
|
50
|
+
FormattedMessage,
|
|
51
|
+
{
|
|
52
|
+
id: "login/connection",
|
|
53
|
+
defaultMessage: "connection"
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
] }),
|
|
59
|
+
/* @__PURE__ */ jsx(Box, { mt: 2, children: /* @__PURE__ */ jsxs(
|
|
60
|
+
Typography,
|
|
61
|
+
{
|
|
62
|
+
variant: "body2",
|
|
63
|
+
color: "textSecondary",
|
|
64
|
+
align: "center",
|
|
65
|
+
children: [
|
|
66
|
+
"Copyright © ",
|
|
67
|
+
/* @__PURE__ */ jsx(Link, { color: "inherit", href: "#", children: "GridSuite" }),
|
|
68
|
+
" ",
|
|
69
|
+
(/* @__PURE__ */ new Date()).getFullYear(),
|
|
70
|
+
"."
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
) })
|
|
74
|
+
] });
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
Login as default
|
|
78
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Container, Box, Avatar, Typography, Button, Link } from "@mui/material";
|
|
4
|
+
import { LogoutOutlined } from "@mui/icons-material";
|
|
5
|
+
import { FormattedMessage } from "react-intl";
|
|
6
|
+
const styles = {
|
|
7
|
+
paper: (theme) => ({
|
|
8
|
+
marginTop: theme.spacing(8),
|
|
9
|
+
display: "flex",
|
|
10
|
+
flexDirection: "column",
|
|
11
|
+
alignItems: "center"
|
|
12
|
+
}),
|
|
13
|
+
avatar: (theme) => ({
|
|
14
|
+
margin: theme.spacing(1),
|
|
15
|
+
backgroundColor: theme.palette.error.main
|
|
16
|
+
}),
|
|
17
|
+
submit: (theme) => ({
|
|
18
|
+
margin: theme.spacing(3, 0, 2),
|
|
19
|
+
borderRadius: "30px"
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
const Logout = ({ onLogoutClick, disabled }) => {
|
|
23
|
+
function Copyright() {
|
|
24
|
+
return /* @__PURE__ */ jsxs(Typography, { variant: "body2", color: "textSecondary", align: "center", children: [
|
|
25
|
+
"Copyright © ",
|
|
26
|
+
/* @__PURE__ */ jsx(Link, { color: "inherit", href: "#", children: "GridSuite" }),
|
|
27
|
+
" ",
|
|
28
|
+
(/* @__PURE__ */ new Date()).getFullYear(),
|
|
29
|
+
"."
|
|
30
|
+
] });
|
|
31
|
+
}
|
|
32
|
+
return /* @__PURE__ */ jsxs(Container, { component: "main", maxWidth: "xs", children: [
|
|
33
|
+
/* @__PURE__ */ jsxs(Box, { sx: styles.paper, children: [
|
|
34
|
+
/* @__PURE__ */ jsx(Avatar, { sx: styles.avatar, children: /* @__PURE__ */ jsx(LogoutOutlined, {}) }),
|
|
35
|
+
/* @__PURE__ */ jsxs(Typography, { component: "h1", variant: "h5", children: [
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
FormattedMessage,
|
|
38
|
+
{
|
|
39
|
+
id: "login/logout",
|
|
40
|
+
defaultMessage: "logout"
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
" ",
|
|
44
|
+
"?"
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
Button,
|
|
48
|
+
{
|
|
49
|
+
disabled,
|
|
50
|
+
fullWidth: true,
|
|
51
|
+
variant: "contained",
|
|
52
|
+
sx: styles.submit,
|
|
53
|
+
onClick: onLogoutClick,
|
|
54
|
+
children: /* @__PURE__ */ jsx(
|
|
55
|
+
FormattedMessage,
|
|
56
|
+
{
|
|
57
|
+
id: "login/logout",
|
|
58
|
+
defaultMessage: "logout"
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ jsx(Box, { mt: 2, children: /* @__PURE__ */ jsx(Copyright, {}) })
|
|
65
|
+
] });
|
|
66
|
+
};
|
|
67
|
+
export {
|
|
68
|
+
Logout as default
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Login";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export const ColumnHeader: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
2
|
+
declare const _default: import("@emotion/styled").StyledComponent<React.RefAttributes<any> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
|
|
3
|
+
export default _default;
|
|
4
|
+
import React from 'react';
|