@gridsuite/commons-ui 0.139.0 → 0.141.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.
Files changed (59) hide show
  1. package/dist/components/csvDownloader/csv-export.d.ts +1 -1
  2. package/dist/components/csvDownloader/csv-export.js +5 -14
  3. package/dist/components/csvDownloader/csv-export.type.d.ts +1 -1
  4. package/dist/components/csvDownloader/use-csv-export.d.ts +1 -1
  5. package/dist/components/csvDownloader/use-csv-export.js +11 -11
  6. package/dist/components/customAGGrid/cell-renderers.d.ts +26 -0
  7. package/dist/components/customAGGrid/cell-renderers.js +199 -0
  8. package/dist/components/customAGGrid/index.d.ts +1 -0
  9. package/dist/components/customAGGrid/index.js +9 -0
  10. package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +2 -2
  11. package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.d.ts +1 -1
  12. package/dist/components/dialogs/modifyElementSelection/ModifyElementSelection.js +3 -0
  13. package/dist/components/directoryItemSelector/DirectoryItemSelector.js +5 -2
  14. package/dist/components/directoryItemSelector/utils.js +2 -1
  15. package/dist/components/filter/FilterCreationDialog.js +2 -1
  16. package/dist/components/filter/FilterForm.d.ts +16 -2
  17. package/dist/components/filter/FilterForm.js +5 -10
  18. package/dist/components/filter/HeaderFilterForm.d.ts +7 -11
  19. package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +8 -1
  20. package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.d.ts +3 -1
  21. package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +9 -2
  22. package/dist/components/index.d.ts +2 -0
  23. package/dist/components/index.js +15 -0
  24. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +2 -1
  25. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +44 -55
  26. package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +1 -0
  27. package/dist/components/inputs/reactQueryBuilder/ElementValueEditor.js +1 -1
  28. package/dist/components/muiTable/OverflowableTableCell.d.ts +3 -0
  29. package/dist/components/muiTable/OverflowableTableCell.js +10 -0
  30. package/dist/components/muiTable/OverflowableTableCellWithCheckbox.d.ts +6 -0
  31. package/dist/components/muiTable/OverflowableTableCellWithCheckbox.js +16 -0
  32. package/dist/components/muiTable/index.d.ts +8 -0
  33. package/dist/components/muiTable/index.js +6 -0
  34. package/dist/components/parameters/common/parameters-creation-dialog.js +1 -1
  35. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +1 -1
  36. package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -1
  37. package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +1 -1
  38. package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -1
  39. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
  40. package/dist/components/resizablePanels/ResizeHandle.d.ts +8 -0
  41. package/dist/components/resizablePanels/ResizeHandle.js +32 -0
  42. package/dist/components/resizablePanels/index.d.ts +7 -0
  43. package/dist/components/resizablePanels/index.js +4 -0
  44. package/dist/components/topBar/GridLogo.d.ts +4 -2
  45. package/dist/components/topBar/GridLogo.js +39 -21
  46. package/dist/components/topBar/TopBar.d.ts +2 -1
  47. package/dist/components/topBar/TopBar.js +81 -65
  48. package/dist/index.js +25 -5
  49. package/dist/services/config.d.ts +10 -0
  50. package/dist/services/config.js +34 -0
  51. package/dist/services/directory.d.ts +6 -4
  52. package/dist/services/directory.js +17 -32
  53. package/dist/services/index.d.ts +5 -4
  54. package/dist/services/index.js +8 -5
  55. package/dist/utils/index.d.ts +1 -0
  56. package/dist/utils/index.js +2 -0
  57. package/dist/utils/navigator-clipboard.d.ts +7 -0
  58. package/dist/utils/navigator-clipboard.js +16 -0
  59. package/package.json +2 -1
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState, useMemo } from "react";
2
+ import { useMemo, useState } from "react";
3
3
  import { FormattedMessage } from "react-intl";
4
- import { styled, Menu, MenuItem, ListItemIcon, AppBar, Toolbar, Box, IconButton, ListItemText, Button, darken, Popper, Paper, ClickAwayListener, MenuList, Typography, ToggleButtonGroup, ToggleButton } from "@mui/material";
4
+ import { styled, Menu, MenuItem, ListItemIcon, AppBar, Toolbar, Box, IconButton, ListItemText, Button, Popper, Paper, ClickAwayListener, MenuList, Typography, ToggleButtonGroup, ToggleButton, darken } from "@mui/material";
5
5
  import { Apps, ArrowDropUp, ArrowDropDown, Person, Badge, ManageAccounts, HelpOutline, WbSunny, Brightness3, Computer, ExitToApp } from "@mui/icons-material";
6
6
  import { GridLogo } from "./GridLogo.js";
7
7
  import { AboutDialog } from "./AboutDialog.js";
@@ -11,63 +11,77 @@ import UserSettingsDialog from "./UserSettingsDialog.js";
11
11
  import { LIGHT_THEME, DARK_THEME } from "../../utils/styles.js";
12
12
  import { LANG_SYSTEM, LANG_ENGLISH, LANG_FRENCH } from "../../utils/langs.js";
13
13
  import { DevModeBanner } from "./DevModeBanner.js";
14
- const styles = {
15
- grow: {
16
- flexGrow: 1,
17
- display: "flex",
18
- overflow: "hidden"
19
- },
20
- menuContainer: {
21
- marginLeft: 1
22
- },
23
- link: {
24
- textDecoration: "none",
25
- color: "inherit"
26
- },
27
- name: (theme) => ({
28
- backgroundColor: darken(theme.palette.background.paper, 0.1),
29
- paddingTop: "10px",
30
- borderRadius: "100%",
31
- fontWeight: "400",
32
- textTransform: "uppercase",
33
- height: "48px",
34
- width: "48px"
35
- }),
36
- arrowIcon: {
37
- fontSize: "40px"
38
- },
39
- userMail: {
40
- fontSize: "14px",
41
- display: "block"
42
- },
43
- borderBottom: {
44
- borderBottom: "1px solid #ccc"
45
- },
46
- settingsMenu: {
47
- maxWidth: "385px",
48
- zIndex: 60
49
- },
50
- sizeLabel: {
51
- fontSize: "16px"
52
- },
53
- showHideMenu: {
54
- padding: "0",
55
- borderRadius: "25px"
56
- },
57
- toggleButtonGroup: {
58
- marginLeft: "15px",
59
- pointerEvents: "auto"
60
- },
61
- toggleButton: {
62
- height: "30px",
63
- width: "48px",
64
- padding: "7px",
65
- textTransform: "capitalize"
66
- },
67
- languageToggleButton: {
68
- height: "30px",
69
- width: "48px"
70
- }
14
+ const getStyles = (dense = false) => {
15
+ return {
16
+ toolbar: (theme) => ({
17
+ ...dense && {
18
+ minHeight: `${theme.spacing(6)} !important`,
19
+ paddingLeft: `${theme.spacing(0.875)} !important`,
20
+ paddingRight: `${theme.spacing(0.875)} !important`
21
+ }
22
+ }),
23
+ grow: {
24
+ flexGrow: 1,
25
+ display: "flex",
26
+ overflow: "hidden"
27
+ },
28
+ menuContainer: (theme) => ({
29
+ marginLeft: theme.spacing(dense ? 0.5 : 1)
30
+ }),
31
+ link: {
32
+ textDecoration: "none",
33
+ color: "inherit"
34
+ },
35
+ name: (theme) => ({
36
+ backgroundColor: darken(theme.palette.background.paper, 0.1),
37
+ paddingTop: theme.spacing(dense ? 0.625 : 1.25),
38
+ borderRadius: "100%",
39
+ fontWeight: "400",
40
+ textTransform: "uppercase",
41
+ height: theme.spacing(dense ? 4.5 : 6),
42
+ width: theme.spacing(dense ? 4.5 : 6)
43
+ }),
44
+ arrowIcon: (theme) => ({
45
+ fontSize: theme.spacing(dense ? 4 : 5)
46
+ }),
47
+ userMail: {
48
+ fontSize: "14px",
49
+ display: "block"
50
+ },
51
+ borderBottom: {
52
+ borderBottom: "1px solid #ccc"
53
+ },
54
+ borderTop: {
55
+ borderTop: "1px solid #ccc"
56
+ },
57
+ settingsMenu: {
58
+ maxWidth: "385px",
59
+ zIndex: 60
60
+ },
61
+ sizeLabel: {
62
+ fontSize: "16px"
63
+ },
64
+ showHideMenu: (theme) => ({
65
+ padding: 0,
66
+ borderRadius: "50%",
67
+ minWidth: theme.spacing(dense ? 5 : 6.875),
68
+ minHeight: theme.spacing(dense ? 5 : 6.875)
69
+ }),
70
+ toggleButtonGroup: {
71
+ marginLeft: "15px",
72
+ pointerEvents: "auto"
73
+ },
74
+ toggleButton: {
75
+ height: "30px",
76
+ width: "48px",
77
+ padding: "7px",
78
+ textTransform: "capitalize"
79
+ },
80
+ languageToggleButton: {
81
+ height: "30px",
82
+ width: "48px"
83
+ }
84
+ };
71
85
  };
72
86
  const StyledMenu = styled((props) => /* @__PURE__ */ jsx(
73
87
  Menu,
@@ -130,8 +144,10 @@ function TopBar({
130
144
  onEquipmentLabellingClick,
131
145
  equipmentLabelling,
132
146
  onLanguageClick,
133
- language
147
+ language,
148
+ dense = false
134
149
  }) {
150
+ const styles = useMemo(() => getStyles(dense), [dense]);
135
151
  const [anchorElSettingsMenu, setAnchorElSettingsMenu] = useState(null);
136
152
  const [anchorElAppsMenu, setAnchorElAppsMenu] = useState(null);
137
153
  const {
@@ -196,15 +212,15 @@ function TopBar({
196
212
  openUserSettingsDialog();
197
213
  };
198
214
  const logoClickable = useMemo(
199
- () => /* @__PURE__ */ jsx(GridLogo, { onClick: onLogoClick, appLogo, appName, appColor }),
200
- [onLogoClick, appLogo, appName, appColor]
215
+ () => /* @__PURE__ */ jsx(GridLogo, { onClick: onLogoClick, appLogo, appName, appColor, dense }),
216
+ [onLogoClick, appLogo, appName, appColor, dense]
201
217
  );
202
218
  return /* @__PURE__ */ jsxs(AppBar, { position: "static", color: "default", children: [
203
219
  user && developerMode && /* @__PURE__ */ jsx(DevModeBanner, {}),
204
- /* @__PURE__ */ jsxs(Toolbar, { children: [
220
+ /* @__PURE__ */ jsxs(Toolbar, { variant: dense ? "dense" : "regular", sx: styles.toolbar, children: [
205
221
  logoClickable,
206
222
  /* @__PURE__ */ jsx(Box, { sx: styles.grow, children }),
207
- user && /* @__PURE__ */ jsxs(Box, { children: [
223
+ user && !dense && /* @__PURE__ */ jsxs(Box, { children: [
208
224
  /* @__PURE__ */ jsx(
209
225
  IconButton,
210
226
  {
@@ -273,7 +289,7 @@ function TopBar({
273
289
  "data-testid": "SettingsMenu",
274
290
  children: [
275
291
  /* @__PURE__ */ jsx(Box, { component: "span", sx: styles.name, children: user.profile.name !== void 0 ? abbreviationFromUserName(user.profile.name) : "" }),
276
- anchorElSettingsMenu ? /* @__PURE__ */ jsx(ArrowDropUp, { sx: styles.arrowIcon }) : /* @__PURE__ */ jsx(ArrowDropDown, { sx: styles.arrowIcon })
292
+ !dense && (anchorElSettingsMenu ? /* @__PURE__ */ jsx(ArrowDropUp, { sx: styles.arrowIcon }) : /* @__PURE__ */ jsx(ArrowDropDown, { sx: styles.arrowIcon }))
277
293
  ]
278
294
  }
279
295
  ),
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ import { useCsvExport } from "./components/csvDownloader/use-csv-export.js";
21
21
  import { CUSTOM_AGGRID_THEME, styles } from "./components/customAGGrid/customAggrid.style.js";
22
22
  import { CustomAGGrid } from "./components/customAGGrid/customAggrid.js";
23
23
  import { SeparatorCellRenderer } from "./components/customAGGrid/separatorCellRenderer.js";
24
+ import { BooleanCellRenderer, BooleanNullableCellRenderer, ContingencyCellRenderer, DefaultCellRenderer, ErrorCellRenderer, MessageLogCellRenderer, NetworkModificationNameCellRenderer, NumericCellRenderer } from "./components/customAGGrid/cell-renderers.js";
24
25
  import { CustomMuiDialog, unscrollableDialogStyles } from "./components/dialogs/customMuiDialog/CustomMuiDialog.js";
25
26
  import { DescriptionModificationDialog } from "./components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
26
27
  import { ElementSaveDialog } from "./components/dialogs/elementSaveDialog/ElementSaveDialog.js";
@@ -173,6 +174,9 @@ import { SensitivityAnalysisParametersDialog } from "./components/parameters/sen
173
174
  import { COLUMNS_DEFINITIONS_HVDCS, COLUMNS_DEFINITIONS_INJECTIONS, COLUMNS_DEFINITIONS_INJECTIONS_SET, COLUMNS_DEFINITIONS_NODES, COLUMNS_DEFINITIONS_PSTS, EQUIPMENTS_IN_VOLTAGE_REGULATION_TYPES, HVDC_EQUIPMENT_TYPES, INJECTIONS_EQUIPMENT_TYPES, INJECTION_DISTRIBUTION_TYPES, MONITORED_BRANCHES_EQUIPMENT_TYPES, MONITORED_VOLTAGE_LEVELS_EQUIPMENT_TYPES, PSTS_EQUIPMENT_TYPES, SENSITIVITY_TYPES, SensiBranchesTabValues, SensiHvdcs, SensiInjection, SensiInjectionsSet, SensiNodes, SensiPsts, SensiTabValues } from "./components/parameters/sensi/columns-definitions.js";
174
175
  import { SensitivityTable } from "./components/parameters/sensi/sensitivity-table.js";
175
176
  import { CustomMenuItem, CustomNestedMenuItem } from "./components/menus/custom-nested-menu.js";
177
+ import { OverflowableTableCell } from "./components/muiTable/OverflowableTableCell.js";
178
+ import { OverflowableTableCellWithCheckbox } from "./components/muiTable/OverflowableTableCellWithCheckbox.js";
179
+ import { ResizeHandle } from "./components/resizablePanels/ResizeHandle.js";
176
180
  import { useStateBoolean } from "./hooks/customStates/useStateBoolean.js";
177
181
  import { useStateNumber } from "./hooks/customStates/useStateNumber.js";
178
182
  import { useModificationLabelComputer } from "./hooks/useModificationLabelComputer.js";
@@ -189,17 +193,18 @@ import { OptionalServicesStatus, useParametersBackend } from "./hooks/use-parame
189
193
  import { useCreateRowDataSensi } from "./hooks/use-create-row-data-sensi.js";
190
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";
191
195
  import { getUserToken, setCommonStore } from "./redux/commonStore.js";
192
- import { NetworkTimeoutError, backendFetch, backendFetchFile, backendFetchJson, backendFetchText, getRequestParamFromList } from "./services/utils.js";
193
- import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./services/explore.js";
194
196
  import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./services/appsMetadata.js";
195
- import { elementAlreadyExists, fetchConfigParameter, fetchConfigParameters, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, getAppName, updateConfigParameter } from "./services/directory.js";
197
+ import { fetchConfigParameter, fetchConfigParameters, getAppName, updateConfigParameter } from "./services/config.js";
198
+ import { PermissionType, elementAlreadyExists, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, hasElementPermission } from "./services/directory.js";
199
+ import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./services/explore.js";
196
200
  import { PREFIX_STUDY_QUERIES, fetchLoadFlowParameters, getDefaultLoadFlowProvider, getLoadFlowDefaultLimitReductions, getLoadFlowProviders, getLoadFlowSpecificParametersDescription, getLoadFlowUrl, setLoadFlowParameters } from "./services/loadflow.js";
201
+ import { getPccMinStudyParameters, updatePccMinParameters } from "./services/pcc-min.js";
202
+ import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./services/security-analysis.js";
197
203
  import { exportFilter, getAvailableComponentLibraries, getStudyNetworkVisualizationsParameters, getStudyShortCircuitParameters, invalidateStudyShortCircuitStatus, setStudyNetworkVisualizationParameters, setStudyShortCircuitParameters, updateVoltageInitParameters } from "./services/study.js";
198
204
  import { getNetworkVisualizationsParameters } from "./services/study-config.js";
199
205
  import { fetchCurrentAnnouncement, fetchUserDetails } from "./services/userAdmin.js";
206
+ import { NetworkTimeoutError, backendFetch, backendFetchFile, backendFetchJson, backendFetchText, getRequestParamFromList } from "./services/utils.js";
200
207
  import { getVoltageInitParameters, getVoltageInitUrl } from "./services/voltage-init.js";
201
- import { getPccMinStudyParameters, updatePccMinParameters } from "./services/pcc-min.js";
202
- import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./services/security-analysis.js";
203
208
  import { equalsArray } from "./utils/algos.js";
204
209
  import { FetchStatus } from "./utils/constants/fetchStatus.js";
205
210
  import { FieldConstants } from "./utils/constants/fieldConstants.js";
@@ -213,6 +218,7 @@ import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./utils/fun
213
218
  import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./utils/langs.js";
214
219
  import { getFileIcon } from "./utils/mapper/getFileIcon.js";
215
220
  import { equipmentTypesForPredefinedPropertiesMapper } from "./utils/mapper/equipmentTypesForPredefinedPropertiesMapper.js";
221
+ import { copyToClipboard } from "./utils/navigator-clipboard.js";
216
222
  import { NotificationsUrlKeys, PREFIX_CONFIG_NOTIFICATION_WS, PREFIX_DIRECTORY_NOTIFICATION_WS, PREFIX_STUDY_NOTIFICATION_WS } from "./utils/constants/notificationsProvider.js";
217
223
  import { DARK_THEME, LIGHT_THEME, makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./utils/styles.js";
218
224
  import { CustomError, formatMessageValues } from "./utils/types/CustomError.js";
@@ -305,7 +311,9 @@ export {
305
311
  BALANCE_TYPE,
306
312
  BASE_EQUIPMENTS,
307
313
  Battery,
314
+ BooleanCellRenderer,
308
315
  BooleanInput,
316
+ BooleanNullableCellRenderer,
309
317
  BottomRightButtons,
310
318
  BusBar,
311
319
  CENTER_LABEL,
@@ -333,6 +341,7 @@ export {
333
341
  CombinatorSelector,
334
342
  CombinatorType,
335
343
  ComputingType,
344
+ ContingencyCellRenderer,
336
345
  CountriesInput,
337
346
  CountryValueEditor,
338
347
  CreateParameterDialog,
@@ -367,6 +376,7 @@ export {
367
376
  DISTRIBUTION_KEY,
368
377
  DanglingLine,
369
378
  DataType,
379
+ DefaultCellRenderer,
370
380
  DescriptionField,
371
381
  DescriptionModificationDialog,
372
382
  DevModeBanner,
@@ -392,6 +402,7 @@ export {
392
402
  EquipmentItem,
393
403
  EquipmentType,
394
404
  EquipmentsSelectionType,
405
+ ErrorCellRenderer,
395
406
  ErrorInLogoutAlert,
396
407
  ErrorInUserValidationAlert,
397
408
  ErrorInput,
@@ -489,6 +500,7 @@ export {
489
500
  MODIFICATION_TYPES,
490
501
  MONITORED_BRANCHES_EQUIPMENT_TYPES,
491
502
  MONITORED_VOLTAGE_LEVELS_EQUIPMENT_TYPES,
503
+ MessageLogCellRenderer,
492
504
  MidFormError,
493
505
  ModificationType,
494
506
  ModifyElementSelection,
@@ -500,6 +512,7 @@ export {
500
512
  NAME,
501
513
  NO_ITEM_SELECTION_FOR_COPY,
502
514
  NadPositionsGenerationMode,
515
+ NetworkModificationNameCellRenderer,
503
516
  NetworkTimeoutError,
504
517
  NetworkVisualizationParametersInline,
505
518
  NetworkVisualizationTabValues,
@@ -507,6 +520,7 @@ export {
507
520
  NotificationsContext,
508
521
  NotificationsProvider,
509
522
  NotificationsUrlKeys,
523
+ NumericCellRenderer,
510
524
  NumericEditor,
511
525
  OHM,
512
526
  OPERATOR_OPTIONS,
@@ -515,6 +529,8 @@ export {
515
529
  OptionalServicesStatus,
516
530
  OverflowableChip,
517
531
  OverflowableChipWithHelperText,
532
+ OverflowableTableCell,
533
+ OverflowableTableCellWithCheckbox,
518
534
  OverflowableText,
519
535
  PARAM_CENTER_LABEL,
520
536
  PARAM_COMPONENT_LIBRARY,
@@ -554,6 +570,7 @@ export {
554
570
  ParameterSwitch,
555
571
  ParameterType,
556
572
  PccMinParametersInLine,
573
+ PermissionType,
557
574
  PhotoLibraryIcon,
558
575
  PopupConfirmationDialog,
559
576
  PredefinedParameters,
@@ -573,6 +590,7 @@ export {
573
590
  RawReadOnlyInput,
574
591
  ReactivePowerAdornment,
575
592
  RemoveButton,
593
+ ResizeHandle,
576
594
  RuleValueEditor,
577
595
  SEARCH_EQUIPMENTS,
578
596
  SELECTED,
@@ -687,6 +705,7 @@ export {
687
705
  componentsFr,
688
706
  convertInputValue,
689
707
  convertOutputValue,
708
+ copyToClipboard,
690
709
  countRules,
691
710
  createFilter,
692
711
  createParameter,
@@ -784,6 +803,7 @@ export {
784
803
  gridItem,
785
804
  handleSigninCallback,
786
805
  handleSilentRenewCallback,
806
+ hasElementPermission,
787
807
  identity,
788
808
  importExpertRules,
789
809
  importParamsEn,
@@ -0,0 +1,10 @@
1
+ /**
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/.
6
+ */
7
+ export declare function getAppName(appName: string, name: string): string;
8
+ export declare function updateConfigParameter(appName: string, name: string, value: string): Promise<Response>;
9
+ export declare function fetchConfigParameters(appName: string): Promise<any>;
10
+ export declare function fetchConfigParameter(appName: string, name: string): Promise<any>;
@@ -0,0 +1,34 @@
1
+ import { backendFetch, backendFetchJson } from "./utils.js";
2
+ import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES } from "../utils/constants/configConstants.js";
3
+ import "../utils/conversionUtils.js";
4
+ import "react/jsx-runtime";
5
+ import "@mui/icons-material";
6
+ import "../utils/types/equipmentType.js";
7
+ import "../utils/yupConfig.js";
8
+ const PREFIX_CONFIG_QUERIES = `${"api/gateway"}/config`;
9
+ function getAppName(appName, name) {
10
+ return COMMON_CONFIG_PARAMS_NAMES.has(name) ? COMMON_APP_NAME : appName;
11
+ }
12
+ function updateConfigParameter(appName, name, value) {
13
+ const targetAppName = getAppName(appName, name);
14
+ console.info(`Updating config parameter '${name}=${value}' for app '${targetAppName}'`);
15
+ const updateParams = `${PREFIX_CONFIG_QUERIES}/v1/applications/${targetAppName}/parameters/${name}?value=${encodeURIComponent(value)}`;
16
+ return backendFetch(updateParams, { method: "put" });
17
+ }
18
+ function fetchConfigParameters(appName) {
19
+ console.info(`Fetching UI configuration params for app : ${appName}`);
20
+ const fetchParams = `${PREFIX_CONFIG_QUERIES}/v1/applications/${appName}/parameters`;
21
+ return backendFetchJson(fetchParams);
22
+ }
23
+ function fetchConfigParameter(appName, name) {
24
+ const targetAppName = getAppName(appName, name);
25
+ console.info(`Fetching UI config parameter '${name}' for app '${targetAppName}'`);
26
+ const fetchParams = `${PREFIX_CONFIG_QUERIES}/v1/applications/${targetAppName}/parameters/${name}`;
27
+ return backendFetchJson(fetchParams);
28
+ }
29
+ export {
30
+ fetchConfigParameter,
31
+ fetchConfigParameters,
32
+ getAppName,
33
+ updateConfigParameter
34
+ };
@@ -1,10 +1,12 @@
1
1
  import { UUID } from 'node:crypto';
2
2
  import { ElementAttributes } from '../utils';
3
- export declare function getAppName(appName: string, name: string): string;
4
- export declare function updateConfigParameter(appName: string, name: string, value: string): Promise<Response>;
5
- export declare function fetchConfigParameters(appName: string): Promise<any>;
6
- export declare function fetchConfigParameter(appName: string, name: string): Promise<any>;
7
3
  export declare function fetchRootFolders(types: string[]): Promise<ElementAttributes[]>;
8
4
  export declare function fetchDirectoryContent(directoryUuid: UUID, types?: string[]): Promise<ElementAttributes[]>;
9
5
  export declare function fetchDirectoryElementPath(elementUuid: UUID): Promise<ElementAttributes[]>;
10
6
  export declare function elementAlreadyExists(directoryUuid: UUID, elementName: string, type: string): Promise<boolean>;
7
+ export declare enum PermissionType {
8
+ READ = "READ",
9
+ WRITE = "WRITE",
10
+ MANAGE = "MANAGE"
11
+ }
12
+ export declare function hasElementPermission(elementUuid: UUID, permission: PermissionType): Promise<boolean>;
@@ -1,32 +1,5 @@
1
- import { backendFetch, backendFetchJson, getRequestParamFromList } from "./utils.js";
2
- import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES } from "../utils/constants/configConstants.js";
3
- import "../utils/conversionUtils.js";
4
- import "react/jsx-runtime";
5
- import "@mui/icons-material";
6
- import "../utils/types/equipmentType.js";
7
- import "../utils/yupConfig.js";
1
+ import { getRequestParamFromList, backendFetchJson, backendFetch } from "./utils.js";
8
2
  const PREFIX_EXPLORE_SERVER_QUERIES = `${"api/gateway"}/explore`;
9
- const PREFIX_CONFIG_QUERIES = `${"api/gateway"}/config`;
10
- function getAppName(appName, name) {
11
- return COMMON_CONFIG_PARAMS_NAMES.has(name) ? COMMON_APP_NAME : appName;
12
- }
13
- function updateConfigParameter(appName, name, value) {
14
- const targetAppName = getAppName(appName, name);
15
- console.info(`Updating config parameter '${name}=${value}' for app '${targetAppName}'`);
16
- const updateParams = `${PREFIX_CONFIG_QUERIES}/v1/applications/${targetAppName}/parameters/${name}?value=${encodeURIComponent(value)}`;
17
- return backendFetch(updateParams, { method: "put" });
18
- }
19
- function fetchConfigParameters(appName) {
20
- console.info(`Fetching UI configuration params for app : ${appName}`);
21
- const fetchParams = `${PREFIX_CONFIG_QUERIES}/v1/applications/${appName}/parameters`;
22
- return backendFetchJson(fetchParams);
23
- }
24
- function fetchConfigParameter(appName, name) {
25
- const targetAppName = getAppName(appName, name);
26
- console.info(`Fetching UI config parameter '${name}' for app '${targetAppName}'`);
27
- const fetchParams = `${PREFIX_CONFIG_QUERIES}/v1/applications/${targetAppName}/parameters/${name}`;
28
- return backendFetchJson(fetchParams);
29
- }
30
3
  function fetchRootFolders(types) {
31
4
  console.info("Fetching Root Directories");
32
5
  const urlSearchParams = getRequestParamFromList("elementTypes", types).toString();
@@ -65,13 +38,25 @@ function elementAlreadyExists(directoryUuid, elementName, type) {
65
38
  // HTTP 204 : No-content
66
39
  );
67
40
  }
41
+ var PermissionType = /* @__PURE__ */ ((PermissionType2) => {
42
+ PermissionType2["READ"] = "READ";
43
+ PermissionType2["WRITE"] = "WRITE";
44
+ PermissionType2["MANAGE"] = "MANAGE";
45
+ return PermissionType2;
46
+ })(PermissionType || {});
47
+ function hasElementPermission(elementUuid, permission) {
48
+ const url = `${PREFIX_EXPLORE_SERVER_QUERIES}/v1/explore/elements/${elementUuid}?permission=${permission}`;
49
+ console.debug(url);
50
+ return backendFetch(url, { method: "head" }).then((response) => response.status === 200).catch(() => {
51
+ console.info(`${permission} permission denied for element or directory ${elementUuid}`);
52
+ return false;
53
+ });
54
+ }
68
55
  export {
56
+ PermissionType,
69
57
  elementAlreadyExists,
70
- fetchConfigParameter,
71
- fetchConfigParameters,
72
58
  fetchDirectoryContent,
73
59
  fetchDirectoryElementPath,
74
60
  fetchRootFolders,
75
- getAppName,
76
- updateConfigParameter
61
+ hasElementPermission
77
62
  };
@@ -4,14 +4,15 @@
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 * from './utils';
8
- export * from './explore';
9
7
  export * from './appsMetadata';
8
+ export * from './config';
10
9
  export * from './directory';
10
+ export * from './explore';
11
11
  export * from './loadflow';
12
+ export * from './pcc-min';
13
+ export * from './security-analysis';
12
14
  export * from './study';
13
15
  export * from './study-config';
14
16
  export * from './userAdmin';
17
+ export * from './utils';
15
18
  export * from './voltage-init';
16
- export * from './pcc-min';
17
- export * from './security-analysis';
@@ -1,17 +1,19 @@
1
- import { NetworkTimeoutError, backendFetch, backendFetchFile, backendFetchJson, backendFetchText, getRequestParamFromList } from "./utils.js";
2
- import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./explore.js";
3
1
  import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./appsMetadata.js";
4
- import { elementAlreadyExists, fetchConfigParameter, fetchConfigParameters, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, getAppName, updateConfigParameter } from "./directory.js";
2
+ import { fetchConfigParameter, fetchConfigParameters, getAppName, updateConfigParameter } from "./config.js";
3
+ import { PermissionType, elementAlreadyExists, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, hasElementPermission } from "./directory.js";
4
+ import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./explore.js";
5
5
  import { PREFIX_STUDY_QUERIES, fetchLoadFlowParameters, getDefaultLoadFlowProvider, getLoadFlowDefaultLimitReductions, getLoadFlowProviders, getLoadFlowSpecificParametersDescription, getLoadFlowUrl, setLoadFlowParameters } from "./loadflow.js";
6
+ import { getPccMinStudyParameters, updatePccMinParameters } from "./pcc-min.js";
7
+ import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./security-analysis.js";
6
8
  import { exportFilter, getAvailableComponentLibraries, getStudyNetworkVisualizationsParameters, getStudyShortCircuitParameters, invalidateStudyShortCircuitStatus, setStudyNetworkVisualizationParameters, setStudyShortCircuitParameters, updateVoltageInitParameters } from "./study.js";
7
9
  import { getNetworkVisualizationsParameters } from "./study-config.js";
8
10
  import { fetchCurrentAnnouncement, fetchUserDetails } from "./userAdmin.js";
11
+ import { NetworkTimeoutError, backendFetch, backendFetchFile, backendFetchJson, backendFetchText, getRequestParamFromList } from "./utils.js";
9
12
  import { getVoltageInitParameters, getVoltageInitUrl } from "./voltage-init.js";
10
- import { getPccMinStudyParameters, updatePccMinParameters } from "./pcc-min.js";
11
- import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./security-analysis.js";
12
13
  export {
13
14
  NetworkTimeoutError,
14
15
  PREFIX_STUDY_QUERIES,
16
+ PermissionType,
15
17
  backendFetch,
16
18
  backendFetchFile,
17
19
  backendFetchJson,
@@ -54,6 +56,7 @@ export {
54
56
  getStudyUrl,
55
57
  getVoltageInitParameters,
56
58
  getVoltageInitUrl,
59
+ hasElementPermission,
57
60
  invalidateStudyShortCircuitStatus,
58
61
  isStudyMetadata,
59
62
  safeEncodeURIComponent,
@@ -11,6 +11,7 @@ export * from './error';
11
11
  export * from './functions';
12
12
  export * from './langs';
13
13
  export * from './mapper';
14
+ export * from './navigator-clipboard';
14
15
  export * from './constants/notificationsProvider';
15
16
  export * from './styles';
16
17
  export * from './types';
@@ -11,6 +11,7 @@ import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./functions
11
11
  import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./langs.js";
12
12
  import { getFileIcon } from "./mapper/getFileIcon.js";
13
13
  import { equipmentTypesForPredefinedPropertiesMapper } from "./mapper/equipmentTypesForPredefinedPropertiesMapper.js";
14
+ import { copyToClipboard } from "./navigator-clipboard.js";
14
15
  import { NotificationsUrlKeys, PREFIX_CONFIG_NOTIFICATION_WS, PREFIX_DIRECTORY_NOTIFICATION_WS, PREFIX_STUDY_NOTIFICATION_WS } from "./constants/notificationsProvider.js";
15
16
  import { DARK_THEME, LIGHT_THEME, makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./styles.js";
16
17
  import { CustomError, formatMessageValues } from "./types/CustomError.js";
@@ -102,6 +103,7 @@ export {
102
103
  catchErrorHandler,
103
104
  convertInputValue,
104
105
  convertOutputValue,
106
+ copyToClipboard,
105
107
  equalsArray,
106
108
  equipmentStyles,
107
109
  equipmentTypesForPredefinedPropertiesMapper,
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2025, 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
+ export declare function copyToClipboard(valueToCopy: string, onSuccess?: () => void, onError?: () => void): void;
@@ -0,0 +1,16 @@
1
+ function copyToClipboard(valueToCopy, onSuccess, onError) {
2
+ if ("clipboard" in navigator) {
3
+ navigator.clipboard.writeText(valueToCopy).then(() => {
4
+ if (onSuccess) onSuccess();
5
+ }).catch((error) => {
6
+ console.error("Clipboard copy error: ", error);
7
+ if (onError) onError();
8
+ });
9
+ } else {
10
+ console.error("navigator.clipboard is not supported by your current navigator");
11
+ if (onError) onError();
12
+ }
13
+ }
14
+ export {
15
+ copyToClipboard
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.139.0",
3
+ "version": "0.141.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "author": "gridsuite team",
6
6
  "homepage": "https://github.com/gridsuite",
@@ -53,6 +53,7 @@
53
53
  "react-dnd": "^16.0.1",
54
54
  "react-dnd-html5-backend": "^16.0.1",
55
55
  "react-querybuilder": "^8.11.0",
56
+ "react-resizable-panels": "^3.0.6",
56
57
  "reconnecting-websocket": "^4.4.0",
57
58
  "type-fest": "^4.41.0",
58
59
  "uuid": "^13.0.0"