vxe-table 3.20.5 → 3.20.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +106 -106
  3. package/es/index.esm.js +1 -2
  4. package/es/style.css +1 -1
  5. package/es/table/src/methods.js +20 -0
  6. package/es/table/src/table.js +39 -0
  7. package/es/table/src/util.js +3 -4
  8. package/es/table/style.css +48 -18
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-table/style.css +48 -18
  12. package/lib/index.common.js +1 -2
  13. package/lib/index.umd.js +3271 -1892
  14. package/lib/index.umd.min.js +1 -1
  15. package/lib/style.css +1 -1
  16. package/lib/table/src/methods.js +2 -1
  17. package/lib/table/src/methods.min.js +1 -1
  18. package/lib/table/src/table.js +48 -0
  19. package/lib/table/src/table.min.js +1 -1
  20. package/lib/table/src/util.js +4 -6
  21. package/lib/table/src/util.min.js +1 -1
  22. package/lib/table/style/style.css +48 -18
  23. package/lib/ui/index.js +1 -1
  24. package/lib/ui/index.min.js +1 -1
  25. package/lib/ui/src/log.js +1 -1
  26. package/lib/ui/src/log.min.js +1 -1
  27. package/lib/v-x-e-table/index.js +1 -2
  28. package/lib/v-x-e-table/index.min.js +1 -1
  29. package/lib/vxe-colgroup/index.js +1 -2
  30. package/lib/vxe-colgroup/index.min.js +1 -1
  31. package/lib/vxe-column/index.js +1 -2
  32. package/lib/vxe-column/index.min.js +1 -1
  33. package/lib/vxe-grid/index.js +1 -2
  34. package/lib/vxe-grid/index.min.js +1 -1
  35. package/lib/vxe-table/index.js +1 -2
  36. package/lib/vxe-table/index.min.js +1 -1
  37. package/lib/vxe-table/style/style.css +48 -18
  38. package/lib/vxe-toolbar/index.js +1 -2
  39. package/lib/vxe-toolbar/index.min.js +1 -1
  40. package/lib/vxe-ui/index.js +1 -2
  41. package/lib/vxe-ui/index.min.js +1 -1
  42. package/lib/vxe-v-x-e-table/index.js +1 -2
  43. package/lib/vxe-v-x-e-table/index.min.js +1 -1
  44. package/package.json +93 -93
  45. package/packages/colgroup/index.ts +22 -22
  46. package/packages/column/index.ts +22 -22
  47. package/packages/components.ts +42 -42
  48. package/packages/grid/index.ts +22 -22
  49. package/packages/grid/src/grid.ts +1935 -1935
  50. package/packages/index.ts +4 -4
  51. package/packages/locale/lang/ar-EG.ts +832 -832
  52. package/packages/locale/lang/de-DE.ts +832 -832
  53. package/packages/locale/lang/en-US.ts +832 -832
  54. package/packages/locale/lang/es-ES.ts +832 -832
  55. package/packages/locale/lang/fr-FR.ts +832 -832
  56. package/packages/locale/lang/hu-HU.ts +832 -832
  57. package/packages/locale/lang/hy-AM.ts +832 -832
  58. package/packages/locale/lang/id-ID.ts +832 -832
  59. package/packages/locale/lang/it-IT.ts +832 -832
  60. package/packages/locale/lang/ja-JP.ts +832 -832
  61. package/packages/locale/lang/ko-KR.ts +832 -832
  62. package/packages/locale/lang/ms-MY.ts +832 -832
  63. package/packages/locale/lang/nb-NO.ts +832 -832
  64. package/packages/locale/lang/pt-BR.ts +832 -832
  65. package/packages/locale/lang/ru-RU.ts +832 -832
  66. package/packages/locale/lang/th-TH.ts +832 -832
  67. package/packages/locale/lang/ug-CN.ts +832 -832
  68. package/packages/locale/lang/uk-UA.ts +832 -832
  69. package/packages/locale/lang/uz-UZ.ts +832 -832
  70. package/packages/locale/lang/vi-VN.ts +832 -832
  71. package/packages/locale/lang/zh-CHT.ts +832 -832
  72. package/packages/locale/lang/zh-CN.ts +832 -832
  73. package/packages/locale/lang/zh-HK.ts +3 -3
  74. package/packages/locale/lang/zh-MO.ts +3 -3
  75. package/packages/locale/lang/zh-TC.ts +3 -3
  76. package/packages/locale/lang/zh-TW.ts +3 -3
  77. package/packages/table/index.ts +49 -49
  78. package/packages/table/module/custom/mixin.ts +369 -369
  79. package/packages/table/module/custom/panel.ts +1461 -1461
  80. package/packages/table/module/edit/mixin.ts +1123 -1123
  81. package/packages/table/module/export/export-panel.ts +658 -658
  82. package/packages/table/module/export/import-panel.ts +319 -319
  83. package/packages/table/module/export/mixin.ts +1693 -1693
  84. package/packages/table/module/export/util.ts +24 -24
  85. package/packages/table/module/filter/mixin.ts +507 -507
  86. package/packages/table/module/filter/panel.ts +329 -329
  87. package/packages/table/module/keyboard/mixin.ts +513 -513
  88. package/packages/table/module/menu/mixin.ts +329 -329
  89. package/packages/table/module/menu/panel.ts +212 -212
  90. package/packages/table/module/validator/mixin.ts +626 -626
  91. package/packages/table/render/index.ts +1456 -1456
  92. package/packages/table/src/body.ts +969 -969
  93. package/packages/table/src/cell.ts +1285 -1285
  94. package/packages/table/src/column.ts +205 -205
  95. package/packages/table/src/columnInfo.ts +228 -228
  96. package/packages/table/src/footer.ts +388 -388
  97. package/packages/table/src/group.ts +51 -51
  98. package/packages/table/src/header.ts +602 -602
  99. package/packages/table/src/methods.ts +12939 -12920
  100. package/packages/table/src/props.ts +311 -311
  101. package/packages/table/src/store.ts +15 -15
  102. package/packages/table/src/table.ts +2505 -2460
  103. package/packages/table/src/util.ts +1012 -1012
  104. package/packages/toolbar/index.ts +18 -18
  105. package/packages/toolbar/src/toolbar.ts +856 -856
  106. package/packages/ui/index.ts +530 -530
  107. package/packages/ui/src/anime.ts +52 -52
  108. package/packages/ui/src/comp.ts +3 -3
  109. package/packages/ui/src/dom.ts +236 -236
  110. package/packages/ui/src/log.ts +8 -8
  111. package/packages/ui/src/utils.ts +56 -56
  112. package/packages/ui/src/vn.ts +65 -65
  113. package/packages/v-x-e-table/index.ts +4 -4
  114. package/styles/all.scss +7 -7
  115. package/styles/base.scss +16 -16
  116. package/styles/components/grid.scss +89 -89
  117. package/styles/components/icon.scss +225 -225
  118. package/styles/components/old-icon.scss +715 -715
  119. package/styles/components/table-module/all.scss +6 -6
  120. package/styles/components/table-module/custom.scss +527 -527
  121. package/styles/components/table-module/export.scss +130 -130
  122. package/styles/components/table-module/filter.scss +130 -130
  123. package/styles/components/table-module/menu.scss +81 -81
  124. package/styles/components/table.scss +2679 -2679
  125. package/styles/components/toolbar.scss +119 -119
  126. package/styles/default.scss +2 -2
  127. package/styles/helpers/baseMixin.scss +95 -95
  128. package/styles/index.scss +3 -3
  129. package/styles/modules.scss +5 -5
  130. package/styles/theme/base.scss +93 -93
  131. package/styles/theme/dark.scss +49 -49
  132. package/styles/theme/light.scss +44 -44
  133. package/styles/variable.scss +43 -43
  134. package/types/all.d.ts +53 -53
  135. package/types/index.d.ts +4 -4
  136. /package/es/{iconfont.1773710661615.ttf → iconfont.1773991883171.ttf} +0 -0
  137. /package/es/{iconfont.1773710661615.woff → iconfont.1773991883171.woff} +0 -0
  138. /package/es/{iconfont.1773710661615.woff2 → iconfont.1773991883171.woff2} +0 -0
  139. /package/lib/{iconfont.1773710661615.ttf → iconfont.1773991883171.ttf} +0 -0
  140. /package/lib/{iconfont.1773710661615.woff → iconfont.1773991883171.woff} +0 -0
  141. /package/lib/{iconfont.1773710661615.woff2 → iconfont.1773991883171.woff2} +0 -0
@@ -1,2460 +1,2505 @@
1
- import { CreateElement } from 'vue'
2
- import XEUtils from 'xe-utils'
3
- import { getFuncText, isEnableConf } from '../../ui/src/utils'
4
- import { initTpImg, toCssUnit } from '../../ui/src/dom'
5
- import { createReactData, createInternalData, createHandleGetRowId, getCalcHeight, hasDeepKey } from './util'
6
- import { VxeUI } from '../../ui'
7
- import methods from './methods'
8
- import TableBodyComponent from './body'
9
- import TableHeaderComponent from './header'
10
- import TableFooterComponent from './footer'
11
- import { tableProps } from './props'
12
- import { getSlotVNs } from '../../ui/src/vn'
13
- import { warnLog, errLog } from '../../ui/src/log'
14
- import { crossTableDragRowGlobal, getCrossTableDragRowInfo } from './store'
15
- import TableCustomPanelComponent from '../module/custom/panel'
16
- import TableFilterPanelComponent from '../module/filter/panel'
17
- import TableImportPanelComponent from '../module/export/import-panel'
18
- import TableExportPanelComponent from '../module/export/export-panel'
19
- import TableMenuPanelComponent from '../module/menu/panel'
20
-
21
- import filterMixin from '../module/filter/mixin'
22
- import menuMixin from '../module/menu/mixin'
23
- import editMixin from '../module/edit/mixin'
24
- import exportMixin from '../module/export/mixin'
25
- import keyboardMixin from '../module/keyboard/mixin'
26
- import validatorMixin from '../module/validator/mixin'
27
- import customMixin from '../module/custom/mixin'
28
-
29
- import type { VxeTabsConstructor, VxeTabsPrivateMethods, VxeComponentStyleType } from 'vxe-pc-ui'
30
- import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTablePropTypes, TableInternalData, TableReactData, VxeTableDefines } from '../../../types'
31
-
32
- const { getConfig, getIcon, getI18n, renderer, globalResize, globalEvents, globalMixins, renderEmptyElement } = VxeUI
33
-
34
- function handleUpdateMergeBodyCells ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, merges: VxeTableDefines.MergeOptions | VxeTableDefines.MergeOptions[]) {
35
- const internalData = $xeTable as unknown as TableInternalData
36
-
37
- internalData.mergeBodyList = []
38
- internalData.mergeBodyMaps = {}
39
- internalData.mergeBodyCellMaps = {}
40
- $xeTable.setMergeCells(merges)
41
- }
42
-
43
- function handleUpdateMergeHeaderCells ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, merges: VxeTableDefines.MergeOptions | VxeTableDefines.MergeOptions[]) {
44
- const internalData = $xeTable as unknown as TableInternalData
45
-
46
- internalData.mergeHeaderList = []
47
- internalData.mergeHeaderMaps = {}
48
- internalData.mergeHeaderCellMaps = {}
49
- $xeTable.setMergeHeaderCells(merges)
50
- }
51
-
52
- function handleUpdateMergeFooterCells ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, merges: VxeTableDefines.MergeOptions | VxeTableDefines.MergeOptions[]) {
53
- const internalData = $xeTable as unknown as TableInternalData
54
-
55
- internalData.mergeFooterList = []
56
- internalData.mergeFooterMaps = {}
57
- internalData.mergeFooterCellMaps = {}
58
- $xeTable.setMergeFooterCells(merges)
59
- }
60
-
61
- function handleKeyField ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
62
- const internalData = $xeTable as unknown as TableInternalData
63
-
64
- const keyField = $xeTable.computeRowField
65
- internalData.currKeyField = keyField
66
- internalData.isCurrDeepKey = hasDeepKey(keyField)
67
- }
68
-
69
- /**
70
- * 渲染浮固定列
71
- * 分别渲染左边固定列和右边固定列
72
- * 如果宽度足够情况下,则不需要渲染固定列
73
- */
74
- function renderViewFixed (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods, fixedType: any) {
75
- const props = $xeTable
76
- const reactData = $xeTable as unknown as TableReactData
77
-
78
- const { showHeader, showFooter } = props
79
- const { tableData, tableColumn, tableGroupColumn, columnStore, footerTableData } = reactData
80
- const scrollbarOpts = $xeTable.computeScrollbarOpts
81
- const scrollbarXOpts = $xeTable.computeScrollbarXOpts
82
- const scrollbarYOpts = $xeTable.computeScrollbarYOpts
83
- const { overscrollBehavior: overscrollXBehavior } = scrollbarXOpts
84
- const { overscrollBehavior: overscrollYBehavior } = scrollbarYOpts
85
- const isFixedLeft = fixedType === 'left'
86
- const fixedColumn = isFixedLeft ? columnStore.leftList : columnStore.rightList
87
- const osXBehavior = XEUtils.eqNull(overscrollXBehavior) ? scrollbarOpts.overscrollBehavior : overscrollXBehavior
88
- const osYBehavior = XEUtils.eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior
89
- return h('div', {
90
- ref: isFixedLeft ? 'refLeftContainer' : 'refRightContainer',
91
- class: [`vxe-table--fixed-${fixedType}-wrapper`, `sx--${scrollbarXOpts.visible}`, `sy--${scrollbarYOpts.visible}`, {
92
- [`x-ob--${osXBehavior}`]: osXBehavior,
93
- [`y-ob--${osYBehavior}`]: osYBehavior
94
- }]
95
- }, [
96
- showHeader
97
- ? h(TableHeaderComponent, {
98
- props: {
99
- fixedType,
100
- tableData,
101
- tableColumn,
102
- tableGroupColumn,
103
- fixedColumn
104
- },
105
- ref: `${fixedType}Header`
106
- })
107
- : renderEmptyElement($xeTable),
108
- h(TableBodyComponent, {
109
- props: {
110
- fixedType,
111
- tableData,
112
- tableColumn,
113
- fixedColumn
114
- },
115
- ref: `${fixedType}Body`
116
- }),
117
- showFooter
118
- ? h(TableFooterComponent, {
119
- props: {
120
- footerTableData,
121
- tableColumn,
122
- fixedColumn,
123
- fixedType
124
- },
125
- ref: `${fixedType}Footer`
126
- })
127
- : renderEmptyElement($xeTable)
128
- ])
129
- }
130
-
131
- function renderEmptyBody (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
132
- const slots = $xeTable.$scopedSlots
133
- const $xeGrid = $xeTable.$xeGrid
134
- const $xeGantt = $xeTable.$xeGantt
135
-
136
- const emptyOpts = $xeTable.computeEmptyOpts
137
- const emptySlot = slots.empty
138
- let emptyContent: any = ''
139
- const emptyParams = { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }
140
- if (emptySlot) {
141
- emptyContent = emptySlot.call($xeTable, emptyParams)
142
- } else {
143
- const compConf = emptyOpts.name ? renderer.get(emptyOpts.name) : null
144
- const rtEmptyView = compConf ? (compConf.renderTableEmpty || compConf.renderTableEmptyView || compConf.renderEmpty) : null
145
- if (rtEmptyView) {
146
- emptyContent = getSlotVNs(rtEmptyView.call($xeTable, h, emptyOpts, emptyParams))
147
- } else {
148
- emptyContent = getFuncText($xeTable.emptyText) || getI18n('vxe.table.emptyText')
149
- }
150
- }
151
- return emptyContent
152
- }
153
-
154
- const renderDragTipContents = (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) => {
155
- const props = $xeTable
156
- const reactData = $xeTable as unknown as TableReactData
157
- const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable)
158
-
159
- const { dragConfig } = props
160
- const { dragRow, dragCol, dragTipText } = reactData
161
- const columnDragOpts = $xeTable.computeColumnDragOpts
162
- const rowDragOpts = $xeTable.computeRowDragOpts
163
- const rowDragSlots = rowDragOpts.slots || {}
164
- const rTipSlot = rowDragSlots.tip || (dragConfig && dragConfig.slots ? dragConfig.slots.rowTip : null)
165
- const columnDragSlots = columnDragOpts.slots || {}
166
- const cTipSlot = columnDragSlots.tip
167
- const dRow = dragRow || (rowDragOpts.isCrossTableDrag ? crossTableDragRowInfo.row : null)
168
-
169
- if (dRow && rTipSlot) {
170
- return $xeTable.callSlot(rTipSlot, { row: dRow }, h)
171
- }
172
- if (dragCol && cTipSlot) {
173
- return $xeTable.callSlot(cTipSlot, { column: dragCol }, h)
174
- }
175
- return [h('span', dragTipText)]
176
- }
177
-
178
- const renderDragTip = (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) => {
179
- const reactData = $xeTable as unknown as TableReactData
180
- const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable)
181
-
182
- const { dragRow, dragCol } = reactData
183
- const rowOpts = $xeTable.computeRowOpts
184
- const columnOpts = $xeTable.computeColumnOpts
185
- const rowDragOpts = $xeTable.computeRowDragOpts
186
- const columnDragOpts = $xeTable.computeColumnDragOpts
187
- const dRow = dragRow || (rowDragOpts.isCrossTableDrag ? crossTableDragRowInfo.row : null)
188
-
189
- if (rowOpts.drag || columnOpts.drag) {
190
- return h('div', {
191
- class: 'vxe-table--drag-wrapper'
192
- }, [
193
- h('div', {
194
- ref: 'refDragRowLineElem',
195
- class: ['vxe-table--drag-row-line', {
196
- 'is--guides': rowDragOpts.showGuidesStatus
197
- }]
198
- }),
199
- h('div', {
200
- ref: 'refDragColLineElem',
201
- class: ['vxe-table--drag-col-line', {
202
- 'is--guides': columnDragOpts.showGuidesStatus
203
- }]
204
- }),
205
- (dRow && rowDragOpts.showDragTip) || (dragCol && columnDragOpts.showDragTip)
206
- ? h('div', {
207
- ref: 'refDragTipElem',
208
- class: 'vxe-table--drag-sort-tip'
209
- }, [
210
- h('div', {
211
- class: 'vxe-table--drag-sort-tip-wrapper'
212
- }, [
213
- h('div', {
214
- class: 'vxe-table--drag-sort-tip-status'
215
- }, [
216
- h('span', {
217
- class: ['vxe-table--drag-sort-tip-normal-status', dRow ? getIcon().TABLE_DRAG_STATUS_ROW : getIcon().TABLE_DRAG_STATUS_COLUMN]
218
- }),
219
- h('span', {
220
- class: ['vxe-table--drag-sort-tip-sub-status', getIcon().TABLE_DRAG_STATUS_SUB_ROW]
221
- }),
222
- h('span', {
223
- class: ['vxe-table--drag-sort-tip-disabled-status', getIcon().TABLE_DRAG_DISABLED]
224
- })
225
- ]),
226
- h('div', {
227
- class: 'vxe-table--drag-sort-tip-content'
228
- }, renderDragTipContents(h, $xeTable))
229
- ])
230
- ])
231
- : renderEmptyElement($xeTable)
232
- ])
233
- }
234
- return renderEmptyElement($xeTable)
235
- }
236
-
237
- function handleUpdateResize ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
238
- const el = $xeTable.$refs.refElem as HTMLDivElement
239
- if (el && el.clientWidth && el.clientHeight) {
240
- $xeTable.recalculate()
241
- }
242
- }
243
-
244
- function renderRowExpandedVNs (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
245
- const props = $xeTable
246
- const reactData = $xeTable as unknown as TableReactData
247
- const internalData = $xeTable as unknown as TableInternalData
248
- const $xeGrid = $xeTable.$xeGrid
249
- const $xeGantt = $xeTable.$xeGantt
250
-
251
- const { treeConfig } = props
252
- const { expandColumn, isRowGroupStatus } = reactData
253
- const tableRowExpandedList: any[] = ($xeTable as any).computeTableRowExpandedList
254
- const expandOpts = $xeTable.computeExpandOpts
255
- const { mode } = expandOpts
256
- if (mode !== 'fixed') {
257
- return renderEmptyElement($xeTable)
258
- }
259
- const expandVNs = [
260
- h('div', {
261
- key: 'repY',
262
- ref: 'refRowExpandYSpaceElem'
263
- })
264
- ]
265
-
266
- if (expandColumn) {
267
- const { handleGetRowId } = createHandleGetRowId($xeTable)
268
- tableRowExpandedList.forEach((row) => {
269
- const expandOpts = $xeTable.computeExpandOpts
270
- const { height: expandHeight, padding, indent } = expandOpts
271
- const { fullAllDataRowIdData, fullColumnIdData } = internalData
272
- const treeOpts = $xeTable.computeTreeOpts
273
- const { transform, seqMode } = treeOpts
274
- const cellStyle: Record<string, string> = {}
275
- const rowid = handleGetRowId(row)
276
- const rowRest = fullAllDataRowIdData[rowid]
277
- const colid = expandColumn.id
278
- const colRest = fullColumnIdData[colid] || {}
279
- let rowLevel = 0
280
- let seq: string | number = -1
281
- let _rowIndex = -1
282
- let rowIndex = -1
283
- let $rowIndex = -1
284
- if (rowRest) {
285
- rowIndex = rowRest.index
286
- $rowIndex = rowRest.$index
287
- _rowIndex = rowRest._index
288
- rowLevel = rowRest.level
289
- seq = rowRest.seq
290
- if (isRowGroupStatus || (treeConfig && transform && seqMode === 'increasing')) {
291
- seq = rowRest._index + 1
292
- } else if ((treeConfig && seqMode === 'fixed')) {
293
- seq = rowRest._tIndex + 1
294
- }
295
- }
296
- if (expandHeight) {
297
- cellStyle.height = `${expandHeight}px`
298
- }
299
- if (isRowGroupStatus || treeConfig) {
300
- cellStyle.paddingLeft = `${(rowLevel * (XEUtils.isNumber(indent) ? indent : treeOpts.indent)) + 30}px`
301
- }
302
- let columnIndex = -1
303
- let $columnIndex = -1
304
- let _columnIndex = -1
305
- if (colRest) {
306
- columnIndex = colRest.index
307
- $columnIndex = colRest.$index
308
- _columnIndex = colRest._index
309
- }
310
- const expandParams: VxeTableDefines.CellRenderDataParams = {
311
- $table: $xeTable,
312
- $grid: $xeGrid,
313
- $gantt: $xeGantt,
314
- seq,
315
- column: expandColumn,
316
- columnIndex,
317
- $columnIndex,
318
- _columnIndex,
319
- fixed: '',
320
- source: 'table',
321
- type: 'body',
322
- level: rowLevel,
323
- rowid,
324
- row,
325
- rowIndex,
326
- $rowIndex,
327
- _rowIndex,
328
- isHidden: false,
329
- isEdit: false,
330
- visibleData: [],
331
- data: [],
332
- items: []
333
- }
334
- expandVNs.push(
335
- h('div', {
336
- key: rowid,
337
- class: ['vxe-body--row-expanded-cell', {
338
- 'is--padding': padding,
339
- 'is--ellipsis': expandHeight
340
- }],
341
- attrs: {
342
- rowid
343
- },
344
- style: cellStyle
345
- }, [
346
- h('div', {
347
- class: 'vxe-body--row-expanded-content'
348
- }, expandColumn.renderData(h, expandParams))
349
- ])
350
- )
351
- })
352
- }
353
-
354
- return h('div', {
355
- ref: 'refRowExpandElem',
356
- class: 'vxe-table--row-expanded-wrapper'
357
- }, expandVNs)
358
- }
359
-
360
- function renderScrollX (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
361
- return h('div', {
362
- key: 'vsx',
363
- ref: 'refScrollXVirtualElem',
364
- class: 'vxe-table--scroll-x-virtual'
365
- }, [
366
- h('div', {
367
- ref: 'refScrollXLeftCornerElem',
368
- class: 'vxe-table--scroll-x-left-corner'
369
- }),
370
- h('div', {
371
- ref: 'refScrollXWrapperElem',
372
- class: 'vxe-table--scroll-x-wrapper'
373
- }, [
374
- h('div', {
375
- ref: 'refScrollXHandleElem',
376
- class: 'vxe-table--scroll-x-handle',
377
- on: {
378
- scroll: $xeTable.triggerVirtualScrollXEvent
379
- }
380
- }, [
381
- h('div', {
382
- ref: 'refScrollXSpaceElem',
383
- class: 'vxe-table--scroll-x-space'
384
- })
385
- ]),
386
- h('div', {
387
- class: 'vxe-table--scroll-x-handle-appearance'
388
- })
389
- ]),
390
- h('div', {
391
- ref: 'refScrollXRightCornerElem',
392
- class: 'vxe-table--scroll-x-right-corner'
393
- })
394
- ])
395
- }
396
-
397
- function renderScrollY (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
398
- return h('div', {
399
- ref: 'refScrollYVirtualElem',
400
- class: 'vxe-table--scroll-y-virtual'
401
- }, [
402
- h('div', {
403
- ref: 'refScrollYTopCornerElem',
404
- class: 'vxe-table--scroll-y-top-corner'
405
- }),
406
- h('div', {
407
- ref: 'refScrollYWrapperElem',
408
- class: 'vxe-table--scroll-y-wrapper'
409
- }, [
410
- h('div', {
411
- ref: 'refScrollYHandleElem',
412
- class: 'vxe-table--scroll-y-handle',
413
- on: {
414
- scroll: $xeTable.triggerVirtualScrollYEvent
415
- }
416
- }, [
417
- h('div', {
418
- ref: 'refScrollYSpaceElem',
419
- class: 'vxe-table--scroll-y-space'
420
- })
421
- ])
422
- ]),
423
- h('div', {
424
- ref: 'refScrollYBottomCornerElem',
425
- class: 'vxe-table--scroll-y-bottom-corner'
426
- })
427
- ])
428
- }
429
-
430
- function renderViewport (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
431
- const props = $xeTable
432
- const reactData = $xeTable as unknown as TableReactData
433
-
434
- const { showHeader, showFooter } = props
435
- const { overflowX, tableData, tableColumn, tableGroupColumn, footerTableData, columnStore } = reactData
436
- const scrollbarOpts = $xeTable.computeScrollbarOpts
437
- const scrollbarXOpts = $xeTable.computeScrollbarXOpts
438
- const scrollbarYOpts = $xeTable.computeScrollbarYOpts
439
- const { overscrollBehavior: overscrollXBehavior } = scrollbarXOpts
440
- const { overscrollBehavior: overscrollYBehavior } = scrollbarYOpts
441
- const { leftList, rightList } = columnStore
442
- const osXBehavior = XEUtils.eqNull(overscrollXBehavior) ? scrollbarOpts.overscrollBehavior : overscrollXBehavior
443
- const osYBehavior = XEUtils.eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior
444
-
445
- return h('div', {
446
- ref: 'refTableViewportElem',
447
- class: ['vxe-table--viewport-wrapper', {
448
- [`x-ob--${osXBehavior}`]: osXBehavior,
449
- [`y-ob--${osYBehavior}`]: osYBehavior
450
- }]
451
- }, [
452
- h('div', {
453
- class: ['vxe-table--main-wrapper', `sx--${scrollbarXOpts.visible}`, `sy--${scrollbarYOpts.visible}`]
454
- }, [
455
- /**
456
- * 表头
457
- */
458
- showHeader
459
- ? h(TableHeaderComponent, {
460
- ref: 'refTableHeader',
461
- props: {
462
- tableData,
463
- tableColumn,
464
- tableGroupColumn
465
- }
466
- })
467
- : renderEmptyElement($xeTable),
468
- /**
469
- * 表体
470
- */
471
- h(TableBodyComponent, {
472
- ref: 'refTableBody',
473
- props: {
474
- tableData,
475
- tableColumn
476
- }
477
- }),
478
- /**
479
- * 表尾
480
- */
481
- showFooter
482
- ? h(TableFooterComponent, {
483
- ref: 'refTableFooter',
484
- props: {
485
- footerTableData,
486
- tableColumn
487
- }
488
- })
489
- : renderEmptyElement($xeTable)
490
- ]),
491
- h('div', {
492
- class: 'vxe-table--fixed-wrapper'
493
- }, [
494
- leftList && leftList.length && overflowX ? renderViewFixed(h, $xeTable, 'left') : renderEmptyElement($xeTable),
495
- rightList && rightList.length && overflowX ? renderViewFixed(h, $xeTable, 'right') : renderEmptyElement($xeTable)
496
- ]),
497
- renderRowExpandedVNs(h, $xeTable)
498
- ])
499
- }
500
-
501
- function renderBody (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
502
- const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
503
- return h('div', {
504
- class: 'vxe-table--layout-wrapper'
505
- }, scrollbarYToLeft
506
- ? [
507
- renderScrollY(h, $xeTable),
508
- renderViewport(h, $xeTable)
509
- ]
510
- : [
511
- renderViewport(h, $xeTable),
512
- renderScrollY(h, $xeTable)
513
- ])
514
- }
515
-
516
- export default {
517
- name: 'VxeTable',
518
- mixins: [
519
- globalMixins.sizeMixin,
520
- filterMixin,
521
- menuMixin,
522
- editMixin,
523
- exportMixin,
524
- keyboardMixin,
525
- validatorMixin,
526
- customMixin
527
- ],
528
- props: tableProps,
529
- provide () {
530
- const $xeTable = this
531
- return {
532
- $xeTable,
533
- xecolgroup: null
534
- }
535
- },
536
- inject: {
537
- $xeTabs: {
538
- default: null
539
- },
540
- $xeParentTable: {
541
- from: '$xeTable',
542
- default: null
543
- },
544
- $xeGrid: {
545
- default: null
546
- },
547
- $xeGantt: {
548
- default: null
549
- }
550
- },
551
- data () {
552
- const xID = XEUtils.uniqueId()
553
-
554
- const reactData = createReactData()
555
-
556
- return {
557
- xID,
558
- ...reactData,
559
-
560
- // 私有属性
561
- reScrollFlag: 0,
562
- reLayoutFlag: 0,
563
- footFlag: 0,
564
- kfFlag: 0,
565
- mergeFooteCellFlag: 0,
566
- crossTableDragRowInfo: crossTableDragRowGlobal
567
- }
568
- },
569
- computed: {
570
- ...({} as {
571
- $xeTabs(): (VxeTabsConstructor & VxeTabsPrivateMethods) | null
572
- }),
573
- tableId () {
574
- return this.computeTableId
575
- },
576
- computeTableId () {
577
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
578
- const props = $xeTable
579
- const $xeGrid = $xeTable.$xeGrid
580
- const $xeGantt = $xeTable.$xeGantt
581
-
582
- const { id } = props
583
- if (id) {
584
- if (XEUtils.isFunction(id)) {
585
- return `${id({ $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) || ''}`
586
- }
587
- return `${id}`
588
- }
589
- return ''
590
- },
591
- computeRowField () {
592
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
593
- const props = $xeTable
594
-
595
- const rowOpts = $xeTable.computeRowOpts
596
- return `${props.rowId || rowOpts.keyField || '_X_ROW_KEY'}`
597
- },
598
- validOpts () {
599
- return this.computeValidOpts
600
- },
601
- computeValidOpts () {
602
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
603
- const props = $xeTable
604
-
605
- const opts = Object.assign({}, getConfig().table.validConfig, props.validConfig)
606
- // 兼容老版本
607
- if (XEUtils.isBoolean(opts.showMessage)) {
608
- opts.showErrorMessage = opts.showMessage
609
- }
610
- return opts
611
- },
612
- sXOpts () {
613
- return this.computeVirtualXOpts
614
- },
615
- computeSXOpts () {
616
- return this.computeVirtualXOpts
617
- },
618
- computeScrollXThreshold () {
619
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
620
-
621
- const virtualXOpts = $xeTable.computeVirtualXOpts
622
- const { threshold } = virtualXOpts
623
- if (threshold) {
624
- return XEUtils.toNumber(threshold)
625
- }
626
- return 0
627
- },
628
- sYOpts () {
629
- return this.computeVirtualYOpts
630
- },
631
- computeSYOpts () {
632
- return this.computeVirtualYOpts
633
- },
634
- computeVirtualXOpts () {
635
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
636
- const props = $xeTable
637
-
638
- const { virtualXConfig, scrollX } = props
639
- const globalVirtualXConfig = getConfig().table.virtualXConfig
640
- const globalScrollX = getConfig().table.scrollX
641
- if (virtualXConfig) {
642
- return Object.assign({}, globalVirtualXConfig, virtualXConfig) as VxeTablePropTypes.VirtualXConfig & { gt: number }
643
- }
644
- if (scrollX) {
645
- // 已废弃,保留兼容
646
- return Object.assign({}, globalScrollX, scrollX) as VxeTablePropTypes.VirtualXConfig & { gt: number }
647
- }
648
- if (globalVirtualXConfig) {
649
- return Object.assign({}, globalVirtualXConfig, virtualXConfig) as VxeTablePropTypes.VirtualXConfig & { gt: number }
650
- }
651
- // 已废弃,保留兼容
652
- return Object.assign({}, globalScrollX, scrollX) as VxeTablePropTypes.VirtualXConfig & { gt: number }
653
- },
654
- computeVirtualYOpts () {
655
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
656
- const props = $xeTable
657
-
658
- const { virtualYConfig, scrollY } = props
659
- const globalVirtualYConfig = getConfig().table.virtualYConfig
660
- const globalScrollY = getConfig().table.scrollY
661
- if (virtualYConfig) {
662
- return Object.assign({}, globalVirtualYConfig, virtualYConfig) as VxeTablePropTypes.VirtualYConfig & { gt: number }
663
- }
664
- if (scrollY) {
665
- // 已废弃,保留兼容
666
- return Object.assign({}, globalScrollY, scrollY) as VxeTablePropTypes.VirtualYConfig & { gt: number }
667
- }
668
- if (globalVirtualYConfig) {
669
- return Object.assign({}, globalVirtualYConfig, virtualYConfig) as VxeTablePropTypes.VirtualYConfig & { gt: number }
670
- }
671
- // 已废弃,保留兼容
672
- return Object.assign({}, globalScrollY, scrollY) as VxeTablePropTypes.VirtualYConfig & { gt: number }
673
- },
674
- computeScrollbarOpts () {
675
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
676
- const props = $xeTable
677
-
678
- return Object.assign({}, getConfig().table.scrollbarConfig, props.scrollbarConfig)
679
- },
680
- computeScrollbarXOpts () {
681
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
682
- const props = $xeTable
683
-
684
- const scrollbarOpts = $xeTable.computeScrollbarOpts
685
- return Object.assign({}, scrollbarOpts.x, props.scrollbarConfig?.x || {})
686
- },
687
- computeScrollbarYOpts () {
688
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
689
- const props = $xeTable
690
-
691
- const scrollbarOpts = $xeTable.computeScrollbarOpts
692
- return Object.assign({}, scrollbarOpts.y, props.scrollbarConfig?.y || {})
693
- },
694
- computeScrollbarXToTop () {
695
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
696
-
697
- const scrollbarXOpts = $xeTable.computeScrollbarXOpts
698
- return scrollbarXOpts.position === 'top'
699
- },
700
- computeScrollbarYToLeft () {
701
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
702
-
703
- const scrollbarYOpts = $xeTable.computeScrollbarYOpts
704
- return scrollbarYOpts.position === 'left'
705
- },
706
- computeScrollYThreshold () {
707
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
708
-
709
- const virtualYOpts = $xeTable.computeVirtualYOpts
710
- const { threshold } = virtualYOpts
711
- if (threshold) {
712
- return XEUtils.toNumber(threshold)
713
- }
714
- return 0
715
- },
716
- rowHeightMaps () {
717
- return this.computeRowHeightMaps
718
- },
719
- computeRowHeightMaps () {
720
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
721
- const reactData = $xeTable as unknown as TableReactData
722
-
723
- return reactData.rowHeightStore
724
- },
725
- computeDefaultRowHeight () {
726
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
727
-
728
- const vSize = $xeTable.computeSize
729
- const rowHeightMaps = $xeTable.computeRowHeightMaps
730
- return rowHeightMaps[vSize || 'default'] || 18
731
- },
732
- columnOpts () {
733
- return this.computeColumnOpts
734
- },
735
- computeColumnOpts () {
736
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
737
- const props = $xeTable
738
-
739
- return Object.assign({}, getConfig().table.columnConfig, props.columnConfig)
740
- },
741
- computeCurrentColumnOpts () {
742
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
743
- const props = $xeTable
744
-
745
- return Object.assign({}, getConfig().table.currentColumnConfig, props.currentColumnConfig)
746
- },
747
- computeCellOpts () {
748
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
749
- const props = $xeTable
750
-
751
- const cellOpts = Object.assign({}, getConfig().table.cellConfig, props.cellConfig)
752
- if (cellOpts.height) {
753
- cellOpts.height = XEUtils.toNumber(cellOpts.height)
754
- }
755
- return cellOpts
756
- },
757
- computeHeaderCellOpts () {
758
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
759
- const $xeGantt = $xeTable.$xeGantt
760
- const props = $xeTable
761
-
762
- const headerCellOpts = Object.assign({}, getConfig().table.headerCellConfig, props.headerCellConfig)
763
- const defaultRowHeight = $xeTable.computeDefaultRowHeight
764
- const cellOpts = $xeTable.computeCellOpts
765
- let headCellHeight = XEUtils.toNumber(getCalcHeight(headerCellOpts.height || cellOpts.height))
766
- if ($xeGantt) {
767
- const taskViewScales = $xeGantt.computeTaskViewScales
768
- if (taskViewScales && taskViewScales.length > 2) {
769
- const ganttMinHeadCellHeight = defaultRowHeight / 2 * taskViewScales.length
770
- headCellHeight = Math.max(ganttMinHeadCellHeight, headCellHeight)
771
- }
772
- }
773
- headerCellOpts.height = headCellHeight
774
- return headerCellOpts
775
- },
776
- computeFooterCellOpts () {
777
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
778
- const props = $xeTable
779
-
780
- const footerCellOpts = Object.assign({}, getConfig().table.footerCellConfig, props.footerCellConfig)
781
- const cellOpts = $xeTable.computeCellOpts
782
- footerCellOpts.height = XEUtils.toNumber(getCalcHeight(footerCellOpts.height || cellOpts.height))
783
- return footerCellOpts
784
- },
785
- rowOpts () {
786
- return this.computeRowOpts
787
- },
788
- computeRowOpts () {
789
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
790
- const props = $xeTable
791
-
792
- return Object.assign({}, getConfig().table.rowConfig, props.rowConfig)
793
- },
794
- computeAggregateOpts () {
795
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
796
- const props = $xeTable
797
-
798
- return Object.assign({}, getConfig().table.aggregateConfig || getConfig().table.rowGroupConfig, props.aggregateConfig || props.rowGroupConfig)
799
- },
800
- computeAggregateAccuracyOpts () {
801
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
802
- const props = $xeTable
803
-
804
- return Object.assign({}, getConfig().table.aggregateAccuracyConfig, props.aggregateAccuracyConfig)
805
- },
806
- computeRowGroupOpts () {
807
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
808
-
809
- return $xeTable.computeAggregateOpts
810
- },
811
- computeCurrentRowOpts () {
812
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
813
- const props = $xeTable
814
-
815
- return Object.assign({}, getConfig().table.currentRowConfig, props.currentRowConfig)
816
- },
817
- computeRowDragOpts () {
818
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
819
- const props = $xeTable
820
-
821
- return Object.assign({}, getConfig().table.rowDragConfig, props.rowDragConfig)
822
- },
823
- computeColumnDragOpts () {
824
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
825
- const props = $xeTable
826
-
827
- return Object.assign({}, getConfig().table.columnDragConfig, props.columnDragConfig)
828
- },
829
- resizeOpts () {
830
- return this.computeResizeOpts
831
- },
832
- computeResizeOpts () {
833
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
834
- const props = $xeTable
835
-
836
- return Object.assign({}, getConfig().table.resizeConfig, props.resizeConfig)
837
- },
838
- resizableOpts () {
839
- return this.computeResizableOpts
840
- },
841
- computeResizableOpts () {
842
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
843
- const props = $xeTable
844
-
845
- return Object.assign({}, getConfig().table.resizableConfig, props.resizableConfig)
846
- },
847
- seqOpts () {
848
- return this.computeSeqOpts
849
- },
850
- computeSeqOpts () {
851
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
852
- const props = $xeTable
853
-
854
- return Object.assign({ startIndex: 0 }, getConfig().table.seqConfig, props.seqConfig)
855
- },
856
- radioOpts () {
857
- return this.computeRadioOpts
858
- },
859
- computeRadioOpts () {
860
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
861
- const props = $xeTable
862
-
863
- return Object.assign({}, getConfig().table.radioConfig, props.radioConfig)
864
- },
865
- checkboxOpts () {
866
- return this.computeCheckboxOpts
867
- },
868
- computeCheckboxOpts () {
869
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
870
- const props = $xeTable
871
-
872
- return Object.assign({}, getConfig().table.checkboxConfig, props.checkboxConfig)
873
- },
874
- tooltipOpts () {
875
- return this.computeTooltipOpts
876
- },
877
- computeTooltipOpts () {
878
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
879
- const props = $xeTable
880
-
881
- return Object.assign({}, getConfig().tooltip, getConfig().table.tooltipConfig, props.tooltipConfig)
882
- },
883
- tipConfig () {
884
- return { ...this.tooltipOpts }
885
- },
886
- computeHeaderTooltipOpts () {
887
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
888
- const props = $xeTable
889
-
890
- return Object.assign({}, getConfig().tooltip, getConfig().table.headerTooltipConfig, props.headerTooltipConfig)
891
- },
892
- computeFooterTooltipOpts () {
893
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
894
- const props = $xeTable
895
-
896
- return Object.assign({}, getConfig().tooltip, getConfig().table.footerTooltipConfig, props.footerTooltipConfig)
897
- },
898
- computeTableTipConfig () {
899
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
900
- const reactData = $xeTable as unknown as TableReactData
901
-
902
- const { tooltipStore } = reactData
903
- const tooltipOpts = $xeTable.computeTooltipOpts
904
- return Object.assign({}, tooltipOpts, tooltipStore.currOpts)
905
- },
906
- computeValidTipConfig () {
907
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
908
-
909
- const tooltipOpts = $xeTable.computeTooltipOpts
910
- return Object.assign({}, tooltipOpts)
911
- },
912
- validTipOpts () {
913
- return Object.assign({ isArrow: false }, this.tooltipOpts)
914
- },
915
- editOpts () {
916
- return this.computeEditOpts
917
- },
918
- computeEditOpts () {
919
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
920
- const props = $xeTable
921
-
922
- return Object.assign({}, getConfig().table.editConfig, props.editConfig)
923
- },
924
- computeEditDirtyOpts () {
925
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
926
- const props = $xeTable
927
-
928
- return Object.assign({}, getConfig().table.editDirtyConfig, props.editDirtyConfig)
929
- },
930
- sortOpts () {
931
- return this.computeSortOpts
932
- },
933
- computeSortOpts () {
934
- return Object.assign({ orders: ['asc', 'desc', null] }, getConfig().table.sortConfig, this.sortConfig)
935
- },
936
- filterOpts () {
937
- return this.computeFilterOpts
938
- },
939
- computeFilterOpts () {
940
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
941
- const props = $xeTable
942
-
943
- return Object.assign({}, getConfig().table.filterConfig, props.filterConfig)
944
- },
945
- computeFloatingFilterOpts () {
946
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
947
- const props = $xeTable
948
-
949
- return Object.assign({}, getConfig().table.floatingFilterConfig, props.floatingFilterConfig)
950
- },
951
- mouseOpts () {
952
- return this.computeMouseOpts
953
- },
954
- computeMouseOpts () {
955
- return Object.assign({}, getConfig().table.mouseConfig, this.mouseConfig)
956
- },
957
- areaOpts () {
958
- return this.computeAreaOpts
959
- },
960
- computeAreaOpts () {
961
- return Object.assign({}, getConfig().table.areaConfig, this.areaConfig)
962
- },
963
- keyboardOpts () {
964
- return this.computeKeyboardOpts
965
- },
966
- computeKeyboardOpts () {
967
- return Object.assign({}, getConfig().table.keyboardConfig, this.keyboardConfig)
968
- },
969
- clipOpts () {
970
- return this.computeClipOpts
971
- },
972
- computeClipOpts () {
973
- return Object.assign({}, getConfig().table.clipConfig, this.clipConfig)
974
- },
975
- fnrOpts () {
976
- return this.computeFnrOpts
977
- },
978
- computeFNROpts () {
979
- return this.computeFnrOpts
980
- },
981
- computeFnrOpts () {
982
- return Object.assign({}, getConfig().table.fnrConfig, this.fnrConfig)
983
- },
984
- headerCtxMenu () {
985
- return this.computeHeaderMenu
986
- },
987
- computeHeaderMenu () {
988
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
989
-
990
- const menuOpts = $xeTable.computeMenuOpts
991
- const headerOpts = menuOpts.header
992
- return headerOpts && headerOpts.options ? headerOpts.options : []
993
- },
994
- bodyCtxMenu () {
995
- return this.computeBodyMenu
996
- },
997
- computeBodyMenu () {
998
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
999
-
1000
- const menuOpts = $xeTable.computeMenuOpts
1001
- const bodyOpts = menuOpts.body
1002
- return bodyOpts && bodyOpts.options ? bodyOpts.options : []
1003
- },
1004
- footerCtxMenu () {
1005
- return this.computeFooterMenu
1006
- },
1007
- computeFooterMenu () {
1008
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1009
-
1010
- const menuOpts = $xeTable.computeMenuOpts
1011
- const footerOpts = menuOpts.footer
1012
- return footerOpts && footerOpts.options ? footerOpts.options : []
1013
- },
1014
- isCtxMenu () {
1015
- return this.computeIsContentMenu
1016
- },
1017
- computeIsMenu () {
1018
- return this.computeIsContentMenu
1019
- },
1020
- computeIsContentMenu () {
1021
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1022
- const props = $xeTable
1023
-
1024
- const menuOpts = $xeTable.computeMenuOpts
1025
- const headerMenu = $xeTable.computeHeaderMenu
1026
- const bodyMenu = $xeTable.computeBodyMenu
1027
- const footerMenu = $xeTable.computeFooterMenu
1028
- return !!(((props as any).contextMenu || props.menuConfig) && isEnableConf(menuOpts) && (headerMenu.length || bodyMenu.length || footerMenu.length))
1029
- },
1030
- ctxMenuList () {
1031
- return this.computeMenuList
1032
- },
1033
- computeMenuList () {
1034
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1035
- const reactData = $xeTable as unknown as TableReactData
1036
-
1037
- const { ctxMenuStore } = reactData
1038
- const rest: any[] = []
1039
- ctxMenuStore.list.forEach((list) => {
1040
- list.forEach((item) => {
1041
- rest.push(item)
1042
- })
1043
- })
1044
- return rest
1045
- },
1046
- ctxMenuOpts () {
1047
- return this.computeMenuOpts
1048
- },
1049
- computeMenuOpts () {
1050
- return Object.assign({}, getConfig().table.menuConfig, this.contextMenu, this.menuConfig)
1051
- },
1052
- computeLeftFixedWidth () {
1053
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1054
- const reactData = $xeTable as unknown as TableReactData
1055
-
1056
- const { columnStore } = reactData
1057
- const { leftList } = columnStore
1058
- let leftWidth = 0
1059
- for (let i = 0; i < leftList.length; i++) {
1060
- const column = leftList[i]
1061
- leftWidth += column.renderWidth
1062
- }
1063
- return leftWidth
1064
- },
1065
- computeRightFixedWidth () {
1066
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1067
- const reactData = $xeTable as unknown as TableReactData
1068
-
1069
- const { columnStore } = reactData
1070
- const { rightList } = columnStore
1071
- let leftWidth = 0
1072
- for (let i = 0; i < rightList.length; i++) {
1073
- const column = rightList[i]
1074
- leftWidth += column.renderWidth
1075
- }
1076
- return leftWidth
1077
- },
1078
- computeBodyMergeCoverFixed () {
1079
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1080
- const reactData = $xeTable as unknown as TableReactData
1081
- const internalData = $xeTable as unknown as TableInternalData
1082
-
1083
- const { columnStore, mergeBodyFlag } = reactData
1084
- const { mergeBodyList, visibleColumn } = internalData
1085
- const { leftList, rightList } = columnStore
1086
- const rscIndex = visibleColumn.length - rightList.length
1087
- if (mergeBodyFlag && (leftList.length || rightList.length)) {
1088
- const lecIndex = leftList.length
1089
- for (let i = 0; i < mergeBodyList.length; i++) {
1090
- const { col, colspan } = mergeBodyList[i]
1091
- if (col < lecIndex || (col + colspan) > rscIndex) {
1092
- return true
1093
- }
1094
- }
1095
- }
1096
- return false
1097
- },
1098
- computeIsHeaderRenderOptimize () {
1099
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1100
- const props = $xeTable
1101
- const reactData = $xeTable as unknown as TableReactData
1102
-
1103
- const { spanMethod, footerSpanMethod, showHeaderOverflow: allColumnHeaderOverflow } = props
1104
- const { isGroup, scrollXLoad } = reactData
1105
- let isOptimizeMode = false
1106
- if (isGroup) {
1107
- // 分组表头
1108
- } else {
1109
- // 如果是使用优化模式
1110
- if (scrollXLoad && allColumnHeaderOverflow) {
1111
- if (spanMethod || footerSpanMethod) {
1112
- // 如果不支持优化模式
1113
- } else {
1114
- isOptimizeMode = true
1115
- }
1116
- }
1117
- }
1118
- return isOptimizeMode
1119
- },
1120
- computeIsBodyRenderOptimize () {
1121
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1122
- const props = $xeTable
1123
- const reactData = $xeTable as unknown as TableReactData
1124
-
1125
- const { spanMethod, footerSpanMethod } = props
1126
- const { scrollXLoad, scrollYLoad, isAllOverflow, expandColumn } = reactData
1127
- const bodyMergeCoverFixed = $xeTable.computeBodyMergeCoverFixed
1128
- const expandOpts = $xeTable.computeExpandOpts
1129
- let isOptimizeMode = false
1130
- // 如果是使用优化模式
1131
- if (scrollXLoad || scrollYLoad || isAllOverflow) {
1132
- // 如果是展开行,内联模式,不支持优化
1133
- // 如果是方法合并,不支持优化
1134
- // 如果固定列且配置式合并,不支持优化
1135
- if ((expandColumn && expandOpts.mode !== 'fixed') || bodyMergeCoverFixed || spanMethod || footerSpanMethod) {
1136
- // 如果不支持优化模式
1137
- } else {
1138
- isOptimizeMode = true
1139
- }
1140
- }
1141
- return isOptimizeMode
1142
- },
1143
- computeIsFooterRenderOptimize () {
1144
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1145
- const props = $xeTable
1146
- const reactData = $xeTable as unknown as TableReactData
1147
-
1148
- const { spanMethod, footerSpanMethod, showFooterOverflow: allColumnFooterOverflow } = props
1149
- const { scrollXLoad } = reactData
1150
- let isOptimizeMode = false
1151
- // 如果是使用优化模式
1152
- if (scrollXLoad && allColumnFooterOverflow) {
1153
- if (spanMethod || footerSpanMethod) {
1154
- // 如果不支持优化模式
1155
- } else {
1156
- isOptimizeMode = true
1157
- }
1158
- }
1159
- return isOptimizeMode
1160
- },
1161
- exportOpts () {
1162
- return this.computeExportOpts
1163
- },
1164
- computeExportOpts () {
1165
- return Object.assign({}, getConfig().table.exportConfig, this.exportConfig)
1166
- },
1167
- importOpts () {
1168
- return this.computeImportOpts
1169
- },
1170
- computeImportOpts () {
1171
- return Object.assign({}, getConfig().table.importConfig, this.importConfig)
1172
- },
1173
- printOpts () {
1174
- return this.computePrintOpts
1175
- },
1176
- computePrintOpts () {
1177
- return Object.assign({}, getConfig().table.printConfig, this.printConfig)
1178
- },
1179
- expandOpts () {
1180
- return this.computeExpandOpts
1181
- },
1182
- computeExpandOpts () {
1183
- return Object.assign({}, getConfig().table.expandConfig, this.expandConfig)
1184
- },
1185
- treeOpts () {
1186
- return this.computeTreeOpts
1187
- },
1188
- computeTreeOpts () {
1189
- return Object.assign({}, getConfig().table.treeConfig, this.treeConfig)
1190
- },
1191
- emptyOpts () {
1192
- return this.computeEmptyOpts
1193
- },
1194
- computeEmptyOpts () {
1195
- return Object.assign({}, getConfig().table.emptyRender, this.emptyRender)
1196
- },
1197
- loadingOpts () {
1198
- return this.computeLoadingOpts
1199
- },
1200
- computeLoadingOpts () {
1201
- return Object.assign({}, getConfig().table.loadingConfig, this.loadingConfig)
1202
- },
1203
- computeCellOffsetWidth () {
1204
- return this.border ? Math.max(2, Math.ceil(this.scrollbarWidth / this.tableColumn.length)) : 1
1205
- },
1206
- customOpts () {
1207
- return this.computeCustomOpts
1208
- },
1209
- computeCustomOpts () {
1210
- return Object.assign({}, getConfig().table.customConfig, this.customConfig)
1211
- },
1212
- computeCustomSimpleMode () {
1213
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1214
- const props = $xeTable
1215
-
1216
- const { minHeight, height } = props
1217
- const customOpts = $xeTable.computeCustomOpts
1218
- const { mode, popupOptions, placement } = customOpts
1219
- if (!placement || placement === 'top-left' || placement === 'top-right') {
1220
- if (!(mode === 'modal' || mode === 'drawer')) {
1221
- const { mode } = popupOptions || {}
1222
- if (!mode || mode === 'auto') {
1223
- if (height || minHeight) {
1224
- return 'inside'
1225
- }
1226
- return 'outside'
1227
- }
1228
- if (mode) {
1229
- return mode
1230
- }
1231
- }
1232
- }
1233
- return ''
1234
- },
1235
- computeTableStyle () {
1236
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1237
-
1238
- const scrollbarOpts = $xeTable.computeScrollbarOpts
1239
- const { width, height } = scrollbarOpts
1240
- const tStys: VxeComponentStyleType = {}
1241
- if (width) {
1242
- tStys['--vxe-ui-table-view-scrollbar-width'] = toCssUnit(width)
1243
- }
1244
- if (height) {
1245
- tStys['--vxe-ui-table-view-scrollbar-height'] = toCssUnit(height)
1246
- }
1247
- return tStys
1248
- },
1249
- computeTableRowExpandedList () {
1250
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1251
- const reactData = $xeTable as unknown as TableReactData
1252
- const internalData = $xeTable as unknown as TableInternalData
1253
-
1254
- const { tableData, rowExpandedFlag, expandColumn, rowGroupExpandedFlag, treeExpandedFlag } = reactData
1255
- const { visibleDataRowIdData, rowExpandedMaps } = internalData
1256
- const expandList: any[] = []
1257
- if (tableData.length && expandColumn && rowExpandedFlag && rowGroupExpandedFlag && treeExpandedFlag) {
1258
- XEUtils.each(rowExpandedMaps, (row, rowid) => {
1259
- if (visibleDataRowIdData[rowid]) {
1260
- expandList.push(row)
1261
- }
1262
- })
1263
- }
1264
- return expandList
1265
- },
1266
- computeAutoWidthColumnList () {
1267
- const { tableColumn, visibleColumn } = this
1268
- return tableColumn.length || visibleColumn.length ? visibleColumn.filter((column: any) => column.width === 'auto' || column.minWidth === 'auto') : []
1269
- },
1270
- computeFixedColumnSize () {
1271
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1272
- const reactData = $xeTable as unknown as TableReactData
1273
- const internalData = $xeTable as unknown as TableInternalData
1274
-
1275
- const { tableColumn } = reactData
1276
- const { collectColumn } = internalData
1277
- let fixedSize = 0
1278
- // 只判断第一层
1279
- if (tableColumn.length && collectColumn.length) {
1280
- collectColumn.forEach((column: any) => {
1281
- if (column.renderFixed) {
1282
- fixedSize++
1283
- }
1284
- })
1285
- }
1286
- return fixedSize
1287
- },
1288
- fixedColumnSize () {
1289
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1290
-
1291
- return $xeTable.computeFixedColumnSize
1292
- },
1293
- computeIsMaxFixedColumn () {
1294
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1295
-
1296
- const fixedColumnSize = $xeTable.computeFixedColumnSize
1297
- const columnOpts = $xeTable.columnOpts
1298
- const { maxFixedSize } = columnOpts
1299
- if (maxFixedSize) {
1300
- return fixedColumnSize >= maxFixedSize
1301
- }
1302
- return false
1303
- },
1304
- computeKeepFields () {
1305
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1306
- const reactData = $xeTable as unknown as TableReactData
1307
- const internalData = $xeTable as unknown as TableInternalData
1308
-
1309
- const { tableFullColumn } = internalData
1310
- const { updateColFlag } = reactData
1311
- const editDirtyOpts = $xeTable.computeEditDirtyOpts
1312
- const { includeFields, excludeFields } = editDirtyOpts
1313
- const kpFields: string[] = []
1314
- if (updateColFlag) {
1315
- if (includeFields && includeFields.length) {
1316
- return includeFields
1317
- }
1318
- const exfMaps: Record<string, number> = {}
1319
- if (excludeFields && excludeFields.length) {
1320
- excludeFields.forEach(field => {
1321
- exfMaps[field] = 1
1322
- })
1323
- }
1324
- for (let i = 0; i < tableFullColumn.length; i++) {
1325
- const column = tableFullColumn[i]
1326
- const { field, type, editRender, cellRender } = column
1327
- if (field && !type && (editRender || cellRender) && !exfMaps[field]) {
1328
- kpFields.push(field)
1329
- }
1330
- }
1331
- }
1332
- return kpFields
1333
- },
1334
- computeTableBorder () {
1335
- const $xeTable = this
1336
- const props = $xeTable
1337
-
1338
- const { border } = props
1339
- if (border === true) {
1340
- return 'full'
1341
- }
1342
- if (border) {
1343
- return border
1344
- }
1345
- return 'default'
1346
- },
1347
- /**
1348
- * 判断列全选的复选框是否禁用
1349
- */
1350
- computeIsAllCheckboxDisabled () {
1351
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1352
- const props = $xeTable
1353
- const reactData = $xeTable as unknown as TableReactData
1354
- const internalData = $xeTable as unknown as TableInternalData
1355
-
1356
- const { treeConfig } = props
1357
- const { tableData } = reactData
1358
- const { tableFullData } = internalData
1359
- const checkboxOpts = $xeTable.computeCheckboxOpts
1360
- const { strict, checkMethod } = checkboxOpts
1361
- if (strict) {
1362
- if (tableData.length || tableFullData.length) {
1363
- if (checkMethod) {
1364
- if (treeConfig) {
1365
- // 暂时不支持树形结构
1366
- }
1367
- // 如果所有行都被禁用
1368
- return tableFullData.every((row) => !checkMethod({ $table: $xeTable, row }))
1369
- }
1370
- return false
1371
- }
1372
- return true
1373
- }
1374
- return false
1375
- },
1376
- isAllCheckboxDisabled () {
1377
- return this.computeIsAllCheckboxDisabled
1378
- },
1379
- computeVirtualScrollBars () {
1380
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1381
- const reactData = $xeTable as unknown as TableReactData
1382
-
1383
- const { overflowX, scrollXLoad, overflowY, scrollYLoad } = reactData
1384
- return {
1385
- x: overflowX && scrollXLoad,
1386
- y: overflowY && scrollYLoad
1387
- }
1388
- },
1389
- computeRowGroupFields () {
1390
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1391
-
1392
- const aggregateOpts = $xeTable.computeAggregateOpts
1393
- return aggregateOpts.groupFields
1394
- },
1395
- computeRowGroupColumns () {
1396
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1397
- const reactData = $xeTable as unknown as TableReactData
1398
- const internalData = $xeTable as unknown as TableInternalData
1399
-
1400
- const { rowGroupList } = reactData
1401
- const { fullColumnFieldData } = internalData
1402
- const rgColumns: VxeTableDefines.ColumnInfo[] = []
1403
- rowGroupList.forEach(aggConf => {
1404
- const colRest = fullColumnFieldData[aggConf.field]
1405
- if (colRest) {
1406
- rgColumns.push(colRest.column)
1407
- }
1408
- })
1409
- return rgColumns
1410
- },
1411
- computeAggFuncColumns () {
1412
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1413
- const reactData = $xeTable as unknown as TableReactData
1414
-
1415
- const { rowGroupList, tableColumn } = reactData
1416
- if (rowGroupList.length) {
1417
- return tableColumn.filter(column => column.field && column.aggFunc)
1418
- }
1419
- return []
1420
- },
1421
- computeUndoHistoryOpts () {
1422
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1423
- const props = $xeTable
1424
-
1425
- return Object.assign({}, getConfig().table.undoHistoryConfig, props.undoHistoryConfig)
1426
- },
1427
- tabsResizeFlag () {
1428
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1429
- const $xeTabs = $xeTable.$xeTabs
1430
-
1431
- return $xeTabs ? $xeTabs.reactData.resizeFlag : null
1432
- },
1433
- computeVxeLanguage () {
1434
- return VxeUI.getLanguage()
1435
- },
1436
- computeScrollbarVisible () {
1437
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1438
-
1439
- const scrollbarXOpts = $xeTable.computeScrollbarXOpts
1440
- const scrollbarYOpts = $xeTable.computeScrollbarYOpts
1441
- return `${scrollbarXOpts.visible}${scrollbarYOpts.visible}`
1442
- }
1443
- } as any,
1444
- watch: {
1445
- data (value: any) {
1446
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1447
- const reactData = $xeTable as unknown as TableReactData
1448
-
1449
- const { initStatus } = this
1450
- if (value && value.length >= 20000) {
1451
- warnLog('vxe.error.errLargeData', ['loadData(data), reloadData(data)'])
1452
- }
1453
- this.loadTableData(value || [], true, true).then(() => {
1454
- const { scrollXLoad, scrollYLoad, expandColumn } = reactData
1455
- const expandOpts = $xeTable.computeExpandOpts
1456
- this.inited = true
1457
- this.initStatus = true
1458
- if (!initStatus) {
1459
- this.handleLoadDefaults()
1460
- }
1461
- // const checkboxColumn = this.tableFullColumn.find(column => column.type === 'checkbox')
1462
- // if (checkboxColumn && this.tableFullData.length > 300 && !this.checkboxOpts.checkField) {
1463
- // warnLog('vxe.error.checkProp', ['checkbox-config.checkField'])
1464
- // }
1465
- if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
1466
- warnLog('vxe.error.scrollErrProp', ['column.type=expand'])
1467
- }
1468
- this.recalculate()
1469
- })
1470
- },
1471
- staticColumns (value: any) {
1472
- this.$nextTick(() => this.handleInitColumn(XEUtils.clone(value)))
1473
- },
1474
- tableColumn () {
1475
- this.analyColumnWidth()
1476
- },
1477
- upDataFlag () {
1478
- this.$nextTick().then(() => this.updateData())
1479
- },
1480
- reColumnFlag () {
1481
- this.$nextTick().then(() => this.refreshColumn())
1482
- },
1483
-
1484
- computeSize () {
1485
- this.reLayoutFlag++
1486
- },
1487
- showHeader () {
1488
- this.reLayoutFlag++
1489
- },
1490
- showFooter () {
1491
- this.reLayoutFlag++
1492
- },
1493
- overflowX () {
1494
- this.reLayoutFlag++
1495
- },
1496
- overflowY () {
1497
- this.reLayoutFlag++
1498
- },
1499
- height () {
1500
- this.reLayoutFlag++
1501
- },
1502
- maxHeight () {
1503
- this.reLayoutFlag++
1504
- },
1505
- computeScrollbarXToTop () {
1506
- this.reLayoutFlag++
1507
- },
1508
- computeScrollbarYToLeft () {
1509
- this.reLayoutFlag++
1510
- },
1511
- computeVxeLanguage () {
1512
- this.reLayoutFlag++
1513
- },
1514
- computeScrollbarVisible () {
1515
- this.reLayoutFlag++
1516
- },
1517
- reLayoutFlag () {
1518
- const $xeTable = this
1519
-
1520
- $xeTable.$nextTick(() => $xeTable.recalculate(true))
1521
- },
1522
-
1523
- footerData () {
1524
- this.footFlag++
1525
- },
1526
- footFlag () {
1527
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1528
- const internalData = $xeTable as unknown as TableInternalData
1529
-
1530
- internalData.footerFullDataRowData = {}
1531
- $xeTable.updateFooter()
1532
- },
1533
-
1534
- updateColFlag () {
1535
- this.kfFlag++
1536
- },
1537
- computeKeepFields () {
1538
- this.kfFlag++
1539
- },
1540
- kfFlag () {
1541
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1542
- const internalData = $xeTable as unknown as TableInternalData
1543
-
1544
- const keepFields = $xeTable.computeKeepFields
1545
- const kpfMaps: Record<string, number> = {}
1546
- keepFields.forEach(field => {
1547
- kpfMaps[field] = 1
1548
- })
1549
- internalData.keepUpdateFieldMaps = kpfMaps
1550
- },
1551
-
1552
- syncResize (value: any) {
1553
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1554
-
1555
- if (value) {
1556
- handleUpdateResize($xeTable)
1557
- $xeTable.$nextTick(() => {
1558
- handleUpdateResize($xeTable)
1559
- setTimeout(() => handleUpdateResize($xeTable))
1560
- })
1561
- }
1562
- },
1563
- tabsResizeFlag () {
1564
- this.handleGlobalResizeEvent()
1565
- },
1566
- mergeCells (value: any) {
1567
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1568
-
1569
- handleUpdateMergeBodyCells($xeTable, value)
1570
- },
1571
- mergeHeaderCells (value: any) {
1572
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1573
-
1574
- handleUpdateMergeHeaderCells($xeTable, value)
1575
- },
1576
- mergeFooterCells () {
1577
- this.mergeFooteCellFlag++
1578
- },
1579
- mergeFooterItems () {
1580
- this.mergeFooteCellFlag++
1581
- },
1582
- mergeFooteCellFlag () {
1583
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1584
- const props = $xeTable
1585
-
1586
- const mFooterCells = props.mergeFooterCells || props.mergeFooterItems
1587
- handleUpdateMergeFooterCells($xeTable, mFooterCells || [])
1588
- },
1589
-
1590
- computeRowGroupFields (val: any) {
1591
- const $xeTable = this
1592
-
1593
- $xeTable.handleUpdateRowGroup(val)
1594
- },
1595
- computeRowField () {
1596
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1597
- const reactData = $xeTable as unknown as TableReactData
1598
- const internalData = $xeTable as unknown as TableInternalData
1599
-
1600
- // 行主键被改变,重载表格
1601
- const { inited, tableFullData } = internalData
1602
- if (inited) {
1603
- handleKeyField($xeTable)
1604
- reactData.tableData = []
1605
- $xeTable.$nextTick(() => {
1606
- $xeTable.reloadData(tableFullData)
1607
- })
1608
- }
1609
- }
1610
- } as any,
1611
- created () {
1612
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1613
- const props = $xeTable
1614
- const internalData = $xeTable as unknown as TableInternalData
1615
-
1616
- XEUtils.assign(internalData, createInternalData())
1617
-
1618
- handleKeyField($xeTable)
1619
-
1620
- const { exportConfig, importConfig, treeConfig, minHeight } = props
1621
- const { scrollXStore, scrollYStore } = internalData
1622
- const columnOpts = $xeTable.computeColumnOpts
1623
- const columnDragOpts = $xeTable.computeColumnDragOpts
1624
- const editOpts = $xeTable.computeEditOpts
1625
- const treeOpts = $xeTable.computeTreeOpts
1626
- const radioOpts = $xeTable.computeRadioOpts
1627
- const checkboxOpts = $xeTable.computeCheckboxOpts
1628
- const expandOpts = $xeTable.computeExpandOpts
1629
- const rowOpts = $xeTable.computeRowOpts
1630
- const customOpts = $xeTable.computeCustomOpts
1631
- const mouseOpts = $xeTable.computeMouseOpts
1632
- const exportOpts = $xeTable.computeExportOpts
1633
- const importOpts = $xeTable.computeImportOpts
1634
- // const currentRowOpts = $xeTable.computeCurrentRowOpts
1635
- // const currentColumnOpts = $xeTable.computeCurrentColumnOpts
1636
- // const keyboardOpts = $xeTable.computeKeyboardOpts
1637
- const aggregateOpts = $xeTable.computeAggregateOpts
1638
- const rowDragOpts = $xeTable.computeRowDragOpts
1639
- const areaOpts = $xeTable.computeAreaOpts
1640
- const { groupFields } = aggregateOpts
1641
-
1642
- if (props.rowId) {
1643
- warnLog('vxe.error.delProp', ['row-id', 'row-config.keyField'])
1644
- }
1645
- if (props.rowKey) {
1646
- warnLog('vxe.error.delProp', ['row-key', 'row-config.useKey'])
1647
- }
1648
- if (props.columnKey) {
1649
- warnLog('vxe.error.delProp', ['column-id', 'column-config.useKey'])
1650
- }
1651
- if (!(props.rowId || rowOpts.keyField) && (checkboxOpts.reserve || checkboxOpts.checkRowKeys || radioOpts.reserve || radioOpts.checkRowKey || expandOpts.expandRowKeys || treeOpts.expandRowKeys)) {
1652
- warnLog('vxe.error.reqProp', ['row-config.keyField'])
1653
- }
1654
- if (props.editConfig && editOpts.showStatus && !props.keepSource) {
1655
- warnLog('vxe.error.reqProp', ['keep-source'])
1656
- }
1657
- // if (treeConfig && (treeOpts.showLine || treeOpts.line) && !showOverflow) {
1658
- // warnLog('vxe.error.reqProp', ['show-overflow'])
1659
- // }
1660
- if (treeConfig && !treeOpts.transform && props.stripe) {
1661
- warnLog('vxe.error.noTree', ['stripe'])
1662
- }
1663
- if (props.showFooter && !(props.footerMethod || props.footerData)) {
1664
- warnLog('vxe.error.reqProp', ['footer-data | footer-method'])
1665
- }
1666
- if (rowOpts.height) {
1667
- warnLog('vxe.error.delProp', ['row-config.height', 'cell-config.height'])
1668
- }
1669
- if (this.tooltipOpts.enabled) {
1670
- warnLog('vxe.error.delProp', ['tooltip-config.enabled', 'tooltip-config.showAll'])
1671
- }
1672
- if (this.highlightCurrentRow) {
1673
- warnLog('vxe.error.delProp', ['highlight-current-row', 'row-config.isCurrent'])
1674
- }
1675
- if (this.highlightHoverRow) {
1676
- warnLog('vxe.error.delProp', ['highlight-hover-row', 'row-config.isHover'])
1677
- }
1678
- if (this.highlightCurrentColumn) {
1679
- warnLog('vxe.error.delProp', ['highlight-current-column', 'column-config.isCurrent'])
1680
- }
1681
- if (this.highlightHoverColumn) {
1682
- warnLog('vxe.error.delProp', ['highlight-hover-column', 'column-config.isHover'])
1683
- }
1684
- if (props.resizable) {
1685
- warnLog('vxe.error.delProp', ['resizable', 'column-config.resizable'])
1686
- }
1687
- // if (props.virtualXConfig && props.scrollX) {
1688
- // warnLog('vxe.error.notSupportProp', ['virtual-x-config', 'scroll-x', 'scroll-x=null'])
1689
- // }
1690
- // if (props.virtualYConfig && props.scrollY) {
1691
- // warnLog('vxe.error.notSupportProp', ['virtual-y-config', 'scroll-y', 'scroll-y=null'])
1692
- // }
1693
- if (props.aggregateConfig && props.rowGroupConfig) {
1694
- warnLog('vxe.error.notSupportProp', ['aggregate-config', 'row-group-config', 'row-group-config=null'])
1695
- }
1696
- // if (props.scrollY) {
1697
- // warnLog('vxe.error.delProp', ['scroll-y', 'virtual-y-config'])
1698
- // }
1699
- // if (props.scrollX) {
1700
- // warnLog('vxe.error.delProp', ['scroll-x', 'virtual-x-config'])
1701
- // }
1702
- // 检查导入导出类型,如果自定义导入导出方法,则不校验类型
1703
- if (importConfig && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(XEUtils.keys(importOpts._typeMaps), importOpts.types)) {
1704
- warnLog('vxe.error.errProp', [`export-config.types=${importOpts.types.join(',')}`, importOpts.types.filter((type) => XEUtils.includes(XEUtils.keys(importOpts._typeMaps), type)).join(',') || XEUtils.keys(importOpts._typeMaps).join(',')])
1705
- }
1706
- if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(XEUtils.keys(exportOpts._typeMaps), exportOpts.types)) {
1707
- warnLog('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter((type) => XEUtils.includes(XEUtils.keys(exportOpts._typeMaps), type)).join(',') || XEUtils.keys(exportOpts._typeMaps).join(',')])
1708
- }
1709
-
1710
- if (!props.id) {
1711
- if ((props.customConfig ? isEnableConf(customOpts) : customOpts.enabled) && customOpts.storage) {
1712
- errLog('vxe.error.reqProp', ['id'])
1713
- }
1714
- }
1715
- if (treeConfig && checkboxOpts.range) {
1716
- errLog('vxe.error.noTree', ['checkbox-config.range'])
1717
- }
1718
- if (rowOpts.height && !this.showOverflow) {
1719
- warnLog('vxe.error.notProp', ['table.show-overflow'])
1720
- }
1721
- if (!$xeTable.triggerClAreaModnEvent) {
1722
- if (props.areaConfig) {
1723
- warnLog('vxe.error.notProp', ['area-config'])
1724
- }
1725
- if (props.clipConfig) {
1726
- warnLog('vxe.error.notProp', ['clip-config'])
1727
- }
1728
- if (props.fnrConfig) {
1729
- warnLog('vxe.error.notProp', ['fnr-config'])
1730
- }
1731
- if (mouseOpts.area) {
1732
- errLog('vxe.error.notProp', ['mouse-config.area'])
1733
- return
1734
- }
1735
- if (mouseOpts.area && areaOpts.selectCellByHeader && columnOpts.drag && columnDragOpts.trigger === 'cell') {
1736
- errLog('vxe.error.notSupportProp', ['area-config.selectCellByHeader & column-config.drag', 'column-drag-config.trigger=cell', 'column-drag-config.trigger=default | area-config.selectCellByHeader=false'])
1737
- }
1738
- }
1739
- if (!$xeTable.handlePivotTableAggregateData) {
1740
- if (customOpts.allowGroup) {
1741
- errLog('vxe.error.notProp', ['custom-config.allowGroup'])
1742
- return
1743
- }
1744
- if (customOpts.allowValues) {
1745
- errLog('vxe.error.notProp', ['custom-config.allowValues'])
1746
- return
1747
- }
1748
- }
1749
- if (treeConfig && rowOpts.drag && !treeOpts.transform) {
1750
- warnLog('vxe.error.notSupportProp', ['row-config.drag', 'tree-config.transform=false', 'tree-config.transform=true'])
1751
- }
1752
- if (treeConfig && rowDragOpts.isCrossTableDrag && !rowDragOpts.isCrossDrag) {
1753
- errLog('vxe.error.reqSupportProp', ['tree-config & row-drag-config.isCrossTableDrag', 'row-drag-config.isCrossDrag'])
1754
- }
1755
- if (props.dragConfig) {
1756
- warnLog('vxe.error.delProp', ['drag-config', 'row-drag-config'])
1757
- }
1758
- if (props.rowGroupConfig) {
1759
- warnLog('vxe.error.delProp', ['row-group-config', 'aggregate-config'])
1760
- }
1761
- if (aggregateOpts.countFields) {
1762
- warnLog('vxe.error.delProp', ['row-group-config.countFields', 'column.agg-func'])
1763
- }
1764
- if (aggregateOpts.aggregateMethod) {
1765
- warnLog('vxe.error.delProp', ['row-group-config.aggregateMethod', 'aggregate-config.calcValuesMethod'])
1766
- }
1767
- if (aggregateOpts.countMethod) {
1768
- warnLog('vxe.error.delProp', ['aggregate-config.countMethod', 'aggregate-config.calcValuesMethod'])
1769
- }
1770
- if (props.treeConfig && treeOpts.children) {
1771
- warnLog('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField'])
1772
- }
1773
- if (props.treeConfig && treeOpts.line) {
1774
- warnLog('vxe.error.delProp', ['tree-config.line', 'tree-config.showLine'])
1775
- }
1776
- if (mouseOpts.area && mouseOpts.selected) {
1777
- warnLog('vxe.error.errConflicts', ['mouse-config.area', 'mouse-config.selected'])
1778
- }
1779
- if (mouseOpts.area && (props.treeConfig && !treeOpts.transform)) {
1780
- errLog('vxe.error.noTree', ['mouse-config.area'])
1781
- }
1782
- if (props.editConfig && editOpts.activeMethod) {
1783
- warnLog('vxe.error.delProp', ['table.edit-config.activeMethod', 'table.edit-config.beforeEditMethod'])
1784
- }
1785
- if (props.treeConfig && checkboxOpts.isShiftKey) {
1786
- errLog('vxe.error.errConflicts', ['tree-config', 'checkbox-config.isShiftKey'])
1787
- }
1788
- if (checkboxOpts.halfField) {
1789
- warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField'])
1790
- }
1791
- if (props.editConfig && isEnableConf(editOpts) && props.editRules && (minHeight === 0 || minHeight === '0')) {
1792
- warnLog('vxe.error.reqSupportProp', ['edit-config & edit-rules', 'min-height'])
1793
- }
1794
-
1795
- if (treeConfig) {
1796
- XEUtils.arrayEach(['rowField', 'parentField', 'childrenField', 'hasChildField', 'mapChildrenField'], key => {
1797
- const val = treeOpts[key as 'rowField']
1798
- if (val && val.indexOf('.') > -1) {
1799
- errLog('vxe.error.errProp', [`${key}=${val}`, `${key}=${val.split('.')[0]}`])
1800
- }
1801
- })
1802
- }
1803
-
1804
- // 在 v3.0 中废弃 context-menu
1805
- if (this.contextMenu) {
1806
- warnLog('vxe.error.delProp', ['context-menu', 'menu-config'])
1807
- if (!XEUtils.isObject(this.contextMenu)) {
1808
- warnLog('vxe.error.errProp', [`table.context-menu=${this.contextMenu}`, 'table.context-menu={}'])
1809
- }
1810
- }
1811
- if (props.menuConfig && !XEUtils.isObject(props.menuConfig)) {
1812
- warnLog('vxe.error.errProp', [`table.menu-config=${props.menuConfig}`, 'table.menu-config={}'])
1813
- }
1814
- if (props.exportConfig && !XEUtils.isObject(props.exportConfig)) {
1815
- warnLog('vxe.error.errProp', [`table.export-config=${props.exportConfig}`, 'table.export-config={}'])
1816
- }
1817
- if (props.importConfig && !XEUtils.isObject(props.importConfig)) {
1818
- warnLog('vxe.error.errProp', [`table.import-config=${props.importConfig}`, 'table.import-config={}'])
1819
- }
1820
- if (props.printConfig && !XEUtils.isObject(props.printConfig)) {
1821
- warnLog('vxe.error.errProp', [`table.print-config=${props.printConfig}`, 'table.print-config={}'])
1822
- }
1823
- if (props.treeConfig && !XEUtils.isObject(props.treeConfig)) {
1824
- warnLog('vxe.error.errProp', [`table.tree-config=${props.treeConfig}`, 'table.tree-config={}'])
1825
- }
1826
- if (props.customConfig && !XEUtils.isObject(props.customConfig)) {
1827
- warnLog('vxe.error.errProp', [`table.custom-config=${props.customConfig}`, 'table.custom-config={}'])
1828
- }
1829
- if (props.editConfig && !XEUtils.isObject(props.editConfig)) {
1830
- warnLog('vxe.error.errProp', [`table.edit-config=${props.editConfig}`, 'table.edit-config={}'])
1831
- }
1832
- if (props.emptyRender && !XEUtils.isObject(props.emptyRender)) {
1833
- warnLog('vxe.error.errProp', [`table.empty-render=${props.emptyRender}`, 'table.empty-render={}'])
1834
- }
1835
-
1836
- if (rowOpts.currentMethod) {
1837
- warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-row-config.beforeSelectMethod'])
1838
- }
1839
- if (columnOpts.currentMethod) {
1840
- warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-column-config.beforeSelectMethod'])
1841
- }
1842
- // if ((rowOpts.isCurrent || highlightCurrentRow) && props.keyboardConfig && keyboardOpts.isArrow && !XEUtils.isBoolean(currentRowOpts.isFollowSelected)) {
1843
- // warnLog('vxe.error.notConflictProp', ['row-config.isCurrent & keyboard-config.isArrow', 'current-row-config.isFollowSelected'])
1844
- // }
1845
- // if ((columnOpts.isCurrent || highlightCurrentColumn) && props.keyboardConfig && keyboardOpts.isArrow && !XEUtils.isBoolean(currentColumnOpts.isFollowSelected)) {
1846
- // warnLog('vxe.error.notConflictProp', ['column-config.isCurrent & keyboard-config.isArrow', 'current-column-config.isFollowSelected'])
1847
- // }
1848
-
1849
- // 如果不支持虚拟滚动
1850
- // if (props.spanMethod) {
1851
- // if (virtualXOpts.enabled) {
1852
- // warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-x-config.enabled=false'])
1853
- // }
1854
- // if (virtualYOpts.enabled) {
1855
- // warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-y-config.enabled=false'])
1856
- // }
1857
- // }
1858
- // if (props.footerSpanMethod) {
1859
- // if (virtualXOpts.enabled) {
1860
- // warnLog('vxe.error.notConflictProp', ['footer-span-method', 'virtual-x-config.enabled=false'])
1861
- // }
1862
- // }
1863
-
1864
- // 检查是否有安装需要的模块
1865
- if (props.editConfig && !$xeTable.insert) {
1866
- errLog('vxe.error.reqModule', ['Edit'])
1867
- }
1868
- if (props.editRules && !$xeTable.validate) {
1869
- errLog('vxe.error.reqModule', ['Validator'])
1870
- }
1871
- if ((checkboxOpts.range || props.keyboardConfig || props.mouseConfig) && !$xeTable.handleCellMousedownEvent) {
1872
- errLog('vxe.error.reqModule', ['Keyboard'])
1873
- }
1874
- if ((props.printConfig || props.importConfig || props.exportConfig) && !$xeTable.exportData) {
1875
- errLog('vxe.error.reqModule', ['Export'])
1876
- }
1877
-
1878
- Object.assign(scrollYStore, {
1879
- startIndex: 0,
1880
- endIndex: 1,
1881
- visibleSize: 0
1882
- })
1883
- Object.assign(scrollXStore, {
1884
- startIndex: 0,
1885
- endIndex: 1,
1886
- visibleSize: 0
1887
- })
1888
-
1889
- this.handleUpdateRowGroup(groupFields)
1890
-
1891
- this.initData()
1892
-
1893
- globalEvents.on($xeTable, 'paste', this.handleGlobalPasteEvent)
1894
- globalEvents.on($xeTable, 'copy', this.handleGlobalCopyEvent)
1895
- globalEvents.on($xeTable, 'cut', this.handleGlobalCutEvent)
1896
- globalEvents.on($xeTable, 'mousedown', this.handleGlobalMousedownEvent)
1897
- globalEvents.on($xeTable, 'blur', this.handleGlobalBlurEvent)
1898
- globalEvents.on($xeTable, 'mousewheel', this.handleGlobalMousewheelEvent)
1899
- globalEvents.on($xeTable, 'keydown', this.handleGlobalKeydownEvent)
1900
- globalEvents.on($xeTable, 'resize', this.handleGlobalResizeEvent)
1901
- globalEvents.on($xeTable, 'contextmenu', this.handleGlobalContextmenuEvent)
1902
- $xeTable.preventEvent(null, 'created')
1903
- },
1904
- mounted () {
1905
- const $xeTable = this
1906
- const props = $xeTable
1907
- const internalData = $xeTable as unknown as TableInternalData
1908
- const $xeGrid = $xeTable.$xeGrid
1909
- const $xeGantt = $xeTable.$xeGantt
1910
- const $xeGGWrapper = $xeGrid || $xeGantt
1911
-
1912
- const columnOpts = $xeTable.computeColumnOpts
1913
- const rowOpts = $xeTable.computeRowOpts
1914
- const customOpts = $xeTable.computeCustomOpts
1915
- const virtualYOpts = $xeTable.computeVirtualYOpts
1916
-
1917
- if ($xeGantt) {
1918
- const classifyWrapperEl = $xeGantt.$refs.refClassifyWrapperElem as HTMLDivElement
1919
- const teleportWrapperEl = $xeTable.$refs.refTeleportWrapper as HTMLDivElement
1920
- if (classifyWrapperEl) {
1921
- if (teleportWrapperEl) {
1922
- classifyWrapperEl.appendChild(teleportWrapperEl)
1923
- }
1924
- internalData.teleportToWrapperElem = classifyWrapperEl
1925
- }
1926
- }
1927
- if ($xeGGWrapper) {
1928
- const popupContainerElem = $xeGGWrapper.$refs.refPopupContainerElem as HTMLDivElement
1929
- const popupWrapperEl = $xeTable.$refs.refPopupWrapperElem as HTMLDivElement
1930
- if (popupContainerElem) {
1931
- if (popupWrapperEl) {
1932
- popupContainerElem.appendChild(popupWrapperEl)
1933
- }
1934
- internalData.popupToWrapperElem = popupContainerElem
1935
- }
1936
- }
1937
-
1938
- if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
1939
- initTpImg()
1940
- }
1941
-
1942
- const { $listeners } = this
1943
- if (!this.menuConfig && ($listeners['menu-click'] || $listeners['cell-menu'] || $listeners['header-cell-menu'] || $listeners['footer-cell-menu'])) {
1944
- warnLog('vxe.error.reqProp', ['menu-config'])
1945
- }
1946
- if (!this.tooltipConfig && ($listeners['cell-mouseenter'] || $listeners['cell-mouseleave'])) {
1947
- warnLog('vxe.error.reqProp', ['tooltip-config'])
1948
- }
1949
-
1950
- $xeTable.$nextTick(() => {
1951
- // 使用已安装的组件,如果未安装则不渲染
1952
- const VxeUILoadingComponent = VxeUI.getComponent('VxeLoading')
1953
- const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
1954
-
1955
- if (props.loading) {
1956
- if (!VxeUILoadingComponent && !this.$scopedSlots.loading) {
1957
- errLog('vxe.error.errProp', ['loading=true', 'loading=false | <template #loading>...</template>'])
1958
- errLog('vxe.error.reqComp', ['vxe-loading'])
1959
- }
1960
- }
1961
- if ((props.showOverflow === true || props.showOverflow === 'tooltip') ||
1962
- (props.showHeaderOverflow === true || props.showHeaderOverflow === 'tooltip') ||
1963
- (props.showFooterOverflow === true || props.showFooterOverflow === 'tooltip') ||
1964
- props.tooltipConfig || props.editRules) {
1965
- if (!VxeUITooltipComponent) {
1966
- if (props.showOverflow === true) {
1967
- errLog('vxe.error.errProp', ['show-overflow=true', 'show-overflow=title'])
1968
- }
1969
- if (props.showOverflow === 'tooltip') {
1970
- errLog('vxe.error.errProp', ['show-overflow=tooltip', 'show-overflow=title'])
1971
- }
1972
- if (props.showHeaderOverflow === true) {
1973
- errLog('vxe.error.errProp', ['show-header-overflow=true', 'show-header-overflow=title'])
1974
- }
1975
- if (props.showHeaderOverflow === 'tooltip') {
1976
- errLog('vxe.error.errProp', ['show-header-overflow=tooltip', 'show-header-overflow=title'])
1977
- }
1978
- if (props.showFooterOverflow === true) {
1979
- errLog('vxe.error.errProp', ['show-footer-overflow=true', 'show-footer-overflow=title'])
1980
- }
1981
- if (props.showFooterOverflow === 'tooltip') {
1982
- errLog('vxe.error.errProp', ['show-footer-overflow=tooltip', 'show-footer-overflow=title'])
1983
- }
1984
- errLog('vxe.error.reqComp', ['vxe-tooltip'])
1985
- }
1986
- }
1987
-
1988
- if (this.autoResize) {
1989
- const resizeObserver = globalResize.create(() => {
1990
- if (this.autoResize) {
1991
- this.handleResizeEvent()
1992
- }
1993
- })
1994
- resizeObserver.observe(this.$el)
1995
- resizeObserver.observe(this.getParentElem())
1996
- this.$resize = resizeObserver
1997
- }
1998
- })
1999
-
2000
- if (virtualYOpts.mode !== 'scroll') {
2001
- const tableViewportEl = $xeTable.$refs.refTableViewportElem as HTMLDivElement
2002
- if (tableViewportEl) {
2003
- tableViewportEl.addEventListener('wheel', $xeTable.triggerBodyWheelEvent, { passive: false })
2004
- }
2005
- }
2006
-
2007
- $xeTable.preventEvent(null, 'mounted')
2008
- },
2009
- activated () {
2010
- this.recalculate().then(() => this.refreshScroll())
2011
- this.preventEvent(null, 'activated')
2012
- },
2013
- deactivated () {
2014
- const $xeTable = this
2015
- const reactData = $xeTable as unknown as TableReactData
2016
- const internalData = $xeTable as unknown as TableInternalData
2017
-
2018
- const { filterStore } = reactData
2019
- if (filterStore.visible) {
2020
- $xeTable.clearFilter()
2021
- }
2022
- $xeTable.closeTooltip()
2023
- internalData.isActivated = false
2024
- this.preventEvent(null, 'deactivated')
2025
- },
2026
- beforeDestroy () {
2027
- const $xeTable = this
2028
- const reactData = $xeTable as unknown as TableReactData
2029
- const internalData = $xeTable as unknown as TableInternalData
2030
-
2031
- const teleportWrapperEl = $xeTable.$refs.refTeleportWrapper as HTMLDivElement
2032
- if (teleportWrapperEl && teleportWrapperEl.parentElement) {
2033
- teleportWrapperEl.parentElement.removeChild(teleportWrapperEl)
2034
- }
2035
- const popupWrapperEl = $xeTable.$refs.refPopupWrapperElem as HTMLDivElement
2036
- if (popupWrapperEl && popupWrapperEl.parentElement) {
2037
- popupWrapperEl.parentElement.removeChild(popupWrapperEl)
2038
- }
2039
- const tableViewportEl = $xeTable.$refs.refTableViewportElem as HTMLDivElement
2040
- if (tableViewportEl) {
2041
- tableViewportEl.removeEventListener('wheel', $xeTable.triggerBodyWheelEvent)
2042
- }
2043
- if (this.$resize) {
2044
- this.$resize.disconnect()
2045
- }
2046
- $xeTable.closeTooltip()
2047
- $xeTable.closeFilter()
2048
- $xeTable.closeMenu()
2049
-
2050
- globalEvents.off($xeTable, 'paste')
2051
- globalEvents.off($xeTable, 'copy')
2052
- globalEvents.off($xeTable, 'cut')
2053
- globalEvents.off($xeTable, 'mousedown')
2054
- globalEvents.off($xeTable, 'blur')
2055
- globalEvents.off($xeTable, 'mousewheel')
2056
- globalEvents.off($xeTable, 'keydown')
2057
- globalEvents.off($xeTable, 'resize')
2058
- globalEvents.off($xeTable, 'contextmenu')
2059
-
2060
- $xeTable.preventEvent(null, 'beforeDestroy')
2061
-
2062
- XEUtils.assign(reactData, createReactData())
2063
- XEUtils.assign(internalData, createInternalData())
2064
- },
2065
- destroyed () {
2066
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
2067
-
2068
- $xeTable.preventEvent(null, 'destroyed')
2069
- },
2070
- render (h: CreateElement) {
2071
- // 使用已安装的组件,如果未安装则不渲染
2072
- const VxeUILoadingComponent = VxeUI.getComponent('VxeLoading')
2073
- const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
2074
-
2075
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
2076
- const $xeGrid = $xeTable.$xeGrid
2077
- const $xeGantt = $xeTable.$xeGantt
2078
- const props = $xeTable
2079
- const slots = $xeTable.$scopedSlots
2080
- const reactData = $xeTable as unknown as TableReactData
2081
-
2082
- const { xID } = $xeTable
2083
-
2084
- const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props
2085
- const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore, tooltipStore } = reactData
2086
- const { leftList, rightList } = columnStore
2087
- const loadingSlot = slots.loading
2088
- const tipSlots = {
2089
- header: slots.headerTooltip || slots['header-tooltip'],
2090
- body: slots.tooltip,
2091
- footer: slots.footerTooltip || slots['footer-tooltip']
2092
- }
2093
- const currTooltipSlot = tooltipStore.visible && tooltipStore.type ? tipSlots[tooltipStore.type] : null
2094
- const tableStyle = ($xeTable as any).computeTableStyle as VxeComponentStyleType
2095
- const rowDragOpts = $xeTable.computeRowDragOpts
2096
- const tableTipConfig = $xeTable.computeTableTipConfig
2097
- const validTipConfig = $xeTable.computeValidTipConfig
2098
- const validOpts = $xeTable.computeValidOpts
2099
- const checkboxOpts = $xeTable.computeCheckboxOpts
2100
- const treeOpts = $xeTable.computeTreeOpts
2101
- const rowOpts = $xeTable.computeRowOpts
2102
- const columnOpts = $xeTable.computeColumnOpts
2103
- const vSize = $xeTable.computeSize
2104
- const tableBorder = $xeTable.computeTableBorder
2105
- const mouseOpts = $xeTable.computeMouseOpts
2106
- const areaOpts = $xeTable.computeAreaOpts
2107
- const loadingOpts = $xeTable.computeLoadingOpts
2108
- const isContentMenu = $xeTable.computeIsContentMenu
2109
- const currLoading = reactData.isColLoading || reactData.isRowLoading || loading
2110
- const resizableOpts = $xeTable.computeResizableOpts
2111
- const isArea = mouseConfig && mouseOpts.area
2112
- const columnDragOpts = $xeTable.computeColumnDragOpts
2113
- const scrollbarXToTop = $xeTable.computeScrollbarXToTop
2114
- const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
2115
- const customSimpleMode = $xeTable.computeCustomSimpleMode
2116
- const showCustomSimpleOutside = customSimpleMode === 'outside'
2117
- const { isCrossTableDrag } = rowDragOpts
2118
- const tbOns: {
2119
- contextmenu: (...args: any[]) => void
2120
- keydown: (...args: any[]) => void
2121
- dragover?: (...args: any[]) => void
2122
- } = {
2123
- contextmenu: this.contextMenuEvent,
2124
- keydown: this.keydownEvent
2125
- }
2126
- if (isCrossTableDrag && !tableData.length) {
2127
- tbOns.dragover = $xeTable.handleCrossTableRowDragoverEmptyEvent
2128
- }
2129
- return h('div', {
2130
- ref: 'refElem',
2131
- class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
2132
- [`size--${vSize}`]: vSize,
2133
- [`valid-msg--${validOpts.msgMode}`]: !!editRules,
2134
- 'vxe-editable': !!editConfig,
2135
- 'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete',
2136
- 'cell--highlight': highlightCell,
2137
- 'cell--selected': mouseConfig && mouseOpts.selected,
2138
- 'cell--area': isArea,
2139
- 'header-cell--area': isArea && areaOpts.selectCellByHeader,
2140
- 'body-cell--area': isArea && areaOpts.selectCellByBody,
2141
- 'row--highlight': rowOpts.isHover || highlightHoverRow,
2142
- 'column--highlight': columnOpts.isHover || highlightHoverColumn,
2143
- 'checkbox--range': checkboxOpts.range,
2144
- 'col--drag-cell': columnOpts.drag && columnDragOpts.trigger === 'cell',
2145
- 'is--header': showHeader,
2146
- 'not--header': !showHeader,
2147
- 'is--footer': showFooter,
2148
- 'not--footer': !showFooter,
2149
- 'is--group': isGroup,
2150
- 'is-row-group': isRowGroupStatus,
2151
- 'is--tree-line': treeConfig && (treeOpts.showLine || treeOpts.line),
2152
- 'is--fixed-left': leftList.length,
2153
- 'is--fixed-right': rightList.length,
2154
- 'is--animat': !!props.animat,
2155
- 'is--round': props.round,
2156
- 'is--stripe': !treeConfig && stripe,
2157
- 'is--loading': currLoading,
2158
- 'is--empty': !currLoading && !tableData.length,
2159
- 'is--scroll-y': overflowY,
2160
- 'not--scroll-y': !overflowY,
2161
- 'is--scroll-x': overflowX,
2162
- 'not--scroll-x': !overflowX,
2163
- 'is--virtual-x': scrollXLoad,
2164
- 'is--virtual-y': scrollYLoad
2165
- }],
2166
- style: tableStyle,
2167
- attrs: {
2168
- spellcheck: false
2169
- },
2170
- on: tbOns
2171
- }, [
2172
- /**
2173
- * 隐藏列
2174
- */
2175
- h('div', {
2176
- class: 'vxe-table-slots',
2177
- ref: 'hideColumn'
2178
- }, this.$slots.default),
2179
- h('div', {
2180
- ref: 'refVarElem',
2181
- class: 'vxe-table-vars'
2182
- }, [
2183
- h('div', {
2184
- class: 'vxe-table-var-default'
2185
- }),
2186
- h('div', {
2187
- class: 'vxe-table-var-medium'
2188
- }),
2189
- h('div', {
2190
- class: 'vxe-table-var-small'
2191
- }),
2192
- h('div', {
2193
- class: 'vxe-table-var-mini'
2194
- })
2195
- ]),
2196
- h('div', {
2197
- key: 'tw',
2198
- class: 'vxe-table--render-wrapper'
2199
- }, scrollbarXToTop
2200
- ? [
2201
- renderScrollX(h, $xeTable),
2202
- renderBody(h, $xeTable)
2203
- ]
2204
- : [
2205
- renderBody(h, $xeTable),
2206
- renderScrollX(h, $xeTable)
2207
- ]),
2208
- /**
2209
- * 空数据
2210
- */
2211
- h('div', {
2212
- key: 'tn',
2213
- ref: 'refEmptyPlaceholder',
2214
- class: 'vxe-table--empty-place-wrapper',
2215
- attrs: {
2216
- xid: xID
2217
- }
2218
- }, [
2219
- h('div', {
2220
- class: 'vxe-table--empty-placeholder'
2221
- }, [
2222
- h('div', {
2223
- class: 'vxe-table--empty-content'
2224
- }, renderEmptyBody(h, $xeTable))
2225
- ])
2226
- ]),
2227
- /**
2228
- * 边框线
2229
- */
2230
- h('div', {
2231
- key: 'tl',
2232
- class: 'vxe-table--border-line'
2233
- }),
2234
- /**
2235
- * 列宽线
2236
- */
2237
- h('div', {
2238
- key: 'tcl',
2239
- ref: 'refColResizeBar',
2240
- class: 'vxe-table--resizable-col-bar'
2241
- }, resizableOpts.showDragTip
2242
- ? [
2243
- h('div', {
2244
- ref: 'refColResizeTip',
2245
- class: 'vxe-table--resizable-number-tip'
2246
- })
2247
- ]
2248
- : []),
2249
- h('div', {
2250
- key: 'ttw'
2251
- }, [
2252
- h('div', {
2253
- ref: 'refTeleportWrapper'
2254
- }, [
2255
- /**
2256
- * 行高线
2257
- */
2258
- h('div', {
2259
- key: 'trl',
2260
- ref: 'refRowResizeBar',
2261
- class: 'vxe-table--resizable-row-bar'
2262
- }, resizableOpts.showDragTip
2263
- ? [
2264
- h('div', {
2265
- class: 'vxe-table--resizable-number-tip'
2266
- })
2267
- ]
2268
- : []),
2269
- /**
2270
- * 自定义列
2271
- */
2272
- !showCustomSimpleOutside && initStore.custom
2273
- ? h(TableCustomPanelComponent, {
2274
- key: 'cs',
2275
- ref: 'refTableCustom',
2276
- props: {
2277
- customStore
2278
- }
2279
- })
2280
- : renderEmptyElement($xeTable),
2281
- /**
2282
- * 加载中
2283
- */
2284
- VxeUILoadingComponent
2285
- ? h(VxeUILoadingComponent, {
2286
- key: 'lg',
2287
- class: 'vxe-table--loading',
2288
- props: {
2289
- value: currLoading,
2290
- icon: loadingOpts.icon,
2291
- text: loadingOpts.text
2292
- },
2293
- scopedSlots: loadingSlot
2294
- ? {
2295
- default: () => $xeTable.callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading }, h)
2296
- }
2297
- : {}
2298
- })
2299
- : loadingSlot
2300
- ? h('div', {
2301
- class: ['vxe-loading--custom-wrapper', {
2302
- 'is--visible': currLoading
2303
- }]
2304
- }, $xeTable.callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading }, h))
2305
- : renderEmptyElement($xeTable),
2306
- /**
2307
- * 拖拽提示
2308
- */
2309
- renderDragTip(h, this)
2310
- ])
2311
- ]),
2312
- h('div', {
2313
- key: 'tpw'
2314
- }, [
2315
- h('div', {
2316
- ref: 'refPopupWrapperElem'
2317
- }, [
2318
- /**
2319
- * 自定义列
2320
- */
2321
- showCustomSimpleOutside && initStore.custom
2322
- ? h(TableCustomPanelComponent, {
2323
- key: 'cs',
2324
- ref: 'refTableCustom',
2325
- props: {
2326
- customStore
2327
- }
2328
- })
2329
- : renderEmptyElement($xeTable),
2330
- /**
2331
- * 筛选
2332
- */
2333
- initStore.filter
2334
- ? h(TableFilterPanelComponent, {
2335
- key: 'tf',
2336
- ref: 'refTableFilter',
2337
- props: {
2338
- filterStore
2339
- }
2340
- })
2341
- : renderEmptyElement($xeTable),
2342
- /**
2343
- * 快捷菜单
2344
- */
2345
- isContentMenu
2346
- ? h(TableMenuPanelComponent, {
2347
- key: 'tm',
2348
- ref: 'refTableMenu'
2349
- })
2350
- : renderEmptyElement($xeTable)
2351
- ])
2352
- ]),
2353
- /**
2354
- * 导入
2355
- */
2356
- initStore.import && this.importConfig
2357
- ? h(TableImportPanelComponent, {
2358
- key: 'it',
2359
- props: {
2360
- defaultOptions: this.importParams,
2361
- storeData: this.importStore
2362
- }
2363
- })
2364
- : renderEmptyElement($xeTable),
2365
- /**
2366
- * 导出
2367
- */
2368
- initStore.export && (this.exportConfig || this.printConfig)
2369
- ? h(TableExportPanelComponent, {
2370
- key: 'et',
2371
- props: {
2372
- defaultOptions: this.exportParams,
2373
- storeData: this.exportStore
2374
- }
2375
- })
2376
- : renderEmptyElement($xeTable),
2377
- h('div', {}, [
2378
- /**
2379
- * 提示相关
2380
- */
2381
- VxeUITooltipComponent
2382
- ? h(VxeUITooltipComponent, {
2383
- key: 'ctp',
2384
- ref: 'refCommTooltip',
2385
- props: {
2386
- isArrow: false,
2387
- enterable: false
2388
- }
2389
- })
2390
- : renderEmptyElement($xeTable),
2391
- /**
2392
- * 工具提示
2393
- */
2394
- VxeUITooltipComponent
2395
- ? h(VxeUITooltipComponent, {
2396
- key: 'btp',
2397
- ref: 'refTooltip',
2398
- props: {
2399
- theme: tableTipConfig.theme,
2400
- enterable: tableTipConfig.enterable,
2401
- enterDelay: tableTipConfig.enterDelay,
2402
- leaveDelay: tableTipConfig.leaveDelay,
2403
- useHTML: tableTipConfig.useHTML,
2404
- width: tableTipConfig.width,
2405
- height: tableTipConfig.height,
2406
- minWidth: tableTipConfig.minWidth,
2407
- minHeight: tableTipConfig.minHeight,
2408
- maxWidth: tableTipConfig.maxWidth,
2409
- maxHeight: tableTipConfig.maxHeight
2410
- },
2411
- scopedSlots: currTooltipSlot
2412
- ? {
2413
- content: () => {
2414
- const { type, row, column, content: tooltipContent } = tooltipStore
2415
- if (currTooltipSlot) {
2416
- if (column && type === 'header') {
2417
- return h('div', {
2418
- key: type
2419
- }, currTooltipSlot({ column, tooltipContent, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }))
2420
- }
2421
- if (row && column && type === 'body') {
2422
- return h('div', {
2423
- key: type
2424
- }, currTooltipSlot({ row, column, tooltipContent, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }))
2425
- }
2426
- if (row && column && type === 'footer') {
2427
- return h('div', {
2428
- key: type
2429
- }, currTooltipSlot({ row, column, tooltipContent, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }))
2430
- }
2431
- }
2432
- return renderEmptyElement($xeTable)
2433
- }
2434
- }
2435
- : {}
2436
- })
2437
- : renderEmptyElement($xeTable),
2438
- /**
2439
- * 校验提示
2440
- */
2441
- VxeUITooltipComponent && this.editRules && validOpts.showErrorMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip')
2442
- ? h(VxeUITooltipComponent, {
2443
- key: 'vtp',
2444
- ref: 'refValidTooltip',
2445
- class: [{
2446
- 'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete'
2447
- }, 'vxe-table--valid-error'],
2448
- props: {
2449
- theme: validTipConfig.theme,
2450
- enterable: validTipConfig.enterable,
2451
- enterDelay: validTipConfig.enterDelay,
2452
- leaveDelay: validTipConfig.leaveDelay
2453
- }
2454
- })
2455
- : renderEmptyElement($xeTable)
2456
- ])
2457
- ])
2458
- },
2459
- methods
2460
- } as any
1
+ import { CreateElement } from 'vue'
2
+ import XEUtils from 'xe-utils'
3
+ import { getFuncText, isEnableConf } from '../../ui/src/utils'
4
+ import { initTpImg, toCssUnit } from '../../ui/src/dom'
5
+ import { createReactData, createInternalData, createHandleGetRowId, getCalcHeight, hasDeepKey } from './util'
6
+ import { VxeUI } from '../../ui'
7
+ import methods from './methods'
8
+ import TableBodyComponent from './body'
9
+ import TableHeaderComponent from './header'
10
+ import TableFooterComponent from './footer'
11
+ import { tableProps } from './props'
12
+ import { getSlotVNs } from '../../ui/src/vn'
13
+ import { warnLog, errLog } from '../../ui/src/log'
14
+ import { crossTableDragRowGlobal, getCrossTableDragRowInfo } from './store'
15
+ import TableCustomPanelComponent from '../module/custom/panel'
16
+ import TableFilterPanelComponent from '../module/filter/panel'
17
+ import TableImportPanelComponent from '../module/export/import-panel'
18
+ import TableExportPanelComponent from '../module/export/export-panel'
19
+ import TableMenuPanelComponent from '../module/menu/panel'
20
+
21
+ import filterMixin from '../module/filter/mixin'
22
+ import menuMixin from '../module/menu/mixin'
23
+ import editMixin from '../module/edit/mixin'
24
+ import exportMixin from '../module/export/mixin'
25
+ import keyboardMixin from '../module/keyboard/mixin'
26
+ import validatorMixin from '../module/validator/mixin'
27
+ import customMixin from '../module/custom/mixin'
28
+
29
+ import type { VxeTabsConstructor, VxeTabsPrivateMethods, VxeComponentStyleType } from 'vxe-pc-ui'
30
+ import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTablePropTypes, TableInternalData, TableReactData, VxeTableDefines } from '../../../types'
31
+
32
+ const { getConfig, getIcon, getI18n, renderer, globalResize, globalEvents, globalMixins, renderEmptyElement } = VxeUI
33
+
34
+ function handleUpdateMergeBodyCells ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, merges: VxeTableDefines.MergeOptions | VxeTableDefines.MergeOptions[]) {
35
+ const internalData = $xeTable as unknown as TableInternalData
36
+
37
+ internalData.mergeBodyList = []
38
+ internalData.mergeBodyMaps = {}
39
+ internalData.mergeBodyCellMaps = {}
40
+ $xeTable.setMergeCells(merges)
41
+ }
42
+
43
+ function handleUpdateMergeHeaderCells ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, merges: VxeTableDefines.MergeOptions | VxeTableDefines.MergeOptions[]) {
44
+ const internalData = $xeTable as unknown as TableInternalData
45
+
46
+ internalData.mergeHeaderList = []
47
+ internalData.mergeHeaderMaps = {}
48
+ internalData.mergeHeaderCellMaps = {}
49
+ $xeTable.setMergeHeaderCells(merges)
50
+ }
51
+
52
+ function handleUpdateMergeFooterCells ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, merges: VxeTableDefines.MergeOptions | VxeTableDefines.MergeOptions[]) {
53
+ const internalData = $xeTable as unknown as TableInternalData
54
+
55
+ internalData.mergeFooterList = []
56
+ internalData.mergeFooterMaps = {}
57
+ internalData.mergeFooterCellMaps = {}
58
+ $xeTable.setMergeFooterCells(merges)
59
+ }
60
+
61
+ function handleKeyField ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
62
+ const internalData = $xeTable as unknown as TableInternalData
63
+
64
+ const keyField = $xeTable.computeRowField
65
+ internalData.currKeyField = keyField
66
+ internalData.isCurrDeepKey = hasDeepKey(keyField)
67
+ }
68
+
69
+ function updateColumnAllOverflow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
70
+ const props = $xeTable
71
+ const reactData = $xeTable as unknown as TableReactData
72
+ const internalData = $xeTable as unknown as TableInternalData
73
+
74
+ const { showOverflow } = props
75
+ const { isGroup } = reactData
76
+ const { fullAllDataRowIdData, tableFullColumn, collectColumn } = internalData
77
+ let isAllOverflow = !!showOverflow
78
+ const handleFunc = (column: VxeTableDefines.ColumnInfo) => {
79
+ if (isAllOverflow && column.showOverflow === false) {
80
+ isAllOverflow = false
81
+ }
82
+ }
83
+ if (isGroup) {
84
+ XEUtils.eachTree(collectColumn, handleFunc)
85
+ } else {
86
+ tableFullColumn.forEach(handleFunc)
87
+ }
88
+ XEUtils.each(fullAllDataRowIdData, (rowRest: VxeTableDefines.RowCacheItem) => {
89
+ rowRest.height = 0
90
+ })
91
+ reactData.isAllOverflow = isAllOverflow
92
+ }
93
+
94
+ /**
95
+ * 渲染浮固定列
96
+ * 分别渲染左边固定列和右边固定列
97
+ * 如果宽度足够情况下,则不需要渲染固定列
98
+ */
99
+ function renderViewFixed (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods, fixedType: any) {
100
+ const props = $xeTable
101
+ const reactData = $xeTable as unknown as TableReactData
102
+
103
+ const { showHeader, showFooter } = props
104
+ const { tableData, tableColumn, tableGroupColumn, columnStore, footerTableData } = reactData
105
+ const scrollbarOpts = $xeTable.computeScrollbarOpts
106
+ const scrollbarXOpts = $xeTable.computeScrollbarXOpts
107
+ const scrollbarYOpts = $xeTable.computeScrollbarYOpts
108
+ const { overscrollBehavior: overscrollXBehavior } = scrollbarXOpts
109
+ const { overscrollBehavior: overscrollYBehavior } = scrollbarYOpts
110
+ const isFixedLeft = fixedType === 'left'
111
+ const fixedColumn = isFixedLeft ? columnStore.leftList : columnStore.rightList
112
+ const osXBehavior = XEUtils.eqNull(overscrollXBehavior) ? scrollbarOpts.overscrollBehavior : overscrollXBehavior
113
+ const osYBehavior = XEUtils.eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior
114
+ return h('div', {
115
+ ref: isFixedLeft ? 'refLeftContainer' : 'refRightContainer',
116
+ class: [`vxe-table--fixed-${fixedType}-wrapper`, `sx--${scrollbarXOpts.visible}`, `sy--${scrollbarYOpts.visible}`, {
117
+ [`x-ob--${osXBehavior}`]: osXBehavior,
118
+ [`y-ob--${osYBehavior}`]: osYBehavior
119
+ }]
120
+ }, [
121
+ showHeader
122
+ ? h(TableHeaderComponent, {
123
+ props: {
124
+ fixedType,
125
+ tableData,
126
+ tableColumn,
127
+ tableGroupColumn,
128
+ fixedColumn
129
+ },
130
+ ref: `${fixedType}Header`
131
+ })
132
+ : renderEmptyElement($xeTable),
133
+ h(TableBodyComponent, {
134
+ props: {
135
+ fixedType,
136
+ tableData,
137
+ tableColumn,
138
+ fixedColumn
139
+ },
140
+ ref: `${fixedType}Body`
141
+ }),
142
+ showFooter
143
+ ? h(TableFooterComponent, {
144
+ props: {
145
+ footerTableData,
146
+ tableColumn,
147
+ fixedColumn,
148
+ fixedType
149
+ },
150
+ ref: `${fixedType}Footer`
151
+ })
152
+ : renderEmptyElement($xeTable)
153
+ ])
154
+ }
155
+
156
+ function renderEmptyBody (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
157
+ const slots = $xeTable.$scopedSlots
158
+ const $xeGrid = $xeTable.$xeGrid
159
+ const $xeGantt = $xeTable.$xeGantt
160
+
161
+ const emptyOpts = $xeTable.computeEmptyOpts
162
+ const emptySlot = slots.empty
163
+ let emptyContent: any = ''
164
+ const emptyParams = { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }
165
+ if (emptySlot) {
166
+ emptyContent = emptySlot.call($xeTable, emptyParams)
167
+ } else {
168
+ const compConf = emptyOpts.name ? renderer.get(emptyOpts.name) : null
169
+ const rtEmptyView = compConf ? (compConf.renderTableEmpty || compConf.renderTableEmptyView || compConf.renderEmpty) : null
170
+ if (rtEmptyView) {
171
+ emptyContent = getSlotVNs(rtEmptyView.call($xeTable, h, emptyOpts, emptyParams))
172
+ } else {
173
+ emptyContent = getFuncText($xeTable.emptyText) || getI18n('vxe.table.emptyText')
174
+ }
175
+ }
176
+ return emptyContent
177
+ }
178
+
179
+ const renderDragTipContents = (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) => {
180
+ const props = $xeTable
181
+ const reactData = $xeTable as unknown as TableReactData
182
+ const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable)
183
+
184
+ const { dragConfig } = props
185
+ const { dragRow, dragCol, dragTipText } = reactData
186
+ const columnDragOpts = $xeTable.computeColumnDragOpts
187
+ const rowDragOpts = $xeTable.computeRowDragOpts
188
+ const rowDragSlots = rowDragOpts.slots || {}
189
+ const rTipSlot = rowDragSlots.tip || (dragConfig && dragConfig.slots ? dragConfig.slots.rowTip : null)
190
+ const columnDragSlots = columnDragOpts.slots || {}
191
+ const cTipSlot = columnDragSlots.tip
192
+ const dRow = dragRow || (rowDragOpts.isCrossTableDrag ? crossTableDragRowInfo.row : null)
193
+
194
+ if (dRow && rTipSlot) {
195
+ return $xeTable.callSlot(rTipSlot, { row: dRow }, h)
196
+ }
197
+ if (dragCol && cTipSlot) {
198
+ return $xeTable.callSlot(cTipSlot, { column: dragCol }, h)
199
+ }
200
+ return [h('span', dragTipText)]
201
+ }
202
+
203
+ const renderDragTip = (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) => {
204
+ const reactData = $xeTable as unknown as TableReactData
205
+ const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable)
206
+
207
+ const { dragRow, dragCol } = reactData
208
+ const rowOpts = $xeTable.computeRowOpts
209
+ const columnOpts = $xeTable.computeColumnOpts
210
+ const rowDragOpts = $xeTable.computeRowDragOpts
211
+ const columnDragOpts = $xeTable.computeColumnDragOpts
212
+ const dRow = dragRow || (rowDragOpts.isCrossTableDrag ? crossTableDragRowInfo.row : null)
213
+
214
+ if (rowOpts.drag || columnOpts.drag) {
215
+ return h('div', {
216
+ class: 'vxe-table--drag-wrapper'
217
+ }, [
218
+ h('div', {
219
+ ref: 'refDragRowLineElem',
220
+ class: ['vxe-table--drag-row-line', {
221
+ 'is--guides': rowDragOpts.showGuidesStatus
222
+ }]
223
+ }),
224
+ h('div', {
225
+ ref: 'refDragColLineElem',
226
+ class: ['vxe-table--drag-col-line', {
227
+ 'is--guides': columnDragOpts.showGuidesStatus
228
+ }]
229
+ }),
230
+ (dRow && rowDragOpts.showDragTip) || (dragCol && columnDragOpts.showDragTip)
231
+ ? h('div', {
232
+ ref: 'refDragTipElem',
233
+ class: 'vxe-table--drag-sort-tip'
234
+ }, [
235
+ h('div', {
236
+ class: 'vxe-table--drag-sort-tip-wrapper'
237
+ }, [
238
+ h('div', {
239
+ class: 'vxe-table--drag-sort-tip-status'
240
+ }, [
241
+ h('span', {
242
+ class: ['vxe-table--drag-sort-tip-normal-status', dRow ? getIcon().TABLE_DRAG_STATUS_ROW : getIcon().TABLE_DRAG_STATUS_COLUMN]
243
+ }),
244
+ h('span', {
245
+ class: ['vxe-table--drag-sort-tip-sub-status', getIcon().TABLE_DRAG_STATUS_SUB_ROW]
246
+ }),
247
+ h('span', {
248
+ class: ['vxe-table--drag-sort-tip-disabled-status', getIcon().TABLE_DRAG_DISABLED]
249
+ })
250
+ ]),
251
+ h('div', {
252
+ class: 'vxe-table--drag-sort-tip-content'
253
+ }, renderDragTipContents(h, $xeTable))
254
+ ])
255
+ ])
256
+ : renderEmptyElement($xeTable)
257
+ ])
258
+ }
259
+ return renderEmptyElement($xeTable)
260
+ }
261
+
262
+ function handleUpdateResize ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
263
+ const el = $xeTable.$refs.refElem as HTMLDivElement
264
+ if (el && el.clientWidth && el.clientHeight) {
265
+ $xeTable.recalculate()
266
+ }
267
+ }
268
+
269
+ function renderRowExpandedVNs (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
270
+ const props = $xeTable
271
+ const reactData = $xeTable as unknown as TableReactData
272
+ const internalData = $xeTable as unknown as TableInternalData
273
+ const $xeGrid = $xeTable.$xeGrid
274
+ const $xeGantt = $xeTable.$xeGantt
275
+
276
+ const { treeConfig } = props
277
+ const { expandColumn, isRowGroupStatus } = reactData
278
+ const tableRowExpandedList: any[] = ($xeTable as any).computeTableRowExpandedList
279
+ const expandOpts = $xeTable.computeExpandOpts
280
+ const { mode } = expandOpts
281
+ if (mode !== 'fixed') {
282
+ return renderEmptyElement($xeTable)
283
+ }
284
+ const expandVNs = [
285
+ h('div', {
286
+ key: 'repY',
287
+ ref: 'refRowExpandYSpaceElem'
288
+ })
289
+ ]
290
+
291
+ if (expandColumn) {
292
+ const { handleGetRowId } = createHandleGetRowId($xeTable)
293
+ tableRowExpandedList.forEach((row) => {
294
+ const expandOpts = $xeTable.computeExpandOpts
295
+ const { height: expandHeight, padding, indent } = expandOpts
296
+ const { fullAllDataRowIdData, fullColumnIdData } = internalData
297
+ const treeOpts = $xeTable.computeTreeOpts
298
+ const { transform, seqMode } = treeOpts
299
+ const cellStyle: Record<string, string> = {}
300
+ const rowid = handleGetRowId(row)
301
+ const rowRest = fullAllDataRowIdData[rowid]
302
+ const colid = expandColumn.id
303
+ const colRest = fullColumnIdData[colid] || {}
304
+ let rowLevel = 0
305
+ let seq: string | number = -1
306
+ let _rowIndex = -1
307
+ let rowIndex = -1
308
+ let $rowIndex = -1
309
+ if (rowRest) {
310
+ rowIndex = rowRest.index
311
+ $rowIndex = rowRest.$index
312
+ _rowIndex = rowRest._index
313
+ rowLevel = rowRest.level
314
+ seq = rowRest.seq
315
+ if (isRowGroupStatus || (treeConfig && transform && seqMode === 'increasing')) {
316
+ seq = rowRest._index + 1
317
+ } else if ((treeConfig && seqMode === 'fixed')) {
318
+ seq = rowRest._tIndex + 1
319
+ }
320
+ }
321
+ if (expandHeight) {
322
+ cellStyle.height = `${expandHeight}px`
323
+ }
324
+ if (isRowGroupStatus || treeConfig) {
325
+ cellStyle.paddingLeft = `${(rowLevel * (XEUtils.isNumber(indent) ? indent : treeOpts.indent)) + 30}px`
326
+ }
327
+ let columnIndex = -1
328
+ let $columnIndex = -1
329
+ let _columnIndex = -1
330
+ if (colRest) {
331
+ columnIndex = colRest.index
332
+ $columnIndex = colRest.$index
333
+ _columnIndex = colRest._index
334
+ }
335
+ const expandParams: VxeTableDefines.CellRenderDataParams = {
336
+ $table: $xeTable,
337
+ $grid: $xeGrid,
338
+ $gantt: $xeGantt,
339
+ seq,
340
+ column: expandColumn,
341
+ columnIndex,
342
+ $columnIndex,
343
+ _columnIndex,
344
+ fixed: '',
345
+ source: 'table',
346
+ type: 'body',
347
+ level: rowLevel,
348
+ rowid,
349
+ row,
350
+ rowIndex,
351
+ $rowIndex,
352
+ _rowIndex,
353
+ isHidden: false,
354
+ isEdit: false,
355
+ visibleData: [],
356
+ data: [],
357
+ items: []
358
+ }
359
+ expandVNs.push(
360
+ h('div', {
361
+ key: rowid,
362
+ class: ['vxe-body--row-expanded-cell', {
363
+ 'is--padding': padding,
364
+ 'is--ellipsis': expandHeight
365
+ }],
366
+ attrs: {
367
+ rowid
368
+ },
369
+ style: cellStyle
370
+ }, [
371
+ h('div', {
372
+ class: 'vxe-body--row-expanded-content'
373
+ }, expandColumn.renderData(h, expandParams))
374
+ ])
375
+ )
376
+ })
377
+ }
378
+
379
+ return h('div', {
380
+ ref: 'refRowExpandElem',
381
+ class: 'vxe-table--row-expanded-wrapper'
382
+ }, expandVNs)
383
+ }
384
+
385
+ function renderScrollX (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
386
+ return h('div', {
387
+ key: 'vsx',
388
+ ref: 'refScrollXVirtualElem',
389
+ class: 'vxe-table--scroll-x-virtual'
390
+ }, [
391
+ h('div', {
392
+ ref: 'refScrollXLeftCornerElem',
393
+ class: 'vxe-table--scroll-x-left-corner'
394
+ }),
395
+ h('div', {
396
+ ref: 'refScrollXWrapperElem',
397
+ class: 'vxe-table--scroll-x-wrapper'
398
+ }, [
399
+ h('div', {
400
+ ref: 'refScrollXHandleElem',
401
+ class: 'vxe-table--scroll-x-handle',
402
+ on: {
403
+ scroll: $xeTable.triggerVirtualScrollXEvent
404
+ }
405
+ }, [
406
+ h('div', {
407
+ ref: 'refScrollXSpaceElem',
408
+ class: 'vxe-table--scroll-x-space'
409
+ })
410
+ ]),
411
+ h('div', {
412
+ class: 'vxe-table--scroll-x-handle-appearance'
413
+ })
414
+ ]),
415
+ h('div', {
416
+ ref: 'refScrollXRightCornerElem',
417
+ class: 'vxe-table--scroll-x-right-corner'
418
+ })
419
+ ])
420
+ }
421
+
422
+ function renderScrollY (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
423
+ return h('div', {
424
+ ref: 'refScrollYVirtualElem',
425
+ class: 'vxe-table--scroll-y-virtual'
426
+ }, [
427
+ h('div', {
428
+ ref: 'refScrollYTopCornerElem',
429
+ class: 'vxe-table--scroll-y-top-corner'
430
+ }),
431
+ h('div', {
432
+ ref: 'refScrollYWrapperElem',
433
+ class: 'vxe-table--scroll-y-wrapper'
434
+ }, [
435
+ h('div', {
436
+ ref: 'refScrollYHandleElem',
437
+ class: 'vxe-table--scroll-y-handle',
438
+ on: {
439
+ scroll: $xeTable.triggerVirtualScrollYEvent
440
+ }
441
+ }, [
442
+ h('div', {
443
+ ref: 'refScrollYSpaceElem',
444
+ class: 'vxe-table--scroll-y-space'
445
+ })
446
+ ])
447
+ ]),
448
+ h('div', {
449
+ ref: 'refScrollYBottomCornerElem',
450
+ class: 'vxe-table--scroll-y-bottom-corner'
451
+ })
452
+ ])
453
+ }
454
+
455
+ function renderViewport (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
456
+ const props = $xeTable
457
+ const reactData = $xeTable as unknown as TableReactData
458
+
459
+ const { showHeader, showFooter } = props
460
+ const { overflowX, tableData, tableColumn, tableGroupColumn, footerTableData, columnStore } = reactData
461
+ const scrollbarOpts = $xeTable.computeScrollbarOpts
462
+ const scrollbarXOpts = $xeTable.computeScrollbarXOpts
463
+ const scrollbarYOpts = $xeTable.computeScrollbarYOpts
464
+ const { overscrollBehavior: overscrollXBehavior } = scrollbarXOpts
465
+ const { overscrollBehavior: overscrollYBehavior } = scrollbarYOpts
466
+ const { leftList, rightList } = columnStore
467
+ const osXBehavior = XEUtils.eqNull(overscrollXBehavior) ? scrollbarOpts.overscrollBehavior : overscrollXBehavior
468
+ const osYBehavior = XEUtils.eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior
469
+
470
+ return h('div', {
471
+ ref: 'refTableViewportElem',
472
+ class: ['vxe-table--viewport-wrapper', {
473
+ [`x-ob--${osXBehavior}`]: osXBehavior,
474
+ [`y-ob--${osYBehavior}`]: osYBehavior
475
+ }]
476
+ }, [
477
+ h('div', {
478
+ class: ['vxe-table--main-wrapper', `sx--${scrollbarXOpts.visible}`, `sy--${scrollbarYOpts.visible}`]
479
+ }, [
480
+ /**
481
+ * 表头
482
+ */
483
+ showHeader
484
+ ? h(TableHeaderComponent, {
485
+ ref: 'refTableHeader',
486
+ props: {
487
+ tableData,
488
+ tableColumn,
489
+ tableGroupColumn
490
+ }
491
+ })
492
+ : renderEmptyElement($xeTable),
493
+ /**
494
+ * 表体
495
+ */
496
+ h(TableBodyComponent, {
497
+ ref: 'refTableBody',
498
+ props: {
499
+ tableData,
500
+ tableColumn
501
+ }
502
+ }),
503
+ /**
504
+ * 表尾
505
+ */
506
+ showFooter
507
+ ? h(TableFooterComponent, {
508
+ ref: 'refTableFooter',
509
+ props: {
510
+ footerTableData,
511
+ tableColumn
512
+ }
513
+ })
514
+ : renderEmptyElement($xeTable)
515
+ ]),
516
+ h('div', {
517
+ class: 'vxe-table--fixed-wrapper'
518
+ }, [
519
+ leftList && leftList.length && overflowX ? renderViewFixed(h, $xeTable, 'left') : renderEmptyElement($xeTable),
520
+ rightList && rightList.length && overflowX ? renderViewFixed(h, $xeTable, 'right') : renderEmptyElement($xeTable)
521
+ ]),
522
+ renderRowExpandedVNs(h, $xeTable)
523
+ ])
524
+ }
525
+
526
+ function renderBody (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
527
+ const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
528
+ return h('div', {
529
+ class: 'vxe-table--layout-wrapper'
530
+ }, scrollbarYToLeft
531
+ ? [
532
+ renderScrollY(h, $xeTable),
533
+ renderViewport(h, $xeTable)
534
+ ]
535
+ : [
536
+ renderViewport(h, $xeTable),
537
+ renderScrollY(h, $xeTable)
538
+ ])
539
+ }
540
+
541
+ export default {
542
+ name: 'VxeTable',
543
+ mixins: [
544
+ globalMixins.sizeMixin,
545
+ filterMixin,
546
+ menuMixin,
547
+ editMixin,
548
+ exportMixin,
549
+ keyboardMixin,
550
+ validatorMixin,
551
+ customMixin
552
+ ],
553
+ props: tableProps,
554
+ provide () {
555
+ const $xeTable = this
556
+ return {
557
+ $xeTable,
558
+ xecolgroup: null
559
+ }
560
+ },
561
+ inject: {
562
+ $xeTabs: {
563
+ default: null
564
+ },
565
+ $xeParentTable: {
566
+ from: '$xeTable',
567
+ default: null
568
+ },
569
+ $xeGrid: {
570
+ default: null
571
+ },
572
+ $xeGantt: {
573
+ default: null
574
+ }
575
+ },
576
+ data () {
577
+ const xID = XEUtils.uniqueId()
578
+
579
+ const reactData = createReactData()
580
+
581
+ return {
582
+ xID,
583
+ ...reactData,
584
+
585
+ // 私有属性
586
+ reScrollFlag: 0,
587
+ reLayoutFlag: 0,
588
+ footFlag: 0,
589
+ kfFlag: 0,
590
+ mergeFooteCellFlag: 0,
591
+ crossTableDragRowInfo: crossTableDragRowGlobal
592
+ }
593
+ },
594
+ computed: {
595
+ ...({} as {
596
+ $xeTabs(): (VxeTabsConstructor & VxeTabsPrivateMethods) | null
597
+ }),
598
+ tableId () {
599
+ return this.computeTableId
600
+ },
601
+ computeTableId () {
602
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
603
+ const props = $xeTable
604
+ const $xeGrid = $xeTable.$xeGrid
605
+ const $xeGantt = $xeTable.$xeGantt
606
+
607
+ const { id } = props
608
+ if (id) {
609
+ if (XEUtils.isFunction(id)) {
610
+ return `${id({ $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) || ''}`
611
+ }
612
+ return `${id}`
613
+ }
614
+ return ''
615
+ },
616
+ computeRowField () {
617
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
618
+ const props = $xeTable
619
+
620
+ const rowOpts = $xeTable.computeRowOpts
621
+ return `${props.rowId || rowOpts.keyField || '_X_ROW_KEY'}`
622
+ },
623
+ validOpts () {
624
+ return this.computeValidOpts
625
+ },
626
+ computeValidOpts () {
627
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
628
+ const props = $xeTable
629
+
630
+ const opts = Object.assign({}, getConfig().table.validConfig, props.validConfig)
631
+ // 兼容老版本
632
+ if (XEUtils.isBoolean(opts.showMessage)) {
633
+ opts.showErrorMessage = opts.showMessage
634
+ }
635
+ return opts
636
+ },
637
+ sXOpts () {
638
+ return this.computeVirtualXOpts
639
+ },
640
+ computeSXOpts () {
641
+ return this.computeVirtualXOpts
642
+ },
643
+ computeScrollXThreshold () {
644
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
645
+
646
+ const virtualXOpts = $xeTable.computeVirtualXOpts
647
+ const { threshold } = virtualXOpts
648
+ if (threshold) {
649
+ return XEUtils.toNumber(threshold)
650
+ }
651
+ return 0
652
+ },
653
+ sYOpts () {
654
+ return this.computeVirtualYOpts
655
+ },
656
+ computeSYOpts () {
657
+ return this.computeVirtualYOpts
658
+ },
659
+ computeVirtualXOpts () {
660
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
661
+ const props = $xeTable
662
+
663
+ const { virtualXConfig, scrollX } = props
664
+ const globalVirtualXConfig = getConfig().table.virtualXConfig
665
+ const globalScrollX = getConfig().table.scrollX
666
+ if (virtualXConfig) {
667
+ return Object.assign({}, globalVirtualXConfig, virtualXConfig) as VxeTablePropTypes.VirtualXConfig & { gt: number }
668
+ }
669
+ if (scrollX) {
670
+ // 已废弃,保留兼容
671
+ return Object.assign({}, globalScrollX, scrollX) as VxeTablePropTypes.VirtualXConfig & { gt: number }
672
+ }
673
+ if (globalVirtualXConfig) {
674
+ return Object.assign({}, globalVirtualXConfig, virtualXConfig) as VxeTablePropTypes.VirtualXConfig & { gt: number }
675
+ }
676
+ // 已废弃,保留兼容
677
+ return Object.assign({}, globalScrollX, scrollX) as VxeTablePropTypes.VirtualXConfig & { gt: number }
678
+ },
679
+ computeVirtualYOpts () {
680
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
681
+ const props = $xeTable
682
+
683
+ const { virtualYConfig, scrollY } = props
684
+ const globalVirtualYConfig = getConfig().table.virtualYConfig
685
+ const globalScrollY = getConfig().table.scrollY
686
+ if (virtualYConfig) {
687
+ return Object.assign({}, globalVirtualYConfig, virtualYConfig) as VxeTablePropTypes.VirtualYConfig & { gt: number }
688
+ }
689
+ if (scrollY) {
690
+ // 已废弃,保留兼容
691
+ return Object.assign({}, globalScrollY, scrollY) as VxeTablePropTypes.VirtualYConfig & { gt: number }
692
+ }
693
+ if (globalVirtualYConfig) {
694
+ return Object.assign({}, globalVirtualYConfig, virtualYConfig) as VxeTablePropTypes.VirtualYConfig & { gt: number }
695
+ }
696
+ // 已废弃,保留兼容
697
+ return Object.assign({}, globalScrollY, scrollY) as VxeTablePropTypes.VirtualYConfig & { gt: number }
698
+ },
699
+ computeScrollbarOpts () {
700
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
701
+ const props = $xeTable
702
+
703
+ return Object.assign({}, getConfig().table.scrollbarConfig, props.scrollbarConfig)
704
+ },
705
+ computeScrollbarXOpts () {
706
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
707
+ const props = $xeTable
708
+
709
+ const scrollbarOpts = $xeTable.computeScrollbarOpts
710
+ return Object.assign({}, scrollbarOpts.x, props.scrollbarConfig?.x || {})
711
+ },
712
+ computeScrollbarYOpts () {
713
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
714
+ const props = $xeTable
715
+
716
+ const scrollbarOpts = $xeTable.computeScrollbarOpts
717
+ return Object.assign({}, scrollbarOpts.y, props.scrollbarConfig?.y || {})
718
+ },
719
+ computeScrollbarXToTop () {
720
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
721
+
722
+ const scrollbarXOpts = $xeTable.computeScrollbarXOpts
723
+ return scrollbarXOpts.position === 'top'
724
+ },
725
+ computeScrollbarYToLeft () {
726
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
727
+
728
+ const scrollbarYOpts = $xeTable.computeScrollbarYOpts
729
+ return scrollbarYOpts.position === 'left'
730
+ },
731
+ computeScrollYThreshold () {
732
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
733
+
734
+ const virtualYOpts = $xeTable.computeVirtualYOpts
735
+ const { threshold } = virtualYOpts
736
+ if (threshold) {
737
+ return XEUtils.toNumber(threshold)
738
+ }
739
+ return 0
740
+ },
741
+ rowHeightMaps () {
742
+ return this.computeRowHeightMaps
743
+ },
744
+ computeRowHeightMaps () {
745
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
746
+ const reactData = $xeTable as unknown as TableReactData
747
+
748
+ return reactData.rowHeightStore
749
+ },
750
+ computeDefaultRowHeight () {
751
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
752
+
753
+ const vSize = $xeTable.computeSize
754
+ const rowHeightMaps = $xeTable.computeRowHeightMaps
755
+ return rowHeightMaps[vSize || 'default'] || 18
756
+ },
757
+ columnOpts () {
758
+ return this.computeColumnOpts
759
+ },
760
+ computeColumnOpts () {
761
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
762
+ const props = $xeTable
763
+
764
+ return Object.assign({}, getConfig().table.columnConfig, props.columnConfig)
765
+ },
766
+ computeCurrentColumnOpts () {
767
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
768
+ const props = $xeTable
769
+
770
+ return Object.assign({}, getConfig().table.currentColumnConfig, props.currentColumnConfig)
771
+ },
772
+ computeCellOpts () {
773
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
774
+ const props = $xeTable
775
+
776
+ const cellOpts = Object.assign({}, getConfig().table.cellConfig, props.cellConfig)
777
+ if (cellOpts.height) {
778
+ cellOpts.height = XEUtils.toNumber(cellOpts.height)
779
+ }
780
+ return cellOpts
781
+ },
782
+ computeHeaderCellOpts () {
783
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
784
+ const $xeGantt = $xeTable.$xeGantt
785
+ const props = $xeTable
786
+
787
+ const headerCellOpts = Object.assign({}, getConfig().table.headerCellConfig, props.headerCellConfig)
788
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight
789
+ const cellOpts = $xeTable.computeCellOpts
790
+ let headCellHeight = XEUtils.toNumber(getCalcHeight(headerCellOpts.height || cellOpts.height))
791
+ if ($xeGantt) {
792
+ const taskViewScales = $xeGantt.computeTaskViewScales
793
+ if (taskViewScales && taskViewScales.length > 2) {
794
+ const ganttMinHeadCellHeight = defaultRowHeight / 2 * taskViewScales.length
795
+ headCellHeight = Math.max(ganttMinHeadCellHeight, headCellHeight)
796
+ }
797
+ }
798
+ headerCellOpts.height = headCellHeight
799
+ return headerCellOpts
800
+ },
801
+ computeFooterCellOpts () {
802
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
803
+ const props = $xeTable
804
+
805
+ const footerCellOpts = Object.assign({}, getConfig().table.footerCellConfig, props.footerCellConfig)
806
+ const cellOpts = $xeTable.computeCellOpts
807
+ footerCellOpts.height = XEUtils.toNumber(getCalcHeight(footerCellOpts.height || cellOpts.height))
808
+ return footerCellOpts
809
+ },
810
+ rowOpts () {
811
+ return this.computeRowOpts
812
+ },
813
+ computeRowOpts () {
814
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
815
+ const props = $xeTable
816
+
817
+ return Object.assign({}, getConfig().table.rowConfig, props.rowConfig)
818
+ },
819
+ computeAggregateOpts () {
820
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
821
+ const props = $xeTable
822
+
823
+ return Object.assign({}, getConfig().table.aggregateConfig || getConfig().table.rowGroupConfig, props.aggregateConfig || props.rowGroupConfig)
824
+ },
825
+ computeAggregateAccuracyOpts () {
826
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
827
+ const props = $xeTable
828
+
829
+ return Object.assign({}, getConfig().table.aggregateAccuracyConfig, props.aggregateAccuracyConfig)
830
+ },
831
+ computeRowGroupOpts () {
832
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
833
+
834
+ return $xeTable.computeAggregateOpts
835
+ },
836
+ computeCurrentRowOpts () {
837
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
838
+ const props = $xeTable
839
+
840
+ return Object.assign({}, getConfig().table.currentRowConfig, props.currentRowConfig)
841
+ },
842
+ computeRowDragOpts () {
843
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
844
+ const props = $xeTable
845
+
846
+ return Object.assign({}, getConfig().table.rowDragConfig, props.rowDragConfig)
847
+ },
848
+ computeColumnDragOpts () {
849
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
850
+ const props = $xeTable
851
+
852
+ return Object.assign({}, getConfig().table.columnDragConfig, props.columnDragConfig)
853
+ },
854
+ resizeOpts () {
855
+ return this.computeResizeOpts
856
+ },
857
+ computeResizeOpts () {
858
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
859
+ const props = $xeTable
860
+
861
+ return Object.assign({}, getConfig().table.resizeConfig, props.resizeConfig)
862
+ },
863
+ resizableOpts () {
864
+ return this.computeResizableOpts
865
+ },
866
+ computeResizableOpts () {
867
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
868
+ const props = $xeTable
869
+
870
+ return Object.assign({}, getConfig().table.resizableConfig, props.resizableConfig)
871
+ },
872
+ seqOpts () {
873
+ return this.computeSeqOpts
874
+ },
875
+ computeSeqOpts () {
876
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
877
+ const props = $xeTable
878
+
879
+ return Object.assign({ startIndex: 0 }, getConfig().table.seqConfig, props.seqConfig)
880
+ },
881
+ radioOpts () {
882
+ return this.computeRadioOpts
883
+ },
884
+ computeRadioOpts () {
885
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
886
+ const props = $xeTable
887
+
888
+ return Object.assign({}, getConfig().table.radioConfig, props.radioConfig)
889
+ },
890
+ checkboxOpts () {
891
+ return this.computeCheckboxOpts
892
+ },
893
+ computeCheckboxOpts () {
894
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
895
+ const props = $xeTable
896
+
897
+ return Object.assign({}, getConfig().table.checkboxConfig, props.checkboxConfig)
898
+ },
899
+ tooltipOpts () {
900
+ return this.computeTooltipOpts
901
+ },
902
+ computeTooltipOpts () {
903
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
904
+ const props = $xeTable
905
+
906
+ return Object.assign({}, getConfig().tooltip, getConfig().table.tooltipConfig, props.tooltipConfig)
907
+ },
908
+ tipConfig () {
909
+ return { ...this.tooltipOpts }
910
+ },
911
+ computeHeaderTooltipOpts () {
912
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
913
+ const props = $xeTable
914
+
915
+ return Object.assign({}, getConfig().tooltip, getConfig().table.headerTooltipConfig, props.headerTooltipConfig)
916
+ },
917
+ computeFooterTooltipOpts () {
918
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
919
+ const props = $xeTable
920
+
921
+ return Object.assign({}, getConfig().tooltip, getConfig().table.footerTooltipConfig, props.footerTooltipConfig)
922
+ },
923
+ computeTableTipConfig () {
924
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
925
+ const reactData = $xeTable as unknown as TableReactData
926
+
927
+ const { tooltipStore } = reactData
928
+ const tooltipOpts = $xeTable.computeTooltipOpts
929
+ return Object.assign({}, tooltipOpts, tooltipStore.currOpts)
930
+ },
931
+ computeValidTipConfig () {
932
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
933
+
934
+ const tooltipOpts = $xeTable.computeTooltipOpts
935
+ return Object.assign({}, tooltipOpts)
936
+ },
937
+ validTipOpts () {
938
+ return Object.assign({ isArrow: false }, this.tooltipOpts)
939
+ },
940
+ editOpts () {
941
+ return this.computeEditOpts
942
+ },
943
+ computeEditOpts () {
944
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
945
+ const props = $xeTable
946
+
947
+ return Object.assign({}, getConfig().table.editConfig, props.editConfig)
948
+ },
949
+ computeEditDirtyOpts () {
950
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
951
+ const props = $xeTable
952
+
953
+ return Object.assign({}, getConfig().table.editDirtyConfig, props.editDirtyConfig)
954
+ },
955
+ sortOpts () {
956
+ return this.computeSortOpts
957
+ },
958
+ computeSortOpts () {
959
+ return Object.assign({ orders: ['asc', 'desc', null] }, getConfig().table.sortConfig, this.sortConfig)
960
+ },
961
+ filterOpts () {
962
+ return this.computeFilterOpts
963
+ },
964
+ computeFilterOpts () {
965
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
966
+ const props = $xeTable
967
+
968
+ return Object.assign({}, getConfig().table.filterConfig, props.filterConfig)
969
+ },
970
+ computeFloatingFilterOpts () {
971
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
972
+ const props = $xeTable
973
+
974
+ return Object.assign({}, getConfig().table.floatingFilterConfig, props.floatingFilterConfig)
975
+ },
976
+ mouseOpts () {
977
+ return this.computeMouseOpts
978
+ },
979
+ computeMouseOpts () {
980
+ return Object.assign({}, getConfig().table.mouseConfig, this.mouseConfig)
981
+ },
982
+ areaOpts () {
983
+ return this.computeAreaOpts
984
+ },
985
+ computeAreaOpts () {
986
+ return Object.assign({}, getConfig().table.areaConfig, this.areaConfig)
987
+ },
988
+ keyboardOpts () {
989
+ return this.computeKeyboardOpts
990
+ },
991
+ computeKeyboardOpts () {
992
+ return Object.assign({}, getConfig().table.keyboardConfig, this.keyboardConfig)
993
+ },
994
+ clipOpts () {
995
+ return this.computeClipOpts
996
+ },
997
+ computeClipOpts () {
998
+ return Object.assign({}, getConfig().table.clipConfig, this.clipConfig)
999
+ },
1000
+ fnrOpts () {
1001
+ return this.computeFnrOpts
1002
+ },
1003
+ computeFNROpts () {
1004
+ return this.computeFnrOpts
1005
+ },
1006
+ computeFnrOpts () {
1007
+ return Object.assign({}, getConfig().table.fnrConfig, this.fnrConfig)
1008
+ },
1009
+ headerCtxMenu () {
1010
+ return this.computeHeaderMenu
1011
+ },
1012
+ computeHeaderMenu () {
1013
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1014
+
1015
+ const menuOpts = $xeTable.computeMenuOpts
1016
+ const headerOpts = menuOpts.header
1017
+ return headerOpts && headerOpts.options ? headerOpts.options : []
1018
+ },
1019
+ bodyCtxMenu () {
1020
+ return this.computeBodyMenu
1021
+ },
1022
+ computeBodyMenu () {
1023
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1024
+
1025
+ const menuOpts = $xeTable.computeMenuOpts
1026
+ const bodyOpts = menuOpts.body
1027
+ return bodyOpts && bodyOpts.options ? bodyOpts.options : []
1028
+ },
1029
+ footerCtxMenu () {
1030
+ return this.computeFooterMenu
1031
+ },
1032
+ computeFooterMenu () {
1033
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1034
+
1035
+ const menuOpts = $xeTable.computeMenuOpts
1036
+ const footerOpts = menuOpts.footer
1037
+ return footerOpts && footerOpts.options ? footerOpts.options : []
1038
+ },
1039
+ isCtxMenu () {
1040
+ return this.computeIsContentMenu
1041
+ },
1042
+ computeIsMenu () {
1043
+ return this.computeIsContentMenu
1044
+ },
1045
+ computeIsContentMenu () {
1046
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1047
+ const props = $xeTable
1048
+
1049
+ const menuOpts = $xeTable.computeMenuOpts
1050
+ const headerMenu = $xeTable.computeHeaderMenu
1051
+ const bodyMenu = $xeTable.computeBodyMenu
1052
+ const footerMenu = $xeTable.computeFooterMenu
1053
+ return !!(((props as any).contextMenu || props.menuConfig) && isEnableConf(menuOpts) && (headerMenu.length || bodyMenu.length || footerMenu.length))
1054
+ },
1055
+ ctxMenuList () {
1056
+ return this.computeMenuList
1057
+ },
1058
+ computeMenuList () {
1059
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1060
+ const reactData = $xeTable as unknown as TableReactData
1061
+
1062
+ const { ctxMenuStore } = reactData
1063
+ const rest: any[] = []
1064
+ ctxMenuStore.list.forEach((list) => {
1065
+ list.forEach((item) => {
1066
+ rest.push(item)
1067
+ })
1068
+ })
1069
+ return rest
1070
+ },
1071
+ ctxMenuOpts () {
1072
+ return this.computeMenuOpts
1073
+ },
1074
+ computeMenuOpts () {
1075
+ return Object.assign({}, getConfig().table.menuConfig, this.contextMenu, this.menuConfig)
1076
+ },
1077
+ computeLeftFixedWidth () {
1078
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1079
+ const reactData = $xeTable as unknown as TableReactData
1080
+
1081
+ const { columnStore } = reactData
1082
+ const { leftList } = columnStore
1083
+ let leftWidth = 0
1084
+ for (let i = 0; i < leftList.length; i++) {
1085
+ const column = leftList[i]
1086
+ leftWidth += column.renderWidth
1087
+ }
1088
+ return leftWidth
1089
+ },
1090
+ computeRightFixedWidth () {
1091
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1092
+ const reactData = $xeTable as unknown as TableReactData
1093
+
1094
+ const { columnStore } = reactData
1095
+ const { rightList } = columnStore
1096
+ let leftWidth = 0
1097
+ for (let i = 0; i < rightList.length; i++) {
1098
+ const column = rightList[i]
1099
+ leftWidth += column.renderWidth
1100
+ }
1101
+ return leftWidth
1102
+ },
1103
+ computeBodyMergeCoverFixed () {
1104
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1105
+ const reactData = $xeTable as unknown as TableReactData
1106
+ const internalData = $xeTable as unknown as TableInternalData
1107
+
1108
+ const { columnStore, mergeBodyFlag } = reactData
1109
+ const { mergeBodyList, visibleColumn } = internalData
1110
+ const { leftList, rightList } = columnStore
1111
+ const rscIndex = visibleColumn.length - rightList.length
1112
+ if (mergeBodyFlag && (leftList.length || rightList.length)) {
1113
+ const lecIndex = leftList.length
1114
+ for (let i = 0; i < mergeBodyList.length; i++) {
1115
+ const { col, colspan } = mergeBodyList[i]
1116
+ if (col < lecIndex || (col + colspan) > rscIndex) {
1117
+ return true
1118
+ }
1119
+ }
1120
+ }
1121
+ return false
1122
+ },
1123
+ computeIsHeaderRenderOptimize () {
1124
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1125
+ const props = $xeTable
1126
+ const reactData = $xeTable as unknown as TableReactData
1127
+
1128
+ const { spanMethod, footerSpanMethod, showHeaderOverflow: allColumnHeaderOverflow } = props
1129
+ const { isGroup, scrollXLoad } = reactData
1130
+ let isOptimizeMode = false
1131
+ if (isGroup) {
1132
+ // 分组表头
1133
+ } else {
1134
+ // 如果是使用优化模式
1135
+ if (scrollXLoad && allColumnHeaderOverflow) {
1136
+ if (spanMethod || footerSpanMethod) {
1137
+ // 如果不支持优化模式
1138
+ } else {
1139
+ isOptimizeMode = true
1140
+ }
1141
+ }
1142
+ }
1143
+ return isOptimizeMode
1144
+ },
1145
+ computeIsBodyRenderOptimize () {
1146
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1147
+ const props = $xeTable
1148
+ const reactData = $xeTable as unknown as TableReactData
1149
+
1150
+ const { spanMethod, footerSpanMethod } = props
1151
+ const { scrollXLoad, scrollYLoad, isAllOverflow, expandColumn } = reactData
1152
+ const bodyMergeCoverFixed = $xeTable.computeBodyMergeCoverFixed
1153
+ const expandOpts = $xeTable.computeExpandOpts
1154
+ let isOptimizeMode = false
1155
+ // 如果是使用优化模式
1156
+ if (scrollXLoad || scrollYLoad || isAllOverflow) {
1157
+ // 如果是展开行,内联模式,不支持优化
1158
+ // 如果是方法合并,不支持优化
1159
+ // 如果固定列且配置式合并,不支持优化
1160
+ if ((expandColumn && expandOpts.mode !== 'fixed') || bodyMergeCoverFixed || spanMethod || footerSpanMethod) {
1161
+ // 如果不支持优化模式
1162
+ } else {
1163
+ isOptimizeMode = true
1164
+ }
1165
+ }
1166
+ return isOptimizeMode
1167
+ },
1168
+ computeIsFooterRenderOptimize () {
1169
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1170
+ const props = $xeTable
1171
+ const reactData = $xeTable as unknown as TableReactData
1172
+
1173
+ const { spanMethod, footerSpanMethod, showFooterOverflow: allColumnFooterOverflow } = props
1174
+ const { scrollXLoad } = reactData
1175
+ let isOptimizeMode = false
1176
+ // 如果是使用优化模式
1177
+ if (scrollXLoad && allColumnFooterOverflow) {
1178
+ if (spanMethod || footerSpanMethod) {
1179
+ // 如果不支持优化模式
1180
+ } else {
1181
+ isOptimizeMode = true
1182
+ }
1183
+ }
1184
+ return isOptimizeMode
1185
+ },
1186
+ exportOpts () {
1187
+ return this.computeExportOpts
1188
+ },
1189
+ computeExportOpts () {
1190
+ return Object.assign({}, getConfig().table.exportConfig, this.exportConfig)
1191
+ },
1192
+ importOpts () {
1193
+ return this.computeImportOpts
1194
+ },
1195
+ computeImportOpts () {
1196
+ return Object.assign({}, getConfig().table.importConfig, this.importConfig)
1197
+ },
1198
+ printOpts () {
1199
+ return this.computePrintOpts
1200
+ },
1201
+ computePrintOpts () {
1202
+ return Object.assign({}, getConfig().table.printConfig, this.printConfig)
1203
+ },
1204
+ expandOpts () {
1205
+ return this.computeExpandOpts
1206
+ },
1207
+ computeExpandOpts () {
1208
+ return Object.assign({}, getConfig().table.expandConfig, this.expandConfig)
1209
+ },
1210
+ treeOpts () {
1211
+ return this.computeTreeOpts
1212
+ },
1213
+ computeTreeOpts () {
1214
+ return Object.assign({}, getConfig().table.treeConfig, this.treeConfig)
1215
+ },
1216
+ emptyOpts () {
1217
+ return this.computeEmptyOpts
1218
+ },
1219
+ computeEmptyOpts () {
1220
+ return Object.assign({}, getConfig().table.emptyRender, this.emptyRender)
1221
+ },
1222
+ loadingOpts () {
1223
+ return this.computeLoadingOpts
1224
+ },
1225
+ computeLoadingOpts () {
1226
+ return Object.assign({}, getConfig().table.loadingConfig, this.loadingConfig)
1227
+ },
1228
+ computeCellOffsetWidth () {
1229
+ return this.border ? Math.max(2, Math.ceil(this.scrollbarWidth / this.tableColumn.length)) : 1
1230
+ },
1231
+ customOpts () {
1232
+ return this.computeCustomOpts
1233
+ },
1234
+ computeCustomOpts () {
1235
+ return Object.assign({}, getConfig().table.customConfig, this.customConfig)
1236
+ },
1237
+ computeCustomSimpleMode () {
1238
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1239
+ const props = $xeTable
1240
+
1241
+ const { minHeight, height } = props
1242
+ const customOpts = $xeTable.computeCustomOpts
1243
+ const { mode, popupOptions, placement } = customOpts
1244
+ if (!placement || placement === 'top-left' || placement === 'top-right') {
1245
+ if (!(mode === 'modal' || mode === 'drawer')) {
1246
+ const { mode } = popupOptions || {}
1247
+ if (!mode || mode === 'auto') {
1248
+ if (height || minHeight) {
1249
+ return 'inside'
1250
+ }
1251
+ return 'outside'
1252
+ }
1253
+ if (mode) {
1254
+ return mode
1255
+ }
1256
+ }
1257
+ }
1258
+ return ''
1259
+ },
1260
+ computeTableStyle () {
1261
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1262
+
1263
+ const scrollbarOpts = $xeTable.computeScrollbarOpts
1264
+ const { width, height } = scrollbarOpts
1265
+ const tStys: VxeComponentStyleType = {}
1266
+ if (width) {
1267
+ tStys['--vxe-ui-table-view-scrollbar-width'] = toCssUnit(width)
1268
+ }
1269
+ if (height) {
1270
+ tStys['--vxe-ui-table-view-scrollbar-height'] = toCssUnit(height)
1271
+ }
1272
+ return tStys
1273
+ },
1274
+ computeTableRowExpandedList () {
1275
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1276
+ const reactData = $xeTable as unknown as TableReactData
1277
+ const internalData = $xeTable as unknown as TableInternalData
1278
+
1279
+ const { tableData, rowExpandedFlag, expandColumn, rowGroupExpandedFlag, treeExpandedFlag } = reactData
1280
+ const { visibleDataRowIdData, rowExpandedMaps } = internalData
1281
+ const expandList: any[] = []
1282
+ if (tableData.length && expandColumn && rowExpandedFlag && rowGroupExpandedFlag && treeExpandedFlag) {
1283
+ XEUtils.each(rowExpandedMaps, (row, rowid) => {
1284
+ if (visibleDataRowIdData[rowid]) {
1285
+ expandList.push(row)
1286
+ }
1287
+ })
1288
+ }
1289
+ return expandList
1290
+ },
1291
+ computeAutoWidthColumnList () {
1292
+ const { tableColumn, visibleColumn } = this
1293
+ return tableColumn.length || visibleColumn.length ? visibleColumn.filter((column: any) => column.width === 'auto' || column.minWidth === 'auto') : []
1294
+ },
1295
+ computeFixedColumnSize () {
1296
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1297
+ const reactData = $xeTable as unknown as TableReactData
1298
+ const internalData = $xeTable as unknown as TableInternalData
1299
+
1300
+ const { tableColumn } = reactData
1301
+ const { collectColumn } = internalData
1302
+ let fixedSize = 0
1303
+ // 只判断第一层
1304
+ if (tableColumn.length && collectColumn.length) {
1305
+ collectColumn.forEach((column: any) => {
1306
+ if (column.renderFixed) {
1307
+ fixedSize++
1308
+ }
1309
+ })
1310
+ }
1311
+ return fixedSize
1312
+ },
1313
+ fixedColumnSize () {
1314
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1315
+
1316
+ return $xeTable.computeFixedColumnSize
1317
+ },
1318
+ computeIsMaxFixedColumn () {
1319
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1320
+
1321
+ const fixedColumnSize = $xeTable.computeFixedColumnSize
1322
+ const columnOpts = $xeTable.columnOpts
1323
+ const { maxFixedSize } = columnOpts
1324
+ if (maxFixedSize) {
1325
+ return fixedColumnSize >= maxFixedSize
1326
+ }
1327
+ return false
1328
+ },
1329
+ computeKeepFields () {
1330
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1331
+ const reactData = $xeTable as unknown as TableReactData
1332
+ const internalData = $xeTable as unknown as TableInternalData
1333
+
1334
+ const { tableFullColumn } = internalData
1335
+ const { updateColFlag } = reactData
1336
+ const editDirtyOpts = $xeTable.computeEditDirtyOpts
1337
+ const { includeFields, excludeFields } = editDirtyOpts
1338
+ const kpFields: string[] = []
1339
+ if (updateColFlag) {
1340
+ if (includeFields && includeFields.length) {
1341
+ return includeFields
1342
+ }
1343
+ const exfMaps: Record<string, number> = {}
1344
+ if (excludeFields && excludeFields.length) {
1345
+ excludeFields.forEach(field => {
1346
+ exfMaps[field] = 1
1347
+ })
1348
+ }
1349
+ for (let i = 0; i < tableFullColumn.length; i++) {
1350
+ const column = tableFullColumn[i]
1351
+ const { field, type, editRender, cellRender } = column
1352
+ if (field && !type && (editRender || cellRender) && !exfMaps[field]) {
1353
+ kpFields.push(field)
1354
+ }
1355
+ }
1356
+ }
1357
+ return kpFields
1358
+ },
1359
+ computeTableBorder () {
1360
+ const $xeTable = this
1361
+ const props = $xeTable
1362
+
1363
+ const { border } = props
1364
+ if (border === true) {
1365
+ return 'full'
1366
+ }
1367
+ if (border) {
1368
+ return border
1369
+ }
1370
+ return 'default'
1371
+ },
1372
+ /**
1373
+ * 判断列全选的复选框是否禁用
1374
+ */
1375
+ computeIsAllCheckboxDisabled () {
1376
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1377
+ const props = $xeTable
1378
+ const reactData = $xeTable as unknown as TableReactData
1379
+ const internalData = $xeTable as unknown as TableInternalData
1380
+
1381
+ const { treeConfig } = props
1382
+ const { tableData } = reactData
1383
+ const { tableFullData } = internalData
1384
+ const checkboxOpts = $xeTable.computeCheckboxOpts
1385
+ const { strict, checkMethod } = checkboxOpts
1386
+ if (strict) {
1387
+ if (tableData.length || tableFullData.length) {
1388
+ if (checkMethod) {
1389
+ if (treeConfig) {
1390
+ // 暂时不支持树形结构
1391
+ }
1392
+ // 如果所有行都被禁用
1393
+ return tableFullData.every((row) => !checkMethod({ $table: $xeTable, row }))
1394
+ }
1395
+ return false
1396
+ }
1397
+ return true
1398
+ }
1399
+ return false
1400
+ },
1401
+ isAllCheckboxDisabled () {
1402
+ return this.computeIsAllCheckboxDisabled
1403
+ },
1404
+ computeVirtualScrollBars () {
1405
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1406
+ const reactData = $xeTable as unknown as TableReactData
1407
+
1408
+ const { overflowX, scrollXLoad, overflowY, scrollYLoad } = reactData
1409
+ return {
1410
+ x: overflowX && scrollXLoad,
1411
+ y: overflowY && scrollYLoad
1412
+ }
1413
+ },
1414
+ computeRowGroupFields () {
1415
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1416
+
1417
+ const aggregateOpts = $xeTable.computeAggregateOpts
1418
+ return aggregateOpts.groupFields
1419
+ },
1420
+ computeRowGroupColumns () {
1421
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1422
+ const reactData = $xeTable as unknown as TableReactData
1423
+ const internalData = $xeTable as unknown as TableInternalData
1424
+
1425
+ const { rowGroupList } = reactData
1426
+ const { fullColumnFieldData } = internalData
1427
+ const rgColumns: VxeTableDefines.ColumnInfo[] = []
1428
+ rowGroupList.forEach(aggConf => {
1429
+ const colRest = fullColumnFieldData[aggConf.field]
1430
+ if (colRest) {
1431
+ rgColumns.push(colRest.column)
1432
+ }
1433
+ })
1434
+ return rgColumns
1435
+ },
1436
+ computeAggFuncColumns () {
1437
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1438
+ const reactData = $xeTable as unknown as TableReactData
1439
+
1440
+ const { rowGroupList, tableColumn } = reactData
1441
+ if (rowGroupList.length) {
1442
+ return tableColumn.filter(column => column.field && column.aggFunc)
1443
+ }
1444
+ return []
1445
+ },
1446
+ computeUndoHistoryOpts () {
1447
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1448
+ const props = $xeTable
1449
+
1450
+ return Object.assign({}, getConfig().table.undoHistoryConfig, props.undoHistoryConfig)
1451
+ },
1452
+ tabsResizeFlag () {
1453
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1454
+ const $xeTabs = $xeTable.$xeTabs
1455
+
1456
+ return $xeTabs ? $xeTabs.reactData.resizeFlag : null
1457
+ },
1458
+ computeVxeLanguage () {
1459
+ return VxeUI.getLanguage()
1460
+ },
1461
+ computeScrollbarVisible () {
1462
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1463
+
1464
+ const scrollbarXOpts = $xeTable.computeScrollbarXOpts
1465
+ const scrollbarYOpts = $xeTable.computeScrollbarYOpts
1466
+ return `${scrollbarXOpts.visible}${scrollbarYOpts.visible}`
1467
+ }
1468
+ } as any,
1469
+ watch: {
1470
+ data (value: any) {
1471
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1472
+ const reactData = $xeTable as unknown as TableReactData
1473
+
1474
+ const { initStatus } = this
1475
+ if (value && value.length >= 20000) {
1476
+ warnLog('vxe.error.errLargeData', ['loadData(data), reloadData(data)'])
1477
+ }
1478
+ this.loadTableData(value || [], true, true).then(() => {
1479
+ const { scrollXLoad, scrollYLoad, expandColumn } = reactData
1480
+ const expandOpts = $xeTable.computeExpandOpts
1481
+ this.inited = true
1482
+ this.initStatus = true
1483
+ if (!initStatus) {
1484
+ this.handleLoadDefaults()
1485
+ }
1486
+ // const checkboxColumn = this.tableFullColumn.find(column => column.type === 'checkbox')
1487
+ // if (checkboxColumn && this.tableFullData.length > 300 && !this.checkboxOpts.checkField) {
1488
+ // warnLog('vxe.error.checkProp', ['checkbox-config.checkField'])
1489
+ // }
1490
+ if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
1491
+ warnLog('vxe.error.scrollErrProp', ['column.type=expand'])
1492
+ }
1493
+ this.recalculate()
1494
+ })
1495
+ },
1496
+ staticColumns (value: any) {
1497
+ this.$nextTick(() => this.handleInitColumn(XEUtils.clone(value)))
1498
+ },
1499
+ tableColumn () {
1500
+ this.analyColumnWidth()
1501
+ },
1502
+ upDataFlag () {
1503
+ this.$nextTick().then(() => this.updateData())
1504
+ },
1505
+ reColumnFlag () {
1506
+ this.$nextTick().then(() => this.refreshColumn())
1507
+ },
1508
+
1509
+ computeSize () {
1510
+ this.reLayoutFlag++
1511
+ },
1512
+ showHeader () {
1513
+ this.reLayoutFlag++
1514
+ },
1515
+ showFooter () {
1516
+ this.reLayoutFlag++
1517
+ },
1518
+ showHeaderOverflow () {
1519
+ this.reLayoutFlag++
1520
+ },
1521
+ showOverflow () {
1522
+ const $xeTable = this
1523
+
1524
+ updateColumnAllOverflow($xeTable)
1525
+ this.reLayoutFlag++
1526
+ },
1527
+ showFooterOverflow () {
1528
+ this.reLayoutFlag++
1529
+ },
1530
+ overflowX () {
1531
+ this.reLayoutFlag++
1532
+ },
1533
+ overflowY () {
1534
+ this.reLayoutFlag++
1535
+ },
1536
+ height () {
1537
+ this.reLayoutFlag++
1538
+ },
1539
+ maxHeight () {
1540
+ this.reLayoutFlag++
1541
+ },
1542
+ computeScrollbarXToTop () {
1543
+ this.reLayoutFlag++
1544
+ },
1545
+ computeScrollbarYToLeft () {
1546
+ this.reLayoutFlag++
1547
+ },
1548
+ computeVxeLanguage () {
1549
+ this.reLayoutFlag++
1550
+ },
1551
+ computeScrollbarVisible () {
1552
+ this.reLayoutFlag++
1553
+ },
1554
+ reLayoutFlag () {
1555
+ const $xeTable = this
1556
+
1557
+ $xeTable.$nextTick(() => $xeTable.recalculate(true))
1558
+ },
1559
+
1560
+ footerData () {
1561
+ this.footFlag++
1562
+ },
1563
+ footFlag () {
1564
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1565
+ const internalData = $xeTable as unknown as TableInternalData
1566
+
1567
+ internalData.footerFullDataRowData = {}
1568
+ $xeTable.updateFooter()
1569
+ },
1570
+
1571
+ updateColFlag () {
1572
+ this.kfFlag++
1573
+ },
1574
+ computeKeepFields () {
1575
+ this.kfFlag++
1576
+ },
1577
+ kfFlag () {
1578
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1579
+ const internalData = $xeTable as unknown as TableInternalData
1580
+
1581
+ const keepFields = $xeTable.computeKeepFields
1582
+ const kpfMaps: Record<string, number> = {}
1583
+ keepFields.forEach(field => {
1584
+ kpfMaps[field] = 1
1585
+ })
1586
+ internalData.keepUpdateFieldMaps = kpfMaps
1587
+ },
1588
+
1589
+ syncResize (value: any) {
1590
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1591
+
1592
+ if (value) {
1593
+ handleUpdateResize($xeTable)
1594
+ $xeTable.$nextTick(() => {
1595
+ handleUpdateResize($xeTable)
1596
+ setTimeout(() => handleUpdateResize($xeTable))
1597
+ })
1598
+ }
1599
+ },
1600
+ tabsResizeFlag () {
1601
+ this.handleGlobalResizeEvent()
1602
+ },
1603
+ mergeCells (value: any) {
1604
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1605
+
1606
+ handleUpdateMergeBodyCells($xeTable, value)
1607
+ },
1608
+ mergeHeaderCells (value: any) {
1609
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1610
+
1611
+ handleUpdateMergeHeaderCells($xeTable, value)
1612
+ },
1613
+ mergeFooterCells () {
1614
+ this.mergeFooteCellFlag++
1615
+ },
1616
+ mergeFooterItems () {
1617
+ this.mergeFooteCellFlag++
1618
+ },
1619
+ mergeFooteCellFlag () {
1620
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1621
+ const props = $xeTable
1622
+
1623
+ const mFooterCells = props.mergeFooterCells || props.mergeFooterItems
1624
+ handleUpdateMergeFooterCells($xeTable, mFooterCells || [])
1625
+ },
1626
+
1627
+ computeRowGroupFields (val: any) {
1628
+ const $xeTable = this
1629
+
1630
+ $xeTable.handleUpdateRowGroup(val)
1631
+ },
1632
+ computeRowField () {
1633
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1634
+ const reactData = $xeTable as unknown as TableReactData
1635
+ const internalData = $xeTable as unknown as TableInternalData
1636
+
1637
+ // 行主键被改变,重载表格
1638
+ const { inited, tableFullData } = internalData
1639
+ if (inited) {
1640
+ handleKeyField($xeTable)
1641
+ reactData.tableData = []
1642
+ $xeTable.$nextTick(() => {
1643
+ $xeTable.reloadData(tableFullData)
1644
+ })
1645
+ }
1646
+ }
1647
+ } as any,
1648
+ created () {
1649
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1650
+ const props = $xeTable
1651
+ const internalData = $xeTable as unknown as TableInternalData
1652
+
1653
+ XEUtils.assign(internalData, createInternalData())
1654
+
1655
+ handleKeyField($xeTable)
1656
+
1657
+ const { exportConfig, importConfig, treeConfig, minHeight } = props
1658
+ const { scrollXStore, scrollYStore } = internalData
1659
+ const columnOpts = $xeTable.computeColumnOpts
1660
+ const columnDragOpts = $xeTable.computeColumnDragOpts
1661
+ const editOpts = $xeTable.computeEditOpts
1662
+ const treeOpts = $xeTable.computeTreeOpts
1663
+ const radioOpts = $xeTable.computeRadioOpts
1664
+ const checkboxOpts = $xeTable.computeCheckboxOpts
1665
+ const expandOpts = $xeTable.computeExpandOpts
1666
+ const rowOpts = $xeTable.computeRowOpts
1667
+ const customOpts = $xeTable.computeCustomOpts
1668
+ const mouseOpts = $xeTable.computeMouseOpts
1669
+ const exportOpts = $xeTable.computeExportOpts
1670
+ const importOpts = $xeTable.computeImportOpts
1671
+ // const currentRowOpts = $xeTable.computeCurrentRowOpts
1672
+ // const currentColumnOpts = $xeTable.computeCurrentColumnOpts
1673
+ // const keyboardOpts = $xeTable.computeKeyboardOpts
1674
+ const aggregateOpts = $xeTable.computeAggregateOpts
1675
+ const rowDragOpts = $xeTable.computeRowDragOpts
1676
+ const areaOpts = $xeTable.computeAreaOpts
1677
+ const { groupFields } = aggregateOpts
1678
+
1679
+ if (props.rowId) {
1680
+ warnLog('vxe.error.delProp', ['row-id', 'row-config.keyField'])
1681
+ }
1682
+ if (props.rowKey) {
1683
+ warnLog('vxe.error.delProp', ['row-key', 'row-config.useKey'])
1684
+ }
1685
+ if (props.columnKey) {
1686
+ warnLog('vxe.error.delProp', ['column-id', 'column-config.useKey'])
1687
+ }
1688
+ if (!(props.rowId || rowOpts.keyField) && (checkboxOpts.reserve || checkboxOpts.checkRowKeys || radioOpts.reserve || radioOpts.checkRowKey || expandOpts.expandRowKeys || treeOpts.expandRowKeys)) {
1689
+ warnLog('vxe.error.reqProp', ['row-config.keyField'])
1690
+ }
1691
+ if (props.editConfig && editOpts.showStatus && !props.keepSource) {
1692
+ warnLog('vxe.error.reqProp', ['keep-source'])
1693
+ }
1694
+ // if (treeConfig && (treeOpts.showLine || treeOpts.line) && !showOverflow) {
1695
+ // warnLog('vxe.error.reqProp', ['show-overflow'])
1696
+ // }
1697
+ if (treeConfig && !treeOpts.transform && props.stripe) {
1698
+ warnLog('vxe.error.noTree', ['stripe'])
1699
+ }
1700
+ if (props.showFooter && !(props.footerMethod || props.footerData)) {
1701
+ warnLog('vxe.error.reqProp', ['footer-data | footer-method'])
1702
+ }
1703
+ if (rowOpts.height) {
1704
+ warnLog('vxe.error.delProp', ['row-config.height', 'cell-config.height'])
1705
+ }
1706
+ if (this.tooltipOpts.enabled) {
1707
+ warnLog('vxe.error.delProp', ['tooltip-config.enabled', 'tooltip-config.showAll'])
1708
+ }
1709
+ if (this.highlightCurrentRow) {
1710
+ warnLog('vxe.error.delProp', ['highlight-current-row', 'row-config.isCurrent'])
1711
+ }
1712
+ if (this.highlightHoverRow) {
1713
+ warnLog('vxe.error.delProp', ['highlight-hover-row', 'row-config.isHover'])
1714
+ }
1715
+ if (this.highlightCurrentColumn) {
1716
+ warnLog('vxe.error.delProp', ['highlight-current-column', 'column-config.isCurrent'])
1717
+ }
1718
+ if (this.highlightHoverColumn) {
1719
+ warnLog('vxe.error.delProp', ['highlight-hover-column', 'column-config.isHover'])
1720
+ }
1721
+ if (props.resizable) {
1722
+ warnLog('vxe.error.delProp', ['resizable', 'column-config.resizable'])
1723
+ }
1724
+ // if (props.virtualXConfig && props.scrollX) {
1725
+ // warnLog('vxe.error.notSupportProp', ['virtual-x-config', 'scroll-x', 'scroll-x=null'])
1726
+ // }
1727
+ // if (props.virtualYConfig && props.scrollY) {
1728
+ // warnLog('vxe.error.notSupportProp', ['virtual-y-config', 'scroll-y', 'scroll-y=null'])
1729
+ // }
1730
+ if (props.aggregateConfig && props.rowGroupConfig) {
1731
+ warnLog('vxe.error.notSupportProp', ['aggregate-config', 'row-group-config', 'row-group-config=null'])
1732
+ }
1733
+ // if (props.scrollY) {
1734
+ // warnLog('vxe.error.delProp', ['scroll-y', 'virtual-y-config'])
1735
+ // }
1736
+ // if (props.scrollX) {
1737
+ // warnLog('vxe.error.delProp', ['scroll-x', 'virtual-x-config'])
1738
+ // }
1739
+ // 检查导入导出类型,如果自定义导入导出方法,则不校验类型
1740
+ if (importConfig && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(XEUtils.keys(importOpts._typeMaps), importOpts.types)) {
1741
+ warnLog('vxe.error.errProp', [`export-config.types=${importOpts.types.join(',')}`, importOpts.types.filter((type) => XEUtils.includes(XEUtils.keys(importOpts._typeMaps), type)).join(',') || XEUtils.keys(importOpts._typeMaps).join(',')])
1742
+ }
1743
+ if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(XEUtils.keys(exportOpts._typeMaps), exportOpts.types)) {
1744
+ warnLog('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter((type) => XEUtils.includes(XEUtils.keys(exportOpts._typeMaps), type)).join(',') || XEUtils.keys(exportOpts._typeMaps).join(',')])
1745
+ }
1746
+
1747
+ if (!props.id) {
1748
+ if ((props.customConfig ? isEnableConf(customOpts) : customOpts.enabled) && customOpts.storage) {
1749
+ errLog('vxe.error.reqProp', ['id'])
1750
+ }
1751
+ }
1752
+ if (treeConfig && checkboxOpts.range) {
1753
+ errLog('vxe.error.noTree', ['checkbox-config.range'])
1754
+ }
1755
+ if (rowOpts.height && !this.showOverflow) {
1756
+ warnLog('vxe.error.notProp', ['table.show-overflow'])
1757
+ }
1758
+ if (!$xeTable.triggerClAreaModnEvent) {
1759
+ if (props.areaConfig) {
1760
+ warnLog('vxe.error.notProp', ['area-config'])
1761
+ }
1762
+ if (props.clipConfig) {
1763
+ warnLog('vxe.error.notProp', ['clip-config'])
1764
+ }
1765
+ if (props.fnrConfig) {
1766
+ warnLog('vxe.error.notProp', ['fnr-config'])
1767
+ }
1768
+ if (mouseOpts.area) {
1769
+ errLog('vxe.error.notProp', ['mouse-config.area'])
1770
+ return
1771
+ }
1772
+ if (mouseOpts.area && areaOpts.selectCellByHeader && columnOpts.drag && columnDragOpts.trigger === 'cell') {
1773
+ errLog('vxe.error.notSupportProp', ['area-config.selectCellByHeader & column-config.drag', 'column-drag-config.trigger=cell', 'column-drag-config.trigger=default | area-config.selectCellByHeader=false'])
1774
+ }
1775
+ }
1776
+ if (!$xeTable.handlePivotTableAggregateData) {
1777
+ if (customOpts.allowGroup) {
1778
+ errLog('vxe.error.notProp', ['custom-config.allowGroup'])
1779
+ return
1780
+ }
1781
+ if (customOpts.allowValues) {
1782
+ errLog('vxe.error.notProp', ['custom-config.allowValues'])
1783
+ return
1784
+ }
1785
+ }
1786
+ if (treeConfig && rowOpts.drag && !treeOpts.transform) {
1787
+ warnLog('vxe.error.notSupportProp', ['row-config.drag', 'tree-config.transform=false', 'tree-config.transform=true'])
1788
+ }
1789
+ if (treeConfig && rowDragOpts.isCrossTableDrag && !rowDragOpts.isCrossDrag) {
1790
+ errLog('vxe.error.reqSupportProp', ['tree-config & row-drag-config.isCrossTableDrag', 'row-drag-config.isCrossDrag'])
1791
+ }
1792
+ if (props.dragConfig) {
1793
+ warnLog('vxe.error.delProp', ['drag-config', 'row-drag-config'])
1794
+ }
1795
+ if (props.rowGroupConfig) {
1796
+ warnLog('vxe.error.delProp', ['row-group-config', 'aggregate-config'])
1797
+ }
1798
+ if (aggregateOpts.countFields) {
1799
+ warnLog('vxe.error.delProp', ['row-group-config.countFields', 'column.agg-func'])
1800
+ }
1801
+ if (aggregateOpts.aggregateMethod) {
1802
+ warnLog('vxe.error.delProp', ['row-group-config.aggregateMethod', 'aggregate-config.calcValuesMethod'])
1803
+ }
1804
+ if (aggregateOpts.countMethod) {
1805
+ warnLog('vxe.error.delProp', ['aggregate-config.countMethod', 'aggregate-config.calcValuesMethod'])
1806
+ }
1807
+ if (props.treeConfig && treeOpts.children) {
1808
+ warnLog('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField'])
1809
+ }
1810
+ if (props.treeConfig && treeOpts.line) {
1811
+ warnLog('vxe.error.delProp', ['tree-config.line', 'tree-config.showLine'])
1812
+ }
1813
+ if (mouseOpts.area && mouseOpts.selected) {
1814
+ warnLog('vxe.error.errConflicts', ['mouse-config.area', 'mouse-config.selected'])
1815
+ }
1816
+ if (mouseOpts.area && (props.treeConfig && !treeOpts.transform)) {
1817
+ errLog('vxe.error.noTree', ['mouse-config.area'])
1818
+ }
1819
+ if (props.editConfig && editOpts.activeMethod) {
1820
+ warnLog('vxe.error.delProp', ['table.edit-config.activeMethod', 'table.edit-config.beforeEditMethod'])
1821
+ }
1822
+ if (props.treeConfig && checkboxOpts.isShiftKey) {
1823
+ errLog('vxe.error.errConflicts', ['tree-config', 'checkbox-config.isShiftKey'])
1824
+ }
1825
+ if (checkboxOpts.halfField) {
1826
+ warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField'])
1827
+ }
1828
+ if (props.editConfig && isEnableConf(editOpts) && props.editRules && (minHeight === 0 || minHeight === '0')) {
1829
+ warnLog('vxe.error.reqSupportProp', ['edit-config & edit-rules', 'min-height'])
1830
+ }
1831
+
1832
+ if (treeConfig) {
1833
+ XEUtils.arrayEach(['rowField', 'parentField', 'childrenField', 'hasChildField', 'mapChildrenField'], key => {
1834
+ const val = treeOpts[key as 'rowField']
1835
+ if (val && val.indexOf('.') > -1) {
1836
+ errLog('vxe.error.errProp', [`${key}=${val}`, `${key}=${val.split('.')[0]}`])
1837
+ }
1838
+ })
1839
+ }
1840
+
1841
+ // 在 v3.0 中废弃 context-menu
1842
+ if (this.contextMenu) {
1843
+ warnLog('vxe.error.delProp', ['context-menu', 'menu-config'])
1844
+ if (!XEUtils.isObject(this.contextMenu)) {
1845
+ warnLog('vxe.error.errProp', [`table.context-menu=${this.contextMenu}`, 'table.context-menu={}'])
1846
+ }
1847
+ }
1848
+ if (props.menuConfig && !XEUtils.isObject(props.menuConfig)) {
1849
+ warnLog('vxe.error.errProp', [`table.menu-config=${props.menuConfig}`, 'table.menu-config={}'])
1850
+ }
1851
+ if (props.exportConfig && !XEUtils.isObject(props.exportConfig)) {
1852
+ warnLog('vxe.error.errProp', [`table.export-config=${props.exportConfig}`, 'table.export-config={}'])
1853
+ }
1854
+ if (props.importConfig && !XEUtils.isObject(props.importConfig)) {
1855
+ warnLog('vxe.error.errProp', [`table.import-config=${props.importConfig}`, 'table.import-config={}'])
1856
+ }
1857
+ if (props.printConfig && !XEUtils.isObject(props.printConfig)) {
1858
+ warnLog('vxe.error.errProp', [`table.print-config=${props.printConfig}`, 'table.print-config={}'])
1859
+ }
1860
+ if (props.treeConfig && !XEUtils.isObject(props.treeConfig)) {
1861
+ warnLog('vxe.error.errProp', [`table.tree-config=${props.treeConfig}`, 'table.tree-config={}'])
1862
+ }
1863
+ if (props.customConfig && !XEUtils.isObject(props.customConfig)) {
1864
+ warnLog('vxe.error.errProp', [`table.custom-config=${props.customConfig}`, 'table.custom-config={}'])
1865
+ }
1866
+ if (props.editConfig && !XEUtils.isObject(props.editConfig)) {
1867
+ warnLog('vxe.error.errProp', [`table.edit-config=${props.editConfig}`, 'table.edit-config={}'])
1868
+ }
1869
+ if (props.emptyRender && !XEUtils.isObject(props.emptyRender)) {
1870
+ warnLog('vxe.error.errProp', [`table.empty-render=${props.emptyRender}`, 'table.empty-render={}'])
1871
+ }
1872
+
1873
+ if (rowOpts.currentMethod) {
1874
+ warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-row-config.beforeSelectMethod'])
1875
+ }
1876
+ if (columnOpts.currentMethod) {
1877
+ warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-column-config.beforeSelectMethod'])
1878
+ }
1879
+ // if ((rowOpts.isCurrent || highlightCurrentRow) && props.keyboardConfig && keyboardOpts.isArrow && !XEUtils.isBoolean(currentRowOpts.isFollowSelected)) {
1880
+ // warnLog('vxe.error.notConflictProp', ['row-config.isCurrent & keyboard-config.isArrow', 'current-row-config.isFollowSelected'])
1881
+ // }
1882
+ // if ((columnOpts.isCurrent || highlightCurrentColumn) && props.keyboardConfig && keyboardOpts.isArrow && !XEUtils.isBoolean(currentColumnOpts.isFollowSelected)) {
1883
+ // warnLog('vxe.error.notConflictProp', ['column-config.isCurrent & keyboard-config.isArrow', 'current-column-config.isFollowSelected'])
1884
+ // }
1885
+
1886
+ // 如果不支持虚拟滚动
1887
+ // if (props.spanMethod) {
1888
+ // if (virtualXOpts.enabled) {
1889
+ // warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-x-config.enabled=false'])
1890
+ // }
1891
+ // if (virtualYOpts.enabled) {
1892
+ // warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-y-config.enabled=false'])
1893
+ // }
1894
+ // }
1895
+ // if (props.footerSpanMethod) {
1896
+ // if (virtualXOpts.enabled) {
1897
+ // warnLog('vxe.error.notConflictProp', ['footer-span-method', 'virtual-x-config.enabled=false'])
1898
+ // }
1899
+ // }
1900
+
1901
+ // 检查是否有安装需要的模块
1902
+ if (props.editConfig && !$xeTable.insert) {
1903
+ errLog('vxe.error.reqModule', ['Edit'])
1904
+ }
1905
+ if (props.editRules && !$xeTable.validate) {
1906
+ errLog('vxe.error.reqModule', ['Validator'])
1907
+ }
1908
+ if ((checkboxOpts.range || props.keyboardConfig || props.mouseConfig) && !$xeTable.handleCellMousedownEvent) {
1909
+ errLog('vxe.error.reqModule', ['Keyboard'])
1910
+ }
1911
+ if ((props.printConfig || props.importConfig || props.exportConfig) && !$xeTable.exportData) {
1912
+ errLog('vxe.error.reqModule', ['Export'])
1913
+ }
1914
+
1915
+ Object.assign(scrollYStore, {
1916
+ startIndex: 0,
1917
+ endIndex: 1,
1918
+ visibleSize: 0
1919
+ })
1920
+ Object.assign(scrollXStore, {
1921
+ startIndex: 0,
1922
+ endIndex: 1,
1923
+ visibleSize: 0
1924
+ })
1925
+
1926
+ this.handleUpdateRowGroup(groupFields)
1927
+
1928
+ this.initData()
1929
+
1930
+ globalEvents.on($xeTable, 'paste', this.handleGlobalPasteEvent)
1931
+ globalEvents.on($xeTable, 'copy', this.handleGlobalCopyEvent)
1932
+ globalEvents.on($xeTable, 'cut', this.handleGlobalCutEvent)
1933
+ globalEvents.on($xeTable, 'mousedown', this.handleGlobalMousedownEvent)
1934
+ globalEvents.on($xeTable, 'blur', this.handleGlobalBlurEvent)
1935
+ globalEvents.on($xeTable, 'mousewheel', this.handleGlobalMousewheelEvent)
1936
+ globalEvents.on($xeTable, 'keydown', this.handleGlobalKeydownEvent)
1937
+ globalEvents.on($xeTable, 'resize', this.handleGlobalResizeEvent)
1938
+ globalEvents.on($xeTable, 'contextmenu', this.handleGlobalContextmenuEvent)
1939
+ $xeTable.preventEvent(null, 'created')
1940
+ },
1941
+ mounted () {
1942
+ const $xeTable = this
1943
+ const props = $xeTable
1944
+ const internalData = $xeTable as unknown as TableInternalData
1945
+ const $xeGrid = $xeTable.$xeGrid
1946
+ const $xeGantt = $xeTable.$xeGantt
1947
+ const $xeGGWrapper = $xeGrid || $xeGantt
1948
+
1949
+ const columnOpts = $xeTable.computeColumnOpts
1950
+ const rowOpts = $xeTable.computeRowOpts
1951
+ const customOpts = $xeTable.computeCustomOpts
1952
+ const virtualYOpts = $xeTable.computeVirtualYOpts
1953
+
1954
+ if ($xeGantt) {
1955
+ const classifyWrapperEl = $xeGantt.$refs.refClassifyWrapperElem as HTMLDivElement
1956
+ const teleportWrapperEl = $xeTable.$refs.refTeleportWrapper as HTMLDivElement
1957
+ if (classifyWrapperEl) {
1958
+ if (teleportWrapperEl) {
1959
+ classifyWrapperEl.appendChild(teleportWrapperEl)
1960
+ }
1961
+ internalData.teleportToWrapperElem = classifyWrapperEl
1962
+ }
1963
+ }
1964
+ if ($xeGGWrapper) {
1965
+ const popupContainerElem = $xeGGWrapper.$refs.refPopupContainerElem as HTMLDivElement
1966
+ const popupWrapperEl = $xeTable.$refs.refPopupWrapperElem as HTMLDivElement
1967
+ if (popupContainerElem) {
1968
+ if (popupWrapperEl) {
1969
+ popupContainerElem.appendChild(popupWrapperEl)
1970
+ }
1971
+ internalData.popupToWrapperElem = popupContainerElem
1972
+ }
1973
+ }
1974
+
1975
+ if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
1976
+ initTpImg()
1977
+ }
1978
+
1979
+ const { $listeners } = this
1980
+ if (!this.menuConfig && ($listeners['menu-click'] || $listeners['cell-menu'] || $listeners['header-cell-menu'] || $listeners['footer-cell-menu'])) {
1981
+ warnLog('vxe.error.reqProp', ['menu-config'])
1982
+ }
1983
+ if (!this.tooltipConfig && ($listeners['cell-mouseenter'] || $listeners['cell-mouseleave'])) {
1984
+ warnLog('vxe.error.reqProp', ['tooltip-config'])
1985
+ }
1986
+
1987
+ $xeTable.$nextTick(() => {
1988
+ // 使用已安装的组件,如果未安装则不渲染
1989
+ const VxeUILoadingComponent = VxeUI.getComponent('VxeLoading')
1990
+ const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
1991
+
1992
+ if (props.loading) {
1993
+ if (!VxeUILoadingComponent && !this.$scopedSlots.loading) {
1994
+ errLog('vxe.error.errProp', ['loading=true', 'loading=false | <template #loading>...</template>'])
1995
+ errLog('vxe.error.reqComp', ['vxe-loading'])
1996
+ }
1997
+ }
1998
+ if ((props.showOverflow === true || props.showOverflow === 'tooltip') ||
1999
+ (props.showHeaderOverflow === true || props.showHeaderOverflow === 'tooltip') ||
2000
+ (props.showFooterOverflow === true || props.showFooterOverflow === 'tooltip') ||
2001
+ props.tooltipConfig || props.editRules) {
2002
+ if (!VxeUITooltipComponent) {
2003
+ if (props.showOverflow === true) {
2004
+ errLog('vxe.error.errProp', ['show-overflow=true', 'show-overflow=title'])
2005
+ }
2006
+ if (props.showOverflow === 'tooltip') {
2007
+ errLog('vxe.error.errProp', ['show-overflow=tooltip', 'show-overflow=title'])
2008
+ }
2009
+ if (props.showHeaderOverflow === true) {
2010
+ errLog('vxe.error.errProp', ['show-header-overflow=true', 'show-header-overflow=title'])
2011
+ }
2012
+ if (props.showHeaderOverflow === 'tooltip') {
2013
+ errLog('vxe.error.errProp', ['show-header-overflow=tooltip', 'show-header-overflow=title'])
2014
+ }
2015
+ if (props.showFooterOverflow === true) {
2016
+ errLog('vxe.error.errProp', ['show-footer-overflow=true', 'show-footer-overflow=title'])
2017
+ }
2018
+ if (props.showFooterOverflow === 'tooltip') {
2019
+ errLog('vxe.error.errProp', ['show-footer-overflow=tooltip', 'show-footer-overflow=title'])
2020
+ }
2021
+ errLog('vxe.error.reqComp', ['vxe-tooltip'])
2022
+ }
2023
+ }
2024
+
2025
+ if (this.autoResize) {
2026
+ const resizeObserver = globalResize.create(() => {
2027
+ if (this.autoResize) {
2028
+ this.handleResizeEvent()
2029
+ }
2030
+ })
2031
+ resizeObserver.observe(this.$el)
2032
+ resizeObserver.observe(this.getParentElem())
2033
+ this.$resize = resizeObserver
2034
+ }
2035
+ })
2036
+
2037
+ if (virtualYOpts.mode !== 'scroll') {
2038
+ const tableViewportEl = $xeTable.$refs.refTableViewportElem as HTMLDivElement
2039
+ if (tableViewportEl) {
2040
+ tableViewportEl.addEventListener('wheel', $xeTable.triggerBodyWheelEvent, { passive: false })
2041
+ }
2042
+ }
2043
+
2044
+ $xeTable.preventEvent(null, 'mounted')
2045
+ },
2046
+ activated () {
2047
+ this.recalculate().then(() => this.refreshScroll())
2048
+ this.preventEvent(null, 'activated')
2049
+ },
2050
+ deactivated () {
2051
+ const $xeTable = this
2052
+ const reactData = $xeTable as unknown as TableReactData
2053
+ const internalData = $xeTable as unknown as TableInternalData
2054
+
2055
+ const { filterStore } = reactData
2056
+ if (filterStore.visible) {
2057
+ $xeTable.clearFilter()
2058
+ }
2059
+ $xeTable.closeTooltip()
2060
+ internalData.isActivated = false
2061
+ this.preventEvent(null, 'deactivated')
2062
+ },
2063
+ beforeDestroy () {
2064
+ const $xeTable = this
2065
+ const reactData = $xeTable as unknown as TableReactData
2066
+ const internalData = $xeTable as unknown as TableInternalData
2067
+
2068
+ const { _sToTime } = internalData
2069
+ if (_sToTime) {
2070
+ clearTimeout(_sToTime)
2071
+ }
2072
+
2073
+ const teleportWrapperEl = $xeTable.$refs.refTeleportWrapper as HTMLDivElement
2074
+ if (teleportWrapperEl && teleportWrapperEl.parentElement) {
2075
+ teleportWrapperEl.parentElement.removeChild(teleportWrapperEl)
2076
+ }
2077
+ const popupWrapperEl = $xeTable.$refs.refPopupWrapperElem as HTMLDivElement
2078
+ if (popupWrapperEl && popupWrapperEl.parentElement) {
2079
+ popupWrapperEl.parentElement.removeChild(popupWrapperEl)
2080
+ }
2081
+
2082
+ const tableViewportEl = $xeTable.$refs.refTableViewportElem as HTMLDivElement
2083
+ if (tableViewportEl) {
2084
+ tableViewportEl.removeEventListener('wheel', $xeTable.triggerBodyWheelEvent)
2085
+ }
2086
+
2087
+ if (this.$resize) {
2088
+ this.$resize.disconnect()
2089
+ }
2090
+
2091
+ $xeTable.closeTooltip()
2092
+ $xeTable.closeFilter()
2093
+ $xeTable.closeMenu()
2094
+
2095
+ globalEvents.off($xeTable, 'paste')
2096
+ globalEvents.off($xeTable, 'copy')
2097
+ globalEvents.off($xeTable, 'cut')
2098
+ globalEvents.off($xeTable, 'mousedown')
2099
+ globalEvents.off($xeTable, 'blur')
2100
+ globalEvents.off($xeTable, 'mousewheel')
2101
+ globalEvents.off($xeTable, 'keydown')
2102
+ globalEvents.off($xeTable, 'resize')
2103
+ globalEvents.off($xeTable, 'contextmenu')
2104
+
2105
+ $xeTable.preventEvent(null, 'beforeDestroy')
2106
+
2107
+ XEUtils.assign(reactData, createReactData())
2108
+ XEUtils.assign(internalData, createInternalData())
2109
+ },
2110
+ destroyed () {
2111
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
2112
+
2113
+ $xeTable.preventEvent(null, 'destroyed')
2114
+ },
2115
+ render (h: CreateElement) {
2116
+ // 使用已安装的组件,如果未安装则不渲染
2117
+ const VxeUILoadingComponent = VxeUI.getComponent('VxeLoading')
2118
+ const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
2119
+
2120
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
2121
+ const $xeGrid = $xeTable.$xeGrid
2122
+ const $xeGantt = $xeTable.$xeGantt
2123
+ const props = $xeTable
2124
+ const slots = $xeTable.$scopedSlots
2125
+ const reactData = $xeTable as unknown as TableReactData
2126
+
2127
+ const { xID } = $xeTable
2128
+
2129
+ const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props
2130
+ const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore, tooltipStore } = reactData
2131
+ const { leftList, rightList } = columnStore
2132
+ const loadingSlot = slots.loading
2133
+ const tipSlots = {
2134
+ header: slots.headerTooltip || slots['header-tooltip'],
2135
+ body: slots.tooltip,
2136
+ footer: slots.footerTooltip || slots['footer-tooltip']
2137
+ }
2138
+ const currTooltipSlot = tooltipStore.visible && tooltipStore.type ? tipSlots[tooltipStore.type] : null
2139
+ const tableStyle = ($xeTable as any).computeTableStyle as VxeComponentStyleType
2140
+ const rowDragOpts = $xeTable.computeRowDragOpts
2141
+ const tableTipConfig = $xeTable.computeTableTipConfig
2142
+ const validTipConfig = $xeTable.computeValidTipConfig
2143
+ const validOpts = $xeTable.computeValidOpts
2144
+ const checkboxOpts = $xeTable.computeCheckboxOpts
2145
+ const treeOpts = $xeTable.computeTreeOpts
2146
+ const rowOpts = $xeTable.computeRowOpts
2147
+ const columnOpts = $xeTable.computeColumnOpts
2148
+ const vSize = $xeTable.computeSize
2149
+ const tableBorder = $xeTable.computeTableBorder
2150
+ const mouseOpts = $xeTable.computeMouseOpts
2151
+ const areaOpts = $xeTable.computeAreaOpts
2152
+ const loadingOpts = $xeTable.computeLoadingOpts
2153
+ const isContentMenu = $xeTable.computeIsContentMenu
2154
+ const currLoading = reactData.isColLoading || reactData.isRowLoading || loading
2155
+ const resizableOpts = $xeTable.computeResizableOpts
2156
+ const isArea = mouseConfig && mouseOpts.area
2157
+ const columnDragOpts = $xeTable.computeColumnDragOpts
2158
+ const scrollbarXToTop = $xeTable.computeScrollbarXToTop
2159
+ const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
2160
+ const customSimpleMode = $xeTable.computeCustomSimpleMode
2161
+ const showCustomSimpleOutside = customSimpleMode === 'outside'
2162
+ const { isCrossTableDrag } = rowDragOpts
2163
+ const tbOns: {
2164
+ contextmenu: (...args: any[]) => void
2165
+ keydown: (...args: any[]) => void
2166
+ dragover?: (...args: any[]) => void
2167
+ } = {
2168
+ contextmenu: this.contextMenuEvent,
2169
+ keydown: this.keydownEvent
2170
+ }
2171
+ if (isCrossTableDrag && !tableData.length) {
2172
+ tbOns.dragover = $xeTable.handleCrossTableRowDragoverEmptyEvent
2173
+ }
2174
+ return h('div', {
2175
+ ref: 'refElem',
2176
+ class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
2177
+ [`size--${vSize}`]: vSize,
2178
+ [`valid-msg--${validOpts.msgMode}`]: !!editRules,
2179
+ 'vxe-editable': !!editConfig,
2180
+ 'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete',
2181
+ 'cell--highlight': highlightCell,
2182
+ 'cell--selected': mouseConfig && mouseOpts.selected,
2183
+ 'cell--area': isArea,
2184
+ 'header-cell--area': isArea && areaOpts.selectCellByHeader,
2185
+ 'body-cell--area': isArea && areaOpts.selectCellByBody,
2186
+ 'row--highlight': rowOpts.isHover || highlightHoverRow,
2187
+ 'column--highlight': columnOpts.isHover || highlightHoverColumn,
2188
+ 'checkbox--range': checkboxOpts.range,
2189
+ 'col--drag-cell': columnOpts.drag && columnDragOpts.trigger === 'cell',
2190
+ 'is--header': showHeader,
2191
+ 'not--header': !showHeader,
2192
+ 'is--footer': showFooter,
2193
+ 'not--footer': !showFooter,
2194
+ 'is--group': isGroup,
2195
+ 'is-row-group': isRowGroupStatus,
2196
+ 'is--tree-line': treeConfig && (treeOpts.showLine || treeOpts.line),
2197
+ 'is--fixed-left': leftList.length,
2198
+ 'is--fixed-right': rightList.length,
2199
+ 'is--animat': !!props.animat,
2200
+ 'is--round': props.round,
2201
+ 'is--stripe': !treeConfig && stripe,
2202
+ 'is--loading': currLoading,
2203
+ 'is--empty': !currLoading && !tableData.length,
2204
+ 'is--scroll-y': overflowY,
2205
+ 'not--scroll-y': !overflowY,
2206
+ 'is--scroll-x': overflowX,
2207
+ 'not--scroll-x': !overflowX,
2208
+ 'is--virtual-x': scrollXLoad,
2209
+ 'is--virtual-y': scrollYLoad
2210
+ }],
2211
+ style: tableStyle,
2212
+ attrs: {
2213
+ spellcheck: false
2214
+ },
2215
+ on: tbOns
2216
+ }, [
2217
+ /**
2218
+ * 隐藏列
2219
+ */
2220
+ h('div', {
2221
+ class: 'vxe-table-slots',
2222
+ ref: 'hideColumn'
2223
+ }, this.$slots.default),
2224
+ h('div', {
2225
+ ref: 'refVarElem',
2226
+ class: 'vxe-table-vars'
2227
+ }, [
2228
+ h('div', {
2229
+ class: 'vxe-table-var-default'
2230
+ }),
2231
+ h('div', {
2232
+ class: 'vxe-table-var-medium'
2233
+ }),
2234
+ h('div', {
2235
+ class: 'vxe-table-var-small'
2236
+ }),
2237
+ h('div', {
2238
+ class: 'vxe-table-var-mini'
2239
+ })
2240
+ ]),
2241
+ h('div', {
2242
+ key: 'tw',
2243
+ class: 'vxe-table--render-wrapper'
2244
+ }, scrollbarXToTop
2245
+ ? [
2246
+ renderScrollX(h, $xeTable),
2247
+ renderBody(h, $xeTable)
2248
+ ]
2249
+ : [
2250
+ renderBody(h, $xeTable),
2251
+ renderScrollX(h, $xeTable)
2252
+ ]),
2253
+ /**
2254
+ * 空数据
2255
+ */
2256
+ h('div', {
2257
+ key: 'tn',
2258
+ ref: 'refEmptyPlaceholder',
2259
+ class: 'vxe-table--empty-place-wrapper',
2260
+ attrs: {
2261
+ xid: xID
2262
+ }
2263
+ }, [
2264
+ h('div', {
2265
+ class: 'vxe-table--empty-placeholder'
2266
+ }, [
2267
+ h('div', {
2268
+ class: 'vxe-table--empty-content'
2269
+ }, renderEmptyBody(h, $xeTable))
2270
+ ])
2271
+ ]),
2272
+ /**
2273
+ * 边框线
2274
+ */
2275
+ h('div', {
2276
+ key: 'tl',
2277
+ class: 'vxe-table--border-line'
2278
+ }),
2279
+ /**
2280
+ * 列宽线
2281
+ */
2282
+ h('div', {
2283
+ key: 'tcl',
2284
+ ref: 'refColResizeBar',
2285
+ class: 'vxe-table--resizable-col-bar'
2286
+ }, resizableOpts.showDragTip
2287
+ ? [
2288
+ h('div', {
2289
+ ref: 'refColResizeTip',
2290
+ class: 'vxe-table--resizable-number-tip'
2291
+ })
2292
+ ]
2293
+ : []),
2294
+ h('div', {
2295
+ key: 'ttw'
2296
+ }, [
2297
+ h('div', {
2298
+ ref: 'refTeleportWrapper'
2299
+ }, [
2300
+ /**
2301
+ * 行高线
2302
+ */
2303
+ h('div', {
2304
+ key: 'trl',
2305
+ ref: 'refRowResizeBar',
2306
+ class: 'vxe-table--resizable-row-bar'
2307
+ }, resizableOpts.showDragTip
2308
+ ? [
2309
+ h('div', {
2310
+ class: 'vxe-table--resizable-number-tip'
2311
+ })
2312
+ ]
2313
+ : []),
2314
+ /**
2315
+ * 自定义列
2316
+ */
2317
+ !showCustomSimpleOutside && initStore.custom
2318
+ ? h(TableCustomPanelComponent, {
2319
+ key: 'cs',
2320
+ ref: 'refTableCustom',
2321
+ props: {
2322
+ customStore
2323
+ }
2324
+ })
2325
+ : renderEmptyElement($xeTable),
2326
+ /**
2327
+ * 加载中
2328
+ */
2329
+ VxeUILoadingComponent
2330
+ ? h(VxeUILoadingComponent, {
2331
+ key: 'lg',
2332
+ class: 'vxe-table--loading',
2333
+ props: {
2334
+ value: currLoading,
2335
+ icon: loadingOpts.icon,
2336
+ text: loadingOpts.text
2337
+ },
2338
+ scopedSlots: loadingSlot
2339
+ ? {
2340
+ default: () => $xeTable.callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading }, h)
2341
+ }
2342
+ : {}
2343
+ })
2344
+ : loadingSlot
2345
+ ? h('div', {
2346
+ class: ['vxe-loading--custom-wrapper', {
2347
+ 'is--visible': currLoading
2348
+ }]
2349
+ }, $xeTable.callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading }, h))
2350
+ : renderEmptyElement($xeTable),
2351
+ /**
2352
+ * 拖拽提示
2353
+ */
2354
+ renderDragTip(h, this)
2355
+ ])
2356
+ ]),
2357
+ h('div', {
2358
+ key: 'tpw'
2359
+ }, [
2360
+ h('div', {
2361
+ ref: 'refPopupWrapperElem'
2362
+ }, [
2363
+ /**
2364
+ * 自定义列
2365
+ */
2366
+ showCustomSimpleOutside && initStore.custom
2367
+ ? h(TableCustomPanelComponent, {
2368
+ key: 'cs',
2369
+ ref: 'refTableCustom',
2370
+ props: {
2371
+ customStore
2372
+ }
2373
+ })
2374
+ : renderEmptyElement($xeTable),
2375
+ /**
2376
+ * 筛选
2377
+ */
2378
+ initStore.filter
2379
+ ? h(TableFilterPanelComponent, {
2380
+ key: 'tf',
2381
+ ref: 'refTableFilter',
2382
+ props: {
2383
+ filterStore
2384
+ }
2385
+ })
2386
+ : renderEmptyElement($xeTable),
2387
+ /**
2388
+ * 快捷菜单
2389
+ */
2390
+ isContentMenu
2391
+ ? h(TableMenuPanelComponent, {
2392
+ key: 'tm',
2393
+ ref: 'refTableMenu'
2394
+ })
2395
+ : renderEmptyElement($xeTable)
2396
+ ])
2397
+ ]),
2398
+ /**
2399
+ * 导入
2400
+ */
2401
+ initStore.import && this.importConfig
2402
+ ? h(TableImportPanelComponent, {
2403
+ key: 'it',
2404
+ props: {
2405
+ defaultOptions: this.importParams,
2406
+ storeData: this.importStore
2407
+ }
2408
+ })
2409
+ : renderEmptyElement($xeTable),
2410
+ /**
2411
+ * 导出
2412
+ */
2413
+ initStore.export && (this.exportConfig || this.printConfig)
2414
+ ? h(TableExportPanelComponent, {
2415
+ key: 'et',
2416
+ props: {
2417
+ defaultOptions: this.exportParams,
2418
+ storeData: this.exportStore
2419
+ }
2420
+ })
2421
+ : renderEmptyElement($xeTable),
2422
+ h('div', {}, [
2423
+ /**
2424
+ * 提示相关
2425
+ */
2426
+ VxeUITooltipComponent
2427
+ ? h(VxeUITooltipComponent, {
2428
+ key: 'ctp',
2429
+ ref: 'refCommTooltip',
2430
+ props: {
2431
+ isArrow: false,
2432
+ enterable: false
2433
+ }
2434
+ })
2435
+ : renderEmptyElement($xeTable),
2436
+ /**
2437
+ * 工具提示
2438
+ */
2439
+ VxeUITooltipComponent
2440
+ ? h(VxeUITooltipComponent, {
2441
+ key: 'btp',
2442
+ ref: 'refTooltip',
2443
+ props: {
2444
+ theme: tableTipConfig.theme,
2445
+ enterable: tableTipConfig.enterable,
2446
+ enterDelay: tableTipConfig.enterDelay,
2447
+ leaveDelay: tableTipConfig.leaveDelay,
2448
+ useHTML: tableTipConfig.useHTML,
2449
+ width: tableTipConfig.width,
2450
+ height: tableTipConfig.height,
2451
+ minWidth: tableTipConfig.minWidth,
2452
+ minHeight: tableTipConfig.minHeight,
2453
+ maxWidth: tableTipConfig.maxWidth,
2454
+ maxHeight: tableTipConfig.maxHeight
2455
+ },
2456
+ scopedSlots: currTooltipSlot
2457
+ ? {
2458
+ content: () => {
2459
+ const { type, row, column, content: tooltipContent } = tooltipStore
2460
+ if (currTooltipSlot) {
2461
+ if (column && type === 'header') {
2462
+ return h('div', {
2463
+ key: type
2464
+ }, currTooltipSlot({ column, tooltipContent, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }))
2465
+ }
2466
+ if (row && column && type === 'body') {
2467
+ return h('div', {
2468
+ key: type
2469
+ }, currTooltipSlot({ row, column, tooltipContent, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }))
2470
+ }
2471
+ if (row && column && type === 'footer') {
2472
+ return h('div', {
2473
+ key: type
2474
+ }, currTooltipSlot({ row, column, tooltipContent, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }))
2475
+ }
2476
+ }
2477
+ return renderEmptyElement($xeTable)
2478
+ }
2479
+ }
2480
+ : {}
2481
+ })
2482
+ : renderEmptyElement($xeTable),
2483
+ /**
2484
+ * 校验提示
2485
+ */
2486
+ VxeUITooltipComponent && this.editRules && validOpts.showErrorMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip')
2487
+ ? h(VxeUITooltipComponent, {
2488
+ key: 'vtp',
2489
+ ref: 'refValidTooltip',
2490
+ class: [{
2491
+ 'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete'
2492
+ }, 'vxe-table--valid-error'],
2493
+ props: {
2494
+ theme: validTipConfig.theme,
2495
+ enterable: validTipConfig.enterable,
2496
+ enterDelay: validTipConfig.enterDelay,
2497
+ leaveDelay: validTipConfig.leaveDelay
2498
+ }
2499
+ })
2500
+ : renderEmptyElement($xeTable)
2501
+ ])
2502
+ ])
2503
+ },
2504
+ methods
2505
+ } as any