Merge pull request #12029 from dataease/dev-v2

merge dev-2
This commit is contained in:
fit2cloudrd 2024-09-04 20:45:49 +08:00 committed by GitHub
commit 6af3315f9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 62 additions and 35 deletions

View File

@ -250,7 +250,7 @@ export function refreshOtherComponent(dvId, busiFlag) {
for (let i = 0; i < componentData.value.length; i++) {
const component = componentData.value[i]
if (refreshIdList.includes(component.id) && canvasDataResultMap[component.id]) {
const { top, left, height, width } = componentData.value[i]
const { top, left, height, width } = componentData.value[i].style
canvasDataResultMap[component.id].style.top = top
canvasDataResultMap[component.id].style.left = left
canvasDataResultMap[component.id].style.height = height

View File

@ -266,8 +266,7 @@ export class Gauge extends G2PlotChartView<GaugeOptions, G2Gauge> {
return ''
}
if (gaugePercentLabel === false) {
const val = v === '0' ? min : v === '1' ? max : min + (max - min) * v
return valueFormatter(val, labelFormatter)
return v === '0' ? min : v === '1' ? max : min + (max - min) * v
}
return v === '0' ? v : v * 100 + '%'
}

View File

@ -147,18 +147,15 @@ export class TableInfo extends S2ChartView<TableSheet> {
}
// 开启序号之后第一列就是序号列修改 label 即可
if (s2Options.showSeriesNumber) {
s2Options.colCell = (node, sheet, config) => {
if (node.colIndex === 0) {
let indexLabel = customAttr.tableHeader.indexLabel
if (!indexLabel) {
indexLabel = ''
}
const cell = new TableColCell(node, sheet, config)
const shape = cell.getTextShape() as any
shape.attrs.text = indexLabel
return cell
s2Options.layoutCoordinate = (_, __, col) => {
if (col.colIndex === 0 && col.rowIndex === 0) {
col.label = indexLabel
col.value = indexLabel
}
return new TableColCell(node, sheet, config)
}
}
s2Options.dataCell = viewMeta => {

View File

@ -135,21 +135,15 @@ export class TableNormal extends S2ChartView<TableSheet> {
}
// 开启序号之后第一列就是序号列修改 label 即可
if (s2Options.showSeriesNumber) {
s2Options.colCell = (node, sheet, config) => {
if (node.colIndex === 0) {
let indexLabel = customAttr.tableHeader.indexLabel
if (!indexLabel) {
indexLabel = ''
}
const cell = new TableColCell(node, sheet, config)
const shape = cell.getTextShape() as any
shape.attrs.text = indexLabel
return cell
s2Options.layoutCoordinate = (_, __, col) => {
if (col.colIndex === 0 && col.rowIndex === 0) {
col.label = indexLabel
col.value = indexLabel
}
return new TableColCell(node, sheet, config)
}
s2Options.dataCell = viewMeta => {
return new TableDataCell(viewMeta, viewMeta?.spreadsheet)
}
}
// tooltip

View File

@ -1,4 +1,11 @@
import { copyString, hexColorToRGBA, isAlphaColor, parseJson, resetRgbOpacity } from '../..//util'
import {
copyString,
hexColorToRGBA,
isAlphaColor,
isTransparent,
parseJson,
resetRgbOpacity
} from '../..//util'
import {
DEFAULT_BASIC_STYLE,
DEFAULT_TABLE_CELL,
@ -547,7 +554,10 @@ export function getConditions(chart: Chart) {
return null
}
const fill = mappingColor(value, defaultBgColor, field, 'backgroundColor')
return fill ? { fill } : null
if (isTransparent(fill)) {
return null
}
return { fill }
}
})
}

View File

@ -83,10 +83,6 @@ export abstract class S2ChartView<P extends SpreadSheet> extends AntVAbstractCha
break
case 'rowCell':
case 'colCell':
if (meta.field === SERIES_NUMBER_FIELD) {
content = cell.getTextShape()['attrs'].text
break
}
content = meta.label
field = find(metaConfig, item => item.field === content)
if (field) {

View File

@ -705,7 +705,10 @@ export const stepsColor = (start, end, steps, gamma) => {
export const getMapColorCases = colorCases => {
const cloneColorCases = JSON.parse(JSON.stringify(colorCases))
return cloneColorCases.map(colorItem => {
const curColors = colorItem.colors
let curColors = colorItem.colors
if (['fresh', 'red', 'spiritual'].includes(colorItem.value)) {
curColors = colorItem.colors.reverse()
}
const len = curColors.length
const start = curColors[0]
const end = curColors[len - 1]
@ -987,6 +990,30 @@ export function isAlphaColor(color: string): boolean {
return false
}
export function isTransparent(color: string): boolean {
if (!color?.trim()) {
return true
}
if (color.startsWith('#')) {
const tmp = color.substring(1, color.length)
if (tmp.length === 3 || tmp.length === 6) {
return false
}
if (tmp.length === 8) {
return tmp.substring(6, 8) === '00'
}
}
if (color.startsWith('rgb')) {
const tmp = color.split(',')
if (tmp.length !== 4) {
return false
}
const alpha = tmp[3].substring(0, tmp[3].length - 1)
return alpha.trim() === '0'
}
return false
}
export function convertToAlphaColor(color: string, alpha: number): string {
if (!color?.trim()) {
return 'rgba(255,255,255,1)'

View File

@ -739,4 +739,8 @@ const tablePageClass = computed(() => {
flex-direction: row;
justify-content: center;
}
.antv-s2-tooltip-container {
max-width: 80px;
min-width: 80px;
}
</style>