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
@@ -282,14 +282,18 @@ function getDefaultCellLabel (params: VxeTableDefines.CellRenderBodyParams) {
282
282
  function renderCellHandle (params: VxeTableDefines.CellRenderBodyParams & {
283
283
  $table: VxeTableConstructor & VxeTablePrivateMethods;
284
284
  }) {
285
- const { column, $table } = params
285
+ const { column, row, $table } = params
286
286
  const tableProps = $table.props
287
+ const tableReactData = $table.reactData
288
+ const { isRowGroupStatus } = tableReactData
287
289
  const { editConfig } = tableProps
288
290
  const { type, treeNode, rowGroupNode, editRender } = column
289
- const { computeEditOpts, computeCheckboxOpts } = $table.getComputeMaps()
291
+ const { computeEditOpts, computeCheckboxOpts, computeRowGroupOpts } = $table.getComputeMaps()
292
+ const rowGroupOpts = computeRowGroupOpts.value
293
+ const { mode } = rowGroupOpts
290
294
  const checkboxOpts = computeCheckboxOpts.value
291
295
  const editOpts = computeEditOpts.value
292
- const isDeepCell = treeNode || rowGroupNode
296
+ const isDeepCell = treeNode || (isRowGroupStatus && row.isAggregate && (mode === 'column' ? column.field === row.groupField : rowGroupNode))
293
297
  switch (type) {
294
298
  case 'seq':
295
299
  return isDeepCell ? Cell.renderDeepIndexCell(params) : Cell.renderSeqCell(params)
@@ -393,7 +397,7 @@ export const Cell = {
393
397
  const tableReactData = $table.reactData
394
398
  const tableInternalData = $table.internalData
395
399
  const { isRowGroupStatus } = tableReactData
396
- const { slots, editRender, cellRender, rowGroupNode } = column
400
+ const { field, slots, editRender, cellRender, rowGroupNode } = column
397
401
  const renderOpts = editRender || cellRender
398
402
  const defaultSlot = slots ? slots.default : null
399
403
  if (defaultSlot) {
@@ -411,30 +415,37 @@ export const Cell = {
411
415
  }
412
416
  }
413
417
  let cellValue: string | number | null = ''
414
- if (isRowGroupStatus && rowGroupNode && row.isAggregate) {
418
+ if (isRowGroupStatus && row.isAggregate) {
415
419
  const { fullColumnFieldData } = tableInternalData
416
420
  const { computeRowGroupOpts } = $table.getComputeMaps()
417
421
  const rowGroupOpts = computeRowGroupOpts.value
418
- const { showTotal, totalMethod, contentMethod, mapChildrenField } = rowGroupOpts
422
+ const { mode, showTotal, totalMethod, countFields, countMethod, contentMethod, mapChildrenField } = rowGroupOpts
419
423
  const groupField = row.groupField
420
- cellValue = row.groupContent
424
+ const groupContent = row.groupContent
421
425
  const childList = mapChildrenField ? (row[mapChildrenField] || []) : []
422
- const totalValue = childList.length
426
+ const totalValue = row.childCount
423
427
  const colRest = fullColumnFieldData[groupField] || {}
424
428
  const params = {
425
429
  $table,
426
430
  groupField,
427
431
  groupColumn: (colRest ? colRest.column : null) as VxeTableDefines.ColumnInfo,
428
432
  column,
429
- groupValue: cellValue,
433
+ groupValue: groupContent,
430
434
  children: childList,
431
435
  totalValue: totalValue
432
436
  }
433
- if (contentMethod) {
434
- cellValue = `${contentMethod(params)}`
435
- }
436
- if (showTotal) {
437
- cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(params) : totalValue, totalValue])
437
+ if (mode === 'column' ? column.field === row.groupField : rowGroupNode) {
438
+ cellValue = groupContent
439
+ if (contentMethod) {
440
+ cellValue = `${contentMethod(params)}`
441
+ }
442
+ if (showTotal) {
443
+ cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(params) : totalValue, totalValue])
444
+ }
445
+ } else if (countFields && countFields.includes(field)) {
446
+ if (countMethod) {
447
+ cellValue = `${countMethod(params)}`
448
+ }
438
449
  }
439
450
  } else if (!(isRowGroupStatus && row.isAggregate)) {
440
451
  cellValue = $table.getCellLabel(row, column)
@@ -575,10 +586,15 @@ export const Cell = {
575
586
  * 行分组、树结构
576
587
  */
577
588
  renderDeepNodeBtn (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
578
- const { row, column } = params
589
+ const { $table, row, column } = params
579
590
  const { rowGroupNode } = column
580
- if (rowGroupNode && row.isAggregate) {
581
- return [Cell.renderRowGroupBtn(params, cellVNodes)]
591
+ if (row.isAggregate) {
592
+ const { computeRowGroupOpts } = $table.getComputeMaps()
593
+ const rowGroupOpts = computeRowGroupOpts.value
594
+ const { mode } = rowGroupOpts
595
+ if (mode === 'column' ? column.field === row.groupField : rowGroupNode) {
596
+ return [Cell.renderRowGroupBtn(params, cellVNodes)]
597
+ }
582
598
  }
583
599
  return [Cell.renderTreeNodeBtn(params, cellVNodes)]
584
600
  },
@@ -508,11 +508,11 @@ export default defineComponent({
508
508
  })
509
509
 
510
510
  const computeVirtualXOpts = computed(() => {
511
- return Object.assign({}, getConfig().table.scrollX, getConfig().table.virtualXConfig, props.scrollX, props.virtualXConfig) as VxeTablePropTypes.VirtualXConfig & { gt: number }
511
+ return Object.assign({}, getConfig().table.virtualXConfig || getConfig().table.scrollX, props.virtualXConfig || props.scrollX) as VxeTablePropTypes.VirtualXConfig & { gt: number }
512
512
  })
513
513
 
514
514
  const computeVirtualYOpts = computed(() => {
515
- return Object.assign({}, getConfig().table.scrollY, getConfig().table.virtualYConfig, props.scrollY, props.virtualYConfig) as VxeTablePropTypes.VirtualYConfig & { gt: number }
515
+ return Object.assign({}, getConfig().table.virtualYConfig || getConfig().table.scrollY, props.virtualYConfig || props.scrollY) as VxeTablePropTypes.VirtualYConfig & { gt: number }
516
516
  })
517
517
 
518
518
  const computeScrollbarOpts = computed(() => {
@@ -1058,7 +1058,7 @@ export default defineComponent({
1058
1058
  }
1059
1059
  }
1060
1060
  let visibleSize = 0
1061
- const toVisibleIndex = Math.max(0, leftIndex < visibleColumn.length ? leftIndex - 2 : 0)
1061
+ const toVisibleIndex = leftIndex === visibleColumn.length ? leftIndex : Math.max(0, leftIndex < visibleColumn.length ? leftIndex - 2 : 0)
1062
1062
  for (let cIndex = toVisibleIndex, cLen = visibleColumn.length; cIndex < cLen; cIndex++) {
1063
1063
  const column = visibleColumn[cIndex]
1064
1064
  const colid = column.id
@@ -1145,7 +1145,7 @@ export default defineComponent({
1145
1145
  rightIndex = rIndex
1146
1146
  }
1147
1147
  }
1148
- toVisibleIndex = Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0)
1148
+ toVisibleIndex = leftIndex === afterFullData.length ? leftIndex : Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0)
1149
1149
  for (let rIndex = toVisibleIndex, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
1150
1150
  const row = afterFullData[rIndex]
1151
1151
  const rowid = handleGetRowId(row)
@@ -3155,6 +3155,7 @@ export default defineComponent({
3155
3155
  const groupField = rgItem.field
3156
3156
  const groupColumn = $xeTable.getColumnByField(groupField)
3157
3157
  const groupMaps: Record<string, any[]> = {}
3158
+ const groupList: any[] = []
3158
3159
  const rowkey = getRowkey($xeTable)
3159
3160
  list.forEach((row) => {
3160
3161
  const cellValue = groupColumn ? $xeTable.getCellLabel(row, groupColumn) : XEUtils.get(row, groupField)
@@ -3171,8 +3172,10 @@ export default defineComponent({
3171
3172
  })
3172
3173
  XEUtils.objectEach(groupMaps, (childList, groupValue) => {
3173
3174
  const { fullData: childFullData, treeData: childTreeData } = handleGroupData(childList, rowGroups.slice(1))
3175
+ const childCount = 0
3174
3176
  const groupRow = {
3175
3177
  isAggregate: true,
3178
+ childCount,
3176
3179
  groupContent: groupValue,
3177
3180
  groupField,
3178
3181
  [rowField]: getRowUniqueId(),
@@ -3187,12 +3190,24 @@ export default defineComponent({
3187
3190
  if (indeterminateField) {
3188
3191
  groupRow[indeterminateField] = false
3189
3192
  }
3193
+ groupList.push(groupRow)
3190
3194
  treeData.push(groupRow)
3191
3195
  fullData.push(groupRow)
3192
3196
  if (childFullData.length) {
3193
3197
  fullData.push(...childFullData)
3194
3198
  }
3195
3199
  })
3200
+ XEUtils.lastEach(groupList, groupItem => {
3201
+ let count = 0
3202
+ XEUtils.each(groupItem[childrenField], row => {
3203
+ if (row.isAggregate) {
3204
+ count += row[childrenField] ? row[childrenField].length : 0
3205
+ } else {
3206
+ count++
3207
+ }
3208
+ })
3209
+ groupItem.childCount = count
3210
+ })
3196
3211
  }
3197
3212
  }
3198
3213
  return {
@@ -207,13 +207,13 @@ VxeUI.setConfig({
207
207
  isReplace: true
208
208
  },
209
209
  virtualXConfig: {
210
- // enabled: false,
210
+ enabled: true,
211
211
  gt: 24,
212
212
  preSize: 1,
213
213
  oSize: 0
214
214
  },
215
215
  virtualYConfig: {
216
- // enabled: false,
216
+ enabled: true,
217
217
  gt: 100,
218
218
  preSize: 1,
219
219
  oSize: 0
@@ -1000,15 +1000,6 @@ $btnThemeList: (
1000
1000
  }
1001
1001
  }
1002
1002
  }
1003
- &.column--highlight {
1004
- .vxe-header--column {
1005
- &:not(.col--seq) {
1006
- &:hover {
1007
- background-color: var(--vxe-ui-table-column-hover-background-color);
1008
- }
1009
- }
1010
- }
1011
- }
1012
1003
  &.header-cell--area {
1013
1004
  .vxe-table--header-wrapper {
1014
1005
  user-select: none;
@@ -1090,6 +1081,16 @@ $btnThemeList: (
1090
1081
  }
1091
1082
 
1092
1083
  // 列高亮
1084
+ &.column--highlight {
1085
+ .vxe-header--column {
1086
+ &:hover {
1087
+ background-color: var(--vxe-ui-table-column-hover-background-color);
1088
+ &.col--current {
1089
+ background-color: var(--vxe-ui-table-column-hover-current-background-color);
1090
+ }
1091
+ }
1092
+ }
1093
+ }
1093
1094
  .vxe-header--column,
1094
1095
  .vxe-body--column,
1095
1096
  .vxe-footer--column {
@@ -1135,6 +1136,9 @@ $btnThemeList: (
1135
1136
  &.row--hover {
1136
1137
  & > .vxe-body--column {
1137
1138
  background-color: var(--vxe-ui-table-row-hover-background-color);
1139
+ &.col--current {
1140
+ background-color: var(--vxe-ui-table-column-current-background-color);
1141
+ }
1138
1142
  }
1139
1143
  &.row--stripe {
1140
1144
  & > .vxe-body--column {
@@ -36,8 +36,6 @@
36
36
  --vxe-ui-table-row-height-mini: 36px;
37
37
  --vxe-ui-table-row-line-height: 22px;
38
38
 
39
- --vxe-ui-table-column-hover-background-color: #d7effb;
40
- --vxe-ui-table-column-current-background-color: #e6f7ff;
41
39
  --vxe-ui-table-column-icon-border-color: #c0c4cc;
42
40
  --vxe-ui-table-column-icon-border-hover-color: #515A6E;
43
41
 
@@ -31,6 +31,9 @@
31
31
  /*table*/
32
32
  --vxe-ui-table-header-background-color: #28282a;
33
33
  --vxe-ui-table-column-to-row-background-color: #28282a;
34
+ --vxe-ui-table-column-hover-background-color: #242f3b;
35
+ --vxe-ui-table-column-current-background-color: #18222c;
36
+ --vxe-ui-table-column-hover-current-background-color: #242f3b;
34
37
  --vxe-ui-table-border-color: #37373a;
35
38
  --vxe-ui-table-row-hover-background-color: #262727;
36
39
  --vxe-ui-table-row-striped-background-color: #1D1D1D;
@@ -40,7 +43,7 @@
40
43
  --vxe-ui-table-row-checkbox-checked-background-color: #604820;
41
44
  --vxe-ui-table-row-hover-checkbox-checked-background-color: #6e5326;
42
45
  --vxe-ui-table-row-current-background-color: #18222c;
43
- --vxe-ui-table-row-hover-current-background-color: #262727;
46
+ --vxe-ui-table-row-hover-current-background-color: #242f3b;
44
47
  --vxe-ui-table-fixed-scrolling-box-shadow-color: rgba(0, 0, 0, 0.8);
45
48
  --vxe-ui-table-drag-over-background-color:rgba(48, 48, 0, 0.3);
46
49
  }
@@ -27,6 +27,9 @@
27
27
  /*table*/
28
28
  --vxe-ui-table-header-background-color: #{light_variable.$vxe-ui-table-header-background-color};
29
29
  --vxe-ui-table-column-to-row-background-color: #{light_variable.$vxe-ui-table-column-to-row-background-color};
30
+ --vxe-ui-table-column-hover-background-color: #{light_variable.$vxe-ui-table-column-hover-background-color};
31
+ --vxe-ui-table-column-current-background-color: #{light_variable.$vxe-ui-table-column-current-background-color};
32
+ --vxe-ui-table-column-hover-current-background-color: #{light_variable.$vxe-ui-table-column-hover-current-background-color};
30
33
  --vxe-ui-table-border-color: #{light_variable.$vxe-ui-table-border-color};
31
34
  --vxe-ui-table-row-hover-background-color: #{light_variable.$vxe-ui-table-row-hover-background-color};
32
35
  --vxe-ui-table-row-striped-background-color: #{light_variable.$vxe-ui-table-row-striped-background-color};
@@ -26,6 +26,9 @@ $vxe-ui-loading-background-color: rgba(255, 255, 255, 0.5) !default;
26
26
  /*table*/
27
27
  $vxe-ui-table-header-background-color: #f8f8f9 !default;
28
28
  $vxe-ui-table-column-to-row-background-color: #f8f8f9 !default;
29
+ $vxe-ui-table-column-hover-background-color: #d7effb !default;
30
+ $vxe-ui-table-column-current-background-color: #e6f7ff !default;
31
+ $vxe-ui-table-column-hover-current-background-color: #d7effb !default;
29
32
  $vxe-ui-table-border-color: #e8eaec !default;
30
33
  $vxe-ui-table-row-hover-background-color: #f5f7fa !default;
31
34
  $vxe-ui-table-row-striped-background-color: #fafafa !default;
@@ -38,4 +41,4 @@ $vxe-ui-table-row-current-background-color: #e6f7ff !default;
38
41
  $vxe-ui-table-row-hover-current-background-color: #d7effb !default;
39
42
  $vxe-ui-table-fixed-scrolling-box-shadow-color: rgba(0, 0, 0, 0.12) !default;
40
43
  $vxe-ui-table-drag-over-background-color:rgba(255,255,200,0.3) !default;
41
-
44
+