vxe-table 4.23.19 → 4.23.20

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 (124) hide show
  1. package/dist/all.esm.js +283 -251
  2. package/dist/all.esm.min.js +3 -3
  3. package/dist/style.css +4 -1
  4. package/dist/style.mini.css +1 -1
  5. package/es/components.d.ts +1 -3
  6. package/es/components.js +1 -2
  7. package/es/esm.index.d.ts +7 -0
  8. package/es/esm.index.js +8 -0
  9. package/es/style.css +4 -1
  10. package/es/style.mini.css +1 -1
  11. package/es/table/style.css +4 -1
  12. package/es/table/style.mini.css +1 -1
  13. package/es/ui/abandon.d.ts +82 -0
  14. package/es/ui/abandon.js +90 -0
  15. package/es/ui/index.d.ts +1 -83
  16. package/es/ui/index.js +2 -89
  17. package/es/ui/src/log.js +1 -1
  18. package/es/vxe-table/style.css +4 -1
  19. package/es/vxe-table/style.mini.css +1 -1
  20. package/lib/components.d.ts +1 -3
  21. package/lib/components.js +1 -2
  22. package/lib/esm.index.d.ts +7 -0
  23. package/lib/esm.index.js +39 -0
  24. package/lib/index.umd.js +248 -247
  25. package/lib/index.umd.min.js +3 -3
  26. package/lib/style.css +4 -1
  27. package/lib/style.mini.css +1 -1
  28. package/lib/table/style/style.css +4 -1
  29. package/lib/table/style/style.mini.css +1 -1
  30. package/lib/ui/abandon.d.ts +82 -0
  31. package/lib/ui/abandon.js +110 -0
  32. package/lib/ui/index.d.ts +1 -83
  33. package/lib/ui/index.js +3 -89
  34. package/lib/ui/src/log.js +1 -1
  35. package/lib/vxe-table/style/style.css +4 -1
  36. package/lib/vxe-table/style/style.mini.css +1 -1
  37. package/package.json +1 -1
  38. package/packages/colgroup/index.ts +22 -22
  39. package/packages/column/index.ts +22 -22
  40. package/packages/components.ts +42 -45
  41. package/packages/esm.index.ts +10 -0
  42. package/packages/grid/index.ts +18 -18
  43. package/packages/grid/src/emits.ts +5 -5
  44. package/packages/grid/src/grid.ts +2220 -2220
  45. package/packages/grid/src/props.ts +22 -22
  46. package/packages/index.ts +13 -13
  47. package/packages/locale/lang/ar-EG.ts +914 -914
  48. package/packages/locale/lang/de-DE.ts +914 -914
  49. package/packages/locale/lang/en-US.ts +914 -914
  50. package/packages/locale/lang/es-ES.ts +914 -914
  51. package/packages/locale/lang/fr-FR.ts +914 -914
  52. package/packages/locale/lang/hu-HU.ts +914 -914
  53. package/packages/locale/lang/hy-AM.ts +914 -914
  54. package/packages/locale/lang/id-ID.ts +914 -914
  55. package/packages/locale/lang/it-IT.ts +914 -914
  56. package/packages/locale/lang/ja-JP.ts +914 -914
  57. package/packages/locale/lang/ko-KR.ts +914 -914
  58. package/packages/locale/lang/ms-MY.ts +914 -914
  59. package/packages/locale/lang/nb-NO.ts +914 -914
  60. package/packages/locale/lang/pt-BR.ts +914 -914
  61. package/packages/locale/lang/ru-RU.ts +914 -914
  62. package/packages/locale/lang/th-TH.ts +914 -914
  63. package/packages/locale/lang/ug-CN.ts +914 -914
  64. package/packages/locale/lang/uk-UA.ts +914 -914
  65. package/packages/locale/lang/uz-UZ.ts +914 -914
  66. package/packages/locale/lang/vi-VN.ts +914 -914
  67. package/packages/locale/lang/zh-CHT.ts +914 -914
  68. package/packages/locale/lang/zh-CN.ts +914 -914
  69. package/packages/locale/lang/zh-HK.ts +914 -914
  70. package/packages/locale/lang/zh-MO.ts +914 -914
  71. package/packages/locale/lang/zh-TC.ts +914 -914
  72. package/packages/locale/lang/zh-TW.ts +914 -914
  73. package/packages/table/index.ts +26 -26
  74. package/packages/table/module/custom/hook.ts +510 -510
  75. package/packages/table/module/custom/panel.ts +2002 -2002
  76. package/packages/table/module/edit/hook.ts +1232 -1232
  77. package/packages/table/module/export/export-panel.ts +697 -697
  78. package/packages/table/module/export/hook.ts +2158 -2158
  79. package/packages/table/module/export/import-panel.ts +319 -319
  80. package/packages/table/module/export/util.ts +25 -25
  81. package/packages/table/module/filter/hook.ts +505 -505
  82. package/packages/table/module/filter/panel.ts +368 -368
  83. package/packages/table/module/keyboard/hook.ts +498 -498
  84. package/packages/table/module/menu/hook.ts +330 -330
  85. package/packages/table/module/menu/panel.ts +272 -272
  86. package/packages/table/module/validator/hook.ts +653 -653
  87. package/packages/table/render/index.ts +1819 -1819
  88. package/packages/table/src/body.ts +1078 -1078
  89. package/packages/table/src/cell.ts +1524 -1524
  90. package/packages/table/src/column.ts +192 -192
  91. package/packages/table/src/columnInfo.ts +232 -232
  92. package/packages/table/src/emits.ts +134 -134
  93. package/packages/table/src/footer.ts +425 -425
  94. package/packages/table/src/group.ts +67 -67
  95. package/packages/table/src/header.ts +661 -661
  96. package/packages/table/src/props.ts +336 -336
  97. package/packages/table/src/store.ts +14 -14
  98. package/packages/table/src/use/cell-view.ts +41 -41
  99. package/packages/table/src/use/index.ts +1 -1
  100. package/packages/table/src/util.ts +1206 -1206
  101. package/packages/toolbar/index.ts +18 -18
  102. package/packages/toolbar/src/toolbar.ts +768 -768
  103. package/packages/ui/abandon.ts +136 -0
  104. package/packages/ui/index.ts +404 -524
  105. package/packages/ui/src/anime.ts +51 -51
  106. package/packages/ui/src/comp.ts +3 -3
  107. package/packages/ui/src/dom.ts +466 -466
  108. package/packages/ui/src/log.ts +19 -19
  109. package/packages/ui/src/utils.ts +66 -66
  110. package/packages/ui/src/vn.ts +55 -55
  111. package/packages/v-x-e-table/index.d.ts +3 -3
  112. package/packages/v-x-e-table/index.ts +3 -3
  113. package/styles/components/table.scss +2 -1
  114. package/types/all.d.ts +76 -76
  115. package/types/index.d.ts +4 -4
  116. /package/dist/{iconfont.1794474448348.ttf → iconfont.1794633824975.ttf} +0 -0
  117. /package/dist/{iconfont.1794474448348.woff → iconfont.1794633824975.woff} +0 -0
  118. /package/dist/{iconfont.1794474448348.woff2 → iconfont.1794633824975.woff2} +0 -0
  119. /package/es/{iconfont.1794474448348.ttf → iconfont.1794633824975.ttf} +0 -0
  120. /package/es/{iconfont.1794474448348.woff → iconfont.1794633824975.woff} +0 -0
  121. /package/es/{iconfont.1794474448348.woff2 → iconfont.1794633824975.woff2} +0 -0
  122. /package/lib/{iconfont.1794474448348.ttf → iconfont.1794633824975.ttf} +0 -0
  123. /package/lib/{iconfont.1794474448348.woff → iconfont.1794633824975.woff} +0 -0
  124. /package/lib/{iconfont.1794474448348.woff2 → iconfont.1794633824975.woff2} +0 -0
@@ -1,1524 +1,1524 @@
1
- import { h, VNode } from 'vue'
2
- import XEUtils from 'xe-utils'
3
- import { VxeUI } from '@vxe-ui/core'
4
- import { getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
5
- import { updateCellTitle } from '../../ui/src/dom'
6
- import { createColumn, getRowid } from './util'
7
- import { getSlotVNs } from '../../ui/src/vn'
8
-
9
- import type { VxeTableConstructor, VxeTableDefines, VxeTablePrivateMethods, VxeComponentSlotType } from '../../../types'
10
-
11
- const { getConfig, getI18n, getIcon, renderer, renderEmptyElement } = VxeUI
12
-
13
- function renderTitlePrefixIcon(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
14
- const { $table, column } = params
15
- const titlePrefix = column.titlePrefix || column.titleHelp
16
- if (titlePrefix) {
17
- return h(
18
- 'span',
19
- {
20
- class: ['vxe-cell-title-prefix-icon', titlePrefix.iconStatus ? `theme--${titlePrefix.iconStatus}` : ''],
21
- onMouseenter(evnt: MouseEvent) {
22
- $table.triggerHeaderTitleEvent(evnt, titlePrefix, params)
23
- },
24
- onMouseleave(evnt: MouseEvent) {
25
- $table.handleTargetLeaveEvent(evnt)
26
- }
27
- },
28
- [
29
- h('i', {
30
- class: titlePrefix.icon || getIcon().TABLE_TITLE_PREFIX
31
- })
32
- ]
33
- )
34
- }
35
- return renderEmptyElement($table)
36
- }
37
-
38
- function renderTitleSuffixIcon(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
39
- const { $table, column } = params
40
- const titleSuffix = column.titleSuffix
41
- if (titleSuffix) {
42
- return h(
43
- 'span',
44
- {
45
- class: ['vxe-cell-title-suffix-icon', titleSuffix.iconStatus ? `theme--${titleSuffix.iconStatus}` : ''],
46
- onMouseenter(evnt: MouseEvent) {
47
- $table.triggerHeaderTitleEvent(evnt, titleSuffix, params)
48
- },
49
- onMouseleave(evnt: MouseEvent) {
50
- $table.handleTargetLeaveEvent(evnt)
51
- }
52
- },
53
- [
54
- h('i', {
55
- class: titleSuffix.icon || getIcon().TABLE_TITLE_SUFFIX
56
- })
57
- ]
58
- )
59
- }
60
- return renderEmptyElement($table)
61
- }
62
-
63
- function renderCellDragIcon(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
64
- const { $table, column } = params
65
- const { context } = $table
66
- const tableSlots = context.slots
67
- const tableProps = $table.props
68
- const { slots } = column
69
- const { dragConfig } = tableProps
70
- const { computeRowDragOpts } = $table.getComputeMaps()
71
- const rowDragOpts = computeRowDragOpts.value
72
- const { icon, trigger, disabledMethod } = rowDragOpts
73
- const rDisabledMethod = disabledMethod || (dragConfig ? dragConfig.rowDisabledMethod : null)
74
- const isDisabled = rDisabledMethod && rDisabledMethod(params)
75
- const rowDragIconSlot = (slots ? slots.rowDragIcon || slots['row-drag-icon'] : null) || tableSlots.rowDragIcon || tableSlots['row-drag-icon']
76
- const ons: Record<string, any> = {}
77
- if (trigger !== 'cell') {
78
- ons.onMousedown = (evnt: MouseEvent) => {
79
- if (!isDisabled) {
80
- $table.handleCellDragMousedownEvent(evnt, params)
81
- }
82
- }
83
- ons.onMouseup = $table.handleCellDragMouseupEvent
84
- }
85
- return h(
86
- 'span',
87
- {
88
- key: 'dg',
89
- class: [
90
- 'vxe-cell--drag-handle',
91
- {
92
- 'is--disabled': isDisabled
93
- }
94
- ],
95
- ...ons
96
- },
97
- rowDragIconSlot
98
- ? $table.callSlot(rowDragIconSlot, params)
99
- : [
100
- h('i', {
101
- class: icon || (dragConfig ? dragConfig.rowIcon : '') || getIcon().TABLE_DRAG_ROW
102
- })
103
- ]
104
- )
105
- }
106
-
107
- function renderCellBaseVNs(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, content: VxeComponentSlotType | VxeComponentSlotType[]) {
108
- const { $table, column, level } = params
109
- const { dragSort } = column
110
- const tableProps = $table.props
111
- const { treeConfig, dragConfig } = tableProps
112
- const { computeRowOpts, computeRowDragOpts, computeTreeOpts } = $table.getComputeMaps()
113
- const rowOpts = computeRowOpts.value
114
- const rowDragOpts = computeRowDragOpts.value
115
- const treeOpts = computeTreeOpts.value
116
- const { showIcon, isPeerDrag, isCrossDrag, visibleMethod } = rowDragOpts
117
- const rVisibleMethod = visibleMethod || (dragConfig ? dragConfig.rowVisibleMethod : null)
118
- const vns: VxeComponentSlotType[] = []
119
- if (dragSort && rowOpts.drag && (showIcon || (dragConfig ? dragConfig.showRowIcon : false)) && (!rVisibleMethod || rVisibleMethod(params))) {
120
- if (treeConfig) {
121
- if (treeOpts.transform && (isPeerDrag || isCrossDrag || !level)) {
122
- vns.push(renderCellDragIcon(params))
123
- }
124
- } else {
125
- vns.push(renderCellDragIcon(params))
126
- }
127
- }
128
- return vns.concat(XEUtils.isArray(content) ? content : [content])
129
- }
130
-
131
- function renderHeaderCellDragIcon(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
132
- const { $table, column } = params
133
- const { context } = $table
134
- const tableSlots = context.slots
135
- const { slots } = column
136
- const { computeColumnOpts, computeColumnDragOpts } = $table.getComputeMaps()
137
- const columnOpts = computeColumnOpts.value
138
- const columnDragOpts = computeColumnDragOpts.value
139
- const { showIcon, icon, trigger, isPeerDrag, isCrossDrag, visibleMethod, disabledMethod } = columnDragOpts
140
- if (columnOpts.drag && showIcon && (!visibleMethod || visibleMethod(params))) {
141
- if (!column.fixed && (isPeerDrag || isCrossDrag || !column.parentId)) {
142
- const isDisabled = disabledMethod && disabledMethod(params)
143
- const columnDragIconSlot = (slots ? slots.columnDragIcon || slots['column-drag-icon'] : null) || tableSlots.columnDragIcon || tableSlots['column-drag-icon']
144
- const ons: Record<string, any> = {}
145
- if (trigger !== 'cell') {
146
- ons.onMousedown = (evnt: MouseEvent) => {
147
- if (!isDisabled) {
148
- $table.handleHeaderCellDragMousedownEvent(evnt, params)
149
- }
150
- }
151
- ons.onMouseup = $table.handleHeaderCellDragMouseupEvent
152
- }
153
- return h(
154
- 'span',
155
- {
156
- key: 'dg',
157
- class: [
158
- 'vxe-cell--drag-handle',
159
- {
160
- 'is--disabled': isDisabled
161
- }
162
- ],
163
- ...ons
164
- },
165
- columnDragIconSlot
166
- ? $table.callSlot(columnDragIconSlot, params)
167
- : [
168
- h('i', {
169
- class: icon || getIcon().TABLE_DRAG_COLUMN
170
- })
171
- ]
172
- )
173
- }
174
- }
175
- return renderEmptyElement($table)
176
- }
177
-
178
- function renderHeaderCellBaseVNs(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, content: VNode | VNode[]) {
179
- const vns = [renderTitlePrefixIcon(params), renderHeaderCellDragIcon(params), ...(XEUtils.isArray(content) ? content : [content]), renderTitleSuffixIcon(params)]
180
- return vns
181
- }
182
-
183
- function getRenderDefaultColumnTitle(column: VxeTableDefines.ColumnInfo, content: VxeComponentSlotType | VxeComponentSlotType[]) {
184
- if (column.type === 'html' && XEUtils.isString(content)) {
185
- return h('span', {
186
- key: 'ch',
187
- innerHTML: content
188
- })
189
- }
190
- return h(
191
- 'span',
192
- {
193
- key: 'ct'
194
- },
195
- getSlotVNs(content)
196
- )
197
- }
198
-
199
- function renderTitleContent(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, content: VxeComponentSlotType | VxeComponentSlotType[]) {
200
- const { $table, column } = params
201
- const tableProps = $table.props
202
- const tableReactData = $table.reactData
203
- const { computeHeaderTooltipOpts } = $table.getComputeMaps()
204
- const { showHeaderOverflow: allColumnHeaderOverflow } = tableProps
205
- const { isRowGroupStatus } = tableReactData
206
- const { showHeaderOverflow, slots } = column
207
- const titleSlot = slots ? slots.title : null
208
- const headerTooltipOpts = computeHeaderTooltipOpts.value
209
- const showAllTip = headerTooltipOpts.showAll
210
- const headOverflow = XEUtils.eqNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow
211
- const showTitle = (headOverflow === true ? headerTooltipOpts.mode : headOverflow) === 'title'
212
- const showTooltip = (headOverflow === true ? headerTooltipOpts.mode : headOverflow) === 'tooltip'
213
- const ons: Record<string, any> = {}
214
- if (showTitle || showTooltip || showAllTip) {
215
- ons.onMouseenter = (evnt: MouseEvent) => {
216
- if (tableReactData.isDragResize) {
217
- return
218
- }
219
- if (showTitle) {
220
- updateCellTitle(evnt.currentTarget, column)
221
- } else if (showTooltip || showAllTip) {
222
- $table.triggerHeaderTooltipEvent(evnt, params)
223
- }
224
- }
225
- }
226
- if (showTooltip || showAllTip) {
227
- ons.onMouseleave = (evnt: MouseEvent) => {
228
- if (tableReactData.isDragResize) {
229
- return
230
- }
231
- if (showTooltip || showAllTip) {
232
- $table.handleTargetLeaveEvent(evnt)
233
- }
234
- }
235
- }
236
- const titleVN = getRenderDefaultColumnTitle(column, content)
237
- return [
238
- h(
239
- 'span',
240
- {
241
- class: 'vxe-cell--title',
242
- ...ons
243
- },
244
- isRowGroupStatus && column.aggFunc && $table.getPivotTableAggregateRenderColTitles ? $table.getPivotTableAggregateRenderColTitles(column, titleVN) : titleSlot ? $table.callSlot(titleSlot, params) : [titleVN]
245
- )
246
- ]
247
- }
248
-
249
- function getFooterContent(params: VxeTableDefines.CellRenderFooterParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
250
- const { $table, column, row } = params
251
- const tableProps = $table.props
252
- const { editConfig } = tableProps
253
- const { slots, editRender, cellRender } = column
254
- const footerSlot = slots ? slots.footer : null
255
- if (footerSlot) {
256
- return $table.callSlot(footerSlot, params)
257
- }
258
- const isEnableEdit = editConfig && isEnableConf(editConfig)
259
- const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
260
- const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null
261
- const renderOpts = editRenderOpts || cellRenderOpts
262
- const itemValue = $table.getFooterCellLabel(row, column)
263
- if (renderOpts) {
264
- const { computeRendererOpts } = $table.getComputeMaps()
265
- const rendererOpts = computeRendererOpts.value
266
- const compConf = renderOpts.name ? rendererOpts[renderOpts.name] || renderer.get(renderOpts.name) : null
267
- if (compConf) {
268
- const rtFooter = compConf.renderTableFooter || compConf.renderFooter
269
- if (rtFooter) {
270
- const footParams = Object.assign(params, {
271
- cellValue: itemValue,
272
- itemValue
273
- })
274
- return getSlotVNs(rtFooter(renderOpts, footParams))
275
- }
276
- }
277
- }
278
- return [
279
- h(
280
- 'span',
281
- {
282
- class: 'vxe-cell--label'
283
- },
284
- formatText(itemValue, 1)
285
- )
286
- ]
287
- }
288
-
289
- function getDefaultCellLabel(params: VxeTableDefines.CellRenderBodyParams) {
290
- const { $table, row, column } = params
291
- return formatText($table.getCellLabel(row, column), 1)
292
- }
293
-
294
- function renderCellHandle(
295
- params: VxeTableDefines.CellRenderBodyParams & {
296
- $table: VxeTableConstructor & VxeTablePrivateMethods
297
- }
298
- ) {
299
- const { column, row, $table } = params
300
- const tableProps = $table.props
301
- const tableReactData = $table.reactData
302
- const { isRowGroupStatus } = tableReactData
303
- const { editConfig } = tableProps
304
- const { type, treeNode, rowGroupNode, editRender } = column
305
- const { computeEditOpts, computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps()
306
- const aggregateOpts = computeAggregateOpts.value
307
- const { mode } = aggregateOpts
308
- const checkboxOpts = computeCheckboxOpts.value
309
- const editOpts = computeEditOpts.value
310
- const isDeepCell = treeNode || (isRowGroupStatus && (mode === 'column' ? column.field === row.groupField : rowGroupNode))
311
- switch (type) {
312
- case 'seq':
313
- return isDeepCell ? Cell.renderDeepIndexCell(params) : Cell.renderSeqCell(params)
314
- case 'radio':
315
- return isDeepCell ? Cell.renderDeepRadioCell(params) : Cell.renderRadioCell(params)
316
- case 'checkbox':
317
- return checkboxOpts.checkField ? (isDeepCell ? Cell.renderDeepSelectionCellByProp(params) : Cell.renderCheckboxCellByProp(params)) : isDeepCell ? Cell.renderDeepSelectionCell(params) : Cell.renderCheckboxCell(params)
318
- case 'expand':
319
- return Cell.renderExpandCell(params)
320
- case 'html':
321
- return isDeepCell ? Cell.renderDeepHTMLCell(params) : Cell.renderHTMLCell(params)
322
- }
323
- const isEnableEdit = editConfig && isEnableConf(editConfig)
324
- const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
325
- if (editRenderOpts) {
326
- return editOpts.mode === 'cell' ? (isDeepCell ? Cell.renderDeepCellEdit(params) : Cell.renderCellEdit(params)) : isDeepCell ? Cell.renderDeepRowEdit(params) : Cell.renderRowEdit(params)
327
- }
328
- return isDeepCell ? Cell.renderDeepCell(params) : Cell.renderDefaultCell(params)
329
- }
330
-
331
- function renderHeaderHandle(
332
- params: VxeTableDefines.CellRenderHeaderParams & {
333
- $table: VxeTableConstructor & VxeTablePrivateMethods
334
- }
335
- ) {
336
- const { column, $table } = params
337
- const tableProps = $table.props
338
- const { editConfig } = tableProps
339
- const { type, filters, sortable, editRender, slots } = column
340
-
341
- // 兼容已废弃方式
342
- if (getConfig().tableHeadeSlotToTitleSlot !== 'obsolete') {
343
- const headerSlot = slots ? slots.header : null
344
- if (headerSlot) {
345
- return renderTitleContent(params, $table.callSlot(headerSlot, params))
346
- }
347
- }
348
-
349
- switch (type) {
350
- case 'seq':
351
- return Cell.renderSeqHeader(params)
352
- case 'radio':
353
- return Cell.renderRadioHeader(params)
354
- case 'checkbox':
355
- return Cell.renderCheckboxHeader(params)
356
- case 'html':
357
- if (filters && sortable) {
358
- return Cell.renderSortAndFilterHeader(params)
359
- } else if (sortable) {
360
- return Cell.renderSortHeader(params)
361
- } else if (filters) {
362
- return Cell.renderFilterHeader(params)
363
- }
364
- break
365
- }
366
- const isEnableEdit = editConfig && isEnableConf(editConfig)
367
- const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
368
- if (editRenderOpts) {
369
- return Cell.renderEditHeader(params)
370
- } else if (filters && sortable) {
371
- return Cell.renderSortAndFilterHeader(params)
372
- } else if (sortable) {
373
- return Cell.renderSortHeader(params)
374
- } else if (filters) {
375
- return Cell.renderFilterHeader(params)
376
- }
377
- return Cell.renderDefaultHeader(params)
378
- }
379
-
380
- function renderFooterHandle(
381
- params: VxeTableDefines.CellRenderFooterParams & {
382
- $table: VxeTableConstructor & VxeTablePrivateMethods
383
- }
384
- ) {
385
- return Cell.renderDefaultFooter(params)
386
- }
387
-
388
- export const Cell = {
389
- createColumn($xeTable: VxeTableConstructor & VxeTablePrivateMethods, columnOpts: VxeTableDefines.ColumnOptions | VxeTableDefines.ColumnInfo) {
390
- const { type } = columnOpts
391
- const renConfs: any = {
392
- renderHeader: renderHeaderHandle,
393
- renderCell: renderCellHandle,
394
- renderFooter: renderFooterHandle
395
- }
396
- if (type === 'expand') {
397
- renConfs.renderData = Cell.renderExpandData
398
- }
399
- return createColumn($xeTable, columnOpts, renConfs)
400
- },
401
- /**
402
- * 列头标题
403
- */
404
- renderHeaderTitle(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
405
- const { $table, column } = params
406
- const tableProps = $table.props
407
- const { editConfig } = tableProps
408
- const { slots, editRender, cellRender } = column
409
- const isEnableEdit = editConfig && isEnableConf(editConfig)
410
- const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
411
- const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null
412
- const renderOpts = editRenderOpts || cellRenderOpts
413
-
414
- // 兼容已废弃方式
415
- if (getConfig().tableHeadeSlotToTitleSlot === 'obsolete') {
416
- const headerSlot = slots ? slots.header : null
417
- if (headerSlot) {
418
- return renderTitleContent(params, $table.callSlot(headerSlot, params))
419
- }
420
- }
421
-
422
- if (renderOpts) {
423
- const { computeRendererOpts } = $table.getComputeMaps()
424
- const rendererOpts = computeRendererOpts.value
425
- const compConf = renderOpts.name ? rendererOpts[renderOpts.name] || renderer.get(renderOpts.name) : null
426
- if (compConf) {
427
- const rtHeader = compConf.renderTableHeader || compConf.renderHeader
428
- if (rtHeader) {
429
- return renderTitleContent(params, getSlotVNs(rtHeader(renderOpts, params)))
430
- }
431
- }
432
- }
433
- return renderTitleContent(params, $table.getHeaderCellLabel(column))
434
- },
435
- renderDefaultHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
436
- return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params))
437
- },
438
- renderDefaultCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
439
- const { $table, row, column } = params
440
- const tableProps = $table.props
441
- const tableReactData = $table.reactData
442
- const tableInternalData = $table.internalData
443
- const { isRowGroupStatus } = tableReactData
444
- const { editConfig } = tableProps
445
- const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column
446
- const isEnableEdit = editConfig && isEnableConf(editConfig)
447
- const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
448
- const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null
449
- const defaultSlot = slots ? slots.default : null
450
- const gcSlot = slots ? slots.groupContent || slots['group-content'] : null
451
- const gvSlot = slots ? slots.groupValues || slots['group-values'] : null
452
- let cellValue: string | number | null = ''
453
- if (isRowGroupStatus && field && row.isAggregate) {
454
- const aggRow: VxeTableDefines.AggregateRowInfo = row
455
- const { fullColumnFieldData } = tableInternalData
456
- const { computeAggregateOpts } = $table.getComputeMaps()
457
- const aggregateOpts = computeAggregateOpts.value
458
- const { mode, showTotal, totalMethod, countFields, contentMethod, formatValuesMethod, mapChildrenField } = aggregateOpts
459
- const aggData = aggRow.aggData
460
- const currAggData = aggData ? aggData[field] : null
461
- const groupField = aggRow.groupField
462
- const groupContent = aggRow.groupContent
463
- const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : []
464
- const childCount = aggRow.childCount
465
- const colRest = fullColumnFieldData[groupField] || {}
466
- const ctParams = {
467
- $table,
468
- groupField,
469
- groupColumn: (colRest ? colRest.column : null) as VxeTableDefines.ColumnInfo,
470
- column,
471
- groupValue: groupContent,
472
- childList,
473
- childCount,
474
- aggValue: null as any,
475
-
476
- /**
477
- * 已废弃
478
- * @deprecated
479
- */
480
- children: childList,
481
- /**
482
- * 已废弃
483
- * @deprecated
484
- */
485
- totalValue: childCount
486
- }
487
- if (mode === 'column' ? field === aggRow.groupField : rowGroupNode) {
488
- cellValue = groupContent
489
- if (contentMethod) {
490
- cellValue = `${contentMethod(ctParams)}`
491
- }
492
- if (showTotal) {
493
- cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount])
494
- }
495
- if (gcSlot) {
496
- return renderCellBaseVNs(params, $table.callSlot(gcSlot, Object.assign({ groupField, groupContent, childList, childCount }, params)))
497
- }
498
- } else if ($table.getPivotTableAggregateCellAggValue) {
499
- cellValue = $table.getPivotTableAggregateCellAggValue(params)
500
- ctParams.aggValue = cellValue
501
- if (gvSlot) {
502
- return renderCellBaseVNs(params, $table.callSlot(gvSlot, Object.assign({ groupField, groupContent, childList, childCount }, params, ctParams)))
503
- }
504
- } else if (aggFunc === true || (countFields && countFields.includes(field))) {
505
- cellValue = currAggData ? currAggData.value : childCount
506
- ctParams.aggValue = cellValue
507
- if (formatValuesMethod) {
508
- cellValue = formatValuesMethod(ctParams)
509
- }
510
- if (gvSlot) {
511
- return renderCellBaseVNs(params, $table.callSlot(gvSlot, Object.assign({ groupField, groupContent, childList, childCount }, params, ctParams)))
512
- }
513
- }
514
- } else {
515
- if (defaultSlot) {
516
- return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params))
517
- }
518
- const { computeRendererOpts } = $table.getComputeMaps()
519
- const rendererOpts = computeRendererOpts.value
520
- // 如果是编辑模式-查看:slot default > formatter > cellRender.renderTableDefault > editRender.renderTableCell > editRender.renderTableDefault > cellRender.tableCellFormatter > editRender.tableCellFormatter > field
521
- // 如果是查看表格:slot default > formatter > cellRender.renderTableDefault > cellRender.tableCellFormatter > field
522
- const cellCompConf = cellRenderOpts && cellRenderOpts.name ? rendererOpts[cellRenderOpts.name] || renderer.get(cellRenderOpts.name) : null
523
- if (cellRenderOpts) {
524
- const cellDefaultRenderFn = cellCompConf ? cellCompConf.renderTableDefault || cellCompConf.renderDefault : null
525
- if (cellDefaultRenderFn && cellRenderOpts) {
526
- return renderCellBaseVNs(params, getSlotVNs(cellDefaultRenderFn(cellRenderOpts, Object.assign({ $type: editRenderOpts ? 'edit' : 'cell' }, params))))
527
- }
528
- }
529
- if (editRenderOpts) {
530
- const editCompConf = editRenderOpts && editRenderOpts.name ? rendererOpts[editRenderOpts.name] || renderer.get(editRenderOpts.name) : null
531
- const editCellRenderFn = editCompConf ? editCompConf.renderTableCell || editCompConf.renderCell || editCompConf.renderTableDefault || editCompConf.renderDefault : null
532
- if (editCellRenderFn) {
533
- return renderCellBaseVNs(params, getSlotVNs(editCellRenderFn(editRenderOpts, Object.assign({ $type: editRenderOpts ? 'edit' : 'cell' }, params))))
534
- }
535
- }
536
-
537
- // 如果是编辑模式-查看:cellRender.tableCellFormatter > editRender.tableCellFormatter > field
538
- // 如果是查看表格:cellRender.tableCellFormatter > field
539
- cellValue = $table.getCellLabel(row, column)
540
- }
541
- const cellPlaceholder = editRenderOpts ? editRenderOpts.placeholder : ''
542
- return renderCellBaseVNs(params, [
543
- h(
544
- 'span',
545
- {
546
- class: 'vxe-cell--label'
547
- },
548
- [
549
- // 如果设置占位符
550
- editRenderOpts && eqEmptyValue(cellValue)
551
- ? h(
552
- 'span',
553
- {
554
- class: 'vxe-cell--placeholder'
555
- },
556
- formatText(getFuncText(cellPlaceholder), 1)
557
- )
558
- : h('span', formatText(cellValue, 1))
559
- ]
560
- )
561
- ])
562
- },
563
- renderDeepCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
564
- return Cell.renderDeepNodeBtn(params, Cell.renderDefaultCell(params) as VNode[])
565
- },
566
- renderDefaultFooter(params: VxeTableDefines.CellRenderFooterParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
567
- return getFooterContent(params)
568
- },
569
-
570
- /**
571
- * 行分组
572
- */
573
- renderRowGroupBtn(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
574
- const { $table } = params
575
- const tableReactData = $table.reactData
576
- const tableInternalData = $table.internalData
577
- const { row, level } = params
578
- const { computeAggregateOpts } = $table.getComputeMaps()
579
- const { rowGroupExpandedFlag } = tableReactData
580
- const { rowGroupExpandedMaps } = tableInternalData
581
- const aggregateOpts = computeAggregateOpts.value
582
- const { mode, padding, indent, showIcon, iconOpen, iconClose } = aggregateOpts
583
- const rowid = getRowid($table, row)
584
- const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid]
585
- return h(
586
- 'div',
587
- {
588
- class: [
589
- 'vxe-row-group--tree-node',
590
- {
591
- 'is--expanded': isExpand
592
- }
593
- ],
594
- style:
595
- mode !== 'column' && padding && indent
596
- ? {
597
- paddingLeft: `${level * indent}px`
598
- }
599
- : undefined
600
- },
601
- [
602
- showIcon && row.isAggregate
603
- ? h(
604
- 'span',
605
- {
606
- class: 'vxe-row-group--node-btn',
607
- onClick(evnt: MouseEvent) {
608
- $table.triggerRowGroupExpandEvent(evnt, params)
609
- }
610
- },
611
- [
612
- h('i', {
613
- class: isExpand ? iconOpen || getIcon().TABLE_ROW_GROUP_OPEN : iconClose || getIcon().TABLE_ROW_GROUP_CLOSE
614
- })
615
- ]
616
- )
617
- : renderEmptyElement($table),
618
- h(
619
- 'div',
620
- {
621
- class: 'vxe-row-group-cell'
622
- },
623
- cellVNodes
624
- )
625
- ]
626
- )
627
- },
628
- /**
629
- * 树
630
- */
631
- renderTreeNodeBtn(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
632
- const { $table, isHidden } = params
633
- const tableReactData = $table.reactData
634
- const tableInternalData = $table.internalData
635
- const { row, column, level } = params
636
- const { slots } = column
637
- const iconSlot = slots ? slots.icon : null
638
- if (iconSlot) {
639
- return $table.callSlot(iconSlot, params)
640
- }
641
- const { computeTreeOpts } = $table.getComputeMaps()
642
- const { treeExpandedFlag } = tableReactData
643
- const { fullAllDataRowIdData, treeExpandedMaps, treeExpandLazyLoadedMaps } = tableInternalData
644
- const treeOpts = computeTreeOpts.value
645
- const { padding, indent, lazy, trigger, visibleMethod, iconLoaded, showIcon, iconOpen, iconClose } = treeOpts
646
- const childrenField = treeOpts.children || treeOpts.childrenField
647
- const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
648
- const rowChilds = row[childrenField]
649
- const hasChild = rowChilds && rowChilds.length
650
- let hasLazyChilds = false
651
- let isActive = false
652
- let isLazyLoading = false
653
- let isLazyLoaded = false
654
- const ons: Record<string, any> = {}
655
- if (!isHidden) {
656
- const rowid = getRowid($table, row)
657
- isActive = !!treeExpandedFlag && !!treeExpandedMaps[rowid]
658
- if (lazy) {
659
- const rest = fullAllDataRowIdData[rowid]
660
- isLazyLoading = !!treeExpandLazyLoadedMaps[rowid]
661
- hasLazyChilds = row[hasChildField]
662
- isLazyLoaded = !!rest.treeLoaded
663
- }
664
- }
665
- if (!trigger || trigger === 'default') {
666
- ons.onClick = (evnt: MouseEvent) => {
667
- $table.triggerTreeExpandEvent(evnt, params)
668
- }
669
- }
670
- return h(
671
- 'div',
672
- {
673
- class: [
674
- 'vxe-cell--tree-node',
675
- {
676
- 'is--active': isActive
677
- }
678
- ],
679
- style:
680
- padding && indent
681
- ? {
682
- paddingLeft: `${level * indent}px`
683
- }
684
- : undefined
685
- },
686
- [
687
- showIcon && (lazy ? (isLazyLoaded ? hasChild : hasChild || hasLazyChilds) : hasChild) && (!visibleMethod || visibleMethod(params))
688
- ? [
689
- h(
690
- 'div',
691
- {
692
- class: 'vxe-cell--tree-btn',
693
- ...ons
694
- },
695
- [
696
- h('i', {
697
- class: isLazyLoading ? iconLoaded || getIcon().TABLE_TREE_LOADED : isActive ? iconOpen || getIcon().TABLE_TREE_OPEN : iconClose || getIcon().TABLE_TREE_CLOSE
698
- })
699
- ]
700
- )
701
- ]
702
- : null,
703
- h(
704
- 'div',
705
- {
706
- class: 'vxe-tree-cell'
707
- },
708
- cellVNodes
709
- )
710
- ]
711
- )
712
- },
713
- /**
714
- * 层级节点。
715
- * 行分组、树结构
716
- */
717
- renderDeepNodeBtn(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
718
- const { $table, row, column } = params
719
- const { rowGroupNode } = column
720
- const tableReactData = $table.reactData
721
- const { rowGroupList } = tableReactData
722
- if (rowGroupList.length) {
723
- const { computeAggregateOpts } = $table.getComputeMaps()
724
- const aggregateOpts = computeAggregateOpts.value
725
- const { mode } = aggregateOpts
726
- if (mode === 'column') {
727
- if (row.groupField && column.field === row.groupField) {
728
- return [Cell.renderRowGroupBtn(params, cellVNodes)]
729
- }
730
- return cellVNodes
731
- } else if (rowGroupNode) {
732
- return [Cell.renderRowGroupBtn(params, cellVNodes)]
733
- }
734
- }
735
- return [Cell.renderTreeNodeBtn(params, cellVNodes)]
736
- },
737
-
738
- /**
739
- * 序号
740
- */
741
- renderSeqHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
742
- const { $table, column } = params
743
-
744
- // 兼容已废弃方式
745
- if (getConfig().tableHeadeSlotToTitleSlot === 'obsolete') {
746
- const { slots } = column
747
- const headerSlot = slots ? slots.header : null
748
- return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : $table.getHeaderCellLabel(column)))
749
- }
750
-
751
- return renderHeaderCellBaseVNs(params, renderTitleContent(params, $table.getHeaderCellLabel(column)))
752
- },
753
- renderSeqCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
754
- const { $table, column } = params
755
- const tableProps = $table.props
756
- const { treeConfig } = tableProps
757
- const { computeSeqOpts } = $table.getComputeMaps()
758
- const seqOpts = computeSeqOpts.value
759
- const { slots } = column
760
- const defaultSlot = slots ? slots.default : null
761
- if (defaultSlot) {
762
- return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params))
763
- }
764
- const { seq } = params
765
- const seqMd = seqOpts.seqMethod
766
- return renderCellBaseVNs(params, [h('span', `${formatText(seqMd ? seqMd(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + (seq as number), 1)}`)])
767
- },
768
- renderDeepIndexCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
769
- return Cell.renderDeepNodeBtn(params, Cell.renderSeqCell(params) as VNode[])
770
- },
771
-
772
- /**
773
- * 单选
774
- */
775
- renderRadioHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
776
- const { $table, column } = params
777
- const { slots } = column
778
- const titleSlot = slots ? slots.title : null
779
-
780
- // 兼容已废弃方式
781
- if (getConfig().tableHeadeSlotToTitleSlot === 'obsolete') {
782
- const headerSlot = slots ? slots.header : null
783
- return renderHeaderCellBaseVNs(
784
- params,
785
- renderTitleContent(
786
- params,
787
- headerSlot
788
- ? $table.callSlot(headerSlot, params)
789
- : [
790
- h(
791
- 'span',
792
- {
793
- class: 'vxe-radio--label'
794
- },
795
- titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column)
796
- )
797
- ]
798
- )
799
- )
800
- }
801
-
802
- return renderHeaderCellBaseVNs(
803
- params,
804
- renderTitleContent(params, [
805
- h(
806
- 'span',
807
- {
808
- class: 'vxe-radio--label'
809
- },
810
- titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column)
811
- )
812
- ])
813
- )
814
- },
815
- renderRadioCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
816
- const { $table, column, isHidden } = params
817
- const tableReactData = $table.reactData
818
- const { computeRadioOpts } = $table.getComputeMaps()
819
- const { selectRadioRow } = tableReactData
820
- const radioOpts = computeRadioOpts.value
821
- const { slots } = column
822
- const { labelField, checkMethod, visibleMethod } = radioOpts
823
- const { row } = params
824
- const defaultSlot = slots ? slots.default : null
825
- const radioSlot = slots ? slots.radio : null
826
- const isChecked = $table.eqRow(row, selectRadioRow)
827
- const isVisible = !visibleMethod || visibleMethod({ $table, row })
828
- let isDisabled = !!checkMethod
829
- let ons
830
- if (!isHidden) {
831
- ons = {
832
- onClick(evnt: Event) {
833
- if (!isDisabled && isVisible) {
834
- $table.triggerRadioRowEvent(evnt, params)
835
- }
836
- }
837
- }
838
- if (checkMethod) {
839
- isDisabled = !checkMethod({ $table, row })
840
- }
841
- }
842
- const radioParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible }
843
- if (radioSlot) {
844
- return renderCellBaseVNs(params, $table.callSlot(radioSlot, radioParams))
845
- }
846
- const radioVNs: VNode[] = []
847
- if (isVisible) {
848
- radioVNs.push(
849
- h('span', {
850
- class: ['vxe-radio--icon', isChecked ? getIcon().TABLE_RADIO_CHECKED : isDisabled ? getIcon().TABLE_RADIO_DISABLED_UNCHECKED : getIcon().TABLE_RADIO_UNCHECKED]
851
- })
852
- )
853
- }
854
- if (defaultSlot || labelField) {
855
- radioVNs.push(
856
- h(
857
- 'span',
858
- {
859
- class: 'vxe-radio--label'
860
- },
861
- defaultSlot ? $table.callSlot(defaultSlot, radioParams) : XEUtils.get(row, labelField as string)
862
- )
863
- )
864
- }
865
- return renderCellBaseVNs(params, [
866
- h(
867
- 'span',
868
- {
869
- class: [
870
- 'vxe-cell--radio',
871
- {
872
- 'is--checked': isChecked,
873
- 'is--disabled': isDisabled
874
- }
875
- ],
876
- ...ons
877
- },
878
- radioVNs
879
- )
880
- ])
881
- },
882
- renderDeepRadioCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
883
- return Cell.renderDeepNodeBtn(params, Cell.renderRadioCell(params))
884
- },
885
-
886
- /**
887
- * 多选
888
- */
889
- renderCheckboxHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
890
- const { $table, column, isHidden } = params
891
- const tableReactData = $table.reactData
892
- const { computeIsAllCheckboxDisabled, computeCheckboxOpts } = $table.getComputeMaps()
893
- const { isAllSelected: isAllCheckboxSelected, isIndeterminate: isAllCheckboxIndeterminate } = tableReactData
894
- const isAllCheckboxDisabled = computeIsAllCheckboxDisabled.value
895
- const { slots } = column
896
- const titleSlot = slots ? slots.title : null
897
- const checkboxOpts = computeCheckboxOpts.value
898
- const { checkStrictly, showHeader, headerTitle } = checkboxOpts
899
- const colTitle = $table.getHeaderCellLabel(column)
900
- const ons: Record<string, any> = {}
901
- if (!isHidden) {
902
- ons.onClick = (evnt: MouseEvent) => {
903
- if (!isAllCheckboxDisabled) {
904
- $table.triggerCheckAllEvent(evnt, !isAllCheckboxSelected)
905
- }
906
- }
907
- }
908
- const checkboxParams = { ...params, checked: isAllCheckboxSelected, disabled: isAllCheckboxDisabled, indeterminate: isAllCheckboxIndeterminate }
909
-
910
- // 兼容已废弃方式
911
- if (getConfig().tableHeadeSlotToTitleSlot === 'obsolete') {
912
- const headerSlot = slots ? slots.header : null
913
- if (headerSlot) {
914
- return renderHeaderCellBaseVNs(params, renderTitleContent(checkboxParams, $table.callSlot(headerSlot, checkboxParams)))
915
- }
916
- }
917
-
918
- if (checkStrictly ? !showHeader : showHeader === false) {
919
- return renderHeaderCellBaseVNs(
920
- params,
921
- renderTitleContent(checkboxParams, [
922
- h(
923
- 'span',
924
- {
925
- class: 'vxe-checkbox--label'
926
- },
927
- titleSlot ? $table.callSlot(titleSlot, checkboxParams) : colTitle
928
- )
929
- ])
930
- )
931
- }
932
- return renderHeaderCellBaseVNs(
933
- params,
934
- renderTitleContent(checkboxParams, [
935
- h(
936
- 'span',
937
- {
938
- class: [
939
- 'vxe-cell--checkbox',
940
- {
941
- 'is--checked': isAllCheckboxSelected,
942
- 'is--disabled': isAllCheckboxDisabled,
943
- 'is--indeterminate': isAllCheckboxIndeterminate
944
- }
945
- ],
946
- title: XEUtils.eqNull(headerTitle) ? getI18n('vxe.table.allTitle') : `${headerTitle || ''}`,
947
- ...ons
948
- },
949
- [
950
- h('span', {
951
- class: ['vxe-checkbox--icon', isAllCheckboxIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllCheckboxSelected ? getIcon().TABLE_CHECKBOX_CHECKED : isAllCheckboxDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
952
- })
953
- ].concat(
954
- titleSlot || colTitle
955
- ? [
956
- h(
957
- 'span',
958
- {
959
- class: 'vxe-checkbox--label'
960
- },
961
- titleSlot ? $table.callSlot(titleSlot, checkboxParams) : colTitle
962
- )
963
- ]
964
- : []
965
- )
966
- )
967
- ])
968
- )
969
- },
970
- renderCheckboxCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
971
- const { $table, row, column, isHidden } = params
972
- const tableProps = $table.props
973
- const tableReactData = $table.reactData
974
- const tableInternalData = $table.internalData
975
- const { treeConfig } = tableProps
976
- const { updateCheckboxFlag, isRowGroupStatus } = tableReactData
977
- const { selectCheckboxMaps, treeIndeterminateRowMaps } = tableInternalData
978
- const { computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps()
979
- const aggregateOpts = computeAggregateOpts.value
980
- const { mapChildrenField } = aggregateOpts
981
- const checkboxOpts = computeCheckboxOpts.value
982
- const { labelField, checkMethod, visibleMethod } = checkboxOpts
983
- const { slots } = column
984
- const defaultSlot = slots ? slots.default : null
985
- const checkboxSlot = slots ? slots.checkbox : null
986
- let indeterminate = false
987
- let isChecked = false
988
- let isVisible = true
989
- let isDisabled = false
990
- const ons: Record<string, any> = {}
991
- if (!isHidden) {
992
- const rowid = getRowid($table, row)
993
- isChecked = !!updateCheckboxFlag && !!selectCheckboxMaps[rowid]
994
- if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
995
- const childList: any[] = row[mapChildrenField || '']
996
- if (!childList || !childList.length || childList.every((item) => !checkMethod({ $table, row: item }))) {
997
- isDisabled = true
998
- }
999
- } else {
1000
- isVisible = !visibleMethod || visibleMethod({ $table, row })
1001
- isDisabled = checkMethod ? !checkMethod({ $table, row }) : !!checkMethod
1002
- }
1003
- if (treeConfig || isRowGroupStatus) {
1004
- indeterminate = !!treeIndeterminateRowMaps[rowid]
1005
- }
1006
- ons.onClick = (evnt: MouseEvent) => {
1007
- if (!isDisabled && isVisible) {
1008
- $table.triggerCheckRowEvent(evnt, params, !isChecked)
1009
- }
1010
- }
1011
- }
1012
- const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate }
1013
- if (checkboxSlot) {
1014
- return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams))
1015
- }
1016
- const checkVNs: VNode[] = []
1017
- if (isVisible) {
1018
- checkVNs.push(
1019
- h('span', {
1020
- class: ['vxe-checkbox--icon', indeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : isDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
1021
- })
1022
- )
1023
- }
1024
- if (defaultSlot || labelField) {
1025
- checkVNs.push(
1026
- h(
1027
- 'span',
1028
- {
1029
- class: 'vxe-checkbox--label'
1030
- },
1031
- defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField as string)
1032
- )
1033
- )
1034
- }
1035
- return renderCellBaseVNs(params, [
1036
- h(
1037
- 'span',
1038
- {
1039
- class: [
1040
- 'vxe-cell--checkbox',
1041
- {
1042
- 'is--checked': isChecked,
1043
- 'is--disabled': isDisabled,
1044
- 'is--indeterminate': indeterminate,
1045
- 'is--hidden': !isVisible
1046
- }
1047
- ],
1048
- ...ons
1049
- },
1050
- checkVNs
1051
- )
1052
- ])
1053
- },
1054
- renderDeepSelectionCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1055
- return Cell.renderDeepNodeBtn(params, Cell.renderCheckboxCell(params))
1056
- },
1057
- renderCheckboxCellByProp(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1058
- const { $table, row, column, isHidden } = params
1059
- const tableProps = $table.props
1060
- const tableReactData = $table.reactData
1061
- const tableInternalData = $table.internalData
1062
- const { treeConfig } = tableProps
1063
- const { updateCheckboxFlag, isRowGroupStatus } = tableReactData
1064
- const { treeIndeterminateRowMaps } = tableInternalData
1065
- const { computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps()
1066
- const aggregateOpts = computeAggregateOpts.value
1067
- const { mapChildrenField } = aggregateOpts
1068
- const checkboxOpts = computeCheckboxOpts.value
1069
- const { labelField, checkField, checkMethod, visibleMethod } = checkboxOpts
1070
- const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
1071
- const { slots } = column
1072
- const defaultSlot = slots ? slots.default : null
1073
- const checkboxSlot = slots ? slots.checkbox : null
1074
- let indeterminate = false
1075
- let isChecked = false
1076
- let isVisible = true
1077
- let isDisabled = false
1078
- const ons: Record<string, any> = {}
1079
- if (!isHidden) {
1080
- const rowid = getRowid($table, row)
1081
- isChecked = !!updateCheckboxFlag && XEUtils.get(row, checkField)
1082
- if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
1083
- const childList: any[] = row[mapChildrenField || '']
1084
- if (!childList || !childList.length || childList.every((item) => !checkMethod({ $table, row: item }))) {
1085
- isDisabled = true
1086
- }
1087
- } else {
1088
- isVisible = !visibleMethod || visibleMethod({ $table, row })
1089
- isDisabled = checkMethod ? !checkMethod({ $table, row }) : !!checkMethod
1090
- }
1091
- if (treeConfig || isRowGroupStatus) {
1092
- indeterminate = !!treeIndeterminateRowMaps[rowid]
1093
- }
1094
- ons.onClick = (evnt: MouseEvent) => {
1095
- if (!isDisabled && isVisible) {
1096
- $table.triggerCheckRowEvent(evnt, params, !isChecked)
1097
- }
1098
- }
1099
- }
1100
- const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate }
1101
- if (checkboxSlot) {
1102
- return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams))
1103
- }
1104
- const checkVNs: VNode[] = []
1105
- if (isVisible) {
1106
- checkVNs.push(
1107
- h('span', {
1108
- class: ['vxe-checkbox--icon', indeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : isDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
1109
- })
1110
- )
1111
- if (defaultSlot || labelField) {
1112
- checkVNs.push(
1113
- h(
1114
- 'span',
1115
- {
1116
- class: 'vxe-checkbox--label'
1117
- },
1118
- defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField as string)
1119
- )
1120
- )
1121
- }
1122
- }
1123
- return renderCellBaseVNs(params, [
1124
- h(
1125
- 'span',
1126
- {
1127
- class: [
1128
- 'vxe-cell--checkbox',
1129
- {
1130
- 'is--checked': isChecked,
1131
- 'is--disabled': isDisabled,
1132
- 'is--indeterminate': indeterminateField && !isChecked ? row[indeterminateField] : indeterminate,
1133
- 'is--hidden': !isVisible
1134
- }
1135
- ],
1136
- ...ons
1137
- },
1138
- checkVNs
1139
- )
1140
- ])
1141
- },
1142
- renderDeepSelectionCellByProp(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1143
- return Cell.renderDeepNodeBtn(params, Cell.renderCheckboxCellByProp(params))
1144
- },
1145
-
1146
- /**
1147
- * 展开行
1148
- */
1149
- renderExpandCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1150
- const { $table, isHidden, row, column } = params
1151
- const tableReactData = $table.reactData
1152
- const tableInternalData = $table.internalData
1153
- const { isRowGroupStatus } = tableReactData
1154
- const { rowExpandedMaps, rowExpandLazyLoadedMaps } = tableInternalData
1155
- const { computeExpandOpts } = $table.getComputeMaps()
1156
- const expandOpts = computeExpandOpts.value
1157
- const { lazy, labelField, iconLoaded, showIcon, iconOpen, iconClose, visibleMethod } = expandOpts
1158
- const { slots } = column
1159
- const defaultSlot = slots ? slots.default : null
1160
- const iconSlot = slots ? slots.icon : null
1161
- let isActive = false
1162
- let isLazyLoading = false
1163
- if (isRowGroupStatus && row.isAggregate) {
1164
- return renderCellBaseVNs(params, [])
1165
- }
1166
- if (iconSlot) {
1167
- return renderCellBaseVNs(params, $table.callSlot(iconSlot, params))
1168
- }
1169
- if (!isHidden) {
1170
- const rowid = getRowid($table, row)
1171
- isActive = !!rowExpandedMaps[rowid]
1172
- if (lazy) {
1173
- isLazyLoading = !!rowExpandLazyLoadedMaps[rowid]
1174
- }
1175
- }
1176
- return renderCellBaseVNs(params, [
1177
- showIcon && (!visibleMethod || visibleMethod(params))
1178
- ? h(
1179
- 'div',
1180
- {
1181
- class: [
1182
- 'vxe-table--expanded',
1183
- {
1184
- 'is--active': isActive
1185
- }
1186
- ]
1187
- },
1188
- [
1189
- h(
1190
- 'span',
1191
- {
1192
- class: 'vxe-table--expand-btn',
1193
- onMousedown(evnt) {
1194
- evnt.stopPropagation()
1195
- },
1196
- onClick(evnt: MouseEvent) {
1197
- $table.triggerRowExpandEvent(evnt, params)
1198
- }
1199
- },
1200
- [
1201
- h('i', {
1202
- class: isLazyLoading ? iconLoaded || getIcon().TABLE_EXPAND_LOADED : isActive ? iconOpen || getIcon().TABLE_EXPAND_OPEN : iconClose || getIcon().TABLE_EXPAND_CLOSE
1203
- })
1204
- ]
1205
- )
1206
- ]
1207
- )
1208
- : renderEmptyElement($table),
1209
- defaultSlot || labelField
1210
- ? h(
1211
- 'div',
1212
- {
1213
- class: 'vxe-table--expand-label'
1214
- },
1215
- defaultSlot ? $table.callSlot(defaultSlot, params) : XEUtils.get(row, labelField as string)
1216
- )
1217
- : renderEmptyElement($table)
1218
- ])
1219
- },
1220
- renderExpandData(params: VxeTableDefines.CellRenderDataParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1221
- const { $table, column } = params
1222
- const { slots, contentRender } = column
1223
- const contentSlot = slots ? slots.content : null
1224
- if (contentSlot) {
1225
- return $table.callSlot(contentSlot, params)
1226
- }
1227
- if (contentRender) {
1228
- const { computeRendererOpts } = $table.getComputeMaps()
1229
- const rendererOpts = computeRendererOpts.value
1230
- const compConf = contentRender.name ? rendererOpts[contentRender.name] || renderer.get(contentRender.name) : null
1231
- if (compConf) {
1232
- const rtExpand = compConf.renderTableExpand || compConf.renderExpand
1233
- if (rtExpand) {
1234
- return getSlotVNs(rtExpand(contentRender, params))
1235
- }
1236
- }
1237
- }
1238
- return []
1239
- },
1240
-
1241
- /**
1242
- * HTML 标签
1243
- */
1244
- renderHTMLCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1245
- const { $table, column } = params
1246
- const { slots } = column
1247
- const defaultSlot = slots ? slots.default : null
1248
- if (defaultSlot) {
1249
- return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params))
1250
- }
1251
- return renderCellBaseVNs(params, [
1252
- h('span', {
1253
- class: 'vxe-cell--html',
1254
- innerHTML: getDefaultCellLabel(params)
1255
- })
1256
- ])
1257
- },
1258
- renderDeepHTMLCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1259
- return Cell.renderDeepNodeBtn(params, Cell.renderHTMLCell(params))
1260
- },
1261
-
1262
- /**
1263
- * 排序和筛选
1264
- */
1265
- renderSortAndFilterHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1266
- return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params).concat(Cell.renderSortIcon(params).concat(Cell.renderFilterIcon(params))))
1267
- },
1268
-
1269
- /**
1270
- * 排序
1271
- */
1272
- renderSortHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1273
- return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params).concat(Cell.renderSortIcon(params)))
1274
- },
1275
- renderSortIcon(params: (VxeTableDefines.CellRenderHeaderParams | VxeTableDefines.CellRenderHeaderParams) & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1276
- const { $table, column } = params
1277
- const { computeSortOpts } = $table.getComputeMaps()
1278
- const sortOpts = computeSortOpts.value
1279
- const { showIcon, allowBtn, ascTitle, descTitle, iconLayout, iconAsc, iconDesc, iconVisibleMethod } = sortOpts
1280
- const { order, slots } = column
1281
- if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
1282
- const sortSlot = slots ? slots.sort : null
1283
- return sortSlot
1284
- ? (getSlotVNs($table.callSlot(sortSlot, params)) as VNode[])
1285
- : [
1286
- h(
1287
- 'span',
1288
- {
1289
- class: ['vxe-cell--sort', `vxe-cell--sort-${iconLayout}-layout`]
1290
- },
1291
- [
1292
- h('i', {
1293
- class: [
1294
- 'vxe-sort--asc-btn',
1295
- iconAsc || getIcon().TABLE_SORT_ASC,
1296
- {
1297
- 'sort--active': order === 'asc'
1298
- }
1299
- ],
1300
- title: XEUtils.eqNull(ascTitle) ? getI18n('vxe.table.sortAsc') : `${ascTitle || ''}`,
1301
- onClick: allowBtn
1302
- ? (evnt: Event) => {
1303
- evnt.stopPropagation()
1304
- $table.triggerSortEvent(evnt, column, 'asc')
1305
- }
1306
- : undefined
1307
- }),
1308
- h('i', {
1309
- class: [
1310
- 'vxe-sort--desc-btn',
1311
- iconDesc || getIcon().TABLE_SORT_DESC,
1312
- {
1313
- 'sort--active': order === 'desc'
1314
- }
1315
- ],
1316
- title: XEUtils.eqNull(descTitle) ? getI18n('vxe.table.sortDesc') : `${descTitle || ''}`,
1317
- onClick: allowBtn
1318
- ? (evnt: Event) => {
1319
- evnt.stopPropagation()
1320
- $table.triggerSortEvent(evnt, column, 'desc')
1321
- }
1322
- : undefined
1323
- })
1324
- ]
1325
- )
1326
- ]
1327
- }
1328
- return []
1329
- },
1330
-
1331
- /**
1332
- * 筛选
1333
- */
1334
- renderFilterHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1335
- return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params).concat(Cell.renderFilterIcon(params)))
1336
- },
1337
- renderFilterIcon(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1338
- const { $table, column, hasFilter } = params
1339
- const tableReactData = $table.reactData
1340
- const { filterStore } = tableReactData
1341
- const { computeFilterOpts } = $table.getComputeMaps()
1342
- const filterOpts = computeFilterOpts.value
1343
- const { showIcon, iconNone, iconMatch, iconVisibleMethod } = filterOpts
1344
- if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
1345
- return [
1346
- h(
1347
- 'span',
1348
- {
1349
- class: [
1350
- 'vxe-cell--filter',
1351
- {
1352
- 'is--active': filterStore.visible && filterStore.column === column
1353
- }
1354
- ],
1355
- onClick(evnt) {
1356
- if ($table.triggerFilterEvent) {
1357
- $table.triggerFilterEvent(evnt, params.column, params)
1358
- }
1359
- }
1360
- },
1361
- [
1362
- h('i', {
1363
- class: ['vxe-filter--btn', hasFilter ? iconMatch || getIcon().TABLE_FILTER_MATCH : iconNone || getIcon().TABLE_FILTER_NONE],
1364
- title: getI18n('vxe.table.filter')
1365
- })
1366
- ]
1367
- )
1368
- ]
1369
- }
1370
- return []
1371
- },
1372
-
1373
- /**
1374
- * 可编辑
1375
- */
1376
- renderEditHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1377
- const { $table, column } = params
1378
- const tableProps = $table.props
1379
- const { computeEditOpts } = $table.getComputeMaps()
1380
- const { editConfig, editRules } = tableProps
1381
- const editOpts = computeEditOpts.value
1382
- const { sortable, filters, editRender } = column
1383
- const isEnableEdit = editConfig && isEnableConf(editConfig)
1384
- const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
1385
- let isRequired = false
1386
- if (editRules) {
1387
- const columnRules = column.rules ? column.rules : XEUtils.get(editRules, column.field)
1388
- if (columnRules) {
1389
- isRequired = columnRules.some((rule) => rule.required)
1390
- }
1391
- }
1392
- let editIconVNs: VNode[] = []
1393
- if (isEnableEdit) {
1394
- const { showAsterisk, showIcon, icon } = editOpts
1395
- editIconVNs = [
1396
- isRequired && showAsterisk
1397
- ? h(
1398
- 'span',
1399
- {
1400
- class: 'vxe-cell--required-icon'
1401
- },
1402
- [h('i')]
1403
- )
1404
- : renderEmptyElement($table),
1405
- editRenderOpts && showIcon
1406
- ? h(
1407
- 'span',
1408
- {
1409
- class: 'vxe-cell--edit-icon'
1410
- },
1411
- XEUtils.isFunction(icon)
1412
- ? getSlotVNs(icon({}))
1413
- : [
1414
- h('i', {
1415
- class: icon || getIcon().TABLE_EDIT
1416
- })
1417
- ]
1418
- )
1419
- : renderEmptyElement($table)
1420
- ]
1421
- }
1422
- return renderHeaderCellBaseVNs(
1423
- params,
1424
- editIconVNs
1425
- .concat(Cell.renderHeaderTitle(params))
1426
- .concat(sortable ? Cell.renderSortIcon(params) : [])
1427
- .concat(filters ? Cell.renderFilterIcon(params) : [])
1428
- )
1429
- },
1430
- // 行格编辑模式
1431
- renderRowEdit(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1432
- const { $table, column } = params
1433
- const tableProps = $table.props
1434
- const { editConfig } = tableProps
1435
- const tableReactData = $table.reactData
1436
- const { editStore } = tableReactData
1437
- const { actived } = editStore
1438
- const { editRender } = column
1439
- const isEnableEdit = editConfig && isEnableConf(editConfig)
1440
- const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
1441
- return Cell.runRenderer(params, !!(editRenderOpts && actived && actived.row === params.row))
1442
- },
1443
- renderDeepRowEdit(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1444
- return Cell.renderDeepNodeBtn(params, Cell.renderRowEdit(params) as VNode[])
1445
- },
1446
- // 单元格编辑模式
1447
- renderCellEdit(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1448
- const { $table, column } = params
1449
- const tableProps = $table.props
1450
- const { editConfig } = tableProps
1451
- const tableReactData = $table.reactData
1452
- const { editStore } = tableReactData
1453
- const { actived } = editStore
1454
- const { editRender } = column
1455
- const isEnableEdit = editConfig && isEnableConf(editConfig)
1456
- const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
1457
- return Cell.runRenderer(params, !!(editRenderOpts && actived && actived.row === params.row && actived.column === params.column))
1458
- },
1459
- renderDeepCellEdit(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1460
- return Cell.renderDeepNodeBtn(params, Cell.renderCellEdit(params) as VNode[])
1461
- },
1462
- runRenderer(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, isEdit: boolean) {
1463
- const { $table, row, column } = params
1464
- const tableProps = $table.props
1465
- const { editConfig } = tableProps
1466
- const tableReactData = $table.reactData
1467
- const { isRowGroupStatus } = tableReactData
1468
- const { slots, field, editRender, formatter } = column
1469
- const isEnableEdit = editConfig && isEnableConf(editConfig)
1470
- const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
1471
- const defaultSlot = slots ? slots.default : null
1472
- const gcSlot = slots ? slots.groupContent || slots['group-content'] : null
1473
- const editSlot = slots ? slots.edit : null
1474
- const cellParams = Object.assign({ $type: '', isEdit }, params)
1475
- if (isEdit && editRenderOpts) {
1476
- cellParams.$type = 'edit'
1477
- if (editSlot) {
1478
- return $table.callSlot(editSlot, cellParams)
1479
- }
1480
- const { computeRendererOpts } = $table.getComputeMaps()
1481
- const rendererOpts = computeRendererOpts.value
1482
- const compConf = editRenderOpts.name ? rendererOpts[editRenderOpts.name] || renderer.get(editRenderOpts.name) : null
1483
- const rtEdit = compConf ? compConf.renderTableEdit || compConf.renderEdit : null
1484
- if (rtEdit) {
1485
- return getSlotVNs(rtEdit(editRenderOpts, cellParams))
1486
- }
1487
- return []
1488
- }
1489
-
1490
- if (isRowGroupStatus && field && row.isAggregate) {
1491
- const aggRow: VxeTableDefines.AggregateRowInfo = row
1492
- const { computeAggregateOpts } = $table.getComputeMaps()
1493
- const aggregateOpts = computeAggregateOpts.value
1494
- const { mapChildrenField } = aggregateOpts
1495
- const groupField = aggRow.groupField
1496
- const groupContent = aggRow.groupContent
1497
- const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : []
1498
- const childCount = aggRow.childCount
1499
- if (gcSlot) {
1500
- return renderCellBaseVNs(params, $table.callSlot(gcSlot, Object.assign({ groupField, groupContent, childList, childCount }, params)))
1501
- }
1502
- } else {
1503
- if (defaultSlot) {
1504
- return renderCellBaseVNs(params, $table.callSlot(defaultSlot, cellParams))
1505
- }
1506
- }
1507
-
1508
- // slot default > formatter
1509
- if (formatter) {
1510
- return renderCellBaseVNs(params, [
1511
- h(
1512
- 'span',
1513
- {
1514
- class: 'vxe-cell--label'
1515
- },
1516
- getDefaultCellLabel(cellParams)
1517
- )
1518
- ])
1519
- }
1520
- return Cell.renderDefaultCell(cellParams)
1521
- }
1522
- }
1523
-
1524
- export default Cell
1
+ import { h, VNode } from 'vue'
2
+ import XEUtils from 'xe-utils'
3
+ import { VxeUI } from '@vxe-ui/core'
4
+ import { getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
5
+ import { updateCellTitle } from '../../ui/src/dom'
6
+ import { createColumn, getRowid } from './util'
7
+ import { getSlotVNs } from '../../ui/src/vn'
8
+
9
+ import type { VxeTableConstructor, VxeTableDefines, VxeTablePrivateMethods, VxeComponentSlotType } from '../../../types'
10
+
11
+ const { getConfig, getI18n, getIcon, renderer, renderEmptyElement } = VxeUI
12
+
13
+ function renderTitlePrefixIcon(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
14
+ const { $table, column } = params
15
+ const titlePrefix = column.titlePrefix || column.titleHelp
16
+ if (titlePrefix) {
17
+ return h(
18
+ 'span',
19
+ {
20
+ class: ['vxe-cell-title-prefix-icon', titlePrefix.iconStatus ? `theme--${titlePrefix.iconStatus}` : ''],
21
+ onMouseenter(evnt: MouseEvent) {
22
+ $table.triggerHeaderTitleEvent(evnt, titlePrefix, params)
23
+ },
24
+ onMouseleave(evnt: MouseEvent) {
25
+ $table.handleTargetLeaveEvent(evnt)
26
+ }
27
+ },
28
+ [
29
+ h('i', {
30
+ class: titlePrefix.icon || getIcon().TABLE_TITLE_PREFIX
31
+ })
32
+ ]
33
+ )
34
+ }
35
+ return renderEmptyElement($table)
36
+ }
37
+
38
+ function renderTitleSuffixIcon(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
39
+ const { $table, column } = params
40
+ const titleSuffix = column.titleSuffix
41
+ if (titleSuffix) {
42
+ return h(
43
+ 'span',
44
+ {
45
+ class: ['vxe-cell-title-suffix-icon', titleSuffix.iconStatus ? `theme--${titleSuffix.iconStatus}` : ''],
46
+ onMouseenter(evnt: MouseEvent) {
47
+ $table.triggerHeaderTitleEvent(evnt, titleSuffix, params)
48
+ },
49
+ onMouseleave(evnt: MouseEvent) {
50
+ $table.handleTargetLeaveEvent(evnt)
51
+ }
52
+ },
53
+ [
54
+ h('i', {
55
+ class: titleSuffix.icon || getIcon().TABLE_TITLE_SUFFIX
56
+ })
57
+ ]
58
+ )
59
+ }
60
+ return renderEmptyElement($table)
61
+ }
62
+
63
+ function renderCellDragIcon(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
64
+ const { $table, column } = params
65
+ const { context } = $table
66
+ const tableSlots = context.slots
67
+ const tableProps = $table.props
68
+ const { slots } = column
69
+ const { dragConfig } = tableProps
70
+ const { computeRowDragOpts } = $table.getComputeMaps()
71
+ const rowDragOpts = computeRowDragOpts.value
72
+ const { icon, trigger, disabledMethod } = rowDragOpts
73
+ const rDisabledMethod = disabledMethod || (dragConfig ? dragConfig.rowDisabledMethod : null)
74
+ const isDisabled = rDisabledMethod && rDisabledMethod(params)
75
+ const rowDragIconSlot = (slots ? slots.rowDragIcon || slots['row-drag-icon'] : null) || tableSlots.rowDragIcon || tableSlots['row-drag-icon']
76
+ const ons: Record<string, any> = {}
77
+ if (trigger !== 'cell') {
78
+ ons.onMousedown = (evnt: MouseEvent) => {
79
+ if (!isDisabled) {
80
+ $table.handleCellDragMousedownEvent(evnt, params)
81
+ }
82
+ }
83
+ ons.onMouseup = $table.handleCellDragMouseupEvent
84
+ }
85
+ return h(
86
+ 'span',
87
+ {
88
+ key: 'dg',
89
+ class: [
90
+ 'vxe-cell--drag-handle',
91
+ {
92
+ 'is--disabled': isDisabled
93
+ }
94
+ ],
95
+ ...ons
96
+ },
97
+ rowDragIconSlot
98
+ ? $table.callSlot(rowDragIconSlot, params)
99
+ : [
100
+ h('i', {
101
+ class: icon || (dragConfig ? dragConfig.rowIcon : '') || getIcon().TABLE_DRAG_ROW
102
+ })
103
+ ]
104
+ )
105
+ }
106
+
107
+ function renderCellBaseVNs(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, content: VxeComponentSlotType | VxeComponentSlotType[]) {
108
+ const { $table, column, level } = params
109
+ const { dragSort } = column
110
+ const tableProps = $table.props
111
+ const { treeConfig, dragConfig } = tableProps
112
+ const { computeRowOpts, computeRowDragOpts, computeTreeOpts } = $table.getComputeMaps()
113
+ const rowOpts = computeRowOpts.value
114
+ const rowDragOpts = computeRowDragOpts.value
115
+ const treeOpts = computeTreeOpts.value
116
+ const { showIcon, isPeerDrag, isCrossDrag, visibleMethod } = rowDragOpts
117
+ const rVisibleMethod = visibleMethod || (dragConfig ? dragConfig.rowVisibleMethod : null)
118
+ const vns: VxeComponentSlotType[] = []
119
+ if (dragSort && rowOpts.drag && (showIcon || (dragConfig ? dragConfig.showRowIcon : false)) && (!rVisibleMethod || rVisibleMethod(params))) {
120
+ if (treeConfig) {
121
+ if (treeOpts.transform && (isPeerDrag || isCrossDrag || !level)) {
122
+ vns.push(renderCellDragIcon(params))
123
+ }
124
+ } else {
125
+ vns.push(renderCellDragIcon(params))
126
+ }
127
+ }
128
+ return vns.concat(XEUtils.isArray(content) ? content : [content])
129
+ }
130
+
131
+ function renderHeaderCellDragIcon(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
132
+ const { $table, column } = params
133
+ const { context } = $table
134
+ const tableSlots = context.slots
135
+ const { slots } = column
136
+ const { computeColumnOpts, computeColumnDragOpts } = $table.getComputeMaps()
137
+ const columnOpts = computeColumnOpts.value
138
+ const columnDragOpts = computeColumnDragOpts.value
139
+ const { showIcon, icon, trigger, isPeerDrag, isCrossDrag, visibleMethod, disabledMethod } = columnDragOpts
140
+ if (columnOpts.drag && showIcon && (!visibleMethod || visibleMethod(params))) {
141
+ if (!column.fixed && (isPeerDrag || isCrossDrag || !column.parentId)) {
142
+ const isDisabled = disabledMethod && disabledMethod(params)
143
+ const columnDragIconSlot = (slots ? slots.columnDragIcon || slots['column-drag-icon'] : null) || tableSlots.columnDragIcon || tableSlots['column-drag-icon']
144
+ const ons: Record<string, any> = {}
145
+ if (trigger !== 'cell') {
146
+ ons.onMousedown = (evnt: MouseEvent) => {
147
+ if (!isDisabled) {
148
+ $table.handleHeaderCellDragMousedownEvent(evnt, params)
149
+ }
150
+ }
151
+ ons.onMouseup = $table.handleHeaderCellDragMouseupEvent
152
+ }
153
+ return h(
154
+ 'span',
155
+ {
156
+ key: 'dg',
157
+ class: [
158
+ 'vxe-cell--drag-handle',
159
+ {
160
+ 'is--disabled': isDisabled
161
+ }
162
+ ],
163
+ ...ons
164
+ },
165
+ columnDragIconSlot
166
+ ? $table.callSlot(columnDragIconSlot, params)
167
+ : [
168
+ h('i', {
169
+ class: icon || getIcon().TABLE_DRAG_COLUMN
170
+ })
171
+ ]
172
+ )
173
+ }
174
+ }
175
+ return renderEmptyElement($table)
176
+ }
177
+
178
+ function renderHeaderCellBaseVNs(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, content: VNode | VNode[]) {
179
+ const vns = [renderTitlePrefixIcon(params), renderHeaderCellDragIcon(params), ...(XEUtils.isArray(content) ? content : [content]), renderTitleSuffixIcon(params)]
180
+ return vns
181
+ }
182
+
183
+ function getRenderDefaultColumnTitle(column: VxeTableDefines.ColumnInfo, content: VxeComponentSlotType | VxeComponentSlotType[]) {
184
+ if (column.type === 'html' && XEUtils.isString(content)) {
185
+ return h('span', {
186
+ key: 'ch',
187
+ innerHTML: content
188
+ })
189
+ }
190
+ return h(
191
+ 'span',
192
+ {
193
+ key: 'ct'
194
+ },
195
+ getSlotVNs(content)
196
+ )
197
+ }
198
+
199
+ function renderTitleContent(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, content: VxeComponentSlotType | VxeComponentSlotType[]) {
200
+ const { $table, column } = params
201
+ const tableProps = $table.props
202
+ const tableReactData = $table.reactData
203
+ const { computeHeaderTooltipOpts } = $table.getComputeMaps()
204
+ const { showHeaderOverflow: allColumnHeaderOverflow } = tableProps
205
+ const { isRowGroupStatus } = tableReactData
206
+ const { showHeaderOverflow, slots } = column
207
+ const titleSlot = slots ? slots.title : null
208
+ const headerTooltipOpts = computeHeaderTooltipOpts.value
209
+ const showAllTip = headerTooltipOpts.showAll
210
+ const headOverflow = XEUtils.eqNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow
211
+ const showTitle = (headOverflow === true ? headerTooltipOpts.mode : headOverflow) === 'title'
212
+ const showTooltip = (headOverflow === true ? headerTooltipOpts.mode : headOverflow) === 'tooltip'
213
+ const ons: Record<string, any> = {}
214
+ if (showTitle || showTooltip || showAllTip) {
215
+ ons.onMouseenter = (evnt: MouseEvent) => {
216
+ if (tableReactData.isDragResize) {
217
+ return
218
+ }
219
+ if (showTitle) {
220
+ updateCellTitle(evnt.currentTarget, column)
221
+ } else if (showTooltip || showAllTip) {
222
+ $table.triggerHeaderTooltipEvent(evnt, params)
223
+ }
224
+ }
225
+ }
226
+ if (showTooltip || showAllTip) {
227
+ ons.onMouseleave = (evnt: MouseEvent) => {
228
+ if (tableReactData.isDragResize) {
229
+ return
230
+ }
231
+ if (showTooltip || showAllTip) {
232
+ $table.handleTargetLeaveEvent(evnt)
233
+ }
234
+ }
235
+ }
236
+ const titleVN = getRenderDefaultColumnTitle(column, content)
237
+ return [
238
+ h(
239
+ 'span',
240
+ {
241
+ class: 'vxe-cell--title',
242
+ ...ons
243
+ },
244
+ isRowGroupStatus && column.aggFunc && $table.getPivotTableAggregateRenderColTitles ? $table.getPivotTableAggregateRenderColTitles(column, titleVN) : titleSlot ? $table.callSlot(titleSlot, params) : [titleVN]
245
+ )
246
+ ]
247
+ }
248
+
249
+ function getFooterContent(params: VxeTableDefines.CellRenderFooterParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
250
+ const { $table, column, row } = params
251
+ const tableProps = $table.props
252
+ const { editConfig } = tableProps
253
+ const { slots, editRender, cellRender } = column
254
+ const footerSlot = slots ? slots.footer : null
255
+ if (footerSlot) {
256
+ return $table.callSlot(footerSlot, params)
257
+ }
258
+ const isEnableEdit = editConfig && isEnableConf(editConfig)
259
+ const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
260
+ const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null
261
+ const renderOpts = editRenderOpts || cellRenderOpts
262
+ const itemValue = $table.getFooterCellLabel(row, column)
263
+ if (renderOpts) {
264
+ const { computeRendererOpts } = $table.getComputeMaps()
265
+ const rendererOpts = computeRendererOpts.value
266
+ const compConf = renderOpts.name ? rendererOpts[renderOpts.name] || renderer.get(renderOpts.name) : null
267
+ if (compConf) {
268
+ const rtFooter = compConf.renderTableFooter || compConf.renderFooter
269
+ if (rtFooter) {
270
+ const footParams = Object.assign(params, {
271
+ cellValue: itemValue,
272
+ itemValue
273
+ })
274
+ return getSlotVNs(rtFooter(renderOpts, footParams))
275
+ }
276
+ }
277
+ }
278
+ return [
279
+ h(
280
+ 'span',
281
+ {
282
+ class: 'vxe-cell--label'
283
+ },
284
+ formatText(itemValue, 1)
285
+ )
286
+ ]
287
+ }
288
+
289
+ function getDefaultCellLabel(params: VxeTableDefines.CellRenderBodyParams) {
290
+ const { $table, row, column } = params
291
+ return formatText($table.getCellLabel(row, column), 1)
292
+ }
293
+
294
+ function renderCellHandle(
295
+ params: VxeTableDefines.CellRenderBodyParams & {
296
+ $table: VxeTableConstructor & VxeTablePrivateMethods
297
+ }
298
+ ) {
299
+ const { column, row, $table } = params
300
+ const tableProps = $table.props
301
+ const tableReactData = $table.reactData
302
+ const { isRowGroupStatus } = tableReactData
303
+ const { editConfig } = tableProps
304
+ const { type, treeNode, rowGroupNode, editRender } = column
305
+ const { computeEditOpts, computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps()
306
+ const aggregateOpts = computeAggregateOpts.value
307
+ const { mode } = aggregateOpts
308
+ const checkboxOpts = computeCheckboxOpts.value
309
+ const editOpts = computeEditOpts.value
310
+ const isDeepCell = treeNode || (isRowGroupStatus && (mode === 'column' ? column.field === row.groupField : rowGroupNode))
311
+ switch (type) {
312
+ case 'seq':
313
+ return isDeepCell ? Cell.renderDeepIndexCell(params) : Cell.renderSeqCell(params)
314
+ case 'radio':
315
+ return isDeepCell ? Cell.renderDeepRadioCell(params) : Cell.renderRadioCell(params)
316
+ case 'checkbox':
317
+ return checkboxOpts.checkField ? (isDeepCell ? Cell.renderDeepSelectionCellByProp(params) : Cell.renderCheckboxCellByProp(params)) : isDeepCell ? Cell.renderDeepSelectionCell(params) : Cell.renderCheckboxCell(params)
318
+ case 'expand':
319
+ return Cell.renderExpandCell(params)
320
+ case 'html':
321
+ return isDeepCell ? Cell.renderDeepHTMLCell(params) : Cell.renderHTMLCell(params)
322
+ }
323
+ const isEnableEdit = editConfig && isEnableConf(editConfig)
324
+ const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
325
+ if (editRenderOpts) {
326
+ return editOpts.mode === 'cell' ? (isDeepCell ? Cell.renderDeepCellEdit(params) : Cell.renderCellEdit(params)) : isDeepCell ? Cell.renderDeepRowEdit(params) : Cell.renderRowEdit(params)
327
+ }
328
+ return isDeepCell ? Cell.renderDeepCell(params) : Cell.renderDefaultCell(params)
329
+ }
330
+
331
+ function renderHeaderHandle(
332
+ params: VxeTableDefines.CellRenderHeaderParams & {
333
+ $table: VxeTableConstructor & VxeTablePrivateMethods
334
+ }
335
+ ) {
336
+ const { column, $table } = params
337
+ const tableProps = $table.props
338
+ const { editConfig } = tableProps
339
+ const { type, filters, sortable, editRender, slots } = column
340
+
341
+ // 兼容已废弃方式
342
+ if (getConfig().tableHeadeSlotToTitleSlot !== 'obsolete') {
343
+ const headerSlot = slots ? slots.header : null
344
+ if (headerSlot) {
345
+ return renderTitleContent(params, $table.callSlot(headerSlot, params))
346
+ }
347
+ }
348
+
349
+ switch (type) {
350
+ case 'seq':
351
+ return Cell.renderSeqHeader(params)
352
+ case 'radio':
353
+ return Cell.renderRadioHeader(params)
354
+ case 'checkbox':
355
+ return Cell.renderCheckboxHeader(params)
356
+ case 'html':
357
+ if (filters && sortable) {
358
+ return Cell.renderSortAndFilterHeader(params)
359
+ } else if (sortable) {
360
+ return Cell.renderSortHeader(params)
361
+ } else if (filters) {
362
+ return Cell.renderFilterHeader(params)
363
+ }
364
+ break
365
+ }
366
+ const isEnableEdit = editConfig && isEnableConf(editConfig)
367
+ const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
368
+ if (editRenderOpts) {
369
+ return Cell.renderEditHeader(params)
370
+ } else if (filters && sortable) {
371
+ return Cell.renderSortAndFilterHeader(params)
372
+ } else if (sortable) {
373
+ return Cell.renderSortHeader(params)
374
+ } else if (filters) {
375
+ return Cell.renderFilterHeader(params)
376
+ }
377
+ return Cell.renderDefaultHeader(params)
378
+ }
379
+
380
+ function renderFooterHandle(
381
+ params: VxeTableDefines.CellRenderFooterParams & {
382
+ $table: VxeTableConstructor & VxeTablePrivateMethods
383
+ }
384
+ ) {
385
+ return Cell.renderDefaultFooter(params)
386
+ }
387
+
388
+ export const Cell = {
389
+ createColumn($xeTable: VxeTableConstructor & VxeTablePrivateMethods, columnOpts: VxeTableDefines.ColumnOptions | VxeTableDefines.ColumnInfo) {
390
+ const { type } = columnOpts
391
+ const renConfs: any = {
392
+ renderHeader: renderHeaderHandle,
393
+ renderCell: renderCellHandle,
394
+ renderFooter: renderFooterHandle
395
+ }
396
+ if (type === 'expand') {
397
+ renConfs.renderData = Cell.renderExpandData
398
+ }
399
+ return createColumn($xeTable, columnOpts, renConfs)
400
+ },
401
+ /**
402
+ * 列头标题
403
+ */
404
+ renderHeaderTitle(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
405
+ const { $table, column } = params
406
+ const tableProps = $table.props
407
+ const { editConfig } = tableProps
408
+ const { slots, editRender, cellRender } = column
409
+ const isEnableEdit = editConfig && isEnableConf(editConfig)
410
+ const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
411
+ const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null
412
+ const renderOpts = editRenderOpts || cellRenderOpts
413
+
414
+ // 兼容已废弃方式
415
+ if (getConfig().tableHeadeSlotToTitleSlot === 'obsolete') {
416
+ const headerSlot = slots ? slots.header : null
417
+ if (headerSlot) {
418
+ return renderTitleContent(params, $table.callSlot(headerSlot, params))
419
+ }
420
+ }
421
+
422
+ if (renderOpts) {
423
+ const { computeRendererOpts } = $table.getComputeMaps()
424
+ const rendererOpts = computeRendererOpts.value
425
+ const compConf = renderOpts.name ? rendererOpts[renderOpts.name] || renderer.get(renderOpts.name) : null
426
+ if (compConf) {
427
+ const rtHeader = compConf.renderTableHeader || compConf.renderHeader
428
+ if (rtHeader) {
429
+ return renderTitleContent(params, getSlotVNs(rtHeader(renderOpts, params)))
430
+ }
431
+ }
432
+ }
433
+ return renderTitleContent(params, $table.getHeaderCellLabel(column))
434
+ },
435
+ renderDefaultHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
436
+ return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params))
437
+ },
438
+ renderDefaultCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
439
+ const { $table, row, column } = params
440
+ const tableProps = $table.props
441
+ const tableReactData = $table.reactData
442
+ const tableInternalData = $table.internalData
443
+ const { isRowGroupStatus } = tableReactData
444
+ const { editConfig } = tableProps
445
+ const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column
446
+ const isEnableEdit = editConfig && isEnableConf(editConfig)
447
+ const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
448
+ const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null
449
+ const defaultSlot = slots ? slots.default : null
450
+ const gcSlot = slots ? slots.groupContent || slots['group-content'] : null
451
+ const gvSlot = slots ? slots.groupValues || slots['group-values'] : null
452
+ let cellValue: string | number | null = ''
453
+ if (isRowGroupStatus && field && row.isAggregate) {
454
+ const aggRow: VxeTableDefines.AggregateRowInfo = row
455
+ const { fullColumnFieldData } = tableInternalData
456
+ const { computeAggregateOpts } = $table.getComputeMaps()
457
+ const aggregateOpts = computeAggregateOpts.value
458
+ const { mode, showTotal, totalMethod, countFields, contentMethod, formatValuesMethod, mapChildrenField } = aggregateOpts
459
+ const aggData = aggRow.aggData
460
+ const currAggData = aggData ? aggData[field] : null
461
+ const groupField = aggRow.groupField
462
+ const groupContent = aggRow.groupContent
463
+ const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : []
464
+ const childCount = aggRow.childCount
465
+ const colRest = fullColumnFieldData[groupField] || {}
466
+ const ctParams = {
467
+ $table,
468
+ groupField,
469
+ groupColumn: (colRest ? colRest.column : null) as VxeTableDefines.ColumnInfo,
470
+ column,
471
+ groupValue: groupContent,
472
+ childList,
473
+ childCount,
474
+ aggValue: null as any,
475
+
476
+ /**
477
+ * 已废弃
478
+ * @deprecated
479
+ */
480
+ children: childList,
481
+ /**
482
+ * 已废弃
483
+ * @deprecated
484
+ */
485
+ totalValue: childCount
486
+ }
487
+ if (mode === 'column' ? field === aggRow.groupField : rowGroupNode) {
488
+ cellValue = groupContent
489
+ if (contentMethod) {
490
+ cellValue = `${contentMethod(ctParams)}`
491
+ }
492
+ if (showTotal) {
493
+ cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount])
494
+ }
495
+ if (gcSlot) {
496
+ return renderCellBaseVNs(params, $table.callSlot(gcSlot, Object.assign({ groupField, groupContent, childList, childCount }, params)))
497
+ }
498
+ } else if ($table.getPivotTableAggregateCellAggValue) {
499
+ cellValue = $table.getPivotTableAggregateCellAggValue(params)
500
+ ctParams.aggValue = cellValue
501
+ if (gvSlot) {
502
+ return renderCellBaseVNs(params, $table.callSlot(gvSlot, Object.assign({ groupField, groupContent, childList, childCount }, params, ctParams)))
503
+ }
504
+ } else if (aggFunc === true || (countFields && countFields.includes(field))) {
505
+ cellValue = currAggData ? currAggData.value : childCount
506
+ ctParams.aggValue = cellValue
507
+ if (formatValuesMethod) {
508
+ cellValue = formatValuesMethod(ctParams)
509
+ }
510
+ if (gvSlot) {
511
+ return renderCellBaseVNs(params, $table.callSlot(gvSlot, Object.assign({ groupField, groupContent, childList, childCount }, params, ctParams)))
512
+ }
513
+ }
514
+ } else {
515
+ if (defaultSlot) {
516
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params))
517
+ }
518
+ const { computeRendererOpts } = $table.getComputeMaps()
519
+ const rendererOpts = computeRendererOpts.value
520
+ // 如果是编辑模式-查看:slot default > formatter > cellRender.renderTableDefault > editRender.renderTableCell > editRender.renderTableDefault > cellRender.tableCellFormatter > editRender.tableCellFormatter > field
521
+ // 如果是查看表格:slot default > formatter > cellRender.renderTableDefault > cellRender.tableCellFormatter > field
522
+ const cellCompConf = cellRenderOpts && cellRenderOpts.name ? rendererOpts[cellRenderOpts.name] || renderer.get(cellRenderOpts.name) : null
523
+ if (cellRenderOpts) {
524
+ const cellDefaultRenderFn = cellCompConf ? cellCompConf.renderTableDefault || cellCompConf.renderDefault : null
525
+ if (cellDefaultRenderFn && cellRenderOpts) {
526
+ return renderCellBaseVNs(params, getSlotVNs(cellDefaultRenderFn(cellRenderOpts, Object.assign({ $type: editRenderOpts ? 'edit' : 'cell' }, params))))
527
+ }
528
+ }
529
+ if (editRenderOpts) {
530
+ const editCompConf = editRenderOpts && editRenderOpts.name ? rendererOpts[editRenderOpts.name] || renderer.get(editRenderOpts.name) : null
531
+ const editCellRenderFn = editCompConf ? editCompConf.renderTableCell || editCompConf.renderCell || editCompConf.renderTableDefault || editCompConf.renderDefault : null
532
+ if (editCellRenderFn) {
533
+ return renderCellBaseVNs(params, getSlotVNs(editCellRenderFn(editRenderOpts, Object.assign({ $type: editRenderOpts ? 'edit' : 'cell' }, params))))
534
+ }
535
+ }
536
+
537
+ // 如果是编辑模式-查看:cellRender.tableCellFormatter > editRender.tableCellFormatter > field
538
+ // 如果是查看表格:cellRender.tableCellFormatter > field
539
+ cellValue = $table.getCellLabel(row, column)
540
+ }
541
+ const cellPlaceholder = editRenderOpts ? editRenderOpts.placeholder : ''
542
+ return renderCellBaseVNs(params, [
543
+ h(
544
+ 'span',
545
+ {
546
+ class: 'vxe-cell--label'
547
+ },
548
+ [
549
+ // 如果设置占位符
550
+ editRenderOpts && eqEmptyValue(cellValue)
551
+ ? h(
552
+ 'span',
553
+ {
554
+ class: 'vxe-cell--placeholder'
555
+ },
556
+ formatText(getFuncText(cellPlaceholder), 1)
557
+ )
558
+ : h('span', formatText(cellValue, 1))
559
+ ]
560
+ )
561
+ ])
562
+ },
563
+ renderDeepCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
564
+ return Cell.renderDeepNodeBtn(params, Cell.renderDefaultCell(params) as VNode[])
565
+ },
566
+ renderDefaultFooter(params: VxeTableDefines.CellRenderFooterParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
567
+ return getFooterContent(params)
568
+ },
569
+
570
+ /**
571
+ * 行分组
572
+ */
573
+ renderRowGroupBtn(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
574
+ const { $table } = params
575
+ const tableReactData = $table.reactData
576
+ const tableInternalData = $table.internalData
577
+ const { row, level } = params
578
+ const { computeAggregateOpts } = $table.getComputeMaps()
579
+ const { rowGroupExpandedFlag } = tableReactData
580
+ const { rowGroupExpandedMaps } = tableInternalData
581
+ const aggregateOpts = computeAggregateOpts.value
582
+ const { mode, padding, indent, showIcon, iconOpen, iconClose } = aggregateOpts
583
+ const rowid = getRowid($table, row)
584
+ const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid]
585
+ return h(
586
+ 'div',
587
+ {
588
+ class: [
589
+ 'vxe-row-group--tree-node',
590
+ {
591
+ 'is--expanded': isExpand
592
+ }
593
+ ],
594
+ style:
595
+ mode !== 'column' && padding && indent
596
+ ? {
597
+ paddingLeft: `${level * indent}px`
598
+ }
599
+ : undefined
600
+ },
601
+ [
602
+ showIcon && row.isAggregate
603
+ ? h(
604
+ 'span',
605
+ {
606
+ class: 'vxe-row-group--node-btn',
607
+ onClick(evnt: MouseEvent) {
608
+ $table.triggerRowGroupExpandEvent(evnt, params)
609
+ }
610
+ },
611
+ [
612
+ h('i', {
613
+ class: isExpand ? iconOpen || getIcon().TABLE_ROW_GROUP_OPEN : iconClose || getIcon().TABLE_ROW_GROUP_CLOSE
614
+ })
615
+ ]
616
+ )
617
+ : renderEmptyElement($table),
618
+ h(
619
+ 'div',
620
+ {
621
+ class: 'vxe-row-group-cell'
622
+ },
623
+ cellVNodes
624
+ )
625
+ ]
626
+ )
627
+ },
628
+ /**
629
+ * 树
630
+ */
631
+ renderTreeNodeBtn(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
632
+ const { $table, isHidden } = params
633
+ const tableReactData = $table.reactData
634
+ const tableInternalData = $table.internalData
635
+ const { row, column, level } = params
636
+ const { slots } = column
637
+ const iconSlot = slots ? slots.icon : null
638
+ if (iconSlot) {
639
+ return $table.callSlot(iconSlot, params)
640
+ }
641
+ const { computeTreeOpts } = $table.getComputeMaps()
642
+ const { treeExpandedFlag } = tableReactData
643
+ const { fullAllDataRowIdData, treeExpandedMaps, treeExpandLazyLoadedMaps } = tableInternalData
644
+ const treeOpts = computeTreeOpts.value
645
+ const { padding, indent, lazy, trigger, visibleMethod, iconLoaded, showIcon, iconOpen, iconClose } = treeOpts
646
+ const childrenField = treeOpts.children || treeOpts.childrenField
647
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
648
+ const rowChilds = row[childrenField]
649
+ const hasChild = rowChilds && rowChilds.length
650
+ let hasLazyChilds = false
651
+ let isActive = false
652
+ let isLazyLoading = false
653
+ let isLazyLoaded = false
654
+ const ons: Record<string, any> = {}
655
+ if (!isHidden) {
656
+ const rowid = getRowid($table, row)
657
+ isActive = !!treeExpandedFlag && !!treeExpandedMaps[rowid]
658
+ if (lazy) {
659
+ const rest = fullAllDataRowIdData[rowid]
660
+ isLazyLoading = !!treeExpandLazyLoadedMaps[rowid]
661
+ hasLazyChilds = row[hasChildField]
662
+ isLazyLoaded = !!rest.treeLoaded
663
+ }
664
+ }
665
+ if (!trigger || trigger === 'default') {
666
+ ons.onClick = (evnt: MouseEvent) => {
667
+ $table.triggerTreeExpandEvent(evnt, params)
668
+ }
669
+ }
670
+ return h(
671
+ 'div',
672
+ {
673
+ class: [
674
+ 'vxe-cell--tree-node',
675
+ {
676
+ 'is--active': isActive
677
+ }
678
+ ],
679
+ style:
680
+ padding && indent
681
+ ? {
682
+ paddingLeft: `${level * indent}px`
683
+ }
684
+ : undefined
685
+ },
686
+ [
687
+ showIcon && (lazy ? (isLazyLoaded ? hasChild : hasChild || hasLazyChilds) : hasChild) && (!visibleMethod || visibleMethod(params))
688
+ ? [
689
+ h(
690
+ 'div',
691
+ {
692
+ class: 'vxe-cell--tree-btn',
693
+ ...ons
694
+ },
695
+ [
696
+ h('i', {
697
+ class: isLazyLoading ? iconLoaded || getIcon().TABLE_TREE_LOADED : isActive ? iconOpen || getIcon().TABLE_TREE_OPEN : iconClose || getIcon().TABLE_TREE_CLOSE
698
+ })
699
+ ]
700
+ )
701
+ ]
702
+ : null,
703
+ h(
704
+ 'div',
705
+ {
706
+ class: 'vxe-tree-cell'
707
+ },
708
+ cellVNodes
709
+ )
710
+ ]
711
+ )
712
+ },
713
+ /**
714
+ * 层级节点。
715
+ * 行分组、树结构
716
+ */
717
+ renderDeepNodeBtn(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
718
+ const { $table, row, column } = params
719
+ const { rowGroupNode } = column
720
+ const tableReactData = $table.reactData
721
+ const { rowGroupList } = tableReactData
722
+ if (rowGroupList.length) {
723
+ const { computeAggregateOpts } = $table.getComputeMaps()
724
+ const aggregateOpts = computeAggregateOpts.value
725
+ const { mode } = aggregateOpts
726
+ if (mode === 'column') {
727
+ if (row.groupField && column.field === row.groupField) {
728
+ return [Cell.renderRowGroupBtn(params, cellVNodes)]
729
+ }
730
+ return cellVNodes
731
+ } else if (rowGroupNode) {
732
+ return [Cell.renderRowGroupBtn(params, cellVNodes)]
733
+ }
734
+ }
735
+ return [Cell.renderTreeNodeBtn(params, cellVNodes)]
736
+ },
737
+
738
+ /**
739
+ * 序号
740
+ */
741
+ renderSeqHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
742
+ const { $table, column } = params
743
+
744
+ // 兼容已废弃方式
745
+ if (getConfig().tableHeadeSlotToTitleSlot === 'obsolete') {
746
+ const { slots } = column
747
+ const headerSlot = slots ? slots.header : null
748
+ return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : $table.getHeaderCellLabel(column)))
749
+ }
750
+
751
+ return renderHeaderCellBaseVNs(params, renderTitleContent(params, $table.getHeaderCellLabel(column)))
752
+ },
753
+ renderSeqCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
754
+ const { $table, column } = params
755
+ const tableProps = $table.props
756
+ const { treeConfig } = tableProps
757
+ const { computeSeqOpts } = $table.getComputeMaps()
758
+ const seqOpts = computeSeqOpts.value
759
+ const { slots } = column
760
+ const defaultSlot = slots ? slots.default : null
761
+ if (defaultSlot) {
762
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params))
763
+ }
764
+ const { seq } = params
765
+ const seqMd = seqOpts.seqMethod
766
+ return renderCellBaseVNs(params, [h('span', `${formatText(seqMd ? seqMd(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + (seq as number), 1)}`)])
767
+ },
768
+ renderDeepIndexCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
769
+ return Cell.renderDeepNodeBtn(params, Cell.renderSeqCell(params) as VNode[])
770
+ },
771
+
772
+ /**
773
+ * 单选
774
+ */
775
+ renderRadioHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
776
+ const { $table, column } = params
777
+ const { slots } = column
778
+ const titleSlot = slots ? slots.title : null
779
+
780
+ // 兼容已废弃方式
781
+ if (getConfig().tableHeadeSlotToTitleSlot === 'obsolete') {
782
+ const headerSlot = slots ? slots.header : null
783
+ return renderHeaderCellBaseVNs(
784
+ params,
785
+ renderTitleContent(
786
+ params,
787
+ headerSlot
788
+ ? $table.callSlot(headerSlot, params)
789
+ : [
790
+ h(
791
+ 'span',
792
+ {
793
+ class: 'vxe-radio--label'
794
+ },
795
+ titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column)
796
+ )
797
+ ]
798
+ )
799
+ )
800
+ }
801
+
802
+ return renderHeaderCellBaseVNs(
803
+ params,
804
+ renderTitleContent(params, [
805
+ h(
806
+ 'span',
807
+ {
808
+ class: 'vxe-radio--label'
809
+ },
810
+ titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column)
811
+ )
812
+ ])
813
+ )
814
+ },
815
+ renderRadioCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
816
+ const { $table, column, isHidden } = params
817
+ const tableReactData = $table.reactData
818
+ const { computeRadioOpts } = $table.getComputeMaps()
819
+ const { selectRadioRow } = tableReactData
820
+ const radioOpts = computeRadioOpts.value
821
+ const { slots } = column
822
+ const { labelField, checkMethod, visibleMethod } = radioOpts
823
+ const { row } = params
824
+ const defaultSlot = slots ? slots.default : null
825
+ const radioSlot = slots ? slots.radio : null
826
+ const isChecked = $table.eqRow(row, selectRadioRow)
827
+ const isVisible = !visibleMethod || visibleMethod({ $table, row })
828
+ let isDisabled = !!checkMethod
829
+ let ons
830
+ if (!isHidden) {
831
+ ons = {
832
+ onClick(evnt: Event) {
833
+ if (!isDisabled && isVisible) {
834
+ $table.triggerRadioRowEvent(evnt, params)
835
+ }
836
+ }
837
+ }
838
+ if (checkMethod) {
839
+ isDisabled = !checkMethod({ $table, row })
840
+ }
841
+ }
842
+ const radioParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible }
843
+ if (radioSlot) {
844
+ return renderCellBaseVNs(params, $table.callSlot(radioSlot, radioParams))
845
+ }
846
+ const radioVNs: VNode[] = []
847
+ if (isVisible) {
848
+ radioVNs.push(
849
+ h('span', {
850
+ class: ['vxe-radio--icon', isChecked ? getIcon().TABLE_RADIO_CHECKED : isDisabled ? getIcon().TABLE_RADIO_DISABLED_UNCHECKED : getIcon().TABLE_RADIO_UNCHECKED]
851
+ })
852
+ )
853
+ }
854
+ if (defaultSlot || labelField) {
855
+ radioVNs.push(
856
+ h(
857
+ 'span',
858
+ {
859
+ class: 'vxe-radio--label'
860
+ },
861
+ defaultSlot ? $table.callSlot(defaultSlot, radioParams) : XEUtils.get(row, labelField as string)
862
+ )
863
+ )
864
+ }
865
+ return renderCellBaseVNs(params, [
866
+ h(
867
+ 'span',
868
+ {
869
+ class: [
870
+ 'vxe-cell--radio',
871
+ {
872
+ 'is--checked': isChecked,
873
+ 'is--disabled': isDisabled
874
+ }
875
+ ],
876
+ ...ons
877
+ },
878
+ radioVNs
879
+ )
880
+ ])
881
+ },
882
+ renderDeepRadioCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
883
+ return Cell.renderDeepNodeBtn(params, Cell.renderRadioCell(params))
884
+ },
885
+
886
+ /**
887
+ * 多选
888
+ */
889
+ renderCheckboxHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
890
+ const { $table, column, isHidden } = params
891
+ const tableReactData = $table.reactData
892
+ const { computeIsAllCheckboxDisabled, computeCheckboxOpts } = $table.getComputeMaps()
893
+ const { isAllSelected: isAllCheckboxSelected, isIndeterminate: isAllCheckboxIndeterminate } = tableReactData
894
+ const isAllCheckboxDisabled = computeIsAllCheckboxDisabled.value
895
+ const { slots } = column
896
+ const titleSlot = slots ? slots.title : null
897
+ const checkboxOpts = computeCheckboxOpts.value
898
+ const { checkStrictly, showHeader, headerTitle } = checkboxOpts
899
+ const colTitle = $table.getHeaderCellLabel(column)
900
+ const ons: Record<string, any> = {}
901
+ if (!isHidden) {
902
+ ons.onClick = (evnt: MouseEvent) => {
903
+ if (!isAllCheckboxDisabled) {
904
+ $table.triggerCheckAllEvent(evnt, !isAllCheckboxSelected)
905
+ }
906
+ }
907
+ }
908
+ const checkboxParams = { ...params, checked: isAllCheckboxSelected, disabled: isAllCheckboxDisabled, indeterminate: isAllCheckboxIndeterminate }
909
+
910
+ // 兼容已废弃方式
911
+ if (getConfig().tableHeadeSlotToTitleSlot === 'obsolete') {
912
+ const headerSlot = slots ? slots.header : null
913
+ if (headerSlot) {
914
+ return renderHeaderCellBaseVNs(params, renderTitleContent(checkboxParams, $table.callSlot(headerSlot, checkboxParams)))
915
+ }
916
+ }
917
+
918
+ if (checkStrictly ? !showHeader : showHeader === false) {
919
+ return renderHeaderCellBaseVNs(
920
+ params,
921
+ renderTitleContent(checkboxParams, [
922
+ h(
923
+ 'span',
924
+ {
925
+ class: 'vxe-checkbox--label'
926
+ },
927
+ titleSlot ? $table.callSlot(titleSlot, checkboxParams) : colTitle
928
+ )
929
+ ])
930
+ )
931
+ }
932
+ return renderHeaderCellBaseVNs(
933
+ params,
934
+ renderTitleContent(checkboxParams, [
935
+ h(
936
+ 'span',
937
+ {
938
+ class: [
939
+ 'vxe-cell--checkbox',
940
+ {
941
+ 'is--checked': isAllCheckboxSelected,
942
+ 'is--disabled': isAllCheckboxDisabled,
943
+ 'is--indeterminate': isAllCheckboxIndeterminate
944
+ }
945
+ ],
946
+ title: XEUtils.eqNull(headerTitle) ? getI18n('vxe.table.allTitle') : `${headerTitle || ''}`,
947
+ ...ons
948
+ },
949
+ [
950
+ h('span', {
951
+ class: ['vxe-checkbox--icon', isAllCheckboxIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllCheckboxSelected ? getIcon().TABLE_CHECKBOX_CHECKED : isAllCheckboxDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
952
+ })
953
+ ].concat(
954
+ titleSlot || colTitle
955
+ ? [
956
+ h(
957
+ 'span',
958
+ {
959
+ class: 'vxe-checkbox--label'
960
+ },
961
+ titleSlot ? $table.callSlot(titleSlot, checkboxParams) : colTitle
962
+ )
963
+ ]
964
+ : []
965
+ )
966
+ )
967
+ ])
968
+ )
969
+ },
970
+ renderCheckboxCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
971
+ const { $table, row, column, isHidden } = params
972
+ const tableProps = $table.props
973
+ const tableReactData = $table.reactData
974
+ const tableInternalData = $table.internalData
975
+ const { treeConfig } = tableProps
976
+ const { updateCheckboxFlag, isRowGroupStatus } = tableReactData
977
+ const { selectCheckboxMaps, treeIndeterminateRowMaps } = tableInternalData
978
+ const { computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps()
979
+ const aggregateOpts = computeAggregateOpts.value
980
+ const { mapChildrenField } = aggregateOpts
981
+ const checkboxOpts = computeCheckboxOpts.value
982
+ const { labelField, checkMethod, visibleMethod } = checkboxOpts
983
+ const { slots } = column
984
+ const defaultSlot = slots ? slots.default : null
985
+ const checkboxSlot = slots ? slots.checkbox : null
986
+ let indeterminate = false
987
+ let isChecked = false
988
+ let isVisible = true
989
+ let isDisabled = false
990
+ const ons: Record<string, any> = {}
991
+ if (!isHidden) {
992
+ const rowid = getRowid($table, row)
993
+ isChecked = !!updateCheckboxFlag && !!selectCheckboxMaps[rowid]
994
+ if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
995
+ const childList: any[] = row[mapChildrenField || '']
996
+ if (!childList || !childList.length || childList.every((item) => !checkMethod({ $table, row: item }))) {
997
+ isDisabled = true
998
+ }
999
+ } else {
1000
+ isVisible = !visibleMethod || visibleMethod({ $table, row })
1001
+ isDisabled = checkMethod ? !checkMethod({ $table, row }) : !!checkMethod
1002
+ }
1003
+ if (treeConfig || isRowGroupStatus) {
1004
+ indeterminate = !!treeIndeterminateRowMaps[rowid]
1005
+ }
1006
+ ons.onClick = (evnt: MouseEvent) => {
1007
+ if (!isDisabled && isVisible) {
1008
+ $table.triggerCheckRowEvent(evnt, params, !isChecked)
1009
+ }
1010
+ }
1011
+ }
1012
+ const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate }
1013
+ if (checkboxSlot) {
1014
+ return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams))
1015
+ }
1016
+ const checkVNs: VNode[] = []
1017
+ if (isVisible) {
1018
+ checkVNs.push(
1019
+ h('span', {
1020
+ class: ['vxe-checkbox--icon', indeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : isDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
1021
+ })
1022
+ )
1023
+ }
1024
+ if (defaultSlot || labelField) {
1025
+ checkVNs.push(
1026
+ h(
1027
+ 'span',
1028
+ {
1029
+ class: 'vxe-checkbox--label'
1030
+ },
1031
+ defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField as string)
1032
+ )
1033
+ )
1034
+ }
1035
+ return renderCellBaseVNs(params, [
1036
+ h(
1037
+ 'span',
1038
+ {
1039
+ class: [
1040
+ 'vxe-cell--checkbox',
1041
+ {
1042
+ 'is--checked': isChecked,
1043
+ 'is--disabled': isDisabled,
1044
+ 'is--indeterminate': indeterminate,
1045
+ 'is--hidden': !isVisible
1046
+ }
1047
+ ],
1048
+ ...ons
1049
+ },
1050
+ checkVNs
1051
+ )
1052
+ ])
1053
+ },
1054
+ renderDeepSelectionCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1055
+ return Cell.renderDeepNodeBtn(params, Cell.renderCheckboxCell(params))
1056
+ },
1057
+ renderCheckboxCellByProp(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1058
+ const { $table, row, column, isHidden } = params
1059
+ const tableProps = $table.props
1060
+ const tableReactData = $table.reactData
1061
+ const tableInternalData = $table.internalData
1062
+ const { treeConfig } = tableProps
1063
+ const { updateCheckboxFlag, isRowGroupStatus } = tableReactData
1064
+ const { treeIndeterminateRowMaps } = tableInternalData
1065
+ const { computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps()
1066
+ const aggregateOpts = computeAggregateOpts.value
1067
+ const { mapChildrenField } = aggregateOpts
1068
+ const checkboxOpts = computeCheckboxOpts.value
1069
+ const { labelField, checkField, checkMethod, visibleMethod } = checkboxOpts
1070
+ const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
1071
+ const { slots } = column
1072
+ const defaultSlot = slots ? slots.default : null
1073
+ const checkboxSlot = slots ? slots.checkbox : null
1074
+ let indeterminate = false
1075
+ let isChecked = false
1076
+ let isVisible = true
1077
+ let isDisabled = false
1078
+ const ons: Record<string, any> = {}
1079
+ if (!isHidden) {
1080
+ const rowid = getRowid($table, row)
1081
+ isChecked = !!updateCheckboxFlag && XEUtils.get(row, checkField)
1082
+ if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
1083
+ const childList: any[] = row[mapChildrenField || '']
1084
+ if (!childList || !childList.length || childList.every((item) => !checkMethod({ $table, row: item }))) {
1085
+ isDisabled = true
1086
+ }
1087
+ } else {
1088
+ isVisible = !visibleMethod || visibleMethod({ $table, row })
1089
+ isDisabled = checkMethod ? !checkMethod({ $table, row }) : !!checkMethod
1090
+ }
1091
+ if (treeConfig || isRowGroupStatus) {
1092
+ indeterminate = !!treeIndeterminateRowMaps[rowid]
1093
+ }
1094
+ ons.onClick = (evnt: MouseEvent) => {
1095
+ if (!isDisabled && isVisible) {
1096
+ $table.triggerCheckRowEvent(evnt, params, !isChecked)
1097
+ }
1098
+ }
1099
+ }
1100
+ const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate }
1101
+ if (checkboxSlot) {
1102
+ return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams))
1103
+ }
1104
+ const checkVNs: VNode[] = []
1105
+ if (isVisible) {
1106
+ checkVNs.push(
1107
+ h('span', {
1108
+ class: ['vxe-checkbox--icon', indeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : isDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
1109
+ })
1110
+ )
1111
+ if (defaultSlot || labelField) {
1112
+ checkVNs.push(
1113
+ h(
1114
+ 'span',
1115
+ {
1116
+ class: 'vxe-checkbox--label'
1117
+ },
1118
+ defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField as string)
1119
+ )
1120
+ )
1121
+ }
1122
+ }
1123
+ return renderCellBaseVNs(params, [
1124
+ h(
1125
+ 'span',
1126
+ {
1127
+ class: [
1128
+ 'vxe-cell--checkbox',
1129
+ {
1130
+ 'is--checked': isChecked,
1131
+ 'is--disabled': isDisabled,
1132
+ 'is--indeterminate': indeterminateField && !isChecked ? row[indeterminateField] : indeterminate,
1133
+ 'is--hidden': !isVisible
1134
+ }
1135
+ ],
1136
+ ...ons
1137
+ },
1138
+ checkVNs
1139
+ )
1140
+ ])
1141
+ },
1142
+ renderDeepSelectionCellByProp(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1143
+ return Cell.renderDeepNodeBtn(params, Cell.renderCheckboxCellByProp(params))
1144
+ },
1145
+
1146
+ /**
1147
+ * 展开行
1148
+ */
1149
+ renderExpandCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1150
+ const { $table, isHidden, row, column } = params
1151
+ const tableReactData = $table.reactData
1152
+ const tableInternalData = $table.internalData
1153
+ const { isRowGroupStatus } = tableReactData
1154
+ const { rowExpandedMaps, rowExpandLazyLoadedMaps } = tableInternalData
1155
+ const { computeExpandOpts } = $table.getComputeMaps()
1156
+ const expandOpts = computeExpandOpts.value
1157
+ const { lazy, labelField, iconLoaded, showIcon, iconOpen, iconClose, visibleMethod } = expandOpts
1158
+ const { slots } = column
1159
+ const defaultSlot = slots ? slots.default : null
1160
+ const iconSlot = slots ? slots.icon : null
1161
+ let isActive = false
1162
+ let isLazyLoading = false
1163
+ if (isRowGroupStatus && row.isAggregate) {
1164
+ return renderCellBaseVNs(params, [])
1165
+ }
1166
+ if (iconSlot) {
1167
+ return renderCellBaseVNs(params, $table.callSlot(iconSlot, params))
1168
+ }
1169
+ if (!isHidden) {
1170
+ const rowid = getRowid($table, row)
1171
+ isActive = !!rowExpandedMaps[rowid]
1172
+ if (lazy) {
1173
+ isLazyLoading = !!rowExpandLazyLoadedMaps[rowid]
1174
+ }
1175
+ }
1176
+ return renderCellBaseVNs(params, [
1177
+ showIcon && (!visibleMethod || visibleMethod(params))
1178
+ ? h(
1179
+ 'div',
1180
+ {
1181
+ class: [
1182
+ 'vxe-table--expanded',
1183
+ {
1184
+ 'is--active': isActive
1185
+ }
1186
+ ]
1187
+ },
1188
+ [
1189
+ h(
1190
+ 'span',
1191
+ {
1192
+ class: 'vxe-table--expand-btn',
1193
+ onMousedown(evnt) {
1194
+ evnt.stopPropagation()
1195
+ },
1196
+ onClick(evnt: MouseEvent) {
1197
+ $table.triggerRowExpandEvent(evnt, params)
1198
+ }
1199
+ },
1200
+ [
1201
+ h('i', {
1202
+ class: isLazyLoading ? iconLoaded || getIcon().TABLE_EXPAND_LOADED : isActive ? iconOpen || getIcon().TABLE_EXPAND_OPEN : iconClose || getIcon().TABLE_EXPAND_CLOSE
1203
+ })
1204
+ ]
1205
+ )
1206
+ ]
1207
+ )
1208
+ : renderEmptyElement($table),
1209
+ defaultSlot || labelField
1210
+ ? h(
1211
+ 'div',
1212
+ {
1213
+ class: 'vxe-table--expand-label'
1214
+ },
1215
+ defaultSlot ? $table.callSlot(defaultSlot, params) : XEUtils.get(row, labelField as string)
1216
+ )
1217
+ : renderEmptyElement($table)
1218
+ ])
1219
+ },
1220
+ renderExpandData(params: VxeTableDefines.CellRenderDataParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1221
+ const { $table, column } = params
1222
+ const { slots, contentRender } = column
1223
+ const contentSlot = slots ? slots.content : null
1224
+ if (contentSlot) {
1225
+ return $table.callSlot(contentSlot, params)
1226
+ }
1227
+ if (contentRender) {
1228
+ const { computeRendererOpts } = $table.getComputeMaps()
1229
+ const rendererOpts = computeRendererOpts.value
1230
+ const compConf = contentRender.name ? rendererOpts[contentRender.name] || renderer.get(contentRender.name) : null
1231
+ if (compConf) {
1232
+ const rtExpand = compConf.renderTableExpand || compConf.renderExpand
1233
+ if (rtExpand) {
1234
+ return getSlotVNs(rtExpand(contentRender, params))
1235
+ }
1236
+ }
1237
+ }
1238
+ return []
1239
+ },
1240
+
1241
+ /**
1242
+ * HTML 标签
1243
+ */
1244
+ renderHTMLCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1245
+ const { $table, column } = params
1246
+ const { slots } = column
1247
+ const defaultSlot = slots ? slots.default : null
1248
+ if (defaultSlot) {
1249
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params))
1250
+ }
1251
+ return renderCellBaseVNs(params, [
1252
+ h('span', {
1253
+ class: 'vxe-cell--html',
1254
+ innerHTML: getDefaultCellLabel(params)
1255
+ })
1256
+ ])
1257
+ },
1258
+ renderDeepHTMLCell(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1259
+ return Cell.renderDeepNodeBtn(params, Cell.renderHTMLCell(params))
1260
+ },
1261
+
1262
+ /**
1263
+ * 排序和筛选
1264
+ */
1265
+ renderSortAndFilterHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1266
+ return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params).concat(Cell.renderSortIcon(params).concat(Cell.renderFilterIcon(params))))
1267
+ },
1268
+
1269
+ /**
1270
+ * 排序
1271
+ */
1272
+ renderSortHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1273
+ return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params).concat(Cell.renderSortIcon(params)))
1274
+ },
1275
+ renderSortIcon(params: (VxeTableDefines.CellRenderHeaderParams | VxeTableDefines.CellRenderHeaderParams) & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1276
+ const { $table, column } = params
1277
+ const { computeSortOpts } = $table.getComputeMaps()
1278
+ const sortOpts = computeSortOpts.value
1279
+ const { showIcon, allowBtn, ascTitle, descTitle, iconLayout, iconAsc, iconDesc, iconVisibleMethod } = sortOpts
1280
+ const { order, slots } = column
1281
+ if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
1282
+ const sortSlot = slots ? slots.sort : null
1283
+ return sortSlot
1284
+ ? (getSlotVNs($table.callSlot(sortSlot, params)) as VNode[])
1285
+ : [
1286
+ h(
1287
+ 'span',
1288
+ {
1289
+ class: ['vxe-cell--sort', `vxe-cell--sort-${iconLayout}-layout`]
1290
+ },
1291
+ [
1292
+ h('i', {
1293
+ class: [
1294
+ 'vxe-sort--asc-btn',
1295
+ iconAsc || getIcon().TABLE_SORT_ASC,
1296
+ {
1297
+ 'sort--active': order === 'asc'
1298
+ }
1299
+ ],
1300
+ title: XEUtils.eqNull(ascTitle) ? getI18n('vxe.table.sortAsc') : `${ascTitle || ''}`,
1301
+ onClick: allowBtn
1302
+ ? (evnt: Event) => {
1303
+ evnt.stopPropagation()
1304
+ $table.triggerSortEvent(evnt, column, 'asc')
1305
+ }
1306
+ : undefined
1307
+ }),
1308
+ h('i', {
1309
+ class: [
1310
+ 'vxe-sort--desc-btn',
1311
+ iconDesc || getIcon().TABLE_SORT_DESC,
1312
+ {
1313
+ 'sort--active': order === 'desc'
1314
+ }
1315
+ ],
1316
+ title: XEUtils.eqNull(descTitle) ? getI18n('vxe.table.sortDesc') : `${descTitle || ''}`,
1317
+ onClick: allowBtn
1318
+ ? (evnt: Event) => {
1319
+ evnt.stopPropagation()
1320
+ $table.triggerSortEvent(evnt, column, 'desc')
1321
+ }
1322
+ : undefined
1323
+ })
1324
+ ]
1325
+ )
1326
+ ]
1327
+ }
1328
+ return []
1329
+ },
1330
+
1331
+ /**
1332
+ * 筛选
1333
+ */
1334
+ renderFilterHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1335
+ return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params).concat(Cell.renderFilterIcon(params)))
1336
+ },
1337
+ renderFilterIcon(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1338
+ const { $table, column, hasFilter } = params
1339
+ const tableReactData = $table.reactData
1340
+ const { filterStore } = tableReactData
1341
+ const { computeFilterOpts } = $table.getComputeMaps()
1342
+ const filterOpts = computeFilterOpts.value
1343
+ const { showIcon, iconNone, iconMatch, iconVisibleMethod } = filterOpts
1344
+ if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
1345
+ return [
1346
+ h(
1347
+ 'span',
1348
+ {
1349
+ class: [
1350
+ 'vxe-cell--filter',
1351
+ {
1352
+ 'is--active': filterStore.visible && filterStore.column === column
1353
+ }
1354
+ ],
1355
+ onClick(evnt) {
1356
+ if ($table.triggerFilterEvent) {
1357
+ $table.triggerFilterEvent(evnt, params.column, params)
1358
+ }
1359
+ }
1360
+ },
1361
+ [
1362
+ h('i', {
1363
+ class: ['vxe-filter--btn', hasFilter ? iconMatch || getIcon().TABLE_FILTER_MATCH : iconNone || getIcon().TABLE_FILTER_NONE],
1364
+ title: getI18n('vxe.table.filter')
1365
+ })
1366
+ ]
1367
+ )
1368
+ ]
1369
+ }
1370
+ return []
1371
+ },
1372
+
1373
+ /**
1374
+ * 可编辑
1375
+ */
1376
+ renderEditHeader(params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1377
+ const { $table, column } = params
1378
+ const tableProps = $table.props
1379
+ const { computeEditOpts } = $table.getComputeMaps()
1380
+ const { editConfig, editRules } = tableProps
1381
+ const editOpts = computeEditOpts.value
1382
+ const { sortable, filters, editRender } = column
1383
+ const isEnableEdit = editConfig && isEnableConf(editConfig)
1384
+ const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
1385
+ let isRequired = false
1386
+ if (editRules) {
1387
+ const columnRules = column.rules ? column.rules : XEUtils.get(editRules, column.field)
1388
+ if (columnRules) {
1389
+ isRequired = columnRules.some((rule) => rule.required)
1390
+ }
1391
+ }
1392
+ let editIconVNs: VNode[] = []
1393
+ if (isEnableEdit) {
1394
+ const { showAsterisk, showIcon, icon } = editOpts
1395
+ editIconVNs = [
1396
+ isRequired && showAsterisk
1397
+ ? h(
1398
+ 'span',
1399
+ {
1400
+ class: 'vxe-cell--required-icon'
1401
+ },
1402
+ [h('i')]
1403
+ )
1404
+ : renderEmptyElement($table),
1405
+ editRenderOpts && showIcon
1406
+ ? h(
1407
+ 'span',
1408
+ {
1409
+ class: 'vxe-cell--edit-icon'
1410
+ },
1411
+ XEUtils.isFunction(icon)
1412
+ ? getSlotVNs(icon({}))
1413
+ : [
1414
+ h('i', {
1415
+ class: icon || getIcon().TABLE_EDIT
1416
+ })
1417
+ ]
1418
+ )
1419
+ : renderEmptyElement($table)
1420
+ ]
1421
+ }
1422
+ return renderHeaderCellBaseVNs(
1423
+ params,
1424
+ editIconVNs
1425
+ .concat(Cell.renderHeaderTitle(params))
1426
+ .concat(sortable ? Cell.renderSortIcon(params) : [])
1427
+ .concat(filters ? Cell.renderFilterIcon(params) : [])
1428
+ )
1429
+ },
1430
+ // 行格编辑模式
1431
+ renderRowEdit(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1432
+ const { $table, column } = params
1433
+ const tableProps = $table.props
1434
+ const { editConfig } = tableProps
1435
+ const tableReactData = $table.reactData
1436
+ const { editStore } = tableReactData
1437
+ const { actived } = editStore
1438
+ const { editRender } = column
1439
+ const isEnableEdit = editConfig && isEnableConf(editConfig)
1440
+ const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
1441
+ return Cell.runRenderer(params, !!(editRenderOpts && actived && actived.row === params.row))
1442
+ },
1443
+ renderDeepRowEdit(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1444
+ return Cell.renderDeepNodeBtn(params, Cell.renderRowEdit(params) as VNode[])
1445
+ },
1446
+ // 单元格编辑模式
1447
+ renderCellEdit(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1448
+ const { $table, column } = params
1449
+ const tableProps = $table.props
1450
+ const { editConfig } = tableProps
1451
+ const tableReactData = $table.reactData
1452
+ const { editStore } = tableReactData
1453
+ const { actived } = editStore
1454
+ const { editRender } = column
1455
+ const isEnableEdit = editConfig && isEnableConf(editConfig)
1456
+ const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
1457
+ return Cell.runRenderer(params, !!(editRenderOpts && actived && actived.row === params.row && actived.column === params.column))
1458
+ },
1459
+ renderDeepCellEdit(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1460
+ return Cell.renderDeepNodeBtn(params, Cell.renderCellEdit(params) as VNode[])
1461
+ },
1462
+ runRenderer(params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, isEdit: boolean) {
1463
+ const { $table, row, column } = params
1464
+ const tableProps = $table.props
1465
+ const { editConfig } = tableProps
1466
+ const tableReactData = $table.reactData
1467
+ const { isRowGroupStatus } = tableReactData
1468
+ const { slots, field, editRender, formatter } = column
1469
+ const isEnableEdit = editConfig && isEnableConf(editConfig)
1470
+ const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
1471
+ const defaultSlot = slots ? slots.default : null
1472
+ const gcSlot = slots ? slots.groupContent || slots['group-content'] : null
1473
+ const editSlot = slots ? slots.edit : null
1474
+ const cellParams = Object.assign({ $type: '', isEdit }, params)
1475
+ if (isEdit && editRenderOpts) {
1476
+ cellParams.$type = 'edit'
1477
+ if (editSlot) {
1478
+ return $table.callSlot(editSlot, cellParams)
1479
+ }
1480
+ const { computeRendererOpts } = $table.getComputeMaps()
1481
+ const rendererOpts = computeRendererOpts.value
1482
+ const compConf = editRenderOpts.name ? rendererOpts[editRenderOpts.name] || renderer.get(editRenderOpts.name) : null
1483
+ const rtEdit = compConf ? compConf.renderTableEdit || compConf.renderEdit : null
1484
+ if (rtEdit) {
1485
+ return getSlotVNs(rtEdit(editRenderOpts, cellParams))
1486
+ }
1487
+ return []
1488
+ }
1489
+
1490
+ if (isRowGroupStatus && field && row.isAggregate) {
1491
+ const aggRow: VxeTableDefines.AggregateRowInfo = row
1492
+ const { computeAggregateOpts } = $table.getComputeMaps()
1493
+ const aggregateOpts = computeAggregateOpts.value
1494
+ const { mapChildrenField } = aggregateOpts
1495
+ const groupField = aggRow.groupField
1496
+ const groupContent = aggRow.groupContent
1497
+ const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : []
1498
+ const childCount = aggRow.childCount
1499
+ if (gcSlot) {
1500
+ return renderCellBaseVNs(params, $table.callSlot(gcSlot, Object.assign({ groupField, groupContent, childList, childCount }, params)))
1501
+ }
1502
+ } else {
1503
+ if (defaultSlot) {
1504
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, cellParams))
1505
+ }
1506
+ }
1507
+
1508
+ // slot default > formatter
1509
+ if (formatter) {
1510
+ return renderCellBaseVNs(params, [
1511
+ h(
1512
+ 'span',
1513
+ {
1514
+ class: 'vxe-cell--label'
1515
+ },
1516
+ getDefaultCellLabel(cellParams)
1517
+ )
1518
+ ])
1519
+ }
1520
+ return Cell.renderDefaultCell(cellParams)
1521
+ }
1522
+ }
1523
+
1524
+ export default Cell