vxe-table 3.15.5 → 3.15.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +977 -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 +1729 -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 +1158 -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 +1010 -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.1745197894601.ttf} +0 -0
- /package/es/{iconfont.1744880837792.woff → iconfont.1745197894601.woff} +0 -0
- /package/es/{iconfont.1744880837792.woff2 → iconfont.1745197894601.woff2} +0 -0
- /package/lib/{iconfont.1744880837792.ttf → iconfont.1745197894601.ttf} +0 -0
- /package/lib/{iconfont.1744880837792.woff → iconfont.1745197894601.woff} +0 -0
- /package/lib/{iconfont.1744880837792.woff2 → iconfont.1745197894601.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) {
|
|
1358
|
+
if (checked) {
|
|
1359
|
+
/**
|
|
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) {
|
|
1022
1384
|
if (checked) {
|
|
1023
1385
|
/**
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
XEUtils.eachTree(
|
|
1028
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
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,264 @@ 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.insertRowMaps = {}
|
|
2724
|
+
internalData.removeRowMaps = {}
|
|
2725
|
+
const sYLoad = updateScrollYStatus($xeTable, fullData)
|
|
2726
|
+
reactData.isDragColMove = false
|
|
2727
|
+
reactData.isDragRowMove = false
|
|
2728
|
+
// 全量数据
|
|
2729
|
+
internalData.tableFullData = fullData
|
|
2730
|
+
internalData.tableFullTreeData = isRGroup ? [] : treeData
|
|
2731
|
+
internalData.tableFullGroupData = isRGroup ? treeData : []
|
|
2732
|
+
// 缓存数据
|
|
2733
|
+
$xeTable.cacheRowMap(isReset)
|
|
2734
|
+
// 原始数据
|
|
2735
|
+
internalData.tableSynchData = datas
|
|
2736
|
+
if (isReset) {
|
|
2737
|
+
internalData.isResizeCellHeight = false
|
|
2738
|
+
}
|
|
2739
|
+
// 克隆原数据,用于显示编辑状态,与编辑值做对比
|
|
2740
|
+
if (keepSource) {
|
|
2741
|
+
$xeTable.cacheSourceMap(fullData)
|
|
2742
|
+
}
|
|
2743
|
+
if ($xeTable.clearCellAreas && props.mouseConfig) {
|
|
2744
|
+
$xeTable.clearCellAreas()
|
|
2745
|
+
$xeTable.clearCopyCellArea()
|
|
2746
|
+
}
|
|
2747
|
+
$xeTable.clearMergeCells()
|
|
2748
|
+
$xeTable.clearMergeFooterItems()
|
|
2749
|
+
$xeTable.handleTableData(true)
|
|
2750
|
+
$xeTable.updateFooter()
|
|
2751
|
+
$xeTable.handleUpdateBodyMerge()
|
|
2752
|
+
return $xeTable.$nextTick().then(() => {
|
|
2753
|
+
updateHeight($xeTable)
|
|
2754
|
+
updateStyle($xeTable)
|
|
2755
|
+
}).then(() => {
|
|
2756
|
+
computeScrollLoad($xeTable)
|
|
2757
|
+
}).then(() => {
|
|
2758
|
+
// 是否启用了虚拟滚动
|
|
2759
|
+
if (sYLoad) {
|
|
2760
|
+
scrollYStore.endIndex = scrollYStore.visibleSize
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
if (sYLoad) {
|
|
2764
|
+
if (reactData.expandColumn && expandOpts.mode !== 'fixed') {
|
|
2765
|
+
errLog('vxe.error.notConflictProp', ['column.type="expand', 'expand-config.mode="fixed"'])
|
|
2766
|
+
}
|
|
2767
|
+
// if (showOverflow) {
|
|
2768
|
+
// if (!rowOpts.height) {
|
|
2769
|
+
// const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
|
|
2770
|
+
// if (errColumn) {
|
|
2771
|
+
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
2772
|
+
// }
|
|
2773
|
+
// }
|
|
2774
|
+
// }
|
|
2775
|
+
|
|
2776
|
+
if (!(props.height || props.maxHeight)) {
|
|
2777
|
+
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}'])
|
|
2778
|
+
}
|
|
2779
|
+
// if (!props.showOverflow) {
|
|
2780
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2781
|
+
// }
|
|
2782
|
+
if (props.spanMethod) {
|
|
2783
|
+
errLog('vxe.error.scrollErrProp', ['table.span-method'])
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
handleReserveStatus($xeTable)
|
|
2788
|
+
$xeTable.checkSelectionStatus()
|
|
2789
|
+
return new Promise<void>(resolve => {
|
|
2790
|
+
$xeTable.$nextTick()
|
|
2791
|
+
.then(() => handleRecalculateLayout($xeTable, false))
|
|
2792
|
+
.then(() => {
|
|
2793
|
+
calcCellHeight($xeTable)
|
|
2794
|
+
updateRowOffsetTop($xeTable)
|
|
2795
|
+
return handleRecalculateLayout($xeTable, false)
|
|
2796
|
+
})
|
|
2797
|
+
.then(() => {
|
|
2798
|
+
let targetScrollLeft = lastScrollLeft
|
|
2799
|
+
let targetScrollTop = lastScrollTop
|
|
2800
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts
|
|
2801
|
+
const virtualYOpts = $xeTable.computeVirtualYOpts
|
|
2802
|
+
// 是否在更新数据之后自动滚动重置滚动条
|
|
2803
|
+
if (virtualXOpts.scrollToLeftOnChange) {
|
|
2804
|
+
targetScrollLeft = 0
|
|
2805
|
+
}
|
|
2806
|
+
if (virtualYOpts.scrollToTopOnChange) {
|
|
2807
|
+
targetScrollTop = 0
|
|
2808
|
+
}
|
|
2809
|
+
reactData.isRowLoading = false
|
|
2810
|
+
handleRecalculateLayout($xeTable, false)
|
|
2811
|
+
// 是否变更虚拟滚动
|
|
2812
|
+
if (oldScrollYLoad === sYLoad) {
|
|
2813
|
+
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
2814
|
+
.then(() => {
|
|
2815
|
+
resolve()
|
|
2816
|
+
})
|
|
2817
|
+
} else {
|
|
2818
|
+
setTimeout(() => {
|
|
2819
|
+
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
2820
|
+
.then(() => {
|
|
2821
|
+
resolve()
|
|
2822
|
+
})
|
|
2823
|
+
})
|
|
2824
|
+
}
|
|
2825
|
+
})
|
|
2826
|
+
})
|
|
2827
|
+
})
|
|
2828
|
+
}
|
|
2829
|
+
|
|
2206
2830
|
/**
|
|
2207
2831
|
* 处理数据加载默认行为
|
|
2208
2832
|
* 默认执行一次,除非被重置
|
|
@@ -2906,16 +3530,25 @@ const Methods = {
|
|
|
2906
3530
|
clearAll () {
|
|
2907
3531
|
return clearTableAllStatus(this)
|
|
2908
3532
|
},
|
|
3533
|
+
handleUpdateRowGroup (groupFields: any[]) {
|
|
3534
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3535
|
+
|
|
3536
|
+
handleUpdateRowGroup($xeTable, groupFields)
|
|
3537
|
+
},
|
|
2909
3538
|
/**
|
|
2910
3539
|
* 同步 data 数据(即将废弃)
|
|
2911
3540
|
* 如果用了该方法,那么组件将不再记录增删改的状态,只能自行实现对应逻辑
|
|
2912
3541
|
* 对于某些特殊的场景,比如深层树节点元素发生变动时可能会用到
|
|
2913
3542
|
*/
|
|
2914
3543
|
syncData () {
|
|
3544
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3545
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
3546
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3547
|
+
|
|
2915
3548
|
errLog('vxe.error.delFunc', ['syncData', 'getData'])
|
|
2916
|
-
return
|
|
2917
|
-
|
|
2918
|
-
return
|
|
3549
|
+
return $xeTable.$nextTick().then(() => {
|
|
3550
|
+
reactData.tableData = []
|
|
3551
|
+
return $xeTable.$nextTick().then(() => loadTableData($xeTable, internalData.tableFullData, true))
|
|
2919
3552
|
})
|
|
2920
3553
|
},
|
|
2921
3554
|
/**
|
|
@@ -2942,205 +3575,47 @@ const Methods = {
|
|
|
2942
3575
|
$xeTable.updateCellAreas()
|
|
2943
3576
|
return $xeTable.recalculate(true)
|
|
2944
3577
|
}).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
|
-
// }
|
|
3578
|
+
// 存在滚动行为未结束情况
|
|
3579
|
+
setTimeout(() => $xeTable.recalculate(), 50)
|
|
3580
|
+
})
|
|
3581
|
+
},
|
|
3582
|
+
handleTableData (force: any) {
|
|
3583
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3584
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
3585
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3091
3586
|
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3587
|
+
const { scrollYLoad } = reactData
|
|
3588
|
+
const { scrollYStore, fullDataRowIdData } = internalData
|
|
3589
|
+
let fullList: any[] = internalData.afterFullData
|
|
3590
|
+
// 是否进行数据处理
|
|
3591
|
+
if (force) {
|
|
3592
|
+
// 更新数据,处理筛选和排序
|
|
3593
|
+
updateAfterFullData($xeTable)
|
|
3594
|
+
// 如果为虚拟树,将树结构拍平
|
|
3595
|
+
fullList = handleVirtualTreeToList($xeTable)
|
|
3596
|
+
}
|
|
3597
|
+
const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0)
|
|
3598
|
+
const visibleDataRowIdMaps: Record<string, any> = {}
|
|
3599
|
+
tableData.forEach((row, $index) => {
|
|
3600
|
+
const rowid = getRowid($xeTable, row)
|
|
3601
|
+
const rest = fullDataRowIdData[rowid]
|
|
3602
|
+
if (rest) {
|
|
3603
|
+
rest.$index = $index
|
|
3101
3604
|
}
|
|
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
|
-
})
|
|
3605
|
+
visibleDataRowIdMaps[rowid] = row
|
|
3143
3606
|
})
|
|
3607
|
+
reactData.tableData = tableData
|
|
3608
|
+
internalData.visibleDataRowIdData = visibleDataRowIdMaps
|
|
3609
|
+
return $xeTable.$nextTick()
|
|
3610
|
+
},
|
|
3611
|
+
/**
|
|
3612
|
+
* 加载表格数据
|
|
3613
|
+
* @param {Array} datas 数据
|
|
3614
|
+
*/
|
|
3615
|
+
loadTableData (datas: any[], isReset: boolean) {
|
|
3616
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3617
|
+
|
|
3618
|
+
return loadTableData($xeTable, datas, isReset)
|
|
3144
3619
|
},
|
|
3145
3620
|
/**
|
|
3146
3621
|
* 重新加载数据,不会清空表格状态
|
|
@@ -3150,7 +3625,7 @@ const Methods = {
|
|
|
3150
3625
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3151
3626
|
|
|
3152
3627
|
const { initStatus } = this
|
|
3153
|
-
return
|
|
3628
|
+
return loadTableData($xeTable, datas, false).then(() => {
|
|
3154
3629
|
this.inited = true
|
|
3155
3630
|
this.initStatus = true
|
|
3156
3631
|
if (!initStatus) {
|
|
@@ -3170,7 +3645,7 @@ const Methods = {
|
|
|
3170
3645
|
.then(() => {
|
|
3171
3646
|
this.inited = true
|
|
3172
3647
|
this.initStatus = true
|
|
3173
|
-
return
|
|
3648
|
+
return loadTableData($xeTable, datas, true)
|
|
3174
3649
|
})
|
|
3175
3650
|
.then(() => {
|
|
3176
3651
|
handleLoadDefaults($xeTable)
|
|
@@ -3256,11 +3731,8 @@ const Methods = {
|
|
|
3256
3731
|
const internalData = $xeTable as unknown as TableInternalData
|
|
3257
3732
|
|
|
3258
3733
|
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
|
|
3734
|
+
const { isRowGroupStatus } = reactData
|
|
3735
|
+
const { fullAllDataRowIdData, tableFullData, tableFullTreeData, tableFullGroupData, treeExpandedMaps } = internalData
|
|
3264
3736
|
const fullAllDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = isReset ? {} : { ...fullAllDataRowIdData } // 存在已删除数据
|
|
3265
3737
|
const fullDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = {}
|
|
3266
3738
|
|
|
@@ -3285,6 +3757,10 @@ const Methods = {
|
|
|
3285
3757
|
}
|
|
3286
3758
|
|
|
3287
3759
|
if (treeConfig) {
|
|
3760
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
3761
|
+
const { lazy } = treeOpts
|
|
3762
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
3763
|
+
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
3288
3764
|
XEUtils.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
|
|
3289
3765
|
const rowid = handleUpdateRowId(row)
|
|
3290
3766
|
if (treeConfig && lazy) {
|
|
@@ -3299,6 +3775,13 @@ const Methods = {
|
|
|
3299
3775
|
}
|
|
3300
3776
|
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
|
|
3301
3777
|
}, { children: childrenField })
|
|
3778
|
+
} else if (isRowGroupStatus) {
|
|
3779
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
3780
|
+
const { mapChildrenField } = rowGroupOpts
|
|
3781
|
+
XEUtils.eachTree(tableFullGroupData, (row, index, items, path, parentRow, nodes) => {
|
|
3782
|
+
const rowid = handleUpdateRowId(row)
|
|
3783
|
+
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
|
|
3784
|
+
}, { children: mapChildrenField })
|
|
3302
3785
|
} else {
|
|
3303
3786
|
tableFullData.forEach((row, index, items) => {
|
|
3304
3787
|
handleRowCache(row, index, items, index, null, handleUpdateRowId(row), 0, index + 1)
|
|
@@ -4061,173 +4544,6 @@ const Methods = {
|
|
|
4061
4544
|
}
|
|
4062
4545
|
return rowList
|
|
4063
4546
|
},
|
|
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
4547
|
/**
|
|
4232
4548
|
* 预编译
|
|
4233
4549
|
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
@@ -4592,7 +4908,7 @@ const Methods = {
|
|
|
4592
4908
|
const storeData = getCustomStorageMap(tableId)
|
|
4593
4909
|
if (restoreStore) {
|
|
4594
4910
|
return Promise.resolve(
|
|
4595
|
-
restoreStore({ id: tableId, type: 'restore', storeData })
|
|
4911
|
+
restoreStore({ $table: $xeTable, id: tableId, type: 'restore', storeData })
|
|
4596
4912
|
).then(storeData => {
|
|
4597
4913
|
if (!storeData) {
|
|
4598
4914
|
return
|
|
@@ -4658,7 +4974,7 @@ const Methods = {
|
|
|
4658
4974
|
hasResizable = 1
|
|
4659
4975
|
resizableData[colKey] = column.renderWidth
|
|
4660
4976
|
}
|
|
4661
|
-
if (isCustomVisible && (!checkMethod || checkMethod({ column }))) {
|
|
4977
|
+
if (isCustomVisible && (!checkMethod || checkMethod({ $table: $xeTable, column }))) {
|
|
4662
4978
|
if (!column.visible && column.defaultVisible) {
|
|
4663
4979
|
hasVisible = 1
|
|
4664
4980
|
visibleData[colKey] = false
|
|
@@ -4715,6 +5031,7 @@ const Methods = {
|
|
|
4715
5031
|
: this.getCustomStoreData()
|
|
4716
5032
|
if (updateStore) {
|
|
4717
5033
|
return updateStore({
|
|
5034
|
+
$table: $xeTable,
|
|
4718
5035
|
id: tableId,
|
|
4719
5036
|
type,
|
|
4720
5037
|
storeData
|
|
@@ -5598,8 +5915,7 @@ const Methods = {
|
|
|
5598
5915
|
const hasDeleteKey = keyCode === 46
|
|
5599
5916
|
const isF2 = keyCode === 113
|
|
5600
5917
|
const isContextMenu = keyCode === 93
|
|
5601
|
-
const
|
|
5602
|
-
const hasCtrlKey = evnt.ctrlKey
|
|
5918
|
+
const isControlKey = hasControlKey(evnt)
|
|
5603
5919
|
const hasShiftKey = evnt.shiftKey
|
|
5604
5920
|
const hasAltKey = evnt.altKey
|
|
5605
5921
|
const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow
|
|
@@ -5661,7 +5977,7 @@ const Methods = {
|
|
|
5661
5977
|
} else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
|
|
5662
5978
|
const { isLastEnterAppendRow, beforeEnterMethod, enterMethod } = keyboardOpts
|
|
5663
5979
|
// 退出选中
|
|
5664
|
-
if (
|
|
5980
|
+
if (isControlKey) {
|
|
5665
5981
|
// 如果是激活编辑状态,则取消编辑
|
|
5666
5982
|
if (actived.row) {
|
|
5667
5983
|
const params = actived.args
|
|
@@ -5827,7 +6143,7 @@ const Methods = {
|
|
|
5827
6143
|
.then(() => $xeTable.scrollToRow(parentRow))
|
|
5828
6144
|
.then(() => $xeTable.triggerCurrentRowEvent(evnt, params))
|
|
5829
6145
|
}
|
|
5830
|
-
} else if (keyboardConfig && keyboardOpts.isEdit && !
|
|
6146
|
+
} 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
6147
|
const { editMethod } = keyboardOpts
|
|
5832
6148
|
// 启用编辑后,空格键功能将失效
|
|
5833
6149
|
// if (isSpacebar) {
|
|
@@ -6205,7 +6521,9 @@ const Methods = {
|
|
|
6205
6521
|
const internalData = $xeTable as unknown as TableInternalData
|
|
6206
6522
|
|
|
6207
6523
|
const { treeConfig } = props
|
|
6524
|
+
const { isRowGroupStatus } = reactData
|
|
6208
6525
|
const { selectCheckboxMaps } = internalData
|
|
6526
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
6209
6527
|
const treeOpts = $xeTable.computeTreeOpts
|
|
6210
6528
|
const { transform, mapChildrenField } = treeOpts
|
|
6211
6529
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -6216,10 +6534,10 @@ const Methods = {
|
|
|
6216
6534
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
|
|
6217
6535
|
if (checkField) {
|
|
6218
6536
|
// 树结构
|
|
6219
|
-
if (treeConfig && !checkStrictly) {
|
|
6537
|
+
if ((treeConfig || isRowGroupStatus) && !checkStrictly) {
|
|
6220
6538
|
// 更新子节点状态
|
|
6221
6539
|
XEUtils.eachTree(rows, (row) => {
|
|
6222
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
6540
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
6223
6541
|
XEUtils.set(row, checkField, checked)
|
|
6224
6542
|
if (indeterminateField) {
|
|
6225
6543
|
XEUtils.set(row, indeterminateField, false)
|
|
@@ -6232,7 +6550,7 @@ const Methods = {
|
|
|
6232
6550
|
}
|
|
6233
6551
|
// 列表
|
|
6234
6552
|
rows.forEach(row => {
|
|
6235
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
6553
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
6236
6554
|
XEUtils.set(row, checkField, checked)
|
|
6237
6555
|
handleCheckboxReserveRow($xeTable, row, checked)
|
|
6238
6556
|
}
|
|
@@ -6242,29 +6560,48 @@ const Methods = {
|
|
|
6242
6560
|
}
|
|
6243
6561
|
|
|
6244
6562
|
// 树结构
|
|
6245
|
-
if (
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
if (
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6563
|
+
if (!checkStrictly) {
|
|
6564
|
+
if (isRowGroupStatus) {
|
|
6565
|
+
// 更新行分组节点状态
|
|
6566
|
+
XEUtils.eachTree(rows, (row) => {
|
|
6567
|
+
const rowid = handleGetRowId(row)
|
|
6568
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
6569
|
+
if (checked) {
|
|
6570
|
+
selectCheckboxMaps[rowid] = row
|
|
6571
|
+
} else {
|
|
6572
|
+
if (selectCheckboxMaps[rowid]) {
|
|
6573
|
+
delete selectCheckboxMaps[rowid]
|
|
6574
|
+
}
|
|
6255
6575
|
}
|
|
6576
|
+
handleCheckboxReserveRow($xeTable, row, checked)
|
|
6256
6577
|
}
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6578
|
+
}, { children: rowGroupOpts.mapChildrenField })
|
|
6579
|
+
reactData.updateCheckboxFlag++
|
|
6580
|
+
return
|
|
6581
|
+
} else if (treeConfig) {
|
|
6582
|
+
// 更新子节点状态
|
|
6583
|
+
XEUtils.eachTree(rows, (row) => {
|
|
6584
|
+
const rowid = handleGetRowId(row)
|
|
6585
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
6586
|
+
if (checked) {
|
|
6587
|
+
selectCheckboxMaps[rowid] = row
|
|
6588
|
+
} else {
|
|
6589
|
+
if (selectCheckboxMaps[rowid]) {
|
|
6590
|
+
delete selectCheckboxMaps[rowid]
|
|
6591
|
+
}
|
|
6592
|
+
}
|
|
6593
|
+
handleCheckboxReserveRow($xeTable, row, checked)
|
|
6594
|
+
}
|
|
6595
|
+
}, { children: transform ? mapChildrenField : childrenField })
|
|
6596
|
+
reactData.updateCheckboxFlag++
|
|
6597
|
+
return
|
|
6598
|
+
}
|
|
6262
6599
|
}
|
|
6263
6600
|
|
|
6264
6601
|
// 列表
|
|
6265
6602
|
rows.forEach(row => {
|
|
6266
6603
|
const rowid = handleGetRowId(row)
|
|
6267
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
6604
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
6268
6605
|
if (checked) {
|
|
6269
6606
|
if (!selectCheckboxMaps[rowid]) {
|
|
6270
6607
|
selectCheckboxMaps[rowid] = row
|
|
@@ -6315,9 +6652,12 @@ const Methods = {
|
|
|
6315
6652
|
triggerCheckRowEvent (evnt: any, params: any, checked: any) {
|
|
6316
6653
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6317
6654
|
const props = $xeTable
|
|
6655
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
6318
6656
|
const internalData = $xeTable as unknown as TableInternalData
|
|
6319
6657
|
|
|
6658
|
+
const { treeConfig } = props
|
|
6320
6659
|
const { row } = params
|
|
6660
|
+
const { isRowGroupStatus } = reactData
|
|
6321
6661
|
const { afterFullData } = internalData
|
|
6322
6662
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
6323
6663
|
const { checkMethod, trigger } = checkboxOpts
|
|
@@ -6325,7 +6665,7 @@ const Methods = {
|
|
|
6325
6665
|
return
|
|
6326
6666
|
}
|
|
6327
6667
|
evnt.stopPropagation()
|
|
6328
|
-
if (checkboxOpts.isShiftKey && evnt.shiftKey && !
|
|
6668
|
+
if (checkboxOpts.isShiftKey && evnt.shiftKey && !(treeConfig || isRowGroupStatus)) {
|
|
6329
6669
|
const checkboxRecords = $xeTable.getCheckboxRecords()
|
|
6330
6670
|
if (checkboxRecords.length) {
|
|
6331
6671
|
const firstRow = checkboxRecords[0]
|
|
@@ -6342,7 +6682,7 @@ const Methods = {
|
|
|
6342
6682
|
}
|
|
6343
6683
|
}
|
|
6344
6684
|
}
|
|
6345
|
-
if (!checkMethod || checkMethod({ row })) {
|
|
6685
|
+
if (!checkMethod || checkMethod({ $table: $xeTable, row })) {
|
|
6346
6686
|
$xeTable.handleBatchSelectRows([row], checked)
|
|
6347
6687
|
$xeTable.checkSelectionStatus()
|
|
6348
6688
|
$xeTable.dispatchEvent('checkbox-change', Object.assign({
|
|
@@ -6384,29 +6724,47 @@ const Methods = {
|
|
|
6384
6724
|
const internalData = $xeTable as unknown as TableInternalData
|
|
6385
6725
|
|
|
6386
6726
|
const { treeConfig } = props
|
|
6387
|
-
const {
|
|
6727
|
+
const { isRowGroupStatus } = reactData
|
|
6728
|
+
const { afterTreeFullData, afterGroupFullData, selectCheckboxMaps, treeIndeterminateRowMaps } = internalData
|
|
6729
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
6388
6730
|
const treeOpts = $xeTable.computeTreeOpts
|
|
6389
|
-
const { transform, mapChildrenField } = treeOpts
|
|
6390
6731
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
6391
6732
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
6392
6733
|
const { checkField, checkStrictly, checkMethod } = checkboxOpts
|
|
6393
|
-
const { afterTreeFullData } = internalData
|
|
6394
6734
|
if (checkStrictly) {
|
|
6395
6735
|
return
|
|
6396
6736
|
}
|
|
6397
|
-
|
|
6398
|
-
if (treeConfig) {
|
|
6737
|
+
if (isRowGroupStatus || treeConfig) {
|
|
6399
6738
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
6400
6739
|
const childRowMaps: Record<string, number> = {}
|
|
6401
6740
|
const childRowList: any[][] = []
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6741
|
+
|
|
6742
|
+
if (isRowGroupStatus) {
|
|
6743
|
+
// 行分组
|
|
6744
|
+
const mapChildrenField = rowGroupOpts.mapChildrenField
|
|
6745
|
+
if (mapChildrenField) {
|
|
6746
|
+
XEUtils.eachTree(afterGroupFullData, (row) => {
|
|
6747
|
+
const rowid = handleGetRowId(row)
|
|
6748
|
+
const childList = row[mapChildrenField]
|
|
6749
|
+
if (childList && childList.length && !childRowMaps[rowid]) {
|
|
6750
|
+
childRowMaps[rowid] = 1
|
|
6751
|
+
childRowList.unshift([row, rowid, childList])
|
|
6752
|
+
}
|
|
6753
|
+
}, { children: mapChildrenField })
|
|
6408
6754
|
}
|
|
6409
|
-
}
|
|
6755
|
+
} else if (treeConfig) {
|
|
6756
|
+
// 树结构
|
|
6757
|
+
const { transform, mapChildrenField } = treeOpts
|
|
6758
|
+
XEUtils.eachTree(afterTreeFullData, (row) => {
|
|
6759
|
+
const rowid = handleGetRowId(row)
|
|
6760
|
+
const childList = row[transform ? mapChildrenField : childrenField]
|
|
6761
|
+
if (childList && childList.length && !childRowMaps[rowid]) {
|
|
6762
|
+
childRowMaps[rowid] = 1
|
|
6763
|
+
childRowList.unshift([row, rowid, childList])
|
|
6764
|
+
}
|
|
6765
|
+
}, { children: transform ? mapChildrenField : childrenField })
|
|
6766
|
+
}
|
|
6767
|
+
|
|
6410
6768
|
childRowList.forEach(vals => {
|
|
6411
6769
|
const row: string = vals[0]
|
|
6412
6770
|
const rowid: string = vals[1]
|
|
@@ -6419,7 +6777,7 @@ const Methods = {
|
|
|
6419
6777
|
? (item) => {
|
|
6420
6778
|
const childRowid = handleGetRowId(item)
|
|
6421
6779
|
const isSelect = checkField ? XEUtils.get(item, checkField) : selectCheckboxMaps[childRowid]
|
|
6422
|
-
if (checkMethod({ row: item })) {
|
|
6780
|
+
if (checkMethod({ $table: $xeTable, row: item })) {
|
|
6423
6781
|
if (isSelect) {
|
|
6424
6782
|
sLen++
|
|
6425
6783
|
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
@@ -6482,7 +6840,8 @@ const Methods = {
|
|
|
6482
6840
|
const internalData = $xeTable as unknown as TableInternalData
|
|
6483
6841
|
|
|
6484
6842
|
const { treeConfig } = props
|
|
6485
|
-
const {
|
|
6843
|
+
const { isRowGroupStatus } = reactData
|
|
6844
|
+
const { afterFullData, afterTreeFullData, afterGroupFullData, checkboxReserveRowMap, selectCheckboxMaps, treeIndeterminateRowMaps } = internalData
|
|
6486
6845
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
6487
6846
|
const { checkField, checkMethod, showReserveStatus } = checkboxOpts
|
|
6488
6847
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
@@ -6491,12 +6850,12 @@ const Methods = {
|
|
|
6491
6850
|
let hLen = 0 // 半选
|
|
6492
6851
|
let vLen = 0 // 有效行
|
|
6493
6852
|
|
|
6494
|
-
const rootList
|
|
6853
|
+
const rootList = (treeConfig ? afterTreeFullData : (isRowGroupStatus ? afterGroupFullData : afterFullData))
|
|
6495
6854
|
rootList.forEach(checkMethod
|
|
6496
6855
|
? row => {
|
|
6497
6856
|
const childRowid = handleGetRowId(row)
|
|
6498
6857
|
const selected = checkField ? XEUtils.get(row, checkField) : selectCheckboxMaps[childRowid]
|
|
6499
|
-
if (checkMethod({ row })) {
|
|
6858
|
+
if (checkMethod({ $table: $xeTable, row })) {
|
|
6500
6859
|
if (selected) {
|
|
6501
6860
|
sLen++
|
|
6502
6861
|
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
@@ -6994,20 +7353,22 @@ const Methods = {
|
|
|
6994
7353
|
const radioOpts = $xeTable.computeRadioOpts
|
|
6995
7354
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
6996
7355
|
const keyboardOpts = $xeTable.computeKeyboardOpts
|
|
7356
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
6997
7357
|
const rowOpts = $xeTable.computeRowOpts
|
|
6998
7358
|
const columnOpts = $xeTable.computeColumnOpts
|
|
6999
7359
|
const currentColumnOpts = $xeTable.computeCurrentColumnOpts
|
|
7000
7360
|
const { actived, focused } = editStore
|
|
7001
7361
|
const { row, column } = params
|
|
7002
|
-
const { type, treeNode } = column
|
|
7362
|
+
const { type, treeNode, rowGroupNode } = column
|
|
7003
7363
|
const isRadioType = type === 'radio'
|
|
7004
7364
|
const isCheckboxType = type === 'checkbox'
|
|
7005
7365
|
const isExpandType = type === 'expand'
|
|
7006
7366
|
const cell = evnt.currentTarget as HTMLDivElement
|
|
7007
7367
|
const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag
|
|
7008
7368
|
const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag
|
|
7009
|
-
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree
|
|
7369
|
+
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag
|
|
7010
7370
|
const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag
|
|
7371
|
+
const triggerRowGroupNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-row-group--node-btn').flag
|
|
7011
7372
|
params = Object.assign({ cell, triggerRadio, triggerCheckbox, triggerTreeNode, triggerExpandNode }, params)
|
|
7012
7373
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7013
7374
|
// 如果是展开行
|
|
@@ -7018,11 +7379,15 @@ const Methods = {
|
|
|
7018
7379
|
if ((treeOpts.trigger === 'row' || (treeNode && treeOpts.trigger === 'cell'))) {
|
|
7019
7380
|
$xeTable.triggerTreeExpandEvent(evnt, params)
|
|
7020
7381
|
}
|
|
7382
|
+
// 如果是行分组
|
|
7383
|
+
if ((rowGroupOpts.trigger === 'row' || (rowGroupNode && rowGroupOpts.trigger === 'cell'))) {
|
|
7384
|
+
$xeTable.triggerRowGroupExpandEvent(evnt, params)
|
|
7385
|
+
}
|
|
7021
7386
|
}
|
|
7022
7387
|
// 如果点击了树节点
|
|
7023
7388
|
if (!triggerTreeNode) {
|
|
7024
|
-
if (!triggerExpandNode) {
|
|
7025
|
-
//
|
|
7389
|
+
if (!triggerExpandNode && !triggerRowGroupNode) {
|
|
7390
|
+
// 如果是当前行
|
|
7026
7391
|
if (rowOpts.isCurrent || highlightCurrentRow) {
|
|
7027
7392
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7028
7393
|
$xeTable.triggerCurrentRowEvent(evnt, params)
|
|
@@ -7238,7 +7603,7 @@ const Methods = {
|
|
|
7238
7603
|
const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input'
|
|
7239
7604
|
const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag
|
|
7240
7605
|
const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag
|
|
7241
|
-
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree
|
|
7606
|
+
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag
|
|
7242
7607
|
const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag
|
|
7243
7608
|
let isColDragCell = false
|
|
7244
7609
|
if (rowOpts.drag) {
|
|
@@ -7526,7 +7891,7 @@ const Methods = {
|
|
|
7526
7891
|
evnt.preventDefault()
|
|
7527
7892
|
return
|
|
7528
7893
|
}
|
|
7529
|
-
const
|
|
7894
|
+
const isControlKey = hasControlKey(evnt)
|
|
7530
7895
|
const trEl = evnt.currentTarget as HTMLElement
|
|
7531
7896
|
const rowid = trEl.getAttribute('rowid') || ''
|
|
7532
7897
|
const rest = fullAllDataRowIdData[rowid]
|
|
@@ -7538,11 +7903,11 @@ const Methods = {
|
|
|
7538
7903
|
const { dragRow } = reactData
|
|
7539
7904
|
const offsetY = evnt.clientY - trEl.getBoundingClientRect().y
|
|
7540
7905
|
const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom'
|
|
7541
|
-
internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag &&
|
|
7906
|
+
internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && isControlKey)
|
|
7542
7907
|
internalData.prevDragRow = row
|
|
7543
7908
|
internalData.prevDragPos = dragPos
|
|
7544
7909
|
if ($xeTable.eqRow(dragRow, row) ||
|
|
7545
|
-
(
|
|
7910
|
+
(isControlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded) ||
|
|
7546
7911
|
(!isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level))
|
|
7547
7912
|
) {
|
|
7548
7913
|
showDropTip($xeTable, evnt, trEl, null, false, dragPos)
|
|
@@ -7823,7 +8188,7 @@ const Methods = {
|
|
|
7823
8188
|
evnt.preventDefault()
|
|
7824
8189
|
return
|
|
7825
8190
|
}
|
|
7826
|
-
const
|
|
8191
|
+
const isControlKey = hasControlKey(evnt)
|
|
7827
8192
|
const thEl = evnt.currentTarget as HTMLElement
|
|
7828
8193
|
const colid = thEl.getAttribute('colid')
|
|
7829
8194
|
const column = $xeTable.getColumnById(colid)
|
|
@@ -7832,7 +8197,7 @@ const Methods = {
|
|
|
7832
8197
|
const { clientX } = evnt
|
|
7833
8198
|
const offsetX = clientX - thEl.getBoundingClientRect().x
|
|
7834
8199
|
const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right'
|
|
7835
|
-
internalData.prevDragToChild = !!((isCrossDrag && isToChildDrag) &&
|
|
8200
|
+
internalData.prevDragToChild = !!((isCrossDrag && isToChildDrag) && isControlKey)
|
|
7836
8201
|
internalData.prevDragCol = column
|
|
7837
8202
|
internalData.prevDragPos = dragPos
|
|
7838
8203
|
if (column.fixed ||
|
|
@@ -8249,7 +8614,7 @@ const Methods = {
|
|
|
8249
8614
|
const reactData = $xeTable as unknown as TableReactData
|
|
8250
8615
|
const internalData = $xeTable as unknown as TableInternalData
|
|
8251
8616
|
|
|
8252
|
-
const { expandColumn
|
|
8617
|
+
const { expandColumn } = reactData
|
|
8253
8618
|
const { rowExpandLazyLoadedMaps } = internalData
|
|
8254
8619
|
const expandOpts = $xeTable.computeExpandOpts
|
|
8255
8620
|
const { row } = params
|
|
@@ -8261,12 +8626,12 @@ const Methods = {
|
|
|
8261
8626
|
const rowid = getRowid($xeTable, row)
|
|
8262
8627
|
if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
|
|
8263
8628
|
const expanded = !$xeTable.isRowExpandByRow(row)
|
|
8264
|
-
const columnIndex = $xeTable.getColumnIndex(
|
|
8265
|
-
const $columnIndex = $xeTable.getVMColumnIndex(
|
|
8629
|
+
const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1
|
|
8630
|
+
const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1
|
|
8266
8631
|
$xeTable.setRowExpand(row, expanded)
|
|
8267
8632
|
$xeTable.dispatchEvent('toggle-row-expand', {
|
|
8268
8633
|
expanded,
|
|
8269
|
-
column,
|
|
8634
|
+
column: expandColumn,
|
|
8270
8635
|
columnIndex,
|
|
8271
8636
|
$columnIndex,
|
|
8272
8637
|
row,
|
|
@@ -8316,8 +8681,8 @@ const Methods = {
|
|
|
8316
8681
|
const expandOpts = $xeTable.computeExpandOpts
|
|
8317
8682
|
const { reserve, lazy, accordion, toggleMethod } = expandOpts
|
|
8318
8683
|
const lazyRests: any[] = []
|
|
8319
|
-
const columnIndex = $xeTable.getColumnIndex(expandColumn)
|
|
8320
|
-
const $columnIndex = $xeTable.getVMColumnIndex(expandColumn)
|
|
8684
|
+
const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1
|
|
8685
|
+
const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1
|
|
8321
8686
|
if (rows) {
|
|
8322
8687
|
if (!XEUtils.isArray(rows)) {
|
|
8323
8688
|
rows = [rows]
|
|
@@ -8328,7 +8693,7 @@ const Methods = {
|
|
|
8328
8693
|
internalData.rowExpandedMaps = rowExpandedMaps
|
|
8329
8694
|
rows = rows.slice(rows.length - 1, rows.length)
|
|
8330
8695
|
}
|
|
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
|
|
8696
|
+
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
8697
|
if (expanded) {
|
|
8333
8698
|
validRows.forEach((row: any) => {
|
|
8334
8699
|
const rowid = handleGetRowId(row)
|
|
@@ -8430,6 +8795,95 @@ const Methods = {
|
|
|
8430
8795
|
})
|
|
8431
8796
|
return rest
|
|
8432
8797
|
},
|
|
8798
|
+
setRowGroups (fieldOrColumns: (VxeColumnPropTypes.Field | VxeTableDefines.ColumnInfo)[] | VxeColumnPropTypes.Field | VxeTableDefines.ColumnInfo | null) {
|
|
8799
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8800
|
+
const props = $xeTable
|
|
8801
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8802
|
+
|
|
8803
|
+
const { rowGroupConfig } = props
|
|
8804
|
+
if (!rowGroupConfig) {
|
|
8805
|
+
errLog('vxe.error.reqProp', ['row-group-config'])
|
|
8806
|
+
return $xeTable.$nextTick()
|
|
8807
|
+
}
|
|
8808
|
+
if (fieldOrColumns) {
|
|
8809
|
+
handleUpdateRowGroup($xeTable, (XEUtils.isArray(fieldOrColumns) ? fieldOrColumns : [fieldOrColumns]).map(fieldOrColumn => {
|
|
8810
|
+
return XEUtils.isString(fieldOrColumn) ? fieldOrColumn : fieldOrColumn.field
|
|
8811
|
+
}))
|
|
8812
|
+
return loadTableData($xeTable, internalData.tableSynchData, true)
|
|
8813
|
+
}
|
|
8814
|
+
return $xeTable.$nextTick()
|
|
8815
|
+
},
|
|
8816
|
+
clearRowGroups () {
|
|
8817
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8818
|
+
const props = $xeTable
|
|
8819
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8820
|
+
|
|
8821
|
+
const { rowGroupConfig } = props
|
|
8822
|
+
if (!rowGroupConfig) {
|
|
8823
|
+
errLog('vxe.error.reqProp', ['row-group-config'])
|
|
8824
|
+
return $xeTable.$nextTick()
|
|
8825
|
+
}
|
|
8826
|
+
handleUpdateRowGroup($xeTable, [])
|
|
8827
|
+
return loadTableData($xeTable, internalData.tableSynchData, true)
|
|
8828
|
+
},
|
|
8829
|
+
isRowGroupRecord (row: any) {
|
|
8830
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8831
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8832
|
+
|
|
8833
|
+
const { isRowGroupStatus } = reactData
|
|
8834
|
+
return isRowGroupStatus && row.isAggregate
|
|
8835
|
+
},
|
|
8836
|
+
isRowGroupExpandByRow (row: any) {
|
|
8837
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8838
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8839
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8840
|
+
|
|
8841
|
+
const { rowGroupExpandedFlag } = reactData
|
|
8842
|
+
const { rowGroupExpandedMaps } = internalData
|
|
8843
|
+
return !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[getRowid($xeTable, row)]
|
|
8844
|
+
},
|
|
8845
|
+
setRowGroupExpand (rows: any, expanded: boolean) {
|
|
8846
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8847
|
+
|
|
8848
|
+
if (rows) {
|
|
8849
|
+
if (!XEUtils.isArray(rows)) {
|
|
8850
|
+
rows = [rows]
|
|
8851
|
+
}
|
|
8852
|
+
return handleRowGroupVirtualExpand($xeTable, rows, expanded)
|
|
8853
|
+
}
|
|
8854
|
+
return $xeTable.$nextTick()
|
|
8855
|
+
},
|
|
8856
|
+
setAllRowGroupExpand (expanded: boolean) {
|
|
8857
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8858
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8859
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8860
|
+
|
|
8861
|
+
const { tableFullGroupData } = internalData
|
|
8862
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
8863
|
+
const { mapChildrenField } = rowGroupOpts
|
|
8864
|
+
const rgExpandedMaps: Record<string, any> = {}
|
|
8865
|
+
if (expanded && mapChildrenField) {
|
|
8866
|
+
XEUtils.eachTree(tableFullGroupData, (row) => {
|
|
8867
|
+
if (row[mapChildrenField] && row[mapChildrenField].length) {
|
|
8868
|
+
rgExpandedMaps[getRowid($xeTable, row)] = row
|
|
8869
|
+
}
|
|
8870
|
+
}, { children: mapChildrenField })
|
|
8871
|
+
}
|
|
8872
|
+
internalData.rowGroupExpandedMaps = rgExpandedMaps
|
|
8873
|
+
handleVirtualTreeToList($xeTable)
|
|
8874
|
+
reactData.rowGroupExpandedFlag++
|
|
8875
|
+
return $xeTable.handleTableData()
|
|
8876
|
+
},
|
|
8877
|
+
clearRowGroupExpand () {
|
|
8878
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8879
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8880
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8881
|
+
|
|
8882
|
+
internalData.rowGroupExpandedMaps = {}
|
|
8883
|
+
handleVirtualTreeToList($xeTable)
|
|
8884
|
+
reactData.rowGroupExpandedFlag++
|
|
8885
|
+
return $xeTable.handleTableData()
|
|
8886
|
+
},
|
|
8433
8887
|
getTreeExpandRecords () {
|
|
8434
8888
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8435
8889
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -8493,11 +8947,11 @@ const Methods = {
|
|
|
8493
8947
|
})
|
|
8494
8948
|
}
|
|
8495
8949
|
internalData.treeExpandedMaps = {}
|
|
8496
|
-
reactData.treeExpandedFlag++
|
|
8497
8950
|
if (transform) {
|
|
8498
8951
|
handleVirtualTreeToList($xeTable)
|
|
8499
|
-
|
|
8952
|
+
$xeTable.handleTableData()
|
|
8500
8953
|
}
|
|
8954
|
+
reactData.treeExpandedFlag++
|
|
8501
8955
|
return $xeTable.$nextTick()
|
|
8502
8956
|
},
|
|
8503
8957
|
/**
|
|
@@ -8506,6 +8960,7 @@ const Methods = {
|
|
|
8506
8960
|
*/
|
|
8507
8961
|
reloadTreeExpand (row: any) {
|
|
8508
8962
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8963
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8509
8964
|
const internalData = $xeTable as unknown as TableInternalData
|
|
8510
8965
|
|
|
8511
8966
|
const { treeExpandLazyLoadedMaps } = internalData
|
|
@@ -8519,8 +8974,9 @@ const Methods = {
|
|
|
8519
8974
|
}).then(() => {
|
|
8520
8975
|
if (transform) {
|
|
8521
8976
|
handleVirtualTreeToList($xeTable)
|
|
8522
|
-
|
|
8977
|
+
$xeTable.handleTableData()
|
|
8523
8978
|
}
|
|
8979
|
+
reactData.treeExpandedFlag++
|
|
8524
8980
|
}).then(() => {
|
|
8525
8981
|
return $xeTable.recalculate()
|
|
8526
8982
|
})
|
|
@@ -8536,10 +8992,32 @@ const Methods = {
|
|
|
8536
8992
|
// 即将废弃
|
|
8537
8993
|
return $xeTable.reloadTreeExpand(row)
|
|
8538
8994
|
},
|
|
8995
|
+
/**
|
|
8996
|
+
* 行分组事件
|
|
8997
|
+
*/
|
|
8998
|
+
triggerRowGroupExpandEvent (evnt: any, params: VxeTableDefines.CellRenderBodyParams) {
|
|
8999
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9000
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9001
|
+
|
|
9002
|
+
const { rowGroupExpandedMaps } = internalData
|
|
9003
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
9004
|
+
const { row, column } = params
|
|
9005
|
+
const { trigger } = rowGroupOpts
|
|
9006
|
+
if (trigger === 'manual') {
|
|
9007
|
+
return
|
|
9008
|
+
}
|
|
9009
|
+
evnt.stopPropagation()
|
|
9010
|
+
const rowid = getRowid($xeTable, row)
|
|
9011
|
+
const expanded = !rowGroupExpandedMaps[rowid]
|
|
9012
|
+
const columnIndex = $xeTable.getColumnIndex(column)
|
|
9013
|
+
const $columnIndex = $xeTable.getVMColumnIndex(column)
|
|
9014
|
+
$xeTable.setRowGroupExpand(row, expanded)
|
|
9015
|
+
$xeTable.dispatchEvent('toggle-row-group-expand', { expanded, column, columnIndex, $columnIndex, row }, evnt)
|
|
9016
|
+
},
|
|
8539
9017
|
/**
|
|
8540
9018
|
* 展开树节点事件
|
|
8541
9019
|
*/
|
|
8542
|
-
triggerTreeExpandEvent (evnt: any, params:
|
|
9020
|
+
triggerTreeExpandEvent (evnt: any, params: VxeTableDefines.CellRenderBodyParams) {
|
|
8543
9021
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8544
9022
|
const internalData = $xeTable as unknown as TableInternalData
|
|
8545
9023
|
|
|
@@ -8580,18 +9058,29 @@ const Methods = {
|
|
|
8580
9058
|
* 设置所有树节点的展开与否
|
|
8581
9059
|
* @param {Boolean} expanded 是否展开
|
|
8582
9060
|
*/
|
|
8583
|
-
setAllTreeExpand (expanded:
|
|
8584
|
-
const
|
|
8585
|
-
const
|
|
9061
|
+
setAllTreeExpand (expanded: boolean) {
|
|
9062
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9063
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
9064
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9065
|
+
|
|
9066
|
+
const { tableFullData } = internalData
|
|
9067
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
9068
|
+
const { transform, lazy } = treeOpts
|
|
8586
9069
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
8587
9070
|
const expandeds: any[] = []
|
|
8588
|
-
XEUtils.eachTree(tableFullData, (row
|
|
9071
|
+
XEUtils.eachTree(tableFullData, (row) => {
|
|
8589
9072
|
const rowChildren = row[childrenField]
|
|
8590
9073
|
if (lazy || (rowChildren && rowChildren.length)) {
|
|
8591
9074
|
expandeds.push(row)
|
|
8592
9075
|
}
|
|
8593
9076
|
}, { children: childrenField })
|
|
8594
|
-
return
|
|
9077
|
+
return $xeTable.setTreeExpand(expandeds, expanded).then(() => {
|
|
9078
|
+
if (transform) {
|
|
9079
|
+
handleVirtualTreeToList($xeTable)
|
|
9080
|
+
reactData.treeExpandedFlag++
|
|
9081
|
+
return $xeTable.recalculate()
|
|
9082
|
+
}
|
|
9083
|
+
})
|
|
8595
9084
|
},
|
|
8596
9085
|
/**
|
|
8597
9086
|
* 设置展开树形节点,二个参数设置这一行展开与否
|
|
@@ -8647,15 +9136,15 @@ const Methods = {
|
|
|
8647
9136
|
const { transform, reserve } = treeOpts
|
|
8648
9137
|
const expList = $xeTable.getTreeExpandRecords()
|
|
8649
9138
|
internalData.treeExpandedMaps = {}
|
|
8650
|
-
reactData.treeExpandedFlag++
|
|
8651
9139
|
if (reserve) {
|
|
8652
9140
|
XEUtils.eachTree(tableFullTreeData, row => handleTreeExpandReserve($xeTable, row, false), { children: childrenField })
|
|
8653
9141
|
}
|
|
8654
9142
|
return $xeTable.handleTableData().then(() => {
|
|
8655
9143
|
if (transform) {
|
|
8656
9144
|
handleVirtualTreeToList($xeTable)
|
|
8657
|
-
|
|
9145
|
+
$xeTable.handleTableData()
|
|
8658
9146
|
}
|
|
9147
|
+
reactData.treeExpandedFlag++
|
|
8659
9148
|
}).then(() => {
|
|
8660
9149
|
if (expList.length) {
|
|
8661
9150
|
$xeTable.recalculate()
|
|
@@ -9465,21 +9954,30 @@ const Methods = {
|
|
|
9465
9954
|
* @param {Row} row 行对象
|
|
9466
9955
|
*/
|
|
9467
9956
|
scrollToTreeRow (row: any) {
|
|
9468
|
-
const
|
|
9469
|
-
const
|
|
9470
|
-
const
|
|
9471
|
-
|
|
9472
|
-
|
|
9957
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9958
|
+
const props = $xeTable
|
|
9959
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
9960
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9961
|
+
|
|
9962
|
+
const { treeConfig } = props
|
|
9963
|
+
const { isRowGroupStatus } = reactData
|
|
9964
|
+
const { tableFullData } = internalData
|
|
9965
|
+
const rests: Promise<any>[] = []
|
|
9966
|
+
if (treeConfig || isRowGroupStatus) {
|
|
9967
|
+
const rowGroupOpts = $xeTable.computeRowGroupOpts
|
|
9968
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
9969
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
9970
|
+
const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ? rowGroupOpts.mapChildrenField : childrenField })
|
|
9473
9971
|
if (matchObj) {
|
|
9474
9972
|
const nodes = matchObj.nodes
|
|
9475
9973
|
nodes.forEach((row, index) => {
|
|
9476
|
-
if (index < nodes.length - 1 &&
|
|
9477
|
-
rests.push(
|
|
9974
|
+
if (index < nodes.length - 1 && !$xeTable.isTreeExpandByRow(row)) {
|
|
9975
|
+
rests.push($xeTable.setTreeExpand(row, true))
|
|
9478
9976
|
}
|
|
9479
9977
|
})
|
|
9480
9978
|
}
|
|
9481
9979
|
}
|
|
9482
|
-
return Promise.all(rests).then(() => rowToVisible(
|
|
9980
|
+
return Promise.all(rests).then(() => rowToVisible($xeTable, row))
|
|
9483
9981
|
},
|
|
9484
9982
|
/**
|
|
9485
9983
|
* 手动清除滚动相关信息,还原到初始状态
|