vxe-table 3.20.4 → 3.20.6

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