@gridsuite/commons-ui 0.81.0 → 0.82.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 (52) hide show
  1. package/dist/assets/ExpertFilterForm.css +8 -1
  2. package/dist/components/authentication/AuthenticationRouterErrorDisplay.js +1 -0
  3. package/dist/components/authentication/utils/authService.d.ts +6 -1
  4. package/dist/components/authentication/utils/userManagerMock.d.ts +18 -17
  5. package/dist/components/authentication/utils/userManagerMock.js +80 -92
  6. package/dist/components/cardErrorBoundary/CardErrorBoundary.d.ts +6 -9
  7. package/dist/components/cardErrorBoundary/CardErrorBoundary.js +1 -3
  8. package/dist/components/filter/expert/expertFilterConstants.js +2 -2
  9. package/dist/components/flatParameters/FlatParameters.js +13 -14
  10. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +1 -1
  11. package/dist/components/inputs/reactHookForm/agGridTable/cellEditors/numericEditor.d.ts +6 -7
  12. package/dist/components/inputs/reactHookForm/agGridTable/cellEditors/numericEditor.js +7 -13
  13. package/dist/components/inputs/reactQueryBuilder/CombinatorSelector.js +4 -2
  14. package/dist/components/inputs/reactQueryBuilder/FieldSelector.js +3 -1
  15. package/dist/components/inputs/reactQueryBuilder/PropertyValueEditor.js +18 -6
  16. package/dist/components/inputs/reactQueryBuilder/TextValueEditor.js +14 -2
  17. package/dist/components/inputs/reactQueryBuilder/ValueSelector.js +3 -1
  18. package/dist/components/topBar/MessageBanner.d.ts +7 -0
  19. package/dist/components/topBar/MessageBanner.js +55 -0
  20. package/dist/components/topBar/TopBar.d.ts +3 -2
  21. package/dist/components/topBar/TopBar.js +325 -312
  22. package/dist/components/topBar/UserSettingsDialog.d.ts +8 -0
  23. package/dist/components/topBar/UserSettingsDialog.js +48 -0
  24. package/dist/hooks/index.d.ts +1 -0
  25. package/dist/hooks/index.js +2 -0
  26. package/dist/hooks/useCustomFilterOptions.d.ts +6 -0
  27. package/dist/hooks/useCustomFilterOptions.js +20 -0
  28. package/dist/hooks/useSelectAppearance.d.ts +29 -0
  29. package/dist/hooks/useSelectAppearance.js +22 -0
  30. package/dist/index.js +4 -1
  31. package/dist/module-localized-countries.d.js +1 -0
  32. package/dist/translations/en/filterEn.d.ts +2 -2
  33. package/dist/translations/en/filterEn.js +5 -5
  34. package/dist/translations/en/filterExpertEn.d.ts +1 -0
  35. package/dist/translations/en/filterExpertEn.js +3 -2
  36. package/dist/translations/en/topBarEn.d.ts +7 -2
  37. package/dist/translations/en/topBarEn.js +8 -3
  38. package/dist/translations/fr/filterExpertFr.d.ts +1 -0
  39. package/dist/translations/fr/filterExpertFr.js +3 -2
  40. package/dist/translations/fr/filterFr.d.ts +2 -2
  41. package/dist/translations/fr/filterFr.js +5 -5
  42. package/dist/translations/fr/topBarFr.d.ts +6 -1
  43. package/dist/translations/fr/topBarFr.js +7 -2
  44. package/dist/utils/index.js +2 -1
  45. package/dist/utils/mapper/getFileIcon.js +0 -1
  46. package/dist/utils/types/elementType.d.ts +0 -1
  47. package/dist/utils/types/elementType.js +0 -1
  48. package/dist/utils/types/equipmentType.d.ts +4 -0
  49. package/dist/utils/types/equipmentType.js +6 -0
  50. package/dist/utils/types/index.js +2 -1
  51. package/dist/utils/types/metadata.d.ts +0 -2
  52. package/package.json +1 -2
@@ -7,6 +7,8 @@ import { useValid } from "./hooks/useValid.js";
7
7
  import { OPERATOR_OPTIONS } from "../../filter/expert/expertFilterConstants.js";
8
8
  import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
9
9
  import { usePredefinedProperties } from "../../../hooks/usePredefinedProperties.js";
10
+ import { useSelectAppearance } from "../../../hooks/useSelectAppearance.js";
11
+ import { useCustomFilterOptions } from "../../../hooks/useCustomFilterOptions.js";
10
12
  const PROPERTY_VALUE_OPERATORS = [OPERATOR_OPTIONS.IN];
11
13
  function PropertyValueEditor(props) {
12
14
  const { equipmentType, valueEditorProps } = props;
@@ -45,7 +47,7 @@ function PropertyValueEditor(props) {
45
47
  },
46
48
  [valueEditorProps]
47
49
  );
48
- return /* @__PURE__ */ jsxs(Grid, { container: true, item: true, spacing: 1, children: [
50
+ return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 1, item: true, children: [
49
51
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 5, children: /* @__PURE__ */ jsx(
50
52
  Autocomplete,
51
53
  {
@@ -58,10 +60,11 @@ function PropertyValueEditor(props) {
58
60
  onChange: (event, value) => {
59
61
  onChange(FieldConstants.PROPERTY_NAME, value);
60
62
  },
61
- size: "small"
63
+ size: "small",
64
+ filterOptions: useCustomFilterOptions()
62
65
  }
63
66
  ) }),
64
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 2.5, children: /* @__PURE__ */ jsx(
67
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: "auto", children: /* @__PURE__ */ jsx(
65
68
  Select,
66
69
  {
67
70
  value: propertyOperator ?? PROPERTY_VALUE_OPERATORS[0].customName,
@@ -71,23 +74,32 @@ function PropertyValueEditor(props) {
71
74
  onChange: (event, value) => {
72
75
  onChange(FieldConstants.PROPERTY_OPERATOR, value);
73
76
  },
77
+ ...useSelectAppearance(PROPERTY_VALUE_OPERATORS.length),
74
78
  children: PROPERTY_VALUE_OPERATORS.map((operator) => /* @__PURE__ */ jsx(MenuItem, { value: operator.customName, children: intl.formatMessage({ id: operator.label }) }, operator.customName))
75
79
  }
76
80
  ) }),
77
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 4.5, children: /* @__PURE__ */ jsx(
81
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: true, children: /* @__PURE__ */ jsx(
78
82
  Autocomplete,
79
83
  {
80
84
  value: propertyValues ?? [],
81
85
  options: predefinedValues ?? [],
82
86
  title: valueEditorProps == null ? void 0 : valueEditorProps.title,
83
87
  multiple: true,
84
- renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
88
+ renderInput: (params) => /* @__PURE__ */ jsx(
89
+ TextField,
90
+ {
91
+ ...params,
92
+ error: !valid,
93
+ placeholder: (propertyValues == null ? void 0 : propertyValues.length) > 0 ? "" : intl.formatMessage({ id: "valuesList" })
94
+ }
95
+ ),
85
96
  freeSolo: true,
86
97
  autoSelect: true,
87
98
  onChange: (event, value) => {
88
99
  onChange(FieldConstants.PROPERTY_VALUES, value);
89
100
  },
90
- size: "small"
101
+ size: "small",
102
+ filterOptions: useCustomFilterOptions()
91
103
  }
92
104
  ) })
93
105
  ] });
@@ -1,12 +1,16 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { MaterialValueEditor } from "@react-querybuilder/material";
3
3
  import { Autocomplete, TextField } from "@mui/material";
4
+ import { useIntl } from "react-intl";
4
5
  import { useConvertValue } from "./hooks/useConvertValue.js";
5
6
  import { useValid } from "./hooks/useValid.js";
7
+ import { useCustomFilterOptions } from "../../../hooks/useCustomFilterOptions.js";
6
8
  function TextValueEditor(props) {
7
9
  useConvertValue(props);
8
10
  const valid = useValid(props);
9
11
  const { value, handleOnChange, title } = props;
12
+ const customFilterOptions = useCustomFilterOptions();
13
+ const intl = useIntl();
10
14
  if (!Array.isArray(value)) {
11
15
  return /* @__PURE__ */ jsx(MaterialValueEditor, { ...props });
12
16
  }
@@ -19,9 +23,17 @@ function TextValueEditor(props) {
19
23
  onChange: (event, newValue) => handleOnChange(newValue),
20
24
  multiple: true,
21
25
  fullWidth: true,
22
- renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
26
+ renderInput: (params) => /* @__PURE__ */ jsx(
27
+ TextField,
28
+ {
29
+ ...params,
30
+ error: !valid,
31
+ placeholder: (value == null ? void 0 : value.length) > 0 ? "" : intl.formatMessage({ id: "valuesList" })
32
+ }
33
+ ),
23
34
  size: "small",
24
- title
35
+ title,
36
+ filterOptions: customFilterOptions
25
37
  }
26
38
  );
27
39
  }
@@ -1,7 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { MaterialValueSelector } from "@react-querybuilder/material";
3
+ import { useSelectAppearance } from "../../../hooks/useSelectAppearance.js";
3
4
  function ValueSelector(props) {
4
- return /* @__PURE__ */ jsx(MaterialValueSelector, { ...props });
5
+ const { options } = props;
6
+ return /* @__PURE__ */ jsx(MaterialValueSelector, { ...props, ...useSelectAppearance(options.length), sx: { border: "none" } });
5
7
  }
6
8
  export {
7
9
  ValueSelector
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface MessageBannerProps {
4
+ children: ReactNode;
5
+ }
6
+ declare function MessageBanner({ children }: MessageBannerProps): false | import("react/jsx-runtime").JSX.Element;
7
+ export default MessageBanner;
@@ -0,0 +1,55 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Box } from "@mui/material";
4
+ import CloseIcon from "@mui/icons-material/Close";
5
+ import WarningAmberIcon from "@mui/icons-material/WarningAmber";
6
+ const styles = {
7
+ banner: (theme) => ({
8
+ left: 0,
9
+ width: "100%",
10
+ backgroundColor: "#f6b26b",
11
+ color: "black",
12
+ padding: theme.spacing(1),
13
+ textAlign: "left",
14
+ boxShadow: "0px 2px 5px rgba(0, 0, 0, 0.1)",
15
+ zIndex: 1e3,
16
+ display: "flex",
17
+ justifyContent: "flex-start",
18
+ alignItems: "center"
19
+ }),
20
+ icon: (theme) => ({
21
+ paddingRight: theme.spacing(0.75),
22
+ color: "red",
23
+ marginTop: theme.spacing(0.5)
24
+ }),
25
+ message: {
26
+ flexGrow: 1
27
+ },
28
+ button: (theme) => ({
29
+ backgroundColor: "#f6b26b",
30
+ border: "none",
31
+ cursor: "pointer",
32
+ borderRadius: theme.spacing(0.5),
33
+ marginRight: theme.spacing(0.5),
34
+ width: theme.spacing(3.5),
35
+ height: theme.spacing(3.5),
36
+ "&:hover": {
37
+ backgroundColor: "#e39648"
38
+ },
39
+ "& svg": {
40
+ width: "100%",
41
+ height: "100%"
42
+ }
43
+ })
44
+ };
45
+ function MessageBanner({ children }) {
46
+ const [visible, setVisible] = useState(true);
47
+ return visible && /* @__PURE__ */ jsxs(Box, { sx: styles.banner, children: [
48
+ /* @__PURE__ */ jsx(Box, { sx: styles.icon, children: /* @__PURE__ */ jsx(WarningAmberIcon, {}) }),
49
+ /* @__PURE__ */ jsx(Box, { sx: styles.message, children }),
50
+ /* @__PURE__ */ jsx(Box, { sx: styles.button, onClick: () => setVisible(false), children: /* @__PURE__ */ jsx(CloseIcon, {}) })
51
+ ] });
52
+ }
53
+ export {
54
+ MessageBanner as default
55
+ };
@@ -10,7 +10,6 @@ export type GsLangUser = typeof LANG_ENGLISH | typeof LANG_FRENCH;
10
10
  export type GsLang = GsLangUser | typeof LANG_SYSTEM;
11
11
  export type GsTheme = typeof LIGHT_THEME | typeof DARK_THEME;
12
12
  export type TopBarProps = Omit<GridLogoProps, 'onClick'> & Omit<LogoutProps, 'disabled'> & Omit<AboutDialogProps, 'open' | 'onClose'> & {
13
- onParametersClick?: () => void;
14
13
  onLogoClick: GridLogoProps['onClick'];
15
14
  user?: User;
16
15
  onAboutClick?: () => void;
@@ -22,5 +21,7 @@ export type TopBarProps = Omit<GridLogoProps, 'onClick'> & Omit<LogoutProps, 'di
22
21
  equipmentLabelling?: boolean;
23
22
  onLanguageClick: (value: GsLang) => void;
24
23
  language: GsLang;
24
+ developerMode: boolean;
25
+ onDeveloperModeClick?: (value: boolean) => void;
25
26
  };
26
- export declare function TopBar({ appName, appColor, appLogo, appVersion, appLicense, logoAboutDialog, onParametersClick, onLogoutClick, onLogoClick, user, children, appsAndUrls, onAboutClick, globalVersionPromise, additionalModulesPromise, onThemeClick, theme, onEquipmentLabellingClick, equipmentLabelling, onLanguageClick, language, }: PropsWithChildren<TopBarProps>): import("react/jsx-runtime").JSX.Element;
27
+ export declare function TopBar({ appName, appColor, appLogo, appVersion, appLicense, logoAboutDialog, onLogoutClick, onLogoClick, user, children, appsAndUrls, onAboutClick, globalVersionPromise, additionalModulesPromise, onThemeClick, theme, developerMode, onDeveloperModeClick, onEquipmentLabellingClick, equipmentLabelling, onLanguageClick, language, }: PropsWithChildren<TopBarProps>): import("react/jsx-runtime").JSX.Element;