@gridsuite/commons-ui 0.192.0 → 0.194.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/directoryItemSelector/DirectoryItemSelector.js +0 -1
- package/dist/components/dnd-table-v2/deletable-table-row.d.ts +7 -0
- package/dist/components/dnd-table-v2/deletable-table-row.js +37 -0
- package/dist/components/dnd-table-v2/dnd-table-add-rows-dialog.d.ts +13 -0
- package/dist/components/dnd-table-v2/dnd-table-add-rows-dialog.js +75 -0
- package/dist/components/dnd-table-v2/dnd-table-bottom-left-buttons.d.ts +17 -0
- package/dist/components/dnd-table-v2/dnd-table-bottom-left-buttons.js +48 -0
- package/dist/components/dnd-table-v2/dnd-table-bottom-right-buttons.d.ts +17 -0
- package/dist/components/dnd-table-v2/dnd-table-bottom-right-buttons.js +103 -0
- package/dist/components/dnd-table-v2/dnd-table-row.d.ts +23 -0
- package/dist/components/dnd-table-v2/dnd-table-row.js +183 -0
- package/dist/components/dnd-table-v2/dnd-table-utils.d.ts +2 -0
- package/dist/components/dnd-table-v2/dnd-table-utils.js +10 -0
- package/dist/components/dnd-table-v2/dnd-table.d.ts +32 -0
- package/dist/components/dnd-table-v2/dnd-table.js +381 -0
- package/dist/components/dnd-table-v2/dnd-table.type.d.ts +70 -0
- package/dist/components/dnd-table-v2/dnd-table.type.js +19 -0
- package/dist/components/dnd-table-v2/index.d.ts +12 -0
- package/dist/components/dnd-table-v2/index.js +16 -0
- package/dist/components/filter/constants/FilterConstants.d.ts +6 -2
- package/dist/components/filter/constants/FilterConstants.js +1 -10
- package/dist/components/filter/expert/ExpertFilterEditionDialog.js +2 -1
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +2 -1
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.d.ts +1 -1
- package/dist/components/filter/filter.type.d.ts +27 -17
- package/dist/components/filter/index.js +1 -2
- package/dist/components/index.js +12 -12
- package/dist/components/inputs/checkbox-autocomplete/checkbox-autocomplete.d.ts +12 -0
- package/dist/components/inputs/checkbox-autocomplete/checkbox-autocomplete.js +126 -0
- package/dist/components/inputs/checkbox-autocomplete/checkbox-item.d.ts +8 -0
- package/dist/components/inputs/checkbox-autocomplete/checkbox-item.js +17 -0
- package/dist/components/inputs/checkbox-autocomplete/index.d.ts +7 -0
- package/dist/components/inputs/checkbox-autocomplete/index.js +4 -0
- package/dist/components/inputs/checkbox-autocomplete/virtualized-list-item.d.ts +15 -0
- package/dist/components/inputs/checkbox-autocomplete/virtualized-list-item.js +27 -0
- package/dist/components/inputs/checkbox-autocomplete/virtualized-list.d.ts +3 -0
- package/dist/components/inputs/checkbox-autocomplete/virtualized-list.js +30 -0
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +1 -2
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +2 -5
- package/dist/components/inputs/reactHookForm/booleans/BooleanInput.js +6 -4
- package/dist/components/inputs/reactQueryBuilder/OperatorSelector.js +0 -1
- package/dist/components/parameters/common/contingency-table/columns-definitions.d.ts +4 -3
- package/dist/components/parameters/common/contingency-table/columns-definitions.js +23 -15
- package/dist/components/parameters/common/contingency-table/contingency-table.d.ts +2 -1
- package/dist/components/parameters/common/contingency-table/contingency-table.js +45 -44
- package/dist/components/parameters/common/contingency-table/index.js +2 -2
- package/dist/components/parameters/common/hook/index.d.ts +8 -0
- package/dist/components/parameters/common/hook/index.js +6 -0
- package/dist/components/parameters/common/hook/use-parameters-form.d.ts +13 -0
- package/dist/components/parameters/common/hook/use-parameters-form.js +60 -0
- package/dist/components/parameters/common/hook/use-tabs.d.ts +13 -0
- package/dist/components/parameters/common/hook/use-tabs.js +60 -0
- package/dist/components/parameters/common/index.d.ts +1 -0
- package/dist/components/parameters/common/index.js +7 -3
- package/dist/components/parameters/common/parameter-field.js +4 -0
- package/dist/components/parameters/common/parameter-table/table-cell.js +1 -1
- package/dist/components/parameters/common/parameter-table-field/constants.d.ts +10 -0
- package/dist/components/parameters/common/parameter-table-field/constants.js +10 -0
- package/dist/components/parameters/common/{parameter-table → parameter-table-field}/index.d.ts +2 -3
- package/dist/components/parameters/common/parameter-table-field/index.js +9 -0
- package/dist/components/parameters/common/parameter-table-field/parameter-table-field.d.ts +11 -0
- package/dist/components/parameters/common/parameter-table-field/parameter-table-field.js +121 -0
- package/dist/components/parameters/common/parameters-edition-dialog-props.d.ts +1 -1
- package/dist/components/parameters/common/utils.d.ts +2 -15
- package/dist/components/parameters/common/utils.js +1 -40
- package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.d.ts +4 -3
- package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +21 -12
- package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +11 -6
- package/dist/components/parameters/dynamic-margin-calculation/loads-variations-parameters.js +9 -7
- package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.d.ts +1 -3
- package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js +11 -54
- package/dist/components/parameters/dynamic-security-analysis/contingency-parameters.js +16 -7
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +11 -6
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.d.ts +4 -3
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +43 -40
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis.type.d.ts +10 -0
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis.type.js +8 -0
- package/dist/components/parameters/dynamic-security-analysis/scenario-parameters.js +15 -6
- package/dist/components/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.d.ts +1 -6
- package/dist/components/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js +21 -96
- package/dist/components/parameters/dynamic-simulation/curve/common/checkbox-select.d.ts +15 -0
- package/dist/components/parameters/dynamic-simulation/curve/common/checkbox-select.js +83 -0
- package/dist/components/parameters/dynamic-simulation/curve/common/checkbox-treeview.d.ts +22 -0
- package/dist/components/parameters/dynamic-simulation/curve/common/checkbox-treeview.js +163 -0
- package/dist/components/parameters/dynamic-simulation/curve/common/curve.type.d.ts +14 -0
- package/dist/components/parameters/dynamic-simulation/curve/common/curve.type.js +1 -0
- package/dist/components/parameters/dynamic-simulation/curve/common/grid-buttons.d.ts +8 -0
- package/dist/components/parameters/dynamic-simulation/curve/common/grid-buttons.js +39 -0
- package/dist/components/parameters/dynamic-simulation/curve/common/grid-search.d.ts +8 -0
- package/dist/components/parameters/dynamic-simulation/curve/common/grid-search.js +60 -0
- package/dist/components/parameters/dynamic-simulation/curve/curve-parameters-constants.d.ts +11 -0
- package/dist/components/parameters/dynamic-simulation/curve/curve-parameters-constants.js +9 -0
- package/dist/components/parameters/dynamic-simulation/curve/curve-parameters-utils.d.ts +12 -0
- package/dist/components/parameters/dynamic-simulation/curve/curve-parameters-utils.js +18 -0
- package/dist/components/parameters/dynamic-simulation/curve/curve-parameters.d.ts +11 -0
- package/dist/components/parameters/dynamic-simulation/curve/curve-parameters.js +177 -0
- package/dist/components/parameters/dynamic-simulation/curve/curve-parameters.type.d.ts +6 -0
- package/dist/components/parameters/dynamic-simulation/curve/curve-parameters.type.js +1 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/curve-preview.d.ts +8 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/curve-preview.js +123 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/curve-selector-dialog.d.ts +15 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/curve-selector-dialog.js +126 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/curve-selector-utils.d.ts +20 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/curve-selector-utils.js +283 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/curve-selector.d.ts +16 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/curve-selector.js +96 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/equipment-filter.d.ts +14 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/equipment-filter.js +239 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/model-filter-utils.d.ts +3 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/model-filter-utils.js +68 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/model-filter.d.ts +12 -0
- package/dist/components/parameters/dynamic-simulation/curve/dialog/model-filter.js +148 -0
- package/dist/components/parameters/dynamic-simulation/dynamic-simulation-inline.d.ts +15 -0
- package/dist/components/parameters/dynamic-simulation/dynamic-simulation-inline.js +193 -0
- package/dist/components/parameters/dynamic-simulation/dynamic-simulation-parameters-form.d.ts +15 -0
- package/dist/components/parameters/dynamic-simulation/dynamic-simulation-parameters-form.js +155 -0
- package/dist/components/parameters/dynamic-simulation/dynamic-simulation.type.d.ts +13 -0
- package/dist/components/parameters/dynamic-simulation/dynamic-simulation.type.js +11 -0
- package/dist/components/parameters/dynamic-simulation/hook/use-default-params.d.ts +4 -0
- package/dist/components/parameters/dynamic-simulation/hook/use-default-params.js +22 -0
- package/dist/components/parameters/dynamic-simulation/index.d.ts +7 -0
- package/dist/components/parameters/dynamic-simulation/index.js +4 -0
- package/dist/components/parameters/dynamic-simulation/mapping/index.d.ts +9 -0
- package/dist/components/parameters/dynamic-simulation/mapping/index.js +9 -0
- package/dist/components/parameters/dynamic-simulation/mapping/mapping-parameters-constants.d.ts +7 -0
- package/dist/components/parameters/dynamic-simulation/mapping/mapping-parameters-constants.js +4 -0
- package/dist/components/parameters/dynamic-simulation/mapping/mapping-parameters-utils.d.ts +9 -0
- package/dist/components/parameters/dynamic-simulation/mapping/mapping-parameters-utils.js +13 -0
- package/dist/components/parameters/dynamic-simulation/mapping/mapping-parameters.d.ts +5 -0
- package/dist/components/parameters/dynamic-simulation/mapping/mapping-parameters.js +52 -0
- package/dist/components/parameters/dynamic-simulation/network/index.d.ts +9 -0
- package/dist/components/parameters/dynamic-simulation/network/index.js +10 -0
- package/dist/components/parameters/dynamic-simulation/network/network-parameters-constants.d.ts +29 -0
- package/dist/components/parameters/dynamic-simulation/network/network-parameters-constants.js +28 -0
- package/dist/components/parameters/dynamic-simulation/network/network-parameters-utils.d.ts +66 -0
- package/dist/components/parameters/dynamic-simulation/network/network-parameters-utils.js +51 -0
- package/dist/components/parameters/dynamic-simulation/network/network-parameters.d.ts +3 -0
- package/dist/components/parameters/dynamic-simulation/network/network-parameters.js +120 -0
- package/dist/components/parameters/dynamic-simulation/solver/common-solver/common-solver-parameters-constants.d.ts +31 -0
- package/dist/components/parameters/dynamic-simulation/solver/common-solver/common-solver-parameters-constants.js +29 -0
- package/dist/components/parameters/dynamic-simulation/solver/common-solver/common-solver-parameters-utils.d.ts +26 -0
- package/dist/components/parameters/dynamic-simulation/solver/common-solver/common-solver-parameters-utils.js +33 -0
- package/dist/components/parameters/dynamic-simulation/solver/common-solver/common-solver-parameters.d.ts +3 -0
- package/dist/components/parameters/dynamic-simulation/solver/common-solver/common-solver-parameters.js +134 -0
- package/dist/components/parameters/dynamic-simulation/solver/common-solver/index.d.ts +9 -0
- package/dist/components/parameters/dynamic-simulation/solver/common-solver/index.js +8 -0
- package/dist/components/parameters/dynamic-simulation/solver/ida-solver/ida-solver-parameters-constants.d.ts +14 -0
- package/dist/components/parameters/dynamic-simulation/solver/ida-solver/ida-solver-parameters-constants.js +12 -0
- package/dist/components/parameters/dynamic-simulation/solver/ida-solver/ida-solver-parameters-utils.d.ts +62 -0
- package/dist/components/parameters/dynamic-simulation/solver/ida-solver/ida-solver-parameters-utils.js +17 -0
- package/dist/components/parameters/dynamic-simulation/solver/ida-solver/ida-solver-parameters.d.ts +3 -0
- package/dist/components/parameters/dynamic-simulation/solver/ida-solver/ida-solver-parameters.js +53 -0
- package/dist/components/parameters/dynamic-simulation/solver/ida-solver/index.d.ts +9 -0
- package/dist/components/parameters/dynamic-simulation/solver/ida-solver/index.js +8 -0
- package/dist/components/parameters/dynamic-simulation/solver/index.d.ts +9 -0
- package/dist/components/parameters/dynamic-simulation/solver/index.js +9 -0
- package/dist/components/parameters/dynamic-simulation/solver/sim-solver/index.d.ts +9 -0
- package/dist/components/parameters/dynamic-simulation/solver/sim-solver/index.js +8 -0
- package/dist/components/parameters/dynamic-simulation/solver/sim-solver/simplified-solver-parameters-constant.d.ts +26 -0
- package/dist/components/parameters/dynamic-simulation/solver/sim-solver/simplified-solver-parameters-constant.js +24 -0
- package/dist/components/parameters/dynamic-simulation/solver/sim-solver/simplified-solver-parameters-utils.d.ts +86 -0
- package/dist/components/parameters/dynamic-simulation/solver/sim-solver/simplified-solver-parameters-utils.js +31 -0
- package/dist/components/parameters/dynamic-simulation/solver/sim-solver/simplified-solver-parameters.d.ts +3 -0
- package/dist/components/parameters/dynamic-simulation/solver/sim-solver/simplified-solver-parameters.js +113 -0
- package/dist/components/parameters/dynamic-simulation/solver/solver-parameters-constants.d.ts +10 -0
- package/dist/components/parameters/dynamic-simulation/solver/solver-parameters-constants.js +8 -0
- package/dist/components/parameters/dynamic-simulation/solver/solver-parameters-utils.d.ts +12 -0
- package/dist/components/parameters/dynamic-simulation/solver/solver-parameters-utils.js +38 -0
- package/dist/components/parameters/dynamic-simulation/solver/solver-parameters.d.ts +5 -0
- package/dist/components/parameters/dynamic-simulation/solver/solver-parameters.js +52 -0
- package/dist/components/parameters/dynamic-simulation/time-delay/index.d.ts +9 -0
- package/dist/components/parameters/dynamic-simulation/time-delay/index.js +9 -0
- package/dist/components/parameters/dynamic-simulation/time-delay/time-delay-parameters-constants.d.ts +10 -0
- package/dist/components/parameters/dynamic-simulation/time-delay/time-delay-parameters-constants.js +8 -0
- package/dist/components/parameters/dynamic-simulation/time-delay/time-delay-parameters-utils.d.ts +12 -0
- package/dist/components/parameters/dynamic-simulation/time-delay/time-delay-parameters-utils.js +21 -0
- package/dist/components/parameters/dynamic-simulation/time-delay/time-delay-parameters.d.ts +3 -0
- package/dist/components/parameters/dynamic-simulation/time-delay/time-delay-parameters.js +30 -0
- package/dist/components/parameters/dynamic-simulation/use-dynamic-simulation-parameters-form.d.ts +13 -0
- package/dist/components/parameters/dynamic-simulation/use-dynamic-simulation-parameters-form.js +124 -0
- package/dist/components/parameters/index.d.ts +2 -1
- package/dist/components/parameters/index.js +12 -11
- package/dist/components/parameters/loadflow/load-flow-general-parameters.js +4 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-content.js +4 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +4 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-header.js +4 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +5 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +4 -0
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +3 -1
- package/dist/components/parameters/network-visualizations/map-parameters.js +4 -0
- package/dist/components/parameters/network-visualizations/network-visualizations-form.js +4 -0
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +5 -1
- package/dist/components/parameters/network-visualizations/single-line-diagram-parameters.js +4 -0
- package/dist/components/parameters/pcc-min/pcc-min-parameters-form.js +4 -0
- package/dist/components/parameters/pcc-min/pcc-min-parameters-inline.js +5 -1
- package/dist/components/parameters/security-analysis/columns-definitions.js +3 -0
- package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.js +5 -2
- package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +7 -4
- package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +4 -0
- package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.js +4 -2
- package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +4 -0
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.d.ts +1 -1
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +7 -3
- package/dist/components/parameters/sensi/columns-definitions.d.ts +7 -180
- package/dist/components/parameters/sensi/columns-definitions.js +83 -73
- package/dist/components/parameters/sensi/index.js +1 -6
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-dialog.js +5 -2
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +6 -2
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.js +4 -0
- package/dist/components/parameters/sensi/sensitivity-parameters-selector.js +54 -51
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.d.ts +2 -2
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +41 -61
- package/dist/components/parameters/sensi/utils.d.ts +4 -4
- package/dist/components/parameters/sensi/utils.js +9 -6
- package/dist/components/parameters/short-circuit/short-circuit-general-tab-panel.js +4 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-content.js +4 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +3 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +5 -1
- package/dist/components/parameters/short-circuit/short-circuit-parameters-utils.js +4 -0
- package/dist/components/parameters/short-circuit/short-circuit-power-electronics-tab-panel.js +4 -0
- package/dist/components/parameters/short-circuit/short-circuit-study-area-tab-panel.js +4 -0
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +2 -0
- package/dist/components/parameters/voltage-init/equipment-selection-parameters.js +4 -0
- package/dist/components/parameters/voltage-init/general-parameters.js +4 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +4 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +5 -1
- package/dist/components/parameters/voltage-init/voltage-limits-parameters.js +17 -31
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.js +0 -2
- package/dist/index.js +27 -15
- package/dist/services/dynamic-mapping.d.ts +3 -0
- package/dist/services/dynamic-mapping.js +21 -0
- package/dist/services/dynamic-margin-calculation.js +1 -1
- package/dist/services/dynamic-simulation.d.ts +5 -0
- package/dist/services/dynamic-simulation.js +35 -0
- package/dist/services/index.d.ts +3 -1
- package/dist/services/index.js +8 -1
- package/dist/translations/en/parameters.d.ts +101 -2
- package/dist/translations/en/parameters.js +115 -2
- package/dist/translations/fr/parameters.d.ts +101 -2
- package/dist/translations/fr/parameters.js +115 -2
- package/dist/translations/not-intl/aggrid-locales.d.ts +8 -0
- package/dist/translations/not-intl/aggrid-locales.js +12 -0
- package/dist/utils/directory-utils.d.ts +2 -0
- package/dist/utils/directory-utils.js +11 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +8 -1
- package/dist/utils/types/dynamic-simulation.type.d.ts +14 -24
- package/dist/utils/types/elementType.d.ts +2 -1
- package/dist/utils/types/elementType.js +2 -1
- package/dist/utils/types/equipmentType.d.ts +9 -0
- package/dist/utils/types/equipmentType.js +52 -0
- package/dist/utils/types/index.js +6 -1
- package/dist/utils/types/parameters.type.d.ts +2 -2
- package/dist/utils/types/types.d.ts +11 -0
- package/package.json +3 -1
- package/dist/components/parameters/common/parameter-dnd-table-field.d.ts +0 -9
- package/dist/components/parameters/common/parameter-dnd-table-field.js +0 -86
- package/dist/components/parameters/common/parameter-table/index.js +0 -10
- package/dist/components/parameters/util/make-component-utils.d.ts +0 -17
- package/dist/components/parameters/util/make-component-utils.js +0 -97
- package/dist/components/parameters/util/styles.d.ts +0 -38
- package/dist/components/parameters/util/styles.js +0 -41
- package/dist/hooks/use-create-row-data.d.ts +0 -4
- package/dist/hooks/use-create-row-data.js +0 -19
- /package/dist/components/parameters/sensi/{sensitivity-Flow-parameters.d.ts → sensitivity-parameters-fields.d.ts} +0 -0
- /package/dist/components/parameters/sensi/{sensitivity-Flow-parameters.js → sensitivity-parameters-fields.js} +0 -0
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Grid } from "@mui/material";
|
|
3
|
-
import { TYPES, makeComponents } from "../util/make-component-utils.js";
|
|
4
3
|
import { SCENARIO_DURATION } from "./constants.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import "../../../utils/conversionUtils.js";
|
|
5
|
+
import "../../../utils/types/equipmentType.js";
|
|
6
|
+
import { ParameterType } from "../../../utils/types/parameters.type.js";
|
|
7
|
+
import "@mui/icons-material";
|
|
8
|
+
import "../../../utils/yupConfig.js";
|
|
9
|
+
import ParameterField from "../common/parameter-field.js";
|
|
10
|
+
const params = [
|
|
11
|
+
{
|
|
12
|
+
name: SCENARIO_DURATION,
|
|
13
|
+
type: ParameterType.DOUBLE,
|
|
8
14
|
label: "DynamicSecurityAnalysisScenarioDuration"
|
|
9
15
|
}
|
|
10
|
-
|
|
16
|
+
];
|
|
11
17
|
function ScenarioParameters({ path }) {
|
|
12
|
-
return /* @__PURE__ */ jsx(Grid, {
|
|
18
|
+
return /* @__PURE__ */ jsx(Grid, { container: true, children: params.map((param) => {
|
|
19
|
+
const { name, type, ...otherParams } = param;
|
|
20
|
+
return /* @__PURE__ */ jsx(ParameterField, { id: path, name: param.name, type: param.type, ...otherParams }, param.name);
|
|
21
|
+
}) });
|
|
13
22
|
}
|
|
14
23
|
export {
|
|
15
24
|
ScenarioParameters as default
|
|
@@ -2,10 +2,6 @@ import { FieldValues } from 'react-hook-form';
|
|
|
2
2
|
import { default as yup } from '../../../utils/yupConfig';
|
|
3
3
|
import { DynamicSecurityAnalysisParametersFetchReturn, DynamicSecurityAnalysisParametersInfos } from '../../../utils';
|
|
4
4
|
import { UseComputationParametersFormReturn } from '../common/utils';
|
|
5
|
-
export declare enum TabValues {
|
|
6
|
-
SCENARIO = "scenario",
|
|
7
|
-
CONTINGENCY = "contingency"
|
|
8
|
-
}
|
|
9
5
|
export declare const formSchema: yup.ObjectSchema<{
|
|
10
6
|
provider: string;
|
|
11
7
|
scenario: {
|
|
@@ -40,12 +36,11 @@ export declare const emptyFormData: {
|
|
|
40
36
|
};
|
|
41
37
|
export declare const toFormValues: (_params: DynamicSecurityAnalysisParametersFetchReturn) => FieldValues;
|
|
42
38
|
export declare const toParamsInfos: (_formData: FieldValues) => DynamicSecurityAnalysisParametersFetchReturn;
|
|
43
|
-
export type UseDynamicSecurityAnalysisParametersFormReturn = UseComputationParametersFormReturn<TabValues>;
|
|
44
39
|
type UseDynamicSecurityAnalysisParametersFormProps = {
|
|
45
40
|
providers: Record<string, string>;
|
|
46
41
|
params: DynamicSecurityAnalysisParametersInfos | null;
|
|
47
42
|
name: string | null;
|
|
48
43
|
description: string | null;
|
|
49
44
|
};
|
|
50
|
-
export declare function useDynamicSecurityAnalysisParametersForm(
|
|
45
|
+
export declare function useDynamicSecurityAnalysisParametersForm(props: Readonly<UseDynamicSecurityAnalysisParametersFormProps>): UseComputationParametersFormReturn;
|
|
51
46
|
export {};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { useForm } from "react-hook-form";
|
|
2
|
-
import { useMemo, useEffect } from "react";
|
|
3
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
4
1
|
import "../../../utils/yupConfig.js";
|
|
5
2
|
import { ID } from "../../../utils/constants/filterConstant.js";
|
|
6
3
|
import "../../../utils/conversionUtils.js";
|
|
@@ -10,10 +7,12 @@ import "@mui/icons-material";
|
|
|
10
7
|
import { PROVIDER } from "../common/constants.js";
|
|
11
8
|
import "@mui/material";
|
|
12
9
|
import "react-intl";
|
|
10
|
+
import "react";
|
|
13
11
|
import "localized-countries";
|
|
14
12
|
import "localized-countries/data/fr";
|
|
15
13
|
import "localized-countries/data/en";
|
|
16
14
|
import "notistack";
|
|
15
|
+
import "react-hook-form";
|
|
17
16
|
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
18
17
|
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
19
18
|
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
@@ -40,16 +39,12 @@ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
|
40
39
|
import "react-querybuilder";
|
|
41
40
|
import "../common/widget/parameter-line-slider.js";
|
|
42
41
|
import "../common/limitreductions/columns-definitions.js";
|
|
42
|
+
import "react-dom";
|
|
43
|
+
import "@hello-pangea/dnd";
|
|
43
44
|
import "../common/contingency-table/columns-definitions.js";
|
|
44
|
-
import "
|
|
45
|
-
import { getNameElementEditorSchema, getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
|
|
45
|
+
import { useParametersForm } from "../common/hook/use-parameters-form.js";
|
|
46
46
|
import { SCENARIO_DURATION, CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME } from "./constants.js";
|
|
47
|
-
import {
|
|
48
|
-
var TabValues = /* @__PURE__ */ ((TabValues2) => {
|
|
49
|
-
TabValues2["SCENARIO"] = "scenario";
|
|
50
|
-
TabValues2["CONTINGENCY"] = "contingency";
|
|
51
|
-
return TabValues2;
|
|
52
|
-
})(TabValues || {});
|
|
47
|
+
import { TabValues } from "./dynamic-security-analysis.type.js";
|
|
53
48
|
const scenarioFormSchema = yup.object().shape({
|
|
54
49
|
[SCENARIO_DURATION]: yup.number().required()
|
|
55
50
|
}).required();
|
|
@@ -64,14 +59,8 @@ const contingencyFormSchema = yup.object().shape({
|
|
|
64
59
|
});
|
|
65
60
|
const formSchema = yup.object().shape({
|
|
66
61
|
[PROVIDER]: yup.string().required(),
|
|
67
|
-
[
|
|
68
|
-
|
|
69
|
-
/* SCENARIO */
|
|
70
|
-
]: scenarioFormSchema,
|
|
71
|
-
[
|
|
72
|
-
"contingency"
|
|
73
|
-
/* CONTINGENCY */
|
|
74
|
-
]: contingencyFormSchema
|
|
62
|
+
[TabValues.SCENARIO]: scenarioFormSchema,
|
|
63
|
+
[TabValues.CONTINGENCY]: contingencyFormSchema
|
|
75
64
|
});
|
|
76
65
|
const scenarioEmptyFormData = {
|
|
77
66
|
[SCENARIO_DURATION]: 0
|
|
@@ -82,98 +71,34 @@ const contingencyEmptyFormData = {
|
|
|
82
71
|
};
|
|
83
72
|
const emptyFormData = {
|
|
84
73
|
[PROVIDER]: "",
|
|
85
|
-
[
|
|
86
|
-
|
|
87
|
-
/* SCENARIO */
|
|
88
|
-
]: { ...scenarioEmptyFormData },
|
|
89
|
-
[
|
|
90
|
-
"contingency"
|
|
91
|
-
/* CONTINGENCY */
|
|
92
|
-
]: { ...contingencyEmptyFormData }
|
|
74
|
+
[TabValues.SCENARIO]: { ...scenarioEmptyFormData },
|
|
75
|
+
[TabValues.CONTINGENCY]: { ...contingencyEmptyFormData }
|
|
93
76
|
};
|
|
94
77
|
const toFormValues = (_params) => ({
|
|
95
78
|
[PROVIDER]: _params.provider,
|
|
96
|
-
[
|
|
97
|
-
"scenario"
|
|
98
|
-
/* SCENARIO */
|
|
99
|
-
]: {
|
|
79
|
+
[TabValues.SCENARIO]: {
|
|
100
80
|
[SCENARIO_DURATION]: _params.scenarioDuration
|
|
101
81
|
},
|
|
102
|
-
[
|
|
103
|
-
"contingency"
|
|
104
|
-
/* CONTINGENCY */
|
|
105
|
-
]: {
|
|
82
|
+
[TabValues.CONTINGENCY]: {
|
|
106
83
|
[CONTINGENCIES_START_TIME]: _params.contingenciesStartTime,
|
|
107
84
|
[CONTINGENCIES_LIST_INFOS]: _params.contingencyListInfos
|
|
108
85
|
}
|
|
109
86
|
});
|
|
110
87
|
const toParamsInfos = (_formData) => ({
|
|
111
88
|
provider: _formData[PROVIDER],
|
|
112
|
-
scenarioDuration: _formData[
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
][SCENARIO_DURATION],
|
|
116
|
-
contingenciesStartTime: _formData[
|
|
117
|
-
"contingency"
|
|
118
|
-
/* CONTINGENCY */
|
|
119
|
-
][CONTINGENCIES_START_TIME],
|
|
120
|
-
contingencyListInfos: _formData[
|
|
121
|
-
"contingency"
|
|
122
|
-
/* CONTINGENCY */
|
|
123
|
-
][CONTINGENCIES_LIST_INFOS]
|
|
89
|
+
scenarioDuration: _formData[TabValues.SCENARIO][SCENARIO_DURATION],
|
|
90
|
+
contingenciesStartTime: _formData[TabValues.CONTINGENCY][CONTINGENCIES_START_TIME],
|
|
91
|
+
contingencyListInfos: _formData[TabValues.CONTINGENCY][CONTINGENCIES_LIST_INFOS]
|
|
124
92
|
});
|
|
125
|
-
function useDynamicSecurityAnalysisParametersForm({
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const paramsLoaded = useMemo(() => !!params, [params]);
|
|
132
|
-
const formattedProviders = useMemo(
|
|
133
|
-
() => Object.entries(providers).map(([key, value]) => ({
|
|
134
|
-
id: key,
|
|
135
|
-
label: value
|
|
136
|
-
})),
|
|
137
|
-
[providers]
|
|
138
|
-
);
|
|
139
|
-
const returnFormSchema = useMemo(() => {
|
|
140
|
-
return initialName === null ? formSchema : formSchema.concat(getNameElementEditorSchema(initialName));
|
|
141
|
-
}, [initialName]);
|
|
142
|
-
const newEmptyFormData = useMemo(() => {
|
|
143
|
-
return {
|
|
144
|
-
...initialName === null ? {} : getNameElementEditorEmptyFormData(initialName, initialDescription),
|
|
145
|
-
...emptyFormData
|
|
146
|
-
};
|
|
147
|
-
}, [initialName, initialDescription]);
|
|
148
|
-
const returnFormMethods = useForm({
|
|
149
|
-
defaultValues: newEmptyFormData,
|
|
150
|
-
resolver: yupResolver(returnFormSchema)
|
|
93
|
+
function useDynamicSecurityAnalysisParametersForm(props) {
|
|
94
|
+
return useParametersForm({
|
|
95
|
+
...props,
|
|
96
|
+
formSchema,
|
|
97
|
+
emptyFormData,
|
|
98
|
+
toFormValues
|
|
151
99
|
});
|
|
152
|
-
const { reset } = returnFormMethods;
|
|
153
|
-
useEffect(() => {
|
|
154
|
-
if (params) {
|
|
155
|
-
console.log("xxx Resetting form with params:", params);
|
|
156
|
-
reset(toFormValues(params));
|
|
157
|
-
}
|
|
158
|
-
}, [params, paramsLoaded, reset]);
|
|
159
|
-
const { selectedTab, tabsWithError, onTabChange, onError } = useTabs({
|
|
160
|
-
defaultTab: "scenario",
|
|
161
|
-
tabEnum: TabValues
|
|
162
|
-
});
|
|
163
|
-
return {
|
|
164
|
-
formMethods: returnFormMethods,
|
|
165
|
-
formSchema: returnFormSchema,
|
|
166
|
-
paramsLoaded,
|
|
167
|
-
formattedProviders,
|
|
168
|
-
/* tab-related handling */
|
|
169
|
-
selectedTab,
|
|
170
|
-
tabsWithError,
|
|
171
|
-
onTabChange,
|
|
172
|
-
onError
|
|
173
|
-
};
|
|
174
100
|
}
|
|
175
101
|
export {
|
|
176
|
-
TabValues,
|
|
177
102
|
emptyFormData,
|
|
178
103
|
formSchema,
|
|
179
104
|
toFormValues,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
interface CheckBoxSelectProps {
|
|
8
|
+
options: string[];
|
|
9
|
+
getOptionLabel: (label: string) => string;
|
|
10
|
+
onChange: (newSelectedOption: string[]) => void;
|
|
11
|
+
value: string[];
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare function CheckboxSelect({ options, getOptionLabel, onChange, value: initialSelectedOptions, disabled, }: Readonly<CheckBoxSelectProps>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default CheckboxSelect;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Select, MenuItem, ListItemText, Checkbox } from "@mui/material";
|
|
3
|
+
import { useState, useCallback } from "react";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
const ITEM_HEIGHT = 48;
|
|
6
|
+
const ITEM_PADDING_TOP = 8;
|
|
7
|
+
const MenuProps = {
|
|
8
|
+
PaperProps: {
|
|
9
|
+
style: {
|
|
10
|
+
maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP,
|
|
11
|
+
maxWidth: "200"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const CHECK_ALL = { label: "SelectAll", value: "check_all" };
|
|
16
|
+
const UNCHECK_ALL = { label: "UnselectAll", value: "uncheck_all" };
|
|
17
|
+
function CheckboxSelect({
|
|
18
|
+
options,
|
|
19
|
+
getOptionLabel,
|
|
20
|
+
onChange,
|
|
21
|
+
value: initialSelectedOptions,
|
|
22
|
+
disabled
|
|
23
|
+
}) {
|
|
24
|
+
const intl = useIntl();
|
|
25
|
+
const [selectedOptions, setSelectedOptions] = useState(initialSelectedOptions ?? []);
|
|
26
|
+
const [prevInitialSelectedOptions, setPrevInitialSelectedOptions] = useState(initialSelectedOptions);
|
|
27
|
+
if (initialSelectedOptions !== prevInitialSelectedOptions) {
|
|
28
|
+
setPrevInitialSelectedOptions(initialSelectedOptions);
|
|
29
|
+
setSelectedOptions(initialSelectedOptions);
|
|
30
|
+
}
|
|
31
|
+
const handleChange = useCallback(
|
|
32
|
+
(event) => {
|
|
33
|
+
const {
|
|
34
|
+
target: { value: eventValue }
|
|
35
|
+
} = event;
|
|
36
|
+
const values = Array.isArray(eventValue) ? eventValue : [eventValue];
|
|
37
|
+
let newSelectedOptions;
|
|
38
|
+
if (values.includes(CHECK_ALL.value)) {
|
|
39
|
+
newSelectedOptions = options;
|
|
40
|
+
} else if (values.includes(UNCHECK_ALL.value)) {
|
|
41
|
+
newSelectedOptions = [];
|
|
42
|
+
} else {
|
|
43
|
+
newSelectedOptions = values;
|
|
44
|
+
}
|
|
45
|
+
setSelectedOptions(newSelectedOptions);
|
|
46
|
+
onChange?.(newSelectedOptions);
|
|
47
|
+
},
|
|
48
|
+
[options, onChange]
|
|
49
|
+
);
|
|
50
|
+
return /* @__PURE__ */ jsxs(
|
|
51
|
+
Select,
|
|
52
|
+
{
|
|
53
|
+
id: "multiple-checkbox",
|
|
54
|
+
size: "small",
|
|
55
|
+
multiple: true,
|
|
56
|
+
value: selectedOptions,
|
|
57
|
+
onChange: handleChange,
|
|
58
|
+
renderValue: (_selectedOptions) => {
|
|
59
|
+
if (_selectedOptions.length === 1) {
|
|
60
|
+
return getOptionLabel(_selectedOptions[0]);
|
|
61
|
+
}
|
|
62
|
+
if (_selectedOptions.length > 1) {
|
|
63
|
+
return `${getOptionLabel(_selectedOptions.at(-1) ?? "")} (+${_selectedOptions.length - 1})`;
|
|
64
|
+
}
|
|
65
|
+
return "";
|
|
66
|
+
},
|
|
67
|
+
MenuProps,
|
|
68
|
+
sx: { width: "100%" },
|
|
69
|
+
disabled,
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx(MenuItem, { value: CHECK_ALL.value, children: /* @__PURE__ */ jsx(ListItemText, { primary: intl.formatMessage({ id: CHECK_ALL.label }) }) }, CHECK_ALL.value),
|
|
72
|
+
/* @__PURE__ */ jsx(MenuItem, { value: UNCHECK_ALL.value, children: /* @__PURE__ */ jsx(ListItemText, { primary: intl.formatMessage({ id: UNCHECK_ALL.label }) }) }, UNCHECK_ALL.value),
|
|
73
|
+
options.map((option) => /* @__PURE__ */ jsxs(MenuItem, { value: option, children: [
|
|
74
|
+
/* @__PURE__ */ jsx(Checkbox, { checked: selectedOptions.includes(option) }),
|
|
75
|
+
/* @__PURE__ */ jsx(ListItemText, { children: getOptionLabel(option) })
|
|
76
|
+
] }, option))
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
CheckboxSelect as default
|
|
83
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { SxProps } from '@mui/material';
|
|
3
|
+
export type ItemData = {
|
|
4
|
+
id: string;
|
|
5
|
+
parentId?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
};
|
|
8
|
+
export type CheckboxTreeviewApi<TData extends ItemData = ItemData> = {
|
|
9
|
+
getSelectedItems: () => TData[];
|
|
10
|
+
};
|
|
11
|
+
type CheckBoxTreeViewProps<TData extends ItemData = ItemData> = {
|
|
12
|
+
data: TData[];
|
|
13
|
+
checkAll: boolean;
|
|
14
|
+
onSelectionChanged?: (newSelection: TData[]) => void;
|
|
15
|
+
getLabel: (element: TData) => string;
|
|
16
|
+
sx?: SxProps;
|
|
17
|
+
};
|
|
18
|
+
declare function CheckboxTreeview<TData extends ItemData>({ data: items, checkAll, onSelectionChanged, getLabel, sx }: Readonly<CheckBoxTreeViewProps<TData>>, ref: Ref<CheckboxTreeviewApi<TData>>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare const _default: <TData extends ItemData>(props: CheckBoxTreeViewProps<TData> & {
|
|
20
|
+
ref?: Ref<CheckboxTreeviewApi<TData>>;
|
|
21
|
+
}) => ReturnType<typeof CheckboxTreeview>;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo, useState, useEffect, useCallback, useImperativeHandle } from "react";
|
|
3
|
+
import { styled, alpha, useTheme, Checkbox } from "@mui/material";
|
|
4
|
+
import { TreeItem, treeItemClasses, SimpleTreeView } from "@mui/x-tree-view";
|
|
5
|
+
const BorderedTreeItem = styled(TreeItem)(({ theme, root }) => {
|
|
6
|
+
const border = `1px dashed ${alpha(theme.palette.text.primary, 0.4)}`;
|
|
7
|
+
return {
|
|
8
|
+
position: "relative",
|
|
9
|
+
"&:before": {
|
|
10
|
+
pointerEvents: "none",
|
|
11
|
+
content: '""',
|
|
12
|
+
position: "absolute",
|
|
13
|
+
width: 16,
|
|
14
|
+
left: -16,
|
|
15
|
+
top: 20,
|
|
16
|
+
borderBottom: root ? "none" : border
|
|
17
|
+
},
|
|
18
|
+
[`& .${treeItemClasses.groupTransition}`]: {
|
|
19
|
+
marginLeft: 15,
|
|
20
|
+
paddingLeft: 18,
|
|
21
|
+
borderLeft: border
|
|
22
|
+
},
|
|
23
|
+
[`& .${treeItemClasses.content}`]: {
|
|
24
|
+
paddingLeft: 8,
|
|
25
|
+
width: "max-content"
|
|
26
|
+
},
|
|
27
|
+
[`& .${treeItemClasses.label}`]: {
|
|
28
|
+
whiteSpace: "nowrap"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
function CheckboxTreeview({ data: items, checkAll, onSelectionChanged, getLabel, sx }, ref) {
|
|
33
|
+
const theme = useTheme();
|
|
34
|
+
const initialItemStates = useMemo(
|
|
35
|
+
() => Object.fromEntries(items.map((elem) => [
|
|
36
|
+
elem.id,
|
|
37
|
+
checkAll ? "CHECKED" : "UNCHECKED"
|
|
38
|
+
/* UNCHECKED */
|
|
39
|
+
])),
|
|
40
|
+
[items, checkAll]
|
|
41
|
+
);
|
|
42
|
+
const [itemStates, setItemStates] = useState(initialItemStates);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setItemStates(initialItemStates);
|
|
45
|
+
}, [initialItemStates]);
|
|
46
|
+
const updateItemState = useCallback(
|
|
47
|
+
(_itemStates, _items, onClickedId) => {
|
|
48
|
+
const updateStateParent = (__itemStates, __items, childId) => {
|
|
49
|
+
const child = __items.find((elem) => elem.id === childId);
|
|
50
|
+
const parent = __items.find((elem) => elem.id === child?.parentId);
|
|
51
|
+
if (!parent) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const childrenIds = __items.filter((elem) => elem.parentId === parent.id).map((elem) => elem.id);
|
|
55
|
+
const childrenStates = childrenIds.map((id) => __itemStates[id]);
|
|
56
|
+
__itemStates[parent.id] = "INDETERMINATE";
|
|
57
|
+
if (childrenStates.every(
|
|
58
|
+
(state) => state === "CHECKED"
|
|
59
|
+
/* CHECKED */
|
|
60
|
+
)) {
|
|
61
|
+
__itemStates[parent.id] = "CHECKED";
|
|
62
|
+
}
|
|
63
|
+
if (childrenStates.every(
|
|
64
|
+
(state) => state === "UNCHECKED"
|
|
65
|
+
/* UNCHECKED */
|
|
66
|
+
)) {
|
|
67
|
+
__itemStates[parent.id] = "UNCHECKED";
|
|
68
|
+
}
|
|
69
|
+
updateStateParent(__itemStates, __items, parent.id);
|
|
70
|
+
};
|
|
71
|
+
const setState = (__itemStates, __items, id, newState) => {
|
|
72
|
+
__itemStates[id] = newState;
|
|
73
|
+
const children = __items.filter((elem) => elem.parentId === id);
|
|
74
|
+
children.forEach((elem) => setState(__itemStates, __items, elem.id, newState));
|
|
75
|
+
updateStateParent(__itemStates, __items, id);
|
|
76
|
+
};
|
|
77
|
+
const newItemStates = { ..._itemStates };
|
|
78
|
+
const currentState = _itemStates[onClickedId];
|
|
79
|
+
setState(
|
|
80
|
+
newItemStates,
|
|
81
|
+
_items,
|
|
82
|
+
onClickedId,
|
|
83
|
+
currentState === "CHECKED" ? "UNCHECKED" : "CHECKED"
|
|
84
|
+
/* CHECKED */
|
|
85
|
+
);
|
|
86
|
+
return newItemStates;
|
|
87
|
+
},
|
|
88
|
+
[]
|
|
89
|
+
);
|
|
90
|
+
const handleItemSelect = useCallback(
|
|
91
|
+
(event, id) => {
|
|
92
|
+
event.stopPropagation();
|
|
93
|
+
const newItemStates = updateItemState(itemStates, items, id);
|
|
94
|
+
setItemStates(newItemStates);
|
|
95
|
+
if (onSelectionChanged) {
|
|
96
|
+
const selectedItems = items.filter(
|
|
97
|
+
(item) => newItemStates[item.id] === "CHECKED" && items.every((elem) => elem.parentId !== item.id)
|
|
98
|
+
// no children
|
|
99
|
+
);
|
|
100
|
+
onSelectionChanged(selectedItems);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
[itemStates, items, updateItemState, onSelectionChanged]
|
|
104
|
+
);
|
|
105
|
+
const handleExpand = useCallback((event) => {
|
|
106
|
+
event.stopPropagation();
|
|
107
|
+
}, []);
|
|
108
|
+
const getSelectedItems = useCallback(() => {
|
|
109
|
+
return items.filter(
|
|
110
|
+
(item) => itemStates[item.id] === "CHECKED" && !items.some((elem) => elem.parentId === item.id)
|
|
111
|
+
// no children
|
|
112
|
+
);
|
|
113
|
+
}, [items, itemStates]);
|
|
114
|
+
useImperativeHandle(
|
|
115
|
+
ref,
|
|
116
|
+
() => ({
|
|
117
|
+
getSelectedItems
|
|
118
|
+
}),
|
|
119
|
+
[getSelectedItems]
|
|
120
|
+
);
|
|
121
|
+
const itemsByParent = useMemo(() => {
|
|
122
|
+
const map = /* @__PURE__ */ new Map();
|
|
123
|
+
items.forEach((item) => {
|
|
124
|
+
const key = item.parentId ?? null;
|
|
125
|
+
if (!map.has(key)) map.set(key, []);
|
|
126
|
+
map.get(key)?.push(item);
|
|
127
|
+
});
|
|
128
|
+
return map;
|
|
129
|
+
}, [items]);
|
|
130
|
+
const renderTree = useCallback(
|
|
131
|
+
(parentId = null) => {
|
|
132
|
+
const itemsToRender = itemsByParent.get(parentId) ?? [];
|
|
133
|
+
return itemsToRender.map((elem) => /* @__PURE__ */ jsx(
|
|
134
|
+
BorderedTreeItem,
|
|
135
|
+
{
|
|
136
|
+
theme,
|
|
137
|
+
itemId: elem.id,
|
|
138
|
+
onClick: handleExpand,
|
|
139
|
+
root: !elem.parentId,
|
|
140
|
+
label: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
141
|
+
/* @__PURE__ */ jsx(
|
|
142
|
+
Checkbox,
|
|
143
|
+
{
|
|
144
|
+
checked: "CHECKED" === itemStates[elem.id],
|
|
145
|
+
indeterminate: "INDETERMINATE" === itemStates[elem.id],
|
|
146
|
+
onClick: (event) => handleItemSelect(event, elem.id)
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
getLabel ? getLabel(elem) : elem.name
|
|
150
|
+
] }),
|
|
151
|
+
children: renderTree(elem.id)
|
|
152
|
+
},
|
|
153
|
+
elem.id
|
|
154
|
+
));
|
|
155
|
+
},
|
|
156
|
+
[itemsByParent, theme, handleExpand, itemStates, getLabel, handleItemSelect]
|
|
157
|
+
);
|
|
158
|
+
return /* @__PURE__ */ jsx(SimpleTreeView, { sx, children: renderTree(null) });
|
|
159
|
+
}
|
|
160
|
+
const CheckboxTreeview$1 = forwardRef(CheckboxTreeview);
|
|
161
|
+
export {
|
|
162
|
+
CheckboxTreeview$1 as default
|
|
163
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EquipmentType } from '../../../../../utils/types/equipmentType';
|
|
2
|
+
import { ItemData } from './checkbox-treeview';
|
|
3
|
+
export type DynamicSimulationModel = {
|
|
4
|
+
name: string;
|
|
5
|
+
equipmentType: EquipmentType;
|
|
6
|
+
};
|
|
7
|
+
export type ModelVariable = ItemData & {
|
|
8
|
+
variableId?: string;
|
|
9
|
+
};
|
|
10
|
+
export type Curve = {
|
|
11
|
+
equipmentType: EquipmentType;
|
|
12
|
+
equipmentId: string;
|
|
13
|
+
variableId?: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface GridButtonsProps {
|
|
2
|
+
onAddButton: () => void;
|
|
3
|
+
onDeleteButton: () => void;
|
|
4
|
+
disabledAdd?: boolean;
|
|
5
|
+
disabledDelete?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function GridButtons({ onAddButton, onDeleteButton, disabledAdd, disabledDelete }: Readonly<GridButtonsProps>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Grid, Tooltip, IconButton } from "@mui/material";
|
|
3
|
+
import { AddCircle, Delete } from "@mui/icons-material";
|
|
4
|
+
import { useCallback } from "react";
|
|
5
|
+
import { useIntl } from "react-intl";
|
|
6
|
+
function GridButtons({ onAddButton, onDeleteButton, disabledAdd, disabledDelete }) {
|
|
7
|
+
const intl = useIntl();
|
|
8
|
+
const handleAddButton = useCallback(() => {
|
|
9
|
+
onAddButton();
|
|
10
|
+
}, [onAddButton]);
|
|
11
|
+
const handleDeleteButton = useCallback(() => {
|
|
12
|
+
onDeleteButton();
|
|
13
|
+
}, [onDeleteButton]);
|
|
14
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, item: true, xs: true, spacing: 1, sx: { justifyContent: "flex-end", alignItems: "flex-end" }, children: [
|
|
15
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
|
|
16
|
+
Tooltip,
|
|
17
|
+
{
|
|
18
|
+
title: intl.formatMessage({
|
|
19
|
+
id: "AddRows"
|
|
20
|
+
}),
|
|
21
|
+
placement: "top",
|
|
22
|
+
children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconButton, { color: "primary", onClick: () => handleAddButton(), disabled: disabledAdd, children: /* @__PURE__ */ jsx(AddCircle, {}) }) })
|
|
23
|
+
}
|
|
24
|
+
) }),
|
|
25
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
|
|
26
|
+
Tooltip,
|
|
27
|
+
{
|
|
28
|
+
title: intl.formatMessage({
|
|
29
|
+
id: "DeleteRows"
|
|
30
|
+
}),
|
|
31
|
+
placement: "top",
|
|
32
|
+
children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconButton, { color: "primary", onClick: () => handleDeleteButton(), disabled: disabledDelete, children: /* @__PURE__ */ jsx(Delete, {}) }) })
|
|
33
|
+
}
|
|
34
|
+
) })
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
GridButtons
|
|
39
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { AgGridReact } from 'ag-grid-react';
|
|
3
|
+
interface GridSearchProps {
|
|
4
|
+
gridRef: RefObject<AgGridReact | null>;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const GridSearch: import('react').ForwardRefExoticComponent<GridSearchProps & import('react').RefAttributes<unknown>>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextField, InputAdornment } from "@mui/material";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
4
|
+
import { forwardRef, useRef, useCallback, useImperativeHandle } from "react";
|
|
5
|
+
import { Search } from "@mui/icons-material";
|
|
6
|
+
const styles = {
|
|
7
|
+
searchSection: (theme) => ({
|
|
8
|
+
paddingRight: theme.spacing(1),
|
|
9
|
+
alignItems: "center"
|
|
10
|
+
})
|
|
11
|
+
};
|
|
12
|
+
const GridSearch = forwardRef(({ gridRef, disabled }, ref) => {
|
|
13
|
+
const intl = useIntl();
|
|
14
|
+
const inputRef = useRef(null);
|
|
15
|
+
const applyQuickFilter = useCallback(
|
|
16
|
+
(filterValue) => {
|
|
17
|
+
gridRef.current?.api?.setGridOption("quickFilterText", filterValue);
|
|
18
|
+
},
|
|
19
|
+
[gridRef]
|
|
20
|
+
);
|
|
21
|
+
const resetFilter = useCallback(() => {
|
|
22
|
+
inputRef.current.value = "";
|
|
23
|
+
applyQuickFilter("");
|
|
24
|
+
}, [applyQuickFilter]);
|
|
25
|
+
const getFilterValue = useCallback(() => {
|
|
26
|
+
return inputRef.current.value;
|
|
27
|
+
}, []);
|
|
28
|
+
useImperativeHandle(ref, () => {
|
|
29
|
+
return {
|
|
30
|
+
resetFilter,
|
|
31
|
+
getFilterValue
|
|
32
|
+
};
|
|
33
|
+
}, [getFilterValue, resetFilter]);
|
|
34
|
+
const handleChangeFilter = useCallback(
|
|
35
|
+
(event) => {
|
|
36
|
+
applyQuickFilter(event.target.value);
|
|
37
|
+
},
|
|
38
|
+
[applyQuickFilter]
|
|
39
|
+
);
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
TextField,
|
|
42
|
+
{
|
|
43
|
+
disabled,
|
|
44
|
+
size: "small",
|
|
45
|
+
placeholder: `${intl.formatMessage({ id: "filter" })}...`,
|
|
46
|
+
onChange: handleChangeFilter,
|
|
47
|
+
inputRef,
|
|
48
|
+
fullWidth: true,
|
|
49
|
+
InputProps: {
|
|
50
|
+
sx: {
|
|
51
|
+
input: styles.searchSection
|
|
52
|
+
},
|
|
53
|
+
startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx(Search, { color: disabled ? "disabled" : "inherit" }) })
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
export {
|
|
59
|
+
GridSearch
|
|
60
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum Curve {
|
|
8
|
+
EQUIPMENT_ID = "equipmentId",
|
|
9
|
+
VARIABLE_ID = "variableId",
|
|
10
|
+
CURVES = "curves"
|
|
11
|
+
}
|