@evoke-platform/ui-components 1.0.0-dev.252 → 1.0.0-dev.254
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.
@@ -173,6 +173,9 @@ const customSelector = (props) => {
|
|
173
173
|
else if (inputType === 'string' && isArray(props.fieldData?.values)) {
|
174
174
|
opts = options.filter((option) => ['in', 'notIn', '=', '!=', 'notNull', 'null'].includes(option.name));
|
175
175
|
}
|
176
|
+
else if (inputType === 'string') {
|
177
|
+
opts = options.filter((option) => !['>', '<', '<=', '>='].includes(option.name));
|
178
|
+
}
|
176
179
|
break;
|
177
180
|
case 'Fields':
|
178
181
|
placeholder = 'Select Property';
|
@@ -328,26 +331,8 @@ const CriteriaBuilder = (props) => {
|
|
328
331
|
const handleQueryChange = (q) => {
|
329
332
|
setQuery(q);
|
330
333
|
const newCriteria = JSON.parse(formatQuery(q, 'mongodb'));
|
331
|
-
//Filters out the empty rules
|
332
|
-
const filterEmptyRules = (newCriteria) => {
|
333
|
-
let updatedCriteria;
|
334
|
-
Object.keys(newCriteria).forEach((key) => {
|
335
|
-
updatedCriteria = newCriteria[key];
|
336
|
-
if (key === '$and' || key === '$or') {
|
337
|
-
if (Array.isArray(updatedCriteria)) {
|
338
|
-
newCriteria[key] = updatedCriteria.filter((query) => !isEmpty(difference(query, { $and: [{ $expr: true }] })));
|
339
|
-
}
|
340
|
-
}
|
341
|
-
//If it is an object filter there may be a nested rule
|
342
|
-
if (typeof updatedCriteria === 'object') {
|
343
|
-
filterEmptyRules(updatedCriteria);
|
344
|
-
}
|
345
|
-
});
|
346
|
-
return newCriteria;
|
347
|
-
};
|
348
|
-
const filteredCriteria = filterEmptyRules(newCriteria);
|
349
334
|
//when q has no rules, it formats and parses to { $and: [{ $expr: true }] }
|
350
|
-
const allRulesDeleted = isEmpty(difference(
|
335
|
+
const allRulesDeleted = isEmpty(difference(newCriteria, { $and: [{ $expr: true }] }));
|
351
336
|
// since the Add Condition / Add Group buttons add rules with all the fields empty,
|
352
337
|
// we need to check if the first rule was added because q will still parse to { $and: [{ $expr: true }] }
|
353
338
|
const firstRuleAdded = isEmpty(criteria) && q.rules.length > 0;
|
@@ -196,6 +196,17 @@ CriteriaBuilder.args = {
|
|
196
196
|
{
|
197
197
|
name: { $in: ['Jane', 'John', 'Jack'] },
|
198
198
|
},
|
199
|
+
{
|
200
|
+
//TODO: the fix in CDR-2082 should allow for a preexisting configuration like below to show greater than on the UI
|
201
|
+
licenseeName: {
|
202
|
+
$gt: 'k',
|
203
|
+
},
|
204
|
+
},
|
205
|
+
{
|
206
|
+
amountOfInspections: {
|
207
|
+
$lt: 3,
|
208
|
+
},
|
209
|
+
},
|
199
210
|
{
|
200
211
|
licensedFor: { $in: ['hot dogs', 'amusements', 'entertainment'] },
|
201
212
|
},
|
@@ -843,6 +854,11 @@ CriteriaBuilderRelatedObject.args = {
|
|
843
854
|
$regex: '410',
|
844
855
|
},
|
845
856
|
},
|
857
|
+
{
|
858
|
+
'applicant.license.person.email': {
|
859
|
+
$regex: '^k',
|
860
|
+
},
|
861
|
+
},
|
846
862
|
{
|
847
863
|
$or: [
|
848
864
|
{
|