@kissflow/lowcode-client-sdk 1.0.2-0.beta.1 → 1.0.2-1.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/dist/index.d.ts CHANGED
@@ -47,6 +47,7 @@ declare module "core/constants" {
47
47
  WINDOW_NDEF_READER_MAKE_READONLY: string;
48
48
  WINDOW_NDEF_READER_ABORT_SCAN: string;
49
49
  DECISION_TABLE_EXECUTE: string;
50
+ DATAFORM_IMPORT_CSV: string;
50
51
  };
51
52
  export const EVENT_TYPES: {
52
53
  COMPONENT_ON_MOUNT: string;
@@ -183,11 +184,20 @@ declare module "app/decisiontable" {
183
184
  evaluate(payload?: object): any;
184
185
  }
185
186
  }
187
+ declare module "app/dataform" {
188
+ import { BaseSDK } from "core/index";
189
+ export class Dataform extends BaseSDK {
190
+ private _id;
191
+ constructor(flowId: string);
192
+ importCSV(defaultValues: object): any;
193
+ }
194
+ }
186
195
  declare module "app/index" {
187
196
  import { BaseSDK } from "core/index";
188
197
  import { Page } from "app/page";
189
198
  import { AppContext } from "types/internal";
190
199
  import { DecisionTable } from "app/decisiontable";
200
+ import { Dataform } from "app/dataform";
191
201
  export class Application extends BaseSDK {
192
202
  page: Page;
193
203
  _id: string;
@@ -196,6 +206,7 @@ declare module "app/index" {
196
206
  setVariable(key: string | object, value?: any): any;
197
207
  openPage(pageId: string, pageParams: object): any;
198
208
  getDecisionTable(flowId: string): DecisionTable;
209
+ getDataform(flowId: string): Dataform;
199
210
  }
200
211
  export * from "app/component";
201
212
  export { Page };
@@ -81,7 +81,8 @@ const LISTENER_CMDS = {
81
81
  WINDOW_NDEF_READER_ADD_EVENT_LISTENER: "WINDOW_NDEF_READER_ADD_EVENT_LISTENER",
82
82
  WINDOW_NDEF_READER_MAKE_READONLY: "WINDOW_NDEF_READER_MAKE_READONLY",
83
83
  WINDOW_NDEF_READER_ABORT_SCAN: "WINDOW_NDEF_READER_ABORT_SCAN",
84
- DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE"
84
+ DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE",
85
+ DATAFORM_IMPORT_CSV: "DATAFORM_IMPORT_CSV"
85
86
  };
86
87
  const EVENT_TYPES = {
87
88
  COMPONENT_ON_MOUNT: "componentOnMount",
@@ -497,6 +498,18 @@ class DecisionTable extends BaseSDK {
497
498
  });
498
499
  }
499
500
  }
501
+ class Dataform extends BaseSDK {
502
+ constructor(flowId) {
503
+ super();
504
+ this._id = flowId;
505
+ }
506
+ importCSV(defaultValues) {
507
+ return this._postMessageAsync(LISTENER_CMDS.DATAFORM_IMPORT_CSV, {
508
+ flowId: this._id,
509
+ defaultValues
510
+ });
511
+ }
512
+ }
500
513
  class Application extends BaseSDK {
501
514
  constructor(props) {
502
515
  super();
@@ -523,6 +536,9 @@ class Application extends BaseSDK {
523
536
  getDecisionTable(flowId) {
524
537
  return new DecisionTable(flowId);
525
538
  }
539
+ getDataform(flowId) {
540
+ return new Dataform(flowId);
541
+ }
526
542
  }
527
543
  class NDEFReader extends BaseSDK {
528
544
  constructor() {
@@ -77,7 +77,8 @@ const LISTENER_CMDS = {
77
77
  WINDOW_NDEF_READER_ADD_EVENT_LISTENER: "WINDOW_NDEF_READER_ADD_EVENT_LISTENER",
78
78
  WINDOW_NDEF_READER_MAKE_READONLY: "WINDOW_NDEF_READER_MAKE_READONLY",
79
79
  WINDOW_NDEF_READER_ABORT_SCAN: "WINDOW_NDEF_READER_ABORT_SCAN",
80
- DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE"
80
+ DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE",
81
+ DATAFORM_IMPORT_CSV: "DATAFORM_IMPORT_CSV"
81
82
  };
82
83
  function generateId(prefix = "lcncsdk") {
83
84
  return `${prefix}-${nanoid()}`;
package/dist/kfsdk.es.js CHANGED
@@ -81,7 +81,8 @@ const LISTENER_CMDS = {
81
81
  WINDOW_NDEF_READER_ADD_EVENT_LISTENER: "WINDOW_NDEF_READER_ADD_EVENT_LISTENER",
82
82
  WINDOW_NDEF_READER_MAKE_READONLY: "WINDOW_NDEF_READER_MAKE_READONLY",
83
83
  WINDOW_NDEF_READER_ABORT_SCAN: "WINDOW_NDEF_READER_ABORT_SCAN",
84
- DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE"
84
+ DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE",
85
+ DATAFORM_IMPORT_CSV: "DATAFORM_IMPORT_CSV"
85
86
  };
86
87
  const EVENT_TYPES = {
87
88
  COMPONENT_ON_MOUNT: "componentOnMount",
@@ -361,6 +362,18 @@ class DecisionTable extends BaseSDK {
361
362
  });
362
363
  }
363
364
  }
365
+ class Dataform extends BaseSDK {
366
+ constructor(flowId) {
367
+ super();
368
+ this._id = flowId;
369
+ }
370
+ importCSV(defaultValues) {
371
+ return this._postMessageAsync(LISTENER_CMDS.DATAFORM_IMPORT_CSV, {
372
+ flowId: this._id,
373
+ defaultValues
374
+ });
375
+ }
376
+ }
364
377
  class Application extends BaseSDK {
365
378
  constructor(props) {
366
379
  super();
@@ -387,6 +400,9 @@ class Application extends BaseSDK {
387
400
  getDecisionTable(flowId) {
388
401
  return new DecisionTable(flowId);
389
402
  }
403
+ getDataform(flowId) {
404
+ return new Dataform(flowId);
405
+ }
390
406
  }
391
407
  class Client extends BaseSDK {
392
408
  showInfo(message) {
package/dist/kfsdk.umd.js CHANGED
@@ -1 +1 @@
1
- var h=(E,t,A)=>{if(!t.has(E))throw TypeError("Cannot "+A)};var o=(E,t,A)=>(h(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)},l=(E,t,A,R)=>(h(E,t,"write to private field"),R?R.call(E,A):t.set(E,A),A);var g=(E,t,A)=>(h(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",DECISION_TABLE_EXECUTE:"DECISION_TABLE_EXECUTE"},A={COMPONENT_ON_MOUNT:"componentOnMount",CC_ON_PARAMS_CHANGE:"onCustomComponentParamsChange"},R={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:a,eventName:c,eventConfig:N={}}=e;let T=P[r];T._dispatchEvent(c,a),N.once&&T._removeEventListener(c);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);l(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(a){console.error("Message callback error: ",a)}}),this._removeEventListener(_))}}i=new WeakMap;class O extends S{_postMessageAsync(e,s,_,r){return new Promise((a,c)=>{const N=u(e.toLowerCase());C({_id:N,command:e,...s}),P[N]=this,this._addEventListener(N,async T=>{T!=null&&T.errorMessage?c(T):(_&&r&&(T=await r(T)),a(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,g(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||R.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.flowId=e}evaluate(e){return this._postMessageAsync(t.DECISION_TABLE_EXECUTE,{flowId:this.flowId,payload:e})}}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})}getDecisionTable(e){return new W(e)}}class F 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 m 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 B 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 F,this.formatter=new m,this.user=e.user,this.account=e.account,this.env=e.envDetails,this))}initialise(){return this.initialize()}}var U=new B;return U});
1
+ var h=(E,t,A)=>{if(!t.has(E))throw TypeError("Cannot "+A)};var o=(E,t,A)=>(h(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)},l=(E,t,A,N)=>(h(E,t,"write to private field"),N?N.call(E,A):t.set(E,A),A);var g=(E,t,A)=>(h(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",DECISION_TABLE_EXECUTE:"DECISION_TABLE_EXECUTE",DATAFORM_IMPORT_CSV:"DATAFORM_IMPORT_CSV"},A={COMPONENT_ON_MOUNT:"componentOnMount",CC_ON_PARAMS_CHANGE:"onCustomComponentParamsChange"},N={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:a,eventName:c,eventConfig:R={}}=e;let O=P[r];O._dispatchEvent(c,a),R.once&&O._removeEventListener(c);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);l(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(a){console.error("Message callback error: ",a)}}),this._removeEventListener(_))}}i=new WeakMap;class T extends S{_postMessageAsync(e,s,_,r){return new Promise((a,c)=>{const R=u(e.toLowerCase());C({_id:R,command:e,...s}),P[R]=this,this._addEventListener(R,async O=>{O!=null&&O.errorMessage?c(O):(_&&r&&(O=await r(O)),a(O))})})}_postMessage(e,s,_){const r=u(e.toLowerCase());C({_id:r,command:e,...s}),_&&this._addEventListener(s.eventName,_)}}class D extends T{constructor(s){super();p(this,M);this._id=s.componentId,this.type="Component",P[this._id]=this,g(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 T{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 T{constructor(e){super(),this.type="Popup",this._id=e.popupId||N.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 T{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 T{constructor(e){super(),this.flowId=e}evaluate(e){return this._postMessageAsync(t.DECISION_TABLE_EXECUTE,{flowId:this.flowId,payload:e})}}class F extends T{constructor(e){super(),this._id=e}importCSV(e){return this._postMessageAsync(t.DATAFORM_IMPORT_CSV,{flowId:this._id,defaultValues:e})}}class W extends T{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})}getDecisionTable(e){return new y(e)}getDataform(e){return new F(e)}}class m extends T{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 B extends T{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 U extends T{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 m,this.formatter=new B,this.user=e.user,this.account=e.account,this.env=e.envDetails,this))}initialise(){return this.initialize()}}var V=new U;return V});
package/dist/lowcode.d.ts CHANGED
@@ -47,6 +47,7 @@ declare module "core/constants" {
47
47
  WINDOW_NDEF_READER_MAKE_READONLY: string;
48
48
  WINDOW_NDEF_READER_ABORT_SCAN: string;
49
49
  DECISION_TABLE_EXECUTE: string;
50
+ DATAFORM_IMPORT_CSV: string;
50
51
  };
51
52
  export const EVENT_TYPES: {
52
53
  COMPONENT_ON_MOUNT: string;
@@ -245,11 +246,20 @@ declare module "app/decisiontable" {
245
246
  evaluate(payload?: object): any;
246
247
  }
247
248
  }
249
+ declare module "app/dataform" {
250
+ import { BaseSDK } from "core/index";
251
+ export class Dataform extends BaseSDK {
252
+ private _id;
253
+ constructor(flowId: string);
254
+ importCSV(defaultValues: object): any;
255
+ }
256
+ }
248
257
  declare module "app/index" {
249
258
  import { BaseSDK } from "core/index";
250
259
  import { Page } from "app/page";
251
260
  import { AppContext } from "types/internal";
252
261
  import { DecisionTable } from "app/decisiontable";
262
+ import { Dataform } from "app/dataform";
253
263
  export class Application extends BaseSDK {
254
264
  page: Page;
255
265
  _id: string;
@@ -258,6 +268,7 @@ declare module "app/index" {
258
268
  setVariable(key: string | object, value?: any): any;
259
269
  openPage(pageId: string, pageParams: object): any;
260
270
  getDecisionTable(flowId: string): DecisionTable;
271
+ getDataform(flowId: string): Dataform;
261
272
  }
262
273
  export * from "app/component";
263
274
  export { Page };
@@ -76,6 +76,7 @@ declare class Application {
76
76
  setVariable(key: string | object, value?: any): any;
77
77
  openPage(pageId: string, pageParams: object): any;
78
78
  getDecisionTable(flowId: string): DecisionTable;
79
+ getDataform(flowId: string): Dataform;
79
80
  }
80
81
  declare class kf {
81
82
  static context: Component
package/dist/nocode.d.ts CHANGED
@@ -47,6 +47,7 @@ declare module "core/constants" {
47
47
  WINDOW_NDEF_READER_MAKE_READONLY: string;
48
48
  WINDOW_NDEF_READER_ABORT_SCAN: string;
49
49
  DECISION_TABLE_EXECUTE: string;
50
+ DATAFORM_IMPORT_CSV: string;
50
51
  };
51
52
  export const EVENT_TYPES: {
52
53
  COMPONENT_ON_MOUNT: string;
@@ -245,6 +246,14 @@ declare module "app/component" {
245
246
  watchParams(callBack: (data: any) => any): void;
246
247
  }
247
248
  }
249
+ declare module "app/dataform" {
250
+ import { BaseSDK } from "core/index";
251
+ export class Dataform extends BaseSDK {
252
+ private _id;
253
+ constructor(flowId: string);
254
+ importCSV(defaultValues: object): any;
255
+ }
256
+ }
248
257
  declare module "app/decisiontable" {
249
258
  import { BaseSDK } from "core/index";
250
259
  export class DecisionTable extends BaseSDK {
@@ -290,6 +299,7 @@ declare module "app/index" {
290
299
  import { Page } from "app/page";
291
300
  import { AppContext } from "types/internal";
292
301
  import { DecisionTable } from "app/decisiontable";
302
+ import { Dataform } from "app/dataform";
293
303
  export class Application extends BaseSDK {
294
304
  page: Page;
295
305
  _id: string;
@@ -298,6 +308,7 @@ declare module "app/index" {
298
308
  setVariable(key: string | object, value?: any): any;
299
309
  openPage(pageId: string, pageParams: object): any;
300
310
  getDecisionTable(flowId: string): DecisionTable;
311
+ getDataform(flowId: string): Dataform;
301
312
  }
302
313
  export * from "app/component";
303
314
  export { Page };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kissflow/lowcode-client-sdk",
3
- "version": "1.0.20.beta.1",
3
+ "version": "1.0.21.beta.1",
4
4
  "description": "JavaScript SDK for developing over the Kissflow lowcode platform",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [