vxe-table 3.11.4 → 3.11.6-beta.0

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 (58) hide show
  1. package/es/index.css +1 -0
  2. package/es/index.min.css +1 -0
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/table/module/filter/mixin.js +23 -2
  6. package/es/table/module/filter/panel.js +3 -6
  7. package/es/table/src/body.js +55 -30
  8. package/es/table/src/footer.js +30 -22
  9. package/es/table/src/methods.js +253 -109
  10. package/es/table/src/table.js +11 -3
  11. package/es/table/style.css +48 -3
  12. package/es/table/style.min.css +1 -1
  13. package/es/ui/index.js +2 -2
  14. package/es/ui/src/log.js +1 -1
  15. package/es/vxe-table/style.css +48 -3
  16. package/es/vxe-table/style.min.css +1 -1
  17. package/lib/index.css +1 -0
  18. package/lib/index.min.css +1 -0
  19. package/lib/index.umd.js +436 -196
  20. package/lib/index.umd.min.js +1 -1
  21. package/lib/style.css +1 -1
  22. package/lib/style.min.css +1 -1
  23. package/lib/table/module/filter/mixin.js +25 -2
  24. package/lib/table/module/filter/mixin.min.js +1 -1
  25. package/lib/table/module/filter/panel.js +3 -7
  26. package/lib/table/module/filter/panel.min.js +1 -1
  27. package/lib/table/src/body.js +65 -32
  28. package/lib/table/src/body.min.js +1 -1
  29. package/lib/table/src/footer.js +32 -23
  30. package/lib/table/src/footer.min.js +1 -1
  31. package/lib/table/src/methods.js +293 -127
  32. package/lib/table/src/methods.min.js +1 -1
  33. package/lib/table/src/table.js +16 -2
  34. package/lib/table/src/table.min.js +1 -1
  35. package/lib/table/style/style.css +48 -3
  36. package/lib/table/style/style.min.css +1 -1
  37. package/lib/ui/index.js +2 -2
  38. package/lib/ui/index.min.js +1 -1
  39. package/lib/ui/src/log.js +1 -1
  40. package/lib/ui/src/log.min.js +1 -1
  41. package/lib/vxe-table/style/style.css +48 -3
  42. package/lib/vxe-table/style/style.min.css +1 -1
  43. package/package.json +2 -2
  44. package/packages/table/module/filter/mixin.ts +26 -2
  45. package/packages/table/module/filter/panel.ts +3 -6
  46. package/packages/table/src/body.ts +66 -27
  47. package/packages/table/src/footer.ts +33 -21
  48. package/packages/table/src/methods.ts +266 -112
  49. package/packages/table/src/table.ts +11 -3
  50. package/packages/ui/index.ts +1 -1
  51. package/packages/ui/src/dom.ts +2 -2
  52. package/styles/components/table.scss +38 -3
  53. /package/es/{iconfont.1732091003142.ttf → iconfont.1732505453169.ttf} +0 -0
  54. /package/es/{iconfont.1732091003142.woff → iconfont.1732505453169.woff} +0 -0
  55. /package/es/{iconfont.1732091003142.woff2 → iconfont.1732505453169.woff2} +0 -0
  56. /package/lib/{iconfont.1732091003142.ttf → iconfont.1732505453169.ttf} +0 -0
  57. /package/lib/{iconfont.1732091003142.woff → iconfont.1732505453169.woff} +0 -0
  58. /package/lib/{iconfont.1732091003142.woff2 → iconfont.1732505453169.woff2} +0 -0
@@ -6,7 +6,7 @@ import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid } from './util'
6
6
  import { updateCellTitle, setScrollTop, setScrollLeft } from '../../ui/src/dom'
7
7
  import { getSlotVNs } from '../../ui/src/vn'
8
8
 
9
- const { getI18n, renderer } = VxeUI
9
+ const { getI18n, renderer, renderEmptyElement } = VxeUI
10
10
 
11
11
  const renderType = 'body'
12
12
 
@@ -64,6 +64,7 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
64
64
  columnKey,
65
65
  overflowX,
66
66
  sYOpts,
67
+ scrollXLoad,
67
68
  scrollYLoad,
68
69
  highlightCurrentRow,
69
70
  showOverflow: allColumnOverflow,
@@ -88,8 +89,11 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
88
89
  tooltipConfig,
89
90
  rowOpts,
90
91
  columnOpts,
92
+ mouseOpts,
93
+ areaOpts,
91
94
  validErrorMaps
92
95
  } = $xetable
96
+ const { selectCellToRow } = areaOpts
93
97
  const cellOpts = $xetable.computeCellOpts
94
98
  const { type, cellRender, editRender, align, showOverflow, className, treeNode, slots } = column
95
99
  const { verticalAlign } = cellOpts
@@ -249,7 +253,7 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
249
253
  if (showValidTip && errorValidItem) {
250
254
  const errRule = errorValidItem.rule
251
255
  const validSlot = slots ? slots.valid : null
252
- const validParams = { ...params, ...errorValidItem }
256
+ const validParams = { ...params, ...errorValidItem, rule: errorValidItem }
253
257
  tdVNs.push(
254
258
  h('div', {
255
259
  class: ['vxe-cell--valid-error-tip', getClass(validOpts.className, errorValidItem)],
@@ -277,12 +281,25 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
277
281
  let cellHeight = ''
278
282
  if (hasEllipsis && (scrollYRHeight || rowHeight)) {
279
283
  cellHeight = `${scrollYRHeight || rowHeight}px`
280
- } else if (scrollYLoad) {
284
+ } else if (scrollXLoad || scrollYLoad) {
281
285
  if (!hasEllipsis) {
282
286
  cellHeight = `${rest.height || 24}px`
283
287
  }
284
288
  }
285
289
 
290
+ if (mouseConfig && mouseOpts.area && selectCellToRow) {
291
+ if (
292
+ (!$columnIndex && selectCellToRow === true) ||
293
+ (selectCellToRow === column.field)
294
+ ) {
295
+ tdVNs.push(
296
+ h('div', {
297
+ class: 'vxe-cell--area-status'
298
+ })
299
+ )
300
+ }
301
+ }
302
+
286
303
  return h('td', {
287
304
  class: [
288
305
  'vxe-body--column',
@@ -536,6 +553,8 @@ export default {
536
553
  elemStore[`${prefix}emptyBlock`] = null
537
554
  },
538
555
  render (this: any, h: CreateElement) {
556
+ const $xeTable = this.$parent
557
+
539
558
  const { _e, $parent: $xetable, fixedColumn, fixedType } = this
540
559
  let { $scopedSlots, tId, tableData, tableColumn, visibleColumn, expandColumn, showOverflow: allColumnOverflow, keyboardConfig, keyboardOpts, mergeList, spanMethod, scrollXLoad, scrollYLoad, isAllOverflow, emptyOpts, mouseConfig, mouseOpts, sYOpts, rowOpts, isDragRowMove } = $xetable
541
560
  // 如果是使用优化模式
@@ -571,14 +590,21 @@ export default {
571
590
  emptyContent = $xetable.emptyText || getI18n('vxe.table.emptyText')
572
591
  }
573
592
  }
593
+
594
+ const ons: Record<string, any> = {
595
+ scroll: this.scrollEvent
596
+ }
597
+ if (sYOpts.mode === 'wheel') {
598
+ ons.wheel = this.wheelEvent
599
+ }
600
+
574
601
  return h('div', {
602
+ ref: 'refElem',
575
603
  class: ['vxe-table--body-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
576
604
  attrs: {
577
605
  xid: tId
578
606
  },
579
- on: Object.assign({
580
- scroll: this.scrollEvent
581
- }, scrollYLoad && sYOpts.mode === 'wheel' ? { wheel: this.wheelEvent } : null)
607
+ on: ons
582
608
  }, [
583
609
  fixedType
584
610
  ? _e()
@@ -661,7 +687,7 @@ export default {
661
687
  class: 'vxe-table--cell-active-area'
662
688
  })
663
689
  ])
664
- : null,
690
+ : renderEmptyElement($xeTable),
665
691
  !fixedType
666
692
  ? h('div', {
667
693
  class: 'vxe-table--empty-block',
@@ -671,7 +697,7 @@ export default {
671
697
  class: 'vxe-table--empty-content'
672
698
  }, emptyContent)
673
699
  ])
674
- : null
700
+ : renderEmptyElement($xeTable)
675
701
  ])
676
702
  },
677
703
  methods: {
@@ -681,23 +707,38 @@ export default {
681
707
  * 如果存在列固定右侧,同步更新滚动状态
682
708
  */
683
709
  scrollEvent (evnt: Event) {
684
- const { $el: scrollBodyElem, $parent: $xeTable, fixedType } = this
685
- const { $refs, lastScrollTop, lastScrollLeft } = $xeTable
686
- const { tableHeader, tableBody, leftBody, rightBody, tableFooter } = $refs
710
+ const $xeTable = this.$parent
711
+ const tableInternalData = $xeTable
712
+
713
+ const { fixedType } = this
714
+ const { lastScrollTop, lastScrollLeft, inVirtualScroll, inBodyScroll, bodyScrollType, inFooterScroll } = tableInternalData
715
+ if (inVirtualScroll) {
716
+ return
717
+ }
718
+ if (inFooterScroll) {
719
+ return
720
+ }
721
+ if (inBodyScroll) {
722
+ if (bodyScrollType !== fixedType) {
723
+ return
724
+ }
725
+ }
726
+ const { tableHeader, tableBody, leftBody, rightBody, tableFooter } = $xeTable.$refs
727
+ const scrollBodyElem = this.$el
687
728
  const headerElem = tableHeader ? tableHeader.$el : null
688
729
  const footerElem = tableFooter ? tableFooter.$el : null
689
730
  const bodyElem = tableBody.$el
690
731
  const leftElem = leftBody ? leftBody.$el : null
691
732
  const rightElem = rightBody ? rightBody.$el : null
733
+ const xHandleEl = $xeTable.$refs.refScrollXHandleElem
734
+ const yHandleEl = $xeTable.$refs.refScrollYHandleElem
692
735
  const scrollTop = scrollBodyElem.scrollTop
693
736
  const scrollLeft = bodyElem.scrollLeft
694
737
  const isRollX = scrollLeft !== lastScrollLeft
695
738
  const isRollY = scrollTop !== lastScrollTop
696
- const xHandleEl = $refs.refScrollXHandleElem
697
- const yHandleEl = $refs.refScrollYHandleElem
698
- if (yHandleEl) {
699
- yHandleEl.scrollTop = scrollTop
700
- } else if (isRollY) {
739
+ tableInternalData.inBodyScroll = true
740
+ tableInternalData.bodyScrollType = fixedType
741
+ if (isRollY) {
701
742
  if (leftElem && fixedType === 'left') {
702
743
  setScrollTop(bodyElem, scrollTop)
703
744
  setScrollTop(rightElem, scrollTop)
@@ -708,21 +749,19 @@ export default {
708
749
  setScrollTop(leftElem, scrollTop)
709
750
  setScrollTop(rightElem, scrollTop)
710
751
  }
711
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
712
- type: renderType,
713
- fixed: fixedType
714
- })
752
+ setScrollTop(yHandleEl, scrollTop)
753
+ $xeTable.triggerScrollYEvent(evnt)
715
754
  }
716
- if (xHandleEl) {
717
- xHandleEl.scrollLeft = scrollLeft
718
- } else if (isRollX) {
755
+ if (isRollX) {
756
+ setScrollLeft(xHandleEl, scrollLeft)
719
757
  setScrollLeft(headerElem, scrollLeft)
720
758
  setScrollLeft(footerElem, scrollLeft)
721
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
722
- type: renderType,
723
- fixed: fixedType
724
- })
759
+ $xeTable.triggerScrollXEvent(evnt)
725
760
  }
761
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
762
+ type: renderType,
763
+ fixed: fixedType
764
+ })
726
765
  },
727
766
  handleWheel (evnt: any, isTopWheel: any, deltaTop: any, isRollX: any, isRollY: any) {
728
767
  const { $parent: $xetable } = this
@@ -229,14 +229,18 @@ export default {
229
229
  tableColumn = visibleColumn
230
230
  }
231
231
  }
232
+
233
+ const ons: Record<string, any> = {}
234
+ if (!fixedType) {
235
+ ons.scroll = this.scrollEvent
236
+ }
237
+
232
238
  return h('div', {
233
239
  class: ['vxe-table--footer-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
234
240
  attrs: {
235
241
  xid: tId
236
242
  },
237
- on: {
238
- scroll: this.scrollEvent
239
- }
243
+ on: ons
240
244
  }, [
241
245
  fixedType
242
246
  ? _e()
@@ -291,27 +295,35 @@ export default {
291
295
  * 如果存在列固定右侧,同步更新滚动状态
292
296
  */
293
297
  scrollEvent (evnt: any) {
294
- const { $parent: $xeTable, fixedType } = this
295
- const { $refs } = $xeTable
296
- const { tableHeader, tableBody, tableFooter } = $refs
298
+ const $xeTable = this.$parent
299
+ const tableInternalData = $xeTable
300
+
301
+ const { inVirtualScroll, inBodyScroll } = tableInternalData
302
+ if (inVirtualScroll) {
303
+ return
304
+ }
305
+ if (inBodyScroll) {
306
+ return
307
+ }
308
+ const { fixedType } = this
309
+ const { tableHeader, tableBody, tableFooter } = $xeTable.$refs
297
310
  const headerElem = tableHeader ? tableHeader.$el : null
298
311
  const footerElem = tableFooter ? tableFooter.$el : null
299
312
  const bodyElem = tableBody.$el
300
- const scrollLeft = footerElem ? footerElem.scrollLeft : 0
301
- const xHandleEl = $refs.refScrollXHandleElem
302
- if (xHandleEl) {
303
- xHandleEl.scrollLeft = scrollLeft
304
- } else {
305
- const isRollX = true
306
- const isRollY = false
307
- const scrollTop = bodyElem.scrollTop
308
- setScrollLeft(headerElem, scrollLeft)
309
- setScrollLeft(bodyElem, scrollLeft)
310
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
311
- type: renderType,
312
- fixed: fixedType
313
- })
314
- }
313
+ const xHandleEl = $xeTable.$refs.refScrollXHandleElem
314
+ const scrollLeft = footerElem.scrollLeft
315
+ const isRollX = true
316
+ const isRollY = false
317
+ const scrollTop = bodyElem.scrollTop
318
+ tableInternalData.inFooterScroll = true
319
+ setScrollLeft(xHandleEl, scrollLeft)
320
+ setScrollLeft(headerElem, scrollLeft)
321
+ setScrollLeft(bodyElem, scrollLeft)
322
+ $xeTable.triggerScrollXEvent(evnt)
323
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
324
+ type: renderType,
325
+ fixed: fixedType
326
+ })
315
327
  }
316
328
  } as any
317
329
  } as any