Browse Source

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>
pull/9936/head
Raju Udava 3 days ago committed by GitHub
parent
commit
8d6396d43b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      packages/nc-gui/components/cell/MultiSelect.vue
  2. 4
      packages/nc-gui/components/nc/Select.vue
  3. 2
      packages/nc-gui/composables/useExtensionHelper.ts
  4. 2
      packages/nc-gui/composables/useExtensions.ts
  5. 10
      packages/nc-gui/utils/dataUtils.ts

1
packages/nc-gui/components/cell/MultiSelect.vue

@ -280,7 +280,6 @@ async function addIfMissingAndSave() {
updatedColMeta, updatedColMeta,
) )
column.value.colOptions = data.columns.find((c) => c.id === column.value.id).colOptions column.value.colOptions = data.columns.find((c) => c.id === column.value.id).colOptions
activeOptCreateInProgress.value-- activeOptCreateInProgress.value--

4
packages/nc-gui/components/nc/Select.vue

@ -15,6 +15,7 @@ const props = withDefaults(
allowClear?: boolean allowClear?: boolean
loading?: boolean loading?: boolean
suffixIcon?: keyof typeof iconMap suffixIcon?: keyof typeof iconMap
maxTagCount?: number
}>(), }>(),
{ {
suffixIcon: 'arrowDown', suffixIcon: 'arrowDown',
@ -55,8 +56,9 @@ const onChange = (value: string) => {
:mode="mode" :mode="mode"
:placeholder="placeholder" :placeholder="placeholder"
:show-search="showSearch" :show-search="showSearch"
:max-tag-count="maxTagCount"
class="nc-select" class="nc-select"
@change="onChange" @change="onChange as any"
> >
<template #suffixIcon> <template #suffixIcon>
<GeneralLoader v-if="loading" /> <GeneralLoader v-if="loading" />

2
packages/nc-gui/composables/useExtensionHelper.ts

@ -29,6 +29,7 @@ const [useProvideExtensionHelper, useExtensionHelper] = useInjectionState(
const fullscreenModalSize = ref<keyof typeof modalSizes>(extensionManifest.value?.config?.modalSize || 'lg') const fullscreenModalSize = ref<keyof typeof modalSizes>(extensionManifest.value?.config?.modalSize || 'lg')
const activeTableId = computed(() => route.params.viewId as string | undefined) const activeTableId = computed(() => route.params.viewId as string | undefined)
const activeViewId = computed(() => route.params.viewTitle as string | undefined)
const collapsed = computed({ const collapsed = computed({
get: () => extension.value?.meta?.collapsed ?? false, get: () => extension.value?.meta?.collapsed ?? false,
@ -225,6 +226,7 @@ const [useProvideExtensionHelper, useExtensionHelper] = useInjectionState(
showExpandBtn, showExpandBtn,
fullscreenModalSize, fullscreenModalSize,
activeTableId, activeTableId,
activeViewId,
getViewsForTable, getViewsForTable,
getData, getData,
getTableMeta, getTableMeta,

2
packages/nc-gui/composables/useExtensions.ts

@ -447,7 +447,7 @@ export const useExtensions = createSharedComposable(() => {
if (availableExtensions.value.length + disabledCount === extensionCount) { if (availableExtensions.value.length + disabledCount === extensionCount) {
// Sort extensions // Sort extensions
availableExtensions.value.sort((a, b) => a.title.localeCompare(b.title)) availableExtensions.value.sort((a, b) => (a.order ?? Infinity) - (b.order ?? Infinity))
extensionsLoaded.value = true extensionsLoaded.value = true
} }
} catch (error) { } catch (error) {

10
packages/nc-gui/utils/dataUtils.ts

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

Loading…
Cancel
Save