-
Notifications
You must be signed in to change notification settings - Fork 120
/
explorer.tsx
54 lines (49 loc) · 1.35 KB
/
explorer.tsx
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
import React from 'react';
import { IActionBarItemProps } from 'mo/components/actionBar';
import type { UniqueId } from 'mo/common/types';
export enum ExplorerEvent {
onClick = 'explorer.onClick',
onPanelToolbarClick = 'explorer.onPanelToolbarClick',
onCollapseChange = 'explorer.onCollapseChange',
onRemovePanel = 'explorer.onRemovePanel',
}
export type RenderFunctionProps = (props) => React.ReactNode;
export interface IExplorerPanelItem {
/**
* It must be unique in the Explorer Panel Data
*/
id: UniqueId;
/**
* @requires true
* explorer panel's title
*/
name: string;
/**
* specify panel order
* the bigger the number is ranked previous
*/
sortIndex?: number;
className?: string;
toolbar?: IActionBarItemProps[];
renderPanel?: RenderFunctionProps;
/**
* whether hidden in explorer
*/
hidden?: boolean;
[key: string]: any;
}
export interface IExplorer {
data: IExplorerPanelItem[];
headerToolBar?: IActionBarItemProps;
}
export class IExplorerModel implements IExplorer {
public data: IExplorerPanelItem[];
public headerToolBar?: IActionBarItemProps;
constructor(
data: IExplorerPanelItem[] = [],
headerToolBar?: IActionBarItemProps
) {
this.data = data;
this.headerToolBar = headerToolBar;
}
}