@gridsuite/commons-ui 0.63.4 → 0.63.5
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/dist/_mocks_/svg.js +1 -3
- package/dist/assets/expert-filter-form.css +18 -8
- package/dist/components/AuthenticationRouter/AuthenticationRouter.js +88 -97
- package/dist/components/CardErrorBoundary/card-error-boundary.js +6 -20
- package/dist/components/CustomAGGrid/custom-aggrid.js +47 -49
- package/dist/components/DirectoryItemSelector/directory-item-selector.js +10 -40
- package/dist/components/ElementSearchDialog/element-search-dialog.js +1 -17
- package/dist/components/ElementSearchDialog/equipment-item.js +29 -47
- package/dist/components/ElementSearchDialog/tag-renderer.js +2 -8
- package/dist/components/ElementSearchDialog/use-element-search.js +1 -4
- package/dist/components/FlatParameters/FlatParameters.js +13 -77
- package/dist/components/Login/Login.js +9 -34
- package/dist/components/Login/Logout.js +3 -26
- package/dist/components/MuiVirtualizedTable/ColumnHeader.js +35 -64
- package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +4 -17
- package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +1 -1
- package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +19 -95
- package/dist/components/MuiVirtualizedTable/index.d.ts +1 -1
- package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +2 -6
- package/dist/components/OverflowableText/overflowable-text.js +3 -10
- package/dist/components/ReportViewer/filter-button.d.ts +1 -1
- package/dist/components/ReportViewer/filter-button.js +2 -7
- package/dist/components/ReportViewer/log-report-item.js +7 -17
- package/dist/components/ReportViewer/log-report.js +4 -13
- package/dist/components/ReportViewer/log-table.d.ts +1 -1
- package/dist/components/ReportViewer/log-table.js +3 -16
- package/dist/components/ReportViewer/multi-select-list.d.ts +1 -1
- package/dist/components/ReportViewer/multi-select-list.js +2 -14
- package/dist/components/ReportViewer/report-item.js +4 -10
- package/dist/components/ReportViewer/report-viewer.d.ts +1 -1
- package/dist/components/ReportViewer/report-viewer.js +2 -7
- package/dist/components/ReportViewerDialog/report-viewer-dialog.js +1 -13
- package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +1 -1
- package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +1 -4
- package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +1 -1
- package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +1 -4
- package/dist/components/SnackbarProvider/SnackbarProvider.js +4 -11
- package/dist/components/TopBar/AboutDialog.js +51 -152
- package/dist/components/TopBar/GridLogo.d.ts +2 -2
- package/dist/components/TopBar/GridLogo.js +8 -41
- package/dist/components/TopBar/TopBar.js +197 -328
- package/dist/components/TreeViewFinder/TreeViewFinder.js +23 -66
- package/dist/components/TreeViewFinder/index.d.ts +2 -2
- package/dist/components/dialogs/custom-mui-dialog.d.ts +2 -1
- package/dist/components/dialogs/custom-mui-dialog.js +64 -39
- package/dist/components/dialogs/modify-element-selection.js +1 -3
- package/dist/components/dialogs/popup-confirmation-dialog.d.ts +1 -1
- package/dist/components/dialogs/popup-confirmation-dialog.js +8 -15
- package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +3 -18
- package/dist/components/filter/criteria-based/criteria-based-filter-utils.js +3 -9
- package/dist/components/filter/criteria-based/criteria-based-form.d.ts +1 -1
- package/dist/components/filter/criteria-based/criteria-based-form.js +7 -15
- package/dist/components/filter/criteria-based/filter-free-properties.d.ts +1 -1
- package/dist/components/filter/criteria-based/filter-free-properties.js +1 -4
- package/dist/components/filter/criteria-based/filter-properties.js +16 -24
- package/dist/components/filter/criteria-based/filter-property.js +1 -4
- package/dist/components/filter/expert/expert-filter-constants.d.ts +10 -3
- package/dist/components/filter/expert/expert-filter-constants.js +16 -12
- package/dist/components/filter/expert/expert-filter-edition-dialog.js +3 -18
- package/dist/components/filter/expert/expert-filter-form.js +1 -7
- package/dist/components/filter/expert/expert-filter-utils.js +10 -30
- package/dist/components/filter/expert/expert-filter.type.d.ts +3 -1
- package/dist/components/filter/expert/expert-filter.type.js +2 -0
- package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +2 -15
- package/dist/components/filter/explicit-naming/explicit-naming-filter-form.d.ts +1 -1
- package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +10 -35
- package/dist/components/filter/filter-creation-dialog.js +5 -10
- package/dist/components/filter/filter-form.js +1 -6
- package/dist/components/filter/utils/filter-api.js +1 -7
- package/dist/components/inputs/react-hook-form/ExpandingTextField.js +1 -9
- package/dist/components/inputs/react-hook-form/ag-grid-table/bottom-right-buttons.js +14 -52
- package/dist/components/inputs/react-hook-form/ag-grid-table/csv-uploader/csv-uploader.js +14 -62
- package/dist/components/inputs/react-hook-form/ag-grid-table/custom-ag-grid-table.js +29 -40
- package/dist/components/inputs/react-hook-form/autocomplete-inputs/autocomplete-input.js +2 -8
- package/dist/components/inputs/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.js +1 -3
- package/dist/components/inputs/react-hook-form/booleans/boolean-input.js +1 -7
- package/dist/components/inputs/react-hook-form/booleans/checkbox-input.js +1 -9
- package/dist/components/inputs/react-hook-form/booleans/switch-input.js +1 -9
- package/dist/components/inputs/react-hook-form/directory-items-input.js +5 -29
- package/dist/components/inputs/react-hook-form/error-management/error-input.d.ts +1 -1
- package/dist/components/inputs/react-hook-form/provider/custom-form-provider.js +1 -7
- package/dist/components/inputs/react-hook-form/radio-input.js +8 -18
- package/dist/components/inputs/react-hook-form/range-input.js +1 -4
- package/dist/components/inputs/react-hook-form/select-inputs/countries-input.js +1 -9
- package/dist/components/inputs/react-hook-form/select-inputs/mui-select-input.js +2 -13
- package/dist/components/inputs/react-hook-form/select-inputs/select-input.js +2 -6
- package/dist/components/inputs/react-hook-form/slider-input.d.ts +1 -1
- package/dist/components/inputs/react-hook-form/slider-input.js +2 -19
- package/dist/components/inputs/react-hook-form/unique-name-input.js +1 -9
- package/dist/components/inputs/react-hook-form/utils/field-label.d.ts +1 -1
- package/dist/components/inputs/react-hook-form/utils/field-label.js +1 -5
- package/dist/components/inputs/react-hook-form/utils/submit-button.js +1 -8
- package/dist/components/inputs/react-hook-form/utils/text-field-with-adornment.js +18 -47
- package/dist/components/inputs/react-query-builder/add-button.js +1 -10
- package/dist/components/inputs/react-query-builder/autocomplete-with-favorites.d.ts +12 -0
- package/dist/components/inputs/react-query-builder/autocomplete-with-favorites.js +43 -0
- package/dist/components/inputs/react-query-builder/composite-rule-editor/group-value-editor.js +14 -27
- package/dist/components/inputs/react-query-builder/composite-rule-editor/rule-value-editor.js +1 -3
- package/dist/components/inputs/react-query-builder/country-value-editor.js +27 -28
- package/dist/components/inputs/react-query-builder/custom-react-query-builder.js +25 -31
- package/dist/components/inputs/react-query-builder/element-value-editor.js +1 -10
- package/dist/components/inputs/react-query-builder/property-value-editor.js +6 -11
- package/dist/components/inputs/react-query-builder/remove-button.js +1 -9
- package/dist/components/inputs/react-query-builder/text-value-editor.js +2 -1
- package/dist/components/inputs/react-query-builder/translated-value-editor.js +3 -4
- package/dist/components/inputs/react-query-builder/use-convert-value.d.ts +1 -1
- package/dist/components/inputs/react-query-builder/use-convert-value.js +1 -6
- package/dist/components/inputs/react-query-builder/value-editor.js +4 -20
- package/dist/components/translations/filter-expert-en.d.ts +2 -0
- package/dist/components/translations/filter-expert-en.js +3 -1
- package/dist/components/translations/filter-expert-fr.d.ts +2 -0
- package/dist/components/translations/filter-expert-fr.js +3 -1
- package/dist/hooks/localized-countries-hook.js +1 -3
- package/dist/hooks/useConfidentialityWarning.d.ts +8 -0
- package/dist/hooks/useConfidentialityWarning.js +14 -0
- package/dist/hooks/useDebounce.js +1 -4
- package/dist/hooks/useSnackMessage.js +3 -12
- package/dist/index.d.ts +10 -9
- package/dist/index.js +77 -73
- package/dist/services/apps-metadata.d.ts +7 -0
- package/dist/services/apps-metadata.js +13 -0
- package/dist/services/directory.js +3 -11
- package/dist/services/explore.js +2 -8
- package/dist/services/index.js +3 -1
- package/dist/services/utils.js +4 -12
- package/dist/utils/AuthService.js +8 -29
- package/dist/utils/UserManagerMock.js +6 -23
- package/dist/utils/styles.js +1 -6
- package/package.json +1 -1
|
@@ -57,12 +57,8 @@ function TreeViewFinder(props) {
|
|
|
57
57
|
expanded: expandedProp
|
|
58
58
|
} = props;
|
|
59
59
|
const [mapPrintedNodes, setMapPrintedNodes] = useState({});
|
|
60
|
-
const [expanded, setExpanded] = useState(
|
|
61
|
-
|
|
62
|
-
);
|
|
63
|
-
const [selected, setSelected] = useState(
|
|
64
|
-
defaultSelected ?? []
|
|
65
|
-
);
|
|
60
|
+
const [expanded, setExpanded] = useState(defaultExpanded ?? []);
|
|
61
|
+
const [selected, setSelected] = useState(defaultSelected ?? []);
|
|
66
62
|
const scrollRef = useRef([]);
|
|
67
63
|
const [autoScrollAllowed, setAutoScrollAllowed] = useState(true);
|
|
68
64
|
const isLeaf = (node) => {
|
|
@@ -74,22 +70,16 @@ function TreeViewFinder(props) {
|
|
|
74
70
|
const isValidationDisabled = () => {
|
|
75
71
|
return (selected == null ? void 0 : selected.length) === 0 || (selected == null ? void 0 : selected.length) === (selectedProp == null ? void 0 : selectedProp.length) && (selected == null ? void 0 : selected.every((nodeId) => selectedProp == null ? void 0 : selectedProp.includes(nodeId)));
|
|
76
72
|
};
|
|
77
|
-
const computeMapPrintedNodes = useCallback(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
return newMapPrintedNodes;
|
|
90
|
-
},
|
|
91
|
-
[]
|
|
92
|
-
);
|
|
73
|
+
const computeMapPrintedNodes = useCallback((nodes) => {
|
|
74
|
+
const newMapPrintedNodes = {};
|
|
75
|
+
nodes == null ? void 0 : nodes.forEach((node) => {
|
|
76
|
+
newMapPrintedNodes[node.id] = node;
|
|
77
|
+
if (!isLeaf(node)) {
|
|
78
|
+
Object.assign(newMapPrintedNodes, computeMapPrintedNodes(node.children));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return newMapPrintedNodes;
|
|
82
|
+
}, []);
|
|
93
83
|
useEffect(() => {
|
|
94
84
|
const newMapPrintedNodes = computeMapPrintedNodes(data);
|
|
95
85
|
setMapPrintedNodes(newMapPrintedNodes);
|
|
@@ -117,10 +107,7 @@ function TreeViewFinder(props) {
|
|
|
117
107
|
return;
|
|
118
108
|
}
|
|
119
109
|
if (selectedProp.length > 0) {
|
|
120
|
-
setSelected((oldSelectedNodes) => [
|
|
121
|
-
...oldSelectedNodes ?? [],
|
|
122
|
-
...selectedProp
|
|
123
|
-
]);
|
|
110
|
+
setSelected((oldSelectedNodes) => [...oldSelectedNodes ?? [], ...selectedProp]);
|
|
124
111
|
}
|
|
125
112
|
}, [selectedProp]);
|
|
126
113
|
useEffect(() => {
|
|
@@ -128,10 +115,7 @@ function TreeViewFinder(props) {
|
|
|
128
115
|
return;
|
|
129
116
|
}
|
|
130
117
|
if (expandedProp.length > 0) {
|
|
131
|
-
setExpanded((oldExpandedNodes) => [
|
|
132
|
-
...oldExpandedNodes ?? [],
|
|
133
|
-
...expandedProp
|
|
134
|
-
]);
|
|
118
|
+
setExpanded((oldExpandedNodes) => [...oldExpandedNodes ?? [], ...expandedProp]);
|
|
135
119
|
}
|
|
136
120
|
}, [expandedProp]);
|
|
137
121
|
useEffect(() => {
|
|
@@ -139,9 +123,7 @@ function TreeViewFinder(props) {
|
|
|
139
123
|
return;
|
|
140
124
|
}
|
|
141
125
|
if (selectedProp.length > 0 && autoScrollAllowed) {
|
|
142
|
-
const isNodeExpanded = expandedProp == null ? void 0 : expandedProp.every(
|
|
143
|
-
(nodeId) => expanded == null ? void 0 : expanded.includes(nodeId)
|
|
144
|
-
);
|
|
126
|
+
const isNodeExpanded = expandedProp == null ? void 0 : expandedProp.every((nodeId) => expanded == null ? void 0 : expanded.includes(nodeId));
|
|
145
127
|
const lastScrollRef = scrollRef.current[scrollRef.current.length - 1];
|
|
146
128
|
if (isNodeExpanded && lastScrollRef) {
|
|
147
129
|
lastScrollRef.scrollIntoView({
|
|
@@ -155,16 +137,12 @@ function TreeViewFinder(props) {
|
|
|
155
137
|
}, [expanded, selectedProp, expandedProp, data, autoScrollAllowed]);
|
|
156
138
|
const handleNodeSelect = (_e, values) => {
|
|
157
139
|
if (multiSelect && Array.isArray(values)) {
|
|
158
|
-
setSelected(
|
|
159
|
-
values.filter((nodeId) => isSelectable(mapPrintedNodes[nodeId]))
|
|
160
|
-
);
|
|
140
|
+
setSelected(values.filter((nodeId) => isSelectable(mapPrintedNodes[nodeId])));
|
|
161
141
|
} else if (!Array.isArray(values)) {
|
|
162
142
|
if (selected == null ? void 0 : selected.includes(values)) {
|
|
163
143
|
setSelected([]);
|
|
164
144
|
} else {
|
|
165
|
-
setSelected(
|
|
166
|
-
isSelectable(mapPrintedNodes[values]) ? [values] : []
|
|
167
|
-
);
|
|
145
|
+
setSelected(isSelectable(mapPrintedNodes[values]) ? [values] : []);
|
|
168
146
|
}
|
|
169
147
|
}
|
|
170
148
|
};
|
|
@@ -214,9 +192,7 @@ function TreeViewFinder(props) {
|
|
|
214
192
|
if (Array.isArray(node.children)) {
|
|
215
193
|
if (node.children.length) {
|
|
216
194
|
const sortedChildren = node.children.sort(sortMethod);
|
|
217
|
-
childrenNodes = sortedChildren.map(
|
|
218
|
-
(child) => renderTree(child)
|
|
219
|
-
);
|
|
195
|
+
childrenNodes = sortedChildren.map((child) => renderTree(child));
|
|
220
196
|
} else {
|
|
221
197
|
childrenNodes = [false];
|
|
222
198
|
}
|
|
@@ -226,18 +202,8 @@ function TreeViewFinder(props) {
|
|
|
226
202
|
{
|
|
227
203
|
nodeId: node.id,
|
|
228
204
|
label: renderTreeItemLabel(node),
|
|
229
|
-
expandIcon: showChevron(node) ? /* @__PURE__ */ jsx(
|
|
230
|
-
|
|
231
|
-
{
|
|
232
|
-
className: composeClasses(classes, cssIcon)
|
|
233
|
-
}
|
|
234
|
-
) : null,
|
|
235
|
-
collapseIcon: showChevron(node) ? /* @__PURE__ */ jsx(
|
|
236
|
-
ExpandMore,
|
|
237
|
-
{
|
|
238
|
-
className: composeClasses(classes, cssIcon)
|
|
239
|
-
}
|
|
240
|
-
) : null,
|
|
205
|
+
expandIcon: showChevron(node) ? /* @__PURE__ */ jsx(ChevronRight, { className: composeClasses(classes, cssIcon) }) : null,
|
|
206
|
+
collapseIcon: showChevron(node) ? /* @__PURE__ */ jsx(ExpandMore, { className: composeClasses(classes, cssIcon) }) : null,
|
|
241
207
|
ref: (element) => {
|
|
242
208
|
if (selectedProp == null ? void 0 : selectedProp.includes(node.id)) {
|
|
243
209
|
scrollRef.current.push(element);
|
|
@@ -276,15 +242,9 @@ function TreeViewFinder(props) {
|
|
|
276
242
|
paper: composeClasses(classes, cssDialogPaper)
|
|
277
243
|
},
|
|
278
244
|
children: [
|
|
279
|
-
/* @__PURE__ */ jsx(DialogTitle, { id: "TreeViewFindertitle", children: title ?? intl.formatMessage(
|
|
280
|
-
{ id: "treeview_finder/finderTitle" },
|
|
281
|
-
{ multiSelect }
|
|
282
|
-
) }),
|
|
245
|
+
/* @__PURE__ */ jsx(DialogTitle, { id: "TreeViewFindertitle", children: title ?? intl.formatMessage({ id: "treeview_finder/finderTitle" }, { multiSelect }) }),
|
|
283
246
|
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
284
|
-
/* @__PURE__ */ jsx(DialogContentText, { children: contentText ?? intl.formatMessage(
|
|
285
|
-
{ id: "treeview_finder/contentText" },
|
|
286
|
-
{ multiSelect }
|
|
287
|
-
) }),
|
|
247
|
+
/* @__PURE__ */ jsx(DialogContentText, { children: contentText ?? intl.formatMessage({ id: "treeview_finder/contentText" }, { multiSelect }) }),
|
|
288
248
|
/* @__PURE__ */ jsx(
|
|
289
249
|
TreeView,
|
|
290
250
|
{
|
|
@@ -328,10 +288,7 @@ function TreeViewFinder(props) {
|
|
|
328
288
|
}
|
|
329
289
|
);
|
|
330
290
|
}
|
|
331
|
-
const nestedGlobalSelectorsStyles = toNestedGlobalSelectors(
|
|
332
|
-
defaultStyles,
|
|
333
|
-
generateTreeViewFinderClass
|
|
334
|
-
);
|
|
291
|
+
const nestedGlobalSelectorsStyles = toNestedGlobalSelectors(defaultStyles, generateTreeViewFinderClass);
|
|
335
292
|
const TreeViewFinder$1 = styled(TreeViewFinder)(nestedGlobalSelectorsStyles);
|
|
336
293
|
export {
|
|
337
294
|
TreeViewFinder$1 as default,
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
*/
|
|
7
|
-
export { default as TreeViewFinder, generateTreeViewFinderClass
|
|
8
|
-
export type { TreeViewFinderProps, TreeViewFinderNodeProps
|
|
7
|
+
export { default as TreeViewFinder, generateTreeViewFinderClass } from './TreeViewFinder';
|
|
8
|
+
export type { TreeViewFinderProps, TreeViewFinderNodeProps } from './TreeViewFinder';
|
|
@@ -17,6 +17,7 @@ interface ICustomMuiDialog {
|
|
|
17
17
|
children: React.ReactNode;
|
|
18
18
|
isDataFetching?: boolean;
|
|
19
19
|
language?: string;
|
|
20
|
+
confirmationMessageKey?: string;
|
|
20
21
|
}
|
|
21
|
-
declare function CustomMuiDialog({ open, formSchema, formMethods, onClose, onSave, isDataFetching, onValidationError, titleId, disabledSave, removeOptional, onCancel, children, language, }: ICustomMuiDialog): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function CustomMuiDialog({ open, formSchema, formMethods, onClose, onSave, isDataFetching, onValidationError, titleId, disabledSave, removeOptional, onCancel, children, language, confirmationMessageKey, }: ICustomMuiDialog): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export default CustomMuiDialog;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
2
3
|
import { FormattedMessage } from "react-intl";
|
|
3
4
|
import { Dialog, LinearProgress, DialogTitle, Grid, DialogContent, DialogActions } from "@mui/material";
|
|
4
5
|
import SubmitButton from "../inputs/react-hook-form/utils/submit-button.js";
|
|
5
6
|
import CancelButton from "../inputs/react-hook-form/utils/cancel-button.js";
|
|
6
7
|
import CustomFormProvider from "../inputs/react-hook-form/provider/custom-form-provider.js";
|
|
8
|
+
import PopupConfirmationDialog from "./popup-confirmation-dialog.js";
|
|
7
9
|
const styles = {
|
|
8
10
|
dialogPaper: {
|
|
9
11
|
".MuiDialog-paper": {
|
|
@@ -26,61 +28,84 @@ function CustomMuiDialog({
|
|
|
26
28
|
removeOptional = false,
|
|
27
29
|
onCancel,
|
|
28
30
|
children,
|
|
29
|
-
language
|
|
31
|
+
language,
|
|
32
|
+
confirmationMessageKey
|
|
30
33
|
}) {
|
|
34
|
+
const [openConfirmationPopup, setOpenConfirmationPopup] = useState(false);
|
|
35
|
+
const [validatedData, setValidatedData] = useState(void 0);
|
|
31
36
|
const { handleSubmit } = formMethods;
|
|
32
|
-
const handleCancel = (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
const handleCancel = useCallback(
|
|
38
|
+
(event) => {
|
|
39
|
+
onCancel == null ? void 0 : onCancel();
|
|
40
|
+
onClose(event);
|
|
41
|
+
},
|
|
42
|
+
[onCancel, onClose]
|
|
43
|
+
);
|
|
36
44
|
const handleClose = (event, reason) => {
|
|
37
45
|
if (reason === "backdropClick" && onCancel) {
|
|
38
46
|
onCancel();
|
|
39
47
|
}
|
|
40
48
|
onClose(event);
|
|
41
49
|
};
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
const validate = useCallback(
|
|
51
|
+
(data) => {
|
|
52
|
+
onSave(data);
|
|
53
|
+
onClose(data);
|
|
54
|
+
},
|
|
55
|
+
[onClose, onSave]
|
|
56
|
+
);
|
|
57
|
+
const handleValidate = useCallback(
|
|
58
|
+
(data) => {
|
|
59
|
+
if (confirmationMessageKey) {
|
|
60
|
+
setValidatedData(data);
|
|
61
|
+
setOpenConfirmationPopup(true);
|
|
62
|
+
} else {
|
|
63
|
+
validate(data);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
[confirmationMessageKey, validate]
|
|
67
|
+
);
|
|
68
|
+
const handlePopupConfirmation = useCallback(() => {
|
|
69
|
+
setOpenConfirmationPopup(false);
|
|
70
|
+
validate(validatedData);
|
|
71
|
+
}, [validate, validatedData]);
|
|
46
72
|
const handleValidationError = (errors) => {
|
|
47
73
|
onValidationError == null ? void 0 : onValidationError(errors);
|
|
48
74
|
};
|
|
49
|
-
return /* @__PURE__ */
|
|
75
|
+
return /* @__PURE__ */ jsxs(
|
|
50
76
|
CustomFormProvider,
|
|
51
77
|
{
|
|
52
78
|
...formMethods,
|
|
53
79
|
validationSchema: formSchema,
|
|
54
80
|
removeOptional,
|
|
55
81
|
language,
|
|
56
|
-
children:
|
|
57
|
-
Dialog,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ jsxs(Dialog, { sx: styles.dialogPaper, open, onClose: handleClose, fullWidth: true, children: [
|
|
84
|
+
isDataFetching && /* @__PURE__ */ jsx(LinearProgress, {}),
|
|
85
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 11, children: /* @__PURE__ */ jsx(FormattedMessage, { id: titleId }) }) }),
|
|
86
|
+
/* @__PURE__ */ jsx(DialogContent, { children }),
|
|
87
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
88
|
+
/* @__PURE__ */ jsx(CancelButton, { onClick: handleCancel }),
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
SubmitButton,
|
|
91
|
+
{
|
|
92
|
+
variant: "outlined",
|
|
93
|
+
disabled: disabledSave,
|
|
94
|
+
onClick: handleSubmit(handleValidate, handleValidationError)
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] })
|
|
98
|
+
] }),
|
|
99
|
+
confirmationMessageKey && /* @__PURE__ */ jsx(
|
|
100
|
+
PopupConfirmationDialog,
|
|
101
|
+
{
|
|
102
|
+
message: confirmationMessageKey,
|
|
103
|
+
openConfirmationPopup,
|
|
104
|
+
setOpenConfirmationPopup,
|
|
105
|
+
handlePopupConfirmation
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
]
|
|
84
109
|
}
|
|
85
110
|
);
|
|
86
111
|
}
|
|
@@ -27,9 +27,7 @@ function ModifyElementSelection(props) {
|
|
|
27
27
|
useEffect(() => {
|
|
28
28
|
if (directory) {
|
|
29
29
|
fetchDirectoryElementPath(directory).then((res) => {
|
|
30
|
-
setActiveDirectoryName(
|
|
31
|
-
res.map((element) => element.elementName.trim()).join("/")
|
|
32
|
-
);
|
|
30
|
+
setActiveDirectoryName(res.map((element) => element.elementName.trim()).join("/"));
|
|
33
31
|
});
|
|
34
32
|
}
|
|
35
33
|
}, [directory]);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export interface PopupConfirmationDialogProps {
|
|
8
8
|
message: string;
|
|
9
|
-
validateButtonLabel
|
|
9
|
+
validateButtonLabel?: string;
|
|
10
10
|
openConfirmationPopup: boolean;
|
|
11
11
|
setOpenConfirmationPopup: (value: boolean) => void;
|
|
12
12
|
handlePopupConfirmation: () => void;
|
|
@@ -14,21 +14,14 @@ function PopupConfirmationDialog({
|
|
|
14
14
|
setOpenConfirmationPopup,
|
|
15
15
|
handlePopupConfirmation
|
|
16
16
|
}) {
|
|
17
|
-
return /* @__PURE__ */ jsxs(
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
children:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
26
|
-
/* @__PURE__ */ jsx(CancelButton, { onClick: () => setOpenConfirmationPopup(false) }),
|
|
27
|
-
/* @__PURE__ */ jsx(Button, { onClick: handlePopupConfirmation, variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: validateButtonLabel ?? "validate" }) })
|
|
28
|
-
] })
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
);
|
|
17
|
+
return /* @__PURE__ */ jsxs(Dialog, { open: openConfirmationPopup, "aria-labelledby": "dialog-title-change-equipment-type", children: [
|
|
18
|
+
/* @__PURE__ */ jsx(DialogTitle, { id: "dialog-title-change-equipment-type", children: "Confirmation" }),
|
|
19
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(DialogContentText, { children: message && /* @__PURE__ */ jsx(FormattedMessage, { id: message }) }) }),
|
|
20
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
21
|
+
/* @__PURE__ */ jsx(CancelButton, { onClick: () => setOpenConfirmationPopup(false) }),
|
|
22
|
+
/* @__PURE__ */ jsx(Button, { onClick: handlePopupConfirmation, variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: validateButtonLabel ?? "validate" }) })
|
|
23
|
+
] })
|
|
24
|
+
] });
|
|
32
25
|
}
|
|
33
26
|
export {
|
|
34
27
|
PopupConfirmationDialog as default
|
|
@@ -72,10 +72,7 @@ function CriteriaBasedFilterEditionDialog({
|
|
|
72
72
|
}, [id, name, open, reset, snackError, getFilterById]);
|
|
73
73
|
const onSubmit = useCallback(
|
|
74
74
|
(filterForm) => {
|
|
75
|
-
saveFilter(
|
|
76
|
-
frontToBackTweak(id, filterForm),
|
|
77
|
-
filterForm[FieldConstants.NAME]
|
|
78
|
-
).then(() => {
|
|
75
|
+
saveFilter(frontToBackTweak(id, filterForm), filterForm[FieldConstants.NAME]).then(() => {
|
|
79
76
|
if (selectionForCopy.sourceItemUuid === id) {
|
|
80
77
|
setSelelectionForCopy(noSelectionForCopy);
|
|
81
78
|
broadcastChannel.postMessage({
|
|
@@ -88,13 +85,7 @@ function CriteriaBasedFilterEditionDialog({
|
|
|
88
85
|
});
|
|
89
86
|
});
|
|
90
87
|
},
|
|
91
|
-
[
|
|
92
|
-
broadcastChannel,
|
|
93
|
-
id,
|
|
94
|
-
selectionForCopy.sourceItemUuid,
|
|
95
|
-
snackError,
|
|
96
|
-
setSelelectionForCopy
|
|
97
|
-
]
|
|
88
|
+
[broadcastChannel, id, selectionForCopy.sourceItemUuid, snackError, setSelelectionForCopy]
|
|
98
89
|
);
|
|
99
90
|
const isDataReady = dataFetchStatus === FetchStatus.FETCH_SUCCESS;
|
|
100
91
|
return /* @__PURE__ */ jsx(
|
|
@@ -110,13 +101,7 @@ function CriteriaBasedFilterEditionDialog({
|
|
|
110
101
|
disabledSave: !!nameError || !!isValidating,
|
|
111
102
|
isDataFetching: dataFetchStatus === FetchStatus.FETCHING,
|
|
112
103
|
language,
|
|
113
|
-
children: isDataReady && /* @__PURE__ */ jsx(
|
|
114
|
-
FilterForm,
|
|
115
|
-
{
|
|
116
|
-
activeDirectory,
|
|
117
|
-
elementExists
|
|
118
|
-
}
|
|
119
|
-
)
|
|
104
|
+
children: isDataReady && /* @__PURE__ */ jsx(FilterForm, { activeDirectory, elementExists })
|
|
120
105
|
}
|
|
121
106
|
);
|
|
122
107
|
}
|
|
@@ -104,19 +104,13 @@ function cleanNominalVoltages(formValues) {
|
|
|
104
104
|
if (isNominalVoltageEmpty(cleanedFormValues[FieldConstants.NOMINAL_VOLTAGE])) {
|
|
105
105
|
cleanedFormValues[FieldConstants.NOMINAL_VOLTAGE] = null;
|
|
106
106
|
}
|
|
107
|
-
if (isNominalVoltageEmpty(
|
|
108
|
-
cleanedFormValues[FieldConstants.NOMINAL_VOLTAGE_1]
|
|
109
|
-
)) {
|
|
107
|
+
if (isNominalVoltageEmpty(cleanedFormValues[FieldConstants.NOMINAL_VOLTAGE_1])) {
|
|
110
108
|
cleanedFormValues[FieldConstants.NOMINAL_VOLTAGE_1] = null;
|
|
111
109
|
}
|
|
112
|
-
if (isNominalVoltageEmpty(
|
|
113
|
-
cleanedFormValues[FieldConstants.NOMINAL_VOLTAGE_2]
|
|
114
|
-
)) {
|
|
110
|
+
if (isNominalVoltageEmpty(cleanedFormValues[FieldConstants.NOMINAL_VOLTAGE_2])) {
|
|
115
111
|
cleanedFormValues[FieldConstants.NOMINAL_VOLTAGE_2] = null;
|
|
116
112
|
}
|
|
117
|
-
if (isNominalVoltageEmpty(
|
|
118
|
-
cleanedFormValues[FieldConstants.NOMINAL_VOLTAGE_3]
|
|
119
|
-
)) {
|
|
113
|
+
if (isNominalVoltageEmpty(cleanedFormValues[FieldConstants.NOMINAL_VOLTAGE_3])) {
|
|
120
114
|
cleanedFormValues[FieldConstants.NOMINAL_VOLTAGE_3] = null;
|
|
121
115
|
}
|
|
122
116
|
return cleanedFormValues;
|
|
@@ -4,5 +4,5 @@ export interface CriteriaBasedFormProps {
|
|
|
4
4
|
equipments: Record<string, FormEquipment>;
|
|
5
5
|
defaultValues: Record<string, any>;
|
|
6
6
|
}
|
|
7
|
-
declare function CriteriaBasedForm({ equipments, defaultValues
|
|
7
|
+
declare function CriteriaBasedForm({ equipments, defaultValues }: CriteriaBasedFormProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export default CriteriaBasedForm;
|
|
@@ -6,10 +6,7 @@ import FieldConstants from "../../../utils/field-constants.js";
|
|
|
6
6
|
import SelectInput from "../../inputs/react-hook-form/select-inputs/select-input.js";
|
|
7
7
|
import InputWithPopupConfirmation from "../../inputs/react-hook-form/select-inputs/input-with-popup-confirmation.js";
|
|
8
8
|
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
9
|
-
function CriteriaBasedForm({
|
|
10
|
-
equipments,
|
|
11
|
-
defaultValues
|
|
12
|
-
}) {
|
|
9
|
+
function CriteriaBasedForm({ equipments, defaultValues }) {
|
|
13
10
|
const { getValues, setValue } = useFormContext();
|
|
14
11
|
const { snackError } = useSnackMessage();
|
|
15
12
|
const watchEquipmentType = useWatch({
|
|
@@ -27,10 +24,7 @@ function CriteriaBasedForm({
|
|
|
27
24
|
};
|
|
28
25
|
const handleResetOnConfirmation = () => {
|
|
29
26
|
Object.keys(defaultValues).forEach(
|
|
30
|
-
(field) => setValue(
|
|
31
|
-
`${FieldConstants.CRITERIA_BASED}.${field}`,
|
|
32
|
-
defaultValues[field]
|
|
33
|
-
)
|
|
27
|
+
(field) => setValue(`${FieldConstants.CRITERIA_BASED}.${field}`, defaultValues[field])
|
|
34
28
|
);
|
|
35
29
|
};
|
|
36
30
|
return /* @__PURE__ */ jsxs(Grid, { container: true, item: true, spacing: 2, children: [
|
|
@@ -47,13 +41,11 @@ function CriteriaBasedForm({
|
|
|
47
41
|
validateButtonLabel: "button.changeType"
|
|
48
42
|
}
|
|
49
43
|
) }),
|
|
50
|
-
watchEquipmentType && equipments[watchEquipmentType] && equipments[watchEquipmentType].fields.map(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
)
|
|
44
|
+
watchEquipmentType && equipments[watchEquipmentType] && equipments[watchEquipmentType].fields.map((equipment, index) => {
|
|
45
|
+
const EquipmentForm = equipment.renderer;
|
|
46
|
+
const uniqueKey = `${watchEquipmentType}-${index}`;
|
|
47
|
+
return /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, flexGrow: 1, children: /* @__PURE__ */ jsx(EquipmentForm, { ...equipment.props }) }, uniqueKey);
|
|
48
|
+
})
|
|
57
49
|
] });
|
|
58
50
|
}
|
|
59
51
|
export {
|
|
@@ -8,5 +8,5 @@ interface FilterFreePropertiesProps {
|
|
|
8
8
|
freePropertiesType: FreePropertiesTypes;
|
|
9
9
|
predefined: PredefinedProperties;
|
|
10
10
|
}
|
|
11
|
-
declare function FilterFreeProperties({ freePropertiesType, predefined
|
|
11
|
+
declare function FilterFreeProperties({ freePropertiesType, predefined }: FilterFreePropertiesProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export default FilterFreeProperties;
|
|
@@ -14,10 +14,7 @@ var FreePropertiesTypes = /* @__PURE__ */ ((FreePropertiesTypes2) => {
|
|
|
14
14
|
FreePropertiesTypes2["FREE_FILTER_PROPERTIES"] = "freeProperties";
|
|
15
15
|
return FreePropertiesTypes2;
|
|
16
16
|
})(FreePropertiesTypes || {});
|
|
17
|
-
function FilterFreeProperties({
|
|
18
|
-
freePropertiesType,
|
|
19
|
-
predefined
|
|
20
|
-
}) {
|
|
17
|
+
function FilterFreeProperties({ freePropertiesType, predefined }) {
|
|
21
18
|
const watchEquipmentType = useWatch({
|
|
22
19
|
name: FieldConstants.EQUIPMENT_TYPE
|
|
23
20
|
});
|
|
@@ -45,19 +45,15 @@ const filterPropertiesYupSchema = {
|
|
|
45
45
|
(values, context) => propertyValuesTest(values, context, true)
|
|
46
46
|
)
|
|
47
47
|
})
|
|
48
|
-
).test(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
(
|
|
52
|
-
|
|
53
|
-
const filterType = rootLevelForm.value[FieldConstants.FILTER_TYPE];
|
|
54
|
-
if (filterType !== FilterType.CRITERIA_BASED.id) {
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
const names = properties.filter((prop) => !!prop[PROPERTY_NAME]).map((prop) => prop[PROPERTY_NAME]);
|
|
58
|
-
return areArrayElementsUnique(names);
|
|
48
|
+
).test("distinct names", "filterPropertiesNameUniquenessError", (properties, context) => {
|
|
49
|
+
const rootLevelForm = context.from[context.from.length - 1];
|
|
50
|
+
const filterType = rootLevelForm.value[FieldConstants.FILTER_TYPE];
|
|
51
|
+
if (filterType !== FilterType.CRITERIA_BASED.id) {
|
|
52
|
+
return true;
|
|
59
53
|
}
|
|
60
|
-
|
|
54
|
+
const names = properties.filter((prop) => !!prop[PROPERTY_NAME]).map((prop) => prop[PROPERTY_NAME]);
|
|
55
|
+
return areArrayElementsUnique(names);
|
|
56
|
+
}),
|
|
61
57
|
[FreePropertiesTypes.FREE_FILTER_PROPERTIES]: yup.array().of(
|
|
62
58
|
yup.object().shape({
|
|
63
59
|
[PROPERTY_NAME]: yup.string().required(),
|
|
@@ -67,19 +63,15 @@ const filterPropertiesYupSchema = {
|
|
|
67
63
|
(values, context) => propertyValuesTest(values, context, false)
|
|
68
64
|
)
|
|
69
65
|
})
|
|
70
|
-
).test(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
(
|
|
74
|
-
|
|
75
|
-
const filterType = rootLevelForm.value[FieldConstants.FILTER_TYPE];
|
|
76
|
-
if (filterType !== FilterType.CRITERIA_BASED.id) {
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
const names = properties.filter((prop) => !!prop[PROPERTY_NAME]).map((prop) => prop[PROPERTY_NAME]);
|
|
80
|
-
return areArrayElementsUnique(names);
|
|
66
|
+
).test("distinct names", "filterPropertiesNameUniquenessError", (properties, context) => {
|
|
67
|
+
const rootLevelForm = context.from[context.from.length - 1];
|
|
68
|
+
const filterType = rootLevelForm.value[FieldConstants.FILTER_TYPE];
|
|
69
|
+
if (filterType !== FilterType.CRITERIA_BASED.id) {
|
|
70
|
+
return true;
|
|
81
71
|
}
|
|
82
|
-
|
|
72
|
+
const names = properties.filter((prop) => !!prop[PROPERTY_NAME]).map((prop) => prop[PROPERTY_NAME]);
|
|
73
|
+
return areArrayElementsUnique(names);
|
|
74
|
+
})
|
|
83
75
|
};
|
|
84
76
|
function FilterProperties() {
|
|
85
77
|
const watchEquipmentType = useWatch({
|
|
@@ -29,10 +29,7 @@ function FilterProperty(props) {
|
|
|
29
29
|
}, [watchName, predefined]);
|
|
30
30
|
const onNameChange = useCallback(() => {
|
|
31
31
|
valuesFields.forEach(
|
|
32
|
-
(valuesField) => setValue(
|
|
33
|
-
`${FieldConstants.CRITERIA_BASED}.${propertyType}[${index}].${valuesField.name}`,
|
|
34
|
-
[]
|
|
35
|
-
)
|
|
32
|
+
(valuesField) => setValue(`${FieldConstants.CRITERIA_BASED}.${propertyType}[${index}].${valuesField.name}`, [])
|
|
36
33
|
);
|
|
37
34
|
}, [setValue, index, valuesFields, propertyType]);
|
|
38
35
|
return /* @__PURE__ */ jsxs(Grid, { container: true, item: true, spacing: 1, columns: 21, children: [
|
|
@@ -244,7 +244,6 @@ export declare const FIELDS_OPTIONS: {
|
|
|
244
244
|
label: string;
|
|
245
245
|
dataType: DataType;
|
|
246
246
|
valueEditorType: string;
|
|
247
|
-
defaultValue: string;
|
|
248
247
|
};
|
|
249
248
|
VOLTAGE_REGULATOR_ON: {
|
|
250
249
|
name: FieldType;
|
|
@@ -485,14 +484,12 @@ export declare const FIELDS_OPTIONS: {
|
|
|
485
484
|
label: string;
|
|
486
485
|
dataType: DataType;
|
|
487
486
|
valueEditorType: string;
|
|
488
|
-
defaultValue: string;
|
|
489
487
|
};
|
|
490
488
|
COUNTRY_2: {
|
|
491
489
|
name: FieldType;
|
|
492
490
|
label: string;
|
|
493
491
|
dataType: DataType;
|
|
494
492
|
valueEditorType: string;
|
|
495
|
-
defaultValue: string;
|
|
496
493
|
};
|
|
497
494
|
SERIE_RESISTANCE: {
|
|
498
495
|
name: FieldType;
|
|
@@ -1069,5 +1066,15 @@ export declare const FIELDS_OPTIONS: {
|
|
|
1069
1066
|
dataType: DataType;
|
|
1070
1067
|
inputType: string;
|
|
1071
1068
|
};
|
|
1069
|
+
PAIRING_KEY: {
|
|
1070
|
+
name: FieldType;
|
|
1071
|
+
label: string;
|
|
1072
|
+
dataType: DataType;
|
|
1073
|
+
};
|
|
1074
|
+
TIE_LINE_ID: {
|
|
1075
|
+
name: FieldType;
|
|
1076
|
+
label: string;
|
|
1077
|
+
dataType: DataType;
|
|
1078
|
+
};
|
|
1072
1079
|
};
|
|
1073
1080
|
export declare const fields: Record<string, Field[]>;
|