1 | import { IBase } from '@antv/g-base';
|
2 | import { BBox, ListItem, LocationCfg, LocationType, OffsetPoint, Range } from './types';
|
3 | export interface IList {
|
4 | /**
|
5 | * 获取列表项
|
6 | * @return {ListItem[]} 列表项集合
|
7 | */
|
8 | getItems(): ListItem[];
|
9 | /**
|
10 | * 设置列表项
|
11 | * @param {ListItem[]} items 列表项集合
|
12 | */
|
13 | setItems(items: ListItem[]): any;
|
14 | /**
|
15 | * 更新列表项
|
16 | * @param {ListItem} item 列表项
|
17 | * @param {object} cfg 列表项
|
18 | */
|
19 | updateItem(item: ListItem, cfg: object): any;
|
20 | /**
|
21 | * 清空列表
|
22 | */
|
23 | clearItems(): any;
|
24 | /**
|
25 | * 设置列表项的状态
|
26 | * @param {ListItem} item 列表项
|
27 | * @param {string} state 状态名
|
28 | * @param {boolean} value 状态值, true, false
|
29 | */
|
30 | setItemState(item: ListItem, state: string, value: boolean): any;
|
31 | /**
|
32 | * 根据状态获取
|
33 | * @param {state} state 状态名
|
34 | * @return {ListItem[]} 列表项
|
35 | */
|
36 | getItemsByState(state: any): ListItem[];
|
37 | /**
|
38 | * 是否存在指定的状态
|
39 | * @param {ListItem} item 列表项
|
40 | * @param {string} state 状态名
|
41 | */
|
42 | hasState(item: ListItem, state: string): boolean;
|
43 | /**
|
44 | * 清楚所有列表项的状态
|
45 | * @param {string} state 状态值
|
46 | */
|
47 | clearItemsState(state: string): any;
|
48 | }
|
49 | export interface ISlider {
|
50 | /**
|
51 | * 设置可滑动范围
|
52 | * @param {number} min 最小值
|
53 | * @param {number} max 最大值
|
54 | */
|
55 | setRange(min: number, max: number): any;
|
56 | /**
|
57 | * 获取滑动的范围
|
58 | * @return {Range} 滑动范围
|
59 | */
|
60 | getRange(): Range;
|
61 | /**
|
62 | * 设置当前值,单值或者两个值
|
63 | * @param {number | number[]} value 值
|
64 | */
|
65 | setValue(value: number | number[]): any;
|
66 | /**
|
67 | * 获取当前值
|
68 | * @return {number|number[]} 当前值
|
69 | */
|
70 | getValue(): number | number[];
|
71 | }
|
72 | export interface ILocation<T extends LocationCfg = LocationCfg> {
|
73 | /**
|
74 | * 获取定位方式,point,points,region,circle,'none' 五种值
|
75 | * @return {LocationType} 定位方式
|
76 | */
|
77 | getLocationType(): LocationType;
|
78 | /**
|
79 | * 获取定位信息
|
80 | * @return {T} 定位信息
|
81 | */
|
82 | getLocation(): T;
|
83 | /**
|
84 | * 设置定位信息
|
85 | * @param {T} cfg 定位信息
|
86 | */
|
87 | setLocation(cfg: T): any;
|
88 | /**
|
89 | * 设置偏移量
|
90 | * @param {number} offsetX 偏移 x
|
91 | * @param {number} offsetY 偏移 y
|
92 | */
|
93 | setOffset(offsetX: number, offsetY: number): any;
|
94 | /**
|
95 | * 获取偏移信息
|
96 | * @return {OffsetPoint} 偏移信息
|
97 | */
|
98 | getOffset(): OffsetPoint;
|
99 | }
|
100 | export interface IComponent extends IBase {
|
101 | /**
|
102 | * 初始化组件
|
103 | */
|
104 | init(): void;
|
105 | /**
|
106 | * 是否是列表
|
107 | */
|
108 | isList(): boolean;
|
109 | /**
|
110 | * 是否是 slider
|
111 | */
|
112 | isSlider(): boolean;
|
113 | /**
|
114 | * 渲染组件
|
115 | */
|
116 | render(): any;
|
117 | /**
|
118 | * 更新组件
|
119 | * @param {object} cfg 更新的配置项
|
120 | */
|
121 | update(cfg: object): any;
|
122 | /**
|
123 | * 清空组件
|
124 | */
|
125 | clear(): any;
|
126 | /**
|
127 | * 组件在画布上的包围盒
|
128 | * @return {BBox} 包围盒
|
129 | */
|
130 | getBBox(): BBox;
|
131 | /**
|
132 | * 组件布局要求的包围盒,不一定等于 getBBox
|
133 | * @return {BBox} 包围盒
|
134 | */
|
135 | getLayoutBBox(): BBox;
|
136 | /**
|
137 | * 是否可以响应事件
|
138 | * @param capture 是否可以响应事件
|
139 | */
|
140 | setCapture(capture: boolean): void;
|
141 | /**
|
142 | * 显示
|
143 | */
|
144 | show(): any;
|
145 | /**
|
146 | * 隐藏
|
147 | */
|
148 | hide(): any;
|
149 | }
|