From 3ada4d23488a8c5c8e0714280d548d0dbcec08b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=98=89=E8=B1=AA?= <42510293+ziyujiahao@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:58:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF=E3=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=BE=B9=E6=A1=86=E8=83=8C=E6=99=AF=E5=9C=86=E8=A7=92=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E9=A2=84=E8=A7=88=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#17259)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/ComponentWrapper.vue | 40 ++++++++++++++++++- .../component-background/Types.ts | 2 +- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue b/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue index 75bc591f17..aa615c42c5 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue @@ -16,6 +16,8 @@ import { XpackComponent } from '@/components/plugin' import DePreviewPopDialog from '@/components/visualization/DePreviewPopDialog.vue' import Icon from '../../icon-custom/src/Icon.vue' import replaceOutlined from '@/assets/svg/icon_replace_outlined.svg' +import { CommonBackground } from '@/components/visualization/component-background/Types' +import { ShorthandMode } from '@/Types' const componentWrapperInnerRef = ref(null) const componentEditBarRef = ref(null) @@ -226,9 +228,43 @@ const componentBackgroundStyle = computed(() => { innerPadding, borderRadius } = config.value.commonBackground + const commonBackground = config.value.commonBackground as CommonBackground + const innerPaddingTarget = ['Group'].includes(config.value.component) ? 0 : innerPadding + let innerPaddingStyle = innerPaddingTarget * deepScale.value + 'px' + const paddingMode = commonBackground.innerPadding?.mode + if (paddingMode === ShorthandMode.Uniform) { + innerPaddingStyle = `${commonBackground.innerPadding?.top * deepScale.value}px` + } else if (paddingMode === ShorthandMode.Axis) { + innerPaddingStyle = `${commonBackground.innerPadding?.top * deepScale.value}px ${ + commonBackground.innerPadding?.left * deepScale.value + }px` + } else if (paddingMode === ShorthandMode.PerEdge) { + innerPaddingStyle = `${commonBackground.innerPadding?.top * deepScale.value}px ${ + commonBackground.innerPadding?.right * deepScale.value + }px ${commonBackground.innerPadding?.bottom * deepScale.value}px ${ + commonBackground.innerPadding?.left * deepScale.value + }px` + } + + let borderRadiusStyle = borderRadius + 'px' + const borderRadiusMode = commonBackground.borderRadius?.mode + if (borderRadiusMode === ShorthandMode.Uniform) { + borderRadiusStyle = `${commonBackground.borderRadius?.topLeft * deepScale.value}px` + } else if (borderRadiusMode === ShorthandMode.Axis) { + borderRadiusStyle = `${commonBackground.borderRadius?.topLeft * deepScale.value}px ${ + commonBackground.borderRadius?.bottomLeft * deepScale.value + }px` + } else if (borderRadiusMode === ShorthandMode.PerEdge) { + borderRadiusStyle = `${commonBackground.borderRadius?.topLeft * deepScale.value}px ${ + commonBackground.borderRadius?.topRight * deepScale.value + }px ${commonBackground.borderRadius?.bottomRight * deepScale.value}px ${ + commonBackground.borderRadius?.bottomLeft * deepScale.value + }px` + } + let style = { - padding: innerPadding * deepScale.value + 'px', - borderRadius: borderRadius + 'px' + padding: innerPaddingStyle, + borderRadius: borderRadiusStyle } let colorRGBA = '' if (backgroundColorSelect && backgroundColor) { diff --git a/core/core-frontend/src/components/visualization/component-background/Types.ts b/core/core-frontend/src/components/visualization/component-background/Types.ts index c8f93b3558..c0e530d726 100644 --- a/core/core-frontend/src/components/visualization/component-background/Types.ts +++ b/core/core-frontend/src/components/visualization/component-background/Types.ts @@ -1,4 +1,4 @@ -import { EdgeValues } from '@/Types' +import { EdgeValues, CornerValues } from '@/Types' import { COLOR_PANEL } from '@/views/chart/components/editor/util/chart' import type { UploadFile } from 'element-plus-secondary'