@kissflow/lowcode-client-sdk 1.0.12 → 1.0.13
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/README.md +28 -12
- package/dist/global.types.d.ts +40 -39
- package/dist/index.d.ts +105 -67
- package/dist/kfsdk.es.js +227 -160
- package/dist/kfsdk.umd.js +1 -1
- package/dist/kfworkersdk.es.js +253 -119
- package/dist/lowcode.d.ts +131 -94
- package/package.json +4 -12
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
|
-
|
|
35
|
+
COMPONENT_GET: string;
|
|
37
36
|
COMPONENT_REFRESH: string;
|
|
38
37
|
COMPONENT_SHOW: string;
|
|
39
38
|
COMPONENT_HIDE: string;
|
|
40
|
-
|
|
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
|
-
|
|
44
|
-
|
|
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 "
|
|
53
|
-
export
|
|
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(
|
|
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,
|
|
58
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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 "
|
|
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
|
-
|
|
126
|
-
|
|
200
|
+
_id: string;
|
|
201
|
+
constructor(id: any);
|
|
202
|
+
watchParams(callBack: (data: any) => any): void;
|
|
127
203
|
}
|
|
128
204
|
}
|
|
129
|
-
declare module "popup" {
|
|
130
|
-
import {
|
|
131
|
-
import {
|
|
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 {
|
|
145
|
-
import {
|
|
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 "
|
|
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
|
|
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 "
|
|
175
|
-
import { BaseSDK } from "
|
|
176
|
-
export class
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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 "
|
|
221
|
-
import {
|
|
222
|
-
export
|
|
223
|
-
|
|
224
|
-
|
|
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 "
|
|
232
|
-
import { Form } from "form";
|
|
233
|
-
import {
|
|
234
|
-
import {
|
|
235
|
-
import {
|
|
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
|
|
294
|
+
export { window, initSDK as default };
|
|
258
295
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kissflow/lowcode-client-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "JavaScript SDK for developing over the Kissflow lowcode platform",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -29,20 +29,12 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/kissflow/lcnc-sdk-js#readme",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"
|
|
33
|
-
"http-server": "^0.12.3",
|
|
34
|
-
"ts-loader": "^9.2.5",
|
|
32
|
+
"ts-file-parser": "0.0.21",
|
|
35
33
|
"typescript": "^4.3.5",
|
|
36
|
-
"vite": "^2.9.8"
|
|
37
|
-
"webpack": "^5.52.1",
|
|
38
|
-
"webpack-cli": "^4.8.0",
|
|
39
|
-
"webpack-dev-server": "^3.11.2"
|
|
34
|
+
"vite": "^2.9.8"
|
|
40
35
|
},
|
|
41
36
|
"dependencies": {
|
|
42
|
-
"
|
|
43
|
-
"@lingui/react": "^2",
|
|
44
|
-
"nanoid": "^3.1.30",
|
|
45
|
-
"ts-file-parser": "0.0.21"
|
|
37
|
+
"nanoid": "^3.1.30"
|
|
46
38
|
},
|
|
47
39
|
"scripts": {
|
|
48
40
|
"start": "vite serve",
|