@kissflow/lowcode-client-sdk 1.0.1 → 1.0.2-0.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 +392 -95
- package/dist/index.d.ts +252 -76
- package/dist/kf.lowcodeworkersdk.es.js +649 -0
- package/dist/kf.nocodeworkersdk.es.js +454 -0
- package/dist/kfsdk.es.js +467 -0
- package/dist/kfsdk.umd.js +1 -0
- package/dist/lowcode.d.ts +308 -0
- package/dist/lowcode.types.d.ts +105 -0
- package/dist/nocode.d.ts +305 -0
- package/dist/nocode.types.d.ts +65 -0
- package/dist/snippets.json +193 -0
- package/dist/worker.js +40 -0
- package/package.json +44 -39
- package/custom.build.js +0 -79
- package/dist/app.js +0 -48
- package/dist/base.js +0 -171
- package/dist/client.js +0 -44
- package/dist/component.js +0 -35
- package/dist/constants.js +0 -40
- package/dist/form.js +0 -44
- package/dist/formatter.js +0 -54
- package/dist/global.types.d.ts +0 -54
- package/dist/index.html +0 -23
- package/dist/index.js +0 -7
- package/dist/kflowcode.sdk.js +0 -822
- package/dist/kflowcode.sdk.js.map +0 -1
- package/dist/kflowcode.sdk.module.js +0 -808
- package/dist/kflowcode.sdk.module.js.map +0 -1
- package/dist/lowcode.sdk.js +0 -56
- package/dist/page.js +0 -62
- package/id +0 -55
- package/index.html +0 -23
- package/src/app.ts +0 -31
- package/src/base.ts +0 -109
- package/src/client.ts +0 -28
- package/src/component.ts +0 -15
- package/src/constants.ts +0 -45
- package/src/form.ts +0 -21
- package/src/formatter.ts +0 -35
- package/src/index.ts +0 -7
- package/src/lowcode.sdk.ts +0 -41
- package/src/page.ts +0 -51
- package/test/lcnc-handler.js +0 -45
- package/test/mock/api.js +0 -16
- package/test/mock/id.js +0 -55
- package/tsconfig.json +0 -7
- package/tsconfig.types.json +0 -18
- package/webpack.config.js +0 -63
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
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;
|
|
8
7
|
UPDATE_FORM: string;
|
|
8
|
+
GET_TABLE: string;
|
|
9
|
+
GET_TABLE_ROW: string;
|
|
9
10
|
ADD_TABLE_ROW: string;
|
|
11
|
+
ADD_TABLE_ROWS: string;
|
|
12
|
+
DELETE_TABLE_ROW: string;
|
|
13
|
+
TO_JSON: string;
|
|
14
|
+
GET_TABLE_ROWS: string;
|
|
10
15
|
MESSAGE: string;
|
|
11
16
|
CONFIRM: string;
|
|
12
17
|
ALERT: string;
|
|
@@ -22,108 +27,279 @@ declare module "constants" {
|
|
|
22
27
|
GET_PAGE_VARIABLE: string;
|
|
23
28
|
SET_PAGE_VARIABLE: string;
|
|
24
29
|
GET_PAGE_PARAMS: string;
|
|
25
|
-
|
|
30
|
+
GET_ALL_PAGE_PARAMS: string;
|
|
26
31
|
PAGE_ON_CLOSE: string;
|
|
32
|
+
OPEN_POPUP: string;
|
|
33
|
+
GET_POPUP_PARAMS: string;
|
|
34
|
+
GET_ALL_POPUP_PARAMS: string;
|
|
35
|
+
CLOSE_POPUP: string;
|
|
36
|
+
COMPONENT_GET: string;
|
|
27
37
|
COMPONENT_REFRESH: string;
|
|
38
|
+
COMPONENT_SHOW: string;
|
|
39
|
+
COMPONENT_HIDE: string;
|
|
40
|
+
COMPONENT_ADD_EVENT_LISTENER: string;
|
|
41
|
+
CC_INITIALIZE: string;
|
|
42
|
+
CC_WATCH_PARAMS: string;
|
|
43
|
+
WINDOW_NDEF_READER_NEW: string;
|
|
44
|
+
WINDOW_NDEF_READER_SCAN: string;
|
|
45
|
+
WINDOW_NDEF_READER_WRITE: string;
|
|
46
|
+
WINDOW_NDEF_READER_ADD_EVENT_LISTENER: string;
|
|
47
|
+
WINDOW_NDEF_READER_MAKE_READONLY: string;
|
|
48
|
+
WINDOW_NDEF_READER_ABORT_SCAN: string;
|
|
49
|
+
DECISION_TABLE_EXECUTE: string;
|
|
28
50
|
};
|
|
29
51
|
export const EVENT_TYPES: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
ON_LOAD: string;
|
|
52
|
+
COMPONENT_ON_MOUNT: string;
|
|
53
|
+
CC_ON_PARAMS_CHANGE: string;
|
|
33
54
|
};
|
|
55
|
+
export const DEFAULTS: {
|
|
56
|
+
POPUP_ID: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
declare module "core/index" {
|
|
60
|
+
export function generateId(prefix?: string): string;
|
|
61
|
+
export const globalInstances: {};
|
|
62
|
+
export class EventBase {
|
|
63
|
+
#private;
|
|
64
|
+
constructor();
|
|
65
|
+
_addEventListener(eventName: string, callBack: Function): void;
|
|
66
|
+
_removeEventListener(eventName: string, callBack?: any): void;
|
|
67
|
+
_dispatchEvent(eventName: string, eventParams: object): boolean;
|
|
68
|
+
_dispatchMessageEvents(req: any, resp: any): void;
|
|
69
|
+
}
|
|
70
|
+
export class BaseSDK extends EventBase {
|
|
71
|
+
_postMessageAsync(command: string, args: any, hasCallBack?: boolean, callBack?: (data: any) => {}): object | string | any;
|
|
72
|
+
_postMessage(command: string, args: any, callBack?: any): void;
|
|
73
|
+
}
|
|
74
|
+
export * from "core/constants";
|
|
75
|
+
}
|
|
76
|
+
declare module "types/external" {
|
|
77
|
+
export type userObject = {
|
|
78
|
+
_id: string;
|
|
79
|
+
Name: string;
|
|
80
|
+
Email: string;
|
|
81
|
+
Role: string;
|
|
82
|
+
};
|
|
83
|
+
export type accountObject = {
|
|
84
|
+
_id: string;
|
|
85
|
+
};
|
|
86
|
+
export type environmentObject = {
|
|
87
|
+
isMobile: boolean;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
declare module "types/internal" {
|
|
91
|
+
import { userObject, accountObject, environmentObject } from "types/external";
|
|
92
|
+
export interface SDKContext {
|
|
93
|
+
formInstanceId: string;
|
|
94
|
+
tableId: string;
|
|
95
|
+
tableRowId: string;
|
|
96
|
+
componentId: string;
|
|
97
|
+
componentMethods?: componentMethodsType[];
|
|
98
|
+
appId: string;
|
|
99
|
+
pageId: string;
|
|
100
|
+
popupId: string;
|
|
101
|
+
user: userObject;
|
|
102
|
+
account: accountObject;
|
|
103
|
+
csrfToken: string;
|
|
104
|
+
envDetails: environmentObject;
|
|
105
|
+
}
|
|
106
|
+
export interface componentMethodsType {
|
|
107
|
+
name: string;
|
|
108
|
+
returnType?: string;
|
|
109
|
+
parameters?: string[];
|
|
110
|
+
}
|
|
111
|
+
export interface ComponentProps {
|
|
112
|
+
componentId: string;
|
|
113
|
+
componentMethods?: componentMethodsType[];
|
|
114
|
+
}
|
|
115
|
+
export interface AppContext {
|
|
116
|
+
appId: string;
|
|
117
|
+
pageId: string;
|
|
118
|
+
}
|
|
119
|
+
export interface PageContext {
|
|
120
|
+
pageId: string;
|
|
121
|
+
}
|
|
122
|
+
export interface PopupContext {
|
|
123
|
+
popupId?: string;
|
|
124
|
+
}
|
|
34
125
|
}
|
|
35
|
-
declare module "
|
|
36
|
-
|
|
126
|
+
declare module "app/component" {
|
|
127
|
+
import { BaseSDK } from "core/index";
|
|
128
|
+
import { ComponentProps } from "types/internal";
|
|
129
|
+
export class Component extends BaseSDK {
|
|
37
130
|
#private;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
131
|
+
_id: string;
|
|
132
|
+
type: string;
|
|
133
|
+
constructor(props: ComponentProps);
|
|
134
|
+
onMount(callback: Function): void;
|
|
135
|
+
refresh(): any;
|
|
136
|
+
show(): any;
|
|
137
|
+
hide(): any;
|
|
138
|
+
}
|
|
139
|
+
export class CustomComponent extends BaseSDK {
|
|
140
|
+
type: string;
|
|
141
|
+
_id: string;
|
|
142
|
+
constructor(id: any);
|
|
143
|
+
watchParams(callBack: (data: any) => any): void;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
declare module "app/popup" {
|
|
147
|
+
import { BaseSDK } from "core/index";
|
|
148
|
+
import { Component } from "app/component";
|
|
149
|
+
import { PopupContext } from "types/internal";
|
|
150
|
+
export class Popup extends BaseSDK {
|
|
151
|
+
_id: string;
|
|
152
|
+
type: string;
|
|
153
|
+
constructor(props: PopupContext);
|
|
154
|
+
getParameter(key: string): any;
|
|
155
|
+
getAllParameters(): any;
|
|
156
|
+
close(): any;
|
|
157
|
+
getComponent(componentId: string): Component;
|
|
42
158
|
}
|
|
43
159
|
}
|
|
44
|
-
declare module "page" {
|
|
45
|
-
import { BaseSDK } from "
|
|
160
|
+
declare module "app/page" {
|
|
161
|
+
import { BaseSDK } from "core/index";
|
|
162
|
+
import { Component } from "app/component";
|
|
163
|
+
import { Popup } from "app/popup";
|
|
164
|
+
import { PageContext } from "types/internal";
|
|
46
165
|
export class Page extends BaseSDK {
|
|
47
166
|
_id: string;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
declare module "app" {
|
|
60
|
-
import { BaseSDK } from "
|
|
61
|
-
|
|
167
|
+
popup: Popup;
|
|
168
|
+
type: string;
|
|
169
|
+
constructor(props: PageContext);
|
|
170
|
+
getParameter(key: string): any;
|
|
171
|
+
getAllParameters(): any;
|
|
172
|
+
getVariable(key: string): any;
|
|
173
|
+
setVariable(key: string, value: any): any;
|
|
174
|
+
openPopup(popupId: string, popupParams: object): any;
|
|
175
|
+
getComponent(componentId: string): Component;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
declare module "app/decisiontable" {
|
|
179
|
+
import { BaseSDK } from "core/index";
|
|
180
|
+
export class DecisionTable extends BaseSDK {
|
|
181
|
+
private flowId;
|
|
182
|
+
constructor(flowId: string);
|
|
183
|
+
evaluate(payload?: object): any;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
declare module "app/index" {
|
|
187
|
+
import { BaseSDK } from "core/index";
|
|
188
|
+
import { Page } from "app/page";
|
|
189
|
+
import { AppContext } from "types/internal";
|
|
190
|
+
import { DecisionTable } from "app/decisiontable";
|
|
62
191
|
export class Application extends BaseSDK {
|
|
63
192
|
page: Page;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
193
|
+
_id: string;
|
|
194
|
+
constructor(props: AppContext);
|
|
195
|
+
getVariable(key: string): any;
|
|
196
|
+
setVariable(key: string | object, value?: any): any;
|
|
197
|
+
openPage(pageId: string, pageParams: object): any;
|
|
198
|
+
getDecisionTable(flowId: string): DecisionTable;
|
|
68
199
|
}
|
|
200
|
+
export * from "app/component";
|
|
201
|
+
export { Page };
|
|
202
|
+
export * from "app/popup";
|
|
69
203
|
}
|
|
70
|
-
declare module "client" {
|
|
71
|
-
import { BaseSDK } from "
|
|
204
|
+
declare module "utils/client" {
|
|
205
|
+
import { BaseSDK } from "core/index";
|
|
72
206
|
export class Client extends BaseSDK {
|
|
73
|
-
showInfo(message: string):
|
|
207
|
+
showInfo(message: string): any;
|
|
74
208
|
showConfirm(args: {
|
|
75
209
|
title: string;
|
|
76
210
|
content: string;
|
|
77
211
|
okText: string;
|
|
78
212
|
cancelText: string;
|
|
79
|
-
}):
|
|
80
|
-
redirect(url: string):
|
|
213
|
+
}): any;
|
|
214
|
+
redirect(url: string): any;
|
|
81
215
|
}
|
|
82
216
|
}
|
|
83
|
-
declare module "
|
|
84
|
-
import { BaseSDK } from "
|
|
85
|
-
export class
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
217
|
+
declare module "utils/formatter" {
|
|
218
|
+
import { BaseSDK } from "core/index";
|
|
219
|
+
export class Formatter extends BaseSDK {
|
|
220
|
+
toDate(date: string): any;
|
|
221
|
+
toDateTime(date: string): any;
|
|
222
|
+
toNumber(value: string): any;
|
|
223
|
+
toCurrency(value: string, currencyCode: string): any;
|
|
224
|
+
toBoolean(value: string): any;
|
|
89
225
|
}
|
|
90
226
|
}
|
|
91
|
-
declare module "
|
|
92
|
-
|
|
93
|
-
export
|
|
94
|
-
getField(fieldId: string): string | object;
|
|
95
|
-
updateField(args: object): string | object;
|
|
96
|
-
addTableRow(tableId: string, rowObject: object): string | object;
|
|
97
|
-
}
|
|
227
|
+
declare module "utils/index" {
|
|
228
|
+
export * from "utils/client";
|
|
229
|
+
export * from "utils/formatter";
|
|
98
230
|
}
|
|
99
|
-
declare module "
|
|
100
|
-
import { BaseSDK } from "
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
import { BaseSDK } from "base";
|
|
111
|
-
import { Form } from "form";
|
|
112
|
-
import { Client } from "client";
|
|
113
|
-
import { Formatter } from "formatter";
|
|
114
|
-
import { Application } from "app";
|
|
115
|
-
import { Component } from "component";
|
|
116
|
-
export class LowcodeSDK extends BaseSDK {
|
|
117
|
-
currentForm: Form;
|
|
231
|
+
declare module "index" {
|
|
232
|
+
import { BaseSDK } from "core/index";
|
|
233
|
+
import { Application, Page, CustomComponent } from "app/index";
|
|
234
|
+
import { Client, Formatter } from "utils/index";
|
|
235
|
+
import { userObject, accountObject, environmentObject } from "types/external";
|
|
236
|
+
class CustomComponentSDK extends BaseSDK {
|
|
237
|
+
app: Application;
|
|
238
|
+
page: Page;
|
|
239
|
+
user: userObject;
|
|
240
|
+
account: accountObject;
|
|
241
|
+
context: CustomComponent;
|
|
118
242
|
client: Client;
|
|
119
243
|
formatter: Formatter;
|
|
120
|
-
|
|
121
|
-
constructor(
|
|
244
|
+
env: environmentObject;
|
|
245
|
+
constructor();
|
|
122
246
|
api(url: string, args?: {}): string | object;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
247
|
+
initialize(): any;
|
|
248
|
+
initialise(): any;
|
|
249
|
+
}
|
|
250
|
+
const _default: CustomComponentSDK;
|
|
251
|
+
export default _default;
|
|
252
|
+
}
|
|
253
|
+
declare module "form/index" {
|
|
254
|
+
import { BaseSDK } from "core/index";
|
|
255
|
+
export class Form extends BaseSDK {
|
|
256
|
+
private instanceId;
|
|
257
|
+
type: string;
|
|
258
|
+
constructor(instanceId: string);
|
|
259
|
+
toJSON(): any;
|
|
260
|
+
getField(fieldId: string): any;
|
|
261
|
+
updateField(args: object): any;
|
|
262
|
+
getTable(tableId: string): Table;
|
|
263
|
+
}
|
|
264
|
+
class Table extends BaseSDK {
|
|
265
|
+
private tableId;
|
|
266
|
+
private instanceId;
|
|
267
|
+
constructor(instanceId: string, tableId: string);
|
|
268
|
+
toJSON(): any;
|
|
269
|
+
getRows(): TableForm[];
|
|
270
|
+
getRow(rowId: string): TableForm;
|
|
271
|
+
addRow(rowObject: object): any;
|
|
272
|
+
addRows(rows: [object]): any;
|
|
273
|
+
deleteRow(rowId: string): any;
|
|
274
|
+
deleteRows(rows: [string]): any;
|
|
126
275
|
}
|
|
127
|
-
|
|
128
|
-
|
|
276
|
+
export class TableForm extends BaseSDK {
|
|
277
|
+
private instanceId;
|
|
278
|
+
private tableId;
|
|
279
|
+
private rowId;
|
|
280
|
+
type: string;
|
|
281
|
+
constructor(instanceId: string, tableId: string, rowId: string);
|
|
282
|
+
getParent(): Form;
|
|
283
|
+
toJSON(): any;
|
|
284
|
+
getField(fieldId: string): any;
|
|
285
|
+
updateField(args: object): any;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
declare module "window/NDEFReader" {
|
|
289
|
+
import { BaseSDK } from "core/index";
|
|
290
|
+
export class NDEFReader extends BaseSDK {
|
|
291
|
+
id: string;
|
|
292
|
+
constructor();
|
|
293
|
+
scan(): Promise<unknown>;
|
|
294
|
+
write(data: any): Promise<unknown>;
|
|
295
|
+
addEventListener(eventName: string, cb: Function): void;
|
|
296
|
+
makeReadOnly(): Promise<unknown>;
|
|
297
|
+
abortScan(): Promise<unknown>;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
declare module "window/index" {
|
|
301
|
+
import { NDEFReader } from "window/NDEFReader";
|
|
302
|
+
export const window: {
|
|
303
|
+
NDEFReader: typeof NDEFReader;
|
|
304
|
+
};
|
|
129
305
|
}
|