vxe-table 4.10.6-beta.25 → 4.10.6-beta.27

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 (69) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/locale/lang/en-US.js +2 -2
  4. package/es/style.css +1 -1
  5. package/es/style.min.css +1 -1
  6. package/es/table/src/body.js +21 -19
  7. package/es/table/src/cell.js +25 -39
  8. package/es/table/src/column.js +10 -0
  9. package/es/table/src/columnInfo.js +2 -0
  10. package/es/table/src/footer.js +2 -1
  11. package/es/table/src/header.js +2 -2
  12. package/es/table/src/table.js +111 -81
  13. package/es/table/src/util.js +9 -3
  14. package/es/table/style.css +51 -26
  15. package/es/table/style.min.css +1 -1
  16. package/es/ui/index.js +1 -1
  17. package/es/ui/src/log.js +1 -1
  18. package/es/vxe-table/style.css +51 -26
  19. package/es/vxe-table/style.min.css +1 -1
  20. package/lib/index.css +1 -1
  21. package/lib/index.min.css +1 -1
  22. package/lib/index.umd.js +189 -150
  23. package/lib/index.umd.min.js +1 -1
  24. package/lib/locale/lang/en-US.js +2 -2
  25. package/lib/locale/lang/en-US.min.js +1 -1
  26. package/lib/locale/lang/en-US.umd.js +2 -2
  27. package/lib/style.css +1 -1
  28. package/lib/style.min.css +1 -1
  29. package/lib/table/src/body.js +17 -18
  30. package/lib/table/src/body.min.js +1 -1
  31. package/lib/table/src/cell.js +24 -33
  32. package/lib/table/src/cell.min.js +1 -1
  33. package/lib/table/src/column.js +10 -0
  34. package/lib/table/src/column.min.js +1 -1
  35. package/lib/table/src/columnInfo.js +2 -0
  36. package/lib/table/src/columnInfo.min.js +1 -1
  37. package/lib/table/src/footer.js +2 -1
  38. package/lib/table/src/footer.min.js +1 -1
  39. package/lib/table/src/header.js +1 -1
  40. package/lib/table/src/header.min.js +1 -1
  41. package/lib/table/src/table.js +122 -92
  42. package/lib/table/src/table.min.js +1 -1
  43. package/lib/table/src/util.js +10 -3
  44. package/lib/table/src/util.min.js +1 -1
  45. package/lib/table/style/style.css +51 -26
  46. package/lib/table/style/style.min.css +1 -1
  47. package/lib/ui/index.js +1 -1
  48. package/lib/ui/index.min.js +1 -1
  49. package/lib/ui/src/log.js +1 -1
  50. package/lib/ui/src/log.min.js +1 -1
  51. package/lib/vxe-table/style/style.css +51 -26
  52. package/lib/vxe-table/style/style.min.css +1 -1
  53. package/package.json +2 -2
  54. package/packages/locale/lang/en-US.ts +2 -2
  55. package/packages/table/src/body.ts +21 -19
  56. package/packages/table/src/cell.ts +25 -47
  57. package/packages/table/src/column.ts +10 -0
  58. package/packages/table/src/columnInfo.ts +2 -0
  59. package/packages/table/src/footer.ts +2 -1
  60. package/packages/table/src/header.ts +2 -2
  61. package/packages/table/src/table.ts +116 -83
  62. package/packages/table/src/util.ts +10 -3
  63. package/styles/components/table.scss +63 -31
  64. /package/es/{iconfont.1737356819937.ttf → iconfont.1737446773545.ttf} +0 -0
  65. /package/es/{iconfont.1737356819937.woff → iconfont.1737446773545.woff} +0 -0
  66. /package/es/{iconfont.1737356819937.woff2 → iconfont.1737446773545.woff2} +0 -0
  67. /package/lib/{iconfont.1737356819937.ttf → iconfont.1737446773545.ttf} +0 -0
  68. /package/lib/{iconfont.1737356819937.woff → iconfont.1737446773545.woff} +0 -0
  69. /package/lib/{iconfont.1737356819937.woff2 → iconfont.1737446773545.woff2} +0 -0
@@ -103,7 +103,7 @@ export default defineComponent({
103
103
  items: any[]
104
104
  ) => {
105
105
  const { fullAllDataRowIdData } = tableInternalData
106
- const { columnKey, height, showOverflow: allColumnOverflow, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps
106
+ const { columnKey, height, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps
107
107
  const { tableData, overflowX, currentColumn, scrollXLoad, scrollYLoad, calcCellHeightFlag, resizeHeightFlag, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData
108
108
  const { afterFullData, scrollXStore, scrollYStore } = tableInternalData
109
109
  const cellOpts = computeCellOpts.value
@@ -120,8 +120,8 @@ export default defineComponent({
120
120
  const mouseOpts = computeMouseOpts.value
121
121
  const areaOpts = computeAreaOpts.value
122
122
  const { selectCellToRow } = areaOpts
123
- const { type, cellRender, editRender, align, showOverflow, className, treeNode, rowResize, slots } = column
124
- const { verticalAlign } = cellOpts
123
+ const { type, cellRender, editRender, align, showOverflow, className, treeNode, rowResize, padding, verticalAlign, slots } = column
124
+ const { verticalAlign: allVerticalAlign } = cellOpts
125
125
  const { actived } = editStore
126
126
  const rowRest = fullAllDataRowIdData[rowid]
127
127
  const colid = column.id
@@ -135,16 +135,17 @@ export default defineComponent({
135
135
  const isEdit = isEnableConf(editRender)
136
136
  const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0
137
137
  let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX
138
- const isPadding = allPadding === null ? cellOpts.padding : allPadding
139
- const cellOverflow = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow
138
+ const isCellPadding = XEUtils.eqNull(padding) ? (allPadding === null ? cellOpts.padding : allPadding) : padding
139
+ const cellOverflow = XEUtils.eqNull(showOverflow) ? isAllOverflow : showOverflow
140
140
  const showEllipsis = cellOverflow === 'ellipsis'
141
141
  const showTitle = cellOverflow === 'title'
142
142
  const showTooltip = cellOverflow === true || cellOverflow === 'tooltip'
143
- // 如果表格加上 showOverflow 则不再支持列单独设置
144
- const hasEllipsis = allColumnOverflow || showTitle || showTooltip || showEllipsis || resizeHeight > 0
143
+ const hasEllipsis = isAllOverflow || showTitle || showTooltip || showEllipsis
144
+ const isRsHeight = resizeHeight > 0
145
145
  let isDirty
146
146
  const tdOns: any = {}
147
147
  const cellAlign = align || (compConf ? compConf.tableCellAlign : '') || allAlign
148
+ const cellVerticalAlign = XEUtils.eqNull(verticalAlign) ? allVerticalAlign : verticalAlign
148
149
  const errorValidItem = validErrorMaps[`${rowid}:${colid}`]
149
150
  const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? (height || tableData.length > 1) : validOpts.message === 'inline')
150
151
  const tdAttrs: any = { colid }
@@ -288,14 +289,14 @@ export default defineComponent({
288
289
  }
289
290
 
290
291
  const tcStyle: Record<string, string> = {}
291
- if (hasEllipsis) {
292
+ if (scrollYLoad || hasEllipsis || isRsHeight) {
292
293
  tcStyle.height = `${cellHeight}px`
293
294
  } else {
294
295
  tcStyle.minHeight = `${cellHeight}px`
295
296
  }
296
297
 
297
298
  const tdVNs: any[] = []
298
- if (fixedHiddenColumn && (allColumnOverflow ? isAllOverflow : allColumnOverflow)) {
299
+ if (fixedHiddenColumn && isAllOverflow) {
299
300
  tdVNs.push(
300
301
  h('div', {
301
302
  key: 'tc',
@@ -385,19 +386,20 @@ export default defineComponent({
385
386
  class: [
386
387
  'vxe-body--column',
387
388
  colid,
389
+ cellVerticalAlign ? `col--vertical-${cellVerticalAlign}` : '',
390
+ cellAlign ? `col--${cellAlign}` : '',
391
+ type ? `col--${type}` : '',
388
392
  {
389
- [`col--${cellAlign}`]: cellAlign,
390
- [`col--vertical-${verticalAlign}`]: verticalAlign,
391
- [`col--${type}`]: type,
392
393
  'col--last': isLastColumn,
393
394
  'col--tree-node': treeNode,
394
395
  'col--edit': isEdit,
395
396
  'col--ellipsis': hasEllipsis,
397
+ 'col--rs-height': isRsHeight,
396
398
  'col--to-row': showAreaRowStatus,
397
399
  'col--auto-height': isVNAutoHeight,
398
400
  'fixed--width': !isAutoCellWidth,
399
401
  'fixed--hidden': fixedHiddenColumn,
400
- 'is--padding': isPadding,
402
+ 'is--padding': isCellPadding,
401
403
  'is--drag-cell': isRowDragCell && (isCrossDrag || isPeerDrag || !rowLevel),
402
404
  'is--drag-disabled': isDisabledDrag,
403
405
  'col--dirty': isDirty,
@@ -417,8 +419,8 @@ export default defineComponent({
417
419
  }
418
420
 
419
421
  const renderRows = (fixedType: VxeColumnPropTypes.Fixed, isOptimizeMode: boolean, tableData: any[], tableColumn: VxeTableDefines.ColumnInfo[]) => {
420
- const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, showOverflow: allColumnOverflow, editConfig, treeConfig } = tableProps
421
- const { hasFixedColumn, treeExpandedMaps, scrollXLoad, scrollYLoad, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove } = tableReactData
422
+ const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps
423
+ const { hasFixedColumn, treeExpandedMaps, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove } = tableReactData
422
424
  const { fullAllDataRowIdData } = tableInternalData
423
425
  const checkboxOpts = computeCheckboxOpts.value
424
426
  const radioOpts = computeRadioOpts.value
@@ -535,7 +537,7 @@ export default defineComponent({
535
537
  cellStyle.paddingLeft = `${(rowLevel * treeOpts.indent) + 30}px`
536
538
  }
537
539
  const { showOverflow } = expandColumn
538
- const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow
540
+ const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? isAllOverflow : showOverflow
539
541
  const expandParams = { $table: $xeTable, seq, column: expandColumn, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
540
542
  rows.push(
541
543
  h('tr', {
@@ -609,7 +611,7 @@ export default defineComponent({
609
611
  const { slots } = tableContext
610
612
 
611
613
  const { fixedColumn, fixedType, tableColumn } = props
612
- const { showOverflow: allColumnOverflow, spanMethod, footerSpanMethod, mouseConfig } = tableProps
614
+ const { spanMethod, footerSpanMethod, mouseConfig } = tableProps
613
615
  const { isGroup, tableData, scrollXLoad, scrollYLoad, isAllOverflow, isDragRowMove, expandColumn, dragRow, dragCol } = tableReactData
614
616
  const { visibleColumn, fullAllDataRowIdData, fullColumnIdData } = tableInternalData
615
617
  const rowOpts = computeRowOpts.value
@@ -623,7 +625,7 @@ export default defineComponent({
623
625
  let renderColumnList = tableColumn as VxeTableDefines.ColumnInfo[]
624
626
  let isOptimizeMode = false
625
627
  // 如果是使用优化模式
626
- if (scrollXLoad || scrollYLoad || (allColumnOverflow && isAllOverflow)) {
628
+ if (scrollXLoad || scrollYLoad || isAllOverflow) {
627
629
  if (expandColumn || spanMethod || footerSpanMethod) {
628
630
  // 如果不支持优化模式
629
631
  } else {
@@ -705,7 +707,7 @@ export default defineComponent({
705
707
  $xeTable.triggerBodyScrollEvent(evnt, fixedType)
706
708
  }
707
709
  }
708
- if (leftFixedWidth || rightFixedWidth) {
710
+ if (scrollYLoad || leftFixedWidth || rightFixedWidth) {
709
711
  ons.onWheel = $xeTable.triggerBodyWheelEvent
710
712
  }
711
713
 
@@ -6,7 +6,7 @@ import { updateCellTitle } from '../../ui/src/dom'
6
6
  import { createColumn, getRowid } from './util'
7
7
  import { getSlotVNs } from '../../ui/src/vn'
8
8
 
9
- import type { VxeTableConstructor, VxeTableDefines, VxeColumnPropTypes, VxeTablePrivateMethods, VxeComponentSlotType } from '../../../types'
9
+ import type { VxeTableConstructor, VxeTableDefines, VxeTablePrivateMethods, VxeComponentSlotType } from '../../../types'
10
10
 
11
11
  const { getI18n, getIcon, renderer, formats, renderEmptyElement } = VxeUI
12
12
 
@@ -207,25 +207,6 @@ function renderTitleContent (params: VxeTableDefines.CellRenderHeaderParams & {
207
207
  ]
208
208
  }
209
209
 
210
- function formatFooterLabel (footerFormatter: VxeColumnPropTypes.FooterFormatter, params: {
211
- itemValue: any
212
- column: VxeTableDefines.ColumnInfo
213
- row: any
214
- items: any[]
215
- _columnIndex: number
216
- }) {
217
- if (XEUtils.isFunction(footerFormatter)) {
218
- return `${footerFormatter(params)}`
219
- }
220
- const isArr = XEUtils.isArray(footerFormatter)
221
- const gFormatOpts = isArr ? formats.get(footerFormatter[0]) : formats.get(footerFormatter)
222
- const footerFormatMethod = gFormatOpts ? gFormatOpts.tableFooterCellFormatMethod : null
223
- if (footerFormatMethod) {
224
- return `${isArr ? footerFormatMethod(params, ...footerFormatter.slice(1)) : footerFormatMethod(params)}`
225
- }
226
- return ''
227
- }
228
-
229
210
  function getFooterContent (params: VxeTableDefines.CellRenderFooterParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
230
211
  const { $table, column, _columnIndex, items, row } = params
231
212
  const { slots, editRender, cellRender, footerFormatter } = column
@@ -234,42 +215,39 @@ function getFooterContent (params: VxeTableDefines.CellRenderFooterParams & { $t
234
215
  if (footerSlot) {
235
216
  return $table.callSlot(footerSlot, params)
236
217
  }
218
+ let itemValue = ''
219
+ // 兼容老模式
220
+ if (XEUtils.isArray(items)) {
221
+ itemValue = items[_columnIndex]
222
+ } else {
223
+ itemValue = XEUtils.get(row, column.field)
224
+ }
225
+ const footParams = Object.assign(params, {
226
+ itemValue
227
+ })
228
+ if (footerFormatter) {
229
+ if (XEUtils.isFunction(footerFormatter)) {
230
+ return `${footerFormatter(footParams)}`
231
+ }
232
+ const isArr = XEUtils.isArray(footerFormatter)
233
+ const gFormatOpts = isArr ? formats.get(footerFormatter[0]) : formats.get(footerFormatter)
234
+ const footerFormatMethod = gFormatOpts ? gFormatOpts.tableFooterCellFormatMethod : null
235
+ if (footerFormatMethod) {
236
+ return `${isArr ? footerFormatMethod(footParams, ...footerFormatter.slice(1)) : footerFormatMethod(footParams)}`
237
+ }
238
+ return ''
239
+ }
237
240
  if (renderOpts) {
238
241
  const compConf = renderer.get(renderOpts.name)
239
242
  if (compConf) {
240
243
  const rtFooter = compConf.renderTableFooter || compConf.renderFooter
241
244
  if (rtFooter) {
242
- return getSlotVNs(rtFooter(renderOpts, params))
245
+ return getSlotVNs(rtFooter(renderOpts, footParams))
243
246
  }
244
247
  }
245
248
  }
246
- let itemValue = ''
247
- // 兼容老模式
248
- if (XEUtils.isArray(items)) {
249
- itemValue = items[_columnIndex]
250
- return [
251
- footerFormatter
252
- ? formatFooterLabel(footerFormatter, {
253
- itemValue,
254
- column,
255
- row,
256
- items,
257
- _columnIndex
258
- })
259
- : formatText(itemValue, 1)
260
- ]
261
- }
262
- itemValue = XEUtils.get(row, column.field)
263
249
  return [
264
- footerFormatter
265
- ? formatFooterLabel(footerFormatter, {
266
- itemValue,
267
- column,
268
- row,
269
- items,
270
- _columnIndex
271
- })
272
- : formatText(itemValue, 1)
250
+ formatText(itemValue, 1)
273
251
  ]
274
252
  }
275
253
 
@@ -57,6 +57,16 @@ export const columnProps = {
57
57
  formatter: [Function, Array, String] as PropType<VxeColumnPropTypes.Formatter<any>>,
58
58
  // 格式化表尾显示内容
59
59
  footerFormatter: [Function, Array, String] as PropType<VxeColumnPropTypes.FooterFormatter>,
60
+ // 是否显示间距
61
+ padding: {
62
+ type: Boolean as PropType<VxeColumnPropTypes.Padding>,
63
+ default: null
64
+ },
65
+ // 垂直对齐方式
66
+ verticalAlign: {
67
+ type: String as PropType<VxeColumnPropTypes.VerticalAlign>,
68
+ default: null
69
+ },
60
70
  // 是否允许排序
61
71
  sortable: Boolean as PropType<VxeColumnPropTypes.Sortable>,
62
72
  // 自定义排序的属性
@@ -74,6 +74,8 @@ export class ColumnInfo {
74
74
  footerClassName: _vm.footerClassName,
75
75
  formatter: formatter,
76
76
  footerFormatter: _vm.footerFormatter,
77
+ padding: _vm.padding,
78
+ verticalAlign: _vm.verticalAlign,
77
79
  sortable: _vm.sortable,
78
80
  sortBy: _vm.sortBy,
79
81
  sortType: _vm.sortType,
@@ -2,6 +2,7 @@ import { defineComponent, TransitionGroup, h, ref, Ref, PropType, inject, nextTi
2
2
  import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../ui'
4
4
  import { updateCellTitle, getPropClass } from '../../ui/src/dom'
5
+ import { getCellHeight } from './util'
5
6
 
6
7
  import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods, VxeTableDefines } from '../../../types'
7
8
 
@@ -66,7 +67,7 @@ export default defineComponent({
66
67
  const defaultRowHeight = computeDefaultRowHeight.value
67
68
  const cellOpts = computeCellOpts.value
68
69
  const footerCellOpts = computeFooterCellOpts.value
69
- const currCellHeight = footerCellOpts.height || cellOpts.height || defaultRowHeight
70
+ const currCellHeight = getCellHeight(footerCellOpts.height || cellOpts.height) || defaultRowHeight
70
71
 
71
72
  return tableColumn.map((column, $columnIndex) => {
72
73
  const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, TransitionGroup, h, ref, Ref, PropType, inject, nextTick, watch, onMounted, onUnmounted } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../ui'
4
- import { convertHeaderColumnToRows } from './util'
4
+ import { getCellHeight, convertHeaderColumnToRows } from './util'
5
5
 
6
6
  import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods, VxeTableDefines, VxeColumnPropTypes } from '../../../types'
7
7
 
@@ -52,7 +52,7 @@ export default defineComponent({
52
52
  const cellOpts = computeCellOpts.value
53
53
  const defaultRowHeight = computeDefaultRowHeight.value
54
54
  const headerCellOpts = computeHeaderCellOpts.value
55
- const currCellHeight = headerCellOpts.height || cellOpts.height || defaultRowHeight
55
+ const currCellHeight = getCellHeight(headerCellOpts.height || cellOpts.height) || defaultRowHeight
56
56
  const { disabledMethod: dragDisabledMethod, isCrossDrag, isPeerDrag } = columnDragOpts
57
57
  return cols.map((column, $columnIndex) => {
58
58
  const { type, showHeaderOverflow, headerAlign, align, filters, headerClassName, editRender, cellRender } = column