@gridsuite/commons-ui 0.77.0 → 0.77.2

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.
@@ -5,7 +5,6 @@ import { formatQuery } from "react-querybuilder";
5
5
  import { useFormContext, useWatch } from "react-hook-form";
6
6
  import * as yup from "yup";
7
7
  import { v4 } from "uuid";
8
- import { useIntl } from "react-intl";
9
8
  import { Box } from "@mui/material";
10
9
  import { testQuery } from "./expertFilterUtils.js";
11
10
  import { COMBINATOR_OPTIONS, OPERATOR_OPTIONS, EXPERT_FILTER_EQUIPMENTS, RULES, EXPERT_FILTER_FIELDS } from "./expertFilterConstants.js";
@@ -16,6 +15,7 @@ import { FilterType } from "../constants/FilterConstants.js";
16
15
  import { CustomReactQueryBuilder } from "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
17
16
  import { unscrollableDialogStyles } from "../../dialogs/customMuiDialog/CustomMuiDialog.js";
18
17
  import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
18
+ import "react-intl";
19
19
  import "@mui/icons-material";
20
20
  import "../../treeViewFinder/TreeViewFinder.js";
21
21
  import "notistack";
@@ -26,6 +26,7 @@ import "@mui/material/DialogActions";
26
26
  import "@mui/material/Button";
27
27
  import "@mui/material/styles";
28
28
  import { FieldType } from "../../../utils/types/fieldType.js";
29
+ import { useFormatLabelWithUnit } from "../../../hooks/useFormatLabelWithUnit.js";
29
30
  yup.setLocale({
30
31
  mixed: {
31
32
  required: "YupRequired",
@@ -76,7 +77,6 @@ function getExpertFilterEmptyFormData() {
76
77
  };
77
78
  }
78
79
  function ExpertFilterForm() {
79
- const intl = useIntl();
80
80
  const { getValues, setValue } = useFormContext();
81
81
  const openConfirmationPopup = useCallback(() => {
82
82
  return formatQuery(getValues(EXPERT_FILTER_QUERY), "json_without_ids") !== formatQuery(defaultQuery, "json_without_ids");
@@ -87,15 +87,16 @@ function ExpertFilterForm() {
87
87
  const watchEquipmentType = useWatch({
88
88
  name: FieldConstants.EQUIPMENT_TYPE
89
89
  });
90
+ const formatLabelWithUnit = useFormatLabelWithUnit();
90
91
  const translatedFields = useMemo(() => {
91
92
  var _a;
92
93
  return (_a = EXPERT_FILTER_FIELDS[watchEquipmentType]) == null ? void 0 : _a.map((field) => {
93
94
  return {
94
95
  ...field,
95
- label: intl.formatMessage({ id: field.label })
96
+ label: formatLabelWithUnit(field)
96
97
  };
97
98
  });
98
- }, [intl, watchEquipmentType]);
99
+ }, [formatLabelWithUnit, watchEquipmentType]);
99
100
  return /* @__PURE__ */ jsxs(Fragment, { children: [
100
101
  /* @__PURE__ */ jsx(Box, { sx: unscrollableDialogStyles.unscrollableHeader, children: /* @__PURE__ */ jsx(
101
102
  InputWithPopupConfirmation,
@@ -196,36 +196,42 @@ export declare const FIELDS_OPTIONS: {
196
196
  NOMINAL_VOLTAGE: {
197
197
  name: FieldType;
198
198
  label: string;
199
+ unit: string;
199
200
  dataType: DataType;
200
201
  inputType: string;
201
202
  };
202
203
  MIN_P: {
203
204
  name: FieldType;
204
205
  label: string;
206
+ unit: string;
205
207
  dataType: DataType;
206
208
  inputType: string;
207
209
  };
208
210
  MAX_P: {
209
211
  name: FieldType;
210
212
  label: string;
213
+ unit: string;
211
214
  dataType: DataType;
212
215
  inputType: string;
213
216
  };
214
217
  TARGET_P: {
215
218
  name: FieldType;
216
219
  label: string;
220
+ unit: string;
217
221
  dataType: DataType;
218
222
  inputType: string;
219
223
  };
220
224
  TARGET_V: {
221
225
  name: FieldType;
222
226
  label: string;
227
+ unit: string;
223
228
  dataType: DataType;
224
229
  inputType: string;
225
230
  };
226
231
  TARGET_Q: {
227
232
  name: FieldType;
228
233
  label: string;
234
+ unit: string;
229
235
  dataType: DataType;
230
236
  inputType: string;
231
237
  };
@@ -256,6 +262,7 @@ export declare const FIELDS_OPTIONS: {
256
262
  PLANNED_ACTIVE_POWER_SET_POINT: {
257
263
  name: FieldType;
258
264
  label: string;
265
+ unit: string;
259
266
  dataType: DataType;
260
267
  inputType: string;
261
268
  };
@@ -269,24 +276,28 @@ export declare const FIELDS_OPTIONS: {
269
276
  RATED_S: {
270
277
  name: FieldType;
271
278
  label: string;
279
+ unit: string;
272
280
  dataType: DataType;
273
281
  inputType: string;
274
282
  };
275
283
  RATED_S1: {
276
284
  name: FieldType;
277
285
  label: string;
286
+ unit: string;
278
287
  dataType: DataType;
279
288
  inputType: string;
280
289
  };
281
290
  RATED_S2: {
282
291
  name: FieldType;
283
292
  label: string;
293
+ unit: string;
284
294
  dataType: DataType;
285
295
  inputType: string;
286
296
  };
287
297
  RATED_S3: {
288
298
  name: FieldType;
289
299
  label: string;
300
+ unit: string;
290
301
  dataType: DataType;
291
302
  inputType: string;
292
303
  };
@@ -316,24 +327,28 @@ export declare const FIELDS_OPTIONS: {
316
327
  P0: {
317
328
  name: FieldType;
318
329
  label: string;
330
+ unit: string;
319
331
  dataType: DataType;
320
332
  inputType: string;
321
333
  };
322
334
  Q0: {
323
335
  name: FieldType;
324
336
  label: string;
337
+ unit: string;
325
338
  dataType: DataType;
326
339
  inputType: string;
327
340
  };
328
341
  LOW_VOLTAGE_LIMIT: {
329
342
  name: FieldType;
330
343
  label: string;
344
+ unit: string;
331
345
  dataType: DataType;
332
346
  inputType: string;
333
347
  };
334
348
  HIGH_VOLTAGE_LIMIT: {
335
349
  name: FieldType;
336
350
  label: string;
351
+ unit: string;
337
352
  dataType: DataType;
338
353
  inputType: string;
339
354
  };
@@ -363,42 +378,49 @@ export declare const FIELDS_OPTIONS: {
363
378
  MAX_Q_AT_NOMINAL_V: {
364
379
  name: FieldType;
365
380
  label: string;
381
+ unit: string;
366
382
  dataType: DataType;
367
383
  inputType: string;
368
384
  };
369
385
  MIN_Q_AT_NOMINAL_V: {
370
386
  name: FieldType;
371
387
  label: string;
388
+ unit: string;
372
389
  dataType: DataType;
373
390
  inputType: string;
374
391
  };
375
392
  FIX_Q_AT_NOMINAL_V: {
376
393
  name: FieldType;
377
394
  label: string;
395
+ unit: string;
378
396
  dataType: DataType;
379
397
  inputType: string;
380
398
  };
381
399
  SWITCHED_ON_Q_AT_NOMINAL_V: {
382
400
  name: FieldType;
383
401
  label: string;
402
+ unit: string;
384
403
  dataType: DataType;
385
404
  inputType: string;
386
405
  };
387
406
  MAX_SUSCEPTANCE: {
388
407
  name: FieldType;
389
408
  label: string;
409
+ unit: string;
390
410
  dataType: DataType;
391
411
  inputType: string;
392
412
  };
393
413
  MIN_SUSCEPTANCE: {
394
414
  name: FieldType;
395
415
  label: string;
416
+ unit: string;
396
417
  dataType: DataType;
397
418
  inputType: string;
398
419
  };
399
420
  SWITCHED_ON_SUSCEPTANCE: {
400
421
  name: FieldType;
401
422
  label: string;
423
+ unit: string;
402
424
  dataType: DataType;
403
425
  inputType: string;
404
426
  };
@@ -441,42 +463,49 @@ export declare const FIELDS_OPTIONS: {
441
463
  NOMINAL_VOLTAGE_1: {
442
464
  name: FieldType;
443
465
  label: string;
466
+ unit: string;
444
467
  dataType: DataType;
445
468
  inputType: string;
446
469
  };
447
470
  NOMINAL_VOLTAGE_2: {
448
471
  name: FieldType;
449
472
  label: string;
473
+ unit: string;
450
474
  dataType: DataType;
451
475
  inputType: string;
452
476
  };
453
477
  NOMINAL_VOLTAGE_3: {
454
478
  name: FieldType;
455
479
  label: string;
480
+ unit: string;
456
481
  dataType: DataType;
457
482
  inputType: string;
458
483
  };
459
484
  RATED_VOLTAGE_1: {
460
485
  name: FieldType;
461
486
  label: string;
487
+ unit: string;
462
488
  dataType: DataType;
463
489
  inputType: string;
464
490
  };
465
491
  RATED_VOLTAGE_2: {
466
492
  name: FieldType;
467
493
  label: string;
494
+ unit: string;
468
495
  dataType: DataType;
469
496
  inputType: string;
470
497
  };
471
498
  RATED_VOLTAGE_0: {
472
499
  name: FieldType;
473
500
  label: string;
501
+ unit: string;
474
502
  dataType: DataType;
475
503
  inputType: string;
476
504
  };
477
505
  RATED_VOLTAGE_3: {
478
506
  name: FieldType;
479
507
  label: string;
508
+ unit: string;
480
509
  dataType: DataType;
481
510
  inputType: string;
482
511
  };
@@ -495,120 +524,140 @@ export declare const FIELDS_OPTIONS: {
495
524
  SERIE_RESISTANCE: {
496
525
  name: FieldType;
497
526
  label: string;
527
+ unit: string;
498
528
  dataType: DataType;
499
529
  inputType: string;
500
530
  };
501
531
  SERIE_RESISTANCE_1: {
502
532
  name: FieldType;
503
533
  label: string;
534
+ unit: string;
504
535
  dataType: DataType;
505
536
  inputType: string;
506
537
  };
507
538
  SERIE_RESISTANCE_2: {
508
539
  name: FieldType;
509
540
  label: string;
541
+ unit: string;
510
542
  dataType: DataType;
511
543
  inputType: string;
512
544
  };
513
545
  SERIE_RESISTANCE_3: {
514
546
  name: FieldType;
515
547
  label: string;
548
+ unit: string;
516
549
  dataType: DataType;
517
550
  inputType: string;
518
551
  };
519
552
  SERIE_REACTANCE: {
520
553
  name: FieldType;
521
554
  label: string;
555
+ unit: string;
522
556
  dataType: DataType;
523
557
  inputType: string;
524
558
  };
525
559
  SERIE_REACTANCE_1: {
526
560
  name: FieldType;
527
561
  label: string;
562
+ unit: string;
528
563
  dataType: DataType;
529
564
  inputType: string;
530
565
  };
531
566
  SERIE_REACTANCE_2: {
532
567
  name: FieldType;
533
568
  label: string;
569
+ unit: string;
534
570
  dataType: DataType;
535
571
  inputType: string;
536
572
  };
537
573
  SERIE_REACTANCE_3: {
538
574
  name: FieldType;
539
575
  label: string;
576
+ unit: string;
540
577
  dataType: DataType;
541
578
  inputType: string;
542
579
  };
543
580
  SHUNT_CONDUCTANCE_1: {
544
581
  name: FieldType;
545
582
  label: string;
583
+ unit: string;
546
584
  dataType: DataType;
547
585
  inputType: string;
548
586
  };
549
587
  SHUNT_CONDUCTANCE_2: {
550
588
  name: FieldType;
551
589
  label: string;
590
+ unit: string;
552
591
  dataType: DataType;
553
592
  inputType: string;
554
593
  };
555
594
  SHUNT_SUSCEPTANCE_1: {
556
595
  name: FieldType;
557
596
  label: string;
597
+ unit: string;
558
598
  dataType: DataType;
559
599
  inputType: string;
560
600
  };
561
601
  SHUNT_SUSCEPTANCE_2: {
562
602
  name: FieldType;
563
603
  label: string;
604
+ unit: string;
564
605
  dataType: DataType;
565
606
  inputType: string;
566
607
  };
567
608
  MAGNETIZING_CONDUCTANCE: {
568
609
  name: FieldType;
569
610
  label: string;
611
+ unit: string;
570
612
  dataType: DataType;
571
613
  inputType: string;
572
614
  };
573
615
  MAGNETIZING_CONDUCTANCE_1: {
574
616
  name: FieldType;
575
617
  label: string;
618
+ unit: string;
576
619
  dataType: DataType;
577
620
  inputType: string;
578
621
  };
579
622
  MAGNETIZING_CONDUCTANCE_2: {
580
623
  name: FieldType;
581
624
  label: string;
625
+ unit: string;
582
626
  dataType: DataType;
583
627
  inputType: string;
584
628
  };
585
629
  MAGNETIZING_CONDUCTANCE_3: {
586
630
  name: FieldType;
587
631
  label: string;
632
+ unit: string;
588
633
  dataType: DataType;
589
634
  inputType: string;
590
635
  };
591
636
  MAGNETIZING_SUSCEPTANCE: {
592
637
  name: FieldType;
593
638
  label: string;
639
+ unit: string;
594
640
  dataType: DataType;
595
641
  inputType: string;
596
642
  };
597
643
  MAGNETIZING_SUSCEPTANCE_1: {
598
644
  name: FieldType;
599
645
  label: string;
646
+ unit: string;
600
647
  dataType: DataType;
601
648
  inputType: string;
602
649
  };
603
650
  MAGNETIZING_SUSCEPTANCE_2: {
604
651
  name: FieldType;
605
652
  label: string;
653
+ unit: string;
606
654
  dataType: DataType;
607
655
  inputType: string;
608
656
  };
609
657
  MAGNETIZING_SUSCEPTANCE_3: {
610
658
  name: FieldType;
611
659
  label: string;
660
+ unit: string;
612
661
  dataType: DataType;
613
662
  inputType: string;
614
663
  };
@@ -726,24 +775,28 @@ export declare const FIELDS_OPTIONS: {
726
775
  RATIO_TARGET_V: {
727
776
  name: FieldType;
728
777
  label: string;
778
+ unit: string;
729
779
  dataType: DataType;
730
780
  inputType: string;
731
781
  };
732
782
  RATIO_TARGET_V1: {
733
783
  name: FieldType;
734
784
  label: string;
785
+ unit: string;
735
786
  dataType: DataType;
736
787
  inputType: string;
737
788
  };
738
789
  RATIO_TARGET_V2: {
739
790
  name: FieldType;
740
791
  label: string;
792
+ unit: string;
741
793
  dataType: DataType;
742
794
  inputType: string;
743
795
  };
744
796
  RATIO_TARGET_V3: {
745
797
  name: FieldType;
746
798
  label: string;
799
+ unit: string;
747
800
  dataType: DataType;
748
801
  inputType: string;
749
802
  };
@@ -913,18 +966,21 @@ export declare const FIELDS_OPTIONS: {
913
966
  VOLTAGE_SET_POINT: {
914
967
  name: FieldType;
915
968
  label: string;
969
+ unit: string;
916
970
  dataType: DataType;
917
971
  inputType: string;
918
972
  };
919
973
  ACTIVE_POWER_SET_POINT: {
920
974
  name: FieldType;
921
975
  label: string;
976
+ unit: string;
922
977
  dataType: DataType;
923
978
  inputType: string;
924
979
  };
925
980
  REACTIVE_POWER_SET_POINT: {
926
981
  name: FieldType;
927
982
  label: string;
983
+ unit: string;
928
984
  dataType: DataType;
929
985
  inputType: string;
930
986
  };
@@ -975,42 +1031,49 @@ export declare const FIELDS_OPTIONS: {
975
1031
  LOW_VOLTAGE_SET_POINT: {
976
1032
  name: FieldType;
977
1033
  label: string;
1034
+ unit: string;
978
1035
  dataType: DataType;
979
1036
  inputType: string;
980
1037
  };
981
1038
  HIGH_VOLTAGE_SET_POINT: {
982
1039
  name: FieldType;
983
1040
  label: string;
1041
+ unit: string;
984
1042
  dataType: DataType;
985
1043
  inputType: string;
986
1044
  };
987
1045
  LOW_VOLTAGE_THRESHOLD: {
988
1046
  name: FieldType;
989
1047
  label: string;
1048
+ unit: string;
990
1049
  dataType: DataType;
991
1050
  inputType: string;
992
1051
  };
993
1052
  HIGH_VOLTAGE_THRESHOLD: {
994
1053
  name: FieldType;
995
1054
  label: string;
1055
+ unit: string;
996
1056
  dataType: DataType;
997
1057
  inputType: string;
998
1058
  };
999
1059
  SUSCEPTANCE_FIX: {
1000
1060
  name: FieldType;
1001
1061
  label: string;
1062
+ unit: string;
1002
1063
  dataType: DataType;
1003
1064
  inputType: string;
1004
1065
  };
1005
1066
  SHUNT_SUSCEPTANCE: {
1006
1067
  name: FieldType;
1007
1068
  label: string;
1069
+ unit: string;
1008
1070
  dataType: DataType;
1009
1071
  inputType: string;
1010
1072
  };
1011
1073
  SHUNT_CONDUCTANCE: {
1012
1074
  name: FieldType;
1013
1075
  label: string;
1076
+ unit: string;
1014
1077
  dataType: DataType;
1015
1078
  inputType: string;
1016
1079
  };
@@ -1045,18 +1108,21 @@ export declare const FIELDS_OPTIONS: {
1045
1108
  CONVERTER_STATION_NOMINAL_VOLTAGE_1: {
1046
1109
  name: FieldType;
1047
1110
  label: string;
1111
+ unit: string;
1048
1112
  dataType: DataType;
1049
1113
  inputType: string;
1050
1114
  };
1051
1115
  CONVERTER_STATION_NOMINAL_VOLTAGE_2: {
1052
1116
  name: FieldType;
1053
1117
  label: string;
1118
+ unit: string;
1054
1119
  dataType: DataType;
1055
1120
  inputType: string;
1056
1121
  };
1057
1122
  DC_NOMINAL_VOLTAGE: {
1058
1123
  name: FieldType;
1059
1124
  label: string;
1125
+ unit: string;
1060
1126
  dataType: DataType;
1061
1127
  inputType: string;
1062
1128
  };
@@ -1073,12 +1139,14 @@ export declare const FIELDS_OPTIONS: {
1073
1139
  LOW_SHORT_CIRCUIT_CURRENT_LIMIT: {
1074
1140
  name: FieldType;
1075
1141
  label: string;
1142
+ unit: string;
1076
1143
  dataType: DataType;
1077
1144
  inputType: string;
1078
1145
  };
1079
1146
  HIGH_SHORT_CIRCUIT_CURRENT_LIMIT: {
1080
1147
  name: FieldType;
1081
1148
  label: string;
1149
+ unit: string;
1082
1150
  dataType: DataType;
1083
1151
  inputType: string;
1084
1152
  };