@gridsuite/commons-ui 0.63.4 → 0.64.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 (131) hide show
  1. package/dist/_mocks_/svg.js +1 -3
  2. package/dist/assets/expert-filter-form.css +18 -8
  3. package/dist/components/AuthenticationRouter/AuthenticationRouter.js +88 -97
  4. package/dist/components/CardErrorBoundary/card-error-boundary.js +6 -20
  5. package/dist/components/CustomAGGrid/custom-aggrid.js +47 -49
  6. package/dist/components/DirectoryItemSelector/directory-item-selector.js +10 -40
  7. package/dist/components/ElementSearchDialog/element-search-dialog.js +1 -17
  8. package/dist/components/ElementSearchDialog/equipment-item.js +29 -47
  9. package/dist/components/ElementSearchDialog/tag-renderer.js +2 -8
  10. package/dist/components/ElementSearchDialog/use-element-search.js +1 -4
  11. package/dist/components/FlatParameters/FlatParameters.js +13 -77
  12. package/dist/components/Login/Login.js +9 -34
  13. package/dist/components/Login/Logout.js +3 -26
  14. package/dist/components/MuiVirtualizedTable/ColumnHeader.js +35 -64
  15. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +4 -17
  16. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +1 -1
  17. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +19 -95
  18. package/dist/components/MuiVirtualizedTable/index.d.ts +1 -1
  19. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +2 -6
  20. package/dist/components/OverflowableText/overflowable-text.js +3 -10
  21. package/dist/components/ReportViewer/filter-button.d.ts +1 -1
  22. package/dist/components/ReportViewer/filter-button.js +2 -7
  23. package/dist/components/ReportViewer/log-report-item.js +7 -17
  24. package/dist/components/ReportViewer/log-report.js +4 -13
  25. package/dist/components/ReportViewer/log-table.d.ts +1 -1
  26. package/dist/components/ReportViewer/log-table.js +3 -16
  27. package/dist/components/ReportViewer/multi-select-list.d.ts +1 -1
  28. package/dist/components/ReportViewer/multi-select-list.js +2 -14
  29. package/dist/components/ReportViewer/report-item.js +4 -10
  30. package/dist/components/ReportViewer/report-viewer.d.ts +1 -1
  31. package/dist/components/ReportViewer/report-viewer.js +2 -7
  32. package/dist/components/ReportViewerDialog/report-viewer-dialog.js +1 -13
  33. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +1 -1
  34. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +1 -4
  35. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +1 -1
  36. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +1 -4
  37. package/dist/components/SnackbarProvider/SnackbarProvider.js +4 -11
  38. package/dist/components/TopBar/AboutDialog.js +51 -152
  39. package/dist/components/TopBar/GridLogo.d.ts +2 -2
  40. package/dist/components/TopBar/GridLogo.js +8 -41
  41. package/dist/components/TopBar/TopBar.js +197 -328
  42. package/dist/components/TreeViewFinder/TreeViewFinder.js +23 -66
  43. package/dist/components/TreeViewFinder/index.d.ts +2 -2
  44. package/dist/components/dialogs/custom-mui-dialog.d.ts +2 -1
  45. package/dist/components/dialogs/custom-mui-dialog.js +64 -39
  46. package/dist/components/dialogs/modify-element-selection.js +1 -3
  47. package/dist/components/dialogs/popup-confirmation-dialog.d.ts +1 -1
  48. package/dist/components/dialogs/popup-confirmation-dialog.js +8 -15
  49. package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +3 -18
  50. package/dist/components/filter/criteria-based/criteria-based-filter-utils.js +3 -9
  51. package/dist/components/filter/criteria-based/criteria-based-form.d.ts +1 -1
  52. package/dist/components/filter/criteria-based/criteria-based-form.js +7 -15
  53. package/dist/components/filter/criteria-based/filter-free-properties.d.ts +1 -1
  54. package/dist/components/filter/criteria-based/filter-free-properties.js +1 -4
  55. package/dist/components/filter/criteria-based/filter-properties.js +16 -24
  56. package/dist/components/filter/criteria-based/filter-property.js +1 -4
  57. package/dist/components/filter/expert/expert-filter-constants.d.ts +10 -3
  58. package/dist/components/filter/expert/expert-filter-constants.js +16 -12
  59. package/dist/components/filter/expert/expert-filter-edition-dialog.js +3 -18
  60. package/dist/components/filter/expert/expert-filter-form.js +1 -7
  61. package/dist/components/filter/expert/expert-filter-utils.js +10 -30
  62. package/dist/components/filter/expert/expert-filter.type.d.ts +3 -1
  63. package/dist/components/filter/expert/expert-filter.type.js +2 -0
  64. package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +2 -15
  65. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.d.ts +1 -1
  66. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +10 -35
  67. package/dist/components/filter/filter-creation-dialog.js +5 -10
  68. package/dist/components/filter/filter-form.js +3 -17
  69. package/dist/components/filter/utils/filter-api.js +1 -7
  70. package/dist/components/inputs/react-hook-form/ExpandingTextField.js +1 -9
  71. package/dist/components/inputs/react-hook-form/ag-grid-table/bottom-right-buttons.js +14 -52
  72. package/dist/components/inputs/react-hook-form/ag-grid-table/csv-uploader/csv-uploader.js +14 -62
  73. package/dist/components/inputs/react-hook-form/ag-grid-table/custom-ag-grid-table.js +29 -40
  74. package/dist/components/inputs/react-hook-form/autocomplete-inputs/autocomplete-input.js +2 -8
  75. package/dist/components/inputs/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.js +1 -3
  76. package/dist/components/inputs/react-hook-form/booleans/boolean-input.js +1 -7
  77. package/dist/components/inputs/react-hook-form/booleans/checkbox-input.js +1 -9
  78. package/dist/components/inputs/react-hook-form/booleans/switch-input.js +1 -9
  79. package/dist/components/inputs/react-hook-form/description-field.d.ts +8 -0
  80. package/dist/components/inputs/react-hook-form/description-field.js +48 -0
  81. package/dist/components/inputs/react-hook-form/directory-items-input.js +5 -29
  82. package/dist/components/inputs/react-hook-form/error-management/error-input.d.ts +1 -1
  83. package/dist/components/inputs/react-hook-form/provider/custom-form-provider.js +1 -7
  84. package/dist/components/inputs/react-hook-form/radio-input.js +8 -18
  85. package/dist/components/inputs/react-hook-form/range-input.js +1 -4
  86. package/dist/components/inputs/react-hook-form/select-inputs/countries-input.js +1 -9
  87. package/dist/components/inputs/react-hook-form/select-inputs/mui-select-input.js +2 -13
  88. package/dist/components/inputs/react-hook-form/select-inputs/select-input.js +2 -6
  89. package/dist/components/inputs/react-hook-form/slider-input.d.ts +1 -1
  90. package/dist/components/inputs/react-hook-form/slider-input.js +2 -19
  91. package/dist/components/inputs/react-hook-form/unique-name-input.js +1 -9
  92. package/dist/components/inputs/react-hook-form/utils/field-label.d.ts +1 -1
  93. package/dist/components/inputs/react-hook-form/utils/field-label.js +1 -5
  94. package/dist/components/inputs/react-hook-form/utils/submit-button.js +1 -8
  95. package/dist/components/inputs/react-hook-form/utils/text-field-with-adornment.js +18 -47
  96. package/dist/components/inputs/react-query-builder/add-button.js +1 -10
  97. package/dist/components/inputs/react-query-builder/autocomplete-with-favorites.d.ts +12 -0
  98. package/dist/components/inputs/react-query-builder/autocomplete-with-favorites.js +43 -0
  99. package/dist/components/inputs/react-query-builder/composite-rule-editor/group-value-editor.js +14 -27
  100. package/dist/components/inputs/react-query-builder/composite-rule-editor/rule-value-editor.js +1 -3
  101. package/dist/components/inputs/react-query-builder/country-value-editor.js +27 -28
  102. package/dist/components/inputs/react-query-builder/custom-react-query-builder.js +25 -31
  103. package/dist/components/inputs/react-query-builder/element-value-editor.js +1 -10
  104. package/dist/components/inputs/react-query-builder/property-value-editor.js +6 -11
  105. package/dist/components/inputs/react-query-builder/remove-button.js +1 -9
  106. package/dist/components/inputs/react-query-builder/text-value-editor.js +2 -1
  107. package/dist/components/inputs/react-query-builder/translated-value-editor.js +3 -4
  108. package/dist/components/inputs/react-query-builder/use-convert-value.d.ts +1 -1
  109. package/dist/components/inputs/react-query-builder/use-convert-value.js +1 -6
  110. package/dist/components/inputs/react-query-builder/value-editor.js +4 -20
  111. package/dist/components/translations/filter-expert-en.d.ts +2 -0
  112. package/dist/components/translations/filter-expert-en.js +3 -1
  113. package/dist/components/translations/filter-expert-fr.d.ts +2 -0
  114. package/dist/components/translations/filter-expert-fr.js +3 -1
  115. package/dist/hooks/localized-countries-hook.js +1 -3
  116. package/dist/hooks/useConfidentialityWarning.d.ts +8 -0
  117. package/dist/hooks/useConfidentialityWarning.js +14 -0
  118. package/dist/hooks/useDebounce.js +1 -4
  119. package/dist/hooks/useSnackMessage.js +3 -12
  120. package/dist/index.d.ts +11 -9
  121. package/dist/index.js +157 -151
  122. package/dist/services/apps-metadata.d.ts +7 -0
  123. package/dist/services/apps-metadata.js +13 -0
  124. package/dist/services/directory.js +3 -11
  125. package/dist/services/explore.js +2 -8
  126. package/dist/services/index.js +3 -1
  127. package/dist/services/utils.js +4 -12
  128. package/dist/utils/AuthService.js +8 -29
  129. package/dist/utils/UserManagerMock.js +6 -23
  130. package/dist/utils/styles.js +1 -6
  131. package/package.json +1 -1
@@ -0,0 +1,43 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Autocomplete, TextField, Box } from "@mui/material";
3
+ import { useMemo } from "react";
4
+ const styles = {
5
+ favBox: (theme) => ({
6
+ borderBottom: "1px solid",
7
+ borderColor: theme.palette.divider
8
+ })
9
+ };
10
+ function AutocompleteWithFavorites({
11
+ favorites,
12
+ valid,
13
+ options,
14
+ value,
15
+ ...otherProps
16
+ }) {
17
+ const optionsWithFavorites = useMemo(() => {
18
+ if (favorites) {
19
+ const optionsWithoutFavorites = options.filter((option) => !favorites.includes(option));
20
+ return [...favorites, ...optionsWithoutFavorites];
21
+ }
22
+ return options;
23
+ }, [options, favorites]);
24
+ return /* @__PURE__ */ jsx(
25
+ Autocomplete,
26
+ {
27
+ size: "small",
28
+ value,
29
+ options: optionsWithFavorites,
30
+ ...otherProps,
31
+ groupBy: (option) => favorites.includes(option) ? `fav` : "not_fav",
32
+ multiple: Array.isArray(value),
33
+ renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
34
+ renderGroup: (item) => {
35
+ const { group, children } = item;
36
+ return /* @__PURE__ */ jsx(Box, { sx: styles.favBox, children }, `keyBoxGroup_${group}`);
37
+ }
38
+ }
39
+ );
40
+ }
41
+ export {
42
+ AutocompleteWithFavorites as default
43
+ };
@@ -29,33 +29,20 @@ function GroupValueEditor(props) {
29
29
  },
30
30
  [handleOnChange, combinator, value]
31
31
  );
32
- return /* @__PURE__ */ jsx(
33
- Grid,
34
- {
35
- container: true,
36
- direction: "column",
37
- sx: styles.group,
38
- paddingLeft: 1,
39
- paddingRight: 1,
40
- paddingBottom: 1,
41
- children: children && Object.values(children).map((fieldData) => {
42
- var _a;
43
- return /* @__PURE__ */ createElement(
44
- RuleValueEditor,
45
- {
46
- ...props,
47
- key: fieldData.name,
48
- field: fieldData.name,
49
- fieldData,
50
- rule: (_a = value == null ? void 0 : value.rules) == null ? void 0 : _a[fieldData.name],
51
- handleOnChangeRule: generateOnChangeRuleHandler(
52
- fieldData.name
53
- )
54
- }
55
- );
56
- })
57
- }
58
- );
32
+ return /* @__PURE__ */ jsx(Grid, { container: true, direction: "column", sx: styles.group, paddingLeft: 1, paddingRight: 1, paddingBottom: 1, children: children && Object.values(children).map((fieldData) => {
33
+ var _a;
34
+ return /* @__PURE__ */ createElement(
35
+ RuleValueEditor,
36
+ {
37
+ ...props,
38
+ key: fieldData.name,
39
+ field: fieldData.name,
40
+ fieldData,
41
+ rule: (_a = value == null ? void 0 : value.rules) == null ? void 0 : _a[fieldData.name],
42
+ handleOnChangeRule: generateOnChangeRuleHandler(fieldData.name)
43
+ }
44
+ );
45
+ }) });
59
46
  }
60
47
  export {
61
48
  GroupValueEditor as default
@@ -44,9 +44,7 @@ function RuleValueEditor(props) {
44
44
  handleOnChangeOperator(event.target.value);
45
45
  },
46
46
  variant: "standard",
47
- children: (_b = fieldData.operators) == null ? void 0 : _b.map(
48
- (option) => /* @__PURE__ */ jsx(MenuItem, { value: option.name, children: intl.formatMessage({ id: option.label }) }, option.name)
49
- )
47
+ children: (_b = fieldData.operators) == null ? void 0 : _b.map((option) => /* @__PURE__ */ jsx(MenuItem, { value: option.name, children: intl.formatMessage({ id: option.label }) }, option.name))
50
48
  }
51
49
  ) }),
52
50
  /* @__PURE__ */ jsx(Grid, { container: true, item: true, xs: 5.5, sx: styles.gridItem, paddingLeft: 1, children: /* @__PURE__ */ jsx(
@@ -1,43 +1,42 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { MaterialValueEditor } from "@react-querybuilder/material";
3
- import { Autocomplete, TextField } from "@mui/material";
4
- import { useMemo } from "react";
5
- import useConvertValue from "./use-convert-value.js";
6
- import useValid from "./use-valid.js";
2
+ import { useState, useEffect } from "react";
7
3
  import { useLocalizedCountries } from "../../../hooks/localized-countries-hook.js";
8
4
  import useCustomFormContext from "../react-hook-form/provider/use-custom-form-context.js";
5
+ import { fetchFavoriteAndDefaultCountries } from "../../../services/apps-metadata.js";
6
+ import AutocompleteWithFavorites from "./autocomplete-with-favorites.js";
7
+ import useConvertValue from "./use-convert-value.js";
8
+ import useValid from "./use-valid.js";
9
9
  function CountryValueEditor(props) {
10
+ const { value, handleOnChange } = props;
10
11
  const { language } = useCustomFormContext();
11
12
  const { translate, countryCodes } = useLocalizedCountries(language);
12
- const { value, handleOnChange } = props;
13
- const countriesList = useMemo(
14
- () => countryCodes.map((country) => {
15
- return { name: country, label: translate(country) };
16
- }),
17
- [countryCodes, translate]
18
- );
13
+ const [favoriteCountryCodes, setFavoriteCountryCodes] = useState([]);
14
+ const [initialized, setInitialized] = useState(false);
15
+ useEffect(() => {
16
+ if (!initialized) {
17
+ fetchFavoriteAndDefaultCountries().then(({ favoriteCountries, defaultCountry }) => {
18
+ setFavoriteCountryCodes(favoriteCountries);
19
+ if (defaultCountry && !value) {
20
+ handleOnChange(defaultCountry);
21
+ }
22
+ setInitialized(true);
23
+ });
24
+ }
25
+ }, [initialized, setInitialized, handleOnChange, value]);
19
26
  useConvertValue(props);
20
27
  const valid = useValid(props);
21
- if (!Array.isArray(value)) {
22
- return /* @__PURE__ */ jsx(
23
- MaterialValueEditor,
24
- {
25
- ...props,
26
- values: countriesList,
27
- title: void 0
28
- }
29
- );
30
- }
31
28
  return /* @__PURE__ */ jsx(
32
- Autocomplete,
29
+ AutocompleteWithFavorites,
33
30
  {
34
31
  value,
35
32
  options: countryCodes,
36
- getOptionLabel: (code) => translate(code),
37
- onChange: (event, newValue) => handleOnChange(newValue),
38
- multiple: true,
39
- fullWidth: true,
40
- renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid })
33
+ favorites: favoriteCountryCodes,
34
+ getOptionLabel: (code) => code ? translate(code) : "",
35
+ valid,
36
+ onChange: (event, newValue) => {
37
+ handleOnChange(newValue);
38
+ },
39
+ fullWidth: true
41
40
  }
42
41
  );
43
42
  }
@@ -53,39 +53,33 @@ function CustomReactQueryBuilder(props) {
53
53
  }));
54
54
  }, [intl]);
55
55
  return /* @__PURE__ */ jsxs(Fragment, { children: [
56
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(QueryBuilderMaterial, { children: /* @__PURE__ */ jsx(
57
- QueryBuilderDnD,
56
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(QueryBuilderMaterial, { children: /* @__PURE__ */ jsx(QueryBuilderDnD, { dnd: { ...ReactDnD, ...ReactDndHtml5Backend }, children: /* @__PURE__ */ jsx(
57
+ QueryBuilder,
58
58
  {
59
- dnd: { ...ReactDnD, ...ReactDndHtml5Backend },
60
- children: /* @__PURE__ */ jsx(
61
- QueryBuilder,
62
- {
63
- fields,
64
- query,
65
- addRuleToNewGroups: true,
66
- combinators,
67
- onQueryChange: handleQueryChange,
68
- getOperators: (fieldName) => getOperators(fieldName, intl),
69
- validator: queryValidator,
70
- controlClassnames: {
71
- queryBuilder: "queryBuilder-branches"
72
- },
73
- controlElements: {
74
- addRuleAction: RuleAddButton,
75
- addGroupAction: GroupAddButton,
76
- combinatorSelector: CombinatorSelector,
77
- removeRuleAction: RemoveButton,
78
- removeGroupAction: RemoveButton,
79
- valueEditor: ValueEditor,
80
- operatorSelector: ValueSelector,
81
- fieldSelector: ValueSelector,
82
- valueSourceSelector: ValueSelector
83
- },
84
- listsAsArrays: true
85
- }
86
- )
59
+ fields,
60
+ query,
61
+ addRuleToNewGroups: true,
62
+ combinators,
63
+ onQueryChange: handleQueryChange,
64
+ getOperators: (fieldName) => getOperators(fieldName, intl),
65
+ validator: queryValidator,
66
+ controlClassnames: {
67
+ queryBuilder: "queryBuilder-branches"
68
+ },
69
+ controlElements: {
70
+ addRuleAction: RuleAddButton,
71
+ addGroupAction: GroupAddButton,
72
+ combinatorSelector: CombinatorSelector,
73
+ removeRuleAction: RemoveButton,
74
+ removeGroupAction: RemoveButton,
75
+ valueEditor: ValueEditor,
76
+ operatorSelector: ValueSelector,
77
+ fieldSelector: ValueSelector,
78
+ valueSourceSelector: ValueSelector
79
+ },
80
+ listsAsArrays: true
87
81
  }
88
- ) }) }),
82
+ ) }) }) }),
89
83
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(ErrorInput, { name, InputField: FieldErrorAlert }) })
90
84
  ] });
91
85
  }
@@ -5,16 +5,7 @@ import useCustomFormContext from "../react-hook-form/provider/use-custom-form-co
5
5
  import { fetchElementsInfos } from "../../../services/explore.js";
6
6
  import DirectoryItemsInput from "../react-hook-form/directory-items-input.js";
7
7
  function ElementValueEditor(props) {
8
- const {
9
- defaultValue,
10
- name,
11
- elementType,
12
- equipmentTypes,
13
- titleId,
14
- hideErrorMessage,
15
- itemFilter,
16
- onChange
17
- } = props;
8
+ const { defaultValue, name, elementType, equipmentTypes, titleId, hideErrorMessage, itemFilter, onChange } = props;
18
9
  const { setValue } = useCustomFormContext();
19
10
  useEffect(() => {
20
11
  if (defaultValue && Array.isArray(defaultValue) && defaultValue.length > 0 && defaultValue[0].length > 0 && validate(defaultValue[0])) {
@@ -57,26 +57,20 @@ function PropertyValueEditor(props) {
57
57
  renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
58
58
  onChange: (event, value) => {
59
59
  onChange(FieldConstants.PROPERTY_NAME, value);
60
- }
60
+ },
61
+ size: "small"
61
62
  }
62
63
  ) }),
63
64
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 2.5, children: /* @__PURE__ */ jsx(
64
65
  Select,
65
66
  {
66
67
  value: propertyOperator ?? PROPERTY_VALUE_OPERATORS[0].customName,
67
- size: "medium",
68
+ size: "small",
68
69
  error: !valid,
69
70
  onChange: (event, value) => {
70
71
  onChange(FieldConstants.PROPERTY_OPERATOR, value);
71
72
  },
72
- children: PROPERTY_VALUE_OPERATORS.map((operator) => /* @__PURE__ */ jsx(
73
- MenuItem,
74
- {
75
- value: operator.customName,
76
- children: intl.formatMessage({ id: operator.label })
77
- },
78
- operator.customName
79
- ))
73
+ children: PROPERTY_VALUE_OPERATORS.map((operator) => /* @__PURE__ */ jsx(MenuItem, { value: operator.customName, children: intl.formatMessage({ id: operator.label }) }, operator.customName))
80
74
  }
81
75
  ) }),
82
76
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 4.5, children: /* @__PURE__ */ jsx(
@@ -90,7 +84,8 @@ function PropertyValueEditor(props) {
90
84
  autoSelect: true,
91
85
  onChange: (event, value) => {
92
86
  onChange(FieldConstants.PROPERTY_VALUES, value);
93
- }
87
+ },
88
+ size: "small"
94
89
  }
95
90
  ) })
96
91
  ] });
@@ -13,15 +13,7 @@ function RemoveButton(props) {
13
13
  onChange(recursiveRemove(query, path));
14
14
  }
15
15
  const isLastRuleOrGroup = path.toString() === [0].toString() && getNumberOfSiblings(path, query) === 1;
16
- return /* @__PURE__ */ jsx(
17
- IconButton,
18
- {
19
- size: "small",
20
- onClick: () => handleDelete(),
21
- className,
22
- children: !isLastRuleOrGroup && /* @__PURE__ */ jsx(DeleteIcon, {})
23
- }
24
- );
16
+ return /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => handleDelete(), className, children: !isLastRuleOrGroup && /* @__PURE__ */ jsx(DeleteIcon, {}) });
25
17
  }
26
18
  export {
27
19
  RemoveButton as default
@@ -25,7 +25,8 @@ function TextValueEditor(props) {
25
25
  onChange: (event, newValue) => handleOnChange(newValue),
26
26
  multiple: true,
27
27
  fullWidth: true,
28
- renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid })
28
+ renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
29
+ size: "small"
29
30
  }
30
31
  );
31
32
  }
@@ -20,9 +20,7 @@ function TranslatedValueEditor(props) {
20
20
  if (!values) {
21
21
  return {};
22
22
  }
23
- return Object.fromEntries(
24
- values.map((v) => [v.name, intl.formatMessage({ id: v.label })])
25
- );
23
+ return Object.fromEntries(values.map((v) => [v.name, intl.formatMessage({ id: v.label })]));
26
24
  }, [intl, values]);
27
25
  useConvertValue(props);
28
26
  const valid = useValid(props);
@@ -45,7 +43,8 @@ function TranslatedValueEditor(props) {
45
43
  onChange: (event, newValue) => handleOnChange(newValue),
46
44
  multiple: true,
47
45
  fullWidth: true,
48
- renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid })
46
+ renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
47
+ size: "small"
49
48
  }
50
49
  );
51
50
  }
@@ -5,5 +5,5 @@ import { ValueEditorProps } from 'react-querybuilder';
5
5
  * PS : can be extended to manage more than the IN operator
6
6
  * PS 2 : don't use this if the operator can be another array operator (like BETWEEN) or change a bit the conditions
7
7
  */
8
- declare const useConvertValue: ({ operator, value, fieldData: { defaultValue }, handleOnChange, }: ValueEditorProps) => void;
8
+ declare const useConvertValue: ({ operator, value, fieldData: { defaultValue }, handleOnChange }: ValueEditorProps) => void;
9
9
  export default useConvertValue;
@@ -1,11 +1,6 @@
1
1
  import { useEffect } from "react";
2
2
  import { OPERATOR_OPTIONS } from "../../filter/expert/expert-filter-constants.js";
3
- const useConvertValue = ({
4
- operator,
5
- value,
6
- fieldData: { defaultValue },
7
- handleOnChange
8
- }) => {
3
+ const useConvertValue = ({ operator, value, fieldData: { defaultValue }, handleOnChange }) => {
9
4
  useEffect(
10
5
  () => {
11
6
  if (operator === OPERATOR_OPTIONS.IN.name && !Array.isArray(value)) {
@@ -26,15 +26,7 @@ const styles = {
26
26
  }
27
27
  };
28
28
  function ValueEditor(props) {
29
- const {
30
- field,
31
- operator,
32
- value,
33
- rule,
34
- handleOnChange,
35
- inputType,
36
- fieldData
37
- } = props;
29
+ const { field, operator, value, rule, handleOnChange, inputType, fieldData } = props;
38
30
  const formContext = useFormContext();
39
31
  const { getValues } = formContext;
40
32
  const itemFilter = useCallback(
@@ -54,9 +46,7 @@ function ValueEditor(props) {
54
46
  if (operator === OPERATOR_OPTIONS.EXISTS.name || operator === OPERATOR_OPTIONS.NOT_EXISTS.name) {
55
47
  return null;
56
48
  }
57
- if ([FieldType.COUNTRY, FieldType.COUNTRY_1, FieldType.COUNTRY_2].includes(
58
- field
59
- )) {
49
+ if ([FieldType.COUNTRY, FieldType.COUNTRY_1, FieldType.COUNTRY_2].includes(field)) {
60
50
  return /* @__PURE__ */ jsx(CountryValueEditor, { ...props });
61
51
  }
62
52
  if (fieldData.dataType === DataType.ENUM) {
@@ -85,7 +75,7 @@ function ValueEditor(props) {
85
75
  }
86
76
  );
87
77
  }
88
- if (field === FieldType.ID || field === FieldType.NAME || field === FieldType.REGULATING_TERMINAL_VL_ID || field === FieldType.REGULATING_TERMINAL_CONNECTABLE_ID || field === FieldType.VOLTAGE_LEVEL_ID || field === FieldType.VOLTAGE_LEVEL_ID_1 || field === FieldType.VOLTAGE_LEVEL_ID_2 || field === FieldType.VOLTAGE_LEVEL_ID_3) {
78
+ if (fieldData.dataType === DataType.STRING) {
89
79
  return /* @__PURE__ */ jsx(TextValueEditor, { ...props });
90
80
  }
91
81
  if (fieldData.dataType === DataType.PROPERTY) {
@@ -97,13 +87,7 @@ function ValueEditor(props) {
97
87
  } else {
98
88
  equipmentType = getValues(FieldConstants.EQUIPMENT_TYPE);
99
89
  }
100
- return /* @__PURE__ */ jsx(
101
- PropertyValueEditor,
102
- {
103
- equipmentType,
104
- valueEditorProps: props
105
- }
106
- );
90
+ return /* @__PURE__ */ jsx(PropertyValueEditor, { equipmentType, valueEditorProps: props });
107
91
  }
108
92
  if (fieldData.dataType === DataType.COMBINATOR) {
109
93
  return /* @__PURE__ */ jsx(GroupValueEditor, { ...props });
@@ -174,5 +174,7 @@ declare const filterExpertEn: {
174
174
  shuntSusceptance1: string;
175
175
  shuntConductance2: string;
176
176
  shuntSusceptance2: string;
177
+ pairingKey: string;
178
+ tieLineId: string;
177
179
  };
178
180
  export default filterExpertEn;
@@ -167,7 +167,9 @@ const filterExpertEn = {
167
167
  shuntConductance1: "Shunt conductance 1 (μS)",
168
168
  shuntSusceptance1: "Shunt susceptance 1 (μS)",
169
169
  shuntConductance2: "Shunt conductance 2 (μS)",
170
- shuntSusceptance2: "Shunt susceptance 2 (μS)"
170
+ shuntSusceptance2: "Shunt susceptance 2 (μS)",
171
+ pairingKey: "Xnode",
172
+ tieLineId: "Tie line ID"
171
173
  };
172
174
  export {
173
175
  filterExpertEn as default
@@ -174,5 +174,7 @@ declare const filterExpertFr: {
174
174
  shuntSusceptance1: string;
175
175
  shuntConductance2: string;
176
176
  shuntSusceptance2: string;
177
+ pairingKey: string;
178
+ tieLineId: string;
177
179
  };
178
180
  export default filterExpertFr;
@@ -167,7 +167,9 @@ const filterExpertFr = {
167
167
  shuntConductance1: "Conductance parallèle 1 (μS)",
168
168
  shuntSusceptance1: "Susceptance parallèle 1 (μS)",
169
169
  shuntConductance2: "Conductance parallèle 2 (μS)",
170
- shuntSusceptance2: "Susceptance parallèle 2 (μS)"
170
+ shuntSusceptance2: "Susceptance parallèle 2 (μS)",
171
+ pairingKey: "Xnode",
172
+ tieLineId: "ID de l'interconnexion"
171
173
  };
172
174
  export {
173
175
  filterExpertFr as default
@@ -21,9 +21,7 @@ const useLocalizedCountries = (language) => {
21
21
  } else if (lang === "en") {
22
22
  localizedCountriesResult = localizedCountries(countriesEn);
23
23
  } else {
24
- console.warn(
25
- `Unsupported language "${lang}" for countries translation, we use english as default`
26
- );
24
+ console.warn(`Unsupported language "${lang}" for countries translation, we use english as default`);
27
25
  localizedCountriesResult = localizedCountries(countriesEn);
28
26
  }
29
27
  setLocalizedCountriesModule(localizedCountriesResult);
@@ -0,0 +1,8 @@
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
+ declare const useConfidentialityWarning: () => string | undefined;
8
+ export default useConfidentialityWarning;
@@ -0,0 +1,14 @@
1
+ import { useState, useEffect } from "react";
2
+ import { fetchEnv } from "../services/apps-metadata.js";
3
+ const useConfidentialityWarning = () => {
4
+ const [confidentialityWarningKey, setConfidentialityWarningKey] = useState();
5
+ useEffect(() => {
6
+ fetchEnv().then((res) => {
7
+ setConfidentialityWarningKey(res == null ? void 0 : res.confidentialityMessageKey);
8
+ });
9
+ }, []);
10
+ return confidentialityWarningKey;
11
+ };
12
+ export {
13
+ useConfidentialityWarning as default
14
+ };
@@ -1,10 +1,7 @@
1
1
  import { useMemo, useEffect } from "react";
2
2
  import { debounce } from "@mui/material";
3
3
  const useDebounce = (func, delay = 700) => {
4
- const debouncedChangeHandler = useMemo(
5
- () => debounce(func, delay),
6
- [func, delay]
7
- );
4
+ const debouncedChangeHandler = useMemo(() => debounce(func, delay), [func, delay]);
8
5
  useEffect(() => {
9
6
  return () => {
10
7
  debouncedChangeHandler.clear();
@@ -57,18 +57,9 @@ function useSnackMessage() {
57
57
  },
58
58
  [enqueueSnackbar, intlRef]
59
59
  );
60
- const snackError = useCallback(
61
- (snackInputs) => enqueue(snackInputs, "error"),
62
- [enqueue]
63
- );
64
- const snackWarning = useCallback(
65
- (snackInputs) => enqueue(snackInputs, "warning"),
66
- [enqueue]
67
- );
68
- const snackInfo = useCallback(
69
- (snackInputs) => enqueue(snackInputs, "info"),
70
- [enqueue]
71
- );
60
+ const snackError = useCallback((snackInputs) => enqueue(snackInputs, "error"), [enqueue]);
61
+ const snackWarning = useCallback((snackInputs) => enqueue(snackInputs, "warning"), [enqueue]);
62
+ const snackInfo = useCallback((snackInputs) => enqueue(snackInputs, "info"), [enqueue]);
72
63
  return { snackError, snackInfo, snackWarning, closeSnackbar };
73
64
  }
74
65
  export {
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ export { default as SnackbarProvider } from './components/SnackbarProvider';
12
12
  export { default as AuthenticationRouter } from './components/AuthenticationRouter';
13
13
  export type { AuthenticationRouterErrorState, AuthenticationRouterProps, UserManagerState, } from './components/AuthenticationRouter';
14
14
  export { MuiVirtualizedTable } from './components/MuiVirtualizedTable';
15
- export { KeyedColumnsRowIndexer, ChangeWays, } from './components/MuiVirtualizedTable';
15
+ export { KeyedColumnsRowIndexer, ChangeWays } from './components/MuiVirtualizedTable';
16
16
  export { default as ReportViewer } from './components/ReportViewer';
17
17
  export { default as ReportViewerDialog } from './components/ReportViewerDialog';
18
18
  export { default as OverflowableText } from './components/OverflowableText';
@@ -22,6 +22,7 @@ export { default as ExpandableGroup } from './components/ExpandableGroup';
22
22
  export { default as MultipleSelectionDialog } from './components/MultipleSelectionDialog';
23
23
  export { default as CustomMuiDialog } from './components/dialogs/custom-mui-dialog';
24
24
  export { default as DescriptionModificationDialog } from './components/dialogs/description-modification-dialog';
25
+ export { default as DescriptionField } from './components/inputs/react-hook-form/description-field';
25
26
  export { default as ModifyElementSelection } from './components/dialogs/modify-element-selection';
26
27
  export { default as CriteriaBasedForm } from './components/filter/criteria-based/criteria-based-form';
27
28
  export { default as PopupConfirmationDialog } from './components/dialogs/popup-confirmation-dialog';
@@ -34,19 +35,19 @@ export { default as FieldConstants } from './utils/field-constants';
34
35
  export { fields as EXPERT_FILTER_FIELDS } from './components/filter/expert/expert-filter-constants';
35
36
  export { default as CustomReactQueryBuilder } from './components/inputs/react-query-builder/custom-react-query-builder';
36
37
  export { EXPERT_FILTER_QUERY, rqbQuerySchemaValidator, getExpertFilterEmptyFormData, } from './components/filter/expert/expert-filter-form';
37
- export { importExpertRules, exportExpertRules, } from './components/filter/expert/expert-filter-utils';
38
- export type { RuleTypeExport, RuleGroupTypeExport, } from './components/filter/expert/expert-filter.type';
38
+ export { importExpertRules, exportExpertRules } from './components/filter/expert/expert-filter-utils';
39
+ export type { RuleTypeExport, RuleGroupTypeExport } from './components/filter/expert/expert-filter.type';
39
40
  export { formatQuery } from 'react-querybuilder';
40
41
  export { default as yup } from './utils/yup-config';
41
42
  export type { TreeViewFinderNodeProps } from './components/TreeViewFinder/TreeViewFinder';
42
43
  export { GRIDSUITE_DEFAULT_PRECISION, roundToPrecision, roundToDefaultPrecision, isBlankOrEmpty, unitToMicroUnit, microUnitToUnit, } from './utils/conversion-utils';
43
44
  export { ElementType } from './utils/ElementType';
44
45
  export type { ElementAttributes, Option, Equipment } from './utils/types';
45
- export { EQUIPMENT_TYPE, EquipmentType, getEquipmentsInfosForSearchBar, equipmentStyles, } from './utils/EquipmentType';
46
+ export { EQUIPMENT_TYPE, EquipmentType, getEquipmentsInfosForSearchBar, equipmentStyles } from './utils/EquipmentType';
46
47
  export { initializeAuthenticationDev, initializeAuthenticationProd, logout, dispatchUser, getPreLoginPath, } from './utils/AuthService';
47
48
  export { default as getFileIcon } from './utils/ElementIcon';
48
49
  export { DEFAULT_CELL_PADDING, DEFAULT_HEADER_HEIGHT, DEFAULT_ROW_HEIGHT, } from './components/MuiVirtualizedTable/MuiVirtualizedTable';
49
- export { DARK_THEME, LIGHT_THEME, LANG_SYSTEM, LANG_ENGLISH, LANG_FRENCH, } from './components/TopBar/TopBar';
50
+ export { DARK_THEME, LIGHT_THEME, LANG_SYSTEM, LANG_ENGLISH, LANG_FRENCH } from './components/TopBar/TopBar';
50
51
  export type { GsLang, GsLangUser, GsTheme } from './components/TopBar/TopBar';
51
52
  export { USER, setLoggedUser, SIGNIN_CALLBACK_ERROR, setSignInCallbackError, UNAUTHORIZED_USER_INFO, LOGOUT_ERROR, USER_VALIDATION_ERROR, RESET_AUTHENTICATION_ROUTER_ERROR, SHOW_AUTH_INFO_LOGIN, } from './redux/authActions';
52
53
  export type { AuthenticationActions, AuthenticationRouterErrorBase, AuthenticationRouterErrorAction, LogoutErrorAction, ShowAuthenticationRouterLoginAction, SignInCallbackErrorAction, UnauthorizedUserAction, UserAction, UserValidationErrorAction, } from './redux/authActions';
@@ -78,7 +79,7 @@ export { default as common_button_en } from './components/translations/common-bu
78
79
  export { default as common_button_fr } from './components/translations/common-button-fr';
79
80
  export { default as directory_items_input_en } from './components/translations/directory-items-input-en';
80
81
  export { default as directory_items_input_fr } from './components/translations/directory-items-input-fr';
81
- export { TagRenderer, ElementSearchInput, useElementSearch, } from './components/ElementSearchDialog';
82
+ export { TagRenderer, ElementSearchInput, useElementSearch } from './components/ElementSearchDialog';
82
83
  export type { Paginated } from './components/ElementSearchDialog';
83
84
  export type { TagRendererProps } from './components/ElementSearchDialog';
84
85
  export { EquipmentItem } from './components/ElementSearchDialog/equipment-item';
@@ -87,6 +88,7 @@ export { default as useIntlRef } from './hooks/useIntlRef';
87
88
  export { useSnackMessage } from './hooks/useSnackMessage';
88
89
  export { default as useDebounce } from './hooks/useDebounce';
89
90
  export { default as usePrevious } from './hooks/usePrevious';
91
+ export { default as useConfidentialityWarning } from './hooks/useConfidentialityWarning';
90
92
  export { default as SelectClearable } from './components/inputs/select-clearable';
91
93
  export { default as useCustomFormContext } from './components/inputs/react-hook-form/provider/use-custom-form-context';
92
94
  export { default as CustomFormProvider } from './components/inputs/react-hook-form/provider/custom-form-provider';
@@ -108,7 +110,7 @@ export { default as FieldLabel } from './components/inputs/react-hook-form/utils
108
110
  export { default as SubmitButton } from './components/inputs/react-hook-form/utils/submit-button';
109
111
  export { default as CancelButton } from './components/inputs/react-hook-form/utils/cancel-button';
110
112
  export { genHelperPreviousValue, genHelperError, identity, isFieldRequired, gridItem, isFloatNumber, toFloatOrNullValue, } from './components/inputs/react-hook-form/utils/functions';
111
- export { keyGenerator, areArrayElementsUnique, isObjectEmpty, } from './utils/functions';
113
+ export { keyGenerator, areArrayElementsUnique, isObjectEmpty } from './utils/functions';
112
114
  export { default as DirectoryItemsInput } from './components/inputs/react-hook-form/directory-items-input';
113
115
  export { default as DirectoryItemSelector } from './components/DirectoryItemSelector/directory-item-selector';
114
116
  export { default as CustomAGGrid } from './components/CustomAGGrid/custom-aggrid';
@@ -122,12 +124,12 @@ export { default as RangeInput, DEFAULT_RANGE_VALUE, getRangeInputDataForm, getR
122
124
  export { default as InputWithPopupConfirmation } from './components/inputs/react-hook-form/select-inputs/input-with-popup-confirmation';
123
125
  export { default as MuiSelectInput } from './components/inputs/react-hook-form/select-inputs/mui-select-input';
124
126
  export { default as CountriesInput } from './components/inputs/react-hook-form/select-inputs/countries-input';
125
- export { getSystemLanguage, getComputedLanguage, useLocalizedCountries, } from './hooks/localized-countries-hook';
127
+ export { getSystemLanguage, getComputedLanguage, useLocalizedCountries } from './hooks/localized-countries-hook';
126
128
  export { default as MultipleAutocompleteInput } from './components/inputs/react-hook-form/autocomplete-inputs/multiple-autocomplete-input';
127
129
  export { default as CsvUploader } from './components/inputs/react-hook-form/ag-grid-table/csv-uploader/csv-uploader';
128
130
  export { default as UniqueNameInput } from './components/inputs/react-hook-form/unique-name-input';
129
131
  export { default as UserManagerMock } from './utils/UserManagerMock';
130
- export { FILTER_EQUIPMENTS, CONTINGENCY_LIST_EQUIPMENTS, } from './components/filter/utils/filter-form-utils';
132
+ export { FILTER_EQUIPMENTS, CONTINGENCY_LIST_EQUIPMENTS } from './components/filter/utils/filter-form-utils';
131
133
  export type { FormEquipment } from './components/filter/utils/filter-form-utils';
132
134
  export { getCriteriaBasedFormData, getCriteriaBasedSchema, } from './components/filter/criteria-based/criteria-based-filter-utils';
133
135
  export { mergeSx } from './utils/styles';