forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcommonUI.tsx
More file actions
109 lines (99 loc) · 2.7 KB
/
commonUI.tsx
File metadata and controls
109 lines (99 loc) · 2.7 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import {
IPublicApiCommonUI,
IPublicModelPluginContext,
IPublicTypeContextMenuAction,
} from '@felce/lowcode-types';
import { HelpTip, IEditor, Tip as InnerTip, Title as InnerTitle } from '@felce/lowcode-editor-core';
import {
Balloon,
Breadcrumb,
Button,
Card,
Checkbox,
DatePicker,
Dialog,
Dropdown,
Form,
Icon,
Input,
Loading,
Message,
Overlay,
Pagination,
Radio,
Search,
Select,
SplitButton,
Step,
Switch,
Tab,
Table,
Tree,
TreeSelect,
Upload,
Divider,
} from '@alifd/next';
import { ContextMenu } from '../components/context-menu';
import { editorSymbol } from '../symbols';
import { ReactElement } from 'react';
export class CommonUI implements IPublicApiCommonUI {
[editorSymbol]: IEditor;
Balloon: typeof Balloon = Balloon;
Breadcrumb: typeof Breadcrumb = Breadcrumb;
Button: typeof Button = Button;
Card: typeof Card = Card;
Checkbox: typeof Checkbox = Checkbox;
DatePicker: typeof DatePicker = DatePicker;
Dialog: typeof Dialog = Dialog;
Dropdown: typeof Dropdown = Dropdown;
Form: typeof Form = Form;
Icon: typeof Icon = Icon;
Input: typeof Input = Input;
Loading: typeof Loading = Loading;
Message: typeof Message = Message;
Overlay: typeof Overlay = Overlay;
Pagination: typeof Pagination = Pagination;
Radio: typeof Radio = Radio;
Search: typeof Search = Search;
Select: typeof Select = Select;
SplitButton: typeof SplitButton = SplitButton;
Step: typeof Step = Step;
Switch: typeof Switch = Switch;
Tab: typeof Tab = Tab;
Table: typeof Table = Table;
Tree: typeof Tree = Tree;
TreeSelect: typeof TreeSelect = TreeSelect;
Upload: typeof Upload = Upload;
Divider: typeof Divider = Divider;
ContextMenu: ((props: {
menus: IPublicTypeContextMenuAction[];
children: React.ReactElement[] | React.ReactElement;
}) => ReactElement) & {
create(menus: IPublicTypeContextMenuAction[], event: MouseEvent | React.MouseEvent): void;
};
constructor(editor: IEditor) {
this[editorSymbol] = editor;
const innerContextMenu = (props: any) => {
const pluginContext: IPublicModelPluginContext = editor.get(
'pluginContext',
) as IPublicModelPluginContext;
return <ContextMenu {...props} pluginContext={pluginContext} />;
};
innerContextMenu.create = (menus: IPublicTypeContextMenuAction[], event: MouseEvent) => {
const pluginContext: IPublicModelPluginContext = editor.get(
'pluginContext',
) as IPublicModelPluginContext;
return ContextMenu.create(pluginContext, menus, event);
};
this.ContextMenu = innerContextMenu;
}
get Tip() {
return InnerTip;
}
get HelpTip() {
return HelpTip;
}
get Title() {
return InnerTitle;
}
}