|
|
@ -1,5 +1,5 @@ |
|
|
|
import { useStyleTag } from '@vueuse/core' |
|
|
|
import { useStyleTag } from '@vueuse/core' |
|
|
|
import type { ColumnType, GridColumnType, GridType } from 'nocodb-sdk' |
|
|
|
import type { ColumnType, GridColumnType, GridType, ViewType } from 'nocodb-sdk' |
|
|
|
import type { Ref } from 'vue' |
|
|
|
import type { Ref } from 'vue' |
|
|
|
import { useMetas } from './useMetas' |
|
|
|
import { useMetas } from './useMetas' |
|
|
|
import { useUIPermission } from './useUIPermission' |
|
|
|
import { useUIPermission } from './useUIPermission' |
|
|
@ -16,7 +16,7 @@ export function useGridViewColumnWidth(view: Ref<GridType | undefined>) { |
|
|
|
const resizingColWidth = ref('200px') |
|
|
|
const resizingColWidth = ref('200px') |
|
|
|
const isPublic = inject(IsPublicInj, ref(false)) |
|
|
|
const isPublic = inject(IsPublicInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
const columns = computed<ColumnType[]>(() => metas?.value?.[(view.value as any)?.fk_model_id as string]?.columns) |
|
|
|
const columns = computed<ColumnType[]>(() => metas.value?.[(view.value as ViewType)?.fk_model_id as string]?.columns || []) |
|
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
watch( |
|
|
|
[gridViewCols, resizingCol, resizingColWidth], |
|
|
|
[gridViewCols, resizingCol, resizingColWidth], |
|
|
@ -37,9 +37,10 @@ export function useGridViewColumnWidth(view: Ref<GridType | undefined>) { |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const loadGridViewColumns = async () => { |
|
|
|
const loadGridViewColumns = async () => { |
|
|
|
if ((!view.value || view.value?.id) && !isPublic.value) return |
|
|
|
if (!view.value?.id && !isPublic.value) return |
|
|
|
|
|
|
|
|
|
|
|
const colsData: GridColumnType[] = (isPublic.value ? columns.value : await $api.dbView.gridColumnsList(view.value!.id!)) ?? [] |
|
|
|
const colsData: GridColumnType[] = (isPublic.value ? columns.value : await $api.dbView.gridColumnsList(view.value!.id!) |
|
|
|
|
|
|
|
) ?? [] |
|
|
|
gridViewCols.value = colsData.reduce<Record<string, GridColumnType>>( |
|
|
|
gridViewCols.value = colsData.reduce<Record<string, GridColumnType>>( |
|
|
|
(o, col) => ({ |
|
|
|
(o, col) => ({ |
|
|
|
...o, |
|
|
|
...o, |
|
|
|