From 13036b68a7870903986d89cf01d0b7aa2fc37c1a Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 19 Aug 2024 13:13:35 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E5=A4=A7=E5=B1=8F=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=92=8C=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-visualization/canvas/CanvasCore.vue | 3 +- .../canvas/ComponentWrapper.vue | 16 ++++++++++- .../data-visualization/canvas/DePreview.vue | 9 +----- .../visualization/common/DeFullscreen.vue | 2 +- .../custom-component/common/CommonAttr.vue | 1 + core/core-frontend/src/utils/style.ts | 11 ++++---- .../editor/editor-style/ChartStyle.vue | 1 + .../views/components/ChartComponentG2Plot.vue | 28 +++++++++++-------- 8 files changed, 42 insertions(+), 29 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue index ca518daa2c..a0bc770939 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue @@ -539,7 +539,8 @@ const getShapeItemShowStyle = item => { dvModel: dvInfo.value.type, cellWidth: cellWidth.value, cellHeight: cellHeight.value, - curGap: curGap.value + curGap: curGap.value, + showPosition: 'edit' }) } 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 6aa71fcec4..f96d6e05d6 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,20 @@ const componentEditBarRef = ref(null) const dvMainStore = dvMainStoreWithOut() const downLoading = ref(false) +const commonFilterAttrs = ['width', 'height', 'top', 'left', 'rotate'] +const commonFilterAttrsFilterBorder = [ + 'width', + 'height', + 'top', + 'left', + 'rotate', + 'borderActive', + 'borderWidth', + 'borderRadius', + 'borderStyle', + 'borderColor' +] + const props = defineProps({ active: { type: Boolean, @@ -144,7 +158,7 @@ const getComponentStyleDefault = style => { if (config.value.component.includes('Svg')) { return getStyle(style, ['top', 'left', 'width', 'height', 'rotate', 'backgroundColor']) } else { - return getStyle(style, ['top', 'left', 'width', 'height', 'rotate']) + return getStyle(style, style.borderActive ? commonFilterAttrs : commonFilterAttrsFilterBorder) } } diff --git a/core/core-frontend/src/components/data-visualization/canvas/DePreview.vue b/core/core-frontend/src/components/data-visualization/canvas/DePreview.vue index 08460a51be..7e0e43281d 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/DePreview.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/DePreview.vue @@ -192,14 +192,6 @@ const resetLayout = () => { //div容器获取tableBox.value.clientWidth let canvasWidth = previewCanvas.value.clientWidth let canvasHeight = previewCanvas.value.clientHeight - console.log( - '===canvasId=' + - canvasId.value + - ';canvasWidth =' + - canvasWidth + - ';canvasHeight =' + - canvasHeight - ) scaleWidthPoint.value = (canvasWidth * 100) / canvasStyleData.value.width scaleHeightPoint.value = (canvasHeight * 100) / canvasStyleData.value.height scaleMin.value = isDashboard() @@ -220,6 +212,7 @@ const resetLayout = () => { scaleMin.value, scaleMinHeight ) + scaleMin.value = isMainCanvas(canvasId.value) ? scaleMin.value : outerScale.value * 100 } renderReady.value = true emits('onResetLayout') diff --git a/core/core-frontend/src/components/visualization/common/DeFullscreen.vue b/core/core-frontend/src/components/visualization/common/DeFullscreen.vue index 5ae9de0c68..f197259c4b 100644 --- a/core/core-frontend/src/components/visualization/common/DeFullscreen.vue +++ b/core/core-frontend/src/components/visualization/common/DeFullscreen.vue @@ -21,7 +21,7 @@ const props = defineProps({ default: 'preview' } }) -const { themes, componentType } = toRefs(props) +const { themes } = toRefs(props) const fullscreenChange = () => { if (screenfull.isEnabled) { diff --git a/core/core-frontend/src/custom-component/common/CommonAttr.vue b/core/core-frontend/src/custom-component/common/CommonAttr.vue index 385ce77957..10187f4042 100644 --- a/core/core-frontend/src/custom-component/common/CommonAttr.vue +++ b/core/core-frontend/src/custom-component/common/CommonAttr.vue @@ -187,6 +187,7 @@ const stopEvent = e => { { } let myChart = null const renderG2Plot = async (chart, chartView: G2PlotChartView) => { - myChart?.destroy() - myChart = await chartView.drawChart({ - chartObj: myChart, - container: containerId, - chart: chart, - scale: 1, - action, - quadrantDefaultBaseline - }) - myChart?.render() - if (linkageActiveHistory.value) { - linkageActive() + try { + myChart?.destroy() + myChart = await chartView.drawChart({ + chartObj: myChart, + container: containerId, + chart: chart, + scale: 1, + action, + quadrantDefaultBaseline + }) + myChart?.render() + if (linkageActiveHistory.value) { + linkageActive() + } + } catch (e) { + console.error('renderG2Plot error', e) } }