@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.
- package/dist/assets/criteria-based-filter-edition-dialog.css +168 -0
- package/dist/chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js +1673 -0
- package/dist/chunks/filter-properties.GRon8-ML.js +195 -0
- package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +13 -3
- package/dist/components/DirectoryItemSelector/directory-item-selector.js +14 -10
- package/dist/components/dialogs/custom-mui-dialog.d.ts +21 -0
- package/dist/components/dialogs/custom-mui-dialog.js +87 -0
- package/dist/components/dialogs/description-modification-dialog.d.ts +11 -0
- package/dist/components/dialogs/description-modification-dialog.js +71 -0
- package/dist/components/dialogs/popup-confirmation-dialog.d.ts +11 -0
- package/dist/components/dialogs/popup-confirmation-dialog.js +38 -0
- package/dist/components/filter/constants/equipment-types.d.ts +72 -0
- package/dist/components/filter/constants/equipment-types.js +63 -0
- package/dist/components/filter/constants/expert-filter-constants.d.ts +546 -0
- package/dist/components/filter/constants/expert-filter-constants.js +663 -0
- package/dist/components/filter/constants/field-constants.d.ts +45 -0
- package/dist/components/filter/constants/field-constants.js +43 -0
- package/dist/components/filter/constants/filter-constants.d.ts +21 -0
- package/dist/components/filter/constants/filter-constants.js +10 -0
- package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.d.ts +29 -0
- package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +19 -0
- package/dist/components/filter/criteria-based/criteria-based-filter-form.d.ts +15 -0
- package/dist/components/filter/criteria-based/criteria-based-filter-form.js +33 -0
- package/dist/components/filter/criteria-based/criteria-based-filter-utils.d.ts +37 -0
- package/dist/components/filter/criteria-based/criteria-based-filter-utils.js +127 -0
- package/dist/components/filter/criteria-based/criteria-based-form.d.ts +7 -0
- package/dist/components/filter/criteria-based/criteria-based-form.js +50 -0
- package/dist/components/filter/criteria-based/filter-free-properties.d.ts +10 -0
- package/dist/components/filter/criteria-based/filter-free-properties.js +15 -0
- package/dist/components/filter/criteria-based/filter-properties.d.ts +21 -0
- package/dist/components/filter/criteria-based/filter-properties.js +19 -0
- package/dist/components/filter/criteria-based/filter-property.d.ts +19 -0
- package/dist/components/filter/criteria-based/filter-property.js +67 -0
- package/dist/components/filter/expert/expert-filter-edition-dialog.d.ts +28 -0
- package/dist/components/filter/expert/expert-filter-edition-dialog.js +20 -0
- package/dist/components/filter/expert/expert-filter-form.d.ts +21 -0
- package/dist/components/filter/expert/expert-filter-form.js +22 -0
- package/dist/components/filter/expert/expert-filter-utils.d.ts +19 -0
- package/dist/components/filter/expert/expert-filter-utils.js +302 -0
- package/dist/components/filter/expert/expert-filter.type.d.ts +113 -0
- package/dist/components/filter/expert/expert-filter.type.js +103 -0
- package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.d.ts +22 -0
- package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +19 -0
- package/dist/components/filter/explicit-naming/explicit-naming-filter-form.d.ts +22 -0
- package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +23 -0
- package/dist/components/filter/filter-context.d.ts +12 -0
- package/dist/components/filter/filter-context.js +10 -0
- package/dist/components/filter/filter-creation-dialog.d.ts +21 -0
- package/dist/components/filter/filter-creation-dialog.js +17 -0
- package/dist/components/filter/filter-form.d.ts +11 -0
- package/dist/components/filter/filter-form.js +14 -0
- package/dist/components/filter/utils/criteria-based-utils.d.ts +28 -0
- package/dist/components/filter/utils/criteria-based-utils.js +197 -0
- package/dist/components/filter/utils/filters-utils.d.ts +5 -0
- package/dist/components/filter/utils/filters-utils.js +99 -0
- package/dist/components/inputs/select-clearable.d.ts +14 -0
- package/dist/components/inputs/select-clearable.js +40 -0
- package/dist/components/react-hook-form/ExpandingTextField.d.ts +1 -1
- package/dist/components/react-hook-form/ExpandingTextField.js +0 -37
- package/dist/components/react-hook-form/ag-grid-table-rhf/bottom-right-buttons.d.ts +17 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/bottom-right-buttons.js +15 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/cell-editors/numericEditor.d.ts +23 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/cell-editors/numericEditor.js +70 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/csv-uploader/csv-uploader.d.ts +16 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/csv-uploader/csv-uploader.js +69 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/custom-ag-grid-table.d.ts +23 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/custom-ag-grid-table.js +15 -0
- package/dist/components/react-hook-form/autocomplete-input.d.ts +17 -29
- package/dist/components/react-hook-form/autocomplete-input.js +4 -15
- package/dist/components/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.d.ts +2 -0
- package/dist/components/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.js +46 -0
- package/dist/components/react-hook-form/directory-items-input.d.ts +0 -3
- package/dist/components/react-hook-form/directory-items-input.js +5 -6
- package/dist/components/react-hook-form/error-management/error-input.d.ts +13 -4
- package/dist/components/react-hook-form/error-management/error-input.js +7 -7
- package/dist/components/react-hook-form/error-management/field-error-alert.d.ts +6 -3
- package/dist/components/react-hook-form/error-management/field-error-alert.js +3 -1
- package/dist/components/react-hook-form/numbers/float-input.d.ts +5 -17
- package/dist/components/react-hook-form/numbers/float-input.js +3 -5
- package/dist/components/react-hook-form/numbers/integer-input.d.ts +15 -12
- package/dist/components/react-hook-form/numbers/utils.d.ts +8 -2
- package/dist/components/react-hook-form/provider/custom-form-provider.d.ts +1 -0
- package/dist/components/react-hook-form/provider/custom-form-provider.js +12 -3
- package/dist/components/react-hook-form/radio-input.d.ts +14 -17
- package/dist/components/react-hook-form/radio-input.js +7 -9
- package/dist/components/react-hook-form/range-input.d.ts +54 -0
- package/dist/components/react-hook-form/range-input.js +118 -0
- package/dist/components/react-hook-form/select-inputs/countries-input.d.ts +8 -0
- package/dist/components/react-hook-form/select-inputs/countries-input.js +36 -0
- package/dist/components/react-hook-form/select-inputs/input-with-popup-confirmation.d.ts +2 -0
- package/dist/components/react-hook-form/select-inputs/input-with-popup-confirmation.js +61 -0
- package/dist/components/react-hook-form/select-inputs/mui-select-input.d.ts +12 -0
- package/dist/components/react-hook-form/select-inputs/mui-select-input.js +25 -0
- package/dist/components/react-hook-form/select-inputs/select-input.d.ts +9 -0
- package/dist/components/react-hook-form/select-inputs/select-input.js +37 -0
- package/dist/components/react-hook-form/text-input.d.ts +23 -32
- package/dist/components/react-hook-form/text-input.js +6 -20
- package/dist/components/react-hook-form/unique-name-input.d.ts +21 -0
- package/dist/components/react-hook-form/unique-name-input.js +129 -0
- package/dist/components/react-hook-form/utils/cancel-button.d.ts +9 -8
- package/dist/components/react-hook-form/utils/field-label.d.ts +12 -5
- package/dist/components/react-hook-form/utils/field-label.js +5 -1
- package/dist/components/react-hook-form/utils/functions.d.ts +12 -4
- package/dist/components/react-hook-form/utils/functions.js +21 -1
- package/dist/components/react-hook-form/utils/submit-button.d.ts +9 -8
- package/dist/components/react-hook-form/utils/text-field-with-adornment.d.ts +11 -11
- package/dist/components/react-hook-form/utils/text-field-with-adornment.js +18 -23
- package/dist/components/react-query-builder-inputs/add-button.d.ts +8 -0
- package/dist/components/react-query-builder-inputs/add-button.js +17 -0
- package/dist/components/react-query-builder-inputs/combinator-selector.d.ts +5 -0
- package/dist/components/react-query-builder-inputs/combinator-selector.js +38 -0
- package/dist/components/react-query-builder-inputs/country-value-editor.d.ts +5 -0
- package/dist/components/react-query-builder-inputs/country-value-editor.js +46 -0
- package/dist/components/react-query-builder-inputs/custom-react-query-builder.d.ts +8 -0
- package/dist/components/react-query-builder-inputs/custom-react-query-builder.js +21 -0
- package/dist/components/react-query-builder-inputs/element-value-editor.d.ts +14 -0
- package/dist/components/react-query-builder-inputs/element-value-editor.js +69 -0
- package/dist/components/react-query-builder-inputs/property-value-editor.d.ts +9 -0
- package/dist/components/react-query-builder-inputs/property-value-editor.js +100 -0
- package/dist/components/react-query-builder-inputs/remove-button.d.ts +5 -0
- package/dist/components/react-query-builder-inputs/remove-button.js +9 -0
- package/dist/components/react-query-builder-inputs/text-value-editor.d.ts +5 -0
- package/dist/components/react-query-builder-inputs/text-value-editor.js +34 -0
- package/dist/components/react-query-builder-inputs/translated-value-editor.d.ts +5 -0
- package/dist/components/react-query-builder-inputs/translated-value-editor.js +58 -0
- package/dist/components/react-query-builder-inputs/use-convert-value.d.ts +9 -0
- package/dist/components/react-query-builder-inputs/use-convert-value.js +24 -0
- package/dist/components/react-query-builder-inputs/use-valid.d.ts +7 -0
- package/dist/components/react-query-builder-inputs/use-valid.js +13 -0
- package/dist/components/react-query-builder-inputs/value-editor.d.ts +5 -0
- package/dist/components/react-query-builder-inputs/value-editor.js +18 -0
- package/dist/components/react-query-builder-inputs/value-selector.d.ts +4 -0
- package/dist/components/react-query-builder-inputs/value-selector.js +14 -0
- package/dist/hooks/localized-countries-hook.d.ts +6 -0
- package/dist/hooks/localized-countries-hook.js +45 -0
- package/dist/hooks/predefined-properties-hook.d.ts +18 -0
- package/dist/hooks/predefined-properties-hook.js +43 -0
- package/dist/hooks/useDebounce.d.ts +7 -1
- package/dist/hooks/useSnackMessage.d.ts +23 -5
- package/dist/hooks/useSnackMessage.js +14 -12
- package/dist/index.d.ts +87 -142
- package/dist/index.js +168 -91
- package/dist/utils/FetchStatus.d.ts +12 -0
- package/dist/utils/FetchStatus.js +9 -0
- package/dist/utils/conversion-utils.d.ts +12 -0
- package/dist/utils/conversion-utils.js +22 -0
- package/dist/utils/equipment-types-for-predefined-properties-mapper.d.ts +3 -0
- package/dist/utils/equipment-types-for-predefined-properties-mapper.js +31 -0
- package/dist/utils/functions.d.ts +14 -0
- package/dist/utils/functions.js +16 -0
- package/dist/utils/types.d.ts +21 -0
- package/dist/utils/types.js +1 -0
- package/dist/utils/yup-config.d.ts +8 -0
- package/dist/utils/yup-config.js +16 -0
- package/package.json +15 -2
- package/dist/components/react-hook-form/select-input.d.ts +0 -17
- package/dist/components/react-hook-form/select-input.js +0 -30
|
@@ -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,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,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,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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
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 {
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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 {
|
|
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;
|