Browse Source

chore(nc-gui): lint

pull/4099/head
braks 2 years ago
parent
commit
7744db0edc
  1. 2
      packages/nc-gui/composables/useMultiSelect/index.ts
  2. 3
      packages/nc-gui/composables/useViewData.ts
  3. 32
      packages/nc-gui/pages/[projectType]/form/[viewId]/index.vue

2
packages/nc-gui/composables/useMultiSelect/index.ts

@ -14,7 +14,7 @@ export function useMultiSelect(
fields: MaybeRef<any[]>, fields: MaybeRef<any[]>,
data: MaybeRef<any[]>, data: MaybeRef<any[]>,
editEnabled: MaybeRef<boolean>, editEnabled: MaybeRef<boolean>,
isPkAvail: MaybeRef<boolean>, isPkAvail: MaybeRef<boolean | undefined>,
clearCell: Function, clearCell: Function,
makeEditable: Function, makeEditable: Function,
scrollToActiveCell?: (row?: number | null, col?: number | null) => void, scrollToActiveCell?: (row?: number | null, col?: number | null) => void,

3
packages/nc-gui/composables/useViewData.ts

@ -202,7 +202,6 @@ export function useViewData(
async function insertRow( async function insertRow(
currentRow: Row, currentRow: Row,
_rowIndex = formattedData.value?.length,
ltarState: Record<string, any> = {}, ltarState: Record<string, any> = {},
{ metaValue = meta.value, viewMetaValue = viewMeta.value }: { metaValue?: TableType; viewMetaValue?: ViewType } = {}, { metaValue = meta.value, viewMetaValue = viewMeta.value }: { metaValue?: TableType; viewMetaValue?: ViewType } = {},
) { ) {
@ -301,7 +300,7 @@ export function useViewData(
await until(() => !(row.rowMeta?.new && row.rowMeta?.saving)).toMatch((v) => v) await until(() => !(row.rowMeta?.new && row.rowMeta?.saving)).toMatch((v) => v)
if (row.rowMeta.new) { if (row.rowMeta.new) {
return await insertRow(row, formattedData.value.indexOf(row), ltarState, args) return await insertRow(row, ltarState, args)
} else { } else {
await updateRowProperty(row, property!, args) await updateRowProperty(row, property!, args)
} }

32
packages/nc-gui/pages/[projectType]/form/[viewId]/index.vue

@ -1,39 +1,39 @@
<script setup lang="ts"> <script setup lang="ts">
import { navigateTo, useDark, useRoute, useRouter, useSharedFormStoreOrThrow, useTheme, watch } from "#imports"; import { navigateTo, useDark, useRoute, useRouter, useSharedFormStoreOrThrow, useTheme, watch } from '#imports'
const { sharedViewMeta } = useSharedFormStoreOrThrow(); const { sharedViewMeta } = useSharedFormStoreOrThrow()
const isDark = useDark(); const isDark = useDark()
const { setTheme } = useTheme(); const { setTheme } = useTheme()
const route = useRoute(); const route = useRoute()
const router = useRouter(); const router = useRouter()
watch( watch(
() => sharedViewMeta.value.withTheme, () => sharedViewMeta.value.withTheme,
(hasTheme) => { (hasTheme) => {
if (hasTheme && sharedViewMeta.value.theme) setTheme(sharedViewMeta.value.theme); if (hasTheme && sharedViewMeta.value.theme) setTheme(sharedViewMeta.value.theme)
}, },
{ immediate: true } { immediate: true },
); )
const onClick = () => { const onClick = () => {
isDark.value = !isDark.value; isDark.value = !isDark.value
}; }
const shouldRedirect = (to: string) => { const shouldRedirect = (to: string) => {
if (sharedViewMeta.value.surveyMode) { if (sharedViewMeta.value.surveyMode) {
if (!to.includes("survey")) navigateTo(`/nc/form/${route.params.viewId}/survey`); if (!to.includes('survey')) navigateTo(`/nc/form/${route.params.viewId}/survey`)
} else { } else {
if (to.includes("survey")) navigateTo(`/nc/form/${route.params.viewId}`); if (to.includes('survey')) navigateTo(`/nc/form/${route.params.viewId}`)
}
} }
};
shouldRedirect(route.name as string); shouldRedirect(route.name as string)
router.afterEach((to) => shouldRedirect(to.name as string)); router.afterEach((to) => shouldRedirect(to.name as string))
</script> </script>
<template> <template>

Loading…
Cancel
Save