|
@@ -88,8 +88,25 @@ const useTableCheck = <T extends TableDataType<InputDataType>>(data: T, auto = t
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const nextRow = () => {
|
|
const nextRow = () => {
|
|
- elTableRef?.value?.setCurrentRow(tableData.value[((current.value?.index || 0) + 1) % tableData.value.length])
|
|
|
|
- elTableRef?.value?.scrollTo(0, (current.value?.index || 0) * 36)
|
|
|
|
|
|
+ const index = (current.value?.index || 0) + 1
|
|
|
|
+ elTableRef?.value?.setCurrentRow(tableData.value[index % tableData.value.length])
|
|
|
|
+ const tBodyDomWrap = elTableRef?.value?.$refs.bodyWrapper
|
|
|
|
+ if (tBodyDomWrap) {
|
|
|
|
+ if (index % tableData.value.length == 0) {
|
|
|
|
+ elTableRef?.value?.scrollTo({ left: 0, top: 0, behavior: 'smooth' })
|
|
|
|
+ } else {
|
|
|
|
+ const wrap = tBodyDomWrap.getElementsByClassName('el-scrollbar__wrap')[0]
|
|
|
|
+ const oHeight = wrap.offsetHeight
|
|
|
|
+ const sTop = wrap.scrollTop
|
|
|
|
+ const sHeight = wrap.scrollHeight
|
|
|
|
+ const targetRowAsHeight = 36 * ((current.value?.index || 0) + 1)
|
|
|
|
+ if (sHeight > oHeight && targetRowAsHeight - sTop > oHeight) {
|
|
|
|
+ const t = sHeight - targetRowAsHeight
|
|
|
|
+ elTableRef?.value?.scrollTo({ left: 0, top: sTop + 36, behavior: 'smooth' })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // elTableRef?.value?.scrollTo(0, (current.value?.index || 0) * 36)
|
|
}
|
|
}
|
|
const arrowDownToNextRow = (e: any) => {
|
|
const arrowDownToNextRow = (e: any) => {
|
|
if (e.target.tagName === 'INPUT' || (e.target.className || '').includes('contenteditable-ele')) {
|
|
if (e.target.tagName === 'INPUT' || (e.target.className || '').includes('contenteditable-ele')) {
|