vxe-table 3.20.7 → 3.20.8

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