-
Notifications
You must be signed in to change notification settings - Fork 120
/
activityBar.ts
54 lines (50 loc) · 1.42 KB
/
activityBar.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
import React from 'react';
import { IMenuItemProps } from 'mo/components';
import type { HTMLElementProps, UniqueId } from 'mo/common/types';
/**
* The activity bar event definition
*/
export enum ActivityBarEvent {
OnClick = 'activityBar.onClick',
OnChange = 'activityBar.onChange',
/**
* Activity bar data changed
*/
DataChanged = 'activityBar.data',
ReRender = 'activityBar.reRender',
}
export interface IActivityBarItem extends HTMLElementProps {
id: UniqueId;
name?: React.ReactNode;
hidden?: boolean;
data?: any;
icon?: string | JSX.Element;
checked?: boolean;
disabled?: boolean;
type?: 'normal' | 'global';
contextMenu?: IActivityMenuItemProps[];
sortIndex?: number;
render?: () => React.ReactNode | JSX.Element;
}
export interface IActivityMenuItemProps extends IMenuItemProps {
id: UniqueId;
}
export interface IActivityBar {
data?: IActivityBarItem[];
contextMenu?: IActivityMenuItemProps[];
selected?: UniqueId;
}
export class ActivityBarModel implements IActivityBar {
public data: IActivityBarItem[];
public contextMenu: IActivityMenuItemProps[];
public selected: UniqueId;
constructor(
data: IActivityBarItem[] = [],
contextMenu: IActivityMenuItemProps[] = [],
selected: UniqueId = ''
) {
this.data = data;
this.contextMenu = contextMenu;
this.selected = selected;
}
}