@kissflow/lowcode-client-sdk 1.0.16 → 1.0.18

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 CHANGED
@@ -29,7 +29,7 @@ window.onload = async function () {
29
29
  ### User and Account details
30
30
  Details of authenticated user can be accessed as following
31
31
  ```js
32
- const { Name, Email, UserType, _id } = kf.user
32
+ const { Name, Email, _id } = kf.user
33
33
  ```
34
34
  And account id can be accessed as `kf.account._id`
35
35
 
@@ -132,7 +132,7 @@ const json = await kf.context.toJSON();
132
132
  #### a) addRow()
133
133
 
134
134
  ###### Description:
135
- Appends row details to the end of table.
135
+ Appends row details to the table.
136
136
 
137
137
  ###### Syntax:
138
138
  ```js
@@ -140,7 +140,22 @@ const table = kf.context.getTable(tableId);
140
140
  table.addRow({ columnId1: value, columnId2: value });
141
141
  ```
142
142
 
143
- #### b) deleteRow()
143
+ #### b) addRows()
144
+
145
+ ###### Description:
146
+ Appends multiple rows details to the table.
147
+
148
+ ###### Syntax:
149
+ ```js
150
+ const table = kf.context.getTable(tableId);
151
+ table.addRows([
152
+ { columnId1: value, columnId2: value },
153
+ { columnId1: value, columnId2: value },
154
+ { columnId1: value, columnId2: value }
155
+ ]);
156
+ ```
157
+
158
+ #### c) deleteRow()
144
159
 
145
160
  ###### Description:
146
161
  Deletes a row from the table based on the row id
@@ -151,7 +166,7 @@ const table = kf.context.getTable(tableId);
151
166
  table.deleteRow(rowId);
152
167
  ```
153
168
 
154
- #### c) getRow()
169
+ #### d) getRow()
155
170
 
156
171
  ###### Description:
157
172
  Use this function to perform form actions on any row inside a child table
@@ -165,7 +180,7 @@ const row = table.getRow(rowId);
165
180
  ###### Output:
166
181
  Returns an instance of `TableForm` class
167
182
 
168
- #### d) getRows()
183
+ #### e) getRows()
169
184
 
170
185
  ###### Description:
171
186
  Gets all the rows of the table
@@ -178,7 +193,7 @@ const rows = await kf.context.getTable(tableId).getRows();
178
193
  ###### Output:
179
194
  Returns an array of `TableForm` instances
180
195
 
181
- ##### e) toJSON()
196
+ ##### f) toJSON()
182
197
 
183
198
  ###### Description:
184
199
  Use this function to get the JSON data of the child table
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ declare module "core/constants" {
8
8
  GET_TABLE: string;
9
9
  GET_TABLE_ROW: string;
10
10
  ADD_TABLE_ROW: string;
11
+ ADD_TABLE_ROWS: string;
11
12
  DELETE_TABLE_ROW: string;
12
13
  TO_JSON: string;
13
14
  GET_TABLE_ROWS: string;
@@ -76,7 +77,6 @@ declare module "types/external" {
76
77
  _id: string;
77
78
  Name: string;
78
79
  Email: string;
79
- UserType: string;
80
80
  Role: string;
81
81
  };
82
82
  export type accountObject = {
@@ -258,6 +258,7 @@ declare module "form/index" {
258
258
  getRows(): TableForm[];
259
259
  getRow(rowId: string): TableForm;
260
260
  addRow(rowObject: object): any;
261
+ addRows(rows: [object]): any;
261
262
  deleteRow(rowId: string): any;
262
263
  }
263
264
  export class TableForm extends BaseSDK {
@@ -43,6 +43,7 @@ const LISTENER_CMDS = {
43
43
  GET_TABLE: "GET_TABLE",
44
44
  GET_TABLE_ROW: "GET_TABLE_ROW",
45
45
  ADD_TABLE_ROW: "ADD_TABLE_ROW",
46
+ ADD_TABLE_ROWS: "ADD_TABLE_ROWS",
46
47
  DELETE_TABLE_ROW: "DELETE_TABLE_ROW",
47
48
  TO_JSON: "TO_JSON",
48
49
  GET_TABLE_ROWS: "GET_TABLE_ROWS",
@@ -224,12 +225,9 @@ class Table extends BaseSDK {
224
225
  this.instanceId = instanceId;
225
226
  }
226
227
  toJSON() {
227
- return this._postMessageAsync(
228
- LISTENER_CMDS.TO_JSON,
229
- {
230
- tableId: this.tableId
231
- }
232
- );
228
+ return this._postMessageAsync(LISTENER_CMDS.TO_JSON, {
229
+ tableId: this.tableId
230
+ });
233
231
  }
234
232
  getRows() {
235
233
  return this._postMessageAsync(
@@ -237,7 +235,9 @@ class Table extends BaseSDK {
237
235
  { tableId: this.tableId },
238
236
  true,
239
237
  (data) => {
240
- return data.map((row) => new TableForm(this.instanceId, this.tableId, row.id));
238
+ return data.map(
239
+ (row) => new TableForm(this.instanceId, this.tableId, row.id)
240
+ );
241
241
  }
242
242
  );
243
243
  }
@@ -250,6 +250,12 @@ class Table extends BaseSDK {
250
250
  rowObject
251
251
  });
252
252
  }
253
+ addRows(rows) {
254
+ return this._postMessageAsync(LISTENER_CMDS.ADD_TABLE_ROWS, {
255
+ tableId: this.tableId,
256
+ rows
257
+ });
258
+ }
253
259
  deleteRow(rowId) {
254
260
  return this._postMessageAsync(LISTENER_CMDS.DELETE_TABLE_ROW, {
255
261
  tableId: this.tableId,
@@ -39,6 +39,7 @@ const LISTENER_CMDS = {
39
39
  GET_TABLE: "GET_TABLE",
40
40
  GET_TABLE_ROW: "GET_TABLE_ROW",
41
41
  ADD_TABLE_ROW: "ADD_TABLE_ROW",
42
+ ADD_TABLE_ROWS: "ADD_TABLE_ROWS",
42
43
  DELETE_TABLE_ROW: "DELETE_TABLE_ROW",
43
44
  TO_JSON: "TO_JSON",
44
45
  GET_TABLE_ROWS: "GET_TABLE_ROWS",
@@ -213,12 +214,9 @@ class Table extends BaseSDK {
213
214
  this.instanceId = instanceId;
214
215
  }
215
216
  toJSON() {
216
- return this._postMessageAsync(
217
- LISTENER_CMDS.TO_JSON,
218
- {
219
- tableId: this.tableId
220
- }
221
- );
217
+ return this._postMessageAsync(LISTENER_CMDS.TO_JSON, {
218
+ tableId: this.tableId
219
+ });
222
220
  }
223
221
  getRows() {
224
222
  return this._postMessageAsync(
@@ -226,7 +224,9 @@ class Table extends BaseSDK {
226
224
  { tableId: this.tableId },
227
225
  true,
228
226
  (data) => {
229
- return data.map((row) => new TableForm(this.instanceId, this.tableId, row.id));
227
+ return data.map(
228
+ (row) => new TableForm(this.instanceId, this.tableId, row.id)
229
+ );
230
230
  }
231
231
  );
232
232
  }
@@ -239,6 +239,12 @@ class Table extends BaseSDK {
239
239
  rowObject
240
240
  });
241
241
  }
242
+ addRows(rows) {
243
+ return this._postMessageAsync(LISTENER_CMDS.ADD_TABLE_ROWS, {
244
+ tableId: this.tableId,
245
+ rows
246
+ });
247
+ }
242
248
  deleteRow(rowId) {
243
249
  return this._postMessageAsync(LISTENER_CMDS.DELETE_TABLE_ROW, {
244
250
  tableId: this.tableId,
package/dist/kfsdk.es.js CHANGED
@@ -43,6 +43,7 @@ const LISTENER_CMDS = {
43
43
  GET_TABLE: "GET_TABLE",
44
44
  GET_TABLE_ROW: "GET_TABLE_ROW",
45
45
  ADD_TABLE_ROW: "ADD_TABLE_ROW",
46
+ ADD_TABLE_ROWS: "ADD_TABLE_ROWS",
46
47
  DELETE_TABLE_ROW: "DELETE_TABLE_ROW",
47
48
  TO_JSON: "TO_JSON",
48
49
  GET_TABLE_ROWS: "GET_TABLE_ROWS",
package/dist/kfsdk.umd.js CHANGED
@@ -1 +1 @@
1
- var c=(E,t,i)=>{if(!t.has(E))throw TypeError("Cannot "+i)};var o=(E,t,i)=>(c(E,t,"read from private field"),i?i.call(E):t.get(E)),p=(E,t,i)=>{if(t.has(E))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(E):t.set(E,i)},g=(E,t,i,a)=>(c(E,t,"write to private field"),a?a.call(E,i):t.set(E,i),i);var l=(E,t,i)=>(c(E,t,"access private method"),i);(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 A,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",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"},i={COMPONENT_ON_MOUNT:"componentOnMount",CC_ON_PARAMS_CHANGE:"onCustomComponentParamsChange"},a={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:R,eventName:h,eventConfig:N={}}=e;let T=P[r];T._dispatchEvent(h,R),N.once&&T._removeEventListener(h);return}let{_req:s,resp:_}=e;s!=null&&s._id&&P[s._id]._dispatchMessageEvents(s,_)}}globalThis.addEventListener("message",d);class S{constructor(){p(this,A,void 0);g(this,A,{})}_addEventListener(e,s){var _;o(this,A)[e]=((_=o(this,A))==null?void 0:_[e])||[],o(this,A)[e].push(s)}_removeEventListener(e,s){if(s){let _=o(this,A)[e].findIndex(s);_>-1&&o(this,A)[e].splice(_,1);return}Reflect.deleteProperty(o(this,A),e)}_dispatchEvent(e,s){return Array.isArray(o(this,A)[e])?(o(this,A)[e].forEach(_=>_(s)),!0):!1}_dispatchMessageEvents(e,s){let _=e._id;Array.isArray(o(this,A)[_])&&(o(this,A)[_].forEach(r=>{try{s&&Object.keys(s).length===1&&e.command!==t.API?r(Object.values(s)[0]):r(s)}catch(R){console.error("Message callback error: ",R)}}),this._removeEventListener(_))}}A=new WeakMap;class O extends S{_postMessageAsync(e,s,_,r){return new Promise((R,h)=>{const N=u(e.toLowerCase());C({_id:N,command:e,...s}),P[N]=this,this._addEventListener(N,async T=>{T!=null&&T.errorMessage?h(T):(_&&r&&(T=await r(T)),R(T))})})}_postMessage(e,s,_){const r=u(e.toLowerCase());C({_id:r,command:e,...s}),_&&this._addEventListener(s.eventName,_)}}class D extends O{constructor(s){super();p(this,M);this._id=s.componentId,this.type="Component",P[this._id]=this,l(this,M,L).call(this,s.componentMethods)}onMount(s){this._postMessage(t.COMPONENT_ADD_EVENT_LISTENER,{id:this._id,eventName:i.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 O{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:i.CC_ON_PARAMS_CHANGE,eventConfig:{once:!1}},e)}}class f extends O{constructor(e){super(),this.type="Popup",this._id=e.popupId||a.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 O{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 O{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})}}class W extends O{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 F extends O{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 m extends O{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 y(e),this.page=new I(e),this.context=new G(e.componentId),this.client=new W,this.formatter=new F,this.user=e.user,this.account=e.account,this.env=e.envDetails,this))}initialise(){return this.initialize()}}var B=new m;return B});
1
+ var c=(E,t,A)=>{if(!t.has(E))throw TypeError("Cannot "+A)};var o=(E,t,A)=>(c(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)},g=(E,t,A,a)=>(c(E,t,"write to private field"),a?a.call(E,A):t.set(E,A),A);var L=(E,t,A)=>(c(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"},A={COMPONENT_ON_MOUNT:"componentOnMount",CC_ON_PARAMS_CHANGE:"onCustomComponentParamsChange"},a={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:R,eventName:h,eventConfig:N={}}=e;let T=P[r];T._dispatchEvent(h,R),N.once&&T._removeEventListener(h);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);g(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(R){console.error("Message callback error: ",R)}}),this._removeEventListener(_))}}i=new WeakMap;class O extends S{_postMessageAsync(e,s,_,r){return new Promise((R,h)=>{const N=u(e.toLowerCase());C({_id:N,command:e,...s}),P[N]=this,this._addEventListener(N,async T=>{T!=null&&T.errorMessage?h(T):(_&&r&&(T=await r(T)),R(T))})})}_postMessage(e,s,_){const r=u(e.toLowerCase());C({_id:r,command:e,...s}),_&&this._addEventListener(s.eventName,_)}}class D extends O{constructor(s){super();p(this,M);this._id=s.componentId,this.type="Component",P[this._id]=this,L(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 O{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 O{constructor(e){super(),this.type="Popup",this._id=e.popupId||a.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 O{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 W extends O{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})}}class y extends O{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 F extends O{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 m extends O{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 y,this.formatter=new F,this.user=e.user,this.account=e.account,this.env=e.envDetails,this))}initialise(){return this.initialize()}}var B=new m;return B});
package/dist/lowcode.d.ts CHANGED
@@ -8,6 +8,7 @@ declare module "core/constants" {
8
8
  GET_TABLE: string;
9
9
  GET_TABLE_ROW: string;
10
10
  ADD_TABLE_ROW: string;
11
+ ADD_TABLE_ROWS: string;
11
12
  DELETE_TABLE_ROW: string;
12
13
  TO_JSON: string;
13
14
  GET_TABLE_ROWS: string;
@@ -90,6 +91,7 @@ declare module "form/index" {
90
91
  getRows(): TableForm[];
91
92
  getRow(rowId: string): TableForm;
92
93
  addRow(rowObject: object): any;
94
+ addRows(rows: [object]): any;
93
95
  deleteRow(rowId: string): any;
94
96
  }
95
97
  export class TableForm extends BaseSDK {
@@ -136,7 +138,6 @@ declare module "types/external" {
136
138
  _id: string;
137
139
  Name: string;
138
140
  Email: string;
139
- UserType: string;
140
141
  Role: string;
141
142
  };
142
143
  export type accountObject = {
@@ -11,6 +11,7 @@ declare class Table {
11
11
  getRows(): TableForm[];
12
12
  getRow(rowId: string): TableForm;
13
13
  addRow(rowObject: object): any;
14
+ addRows(rows: [object]): any;
14
15
  deleteRow(rowId: string): any;
15
16
  }
16
17
  declare class TableForm {
@@ -87,7 +88,6 @@ declare type userObject = {
87
88
  _id: string;
88
89
  Name: string;
89
90
  Email: string;
90
- UserType: string;
91
91
  Role: string;
92
92
  };
93
93
 
package/dist/nocode.d.ts CHANGED
@@ -8,6 +8,7 @@ declare module "core/constants" {
8
8
  GET_TABLE: string;
9
9
  GET_TABLE_ROW: string;
10
10
  ADD_TABLE_ROW: string;
11
+ ADD_TABLE_ROWS: string;
11
12
  DELETE_TABLE_ROW: string;
12
13
  TO_JSON: string;
13
14
  GET_TABLE_ROWS: string;
@@ -90,6 +91,7 @@ declare module "form/index" {
90
91
  getRows(): TableForm[];
91
92
  getRow(rowId: string): TableForm;
92
93
  addRow(rowObject: object): any;
94
+ addRows(rows: [object]): any;
93
95
  deleteRow(rowId: string): any;
94
96
  }
95
97
  export class TableForm extends BaseSDK {
@@ -154,7 +156,6 @@ declare module "types/external" {
154
156
  _id: string;
155
157
  Name: string;
156
158
  Email: string;
157
- UserType: string;
158
159
  Role: string;
159
160
  };
160
161
  export type accountObject = {
@@ -11,6 +11,7 @@ declare class Table {
11
11
  getRows(): TableForm[];
12
12
  getRow(rowId: string): TableForm;
13
13
  addRow(rowObject: object): any;
14
+ addRows(rows: [object]): any;
14
15
  deleteRow(rowId: string): any;
15
16
  }
16
17
  declare class TableForm {
@@ -51,7 +52,6 @@ declare type userObject = {
51
52
  _id: string;
52
53
  Name: string;
53
54
  Email: string;
54
- UserType: string;
55
55
  Role: string;
56
56
  };
57
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kissflow/lowcode-client-sdk",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "JavaScript SDK for developing over the Kissflow lowcode platform",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [