fix(components): [table] the last column shuld not allow drag (#18444)

This commit is contained in:
btea 2024-10-11 18:42:24 +08:00 committed by GitHub
parent 1f82e8ca61
commit ed9bb12ef8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -121,13 +121,14 @@ function useEvent<T>(props: TableHeaderProps<T>, emit) {
}
const target = el?.closest('th')
if (!column || !column.resizable) return
if (!column || !column.resizable || !target) return
if (!dragging.value && props.border) {
const rect = target.getBoundingClientRect()
const bodyStyle = document.body.style
if (rect.width > 12 && rect.right - event.pageX < 8) {
const isLastTh = target.parentNode?.lastElementChild === target
if (rect.width > 12 && rect.right - event.pageX < 8 && !isLastTh) {
bodyStyle.cursor = 'col-resize'
if (hasClass(target, 'is-sortable')) {
target.style.cursor = 'col-resize'