feat(Data Table Node): Add isEmpty and isNotEmpty operations (no-changelog) (#19046)

This commit is contained in:
Daria
2025-09-01 14:41:49 +03:00
committed by GitHub
parent 5bcff78174
commit b527edb5f8
5 changed files with 148 additions and 24 deletions

View File

@@ -72,7 +72,7 @@ export async function getDataTableAggregateProxy(
export function isFieldEntry(obj: unknown): obj is FieldEntry {
if (obj === null || typeof obj !== 'object') return false;
return 'keyName' in obj && 'condition' in obj && 'keyValue' in obj;
return 'keyName' in obj && 'condition' in obj; // keyValue is optional
}
export function isMatchType(obj: unknown): obj is FilterType {
@@ -83,11 +83,28 @@ export function buildGetManyFilter(
fieldEntries: FieldEntry[],
matchType: FilterType,
): ListDataStoreContentFilter {
const filters = fieldEntries.map((x) => ({
columnName: x.keyName,
condition: x.condition,
value: x.keyValue,
}));
const filters = fieldEntries.map((x) => {
switch (x.condition) {
case 'isEmpty':
return {
columnName: x.keyName,
condition: 'eq' as const,
value: null,
};
case 'isNotEmpty':
return {
columnName: x.keyName,
condition: 'neq' as const,
value: null,
};
default:
return {
columnName: x.keyName,
condition: x.condition,
value: x.keyValue,
};
}
});
return { type: matchType === 'allFilters' ? 'and' : 'or', filters };
}