Nc org chart extension (#9860)

* feat(extensions): org chart: working nodes and edges

* fix(extensions): org chart: auto select active view

* fix(extensions): org chart: reuse isValidValue

* fix(extensions): org chart: typing and linting

* fix(extensions): org chart: fix edge case

---------

Co-authored-by: amandesai01 <amandesai01@gmail.com>
This commit is contained in:
Raju Udava
2024-12-02 10:57:06 +05:30
committed by GitHub
parent d10a04d4c6
commit 8d6396d43b
5 changed files with 9 additions and 10 deletions

View File

@@ -2,7 +2,6 @@ import { RelationTypes, UITypes, buildFilterTree, isDateMonthFormat, isSystemCol
import type { ColumnType, FilterType, LinkToAnotherRecordType, TableType } from 'nocodb-sdk'
import dayjs from 'dayjs'
import { isColumnRequiredAndNull } from './columnUtils'
import type { Row } from '~/lib/types'
export const isValidValue = (val: unknown) => {
if (ncIsNull(val) || ncIsUndefined(val)) {
@@ -141,13 +140,10 @@ export const rowDefaultData = (columns: ColumnType[] = []) => {
return defaultData
}
export const isRowEmpty = (record: any, col: any) => {
if (!record || !col) return true
export const isRowEmpty = (record: Pick<Row, '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 Array.isArray(val) && val.length === 0
return !isValidValue(record.row[col.title])
}
export function validateRowFilters(_filters: FilterType[], data: any, columns: ColumnType[], client: any) {