Browse Source

chore(gui): lint

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3370/head
Pranav C 2 years ago
parent
commit
20a9f3eef6
  1. 2
      packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue
  2. 9
      packages/nc-gui/composables/useViewFilters.ts
  3. 10
      packages/nc-gui/composables/useViewSorts.ts

2
packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue

@ -87,7 +87,7 @@ watch(
() => activeView.value?.id, () => activeView.value?.id,
(n, o) => { (n, o) => {
if (!nested && n !== o && (hookId || !webHook)) loadFilters(hookId as string) if (!nested && n !== o && (hookId || !webHook)) loadFilters(hookId as string)
} },
) )
loadFilters(hookId as string) loadFilters(hookId as string)

9
packages/nc-gui/composables/useViewFilters.ts

@ -13,9 +13,8 @@ import {
useUIPermission, useUIPermission,
watch, watch,
} from '#imports' } from '#imports'
import type { TabItem } from '~/composables/useTabs'
import { TabMetaInj } from '~/context' import { TabMetaInj } from '~/context'
import type { Filter } from '~/lib' import type { Filter, TabItem } from '~/lib'
export function useViewFilters( export function useViewFilters(
view: Ref<ViewType | undefined>, view: Ref<ViewType | undefined>,
@ -53,7 +52,7 @@ export function useViewFilters(
currentFilters = value currentFilters = value
if (isNestedRoot) { if (isNestedRoot) {
nestedFilters.value = value nestedFilters.value = value
tabMeta.value.filterState!.set(view!.value.id!, nestedFilters.value) tabMeta.value.filterState!.set(view.value!.id!, nestedFilters.value)
} }
nestedFilters.value = [...nestedFilters.value] nestedFilters.value = [...nestedFilters.value]
reloadHook?.trigger() reloadHook?.trigger()
@ -77,8 +76,8 @@ export function useViewFilters(
const loadFilters = async (hookId?: string) => { const loadFilters = async (hookId?: string) => {
if (nestedMode.value) { if (nestedMode.value) {
if (isNestedRoot) // ignore restoring if not root filter group
filters.value = tabMeta.value.filterState!.get(view.value.id!) || [] if (isNestedRoot) filters.value = tabMeta.value.filterState!.get(view.value!.id!) || []
return return
} }

10
packages/nc-gui/composables/useViewSorts.ts

@ -13,7 +13,7 @@ import {
useSmartsheetStoreOrThrow, useSmartsheetStoreOrThrow,
useUIPermission, useUIPermission,
} from '#imports' } from '#imports'
import { TabItem } from '~/lib' import type { TabItem } from '~/lib'
export function useViewSorts(view: Ref<ViewType | undefined>, reloadData?: () => void) { export function useViewSorts(view: Ref<ViewType | undefined>, reloadData?: () => void) {
const { sharedView } = useSharedView() const { sharedView } = useSharedView()
@ -42,7 +42,7 @@ export function useViewSorts(view: Ref<ViewType | undefined>, reloadData?: () =>
try { try {
if (!isUIAllowed('sortSync')) { if (!isUIAllowed('sortSync')) {
const sortsBackup = tabMeta.value.sortsState.get(view.value.id!) const sortsBackup = tabMeta.value.sortsState!.get(view.value!.id!)
if (sortsBackup) { if (sortsBackup) {
sorts.value = sortsBackup sorts.value = sortsBackup
return return
@ -61,7 +61,7 @@ export function useViewSorts(view: Ref<ViewType | undefined>, reloadData?: () =>
sorts.value[i] = sort sorts.value[i] = sort
sorts.value = [...sorts.value] sorts.value = [...sorts.value]
reloadHook?.trigger() reloadHook?.trigger()
tabMeta.value.sortsState.set(view.value.id!, sorts.value) tabMeta.value.sortsState!.set(view.value!.id!, sorts.value)
return return
} }
@ -91,7 +91,7 @@ export function useViewSorts(view: Ref<ViewType | undefined>, reloadData?: () =>
$e('a:sort:add', { length: sorts?.value?.length }) $e('a:sort:add', { length: sorts?.value?.length })
tabMeta.value.sortsState.set(view.value.id!, sorts.value) tabMeta.value.sortsState!.set(view.value!.id!, sorts.value)
} }
const deleteSort = async (sort: SortType, i: number) => { const deleteSort = async (sort: SortType, i: number) => {
@ -102,7 +102,7 @@ export function useViewSorts(view: Ref<ViewType | undefined>, reloadData?: () =>
sorts.value.splice(i, 1) sorts.value.splice(i, 1)
sorts.value = [...sorts.value] sorts.value = [...sorts.value]
tabMeta.value.sortsState.set(view.value.id!, sorts.value) tabMeta.value.sortsState!.set(view.value!.id!, sorts.value)
reloadHook?.trigger() reloadHook?.trigger()
$e('a:sort:delete') $e('a:sort:delete')

Loading…
Cancel
Save