@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.
Files changed (183) hide show
  1. package/README.md +0 -17
  2. package/dist/components/AuthenticationRouter/AuthenticationRouter.js +147 -0
  3. package/dist/components/CardErrorBoundary/card-error-boundary.js +110 -0
  4. package/dist/components/ElementSearchDialog/element-search-dialog.js +139 -0
  5. package/dist/components/ElementSearchDialog/equipment-item.js +77 -0
  6. package/dist/components/ElementSearchDialog/tag-renderer.js +34 -0
  7. package/dist/components/FlatParameters/FlatParameters.js +411 -0
  8. package/dist/components/Login/Login.js +78 -0
  9. package/dist/components/Login/Logout.js +69 -0
  10. package/dist/components/MuiVirtualizedTable/ColumnHeader.js +127 -0
  11. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +548 -0
  12. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +790 -0
  13. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +87 -0
  14. package/dist/components/OverflowableText/overflowable-text.js +87 -0
  15. package/dist/components/ReportViewer/filter-button.js +64 -0
  16. package/dist/components/ReportViewer/log-report-item.js +95 -0
  17. package/dist/components/ReportViewer/log-report.js +49 -0
  18. package/dist/components/ReportViewer/log-table.js +131 -0
  19. package/dist/components/ReportViewer/multi-select-list.js +40 -0
  20. package/dist/components/ReportViewer/report-item.js +112 -0
  21. package/dist/components/ReportViewer/report-tree-view-context.js +8 -0
  22. package/dist/components/ReportViewer/report-viewer.js +158 -0
  23. package/dist/components/ReportViewerDialog/report-viewer-dialog.js +61 -0
  24. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +13 -0
  25. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +16 -0
  26. package/dist/components/SnackbarProvider/SnackbarProvider.js +28 -0
  27. package/dist/components/TopBar/AboutDialog.js +467 -0
  28. package/dist/components/TopBar/GridLogo.js +71 -0
  29. package/dist/components/TopBar/TopBar.js +679 -0
  30. package/dist/components/TreeViewFinder/TreeViewFinder.js +288 -0
  31. package/dist/components/react-hook-form/autocomplete-input.js +96 -0
  32. package/dist/components/react-hook-form/booleans/boolean-input.js +49 -0
  33. package/dist/components/react-hook-form/booleans/checkbox-input.js +24 -0
  34. package/dist/components/react-hook-form/booleans/switch-input.js +24 -0
  35. package/dist/components/react-hook-form/error-management/error-input.js +42 -0
  36. package/dist/components/react-hook-form/error-management/field-error-alert.js +9 -0
  37. package/dist/components/react-hook-form/error-management/mid-form-error.js +20 -0
  38. package/dist/components/react-hook-form/numbers/float-input.js +51 -0
  39. package/dist/components/react-hook-form/numbers/integer-input.js +36 -0
  40. package/dist/components/react-hook-form/numbers/utils.js +10 -0
  41. package/dist/components/react-hook-form/radio-input.js +44 -0
  42. package/dist/components/react-hook-form/select-input.js +31 -0
  43. package/dist/components/react-hook-form/slider-input.js +43 -0
  44. package/dist/components/react-hook-form/text-input.js +94 -0
  45. package/dist/components/react-hook-form/utils/cancel-button.js +16 -0
  46. package/dist/components/react-hook-form/utils/field-label.js +12 -0
  47. package/dist/components/react-hook-form/utils/functions.js +36 -0
  48. package/dist/components/react-hook-form/utils/submit-button.js +23 -0
  49. package/dist/components/react-hook-form/utils/text-field-with-adornment.js +96 -0
  50. package/dist/components/translations/card-error-boundary-en.js +8 -0
  51. package/dist/components/translations/card-error-boundary-fr.js +8 -0
  52. package/dist/components/translations/common-button-en.js +7 -0
  53. package/dist/components/translations/common-button-fr.js +7 -0
  54. package/dist/components/translations/element-search-en.js +7 -0
  55. package/dist/components/translations/element-search-fr.js +7 -0
  56. package/dist/components/translations/equipment-search-en.js +21 -0
  57. package/dist/components/translations/equipment-search-fr.js +21 -0
  58. package/dist/components/translations/flat-parameters-en.js +8 -0
  59. package/dist/components/translations/flat-parameters-fr.js +8 -0
  60. package/dist/components/translations/login-en.js +14 -0
  61. package/dist/components/translations/login-fr.js +14 -0
  62. package/dist/components/translations/multiple-selection-dialog-en.js +8 -0
  63. package/dist/components/translations/multiple-selection-dialog-fr.js +8 -0
  64. package/dist/components/translations/report-viewer-en.js +8 -0
  65. package/dist/components/translations/report-viewer-fr.js +8 -0
  66. package/dist/components/translations/table-en.js +6 -0
  67. package/dist/components/translations/table-fr.js +6 -0
  68. package/dist/components/translations/top-bar-en.js +27 -0
  69. package/dist/components/translations/top-bar-fr.js +27 -0
  70. package/dist/components/translations/treeview-finder-en.js +12 -0
  71. package/dist/components/translations/treeview-finder-fr.js +12 -0
  72. package/dist/hooks/useDebounce.js +17 -0
  73. package/{es/components/ElementSearchDialog/index.js → dist/hooks/useIntlRef.d.ts} +2 -2
  74. package/dist/hooks/useIntlRef.js +13 -0
  75. package/dist/hooks/useSnackMessage.js +81 -0
  76. package/dist/index.d.ts +225 -0
  77. package/dist/index.js +154 -0
  78. package/dist/utils/AuthService.js +336 -0
  79. package/dist/utils/ElementType.js +38 -0
  80. package/dist/utils/EquipmentType.js +132 -0
  81. package/dist/utils/UserManagerMock.js +85 -0
  82. package/dist/utils/actions.js +71 -0
  83. package/dist/utils/algos.js +24 -0
  84. package/dist/utils/styles.js +13 -0
  85. package/package.json +36 -21
  86. package/es/components/AuthenticationRouter/AuthenticationRouter.js +0 -102
  87. package/es/components/AuthenticationRouter/index.js +0 -7
  88. package/es/components/CardErrorBoundary/card-error-boundary.js +0 -138
  89. package/es/components/CardErrorBoundary/index.js +0 -7
  90. package/es/components/ElementSearchDialog/element-search-dialog.js +0 -153
  91. package/es/components/ElementSearchDialog/equipment-item.js +0 -63
  92. package/es/components/ElementSearchDialog/tag-renderer.js +0 -29
  93. package/es/components/FlatParameters/FlatParameters.js +0 -448
  94. package/es/components/FlatParameters/index.js +0 -8
  95. package/es/components/Login/Login.js +0 -79
  96. package/es/components/Login/Logout.js +0 -78
  97. package/es/components/Login/index.js +0 -7
  98. package/es/components/MuiVirtualizedTable/ColumnHeader.js +0 -125
  99. package/es/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +0 -619
  100. package/es/components/MuiVirtualizedTable/MuiVirtualizedTable.js +0 -780
  101. package/es/components/MuiVirtualizedTable/index.js +0 -9
  102. package/es/components/MultipleSelectionDialog/MultipleSelectionDialog.js +0 -95
  103. package/es/components/MultipleSelectionDialog/index.js +0 -8
  104. package/es/components/OverflowableText/index.js +0 -7
  105. package/es/components/OverflowableText/overflowable-text.js +0 -81
  106. package/es/components/ReportViewer/filter-button.js +0 -77
  107. package/es/components/ReportViewer/index.js +0 -7
  108. package/es/components/ReportViewer/log-report-item.js +0 -97
  109. package/es/components/ReportViewer/log-report.js +0 -63
  110. package/es/components/ReportViewer/log-table.js +0 -130
  111. package/es/components/ReportViewer/multi-select-list.js +0 -56
  112. package/es/components/ReportViewer/report-item.js +0 -131
  113. package/es/components/ReportViewer/report-tree-view-context.js +0 -13
  114. package/es/components/ReportViewer/report-viewer.js +0 -167
  115. package/es/components/ReportViewerDialog/index.js +0 -7
  116. package/es/components/ReportViewerDialog/report-viewer-dialog.js +0 -67
  117. package/es/components/SignInCallbackHandler/SignInCallbackHandler.js +0 -19
  118. package/es/components/SignInCallbackHandler/index.js +0 -7
  119. package/es/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +0 -19
  120. package/es/components/SilentRenewCallbackHandler/index.js +0 -7
  121. package/es/components/SnackbarProvider/SnackbarProvider.js +0 -39
  122. package/es/components/SnackbarProvider/index.js +0 -7
  123. package/es/components/TopBar/AboutDialog.js +0 -456
  124. package/es/components/TopBar/GridLogo.js +0 -73
  125. package/es/components/TopBar/TopBar.js +0 -487
  126. package/es/components/TopBar/index.js +0 -9
  127. package/es/components/TreeViewFinder/TreeViewFinder.js +0 -341
  128. package/es/components/TreeViewFinder/index.js +0 -7
  129. package/es/components/images/powsybl_logo.svg +0 -35
  130. package/es/components/react-hook-form/autocomplete-input.js +0 -110
  131. package/es/components/react-hook-form/booleans/boolean-input.js +0 -56
  132. package/es/components/react-hook-form/booleans/checkbox-input.js +0 -28
  133. package/es/components/react-hook-form/booleans/switch-input.js +0 -28
  134. package/es/components/react-hook-form/error-management/error-input.js +0 -50
  135. package/es/components/react-hook-form/error-management/field-error-alert.js +0 -22
  136. package/es/components/react-hook-form/error-management/mid-form-error.js +0 -25
  137. package/es/components/react-hook-form/numbers/float-input.js +0 -105
  138. package/es/components/react-hook-form/numbers/integer-input.js +0 -35
  139. package/es/components/react-hook-form/numbers/utils.js +0 -6
  140. package/es/components/react-hook-form/radio-input.js +0 -55
  141. package/es/components/react-hook-form/select-input.js +0 -40
  142. package/es/components/react-hook-form/slider-input.js +0 -48
  143. package/es/components/react-hook-form/text-input.js +0 -100
  144. package/es/components/react-hook-form/utils/cancel-button.js +0 -28
  145. package/es/components/react-hook-form/utils/field-label.js +0 -15
  146. package/es/components/react-hook-form/utils/functions.js +0 -42
  147. package/es/components/react-hook-form/utils/submit-button.js +0 -29
  148. package/es/components/react-hook-form/utils/text-field-with-adornment.js +0 -92
  149. package/es/components/translations/card-error-boundary-en.js +0 -13
  150. package/es/components/translations/card-error-boundary-fr.js +0 -13
  151. package/es/components/translations/common-button-en.js +0 -12
  152. package/es/components/translations/common-button-fr.js +0 -12
  153. package/es/components/translations/element-search-en.js +0 -12
  154. package/es/components/translations/element-search-fr.js +0 -12
  155. package/es/components/translations/equipment-search-en.js +0 -26
  156. package/es/components/translations/equipment-search-fr.js +0 -26
  157. package/es/components/translations/flat-parameters-en.js +0 -13
  158. package/es/components/translations/flat-parameters-fr.js +0 -13
  159. package/es/components/translations/inputs-en.js +0 -25
  160. package/es/components/translations/inputs-fr.js +0 -25
  161. package/es/components/translations/login-en.js +0 -19
  162. package/es/components/translations/login-fr.js +0 -19
  163. package/es/components/translations/multiple-selection-dialog-en.js +0 -13
  164. package/es/components/translations/multiple-selection-dialog-fr.js +0 -13
  165. package/es/components/translations/report-viewer-en.js +0 -13
  166. package/es/components/translations/report-viewer-fr.js +0 -13
  167. package/es/components/translations/table-en.js +0 -11
  168. package/es/components/translations/table-fr.js +0 -11
  169. package/es/components/translations/top-bar-en.js +0 -32
  170. package/es/components/translations/top-bar-fr.js +0 -32
  171. package/es/components/translations/treeview-finder-en.js +0 -17
  172. package/es/components/translations/treeview-finder-fr.js +0 -17
  173. package/es/hooks/useDebounce.js +0 -26
  174. package/es/hooks/useIntlRef.js +0 -22
  175. package/es/hooks/useSnackMessage.js +0 -81
  176. package/es/index.js +0 -71
  177. package/es/utils/AuthService.js +0 -312
  178. package/es/utils/ElementType.js +0 -53
  179. package/es/utils/EquipmentType.js +0 -133
  180. package/es/utils/UserManagerMock.js +0 -81
  181. package/es/utils/actions.js +0 -65
  182. package/es/utils/algos.js +0 -29
  183. 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,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,127 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import React, { useRef } from "react";
3
+ import { ArrowUpward, ArrowDownward, FilterAltOutlined } from "@mui/icons-material";
4
+ import { styled } from "@mui/system";
5
+ import { Box } from "@mui/material";
6
+ import { mergeSx } from "../../utils/styles.js";
7
+ const styles = {
8
+ label: {
9
+ fontWeight: "bold",
10
+ fontSize: "0.875rem"
11
+ // to mimic TableCellRoot 'binding'
12
+ },
13
+ divFlex: {
14
+ display: "flex",
15
+ flexDirection: "row",
16
+ alignItems: "center",
17
+ height: "100%"
18
+ },
19
+ divNum: {
20
+ flexDirection: "row-reverse",
21
+ textAlign: "right"
22
+ },
23
+ sortDiv: {
24
+ display: "flex",
25
+ flexDirection: "column",
26
+ alignItems: "center"
27
+ },
28
+ sortButton: {
29
+ fill: "currentcolor"
30
+ },
31
+ filterButton: {
32
+ stroke: "currentcolor"
33
+ },
34
+ filterTooLossy: (theme) => ({
35
+ stroke: theme.palette.secondary.main
36
+ }),
37
+ transparent: {
38
+ opacity: 0
39
+ },
40
+ hovered: {
41
+ opacity: 0.5
42
+ }
43
+ };
44
+ const SortButton = (props) => {
45
+ const sortRank = Math.abs(props.signedRank);
46
+ const visibilityStyle = (!props.signedRank || void 0) && (props.headerHovered ? styles.hovered : styles.transparent);
47
+ return /* @__PURE__ */ jsxs(Box, { sx: styles.sortDiv, onClick: props.onClick, children: [
48
+ props.signedRank >= 0 ? /* @__PURE__ */ jsx(ArrowUpward, { sx: visibilityStyle }) : /* @__PURE__ */ jsx(ArrowDownward, { sx: visibilityStyle }),
49
+ sortRank > 1 && !props.hovered && /* @__PURE__ */ jsx("sub", { children: sortRank })
50
+ ] });
51
+ };
52
+ const FilterButton = (props) => {
53
+ const visibilityStyle = !props.filterLevel && (props.headerHovered ? styles.hovered : styles.transparent);
54
+ return /* @__PURE__ */ jsx(
55
+ FilterAltOutlined,
56
+ {
57
+ onClick: props.onClick,
58
+ sx: mergeSx(
59
+ styles.filterButton,
60
+ props.filterLevel > 1 && styles.filterTooLossy,
61
+ visibilityStyle
62
+ )
63
+ }
64
+ );
65
+ };
66
+ const ColumnHeader = React.forwardRef((props, ref) => {
67
+ const {
68
+ className,
69
+ label,
70
+ numeric,
71
+ sortSignedRank,
72
+ filterLevel,
73
+ onSortClick,
74
+ onFilterClick,
75
+ onContextMenu,
76
+ style
77
+ } = props;
78
+ const [hovered, setHovered] = React.useState();
79
+ const onHover = React.useCallback((evt) => {
80
+ setHovered(evt.type === "mouseenter");
81
+ }, []);
82
+ const topmostDiv = useRef();
83
+ const handleFilterClick = React.useMemo(() => {
84
+ if (!onFilterClick) {
85
+ return void 0;
86
+ }
87
+ return (evt) => {
88
+ onFilterClick(evt, topmostDiv.current);
89
+ };
90
+ }, [onFilterClick]);
91
+ return /* @__PURE__ */ jsxs(
92
+ Box,
93
+ {
94
+ ref: topmostDiv,
95
+ onMouseEnter: onHover,
96
+ onMouseLeave: onHover,
97
+ sx: mergeSx(styles.divFlex, numeric && styles.divNum),
98
+ className,
99
+ style,
100
+ onContextMenu,
101
+ children: [
102
+ /* @__PURE__ */ jsx(Box, { ref, sx: styles.label, children: label }),
103
+ onSortClick && /* @__PURE__ */ jsx(
104
+ SortButton,
105
+ {
106
+ headerHovered: hovered,
107
+ onClick: onSortClick,
108
+ signedRank: sortSignedRank
109
+ }
110
+ ),
111
+ handleFilterClick && /* @__PURE__ */ jsx(
112
+ FilterButton,
113
+ {
114
+ headerHovered: hovered,
115
+ onClick: handleFilterClick,
116
+ filterLevel
117
+ }
118
+ )
119
+ ]
120
+ }
121
+ );
122
+ });
123
+ const ColumnHeader$1 = styled(ColumnHeader)({});
124
+ export {
125
+ ColumnHeader,
126
+ ColumnHeader$1 as default
127
+ };