@gridsuite/commons-ui 0.72.3 → 0.74.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/README.md CHANGED
@@ -33,6 +33,7 @@ you need to follow the steps below:
33
33
  - [Make a release action](https://github.com/gridsuite/commons-ui/actions/workflows/release.yml)
34
34
  - In the 'run workflow' combobox select, let the branch on main
35
35
  - Enter the type of evolution (major | minor | patch)
36
+ - Enter your NPM access token (it must be an **automation** access token to bypass 2FA, see the [access token documentation](https://docs.npmjs.com/creating-and-viewing-access-tokens) for details)
36
37
  - Click 'run workflow'
37
38
 
38
39
  #### License Headers and dependencies checking
@@ -1,4 +1,4 @@
1
- import { SelectionForCopy } from '../filter.type';
1
+ import { ItemSelectionForCopy } from '../filter.type';
2
2
 
3
3
  export declare const DISTRIBUTION_KEY = "distributionKey";
4
4
  export declare const FilterType: {
@@ -15,4 +15,4 @@ export declare const FilterType: {
15
15
  label: string;
16
16
  };
17
17
  };
18
- export declare const NO_SELECTION_FOR_COPY: SelectionForCopy;
18
+ export declare const NO_ITEM_SELECTION_FOR_COPY: ItemSelectionForCopy;
@@ -4,7 +4,7 @@ const FilterType = {
4
4
  EXPLICIT_NAMING: { id: "IDENTIFIER_LIST", label: "filter.explicitNaming" },
5
5
  EXPERT: { id: "EXPERT", label: "filter.expert" }
6
6
  };
7
- const NO_SELECTION_FOR_COPY = {
7
+ const NO_ITEM_SELECTION_FOR_COPY = {
8
8
  sourceItemUuid: null,
9
9
  nameItem: null,
10
10
  descriptionItem: null,
@@ -15,5 +15,5 @@ const NO_SELECTION_FOR_COPY = {
15
15
  export {
16
16
  DISTRIBUTION_KEY,
17
17
  FilterType,
18
- NO_SELECTION_FOR_COPY
18
+ NO_ITEM_SELECTION_FOR_COPY
19
19
  };
@@ -1,4 +1,4 @@
1
- import { SelectionForCopy } from '../filter.type';
1
+ import { ItemSelectionForCopy } from '../filter.type';
2
2
  import { ElementExistsType } from '../../../utils/types/elementType';
3
3
  import { UUID } from 'crypto';
4
4
 
@@ -10,10 +10,10 @@ export interface CriteriaBasedFilterEditionDialogProps {
10
10
  onClose: () => void;
11
11
  broadcastChannel: BroadcastChannel;
12
12
  getFilterById: (id: string) => Promise<any>;
13
- selectionForCopy: SelectionForCopy;
14
- setSelectionForCopy: (selection: SelectionForCopy) => void;
13
+ itemSelectionForCopy: ItemSelectionForCopy;
14
+ setItemSelectionForCopy: (selection: ItemSelectionForCopy) => void;
15
15
  activeDirectory?: UUID;
16
16
  elementExists?: ElementExistsType;
17
17
  language?: string;
18
18
  }
19
- export declare function CriteriaBasedFilterEditionDialog({ id, name, titleId, open, onClose, broadcastChannel, getFilterById, selectionForCopy, setSelectionForCopy, activeDirectory, elementExists, language, }: Readonly<CriteriaBasedFilterEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
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;
@@ -9,7 +9,7 @@ import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
9
9
  import "../../../utils/yupConfig.js";
10
10
  import { CustomMuiDialog } from "../../dialogs/customMuiDialog/CustomMuiDialog.js";
11
11
  import { FilterForm } from "../FilterForm.js";
12
- import { FilterType, NO_SELECTION_FOR_COPY } from "../constants/FilterConstants.js";
12
+ import { FilterType, NO_ITEM_SELECTION_FOR_COPY } from "../constants/FilterConstants.js";
13
13
  import { criteriaBasedFilterSchema } from "./CriteriaBasedFilterForm.js";
14
14
  import { backToFrontTweak, frontToBackTweak } from "./criteriaBasedFilterUtils.js";
15
15
  import * as yup from "yup";
@@ -27,8 +27,8 @@ function CriteriaBasedFilterEditionDialog({
27
27
  onClose,
28
28
  broadcastChannel,
29
29
  getFilterById,
30
- selectionForCopy,
31
- setSelectionForCopy,
30
+ itemSelectionForCopy,
31
+ setItemSelectionForCopy,
32
32
  activeDirectory,
33
33
  elementExists,
34
34
  language
@@ -67,11 +67,9 @@ function CriteriaBasedFilterEditionDialog({
67
67
  const onSubmit = useCallback(
68
68
  (filterForm) => {
69
69
  saveFilter(frontToBackTweak(id, filterForm), filterForm[FieldConstants.NAME]).then(() => {
70
- if (selectionForCopy.sourceItemUuid === id) {
71
- setSelectionForCopy(NO_SELECTION_FOR_COPY);
72
- broadcastChannel.postMessage({
73
- NO_SELECTION_FOR_COPY
74
- });
70
+ if (itemSelectionForCopy.sourceItemUuid === id) {
71
+ setItemSelectionForCopy(NO_ITEM_SELECTION_FOR_COPY);
72
+ broadcastChannel.postMessage({ NO_SELECTION_FOR_COPY: NO_ITEM_SELECTION_FOR_COPY });
75
73
  }
76
74
  }).catch((error) => {
77
75
  snackError({
@@ -79,7 +77,7 @@ function CriteriaBasedFilterEditionDialog({
79
77
  });
80
78
  });
81
79
  },
82
- [broadcastChannel, id, selectionForCopy.sourceItemUuid, snackError, setSelectionForCopy]
80
+ [broadcastChannel, id, itemSelectionForCopy.sourceItemUuid, snackError, setItemSelectionForCopy]
83
81
  );
84
82
  const isDataReady = dataFetchStatus === FetchStatus.FETCH_SUCCESS;
85
83
  return /* @__PURE__ */ jsx(
@@ -1,4 +1,4 @@
1
- import { SelectionForCopy } from '../filter.type';
1
+ import { ItemSelectionForCopy } from '../filter.type';
2
2
  import { ElementExistsType } from '../../../utils/types/elementType';
3
3
  import { UUID } from 'crypto';
4
4
 
@@ -9,13 +9,13 @@ export interface ExpertFilterEditionDialogProps {
9
9
  open: boolean;
10
10
  onClose: () => void;
11
11
  broadcastChannel: BroadcastChannel;
12
- selectionForCopy: SelectionForCopy;
12
+ itemSelectionForCopy: ItemSelectionForCopy;
13
+ setItemSelectionForCopy: (selection: ItemSelectionForCopy) => void;
13
14
  getFilterById: (id: string) => Promise<{
14
15
  [prop: string]: any;
15
16
  }>;
16
- setSelectionForCopy: (selection: SelectionForCopy) => void;
17
17
  activeDirectory?: UUID;
18
18
  elementExists?: ElementExistsType;
19
19
  language?: string;
20
20
  }
21
- export declare function ExpertFilterEditionDialog({ id, name, titleId, open, onClose, broadcastChannel, selectionForCopy, getFilterById, setSelectionForCopy, activeDirectory, elementExists, language, }: ExpertFilterEditionDialogProps): import("react/jsx-runtime").JSX.Element;
21
+ export declare function ExpertFilterEditionDialog({ id, name, titleId, open, onClose, broadcastChannel, itemSelectionForCopy, getFilterById, setItemSelectionForCopy, activeDirectory, elementExists, language, }: Readonly<ExpertFilterEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
@@ -7,7 +7,7 @@ import { FetchStatus } from "../../../utils/constants/fetchStatus.js";
7
7
  import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
8
8
  import "../../../utils/yupConfig.js";
9
9
  import { CustomMuiDialog } from "../../dialogs/customMuiDialog/CustomMuiDialog.js";
10
- import { FilterType, NO_SELECTION_FOR_COPY } from "../constants/FilterConstants.js";
10
+ import { FilterType, NO_ITEM_SELECTION_FOR_COPY } from "../constants/FilterConstants.js";
11
11
  import { FilterForm } from "../FilterForm.js";
12
12
  import { saveExpertFilter } from "../utils/filterApi.js";
13
13
  import { expertFilterSchema, EXPERT_FILTER_QUERY } from "./ExpertFilterForm.js";
@@ -26,9 +26,9 @@ function ExpertFilterEditionDialog({
26
26
  open,
27
27
  onClose,
28
28
  broadcastChannel,
29
- selectionForCopy,
29
+ itemSelectionForCopy,
30
30
  getFilterById,
31
- setSelectionForCopy,
31
+ setItemSelectionForCopy,
32
32
  activeDirectory,
33
33
  elementExists,
34
34
  language
@@ -83,14 +83,12 @@ function ExpertFilterEditionDialog({
83
83
  });
84
84
  }
85
85
  );
86
- if (selectionForCopy.sourceItemUuid === id) {
87
- setSelectionForCopy(NO_SELECTION_FOR_COPY);
88
- broadcastChannel.postMessage({
89
- NO_SELECTION_FOR_COPY
90
- });
86
+ if (itemSelectionForCopy.sourceItemUuid === id) {
87
+ setItemSelectionForCopy(NO_ITEM_SELECTION_FOR_COPY);
88
+ broadcastChannel.postMessage({ NO_SELECTION_FOR_COPY: NO_ITEM_SELECTION_FOR_COPY });
91
89
  }
92
90
  },
93
- [broadcastChannel, id, onClose, selectionForCopy.sourceItemUuid, snackError, setSelectionForCopy]
91
+ [broadcastChannel, id, onClose, itemSelectionForCopy.sourceItemUuid, snackError, setItemSelectionForCopy]
94
92
  );
95
93
  const isDataReady = dataFetchStatus === FetchStatus.FETCH_SUCCESS;
96
94
  return /* @__PURE__ */ jsx(
@@ -1,4 +1,4 @@
1
- import { SelectionForCopy } from '../filter.type';
1
+ import { ItemSelectionForCopy } from '../filter.type';
2
2
  import { ElementExistsType } from '../../../utils/types/elementType';
3
3
  import { UUID } from 'crypto';
4
4
 
@@ -9,11 +9,11 @@ export interface ExplicitNamingFilterEditionDialogProps {
9
9
  open: boolean;
10
10
  onClose: () => void;
11
11
  broadcastChannel: BroadcastChannel;
12
- selectionForCopy: SelectionForCopy;
13
- setSelectionForCopy: (selection: SelectionForCopy) => void;
12
+ itemSelectionForCopy: ItemSelectionForCopy;
13
+ setItemSelectionForCopy: (selection: ItemSelectionForCopy) => void;
14
14
  getFilterById: (id: string) => Promise<any>;
15
15
  activeDirectory?: UUID;
16
16
  elementExists?: ElementExistsType;
17
17
  language?: string;
18
18
  }
19
- export declare function ExplicitNamingFilterEditionDialog({ id, name, titleId, open, onClose, broadcastChannel, selectionForCopy, setSelectionForCopy, getFilterById, activeDirectory, elementExists, language, }: Readonly<ExplicitNamingFilterEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
19
+ export declare function ExplicitNamingFilterEditionDialog({ id, name, titleId, open, onClose, broadcastChannel, itemSelectionForCopy, setItemSelectionForCopy, getFilterById, activeDirectory, elementExists, language, }: Readonly<ExplicitNamingFilterEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
@@ -12,7 +12,7 @@ import { saveExplicitNamingFilter } from "../utils/filterApi.js";
12
12
  import { explicitNamingFilterSchema, FILTER_EQUIPMENTS_ATTRIBUTES } from "./ExplicitNamingFilterForm.js";
13
13
  import { FetchStatus } from "../../../utils/constants/fetchStatus.js";
14
14
  import { FilterForm } from "../FilterForm.js";
15
- import { FilterType, NO_SELECTION_FOR_COPY } from "../constants/FilterConstants.js";
15
+ import { FilterType, NO_ITEM_SELECTION_FOR_COPY } from "../constants/FilterConstants.js";
16
16
  import * as yup from "yup";
17
17
  const formSchema = yup.object().shape({
18
18
  [FieldConstants.NAME]: yup.string().trim().required("nameEmpty"),
@@ -27,8 +27,8 @@ function ExplicitNamingFilterEditionDialog({
27
27
  open,
28
28
  onClose,
29
29
  broadcastChannel,
30
- selectionForCopy,
31
- setSelectionForCopy,
30
+ itemSelectionForCopy,
31
+ setItemSelectionForCopy,
32
32
  getFilterById,
33
33
  activeDirectory,
34
34
  elementExists,
@@ -86,14 +86,12 @@ function ExplicitNamingFilterEditionDialog({
86
86
  },
87
87
  onClose
88
88
  );
89
- if (selectionForCopy.sourceItemUuid === id) {
90
- setSelectionForCopy(NO_SELECTION_FOR_COPY);
91
- broadcastChannel.postMessage({
92
- NO_SELECTION_FOR_COPY
93
- });
89
+ if (itemSelectionForCopy.sourceItemUuid === id) {
90
+ setItemSelectionForCopy(NO_ITEM_SELECTION_FOR_COPY);
91
+ broadcastChannel.postMessage({ NO_SELECTION_FOR_COPY: NO_ITEM_SELECTION_FOR_COPY });
94
92
  }
95
93
  },
96
- [broadcastChannel, id, selectionForCopy, onClose, snackError, setSelectionForCopy]
94
+ [broadcastChannel, id, itemSelectionForCopy, onClose, snackError, setItemSelectionForCopy]
97
95
  );
98
96
  const isDataReady = dataFetchStatus === FetchStatus.FETCH_SUCCESS;
99
97
  return /* @__PURE__ */ jsx(
@@ -1,14 +1,13 @@
1
+ import { UUID } from 'crypto';
2
+
1
3
  /**
2
- * Copyright (c) 2024, 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/.
4
+ * Represent an item/object in directories.
6
5
  */
7
- export type SelectionForCopy = {
8
- sourceItemUuid: string | null;
6
+ export type ItemSelectionForCopy = {
7
+ sourceItemUuid: UUID | null;
9
8
  typeItem: string | null;
10
9
  nameItem: string | null;
11
10
  descriptionItem: string | null;
12
- parentDirectoryUuid: string | null;
11
+ parentDirectoryUuid: UUID | null;
13
12
  specificTypeItem: string | null;
14
13
  };
@@ -1,6 +1,6 @@
1
1
  import { FilterCreationDialog } from "./FilterCreationDialog.js";
2
2
  import { FilterForm } from "./FilterForm.js";
3
- import { DISTRIBUTION_KEY, FilterType, NO_SELECTION_FOR_COPY } from "./constants/FilterConstants.js";
3
+ import { DISTRIBUTION_KEY, FilterType, NO_ITEM_SELECTION_FOR_COPY } from "./constants/FilterConstants.js";
4
4
  import { CriteriaBasedFilterEditionDialog } from "./criteriaBased/CriteriaBasedFilterEditionDialog.js";
5
5
  import { CriteriaBasedFilterForm, criteriaBasedFilterEmptyFormData, criteriaBasedFilterSchema } from "./criteriaBased/CriteriaBasedFilterForm.js";
6
6
  import { CriteriaBasedForm } from "./criteriaBased/CriteriaBasedForm.js";
@@ -47,7 +47,7 @@ export {
47
47
  FilterType,
48
48
  FreePropertiesTypes,
49
49
  LOAD_TYPE_OPTIONS,
50
- NO_SELECTION_FOR_COPY,
50
+ NO_ITEM_SELECTION_FOR_COPY,
51
51
  OPERATOR_OPTIONS,
52
52
  OperatorType,
53
53
  PHASE_REGULATION_MODE_OPTIONS,
@@ -12,7 +12,7 @@ export interface FlatParametersProps {
12
12
  paramsAsArray: Parameter[];
13
13
  initValues: Record<string, string>;
14
14
  onChange: (paramName: string, value: unknown, isInEdition: boolean) => void;
15
- variant: TextFieldProps['variant'];
15
+ variant?: TextFieldProps['variant'];
16
16
  showSeparator?: boolean;
17
17
  selectionWithDialog?: (param: Parameter) => boolean;
18
18
  }
@@ -25,7 +25,7 @@ import { useElementSearch } from "./elementSearch/hooks/useElementSearch.js";
25
25
  import { TagRenderer } from "./elementSearch/tagRenderer/TagRenderer.js";
26
26
  import { FilterCreationDialog } from "./filter/FilterCreationDialog.js";
27
27
  import { FilterForm } from "./filter/FilterForm.js";
28
- import { DISTRIBUTION_KEY, FilterType, NO_SELECTION_FOR_COPY } from "./filter/constants/FilterConstants.js";
28
+ import { DISTRIBUTION_KEY, FilterType, NO_ITEM_SELECTION_FOR_COPY } from "./filter/constants/FilterConstants.js";
29
29
  import { CriteriaBasedFilterEditionDialog } from "./filter/criteriaBased/CriteriaBasedFilterEditionDialog.js";
30
30
  import { CriteriaBasedFilterForm, criteriaBasedFilterEmptyFormData, criteriaBasedFilterSchema } from "./filter/criteriaBased/CriteriaBasedFilterForm.js";
31
31
  import { CriteriaBasedForm } from "./filter/criteriaBased/CriteriaBasedForm.js";
@@ -193,7 +193,7 @@ export {
193
193
  MultipleAutocompleteInput,
194
194
  MultipleSelectionDialog,
195
195
  NAME,
196
- NO_SELECTION_FOR_COPY,
196
+ NO_ITEM_SELECTION_FOR_COPY,
197
197
  NumericEditor,
198
198
  OPERATOR_OPTIONS,
199
199
  OperatorType,
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ import { useElementSearch } from "./components/elementSearch/hooks/useElementSea
26
26
  import { TagRenderer } from "./components/elementSearch/tagRenderer/TagRenderer.js";
27
27
  import { FilterCreationDialog } from "./components/filter/FilterCreationDialog.js";
28
28
  import { FilterForm } from "./components/filter/FilterForm.js";
29
- import { DISTRIBUTION_KEY, FilterType, NO_SELECTION_FOR_COPY } from "./components/filter/constants/FilterConstants.js";
29
+ import { DISTRIBUTION_KEY, FilterType, NO_ITEM_SELECTION_FOR_COPY } from "./components/filter/constants/FilterConstants.js";
30
30
  import { CriteriaBasedFilterEditionDialog } from "./components/filter/criteriaBased/CriteriaBasedFilterEditionDialog.js";
31
31
  import { CriteriaBasedFilterForm, criteriaBasedFilterEmptyFormData, criteriaBasedFilterSchema } from "./components/filter/criteriaBased/CriteriaBasedFilterForm.js";
32
32
  import { CriteriaBasedForm } from "./components/filter/criteriaBased/CriteriaBasedForm.js";
@@ -290,7 +290,7 @@ export {
290
290
  MultipleAutocompleteInput,
291
291
  MultipleSelectionDialog,
292
292
  NAME,
293
- NO_SELECTION_FOR_COPY,
293
+ NO_ITEM_SELECTION_FOR_COPY,
294
294
  NumericEditor,
295
295
  OPERATOR_OPTIONS,
296
296
  OperatingStatus,
@@ -8,7 +8,7 @@ export type Env = {
8
8
  };
9
9
  export declare function fetchEnv(): Promise<Env>;
10
10
  export declare function fetchAppsMetadata(): Promise<Metadata[]>;
11
- export declare const isStudyMetadata: (metadata: Metadata) => metadata is StudyMetadata;
11
+ export declare function isStudyMetadata(metadata: Metadata): metadata is StudyMetadata;
12
12
  export declare function fetchStudyMetadata(): Promise<StudyMetadata>;
13
13
  export declare function fetchFavoriteAndDefaultCountries(): Promise<{
14
14
  favoriteCountries: string[];
@@ -7,9 +7,9 @@ async function fetchAppsMetadata() {
7
7
  const res = await fetch(`${env.appsMetadataServerUrl}/apps-metadata.json`);
8
8
  return res.json();
9
9
  }
10
- const isStudyMetadata = (metadata) => {
10
+ function isStudyMetadata(metadata) {
11
11
  return metadata.name === "Study";
12
- };
12
+ }
13
13
  async function fetchStudyMetadata() {
14
14
  console.info(`Fetching study metadata...`);
15
15
  const studyMetadata = (await fetchAppsMetadata()).filter(isStudyMetadata);
@@ -58,4 +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.CSPR_CREATION': string;
61
62
  };
@@ -51,7 +51,8 @@ const networkModificationsEn = {
51
51
  "network_modifications.tabular.SUBSTATION_MODIFICATION": "substation modifications",
52
52
  "network_modifications.TABULAR_CREATION": "Tabular creation - {computedLabel}",
53
53
  "network_modifications.tabular.GENERATOR_CREATION": "generator creations",
54
- "network_modifications.LCC_CREATION": "Creating HVDC (LCC) {computedLabel}"
54
+ "network_modifications.LCC_CREATION": "Creating HVDC (LCC) {computedLabel}",
55
+ "network_modifications.CSPR_CREATION": "Creating CSPR {computedLabel}"
55
56
  };
56
57
  export {
57
58
  networkModificationsEn
@@ -58,4 +58,5 @@ export declare const networkModificationsFr: {
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.STATIC_VAR_COMPENSATOR_CREATION': string;
61
62
  };
@@ -51,7 +51,8 @@ const networkModificationsFr = {
51
51
  "network_modifications.tabular.SUBSTATION_MODIFICATION": "modifications de sites",
52
52
  "network_modifications.TABULAR_CREATION": "Création tabulaire - {computedLabel}",
53
53
  "network_modifications.tabular.GENERATOR_CREATION": "créations de générateurs",
54
- "network_modifications.LCC_CREATION": "Création de la HVDC (LCC) {computedLabel}"
54
+ "network_modifications.LCC_CREATION": "Création de la HVDC (LCC) {computedLabel}",
55
+ "network_modifications.STATIC_VAR_COMPENSATOR_CREATION": "Création de CSPR {computedLabel}"
55
56
  };
56
57
  export {
57
58
  networkModificationsFr
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.72.3",
3
+ "version": "0.74.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "engines": {
6
6
  "npm": ">=9",