Merge pull request #13056 from dataease/pr@dev-v2@refactor_table_info_merge_cells_threshold

refactor(图表): 明细表合并单元格条件样式
This commit is contained in:
wisonic-s 2024-11-01 12:14:12 +08:00 committed by GitHub
commit e8ef87a814
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,7 +29,10 @@ import {
InteractionStateName,
InteractionName,
DataCellBrushSelection,
TableDataCell
TableDataCell,
MergedCell,
getPolygonPoints,
renderPolygon
} from '@antv/s2'
import { keys, intersection, filter, cloneDeep, merge, find, repeat } from 'lodash-es'
import { createVNode, render } from 'vue'
@ -1462,5 +1465,25 @@ export function configMergeCells(chart: Chart, options: S2Options) {
})
})
options.mergedCellsInfo = mergedCellsInfo
options.mergedCell = (sheet, cells, meta) => {
return new CustomMergedCell(sheet, cells, meta)
}
}
}
class CustomMergedCell extends MergedCell {
protected drawBackgroundShape() {
const allPoints = getPolygonPoints(this.cells)
// 处理条件样式这里没有用透明度
// 因为合并的单元格是单独的图层透明度降低的话会显示底下未合并的单元格需要单独处理被覆盖的单元格
const { backgroundColor: fill, backgroundColorOpacity: fillOpacity } =
this.getBackgroundColor();
const cellTheme = this.theme.dataCell.cell
this.backgroundShape = renderPolygon(this, {
points: allPoints,
stroke: cellTheme.horizontalBorderColor,
fill,
lineHeight: cellTheme.horizontalBorderWidth,
})
}
}