feat: 新增剪切

This commit is contained in:
MTrun
2022-02-04 12:17:50 +08:00
parent ad8cc8a003
commit 71e13c83e6
11 changed files with 224 additions and 45 deletions
@@ -1,17 +1,12 @@
import { getUUID } from '@/utils'
import { echartOptionProfixHandle } from '@/packages/utils/chart'
import { echartOptionProfixHandle, publicConfig } from '@/packages/utils'
import { BarCommonConfig } from './index'
import { ConfigType, CreateComponentType } from '@/packages/index.d'
import omit from 'lodash/omit'
export default class Config implements CreateComponentType {
public id = getUUID()
export default class Config extends publicConfig implements CreateComponentType {
public key = BarCommonConfig.key
public rename = undefined
public chartData: Exclude<ConfigType, ['node']> = omit(BarCommonConfig, ['node'])
public attr = { x: 0, y: 0, w: 500, h: 300 }
// 图表配置项
public option = echartOptionProfixHandle({
tooltip: {
@@ -34,10 +29,4 @@ export default class Config implements CreateComponentType {
}
]
})
// 设置坐标
public setPosition(x: number, y: number): void {
this.attr.x = x
this.attr.y = y
}
}
+6 -4
View File
@@ -13,14 +13,16 @@ export type ConfigType = {
}
// 组件实例类
export interface CreateComponentType {
export interface PublicConfigType {
id: string
key: string
rename?: string
attr: { x: number; y: number; w: number; h: number }
attr: { x: number; y: number; w: number; h: number; zIndex: number }
setPosition: Function
}
export interface CreateComponentType extends PublicConfigType {
key: string
chartData: ConfigType
option: object
setPosition: Function
}
// 包分类枚举
+1
View File
@@ -1 +1,2 @@
export * from '@/packages/utils/chart'
export * from '@/packages/utils/publicConfig'
+15
View File
@@ -0,0 +1,15 @@
import { getUUID } from '@/utils'
import { PublicConfigType } from '@/packages/index.d'
export class publicConfig implements PublicConfigType{
public id = getUUID()
// 重命名
public rename = undefined
// 基本信息
public attr = { x: 0, y: 0, w: 500, h: 300, zIndex: 0 }
// 设置坐标
public setPosition(x: number, y: number): void {
this.attr.x = x
this.attr.y = y
}
}