@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/README.md
CHANGED
|
@@ -1,80 +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 src="https://
|
|
20
|
-
<!-- or -->
|
|
21
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@kissflow/lowcode-client-sdk@1/dist/kflowcode.sdk.module.js"></script>
|
|
19
|
+
<script src="https://unpkg.com/@kissflow/lowcode-client-sdk@latest/dist/kfsdk.umd.js"></script>
|
|
22
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.
|
|
23
74
|
|
|
24
|
-
> Then SDK can be initialized anywhere by declaring:
|
|
25
75
|
```js
|
|
26
|
-
|
|
76
|
+
kf.context.watchParams(function (data) {
|
|
77
|
+
console.log(data);
|
|
78
|
+
});
|
|
27
79
|
```
|
|
28
80
|
|
|
29
|
-
###
|
|
81
|
+
### Kissflow Forms
|
|
30
82
|
|
|
31
|
-
|
|
32
|
-
> Use Table:: as a prefix while using TableId
|
|
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
|
|
33
84
|
|
|
34
|
-
#####
|
|
85
|
+
##### a) getField()
|
|
86
|
+
|
|
87
|
+
###### Description:
|
|
88
|
+
Use this function to get the current value of a form field
|
|
89
|
+
|
|
90
|
+
###### Syntax:
|
|
35
91
|
```js
|
|
36
|
-
kf.
|
|
92
|
+
kf.context.getField(fieldId).then((res) => {...})
|
|
37
93
|
// or
|
|
38
|
-
let value = await kf.
|
|
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]);
|
|
39
183
|
```
|
|
40
|
-
|
|
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:
|
|
41
191
|
```js
|
|
42
|
-
kf.
|
|
192
|
+
const table = kf.context.getTable(tableId);
|
|
193
|
+
const row = table.getRow(rowId);
|
|
43
194
|
```
|
|
44
|
-
|
|
45
|
-
|
|
195
|
+
|
|
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:
|
|
46
205
|
```js
|
|
47
|
-
kf.
|
|
206
|
+
const rows = await kf.context.getTable(tableId).getRows();
|
|
48
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:
|
|
218
|
+
```js
|
|
219
|
+
const json = await kf.context.getTable(tableId).toJSON();
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
###### Output:
|
|
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
|
|
243
|
+
|
|
244
|
+
##### a) getField()
|
|
245
|
+
|
|
246
|
+
###### Description:
|
|
247
|
+
Use this function to get the value of the table row
|
|
248
|
+
|
|
249
|
+
###### Syntax:
|
|
250
|
+
```js
|
|
251
|
+
kf.context.getField(fieldId).then((res) => {...})
|
|
252
|
+
// or
|
|
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 });
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
##### c) getParent()
|
|
267
|
+
|
|
268
|
+
###### Description:
|
|
269
|
+
Use this function to perform form actions on the main form
|
|
270
|
+
|
|
271
|
+
###### Syntax:
|
|
272
|
+
```js
|
|
273
|
+
const mainForm = kf.context.getParent();
|
|
274
|
+
mainForm.updateField({ fieldId_1: fieldValue, fieldId_2: fieldValue });
|
|
275
|
+
```
|
|
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:
|
|
287
|
+
```js
|
|
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
|
+
}
|
|
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
|
-
---
|
|
65
|
-
### 3) Component Functions
|
|
66
|
-
#### Refresh a component
|
|
67
|
-
```js
|
|
68
|
-
kf.getComponent(componentId).refresh();
|
|
69
|
-
```
|
|
70
|
-
---
|
|
71
325
|
|
|
72
|
-
###
|
|
73
|
-
|
|
326
|
+
### 3) Application
|
|
327
|
+
|
|
328
|
+
`kf.app` represents the active kissflow app and `kf.app._id` returns its id.
|
|
329
|
+
|
|
74
330
|
##### Get value to application variable
|
|
331
|
+
```js
|
|
332
|
+
const appVarible1 = await kf.app.getVariable("variableId");
|
|
75
333
|
```
|
|
76
|
-
|
|
77
|
-
```
|
|
334
|
+
|
|
78
335
|
##### Set value of application variable
|
|
79
336
|
```js
|
|
80
337
|
let value = await kf.app.setVariable("variableId", value);
|
|
@@ -84,111 +341,152 @@ await kf.app.setVariable({
|
|
|
84
341
|
variableId_2: 3345
|
|
85
342
|
});
|
|
86
343
|
```
|
|
344
|
+
|
|
87
345
|
##### Open a page
|
|
88
|
-
|
|
346
|
+
`openPage(id)` returns [Page](#4-page) class instance
|
|
89
347
|
```js
|
|
90
|
-
|
|
348
|
+
const pageInputParameters = {
|
|
91
349
|
param1: value,
|
|
92
350
|
param2: value
|
|
93
351
|
};
|
|
94
352
|
kf.app.openPage(pageId, pageInputParameters);
|
|
353
|
+
// Note: Page Input parameters are optional.
|
|
95
354
|
```
|
|
96
|
-
|
|
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
|
|
97
360
|
```js
|
|
98
|
-
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
|
+
}
|
|
99
371
|
```
|
|
100
|
-
|
|
372
|
+
|
|
373
|
+
##### Access a Component
|
|
374
|
+
`getComponent` returns a [Component](#5-component) class.
|
|
101
375
|
```js
|
|
102
|
-
|
|
376
|
+
const componentName = await kf.app.page.getComponent("componentId");
|
|
103
377
|
```
|
|
104
|
-
|
|
378
|
+
|
|
379
|
+
##### Open a popup
|
|
380
|
+
`openPoup` returns a [Popup](#6-popup) class.
|
|
105
381
|
```js
|
|
106
|
-
|
|
107
|
-
|
|
382
|
+
kf.app.page.openPopup("popupId", { inputParam1: "value" });
|
|
383
|
+
// Note: Popup parameters are optional.
|
|
108
384
|
```
|
|
109
|
-
|
|
385
|
+
|
|
386
|
+
### 5) Component
|
|
387
|
+
#### getComponent(id)
|
|
388
|
+
Parameter: Component's Id
|
|
389
|
+
Returns: Component class instance
|
|
110
390
|
```js
|
|
111
|
-
kf.app.page.
|
|
112
|
-
// or
|
|
113
|
-
let popupPage = await kf.app.page.openPopup(pageId, { inputParam1: 2 }, { w: 50; h: 50 })
|
|
114
|
-
popupPage.onClose(() => {
|
|
115
|
-
console.log("popup onclose");
|
|
116
|
-
// ...
|
|
117
|
-
});
|
|
391
|
+
const component = await kf.app.page.getComponent(componentId);
|
|
118
392
|
```
|
|
119
|
-
|
|
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
|
|
120
400
|
|
|
121
|
-
|
|
122
|
-
|
|
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
|
|
123
406
|
```js
|
|
124
|
-
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
*/
|
|
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
|
|
136
418
|
```
|
|
137
|
-
---
|
|
138
419
|
|
|
139
|
-
### 7) Fetch Api through kf sdk
|
|
140
420
|
|
|
141
|
-
|
|
142
|
-
|
|
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
|
|
143
426
|
```js
|
|
144
|
-
kf.
|
|
145
|
-
|
|
146
|
-
|
|
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
|
+
}
|
|
147
437
|
```
|
|
148
|
-
---
|
|
149
438
|
|
|
150
|
-
|
|
151
|
-
Listens for changes in parameter given to custom components in lowcode
|
|
152
|
-
application.
|
|
439
|
+
##### Close popup
|
|
153
440
|
```js
|
|
154
|
-
kf.
|
|
155
|
-
|
|
156
|
-
|
|
441
|
+
kf.app.page.popup.close() // for active popup
|
|
442
|
+
// or if you already have a popup instance...
|
|
443
|
+
greetPopup.close();
|
|
157
444
|
```
|
|
158
|
-
---
|
|
159
445
|
|
|
160
|
-
###
|
|
446
|
+
### 7) Formatter
|
|
447
|
+
|
|
161
448
|
##### Format to KF Date
|
|
449
|
+
|
|
162
450
|
```js
|
|
163
|
-
kf.formatter.
|
|
451
|
+
kf.formatter.toDate("08-24-2021").then((res) => {...})
|
|
164
452
|
// or
|
|
165
|
-
let value = await kf.formatter.
|
|
453
|
+
let value = await kf.formatter.toDate("08-24-2021");
|
|
166
454
|
```
|
|
455
|
+
|
|
167
456
|
##### Format to KF Date Time
|
|
457
|
+
|
|
168
458
|
```js
|
|
169
|
-
kf.formatter.
|
|
459
|
+
kf.formatter.toDateTime("2021-08-26T14:30").then((res) => {...})
|
|
170
460
|
// or
|
|
171
|
-
let value = await kf.formatter.
|
|
461
|
+
let value = await kf.formatter.toDateTime("2021-08-26T14:30");
|
|
172
462
|
```
|
|
463
|
+
|
|
173
464
|
##### Format to KF Number
|
|
465
|
+
|
|
174
466
|
```js
|
|
175
|
-
kf.formatter.
|
|
467
|
+
kf.formatter.toNumber("1,00,000.500000").then((res) => {...})
|
|
176
468
|
// or
|
|
177
|
-
let value = await kf.formatter.
|
|
469
|
+
let value = await kf.formatter.toNumber("1,00,000.500000");
|
|
178
470
|
```
|
|
471
|
+
|
|
179
472
|
##### Format to KF Currency
|
|
473
|
+
|
|
180
474
|
```js
|
|
181
|
-
kf.formatter.
|
|
475
|
+
kf.formatter.toCurrency("1,00,000.500000", "USD").then((res) => {...})
|
|
182
476
|
// or
|
|
183
|
-
let value = await kf.formatter.
|
|
477
|
+
let value = await kf.formatter.toCurrency("1,00,000.500000", "USD");
|
|
184
478
|
```
|
|
479
|
+
|
|
185
480
|
##### Format to KF Boolean
|
|
481
|
+
|
|
186
482
|
```js
|
|
187
483
|
kf.formatter.toBoolean("yes").then((res) => {...})
|
|
188
484
|
// or
|
|
189
485
|
let value = await kf.formatter.toBoolean("yes");
|
|
190
486
|
```
|
|
487
|
+
|
|
191
488
|
##### Other supported Boolean values
|
|
489
|
+
|
|
192
490
|
```js
|
|
193
491
|
let value = await kf.formatter.toBoolean("1");
|
|
194
492
|
let value = await kf.formatter.toBoolean("true");
|
|
@@ -196,4 +494,3 @@ let value = await kf.formatter.toBoolean("no");
|
|
|
196
494
|
let value = await kf.formatter.toBoolean("0");
|
|
197
495
|
let value = await kf.formatter.toBoolean("false");
|
|
198
496
|
```
|
|
199
|
-
---
|