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
@@ -503,6 +503,7 @@ const updateColDropTipContent = ($xeTable, tdEl) => {
503
503
  };
504
504
  function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
505
505
  const reactData = $xeTable;
506
+ const internalData = $xeTable;
506
507
  const el = $xeTable.$refs.refElem;
507
508
  if (!el) {
508
509
  return;
@@ -511,6 +512,9 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
511
512
  scrollbarWidth,
512
513
  scrollbarHeight
513
514
  } = reactData;
515
+ const {
516
+ prevDragToChild
517
+ } = internalData;
514
518
  const wrapperRect = el.getBoundingClientRect();
515
519
  if (trEl) {
516
520
  const rdLineEl = $xeTable.$refs.refDragRowLineElem;
@@ -522,6 +526,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
522
526
  rdLineEl.style.height = `${trRect.height}px`;
523
527
  rdLineEl.style.width = `${wrapperRect.width - scrollbarWidth}px`;
524
528
  rdLineEl.setAttribute('drag-pos', dragPos);
529
+ rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
525
530
  } else {
526
531
  rdLineEl.style.display = '';
527
532
  }
@@ -546,7 +551,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
546
551
  rdTipEl.style.display = 'block';
547
552
  rdTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
548
553
  rdTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
549
- rdTipEl.setAttribute('drag-status', showLine ? 'normal' : 'disabled');
554
+ rdTipEl.setAttribute('drag-status', showLine ? prevDragToChild ? 'sub' : 'normal' : 'disabled');
550
555
  }
551
556
  }
552
557
  const hideDropTip = $xeTable => {
@@ -1096,6 +1101,9 @@ const Methods = {
1096
1101
  };
1097
1102
  }
1098
1103
  if (isSource) {
1104
+ cacheItem.row = row;
1105
+ cacheItem.items = items;
1106
+ cacheItem.parent = parent;
1099
1107
  cacheItem.level = level;
1100
1108
  cacheItem.index = treeConfig && parent ? -1 : index;
1101
1109
  fullDataRowIdMaps[rowid] = cacheItem;
@@ -5951,13 +5959,40 @@ const Methods = {
5951
5959
  }
5952
5960
  }
5953
5961
  },
5962
+ handleColumnSortEvent(evnt, column) {
5963
+ const $xeTable = this;
5964
+ const props = $xeTable;
5965
+ const {
5966
+ mouseConfig
5967
+ } = props;
5968
+ const mouseOpts = $xeTable.computeMouseOpts;
5969
+ const {
5970
+ field,
5971
+ sortable
5972
+ } = column;
5973
+ if (sortable) {
5974
+ const params = {
5975
+ $table: $xeTable,
5976
+ $event: evnt,
5977
+ column,
5978
+ field,
5979
+ property: field,
5980
+ order: column.order,
5981
+ sortList: $xeTable.getSortColumns(),
5982
+ sortTime: column.sortTime
5983
+ };
5984
+ if (mouseConfig && mouseOpts.area && $xeTable.handleSortEvent) {
5985
+ $xeTable.handleSortEvent(evnt, params);
5986
+ }
5987
+ $xeTable.dispatchEvent('sort-change', params, evnt);
5988
+ }
5989
+ },
5954
5990
  /**
5955
5991
  * 点击排序事件
5956
5992
  */
5957
5993
  triggerSortEvent(evnt, column, order) {
5958
- const {
5959
- sortOpts
5960
- } = this;
5994
+ const $xeTable = this;
5995
+ const sortOpts = $xeTable.computeSortOpts;
5961
5996
  const {
5962
5997
  field,
5963
5998
  sortable,
@@ -5965,27 +6000,14 @@ const Methods = {
5965
6000
  } = column;
5966
6001
  if (sortable || remoteSort) {
5967
6002
  if (!order || column.order === order) {
5968
- this.clearSort(sortOpts.multiple ? column : null);
6003
+ $xeTable.clearSort(sortOpts.multiple ? column : null);
5969
6004
  } else {
5970
- this.sort({
6005
+ $xeTable.sort({
5971
6006
  field,
5972
6007
  order
5973
6008
  });
5974
6009
  }
5975
- const params = {
5976
- $table: this,
5977
- $event: evnt,
5978
- column,
5979
- field,
5980
- property: field,
5981
- order: column.order,
5982
- sortList: this.getSortColumns(),
5983
- sortTime: column.sortTime
5984
- };
5985
- if (this.mouseConfig && this.mouseOpts.area && this.handleSortEvent) {
5986
- this.handleSortEvent(evnt, params);
5987
- }
5988
- this.emitEvent('sort-change', params, evnt);
6010
+ $xeTable.handleColumnSortEvent(evnt, column);
5989
6011
  }
5990
6012
  },
5991
6013
  /**
@@ -6008,7 +6030,8 @@ const Methods = {
6008
6030
  } = props;
6009
6031
  const rowDragOpts = $xeTable.computeRowDragOpts;
6010
6032
  const {
6011
- fullAllDataRowIdData
6033
+ fullAllDataRowIdData,
6034
+ prevDragToChild
6012
6035
  } = internalData;
6013
6036
  const {
6014
6037
  isCrossDrag,
@@ -6018,6 +6041,7 @@ const Methods = {
6018
6041
  const treeOpts = $xeTable.computeTreeOpts;
6019
6042
  const {
6020
6043
  transform,
6044
+ rowField,
6021
6045
  mapChildrenField,
6022
6046
  parentField
6023
6047
  } = treeOpts;
@@ -6127,7 +6151,7 @@ const Methods = {
6127
6151
  childRow[parentField] = dragRow[parentField];
6128
6152
  });
6129
6153
  }
6130
- dragRow[parentField] = prevDragRow[parentField];
6154
+ dragRow[parentField] = prevDragToChild ? prevDragRow[rowField] : prevDragRow[parentField];
6131
6155
  internalData.tableFullTreeData = _xeUtils.default.toArrayTree(fullList, {
6132
6156
  key: treeOpts.rowField,
6133
6157
  parentKey: treeOpts.parentField,
@@ -6200,14 +6224,20 @@ const Methods = {
6200
6224
  const {
6201
6225
  dragRow
6202
6226
  } = reactData;
6227
+ const treeOpts = $xeTable.computeTreeOpts;
6228
+ const {
6229
+ transform
6230
+ } = treeOpts;
6203
6231
  const rowDragOpts = $xeTable.computeRowDragOpts;
6204
6232
  const {
6205
- isCrossDrag
6233
+ isCrossDrag,
6234
+ isToChildDrag
6206
6235
  } = rowDragOpts;
6207
6236
  if (!dragRow) {
6208
6237
  evnt.preventDefault();
6209
6238
  return;
6210
6239
  }
6240
+ const hasCtrlKey = evnt.ctrlKey;
6211
6241
  const trEl = evnt.currentTarget;
6212
6242
  const rowid = trEl.getAttribute('rowid') || '';
6213
6243
  const rest = fullAllDataRowIdData[rowid];
@@ -6223,6 +6253,7 @@ const Methods = {
6223
6253
  showDropTip($xeTable, evnt, trEl, null, false, dragPos);
6224
6254
  return;
6225
6255
  }
6256
+ internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && hasCtrlKey);
6226
6257
  internalData.prevDragRow = row;
6227
6258
  internalData.prevDragPos = dragPos;
6228
6259
  showDropTip($xeTable, evnt, trEl, null, true, dragPos);
@@ -6399,6 +6430,7 @@ const Methods = {
6399
6430
  showDropTip($xeTable, evnt, null, thEl, false, dragPos);
6400
6431
  return;
6401
6432
  }
6433
+ internalData.prevDragToChild = false;
6402
6434
  internalData.prevDragCol = column;
6403
6435
  internalData.prevDragPos = dragPos;
6404
6436
  showDropTip($xeTable, evnt, null, thEl, true, dragPos);
@@ -6576,6 +6608,58 @@ const Methods = {
6576
6608
  }
6577
6609
  return this.$nextTick();
6578
6610
  },
6611
+ setSort(sortConfs, isUpdate) {
6612
+ const $xeTable = this;
6613
+ const sortOpts = $xeTable.computeSortOpts;
6614
+ const {
6615
+ multiple,
6616
+ remote,
6617
+ orders
6618
+ } = sortOpts;
6619
+ if (!_xeUtils.default.isArray(sortConfs)) {
6620
+ sortConfs = [sortConfs];
6621
+ }
6622
+ if (sortConfs && sortConfs.length) {
6623
+ if (!multiple) {
6624
+ sortConfs = [sortConfs[0]];
6625
+ clearAllSort($xeTable);
6626
+ }
6627
+ let firstColumn = null;
6628
+ sortConfs.forEach((confs, index) => {
6629
+ let {
6630
+ field,
6631
+ order
6632
+ } = confs;
6633
+ let column = field;
6634
+ if (_xeUtils.default.isString(field)) {
6635
+ column = $xeTable.getColumnByField(field);
6636
+ }
6637
+ if (!firstColumn) {
6638
+ firstColumn = column;
6639
+ }
6640
+ if (column && column.sortable) {
6641
+ if (orders.indexOf(order) === -1) {
6642
+ order = getNextSortOrder($xeTable, column);
6643
+ }
6644
+ if (column.order !== order) {
6645
+ column.order = order;
6646
+ }
6647
+ column.sortTime = Date.now() + index;
6648
+ }
6649
+ });
6650
+ if (isUpdate) {
6651
+ if (!remote) {
6652
+ $xeTable.handleTableData(true);
6653
+ }
6654
+ $xeTable.handleColumnSortEvent(new Event('click'), firstColumn);
6655
+ }
6656
+ return $xeTable.$nextTick().then(() => {
6657
+ $xeTable.updateCellAreas();
6658
+ return $xeTable.updateStyle();
6659
+ });
6660
+ }
6661
+ return $xeTable.$nextTick();
6662
+ },
6579
6663
  /**
6580
6664
  * 清空指定列的排序条件
6581
6665
  * 如果为空则清空所有列的排序条件