@gridsuite/commons-ui 0.74.0 → 0.76.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/{filter → contingencyList}/criteriaBased/CriteriaBasedForm.d.ts +1 -1
- package/dist/components/{filter/criteriaBased/criteriaBasedFilterUtils.d.ts → contingencyList/criteriaBased/criteriaBasedUtils.d.ts} +0 -39
- package/dist/components/contingencyList/criteriaBased/criteriaBasedUtils.js +36 -0
- package/dist/components/{filter → contingencyList}/criteriaBased/index.d.ts +1 -6
- package/dist/components/contingencyList/criteriaBased/index.js +7 -0
- package/dist/components/filter/FilterCreationDialog.js +1 -10
- package/dist/components/filter/FilterForm.js +0 -2
- package/dist/components/filter/constants/FilterConstants.d.ts +0 -4
- package/dist/components/filter/constants/FilterConstants.js +0 -1
- package/dist/components/filter/index.d.ts +1 -1
- package/dist/components/filter/index.js +3 -24
- package/dist/components/filter/utils/filterApi.d.ts +0 -1
- package/dist/components/filter/utils/filterApi.js +0 -10
- package/dist/components/filter/utils/index.js +1 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +11 -24
- package/dist/components/notifications/NotificationsProvider.d.ts +6 -0
- package/dist/components/notifications/NotificationsProvider.js +54 -0
- package/dist/components/notifications/contexts/NotificationsContext.d.ts +23 -0
- package/dist/components/notifications/contexts/NotificationsContext.js +14 -0
- package/dist/components/notifications/hooks/useListenerManager.d.ts +7 -0
- package/dist/components/notifications/hooks/useListenerManager.js +50 -0
- package/dist/components/notifications/hooks/useNotificationsListener.d.ts +11 -0
- package/dist/components/notifications/hooks/useNotificationsListener.js +33 -0
- package/dist/components/notifications/index.d.ts +4 -0
- package/dist/components/notifications/index.js +10 -0
- package/dist/index.js +11 -24
- package/dist/translations/en/filterEn.d.ts +0 -1
- package/dist/translations/en/filterEn.js +1 -2
- package/dist/translations/en/networkModificationsEn.d.ts +1 -1
- package/dist/translations/en/networkModificationsEn.js +1 -1
- package/dist/translations/fr/filterFr.d.ts +0 -1
- package/dist/translations/fr/filterFr.js +1 -2
- package/dist/utils/mapper/getFileIcon.js +3 -1
- package/dist/utils/types/elementType.d.ts +2 -1
- package/dist/utils/types/elementType.js +1 -0
- package/package.json +2 -1
- package/dist/components/filter/criteriaBased/CriteriaBasedFilterEditionDialog.d.ts +0 -19
- package/dist/components/filter/criteriaBased/CriteriaBasedFilterEditionDialog.js +0 -103
- package/dist/components/filter/criteriaBased/CriteriaBasedFilterForm.d.ts +0 -49
- package/dist/components/filter/criteriaBased/CriteriaBasedFilterForm.js +0 -33
- package/dist/components/filter/criteriaBased/FilterFreeProperties.d.ts +0 -12
- package/dist/components/filter/criteriaBased/FilterFreeProperties.js +0 -68
- package/dist/components/filter/criteriaBased/FilterProperties.d.ts +0 -15
- package/dist/components/filter/criteriaBased/FilterProperties.js +0 -121
- package/dist/components/filter/criteriaBased/FilterProperty.d.ts +0 -18
- package/dist/components/filter/criteriaBased/FilterProperty.js +0 -65
- package/dist/components/filter/criteriaBased/criteriaBasedFilterUtils.js +0 -158
- package/dist/components/filter/criteriaBased/index.js +0 -27
- /package/dist/components/{filter → contingencyList}/criteriaBased/CriteriaBasedForm.js +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NotificationsProvider } from "./NotificationsProvider.js";
|
|
2
|
+
import { NotificationsContext } from "./contexts/NotificationsContext.js";
|
|
3
|
+
import { useNotificationsListener } from "./hooks/useNotificationsListener.js";
|
|
4
|
+
import { useListenerManager } from "./hooks/useListenerManager.js";
|
|
5
|
+
export {
|
|
6
|
+
NotificationsContext,
|
|
7
|
+
NotificationsProvider,
|
|
8
|
+
useListenerManager,
|
|
9
|
+
useNotificationsListener
|
|
10
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -27,13 +27,8 @@ import { TagRenderer } from "./components/elementSearch/tagRenderer/TagRenderer.
|
|
|
27
27
|
import { FilterCreationDialog } from "./components/filter/FilterCreationDialog.js";
|
|
28
28
|
import { FilterForm } from "./components/filter/FilterForm.js";
|
|
29
29
|
import { DISTRIBUTION_KEY, FilterType, NO_ITEM_SELECTION_FOR_COPY } from "./components/filter/constants/FilterConstants.js";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import { CriteriaBasedForm } from "./components/filter/criteriaBased/CriteriaBasedForm.js";
|
|
33
|
-
import { FilterFreeProperties, FreePropertiesTypes } from "./components/filter/criteriaBased/FilterFreeProperties.js";
|
|
34
|
-
import { FilterProperties, filterPropertiesYupSchema } from "./components/filter/criteriaBased/FilterProperties.js";
|
|
35
|
-
import { FilterProperty, PROPERTY_NAME, PROPERTY_VALUES, PROPERTY_VALUES_1, PROPERTY_VALUES_2 } from "./components/filter/criteriaBased/FilterProperty.js";
|
|
36
|
-
import { backToFrontTweak, frontToBackTweak, getCriteriaBasedFormData, getCriteriaBasedSchema } from "./components/filter/criteriaBased/criteriaBasedFilterUtils.js";
|
|
30
|
+
import { CriteriaBasedForm } from "./components/contingencyList/criteriaBased/CriteriaBasedForm.js";
|
|
31
|
+
import { getCriteriaBasedFormData, getCriteriaBasedSchema } from "./components/contingencyList/criteriaBased/criteriaBasedUtils.js";
|
|
37
32
|
import { ExpertFilterEditionDialog } from "./components/filter/expert/ExpertFilterEditionDialog.js";
|
|
38
33
|
import { EXPERT_FILTER_QUERY, ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData, rqbQuerySchemaValidator } from "./components/filter/expert/ExpertFilterForm.js";
|
|
39
34
|
import { CombinatorType, DataType, FieldType, OperatorType } from "./components/filter/expert/expertFilter.type.js";
|
|
@@ -41,7 +36,7 @@ import { COMBINATOR_OPTIONS, CONVERTERS_MODE_OPTIONS, ENERGY_SOURCE_OPTIONS, EXP
|
|
|
41
36
|
import { countRules, exportExpertRules, getNumberOfSiblings, getOperators, importExpertRules, queryValidator, recursiveRemove, testQuery } from "./components/filter/expert/expertFilterUtils.js";
|
|
42
37
|
import { ExplicitNamingFilterEditionDialog } from "./components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
43
38
|
import { ExplicitNamingFilterForm, FILTER_EQUIPMENTS_ATTRIBUTES, explicitNamingFilterSchema, getExplicitNamingFilterEmptyFormData } from "./components/filter/explicitNaming/ExplicitNamingFilterForm.js";
|
|
44
|
-
import {
|
|
39
|
+
import { saveExpertFilter, saveExplicitNamingFilter } from "./components/filter/utils/filterApi.js";
|
|
45
40
|
import { CONTINGENCY_LIST_EQUIPMENTS, FILTER_EQUIPMENTS } from "./components/filter/utils/filterFormUtils.js";
|
|
46
41
|
import { FlatParameters, extractDefault } from "./components/flatParameters/FlatParameters.js";
|
|
47
42
|
import { SelectClearable } from "./components/inputs/SelectClearable.js";
|
|
@@ -105,6 +100,10 @@ import { TopBar } from "./components/topBar/TopBar.js";
|
|
|
105
100
|
import { GridLogo, LogoText } from "./components/topBar/GridLogo.js";
|
|
106
101
|
import { AboutDialog } from "./components/topBar/AboutDialog.js";
|
|
107
102
|
import { TreeViewFinder, generateTreeViewFinderClass } from "./components/treeViewFinder/TreeViewFinder.js";
|
|
103
|
+
import { NotificationsProvider } from "./components/notifications/NotificationsProvider.js";
|
|
104
|
+
import { NotificationsContext } from "./components/notifications/contexts/NotificationsContext.js";
|
|
105
|
+
import { useNotificationsListener } from "./components/notifications/hooks/useNotificationsListener.js";
|
|
106
|
+
import { useListenerManager } from "./components/notifications/hooks/useListenerManager.js";
|
|
108
107
|
import { useStateBoolean } from "./hooks/customStates/useStateBoolean.js";
|
|
109
108
|
import { useStateNumber } from "./hooks/customStates/useStateNumber.js";
|
|
110
109
|
import { useModificationLabelComputer } from "./hooks/useModificationLabelComputer.js";
|
|
@@ -203,8 +202,6 @@ export {
|
|
|
203
202
|
CombinatorType,
|
|
204
203
|
CountriesInput,
|
|
205
204
|
CountryValueEditor,
|
|
206
|
-
CriteriaBasedFilterEditionDialog,
|
|
207
|
-
CriteriaBasedFilterForm,
|
|
208
205
|
CriteriaBasedForm,
|
|
209
206
|
CsvUploader,
|
|
210
207
|
CustomAGGrid,
|
|
@@ -254,13 +251,9 @@ export {
|
|
|
254
251
|
FieldType,
|
|
255
252
|
FilterCreationDialog,
|
|
256
253
|
FilterForm,
|
|
257
|
-
FilterFreeProperties,
|
|
258
|
-
FilterProperties,
|
|
259
|
-
FilterProperty,
|
|
260
254
|
FilterType,
|
|
261
255
|
FlatParameters,
|
|
262
256
|
FloatInput,
|
|
263
|
-
FreePropertiesTypes,
|
|
264
257
|
GRIDSUITE_DEFAULT_PRECISION,
|
|
265
258
|
Generator,
|
|
266
259
|
GridLogo,
|
|
@@ -291,16 +284,14 @@ export {
|
|
|
291
284
|
MultipleSelectionDialog,
|
|
292
285
|
NAME,
|
|
293
286
|
NO_ITEM_SELECTION_FOR_COPY,
|
|
287
|
+
NotificationsContext,
|
|
288
|
+
NotificationsProvider,
|
|
294
289
|
NumericEditor,
|
|
295
290
|
OPERATOR_OPTIONS,
|
|
296
291
|
OperatingStatus,
|
|
297
292
|
OperatorType,
|
|
298
293
|
OverflowableText,
|
|
299
294
|
PHASE_REGULATION_MODE_OPTIONS,
|
|
300
|
-
PROPERTY_NAME,
|
|
301
|
-
PROPERTY_VALUES,
|
|
302
|
-
PROPERTY_VALUES_1,
|
|
303
|
-
PROPERTY_VALUES_2,
|
|
304
295
|
PopupConfirmationDialog,
|
|
305
296
|
PropertyValueEditor,
|
|
306
297
|
RATIO_REGULATION_MODE_OPTIONS,
|
|
@@ -351,7 +342,6 @@ export {
|
|
|
351
342
|
ValueSelector,
|
|
352
343
|
VoltageLevel,
|
|
353
344
|
areArrayElementsUnique,
|
|
354
|
-
backToFrontTweak,
|
|
355
345
|
backendFetch,
|
|
356
346
|
backendFetchJson,
|
|
357
347
|
cardErrorBoundaryEn,
|
|
@@ -362,8 +352,6 @@ export {
|
|
|
362
352
|
commonButtonFr,
|
|
363
353
|
countRules,
|
|
364
354
|
createFilter,
|
|
365
|
-
criteriaBasedFilterEmptyFormData,
|
|
366
|
-
criteriaBasedFilterSchema,
|
|
367
355
|
csvEn,
|
|
368
356
|
csvFr,
|
|
369
357
|
descriptionEn,
|
|
@@ -400,11 +388,9 @@ export {
|
|
|
400
388
|
filterExpertEn,
|
|
401
389
|
filterExpertFr,
|
|
402
390
|
filterFr,
|
|
403
|
-
filterPropertiesYupSchema,
|
|
404
391
|
flatParametersEn,
|
|
405
392
|
flatParametersFr,
|
|
406
393
|
forTesting,
|
|
407
|
-
frontToBackTweak,
|
|
408
394
|
genHelperError,
|
|
409
395
|
genHelperPreviousValue,
|
|
410
396
|
generateMuiVirtualizedTableClass,
|
|
@@ -463,7 +449,6 @@ export {
|
|
|
463
449
|
roundToDefaultPrecision,
|
|
464
450
|
roundToPrecision,
|
|
465
451
|
rqbQuerySchemaValidator,
|
|
466
|
-
saveCriteriaBasedFilter,
|
|
467
452
|
saveExpertFilter,
|
|
468
453
|
saveExplicitNamingFilter,
|
|
469
454
|
saveFilter,
|
|
@@ -494,8 +479,10 @@ export {
|
|
|
494
479
|
useDebounce,
|
|
495
480
|
useElementSearch,
|
|
496
481
|
useIntlRef,
|
|
482
|
+
useListenerManager,
|
|
497
483
|
useLocalizedCountries,
|
|
498
484
|
useModificationLabelComputer,
|
|
485
|
+
useNotificationsListener,
|
|
499
486
|
usePredefinedProperties,
|
|
500
487
|
usePrevious,
|
|
501
488
|
useSnackMessage,
|
|
@@ -19,8 +19,7 @@ const filterEn = {
|
|
|
19
19
|
betweenRule: "Left value of 'between' rule have to be lower than the right value",
|
|
20
20
|
emptyGroup: "Filter contains an empty group. Consider removing it or adding rules to this group",
|
|
21
21
|
Hvdc: "HVDC",
|
|
22
|
-
"filter.
|
|
23
|
-
"filter.expert": "Expert",
|
|
22
|
+
"filter.expert": "Criteria based",
|
|
24
23
|
"filter.explicitNaming": "Explicit naming",
|
|
25
24
|
nameEmpty: "The name is empty",
|
|
26
25
|
equipmentType: "Equipment type",
|
|
@@ -58,5 +58,5 @@ export declare const networkModificationsEn: {
|
|
|
58
58
|
'network_modifications.TABULAR_CREATION': string;
|
|
59
59
|
'network_modifications.tabular.GENERATOR_CREATION': string;
|
|
60
60
|
'network_modifications.LCC_CREATION': string;
|
|
61
|
-
'network_modifications.
|
|
61
|
+
'network_modifications.STATIC_VAR_COMPENSATOR_CREATION': string;
|
|
62
62
|
};
|
|
@@ -52,7 +52,7 @@ const networkModificationsEn = {
|
|
|
52
52
|
"network_modifications.TABULAR_CREATION": "Tabular creation - {computedLabel}",
|
|
53
53
|
"network_modifications.tabular.GENERATOR_CREATION": "generator creations",
|
|
54
54
|
"network_modifications.LCC_CREATION": "Creating HVDC (LCC) {computedLabel}",
|
|
55
|
-
"network_modifications.
|
|
55
|
+
"network_modifications.STATIC_VAR_COMPENSATOR_CREATION": "Creating static var compensator {computedLabel}"
|
|
56
56
|
};
|
|
57
57
|
export {
|
|
58
58
|
networkModificationsEn
|
|
@@ -19,8 +19,7 @@ const filterFr = {
|
|
|
19
19
|
betweenRule: "La valeur de gauche d'une règle 'entre' doit être inférieure à la valeur de droite",
|
|
20
20
|
emptyGroup: "Le filtre contient un groupe vide. Supprimez le ou ajoutez des règles à ce groupe",
|
|
21
21
|
Hvdc: "HVDC",
|
|
22
|
-
"filter.
|
|
23
|
-
"filter.expert": "Expert",
|
|
22
|
+
"filter.expert": "Par critères",
|
|
24
23
|
"filter.explicitNaming": "Par nommage",
|
|
25
24
|
nameEmpty: "Le nom est vide",
|
|
26
25
|
equipmentType: "Type d'ouvrage",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Calculate, Settings, Article, NoteAlt, OfflineBolt, Photo, PhotoLibrary } from "@mui/icons-material";
|
|
2
|
+
import { TableView, Calculate, Settings, Article, NoteAlt, OfflineBolt, Photo, PhotoLibrary } from "@mui/icons-material";
|
|
3
3
|
import { ElementType } from "../types/elementType.js";
|
|
4
4
|
function getFileIcon(type, style) {
|
|
5
5
|
switch (type) {
|
|
@@ -22,6 +22,8 @@ function getFileIcon(type, style) {
|
|
|
22
22
|
return /* @__PURE__ */ jsx(Settings, { sx: style });
|
|
23
23
|
case ElementType.SPREADSHEET_CONFIG:
|
|
24
24
|
return /* @__PURE__ */ jsx(Calculate, { sx: style });
|
|
25
|
+
case ElementType.SPREADSHEET_CONFIG_COLLECTION:
|
|
26
|
+
return /* @__PURE__ */ jsx(TableView, { sx: style });
|
|
25
27
|
case ElementType.DIRECTORY:
|
|
26
28
|
return void 0;
|
|
27
29
|
default:
|
|
@@ -13,6 +13,7 @@ export declare enum ElementType {
|
|
|
13
13
|
LOADFLOW_PARAMETERS = "LOADFLOW_PARAMETERS",
|
|
14
14
|
SENSITIVITY_PARAMETERS = "SENSITIVITY_PARAMETERS",
|
|
15
15
|
SHORT_CIRCUIT_PARAMETERS = "SHORT_CIRCUIT_PARAMETERS",
|
|
16
|
-
SPREADSHEET_CONFIG = "SPREADSHEET_CONFIG"
|
|
16
|
+
SPREADSHEET_CONFIG = "SPREADSHEET_CONFIG",
|
|
17
|
+
SPREADSHEET_CONFIG_COLLECTION = "SPREADSHEET_CONFIG_COLLECTION"
|
|
17
18
|
}
|
|
18
19
|
export type ElementExistsType = (directory: UUID, value: string, elementType: ElementType) => Promise<boolean>;
|
|
@@ -12,6 +12,7 @@ var ElementType = /* @__PURE__ */ ((ElementType2) => {
|
|
|
12
12
|
ElementType2["SENSITIVITY_PARAMETERS"] = "SENSITIVITY_PARAMETERS";
|
|
13
13
|
ElementType2["SHORT_CIRCUIT_PARAMETERS"] = "SHORT_CIRCUIT_PARAMETERS";
|
|
14
14
|
ElementType2["SPREADSHEET_CONFIG"] = "SPREADSHEET_CONFIG";
|
|
15
|
+
ElementType2["SPREADSHEET_CONFIG_COLLECTION"] = "SPREADSHEET_CONFIG_COLLECTION";
|
|
15
16
|
return ElementType2;
|
|
16
17
|
})(ElementType || {});
|
|
17
18
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridsuite/commons-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.0",
|
|
4
4
|
"description": "common react components for gridsuite applications",
|
|
5
5
|
"engines": {
|
|
6
6
|
"npm": ">=9",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"react-dnd-html5-backend": "^16.0.1",
|
|
44
44
|
"react-querybuilder": "^7.2.0",
|
|
45
45
|
"react-virtualized": "^9.22.5",
|
|
46
|
+
"reconnecting-websocket": "^4.4.0",
|
|
46
47
|
"uuid": "^9.0.1"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ItemSelectionForCopy } from '../filter.type';
|
|
2
|
-
import { ElementExistsType } from '../../../utils/types/elementType';
|
|
3
|
-
import { UUID } from 'crypto';
|
|
4
|
-
|
|
5
|
-
export interface CriteriaBasedFilterEditionDialogProps {
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
titleId: string;
|
|
9
|
-
open: boolean;
|
|
10
|
-
onClose: () => void;
|
|
11
|
-
broadcastChannel: BroadcastChannel;
|
|
12
|
-
getFilterById: (id: string) => Promise<any>;
|
|
13
|
-
itemSelectionForCopy: ItemSelectionForCopy;
|
|
14
|
-
setItemSelectionForCopy: (selection: ItemSelectionForCopy) => void;
|
|
15
|
-
activeDirectory?: UUID;
|
|
16
|
-
elementExists?: ElementExistsType;
|
|
17
|
-
language?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare function CriteriaBasedFilterEditionDialog({ id, name, titleId, open, onClose, broadcastChannel, getFilterById, itemSelectionForCopy, setItemSelectionForCopy, activeDirectory, elementExists, language, }: Readonly<CriteriaBasedFilterEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
3
|
-
import { useState, useEffect, useCallback } from "react";
|
|
4
|
-
import { useForm } from "react-hook-form";
|
|
5
|
-
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
6
|
-
import { saveFilter } from "../../../services/explore.js";
|
|
7
|
-
import { FetchStatus } from "../../../utils/constants/fetchStatus.js";
|
|
8
|
-
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
9
|
-
import "../../../utils/yupConfig.js";
|
|
10
|
-
import { CustomMuiDialog } from "../../dialogs/customMuiDialog/CustomMuiDialog.js";
|
|
11
|
-
import { FilterForm } from "../FilterForm.js";
|
|
12
|
-
import { FilterType, NO_ITEM_SELECTION_FOR_COPY } from "../constants/FilterConstants.js";
|
|
13
|
-
import { criteriaBasedFilterSchema } from "./CriteriaBasedFilterForm.js";
|
|
14
|
-
import { backToFrontTweak, frontToBackTweak } from "./criteriaBasedFilterUtils.js";
|
|
15
|
-
import * as yup from "yup";
|
|
16
|
-
const formSchema = yup.object().shape({
|
|
17
|
-
[FieldConstants.NAME]: yup.string().trim().required("nameEmpty"),
|
|
18
|
-
[FieldConstants.FILTER_TYPE]: yup.string().required(),
|
|
19
|
-
[FieldConstants.EQUIPMENT_TYPE]: yup.string().required(),
|
|
20
|
-
...criteriaBasedFilterSchema
|
|
21
|
-
}).required();
|
|
22
|
-
function CriteriaBasedFilterEditionDialog({
|
|
23
|
-
id,
|
|
24
|
-
name,
|
|
25
|
-
titleId,
|
|
26
|
-
open,
|
|
27
|
-
onClose,
|
|
28
|
-
broadcastChannel,
|
|
29
|
-
getFilterById,
|
|
30
|
-
itemSelectionForCopy,
|
|
31
|
-
setItemSelectionForCopy,
|
|
32
|
-
activeDirectory,
|
|
33
|
-
elementExists,
|
|
34
|
-
language
|
|
35
|
-
}) {
|
|
36
|
-
var _a;
|
|
37
|
-
const { snackError } = useSnackMessage();
|
|
38
|
-
const [dataFetchStatus, setDataFetchStatus] = useState(FetchStatus.IDLE);
|
|
39
|
-
const formMethods = useForm({
|
|
40
|
-
resolver: yupResolver(formSchema)
|
|
41
|
-
});
|
|
42
|
-
const {
|
|
43
|
-
reset,
|
|
44
|
-
formState: { errors }
|
|
45
|
-
} = formMethods;
|
|
46
|
-
const nameError = errors[FieldConstants.NAME];
|
|
47
|
-
const isValidating = (_a = errors.root) == null ? void 0 : _a.isValidating;
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
if (id && open) {
|
|
50
|
-
setDataFetchStatus(FetchStatus.FETCHING);
|
|
51
|
-
getFilterById(id).then((response) => {
|
|
52
|
-
setDataFetchStatus(FetchStatus.FETCH_SUCCESS);
|
|
53
|
-
reset({
|
|
54
|
-
[FieldConstants.NAME]: name,
|
|
55
|
-
[FieldConstants.FILTER_TYPE]: FilterType.CRITERIA_BASED.id,
|
|
56
|
-
...backToFrontTweak(response)
|
|
57
|
-
});
|
|
58
|
-
}).catch((error) => {
|
|
59
|
-
setDataFetchStatus(FetchStatus.FETCH_ERROR);
|
|
60
|
-
snackError({
|
|
61
|
-
messageTxt: error.message,
|
|
62
|
-
headerId: "cannotRetrieveFilter"
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}, [id, name, open, reset, snackError, getFilterById]);
|
|
67
|
-
const onSubmit = useCallback(
|
|
68
|
-
(filterForm) => {
|
|
69
|
-
saveFilter(frontToBackTweak(id, filterForm), filterForm[FieldConstants.NAME]).then(() => {
|
|
70
|
-
if (itemSelectionForCopy.sourceItemUuid === id) {
|
|
71
|
-
setItemSelectionForCopy(NO_ITEM_SELECTION_FOR_COPY);
|
|
72
|
-
broadcastChannel.postMessage({ NO_SELECTION_FOR_COPY: NO_ITEM_SELECTION_FOR_COPY });
|
|
73
|
-
}
|
|
74
|
-
}).catch((error) => {
|
|
75
|
-
snackError({
|
|
76
|
-
messageTxt: error.message
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
[broadcastChannel, id, itemSelectionForCopy.sourceItemUuid, snackError, setItemSelectionForCopy]
|
|
81
|
-
);
|
|
82
|
-
const isDataReady = dataFetchStatus === FetchStatus.FETCH_SUCCESS;
|
|
83
|
-
return /* @__PURE__ */ jsx(
|
|
84
|
-
CustomMuiDialog,
|
|
85
|
-
{
|
|
86
|
-
open,
|
|
87
|
-
onClose,
|
|
88
|
-
onSave: onSubmit,
|
|
89
|
-
formSchema,
|
|
90
|
-
formMethods,
|
|
91
|
-
titleId,
|
|
92
|
-
removeOptional: true,
|
|
93
|
-
disabledSave: !!nameError || !!isValidating,
|
|
94
|
-
isDataFetching: dataFetchStatus === FetchStatus.FETCHING,
|
|
95
|
-
language,
|
|
96
|
-
unscrollableFullHeight: true,
|
|
97
|
-
children: isDataReady && /* @__PURE__ */ jsx(FilterForm, { activeDirectory, elementExists })
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
export {
|
|
102
|
-
CriteriaBasedFilterEditionDialog
|
|
103
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { default as yup } from '../../../utils/yupConfig';
|
|
2
|
-
|
|
3
|
-
export declare const criteriaBasedFilterSchema: {
|
|
4
|
-
readonly criteriaBased: yup.ObjectSchema<{
|
|
5
|
-
nominalVoltage3: {
|
|
6
|
-
value1: number | null;
|
|
7
|
-
value2: number | null;
|
|
8
|
-
type: string;
|
|
9
|
-
};
|
|
10
|
-
nominalVoltage2: {
|
|
11
|
-
value1: number | null;
|
|
12
|
-
value2: number | null;
|
|
13
|
-
type: string;
|
|
14
|
-
};
|
|
15
|
-
nominalVoltage1: {
|
|
16
|
-
value1: number | null;
|
|
17
|
-
value2: number | null;
|
|
18
|
-
type: string;
|
|
19
|
-
};
|
|
20
|
-
nominalVoltage: {
|
|
21
|
-
value1: number | null;
|
|
22
|
-
value2: number | null;
|
|
23
|
-
type: string;
|
|
24
|
-
};
|
|
25
|
-
countries: string[] | undefined;
|
|
26
|
-
countries1: string[] | undefined;
|
|
27
|
-
countries2: string[] | undefined;
|
|
28
|
-
}, yup.AnyObject, {
|
|
29
|
-
nominalVoltage3: any;
|
|
30
|
-
nominalVoltage2: any;
|
|
31
|
-
nominalVoltage1: any;
|
|
32
|
-
nominalVoltage: any;
|
|
33
|
-
countries: "";
|
|
34
|
-
countries1: "";
|
|
35
|
-
countries2: "";
|
|
36
|
-
}, "">;
|
|
37
|
-
};
|
|
38
|
-
export declare const criteriaBasedFilterEmptyFormData: {
|
|
39
|
-
readonly criteriaBased: {
|
|
40
|
-
readonly countries: any;
|
|
41
|
-
readonly countries1: any;
|
|
42
|
-
readonly countries2: any;
|
|
43
|
-
readonly nominalVoltage: any;
|
|
44
|
-
readonly nominalVoltage1: any;
|
|
45
|
-
readonly nominalVoltage2: any;
|
|
46
|
-
readonly nominalVoltage3: any;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
export declare function CriteriaBasedFilterForm(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { filterPropertiesYupSchema, FilterProperties } from "./FilterProperties.js";
|
|
3
|
-
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
4
|
-
import "../../../utils/yupConfig.js";
|
|
5
|
-
import { CriteriaBasedForm } from "./CriteriaBasedForm.js";
|
|
6
|
-
import { getCriteriaBasedSchema, getCriteriaBasedFormData } from "./criteriaBasedFilterUtils.js";
|
|
7
|
-
import { FILTER_EQUIPMENTS } from "../utils/filterFormUtils.js";
|
|
8
|
-
import { FreePropertiesTypes } from "./FilterFreeProperties.js";
|
|
9
|
-
import * as yup from "yup";
|
|
10
|
-
const criteriaBasedFilterSchema = getCriteriaBasedSchema({
|
|
11
|
-
[FieldConstants.ENERGY_SOURCE]: yup.string().nullable(),
|
|
12
|
-
...filterPropertiesYupSchema
|
|
13
|
-
});
|
|
14
|
-
const criteriaBasedFilterEmptyFormData = getCriteriaBasedFormData(void 0, {
|
|
15
|
-
[FieldConstants.ENERGY_SOURCE]: null,
|
|
16
|
-
[FreePropertiesTypes.SUBSTATION_FILTER_PROPERTIES]: [],
|
|
17
|
-
[FreePropertiesTypes.FREE_FILTER_PROPERTIES]: []
|
|
18
|
-
});
|
|
19
|
-
function CriteriaBasedFilterForm() {
|
|
20
|
-
return /* @__PURE__ */ jsx(
|
|
21
|
-
CriteriaBasedForm,
|
|
22
|
-
{
|
|
23
|
-
equipments: FILTER_EQUIPMENTS,
|
|
24
|
-
defaultValues: criteriaBasedFilterEmptyFormData[FieldConstants.CRITERIA_BASED],
|
|
25
|
-
children: /* @__PURE__ */ jsx(FilterProperties, {})
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
CriteriaBasedFilterForm,
|
|
31
|
-
criteriaBasedFilterEmptyFormData,
|
|
32
|
-
criteriaBasedFilterSchema
|
|
33
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PredefinedProperties } from '../../../utils/types/types';
|
|
2
|
-
|
|
3
|
-
export declare enum FreePropertiesTypes {
|
|
4
|
-
SUBSTATION_FILTER_PROPERTIES = "substationFreeProperties",
|
|
5
|
-
FREE_FILTER_PROPERTIES = "freeProperties"
|
|
6
|
-
}
|
|
7
|
-
interface FilterFreePropertiesProps {
|
|
8
|
-
freePropertiesType: FreePropertiesTypes;
|
|
9
|
-
predefined: PredefinedProperties;
|
|
10
|
-
}
|
|
11
|
-
export declare function FilterFreeProperties({ freePropertiesType, predefined }: FilterFreePropertiesProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Grid, ListItem, Button } from "@mui/material";
|
|
3
|
-
import { useWatch, useFieldArray } from "react-hook-form";
|
|
4
|
-
import { FormattedMessage } from "react-intl";
|
|
5
|
-
import AddIcon from "@mui/icons-material/Add";
|
|
6
|
-
import { useMemo } from "react";
|
|
7
|
-
import { ErrorInput } from "../../inputs/reactHookForm/errorManagement/ErrorInput.js";
|
|
8
|
-
import { FieldErrorAlert } from "../../inputs/reactHookForm/errorManagement/FieldErrorAlert.js";
|
|
9
|
-
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
10
|
-
import { FilterProperty, PROPERTY_NAME, PROPERTY_VALUES_1, PROPERTY_VALUES_2, PROPERTY_VALUES } from "./FilterProperty.js";
|
|
11
|
-
import { Line, Hvdc } from "../../../utils/types/equipmentTypes.js";
|
|
12
|
-
var FreePropertiesTypes = /* @__PURE__ */ ((FreePropertiesTypes2) => {
|
|
13
|
-
FreePropertiesTypes2["SUBSTATION_FILTER_PROPERTIES"] = "substationFreeProperties";
|
|
14
|
-
FreePropertiesTypes2["FREE_FILTER_PROPERTIES"] = "freeProperties";
|
|
15
|
-
return FreePropertiesTypes2;
|
|
16
|
-
})(FreePropertiesTypes || {});
|
|
17
|
-
function FilterFreeProperties({ freePropertiesType, predefined }) {
|
|
18
|
-
const watchEquipmentType = useWatch({
|
|
19
|
-
name: FieldConstants.EQUIPMENT_TYPE
|
|
20
|
-
});
|
|
21
|
-
const isForLineOrHvdcLineSubstation = (watchEquipmentType === Line.type || watchEquipmentType === Hvdc.type) && freePropertiesType === "substationFreeProperties";
|
|
22
|
-
const fieldName = `${FieldConstants.CRITERIA_BASED}.${freePropertiesType}`;
|
|
23
|
-
const {
|
|
24
|
-
fields: filterProperties,
|
|
25
|
-
// don't use it to access form data ! check doc,
|
|
26
|
-
append,
|
|
27
|
-
remove
|
|
28
|
-
} = useFieldArray({
|
|
29
|
-
name: fieldName
|
|
30
|
-
});
|
|
31
|
-
function addNewProp() {
|
|
32
|
-
if (isForLineOrHvdcLineSubstation) {
|
|
33
|
-
append({
|
|
34
|
-
[PROPERTY_NAME]: null,
|
|
35
|
-
[PROPERTY_VALUES_1]: [],
|
|
36
|
-
[PROPERTY_VALUES_2]: []
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
append({ [PROPERTY_NAME]: null, [PROPERTY_VALUES]: [] });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const valuesFields = isForLineOrHvdcLineSubstation ? [
|
|
43
|
-
{ name: PROPERTY_VALUES_1, label: "PropertyValues1" },
|
|
44
|
-
{ name: PROPERTY_VALUES_2, label: "PropertyValues2" }
|
|
45
|
-
] : [{ name: PROPERTY_VALUES, label: "PropertyValues" }];
|
|
46
|
-
const title = useMemo(() => {
|
|
47
|
-
return freePropertiesType === "freeProperties" ? "FreeProps" : "SubstationFreeProps";
|
|
48
|
-
}, [freePropertiesType]);
|
|
49
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
-
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(FormattedMessage, { id: title, children: (formattedTitle) => /* @__PURE__ */ jsx("h4", { children: formattedTitle }) }) }),
|
|
51
|
-
filterProperties.map((prop, index) => /* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsx(
|
|
52
|
-
FilterProperty,
|
|
53
|
-
{
|
|
54
|
-
index,
|
|
55
|
-
valuesFields,
|
|
56
|
-
predefined,
|
|
57
|
-
handleDelete: remove,
|
|
58
|
-
propertyType: freePropertiesType
|
|
59
|
-
}
|
|
60
|
-
) }, prop.id)),
|
|
61
|
-
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Button, { startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: () => addNewProp(), children: /* @__PURE__ */ jsx(FormattedMessage, { id: "AddFreePropCrit" }) }) }),
|
|
62
|
-
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(ErrorInput, { name: fieldName, InputField: FieldErrorAlert }) })
|
|
63
|
-
] });
|
|
64
|
-
}
|
|
65
|
-
export {
|
|
66
|
-
FilterFreeProperties,
|
|
67
|
-
FreePropertiesTypes
|
|
68
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { default as yup } from '../../../utils/yupConfig';
|
|
2
|
-
|
|
3
|
-
export declare const filterPropertiesYupSchema: {
|
|
4
|
-
substationFreeProperties: yup.ArraySchema<{
|
|
5
|
-
prop_values?: (string | undefined)[] | undefined;
|
|
6
|
-
prop_values1?: (string | undefined)[] | undefined;
|
|
7
|
-
prop_values2?: (string | undefined)[] | undefined;
|
|
8
|
-
name_property: string;
|
|
9
|
-
}[] | undefined, yup.AnyObject, "", "">;
|
|
10
|
-
freeProperties: yup.ArraySchema<{
|
|
11
|
-
prop_values?: (string | undefined)[] | undefined;
|
|
12
|
-
name_property: string;
|
|
13
|
-
}[] | undefined, yup.AnyObject, "", "">;
|
|
14
|
-
};
|
|
15
|
-
export declare function FilterProperties(): any;
|