vxe-table 3.13.1 → 3.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/table/module/export/mixin.js +9 -6
  6. package/es/table/src/methods.js +51 -21
  7. package/es/table/src/table.js +13 -10
  8. package/es/table/style.css +3 -1
  9. package/es/table/style.min.css +1 -1
  10. package/es/ui/index.js +1 -1
  11. package/es/ui/src/log.js +1 -1
  12. package/es/vxe-table/style.css +3 -1
  13. package/es/vxe-table/style.min.css +1 -1
  14. package/lib/index.css +1 -1
  15. package/lib/index.min.css +1 -1
  16. package/lib/index.umd.js +77 -39
  17. package/lib/index.umd.min.js +1 -1
  18. package/lib/style.css +1 -1
  19. package/lib/style.min.css +1 -1
  20. package/lib/table/module/export/mixin.js +10 -7
  21. package/lib/table/module/export/mixin.min.js +1 -1
  22. package/lib/table/src/methods.js +51 -20
  23. package/lib/table/src/methods.min.js +1 -1
  24. package/lib/table/src/table.js +14 -10
  25. package/lib/table/src/table.min.js +1 -1
  26. package/lib/table/style/style.css +3 -1
  27. package/lib/table/style/style.min.css +1 -1
  28. package/lib/ui/index.js +1 -1
  29. package/lib/ui/index.min.js +1 -1
  30. package/lib/ui/src/log.js +1 -1
  31. package/lib/ui/src/log.min.js +1 -1
  32. package/lib/vxe-table/style/style.css +3 -1
  33. package/lib/vxe-table/style/style.min.css +1 -1
  34. package/package.json +1 -1
  35. package/packages/table/module/export/mixin.ts +9 -6
  36. package/packages/table/src/methods.ts +54 -23
  37. package/packages/table/src/table.ts +17 -11
  38. package/styles/components/table.scss +3 -1
  39. /package/es/{iconfont.1739845316237.ttf → iconfont.1739938254381.ttf} +0 -0
  40. /package/es/{iconfont.1739845316237.woff → iconfont.1739938254381.woff} +0 -0
  41. /package/es/{iconfont.1739845316237.woff2 → iconfont.1739938254381.woff2} +0 -0
  42. /package/lib/{iconfont.1739845316237.ttf → iconfont.1739938254381.ttf} +0 -0
  43. /package/lib/{iconfont.1739845316237.woff → iconfont.1739938254381.woff} +0 -0
  44. /package/lib/{iconfont.1739845316237.woff2 → iconfont.1739938254381.woff2} +0 -0
@@ -1877,7 +1877,13 @@ const getWheelSpeed = (lastScrollTime: number) => {
1877
1877
  return multiple
1878
1878
  }
1879
1879
 
1880
- const wheelScrollTo = (diffNum: number, cb: (progress: number) => void) => {
1880
+ const wheelScrollLeftTo = (scrollLeft: number, cb: (offsetLeft: number) => void) => {
1881
+ requestAnimationFrame(() => {
1882
+ cb(scrollLeft)
1883
+ })
1884
+ }
1885
+
1886
+ const wheelScrollTopTo = (diffNum: number, cb: (progress: number) => void) => {
1881
1887
  const duration = Math.abs(diffNum)
1882
1888
  const startTime = performance.now()
1883
1889
  let countTop = 0
@@ -8090,6 +8096,9 @@ const Methods = {
8090
8096
 
8091
8097
  const { scrollYLoad, scrollXLoad } = reactData
8092
8098
  const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData
8099
+ if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
8100
+ return
8101
+ }
8093
8102
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
8094
8103
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
8095
8104
  const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
@@ -8098,9 +8107,6 @@ const Methods = {
8098
8107
  const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
8099
8108
  const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
8100
8109
  const rowExpandEl = $xeTable.$refs.refRowExpandElem as HTMLDivElement
8101
- if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
8102
- return
8103
- }
8104
8110
  if (intoRunScroll) {
8105
8111
  return
8106
8112
  }
@@ -8169,17 +8175,17 @@ const Methods = {
8169
8175
 
8170
8176
  const { scrollXLoad } = reactData
8171
8177
  const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData
8172
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
8173
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
8174
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
8175
- const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
8176
- const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
8177
8178
  if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
8178
8179
  return
8179
8180
  }
8180
8181
  if (intoRunScroll) {
8181
8182
  return
8182
8183
  }
8184
+ const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
8185
+ const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
8186
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
8187
+ const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
8188
+ const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
8183
8189
  if (!headerScrollElem) {
8184
8190
  return
8185
8191
  }
@@ -8212,14 +8218,14 @@ const Methods = {
8212
8218
 
8213
8219
  const { scrollXLoad } = reactData
8214
8220
  const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
8221
+ if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
8222
+ return
8223
+ }
8215
8224
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
8216
8225
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
8217
8226
  const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
8218
8227
  const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
8219
8228
  const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
8220
- if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
8221
- return
8222
- }
8223
8229
  if (intoRunScroll) {
8224
8230
  return
8225
8231
  }
@@ -8258,17 +8264,25 @@ const Methods = {
8258
8264
  if (target && /^textarea$/i.test((target as HTMLElement).tagName)) {
8259
8265
  return
8260
8266
  }
8267
+
8261
8268
  const { highlightHoverRow } = tableProps
8262
- const { scrollYLoad } = reactData
8269
+ const { scrollXLoad, scrollYLoad } = reactData
8270
+ const leftFixedWidth = $xeTable.computeLeftFixedWidth
8271
+ const rightFixedWidth = $xeTable.computeRightFixedWidth
8272
+ if (!(scrollYLoad || leftFixedWidth || rightFixedWidth)) {
8273
+ return
8274
+ }
8275
+
8263
8276
  const { elemStore, lastScrollTop, lastScrollLeft } = internalData
8264
8277
  const rowOpts = $xeTable.computeRowOpts
8265
8278
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
8266
8279
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
8267
8280
  const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
8281
+ const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
8268
8282
  const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
8283
+ const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
8269
8284
  const rightScrollElem = getRefElem(elemStore['right-body-scroll'])
8270
8285
  const rowExpandEl = $xeTable.$refs.refRowExpandElem as HTMLDivElement
8271
-
8272
8286
  if (!xHandleEl) {
8273
8287
  return
8274
8288
  }
@@ -8280,8 +8294,8 @@ const Methods = {
8280
8294
  }
8281
8295
 
8282
8296
  const wheelSpeed = getWheelSpeed(reactData.lastScrollTime)
8283
- const deltaTop = deltaY * wheelSpeed
8284
- const deltaLeft = deltaX * wheelSpeed
8297
+ const deltaTop = Math.ceil(deltaY * wheelSpeed)
8298
+ const deltaLeft = Math.ceil(deltaX * wheelSpeed)
8285
8299
 
8286
8300
  const isTopWheel = deltaTop < 0
8287
8301
  const currScrollTop = bodyScrollElem.scrollTop
@@ -8290,19 +8304,36 @@ const Methods = {
8290
8304
  return
8291
8305
  }
8292
8306
 
8293
- const scrollTop = bodyScrollElem.scrollTop + deltaTop
8307
+ const scrollTop = currScrollTop + deltaTop
8294
8308
  const scrollLeft = bodyScrollElem.scrollLeft + deltaLeft
8295
8309
  const isRollX = scrollLeft !== lastScrollLeft
8296
8310
  const isRollY = scrollTop !== lastScrollTop
8297
8311
 
8312
+ if (rowOpts.isHover || highlightHoverRow) {
8313
+ $xeTable.clearHoverRow()
8314
+ }
8298
8315
  // 用于鼠标纵向滚轮处理
8316
+ if (isRollX) {
8317
+ evnt.preventDefault()
8318
+ internalData.inWheelScroll = true
8319
+ wheelScrollLeftTo(scrollLeft, (offsetLeft: number) => {
8320
+ const currLeftNum = offsetLeft
8321
+ setScrollLeft(xHandleEl, currLeftNum)
8322
+ setScrollLeft(bodyScrollElem, currLeftNum)
8323
+ setScrollLeft(headerScrollElem, currLeftNum)
8324
+ setScrollLeft(footerScrollElem, currLeftNum)
8325
+ if (scrollXLoad) {
8326
+ $xeTable.triggerScrollXEvent(evnt)
8327
+ }
8328
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, bodyScrollElem.scrollTop, currLeftNum, {
8329
+ type: 'table',
8330
+ fixed: ''
8331
+ })
8332
+ })
8333
+ }
8299
8334
  if (isRollY) {
8300
8335
  evnt.preventDefault()
8301
- if (rowOpts.isHover || highlightHoverRow) {
8302
- $xeTable.clearHoverRow()
8303
- }
8304
-
8305
- wheelScrollTo(scrollTop - bodyScrollElem.scrollTop, (offsetTop: number) => {
8336
+ wheelScrollTopTo(scrollTop - currScrollTop, (offsetTop: number) => {
8306
8337
  const currTopNum = bodyScrollElem.scrollTop + offsetTop
8307
8338
  internalData.inWheelScroll = true
8308
8339
  setScrollTop(yHandleEl, currTopNum)
@@ -8313,7 +8344,7 @@ const Methods = {
8313
8344
  if (scrollYLoad) {
8314
8345
  $xeTable.triggerScrollYEvent(evnt)
8315
8346
  }
8316
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
8347
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, bodyScrollElem.scrollLeft, {
8317
8348
  type: 'table',
8318
8349
  fixed: ''
8319
8350
  })
@@ -333,20 +333,12 @@ function renderViewport (h: CreateElement, $xeTable: VxeTableConstructor & VxeTa
333
333
  const reactData = $xeTable as unknown as TableReactData
334
334
 
335
335
  const { showHeader, showFooter } = props
336
- const { overflowX, scrollYLoad, tableData, tableColumn, tableGroupColumn, footerTableData, columnStore } = reactData
336
+ const { overflowX, tableData, tableColumn, tableGroupColumn, footerTableData, columnStore } = reactData
337
337
  const { leftList, rightList } = columnStore
338
- const leftFixedWidth = $xeTable.computeLeftFixedWidth
339
- const rightFixedWidth = $xeTable.computeRightFixedWidth
340
-
341
- const ons: Record<string, any> = {}
342
- if (scrollYLoad || leftFixedWidth || rightFixedWidth) {
343
- ons.wheel = $xeTable.triggerBodyWheelEvent
344
- }
345
338
 
346
339
  return h('div', {
347
340
  ref: 'refTableViewportElem',
348
- class: 'vxe-table--viewport-wrapper',
349
- on: ons
341
+ class: 'vxe-table--viewport-wrapper'
350
342
  }, [
351
343
  h('div', {
352
344
  class: 'vxe-table--main-wrapper'
@@ -1290,6 +1282,8 @@ export default {
1290
1282
  }
1291
1283
  } as any,
1292
1284
  created () {
1285
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1286
+
1293
1287
  const { scrollXStore, sYOpts, scrollYStore, data, editOpts, treeOpts, treeConfig, showOverflow, rowOpts } = Object.assign(this, {
1294
1288
  tZindex: 0,
1295
1289
  elemStore: {},
@@ -1548,7 +1542,7 @@ export default {
1548
1542
  globalEvents.on(this, 'keydown', this.handleGlobalKeydownEvent)
1549
1543
  globalEvents.on(this, 'resize', this.handleGlobalResizeEvent)
1550
1544
  globalEvents.on(this, 'contextmenu', this.handleGlobalContextmenuEvent)
1551
- this.preventEvent(null, 'created')
1545
+ $xeTable.preventEvent(null, 'created')
1552
1546
  },
1553
1547
  mounted () {
1554
1548
  const $xeTable = this
@@ -1603,6 +1597,12 @@ export default {
1603
1597
  resizeObserver.observe(this.getParentElem())
1604
1598
  this.$resize = resizeObserver
1605
1599
  }
1600
+
1601
+ const tableViewportEl = $xeTable.$refs.refTableViewportElem as HTMLDivElement
1602
+ if (tableViewportEl) {
1603
+ tableViewportEl.addEventListener('wheel', $xeTable.triggerBodyWheelEvent, { passive: false })
1604
+ }
1605
+
1606
1606
  this.preventEvent(null, 'mounted')
1607
1607
  },
1608
1608
  activated () {
@@ -1613,6 +1613,12 @@ export default {
1613
1613
  this.preventEvent(null, 'deactivated')
1614
1614
  },
1615
1615
  beforeDestroy () {
1616
+ const $xeTable = this
1617
+
1618
+ const tableViewportEl = $xeTable.$refs.refTableViewportElem as HTMLDivElement
1619
+ if (tableViewportEl) {
1620
+ tableViewportEl.removeEventListener('wheel', $xeTable.triggerBodyWheelEvent)
1621
+ }
1616
1622
  if (this.$resize) {
1617
1623
  this.$resize.disconnect()
1618
1624
  }
@@ -54,6 +54,7 @@
54
54
  overflow: hidden;
55
55
  outline: 0;
56
56
  scrollbar-width: none;
57
+ -webkit-overflow-scrolling: touch;
57
58
  }
58
59
  .vxe-table--header-inner-wrapper,
59
60
  .vxe-table--body-inner-wrapper,
@@ -63,6 +64,7 @@
63
64
  height: 100%;
64
65
  scrollbar-width: none;
65
66
  -ms-overflow-style: none;
67
+ -webkit-overflow-scrolling: touch;
66
68
  &::-webkit-scrollbar {
67
69
  display: none;
68
70
  }
@@ -271,7 +273,7 @@
271
273
  display: none;
272
274
  position: absolute;
273
275
  pointer-events: none;
274
- z-index: 6;
276
+ z-index: 1;
275
277
  }
276
278
 
277
279
  .vxe-table--header-wrapper {