@gridsuite/commons-ui 0.55.0 → 0.56.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 (157) hide show
  1. package/dist/assets/criteria-based-filter-edition-dialog.css +168 -0
  2. package/dist/chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js +1673 -0
  3. package/dist/chunks/filter-properties.GRon8-ML.js +195 -0
  4. package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +13 -3
  5. package/dist/components/DirectoryItemSelector/directory-item-selector.js +14 -10
  6. package/dist/components/dialogs/custom-mui-dialog.d.ts +21 -0
  7. package/dist/components/dialogs/custom-mui-dialog.js +87 -0
  8. package/dist/components/dialogs/description-modification-dialog.d.ts +11 -0
  9. package/dist/components/dialogs/description-modification-dialog.js +71 -0
  10. package/dist/components/dialogs/popup-confirmation-dialog.d.ts +11 -0
  11. package/dist/components/dialogs/popup-confirmation-dialog.js +38 -0
  12. package/dist/components/filter/constants/equipment-types.d.ts +72 -0
  13. package/dist/components/filter/constants/equipment-types.js +63 -0
  14. package/dist/components/filter/constants/expert-filter-constants.d.ts +546 -0
  15. package/dist/components/filter/constants/expert-filter-constants.js +663 -0
  16. package/dist/components/filter/constants/field-constants.d.ts +45 -0
  17. package/dist/components/filter/constants/field-constants.js +43 -0
  18. package/dist/components/filter/constants/filter-constants.d.ts +21 -0
  19. package/dist/components/filter/constants/filter-constants.js +10 -0
  20. package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.d.ts +29 -0
  21. package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +19 -0
  22. package/dist/components/filter/criteria-based/criteria-based-filter-form.d.ts +15 -0
  23. package/dist/components/filter/criteria-based/criteria-based-filter-form.js +33 -0
  24. package/dist/components/filter/criteria-based/criteria-based-filter-utils.d.ts +37 -0
  25. package/dist/components/filter/criteria-based/criteria-based-filter-utils.js +127 -0
  26. package/dist/components/filter/criteria-based/criteria-based-form.d.ts +7 -0
  27. package/dist/components/filter/criteria-based/criteria-based-form.js +50 -0
  28. package/dist/components/filter/criteria-based/filter-free-properties.d.ts +10 -0
  29. package/dist/components/filter/criteria-based/filter-free-properties.js +15 -0
  30. package/dist/components/filter/criteria-based/filter-properties.d.ts +21 -0
  31. package/dist/components/filter/criteria-based/filter-properties.js +19 -0
  32. package/dist/components/filter/criteria-based/filter-property.d.ts +19 -0
  33. package/dist/components/filter/criteria-based/filter-property.js +67 -0
  34. package/dist/components/filter/expert/expert-filter-edition-dialog.d.ts +28 -0
  35. package/dist/components/filter/expert/expert-filter-edition-dialog.js +20 -0
  36. package/dist/components/filter/expert/expert-filter-form.d.ts +21 -0
  37. package/dist/components/filter/expert/expert-filter-form.js +22 -0
  38. package/dist/components/filter/expert/expert-filter-utils.d.ts +19 -0
  39. package/dist/components/filter/expert/expert-filter-utils.js +302 -0
  40. package/dist/components/filter/expert/expert-filter.type.d.ts +113 -0
  41. package/dist/components/filter/expert/expert-filter.type.js +103 -0
  42. package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.d.ts +22 -0
  43. package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +19 -0
  44. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.d.ts +22 -0
  45. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +23 -0
  46. package/dist/components/filter/filter-context.d.ts +12 -0
  47. package/dist/components/filter/filter-context.js +10 -0
  48. package/dist/components/filter/filter-creation-dialog.d.ts +21 -0
  49. package/dist/components/filter/filter-creation-dialog.js +17 -0
  50. package/dist/components/filter/filter-form.d.ts +11 -0
  51. package/dist/components/filter/filter-form.js +14 -0
  52. package/dist/components/filter/utils/criteria-based-utils.d.ts +28 -0
  53. package/dist/components/filter/utils/criteria-based-utils.js +197 -0
  54. package/dist/components/filter/utils/filters-utils.d.ts +5 -0
  55. package/dist/components/filter/utils/filters-utils.js +99 -0
  56. package/dist/components/inputs/select-clearable.d.ts +14 -0
  57. package/dist/components/inputs/select-clearable.js +40 -0
  58. package/dist/components/react-hook-form/ExpandingTextField.d.ts +1 -1
  59. package/dist/components/react-hook-form/ExpandingTextField.js +0 -37
  60. package/dist/components/react-hook-form/ag-grid-table-rhf/bottom-right-buttons.d.ts +17 -0
  61. package/dist/components/react-hook-form/ag-grid-table-rhf/bottom-right-buttons.js +15 -0
  62. package/dist/components/react-hook-form/ag-grid-table-rhf/cell-editors/numericEditor.d.ts +23 -0
  63. package/dist/components/react-hook-form/ag-grid-table-rhf/cell-editors/numericEditor.js +70 -0
  64. package/dist/components/react-hook-form/ag-grid-table-rhf/csv-uploader/csv-uploader.d.ts +16 -0
  65. package/dist/components/react-hook-form/ag-grid-table-rhf/csv-uploader/csv-uploader.js +69 -0
  66. package/dist/components/react-hook-form/ag-grid-table-rhf/custom-ag-grid-table.d.ts +23 -0
  67. package/dist/components/react-hook-form/ag-grid-table-rhf/custom-ag-grid-table.js +15 -0
  68. package/dist/components/react-hook-form/autocomplete-input.d.ts +17 -29
  69. package/dist/components/react-hook-form/autocomplete-input.js +4 -15
  70. package/dist/components/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.d.ts +2 -0
  71. package/dist/components/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.js +46 -0
  72. package/dist/components/react-hook-form/directory-items-input.d.ts +0 -3
  73. package/dist/components/react-hook-form/directory-items-input.js +5 -6
  74. package/dist/components/react-hook-form/error-management/error-input.d.ts +13 -4
  75. package/dist/components/react-hook-form/error-management/error-input.js +7 -7
  76. package/dist/components/react-hook-form/error-management/field-error-alert.d.ts +6 -3
  77. package/dist/components/react-hook-form/error-management/field-error-alert.js +3 -1
  78. package/dist/components/react-hook-form/numbers/float-input.d.ts +5 -17
  79. package/dist/components/react-hook-form/numbers/float-input.js +3 -5
  80. package/dist/components/react-hook-form/numbers/integer-input.d.ts +15 -12
  81. package/dist/components/react-hook-form/numbers/utils.d.ts +8 -2
  82. package/dist/components/react-hook-form/provider/custom-form-provider.d.ts +1 -0
  83. package/dist/components/react-hook-form/provider/custom-form-provider.js +12 -3
  84. package/dist/components/react-hook-form/radio-input.d.ts +14 -17
  85. package/dist/components/react-hook-form/radio-input.js +7 -9
  86. package/dist/components/react-hook-form/range-input.d.ts +54 -0
  87. package/dist/components/react-hook-form/range-input.js +118 -0
  88. package/dist/components/react-hook-form/select-inputs/countries-input.d.ts +8 -0
  89. package/dist/components/react-hook-form/select-inputs/countries-input.js +36 -0
  90. package/dist/components/react-hook-form/select-inputs/input-with-popup-confirmation.d.ts +2 -0
  91. package/dist/components/react-hook-form/select-inputs/input-with-popup-confirmation.js +61 -0
  92. package/dist/components/react-hook-form/select-inputs/mui-select-input.d.ts +12 -0
  93. package/dist/components/react-hook-form/select-inputs/mui-select-input.js +25 -0
  94. package/dist/components/react-hook-form/select-inputs/select-input.d.ts +9 -0
  95. package/dist/components/react-hook-form/select-inputs/select-input.js +37 -0
  96. package/dist/components/react-hook-form/text-input.d.ts +23 -32
  97. package/dist/components/react-hook-form/text-input.js +6 -20
  98. package/dist/components/react-hook-form/unique-name-input.d.ts +21 -0
  99. package/dist/components/react-hook-form/unique-name-input.js +129 -0
  100. package/dist/components/react-hook-form/utils/cancel-button.d.ts +9 -8
  101. package/dist/components/react-hook-form/utils/field-label.d.ts +12 -5
  102. package/dist/components/react-hook-form/utils/field-label.js +5 -1
  103. package/dist/components/react-hook-form/utils/functions.d.ts +12 -4
  104. package/dist/components/react-hook-form/utils/functions.js +21 -1
  105. package/dist/components/react-hook-form/utils/submit-button.d.ts +9 -8
  106. package/dist/components/react-hook-form/utils/text-field-with-adornment.d.ts +11 -11
  107. package/dist/components/react-hook-form/utils/text-field-with-adornment.js +18 -23
  108. package/dist/components/react-query-builder-inputs/add-button.d.ts +8 -0
  109. package/dist/components/react-query-builder-inputs/add-button.js +17 -0
  110. package/dist/components/react-query-builder-inputs/combinator-selector.d.ts +5 -0
  111. package/dist/components/react-query-builder-inputs/combinator-selector.js +38 -0
  112. package/dist/components/react-query-builder-inputs/country-value-editor.d.ts +5 -0
  113. package/dist/components/react-query-builder-inputs/country-value-editor.js +46 -0
  114. package/dist/components/react-query-builder-inputs/custom-react-query-builder.d.ts +8 -0
  115. package/dist/components/react-query-builder-inputs/custom-react-query-builder.js +21 -0
  116. package/dist/components/react-query-builder-inputs/element-value-editor.d.ts +14 -0
  117. package/dist/components/react-query-builder-inputs/element-value-editor.js +69 -0
  118. package/dist/components/react-query-builder-inputs/property-value-editor.d.ts +9 -0
  119. package/dist/components/react-query-builder-inputs/property-value-editor.js +100 -0
  120. package/dist/components/react-query-builder-inputs/remove-button.d.ts +5 -0
  121. package/dist/components/react-query-builder-inputs/remove-button.js +9 -0
  122. package/dist/components/react-query-builder-inputs/text-value-editor.d.ts +5 -0
  123. package/dist/components/react-query-builder-inputs/text-value-editor.js +34 -0
  124. package/dist/components/react-query-builder-inputs/translated-value-editor.d.ts +5 -0
  125. package/dist/components/react-query-builder-inputs/translated-value-editor.js +58 -0
  126. package/dist/components/react-query-builder-inputs/use-convert-value.d.ts +9 -0
  127. package/dist/components/react-query-builder-inputs/use-convert-value.js +24 -0
  128. package/dist/components/react-query-builder-inputs/use-valid.d.ts +7 -0
  129. package/dist/components/react-query-builder-inputs/use-valid.js +13 -0
  130. package/dist/components/react-query-builder-inputs/value-editor.d.ts +5 -0
  131. package/dist/components/react-query-builder-inputs/value-editor.js +18 -0
  132. package/dist/components/react-query-builder-inputs/value-selector.d.ts +4 -0
  133. package/dist/components/react-query-builder-inputs/value-selector.js +14 -0
  134. package/dist/hooks/localized-countries-hook.d.ts +6 -0
  135. package/dist/hooks/localized-countries-hook.js +45 -0
  136. package/dist/hooks/predefined-properties-hook.d.ts +18 -0
  137. package/dist/hooks/predefined-properties-hook.js +43 -0
  138. package/dist/hooks/useDebounce.d.ts +7 -1
  139. package/dist/hooks/useSnackMessage.d.ts +23 -5
  140. package/dist/hooks/useSnackMessage.js +14 -12
  141. package/dist/index.d.ts +87 -142
  142. package/dist/index.js +168 -91
  143. package/dist/utils/FetchStatus.d.ts +12 -0
  144. package/dist/utils/FetchStatus.js +9 -0
  145. package/dist/utils/conversion-utils.d.ts +12 -0
  146. package/dist/utils/conversion-utils.js +22 -0
  147. package/dist/utils/equipment-types-for-predefined-properties-mapper.d.ts +3 -0
  148. package/dist/utils/equipment-types-for-predefined-properties-mapper.js +31 -0
  149. package/dist/utils/functions.d.ts +14 -0
  150. package/dist/utils/functions.js +16 -0
  151. package/dist/utils/types.d.ts +21 -0
  152. package/dist/utils/types.js +1 -0
  153. package/dist/utils/yup-config.d.ts +8 -0
  154. package/dist/utils/yup-config.js +16 -0
  155. package/package.json +15 -2
  156. package/dist/components/react-hook-form/select-input.d.ts +0 -17
  157. package/dist/components/react-hook-form/select-input.js +0 -30
@@ -0,0 +1,7 @@
1
+ import { ValueEditorProps } from 'react-querybuilder';
2
+
3
+ /**
4
+ * Hook that return if a field of RQB is valid or not
5
+ */
6
+ declare const useValid: ({ validation }: ValueEditorProps) => boolean;
7
+ export default useValid;
@@ -0,0 +1,13 @@
1
+ const useValid = ({ validation }) => {
2
+ if (validation === void 0 || validation === null) {
3
+ return true;
4
+ }
5
+ if (typeof validation === "boolean") {
6
+ return validation;
7
+ }
8
+ const convertedValidation = validation;
9
+ return convertedValidation.valid;
10
+ };
11
+ export {
12
+ useValid as default
13
+ };
@@ -0,0 +1,5 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { ValueEditorProps } from 'react-querybuilder';
3
+
4
+ declare const ValueEditor: FunctionComponent<ValueEditorProps>;
5
+ export default ValueEditor;
@@ -0,0 +1,18 @@
1
+ import "react/jsx-runtime";
2
+ import "react";
3
+ import "@react-querybuilder/material";
4
+ import "./country-value-editor.js";
5
+ import "./translated-value-editor.js";
6
+ import "./text-value-editor.js";
7
+ import "@mui/material/Box";
8
+ import "react-hook-form";
9
+ import "../filter/constants/field-constants.js";
10
+ import "../filter/expert/expert-filter.type.js";
11
+ import "../filter/constants/equipment-types.js";
12
+ import { V } from "../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
13
+ import "../../utils/ElementType.js";
14
+ import "./property-value-editor.js";
15
+ import "../filter/constants/filter-constants.js";
16
+ export {
17
+ V as default
18
+ };
@@ -0,0 +1,4 @@
1
+ import { ValueSelectorProps } from 'react-querybuilder';
2
+
3
+ declare const ValueSelector: (props: ValueSelectorProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default ValueSelector;
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { MaterialValueSelector } from "@react-querybuilder/material";
3
+ const ValueSelector = (props) => {
4
+ return /* @__PURE__ */ jsx(
5
+ MaterialValueSelector,
6
+ {
7
+ ...props,
8
+ title: void 0
9
+ }
10
+ );
11
+ };
12
+ export {
13
+ ValueSelector as default
14
+ };
@@ -0,0 +1,6 @@
1
+ export function getSystemLanguage(): string;
2
+ export function getComputedLanguage(language: any): any;
3
+ export function useLocalizedCountries(language: any): {
4
+ translate: (countryCode: any) => any;
5
+ countryCodes: string[];
6
+ };
@@ -0,0 +1,45 @@
1
+ import { useState, useEffect, useMemo, useCallback } from "react";
2
+ import localizedCountries from "localized-countries";
3
+ import countriesFr from "localized-countries/data/fr";
4
+ import countriesEn from "localized-countries/data/en";
5
+ import { LANG_ENGLISH, LANG_SYSTEM, LANG_FRENCH } from "../components/TopBar/TopBar.js";
6
+ const supportedLanguages = [LANG_FRENCH, LANG_ENGLISH];
7
+ const getSystemLanguage = () => {
8
+ const systemLanguage = navigator.language.split(/[-_]/)[0];
9
+ return supportedLanguages.includes(systemLanguage) ? systemLanguage : LANG_ENGLISH;
10
+ };
11
+ const getComputedLanguage = (language) => {
12
+ return language === LANG_SYSTEM ? getSystemLanguage() : language;
13
+ };
14
+ const useLocalizedCountries = (language) => {
15
+ const [localizedCountriesModule, setLocalizedCountriesModule] = useState();
16
+ useEffect(() => {
17
+ const lang = getComputedLanguage(language).substring(0, 2);
18
+ let localizedCountriesResult;
19
+ if (lang === "fr") {
20
+ localizedCountriesResult = localizedCountries(countriesFr);
21
+ } else if (lang === "en") {
22
+ localizedCountriesResult = localizedCountries(countriesEn);
23
+ } else {
24
+ console.warn(
25
+ 'Unsupported language "' + lang + '" for countries translation, we use english as default'
26
+ );
27
+ localizedCountriesResult = localizedCountries(countriesEn);
28
+ }
29
+ setLocalizedCountriesModule(localizedCountriesResult);
30
+ }, [language]);
31
+ const countryCodes = useMemo(
32
+ () => localizedCountriesModule ? Object.keys(localizedCountriesModule.object()) : [],
33
+ [localizedCountriesModule]
34
+ );
35
+ const translate = useCallback(
36
+ (countryCode) => localizedCountriesModule ? localizedCountriesModule.get(countryCode) : "",
37
+ [localizedCountriesModule]
38
+ );
39
+ return { translate, countryCodes };
40
+ };
41
+ export {
42
+ getComputedLanguage,
43
+ getSystemLanguage,
44
+ useLocalizedCountries
45
+ };
@@ -0,0 +1,18 @@
1
+ import { EquipmentType, PredefinedProperties } from '../utils/types.ts';
2
+ import { Dispatch, SetStateAction } from 'react';
3
+
4
+ interface Metadata {
5
+ name: string;
6
+ url: string;
7
+ appColor: string;
8
+ hiddenInAppsMenu: boolean;
9
+ resources: unknown;
10
+ }
11
+ export interface StudyMetadata extends Metadata {
12
+ name: 'Study';
13
+ predefinedEquipmentProperties: {
14
+ [networkElementType: string]: PredefinedProperties;
15
+ };
16
+ }
17
+ export declare const usePredefinedProperties: (initialType: EquipmentType | null) => [PredefinedProperties, Dispatch<SetStateAction<EquipmentType | null>>];
18
+ export {};
@@ -0,0 +1,43 @@
1
+ import { useState, useContext, useEffect } from "react";
2
+ import { mapEquipmentTypeForPredefinedProperties } from "../utils/equipment-types-for-predefined-properties-mapper.js";
3
+ import { useSnackMessage } from "./useSnackMessage.js";
4
+ import { FilterContext } from "../components/filter/filter-context.js";
5
+ const isStudyMetadata = (metadata) => {
6
+ return metadata.name === "Study";
7
+ };
8
+ const fetchPredefinedProperties = async (equipmentType, fetchAppsAndUrls) => {
9
+ var _a;
10
+ const networkEquipmentType = mapEquipmentTypeForPredefinedProperties(equipmentType);
11
+ if (networkEquipmentType === void 0) {
12
+ return Promise.resolve(void 0);
13
+ }
14
+ const res = await fetchAppsAndUrls();
15
+ const studyMetadata = res.filter(isStudyMetadata);
16
+ if (!studyMetadata) {
17
+ return Promise.reject("Study entry could not be found in metadata");
18
+ }
19
+ return (_a = studyMetadata[0].predefinedEquipmentProperties) == null ? void 0 : _a[networkEquipmentType];
20
+ };
21
+ const usePredefinedProperties = (initialType) => {
22
+ const [type, setType] = useState(initialType);
23
+ const [equipmentPredefinedProps, setEquipmentPredefinedProps] = useState({});
24
+ const { snackError } = useSnackMessage();
25
+ const { fetchAppsAndUrls } = useContext(FilterContext);
26
+ useEffect(() => {
27
+ if (fetchAppsAndUrls && type !== null) {
28
+ fetchPredefinedProperties(type, fetchAppsAndUrls).then((p) => {
29
+ if (p !== void 0) {
30
+ setEquipmentPredefinedProps(p);
31
+ }
32
+ }).catch((error) => {
33
+ snackError({
34
+ messageTxt: error.message ?? error
35
+ });
36
+ });
37
+ }
38
+ }, [type, setEquipmentPredefinedProps, snackError, fetchAppsAndUrls]);
39
+ return [equipmentPredefinedProps, setType];
40
+ };
41
+ export {
42
+ usePredefinedProperties
43
+ };
@@ -1 +1,7 @@
1
- export function useDebounce(func: any, delay?: number): any;
1
+ /**
2
+ * Copyright (c) 2023, 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 const useDebounce: (func: (...args: any[]) => any, delay?: number) => ((...args: any[]) => any) & import('@mui/utils/debounce').Cancelable;
@@ -1,5 +1,23 @@
1
- export function useSnackMessage(): {
2
- snackError: (snackInputs: any) => void;
3
- snackInfo: (snackInputs: any) => void;
4
- snackWarning: (snackInputs: any) => void;
5
- };
1
+ /**
2
+ * Copyright (c) 2021, 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
+ interface SnackInputs {
8
+ messageTxt?: string;
9
+ messageId?: string;
10
+ messageValues?: {
11
+ [key: string]: string;
12
+ };
13
+ headerTxt?: string;
14
+ headerId?: string;
15
+ headerValues?: Record<string, string>;
16
+ }
17
+ export interface UseSnackMessageReturn {
18
+ snackError: (snackInputs: SnackInputs) => void;
19
+ snackWarning: (snackInputs: SnackInputs) => void;
20
+ snackInfo: (snackInputs: SnackInputs) => void;
21
+ }
22
+ export declare function useSnackMessage(): UseSnackMessageReturn;
23
+ export {};
@@ -26,26 +26,28 @@ function useSnackMessage() {
26
26
  }
27
27
  function makeSnackbar(snackInputs, intlRef, enqueueSnackbar, level, persistent) {
28
28
  const message = checkAndTranslateIfNecessary(
29
+ intlRef,
29
30
  snackInputs.messageTxt,
30
31
  snackInputs.messageId,
31
- snackInputs.messageValues,
32
- intlRef
32
+ snackInputs.messageValues
33
33
  );
34
34
  const header = checkAndTranslateIfNecessary(
35
+ intlRef,
35
36
  snackInputs.headerTxt,
36
37
  snackInputs.headerId,
37
- snackInputs.headerValues,
38
- intlRef
39
- );
40
- displayMessageWithSnackbar(
41
- message,
42
- header,
43
- enqueueSnackbar,
44
- level,
45
- persistent
38
+ snackInputs.headerValues
46
39
  );
40
+ if (message !== null && header !== null) {
41
+ displayMessageWithSnackbar(
42
+ message,
43
+ header,
44
+ enqueueSnackbar,
45
+ level,
46
+ persistent
47
+ );
48
+ }
47
49
  }
48
- function checkAndTranslateIfNecessary(txt, id, values, intlRef) {
50
+ function checkAndTranslateIfNecessary(intlRef, txt, id, values) {
49
51
  checkInputs(txt, id, values);
50
52
  return txt ?? (id ? intlRef.current.formatMessage(
51
53
  {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { ButtonProps, CheckboxProps, RadioGroupProps, SwitchProps, SxProps, TextFieldProps } from '@mui/material';
2
- import { AutocompleteProps } from '@mui/material/Autocomplete/Autocomplete';
1
+ import { CheckboxProps, SwitchProps, SxProps, TextFieldProps } from '@mui/material';
3
2
  import { FunctionComponent, ReactElement } from 'react';
4
3
 
5
4
 
@@ -41,8 +40,6 @@ export {
41
40
  getPreLoginPath,
42
41
  } from './utils/AuthService';
43
42
 
44
- export { getFileIcon } from './utils/ElementIcon';
45
-
46
43
  export {
47
44
  DEFAULT_CELL_PADDING,
48
45
  DEFAULT_HEADER_HEIGHT,
@@ -67,6 +64,10 @@ export {
67
64
  RESET_AUTHENTICATION_ROUTER_ERROR,
68
65
  SHOW_AUTH_INFO_LOGIN,
69
66
  } from './utils/actions';
67
+ export {
68
+ getCriteriaBasedFormData,
69
+ getCriteriaBasedSchema,
70
+ } from './components/filter/utils/criteria-based-utils';
70
71
  export { default as report_viewer_en } from './components/translations/report-viewer-en';
71
72
  export { default as report_viewer_fr } from './components/translations/report-viewer-fr';
72
73
  export { default as login_en } from './components/translations/login-en';
@@ -95,27 +96,105 @@ export { default as directory_items_input_fr } from './components/translations/d
95
96
  export { TagRenderer } from './components/ElementSearchDialog';
96
97
  export { EquipmentItem } from './components/ElementSearchDialog/equipment-item';
97
98
  export { useIntlRef } from './hooks/useIntlRef';
99
+ export { default as SelectClearable } from './components/inputs/select-clearable';
98
100
  export { useCustomFormContext } from './components/react-hook-form/provider/use-custom-form-context';
99
101
  export { default as CustomFormProvider } from './components/react-hook-form/provider/custom-form-provider';
100
102
  export { default as SliderInput } from './components/react-hook-form/slider-input';
101
103
  export { default as TextFieldWithAdornment } from './components/react-hook-form/utils/text-field-with-adornment';
104
+ export { default as SelectInput } from './components/react-hook-form/select-inputs/select-input';
105
+ export { default as ErrorInput } from './components/react-hook-form/error-management/error-input';
106
+ export { default as AutocompleteInput } from './components/react-hook-form/autocomplete-input';
107
+ export { default as TextInput } from './components/react-hook-form/text-input';
108
+ export { default as FloatInput } from './components/react-hook-form/numbers/float-input';
109
+ export { default as RadioInput } from './components/react-hook-form/radio-input';
110
+ export { default as SubmitButton } from './components/react-hook-form/utils/submit-button';
111
+ export { default as CancelButton } from './components/react-hook-form/utils/cancel-button';
112
+ export { default as FieldLabel } from './components/react-hook-form/utils/field-label';
113
+ export { default as FieldErrorAlert } from './components/react-hook-form/error-management/field-error-alert';
114
+ export { default as FilterCreationDialog } from './components/filter/filter-creation-dialog';
115
+ export { default as ExpertFilterEditionDialog } from './components/filter/expert/expert-filter-edition-dialog';
116
+ export { default as ExplicitNamingFilterEditionDialog } from './components/filter/explicit-naming/explicit-naming-filter-edition-dialog';
117
+ export { default as CriteriaBasedFilterEditionDialog } from './components/filter/criteria-based/criteria-based-filter-edition-dialog';
118
+ export { default as ExpandingTextField } from './components/react-hook-form/expanding-text-field';
119
+ export { default as CustomMuiDialog } from './components/dialogs/custom-mui-dialog';
102
120
  export {
103
121
  genHelperPreviousValue,
104
122
  genHelperError,
105
123
  identity,
106
124
  isFieldRequired,
125
+ gridItem,
126
+ isFloatNumber,
127
+ toFloatOrNullValue,
107
128
  } from './components/react-hook-form/utils/functions';
108
129
  export { default as DirectoryItemsInput } from './components/react-hook-form/directory-items-input';
109
130
  export { default as DirectoryItemSelector } from './components/DirectoryItemSelector/directory-item-selector';
110
131
  export { RawReadOnlyInput } from './components/react-hook-form/raw-read-only-input';
111
132
  export { UserManagerMock } from './utils/UserManagerMock';
133
+ export {
134
+ keyGenerator,
135
+ areArrayElementsUnique,
136
+ mergeSx,
137
+ isObjectEmpty,
138
+ } from './utils/functions';
112
139
 
140
+ export { ElementType, getFileIcon } from './utils/ElementType';
141
+ export {
142
+ saveExplicitNamingFilter,
143
+ saveCriteriaBasedFilter,
144
+ saveExpertFilter,
145
+ } from './components/filter/utils/filters-utils';
113
146
  export {
114
- ExpandingTextFieldProps,
115
- ExpandingTextField,
116
- } from './components/react-hook-form/expanding-text-field';
147
+ RangeInput,
148
+ DEFAULT_RANGE_VALUE,
149
+ getRangeInputDataForm,
150
+ getRangeInputSchema,
151
+ } from './components/react-hook-form/range-input';
152
+ export { InputWithPopupConfirmation } from './components/react-hook-form/select-inputs/input-with-popup-confirmation';
153
+ export { MuiSelectInput } from './components/react-hook-form/select-inputs/mui-select-input';
154
+ export {
155
+ CountriesInput,
156
+ getSystemLanguage,
157
+ getComputedLanguage,
158
+ } from './components/react-hook-form/select-inputs/countries-input';
159
+ export { MultipleAutocompleteInput } from './components/react-hook-form/autocomplete-inputs/multiple-autocomplete-input';
160
+ export { CsvUploader } from './components/react-hook-form/ag-grid-table-rhf/csv-uploader/csv-uploader';
161
+ export { UniqueNameInput } from './components/react-hook-form/unique-name-input';
117
162
 
118
- export { ElementType } from './utils/ElementType';
163
+ export {
164
+ Line,
165
+ Generator,
166
+ Load,
167
+ Battery,
168
+ SVC,
169
+ DanglingLine,
170
+ LCC,
171
+ VSC,
172
+ Hvdc,
173
+ BusBar,
174
+ TwoWindingTransfo,
175
+ ThreeWindingTransfo,
176
+ ShuntCompensator,
177
+ VoltageLevel,
178
+ Substation,
179
+ noSelectionForCopy,
180
+ } from './components/filter/constants/equipment-types';
181
+
182
+ export { FieldConstants } from './components/filter/constants/field-constants';
183
+
184
+ export {
185
+ GRIDSUITE_DEFAULT_PRECISION,
186
+ roundToPrecision,
187
+ roundToDefaultPrecision,
188
+ isBlankOrEmpty,
189
+ unitToMicroUnit,
190
+ microUnitToUnit,
191
+ } from './utils/conversion-utils';
192
+
193
+ export { useSnackMessage } from './hooks/useSnackMessage';
194
+ export { useDebounce } from './hooks/useDebounce';
195
+ export { ROW_DRAGGING_SELECTION_COLUMN_DEF } from './components/react-hook-form/ag-grid-table-rhf/custom-ag-grid-table';
196
+ export { FILTER_EQUIPMENTS } from './components/filter/utils/criteria-based-utils';
197
+ export { CONTINGENCY_LIST_EQUIPMENTS } from './components/filter/utils/criteria-based-utils';
119
198
 
120
199
  /**
121
200
  * Section to export manual type declarations of .js and .jsx files
@@ -130,110 +209,8 @@ export function logout(
130
209
  userManagerInstance: any
131
210
  ): Promise<any | undefined>;
132
211
 
133
- interface SnackInputs {
134
- messageTxt?: string;
135
- messageId?: string;
136
- messageValues?: Record<string, string>;
137
- headerTxt?: string;
138
- headerId?: string;
139
- headerValues?: Record<string, string>;
140
- }
141
-
142
- interface UseSnackMessageReturn {
143
- snackError: (snackInputs: SnackInputs) => void;
144
- snackWarning: (snackInputs: SnackInputs) => void;
145
- snackInfo: (snackInputs: SnackInputs) => void;
146
- }
147
-
148
- export function useSnackMessage(): UseSnackMessageReturn;
149
-
150
- type Input = string | number;
151
- type Option = string | { id: string; label: string };
152
-
153
- interface AutocompleteInputProps
154
- extends Omit<
155
- AutocompleteProps<
156
- Option,
157
- boolean | undefined,
158
- boolean | undefined,
159
- boolean | undefined
160
- >,
161
- // we already defined them in our custom Autocomplete
162
- 'value' | 'onChange' | 'renderInput'
163
- > {
164
- name: string;
165
- options: Option[];
166
- label?: string;
167
- outputTransform?: (value: Option) => Option;
168
- inputTransform?: (value: Option) => Option;
169
- readOnly?: boolean;
170
- previousValue?: string;
171
- allowNewValue?: boolean;
172
- onChangeCallback?: () => void;
173
- formProps?: Omit<
174
- TextFieldProps,
175
- 'value' | 'onChange' | 'inputRef' | 'inputProps' | 'InputProps'
176
- >;
177
- }
178
-
179
- export const AutocompleteInput: FunctionComponent<AutocompleteInputProps>;
180
-
181
- interface ErrorInputProps {
182
- name: string;
183
- InputField?: FunctionComponent;
184
- }
185
-
186
- export const ErrorInput: FunctionComponent<ErrorInputProps>;
187
-
188
- export const SelectInput: FunctionComponent<
189
- Omit<
190
- AutocompleteInputProps,
191
- 'outputTransform' | 'inputTransform' | 'readOnly' | 'getOptionLabel' // already defined in SelectInput
192
- >
193
- >;
194
-
195
212
  export const MidFormError: FunctionComponent;
196
213
 
197
- export const FieldErrorAlert: FunctionComponent;
198
-
199
- type TextFieldWithAdornmentProps = TextFieldProps & {
200
- // variant already included in TextFieldProps
201
- value: Input; // we override the default type of TextFieldProps which is unknown
202
- adornmentPosition: string;
203
- adornmentText: string;
204
- handleClearValue?: () => void;
205
- };
206
-
207
- export interface TextInputProps {
208
- name: string;
209
- label?: string;
210
- labelValues?: any; // it's for values from https://formatjs.io/docs/react-intl/components/#formattedmessage
211
- id?: string;
212
- adornment?: {
213
- position: string;
214
- text: string;
215
- };
216
- customAdornment?: ReactElement | null;
217
- outputTransform?: (value: string) => Input;
218
- inputTransform?: (value: Input) => string;
219
- acceptValue?: (value: string) => boolean;
220
- previousValue?: Input;
221
- clearable?: boolean;
222
- formProps?: Omit<
223
- TextFieldWithAdornmentProps | TextFieldProps,
224
- 'value' | 'onChange' | 'inputRef' | 'inputProps' | 'InputProps'
225
- >;
226
- }
227
-
228
- export const TextInput: FunctionComponent<TextInputProps>;
229
-
230
- export const FloatInput: FunctionComponent<
231
- Omit<
232
- TextInputProps,
233
- 'outputTransform' | 'inputTransform' | 'acceptValue' // already defined in FloatInput
234
- >
235
- >;
236
-
237
214
  export const IntegerInput: FunctionComponent<
238
215
  Omit<
239
216
  TextInputProps,
@@ -241,19 +218,6 @@ export const IntegerInput: FunctionComponent<
241
218
  >
242
219
  >;
243
220
 
244
- interface RadioInputProps {
245
- name: string;
246
- label?: string;
247
- id?: string;
248
- options: Array<{
249
- id: string;
250
- label: string;
251
- }>;
252
- formProps?: Omit<RadioGroupProps, 'value'>;
253
- }
254
-
255
- export const RadioInput: FunctionComponent<RadioInputProps>;
256
-
257
221
  interface SwitchInputProps {
258
222
  name: string;
259
223
  label?: string;
@@ -270,20 +234,6 @@ interface CheckboxInputProps {
270
234
 
271
235
  export const CheckboxInput: FunctionComponent<CheckboxInputProps>;
272
236
 
273
- export const SubmitButton: FunctionComponent<ButtonProps>;
274
-
275
- type CancelButtonProps = ButtonProps & {
276
- color?: string;
277
- };
278
-
279
- export const CancelButton: FunctionComponent<CancelButtonProps>;
280
-
281
- export const FieldLabel: FunctionComponent<{
282
- label: string;
283
- optional?: boolean;
284
- values?: any; // it's for values from https://formatjs.io/docs/react-intl/components/#formattedmessage
285
- }>;
286
-
287
237
  interface Parameters {
288
238
  name: string;
289
239
  description: string;
@@ -302,11 +252,6 @@ interface FlatParametersProps extends Pick<TextFieldProps, 'variant'> {
302
252
 
303
253
  export const FlatParameters: FunctionComponent<FlatParametersProps>;
304
254
 
305
- export function useDebounce(
306
- debouncedFunction: (...args: any[]) => void,
307
- debounceDelay: number
308
- ): (...args: any[]) => void;
309
-
310
255
  interface OverflowableTextProps {
311
256
  sx?: SxProps;
312
257
  text?: string | ReactElement;