goview_vue/src/packages/index.d.ts

74 lines
1.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-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-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-03-21 20:56:42 +08:00
data: RequestConfigType,
// 暂时约定为数据存储区域(未使用)
requestData: any
2022-03-17 20:18:46 +08:00
}
// Echarts 数据类型
interface EchartsDataType {
dimensions: string[],
source: any[]
}
2022-01-29 21:44:22 +08:00
// 组件实例类
2022-03-17 20:18:46 +08:00
export interface PublicConfigType extends requestConfig {
2022-01-29 21:44:22 +08:00
id: string
2022-02-03 22:54:31 +08:00
rename?: string
2022-02-04 12:17:50 +08:00
attr: { x: number; y: number; w: number; h: number; zIndex: number }
2022-03-17 20:18:46 +08:00
styles: { opacity: number; animations: string[] }
2022-02-04 12:17:50 +08:00
setPosition: Function
}
export interface CreateComponentType extends PublicConfigType {
key: string
2022-03-17 20:18:46 +08:00
chartConfig: ConfigType
option: GlobalThemeJsonType
2022-01-29 21:44:22 +08:00
}
2022-02-25 21:26:56 +08:00
// 获取组件实例类中某个key对应value类型的方法
2022-03-17 20:18:46 +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',
INFORMATION = '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 = '图表',
TABLES = '表格',
INFORMATION = '信息',
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-01-15 12:50:00 +08:00
[PackagesCategoryEnum.INFORMATION]: ConfigType[]
2022-01-14 22:07:02 +08:00
[PackagesCategoryEnum.TABLES]: ConfigType[]
[PackagesCategoryEnum.DECORATES]: ConfigType[]
2022-01-15 21:54:04 +08:00
}