From 30bafbb4392f47374b49722eaa2cbc7be7d96513 Mon Sep 17 00:00:00 2001 From: amandesai01 Date: Tue, 26 Nov 2024 07:35:21 +0000 Subject: [PATCH] fix(extensions): org chart: reuse isValidValue --- packages/nc-gui/utils/dataUtils.ts | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/packages/nc-gui/utils/dataUtils.ts b/packages/nc-gui/utils/dataUtils.ts index b5dc9986bb..dbdd9c0f58 100644 --- a/packages/nc-gui/utils/dataUtils.ts +++ b/packages/nc-gui/utils/dataUtils.ts @@ -140,23 +140,17 @@ export const rowDefaultData = (columns: ColumnType[] = []) => { return defaultData } -export const isRowEmpty = (record: Row, col: ColumnType) => { - if (!record || !col) return true +export const isRowEmpty = (record: Row, col: ColumnType): boolean => { + if (!record || !col || !col.title) return true; - const val = record.row[col.title!] - if (val === null || val === undefined || val === '') return true + return !isValidValue(record.row[col.title]); +}; - return Array.isArray(val) && val.length === 0 -} - -export const isRowRecordEmpty = (record: Record, col: ColumnType) => { - if (!record || !col) return true +export const isRowRecordEmpty = (record: Record, col: ColumnType): boolean => { + if (!record || !col || !col.title) return true; - const val = record[col.title!] - if (val === null || val === undefined || val === '') return true - - return Array.isArray(val) && val.length === 0 -} + return !isValidValue(record[col.title]); +}; export function validateRowFilters(_filters: FilterType[], data: any, columns: ColumnType[], client: any) { if (!_filters.length) {