feat: 新增图表外层
This commit is contained in:
parent
be28b2990f
commit
f44d119f16
3
src/views/chart/ContentEdit/components/ShapeBox/index.ts
Normal file
3
src/views/chart/ContentEdit/components/ShapeBox/index.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import ShapeBox from './index.vue'
|
||||||
|
|
||||||
|
export { ShapeBox }
|
13
src/views/chart/ContentEdit/components/ShapeBox/index.vue
Normal file
13
src/views/chart/ContentEdit/components/ShapeBox/index.vue
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<template>
|
||||||
|
<div class="go-shape-box">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@include go(shape-box) {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
</style>
|
@ -10,8 +10,13 @@ export const useComponentStyle = (attr: AttrType, index: number) => {
|
|||||||
zIndex: index,
|
zIndex: index,
|
||||||
left: `${attr.x}px`,
|
left: `${attr.x}px`,
|
||||||
top: `${attr.y}px`,
|
top: `${attr.y}px`,
|
||||||
width: `${attr.w}px`,
|
|
||||||
height: `${attr.h}px`
|
|
||||||
}
|
}
|
||||||
return componentStyle
|
return componentStyle
|
||||||
}
|
}
|
||||||
|
export const useSizeStyle = (attr: AttrType) => {
|
||||||
|
const sizeStyle = {
|
||||||
|
width: `${attr.w}px`,
|
||||||
|
height: `${attr.h}px`
|
||||||
|
}
|
||||||
|
return sizeStyle
|
||||||
|
}
|
||||||
|
@ -12,14 +12,19 @@
|
|||||||
<div id="go-chart-edit-content">
|
<div id="go-chart-edit-content">
|
||||||
<!-- 展示 -->
|
<!-- 展示 -->
|
||||||
<EditRange>
|
<EditRange>
|
||||||
<component
|
<ShapeBox
|
||||||
class="edit-content-chart"
|
|
||||||
v-for="(item, index) in chartEditStore.getComponentList"
|
v-for="(item, index) in chartEditStore.getComponentList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
:index="index"
|
||||||
|
:style="useComponentStyle(item.attr, index)"
|
||||||
|
>
|
||||||
|
<component
|
||||||
|
class="edit-content-chart"
|
||||||
:is="item.key"
|
:is="item.key"
|
||||||
:chartData="item"
|
:chartData="item"
|
||||||
:style="useComponentStyle(item.attr, index)"
|
:style="useSizeStyle(item.attr)"
|
||||||
/>
|
/>
|
||||||
|
</ShapeBox>
|
||||||
</EditRange>
|
</EditRange>
|
||||||
</div>
|
</div>
|
||||||
<!-- 底部控制 -->
|
<!-- 底部控制 -->
|
||||||
@ -34,10 +39,11 @@ import { onUnmounted, onMounted, toRefs } from 'vue'
|
|||||||
import { ContentBox } from '../ContentBox/index'
|
import { ContentBox } from '../ContentBox/index'
|
||||||
import { EditRange } from './components/EditRange'
|
import { EditRange } from './components/EditRange'
|
||||||
import { EditBottom } from './components/EditBottom'
|
import { EditBottom } from './components/EditBottom'
|
||||||
|
import { ShapeBox } from './components/ShapeBox/index'
|
||||||
import { useLayout } from './hooks/useLayout.hook'
|
import { useLayout } from './hooks/useLayout.hook'
|
||||||
import { handleDrop, handleDragOver } from './hooks/useDrop.hook'
|
import { handleDrop, handleDragOver } from './hooks/useDrop.hook'
|
||||||
import { getChartEditStore } from './hooks/useStore.hook'
|
import { getChartEditStore } from './hooks/useStore.hook'
|
||||||
import { useComponentStyle } from './hooks/useStyle.hook'
|
import { useComponentStyle, useSizeStyle } from './hooks/useStyle.hook'
|
||||||
|
|
||||||
const chartEditStore = getChartEditStore()
|
const chartEditStore = getChartEditStore()
|
||||||
|
|
||||||
@ -50,19 +56,17 @@ useLayout()
|
|||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@include background-image("background-point");
|
@include background-image('background-point');
|
||||||
@extend .go-point-bg;
|
@extend .go-point-bg;
|
||||||
@include goId(chart-edit-content) {
|
@include goId(chart-edit-content) {
|
||||||
position: relative;
|
margin: 20px;
|
||||||
top: 20px;
|
overflow: hidden;
|
||||||
left: 20px;
|
|
||||||
transform-origin: left top;
|
transform-origin: left top;
|
||||||
border: 1px solid rgba(0, 0, 0, 0);
|
border: 1px solid rgba(0, 0, 0, 0);
|
||||||
overflow: hidden;
|
|
||||||
@extend .go-transition;
|
@extend .go-transition;
|
||||||
&.content-resize {
|
&.content-resize {
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
@include hover-border-color("hover-border-color");
|
@include hover-border-color('hover-border-color');
|
||||||
}
|
}
|
||||||
.edit-content-chart {
|
.edit-content-chart {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user