@gridsuite/commons-ui 0.256.0 → 0.258.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/composite/filter/FilterCreationDialog.js +6 -2
- package/dist/components/composite/filter/FilterForm.js +10 -0
- package/dist/components/composite/filter/HeaderFilterForm.d.ts +0 -10
- package/dist/components/composite/filter/HeaderFilterForm.js +7 -16
- package/dist/components/composite/filter/expert/ExpertFilterForm.js +3 -3
- package/dist/components/index.js +8 -0
- package/dist/components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js +2 -1
- package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js +2 -1
- package/dist/components/ui/dialogs/index.d.ts +1 -0
- package/dist/components/ui/dialogs/index.js +8 -0
- package/dist/{features/parameters/common → components/ui/dialogs}/name-element-editor/index.d.ts +2 -1
- package/dist/components/ui/dialogs/name-element-editor/index.js +10 -0
- package/dist/{features/parameters/common → components/ui/dialogs}/name-element-editor/name-element-editor-form.js +5 -5
- package/dist/{features/parameters/common → components/ui/dialogs}/name-element-editor/name-element-editor-utils.d.ts +13 -3
- package/dist/{features/parameters/common → components/ui/dialogs}/name-element-editor/name-element-editor-utils.js +27 -22
- package/dist/components/ui/dialogs/name-element-editor/named-element-edition-dialog.d.ts +17 -0
- package/dist/components/ui/dialogs/name-element-editor/named-element-edition-dialog.js +49 -0
- package/dist/components/ui/index.js +8 -0
- package/dist/features/global-filter/context/global-filter-context-provider.d.ts +2 -0
- package/dist/features/global-filter/context/global-filter-context-provider.js +41 -0
- package/dist/features/global-filter/context/global-filter-context.d.ts +3 -0
- package/dist/features/global-filter/context/global-filter-context.js +13 -0
- package/dist/features/global-filter/context/global-filter-context.type.d.ts +14 -0
- package/dist/features/global-filter/context/global-filter-context.type.js +1 -0
- package/dist/features/global-filter/context/index.d.ts +8 -0
- package/dist/features/global-filter/context/index.js +4 -0
- package/dist/features/global-filter/global-filter.style.d.ts +162 -0
- package/dist/features/global-filter/global-filter.style.js +190 -0
- package/dist/features/global-filter/index.d.ts +10 -0
- package/dist/features/global-filter/index.js +31 -0
- package/dist/features/global-filter/types/global-filter.type.d.ts +51 -0
- package/dist/features/global-filter/types/global-filter.type.js +19 -0
- package/dist/features/global-filter/types/index.d.ts +8 -0
- package/dist/features/global-filter/types/index.js +8 -0
- package/dist/features/global-filter/types/limit-violation.type.d.ts +11 -0
- package/dist/features/global-filter/types/limit-violation.type.js +9 -0
- package/dist/features/global-filter/ui/global-filter-dropdown-panel.d.ts +10 -0
- package/dist/features/global-filter/ui/global-filter-dropdown-panel.js +251 -0
- package/dist/features/global-filter/ui/global-filter-panel.d.ts +9 -0
- package/dist/features/global-filter/ui/global-filter-panel.js +391 -0
- package/dist/features/global-filter/ui/label-with-info-tooltip.d.ts +12 -0
- package/dist/features/global-filter/ui/label-with-info-tooltip.js +24 -0
- package/dist/features/global-filter/ui/selected-global-filters.d.ts +4 -0
- package/dist/features/global-filter/ui/selected-global-filters.js +114 -0
- package/dist/features/global-filter/utils/build-valid-global-filters.d.ts +8 -0
- package/dist/features/global-filter/utils/build-valid-global-filters.js +51 -0
- package/dist/features/global-filter/utils/editing-global-filter-sync.d.ts +9 -0
- package/dist/features/global-filter/utils/editing-global-filter-sync.js +15 -0
- package/dist/features/global-filter/utils/global-filter-state.utils.d.ts +14 -0
- package/dist/features/global-filter/utils/global-filter-state.utils.js +71 -0
- package/dist/features/global-filter/utils/global-filter-sync.utils.d.ts +9 -0
- package/dist/features/global-filter/utils/global-filter-sync.utils.js +26 -0
- package/dist/features/global-filter/utils/global-filter-utils.d.ts +7 -0
- package/dist/features/global-filter/utils/global-filter-utils.js +44 -0
- package/dist/features/global-filter/utils/index.d.ts +11 -0
- package/dist/features/global-filter/utils/index.js +21 -0
- package/dist/features/index.d.ts +1 -0
- package/dist/features/index.js +42 -8
- package/dist/features/network-modification-table/renderers/description-cell.js +4 -0
- package/dist/features/network-modifications/battery/creation/batteryCreation.utils.js +3 -2
- package/dist/features/network-modifications/battery/modification/batteryModification.utils.js +2 -1
- package/dist/features/network-modifications/by-filter/assignment/assignment/assignment-form.js +2 -1
- package/dist/features/network-modifications/by-filter/assignment/assignment/assignment-utils.js +2 -2
- package/dist/features/network-modifications/by-filter/formula/formula/formula-utils.js +5 -5
- package/dist/features/network-modifications/common/activePowerControl/activePowerControlForm.utils.js +2 -1
- package/dist/features/network-modifications/common/connectivity/connectivityForm.utils.js +2 -1
- package/dist/features/network-modifications/common/currentLimits/limitsPane.utils.js +2 -1
- package/dist/features/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js +2 -1
- package/dist/features/network-modifications/common/reactiveLimits/reactiveLimits.utils.js +3 -2
- package/dist/features/network-modifications/common/voltageRegulation/voltageRegulation.utils.js +3 -2
- package/dist/features/network-modifications/generator/creation/generatorCreation.utils.js +4 -3
- package/dist/features/network-modifications/generator/modification/generatorModification.utils.js +5 -4
- package/dist/features/network-modifications/line/characteristics/lineCharacteristicsPane.utils.js +7 -6
- package/dist/features/network-modifications/shunt-compensator/common/characteristicsForm.utils.js +7 -6
- package/dist/features/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +10 -9
- package/dist/features/network-modifications/voltageLevel/modification/voltageLevelModification.utils.js +6 -5
- package/dist/features/parameters/common/hook/use-parameters-form.js +1 -2
- package/dist/features/parameters/common/limitreductions/columns-definitions.js +3 -2
- package/dist/features/parameters/common/parameters-creation-dialog.js +9 -0
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +0 -1
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +0 -1
- package/dist/features/parameters/dynamic-margin-calculation/loads-variations-parameters.js +2 -2
- package/dist/features/parameters/dynamic-security-analysis/contingency-parameters.js +0 -1
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +0 -1
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +0 -1
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation-inline.js +0 -1
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.js +0 -1
- package/dist/features/parameters/dynamic-simulation/mapping/mapping-parameters.js +0 -1
- package/dist/features/parameters/loadflow/load-flow-advanced-parameters.js +0 -1
- package/dist/features/parameters/loadflow/load-flow-general-parameters.js +0 -1
- package/dist/features/parameters/loadflow/load-flow-parameters-content.js +0 -1
- package/dist/features/parameters/loadflow/load-flow-parameters-dialog.js +4 -8
- package/dist/features/parameters/loadflow/load-flow-parameters-header.js +0 -1
- package/dist/features/parameters/loadflow/load-flow-parameters-inline.js +0 -1
- package/dist/features/parameters/loadflow/load-flow-parameters-utils.js +0 -1
- package/dist/features/parameters/loadflow/load-flow-provider-specific-parameters.js +0 -1
- package/dist/features/parameters/loadflow/use-load-flow-parameters-form.js +1 -2
- package/dist/features/parameters/network-visualizations/network-visualizations-form.js +0 -1
- package/dist/features/parameters/network-visualizations/network-visualizations-parameters-dialog.js +3 -7
- package/dist/features/parameters/network-visualizations/network-visualizations-parameters-inline.js +0 -1
- package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -2
- package/dist/features/parameters/pcc-min/pcc-min-parameters-dialog.js +1 -5
- package/dist/features/parameters/pcc-min/pcc-min-parameters-inline.js +0 -1
- package/dist/features/parameters/pcc-min/use-pcc-min-parameters-form.js +1 -2
- package/dist/features/parameters/security-analysis/columns-definitions.js +5 -5
- package/dist/features/parameters/security-analysis/security-analysis-parameters-content.js +0 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-dialog.js +2 -6
- package/dist/features/parameters/security-analysis/security-analysis-parameters-form.js +0 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-inline.js +0 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-utils.js +0 -1
- package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.js +1 -2
- package/dist/features/parameters/sensi/columns-definitions.js +0 -1
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-dialog.js +1 -5
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-form.js +0 -1
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-inline.js +0 -1
- package/dist/features/parameters/sensi/sensitivity-parameters-selector.js +0 -1
- package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.js +1 -2
- package/dist/features/parameters/sensi/utils.js +1 -2
- package/dist/features/parameters/short-circuit/short-circuit-general-tab-panel.js +0 -1
- package/dist/features/parameters/short-circuit/short-circuit-parameters-content.js +0 -1
- package/dist/features/parameters/short-circuit/short-circuit-parameters-dialog.js +1 -5
- package/dist/features/parameters/short-circuit/short-circuit-parameters-inline.js +0 -1
- package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.js +0 -1
- package/dist/features/parameters/short-circuit/short-circuit-power-electronics-tab-panel.js +0 -1
- package/dist/features/parameters/short-circuit/short-circuit-study-area-tab-panel.js +0 -1
- package/dist/features/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -2
- package/dist/features/parameters/voltage-init/equipment-selection-parameters.js +0 -1
- package/dist/features/parameters/voltage-init/general-parameters.js +0 -1
- package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -5
- package/dist/features/parameters/voltage-init/voltage-init-parameters-dialog.js +1 -5
- package/dist/features/parameters/voltage-init/voltage-init-parameters-form.js +0 -1
- package/dist/features/parameters/voltage-init/voltage-init-parameters-inline.js +0 -1
- package/dist/features/process-configs/common/index.d.ts +9 -0
- package/dist/features/process-configs/common/index.js +11 -0
- package/dist/features/process-configs/common/process-config-modifications-edition.d.ts +3 -0
- package/dist/features/process-configs/common/process-config-modifications-edition.js +129 -0
- package/dist/features/process-configs/common/process-config-modifications-edition.utils.d.ts +53 -0
- package/dist/features/process-configs/common/process-config-modifications-edition.utils.js +50 -0
- package/dist/features/process-configs/common/process-config.type.d.ts +14 -0
- package/dist/features/process-configs/index.d.ts +6 -3
- package/dist/features/process-configs/index.js +13 -8
- package/dist/features/process-configs/lf-process-config-edition-dialog.d.ts +3 -0
- package/dist/features/process-configs/lf-process-config-edition-dialog.js +136 -0
- package/dist/features/process-configs/loadflow/index.d.ts +9 -0
- package/dist/features/process-configs/loadflow/index.js +9 -0
- package/dist/features/process-configs/loadflow/lf-process-config-edition.d.ts +1 -0
- package/dist/features/process-configs/loadflow/lf-process-config-edition.js +91 -0
- package/dist/features/process-configs/loadflow/lf-process-config-edition.utils.d.ts +39 -0
- package/dist/features/process-configs/{security-analysis/update-sa-process-config-dialog.js → loadflow/lf-process-config-edition.utils.js} +53 -81
- package/dist/features/process-configs/loadflow/lf-process-config.type.d.ts +6 -0
- package/dist/features/process-configs/loadflow/lf-process-config.type.js +1 -0
- package/dist/features/process-configs/process-config-edition.utils.d.ts +13 -0
- package/dist/features/process-configs/process-config-edition.utils.js +1 -0
- package/dist/features/process-configs/process-config.type.d.ts +14 -0
- package/dist/features/process-configs/process-config.type.js +1 -0
- package/dist/features/process-configs/process-config.utils.d.ts +2 -0
- package/dist/features/process-configs/{update-process-config-modifications.js → process-config.utils.js} +11 -74
- package/dist/features/process-configs/sa-process-config-edition-dialog.d.ts +3 -0
- package/dist/features/process-configs/sa-process-config-edition-dialog.js +136 -0
- package/dist/features/process-configs/security-analysis/index.d.ts +4 -3
- package/dist/features/process-configs/security-analysis/index.js +7 -8
- package/dist/features/process-configs/security-analysis/sa-process-config-edition.d.ts +1 -0
- package/dist/features/process-configs/security-analysis/{update-sa-process-config.js → sa-process-config-edition.js} +5 -13
- package/dist/features/process-configs/security-analysis/sa-process-config-edition.utils.d.ts +45 -0
- package/dist/features/process-configs/security-analysis/sa-process-config-edition.utils.js +119 -0
- package/dist/features/process-configs/security-analysis/sa-process-config.type.d.ts +7 -0
- package/dist/features/process-configs/security-analysis/sa-process-config.type.js +1 -0
- package/dist/hooks/use-unique-name-validation.js +3 -2
- package/dist/index.js +77 -9
- package/dist/translations/en/descriptionEn.d.ts +0 -6
- package/dist/translations/en/descriptionEn.js +6 -1
- package/dist/translations/en/filterEn.d.ts +0 -2
- package/dist/translations/en/filterEn.js +0 -2
- package/dist/translations/en/generic-validationEn.d.ts +23 -0
- package/dist/translations/en/generic-validationEn.js +25 -0
- package/dist/translations/en/index.d.ts +2 -0
- package/dist/translations/en/index.js +4 -0
- package/dist/translations/en/network-modification-validationEn.d.ts +23 -0
- package/dist/translations/en/network-modification-validationEn.js +31 -0
- package/dist/translations/en/networkModificationsEn.d.ts +6 -33
- package/dist/translations/en/networkModificationsEn.js +0 -38
- package/dist/translations/en/parameters.d.ts +0 -2
- package/dist/translations/en/parameters.js +0 -2
- package/dist/translations/en/processConfigEn.d.ts +3 -0
- package/dist/translations/en/processConfigEn.js +5 -2
- package/dist/translations/en/use-unique-name-validation-en.d.ts +0 -2
- package/dist/translations/en/use-unique-name-validation-en.js +1 -3
- package/dist/translations/fr/descriptionFr.d.ts +0 -6
- package/dist/translations/fr/descriptionFr.js +6 -1
- package/dist/translations/fr/filterFr.d.ts +0 -2
- package/dist/translations/fr/filterFr.js +0 -2
- package/dist/translations/fr/generic-validationFr.d.ts +17 -0
- package/dist/translations/fr/generic-validationFr.js +25 -0
- package/dist/translations/fr/index.d.ts +2 -0
- package/dist/translations/fr/index.js +4 -0
- package/dist/translations/fr/network-modification-validationFr.d.ts +23 -0
- package/dist/translations/fr/network-modification-validationFr.js +31 -0
- package/dist/translations/fr/networkModificationsFr.d.ts +6 -33
- package/dist/translations/fr/networkModificationsFr.js +0 -38
- package/dist/translations/fr/parameters.d.ts +0 -2
- package/dist/translations/fr/parameters.js +0 -2
- package/dist/translations/fr/processConfigFr.d.ts +3 -0
- package/dist/translations/fr/processConfigFr.js +5 -2
- package/dist/translations/fr/use-unique-name-validation-fr.d.ts +0 -2
- package/dist/translations/fr/use-unique-name-validation-fr.js +1 -3
- package/dist/utils/constants/index.js +19 -1
- package/dist/utils/constants/translationKeys.d.ts +18 -0
- package/dist/utils/constants/translationKeys.js +36 -0
- package/dist/utils/index.js +19 -1
- package/package.json +1 -1
- package/dist/features/parameters/common/name-element-editor/index.js +0 -7
- package/dist/features/process-configs/process-configs.type.d.ts +0 -33
- package/dist/features/process-configs/security-analysis/update-sa-process-config-dialog.d.ts +0 -14
- package/dist/features/process-configs/security-analysis/update-sa-process-config.d.ts +0 -7
- package/dist/features/process-configs/security-analysis/update-sa-process-configs-utils.d.ts +0 -68
- package/dist/features/process-configs/security-analysis/update-sa-process-configs-utils.js +0 -88
- package/dist/features/process-configs/update-process-config-modifications.d.ts +0 -3
- /package/dist/{features/parameters/common → components/ui/dialogs}/name-element-editor/name-element-editor-form.d.ts +0 -0
- /package/dist/features/process-configs/{process-configs.type.js → common/process-config.type.js} +0 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ClickAwayListener, Paper, Grid2, Typography, Button, List, ListItemButton, ListItemText, Box } from "@mui/material";
|
|
3
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
4
|
+
import { FileUpload } from "@mui/icons-material";
|
|
5
|
+
import { useState, useMemo, useCallback } from "react";
|
|
6
|
+
import { RECENT_FILTER } from "../utils/global-filter-utils.js";
|
|
7
|
+
import SelectedGlobalFilters from "./selected-global-filters.js";
|
|
8
|
+
import { LabelWithInfoTooltip } from "./label-with-info-tooltip.js";
|
|
9
|
+
import { useGlobalFilterContext } from "../context/global-filter-context.js";
|
|
10
|
+
import { resultsGlobalFilterStyles, GLOBAL_FILTERS_CELL_HEIGHT, IMPORT_FILTER_HEIGHT } from "../global-filter.style.js";
|
|
11
|
+
import { GlobalFilterType, isCriteriaFilterType } from "../types/global-filter.type.js";
|
|
12
|
+
import "../../../components/ui/overflowableText/OverflowableText.js";
|
|
13
|
+
import "../../../utils/conversionUtils.js";
|
|
14
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
15
|
+
import { EquipmentType } from "../../../utils/types/equipmentType.js";
|
|
16
|
+
import { mergeSx } from "../../../utils/styles.js";
|
|
17
|
+
import "react-hook-form";
|
|
18
|
+
import "localized-countries";
|
|
19
|
+
import "localized-countries/data/fr";
|
|
20
|
+
import "localized-countries/data/en";
|
|
21
|
+
import "notistack";
|
|
22
|
+
import "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
|
|
23
|
+
import "yup";
|
|
24
|
+
import { DirectoryItemSelector } from "../../../components/ui/directoryItemSelector/DirectoryItemSelector.js";
|
|
25
|
+
import "../../../components/ui/reactHookForm/numbers/RangeInput.js";
|
|
26
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
27
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
28
|
+
import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
|
|
29
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
30
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
31
|
+
import "../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
32
|
+
import "../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
|
|
33
|
+
import "../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
|
|
34
|
+
import "@hello-pangea/dnd";
|
|
35
|
+
import "../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
36
|
+
import "../../../components/ui/snackbarProvider/SnackbarProvider.js";
|
|
37
|
+
import "mui-nested-menu";
|
|
38
|
+
import "react-resizable-panels";
|
|
39
|
+
import "react-papaparse";
|
|
40
|
+
import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
|
|
41
|
+
import "react-dom";
|
|
42
|
+
import "autosuggest-highlight/match";
|
|
43
|
+
import "autosuggest-highlight/parse";
|
|
44
|
+
import "clsx";
|
|
45
|
+
import "../../../components/composite/filter/FilterCreationDialog.js";
|
|
46
|
+
import "../../../components/composite/filter/HeaderFilterForm.js";
|
|
47
|
+
import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
|
|
48
|
+
import "../../../components/composite/filter/expert/ExpertFilterForm.js";
|
|
49
|
+
import "../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
|
|
50
|
+
import "../../../components/composite/filter/expert/expertFilterConstants.js";
|
|
51
|
+
import "react-querybuilder";
|
|
52
|
+
import "uuid";
|
|
53
|
+
import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
54
|
+
import "../../../components/composite/filter/utils/filterFormUtils.js";
|
|
55
|
+
import "@react-querybuilder/material";
|
|
56
|
+
import "../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
57
|
+
import "../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
58
|
+
import "../../../components/composite/agGridTable/BottomTableButtons.js";
|
|
59
|
+
import "../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
60
|
+
import "ag-grid-community";
|
|
61
|
+
import "../../../components/composite/customAGGrid/customAggrid.js";
|
|
62
|
+
import "../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
|
|
63
|
+
import "mathjs";
|
|
64
|
+
import "../../../components/composite/report/report-viewer/log-table/log-table.js";
|
|
65
|
+
import "react-window";
|
|
66
|
+
import "../../../components/composite/report/report-treeview/treeview-item.js";
|
|
67
|
+
import "../../../components/composite/report/report-viewer/context/report-viewer-context.js";
|
|
68
|
+
const XS_COLUMN1 = 3;
|
|
69
|
+
const XS_COLUMN2 = 4;
|
|
70
|
+
const XS_COLUMN3 = 5;
|
|
71
|
+
function GlobalFilterDropdownPanel({
|
|
72
|
+
children,
|
|
73
|
+
autocompleteRef,
|
|
74
|
+
setOpenedDropdown,
|
|
75
|
+
filterGroupSelected,
|
|
76
|
+
setFilterGroupSelected,
|
|
77
|
+
substationPropertiesGlobalFilters,
|
|
78
|
+
filterCategories,
|
|
79
|
+
genericFiltersStrictMode,
|
|
80
|
+
filterableEquipmentTypes,
|
|
81
|
+
translateCountryCode
|
|
82
|
+
}) {
|
|
83
|
+
const intl = useIntl();
|
|
84
|
+
const [directoryItemSelectorOpen, setDirectoryItemSelectorOpen] = useState(false);
|
|
85
|
+
const { selectedGlobalFilters, clearSelectedGlobalFilters, addFiltersToGlobalFiltersOptions } = useGlobalFilterContext();
|
|
86
|
+
const filteringOnlySubstations = useMemo(() => {
|
|
87
|
+
return filterableEquipmentTypes?.length === 1 && filterableEquipmentTypes[0] === EquipmentType.SUBSTATION;
|
|
88
|
+
}, [filterableEquipmentTypes]);
|
|
89
|
+
const standardCategories = useMemo(() => {
|
|
90
|
+
const filteredCategories = filterCategories.filter((category) => category !== GlobalFilterType.SUBSTATION_PROPERTY).filter((category) => {
|
|
91
|
+
const onlyVoltageLevels = filterableEquipmentTypes?.every(
|
|
92
|
+
(equipment) => equipment === EquipmentType.VOLTAGE_LEVEL || equipment === EquipmentType.BUS || equipment === EquipmentType.BUSBAR_SECTION
|
|
93
|
+
);
|
|
94
|
+
return !(category === GlobalFilterType.GENERIC_FILTER && onlyVoltageLevels);
|
|
95
|
+
}).filter((category) => {
|
|
96
|
+
return !(category === GlobalFilterType.SUBSTATION_OR_VL && filteringOnlySubstations);
|
|
97
|
+
});
|
|
98
|
+
return [RECENT_FILTER, ...filteredCategories];
|
|
99
|
+
}, [filterCategories, filterableEquipmentTypes, filteringOnlySubstations]);
|
|
100
|
+
const categories = useMemo(() => {
|
|
101
|
+
const sortedCategories = [
|
|
102
|
+
...standardCategories,
|
|
103
|
+
...substationPropertiesGlobalFilters ? Array.from(substationPropertiesGlobalFilters.keys()) : []
|
|
104
|
+
];
|
|
105
|
+
const substationCategory = sortedCategories.splice(
|
|
106
|
+
sortedCategories.indexOf(GlobalFilterType.SUBSTATION_OR_VL),
|
|
107
|
+
1
|
|
108
|
+
);
|
|
109
|
+
if (substationCategory.length > 0) {
|
|
110
|
+
sortedCategories.push(substationCategory[0]);
|
|
111
|
+
}
|
|
112
|
+
const genericFilterCategory = sortedCategories.splice(
|
|
113
|
+
sortedCategories.indexOf(GlobalFilterType.GENERIC_FILTER),
|
|
114
|
+
1
|
|
115
|
+
);
|
|
116
|
+
if (genericFilterCategory.length > 0) {
|
|
117
|
+
sortedCategories.push(genericFilterCategory[0]);
|
|
118
|
+
}
|
|
119
|
+
return sortedCategories;
|
|
120
|
+
}, [standardCategories, substationPropertiesGlobalFilters]);
|
|
121
|
+
const filtersMsg = useMemo(
|
|
122
|
+
() => intl.formatMessage(
|
|
123
|
+
{
|
|
124
|
+
id: selectedGlobalFilters.length < 2 ? "results.globalFilter.activeFilter" : "results.globalFilter.activeFilters"
|
|
125
|
+
},
|
|
126
|
+
{ filtersCount: selectedGlobalFilters.length }
|
|
127
|
+
),
|
|
128
|
+
[intl, selectedGlobalFilters.length]
|
|
129
|
+
);
|
|
130
|
+
const addSelectedFiltersToGlobalFiltersOptions = useCallback(
|
|
131
|
+
async (values) => {
|
|
132
|
+
if (!values) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
setOpenedDropdown(true);
|
|
136
|
+
await addFiltersToGlobalFiltersOptions(values.map((value) => value.id));
|
|
137
|
+
setDirectoryItemSelectorOpen(false);
|
|
138
|
+
},
|
|
139
|
+
[addFiltersToGlobalFiltersOptions, setDirectoryItemSelectorOpen, setOpenedDropdown]
|
|
140
|
+
);
|
|
141
|
+
const allowedEquipmentTypes = useMemo(() => {
|
|
142
|
+
if (filterGroupSelected === GlobalFilterType.SUBSTATION_OR_VL) {
|
|
143
|
+
return [EquipmentType.SUBSTATION, EquipmentType.VOLTAGE_LEVEL];
|
|
144
|
+
}
|
|
145
|
+
return genericFiltersStrictMode ? filterableEquipmentTypes : Object.values(EquipmentType).filter(
|
|
146
|
+
(equipmentType) => equipmentType !== EquipmentType.SUBSTATION && equipmentType !== EquipmentType.VOLTAGE_LEVEL
|
|
147
|
+
);
|
|
148
|
+
}, [filterableEquipmentTypes, genericFiltersStrictMode, filterGroupSelected]);
|
|
149
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
ClickAwayListener,
|
|
152
|
+
{
|
|
153
|
+
onClickAway: (event) => {
|
|
154
|
+
const target = event.target;
|
|
155
|
+
if (autocompleteRef?.current?.contains(target)) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (!directoryItemSelectorOpen) {
|
|
159
|
+
setOpenedDropdown(false);
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
children: /* @__PURE__ */ jsx(Paper, { sx: resultsGlobalFilterStyles.dropdown, children: /* @__PURE__ */ jsxs(Grid2, { container: true, children: [
|
|
163
|
+
/* @__PURE__ */ jsx(Grid2, { size: XS_COLUMN1, sx: resultsGlobalFilterStyles.cellHeader, children: /* @__PURE__ */ jsx(
|
|
164
|
+
LabelWithInfoTooltip,
|
|
165
|
+
{
|
|
166
|
+
text: "results.globalFilter.categories",
|
|
167
|
+
tooltipMessage: "results.globalFilter.categoriesHelp"
|
|
168
|
+
}
|
|
169
|
+
) }),
|
|
170
|
+
/* @__PURE__ */ jsx(Grid2, { size: XS_COLUMN2, sx: resultsGlobalFilterStyles.cellHeader }),
|
|
171
|
+
/* @__PURE__ */ jsxs(Grid2, { size: XS_COLUMN3, sx: resultsGlobalFilterStyles.cellHeader, children: [
|
|
172
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: filtersMsg }),
|
|
173
|
+
/* @__PURE__ */ jsx(
|
|
174
|
+
Button,
|
|
175
|
+
{
|
|
176
|
+
size: "small",
|
|
177
|
+
onClick: clearSelectedGlobalFilters,
|
|
178
|
+
sx: resultsGlobalFilterStyles.miniButton,
|
|
179
|
+
"data-testid": "GlobalFilterClearAllButton",
|
|
180
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "caption", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "results.globalFilter.clearAll" }) })
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
] }),
|
|
184
|
+
/* @__PURE__ */ jsx(Grid2, { size: XS_COLUMN1, sx: resultsGlobalFilterStyles.cell, children: /* @__PURE__ */ jsx(List, { sx: resultsGlobalFilterStyles.list, children: categories.map((category) => {
|
|
185
|
+
return /* @__PURE__ */ jsx(
|
|
186
|
+
ListItemButton,
|
|
187
|
+
{
|
|
188
|
+
onClick: () => {
|
|
189
|
+
setFilterGroupSelected(category);
|
|
190
|
+
},
|
|
191
|
+
selected: category === filterGroupSelected,
|
|
192
|
+
"data-testid": `GlobalFilterCategory${category}`,
|
|
193
|
+
children: /* @__PURE__ */ jsx(
|
|
194
|
+
ListItemText,
|
|
195
|
+
{
|
|
196
|
+
primary: category === "genericFilter" ? /* @__PURE__ */ jsx(
|
|
197
|
+
LabelWithInfoTooltip,
|
|
198
|
+
{
|
|
199
|
+
text: filteringOnlySubstations ? "results.globalFilter.substationFilter" : "results.globalFilter.genericFilter",
|
|
200
|
+
tooltipMessage: "results.globalFilter.elementsHelp"
|
|
201
|
+
}
|
|
202
|
+
) : /* @__PURE__ */ jsx(FormattedMessage, { id: `results.globalFilter.${category}` })
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
},
|
|
206
|
+
category
|
|
207
|
+
);
|
|
208
|
+
}) }) }),
|
|
209
|
+
/* @__PURE__ */ jsxs(Grid2, { size: XS_COLUMN2, sx: resultsGlobalFilterStyles.cell, children: [
|
|
210
|
+
/* @__PURE__ */ jsx(
|
|
211
|
+
Box,
|
|
212
|
+
{
|
|
213
|
+
sx: mergeSx(resultsGlobalFilterStyles.list, {
|
|
214
|
+
height: isCriteriaFilterType(filterGroupSelected) ? `${GLOBAL_FILTERS_CELL_HEIGHT - IMPORT_FILTER_HEIGHT}px` : `${GLOBAL_FILTERS_CELL_HEIGHT}px`
|
|
215
|
+
}),
|
|
216
|
+
children
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
isCriteriaFilterType(filterGroupSelected) && /* @__PURE__ */ jsx(
|
|
220
|
+
Button,
|
|
221
|
+
{
|
|
222
|
+
startIcon: /* @__PURE__ */ jsx(FileUpload, {}),
|
|
223
|
+
fullWidth: true,
|
|
224
|
+
sx: resultsGlobalFilterStyles.importFilterButton,
|
|
225
|
+
onMouseDown: () => {
|
|
226
|
+
setDirectoryItemSelectorOpen(true);
|
|
227
|
+
},
|
|
228
|
+
children: /* @__PURE__ */ jsx(FormattedMessage, { id: "results.globalFilter.loadFilter" })
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
] }),
|
|
232
|
+
/* @__PURE__ */ jsx(Grid2, { size: XS_COLUMN3, sx: resultsGlobalFilterStyles.cell, children: /* @__PURE__ */ jsx(SelectedGlobalFilters, { translateCountryCode }) })
|
|
233
|
+
] }) })
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
/* @__PURE__ */ jsx(
|
|
237
|
+
DirectoryItemSelector,
|
|
238
|
+
{
|
|
239
|
+
open: directoryItemSelectorOpen,
|
|
240
|
+
onClose: addSelectedFiltersToGlobalFiltersOptions,
|
|
241
|
+
types: [ElementType.FILTER],
|
|
242
|
+
equipmentTypes: allowedEquipmentTypes,
|
|
243
|
+
title: intl.formatMessage({ id: "Filters" }),
|
|
244
|
+
multiSelect: true
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
] });
|
|
248
|
+
}
|
|
249
|
+
export {
|
|
250
|
+
GlobalFilterDropdownPanel as default
|
|
251
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type GlobalFilterProps = {
|
|
3
|
+
substationPropertiesGlobalFilters?: Map<string, string[]>;
|
|
4
|
+
filterCategories: string[];
|
|
5
|
+
genericFiltersStrictMode: boolean;
|
|
6
|
+
filterableEquipmentTypes: string[];
|
|
7
|
+
translateCountryCode: (countryCode: string) => string;
|
|
8
|
+
};
|
|
9
|
+
export declare function GlobalFilterPanel({ substationPropertiesGlobalFilters, filterCategories, genericFiltersStrictMode, filterableEquipmentTypes, translateCountryCode, }: Readonly<GlobalFilterProps>): React.JSX.Element;
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState, useMemo, useCallback, createElement } from "react";
|
|
3
|
+
import { Chip, Autocomplete, Box, TextField, InputAdornment, Tooltip, Typography, ListItemButton, Checkbox, IconButton } from "@mui/material";
|
|
4
|
+
import { FilterAlt, WarningAmberRounded, Delete } from "@mui/icons-material";
|
|
5
|
+
import { useIntl } from "react-intl";
|
|
6
|
+
import { getResultsGlobalFiltersChipStyle, resultsGlobalFilterStyles } from "../global-filter.style.js";
|
|
7
|
+
import GlobalFilterDropdownPanel from "./global-filter-dropdown-panel.js";
|
|
8
|
+
import { RECENT_FILTER, getOptionLabel } from "../utils/global-filter-utils.js";
|
|
9
|
+
import { useGlobalFilterContext } from "../context/global-filter-context.js";
|
|
10
|
+
import { GlobalFilterType } from "../types/global-filter.type.js";
|
|
11
|
+
import { OverflowableChip } from "../../../components/ui/reactHookForm/OverflowableChip.js";
|
|
12
|
+
import "../../../utils/conversionUtils.js";
|
|
13
|
+
import { EquipmentType } from "../../../utils/types/equipmentType.js";
|
|
14
|
+
import "react-hook-form";
|
|
15
|
+
import "localized-countries";
|
|
16
|
+
import "localized-countries/data/fr";
|
|
17
|
+
import "localized-countries/data/en";
|
|
18
|
+
import "notistack";
|
|
19
|
+
import "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
|
|
20
|
+
import "yup";
|
|
21
|
+
import { OverflowableText } from "../../../components/ui/overflowableText/OverflowableText.js";
|
|
22
|
+
import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
|
|
23
|
+
import "../../../components/ui/reactHookForm/numbers/RangeInput.js";
|
|
24
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
25
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
26
|
+
import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
|
|
27
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
28
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
29
|
+
import "../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
30
|
+
import "../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
|
|
31
|
+
import "../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
|
|
32
|
+
import "@hello-pangea/dnd";
|
|
33
|
+
import "../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
34
|
+
import "../../../components/ui/snackbarProvider/SnackbarProvider.js";
|
|
35
|
+
import "mui-nested-menu";
|
|
36
|
+
import "react-resizable-panels";
|
|
37
|
+
import "react-papaparse";
|
|
38
|
+
import "react-dom";
|
|
39
|
+
import "autosuggest-highlight/match";
|
|
40
|
+
import "autosuggest-highlight/parse";
|
|
41
|
+
import "clsx";
|
|
42
|
+
import "../../../components/composite/filter/FilterCreationDialog.js";
|
|
43
|
+
import "../../../components/composite/filter/HeaderFilterForm.js";
|
|
44
|
+
import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
|
|
45
|
+
import "../../../components/composite/filter/expert/ExpertFilterForm.js";
|
|
46
|
+
import "../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
|
|
47
|
+
import "../../../components/composite/filter/expert/expertFilterConstants.js";
|
|
48
|
+
import "react-querybuilder";
|
|
49
|
+
import "uuid";
|
|
50
|
+
import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
51
|
+
import "../../../components/composite/filter/utils/filterFormUtils.js";
|
|
52
|
+
import "@react-querybuilder/material";
|
|
53
|
+
import "../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
54
|
+
import "../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
55
|
+
import "../../../components/composite/agGridTable/BottomTableButtons.js";
|
|
56
|
+
import "../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
57
|
+
import "ag-grid-community";
|
|
58
|
+
import "../../../components/composite/customAGGrid/customAggrid.js";
|
|
59
|
+
import "../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
|
|
60
|
+
import "mathjs";
|
|
61
|
+
import "../../../components/composite/report/report-viewer/log-table/log-table.js";
|
|
62
|
+
import "react-window";
|
|
63
|
+
import "../../../components/composite/report/report-treeview/treeview-item.js";
|
|
64
|
+
import "../../../components/composite/report/report-viewer/context/report-viewer-context.js";
|
|
65
|
+
const TAG_LIMIT_NUMBER = 4;
|
|
66
|
+
function RenderInput({
|
|
67
|
+
id,
|
|
68
|
+
size,
|
|
69
|
+
fullWidth,
|
|
70
|
+
inputProps,
|
|
71
|
+
disabled,
|
|
72
|
+
InputProps: { startAdornment, ...otherInputProps }
|
|
73
|
+
}) {
|
|
74
|
+
const intl = useIntl();
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
TextField,
|
|
77
|
+
{
|
|
78
|
+
id,
|
|
79
|
+
size,
|
|
80
|
+
fullWidth,
|
|
81
|
+
inputProps,
|
|
82
|
+
disabled,
|
|
83
|
+
label: intl.formatMessage({
|
|
84
|
+
id: "results.globalFilter.fillerText"
|
|
85
|
+
}),
|
|
86
|
+
InputProps: {
|
|
87
|
+
...otherInputProps,
|
|
88
|
+
startAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
89
|
+
/* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx(FilterAlt, {}) }),
|
|
90
|
+
startAdornment
|
|
91
|
+
] })
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
function formatVoltageRange(option) {
|
|
97
|
+
if (option.minValue != null && option.maxValue != null) {
|
|
98
|
+
return `[${option.minValue} kV, ${option.maxValue} kV]`;
|
|
99
|
+
}
|
|
100
|
+
return "";
|
|
101
|
+
}
|
|
102
|
+
function RenderOption(props) {
|
|
103
|
+
const { children, option, state, translateCountryCode, ...otherProps } = props;
|
|
104
|
+
const intl = useIntl();
|
|
105
|
+
const { removeGlobalFilterOption } = useGlobalFilterContext();
|
|
106
|
+
const label = getOptionLabel(option, translateCountryCode, intl);
|
|
107
|
+
let content;
|
|
108
|
+
switch (option.filterType) {
|
|
109
|
+
case GlobalFilterType.VOLTAGE_LEVEL:
|
|
110
|
+
content = /* @__PURE__ */ jsx(Tooltip, { title: formatVoltageRange(option), placement: "right", arrow: true, children: /* @__PURE__ */ jsx(Typography, { children: label }) });
|
|
111
|
+
break;
|
|
112
|
+
case GlobalFilterType.SUBSTATION_OR_VL:
|
|
113
|
+
case GlobalFilterType.GENERIC_FILTER:
|
|
114
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
115
|
+
/* @__PURE__ */ jsx(OverflowableText, { text: label, width: "100%" }),
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
IconButton,
|
|
118
|
+
{
|
|
119
|
+
sx: {
|
|
120
|
+
display: "none",
|
|
121
|
+
".MuiListItemButton-root:hover &": {
|
|
122
|
+
display: "inline-flex"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
onClick: (e) => {
|
|
126
|
+
e.stopPropagation();
|
|
127
|
+
removeGlobalFilterOption(option.id);
|
|
128
|
+
},
|
|
129
|
+
children: /* @__PURE__ */ jsx(Delete, { fontSize: "small" })
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
] });
|
|
133
|
+
break;
|
|
134
|
+
default:
|
|
135
|
+
content = /* @__PURE__ */ jsx(OverflowableText, { text: label });
|
|
136
|
+
}
|
|
137
|
+
return /* @__PURE__ */ jsxs(ListItemButton, { selected: state.selected, component: "li", ...otherProps, children: [
|
|
138
|
+
/* @__PURE__ */ jsx(Checkbox, { size: "small", checked: state.selected }),
|
|
139
|
+
content
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
function WarningTooltip({ warningEquipmentTypeMessage }) {
|
|
143
|
+
return /* @__PURE__ */ jsx(
|
|
144
|
+
Tooltip,
|
|
145
|
+
{
|
|
146
|
+
title: warningEquipmentTypeMessage,
|
|
147
|
+
placement: "right",
|
|
148
|
+
arrow: true,
|
|
149
|
+
PopperProps: {
|
|
150
|
+
modifiers: [
|
|
151
|
+
{
|
|
152
|
+
name: "offset",
|
|
153
|
+
options: {
|
|
154
|
+
offset: [0, -15]
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
children: /* @__PURE__ */ jsx(IconButton, { size: "small", sx: { cursor: "default" }, children: /* @__PURE__ */ jsx(WarningAmberRounded, { color: "warning", fontSize: "medium" }) })
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
function GlobalFilterPanel({
|
|
164
|
+
substationPropertiesGlobalFilters,
|
|
165
|
+
filterCategories,
|
|
166
|
+
genericFiltersStrictMode,
|
|
167
|
+
filterableEquipmentTypes,
|
|
168
|
+
translateCountryCode
|
|
169
|
+
}) {
|
|
170
|
+
const {
|
|
171
|
+
globalFilterOptions,
|
|
172
|
+
selectedGlobalFilters,
|
|
173
|
+
recentGlobalFilters,
|
|
174
|
+
selectGlobalFilter,
|
|
175
|
+
unselectGlobalFilters,
|
|
176
|
+
clearSelectedGlobalFilters
|
|
177
|
+
} = useGlobalFilterContext();
|
|
178
|
+
const intl = useIntl();
|
|
179
|
+
const autocompleteRef = useRef(null);
|
|
180
|
+
const [openedDropdown, setOpenedDropdown] = useState(false);
|
|
181
|
+
const [filterGroupSelected, setFilterGroupSelected] = useState(GlobalFilterType.VOLTAGE_LEVEL);
|
|
182
|
+
const warningEquipmentTypeMessage = useMemo(() => {
|
|
183
|
+
if (!genericFiltersStrictMode) {
|
|
184
|
+
const inappropriateFilters = selectedGlobalFilters.filter(
|
|
185
|
+
(filter) => filter.equipmentType && !filterableEquipmentTypes.find((eqptType) => eqptType.toString() === filter.equipmentType)
|
|
186
|
+
).map((filter) => filter.label);
|
|
187
|
+
if (inappropriateFilters.length > 0) {
|
|
188
|
+
if (inappropriateFilters.length > 1) {
|
|
189
|
+
return intl.formatMessage(
|
|
190
|
+
{
|
|
191
|
+
id: "results.globalFilter.nonApplicableExtra"
|
|
192
|
+
},
|
|
193
|
+
{ filterName: inappropriateFilters[0], extraFiltersNum: inappropriateFilters.length - 1 }
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
return intl.formatMessage(
|
|
197
|
+
{
|
|
198
|
+
id: "results.globalFilter.nonApplicable"
|
|
199
|
+
},
|
|
200
|
+
{ filterName: inappropriateFilters[0] }
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return "";
|
|
205
|
+
}, [genericFiltersStrictMode, selectedGlobalFilters, filterableEquipmentTypes, intl]);
|
|
206
|
+
const filterOptions = useCallback(
|
|
207
|
+
(options2, state) => {
|
|
208
|
+
const filteredOptions = options2.filter((option) => {
|
|
209
|
+
const labelToMatch = option.filterType === GlobalFilterType.COUNTRY ? translateCountryCode(option.label) : option.label;
|
|
210
|
+
return labelToMatch.toLowerCase().includes(state.inputValue.toLowerCase());
|
|
211
|
+
}).filter((option) => {
|
|
212
|
+
if (filterGroupSelected === RECENT_FILTER) {
|
|
213
|
+
return recentGlobalFilters.some((r) => r.id === option.id);
|
|
214
|
+
}
|
|
215
|
+
if (option.filterSubtype) {
|
|
216
|
+
return option.filterSubtype === filterGroupSelected;
|
|
217
|
+
}
|
|
218
|
+
if (filterGroupSelected === GlobalFilterType.GENERIC_FILTER && filterableEquipmentTypes?.length === 1 && filterableEquipmentTypes[0] === EquipmentType.SUBSTATION && option.equipmentType === EquipmentType.SUBSTATION) {
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
return option.filterType === filterGroupSelected;
|
|
222
|
+
});
|
|
223
|
+
if (filterGroupSelected === RECENT_FILTER) {
|
|
224
|
+
filteredOptions.sort((a, b) => {
|
|
225
|
+
const indexA = recentGlobalFilters.findIndex((r) => r.id === a.id);
|
|
226
|
+
const indexB = recentGlobalFilters.findIndex((r) => r.id === b.id);
|
|
227
|
+
return indexA - indexB;
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return filteredOptions;
|
|
231
|
+
},
|
|
232
|
+
[filterGroupSelected, translateCountryCode, filterableEquipmentTypes, recentGlobalFilters]
|
|
233
|
+
);
|
|
234
|
+
const options = useMemo(
|
|
235
|
+
() => globalFilterOptions.filter((filter) => !filter.deleted).filter(
|
|
236
|
+
(filter) => filterCategories.includes(filter.filterType) && (genericFiltersStrictMode && filter.filterType === GlobalFilterType.GENERIC_FILTER ? filterableEquipmentTypes.includes(filter.equipmentType) : true)
|
|
237
|
+
).sort((a, b) => {
|
|
238
|
+
if (a.filterType === GlobalFilterType.COUNTRY && b.filterType === GlobalFilterType.COUNTRY) {
|
|
239
|
+
const bt = translateCountryCode(b.label);
|
|
240
|
+
const at = translateCountryCode(a.label);
|
|
241
|
+
return at.localeCompare(bt);
|
|
242
|
+
}
|
|
243
|
+
return 0;
|
|
244
|
+
}),
|
|
245
|
+
[
|
|
246
|
+
globalFilterOptions,
|
|
247
|
+
translateCountryCode,
|
|
248
|
+
filterCategories,
|
|
249
|
+
genericFiltersStrictMode,
|
|
250
|
+
filterableEquipmentTypes
|
|
251
|
+
]
|
|
252
|
+
);
|
|
253
|
+
const inputFieldChip = useCallback(
|
|
254
|
+
(element, index, getTagsProps, filtersNumber) => {
|
|
255
|
+
const label = getOptionLabel(element, translateCountryCode, intl);
|
|
256
|
+
const key = `inputFieldChip_${element.label}`;
|
|
257
|
+
if (index < TAG_LIMIT_NUMBER) {
|
|
258
|
+
return /* @__PURE__ */ createElement(
|
|
259
|
+
OverflowableChip,
|
|
260
|
+
{
|
|
261
|
+
label,
|
|
262
|
+
...getTagsProps({ index }),
|
|
263
|
+
key,
|
|
264
|
+
sx: getResultsGlobalFiltersChipStyle(element)
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
if (index === TAG_LIMIT_NUMBER) {
|
|
269
|
+
return /* @__PURE__ */ jsx(Chip, { size: "small", label: `+${filtersNumber - TAG_LIMIT_NUMBER}` }, key);
|
|
270
|
+
}
|
|
271
|
+
return void 0;
|
|
272
|
+
},
|
|
273
|
+
[translateCountryCode, intl]
|
|
274
|
+
);
|
|
275
|
+
const isOptionEqualToValue = useCallback((option, value) => option.id === value.id, []);
|
|
276
|
+
const PaperComponentMemo = useCallback(
|
|
277
|
+
(props) => /* @__PURE__ */ jsx(
|
|
278
|
+
GlobalFilterDropdownPanel,
|
|
279
|
+
{
|
|
280
|
+
...props,
|
|
281
|
+
autocompleteRef,
|
|
282
|
+
setOpenedDropdown,
|
|
283
|
+
filterGroupSelected,
|
|
284
|
+
setFilterGroupSelected,
|
|
285
|
+
substationPropertiesGlobalFilters,
|
|
286
|
+
filterCategories,
|
|
287
|
+
genericFiltersStrictMode,
|
|
288
|
+
filterableEquipmentTypes,
|
|
289
|
+
translateCountryCode
|
|
290
|
+
}
|
|
291
|
+
),
|
|
292
|
+
[
|
|
293
|
+
autocompleteRef,
|
|
294
|
+
filterGroupSelected,
|
|
295
|
+
substationPropertiesGlobalFilters,
|
|
296
|
+
filterCategories,
|
|
297
|
+
genericFiltersStrictMode,
|
|
298
|
+
filterableEquipmentTypes,
|
|
299
|
+
translateCountryCode
|
|
300
|
+
]
|
|
301
|
+
);
|
|
302
|
+
const handleOnChange = useCallback(
|
|
303
|
+
(_event, _value, reason, details) => {
|
|
304
|
+
switch (reason) {
|
|
305
|
+
case "selectOption":
|
|
306
|
+
selectGlobalFilter(details.option.id);
|
|
307
|
+
break;
|
|
308
|
+
case "removeOption":
|
|
309
|
+
unselectGlobalFilters([details.option.id]);
|
|
310
|
+
break;
|
|
311
|
+
case "clear":
|
|
312
|
+
clearSelectedGlobalFilters();
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
[clearSelectedGlobalFilters, selectGlobalFilter, unselectGlobalFilters]
|
|
317
|
+
);
|
|
318
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
319
|
+
/* @__PURE__ */ jsx("div", { ref: autocompleteRef, children: /* @__PURE__ */ jsx(
|
|
320
|
+
Autocomplete,
|
|
321
|
+
{
|
|
322
|
+
value: selectedGlobalFilters,
|
|
323
|
+
open: openedDropdown,
|
|
324
|
+
onOpen: () => setOpenedDropdown(true),
|
|
325
|
+
onClose: (_event, reason) => {
|
|
326
|
+
if (reason !== "selectOption" && reason !== "blur") {
|
|
327
|
+
setOpenedDropdown(false);
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
sx: resultsGlobalFilterStyles.autocomplete,
|
|
331
|
+
multiple: true,
|
|
332
|
+
id: "result-global-filter",
|
|
333
|
+
size: "small",
|
|
334
|
+
openOnFocus: true,
|
|
335
|
+
disableCloseOnSelect: true,
|
|
336
|
+
options,
|
|
337
|
+
onChange: handleOnChange,
|
|
338
|
+
renderInput: RenderInput,
|
|
339
|
+
renderTags: (filters, getTagsProps) => {
|
|
340
|
+
return /* @__PURE__ */ jsx(
|
|
341
|
+
Box,
|
|
342
|
+
{
|
|
343
|
+
sx: {
|
|
344
|
+
display: "flex",
|
|
345
|
+
alignItems: "center",
|
|
346
|
+
overflowX: "hidden",
|
|
347
|
+
flexWrap: "nowrap",
|
|
348
|
+
maxWidth: "90%"
|
|
349
|
+
},
|
|
350
|
+
children: filters.map((element, index) => {
|
|
351
|
+
return inputFieldChip(element, index, getTagsProps, filters.length);
|
|
352
|
+
})
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
},
|
|
356
|
+
renderOption: (props, option, state) => {
|
|
357
|
+
const { key, ...otherProps } = props;
|
|
358
|
+
return /* @__PURE__ */ jsx(
|
|
359
|
+
RenderOption,
|
|
360
|
+
{
|
|
361
|
+
...otherProps,
|
|
362
|
+
option,
|
|
363
|
+
state,
|
|
364
|
+
translateCountryCode
|
|
365
|
+
},
|
|
366
|
+
key
|
|
367
|
+
);
|
|
368
|
+
},
|
|
369
|
+
isOptionEqualToValue,
|
|
370
|
+
filterOptions: (autocompleteOptions, state) => filterOptions(autocompleteOptions, state),
|
|
371
|
+
PaperComponent: PaperComponentMemo,
|
|
372
|
+
ListboxProps: {
|
|
373
|
+
sx: {
|
|
374
|
+
"& .MuiAutocomplete-option": {
|
|
375
|
+
paddingLeft: 0,
|
|
376
|
+
paddingRight: 0
|
|
377
|
+
},
|
|
378
|
+
height: "100%",
|
|
379
|
+
maxHeight: "100%",
|
|
380
|
+
overflowY: "auto"
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
noOptionsText: ""
|
|
384
|
+
}
|
|
385
|
+
) }),
|
|
386
|
+
warningEquipmentTypeMessage && /* @__PURE__ */ jsx(WarningTooltip, { warningEquipmentTypeMessage })
|
|
387
|
+
] });
|
|
388
|
+
}
|
|
389
|
+
export {
|
|
390
|
+
GlobalFilterPanel
|
|
391
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
type TextWithToolTipProps = {
|
|
8
|
+
text: string;
|
|
9
|
+
tooltipMessage: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function LabelWithInfoTooltip({ text, tooltipMessage }: Readonly<TextWithToolTipProps>): import("react").JSX.Element;
|
|
12
|
+
export {};
|