1 | import { View } from '../chart';
|
2 | import { ActionCallback, IAction, IInteractionContext } from '../interface';
|
3 | import Interaction from './interaction';
|
4 | export declare function parseAction(actionStr: string, context: IInteractionContext, arg?: any): ActionObject;
|
5 |
|
6 | export interface InteractionStep {
|
7 | |
8 |
|
9 |
|
10 | trigger: string;
|
11 | |
12 |
|
13 |
|
14 |
|
15 | isEnable?: (context: IInteractionContext) => boolean;
|
16 | |
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | action: string | string[] | ActionCallback;
|
23 | |
24 |
|
25 |
|
26 |
|
27 | arg?: any | any[];
|
28 | |
29 |
|
30 |
|
31 | callback?: (context: IInteractionContext) => void;
|
32 | |
33 |
|
34 |
|
35 |
|
36 | actionObject?: ActionObject | ActionObject[];
|
37 | |
38 |
|
39 |
|
40 | once?: boolean;
|
41 | |
42 |
|
43 |
|
44 | throttle?: ThrottleOption;
|
45 | |
46 |
|
47 |
|
48 | debounce?: DebounceOption;
|
49 | }
|
50 |
|
51 |
|
52 |
|
53 | export interface DebounceOption {
|
54 | |
55 |
|
56 |
|
57 | wait: number;
|
58 | |
59 |
|
60 |
|
61 | immediate?: boolean;
|
62 | }
|
63 |
|
64 |
|
65 |
|
66 | export interface ThrottleOption {
|
67 | |
68 |
|
69 |
|
70 | wait: number;
|
71 | |
72 |
|
73 |
|
74 | leading?: boolean;
|
75 | |
76 |
|
77 |
|
78 | trailing?: boolean;
|
79 | }
|
80 |
|
81 | interface ActionObject {
|
82 | |
83 |
|
84 |
|
85 | action: IAction;
|
86 | |
87 |
|
88 |
|
89 | methodName: string;
|
90 | |
91 |
|
92 |
|
93 | arg?: any;
|
94 | }
|
95 |
|
96 | export interface InteractionSteps {
|
97 | |
98 |
|
99 |
|
100 | showEnable?: InteractionStep[];
|
101 | |
102 |
|
103 |
|
104 | start?: InteractionStep[];
|
105 | |
106 |
|
107 |
|
108 | processing?: InteractionStep[];
|
109 | |
110 |
|
111 |
|
112 | end?: InteractionStep[];
|
113 | |
114 |
|
115 |
|
116 | rollback?: InteractionStep[];
|
117 | }
|
118 |
|
119 |
|
120 |
|
121 | export default class GrammarInteraction extends Interaction {
|
122 | private steps;
|
123 |
|
124 | currentStepName: string;
|
125 | |
126 |
|
127 |
|
128 | context: IInteractionContext;
|
129 | private callbackCaches;
|
130 | private emitCaches;
|
131 | constructor(view: View, steps: InteractionSteps);
|
132 | /**
|
133 | * 初始化
|
134 | */
|
135 | init(): void;
|
136 | /**
|
137 | * 清理资源
|
138 | */
|
139 | destroy(): void;
|
140 | /**
|
141 | * 绑定事件
|
142 | */
|
143 | protected initEvents(): void;
|
144 | /**
|
145 | * 清理绑定的事件
|
146 | */
|
147 | protected clearEvents(): void;
|
148 | private initContext;
|
149 | private isAllowStep;
|
150 | private isAllowExecute;
|
151 | private enterStep;
|
152 | private afterExecute;
|
153 | private getKey;
|
154 | private getActionCallback;
|
155 | private bindEvent;
|
156 | private offEvent;
|
157 | }
|
158 | export {};
|