vxe-table 3.15.32 → 3.15.34

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 (49) 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/src/cell.js +31 -15
  6. package/es/table/src/methods.js +18 -2
  7. package/es/table/src/table.js +2 -2
  8. package/es/table/style.css +9 -3
  9. package/es/table/style.min.css +1 -1
  10. package/es/ui/index.js +3 -3
  11. package/es/ui/src/log.js +1 -1
  12. package/es/vxe-table/style.css +9 -3
  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 +62 -20
  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/src/cell.js +39 -12
  21. package/lib/table/src/cell.min.js +1 -1
  22. package/lib/table/src/methods.js +17 -2
  23. package/lib/table/src/methods.min.js +1 -1
  24. package/lib/table/src/table.js +2 -2
  25. package/lib/table/src/table.min.js +1 -1
  26. package/lib/table/style/style.css +9 -3
  27. package/lib/table/style/style.min.css +1 -1
  28. package/lib/ui/index.js +3 -3
  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 +9 -3
  33. package/lib/vxe-table/style/style.min.css +1 -1
  34. package/package.json +1 -1
  35. package/packages/table/src/cell.ts +31 -16
  36. package/packages/table/src/methods.ts +17 -2
  37. package/packages/table/src/table.ts +2 -2
  38. package/packages/ui/index.ts +2 -2
  39. package/styles/components/table.scss +13 -9
  40. package/styles/theme/base.scss +0 -2
  41. package/styles/theme/dark.scss +4 -1
  42. package/styles/theme/light.scss +3 -0
  43. package/styles/variable.scss +3 -0
  44. /package/es/{iconfont.1748578557669.ttf → iconfont.1749092456241.ttf} +0 -0
  45. /package/es/{iconfont.1748578557669.woff → iconfont.1749092456241.woff} +0 -0
  46. /package/es/{iconfont.1748578557669.woff2 → iconfont.1749092456241.woff2} +0 -0
  47. /package/lib/{iconfont.1748578557669.ttf → iconfont.1749092456241.ttf} +0 -0
  48. /package/lib/{iconfont.1748578557669.woff → iconfont.1749092456241.woff} +0 -0
  49. /package/lib/{iconfont.1748578557669.woff2 → iconfont.1749092456241.woff2} +0 -0
@@ -247,13 +247,17 @@ function getDefaultCellLabel(params) {
247
247
  return formatText($table.getCellLabel(row, column), 1);
248
248
  }
249
249
  function renderCellHandle(h, params) {
250
- const { column, $table } = params;
250
+ const { column, row, $table } = params;
251
251
  const tableProps = $table;
252
+ const tableReactData = $table;
252
253
  const { editConfig } = tableProps;
254
+ const { isRowGroupStatus } = tableReactData;
253
255
  const { type, treeNode, rowGroupNode, editRender } = column;
256
+ const rowGroupOpts = $table.computeRowGroupOpts;
257
+ const { mode } = rowGroupOpts;
254
258
  const checkboxOpts = $table.computeCheckboxOpts;
255
259
  const editOpts = $table.computeEditOpts;
256
- const isDeepCell = treeNode || rowGroupNode;
260
+ const isDeepCell = treeNode || (isRowGroupStatus && row.isAggregate && (mode === 'column' ? column.field === row.groupField : rowGroupNode));
257
261
  switch (type) {
258
262
  case 'seq':
259
263
  return isDeepCell ? Cell.renderDeepIndexCell(h, params) : Cell.renderSeqCell(h, params);
@@ -352,7 +356,7 @@ export const Cell = {
352
356
  const tableReactData = $table;
353
357
  const tableInternalData = $table;
354
358
  const { isRowGroupStatus } = tableReactData;
355
- const { slots, editRender, cellRender, rowGroupNode } = column;
359
+ const { field, slots, editRender, cellRender, rowGroupNode } = column;
356
360
  const renderOpts = editRender || cellRender;
357
361
  if (slots && slots.default) {
358
362
  return renderCellBaseVNs(h, params, $table.callSlot(slots.default, params, h));
@@ -367,29 +371,37 @@ export const Cell = {
367
371
  }
368
372
  }
369
373
  let cellValue = '';
370
- if (isRowGroupStatus && rowGroupNode && row.isAggregate) {
374
+ if (isRowGroupStatus && row.isAggregate) {
371
375
  const { fullColumnFieldData } = tableInternalData;
372
376
  const rowGroupOpts = $table.computeRowGroupOpts;
373
- const { showTotal, totalMethod, contentMethod, mapChildrenField } = rowGroupOpts;
377
+ const { mode, showTotal, totalMethod, countFields, countMethod, contentMethod, mapChildrenField } = rowGroupOpts;
374
378
  const groupField = row.groupField;
375
- cellValue = row.groupContent;
379
+ const groupContent = row.groupContent;
376
380
  const childList = mapChildrenField ? (row[mapChildrenField] || []) : [];
377
- const totalValue = childList.length;
381
+ const totalValue = row.childCount;
378
382
  const colRest = fullColumnFieldData[groupField] || {};
379
383
  const params = {
380
384
  $table,
381
385
  groupField,
382
386
  groupColumn: (colRest ? colRest.column : null),
383
387
  column,
384
- groupValue: cellValue,
388
+ groupValue: groupContent,
385
389
  children: childList,
386
390
  totalValue: totalValue
387
391
  };
388
- if (contentMethod) {
389
- cellValue = `${contentMethod(params)}`;
392
+ if (mode === 'column' ? column.field === row.groupField : rowGroupNode) {
393
+ cellValue = groupContent;
394
+ if (contentMethod) {
395
+ cellValue = `${contentMethod(params)}`;
396
+ }
397
+ if (showTotal) {
398
+ cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(params) : totalValue, totalValue]);
399
+ }
390
400
  }
391
- if (showTotal) {
392
- cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(params) : totalValue, totalValue]);
401
+ else if (countFields && countFields.includes(field)) {
402
+ if (countMethod) {
403
+ cellValue = `${countMethod(params)}`;
404
+ }
393
405
  }
394
406
  }
395
407
  else if (!(isRowGroupStatus && row.isAggregate)) {
@@ -531,10 +543,14 @@ export const Cell = {
531
543
  * 行分组、树结构
532
544
  */
533
545
  renderDeepNodeBtn(h, params, cellVNodes) {
534
- const { row, column } = params;
546
+ const { $table, row, column } = params;
535
547
  const { rowGroupNode } = column;
536
- if (rowGroupNode && row.isAggregate) {
537
- return [Cell.renderRowGroupBtn(h, params, cellVNodes)];
548
+ if (row.isAggregate) {
549
+ const rowGroupOpts = $table.computeRowGroupOpts;
550
+ const { mode } = rowGroupOpts;
551
+ if (mode === 'column' ? column.field === row.groupField : rowGroupNode) {
552
+ return [Cell.renderRowGroupBtn(h, params, cellVNodes)];
553
+ }
538
554
  }
539
555
  return [Cell.renderTreeNodeBtn(h, params, cellVNodes)];
540
556
  },
@@ -96,7 +96,7 @@ function handleVirtualXVisible($xeTable) {
96
96
  }
97
97
  }
98
98
  let visibleSize = 0;
99
- const toVisibleIndex = Math.max(0, leftIndex < visibleColumn.length ? leftIndex - 2 : 0);
99
+ const toVisibleIndex = leftIndex === visibleColumn.length ? leftIndex : Math.max(0, leftIndex < visibleColumn.length ? leftIndex - 2 : 0);
100
100
  for (let cIndex = toVisibleIndex, cLen = visibleColumn.length; cIndex < cLen; cIndex++) {
101
101
  const column = visibleColumn[cIndex];
102
102
  const colid = column.id;
@@ -1690,7 +1690,7 @@ function handleVirtualYVisible($xeTable) {
1690
1690
  rightIndex = rIndex;
1691
1691
  }
1692
1692
  }
1693
- toVisibleIndex = Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
1693
+ toVisibleIndex = leftIndex === afterFullData.length ? leftIndex : Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
1694
1694
  for (let rIndex = toVisibleIndex, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
1695
1695
  const row = afterFullData[rIndex];
1696
1696
  const rowid = handleGetRowId(row);
@@ -2624,6 +2624,7 @@ function handleGroupData($xeTable, list, rowGroups) {
2624
2624
  const groupField = rgItem.field;
2625
2625
  const groupColumn = $xeTable.getColumnByField(groupField);
2626
2626
  const groupMaps = {};
2627
+ const groupList = [];
2627
2628
  const rowkey = getRowkey($xeTable);
2628
2629
  list.forEach((row) => {
2629
2630
  const cellValue = groupColumn ? $xeTable.getCellLabel(row, groupColumn) : XEUtils.get(row, groupField);
@@ -2640,8 +2641,10 @@ function handleGroupData($xeTable, list, rowGroups) {
2640
2641
  });
2641
2642
  XEUtils.objectEach(groupMaps, (childList, groupValue) => {
2642
2643
  const { fullData: childFullData, treeData: childTreeData } = handleGroupData($xeTable, childList, rowGroups.slice(1));
2644
+ const childCount = 0;
2643
2645
  const groupRow = {
2644
2646
  isAggregate: true,
2647
+ childCount,
2645
2648
  groupContent: groupValue,
2646
2649
  groupField,
2647
2650
  [rowField]: getRowUniqueId(),
@@ -2656,12 +2659,25 @@ function handleGroupData($xeTable, list, rowGroups) {
2656
2659
  if (indeterminateField) {
2657
2660
  groupRow[indeterminateField] = false;
2658
2661
  }
2662
+ groupList.push(groupRow);
2659
2663
  treeData.push(groupRow);
2660
2664
  fullData.push(groupRow);
2661
2665
  if (childFullData.length) {
2662
2666
  fullData.push(...childFullData);
2663
2667
  }
2664
2668
  });
2669
+ XEUtils.lastEach(groupList, groupItem => {
2670
+ let count = 0;
2671
+ XEUtils.each(groupItem[childrenField], row => {
2672
+ if (row.isAggregate) {
2673
+ count += row[childrenField] ? row[childrenField].length : 0;
2674
+ }
2675
+ else {
2676
+ count++;
2677
+ }
2678
+ });
2679
+ groupItem.childCount = count;
2680
+ });
2665
2681
  }
2666
2682
  }
2667
2683
  return {
@@ -732,12 +732,12 @@ export default {
732
732
  computeVirtualXOpts() {
733
733
  const $xeTable = this;
734
734
  const props = $xeTable;
735
- return Object.assign({}, getConfig().table.scrollX, getConfig().table.virtualXConfig, props.scrollX, props.virtualXConfig);
735
+ return Object.assign({}, getConfig().table.virtualXConfig || getConfig().table.scrollX, props.virtualXConfig || props.scrollX);
736
736
  },
737
737
  computeVirtualYOpts() {
738
738
  const $xeTable = this;
739
739
  const props = $xeTable;
740
- return Object.assign({}, getConfig().table.scrollY, getConfig().table.virtualYConfig, props.scrollY, props.virtualYConfig);
740
+ return Object.assign({}, getConfig().table.virtualYConfig || getConfig().table.scrollY, props.virtualYConfig || props.scrollY);
741
741
  },
742
742
  computeScrollbarOpts() {
743
743
  const $xeTable = this;
@@ -2500,9 +2500,6 @@
2500
2500
  color: var(--vxe-ui-input-disabled-color);
2501
2501
  cursor: not-allowed;
2502
2502
  }
2503
- .vxe-table--render-default.column--highlight .vxe-header--column:not(.col--seq):hover {
2504
- background-color: var(--vxe-ui-table-column-hover-background-color);
2505
- }
2506
2503
  .vxe-table--render-default.header-cell--area .vxe-table--header-wrapper {
2507
2504
  -webkit-user-select: none;
2508
2505
  -moz-user-select: none;
@@ -2567,6 +2564,12 @@
2567
2564
  .vxe-table--render-default .vxe-body--row.row--stripe > .vxe-body--column {
2568
2565
  background-color: var(--vxe-ui-table-row-striped-background-color);
2569
2566
  }
2567
+ .vxe-table--render-default.column--highlight .vxe-header--column:hover {
2568
+ background-color: var(--vxe-ui-table-column-hover-background-color);
2569
+ }
2570
+ .vxe-table--render-default.column--highlight .vxe-header--column:hover.col--current {
2571
+ background-color: var(--vxe-ui-table-column-hover-current-background-color);
2572
+ }
2570
2573
  .vxe-table--render-default .vxe-header--column,
2571
2574
  .vxe-table--render-default .vxe-body--column,
2572
2575
  .vxe-table--render-default .vxe-footer--column {
@@ -2591,6 +2594,9 @@
2591
2594
  .vxe-table--render-default .vxe-body--row.row--hover > .vxe-body--column {
2592
2595
  background-color: var(--vxe-ui-table-row-hover-background-color);
2593
2596
  }
2597
+ .vxe-table--render-default .vxe-body--row.row--hover > .vxe-body--column.col--current {
2598
+ background-color: var(--vxe-ui-table-column-current-background-color);
2599
+ }
2594
2600
  .vxe-table--render-default .vxe-body--row.row--hover.row--stripe > .vxe-body--column {
2595
2601
  background-color: var(--vxe-ui-table-row-hover-striped-background-color);
2596
2602
  }