-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
constant.ts
113 lines (102 loc) · 2.63 KB
/
constant.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
* view 中三层 group 分层 key
*/
export enum LAYER {
/** 前景层 */
FORE = 'fore',
/** 中间层 */
MID = 'mid',
/** 背景层 */
BG = 'bg',
}
/**
* 组件在画布的布局方位 12 方位
*/
export enum DIRECTION {
TOP = 'top',
TOP_LEFT = 'top-left',
TOP_RIGHT = 'top-right',
RIGHT = 'right',
RIGHT_TOP = 'right-top',
RIGHT_BOTTOM = 'right-bottom',
LEFT = 'left',
LEFT_TOP = 'left-top',
LEFT_BOTTOM = 'left-bottom',
BOTTOM = 'bottom',
BOTTOM_LEFT = 'bottom-left',
BOTTOM_RIGHT = 'bottom-right',
// no direction information
NONE = 'none',
}
/**
* 组件的类型,可能会影响到布局算法
*/
export enum COMPONENT_TYPE {
/** axis 组件 */
AXIS = 'axis',
/** grid 组件 */
GRID = 'grid',
/** legend 组件 */
LEGEND = 'legend',
/** tooltip 组件 */
TOOLTIP = 'tooltip',
/** annotation 组件 */
ANNOTATION = 'annotation',
/** 其他组件,自定义组件 */
OTHER = 'other',
}
/**
* 三层 group 的 z index
*/
export const GROUP_Z_INDEX = {
FORE: 3,
MID: 2,
BG: 1,
};
/**
* View 的生命周期阶段(和 3.x 的生命周期略有不同)
* 我们需要先确定在那写场景需要用到生命周期,如果只是为了在生命周期插入一下什么组件之类的,那么在现有架构就是不需要的
*/
export enum VIEW_LIFE_CIRCLE {
BEFORE_RENDER = 'beforerender',
AFTER_RENDER = 'afterrender',
BEFORE_PAINT = 'beforepaint',
AFTER_PAINT = 'afterpaint',
BEFORE_CHANGE_DATA = 'beforechangedata',
AFTER_CHANGE_DATA = 'afterchangedata',
BEFORE_CLEAR = 'beforeclear',
AFTER_CLEAR = 'afterclear',
BEFORE_DESTROY = 'beforedestroy',
}
/**
* 绘图区的事件列表
*/
export enum PLOT_EVENTS {
// mouse 事件
MOUSE_ENTER = 'plot:mouseenter',
MOUSE_DOWN = 'plot:mousedown',
MOUSE_MOVE = 'plot:mousemove',
MOUSE_UP = 'plot:mouseup',
MOUSE_LEAVE = 'plot:mouseleave',
// 移动端事件
TOUCH_START = 'plot:touchstart',
TOUCH_MOVE = 'plot:touchmove',
TOUCH_END = 'plot:touchend',
TOUCH_CANCEL = 'plot:touchcancel',
// click 事件
CLICK = 'plot:click',
DBLCLICK = 'plot:dblclick',
CONTEXTMENU = 'plot:contextmenu',
LEAVE = 'plot:leave',
ENTER = 'plot:enter',
}
/** 参与分组的图形属性名 */
export const GROUP_ATTRS = ['color', 'shape', 'size'];
/** 存储原始数据的字段名 */
export const FIELD_ORIGIN = '_origin';
/** 最小的图表宽度 */
export const MIN_CHART_WIDTH = 1;
/** 最小的图表高度 */
export const MIN_CHART_HEIGHT = 1;
/** 辅助组件占图表的尺寸的最大比例:如图表上方的图例最多占图表高度的25% */
export const COMPONENT_MAX_VIEW_PERCENTAGE = 0.25;