@sdata-plugin-adapter/types 0.0.0-alpha.1 → 0.0.0-alpha.3

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.
@@ -0,0 +1,25 @@
1
+ //#region global/module.d.ts
2
+ interface ConfigJson {
3
+ id: string;
4
+ type: string;
5
+ main: string;
6
+ version: string | number;
7
+ configuration: boolean;
8
+ scriptLoadType: string;
9
+ props: {
10
+ [key: string]: any;
11
+ };
12
+ "online-development-mode"?: {
13
+ open: boolean;
14
+ host: string;
15
+ port: string | number;
16
+ entry: string;
17
+ };
18
+ templateType?: string;
19
+ "requirement-number": string;
20
+ "requirement-name": string;
21
+ }
22
+ declare module "configJson" {
23
+ const configJson: ConfigJson;
24
+ export default configJson;
25
+ }
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,228 @@
1
+ import * as ReactType from "react";
2
+ import * as ReactDOMClientType from "react-dom/client";
3
+
4
+ //#region index.d.ts
5
+ interface CustomConfig {
6
+ componentId?: string;
7
+ id: string;
8
+ [key: string]: any;
9
+ }
10
+ type ConfigType = 'default' | 'data' | 'style' | 'interaction';
11
+ type ActionsFunction = {
12
+ [key: string]: (...args: any[]) => any;
13
+ };
14
+ type ActionsPayload = {
15
+ key: string;
16
+ name: string;
17
+ params: {
18
+ key: string;
19
+ name: string;
20
+ dataType: string;
21
+ }[];
22
+ hasReturn: boolean;
23
+ };
24
+ type EventsPayload = {
25
+ key: string;
26
+ name: string;
27
+ payload: {
28
+ name: string;
29
+ key: string;
30
+ dataType: string;
31
+ }[];
32
+ }[];
33
+ interface EventActionDefinitions {
34
+ actions: ActionsPayload;
35
+ events: EventsPayload;
36
+ }
37
+ interface UseRegisterComponentParams {
38
+ actions?: ActionsFunction;
39
+ eventActionDefinitions?: EventActionDefinitions;
40
+ }
41
+ interface TriggerEventPayload {
42
+ componentId?: string;
43
+ event: string;
44
+ payload?: Record<string, any>;
45
+ [key: string]: any;
46
+ }
47
+ interface BaseAppProps {
48
+ isConfig: boolean;
49
+ configType: ConfigType;
50
+ customConfig: CustomConfig;
51
+ onConfigChange: (parasm: Record<string, any>) => void;
52
+ appTriggerEvent: (payload: TriggerEventPayload) => void;
53
+ }
54
+ interface AppAdapterProps extends BaseAppProps {
55
+ changeCustomConfig: (customConfig: string | CustomConfig) => void;
56
+ componentId: string;
57
+ type: string;
58
+ triggerEvent: (eventName: string, payload?: Record<string, any>) => void;
59
+ useRegisterComponent: (params: UseRegisterComponentParams) => void;
60
+ }
61
+ interface FormConfig {
62
+ id: string;
63
+ form_name: string;
64
+ [key: string]: any;
65
+ }
66
+ interface QueryProps {
67
+ data: Record<string, any>;
68
+ queryConfig: Record<string, any>;
69
+ onSearch: unknown;
70
+ onChange: (params: Record<string, any>) => void;
71
+ }
72
+ interface BaseReportProps {
73
+ type: string;
74
+ formConfig: FormConfig;
75
+ queryProps: QueryProps;
76
+ queryData: Record<string, any>;
77
+ component: CustomConfig;
78
+ control$: Record<string, any>;
79
+ parent: CustomConfig;
80
+ configuration: string;
81
+ changeConfiguration: (param: any) => void;
82
+ instance: Record<string, any>;
83
+ isDesign: boolean;
84
+ index: string | number;
85
+ child_id: string | number;
86
+ }
87
+ interface ReportAdapterProps extends BaseReportProps {
88
+ formId: string;
89
+ formName: string;
90
+ isInChildTable: boolean;
91
+ componentId: string;
92
+ componentName: string;
93
+ customConfig: CustomConfig;
94
+ type: string;
95
+ changeCustomConfig?: (customConfig: string | Record<string, any>) => void;
96
+ onSearch: unknown;
97
+ onSearchChange: (value: unknown, type: number) => void;
98
+ triggerEvent: (eventName: string, payload?: Record<string, any>) => void;
99
+ useRegisterComponent: (params: UseRegisterComponentParams) => void;
100
+ }
101
+ type baseCol = {
102
+ id: string | number;
103
+ showType: string;
104
+ componentConfig: Record<string, any>;
105
+ [key: string]: any;
106
+ };
107
+ type column = {
108
+ showType: string;
109
+ value: string | number;
110
+ label: string;
111
+ };
112
+ interface BaseDFListProps {
113
+ viewId: string;
114
+ pluginId: string;
115
+ type: string;
116
+ configuration: string;
117
+ pluginConfig: CustomConfig;
118
+ allComponentList: baseCol[];
119
+ changeConfiguration: (param: any) => void;
120
+ }
121
+ interface DFListAdapterProps extends BaseDFListProps {
122
+ componentId: string;
123
+ type: 'designConfiguration' | 'main';
124
+ customConfig: CustomConfig;
125
+ columnList: column[];
126
+ changeCustomConfig?: (customConfig: string | Record<string, any>) => void;
127
+ triggerEvent: (eventName: string, payload?: Record<string, any>) => void;
128
+ useRegisterComponent: (params: UseRegisterComponentParams) => void;
129
+ }
130
+ type BScreenBlock = {
131
+ baseConfig: {
132
+ id: string | number;
133
+ } & Record<string, any>;
134
+ dataConfig: {
135
+ pluginOptions: Record<string, any>;
136
+ columns: unknown;
137
+ };
138
+ };
139
+ type bigScreenType = {
140
+ updateBlockById: (id: string | number, data: Record<string, any>) => void;
141
+ pluginDetailMap: Record<string, any>;
142
+ variableList: unknown;
143
+ rootStore: {
144
+ bigscreen: bigScreenType;
145
+ };
146
+ };
147
+ type bigScreenOptions = {
148
+ externalVariables: any;
149
+ } & Record<string, any>;
150
+ type bigScreenPubSub = {
151
+ subscribe: (id: string, call: (...args: unknown[]) => void) => void;
152
+ };
153
+ interface BaseBScreenProps {
154
+ componentId: string;
155
+ type: 'main' | string;
156
+ block: BScreenBlock;
157
+ bigscreen: bigScreenType;
158
+ options: bigScreenOptions;
159
+ pubSub: bigScreenPubSub;
160
+ }
161
+ interface BScreenAdapterProps extends BaseBScreenProps {
162
+ customConfig: Record<string, any>;
163
+ customOptions: bigScreenOptions;
164
+ variableList: unknown;
165
+ afterUpdateComponent: (callback: (data: unknown) => unknown) => void;
166
+ setComponentVisible: (visible: boolean) => void;
167
+ changeCustomConfig: (pluginOptions: string) => void;
168
+ triggerEvent: (eventName: string, payload?: Record<string, any>) => void;
169
+ useRegisterComponent: (params: UseRegisterComponentParams) => void;
170
+ }
171
+ type AnalyzerOptions = {
172
+ analyzer_secondary_configuration: string;
173
+ externalVariables: Record<string, any>;
174
+ };
175
+ interface BaseAnalyzerProps {
176
+ componentId: string;
177
+ type: 'main' | string;
178
+ configuration: CustomConfig;
179
+ options: AnalyzerOptions;
180
+ dataSource: unknown;
181
+ data: unknown;
182
+ changeConfiguration: (configuration: unknown) => void;
183
+ }
184
+ interface AnalyzerAdapterProps extends BaseAnalyzerProps {
185
+ data: unknown;
186
+ customConfig: CustomConfig;
187
+ customOptions: Record<string, any>;
188
+ changeCustomConfig: (configuration: string) => void;
189
+ triggerEvent: (eventName: string, payload?: Record<string, any>) => void;
190
+ useRegisterComponent: (params: UseRegisterComponentParams) => void;
191
+ }
192
+ type BaseProps = BaseAppProps | BaseReportProps | BaseDFListProps | BaseBScreenProps | BaseAnalyzerProps;
193
+ type AdapterFn<T extends BaseProps, R extends T> = (props: T) => R;
194
+ interface StartOptions {
195
+ App: React.ComponentType;
196
+ beforeBootstrap?: (callback: () => void) => void;
197
+ }
198
+ type SetAttributes<T extends BaseProps> = (dom: Element, props: T) => Promise<void>;
199
+ interface CreatePluginOptions<P extends BaseProps, R extends P> extends StartOptions {
200
+ setAttributes: SetAttributes<P>;
201
+ adapter: AdapterFn<P, R>;
202
+ }
203
+ interface EventBus {
204
+ emit: (props: Record<string, any>) => void;
205
+ on: (callback: (payload?: any) => void) => void;
206
+ remove: () => void;
207
+ }
208
+ type PluginRun<T extends BaseProps> = (dom: Element, props: T, context: Record<string, any>, eventBus: EventBus, setCompRoot?: (root: ReactDOMClientType.Root) => void) => void;
209
+ declare global {
210
+ interface Window {
211
+ React: typeof ReactType;
212
+ ReactDOM: typeof ReactDOMClientType;
213
+ online_development_islocal: boolean;
214
+ CUSTOM_PLUGIN: Map<string, PluginRun<keyof BaseProps>>;
215
+ eventCenter: {
216
+ triggerEventNew: (payload: Record<string, any>) => void;
217
+ [key: string]: any;
218
+ };
219
+ componentCenter: {
220
+ register: (componentId: string, type: string, payload: Record<string, any>, eventsDefine: EventActionDefinitions) => void;
221
+ removeInstance: (componentId: string) => void;
222
+ [key: string]: any;
223
+ };
224
+ [key: string]: any;
225
+ }
226
+ }
227
+ //#endregion
228
+ export { type ActionsFunction, type ActionsPayload, type AdapterFn, type AnalyzerAdapterProps, type AppAdapterProps, type BScreenAdapterProps, type BaseAnalyzerProps, type BaseAppProps, type BaseBScreenProps, type BaseDFListProps, type BaseProps, type BaseReportProps, type CreatePluginOptions, type CustomConfig, type DFListAdapterProps, type EventActionDefinitions, type EventBus, type EventsPayload, type PluginRun, type ReportAdapterProps, type SetAttributes, type StartOptions, type TriggerEventPayload, type UseRegisterComponentParams };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { };
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@sdata-plugin-adapter/types",
3
- "version": "0.0.0-alpha.1",
3
+ "version": "0.0.0-alpha.3",
4
4
  "description": "adapter types of smdata plugin",
5
5
  "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
6
+ "types": "./dist/index.d.mts",
9
7
  "exports": {
10
8
  ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "require": "./dist/index.cjs"
9
+ "types": "./dist/index.d.mts"
10
+ },
11
+ "./global": {
12
+ "types": "./dist/global/index.d.mts"
14
13
  }
15
14
  },
16
15
  "files": [
@@ -23,6 +22,6 @@
23
22
  },
24
23
  "scripts": {
25
24
  "test": "echo \"Error: no test specified\" && exit 1",
26
- "build": "tsup"
25
+ "build": "tsdown"
27
26
  }
28
27
  }
package/dist/index.cjs DELETED
@@ -1,17 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
-
15
- // index.ts
16
- var index_exports = {};
17
- module.exports = __toCommonJS(index_exports);
package/dist/index.d.cts DELETED
@@ -1,73 +0,0 @@
1
- import * as ReactDOMClientType from 'react-dom/client';
2
-
3
- interface CustomConfig {
4
- componentId: string;
5
- id: string;
6
- appId?: string;
7
- [key: string]: any;
8
- }
9
- type ConfigType = "default" | "data" | "style" | "interaction";
10
- type ActionsFunction = {
11
- [key: string]: (...args: any[]) => any;
12
- };
13
- type ActionsPayload = {
14
- key: string;
15
- name: string;
16
- params: {
17
- key: string;
18
- name: string;
19
- dataType: string;
20
- }[];
21
- hasReturn: boolean;
22
- };
23
- type EventsPayload = {
24
- key: string;
25
- name: string;
26
- payload: {
27
- name: string;
28
- key: string;
29
- dataType: string;
30
- }[];
31
- }[];
32
- interface EventActionDefinitions {
33
- actions: ActionsPayload;
34
- events: EventsPayload;
35
- }
36
- interface UseRegisterComponentParams {
37
- actions?: ActionsFunction;
38
- eventActionDefinitions?: EventActionDefinitions;
39
- }
40
- interface AppTriggerEventPayload {
41
- componentId?: string;
42
- event: string;
43
- payload?: Record<string, any>;
44
- [key: string]: any;
45
- }
46
- interface AdapterProps {
47
- isConfig?: boolean;
48
- changeCustomConfig?: (customConfigStr: string) => void;
49
- onConfigChange: (config: any) => void;
50
- componentId?: string;
51
- customConfig: CustomConfig;
52
- configType?: ConfigType;
53
- type?: string;
54
- appTriggerEvent?: (payload: AppTriggerEventPayload) => void;
55
- triggerEvent?: (eventName: string, payload?: Record<string, any>) => void;
56
- useRegisterComponent?: (params: UseRegisterComponentParams) => void;
57
- [key: string]: any;
58
- }
59
- type PluginProps = AdapterProps & Record<string, any>;
60
- interface createPluginOptions {
61
- App: React.ComponentType;
62
- setAttributes: (dom: Element, props: PluginProps) => Promise<any>;
63
- adapter: (props: AdapterProps) => AdapterProps;
64
- beforeBootstrap?: (callback: () => void) => void;
65
- }
66
- interface EventBus {
67
- emit: (props: Record<string, any>) => void;
68
- on: (callback: (payload?: any) => void) => void;
69
- remove: () => void;
70
- }
71
- type PluginRun = (dom: Element, props: PluginProps, context?: Record<string, any>, eventBus?: EventBus, setCompRoot?: (root: ReactDOMClientType.Root) => void) => void;
72
-
73
- export type { ActionsFunction, ActionsPayload, AdapterProps, AppTriggerEventPayload, CustomConfig, EventActionDefinitions, EventBus, EventsPayload, PluginProps, PluginRun, UseRegisterComponentParams, createPluginOptions };
package/dist/index.d.ts DELETED
@@ -1,73 +0,0 @@
1
- import * as ReactDOMClientType from 'react-dom/client';
2
-
3
- interface CustomConfig {
4
- componentId: string;
5
- id: string;
6
- appId?: string;
7
- [key: string]: any;
8
- }
9
- type ConfigType = "default" | "data" | "style" | "interaction";
10
- type ActionsFunction = {
11
- [key: string]: (...args: any[]) => any;
12
- };
13
- type ActionsPayload = {
14
- key: string;
15
- name: string;
16
- params: {
17
- key: string;
18
- name: string;
19
- dataType: string;
20
- }[];
21
- hasReturn: boolean;
22
- };
23
- type EventsPayload = {
24
- key: string;
25
- name: string;
26
- payload: {
27
- name: string;
28
- key: string;
29
- dataType: string;
30
- }[];
31
- }[];
32
- interface EventActionDefinitions {
33
- actions: ActionsPayload;
34
- events: EventsPayload;
35
- }
36
- interface UseRegisterComponentParams {
37
- actions?: ActionsFunction;
38
- eventActionDefinitions?: EventActionDefinitions;
39
- }
40
- interface AppTriggerEventPayload {
41
- componentId?: string;
42
- event: string;
43
- payload?: Record<string, any>;
44
- [key: string]: any;
45
- }
46
- interface AdapterProps {
47
- isConfig?: boolean;
48
- changeCustomConfig?: (customConfigStr: string) => void;
49
- onConfigChange: (config: any) => void;
50
- componentId?: string;
51
- customConfig: CustomConfig;
52
- configType?: ConfigType;
53
- type?: string;
54
- appTriggerEvent?: (payload: AppTriggerEventPayload) => void;
55
- triggerEvent?: (eventName: string, payload?: Record<string, any>) => void;
56
- useRegisterComponent?: (params: UseRegisterComponentParams) => void;
57
- [key: string]: any;
58
- }
59
- type PluginProps = AdapterProps & Record<string, any>;
60
- interface createPluginOptions {
61
- App: React.ComponentType;
62
- setAttributes: (dom: Element, props: PluginProps) => Promise<any>;
63
- adapter: (props: AdapterProps) => AdapterProps;
64
- beforeBootstrap?: (callback: () => void) => void;
65
- }
66
- interface EventBus {
67
- emit: (props: Record<string, any>) => void;
68
- on: (callback: (payload?: any) => void) => void;
69
- remove: () => void;
70
- }
71
- type PluginRun = (dom: Element, props: PluginProps, context?: Record<string, any>, eventBus?: EventBus, setCompRoot?: (root: ReactDOMClientType.Root) => void) => void;
72
-
73
- export type { ActionsFunction, ActionsPayload, AdapterProps, AppTriggerEventPayload, CustomConfig, EventActionDefinitions, EventBus, EventsPayload, PluginProps, PluginRun, UseRegisterComponentParams, createPluginOptions };
package/dist/index.js DELETED
File without changes