Browse Source

fix: keep selection while resizing column

pull/8387/head
mertmit 7 months ago
parent
commit
01d20e2b04
  1. 12
      packages/nc-gui/components/smartsheet/grid/Table.vue

12
packages/nc-gui/components/smartsheet/grid/Table.vue

@ -204,6 +204,8 @@ const { height: tableHeadHeight, width: _tableHeadWidth } = useElementBounding(t
const isViewColumnsLoading = computed(() => _isViewColumnsLoading.value || !meta.value) const isViewColumnsLoading = computed(() => _isViewColumnsLoading.value || !meta.value)
const resizingColumn = ref(false)
// #Permissions // #Permissions
const { isUIAllowed } = useRoles() const { isUIAllowed } = useRoles()
const hasEditPermission = computed(() => isUIAllowed('dataEdit')) const hasEditPermission = computed(() => isUIAllowed('dataEdit'))
@ -855,6 +857,11 @@ const deleteSelectedRangeOfRows = () => {
} }
const selectColumn = (columnId: string) => { const selectColumn = (columnId: string) => {
// this is triggered with click event, so do nothing & clear resizingColumn flag if it's true
if (resizingColumn.value) {
resizingColumn.value = false
return
}
const colIndex = fields.value.findIndex((col) => col.id === columnId) const colIndex = fields.value.findIndex((col) => col.id === columnId)
if (colIndex !== -1) { if (colIndex !== -1) {
makeActive(0, colIndex) makeActive(0, colIndex)
@ -870,6 +877,10 @@ onClickOutside(tableBodyEl, (e) => {
return return
} }
if (resizingColumn.value) {
return
}
// do nothing if context menu was open // do nothing if context menu was open
if (contextMenu.value) return if (contextMenu.value) return
@ -1117,6 +1128,7 @@ const onXcResizing = (cn: string | undefined, event: any) => {
const onXcStartResizing = (cn: string | undefined, event: any) => { const onXcStartResizing = (cn: string | undefined, event: any) => {
if (!cn) return if (!cn) return
resizingColOldWith.value = event.detail resizingColOldWith.value = event.detail
resizingColumn.value = true
} }
const loadColumn = (title: string, tp: string, colOptions?: any) => { const loadColumn = (title: string, tp: string, colOptions?: any) => {

Loading…
Cancel
Save