@gridsuite/commons-ui 0.46.0 → 0.47.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.js +147 -0
- package/dist/components/CardErrorBoundary/card-error-boundary.js +110 -0
- package/dist/components/ElementSearchDialog/element-search-dialog.js +139 -0
- package/dist/components/ElementSearchDialog/equipment-item.js +77 -0
- package/dist/components/ElementSearchDialog/tag-renderer.js +34 -0
- package/dist/components/FlatParameters/FlatParameters.js +411 -0
- package/dist/components/Login/Login.js +78 -0
- package/dist/components/Login/Logout.js +69 -0
- package/dist/components/MuiVirtualizedTable/ColumnHeader.js +127 -0
- package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +548 -0
- package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +790 -0
- package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +87 -0
- package/dist/components/OverflowableText/overflowable-text.js +87 -0
- package/dist/components/ReportViewer/filter-button.js +64 -0
- package/dist/components/ReportViewer/log-report-item.js +95 -0
- package/dist/components/ReportViewer/log-report.js +49 -0
- package/dist/components/ReportViewer/log-table.js +131 -0
- package/dist/components/ReportViewer/multi-select-list.js +40 -0
- package/dist/components/ReportViewer/report-item.js +112 -0
- package/dist/components/ReportViewer/report-tree-view-context.js +8 -0
- package/dist/components/ReportViewer/report-viewer.js +158 -0
- package/dist/components/ReportViewerDialog/report-viewer-dialog.js +61 -0
- package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +13 -0
- package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +16 -0
- package/dist/components/SnackbarProvider/SnackbarProvider.js +28 -0
- package/dist/components/TopBar/AboutDialog.js +467 -0
- package/dist/components/TopBar/GridLogo.js +71 -0
- package/dist/components/TopBar/TopBar.js +679 -0
- package/dist/components/TreeViewFinder/TreeViewFinder.js +288 -0
- package/dist/components/react-hook-form/autocomplete-input.js +96 -0
- package/dist/components/react-hook-form/booleans/boolean-input.js +49 -0
- package/dist/components/react-hook-form/booleans/checkbox-input.js +24 -0
- package/dist/components/react-hook-form/booleans/switch-input.js +24 -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.js +9 -0
- package/dist/components/react-hook-form/error-management/mid-form-error.js +20 -0
- package/dist/components/react-hook-form/numbers/float-input.js +51 -0
- package/dist/components/react-hook-form/numbers/integer-input.js +36 -0
- package/dist/components/react-hook-form/numbers/utils.js +10 -0
- package/dist/components/react-hook-form/radio-input.js +44 -0
- package/dist/components/react-hook-form/select-input.js +31 -0
- package/dist/components/react-hook-form/slider-input.js +43 -0
- package/dist/components/react-hook-form/text-input.js +94 -0
- package/dist/components/react-hook-form/utils/cancel-button.js +16 -0
- package/dist/components/react-hook-form/utils/field-label.js +12 -0
- package/dist/components/react-hook-form/utils/functions.js +36 -0
- package/dist/components/react-hook-form/utils/submit-button.js +23 -0
- package/dist/components/react-hook-form/utils/text-field-with-adornment.js +96 -0
- package/dist/components/translations/card-error-boundary-en.js +8 -0
- package/dist/components/translations/card-error-boundary-fr.js +8 -0
- package/dist/components/translations/common-button-en.js +7 -0
- package/dist/components/translations/common-button-fr.js +7 -0
- package/dist/components/translations/element-search-en.js +7 -0
- package/dist/components/translations/element-search-fr.js +7 -0
- package/dist/components/translations/equipment-search-en.js +21 -0
- package/dist/components/translations/equipment-search-fr.js +21 -0
- package/dist/components/translations/flat-parameters-en.js +8 -0
- package/dist/components/translations/flat-parameters-fr.js +8 -0
- package/dist/components/translations/login-en.js +14 -0
- package/dist/components/translations/login-fr.js +14 -0
- package/dist/components/translations/multiple-selection-dialog-en.js +8 -0
- package/dist/components/translations/multiple-selection-dialog-fr.js +8 -0
- package/dist/components/translations/report-viewer-en.js +8 -0
- package/dist/components/translations/report-viewer-fr.js +8 -0
- package/dist/components/translations/table-en.js +6 -0
- package/dist/components/translations/table-fr.js +6 -0
- package/dist/components/translations/top-bar-en.js +27 -0
- package/dist/components/translations/top-bar-fr.js +27 -0
- package/dist/components/translations/treeview-finder-en.js +12 -0
- package/dist/components/translations/treeview-finder-fr.js +12 -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.js +81 -0
- package/dist/index.d.ts +225 -0
- package/dist/index.js +154 -0
- package/dist/utils/AuthService.js +336 -0
- package/dist/utils/ElementType.js +38 -0
- package/dist/utils/EquipmentType.js +132 -0
- package/dist/utils/UserManagerMock.js +85 -0
- package/dist/utils/actions.js +71 -0
- package/dist/utils/algos.js +24 -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/CardErrorBoundary/index.js +0 -7
- 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/MultipleSelectionDialog/index.js +0 -8
- 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/common-button-en.js +0 -12
- package/es/components/translations/common-button-fr.js +0 -12
- package/es/components/translations/element-search-en.js +0 -12
- package/es/components/translations/element-search-fr.js +0 -12
- package/es/components/translations/equipment-search-en.js +0 -26
- package/es/components/translations/equipment-search-fr.js +0 -26
- package/es/components/translations/flat-parameters-en.js +0 -13
- package/es/components/translations/flat-parameters-fr.js +0 -13
- 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/report-viewer-en.js +0 -13
- package/es/components/translations/report-viewer-fr.js +0 -13
- package/es/components/translations/table-en.js +0 -11
- package/es/components/translations/table-fr.js +0 -11
- 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
|
@@ -1,448 +0,0 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
-
/**
|
|
6
|
-
* Copyright (c) 2023, RTE (http://www.rte-france.com)
|
|
7
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
8
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
9
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import React, { useCallback, useState } from 'react';
|
|
13
|
-
import { Autocomplete, Chip, List, ListItem, MenuItem, Select, Switch, TextField, Tooltip, Typography, Divider, IconButton } from '@mui/material';
|
|
14
|
-
import TuneIcon from '@mui/icons-material/Tune';
|
|
15
|
-
import { FormattedMessage, useIntl } from 'react-intl';
|
|
16
|
-
import MultipleSelectionDialog from '../MultipleSelectionDialog/MultipleSelectionDialog';
|
|
17
|
-
var styles = {
|
|
18
|
-
paramList: {
|
|
19
|
-
width: '100%',
|
|
20
|
-
margin: 0
|
|
21
|
-
},
|
|
22
|
-
paramListItem: function paramListItem(theme) {
|
|
23
|
-
return {
|
|
24
|
-
display: 'flex',
|
|
25
|
-
justifyContent: 'space-between',
|
|
26
|
-
gap: theme.spacing(2),
|
|
27
|
-
paddingLeft: 0,
|
|
28
|
-
paddingRight: 0
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
paramName: {
|
|
32
|
-
fontWeight: 'bold',
|
|
33
|
-
minWidth: '30%',
|
|
34
|
-
overflowWrap: 'anywhere'
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var FloatRE = /^-?\d*[.,]?\d*([eE]-?\d*)?$/;
|
|
38
|
-
var IntegerRE = /^-?\d*$/;
|
|
39
|
-
var ListRE = /^\[(.*)]$/;
|
|
40
|
-
var sepRE = /[, ]/;
|
|
41
|
-
export function extractDefault(paramDescription) {
|
|
42
|
-
var d = paramDescription.defaultValue;
|
|
43
|
-
if (paramDescription.type === 'BOOLEAN') {
|
|
44
|
-
return !!d;
|
|
45
|
-
}
|
|
46
|
-
if (paramDescription.type === 'DOUBLE') {
|
|
47
|
-
return d - 0.0;
|
|
48
|
-
}
|
|
49
|
-
if (paramDescription.type === 'INTEGER') {
|
|
50
|
-
return d - 0;
|
|
51
|
-
}
|
|
52
|
-
if (paramDescription.type === 'STRING_LIST') {
|
|
53
|
-
if (Array.isArray(d)) {
|
|
54
|
-
return d;
|
|
55
|
-
}
|
|
56
|
-
var mo = ListRE.exec(d);
|
|
57
|
-
if ((mo === null || mo === void 0 ? void 0 : mo.length) > 1) {
|
|
58
|
-
return mo[1].split(sepRE).map(function (s) {
|
|
59
|
-
return s.trim();
|
|
60
|
-
}).filter(function (s) {
|
|
61
|
-
return !!s;
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
return d !== null && d !== void 0 ? d : null;
|
|
67
|
-
}
|
|
68
|
-
function longestCommonPrefix(stringList) {
|
|
69
|
-
if (!(stringList === null || stringList === void 0 ? void 0 : stringList.length)) {
|
|
70
|
-
return '';
|
|
71
|
-
}
|
|
72
|
-
var prefix = stringList.reduce(function (acc, str) {
|
|
73
|
-
return str.length < acc.length ? str : acc;
|
|
74
|
-
});
|
|
75
|
-
for (var _iterator = _createForOfIteratorHelperLoose(stringList), _step; !(_step = _iterator()).done;) {
|
|
76
|
-
var str = _step.value;
|
|
77
|
-
while (str.slice(0, prefix.length) !== prefix) {
|
|
78
|
-
prefix = prefix.slice(0, -1);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return prefix;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Present a "list" of independently editable parameters according to
|
|
86
|
-
* their description, as given by paramsAsArray, with current values as in initValues.
|
|
87
|
-
* @param paramsAsArray [{type,name,possibleValues,defaultValue}]
|
|
88
|
-
* @param initValues {k:v}
|
|
89
|
-
* @param onChange (paramName, newValue, isInEdition)
|
|
90
|
-
* @param variant style variant for TextField, Autocomplete and Select parameter fields
|
|
91
|
-
* @param showSeparator if true, a separator is added between parameters
|
|
92
|
-
* @param selectionWithDialog {(param: {}) => boolean} if true, param with multiple options use dialog for selection
|
|
93
|
-
*/
|
|
94
|
-
export var FlatParameters = function FlatParameters(_ref) {
|
|
95
|
-
var paramsAsArray = _ref.paramsAsArray,
|
|
96
|
-
initValues = _ref.initValues,
|
|
97
|
-
onChange = _ref.onChange,
|
|
98
|
-
_ref$variant = _ref.variant,
|
|
99
|
-
variant = _ref$variant === void 0 ? 'outlined' : _ref$variant,
|
|
100
|
-
_ref$showSeparator = _ref.showSeparator,
|
|
101
|
-
showSeparator = _ref$showSeparator === void 0 ? false : _ref$showSeparator,
|
|
102
|
-
_ref$selectionWithDia = _ref.selectionWithDialog,
|
|
103
|
-
selectionWithDialog = _ref$selectionWithDia === void 0 ? function (param) {
|
|
104
|
-
return false;
|
|
105
|
-
} : _ref$selectionWithDia;
|
|
106
|
-
var intl = useIntl();
|
|
107
|
-
var longestPrefix = longestCommonPrefix(paramsAsArray.map(function (m) {
|
|
108
|
-
return m.name;
|
|
109
|
-
}));
|
|
110
|
-
var lastDotIndex = longestPrefix.lastIndexOf('.');
|
|
111
|
-
var prefix = longestPrefix.slice(0, lastDotIndex + 1);
|
|
112
|
-
var _useState = useState(null),
|
|
113
|
-
uncommitted = _useState[0],
|
|
114
|
-
setUncommitted = _useState[1];
|
|
115
|
-
var _useState2 = useState(null),
|
|
116
|
-
inEditionParam = _useState2[0],
|
|
117
|
-
setInEditionParam = _useState2[1];
|
|
118
|
-
var _useState3 = useState(false),
|
|
119
|
-
openSelector = _useState3[0],
|
|
120
|
-
setOpenSelector = _useState3[1];
|
|
121
|
-
var getTranslatedValue = useCallback(function (prefix, value) {
|
|
122
|
-
return intl.formatMessage({
|
|
123
|
-
id: prefix + '.' + value,
|
|
124
|
-
defaultMessage: value
|
|
125
|
-
});
|
|
126
|
-
}, [intl]);
|
|
127
|
-
var getSelectionDialogName = useCallback(function (paramName) {
|
|
128
|
-
var defaultMessage = intl.formatMessage({
|
|
129
|
-
id: paramName,
|
|
130
|
-
defaultMessage: paramName.slice(prefix.length)
|
|
131
|
-
});
|
|
132
|
-
return intl.formatMessage({
|
|
133
|
-
id: paramName + '.selectionDialog.name',
|
|
134
|
-
defaultMessage: defaultMessage
|
|
135
|
-
});
|
|
136
|
-
}, [intl, prefix.length]);
|
|
137
|
-
var sortPossibleValues = useCallback(function (prefix, values) {
|
|
138
|
-
if (values == null) {
|
|
139
|
-
return [];
|
|
140
|
-
}
|
|
141
|
-
// Sort by translated values
|
|
142
|
-
return values.map(function (value) {
|
|
143
|
-
return {
|
|
144
|
-
id: value,
|
|
145
|
-
message: getTranslatedValue(prefix, value)
|
|
146
|
-
};
|
|
147
|
-
}).sort(function (a, b) {
|
|
148
|
-
return a.message.localeCompare(b.message);
|
|
149
|
-
});
|
|
150
|
-
}, [getTranslatedValue]);
|
|
151
|
-
var onFieldChange = useCallback(function (value, param) {
|
|
152
|
-
var paramName = param.name;
|
|
153
|
-
var isInEdition = inEditionParam === paramName;
|
|
154
|
-
if (isInEdition) {
|
|
155
|
-
setUncommitted(value);
|
|
156
|
-
}
|
|
157
|
-
if (onChange) {
|
|
158
|
-
if (param.type === 'STRING_LIST') {
|
|
159
|
-
onChange(paramName, value ? value.toString() : null, isInEdition);
|
|
160
|
-
} else {
|
|
161
|
-
onChange(paramName, value, isInEdition);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}, [inEditionParam, onChange]);
|
|
165
|
-
var onUncommitted = useCallback(function (param, inEdit) {
|
|
166
|
-
if (inEdit) {
|
|
167
|
-
setInEditionParam(param.name);
|
|
168
|
-
} else {
|
|
169
|
-
if (onChange && uncommitted != null) {
|
|
170
|
-
if (!['INTEGER', 'DOUBLE'].includes(param.type)) {
|
|
171
|
-
onChange(param.name, uncommitted, false);
|
|
172
|
-
} else if (uncommitted) {
|
|
173
|
-
// may give NaN
|
|
174
|
-
onChange(param.name, uncommitted - 0, false);
|
|
175
|
-
} else {
|
|
176
|
-
onChange(param.name, extractDefault(param), false);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
setInEditionParam(null);
|
|
180
|
-
setUncommitted(null);
|
|
181
|
-
}
|
|
182
|
-
}, [uncommitted, onChange]);
|
|
183
|
-
function mixInitAndDefault(param) {
|
|
184
|
-
if (param.name === inEditionParam && uncommitted !== null) {
|
|
185
|
-
return uncommitted;
|
|
186
|
-
} else if (initValues && initValues.hasOwnProperty(param.name)) {
|
|
187
|
-
if (param.type !== 'STRING_LIST') {
|
|
188
|
-
return initValues[param.name];
|
|
189
|
-
}
|
|
190
|
-
var valueList = initValues[param.name];
|
|
191
|
-
if (Array.isArray(valueList)) {
|
|
192
|
-
return valueList;
|
|
193
|
-
}
|
|
194
|
-
// otherwise split string into array
|
|
195
|
-
return valueList ? valueList.split(',').map(function (s) {
|
|
196
|
-
return s.trim();
|
|
197
|
-
}).filter(function (s) {
|
|
198
|
-
return !!s;
|
|
199
|
-
}) : [];
|
|
200
|
-
} else {
|
|
201
|
-
return extractDefault(param);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
var outputTransformFloatString = function outputTransformFloatString(value) {
|
|
205
|
-
return (value === null || value === void 0 ? void 0 : value.replace(',', '.')) || '';
|
|
206
|
-
};
|
|
207
|
-
var getStringListValue = function getStringListValue(allValues, selectValues) {
|
|
208
|
-
if (!selectValues || !selectValues.length) {
|
|
209
|
-
return intl.formatMessage({
|
|
210
|
-
id: 'flat_parameters/none'
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
if (selectValues.length === allValues.length) {
|
|
214
|
-
return intl.formatMessage({
|
|
215
|
-
id: 'flat_parameters/all'
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
return intl.formatMessage({
|
|
219
|
-
id: 'flat_parameters/some'
|
|
220
|
-
});
|
|
221
|
-
};
|
|
222
|
-
var renderField = function renderField(param) {
|
|
223
|
-
var fieldValue = mixInitAndDefault(param);
|
|
224
|
-
switch (param.type) {
|
|
225
|
-
case 'BOOLEAN':
|
|
226
|
-
return /*#__PURE__*/React.createElement(Switch, {
|
|
227
|
-
checked: !!fieldValue,
|
|
228
|
-
onChange: function onChange(e) {
|
|
229
|
-
return onFieldChange(e.target.checked, param);
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
case 'DOUBLE':
|
|
233
|
-
var err = isNaN(fieldValue) || typeof fieldValue !== 'number' && !!fieldValue && isNaN(fieldValue - 0);
|
|
234
|
-
return /*#__PURE__*/React.createElement(TextField, {
|
|
235
|
-
size: 'small',
|
|
236
|
-
sx: {
|
|
237
|
-
width: '50%'
|
|
238
|
-
},
|
|
239
|
-
inputProps: {
|
|
240
|
-
style: {
|
|
241
|
-
textAlign: 'right'
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
value: fieldValue,
|
|
245
|
-
onFocus: function onFocus() {
|
|
246
|
-
return onUncommitted(param, true);
|
|
247
|
-
},
|
|
248
|
-
onBlur: function onBlur() {
|
|
249
|
-
return onUncommitted(param, false);
|
|
250
|
-
},
|
|
251
|
-
onChange: function onChange(e) {
|
|
252
|
-
var m = FloatRE.exec(e.target.value);
|
|
253
|
-
if (m) {
|
|
254
|
-
onFieldChange(outputTransformFloatString(e.target.value), param);
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
error: err,
|
|
258
|
-
variant: variant
|
|
259
|
-
});
|
|
260
|
-
case 'INTEGER':
|
|
261
|
-
return /*#__PURE__*/React.createElement(TextField, {
|
|
262
|
-
size: 'small',
|
|
263
|
-
sx: {
|
|
264
|
-
width: '50%'
|
|
265
|
-
},
|
|
266
|
-
inputProps: {
|
|
267
|
-
style: {
|
|
268
|
-
textAlign: 'right'
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
value: fieldValue,
|
|
272
|
-
onFocus: function onFocus() {
|
|
273
|
-
return onUncommitted(param, true);
|
|
274
|
-
},
|
|
275
|
-
onBlur: function onBlur() {
|
|
276
|
-
return onUncommitted(param, false);
|
|
277
|
-
},
|
|
278
|
-
onChange: function onChange(e) {
|
|
279
|
-
var m = IntegerRE.exec(e.target.value);
|
|
280
|
-
if (m) {
|
|
281
|
-
onFieldChange(e.target.value, param);
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
variant: variant
|
|
285
|
-
});
|
|
286
|
-
case 'STRING_LIST':
|
|
287
|
-
if (param.possibleValues) {
|
|
288
|
-
var allOptions = sortPossibleValues(param.name, param.possibleValues).map(function (_ref2) {
|
|
289
|
-
var id = _ref2.id;
|
|
290
|
-
return id;
|
|
291
|
-
});
|
|
292
|
-
var withDialog = selectionWithDialog(param);
|
|
293
|
-
if (withDialog) {
|
|
294
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextField, {
|
|
295
|
-
value: getStringListValue(allOptions, fieldValue),
|
|
296
|
-
size: 'small',
|
|
297
|
-
variant: variant,
|
|
298
|
-
InputProps: {
|
|
299
|
-
readOnly: true,
|
|
300
|
-
endAdornment: /*#__PURE__*/React.createElement(IconButton, {
|
|
301
|
-
onClick: function onClick() {
|
|
302
|
-
return setOpenSelector(true);
|
|
303
|
-
}
|
|
304
|
-
}, /*#__PURE__*/React.createElement(TuneIcon, null))
|
|
305
|
-
}
|
|
306
|
-
}), /*#__PURE__*/React.createElement(MultipleSelectionDialog, {
|
|
307
|
-
options: allOptions,
|
|
308
|
-
titleId: getSelectionDialogName(param.name),
|
|
309
|
-
open: openSelector,
|
|
310
|
-
getOptionLabel: function getOptionLabel(option) {
|
|
311
|
-
return getTranslatedValue(param.name, option);
|
|
312
|
-
},
|
|
313
|
-
selectedOptions: fieldValue,
|
|
314
|
-
handleClose: function handleClose() {
|
|
315
|
-
return setOpenSelector(false);
|
|
316
|
-
},
|
|
317
|
-
handleValidate: function handleValidate(selectedOptions) {
|
|
318
|
-
onFieldChange(selectedOptions, param);
|
|
319
|
-
setOpenSelector(false);
|
|
320
|
-
}
|
|
321
|
-
}));
|
|
322
|
-
}
|
|
323
|
-
return /*#__PURE__*/React.createElement(Autocomplete, {
|
|
324
|
-
fullWidth: true,
|
|
325
|
-
multiple: true,
|
|
326
|
-
size: 'small',
|
|
327
|
-
options: sortPossibleValues(param.name, param.possibleValues).map(function (v) {
|
|
328
|
-
return v.id;
|
|
329
|
-
}),
|
|
330
|
-
getOptionLabel: function getOptionLabel(option) {
|
|
331
|
-
return getTranslatedValue(param.name, option);
|
|
332
|
-
},
|
|
333
|
-
onChange: function onChange(e, value) {
|
|
334
|
-
return onFieldChange(value, param);
|
|
335
|
-
},
|
|
336
|
-
value: fieldValue,
|
|
337
|
-
renderTags: function renderTags(values, getTagProps) {
|
|
338
|
-
return values.map(function (value, index) {
|
|
339
|
-
return /*#__PURE__*/React.createElement(Chip, _extends({
|
|
340
|
-
label: getTranslatedValue(param.name, value)
|
|
341
|
-
}, getTagProps({
|
|
342
|
-
index: index
|
|
343
|
-
})));
|
|
344
|
-
});
|
|
345
|
-
},
|
|
346
|
-
renderInput: function renderInput(inputProps) {
|
|
347
|
-
return /*#__PURE__*/React.createElement(TextField, _extends({}, inputProps, {
|
|
348
|
-
variant: variant
|
|
349
|
-
}));
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
} else {
|
|
353
|
-
// no possible values => free user inputs
|
|
354
|
-
return /*#__PURE__*/React.createElement(Autocomplete, {
|
|
355
|
-
multiple: true,
|
|
356
|
-
freeSolo: true,
|
|
357
|
-
autoSelect: true,
|
|
358
|
-
sx: {
|
|
359
|
-
width: '50%'
|
|
360
|
-
},
|
|
361
|
-
options: [],
|
|
362
|
-
size: 'small',
|
|
363
|
-
onChange: function onChange(e, value) {
|
|
364
|
-
return onFieldChange(value, param);
|
|
365
|
-
},
|
|
366
|
-
value: fieldValue,
|
|
367
|
-
renderTags: function renderTags(values, getTagProps) {
|
|
368
|
-
return values.map(function (value, index) {
|
|
369
|
-
return /*#__PURE__*/React.createElement(Chip, _extends({
|
|
370
|
-
id: 'chip_' + value,
|
|
371
|
-
size: 'small',
|
|
372
|
-
label: value
|
|
373
|
-
}, getTagProps({
|
|
374
|
-
index: index
|
|
375
|
-
})));
|
|
376
|
-
});
|
|
377
|
-
},
|
|
378
|
-
renderInput: function renderInput(inputProps) {
|
|
379
|
-
return /*#__PURE__*/React.createElement(TextField, _extends({}, inputProps, {
|
|
380
|
-
variant: variant
|
|
381
|
-
}));
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
case 'STRING':
|
|
386
|
-
if (param.possibleValues) {
|
|
387
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Select, {
|
|
388
|
-
labelId: param.name,
|
|
389
|
-
value: fieldValue !== null && fieldValue !== void 0 ? fieldValue : '',
|
|
390
|
-
onChange: function onChange(ev) {
|
|
391
|
-
onFieldChange(ev.target.value, param);
|
|
392
|
-
},
|
|
393
|
-
size: "small",
|
|
394
|
-
sx: {
|
|
395
|
-
minWidth: '4em'
|
|
396
|
-
},
|
|
397
|
-
variant: variant
|
|
398
|
-
}, sortPossibleValues(param.name, param.possibleValues).map(function (value) {
|
|
399
|
-
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
400
|
-
key: value.id,
|
|
401
|
-
value: value.id
|
|
402
|
-
}, /*#__PURE__*/React.createElement(Typography, null, value.message));
|
|
403
|
-
})));
|
|
404
|
-
}
|
|
405
|
-
// else fallthrough to default
|
|
406
|
-
default:
|
|
407
|
-
return /*#__PURE__*/React.createElement(TextField, {
|
|
408
|
-
sx: {
|
|
409
|
-
width: '50%'
|
|
410
|
-
},
|
|
411
|
-
size: 'small',
|
|
412
|
-
value: fieldValue || '',
|
|
413
|
-
onFocus: function onFocus() {
|
|
414
|
-
return onUncommitted(param, true);
|
|
415
|
-
},
|
|
416
|
-
onBlur: function onBlur() {
|
|
417
|
-
return onUncommitted(param, false);
|
|
418
|
-
},
|
|
419
|
-
onChange: function onChange(e) {
|
|
420
|
-
return onFieldChange(e.target.value, param);
|
|
421
|
-
},
|
|
422
|
-
variant: variant
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
return /*#__PURE__*/React.createElement(List, {
|
|
427
|
-
sx: styles.paramList
|
|
428
|
-
}, paramsAsArray.map(function (param, index) {
|
|
429
|
-
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
430
|
-
key: param.name
|
|
431
|
-
}, /*#__PURE__*/React.createElement(ListItem, {
|
|
432
|
-
sx: styles.paramListItem
|
|
433
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
434
|
-
title: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
435
|
-
id: param.name + '.desc',
|
|
436
|
-
defaultMessage: param.description
|
|
437
|
-
}),
|
|
438
|
-
enterDelay: 1200,
|
|
439
|
-
key: param.name
|
|
440
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
441
|
-
sx: styles.paramName
|
|
442
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
443
|
-
id: param.name,
|
|
444
|
-
defaultMessage: param.name.slice(prefix.length)
|
|
445
|
-
}))), renderField(param)), showSeparator && index !== paramsAsArray.length - 1 && /*#__PURE__*/React.createElement(Divider, null));
|
|
446
|
-
}));
|
|
447
|
-
};
|
|
448
|
-
export default FlatParameters;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023, RTE (http://www.rte-france.com)
|
|
3
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export { default } from './FlatParameters';
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
3
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import Avatar from '@mui/material/Avatar';
|
|
10
|
-
import Button from '@mui/material/Button';
|
|
11
|
-
import Link from '@mui/material/Link';
|
|
12
|
-
import Box from '@mui/material/Box';
|
|
13
|
-
import LockOutlinedIcon from '@mui/icons-material/LockOutlined';
|
|
14
|
-
import Typography from '@mui/material/Typography';
|
|
15
|
-
import Container from '@mui/material/Container';
|
|
16
|
-
import { FormattedMessage } from 'react-intl';
|
|
17
|
-
var styles = {
|
|
18
|
-
paper: function paper(theme) {
|
|
19
|
-
return {
|
|
20
|
-
marginTop: theme.spacing(8),
|
|
21
|
-
display: 'flex',
|
|
22
|
-
flexDirection: 'column',
|
|
23
|
-
alignItems: 'center'
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
avatar: function avatar(theme) {
|
|
27
|
-
return {
|
|
28
|
-
margin: theme.spacing(1),
|
|
29
|
-
backgroundColor: theme.palette.secondary.main
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
submit: function submit(theme) {
|
|
33
|
-
return {
|
|
34
|
-
margin: theme.spacing(3, 0, 2),
|
|
35
|
-
borderRadius: '30px'
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
logo: {
|
|
39
|
-
width: 64,
|
|
40
|
-
height: 64
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
var Login = function Login(_ref) {
|
|
44
|
-
var onLoginClick = _ref.onLoginClick,
|
|
45
|
-
disabled = _ref.disabled;
|
|
46
|
-
return /*#__PURE__*/React.createElement(Container, {
|
|
47
|
-
component: "main",
|
|
48
|
-
maxWidth: "xs"
|
|
49
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
50
|
-
sx: styles.paper
|
|
51
|
-
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
52
|
-
sx: styles.avatar
|
|
53
|
-
}, /*#__PURE__*/React.createElement(LockOutlinedIcon, null)), /*#__PURE__*/React.createElement(Typography, {
|
|
54
|
-
component: "h1",
|
|
55
|
-
variant: "h5"
|
|
56
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
57
|
-
id: "login/login",
|
|
58
|
-
defaultMessage: 'login'
|
|
59
|
-
}), ' ', "?"), /*#__PURE__*/React.createElement(Button, {
|
|
60
|
-
disabled: disabled,
|
|
61
|
-
fullWidth: true,
|
|
62
|
-
variant: "contained",
|
|
63
|
-
sx: styles.submit,
|
|
64
|
-
onClick: onLoginClick
|
|
65
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
66
|
-
id: "login/connection",
|
|
67
|
-
defaultMessage: 'connection'
|
|
68
|
-
}))), /*#__PURE__*/React.createElement(Box, {
|
|
69
|
-
mt: 2
|
|
70
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
71
|
-
variant: "body2",
|
|
72
|
-
color: "textSecondary",
|
|
73
|
-
align: "center"
|
|
74
|
-
}, 'Copyright © ', /*#__PURE__*/React.createElement(Link, {
|
|
75
|
-
color: "inherit",
|
|
76
|
-
href: "#"
|
|
77
|
-
}, "GridSuite"), ' ', new Date().getFullYear(), '.')));
|
|
78
|
-
};
|
|
79
|
-
export default Login;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
3
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import Avatar from '@mui/material/Avatar';
|
|
10
|
-
import Button from '@mui/material/Button';
|
|
11
|
-
import Link from '@mui/material/Link';
|
|
12
|
-
import Box from '@mui/material/Box';
|
|
13
|
-
import LogoutOutlinedIcon from '@mui/icons-material/LogoutOutlined';
|
|
14
|
-
import Typography from '@mui/material/Typography';
|
|
15
|
-
import Container from '@mui/material/Container';
|
|
16
|
-
import { FormattedMessage } from 'react-intl';
|
|
17
|
-
var styles = {
|
|
18
|
-
paper: function paper(theme) {
|
|
19
|
-
return {
|
|
20
|
-
marginTop: theme.spacing(8),
|
|
21
|
-
display: 'flex',
|
|
22
|
-
flexDirection: 'column',
|
|
23
|
-
alignItems: 'center'
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
avatar: function avatar(theme) {
|
|
27
|
-
return {
|
|
28
|
-
margin: theme.spacing(1),
|
|
29
|
-
backgroundColor: theme.palette.error.main
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
submit: function submit(theme) {
|
|
33
|
-
return {
|
|
34
|
-
margin: theme.spacing(3, 0, 2),
|
|
35
|
-
borderRadius: '30px'
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
var Logout = function Logout(_ref) {
|
|
40
|
-
var onLogoutClick = _ref.onLogoutClick,
|
|
41
|
-
disabled = _ref.disabled;
|
|
42
|
-
function Copyright() {
|
|
43
|
-
return /*#__PURE__*/React.createElement(Typography, {
|
|
44
|
-
variant: "body2",
|
|
45
|
-
color: "textSecondary",
|
|
46
|
-
align: "center"
|
|
47
|
-
}, 'Copyright © ', /*#__PURE__*/React.createElement(Link, {
|
|
48
|
-
color: "inherit",
|
|
49
|
-
href: "#"
|
|
50
|
-
}, "GridSuite"), ' ', new Date().getFullYear(), '.');
|
|
51
|
-
}
|
|
52
|
-
return /*#__PURE__*/React.createElement(Container, {
|
|
53
|
-
component: "main",
|
|
54
|
-
maxWidth: "xs"
|
|
55
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
56
|
-
sx: styles.paper
|
|
57
|
-
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
58
|
-
sx: styles.avatar
|
|
59
|
-
}, /*#__PURE__*/React.createElement(LogoutOutlinedIcon, null)), /*#__PURE__*/React.createElement(Typography, {
|
|
60
|
-
component: "h1",
|
|
61
|
-
variant: "h5"
|
|
62
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
63
|
-
id: "login/logout",
|
|
64
|
-
defaultMessage: 'logout'
|
|
65
|
-
}), ' ', "?"), /*#__PURE__*/React.createElement(Button, {
|
|
66
|
-
disabled: disabled,
|
|
67
|
-
fullWidth: true,
|
|
68
|
-
variant: "contained",
|
|
69
|
-
sx: styles.submit,
|
|
70
|
-
onClick: onLogoutClick
|
|
71
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
72
|
-
id: "login/logout",
|
|
73
|
-
defaultMessage: 'logout'
|
|
74
|
-
}))), /*#__PURE__*/React.createElement(Box, {
|
|
75
|
-
mt: 2
|
|
76
|
-
}, /*#__PURE__*/React.createElement(Copyright, null)));
|
|
77
|
-
};
|
|
78
|
-
export default Logout;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
3
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
-
*/
|
|
7
|
-
export { default } from './Login';
|