@kissflow/lowcode-client-sdk 1.0.12 → 1.0.13-beta

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.
package/dist/lowcode.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- declare module "constants" {
1
+ declare module "core/constants" {
2
2
  export const LISTENER_CMDS: {
3
3
  API: string;
4
- PARAMS: string;
5
4
  GET_CONTEXT: string;
6
5
  RETURN: string;
7
6
  GET_FORM_FIELD: string;
@@ -33,30 +32,104 @@ declare module "constants" {
33
32
  GET_POPUP_PARAMS: string;
34
33
  GET_ALL_POPUP_PARAMS: string;
35
34
  CLOSE_POPUP: string;
36
- GET_COMPONENT: string;
35
+ COMPONENT_GET: string;
37
36
  COMPONENT_REFRESH: string;
38
37
  COMPONENT_SHOW: string;
39
38
  COMPONENT_HIDE: string;
40
- INITIALIZE_CUST_COMP: string;
39
+ COMPONENT_ADD_EVENT_LISTENER: string;
40
+ CC_INITIALIZE: string;
41
+ CC_WATCH_PARAMS: string;
42
+ WINDOW_NDEF_READER_NEW: string;
43
+ WINDOW_NDEF_READER_SCAN: string;
44
+ WINDOW_NDEF_READER_WRITE: string;
45
+ WINDOW_NDEF_READER_ADD_EVENT_LISTENER: string;
46
+ WINDOW_NDEF_READER_MAKE_READONLY: string;
47
+ WINDOW_NDEF_READER_ABORT_SCAN: string;
41
48
  };
42
49
  export const EVENT_TYPES: {
43
- ON_CLOSE: string;
44
- POPUP_ON_CLOSE: string;
45
- ON_CHANGE: string;
46
- ON_LOAD: string;
50
+ COMPONENT_ON_MOUNT: string;
51
+ CC_ON_PARAMS_CHANGE: string;
47
52
  };
48
53
  export const DEFAULTS: {
49
54
  POPUP_ID: string;
50
55
  };
51
56
  }
52
- declare module "base" {
53
- export class BaseSDK {
57
+ declare module "core/index" {
58
+ export function generateId(prefix?: string): string;
59
+ export const globalInstances: {};
60
+ export class EventBase {
54
61
  #private;
55
- constructor(props: any);
62
+ constructor();
63
+ _addEventListener(eventName: string, callBack: Function): void;
64
+ _removeEventListener(eventName: string, callBack?: any): void;
65
+ _dispatchEvent(eventName: string, eventParams: object): boolean;
66
+ _dispatchMessageEvents(req: any, resp: any): void;
67
+ }
68
+ export class BaseSDK extends EventBase {
56
69
  _postMessageAsync(command: string, args: any, hasCallBack?: boolean, callBack?: (data: any) => {}): object | string | any;
57
- _postMessage(command: string, func: (data: any) => {}, args?: {}): void;
58
- _registerEventListener(_id: string, eventType: string, callback: any): void;
70
+ _postMessage(command: string, args: any, callBack?: any): void;
71
+ }
72
+ export * from "core/constants";
73
+ }
74
+ declare module "form/index" {
75
+ import { BaseSDK } from "core/index";
76
+ export class Form extends BaseSDK {
77
+ private instanceId;
78
+ type: string;
79
+ constructor(instanceId: string);
80
+ toJSON(): any;
81
+ getField(fieldId: string): any;
82
+ updateField(args: object): any;
83
+ getTable(tableId: string): Table;
59
84
  }
85
+ class Table extends BaseSDK {
86
+ private tableId;
87
+ private instanceId;
88
+ constructor(instanceId: string, tableId: string);
89
+ toJSON(): any;
90
+ getRows(): TableForm[];
91
+ getRow(rowId: string): TableForm;
92
+ addRow(rowObject: object): any;
93
+ deleteRow(rowId: string): any;
94
+ }
95
+ export class TableForm extends BaseSDK {
96
+ private instanceId;
97
+ private tableId;
98
+ private rowId;
99
+ type: string;
100
+ constructor(instanceId: string, tableId: string, rowId: string);
101
+ getParent(): Form;
102
+ toJSON(): any;
103
+ getField(fieldId: string): any;
104
+ updateField(args: object): any;
105
+ }
106
+ }
107
+ declare module "utils/client" {
108
+ import { BaseSDK } from "core/index";
109
+ export class Client extends BaseSDK {
110
+ showInfo(message: string): any;
111
+ showConfirm(args: {
112
+ title: string;
113
+ content: string;
114
+ okText: string;
115
+ cancelText: string;
116
+ }): any;
117
+ redirect(url: string): any;
118
+ }
119
+ }
120
+ declare module "utils/formatter" {
121
+ import { BaseSDK } from "core/index";
122
+ export class Formatter extends BaseSDK {
123
+ toDate(date: string): any;
124
+ toDateTime(date: string): any;
125
+ toNumber(value: string): any;
126
+ toCurrency(value: string, currencyCode: string): any;
127
+ toBoolean(value: string): any;
128
+ }
129
+ }
130
+ declare module "utils/index" {
131
+ export * from "utils/client";
132
+ export * from "utils/formatter";
60
133
  }
61
134
  declare module "types/external" {
62
135
  export type userObject = {
@@ -80,7 +153,7 @@ declare module "types/internal" {
80
153
  tableId: string;
81
154
  tableRowId: string;
82
155
  componentId: string;
83
- manifestMethods?: manifestMethodsType[];
156
+ componentMethods?: componentMethodsType[];
84
157
  appId: string;
85
158
  pageId: string;
86
159
  popupId: string;
@@ -89,14 +162,14 @@ declare module "types/internal" {
89
162
  csrfToken: string;
90
163
  envDetails: environmentObject;
91
164
  }
92
- export interface manifestMethodsType {
165
+ export interface componentMethodsType {
93
166
  name: string;
94
167
  returnType?: string;
95
168
  parameters?: string[];
96
169
  }
97
170
  export interface ComponentProps {
98
171
  componentId: string;
99
- manifestMethods?: manifestMethodsType[];
172
+ componentMethods?: componentMethodsType[];
100
173
  }
101
174
  export interface AppContext {
102
175
  appId: string;
@@ -109,26 +182,29 @@ declare module "types/internal" {
109
182
  popupId?: string;
110
183
  }
111
184
  }
112
- declare module "component" {
113
- import { BaseSDK } from "base";
185
+ declare module "app/component" {
186
+ import { BaseSDK } from "core/index";
114
187
  import { ComponentProps } from "types/internal";
115
188
  export class Component extends BaseSDK {
189
+ #private;
116
190
  _id: string;
117
191
  type: string;
118
192
  constructor(props: ComponentProps);
193
+ onMount(callback: Function): void;
119
194
  refresh(): any;
120
195
  show(): any;
121
196
  hide(): any;
122
197
  }
123
198
  export class CustomComponent extends BaseSDK {
124
199
  type: string;
125
- constructor();
126
- watchParams(func: (data: any) => any): void;
200
+ _id: string;
201
+ constructor(id: any);
202
+ watchParams(callBack: (data: any) => any): void;
127
203
  }
128
204
  }
129
- declare module "popup" {
130
- import { Component } from "component";
131
- import { BaseSDK } from "base";
205
+ declare module "app/popup" {
206
+ import { BaseSDK } from "core/index";
207
+ import { Component } from "app/component";
132
208
  import { PopupContext } from "types/internal";
133
209
  export class Popup extends BaseSDK {
134
210
  _id: string;
@@ -140,10 +216,10 @@ declare module "popup" {
140
216
  getComponent(componentId: string): Component;
141
217
  }
142
218
  }
143
- declare module "page" {
144
- import { Component } from "component";
145
- import { BaseSDK } from "base";
146
- import { Popup } from "popup";
219
+ declare module "app/page" {
220
+ import { BaseSDK } from "core/index";
221
+ import { Component } from "app/component";
222
+ import { Popup } from "app/popup";
147
223
  import { PageContext } from "types/internal";
148
224
  export class Page extends BaseSDK {
149
225
  _id: string;
@@ -158,85 +234,46 @@ declare module "page" {
158
234
  getComponent(componentId: string): Component;
159
235
  }
160
236
  }
161
- declare module "app" {
162
- import { BaseSDK } from "base";
163
- import { Page } from "page";
237
+ declare module "app/index" {
238
+ import { BaseSDK } from "core/index";
239
+ import { Page } from "app/page";
164
240
  import { AppContext } from "types/internal";
165
241
  export class Application extends BaseSDK {
166
242
  page: Page;
167
243
  _id: string;
168
244
  constructor(props: AppContext);
169
245
  getVariable(key: string): any;
170
- setVariable(key: string | object, value: any): any;
246
+ setVariable(key: string | object, value?: any): any;
171
247
  openPage(pageId: string, pageParams: object): any;
172
248
  }
249
+ export * from "app/component";
250
+ export { Page };
251
+ export * from "app/popup";
173
252
  }
174
- declare module "client" {
175
- import { BaseSDK } from "base";
176
- export class Client extends BaseSDK {
177
- showInfo(message: string): any;
178
- showConfirm(args: {
179
- title: string;
180
- content: string;
181
- okText: string;
182
- cancelText: string;
183
- }): any;
184
- redirect(url: string): any;
185
- }
186
- }
187
- declare module "form" {
188
- import { BaseSDK } from "base";
189
- export class Form extends BaseSDK {
190
- private instanceId;
191
- type: string;
192
- constructor(instanceId: string);
193
- toJSON(): any;
194
- getField(fieldId: string): any;
195
- updateField(args: object): any;
196
- getTable(tableId: string): Table;
197
- }
198
- class Table extends BaseSDK {
199
- private tableId;
200
- private instanceId;
201
- constructor(instanceId: string, tableId: string);
202
- toJSON(): any;
203
- getRows(): TableForm[];
204
- getRow(rowId: string): TableForm;
205
- addRow(rowObject: object): any;
206
- deleteRow(rowId: string): any;
207
- }
208
- export class TableForm extends BaseSDK {
209
- private instanceId;
210
- private tableId;
211
- private rowId;
212
- type: string;
213
- constructor(instanceId: string, tableId: string, rowId: string);
214
- getParent(): Form;
215
- toJSON(): any;
216
- getField(fieldId: string): any;
217
- updateField(args: object): any;
253
+ declare module "window/NDEFReader" {
254
+ import { BaseSDK } from "core/index";
255
+ export class NDEFReader extends BaseSDK {
256
+ id: string;
257
+ constructor();
258
+ scan(): Promise<unknown>;
259
+ write(data: any): Promise<unknown>;
260
+ addEventListener(eventName: string, cb: Function): void;
261
+ makeReadOnly(): Promise<unknown>;
262
+ abortScan(): Promise<unknown>;
218
263
  }
219
264
  }
220
- declare module "formatter" {
221
- import { BaseSDK } from "base";
222
- export class Formatter extends BaseSDK {
223
- toDate(date: string): any;
224
- toDateTime(date: string): any;
225
- toNumber(value: string): any;
226
- toCurrency(value: string, currencyCode: string): any;
227
- toBoolean(value: string): any;
228
- }
265
+ declare module "window/index" {
266
+ import { NDEFReader } from "window/NDEFReader";
267
+ export const window: {
268
+ NDEFReader: typeof NDEFReader;
269
+ };
229
270
  }
230
271
  declare module "lowcode" {
231
- import { BaseSDK } from "base";
232
- import { Form } from "form";
233
- import { TableForm } from "form";
234
- import { Client } from "client";
235
- import { Formatter } from "formatter";
236
- import { Application } from "app";
237
- import { Page } from "page";
238
- import { Component } from "component";
239
- import { Popup } from "popup";
272
+ import { BaseSDK } from "core/index";
273
+ import { Form, TableForm } from "form/index";
274
+ import { Client, Formatter } from "utils/index";
275
+ import { Application, Page, Component, Popup } from "app/index";
276
+ import { window } from "window/index";
240
277
  import { SDKContext } from "types/internal";
241
278
  import { userObject, accountObject, environmentObject } from "types/external";
242
279
  class LowcodeSDK extends BaseSDK {
@@ -254,5 +291,5 @@ declare module "lowcode" {
254
291
  }): Promise<any>;
255
292
  }
256
293
  function initSDK(config: SDKContext): LowcodeSDK;
257
- export default initSDK;
294
+ export { window, initSDK as default };
258
295
  }
@@ -1,7 +1,46 @@
1
1
 
2
+ declare class Form {
3
+ type: string
4
+ toJSON(): any;
5
+ getField(fieldId: string): any;
6
+ updateField(args: object): any;
7
+ getTable(tableId: string): Table;
8
+ }
9
+ declare class Table {
10
+ toJSON(): any;
11
+ getRows(): TableForm[];
12
+ getRow(rowId: string): TableForm;
13
+ addRow(rowObject: object): any;
14
+ deleteRow(rowId: string): any;
15
+ }
16
+ declare class TableForm {
17
+ type: string
18
+ getParent(): Form;
19
+ toJSON(): any;
20
+ getField(fieldId: string): any;
21
+ updateField(args: object): any;
22
+ }
23
+ declare class Client {
24
+ showInfo(message: string): any;
25
+ showConfirm(args: {
26
+ title: string;
27
+ content: string;
28
+ okText: string;
29
+ cancelText: string;
30
+ }): any;
31
+ redirect(url: string): any;
32
+ }
33
+ declare class Formatter {
34
+ toDate(date: string): any;
35
+ toDateTime(date: string): any;
36
+ toNumber(value: string): any;
37
+ toCurrency(value: string, currencyCode: string): any;
38
+ toBoolean(value: string): any;
39
+ }
2
40
  declare class Component {
3
41
  _id: string
4
42
  type: string
43
+ onMount(callback: Function): void;
5
44
  refresh(): any;
6
45
  show(): any;
7
46
  hide(): any;
@@ -29,47 +68,9 @@ declare class Application {
29
68
  page: Page
30
69
  _id: string
31
70
  getVariable(key: string): any;
32
- setVariable(key: string | object, value: any): any;
71
+ setVariable(key: string | object, value?: any): any;
33
72
  openPage(pageId: string, pageParams: object): any;
34
73
  }
35
- declare class Client {
36
- showInfo(message: string): any;
37
- showConfirm(args: {
38
- title: string;
39
- content: string;
40
- okText: string;
41
- cancelText: string;
42
- }): any;
43
- redirect(url: string): any;
44
- }
45
- declare class Form {
46
- type: string
47
- toJSON(): any;
48
- getField(fieldId: string): any;
49
- updateField(args: object): any;
50
- getTable(tableId: string): Table;
51
- }
52
- declare class Table {
53
- toJSON(): any;
54
- getRows(): TableForm[];
55
- getRow(rowId: string): TableForm;
56
- addRow(rowObject: object): any;
57
- deleteRow(rowId: string): any;
58
- }
59
- declare class TableForm {
60
- type: string
61
- getParent(): Form;
62
- toJSON(): any;
63
- getField(fieldId: string): any;
64
- updateField(args: object): any;
65
- }
66
- declare class Formatter {
67
- toDate(date: string): any;
68
- toDateTime(date: string): any;
69
- toNumber(value: string): any;
70
- toCurrency(value: string, currencyCode: string): any;
71
- toBoolean(value: string): any;
72
- }
73
74
  declare class kf {
74
75
  static context: Component
75
76
  static client: Client