vxe-table 4.10.6-beta.8 → 4.10.6

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 +128 -81
  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 +48 -10
  34. package/es/table/src/header.js +70 -168
  35. package/es/table/src/props.js +14 -4
  36. package/es/table/src/table.js +884 -426
  37. package/es/table/src/util.js +77 -62
  38. package/es/table/style.css +253 -189
  39. package/es/table/style.min.css +1 -1
  40. package/es/ui/index.js +26 -11
  41. package/es/ui/src/log.js +1 -1
  42. package/es/vxe-table/style.css +253 -189
  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 +1533 -917
  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 +129 -80
  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 +48 -8
  116. package/lib/table/src/footer.min.js +1 -1
  117. package/lib/table/src/header.js +54 -181
  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 +935 -417
  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 +253 -189
  126. package/lib/table/style/style.min.css +1 -1
  127. package/lib/ui/index.js +26 -11
  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 +253 -189
  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 +148 -91
  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 +51 -11
  163. package/packages/table/src/header.ts +70 -168
  164. package/packages/table/src/props.ts +14 -5
  165. package/packages/table/src/table.ts +890 -428
  166. package/packages/table/src/util.ts +81 -62
  167. package/packages/ui/index.ts +25 -10
  168. package/styles/components/table.scss +319 -271
  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.1736840923205.ttf → iconfont.1738985856004.ttf} +0 -0
  174. /package/es/{iconfont.1736840923205.woff → iconfont.1738985856004.woff} +0 -0
  175. /package/es/{iconfont.1736840923205.woff2 → iconfont.1738985856004.woff2} +0 -0
  176. /package/lib/{iconfont.1736840923205.ttf → iconfont.1738985856004.ttf} +0 -0
  177. /package/lib/{iconfont.1736840923205.woff → iconfont.1738985856004.woff} +0 -0
  178. /package/lib/{iconfont.1736840923205.woff2 → iconfont.1738985856004.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,30 @@ 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
120
+ const currCellHeight = customCellHeight || defaultRowHeight
115
121
  const { disabledMethod: dragDisabledMethod, isCrossDrag, isPeerDrag } = rowDragOpts
116
122
  const columnOpts = computeColumnOpts.value
117
123
  const mouseOpts = computeMouseOpts.value
118
124
  const areaOpts = computeAreaOpts.value
119
125
  const { selectCellToRow } = areaOpts
120
- const { type, cellRender, editRender, align, showOverflow, className, treeNode, slots } = column
121
- const { verticalAlign } = cellOpts
126
+ const { type, cellRender, editRender, align, showOverflow, className, treeNode, rowResize, padding, verticalAlign, slots } = column
127
+ const { verticalAlign: allVerticalAlign } = cellOpts
122
128
  const { actived } = editStore
123
- const { height: customRHeight } = rowOpts
129
+ const rowRest = fullAllDataRowIdData[rowid]
124
130
  const colid = column.id
125
131
  const renderOpts = editRender || cellRender
126
132
  const compConf = renderOpts ? renderer.get(renderOpts.name) : null
@@ -130,21 +136,27 @@ export default defineComponent({
130
136
  const columnIndex = $xeTable.getColumnIndex(column)
131
137
  const _columnIndex = $xeTable.getVTColumnIndex(column)
132
138
  const isEdit = isEnableConf(editRender)
139
+ const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0
133
140
  let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX
134
- const cellOverflow = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow
141
+ const isCellPadding = XEUtils.eqNull(padding) ? (allPadding === null ? cellOpts.padding : allPadding) : padding
142
+ const cellOverflow = XEUtils.eqNull(showOverflow) ? isAllOverflow : showOverflow
135
143
  const showEllipsis = cellOverflow === 'ellipsis'
136
144
  const showTitle = cellOverflow === 'title'
137
145
  const showTooltip = cellOverflow === true || cellOverflow === 'tooltip'
138
- // 如果表格加上 showOverflow 则不再支持列单独设置
139
- const hasEllipsis = allColumnOverflow || showTitle || showTooltip || showEllipsis
146
+ const hasEllipsis = isAllOverflow || showTitle || showTooltip || showEllipsis
147
+ const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
148
+ const isCsHeight = !!customCellHeight
149
+ const isRsHeight = resizeHeight > 0
140
150
  let isDirty
141
151
  const tdOns: any = {}
142
- const rest = fullAllDataRowIdData[rowid]
143
152
  const cellAlign = align || (compConf ? compConf.tableCellAlign : '') || allAlign
153
+ const cellVerticalAlign = XEUtils.eqNull(verticalAlign) ? allVerticalAlign : verticalAlign
144
154
  const errorValidItem = validErrorMaps[`${rowid}:${colid}`]
145
155
  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 = {
156
+ const tdAttrs: any = { colid }
157
+ const cellParams: VxeTableDefines.CellRenderBodyParams & {
158
+ $table: VxeTableConstructor<any> & VxeTablePrivateMethods
159
+ } = {
148
160
  $table: $xeTable,
149
161
  $grid: $xeTable.xegrid,
150
162
  isEdit: false,
@@ -172,7 +184,7 @@ export default defineComponent({
172
184
  isRowDragCell = rowDragOpts.trigger === 'row' || (column.dragSort && rowDragOpts.trigger === 'cell')
173
185
  }
174
186
  if (isRowDragCell) {
175
- isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(params))
187
+ isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(cellParams))
176
188
  }
177
189
  // hover 进入事件
178
190
  if (showTitle || showTooltip || showAllTip || tooltipConfig) {
@@ -184,9 +196,9 @@ export default defineComponent({
184
196
  updateCellTitle(evnt.currentTarget, column)
185
197
  } else if (showTooltip || showAllTip) {
186
198
  // 如果配置了显示 tooltip
187
- $xeTable.triggerBodyTooltipEvent(evnt, params)
199
+ $xeTable.triggerBodyTooltipEvent(evnt, cellParams)
188
200
  }
189
- $xeTable.dispatchEvent('cell-mouseenter', Object.assign({ cell: evnt.currentTarget }, params), evnt)
201
+ $xeTable.dispatchEvent('cell-mouseenter', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt)
190
202
  }
191
203
  }
192
204
  // hover 退出事件
@@ -198,13 +210,13 @@ export default defineComponent({
198
210
  if (showTooltip || showAllTip) {
199
211
  $xeTable.handleTargetLeaveEvent(evnt)
200
212
  }
201
- $xeTable.dispatchEvent('cell-mouseleave', Object.assign({ cell: evnt.currentTarget }, params), evnt)
213
+ $xeTable.dispatchEvent('cell-mouseleave', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt)
202
214
  }
203
215
  }
204
216
  // 按下事件处理
205
217
  if (isRowDragCell || checkboxOpts.range || mouseConfig) {
206
218
  tdOns.onMousedown = (evnt: MouseEvent) => {
207
- $xeTable.triggerCellMousedownEvent(evnt, params)
219
+ $xeTable.triggerCellMousedownEvent(evnt, cellParams)
208
220
  }
209
221
  }
210
222
  // 拖拽列事件
@@ -213,11 +225,11 @@ export default defineComponent({
213
225
  }
214
226
  // 点击事件处理
215
227
  tdOns.onClick = (evnt: MouseEvent) => {
216
- $xeTable.triggerCellClickEvent(evnt, params)
228
+ $xeTable.triggerCellClickEvent(evnt, cellParams)
217
229
  }
218
230
  // 双击事件处理
219
231
  tdOns.onDblclick = (evnt: MouseEvent) => {
220
- $xeTable.triggerCellDblclickEvent(evnt, params)
232
+ $xeTable.triggerCellDblclickEvent(evnt, cellParams)
221
233
  }
222
234
  // 合并行或列
223
235
  if (mergeList.length) {
@@ -228,28 +240,28 @@ export default defineComponent({
228
240
  return null
229
241
  }
230
242
  if (rowspan > 1) {
231
- attrs.rowspan = rowspan
243
+ tdAttrs.rowspan = rowspan
232
244
  }
233
245
  if (colspan > 1) {
234
- attrs.colspan = colspan
246
+ tdAttrs.colspan = colspan
235
247
  }
236
248
  }
237
249
  } else if (spanMethod) {
238
250
  // 自定义合并行或列的方法
239
- const { rowspan = 1, colspan = 1 } = spanMethod(params) || {}
251
+ const { rowspan = 1, colspan = 1 } = spanMethod(cellParams) || {}
240
252
  if (!rowspan || !colspan) {
241
253
  return null
242
254
  }
243
255
  if (rowspan > 1) {
244
- attrs.rowspan = rowspan
256
+ tdAttrs.rowspan = rowspan
245
257
  }
246
258
  if (colspan > 1) {
247
- attrs.colspan = colspan
259
+ tdAttrs.colspan = colspan
248
260
  }
249
261
  }
250
262
  // 如果被合并不可隐藏
251
263
  if (fixedHiddenColumn && mergeList) {
252
- if (attrs.colspan > 1 || attrs.rowspan > 1) {
264
+ if (tdAttrs.colspan > 1 || tdAttrs.rowspan > 1) {
253
265
  fixedHiddenColumn = false
254
266
  }
255
267
  }
@@ -257,42 +269,80 @@ export default defineComponent({
257
269
  if (!fixedHiddenColumn && editConfig && (editRender || cellRender) && (editOpts.showStatus || editOpts.showUpdateStatus)) {
258
270
  isDirty = $xeTable.isUpdateByRow(row, column.field)
259
271
  }
272
+
273
+ const isVNAutoHeight = scrollYLoad && !hasEllipsis
274
+ let cellHeight = currCellHeight
275
+ const vnHeight = calcCellHeightFlag ? rowRest.height : 0
276
+ if (resizeHeight) {
277
+ cellHeight = resizeHeight
278
+ } else {
279
+ if (scrollYLoad) {
280
+ if (!hasEllipsis) {
281
+ cellHeight = vnHeight || currCellHeight
282
+ }
283
+ }
284
+ }
285
+
286
+ const isLastColumn = $columnIndex === columns.length - 1
287
+ const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
288
+
289
+ let isVNPreEmptyStatus = false
290
+ if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
291
+ isVNPreEmptyStatus = true
292
+ } else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
293
+ isVNPreEmptyStatus = true
294
+ }
295
+
296
+ const tcStyle: Record<string, string> = {}
297
+ if (scrollYLoad || hasEllipsis || isCsHeight || isRsHeight) {
298
+ tcStyle.height = `${cellHeight}px`
299
+ } else {
300
+ tcStyle.minHeight = `${cellHeight}px`
301
+ }
302
+
260
303
  const tdVNs: any[] = []
261
- if (fixedHiddenColumn && (allColumnOverflow ? isAllOverflow : allColumnOverflow)) {
304
+ if (fixedHiddenColumn && isAllOverflow) {
262
305
  tdVNs.push(
263
306
  h('div', {
307
+ key: 'tc',
264
308
  class: ['vxe-cell', {
265
309
  'c--title': showTitle,
266
310
  'c--tooltip': showTooltip,
267
311
  'c--ellipsis': showEllipsis
268
312
  }],
269
- style: {
270
- maxHeight: hasEllipsis && (customRHeight || defaultRowHeight) ? `${customRHeight || defaultRowHeight}px` : ''
271
- }
313
+ style: tcStyle
272
314
  })
273
315
  )
274
316
  } else {
275
317
  // 渲染单元格
276
318
  tdVNs.push(
277
- ...renderLine(params),
319
+ ...renderLine(cellParams, cellHeight),
278
320
  h('div', {
321
+ key: 'tc',
279
322
  class: ['vxe-cell', {
280
323
  'c--title': showTitle,
281
324
  'c--tooltip': showTooltip,
282
325
  'c--ellipsis': showEllipsis
283
326
  }],
284
- style: {
285
- maxHeight: hasEllipsis && (customRHeight || defaultRowHeight) ? `${customRHeight || defaultRowHeight}px` : ''
286
- },
327
+ style: tcStyle,
287
328
  title: showTitle ? $xeTable.getCellLabel(row, column) : null
288
- }, column.renderCell(params))
329
+ }, isVNPreEmptyStatus
330
+ ? []
331
+ : [
332
+ h('div', {
333
+ colid,
334
+ rowid,
335
+ class: 'vxe-cell--wrapper'
336
+ }, column.renderCell(cellParams))
337
+ ])
289
338
  )
290
339
  if (showValidTip && errorValidItem) {
291
340
  const errRule = errorValidItem.rule
292
341
  const validSlot = slots ? slots.valid : null
293
- const validParams = { ...params, ...errorValidItem, rule: errorValidItem }
342
+ const validParams = { ...cellParams, ...errorValidItem, rule: errorValidItem }
294
343
  tdVNs.push(
295
344
  h('div', {
345
+ key: 'tcv',
296
346
  class: ['vxe-cell--valid-error-tip', getPropClass(validOpts.className, validParams)],
297
347
  style: errRule && errRule.maxWidth
298
348
  ? {
@@ -315,54 +365,60 @@ export default defineComponent({
315
365
  )
316
366
  }
317
367
  }
318
- let cellHeight = ''
319
- const vnHeight = isCalcCellHeight ? rest.height : 0
320
- if (hasEllipsis) {
321
- if (customRHeight) {
322
- cellHeight = `${customRHeight}px`
323
- } else if (!isAllOverflow) {
324
- cellHeight = `${vnHeight || defaultRowHeight || 18}px`
325
- }
326
- } else {
327
- cellHeight = `${vnHeight || defaultRowHeight || 18}px`
328
- }
329
368
 
369
+ let showAreaRowStatus = false
330
370
  if (mouseConfig && mouseOpts.area && selectCellToRow) {
331
371
  if (
332
- (!$columnIndex && selectCellToRow === true) ||
372
+ (!_columnIndex && selectCellToRow === true) ||
333
373
  (selectCellToRow === column.field)
334
374
  ) {
335
- tdVNs.push(
336
- h('div', {
337
- class: 'vxe-cell--area-status'
338
- })
339
- )
375
+ showAreaRowStatus = true
340
376
  }
341
377
  }
342
- const isLastColumn = $columnIndex === columns.length - 1
343
- const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
344
378
 
345
- let isPreLoadStatus = false
346
- if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex || _rowIndex > scrollYStore.visibleEndIndex)) {
347
- isPreLoadStatus = true
348
- } else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
349
- isPreLoadStatus = true
379
+ if (!fixedHiddenColumn && showResizable && isAllColumnDrag) {
380
+ tdVNs.push(
381
+ h('div', {
382
+ key: 'tcc',
383
+ class: ['vxe-cell--col-resizable', {
384
+ 'is--line': !border || border === 'none'
385
+ }],
386
+ onMousedown: (evnt: MouseEvent) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
387
+ onDblclick: (evnt: MouseEvent) => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
388
+ })
389
+ )
390
+ }
391
+
392
+ if ((rowResize || isAllRowDrag) && rowOpts.resizable) {
393
+ tdVNs.push(
394
+ h('div', {
395
+ key: 'tcr',
396
+ class: 'vxe-cell--row-resizable',
397
+ onMousedown: (evnt: MouseEvent) => $xeTable.handleRowResizeMousedownEvent(evnt, cellParams),
398
+ onDblclick: (evnt: MouseEvent) => $xeTable.handleRowResizeDblclickEvent(evnt, cellParams)
399
+ })
400
+ )
350
401
  }
351
402
 
352
403
  return h('td', {
353
404
  class: [
354
405
  'vxe-body--column',
355
406
  colid,
407
+ cellVerticalAlign ? `col--vertical-${cellVerticalAlign}` : '',
408
+ cellAlign ? `col--${cellAlign}` : '',
409
+ type ? `col--${type}` : '',
356
410
  {
357
- [`col--${cellAlign}`]: cellAlign,
358
- [`col--vertical-${verticalAlign}`]: verticalAlign,
359
- [`col--${type}`]: type,
360
411
  'col--last': isLastColumn,
361
412
  'col--tree-node': treeNode,
362
413
  'col--edit': isEdit,
363
414
  'col--ellipsis': hasEllipsis,
415
+ 'col--cs-height': isCsHeight,
416
+ 'col--rs-height': isRsHeight,
417
+ 'col--to-row': showAreaRowStatus,
418
+ 'col--auto-height': isVNAutoHeight,
364
419
  'fixed--width': !isAutoCellWidth,
365
420
  'fixed--hidden': fixedHiddenColumn,
421
+ 'is--padding': isCellPadding,
366
422
  'is--drag-cell': isRowDragCell && (isCrossDrag || isPeerDrag || !rowLevel),
367
423
  'is--drag-disabled': isDisabledDrag,
368
424
  'col--dirty': isDirty,
@@ -370,22 +426,20 @@ export default defineComponent({
370
426
  'col--valid-error': !!errorValidItem,
371
427
  'col--current': currentColumn === column
372
428
  },
373
- getPropClass(compCellClassName, params),
374
- getPropClass(className, params),
375
- getPropClass(allCellClassName, params)
429
+ getPropClass(compCellClassName, cellParams),
430
+ getPropClass(className, cellParams),
431
+ getPropClass(allCellClassName, cellParams)
376
432
  ],
377
433
  key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || rowOpts.useKey || columnOpts.drag ? colid : $columnIndex,
378
- ...attrs,
379
- style: Object.assign({
380
- height: cellHeight
381
- }, XEUtils.isFunction(compCellStyle) ? compCellStyle(params) : compCellStyle, XEUtils.isFunction(cellStyle) ? cellStyle(params) : cellStyle),
434
+ ...tdAttrs,
435
+ style: Object.assign({}, XEUtils.isFunction(compCellStyle) ? compCellStyle(cellParams) : compCellStyle, XEUtils.isFunction(cellStyle) ? cellStyle(cellParams) : cellStyle),
382
436
  ...tdOns
383
- }, isPreLoadStatus || (isOptimizeMode && fixedHiddenColumn) ? [] : tdVNs)
437
+ }, isOptimizeMode && fixedHiddenColumn ? [] : tdVNs)
384
438
  }
385
439
 
386
- const renderRows = (fixedType: VxeColumnPropTypes.Fixed, isOptimizeMode: boolean, tableData: any[], tableColumn: VxeTableDefines.ColumnInfo[]) => {
387
- const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, showOverflow: allColumnOverflow, editConfig, treeConfig } = tableProps
388
- const { hasFixedColumn, treeExpandedMaps, scrollXLoad, scrollYLoad, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove } = tableReactData
440
+ const renderRows = (fixedType: 'left' | 'right' | '', isOptimizeMode: boolean, tableData: any[], tableColumn: VxeTableDefines.ColumnInfo[]) => {
441
+ const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps
442
+ const { hasFixedColumn, treeExpandedMaps, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove } = tableReactData
389
443
  const { fullAllDataRowIdData } = tableInternalData
390
444
  const checkboxOpts = computeCheckboxOpts.value
391
445
  const radioOpts = computeRadioOpts.value
@@ -470,7 +524,7 @@ export default defineComponent({
470
524
  return renderTdColumn(seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData)
471
525
  })
472
526
  rows.push(
473
- columnOpts.drag && columnDragOpts.animation
527
+ !isColLoading && (columnOpts.drag && columnDragOpts.animation)
474
528
  ? h(TransitionGroup, {
475
529
  name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
476
530
  tag: 'tr',
@@ -502,7 +556,7 @@ export default defineComponent({
502
556
  cellStyle.paddingLeft = `${(rowLevel * treeOpts.indent) + 30}px`
503
557
  }
504
558
  const { showOverflow } = expandColumn
505
- const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow
559
+ const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? isAllOverflow : showOverflow
506
560
  const expandParams = { $table: $xeTable, seq, column: expandColumn, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
507
561
  rows.push(
508
562
  h('tr', {
@@ -576,8 +630,8 @@ export default defineComponent({
576
630
  const { slots } = tableContext
577
631
 
578
632
  const { fixedColumn, fixedType, tableColumn } = props
579
- const { showOverflow: allColumnOverflow, spanMethod, footerSpanMethod, mouseConfig } = tableProps
580
- const { isGroup, tableData, scrollXLoad, scrollYLoad, isAllOverflow, isDragRowMove, expandColumn, dragRow, dragCol } = tableReactData
633
+ const { spanMethod, footerSpanMethod, mouseConfig } = tableProps
634
+ const { isGroup, tableData, isRowLoading, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, isDragRowMove, expandColumn, dragRow, dragCol } = tableReactData
581
635
  const { visibleColumn, fullAllDataRowIdData, fullColumnIdData } = tableInternalData
582
636
  const rowOpts = computeRowOpts.value
583
637
  const emptyOpts = computeEmptyOpts.value
@@ -590,7 +644,7 @@ export default defineComponent({
590
644
  let renderColumnList = tableColumn as VxeTableDefines.ColumnInfo[]
591
645
  let isOptimizeMode = false
592
646
  // 如果是使用优化模式
593
- if (scrollXLoad || scrollYLoad || (allColumnOverflow && isAllOverflow)) {
647
+ if (scrollXLoad || scrollYLoad || isAllOverflow) {
594
648
  if (expandColumn || spanMethod || footerSpanMethod) {
595
649
  // 如果不支持优化模式
596
650
  } else {
@@ -704,21 +758,21 @@ export default defineComponent({
704
758
  cellpadding: 0,
705
759
  border: 0
706
760
  }, [
707
- /**
708
- * 列宽
709
- */
761
+ /**
762
+ * 列宽
763
+ */
710
764
  h('colgroup', {
711
765
  ref: refBodyColgroup
712
- }, (renderColumnList as any[]).map((column, $columnIndex) => {
766
+ }, renderColumnList.map((column, $columnIndex) => {
713
767
  return h('col', {
714
768
  name: column.id,
715
769
  key: $columnIndex
716
770
  })
717
771
  })),
718
772
  /**
719
- * 内容
720
- */
721
- rowOpts.drag && rowDragOpts.animation
773
+ * 内容
774
+ */
775
+ !(isRowLoading || isColLoading) && (rowOpts.drag && rowDragOpts.animation)
722
776
  ? h(TransitionGroup, {
723
777
  ref: refBodyTBody,
724
778
  name: `vxe-body--row-list${isDragRowMove ? '' : '-disabled'}`,
@@ -762,6 +816,9 @@ export default defineComponent({
762
816
  }),
763
817
  h('span', {
764
818
  class: 'vxe-table--cell-active-area'
819
+ }),
820
+ h('span', {
821
+ class: 'vxe-table--cell-row-status-area'
765
822
  })
766
823
  ])
767
824
  : 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
  ]