goview_vue/src/packages/index.d.ts

164 lines
3.8 KiB
TypeScript
Raw Normal View History

2022-03-17 20:18:46 +08:00
import type { GlobalThemeJsonType } from '@/settings/chartThemes/index'
import type { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
2022-01-14 16:17:14 +08:00
2022-06-25 17:44:21 +08:00
export enum ChartFrameEnum {
// 支持 dataset 的 echarts 框架
2022-06-25 17:44:21 +08:00
ECHARTS = 'echarts',
// UI 组件框架
NAIVE_UI = 'naiveUI',
// 自定义带数据组件
COMMON = 'common',
// 无数据变更
STATIC = 'static'
2022-06-25 17:44:21 +08:00
}
2022-01-29 21:44:22 +08:00
// 组件配置
2022-01-14 16:17:14 +08:00
export type ConfigType = {
key: string
2022-03-17 20:18:46 +08:00
chartKey: string
conKey: string
2022-01-14 16:17:14 +08:00
title: string
2022-01-14 22:07:02 +08:00
category: string
categoryName: string
2022-01-25 11:09:32 +08:00
package: string
2022-06-25 17:44:21 +08:00
chartFrame?: ChartFrameEnum
2022-01-15 21:54:04 +08:00
image: string | (() => Promise<typeof import('*.png')>)
2022-01-14 16:17:14 +08:00
}
2022-03-17 20:18:46 +08:00
// 数据请求
interface requestConfig {
2022-08-06 13:04:25 +08:00
request: RequestConfigType
2022-03-17 20:18:46 +08:00
}
// Echarts 数据类型
interface EchartsDataType {
2022-08-06 13:04:25 +08:00
dimensions: string[]
source: any[]
}
2022-04-25 16:17:22 +08:00
// 组件状态
export interface StatusType {
lock: boolean
hide: boolean
}
2022-05-03 16:24:31 +08:00
// 滤镜/变换枚举
2022-04-25 16:17:22 +08:00
export enum FilterEnum {
// 是否启用
FILTERS_SHOW = 'filterShow',
2022-05-03 16:24:31 +08:00
// 透明度
OPACITY = 'opacity',
// 饱和度
2022-04-25 16:17:22 +08:00
SATURATE = 'saturate',
2022-05-03 16:24:31 +08:00
// 对比度
2022-04-25 16:17:22 +08:00
CONTRAST = 'contrast',
2022-05-03 16:24:31 +08:00
// 色相
HUE_ROTATE = 'hueRotate',
// 亮度
BRIGHTNESS = 'brightness',
// 旋转
ROTATE_Z = 'rotateZ',
ROTATE_X = 'rotateX',
ROTATE_Y = 'rotateY',
// 倾斜
SKEW_X = 'skewX',
SKEW_Y = 'skewY',
// 混合模式
2022-10-08 11:43:38 +08:00
BLEND_MODE = 'blendMode'
2022-04-25 16:17:22 +08:00
}
export const BlendModeEnumList = [
{ label: '正常', value: 'normal' },
{ label: '正片叠底', value: 'multiply' },
{ label: '叠加', value: 'overlay' },
{ label: '滤色', value: 'screen' },
{ label: '变暗', value: 'darken' },
{ label: '变亮', value: 'lighten' },
{ label: '颜色减淡', value: 'color-dodge' },
{ label: '颜色加深', value: 'color-burn;' },
{ label: '强光', value: 'hard-light' },
{ label: '柔光', value: 'soft-light' },
{ label: '差值', value: 'difference' },
{ label: '排除', value: 'exclusion' },
{ label: '色相', value: 'hue' },
{ label: '饱和度', value: 'saturation' },
{ label: '颜色', value: 'color' },
{ label: '亮度', value: 'luminosity' }
]
2022-01-29 21:44:22 +08:00
// 组件实例类
export interface PublicConfigType {
2022-01-29 21:44:22 +08:00
id: string
2022-08-06 13:04:25 +08:00
isGroup: boolean
attr: { x: number; y: number; w: number; h: number; zIndex: number; offsetX: number; offsetY: number }
2022-04-19 22:07:54 +08:00
styles: {
[FilterEnum.FILTERS_SHOW]: boolean
2022-08-06 13:04:25 +08:00
[FilterEnum.OPACITY]: number
[FilterEnum.SATURATE]: number
[FilterEnum.CONTRAST]: number
[FilterEnum.HUE_ROTATE]: number
[FilterEnum.BRIGHTNESS]: number
[FilterEnum.ROTATE_Z]: number
[FilterEnum.ROTATE_X]: number
[FilterEnum.ROTATE_Y]: number
[FilterEnum.SKEW_X]: number
[FilterEnum.SKEW_Y]: number
2022-10-08 11:43:38 +08:00
[FilterEnum.BLEND_MODE]: string
2022-04-19 22:07:54 +08:00
// 动画
animations: string[]
}
filter?: string
status: StatusType
2022-02-04 12:17:50 +08:00
setPosition: Function
}
2022-04-25 16:17:22 +08:00
export interface CreateComponentType extends PublicConfigType, requestConfig {
2022-02-04 12:17:50 +08:00
key: string
2022-03-17 20:18:46 +08:00
chartConfig: ConfigType
option: GlobalThemeJsonType
2022-01-29 21:44:22 +08:00
}
2022-08-15 11:43:32 +08:00
// 组件成组实例类
export interface CreateComponentGroupType extends CreateComponentType {
groupList: Array<CreateComponentType>
}
2022-02-25 21:26:56 +08:00
// 获取组件实例类中某个key对应value类型的方法
2022-06-25 17:44:21 +08:00
export type PickCreateComponentType<T extends keyof CreateComponentType> = Pick<CreateComponentType, T>[T]
2022-02-25 21:26:56 +08:00
2022-01-29 21:44:22 +08:00
// 包分类枚举
2022-01-14 22:07:02 +08:00
export enum PackagesCategoryEnum {
2022-01-25 11:09:32 +08:00
CHARTS = 'Charts',
TABLES = 'Tables',
2022-04-01 16:36:22 +08:00
INFORMATIONS = 'Informations',
2022-01-27 23:16:51 +08:00
DECORATES = 'Decorates'
2022-01-15 21:54:04 +08:00
}
2022-01-29 21:44:22 +08:00
// 包分类名称
2022-01-15 21:54:04 +08:00
export enum PackagesCategoryName {
CHARTS = '图表',
2022-04-01 16:36:22 +08:00
TABLES = '列表',
INFORMATIONS = '信息',
2022-01-27 23:16:51 +08:00
DECORATES = '小组件'
2022-01-14 16:17:14 +08:00
}
2022-01-14 22:07:02 +08:00
2022-03-10 10:14:52 +08:00
// 获取组件
export enum FetchComFlagType {
2022-03-17 20:18:46 +08:00
VIEW,
CONFIG
2022-03-10 10:14:52 +08:00
}
2022-01-29 21:44:22 +08:00
// 图表包类型
2022-01-14 22:07:02 +08:00
export type PackagesType = {
[PackagesCategoryEnum.CHARTS]: ConfigType[]
2022-04-01 16:36:22 +08:00
[PackagesCategoryEnum.INFORMATIONS]: ConfigType[]
2022-01-14 22:07:02 +08:00
[PackagesCategoryEnum.TABLES]: ConfigType[]
[PackagesCategoryEnum.DECORATES]: ConfigType[]
2022-01-15 21:54:04 +08:00
}