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

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 (2) hide show
  1. package/dist/index.d.mts +40 -16
  2. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -29,14 +29,14 @@ type EventsPayload = {
29
29
  key: string;
30
30
  dataType: string;
31
31
  }[];
32
- }[];
32
+ };
33
33
  interface EventActionDefinitions {
34
- actions: ActionsPayload;
35
- events: EventsPayload;
34
+ actions: ActionsPayload[];
35
+ events: EventsPayload[];
36
36
  }
37
37
  interface UseRegisterComponentParams {
38
- actions?: ActionsFunction;
39
- eventActionDefinitions?: EventActionDefinitions;
38
+ actions: ActionsFunction;
39
+ eventActionDefinitions: EventActionDefinitions;
40
40
  }
41
41
  interface TriggerEventPayload {
42
42
  componentId?: string;
@@ -57,6 +57,7 @@ interface AppAdapterProps extends BaseAppProps {
57
57
  type: string;
58
58
  triggerEvent: (eventName: string, payload?: Record<string, any>) => void;
59
59
  useRegisterComponent: (params: UseRegisterComponentParams) => void;
60
+ [key: string]: any;
60
61
  }
61
62
  interface FormConfig {
62
63
  id: string;
@@ -66,11 +67,13 @@ interface FormConfig {
66
67
  interface QueryProps {
67
68
  data: Record<string, any>;
68
69
  queryConfig: Record<string, any>;
69
- onSearch: unknown;
70
+ onSearch: (...args: unknown[]) => void;
70
71
  onChange: (params: Record<string, any>) => void;
71
72
  }
72
73
  interface BaseReportProps {
73
74
  type: string;
75
+ data: string;
76
+ onChange: (data: string) => void;
74
77
  formConfig: FormConfig;
75
78
  queryProps: QueryProps;
76
79
  queryData: Record<string, any>;
@@ -83,6 +86,7 @@ interface BaseReportProps {
83
86
  isDesign: boolean;
84
87
  index: string | number;
85
88
  child_id: string | number;
89
+ setCustomRuleFunc?: (func: (value: any) => boolean) => void;
86
90
  }
87
91
  interface ReportAdapterProps extends BaseReportProps {
88
92
  formId: string;
@@ -93,10 +97,11 @@ interface ReportAdapterProps extends BaseReportProps {
93
97
  customConfig: CustomConfig;
94
98
  type: string;
95
99
  changeCustomConfig?: (customConfig: string | Record<string, any>) => void;
96
- onSearch: unknown;
100
+ onSearch: (...args: unknown[]) => void;
97
101
  onSearchChange: (value: unknown, type: number) => void;
98
102
  triggerEvent: (eventName: string, payload?: Record<string, any>) => void;
99
103
  useRegisterComponent: (params: UseRegisterComponentParams) => void;
104
+ [key: string]: any;
100
105
  }
101
106
  type baseCol = {
102
107
  id: string | number;
@@ -104,16 +109,28 @@ type baseCol = {
104
109
  componentConfig: Record<string, any>;
105
110
  [key: string]: any;
106
111
  };
107
- type column = {
112
+ type columnListItem = {
108
113
  showType: string;
109
- value: string | number;
114
+ value: string | number | unknown;
115
+ label: string;
116
+ [key: string]: any;
117
+ };
118
+ type columnsItem = {
119
+ title: string;
120
+ [key: string]: any;
121
+ };
122
+ type dataItem = {
110
123
  label: string;
124
+ value: string | number | unknown;
125
+ [key: string]: any;
111
126
  };
112
127
  interface BaseDFListProps {
128
+ data: dataItem[];
113
129
  viewId: string;
114
130
  pluginId: string;
115
131
  type: string;
116
132
  configuration: string;
133
+ columns: columnsItem[];
117
134
  pluginConfig: CustomConfig;
118
135
  allComponentList: baseCol[];
119
136
  changeConfiguration: (param: any) => void;
@@ -122,10 +139,11 @@ interface DFListAdapterProps extends BaseDFListProps {
122
139
  componentId: string;
123
140
  type: 'designConfiguration' | 'main';
124
141
  customConfig: CustomConfig;
125
- columnList: column[];
142
+ columnList: columnListItem[];
126
143
  changeCustomConfig?: (customConfig: string | Record<string, any>) => void;
127
144
  triggerEvent: (eventName: string, payload?: Record<string, any>) => void;
128
145
  useRegisterComponent: (params: UseRegisterComponentParams) => void;
146
+ [key: string]: any;
129
147
  }
130
148
  type BScreenBlock = {
131
149
  baseConfig: {
@@ -167,6 +185,7 @@ interface BScreenAdapterProps extends BaseBScreenProps {
167
185
  changeCustomConfig: (pluginOptions: string) => void;
168
186
  triggerEvent: (eventName: string, payload?: Record<string, any>) => void;
169
187
  useRegisterComponent: (params: UseRegisterComponentParams) => void;
188
+ [key: string]: any;
170
189
  }
171
190
  type AnalyzerOptions = {
172
191
  analyzer_secondary_configuration: string;
@@ -188,15 +207,20 @@ interface AnalyzerAdapterProps extends BaseAnalyzerProps {
188
207
  changeCustomConfig: (configuration: string) => void;
189
208
  triggerEvent: (eventName: string, payload?: Record<string, any>) => void;
190
209
  useRegisterComponent: (params: UseRegisterComponentParams) => void;
210
+ [key: string]: any;
211
+ }
212
+ interface CommonProps {
213
+ type: string;
191
214
  }
192
- type BaseProps = BaseAppProps | BaseReportProps | BaseDFListProps | BaseBScreenProps | BaseAnalyzerProps;
215
+ type BaseProps = BaseAppProps | BaseReportProps | BaseDFListProps | BaseBScreenProps | BaseAnalyzerProps | CommonProps;
193
216
  type AdapterFn<T extends BaseProps, R extends T> = (props: T) => R;
194
- interface StartOptions {
195
- App: React.ComponentType;
196
- beforeBootstrap?: (callback: () => void) => void;
217
+ type BeforeBootstrap = <T extends Record<string, any> = {}>(callback: () => void, payload?: T) => void;
218
+ interface StartOptions<P extends BaseProps> {
219
+ App: React.ComponentType<P>;
220
+ beforeBootstrap?: BeforeBootstrap;
197
221
  }
198
222
  type SetAttributes<T extends BaseProps> = (dom: Element, props: T) => Promise<void>;
199
- interface CreatePluginOptions<P extends BaseProps, R extends P> extends StartOptions {
223
+ interface CreatePluginOptions<P extends BaseProps, R extends P> extends StartOptions<R> {
200
224
  setAttributes: SetAttributes<P>;
201
225
  adapter: AdapterFn<P, R>;
202
226
  }
@@ -225,4 +249,4 @@ declare global {
225
249
  }
226
250
  }
227
251
  //#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 };
252
+ 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 CommonProps, 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdata-plugin-adapter/types",
3
- "version": "0.0.0-alpha.3",
3
+ "version": "0.0.0-alpha.4",
4
4
  "description": "adapter types of smdata plugin",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.mts",