bi-sdk-react 0.0.54 → 0.0.56

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 (38) 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/example.d.ts +8 -4
  5. package/dist/types/components/hooks/datasource.d.ts +2 -1
  6. package/dist/types/components/hooks/method.d.ts +1 -0
  7. package/dist/types/components/panel/GlobalDatasetPanel.d.ts +2 -0
  8. package/dist/types/components/plugins/@antd/item-props/TableProps.d.ts +9 -0
  9. package/dist/types/components/plugins/@antd/item-props/TextProps.d.ts +1 -0
  10. package/dist/types/components/plugins/@antd/items/TableRender.d.ts +9 -1
  11. package/dist/types/components/plugins/@antd/items/TextRender.d.ts +3 -4
  12. package/dist/types/components/typing.d.ts +9 -1
  13. package/dist/umd/js/bi-sdk.umd.min.js +55 -41
  14. package/package.json +1 -1
  15. package/src/components/PageDesigner.tsx +8 -0
  16. package/src/components/context/GlobalDatasetContext.tsx +52 -0
  17. package/src/components/context/PageContext.tsx +31 -8
  18. package/src/components/example.ts +9 -10
  19. package/src/components/hooks/datasource.ts +5 -4
  20. package/src/components/hooks/event.ts +6 -1
  21. package/src/components/hooks/method.ts +2 -2
  22. package/src/components/icon/IconFont.tsx +1 -1
  23. package/src/components/panel/EventPanel.tsx +1 -0
  24. package/src/components/panel/GlobalDatasetPanel.tsx +165 -0
  25. package/src/components/panel/VariablesPanel.tsx +4 -1
  26. package/src/components/plugins/@antd/index.ts +15 -7
  27. package/src/components/plugins/@antd/item-props/EchartsProps.tsx +20 -2
  28. package/src/components/plugins/@antd/item-props/HtmlProps.tsx +19 -2
  29. package/src/components/plugins/@antd/item-props/TableProps.tsx +86 -0
  30. package/src/components/plugins/@antd/item-props/TextProps.tsx +12 -0
  31. package/src/components/plugins/@antd/items/DrawerRender.tsx +8 -0
  32. package/src/components/plugins/@antd/items/EchartsRender.tsx +6 -2
  33. package/src/components/plugins/@antd/items/HtmlRender.tsx +13 -4
  34. package/src/components/plugins/@antd/items/ModalRender.tsx +7 -0
  35. package/src/components/plugins/@antd/items/TableRender.tsx +95 -21
  36. package/src/components/plugins/@antd/items/TextRender.tsx +21 -6
  37. package/src/components/typing.ts +9 -1
  38. 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">>;
@@ -203,16 +203,20 @@ export declare const schema: {
203
203
  children: {
204
204
  type: string;
205
205
  name: string;
206
+ datasource: {
207
+ source: string;
208
+ custom: string;
209
+ };
206
210
  props: {
207
211
  title: string;
208
212
  size: string;
209
213
  bordered: boolean;
210
214
  showHeader: boolean;
215
+ showSizeChanger: boolean;
216
+ showQuickJumper: boolean;
217
+ hideOnSinglePage: boolean;
218
+ showTotal: boolean;
211
219
  pageSize: number;
212
- dataSource: {
213
- name: string;
214
- count: number;
215
- }[];
216
220
  columns: {
217
221
  title: string;
218
222
  dataIndex: string;
@@ -3,6 +3,7 @@ export type Signal = string | number;
3
3
  type Props = {
4
4
  item: SchemaItemType;
5
5
  signal?: Signal;
6
+ query?: Record<string, any>;
6
7
  };
7
- export declare const useDatasource: ({ item, signal }: Props) => any;
8
+ export declare const useDatasource: ({ item, signal, query }: Props) => any;
8
9
  export {};
@@ -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;
@@ -11,5 +11,14 @@ export type TableColumnModel = {
11
11
  export type TableModel = {
12
12
  pageSize?: number;
13
13
  columns: TableColumnModel[];
14
+ dataKey?: string;
15
+ showSizeChanger?: boolean;
16
+ showQuickJumper?: boolean;
17
+ hideOnSinglePage?: boolean;
18
+ showTotal?: boolean;
19
+ headerCellClassNames?: string[];
20
+ bodyCellClassNames?: string[];
21
+ paginationRootClassNames?: string[];
22
+ paginationItemClassNames?: string[];
14
23
  } & Pick<AntTableProps, "bordered" | "showHeader" | "size">;
15
24
  export declare const TableProps: React.FC<PropEditorProps<TableModel>>;
@@ -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
  };
@@ -2,12 +2,20 @@ import { type TableProps } from "antd";
2
2
  import React from "react";
3
3
  import { HtmlBaseProps } from "../../../typing";
4
4
  export type TableRenderProps = {
5
- dataSource?: any[];
6
5
  columns?: any[];
6
+ dataKey?: string;
7
7
  pageSize?: number;
8
8
  bordered?: boolean;
9
9
  size?: TableProps["size"];
10
10
  showHeader?: boolean;
11
11
  item: any;
12
+ showSizeChanger?: boolean;
13
+ showQuickJumper?: boolean;
14
+ hideOnSinglePage?: boolean;
15
+ showTotal?: boolean;
16
+ headerCellClassNames?: string[];
17
+ bodyCellClassNames?: string[];
18
+ paginationRootClassNames?: string[];
19
+ paginationItemClassNames?: string[];
12
20
  } & HtmlBaseProps;
13
21
  export declare const TableRender: React.FC<TableRenderProps>;
@@ -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>;