@gridsuite/commons-ui 0.59.1 → 0.60.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/chunks/{criteria-based-filter-edition-dialog.DcXcQOoT.js → criteria-based-filter-edition-dialog.g-QT74FD.js} +57 -22
- package/dist/components/ElementSearchDialog/element-search-dialog.d.ts +4 -15
- package/dist/components/ElementSearchDialog/element-search-dialog.js +10 -80
- package/dist/components/ElementSearchDialog/element-search-input.d.ts +21 -0
- package/dist/components/ElementSearchDialog/element-search-input.js +85 -0
- package/dist/components/ElementSearchDialog/equipment-item.d.ts +8 -8
- package/dist/components/ElementSearchDialog/equipment-item.js +1 -1
- package/dist/components/ElementSearchDialog/index.d.ts +2 -0
- package/dist/components/ElementSearchDialog/index.js +6 -2
- package/dist/components/ElementSearchDialog/tag-renderer.d.ts +3 -3
- package/dist/components/ElementSearchDialog/use-element-search.d.ts +16 -0
- package/dist/components/ElementSearchDialog/use-element-search.js +57 -0
- package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +1 -1
- package/dist/components/OverflowableText/overflowable-text.d.ts +3 -3
- package/dist/components/OverflowableText/overflowable-text.js +1 -2
- package/dist/components/dialogs/modify-element-selection.js +1 -1
- package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +1 -1
- package/dist/components/filter/expert/expert-filter-constants.d.ts +129 -2
- package/dist/components/filter/expert/expert-filter-constants.js +165 -4
- package/dist/components/filter/expert/expert-filter-edition-dialog.js +1 -1
- package/dist/components/filter/expert/expert-filter-form.js +1 -1
- package/dist/components/filter/expert/expert-filter-utils.d.ts +3 -7
- package/dist/components/filter/expert/expert-filter-utils.js +127 -26
- package/dist/components/filter/expert/expert-filter.type.d.ts +42 -7
- package/dist/components/filter/expert/expert-filter.type.js +16 -0
- package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +1 -1
- package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +1 -1
- package/dist/components/filter/filter-creation-dialog.js +1 -1
- package/dist/components/filter/filter-form.js +1 -1
- package/dist/components/filter/utils/filter-form-utils.js +1 -1
- package/dist/components/inputs/react-hook-form/ag-grid-table/bottom-right-buttons.js +1 -1
- package/dist/components/inputs/react-hook-form/ag-grid-table/csv-uploader/csv-uploader.js +2 -1
- package/dist/components/inputs/react-hook-form/ag-grid-table/custom-ag-grid-table.js +1 -1
- package/dist/components/inputs/react-hook-form/directory-items-input.js +1 -1
- package/dist/components/inputs/react-hook-form/error-management/error-input.js +10 -8
- package/dist/components/inputs/react-query-builder/composite-rule-editor/group-value-editor.d.ts +5 -0
- package/dist/components/inputs/react-query-builder/composite-rule-editor/group-value-editor.js +62 -0
- package/dist/components/inputs/react-query-builder/composite-rule-editor/rule-value-editor.d.ts +9 -0
- package/dist/components/inputs/react-query-builder/composite-rule-editor/rule-value-editor.js +65 -0
- package/dist/components/inputs/react-query-builder/custom-react-query-builder.js +1 -1
- package/dist/components/inputs/react-query-builder/element-value-editor.js +2 -1
- package/dist/components/inputs/react-query-builder/remove-button.js +1 -1
- package/dist/components/inputs/react-query-builder/value-editor.js +3 -1
- package/dist/components/translations/filter-expert-en.d.ts +23 -0
- package/dist/components/translations/filter-expert-en.js +24 -1
- package/dist/components/translations/filter-expert-fr.d.ts +23 -0
- package/dist/components/translations/filter-expert-fr.js +25 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +131 -127
- package/dist/utils/styles.d.ts +2 -2
- package/dist/utils/types.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defaultOperators, getParentPath, remove, findPath } from "react-querybuilder";
|
|
2
|
-
import { FieldType, DataType
|
|
2
|
+
import { FieldType, DataType } from "./expert-filter.type.js";
|
|
3
3
|
import { validate } from "uuid";
|
|
4
4
|
import { FIELDS_OPTIONS, OPERATOR_OPTIONS, RULES } from "./expert-filter-constants.js";
|
|
5
5
|
import { isBlankOrEmpty, microUnitToUnit, unitToMicroUnit } from "../../../utils/conversion-utils.js";
|
|
@@ -9,14 +9,31 @@ const microUnits = [
|
|
|
9
9
|
FieldType.SHUNT_SUSCEPTANCE_1,
|
|
10
10
|
FieldType.SHUNT_SUSCEPTANCE_2
|
|
11
11
|
];
|
|
12
|
+
const searchTree = (tree, key, value) => {
|
|
13
|
+
const stack = Object.values(tree);
|
|
14
|
+
while (stack.length) {
|
|
15
|
+
const node = stack.shift();
|
|
16
|
+
if ((node == null ? void 0 : node[key]) === value) {
|
|
17
|
+
return node;
|
|
18
|
+
}
|
|
19
|
+
if (node == null ? void 0 : node.children) {
|
|
20
|
+
stack.push(...Object.values(node.children));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
25
|
+
const getFieldData = (fieldName) => {
|
|
26
|
+
return searchTree(FIELDS_OPTIONS, "name", fieldName);
|
|
27
|
+
};
|
|
12
28
|
const getDataType = (fieldName, operator) => {
|
|
13
|
-
if (
|
|
29
|
+
if (operator === OPERATOR_OPTIONS.IS_PART_OF.name || operator === OPERATOR_OPTIONS.IS_NOT_PART_OF.name) {
|
|
14
30
|
return DataType.FILTER_UUID;
|
|
15
31
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
32
|
+
if (fieldName === FieldType.REMOTE_REGULATED_TERMINAL && (operator === OPERATOR_OPTIONS.EXISTS.name || operator === OPERATOR_OPTIONS.NOT_EXISTS.name)) {
|
|
33
|
+
return DataType.BOOLEAN;
|
|
34
|
+
}
|
|
35
|
+
const fieldData = getFieldData(fieldName);
|
|
36
|
+
return fieldData == null ? void 0 : fieldData.dataType;
|
|
20
37
|
};
|
|
21
38
|
const getOperators = (fieldName, intl) => {
|
|
22
39
|
const field = Object.values(FIELDS_OPTIONS).find(
|
|
@@ -24,7 +41,7 @@ const getOperators = (fieldName, intl) => {
|
|
|
24
41
|
);
|
|
25
42
|
switch (field == null ? void 0 : field.dataType) {
|
|
26
43
|
case DataType.STRING:
|
|
27
|
-
let
|
|
44
|
+
let stringOperators = [
|
|
28
45
|
OPERATOR_OPTIONS.CONTAINS,
|
|
29
46
|
OPERATOR_OPTIONS.IS,
|
|
30
47
|
OPERATOR_OPTIONS.BEGINS_WITH,
|
|
@@ -34,20 +51,20 @@ const getOperators = (fieldName, intl) => {
|
|
|
34
51
|
OPERATOR_OPTIONS.NOT_EXISTS
|
|
35
52
|
];
|
|
36
53
|
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) {
|
|
37
|
-
|
|
38
|
-
|
|
54
|
+
stringOperators.push(OPERATOR_OPTIONS.IS_PART_OF);
|
|
55
|
+
stringOperators.push(OPERATOR_OPTIONS.IS_NOT_PART_OF);
|
|
39
56
|
}
|
|
40
57
|
if (field.name === FieldType.ID) {
|
|
41
|
-
|
|
42
|
-
(
|
|
58
|
+
stringOperators = stringOperators.filter(
|
|
59
|
+
(operator) => operator !== OPERATOR_OPTIONS.EXISTS && operator !== OPERATOR_OPTIONS.NOT_EXISTS
|
|
43
60
|
);
|
|
44
61
|
}
|
|
45
|
-
return
|
|
62
|
+
return stringOperators.map((operator) => ({
|
|
46
63
|
name: operator.name,
|
|
47
64
|
label: intl.formatMessage({ id: operator.label })
|
|
48
65
|
}));
|
|
49
66
|
case DataType.NUMBER:
|
|
50
|
-
|
|
67
|
+
let numberOperators = [
|
|
51
68
|
OPERATOR_OPTIONS.EQUALS,
|
|
52
69
|
OPERATOR_OPTIONS.GREATER,
|
|
53
70
|
OPERATOR_OPTIONS.GREATER_OR_EQUALS,
|
|
@@ -56,12 +73,20 @@ const getOperators = (fieldName, intl) => {
|
|
|
56
73
|
OPERATOR_OPTIONS.BETWEEN,
|
|
57
74
|
OPERATOR_OPTIONS.EXISTS,
|
|
58
75
|
OPERATOR_OPTIONS.NOT_EXISTS
|
|
59
|
-
]
|
|
76
|
+
];
|
|
77
|
+
return numberOperators.map((operator) => ({
|
|
60
78
|
name: operator.name,
|
|
61
79
|
label: intl.formatMessage({ id: operator.label })
|
|
62
80
|
}));
|
|
63
81
|
case DataType.BOOLEAN:
|
|
64
|
-
|
|
82
|
+
let booleanOperators = [OPERATOR_OPTIONS.EQUALS];
|
|
83
|
+
if (field.name === FieldType.AUTOMATE) {
|
|
84
|
+
booleanOperators = [
|
|
85
|
+
OPERATOR_OPTIONS.EXISTS,
|
|
86
|
+
OPERATOR_OPTIONS.NOT_EXISTS
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
return booleanOperators.map((operator) => ({
|
|
65
90
|
name: operator.name,
|
|
66
91
|
label: intl.formatMessage({ id: operator.label })
|
|
67
92
|
}));
|
|
@@ -71,9 +96,9 @@ const getOperators = (fieldName, intl) => {
|
|
|
71
96
|
OPERATOR_OPTIONS.NOT_EQUALS,
|
|
72
97
|
OPERATOR_OPTIONS.IN
|
|
73
98
|
];
|
|
74
|
-
if (field.name === FieldType.SHUNT_COMPENSATOR_TYPE) {
|
|
99
|
+
if (field.name === FieldType.SHUNT_COMPENSATOR_TYPE || field.name === FieldType.REGULATION_TYPE || field.name === FieldType.SVAR_REGULATION_MODE) {
|
|
75
100
|
enumOperators = enumOperators.filter(
|
|
76
|
-
(
|
|
101
|
+
(operator) => operator !== OPERATOR_OPTIONS.IN
|
|
77
102
|
);
|
|
78
103
|
}
|
|
79
104
|
return enumOperators.map((operator) => ({
|
|
@@ -86,6 +111,16 @@ const getOperators = (fieldName, intl) => {
|
|
|
86
111
|
name: operator.name,
|
|
87
112
|
label: intl.formatMessage({ id: operator.label })
|
|
88
113
|
}));
|
|
114
|
+
case DataType.COMBINATOR:
|
|
115
|
+
const combinatorOperators = [OPERATOR_OPTIONS.IS];
|
|
116
|
+
if (field.name === FieldType.REMOTE_REGULATED_TERMINAL) {
|
|
117
|
+
combinatorOperators.push(OPERATOR_OPTIONS.EXISTS);
|
|
118
|
+
combinatorOperators.push(OPERATOR_OPTIONS.NOT_EXISTS);
|
|
119
|
+
}
|
|
120
|
+
return combinatorOperators.map((operator) => ({
|
|
121
|
+
name: operator.name,
|
|
122
|
+
label: intl.formatMessage({ id: operator.label })
|
|
123
|
+
}));
|
|
89
124
|
}
|
|
90
125
|
return defaultOperators;
|
|
91
126
|
};
|
|
@@ -104,18 +139,43 @@ function exportExpertRules(query) {
|
|
|
104
139
|
var _a;
|
|
105
140
|
const isValueAnArray = Array.isArray(rule.value);
|
|
106
141
|
const dataType = getDataType(rule.field, rule.operator);
|
|
142
|
+
if (dataType === DataType.COMBINATOR) {
|
|
143
|
+
return transformCompositeRule(rule);
|
|
144
|
+
}
|
|
107
145
|
return {
|
|
108
146
|
field: rule.field,
|
|
109
147
|
operator: dataType !== DataType.PROPERTY ? (_a = Object.values(OPERATOR_OPTIONS).find(
|
|
110
148
|
(operator) => operator.name === rule.operator
|
|
111
149
|
)) == null ? void 0 : _a.customName : rule.value.propertyOperator,
|
|
112
|
-
value: !isValueAnArray && rule.operator !==
|
|
150
|
+
value: !isValueAnArray && rule.operator !== OPERATOR_OPTIONS.EXISTS.name && rule.operator !== OPERATOR_OPTIONS.NOT_EXISTS.name && dataType !== DataType.PROPERTY ? changeValueUnit(rule.value, rule.field) : void 0,
|
|
113
151
|
values: isValueAnArray && dataType !== DataType.PROPERTY ? changeValueUnit(rule.value, rule.field) : void 0,
|
|
114
152
|
dataType,
|
|
115
153
|
propertyName: dataType === DataType.PROPERTY ? rule.value.propertyName : void 0,
|
|
116
154
|
propertyValues: dataType === DataType.PROPERTY ? rule.value.propertyValues : void 0
|
|
117
155
|
};
|
|
118
156
|
}
|
|
157
|
+
function transformCompositeRule(compositeRule) {
|
|
158
|
+
var _a;
|
|
159
|
+
const compositeGroup = compositeRule.value;
|
|
160
|
+
const transformedRules = Object.entries(compositeGroup.rules).map(
|
|
161
|
+
([field, rule]) => transformRule({
|
|
162
|
+
...rule,
|
|
163
|
+
field,
|
|
164
|
+
operator: rule.operator,
|
|
165
|
+
value: rule.value
|
|
166
|
+
})
|
|
167
|
+
);
|
|
168
|
+
return {
|
|
169
|
+
combinator: compositeGroup.combinator,
|
|
170
|
+
dataType: DataType.COMBINATOR,
|
|
171
|
+
rules: transformedRules,
|
|
172
|
+
// two additional attributes to distinct a composite rule from a normal rule group
|
|
173
|
+
operator: (_a = Object.values(OPERATOR_OPTIONS).find(
|
|
174
|
+
(operator) => operator.name === compositeRule.operator
|
|
175
|
+
)) == null ? void 0 : _a.customName,
|
|
176
|
+
field: compositeRule.field
|
|
177
|
+
};
|
|
178
|
+
}
|
|
119
179
|
function transformGroup(group) {
|
|
120
180
|
const transformedRules = group.rules.map((ruleOrGroup) => {
|
|
121
181
|
if ("rules" in ruleOrGroup) {
|
|
@@ -158,14 +218,41 @@ function importExpertRules(query) {
|
|
|
158
218
|
field: rule.field,
|
|
159
219
|
operator: rule.dataType !== DataType.PROPERTY ? (_a = Object.values(OPERATOR_OPTIONS).find(
|
|
160
220
|
(operator) => operator.customName === rule.operator
|
|
161
|
-
)) == null ? void 0 : _a.name :
|
|
162
|
-
value: parseValue(rule)
|
|
163
|
-
|
|
221
|
+
)) == null ? void 0 : _a.name : OPERATOR_OPTIONS.IS.name,
|
|
222
|
+
value: parseValue(rule)
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function transformCompositeGroup(group) {
|
|
226
|
+
var _a;
|
|
227
|
+
const transformedRules = group.rules.map((rule) => transformRule(rule)).reduce(
|
|
228
|
+
(obj, transformedRule) => ({
|
|
229
|
+
...obj,
|
|
230
|
+
[transformedRule.field]: {
|
|
231
|
+
operator: transformedRule.operator,
|
|
232
|
+
value: transformedRule.value
|
|
233
|
+
}
|
|
234
|
+
}),
|
|
235
|
+
{}
|
|
236
|
+
);
|
|
237
|
+
return {
|
|
238
|
+
field: group.field,
|
|
239
|
+
operator: (_a = Object.values(OPERATOR_OPTIONS).find(
|
|
240
|
+
(operator) => operator.customName === group.operator
|
|
241
|
+
)) == null ? void 0 : _a.name,
|
|
242
|
+
value: {
|
|
243
|
+
combinator: group.combinator,
|
|
244
|
+
rules: transformedRules
|
|
245
|
+
}
|
|
164
246
|
};
|
|
165
247
|
}
|
|
166
248
|
function transformGroup(group) {
|
|
167
249
|
const transformedRules = group.rules.map((ruleOrGroup) => {
|
|
168
250
|
if ("rules" in ruleOrGroup) {
|
|
251
|
+
if ("field" in ruleOrGroup && "operator" in ruleOrGroup) {
|
|
252
|
+
return transformCompositeGroup(
|
|
253
|
+
ruleOrGroup
|
|
254
|
+
);
|
|
255
|
+
}
|
|
169
256
|
return transformGroup(ruleOrGroup);
|
|
170
257
|
} else {
|
|
171
258
|
return transformRule(ruleOrGroup);
|
|
@@ -173,7 +260,6 @@ function importExpertRules(query) {
|
|
|
173
260
|
});
|
|
174
261
|
return {
|
|
175
262
|
combinator: group.combinator,
|
|
176
|
-
dataType: DataType.COMBINATOR,
|
|
177
263
|
rules: transformedRules
|
|
178
264
|
};
|
|
179
265
|
}
|
|
@@ -204,8 +290,9 @@ const queryValidator = (query) => {
|
|
|
204
290
|
const validateRule = (rule) => {
|
|
205
291
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
206
292
|
const isValueAnArray = Array.isArray(rule.value);
|
|
207
|
-
const
|
|
208
|
-
const
|
|
293
|
+
const dataType = getDataType(rule.field, rule.operator);
|
|
294
|
+
const isNumberInput = dataType === DataType.NUMBER && !isValueAnArray;
|
|
295
|
+
const isStringInput = dataType === DataType.STRING && !isValueAnArray;
|
|
209
296
|
if (rule.id && (rule.operator === OPERATOR_OPTIONS.EXISTS.name || rule.operator === OPERATOR_OPTIONS.NOT_EXISTS.name)) {
|
|
210
297
|
result[rule.id] = {
|
|
211
298
|
valid: true,
|
|
@@ -243,16 +330,30 @@ const queryValidator = (query) => {
|
|
|
243
330
|
valid: false,
|
|
244
331
|
reasons: [RULES.INCORRECT_RULE]
|
|
245
332
|
};
|
|
246
|
-
} else if (rule.id &&
|
|
333
|
+
} else if (rule.id && dataType === DataType.FILTER_UUID && (!((_d = rule.value) == null ? void 0 : _d.length) || !validate(rule.value[0]))) {
|
|
247
334
|
result[rule.id] = {
|
|
248
335
|
valid: false,
|
|
249
336
|
reasons: [RULES.EMPTY_RULE]
|
|
250
337
|
};
|
|
251
|
-
} else if (rule.id &&
|
|
338
|
+
} else if (rule.id && dataType === 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))) {
|
|
252
339
|
result[rule.id] = {
|
|
253
340
|
valid: false,
|
|
254
341
|
reasons: [RULES.EMPTY_RULE]
|
|
255
342
|
};
|
|
343
|
+
} else if (rule.id && dataType === DataType.COMBINATOR) {
|
|
344
|
+
const childrenFields = Object.keys(
|
|
345
|
+
getFieldData(rule.field).children ?? {}
|
|
346
|
+
);
|
|
347
|
+
const compositeGroup = rule.value;
|
|
348
|
+
childrenFields.forEach((field) => {
|
|
349
|
+
var _a2, _b2, _c2, _d2;
|
|
350
|
+
validateRule({
|
|
351
|
+
...rule,
|
|
352
|
+
field,
|
|
353
|
+
operator: (_b2 = (_a2 = compositeGroup == null ? void 0 : compositeGroup.rules) == null ? void 0 : _a2[field]) == null ? void 0 : _b2.operator,
|
|
354
|
+
value: (_d2 = (_c2 = compositeGroup == null ? void 0 : compositeGroup.rules) == null ? void 0 : _c2[field]) == null ? void 0 : _d2.value
|
|
355
|
+
});
|
|
356
|
+
});
|
|
256
357
|
}
|
|
257
358
|
};
|
|
258
359
|
const validateGroup = (ruleGroup) => {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
import { FullField } from 'react-querybuilder';
|
|
2
|
+
|
|
7
3
|
export declare enum OperatorType {
|
|
8
4
|
EQUALS = "EQUALS",
|
|
9
5
|
NOT_EQUALS = "NOT_EQUALS",
|
|
@@ -53,8 +49,11 @@ export declare enum FieldType {
|
|
|
53
49
|
SHUNT_COMPENSATOR_TYPE = "SHUNT_COMPENSATOR_TYPE",
|
|
54
50
|
CONNECTED = "CONNECTED",
|
|
55
51
|
MAX_Q_AT_NOMINAL_V = "MAX_Q_AT_NOMINAL_V",
|
|
52
|
+
MIN_Q_AT_NOMINAL_V = "MIN_Q_AT_NOMINAL_V",
|
|
53
|
+
FIX_Q_AT_NOMINAL_V = "FIX_Q_AT_NOMINAL_V",
|
|
56
54
|
SWITCHED_ON_Q_AT_NOMINAL_V = "SWITCHED_ON_Q_AT_NOMINAL_V",
|
|
57
55
|
MAX_SUSCEPTANCE = "MAX_SUSCEPTANCE",
|
|
56
|
+
MIN_SUSCEPTANCE = "MIN_SUSCEPTANCE",
|
|
58
57
|
SWITCHED_ON_SUSCEPTANCE = "SWITCHED_ON_SUSCEPTANCE",
|
|
59
58
|
CONNECTED_1 = "CONNECTED_1",
|
|
60
59
|
CONNECTED_2 = "CONNECTED_2",
|
|
@@ -90,7 +89,20 @@ export declare enum FieldType {
|
|
|
90
89
|
SUBSTATION_PROPERTY_2 = "SUBSTATION_PROPERTIES_2",
|
|
91
90
|
VOLTAGE_LEVEL_PROPERTY = "VOLTAGE_LEVEL_PROPERTIES",
|
|
92
91
|
VOLTAGE_LEVEL_PROPERTY_1 = "VOLTAGE_LEVEL_PROPERTIES_1",
|
|
93
|
-
VOLTAGE_LEVEL_PROPERTY_2 = "VOLTAGE_LEVEL_PROPERTIES_2"
|
|
92
|
+
VOLTAGE_LEVEL_PROPERTY_2 = "VOLTAGE_LEVEL_PROPERTIES_2",
|
|
93
|
+
SVAR_REGULATION_MODE = "SVAR_REGULATION_MODE",
|
|
94
|
+
VOLTAGE_SET_POINT = "VOLTAGE_SET_POINT",
|
|
95
|
+
REACTIVE_POWER_SET_POINT = "REACTIVE_POWER_SET_POINT",
|
|
96
|
+
REMOTE_REGULATED_TERMINAL = "REMOTE_REGULATED_TERMINAL",
|
|
97
|
+
REGULATING_TERMINAL_VL_ID = "REGULATING_TERMINAL_VL_ID",
|
|
98
|
+
REGULATING_TERMINAL_CONNECTABLE_ID = "REGULATING_TERMINAL_CONNECTABLE_ID",
|
|
99
|
+
REGULATION_TYPE = "REGULATION_TYPE",
|
|
100
|
+
AUTOMATE = "AUTOMATE",
|
|
101
|
+
LOW_VOLTAGE_SET_POINT = "LOW_VOLTAGE_SET_POINT",
|
|
102
|
+
HIGH_VOLTAGE_SET_POINT = "HIGH_VOLTAGE_SET_POINT",
|
|
103
|
+
LOW_VOLTAGE_THRESHOLD = "LOW_VOLTAGE_THRESHOLD",
|
|
104
|
+
HIGH_VOLTAGE_THRESHOLD = "HIGH_VOLTAGE_THRESHOLD",
|
|
105
|
+
SUSCEPTANCE_FIX = "SUSCEPTANCE_FIX"
|
|
94
106
|
}
|
|
95
107
|
export declare enum DataType {
|
|
96
108
|
STRING = "STRING",
|
|
@@ -101,6 +113,11 @@ export declare enum DataType {
|
|
|
101
113
|
FILTER_UUID = "FILTER_UUID",
|
|
102
114
|
PROPERTY = "PROPERTIES"
|
|
103
115
|
}
|
|
116
|
+
export type OperatorOption = {
|
|
117
|
+
name: string;
|
|
118
|
+
customName: string;
|
|
119
|
+
label: string;
|
|
120
|
+
};
|
|
104
121
|
export interface RuleTypeExport {
|
|
105
122
|
field: FieldType;
|
|
106
123
|
operator: OperatorType;
|
|
@@ -113,5 +130,23 @@ export interface RuleTypeExport {
|
|
|
113
130
|
export interface RuleGroupTypeExport {
|
|
114
131
|
combinator: CombinatorType;
|
|
115
132
|
dataType: DataType;
|
|
133
|
+
field?: FieldType;
|
|
134
|
+
operator?: OperatorType;
|
|
116
135
|
rules: (RuleTypeExport | RuleGroupTypeExport)[];
|
|
117
136
|
}
|
|
137
|
+
export interface CompositeField extends FullField {
|
|
138
|
+
combinator?: string;
|
|
139
|
+
children?: {
|
|
140
|
+
[field: string]: FullField;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export interface CompositeGroup {
|
|
144
|
+
combinator: string;
|
|
145
|
+
rules: {
|
|
146
|
+
[field: string]: CompositeRule;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
export interface CompositeRule {
|
|
150
|
+
operator: string;
|
|
151
|
+
value: any;
|
|
152
|
+
}
|
|
@@ -49,8 +49,11 @@ var FieldType = /* @__PURE__ */ ((FieldType2) => {
|
|
|
49
49
|
FieldType2["SHUNT_COMPENSATOR_TYPE"] = "SHUNT_COMPENSATOR_TYPE";
|
|
50
50
|
FieldType2["CONNECTED"] = "CONNECTED";
|
|
51
51
|
FieldType2["MAX_Q_AT_NOMINAL_V"] = "MAX_Q_AT_NOMINAL_V";
|
|
52
|
+
FieldType2["MIN_Q_AT_NOMINAL_V"] = "MIN_Q_AT_NOMINAL_V";
|
|
53
|
+
FieldType2["FIX_Q_AT_NOMINAL_V"] = "FIX_Q_AT_NOMINAL_V";
|
|
52
54
|
FieldType2["SWITCHED_ON_Q_AT_NOMINAL_V"] = "SWITCHED_ON_Q_AT_NOMINAL_V";
|
|
53
55
|
FieldType2["MAX_SUSCEPTANCE"] = "MAX_SUSCEPTANCE";
|
|
56
|
+
FieldType2["MIN_SUSCEPTANCE"] = "MIN_SUSCEPTANCE";
|
|
54
57
|
FieldType2["SWITCHED_ON_SUSCEPTANCE"] = "SWITCHED_ON_SUSCEPTANCE";
|
|
55
58
|
FieldType2["CONNECTED_1"] = "CONNECTED_1";
|
|
56
59
|
FieldType2["CONNECTED_2"] = "CONNECTED_2";
|
|
@@ -87,6 +90,19 @@ var FieldType = /* @__PURE__ */ ((FieldType2) => {
|
|
|
87
90
|
FieldType2["VOLTAGE_LEVEL_PROPERTY"] = "VOLTAGE_LEVEL_PROPERTIES";
|
|
88
91
|
FieldType2["VOLTAGE_LEVEL_PROPERTY_1"] = "VOLTAGE_LEVEL_PROPERTIES_1";
|
|
89
92
|
FieldType2["VOLTAGE_LEVEL_PROPERTY_2"] = "VOLTAGE_LEVEL_PROPERTIES_2";
|
|
93
|
+
FieldType2["SVAR_REGULATION_MODE"] = "SVAR_REGULATION_MODE";
|
|
94
|
+
FieldType2["VOLTAGE_SET_POINT"] = "VOLTAGE_SET_POINT";
|
|
95
|
+
FieldType2["REACTIVE_POWER_SET_POINT"] = "REACTIVE_POWER_SET_POINT";
|
|
96
|
+
FieldType2["REMOTE_REGULATED_TERMINAL"] = "REMOTE_REGULATED_TERMINAL";
|
|
97
|
+
FieldType2["REGULATING_TERMINAL_VL_ID"] = "REGULATING_TERMINAL_VL_ID";
|
|
98
|
+
FieldType2["REGULATING_TERMINAL_CONNECTABLE_ID"] = "REGULATING_TERMINAL_CONNECTABLE_ID";
|
|
99
|
+
FieldType2["REGULATION_TYPE"] = "REGULATION_TYPE";
|
|
100
|
+
FieldType2["AUTOMATE"] = "AUTOMATE";
|
|
101
|
+
FieldType2["LOW_VOLTAGE_SET_POINT"] = "LOW_VOLTAGE_SET_POINT";
|
|
102
|
+
FieldType2["HIGH_VOLTAGE_SET_POINT"] = "HIGH_VOLTAGE_SET_POINT";
|
|
103
|
+
FieldType2["LOW_VOLTAGE_THRESHOLD"] = "LOW_VOLTAGE_THRESHOLD";
|
|
104
|
+
FieldType2["HIGH_VOLTAGE_THRESHOLD"] = "HIGH_VOLTAGE_THRESHOLD";
|
|
105
|
+
FieldType2["SUSCEPTANCE_FIX"] = "SUSCEPTANCE_FIX";
|
|
90
106
|
return FieldType2;
|
|
91
107
|
})(FieldType || {});
|
|
92
108
|
var DataType = /* @__PURE__ */ ((DataType2) => {
|
|
@@ -7,7 +7,7 @@ import "@hookform/resolvers/yup";
|
|
|
7
7
|
import "../../../hooks/useSnackMessage.js";
|
|
8
8
|
import "../../dialogs/custom-mui-dialog.js";
|
|
9
9
|
import "../../../utils/yup-config.js";
|
|
10
|
-
import { a } from "../../../chunks/criteria-based-filter-edition-dialog.
|
|
10
|
+
import { a } from "../../../chunks/criteria-based-filter-edition-dialog.g-QT74FD.js";
|
|
11
11
|
import "../../../utils/field-constants.js";
|
|
12
12
|
import "uuid";
|
|
13
13
|
import "../../../utils/equipment-types.js";
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import "../../../utils/field-constants.js";
|
|
4
4
|
import "../../../utils/yup-config.js";
|
|
5
|
-
import { d, f, e, g } from "../../../chunks/criteria-based-filter-edition-dialog.
|
|
5
|
+
import { d, f, e, g } from "../../../chunks/criteria-based-filter-edition-dialog.g-QT74FD.js";
|
|
6
6
|
import "react-intl";
|
|
7
7
|
import "react-hook-form";
|
|
8
8
|
import "@mui/material/Grid";
|
|
@@ -5,7 +5,7 @@ import "react-hook-form";
|
|
|
5
5
|
import "../../hooks/useSnackMessage.js";
|
|
6
6
|
import "../dialogs/custom-mui-dialog.js";
|
|
7
7
|
import "./criteria-based/criteria-based-filter-form.js";
|
|
8
|
-
import { F } from "../../chunks/criteria-based-filter-edition-dialog.
|
|
8
|
+
import { F } from "../../chunks/criteria-based-filter-edition-dialog.g-QT74FD.js";
|
|
9
9
|
import "../../utils/field-constants.js";
|
|
10
10
|
import "../../utils/yup-config.js";
|
|
11
11
|
import "@hookform/resolvers/yup";
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "../inputs/react-hook-form/unique-name-input.js";
|
|
3
3
|
import "../../utils/field-constants.js";
|
|
4
4
|
import "./criteria-based/criteria-based-filter-form.js";
|
|
5
|
-
import { o } from "../../chunks/criteria-based-filter-edition-dialog.
|
|
5
|
+
import { o } from "../../chunks/criteria-based-filter-edition-dialog.g-QT74FD.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import "react-hook-form";
|
|
8
8
|
import "@mui/material";
|
|
@@ -4,7 +4,7 @@ import "@mui/material/IconButton";
|
|
|
4
4
|
import "@mui/icons-material";
|
|
5
5
|
import "@mui/icons-material/ControlPoint";
|
|
6
6
|
import "@mui/icons-material/Delete";
|
|
7
|
-
import { B } from "../../../../chunks/criteria-based-filter-edition-dialog.
|
|
7
|
+
import { B } from "../../../../chunks/criteria-based-filter-edition-dialog.g-QT74FD.js";
|
|
8
8
|
import "react";
|
|
9
9
|
import "react-intl";
|
|
10
10
|
import "@mui/material/styles";
|
|
@@ -34,7 +34,7 @@ import "../../../../dialogs/description-modification-dialog.js";
|
|
|
34
34
|
import "../../../../../utils/field-constants.js";
|
|
35
35
|
import "yup";
|
|
36
36
|
import "../../../../dialogs/popup-confirmation-dialog.js";
|
|
37
|
-
import { c } from "../../../../../chunks/criteria-based-filter-edition-dialog.
|
|
37
|
+
import { c } from "../../../../../chunks/criteria-based-filter-edition-dialog.g-QT74FD.js";
|
|
38
38
|
import "ag-grid-react";
|
|
39
39
|
import "ag-grid-community/styles/ag-grid.css";
|
|
40
40
|
import "ag-grid-community/styles/ag-theme-alpine.css";
|
|
@@ -57,6 +57,7 @@ import "@mui/icons-material/Check";
|
|
|
57
57
|
import "@mui/material/CircularProgress";
|
|
58
58
|
import "@mui/material/TextField";
|
|
59
59
|
import "../../../../filter/utils/filter-form-utils.js";
|
|
60
|
+
import "papaparse";
|
|
60
61
|
export {
|
|
61
62
|
c as default
|
|
62
63
|
};
|
|
@@ -5,7 +5,7 @@ import "ag-grid-react";
|
|
|
5
5
|
import "ag-grid-community/styles/ag-grid.css";
|
|
6
6
|
import "ag-grid-community/styles/ag-theme-alpine.css";
|
|
7
7
|
import "@mui/material";
|
|
8
|
-
import { C, R, C as C2 } from "../../../../chunks/criteria-based-filter-edition-dialog.
|
|
8
|
+
import { C, R, C as C2 } from "../../../../chunks/criteria-based-filter-edition-dialog.g-QT74FD.js";
|
|
9
9
|
import "react-intl";
|
|
10
10
|
import "../../../../utils/field-constants.js";
|
|
11
11
|
export {
|
|
@@ -139,7 +139,7 @@ const DirectoryItemsInput = ({
|
|
|
139
139
|
const chip = (_a = chips.at(index)) == null ? void 0 : _a.id;
|
|
140
140
|
if (chip) {
|
|
141
141
|
fetchDirectoryElementPath(chip).then((response) => {
|
|
142
|
-
const path = response.
|
|
142
|
+
const path = response.filter((e) => e.elementUuid !== chip).map((e) => e.elementUuid);
|
|
143
143
|
setExpanded(path);
|
|
144
144
|
setSelected([chip]);
|
|
145
145
|
setDirectoryItemSelectorOpen(true);
|
|
@@ -6,6 +6,7 @@ const ErrorInput = ({
|
|
|
6
6
|
name,
|
|
7
7
|
InputField
|
|
8
8
|
}) => {
|
|
9
|
+
var _a;
|
|
9
10
|
const {
|
|
10
11
|
fieldState: { error },
|
|
11
12
|
formState: { isSubmitting }
|
|
@@ -13,16 +14,16 @@ const ErrorInput = ({
|
|
|
13
14
|
name
|
|
14
15
|
});
|
|
15
16
|
const errorRef = useRef(null);
|
|
16
|
-
const errorProps = (
|
|
17
|
-
if (typeof
|
|
17
|
+
const errorProps = (errorMsg2) => {
|
|
18
|
+
if (typeof errorMsg2 === "string") {
|
|
18
19
|
return {
|
|
19
|
-
id:
|
|
20
|
+
id: errorMsg2
|
|
20
21
|
};
|
|
21
|
-
} else if (typeof
|
|
22
|
+
} else if (typeof errorMsg2 === "object") {
|
|
22
23
|
return {
|
|
23
|
-
id:
|
|
24
|
+
id: errorMsg2.id,
|
|
24
25
|
values: {
|
|
25
|
-
value:
|
|
26
|
+
value: errorMsg2.value
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
29
|
}
|
|
@@ -33,8 +34,9 @@ const ErrorInput = ({
|
|
|
33
34
|
errorRef.current.scrollIntoView({ behavior: "smooth" });
|
|
34
35
|
}
|
|
35
36
|
}, [isSubmitting]);
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
const errorMsg = (error == null ? void 0 : error.message) || ((_a = error == null ? void 0 : error.root) == null ? void 0 : _a.message);
|
|
38
|
+
return /* @__PURE__ */ jsx(Fragment, { children: errorMsg && /* @__PURE__ */ jsx("div", { ref: errorRef, children: InputField({
|
|
39
|
+
message: /* @__PURE__ */ jsx(FormattedMessage, { ...errorProps(errorMsg) })
|
|
38
40
|
}) }) });
|
|
39
41
|
};
|
|
40
42
|
export {
|
package/dist/components/inputs/react-query-builder/composite-rule-editor/group-value-editor.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CompositeField } from '../../../filter/expert/expert-filter.type';
|
|
2
|
+
import { ValueEditorProps } from 'react-querybuilder';
|
|
3
|
+
|
|
4
|
+
declare const GroupValueEditor: (props: ValueEditorProps<CompositeField>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default GroupValueEditor;
|
package/dist/components/inputs/react-query-builder/composite-rule-editor/group-value-editor.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, createElement } from "react";
|
|
3
|
+
import { Grid } from "@mui/material";
|
|
4
|
+
import RuleValueEditor from "./rule-value-editor.js";
|
|
5
|
+
const styles = {
|
|
6
|
+
group: (theme) => ({
|
|
7
|
+
border: 1,
|
|
8
|
+
borderRadius: 1,
|
|
9
|
+
borderColor: theme.palette.grey[500]
|
|
10
|
+
})
|
|
11
|
+
};
|
|
12
|
+
const GroupValueEditor = (props) => {
|
|
13
|
+
const {
|
|
14
|
+
fieldData: { combinator, children },
|
|
15
|
+
value,
|
|
16
|
+
handleOnChange
|
|
17
|
+
} = props;
|
|
18
|
+
const generateOnChangeRuleHandler = useCallback(
|
|
19
|
+
(field) => (rule) => {
|
|
20
|
+
const compositeGroup = {
|
|
21
|
+
...value,
|
|
22
|
+
combinator,
|
|
23
|
+
rules: {
|
|
24
|
+
...value == null ? void 0 : value.rules,
|
|
25
|
+
[field]: rule
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
handleOnChange(compositeGroup);
|
|
29
|
+
},
|
|
30
|
+
[handleOnChange, combinator, value]
|
|
31
|
+
);
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
Grid,
|
|
34
|
+
{
|
|
35
|
+
container: true,
|
|
36
|
+
direction: "column",
|
|
37
|
+
sx: styles.group,
|
|
38
|
+
paddingLeft: 1,
|
|
39
|
+
paddingRight: 1,
|
|
40
|
+
paddingBottom: 1,
|
|
41
|
+
children: children && Object.values(children).map((fieldData) => {
|
|
42
|
+
var _a;
|
|
43
|
+
return /* @__PURE__ */ createElement(
|
|
44
|
+
RuleValueEditor,
|
|
45
|
+
{
|
|
46
|
+
...props,
|
|
47
|
+
key: fieldData.name,
|
|
48
|
+
field: fieldData.name,
|
|
49
|
+
fieldData,
|
|
50
|
+
rule: (_a = value == null ? void 0 : value.rules) == null ? void 0 : _a[fieldData.name],
|
|
51
|
+
handleOnChangeRule: generateOnChangeRuleHandler(
|
|
52
|
+
fieldData.name
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
GroupValueEditor as default
|
|
62
|
+
};
|
package/dist/components/inputs/react-query-builder/composite-rule-editor/rule-value-editor.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CompositeRule } from '../../../filter/expert/expert-filter.type';
|
|
2
|
+
import { ValueEditorProps } from 'react-querybuilder';
|
|
3
|
+
|
|
4
|
+
type RuleValueEditorProps = ValueEditorProps & {
|
|
5
|
+
rule?: CompositeRule;
|
|
6
|
+
handleOnChangeRule: (rule: CompositeRule) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const RuleValueEditor: (props: RuleValueEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default RuleValueEditor;
|