vxe-table 4.10.6-beta.9 → 4.10.7

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 (178) hide show
  1. package/es/grid/src/grid.js +1 -1
  2. package/es/index.css +1 -1
  3. package/es/index.min.css +1 -1
  4. package/es/locale/lang/ar-EG.js +2 -1
  5. package/es/locale/lang/de-DE.js +2 -1
  6. package/es/locale/lang/en-US.js +4 -3
  7. package/es/locale/lang/es-ES.js +2 -1
  8. package/es/locale/lang/fr-FR.js +2 -1
  9. package/es/locale/lang/hu-HU.js +2 -1
  10. package/es/locale/lang/hy-AM.js +2 -1
  11. package/es/locale/lang/it-IT.js +2 -1
  12. package/es/locale/lang/ja-JP.js +2 -1
  13. package/es/locale/lang/ko-KR.js +2 -1
  14. package/es/locale/lang/nb-NO.js +2 -1
  15. package/es/locale/lang/pt-BR.js +2 -1
  16. package/es/locale/lang/ru-RU.js +4 -3
  17. package/es/locale/lang/th-TH.js +2 -1
  18. package/es/locale/lang/ug-CN.js +2 -1
  19. package/es/locale/lang/uk-UA.js +518 -517
  20. package/es/locale/lang/vi-VN.js +2 -1
  21. package/es/locale/lang/zh-CHT.js +2 -1
  22. package/es/locale/lang/zh-CN.js +2 -1
  23. package/es/style.css +1 -1
  24. package/es/style.min.css +1 -1
  25. package/es/table/module/edit/hook.js +7 -7
  26. package/es/table/module/export/hook.js +97 -62
  27. package/es/table/module/keyboard/hook.js +63 -27
  28. package/es/table/src/body.js +107 -85
  29. package/es/table/src/cell.js +41 -55
  30. package/es/table/src/column.js +13 -1
  31. package/es/table/src/columnInfo.js +3 -0
  32. package/es/table/src/emits.js +2 -0
  33. package/es/table/src/footer.js +45 -7
  34. package/es/table/src/header.js +67 -165
  35. package/es/table/src/props.js +14 -4
  36. package/es/table/src/table.js +858 -398
  37. package/es/table/src/util.js +77 -62
  38. package/es/table/style.css +246 -191
  39. package/es/table/style.min.css +1 -1
  40. package/es/ui/index.js +20 -7
  41. package/es/ui/src/log.js +1 -1
  42. package/es/vxe-table/style.css +246 -191
  43. package/es/vxe-table/style.min.css +1 -1
  44. package/lib/grid/src/grid.js +1 -1
  45. package/lib/grid/src/grid.min.js +1 -1
  46. package/lib/index.css +1 -1
  47. package/lib/index.min.css +1 -1
  48. package/lib/index.umd.js +1479 -875
  49. package/lib/index.umd.min.js +1 -1
  50. package/lib/locale/lang/ar-EG.js +2 -1
  51. package/lib/locale/lang/ar-EG.min.js +1 -1
  52. package/lib/locale/lang/de-DE.js +2 -1
  53. package/lib/locale/lang/de-DE.min.js +1 -1
  54. package/lib/locale/lang/en-US.js +4 -3
  55. package/lib/locale/lang/en-US.min.js +1 -1
  56. package/lib/locale/lang/en-US.umd.js +4 -3
  57. package/lib/locale/lang/es-ES.js +2 -1
  58. package/lib/locale/lang/es-ES.min.js +1 -1
  59. package/lib/locale/lang/es-ES.umd.js +2 -1
  60. package/lib/locale/lang/fr-FR.js +2 -1
  61. package/lib/locale/lang/fr-FR.min.js +1 -1
  62. package/lib/locale/lang/hu-HU.js +2 -1
  63. package/lib/locale/lang/hu-HU.min.js +1 -1
  64. package/lib/locale/lang/hu-HU.umd.js +2 -1
  65. package/lib/locale/lang/hy-AM.js +2 -1
  66. package/lib/locale/lang/hy-AM.min.js +1 -1
  67. package/lib/locale/lang/it-IT.js +2 -1
  68. package/lib/locale/lang/it-IT.min.js +1 -1
  69. package/lib/locale/lang/ja-JP.js +2 -1
  70. package/lib/locale/lang/ja-JP.min.js +1 -1
  71. package/lib/locale/lang/ja-JP.umd.js +2 -1
  72. package/lib/locale/lang/ko-KR.js +2 -1
  73. package/lib/locale/lang/ko-KR.min.js +1 -1
  74. package/lib/locale/lang/ko-KR.umd.js +2 -1
  75. package/lib/locale/lang/nb-NO.js +2 -1
  76. package/lib/locale/lang/nb-NO.min.js +1 -1
  77. package/lib/locale/lang/pt-BR.js +2 -1
  78. package/lib/locale/lang/pt-BR.min.js +1 -1
  79. package/lib/locale/lang/pt-BR.umd.js +2 -1
  80. package/lib/locale/lang/ru-RU.js +4 -3
  81. package/lib/locale/lang/ru-RU.min.js +1 -1
  82. package/lib/locale/lang/ru-RU.umd.js +4 -3
  83. package/lib/locale/lang/th-TH.js +2 -1
  84. package/lib/locale/lang/th-TH.min.js +1 -1
  85. package/lib/locale/lang/ug-CN.js +2 -1
  86. package/lib/locale/lang/ug-CN.min.js +1 -1
  87. package/lib/locale/lang/uk-UA.js +518 -517
  88. package/lib/locale/lang/uk-UA.min.js +1 -1
  89. package/lib/locale/lang/uk-UA.umd.js +518 -517
  90. package/lib/locale/lang/vi-VN.js +2 -1
  91. package/lib/locale/lang/vi-VN.min.js +1 -1
  92. package/lib/locale/lang/zh-CHT.js +2 -1
  93. package/lib/locale/lang/zh-CHT.min.js +1 -1
  94. package/lib/locale/lang/zh-CN.js +2 -1
  95. package/lib/locale/lang/zh-CN.min.js +1 -1
  96. package/lib/locale/lang/zh-CN.umd.js +2 -1
  97. package/lib/style.css +1 -1
  98. package/lib/style.min.css +1 -1
  99. package/lib/table/module/edit/hook.js +7 -2
  100. package/lib/table/module/edit/hook.min.js +1 -1
  101. package/lib/table/module/export/hook.js +97 -57
  102. package/lib/table/module/export/hook.min.js +1 -1
  103. package/lib/table/module/keyboard/hook.js +71 -28
  104. package/lib/table/module/keyboard/hook.min.js +1 -1
  105. package/lib/table/src/body.js +111 -81
  106. package/lib/table/src/body.min.js +1 -1
  107. package/lib/table/src/cell.js +32 -42
  108. package/lib/table/src/cell.min.js +1 -1
  109. package/lib/table/src/column.js +13 -1
  110. package/lib/table/src/column.min.js +1 -1
  111. package/lib/table/src/columnInfo.js +3 -0
  112. package/lib/table/src/columnInfo.min.js +1 -1
  113. package/lib/table/src/emits.js +1 -1
  114. package/lib/table/src/emits.min.js +1 -1
  115. package/lib/table/src/footer.js +45 -5
  116. package/lib/table/src/footer.min.js +1 -1
  117. package/lib/table/src/header.js +51 -178
  118. package/lib/table/src/header.min.js +1 -1
  119. package/lib/table/src/props.js +14 -4
  120. package/lib/table/src/props.min.js +1 -1
  121. package/lib/table/src/table.js +911 -384
  122. package/lib/table/src/table.min.js +1 -1
  123. package/lib/table/src/util.js +100 -82
  124. package/lib/table/src/util.min.js +1 -1
  125. package/lib/table/style/style.css +246 -191
  126. package/lib/table/style/style.min.css +1 -1
  127. package/lib/ui/index.js +20 -7
  128. package/lib/ui/index.min.js +1 -1
  129. package/lib/ui/src/log.js +1 -1
  130. package/lib/ui/src/log.min.js +1 -1
  131. package/lib/vxe-table/style/style.css +246 -191
  132. package/lib/vxe-table/style/style.min.css +1 -1
  133. package/package.json +2 -2
  134. package/packages/grid/src/grid.ts +1 -1
  135. package/packages/locale/lang/ar-EG.ts +2 -1
  136. package/packages/locale/lang/de-DE.ts +2 -1
  137. package/packages/locale/lang/en-US.ts +4 -3
  138. package/packages/locale/lang/es-ES.ts +2 -1
  139. package/packages/locale/lang/fr-FR.ts +2 -1
  140. package/packages/locale/lang/hu-HU.ts +2 -1
  141. package/packages/locale/lang/hy-AM.ts +2 -1
  142. package/packages/locale/lang/it-IT.ts +2 -1
  143. package/packages/locale/lang/ja-JP.ts +2 -1
  144. package/packages/locale/lang/ko-KR.ts +2 -1
  145. package/packages/locale/lang/nb-NO.ts +2 -1
  146. package/packages/locale/lang/pt-BR.ts +2 -1
  147. package/packages/locale/lang/ru-RU.ts +4 -3
  148. package/packages/locale/lang/th-TH.ts +2 -1
  149. package/packages/locale/lang/ug-CN.ts +2 -1
  150. package/packages/locale/lang/uk-UA.ts +518 -517
  151. package/packages/locale/lang/vi-VN.ts +2 -1
  152. package/packages/locale/lang/zh-CHT.ts +2 -1
  153. package/packages/locale/lang/zh-CN.ts +2 -1
  154. package/packages/table/module/edit/hook.ts +7 -7
  155. package/packages/table/module/export/hook.ts +118 -65
  156. package/packages/table/module/keyboard/hook.ts +59 -25
  157. package/packages/table/src/body.ts +126 -95
  158. package/packages/table/src/cell.ts +41 -63
  159. package/packages/table/src/column.ts +13 -1
  160. package/packages/table/src/columnInfo.ts +3 -0
  161. package/packages/table/src/emits.ts +5 -1
  162. package/packages/table/src/footer.ts +48 -8
  163. package/packages/table/src/header.ts +67 -165
  164. package/packages/table/src/props.ts +14 -5
  165. package/packages/table/src/table.ts +862 -398
  166. package/packages/table/src/util.ts +81 -62
  167. package/packages/ui/index.ts +19 -6
  168. package/styles/components/table.scss +313 -274
  169. package/styles/theme/base.scss +4 -6
  170. package/styles/theme/dark.scss +1 -0
  171. package/styles/theme/light.scss +1 -0
  172. package/styles/variable.scss +1 -1
  173. /package/es/{iconfont.1736854674495.ttf → iconfont.1739008158505.ttf} +0 -0
  174. /package/es/{iconfont.1736854674495.woff → iconfont.1739008158505.woff} +0 -0
  175. /package/es/{iconfont.1736854674495.woff2 → iconfont.1739008158505.woff2} +0 -0
  176. /package/lib/{iconfont.1736854674495.ttf → iconfont.1739008158505.ttf} +0 -0
  177. /package/lib/{iconfont.1736854674495.woff → iconfont.1739008158505.woff} +0 -0
  178. /package/lib/{iconfont.1736854674495.woff2 → iconfont.1739008158505.woff2} +0 -0
@@ -6,7 +6,7 @@ import { updateCellTitle, getPropClass } from '../../ui/src/dom'
6
6
  import { isEnableConf } from '../../ui/src/utils'
7
7
  import { getSlotVNs } from '../../ui/src/vn'
8
8
 
9
- import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableDefines, VxeTableMethods, VxeComponentSlotType, VxeColumnPropTypes } from '../../../types'
9
+ import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableDefines, VxeComponentSlotType } from '../../../types'
10
10
 
11
11
  const { getI18n, renderer, renderEmptyElement } = VxeUI
12
12
 
@@ -24,10 +24,10 @@ export default defineComponent({
24
24
  }
25
25
  },
26
26
  setup (props) {
27
- const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods)
27
+ const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTablePrivateMethods)
28
28
 
29
29
  const { xID, props: tableProps, context: tableContext, reactData: tableReactData, internalData: tableInternalData } = $xeTable
30
- const { computeEditOpts, computeMouseOpts, computeAreaOpts, computeDefaultRowHeight, computeEmptyOpts, computeTooltipOpts, computeRadioOpts, computeExpandOpts, computeTreeOpts, computeCheckboxOpts, computeCellOpts, computeValidOpts, computeRowOpts, computeColumnOpts, computeRowDragOpts, computeColumnDragOpts, computeLeftFixedWidth, computeRightFixedWidth } = $xeTable.getComputeMaps()
30
+ const { computeEditOpts, computeMouseOpts, computeAreaOpts, computeDefaultRowHeight, computeEmptyOpts, computeTooltipOpts, computeRadioOpts, computeExpandOpts, computeTreeOpts, computeCheckboxOpts, computeCellOpts, computeValidOpts, computeRowOpts, computeColumnOpts, computeRowDragOpts, computeColumnDragOpts, computeLeftFixedWidth, computeRightFixedWidth, computeResizableOpts } = $xeTable.getComputeMaps()
31
31
 
32
32
  const refElem = ref() as Ref<HTMLDivElement>
33
33
  const refBodyScroll = ref() as Ref<HTMLDivElement>
@@ -41,11 +41,11 @@ export default defineComponent({
41
41
  // 滚动、拖动过程中不需要触发
42
42
  const isVMScrollProcess = () => {
43
43
  const { delayHover } = tableProps
44
- const { lastScrollTime, _isResize } = tableReactData
45
- return !!(_isResize || (lastScrollTime && Date.now() < lastScrollTime + (delayHover as number)))
44
+ const { lastScrollTime, isDragResize } = tableReactData
45
+ return !!(isDragResize || (lastScrollTime && Date.now() < lastScrollTime + (delayHover as number)))
46
46
  }
47
47
 
48
- const renderLine = (params: VxeTableDefines.CellRenderBodyParams) => {
48
+ const renderLine = (params: VxeTableDefines.CellRenderBodyParams, cellHeight: number) => {
49
49
  const { row, column } = params
50
50
  const { afterFullData } = tableInternalData
51
51
  const { treeConfig } = tableProps
@@ -67,12 +67,14 @@ export default defineComponent({
67
67
  if (treeConfig && treeNode && (treeOpts.showLine || treeOpts.line)) {
68
68
  return [
69
69
  h('div', {
70
+ key: 'tl',
70
71
  class: 'vxe-tree--line-wrapper'
71
72
  }, [
72
73
  h('div', {
73
74
  class: 'vxe-tree--line',
74
75
  style: {
75
76
  height: `${isFirstRow ? 1 : calcTreeLine(params, prevRow)}px`,
77
+ bottom: `-${Math.floor(cellHeight / 2)}px`,
76
78
  left: `${(rLevel * treeOpts.indent) + (rLevel ? 2 - getOffsetSize($xeTable) : 0) + 16}px`
77
79
  }
78
80
  })
@@ -88,7 +90,7 @@ export default defineComponent({
88
90
  const renderTdColumn = (
89
91
  seq: number | string,
90
92
  rowid: string,
91
- fixedType: VxeColumnPropTypes.Fixed,
93
+ fixedType: 'left' | 'right' | '',
92
94
  isOptimizeMode: boolean,
93
95
  rowLevel: number,
94
96
  row: any,
@@ -101,26 +103,29 @@ export default defineComponent({
101
103
  items: any[]
102
104
  ) => {
103
105
  const { fullAllDataRowIdData } = tableInternalData
104
- const { columnKey, height, showOverflow: allColumnOverflow, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig } = tableProps
105
- const { tableData, overflowX, currentColumn, scrollXLoad, scrollYLoad, isCalcCellHeight, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData
106
+ const { columnKey, resizable: allResizable, border, height, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps
107
+ const { tableData, overflowX, currentColumn, scrollXLoad, scrollYLoad, calcCellHeightFlag, resizeHeightFlag, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData
106
108
  const { afterFullData, scrollXStore, scrollYStore } = tableInternalData
107
109
  const cellOpts = computeCellOpts.value
108
110
  const validOpts = computeValidOpts.value
109
111
  const checkboxOpts = computeCheckboxOpts.value
110
112
  const editOpts = computeEditOpts.value
111
113
  const tooltipOpts = computeTooltipOpts.value
114
+ const resizableOpts = computeResizableOpts.value
115
+ const { isAllColumnDrag, isAllRowDrag } = resizableOpts
112
116
  const rowOpts = computeRowOpts.value
113
117
  const rowDragOpts = computeRowDragOpts.value
114
118
  const defaultRowHeight = computeDefaultRowHeight.value
119
+ const customCellHeight = cellOpts.height || rowOpts.height
115
120
  const { disabledMethod: dragDisabledMethod, isCrossDrag, isPeerDrag } = rowDragOpts
116
121
  const columnOpts = computeColumnOpts.value
117
122
  const mouseOpts = computeMouseOpts.value
118
123
  const areaOpts = computeAreaOpts.value
119
124
  const { selectCellToRow } = areaOpts
120
- const { type, cellRender, editRender, align, showOverflow, className, treeNode, slots } = column
121
- const { verticalAlign } = cellOpts
125
+ const { type, cellRender, editRender, align, showOverflow, className, treeNode, rowResize, padding, verticalAlign, slots } = column
126
+ const { verticalAlign: allVerticalAlign } = cellOpts
122
127
  const { actived } = editStore
123
- const { height: customRHeight } = rowOpts
128
+ const rowRest = fullAllDataRowIdData[rowid]
124
129
  const colid = column.id
125
130
  const renderOpts = editRender || cellRender
126
131
  const compConf = renderOpts ? renderer.get(renderOpts.name) : null
@@ -130,21 +135,27 @@ export default defineComponent({
130
135
  const columnIndex = $xeTable.getColumnIndex(column)
131
136
  const _columnIndex = $xeTable.getVTColumnIndex(column)
132
137
  const isEdit = isEnableConf(editRender)
138
+ const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0
133
139
  let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX
134
- const cellOverflow = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow
140
+ const isCellPadding = XEUtils.eqNull(padding) ? (allPadding === null ? cellOpts.padding : allPadding) : padding
141
+ const cellOverflow = XEUtils.eqNull(showOverflow) ? isAllOverflow : showOverflow
135
142
  const showEllipsis = cellOverflow === 'ellipsis'
136
143
  const showTitle = cellOverflow === 'title'
137
144
  const showTooltip = cellOverflow === true || cellOverflow === 'tooltip'
138
- // 如果表格加上 showOverflow 则不再支持列单独设置
139
- const hasEllipsis = allColumnOverflow || showTitle || showTooltip || showEllipsis
145
+ const hasEllipsis = isAllOverflow || showTitle || showTooltip || showEllipsis
146
+ const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
147
+ const isCsHeight = !!customCellHeight
148
+ const isRsHeight = resizeHeight > 0
140
149
  let isDirty
141
150
  const tdOns: any = {}
142
- const rest = fullAllDataRowIdData[rowid]
143
151
  const cellAlign = align || (compConf ? compConf.tableCellAlign : '') || allAlign
152
+ const cellVerticalAlign = XEUtils.eqNull(verticalAlign) ? allVerticalAlign : verticalAlign
144
153
  const errorValidItem = validErrorMaps[`${rowid}:${colid}`]
145
154
  const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? (height || tableData.length > 1) : validOpts.message === 'inline')
146
- const attrs: any = { colid }
147
- const params: VxeTableDefines.CellRenderBodyParams = {
155
+ const tdAttrs: any = { colid }
156
+ const cellParams: VxeTableDefines.CellRenderBodyParams & {
157
+ $table: VxeTableConstructor<any> & VxeTablePrivateMethods
158
+ } = {
148
159
  $table: $xeTable,
149
160
  $grid: $xeTable.xegrid,
150
161
  isEdit: false,
@@ -172,7 +183,7 @@ export default defineComponent({
172
183
  isRowDragCell = rowDragOpts.trigger === 'row' || (column.dragSort && rowDragOpts.trigger === 'cell')
173
184
  }
174
185
  if (isRowDragCell) {
175
- isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(params))
186
+ isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(cellParams))
176
187
  }
177
188
  // hover 进入事件
178
189
  if (showTitle || showTooltip || showAllTip || tooltipConfig) {
@@ -184,9 +195,9 @@ export default defineComponent({
184
195
  updateCellTitle(evnt.currentTarget, column)
185
196
  } else if (showTooltip || showAllTip) {
186
197
  // 如果配置了显示 tooltip
187
- $xeTable.triggerBodyTooltipEvent(evnt, params)
198
+ $xeTable.triggerBodyTooltipEvent(evnt, cellParams)
188
199
  }
189
- $xeTable.dispatchEvent('cell-mouseenter', Object.assign({ cell: evnt.currentTarget }, params), evnt)
200
+ $xeTable.dispatchEvent('cell-mouseenter', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt)
190
201
  }
191
202
  }
192
203
  // hover 退出事件
@@ -198,13 +209,13 @@ export default defineComponent({
198
209
  if (showTooltip || showAllTip) {
199
210
  $xeTable.handleTargetLeaveEvent(evnt)
200
211
  }
201
- $xeTable.dispatchEvent('cell-mouseleave', Object.assign({ cell: evnt.currentTarget }, params), evnt)
212
+ $xeTable.dispatchEvent('cell-mouseleave', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt)
202
213
  }
203
214
  }
204
215
  // 按下事件处理
205
216
  if (isRowDragCell || checkboxOpts.range || mouseConfig) {
206
217
  tdOns.onMousedown = (evnt: MouseEvent) => {
207
- $xeTable.triggerCellMousedownEvent(evnt, params)
218
+ $xeTable.triggerCellMousedownEvent(evnt, cellParams)
208
219
  }
209
220
  }
210
221
  // 拖拽列事件
@@ -213,11 +224,11 @@ export default defineComponent({
213
224
  }
214
225
  // 点击事件处理
215
226
  tdOns.onClick = (evnt: MouseEvent) => {
216
- $xeTable.triggerCellClickEvent(evnt, params)
227
+ $xeTable.triggerCellClickEvent(evnt, cellParams)
217
228
  }
218
229
  // 双击事件处理
219
230
  tdOns.onDblclick = (evnt: MouseEvent) => {
220
- $xeTable.triggerCellDblclickEvent(evnt, params)
231
+ $xeTable.triggerCellDblclickEvent(evnt, cellParams)
221
232
  }
222
233
  // 合并行或列
223
234
  if (mergeList.length) {
@@ -228,28 +239,28 @@ export default defineComponent({
228
239
  return null
229
240
  }
230
241
  if (rowspan > 1) {
231
- attrs.rowspan = rowspan
242
+ tdAttrs.rowspan = rowspan
232
243
  }
233
244
  if (colspan > 1) {
234
- attrs.colspan = colspan
245
+ tdAttrs.colspan = colspan
235
246
  }
236
247
  }
237
248
  } else if (spanMethod) {
238
249
  // 自定义合并行或列的方法
239
- const { rowspan = 1, colspan = 1 } = spanMethod(params) || {}
250
+ const { rowspan = 1, colspan = 1 } = spanMethod(cellParams) || {}
240
251
  if (!rowspan || !colspan) {
241
252
  return null
242
253
  }
243
254
  if (rowspan > 1) {
244
- attrs.rowspan = rowspan
255
+ tdAttrs.rowspan = rowspan
245
256
  }
246
257
  if (colspan > 1) {
247
- attrs.colspan = colspan
258
+ tdAttrs.colspan = colspan
248
259
  }
249
260
  }
250
261
  // 如果被合并不可隐藏
251
262
  if (fixedHiddenColumn && mergeList) {
252
- if (attrs.colspan > 1 || attrs.rowspan > 1) {
263
+ if (tdAttrs.colspan > 1 || tdAttrs.rowspan > 1) {
253
264
  fixedHiddenColumn = false
254
265
  }
255
266
  }
@@ -259,31 +270,30 @@ export default defineComponent({
259
270
  }
260
271
 
261
272
  const isVNAutoHeight = scrollYLoad && !hasEllipsis
262
- let cellHeight = 0
263
- const vnHeight = isCalcCellHeight ? rest.height : 0
264
- if (hasEllipsis) {
265
- if (customRHeight) {
266
- cellHeight = customRHeight
267
- } else if (!isAllOverflow) {
268
- cellHeight = vnHeight || defaultRowHeight || 18
269
- }
270
- } else {
271
- cellHeight = vnHeight || defaultRowHeight || 18
273
+ const cellHeight = calcCellHeightFlag ? (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight) : defaultRowHeight
274
+
275
+ const isLastColumn = $columnIndex === columns.length - 1
276
+ const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
277
+
278
+ let isVNPreEmptyStatus = false
279
+ if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
280
+ isVNPreEmptyStatus = true
281
+ } else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
282
+ isVNPreEmptyStatus = true
272
283
  }
273
284
 
274
285
  const tcStyle: Record<string, string> = {}
275
- if (cellHeight) {
276
- if (hasEllipsis) {
277
- tcStyle.maxHeight = `${cellHeight}px`
278
- } else if (isVNAutoHeight) {
279
- tcStyle.height = `${cellHeight}px`
280
- }
286
+ if (scrollYLoad || hasEllipsis || isCsHeight || isRsHeight) {
287
+ tcStyle.height = `${cellHeight}px`
288
+ } else {
289
+ tcStyle.minHeight = `${cellHeight}px`
281
290
  }
282
291
 
283
292
  const tdVNs: any[] = []
284
- if (fixedHiddenColumn && (allColumnOverflow ? isAllOverflow : allColumnOverflow)) {
293
+ if (fixedHiddenColumn && isAllOverflow) {
285
294
  tdVNs.push(
286
295
  h('div', {
296
+ key: 'tc',
287
297
  class: ['vxe-cell', {
288
298
  'c--title': showTitle,
289
299
  'c--tooltip': showTooltip,
@@ -295,8 +305,9 @@ export default defineComponent({
295
305
  } else {
296
306
  // 渲染单元格
297
307
  tdVNs.push(
298
- ...renderLine(params),
308
+ ...renderLine(cellParams, cellHeight),
299
309
  h('div', {
310
+ key: 'tc',
300
311
  class: ['vxe-cell', {
301
312
  'c--title': showTitle,
302
313
  'c--tooltip': showTooltip,
@@ -304,20 +315,23 @@ export default defineComponent({
304
315
  }],
305
316
  style: tcStyle,
306
317
  title: showTitle ? $xeTable.getCellLabel(row, column) : null
307
- }, isVNAutoHeight
308
- ? [
318
+ }, isVNPreEmptyStatus
319
+ ? []
320
+ : [
309
321
  h('div', {
310
- class: 'vxe-cell--auto-wrapper'
311
- }, column.renderCell(params))
312
- ]
313
- : column.renderCell(params))
322
+ colid,
323
+ rowid,
324
+ class: 'vxe-cell--wrapper'
325
+ }, column.renderCell(cellParams))
326
+ ])
314
327
  )
315
328
  if (showValidTip && errorValidItem) {
316
329
  const errRule = errorValidItem.rule
317
330
  const validSlot = slots ? slots.valid : null
318
- const validParams = { ...params, ...errorValidItem, rule: errorValidItem }
331
+ const validParams = { ...cellParams, ...errorValidItem, rule: errorValidItem }
319
332
  tdVNs.push(
320
333
  h('div', {
334
+ key: 'tcv',
321
335
  class: ['vxe-cell--valid-error-tip', getPropClass(validOpts.className, validParams)],
322
336
  style: errRule && errRule.maxWidth
323
337
  ? {
@@ -341,43 +355,59 @@ export default defineComponent({
341
355
  }
342
356
  }
343
357
 
358
+ let showAreaRowStatus = false
344
359
  if (mouseConfig && mouseOpts.area && selectCellToRow) {
345
360
  if (
346
- (!$columnIndex && selectCellToRow === true) ||
361
+ (!_columnIndex && selectCellToRow === true) ||
347
362
  (selectCellToRow === column.field)
348
363
  ) {
349
- tdVNs.push(
350
- h('div', {
351
- class: 'vxe-cell--area-status'
352
- })
353
- )
364
+ showAreaRowStatus = true
354
365
  }
355
366
  }
356
- const isLastColumn = $columnIndex === columns.length - 1
357
- const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
358
367
 
359
- let isVNPreEmptyStatus = false
360
- if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
361
- isVNPreEmptyStatus = true
362
- } else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
363
- isVNPreEmptyStatus = true
368
+ if (!fixedHiddenColumn && showResizable && isAllColumnDrag) {
369
+ tdVNs.push(
370
+ h('div', {
371
+ key: 'tcc',
372
+ class: ['vxe-cell--col-resizable', {
373
+ 'is--line': !border || border === 'none'
374
+ }],
375
+ onMousedown: (evnt: MouseEvent) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
376
+ onDblclick: (evnt: MouseEvent) => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
377
+ })
378
+ )
379
+ }
380
+
381
+ if ((rowResize || isAllRowDrag) && rowOpts.resizable) {
382
+ tdVNs.push(
383
+ h('div', {
384
+ key: 'tcr',
385
+ class: 'vxe-cell--row-resizable',
386
+ onMousedown: (evnt: MouseEvent) => $xeTable.handleRowResizeMousedownEvent(evnt, cellParams),
387
+ onDblclick: (evnt: MouseEvent) => $xeTable.handleRowResizeDblclickEvent(evnt, cellParams)
388
+ })
389
+ )
364
390
  }
365
391
 
366
392
  return h('td', {
367
393
  class: [
368
394
  'vxe-body--column',
369
395
  colid,
396
+ cellVerticalAlign ? `col--vertical-${cellVerticalAlign}` : '',
397
+ cellAlign ? `col--${cellAlign}` : '',
398
+ type ? `col--${type}` : '',
370
399
  {
371
- [`col--${cellAlign}`]: cellAlign,
372
- [`col--vertical-${verticalAlign}`]: verticalAlign,
373
- [`col--${type}`]: type,
374
400
  'col--last': isLastColumn,
375
401
  'col--tree-node': treeNode,
376
402
  'col--edit': isEdit,
377
403
  'col--ellipsis': hasEllipsis,
404
+ 'col--cs-height': isCsHeight,
405
+ 'col--rs-height': isRsHeight,
406
+ 'col--to-row': showAreaRowStatus,
378
407
  'col--auto-height': isVNAutoHeight,
379
408
  'fixed--width': !isAutoCellWidth,
380
409
  'fixed--hidden': fixedHiddenColumn,
410
+ 'is--padding': isCellPadding,
381
411
  'is--drag-cell': isRowDragCell && (isCrossDrag || isPeerDrag || !rowLevel),
382
412
  'is--drag-disabled': isDisabledDrag,
383
413
  'col--dirty': isDirty,
@@ -385,22 +415,20 @@ export default defineComponent({
385
415
  'col--valid-error': !!errorValidItem,
386
416
  'col--current': currentColumn === column
387
417
  },
388
- getPropClass(compCellClassName, params),
389
- getPropClass(className, params),
390
- getPropClass(allCellClassName, params)
418
+ getPropClass(compCellClassName, cellParams),
419
+ getPropClass(className, cellParams),
420
+ getPropClass(allCellClassName, cellParams)
391
421
  ],
392
422
  key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || rowOpts.useKey || columnOpts.drag ? colid : $columnIndex,
393
- ...attrs,
394
- style: Object.assign({
395
- height: cellHeight ? `${cellHeight}px` : ''
396
- }, XEUtils.isFunction(compCellStyle) ? compCellStyle(params) : compCellStyle, XEUtils.isFunction(cellStyle) ? cellStyle(params) : cellStyle),
423
+ ...tdAttrs,
424
+ style: Object.assign({}, XEUtils.isFunction(compCellStyle) ? compCellStyle(cellParams) : compCellStyle, XEUtils.isFunction(cellStyle) ? cellStyle(cellParams) : cellStyle),
397
425
  ...tdOns
398
- }, isVNPreEmptyStatus || (isOptimizeMode && fixedHiddenColumn) ? [] : tdVNs)
426
+ }, isOptimizeMode && fixedHiddenColumn ? [] : tdVNs)
399
427
  }
400
428
 
401
- const renderRows = (fixedType: VxeColumnPropTypes.Fixed, isOptimizeMode: boolean, tableData: any[], tableColumn: VxeTableDefines.ColumnInfo[]) => {
402
- const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, showOverflow: allColumnOverflow, editConfig, treeConfig } = tableProps
403
- const { hasFixedColumn, treeExpandedMaps, scrollXLoad, scrollYLoad, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove } = tableReactData
429
+ const renderRows = (fixedType: 'left' | 'right' | '', isOptimizeMode: boolean, tableData: any[], tableColumn: VxeTableDefines.ColumnInfo[]) => {
430
+ const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps
431
+ const { hasFixedColumn, treeExpandedMaps, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove } = tableReactData
404
432
  const { fullAllDataRowIdData } = tableInternalData
405
433
  const checkboxOpts = computeCheckboxOpts.value
406
434
  const radioOpts = computeRadioOpts.value
@@ -485,7 +513,7 @@ export default defineComponent({
485
513
  return renderTdColumn(seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData)
486
514
  })
487
515
  rows.push(
488
- columnOpts.drag && columnDragOpts.animation
516
+ !isColLoading && (columnOpts.drag && columnDragOpts.animation)
489
517
  ? h(TransitionGroup, {
490
518
  name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
491
519
  tag: 'tr',
@@ -517,7 +545,7 @@ export default defineComponent({
517
545
  cellStyle.paddingLeft = `${(rowLevel * treeOpts.indent) + 30}px`
518
546
  }
519
547
  const { showOverflow } = expandColumn
520
- const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow
548
+ const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? isAllOverflow : showOverflow
521
549
  const expandParams = { $table: $xeTable, seq, column: expandColumn, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
522
550
  rows.push(
523
551
  h('tr', {
@@ -591,8 +619,8 @@ export default defineComponent({
591
619
  const { slots } = tableContext
592
620
 
593
621
  const { fixedColumn, fixedType, tableColumn } = props
594
- const { showOverflow: allColumnOverflow, spanMethod, footerSpanMethod, mouseConfig } = tableProps
595
- const { isGroup, tableData, scrollXLoad, scrollYLoad, isAllOverflow, isDragRowMove, expandColumn, dragRow, dragCol } = tableReactData
622
+ const { spanMethod, footerSpanMethod, mouseConfig } = tableProps
623
+ const { isGroup, tableData, isRowLoading, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, isDragRowMove, expandColumn, dragRow, dragCol } = tableReactData
596
624
  const { visibleColumn, fullAllDataRowIdData, fullColumnIdData } = tableInternalData
597
625
  const rowOpts = computeRowOpts.value
598
626
  const emptyOpts = computeEmptyOpts.value
@@ -605,7 +633,7 @@ export default defineComponent({
605
633
  let renderColumnList = tableColumn as VxeTableDefines.ColumnInfo[]
606
634
  let isOptimizeMode = false
607
635
  // 如果是使用优化模式
608
- if (scrollXLoad || scrollYLoad || (allColumnOverflow && isAllOverflow)) {
636
+ if (scrollXLoad || scrollYLoad || isAllOverflow) {
609
637
  if (expandColumn || spanMethod || footerSpanMethod) {
610
638
  // 如果不支持优化模式
611
639
  } else {
@@ -719,21 +747,21 @@ export default defineComponent({
719
747
  cellpadding: 0,
720
748
  border: 0
721
749
  }, [
722
- /**
723
- * 列宽
724
- */
750
+ /**
751
+ * 列宽
752
+ */
725
753
  h('colgroup', {
726
754
  ref: refBodyColgroup
727
- }, (renderColumnList as any[]).map((column, $columnIndex) => {
755
+ }, renderColumnList.map((column, $columnIndex) => {
728
756
  return h('col', {
729
757
  name: column.id,
730
758
  key: $columnIndex
731
759
  })
732
760
  })),
733
761
  /**
734
- * 内容
735
- */
736
- rowOpts.drag && rowDragOpts.animation
762
+ * 内容
763
+ */
764
+ !(isRowLoading || isColLoading) && (rowOpts.drag && rowDragOpts.animation)
737
765
  ? h(TransitionGroup, {
738
766
  ref: refBodyTBody,
739
767
  name: `vxe-body--row-list${isDragRowMove ? '' : '-disabled'}`,
@@ -777,6 +805,9 @@ export default defineComponent({
777
805
  }),
778
806
  h('span', {
779
807
  class: 'vxe-table--cell-active-area'
808
+ }),
809
+ h('span', {
810
+ class: 'vxe-table--cell-row-status-area'
780
811
  })
781
812
  ])
782
813
  : renderEmptyElement($xeTable),
@@ -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
 
@@ -173,7 +173,7 @@ function renderTitleContent (params: VxeTableDefines.CellRenderHeaderParams & {
173
173
  const ons: Record<string, any> = {}
174
174
  if (showTitle || showTooltip || showAllTip) {
175
175
  ons.onMouseenter = (evnt: MouseEvent) => {
176
- if (tableReactData._isResize) {
176
+ if (tableReactData.isDragResize) {
177
177
  return
178
178
  }
179
179
  if (showTitle) {
@@ -185,7 +185,7 @@ function renderTitleContent (params: VxeTableDefines.CellRenderHeaderParams & {
185
185
  }
186
186
  if (showTooltip || showAllTip) {
187
187
  ons.onMouseleave = (evnt: MouseEvent) => {
188
- if (tableReactData._isResize) {
188
+ if (tableReactData.isDragResize) {
189
189
  return
190
190
  }
191
191
  if (showTooltip || showAllTip) {
@@ -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
 
@@ -425,11 +403,7 @@ export const Cell = {
425
403
  return Cell.renderTreeIcon(params, Cell.renderDefaultCell(params) as VNode[])
426
404
  },
427
405
  renderDefaultFooter (params: VxeTableDefines.CellRenderFooterParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
428
- return [
429
- h('span', {
430
- class: 'vxe-cell--item'
431
- }, getFooterContent(params))
432
- ]
406
+ return getFooterContent(params)
433
407
  },
434
408
 
435
409
  /**
@@ -911,7 +885,7 @@ export const Cell = {
911
885
  const { $table, column } = params
912
886
  const { computeSortOpts } = $table.getComputeMaps()
913
887
  const sortOpts = computeSortOpts.value
914
- const { showIcon, iconLayout, iconAsc, iconDesc, iconVisibleMethod } = sortOpts
888
+ const { showIcon, allowBtn, iconLayout, iconAsc, iconDesc, iconVisibleMethod } = sortOpts
915
889
  const { order } = column
916
890
  if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
917
891
  return [
@@ -923,20 +897,24 @@ export const Cell = {
923
897
  'sort--active': order === 'asc'
924
898
  }],
925
899
  title: getI18n('vxe.table.sortAsc'),
926
- onClick (evnt: Event) {
927
- evnt.stopPropagation()
928
- $table.triggerSortEvent(evnt, column, 'asc')
929
- }
900
+ onClick: allowBtn
901
+ ? (evnt: Event) => {
902
+ evnt.stopPropagation()
903
+ $table.triggerSortEvent(evnt, column, 'asc')
904
+ }
905
+ : undefined
930
906
  }),
931
907
  h('i', {
932
908
  class: ['vxe-sort--desc-btn', iconDesc || getIcon().TABLE_SORT_DESC, {
933
909
  'sort--active': order === 'desc'
934
910
  }],
935
911
  title: getI18n('vxe.table.sortDesc'),
936
- onClick (evnt: Event) {
937
- evnt.stopPropagation()
938
- $table.triggerSortEvent(evnt, column, 'desc')
939
- }
912
+ onClick: allowBtn
913
+ ? (evnt: Event) => {
914
+ evnt.stopPropagation()
915
+ $table.triggerSortEvent(evnt, column, 'desc')
916
+ }
917
+ : undefined
940
918
  })
941
919
  ])
942
920
  ]