mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 06:25:29 +00:00
fix: isBlank for hm lookup
This commit is contained in:
@@ -282,6 +282,18 @@ export async function validateCondition(
|
|||||||
res = false; // Unsupported operation for User fields
|
res = false; // Unsupported operation for User fields
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
const isBlank = (dataValue: any) => {
|
||||||
|
if (
|
||||||
|
dataValue === '' ||
|
||||||
|
dataValue === null ||
|
||||||
|
dataValue === undefined
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
} else if (Array.isArray(dataValue)) {
|
||||||
|
return dataValue.filter((v) => !isBlank(v)).length === 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
switch (filter.comparison_op) {
|
switch (filter.comparison_op) {
|
||||||
case 'eq':
|
case 'eq':
|
||||||
res = val == filter.value;
|
res = val == filter.value;
|
||||||
@@ -305,18 +317,11 @@ export async function validateCondition(
|
|||||||
break;
|
break;
|
||||||
case 'empty':
|
case 'empty':
|
||||||
case 'blank':
|
case 'blank':
|
||||||
res =
|
res = isBlank(data[field]);
|
||||||
data[field] === '' ||
|
|
||||||
data[field] === null ||
|
|
||||||
data[field] === undefined;
|
|
||||||
break;
|
break;
|
||||||
case 'notempty':
|
case 'notempty':
|
||||||
case 'notblank':
|
case 'notblank':
|
||||||
res = !(
|
res = !isBlank(data[field]);
|
||||||
data[field] === '' ||
|
|
||||||
data[field] === null ||
|
|
||||||
data[field] === undefined
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case 'checked':
|
case 'checked':
|
||||||
res = !!data[field];
|
res = !!data[field];
|
||||||
|
|||||||
Reference in New Issue
Block a user