@gridsuite/commons-ui 0.55.0 → 0.57.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.BEXoNmzz.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/TopBar/TopBar.js +371 -429
- 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 +551 -0
- package/dist/components/filter/constants/expert-filter-constants.js +668 -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 +91 -0
- package/dist/components/filter/expert/expert-filter-utils.js +304 -0
- package/dist/components/filter/expert/expert-filter.type.d.ts +114 -0
- package/dist/components/filter/expert/expert-filter.type.js +104 -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/components/translations/filter-en.d.ts +22 -0
- package/dist/components/translations/filter-en.js +23 -0
- package/dist/components/translations/filter-fr.d.ts +22 -0
- package/dist/components/translations/filter-fr.js +23 -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 +89 -142
- package/dist/index.js +172 -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 -3
- 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,23 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "../constants/field-constants.js";
|
|
4
|
+
import "../../../utils/yup-config.js";
|
|
5
|
+
import { d, f, e, g } from "../../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
|
|
6
|
+
import "react-intl";
|
|
7
|
+
import "react-hook-form";
|
|
8
|
+
import "@mui/material/Grid";
|
|
9
|
+
import "../../react-hook-form/select-inputs/select-input.js";
|
|
10
|
+
import "../constants/equipment-types.js";
|
|
11
|
+
import "../../react-hook-form/ag-grid-table-rhf/cell-editors/numericEditor.js";
|
|
12
|
+
import "../../react-hook-form/select-inputs/input-with-popup-confirmation.js";
|
|
13
|
+
import "uuid";
|
|
14
|
+
import "../../react-hook-form/utils/functions.js";
|
|
15
|
+
import "../constants/filter-constants.js";
|
|
16
|
+
import "../utils/criteria-based-utils.js";
|
|
17
|
+
import "yup";
|
|
18
|
+
export {
|
|
19
|
+
d as FILTER_EQUIPMENTS_ATTRIBUTES,
|
|
20
|
+
f as default,
|
|
21
|
+
e as explicitNamingFilterSchema,
|
|
22
|
+
g as getExplicitNamingFilterEmptyFormData
|
|
23
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ElementAttributes } from '../../utils/types.ts';
|
|
2
|
+
import { StudyMetadata } from '../../hooks/predefined-properties-hook';
|
|
3
|
+
import { UUID } from 'crypto';
|
|
4
|
+
|
|
5
|
+
interface FilterContextProps {
|
|
6
|
+
fetchDirectoryContent?: (directoryUuid: UUID, elementTypes: string[]) => Promise<ElementAttributes[]>;
|
|
7
|
+
fetchRootFolders?: (types: string[]) => Promise<ElementAttributes[]>;
|
|
8
|
+
fetchElementsInfos?: (ids: UUID[], elementTypes?: string[], equipmentTypes?: string[]) => Promise<ElementAttributes[]>;
|
|
9
|
+
fetchAppsAndUrls?: () => Promise<StudyMetadata[]>;
|
|
10
|
+
}
|
|
11
|
+
export declare const FilterContext: import('react').Context<FilterContextProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ElementAttributes } from '../../utils/types.ts';
|
|
2
|
+
import { StudyMetadata } from '../../hooks/predefined-properties-hook.ts';
|
|
3
|
+
import { UUID } from 'crypto';
|
|
4
|
+
import { elementExistsType } from './criteria-based/criteria-based-filter-edition-dialog';
|
|
5
|
+
import { FunctionComponent } from 'react';
|
|
6
|
+
|
|
7
|
+
export interface FilterCreationDialogProps {
|
|
8
|
+
open: boolean;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
activeDirectory?: UUID;
|
|
11
|
+
createFilter: (filter: any, name: string, description: string, activeDirectory: any) => Promise<void>;
|
|
12
|
+
saveFilter: (filter: any, name: string) => Promise<void>;
|
|
13
|
+
fetchAppsAndUrls: () => Promise<StudyMetadata[]>;
|
|
14
|
+
elementExists?: elementExistsType;
|
|
15
|
+
language?: string;
|
|
16
|
+
fetchDirectoryContent?: (directoryUuid: UUID, elementTypes: string[]) => Promise<ElementAttributes[]>;
|
|
17
|
+
fetchRootFolders?: (types: string[]) => Promise<ElementAttributes[]>;
|
|
18
|
+
fetchElementsInfos?: (ids: UUID[], elementTypes?: string[], equipmentTypes?: string[]) => Promise<ElementAttributes[]>;
|
|
19
|
+
}
|
|
20
|
+
declare const FilterCreationDialog: FunctionComponent<FilterCreationDialogProps>;
|
|
21
|
+
export default FilterCreationDialog;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "./utils/filters-utils.js";
|
|
4
|
+
import "react-hook-form";
|
|
5
|
+
import "../../hooks/useSnackMessage.js";
|
|
6
|
+
import "../dialogs/custom-mui-dialog.js";
|
|
7
|
+
import "./criteria-based/criteria-based-filter-form.js";
|
|
8
|
+
import { F } from "../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
|
|
9
|
+
import "./constants/field-constants.js";
|
|
10
|
+
import "../../utils/yup-config.js";
|
|
11
|
+
import "@hookform/resolvers/yup";
|
|
12
|
+
import "./filter-context.js";
|
|
13
|
+
import "./constants/filter-constants.js";
|
|
14
|
+
import "yup";
|
|
15
|
+
export {
|
|
16
|
+
F as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { elementExistsType } from './criteria-based/criteria-based-filter-edition-dialog';
|
|
2
|
+
import { UUID } from 'crypto';
|
|
3
|
+
import { FunctionComponent } from 'react';
|
|
4
|
+
|
|
5
|
+
interface FilterFormProps {
|
|
6
|
+
creation?: boolean;
|
|
7
|
+
activeDirectory?: UUID;
|
|
8
|
+
elementExists?: elementExistsType;
|
|
9
|
+
}
|
|
10
|
+
export declare const FilterForm: FunctionComponent<FilterFormProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "../react-hook-form/unique-name-input.js";
|
|
3
|
+
import "./constants/field-constants.js";
|
|
4
|
+
import "./criteria-based/criteria-based-filter-form.js";
|
|
5
|
+
import { o } from "../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
|
|
6
|
+
import "react-hook-form";
|
|
7
|
+
import "@mui/material";
|
|
8
|
+
import "../react-hook-form/radio-input.js";
|
|
9
|
+
import "../../utils/ElementType.js";
|
|
10
|
+
import "../react-hook-form/ExpandingTextField.js";
|
|
11
|
+
import "./constants/filter-constants.js";
|
|
12
|
+
export {
|
|
13
|
+
o as FilterForm
|
|
14
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { default as yup } from '../../../utils/yup-config';
|
|
3
|
+
|
|
4
|
+
export declare const getCriteriaBasedSchema: (extraFields: any) => {
|
|
5
|
+
criteriaBased: yup.ObjectSchema<{
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
}, yup.AnyObject, {
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
}, "">;
|
|
10
|
+
};
|
|
11
|
+
export declare const getCriteriaBasedFormData: (criteriaValues: any, extraFields: any) => {
|
|
12
|
+
criteriaBased: any;
|
|
13
|
+
};
|
|
14
|
+
type CriteriaFormField = {
|
|
15
|
+
renderer: FunctionComponent<any>;
|
|
16
|
+
props: {
|
|
17
|
+
label: string;
|
|
18
|
+
name: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
type CriteriaFormEquipment = {
|
|
22
|
+
id: string;
|
|
23
|
+
label: string;
|
|
24
|
+
fields: CriteriaFormField[];
|
|
25
|
+
};
|
|
26
|
+
export declare const CONTINGENCY_LIST_EQUIPMENTS: Record<string, CriteriaFormEquipment>;
|
|
27
|
+
export declare const FILTER_EQUIPMENTS: Record<string, CriteriaFormEquipment>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { FieldConstants } from "../constants/field-constants.js";
|
|
2
|
+
import "../../../utils/yup-config.js";
|
|
3
|
+
import RangeInput, { getRangeInputSchema, getRangeInputDataForm, DEFAULT_RANGE_VALUE } from "../../react-hook-form/range-input.js";
|
|
4
|
+
import { CountriesInput } from "../../react-hook-form/select-inputs/countries-input.js";
|
|
5
|
+
import SelectInput from "../../react-hook-form/select-inputs/select-input.js";
|
|
6
|
+
import * as yup from "yup";
|
|
7
|
+
const getCriteriaBasedSchema = (extraFields) => ({
|
|
8
|
+
[FieldConstants.CRITERIA_BASED]: yup.object().shape({
|
|
9
|
+
[FieldConstants.COUNTRIES]: yup.array().of(yup.string()),
|
|
10
|
+
[FieldConstants.COUNTRIES_1]: yup.array().of(yup.string()),
|
|
11
|
+
[FieldConstants.COUNTRIES_2]: yup.array().of(yup.string()),
|
|
12
|
+
...getRangeInputSchema(FieldConstants.NOMINAL_VOLTAGE),
|
|
13
|
+
...getRangeInputSchema(FieldConstants.NOMINAL_VOLTAGE_1),
|
|
14
|
+
...getRangeInputSchema(FieldConstants.NOMINAL_VOLTAGE_2),
|
|
15
|
+
...getRangeInputSchema(FieldConstants.NOMINAL_VOLTAGE_3),
|
|
16
|
+
...extraFields
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
const getCriteriaBasedFormData = (criteriaValues, extraFields) => ({
|
|
20
|
+
[FieldConstants.CRITERIA_BASED]: {
|
|
21
|
+
[FieldConstants.COUNTRIES]: (criteriaValues == null ? void 0 : criteriaValues[FieldConstants.COUNTRIES]) ?? [],
|
|
22
|
+
[FieldConstants.COUNTRIES_1]: (criteriaValues == null ? void 0 : criteriaValues[FieldConstants.COUNTRIES_1]) ?? [],
|
|
23
|
+
[FieldConstants.COUNTRIES_2]: (criteriaValues == null ? void 0 : criteriaValues[FieldConstants.COUNTRIES_2]) ?? [],
|
|
24
|
+
...getRangeInputDataForm(
|
|
25
|
+
FieldConstants.NOMINAL_VOLTAGE,
|
|
26
|
+
(criteriaValues == null ? void 0 : criteriaValues[FieldConstants.NOMINAL_VOLTAGE]) ?? DEFAULT_RANGE_VALUE
|
|
27
|
+
),
|
|
28
|
+
...getRangeInputDataForm(
|
|
29
|
+
FieldConstants.NOMINAL_VOLTAGE_1,
|
|
30
|
+
(criteriaValues == null ? void 0 : criteriaValues[FieldConstants.NOMINAL_VOLTAGE_1]) ?? DEFAULT_RANGE_VALUE
|
|
31
|
+
),
|
|
32
|
+
...getRangeInputDataForm(
|
|
33
|
+
FieldConstants.NOMINAL_VOLTAGE_2,
|
|
34
|
+
(criteriaValues == null ? void 0 : criteriaValues[FieldConstants.NOMINAL_VOLTAGE_2]) ?? DEFAULT_RANGE_VALUE
|
|
35
|
+
),
|
|
36
|
+
...getRangeInputDataForm(
|
|
37
|
+
FieldConstants.NOMINAL_VOLTAGE_3,
|
|
38
|
+
(criteriaValues == null ? void 0 : criteriaValues[FieldConstants.NOMINAL_VOLTAGE_3]) ?? DEFAULT_RANGE_VALUE
|
|
39
|
+
),
|
|
40
|
+
...extraFields
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const countries = {
|
|
44
|
+
renderer: CountriesInput,
|
|
45
|
+
props: {
|
|
46
|
+
label: "Countries",
|
|
47
|
+
name: `${FieldConstants.CRITERIA_BASED}.${FieldConstants.COUNTRIES}`
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const countries1 = {
|
|
51
|
+
renderer: CountriesInput,
|
|
52
|
+
props: {
|
|
53
|
+
label: "Countries1",
|
|
54
|
+
name: `${FieldConstants.CRITERIA_BASED}.${FieldConstants.COUNTRIES_1}`
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const countries2 = {
|
|
58
|
+
renderer: CountriesInput,
|
|
59
|
+
props: {
|
|
60
|
+
label: "Countries2",
|
|
61
|
+
name: `${FieldConstants.CRITERIA_BASED}.${FieldConstants.COUNTRIES_2}`
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const nominalVoltage = {
|
|
65
|
+
renderer: RangeInput,
|
|
66
|
+
props: {
|
|
67
|
+
label: "nominalVoltage",
|
|
68
|
+
name: `${FieldConstants.CRITERIA_BASED}.${FieldConstants.NOMINAL_VOLTAGE}`
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const nominalVoltage1 = {
|
|
72
|
+
renderer: RangeInput,
|
|
73
|
+
props: {
|
|
74
|
+
label: "nominalVoltage1",
|
|
75
|
+
name: `${FieldConstants.CRITERIA_BASED}.${FieldConstants.NOMINAL_VOLTAGE_1}`
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const nominalVoltage2 = {
|
|
79
|
+
renderer: RangeInput,
|
|
80
|
+
props: {
|
|
81
|
+
label: "nominalVoltage2",
|
|
82
|
+
name: `${FieldConstants.CRITERIA_BASED}.${FieldConstants.NOMINAL_VOLTAGE_2}`
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const nominalVoltage3 = {
|
|
86
|
+
renderer: RangeInput,
|
|
87
|
+
props: {
|
|
88
|
+
label: "nominalVoltage3",
|
|
89
|
+
name: `${FieldConstants.CRITERIA_BASED}.${FieldConstants.NOMINAL_VOLTAGE_3}`
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const energySource = {
|
|
93
|
+
renderer: SelectInput,
|
|
94
|
+
props: {
|
|
95
|
+
label: "EnergySourceText",
|
|
96
|
+
name: `${FieldConstants.CRITERIA_BASED}.${FieldConstants.ENERGY_SOURCE}`,
|
|
97
|
+
options: [
|
|
98
|
+
{ id: "HYDRO", label: "Hydro" },
|
|
99
|
+
{ id: "NUCLEAR", label: "Nuclear" },
|
|
100
|
+
{ id: "WIND", label: "Wind" },
|
|
101
|
+
{ id: "THERMAL", label: "Thermal" },
|
|
102
|
+
{ id: "SOLAR", label: "Solar" },
|
|
103
|
+
{ id: "OTHER", label: "Other" }
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const CONTINGENCY_LIST_EQUIPMENTS = {
|
|
108
|
+
LINE: {
|
|
109
|
+
id: "LINE",
|
|
110
|
+
label: "Lines",
|
|
111
|
+
fields: [countries1, countries2, nominalVoltage1, nominalVoltage2]
|
|
112
|
+
},
|
|
113
|
+
TWO_WINDINGS_TRANSFORMER: {
|
|
114
|
+
id: "TWO_WINDINGS_TRANSFORMER",
|
|
115
|
+
label: "TwoWindingsTransformers",
|
|
116
|
+
fields: [countries, nominalVoltage1, nominalVoltage2]
|
|
117
|
+
},
|
|
118
|
+
GENERATOR: {
|
|
119
|
+
id: "GENERATOR",
|
|
120
|
+
label: "Generators",
|
|
121
|
+
fields: [countries, nominalVoltage]
|
|
122
|
+
},
|
|
123
|
+
SHUNT_COMPENSATOR: {
|
|
124
|
+
id: "SHUNT_COMPENSATOR",
|
|
125
|
+
label: "ShuntCompensators",
|
|
126
|
+
fields: [countries, nominalVoltage]
|
|
127
|
+
},
|
|
128
|
+
HVDC_LINE: {
|
|
129
|
+
id: "HVDC_LINE",
|
|
130
|
+
label: "HvdcLines",
|
|
131
|
+
fields: [countries1, countries2, nominalVoltage]
|
|
132
|
+
},
|
|
133
|
+
BUSBAR_SECTION: {
|
|
134
|
+
id: "BUSBAR_SECTION",
|
|
135
|
+
label: "BusBarSections",
|
|
136
|
+
fields: [countries, nominalVoltage]
|
|
137
|
+
},
|
|
138
|
+
DANGLING_LINE: {
|
|
139
|
+
id: "DANGLING_LINE",
|
|
140
|
+
label: "DanglingLines",
|
|
141
|
+
fields: [countries, nominalVoltage]
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const FILTER_EQUIPMENTS = {
|
|
145
|
+
...CONTINGENCY_LIST_EQUIPMENTS,
|
|
146
|
+
THREE_WINDINGS_TRANSFORMER: {
|
|
147
|
+
id: "THREE_WINDINGS_TRANSFORMER",
|
|
148
|
+
label: "ThreeWindingsTransformers",
|
|
149
|
+
fields: [countries, nominalVoltage1, nominalVoltage2, nominalVoltage3]
|
|
150
|
+
},
|
|
151
|
+
GENERATOR: {
|
|
152
|
+
id: "GENERATOR",
|
|
153
|
+
label: "Generators",
|
|
154
|
+
fields: [countries, energySource, nominalVoltage]
|
|
155
|
+
},
|
|
156
|
+
LOAD: {
|
|
157
|
+
id: "LOAD",
|
|
158
|
+
label: "Loads",
|
|
159
|
+
fields: [countries, nominalVoltage]
|
|
160
|
+
},
|
|
161
|
+
BATTERY: {
|
|
162
|
+
id: "BATTERY",
|
|
163
|
+
label: "Batteries",
|
|
164
|
+
fields: [countries, nominalVoltage]
|
|
165
|
+
},
|
|
166
|
+
LCC_CONVERTER_STATION: {
|
|
167
|
+
id: "LCC_CONVERTER_STATION",
|
|
168
|
+
label: "LccConverterStations",
|
|
169
|
+
fields: [countries, nominalVoltage]
|
|
170
|
+
},
|
|
171
|
+
VSC_CONVERTER_STATION: {
|
|
172
|
+
id: "VSC_CONVERTER_STATION",
|
|
173
|
+
label: "VscConverterStations",
|
|
174
|
+
fields: [countries, nominalVoltage]
|
|
175
|
+
},
|
|
176
|
+
VOLTAGE_LEVEL: {
|
|
177
|
+
id: "VOLTAGE_LEVEL",
|
|
178
|
+
label: "VoltageLevels",
|
|
179
|
+
fields: [countries, nominalVoltage]
|
|
180
|
+
},
|
|
181
|
+
SUBSTATION: {
|
|
182
|
+
id: "SUBSTATION",
|
|
183
|
+
label: "Substations",
|
|
184
|
+
fields: [countries, nominalVoltage]
|
|
185
|
+
},
|
|
186
|
+
STATIC_VAR_COMPENSATOR: {
|
|
187
|
+
id: "STATIC_VAR_COMPENSATOR",
|
|
188
|
+
label: "StaticVarCompensators",
|
|
189
|
+
fields: [countries, nominalVoltage]
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
export {
|
|
193
|
+
CONTINGENCY_LIST_EQUIPMENTS,
|
|
194
|
+
FILTER_EQUIPMENTS,
|
|
195
|
+
getCriteriaBasedFormData,
|
|
196
|
+
getCriteriaBasedSchema
|
|
197
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { UUID } from 'crypto';
|
|
2
|
+
|
|
3
|
+
export declare const saveExplicitNamingFilter: (tableValues: any[], isFilterCreation: boolean, equipmentType: string, name: string, description: string, id: string | null, setCreateFilterErr: (value: any) => void, handleClose: () => void, createFilter: (filter: any, name: string, description: string, activeDirectory: any) => Promise<void>, saveFilter: (filter: any, name: string) => Promise<void>, activeDirectory?: UUID) => void;
|
|
4
|
+
export declare const saveCriteriaBasedFilter: (filter: any, activeDirectory: any, onClose: () => void, onError: (message: string) => void, createFilter: (filter: any, name: string, description: string, activeDirectory: any) => Promise<void>) => void;
|
|
5
|
+
export declare const saveExpertFilter: (id: string | null, query: any, equipmentType: string, name: string, description: string, isFilterCreation: boolean, activeDirectory: any, onClose: () => void, onError: (message: string) => void, createFilter: (filter: any, name: string, description: string, activeDirectory: any) => Promise<void>, saveFilter: (filter: any, name: string) => Promise<void>) => void;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { FieldConstants } from "../constants/field-constants.js";
|
|
2
|
+
import { frontToBackTweak } from "../criteria-based/criteria-based-filter-utils.js";
|
|
3
|
+
import { Generator, Load } from "../constants/equipment-types.js";
|
|
4
|
+
import { exportExpertRules } from "../expert/expert-filter-utils.js";
|
|
5
|
+
import { DISTRIBUTION_KEY, FilterType } from "../constants/filter-constants.js";
|
|
6
|
+
const saveExplicitNamingFilter = (tableValues, isFilterCreation, equipmentType, name, description, id, setCreateFilterErr, handleClose, createFilter, saveFilter, activeDirectory) => {
|
|
7
|
+
let cleanedTableValues;
|
|
8
|
+
const isGeneratorOrLoad = equipmentType === Generator.type || equipmentType === Load.type;
|
|
9
|
+
if (isGeneratorOrLoad) {
|
|
10
|
+
cleanedTableValues = tableValues.map((row) => ({
|
|
11
|
+
[FieldConstants.EQUIPMENT_ID]: row[FieldConstants.EQUIPMENT_ID],
|
|
12
|
+
[DISTRIBUTION_KEY]: row[DISTRIBUTION_KEY]
|
|
13
|
+
}));
|
|
14
|
+
} else {
|
|
15
|
+
cleanedTableValues = tableValues.map((row) => ({
|
|
16
|
+
[FieldConstants.EQUIPMENT_ID]: row[FieldConstants.EQUIPMENT_ID]
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
if (isFilterCreation) {
|
|
20
|
+
createFilter(
|
|
21
|
+
{
|
|
22
|
+
type: FilterType.EXPLICIT_NAMING.id,
|
|
23
|
+
equipmentType,
|
|
24
|
+
filterEquipmentsAttributes: cleanedTableValues
|
|
25
|
+
},
|
|
26
|
+
name,
|
|
27
|
+
description,
|
|
28
|
+
activeDirectory
|
|
29
|
+
).then(() => {
|
|
30
|
+
handleClose();
|
|
31
|
+
}).catch((error) => {
|
|
32
|
+
setCreateFilterErr(error.message);
|
|
33
|
+
});
|
|
34
|
+
} else {
|
|
35
|
+
saveFilter(
|
|
36
|
+
{
|
|
37
|
+
id,
|
|
38
|
+
type: FilterType.EXPLICIT_NAMING.id,
|
|
39
|
+
equipmentType,
|
|
40
|
+
filterEquipmentsAttributes: cleanedTableValues
|
|
41
|
+
},
|
|
42
|
+
name
|
|
43
|
+
).then(() => {
|
|
44
|
+
handleClose();
|
|
45
|
+
}).catch((error) => {
|
|
46
|
+
setCreateFilterErr(error.message);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const saveCriteriaBasedFilter = (filter, activeDirectory, onClose, onError, createFilter) => {
|
|
51
|
+
const filterForBack = frontToBackTweak(void 0, filter);
|
|
52
|
+
createFilter(
|
|
53
|
+
filterForBack,
|
|
54
|
+
filter[FieldConstants.NAME],
|
|
55
|
+
filter[FieldConstants.DESCRIPTION],
|
|
56
|
+
activeDirectory
|
|
57
|
+
).then(() => {
|
|
58
|
+
onClose();
|
|
59
|
+
}).catch((error) => {
|
|
60
|
+
onError(error.message);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const saveExpertFilter = (id, query, equipmentType, name, description, isFilterCreation, activeDirectory, onClose, onError, createFilter, saveFilter) => {
|
|
64
|
+
if (isFilterCreation) {
|
|
65
|
+
createFilter(
|
|
66
|
+
{
|
|
67
|
+
type: FilterType.EXPERT.id,
|
|
68
|
+
equipmentType,
|
|
69
|
+
rules: exportExpertRules(query)
|
|
70
|
+
},
|
|
71
|
+
name,
|
|
72
|
+
description,
|
|
73
|
+
activeDirectory
|
|
74
|
+
).then(() => {
|
|
75
|
+
onClose();
|
|
76
|
+
}).catch((error) => {
|
|
77
|
+
onError(error.message);
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
saveFilter(
|
|
81
|
+
{
|
|
82
|
+
id,
|
|
83
|
+
type: FilterType.EXPERT.id,
|
|
84
|
+
equipmentType,
|
|
85
|
+
rules: exportExpertRules(query)
|
|
86
|
+
},
|
|
87
|
+
name
|
|
88
|
+
).then(() => {
|
|
89
|
+
onClose();
|
|
90
|
+
}).catch((error) => {
|
|
91
|
+
onError(error.message);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
export {
|
|
96
|
+
saveCriteriaBasedFilter,
|
|
97
|
+
saveExpertFilter,
|
|
98
|
+
saveExplicitNamingFilter
|
|
99
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AutocompleteProps } from '@mui/material/Autocomplete/Autocomplete';
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
3
|
+
|
|
4
|
+
type SelectOption = {
|
|
5
|
+
id: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
};
|
|
8
|
+
interface SelectClearableProps extends Omit<AutocompleteProps<SelectOption, false, false, false>, 'value' | 'onChange' | 'renderInput'> {
|
|
9
|
+
value: string | null;
|
|
10
|
+
onChange: (value: string | null) => void;
|
|
11
|
+
label?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const SelectClearable: FunctionComponent<SelectClearableProps>;
|
|
14
|
+
export default SelectClearable;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useIntl } from "react-intl";
|
|
3
|
+
import { Autocomplete, TextField } from "@mui/material";
|
|
4
|
+
import FieldLabel from "../react-hook-form/utils/field-label.js";
|
|
5
|
+
const SelectClearable = (props) => {
|
|
6
|
+
const { value, onChange, label, ...otherProps } = props;
|
|
7
|
+
const intl = useIntl();
|
|
8
|
+
const inputTransform = (value2) => {
|
|
9
|
+
return value2 && props.options.find((option) => option.id === value2) || null;
|
|
10
|
+
};
|
|
11
|
+
const outputTransform = (option) => {
|
|
12
|
+
return (option == null ? void 0 : option.id) ?? null;
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
Autocomplete,
|
|
16
|
+
{
|
|
17
|
+
value: inputTransform(value),
|
|
18
|
+
onChange: (_, newValue) => onChange(outputTransform(newValue)),
|
|
19
|
+
getOptionLabel: (option) => {
|
|
20
|
+
return option.label ? intl.formatMessage({ id: option.label }) : option.id;
|
|
21
|
+
},
|
|
22
|
+
renderInput: ({ inputProps, ...otherParams }) => /* @__PURE__ */ jsx(
|
|
23
|
+
TextField,
|
|
24
|
+
{
|
|
25
|
+
...otherParams,
|
|
26
|
+
...label && {
|
|
27
|
+
label: FieldLabel({
|
|
28
|
+
label
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
inputProps: { ...inputProps, readOnly: true }
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
...otherProps
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
SelectClearable as default
|
|
40
|
+
};
|
|
@@ -2,45 +2,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { Typography } from "@mui/material";
|
|
4
4
|
import { useWatch } from "react-hook-form";
|
|
5
|
-
import "../TreeViewFinder/TreeViewFinder.js";
|
|
6
|
-
import "../TopBar/TopBar.js";
|
|
7
|
-
import "../TopBar/GridLogo.js";
|
|
8
|
-
import "../TopBar/AboutDialog.js";
|
|
9
|
-
import "../SnackbarProvider/SnackbarProvider.js";
|
|
10
|
-
import "react-router-dom";
|
|
11
|
-
import "../../utils/AuthService.js";
|
|
12
|
-
import "@mui/icons-material";
|
|
13
|
-
import "react-intl";
|
|
14
|
-
import "../MuiVirtualizedTable/MuiVirtualizedTable.js";
|
|
15
|
-
import "../ReportViewer/report-item.js";
|
|
16
|
-
import "uuid";
|
|
17
|
-
import "../ReportViewer/log-table.js";
|
|
18
|
-
import "../ReportViewer/report-tree-view-context.js";
|
|
19
|
-
import "@mui/x-tree-view";
|
|
20
|
-
import "../OverflowableText/overflowable-text.js";
|
|
21
|
-
import "../ElementSearchDialog/element-search-dialog.js";
|
|
22
|
-
import "../ElementSearchDialog/tag-renderer.js";
|
|
23
|
-
import "autosuggest-highlight/match";
|
|
24
|
-
import "autosuggest-highlight/parse";
|
|
25
|
-
import "clsx";
|
|
26
|
-
import "../CardErrorBoundary/card-error-boundary.js";
|
|
27
|
-
import "notistack";
|
|
28
5
|
import { useCustomFormContext } from "./provider/use-custom-form-context.js";
|
|
29
|
-
import "./provider/custom-form-provider.js";
|
|
30
|
-
import "./autocomplete-input.js";
|
|
31
6
|
import TextInput from "./text-input.js";
|
|
32
|
-
import "./radio-input.js";
|
|
33
|
-
import "./slider-input.js";
|
|
34
|
-
import "./numbers/float-input.js";
|
|
35
|
-
import "./numbers/integer-input.js";
|
|
36
|
-
import "./select-input.js";
|
|
37
|
-
import "./booleans/checkbox-input.js";
|
|
38
|
-
import "./booleans/switch-input.js";
|
|
39
|
-
import "./utils/text-field-with-adornment.js";
|
|
40
|
-
import "./utils/submit-button.js";
|
|
41
|
-
import "./utils/cancel-button.js";
|
|
42
|
-
import "yup";
|
|
43
|
-
import "@mui/icons-material/Folder";
|
|
44
7
|
const ExpandingTextField = ({
|
|
45
8
|
name,
|
|
46
9
|
maxCharactersNumber = 500,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FieldValues, UseFieldArrayReturn } from 'react-hook-form';
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface BottomRightButtonsProps {
|
|
5
|
+
name: string;
|
|
6
|
+
disableUp: boolean;
|
|
7
|
+
disableDown: boolean;
|
|
8
|
+
disableDelete: boolean;
|
|
9
|
+
handleAddRow: () => void;
|
|
10
|
+
handleDeleteRows: () => void;
|
|
11
|
+
handleMoveRowUp: () => void;
|
|
12
|
+
handleMoveRowDown: () => void;
|
|
13
|
+
useFieldArrayOutput: UseFieldArrayReturn<FieldValues, string, 'id'>;
|
|
14
|
+
csvProps: any;
|
|
15
|
+
}
|
|
16
|
+
declare const BottomRightButtons: FunctionComponent<BottomRightButtonsProps>;
|
|
17
|
+
export default BottomRightButtons;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "@mui/material";
|
|
3
|
+
import "@mui/material/IconButton";
|
|
4
|
+
import "@mui/icons-material";
|
|
5
|
+
import "@mui/icons-material/ControlPoint";
|
|
6
|
+
import "@mui/icons-material/Delete";
|
|
7
|
+
import { B } from "../../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
|
|
8
|
+
import "react";
|
|
9
|
+
import "react-intl";
|
|
10
|
+
import "@mui/material/styles";
|
|
11
|
+
import "../error-management/error-input.js";
|
|
12
|
+
import "../error-management/field-error-alert.js";
|
|
13
|
+
export {
|
|
14
|
+
B as default
|
|
15
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ICellEditorComp, ICellEditorParams } from 'ag-grid-community';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is a modified version of the cell editor proposed by AGGrid itself :
|
|
5
|
+
* https://www.ag-grid.com/javascript-data-grid/component-cell-editor/#cell-editor-example
|
|
6
|
+
* I use this JS version instead of the React version because it's simpler and lighter.
|
|
7
|
+
* React version if you want to check, with forwardRef, useEffect and useImperativeHandle :
|
|
8
|
+
* https://www.ag-grid.com/react-data-grid/component-cell-editor/#cell-editor-example
|
|
9
|
+
*/
|
|
10
|
+
export declare class NumericEditor implements ICellEditorComp {
|
|
11
|
+
eInput: HTMLInputElement;
|
|
12
|
+
cancelBeforeStart: boolean;
|
|
13
|
+
init(params: ICellEditorParams): void;
|
|
14
|
+
isBackspace(event: any): boolean;
|
|
15
|
+
isNavigationKey(event: any): boolean;
|
|
16
|
+
getGui(): HTMLInputElement;
|
|
17
|
+
afterGuiAttached(): void;
|
|
18
|
+
isCancelBeforeStart(): boolean;
|
|
19
|
+
getValue(): number | null;
|
|
20
|
+
isCharNumeric(charStr: string | null): boolean | "" | null;
|
|
21
|
+
isNumericKey(event: any): boolean | "" | null;
|
|
22
|
+
focusOut(): boolean;
|
|
23
|
+
}
|