@gridsuite/commons-ui 0.88.1 → 0.88.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/components/contingencyList/criteriaBased/CriteriaBasedForm.js +0 -1
- package/dist/components/dialogs/elementCreationDialog/ElementCreationDialog.js +0 -1
- package/dist/components/filter/FilterForm.js +0 -1
- package/dist/components/filter/HeaderFilterForm.js +0 -1
- package/dist/components/filter/expert/ExpertFilterForm.js +0 -1
- package/dist/components/filter/expert/expertFilter.type.d.ts +1 -0
- package/dist/components/filter/expert/expertFilter.type.js +1 -0
- package/dist/components/filter/expert/expertFilterConstants.d.ts +5 -0
- package/dist/components/filter/expert/expertFilterConstants.js +1 -0
- package/dist/components/filter/expert/expertFilterUtils.js +1 -5
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +0 -1
- package/dist/components/index.js +3 -2
- package/dist/components/inputs/index.js +3 -2
- package/dist/components/inputs/reactHookForm/autocompleteInputs/AutocompleteInput.d.ts +2 -1
- package/dist/components/inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js +16 -3
- package/dist/components/inputs/reactHookForm/index.js +3 -2
- package/dist/components/inputs/reactHookForm/provider/CustomFormProvider.d.ts +4 -2
- package/dist/components/inputs/reactHookForm/provider/CustomFormProvider.js +12 -6
- package/dist/components/inputs/reactHookForm/text/TextInput.d.ts +2 -1
- package/dist/components/inputs/reactHookForm/text/TextInput.js +15 -4
- package/dist/components/inputs/reactHookForm/utils/CancelButton.d.ts +3 -9
- package/dist/components/inputs/reactHookForm/utils/CancelButton.js +2 -3
- package/dist/components/inputs/reactHookForm/utils/HelperPreviousValue.d.ts +9 -0
- package/dist/components/inputs/reactHookForm/utils/HelperPreviousValue.js +40 -0
- package/dist/components/inputs/reactHookForm/utils/functions.d.ts +0 -4
- package/dist/components/inputs/reactHookForm/utils/functions.js +0 -9
- package/dist/components/inputs/reactHookForm/utils/index.d.ts +1 -0
- package/dist/components/inputs/reactHookForm/utils/index.js +3 -2
- package/dist/components/inputs/reactQueryBuilder/CustomReactQueryBuilder.js +2 -1
- package/dist/components/inputs/reactQueryBuilder/OperatorSelector.d.ts +3 -0
- package/dist/components/inputs/reactQueryBuilder/OperatorSelector.js +22 -0
- package/dist/components/inputs/reactQueryBuilder/PropertyValueEditor.js +7 -9
- package/dist/index.js +9 -3
- package/dist/services/utils.js +1 -1
- package/dist/translations/en/componentsEn.d.ts +10 -0
- package/dist/translations/en/componentsEn.js +7 -0
- package/dist/translations/en/filterEn.d.ts +1 -0
- package/dist/translations/en/filterEn.js +2 -1
- package/dist/translations/en/index.d.ts +1 -0
- package/dist/translations/en/index.js +2 -0
- package/dist/translations/fr/componentsFr.d.ts +10 -0
- package/dist/translations/fr/componentsFr.js +7 -0
- package/dist/translations/fr/filterFr.d.ts +1 -0
- package/dist/translations/fr/filterFr.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/elementType.d.ts +3 -0
- package/dist/utils/types/equipmentType.d.ts +11 -6
- package/dist/utils/types/equipmentType.js +22 -17
- package/dist/utils/types/index.js +2 -1
- package/package.json +1 -2
|
@@ -17,7 +17,6 @@ import "@mui/material/DialogTitle";
|
|
|
17
17
|
import "@mui/material/DialogContent";
|
|
18
18
|
import "@mui/material/DialogActions";
|
|
19
19
|
import "@mui/material/Button";
|
|
20
|
-
import "@mui/material/styles";
|
|
21
20
|
function CriteriaBasedForm({ equipments, defaultValues, children }) {
|
|
22
21
|
const { getValues, setValue } = useFormContext();
|
|
23
22
|
const { snackError } = useSnackMessage();
|
|
@@ -33,7 +33,6 @@ import "@mui/material/Button";
|
|
|
33
33
|
import "@mui/material/Grid";
|
|
34
34
|
import "react-csv-downloader";
|
|
35
35
|
import "@mui/material/Alert";
|
|
36
|
-
import "@mui/material/styles";
|
|
37
36
|
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
38
37
|
import "localized-countries";
|
|
39
38
|
import "localized-countries/data/fr";
|
|
@@ -19,7 +19,6 @@ import "@mui/material/DialogTitle";
|
|
|
19
19
|
import "@mui/material/DialogContent";
|
|
20
20
|
import "@mui/material/DialogActions";
|
|
21
21
|
import "@mui/material/Button";
|
|
22
|
-
import "@mui/material/styles";
|
|
23
22
|
function FilterForm({
|
|
24
23
|
sourceFilterForExplicitNamingConversion,
|
|
25
24
|
creation,
|
|
@@ -31,7 +31,6 @@ import "@mui/material/Button";
|
|
|
31
31
|
import "@mui/material/Grid";
|
|
32
32
|
import "react-csv-downloader";
|
|
33
33
|
import "@mui/material/Alert";
|
|
34
|
-
import "@mui/material/styles";
|
|
35
34
|
import { RadioInput } from "../inputs/reactHookForm/booleans/RadioInput.js";
|
|
36
35
|
import "../inputs/reactHookForm/numbers/RangeInput.js";
|
|
37
36
|
import "localized-countries";
|
|
@@ -24,7 +24,6 @@ import "@mui/material/DialogTitle";
|
|
|
24
24
|
import "@mui/material/DialogContent";
|
|
25
25
|
import "@mui/material/DialogActions";
|
|
26
26
|
import "@mui/material/Button";
|
|
27
|
-
import "@mui/material/styles";
|
|
28
27
|
import { FieldType } from "../../../utils/types/fieldType.js";
|
|
29
28
|
import { useFormatLabelWithUnit } from "../../../hooks/useFormatLabelWithUnit.js";
|
|
30
29
|
import { filterStyles } from "../HeaderFilterForm.js";
|
|
@@ -7,6 +7,7 @@ var OperatorType = /* @__PURE__ */ ((OperatorType2) => {
|
|
|
7
7
|
OperatorType2["GREATER_OR_EQUALS"] = "GREATER_OR_EQUALS";
|
|
8
8
|
OperatorType2["BETWEEN"] = "BETWEEN";
|
|
9
9
|
OperatorType2["IN"] = "IN";
|
|
10
|
+
OperatorType2["NOT_IN"] = "NOT_IN";
|
|
10
11
|
OperatorType2["IS"] = "IS";
|
|
11
12
|
OperatorType2["CONTAINS"] = "CONTAINS";
|
|
12
13
|
OperatorType2["BEGINS_WITH"] = "BEGINS_WITH";
|
|
@@ -142,6 +142,11 @@ export declare const OPERATOR_OPTIONS: {
|
|
|
142
142
|
customName: OperatorType;
|
|
143
143
|
label: string;
|
|
144
144
|
};
|
|
145
|
+
NOT_IN: {
|
|
146
|
+
name: string;
|
|
147
|
+
customName: OperatorType;
|
|
148
|
+
label: string;
|
|
149
|
+
};
|
|
145
150
|
IS: {
|
|
146
151
|
name: OperatorType;
|
|
147
152
|
customName: OperatorType;
|
|
@@ -145,6 +145,7 @@ const OPERATOR_OPTIONS = {
|
|
|
145
145
|
label: "between"
|
|
146
146
|
},
|
|
147
147
|
IN: { name: "in", customName: OperatorType.IN, label: "in" },
|
|
148
|
+
NOT_IN: { name: "notIn", customName: OperatorType.NOT_IN, label: "notIn" },
|
|
148
149
|
// String
|
|
149
150
|
IS: { name: OperatorType.IS, customName: OperatorType.IS, label: "is" },
|
|
150
151
|
CONTAINS: {
|
|
@@ -98,11 +98,7 @@ const getOperators = (fieldName, intl) => {
|
|
|
98
98
|
}));
|
|
99
99
|
}
|
|
100
100
|
case DataType.PROPERTY: {
|
|
101
|
-
|
|
102
|
-
return propertiesOperators.map((operator) => ({
|
|
103
|
-
name: operator.name,
|
|
104
|
-
label: intl.formatMessage({ id: operator.label })
|
|
105
|
-
}));
|
|
101
|
+
return [];
|
|
106
102
|
}
|
|
107
103
|
case DataType.COMBINATOR: {
|
|
108
104
|
const combinatorOperators = [OPERATOR_OPTIONS.IS];
|
|
@@ -26,7 +26,6 @@ import "@mui/material/DialogTitle";
|
|
|
26
26
|
import "@mui/material/DialogContent";
|
|
27
27
|
import "@mui/material/DialogActions";
|
|
28
28
|
import "@mui/material/Button";
|
|
29
|
-
import "@mui/material/styles";
|
|
30
29
|
import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./ExplicitNamingFilterConstants.js";
|
|
31
30
|
import { filterStyles } from "../HeaderFilterForm.js";
|
|
32
31
|
import * as yup from "yup";
|
package/dist/components/index.js
CHANGED
|
@@ -75,7 +75,8 @@ import { CancelButton } from "./inputs/reactHookForm/utils/CancelButton.js";
|
|
|
75
75
|
import { FieldLabel } from "./inputs/reactHookForm/utils/FieldLabel.js";
|
|
76
76
|
import { SubmitButton } from "./inputs/reactHookForm/utils/SubmitButton.js";
|
|
77
77
|
import { TextFieldWithAdornment } from "./inputs/reactHookForm/utils/TextFieldWithAdornment.js";
|
|
78
|
-
import { genHelperError,
|
|
78
|
+
import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./inputs/reactHookForm/utils/functions.js";
|
|
79
|
+
import { HelperPreviousValue } from "./inputs/reactHookForm/utils/HelperPreviousValue.js";
|
|
79
80
|
import { AddButton } from "./inputs/reactQueryBuilder/AddButton.js";
|
|
80
81
|
import { AutocompleteWithFavorites } from "./inputs/reactQueryBuilder/AutocompleteWithFavorites.js";
|
|
81
82
|
import { CombinatorSelector } from "./inputs/reactQueryBuilder/CombinatorSelector.js";
|
|
@@ -168,6 +169,7 @@ export {
|
|
|
168
169
|
FloatInput,
|
|
169
170
|
GridLogo,
|
|
170
171
|
GroupValueEditor,
|
|
172
|
+
HelperPreviousValue,
|
|
171
173
|
InputWithPopupConfirmation,
|
|
172
174
|
IntegerInput,
|
|
173
175
|
LOAD_TYPE_OPTIONS,
|
|
@@ -228,7 +230,6 @@ export {
|
|
|
228
230
|
exportExpertRules,
|
|
229
231
|
extractDefault,
|
|
230
232
|
genHelperError,
|
|
231
|
-
genHelperPreviousValue,
|
|
232
233
|
generateTreeViewFinderClass,
|
|
233
234
|
getCriteriaBasedFormData,
|
|
234
235
|
getCriteriaBasedSchema,
|
|
@@ -33,7 +33,8 @@ import { CancelButton } from "./reactHookForm/utils/CancelButton.js";
|
|
|
33
33
|
import { FieldLabel } from "./reactHookForm/utils/FieldLabel.js";
|
|
34
34
|
import { SubmitButton } from "./reactHookForm/utils/SubmitButton.js";
|
|
35
35
|
import { TextFieldWithAdornment } from "./reactHookForm/utils/TextFieldWithAdornment.js";
|
|
36
|
-
import { genHelperError,
|
|
36
|
+
import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./reactHookForm/utils/functions.js";
|
|
37
|
+
import { HelperPreviousValue } from "./reactHookForm/utils/HelperPreviousValue.js";
|
|
37
38
|
import { AddButton } from "./reactQueryBuilder/AddButton.js";
|
|
38
39
|
import { AutocompleteWithFavorites } from "./reactQueryBuilder/AutocompleteWithFavorites.js";
|
|
39
40
|
import { CombinatorSelector } from "./reactQueryBuilder/CombinatorSelector.js";
|
|
@@ -76,6 +77,7 @@ export {
|
|
|
76
77
|
FieldLabel,
|
|
77
78
|
FloatInput,
|
|
78
79
|
GroupValueEditor,
|
|
80
|
+
HelperPreviousValue,
|
|
79
81
|
InputWithPopupConfirmation,
|
|
80
82
|
IntegerInput,
|
|
81
83
|
MidFormError,
|
|
@@ -103,7 +105,6 @@ export {
|
|
|
103
105
|
ValueEditor,
|
|
104
106
|
ValueSelector,
|
|
105
107
|
genHelperError,
|
|
106
|
-
genHelperPreviousValue,
|
|
107
108
|
getRangeInputSchema,
|
|
108
109
|
gridItem,
|
|
109
110
|
identity,
|
|
@@ -12,8 +12,9 @@ export interface AutocompleteInputProps extends Omit<AutocompleteProps<Option, b
|
|
|
12
12
|
allowNewValue?: boolean;
|
|
13
13
|
onChangeCallback?: () => void;
|
|
14
14
|
formProps?: Omit<TextFieldProps, 'value' | 'onChange' | 'inputRef' | 'inputProps' | 'InputProps'>;
|
|
15
|
+
disabledTooltip?: boolean;
|
|
15
16
|
}
|
|
16
17
|
export declare function AutocompleteInput({ name, label, options, outputTransform, // transform materialUi input value before sending it to react hook form, mostly used to deal with select fields that need to return a string
|
|
17
18
|
inputTransform, // transform react hook form value before sending it to materialUi input, mostly used to deal with select fields that need to return a string
|
|
18
19
|
readOnly, previousValue, allowNewValue, onChangeCallback, // method called when input value is changing
|
|
19
|
-
formProps, ...props }: AutocompleteInputProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
formProps, disabledTooltip, ...props }: AutocompleteInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Autocomplete, TextField } from "@mui/material";
|
|
3
3
|
import { useController } from "react-hook-form";
|
|
4
|
-
import { identity, genHelperError,
|
|
4
|
+
import { identity, genHelperError, isFieldRequired } from "../utils/functions.js";
|
|
5
5
|
import { FieldLabel } from "../utils/FieldLabel.js";
|
|
6
6
|
import { useCustomFormContext } from "../provider/useCustomFormContext.js";
|
|
7
|
+
import { HelperPreviousValue } from "../utils/HelperPreviousValue.js";
|
|
7
8
|
function AutocompleteInput({
|
|
8
9
|
name,
|
|
9
10
|
label,
|
|
@@ -18,14 +19,19 @@ function AutocompleteInput({
|
|
|
18
19
|
onChangeCallback,
|
|
19
20
|
// method called when input value is changing
|
|
20
21
|
formProps,
|
|
22
|
+
disabledTooltip,
|
|
21
23
|
...props
|
|
22
24
|
}) {
|
|
23
|
-
const { validationSchema, getValues, removeOptional } = useCustomFormContext();
|
|
25
|
+
const { validationSchema, getValues, removeOptional, isNodeBuilt, isUpdate } = useCustomFormContext();
|
|
24
26
|
const {
|
|
25
27
|
field: { onChange, value, ref },
|
|
26
28
|
fieldState: { error }
|
|
27
29
|
} = useController({ name });
|
|
28
30
|
const handleChange = (newValue) => {
|
|
31
|
+
const currentValue = getValues(name);
|
|
32
|
+
if ((currentValue == null ? void 0 : currentValue.id) === newValue) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
29
35
|
onChangeCallback == null ? void 0 : onChangeCallback();
|
|
30
36
|
if (!allowNewValue || typeof newValue !== "string") {
|
|
31
37
|
onChange(outputTransform(newValue));
|
|
@@ -64,7 +70,14 @@ function AutocompleteInput({
|
|
|
64
70
|
},
|
|
65
71
|
inputRef: ref,
|
|
66
72
|
inputProps: { ...inputProps, readOnly },
|
|
67
|
-
|
|
73
|
+
helperText: /* @__PURE__ */ jsx(
|
|
74
|
+
HelperPreviousValue,
|
|
75
|
+
{
|
|
76
|
+
previousValue,
|
|
77
|
+
isNodeBuilt,
|
|
78
|
+
disabledTooltip: disabledTooltip || !isUpdate && isNodeBuilt
|
|
79
|
+
}
|
|
80
|
+
),
|
|
68
81
|
...genHelperError(error == null ? void 0 : error.message),
|
|
69
82
|
...formProps,
|
|
70
83
|
...rest
|
|
@@ -32,7 +32,8 @@ import { CancelButton } from "./utils/CancelButton.js";
|
|
|
32
32
|
import { FieldLabel } from "./utils/FieldLabel.js";
|
|
33
33
|
import { SubmitButton } from "./utils/SubmitButton.js";
|
|
34
34
|
import { TextFieldWithAdornment } from "./utils/TextFieldWithAdornment.js";
|
|
35
|
-
import { genHelperError,
|
|
35
|
+
import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./utils/functions.js";
|
|
36
|
+
import { HelperPreviousValue } from "./utils/HelperPreviousValue.js";
|
|
36
37
|
export {
|
|
37
38
|
AutocompleteInput,
|
|
38
39
|
BooleanInput,
|
|
@@ -52,6 +53,7 @@ export {
|
|
|
52
53
|
FieldErrorAlert,
|
|
53
54
|
FieldLabel,
|
|
54
55
|
FloatInput,
|
|
56
|
+
HelperPreviousValue,
|
|
55
57
|
InputWithPopupConfirmation,
|
|
56
58
|
IntegerInput,
|
|
57
59
|
MidFormError,
|
|
@@ -71,7 +73,6 @@ export {
|
|
|
71
73
|
TextInput,
|
|
72
74
|
UniqueNameInput,
|
|
73
75
|
genHelperError,
|
|
74
|
-
genHelperPreviousValue,
|
|
75
76
|
getRangeInputSchema,
|
|
76
77
|
gridItem,
|
|
77
78
|
identity,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
3
3
|
import { ObjectSchema } from 'yup';
|
|
4
4
|
|
|
@@ -6,8 +6,10 @@ type CustomFormContextProps<TFieldValues extends FieldValues = FieldValues> = {
|
|
|
6
6
|
removeOptional?: boolean;
|
|
7
7
|
validationSchema: ObjectSchema<TFieldValues>;
|
|
8
8
|
language?: string;
|
|
9
|
+
isNodeBuilt?: boolean;
|
|
10
|
+
isUpdate?: boolean;
|
|
9
11
|
};
|
|
10
12
|
export type MergedFormContextProps<TFieldValues extends FieldValues = FieldValues> = UseFormReturn<TFieldValues> & CustomFormContextProps<TFieldValues>;
|
|
11
|
-
export declare const CustomFormContext:
|
|
13
|
+
export declare const CustomFormContext: import('react').Context<CustomFormContextProps<FieldValues>>;
|
|
12
14
|
export declare function CustomFormProvider<TFieldValues extends FieldValues = FieldValues>(props: PropsWithChildren<MergedFormContextProps<TFieldValues>>): import("react/jsx-runtime").JSX.Element;
|
|
13
15
|
export {};
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { createContext, useMemo } from "react";
|
|
3
3
|
import { FormProvider } from "react-hook-form";
|
|
4
4
|
import * as yup from "yup";
|
|
5
|
+
import "react-intl";
|
|
6
|
+
import "../../../../utils/types/equipmentType.js";
|
|
7
|
+
import "@mui/material";
|
|
5
8
|
import { getSystemLanguage } from "../../../../hooks/useLocalizedCountries.js";
|
|
9
|
+
import "notistack";
|
|
6
10
|
const CustomFormContext = createContext({
|
|
7
11
|
removeOptional: false,
|
|
8
12
|
validationSchema: yup.object(),
|
|
9
|
-
language: getSystemLanguage()
|
|
13
|
+
language: getSystemLanguage(),
|
|
14
|
+
isNodeBuilt: false,
|
|
15
|
+
isUpdate: false
|
|
10
16
|
});
|
|
11
17
|
function CustomFormProvider(props) {
|
|
12
|
-
const { validationSchema, removeOptional, language, children, ...formMethods } = props;
|
|
18
|
+
const { validationSchema, removeOptional, language, isNodeBuilt, isUpdate, children, ...formMethods } = props;
|
|
13
19
|
return /* @__PURE__ */ jsx(FormProvider, { ...formMethods, children: /* @__PURE__ */ jsx(
|
|
14
20
|
CustomFormContext.Provider,
|
|
15
21
|
{
|
|
16
|
-
value:
|
|
17
|
-
() => ({ validationSchema, removeOptional, language }),
|
|
18
|
-
[validationSchema, removeOptional, language]
|
|
22
|
+
value: useMemo(
|
|
23
|
+
() => ({ validationSchema, removeOptional, language, isNodeBuilt, isUpdate }),
|
|
24
|
+
[validationSchema, removeOptional, language, isNodeBuilt, isUpdate]
|
|
19
25
|
),
|
|
20
26
|
children
|
|
21
27
|
}
|
|
@@ -19,9 +19,10 @@ export interface TextInputProps {
|
|
|
19
19
|
previousValue?: Input;
|
|
20
20
|
clearable?: boolean;
|
|
21
21
|
formProps?: Omit<TextFieldWithAdornmentProps | TextFieldProps, 'value' | 'onChange' | 'inputRef' | 'inputProps' | 'InputProps'>;
|
|
22
|
+
disabledTooltip?: boolean;
|
|
22
23
|
}
|
|
23
24
|
export declare function TextInput({ name, label, labelValues, // this prop is used to add a value to label. this value is displayed without being translated
|
|
24
25
|
id, adornment, customAdornment, outputTransform, // transform materialUi input value before sending it to react hook form, mostly used to deal with number fields
|
|
25
26
|
inputTransform, // transform react hook form value before sending it to materialUi input, mostly used to deal with number fields
|
|
26
27
|
acceptValue, // used to check user entry before committing the input change, used mostly to prevent user from typing a character in number field
|
|
27
|
-
previousValue, clearable, formProps, }: TextInputProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
previousValue, clearable, formProps, disabledTooltip, }: TextInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,8 +4,9 @@ import { Clear } from "@mui/icons-material";
|
|
|
4
4
|
import { useController } from "react-hook-form";
|
|
5
5
|
import { TextFieldWithAdornment } from "../utils/TextFieldWithAdornment.js";
|
|
6
6
|
import { FieldLabel } from "../utils/FieldLabel.js";
|
|
7
|
-
import { identity, isFieldRequired, genHelperError
|
|
7
|
+
import { identity, isFieldRequired, genHelperError } from "../utils/functions.js";
|
|
8
8
|
import { useCustomFormContext } from "../provider/useCustomFormContext.js";
|
|
9
|
+
import { HelperPreviousValue } from "../utils/HelperPreviousValue.js";
|
|
9
10
|
function TextInput({
|
|
10
11
|
name,
|
|
11
12
|
label,
|
|
@@ -22,9 +23,11 @@ function TextInput({
|
|
|
22
23
|
// used to check user entry before committing the input change, used mostly to prevent user from typing a character in number field
|
|
23
24
|
previousValue,
|
|
24
25
|
clearable,
|
|
25
|
-
formProps
|
|
26
|
+
formProps,
|
|
27
|
+
disabledTooltip
|
|
28
|
+
// In case we don't want to show tooltip on the value and warning/info icons
|
|
26
29
|
}) {
|
|
27
|
-
const { validationSchema, getValues, removeOptional } = useCustomFormContext();
|
|
30
|
+
const { validationSchema, getValues, removeOptional, isNodeBuilt, isUpdate } = useCustomFormContext();
|
|
28
31
|
const {
|
|
29
32
|
field: { onChange, value, ref },
|
|
30
33
|
fieldState: { error }
|
|
@@ -67,7 +70,15 @@ function TextInput({
|
|
|
67
70
|
...clearable && adornment && {
|
|
68
71
|
handleClearValue
|
|
69
72
|
},
|
|
70
|
-
|
|
73
|
+
helperText: /* @__PURE__ */ jsx(
|
|
74
|
+
HelperPreviousValue,
|
|
75
|
+
{
|
|
76
|
+
previousValue,
|
|
77
|
+
isNodeBuilt,
|
|
78
|
+
disabledTooltip: disabledTooltip || !isUpdate && isNodeBuilt,
|
|
79
|
+
adornmentText: adornment == null ? void 0 : adornment.text
|
|
80
|
+
}
|
|
81
|
+
),
|
|
71
82
|
...genHelperError(error == null ? void 0 : error.message),
|
|
72
83
|
...formProps,
|
|
73
84
|
...adornment && { ...finalAdornment }
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
-
*/
|
|
7
|
-
export declare function CancelButton({ ...inProps }: {
|
|
8
|
-
[x: string]: any;
|
|
9
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { ButtonProps } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
export declare function CancelButton(inProps: Readonly<Omit<ButtonProps, 'children'>>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from "@mui/material";
|
|
2
|
+
import { useThemeProps, Button } from "@mui/material";
|
|
3
3
|
import { FormattedMessage } from "react-intl";
|
|
4
|
-
|
|
5
|
-
function CancelButton({ ...inProps }) {
|
|
4
|
+
function CancelButton(inProps) {
|
|
6
5
|
const props = useThemeProps({ props: inProps, name: "CancelButton" });
|
|
7
6
|
return /* @__PURE__ */ jsx(Button, { ...props, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "cancel" }) });
|
|
8
7
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Input } from '../../../../utils';
|
|
2
|
+
|
|
3
|
+
export interface HelperPreviousValueProps {
|
|
4
|
+
previousValue?: Input;
|
|
5
|
+
isNodeBuilt?: boolean;
|
|
6
|
+
disabledTooltip?: boolean;
|
|
7
|
+
adornmentText?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function HelperPreviousValue({ previousValue, isNodeBuilt, disabledTooltip, adornmentText, }: Readonly<HelperPreviousValueProps>): import("react/jsx-runtime").JSX.Element | undefined;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useIntl } from "react-intl";
|
|
3
|
+
import { FormHelperText, Stack, Tooltip, Typography } from "@mui/material";
|
|
4
|
+
import { InfoOutlined, WarningAmberRounded } from "@mui/icons-material";
|
|
5
|
+
function HelperPreviousValue({
|
|
6
|
+
previousValue,
|
|
7
|
+
isNodeBuilt,
|
|
8
|
+
disabledTooltip,
|
|
9
|
+
adornmentText
|
|
10
|
+
}) {
|
|
11
|
+
const intl = useIntl();
|
|
12
|
+
if (!previousValue && previousValue !== 0) {
|
|
13
|
+
return void 0;
|
|
14
|
+
}
|
|
15
|
+
return /* @__PURE__ */ jsx(FormHelperText, { error: false, sx: { marginLeft: 0 }, children: !disabledTooltip ? /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, children: [
|
|
16
|
+
/* @__PURE__ */ jsx(
|
|
17
|
+
Tooltip,
|
|
18
|
+
{
|
|
19
|
+
title: intl.formatMessage({ id: isNodeBuilt ? "builtNodeTooltip" : "notBuiltNodeTooltip" }),
|
|
20
|
+
placement: "right",
|
|
21
|
+
arrow: true,
|
|
22
|
+
PopperProps: {
|
|
23
|
+
modifiers: [
|
|
24
|
+
{
|
|
25
|
+
name: "offset",
|
|
26
|
+
options: {
|
|
27
|
+
offset: [0, -10]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
children: isNodeBuilt ? /* @__PURE__ */ jsx(InfoOutlined, { color: "info", fontSize: "small" }) : /* @__PURE__ */ jsx(WarningAmberRounded, { color: "warning", fontSize: "small" })
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ jsx(Typography, { noWrap: true, fontSize: 11, align: "center", children: previousValue + (adornmentText ? ` ${adornmentText}` : "") })
|
|
36
|
+
] }) : previousValue + (adornmentText ? ` ${adornmentText}` : "") });
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
HelperPreviousValue
|
|
40
|
+
};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
|
|
3
|
-
export declare function genHelperPreviousValue(previousValue: number | string, adornment?: any): {
|
|
4
|
-
error?: boolean | undefined;
|
|
5
|
-
helperText?: string | undefined;
|
|
6
|
-
};
|
|
7
3
|
export declare function genHelperError(...errors: any[]): {
|
|
8
4
|
error: boolean;
|
|
9
5
|
helperText: import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,14 +2,6 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { FormattedMessage } from "react-intl";
|
|
3
3
|
import { getIn } from "yup";
|
|
4
4
|
import { Grid } from "@mui/material";
|
|
5
|
-
function genHelperPreviousValue(previousValue, adornment) {
|
|
6
|
-
return {
|
|
7
|
-
...(previousValue || previousValue === 0) && {
|
|
8
|
-
error: false,
|
|
9
|
-
helperText: previousValue + (adornment ? ` ${adornment == null ? void 0 : adornment.text}` : "")
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
5
|
function genHelperError(...errors) {
|
|
14
6
|
const inError = errors.find((e) => e);
|
|
15
7
|
if (inError) {
|
|
@@ -43,7 +35,6 @@ const toFloatOrNullValue = (value) => {
|
|
|
43
35
|
};
|
|
44
36
|
export {
|
|
45
37
|
genHelperError,
|
|
46
|
-
genHelperPreviousValue,
|
|
47
38
|
gridItem,
|
|
48
39
|
identity,
|
|
49
40
|
isFieldRequired,
|
|
@@ -2,14 +2,15 @@ import { CancelButton } from "./CancelButton.js";
|
|
|
2
2
|
import { FieldLabel } from "./FieldLabel.js";
|
|
3
3
|
import { SubmitButton } from "./SubmitButton.js";
|
|
4
4
|
import { TextFieldWithAdornment } from "./TextFieldWithAdornment.js";
|
|
5
|
-
import { genHelperError,
|
|
5
|
+
import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./functions.js";
|
|
6
|
+
import { HelperPreviousValue } from "./HelperPreviousValue.js";
|
|
6
7
|
export {
|
|
7
8
|
CancelButton,
|
|
8
9
|
FieldLabel,
|
|
10
|
+
HelperPreviousValue,
|
|
9
11
|
SubmitButton,
|
|
10
12
|
TextFieldWithAdornment,
|
|
11
13
|
genHelperError,
|
|
12
|
-
genHelperPreviousValue,
|
|
13
14
|
gridItem,
|
|
14
15
|
identity,
|
|
15
16
|
isFieldRequired,
|
|
@@ -18,6 +18,7 @@ import { FieldErrorAlert } from "../reactHookForm/errorManagement/FieldErrorAler
|
|
|
18
18
|
import { countRules, queryValidator, getOperators } from "../../filter/expert/expertFilterUtils.js";
|
|
19
19
|
import { RemoveButton } from "./RemoveButton.js";
|
|
20
20
|
import { FieldSelector } from "./FieldSelector.js";
|
|
21
|
+
import { OperatorSelector } from "./OperatorSelector.js";
|
|
21
22
|
function RuleAddButton(props) {
|
|
22
23
|
return /* @__PURE__ */ jsx(AddButton, { ...props, label: "rule" });
|
|
23
24
|
}
|
|
@@ -86,7 +87,7 @@ function CustomReactQueryBuilder(props) {
|
|
|
86
87
|
removeRuleAction: RemoveButton,
|
|
87
88
|
removeGroupAction: RemoveButton,
|
|
88
89
|
valueEditor: ValueEditor,
|
|
89
|
-
operatorSelector:
|
|
90
|
+
operatorSelector: OperatorSelector,
|
|
90
91
|
fieldSelector: FieldSelector,
|
|
91
92
|
valueSourceSelector: ValueSelector
|
|
92
93
|
},
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MaterialValueSelector } from "@react-querybuilder/material";
|
|
3
|
+
import "react";
|
|
4
|
+
import "react-intl";
|
|
5
|
+
import "../../../utils/types/equipmentType.js";
|
|
6
|
+
import "@mui/material";
|
|
7
|
+
import "localized-countries";
|
|
8
|
+
import "localized-countries/data/fr";
|
|
9
|
+
import "localized-countries/data/en";
|
|
10
|
+
import "notistack";
|
|
11
|
+
import { useSelectAppearance } from "../../../hooks/useSelectAppearance.js";
|
|
12
|
+
function OperatorSelector(props) {
|
|
13
|
+
const { options } = props;
|
|
14
|
+
const selectAppearance = useSelectAppearance((options == null ? void 0 : options.length) || 0);
|
|
15
|
+
if (!(options == null ? void 0 : options.length)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsx(MaterialValueSelector, { ...props, ...selectAppearance, sx: { border: "none" } });
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
OperatorSelector
|
|
22
|
+
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useCallback } from "react";
|
|
3
3
|
import Grid from "@mui/material/Grid";
|
|
4
|
-
import { Autocomplete, TextField, Select, MenuItem } from "@mui/material";
|
|
4
|
+
import { Autocomplete, TextField, FormControl, Select, MenuItem } from "@mui/material";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { useValid } from "./hooks/useValid.js";
|
|
7
7
|
import { OPERATOR_OPTIONS } from "../../filter/expert/expertFilterConstants.js";
|
|
8
8
|
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
9
9
|
import { usePredefinedProperties } from "../../../hooks/usePredefinedProperties.js";
|
|
10
|
-
import { useSelectAppearance } from "../../../hooks/useSelectAppearance.js";
|
|
11
10
|
import { useCustomFilterOptions } from "../../../hooks/useCustomFilterOptions.js";
|
|
12
|
-
const PROPERTY_VALUE_OPERATORS = [OPERATOR_OPTIONS.IN];
|
|
11
|
+
const PROPERTY_VALUE_OPERATORS = [OPERATOR_OPTIONS.IN, OPERATOR_OPTIONS.NOT_IN];
|
|
13
12
|
function PropertyValueEditor(props) {
|
|
14
13
|
const { equipmentType, valueEditorProps } = props;
|
|
15
14
|
const valid = useValid(valueEditorProps);
|
|
@@ -48,7 +47,7 @@ function PropertyValueEditor(props) {
|
|
|
48
47
|
[valueEditorProps]
|
|
49
48
|
);
|
|
50
49
|
return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 1, item: true, children: [
|
|
51
|
-
/* @__PURE__ */ jsx(Grid, { item: true, xs:
|
|
50
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(
|
|
52
51
|
Autocomplete,
|
|
53
52
|
{
|
|
54
53
|
value: propertyName ?? "",
|
|
@@ -64,20 +63,19 @@ function PropertyValueEditor(props) {
|
|
|
64
63
|
filterOptions: useCustomFilterOptions()
|
|
65
64
|
}
|
|
66
65
|
) }),
|
|
67
|
-
/* @__PURE__ */ jsx(Grid, { item: true, xs: "auto", children: /* @__PURE__ */ jsx(
|
|
66
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: "auto", children: /* @__PURE__ */ jsx(FormControl, { variant: "standard", sx: { mt: 1, minWidth: 160 }, children: /* @__PURE__ */ jsx(
|
|
68
67
|
Select,
|
|
69
68
|
{
|
|
70
69
|
value: propertyOperator ?? PROPERTY_VALUE_OPERATORS[0].customName,
|
|
71
70
|
size: "small",
|
|
72
71
|
title: valueEditorProps == null ? void 0 : valueEditorProps.title,
|
|
73
72
|
error: !valid,
|
|
74
|
-
onChange: (event
|
|
75
|
-
onChange(FieldConstants.PROPERTY_OPERATOR, value);
|
|
73
|
+
onChange: (event) => {
|
|
74
|
+
onChange(FieldConstants.PROPERTY_OPERATOR, event.target.value);
|
|
76
75
|
},
|
|
77
|
-
...useSelectAppearance(PROPERTY_VALUE_OPERATORS.length),
|
|
78
76
|
children: PROPERTY_VALUE_OPERATORS.map((operator) => /* @__PURE__ */ jsx(MenuItem, { value: operator.customName, children: intl.formatMessage({ id: operator.label }) }, operator.customName))
|
|
79
77
|
}
|
|
80
|
-
) }),
|
|
78
|
+
) }) }),
|
|
81
79
|
/* @__PURE__ */ jsx(Grid, { item: true, xs: true, children: /* @__PURE__ */ jsx(
|
|
82
80
|
Autocomplete,
|
|
83
81
|
{
|
package/dist/index.js
CHANGED
|
@@ -76,7 +76,8 @@ import { CancelButton } from "./components/inputs/reactHookForm/utils/CancelButt
|
|
|
76
76
|
import { FieldLabel } from "./components/inputs/reactHookForm/utils/FieldLabel.js";
|
|
77
77
|
import { SubmitButton } from "./components/inputs/reactHookForm/utils/SubmitButton.js";
|
|
78
78
|
import { TextFieldWithAdornment } from "./components/inputs/reactHookForm/utils/TextFieldWithAdornment.js";
|
|
79
|
-
import { genHelperError,
|
|
79
|
+
import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./components/inputs/reactHookForm/utils/functions.js";
|
|
80
|
+
import { HelperPreviousValue } from "./components/inputs/reactHookForm/utils/HelperPreviousValue.js";
|
|
80
81
|
import { AddButton } from "./components/inputs/reactQueryBuilder/AddButton.js";
|
|
81
82
|
import { AutocompleteWithFavorites } from "./components/inputs/reactQueryBuilder/AutocompleteWithFavorites.js";
|
|
82
83
|
import { CombinatorSelector } from "./components/inputs/reactQueryBuilder/CombinatorSelector.js";
|
|
@@ -135,7 +136,7 @@ import { getFileIcon } from "./utils/mapper/getFileIcon.js";
|
|
|
135
136
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./utils/mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
136
137
|
import { makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./utils/styles.js";
|
|
137
138
|
import { ElementType } from "./utils/types/elementType.js";
|
|
138
|
-
import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./utils/types/equipmentType.js";
|
|
139
|
+
import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./utils/types/equipmentType.js";
|
|
139
140
|
import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./utils/types/equipmentTypes.js";
|
|
140
141
|
import { MODIFICATION_TYPES, ModificationType } from "./utils/types/modificationType.js";
|
|
141
142
|
import { FieldType } from "./utils/types/fieldType.js";
|
|
@@ -161,6 +162,7 @@ import { treeviewFinderEn } from "./translations/en/treeviewFinderEn.js";
|
|
|
161
162
|
import { networkModificationsEn } from "./translations/en/networkModificationsEn.js";
|
|
162
163
|
import { exportParamsEn } from "./translations/en/external/exportParamsEn.js";
|
|
163
164
|
import { importParamsEn } from "./translations/en/external/importParamsEn.js";
|
|
165
|
+
import { componentsEn } from "./translations/en/componentsEn.js";
|
|
164
166
|
import { cardErrorBoundaryFr } from "./translations/fr/cardErrorBoundaryFr.js";
|
|
165
167
|
import { commonButtonFr } from "./translations/fr/commonButtonFr.js";
|
|
166
168
|
import { csvFr } from "./translations/fr/csvFr.js";
|
|
@@ -182,6 +184,7 @@ import { treeviewFinderFr } from "./translations/fr/treeviewFinderFr.js";
|
|
|
182
184
|
import { networkModificationsFr } from "./translations/fr/networkModificationsFr.js";
|
|
183
185
|
import { exportParamsFr } from "./translations/fr/external/exportParamsFr.js";
|
|
184
186
|
import { importParamsFr } from "./translations/fr/external/importParamsFr.js";
|
|
187
|
+
import { componentsFr } from "./translations/fr/componentsFr.js";
|
|
185
188
|
import * as yup from "yup";
|
|
186
189
|
export {
|
|
187
190
|
AMPERE,
|
|
@@ -264,7 +267,9 @@ export {
|
|
|
264
267
|
Generator,
|
|
265
268
|
GridLogo,
|
|
266
269
|
GroupValueEditor,
|
|
270
|
+
HelperPreviousValue,
|
|
267
271
|
Hvdc,
|
|
272
|
+
HvdcType,
|
|
268
273
|
InputWithPopupConfirmation,
|
|
269
274
|
IntegerInput,
|
|
270
275
|
KILO_AMPERE,
|
|
@@ -364,6 +369,8 @@ export {
|
|
|
364
369
|
catchErrorHandler,
|
|
365
370
|
commonButtonEn,
|
|
366
371
|
commonButtonFr,
|
|
372
|
+
componentsEn,
|
|
373
|
+
componentsFr,
|
|
367
374
|
convertInputValue,
|
|
368
375
|
convertOutputValue,
|
|
369
376
|
countRules,
|
|
@@ -408,7 +415,6 @@ export {
|
|
|
408
415
|
flatParametersEn,
|
|
409
416
|
flatParametersFr,
|
|
410
417
|
genHelperError,
|
|
411
|
-
genHelperPreviousValue,
|
|
412
418
|
generateTreeViewFinderClass,
|
|
413
419
|
getComputedLanguage,
|
|
414
420
|
getCriteriaBasedFormData,
|
package/dist/services/utils.js
CHANGED
|
@@ -28,7 +28,7 @@ const handleError = (response) => {
|
|
|
28
28
|
customError.status = errorJson.status;
|
|
29
29
|
} else {
|
|
30
30
|
customError = new Error(`${errorName + response.status} ${response.statusText}, message : ${text}`);
|
|
31
|
-
customError.status = response.
|
|
31
|
+
customError.status = response.status;
|
|
32
32
|
}
|
|
33
33
|
throw customError;
|
|
34
34
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export declare const componentsEn: {
|
|
8
|
+
notBuiltNodeTooltip: string;
|
|
9
|
+
builtNodeTooltip: string;
|
|
10
|
+
};
|
|
@@ -19,9 +19,11 @@ import { treeviewFinderEn } from "./treeviewFinderEn.js";
|
|
|
19
19
|
import { networkModificationsEn } from "./networkModificationsEn.js";
|
|
20
20
|
import { exportParamsEn } from "./external/exportParamsEn.js";
|
|
21
21
|
import { importParamsEn } from "./external/importParamsEn.js";
|
|
22
|
+
import { componentsEn } from "./componentsEn.js";
|
|
22
23
|
export {
|
|
23
24
|
cardErrorBoundaryEn,
|
|
24
25
|
commonButtonEn,
|
|
26
|
+
componentsEn,
|
|
25
27
|
csvEn,
|
|
26
28
|
descriptionEn,
|
|
27
29
|
directoryItemsInputEn,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export declare const componentsFr: {
|
|
8
|
+
notBuiltNodeTooltip: string;
|
|
9
|
+
builtNodeTooltip: string;
|
|
10
|
+
};
|
|
@@ -10,7 +10,8 @@ const filterFr = {
|
|
|
10
10
|
exists: "existe",
|
|
11
11
|
not_exists: "n'existe pas",
|
|
12
12
|
between: "entre",
|
|
13
|
-
in: "
|
|
13
|
+
in: "est parmi",
|
|
14
|
+
notIn: "n'est pas parmi",
|
|
14
15
|
inFilter: "dans le filtre",
|
|
15
16
|
notInFilter: "pas dans le filtre",
|
|
16
17
|
emptyRule: "Le filtre contient un champ vide",
|
|
@@ -19,9 +19,11 @@ import { treeviewFinderFr } from "./treeviewFinderFr.js";
|
|
|
19
19
|
import { networkModificationsFr } from "./networkModificationsFr.js";
|
|
20
20
|
import { exportParamsFr } from "./external/exportParamsFr.js";
|
|
21
21
|
import { importParamsFr } from "./external/importParamsFr.js";
|
|
22
|
+
import { componentsFr } from "./componentsFr.js";
|
|
22
23
|
export {
|
|
23
24
|
cardErrorBoundaryFr,
|
|
24
25
|
commonButtonFr,
|
|
26
|
+
componentsFr,
|
|
25
27
|
csvFr,
|
|
26
28
|
descriptionFr,
|
|
27
29
|
directoryItemsInputFr,
|
package/dist/utils/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { getFileIcon } from "./mapper/getFileIcon.js";
|
|
|
10
10
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
11
11
|
import { makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./styles.js";
|
|
12
12
|
import { ElementType } from "./types/elementType.js";
|
|
13
|
-
import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./types/equipmentType.js";
|
|
13
|
+
import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./types/equipmentType.js";
|
|
14
14
|
import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./types/equipmentTypes.js";
|
|
15
15
|
import { MODIFICATION_TYPES, ModificationType } from "./types/modificationType.js";
|
|
16
16
|
import { FieldType } from "./types/fieldType.js";
|
|
@@ -34,6 +34,7 @@ export {
|
|
|
34
34
|
GRIDSUITE_DEFAULT_PRECISION,
|
|
35
35
|
Generator,
|
|
36
36
|
Hvdc,
|
|
37
|
+
HvdcType,
|
|
37
38
|
KILO_AMPERE,
|
|
38
39
|
KILO_METER,
|
|
39
40
|
KILO_VOLT,
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* All the elements we can find in the GridSuite storage system.
|
|
9
|
+
*/
|
|
7
10
|
export declare enum ElementType {
|
|
8
11
|
DIRECTORY = "DIRECTORY",
|
|
9
12
|
STUDY = "STUDY",
|
|
@@ -39,6 +39,7 @@ export declare const equipmentStyles: {
|
|
|
39
39
|
/**
|
|
40
40
|
* The order of the equipments in this list is important, as many UI follow it directly.
|
|
41
41
|
* When EquipmentType is used for an interface this order must be maintained.
|
|
42
|
+
* @deprecated move to a specialized subtype as this one is used everywhere and cause problems
|
|
42
43
|
*/
|
|
43
44
|
export declare enum EquipmentType {
|
|
44
45
|
SUBSTATION = "SUBSTATION",
|
|
@@ -63,6 +64,10 @@ export declare enum EquipmentType {
|
|
|
63
64
|
DISCONNECTOR = "DISCONNECTOR",
|
|
64
65
|
BREAKER = "BREAKER"
|
|
65
66
|
}
|
|
67
|
+
export declare enum HvdcType {
|
|
68
|
+
LCC = "LCC",
|
|
69
|
+
VSC = "VSC"
|
|
70
|
+
}
|
|
66
71
|
export declare enum ExtendedEquipmentType {
|
|
67
72
|
HVDC_LINE_LCC = "HVDC_LINE_LCC",
|
|
68
73
|
HVDC_LINE_VSC = "HVDC_LINE_VSC"
|
|
@@ -101,9 +106,9 @@ export interface EquipmentInfos extends Identifiable {
|
|
|
101
106
|
voltageLevelId2?: string;
|
|
102
107
|
voltageLevelName2?: string;
|
|
103
108
|
}
|
|
104
|
-
export declare
|
|
105
|
-
IN_OPERATION
|
|
106
|
-
PLANNED_OUTAGE
|
|
107
|
-
FORCED_OUTAGE
|
|
108
|
-
}
|
|
109
|
-
export declare
|
|
109
|
+
export declare enum OperatingStatus {
|
|
110
|
+
IN_OPERATION = "IN_OPERATION",
|
|
111
|
+
PLANNED_OUTAGE = "PLANNED_OUTAGE",
|
|
112
|
+
FORCED_OUTAGE = "FORCED_OUTAGE"
|
|
113
|
+
}
|
|
114
|
+
export declare function getEquipmentsInfosForSearchBar(equipmentsInfos: Equipment[], getNameOrId: (e: Identifiable) => string): EquipmentInfos[];
|
|
@@ -65,6 +65,11 @@ var EquipmentType = /* @__PURE__ */ ((EquipmentType2) => {
|
|
|
65
65
|
EquipmentType2["BREAKER"] = "BREAKER";
|
|
66
66
|
return EquipmentType2;
|
|
67
67
|
})(EquipmentType || {});
|
|
68
|
+
var HvdcType = /* @__PURE__ */ ((HvdcType2) => {
|
|
69
|
+
HvdcType2["LCC"] = "LCC";
|
|
70
|
+
HvdcType2["VSC"] = "VSC";
|
|
71
|
+
return HvdcType2;
|
|
72
|
+
})(HvdcType || {});
|
|
68
73
|
var ExtendedEquipmentType = /* @__PURE__ */ ((ExtendedEquipmentType2) => {
|
|
69
74
|
ExtendedEquipmentType2["HVDC_LINE_LCC"] = "HVDC_LINE_LCC";
|
|
70
75
|
ExtendedEquipmentType2["HVDC_LINE_VSC"] = "HVDC_LINE_VSC";
|
|
@@ -301,12 +306,13 @@ const SEARCH_EQUIPMENTS = {
|
|
|
301
306
|
label: "VSC"
|
|
302
307
|
}
|
|
303
308
|
};
|
|
304
|
-
|
|
305
|
-
IN_OPERATION
|
|
306
|
-
PLANNED_OUTAGE
|
|
307
|
-
FORCED_OUTAGE
|
|
308
|
-
|
|
309
|
-
|
|
309
|
+
var OperatingStatus = /* @__PURE__ */ ((OperatingStatus2) => {
|
|
310
|
+
OperatingStatus2["IN_OPERATION"] = "IN_OPERATION";
|
|
311
|
+
OperatingStatus2["PLANNED_OUTAGE"] = "PLANNED_OUTAGE";
|
|
312
|
+
OperatingStatus2["FORCED_OUTAGE"] = "FORCED_OUTAGE";
|
|
313
|
+
return OperatingStatus2;
|
|
314
|
+
})(OperatingStatus || {});
|
|
315
|
+
function getEquipmentsInfosForSearchBar(equipmentsInfos, getNameOrId) {
|
|
310
316
|
return equipmentsInfos.flatMap((e) => {
|
|
311
317
|
var _a;
|
|
312
318
|
const label = getNameOrId(e);
|
|
@@ -317,23 +323,22 @@ const getEquipmentsInfosForSearchBar = (equipmentsInfos, getNameOrId) => {
|
|
|
317
323
|
key: e.id,
|
|
318
324
|
type: e.type
|
|
319
325
|
}
|
|
320
|
-
] : ((_a = e.voltageLevels) == null ? void 0 : _a.map((vli) => {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
};
|
|
329
|
-
})) ?? [];
|
|
326
|
+
] : ((_a = e.voltageLevels) == null ? void 0 : _a.map((vli) => ({
|
|
327
|
+
label,
|
|
328
|
+
id: e.id,
|
|
329
|
+
key: `${e.id}_${vli.id}`,
|
|
330
|
+
type: e.type,
|
|
331
|
+
voltageLevelLabel: getNameOrId(vli),
|
|
332
|
+
voltageLevelId: vli.id
|
|
333
|
+
}))) ?? [];
|
|
330
334
|
});
|
|
331
|
-
}
|
|
335
|
+
}
|
|
332
336
|
export {
|
|
333
337
|
BASE_EQUIPMENTS,
|
|
334
338
|
EQUIPMENT_TYPE,
|
|
335
339
|
EquipmentType,
|
|
336
340
|
ExtendedEquipmentType,
|
|
341
|
+
HvdcType,
|
|
337
342
|
OperatingStatus,
|
|
338
343
|
SEARCH_EQUIPMENTS,
|
|
339
344
|
TYPE_TAG_MAX_SIZE,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementType } from "./elementType.js";
|
|
2
|
-
import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./equipmentType.js";
|
|
2
|
+
import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./equipmentType.js";
|
|
3
3
|
import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./equipmentTypes.js";
|
|
4
4
|
import { MODIFICATION_TYPES, ModificationType } from "./modificationType.js";
|
|
5
5
|
import { FieldType } from "./fieldType.js";
|
|
@@ -15,6 +15,7 @@ export {
|
|
|
15
15
|
FieldType,
|
|
16
16
|
Generator,
|
|
17
17
|
Hvdc,
|
|
18
|
+
HvdcType,
|
|
18
19
|
LCC,
|
|
19
20
|
Line,
|
|
20
21
|
Load,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridsuite/commons-ui",
|
|
3
|
-
"version": "0.88.
|
|
3
|
+
"version": "0.88.3",
|
|
4
4
|
"description": "common react components for gridsuite applications",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22",
|
|
@@ -115,7 +115,6 @@
|
|
|
115
115
|
"glob": "^11.0.1",
|
|
116
116
|
"identity-obj-proxy": "^3.0.0",
|
|
117
117
|
"jest": "^29.7.0",
|
|
118
|
-
"jest-dom": "^4.0.0",
|
|
119
118
|
"jest-environment-jsdom": "^29.7.0",
|
|
120
119
|
"license-checker": "^25.0.1",
|
|
121
120
|
"notistack": "^3.0.2",
|