bi-sdk-react 0.0.54 → 0.0.55
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 +55 -41
- package/dist/types/components/context/GlobalDatasetContext.d.ts +7 -0
- package/dist/types/components/context/PageContext.d.ts +6 -3
- package/dist/types/components/hooks/method.d.ts +1 -0
- package/dist/types/components/panel/GlobalDatasetPanel.d.ts +2 -0
- package/dist/types/components/plugins/@antd/item-props/TextProps.d.ts +1 -0
- package/dist/types/components/plugins/@antd/items/TextRender.d.ts +3 -4
- package/dist/types/components/typing.d.ts +9 -1
- package/dist/umd/js/bi-sdk.umd.min.js +55 -41
- package/package.json +1 -1
- package/src/components/PageDesigner.tsx +8 -0
- package/src/components/context/GlobalDatasetContext.tsx +52 -0
- package/src/components/context/PageContext.tsx +31 -8
- package/src/components/hooks/event.ts +6 -1
- package/src/components/hooks/method.ts +2 -2
- package/src/components/icon/IconFont.tsx +1 -1
- package/src/components/panel/EventPanel.tsx +1 -0
- package/src/components/panel/GlobalDatasetPanel.tsx +165 -0
- package/src/components/panel/VariablesPanel.tsx +4 -1
- package/src/components/plugins/@antd/index.ts +10 -0
- package/src/components/plugins/@antd/item-props/EchartsProps.tsx +20 -2
- package/src/components/plugins/@antd/item-props/HtmlProps.tsx +19 -2
- package/src/components/plugins/@antd/item-props/TextProps.tsx +12 -0
- package/src/components/plugins/@antd/items/DrawerRender.tsx +8 -0
- package/src/components/plugins/@antd/items/EchartsRender.tsx +6 -2
- package/src/components/plugins/@antd/items/HtmlRender.tsx +13 -4
- package/src/components/plugins/@antd/items/ModalRender.tsx +7 -0
- package/src/components/plugins/@antd/items/TextRender.tsx +21 -6
- package/src/components/typing.ts +9 -1
- package/src/example.tsx +9 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallbackType, DatasetAddFunction, DatasetSelectorFunction, FetchType, PageSchema, PluginType, SchemaItemType } from "../typing";
|
|
1
|
+
import { CallbackType, DatasetAddFunction, DatasetSelectorFunction, EnvType, FetchType, PageSchema, PluginType, SchemaItemType } from "../typing";
|
|
2
2
|
type InitCallbackParams = {
|
|
3
3
|
id: string;
|
|
4
4
|
callback: CallbackType;
|
|
@@ -36,9 +36,12 @@ type PageContextType = {
|
|
|
36
36
|
handleMethod: (item: SchemaItemType, targetId: string, methodName: string, arg?: any) => any;
|
|
37
37
|
getVars: (id: string) => Record<string, any>;
|
|
38
38
|
setVar: (item: SchemaItemType, key: string, value: any) => void;
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
env: EnvType;
|
|
40
|
+
getGlobalEnv: (key: string) => string | undefined | null;
|
|
41
|
+
setGlobalEnv: (key: string, value: any) => void;
|
|
41
42
|
setItemData?: (id: string, data: any) => void;
|
|
43
|
+
globalVars: Record<string, any>;
|
|
44
|
+
updateGlobalVar: (key: string, value: any) => void;
|
|
42
45
|
};
|
|
43
46
|
export declare const PageContext: import("react").Context<PageContextType>;
|
|
44
47
|
type PageProviderProps = React.PropsWithChildren<Omit<Partial<PageContextType>, "updateSelectedItem" | "schema" | "forceUpdate" | "deviceWidth" | "setDeviceWidth" | "initCallback" | "handleCallback" | "getVars" | "setVar"> & Pick<PageContextType, "schema" | "pageId">>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { HtmlBaseProps } from "../../../typing";
|
|
2
|
+
import { HtmlBaseProps, SchemaItemType } from "../../../typing";
|
|
3
3
|
export type TextRenderProps = {
|
|
4
4
|
text?: string;
|
|
5
|
+
tag?: "span" | "a";
|
|
5
6
|
customStyle?: React.CSSProperties;
|
|
6
|
-
item
|
|
7
|
-
style?: React.CSSProperties;
|
|
8
|
-
};
|
|
7
|
+
item: SchemaItemType;
|
|
9
8
|
classNames?: string[];
|
|
10
9
|
} & HtmlBaseProps;
|
|
11
10
|
export declare const TextRender: React.FC<TextRenderProps>;
|
|
@@ -82,7 +82,7 @@ export type FetchType = {
|
|
|
82
82
|
removeConversation: (conversationId: string) => Promise<boolean>;
|
|
83
83
|
removeMessage: (messageId: string) => Promise<boolean>;
|
|
84
84
|
};
|
|
85
|
-
dataset?: (dataSetId: string, params: Record<string, any
|
|
85
|
+
dataset?: (dataSetId: string, params: Record<string, any>, aiPrompt?: string) => Promise<any>;
|
|
86
86
|
};
|
|
87
87
|
export type HtmlBaseProps = {
|
|
88
88
|
id?: string;
|
|
@@ -190,6 +190,14 @@ export type PageSchema = {
|
|
|
190
190
|
scripts: ScriptItem[];
|
|
191
191
|
variables: VariableItem[];
|
|
192
192
|
items: SchemaItemType[];
|
|
193
|
+
datasets?: {
|
|
194
|
+
id: string;
|
|
195
|
+
name: string;
|
|
196
|
+
key: string;
|
|
197
|
+
aiPrompt?: string;
|
|
198
|
+
output: DataSetOutput;
|
|
199
|
+
dependencies?: string[];
|
|
200
|
+
}[];
|
|
193
201
|
};
|
|
194
202
|
export type EnvType = {
|
|
195
203
|
global: Record<string, any>;
|