|
|
@ -3,10 +3,7 @@ import { UITypes } from 'nocodb-sdk' |
|
|
|
import { computed, useGlobal, useMetas, useNuxtApp, useState } from '#imports' |
|
|
|
import { computed, useGlobal, useMetas, useNuxtApp, useState } from '#imports' |
|
|
|
|
|
|
|
|
|
|
|
export function useSharedView() { |
|
|
|
export function useSharedView() { |
|
|
|
const nestedFilters = useState<(FilterType & { status?: 'update' | 'delete' | 'create'; parentId?: string })[]>( |
|
|
|
const nestedFilters = ref<(FilterType & { status?: 'update' | 'delete' | 'create'; parentId?: string })[]>([]) |
|
|
|
'nestedFilters', |
|
|
|
|
|
|
|
() => [], |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { appInfo } = $(useGlobal()) |
|
|
|
const { appInfo } = $(useGlobal()) |
|
|
|
|
|
|
|
|
|
|
@ -16,7 +13,7 @@ export function useSharedView() { |
|
|
|
|
|
|
|
|
|
|
|
const sharedView = useState<ViewType | undefined>('sharedView', () => undefined) |
|
|
|
const sharedView = useState<ViewType | undefined>('sharedView', () => undefined) |
|
|
|
|
|
|
|
|
|
|
|
const sorts = useState<SortType[]>('sorts', () => []) |
|
|
|
const sorts = ref<SortType[]>([]) |
|
|
|
|
|
|
|
|
|
|
|
const password = useState<string | undefined>('password', () => undefined) |
|
|
|
const password = useState<string | undefined>('password', () => undefined) |
|
|
|
|
|
|
|
|
|
|
@ -64,7 +61,7 @@ export function useSharedView() { |
|
|
|
Object.keys(relatedMetas).forEach((key) => setMeta(relatedMetas[key])) |
|
|
|
Object.keys(relatedMetas).forEach((key) => setMeta(relatedMetas[key])) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const fetchSharedViewData = async () => { |
|
|
|
const fetchSharedViewData = async ({ sortsArr, filtersArr }: { sortsArr: SortType[]; filtersArr: FilterType[] }) => { |
|
|
|
if (!sharedView.value) return |
|
|
|
if (!sharedView.value) return |
|
|
|
|
|
|
|
|
|
|
|
const page = paginationData.value.page || 1 |
|
|
|
const page = paginationData.value.page || 1 |
|
|
@ -74,8 +71,8 @@ export function useSharedView() { |
|
|
|
sharedView.value.uuid!, |
|
|
|
sharedView.value.uuid!, |
|
|
|
{ |
|
|
|
{ |
|
|
|
offset: (page - 1) * pageSize, |
|
|
|
offset: (page - 1) * pageSize, |
|
|
|
filterArrJson: JSON.stringify(nestedFilters.value), |
|
|
|
filterArrJson: JSON.stringify(filtersArr ?? nestedFilters.value), |
|
|
|
sortArrJson: JSON.stringify(sorts.value), |
|
|
|
sortArrJson: JSON.stringify(sortsArr ?? sorts.value), |
|
|
|
} as any, |
|
|
|
} as any, |
|
|
|
{ |
|
|
|
{ |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|