| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- import { BaseEvent, EventLife, InteractEvents, InteractEventOn, InteractActionsType } from '@/enums/eventEnum'
- import type { GlobalThemeJsonType } from '@/settings/chartThemes/index'
- import type { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
- export enum ChartFrameEnum {
- // 支持 dataset 的 echarts 框架
- ECHARTS = 'echarts',
- // UI 组件框架
- NAIVE_UI = 'naiveUI',
- // 自定义带数据组件
- COMMON = 'common',
- // 无数据变更
- STATIC = 'static'
- }
- // 组件配置
- export type ConfigType = {
- // 组件 key
- key: string
- // 画布组件 key
- chartKey: string
- // 右侧设置面板组件 key
- conKey: string
- // 标题
- title: string
- // 分类
- category: string
- // 分类名称
- categoryName: string
- // 所属包
- package: string
- // 归类
- chartFrame?: ChartFrameEnum
- // 预览图
- image: string
- // 从指定路径创建创建该组件
- redirectComponent?: string
- // 组件预设的 dataset 值(图片/图标)
- dataset?: any
- // 禁用 拖拽或双击生成组件
- disabled?: boolean
- // 图标
- icon?: string
- // 事件
- configEvents?: { [T: string]: Function }
- }
- // 数据请求
- interface requestConfig {
- request: RequestConfigType
- }
- // Echarts 数据类型
- interface EchartsDataType {
- dimensions: string[]
- source: any[]
- }
- // 组件状态
- export interface StatusType {
- lock: boolean
- hide: boolean
- }
- // 滤镜/变换枚举
- export enum FilterEnum {
- // 是否启用
- FILTERS_SHOW = 'filterShow',
- // 透明度
- OPACITY = 'opacity',
- // 饱和度
- SATURATE = 'saturate',
- // 对比度
- CONTRAST = 'contrast',
- // 色相
- HUE_ROTATE = 'hueRotate',
- // 亮度
- BRIGHTNESS = 'brightness',
- // 旋转
- ROTATE_Z = 'rotateZ',
- ROTATE_X = 'rotateX',
- ROTATE_Y = 'rotateY',
- // 倾斜
- SKEW_X = 'skewX',
- SKEW_Y = 'skewY',
- // 混合模式
- BLEND_MODE = 'blendMode',
- //动画开关
- ANIMATIONS_OPEN = 'animationsOpen',
- //动画循环
- ANIMATIONS_CIRCULATE = 'animationsCirculate',
- //动画曲线
- ANIMATIONS_CURVE = 'animationsCurve',
- //动画方向
- ANIMATIONS_DIRECTION = 'animationsDirection',
- //动画时长
- CIRCULATE_PLAY_TIME = 'circulatePlayTime',
- //动画延迟时长
- CIRCULATE_DELAY_TIME = 'circulateDelayTime',
- //样式增强
- STYLE_ENHANCE= 'styleEnhance',
- }
- 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' }
- ]
- // 组件实例类
- export interface PublicConfigType {
- id: string
- isGroup: boolean
- attr: { x: number; y: number; w: number; h: number; zIndex: number; offsetX: number; offsetY: number }
- styles: {
- [FilterEnum.FILTERS_SHOW]: boolean
- [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
- [FilterEnum.BLEND_MODE]: string
- // 动画
- animations: string[]
- // // 动画开关
- [FilterEnum.ANIMATIONS_OPEN]: boolean,
- // 动画循环
- [FilterEnum.ANIMATIONS_CIRCULATE]: boolean,
- //动画播放速度曲线默认平滑
- [FilterEnum.ANIMATIONS_CURVE]: string,
- //动画方向
- [FilterEnum.ANIMATIONS_DIRECTION]: string,
- // 动画时长/秒
- [FilterEnum.CIRCULATE_PLAY_TIME]: number,
- // 动画延迟时长/秒
- [FilterEnum.CIRCULATE_DELAY_TIME]: number,
- // 样式自定义增强
- [FilterEnum.STYLE_ENHANCE]: string,
- }
- preview?: {
- // 预览超出隐藏
- overFlowHidden?: boolean
- }
- filter?: string
- status: StatusType
- interactActions?: InteractActionsType[]
- events: {
- baseEvent: {
- [K in BaseEvent]?: string
- }
- advancedEvents: {
- [K in EventLife]?: string
- }
- interactEvents: {
- [InteractEvents.INTERACT_ON]: InteractEventOn | undefined
- [InteractEvents.INTERACT_COMPONENT_ID]: string | undefined
- [InteractEvents.INTERACT_FN]: { [name: string]: string }
- }[]
- }
- }
- export interface CreateComponentType extends PublicConfigType, requestConfig {
- key: string
- chartConfig: ConfigType
- option: GlobalThemeJsonType
- groupList?: Array<CreateComponentType>
- }
- // 组件成组实例类
- export interface CreateComponentGroupType extends CreateComponentType {
- groupList: Array<CreateComponentType>
- }
- // 获取组件实例类中某个key对应value类型的方法
- export type PickCreateComponentType<T extends keyof CreateComponentType> = Pick<CreateComponentType, T>[T]
- // 包分类枚举
- export enum PackagesCategoryEnum {
- CHARTS = 'Charts',
- TABLES = 'Tables',
- INFORMATIONS = 'Informations',
- PHOTOS = 'Photos',
- ICONS = 'Icons',
- DECORATES = 'Decorates'
- }
- // 包分类名称
- export enum PackagesCategoryName {
- CHARTS = '图表',
- TABLES = '列表',
- INFORMATIONS = '信息',
- PHOTOS = '图片',
- ICONS = '图标',
- DECORATES = '小组件'
- }
- // 获取组件
- export enum FetchComFlagType {
- VIEW,
- CONFIG
- }
- // 图表包类型
- export type PackagesType = {
- [PackagesCategoryEnum.CHARTS]: ConfigType[]
- [PackagesCategoryEnum.INFORMATIONS]: ConfigType[]
- [PackagesCategoryEnum.TABLES]: ConfigType[]
- [PackagesCategoryEnum.PHOTOS]: ConfigType[]
- [PackagesCategoryEnum.ICONS]: ConfigType[]
- [PackagesCategoryEnum.DECORATES]: ConfigType[]
- }
|