bi-sdk-react 0.0.50 → 0.0.52

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 (37) hide show
  1. package/dist/es/js/bi-sdk.es.js +123 -34
  2. package/dist/types/components/context/PageContext.d.ts +10 -0
  3. package/dist/types/components/hooks/event.d.ts +4 -0
  4. package/dist/types/components/hooks/method.d.ts +4 -0
  5. package/dist/types/components/layout/PageItem.d.ts +1 -0
  6. package/dist/types/components/panel/EventPanel.d.ts +2 -0
  7. package/dist/types/components/plugins/@antd/index.d.ts +2 -0
  8. package/dist/types/components/plugins/@antd/item-props/DrawerProps.d.ts +20 -0
  9. package/dist/types/components/plugins/@antd/item-props/ModalProps.d.ts +18 -0
  10. package/dist/types/components/plugins/@antd/item-props/index.d.ts +2 -0
  11. package/dist/types/components/plugins/@antd/items/DrawerRender.d.ts +19 -0
  12. package/dist/types/components/plugins/@antd/items/EchartsRender.d.ts +2 -2
  13. package/dist/types/components/plugins/@antd/items/ModalRender.d.ts +17 -0
  14. package/dist/types/components/plugins/@antd/items/index.d.ts +2 -0
  15. package/dist/types/components/typing.d.ts +13 -1
  16. package/dist/umd/js/bi-sdk.umd.min.js +124 -35
  17. package/package.json +1 -1
  18. package/src/components/PageDesigner.tsx +57 -41
  19. package/src/components/context/PageContext.tsx +44 -1
  20. package/src/components/dnd/DropContainer.tsx +33 -0
  21. package/src/components/hooks/event.ts +68 -0
  22. package/src/components/hooks/method.ts +13 -0
  23. package/src/components/icon/IconFont.tsx +1 -1
  24. package/src/components/layout/PageItem.tsx +17 -2
  25. package/src/components/panel/EventPanel.tsx +186 -0
  26. package/src/components/panel/LayerPanel.tsx +7 -6
  27. package/src/components/plugins/@antd/index.ts +65 -1
  28. package/src/components/plugins/@antd/item-props/DrawerProps.tsx +174 -0
  29. package/src/components/plugins/@antd/item-props/ModalProps.tsx +153 -0
  30. package/src/components/plugins/@antd/item-props/index.ts +2 -0
  31. package/src/components/plugins/@antd/items/ButtonRender.tsx +3 -0
  32. package/src/components/plugins/@antd/items/DrawerRender.tsx +175 -0
  33. package/src/components/plugins/@antd/items/EchartsRender.tsx +30 -3
  34. package/src/components/plugins/@antd/items/ModalRender.tsx +158 -0
  35. package/src/components/plugins/@antd/items/index.ts +2 -1
  36. package/src/components/typing.ts +13 -1
  37. package/src/example.tsx +2 -49
@@ -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,6 +29,11 @@ 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;
29
39
  setItemData?: (id: string, data: any) => void;
@@ -0,0 +1,4 @@
1
+ import { SchemaItemType } from "../typing";
2
+ export declare const useEvent: (item: SchemaItemType) => {
3
+ handleEvent: (eventName: string, arg?: any) => any;
4
+ };
@@ -0,0 +1,4 @@
1
+ import { SchemaItemType } from "../typing";
2
+ export declare const useMethods: (item: SchemaItemType) => {
3
+ callMethod: (targetId: string, methodName: string, arg?: any) => any;
4
+ };
@@ -3,6 +3,7 @@ import { SchemaItemType } from "../typing";
3
3
  export type PageItemProps = {
4
4
  id?: string;
5
5
  item: SchemaItemType;
6
+ onCopy?: (item: SchemaItemType) => void;
6
7
  onDelete?: () => void;
7
8
  ancestors: SchemaItemType[];
8
9
  parentList?: any[];
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const EventPanel: React.FC;
@@ -19,4 +19,6 @@ export declare const SpacePlugin: PluginType;
19
19
  export declare const CardPlugin: PluginType;
20
20
  export declare const RowPlugin: PluginType;
21
21
  export declare const ColPlugin: PluginType;
22
+ export declare const ModalPlugin: PluginType;
23
+ export declare const DrawerPlugin: PluginType;
22
24
  export declare const plugins: PluginType[];
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import type { PropEditorProps } from "./types";
3
+ export type DrawerModel = {
4
+ title?: string;
5
+ size?: number;
6
+ okType?: "primary" | "link" | "text" | "dashed" | "default";
7
+ okText?: string;
8
+ cancelText?: string;
9
+ resizable?: boolean;
10
+ placement?: "top" | "bottom" | "left" | "right";
11
+ closable?: boolean;
12
+ keyboard?: boolean;
13
+ mask?: boolean;
14
+ maskClosable?: boolean;
15
+ footer?: boolean;
16
+ };
17
+ /**
18
+ * 抽屉属性编辑器
19
+ */
20
+ export declare const DrawerProps: React.FC<PropEditorProps<DrawerModel>>;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import type { PropEditorProps } from "./types";
3
+ export type ModalModel = {
4
+ title?: string;
5
+ width?: number;
6
+ okType?: "primary" | "link" | "text" | "dashed" | "default";
7
+ okText?: string;
8
+ cancelText?: string;
9
+ closable?: boolean;
10
+ keyboard?: boolean;
11
+ mask?: boolean;
12
+ maskClosable?: boolean;
13
+ footer?: boolean;
14
+ };
15
+ /**
16
+ * 模态框属性编辑器
17
+ */
18
+ export declare const ModalProps: React.FC<PropEditorProps<ModalModel>>;
@@ -16,4 +16,6 @@ export { TableProps } from './TableProps';
16
16
  export { PageHeaderProps } from './PageHeaderProps';
17
17
  export { RowProps } from './RowProps';
18
18
  export { ColProps } from './ColProps';
19
+ export { ModalProps } from './ModalProps';
19
20
  export { SpaceProps } from './SpaceProps';
21
+ export { DrawerProps } from './DrawerProps';
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { HtmlBaseProps, SchemaItemType } from "../../../typing";
3
+ export type DrawerRenderProps = {
4
+ item: any;
5
+ title?: string;
6
+ size?: number;
7
+ placement?: "top" | "bottom" | "left" | "right";
8
+ okType?: "primary" | "link" | "text" | "dashed" | "default";
9
+ okText?: string;
10
+ cancelText?: string;
11
+ closable?: boolean;
12
+ keyboard?: boolean;
13
+ mask?: boolean;
14
+ maskClosable?: boolean;
15
+ resizable?: boolean;
16
+ footer?: boolean;
17
+ ancestors: SchemaItemType[];
18
+ } & HtmlBaseProps;
19
+ export declare const DrawerRender: React.FC<DrawerRenderProps>;
@@ -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: any;
6
+ item: SchemaItemType;
7
7
  title?: string;
8
8
  script?: string;
9
9
  height?: number;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { HtmlBaseProps, SchemaItemType } from "../../../typing";
3
+ export type ModalRenderProps = {
4
+ item: any;
5
+ title?: string;
6
+ width?: number;
7
+ okType?: "primary" | "link" | "text" | "dashed" | "default";
8
+ okText?: string;
9
+ cancelText?: string;
10
+ closable?: boolean;
11
+ keyboard?: boolean;
12
+ mask?: boolean;
13
+ maskClosable?: boolean;
14
+ footer?: boolean;
15
+ ancestors: SchemaItemType[];
16
+ } & HtmlBaseProps;
17
+ export declare const ModalRender: React.FC<ModalRenderProps>;
@@ -17,3 +17,5 @@ export { CapsuleRender } from './CapsuleRender';
17
17
  export { CheckboxRender } from './CheckboxRender';
18
18
  export { DatePickerRender } from './DatePickerRender';
19
19
  export { SwitchRender } from './SwitchRender';
20
+ export { ModalRender } from './ModalRender';
21
+ export { DrawerRender } from './DrawerRender';
@@ -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;