@gridsuite/commons-ui 0.98.0 → 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +94 -1
- package/dist/components/inputs/index.js +2 -1
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +1 -0
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +2 -0
- package/dist/components/inputs/reactHookForm/index.js +2 -1
- package/dist/components/inputs/reactHookForm/utils/HelperPreviousValue.js +1 -1
- package/dist/components/parameters/common/ProviderParam.d.ts +7 -0
- package/dist/components/parameters/common/ProviderParam.js +51 -0
- package/dist/components/parameters/common/computing-type.d.ts +20 -0
- package/dist/components/parameters/common/computing-type.js +46 -0
- package/dist/components/parameters/common/constant.d.ts +8 -0
- package/dist/components/parameters/common/constant.js +18 -0
- package/dist/components/parameters/common/index.d.ts +15 -0
- package/dist/components/parameters/common/index.js +61 -0
- package/dist/components/parameters/common/limitreductions/columns-definitions.d.ts +77 -0
- package/dist/components/parameters/common/limitreductions/columns-definitions.js +83 -0
- package/dist/components/parameters/common/limitreductions/index.d.ts +11 -0
- package/dist/components/parameters/common/limitreductions/index.js +21 -0
- package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.d.ts +5 -0
- package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.js +38 -0
- package/dist/components/parameters/common/limitreductions/limit-reduction-table-row.d.ts +7 -0
- package/dist/components/parameters/common/limitreductions/limit-reduction-table-row.js +9 -0
- package/dist/components/parameters/common/limitreductions/limit-reductions-form-util.d.ts +29 -0
- package/dist/components/parameters/common/limitreductions/limit-reductions-form-util.js +27 -0
- package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.d.ts +4 -0
- package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.js +87 -0
- package/dist/components/parameters/common/line-separator.d.ts +1 -0
- package/dist/components/parameters/common/line-separator.js +8 -0
- package/dist/components/parameters/common/parameters-creation-dialog.d.ts +13 -0
- package/dist/components/parameters/common/parameters-creation-dialog.js +88 -0
- package/dist/components/parameters/common/parameters.d.ts +20 -0
- package/dist/components/parameters/common/parameters.js +42 -0
- package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.d.ts +6 -0
- package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +42 -0
- package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-row.d.ts +8 -0
- package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-row.js +17 -0
- package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table.d.ts +8 -0
- package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table.js +55 -0
- package/dist/components/parameters/common/voltage-level-table/index.d.ts +9 -0
- package/dist/components/parameters/common/voltage-level-table/index.js +8 -0
- package/dist/components/parameters/common/widget/index.d.ts +11 -0
- package/dist/components/parameters/common/widget/index.js +13 -0
- package/dist/components/parameters/common/widget/parameter-float.d.ts +10 -0
- package/dist/components/parameters/common/widget/parameter-float.js +51 -0
- package/dist/components/parameters/common/widget/parameter-group.d.ts +11 -0
- package/dist/components/parameters/common/widget/parameter-group.js +54 -0
- package/dist/components/parameters/common/widget/parameter-line-directory-items-input.d.ts +15 -0
- package/dist/components/parameters/common/widget/parameter-line-directory-items-input.js +55 -0
- package/dist/components/parameters/common/widget/parameter-line-slider.d.ts +12 -0
- package/dist/components/parameters/common/widget/parameter-line-slider.js +70 -0
- package/dist/components/parameters/common/widget/parameter-switch.d.ts +7 -0
- package/dist/components/parameters/common/widget/parameter-switch.js +9 -0
- package/dist/components/parameters/index.d.ts +9 -0
- package/dist/components/parameters/index.js +94 -0
- package/dist/components/parameters/loadflow/constants.d.ts +33 -0
- package/dist/components/parameters/loadflow/constants.js +59 -0
- package/dist/components/parameters/loadflow/index.d.ts +9 -0
- package/dist/components/parameters/loadflow/index.js +31 -0
- package/dist/components/parameters/loadflow/load-flow-general-parameters.d.ts +8 -0
- package/dist/components/parameters/loadflow/load-flow-general-parameters.js +179 -0
- package/dist/components/parameters/loadflow/load-flow-parameter-field.d.ts +19 -0
- package/dist/components/parameters/loadflow/load-flow-parameter-field.js +90 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-content.d.ts +13 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-content.js +82 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-context.d.ts +13 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-context.js +5 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-dialog.d.ts +15 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +112 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-form.d.ts +9 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-form.js +102 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-header.d.ts +12 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-header.js +84 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-inline.d.ts +10 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +162 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-provider.d.ts +4 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-provider.js +20 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.d.ts +100 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +158 -0
- package/dist/components/parameters/loadflow/use-load-flow-context.d.ts +7 -0
- package/dist/components/parameters/loadflow/use-load-flow-context.js +12 -0
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.d.ts +32 -0
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +263 -0
- package/dist/components/parameters/parameters-style.d.ts +150 -0
- package/dist/components/parameters/parameters-style.js +146 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/use-parameters-backend.d.ts +11 -0
- package/dist/hooks/use-parameters-backend.js +217 -0
- package/dist/index.js +115 -3
- package/dist/services/explore.d.ts +3 -0
- package/dist/services/explore.js +26 -1
- package/dist/services/index.js +6 -3
- package/dist/services/loadflow.d.ts +9 -0
- package/dist/services/loadflow.js +59 -0
- package/dist/services/utils.d.ts +3 -8
- package/dist/services/utils.js +5 -0
- package/dist/translations/en/index.d.ts +1 -0
- package/dist/translations/en/index.js +2 -0
- package/dist/translations/en/parameters.d.ts +67 -0
- package/dist/translations/en/parameters.js +64 -0
- package/dist/translations/fr/index.d.ts +1 -0
- package/dist/translations/fr/index.js +2 -0
- package/dist/translations/fr/parameters.d.ts +67 -0
- package/dist/translations/fr/parameters.js +64 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/types/dynamic-security-analysis.type.d.ts +13 -0
- package/dist/utils/types/dynamic-security-analysis.type.js +1 -0
- package/dist/utils/types/dynamic-simulation.type.d.ts +111 -0
- package/dist/utils/types/dynamic-simulation.type.js +8 -0
- package/dist/utils/types/index.d.ts +6 -0
- package/dist/utils/types/index.js +9 -0
- package/dist/utils/types/loadflow.type.d.ts +11 -0
- package/dist/utils/types/loadflow.type.js +1 -0
- package/dist/utils/types/non-evacuated-energy.type.d.ts +60 -0
- package/dist/utils/types/non-evacuated-energy.type.js +12 -0
- package/dist/utils/types/parameters.type.d.ts +41 -0
- package/dist/utils/types/parameters.type.js +12 -0
- package/dist/utils/types/sensitivity-analysis.type.d.ts +101 -0
- package/dist/utils/types/sensitivity-analysis.type.js +16 -0
- package/package.json +2 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import "../../../../utils/yupConfig.js";
|
|
2
|
+
import { PARAM_SA_PROVIDER, PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD } from "../constant.js";
|
|
3
|
+
import * as yup from "yup";
|
|
4
|
+
const LIMIT_REDUCTIONS_FORM = "limitReductionsForm";
|
|
5
|
+
const VOLTAGE_LEVELS_FORM = "voltageLevelsForm";
|
|
6
|
+
const IST_FORM = "istForm";
|
|
7
|
+
const LIMIT_DURATION_FORM = "limitReductionForm";
|
|
8
|
+
var TabValues = /* @__PURE__ */ ((TabValues2) => {
|
|
9
|
+
TabValues2[TabValues2["General"] = 0] = "General";
|
|
10
|
+
TabValues2[TabValues2["LimitReductions"] = 1] = "LimitReductions";
|
|
11
|
+
return TabValues2;
|
|
12
|
+
})(TabValues || {});
|
|
13
|
+
const TAB_INFO = [
|
|
14
|
+
{ label: TabValues[
|
|
15
|
+
0
|
|
16
|
+
/* General */
|
|
17
|
+
], developerModeOnly: false },
|
|
18
|
+
{ label: TabValues[
|
|
19
|
+
1
|
|
20
|
+
/* LimitReductions */
|
|
21
|
+
], developerModeOnly: false }
|
|
22
|
+
];
|
|
23
|
+
const COLUMNS_DEFINITIONS_LIMIT_REDUCTIONS = [
|
|
24
|
+
{
|
|
25
|
+
label: "voltageRange",
|
|
26
|
+
dataKey: VOLTAGE_LEVELS_FORM,
|
|
27
|
+
tooltip: "voltageRange"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: "IST",
|
|
31
|
+
dataKey: IST_FORM,
|
|
32
|
+
tooltip: "IST"
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
const getLimitDurationsFormSchema = (nbLimits) => {
|
|
36
|
+
const limitDurationsFormSchema = {};
|
|
37
|
+
for (let i = 0; i < nbLimits; i++) {
|
|
38
|
+
limitDurationsFormSchema[LIMIT_DURATION_FORM + i] = yup.number().min(0, "RealPercentage").max(1, "RealPercentage").nullable().required();
|
|
39
|
+
}
|
|
40
|
+
return limitDurationsFormSchema;
|
|
41
|
+
};
|
|
42
|
+
const getLimitReductionsFormSchema = (nbTemporaryLimits) => {
|
|
43
|
+
return yup.object().shape({
|
|
44
|
+
[LIMIT_REDUCTIONS_FORM]: yup.array().of(
|
|
45
|
+
yup.object().shape({
|
|
46
|
+
[VOLTAGE_LEVELS_FORM]: yup.string(),
|
|
47
|
+
[IST_FORM]: yup.number().min(0, "RealPercentage").max(1, "RealPercentage").nullable().required(),
|
|
48
|
+
...getLimitDurationsFormSchema(nbTemporaryLimits)
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
}).required();
|
|
52
|
+
};
|
|
53
|
+
const getSAParametersFromSchema = (limitReductions) => {
|
|
54
|
+
const providerSchema = yup.object().shape({
|
|
55
|
+
[PARAM_SA_PROVIDER]: yup.string().required()
|
|
56
|
+
});
|
|
57
|
+
const limitReductionsSchema = getLimitReductionsFormSchema(
|
|
58
|
+
(limitReductions == null ? void 0 : limitReductions.length) ? limitReductions[0].temporaryLimitReductions.length : 0
|
|
59
|
+
);
|
|
60
|
+
const thresholdsSchema = yup.object().shape({
|
|
61
|
+
[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD]: yup.number().min(0, "NormalizedPercentage").max(100, "NormalizedPercentage").required(),
|
|
62
|
+
[PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD]: yup.number().min(0, "NormalizedPercentage").max(100, "NormalizedPercentage").required(),
|
|
63
|
+
[PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD]: yup.number().required(),
|
|
64
|
+
[PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD]: yup.number().min(0, "NormalizedPercentage").max(100, "NormalizedPercentage").required(),
|
|
65
|
+
[PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD]: yup.number().required()
|
|
66
|
+
});
|
|
67
|
+
return yup.object().shape({
|
|
68
|
+
...providerSchema.fields,
|
|
69
|
+
...limitReductionsSchema.fields,
|
|
70
|
+
...thresholdsSchema.fields
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
COLUMNS_DEFINITIONS_LIMIT_REDUCTIONS,
|
|
75
|
+
IST_FORM,
|
|
76
|
+
LIMIT_DURATION_FORM,
|
|
77
|
+
LIMIT_REDUCTIONS_FORM,
|
|
78
|
+
TAB_INFO,
|
|
79
|
+
TabValues,
|
|
80
|
+
VOLTAGE_LEVELS_FORM,
|
|
81
|
+
getLimitReductionsFormSchema,
|
|
82
|
+
getSAParametersFromSchema
|
|
83
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
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 https://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export * from './columns-definitions';
|
|
8
|
+
export * from './limit-reductions-form-util';
|
|
9
|
+
export * from './limit-reductions-table-form';
|
|
10
|
+
export * from './limit-reduction-table-row';
|
|
11
|
+
export * from './limit-reduction-table-cell';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { COLUMNS_DEFINITIONS_LIMIT_REDUCTIONS, IST_FORM, LIMIT_DURATION_FORM, LIMIT_REDUCTIONS_FORM, TAB_INFO, TabValues, VOLTAGE_LEVELS_FORM, getLimitReductionsFormSchema, getSAParametersFromSchema } from "./columns-definitions.js";
|
|
2
|
+
import { toFormValueSaParameters, toFormValuesLimitReductions } from "./limit-reductions-form-util.js";
|
|
3
|
+
import { LimitReductionsTableForm } from "./limit-reductions-table-form.js";
|
|
4
|
+
import { LimitReductionTableRow } from "./limit-reduction-table-row.js";
|
|
5
|
+
import { LimitReductionTableCell } from "./limit-reduction-table-cell.js";
|
|
6
|
+
export {
|
|
7
|
+
COLUMNS_DEFINITIONS_LIMIT_REDUCTIONS,
|
|
8
|
+
IST_FORM,
|
|
9
|
+
LIMIT_DURATION_FORM,
|
|
10
|
+
LIMIT_REDUCTIONS_FORM,
|
|
11
|
+
LimitReductionTableCell,
|
|
12
|
+
LimitReductionTableRow,
|
|
13
|
+
LimitReductionsTableForm,
|
|
14
|
+
TAB_INFO,
|
|
15
|
+
TabValues,
|
|
16
|
+
VOLTAGE_LEVELS_FORM,
|
|
17
|
+
getLimitReductionsFormSchema,
|
|
18
|
+
getSAParametersFromSchema,
|
|
19
|
+
toFormValueSaParameters,
|
|
20
|
+
toFormValuesLimitReductions
|
|
21
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TableCell } from "@mui/material";
|
|
3
|
+
import { VOLTAGE_LEVELS_FORM, LIMIT_REDUCTIONS_FORM } from "./columns-definitions.js";
|
|
4
|
+
import "react-intl";
|
|
5
|
+
import "@mui/icons-material";
|
|
6
|
+
import "react";
|
|
7
|
+
import "react-hook-form";
|
|
8
|
+
import { RawReadOnlyInput } from "../../../inputs/reactHookForm/RawReadOnlyInput.js";
|
|
9
|
+
import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
10
|
+
import "yup";
|
|
11
|
+
import "notistack";
|
|
12
|
+
import "../../../overflowableText/OverflowableText.js";
|
|
13
|
+
import "../../../treeViewFinder/TreeViewFinder.js";
|
|
14
|
+
import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
15
|
+
import "../../../customAGGrid/customAggrid.js";
|
|
16
|
+
import "ag-grid-community";
|
|
17
|
+
import "react-papaparse";
|
|
18
|
+
import "react-csv-downloader";
|
|
19
|
+
import { FloatInput } from "../../../inputs/reactHookForm/numbers/FloatInput.js";
|
|
20
|
+
import "../../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
21
|
+
import "localized-countries";
|
|
22
|
+
import "localized-countries/data/fr";
|
|
23
|
+
import "localized-countries/data/en";
|
|
24
|
+
import "../../../../utils/conversionUtils.js";
|
|
25
|
+
import "../../../../utils/types/equipmentType.js";
|
|
26
|
+
import "../../../../utils/yupConfig.js";
|
|
27
|
+
import "@react-querybuilder/material";
|
|
28
|
+
import "../../../filter/expert/expertFilterConstants.js";
|
|
29
|
+
import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
30
|
+
import "uuid";
|
|
31
|
+
import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
32
|
+
import "react-querybuilder";
|
|
33
|
+
function LimitReductionTableCell({ rowIndex, column }) {
|
|
34
|
+
return /* @__PURE__ */ jsx(TableCell, { sx: { fontWeight: "bold" }, children: column.dataKey === VOLTAGE_LEVELS_FORM ? /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${LIMIT_REDUCTIONS_FORM}[${rowIndex}].${column.dataKey}` }) : /* @__PURE__ */ jsx(FloatInput, { name: `${LIMIT_REDUCTIONS_FORM}[${rowIndex}].${column.dataKey}` }) });
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
LimitReductionTableCell
|
|
38
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IColumnsDef } from './columns-definitions';
|
|
2
|
+
interface TableRowComponentProps {
|
|
3
|
+
columnsDefinition: IColumnsDef[];
|
|
4
|
+
index: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function LimitReductionTableRow({ columnsDefinition, index }: Readonly<TableRowComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TableRow } from "@mui/material";
|
|
3
|
+
import { LimitReductionTableCell } from "./limit-reduction-table-cell.js";
|
|
4
|
+
function LimitReductionTableRow({ columnsDefinition, index }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(TableRow, { children: columnsDefinition.map((column) => /* @__PURE__ */ jsx(LimitReductionTableCell, { rowIndex: index, column }, `${column.dataKey}`)) });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
LimitReductionTableRow
|
|
9
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ILimitReductionsByVoltageLevel, ISAParameters } from './columns-definitions';
|
|
2
|
+
export declare const toFormValuesLimitReductions: (limits: ILimitReductionsByVoltageLevel[]) => {
|
|
3
|
+
limitReductionsForm?: undefined;
|
|
4
|
+
} | {
|
|
5
|
+
limitReductionsForm: {
|
|
6
|
+
voltageLevelsForm: string;
|
|
7
|
+
istForm: number;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
export declare const toFormValueSaParameters: (params: ISAParameters) => {
|
|
11
|
+
flowProportionalThreshold: number;
|
|
12
|
+
lowVoltageProportionalThreshold: number;
|
|
13
|
+
lowVoltageAbsoluteThreshold: number;
|
|
14
|
+
highVoltageProportionalThreshold: number;
|
|
15
|
+
highVoltageAbsoluteThreshold: number;
|
|
16
|
+
limitReductionsForm?: undefined;
|
|
17
|
+
provider: string;
|
|
18
|
+
} | {
|
|
19
|
+
flowProportionalThreshold: number;
|
|
20
|
+
lowVoltageProportionalThreshold: number;
|
|
21
|
+
lowVoltageAbsoluteThreshold: number;
|
|
22
|
+
highVoltageProportionalThreshold: number;
|
|
23
|
+
highVoltageAbsoluteThreshold: number;
|
|
24
|
+
limitReductionsForm: {
|
|
25
|
+
voltageLevelsForm: string;
|
|
26
|
+
istForm: number;
|
|
27
|
+
}[];
|
|
28
|
+
provider: string;
|
|
29
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LIMIT_REDUCTIONS_FORM, IST_FORM, VOLTAGE_LEVELS_FORM, LIMIT_DURATION_FORM } from "./columns-definitions.js";
|
|
2
|
+
import { PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_PROVIDER } from "../constant.js";
|
|
3
|
+
const toFormValuesFromTemporaryLimits = (limits) => limits.reduce((acc, limit, index) => {
|
|
4
|
+
acc[LIMIT_DURATION_FORM + index] = limit.reduction;
|
|
5
|
+
return acc;
|
|
6
|
+
}, {});
|
|
7
|
+
const toFormValuesLimitReductions = (limits) => !limits ? {} : {
|
|
8
|
+
[LIMIT_REDUCTIONS_FORM]: limits.map((vlLimits) => ({
|
|
9
|
+
[VOLTAGE_LEVELS_FORM]: `${vlLimits.voltageLevel.nominalV} kV`,
|
|
10
|
+
[IST_FORM]: vlLimits.permanentLimitReduction,
|
|
11
|
+
...toFormValuesFromTemporaryLimits(vlLimits.temporaryLimitReductions)
|
|
12
|
+
}))
|
|
13
|
+
};
|
|
14
|
+
const toFormValueSaParameters = (params) => ({
|
|
15
|
+
[PARAM_SA_PROVIDER]: params[PARAM_SA_PROVIDER],
|
|
16
|
+
...toFormValuesLimitReductions(params == null ? void 0 : params.limitReductions),
|
|
17
|
+
// SA specific form values
|
|
18
|
+
[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD]: params[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD] * 100,
|
|
19
|
+
[PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD]: params[PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD] * 100,
|
|
20
|
+
[PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD]: params[PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD],
|
|
21
|
+
[PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD]: params[PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD] * 100,
|
|
22
|
+
[PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD]: params[PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD]
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
toFormValueSaParameters,
|
|
26
|
+
toFormValuesLimitReductions
|
|
27
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
4
|
+
import { COLUMNS_DEFINITIONS_LIMIT_REDUCTIONS, LIMIT_DURATION_FORM, LIMIT_REDUCTIONS_FORM } from "./columns-definitions.js";
|
|
5
|
+
import { CustomVoltageLevelTable } from "../voltage-level-table/custom-voltage-level-table.js";
|
|
6
|
+
import "@mui/material";
|
|
7
|
+
import "@mui/icons-material";
|
|
8
|
+
import "react-hook-form";
|
|
9
|
+
import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
10
|
+
import "yup";
|
|
11
|
+
import "notistack";
|
|
12
|
+
import "../../../overflowableText/OverflowableText.js";
|
|
13
|
+
import "../../../treeViewFinder/TreeViewFinder.js";
|
|
14
|
+
import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
15
|
+
import "../../../customAGGrid/customAggrid.js";
|
|
16
|
+
import "ag-grid-community";
|
|
17
|
+
import "react-papaparse";
|
|
18
|
+
import "react-csv-downloader";
|
|
19
|
+
import "../../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
20
|
+
import "localized-countries";
|
|
21
|
+
import "localized-countries/data/fr";
|
|
22
|
+
import "localized-countries/data/en";
|
|
23
|
+
import "../../../../utils/conversionUtils.js";
|
|
24
|
+
import "../../../../utils/types/equipmentType.js";
|
|
25
|
+
import "../../../../utils/yupConfig.js";
|
|
26
|
+
import "@react-querybuilder/material";
|
|
27
|
+
import "../../../filter/expert/expertFilterConstants.js";
|
|
28
|
+
import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
29
|
+
import "uuid";
|
|
30
|
+
import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
31
|
+
import "react-querybuilder";
|
|
32
|
+
const getLabelColumn = (limit) => {
|
|
33
|
+
const lowBound = `${Math.trunc(limit.limitDuration.lowBound / 60)} min`;
|
|
34
|
+
const highBoundValue = Math.trunc(limit.limitDuration.highBound / 60);
|
|
35
|
+
const highBound = highBoundValue === 0 ? "∞" : `${Math.trunc(limit.limitDuration.highBound / 60)} min`;
|
|
36
|
+
const lowerBoundClosed = limit.limitDuration.lowClosed ? "[" : "]";
|
|
37
|
+
const highBoundClosed = limit.limitDuration.highClosed || null ? "]" : "[";
|
|
38
|
+
return `${lowerBoundClosed}${lowBound}, ${highBound}${highBoundClosed}`;
|
|
39
|
+
};
|
|
40
|
+
function LimitReductionsTableForm({ limits }) {
|
|
41
|
+
const intl = useIntl();
|
|
42
|
+
const getToolTipColumn = useCallback(
|
|
43
|
+
(limit) => {
|
|
44
|
+
const lowBound = Math.trunc(limit.limitDuration.lowBound / 60);
|
|
45
|
+
const highBound = Math.trunc(limit.limitDuration.highBound / 60);
|
|
46
|
+
if (lowBound === 0) {
|
|
47
|
+
return intl.formatMessage({ id: "LimitDurationAfterIST" }, { value: highBound });
|
|
48
|
+
}
|
|
49
|
+
return intl.formatMessage(
|
|
50
|
+
{ id: "LimitDurationInterval" },
|
|
51
|
+
{
|
|
52
|
+
lowBound: `IT${lowBound}`,
|
|
53
|
+
highBound: highBound === 0 ? "IST" : `IT${highBound}`
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
[intl]
|
|
58
|
+
);
|
|
59
|
+
const columnsDefinition = useMemo(() => {
|
|
60
|
+
const columnsDef = COLUMNS_DEFINITIONS_LIMIT_REDUCTIONS.map((column) => ({
|
|
61
|
+
...column,
|
|
62
|
+
label: intl.formatMessage({ id: column.label }),
|
|
63
|
+
tooltip: intl.formatMessage({ id: column.tooltip })
|
|
64
|
+
}));
|
|
65
|
+
if (limits !== null && limits.length > 0) {
|
|
66
|
+
limits[0].temporaryLimitReductions.forEach((tlimit, index) => {
|
|
67
|
+
columnsDef.push({
|
|
68
|
+
label: getLabelColumn(tlimit),
|
|
69
|
+
dataKey: LIMIT_DURATION_FORM + index,
|
|
70
|
+
tooltip: getToolTipColumn(tlimit)
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return columnsDef;
|
|
75
|
+
}, [intl, limits, getToolTipColumn]);
|
|
76
|
+
return /* @__PURE__ */ jsx(
|
|
77
|
+
CustomVoltageLevelTable,
|
|
78
|
+
{
|
|
79
|
+
formName: LIMIT_REDUCTIONS_FORM,
|
|
80
|
+
columnsDefinition,
|
|
81
|
+
tableHeight: 450
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
LimitReductionsTableForm
|
|
87
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LineSeparator(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FieldValues, UseFormGetValues } from 'react-hook-form';
|
|
2
|
+
import { UUID } from 'crypto';
|
|
3
|
+
import { ElementType } from '../../../utils';
|
|
4
|
+
interface CreateParameterProps<T extends FieldValues> {
|
|
5
|
+
studyUuid: UUID | null;
|
|
6
|
+
open: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
parameterValues: UseFormGetValues<T> | any;
|
|
9
|
+
parameterType: ElementType;
|
|
10
|
+
parameterFormatter: (newParams: any) => any;
|
|
11
|
+
}
|
|
12
|
+
export declare function CreateParameterDialog<T extends FieldValues>({ studyUuid, open, onClose, parameterValues, parameterType, parameterFormatter, }: Readonly<CreateParameterProps<T>>): import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import "react-intl";
|
|
4
|
+
import "../../../utils/types/equipmentType.js";
|
|
5
|
+
import { createParameter, updateParameter } from "../../../services/explore.js";
|
|
6
|
+
import "@mui/material";
|
|
7
|
+
import "localized-countries";
|
|
8
|
+
import "localized-countries/data/fr";
|
|
9
|
+
import "localized-countries/data/en";
|
|
10
|
+
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
11
|
+
import "react-hook-form";
|
|
12
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
13
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
14
|
+
import { ElementSaveDialog } from "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
15
|
+
import "@mui/icons-material";
|
|
16
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
17
|
+
function CreateParameterDialog({
|
|
18
|
+
studyUuid,
|
|
19
|
+
open,
|
|
20
|
+
onClose,
|
|
21
|
+
parameterValues,
|
|
22
|
+
parameterType,
|
|
23
|
+
parameterFormatter
|
|
24
|
+
}) {
|
|
25
|
+
const { snackError, snackInfo } = useSnackMessage();
|
|
26
|
+
const saveParameters = useCallback(
|
|
27
|
+
(element) => {
|
|
28
|
+
createParameter(
|
|
29
|
+
parameterFormatter(parameterValues()),
|
|
30
|
+
element.name,
|
|
31
|
+
parameterType,
|
|
32
|
+
element.description,
|
|
33
|
+
element.folderId
|
|
34
|
+
).then(() => {
|
|
35
|
+
snackInfo({
|
|
36
|
+
headerId: "paramsCreationMsg",
|
|
37
|
+
headerValues: {
|
|
38
|
+
directory: element.folderName
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}).catch((error) => {
|
|
42
|
+
console.error(error);
|
|
43
|
+
snackError({
|
|
44
|
+
messageTxt: error.message,
|
|
45
|
+
headerId: "paramsCreatingError"
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
[parameterFormatter, parameterType, parameterValues, snackError, snackInfo]
|
|
50
|
+
);
|
|
51
|
+
const updateParameters = ({ id, name, description, elementFullPath }) => {
|
|
52
|
+
updateParameter(id, parameterFormatter(parameterValues()), name, parameterType, description).then(() => {
|
|
53
|
+
snackInfo({
|
|
54
|
+
headerId: "paramsUpdateMsg",
|
|
55
|
+
headerValues: {
|
|
56
|
+
item: elementFullPath
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}).catch((error) => {
|
|
60
|
+
console.error(error);
|
|
61
|
+
snackError({
|
|
62
|
+
messageTxt: error.message,
|
|
63
|
+
headerId: "paramsUpdatingError",
|
|
64
|
+
headerValues: {
|
|
65
|
+
item: elementFullPath
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
return studyUuid && /* @__PURE__ */ jsx(
|
|
71
|
+
ElementSaveDialog,
|
|
72
|
+
{
|
|
73
|
+
open,
|
|
74
|
+
onClose,
|
|
75
|
+
onSave: saveParameters,
|
|
76
|
+
OnUpdate: updateParameters,
|
|
77
|
+
type: parameterType,
|
|
78
|
+
titleId: "saveParameters",
|
|
79
|
+
studyUuid,
|
|
80
|
+
selectorTitleId: "showSelectParameterDialog",
|
|
81
|
+
createLabelId: "createParameterLabel",
|
|
82
|
+
updateLabelId: "updateParameterLabel"
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
CreateParameterDialog
|
|
88
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { ButtonProps, TypographyProps } from '@mui/material';
|
|
3
|
+
interface LabelledButtonProps extends ButtonProps {
|
|
4
|
+
callback: React.MouseEventHandler<HTMLButtonElement>;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function LabelledButton({ callback, label, ...props }: Readonly<LabelledButtonProps>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
interface SwitchWithLabelProps {
|
|
9
|
+
value: boolean;
|
|
10
|
+
label: string;
|
|
11
|
+
callback?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function SwitchWithLabel({ value, label, callback }: Readonly<SwitchWithLabelProps>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
interface TabPanelProps<T> extends TypographyProps {
|
|
15
|
+
value: T;
|
|
16
|
+
index: T;
|
|
17
|
+
keepState?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function TabPanel<T>(props: PropsWithChildren<TabPanelProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { FormattedMessage } from "react-intl";
|
|
3
|
+
import { Button, Grid, Switch, Typography, Box } from "@mui/material";
|
|
4
|
+
import { parametersStyles } from "../parameters-style.js";
|
|
5
|
+
function LabelledButton({ callback, label, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Button, { onClick: callback, ...props, children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) });
|
|
7
|
+
}
|
|
8
|
+
function SwitchWithLabel({ value, label, callback }) {
|
|
9
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 8, sx: parametersStyles.parameterName, children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) }),
|
|
11
|
+
/* @__PURE__ */ jsx(Grid, { item: true, container: true, xs: 4, sx: parametersStyles.controlItem, children: /* @__PURE__ */ jsx(
|
|
12
|
+
Switch,
|
|
13
|
+
{
|
|
14
|
+
checked: value,
|
|
15
|
+
onChange: callback,
|
|
16
|
+
value,
|
|
17
|
+
inputProps: { "aria-label": "primary checkbox" }
|
|
18
|
+
}
|
|
19
|
+
) })
|
|
20
|
+
] });
|
|
21
|
+
}
|
|
22
|
+
function TabPanel(props) {
|
|
23
|
+
const { children, value, index, keepState, ...other } = props;
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
Typography,
|
|
26
|
+
{
|
|
27
|
+
component: "div",
|
|
28
|
+
role: "tabpanel",
|
|
29
|
+
hidden: value !== index,
|
|
30
|
+
id: `simple-tabpanel-${index}`,
|
|
31
|
+
"aria-labelledby": `simple-tab-${index}`,
|
|
32
|
+
style: { flexGrow: 1 },
|
|
33
|
+
...other,
|
|
34
|
+
children: (value === index || keepState) && /* @__PURE__ */ jsx(Box, { sx: parametersStyles.panel, children })
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
LabelledButton,
|
|
40
|
+
SwitchWithLabel,
|
|
41
|
+
TabPanel
|
|
42
|
+
};
|
package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IColumnsDef } from '../limitreductions/columns-definitions';
|
|
2
|
+
export declare function CustomVoltageLevelTableCell({ formName, rowIndex, column, }: Readonly<{
|
|
3
|
+
formName: string;
|
|
4
|
+
rowIndex: number;
|
|
5
|
+
column: IColumnsDef;
|
|
6
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TableCell } from "@mui/material";
|
|
3
|
+
import { VOLTAGE_LEVEL } from "../constant.js";
|
|
4
|
+
import "react-intl";
|
|
5
|
+
import "@mui/icons-material";
|
|
6
|
+
import "react";
|
|
7
|
+
import "react-hook-form";
|
|
8
|
+
import { RawReadOnlyInput } from "../../../inputs/reactHookForm/RawReadOnlyInput.js";
|
|
9
|
+
import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
10
|
+
import "yup";
|
|
11
|
+
import "notistack";
|
|
12
|
+
import "../../../overflowableText/OverflowableText.js";
|
|
13
|
+
import "../../../treeViewFinder/TreeViewFinder.js";
|
|
14
|
+
import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
15
|
+
import "../../../customAGGrid/customAggrid.js";
|
|
16
|
+
import "ag-grid-community";
|
|
17
|
+
import "react-papaparse";
|
|
18
|
+
import "react-csv-downloader";
|
|
19
|
+
import { FloatInput } from "../../../inputs/reactHookForm/numbers/FloatInput.js";
|
|
20
|
+
import "../../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
21
|
+
import "localized-countries";
|
|
22
|
+
import "localized-countries/data/fr";
|
|
23
|
+
import "localized-countries/data/en";
|
|
24
|
+
import "../../../../utils/conversionUtils.js";
|
|
25
|
+
import "../../../../utils/types/equipmentType.js";
|
|
26
|
+
import "../../../../utils/yupConfig.js";
|
|
27
|
+
import "@react-querybuilder/material";
|
|
28
|
+
import "../../../filter/expert/expertFilterConstants.js";
|
|
29
|
+
import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
30
|
+
import "uuid";
|
|
31
|
+
import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
32
|
+
import "react-querybuilder";
|
|
33
|
+
function CustomVoltageLevelTableCell({
|
|
34
|
+
formName,
|
|
35
|
+
rowIndex,
|
|
36
|
+
column
|
|
37
|
+
}) {
|
|
38
|
+
return /* @__PURE__ */ jsx(TableCell, { sx: { fontWeight: "bold" }, children: column.dataKey === VOLTAGE_LEVEL ? /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${formName}[${rowIndex}].${column.dataKey}` }) : /* @__PURE__ */ jsx(FloatInput, { name: `${formName}[${rowIndex}].${column.dataKey}` }) });
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
CustomVoltageLevelTableCell
|
|
42
|
+
};
|
package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-row.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IColumnsDef } from '../limitreductions/columns-definitions';
|
|
2
|
+
interface TableRowComponentProps {
|
|
3
|
+
formName: string;
|
|
4
|
+
columnsDefinition: IColumnsDef[];
|
|
5
|
+
index: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function CustomVoltageLevelTableRow({ formName, columnsDefinition, index }: Readonly<TableRowComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-row.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TableRow } from "@mui/material";
|
|
3
|
+
import { CustomVoltageLevelTableCell } from "./custom-voltage-level-table-cell.js";
|
|
4
|
+
function CustomVoltageLevelTableRow({ formName, columnsDefinition, index }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(TableRow, { children: columnsDefinition.map((column) => /* @__PURE__ */ jsx(
|
|
6
|
+
CustomVoltageLevelTableCell,
|
|
7
|
+
{
|
|
8
|
+
formName,
|
|
9
|
+
rowIndex: index,
|
|
10
|
+
column
|
|
11
|
+
},
|
|
12
|
+
`${column.dataKey}`
|
|
13
|
+
)) });
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
CustomVoltageLevelTableRow
|
|
17
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IColumnsDef } from '../limitreductions/columns-definitions';
|
|
2
|
+
interface LimitReductionsTableProps {
|
|
3
|
+
columnsDefinition: IColumnsDef[];
|
|
4
|
+
tableHeight: number;
|
|
5
|
+
formName: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function CustomVoltageLevelTable({ formName, columnsDefinition, tableHeight, }: Readonly<LimitReductionsTableProps>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TableContainer, Table, TableHead, TableRow, TableCell, TableBody } from "@mui/material";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { useFieldArray } from "react-hook-form";
|
|
5
|
+
import { LIMIT_REDUCTIONS_FORM } from "../limitreductions/columns-definitions.js";
|
|
6
|
+
import { LimitReductionTableRow } from "../limitreductions/limit-reduction-table-row.js";
|
|
7
|
+
import { CustomVoltageLevelTableRow } from "./custom-voltage-level-table-row.js";
|
|
8
|
+
function CustomVoltageLevelTable({
|
|
9
|
+
formName,
|
|
10
|
+
columnsDefinition,
|
|
11
|
+
tableHeight
|
|
12
|
+
}) {
|
|
13
|
+
const { fields: rows } = useFieldArray({
|
|
14
|
+
name: formName
|
|
15
|
+
});
|
|
16
|
+
const TableRowComponent = useMemo(
|
|
17
|
+
() => formName === LIMIT_REDUCTIONS_FORM ? LimitReductionTableRow : CustomVoltageLevelTableRow,
|
|
18
|
+
[formName]
|
|
19
|
+
);
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
TableContainer,
|
|
22
|
+
{
|
|
23
|
+
sx: {
|
|
24
|
+
height: tableHeight,
|
|
25
|
+
width: "inherit",
|
|
26
|
+
border: "solid 0px rgba(0,0,0,0.1)"
|
|
27
|
+
},
|
|
28
|
+
children: /* @__PURE__ */ jsxs(Table, { stickyHeader: true, size: "small", sx: { tableLayout: "fixed" }, children: [
|
|
29
|
+
/* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow, { children: columnsDefinition.map((column) => /* @__PURE__ */ jsx(
|
|
30
|
+
TableCell,
|
|
31
|
+
{
|
|
32
|
+
sx: {
|
|
33
|
+
textAlign: "center"
|
|
34
|
+
},
|
|
35
|
+
title: column.tooltip,
|
|
36
|
+
children: column.label
|
|
37
|
+
},
|
|
38
|
+
column.dataKey
|
|
39
|
+
)) }) }),
|
|
40
|
+
/* @__PURE__ */ jsx(TableBody, { children: rows.map((row, index) => /* @__PURE__ */ jsx(
|
|
41
|
+
TableRowComponent,
|
|
42
|
+
{
|
|
43
|
+
columnsDefinition,
|
|
44
|
+
index,
|
|
45
|
+
formName
|
|
46
|
+
},
|
|
47
|
+
`${row.id}`
|
|
48
|
+
)) })
|
|
49
|
+
] })
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
CustomVoltageLevelTable
|
|
55
|
+
};
|