vxe-table 3.9.21 → 3.10.0-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 (88) hide show
  1. package/es/locale/lang/ja-JP.js +5 -5
  2. package/es/locale/lang/ko-KR.js +5 -5
  3. package/es/locale/lang/uk-UA.js +5 -5
  4. package/es/locale/lang/vi-VN.js +5 -5
  5. package/es/locale/lang/zh-CHT.js +5 -5
  6. package/es/locale/lang/zh-CN.js +5 -5
  7. package/es/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/table/module/edit/mixin.js +3 -3
  10. package/es/table/src/body.js +50 -115
  11. package/es/table/src/footer.js +24 -21
  12. package/es/table/src/methods.js +392 -123
  13. package/es/table/src/table.js +68 -10
  14. package/es/table/src/util.js +58 -33
  15. package/es/table/style.css +46 -3
  16. package/es/table/style.min.css +1 -1
  17. package/es/ui/index.js +2 -2
  18. package/es/ui/src/log.js +1 -1
  19. package/es/vxe-table/style.css +46 -3
  20. package/es/vxe-table/style.min.css +1 -1
  21. package/lib/index.umd.js +672 -361
  22. package/lib/index.umd.min.js +1 -1
  23. package/lib/locale/lang/ja-JP.js +5 -5
  24. package/lib/locale/lang/ja-JP.min.js +1 -1
  25. package/lib/locale/lang/ja-JP.umd.js +5 -5
  26. package/lib/locale/lang/ko-KR.js +5 -5
  27. package/lib/locale/lang/ko-KR.min.js +1 -1
  28. package/lib/locale/lang/ko-KR.umd.js +5 -5
  29. package/lib/locale/lang/uk-UA.js +5 -5
  30. package/lib/locale/lang/uk-UA.min.js +1 -1
  31. package/lib/locale/lang/uk-UA.umd.js +5 -5
  32. package/lib/locale/lang/vi-VN.js +5 -5
  33. package/lib/locale/lang/vi-VN.min.js +1 -1
  34. package/lib/locale/lang/zh-CHT.js +5 -5
  35. package/lib/locale/lang/zh-CHT.min.js +1 -1
  36. package/lib/locale/lang/zh-CHT.umd.js +5 -5
  37. package/lib/locale/lang/zh-CN.js +5 -5
  38. package/lib/locale/lang/zh-CN.min.js +1 -1
  39. package/lib/locale/lang/zh-CN.umd.js +5 -5
  40. package/lib/style.css +1 -1
  41. package/lib/style.min.css +1 -1
  42. package/lib/table/module/edit/mixin.js +6 -3
  43. package/lib/table/module/edit/mixin.min.js +1 -1
  44. package/lib/table/src/body.js +49 -118
  45. package/lib/table/src/body.min.js +1 -1
  46. package/lib/table/src/footer.js +24 -33
  47. package/lib/table/src/footer.min.js +1 -1
  48. package/lib/table/src/methods.js +449 -148
  49. package/lib/table/src/methods.min.js +1 -1
  50. package/lib/table/src/table.js +61 -13
  51. package/lib/table/src/table.min.js +1 -1
  52. package/lib/table/src/util.js +72 -38
  53. package/lib/table/src/util.min.js +1 -1
  54. package/lib/table/style/style.css +46 -3
  55. package/lib/table/style/style.min.css +1 -1
  56. package/lib/ui/index.js +2 -2
  57. package/lib/ui/index.min.js +1 -1
  58. package/lib/ui/src/log.js +1 -1
  59. package/lib/ui/src/log.min.js +1 -1
  60. package/lib/vxe-table/style/style.css +46 -3
  61. package/lib/vxe-table/style/style.min.css +1 -1
  62. package/package.json +2 -2
  63. package/packages/locale/lang/ja-JP.ts +5 -5
  64. package/packages/locale/lang/ko-KR.ts +5 -5
  65. package/packages/locale/lang/uk-UA.ts +5 -5
  66. package/packages/locale/lang/vi-VN.ts +5 -5
  67. package/packages/locale/lang/zh-CHT.ts +5 -5
  68. package/packages/locale/lang/zh-CN.ts +5 -5
  69. package/packages/table/module/edit/mixin.ts +3 -3
  70. package/packages/table/src/body.ts +50 -118
  71. package/packages/table/src/footer.ts +24 -22
  72. package/packages/table/src/methods.ts +418 -127
  73. package/packages/table/src/props.ts +8 -8
  74. package/packages/table/src/table.ts +70 -10
  75. package/packages/table/src/util.ts +61 -36
  76. package/packages/ui/index.ts +1 -1
  77. package/styles/components/table-module/filter.scss +1 -1
  78. package/styles/components/table.scss +45 -6
  79. package/styles/modules.scss +0 -2
  80. package/styles/theme/base.scss +1 -1
  81. package/styles/theme/dark.scss +7 -4
  82. package/styles/variable.scss +5 -1
  83. /package/es/{iconfont.1729992873866.ttf → iconfont.1730347297462.ttf} +0 -0
  84. /package/es/{iconfont.1729992873866.woff → iconfont.1730347297462.woff} +0 -0
  85. /package/es/{iconfont.1729992873866.woff2 → iconfont.1730347297462.woff2} +0 -0
  86. /package/lib/{iconfont.1729992873866.ttf → iconfont.1730347297462.ttf} +0 -0
  87. /package/lib/{iconfont.1729992873866.woff → iconfont.1730347297462.woff} +0 -0
  88. /package/lib/{iconfont.1729992873866.woff2 → iconfont.1730347297462.woff2} +0 -0
@@ -1,8 +1,8 @@
1
1
  import XEUtils from 'xe-utils';
2
2
  import { VxeUI } from '../../ui';
3
3
  import { isEnableConf, getClass } from '../../ui/src/utils';
4
- import { getOffsetSize, calcTreeLine, mergeBodyMethod, removeScrollListener, restoreScrollListener, getRowid } from './util';
5
- import { updateCellTitle } from '../../ui/src/dom';
4
+ import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid } from './util';
5
+ import { updateCellTitle, setScrollTop, setScrollLeft } from '../../ui/src/dom';
6
6
  import { getSlotVNs } from '../../ui/src/vn';
7
7
  const { getI18n, renderer } = VxeUI;
8
8
  const renderType = 'body';
@@ -49,7 +49,7 @@ function renderLine(h, _vm, $xetable, params) {
49
49
  * 渲染列
50
50
  */
51
51
  function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
52
- const { $listeners: tableListeners, afterFullData, tableData, height, columnKey, overflowX, sYOpts, scrollXLoad, scrollYLoad, highlightCurrentRow, showOverflow: allColumnOverflow, isAllOverflow, align: allAlign, currentColumn, cellClassName: allCellClassName, cellStyle, mergeList, spanMethod, radioOpts, checkboxOpts, expandOpts, treeOpts, tooltipOpts, mouseConfig, editConfig, editOpts, editRules, validOpts, editStore, tooltipConfig, rowOpts, columnOpts, validErrorMaps } = $xetable;
52
+ const { $listeners: tableListeners, fullAllDataRowIdData, afterFullData, tableData, height, columnKey, overflowX, sYOpts, scrollYLoad, highlightCurrentRow, showOverflow: allColumnOverflow, isAllOverflow, align: allAlign, currentColumn, cellClassName: allCellClassName, cellStyle, mergeList, spanMethod, radioOpts, checkboxOpts, expandOpts, treeOpts, tooltipOpts, mouseConfig, editConfig, editOpts, editRules, validOpts, editStore, tooltipConfig, rowOpts, columnOpts, validErrorMaps } = $xetable;
53
53
  const { type, cellRender, editRender, align, showOverflow, className, treeNode, slots } = column;
54
54
  const { actived } = editStore;
55
55
  const { rHeight: scrollYRHeight } = sYOpts;
@@ -64,12 +64,13 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
64
64
  const isEdit = isEnableConf(editRender);
65
65
  let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX;
66
66
  const cellOverflow = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow;
67
- let showEllipsis = cellOverflow === 'ellipsis';
67
+ const showEllipsis = cellOverflow === 'ellipsis';
68
68
  const showTitle = cellOverflow === 'title';
69
69
  const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
70
- let hasEllipsis = showTitle || showTooltip || showEllipsis;
70
+ const hasEllipsis = showTitle || showTooltip || showEllipsis;
71
71
  let isDirty;
72
72
  const tdOns = {};
73
+ const rest = fullAllDataRowIdData[rowid];
73
74
  const cellAlign = align || (compConf ? compConf.tableCellAlign : '') || allAlign;
74
75
  const errorValidItem = validErrorMaps[`${rowid}:${column.id}`];
75
76
  const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? (height || tableData.length > 1) : validOpts.message === 'inline');
@@ -78,10 +79,6 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
78
79
  const bindMouseleave = tableListeners['cell-mouseleave'];
79
80
  const triggerDblclick = (editRender && editConfig && editOpts.trigger === 'dblclick');
80
81
  const params = { $table: $xetable, $grid: $xetable.$xegrid, isEdit: false, seq, rowid, row, rowIndex, $rowIndex, _rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: renderType, isHidden: fixedHiddenColumn, level: rowLevel, visibleData: afterFullData, data: tableData, items };
81
- // 虚拟滚动不支持动态高度
82
- if ((scrollXLoad || scrollYLoad) && !hasEllipsis) {
83
- showEllipsis = hasEllipsis = true;
84
- }
85
82
  // hover 进入事件
86
83
  if (showTitle || showTooltip || showAllTip || bindMouseenter || tooltipConfig) {
87
84
  tdOns.mouseenter = (evnt) => {
@@ -250,7 +247,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
250
247
  key: columnKey || columnOpts.useKey ? column.id : $columnIndex,
251
248
  attrs,
252
249
  style: Object.assign({
253
- height: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : ''
250
+ height: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : (scrollYLoad ? `${rest.height || scrollYRHeight || rowHeight}px` : '')
254
251
  }, XEUtils.isFunction(compCellStyle) ? compCellStyle(params) : compCellStyle, XEUtils.isFunction(cellStyle) ? cellStyle(params) : cellStyle),
255
252
  on: tdOns
256
253
  }, tdVNs);
@@ -374,45 +371,6 @@ function renderRows(h, _vm, $xetable, fixedType, tableData, tableColumn) {
374
371
  });
375
372
  return rows;
376
373
  }
377
- /**
378
- * 同步滚动条
379
- */
380
- let scrollProcessTimeout;
381
- function syncBodyScroll(_vm, fixedType, scrollTop, elem1, elem2) {
382
- if (elem1 || elem2) {
383
- if (elem1) {
384
- removeScrollListener(elem1);
385
- elem1.scrollTop = scrollTop;
386
- }
387
- if (elem2) {
388
- removeScrollListener(elem2);
389
- elem2.scrollTop = scrollTop;
390
- }
391
- clearTimeout(scrollProcessTimeout);
392
- scrollProcessTimeout = setTimeout(() => {
393
- // const { tableBody, leftBody, rightBody } = _vm.$refs
394
- // const bodyElem = tableBody.$el
395
- // const leftElem = leftBody ? leftBody.$el : null
396
- // const rightElem = rightBody ? rightBody.$el : null
397
- restoreScrollListener(elem1);
398
- restoreScrollListener(elem2);
399
- // 检查滚动条是的同步
400
- // let targetTop = bodyElem.scrollTop
401
- // if (fixedType === 'left') {
402
- // if (leftElem) {
403
- // targetTop = leftElem.scrollTop
404
- // }
405
- // } else if (fixedType === 'right') {
406
- // if (rightElem) {
407
- // targetTop = rightElem.scrollTop
408
- // }
409
- // }
410
- // setScrollTop(bodyElem, targetTop)
411
- // setScrollTop(leftElem, targetTop)
412
- // setScrollTop(rightElem, targetTop)
413
- }, 300);
414
- }
415
- }
416
374
  export default {
417
375
  name: 'VxeTableBody',
418
376
  props: {
@@ -441,17 +399,9 @@ export default {
441
399
  elemStore[`${prefix}xSpace`] = $refs.xSpace;
442
400
  elemStore[`${prefix}ySpace`] = $refs.ySpace;
443
401
  elemStore[`${prefix}emptyBlock`] = $refs.emptyBlock;
444
- if (this.$el) {
445
- this.$el.onscroll = this.scrollEvent;
446
- this.$el._onscroll = this.scrollEvent;
447
- }
448
402
  },
449
403
  beforeDestroy() {
450
404
  clearTimeout(this.wheelTime);
451
- if (this.$el) {
452
- this.$el._onscroll = null;
453
- this.$el.onscroll = null;
454
- }
455
405
  },
456
406
  destroyed() {
457
407
  const { $parent: $xetable, fixedType } = this;
@@ -510,11 +460,9 @@ export default {
510
460
  attrs: {
511
461
  xid: tId
512
462
  },
513
- on: scrollYLoad && sYOpts.mode === 'wheel'
514
- ? {
515
- wheel: this.wheelEvent
516
- }
517
- : {}
463
+ on: Object.assign({
464
+ scroll: this.scrollEvent
465
+ }, scrollYLoad && sYOpts.mode === 'wheel' ? { wheel: this.wheelEvent } : null)
518
466
  }, [
519
467
  fixedType
520
468
  ? _e()
@@ -610,73 +558,60 @@ export default {
610
558
  * 如果存在列固定右侧,同步更新滚动状态
611
559
  */
612
560
  scrollEvent(evnt) {
613
- const { $el: scrollBodyElem, $parent: $xetable, fixedType } = this;
614
- const { $refs, elemStore, highlightHoverRow, scrollXLoad, scrollYLoad, lastScrollTop, lastScrollLeft, rowOpts } = $xetable;
615
- const { tableHeader, tableBody, leftBody, rightBody, tableFooter, validTip } = $refs;
561
+ const { $el: scrollBodyElem, $parent: $xeTable, fixedType } = this;
562
+ const { $refs, lastScrollTop, lastScrollLeft } = $xeTable;
563
+ const { tableHeader, tableBody, leftBody, rightBody, tableFooter } = $refs;
616
564
  const headerElem = tableHeader ? tableHeader.$el : null;
617
565
  const footerElem = tableFooter ? tableFooter.$el : null;
618
566
  const bodyElem = tableBody.$el;
619
567
  const leftElem = leftBody ? leftBody.$el : null;
620
568
  const rightElem = rightBody ? rightBody.$el : null;
621
- const bodyYElem = elemStore['main-body-ySpace'];
622
- const bodyXElem = elemStore['main-body-xSpace'];
623
- const bodyHeight = scrollYLoad && bodyYElem ? bodyYElem.clientHeight : bodyElem.clientHeight;
624
- const bodyWidth = scrollXLoad && bodyXElem ? bodyXElem.clientWidth : bodyElem.clientWidth;
625
- let scrollTop = scrollBodyElem.scrollTop;
569
+ const scrollTop = scrollBodyElem.scrollTop;
626
570
  const scrollLeft = bodyElem.scrollLeft;
627
571
  const isRollX = scrollLeft !== lastScrollLeft;
628
572
  const isRollY = scrollTop !== lastScrollTop;
629
- $xetable.lastScrollTop = scrollTop;
630
- $xetable.lastScrollLeft = scrollLeft;
631
- $xetable.lastScrollTime = Date.now();
632
- if (rowOpts.isHover || highlightHoverRow) {
633
- $xetable.clearHoverRow();
573
+ const xHandleEl = $refs.refScrollXHandleElem;
574
+ const yHandleEl = $refs.refScrollYHandleElem;
575
+ if (yHandleEl) {
576
+ yHandleEl.scrollTop = scrollTop;
634
577
  }
635
- if (leftElem && fixedType === 'left') {
636
- scrollTop = leftElem.scrollTop;
637
- syncBodyScroll($xetable, fixedType, scrollTop, bodyElem, rightElem);
638
- }
639
- else if (rightElem && fixedType === 'right') {
640
- scrollTop = rightElem.scrollTop;
641
- syncBodyScroll($xetable, fixedType, scrollTop, bodyElem, leftElem);
642
- }
643
- else {
644
- if (isRollX) {
645
- if (headerElem) {
646
- headerElem.scrollLeft = bodyElem.scrollLeft;
647
- }
648
- if (footerElem) {
649
- footerElem.scrollLeft = bodyElem.scrollLeft;
650
- }
578
+ else if (isRollY) {
579
+ $xeTable.lastScrollTop = scrollTop;
580
+ $xeTable.lastScrollLeft = scrollLeft;
581
+ if (leftElem && fixedType === 'left') {
582
+ setScrollTop(bodyElem, scrollTop);
583
+ setScrollTop(rightElem, scrollTop);
651
584
  }
652
- if (leftElem || rightElem) {
653
- $xetable.checkScrolling();
654
- if (isRollY) {
655
- syncBodyScroll($xetable, fixedType, scrollTop, leftElem, rightElem);
656
- }
585
+ else if (rightElem && fixedType === 'right') {
586
+ setScrollTop(bodyElem, scrollTop);
587
+ setScrollTop(leftElem, scrollTop);
657
588
  }
589
+ else {
590
+ setScrollTop(leftElem, scrollTop);
591
+ setScrollTop(rightElem, scrollTop);
592
+ }
593
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
594
+ type: renderType,
595
+ fixed: fixedType,
596
+ scrollTop,
597
+ scrollLeft
598
+ });
658
599
  }
659
- if (scrollXLoad && isRollX) {
660
- $xetable.triggerScrollXEvent(evnt);
661
- }
662
- if (scrollYLoad && isRollY) {
663
- $xetable.triggerScrollYEvent(evnt);
600
+ if (xHandleEl) {
601
+ xHandleEl.scrollLeft = scrollLeft;
664
602
  }
665
- if (isRollX && validTip && validTip.visible) {
666
- validTip.updatePlacement();
603
+ else if (isRollX) {
604
+ $xeTable.lastScrollTop = scrollTop;
605
+ $xeTable.lastScrollLeft = scrollLeft;
606
+ setScrollLeft(headerElem, scrollLeft);
607
+ setScrollLeft(footerElem, scrollLeft);
608
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
609
+ type: renderType,
610
+ fixed: fixedType,
611
+ scrollTop,
612
+ scrollLeft
613
+ });
667
614
  }
668
- $xetable.emitEvent('scroll', {
669
- type: renderType,
670
- fixed: fixedType,
671
- scrollTop,
672
- scrollLeft,
673
- scrollHeight: bodyElem.scrollHeight,
674
- scrollWidth: bodyElem.scrollWidth,
675
- bodyHeight,
676
- bodyWidth,
677
- isX: isRollX,
678
- isY: isRollY
679
- }, evnt);
680
615
  },
681
616
  handleWheel(evnt, isTopWheel, deltaTop, isRollX, isRollY) {
682
617
  const { $parent: $xetable } = this;
@@ -1,8 +1,8 @@
1
1
  import XEUtils from 'xe-utils';
2
2
  import { VxeUI } from '../../ui';
3
3
  import { getClass } from '../../ui/src/utils';
4
- import { updateCellTitle } from '../../ui/src/dom';
5
- const cellType = 'footer';
4
+ import { updateCellTitle, setScrollLeft } from '../../ui/src/dom';
5
+ const renderType = 'footer';
6
6
  const { renderer } = VxeUI;
7
7
  function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
8
8
  for (let mIndex = 0; mIndex < mergeFooterList.length; mIndex++) {
@@ -117,7 +117,7 @@ export default {
117
117
  ref: 'tfoot'
118
118
  }, footerTableData.map((list, _rowIndex) => {
119
119
  const $rowIndex = _rowIndex;
120
- const rowParams = { $table: $xetable, row: list, _rowIndex, $rowIndex, fixed: fixedType, type: cellType };
120
+ const rowParams = { $table: $xetable, row: list, _rowIndex, $rowIndex, fixed: fixedType, type: renderType };
121
121
  return h('tr', {
122
122
  class: ['vxe-footer--row', footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''],
123
123
  style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) : null
@@ -152,7 +152,7 @@ export default {
152
152
  itemIndex,
153
153
  items: list,
154
154
  fixed: fixedType,
155
- type: cellType,
155
+ type: renderType,
156
156
  data: footerTableData
157
157
  };
158
158
  // 虚拟滚动不支持动态高度
@@ -255,29 +255,32 @@ export default {
255
255
  * 如果存在列固定右侧,同步更新滚动状态
256
256
  */
257
257
  scrollEvent(evnt) {
258
- const { $parent: $xetable, fixedType } = this;
259
- const { $refs, scrollXLoad, triggerScrollXEvent, lastScrollLeft } = $xetable;
260
- const { tableHeader, tableBody, tableFooter, validTip } = $refs;
258
+ const { $parent: $xeTable, fixedType } = this;
259
+ const { $refs } = $xeTable;
260
+ const { tableHeader, tableBody, tableFooter } = $refs;
261
261
  const headerElem = tableHeader ? tableHeader.$el : null;
262
262
  const footerElem = tableFooter ? tableFooter.$el : null;
263
263
  const bodyElem = tableBody.$el;
264
264
  const scrollLeft = footerElem ? footerElem.scrollLeft : 0;
265
- const isX = scrollLeft !== lastScrollLeft;
266
- $xetable.lastScrollLeft = scrollLeft;
267
- $xetable.lastScrollTime = Date.now();
268
- if (headerElem) {
269
- headerElem.scrollLeft = scrollLeft;
265
+ const xHandleEl = $refs.refScrollXHandleElem;
266
+ if (xHandleEl) {
267
+ xHandleEl.scrollLeft = scrollLeft;
270
268
  }
271
- if (bodyElem) {
272
- bodyElem.scrollLeft = scrollLeft;
273
- }
274
- if (scrollXLoad && isX) {
275
- triggerScrollXEvent(evnt);
276
- }
277
- if (isX && validTip && validTip.visible) {
278
- validTip.updatePlacement();
269
+ else {
270
+ const isRollX = true;
271
+ const isRollY = false;
272
+ const scrollTop = bodyElem.scrollTop;
273
+ $xeTable.lastScrollLeft = scrollLeft;
274
+ $xeTable.lastScrollTime = Date.now();
275
+ setScrollLeft(headerElem, scrollLeft);
276
+ setScrollLeft(bodyElem, scrollLeft);
277
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
278
+ type: renderType,
279
+ fixed: fixedType,
280
+ scrollTop,
281
+ scrollLeft
282
+ });
279
283
  }
280
- $xetable.emitEvent('scroll', { type: cellType, fixed: fixedType, scrollTop: bodyElem.scrollTop, scrollLeft, isX, isY: false }, evnt);
281
284
  }
282
285
  }
283
286
  };