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

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

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

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

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

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

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

Loading…
Cancel
Save