@kissflow/lowcode-client-sdk 1.0.9 → 1.0.12-beta.1
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 +114 -124
- package/dist/global.types.d.ts +48 -40
- package/dist/index.d.ts +111 -66
- package/dist/kfsdk.es.js +192 -134
- package/dist/kfsdk.umd.js +1 -1
- package/dist/kfworkersdk.es.js +200 -88
- package/dist/lowcode.d.ts +143 -97
- package/package.json +52 -53
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,31 +32,105 @@ 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;
|
|
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;
|
|
59
105
|
}
|
|
60
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";
|
|
133
|
+
}
|
|
61
134
|
declare module "types/external" {
|
|
62
135
|
export type userObject = {
|
|
63
136
|
_id: string;
|
|
@@ -69,29 +142,34 @@ declare module "types/external" {
|
|
|
69
142
|
export type accountObject = {
|
|
70
143
|
_id: string;
|
|
71
144
|
};
|
|
145
|
+
export type environmentObject = {
|
|
146
|
+
isMobile: boolean;
|
|
147
|
+
};
|
|
72
148
|
}
|
|
73
149
|
declare module "types/internal" {
|
|
74
|
-
import { userObject, accountObject } from "types/external";
|
|
150
|
+
import { userObject, accountObject, environmentObject } from "types/external";
|
|
75
151
|
export interface SDKContext {
|
|
76
152
|
formInstanceId: string;
|
|
77
153
|
tableId: string;
|
|
78
154
|
tableRowId: string;
|
|
79
155
|
componentId: string;
|
|
80
|
-
|
|
156
|
+
componentMethods?: componentMethodsType[];
|
|
81
157
|
appId: string;
|
|
82
158
|
pageId: string;
|
|
83
159
|
popupId: string;
|
|
84
160
|
user: userObject;
|
|
85
161
|
account: accountObject;
|
|
162
|
+
csrfToken: string;
|
|
163
|
+
envDetails: environmentObject;
|
|
86
164
|
}
|
|
87
|
-
export interface
|
|
165
|
+
export interface componentMethodsType {
|
|
88
166
|
name: string;
|
|
89
167
|
returnType?: string;
|
|
90
168
|
parameters?: string[];
|
|
91
169
|
}
|
|
92
170
|
export interface ComponentProps {
|
|
93
171
|
componentId: string;
|
|
94
|
-
|
|
172
|
+
componentMethods?: componentMethodsType[];
|
|
95
173
|
}
|
|
96
174
|
export interface AppContext {
|
|
97
175
|
appId: string;
|
|
@@ -104,26 +182,29 @@ declare module "types/internal" {
|
|
|
104
182
|
popupId?: string;
|
|
105
183
|
}
|
|
106
184
|
}
|
|
107
|
-
declare module "component" {
|
|
108
|
-
import { BaseSDK } from "
|
|
185
|
+
declare module "app/component" {
|
|
186
|
+
import { BaseSDK } from "core/index";
|
|
109
187
|
import { ComponentProps } from "types/internal";
|
|
110
188
|
export class Component extends BaseSDK {
|
|
189
|
+
#private;
|
|
111
190
|
_id: string;
|
|
112
191
|
type: string;
|
|
113
192
|
constructor(props: ComponentProps);
|
|
193
|
+
onMount(callback: Function): void;
|
|
114
194
|
refresh(): any;
|
|
115
195
|
show(): any;
|
|
116
196
|
hide(): any;
|
|
117
197
|
}
|
|
118
198
|
export class CustomComponent extends BaseSDK {
|
|
119
199
|
type: string;
|
|
120
|
-
|
|
121
|
-
|
|
200
|
+
_id: string;
|
|
201
|
+
constructor(id: any);
|
|
202
|
+
watchParams(callBack: (data: any) => any): void;
|
|
122
203
|
}
|
|
123
204
|
}
|
|
124
|
-
declare module "popup" {
|
|
125
|
-
import {
|
|
126
|
-
import {
|
|
205
|
+
declare module "app/popup" {
|
|
206
|
+
import { BaseSDK } from "core/index";
|
|
207
|
+
import { Component } from "app/component";
|
|
127
208
|
import { PopupContext } from "types/internal";
|
|
128
209
|
export class Popup extends BaseSDK {
|
|
129
210
|
_id: string;
|
|
@@ -135,10 +216,10 @@ declare module "popup" {
|
|
|
135
216
|
getComponent(componentId: string): Component;
|
|
136
217
|
}
|
|
137
218
|
}
|
|
138
|
-
declare module "page" {
|
|
139
|
-
import {
|
|
140
|
-
import {
|
|
141
|
-
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";
|
|
142
223
|
import { PageContext } from "types/internal";
|
|
143
224
|
export class Page extends BaseSDK {
|
|
144
225
|
_id: string;
|
|
@@ -153,97 +234,62 @@ declare module "page" {
|
|
|
153
234
|
getComponent(componentId: string): Component;
|
|
154
235
|
}
|
|
155
236
|
}
|
|
156
|
-
declare module "app" {
|
|
157
|
-
import { BaseSDK } from "
|
|
158
|
-
import { Page } from "page";
|
|
237
|
+
declare module "app/index" {
|
|
238
|
+
import { BaseSDK } from "core/index";
|
|
239
|
+
import { Page } from "app/page";
|
|
159
240
|
import { AppContext } from "types/internal";
|
|
160
241
|
export class Application extends BaseSDK {
|
|
161
242
|
page: Page;
|
|
162
243
|
_id: string;
|
|
163
244
|
constructor(props: AppContext);
|
|
164
245
|
getVariable(key: string): any;
|
|
165
|
-
setVariable(key: string | object, value
|
|
246
|
+
setVariable(key: string | object, value?: any): any;
|
|
166
247
|
openPage(pageId: string, pageParams: object): any;
|
|
167
248
|
}
|
|
249
|
+
export * from "app/component";
|
|
250
|
+
export { Page };
|
|
251
|
+
export * from "app/popup";
|
|
168
252
|
}
|
|
169
|
-
declare module "
|
|
170
|
-
import { BaseSDK } from "
|
|
171
|
-
export class
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
redirect(url: string): any;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
declare module "form" {
|
|
183
|
-
import { BaseSDK } from "base";
|
|
184
|
-
export class Form extends BaseSDK {
|
|
185
|
-
private instanceId;
|
|
186
|
-
type: string;
|
|
187
|
-
constructor(instanceId: string);
|
|
188
|
-
toJSON(): any;
|
|
189
|
-
getField(fieldId: string): any;
|
|
190
|
-
updateField(args: object): any;
|
|
191
|
-
getTable(tableId: string): Table;
|
|
192
|
-
}
|
|
193
|
-
class Table extends BaseSDK {
|
|
194
|
-
private tableId;
|
|
195
|
-
private instanceId;
|
|
196
|
-
constructor(instanceId: string, tableId: string);
|
|
197
|
-
toJSON(): any;
|
|
198
|
-
getRows(): TableForm[];
|
|
199
|
-
getRow(rowId: string): TableForm;
|
|
200
|
-
addRow(rowObject: object): any;
|
|
201
|
-
deleteRow(rowId: string): any;
|
|
202
|
-
}
|
|
203
|
-
export class TableForm extends BaseSDK {
|
|
204
|
-
private instanceId;
|
|
205
|
-
private tableId;
|
|
206
|
-
private rowId;
|
|
207
|
-
type: string;
|
|
208
|
-
constructor(instanceId: string, tableId: string, rowId: string);
|
|
209
|
-
getParent(): Form;
|
|
210
|
-
toJSON(): any;
|
|
211
|
-
getField(fieldId: string): any;
|
|
212
|
-
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>;
|
|
213
263
|
}
|
|
214
264
|
}
|
|
215
|
-
declare module "
|
|
216
|
-
import {
|
|
217
|
-
export
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
toNumber(value: string): any;
|
|
221
|
-
toCurrency(value: string, currencyCode: string): any;
|
|
222
|
-
toBoolean(value: string): any;
|
|
223
|
-
}
|
|
265
|
+
declare module "window/index" {
|
|
266
|
+
import { NDEFReader } from "window/NDEFReader";
|
|
267
|
+
export const window: {
|
|
268
|
+
NDEFReader: typeof NDEFReader;
|
|
269
|
+
};
|
|
224
270
|
}
|
|
225
271
|
declare module "lowcode" {
|
|
226
|
-
import { BaseSDK } from "
|
|
227
|
-
import { Form } from "form";
|
|
228
|
-
import {
|
|
229
|
-
import {
|
|
230
|
-
import {
|
|
231
|
-
import { Application } from "app";
|
|
232
|
-
import { Page } from "page";
|
|
233
|
-
import { Component } from "component";
|
|
234
|
-
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";
|
|
235
277
|
import { SDKContext } from "types/internal";
|
|
236
|
-
import { userObject, accountObject } from "types/external";
|
|
278
|
+
import { userObject, accountObject, environmentObject } from "types/external";
|
|
237
279
|
class LowcodeSDK extends BaseSDK {
|
|
280
|
+
#private;
|
|
238
281
|
context: Component | Form | TableForm | Page | Popup;
|
|
239
282
|
client: Client;
|
|
240
283
|
formatter: Formatter;
|
|
241
284
|
app: Application;
|
|
242
285
|
user: userObject;
|
|
286
|
+
env: environmentObject;
|
|
243
287
|
account: accountObject;
|
|
244
288
|
constructor(props: SDKContext);
|
|
245
|
-
api(url: string, args?: {
|
|
289
|
+
api(url: string, args?: {
|
|
290
|
+
headers: object;
|
|
291
|
+
}): Promise<any>;
|
|
246
292
|
}
|
|
247
293
|
function initSDK(config: SDKContext): LowcodeSDK;
|
|
248
|
-
export default
|
|
294
|
+
export { window, initSDK as default };
|
|
249
295
|
}
|
package/package.json
CHANGED
|
@@ -1,54 +1,53 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
2
|
+
"name": "@kissflow/lowcode-client-sdk",
|
|
3
|
+
"version": "1.0.12-beta.1",
|
|
4
|
+
"description": "JavaScript SDK for developing over the Kissflow lowcode platform",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist/"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/kfsdk.umd.js",
|
|
10
|
+
"module": "./dist/kfsdk.es.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/kfsdk.es.js",
|
|
14
|
+
"require": "./dist/kfsdk.umd.js"
|
|
15
|
+
},
|
|
16
|
+
"./lowcode": {
|
|
17
|
+
"import": "./dist/kfworkersdk.es.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/kissflow/lcnc-sdk-js.git"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [],
|
|
25
|
+
"author": "Vivek Madurai<vivek@kissflow.com>",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/kissflow/lcnc-sdk-js/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/kissflow/lcnc-sdk-js#readme",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"html-webpack-plugin": "^5.3.1",
|
|
33
|
+
"http-server": "^0.12.3",
|
|
34
|
+
"ts-loader": "^9.2.5",
|
|
35
|
+
"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"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@lingui/cli": "^3.13.3",
|
|
43
|
+
"@lingui/react": "^2",
|
|
44
|
+
"nanoid": "^3.1.30",
|
|
45
|
+
"ts-file-parser": "0.0.21"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"start": "vite serve",
|
|
49
|
+
"customBuild": "node custom.build.mjs",
|
|
50
|
+
"build": "pnpm run customBuild",
|
|
51
|
+
"serve": "http-server -p 8080"
|
|
52
|
+
}
|
|
53
|
+
}
|