@gridsuite/commons-ui 0.63.3 → 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 +13 -6
- package/dist/components/filter/expert/expert-filter-constants.js +76 -36
- 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 +21 -7
- package/dist/components/translations/filter-expert-en.js +24 -10
- package/dist/components/translations/filter-expert-fr.d.ts +21 -7
- package/dist/components/translations/filter-expert-fr.js +24 -10
- 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 +2 -1
|
@@ -3,32 +3,22 @@ import { useState, useCallback } from "react";
|
|
|
3
3
|
import { Clear } from "@mui/icons-material";
|
|
4
4
|
import { InputAdornment, IconButton, TextField } from "@mui/material";
|
|
5
5
|
function TextFieldWithAdornment(props) {
|
|
6
|
-
const {
|
|
7
|
-
adornmentPosition,
|
|
8
|
-
adornmentText,
|
|
9
|
-
value,
|
|
10
|
-
variant,
|
|
11
|
-
handleClearValue,
|
|
12
|
-
...otherProps
|
|
13
|
-
} = props;
|
|
6
|
+
const { adornmentPosition, adornmentText, value, variant, handleClearValue, ...otherProps } = props;
|
|
14
7
|
const [isFocused, setIsFocused] = useState(false);
|
|
15
|
-
const getAdornmentStyle = useCallback(
|
|
16
|
-
(innerVariant)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
[]
|
|
31
|
-
);
|
|
8
|
+
const getAdornmentStyle = useCallback((innerVariant) => {
|
|
9
|
+
if (innerVariant === "filled") {
|
|
10
|
+
return {
|
|
11
|
+
alignItems: "start",
|
|
12
|
+
marginBottom: "0.4em"
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (innerVariant === "standard") {
|
|
16
|
+
return {
|
|
17
|
+
marginBottom: "0.3em"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return void 0;
|
|
21
|
+
}, []);
|
|
32
22
|
const getClearAdornment = useCallback(
|
|
33
23
|
(position) => {
|
|
34
24
|
return /* @__PURE__ */ jsx(InputAdornment, { position, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleClearValue, children: /* @__PURE__ */ jsx(Clear, {}) }) });
|
|
@@ -37,14 +27,7 @@ function TextFieldWithAdornment(props) {
|
|
|
37
27
|
);
|
|
38
28
|
const getTextAdornment = useCallback(
|
|
39
29
|
(position) => {
|
|
40
|
-
return /* @__PURE__ */ jsx(
|
|
41
|
-
InputAdornment,
|
|
42
|
-
{
|
|
43
|
-
position,
|
|
44
|
-
sx: variant && getAdornmentStyle(variant),
|
|
45
|
-
children: adornmentText
|
|
46
|
-
}
|
|
47
|
-
);
|
|
30
|
+
return /* @__PURE__ */ jsx(InputAdornment, { position, sx: variant && getAdornmentStyle(variant), children: adornmentText });
|
|
48
31
|
},
|
|
49
32
|
[adornmentText, getAdornmentStyle, variant]
|
|
50
33
|
);
|
|
@@ -54,26 +37,14 @@ function TextFieldWithAdornment(props) {
|
|
|
54
37
|
endAdornment: getTextAdornment("end"),
|
|
55
38
|
sx: { textAlign: "end" }
|
|
56
39
|
} : void 0;
|
|
57
|
-
}, [
|
|
58
|
-
value,
|
|
59
|
-
handleClearValue,
|
|
60
|
-
getClearAdornment,
|
|
61
|
-
isFocused,
|
|
62
|
-
getTextAdornment
|
|
63
|
-
]);
|
|
40
|
+
}, [value, handleClearValue, getClearAdornment, isFocused, getTextAdornment]);
|
|
64
41
|
const withStartAdornmentText = useCallback(() => {
|
|
65
42
|
return value !== "" || isFocused ? {
|
|
66
43
|
startAdornment: getTextAdornment("start"),
|
|
67
44
|
endAdornment: value && handleClearValue && getClearAdornment("end"),
|
|
68
45
|
sx: { textAlign: "start" }
|
|
69
46
|
} : void 0;
|
|
70
|
-
}, [
|
|
71
|
-
value,
|
|
72
|
-
handleClearValue,
|
|
73
|
-
getClearAdornment,
|
|
74
|
-
isFocused,
|
|
75
|
-
getTextAdornment
|
|
76
|
-
]);
|
|
47
|
+
}, [value, handleClearValue, getClearAdornment, isFocused, getTextAdornment]);
|
|
77
48
|
return /* @__PURE__ */ jsx(
|
|
78
49
|
TextField,
|
|
79
50
|
{
|
|
@@ -4,16 +4,7 @@ import AddIcon from "@mui/icons-material/ControlPoint";
|
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
5
|
function AddButton(props) {
|
|
6
6
|
const { label, handleOnClick } = props;
|
|
7
|
-
return /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
8
|
-
Button,
|
|
9
|
-
{
|
|
10
|
-
startIcon: /* @__PURE__ */ jsx(AddIcon, {}),
|
|
11
|
-
onClick: handleOnClick,
|
|
12
|
-
size: "small",
|
|
13
|
-
className: "add-button",
|
|
14
|
-
children: /* @__PURE__ */ jsx(FormattedMessage, { id: label })
|
|
15
|
-
}
|
|
16
|
-
) });
|
|
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 }) }) });
|
|
17
8
|
}
|
|
18
9
|
export {
|
|
19
10
|
AddButton as default
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AutocompleteProps } from '@mui/material/Autocomplete/Autocomplete';
|
|
2
|
+
|
|
3
|
+
interface AutocompleteWithFavoritesProps<Value> extends Omit<AutocompleteProps<Value, boolean, false, boolean>, 'multiple' | 'renderInput' | 'renderGroup' | 'groupBy'> {
|
|
4
|
+
favorites: Value[];
|
|
5
|
+
valid: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Autocomplete component which allows to have a few "favorite" options always displayed
|
|
9
|
+
* at the beginning of the selector and separated from the others options
|
|
10
|
+
*/
|
|
11
|
+
declare function AutocompleteWithFavorites<Value>({ favorites, valid, options, value, ...otherProps }: AutocompleteWithFavoritesProps<Value>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default AutocompleteWithFavorites;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Autocomplete, TextField, Box } from "@mui/material";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
const styles = {
|
|
5
|
+
favBox: (theme) => ({
|
|
6
|
+
borderBottom: "1px solid",
|
|
7
|
+
borderColor: theme.palette.divider
|
|
8
|
+
})
|
|
9
|
+
};
|
|
10
|
+
function AutocompleteWithFavorites({
|
|
11
|
+
favorites,
|
|
12
|
+
valid,
|
|
13
|
+
options,
|
|
14
|
+
value,
|
|
15
|
+
...otherProps
|
|
16
|
+
}) {
|
|
17
|
+
const optionsWithFavorites = useMemo(() => {
|
|
18
|
+
if (favorites) {
|
|
19
|
+
const optionsWithoutFavorites = options.filter((option) => !favorites.includes(option));
|
|
20
|
+
return [...favorites, ...optionsWithoutFavorites];
|
|
21
|
+
}
|
|
22
|
+
return options;
|
|
23
|
+
}, [options, favorites]);
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
Autocomplete,
|
|
26
|
+
{
|
|
27
|
+
size: "small",
|
|
28
|
+
value,
|
|
29
|
+
options: optionsWithFavorites,
|
|
30
|
+
...otherProps,
|
|
31
|
+
groupBy: (option) => favorites.includes(option) ? `fav` : "not_fav",
|
|
32
|
+
multiple: Array.isArray(value),
|
|
33
|
+
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
|
|
34
|
+
renderGroup: (item) => {
|
|
35
|
+
const { group, children } = item;
|
|
36
|
+
return /* @__PURE__ */ jsx(Box, { sx: styles.favBox, children }, `keyBoxGroup_${group}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
AutocompleteWithFavorites as default
|
|
43
|
+
};
|
package/dist/components/inputs/react-query-builder/composite-rule-editor/group-value-editor.js
CHANGED
|
@@ -29,33 +29,20 @@ function GroupValueEditor(props) {
|
|
|
29
29
|
},
|
|
30
30
|
[handleOnChange, combinator, value]
|
|
31
31
|
);
|
|
32
|
-
return /* @__PURE__ */ jsx(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
...props,
|
|
47
|
-
key: fieldData.name,
|
|
48
|
-
field: fieldData.name,
|
|
49
|
-
fieldData,
|
|
50
|
-
rule: (_a = value == null ? void 0 : value.rules) == null ? void 0 : _a[fieldData.name],
|
|
51
|
-
handleOnChangeRule: generateOnChangeRuleHandler(
|
|
52
|
-
fieldData.name
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
);
|
|
32
|
+
return /* @__PURE__ */ jsx(Grid, { container: true, direction: "column", sx: styles.group, paddingLeft: 1, paddingRight: 1, paddingBottom: 1, children: children && Object.values(children).map((fieldData) => {
|
|
33
|
+
var _a;
|
|
34
|
+
return /* @__PURE__ */ createElement(
|
|
35
|
+
RuleValueEditor,
|
|
36
|
+
{
|
|
37
|
+
...props,
|
|
38
|
+
key: fieldData.name,
|
|
39
|
+
field: fieldData.name,
|
|
40
|
+
fieldData,
|
|
41
|
+
rule: (_a = value == null ? void 0 : value.rules) == null ? void 0 : _a[fieldData.name],
|
|
42
|
+
handleOnChangeRule: generateOnChangeRuleHandler(fieldData.name)
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}) });
|
|
59
46
|
}
|
|
60
47
|
export {
|
|
61
48
|
GroupValueEditor as default
|
package/dist/components/inputs/react-query-builder/composite-rule-editor/rule-value-editor.js
CHANGED
|
@@ -44,9 +44,7 @@ function RuleValueEditor(props) {
|
|
|
44
44
|
handleOnChangeOperator(event.target.value);
|
|
45
45
|
},
|
|
46
46
|
variant: "standard",
|
|
47
|
-
children: (_b = fieldData.operators) == null ? void 0 : _b.map(
|
|
48
|
-
(option) => /* @__PURE__ */ jsx(MenuItem, { value: option.name, children: intl.formatMessage({ id: option.label }) }, option.name)
|
|
49
|
-
)
|
|
47
|
+
children: (_b = fieldData.operators) == null ? void 0 : _b.map((option) => /* @__PURE__ */ jsx(MenuItem, { value: option.name, children: intl.formatMessage({ id: option.label }) }, option.name))
|
|
50
48
|
}
|
|
51
49
|
) }),
|
|
52
50
|
/* @__PURE__ */ jsx(Grid, { container: true, item: true, xs: 5.5, sx: styles.gridItem, paddingLeft: 1, children: /* @__PURE__ */ jsx(
|
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Autocomplete, TextField } from "@mui/material";
|
|
4
|
-
import { useMemo } from "react";
|
|
5
|
-
import useConvertValue from "./use-convert-value.js";
|
|
6
|
-
import useValid from "./use-valid.js";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
7
3
|
import { useLocalizedCountries } from "../../../hooks/localized-countries-hook.js";
|
|
8
4
|
import useCustomFormContext from "../react-hook-form/provider/use-custom-form-context.js";
|
|
5
|
+
import { fetchFavoriteAndDefaultCountries } from "../../../services/apps-metadata.js";
|
|
6
|
+
import AutocompleteWithFavorites from "./autocomplete-with-favorites.js";
|
|
7
|
+
import useConvertValue from "./use-convert-value.js";
|
|
8
|
+
import useValid from "./use-valid.js";
|
|
9
9
|
function CountryValueEditor(props) {
|
|
10
|
+
const { value, handleOnChange } = props;
|
|
10
11
|
const { language } = useCustomFormContext();
|
|
11
12
|
const { translate, countryCodes } = useLocalizedCountries(language);
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const [favoriteCountryCodes, setFavoriteCountryCodes] = useState([]);
|
|
14
|
+
const [initialized, setInitialized] = useState(false);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!initialized) {
|
|
17
|
+
fetchFavoriteAndDefaultCountries().then(({ favoriteCountries, defaultCountry }) => {
|
|
18
|
+
setFavoriteCountryCodes(favoriteCountries);
|
|
19
|
+
if (defaultCountry && !value) {
|
|
20
|
+
handleOnChange(defaultCountry);
|
|
21
|
+
}
|
|
22
|
+
setInitialized(true);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}, [initialized, setInitialized, handleOnChange, value]);
|
|
19
26
|
useConvertValue(props);
|
|
20
27
|
const valid = useValid(props);
|
|
21
|
-
if (!Array.isArray(value)) {
|
|
22
|
-
return /* @__PURE__ */ jsx(
|
|
23
|
-
MaterialValueEditor,
|
|
24
|
-
{
|
|
25
|
-
...props,
|
|
26
|
-
values: countriesList,
|
|
27
|
-
title: void 0
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
28
|
return /* @__PURE__ */ jsx(
|
|
32
|
-
|
|
29
|
+
AutocompleteWithFavorites,
|
|
33
30
|
{
|
|
34
31
|
value,
|
|
35
32
|
options: countryCodes,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
favorites: favoriteCountryCodes,
|
|
34
|
+
getOptionLabel: (code) => code ? translate(code) : "",
|
|
35
|
+
valid,
|
|
36
|
+
onChange: (event, newValue) => {
|
|
37
|
+
handleOnChange(newValue);
|
|
38
|
+
},
|
|
39
|
+
fullWidth: true
|
|
41
40
|
}
|
|
42
41
|
);
|
|
43
42
|
}
|
|
@@ -53,39 +53,33 @@ function CustomReactQueryBuilder(props) {
|
|
|
53
53
|
}));
|
|
54
54
|
}, [intl]);
|
|
55
55
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56
|
-
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(QueryBuilderMaterial, { children: /* @__PURE__ */ jsx(
|
|
57
|
-
|
|
56
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(QueryBuilderMaterial, { children: /* @__PURE__ */ jsx(QueryBuilderDnD, { dnd: { ...ReactDnD, ...ReactDndHtml5Backend }, children: /* @__PURE__ */ jsx(
|
|
57
|
+
QueryBuilder,
|
|
58
58
|
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
fieldSelector: ValueSelector,
|
|
82
|
-
valueSourceSelector: ValueSelector
|
|
83
|
-
},
|
|
84
|
-
listsAsArrays: true
|
|
85
|
-
}
|
|
86
|
-
)
|
|
59
|
+
fields,
|
|
60
|
+
query,
|
|
61
|
+
addRuleToNewGroups: true,
|
|
62
|
+
combinators,
|
|
63
|
+
onQueryChange: handleQueryChange,
|
|
64
|
+
getOperators: (fieldName) => getOperators(fieldName, intl),
|
|
65
|
+
validator: queryValidator,
|
|
66
|
+
controlClassnames: {
|
|
67
|
+
queryBuilder: "queryBuilder-branches"
|
|
68
|
+
},
|
|
69
|
+
controlElements: {
|
|
70
|
+
addRuleAction: RuleAddButton,
|
|
71
|
+
addGroupAction: GroupAddButton,
|
|
72
|
+
combinatorSelector: CombinatorSelector,
|
|
73
|
+
removeRuleAction: RemoveButton,
|
|
74
|
+
removeGroupAction: RemoveButton,
|
|
75
|
+
valueEditor: ValueEditor,
|
|
76
|
+
operatorSelector: ValueSelector,
|
|
77
|
+
fieldSelector: ValueSelector,
|
|
78
|
+
valueSourceSelector: ValueSelector
|
|
79
|
+
},
|
|
80
|
+
listsAsArrays: true
|
|
87
81
|
}
|
|
88
|
-
) }) }),
|
|
82
|
+
) }) }) }),
|
|
89
83
|
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(ErrorInput, { name, InputField: FieldErrorAlert }) })
|
|
90
84
|
] });
|
|
91
85
|
}
|
|
@@ -5,16 +5,7 @@ import useCustomFormContext from "../react-hook-form/provider/use-custom-form-co
|
|
|
5
5
|
import { fetchElementsInfos } from "../../../services/explore.js";
|
|
6
6
|
import DirectoryItemsInput from "../react-hook-form/directory-items-input.js";
|
|
7
7
|
function ElementValueEditor(props) {
|
|
8
|
-
const {
|
|
9
|
-
defaultValue,
|
|
10
|
-
name,
|
|
11
|
-
elementType,
|
|
12
|
-
equipmentTypes,
|
|
13
|
-
titleId,
|
|
14
|
-
hideErrorMessage,
|
|
15
|
-
itemFilter,
|
|
16
|
-
onChange
|
|
17
|
-
} = props;
|
|
8
|
+
const { defaultValue, name, elementType, equipmentTypes, titleId, hideErrorMessage, itemFilter, onChange } = props;
|
|
18
9
|
const { setValue } = useCustomFormContext();
|
|
19
10
|
useEffect(() => {
|
|
20
11
|
if (defaultValue && Array.isArray(defaultValue) && defaultValue.length > 0 && defaultValue[0].length > 0 && validate(defaultValue[0])) {
|
|
@@ -57,26 +57,20 @@ function PropertyValueEditor(props) {
|
|
|
57
57
|
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
|
|
58
58
|
onChange: (event, value) => {
|
|
59
59
|
onChange(FieldConstants.PROPERTY_NAME, value);
|
|
60
|
-
}
|
|
60
|
+
},
|
|
61
|
+
size: "small"
|
|
61
62
|
}
|
|
62
63
|
) }),
|
|
63
64
|
/* @__PURE__ */ jsx(Grid, { item: true, xs: 2.5, children: /* @__PURE__ */ jsx(
|
|
64
65
|
Select,
|
|
65
66
|
{
|
|
66
67
|
value: propertyOperator ?? PROPERTY_VALUE_OPERATORS[0].customName,
|
|
67
|
-
size: "
|
|
68
|
+
size: "small",
|
|
68
69
|
error: !valid,
|
|
69
70
|
onChange: (event, value) => {
|
|
70
71
|
onChange(FieldConstants.PROPERTY_OPERATOR, value);
|
|
71
72
|
},
|
|
72
|
-
children: PROPERTY_VALUE_OPERATORS.map((operator) => /* @__PURE__ */ jsx(
|
|
73
|
-
MenuItem,
|
|
74
|
-
{
|
|
75
|
-
value: operator.customName,
|
|
76
|
-
children: intl.formatMessage({ id: operator.label })
|
|
77
|
-
},
|
|
78
|
-
operator.customName
|
|
79
|
-
))
|
|
73
|
+
children: PROPERTY_VALUE_OPERATORS.map((operator) => /* @__PURE__ */ jsx(MenuItem, { value: operator.customName, children: intl.formatMessage({ id: operator.label }) }, operator.customName))
|
|
80
74
|
}
|
|
81
75
|
) }),
|
|
82
76
|
/* @__PURE__ */ jsx(Grid, { item: true, xs: 4.5, children: /* @__PURE__ */ jsx(
|
|
@@ -90,7 +84,8 @@ function PropertyValueEditor(props) {
|
|
|
90
84
|
autoSelect: true,
|
|
91
85
|
onChange: (event, value) => {
|
|
92
86
|
onChange(FieldConstants.PROPERTY_VALUES, value);
|
|
93
|
-
}
|
|
87
|
+
},
|
|
88
|
+
size: "small"
|
|
94
89
|
}
|
|
95
90
|
) })
|
|
96
91
|
] });
|
|
@@ -13,15 +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(
|
|
17
|
-
IconButton,
|
|
18
|
-
{
|
|
19
|
-
size: "small",
|
|
20
|
-
onClick: () => handleDelete(),
|
|
21
|
-
className,
|
|
22
|
-
children: !isLastRuleOrGroup && /* @__PURE__ */ jsx(DeleteIcon, {})
|
|
23
|
-
}
|
|
24
|
-
);
|
|
16
|
+
return /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => handleDelete(), className, children: !isLastRuleOrGroup && /* @__PURE__ */ jsx(DeleteIcon, {}) });
|
|
25
17
|
}
|
|
26
18
|
export {
|
|
27
19
|
RemoveButton as default
|
|
@@ -25,7 +25,8 @@ function TextValueEditor(props) {
|
|
|
25
25
|
onChange: (event, newValue) => handleOnChange(newValue),
|
|
26
26
|
multiple: true,
|
|
27
27
|
fullWidth: true,
|
|
28
|
-
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid })
|
|
28
|
+
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
|
|
29
|
+
size: "small"
|
|
29
30
|
}
|
|
30
31
|
);
|
|
31
32
|
}
|
|
@@ -20,9 +20,7 @@ function TranslatedValueEditor(props) {
|
|
|
20
20
|
if (!values) {
|
|
21
21
|
return {};
|
|
22
22
|
}
|
|
23
|
-
return Object.fromEntries(
|
|
24
|
-
values.map((v) => [v.name, intl.formatMessage({ id: v.label })])
|
|
25
|
-
);
|
|
23
|
+
return Object.fromEntries(values.map((v) => [v.name, intl.formatMessage({ id: v.label })]));
|
|
26
24
|
}, [intl, values]);
|
|
27
25
|
useConvertValue(props);
|
|
28
26
|
const valid = useValid(props);
|
|
@@ -45,7 +43,8 @@ function TranslatedValueEditor(props) {
|
|
|
45
43
|
onChange: (event, newValue) => handleOnChange(newValue),
|
|
46
44
|
multiple: true,
|
|
47
45
|
fullWidth: true,
|
|
48
|
-
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid })
|
|
46
|
+
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
|
|
47
|
+
size: "small"
|
|
49
48
|
}
|
|
50
49
|
);
|
|
51
50
|
}
|
|
@@ -5,5 +5,5 @@ import { ValueEditorProps } from 'react-querybuilder';
|
|
|
5
5
|
* PS : can be extended to manage more than the IN operator
|
|
6
6
|
* PS 2 : don't use this if the operator can be another array operator (like BETWEEN) or change a bit the conditions
|
|
7
7
|
*/
|
|
8
|
-
declare const useConvertValue: ({ operator, value, fieldData: { defaultValue }, handleOnChange
|
|
8
|
+
declare const useConvertValue: ({ operator, value, fieldData: { defaultValue }, handleOnChange }: ValueEditorProps) => void;
|
|
9
9
|
export default useConvertValue;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { OPERATOR_OPTIONS } from "../../filter/expert/expert-filter-constants.js";
|
|
3
|
-
const useConvertValue = ({
|
|
4
|
-
operator,
|
|
5
|
-
value,
|
|
6
|
-
fieldData: { defaultValue },
|
|
7
|
-
handleOnChange
|
|
8
|
-
}) => {
|
|
3
|
+
const useConvertValue = ({ operator, value, fieldData: { defaultValue }, handleOnChange }) => {
|
|
9
4
|
useEffect(
|
|
10
5
|
() => {
|
|
11
6
|
if (operator === OPERATOR_OPTIONS.IN.name && !Array.isArray(value)) {
|
|
@@ -26,15 +26,7 @@ const styles = {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
function ValueEditor(props) {
|
|
29
|
-
const {
|
|
30
|
-
field,
|
|
31
|
-
operator,
|
|
32
|
-
value,
|
|
33
|
-
rule,
|
|
34
|
-
handleOnChange,
|
|
35
|
-
inputType,
|
|
36
|
-
fieldData
|
|
37
|
-
} = props;
|
|
29
|
+
const { field, operator, value, rule, handleOnChange, inputType, fieldData } = props;
|
|
38
30
|
const formContext = useFormContext();
|
|
39
31
|
const { getValues } = formContext;
|
|
40
32
|
const itemFilter = useCallback(
|
|
@@ -54,9 +46,7 @@ function ValueEditor(props) {
|
|
|
54
46
|
if (operator === OPERATOR_OPTIONS.EXISTS.name || operator === OPERATOR_OPTIONS.NOT_EXISTS.name) {
|
|
55
47
|
return null;
|
|
56
48
|
}
|
|
57
|
-
if ([FieldType.COUNTRY, FieldType.COUNTRY_1, FieldType.COUNTRY_2].includes(
|
|
58
|
-
field
|
|
59
|
-
)) {
|
|
49
|
+
if ([FieldType.COUNTRY, FieldType.COUNTRY_1, FieldType.COUNTRY_2].includes(field)) {
|
|
60
50
|
return /* @__PURE__ */ jsx(CountryValueEditor, { ...props });
|
|
61
51
|
}
|
|
62
52
|
if (fieldData.dataType === DataType.ENUM) {
|
|
@@ -85,7 +75,7 @@ function ValueEditor(props) {
|
|
|
85
75
|
}
|
|
86
76
|
);
|
|
87
77
|
}
|
|
88
|
-
if (
|
|
78
|
+
if (fieldData.dataType === DataType.STRING) {
|
|
89
79
|
return /* @__PURE__ */ jsx(TextValueEditor, { ...props });
|
|
90
80
|
}
|
|
91
81
|
if (fieldData.dataType === DataType.PROPERTY) {
|
|
@@ -97,13 +87,7 @@ function ValueEditor(props) {
|
|
|
97
87
|
} else {
|
|
98
88
|
equipmentType = getValues(FieldConstants.EQUIPMENT_TYPE);
|
|
99
89
|
}
|
|
100
|
-
return /* @__PURE__ */ jsx(
|
|
101
|
-
PropertyValueEditor,
|
|
102
|
-
{
|
|
103
|
-
equipmentType,
|
|
104
|
-
valueEditorProps: props
|
|
105
|
-
}
|
|
106
|
-
);
|
|
90
|
+
return /* @__PURE__ */ jsx(PropertyValueEditor, { equipmentType, valueEditorProps: props });
|
|
107
91
|
}
|
|
108
92
|
if (fieldData.dataType === DataType.COMBINATOR) {
|
|
109
93
|
return /* @__PURE__ */ jsx(GroupValueEditor, { ...props });
|
|
@@ -92,27 +92,39 @@ declare const filterExpertEn: {
|
|
|
92
92
|
substationProperty: string;
|
|
93
93
|
substationProperty1: string;
|
|
94
94
|
substationProperty2: string;
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
substationProperty1Twt: string;
|
|
96
|
+
substationProperty2Twt: string;
|
|
97
|
+
substationProperty3Twt: string;
|
|
97
98
|
ratedVoltage1KV: string;
|
|
98
99
|
ratedVoltage2KV: string;
|
|
99
|
-
|
|
100
|
+
ratedVoltage0KVTwt: string;
|
|
101
|
+
ratedVoltage1KVTwt: string;
|
|
102
|
+
ratedVoltage2KVTwt: string;
|
|
103
|
+
ratedVoltage3KVTwt: string;
|
|
100
104
|
nominalVoltage1: string;
|
|
101
105
|
nominalVoltage2: string;
|
|
102
106
|
nominalVoltage3: string;
|
|
103
107
|
nominalVoltage1KV: string;
|
|
104
108
|
nominalVoltage2KV: string;
|
|
105
|
-
|
|
109
|
+
nominalVoltage1KVTwt: string;
|
|
110
|
+
nominalVoltage2KVTwt: string;
|
|
111
|
+
nominalVoltage3KVTwt: string;
|
|
106
112
|
voltageLevelId1: string;
|
|
107
113
|
voltageLevelId2: string;
|
|
108
|
-
|
|
114
|
+
voltageLevelId1Twt: string;
|
|
115
|
+
voltageLevelId2Twt: string;
|
|
116
|
+
voltageLevelId3Twt: string;
|
|
109
117
|
terminal1Connected: string;
|
|
110
118
|
terminal2Connected: string;
|
|
111
|
-
|
|
119
|
+
terminal1ConnectedTwt: string;
|
|
120
|
+
terminal2ConnectedTwt: string;
|
|
121
|
+
terminal3ConnectedTwt: string;
|
|
112
122
|
voltageLevelProperty: string;
|
|
113
123
|
voltageLevelProperty1: string;
|
|
114
124
|
voltageLevelProperty2: string;
|
|
115
|
-
|
|
125
|
+
voltageLevelProperty1Twt: string;
|
|
126
|
+
voltageLevelProperty2Twt: string;
|
|
127
|
+
voltageLevelProperty3Twt: string;
|
|
116
128
|
'maxQAtNominalV.svar': string;
|
|
117
129
|
'minQAtNominalV.svar': string;
|
|
118
130
|
'fixQAtNominalV.svar': string;
|
|
@@ -162,5 +174,7 @@ declare const filterExpertEn: {
|
|
|
162
174
|
shuntSusceptance1: string;
|
|
163
175
|
shuntConductance2: string;
|
|
164
176
|
shuntSusceptance2: string;
|
|
177
|
+
pairingKey: string;
|
|
178
|
+
tieLineId: string;
|
|
165
179
|
};
|
|
166
180
|
export default filterExpertEn;
|