@gridsuite/commons-ui 0.141.0 → 0.142.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.
@@ -22,6 +22,6 @@ export declare class CardErrorBoundary extends Component<PropsWithChildren<{}>,
22
22
  componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
23
23
  private handleExpandClick;
24
24
  private handleReloadClick;
25
- render(): string | number | boolean | Iterable<import('react').ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
25
+ render(): string | number | bigint | boolean | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
26
26
  }
27
27
  export {};
@@ -1,2 +1,3 @@
1
+ import { JSX } from 'react';
1
2
  import { CsvExportProps } from './csv-export.type';
2
3
  export declare function CsvExport({ columns, tableNamePrefix, tableName, disabled, skipColumnHeaders, skipPinnedBottom, language, getData, }: CsvExportProps): JSX.Element;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { JSX, ReactNode } from 'react';
2
2
  import { ElementType, EquipmentType } from '../../utils';
3
3
  export declare const SELECTED = "selected";
4
4
  export declare const MAX_ROWS_NUMBER = 100;
@@ -40,7 +40,7 @@ const OverflowableText = styled(
40
40
  sx,
41
41
  ...props
42
42
  }) => {
43
- const element = useRef();
43
+ const element = useRef(void 0);
44
44
  const isMultiLine = useMemo(() => maxLineCount && maxLineCount > 1, [maxLineCount]);
45
45
  const [overflowed, setOverflowed] = useState(false);
46
46
  const checkOverflow = useCallback(() => {
@@ -4,4 +4,4 @@
4
4
  * License, v. 2.0. If a copy of the MPL was not distributed with this
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
- export declare function useIntlRef(): import('react').MutableRefObject<import('react-intl').IntlShape>;
7
+ export declare function useIntlRef(): import('react').RefObject<import('react-intl').IntlShape>;
@@ -1,6 +1,6 @@
1
1
  import { useRef, useEffect } from "react";
2
2
  function usePrevious(value) {
3
- const ref = useRef();
3
+ const ref = useRef(void 0);
4
4
  useEffect(() => {
5
5
  ref.current = value;
6
6
  }, [value]);
package/dist/index.js CHANGED
@@ -193,7 +193,7 @@ import { OptionalServicesStatus, useParametersBackend } from "./hooks/use-parame
193
193
  import { useCreateRowDataSensi } from "./hooks/use-create-row-data-sensi.js";
194
194
  import { LOGOUT_ERROR, RESET_AUTHENTICATION_ROUTER_ERROR, SHOW_AUTH_INFO_LOGIN, SIGNIN_CALLBACK_ERROR, UNAUTHORIZED_USER_INFO, USER, USER_VALIDATION_ERROR, resetAuthenticationRouterError, setLoggedUser, setLogoutError, setShowAuthenticationRouterLogin, setSignInCallbackError, setUnauthorizedUserInfo, setUserValidationError } from "./redux/actions/authActions.js";
195
195
  import { getUserToken, setCommonStore } from "./redux/commonStore.js";
196
- import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./services/appsMetadata.js";
196
+ import { fetchAppsMetadata, fetchBaseVoltages, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./services/appsMetadata.js";
197
197
  import { fetchConfigParameter, fetchConfigParameters, getAppName, updateConfigParameter } from "./services/config.js";
198
198
  import { PermissionType, elementAlreadyExists, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, hasElementPermission } from "./services/directory.js";
199
199
  import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./services/explore.js";
@@ -742,6 +742,7 @@ export {
742
742
  exportParamsFr,
743
743
  extractDefault,
744
744
  fetchAppsMetadata,
745
+ fetchBaseVoltages,
745
746
  fetchConfigParameter,
746
747
  fetchConfigParameters,
747
748
  fetchCurrentAnnouncement,
@@ -1,4 +1,4 @@
1
- import { Metadata, StudyMetadata } from '../utils';
1
+ import { BaseVoltage, Metadata, StudyMetadata } from '../utils';
2
2
  export type UrlString = `${string}://${string}` | `/${string}` | `./${string}`;
3
3
  export type Url = UrlString | URL;
4
4
  export type Env = {
@@ -10,6 +10,7 @@ export declare function fetchEnv(): Promise<Env>;
10
10
  export declare function fetchAppsMetadata(): Promise<Metadata[]>;
11
11
  export declare function isStudyMetadata(metadata: Metadata): metadata is StudyMetadata;
12
12
  export declare function fetchStudyMetadata(): Promise<StudyMetadata>;
13
+ export declare function fetchBaseVoltages(): Promise<BaseVoltage[]>;
13
14
  export declare function fetchFavoriteAndDefaultCountries(): Promise<{
14
15
  favoriteCountries: string[];
15
16
  defaultCountry?: string;
@@ -12,13 +12,19 @@ function isStudyMetadata(metadata) {
12
12
  }
13
13
  async function fetchStudyMetadata() {
14
14
  console.info(`Fetching study metadata...`);
15
- const studyMetadata = (await fetchAppsMetadata()).filter(isStudyMetadata);
15
+ const studyMetadata = (await fetchAppsMetadata()).find(isStudyMetadata);
16
16
  if (!studyMetadata) {
17
17
  throw new Error("Study entry could not be found in metadata");
18
18
  } else {
19
- return studyMetadata[0];
19
+ return studyMetadata;
20
20
  }
21
21
  }
22
+ async function fetchBaseVoltages() {
23
+ console.info(`Fetching apps' base voltages...`);
24
+ const env = await fetchEnv();
25
+ const res = await fetch(`${env.appsMetadataServerUrl}/apps-metadata-base-voltages.json`);
26
+ return res.json();
27
+ }
22
28
  async function fetchFavoriteAndDefaultCountries() {
23
29
  const { favoriteCountries = [], defaultCountry } = await fetchStudyMetadata();
24
30
  return {
@@ -32,6 +38,7 @@ const fetchDefaultCountry = async () => {
32
38
  };
33
39
  export {
34
40
  fetchAppsMetadata,
41
+ fetchBaseVoltages,
35
42
  fetchDefaultCountry,
36
43
  fetchEnv,
37
44
  fetchFavoriteAndDefaultCountries,
@@ -1,4 +1,4 @@
1
- import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./appsMetadata.js";
1
+ import { fetchAppsMetadata, fetchBaseVoltages, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./appsMetadata.js";
2
2
  import { fetchConfigParameter, fetchConfigParameters, getAppName, updateConfigParameter } from "./config.js";
3
3
  import { PermissionType, elementAlreadyExists, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, hasElementPermission } from "./directory.js";
4
4
  import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./explore.js";
@@ -23,6 +23,7 @@ export {
23
23
  elementAlreadyExists,
24
24
  exportFilter,
25
25
  fetchAppsMetadata,
26
+ fetchBaseVoltages,
26
27
  fetchConfigParameter,
27
28
  fetchConfigParameters,
28
29
  fetchCurrentAnnouncement,
@@ -23,4 +23,18 @@ export type StudyMetadata = Metadata & {
23
23
  favoriteCountries?: string[];
24
24
  substationPropertiesGlobalFilters?: Map<string, string[]>;
25
25
  };
26
+ type ThemeColors = Record<string, string>;
27
+ type SldAndNadColors = {
28
+ darkThemeColors: ThemeColors;
29
+ lightThemeColors: ThemeColors;
30
+ };
31
+ export type BaseVoltageConfig = {
32
+ name: string;
33
+ minValue: number;
34
+ maxValue: number;
35
+ };
36
+ export type BaseVoltage = BaseVoltageConfig & {
37
+ networkMapColor: string;
38
+ sldAndNadColors: SldAndNadColors;
39
+ };
26
40
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.141.0",
3
+ "version": "0.142.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "author": "gridsuite team",
6
6
  "homepage": "https://github.com/gridsuite",
@@ -69,8 +69,8 @@
69
69
  "ag-grid-community": "^33.0.3",
70
70
  "ag-grid-react": "^33.0.4",
71
71
  "notistack": "^3.0.2",
72
- "react": "^18.3.1",
73
- "react-dom": "^18.3.1",
72
+ "react": "^19.2.0",
73
+ "react-dom": "^19.2.0",
74
74
  "react-hook-form": "^7.54.2",
75
75
  "react-intl": "^7.1.6",
76
76
  "react-papaparse": "^4.4.0",
@@ -104,8 +104,8 @@
104
104
  "@types/localized-countries": "^2.0.3",
105
105
  "@types/node": "^22.18.1",
106
106
  "@types/prop-types": "^15.7.15",
107
- "@types/react": "^18.3.24",
108
- "@types/react-dom": "^18.3.7",
107
+ "@types/react": "^19.2.2",
108
+ "@types/react-dom": "^19.2.1",
109
109
  "@types/react-resizable": "^3.0.8",
110
110
  "@vitejs/plugin-react": "^5.0.4",
111
111
  "ag-grid-community": "^33.1.0",
@@ -130,8 +130,8 @@
130
130
  "notistack": "^3.0.2",
131
131
  "prettier": "^3.6.2",
132
132
  "prettier-plugin-properties": "^0.3.0",
133
- "react": "^18.3.1",
134
- "react-dom": "^18.3.1",
133
+ "react": "^19.2.0",
134
+ "react-dom": "^19.2.0",
135
135
  "react-hook-form": "^7.62.0",
136
136
  "react-intl": "^7.1.11",
137
137
  "react-papaparse": "^4.4.0",