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