@gridsuite/commons-ui 0.133.0 → 0.135.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/components/authentication/utils/authService.js +6 -9
- package/dist/components/checkBoxList/CheckBoxList.js +1 -1
- package/dist/components/checkBoxList/CheckBoxListItem.js +3 -3
- package/dist/components/checkBoxList/CheckBoxListItemContent.js +3 -3
- package/dist/components/checkBoxList/CheckBoxListItems.js +4 -4
- package/dist/components/checkBoxList/DraggableCheckBoxListItem.js +5 -5
- package/dist/components/checkBoxList/DraggableCheckBoxListItemContent.js +1 -1
- package/dist/components/contingencyList/criteriaBased/criteriaBasedUtils.js +7 -7
- package/dist/components/csvDownloader/use-csv-export.js +1 -4
- package/dist/components/customAGGrid/customAggrid.js +2 -2
- package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +2 -2
- package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js +1 -2
- package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +6 -6
- package/dist/components/dialogs/elementSaveDialog/utils.js +1 -1
- package/dist/components/dialogs/modifyElementSelection/ModifyElementSelection.js +1 -1
- package/dist/components/directoryItemSelector/DirectoryItemSelector.js +3 -4
- package/dist/components/dnd-table/dnd-table-bottom-right-buttons.js +2 -3
- package/dist/components/dnd-table/dnd-table.js +7 -7
- package/dist/components/elementSearch/elementItem/EquipmentItem.js +6 -7
- package/dist/components/elementSearch/elementSearchDialog/ElementSearchDialog.js +1 -1
- package/dist/components/elementSearch/tagRenderer/TagRenderer.js +3 -4
- package/dist/components/filter/FilterCreationDialog.js +10 -10
- package/dist/components/filter/FilterForm.js +2 -2
- package/dist/components/filter/expert/ExpertFilterEditionDialog.js +1 -2
- package/dist/components/filter/expert/ExpertFilterForm.d.ts +0 -1
- package/dist/components/filter/expert/ExpertFilterForm.js +11 -21
- package/dist/components/filter/expert/expertFilterUtils.js +16 -24
- package/dist/components/filter/expert/index.js +1 -2
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +2 -4
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +11 -18
- package/dist/components/filter/index.js +1 -2
- package/dist/components/flatParameters/FlatParameters.js +2 -2
- package/dist/components/index.js +1 -2
- package/dist/components/inputs/SelectClearable.js +1 -1
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +44 -48
- package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +3 -4
- package/dist/components/inputs/reactHookForm/agGridTable/csvUploader/CsvUploader.js +1 -1
- package/dist/components/inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js +4 -4
- package/dist/components/inputs/reactHookForm/chip-items-input.js +3 -3
- package/dist/components/inputs/reactHookForm/errorManagement/ErrorInput.js +1 -2
- package/dist/components/inputs/reactHookForm/numbers/FloatInput.js +1 -1
- package/dist/components/inputs/reactHookForm/numbers/SliderInput.js +1 -1
- package/dist/components/inputs/reactHookForm/selectInputs/InputWithPopupConfirmation.js +2 -2
- package/dist/components/inputs/reactHookForm/selectInputs/SelectInput.js +3 -3
- package/dist/components/inputs/reactHookForm/tableInputs/table-numerical-input.js +4 -4
- package/dist/components/inputs/reactHookForm/tableInputs/table-text-input.js +3 -3
- package/dist/components/inputs/reactHookForm/text/ExpandingTextField.js +2 -2
- package/dist/components/inputs/reactHookForm/text/TextInput.js +5 -5
- package/dist/components/inputs/reactHookForm/text/UniqueNameInput.js +2 -2
- package/dist/components/inputs/reactHookForm/utils/SubmitButton.js +1 -1
- package/dist/components/inputs/reactHookForm/utils/functions.js +2 -3
- package/dist/components/inputs/reactQueryBuilder/OperatorSelector.js +2 -2
- package/dist/components/inputs/reactQueryBuilder/PropertyValueEditor.js +8 -9
- package/dist/components/inputs/reactQueryBuilder/TextValueEditor.js +1 -1
- package/dist/components/inputs/reactQueryBuilder/TranslatedValueEditor.js +1 -1
- package/dist/components/inputs/reactQueryBuilder/ValueEditor.js +2 -3
- package/dist/components/inputs/reactQueryBuilder/compositeRuleEditor/GroupValueEditor.js +12 -15
- package/dist/components/inputs/reactQueryBuilder/compositeRuleEditor/RuleValueEditor.js +3 -4
- package/dist/components/notifications/hooks/useListenerManager.js +2 -4
- package/dist/components/overflowableText/OverflowableText.js +4 -5
- package/dist/components/parameters/common/computing-type.d.ts +2 -1
- package/dist/components/parameters/common/computing-type.js +3 -0
- package/dist/components/parameters/common/limitreductions/columns-definitions.js +1 -1
- package/dist/components/parameters/common/limitreductions/limit-reductions-form-util.js +1 -1
- package/dist/components/parameters/common/widget/parameter-line-slider.js +5 -4
- package/dist/components/parameters/loadflow/load-flow-general-parameters.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-content.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-form.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +4 -3
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +34 -20
- package/dist/components/parameters/network-visualizations/map-parameters.js +13 -17
- package/dist/components/parameters/network-visualizations/network-area-diagram-parameters.js +1 -2
- package/dist/components/parameters/network-visualizations/network-visualizations-form.js +2 -2
- package/dist/components/parameters/network-visualizations/single-line-diagram-parameters.js +2 -3
- package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +2 -3
- package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.js +3 -3
- package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +1 -1
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +5 -5
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +1 -1
- package/dist/components/parameters/sensi/sensitivity-table.js +2 -3
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +42 -54
- package/dist/components/parameters/sensi/utils.js +16 -27
- package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +2 -2
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +1 -1
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +47 -56
- package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +1 -1
- package/dist/components/snackbarProvider/SnackbarProvider.js +1 -4
- package/dist/components/topBar/TopBar.js +33 -36
- package/dist/components/topBar/UserInformationDialog.js +7 -8
- package/dist/components/topBar/UserSettingsDialog.js +1 -1
- package/dist/components/treeViewFinder/TreeViewFinder.js +13 -13
- package/dist/hooks/use-parameters-backend.js +5 -5
- package/dist/hooks/use-unique-name-validation.js +2 -3
- package/dist/hooks/useConfidentialityWarning.js +1 -1
- package/dist/hooks/usePredefinedProperties.js +1 -2
- package/dist/index.js +1 -2
- package/dist/redux/commonStore.js +1 -2
- package/dist/services/utils.js +3 -3
- package/dist/utils/types/equipmentType.js +9 -13
- package/package.json +19 -17
|
@@ -83,15 +83,15 @@ function ChipItemsInput({ label, name, hideErrorMessage }) {
|
|
|
83
83
|
const handleChange = (e) => {
|
|
84
84
|
setTextEntered(e.target.value);
|
|
85
85
|
};
|
|
86
|
-
const hasError = !!
|
|
86
|
+
const hasError = !!error?.message;
|
|
87
87
|
const containerStyle = useMemo(
|
|
88
88
|
() => ({ ...styles.chipContainer, borderColor: hasError ? "error.main" : null }),
|
|
89
89
|
[hasError]
|
|
90
90
|
);
|
|
91
91
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
92
92
|
/* @__PURE__ */ jsxs(FormControl, { sx: containerStyle, error: hasError, children: [
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
elements?.length === 0 && label && /* @__PURE__ */ jsx(FieldLabel, { label, optional: !isFieldRequired(name, validationSchema, getValues()) }),
|
|
94
|
+
elements?.length > 0 && /* @__PURE__ */ jsx(FormControl, { sx: styles.chipItem, children: elements.map((item, index) => /* @__PURE__ */ jsx(
|
|
95
95
|
Chip,
|
|
96
96
|
{
|
|
97
97
|
size: "small",
|
|
@@ -3,7 +3,6 @@ import { useRef, useEffect } from "react";
|
|
|
3
3
|
import { FormattedMessage } from "react-intl";
|
|
4
4
|
import { useController } from "react-hook-form";
|
|
5
5
|
function ErrorInput({ name, InputField }) {
|
|
6
|
-
var _a;
|
|
7
6
|
const {
|
|
8
7
|
fieldState: { error },
|
|
9
8
|
formState: { isSubmitting }
|
|
@@ -32,7 +31,7 @@ function ErrorInput({ name, InputField }) {
|
|
|
32
31
|
errorRef.current.scrollIntoView({ behavior: "smooth" });
|
|
33
32
|
}
|
|
34
33
|
}, [isSubmitting]);
|
|
35
|
-
const errorMsg =
|
|
34
|
+
const errorMsg = error?.message || error?.root?.message;
|
|
36
35
|
return errorMsg && /* @__PURE__ */ jsx("div", { ref: errorRef, children: InputField({
|
|
37
36
|
message: /* @__PURE__ */ jsx(FormattedMessage, { ...errorProps(errorMsg) })
|
|
38
37
|
}) });
|
|
@@ -27,7 +27,7 @@ function FloatInput(props) {
|
|
|
27
27
|
if (value === "") {
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
|
-
const tmp =
|
|
30
|
+
const tmp = value?.replace(",", ".") || "";
|
|
31
31
|
if (tmp.endsWith(".") || tmp.includes(".") && tmp.endsWith("0")) {
|
|
32
32
|
return tmp;
|
|
33
33
|
}
|
|
@@ -18,7 +18,7 @@ function SliderInput({
|
|
|
18
18
|
field: { onChange, value }
|
|
19
19
|
} = useController({ name });
|
|
20
20
|
const handleValueChange = (event, newValue, activeThumb) => {
|
|
21
|
-
onValueChanged
|
|
21
|
+
onValueChanged?.(newValue);
|
|
22
22
|
onChange(newValue);
|
|
23
23
|
};
|
|
24
24
|
return /* @__PURE__ */ jsx(
|
|
@@ -29,7 +29,7 @@ function InputWithPopupConfirmation({
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
const handlePopupConfirmation = () => {
|
|
32
|
-
resetOnConfirmation
|
|
32
|
+
resetOnConfirmation?.();
|
|
33
33
|
onChange(newValue);
|
|
34
34
|
setOpenPopup(false);
|
|
35
35
|
};
|
|
@@ -40,7 +40,7 @@ function InputWithPopupConfirmation({
|
|
|
40
40
|
name,
|
|
41
41
|
...props,
|
|
42
42
|
onChange: (e, value) => {
|
|
43
|
-
handleOnChange(e,
|
|
43
|
+
handleOnChange(e, value?.id ?? value);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
),
|
|
@@ -11,15 +11,15 @@ function SelectInput(props) {
|
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
if (typeof value === "string") {
|
|
14
|
-
return options.find((option) => typeof option !== "string" &&
|
|
14
|
+
return options.find((option) => typeof option !== "string" && option?.id === value) || null;
|
|
15
15
|
}
|
|
16
|
-
return options.find((option) => typeof option !== "string" &&
|
|
16
|
+
return options.find((option) => typeof option !== "string" && option?.id === value.id) || null;
|
|
17
17
|
};
|
|
18
18
|
const outputTransform = (value) => {
|
|
19
19
|
if (typeof value === "string") {
|
|
20
20
|
return value;
|
|
21
21
|
}
|
|
22
|
-
return
|
|
22
|
+
return value?.id ?? null;
|
|
23
23
|
};
|
|
24
24
|
const getOptionLabel = (option) => {
|
|
25
25
|
if (typeof option === "string") {
|
|
@@ -46,7 +46,7 @@ function TableNumericalInput({
|
|
|
46
46
|
if (str === "") {
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
|
-
const tmp =
|
|
49
|
+
const tmp = str?.replace(",", ".") || "";
|
|
50
50
|
if (tmp.endsWith(".") || tmp.endsWith("0")) {
|
|
51
51
|
return str;
|
|
52
52
|
}
|
|
@@ -67,13 +67,13 @@ function TableNumericalInput({
|
|
|
67
67
|
{
|
|
68
68
|
value: transformedValue,
|
|
69
69
|
onChange: handleInputChange,
|
|
70
|
-
error: !!
|
|
70
|
+
error: !!error?.message,
|
|
71
71
|
size: "small",
|
|
72
72
|
fullWidth: true,
|
|
73
73
|
inputRef: ref,
|
|
74
74
|
InputProps: {
|
|
75
75
|
endAdornment: /* @__PURE__ */ jsxs(InputAdornment, { position: "end", children: [
|
|
76
|
-
transformedValue &&
|
|
76
|
+
transformedValue && adornment?.text,
|
|
77
77
|
clearable && /* @__PURE__ */ jsx(
|
|
78
78
|
IconButton,
|
|
79
79
|
{
|
|
@@ -92,7 +92,7 @@ function TableNumericalInput({
|
|
|
92
92
|
fontSize: "small",
|
|
93
93
|
color: previousValue !== void 0 && previousValue === parseFloat(value) && !valueModified ? "grey" : void 0,
|
|
94
94
|
// grey out the value if it is the same as the previous one
|
|
95
|
-
textAlign:
|
|
95
|
+
textAlign: style?.textAlign ?? "left"
|
|
96
96
|
},
|
|
97
97
|
inputMode: "numeric",
|
|
98
98
|
pattern: "[0-9]*",
|
|
@@ -9,7 +9,7 @@ function TableTextInput({ name, showErrorMsg, inputProps, ...props }) {
|
|
|
9
9
|
} = useController({ name });
|
|
10
10
|
const intl = useIntl();
|
|
11
11
|
const outputTransform = (str) => {
|
|
12
|
-
return
|
|
12
|
+
return str?.trim() === "" ? "" : str;
|
|
13
13
|
};
|
|
14
14
|
const handleInputChange = (e) => {
|
|
15
15
|
onChange(outputTransform(e.target.value));
|
|
@@ -19,8 +19,8 @@ function TableTextInput({ name, showErrorMsg, inputProps, ...props }) {
|
|
|
19
19
|
{
|
|
20
20
|
value,
|
|
21
21
|
onChange: handleInputChange,
|
|
22
|
-
error: !!
|
|
23
|
-
helperText: showErrorMsg && (
|
|
22
|
+
error: !!error?.message,
|
|
23
|
+
helperText: showErrorMsg && (error?.message ? intl.formatMessage({ id: error.message }) : ""),
|
|
24
24
|
size: "small",
|
|
25
25
|
fullWidth: true,
|
|
26
26
|
inputRef: ref,
|
|
@@ -23,8 +23,8 @@ function ExpandingTextField({
|
|
|
23
23
|
const handleBlur = () => {
|
|
24
24
|
setIsFocused(false);
|
|
25
25
|
};
|
|
26
|
-
const isOverTheLimit =
|
|
27
|
-
const descriptionLength =
|
|
26
|
+
const isOverTheLimit = descriptionWatch?.length > maxCharactersNumber;
|
|
27
|
+
const descriptionLength = descriptionWatch?.length ?? 0;
|
|
28
28
|
const descriptionCounter = `${descriptionLength}/${maxCharactersNumber}`;
|
|
29
29
|
const rowsToDisplay = isFocused ? rows : minRows;
|
|
30
30
|
const formProps = {
|
|
@@ -35,8 +35,8 @@ function TextInput({
|
|
|
35
35
|
} = useController({ name });
|
|
36
36
|
const Field = adornment ? TextFieldWithAdornment : TextField;
|
|
37
37
|
const finalAdornment = {
|
|
38
|
-
adornmentPosition:
|
|
39
|
-
adornmentText:
|
|
38
|
+
adornmentPosition: adornment?.position ?? "",
|
|
39
|
+
adornmentText: adornment?.text ?? ""
|
|
40
40
|
};
|
|
41
41
|
const handleClearValue = () => {
|
|
42
42
|
onChange(outputTransform(""));
|
|
@@ -50,7 +50,7 @@ function TextInput({
|
|
|
50
50
|
const fieldLabel = !label ? null : FieldLabel({
|
|
51
51
|
label,
|
|
52
52
|
values: labelValues,
|
|
53
|
-
optional: !isFieldRequired(name, validationSchema, getValues()) && !
|
|
53
|
+
optional: !isFieldRequired(name, validationSchema, getValues()) && !formProps?.disabled && !removeOptional
|
|
54
54
|
});
|
|
55
55
|
return /* @__PURE__ */ jsx(
|
|
56
56
|
Field,
|
|
@@ -78,10 +78,10 @@ function TextInput({
|
|
|
78
78
|
previousValue,
|
|
79
79
|
isNodeBuilt,
|
|
80
80
|
disabledTooltip: disabledTooltip || !isUpdate && isNodeBuilt,
|
|
81
|
-
adornmentText: adornment
|
|
81
|
+
adornmentText: adornment?.text
|
|
82
82
|
}
|
|
83
83
|
),
|
|
84
|
-
...genHelperError(error
|
|
84
|
+
...genHelperError(error?.message),
|
|
85
85
|
...formProps,
|
|
86
86
|
...adornment && { ...finalAdornment }
|
|
87
87
|
},
|
|
@@ -32,11 +32,11 @@ function UniqueNameInput({
|
|
|
32
32
|
});
|
|
33
33
|
const handleManualChange = (e) => {
|
|
34
34
|
onChange(e.target.value);
|
|
35
|
-
onManualChangeCallback
|
|
35
|
+
onManualChangeCallback?.();
|
|
36
36
|
};
|
|
37
37
|
const translatedLabel = /* @__PURE__ */ jsx(FormattedMessage, { id: label });
|
|
38
38
|
const translatedError = error && /* @__PURE__ */ jsx(FormattedMessage, { id: error.message });
|
|
39
|
-
const showOk =
|
|
39
|
+
const showOk = value?.trim() && !isValidating && !error;
|
|
40
40
|
const endAdornment = /* @__PURE__ */ jsxs(InputAdornment, { position: "end", children: [
|
|
41
41
|
isValidating && /* @__PURE__ */ jsx(CircularProgress, { size: "1rem" }),
|
|
42
42
|
showOk && /* @__PURE__ */ jsx(Check, { style: { color: "green" } })
|
|
@@ -4,7 +4,7 @@ import { useFormState } from "react-hook-form";
|
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
5
|
function SubmitButton(buttonProps) {
|
|
6
6
|
const { isDirty } = useFormState();
|
|
7
|
-
return /* @__PURE__ */ jsx(Button, { ...buttonProps, disabled: !isDirty || (
|
|
7
|
+
return /* @__PURE__ */ jsx(Button, { ...buttonProps, disabled: !isDirty || (buttonProps?.disabled ?? false), children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" }) });
|
|
8
8
|
}
|
|
9
9
|
export {
|
|
10
10
|
SubmitButton
|
|
@@ -16,9 +16,8 @@ function identity(x) {
|
|
|
16
16
|
return x;
|
|
17
17
|
}
|
|
18
18
|
const isFieldRequired = (fieldName, schema, values) => {
|
|
19
|
-
var _a;
|
|
20
19
|
const { schema: fieldSchema, parent: parentValues } = getIn(schema, fieldName, values) || {};
|
|
21
|
-
return
|
|
20
|
+
return fieldSchema.describe({ parent: parentValues })?.optional === false;
|
|
22
21
|
};
|
|
23
22
|
const gridItem = (field, size = 6) => {
|
|
24
23
|
return /* @__PURE__ */ jsx(Grid, { item: true, xs: size, alignItems: "start", children: field });
|
|
@@ -30,7 +29,7 @@ const toFloatOrNullValue = (value) => {
|
|
|
30
29
|
if (value === "0") {
|
|
31
30
|
return 0;
|
|
32
31
|
}
|
|
33
|
-
const tmp =
|
|
32
|
+
const tmp = value?.replace(",", ".") || "";
|
|
34
33
|
return parseFloat(tmp) || null;
|
|
35
34
|
};
|
|
36
35
|
export {
|
|
@@ -15,8 +15,8 @@ import { useSelectAppearance } from "../../../hooks/useSelectAppearance.js";
|
|
|
15
15
|
import "react-hook-form";
|
|
16
16
|
function OperatorSelector(props) {
|
|
17
17
|
const { options } = props;
|
|
18
|
-
const selectAppearance = useSelectAppearance(
|
|
19
|
-
if (!
|
|
18
|
+
const selectAppearance = useSelectAppearance(options?.length || 0);
|
|
19
|
+
if (!options?.length) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
return /* @__PURE__ */ jsx(MaterialValueSelector, { ...props, ...selectAppearance, sx: { border: "none" } });
|
|
@@ -12,13 +12,13 @@ function PropertyValueEditor(props) {
|
|
|
12
12
|
const { equipmentType, valueEditorProps } = props;
|
|
13
13
|
const valid = useValid(valueEditorProps);
|
|
14
14
|
const intl = useIntl();
|
|
15
|
-
const { propertyName, propertyOperator, propertyValues } =
|
|
15
|
+
const { propertyName, propertyOperator, propertyValues } = valueEditorProps?.value ?? {};
|
|
16
16
|
const [equipmentPredefinedProps] = usePredefinedProperties(equipmentType);
|
|
17
17
|
const predefinedNames = useMemo(() => {
|
|
18
18
|
return Object.keys(equipmentPredefinedProps ?? {}).sort();
|
|
19
19
|
}, [equipmentPredefinedProps]);
|
|
20
20
|
const predefinedValues = useMemo(() => {
|
|
21
|
-
const predefinedForName = equipmentPredefinedProps
|
|
21
|
+
const predefinedForName = equipmentPredefinedProps?.[propertyName];
|
|
22
22
|
if (!predefinedForName) {
|
|
23
23
|
return [];
|
|
24
24
|
}
|
|
@@ -26,10 +26,9 @@ function PropertyValueEditor(props) {
|
|
|
26
26
|
}, [equipmentPredefinedProps, propertyName]);
|
|
27
27
|
const onChange = useCallback(
|
|
28
28
|
(field, value) => {
|
|
29
|
-
var _a, _b;
|
|
30
29
|
let updatedValue = {
|
|
31
|
-
...valueEditorProps
|
|
32
|
-
[FieldConstants.PROPERTY_OPERATOR]:
|
|
30
|
+
...valueEditorProps?.value,
|
|
31
|
+
[FieldConstants.PROPERTY_OPERATOR]: valueEditorProps?.value?.propertyOperator ?? PROPERTY_VALUE_OPERATORS[0].customName,
|
|
33
32
|
[field]: value
|
|
34
33
|
};
|
|
35
34
|
if (field === FieldConstants.PROPERTY_NAME) {
|
|
@@ -38,7 +37,7 @@ function PropertyValueEditor(props) {
|
|
|
38
37
|
[FieldConstants.PROPERTY_VALUES]: []
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
|
-
|
|
40
|
+
valueEditorProps?.handleOnChange?.(updatedValue);
|
|
42
41
|
},
|
|
43
42
|
[valueEditorProps]
|
|
44
43
|
);
|
|
@@ -64,7 +63,7 @@ function PropertyValueEditor(props) {
|
|
|
64
63
|
{
|
|
65
64
|
value: propertyOperator ?? PROPERTY_VALUE_OPERATORS[0].customName,
|
|
66
65
|
size: "small",
|
|
67
|
-
title: valueEditorProps
|
|
66
|
+
title: valueEditorProps?.title,
|
|
68
67
|
error: !valid,
|
|
69
68
|
onChange: (event) => {
|
|
70
69
|
onChange(FieldConstants.PROPERTY_OPERATOR, event.target.value);
|
|
@@ -77,14 +76,14 @@ function PropertyValueEditor(props) {
|
|
|
77
76
|
{
|
|
78
77
|
value: propertyValues ?? [],
|
|
79
78
|
options: predefinedValues ?? [],
|
|
80
|
-
title: valueEditorProps
|
|
79
|
+
title: valueEditorProps?.title,
|
|
81
80
|
multiple: true,
|
|
82
81
|
renderInput: (params) => /* @__PURE__ */ jsx(
|
|
83
82
|
TextField,
|
|
84
83
|
{
|
|
85
84
|
...params,
|
|
86
85
|
error: !valid,
|
|
87
|
-
placeholder:
|
|
86
|
+
placeholder: propertyValues?.length > 0 ? "" : intl.formatMessage({ id: "valuesList" })
|
|
88
87
|
}
|
|
89
88
|
),
|
|
90
89
|
freeSolo: true,
|
|
@@ -28,7 +28,7 @@ function TextValueEditor(props) {
|
|
|
28
28
|
{
|
|
29
29
|
...params,
|
|
30
30
|
error: !valid,
|
|
31
|
-
placeholder:
|
|
31
|
+
placeholder: value?.length > 0 ? "" : intl.formatMessage({ id: "valuesList" })
|
|
32
32
|
}
|
|
33
33
|
),
|
|
34
34
|
size: "small",
|
|
@@ -9,7 +9,7 @@ function TranslatedValueEditor(props) {
|
|
|
9
9
|
const intl = useIntl();
|
|
10
10
|
const { values, value, handleOnChange, title } = props;
|
|
11
11
|
const translatedValues = useMemo(() => {
|
|
12
|
-
return values
|
|
12
|
+
return values?.map((v) => {
|
|
13
13
|
return {
|
|
14
14
|
name: v.name,
|
|
15
15
|
label: intl.formatMessage({ id: v.label })
|
|
@@ -31,9 +31,8 @@ function ValueEditor(props) {
|
|
|
31
31
|
const { getValues } = formContext;
|
|
32
32
|
const itemFilter = useCallback(
|
|
33
33
|
(filterValue) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return field === FieldType.ID && ((_a = filterValue == null ? void 0 : filterValue.specificMetadata) == null ? void 0 : _a.equipmentType) === getValues(FieldConstants.EQUIPMENT_TYPE) || (field === FieldType.VOLTAGE_LEVEL_ID || field === FieldType.VOLTAGE_LEVEL_ID_1 || field === FieldType.VOLTAGE_LEVEL_ID_2 || field === FieldType.VOLTAGE_LEVEL_ID_3) && ((_b = filterValue == null ? void 0 : filterValue.specificMetadata) == null ? void 0 : _b.equipmentType) === VoltageLevel.type || (field === FieldType.SUBSTATION_ID || field === FieldType.SUBSTATION_ID_1 || field === FieldType.SUBSTATION_ID_2) && ((_c = filterValue == null ? void 0 : filterValue.specificMetadata) == null ? void 0 : _c.equipmentType) === Substation.type;
|
|
34
|
+
if (filterValue?.type === ElementType.FILTER) {
|
|
35
|
+
return field === FieldType.ID && filterValue?.specificMetadata?.equipmentType === getValues(FieldConstants.EQUIPMENT_TYPE) || (field === FieldType.VOLTAGE_LEVEL_ID || field === FieldType.VOLTAGE_LEVEL_ID_1 || field === FieldType.VOLTAGE_LEVEL_ID_2 || field === FieldType.VOLTAGE_LEVEL_ID_3) && filterValue?.specificMetadata?.equipmentType === VoltageLevel.type || (field === FieldType.SUBSTATION_ID || field === FieldType.SUBSTATION_ID_1 || field === FieldType.SUBSTATION_ID_2) && filterValue?.specificMetadata?.equipmentType === Substation.type;
|
|
37
36
|
}
|
|
38
37
|
return true;
|
|
39
38
|
},
|
|
@@ -21,7 +21,7 @@ function GroupValueEditor(props) {
|
|
|
21
21
|
...value,
|
|
22
22
|
combinator,
|
|
23
23
|
rules: {
|
|
24
|
-
...value
|
|
24
|
+
...value?.rules,
|
|
25
25
|
[field]: rule
|
|
26
26
|
}
|
|
27
27
|
};
|
|
@@ -29,20 +29,17 @@ function GroupValueEditor(props) {
|
|
|
29
29
|
},
|
|
30
30
|
[handleOnChange, combinator, value]
|
|
31
31
|
);
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
}) });
|
|
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) => /* @__PURE__ */ createElement(
|
|
33
|
+
RuleValueEditor,
|
|
34
|
+
{
|
|
35
|
+
...props,
|
|
36
|
+
key: fieldData.name,
|
|
37
|
+
field: fieldData.name,
|
|
38
|
+
fieldData,
|
|
39
|
+
rule: value?.rules?.[fieldData.name],
|
|
40
|
+
handleOnChangeRule: generateOnChangeRuleHandler(fieldData.name)
|
|
41
|
+
}
|
|
42
|
+
)) });
|
|
46
43
|
}
|
|
47
44
|
export {
|
|
48
45
|
GroupValueEditor
|
|
@@ -9,7 +9,6 @@ const styles = {
|
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
11
|
function RuleValueEditor(props) {
|
|
12
|
-
var _a, _b;
|
|
13
12
|
const {
|
|
14
13
|
schema: {
|
|
15
14
|
controls: { valueEditor: ValueEditorControlElement }
|
|
@@ -19,7 +18,7 @@ function RuleValueEditor(props) {
|
|
|
19
18
|
handleOnChangeRule
|
|
20
19
|
} = props;
|
|
21
20
|
const intl = useIntl();
|
|
22
|
-
const operator =
|
|
21
|
+
const operator = rule?.operator ?? fieldData.operators?.map((op) => op.name)[0];
|
|
23
22
|
const handleOnChangeOperator = (newOperator) => {
|
|
24
23
|
handleOnChangeRule({
|
|
25
24
|
...rule,
|
|
@@ -44,7 +43,7 @@ function RuleValueEditor(props) {
|
|
|
44
43
|
handleOnChangeOperator(event.target.value);
|
|
45
44
|
},
|
|
46
45
|
variant: "standard",
|
|
47
|
-
children:
|
|
46
|
+
children: fieldData.operators?.map((option) => /* @__PURE__ */ jsx(MenuItem, { value: option.name, children: intl.formatMessage({ id: option.label }) }, option.name))
|
|
48
47
|
}
|
|
49
48
|
) }),
|
|
50
49
|
/* @__PURE__ */ jsx(Grid, { container: true, item: true, xs: 5.5, sx: styles.gridItem, paddingLeft: 1, children: /* @__PURE__ */ jsx(
|
|
@@ -53,7 +52,7 @@ function RuleValueEditor(props) {
|
|
|
53
52
|
...props,
|
|
54
53
|
operator,
|
|
55
54
|
handleOnChange: handleOnChangeValue,
|
|
56
|
-
value: rule
|
|
55
|
+
value: rule?.value
|
|
57
56
|
}
|
|
58
57
|
) })
|
|
59
58
|
] });
|
|
@@ -26,8 +26,7 @@ const useListenerManager = (urls) => {
|
|
|
26
26
|
urlsListenersRef.current = urlsListeners;
|
|
27
27
|
}, []);
|
|
28
28
|
const removeListenerEvent = useCallback((urlKey, id) => {
|
|
29
|
-
|
|
30
|
-
const listeners = (_a = urlsListenersRef.current) == null ? void 0 : _a[urlKey];
|
|
29
|
+
const listeners = urlsListenersRef.current?.[urlKey];
|
|
31
30
|
if (listeners) {
|
|
32
31
|
const newListerners = listeners.filter((l) => l.id !== id);
|
|
33
32
|
urlsListenersRef.current = {
|
|
@@ -38,8 +37,7 @@ const useListenerManager = (urls) => {
|
|
|
38
37
|
}, []);
|
|
39
38
|
const broadcast = useCallback(
|
|
40
39
|
(urlKey) => (...args) => {
|
|
41
|
-
|
|
42
|
-
const listeners = (_a = urlsListenersRef.current) == null ? void 0 : _a[urlKey];
|
|
40
|
+
const listeners = urlsListenersRef.current?.[urlKey];
|
|
43
41
|
if (listeners) {
|
|
44
42
|
listeners.forEach(({ callback }) => {
|
|
45
43
|
callback(...args);
|
|
@@ -34,7 +34,6 @@ const OverflowableText = styled(
|
|
|
34
34
|
children,
|
|
35
35
|
...props
|
|
36
36
|
}) => {
|
|
37
|
-
var _a, _b, _c, _d;
|
|
38
37
|
const element = useRef();
|
|
39
38
|
const isMultiLine = useMemo(() => maxLineCount && maxLineCount > 1, [maxLineCount]);
|
|
40
39
|
const [overflowed, setOverflowed] = useState(false);
|
|
@@ -53,10 +52,10 @@ const OverflowableText = styled(
|
|
|
53
52
|
}, [
|
|
54
53
|
checkOverflow,
|
|
55
54
|
text,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
element.current?.scrollWidth,
|
|
56
|
+
element.current?.clientWidth,
|
|
57
|
+
element.current?.scrollHeight,
|
|
58
|
+
element.current?.clientHeight
|
|
60
59
|
]);
|
|
61
60
|
const defaultTooltipSx = !tooltipStyle ? overflowStyle.tooltip : false;
|
|
62
61
|
const finalTooltipSx = tooltipSx || defaultTooltipSx;
|
|
@@ -13,7 +13,8 @@ export declare enum ComputingType {
|
|
|
13
13
|
DYNAMIC_SIMULATION = "DYNAMIC_SIMULATION",
|
|
14
14
|
DYNAMIC_SECURITY_ANALYSIS = "DYNAMIC_SECURITY_ANALYSIS",
|
|
15
15
|
VOLTAGE_INITIALIZATION = "VOLTAGE_INITIALIZATION",
|
|
16
|
-
STATE_ESTIMATION = "STATE_ESTIMATION"
|
|
16
|
+
STATE_ESTIMATION = "STATE_ESTIMATION",
|
|
17
|
+
PCC_MIN = "PCC_MIN"
|
|
17
18
|
}
|
|
18
19
|
export declare const isValidComputingType: (value: string | undefined) => boolean;
|
|
19
20
|
export declare const formatComputingTypeLabel: (type: ComputingType) => string | undefined;
|
|
@@ -8,6 +8,7 @@ var ComputingType = /* @__PURE__ */ ((ComputingType2) => {
|
|
|
8
8
|
ComputingType2["DYNAMIC_SECURITY_ANALYSIS"] = "DYNAMIC_SECURITY_ANALYSIS";
|
|
9
9
|
ComputingType2["VOLTAGE_INITIALIZATION"] = "VOLTAGE_INITIALIZATION";
|
|
10
10
|
ComputingType2["STATE_ESTIMATION"] = "STATE_ESTIMATION";
|
|
11
|
+
ComputingType2["PCC_MIN"] = "PCC_MIN";
|
|
11
12
|
return ComputingType2;
|
|
12
13
|
})(ComputingType || {});
|
|
13
14
|
const isValidComputingType = (value) => {
|
|
@@ -33,6 +34,8 @@ const formatComputingTypeLabel = (type) => {
|
|
|
33
34
|
return "DynamicSecurityAnalysis";
|
|
34
35
|
case "STATE_ESTIMATION":
|
|
35
36
|
return "StateEstimation";
|
|
37
|
+
case "PCC_MIN":
|
|
38
|
+
return "PccMin";
|
|
36
39
|
default:
|
|
37
40
|
console.warn(`Unrecognized computing type while formatting its label : ${type}`);
|
|
38
41
|
return void 0;
|
|
@@ -66,7 +66,7 @@ const getSAParametersFromSchema = (name, limitReductions) => {
|
|
|
66
66
|
[PARAM_SA_PROVIDER]: yup.string().required()
|
|
67
67
|
});
|
|
68
68
|
const limitReductionsSchema = getLimitReductionsFormSchema(
|
|
69
|
-
|
|
69
|
+
limitReductions?.length ? limitReductions[0].temporaryLimitReductions.length : 0
|
|
70
70
|
);
|
|
71
71
|
const thresholdsSchema = yup.object().shape({
|
|
72
72
|
[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD]: yup.number().min(0, "NormalizedPercentage").max(100, "NormalizedPercentage").required(),
|
|
@@ -13,7 +13,7 @@ const toFormValuesLimitReductions = (limits) => !limits ? {} : {
|
|
|
13
13
|
};
|
|
14
14
|
const toFormValueSaParameters = (params) => ({
|
|
15
15
|
[PARAM_SA_PROVIDER]: params[PARAM_SA_PROVIDER],
|
|
16
|
-
...toFormValuesLimitReductions(params
|
|
16
|
+
...toFormValuesLimitReductions(params?.limitReductions),
|
|
17
17
|
// SA specific form values
|
|
18
18
|
[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD]: params[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD] * 100,
|
|
19
19
|
[PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD]: params[PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD] * 100,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs,
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Grid } from "@mui/material";
|
|
3
3
|
import { FormattedMessage } from "react-intl";
|
|
4
4
|
import { parametersStyles } from "../../parameters-style.js";
|
|
@@ -35,7 +35,8 @@ function sanitizePercentageValue(value) {
|
|
|
35
35
|
const styles = {
|
|
36
36
|
container: {
|
|
37
37
|
...parametersStyles.controlItem,
|
|
38
|
-
|
|
38
|
+
paddingTop: 3,
|
|
39
|
+
paddingRight: 3
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
42
|
function ParameterLineSlider({
|
|
@@ -46,9 +47,9 @@ function ParameterLineSlider({
|
|
|
46
47
|
minValue = 0,
|
|
47
48
|
maxValue = 100
|
|
48
49
|
}) {
|
|
49
|
-
return /* @__PURE__ */ jsxs(
|
|
50
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, sx: styles.container, children: [
|
|
50
51
|
/* @__PURE__ */ jsx(Grid, { item: true, xs: 8, sx: parametersStyles.parameterName, children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) }),
|
|
51
|
-
/* @__PURE__ */ jsx(Grid, { item: true,
|
|
52
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(
|
|
52
53
|
SliderInput,
|
|
53
54
|
{
|
|
54
55
|
name,
|
|
@@ -163,7 +163,7 @@ function LoadFlowGeneralParameters({ provider, specificParams }) {
|
|
|
163
163
|
onClick: setShowSpecificLfParams,
|
|
164
164
|
infoText: provider ?? "",
|
|
165
165
|
disabled: !provider || !specificParams,
|
|
166
|
-
children: showSpecificLfParams &&
|
|
166
|
+
children: showSpecificLfParams && specificParams?.map((item) => /* @__PURE__ */ createElement(LoadFlowParameterField, { id: SPECIFIC_PARAMETERS, ...item, key: item.name }))
|
|
167
167
|
}
|
|
168
168
|
)
|
|
169
169
|
] });
|
|
@@ -60,7 +60,7 @@ function LoadFlowParametersContent({
|
|
|
60
60
|
}) {
|
|
61
61
|
return /* @__PURE__ */ jsx(Box, { sx: styles.wrapper, children: /* @__PURE__ */ jsx(Grid, { container: true, sx: styles.container, children: /* @__PURE__ */ jsxs(Grid, { item: true, sx: styles.maxWidth, children: [
|
|
62
62
|
/* @__PURE__ */ jsx(TabPanel, { value: selectedTab, index: TabValues.GENERAL, children: /* @__PURE__ */ jsx(LoadFlowGeneralParameters, { provider: currentProvider, specificParams: specificParameters }) }),
|
|
63
|
-
/* @__PURE__ */ jsx(TabPanel, { value: selectedTab, index: TabValues.LIMIT_REDUCTIONS, children: /* @__PURE__ */ jsx(Grid, { container: true, sx: { width: "100%" }, children: currentProvider === PARAM_PROVIDER_OPENLOADFLOW ? /* @__PURE__ */ jsx(LimitReductionsTableForm, { limits:
|
|
63
|
+
/* @__PURE__ */ jsx(TabPanel, { value: selectedTab, index: TabValues.LIMIT_REDUCTIONS, children: /* @__PURE__ */ jsx(Grid, { container: true, sx: { width: "100%" }, children: currentProvider === PARAM_PROVIDER_OPENLOADFLOW ? /* @__PURE__ */ jsx(LimitReductionsTableForm, { limits: params?.limitReductions ?? defaultLimitReductions }) : /* @__PURE__ */ jsx(
|
|
64
64
|
ParameterLineSlider,
|
|
65
65
|
{
|
|
66
66
|
name: PARAM_LIMIT_REDUCTION,
|
|
@@ -74,7 +74,7 @@ function LoadFlowParametersForm({
|
|
|
74
74
|
paramsLoaded
|
|
75
75
|
} = loadflowMethods;
|
|
76
76
|
return /* @__PURE__ */ jsx(CustomFormProvider, { validationSchema: formSchema, ...formMethods, removeOptional: true, language, children: /* @__PURE__ */ jsxs(Box, { sx: styles.form, children: [
|
|
77
|
-
renderTitleFields
|
|
77
|
+
renderTitleFields?.(),
|
|
78
78
|
paramsLoaded ? /* @__PURE__ */ jsxs(Box, { sx: styles.loadflowParameters, children: [
|
|
79
79
|
/* @__PURE__ */ jsx(
|
|
80
80
|
LoadFlowParametersHeader,
|
|
@@ -72,7 +72,7 @@ const getCommonLoadFlowParametersFormSchema = () => {
|
|
|
72
72
|
};
|
|
73
73
|
const getSpecificLoadFlowParametersFormSchema = (specificParameters) => {
|
|
74
74
|
const shape = {};
|
|
75
|
-
specificParameters
|
|
75
|
+
specificParameters?.forEach((param) => {
|
|
76
76
|
switch (param.type) {
|
|
77
77
|
case ParameterType.STRING:
|
|
78
78
|
shape[param.name] = yup.string().required();
|
|
@@ -98,7 +98,7 @@ const getSpecificLoadFlowParametersFormSchema = (specificParameters) => {
|
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
100
|
const getDefaultSpecificParamsValues = (specificParams) => {
|
|
101
|
-
return specificParams
|
|
101
|
+
return specificParams?.reduce((acc, param) => {
|
|
102
102
|
if (param.type === ParameterType.STRING_LIST && param.defaultValue === null) {
|
|
103
103
|
acc[param.name] = [];
|
|
104
104
|
} else if ((param.type === ParameterType.DOUBLE || param.type === ParameterType.INTEGER) && Number.isNaN(Number(param.defaultValue))) {
|
|
@@ -110,7 +110,7 @@ const getDefaultSpecificParamsValues = (specificParams) => {
|
|
|
110
110
|
}, {});
|
|
111
111
|
};
|
|
112
112
|
const setSpecificParameters = (provider, specificParamsDescriptions, formMethods) => {
|
|
113
|
-
const specificParams = provider ?
|
|
113
|
+
const specificParams = provider ? specificParamsDescriptions?.[provider] ?? [] : [];
|
|
114
114
|
const specificParamsValues = getDefaultSpecificParamsValues(specificParams);
|
|
115
115
|
formMethods.setValue(SPECIFIC_PARAMETERS, specificParamsValues);
|
|
116
116
|
};
|
|
@@ -124,6 +124,7 @@ const setLimitReductions = (provider, defaultLimitReductions, formMethods) => {
|
|
|
124
124
|
} else {
|
|
125
125
|
formMethods.setValue(PARAM_LIMIT_REDUCTION, DEFAULT_LIMIT_REDUCTION_VALUE);
|
|
126
126
|
formMethods.setValue(LIMIT_REDUCTIONS_FORM, []);
|
|
127
|
+
formMethods.clearErrors(LIMIT_REDUCTIONS_FORM);
|
|
127
128
|
}
|
|
128
129
|
};
|
|
129
130
|
const mapLimitReductions = (vlLimits, formLimits, indexVl) => {
|