bi-sdk-react 0.0.51 → 0.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/js/bi-sdk.es.js +103 -38
- package/dist/types/components/context/PageContext.d.ts +12 -0
- package/dist/types/components/hooks/event.d.ts +4 -0
- package/dist/types/components/hooks/method.d.ts +4 -0
- package/dist/types/components/panel/EventPanel.d.ts +2 -0
- package/dist/types/components/plugins/@antd/items/EchartsRender.d.ts +2 -2
- package/dist/types/components/typing.d.ts +13 -1
- package/dist/umd/js/bi-sdk.umd.min.js +104 -39
- package/package.json +1 -1
- package/src/components/PageDesigner.tsx +57 -41
- package/src/components/context/PageContext.tsx +54 -1
- package/src/components/dnd/DropContainer.tsx +0 -1
- package/src/components/hooks/event.ts +68 -0
- package/src/components/hooks/method.ts +13 -0
- package/src/components/icon/IconFont.tsx +1 -1
- package/src/components/panel/EventPanel.tsx +186 -0
- package/src/components/panel/ScriptPanel.tsx +1 -1
- package/src/components/plugins/@antd/index.ts +9 -1
- package/src/components/plugins/@antd/item-props/DrawerProps.tsx +18 -1
- package/src/components/plugins/@antd/item-props/ModalProps.tsx +18 -1
- package/src/components/plugins/@antd/items/ButtonRender.tsx +3 -0
- package/src/components/plugins/@antd/items/DrawerRender.tsx +15 -6
- package/src/components/plugins/@antd/items/EchartsRender.tsx +30 -3
- package/src/components/plugins/@antd/items/HtmlRender.tsx +1 -1
- package/src/components/plugins/@antd/items/ModalRender.tsx +14 -2
- package/src/components/typing.ts +13 -1
- package/src/example.tsx +1 -1
- package/dist/types/components/context/DesignerContext.d.ts +0 -18
- package/dist/types/components/context/EnvContext.d.ts +0 -16
|
@@ -3,6 +3,11 @@ type InitCallbackParams = {
|
|
|
3
3
|
id: string;
|
|
4
4
|
callback: CallbackType;
|
|
5
5
|
};
|
|
6
|
+
type MethodParams = {
|
|
7
|
+
sourceId: string;
|
|
8
|
+
arg?: any;
|
|
9
|
+
};
|
|
10
|
+
type MethodType = Record<string, (params?: MethodParams) => any>;
|
|
6
11
|
type PageContextType = {
|
|
7
12
|
pageId: string;
|
|
8
13
|
designable: boolean;
|
|
@@ -24,8 +29,15 @@ type PageContextType = {
|
|
|
24
29
|
setDeviceWidth: (width: number) => void;
|
|
25
30
|
initCallback: ({ id, callback }: InitCallbackParams) => any;
|
|
26
31
|
handleCallback: (item: SchemaItemType, refresh?: boolean, consume?: (item: Omit<SchemaItemType, "children">, data: any) => void) => void;
|
|
32
|
+
initMethod: ({ id, method, }: {
|
|
33
|
+
id: string;
|
|
34
|
+
method: MethodType;
|
|
35
|
+
}) => any;
|
|
36
|
+
handleMethod: (item: SchemaItemType, targetId: string, methodName: string, arg?: any) => any;
|
|
27
37
|
getVars: (id: string) => Record<string, any>;
|
|
28
38
|
setVar: (item: SchemaItemType, key: string, value: any) => void;
|
|
39
|
+
getGlobalVar: (key: string) => string | undefined | null;
|
|
40
|
+
setGlobalVar: (key: string, value: any) => void;
|
|
29
41
|
setItemData?: (id: string, data: any) => void;
|
|
30
42
|
};
|
|
31
43
|
export declare const PageContext: import("react").Context<PageContextType>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "echarts-wordcloud";
|
|
2
2
|
import "echarts-liquidfill";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { HtmlBaseProps } from "../../../typing";
|
|
4
|
+
import { HtmlBaseProps, SchemaItemType } from "../../../typing";
|
|
5
5
|
export type EchartsRenderProps = {
|
|
6
|
-
item:
|
|
6
|
+
item: SchemaItemType;
|
|
7
7
|
title?: string;
|
|
8
8
|
script?: string;
|
|
9
9
|
height?: number;
|
|
@@ -106,6 +106,10 @@ export type SchemaItemType = {
|
|
|
106
106
|
custom?: string | null;
|
|
107
107
|
dataset?: DataSetType;
|
|
108
108
|
};
|
|
109
|
+
events?: {
|
|
110
|
+
name: string;
|
|
111
|
+
script: string;
|
|
112
|
+
}[];
|
|
109
113
|
};
|
|
110
114
|
export type PluginType = {
|
|
111
115
|
group: string;
|
|
@@ -114,7 +118,15 @@ export type PluginType = {
|
|
|
114
118
|
icon: string;
|
|
115
119
|
component: React.FC<any>;
|
|
116
120
|
formComponent?: React.FC<any>;
|
|
117
|
-
defaultOptions?: Pick<SchemaItemType, "props" | "children" | "cascadeIds" | "datasource" | "style">;
|
|
121
|
+
defaultOptions?: Pick<SchemaItemType, "props" | "children" | "cascadeIds" | "datasource" | "events" | "style">;
|
|
122
|
+
events?: {
|
|
123
|
+
name: string;
|
|
124
|
+
handler: string;
|
|
125
|
+
}[];
|
|
126
|
+
methods?: {
|
|
127
|
+
name: string;
|
|
128
|
+
handler: string;
|
|
129
|
+
}[];
|
|
118
130
|
};
|
|
119
131
|
type NameValue = {
|
|
120
132
|
name?: string;
|