@kissflow/lowcode-client-sdk 1.0.21 → 1.0.22
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 +184 -53
- package/dist/index.d.ts +11 -0
- package/dist/kf.lowcodeworkersdk.es.js +17 -1
- package/dist/kf.nocodeworkersdk.es.js +2 -1
- package/dist/kfsdk.es.js +17 -1
- package/dist/kfsdk.umd.js +1 -1
- package/dist/lowcode.d.ts +11 -0
- package/dist/lowcode.types.d.ts +4 -0
- package/dist/nocode.d.ts +11 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# _Kissflow Lowcode JavaScript SDK_
|
|
2
2
|
|
|
3
3
|
JavaScript SDK for developing over the Kissflow lowcode platform
|
|
4
|
+
|
|
4
5
|
### Use as an `npm` module
|
|
5
6
|
|
|
6
|
-
Install the SDK as a module: `npm i @kissflow/lowcode-client-sdk` Then import
|
|
7
|
+
Install the SDK as a module: `npm i @kissflow/lowcode-client-sdk` Then import
|
|
8
|
+
into your project:
|
|
9
|
+
|
|
7
10
|
```js
|
|
8
11
|
import KFSDK from "@kissflow/lowcode-client-sdk";
|
|
9
12
|
let kf;
|
|
@@ -11,14 +14,19 @@ let kf;
|
|
|
11
14
|
kf = await KFSDK.initialize();
|
|
12
15
|
})();
|
|
13
16
|
```
|
|
17
|
+
|
|
14
18
|
> Note: Initializing Kf SDK in custom components returns a promise.
|
|
19
|
+
|
|
15
20
|
### Use as a `<script>` tag directly in HTML
|
|
16
21
|
|
|
17
22
|
SDK can also be loaded directly into HTML by adding:
|
|
23
|
+
|
|
18
24
|
```html
|
|
19
25
|
<script src="https://unpkg.com/@kissflow/lowcode-client-sdk@latest/dist/kfsdk.umd.js"></script>
|
|
20
26
|
```
|
|
27
|
+
|
|
21
28
|
Then SDK can be initialized as:
|
|
29
|
+
|
|
22
30
|
```js
|
|
23
31
|
let kf;
|
|
24
32
|
window.onload = async function () {
|
|
@@ -27,15 +35,20 @@ window.onload = async function () {
|
|
|
27
35
|
```
|
|
28
36
|
|
|
29
37
|
### User and Account details
|
|
38
|
+
|
|
30
39
|
Details of authenticated user can be accessed as following
|
|
40
|
+
|
|
31
41
|
```js
|
|
32
|
-
const { Name, Email, _id } = kf.user
|
|
42
|
+
const { Name, Email, _id } = kf.user;
|
|
33
43
|
```
|
|
44
|
+
|
|
34
45
|
And account id can be accessed as `kf.account._id`
|
|
35
46
|
|
|
36
47
|
### Fetch Api through sdk
|
|
37
|
-
|
|
38
|
-
|
|
48
|
+
|
|
49
|
+
Fetch any other kissflow api & external api using this method. kf.api has header
|
|
50
|
+
tokens by default for making authenticated kissflow api calls
|
|
51
|
+
|
|
39
52
|
> Note: This method has a limit of 10 seconds for an api call
|
|
40
53
|
|
|
41
54
|
```js
|
|
@@ -45,32 +58,36 @@ let resp = await kf.api(url, config)
|
|
|
45
58
|
```
|
|
46
59
|
|
|
47
60
|
## Table of contents
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
61
|
+
|
|
62
|
+
- [1. Context](#1-context)
|
|
63
|
+
- [Custom Components](#custom-component)
|
|
64
|
+
- [Form](#custom-component)
|
|
65
|
+
- [Form Table](#form-table)
|
|
66
|
+
- [Table Row](#table-row)
|
|
67
|
+
- [2. Client](#2-client)
|
|
68
|
+
- [3. Application](#3-application)
|
|
69
|
+
- [4. Page](#4-page)
|
|
70
|
+
- [5. Component](#5-component)
|
|
71
|
+
- [Standard Component methods](#standard-component-methods)
|
|
72
|
+
- [Component Specific methods](#component-specific-methods)
|
|
73
|
+
- [Tab](#521-tab-component)
|
|
74
|
+
- [6. Popup](#6-popup)
|
|
75
|
+
- [7. Formatter](#7-formatter)
|
|
62
76
|
|
|
63
77
|
## 1) Context
|
|
64
78
|
|
|
65
|
-
Context methods are polymorphic, it has different classes pre-initialized based
|
|
79
|
+
Context methods are polymorphic, it has different classes pre-initialized based
|
|
80
|
+
on execution context.
|
|
66
81
|
|
|
67
82
|
### Custom component
|
|
68
83
|
|
|
69
|
-
`kf.context` returns a `CustomComponent` class while using inside custom
|
|
84
|
+
`kf.context` returns a `CustomComponent` class while using inside custom
|
|
85
|
+
component. Custom component supported methods:
|
|
70
86
|
|
|
71
87
|
##### a) Watch Params
|
|
72
88
|
|
|
73
|
-
Listens for changes in parameter given to custom components in lowcode
|
|
89
|
+
Listens for changes in parameter given to custom components in lowcode
|
|
90
|
+
application.
|
|
74
91
|
|
|
75
92
|
```js
|
|
76
93
|
kf.context.watchParams(function (data) {
|
|
@@ -80,14 +97,18 @@ kf.context.watchParams(function (data) {
|
|
|
80
97
|
|
|
81
98
|
### Kissflow Forms
|
|
82
99
|
|
|
83
|
-
`kf.context` returns a `Form` class when it is used inside a kissflow's form
|
|
100
|
+
`kf.context` returns a `Form` class when it is used inside a kissflow's form
|
|
101
|
+
that could be either Process, case or Dataform & it has following supported
|
|
102
|
+
methods
|
|
84
103
|
|
|
85
104
|
##### a) getField()
|
|
86
105
|
|
|
87
106
|
###### Description:
|
|
107
|
+
|
|
88
108
|
Use this function to get the current value of a form field
|
|
89
109
|
|
|
90
110
|
###### Syntax:
|
|
111
|
+
|
|
91
112
|
```js
|
|
92
113
|
kf.context.getField(fieldId).then((res) => {...})
|
|
93
114
|
// or
|
|
@@ -97,9 +118,11 @@ let value = await kf.context.getField(fieldId)
|
|
|
97
118
|
##### b) updateField()
|
|
98
119
|
|
|
99
120
|
###### Description:
|
|
121
|
+
|
|
100
122
|
Use this function to get update any field in the form
|
|
101
123
|
|
|
102
124
|
###### Syntax:
|
|
125
|
+
|
|
103
126
|
```js
|
|
104
127
|
kf.context.updateField({ fieldId_1: fieldValue, fieldId_2: fieldValue });
|
|
105
128
|
```
|
|
@@ -107,14 +130,17 @@ kf.context.updateField({ fieldId_1: fieldValue, fieldId_2: fieldValue });
|
|
|
107
130
|
##### c) toJSON()
|
|
108
131
|
|
|
109
132
|
###### Description:
|
|
133
|
+
|
|
110
134
|
Use this function to get the JSON data of the current form
|
|
111
135
|
|
|
112
136
|
###### Syntax:
|
|
137
|
+
|
|
113
138
|
```js
|
|
114
139
|
const json = await kf.context.toJSON();
|
|
115
140
|
```
|
|
116
141
|
|
|
117
142
|
###### Output:
|
|
143
|
+
|
|
118
144
|
```
|
|
119
145
|
{
|
|
120
146
|
"Untitled_Field": "testing",
|
|
@@ -127,34 +153,40 @@ const json = await kf.context.toJSON();
|
|
|
127
153
|
|
|
128
154
|
### Form Table
|
|
129
155
|
|
|
130
|
-
`kf.context.getTable(tableId)` returns a `Table` class which has the following
|
|
156
|
+
`kf.context.getTable(tableId)` returns a `Table` class which has the following
|
|
157
|
+
methods
|
|
131
158
|
|
|
132
159
|
#### a) addRow()
|
|
133
160
|
|
|
134
161
|
###### Description:
|
|
162
|
+
|
|
135
163
|
Appends row details to the table.
|
|
136
164
|
|
|
137
165
|
###### Syntax:
|
|
166
|
+
|
|
138
167
|
```js
|
|
139
168
|
const table = kf.context.getTable(tableId);
|
|
140
169
|
table.addRow({ columnId1: value, columnId2: value });
|
|
141
170
|
```
|
|
171
|
+
|
|
142
172
|
> ##### Note: If there are more than one rows to be added to table then use `addRows()` instead for these bulk operations
|
|
143
173
|
|
|
144
174
|
#### b) addRows()
|
|
145
175
|
|
|
146
176
|
###### Description:
|
|
177
|
+
|
|
147
178
|
Appends multiple rows details to the table.
|
|
148
179
|
|
|
149
180
|
###### Syntax:
|
|
181
|
+
|
|
150
182
|
```js
|
|
151
183
|
const table = kf.context.getTable(tableId);
|
|
152
184
|
let accumulator = [];
|
|
153
|
-
someArrayOfObjects.forEach(function(rowDetail) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
185
|
+
someArrayOfObjects.forEach(function (rowDetail) {
|
|
186
|
+
accumulator.push({
|
|
187
|
+
columnId1: rowDetail[columnId1],
|
|
188
|
+
columnId2: rowDetail[columnId2]
|
|
189
|
+
});
|
|
158
190
|
});
|
|
159
191
|
await table.addRows(accumulator);
|
|
160
192
|
```
|
|
@@ -162,21 +194,26 @@ await table.addRows(accumulator);
|
|
|
162
194
|
#### c) deleteRow()
|
|
163
195
|
|
|
164
196
|
###### Description:
|
|
197
|
+
|
|
165
198
|
Deletes a row from the table based on the row id
|
|
166
199
|
|
|
167
200
|
###### Syntax:
|
|
201
|
+
|
|
168
202
|
```js
|
|
169
203
|
const table = kf.context.getTable(tableId);
|
|
170
204
|
await table.deleteRow(rowId);
|
|
171
205
|
```
|
|
206
|
+
|
|
172
207
|
> ##### Note: If there are more than one rows to be deleted then use `deleteRows()` instead.
|
|
173
208
|
|
|
174
209
|
#### d) deleteRows()
|
|
175
210
|
|
|
176
211
|
###### Description:
|
|
212
|
+
|
|
177
213
|
Deletes multiple rows from the table based on given array of strings.
|
|
178
214
|
|
|
179
215
|
###### Syntax:
|
|
216
|
+
|
|
180
217
|
```js
|
|
181
218
|
const table = kf.context.getTable(tableId);
|
|
182
219
|
await table.deleteRows([rowId1, rowId2, rowId3]);
|
|
@@ -185,41 +222,50 @@ await table.deleteRows([rowId1, rowId2, rowId3]);
|
|
|
185
222
|
#### e) getRow()
|
|
186
223
|
|
|
187
224
|
###### Description:
|
|
225
|
+
|
|
188
226
|
Use this function to perform form actions on any row inside a child table
|
|
189
227
|
|
|
190
228
|
###### Syntax:
|
|
229
|
+
|
|
191
230
|
```js
|
|
192
231
|
const table = kf.context.getTable(tableId);
|
|
193
232
|
const row = table.getRow(rowId);
|
|
194
233
|
```
|
|
195
234
|
|
|
196
235
|
###### Output:
|
|
236
|
+
|
|
197
237
|
Returns an instance of `TableForm` class
|
|
198
238
|
|
|
199
239
|
#### f) getRows()
|
|
200
240
|
|
|
201
241
|
###### Description:
|
|
242
|
+
|
|
202
243
|
Gets all the rows of the table
|
|
203
244
|
|
|
204
245
|
###### Syntax:
|
|
246
|
+
|
|
205
247
|
```js
|
|
206
248
|
const rows = await kf.context.getTable(tableId).getRows();
|
|
207
249
|
```
|
|
208
250
|
|
|
209
251
|
###### Output:
|
|
252
|
+
|
|
210
253
|
Returns an array of `TableForm` instances
|
|
211
254
|
|
|
212
255
|
##### g) toJSON()
|
|
213
256
|
|
|
214
257
|
###### Description:
|
|
258
|
+
|
|
215
259
|
Use this function to get the JSON data of the child table
|
|
216
260
|
|
|
217
261
|
###### Syntax:
|
|
262
|
+
|
|
218
263
|
```js
|
|
219
264
|
const json = await kf.context.getTable(tableId).toJSON();
|
|
220
265
|
```
|
|
221
266
|
|
|
222
267
|
###### Output:
|
|
268
|
+
|
|
223
269
|
```
|
|
224
270
|
[{
|
|
225
271
|
"Untitled_Field": "row 1",
|
|
@@ -238,15 +284,17 @@ const json = await kf.context.getTable(tableId).toJSON();
|
|
|
238
284
|
|
|
239
285
|
### Table Row
|
|
240
286
|
|
|
241
|
-
A single row inside a table is known as Table row
|
|
242
|
-
`
|
|
287
|
+
A single row inside a table is known as Table row `kf.context` returns a
|
|
288
|
+
`TableForm` class which has the following methods
|
|
243
289
|
|
|
244
290
|
##### a) getField()
|
|
245
291
|
|
|
246
292
|
###### Description:
|
|
293
|
+
|
|
247
294
|
Use this function to get the value of the table row
|
|
248
295
|
|
|
249
296
|
###### Syntax:
|
|
297
|
+
|
|
250
298
|
```js
|
|
251
299
|
kf.context.getField(fieldId).then((res) => {...})
|
|
252
300
|
// or
|
|
@@ -256,9 +304,11 @@ let value = await kf.context.getField(fieldId)
|
|
|
256
304
|
##### b) updateField()
|
|
257
305
|
|
|
258
306
|
###### Description:
|
|
307
|
+
|
|
259
308
|
Use this function to get update any field in the table row
|
|
260
309
|
|
|
261
310
|
###### Syntax:
|
|
311
|
+
|
|
262
312
|
```js
|
|
263
313
|
kf.context.updateField({ fieldId_1: fieldValue, fieldId_2: fieldValue });
|
|
264
314
|
```
|
|
@@ -266,29 +316,35 @@ kf.context.updateField({ fieldId_1: fieldValue, fieldId_2: fieldValue });
|
|
|
266
316
|
##### c) getParent()
|
|
267
317
|
|
|
268
318
|
###### Description:
|
|
319
|
+
|
|
269
320
|
Use this function to perform form actions on the main form
|
|
270
321
|
|
|
271
322
|
###### Syntax:
|
|
323
|
+
|
|
272
324
|
```js
|
|
273
325
|
const mainForm = kf.context.getParent();
|
|
274
326
|
mainForm.updateField({ fieldId_1: fieldValue, fieldId_2: fieldValue });
|
|
275
327
|
```
|
|
276
328
|
|
|
277
329
|
###### Output:
|
|
330
|
+
|
|
278
331
|
Returns an instance of `Form` class using which we can perform any action on the
|
|
279
332
|
main form
|
|
280
333
|
|
|
281
334
|
##### d) toJson()
|
|
282
335
|
|
|
283
336
|
##### Description:
|
|
337
|
+
|
|
284
338
|
Get JSON output of table row
|
|
285
339
|
|
|
286
340
|
##### Syntax:
|
|
341
|
+
|
|
287
342
|
```js
|
|
288
343
|
const json = await kf.context.toJSON();
|
|
289
344
|
```
|
|
290
345
|
|
|
291
346
|
###### Output:
|
|
347
|
+
|
|
292
348
|
```
|
|
293
349
|
{
|
|
294
350
|
"Untitled_Field": "testing",
|
|
@@ -304,12 +360,15 @@ const json = await kf.context.toJSON();
|
|
|
304
360
|
### 2) Client
|
|
305
361
|
|
|
306
362
|
##### Show Toast
|
|
363
|
+
|
|
307
364
|
```js
|
|
308
365
|
kf.client.showInfo(message);
|
|
309
366
|
```
|
|
310
367
|
|
|
311
368
|
##### Show confirm
|
|
369
|
+
|
|
312
370
|
Displays the confirmation dialog, and returns users's action as a response
|
|
371
|
+
|
|
313
372
|
```js
|
|
314
373
|
kf.client.showConfirm({ title, content }).then((action) => {
|
|
315
374
|
if(action === "OK") // user clicked ok button
|
|
@@ -319,6 +378,7 @@ kf.client.showConfirm({ title, content }).then((action) => {
|
|
|
319
378
|
```
|
|
320
379
|
|
|
321
380
|
##### Redirect to URL
|
|
381
|
+
|
|
322
382
|
```js
|
|
323
383
|
kf.client.redirect(url);
|
|
324
384
|
```
|
|
@@ -328,11 +388,13 @@ kf.client.redirect(url);
|
|
|
328
388
|
`kf.app` represents the active kissflow app and `kf.app._id` returns its id.
|
|
329
389
|
|
|
330
390
|
##### Get value to application variable
|
|
391
|
+
|
|
331
392
|
```js
|
|
332
393
|
const appVarible1 = await kf.app.getVariable("variableId");
|
|
333
394
|
```
|
|
334
395
|
|
|
335
396
|
##### Set value of application variable
|
|
397
|
+
|
|
336
398
|
```js
|
|
337
399
|
let value = await kf.app.setVariable("variableId", value);
|
|
338
400
|
// or
|
|
@@ -343,7 +405,9 @@ await kf.app.setVariable({
|
|
|
343
405
|
```
|
|
344
406
|
|
|
345
407
|
##### Open a page
|
|
408
|
+
|
|
346
409
|
`openPage(id)` returns [Page](#4-page) class instance
|
|
410
|
+
|
|
347
411
|
```js
|
|
348
412
|
const pageInputParameters = {
|
|
349
413
|
param1: value,
|
|
@@ -353,96 +417,163 @@ kf.app.openPage(pageId, pageInputParameters);
|
|
|
353
417
|
// Note: Page Input parameters are optional.
|
|
354
418
|
```
|
|
355
419
|
|
|
420
|
+
##### Get a dataform instance
|
|
421
|
+
|
|
422
|
+
`getDataform(formId)` returns a Dataform class instance
|
|
423
|
+
|
|
424
|
+
```js
|
|
425
|
+
const dfInstance = kf.app.getDataform("dataform_id");
|
|
426
|
+
```
|
|
427
|
+
|
|
356
428
|
### 4) Page
|
|
357
|
-
|
|
429
|
+
|
|
430
|
+
`kf.app.page` returns the active page opened inside application and
|
|
431
|
+
`kf.app.page._id` returns its id.
|
|
358
432
|
|
|
359
433
|
##### Page parameters
|
|
434
|
+
|
|
360
435
|
```js
|
|
361
436
|
let value = await kf.app.page.getParameter("parameterId"); // for retreiving single parameter
|
|
362
437
|
```
|
|
438
|
+
|
|
363
439
|
Get all page parameters
|
|
364
|
-
|
|
365
|
-
|
|
440
|
+
|
|
441
|
+
```js
|
|
442
|
+
let allParams = await kf.app.page.getAllParameters();
|
|
366
443
|
// returns an object
|
|
367
|
-
{
|
|
444
|
+
{
|
|
368
445
|
parameterName: "Sample value",
|
|
369
446
|
parameterName2: "Sample value 2"
|
|
370
447
|
}
|
|
371
448
|
```
|
|
372
449
|
|
|
373
450
|
##### Access a Component
|
|
451
|
+
|
|
374
452
|
`getComponent` returns a [Component](#5-component) class.
|
|
453
|
+
|
|
375
454
|
```js
|
|
376
455
|
const componentName = await kf.app.page.getComponent("componentId");
|
|
377
456
|
```
|
|
378
457
|
|
|
379
458
|
##### Open a popup
|
|
459
|
+
|
|
380
460
|
`openPoup` returns a [Popup](#6-popup) class.
|
|
461
|
+
|
|
381
462
|
```js
|
|
382
463
|
kf.app.page.openPopup("popupId", { inputParam1: "value" });
|
|
383
464
|
// Note: Popup parameters are optional.
|
|
384
465
|
```
|
|
385
466
|
|
|
386
467
|
### 5) Component
|
|
468
|
+
|
|
387
469
|
#### getComponent(id)
|
|
388
|
-
|
|
389
|
-
Returns: Component class instance
|
|
470
|
+
|
|
471
|
+
Parameter: Component's Id Returns: Component class instance
|
|
472
|
+
|
|
390
473
|
```js
|
|
391
474
|
const component = await kf.app.page.getComponent(componentId);
|
|
392
475
|
```
|
|
476
|
+
|
|
393
477
|
##### Standard Component Methods
|
|
478
|
+
|
|
394
479
|
```js
|
|
395
480
|
component.refresh(); // Refreshes the component
|
|
396
481
|
component.hide(); // Hides the component
|
|
397
482
|
component.show(); // Shows the component if it's been hidden previously
|
|
398
483
|
```
|
|
399
|
-
##### Component Specific Methods
|
|
400
484
|
|
|
485
|
+
##### Component Specific Methods
|
|
401
486
|
|
|
402
487
|
##### 5.2.0) Component onMount
|
|
488
|
+
|
|
403
489
|
Component onMount takes in callBack function as argument.
|
|
490
|
+
|
|
404
491
|
> ##### Note: Any component specific methods that are used on Page load must be called inside component's onMount event.
|
|
405
|
-
|
|
492
|
+
>
|
|
493
|
+
> Parameter: function
|
|
494
|
+
|
|
406
495
|
```js
|
|
407
496
|
component.onMount(() => {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
})
|
|
497
|
+
// function logic goes here... For eg.
|
|
498
|
+
// component.setActiveTab(2)
|
|
499
|
+
});
|
|
411
500
|
```
|
|
501
|
+
|
|
412
502
|
##### 5.2.1) Tab component
|
|
503
|
+
|
|
413
504
|
##### 1) setActiveTab
|
|
414
|
-
|
|
415
|
-
Parameter: Tabs' Number (Starts from 1 to N)
|
|
505
|
+
|
|
506
|
+
Sets specified tab as active. Parameter: Tabs' Number (Starts from 1 to N)
|
|
507
|
+
|
|
416
508
|
```js
|
|
417
|
-
component.setActiveTab(2) // sets 2nd tab as active one
|
|
509
|
+
component.setActiveTab(2); // sets 2nd tab as active one
|
|
418
510
|
```
|
|
419
511
|
|
|
420
|
-
|
|
421
512
|
### 6) Popup
|
|
422
|
-
|
|
423
|
-
|
|
513
|
+
|
|
514
|
+
`kf.app.page.popup` returns the active popup instance opened inside the page and
|
|
515
|
+
its id can be accessed via `kf.app.page.popup._id` And
|
|
516
|
+
`kf.app.page.getPopup(id)` returns this popup class instance.
|
|
424
517
|
|
|
425
518
|
##### Popup parameters
|
|
519
|
+
|
|
426
520
|
```js
|
|
427
521
|
let value = await kf.app.page.popup.getParameter("parameterId"); // for retreiving single popup parameter
|
|
428
522
|
```
|
|
523
|
+
|
|
429
524
|
Get all popup parameters
|
|
430
|
-
|
|
431
|
-
|
|
525
|
+
|
|
526
|
+
```js
|
|
527
|
+
let allParams = await kf.app.page.popup.getAllParameters();
|
|
432
528
|
// Returns an object
|
|
433
|
-
{
|
|
529
|
+
{
|
|
434
530
|
parameterName: "Sample value",
|
|
435
531
|
parameterName2: "Sample value 2"
|
|
436
532
|
}
|
|
437
533
|
```
|
|
438
534
|
|
|
439
535
|
##### Close popup
|
|
536
|
+
|
|
440
537
|
```js
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
538
|
+
kf.app.page.popup.close(); // for active popup
|
|
539
|
+
// or if you already have a popup instance...
|
|
540
|
+
greetPopup.close();
|
|
444
541
|
```
|
|
445
542
|
|
|
543
|
+
### 8) Dataform
|
|
544
|
+
|
|
545
|
+
> Note: Get dataform instance from `kf.app.getDatform`
|
|
546
|
+
|
|
547
|
+
##### Import CSV
|
|
548
|
+
|
|
549
|
+
Opens up the import CSV modal where user could upload CSV file and map
|
|
550
|
+
respective columns to the field.
|
|
551
|
+
|
|
552
|
+
```js
|
|
553
|
+
let defaultValues = { fieldId: "value" };
|
|
554
|
+
dataformInstance.importCSV(defaultValues);
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
###### Example scenario
|
|
558
|
+
|
|
559
|
+
Consider scenario where few fields that aren't exposed to user(basically hidden
|
|
560
|
+
in form visibilty). In such cases Default values can be used to provide data to
|
|
561
|
+
hidden fields
|
|
562
|
+
|
|
563
|
+
```js
|
|
564
|
+
// Here the location field is hidden to user,
|
|
565
|
+
// thus user isn't aware to include this on import csv.
|
|
566
|
+
let defaultValues = { location: "India" };
|
|
567
|
+
dataformInstance.importCSV(defaultValues);
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
> Note:
|
|
571
|
+
> 1. Default values here is optional
|
|
572
|
+
> 2. Any variables or parameter can also be mapped in `defaultValues`.
|
|
573
|
+
> 3. End user can't pass this value if default value is set by dev.
|
|
574
|
+
> 4. Some fields cannot be set as default eg. Auto calculated fields, Sequence numbers etc.
|
|
575
|
+
|
|
576
|
+
|
|
446
577
|
### 7) Formatter
|
|
447
578
|
|
|
448
579
|
##### Format to KF Date
|
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ declare module "core/constants" {
|
|
|
47
47
|
WINDOW_NDEF_READER_MAKE_READONLY: string;
|
|
48
48
|
WINDOW_NDEF_READER_ABORT_SCAN: string;
|
|
49
49
|
DECISION_TABLE_EXECUTE: string;
|
|
50
|
+
DATAFORM_IMPORT_CSV: string;
|
|
50
51
|
};
|
|
51
52
|
export const EVENT_TYPES: {
|
|
52
53
|
COMPONENT_ON_MOUNT: string;
|
|
@@ -183,11 +184,20 @@ declare module "app/decisiontable" {
|
|
|
183
184
|
evaluate(payload?: object): any;
|
|
184
185
|
}
|
|
185
186
|
}
|
|
187
|
+
declare module "app/dataform" {
|
|
188
|
+
import { BaseSDK } from "core/index";
|
|
189
|
+
export class Dataform extends BaseSDK {
|
|
190
|
+
private _id;
|
|
191
|
+
constructor(flowId: string);
|
|
192
|
+
importCSV(defaultValues: object): any;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
186
195
|
declare module "app/index" {
|
|
187
196
|
import { BaseSDK } from "core/index";
|
|
188
197
|
import { Page } from "app/page";
|
|
189
198
|
import { AppContext } from "types/internal";
|
|
190
199
|
import { DecisionTable } from "app/decisiontable";
|
|
200
|
+
import { Dataform } from "app/dataform";
|
|
191
201
|
export class Application extends BaseSDK {
|
|
192
202
|
page: Page;
|
|
193
203
|
_id: string;
|
|
@@ -196,6 +206,7 @@ declare module "app/index" {
|
|
|
196
206
|
setVariable(key: string | object, value?: any): any;
|
|
197
207
|
openPage(pageId: string, pageParams: object): any;
|
|
198
208
|
getDecisionTable(flowId: string): DecisionTable;
|
|
209
|
+
getDataform(flowId: string): Dataform;
|
|
199
210
|
}
|
|
200
211
|
export * from "app/component";
|
|
201
212
|
export { Page };
|
|
@@ -81,7 +81,8 @@ const LISTENER_CMDS = {
|
|
|
81
81
|
WINDOW_NDEF_READER_ADD_EVENT_LISTENER: "WINDOW_NDEF_READER_ADD_EVENT_LISTENER",
|
|
82
82
|
WINDOW_NDEF_READER_MAKE_READONLY: "WINDOW_NDEF_READER_MAKE_READONLY",
|
|
83
83
|
WINDOW_NDEF_READER_ABORT_SCAN: "WINDOW_NDEF_READER_ABORT_SCAN",
|
|
84
|
-
DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE"
|
|
84
|
+
DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE",
|
|
85
|
+
DATAFORM_IMPORT_CSV: "DATAFORM_IMPORT_CSV"
|
|
85
86
|
};
|
|
86
87
|
const EVENT_TYPES = {
|
|
87
88
|
COMPONENT_ON_MOUNT: "componentOnMount",
|
|
@@ -497,6 +498,18 @@ class DecisionTable extends BaseSDK {
|
|
|
497
498
|
});
|
|
498
499
|
}
|
|
499
500
|
}
|
|
501
|
+
class Dataform extends BaseSDK {
|
|
502
|
+
constructor(flowId) {
|
|
503
|
+
super();
|
|
504
|
+
this._id = flowId;
|
|
505
|
+
}
|
|
506
|
+
importCSV(defaultValues) {
|
|
507
|
+
return this._postMessageAsync(LISTENER_CMDS.DATAFORM_IMPORT_CSV, {
|
|
508
|
+
flowId: this._id,
|
|
509
|
+
defaultValues
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
}
|
|
500
513
|
class Application extends BaseSDK {
|
|
501
514
|
constructor(props) {
|
|
502
515
|
super();
|
|
@@ -523,6 +536,9 @@ class Application extends BaseSDK {
|
|
|
523
536
|
getDecisionTable(flowId) {
|
|
524
537
|
return new DecisionTable(flowId);
|
|
525
538
|
}
|
|
539
|
+
getDataform(flowId) {
|
|
540
|
+
return new Dataform(flowId);
|
|
541
|
+
}
|
|
526
542
|
}
|
|
527
543
|
class NDEFReader extends BaseSDK {
|
|
528
544
|
constructor() {
|
|
@@ -77,7 +77,8 @@ const LISTENER_CMDS = {
|
|
|
77
77
|
WINDOW_NDEF_READER_ADD_EVENT_LISTENER: "WINDOW_NDEF_READER_ADD_EVENT_LISTENER",
|
|
78
78
|
WINDOW_NDEF_READER_MAKE_READONLY: "WINDOW_NDEF_READER_MAKE_READONLY",
|
|
79
79
|
WINDOW_NDEF_READER_ABORT_SCAN: "WINDOW_NDEF_READER_ABORT_SCAN",
|
|
80
|
-
DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE"
|
|
80
|
+
DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE",
|
|
81
|
+
DATAFORM_IMPORT_CSV: "DATAFORM_IMPORT_CSV"
|
|
81
82
|
};
|
|
82
83
|
function generateId(prefix = "lcncsdk") {
|
|
83
84
|
return `${prefix}-${nanoid()}`;
|
package/dist/kfsdk.es.js
CHANGED
|
@@ -81,7 +81,8 @@ const LISTENER_CMDS = {
|
|
|
81
81
|
WINDOW_NDEF_READER_ADD_EVENT_LISTENER: "WINDOW_NDEF_READER_ADD_EVENT_LISTENER",
|
|
82
82
|
WINDOW_NDEF_READER_MAKE_READONLY: "WINDOW_NDEF_READER_MAKE_READONLY",
|
|
83
83
|
WINDOW_NDEF_READER_ABORT_SCAN: "WINDOW_NDEF_READER_ABORT_SCAN",
|
|
84
|
-
DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE"
|
|
84
|
+
DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE",
|
|
85
|
+
DATAFORM_IMPORT_CSV: "DATAFORM_IMPORT_CSV"
|
|
85
86
|
};
|
|
86
87
|
const EVENT_TYPES = {
|
|
87
88
|
COMPONENT_ON_MOUNT: "componentOnMount",
|
|
@@ -361,6 +362,18 @@ class DecisionTable extends BaseSDK {
|
|
|
361
362
|
});
|
|
362
363
|
}
|
|
363
364
|
}
|
|
365
|
+
class Dataform extends BaseSDK {
|
|
366
|
+
constructor(flowId) {
|
|
367
|
+
super();
|
|
368
|
+
this._id = flowId;
|
|
369
|
+
}
|
|
370
|
+
importCSV(defaultValues) {
|
|
371
|
+
return this._postMessageAsync(LISTENER_CMDS.DATAFORM_IMPORT_CSV, {
|
|
372
|
+
flowId: this._id,
|
|
373
|
+
defaultValues
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
}
|
|
364
377
|
class Application extends BaseSDK {
|
|
365
378
|
constructor(props) {
|
|
366
379
|
super();
|
|
@@ -387,6 +400,9 @@ class Application extends BaseSDK {
|
|
|
387
400
|
getDecisionTable(flowId) {
|
|
388
401
|
return new DecisionTable(flowId);
|
|
389
402
|
}
|
|
403
|
+
getDataform(flowId) {
|
|
404
|
+
return new Dataform(flowId);
|
|
405
|
+
}
|
|
390
406
|
}
|
|
391
407
|
class Client extends BaseSDK {
|
|
392
408
|
showInfo(message) {
|
package/dist/kfsdk.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=(E,t,A)=>{if(!t.has(E))throw TypeError("Cannot "+A)};var o=(E,t,A)=>(h(E,t,"read from private field"),A?A.call(E):t.get(E)),p=(E,t,A)=>{if(t.has(E))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(E):t.set(E,A)},l=(E,t,A,
|
|
1
|
+
var h=(E,t,A)=>{if(!t.has(E))throw TypeError("Cannot "+A)};var o=(E,t,A)=>(h(E,t,"read from private field"),A?A.call(E):t.get(E)),p=(E,t,A)=>{if(t.has(E))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(E):t.set(E,A)},l=(E,t,A,N)=>(h(E,t,"write to private field"),N?N.call(E,A):t.set(E,A),A);var g=(E,t,A)=>(h(E,t,"access private method"),A);(function(E,t){typeof exports=="object"&&typeof module!="undefined"?module.exports=t():typeof define=="function"&&define.amd?define(t):(E=typeof globalThis!="undefined"?globalThis:E||self,E.kf=t())})(this,function(){var i,M,L;"use strict";let E=(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,s)=>(s&=63,s<36?e+=s.toString(36):s<62?e+=(s-26).toString(36).toUpperCase():s>62?e+="-":e+="_",e),"");const t={API:"API",GET_CONTEXT:"GET_CONTEXT",RETURN:"RETURN",GET_FORM_FIELD:"GET_FORM_FIELD",UPDATE_FORM:"UPDATE_FORM",GET_TABLE:"GET_TABLE",GET_TABLE_ROW:"GET_TABLE_ROW",ADD_TABLE_ROW:"ADD_TABLE_ROW",ADD_TABLE_ROWS:"ADD_TABLE_ROWS",DELETE_TABLE_ROW:"DELETE_TABLE_ROW",TO_JSON:"TO_JSON",GET_TABLE_ROWS:"GET_TABLE_ROWS",MESSAGE:"MESSAGE",CONFIRM:"CONFIRM",ALERT:"ALERT",REDIRECT:"REDIRECT",OPEN_PAGE:"OPEN_PAGE",FORMAT_DATE:"FORMAT_DATE",FORMAT_DATE_TIME:"FORMAT_DATE_TIME",FORMAT_NUMBER:"FORMAT_NUMBER",FORMAT_CURRENCY:"FORMAT_CURRENCY",FORMAT_BOOLEAN:"FORMAT_BOOLEAN",GET_APP_VARIABLE:"GET_APP_VARIABLE",SET_APP_VARIABLE:"SET_APP_VARIABLE",GET_PAGE_VARIABLE:"GET_PAGE_VARIABLE",SET_PAGE_VARIABLE:"SET_PAGE_VARIABLE",GET_PAGE_PARAMS:"GET_PAGE_PARAMS",GET_ALL_PAGE_PARAMS:"GET_ALL_PAGE_PARAMS",PAGE_ON_CLOSE:"PAGE_ON_CLOSE",OPEN_POPUP:"OPEN_POPUP",GET_POPUP_PARAMS:"GET_POPUP_PARAMS",GET_ALL_POPUP_PARAMS:"GET_ALL_POPUP_PARAMS",CLOSE_POPUP:"CLOSE_POPUP",COMPONENT_GET:"COMPONENT_GET",COMPONENT_REFRESH:"COMPONENT_REFRESH",COMPONENT_SHOW:"COMPONENT_SHOW",COMPONENT_HIDE:"COMPONENT_HIDE",COMPONENT_ADD_EVENT_LISTENER:"COMPONENT_ADD_EVENT_LISTENER",CC_INITIALIZE:"CC_INITIALIZE",CC_WATCH_PARAMS:"CC_WATCH_PARAMS",WINDOW_NDEF_READER_NEW:"WINDOW_NDEF_READER_NEW",WINDOW_NDEF_READER_SCAN:"WINDOW_NDEF_READER_SCAN",WINDOW_NDEF_READER_WRITE:"WINDOW_NDEF_READER_WRITE",WINDOW_NDEF_READER_ADD_EVENT_LISTENER:"WINDOW_NDEF_READER_ADD_EVENT_LISTENER",WINDOW_NDEF_READER_MAKE_READONLY:"WINDOW_NDEF_READER_MAKE_READONLY",WINDOW_NDEF_READER_ABORT_SCAN:"WINDOW_NDEF_READER_ABORT_SCAN",DECISION_TABLE_EXECUTE:"DECISION_TABLE_EXECUTE",DATAFORM_IMPORT_CSV:"DATAFORM_IMPORT_CSV"},A={COMPONENT_ON_MOUNT:"componentOnMount",CC_ON_PARAMS_CHANGE:"onCustomComponentParamsChange"},N={POPUP_ID:"ACTIVE_POP_UP"};function u(n="lcncsdk"){return`${n}-${E()}`}const P={};function C(n){globalThis.parent&&globalThis.parent!==globalThis?globalThis.parent.postMessage(n,"*"):globalThis.postMessage(n)}function d(n){if(n.origin!==globalThis.location.origin){const e=n.data;if(e!=null&&e.isEvent){const{target:r,eventParams:a,eventName:c,eventConfig:R={}}=e;let O=P[r];O._dispatchEvent(c,a),R.once&&O._removeEventListener(c);return}let{_req:s,resp:_}=e;s!=null&&s._id&&P[s._id]._dispatchMessageEvents(s,_)}}globalThis.addEventListener("message",d);class S{constructor(){p(this,i,void 0);l(this,i,{})}_addEventListener(e,s){var _;o(this,i)[e]=((_=o(this,i))==null?void 0:_[e])||[],o(this,i)[e].push(s)}_removeEventListener(e,s){if(s){let _=o(this,i)[e].findIndex(s);_>-1&&o(this,i)[e].splice(_,1);return}Reflect.deleteProperty(o(this,i),e)}_dispatchEvent(e,s){return Array.isArray(o(this,i)[e])?(o(this,i)[e].forEach(_=>_(s)),!0):!1}_dispatchMessageEvents(e,s){let _=e._id;Array.isArray(o(this,i)[_])&&(o(this,i)[_].forEach(r=>{try{s&&Object.keys(s).length===1&&e.command!==t.API?r(Object.values(s)[0]):r(s)}catch(a){console.error("Message callback error: ",a)}}),this._removeEventListener(_))}}i=new WeakMap;class T extends S{_postMessageAsync(e,s,_,r){return new Promise((a,c)=>{const R=u(e.toLowerCase());C({_id:R,command:e,...s}),P[R]=this,this._addEventListener(R,async O=>{O!=null&&O.errorMessage?c(O):(_&&r&&(O=await r(O)),a(O))})})}_postMessage(e,s,_){const r=u(e.toLowerCase());C({_id:r,command:e,...s}),_&&this._addEventListener(s.eventName,_)}}class D extends T{constructor(s){super();p(this,M);this._id=s.componentId,this.type="Component",P[this._id]=this,g(this,M,L).call(this,s.componentMethods)}onMount(s){this._postMessage(t.COMPONENT_ADD_EVENT_LISTENER,{id:this._id,eventName:A.COMPONENT_ON_MOUNT,eventConfig:{once:!0}},s)}refresh(){return this._postMessageAsync(t.COMPONENT_REFRESH,{id:this._id})}show(){return this._postMessageAsync(t.COMPONENT_SHOW,{id:this._id})}hide(){return this._postMessageAsync(t.COMPONENT_HIDE,{id:this._id})}}M=new WeakSet,L=function(s){s==null||s.forEach(_=>{this[_.name]=(...r)=>{if(_.type==="method")return this._postMessageAsync(`COMPONENT_${_.name}`,{id:this._id,parameters:r});_.type==="event"&&this._postMessage(t.COMPONENT_ADD_EVENT_LISTENER,{id:this._id,eventName:_.name,eventConfig:r[1]},r[0])}})};class G extends T{constructor(e){super(),this._id=e,this.type="CustomComponent",P[this._id]=this}watchParams(e){this._postMessage(t.CC_WATCH_PARAMS,{id:this._id,eventName:A.CC_ON_PARAMS_CHANGE,eventConfig:{once:!1}},e)}}class f extends T{constructor(e){super(),this.type="Popup",this._id=e.popupId||N.POPUP_ID}getParameter(e){return this._postMessageAsync(t.GET_POPUP_PARAMS,{key:e,popupId:this._id})}getAllParameters(){return this._postMessageAsync(t.GET_ALL_POPUP_PARAMS,{popupId:this._id})}close(){return this._postMessageAsync(t.CLOSE_POPUP,{})}getComponent(e){return this._postMessageAsync(t.COMPONENT_GET,{componentId:e},!0,s=>new D(s))}}class I extends T{constructor(e){super(),this.type="Page",this.popup=new f({}),this._id=e.pageId}getParameter(e){return this._postMessageAsync(t.GET_PAGE_PARAMS,{key:e})}getAllParameters(){return this._postMessageAsync(t.GET_ALL_PAGE_PARAMS,{pageId:this._id})}getVariable(e){return this._postMessageAsync(t.GET_PAGE_VARIABLE,{key:e})}setVariable(e,s){return this._postMessageAsync(t.SET_PAGE_VARIABLE,{key:e,value:s})}openPopup(e,s){return this._postMessageAsync(t.OPEN_POPUP,{popupId:e,popupParams:s})}getComponent(e){return this._postMessageAsync(t.COMPONENT_GET,{componentId:e},!0,s=>new D(s))}}class y extends T{constructor(e){super(),this.flowId=e}evaluate(e){return this._postMessageAsync(t.DECISION_TABLE_EXECUTE,{flowId:this.flowId,payload:e})}}class F extends T{constructor(e){super(),this._id=e}importCSV(e){return this._postMessageAsync(t.DATAFORM_IMPORT_CSV,{flowId:this._id,defaultValues:e})}}class W extends T{constructor(e){super(),this._id=e.appId,this.page=new I(e)}getVariable(e){return this._postMessageAsync(t.GET_APP_VARIABLE,{key:e})}setVariable(e,s){return this._postMessageAsync(t.SET_APP_VARIABLE,{key:e,value:s})}openPage(e,s){return this._postMessageAsync(t.OPEN_PAGE,{pageId:e,pageParams:s})}getDecisionTable(e){return new y(e)}getDataform(e){return new F(e)}}class m extends T{showInfo(e){return super._postMessageAsync(t.MESSAGE,{message:e})}showConfirm(e){return super._postMessageAsync(t.CONFIRM,{data:{title:e.title,content:e.content,okText:e.okText||"Ok",cancelText:e.cancelText||"Cancel"}})}redirect(e){return super._postMessageAsync(t.REDIRECT,{url:e})}}class B extends T{toDate(e){return this._postMessageAsync(t.FORMAT_DATE,{date:e})}toDateTime(e){return this._postMessageAsync(t.FORMAT_DATE_TIME,{date:e})}toNumber(e){return this._postMessageAsync(t.FORMAT_NUMBER,{value:e})}toCurrency(e,s){return this._postMessageAsync(t.FORMAT_CURRENCY,{value:e,currencyCode:s})}toBoolean(e){return this._postMessageAsync(t.FORMAT_BOOLEAN,{value:e})}}class U extends T{constructor(){super()}api(e,s={}){return this._postMessageAsync(t.API,{url:e,args:s})}initialize(){return this._postMessageAsync(t.CC_INITIALIZE,{},!0,e=>(this.app=new W(e),this.page=new I(e),this.context=new G(e.componentId),this.client=new m,this.formatter=new B,this.user=e.user,this.account=e.account,this.env=e.envDetails,this))}initialise(){return this.initialize()}}var V=new U;return V});
|
package/dist/lowcode.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ declare module "core/constants" {
|
|
|
47
47
|
WINDOW_NDEF_READER_MAKE_READONLY: string;
|
|
48
48
|
WINDOW_NDEF_READER_ABORT_SCAN: string;
|
|
49
49
|
DECISION_TABLE_EXECUTE: string;
|
|
50
|
+
DATAFORM_IMPORT_CSV: string;
|
|
50
51
|
};
|
|
51
52
|
export const EVENT_TYPES: {
|
|
52
53
|
COMPONENT_ON_MOUNT: string;
|
|
@@ -245,11 +246,20 @@ declare module "app/decisiontable" {
|
|
|
245
246
|
evaluate(payload?: object): any;
|
|
246
247
|
}
|
|
247
248
|
}
|
|
249
|
+
declare module "app/dataform" {
|
|
250
|
+
import { BaseSDK } from "core/index";
|
|
251
|
+
export class Dataform extends BaseSDK {
|
|
252
|
+
private _id;
|
|
253
|
+
constructor(flowId: string);
|
|
254
|
+
importCSV(defaultValues: object): any;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
248
257
|
declare module "app/index" {
|
|
249
258
|
import { BaseSDK } from "core/index";
|
|
250
259
|
import { Page } from "app/page";
|
|
251
260
|
import { AppContext } from "types/internal";
|
|
252
261
|
import { DecisionTable } from "app/decisiontable";
|
|
262
|
+
import { Dataform } from "app/dataform";
|
|
253
263
|
export class Application extends BaseSDK {
|
|
254
264
|
page: Page;
|
|
255
265
|
_id: string;
|
|
@@ -258,6 +268,7 @@ declare module "app/index" {
|
|
|
258
268
|
setVariable(key: string | object, value?: any): any;
|
|
259
269
|
openPage(pageId: string, pageParams: object): any;
|
|
260
270
|
getDecisionTable(flowId: string): DecisionTable;
|
|
271
|
+
getDataform(flowId: string): Dataform;
|
|
261
272
|
}
|
|
262
273
|
export * from "app/component";
|
|
263
274
|
export { Page };
|
package/dist/lowcode.types.d.ts
CHANGED
|
@@ -69,6 +69,9 @@ declare class Page {
|
|
|
69
69
|
declare class DecisionTable {
|
|
70
70
|
evaluate(payload?: object): any;
|
|
71
71
|
}
|
|
72
|
+
declare class Dataform {
|
|
73
|
+
importCSV(defaultValues: object): any;
|
|
74
|
+
}
|
|
72
75
|
declare class Application {
|
|
73
76
|
page: Page
|
|
74
77
|
_id: string
|
|
@@ -76,6 +79,7 @@ declare class Application {
|
|
|
76
79
|
setVariable(key: string | object, value?: any): any;
|
|
77
80
|
openPage(pageId: string, pageParams: object): any;
|
|
78
81
|
getDecisionTable(flowId: string): DecisionTable;
|
|
82
|
+
getDataform(flowId: string): Dataform;
|
|
79
83
|
}
|
|
80
84
|
declare class kf {
|
|
81
85
|
static context: Component
|
package/dist/nocode.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ declare module "core/constants" {
|
|
|
47
47
|
WINDOW_NDEF_READER_MAKE_READONLY: string;
|
|
48
48
|
WINDOW_NDEF_READER_ABORT_SCAN: string;
|
|
49
49
|
DECISION_TABLE_EXECUTE: string;
|
|
50
|
+
DATAFORM_IMPORT_CSV: string;
|
|
50
51
|
};
|
|
51
52
|
export const EVENT_TYPES: {
|
|
52
53
|
COMPONENT_ON_MOUNT: string;
|
|
@@ -245,6 +246,14 @@ declare module "app/component" {
|
|
|
245
246
|
watchParams(callBack: (data: any) => any): void;
|
|
246
247
|
}
|
|
247
248
|
}
|
|
249
|
+
declare module "app/dataform" {
|
|
250
|
+
import { BaseSDK } from "core/index";
|
|
251
|
+
export class Dataform extends BaseSDK {
|
|
252
|
+
private _id;
|
|
253
|
+
constructor(flowId: string);
|
|
254
|
+
importCSV(defaultValues: object): any;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
248
257
|
declare module "app/decisiontable" {
|
|
249
258
|
import { BaseSDK } from "core/index";
|
|
250
259
|
export class DecisionTable extends BaseSDK {
|
|
@@ -290,6 +299,7 @@ declare module "app/index" {
|
|
|
290
299
|
import { Page } from "app/page";
|
|
291
300
|
import { AppContext } from "types/internal";
|
|
292
301
|
import { DecisionTable } from "app/decisiontable";
|
|
302
|
+
import { Dataform } from "app/dataform";
|
|
293
303
|
export class Application extends BaseSDK {
|
|
294
304
|
page: Page;
|
|
295
305
|
_id: string;
|
|
@@ -298,6 +308,7 @@ declare module "app/index" {
|
|
|
298
308
|
setVariable(key: string | object, value?: any): any;
|
|
299
309
|
openPage(pageId: string, pageParams: object): any;
|
|
300
310
|
getDecisionTable(flowId: string): DecisionTable;
|
|
311
|
+
getDataform(flowId: string): Dataform;
|
|
301
312
|
}
|
|
302
313
|
export * from "app/component";
|
|
303
314
|
export { Page };
|
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.22",
|
|
4
4
|
"description": "JavaScript SDK for developing over the Kissflow lowcode platform",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"start": "vite serve",
|
|
41
41
|
"customBuild": "node custom.build.mjs",
|
|
42
42
|
"build": "pnpm run customBuild",
|
|
43
|
-
"serve": "http-server -p 8080"
|
|
43
|
+
"serve": "http-server -p 8080",
|
|
44
|
+
"publish-canary": "pnpm publish --tag canary"
|
|
44
45
|
}
|
|
45
46
|
}
|