@gridsuite/commons-ui 0.97.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.
Files changed (122) hide show
  1. package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +1 -1
  2. package/dist/components/index.d.ts +1 -0
  3. package/dist/components/index.js +94 -1
  4. package/dist/components/inputs/index.js +2 -1
  5. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +3 -1
  6. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +15 -3
  7. package/dist/components/inputs/reactHookForm/index.js +2 -1
  8. package/dist/components/inputs/reactHookForm/utils/HelperPreviousValue.js +1 -1
  9. package/dist/components/parameters/common/ProviderParam.d.ts +7 -0
  10. package/dist/components/parameters/common/ProviderParam.js +51 -0
  11. package/dist/components/parameters/common/computing-type.d.ts +20 -0
  12. package/dist/components/parameters/common/computing-type.js +46 -0
  13. package/dist/components/parameters/common/constant.d.ts +8 -0
  14. package/dist/components/parameters/common/constant.js +18 -0
  15. package/dist/components/parameters/common/index.d.ts +15 -0
  16. package/dist/components/parameters/common/index.js +61 -0
  17. package/dist/components/parameters/common/limitreductions/columns-definitions.d.ts +77 -0
  18. package/dist/components/parameters/common/limitreductions/columns-definitions.js +83 -0
  19. package/dist/components/parameters/common/limitreductions/index.d.ts +11 -0
  20. package/dist/components/parameters/common/limitreductions/index.js +21 -0
  21. package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.d.ts +5 -0
  22. package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.js +38 -0
  23. package/dist/components/parameters/common/limitreductions/limit-reduction-table-row.d.ts +7 -0
  24. package/dist/components/parameters/common/limitreductions/limit-reduction-table-row.js +9 -0
  25. package/dist/components/parameters/common/limitreductions/limit-reductions-form-util.d.ts +29 -0
  26. package/dist/components/parameters/common/limitreductions/limit-reductions-form-util.js +27 -0
  27. package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.d.ts +4 -0
  28. package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.js +87 -0
  29. package/dist/components/parameters/common/line-separator.d.ts +1 -0
  30. package/dist/components/parameters/common/line-separator.js +8 -0
  31. package/dist/components/parameters/common/parameters-creation-dialog.d.ts +13 -0
  32. package/dist/components/parameters/common/parameters-creation-dialog.js +88 -0
  33. package/dist/components/parameters/common/parameters.d.ts +20 -0
  34. package/dist/components/parameters/common/parameters.js +42 -0
  35. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.d.ts +6 -0
  36. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +42 -0
  37. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-row.d.ts +8 -0
  38. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-row.js +17 -0
  39. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table.d.ts +8 -0
  40. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table.js +55 -0
  41. package/dist/components/parameters/common/voltage-level-table/index.d.ts +9 -0
  42. package/dist/components/parameters/common/voltage-level-table/index.js +8 -0
  43. package/dist/components/parameters/common/widget/index.d.ts +11 -0
  44. package/dist/components/parameters/common/widget/index.js +13 -0
  45. package/dist/components/parameters/common/widget/parameter-float.d.ts +10 -0
  46. package/dist/components/parameters/common/widget/parameter-float.js +51 -0
  47. package/dist/components/parameters/common/widget/parameter-group.d.ts +11 -0
  48. package/dist/components/parameters/common/widget/parameter-group.js +54 -0
  49. package/dist/components/parameters/common/widget/parameter-line-directory-items-input.d.ts +15 -0
  50. package/dist/components/parameters/common/widget/parameter-line-directory-items-input.js +55 -0
  51. package/dist/components/parameters/common/widget/parameter-line-slider.d.ts +12 -0
  52. package/dist/components/parameters/common/widget/parameter-line-slider.js +70 -0
  53. package/dist/components/parameters/common/widget/parameter-switch.d.ts +7 -0
  54. package/dist/components/parameters/common/widget/parameter-switch.js +9 -0
  55. package/dist/components/parameters/index.d.ts +9 -0
  56. package/dist/components/parameters/index.js +94 -0
  57. package/dist/components/parameters/loadflow/constants.d.ts +33 -0
  58. package/dist/components/parameters/loadflow/constants.js +59 -0
  59. package/dist/components/parameters/loadflow/index.d.ts +9 -0
  60. package/dist/components/parameters/loadflow/index.js +31 -0
  61. package/dist/components/parameters/loadflow/load-flow-general-parameters.d.ts +8 -0
  62. package/dist/components/parameters/loadflow/load-flow-general-parameters.js +179 -0
  63. package/dist/components/parameters/loadflow/load-flow-parameter-field.d.ts +19 -0
  64. package/dist/components/parameters/loadflow/load-flow-parameter-field.js +90 -0
  65. package/dist/components/parameters/loadflow/load-flow-parameters-content.d.ts +13 -0
  66. package/dist/components/parameters/loadflow/load-flow-parameters-content.js +82 -0
  67. package/dist/components/parameters/loadflow/load-flow-parameters-context.d.ts +13 -0
  68. package/dist/components/parameters/loadflow/load-flow-parameters-context.js +5 -0
  69. package/dist/components/parameters/loadflow/load-flow-parameters-dialog.d.ts +15 -0
  70. package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +112 -0
  71. package/dist/components/parameters/loadflow/load-flow-parameters-form.d.ts +9 -0
  72. package/dist/components/parameters/loadflow/load-flow-parameters-form.js +102 -0
  73. package/dist/components/parameters/loadflow/load-flow-parameters-header.d.ts +12 -0
  74. package/dist/components/parameters/loadflow/load-flow-parameters-header.js +84 -0
  75. package/dist/components/parameters/loadflow/load-flow-parameters-inline.d.ts +10 -0
  76. package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +162 -0
  77. package/dist/components/parameters/loadflow/load-flow-parameters-provider.d.ts +4 -0
  78. package/dist/components/parameters/loadflow/load-flow-parameters-provider.js +20 -0
  79. package/dist/components/parameters/loadflow/load-flow-parameters-utils.d.ts +100 -0
  80. package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +158 -0
  81. package/dist/components/parameters/loadflow/use-load-flow-context.d.ts +7 -0
  82. package/dist/components/parameters/loadflow/use-load-flow-context.js +12 -0
  83. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.d.ts +32 -0
  84. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +263 -0
  85. package/dist/components/parameters/parameters-style.d.ts +150 -0
  86. package/dist/components/parameters/parameters-style.js +146 -0
  87. package/dist/hooks/index.d.ts +1 -0
  88. package/dist/hooks/index.js +3 -0
  89. package/dist/hooks/use-parameters-backend.d.ts +11 -0
  90. package/dist/hooks/use-parameters-backend.js +217 -0
  91. package/dist/index.js +115 -3
  92. package/dist/services/explore.d.ts +3 -0
  93. package/dist/services/explore.js +26 -1
  94. package/dist/services/index.js +6 -3
  95. package/dist/services/loadflow.d.ts +9 -0
  96. package/dist/services/loadflow.js +59 -0
  97. package/dist/services/utils.d.ts +3 -8
  98. package/dist/services/utils.js +5 -0
  99. package/dist/translations/en/index.d.ts +1 -0
  100. package/dist/translations/en/index.js +2 -0
  101. package/dist/translations/en/parameters.d.ts +67 -0
  102. package/dist/translations/en/parameters.js +64 -0
  103. package/dist/translations/fr/index.d.ts +1 -0
  104. package/dist/translations/fr/index.js +2 -0
  105. package/dist/translations/fr/parameters.d.ts +67 -0
  106. package/dist/translations/fr/parameters.js +64 -0
  107. package/dist/utils/index.js +9 -0
  108. package/dist/utils/types/dynamic-security-analysis.type.d.ts +13 -0
  109. package/dist/utils/types/dynamic-security-analysis.type.js +1 -0
  110. package/dist/utils/types/dynamic-simulation.type.d.ts +111 -0
  111. package/dist/utils/types/dynamic-simulation.type.js +8 -0
  112. package/dist/utils/types/index.d.ts +6 -0
  113. package/dist/utils/types/index.js +9 -0
  114. package/dist/utils/types/loadflow.type.d.ts +11 -0
  115. package/dist/utils/types/loadflow.type.js +1 -0
  116. package/dist/utils/types/non-evacuated-energy.type.d.ts +60 -0
  117. package/dist/utils/types/non-evacuated-energy.type.js +12 -0
  118. package/dist/utils/types/parameters.type.d.ts +41 -0
  119. package/dist/utils/types/parameters.type.js +12 -0
  120. package/dist/utils/types/sensitivity-analysis.type.d.ts +101 -0
  121. package/dist/utils/types/sensitivity-analysis.type.js +16 -0
  122. package/package.json +2 -1
@@ -0,0 +1,77 @@
1
+ import { UUID } from 'crypto';
2
+ import { default as yup } from '../../../../utils/yupConfig';
3
+ import { PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, 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_PROVIDER } from '../constant';
4
+ export declare const LIMIT_REDUCTIONS_FORM = "limitReductionsForm";
5
+ export declare const VOLTAGE_LEVELS_FORM = "voltageLevelsForm";
6
+ export declare const IST_FORM = "istForm";
7
+ export declare const LIMIT_DURATION_FORM = "limitReductionForm";
8
+ export interface IVoltageLevel {
9
+ nominalV: number;
10
+ lowBound: number;
11
+ highBound: number;
12
+ }
13
+ export interface ILimitDuration {
14
+ lowBound: number;
15
+ lowClosed: boolean;
16
+ highBound: number;
17
+ highClosed: boolean;
18
+ }
19
+ export interface ITemporaryLimitReduction {
20
+ reduction: number;
21
+ limitDuration: ILimitDuration;
22
+ }
23
+ export interface ILimitReductionsByVoltageLevel {
24
+ voltageLevel: IVoltageLevel;
25
+ permanentLimitReduction: number;
26
+ temporaryLimitReductions: ITemporaryLimitReduction[];
27
+ }
28
+ export interface ISAParameters {
29
+ uuid?: UUID;
30
+ [PARAM_SA_PROVIDER]: string;
31
+ limitReductions: ILimitReductionsByVoltageLevel[];
32
+ [PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD]: number;
33
+ [PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD]: number;
34
+ [PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD]: number;
35
+ [PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD]: number;
36
+ [PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD]: number;
37
+ }
38
+ export declare enum TabValues {
39
+ 'General' = 0,
40
+ 'LimitReductions' = 1
41
+ }
42
+ export declare const TAB_INFO: {
43
+ label: string;
44
+ developerModeOnly: boolean;
45
+ }[];
46
+ export interface IColumnsDef {
47
+ label: string;
48
+ dataKey: string;
49
+ tooltip: string;
50
+ width?: string;
51
+ }
52
+ export declare const COLUMNS_DEFINITIONS_LIMIT_REDUCTIONS: IColumnsDef[];
53
+ export declare const getLimitReductionsFormSchema: (nbTemporaryLimits: number) => yup.ObjectSchema<{
54
+ limitReductionsForm: {
55
+ voltageLevelsForm?: string | undefined;
56
+ istForm: number;
57
+ }[] | undefined;
58
+ }, yup.AnyObject, {
59
+ limitReductionsForm: "";
60
+ }, "">;
61
+ export declare const getSAParametersFromSchema: (limitReductions?: ILimitReductionsByVoltageLevel[]) => yup.ObjectSchema<{
62
+ flowProportionalThreshold: unknown;
63
+ lowVoltageProportionalThreshold: unknown;
64
+ lowVoltageAbsoluteThreshold: unknown;
65
+ highVoltageProportionalThreshold: unknown;
66
+ highVoltageAbsoluteThreshold: unknown;
67
+ limitReductionsForm: unknown;
68
+ provider: unknown;
69
+ }, yup.AnyObject, {
70
+ flowProportionalThreshold: undefined;
71
+ lowVoltageProportionalThreshold: undefined;
72
+ lowVoltageAbsoluteThreshold: undefined;
73
+ highVoltageProportionalThreshold: undefined;
74
+ highVoltageAbsoluteThreshold: undefined;
75
+ limitReductionsForm: undefined;
76
+ provider: undefined;
77
+ }, "">;
@@ -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,5 @@
1
+ import { IColumnsDef } from './columns-definitions';
2
+ export declare function LimitReductionTableCell({ rowIndex, column }: Readonly<{
3
+ rowIndex: number;
4
+ column: IColumnsDef;
5
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -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,4 @@
1
+ import { ILimitReductionsByVoltageLevel } from './columns-definitions';
2
+ export declare function LimitReductionsTableForm({ limits }: Readonly<{
3
+ limits: ILimitReductionsByVoltageLevel[];
4
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -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,8 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Grid, Divider } from "@mui/material";
3
+ function LineSeparator() {
4
+ return /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Divider, {}) });
5
+ }
6
+ export {
7
+ LineSeparator
8
+ };
@@ -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
+ };
@@ -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;
@@ -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
+ };
@@ -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 {};