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.
Files changed (30) hide show
  1. package/dist/es/js/bi-sdk.es.js +55 -41
  2. package/dist/types/components/context/GlobalDatasetContext.d.ts +7 -0
  3. package/dist/types/components/context/PageContext.d.ts +6 -3
  4. package/dist/types/components/hooks/method.d.ts +1 -0
  5. package/dist/types/components/panel/GlobalDatasetPanel.d.ts +2 -0
  6. package/dist/types/components/plugins/@antd/item-props/TextProps.d.ts +1 -0
  7. package/dist/types/components/plugins/@antd/items/TextRender.d.ts +3 -4
  8. package/dist/types/components/typing.d.ts +9 -1
  9. package/dist/umd/js/bi-sdk.umd.min.js +55 -41
  10. package/package.json +1 -1
  11. package/src/components/PageDesigner.tsx +8 -0
  12. package/src/components/context/GlobalDatasetContext.tsx +52 -0
  13. package/src/components/context/PageContext.tsx +31 -8
  14. package/src/components/hooks/event.ts +6 -1
  15. package/src/components/hooks/method.ts +2 -2
  16. package/src/components/icon/IconFont.tsx +1 -1
  17. package/src/components/panel/EventPanel.tsx +1 -0
  18. package/src/components/panel/GlobalDatasetPanel.tsx +165 -0
  19. package/src/components/panel/VariablesPanel.tsx +4 -1
  20. package/src/components/plugins/@antd/index.ts +10 -0
  21. package/src/components/plugins/@antd/item-props/EchartsProps.tsx +20 -2
  22. package/src/components/plugins/@antd/item-props/HtmlProps.tsx +19 -2
  23. package/src/components/plugins/@antd/item-props/TextProps.tsx +12 -0
  24. package/src/components/plugins/@antd/items/DrawerRender.tsx +8 -0
  25. package/src/components/plugins/@antd/items/EchartsRender.tsx +6 -2
  26. package/src/components/plugins/@antd/items/HtmlRender.tsx +13 -4
  27. package/src/components/plugins/@antd/items/ModalRender.tsx +7 -0
  28. package/src/components/plugins/@antd/items/TextRender.tsx +21 -6
  29. package/src/components/typing.ts +9 -1
  30. package/src/example.tsx +9 -0
@@ -0,0 +1,7 @@
1
+ type GlobalDatasetContextType = {
2
+ datasetId: string;
3
+ var: string;
4
+ dependencies: string[];
5
+ };
6
+ declare const GlobalDatasetContext: React.FC<GlobalDatasetContextType>;
7
+ export default GlobalDatasetContext;
@@ -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
- getGlobalVar: (key: string) => string | undefined | null;
40
- setGlobalVar: (key: string, value: any) => void;
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,4 +1,5 @@
1
1
  import { SchemaItemType } from "../typing";
2
2
  export declare const useMethods: (item: SchemaItemType) => {
3
3
  callMethod: (targetId: string, methodName: string, arg?: any) => any;
4
+ updateEnv: (key: string, value: any) => void;
4
5
  };
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const GlobalDatasetPanel: React.FC;
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import type { PropEditorProps } from "./types";
3
3
  export type TextModel = {
4
4
  text?: string;
5
+ tag?: string;
5
6
  customStyle?: React.CSSProperties;
6
7
  classNames?: string[];
7
8
  };
@@ -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>) => Promise<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>;