@gridsuite/commons-ui 0.54.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 +7 -6
- package/dist/components/DirectoryItemSelector/directory-item-selector.js +34 -43
- package/dist/components/FlatParameters/FlatParameters.js +3 -0
- package/dist/components/ReportViewer/log-report.d.ts +2 -2
- package/dist/components/TreeViewFinder/TreeViewFinder.d.ts +32 -58
- package/dist/components/TreeViewFinder/TreeViewFinder.js +126 -82
- 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 +2 -4
- package/dist/components/react-hook-form/directory-items-input.js +61 -12
- 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/treeview-finder-en.d.ts +1 -0
- package/dist/components/translations/treeview-finder-en.js +4 -3
- package/dist/components/translations/treeview-finder-fr.d.ts +1 -0
- package/dist/components/translations/treeview-finder-fr.js +4 -3
- 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 +92 -143
- 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 +27 -4
- 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,19 @@
|
|
|
1
|
+
import { DataType, RuleGroupTypeExport } from './expert-filter.type';
|
|
2
|
+
import { IntlShape } from 'react-intl';
|
|
3
|
+
import { QueryValidator, RuleGroupType, RuleGroupTypeAny } from 'react-querybuilder';
|
|
4
|
+
|
|
5
|
+
type CustomRuleGroupType = RuleGroupType & {
|
|
6
|
+
dataType: DataType;
|
|
7
|
+
};
|
|
8
|
+
export declare const getOperators: (fieldName: string, intl: IntlShape) => {
|
|
9
|
+
name: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}[];
|
|
12
|
+
export declare function exportExpertRules(query: CustomRuleGroupType): RuleGroupTypeExport;
|
|
13
|
+
export declare function importExpertRules(query: RuleGroupTypeExport): CustomRuleGroupType;
|
|
14
|
+
export declare function countRules(query: RuleGroupTypeAny): number;
|
|
15
|
+
export declare const testQuery: (check: string, query: RuleGroupTypeAny) => boolean;
|
|
16
|
+
export declare const queryValidator: QueryValidator;
|
|
17
|
+
export declare function recursiveRemove(query: RuleGroupTypeAny, path: number[]): RuleGroupTypeAny;
|
|
18
|
+
export declare function getNumberOfSiblings(path: number[], query: RuleGroupTypeAny): number;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { defaultOperators, getParentPath, remove, findPath } from "react-querybuilder";
|
|
2
|
+
import { FieldType, DataType, OperatorType } from "./expert-filter.type.js";
|
|
3
|
+
import { validate } from "uuid";
|
|
4
|
+
import { FIELDS_OPTIONS, OPERATOR_OPTIONS, RULES } from "../constants/expert-filter-constants.js";
|
|
5
|
+
import { isBlankOrEmpty, microUnitToUnit, unitToMicroUnit } from "../../../utils/conversion-utils.js";
|
|
6
|
+
const microUnits = [
|
|
7
|
+
FieldType.SHUNT_CONDUCTANCE_1,
|
|
8
|
+
FieldType.SHUNT_CONDUCTANCE_2,
|
|
9
|
+
FieldType.SHUNT_SUSCEPTANCE_1,
|
|
10
|
+
FieldType.SHUNT_SUSCEPTANCE_2
|
|
11
|
+
];
|
|
12
|
+
const getDataType = (fieldName, operator) => {
|
|
13
|
+
if ((fieldName === FieldType.ID || fieldName === FieldType.VOLTAGE_LEVEL_ID || fieldName === FieldType.VOLTAGE_LEVEL_ID_1 || fieldName === FieldType.VOLTAGE_LEVEL_ID_2) && (operator === OperatorType.IS_PART_OF || operator === OperatorType.IS_NOT_PART_OF)) {
|
|
14
|
+
return DataType.FILTER_UUID;
|
|
15
|
+
}
|
|
16
|
+
const field = Object.values(FIELDS_OPTIONS).find(
|
|
17
|
+
(field2) => field2.name === fieldName
|
|
18
|
+
);
|
|
19
|
+
return field == null ? void 0 : field.dataType;
|
|
20
|
+
};
|
|
21
|
+
const getOperators = (fieldName, intl) => {
|
|
22
|
+
const field = Object.values(FIELDS_OPTIONS).find(
|
|
23
|
+
(field2) => field2.name === fieldName
|
|
24
|
+
);
|
|
25
|
+
switch (field == null ? void 0 : field.dataType) {
|
|
26
|
+
case DataType.STRING:
|
|
27
|
+
let operators = [
|
|
28
|
+
OPERATOR_OPTIONS.CONTAINS,
|
|
29
|
+
OPERATOR_OPTIONS.IS,
|
|
30
|
+
OPERATOR_OPTIONS.BEGINS_WITH,
|
|
31
|
+
OPERATOR_OPTIONS.ENDS_WITH,
|
|
32
|
+
OPERATOR_OPTIONS.IN,
|
|
33
|
+
OPERATOR_OPTIONS.EXISTS
|
|
34
|
+
];
|
|
35
|
+
if (field.name === FieldType.ID || field.name === FieldType.VOLTAGE_LEVEL_ID || field.name === FieldType.VOLTAGE_LEVEL_ID_1 || field.name === FieldType.VOLTAGE_LEVEL_ID_2) {
|
|
36
|
+
operators.push(OPERATOR_OPTIONS.IS_PART_OF);
|
|
37
|
+
operators.push(OPERATOR_OPTIONS.IS_NOT_PART_OF);
|
|
38
|
+
}
|
|
39
|
+
if (field.name === FieldType.ID) {
|
|
40
|
+
operators = operators.filter(
|
|
41
|
+
(field2) => field2.name !== OperatorType.EXISTS
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return operators.map((operator) => ({
|
|
45
|
+
name: operator.name,
|
|
46
|
+
label: intl.formatMessage({ id: operator.label })
|
|
47
|
+
}));
|
|
48
|
+
case DataType.NUMBER:
|
|
49
|
+
return [
|
|
50
|
+
OPERATOR_OPTIONS.EQUALS,
|
|
51
|
+
OPERATOR_OPTIONS.GREATER,
|
|
52
|
+
OPERATOR_OPTIONS.GREATER_OR_EQUALS,
|
|
53
|
+
OPERATOR_OPTIONS.LOWER,
|
|
54
|
+
OPERATOR_OPTIONS.LOWER_OR_EQUALS,
|
|
55
|
+
OPERATOR_OPTIONS.BETWEEN,
|
|
56
|
+
OPERATOR_OPTIONS.EXISTS
|
|
57
|
+
].map((operator) => ({
|
|
58
|
+
name: operator.name,
|
|
59
|
+
label: intl.formatMessage({ id: operator.label })
|
|
60
|
+
}));
|
|
61
|
+
case DataType.BOOLEAN:
|
|
62
|
+
return [OPERATOR_OPTIONS.EQUALS].map((operator) => ({
|
|
63
|
+
name: operator.name,
|
|
64
|
+
label: intl.formatMessage({ id: operator.label })
|
|
65
|
+
}));
|
|
66
|
+
case DataType.ENUM:
|
|
67
|
+
let enumOperators = [
|
|
68
|
+
OPERATOR_OPTIONS.EQUALS,
|
|
69
|
+
OPERATOR_OPTIONS.NOT_EQUALS,
|
|
70
|
+
OPERATOR_OPTIONS.IN
|
|
71
|
+
];
|
|
72
|
+
if (field.name === FieldType.SHUNT_COMPENSATOR_TYPE) {
|
|
73
|
+
enumOperators = enumOperators.filter(
|
|
74
|
+
(field2) => field2.customName !== OperatorType.IN
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return enumOperators.map((operator) => ({
|
|
78
|
+
name: operator.name,
|
|
79
|
+
label: intl.formatMessage({ id: operator.label })
|
|
80
|
+
}));
|
|
81
|
+
case DataType.PROPERTY:
|
|
82
|
+
let propertiesOperators = [OPERATOR_OPTIONS.IS];
|
|
83
|
+
return propertiesOperators.map((operator) => ({
|
|
84
|
+
name: operator.name,
|
|
85
|
+
label: intl.formatMessage({ id: operator.label })
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
return defaultOperators;
|
|
89
|
+
};
|
|
90
|
+
function changeValueUnit(value, field) {
|
|
91
|
+
if (microUnits.includes(field)) {
|
|
92
|
+
if (!Array.isArray(value)) {
|
|
93
|
+
return microUnitToUnit(value);
|
|
94
|
+
} else {
|
|
95
|
+
return value.map((a) => microUnitToUnit(a));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
function exportExpertRules(query) {
|
|
101
|
+
function transformRule(rule) {
|
|
102
|
+
var _a;
|
|
103
|
+
const isValueAnArray = Array.isArray(rule.value);
|
|
104
|
+
const dataType = getDataType(rule.field, rule.operator);
|
|
105
|
+
return {
|
|
106
|
+
field: rule.field,
|
|
107
|
+
operator: dataType !== DataType.PROPERTY ? (_a = Object.values(OPERATOR_OPTIONS).find(
|
|
108
|
+
(operator) => operator.name === rule.operator
|
|
109
|
+
)) == null ? void 0 : _a.customName : rule.value.propertyOperator,
|
|
110
|
+
value: !isValueAnArray && rule.operator !== OperatorType.EXISTS && dataType !== DataType.PROPERTY ? changeValueUnit(rule.value, rule.field) : void 0,
|
|
111
|
+
values: isValueAnArray && dataType !== DataType.PROPERTY ? changeValueUnit(rule.value, rule.field) : void 0,
|
|
112
|
+
dataType,
|
|
113
|
+
propertyName: dataType === DataType.PROPERTY ? rule.value.propertyName : void 0,
|
|
114
|
+
propertyValues: dataType === DataType.PROPERTY ? rule.value.propertyValues : void 0
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function transformGroup(group) {
|
|
118
|
+
const transformedRules = group.rules.map((ruleOrGroup) => {
|
|
119
|
+
if ("rules" in ruleOrGroup) {
|
|
120
|
+
return transformGroup(ruleOrGroup);
|
|
121
|
+
} else {
|
|
122
|
+
return transformRule(ruleOrGroup);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return {
|
|
126
|
+
combinator: group.combinator,
|
|
127
|
+
dataType: DataType.COMBINATOR,
|
|
128
|
+
rules: transformedRules
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return transformGroup(query);
|
|
132
|
+
}
|
|
133
|
+
function importExpertRules(query) {
|
|
134
|
+
function parseValue(rule) {
|
|
135
|
+
if (rule.propertyName) {
|
|
136
|
+
return {
|
|
137
|
+
propertyName: rule.propertyName,
|
|
138
|
+
propertyValues: rule.propertyValues,
|
|
139
|
+
propertyOperator: rule.operator
|
|
140
|
+
};
|
|
141
|
+
} else if (rule.values) {
|
|
142
|
+
if (rule.dataType === DataType.NUMBER) {
|
|
143
|
+
return rule.values.map((value) => parseFloat(value)).map((numberValue) => {
|
|
144
|
+
return microUnits.includes(rule.field) ? unitToMicroUnit(numberValue) : numberValue;
|
|
145
|
+
}).sort((a, b) => a - b);
|
|
146
|
+
} else {
|
|
147
|
+
return rule.values.sort();
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
return microUnits.includes(rule.field) ? unitToMicroUnit(parseFloat(rule.value)) : rule.value;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function transformRule(rule) {
|
|
154
|
+
var _a;
|
|
155
|
+
return {
|
|
156
|
+
field: rule.field,
|
|
157
|
+
operator: rule.dataType !== DataType.PROPERTY ? (_a = Object.values(OPERATOR_OPTIONS).find(
|
|
158
|
+
(operator) => operator.customName === rule.operator
|
|
159
|
+
)) == null ? void 0 : _a.name : OperatorType.IS,
|
|
160
|
+
value: parseValue(rule),
|
|
161
|
+
dataType: rule.operator === OperatorType.IS_PART_OF || rule.operator === OperatorType.IS_NOT_PART_OF ? DataType.STRING : rule.dataType
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function transformGroup(group) {
|
|
165
|
+
const transformedRules = group.rules.map((ruleOrGroup) => {
|
|
166
|
+
if ("rules" in ruleOrGroup) {
|
|
167
|
+
return transformGroup(ruleOrGroup);
|
|
168
|
+
} else {
|
|
169
|
+
return transformRule(ruleOrGroup);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
return {
|
|
173
|
+
combinator: group.combinator,
|
|
174
|
+
dataType: DataType.COMBINATOR,
|
|
175
|
+
rules: transformedRules
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
return transformGroup(query);
|
|
179
|
+
}
|
|
180
|
+
function countRules(query) {
|
|
181
|
+
if ("rules" in query) {
|
|
182
|
+
const group = query;
|
|
183
|
+
return group.rules.reduce(
|
|
184
|
+
(sum, ruleOrGroup) => sum + countRules(ruleOrGroup),
|
|
185
|
+
0
|
|
186
|
+
);
|
|
187
|
+
} else {
|
|
188
|
+
return 1;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const testQuery = (check, query) => {
|
|
192
|
+
const queryValidatorResult = queryValidator(query);
|
|
193
|
+
return !Object.values(queryValidatorResult).some((ruleValidation) => {
|
|
194
|
+
if (typeof ruleValidation !== "boolean" && ruleValidation.reasons) {
|
|
195
|
+
return ruleValidation.reasons.includes(check);
|
|
196
|
+
}
|
|
197
|
+
return false;
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
const queryValidator = (query) => {
|
|
201
|
+
const result = {};
|
|
202
|
+
const validateRule = (rule) => {
|
|
203
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
204
|
+
const isValueAnArray = Array.isArray(rule.value);
|
|
205
|
+
const isNumberInput = getDataType(rule.field, rule.operator) === DataType.NUMBER && !isValueAnArray;
|
|
206
|
+
const isStringInput = getDataType(rule.field, rule.operator) === DataType.STRING && !isValueAnArray;
|
|
207
|
+
if (rule.id && rule.operator === OPERATOR_OPTIONS.EXISTS.name) {
|
|
208
|
+
result[rule.id] = {
|
|
209
|
+
valid: true,
|
|
210
|
+
reasons: void 0
|
|
211
|
+
};
|
|
212
|
+
} else if (rule.id && rule.operator === OPERATOR_OPTIONS.BETWEEN.name) {
|
|
213
|
+
if (!((_a = rule.value) == null ? void 0 : _a[0]) || !((_b = rule.value) == null ? void 0 : _b[1])) {
|
|
214
|
+
result[rule.id] = {
|
|
215
|
+
valid: false,
|
|
216
|
+
reasons: [RULES.EMPTY_RULE]
|
|
217
|
+
};
|
|
218
|
+
} else if (isNaN(parseFloat(rule.value[0])) || isNaN(parseFloat(rule.value[1]))) {
|
|
219
|
+
result[rule.id] = {
|
|
220
|
+
valid: false,
|
|
221
|
+
reasons: [RULES.INCORRECT_RULE]
|
|
222
|
+
};
|
|
223
|
+
} else if (parseFloat(rule.value[0]) >= parseFloat(rule.value[1])) {
|
|
224
|
+
result[rule.id] = {
|
|
225
|
+
valid: false,
|
|
226
|
+
reasons: [RULES.BETWEEN_RULE]
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
} else if (rule.id && rule.operator === OPERATOR_OPTIONS.IN.name && !((_c = rule.value) == null ? void 0 : _c.length)) {
|
|
230
|
+
result[rule.id] = {
|
|
231
|
+
valid: false,
|
|
232
|
+
reasons: [RULES.EMPTY_RULE]
|
|
233
|
+
};
|
|
234
|
+
} else if (rule.id && isStringInput && (rule.value || "").trim() === "") {
|
|
235
|
+
result[rule.id] = {
|
|
236
|
+
valid: false,
|
|
237
|
+
reasons: [RULES.EMPTY_RULE]
|
|
238
|
+
};
|
|
239
|
+
} else if (rule.id && isNumberInput && isNaN(parseFloat(rule.value))) {
|
|
240
|
+
result[rule.id] = {
|
|
241
|
+
valid: false,
|
|
242
|
+
reasons: [RULES.INCORRECT_RULE]
|
|
243
|
+
};
|
|
244
|
+
} else if (rule.id && (rule.operator === OPERATOR_OPTIONS.IS_PART_OF.name || rule.operator === OPERATOR_OPTIONS.IS_NOT_PART_OF.name) && (!((_d = rule.value) == null ? void 0 : _d.length) || !validate(rule.value[0]))) {
|
|
245
|
+
result[rule.id] = {
|
|
246
|
+
valid: false,
|
|
247
|
+
reasons: [RULES.EMPTY_RULE]
|
|
248
|
+
};
|
|
249
|
+
} else if (rule.id && getDataType(rule.field, rule.operator) === DataType.PROPERTY && (isBlankOrEmpty((_e = rule.value) == null ? void 0 : _e.propertyName) || isBlankOrEmpty((_f = rule.value) == null ? void 0 : _f.propertyOperator) || isBlankOrEmpty((_g = rule.value) == null ? void 0 : _g.propertyValues) || !((_i = (_h = rule.value) == null ? void 0 : _h.propertyValues) == null ? void 0 : _i.length))) {
|
|
250
|
+
result[rule.id] = {
|
|
251
|
+
valid: false,
|
|
252
|
+
reasons: [RULES.EMPTY_RULE]
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
const validateGroup = (ruleGroup) => {
|
|
257
|
+
const reasons = [];
|
|
258
|
+
if (ruleGroup.rules.length === 0) {
|
|
259
|
+
reasons.push(RULES.EMPTY_GROUP);
|
|
260
|
+
}
|
|
261
|
+
if (ruleGroup.id) {
|
|
262
|
+
if (reasons.length) {
|
|
263
|
+
result[ruleGroup.id] = { valid: false, reasons };
|
|
264
|
+
} else {
|
|
265
|
+
result[ruleGroup.id] = true;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
ruleGroup.rules.forEach((rule) => {
|
|
269
|
+
if (typeof rule === "string")
|
|
270
|
+
;
|
|
271
|
+
else if ("rules" in rule) {
|
|
272
|
+
validateGroup(rule);
|
|
273
|
+
} else {
|
|
274
|
+
validateRule(rule);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
validateGroup(query);
|
|
279
|
+
return result;
|
|
280
|
+
};
|
|
281
|
+
function recursiveRemove(query, path) {
|
|
282
|
+
if (getNumberOfSiblings(path, query) === 1 && path.toString() !== [0].toString()) {
|
|
283
|
+
return recursiveRemove(query, getParentPath(path));
|
|
284
|
+
} else {
|
|
285
|
+
return remove(query, path);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function getNumberOfSiblings(path, query) {
|
|
289
|
+
const parentPath = getParentPath(path);
|
|
290
|
+
const parentGroup = findPath(parentPath, query);
|
|
291
|
+
return parentGroup.rules.length;
|
|
292
|
+
}
|
|
293
|
+
export {
|
|
294
|
+
countRules,
|
|
295
|
+
exportExpertRules,
|
|
296
|
+
getNumberOfSiblings,
|
|
297
|
+
getOperators,
|
|
298
|
+
importExpertRules,
|
|
299
|
+
queryValidator,
|
|
300
|
+
recursiveRemove,
|
|
301
|
+
testQuery
|
|
302
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
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 enum OperatorType {
|
|
8
|
+
EQUALS = "EQUALS",
|
|
9
|
+
NOT_EQUALS = "NOT_EQUALS",
|
|
10
|
+
LOWER = "LOWER",
|
|
11
|
+
LOWER_OR_EQUALS = "LOWER_OR_EQUALS",
|
|
12
|
+
GREATER = "GREATER",
|
|
13
|
+
GREATER_OR_EQUALS = "GREATER_OR_EQUALS",
|
|
14
|
+
BETWEEN = "BETWEEN",
|
|
15
|
+
IN = "IN",
|
|
16
|
+
IS = "IS",
|
|
17
|
+
CONTAINS = "CONTAINS",
|
|
18
|
+
BEGINS_WITH = "BEGINS_WITH",
|
|
19
|
+
ENDS_WITH = "ENDS_WITH",
|
|
20
|
+
EXISTS = "EXISTS",
|
|
21
|
+
IS_PART_OF = "IS_PART_OF",
|
|
22
|
+
IS_NOT_PART_OF = "IS_NOT_PART_OF"
|
|
23
|
+
}
|
|
24
|
+
export declare enum CombinatorType {
|
|
25
|
+
AND = "AND",
|
|
26
|
+
OR = "OR"
|
|
27
|
+
}
|
|
28
|
+
export declare enum FieldType {
|
|
29
|
+
ID = "ID",
|
|
30
|
+
NAME = "NAME",
|
|
31
|
+
NOMINAL_VOLTAGE = "NOMINAL_VOLTAGE",
|
|
32
|
+
MIN_P = "MIN_P",
|
|
33
|
+
MAX_P = "MAX_P",
|
|
34
|
+
TARGET_V = "TARGET_V",
|
|
35
|
+
TARGET_P = "TARGET_P",
|
|
36
|
+
TARGET_Q = "TARGET_Q",
|
|
37
|
+
ENERGY_SOURCE = "ENERGY_SOURCE",
|
|
38
|
+
COUNTRY = "COUNTRY",
|
|
39
|
+
VOLTAGE_REGULATOR_ON = "VOLTAGE_REGULATOR_ON",
|
|
40
|
+
PLANNED_ACTIVE_POWER_SET_POINT = "PLANNED_ACTIVE_POWER_SET_POINT",
|
|
41
|
+
RATED_S = "RATED_S",
|
|
42
|
+
MARGINAL_COST = "MARGINAL_COST",
|
|
43
|
+
PLANNED_OUTAGE_RATE = "PLANNED_OUTAGE_RATE",
|
|
44
|
+
FORCED_OUTAGE_RATE = "FORCED_OUTAGE_RATE",
|
|
45
|
+
VOLTAGE_LEVEL_ID = "VOLTAGE_LEVEL_ID",
|
|
46
|
+
P0 = "P0",
|
|
47
|
+
Q0 = "Q0",
|
|
48
|
+
LOW_VOLTAGE_LIMIT = "LOW_VOLTAGE_LIMIT",
|
|
49
|
+
HIGH_VOLTAGE_LIMIT = "HIGH_VOLTAGE_LIMIT",
|
|
50
|
+
SECTION_COUNT = "SECTION_COUNT",
|
|
51
|
+
MAXIMUM_SECTION_COUNT = "MAXIMUM_SECTION_COUNT",
|
|
52
|
+
SHUNT_COMPENSATOR_TYPE = "SHUNT_COMPENSATOR_TYPE",
|
|
53
|
+
CONNECTED = "CONNECTED",
|
|
54
|
+
MAX_Q_AT_NOMINAL_V = "MAX_Q_AT_NOMINAL_V",
|
|
55
|
+
SWITCHED_ON_Q_AT_NOMINAL_V = "SWITCHED_ON_Q_AT_NOMINAL_V",
|
|
56
|
+
MAX_SUSCEPTANCE = "MAX_SUSCEPTANCE",
|
|
57
|
+
SWITCHED_ON_SUSCEPTANCE = "SWITCHED_ON_SUSCEPTANCE",
|
|
58
|
+
CONNECTED_1 = "CONNECTED_1",
|
|
59
|
+
CONNECTED_2 = "CONNECTED_2",
|
|
60
|
+
VOLTAGE_LEVEL_ID_1 = "VOLTAGE_LEVEL_ID_1",
|
|
61
|
+
VOLTAGE_LEVEL_ID_2 = "VOLTAGE_LEVEL_ID_2",
|
|
62
|
+
NOMINAL_VOLTAGE_1 = "NOMINAL_VOLTAGE_1",
|
|
63
|
+
NOMINAL_VOLTAGE_2 = "NOMINAL_VOLTAGE_2",
|
|
64
|
+
COUNTRY_1 = "COUNTRY_1",
|
|
65
|
+
COUNTRY_2 = "COUNTRY_2",
|
|
66
|
+
SERIE_RESISTANCE = "SERIE_RESISTANCE",
|
|
67
|
+
SERIE_REACTANCE = "SERIE_REACTANCE",
|
|
68
|
+
SHUNT_CONDUCTANCE_1 = "SHUNT_CONDUCTANCE_1",
|
|
69
|
+
SHUNT_CONDUCTANCE_2 = "SHUNT_CONDUCTANCE_2",
|
|
70
|
+
SHUNT_SUSCEPTANCE_1 = "SHUNT_SUSCEPTANCE_1",
|
|
71
|
+
SHUNT_SUSCEPTANCE_2 = "SHUNT_SUSCEPTANCE_2",
|
|
72
|
+
MAGNETIZING_CONDUCTANCE = "MAGNETIZING_CONDUCTANCE",
|
|
73
|
+
MAGNETIZING_SUSCEPTANCE = "MAGNETIZING_SUSCEPTANCE",
|
|
74
|
+
LOAD_TYPE = "LOAD_TYPE",
|
|
75
|
+
RATED_VOLTAGE_1 = "RATED_VOLTAGE_1",
|
|
76
|
+
RATED_VOLTAGE_2 = "RATED_VOLTAGE_2",
|
|
77
|
+
HAS_RATIO_TAP_CHANGER = "HAS_RATIO_TAP_CHANGER",
|
|
78
|
+
RATIO_REGULATING = "RATIO_REGULATING",
|
|
79
|
+
LOAD_TAP_CHANGING_CAPABILITIES = "LOAD_TAP_CHANGING_CAPABILITIES",
|
|
80
|
+
RATIO_REGULATION_MODE = "RATIO_REGULATION_MODE",
|
|
81
|
+
RATIO_TARGET_V = "RATIO_TARGET_V",
|
|
82
|
+
HAS_PHASE_TAP_CHANGER = "HAS_PHASE_TAP_CHANGER",
|
|
83
|
+
PHASE_REGULATING = "PHASE_REGULATING",
|
|
84
|
+
PHASE_REGULATION_MODE = "PHASE_REGULATION_MODE",
|
|
85
|
+
PHASE_REGULATION_VALUE = "PHASE_REGULATION_VALUE",
|
|
86
|
+
PROPERTY = "FREE_PROPERTIES",
|
|
87
|
+
SUBSTATION_PROPERTY = "SUBSTATION_PROPERTIES",
|
|
88
|
+
SUBSTATION_PROPERTY_1 = "SUBSTATION_PROPERTIES_1",
|
|
89
|
+
SUBSTATION_PROPERTY_2 = "SUBSTATION_PROPERTIES_2"
|
|
90
|
+
}
|
|
91
|
+
export declare enum DataType {
|
|
92
|
+
STRING = "STRING",
|
|
93
|
+
ENUM = "ENUM",
|
|
94
|
+
NUMBER = "NUMBER",
|
|
95
|
+
BOOLEAN = "BOOLEAN",
|
|
96
|
+
COMBINATOR = "COMBINATOR",
|
|
97
|
+
FILTER_UUID = "FILTER_UUID",
|
|
98
|
+
PROPERTY = "PROPERTIES"
|
|
99
|
+
}
|
|
100
|
+
export interface RuleTypeExport {
|
|
101
|
+
field: FieldType;
|
|
102
|
+
operator: OperatorType;
|
|
103
|
+
value: string | number | undefined;
|
|
104
|
+
values: string[] | number[] | undefined;
|
|
105
|
+
dataType: DataType;
|
|
106
|
+
propertyName?: string;
|
|
107
|
+
propertyValues?: string[];
|
|
108
|
+
}
|
|
109
|
+
export interface RuleGroupTypeExport {
|
|
110
|
+
combinator: CombinatorType;
|
|
111
|
+
dataType: DataType;
|
|
112
|
+
rules: (RuleTypeExport | RuleGroupTypeExport)[];
|
|
113
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var OperatorType = /* @__PURE__ */ ((OperatorType2) => {
|
|
2
|
+
OperatorType2["EQUALS"] = "EQUALS";
|
|
3
|
+
OperatorType2["NOT_EQUALS"] = "NOT_EQUALS";
|
|
4
|
+
OperatorType2["LOWER"] = "LOWER";
|
|
5
|
+
OperatorType2["LOWER_OR_EQUALS"] = "LOWER_OR_EQUALS";
|
|
6
|
+
OperatorType2["GREATER"] = "GREATER";
|
|
7
|
+
OperatorType2["GREATER_OR_EQUALS"] = "GREATER_OR_EQUALS";
|
|
8
|
+
OperatorType2["BETWEEN"] = "BETWEEN";
|
|
9
|
+
OperatorType2["IN"] = "IN";
|
|
10
|
+
OperatorType2["IS"] = "IS";
|
|
11
|
+
OperatorType2["CONTAINS"] = "CONTAINS";
|
|
12
|
+
OperatorType2["BEGINS_WITH"] = "BEGINS_WITH";
|
|
13
|
+
OperatorType2["ENDS_WITH"] = "ENDS_WITH";
|
|
14
|
+
OperatorType2["EXISTS"] = "EXISTS";
|
|
15
|
+
OperatorType2["IS_PART_OF"] = "IS_PART_OF";
|
|
16
|
+
OperatorType2["IS_NOT_PART_OF"] = "IS_NOT_PART_OF";
|
|
17
|
+
return OperatorType2;
|
|
18
|
+
})(OperatorType || {});
|
|
19
|
+
var CombinatorType = /* @__PURE__ */ ((CombinatorType2) => {
|
|
20
|
+
CombinatorType2["AND"] = "AND";
|
|
21
|
+
CombinatorType2["OR"] = "OR";
|
|
22
|
+
return CombinatorType2;
|
|
23
|
+
})(CombinatorType || {});
|
|
24
|
+
var FieldType = /* @__PURE__ */ ((FieldType2) => {
|
|
25
|
+
FieldType2["ID"] = "ID";
|
|
26
|
+
FieldType2["NAME"] = "NAME";
|
|
27
|
+
FieldType2["NOMINAL_VOLTAGE"] = "NOMINAL_VOLTAGE";
|
|
28
|
+
FieldType2["MIN_P"] = "MIN_P";
|
|
29
|
+
FieldType2["MAX_P"] = "MAX_P";
|
|
30
|
+
FieldType2["TARGET_V"] = "TARGET_V";
|
|
31
|
+
FieldType2["TARGET_P"] = "TARGET_P";
|
|
32
|
+
FieldType2["TARGET_Q"] = "TARGET_Q";
|
|
33
|
+
FieldType2["ENERGY_SOURCE"] = "ENERGY_SOURCE";
|
|
34
|
+
FieldType2["COUNTRY"] = "COUNTRY";
|
|
35
|
+
FieldType2["VOLTAGE_REGULATOR_ON"] = "VOLTAGE_REGULATOR_ON";
|
|
36
|
+
FieldType2["PLANNED_ACTIVE_POWER_SET_POINT"] = "PLANNED_ACTIVE_POWER_SET_POINT";
|
|
37
|
+
FieldType2["RATED_S"] = "RATED_S";
|
|
38
|
+
FieldType2["MARGINAL_COST"] = "MARGINAL_COST";
|
|
39
|
+
FieldType2["PLANNED_OUTAGE_RATE"] = "PLANNED_OUTAGE_RATE";
|
|
40
|
+
FieldType2["FORCED_OUTAGE_RATE"] = "FORCED_OUTAGE_RATE";
|
|
41
|
+
FieldType2["VOLTAGE_LEVEL_ID"] = "VOLTAGE_LEVEL_ID";
|
|
42
|
+
FieldType2["P0"] = "P0";
|
|
43
|
+
FieldType2["Q0"] = "Q0";
|
|
44
|
+
FieldType2["LOW_VOLTAGE_LIMIT"] = "LOW_VOLTAGE_LIMIT";
|
|
45
|
+
FieldType2["HIGH_VOLTAGE_LIMIT"] = "HIGH_VOLTAGE_LIMIT";
|
|
46
|
+
FieldType2["SECTION_COUNT"] = "SECTION_COUNT";
|
|
47
|
+
FieldType2["MAXIMUM_SECTION_COUNT"] = "MAXIMUM_SECTION_COUNT";
|
|
48
|
+
FieldType2["SHUNT_COMPENSATOR_TYPE"] = "SHUNT_COMPENSATOR_TYPE";
|
|
49
|
+
FieldType2["CONNECTED"] = "CONNECTED";
|
|
50
|
+
FieldType2["MAX_Q_AT_NOMINAL_V"] = "MAX_Q_AT_NOMINAL_V";
|
|
51
|
+
FieldType2["SWITCHED_ON_Q_AT_NOMINAL_V"] = "SWITCHED_ON_Q_AT_NOMINAL_V";
|
|
52
|
+
FieldType2["MAX_SUSCEPTANCE"] = "MAX_SUSCEPTANCE";
|
|
53
|
+
FieldType2["SWITCHED_ON_SUSCEPTANCE"] = "SWITCHED_ON_SUSCEPTANCE";
|
|
54
|
+
FieldType2["CONNECTED_1"] = "CONNECTED_1";
|
|
55
|
+
FieldType2["CONNECTED_2"] = "CONNECTED_2";
|
|
56
|
+
FieldType2["VOLTAGE_LEVEL_ID_1"] = "VOLTAGE_LEVEL_ID_1";
|
|
57
|
+
FieldType2["VOLTAGE_LEVEL_ID_2"] = "VOLTAGE_LEVEL_ID_2";
|
|
58
|
+
FieldType2["NOMINAL_VOLTAGE_1"] = "NOMINAL_VOLTAGE_1";
|
|
59
|
+
FieldType2["NOMINAL_VOLTAGE_2"] = "NOMINAL_VOLTAGE_2";
|
|
60
|
+
FieldType2["COUNTRY_1"] = "COUNTRY_1";
|
|
61
|
+
FieldType2["COUNTRY_2"] = "COUNTRY_2";
|
|
62
|
+
FieldType2["SERIE_RESISTANCE"] = "SERIE_RESISTANCE";
|
|
63
|
+
FieldType2["SERIE_REACTANCE"] = "SERIE_REACTANCE";
|
|
64
|
+
FieldType2["SHUNT_CONDUCTANCE_1"] = "SHUNT_CONDUCTANCE_1";
|
|
65
|
+
FieldType2["SHUNT_CONDUCTANCE_2"] = "SHUNT_CONDUCTANCE_2";
|
|
66
|
+
FieldType2["SHUNT_SUSCEPTANCE_1"] = "SHUNT_SUSCEPTANCE_1";
|
|
67
|
+
FieldType2["SHUNT_SUSCEPTANCE_2"] = "SHUNT_SUSCEPTANCE_2";
|
|
68
|
+
FieldType2["MAGNETIZING_CONDUCTANCE"] = "MAGNETIZING_CONDUCTANCE";
|
|
69
|
+
FieldType2["MAGNETIZING_SUSCEPTANCE"] = "MAGNETIZING_SUSCEPTANCE";
|
|
70
|
+
FieldType2["LOAD_TYPE"] = "LOAD_TYPE";
|
|
71
|
+
FieldType2["RATED_VOLTAGE_1"] = "RATED_VOLTAGE_1";
|
|
72
|
+
FieldType2["RATED_VOLTAGE_2"] = "RATED_VOLTAGE_2";
|
|
73
|
+
FieldType2["HAS_RATIO_TAP_CHANGER"] = "HAS_RATIO_TAP_CHANGER";
|
|
74
|
+
FieldType2["RATIO_REGULATING"] = "RATIO_REGULATING";
|
|
75
|
+
FieldType2["LOAD_TAP_CHANGING_CAPABILITIES"] = "LOAD_TAP_CHANGING_CAPABILITIES";
|
|
76
|
+
FieldType2["RATIO_REGULATION_MODE"] = "RATIO_REGULATION_MODE";
|
|
77
|
+
FieldType2["RATIO_TARGET_V"] = "RATIO_TARGET_V";
|
|
78
|
+
FieldType2["HAS_PHASE_TAP_CHANGER"] = "HAS_PHASE_TAP_CHANGER";
|
|
79
|
+
FieldType2["PHASE_REGULATING"] = "PHASE_REGULATING";
|
|
80
|
+
FieldType2["PHASE_REGULATION_MODE"] = "PHASE_REGULATION_MODE";
|
|
81
|
+
FieldType2["PHASE_REGULATION_VALUE"] = "PHASE_REGULATION_VALUE";
|
|
82
|
+
FieldType2["PROPERTY"] = "FREE_PROPERTIES";
|
|
83
|
+
FieldType2["SUBSTATION_PROPERTY"] = "SUBSTATION_PROPERTIES";
|
|
84
|
+
FieldType2["SUBSTATION_PROPERTY_1"] = "SUBSTATION_PROPERTIES_1";
|
|
85
|
+
FieldType2["SUBSTATION_PROPERTY_2"] = "SUBSTATION_PROPERTIES_2";
|
|
86
|
+
return FieldType2;
|
|
87
|
+
})(FieldType || {});
|
|
88
|
+
var DataType = /* @__PURE__ */ ((DataType2) => {
|
|
89
|
+
DataType2["STRING"] = "STRING";
|
|
90
|
+
DataType2["ENUM"] = "ENUM";
|
|
91
|
+
DataType2["NUMBER"] = "NUMBER";
|
|
92
|
+
DataType2["BOOLEAN"] = "BOOLEAN";
|
|
93
|
+
DataType2["COMBINATOR"] = "COMBINATOR";
|
|
94
|
+
DataType2["FILTER_UUID"] = "FILTER_UUID";
|
|
95
|
+
DataType2["PROPERTY"] = "PROPERTIES";
|
|
96
|
+
return DataType2;
|
|
97
|
+
})(DataType || {});
|
|
98
|
+
export {
|
|
99
|
+
CombinatorType,
|
|
100
|
+
DataType,
|
|
101
|
+
FieldType,
|
|
102
|
+
OperatorType
|
|
103
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { elementExistsType } from '../criteria-based/criteria-based-filter-edition-dialog';
|
|
2
|
+
import { UUID } from 'crypto';
|
|
3
|
+
import { FunctionComponent } from 'react';
|
|
4
|
+
|
|
5
|
+
interface ExplicitNamingFilterEditionDialogProps {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
titleId: string;
|
|
9
|
+
open: boolean;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
broadcastChannel: BroadcastChannel;
|
|
12
|
+
selectionForCopy: any;
|
|
13
|
+
setSelectionForCopy: (selection: any) => void;
|
|
14
|
+
getFilterById: (id: string) => Promise<any>;
|
|
15
|
+
createFilter: (filter: any, name: string, description: string, activeDirectory: any) => Promise<void>;
|
|
16
|
+
saveFilter: (filter: any, name: string) => Promise<void>;
|
|
17
|
+
activeDirectory?: UUID;
|
|
18
|
+
elementExists?: elementExistsType;
|
|
19
|
+
language?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const ExplicitNamingFilterEditionDialog: FunctionComponent<ExplicitNamingFilterEditionDialogProps>;
|
|
22
|
+
export default ExplicitNamingFilterEditionDialog;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "prop-types";
|
|
4
|
+
import "../utils/filters-utils.js";
|
|
5
|
+
import "react-hook-form";
|
|
6
|
+
import "@hookform/resolvers/yup";
|
|
7
|
+
import "../../../hooks/useSnackMessage.js";
|
|
8
|
+
import "../../dialogs/custom-mui-dialog.js";
|
|
9
|
+
import "../../../utils/yup-config.js";
|
|
10
|
+
import { a } from "../../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
|
|
11
|
+
import "../constants/field-constants.js";
|
|
12
|
+
import "uuid";
|
|
13
|
+
import "../constants/equipment-types.js";
|
|
14
|
+
import "../constants/filter-constants.js";
|
|
15
|
+
import "../../../utils/FetchStatus.js";
|
|
16
|
+
import "yup";
|
|
17
|
+
export {
|
|
18
|
+
a as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DISTRIBUTION_KEY } from '../constants/filter-constants';
|
|
2
|
+
import { default as yup } from '../../../utils/yup-config';
|
|
3
|
+
import { FieldConstants } from '../constants/field-constants';
|
|
4
|
+
import { FunctionComponent } from 'react';
|
|
5
|
+
|
|
6
|
+
export declare const FILTER_EQUIPMENTS_ATTRIBUTES = "filterEquipmentsAttributes";
|
|
7
|
+
export declare const explicitNamingFilterSchema: {
|
|
8
|
+
filterEquipmentsAttributes: yup.ArraySchema<{
|
|
9
|
+
equipmentID?: string | null | undefined;
|
|
10
|
+
distributionKey?: number | null | undefined;
|
|
11
|
+
}[] | undefined, yup.AnyObject, "", "">;
|
|
12
|
+
};
|
|
13
|
+
interface FilterTableRow {
|
|
14
|
+
[FieldConstants.AG_GRID_ROW_UUID]: string;
|
|
15
|
+
[FieldConstants.EQUIPMENT_ID]: string;
|
|
16
|
+
[DISTRIBUTION_KEY]: number | null;
|
|
17
|
+
}
|
|
18
|
+
export declare function getExplicitNamingFilterEmptyFormData(): {
|
|
19
|
+
filterEquipmentsAttributes: FilterTableRow[];
|
|
20
|
+
};
|
|
21
|
+
declare const ExplicitNamingFilterForm: FunctionComponent;
|
|
22
|
+
export default ExplicitNamingFilterForm;
|
|
@@ -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.DxqH-mLe.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;
|