@gridsuite/commons-ui 0.132.0 → 0.134.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/dist/components/authentication/utils/authService.js +6 -9
- package/dist/components/checkBoxList/CheckBoxList.js +1 -1
- package/dist/components/checkBoxList/CheckBoxListItem.js +3 -3
- package/dist/components/checkBoxList/CheckBoxListItemContent.js +3 -3
- package/dist/components/checkBoxList/CheckBoxListItems.js +4 -4
- package/dist/components/checkBoxList/DraggableCheckBoxListItem.js +5 -5
- package/dist/components/checkBoxList/DraggableCheckBoxListItemContent.js +1 -1
- package/dist/components/contingencyList/criteriaBased/criteriaBasedUtils.js +7 -7
- package/dist/components/csvDownloader/use-csv-export.js +1 -4
- package/dist/components/customAGGrid/customAggrid.js +2 -2
- package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +2 -2
- package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js +1 -2
- package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +6 -6
- package/dist/components/dialogs/elementSaveDialog/utils.js +1 -1
- package/dist/components/dialogs/modifyElementSelection/ModifyElementSelection.js +1 -1
- package/dist/components/directoryItemSelector/DirectoryItemSelector.js +3 -4
- package/dist/components/dnd-table/dnd-table-bottom-right-buttons.js +2 -3
- package/dist/components/dnd-table/dnd-table.js +7 -7
- package/dist/components/elementSearch/elementItem/EquipmentItem.js +6 -7
- package/dist/components/elementSearch/elementSearchDialog/ElementSearchDialog.js +1 -1
- package/dist/components/elementSearch/tagRenderer/TagRenderer.js +3 -4
- package/dist/components/filter/FilterCreationDialog.js +23 -13
- package/dist/components/filter/FilterForm.js +2 -2
- package/dist/components/filter/expert/ExpertFilterEditionDialog.js +13 -6
- package/dist/components/filter/expert/ExpertFilterForm.d.ts +0 -1
- package/dist/components/filter/expert/ExpertFilterForm.js +11 -21
- package/dist/components/filter/expert/expertFilterConstants.d.ts +13 -12
- package/dist/components/filter/expert/expertFilterConstants.js +17 -48
- package/dist/components/filter/expert/expertFilterUtils.js +21 -25
- package/dist/components/filter/expert/index.js +1 -2
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +2 -4
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +11 -18
- package/dist/components/filter/index.js +1 -2
- package/dist/components/filter/utils/filterApi.js +14 -6
- package/dist/components/flatParameters/FlatParameters.js +2 -2
- package/dist/components/index.js +1 -4
- package/dist/components/inputs/SelectClearable.js +1 -1
- package/dist/components/inputs/index.js +0 -2
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +44 -48
- package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +3 -4
- package/dist/components/inputs/reactHookForm/agGridTable/csvUploader/CsvUploader.js +1 -1
- package/dist/components/inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js +4 -4
- package/dist/components/inputs/reactHookForm/chip-items-input.js +3 -3
- package/dist/components/inputs/reactHookForm/errorManagement/ErrorInput.js +1 -2
- package/dist/components/inputs/reactHookForm/index.js +0 -2
- package/dist/components/inputs/reactHookForm/numbers/FloatInput.js +1 -1
- package/dist/components/inputs/reactHookForm/numbers/SliderInput.js +1 -1
- package/dist/components/inputs/reactHookForm/selectInputs/InputWithPopupConfirmation.js +2 -2
- package/dist/components/inputs/reactHookForm/selectInputs/SelectInput.js +3 -3
- package/dist/components/inputs/reactHookForm/tableInputs/table-numerical-input.js +4 -4
- package/dist/components/inputs/reactHookForm/tableInputs/table-text-input.js +3 -3
- package/dist/components/inputs/reactHookForm/text/ExpandingTextField.js +2 -2
- package/dist/components/inputs/reactHookForm/text/TextInput.js +5 -5
- package/dist/components/inputs/reactHookForm/text/UniqueNameInput.js +2 -2
- package/dist/components/inputs/reactHookForm/utils/SubmitButton.js +1 -1
- package/dist/components/inputs/reactHookForm/utils/functions.js +2 -3
- package/dist/components/inputs/reactHookForm/utils/index.d.ts +0 -1
- package/dist/components/inputs/reactHookForm/utils/index.js +0 -2
- package/dist/components/inputs/reactQueryBuilder/OperatorSelector.js +2 -2
- package/dist/components/inputs/reactQueryBuilder/PropertyValueEditor.js +8 -9
- package/dist/components/inputs/reactQueryBuilder/TextValueEditor.js +1 -1
- package/dist/components/inputs/reactQueryBuilder/TranslatedValueEditor.js +1 -1
- package/dist/components/inputs/reactQueryBuilder/ValueEditor.js +2 -3
- package/dist/components/inputs/reactQueryBuilder/compositeRuleEditor/GroupValueEditor.js +12 -15
- package/dist/components/inputs/reactQueryBuilder/compositeRuleEditor/RuleValueEditor.js +3 -4
- package/dist/components/notifications/hooks/useListenerManager.js +2 -4
- package/dist/components/overflowableText/OverflowableText.js +4 -5
- package/dist/components/parameters/common/computing-type.d.ts +2 -1
- package/dist/components/parameters/common/computing-type.js +3 -0
- package/dist/components/parameters/common/limitreductions/columns-definitions.js +1 -1
- package/dist/components/parameters/common/limitreductions/limit-reductions-form-util.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-general-parameters.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-content.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-form.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +3 -3
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +15 -16
- package/dist/components/parameters/network-visualizations/map-parameters.js +13 -17
- package/dist/components/parameters/network-visualizations/network-area-diagram-parameters.js +1 -2
- package/dist/components/parameters/network-visualizations/network-visualizations-form.js +2 -2
- package/dist/components/parameters/network-visualizations/single-line-diagram-parameters.js +2 -3
- package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +2 -3
- package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.js +3 -3
- package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +1 -1
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +5 -5
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +1 -1
- package/dist/components/parameters/sensi/sensitivity-table.js +2 -3
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +42 -54
- package/dist/components/parameters/sensi/utils.js +16 -27
- package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +2 -2
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +1 -1
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +47 -56
- package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +1 -1
- package/dist/components/snackbarProvider/SnackbarProvider.js +1 -4
- package/dist/components/topBar/TopBar.js +33 -36
- package/dist/components/topBar/UserInformationDialog.js +7 -8
- package/dist/components/topBar/UserSettingsDialog.js +1 -1
- package/dist/components/treeViewFinder/TreeViewFinder.js +13 -13
- package/dist/hooks/use-parameters-backend.js +5 -5
- package/dist/hooks/use-unique-name-validation.js +2 -3
- package/dist/hooks/useConfidentialityWarning.js +1 -1
- package/dist/hooks/usePredefinedProperties.js +1 -2
- package/dist/index.js +9 -5
- package/dist/redux/commonStore.js +1 -2
- package/dist/services/businessErrorCode.d.ts +11 -0
- package/dist/services/businessErrorCode.js +10 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +2 -0
- package/dist/services/utils.js +13 -7
- package/dist/translations/en/businessErrorsEn.d.ts +28 -0
- package/dist/translations/en/businessErrorsEn.js +25 -0
- package/dist/translations/en/equipmentsEn.d.ts +1 -0
- package/dist/translations/en/equipmentsEn.js +2 -1
- package/dist/translations/en/index.d.ts +1 -0
- package/dist/translations/en/index.js +2 -0
- package/dist/translations/fr/businessErrorsFr.d.ts +28 -0
- package/dist/translations/fr/businessErrorsFr.js +25 -0
- package/dist/translations/fr/equipmentsFr.d.ts +1 -0
- package/dist/translations/fr/equipmentsFr.js +2 -1
- package/dist/translations/fr/index.d.ts +1 -0
- package/dist/translations/fr/index.js +2 -0
- package/dist/utils/index.js +2 -1
- package/dist/utils/types/equipmentType.d.ts +162 -8
- package/dist/utils/types/equipmentType.js +126 -22
- package/dist/utils/types/index.js +2 -1
- package/package.json +6 -6
- package/dist/components/inputs/reactHookForm/utils/RefreshButton.d.ts +0 -2
- package/dist/components/inputs/reactHookForm/utils/RefreshButton.js +0 -9
|
@@ -80,12 +80,12 @@ function computeMinExpiresIn(expiresIn, idToken, maxExpiresIn) {
|
|
|
80
80
|
}
|
|
81
81
|
function login(location, userManagerInstance) {
|
|
82
82
|
sessionStorage.setItem(pathKey, location.pathname + location.search);
|
|
83
|
-
return userManagerInstance
|
|
83
|
+
return userManagerInstance?.signinRedirect().then(() => console.debug("login"));
|
|
84
84
|
}
|
|
85
85
|
function logout(dispatch, userManagerInstance) {
|
|
86
86
|
sessionStorage.removeItem(hackAuthorityKey);
|
|
87
87
|
sessionStorage.removeItem(oidcHackReloadedKey);
|
|
88
|
-
return userManagerInstance
|
|
88
|
+
return userManagerInstance?.getUser().then((user) => {
|
|
89
89
|
if (user) {
|
|
90
90
|
return userManagerInstance.signoutRedirect({
|
|
91
91
|
extraQueryParams: {
|
|
@@ -94,10 +94,9 @@ function logout(dispatch, userManagerInstance) {
|
|
|
94
94
|
}).then(() => {
|
|
95
95
|
console.debug("logged out, window is closing...");
|
|
96
96
|
}).catch((e) => {
|
|
97
|
-
var _a;
|
|
98
97
|
console.log("Error during logout :", e);
|
|
99
98
|
dispatch(setLoggedUser(null));
|
|
100
|
-
dispatch(setLogoutError(
|
|
99
|
+
dispatch(setLogoutError(user?.profile?.name, { error: e }));
|
|
101
100
|
});
|
|
102
101
|
}
|
|
103
102
|
console.log("Error nobody to logout ");
|
|
@@ -106,7 +105,6 @@ function logout(dispatch, userManagerInstance) {
|
|
|
106
105
|
}
|
|
107
106
|
function dispatchUser(dispatch, userManagerInstance) {
|
|
108
107
|
return userManagerInstance.getUser().then((user) => {
|
|
109
|
-
var _a;
|
|
110
108
|
if (user) {
|
|
111
109
|
if (getIdTokenExpiresIn(user) < 0) {
|
|
112
110
|
console.debug("User token is expired and will not be dispatched");
|
|
@@ -116,7 +114,7 @@ function dispatchUser(dispatch, userManagerInstance) {
|
|
|
116
114
|
reloadTimerOnExpiresIn(
|
|
117
115
|
user,
|
|
118
116
|
userManagerInstance,
|
|
119
|
-
computeMinExpiresIn(user.expires_in, user.id_token,
|
|
117
|
+
computeMinExpiresIn(user.expires_in, user.id_token, userManagerInstance.idpSettings?.maxExpiresIn)
|
|
120
118
|
);
|
|
121
119
|
return dispatch(setLoggedUser(user));
|
|
122
120
|
}
|
|
@@ -165,7 +163,6 @@ function handleUser(dispatch, userManager) {
|
|
|
165
163
|
console.debug(error);
|
|
166
164
|
window.setTimeout(() => {
|
|
167
165
|
userManager.getUser().then((user) => {
|
|
168
|
-
var _a, _b;
|
|
169
166
|
if (!user) {
|
|
170
167
|
console.error("user is null at silent renew error, it shouldn't happen.");
|
|
171
168
|
return;
|
|
@@ -178,7 +175,7 @@ function handleUser(dispatch, userManager) {
|
|
|
178
175
|
dispatch(setLoggedUser(null));
|
|
179
176
|
return;
|
|
180
177
|
}
|
|
181
|
-
if (
|
|
178
|
+
if (userManager.idpSettings?.maxExpiresIn) {
|
|
182
179
|
if (idTokenExpiresIn < userManager.idpSettings.maxExpiresIn) {
|
|
183
180
|
console.log(
|
|
184
181
|
`Error in silent renew, but idtoken ALMOST expiring (expiring in${idTokenExpiresIn}) => last chance, next error will logout`,
|
|
@@ -196,7 +193,7 @@ function handleUser(dispatch, userManager) {
|
|
|
196
193
|
}
|
|
197
194
|
} else {
|
|
198
195
|
console.log(
|
|
199
|
-
`Error in silent renew, unsupported configuration: token still valid for ${idTokenExpiresIn} but maxExpiresIn is not configured:${
|
|
196
|
+
`Error in silent renew, unsupported configuration: token still valid for ${idTokenExpiresIn} but maxExpiresIn is not configured:${userManager.idpSettings?.maxExpiresIn}`,
|
|
200
197
|
error
|
|
201
198
|
);
|
|
202
199
|
}
|
|
@@ -28,7 +28,7 @@ function CheckBoxList({
|
|
|
28
28
|
}
|
|
29
29
|
setIsDragging(true);
|
|
30
30
|
},
|
|
31
|
-
children: /* @__PURE__ */ jsx(Droppable, { droppableId: "droppable-checkbox-list", isDropDisabled: isDragDisable, children: (provided) => /* @__PURE__ */ jsxs(Box, { ...provided.droppableProps, ref: provided.innerRef, sx: sx
|
|
31
|
+
children: /* @__PURE__ */ jsx(Droppable, { droppableId: "droppable-checkbox-list", isDropDisabled: isDragDisable, children: (provided) => /* @__PURE__ */ jsxs(Box, { ...provided.droppableProps, ref: provided.innerRef, sx: sx?.dragAndDropContainer, children: [
|
|
32
32
|
checkBoxField,
|
|
33
33
|
provided.placeholder
|
|
34
34
|
] }) })
|
|
@@ -51,8 +51,8 @@ function CheckBoxListItem({
|
|
|
51
51
|
return /* @__PURE__ */ jsx(
|
|
52
52
|
ListItem,
|
|
53
53
|
{
|
|
54
|
-
secondaryAction: secondaryAction
|
|
55
|
-
sx: mergeSx(styles.checkboxListItem, sx
|
|
54
|
+
secondaryAction: secondaryAction?.(item, hover),
|
|
55
|
+
sx: mergeSx(styles.checkboxListItem, sx?.checkboxListItem),
|
|
56
56
|
onMouseEnter: () => setHover(getItemId(item)),
|
|
57
57
|
onMouseLeave: () => setHover(""),
|
|
58
58
|
disablePadding: true,
|
|
@@ -60,7 +60,7 @@ function CheckBoxListItem({
|
|
|
60
60
|
children: onItemClick ? /* @__PURE__ */ jsx(
|
|
61
61
|
ListItemButton,
|
|
62
62
|
{
|
|
63
|
-
sx: mergeSx({ alignItems: "flex-start", padding: "unset" }, sx
|
|
63
|
+
sx: mergeSx({ alignItems: "flex-start", padding: "unset" }, sx?.checkboxButton),
|
|
64
64
|
disabled,
|
|
65
65
|
onClick: handleItemClick,
|
|
66
66
|
children: /* @__PURE__ */ jsx(CheckBoxListItemContent, { sx, ...props })
|
|
@@ -18,7 +18,7 @@ function CheckBoxListItemContent({
|
|
|
18
18
|
onClick();
|
|
19
19
|
};
|
|
20
20
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
|
-
/* @__PURE__ */ jsx(ListItemIcon, { sx: mergeSx({ marginTop: "0px" }, sx
|
|
21
|
+
/* @__PURE__ */ jsx(ListItemIcon, { sx: mergeSx({ marginTop: "0px" }, sx?.checkBoxIcon), children: /* @__PURE__ */ jsx(Checkbox, { sx: sx?.checkbox, disableRipple: true, onClick: onCheckboxClick, ...props }) }),
|
|
22
22
|
/* @__PURE__ */ jsx(
|
|
23
23
|
ListItemText,
|
|
24
24
|
{
|
|
@@ -31,11 +31,11 @@ function CheckBoxListItemContent({
|
|
|
31
31
|
// this is to align text with default padding/margin of the checkbox
|
|
32
32
|
marginTop: "9px"
|
|
33
33
|
},
|
|
34
|
-
sx
|
|
34
|
+
sx?.listItemText
|
|
35
35
|
),
|
|
36
36
|
disableTypography: true,
|
|
37
37
|
secondary,
|
|
38
|
-
children: /* @__PURE__ */ jsx(OverflowableText, { sx: mergeSx({ width: "100%" }, sx
|
|
38
|
+
children: /* @__PURE__ */ jsx(OverflowableText, { sx: mergeSx({ width: "100%" }, sx?.label), text: label })
|
|
39
39
|
}
|
|
40
40
|
)
|
|
41
41
|
] });
|
|
@@ -42,7 +42,7 @@ function CheckBoxListItems({
|
|
|
42
42
|
}, [selectedItems, handleOnchange, items]);
|
|
43
43
|
const toggleSelection = useCallback(
|
|
44
44
|
(elementToToggleId) => {
|
|
45
|
-
const element = items
|
|
45
|
+
const element = items?.find((v) => getItemId(v) === elementToToggleId);
|
|
46
46
|
if (element === void 0) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
@@ -72,7 +72,7 @@ function CheckBoxListItems({
|
|
|
72
72
|
() => selectAllCheckBoxLabel ?? "multiple_selection_dialog/selectAll",
|
|
73
73
|
[selectAllCheckBoxLabel]
|
|
74
74
|
);
|
|
75
|
-
return /* @__PURE__ */ jsxs(List, { sx: sx
|
|
75
|
+
return /* @__PURE__ */ jsxs(List, { sx: sx?.checkboxList, dense: true, disablePadding: true, ...props, children: [
|
|
76
76
|
addSelectAllCheckbox && /* @__PURE__ */ jsx(
|
|
77
77
|
ListItem,
|
|
78
78
|
{
|
|
@@ -101,12 +101,12 @@ function CheckBoxListItems({
|
|
|
101
101
|
)
|
|
102
102
|
}
|
|
103
103
|
),
|
|
104
|
-
items
|
|
104
|
+
items?.map((item, index) => {
|
|
105
105
|
const label = getItemLabel ? getItemLabel(item) : getItemId(item);
|
|
106
106
|
const secondary = getItemLabelSecondary ? getItemLabelSecondary(item) : null;
|
|
107
107
|
const disabled = isDisabled ? isDisabled(item) : false;
|
|
108
108
|
const addDivider = divider && index < items.length - 1;
|
|
109
|
-
const calculatedItemSx = typeof
|
|
109
|
+
const calculatedItemSx = typeof sx?.items === "function" ? sx?.items(item) : sx?.items;
|
|
110
110
|
if (isDndActive) {
|
|
111
111
|
return /* @__PURE__ */ jsx(
|
|
112
112
|
Draggable,
|
|
@@ -39,21 +39,21 @@ function DraggableCheckBoxListItem({
|
|
|
39
39
|
...props
|
|
40
40
|
}) {
|
|
41
41
|
const [hover, setHover] = useState("");
|
|
42
|
-
const handleItemClick = useCallback(() => onItemClick
|
|
42
|
+
const handleItemClick = useCallback(() => onItemClick?.(item), [item, onItemClick]);
|
|
43
43
|
return /* @__PURE__ */ jsx(
|
|
44
44
|
ListItem,
|
|
45
45
|
{
|
|
46
|
-
secondaryAction: secondaryAction
|
|
47
|
-
sx: mergeSx(styles.checkboxListItem, sx
|
|
46
|
+
secondaryAction: secondaryAction?.(item, hover),
|
|
47
|
+
sx: mergeSx(styles.checkboxListItem, sx?.checkboxListItem),
|
|
48
48
|
onMouseEnter: () => setHover(getItemId(item)),
|
|
49
49
|
onMouseLeave: () => setHover(""),
|
|
50
50
|
disablePadding: true,
|
|
51
51
|
ref: provided.innerRef,
|
|
52
52
|
...provided.draggableProps,
|
|
53
|
-
children:
|
|
53
|
+
children: isItemClickable?.(item) ? /* @__PURE__ */ jsx(
|
|
54
54
|
ListItemButton,
|
|
55
55
|
{
|
|
56
|
-
sx: mergeSx({ alignItems: "flex-start", paddingTop: "0px" }, sx
|
|
56
|
+
sx: mergeSx({ alignItems: "flex-start", paddingTop: "0px" }, sx?.checkboxButton),
|
|
57
57
|
disabled,
|
|
58
58
|
onClick: handleItemClick,
|
|
59
59
|
disableGutters: true,
|
|
@@ -19,13 +19,13 @@ function getCriteriaBasedSchema(extraFields = {}) {
|
|
|
19
19
|
function getCriteriaBasedFormData(criteriaValues, extraFields = {}) {
|
|
20
20
|
return {
|
|
21
21
|
[FieldConstants.CRITERIA_BASED]: {
|
|
22
|
-
[FieldConstants.COUNTRIES]:
|
|
23
|
-
[FieldConstants.COUNTRIES_1]:
|
|
24
|
-
[FieldConstants.COUNTRIES_2]:
|
|
25
|
-
[FieldConstants.NOMINAL_VOLTAGE]:
|
|
26
|
-
[FieldConstants.NOMINAL_VOLTAGE_1]:
|
|
27
|
-
[FieldConstants.NOMINAL_VOLTAGE_2]:
|
|
28
|
-
[FieldConstants.NOMINAL_VOLTAGE_3]:
|
|
22
|
+
[FieldConstants.COUNTRIES]: criteriaValues?.[FieldConstants.COUNTRIES] ?? [],
|
|
23
|
+
[FieldConstants.COUNTRIES_1]: criteriaValues?.[FieldConstants.COUNTRIES_1] ?? [],
|
|
24
|
+
[FieldConstants.COUNTRIES_2]: criteriaValues?.[FieldConstants.COUNTRIES_2] ?? [],
|
|
25
|
+
[FieldConstants.NOMINAL_VOLTAGE]: criteriaValues?.[FieldConstants.NOMINAL_VOLTAGE] ?? DEFAULT_RANGE_VALUE,
|
|
26
|
+
[FieldConstants.NOMINAL_VOLTAGE_1]: criteriaValues?.[FieldConstants.NOMINAL_VOLTAGE_1] ?? DEFAULT_RANGE_VALUE,
|
|
27
|
+
[FieldConstants.NOMINAL_VOLTAGE_2]: criteriaValues?.[FieldConstants.NOMINAL_VOLTAGE_2] ?? DEFAULT_RANGE_VALUE,
|
|
28
|
+
[FieldConstants.NOMINAL_VOLTAGE_3]: criteriaValues?.[FieldConstants.NOMINAL_VOLTAGE_3] ?? DEFAULT_RANGE_VALUE,
|
|
29
29
|
...extraFields
|
|
30
30
|
}
|
|
31
31
|
};
|
|
@@ -35,10 +35,7 @@ const useCsvExport = () => {
|
|
|
35
35
|
columnSeparator: props.language === LANG_FRENCH ? ";" : ",",
|
|
36
36
|
columnKeys: props.columns.map((col) => col.colId).filter(hasColId),
|
|
37
37
|
skipColumnHeaders: props.skipColumnHeaders,
|
|
38
|
-
processHeaderCallback: (params) =>
|
|
39
|
-
var _a;
|
|
40
|
-
return ((_a = params.column.getColDef().headerComponentParams) == null ? void 0 : _a.displayName) ?? params.column.getColDef().headerName ?? params.column.getColId();
|
|
41
|
-
},
|
|
38
|
+
processHeaderCallback: (params) => params.column.getColDef().headerComponentParams?.displayName ?? params.column.getColDef().headerName ?? params.column.getColId(),
|
|
42
39
|
fileName: prefix.concat(getCSVFilename(props.tableName)),
|
|
43
40
|
processCellCallback: processCell
|
|
44
41
|
});
|
|
@@ -18,11 +18,11 @@ function useAgGridLocale(overrideLocales) {
|
|
|
18
18
|
...AG_GRID_LOCALE_FR,
|
|
19
19
|
thousandSeparator: " ",
|
|
20
20
|
decimalSeparator: ",",
|
|
21
|
-
...overrideLocales
|
|
21
|
+
...overrideLocales?.[LANG_FRENCH]
|
|
22
22
|
};
|
|
23
23
|
case LANG_ENGLISH:
|
|
24
24
|
default:
|
|
25
|
-
return { ...AG_GRID_LOCALE_EN, ...overrideLocales
|
|
25
|
+
return { ...AG_GRID_LOCALE_EN, ...overrideLocales?.[LANG_ENGLISH] };
|
|
26
26
|
}
|
|
27
27
|
}, [intl.defaultLocale, intl.locale, overrideLocales]);
|
|
28
28
|
}
|
|
@@ -61,7 +61,7 @@ function CustomMuiDialog({
|
|
|
61
61
|
const { handleSubmit } = formMethods;
|
|
62
62
|
const handleCancel = useCallback(
|
|
63
63
|
(event) => {
|
|
64
|
-
onCancel
|
|
64
|
+
onCancel?.();
|
|
65
65
|
onClose(event);
|
|
66
66
|
},
|
|
67
67
|
[onCancel, onClose]
|
|
@@ -98,7 +98,7 @@ function CustomMuiDialog({
|
|
|
98
98
|
}, [validate, validatedData]);
|
|
99
99
|
const handleValidationError = useCallback(
|
|
100
100
|
(errors) => {
|
|
101
|
-
onValidationError
|
|
101
|
+
onValidationError?.(errors);
|
|
102
102
|
},
|
|
103
103
|
[onValidationError]
|
|
104
104
|
);
|
package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js
CHANGED
|
@@ -37,9 +37,8 @@ function DescriptionModificationDialog({
|
|
|
37
37
|
};
|
|
38
38
|
const onSubmit = useCallback(
|
|
39
39
|
(data) => {
|
|
40
|
-
var _a;
|
|
41
40
|
updateElement(elementUuid, {
|
|
42
|
-
[FieldConstants.DESCRIPTION]:
|
|
41
|
+
[FieldConstants.DESCRIPTION]: data[FieldConstants.DESCRIPTION]?.trim() ?? ""
|
|
43
42
|
}).catch((error) => {
|
|
44
43
|
if (error instanceof Object && "message" in error && typeof error.message === "string") {
|
|
45
44
|
snackError({
|
|
@@ -149,12 +149,12 @@ function ElementSaveDialog({
|
|
|
149
149
|
const handleSelection = useCallback(
|
|
150
150
|
(items) => {
|
|
151
151
|
if (isCreateMode) {
|
|
152
|
-
if (
|
|
152
|
+
if (items?.length > 0 && items[0].id !== destinationFolder?.id) {
|
|
153
153
|
const { id, name } = items[0];
|
|
154
154
|
setDestinationFolder({ id, name });
|
|
155
155
|
setExpanded([]);
|
|
156
156
|
}
|
|
157
|
-
} else if (
|
|
157
|
+
} else if (items?.length > 0 && items[0].id !== selectedItem?.id) {
|
|
158
158
|
const { id, name, description, parents } = items[0];
|
|
159
159
|
if (!parents) {
|
|
160
160
|
snackError({
|
|
@@ -171,7 +171,7 @@ function ElementSaveDialog({
|
|
|
171
171
|
}
|
|
172
172
|
setDirectorySelectorOpen(false);
|
|
173
173
|
},
|
|
174
|
-
[isCreateMode, destinationFolder
|
|
174
|
+
[isCreateMode, destinationFolder?.id, selectedItem?.id, setValue, snackError]
|
|
175
175
|
);
|
|
176
176
|
const onSubmit = useCallback(
|
|
177
177
|
(values) => {
|
|
@@ -243,8 +243,8 @@ function ElementSaveDialog({
|
|
|
243
243
|
name: FieldConstants.NAME,
|
|
244
244
|
label: "name",
|
|
245
245
|
elementType: type,
|
|
246
|
-
currentName: !isCreateMode ? selectedItem
|
|
247
|
-
activeDirectory: isCreateMode ? destinationFolder
|
|
246
|
+
currentName: !isCreateMode ? selectedItem?.name : void 0,
|
|
247
|
+
activeDirectory: isCreateMode ? destinationFolder?.id : selectedItem?.parentFolderId,
|
|
248
248
|
autoFocus: true
|
|
249
249
|
}
|
|
250
250
|
) }),
|
|
@@ -267,7 +267,7 @@ function ElementSaveDialog({
|
|
|
267
267
|
id: isCreateMode ? "showSelectDirectoryDialog" : selectorTitleId
|
|
268
268
|
})
|
|
269
269
|
},
|
|
270
|
-
isCreateMode ? destinationFolder
|
|
270
|
+
isCreateMode ? destinationFolder?.id : selectedItem?.id
|
|
271
271
|
)
|
|
272
272
|
]
|
|
273
273
|
}
|
|
@@ -20,7 +20,7 @@ async function initializeDirectory(config) {
|
|
|
20
20
|
path: path.slice(0, parentFolderIndex + 1)
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
onError
|
|
23
|
+
onError?.("unknown study directory", "studyDirectoryFetchingError");
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
if (initDirectory) {
|
|
@@ -57,7 +57,7 @@ function ModifyElementSelection(props) {
|
|
|
57
57
|
/* @__PURE__ */ jsx(FolderOutlined, {}),
|
|
58
58
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
59
59
|
" ",
|
|
60
|
-
activeDirectoryName || (
|
|
60
|
+
activeDirectoryName || (props?.noElementMessageLabel ? intl.formatMessage({
|
|
61
61
|
id: noElementMessageLabel
|
|
62
62
|
}) : "")
|
|
63
63
|
] })
|
|
@@ -31,7 +31,7 @@ function flattenDownNodes(n, cef) {
|
|
|
31
31
|
return Array.prototype.concat([n], ...subs.map((sn) => flattenDownNodes(sn, cef)));
|
|
32
32
|
}
|
|
33
33
|
function refreshedUpNodes(nodeMap, newElement) {
|
|
34
|
-
if (!
|
|
34
|
+
if (!newElement?.elementUuid) {
|
|
35
35
|
return [];
|
|
36
36
|
}
|
|
37
37
|
if (newElement.parentUuid === null) {
|
|
@@ -43,7 +43,6 @@ function refreshedUpNodes(nodeMap, newElement) {
|
|
|
43
43
|
return [newElement, ...refreshedUpNodes(nodeMap, nextParent)];
|
|
44
44
|
}
|
|
45
45
|
function updatedTree(prevRoots, prevMap, nodeId, children) {
|
|
46
|
-
var _a;
|
|
47
46
|
const nextChildren = children.sort((a, b) => a.elementName.localeCompare(b.elementName)).map((n) => {
|
|
48
47
|
const pn = prevMap[n.elementUuid];
|
|
49
48
|
if (!pn) {
|
|
@@ -63,8 +62,8 @@ function updatedTree(prevRoots, prevMap, nodeId, children) {
|
|
|
63
62
|
parentUuid: nodeId
|
|
64
63
|
};
|
|
65
64
|
});
|
|
66
|
-
const prevChildren = nodeId ?
|
|
67
|
-
if (
|
|
65
|
+
const prevChildren = nodeId ? prevMap[nodeId]?.children : prevRoots;
|
|
66
|
+
if (prevChildren?.length === nextChildren.length && prevChildren.every((e, i) => e === nextChildren[i])) {
|
|
68
67
|
return [prevRoots, prevMap];
|
|
69
68
|
}
|
|
70
69
|
const nextUuids = new Set(children ? children.map((n) => n.elementUuid) : []);
|
|
@@ -14,14 +14,13 @@ function DndTableBottomRightButtons({
|
|
|
14
14
|
showMoveArrow,
|
|
15
15
|
disabled
|
|
16
16
|
}) {
|
|
17
|
-
var _a, _b;
|
|
18
17
|
const intl = useIntl();
|
|
19
18
|
const currentRows = useWatch({
|
|
20
19
|
name: arrayFormName
|
|
21
20
|
});
|
|
22
21
|
const noRowsSelected = currentRows ? !currentRows.some((row) => row[SELECTED]) : true;
|
|
23
|
-
const firstRowSelected =
|
|
24
|
-
const lastRowSelected =
|
|
22
|
+
const firstRowSelected = currentRows[0]?.[SELECTED];
|
|
23
|
+
const lastRowSelected = currentRows[currentRows.length - 1]?.[SELECTED];
|
|
25
24
|
return /* @__PURE__ */ jsxs(Grid, { container: true, item: true, xs: true, spacing: 1, sx: { justifyContent: "flex-end" }, children: [
|
|
26
25
|
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
|
|
27
26
|
Tooltip,
|
|
@@ -57,17 +57,17 @@ function MultiCheckbox({
|
|
|
57
57
|
name: arrayFormName
|
|
58
58
|
});
|
|
59
59
|
const allRowSelected = useMemo(
|
|
60
|
-
() => arrayToWatch ? arrayToWatch
|
|
60
|
+
() => arrayToWatch ? arrayToWatch?.every((row) => row[SELECTED]) : false,
|
|
61
61
|
[arrayToWatch]
|
|
62
62
|
);
|
|
63
63
|
const someRowSelected = useMemo(
|
|
64
|
-
() => arrayToWatch ? arrayToWatch
|
|
64
|
+
() => arrayToWatch ? arrayToWatch?.some((row) => row[SELECTED]) : false,
|
|
65
65
|
[arrayToWatch]
|
|
66
66
|
);
|
|
67
67
|
return /* @__PURE__ */ jsx(
|
|
68
68
|
Checkbox,
|
|
69
69
|
{
|
|
70
|
-
checked:
|
|
70
|
+
checked: arrayToWatch?.length > 0 && allRowSelected,
|
|
71
71
|
indeterminate: someRowSelected && !allRowSelected,
|
|
72
72
|
onChange: (event) => {
|
|
73
73
|
if (event.target.checked) {
|
|
@@ -99,10 +99,10 @@ function EditableTableCell({
|
|
|
99
99
|
name: `${arrayFormName}[${rowIndex}].${column.dataKey}`,
|
|
100
100
|
previousValue,
|
|
101
101
|
valueModified,
|
|
102
|
-
adornment: column
|
|
103
|
-
isClearable: column
|
|
102
|
+
adornment: column?.adornment,
|
|
103
|
+
isClearable: column?.clearable,
|
|
104
104
|
style: {
|
|
105
|
-
textAlign: column
|
|
105
|
+
textAlign: column?.textAlign
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
),
|
|
@@ -207,7 +207,7 @@ function DndTable(props) {
|
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
209
|
clearErrors(arrayFormName);
|
|
210
|
-
const rowsToAdd = createRows
|
|
210
|
+
const rowsToAdd = createRows?.(numberOfRows).map((row) => {
|
|
211
211
|
return { ...row, [SELECTED]: false };
|
|
212
212
|
});
|
|
213
213
|
append(rowsToAdd);
|
|
@@ -15,28 +15,27 @@ function EquipmentItem({
|
|
|
15
15
|
showsJustText = false,
|
|
16
16
|
...props
|
|
17
17
|
}) {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
19
18
|
const matches = match(element.label, inputValue, {
|
|
20
19
|
insideWords: true,
|
|
21
20
|
findAllOccurrences: true
|
|
22
21
|
});
|
|
23
22
|
const parts = parse(element.label, matches);
|
|
24
|
-
return /* @__PURE__ */ jsx("li", { ...props, children: /* @__PURE__ */ jsxs(Box, { className:
|
|
23
|
+
return /* @__PURE__ */ jsx("li", { ...props, children: /* @__PURE__ */ jsxs(Box, { className: props.classes?.equipmentOption, sx: props.styles?.equipmentOption, children: [
|
|
25
24
|
!showsJustText && /* @__PURE__ */ jsx(
|
|
26
25
|
Box,
|
|
27
26
|
{
|
|
28
27
|
component: "span",
|
|
29
|
-
className: clsx(
|
|
30
|
-
sx: mergeSx(
|
|
31
|
-
children: /* @__PURE__ */ jsx(FormattedMessage, { id:
|
|
28
|
+
className: clsx(props.classes?.equipmentTag, props.classes?.equipmentTypeTag),
|
|
29
|
+
sx: mergeSx(props.styles?.equipmentTag, props.styles?.equipmentTypeTag),
|
|
30
|
+
children: /* @__PURE__ */ jsx(FormattedMessage, { id: EQUIPMENT_TYPE[element.type]?.tagLabel })
|
|
32
31
|
}
|
|
33
32
|
),
|
|
34
33
|
/* @__PURE__ */ jsx(
|
|
35
34
|
OverflowableText,
|
|
36
35
|
{
|
|
37
36
|
text: parts.map((e) => e.text).join(),
|
|
38
|
-
className:
|
|
39
|
-
sx:
|
|
37
|
+
className: props.classes?.result,
|
|
38
|
+
sx: props.styles?.result,
|
|
40
39
|
children: parts.map((part) => /* @__PURE__ */ jsx(
|
|
41
40
|
"span",
|
|
42
41
|
{
|
|
@@ -6,7 +6,7 @@ function ElementSearchDialog(props) {
|
|
|
6
6
|
const { open, onClose, onSearchTermChange, ...rest } = props;
|
|
7
7
|
const handleClose = useCallback(() => {
|
|
8
8
|
onSearchTermChange("");
|
|
9
|
-
onClose
|
|
9
|
+
onClose?.();
|
|
10
10
|
}, [onSearchTermChange, onClose]);
|
|
11
11
|
return /* @__PURE__ */ jsx(Dialog, { open, onClose: handleClose, disableRestoreFocus: true, "aria-labelledby": "dialog-title-search", fullWidth: true, children: /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(ElementSearchInput, { onSearchTermChange, ...rest }) }) });
|
|
12
12
|
}
|
|
@@ -4,14 +4,13 @@ import { OverflowableText } from "../../overflowableText/OverflowableText.js";
|
|
|
4
4
|
import { EQUIPMENT_TYPE } from "../../../utils/types/equipmentType.js";
|
|
5
5
|
import { mergeSx } from "../../../utils/styles.js";
|
|
6
6
|
function TagRenderer({ element, ...props }) {
|
|
7
|
-
|
|
8
|
-
if (element.type !== ((_a = EQUIPMENT_TYPE.SUBSTATION) == null ? void 0 : _a.name) && element.type !== ((_b = EQUIPMENT_TYPE.VOLTAGE_LEVEL) == null ? void 0 : _b.name)) {
|
|
7
|
+
if (element.type !== EQUIPMENT_TYPE.SUBSTATION?.name && element.type !== EQUIPMENT_TYPE.VOLTAGE_LEVEL?.name) {
|
|
9
8
|
return /* @__PURE__ */ jsx(
|
|
10
9
|
OverflowableText,
|
|
11
10
|
{
|
|
12
11
|
text: element.voltageLevelLabel,
|
|
13
|
-
className: clsx(
|
|
14
|
-
sx: mergeSx(
|
|
12
|
+
className: clsx(props.classes?.equipmentTag, props.classes?.equipmentVlTag),
|
|
13
|
+
sx: mergeSx(props.styles?.equipmentTag, props.styles?.equipmentVlTag)
|
|
15
14
|
}
|
|
16
15
|
);
|
|
17
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useMemo, useCallback } from "react";
|
|
3
3
|
import { useForm } from "react-hook-form";
|
|
4
4
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
5
|
import { saveExplicitNamingFilter, saveExpertFilter } from "./utils/filterApi.js";
|
|
@@ -9,11 +9,15 @@ import { getExplicitNamingFilterEmptyFormData, explicitNamingFilterSchema } from
|
|
|
9
9
|
import { FieldConstants } from "../../utils/constants/fieldConstants.js";
|
|
10
10
|
import "../../utils/yupConfig.js";
|
|
11
11
|
import { FilterForm } from "./FilterForm.js";
|
|
12
|
-
import {
|
|
12
|
+
import { getExpertFilterEmptyFormData, expertFilterSchema } from "./expert/ExpertFilterForm.js";
|
|
13
13
|
import { FilterType } from "./constants/FilterConstants.js";
|
|
14
14
|
import { MAX_CHAR_DESCRIPTION } from "../../utils/constants/uiConstants.js";
|
|
15
15
|
import { EXPERT_FILTER_QUERY } from "./expert/expertFilterConstants.js";
|
|
16
16
|
import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./explicitNaming/ExplicitNamingFilterConstants.js";
|
|
17
|
+
import { CustomError } from "../../services/businessErrorCode.js";
|
|
18
|
+
import "../../utils/conversionUtils.js";
|
|
19
|
+
import "@mui/icons-material";
|
|
20
|
+
import "../../utils/types/equipmentType.js";
|
|
17
21
|
import * as yup from "yup";
|
|
18
22
|
const emptyFormData = {
|
|
19
23
|
[FieldConstants.NAME]: "",
|
|
@@ -22,12 +26,12 @@ const emptyFormData = {
|
|
|
22
26
|
...getExplicitNamingFilterEmptyFormData(),
|
|
23
27
|
...getExpertFilterEmptyFormData()
|
|
24
28
|
};
|
|
25
|
-
const
|
|
29
|
+
const formSchemaByFilterType = (filterType) => yup.object().shape({
|
|
26
30
|
[FieldConstants.NAME]: yup.string().trim().required("nameEmpty"),
|
|
27
31
|
[FieldConstants.DESCRIPTION]: yup.string().max(MAX_CHAR_DESCRIPTION, "descriptionLimitError"),
|
|
28
32
|
[FieldConstants.EQUIPMENT_TYPE]: yup.string().required(),
|
|
29
|
-
...explicitNamingFilterSchema,
|
|
30
|
-
...expertFilterSchema
|
|
33
|
+
...filterType?.id === FilterType.EXPLICIT_NAMING.id ? explicitNamingFilterSchema : {},
|
|
34
|
+
...filterType?.id === FilterType.EXPERT.id ? expertFilterSchema : {}
|
|
31
35
|
}).required();
|
|
32
36
|
function FilterCreationDialog({
|
|
33
37
|
open,
|
|
@@ -37,8 +41,8 @@ function FilterCreationDialog({
|
|
|
37
41
|
sourceFilterForExplicitNamingConversion = void 0,
|
|
38
42
|
filterType
|
|
39
43
|
}) {
|
|
40
|
-
var _a;
|
|
41
44
|
const { snackError } = useSnackMessage();
|
|
45
|
+
const formSchema = useMemo(() => formSchemaByFilterType(filterType), [filterType]);
|
|
42
46
|
const formMethods = useForm({
|
|
43
47
|
defaultValues: emptyFormData,
|
|
44
48
|
resolver: yupResolver(formSchema)
|
|
@@ -47,10 +51,10 @@ function FilterCreationDialog({
|
|
|
47
51
|
formState: { errors }
|
|
48
52
|
} = formMethods;
|
|
49
53
|
const nameError = errors[FieldConstants.NAME];
|
|
50
|
-
const isValidating =
|
|
54
|
+
const isValidating = errors.root?.isValidating;
|
|
51
55
|
const onSubmit = useCallback(
|
|
52
56
|
(filterForm) => {
|
|
53
|
-
if (
|
|
57
|
+
if (filterType?.id === FilterType.EXPLICIT_NAMING.id) {
|
|
54
58
|
saveExplicitNamingFilter(
|
|
55
59
|
filterForm[FILTER_EQUIPMENTS_ATTRIBUTES],
|
|
56
60
|
true,
|
|
@@ -66,7 +70,7 @@ function FilterCreationDialog({
|
|
|
66
70
|
onClose,
|
|
67
71
|
activeDirectory
|
|
68
72
|
);
|
|
69
|
-
} else if (
|
|
73
|
+
} else if (filterType?.id === FilterType.EXPERT.id) {
|
|
70
74
|
saveExpertFilter(
|
|
71
75
|
null,
|
|
72
76
|
filterForm[EXPERT_FILTER_QUERY],
|
|
@@ -77,9 +81,15 @@ function FilterCreationDialog({
|
|
|
77
81
|
activeDirectory,
|
|
78
82
|
onClose,
|
|
79
83
|
(error) => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
if (error instanceof CustomError && error.businessErrorCode != null) {
|
|
85
|
+
snackError({
|
|
86
|
+
messageId: error.businessErrorCode
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
snackError({
|
|
90
|
+
messageTxt: error.message
|
|
91
|
+
});
|
|
92
|
+
}
|
|
83
93
|
}
|
|
84
94
|
);
|
|
85
95
|
}
|
|
@@ -90,7 +100,7 @@ function FilterCreationDialog({
|
|
|
90
100
|
if (sourceFilterForExplicitNamingConversion) {
|
|
91
101
|
return "convertIntoExplicitNamingFilter";
|
|
92
102
|
}
|
|
93
|
-
if (
|
|
103
|
+
if (filterType?.id === FilterType.EXPERT.id) {
|
|
94
104
|
return "createNewCriteriaFilter";
|
|
95
105
|
}
|
|
96
106
|
return "createNewExplicitNamingFilter";
|
|
@@ -31,13 +31,13 @@ function FilterForm({
|
|
|
31
31
|
sourceFilterForExplicitNamingConversion
|
|
32
32
|
}
|
|
33
33
|
) }),
|
|
34
|
-
|
|
34
|
+
filterType?.id === FilterType.EXPLICIT_NAMING.id && /* @__PURE__ */ jsx(
|
|
35
35
|
ExplicitNamingFilterForm,
|
|
36
36
|
{
|
|
37
37
|
sourceFilterForExplicitNamingConversion
|
|
38
38
|
}
|
|
39
39
|
),
|
|
40
|
-
|
|
40
|
+
filterType?.id === FilterType.EXPERT.id && /* @__PURE__ */ jsx(ExpertFilterForm, {})
|
|
41
41
|
] });
|
|
42
42
|
}
|
|
43
43
|
export {
|