vxe-table 3.15.5 → 3.15.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/locale/lang/ar-EG.js +3 -2
- package/es/locale/lang/de-DE.js +3 -2
- package/es/locale/lang/en-US.js +2 -1
- package/es/locale/lang/es-ES.js +3 -2
- package/es/locale/lang/fr-FR.js +2 -1
- package/es/locale/lang/hu-HU.js +2 -1
- package/es/locale/lang/hy-AM.js +2 -1
- package/es/locale/lang/id-ID.js +2 -1
- package/es/locale/lang/it-IT.js +2 -1
- package/es/locale/lang/ja-JP.js +2 -1
- package/es/locale/lang/ko-KR.js +2 -1
- package/es/locale/lang/nb-NO.js +2 -1
- package/es/locale/lang/pt-BR.js +2 -1
- package/es/locale/lang/ru-RU.js +2 -1
- package/es/locale/lang/th-TH.js +2 -1
- package/es/locale/lang/ug-CN.js +2 -1
- package/es/locale/lang/uk-UA.js +2 -1
- package/es/locale/lang/vi-VN.js +2 -1
- package/es/locale/lang/zh-CHT.js +2 -1
- package/es/locale/lang/zh-CN.js +2 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/mixin.js +62 -37
- package/es/table/module/custom/panel.js +7 -7
- package/es/table/module/export/mixin.js +13 -12
- package/es/table/module/keyboard/mixin.js +3 -2
- package/es/table/src/body.js +49 -16
- package/es/table/src/cell.js +137 -45
- package/es/table/src/column.js +2 -0
- package/es/table/src/columnInfo.js +1 -0
- package/es/table/src/methods.js +983 -495
- package/es/table/src/props.js +9 -7
- package/es/table/src/table.js +108 -35
- package/es/table/style.css +70 -40
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +13 -1
- package/es/ui/src/dom.js +3 -0
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +70 -40
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +1735 -858
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +3 -2
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +3 -2
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +2 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +2 -1
- package/lib/locale/lang/es-ES.js +3 -2
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +3 -2
- package/lib/locale/lang/fr-FR.js +2 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +2 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +2 -1
- package/lib/locale/lang/hy-AM.js +2 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/id-ID.js +2 -1
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/it-IT.js +2 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +2 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -1
- package/lib/locale/lang/ko-KR.js +2 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +2 -1
- package/lib/locale/lang/nb-NO.js +2 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +2 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +2 -1
- package/lib/locale/lang/ru-RU.js +2 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +2 -1
- package/lib/locale/lang/th-TH.js +2 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +2 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +2 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +2 -1
- package/lib/locale/lang/vi-VN.js +2 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +2 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +2 -1
- package/lib/locale/lang/zh-CN.js +2 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/mixin.js +74 -48
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/custom/panel.js +6 -2
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/export/mixin.js +13 -5
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +2 -1
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/src/body.js +39 -15
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +157 -36
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +2 -0
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +1 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +1164 -562
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +9 -7
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +104 -34
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +70 -40
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +13 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +4 -0
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +70 -40
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/locale/lang/ar-EG.ts +3 -2
- package/packages/locale/lang/de-DE.ts +3 -2
- package/packages/locale/lang/en-US.ts +2 -1
- package/packages/locale/lang/es-ES.ts +3 -2
- package/packages/locale/lang/fr-FR.ts +2 -1
- package/packages/locale/lang/hu-HU.ts +2 -1
- package/packages/locale/lang/hy-AM.ts +2 -1
- package/packages/locale/lang/id-ID.ts +2 -1
- package/packages/locale/lang/it-IT.ts +2 -1
- package/packages/locale/lang/ja-JP.ts +2 -1
- package/packages/locale/lang/ko-KR.ts +2 -1
- package/packages/locale/lang/nb-NO.ts +2 -1
- package/packages/locale/lang/pt-BR.ts +2 -1
- package/packages/locale/lang/ru-RU.ts +2 -1
- package/packages/locale/lang/th-TH.ts +2 -1
- package/packages/locale/lang/ug-CN.ts +2 -1
- package/packages/locale/lang/uk-UA.ts +2 -1
- package/packages/locale/lang/vi-VN.ts +2 -1
- package/packages/locale/lang/zh-CHT.ts +2 -1
- package/packages/locale/lang/zh-CN.ts +2 -1
- package/packages/table/module/custom/mixin.ts +85 -51
- package/packages/table/module/custom/panel.ts +8 -8
- package/packages/table/module/export/mixin.ts +19 -18
- package/packages/table/module/keyboard/mixin.ts +3 -2
- package/packages/table/src/body.ts +50 -17
- package/packages/table/src/cell.ts +136 -45
- package/packages/table/src/column.ts +2 -0
- package/packages/table/src/columnInfo.ts +1 -0
- package/packages/table/src/methods.ts +1016 -512
- package/packages/table/src/props.ts +9 -7
- package/packages/table/src/table.ts +122 -38
- package/packages/ui/index.ts +12 -0
- package/packages/ui/src/dom.ts +4 -0
- package/styles/components/table.scss +131 -92
- /package/es/{iconfont.1744880837792.ttf → iconfont.1745290222894.ttf} +0 -0
- /package/es/{iconfont.1744880837792.woff → iconfont.1745290222894.woff} +0 -0
- /package/es/{iconfont.1744880837792.woff2 → iconfont.1745290222894.woff2} +0 -0
- /package/lib/{iconfont.1744880837792.ttf → iconfont.1745290222894.ttf} +0 -0
- /package/lib/{iconfont.1744880837792.woff → iconfont.1745290222894.woff} +0 -0
- /package/lib/{iconfont.1744880837792.woff2 → iconfont.1745290222894.woff2} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils'
|
|
2
|
-
import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft, toCssUnit } from '../../ui/src/dom'
|
|
2
|
+
import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft, toCssUnit, hasControlKey } from '../../ui/src/dom'
|
|
3
3
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
|
|
4
4
|
import { VxeUI } from '../../ui'
|
|
5
5
|
import Cell from './cell'
|
|
@@ -188,7 +188,7 @@ function restoreCustomStorage ($xeTable: VxeTableConstructor & VxeTablePrivateMe
|
|
|
188
188
|
const storeData: VxeTableDefines.CustomStoreData = getCustomStorageMap(tableId)
|
|
189
189
|
if (restoreStore) {
|
|
190
190
|
return Promise.resolve(
|
|
191
|
-
restoreStore({ id: tableId, type: 'restore', storeData })
|
|
191
|
+
restoreStore({ $table: $xeTable, id: tableId, type: 'restore', storeData })
|
|
192
192
|
).then(storeData => {
|
|
193
193
|
if (!storeData) {
|
|
194
194
|
return
|
|
@@ -223,6 +223,7 @@ function cacheColumnMap ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
223
223
|
const rowOpts = $xeTable.computeRowOpts
|
|
224
224
|
const isGroup = collectColumn.some(hasChildrenList)
|
|
225
225
|
let isAllOverflow = !!props.showOverflow
|
|
226
|
+
let rowGroupColumn: VxeTableDefines.ColumnInfo | undefined
|
|
226
227
|
let expandColumn: VxeTableDefines.ColumnInfo | undefined
|
|
227
228
|
let treeNodeColumn: VxeTableDefines.ColumnInfo | undefined
|
|
228
229
|
let checkboxColumn: VxeTableDefines.ColumnInfo | undefined
|
|
@@ -230,7 +231,7 @@ function cacheColumnMap ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
230
231
|
let htmlColumn: VxeTableDefines.ColumnInfo | undefined
|
|
231
232
|
let hasFixed: VxeColumnPropTypes.Fixed | undefined
|
|
232
233
|
const handleFunc = (column: VxeTableDefines.ColumnInfo, index: number, items: VxeTableDefines.ColumnInfo[], path?: string[], parentColumn?: VxeTableDefines.ColumnInfo) => {
|
|
233
|
-
const { id: colid, field, fixed, type, treeNode } = column
|
|
234
|
+
const { id: colid, field, fixed, type, treeNode, rowGroupNode } = column
|
|
234
235
|
const rest = { $index: -1, _index: -1, column, colid, index, items, parent: parentColumn || null, width: 0, oLeft: 0 }
|
|
235
236
|
if (field) {
|
|
236
237
|
if (fullColumnFieldData[field]) {
|
|
@@ -255,7 +256,16 @@ function cacheColumnMap ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
255
256
|
if (!treeNodeColumn) {
|
|
256
257
|
treeNodeColumn = column
|
|
257
258
|
}
|
|
258
|
-
}
|
|
259
|
+
}
|
|
260
|
+
if (rowGroupNode) {
|
|
261
|
+
if (treeNodeColumn) {
|
|
262
|
+
warnLog('vxe.error.colRepet', ['row-group-node', rowGroupNode])
|
|
263
|
+
}
|
|
264
|
+
if (!rowGroupColumn) {
|
|
265
|
+
rowGroupColumn = column
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (type === 'expand') {
|
|
259
269
|
if (expandColumn) {
|
|
260
270
|
warnLog('vxe.error.colRepet', ['type', type])
|
|
261
271
|
}
|
|
@@ -310,6 +320,7 @@ function cacheColumnMap ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
310
320
|
}
|
|
311
321
|
|
|
312
322
|
reactData.isGroup = isGroup
|
|
323
|
+
reactData.rowGroupColumn = rowGroupColumn
|
|
313
324
|
reactData.treeNodeColumn = treeNodeColumn
|
|
314
325
|
reactData.expandColumn = expandColumn
|
|
315
326
|
reactData.isAllOverflow = isAllOverflow
|
|
@@ -342,7 +353,7 @@ function handleBaseTreeExpand ($xeTable: VxeTableConstructor & VxeTablePrivateMe
|
|
|
342
353
|
const internalData = $xeTable as unknown as TableInternalData
|
|
343
354
|
|
|
344
355
|
const { treeNodeColumn } = reactData
|
|
345
|
-
const { fullAllDataRowIdData,
|
|
356
|
+
const { fullAllDataRowIdData, tableFullTreeData, treeExpandedMaps, treeExpandLazyLoadedMaps } = internalData
|
|
346
357
|
const treeOpts = $xeTable.computeTreeOpts
|
|
347
358
|
const { reserve, lazy, accordion, toggleMethod } = treeOpts
|
|
348
359
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -355,7 +366,7 @@ function handleBaseTreeExpand ($xeTable: VxeTableConstructor & VxeTablePrivateMe
|
|
|
355
366
|
if (accordion) {
|
|
356
367
|
validRows = validRows.length ? [validRows[validRows.length - 1]] : []
|
|
357
368
|
// 同一级只能展开一个
|
|
358
|
-
const matchObj = XEUtils.findTree(
|
|
369
|
+
const matchObj = XEUtils.findTree(tableFullTreeData, item => item === validRows[0], { children: childrenField })
|
|
359
370
|
if (matchObj) {
|
|
360
371
|
matchObj.items.forEach(item => {
|
|
361
372
|
const rowid = handleGetRowId(item)
|
|
@@ -407,9 +418,90 @@ function handleBaseTreeExpand ($xeTable: VxeTableConstructor & VxeTablePrivateMe
|
|
|
407
418
|
* @returns
|
|
408
419
|
*/
|
|
409
420
|
function handleVirtualTreeExpand ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, rows: any[], expanded: boolean) {
|
|
421
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
422
|
+
|
|
410
423
|
return handleBaseTreeExpand($xeTable, rows, expanded).then(() => {
|
|
411
424
|
handleVirtualTreeToList($xeTable)
|
|
412
425
|
$xeTable.handleTableData()
|
|
426
|
+
reactData.treeExpandedFlag++
|
|
427
|
+
updateAfterDataIndex($xeTable)
|
|
428
|
+
return $xeTable.$nextTick()
|
|
429
|
+
}).then(() => {
|
|
430
|
+
return $xeTable.recalculate(true)
|
|
431
|
+
}).then(() => {
|
|
432
|
+
setTimeout(() => {
|
|
433
|
+
$xeTable.updateCellAreas()
|
|
434
|
+
}, 30)
|
|
435
|
+
})
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* 展开与收起行分组节点
|
|
440
|
+
* @param rows
|
|
441
|
+
* @param expanded
|
|
442
|
+
* @returns
|
|
443
|
+
*/
|
|
444
|
+
function handleRowGroupBaseExpand ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, rows: any[], expanded: boolean) {
|
|
445
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
446
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
447
|
+
|
|
448
|
+
const { fullAllDataRowIdData, tableFullGroupData, rowGroupExpandedMaps } = internalData
|
|
449
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
450
|
+
const { mapChildrenField, accordion } = rowGroupOpts
|
|
451
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
452
|
+
let validRows = rows
|
|
453
|
+
if (mapChildrenField) {
|
|
454
|
+
if (accordion) {
|
|
455
|
+
validRows = validRows.length ? [validRows[validRows.length - 1]] : []
|
|
456
|
+
// 同一级只能展开一个
|
|
457
|
+
const matchObj = XEUtils.findTree(tableFullGroupData, item => getRowid($xeTable, item) === getRowid($xeTable, validRows[0]), { children: mapChildrenField })
|
|
458
|
+
if (matchObj) {
|
|
459
|
+
matchObj.items.forEach(item => {
|
|
460
|
+
const rowid = handleGetRowId(item)
|
|
461
|
+
if (rowGroupExpandedMaps[rowid]) {
|
|
462
|
+
delete rowGroupExpandedMaps[rowid]
|
|
463
|
+
}
|
|
464
|
+
})
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if (expanded) {
|
|
468
|
+
validRows.forEach((row) => {
|
|
469
|
+
const rowid = handleGetRowId(row)
|
|
470
|
+
if (!rowGroupExpandedMaps[rowid]) {
|
|
471
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
472
|
+
if (rowRest) {
|
|
473
|
+
if (row[mapChildrenField] && row[mapChildrenField].length) {
|
|
474
|
+
rowGroupExpandedMaps[rowid] = row
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
})
|
|
479
|
+
} else {
|
|
480
|
+
validRows.forEach(item => {
|
|
481
|
+
const rowid = handleGetRowId(item)
|
|
482
|
+
if (rowGroupExpandedMaps[rowid]) {
|
|
483
|
+
delete rowGroupExpandedMaps[rowid]
|
|
484
|
+
}
|
|
485
|
+
})
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
reactData.rowGroupExpandedFlag++
|
|
489
|
+
return $xeTable.recalculate()
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* 行分组的展开与收起
|
|
494
|
+
* @param rows
|
|
495
|
+
* @param expanded
|
|
496
|
+
* @returns
|
|
497
|
+
*/
|
|
498
|
+
function handleRowGroupVirtualExpand ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, rows: any[], expanded: boolean) {
|
|
499
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
500
|
+
|
|
501
|
+
return handleRowGroupBaseExpand($xeTable, rows, expanded).then(() => {
|
|
502
|
+
handleVirtualTreeToList($xeTable)
|
|
503
|
+
$xeTable.handleTableData()
|
|
504
|
+
reactData.rowGroupExpandedFlag++
|
|
413
505
|
updateAfterDataIndex($xeTable)
|
|
414
506
|
return $xeTable.$nextTick()
|
|
415
507
|
}).then(() => {
|
|
@@ -486,23 +578,26 @@ function updateAfterDataIndex ($xeTable: VxeTableConstructor & VxeTablePrivateMe
|
|
|
486
578
|
}
|
|
487
579
|
|
|
488
580
|
/**
|
|
489
|
-
*
|
|
581
|
+
* 如果为虚拟树、行分组、则将树结构拍平
|
|
490
582
|
* @returns
|
|
491
583
|
*/
|
|
492
584
|
function handleVirtualTreeToList ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
493
585
|
const props = $xeTable
|
|
586
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
494
587
|
const internalData = $xeTable as unknown as TableInternalData
|
|
495
588
|
|
|
496
589
|
const { treeConfig } = props
|
|
497
|
-
const {
|
|
590
|
+
const { isRowGroupStatus } = reactData
|
|
591
|
+
const { fullAllDataRowIdData, treeExpandedMaps, rowGroupExpandedMaps } = internalData
|
|
592
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
498
593
|
const treeOpts = $xeTable.computeTreeOpts
|
|
499
|
-
const
|
|
594
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
595
|
+
const fullData: any[] = []
|
|
596
|
+
const expandMaps: {
|
|
597
|
+
[key: string]: number
|
|
598
|
+
} = {}
|
|
500
599
|
if (treeConfig && treeOpts.transform) {
|
|
501
|
-
const
|
|
502
|
-
const fullData: any[] = []
|
|
503
|
-
const expandMaps: {
|
|
504
|
-
[key: string]: number
|
|
505
|
-
} = {}
|
|
600
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
506
601
|
XEUtils.eachTree(internalData.afterTreeFullData, (row, index, items, path, parentRow) => {
|
|
507
602
|
const rowid = handleGetRowId(row)
|
|
508
603
|
const parentRowid = handleGetRowId(parentRow)
|
|
@@ -518,10 +613,248 @@ function handleVirtualTreeToList ($xeTable: VxeTableConstructor & VxeTablePrivat
|
|
|
518
613
|
internalData.afterFullData = fullData
|
|
519
614
|
updateScrollYStatus($xeTable, fullData)
|
|
520
615
|
return fullData
|
|
616
|
+
} else if (isRowGroupStatus) {
|
|
617
|
+
const { childrenField } = rowGroupOpts
|
|
618
|
+
XEUtils.eachTree(internalData.afterGroupFullData, (row, index, items, path, parentRow) => {
|
|
619
|
+
const rowid = handleGetRowId(row)
|
|
620
|
+
const parentRowid = handleGetRowId(parentRow)
|
|
621
|
+
if (!parentRow || (expandMaps[parentRowid] && rowGroupExpandedMaps[parentRowid])) {
|
|
622
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
623
|
+
if (rowRest) {
|
|
624
|
+
rowRest._index = fullData.length
|
|
625
|
+
}
|
|
626
|
+
expandMaps[rowid] = 1
|
|
627
|
+
fullData.push(row)
|
|
628
|
+
}
|
|
629
|
+
}, { children: childrenField })
|
|
630
|
+
internalData.afterFullData = fullData
|
|
631
|
+
updateScrollYStatus($xeTable, fullData)
|
|
632
|
+
return fullData
|
|
521
633
|
}
|
|
522
634
|
return internalData.afterFullData
|
|
523
635
|
}
|
|
524
636
|
|
|
637
|
+
/**
|
|
638
|
+
* 编译处理后全量的表格数据
|
|
639
|
+
* 如果存在筛选条件,继续处理
|
|
640
|
+
*/
|
|
641
|
+
function updateAfterFullData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
642
|
+
const props = $xeTable
|
|
643
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
644
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
645
|
+
|
|
646
|
+
const { treeConfig } = props
|
|
647
|
+
const { isRowGroupStatus } = reactData
|
|
648
|
+
const { tableFullColumn, tableFullData, tableFullTreeData, tableFullGroupData } = internalData
|
|
649
|
+
const filterOpts = $xeTable.computeFilterOpts
|
|
650
|
+
const sortOpts = $xeTable.computeSortOpts
|
|
651
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
652
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
653
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
654
|
+
const { transform, rowField, parentField, mapChildrenField } = treeOpts
|
|
655
|
+
const { isEvery, remote: allRemoteFilter, filterMethod: allFilterMethod } = filterOpts
|
|
656
|
+
const { remote: allRemoteSort, sortMethod: allSortMethod, multiple: sortMultiple, chronological } = sortOpts
|
|
657
|
+
let tableData: any[] = []
|
|
658
|
+
let tableTree: any[] = []
|
|
659
|
+
|
|
660
|
+
// 处理数据
|
|
661
|
+
if (!allRemoteFilter || !allRemoteSort) {
|
|
662
|
+
const filterColumns: {
|
|
663
|
+
column: VxeTableDefines.ColumnInfo
|
|
664
|
+
valueList: any[]
|
|
665
|
+
itemList: VxeTableDefines.FilterOption[]
|
|
666
|
+
}[] = []
|
|
667
|
+
let orderColumns: VxeTableDefines.SortCheckedParams[] = []
|
|
668
|
+
tableFullColumn.forEach((column) => {
|
|
669
|
+
const { field, sortable, order, filters } = column
|
|
670
|
+
if (!allRemoteFilter && filters && filters.length) {
|
|
671
|
+
const valueList: any[] = []
|
|
672
|
+
const itemList: VxeTableDefines.FilterOption[] = []
|
|
673
|
+
filters.forEach((item) => {
|
|
674
|
+
if (item.checked) {
|
|
675
|
+
itemList.push(item as VxeTableDefines.FilterOption)
|
|
676
|
+
valueList.push(item.value)
|
|
677
|
+
}
|
|
678
|
+
})
|
|
679
|
+
if (itemList.length) {
|
|
680
|
+
filterColumns.push({ column, valueList, itemList })
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
if (!allRemoteSort && sortable && order) {
|
|
684
|
+
orderColumns.push({ column, field, property: field, order: order, sortTime: column.sortTime })
|
|
685
|
+
}
|
|
686
|
+
})
|
|
687
|
+
if (sortMultiple && chronological && orderColumns.length > 1) {
|
|
688
|
+
orderColumns = XEUtils.orderBy(orderColumns, 'sortTime')
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// 处理筛选
|
|
692
|
+
// 支持单列、多列、组合筛选
|
|
693
|
+
if (!allRemoteFilter && filterColumns.length) {
|
|
694
|
+
const handleFilter = (row: any) => {
|
|
695
|
+
return filterColumns.every(({ column, valueList, itemList }) => {
|
|
696
|
+
const { filterMethod, filterRender } = column
|
|
697
|
+
const compConf = isEnableConf(filterRender) ? renderer.get(filterRender.name) : null
|
|
698
|
+
const compFilterMethod = compConf ? (compConf.tableFilterMethod || compConf.filterMethod) : null
|
|
699
|
+
const tdFilterMethod = compConf ? (compConf.tableFilterDefaultMethod || compConf.defaultTableFilterMethod || compConf.defaultFilterMethod) : null
|
|
700
|
+
const cellValue = getCellValue(row, column)
|
|
701
|
+
if (filterMethod) {
|
|
702
|
+
return itemList.some((item) => filterMethod({ value: item.value, option: item, cellValue, row, column, $table: $xeTable }))
|
|
703
|
+
} else if (compFilterMethod) {
|
|
704
|
+
return itemList.some((item) => compFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: $xeTable }))
|
|
705
|
+
} else if (allFilterMethod) {
|
|
706
|
+
return allFilterMethod({ $table: $xeTable, options: itemList, values: valueList, cellValue, row, column })
|
|
707
|
+
} else if (tdFilterMethod) {
|
|
708
|
+
return itemList.some((item) => tdFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: $xeTable }))
|
|
709
|
+
}
|
|
710
|
+
return valueList.indexOf(XEUtils.get(row, column.field)) > -1
|
|
711
|
+
})
|
|
712
|
+
}
|
|
713
|
+
if (isRowGroupStatus) {
|
|
714
|
+
// 行分组
|
|
715
|
+
tableTree = XEUtils.searchTree(tableFullGroupData, handleFilter, {
|
|
716
|
+
original: true,
|
|
717
|
+
isEvery: true,
|
|
718
|
+
children: rowGroupOpts.mapChildrenField,
|
|
719
|
+
mapChildren: rowGroupOpts.childrenField
|
|
720
|
+
})
|
|
721
|
+
tableData = tableTree
|
|
722
|
+
} else if (treeConfig && transform) {
|
|
723
|
+
// 筛选虚拟树
|
|
724
|
+
tableTree = XEUtils.searchTree(tableFullTreeData, handleFilter, {
|
|
725
|
+
original: true,
|
|
726
|
+
isEvery,
|
|
727
|
+
children: mapChildrenField,
|
|
728
|
+
mapChildren: childrenField
|
|
729
|
+
})
|
|
730
|
+
tableData = tableTree
|
|
731
|
+
} else {
|
|
732
|
+
tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter)
|
|
733
|
+
tableTree = tableData
|
|
734
|
+
}
|
|
735
|
+
} else {
|
|
736
|
+
if (isRowGroupStatus) {
|
|
737
|
+
// 还原行分组
|
|
738
|
+
tableTree = XEUtils.searchTree(tableFullGroupData, () => true, {
|
|
739
|
+
original: true,
|
|
740
|
+
isEvery: true,
|
|
741
|
+
children: rowGroupOpts.mapChildrenField,
|
|
742
|
+
mapChildren: rowGroupOpts.childrenField
|
|
743
|
+
})
|
|
744
|
+
tableData = tableTree
|
|
745
|
+
} else if (treeConfig && transform) {
|
|
746
|
+
// 还原虚拟树
|
|
747
|
+
tableTree = XEUtils.searchTree(tableFullTreeData, () => true, {
|
|
748
|
+
original: true,
|
|
749
|
+
isEvery,
|
|
750
|
+
children: mapChildrenField,
|
|
751
|
+
mapChildren: childrenField
|
|
752
|
+
})
|
|
753
|
+
tableData = tableTree
|
|
754
|
+
} else {
|
|
755
|
+
tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0)
|
|
756
|
+
tableTree = tableData
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
// 处理排序
|
|
761
|
+
// 支持单列、多列、组合排序
|
|
762
|
+
if (!allRemoteSort && orderColumns.length) {
|
|
763
|
+
if (isRowGroupStatus) {
|
|
764
|
+
// 行分组的排序
|
|
765
|
+
if (allSortMethod) {
|
|
766
|
+
const sortRests = allSortMethod({ data: tableTree, sortList: orderColumns, $table: $xeTable })
|
|
767
|
+
tableTree = XEUtils.isArray(sortRests) ? sortRests : tableTree
|
|
768
|
+
} else {
|
|
769
|
+
const treeList = XEUtils.toTreeArray(tableTree, {
|
|
770
|
+
key: rowGroupOpts.rowField,
|
|
771
|
+
parentKey: rowGroupOpts.parentField,
|
|
772
|
+
children: rowGroupOpts.mapChildrenField
|
|
773
|
+
})
|
|
774
|
+
tableTree = XEUtils.toArrayTree(
|
|
775
|
+
XEUtils.orderBy(treeList, orderColumns.map(({ column, order }) => [getOrderField($xeTable, column), order])),
|
|
776
|
+
{
|
|
777
|
+
key: rowGroupOpts.rowField,
|
|
778
|
+
parentKey: rowGroupOpts.parentField,
|
|
779
|
+
children: rowGroupOpts.childrenField,
|
|
780
|
+
mapChildren: rowGroupOpts.mapChildrenField
|
|
781
|
+
}
|
|
782
|
+
)
|
|
783
|
+
}
|
|
784
|
+
tableData = tableTree
|
|
785
|
+
} else if (treeConfig && transform) {
|
|
786
|
+
// 虚拟树的排序
|
|
787
|
+
if (allSortMethod) {
|
|
788
|
+
const sortRests = allSortMethod({ data: tableTree, sortList: orderColumns, $table: $xeTable })
|
|
789
|
+
tableTree = XEUtils.isArray(sortRests) ? sortRests : tableTree
|
|
790
|
+
} else {
|
|
791
|
+
const treeList = XEUtils.toTreeArray(tableTree, {
|
|
792
|
+
children: mapChildrenField
|
|
793
|
+
})
|
|
794
|
+
tableTree = XEUtils.toArrayTree(
|
|
795
|
+
XEUtils.orderBy(treeList, orderColumns.map(({ column, order }) => [getOrderField($xeTable, column), order])),
|
|
796
|
+
{
|
|
797
|
+
key: rowField,
|
|
798
|
+
parentKey: parentField,
|
|
799
|
+
children: childrenField,
|
|
800
|
+
mapChildren: mapChildrenField
|
|
801
|
+
}
|
|
802
|
+
)
|
|
803
|
+
}
|
|
804
|
+
tableData = tableTree
|
|
805
|
+
} else {
|
|
806
|
+
if (allSortMethod) {
|
|
807
|
+
const sortRests = allSortMethod({ data: tableData, sortList: orderColumns, $table: $xeTable })
|
|
808
|
+
tableData = XEUtils.isArray(sortRests) ? sortRests : tableData
|
|
809
|
+
} else {
|
|
810
|
+
// 兼容 v4
|
|
811
|
+
if (sortMultiple) {
|
|
812
|
+
tableData = XEUtils.orderBy(tableData, orderColumns.map(({ column, order }) => [getOrderField($xeTable, column), order]))
|
|
813
|
+
} else {
|
|
814
|
+
const firstOrderColumn = orderColumns[0]
|
|
815
|
+
let sortByConfs
|
|
816
|
+
// 已废弃,兼容 v2,在 v4 中废弃, sortBy 不能为数组
|
|
817
|
+
if (XEUtils.isArray((firstOrderColumn as any).sortBy)) {
|
|
818
|
+
sortByConfs = (firstOrderColumn as any).sortBy.map((item: any) => [item, firstOrderColumn.order])
|
|
819
|
+
}
|
|
820
|
+
tableData = XEUtils.orderBy(tableData, sortByConfs || [firstOrderColumn].map(({ column, order }) => [getOrderField($xeTable, column), order]))
|
|
821
|
+
}
|
|
822
|
+
tableData = XEUtils.orderBy(tableData, orderColumns.map(({ column, order }) => [getOrderField($xeTable, column), order]))
|
|
823
|
+
}
|
|
824
|
+
tableTree = tableData
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
} else {
|
|
828
|
+
if (isRowGroupStatus) {
|
|
829
|
+
// 还原行分组
|
|
830
|
+
// 还原虚拟树
|
|
831
|
+
tableTree = XEUtils.searchTree(tableFullGroupData, () => true, {
|
|
832
|
+
original: true,
|
|
833
|
+
isEvery: true,
|
|
834
|
+
children: rowGroupOpts.mapChildrenField,
|
|
835
|
+
mapChildren: rowGroupOpts.childrenField
|
|
836
|
+
})
|
|
837
|
+
tableData = tableTree
|
|
838
|
+
} else if (treeConfig && transform) {
|
|
839
|
+
// 还原虚拟树
|
|
840
|
+
tableTree = XEUtils.searchTree(tableFullTreeData, () => true, {
|
|
841
|
+
original: true,
|
|
842
|
+
isEvery,
|
|
843
|
+
children: mapChildrenField,
|
|
844
|
+
mapChildren: childrenField
|
|
845
|
+
})
|
|
846
|
+
tableData = tableTree
|
|
847
|
+
} else {
|
|
848
|
+
tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0)
|
|
849
|
+
tableTree = tableData
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
internalData.afterFullData = tableData
|
|
853
|
+
internalData.afterTreeFullData = tableTree
|
|
854
|
+
internalData.afterGroupFullData = tableTree
|
|
855
|
+
updateAfterDataIndex($xeTable)
|
|
856
|
+
}
|
|
857
|
+
|
|
525
858
|
function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
526
859
|
const props = $xeTable
|
|
527
860
|
const reactData = $xeTable as unknown as TableReactData
|
|
@@ -959,7 +1292,7 @@ function handleCheckedRadioRow ($xeTable: VxeTableConstructor & VxeTablePrivateM
|
|
|
959
1292
|
|
|
960
1293
|
const radioOpts = $xeTable.computeRadioOpts
|
|
961
1294
|
const { checkMethod } = radioOpts
|
|
962
|
-
if (row && (isForce || (!checkMethod || checkMethod({ row })))) {
|
|
1295
|
+
if (row && (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row })))) {
|
|
963
1296
|
reactData.selectRadioRow = row
|
|
964
1297
|
handleRadioReserveRow($xeTable, row)
|
|
965
1298
|
}
|
|
@@ -981,8 +1314,10 @@ function handleCheckedAllCheckboxRow ($xeTable: VxeTableConstructor & VxeTablePr
|
|
|
981
1314
|
const internalData = $xeTable as unknown as TableInternalData
|
|
982
1315
|
|
|
983
1316
|
const { treeConfig } = props
|
|
984
|
-
const {
|
|
1317
|
+
const { isRowGroupStatus } = reactData
|
|
1318
|
+
const { afterFullData, afterTreeFullData, afterGroupFullData, checkboxReserveRowMap, selectCheckboxMaps } = internalData
|
|
985
1319
|
const treeOpts = $xeTable.computeTreeOpts
|
|
1320
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
986
1321
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
987
1322
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
988
1323
|
const { checkField, reserve, checkMethod } = checkboxOpts
|
|
@@ -990,55 +1325,82 @@ function handleCheckedAllCheckboxRow ($xeTable: VxeTableConstructor & VxeTablePr
|
|
|
990
1325
|
// indeterminateField 仅支持读取
|
|
991
1326
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
|
|
992
1327
|
const selectRowMaps: Record<string, any> = {}
|
|
1328
|
+
|
|
993
1329
|
/**
|
|
994
|
-
*
|
|
1330
|
+
* 绑定属性方式(有污染)
|
|
995
1331
|
* 必须在行数据存在对应的属性,否则将不响应
|
|
996
1332
|
*/
|
|
997
1333
|
if (checkField) {
|
|
998
1334
|
const checkValFn = (row: any) => {
|
|
999
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
1335
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
1000
1336
|
if (checked) {
|
|
1001
1337
|
selectRowMaps[handleGetRowId(row)] = row
|
|
1002
1338
|
}
|
|
1003
1339
|
XEUtils.set(row, checkField, checked)
|
|
1004
1340
|
}
|
|
1005
|
-
if (treeConfig && indeterminateField) {
|
|
1341
|
+
if ((treeConfig || isRowGroupStatus) && indeterminateField) {
|
|
1006
1342
|
XEUtils.set(row, indeterminateField, false)
|
|
1007
1343
|
}
|
|
1008
1344
|
}
|
|
1009
1345
|
// 如果存在选中方法
|
|
1010
1346
|
// 如果方法成立,则更新值,否则忽略该数据
|
|
1011
|
-
if (treeConfig) {
|
|
1347
|
+
if ((treeConfig || isRowGroupStatus)) {
|
|
1012
1348
|
XEUtils.eachTree(afterFullData, checkValFn, { children: childrenField })
|
|
1013
1349
|
} else {
|
|
1014
1350
|
afterFullData.forEach(checkValFn)
|
|
1015
1351
|
}
|
|
1016
1352
|
} else {
|
|
1017
1353
|
/**
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
if (
|
|
1354
|
+
* 默认方式(无污染)
|
|
1355
|
+
* 无需任何属性,直接绑定
|
|
1356
|
+
*/
|
|
1357
|
+
if (isRowGroupStatus) {
|
|
1022
1358
|
if (checked) {
|
|
1023
1359
|
/**
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
XEUtils.eachTree(
|
|
1028
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
1360
|
+
* 如果是行分组勾选
|
|
1361
|
+
* 如果方法成立,则添加到临时集合中
|
|
1362
|
+
*/
|
|
1363
|
+
XEUtils.eachTree(afterGroupFullData, (row) => {
|
|
1364
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
1365
|
+
const rowid = handleGetRowId(row)
|
|
1366
|
+
selectRowMaps[rowid] = row
|
|
1367
|
+
}
|
|
1368
|
+
}, { children: rowGroupOpts.mapChildrenField })
|
|
1369
|
+
} else {
|
|
1370
|
+
/**
|
|
1371
|
+
* 如果是树取消
|
|
1372
|
+
* 如果方法成立,则不添加到临时集合中
|
|
1373
|
+
*/
|
|
1374
|
+
if (!isForce && checkMethod) {
|
|
1375
|
+
XEUtils.eachTree(afterGroupFullData, (row) => {
|
|
1376
|
+
const rowid = handleGetRowId(row)
|
|
1377
|
+
if (checkMethod({ $table: $xeTable, row }) ? false : selectCheckboxMaps[rowid]) {
|
|
1378
|
+
selectRowMaps[rowid] = row
|
|
1379
|
+
}
|
|
1380
|
+
}, { children: rowGroupOpts.mapChildrenField })
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
} else if (treeConfig) {
|
|
1384
|
+
if (checked) {
|
|
1385
|
+
/**
|
|
1386
|
+
* 如果是树勾选
|
|
1387
|
+
* 如果方法成立,则添加到临时集合中
|
|
1388
|
+
*/
|
|
1389
|
+
XEUtils.eachTree(afterTreeFullData, (row) => {
|
|
1390
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
1029
1391
|
const rowid = handleGetRowId(row)
|
|
1030
1392
|
selectRowMaps[rowid] = row
|
|
1031
1393
|
}
|
|
1032
1394
|
}, { children: childrenField })
|
|
1033
1395
|
} else {
|
|
1034
1396
|
/**
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1397
|
+
* 如果是树取消
|
|
1398
|
+
* 如果方法成立,则不添加到临时集合中
|
|
1399
|
+
*/
|
|
1038
1400
|
if (!isForce && checkMethod) {
|
|
1039
|
-
XEUtils.eachTree(
|
|
1401
|
+
XEUtils.eachTree(afterTreeFullData, (row) => {
|
|
1040
1402
|
const rowid = handleGetRowId(row)
|
|
1041
|
-
if (checkMethod({ row }) ?
|
|
1403
|
+
if (checkMethod({ $table: $xeTable, row }) ? false : selectCheckboxMaps[rowid]) {
|
|
1042
1404
|
selectRowMaps[rowid] = row
|
|
1043
1405
|
}
|
|
1044
1406
|
}, { children: childrenField })
|
|
@@ -1047,14 +1409,14 @@ function handleCheckedAllCheckboxRow ($xeTable: VxeTableConstructor & VxeTablePr
|
|
|
1047
1409
|
} else {
|
|
1048
1410
|
if (checked) {
|
|
1049
1411
|
/**
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1412
|
+
* 如果是行勾选
|
|
1413
|
+
* 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
|
|
1414
|
+
* 如果不存在选中方法,则添加所有数据到临时集合中
|
|
1415
|
+
*/
|
|
1054
1416
|
if (!isForce && checkMethod) {
|
|
1055
1417
|
afterFullData.forEach((row) => {
|
|
1056
1418
|
const rowid = handleGetRowId(row)
|
|
1057
|
-
if (selectCheckboxMaps[rowid] || checkMethod({ row })) {
|
|
1419
|
+
if (selectCheckboxMaps[rowid] || checkMethod({ $table: $xeTable, row })) {
|
|
1058
1420
|
selectRowMaps[rowid] = row
|
|
1059
1421
|
}
|
|
1060
1422
|
})
|
|
@@ -1066,14 +1428,14 @@ function handleCheckedAllCheckboxRow ($xeTable: VxeTableConstructor & VxeTablePr
|
|
|
1066
1428
|
}
|
|
1067
1429
|
} else {
|
|
1068
1430
|
/**
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1431
|
+
* 如果是行取消
|
|
1432
|
+
* 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
|
|
1433
|
+
* 如果不存在选中方法,无需处理,临时集合默认为空
|
|
1434
|
+
*/
|
|
1073
1435
|
if (!isForce && checkMethod) {
|
|
1074
1436
|
afterFullData.forEach((row) => {
|
|
1075
1437
|
const rowid = handleGetRowId(row)
|
|
1076
|
-
if (checkMethod({ row }) ?
|
|
1438
|
+
if (checkMethod({ $table: $xeTable, row }) ? false : selectCheckboxMaps[rowid]) {
|
|
1077
1439
|
selectRowMaps[rowid] = row
|
|
1078
1440
|
}
|
|
1079
1441
|
})
|
|
@@ -1794,8 +2156,8 @@ function handleTargetEnterEvent ($xeTable: VxeTableConstructor, isClear: boolean
|
|
|
1794
2156
|
}
|
|
1795
2157
|
}
|
|
1796
2158
|
|
|
1797
|
-
function clearDragStatus ($xeTable:
|
|
1798
|
-
const reactData = $xeTable
|
|
2159
|
+
function clearDragStatus ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
2160
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1799
2161
|
|
|
1800
2162
|
const { dragRow, dragCol } = reactData
|
|
1801
2163
|
if (dragRow || dragCol) {
|
|
@@ -1809,7 +2171,7 @@ function clearDragStatus ($xeTable: any) {
|
|
|
1809
2171
|
}
|
|
1810
2172
|
}
|
|
1811
2173
|
|
|
1812
|
-
function clearRowDropOrigin ($xeTable:
|
|
2174
|
+
function clearRowDropOrigin ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
1813
2175
|
const el = $xeTable.$el
|
|
1814
2176
|
if (el) {
|
|
1815
2177
|
const clss = 'row--drag-origin'
|
|
@@ -1820,7 +2182,7 @@ function clearRowDropOrigin ($xeTable: any) {
|
|
|
1820
2182
|
}
|
|
1821
2183
|
}
|
|
1822
2184
|
|
|
1823
|
-
function updateRowDropOrigin ($xeTable:
|
|
2185
|
+
function updateRowDropOrigin ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, row: any) {
|
|
1824
2186
|
const el = $xeTable.$el
|
|
1825
2187
|
if (el) {
|
|
1826
2188
|
const clss = 'row--drag-origin'
|
|
@@ -1831,8 +2193,8 @@ function updateRowDropOrigin ($xeTable: any, row: any) {
|
|
|
1831
2193
|
}
|
|
1832
2194
|
}
|
|
1833
2195
|
|
|
1834
|
-
function updateRowDropTipContent ($xeTable:
|
|
1835
|
-
const reactData = $xeTable
|
|
2196
|
+
function updateRowDropTipContent ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, tdEl: HTMLElement) {
|
|
2197
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1836
2198
|
const props = $xeTable
|
|
1837
2199
|
|
|
1838
2200
|
const { dragConfig } = props
|
|
@@ -1842,16 +2204,18 @@ function updateRowDropTipContent ($xeTable: any, tdEl: HTMLElement) {
|
|
|
1842
2204
|
const rTooltipMethod = tooltipMethod || (dragConfig ? dragConfig.rowTooltipMethod : null)
|
|
1843
2205
|
let tipContent = ''
|
|
1844
2206
|
if (rTooltipMethod) {
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
2207
|
+
const rtParams = {
|
|
2208
|
+
$table: $xeTable,
|
|
2209
|
+
row: dragRow
|
|
2210
|
+
}
|
|
2211
|
+
tipContent = `${rTooltipMethod(rtParams) || ''}`
|
|
1848
2212
|
} else {
|
|
1849
2213
|
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || ''])
|
|
1850
2214
|
}
|
|
1851
2215
|
reactData.dragTipText = tipContent
|
|
1852
2216
|
}
|
|
1853
2217
|
|
|
1854
|
-
function updateColDropOrigin ($xeTable:
|
|
2218
|
+
function updateColDropOrigin ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, column: VxeTableDefines.ColumnInfo) {
|
|
1855
2219
|
const el = $xeTable.$el as HTMLElement
|
|
1856
2220
|
if (el) {
|
|
1857
2221
|
const colQuerys: string[] = []
|
|
@@ -1865,7 +2229,7 @@ function updateColDropOrigin ($xeTable: any, column: VxeTableDefines.ColumnInfo)
|
|
|
1865
2229
|
}
|
|
1866
2230
|
}
|
|
1867
2231
|
|
|
1868
|
-
function clearColDropOrigin ($xeTable:
|
|
2232
|
+
function clearColDropOrigin ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
1869
2233
|
const el = $xeTable.$el as HTMLElement
|
|
1870
2234
|
if (el) {
|
|
1871
2235
|
const clss = 'col--drag-origin'
|
|
@@ -1876,17 +2240,19 @@ function clearColDropOrigin ($xeTable: any) {
|
|
|
1876
2240
|
}
|
|
1877
2241
|
}
|
|
1878
2242
|
|
|
1879
|
-
function updateColDropTipContent ($xeTable:
|
|
1880
|
-
const reactData = $xeTable
|
|
2243
|
+
function updateColDropTipContent ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, tdEl: HTMLElement) {
|
|
2244
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1881
2245
|
|
|
1882
2246
|
const { dragCol } = reactData
|
|
1883
2247
|
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
1884
2248
|
const { tooltipMethod } = columnDragOpts
|
|
1885
2249
|
let tipContent = ''
|
|
1886
2250
|
if (tooltipMethod) {
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
2251
|
+
const dtParams = {
|
|
2252
|
+
$table: $xeTable,
|
|
2253
|
+
column: dragCol as VxeTableDefines.ColumnInfo
|
|
2254
|
+
}
|
|
2255
|
+
tipContent = `${tooltipMethod(dtParams) || ''}`
|
|
1890
2256
|
} else {
|
|
1891
2257
|
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || ''])
|
|
1892
2258
|
}
|
|
@@ -2203,6 +2569,270 @@ function handleRecalculateLayout ($xeTable: VxeTableConstructor & VxeTablePrivat
|
|
|
2203
2569
|
})
|
|
2204
2570
|
}
|
|
2205
2571
|
|
|
2572
|
+
const handleUpdateRowGroup = ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, groupFields?: string[]) => {
|
|
2573
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
2574
|
+
|
|
2575
|
+
reactData.rowGroupList = groupFields
|
|
2576
|
+
? (XEUtils.isArray(groupFields) ? groupFields : [groupFields]).map(field => {
|
|
2577
|
+
return {
|
|
2578
|
+
field
|
|
2579
|
+
}
|
|
2580
|
+
})
|
|
2581
|
+
: []
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
function handleGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, list: any[], rowGroups: VxeTableDefines.RowGroupItem[]) {
|
|
2585
|
+
let fullData = list
|
|
2586
|
+
let treeData = list
|
|
2587
|
+
if (rowGroups) {
|
|
2588
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
2589
|
+
const { rowField, parentField, childrenField, mapChildrenField } = rowGroupOpts
|
|
2590
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
2591
|
+
const { checkField } = checkboxOpts
|
|
2592
|
+
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
|
|
2593
|
+
const rgItem = rowGroups[0]
|
|
2594
|
+
if (rgItem && rowField && parentField && childrenField && mapChildrenField) {
|
|
2595
|
+
fullData = []
|
|
2596
|
+
treeData = []
|
|
2597
|
+
const groupField = rgItem.field
|
|
2598
|
+
const groupColumn = $xeTable.getColumnByField(groupField)
|
|
2599
|
+
const groupMaps: Record<string, any[]> = {}
|
|
2600
|
+
const rowkey = getRowkey($xeTable)
|
|
2601
|
+
list.forEach((row) => {
|
|
2602
|
+
const cellValue = groupColumn ? $xeTable.getCellLabel(row, groupColumn) : XEUtils.get(row, groupField)
|
|
2603
|
+
const groupValue = XEUtils.eqNull(cellValue) ? '' : cellValue
|
|
2604
|
+
let childList = groupMaps[groupValue]
|
|
2605
|
+
if (!childList) {
|
|
2606
|
+
childList = []
|
|
2607
|
+
groupMaps[groupValue] = childList
|
|
2608
|
+
}
|
|
2609
|
+
if (row.isAggregate) {
|
|
2610
|
+
row.isAggregate = undefined
|
|
2611
|
+
}
|
|
2612
|
+
childList.push(row)
|
|
2613
|
+
})
|
|
2614
|
+
XEUtils.objectEach(groupMaps, (childList, groupValue) => {
|
|
2615
|
+
const { fullData: childFullData, treeData: childTreeData } = handleGroupData($xeTable, childList, rowGroups.slice(1))
|
|
2616
|
+
const groupRow = {
|
|
2617
|
+
isAggregate: true,
|
|
2618
|
+
groupContent: groupValue,
|
|
2619
|
+
groupField,
|
|
2620
|
+
[rowField]: getRowUniqueId(),
|
|
2621
|
+
[parentField]: null,
|
|
2622
|
+
[rowkey]: getRowUniqueId(),
|
|
2623
|
+
[childrenField]: childTreeData,
|
|
2624
|
+
[mapChildrenField]: childTreeData
|
|
2625
|
+
}
|
|
2626
|
+
if (checkField) {
|
|
2627
|
+
groupRow[checkField] = false
|
|
2628
|
+
}
|
|
2629
|
+
if (indeterminateField) {
|
|
2630
|
+
groupRow[indeterminateField] = false
|
|
2631
|
+
}
|
|
2632
|
+
treeData.push(groupRow)
|
|
2633
|
+
fullData.push(groupRow)
|
|
2634
|
+
if (childFullData.length) {
|
|
2635
|
+
fullData.push(...childFullData)
|
|
2636
|
+
}
|
|
2637
|
+
})
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
return {
|
|
2641
|
+
treeData,
|
|
2642
|
+
fullData
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
|
|
2646
|
+
/**
|
|
2647
|
+
* 加载表格数据
|
|
2648
|
+
* @param {Array} datas 数据
|
|
2649
|
+
*/
|
|
2650
|
+
function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, datas: any[], isReset: boolean) {
|
|
2651
|
+
const props = $xeTable
|
|
2652
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
2653
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
2654
|
+
|
|
2655
|
+
const { keepSource, treeConfig, rowGroupConfig } = props
|
|
2656
|
+
const { rowGroupList, scrollYLoad: oldScrollYLoad } = reactData
|
|
2657
|
+
const { scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData
|
|
2658
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
2659
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
2660
|
+
const expandOpts = $xeTable.computeExpandOpts
|
|
2661
|
+
const { transform } = treeOpts
|
|
2662
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
2663
|
+
let treeData = []
|
|
2664
|
+
let fullData = datas ? datas.slice(0) : [] // 转为响应式数据
|
|
2665
|
+
if (fullData.length > supportMaxRow) {
|
|
2666
|
+
errLog('vxe.error.errMaxRow', [supportMaxRow])
|
|
2667
|
+
}
|
|
2668
|
+
if (treeConfig && rowGroupList.length) {
|
|
2669
|
+
errLog('vxe.error.noTree', ['row-group-config'])
|
|
2670
|
+
return $xeTable.$nextTick()
|
|
2671
|
+
}
|
|
2672
|
+
if (rowOpts.drag && rowGroupList.length) {
|
|
2673
|
+
errLog('vxe.error.errConflicts', ['row-config.drag', 'row-group-config'])
|
|
2674
|
+
return $xeTable.$nextTick()
|
|
2675
|
+
}
|
|
2676
|
+
let isRGroup = false
|
|
2677
|
+
if (treeConfig) {
|
|
2678
|
+
if (transform) {
|
|
2679
|
+
// 树结构自动转换
|
|
2680
|
+
if (!treeOpts.rowField) {
|
|
2681
|
+
errLog('vxe.error.reqProp', ['tree-config.rowField'])
|
|
2682
|
+
}
|
|
2683
|
+
if (!treeOpts.parentField) {
|
|
2684
|
+
errLog('vxe.error.reqProp', ['tree-config.parentField'])
|
|
2685
|
+
}
|
|
2686
|
+
if (!childrenField) {
|
|
2687
|
+
errLog('vxe.error.reqProp', ['tree-config.childrenField'])
|
|
2688
|
+
}
|
|
2689
|
+
if (!treeOpts.mapChildrenField) {
|
|
2690
|
+
errLog('vxe.error.reqProp', ['tree-config.mapChildrenField'])
|
|
2691
|
+
}
|
|
2692
|
+
if (childrenField === treeOpts.mapChildrenField) {
|
|
2693
|
+
errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField'])
|
|
2694
|
+
}
|
|
2695
|
+
// fullData.forEach(row => {
|
|
2696
|
+
// if (row[treeOpts.children] && row[treeOpts.children].length) {
|
|
2697
|
+
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
|
|
2698
|
+
// }
|
|
2699
|
+
// })
|
|
2700
|
+
treeData = XEUtils.toArrayTree(fullData, {
|
|
2701
|
+
key: treeOpts.rowField,
|
|
2702
|
+
parentKey: treeOpts.parentField,
|
|
2703
|
+
children: childrenField,
|
|
2704
|
+
mapChildren: treeOpts.mapChildrenField
|
|
2705
|
+
})
|
|
2706
|
+
fullData = treeData.slice(0)
|
|
2707
|
+
} else {
|
|
2708
|
+
treeData = fullData.slice(0)
|
|
2709
|
+
}
|
|
2710
|
+
} else if (rowGroupConfig && rowGroupList.length) {
|
|
2711
|
+
const groupRest = handleGroupData($xeTable, fullData, rowGroupList)
|
|
2712
|
+
treeData = groupRest.treeData
|
|
2713
|
+
fullData = groupRest.fullData
|
|
2714
|
+
isRGroup = true
|
|
2715
|
+
}
|
|
2716
|
+
reactData.isRowGroupStatus = isRGroup
|
|
2717
|
+
scrollYStore.startIndex = 0
|
|
2718
|
+
scrollYStore.endIndex = 1
|
|
2719
|
+
scrollXStore.startIndex = 0
|
|
2720
|
+
scrollXStore.endIndex = 1
|
|
2721
|
+
reactData.isRowLoading = true
|
|
2722
|
+
reactData.scrollVMLoading = false
|
|
2723
|
+
internalData.treeExpandedMaps = {}
|
|
2724
|
+
reactData.treeExpandedFlag++
|
|
2725
|
+
internalData.rowExpandedMaps = {}
|
|
2726
|
+
reactData.rowExpandedFlag++
|
|
2727
|
+
internalData.insertRowMaps = {}
|
|
2728
|
+
reactData.insertRowFlag++
|
|
2729
|
+
internalData.removeRowMaps = {}
|
|
2730
|
+
reactData.removeRowFlag++
|
|
2731
|
+
const sYLoad = updateScrollYStatus($xeTable, fullData)
|
|
2732
|
+
reactData.isDragColMove = false
|
|
2733
|
+
reactData.isDragRowMove = false
|
|
2734
|
+
// 全量数据
|
|
2735
|
+
internalData.tableFullData = fullData
|
|
2736
|
+
internalData.tableFullTreeData = isRGroup ? [] : treeData
|
|
2737
|
+
internalData.tableFullGroupData = isRGroup ? treeData : []
|
|
2738
|
+
// 缓存数据
|
|
2739
|
+
$xeTable.cacheRowMap(isReset)
|
|
2740
|
+
// 原始数据
|
|
2741
|
+
internalData.tableSynchData = datas
|
|
2742
|
+
if (isReset) {
|
|
2743
|
+
internalData.isResizeCellHeight = false
|
|
2744
|
+
}
|
|
2745
|
+
// 克隆原数据,用于显示编辑状态,与编辑值做对比
|
|
2746
|
+
if (keepSource) {
|
|
2747
|
+
$xeTable.cacheSourceMap(fullData)
|
|
2748
|
+
}
|
|
2749
|
+
if ($xeTable.clearCellAreas && props.mouseConfig) {
|
|
2750
|
+
$xeTable.clearCellAreas()
|
|
2751
|
+
$xeTable.clearCopyCellArea()
|
|
2752
|
+
}
|
|
2753
|
+
$xeTable.clearMergeCells()
|
|
2754
|
+
$xeTable.clearMergeFooterItems()
|
|
2755
|
+
$xeTable.handleTableData(true)
|
|
2756
|
+
$xeTable.updateFooter()
|
|
2757
|
+
$xeTable.handleUpdateBodyMerge()
|
|
2758
|
+
return $xeTable.$nextTick().then(() => {
|
|
2759
|
+
updateHeight($xeTable)
|
|
2760
|
+
updateStyle($xeTable)
|
|
2761
|
+
}).then(() => {
|
|
2762
|
+
computeScrollLoad($xeTable)
|
|
2763
|
+
}).then(() => {
|
|
2764
|
+
// 是否启用了虚拟滚动
|
|
2765
|
+
if (sYLoad) {
|
|
2766
|
+
scrollYStore.endIndex = scrollYStore.visibleSize
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
if (sYLoad) {
|
|
2770
|
+
if (reactData.expandColumn && expandOpts.mode !== 'fixed') {
|
|
2771
|
+
errLog('vxe.error.notConflictProp', ['column.type="expand', 'expand-config.mode="fixed"'])
|
|
2772
|
+
}
|
|
2773
|
+
// if (showOverflow) {
|
|
2774
|
+
// if (!rowOpts.height) {
|
|
2775
|
+
// const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
|
|
2776
|
+
// if (errColumn) {
|
|
2777
|
+
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
2778
|
+
// }
|
|
2779
|
+
// }
|
|
2780
|
+
// }
|
|
2781
|
+
|
|
2782
|
+
if (!(props.height || props.maxHeight)) {
|
|
2783
|
+
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}'])
|
|
2784
|
+
}
|
|
2785
|
+
// if (!props.showOverflow) {
|
|
2786
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2787
|
+
// }
|
|
2788
|
+
if (props.spanMethod) {
|
|
2789
|
+
errLog('vxe.error.scrollErrProp', ['table.span-method'])
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2793
|
+
handleReserveStatus($xeTable)
|
|
2794
|
+
$xeTable.checkSelectionStatus()
|
|
2795
|
+
return new Promise<void>(resolve => {
|
|
2796
|
+
$xeTable.$nextTick()
|
|
2797
|
+
.then(() => handleRecalculateLayout($xeTable, false))
|
|
2798
|
+
.then(() => {
|
|
2799
|
+
calcCellHeight($xeTable)
|
|
2800
|
+
updateRowOffsetTop($xeTable)
|
|
2801
|
+
return handleRecalculateLayout($xeTable, false)
|
|
2802
|
+
})
|
|
2803
|
+
.then(() => {
|
|
2804
|
+
let targetScrollLeft = lastScrollLeft
|
|
2805
|
+
let targetScrollTop = lastScrollTop
|
|
2806
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts
|
|
2807
|
+
const virtualYOpts = $xeTable.computeVirtualYOpts
|
|
2808
|
+
// 是否在更新数据之后自动滚动重置滚动条
|
|
2809
|
+
if (virtualXOpts.scrollToLeftOnChange) {
|
|
2810
|
+
targetScrollLeft = 0
|
|
2811
|
+
}
|
|
2812
|
+
if (virtualYOpts.scrollToTopOnChange) {
|
|
2813
|
+
targetScrollTop = 0
|
|
2814
|
+
}
|
|
2815
|
+
reactData.isRowLoading = false
|
|
2816
|
+
handleRecalculateLayout($xeTable, false)
|
|
2817
|
+
// 是否变更虚拟滚动
|
|
2818
|
+
if (oldScrollYLoad === sYLoad) {
|
|
2819
|
+
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
2820
|
+
.then(() => {
|
|
2821
|
+
resolve()
|
|
2822
|
+
})
|
|
2823
|
+
} else {
|
|
2824
|
+
setTimeout(() => {
|
|
2825
|
+
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
2826
|
+
.then(() => {
|
|
2827
|
+
resolve()
|
|
2828
|
+
})
|
|
2829
|
+
})
|
|
2830
|
+
}
|
|
2831
|
+
})
|
|
2832
|
+
})
|
|
2833
|
+
})
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2206
2836
|
/**
|
|
2207
2837
|
* 处理数据加载默认行为
|
|
2208
2838
|
* 默认执行一次,除非被重置
|
|
@@ -2906,16 +3536,25 @@ const Methods = {
|
|
|
2906
3536
|
clearAll () {
|
|
2907
3537
|
return clearTableAllStatus(this)
|
|
2908
3538
|
},
|
|
3539
|
+
handleUpdateRowGroup (groupFields: any[]) {
|
|
3540
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3541
|
+
|
|
3542
|
+
handleUpdateRowGroup($xeTable, groupFields)
|
|
3543
|
+
},
|
|
2909
3544
|
/**
|
|
2910
3545
|
* 同步 data 数据(即将废弃)
|
|
2911
3546
|
* 如果用了该方法,那么组件将不再记录增删改的状态,只能自行实现对应逻辑
|
|
2912
3547
|
* 对于某些特殊的场景,比如深层树节点元素发生变动时可能会用到
|
|
2913
3548
|
*/
|
|
2914
3549
|
syncData () {
|
|
3550
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3551
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
3552
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3553
|
+
|
|
2915
3554
|
errLog('vxe.error.delFunc', ['syncData', 'getData'])
|
|
2916
|
-
return
|
|
2917
|
-
|
|
2918
|
-
return
|
|
3555
|
+
return $xeTable.$nextTick().then(() => {
|
|
3556
|
+
reactData.tableData = []
|
|
3557
|
+
return $xeTable.$nextTick().then(() => loadTableData($xeTable, internalData.tableFullData, true))
|
|
2919
3558
|
})
|
|
2920
3559
|
},
|
|
2921
3560
|
/**
|
|
@@ -2942,205 +3581,47 @@ const Methods = {
|
|
|
2942
3581
|
$xeTable.updateCellAreas()
|
|
2943
3582
|
return $xeTable.recalculate(true)
|
|
2944
3583
|
}).then(() => {
|
|
2945
|
-
// 存在滚动行为未结束情况
|
|
2946
|
-
setTimeout(() => $xeTable.recalculate(), 50)
|
|
2947
|
-
})
|
|
2948
|
-
},
|
|
2949
|
-
handleTableData (force: any) {
|
|
2950
|
-
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
2951
|
-
const reactData = $xeTable as unknown as TableReactData
|
|
2952
|
-
const internalData = $xeTable as unknown as TableInternalData
|
|
2953
|
-
|
|
2954
|
-
const { scrollYLoad } = reactData
|
|
2955
|
-
const { scrollYStore, fullDataRowIdData } = internalData
|
|
2956
|
-
let fullList: any[] = internalData.afterFullData
|
|
2957
|
-
// 是否进行数据处理
|
|
2958
|
-
if (force) {
|
|
2959
|
-
// 更新数据,处理筛选和排序
|
|
2960
|
-
this.updateAfterFullData()
|
|
2961
|
-
// 如果为虚拟树,将树结构拍平
|
|
2962
|
-
fullList = handleVirtualTreeToList($xeTable)
|
|
2963
|
-
}
|
|
2964
|
-
const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0)
|
|
2965
|
-
const visibleDataRowIdMaps: Record<string, any> = {}
|
|
2966
|
-
tableData.forEach((row: any, $index: any) => {
|
|
2967
|
-
const rowid = getRowid(this, row)
|
|
2968
|
-
const rest = fullDataRowIdData[rowid]
|
|
2969
|
-
if (rest) {
|
|
2970
|
-
rest.$index = $index
|
|
2971
|
-
}
|
|
2972
|
-
visibleDataRowIdMaps[rowid] = row
|
|
2973
|
-
})
|
|
2974
|
-
this.tableData = tableData
|
|
2975
|
-
internalData.visibleDataRowIdData = visibleDataRowIdMaps
|
|
2976
|
-
return this.$nextTick()
|
|
2977
|
-
},
|
|
2978
|
-
/**
|
|
2979
|
-
* 加载表格数据
|
|
2980
|
-
* @param {Array} datas 数据
|
|
2981
|
-
*/
|
|
2982
|
-
loadTableData (datas: any[], isReset: boolean) {
|
|
2983
|
-
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
2984
|
-
const props = $xeTable
|
|
2985
|
-
const reactData = $xeTable as unknown as TableReactData
|
|
2986
|
-
const internalData = $xeTable as unknown as TableInternalData
|
|
2987
|
-
|
|
2988
|
-
const { keepSource, treeConfig } = props
|
|
2989
|
-
const { scrollYLoad: oldScrollYLoad } = reactData
|
|
2990
|
-
const { scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData
|
|
2991
|
-
const treeOpts = $xeTable.computeTreeOpts
|
|
2992
|
-
const expandOpts = $xeTable.computeExpandOpts
|
|
2993
|
-
const { transform } = treeOpts
|
|
2994
|
-
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
2995
|
-
let treeData = []
|
|
2996
|
-
let fullData = datas ? datas.slice(0) : []
|
|
2997
|
-
if (fullData.length > supportMaxRow) {
|
|
2998
|
-
errLog('vxe.error.errMaxRow', [supportMaxRow])
|
|
2999
|
-
}
|
|
3000
|
-
if (treeConfig) {
|
|
3001
|
-
// 树结构自动转换
|
|
3002
|
-
if (transform) {
|
|
3003
|
-
if (!treeOpts.rowField) {
|
|
3004
|
-
errLog('vxe.error.reqProp', ['table.tree-config.rowField'])
|
|
3005
|
-
}
|
|
3006
|
-
if (!treeOpts.parentField) {
|
|
3007
|
-
errLog('vxe.error.reqProp', ['table.tree-config.parentField'])
|
|
3008
|
-
}
|
|
3009
|
-
if (!childrenField) {
|
|
3010
|
-
errLog('vxe.error.reqProp', ['tree-config.childrenField'])
|
|
3011
|
-
}
|
|
3012
|
-
if (!treeOpts.mapChildrenField) {
|
|
3013
|
-
errLog('vxe.error.reqProp', ['tree-config.mapChildrenField'])
|
|
3014
|
-
}
|
|
3015
|
-
if (childrenField === treeOpts.mapChildrenField) {
|
|
3016
|
-
errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField'])
|
|
3017
|
-
}
|
|
3018
|
-
// fullData.forEach(row => {
|
|
3019
|
-
// if (row[childrenField] && row[childrenField].length) {
|
|
3020
|
-
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${childrenField}`])
|
|
3021
|
-
// }
|
|
3022
|
-
// })
|
|
3023
|
-
treeData = XEUtils.toArrayTree(fullData, {
|
|
3024
|
-
key: treeOpts.rowField,
|
|
3025
|
-
parentKey: treeOpts.parentField,
|
|
3026
|
-
children: childrenField,
|
|
3027
|
-
mapChildren: treeOpts.mapChildrenField
|
|
3028
|
-
})
|
|
3029
|
-
fullData = treeData.slice(0)
|
|
3030
|
-
} else {
|
|
3031
|
-
treeData = fullData.slice(0)
|
|
3032
|
-
}
|
|
3033
|
-
}
|
|
3034
|
-
scrollYStore.startIndex = 0
|
|
3035
|
-
scrollYStore.endIndex = 1
|
|
3036
|
-
scrollXStore.startIndex = 0
|
|
3037
|
-
scrollXStore.endIndex = 1
|
|
3038
|
-
reactData.isRowLoading = true
|
|
3039
|
-
reactData.scrollVMLoading = false
|
|
3040
|
-
internalData.insertRowMaps = {}
|
|
3041
|
-
internalData.removeRowMaps = {}
|
|
3042
|
-
const sYLoad = updateScrollYStatus($xeTable, fullData)
|
|
3043
|
-
reactData.isDragColMove = false
|
|
3044
|
-
reactData.isDragRowMove = false
|
|
3045
|
-
// 全量数据
|
|
3046
|
-
internalData.tableFullData = fullData
|
|
3047
|
-
internalData.tableFullTreeData = treeData
|
|
3048
|
-
// 缓存数据
|
|
3049
|
-
$xeTable.cacheRowMap(isReset)
|
|
3050
|
-
// 原始数据
|
|
3051
|
-
internalData.tableSynchData = datas
|
|
3052
|
-
if (isReset) {
|
|
3053
|
-
internalData.isResizeCellHeight = false
|
|
3054
|
-
}
|
|
3055
|
-
// 克隆原数据,用于显示编辑状态,与编辑值做对比
|
|
3056
|
-
if (keepSource) {
|
|
3057
|
-
$xeTable.cacheSourceMap(fullData)
|
|
3058
|
-
}
|
|
3059
|
-
if ($xeTable.clearCellAreas && props.mouseConfig) {
|
|
3060
|
-
$xeTable.clearCellAreas()
|
|
3061
|
-
$xeTable.clearCopyCellArea()
|
|
3062
|
-
}
|
|
3063
|
-
$xeTable.clearMergeCells()
|
|
3064
|
-
$xeTable.clearMergeFooterItems()
|
|
3065
|
-
$xeTable.handleTableData(true)
|
|
3066
|
-
$xeTable.updateFooter()
|
|
3067
|
-
$xeTable.handleUpdateBodyMerge()
|
|
3068
|
-
return $xeTable.$nextTick().then(() => {
|
|
3069
|
-
updateHeight($xeTable)
|
|
3070
|
-
updateStyle($xeTable)
|
|
3071
|
-
}).then(() => {
|
|
3072
|
-
computeScrollLoad($xeTable)
|
|
3073
|
-
}).then(() => {
|
|
3074
|
-
// 是否启用了虚拟滚动
|
|
3075
|
-
if (sYLoad) {
|
|
3076
|
-
scrollYStore.endIndex = scrollYStore.visibleSize
|
|
3077
|
-
}
|
|
3078
|
-
|
|
3079
|
-
if (sYLoad) {
|
|
3080
|
-
if (reactData.expandColumn && expandOpts.mode !== 'fixed') {
|
|
3081
|
-
errLog('vxe.error.notConflictProp', ['column.type="expand', 'expand-config.mode="fixed"'])
|
|
3082
|
-
}
|
|
3083
|
-
// if (showOverflow) {
|
|
3084
|
-
// if (!rowOpts.height) {
|
|
3085
|
-
// const errColumn = internalData.tableFullColumn.find((column: any) => column.showOverflow === false)
|
|
3086
|
-
// if (errColumn) {
|
|
3087
|
-
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
3088
|
-
// }
|
|
3089
|
-
// }
|
|
3090
|
-
// }
|
|
3584
|
+
// 存在滚动行为未结束情况
|
|
3585
|
+
setTimeout(() => $xeTable.recalculate(), 50)
|
|
3586
|
+
})
|
|
3587
|
+
},
|
|
3588
|
+
handleTableData (force: any) {
|
|
3589
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3590
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
3591
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3091
3592
|
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3593
|
+
const { scrollYLoad } = reactData
|
|
3594
|
+
const { scrollYStore, fullDataRowIdData } = internalData
|
|
3595
|
+
let fullList: any[] = internalData.afterFullData
|
|
3596
|
+
// 是否进行数据处理
|
|
3597
|
+
if (force) {
|
|
3598
|
+
// 更新数据,处理筛选和排序
|
|
3599
|
+
updateAfterFullData($xeTable)
|
|
3600
|
+
// 如果为虚拟树,将树结构拍平
|
|
3601
|
+
fullList = handleVirtualTreeToList($xeTable)
|
|
3602
|
+
}
|
|
3603
|
+
const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0)
|
|
3604
|
+
const visibleDataRowIdMaps: Record<string, any> = {}
|
|
3605
|
+
tableData.forEach((row, $index) => {
|
|
3606
|
+
const rowid = getRowid($xeTable, row)
|
|
3607
|
+
const rest = fullDataRowIdData[rowid]
|
|
3608
|
+
if (rest) {
|
|
3609
|
+
rest.$index = $index
|
|
3101
3610
|
}
|
|
3102
|
-
|
|
3103
|
-
handleReserveStatus($xeTable)
|
|
3104
|
-
$xeTable.checkSelectionStatus()
|
|
3105
|
-
return new Promise<void>(resolve => {
|
|
3106
|
-
this.$nextTick()
|
|
3107
|
-
.then(() => handleRecalculateLayout($xeTable, false))
|
|
3108
|
-
.then(() => {
|
|
3109
|
-
calcCellHeight($xeTable)
|
|
3110
|
-
updateRowOffsetTop($xeTable)
|
|
3111
|
-
return handleRecalculateLayout($xeTable, false)
|
|
3112
|
-
})
|
|
3113
|
-
.then(() => {
|
|
3114
|
-
let targetScrollLeft = lastScrollLeft
|
|
3115
|
-
let targetScrollTop = lastScrollTop
|
|
3116
|
-
const virtualXOpts = $xeTable.computeVirtualXOpts
|
|
3117
|
-
const virtualYOpts = $xeTable.computeVirtualYOpts
|
|
3118
|
-
// 是否在更新数据之后自动滚动重置滚动条
|
|
3119
|
-
if (virtualXOpts.scrollToLeftOnChange) {
|
|
3120
|
-
targetScrollLeft = 0
|
|
3121
|
-
}
|
|
3122
|
-
if (virtualYOpts.scrollToTopOnChange) {
|
|
3123
|
-
targetScrollTop = 0
|
|
3124
|
-
}
|
|
3125
|
-
reactData.isRowLoading = false
|
|
3126
|
-
handleRecalculateLayout($xeTable, false)
|
|
3127
|
-
// 是否变更虚拟滚动
|
|
3128
|
-
if (oldScrollYLoad === sYLoad) {
|
|
3129
|
-
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
3130
|
-
.then(() => {
|
|
3131
|
-
resolve()
|
|
3132
|
-
})
|
|
3133
|
-
} else {
|
|
3134
|
-
setTimeout(() => {
|
|
3135
|
-
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
3136
|
-
.then(() => {
|
|
3137
|
-
resolve()
|
|
3138
|
-
})
|
|
3139
|
-
})
|
|
3140
|
-
}
|
|
3141
|
-
})
|
|
3142
|
-
})
|
|
3611
|
+
visibleDataRowIdMaps[rowid] = row
|
|
3143
3612
|
})
|
|
3613
|
+
reactData.tableData = tableData
|
|
3614
|
+
internalData.visibleDataRowIdData = visibleDataRowIdMaps
|
|
3615
|
+
return $xeTable.$nextTick()
|
|
3616
|
+
},
|
|
3617
|
+
/**
|
|
3618
|
+
* 加载表格数据
|
|
3619
|
+
* @param {Array} datas 数据
|
|
3620
|
+
*/
|
|
3621
|
+
loadTableData (datas: any[], isReset: boolean) {
|
|
3622
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3623
|
+
|
|
3624
|
+
return loadTableData($xeTable, datas, isReset)
|
|
3144
3625
|
},
|
|
3145
3626
|
/**
|
|
3146
3627
|
* 重新加载数据,不会清空表格状态
|
|
@@ -3150,7 +3631,7 @@ const Methods = {
|
|
|
3150
3631
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3151
3632
|
|
|
3152
3633
|
const { initStatus } = this
|
|
3153
|
-
return
|
|
3634
|
+
return loadTableData($xeTable, datas, false).then(() => {
|
|
3154
3635
|
this.inited = true
|
|
3155
3636
|
this.initStatus = true
|
|
3156
3637
|
if (!initStatus) {
|
|
@@ -3170,7 +3651,7 @@ const Methods = {
|
|
|
3170
3651
|
.then(() => {
|
|
3171
3652
|
this.inited = true
|
|
3172
3653
|
this.initStatus = true
|
|
3173
|
-
return
|
|
3654
|
+
return loadTableData($xeTable, datas, true)
|
|
3174
3655
|
})
|
|
3175
3656
|
.then(() => {
|
|
3176
3657
|
handleLoadDefaults($xeTable)
|
|
@@ -3256,11 +3737,8 @@ const Methods = {
|
|
|
3256
3737
|
const internalData = $xeTable as unknown as TableInternalData
|
|
3257
3738
|
|
|
3258
3739
|
const { treeConfig } = props
|
|
3259
|
-
const {
|
|
3260
|
-
const
|
|
3261
|
-
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
3262
|
-
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
3263
|
-
const { lazy } = treeOpts
|
|
3740
|
+
const { isRowGroupStatus } = reactData
|
|
3741
|
+
const { fullAllDataRowIdData, tableFullData, tableFullTreeData, tableFullGroupData, treeExpandedMaps } = internalData
|
|
3264
3742
|
const fullAllDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = isReset ? {} : { ...fullAllDataRowIdData } // 存在已删除数据
|
|
3265
3743
|
const fullDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = {}
|
|
3266
3744
|
|
|
@@ -3285,6 +3763,10 @@ const Methods = {
|
|
|
3285
3763
|
}
|
|
3286
3764
|
|
|
3287
3765
|
if (treeConfig) {
|
|
3766
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
3767
|
+
const { lazy } = treeOpts
|
|
3768
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
3769
|
+
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
3288
3770
|
XEUtils.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
|
|
3289
3771
|
const rowid = handleUpdateRowId(row)
|
|
3290
3772
|
if (treeConfig && lazy) {
|
|
@@ -3299,6 +3781,13 @@ const Methods = {
|
|
|
3299
3781
|
}
|
|
3300
3782
|
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
|
|
3301
3783
|
}, { children: childrenField })
|
|
3784
|
+
} else if (isRowGroupStatus) {
|
|
3785
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
3786
|
+
const { mapChildrenField } = rowGroupOpts
|
|
3787
|
+
XEUtils.eachTree(tableFullGroupData, (row, index, items, path, parentRow, nodes) => {
|
|
3788
|
+
const rowid = handleUpdateRowId(row)
|
|
3789
|
+
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
|
|
3790
|
+
}, { children: mapChildrenField })
|
|
3302
3791
|
} else {
|
|
3303
3792
|
tableFullData.forEach((row, index, items) => {
|
|
3304
3793
|
handleRowCache(row, index, items, index, null, handleUpdateRowId(row), 0, index + 1)
|
|
@@ -4061,173 +4550,6 @@ const Methods = {
|
|
|
4061
4550
|
}
|
|
4062
4551
|
return rowList
|
|
4063
4552
|
},
|
|
4064
|
-
/**
|
|
4065
|
-
* 获取处理后全量的表格数据
|
|
4066
|
-
* 如果存在筛选条件,继续处理
|
|
4067
|
-
*/
|
|
4068
|
-
updateAfterFullData () {
|
|
4069
|
-
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
4070
|
-
const props = $xeTable
|
|
4071
|
-
const internalData = $xeTable as unknown as TableInternalData
|
|
4072
|
-
|
|
4073
|
-
const { treeConfig } = props
|
|
4074
|
-
const { tableFullColumn, tableFullData, tableFullTreeData } = internalData
|
|
4075
|
-
const filterOpts = $xeTable.computeFilterOpts
|
|
4076
|
-
const sortOpts = $xeTable.computeSortOpts
|
|
4077
|
-
const treeOpts = $xeTable.computeTreeOpts
|
|
4078
|
-
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
4079
|
-
const { transform, rowField, parentField, mapChildrenField } = treeOpts
|
|
4080
|
-
const { isEvery, remote: allRemoteFilter, filterMethod: allFilterMethod } = filterOpts
|
|
4081
|
-
const { remote: allRemoteSort, sortMethod: allSortMethod, multiple: sortMultiple, chronological } = sortOpts
|
|
4082
|
-
let tableData: any[] = []
|
|
4083
|
-
let tableTree: any[] = []
|
|
4084
|
-
|
|
4085
|
-
// 处理数据
|
|
4086
|
-
if (!allRemoteFilter || !allRemoteSort) {
|
|
4087
|
-
const filterColumns: {
|
|
4088
|
-
column: VxeTableDefines.ColumnInfo
|
|
4089
|
-
valueList: any[]
|
|
4090
|
-
itemList: VxeTableDefines.FilterOption[]
|
|
4091
|
-
}[] = []
|
|
4092
|
-
let orderColumns: VxeTableDefines.SortCheckedParams[] = []
|
|
4093
|
-
tableFullColumn.forEach((column) => {
|
|
4094
|
-
const { field, sortable, order, filters } = column
|
|
4095
|
-
if (!allRemoteFilter && filters && filters.length) {
|
|
4096
|
-
const valueList: any[] = []
|
|
4097
|
-
const itemList: VxeTableDefines.FilterOption[] = []
|
|
4098
|
-
filters.forEach((item) => {
|
|
4099
|
-
if (item.checked) {
|
|
4100
|
-
itemList.push(item as VxeTableDefines.FilterOption)
|
|
4101
|
-
valueList.push(item.value)
|
|
4102
|
-
}
|
|
4103
|
-
})
|
|
4104
|
-
if (itemList.length) {
|
|
4105
|
-
filterColumns.push({ column, valueList, itemList })
|
|
4106
|
-
}
|
|
4107
|
-
}
|
|
4108
|
-
if (!allRemoteSort && sortable && order) {
|
|
4109
|
-
orderColumns.push({ column, field, property: field, order: order, sortTime: column.sortTime })
|
|
4110
|
-
}
|
|
4111
|
-
})
|
|
4112
|
-
if (sortMultiple && chronological && orderColumns.length > 1) {
|
|
4113
|
-
orderColumns = XEUtils.orderBy(orderColumns, 'sortTime')
|
|
4114
|
-
}
|
|
4115
|
-
|
|
4116
|
-
// 处理筛选
|
|
4117
|
-
// 支持单列、多列、组合筛选
|
|
4118
|
-
if (!allRemoteFilter && filterColumns.length) {
|
|
4119
|
-
const handleFilter = (row: any) => {
|
|
4120
|
-
return filterColumns.every(({ column, valueList, itemList }) => {
|
|
4121
|
-
const { filterMethod, filterRender } = column
|
|
4122
|
-
const compConf = isEnableConf(filterRender) ? renderer.get(filterRender.name) : null
|
|
4123
|
-
const compFilterMethod = compConf ? (compConf.tableFilterMethod || compConf.filterMethod) : null
|
|
4124
|
-
const tdFilterMethod = compConf ? (compConf.tableFilterDefaultMethod || compConf.defaultTableFilterMethod || compConf.defaultFilterMethod) : null
|
|
4125
|
-
const cellValue = getCellValue(row, column)
|
|
4126
|
-
if (filterMethod) {
|
|
4127
|
-
return itemList.some((item) => filterMethod({ value: item.value, option: item, cellValue, row, column, $table: $xeTable }))
|
|
4128
|
-
} else if (compFilterMethod) {
|
|
4129
|
-
return itemList.some((item) => compFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: $xeTable }))
|
|
4130
|
-
} else if (allFilterMethod) {
|
|
4131
|
-
return allFilterMethod({ options: itemList, values: valueList, cellValue, row, column })
|
|
4132
|
-
} else if (tdFilterMethod) {
|
|
4133
|
-
return itemList.some((item) => tdFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: $xeTable }))
|
|
4134
|
-
}
|
|
4135
|
-
return valueList.indexOf(XEUtils.get(row, column.field)) > -1
|
|
4136
|
-
})
|
|
4137
|
-
}
|
|
4138
|
-
if (treeConfig && transform) {
|
|
4139
|
-
// 筛选虚拟树
|
|
4140
|
-
tableTree = XEUtils.searchTree(tableFullTreeData, handleFilter, {
|
|
4141
|
-
original: true,
|
|
4142
|
-
isEvery,
|
|
4143
|
-
children: mapChildrenField,
|
|
4144
|
-
mapChildren: childrenField
|
|
4145
|
-
})
|
|
4146
|
-
tableData = tableTree
|
|
4147
|
-
} else {
|
|
4148
|
-
tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter)
|
|
4149
|
-
tableTree = tableData
|
|
4150
|
-
}
|
|
4151
|
-
} else {
|
|
4152
|
-
if (treeConfig && transform) {
|
|
4153
|
-
// 还原虚拟树
|
|
4154
|
-
tableTree = XEUtils.searchTree(tableFullTreeData, () => true, {
|
|
4155
|
-
original: true,
|
|
4156
|
-
isEvery,
|
|
4157
|
-
children: mapChildrenField,
|
|
4158
|
-
mapChildren: childrenField
|
|
4159
|
-
})
|
|
4160
|
-
tableData = tableTree
|
|
4161
|
-
} else {
|
|
4162
|
-
tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0)
|
|
4163
|
-
tableTree = tableData
|
|
4164
|
-
}
|
|
4165
|
-
}
|
|
4166
|
-
|
|
4167
|
-
// 处理排序(不能用于树形结构)
|
|
4168
|
-
// 支持单列、多列、组合排序
|
|
4169
|
-
if (!allRemoteSort && orderColumns.length) {
|
|
4170
|
-
if (treeConfig && transform) {
|
|
4171
|
-
// 虚拟树和列表一样,只能排序根级节点
|
|
4172
|
-
if (allSortMethod) {
|
|
4173
|
-
const sortRests = allSortMethod({ data: tableTree, sortList: orderColumns, $table: $xeTable })
|
|
4174
|
-
tableTree = XEUtils.isArray(sortRests) ? sortRests : tableTree
|
|
4175
|
-
} else {
|
|
4176
|
-
const treeList = XEUtils.toTreeArray(tableTree, {
|
|
4177
|
-
children: mapChildrenField
|
|
4178
|
-
})
|
|
4179
|
-
tableTree = XEUtils.toArrayTree(
|
|
4180
|
-
XEUtils.orderBy(treeList, orderColumns.map(({ column, order }) => [getOrderField($xeTable, column), order])),
|
|
4181
|
-
{
|
|
4182
|
-
key: rowField,
|
|
4183
|
-
parentKey: parentField,
|
|
4184
|
-
children: childrenField,
|
|
4185
|
-
mapChildren: mapChildrenField
|
|
4186
|
-
}
|
|
4187
|
-
)
|
|
4188
|
-
}
|
|
4189
|
-
tableData = tableTree
|
|
4190
|
-
} else {
|
|
4191
|
-
if (allSortMethod) {
|
|
4192
|
-
const sortRests = allSortMethod({ data: tableData, sortList: orderColumns, $table: $xeTable })
|
|
4193
|
-
tableData = XEUtils.isArray(sortRests) ? sortRests : tableData
|
|
4194
|
-
} else {
|
|
4195
|
-
// 兼容 v4
|
|
4196
|
-
if (sortMultiple) {
|
|
4197
|
-
tableData = XEUtils.orderBy(tableData, orderColumns.map(({ column, order }) => [getOrderField(this, column), order]))
|
|
4198
|
-
} else {
|
|
4199
|
-
const firstOrderColumn = orderColumns[0]
|
|
4200
|
-
let sortByConfs
|
|
4201
|
-
// 已废弃,兼容 v2,在 v4 中废弃, sortBy 不能为数组
|
|
4202
|
-
if (XEUtils.isArray((firstOrderColumn as any).sortBy)) {
|
|
4203
|
-
sortByConfs = (firstOrderColumn as any).sortBy.map((item: any) => [item, firstOrderColumn.order])
|
|
4204
|
-
}
|
|
4205
|
-
tableData = XEUtils.orderBy(tableData, sortByConfs || [firstOrderColumn].map(({ column, order }) => [getOrderField(this, column), order]))
|
|
4206
|
-
}
|
|
4207
|
-
tableData = XEUtils.orderBy(tableData, orderColumns.map(({ column, order }) => [getOrderField($xeTable, column), order]))
|
|
4208
|
-
}
|
|
4209
|
-
tableTree = tableData
|
|
4210
|
-
}
|
|
4211
|
-
}
|
|
4212
|
-
} else {
|
|
4213
|
-
if (treeConfig && transform) {
|
|
4214
|
-
// 还原虚拟树
|
|
4215
|
-
tableTree = XEUtils.searchTree(tableFullTreeData, () => true, {
|
|
4216
|
-
original: true,
|
|
4217
|
-
isEvery,
|
|
4218
|
-
children: treeOpts.mapChildrenField,
|
|
4219
|
-
mapChildren: childrenField
|
|
4220
|
-
})
|
|
4221
|
-
tableData = tableTree
|
|
4222
|
-
} else {
|
|
4223
|
-
tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0)
|
|
4224
|
-
tableTree = tableData
|
|
4225
|
-
}
|
|
4226
|
-
}
|
|
4227
|
-
internalData.afterFullData = tableData
|
|
4228
|
-
internalData.afterTreeFullData = tableTree
|
|
4229
|
-
updateAfterDataIndex($xeTable)
|
|
4230
|
-
},
|
|
4231
4553
|
/**
|
|
4232
4554
|
* 预编译
|
|
4233
4555
|
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
@@ -4592,7 +4914,7 @@ const Methods = {
|
|
|
4592
4914
|
const storeData = getCustomStorageMap(tableId)
|
|
4593
4915
|
if (restoreStore) {
|
|
4594
4916
|
return Promise.resolve(
|
|
4595
|
-
restoreStore({ id: tableId, type: 'restore', storeData })
|
|
4917
|
+
restoreStore({ $table: $xeTable, id: tableId, type: 'restore', storeData })
|
|
4596
4918
|
).then(storeData => {
|
|
4597
4919
|
if (!storeData) {
|
|
4598
4920
|
return
|
|
@@ -4658,7 +4980,7 @@ const Methods = {
|
|
|
4658
4980
|
hasResizable = 1
|
|
4659
4981
|
resizableData[colKey] = column.renderWidth
|
|
4660
4982
|
}
|
|
4661
|
-
if (isCustomVisible && (!checkMethod || checkMethod({ column }))) {
|
|
4983
|
+
if (isCustomVisible && (!checkMethod || checkMethod({ $table: $xeTable, column }))) {
|
|
4662
4984
|
if (!column.visible && column.defaultVisible) {
|
|
4663
4985
|
hasVisible = 1
|
|
4664
4986
|
visibleData[colKey] = false
|
|
@@ -4715,6 +5037,7 @@ const Methods = {
|
|
|
4715
5037
|
: this.getCustomStoreData()
|
|
4716
5038
|
if (updateStore) {
|
|
4717
5039
|
return updateStore({
|
|
5040
|
+
$table: $xeTable,
|
|
4718
5041
|
id: tableId,
|
|
4719
5042
|
type,
|
|
4720
5043
|
storeData
|
|
@@ -5598,8 +5921,7 @@ const Methods = {
|
|
|
5598
5921
|
const hasDeleteKey = keyCode === 46
|
|
5599
5922
|
const isF2 = keyCode === 113
|
|
5600
5923
|
const isContextMenu = keyCode === 93
|
|
5601
|
-
const
|
|
5602
|
-
const hasCtrlKey = evnt.ctrlKey
|
|
5924
|
+
const isControlKey = hasControlKey(evnt)
|
|
5603
5925
|
const hasShiftKey = evnt.shiftKey
|
|
5604
5926
|
const hasAltKey = evnt.altKey
|
|
5605
5927
|
const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow
|
|
@@ -5661,7 +5983,7 @@ const Methods = {
|
|
|
5661
5983
|
} else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
|
|
5662
5984
|
const { isLastEnterAppendRow, beforeEnterMethod, enterMethod } = keyboardOpts
|
|
5663
5985
|
// 退出选中
|
|
5664
|
-
if (
|
|
5986
|
+
if (isControlKey) {
|
|
5665
5987
|
// 如果是激活编辑状态,则取消编辑
|
|
5666
5988
|
if (actived.row) {
|
|
5667
5989
|
const params = actived.args
|
|
@@ -5827,7 +6149,7 @@ const Methods = {
|
|
|
5827
6149
|
.then(() => $xeTable.scrollToRow(parentRow))
|
|
5828
6150
|
.then(() => $xeTable.triggerCurrentRowEvent(evnt, params))
|
|
5829
6151
|
}
|
|
5830
|
-
} else if (keyboardConfig && keyboardOpts.isEdit && !
|
|
6152
|
+
} else if (keyboardConfig && keyboardOpts.isEdit && !isControlKey && (isSpacebar || (keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || (keyCode >= 96 && keyCode <= 111) || (keyCode >= 186 && keyCode <= 192) || (keyCode >= 219 && keyCode <= 222))) {
|
|
5831
6153
|
const { editMethod } = keyboardOpts
|
|
5832
6154
|
// 启用编辑后,空格键功能将失效
|
|
5833
6155
|
// if (isSpacebar) {
|
|
@@ -6205,7 +6527,9 @@ const Methods = {
|
|
|
6205
6527
|
const internalData = $xeTable as unknown as TableInternalData
|
|
6206
6528
|
|
|
6207
6529
|
const { treeConfig } = props
|
|
6530
|
+
const { isRowGroupStatus } = reactData
|
|
6208
6531
|
const { selectCheckboxMaps } = internalData
|
|
6532
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
6209
6533
|
const treeOpts = $xeTable.computeTreeOpts
|
|
6210
6534
|
const { transform, mapChildrenField } = treeOpts
|
|
6211
6535
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -6216,10 +6540,10 @@ const Methods = {
|
|
|
6216
6540
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
|
|
6217
6541
|
if (checkField) {
|
|
6218
6542
|
// 树结构
|
|
6219
|
-
if (treeConfig && !checkStrictly) {
|
|
6543
|
+
if ((treeConfig || isRowGroupStatus) && !checkStrictly) {
|
|
6220
6544
|
// 更新子节点状态
|
|
6221
6545
|
XEUtils.eachTree(rows, (row) => {
|
|
6222
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
6546
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
6223
6547
|
XEUtils.set(row, checkField, checked)
|
|
6224
6548
|
if (indeterminateField) {
|
|
6225
6549
|
XEUtils.set(row, indeterminateField, false)
|
|
@@ -6232,7 +6556,7 @@ const Methods = {
|
|
|
6232
6556
|
}
|
|
6233
6557
|
// 列表
|
|
6234
6558
|
rows.forEach(row => {
|
|
6235
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
6559
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
6236
6560
|
XEUtils.set(row, checkField, checked)
|
|
6237
6561
|
handleCheckboxReserveRow($xeTable, row, checked)
|
|
6238
6562
|
}
|
|
@@ -6242,29 +6566,48 @@ const Methods = {
|
|
|
6242
6566
|
}
|
|
6243
6567
|
|
|
6244
6568
|
// 树结构
|
|
6245
|
-
if (
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
if (
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6569
|
+
if (!checkStrictly) {
|
|
6570
|
+
if (isRowGroupStatus) {
|
|
6571
|
+
// 更新行分组节点状态
|
|
6572
|
+
XEUtils.eachTree(rows, (row) => {
|
|
6573
|
+
const rowid = handleGetRowId(row)
|
|
6574
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
6575
|
+
if (checked) {
|
|
6576
|
+
selectCheckboxMaps[rowid] = row
|
|
6577
|
+
} else {
|
|
6578
|
+
if (selectCheckboxMaps[rowid]) {
|
|
6579
|
+
delete selectCheckboxMaps[rowid]
|
|
6580
|
+
}
|
|
6255
6581
|
}
|
|
6582
|
+
handleCheckboxReserveRow($xeTable, row, checked)
|
|
6256
6583
|
}
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6584
|
+
}, { children: rowGroupOpts.mapChildrenField })
|
|
6585
|
+
reactData.updateCheckboxFlag++
|
|
6586
|
+
return
|
|
6587
|
+
} else if (treeConfig) {
|
|
6588
|
+
// 更新子节点状态
|
|
6589
|
+
XEUtils.eachTree(rows, (row) => {
|
|
6590
|
+
const rowid = handleGetRowId(row)
|
|
6591
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
6592
|
+
if (checked) {
|
|
6593
|
+
selectCheckboxMaps[rowid] = row
|
|
6594
|
+
} else {
|
|
6595
|
+
if (selectCheckboxMaps[rowid]) {
|
|
6596
|
+
delete selectCheckboxMaps[rowid]
|
|
6597
|
+
}
|
|
6598
|
+
}
|
|
6599
|
+
handleCheckboxReserveRow($xeTable, row, checked)
|
|
6600
|
+
}
|
|
6601
|
+
}, { children: transform ? mapChildrenField : childrenField })
|
|
6602
|
+
reactData.updateCheckboxFlag++
|
|
6603
|
+
return
|
|
6604
|
+
}
|
|
6262
6605
|
}
|
|
6263
6606
|
|
|
6264
6607
|
// 列表
|
|
6265
6608
|
rows.forEach(row => {
|
|
6266
6609
|
const rowid = handleGetRowId(row)
|
|
6267
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
6610
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
6268
6611
|
if (checked) {
|
|
6269
6612
|
if (!selectCheckboxMaps[rowid]) {
|
|
6270
6613
|
selectCheckboxMaps[rowid] = row
|
|
@@ -6315,9 +6658,12 @@ const Methods = {
|
|
|
6315
6658
|
triggerCheckRowEvent (evnt: any, params: any, checked: any) {
|
|
6316
6659
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6317
6660
|
const props = $xeTable
|
|
6661
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
6318
6662
|
const internalData = $xeTable as unknown as TableInternalData
|
|
6319
6663
|
|
|
6664
|
+
const { treeConfig } = props
|
|
6320
6665
|
const { row } = params
|
|
6666
|
+
const { isRowGroupStatus } = reactData
|
|
6321
6667
|
const { afterFullData } = internalData
|
|
6322
6668
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
6323
6669
|
const { checkMethod, trigger } = checkboxOpts
|
|
@@ -6325,7 +6671,7 @@ const Methods = {
|
|
|
6325
6671
|
return
|
|
6326
6672
|
}
|
|
6327
6673
|
evnt.stopPropagation()
|
|
6328
|
-
if (checkboxOpts.isShiftKey && evnt.shiftKey && !
|
|
6674
|
+
if (checkboxOpts.isShiftKey && evnt.shiftKey && !(treeConfig || isRowGroupStatus)) {
|
|
6329
6675
|
const checkboxRecords = $xeTable.getCheckboxRecords()
|
|
6330
6676
|
if (checkboxRecords.length) {
|
|
6331
6677
|
const firstRow = checkboxRecords[0]
|
|
@@ -6342,7 +6688,7 @@ const Methods = {
|
|
|
6342
6688
|
}
|
|
6343
6689
|
}
|
|
6344
6690
|
}
|
|
6345
|
-
if (!checkMethod || checkMethod({ row })) {
|
|
6691
|
+
if (!checkMethod || checkMethod({ $table: $xeTable, row })) {
|
|
6346
6692
|
$xeTable.handleBatchSelectRows([row], checked)
|
|
6347
6693
|
$xeTable.checkSelectionStatus()
|
|
6348
6694
|
$xeTable.dispatchEvent('checkbox-change', Object.assign({
|
|
@@ -6384,29 +6730,47 @@ const Methods = {
|
|
|
6384
6730
|
const internalData = $xeTable as unknown as TableInternalData
|
|
6385
6731
|
|
|
6386
6732
|
const { treeConfig } = props
|
|
6387
|
-
const {
|
|
6733
|
+
const { isRowGroupStatus } = reactData
|
|
6734
|
+
const { afterTreeFullData, afterGroupFullData, selectCheckboxMaps, treeIndeterminateRowMaps } = internalData
|
|
6735
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
6388
6736
|
const treeOpts = $xeTable.computeTreeOpts
|
|
6389
|
-
const { transform, mapChildrenField } = treeOpts
|
|
6390
6737
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
6391
6738
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
6392
6739
|
const { checkField, checkStrictly, checkMethod } = checkboxOpts
|
|
6393
|
-
const { afterTreeFullData } = internalData
|
|
6394
6740
|
if (checkStrictly) {
|
|
6395
6741
|
return
|
|
6396
6742
|
}
|
|
6397
|
-
|
|
6398
|
-
if (treeConfig) {
|
|
6743
|
+
if (isRowGroupStatus || treeConfig) {
|
|
6399
6744
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
6400
6745
|
const childRowMaps: Record<string, number> = {}
|
|
6401
6746
|
const childRowList: any[][] = []
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6747
|
+
|
|
6748
|
+
if (isRowGroupStatus) {
|
|
6749
|
+
// 行分组
|
|
6750
|
+
const mapChildrenField = rowGroupOpts.mapChildrenField
|
|
6751
|
+
if (mapChildrenField) {
|
|
6752
|
+
XEUtils.eachTree(afterGroupFullData, (row) => {
|
|
6753
|
+
const rowid = handleGetRowId(row)
|
|
6754
|
+
const childList = row[mapChildrenField]
|
|
6755
|
+
if (childList && childList.length && !childRowMaps[rowid]) {
|
|
6756
|
+
childRowMaps[rowid] = 1
|
|
6757
|
+
childRowList.unshift([row, rowid, childList])
|
|
6758
|
+
}
|
|
6759
|
+
}, { children: mapChildrenField })
|
|
6408
6760
|
}
|
|
6409
|
-
}
|
|
6761
|
+
} else if (treeConfig) {
|
|
6762
|
+
// 树结构
|
|
6763
|
+
const { transform, mapChildrenField } = treeOpts
|
|
6764
|
+
XEUtils.eachTree(afterTreeFullData, (row) => {
|
|
6765
|
+
const rowid = handleGetRowId(row)
|
|
6766
|
+
const childList = row[transform ? mapChildrenField : childrenField]
|
|
6767
|
+
if (childList && childList.length && !childRowMaps[rowid]) {
|
|
6768
|
+
childRowMaps[rowid] = 1
|
|
6769
|
+
childRowList.unshift([row, rowid, childList])
|
|
6770
|
+
}
|
|
6771
|
+
}, { children: transform ? mapChildrenField : childrenField })
|
|
6772
|
+
}
|
|
6773
|
+
|
|
6410
6774
|
childRowList.forEach(vals => {
|
|
6411
6775
|
const row: string = vals[0]
|
|
6412
6776
|
const rowid: string = vals[1]
|
|
@@ -6419,7 +6783,7 @@ const Methods = {
|
|
|
6419
6783
|
? (item) => {
|
|
6420
6784
|
const childRowid = handleGetRowId(item)
|
|
6421
6785
|
const isSelect = checkField ? XEUtils.get(item, checkField) : selectCheckboxMaps[childRowid]
|
|
6422
|
-
if (checkMethod({ row: item })) {
|
|
6786
|
+
if (checkMethod({ $table: $xeTable, row: item })) {
|
|
6423
6787
|
if (isSelect) {
|
|
6424
6788
|
sLen++
|
|
6425
6789
|
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
@@ -6482,7 +6846,8 @@ const Methods = {
|
|
|
6482
6846
|
const internalData = $xeTable as unknown as TableInternalData
|
|
6483
6847
|
|
|
6484
6848
|
const { treeConfig } = props
|
|
6485
|
-
const {
|
|
6849
|
+
const { isRowGroupStatus } = reactData
|
|
6850
|
+
const { afterFullData, afterTreeFullData, afterGroupFullData, checkboxReserveRowMap, selectCheckboxMaps, treeIndeterminateRowMaps } = internalData
|
|
6486
6851
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
6487
6852
|
const { checkField, checkMethod, showReserveStatus } = checkboxOpts
|
|
6488
6853
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
@@ -6491,12 +6856,12 @@ const Methods = {
|
|
|
6491
6856
|
let hLen = 0 // 半选
|
|
6492
6857
|
let vLen = 0 // 有效行
|
|
6493
6858
|
|
|
6494
|
-
const rootList
|
|
6859
|
+
const rootList = (treeConfig ? afterTreeFullData : (isRowGroupStatus ? afterGroupFullData : afterFullData))
|
|
6495
6860
|
rootList.forEach(checkMethod
|
|
6496
6861
|
? row => {
|
|
6497
6862
|
const childRowid = handleGetRowId(row)
|
|
6498
6863
|
const selected = checkField ? XEUtils.get(row, checkField) : selectCheckboxMaps[childRowid]
|
|
6499
|
-
if (checkMethod({ row })) {
|
|
6864
|
+
if (checkMethod({ $table: $xeTable, row })) {
|
|
6500
6865
|
if (selected) {
|
|
6501
6866
|
sLen++
|
|
6502
6867
|
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
@@ -6994,20 +7359,22 @@ const Methods = {
|
|
|
6994
7359
|
const radioOpts = $xeTable.computeRadioOpts
|
|
6995
7360
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
6996
7361
|
const keyboardOpts = $xeTable.computeKeyboardOpts
|
|
7362
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
6997
7363
|
const rowOpts = $xeTable.computeRowOpts
|
|
6998
7364
|
const columnOpts = $xeTable.computeColumnOpts
|
|
6999
7365
|
const currentColumnOpts = $xeTable.computeCurrentColumnOpts
|
|
7000
7366
|
const { actived, focused } = editStore
|
|
7001
7367
|
const { row, column } = params
|
|
7002
|
-
const { type, treeNode } = column
|
|
7368
|
+
const { type, treeNode, rowGroupNode } = column
|
|
7003
7369
|
const isRadioType = type === 'radio'
|
|
7004
7370
|
const isCheckboxType = type === 'checkbox'
|
|
7005
7371
|
const isExpandType = type === 'expand'
|
|
7006
7372
|
const cell = evnt.currentTarget as HTMLDivElement
|
|
7007
7373
|
const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag
|
|
7008
7374
|
const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag
|
|
7009
|
-
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree
|
|
7375
|
+
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag
|
|
7010
7376
|
const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag
|
|
7377
|
+
const triggerRowGroupNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-row-group--node-btn').flag
|
|
7011
7378
|
params = Object.assign({ cell, triggerRadio, triggerCheckbox, triggerTreeNode, triggerExpandNode }, params)
|
|
7012
7379
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7013
7380
|
// 如果是展开行
|
|
@@ -7018,11 +7385,15 @@ const Methods = {
|
|
|
7018
7385
|
if ((treeOpts.trigger === 'row' || (treeNode && treeOpts.trigger === 'cell'))) {
|
|
7019
7386
|
$xeTable.triggerTreeExpandEvent(evnt, params)
|
|
7020
7387
|
}
|
|
7388
|
+
// 如果是行分组
|
|
7389
|
+
if ((rowGroupOpts.trigger === 'row' || (rowGroupNode && rowGroupOpts.trigger === 'cell'))) {
|
|
7390
|
+
$xeTable.triggerRowGroupExpandEvent(evnt, params)
|
|
7391
|
+
}
|
|
7021
7392
|
}
|
|
7022
7393
|
// 如果点击了树节点
|
|
7023
7394
|
if (!triggerTreeNode) {
|
|
7024
|
-
if (!triggerExpandNode) {
|
|
7025
|
-
//
|
|
7395
|
+
if (!triggerExpandNode && !triggerRowGroupNode) {
|
|
7396
|
+
// 如果是当前行
|
|
7026
7397
|
if (rowOpts.isCurrent || highlightCurrentRow) {
|
|
7027
7398
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7028
7399
|
$xeTable.triggerCurrentRowEvent(evnt, params)
|
|
@@ -7238,7 +7609,7 @@ const Methods = {
|
|
|
7238
7609
|
const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input'
|
|
7239
7610
|
const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag
|
|
7240
7611
|
const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag
|
|
7241
|
-
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree
|
|
7612
|
+
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag
|
|
7242
7613
|
const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag
|
|
7243
7614
|
let isColDragCell = false
|
|
7244
7615
|
if (rowOpts.drag) {
|
|
@@ -7526,7 +7897,7 @@ const Methods = {
|
|
|
7526
7897
|
evnt.preventDefault()
|
|
7527
7898
|
return
|
|
7528
7899
|
}
|
|
7529
|
-
const
|
|
7900
|
+
const isControlKey = hasControlKey(evnt)
|
|
7530
7901
|
const trEl = evnt.currentTarget as HTMLElement
|
|
7531
7902
|
const rowid = trEl.getAttribute('rowid') || ''
|
|
7532
7903
|
const rest = fullAllDataRowIdData[rowid]
|
|
@@ -7538,11 +7909,11 @@ const Methods = {
|
|
|
7538
7909
|
const { dragRow } = reactData
|
|
7539
7910
|
const offsetY = evnt.clientY - trEl.getBoundingClientRect().y
|
|
7540
7911
|
const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom'
|
|
7541
|
-
internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag &&
|
|
7912
|
+
internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && isControlKey)
|
|
7542
7913
|
internalData.prevDragRow = row
|
|
7543
7914
|
internalData.prevDragPos = dragPos
|
|
7544
7915
|
if ($xeTable.eqRow(dragRow, row) ||
|
|
7545
|
-
(
|
|
7916
|
+
(isControlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded) ||
|
|
7546
7917
|
(!isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level))
|
|
7547
7918
|
) {
|
|
7548
7919
|
showDropTip($xeTable, evnt, trEl, null, false, dragPos)
|
|
@@ -7823,7 +8194,7 @@ const Methods = {
|
|
|
7823
8194
|
evnt.preventDefault()
|
|
7824
8195
|
return
|
|
7825
8196
|
}
|
|
7826
|
-
const
|
|
8197
|
+
const isControlKey = hasControlKey(evnt)
|
|
7827
8198
|
const thEl = evnt.currentTarget as HTMLElement
|
|
7828
8199
|
const colid = thEl.getAttribute('colid')
|
|
7829
8200
|
const column = $xeTable.getColumnById(colid)
|
|
@@ -7832,7 +8203,7 @@ const Methods = {
|
|
|
7832
8203
|
const { clientX } = evnt
|
|
7833
8204
|
const offsetX = clientX - thEl.getBoundingClientRect().x
|
|
7834
8205
|
const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right'
|
|
7835
|
-
internalData.prevDragToChild = !!((isCrossDrag && isToChildDrag) &&
|
|
8206
|
+
internalData.prevDragToChild = !!((isCrossDrag && isToChildDrag) && isControlKey)
|
|
7836
8207
|
internalData.prevDragCol = column
|
|
7837
8208
|
internalData.prevDragPos = dragPos
|
|
7838
8209
|
if (column.fixed ||
|
|
@@ -8249,7 +8620,7 @@ const Methods = {
|
|
|
8249
8620
|
const reactData = $xeTable as unknown as TableReactData
|
|
8250
8621
|
const internalData = $xeTable as unknown as TableInternalData
|
|
8251
8622
|
|
|
8252
|
-
const { expandColumn
|
|
8623
|
+
const { expandColumn } = reactData
|
|
8253
8624
|
const { rowExpandLazyLoadedMaps } = internalData
|
|
8254
8625
|
const expandOpts = $xeTable.computeExpandOpts
|
|
8255
8626
|
const { row } = params
|
|
@@ -8261,12 +8632,12 @@ const Methods = {
|
|
|
8261
8632
|
const rowid = getRowid($xeTable, row)
|
|
8262
8633
|
if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
|
|
8263
8634
|
const expanded = !$xeTable.isRowExpandByRow(row)
|
|
8264
|
-
const columnIndex = $xeTable.getColumnIndex(
|
|
8265
|
-
const $columnIndex = $xeTable.getVMColumnIndex(
|
|
8635
|
+
const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1
|
|
8636
|
+
const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1
|
|
8266
8637
|
$xeTable.setRowExpand(row, expanded)
|
|
8267
8638
|
$xeTable.dispatchEvent('toggle-row-expand', {
|
|
8268
8639
|
expanded,
|
|
8269
|
-
column,
|
|
8640
|
+
column: expandColumn,
|
|
8270
8641
|
columnIndex,
|
|
8271
8642
|
$columnIndex,
|
|
8272
8643
|
row,
|
|
@@ -8316,8 +8687,8 @@ const Methods = {
|
|
|
8316
8687
|
const expandOpts = $xeTable.computeExpandOpts
|
|
8317
8688
|
const { reserve, lazy, accordion, toggleMethod } = expandOpts
|
|
8318
8689
|
const lazyRests: any[] = []
|
|
8319
|
-
const columnIndex = $xeTable.getColumnIndex(expandColumn)
|
|
8320
|
-
const $columnIndex = $xeTable.getVMColumnIndex(expandColumn)
|
|
8690
|
+
const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1
|
|
8691
|
+
const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1
|
|
8321
8692
|
if (rows) {
|
|
8322
8693
|
if (!XEUtils.isArray(rows)) {
|
|
8323
8694
|
rows = [rows]
|
|
@@ -8328,7 +8699,7 @@ const Methods = {
|
|
|
8328
8699
|
internalData.rowExpandedMaps = rowExpandedMaps
|
|
8329
8700
|
rows = rows.slice(rows.length - 1, rows.length)
|
|
8330
8701
|
}
|
|
8331
|
-
const validRows: any[] = toggleMethod ? rows.filter((row: any) => toggleMethod({ $table: $xeTable, expanded, column: expandColumn, columnIndex, $columnIndex, row, rowIndex: $xeTable.getRowIndex(row), $rowIndex: $xeTable.getVMRowIndex(row) })) : rows
|
|
8702
|
+
const validRows: any[] = toggleMethod ? rows.filter((row: any) => toggleMethod({ $table: $xeTable, expanded, column: expandColumn as VxeTableDefines.ColumnInfo, columnIndex, $columnIndex, row, rowIndex: $xeTable.getRowIndex(row), $rowIndex: $xeTable.getVMRowIndex(row) })) : rows
|
|
8332
8703
|
if (expanded) {
|
|
8333
8704
|
validRows.forEach((row: any) => {
|
|
8334
8705
|
const rowid = handleGetRowId(row)
|
|
@@ -8430,6 +8801,95 @@ const Methods = {
|
|
|
8430
8801
|
})
|
|
8431
8802
|
return rest
|
|
8432
8803
|
},
|
|
8804
|
+
setRowGroups (fieldOrColumns: (VxeColumnPropTypes.Field | VxeTableDefines.ColumnInfo)[] | VxeColumnPropTypes.Field | VxeTableDefines.ColumnInfo | null) {
|
|
8805
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8806
|
+
const props = $xeTable
|
|
8807
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8808
|
+
|
|
8809
|
+
const { rowGroupConfig } = props
|
|
8810
|
+
if (!rowGroupConfig) {
|
|
8811
|
+
errLog('vxe.error.reqProp', ['row-group-config'])
|
|
8812
|
+
return $xeTable.$nextTick()
|
|
8813
|
+
}
|
|
8814
|
+
if (fieldOrColumns) {
|
|
8815
|
+
handleUpdateRowGroup($xeTable, (XEUtils.isArray(fieldOrColumns) ? fieldOrColumns : [fieldOrColumns]).map(fieldOrColumn => {
|
|
8816
|
+
return XEUtils.isString(fieldOrColumn) ? fieldOrColumn : fieldOrColumn.field
|
|
8817
|
+
}))
|
|
8818
|
+
return loadTableData($xeTable, internalData.tableSynchData, true)
|
|
8819
|
+
}
|
|
8820
|
+
return $xeTable.$nextTick()
|
|
8821
|
+
},
|
|
8822
|
+
clearRowGroups () {
|
|
8823
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8824
|
+
const props = $xeTable
|
|
8825
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8826
|
+
|
|
8827
|
+
const { rowGroupConfig } = props
|
|
8828
|
+
if (!rowGroupConfig) {
|
|
8829
|
+
errLog('vxe.error.reqProp', ['row-group-config'])
|
|
8830
|
+
return $xeTable.$nextTick()
|
|
8831
|
+
}
|
|
8832
|
+
handleUpdateRowGroup($xeTable, [])
|
|
8833
|
+
return loadTableData($xeTable, internalData.tableSynchData, true)
|
|
8834
|
+
},
|
|
8835
|
+
isRowGroupRecord (row: any) {
|
|
8836
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8837
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8838
|
+
|
|
8839
|
+
const { isRowGroupStatus } = reactData
|
|
8840
|
+
return isRowGroupStatus && row.isAggregate
|
|
8841
|
+
},
|
|
8842
|
+
isRowGroupExpandByRow (row: any) {
|
|
8843
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8844
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8845
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8846
|
+
|
|
8847
|
+
const { rowGroupExpandedFlag } = reactData
|
|
8848
|
+
const { rowGroupExpandedMaps } = internalData
|
|
8849
|
+
return !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[getRowid($xeTable, row)]
|
|
8850
|
+
},
|
|
8851
|
+
setRowGroupExpand (rows: any, expanded: boolean) {
|
|
8852
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8853
|
+
|
|
8854
|
+
if (rows) {
|
|
8855
|
+
if (!XEUtils.isArray(rows)) {
|
|
8856
|
+
rows = [rows]
|
|
8857
|
+
}
|
|
8858
|
+
return handleRowGroupVirtualExpand($xeTable, rows, expanded)
|
|
8859
|
+
}
|
|
8860
|
+
return $xeTable.$nextTick()
|
|
8861
|
+
},
|
|
8862
|
+
setAllRowGroupExpand (expanded: boolean) {
|
|
8863
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8864
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8865
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8866
|
+
|
|
8867
|
+
const { tableFullGroupData } = internalData
|
|
8868
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
8869
|
+
const { mapChildrenField } = rowGroupOpts
|
|
8870
|
+
const rgExpandedMaps: Record<string, any> = {}
|
|
8871
|
+
if (expanded && mapChildrenField) {
|
|
8872
|
+
XEUtils.eachTree(tableFullGroupData, (row) => {
|
|
8873
|
+
if (row[mapChildrenField] && row[mapChildrenField].length) {
|
|
8874
|
+
rgExpandedMaps[getRowid($xeTable, row)] = row
|
|
8875
|
+
}
|
|
8876
|
+
}, { children: mapChildrenField })
|
|
8877
|
+
}
|
|
8878
|
+
internalData.rowGroupExpandedMaps = rgExpandedMaps
|
|
8879
|
+
handleVirtualTreeToList($xeTable)
|
|
8880
|
+
reactData.rowGroupExpandedFlag++
|
|
8881
|
+
return $xeTable.handleTableData()
|
|
8882
|
+
},
|
|
8883
|
+
clearRowGroupExpand () {
|
|
8884
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8885
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8886
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8887
|
+
|
|
8888
|
+
internalData.rowGroupExpandedMaps = {}
|
|
8889
|
+
handleVirtualTreeToList($xeTable)
|
|
8890
|
+
reactData.rowGroupExpandedFlag++
|
|
8891
|
+
return $xeTable.handleTableData()
|
|
8892
|
+
},
|
|
8433
8893
|
getTreeExpandRecords () {
|
|
8434
8894
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8435
8895
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -8493,11 +8953,11 @@ const Methods = {
|
|
|
8493
8953
|
})
|
|
8494
8954
|
}
|
|
8495
8955
|
internalData.treeExpandedMaps = {}
|
|
8496
|
-
reactData.treeExpandedFlag++
|
|
8497
8956
|
if (transform) {
|
|
8498
8957
|
handleVirtualTreeToList($xeTable)
|
|
8499
|
-
|
|
8958
|
+
$xeTable.handleTableData()
|
|
8500
8959
|
}
|
|
8960
|
+
reactData.treeExpandedFlag++
|
|
8501
8961
|
return $xeTable.$nextTick()
|
|
8502
8962
|
},
|
|
8503
8963
|
/**
|
|
@@ -8506,6 +8966,7 @@ const Methods = {
|
|
|
8506
8966
|
*/
|
|
8507
8967
|
reloadTreeExpand (row: any) {
|
|
8508
8968
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8969
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8509
8970
|
const internalData = $xeTable as unknown as TableInternalData
|
|
8510
8971
|
|
|
8511
8972
|
const { treeExpandLazyLoadedMaps } = internalData
|
|
@@ -8519,8 +8980,9 @@ const Methods = {
|
|
|
8519
8980
|
}).then(() => {
|
|
8520
8981
|
if (transform) {
|
|
8521
8982
|
handleVirtualTreeToList($xeTable)
|
|
8522
|
-
|
|
8983
|
+
$xeTable.handleTableData()
|
|
8523
8984
|
}
|
|
8985
|
+
reactData.treeExpandedFlag++
|
|
8524
8986
|
}).then(() => {
|
|
8525
8987
|
return $xeTable.recalculate()
|
|
8526
8988
|
})
|
|
@@ -8536,10 +8998,32 @@ const Methods = {
|
|
|
8536
8998
|
// 即将废弃
|
|
8537
8999
|
return $xeTable.reloadTreeExpand(row)
|
|
8538
9000
|
},
|
|
9001
|
+
/**
|
|
9002
|
+
* 行分组事件
|
|
9003
|
+
*/
|
|
9004
|
+
triggerRowGroupExpandEvent (evnt: any, params: VxeTableDefines.CellRenderBodyParams) {
|
|
9005
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9006
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9007
|
+
|
|
9008
|
+
const { rowGroupExpandedMaps } = internalData
|
|
9009
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
9010
|
+
const { row, column } = params
|
|
9011
|
+
const { trigger } = rowGroupOpts
|
|
9012
|
+
if (trigger === 'manual') {
|
|
9013
|
+
return
|
|
9014
|
+
}
|
|
9015
|
+
evnt.stopPropagation()
|
|
9016
|
+
const rowid = getRowid($xeTable, row)
|
|
9017
|
+
const expanded = !rowGroupExpandedMaps[rowid]
|
|
9018
|
+
const columnIndex = $xeTable.getColumnIndex(column)
|
|
9019
|
+
const $columnIndex = $xeTable.getVMColumnIndex(column)
|
|
9020
|
+
$xeTable.setRowGroupExpand(row, expanded)
|
|
9021
|
+
$xeTable.dispatchEvent('toggle-row-group-expand', { expanded, column, columnIndex, $columnIndex, row }, evnt)
|
|
9022
|
+
},
|
|
8539
9023
|
/**
|
|
8540
9024
|
* 展开树节点事件
|
|
8541
9025
|
*/
|
|
8542
|
-
triggerTreeExpandEvent (evnt: any, params:
|
|
9026
|
+
triggerTreeExpandEvent (evnt: any, params: VxeTableDefines.CellRenderBodyParams) {
|
|
8543
9027
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8544
9028
|
const internalData = $xeTable as unknown as TableInternalData
|
|
8545
9029
|
|
|
@@ -8580,18 +9064,29 @@ const Methods = {
|
|
|
8580
9064
|
* 设置所有树节点的展开与否
|
|
8581
9065
|
* @param {Boolean} expanded 是否展开
|
|
8582
9066
|
*/
|
|
8583
|
-
setAllTreeExpand (expanded:
|
|
8584
|
-
const
|
|
8585
|
-
const
|
|
9067
|
+
setAllTreeExpand (expanded: boolean) {
|
|
9068
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9069
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
9070
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9071
|
+
|
|
9072
|
+
const { tableFullData } = internalData
|
|
9073
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
9074
|
+
const { transform, lazy } = treeOpts
|
|
8586
9075
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
8587
9076
|
const expandeds: any[] = []
|
|
8588
|
-
XEUtils.eachTree(tableFullData, (row
|
|
9077
|
+
XEUtils.eachTree(tableFullData, (row) => {
|
|
8589
9078
|
const rowChildren = row[childrenField]
|
|
8590
9079
|
if (lazy || (rowChildren && rowChildren.length)) {
|
|
8591
9080
|
expandeds.push(row)
|
|
8592
9081
|
}
|
|
8593
9082
|
}, { children: childrenField })
|
|
8594
|
-
return
|
|
9083
|
+
return $xeTable.setTreeExpand(expandeds, expanded).then(() => {
|
|
9084
|
+
if (transform) {
|
|
9085
|
+
handleVirtualTreeToList($xeTable)
|
|
9086
|
+
reactData.treeExpandedFlag++
|
|
9087
|
+
return $xeTable.recalculate()
|
|
9088
|
+
}
|
|
9089
|
+
})
|
|
8595
9090
|
},
|
|
8596
9091
|
/**
|
|
8597
9092
|
* 设置展开树形节点,二个参数设置这一行展开与否
|
|
@@ -8647,15 +9142,15 @@ const Methods = {
|
|
|
8647
9142
|
const { transform, reserve } = treeOpts
|
|
8648
9143
|
const expList = $xeTable.getTreeExpandRecords()
|
|
8649
9144
|
internalData.treeExpandedMaps = {}
|
|
8650
|
-
reactData.treeExpandedFlag++
|
|
8651
9145
|
if (reserve) {
|
|
8652
9146
|
XEUtils.eachTree(tableFullTreeData, row => handleTreeExpandReserve($xeTable, row, false), { children: childrenField })
|
|
8653
9147
|
}
|
|
8654
9148
|
return $xeTable.handleTableData().then(() => {
|
|
8655
9149
|
if (transform) {
|
|
8656
9150
|
handleVirtualTreeToList($xeTable)
|
|
8657
|
-
|
|
9151
|
+
$xeTable.handleTableData()
|
|
8658
9152
|
}
|
|
9153
|
+
reactData.treeExpandedFlag++
|
|
8659
9154
|
}).then(() => {
|
|
8660
9155
|
if (expList.length) {
|
|
8661
9156
|
$xeTable.recalculate()
|
|
@@ -9465,21 +9960,30 @@ const Methods = {
|
|
|
9465
9960
|
* @param {Row} row 行对象
|
|
9466
9961
|
*/
|
|
9467
9962
|
scrollToTreeRow (row: any) {
|
|
9468
|
-
const
|
|
9469
|
-
const
|
|
9470
|
-
const
|
|
9471
|
-
|
|
9472
|
-
|
|
9963
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9964
|
+
const props = $xeTable
|
|
9965
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
9966
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9967
|
+
|
|
9968
|
+
const { treeConfig } = props
|
|
9969
|
+
const { isRowGroupStatus } = reactData
|
|
9970
|
+
const { tableFullData } = internalData
|
|
9971
|
+
const rests: Promise<any>[] = []
|
|
9972
|
+
if (treeConfig || isRowGroupStatus) {
|
|
9973
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
9974
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
9975
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
9976
|
+
const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ? rowGroupOpts.mapChildrenField : childrenField })
|
|
9473
9977
|
if (matchObj) {
|
|
9474
9978
|
const nodes = matchObj.nodes
|
|
9475
9979
|
nodes.forEach((row, index) => {
|
|
9476
|
-
if (index < nodes.length - 1 &&
|
|
9477
|
-
rests.push(
|
|
9980
|
+
if (index < nodes.length - 1 && !$xeTable.isTreeExpandByRow(row)) {
|
|
9981
|
+
rests.push($xeTable.setTreeExpand(row, true))
|
|
9478
9982
|
}
|
|
9479
9983
|
})
|
|
9480
9984
|
}
|
|
9481
9985
|
}
|
|
9482
|
-
return Promise.all(rests).then(() => rowToVisible(
|
|
9986
|
+
return Promise.all(rests).then(() => rowToVisible($xeTable, row))
|
|
9483
9987
|
},
|
|
9484
9988
|
/**
|
|
9485
9989
|
* 手动清除滚动相关信息,还原到初始状态
|