@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/README.md +28 -12
- package/dist/index.d.ts +105 -67
- package/dist/{kfworkersdk.es.js → kf.lowcodeworkersdk.es.js} +180 -85
- package/dist/kf.nocodeworkersdk.es.js +420 -0
- package/dist/kfsdk.es.js +187 -133
- package/dist/kfsdk.umd.js +1 -1
- package/dist/lowcode.d.ts +131 -94
- package/dist/{global.types.d.ts → lowcode.types.d.ts} +40 -39
- package/dist/nocode.d.ts +292 -0
- package/dist/nocode.types.d.ts +64 -0
- package/package.json +5 -13
package/dist/nocode.d.ts
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
declare module "core/constants" {
|
|
2
|
+
export const LISTENER_CMDS: {
|
|
3
|
+
API: string;
|
|
4
|
+
GET_CONTEXT: string;
|
|
5
|
+
RETURN: string;
|
|
6
|
+
GET_FORM_FIELD: string;
|
|
7
|
+
UPDATE_FORM: string;
|
|
8
|
+
GET_TABLE: string;
|
|
9
|
+
GET_TABLE_ROW: string;
|
|
10
|
+
ADD_TABLE_ROW: string;
|
|
11
|
+
DELETE_TABLE_ROW: string;
|
|
12
|
+
TO_JSON: string;
|
|
13
|
+
GET_TABLE_ROWS: string;
|
|
14
|
+
MESSAGE: string;
|
|
15
|
+
CONFIRM: string;
|
|
16
|
+
ALERT: string;
|
|
17
|
+
REDIRECT: string;
|
|
18
|
+
OPEN_PAGE: string;
|
|
19
|
+
FORMAT_DATE: string;
|
|
20
|
+
FORMAT_DATE_TIME: string;
|
|
21
|
+
FORMAT_NUMBER: string;
|
|
22
|
+
FORMAT_CURRENCY: string;
|
|
23
|
+
FORMAT_BOOLEAN: string;
|
|
24
|
+
GET_APP_VARIABLE: string;
|
|
25
|
+
SET_APP_VARIABLE: string;
|
|
26
|
+
GET_PAGE_VARIABLE: string;
|
|
27
|
+
SET_PAGE_VARIABLE: string;
|
|
28
|
+
GET_PAGE_PARAMS: string;
|
|
29
|
+
GET_ALL_PAGE_PARAMS: string;
|
|
30
|
+
PAGE_ON_CLOSE: string;
|
|
31
|
+
OPEN_POPUP: string;
|
|
32
|
+
GET_POPUP_PARAMS: string;
|
|
33
|
+
GET_ALL_POPUP_PARAMS: string;
|
|
34
|
+
CLOSE_POPUP: string;
|
|
35
|
+
COMPONENT_GET: string;
|
|
36
|
+
COMPONENT_REFRESH: string;
|
|
37
|
+
COMPONENT_SHOW: string;
|
|
38
|
+
COMPONENT_HIDE: 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;
|
|
48
|
+
};
|
|
49
|
+
export const EVENT_TYPES: {
|
|
50
|
+
COMPONENT_ON_MOUNT: string;
|
|
51
|
+
CC_ON_PARAMS_CHANGE: string;
|
|
52
|
+
};
|
|
53
|
+
export const DEFAULTS: {
|
|
54
|
+
POPUP_ID: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
declare module "core/index" {
|
|
58
|
+
export function generateId(prefix?: string): string;
|
|
59
|
+
export const globalInstances: {};
|
|
60
|
+
export class EventBase {
|
|
61
|
+
#private;
|
|
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 {
|
|
69
|
+
_postMessageAsync(command: string, args: any, hasCallBack?: boolean, callBack?: (data: any) => {}): object | string | any;
|
|
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;
|
|
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";
|
|
133
|
+
}
|
|
134
|
+
declare module "window/NDEFReader" {
|
|
135
|
+
import { BaseSDK } from "core/index";
|
|
136
|
+
export class NDEFReader extends BaseSDK {
|
|
137
|
+
id: string;
|
|
138
|
+
constructor();
|
|
139
|
+
scan(): Promise<unknown>;
|
|
140
|
+
write(data: any): Promise<unknown>;
|
|
141
|
+
addEventListener(eventName: string, cb: Function): void;
|
|
142
|
+
makeReadOnly(): Promise<unknown>;
|
|
143
|
+
abortScan(): Promise<unknown>;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
declare module "window/index" {
|
|
147
|
+
import { NDEFReader } from "window/NDEFReader";
|
|
148
|
+
export const window: {
|
|
149
|
+
NDEFReader: typeof NDEFReader;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
declare module "types/external" {
|
|
153
|
+
export type userObject = {
|
|
154
|
+
_id: string;
|
|
155
|
+
Name: string;
|
|
156
|
+
Email: string;
|
|
157
|
+
UserType: string;
|
|
158
|
+
Role: string;
|
|
159
|
+
};
|
|
160
|
+
export type accountObject = {
|
|
161
|
+
_id: string;
|
|
162
|
+
};
|
|
163
|
+
export type environmentObject = {
|
|
164
|
+
isMobile: boolean;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
declare module "types/internal" {
|
|
168
|
+
import { userObject, accountObject, environmentObject } from "types/external";
|
|
169
|
+
export interface SDKContext {
|
|
170
|
+
formInstanceId: string;
|
|
171
|
+
tableId: string;
|
|
172
|
+
tableRowId: string;
|
|
173
|
+
componentId: string;
|
|
174
|
+
componentMethods?: componentMethodsType[];
|
|
175
|
+
appId: string;
|
|
176
|
+
pageId: string;
|
|
177
|
+
popupId: string;
|
|
178
|
+
user: userObject;
|
|
179
|
+
account: accountObject;
|
|
180
|
+
csrfToken: string;
|
|
181
|
+
envDetails: environmentObject;
|
|
182
|
+
}
|
|
183
|
+
export interface componentMethodsType {
|
|
184
|
+
name: string;
|
|
185
|
+
returnType?: string;
|
|
186
|
+
parameters?: string[];
|
|
187
|
+
}
|
|
188
|
+
export interface ComponentProps {
|
|
189
|
+
componentId: string;
|
|
190
|
+
componentMethods?: componentMethodsType[];
|
|
191
|
+
}
|
|
192
|
+
export interface AppContext {
|
|
193
|
+
appId: string;
|
|
194
|
+
pageId: string;
|
|
195
|
+
}
|
|
196
|
+
export interface PageContext {
|
|
197
|
+
pageId: string;
|
|
198
|
+
}
|
|
199
|
+
export interface PopupContext {
|
|
200
|
+
popupId?: string;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
declare module "nocode" {
|
|
204
|
+
import { BaseSDK } from "core/index";
|
|
205
|
+
import { Form, TableForm } from "form/index";
|
|
206
|
+
import { Client, Formatter } from "utils/index";
|
|
207
|
+
import { window } from "window/index";
|
|
208
|
+
import { SDKContext } from "types/internal";
|
|
209
|
+
import { userObject, accountObject } from "types/external";
|
|
210
|
+
class NocodeSDK extends BaseSDK {
|
|
211
|
+
#private;
|
|
212
|
+
context: Form | TableForm;
|
|
213
|
+
client: Client;
|
|
214
|
+
formatter: Formatter;
|
|
215
|
+
user: userObject;
|
|
216
|
+
account: accountObject;
|
|
217
|
+
constructor(props: SDKContext);
|
|
218
|
+
api(url: string, args?: {
|
|
219
|
+
headers: object;
|
|
220
|
+
}): Promise<any>;
|
|
221
|
+
}
|
|
222
|
+
function initSDK(config: SDKContext): NocodeSDK;
|
|
223
|
+
export { window, initSDK as default };
|
|
224
|
+
}
|
|
225
|
+
declare module "app/component" {
|
|
226
|
+
import { BaseSDK } from "core/index";
|
|
227
|
+
import { ComponentProps } from "types/internal";
|
|
228
|
+
export class Component extends BaseSDK {
|
|
229
|
+
#private;
|
|
230
|
+
_id: string;
|
|
231
|
+
type: string;
|
|
232
|
+
constructor(props: ComponentProps);
|
|
233
|
+
onMount(callback: Function): void;
|
|
234
|
+
refresh(): any;
|
|
235
|
+
show(): any;
|
|
236
|
+
hide(): any;
|
|
237
|
+
}
|
|
238
|
+
export class CustomComponent extends BaseSDK {
|
|
239
|
+
type: string;
|
|
240
|
+
_id: string;
|
|
241
|
+
constructor(id: any);
|
|
242
|
+
watchParams(callBack: (data: any) => any): void;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
declare module "app/popup" {
|
|
246
|
+
import { BaseSDK } from "core/index";
|
|
247
|
+
import { Component } from "app/component";
|
|
248
|
+
import { PopupContext } from "types/internal";
|
|
249
|
+
export class Popup extends BaseSDK {
|
|
250
|
+
_id: string;
|
|
251
|
+
type: string;
|
|
252
|
+
constructor(props: PopupContext);
|
|
253
|
+
getParameter(key: string): any;
|
|
254
|
+
getAllParameters(): any;
|
|
255
|
+
close(): any;
|
|
256
|
+
getComponent(componentId: string): Component;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
declare module "app/page" {
|
|
260
|
+
import { BaseSDK } from "core/index";
|
|
261
|
+
import { Component } from "app/component";
|
|
262
|
+
import { Popup } from "app/popup";
|
|
263
|
+
import { PageContext } from "types/internal";
|
|
264
|
+
export class Page extends BaseSDK {
|
|
265
|
+
_id: string;
|
|
266
|
+
popup: Popup;
|
|
267
|
+
type: string;
|
|
268
|
+
constructor(props: PageContext);
|
|
269
|
+
getParameter(key: string): any;
|
|
270
|
+
getAllParameters(): any;
|
|
271
|
+
getVariable(key: string): any;
|
|
272
|
+
setVariable(key: string, value: any): any;
|
|
273
|
+
openPopup(popupId: string, popupParams: object): any;
|
|
274
|
+
getComponent(componentId: string): Component;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
declare module "app/index" {
|
|
278
|
+
import { BaseSDK } from "core/index";
|
|
279
|
+
import { Page } from "app/page";
|
|
280
|
+
import { AppContext } from "types/internal";
|
|
281
|
+
export class Application extends BaseSDK {
|
|
282
|
+
page: Page;
|
|
283
|
+
_id: string;
|
|
284
|
+
constructor(props: AppContext);
|
|
285
|
+
getVariable(key: string): any;
|
|
286
|
+
setVariable(key: string | object, value?: any): any;
|
|
287
|
+
openPage(pageId: string, pageParams: object): any;
|
|
288
|
+
}
|
|
289
|
+
export * from "app/component";
|
|
290
|
+
export { Page };
|
|
291
|
+
export * from "app/popup";
|
|
292
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
}
|
|
40
|
+
declare class kf {
|
|
41
|
+
static context: Form
|
|
42
|
+
static client: Client
|
|
43
|
+
static formatter: Formatter
|
|
44
|
+
static user: userObject
|
|
45
|
+
static account: accountObject
|
|
46
|
+
api(url: string, args?: {
|
|
47
|
+
headers: object;
|
|
48
|
+
}): Promise<any>;
|
|
49
|
+
}
|
|
50
|
+
declare type userObject = {
|
|
51
|
+
_id: string;
|
|
52
|
+
Name: string;
|
|
53
|
+
Email: string;
|
|
54
|
+
UserType: string;
|
|
55
|
+
Role: string;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
declare type accountObject = {
|
|
59
|
+
_id: string;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
declare type environmentObject = {
|
|
63
|
+
isMobile: boolean
|
|
64
|
+
}
|
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-beta",
|
|
4
4
|
"description": "JavaScript SDK for developing over the Kissflow lowcode platform",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"require": "./dist/kfsdk.umd.js"
|
|
15
15
|
},
|
|
16
16
|
"./lowcode": {
|
|
17
|
-
"import": "./dist/
|
|
17
|
+
"import": "./dist/kf.lowcodeworkersdk.es.js"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
@@ -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",
|