diff --git a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue index 1b371a3520..b349d6551f 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue @@ -158,6 +158,11 @@ import { import Board from '@/components/de-board/Board.vue' import { activeWatermarkCheckUser, removeActiveWatermark } from '@/components/watermark/watermark' import { useI18n } from '@/hooks/web/useI18n' +import { + CommonBackground, + ShorthandMode +} from '@/components/visualization/component-background/Types' + const { t } = useI18n() const dvMainStore = dvMainStoreWithOut() const snapshotStore = snapshotStoreWithOut() @@ -962,10 +967,34 @@ const componentBackgroundStyle = computed(() => { innerPadding, borderRadius } = element.value.commonBackground + const commonBackground = element.value.commonBackground as CommonBackground const innerPaddingTarget = ['Group'].includes(element.value.component) ? 0 : innerPadding + let innerPaddingStyle = innerPaddingTarget * scale.value + 'px' + const paddingMode = commonBackground.innerPadding?.mode + if (paddingMode === ShorthandMode.Uniform) { + innerPaddingStyle = `${commonBackground.innerPadding?.top * scale.value}px` + } else if (paddingMode === ShorthandMode.PerEdge) { + innerPaddingStyle = `${commonBackground.innerPadding?.top * scale.value}px ${ + commonBackground.innerPadding?.right * scale.value + }px ${commonBackground.innerPadding?.bottom * scale.value}px ${ + commonBackground.innerPadding?.left * scale.value + }px` + } + + let borderRadiusStyle = borderRadius + 'px' + const borderRadiusMode = commonBackground.borderRadius?.mode + if (borderRadiusMode === ShorthandMode.Uniform) { + borderRadiusStyle = `${commonBackground.borderRadius?.topLeft * scale.value}px` + } else if (borderRadiusMode === ShorthandMode.PerEdge) { + borderRadiusStyle = `${commonBackground.borderRadius?.topLeft * scale.value}px ${ + commonBackground.borderRadius?.topRight * scale.value + }px ${commonBackground.borderRadius?.bottomRight * scale.value}px ${ + commonBackground.borderRadius?.bottomLeft * scale.value + }px` + } let style = { - padding: innerPaddingTarget * scale.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/BackgroundOverallCommon.vue b/core/core-frontend/src/components/visualization/component-background/BackgroundOverallCommon.vue index 57659141b0..dacd980c78 100644 --- a/core/core-frontend/src/components/visualization/component-background/BackgroundOverallCommon.vue +++ b/core/core-frontend/src/components/visualization/component-background/BackgroundOverallCommon.vue @@ -15,38 +15,192 @@ /> - + - +
+ {{ + t('visualization.inner_padding_shorthand_mode') + }} + + + +
+ + +
+ {{ + t('visualization.edge_top') + }} + +
+
+ {{ + t('visualization.edge_left') + }} + +
+
+ +
+ {{ + t('visualization.edge_bottom') + }} + +
+
+ {{ + t('visualization.edge_right') + }} + +
+
+
- +
+ + - +
+ {{ + t('visualization.corner_shorthand_mode') + }} + + + +
+ + +
+ {{ + t('visualization.corner_top_left') + }} + +
+
+ {{ + t('visualization.corner_bottom_left') + }} + +
+
+ +
+ {{ + t('visualization.corner_top_right') + }} + +
+
+ {{ + t('visualization.corner_bottom_right') + }} + +
+
+
@@ -218,7 +372,7 @@ class="image-hint" :class="`image-hint_${themes}`" > - 支持JPG、PNG、GIF、SVG + {{ t('visualization.panel_background_image_tips') }} - 重新上传 + {{ t('visualization.reUpload') }} @@ -244,7 +398,7 @@