@kissflow/lowcode-client-sdk 1.0.22 → 1.0.24-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 +1 -623
- package/dist/index.d.ts +51 -28
- package/dist/kf.lowcodeworkersdk.es.js +138 -6
- package/dist/kf.nocodeworkersdk.es.js +72 -6
- package/dist/kfsdk.es.js +184 -47
- package/dist/kfsdk.umd.js +1 -1
- package/dist/lowcode.d.ts +24 -1
- package/dist/lowcode.types.d.ts +3 -1
- package/dist/nocode.d.ts +24 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,626 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
JavaScript SDK for developing over the Kissflow lowcode platform
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Install the SDK as a module: `npm i @kissflow/lowcode-client-sdk` Then import
|
|
8
|
-
into your project:
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
import KFSDK from "@kissflow/lowcode-client-sdk";
|
|
12
|
-
let kf;
|
|
13
|
-
(async function () {
|
|
14
|
-
kf = await KFSDK.initialize();
|
|
15
|
-
})();
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
> Note: Initializing Kf SDK in custom components returns a promise.
|
|
19
|
-
|
|
20
|
-
### Use as a `<script>` tag directly in HTML
|
|
21
|
-
|
|
22
|
-
SDK can also be loaded directly into HTML by adding:
|
|
23
|
-
|
|
24
|
-
```html
|
|
25
|
-
<script src="https://unpkg.com/@kissflow/lowcode-client-sdk@latest/dist/kfsdk.umd.js"></script>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Then SDK can be initialized as:
|
|
29
|
-
|
|
30
|
-
```js
|
|
31
|
-
let kf;
|
|
32
|
-
window.onload = async function () {
|
|
33
|
-
kf = await window.kf.initialize();
|
|
34
|
-
};
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### User and Account details
|
|
38
|
-
|
|
39
|
-
Details of authenticated user can be accessed as following
|
|
40
|
-
|
|
41
|
-
```js
|
|
42
|
-
const { Name, Email, _id } = kf.user;
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
And account id can be accessed as `kf.account._id`
|
|
46
|
-
|
|
47
|
-
### Fetch Api through sdk
|
|
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
|
-
|
|
52
|
-
> Note: This method has a limit of 10 seconds for an api call
|
|
53
|
-
|
|
54
|
-
```js
|
|
55
|
-
kf.api(url, config).then((res) => {...})
|
|
56
|
-
// or
|
|
57
|
-
let resp = await kf.api(url, config)
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Table of contents
|
|
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)
|
|
76
|
-
|
|
77
|
-
## 1) Context
|
|
78
|
-
|
|
79
|
-
Context methods are polymorphic, it has different classes pre-initialized based
|
|
80
|
-
on execution context.
|
|
81
|
-
|
|
82
|
-
### Custom component
|
|
83
|
-
|
|
84
|
-
`kf.context` returns a `CustomComponent` class while using inside custom
|
|
85
|
-
component. Custom component supported methods:
|
|
86
|
-
|
|
87
|
-
##### a) Watch Params
|
|
88
|
-
|
|
89
|
-
Listens for changes in parameter given to custom components in lowcode
|
|
90
|
-
application.
|
|
91
|
-
|
|
92
|
-
```js
|
|
93
|
-
kf.context.watchParams(function (data) {
|
|
94
|
-
console.log(data);
|
|
95
|
-
});
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Kissflow Forms
|
|
99
|
-
|
|
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
|
|
103
|
-
|
|
104
|
-
##### a) getField()
|
|
105
|
-
|
|
106
|
-
###### Description:
|
|
107
|
-
|
|
108
|
-
Use this function to get the current value of a form field
|
|
109
|
-
|
|
110
|
-
###### Syntax:
|
|
111
|
-
|
|
112
|
-
```js
|
|
113
|
-
kf.context.getField(fieldId).then((res) => {...})
|
|
114
|
-
// or
|
|
115
|
-
let value = await kf.context.getField(fieldId)
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
##### b) updateField()
|
|
119
|
-
|
|
120
|
-
###### Description:
|
|
121
|
-
|
|
122
|
-
Use this function to get update any field in the form
|
|
123
|
-
|
|
124
|
-
###### Syntax:
|
|
125
|
-
|
|
126
|
-
```js
|
|
127
|
-
kf.context.updateField({ fieldId_1: fieldValue, fieldId_2: fieldValue });
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
##### c) toJSON()
|
|
131
|
-
|
|
132
|
-
###### Description:
|
|
133
|
-
|
|
134
|
-
Use this function to get the JSON data of the current form
|
|
135
|
-
|
|
136
|
-
###### Syntax:
|
|
137
|
-
|
|
138
|
-
```js
|
|
139
|
-
const json = await kf.context.toJSON();
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
###### Output:
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
{
|
|
146
|
-
"Untitled_Field": "testing",
|
|
147
|
-
"_created_at": "2022-03-01T03:04:09Z",
|
|
148
|
-
"_flow_name": "form events",
|
|
149
|
-
"_id": "Pk4_T1WGWuMe",
|
|
150
|
-
"_modified_at": "2022-03-01T03:04:09Z"
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Form Table
|
|
155
|
-
|
|
156
|
-
`kf.context.getTable(tableId)` returns a `Table` class which has the following
|
|
157
|
-
methods
|
|
158
|
-
|
|
159
|
-
#### a) addRow()
|
|
160
|
-
|
|
161
|
-
###### Description:
|
|
162
|
-
|
|
163
|
-
Appends row details to the table.
|
|
164
|
-
|
|
165
|
-
###### Syntax:
|
|
166
|
-
|
|
167
|
-
```js
|
|
168
|
-
const table = kf.context.getTable(tableId);
|
|
169
|
-
table.addRow({ columnId1: value, columnId2: value });
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
> ##### Note: If there are more than one rows to be added to table then use `addRows()` instead for these bulk operations
|
|
173
|
-
|
|
174
|
-
#### b) addRows()
|
|
175
|
-
|
|
176
|
-
###### Description:
|
|
177
|
-
|
|
178
|
-
Appends multiple rows details to the table.
|
|
179
|
-
|
|
180
|
-
###### Syntax:
|
|
181
|
-
|
|
182
|
-
```js
|
|
183
|
-
const table = kf.context.getTable(tableId);
|
|
184
|
-
let accumulator = [];
|
|
185
|
-
someArrayOfObjects.forEach(function (rowDetail) {
|
|
186
|
-
accumulator.push({
|
|
187
|
-
columnId1: rowDetail[columnId1],
|
|
188
|
-
columnId2: rowDetail[columnId2]
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
await table.addRows(accumulator);
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
#### c) deleteRow()
|
|
195
|
-
|
|
196
|
-
###### Description:
|
|
197
|
-
|
|
198
|
-
Deletes a row from the table based on the row id
|
|
199
|
-
|
|
200
|
-
###### Syntax:
|
|
201
|
-
|
|
202
|
-
```js
|
|
203
|
-
const table = kf.context.getTable(tableId);
|
|
204
|
-
await table.deleteRow(rowId);
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
> ##### Note: If there are more than one rows to be deleted then use `deleteRows()` instead.
|
|
208
|
-
|
|
209
|
-
#### d) deleteRows()
|
|
210
|
-
|
|
211
|
-
###### Description:
|
|
212
|
-
|
|
213
|
-
Deletes multiple rows from the table based on given array of strings.
|
|
214
|
-
|
|
215
|
-
###### Syntax:
|
|
216
|
-
|
|
217
|
-
```js
|
|
218
|
-
const table = kf.context.getTable(tableId);
|
|
219
|
-
await table.deleteRows([rowId1, rowId2, rowId3]);
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
#### e) getRow()
|
|
223
|
-
|
|
224
|
-
###### Description:
|
|
225
|
-
|
|
226
|
-
Use this function to perform form actions on any row inside a child table
|
|
227
|
-
|
|
228
|
-
###### Syntax:
|
|
229
|
-
|
|
230
|
-
```js
|
|
231
|
-
const table = kf.context.getTable(tableId);
|
|
232
|
-
const row = table.getRow(rowId);
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
###### Output:
|
|
236
|
-
|
|
237
|
-
Returns an instance of `TableForm` class
|
|
238
|
-
|
|
239
|
-
#### f) getRows()
|
|
240
|
-
|
|
241
|
-
###### Description:
|
|
242
|
-
|
|
243
|
-
Gets all the rows of the table
|
|
244
|
-
|
|
245
|
-
###### Syntax:
|
|
246
|
-
|
|
247
|
-
```js
|
|
248
|
-
const rows = await kf.context.getTable(tableId).getRows();
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
###### Output:
|
|
252
|
-
|
|
253
|
-
Returns an array of `TableForm` instances
|
|
254
|
-
|
|
255
|
-
##### g) toJSON()
|
|
256
|
-
|
|
257
|
-
###### Description:
|
|
258
|
-
|
|
259
|
-
Use this function to get the JSON data of the child table
|
|
260
|
-
|
|
261
|
-
###### Syntax:
|
|
262
|
-
|
|
263
|
-
```js
|
|
264
|
-
const json = await kf.context.getTable(tableId).toJSON();
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
###### Output:
|
|
268
|
-
|
|
269
|
-
```
|
|
270
|
-
[{
|
|
271
|
-
"Untitled_Field": "row 1",
|
|
272
|
-
"_created_at": "2022-03-01T03:04:09Z",
|
|
273
|
-
"_flow_name": "form events",
|
|
274
|
-
"_id": "Pk4_T1WGWuMe",
|
|
275
|
-
"_modified_at": "2022-03-01T03:04:09Z"
|
|
276
|
-
},{
|
|
277
|
-
"Untitled_Field": "row 2",
|
|
278
|
-
"_created_at": "2022-03-01T03:04:09Z",
|
|
279
|
-
"_flow_name": "form events",
|
|
280
|
-
"_id": "Pk4_T1WGWuMe",
|
|
281
|
-
"_modified_at": "2022-03-01T03:04:09Z"
|
|
282
|
-
}]
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### Table Row
|
|
286
|
-
|
|
287
|
-
A single row inside a table is known as Table row `kf.context` returns a
|
|
288
|
-
`TableForm` class which has the following methods
|
|
289
|
-
|
|
290
|
-
##### a) getField()
|
|
291
|
-
|
|
292
|
-
###### Description:
|
|
293
|
-
|
|
294
|
-
Use this function to get the value of the table row
|
|
295
|
-
|
|
296
|
-
###### Syntax:
|
|
297
|
-
|
|
298
|
-
```js
|
|
299
|
-
kf.context.getField(fieldId).then((res) => {...})
|
|
300
|
-
// or
|
|
301
|
-
let value = await kf.context.getField(fieldId)
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
##### b) updateField()
|
|
305
|
-
|
|
306
|
-
###### Description:
|
|
307
|
-
|
|
308
|
-
Use this function to get update any field in the table row
|
|
309
|
-
|
|
310
|
-
###### Syntax:
|
|
311
|
-
|
|
312
|
-
```js
|
|
313
|
-
kf.context.updateField({ fieldId_1: fieldValue, fieldId_2: fieldValue });
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
##### c) getParent()
|
|
317
|
-
|
|
318
|
-
###### Description:
|
|
319
|
-
|
|
320
|
-
Use this function to perform form actions on the main form
|
|
321
|
-
|
|
322
|
-
###### Syntax:
|
|
323
|
-
|
|
324
|
-
```js
|
|
325
|
-
const mainForm = kf.context.getParent();
|
|
326
|
-
mainForm.updateField({ fieldId_1: fieldValue, fieldId_2: fieldValue });
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
###### Output:
|
|
330
|
-
|
|
331
|
-
Returns an instance of `Form` class using which we can perform any action on the
|
|
332
|
-
main form
|
|
333
|
-
|
|
334
|
-
##### d) toJson()
|
|
335
|
-
|
|
336
|
-
##### Description:
|
|
337
|
-
|
|
338
|
-
Get JSON output of table row
|
|
339
|
-
|
|
340
|
-
##### Syntax:
|
|
341
|
-
|
|
342
|
-
```js
|
|
343
|
-
const json = await kf.context.toJSON();
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
###### Output:
|
|
347
|
-
|
|
348
|
-
```
|
|
349
|
-
{
|
|
350
|
-
"Untitled_Field": "testing",
|
|
351
|
-
"_created_at": "2022-03-01T03:04:09Z",
|
|
352
|
-
"_flow_name": "form events",
|
|
353
|
-
"_id": "Pk4_T1WGWuMe",
|
|
354
|
-
"_modified_at": "2022-03-01T03:04:09Z"
|
|
355
|
-
}
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
---
|
|
359
|
-
|
|
360
|
-
### 2) Client
|
|
361
|
-
|
|
362
|
-
##### Show Toast
|
|
363
|
-
|
|
364
|
-
```js
|
|
365
|
-
kf.client.showInfo(message);
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
##### Show confirm
|
|
369
|
-
|
|
370
|
-
Displays the confirmation dialog, and returns users's action as a response
|
|
371
|
-
|
|
372
|
-
```js
|
|
373
|
-
kf.client.showConfirm({ title, content }).then((action) => {
|
|
374
|
-
if(action === "OK") // user clicked ok button
|
|
375
|
-
|
|
376
|
-
else // user clicked cancel button or clicked outside the popup
|
|
377
|
-
})
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
##### Redirect to URL
|
|
381
|
-
|
|
382
|
-
```js
|
|
383
|
-
kf.client.redirect(url);
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
### 3) Application
|
|
387
|
-
|
|
388
|
-
`kf.app` represents the active kissflow app and `kf.app._id` returns its id.
|
|
389
|
-
|
|
390
|
-
##### Get value to application variable
|
|
391
|
-
|
|
392
|
-
```js
|
|
393
|
-
const appVarible1 = await kf.app.getVariable("variableId");
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
##### Set value of application variable
|
|
397
|
-
|
|
398
|
-
```js
|
|
399
|
-
let value = await kf.app.setVariable("variableId", value);
|
|
400
|
-
// or
|
|
401
|
-
await kf.app.setVariable({
|
|
402
|
-
variableId_1: "value_1",
|
|
403
|
-
variableId_2: 3345
|
|
404
|
-
});
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
##### Open a page
|
|
408
|
-
|
|
409
|
-
`openPage(id)` returns [Page](#4-page) class instance
|
|
410
|
-
|
|
411
|
-
```js
|
|
412
|
-
const pageInputParameters = {
|
|
413
|
-
param1: value,
|
|
414
|
-
param2: value
|
|
415
|
-
};
|
|
416
|
-
kf.app.openPage(pageId, pageInputParameters);
|
|
417
|
-
// Note: Page Input parameters are optional.
|
|
418
|
-
```
|
|
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
|
-
|
|
428
|
-
### 4) Page
|
|
429
|
-
|
|
430
|
-
`kf.app.page` returns the active page opened inside application and
|
|
431
|
-
`kf.app.page._id` returns its id.
|
|
432
|
-
|
|
433
|
-
##### Page parameters
|
|
434
|
-
|
|
435
|
-
```js
|
|
436
|
-
let value = await kf.app.page.getParameter("parameterId"); // for retreiving single parameter
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
Get all page parameters
|
|
440
|
-
|
|
441
|
-
```js
|
|
442
|
-
let allParams = await kf.app.page.getAllParameters();
|
|
443
|
-
// returns an object
|
|
444
|
-
{
|
|
445
|
-
parameterName: "Sample value",
|
|
446
|
-
parameterName2: "Sample value 2"
|
|
447
|
-
}
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
##### Access a Component
|
|
451
|
-
|
|
452
|
-
`getComponent` returns a [Component](#5-component) class.
|
|
453
|
-
|
|
454
|
-
```js
|
|
455
|
-
const componentName = await kf.app.page.getComponent("componentId");
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
##### Open a popup
|
|
459
|
-
|
|
460
|
-
`openPoup` returns a [Popup](#6-popup) class.
|
|
461
|
-
|
|
462
|
-
```js
|
|
463
|
-
kf.app.page.openPopup("popupId", { inputParam1: "value" });
|
|
464
|
-
// Note: Popup parameters are optional.
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
### 5) Component
|
|
468
|
-
|
|
469
|
-
#### getComponent(id)
|
|
470
|
-
|
|
471
|
-
Parameter: Component's Id Returns: Component class instance
|
|
472
|
-
|
|
473
|
-
```js
|
|
474
|
-
const component = await kf.app.page.getComponent(componentId);
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
##### Standard Component Methods
|
|
478
|
-
|
|
479
|
-
```js
|
|
480
|
-
component.refresh(); // Refreshes the component
|
|
481
|
-
component.hide(); // Hides the component
|
|
482
|
-
component.show(); // Shows the component if it's been hidden previously
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
##### Component Specific Methods
|
|
486
|
-
|
|
487
|
-
##### 5.2.0) Component onMount
|
|
488
|
-
|
|
489
|
-
Component onMount takes in callBack function as argument.
|
|
490
|
-
|
|
491
|
-
> ##### Note: Any component specific methods that are used on Page load must be called inside component's onMount event.
|
|
492
|
-
>
|
|
493
|
-
> Parameter: function
|
|
494
|
-
|
|
495
|
-
```js
|
|
496
|
-
component.onMount(() => {
|
|
497
|
-
// function logic goes here... For eg.
|
|
498
|
-
// component.setActiveTab(2)
|
|
499
|
-
});
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
##### 5.2.1) Tab component
|
|
503
|
-
|
|
504
|
-
##### 1) setActiveTab
|
|
505
|
-
|
|
506
|
-
Sets specified tab as active. Parameter: Tabs' Number (Starts from 1 to N)
|
|
507
|
-
|
|
508
|
-
```js
|
|
509
|
-
component.setActiveTab(2); // sets 2nd tab as active one
|
|
510
|
-
```
|
|
511
|
-
|
|
512
|
-
### 6) Popup
|
|
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.
|
|
517
|
-
|
|
518
|
-
##### Popup parameters
|
|
519
|
-
|
|
520
|
-
```js
|
|
521
|
-
let value = await kf.app.page.popup.getParameter("parameterId"); // for retreiving single popup parameter
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
Get all popup parameters
|
|
525
|
-
|
|
526
|
-
```js
|
|
527
|
-
let allParams = await kf.app.page.popup.getAllParameters();
|
|
528
|
-
// Returns an object
|
|
529
|
-
{
|
|
530
|
-
parameterName: "Sample value",
|
|
531
|
-
parameterName2: "Sample value 2"
|
|
532
|
-
}
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
##### Close popup
|
|
536
|
-
|
|
537
|
-
```js
|
|
538
|
-
kf.app.page.popup.close(); // for active popup
|
|
539
|
-
// or if you already have a popup instance...
|
|
540
|
-
greetPopup.close();
|
|
541
|
-
```
|
|
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
|
-
|
|
577
|
-
### 7) Formatter
|
|
578
|
-
|
|
579
|
-
##### Format to KF Date
|
|
580
|
-
|
|
581
|
-
```js
|
|
582
|
-
kf.formatter.toDate("08-24-2021").then((res) => {...})
|
|
583
|
-
// or
|
|
584
|
-
let value = await kf.formatter.toDate("08-24-2021");
|
|
585
|
-
```
|
|
586
|
-
|
|
587
|
-
##### Format to KF Date Time
|
|
588
|
-
|
|
589
|
-
```js
|
|
590
|
-
kf.formatter.toDateTime("2021-08-26T14:30").then((res) => {...})
|
|
591
|
-
// or
|
|
592
|
-
let value = await kf.formatter.toDateTime("2021-08-26T14:30");
|
|
593
|
-
```
|
|
594
|
-
|
|
595
|
-
##### Format to KF Number
|
|
596
|
-
|
|
597
|
-
```js
|
|
598
|
-
kf.formatter.toNumber("1,00,000.500000").then((res) => {...})
|
|
599
|
-
// or
|
|
600
|
-
let value = await kf.formatter.toNumber("1,00,000.500000");
|
|
601
|
-
```
|
|
602
|
-
|
|
603
|
-
##### Format to KF Currency
|
|
604
|
-
|
|
605
|
-
```js
|
|
606
|
-
kf.formatter.toCurrency("1,00,000.500000", "USD").then((res) => {...})
|
|
607
|
-
// or
|
|
608
|
-
let value = await kf.formatter.toCurrency("1,00,000.500000", "USD");
|
|
609
|
-
```
|
|
610
|
-
|
|
611
|
-
##### Format to KF Boolean
|
|
612
|
-
|
|
613
|
-
```js
|
|
614
|
-
kf.formatter.toBoolean("yes").then((res) => {...})
|
|
615
|
-
// or
|
|
616
|
-
let value = await kf.formatter.toBoolean("yes");
|
|
617
|
-
```
|
|
618
|
-
|
|
619
|
-
##### Other supported Boolean values
|
|
620
|
-
|
|
621
|
-
```js
|
|
622
|
-
let value = await kf.formatter.toBoolean("1");
|
|
623
|
-
let value = await kf.formatter.toBoolean("true");
|
|
624
|
-
let value = await kf.formatter.toBoolean("no");
|
|
625
|
-
let value = await kf.formatter.toBoolean("0");
|
|
626
|
-
let value = await kf.formatter.toBoolean("false");
|
|
627
|
-
```
|
|
5
|
+
Please refer docs [here](https://kissflow.github.io/lcnc-sdk-js/)
|