index.d.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import type { GlobalThemeJsonType } from '@/settings/chartThemes/index'
  2. import type { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
  3. // 组件配置
  4. export type ConfigType = {
  5. key: string
  6. chartKey: string
  7. conKey: string
  8. title: string
  9. category: string
  10. categoryName: string
  11. package: string
  12. image: string | (() => Promise<typeof import('*.png')>)
  13. }
  14. // 数据请求
  15. interface requestConfig {
  16. data: RequestConfigType
  17. }
  18. // Echarts 数据类型
  19. interface EchartsDataType {
  20. dimensions: string[],
  21. source: any[]
  22. }
  23. // 组件实例类
  24. export interface PublicConfigType extends requestConfig {
  25. id: string
  26. rename?: string
  27. attr: { x: number; y: number; w: number; h: number; zIndex: number }
  28. styles: { opacity: number; animations: string[] }
  29. setPosition: Function
  30. }
  31. export interface CreateComponentType extends PublicConfigType {
  32. key: string
  33. chartConfig: ConfigType
  34. option: GlobalThemeJsonType
  35. }
  36. // 获取组件实例类中某个key对应value类型的方法
  37. export type PickCreateComponentType<T extends keyof CreateComponentType> = Pick<CreateComponentType,T>[T]
  38. // 包分类枚举
  39. export enum PackagesCategoryEnum {
  40. CHARTS = 'Charts',
  41. TABLES = 'Tables',
  42. INFORMATION = 'Informations',
  43. DECORATES = 'Decorates'
  44. }
  45. // 包分类名称
  46. export enum PackagesCategoryName {
  47. CHARTS = '图表',
  48. TABLES = '表格',
  49. INFORMATION = '信息',
  50. DECORATES = '小组件'
  51. }
  52. // 获取组件
  53. export enum FetchComFlagType {
  54. VIEW,
  55. CONFIG
  56. }
  57. // 图表包类型
  58. export type PackagesType = {
  59. [PackagesCategoryEnum.CHARTS]: ConfigType[]
  60. [PackagesCategoryEnum.INFORMATION]: ConfigType[]
  61. [PackagesCategoryEnum.TABLES]: ConfigType[]
  62. [PackagesCategoryEnum.DECORATES]: ConfigType[]
  63. }