fix: 新增多选的全部列表添加, 结构设计

This commit is contained in:
奔跑的面条
2022-08-05 21:12:05 +08:00
parent 857f811685
commit 4d560ab937
8 changed files with 100 additions and 35 deletions
+10 -3
View File
@@ -60,9 +60,8 @@ export enum FilterEnum {
}
// 组件实例类
export interface PublicConfigType extends requestConfig {
export interface PublicConfigType {
id: string
rename?: string
attr: { x: number; y: number; w: number; h: number; zIndex: number }
styles: {
[FilterEnum.OPACITY]: number;
@@ -84,12 +83,20 @@ export interface PublicConfigType extends requestConfig {
setPosition: Function
}
export interface CreateComponentType extends PublicConfigType {
export interface CreateComponentType extends PublicConfigType, requestConfig {
key: string
chartConfig: ConfigType
option: GlobalThemeJsonType
}
// 组件成组实例类 (部分属性用不到设置为 any)
export interface CreateComponentGroupType extends PublicConfigType {
chartConfig: {
categoryName: string
}
groupList: Array<CreateComponentType>
}
// 获取组件实例类中某个key对应value类型的方法
export type PickCreateComponentType<T extends keyof CreateComponentType> = Pick<CreateComponentType, T>[T]
+45 -3
View File
@@ -1,5 +1,5 @@
import { getUUID } from '@/utils'
import { PublicConfigType } from '@/packages/index.d'
import { PublicConfigType, CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
import { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
import {
RequestHttpEnum,
@@ -10,6 +10,7 @@ import {
} from '@/enums/httpEnum'
import { chartInitConfig } from '@/settings/designSetting'
// 请求基础属性
const requestConfig: RequestConfigType = {
requestDataType: RequestDataTypeEnum.STATIC,
requestHttpType: RequestHttpEnum.GET,
@@ -33,10 +34,9 @@ const requestConfig: RequestConfigType = {
}
}
// 单实例类
export class publicConfig implements PublicConfigType {
public id = getUUID()
// 重命名
public rename = undefined
// 基本信息
public attr = { ...chartInitConfig, zIndex: -1 }
// 基本样式
@@ -75,3 +75,45 @@ export class publicConfig implements PublicConfigType {
this.attr.y = y
}
}
// 成组类 (部分属性不需要, 不继承 publicConfig)
export class PublicGroupConfigClass implements CreateComponentGroupType {
public id = getUUID()
chartConfig = {
categoryName: '分组'
}
// 基本信息
public attr = { ...chartInitConfig, zIndex: -1 }
// 基本样式
public styles = {
// 色相
hueRotate: 0,
// 饱和度
saturate: 1,
// 对比度
contrast: 1,
// 亮度
brightness: 1,
// 透明
opacity: 1,
// 旋转
rotateZ: 0,
rotateX: 0,
rotateY: 0,
// 倾斜
skewX: 0,
skewY: 0,
// 动画
animations: []
}
// 组成员列表
public groupList: Array<CreateComponentType> = []
// 设置坐标
public setPosition(x: number, y: number): void {
this.attr.x = x
this.attr.y = y
}
}