@kissflow/lowcode-client-sdk 1.0.18 → 1.0.19-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 +16 -7
- package/dist/snippets.json +6 -2
- package/dist/worker.js +40 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,6 +139,7 @@ Appends row details to the table.
|
|
|
139
139
|
const table = kf.context.getTable(tableId);
|
|
140
140
|
table.addRow({ columnId1: value, columnId2: value });
|
|
141
141
|
```
|
|
142
|
+
// Note: If there are more than one rows to be added to table then use addRows() instead for these bulk operations
|
|
142
143
|
|
|
143
144
|
#### b) addRows()
|
|
144
145
|
|
|
@@ -148,11 +149,14 @@ Appends multiple rows details to the table.
|
|
|
148
149
|
###### Syntax:
|
|
149
150
|
```js
|
|
150
151
|
const table = kf.context.getTable(tableId);
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
]
|
|
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);
|
|
156
160
|
```
|
|
157
161
|
|
|
158
162
|
#### c) deleteRow()
|
|
@@ -163,7 +167,7 @@ Deletes a row from the table based on the row id
|
|
|
163
167
|
###### Syntax:
|
|
164
168
|
```js
|
|
165
169
|
const table = kf.context.getTable(tableId);
|
|
166
|
-
table.deleteRow(rowId);
|
|
170
|
+
await table.deleteRow(rowId);
|
|
167
171
|
```
|
|
168
172
|
|
|
169
173
|
#### d) getRow()
|
|
@@ -293,8 +297,13 @@ kf.client.showInfo(message);
|
|
|
293
297
|
```
|
|
294
298
|
|
|
295
299
|
##### Show confirm
|
|
300
|
+
Displays the confirmation dialog, and returns users's action as a response
|
|
296
301
|
```js
|
|
297
|
-
kf.client.showConfirm({ title, content })
|
|
302
|
+
kf.client.showConfirm({ title, content }).then((action) => {
|
|
303
|
+
if(action === "OK") // user clicked ok button
|
|
304
|
+
|
|
305
|
+
else // user clicked cancel button or clicked outside the popup
|
|
306
|
+
})
|
|
298
307
|
```
|
|
299
308
|
|
|
300
309
|
##### Redirect to URL
|
package/dist/snippets.json
CHANGED
|
@@ -65,6 +65,11 @@
|
|
|
65
65
|
"documentation": "Sets the specified tab index as active - works only for the tab component",
|
|
66
66
|
"insertText": "// sets 2nd tab as active\ncomponentInstance.setActiveTab(${1:2})"
|
|
67
67
|
},
|
|
68
|
+
{
|
|
69
|
+
"label": "set selected item",
|
|
70
|
+
"documentation": "Sets the specified instance as selected item - works only for master detail component",
|
|
71
|
+
"insertText": "componentInstance.setSelectedItem(\"${1:instanceId}\")"
|
|
72
|
+
},
|
|
68
73
|
{
|
|
69
74
|
"label": "get popup parameter",
|
|
70
75
|
"documentation": "Get specific parameter in the popup",
|
|
@@ -149,7 +154,6 @@
|
|
|
149
154
|
"documentation": "Retrieves the acccount id",
|
|
150
155
|
"insertText": "kf.account._id"
|
|
151
156
|
},
|
|
152
|
-
|
|
153
157
|
{
|
|
154
158
|
"label": "get dataform item",
|
|
155
159
|
"documentation": "API call to get dataform item",
|
|
@@ -181,4 +185,4 @@
|
|
|
181
185
|
"insertText": "let payload = {}:\nkf.api(`/process/2/${kf.account._id}/${1:processId}/`, {\n\tmethod: \"POST\",\n\tbody: JSON.stringify(payload)\n})\n.then((resp) => {${2}})\n.catch((err) => {${3}})"
|
|
182
186
|
}
|
|
183
187
|
]
|
|
184
|
-
}
|
|
188
|
+
}
|
package/dist/worker.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import KF_LC_SDK from "./kf.lowcodeworkersdk.es.js";
|
|
2
|
+
import KF_NC_SDK from "./kf.nocodeworkersdk.es.js";
|
|
3
|
+
|
|
4
|
+
const SDK_KIND = {
|
|
5
|
+
LOWCODE: "lowcode",
|
|
6
|
+
NOCODE: "nocode"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
onmessage = async function (e) {
|
|
10
|
+
if (!self.kf) {
|
|
11
|
+
let { kind = SDK_KIND.LOWCODE } = e.data?.executionContext;
|
|
12
|
+
let lib = KF_LC_SDK;
|
|
13
|
+
if (kind === SDK_KIND.NOCODE) {
|
|
14
|
+
lib = KF_NC_SDK;
|
|
15
|
+
}
|
|
16
|
+
self.kf = lib(e?.data.executionContext);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (e.data?.eventParameters) {
|
|
20
|
+
let { eventParameters } = e.data;
|
|
21
|
+
if (eventParameters) {
|
|
22
|
+
self.kf.eventParameters = { ...eventParameters };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (e.data.command !== "EXECUTE") return;
|
|
27
|
+
const func = new Function(`
|
|
28
|
+
return (async () => {
|
|
29
|
+
${e.data.code}
|
|
30
|
+
})()`);
|
|
31
|
+
|
|
32
|
+
(async function () {
|
|
33
|
+
await func();
|
|
34
|
+
postMessage({
|
|
35
|
+
_id: Math.floor(Date.now() + 999).toString(36),
|
|
36
|
+
command: "RETURN",
|
|
37
|
+
data: {}
|
|
38
|
+
});
|
|
39
|
+
})();
|
|
40
|
+
};
|