mirror of
https://github.com/dataease/dataease.git
synced 2026-05-18 17:58:11 +08:00
refactor(图表): 优化明细表合并单元格的显示效果,不显示被覆盖单元格的文字和背景颜色
This commit is contained in:
@@ -503,6 +503,16 @@ export class TableInfo extends S2ChartView<TableSheet> {
|
||||
const summaryObj = getSummaryRow(data, axis, basicStyle.seriesSummary) as any
|
||||
data.push(summaryObj)
|
||||
}
|
||||
const { mergeCells } = tableCell
|
||||
const mergedCellsInfoMap: Record<string, boolean> = {}
|
||||
if (mergeCells) {
|
||||
s2Options.mergedCellsInfo?.reduce((p, n) => {
|
||||
n.forEach(cell => {
|
||||
p[`${cell.rowIndex}-${cell.colIndex}`] = true
|
||||
})
|
||||
return p
|
||||
}, mergedCellsInfoMap)
|
||||
}
|
||||
s2Options.dataCell = viewMeta => {
|
||||
// 总计行处理
|
||||
if (showSummary && viewMeta.rowIndex === data.length - 1) {
|
||||
@@ -533,6 +543,10 @@ export class TableInfo extends S2ChartView<TableSheet> {
|
||||
// 配置文本自动换行参数
|
||||
viewMeta.autoWrap = tableCell.mergeCells ? false : basicStyle.autoWrap
|
||||
viewMeta.maxLines = basicStyle.maxLines
|
||||
// 合并单元格标记
|
||||
if (mergeCells && mergedCellsInfoMap[`${viewMeta.rowIndex}-${viewMeta.colIndex}`]) {
|
||||
viewMeta.isMergedCell = true
|
||||
}
|
||||
return new CustomDataCell(viewMeta, viewMeta?.spreadsheet)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2135,6 +2135,7 @@ class CustomMergedCell extends MergedCell {
|
||||
}
|
||||
|
||||
drawTextShape(): void {
|
||||
console.log(this.meta.fieldValue)
|
||||
if (this.meta.deFieldType === 7) {
|
||||
drawImage.apply(this)
|
||||
} else {
|
||||
@@ -2158,11 +2159,25 @@ export class CustomDataCell extends TableDataCell {
|
||||
})
|
||||
}
|
||||
|
||||
public getBackgroundColor() {
|
||||
let bgColorInfo = super.getBackgroundColor()
|
||||
if (this.meta.isMergedCell) {
|
||||
bgColorInfo = {
|
||||
...bgColorInfo,
|
||||
backgroundColorOpacity: 0
|
||||
}
|
||||
}
|
||||
return bgColorInfo
|
||||
}
|
||||
|
||||
/**
|
||||
* 重写绘制文本内容的方法
|
||||
* @protected
|
||||
*/
|
||||
protected drawTextShape() {
|
||||
if(this.meta.isMergedCell) {
|
||||
return
|
||||
}
|
||||
if (this.meta.autoWrap) {
|
||||
drawTextShape(this, false)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user