Browse Source

chore(gui): lint

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5184/head
Pranav C 2 years ago
parent
commit
3fde0f0c36
  1. 6
      packages/nc-gui/components/smartsheet/Grid.vue
  2. 20
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  3. 2
      packages/nc-gui/composables/useExpandedFormStore.ts
  4. 3
      packages/nc-gui/composables/useViewData.ts

6
packages/nc-gui/components/smartsheet/Grid.vue

@ -118,7 +118,7 @@ const {
selectedAllRecords, selectedAllRecords,
removeRowIfNew, removeRowIfNew,
navigateToSiblingRow, navigateToSiblingRow,
getExpandedRowIndex getExpandedRowIndex,
} = useViewData(meta, view, xWhere) } = useViewData(meta, view, xWhere)
const { getMeta } = useMetas() const { getMeta } = useMetas()
@ -981,10 +981,10 @@ const closeAddColumnDropdown = () => {
:row-id="routeQuery.rowId" :row-id="routeQuery.rowId"
:view="view" :view="view"
show-next-prev-icons show-next-prev-icons
@next="navigateToSiblingRow(NavigateDir.NEXT)"
@prev="navigateToSiblingRow(NavigateDir.PREV)"
:first-row="getExpandedRowIndex() === 0" :first-row="getExpandedRowIndex() === 0"
:last-row="getExpandedRowIndex() === paginationData.totalRows - 1" :last-row="getExpandedRowIndex() === paginationData.totalRows - 1"
@next="navigateToSiblingRow(NavigateDir.NEXT)"
@prev="navigateToSiblingRow(NavigateDir.PREV)"
/> />
</Suspense> </Suspense>
</div> </div>

20
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -178,7 +178,7 @@ const addNewRow = () => {
rowMeta: { new: true }, rowMeta: { new: true },
} }
isExpanded.value = true isExpanded.value = true
}, 500); }, 500)
} }
// attach keyboard listeners to switch between rows // attach keyboard listeners to switch between rows
@ -200,7 +200,7 @@ useActiveKeyupListener(
document.activeElement?.blur() document.activeElement?.blur()
e.stopPropagation() e.stopPropagation()
e.preventDefault()
if (isNew.value) { if (isNew.value) {
const data = await save(rowState.value) const data = await save(rowState.value)
await syncLTARRefs(data) await syncLTARRefs(data)
@ -214,12 +214,8 @@ useActiveKeyupListener(
} }
// on alt + n create new record // on alt + n create new record
} else if (e.code === 'KeyN') { } else if (e.code === 'KeyN') {
// remove focus from the active input if any to avoid unwanted input
// remove focus from the active input if any ;(document.activeElement as HTMLInputElement)?.blur?.()
document.activeElement?.blur()
e.stopPropagation()
e.preventDefault()
if (changedColumns.value.size > 0) { if (changedColumns.value.size > 0) {
await Modal.confirm({ await Modal.confirm({
@ -253,7 +249,6 @@ useActiveKeyupListener(
} else { } else {
addNewRow() addNewRow()
} }
} }
}, },
{ immediate: true }, { immediate: true },
@ -282,7 +277,7 @@ export default {
<div class="flex h-full nc-form-wrapper items-stretch min-h-[max(70vh,100%)]"> <div class="flex h-full nc-form-wrapper items-stretch min-h-[max(70vh,100%)]">
<div class="flex-1 overflow-auto scrollbar-thin-dull nc-form-fields-container relative"> <div class="flex-1 overflow-auto scrollbar-thin-dull nc-form-fields-container relative">
<template v-if="props.showNextPrevIcons"> <template v-if="props.showNextPrevIcons">
<a-tooltip placement="bottom" v-if="!props.firstRow"> <a-tooltip v-if="!props.firstRow" placement="bottom">
<template #title> <template #title>
{{ $t('labels.prevRow') }} {{ $t('labels.prevRow') }}
@ -291,7 +286,7 @@ export default {
<MdiChevronRight class="cursor-pointer nc-next-arrow" @click="$emit('next')" /> <MdiChevronRight class="cursor-pointer nc-next-arrow" @click="$emit('next')" />
</a-tooltip> </a-tooltip>
<a-tooltip placement="bottom" v-if="!props.lastRow"> <a-tooltip v-if="!props.lastRow" placement="bottom">
<template #title> <template #title>
{{ $t('labels.nextRow') }} {{ $t('labels.nextRow') }}
<GeneralShortcutLabel class="justify-center" :keys="['Alt', '→']" /> <GeneralShortcutLabel class="justify-center" :keys="['Alt', '→']" />
@ -320,8 +315,7 @@ export default {
:ref="i ? null : (el) => (cellWrapperEl = el)" :ref="i ? null : (el) => (cellWrapperEl = el)"
class="!bg-white rounded px-1 min-h-[35px] flex items-center mt-2 relative" class="!bg-white rounded px-1 min-h-[35px] flex items-center mt-2 relative"
> >
<LazySmartsheetVirtualCell v-if="isVirtualCol(col)" v-model="row.row[col.title]" :row="row" <LazySmartsheetVirtualCell v-if="isVirtualCol(col)" v-model="row.row[col.title]" :row="row" :column="col" />
:column="col" />
<LazySmartsheetCell <LazySmartsheetCell
v-else v-else

2
packages/nc-gui/composables/useExpandedFormStore.ts

@ -245,7 +245,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
changedColumns, changedColumns,
loadRow, loadRow,
primaryKey, primaryKey,
saveRowAndStay saveRowAndStay,
} }
}, 'expanded-form-store') }, 'expanded-form-store')

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

@ -477,7 +477,6 @@ export function useViewData(
} }
} }
// get current expanded row index // get current expanded row index
function getExpandedRowIndex() { function getExpandedRowIndex() {
return formattedData.value.findIndex( return formattedData.value.findIndex(
@ -552,6 +551,6 @@ export function useViewData(
removeRowIfNew, removeRowIfNew,
navigateToSiblingRow, navigateToSiblingRow,
deleteRowById, deleteRowById,
getExpandedRowIndex getExpandedRowIndex,
} }
} }

Loading…
Cancel
Save