1 | import { ComponentOption } from '../../interface';
|
2 | import View from '../view';
|
3 |
|
4 | export declare type ControllerCtor<O = any> = new (view: View) => Controller<O>;
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | export declare abstract class Controller<O = unknown> {
|
12 |
|
13 | visible: boolean;
|
14 | protected view: View;
|
15 |
|
16 | protected option: O;
|
17 |
|
18 | protected components: ComponentOption[];
|
19 | constructor(view: View);
|
20 | abstract get name(): string;
|
21 | /**
|
22 | * init the component
|
23 | */
|
24 | abstract init(): any;
|
25 | /**
|
26 | * render the components
|
27 | */
|
28 | abstract render(): any;
|
29 | /**
|
30 | * update the components
|
31 | */
|
32 | /**
|
33 | * do layout
|
34 | */
|
35 | abstract layout(): any;
|
36 | /**
|
37 | * 组件的更新逻辑
|
38 | * - 根据字段为标识,为每一个组件生成一个 id,放到 option 中
|
39 | * - 更新的时候按照 id 去做 diff,然后对同的做处理
|
40 | * - 创建增加的
|
41 | * - 更新已有的
|
42 | * - 销毁删除的
|
43 | */
|
44 | abstract update(): any;
|
45 | /**
|
46 | * clear
|
47 | * @param includeOption 是否清空 option 配置项(used in annotation)
|
48 | */
|
49 | clear(includeOption?: boolean): void;
|
50 | /**
|
51 | * destroy the component
|
52 | */
|
53 | destroy(): void;
|
54 | /**
|
55 | * get all components
|
56 | * @returns components array
|
57 | */
|
58 | getComponents(): ComponentOption[];
|
59 | /**
|
60 | * change visibility of component
|
61 | * @param visible
|
62 | */
|
63 | changeVisible(visible: boolean): void;
|
64 | }
|