vxe-table 3.15.2 → 3.15.4
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/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/src/body.js +5 -3
- package/es/table/src/footer.js +4 -2
- package/es/table/src/header.js +2 -1
- package/es/table/src/methods.js +95 -95
- package/es/table/src/table.js +3 -0
- package/es/table/style.css +0 -3
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +0 -3
- 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 +132 -123
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/body.js +5 -2
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +4 -2
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +2 -1
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +116 -116
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +3 -0
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +0 -3
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.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 +0 -3
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/table/src/body.ts +5 -3
- package/packages/table/src/footer.ts +4 -2
- package/packages/table/src/header.ts +2 -1
- package/packages/table/src/methods.ts +102 -100
- package/packages/table/src/table.ts +3 -0
- package/styles/components/table.scss +3 -3
- /package/es/{iconfont.1744428010256.ttf → iconfont.1744768256934.ttf} +0 -0
- /package/es/{iconfont.1744428010256.woff → iconfont.1744768256934.woff} +0 -0
- /package/es/{iconfont.1744428010256.woff2 → iconfont.1744768256934.woff2} +0 -0
- /package/lib/{iconfont.1744428010256.ttf → iconfont.1744768256934.ttf} +0 -0
- /package/lib/{iconfont.1744428010256.woff → iconfont.1744768256934.woff} +0 -0
- /package/lib/{iconfont.1744428010256.woff2 → iconfont.1744768256934.woff2} +0 -0
|
@@ -205,7 +205,7 @@ function restoreCustomStorage ($xeTable: VxeTableConstructor & VxeTablePrivateMe
|
|
|
205
205
|
* 更新数据列的 Map
|
|
206
206
|
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
207
207
|
*/
|
|
208
|
-
function cacheColumnMap ($xeTable: VxeTableConstructor) {
|
|
208
|
+
function cacheColumnMap ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
209
209
|
const props = $xeTable
|
|
210
210
|
const reactData = $xeTable as unknown as TableReactData
|
|
211
211
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -315,7 +315,7 @@ function cacheColumnMap ($xeTable: VxeTableConstructor) {
|
|
|
315
315
|
reactData.isAllOverflow = isAllOverflow
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
const updateScrollYStatus = ($xeTable: VxeTableConstructor, fullData?: any[]) => {
|
|
318
|
+
const updateScrollYStatus = ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, fullData?: any[]) => {
|
|
319
319
|
const props = $xeTable
|
|
320
320
|
const reactData = $xeTable as unknown as TableReactData
|
|
321
321
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -331,7 +331,97 @@ const updateScrollYStatus = ($xeTable: VxeTableConstructor, fullData?: any[]) =>
|
|
|
331
331
|
return scrollYLoad
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
|
|
334
|
+
/**
|
|
335
|
+
* 展开与收起树节点
|
|
336
|
+
* @param rows
|
|
337
|
+
* @param expanded
|
|
338
|
+
* @returns
|
|
339
|
+
*/
|
|
340
|
+
function handleBaseTreeExpand ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, rows: any[], expanded: boolean) {
|
|
341
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
342
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
343
|
+
|
|
344
|
+
const { treeNodeColumn } = reactData
|
|
345
|
+
const { fullAllDataRowIdData, tableFullData, treeExpandedMaps, treeExpandLazyLoadedMaps } = internalData
|
|
346
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
347
|
+
const { reserve, lazy, accordion, toggleMethod } = treeOpts
|
|
348
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
349
|
+
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
350
|
+
const result: any[] = []
|
|
351
|
+
const columnIndex = $xeTable.getColumnIndex(treeNodeColumn)
|
|
352
|
+
const $columnIndex = $xeTable.getVMColumnIndex(treeNodeColumn)
|
|
353
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
354
|
+
let validRows = toggleMethod ? rows.filter((row: any) => toggleMethod({ $table: $xeTable, expanded, column: treeNodeColumn, columnIndex, $columnIndex, row })) : rows
|
|
355
|
+
if (accordion) {
|
|
356
|
+
validRows = validRows.length ? [validRows[validRows.length - 1]] : []
|
|
357
|
+
// 同一级只能展开一个
|
|
358
|
+
const matchObj = XEUtils.findTree(tableFullData, item => item === validRows[0], { children: childrenField })
|
|
359
|
+
if (matchObj) {
|
|
360
|
+
matchObj.items.forEach(item => {
|
|
361
|
+
const rowid = handleGetRowId(item)
|
|
362
|
+
if (treeExpandedMaps[rowid]) {
|
|
363
|
+
delete treeExpandedMaps[rowid]
|
|
364
|
+
}
|
|
365
|
+
})
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (expanded) {
|
|
369
|
+
validRows.forEach((row: any) => {
|
|
370
|
+
const rowid = handleGetRowId(row)
|
|
371
|
+
if (!treeExpandedMaps[rowid]) {
|
|
372
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
373
|
+
if (rowRest) {
|
|
374
|
+
const isLoad = lazy && row[hasChildField] && !rowRest.treeLoaded && !treeExpandLazyLoadedMaps[rowid]
|
|
375
|
+
// 是否使用懒加载
|
|
376
|
+
if (isLoad) {
|
|
377
|
+
result.push(handleAsyncTreeExpandChilds($xeTable, row))
|
|
378
|
+
} else {
|
|
379
|
+
if (row[childrenField] && row[childrenField].length) {
|
|
380
|
+
treeExpandedMaps[rowid] = row
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
})
|
|
386
|
+
} else {
|
|
387
|
+
validRows.forEach(item => {
|
|
388
|
+
const rowid = handleGetRowId(item)
|
|
389
|
+
if (treeExpandedMaps[rowid]) {
|
|
390
|
+
delete treeExpandedMaps[rowid]
|
|
391
|
+
}
|
|
392
|
+
})
|
|
393
|
+
}
|
|
394
|
+
if (reserve) {
|
|
395
|
+
validRows.forEach((row: any) => handleTreeExpandReserve($xeTable, row, expanded))
|
|
396
|
+
}
|
|
397
|
+
reactData.treeExpandedFlag++
|
|
398
|
+
return Promise.all(result).then(() => {
|
|
399
|
+
return $xeTable.recalculate()
|
|
400
|
+
})
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* 虚拟树的展开与收起
|
|
405
|
+
* @param rows
|
|
406
|
+
* @param expanded
|
|
407
|
+
* @returns
|
|
408
|
+
*/
|
|
409
|
+
function handleVirtualTreeExpand ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, rows: any[], expanded: boolean) {
|
|
410
|
+
return handleBaseTreeExpand($xeTable, rows, expanded).then(() => {
|
|
411
|
+
handleVirtualTreeToList($xeTable)
|
|
412
|
+
$xeTable.handleTableData()
|
|
413
|
+
updateAfterDataIndex($xeTable)
|
|
414
|
+
return $xeTable.$nextTick()
|
|
415
|
+
}).then(() => {
|
|
416
|
+
return $xeTable.recalculate(true)
|
|
417
|
+
}).then(() => {
|
|
418
|
+
setTimeout(() => {
|
|
419
|
+
$xeTable.updateCellAreas()
|
|
420
|
+
}, 30)
|
|
421
|
+
})
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
function updateAfterListIndex ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
335
425
|
const props = $xeTable
|
|
336
426
|
const internalData = $xeTable as unknown as TableInternalData
|
|
337
427
|
|
|
@@ -362,7 +452,7 @@ function updateAfterListIndex ($xeTable: VxeTableConstructor) {
|
|
|
362
452
|
* 预编译
|
|
363
453
|
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
364
454
|
*/
|
|
365
|
-
function updateAfterDataIndex ($xeTable: VxeTableConstructor) {
|
|
455
|
+
function updateAfterDataIndex ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
366
456
|
const props = $xeTable
|
|
367
457
|
const internalData = $xeTable as unknown as TableInternalData
|
|
368
458
|
|
|
@@ -399,7 +489,7 @@ function updateAfterDataIndex ($xeTable: VxeTableConstructor) {
|
|
|
399
489
|
* 如果为虚拟树,将树结构拍平
|
|
400
490
|
* @returns
|
|
401
491
|
*/
|
|
402
|
-
function handleVirtualTreeToList ($xeTable: VxeTableConstructor) {
|
|
492
|
+
function handleVirtualTreeToList ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
403
493
|
const props = $xeTable
|
|
404
494
|
const internalData = $xeTable as unknown as TableInternalData
|
|
405
495
|
|
|
@@ -8238,7 +8328,7 @@ const Methods = {
|
|
|
8238
8328
|
internalData.rowExpandedMaps = rowExpandedMaps
|
|
8239
8329
|
rows = rows.slice(rows.length - 1, rows.length)
|
|
8240
8330
|
}
|
|
8241
|
-
const validRows: any[] = toggleMethod ? rows.filter((row: any) => toggleMethod({ $table: $xeTable, expanded, column: expandColumn, columnIndex, $columnIndex, row, rowIndex:
|
|
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
|
|
8242
8332
|
if (expanded) {
|
|
8243
8333
|
validRows.forEach((row: any) => {
|
|
8244
8334
|
const rowid = handleGetRowId(row)
|
|
@@ -8253,7 +8343,7 @@ const Methods = {
|
|
|
8253
8343
|
}
|
|
8254
8344
|
})
|
|
8255
8345
|
} else {
|
|
8256
|
-
validRows.forEach(
|
|
8346
|
+
validRows.forEach(item => {
|
|
8257
8347
|
const rowid = handleGetRowId(item)
|
|
8258
8348
|
if (rowExpandedMaps[rowid]) {
|
|
8259
8349
|
delete rowExpandedMaps[rowid]
|
|
@@ -8474,7 +8564,7 @@ const Methods = {
|
|
|
8474
8564
|
internalData.treeEATime = setTimeout(() => {
|
|
8475
8565
|
internalData.treeEATime = undefined
|
|
8476
8566
|
$xeTable.scrollToRow(row)
|
|
8477
|
-
},
|
|
8567
|
+
}, 30)
|
|
8478
8568
|
}
|
|
8479
8569
|
})
|
|
8480
8570
|
$xeTable.dispatchEvent('toggle-tree-expand', { expanded, column, columnIndex, $columnIndex, row }, evnt)
|
|
@@ -8503,96 +8593,6 @@ const Methods = {
|
|
|
8503
8593
|
}, { children: childrenField })
|
|
8504
8594
|
return this.setTreeExpand(expandeds, expanded)
|
|
8505
8595
|
},
|
|
8506
|
-
/**
|
|
8507
|
-
* 默认,展开与收起树节点
|
|
8508
|
-
* @param rows
|
|
8509
|
-
* @param expanded
|
|
8510
|
-
* @returns
|
|
8511
|
-
*/
|
|
8512
|
-
handleBaseTreeExpand (rows: any, expanded: any) {
|
|
8513
|
-
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8514
|
-
const reactData = $xeTable as unknown as TableReactData
|
|
8515
|
-
const internalData = $xeTable as unknown as TableInternalData
|
|
8516
|
-
|
|
8517
|
-
const { treeNodeColumn } = reactData
|
|
8518
|
-
const { fullAllDataRowIdData, tableFullData, treeExpandedMaps, treeExpandLazyLoadedMaps } = internalData
|
|
8519
|
-
const treeOpts = $xeTable.computeTreeOpts
|
|
8520
|
-
const { reserve, lazy, accordion, toggleMethod } = treeOpts
|
|
8521
|
-
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
8522
|
-
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
8523
|
-
const result: any[] = []
|
|
8524
|
-
const columnIndex = $xeTable.getColumnIndex(treeNodeColumn)
|
|
8525
|
-
const $columnIndex = $xeTable.getVMColumnIndex(treeNodeColumn)
|
|
8526
|
-
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
8527
|
-
let validRows = toggleMethod ? rows.filter((row: any) => toggleMethod({ $table: $xeTable, expanded, column: treeNodeColumn, columnIndex, $columnIndex, row })) : rows
|
|
8528
|
-
if (accordion) {
|
|
8529
|
-
validRows = validRows.length ? [validRows[validRows.length - 1]] : []
|
|
8530
|
-
// 同一级只能展开一个
|
|
8531
|
-
const matchObj = XEUtils.findTree(tableFullData, item => item === validRows[0], { children: childrenField })
|
|
8532
|
-
if (matchObj) {
|
|
8533
|
-
matchObj.items.forEach(item => {
|
|
8534
|
-
const rowid = handleGetRowId(item)
|
|
8535
|
-
if (treeExpandedMaps[rowid]) {
|
|
8536
|
-
delete treeExpandedMaps[rowid]
|
|
8537
|
-
}
|
|
8538
|
-
})
|
|
8539
|
-
}
|
|
8540
|
-
}
|
|
8541
|
-
if (expanded) {
|
|
8542
|
-
validRows.forEach((row: any) => {
|
|
8543
|
-
const rowid = handleGetRowId(row)
|
|
8544
|
-
if (!treeExpandedMaps[rowid]) {
|
|
8545
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
8546
|
-
if (rowRest) {
|
|
8547
|
-
const isLoad = lazy && row[hasChildField] && !rowRest.treeLoaded && !treeExpandLazyLoadedMaps[rowid]
|
|
8548
|
-
// 是否使用懒加载
|
|
8549
|
-
if (isLoad) {
|
|
8550
|
-
result.push(handleAsyncTreeExpandChilds($xeTable, row))
|
|
8551
|
-
} else {
|
|
8552
|
-
if (row[childrenField] && row[childrenField].length) {
|
|
8553
|
-
treeExpandedMaps[rowid] = row
|
|
8554
|
-
}
|
|
8555
|
-
}
|
|
8556
|
-
}
|
|
8557
|
-
}
|
|
8558
|
-
})
|
|
8559
|
-
} else {
|
|
8560
|
-
validRows.forEach((item: any) => {
|
|
8561
|
-
const rowid = handleGetRowId(item)
|
|
8562
|
-
if (treeExpandedMaps[rowid]) {
|
|
8563
|
-
delete treeExpandedMaps[rowid]
|
|
8564
|
-
}
|
|
8565
|
-
})
|
|
8566
|
-
}
|
|
8567
|
-
if (reserve) {
|
|
8568
|
-
validRows.forEach((row: any) => handleTreeExpandReserve($xeTable, row, expanded))
|
|
8569
|
-
}
|
|
8570
|
-
reactData.treeExpandedFlag++
|
|
8571
|
-
return Promise.all(result).then(() => {
|
|
8572
|
-
return $xeTable.recalculate()
|
|
8573
|
-
})
|
|
8574
|
-
},
|
|
8575
|
-
/**
|
|
8576
|
-
* 虚拟树的展开与收起
|
|
8577
|
-
* @param rows
|
|
8578
|
-
* @param expanded
|
|
8579
|
-
* @returns
|
|
8580
|
-
*/
|
|
8581
|
-
handleVirtualTreeExpand (rows: any[], expanded: boolean) {
|
|
8582
|
-
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8583
|
-
|
|
8584
|
-
return this.handleBaseTreeExpand(rows, expanded).then(() => {
|
|
8585
|
-
handleVirtualTreeToList($xeTable)
|
|
8586
|
-
this.handleTableData()
|
|
8587
|
-
updateAfterDataIndex($xeTable)
|
|
8588
|
-
}).then(() => {
|
|
8589
|
-
return this.recalculate()
|
|
8590
|
-
}).then(() => {
|
|
8591
|
-
setTimeout(() => {
|
|
8592
|
-
this.updateCellAreas()
|
|
8593
|
-
}, 30)
|
|
8594
|
-
})
|
|
8595
|
-
},
|
|
8596
8596
|
/**
|
|
8597
8597
|
* 设置展开树形节点,二个参数设置这一行展开与否
|
|
8598
8598
|
* 支持单行
|
|
@@ -8601,6 +8601,8 @@ const Methods = {
|
|
|
8601
8601
|
* @param {Boolean} expanded 是否展开
|
|
8602
8602
|
*/
|
|
8603
8603
|
setTreeExpand (rows: any | any[], expanded: boolean) {
|
|
8604
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8605
|
+
|
|
8604
8606
|
const { treeOpts } = this
|
|
8605
8607
|
const { transform } = treeOpts
|
|
8606
8608
|
if (rows) {
|
|
@@ -8610,9 +8612,9 @@ const Methods = {
|
|
|
8610
8612
|
if (rows.length) {
|
|
8611
8613
|
// 如果为虚拟树
|
|
8612
8614
|
if (transform) {
|
|
8613
|
-
return
|
|
8615
|
+
return handleVirtualTreeExpand($xeTable, rows, expanded)
|
|
8614
8616
|
} else {
|
|
8615
|
-
return
|
|
8617
|
+
return handleBaseTreeExpand($xeTable, rows, expanded)
|
|
8616
8618
|
}
|
|
8617
8619
|
}
|
|
8618
8620
|
}
|
|
@@ -1495,6 +1495,9 @@ export default {
|
|
|
1495
1495
|
if (this.highlightHoverColumn) {
|
|
1496
1496
|
warnLog('vxe.error.delProp', ['highlight-hover-column', 'column-config.isHover'])
|
|
1497
1497
|
}
|
|
1498
|
+
if (props.resizable) {
|
|
1499
|
+
warnLog('vxe.error.delProp', ['resizable', 'column-config.resizable'])
|
|
1500
|
+
}
|
|
1498
1501
|
// if (props.scrollY) {
|
|
1499
1502
|
// warnLog('vxe.error.delProp', ['scroll-y', 'virtual-y-config'])
|
|
1500
1503
|
// }
|
|
@@ -1620,9 +1620,9 @@
|
|
|
1620
1620
|
z-index: 1;
|
|
1621
1621
|
user-select: none;
|
|
1622
1622
|
cursor: pointer;
|
|
1623
|
-
& > i {
|
|
1624
|
-
|
|
1625
|
-
}
|
|
1623
|
+
// & > i {
|
|
1624
|
+
// background-color: var(--vxe-ui-layout-background-color); // 影响选择行相关
|
|
1625
|
+
// }
|
|
1626
1626
|
}
|
|
1627
1627
|
.vxe-tree--node-btn {
|
|
1628
1628
|
display: block;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|