vxe-table 4.13.32 → 4.13.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 (45) 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 +33 -16
  6. package/es/table/src/table.js +20 -4
  7. package/es/table/style.css +9 -3
  8. package/es/table/style.min.css +1 -1
  9. package/es/ui/index.js +3 -3
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-table/style.css +9 -3
  12. package/es/vxe-table/style.min.css +1 -1
  13. package/lib/index.css +1 -1
  14. package/lib/index.min.css +1 -1
  15. package/lib/index.umd.js +52 -21
  16. package/lib/index.umd.min.js +1 -1
  17. package/lib/style.css +1 -1
  18. package/lib/style.min.css +1 -1
  19. package/lib/table/src/cell.js +44 -13
  20. package/lib/table/src/cell.min.js +1 -1
  21. package/lib/table/src/table.js +4 -4
  22. package/lib/table/src/table.min.js +1 -1
  23. package/lib/table/style/style.css +9 -3
  24. package/lib/table/style/style.min.css +1 -1
  25. package/lib/ui/index.js +3 -3
  26. package/lib/ui/index.min.js +1 -1
  27. package/lib/ui/src/log.js +1 -1
  28. package/lib/ui/src/log.min.js +1 -1
  29. package/lib/vxe-table/style/style.css +9 -3
  30. package/lib/vxe-table/style/style.min.css +1 -1
  31. package/package.json +1 -1
  32. package/packages/table/src/cell.ts +33 -17
  33. package/packages/table/src/table.ts +19 -4
  34. package/packages/ui/index.ts +2 -2
  35. package/styles/components/table.scss +13 -9
  36. package/styles/theme/base.scss +0 -2
  37. package/styles/theme/dark.scss +4 -1
  38. package/styles/theme/light.scss +3 -0
  39. package/styles/variable.scss +4 -1
  40. /package/es/{iconfont.1748578580599.ttf → iconfont.1749092482353.ttf} +0 -0
  41. /package/es/{iconfont.1748578580599.woff → iconfont.1749092482353.woff} +0 -0
  42. /package/es/{iconfont.1748578580599.woff2 → iconfont.1749092482353.woff2} +0 -0
  43. /package/lib/{iconfont.1748578580599.ttf → iconfont.1749092482353.ttf} +0 -0
  44. /package/lib/{iconfont.1748578580599.woff → iconfont.1749092482353.woff} +0 -0
  45. /package/lib/{iconfont.1748578580599.woff2 → iconfont.1749092482353.woff2} +0 -0
@@ -251,14 +251,18 @@ function getDefaultCellLabel(params) {
251
251
  return formatText($table.getCellLabel(row, column), 1);
252
252
  }
253
253
  function renderCellHandle(params) {
254
- const { column, $table } = params;
254
+ const { column, row, $table } = params;
255
255
  const tableProps = $table.props;
256
+ const tableReactData = $table.reactData;
257
+ const { isRowGroupStatus } = tableReactData;
256
258
  const { editConfig } = tableProps;
257
259
  const { type, treeNode, rowGroupNode, editRender } = column;
258
- const { computeEditOpts, computeCheckboxOpts } = $table.getComputeMaps();
260
+ const { computeEditOpts, computeCheckboxOpts, computeRowGroupOpts } = $table.getComputeMaps();
261
+ const rowGroupOpts = computeRowGroupOpts.value;
262
+ const { mode } = rowGroupOpts;
259
263
  const checkboxOpts = computeCheckboxOpts.value;
260
264
  const editOpts = computeEditOpts.value;
261
- const isDeepCell = treeNode || rowGroupNode;
265
+ const isDeepCell = treeNode || (isRowGroupStatus && row.isAggregate && (mode === 'column' ? column.field === row.groupField : rowGroupNode));
262
266
  switch (type) {
263
267
  case 'seq':
264
268
  return isDeepCell ? Cell.renderDeepIndexCell(params) : Cell.renderSeqCell(params);
@@ -360,7 +364,7 @@ export const Cell = {
360
364
  const tableReactData = $table.reactData;
361
365
  const tableInternalData = $table.internalData;
362
366
  const { isRowGroupStatus } = tableReactData;
363
- const { slots, editRender, cellRender, rowGroupNode } = column;
367
+ const { field, slots, editRender, cellRender, rowGroupNode } = column;
364
368
  const renderOpts = editRender || cellRender;
365
369
  const defaultSlot = slots ? slots.default : null;
366
370
  if (defaultSlot) {
@@ -378,30 +382,38 @@ export const Cell = {
378
382
  }
379
383
  }
380
384
  let cellValue = '';
381
- if (isRowGroupStatus && rowGroupNode && row.isAggregate) {
385
+ if (isRowGroupStatus && row.isAggregate) {
382
386
  const { fullColumnFieldData } = tableInternalData;
383
387
  const { computeRowGroupOpts } = $table.getComputeMaps();
384
388
  const rowGroupOpts = computeRowGroupOpts.value;
385
- const { showTotal, totalMethod, contentMethod, mapChildrenField } = rowGroupOpts;
389
+ const { mode, showTotal, totalMethod, countFields, countMethod, contentMethod, mapChildrenField } = rowGroupOpts;
386
390
  const groupField = row.groupField;
387
- cellValue = row.groupContent;
391
+ const groupContent = row.groupContent;
388
392
  const childList = mapChildrenField ? (row[mapChildrenField] || []) : [];
389
- const totalValue = childList.length;
393
+ const totalValue = row.childCount;
390
394
  const colRest = fullColumnFieldData[groupField] || {};
391
395
  const params = {
392
396
  $table,
393
397
  groupField,
394
398
  groupColumn: (colRest ? colRest.column : null),
395
399
  column,
396
- groupValue: cellValue,
400
+ groupValue: groupContent,
397
401
  children: childList,
398
402
  totalValue: totalValue
399
403
  };
400
- if (contentMethod) {
401
- cellValue = `${contentMethod(params)}`;
404
+ if (mode === 'column' ? column.field === row.groupField : rowGroupNode) {
405
+ cellValue = groupContent;
406
+ if (contentMethod) {
407
+ cellValue = `${contentMethod(params)}`;
408
+ }
409
+ if (showTotal) {
410
+ cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(params) : totalValue, totalValue]);
411
+ }
402
412
  }
403
- if (showTotal) {
404
- cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(params) : totalValue, totalValue]);
413
+ else if (countFields && countFields.includes(field)) {
414
+ if (countMethod) {
415
+ cellValue = `${countMethod(params)}`;
416
+ }
405
417
  }
406
418
  }
407
419
  else if (!(isRowGroupStatus && row.isAggregate)) {
@@ -538,10 +550,15 @@ export const Cell = {
538
550
  * 行分组、树结构
539
551
  */
540
552
  renderDeepNodeBtn(params, cellVNodes) {
541
- const { row, column } = params;
553
+ const { $table, row, column } = params;
542
554
  const { rowGroupNode } = column;
543
- if (rowGroupNode && row.isAggregate) {
544
- return [Cell.renderRowGroupBtn(params, cellVNodes)];
555
+ if (row.isAggregate) {
556
+ const { computeRowGroupOpts } = $table.getComputeMaps();
557
+ const rowGroupOpts = computeRowGroupOpts.value;
558
+ const { mode } = rowGroupOpts;
559
+ if (mode === 'column' ? column.field === row.groupField : rowGroupNode) {
560
+ return [Cell.renderRowGroupBtn(params, cellVNodes)];
561
+ }
545
562
  }
546
563
  return [Cell.renderTreeNodeBtn(params, cellVNodes)];
547
564
  },
@@ -468,10 +468,10 @@ export default defineComponent({
468
468
  return virtualYOpts;
469
469
  });
470
470
  const computeVirtualXOpts = computed(() => {
471
- return Object.assign({}, getConfig().table.scrollX, getConfig().table.virtualXConfig, props.scrollX, props.virtualXConfig);
471
+ return Object.assign({}, getConfig().table.virtualXConfig || getConfig().table.scrollX, props.virtualXConfig || props.scrollX);
472
472
  });
473
473
  const computeVirtualYOpts = computed(() => {
474
- return Object.assign({}, getConfig().table.scrollY, getConfig().table.virtualYConfig, props.scrollY, props.virtualYConfig);
474
+ return Object.assign({}, getConfig().table.virtualYConfig || getConfig().table.scrollY, props.virtualYConfig || props.scrollY);
475
475
  });
476
476
  const computeScrollbarOpts = computed(() => {
477
477
  return Object.assign({}, getConfig().table.scrollbarConfig, props.scrollbarConfig);
@@ -949,7 +949,7 @@ export default defineComponent({
949
949
  }
950
950
  }
951
951
  let visibleSize = 0;
952
- const toVisibleIndex = Math.max(0, leftIndex < visibleColumn.length ? leftIndex - 2 : 0);
952
+ const toVisibleIndex = leftIndex === visibleColumn.length ? leftIndex : Math.max(0, leftIndex < visibleColumn.length ? leftIndex - 2 : 0);
953
953
  for (let cIndex = toVisibleIndex, cLen = visibleColumn.length; cIndex < cLen; cIndex++) {
954
954
  const column = visibleColumn[cIndex];
955
955
  const colid = column.id;
@@ -1036,7 +1036,7 @@ export default defineComponent({
1036
1036
  rightIndex = rIndex;
1037
1037
  }
1038
1038
  }
1039
- toVisibleIndex = Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
1039
+ toVisibleIndex = leftIndex === afterFullData.length ? leftIndex : Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
1040
1040
  for (let rIndex = toVisibleIndex, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
1041
1041
  const row = afterFullData[rIndex];
1042
1042
  const rowid = handleGetRowId(row);
@@ -3012,6 +3012,7 @@ export default defineComponent({
3012
3012
  const groupField = rgItem.field;
3013
3013
  const groupColumn = $xeTable.getColumnByField(groupField);
3014
3014
  const groupMaps = {};
3015
+ const groupList = [];
3015
3016
  const rowkey = getRowkey($xeTable);
3016
3017
  list.forEach((row) => {
3017
3018
  const cellValue = groupColumn ? $xeTable.getCellLabel(row, groupColumn) : XEUtils.get(row, groupField);
@@ -3028,8 +3029,10 @@ export default defineComponent({
3028
3029
  });
3029
3030
  XEUtils.objectEach(groupMaps, (childList, groupValue) => {
3030
3031
  const { fullData: childFullData, treeData: childTreeData } = handleGroupData(childList, rowGroups.slice(1));
3032
+ const childCount = 0;
3031
3033
  const groupRow = {
3032
3034
  isAggregate: true,
3035
+ childCount,
3033
3036
  groupContent: groupValue,
3034
3037
  groupField,
3035
3038
  [rowField]: getRowUniqueId(),
@@ -3044,12 +3047,25 @@ export default defineComponent({
3044
3047
  if (indeterminateField) {
3045
3048
  groupRow[indeterminateField] = false;
3046
3049
  }
3050
+ groupList.push(groupRow);
3047
3051
  treeData.push(groupRow);
3048
3052
  fullData.push(groupRow);
3049
3053
  if (childFullData.length) {
3050
3054
  fullData.push(...childFullData);
3051
3055
  }
3052
3056
  });
3057
+ XEUtils.lastEach(groupList, groupItem => {
3058
+ let count = 0;
3059
+ XEUtils.each(groupItem[childrenField], row => {
3060
+ if (row.isAggregate) {
3061
+ count += row[childrenField] ? row[childrenField].length : 0;
3062
+ }
3063
+ else {
3064
+ count++;
3065
+ }
3066
+ });
3067
+ groupItem.childCount = count;
3068
+ });
3053
3069
  }
3054
3070
  }
3055
3071
  return {
@@ -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
  }