Browse Source

fix(gui-v2): isAnyFieldHidden indicator

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/3268/head
mertmit 2 years ago
parent
commit
e82fa79658
  1. 26
      packages/nc-gui-v2/composables/useViewColumns.ts

26
packages/nc-gui-v2/composables/useViewColumns.ts

@ -23,6 +23,18 @@ export function useViewColumns(view: Ref<ViewType> | undefined, meta: ComputedRe
() => isPublic.value || !isUIAllowed('hideAllColumns') || !isUIAllowed('showAllColumns') || isSharedBase.value, () => isPublic.value || !isUIAllowed('hideAllColumns') || !isUIAllowed('showAllColumns') || isSharedBase.value,
) )
const metaColumnById = computed<Record<string, ColumnType>>(() => {
if (!meta.value?.columns) return {}
return meta.value?.columns?.reduce(
(acc: ColumnType, curr: ColumnType) => ({
...acc,
[curr.id!]: curr,
}),
{} as any,
)
})
const loadViewColumns = async () => { const loadViewColumns = async () => {
if (!meta || !view) return if (!meta || !view) return
@ -48,7 +60,7 @@ export function useViewColumns(view: Ref<ViewType> | undefined, meta: ComputedRe
fk_column_id: column.id, fk_column_id: column.id,
...currentColumnField, ...currentColumnField,
order: currentColumnField.order || order++, order: currentColumnField.order || order++,
system: isSystemColumn(currentColumnField.type || false), system: isSystemColumn(metaColumnById?.value?.[currentColumnField.fk_column_id!]),
} }
}) })
.sort((a: Field, b: Field) => a.order - b.order) .sort((a: Field, b: Field) => a.order - b.order)
@ -129,18 +141,6 @@ export function useViewColumns(view: Ref<ViewType> | undefined, meta: ComputedRe
reloadData?.() reloadData?.()
} }
const metaColumnById = computed<Record<string, ColumnType>>(() => {
if (!meta.value?.columns) return {}
return meta.value?.columns?.reduce(
(acc: ColumnType, curr: ColumnType) => ({
...acc,
[curr.id!]: curr,
}),
{} as any,
)
})
const showSystemFields = computed({ const showSystemFields = computed({
get() { get() {
// todo: show_system_fields missing from ViewType // todo: show_system_fields missing from ViewType

Loading…
Cancel
Save