vxe-table 3.11.23 → 3.11.25

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 (53) hide show
  1. package/es/{iconfont.1733805838288.ttf → iconfont.1733882708391.ttf} +0 -0
  2. package/es/iconfont.1733882708391.woff +0 -0
  3. package/es/iconfont.1733882708391.woff2 +0 -0
  4. package/es/index.css +1 -1
  5. package/es/index.min.css +1 -1
  6. package/es/style.css +1 -1
  7. package/es/style.min.css +1 -1
  8. package/es/table/module/filter/mixin.js +37 -21
  9. package/es/table/src/methods.js +80 -13
  10. package/es/table/src/table.js +3 -0
  11. package/es/table/style.css +15 -2
  12. package/es/table/style.min.css +1 -1
  13. package/es/ui/index.js +2 -1
  14. package/es/ui/src/log.js +1 -1
  15. package/es/vxe-table/style.css +15 -2
  16. package/es/vxe-table/style.min.css +1 -1
  17. package/lib/{iconfont.1733805838288.ttf → iconfont.1733882708391.ttf} +0 -0
  18. package/lib/iconfont.1733882708391.woff +0 -0
  19. package/lib/iconfont.1733882708391.woff2 +0 -0
  20. package/lib/index.css +1 -1
  21. package/lib/index.min.css +1 -1
  22. package/lib/index.umd.js +155 -50
  23. package/lib/index.umd.min.js +1 -1
  24. package/lib/style.css +1 -1
  25. package/lib/style.min.css +1 -1
  26. package/lib/table/module/filter/mixin.js +43 -25
  27. package/lib/table/module/filter/mixin.min.js +1 -1
  28. package/lib/table/src/methods.js +107 -23
  29. package/lib/table/src/methods.min.js +1 -1
  30. package/lib/table/src/table.js +2 -0
  31. package/lib/table/src/table.min.js +1 -1
  32. package/lib/table/style/style.css +15 -2
  33. package/lib/table/style/style.min.css +1 -1
  34. package/lib/ui/index.js +2 -1
  35. package/lib/ui/index.min.js +1 -1
  36. package/lib/ui/src/log.js +1 -1
  37. package/lib/ui/src/log.min.js +1 -1
  38. package/lib/vxe-table/style/style.css +15 -2
  39. package/lib/vxe-table/style/style.min.css +1 -1
  40. package/package.json +2 -2
  41. package/packages/table/module/filter/mixin.ts +42 -21
  42. package/packages/table/src/methods.ts +83 -13
  43. package/packages/table/src/table.ts +3 -0
  44. package/packages/ui/index.ts +1 -0
  45. package/styles/components/icon.scss +5 -1
  46. package/styles/components/table.scss +12 -1
  47. package/styles/icon/iconfont.ttf +0 -0
  48. package/styles/icon/iconfont.woff +0 -0
  49. package/styles/icon/iconfont.woff2 +0 -0
  50. package/es/iconfont.1733805838288.woff +0 -0
  51. package/es/iconfont.1733805838288.woff2 +0 -0
  52. package/lib/iconfont.1733805838288.woff +0 -0
  53. package/lib/iconfont.1733805838288.woff2 +0 -0
package/lib/index.umd.js CHANGED
@@ -2220,7 +2220,7 @@ function getClass(property, params) {
2220
2220
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2221
2221
 
2222
2222
 
2223
- const version = "3.11.23";
2223
+ const version = "3.11.25";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2469,6 +2469,7 @@ core_.VxeUI.setIcon({
2469
2469
  TABLE_DRAG_ROW: iconPrefix + 'drag-handle',
2470
2470
  TABLE_DRAG_COLUMN: iconPrefix + 'drag-handle',
2471
2471
  TABLE_DRAG_STATUS_ROW: iconPrefix + 'sort',
2472
+ TABLE_DRAG_STATUS_SUB_ROW: iconPrefix + 'add-sub',
2472
2473
  TABLE_DRAG_STATUS_COLUMN: iconPrefix + 'swap',
2473
2474
  TABLE_DRAG_DISABLED: iconPrefix + 'no-drop',
2474
2475
  // toolbar
@@ -2788,7 +2789,7 @@ function isNodeElement(elem) {
2788
2789
  const {
2789
2790
  log: log_log
2790
2791
  } = core_.VxeUI;
2791
- const log_version = `table v${"3.11.23"}`;
2792
+ const log_version = `table v${"3.11.25"}`;
2792
2793
  const warnLog = log_log.create('warn', log_version);
2793
2794
  const errLog = log_log.create('error', log_version);
2794
2795
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -5350,6 +5351,7 @@ const updateColDropTipContent = ($xeTable, tdEl) => {
5350
5351
  };
5351
5352
  function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
5352
5353
  const reactData = $xeTable;
5354
+ const internalData = $xeTable;
5353
5355
  const el = $xeTable.$refs.refElem;
5354
5356
  if (!el) {
5355
5357
  return;
@@ -5358,6 +5360,9 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
5358
5360
  scrollbarWidth,
5359
5361
  scrollbarHeight
5360
5362
  } = reactData;
5363
+ const {
5364
+ prevDragToChild
5365
+ } = internalData;
5361
5366
  const wrapperRect = el.getBoundingClientRect();
5362
5367
  if (trEl) {
5363
5368
  const rdLineEl = $xeTable.$refs.refDragRowLineElem;
@@ -5369,6 +5374,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
5369
5374
  rdLineEl.style.height = `${trRect.height}px`;
5370
5375
  rdLineEl.style.width = `${wrapperRect.width - scrollbarWidth}px`;
5371
5376
  rdLineEl.setAttribute('drag-pos', dragPos);
5377
+ rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
5372
5378
  } else {
5373
5379
  rdLineEl.style.display = '';
5374
5380
  }
@@ -5393,7 +5399,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
5393
5399
  rdTipEl.style.display = 'block';
5394
5400
  rdTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
5395
5401
  rdTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
5396
- rdTipEl.setAttribute('drag-status', showLine ? 'normal' : 'disabled');
5402
+ rdTipEl.setAttribute('drag-status', showLine ? prevDragToChild ? 'sub' : 'normal' : 'disabled');
5397
5403
  }
5398
5404
  }
5399
5405
  const hideDropTip = $xeTable => {
@@ -5945,6 +5951,9 @@ const Methods = {
5945
5951
  };
5946
5952
  }
5947
5953
  if (isSource) {
5954
+ cacheItem.row = row;
5955
+ cacheItem.items = items;
5956
+ cacheItem.parent = parent;
5948
5957
  cacheItem.level = level;
5949
5958
  cacheItem.index = treeConfig && parent ? -1 : index;
5950
5959
  fullDataRowIdMaps[rowid] = cacheItem;
@@ -10805,13 +10814,40 @@ const Methods = {
10805
10814
  }
10806
10815
  }
10807
10816
  },
10817
+ handleColumnSortEvent(evnt, column) {
10818
+ const $xeTable = this;
10819
+ const props = $xeTable;
10820
+ const {
10821
+ mouseConfig
10822
+ } = props;
10823
+ const mouseOpts = $xeTable.computeMouseOpts;
10824
+ const {
10825
+ field,
10826
+ sortable
10827
+ } = column;
10828
+ if (sortable) {
10829
+ const params = {
10830
+ $table: $xeTable,
10831
+ $event: evnt,
10832
+ column,
10833
+ field,
10834
+ property: field,
10835
+ order: column.order,
10836
+ sortList: $xeTable.getSortColumns(),
10837
+ sortTime: column.sortTime
10838
+ };
10839
+ if (mouseConfig && mouseOpts.area && $xeTable.handleSortEvent) {
10840
+ $xeTable.handleSortEvent(evnt, params);
10841
+ }
10842
+ $xeTable.dispatchEvent('sort-change', params, evnt);
10843
+ }
10844
+ },
10808
10845
  /**
10809
10846
  * 点击排序事件
10810
10847
  */
10811
10848
  triggerSortEvent(evnt, column, order) {
10812
- const {
10813
- sortOpts
10814
- } = this;
10849
+ const $xeTable = this;
10850
+ const sortOpts = $xeTable.computeSortOpts;
10815
10851
  const {
10816
10852
  field,
10817
10853
  sortable,
@@ -10819,27 +10855,14 @@ const Methods = {
10819
10855
  } = column;
10820
10856
  if (sortable || remoteSort) {
10821
10857
  if (!order || column.order === order) {
10822
- this.clearSort(sortOpts.multiple ? column : null);
10858
+ $xeTable.clearSort(sortOpts.multiple ? column : null);
10823
10859
  } else {
10824
- this.sort({
10860
+ $xeTable.sort({
10825
10861
  field,
10826
10862
  order
10827
10863
  });
10828
10864
  }
10829
- const params = {
10830
- $table: this,
10831
- $event: evnt,
10832
- column,
10833
- field,
10834
- property: field,
10835
- order: column.order,
10836
- sortList: this.getSortColumns(),
10837
- sortTime: column.sortTime
10838
- };
10839
- if (this.mouseConfig && this.mouseOpts.area && this.handleSortEvent) {
10840
- this.handleSortEvent(evnt, params);
10841
- }
10842
- this.emitEvent('sort-change', params, evnt);
10865
+ $xeTable.handleColumnSortEvent(evnt, column);
10843
10866
  }
10844
10867
  },
10845
10868
  /**
@@ -10862,7 +10885,8 @@ const Methods = {
10862
10885
  } = props;
10863
10886
  const rowDragOpts = $xeTable.computeRowDragOpts;
10864
10887
  const {
10865
- fullAllDataRowIdData
10888
+ fullAllDataRowIdData,
10889
+ prevDragToChild
10866
10890
  } = internalData;
10867
10891
  const {
10868
10892
  isCrossDrag,
@@ -10872,6 +10896,7 @@ const Methods = {
10872
10896
  const treeOpts = $xeTable.computeTreeOpts;
10873
10897
  const {
10874
10898
  transform,
10899
+ rowField,
10875
10900
  mapChildrenField,
10876
10901
  parentField
10877
10902
  } = treeOpts;
@@ -10981,7 +11006,7 @@ const Methods = {
10981
11006
  childRow[parentField] = dragRow[parentField];
10982
11007
  });
10983
11008
  }
10984
- dragRow[parentField] = prevDragRow[parentField];
11009
+ dragRow[parentField] = prevDragToChild ? prevDragRow[rowField] : prevDragRow[parentField];
10985
11010
  internalData.tableFullTreeData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(fullList, {
10986
11011
  key: treeOpts.rowField,
10987
11012
  parentKey: treeOpts.parentField,
@@ -11054,14 +11079,20 @@ const Methods = {
11054
11079
  const {
11055
11080
  dragRow
11056
11081
  } = reactData;
11082
+ const treeOpts = $xeTable.computeTreeOpts;
11083
+ const {
11084
+ transform
11085
+ } = treeOpts;
11057
11086
  const rowDragOpts = $xeTable.computeRowDragOpts;
11058
11087
  const {
11059
- isCrossDrag
11088
+ isCrossDrag,
11089
+ isToChildDrag
11060
11090
  } = rowDragOpts;
11061
11091
  if (!dragRow) {
11062
11092
  evnt.preventDefault();
11063
11093
  return;
11064
11094
  }
11095
+ const hasCtrlKey = evnt.ctrlKey;
11065
11096
  const trEl = evnt.currentTarget;
11066
11097
  const rowid = trEl.getAttribute('rowid') || '';
11067
11098
  const rest = fullAllDataRowIdData[rowid];
@@ -11077,6 +11108,7 @@ const Methods = {
11077
11108
  showDropTip($xeTable, evnt, trEl, null, false, dragPos);
11078
11109
  return;
11079
11110
  }
11111
+ internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && hasCtrlKey);
11080
11112
  internalData.prevDragRow = row;
11081
11113
  internalData.prevDragPos = dragPos;
11082
11114
  showDropTip($xeTable, evnt, trEl, null, true, dragPos);
@@ -11252,6 +11284,7 @@ const Methods = {
11252
11284
  showDropTip($xeTable, evnt, null, thEl, false, dragPos);
11253
11285
  return;
11254
11286
  }
11287
+ internalData.prevDragToChild = false;
11255
11288
  internalData.prevDragCol = column;
11256
11289
  internalData.prevDragPos = dragPos;
11257
11290
  showDropTip($xeTable, evnt, null, thEl, true, dragPos);
@@ -11432,6 +11465,58 @@ const Methods = {
11432
11465
  }
11433
11466
  return this.$nextTick();
11434
11467
  },
11468
+ setSort(sortConfs, isUpdate) {
11469
+ const $xeTable = this;
11470
+ const sortOpts = $xeTable.computeSortOpts;
11471
+ const {
11472
+ multiple,
11473
+ remote,
11474
+ orders
11475
+ } = sortOpts;
11476
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortConfs)) {
11477
+ sortConfs = [sortConfs];
11478
+ }
11479
+ if (sortConfs && sortConfs.length) {
11480
+ if (!multiple) {
11481
+ sortConfs = [sortConfs[0]];
11482
+ clearAllSort($xeTable);
11483
+ }
11484
+ let firstColumn = null;
11485
+ sortConfs.forEach((confs, index) => {
11486
+ let {
11487
+ field,
11488
+ order
11489
+ } = confs;
11490
+ let column = field;
11491
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(field)) {
11492
+ column = $xeTable.getColumnByField(field);
11493
+ }
11494
+ if (!firstColumn) {
11495
+ firstColumn = column;
11496
+ }
11497
+ if (column && column.sortable) {
11498
+ if (orders.indexOf(order) === -1) {
11499
+ order = getNextSortOrder($xeTable, column);
11500
+ }
11501
+ if (column.order !== order) {
11502
+ column.order = order;
11503
+ }
11504
+ column.sortTime = Date.now() + index;
11505
+ }
11506
+ });
11507
+ if (isUpdate) {
11508
+ if (!remote) {
11509
+ $xeTable.handleTableData(true);
11510
+ }
11511
+ $xeTable.handleColumnSortEvent(new Event('click'), firstColumn);
11512
+ }
11513
+ return $xeTable.$nextTick().then(() => {
11514
+ $xeTable.updateCellAreas();
11515
+ return $xeTable.updateStyle();
11516
+ });
11517
+ }
11518
+ return $xeTable.$nextTick();
11519
+ },
11435
11520
  /**
11436
11521
  * 清空指定列的排序条件
11437
11522
  * 如果为空则清空所有列的排序条件
@@ -17491,12 +17576,16 @@ const {
17491
17576
  * @param {ColumnInfo} fieldOrColumn 列
17492
17577
  * @param {Array} options 选项
17493
17578
  */
17494
- _setFilter(fieldOrColumn, options, update) {
17579
+ _setFilter(fieldOrColumn, options, isUpdate) {
17580
+ const $xeTable = this;
17495
17581
  const column = handleFieldOrColumn(this, fieldOrColumn);
17496
17582
  if (column && column.filters) {
17497
17583
  column.filters = toFilters(options || []);
17584
+ if (isUpdate) {
17585
+ return $xeTable.handleColumnConfirmFilter(column, new Event('click'));
17586
+ }
17498
17587
  }
17499
- return update ? this.updateData() : this.$nextTick();
17588
+ return $xeTable.$nextTick();
17500
17589
  },
17501
17590
  checkFilterOptions() {
17502
17591
  const {
@@ -17682,21 +17771,19 @@ const {
17682
17771
  });
17683
17772
  return filterList;
17684
17773
  },
17685
- /**
17686
- * 确认筛选
17687
- * 当筛选面板中的确定按钮被按下时触发
17688
- * @param {Event} evnt 事件
17689
- */
17690
- confirmFilterEvent(evnt) {
17774
+ handleColumnConfirmFilter(column, evnt) {
17775
+ const $xeTable = this;
17776
+ const props = $xeTable;
17777
+ const reactData = $xeTable;
17778
+ const {
17779
+ mouseConfig
17780
+ } = props;
17691
17781
  const {
17692
- filterStore,
17693
- filterOpts,
17694
17782
  scrollXLoad: oldScrollXLoad,
17695
17783
  scrollYLoad: oldScrollYLoad
17696
- } = this;
17697
- const {
17698
- column
17699
- } = filterStore;
17784
+ } = reactData;
17785
+ const filterOpts = $xeTable.computeFilterOpts;
17786
+ const mouseOpts = $xeTable.computeMouseOpts;
17700
17787
  const {
17701
17788
  field
17702
17789
  } = column;
@@ -17725,35 +17812,51 @@ const {
17725
17812
  this.handleTableData(true);
17726
17813
  this.checkSelectionStatus();
17727
17814
  }
17728
- if (this.mouseConfig && this.mouseOpts.area && this.handleFilterEvent) {
17729
- this.handleFilterEvent(evnt, params);
17815
+ if (mouseConfig && mouseOpts.area && this.handleFilterEvent) {
17816
+ $xeTable.handleFilterEvent(evnt, params);
17730
17817
  }
17731
17818
  if (evnt) {
17732
- this.emitEvent('filter-change', params, evnt);
17819
+ $xeTable.emitEvent('filter-change', params, evnt);
17733
17820
  }
17734
- this.closeFilter();
17735
- this.updateFooter().then(() => {
17821
+ $xeTable.closeFilter();
17822
+ return $xeTable.updateFooter().then(() => {
17736
17823
  const {
17737
17824
  scrollXLoad,
17738
17825
  scrollYLoad
17739
17826
  } = this;
17740
17827
  if (oldScrollXLoad || scrollXLoad || oldScrollYLoad || scrollYLoad) {
17741
17828
  if (oldScrollXLoad || scrollXLoad) {
17742
- this.updateScrollXSpace();
17829
+ $xeTable.updateScrollXSpace();
17743
17830
  }
17744
17831
  if (oldScrollYLoad || scrollYLoad) {
17745
- this.updateScrollYSpace();
17832
+ $xeTable.updateScrollYSpace();
17746
17833
  }
17747
- return this.refreshScroll();
17834
+ return $xeTable.refreshScroll();
17748
17835
  }
17749
17836
  }).then(() => {
17750
- this.updateCellAreas();
17751
- return this.recalculate(true);
17837
+ $xeTable.updateCellAreas();
17838
+ return $xeTable.recalculate(true);
17752
17839
  }).then(() => {
17753
17840
  // 存在滚动行为未结束情况
17754
- setTimeout(() => this.recalculate(), 50);
17841
+ setTimeout(() => $xeTable.recalculate(), 50);
17755
17842
  });
17756
17843
  },
17844
+ /**
17845
+ * 确认筛选
17846
+ * 当筛选面板中的确定按钮被按下时触发
17847
+ * @param {Event} evnt 事件
17848
+ */
17849
+ confirmFilterEvent(evnt) {
17850
+ const $xeTable = this;
17851
+ const reactData = $xeTable;
17852
+ const {
17853
+ filterStore
17854
+ } = reactData;
17855
+ const {
17856
+ column
17857
+ } = filterStore;
17858
+ $xeTable.handleColumnConfirmFilter(column, evnt);
17859
+ },
17757
17860
  handleClearFilter(column) {
17758
17861
  if (column) {
17759
17862
  const {
@@ -22562,6 +22665,8 @@ const renderDragTip = (h, $xeTable) => {
22562
22665
  class: 'vxe-table--drag-sort-tip-status'
22563
22666
  }, [h('span', {
22564
22667
  class: ['vxe-table--drag-sort-tip-normal-status', dragRow ? table_getIcon().TABLE_DRAG_STATUS_ROW : table_getIcon().TABLE_DRAG_STATUS_COLUMN]
22668
+ }), h('span', {
22669
+ class: ['vxe-table--drag-sort-tip-sub-status', table_getIcon().TABLE_DRAG_STATUS_SUB_ROW]
22565
22670
  }), h('span', {
22566
22671
  class: ['vxe-table--drag-sort-tip-disabled-status', table_getIcon().TABLE_DRAG_DISABLED]
22567
22672
  })]), h('div', {