forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtypes.ts
More file actions
83 lines (70 loc) · 2.28 KB
/
types.ts
File metadata and controls
83 lines (70 loc) · 2.28 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
import { ReactElement, ComponentType } from 'react';
import {
IPublicTypeTitleContent,
IPublicTypeWidgetConfigArea,
IPublicTypeWidgetBaseConfig,
IPublicTypePanelDockProps,
IPublicTypePanelConfigProps,
IPublicTypePanelConfig,
} from '@felce/lowcode-types';
import { IWidget } from './widget/widget';
export interface WidgetConfig extends IPublicTypeWidgetBaseConfig {
type: 'Widget';
props?: {
align?: 'left' | 'right' | 'bottom' | 'center' | 'top';
onInit?: (widget: IWidget) => void;
title?: IPublicTypeTitleContent | null;
};
content?: string | ReactElement | ComponentType<any>; // children
}
export function isWidgetConfig(obj: any): obj is WidgetConfig {
return obj && obj.type === 'Widget';
}
export interface DockProps extends IPublicTypePanelDockProps {}
export interface DividerConfig extends IPublicTypeWidgetBaseConfig {
type: 'Divider';
props?: {
align?: 'left' | 'right' | 'center';
};
}
export function isDividerConfig(obj: any): obj is DividerConfig {
return obj && obj.type === 'Divider';
}
export interface IDockBaseConfig extends IPublicTypeWidgetBaseConfig {
props?: DockProps & {
align?: 'left' | 'right' | 'bottom' | 'center' | 'top';
onInit?: (widget: IWidget) => void;
};
}
export interface DockConfig extends IDockBaseConfig {
type: 'Dock';
content?: string | ReactElement | ComponentType<any>;
}
export function isDockConfig(obj: any): obj is DockConfig {
return obj && /Dock$/.test(obj.type);
}
// 按钮弹窗扩展
export interface DialogDockConfig extends IDockBaseConfig {
type: 'DialogDock';
dialogProps?: {
[key: string]: any;
title?: IPublicTypeTitleContent;
};
}
export function isDialogDockConfig(obj: any): obj is DialogDockConfig {
return obj && obj.type === 'DialogDock';
}
export function isPanelConfig(obj: any): obj is IPublicTypePanelConfig {
return obj && obj.type === 'Panel';
}
export interface PanelDockConfig extends IDockBaseConfig {
type: 'PanelDock';
panelName?: string;
panelProps?: IPublicTypePanelConfigProps & {
area?: IPublicTypeWidgetConfigArea;
};
content?: string | ReactElement | ComponentType<any> | IPublicTypePanelConfig[]; // content for pane
}
export function isPanelDockConfig(obj: any): obj is PanelDockConfig {
return obj && obj.type === 'PanelDock';
}