@gridsuite/commons-ui 0.68.1 → 0.68.3
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/assets/ExpertFilterForm.css +0 -5
- package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.d.ts +35 -1
- package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +53 -18
- package/dist/components/dialogs/index.js +3 -2
- package/dist/components/filter/FilterCreationDialog.js +1 -0
- package/dist/components/filter/FilterForm.d.ts +2 -12
- package/dist/components/filter/FilterForm.js +29 -38
- package/dist/components/filter/HeaderFilterForm.d.ts +13 -0
- package/dist/components/filter/HeaderFilterForm.js +53 -0
- package/dist/components/filter/criteriaBased/CriteriaBasedFilterEditionDialog.js +1 -0
- package/dist/components/filter/criteriaBased/CriteriaBasedFilterForm.js +9 -12
- package/dist/components/filter/criteriaBased/CriteriaBasedForm.d.ts +3 -1
- package/dist/components/filter/criteriaBased/CriteriaBasedForm.js +24 -10
- package/dist/components/filter/expert/ExpertFilterEditionDialog.js +1 -0
- package/dist/components/filter/expert/ExpertFilterForm.js +16 -5
- package/dist/components/filter/expert/expertFilter.type.d.ts +3 -1
- package/dist/components/filter/expert/expertFilter.type.js +2 -0
- package/dist/components/filter/expert/expertFilterConstants.d.ts +12 -0
- package/dist/components/filter/expert/expertFilterConstants.js +15 -1
- package/dist/components/filter/expert/expertFilterUtils.js +17 -2
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +1 -0
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +16 -7
- package/dist/components/filter/utils/filterFormUtils.d.ts +2 -3
- package/dist/components/filter/utils/filterFormUtils.js +20 -0
- package/dist/components/index.js +2 -1
- package/dist/components/inputs/reactHookForm/agGridTable/BottomRightButtons.js +2 -2
- package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +4 -5
- package/dist/components/inputs/reactQueryBuilder/AddButton.js +2 -2
- package/dist/components/inputs/reactQueryBuilder/CombinatorSelector.js +0 -1
- package/dist/components/inputs/reactQueryBuilder/CountryValueEditor.js +2 -1
- package/dist/components/inputs/reactQueryBuilder/CustomReactQueryBuilder.js +20 -6
- package/dist/components/inputs/reactQueryBuilder/FieldSelector.d.ts +1 -1
- package/dist/components/inputs/reactQueryBuilder/FieldSelector.js +9 -1
- package/dist/components/inputs/reactQueryBuilder/PropertyValueEditor.js +2 -0
- package/dist/components/inputs/reactQueryBuilder/RemoveButton.js +2 -2
- package/dist/components/inputs/reactQueryBuilder/TextValueEditor.js +4 -9
- package/dist/components/inputs/reactQueryBuilder/TranslatedValueEditor.js +3 -9
- package/dist/components/inputs/reactQueryBuilder/ValueEditor.js +3 -9
- package/dist/components/inputs/reactQueryBuilder/ValueSelector.js +1 -7
- package/dist/index.js +5 -2
- package/dist/services/explore.js +25 -19
- package/dist/translations/en/filterExpertEn.d.ts +2 -0
- package/dist/translations/en/filterExpertEn.js +3 -1
- package/dist/translations/fr/filterExpertFr.d.ts +2 -0
- package/dist/translations/fr/filterExpertFr.js +3 -1
- package/dist/utils/conversionUtils.d.ts +2 -0
- package/dist/utils/conversionUtils.js +4 -0
- package/dist/utils/index.js +3 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useCallback } from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { useFormContext, useWatch } from "react-hook-form";
|
|
5
|
-
import
|
|
5
|
+
import { Box } from "@mui/material";
|
|
6
6
|
import { v4 } from "uuid";
|
|
7
7
|
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
8
8
|
import "../../../utils/yupConfig.js";
|
|
@@ -18,6 +18,14 @@ import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
|
18
18
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
19
19
|
import { ModifyElementSelection } from "../../dialogs/modifyElementSelection/ModifyElementSelection.js";
|
|
20
20
|
import { exportFilter } from "../../../services/study.js";
|
|
21
|
+
import { unscrollableDialogStyles } from "../../dialogs/customMuiDialog/CustomMuiDialog.js";
|
|
22
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
23
|
+
import "@mui/material/Dialog";
|
|
24
|
+
import "@mui/material/DialogTitle";
|
|
25
|
+
import "@mui/material/DialogContent";
|
|
26
|
+
import "@mui/material/DialogActions";
|
|
27
|
+
import "@mui/material/Button";
|
|
28
|
+
import "@mui/material/styles";
|
|
21
29
|
import * as yup from "yup";
|
|
22
30
|
const FILTER_EQUIPMENTS_ATTRIBUTES = "filterEquipmentsAttributes";
|
|
23
31
|
function isGeneratorOrLoad(equipmentType) {
|
|
@@ -155,8 +163,8 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
|
|
|
155
163
|
})
|
|
156
164
|
);
|
|
157
165
|
};
|
|
158
|
-
return /* @__PURE__ */ jsxs(
|
|
159
|
-
/* @__PURE__ */ jsxs(
|
|
166
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
167
|
+
/* @__PURE__ */ jsxs(Box, { sx: unscrollableDialogStyles.unscrollableHeader, children: [
|
|
160
168
|
/* @__PURE__ */ jsx(
|
|
161
169
|
InputWithPopupConfirmation,
|
|
162
170
|
{
|
|
@@ -183,7 +191,7 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
|
|
|
183
191
|
}
|
|
184
192
|
)
|
|
185
193
|
] }),
|
|
186
|
-
watchEquipmentType && /* @__PURE__ */ jsx(
|
|
194
|
+
watchEquipmentType && /* @__PURE__ */ jsx(
|
|
187
195
|
CustomAgGridTable,
|
|
188
196
|
{
|
|
189
197
|
name: FILTER_EQUIPMENTS_ATTRIBUTES,
|
|
@@ -203,12 +211,13 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
|
|
|
203
211
|
getDataFromCsv: getDataFromCsvFile
|
|
204
212
|
},
|
|
205
213
|
cssProps: {
|
|
214
|
+
padding: 1,
|
|
206
215
|
"& .ag-root-wrapper-body": {
|
|
207
|
-
maxHeight: "
|
|
216
|
+
maxHeight: "unset"
|
|
208
217
|
}
|
|
209
218
|
}
|
|
210
219
|
}
|
|
211
|
-
)
|
|
220
|
+
)
|
|
212
221
|
] });
|
|
213
222
|
}
|
|
214
223
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EquipmentType } from '../../../utils/types/equipmentType';
|
|
2
2
|
import { FunctionComponent } from 'react';
|
|
3
3
|
|
|
4
|
-
type FormField = {
|
|
4
|
+
export type FormField = {
|
|
5
5
|
renderer: FunctionComponent<any>;
|
|
6
6
|
props: {
|
|
7
7
|
label: string;
|
|
@@ -13,6 +13,5 @@ export type FormEquipment = {
|
|
|
13
13
|
label: string;
|
|
14
14
|
fields: FormField[];
|
|
15
15
|
};
|
|
16
|
-
export declare const CONTINGENCY_LIST_EQUIPMENTS: Record<EquipmentType.BUSBAR_SECTION | EquipmentType.LINE | EquipmentType.TWO_WINDINGS_TRANSFORMER | EquipmentType.GENERATOR | EquipmentType.SHUNT_COMPENSATOR | EquipmentType.HVDC_LINE | EquipmentType.DANGLING_LINE, FormEquipment>;
|
|
16
|
+
export declare const CONTINGENCY_LIST_EQUIPMENTS: Record<EquipmentType.BUSBAR_SECTION | EquipmentType.LINE | EquipmentType.TWO_WINDINGS_TRANSFORMER | EquipmentType.THREE_WINDINGS_TRANSFORMER | EquipmentType.GENERATOR | EquipmentType.BATTERY | EquipmentType.LOAD | EquipmentType.SHUNT_COMPENSATOR | EquipmentType.STATIC_VAR_COMPENSATOR | EquipmentType.HVDC_LINE | EquipmentType.DANGLING_LINE, FormEquipment>;
|
|
17
17
|
export declare const FILTER_EQUIPMENTS: Record<EquipmentType.SUBSTATION | EquipmentType.VOLTAGE_LEVEL | EquipmentType.LINE | EquipmentType.TWO_WINDINGS_TRANSFORMER | EquipmentType.THREE_WINDINGS_TRANSFORMER | EquipmentType.GENERATOR | EquipmentType.BATTERY | EquipmentType.LOAD | EquipmentType.SHUNT_COMPENSATOR | EquipmentType.STATIC_VAR_COMPENSATOR | EquipmentType.HVDC_LINE | EquipmentType.DANGLING_LINE, FormEquipment>;
|
|
18
|
-
export {};
|
|
@@ -82,16 +82,36 @@ const CONTINGENCY_LIST_EQUIPMENTS = {
|
|
|
82
82
|
label: "TwoWindingsTransformers",
|
|
83
83
|
fields: [countries, nominalVoltage1, nominalVoltage2]
|
|
84
84
|
},
|
|
85
|
+
THREE_WINDINGS_TRANSFORMER: {
|
|
86
|
+
id: "THREE_WINDINGS_TRANSFORMER",
|
|
87
|
+
label: "ThreeWindingsTransformers",
|
|
88
|
+
fields: [countries, nominalVoltage1, nominalVoltage2, nominalVoltage3]
|
|
89
|
+
},
|
|
85
90
|
GENERATOR: {
|
|
86
91
|
id: "GENERATOR",
|
|
87
92
|
label: "Generators",
|
|
88
93
|
fields: [countries, nominalVoltage]
|
|
89
94
|
},
|
|
95
|
+
BATTERY: {
|
|
96
|
+
id: "BATTERY",
|
|
97
|
+
label: "Batteries",
|
|
98
|
+
fields: [countries, nominalVoltage]
|
|
99
|
+
},
|
|
100
|
+
LOAD: {
|
|
101
|
+
id: "LOAD",
|
|
102
|
+
label: "Loads",
|
|
103
|
+
fields: [countries, nominalVoltage]
|
|
104
|
+
},
|
|
90
105
|
SHUNT_COMPENSATOR: {
|
|
91
106
|
id: "SHUNT_COMPENSATOR",
|
|
92
107
|
label: "ShuntCompensators",
|
|
93
108
|
fields: [countries, nominalVoltage]
|
|
94
109
|
},
|
|
110
|
+
STATIC_VAR_COMPENSATOR: {
|
|
111
|
+
id: "STATIC_VAR_COMPENSATOR",
|
|
112
|
+
label: "StaticVarCompensators",
|
|
113
|
+
fields: [countries, nominalVoltage]
|
|
114
|
+
},
|
|
95
115
|
HVDC_LINE: {
|
|
96
116
|
id: "HVDC_LINE",
|
|
97
117
|
label: "HvdcLines",
|
package/dist/components/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { CardErrorBoundary } from "./cardErrorBoundary/CardErrorBoundary.js";
|
|
|
13
13
|
import { CheckBoxList } from "./checkBoxList/CheckBoxList.js";
|
|
14
14
|
import { CUSTOM_AGGRID_THEME, styles } from "./customAGGrid/customAggrid.style.js";
|
|
15
15
|
import { CustomAGGrid } from "./customAGGrid/customAggrid.js";
|
|
16
|
-
import { CustomMuiDialog } from "./dialogs/customMuiDialog/CustomMuiDialog.js";
|
|
16
|
+
import { CustomMuiDialog, unscrollableDialogStyles } from "./dialogs/customMuiDialog/CustomMuiDialog.js";
|
|
17
17
|
import { DescriptionModificationDialog } from "./dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
18
18
|
import { ModifyElementSelection } from "./dialogs/modifyElementSelection/ModifyElementSelection.js";
|
|
19
19
|
import { PopupConfirmationDialog } from "./dialogs/popupConfirmationDialog/PopupConfirmationDialog.js";
|
|
@@ -286,6 +286,7 @@ export {
|
|
|
286
286
|
styles,
|
|
287
287
|
testQuery,
|
|
288
288
|
toFloatOrNullValue,
|
|
289
|
+
unscrollableDialogStyles,
|
|
289
290
|
useConvertValue,
|
|
290
291
|
useCustomFormContext,
|
|
291
292
|
useElementSearch,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Grid, Tooltip } from "@mui/material";
|
|
2
|
+
import { Grid, Tooltip, Box } from "@mui/material";
|
|
3
3
|
import IconButton from "@mui/material/IconButton";
|
|
4
4
|
import { Upload, ArrowCircleUp, ArrowCircleDown } from "@mui/icons-material";
|
|
5
5
|
import AddIcon from "@mui/icons-material/ControlPoint";
|
|
@@ -48,7 +48,7 @@ function BottomRightButtons({
|
|
|
48
48
|
/* @__PURE__ */ jsx(InnerColoredButton, { disabled: disableDown, onClick: handleMoveRowDown, children: /* @__PURE__ */ jsx(ArrowCircleDown, {}) }, "downButton")
|
|
49
49
|
] })
|
|
50
50
|
] }),
|
|
51
|
-
/* @__PURE__ */ jsx(
|
|
51
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(ErrorInput, { name, InputField: FieldErrorAlert }) }),
|
|
52
52
|
/* @__PURE__ */ jsx(
|
|
53
53
|
CsvUploader,
|
|
54
54
|
{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback, useEffect } from "react";
|
|
3
3
|
import { useFormContext, useFieldArray } from "react-hook-form";
|
|
4
4
|
import { AgGridReact } from "ag-grid-react";
|
|
5
5
|
import "ag-grid-community/styles/ag-grid.css";
|
|
6
6
|
import "ag-grid-community/styles/ag-theme-alpine.css";
|
|
7
|
-
import { useTheme,
|
|
7
|
+
import { useTheme, Box } from "@mui/material";
|
|
8
8
|
import { useIntl } from "react-intl";
|
|
9
9
|
import { BottomRightButtons } from "./BottomRightButtons.js";
|
|
10
10
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
@@ -182,8 +182,8 @@ function CustomAgGridTable({
|
|
|
182
182
|
const isAnycolumnhasSort = event.api.getColumnState().some((col) => col.sort);
|
|
183
183
|
setIsSortApplied(isAnycolumnhasSort);
|
|
184
184
|
}, []);
|
|
185
|
-
return /* @__PURE__ */ jsxs(
|
|
186
|
-
/* @__PURE__ */ jsx(
|
|
185
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
186
|
+
/* @__PURE__ */ jsx(Box, { className: theme.aggrid.theme, sx: style(cssProps).grid, children: /* @__PURE__ */ jsx(
|
|
187
187
|
AgGridReact,
|
|
188
188
|
{
|
|
189
189
|
rowData,
|
|
@@ -191,7 +191,6 @@ function CustomAgGridTable({
|
|
|
191
191
|
getLocaleText,
|
|
192
192
|
cacheOverflowSize: 10,
|
|
193
193
|
rowSelection: "multiple",
|
|
194
|
-
domLayout: "autoHeight",
|
|
195
194
|
rowDragEntireRow: true,
|
|
196
195
|
rowDragManaged: true,
|
|
197
196
|
onRowDragEnd: (e) => move(getIndex(e.node.data), e.overIndex),
|
|
@@ -3,8 +3,8 @@ import { Button } from "@mui/material";
|
|
|
3
3
|
import AddIcon from "@mui/icons-material/ControlPoint";
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
5
|
function AddButton(props) {
|
|
6
|
-
const { label, handleOnClick } = props;
|
|
7
|
-
return /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Button, { startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: handleOnClick, size: "small", className: "add-button", children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) }) });
|
|
6
|
+
const { label, handleOnClick, title } = props;
|
|
7
|
+
return /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Button, { startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: handleOnClick, size: "small", className: "add-button", title, children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) }) });
|
|
8
8
|
}
|
|
9
9
|
export {
|
|
10
10
|
AddButton
|
|
@@ -7,7 +7,7 @@ import { AutocompleteWithFavorites } from "./AutocompleteWithFavorites.js";
|
|
|
7
7
|
import { useConvertValue } from "./hooks/useConvertValue.js";
|
|
8
8
|
import { useValid } from "./hooks/useValid.js";
|
|
9
9
|
function CountryValueEditor(props) {
|
|
10
|
-
const { value, handleOnChange } = props;
|
|
10
|
+
const { value, handleOnChange, title } = props;
|
|
11
11
|
const { language } = useCustomFormContext();
|
|
12
12
|
const { translate, countryCodes } = useLocalizedCountries(language);
|
|
13
13
|
const [favoriteCountryCodes, setFavoriteCountryCodes] = useState([]);
|
|
@@ -33,6 +33,7 @@ function CountryValueEditor(props) {
|
|
|
33
33
|
favorites: favoriteCountryCodes,
|
|
34
34
|
getOptionLabel: (code) => code ? translate(code) : "",
|
|
35
35
|
valid,
|
|
36
|
+
title,
|
|
36
37
|
onChange: (event, newValue) => {
|
|
37
38
|
handleOnChange(newValue);
|
|
38
39
|
},
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
3
|
import { QueryBuilderDnD } from "@react-querybuilder/dnd";
|
|
4
4
|
import * as ReactDnD from "react-dnd";
|
|
5
5
|
import * as ReactDndHtml5Backend from "react-dnd-html5-backend";
|
|
6
6
|
import { QueryBuilderMaterial } from "@react-querybuilder/material";
|
|
7
|
-
import { formatQuery, QueryBuilder } from "react-querybuilder";
|
|
7
|
+
import { defaultTranslations, formatQuery, QueryBuilder } from "react-querybuilder";
|
|
8
8
|
import { useIntl } from "react-intl";
|
|
9
9
|
import { useFormContext } from "react-hook-form";
|
|
10
10
|
import { useCallback, useMemo } from "react";
|
|
@@ -24,6 +24,18 @@ function RuleAddButton(props) {
|
|
|
24
24
|
function GroupAddButton(props) {
|
|
25
25
|
return /* @__PURE__ */ jsx(AddButton, { ...props, label: "subGroup" });
|
|
26
26
|
}
|
|
27
|
+
const customTranslations = {
|
|
28
|
+
...defaultTranslations,
|
|
29
|
+
fields: { ...defaultTranslations.fields, title: "" },
|
|
30
|
+
operators: { ...defaultTranslations.operators, title: "" },
|
|
31
|
+
dragHandle: { ...defaultTranslations.dragHandle, title: "" },
|
|
32
|
+
addRule: { ...defaultTranslations.addRule, title: "" },
|
|
33
|
+
addGroup: { ...defaultTranslations.addGroup, title: "" },
|
|
34
|
+
removeRule: { ...defaultTranslations.removeRule, title: "" },
|
|
35
|
+
removeGroup: { ...defaultTranslations.removeGroup, title: "" },
|
|
36
|
+
value: { title: "" },
|
|
37
|
+
combinators: { title: "" }
|
|
38
|
+
};
|
|
27
39
|
function CustomReactQueryBuilder(props) {
|
|
28
40
|
const { name, fields } = props;
|
|
29
41
|
const {
|
|
@@ -54,7 +66,7 @@ function CustomReactQueryBuilder(props) {
|
|
|
54
66
|
}));
|
|
55
67
|
}, [intl]);
|
|
56
68
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
57
|
-
/* @__PURE__ */ jsx(
|
|
69
|
+
/* @__PURE__ */ jsx(QueryBuilderMaterial, { children: /* @__PURE__ */ jsx(QueryBuilderDnD, { dnd: { ...ReactDnD, ...ReactDndHtml5Backend }, children: /* @__PURE__ */ jsx(
|
|
58
70
|
QueryBuilder,
|
|
59
71
|
{
|
|
60
72
|
fields,
|
|
@@ -78,10 +90,12 @@ function CustomReactQueryBuilder(props) {
|
|
|
78
90
|
fieldSelector: FieldSelector,
|
|
79
91
|
valueSourceSelector: ValueSelector
|
|
80
92
|
},
|
|
81
|
-
listsAsArrays: true
|
|
93
|
+
listsAsArrays: true,
|
|
94
|
+
accessibleDescriptionGenerator: () => "",
|
|
95
|
+
translations: customTranslations
|
|
82
96
|
}
|
|
83
|
-
) }) })
|
|
84
|
-
/* @__PURE__ */ jsx(
|
|
97
|
+
) }) }),
|
|
98
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(ErrorInput, { name, InputField: FieldErrorAlert }) })
|
|
85
99
|
] });
|
|
86
100
|
}
|
|
87
101
|
export {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ValueSelectorProps } from 'react-querybuilder';
|
|
2
2
|
|
|
3
|
-
export declare function FieldSelector({ options, className, value, disabled, handleOnChange }: Readonly<ValueSelectorProps>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function FieldSelector({ options, className, value, disabled, handleOnChange, title, }: Readonly<ValueSelectorProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { toFlatOptionArray } from "react-querybuilder";
|
|
3
3
|
import { Autocomplete, TextField } from "@mui/material";
|
|
4
|
-
function FieldSelector({
|
|
4
|
+
function FieldSelector({
|
|
5
|
+
options,
|
|
6
|
+
className,
|
|
7
|
+
value,
|
|
8
|
+
disabled,
|
|
9
|
+
handleOnChange,
|
|
10
|
+
title
|
|
11
|
+
}) {
|
|
5
12
|
const optionList = toFlatOptionArray(options);
|
|
6
13
|
return /* @__PURE__ */ jsx(
|
|
7
14
|
Autocomplete,
|
|
@@ -17,6 +24,7 @@ function FieldSelector({ options, className, value, disabled, handleOnChange })
|
|
|
17
24
|
options: optionList,
|
|
18
25
|
disableClearable: true,
|
|
19
26
|
size: "small",
|
|
27
|
+
title,
|
|
20
28
|
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, label: "", variant: "standard" }),
|
|
21
29
|
autoHighlight: true,
|
|
22
30
|
getOptionLabel: (option) => option.label
|
|
@@ -66,6 +66,7 @@ function PropertyValueEditor(props) {
|
|
|
66
66
|
{
|
|
67
67
|
value: propertyOperator ?? PROPERTY_VALUE_OPERATORS[0].customName,
|
|
68
68
|
size: "small",
|
|
69
|
+
title: valueEditorProps == null ? void 0 : valueEditorProps.title,
|
|
69
70
|
error: !valid,
|
|
70
71
|
onChange: (event, value) => {
|
|
71
72
|
onChange(FieldConstants.PROPERTY_OPERATOR, value);
|
|
@@ -78,6 +79,7 @@ function PropertyValueEditor(props) {
|
|
|
78
79
|
{
|
|
79
80
|
value: propertyValues ?? [],
|
|
80
81
|
options: predefinedValues ?? [],
|
|
82
|
+
title: valueEditorProps == null ? void 0 : valueEditorProps.title,
|
|
81
83
|
multiple: true,
|
|
82
84
|
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
|
|
83
85
|
freeSolo: true,
|
|
@@ -5,7 +5,7 @@ import { useController } from "react-hook-form";
|
|
|
5
5
|
import { getNumberOfSiblings, recursiveRemove } from "../../filter/expert/expertFilterUtils.js";
|
|
6
6
|
const EXPERT_FILTER_QUERY = "rules";
|
|
7
7
|
function RemoveButton(props) {
|
|
8
|
-
const { path, className } = props;
|
|
8
|
+
const { path, className, title } = props;
|
|
9
9
|
const {
|
|
10
10
|
field: { value: query, onChange }
|
|
11
11
|
} = useController({ name: EXPERT_FILTER_QUERY });
|
|
@@ -13,7 +13,7 @@ function RemoveButton(props) {
|
|
|
13
13
|
onChange(recursiveRemove(query, path));
|
|
14
14
|
}
|
|
15
15
|
const isLastRuleOrGroup = path.toString() === [0].toString() && getNumberOfSiblings(path, query) === 1;
|
|
16
|
-
return /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => handleDelete(), className, children: !isLastRuleOrGroup && /* @__PURE__ */ jsx(DeleteIcon, {}) });
|
|
16
|
+
return /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => handleDelete(), className, title, children: !isLastRuleOrGroup && /* @__PURE__ */ jsx(DeleteIcon, {}) });
|
|
17
17
|
}
|
|
18
18
|
export {
|
|
19
19
|
RemoveButton
|
|
@@ -6,15 +6,9 @@ import { useValid } from "./hooks/useValid.js";
|
|
|
6
6
|
function TextValueEditor(props) {
|
|
7
7
|
useConvertValue(props);
|
|
8
8
|
const valid = useValid(props);
|
|
9
|
-
const { value, handleOnChange } = props;
|
|
9
|
+
const { value, handleOnChange, title } = props;
|
|
10
10
|
if (!Array.isArray(value)) {
|
|
11
|
-
return /* @__PURE__ */ jsx(
|
|
12
|
-
MaterialValueEditor,
|
|
13
|
-
{
|
|
14
|
-
...props,
|
|
15
|
-
title: void 0
|
|
16
|
-
}
|
|
17
|
-
);
|
|
11
|
+
return /* @__PURE__ */ jsx(MaterialValueEditor, { ...props });
|
|
18
12
|
}
|
|
19
13
|
return /* @__PURE__ */ jsx(
|
|
20
14
|
Autocomplete,
|
|
@@ -26,7 +20,8 @@ function TextValueEditor(props) {
|
|
|
26
20
|
multiple: true,
|
|
27
21
|
fullWidth: true,
|
|
28
22
|
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
|
|
29
|
-
size: "small"
|
|
23
|
+
size: "small",
|
|
24
|
+
title
|
|
30
25
|
}
|
|
31
26
|
);
|
|
32
27
|
}
|
|
@@ -7,7 +7,7 @@ import { useConvertValue } from "./hooks/useConvertValue.js";
|
|
|
7
7
|
import { useValid } from "./hooks/useValid.js";
|
|
8
8
|
function TranslatedValueEditor(props) {
|
|
9
9
|
const intl = useIntl();
|
|
10
|
-
const { values, value, handleOnChange } = props;
|
|
10
|
+
const { values, value, handleOnChange, title } = props;
|
|
11
11
|
const translatedValues = useMemo(() => {
|
|
12
12
|
return values == null ? void 0 : values.map((v) => {
|
|
13
13
|
return {
|
|
@@ -25,20 +25,14 @@ function TranslatedValueEditor(props) {
|
|
|
25
25
|
useConvertValue(props);
|
|
26
26
|
const valid = useValid(props);
|
|
27
27
|
if (!Array.isArray(value)) {
|
|
28
|
-
return /* @__PURE__ */ jsx(
|
|
29
|
-
MaterialValueEditor,
|
|
30
|
-
{
|
|
31
|
-
...props,
|
|
32
|
-
values: translatedValues,
|
|
33
|
-
title: void 0
|
|
34
|
-
}
|
|
35
|
-
);
|
|
28
|
+
return /* @__PURE__ */ jsx(MaterialValueEditor, { ...props, values: translatedValues });
|
|
36
29
|
}
|
|
37
30
|
return /* @__PURE__ */ jsx(
|
|
38
31
|
Autocomplete,
|
|
39
32
|
{
|
|
40
33
|
value,
|
|
41
34
|
options: Object.keys(translatedValuesAutocomplete),
|
|
35
|
+
title,
|
|
42
36
|
getOptionLabel: (code) => translatedValuesAutocomplete[code],
|
|
43
37
|
onChange: (event, newValue) => handleOnChange(newValue),
|
|
44
38
|
multiple: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from "react";
|
|
2
|
+
import { useCallback, createElement } from "react";
|
|
3
3
|
import { MaterialValueEditor } from "@react-querybuilder/material";
|
|
4
4
|
import Box from "@mui/material/Box";
|
|
5
5
|
import { useFormContext } from "react-hook-form";
|
|
@@ -47,7 +47,7 @@ function ValueEditor(props) {
|
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
if ([FieldType.COUNTRY, FieldType.COUNTRY_1, FieldType.COUNTRY_2].includes(field)) {
|
|
50
|
-
return /* @__PURE__ */
|
|
50
|
+
return /* @__PURE__ */ createElement(CountryValueEditor, { ...props, key: field });
|
|
51
51
|
}
|
|
52
52
|
if (fieldData.dataType === DataType.ENUM) {
|
|
53
53
|
return /* @__PURE__ */ jsx(TranslatedValueEditor, { ...props });
|
|
@@ -92,13 +92,7 @@ function ValueEditor(props) {
|
|
|
92
92
|
if (fieldData.dataType === DataType.COMBINATOR) {
|
|
93
93
|
return /* @__PURE__ */ jsx(GroupValueEditor, { ...props });
|
|
94
94
|
}
|
|
95
|
-
return /* @__PURE__ */ jsx(Box, { sx: inputType === "number" ? styles.noArrows : void 0, children: /* @__PURE__ */ jsx(
|
|
96
|
-
MaterialValueEditor,
|
|
97
|
-
{
|
|
98
|
-
...props,
|
|
99
|
-
title: void 0
|
|
100
|
-
}
|
|
101
|
-
) });
|
|
95
|
+
return /* @__PURE__ */ jsx(Box, { sx: inputType === "number" ? styles.noArrows : void 0, children: /* @__PURE__ */ jsx(MaterialValueEditor, { ...props }) });
|
|
102
96
|
}
|
|
103
97
|
export {
|
|
104
98
|
ValueEditor
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { MaterialValueSelector } from "@react-querybuilder/material";
|
|
3
3
|
function ValueSelector(props) {
|
|
4
|
-
return /* @__PURE__ */ jsx(
|
|
5
|
-
MaterialValueSelector,
|
|
6
|
-
{
|
|
7
|
-
...props,
|
|
8
|
-
title: void 0
|
|
9
|
-
}
|
|
10
|
-
);
|
|
4
|
+
return /* @__PURE__ */ jsx(MaterialValueSelector, { ...props });
|
|
11
5
|
}
|
|
12
6
|
export {
|
|
13
7
|
ValueSelector
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { CardErrorBoundary } from "./components/cardErrorBoundary/CardErrorBound
|
|
|
14
14
|
import { CheckBoxList } from "./components/checkBoxList/CheckBoxList.js";
|
|
15
15
|
import { CUSTOM_AGGRID_THEME, styles } from "./components/customAGGrid/customAggrid.style.js";
|
|
16
16
|
import { CustomAGGrid } from "./components/customAGGrid/customAggrid.js";
|
|
17
|
-
import { CustomMuiDialog } from "./components/dialogs/customMuiDialog/CustomMuiDialog.js";
|
|
17
|
+
import { CustomMuiDialog, unscrollableDialogStyles } from "./components/dialogs/customMuiDialog/CustomMuiDialog.js";
|
|
18
18
|
import { DescriptionModificationDialog } from "./components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
19
19
|
import { ModifyElementSelection } from "./components/dialogs/modifyElementSelection/ModifyElementSelection.js";
|
|
20
20
|
import { PopupConfirmationDialog } from "./components/dialogs/popupConfirmationDialog/PopupConfirmationDialog.js";
|
|
@@ -125,7 +125,7 @@ import { equalsArray } from "./utils/algos.js";
|
|
|
125
125
|
import { DARK_THEME, LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM, LIGHT_THEME } from "./utils/constants/browserConstants.js";
|
|
126
126
|
import { FetchStatus } from "./utils/constants/fetchStatus.js";
|
|
127
127
|
import { FieldConstants } from "./utils/constants/fieldConstants.js";
|
|
128
|
-
import { GRIDSUITE_DEFAULT_PRECISION, isBlankOrEmpty, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToMicroUnit } from "./utils/conversionUtils.js";
|
|
128
|
+
import { GRIDSUITE_DEFAULT_PRECISION, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./utils/conversionUtils.js";
|
|
129
129
|
import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./utils/functions.js";
|
|
130
130
|
import { getFileIcon } from "./utils/mapper/getFileIcon.js";
|
|
131
131
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./utils/mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
@@ -426,6 +426,7 @@ export {
|
|
|
426
426
|
isIntegerNumber,
|
|
427
427
|
isObjectEmpty,
|
|
428
428
|
keyGenerator,
|
|
429
|
+
kiloUnitToUnit,
|
|
429
430
|
login,
|
|
430
431
|
loginEn,
|
|
431
432
|
loginFr,
|
|
@@ -466,7 +467,9 @@ export {
|
|
|
466
467
|
topBarFr,
|
|
467
468
|
treeviewFinderEn,
|
|
468
469
|
treeviewFinderFr,
|
|
470
|
+
unitToKiloUnit,
|
|
469
471
|
unitToMicroUnit,
|
|
472
|
+
unscrollableDialogStyles,
|
|
470
473
|
useConfidentialityWarning,
|
|
471
474
|
useConvertValue,
|
|
472
475
|
useCustomFormContext,
|
package/dist/services/explore.js
CHANGED
|
@@ -30,26 +30,32 @@ function saveFilter(filter, name, token) {
|
|
|
30
30
|
token
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
|
-
function fetchElementsInfos(ids, elementTypes, equipmentTypes) {
|
|
33
|
+
async function fetchElementsInfos(ids, elementTypes, equipmentTypes) {
|
|
34
34
|
console.info("Fetching elements metadata");
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
35
|
+
let final = [];
|
|
36
|
+
const chunkSize = 50;
|
|
37
|
+
for (let i = 0; i < ids.length; i += chunkSize) {
|
|
38
|
+
const partitionIds = ids.slice(i, i + chunkSize);
|
|
39
|
+
const idsParams = getRequestParamFromList(
|
|
40
|
+
"ids",
|
|
41
|
+
partitionIds.filter((id) => id)
|
|
42
|
+
// filter falsy elements
|
|
43
|
+
);
|
|
44
|
+
const equipmentTypesParams = getRequestParamFromList("equipmentTypes", equipmentTypes);
|
|
45
|
+
const elementTypesParams = getRequestParamFromList("elementTypes", elementTypes);
|
|
46
|
+
const urlSearchParams = new URLSearchParams([
|
|
47
|
+
...idsParams,
|
|
48
|
+
...equipmentTypesParams,
|
|
49
|
+
...elementTypesParams
|
|
50
|
+
]).toString();
|
|
51
|
+
const url = `${PREFIX_EXPLORE_SERVER_QUERIES}/v1/explore/elements/metadata?${urlSearchParams}`;
|
|
52
|
+
const result = await backendFetchJson(url, {
|
|
53
|
+
method: "get",
|
|
54
|
+
headers: { "Content-Type": "application/json" }
|
|
55
|
+
});
|
|
56
|
+
final = final.concat(result);
|
|
57
|
+
}
|
|
58
|
+
return final;
|
|
53
59
|
}
|
|
54
60
|
export {
|
|
55
61
|
createFilter,
|
|
@@ -179,7 +179,9 @@ const filterExpertEn = {
|
|
|
179
179
|
lessOrEqual: "<=",
|
|
180
180
|
YupNotTypeNumber: "This field only accepts numeric values",
|
|
181
181
|
YupNotTypeDefault: "Field value format is incorrect",
|
|
182
|
-
changeOperatorMessage: "The operator will be changed and will be applied to all the rules already created in the group."
|
|
182
|
+
changeOperatorMessage: "The operator will be changed and will be applied to all the rules already created in the group.",
|
|
183
|
+
lowShortCircuitCurrentLimit: "Low short-circuit current limit (kA)",
|
|
184
|
+
highShortCircuitCurrentLimit: "High short-circuit current limit (kA)"
|
|
183
185
|
};
|
|
184
186
|
export {
|
|
185
187
|
filterExpertEn
|
|
@@ -179,7 +179,9 @@ const filterExpertFr = {
|
|
|
179
179
|
lessOrEqual: "<=",
|
|
180
180
|
YupNotTypeNumber: "Ce champ n'accepte que des valeurs numériques",
|
|
181
181
|
YupNotTypeDefault: "La valeur du champ n'est pas au bon format",
|
|
182
|
-
changeOperatorMessage: "L'opérateur sera modifié et s'appliquera sur toutes les règles déjà créées dans le groupe."
|
|
182
|
+
changeOperatorMessage: "L'opérateur sera modifié et s'appliquera sur toutes les règles déjà créées dans le groupe.",
|
|
183
|
+
lowShortCircuitCurrentLimit: "Limite ICC min (kA)",
|
|
184
|
+
highShortCircuitCurrentLimit: "Limite ICC max (kA)"
|
|
183
185
|
};
|
|
184
186
|
export {
|
|
185
187
|
filterExpertFr
|
|
@@ -10,3 +10,5 @@ export declare const roundToDefaultPrecision: (num: number) => number;
|
|
|
10
10
|
export declare function isBlankOrEmpty(value: unknown): boolean;
|
|
11
11
|
export declare const unitToMicroUnit: (num: number) => number | undefined;
|
|
12
12
|
export declare const microUnitToUnit: (num: number) => number | undefined;
|
|
13
|
+
export declare const unitToKiloUnit: (num: number) => number | undefined;
|
|
14
|
+
export declare const kiloUnitToUnit: (num: number) => number | undefined;
|
|
@@ -12,11 +12,15 @@ function isBlankOrEmpty(value) {
|
|
|
12
12
|
}
|
|
13
13
|
const unitToMicroUnit = (num) => isBlankOrEmpty(num) ? void 0 : roundToDefaultPrecision(num * 1e6);
|
|
14
14
|
const microUnitToUnit = (num) => isBlankOrEmpty(num) ? void 0 : roundToDefaultPrecision(num / 1e6);
|
|
15
|
+
const unitToKiloUnit = (num) => isBlankOrEmpty(num) ? void 0 : roundToDefaultPrecision(num / 1e3);
|
|
16
|
+
const kiloUnitToUnit = (num) => isBlankOrEmpty(num) ? void 0 : roundToDefaultPrecision(num * 1e3);
|
|
15
17
|
export {
|
|
16
18
|
GRIDSUITE_DEFAULT_PRECISION,
|
|
17
19
|
isBlankOrEmpty,
|
|
20
|
+
kiloUnitToUnit,
|
|
18
21
|
microUnitToUnit,
|
|
19
22
|
roundToDefaultPrecision,
|
|
20
23
|
roundToPrecision,
|
|
24
|
+
unitToKiloUnit,
|
|
21
25
|
unitToMicroUnit
|
|
22
26
|
};
|
package/dist/utils/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { equalsArray } from "./algos.js";
|
|
|
2
2
|
import { DARK_THEME, LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM, LIGHT_THEME } from "./constants/browserConstants.js";
|
|
3
3
|
import { FetchStatus } from "./constants/fetchStatus.js";
|
|
4
4
|
import { FieldConstants } from "./constants/fieldConstants.js";
|
|
5
|
-
import { GRIDSUITE_DEFAULT_PRECISION, isBlankOrEmpty, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToMicroUnit } from "./conversionUtils.js";
|
|
5
|
+
import { GRIDSUITE_DEFAULT_PRECISION, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./conversionUtils.js";
|
|
6
6
|
import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./functions.js";
|
|
7
7
|
import { getFileIcon } from "./mapper/getFileIcon.js";
|
|
8
8
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
@@ -50,12 +50,14 @@ export {
|
|
|
50
50
|
isBlankOrEmpty,
|
|
51
51
|
isObjectEmpty,
|
|
52
52
|
keyGenerator,
|
|
53
|
+
kiloUnitToUnit,
|
|
53
54
|
makeComposeClasses,
|
|
54
55
|
mergeSx,
|
|
55
56
|
microUnitToUnit,
|
|
56
57
|
roundToDefaultPrecision,
|
|
57
58
|
roundToPrecision,
|
|
58
59
|
toNestedGlobalSelectors,
|
|
60
|
+
unitToKiloUnit,
|
|
59
61
|
unitToMicroUnit,
|
|
60
62
|
yup as yupConfig
|
|
61
63
|
};
|