@wavemaker/app-rn-runtime 12.0.0-next.141195 → 12.0.0-next.141937

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. app-rn-runtime/components/advanced/carousel/carousel.component.js +1 -0
  2. app-rn-runtime/components/advanced/carousel/carousel.component.js.map +1 -1
  3. app-rn-runtime/components/basic/custom/custom.component.js +1 -1
  4. app-rn-runtime/components/basic/custom/custom.component.js.map +1 -1
  5. app-rn-runtime/components/basic/lottie/lottie.component.js +3 -1
  6. app-rn-runtime/components/basic/lottie/lottie.component.js.map +1 -1
  7. app-rn-runtime/components/basic/search/search.component.js +1 -1
  8. app-rn-runtime/components/basic/search/search.component.js.map +1 -1
  9. app-rn-runtime/components/basic/search/search.props.js +1 -0
  10. app-rn-runtime/components/basic/search/search.props.js.map +1 -1
  11. app-rn-runtime/components/basic/skeleton/skeleton.component.js +2 -0
  12. app-rn-runtime/components/basic/skeleton/skeleton.component.js.map +1 -1
  13. app-rn-runtime/components/container/container.component.js +8 -1
  14. app-rn-runtime/components/container/container.component.js.map +1 -1
  15. app-rn-runtime/components/container/container.props.js +1 -0
  16. app-rn-runtime/components/container/container.props.js.map +1 -1
  17. app-rn-runtime/components/container/tabs/tabpane/tabpane.props.js +1 -0
  18. app-rn-runtime/components/container/tabs/tabpane/tabpane.props.js.map +1 -1
  19. app-rn-runtime/components/container/tabs/tabs.component.js +3 -1
  20. app-rn-runtime/components/container/tabs/tabs.component.js.map +1 -1
  21. app-rn-runtime/components/input/baseinput/baseinput.component.js +46 -10
  22. app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
  23. app-rn-runtime/components/input/basenumber/basenumber.component.js +16 -3
  24. app-rn-runtime/components/input/basenumber/basenumber.component.js.map +1 -1
  25. app-rn-runtime/components/input/checkbox/checkbox.component.js +2 -2
  26. app-rn-runtime/components/input/checkbox/checkbox.component.js.map +1 -1
  27. app-rn-runtime/components/input/checkbox/checkbox.styles.js +3 -1
  28. app-rn-runtime/components/input/checkbox/checkbox.styles.js.map +1 -1
  29. app-rn-runtime/components/input/currency/currency.component.js +3 -1
  30. app-rn-runtime/components/input/currency/currency.component.js.map +1 -1
  31. app-rn-runtime/components/input/currency/currency.styles.js +6 -1
  32. app-rn-runtime/components/input/currency/currency.styles.js.map +1 -1
  33. app-rn-runtime/components/input/epoch/base-datetime.component.js +4 -3
  34. app-rn-runtime/components/input/epoch/base-datetime.component.js.map +1 -1
  35. app-rn-runtime/components/input/number/number.component.js +3 -1
  36. app-rn-runtime/components/input/number/number.component.js.map +1 -1
  37. app-rn-runtime/components/input/number/number.styles.js +3 -0
  38. app-rn-runtime/components/input/number/number.styles.js.map +1 -1
  39. app-rn-runtime/components/input/radioset/radioset.component.js +12 -7
  40. app-rn-runtime/components/input/radioset/radioset.component.js.map +1 -1
  41. app-rn-runtime/components/input/radioset/radioset.props.js +1 -0
  42. app-rn-runtime/components/input/radioset/radioset.props.js.map +1 -1
  43. app-rn-runtime/components/input/radioset/radioset.styles.js +6 -0
  44. app-rn-runtime/components/input/radioset/radioset.styles.js.map +1 -1
  45. app-rn-runtime/components/input/text/text.component.js +5 -2
  46. app-rn-runtime/components/input/text/text.component.js.map +1 -1
  47. app-rn-runtime/components/input/text/text.props.js +1 -0
  48. app-rn-runtime/components/input/text/text.props.js.map +1 -1
  49. app-rn-runtime/components/input/text/text.styles.js +3 -0
  50. app-rn-runtime/components/input/text/text.styles.js.map +1 -1
  51. app-rn-runtime/components/input/textarea/textarea.component.js +3 -1
  52. app-rn-runtime/components/input/textarea/textarea.component.js.map +1 -1
  53. app-rn-runtime/components/input/textarea/textarea.styles.js +3 -0
  54. app-rn-runtime/components/input/textarea/textarea.styles.js.map +1 -1
  55. app-rn-runtime/components/page/content/content.component.js +4 -19
  56. app-rn-runtime/components/page/content/content.component.js.map +1 -1
  57. app-rn-runtime/components/page/left-panel/left-panel.component.js +4 -1
  58. app-rn-runtime/components/page/left-panel/left-panel.component.js.map +1 -1
  59. app-rn-runtime/components/page/page-content/page-content.component.js +43 -12
  60. app-rn-runtime/components/page/page-content/page-content.component.js.map +1 -1
  61. app-rn-runtime/core/AppConfig.js.map +1 -1
  62. app-rn-runtime/core/base.component.js +31 -5
  63. app-rn-runtime/core/base.component.js.map +1 -1
  64. app-rn-runtime/core/components/textinput.component.js +9 -7
  65. app-rn-runtime/core/components/textinput.component.js.map +1 -1
  66. app-rn-runtime/core/storage.service.js +15 -0
  67. app-rn-runtime/core/storage.service.js.map +1 -1
  68. app-rn-runtime/core/wm-component-tree.js +58 -0
  69. app-rn-runtime/core/wm-component-tree.js.map +1 -0
  70. app-rn-runtime/package.json +13 -6
  71. app-rn-runtime/runtime/App.js +17 -2
  72. app-rn-runtime/runtime/App.js.map +1 -1
  73. app-rn-runtime/runtime/App.navigator.js +1 -0
  74. app-rn-runtime/runtime/App.navigator.js.map +1 -1
  75. app-rn-runtime/runtime/base-fragment.component.js +18 -0
  76. app-rn-runtime/runtime/base-fragment.component.js.map +1 -1
  77. app-rn-runtime/runtime/base-page.component.js +10 -0
  78. app-rn-runtime/runtime/base-page.component.js.map +1 -1
  79. app-rn-runtime/runtime/base-partial.component.js +3 -0
  80. app-rn-runtime/runtime/base-partial.component.js.map +1 -1
  81. app-rn-runtime/runtime/navigator/drawer.navigator.js +19 -10
  82. app-rn-runtime/runtime/navigator/drawer.navigator.js.map +1 -1
  83. app-rn-runtime/styles/theme.js +5 -0
  84. app-rn-runtime/styles/theme.js.map +1 -1
  85. app-rn-runtime/styles/theme.variables.js +1 -1
  86. app-rn-runtime/styles/theme.variables.js.map +1 -1
  87. app-rn-runtime/variables/http.service.js +5 -1
  88. app-rn-runtime/variables/http.service.js.map +1 -1
  89. app-rn-runtime/variables/live-variable.js +14 -0
  90. app-rn-runtime/variables/live-variable.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["axios","WS_CONSTANTS","isWebPreviewMode","injector","HttpService","send","options","variable","_variable$serviceInfo","serviceInfo","headers","requestBody","data","url","cancelTokenSource","CancelToken","source","consumes","formData","FormData","parameters","forEach","p","v","params","name","append","category","startsWith","replace","config","baseUrl","serviceType","methodType","method","toLowerCase","isNonDataMethod","NON_DATA_AXIOS_METHODS","indexOf","toUpperCase","axiosConfig","cancelToken","token","withCredentials","Promise","resolve","reject","apply","then","result","err","response","sendCall","requestParams","getLocale","appConfig","get","appLocale","messages","cancel","uploadFile","event","error","httpService"],"sources":["http.service.ts"],"sourcesContent":["import axios from 'axios';\nimport { HttpClientService } from '@wavemaker/variables/src/types/http-client.service';\nimport { WS_CONSTANTS } from '@wavemaker/app-rn-runtime/variables/utils/variable.constants';\nimport { get, isEmpty } from 'lodash';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\nimport { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\n\nexport class HttpService implements HttpClientService {\n\n send(options: any, variable: any) {\n const serviceInfo = variable.serviceInfo;\n let headers: any = options.headers,\n requestBody: any = options.data,\n url: string = options.url;\n variable.cancelTokenSource = axios.CancelToken.source();\n if (!isWebPreviewMode() && (variable?.serviceInfo?.consumes||[])[0] === 'multipart/form-data') {\n headers['Content-Type'] = 'multipart/form-data';\n let formData = new FormData();\n (variable.serviceInfo.parameters||[]).forEach((p: any) => {\n const v = variable.params[p.name];\n if (v) {\n formData.append(p.name, variable.params[p.name]);\n }\n });\n requestBody = formData;\n }\n if (!isWebPreviewMode()\n && variable.category === 'wm.LiveVariable'\n && !(url.startsWith('http://') || url.startsWith(\"https://\"))) {\n options.url = options.url.replace('./', '/');\n url = variable.config.baseUrl + options.url;\n }\n\n if (!isWebPreviewMode() \n && variable.serviceType === \"JavaService\"\n && !(url.startsWith('http://') || url.startsWith(\"https://\"))) {\n options.url = options.url.replace('./', '');\n url = options.url;\n }\n\n const methodType: string = serviceInfo?.methodType || options.method.toLowerCase();\n const isNonDataMethod: boolean = WS_CONSTANTS.NON_DATA_AXIOS_METHODS.indexOf(methodType.toUpperCase()) > -1;\n const axiosConfig = {\n headers: headers,\n cancelToken: variable.cancelTokenSource.token,\n withCredentials: !isWebPreviewMode() || options?.withCredentials !== false\n };\n return new Promise((resolve, reject) => {\n // @ts-ignore\n axios[methodType].apply(variable, ( isNonDataMethod ? [url, axiosConfig] : [url, requestBody || {}, axiosConfig]))\n .then((result: any) => {\n resolve(result);\n }, (err: any) => {\n reject(err.response);\n })\n })\n }\n\n sendCall(requestParams: any, variable: any) {\n return new Promise((resolve, reject) => {\n this.send(requestParams, variable).then((response: any) => {\n resolve(response);\n }, (err: any) => {\n reject(err);\n });\n });\n }\n\n getLocale() {\n const appConfig = injector.get<AppConfig>('APP_CONFIG');\n return appConfig.appLocale.messages;\n }\n\n cancel(variable: any) {\n variable.cancelTokenSource.cancel();\n }\n\n uploadFile(url: any, data: any, variable: any, options?: any) {\n const requestParams = {\n url: url,\n data: data\n }\n return new Promise((resolve, reject) => {\n return this.send(requestParams, variable).then((event: any) => {\n resolve(event.data);\n }, (error: any) => {\n reject(error);\n });\n });\n }\n}\n\nconst httpService = new HttpService();\n\nexport default httpService;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,YAAY,QAAQ,8DAA8D;AAG3F,SAASC,gBAAgB,QAAQ,sCAAsC;AACvE,OAAOC,QAAQ,MAAM,yCAAyC;AAE9D,OAAO,MAAMC,WAAW,CAA8B;EAEpDC,IAAIA,CAACC,OAAY,EAAEC,QAAa,EAAE;IAAA,IAAAC,qBAAA;IAChC,MAAMC,WAAW,GAAGF,QAAQ,CAACE,WAAW;IACxC,IAAIC,OAAY,GAAGJ,OAAO,CAACI,OAAO;MAChCC,WAAgB,GAAGL,OAAO,CAACM,IAAI;MAC/BC,GAAW,GAAGP,OAAO,CAACO,GAAG;IACzBN,QAAQ,CAACO,iBAAiB,GAAGd,KAAK,CAACe,WAAW,CAACC,MAAM,CAAC,CAAC;IACzD,IAAI,CAACd,gBAAgB,CAAC,CAAC,IAAI,CAAC,CAAAK,QAAQ,aAARA,QAAQ,gBA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AACM,QAAQ,CAAC;MACrB,CAAC,EAAGD,GAAQ,IAAK;QACfJ,MAAM,CAACI,GAAG,CAAC;MACb,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEAI,SAASA,CAAA,EAAG;IACV,MAAMC,SAAS,GAAGpD,QAAQ,CAACqD,GAAG,CAAY,YAAY,CAAC;IACvD,OAAOD,SAAS,CAACE,SAAS,CAACC,QAAQ;EACrC;EAEAC,MAAMA,CAACpD,QAAa,EAAE;IACpBA,QAAQ,CAACO,iBAAiB,CAAC6C,MAAM,CAAC,CAAC;EACrC;EAEAC,UAAUA,CAAC/C,GAAQ,EAAED,IAAS,EAAEL,QAAa,EAAED,OAAa,EAAE;IAC5D,MAAM+C,aAAa,GAAG;MACpBxC,GAAG,EAAEA,GAAG;MACRD,IAAI,EAAEA;IACR,CAAC;IACD,OAAO,IAAIgC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtC,OAAO,IAAI,CAACzC,IAAI,CAACgD,aAAa,EAAE9C,QAAQ,CAAC,CAACyC,IAAI,CAAEa,KAAU,IAAK;QAC7DhB,OAAO,CAACgB,KAAK,CAACjD,IAAI,CAAC;MACrB,CAAC,EAAGkD,KAAU,IAAK;QACjBhB,MAAM,CAACgB,KAAK,CAAC;MACf,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;AACF;AAEA,MAAMC,WAAW,GAAG,IAAI3D,WAAW,CAAC,CAAC;AAErC,eAAe2D,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["axios","WS_CONSTANTS","isWebPreviewMode","injector","HttpService","send","options","variable","_variable$serviceInfo","serviceInfo","headers","requestBody","data","url","cancelTokenSource","CancelToken","source","consumes","formData","FormData","parameters","forEach","p","v","params","name","append","category","startsWith","replace","config","baseUrl","serviceType","methodType","method","toLowerCase","isNonDataMethod","NON_DATA_AXIOS_METHODS","indexOf","toUpperCase","axiosConfig","cancelToken","token","withCredentials","__wmVariable","owner","_context","Promise","resolve","reject","apply","then","result","err","response","sendCall","requestParams","getLocale","appConfig","get","appLocale","messages","cancel","uploadFile","event","error","httpService"],"sources":["http.service.ts"],"sourcesContent":["import axios from 'axios';\nimport { HttpClientService } from '@wavemaker/variables/src/types/http-client.service';\nimport { WS_CONSTANTS } from '@wavemaker/app-rn-runtime/variables/utils/variable.constants';\nimport { get, isEmpty } from 'lodash';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\nimport { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\n\nexport class HttpService implements HttpClientService {\n\n send(options: any, variable: any) {\n const serviceInfo = variable.serviceInfo;\n let headers: any = options.headers,\n requestBody: any = options.data,\n url: string = options.url;\n variable.cancelTokenSource = axios.CancelToken.source();\n if (!isWebPreviewMode() && (variable?.serviceInfo?.consumes||[])[0] === 'multipart/form-data') {\n headers['Content-Type'] = 'multipart/form-data';\n let formData = new FormData();\n (variable.serviceInfo.parameters||[]).forEach((p: any) => {\n const v = variable.params[p.name];\n if (v) {\n formData.append(p.name, variable.params[p.name]);\n }\n });\n requestBody = formData;\n }\n if (!isWebPreviewMode()\n && variable.category === 'wm.LiveVariable'\n && !(url.startsWith('http://') || url.startsWith(\"https://\"))) {\n options.url = options.url.replace('./', '/');\n url = variable.config.baseUrl + options.url;\n }\n\n if (!isWebPreviewMode() \n && variable.serviceType === \"JavaService\"\n && !(url.startsWith('http://') || url.startsWith(\"https://\"))) {\n options.url = options.url.replace('./', '');\n url = options.url;\n }\n\n const methodType: string = serviceInfo?.methodType || options.method.toLowerCase();\n const isNonDataMethod: boolean = WS_CONSTANTS.NON_DATA_AXIOS_METHODS.indexOf(methodType.toUpperCase()) > -1;\n const axiosConfig = {\n headers: headers,\n cancelToken: variable.cancelTokenSource.token,\n withCredentials: !isWebPreviewMode() || options?.withCredentials !== false,\n __wmVariable: {\n name: variable.name,\n owner: variable.config._context.name\n }\n };\n return new Promise((resolve, reject) => {\n // @ts-ignore\n axios[methodType].apply(variable, ( isNonDataMethod ? [url, axiosConfig] : [url, requestBody || {}, axiosConfig]))\n .then((result: any) => {\n resolve(result);\n }, (err: any) => {\n reject(err.response);\n })\n })\n }\n\n sendCall(requestParams: any, variable: any) {\n return new Promise((resolve, reject) => {\n this.send(requestParams, variable).then((response: any) => {\n resolve(response);\n }, (err: any) => {\n reject(err);\n });\n });\n }\n\n getLocale() {\n const appConfig = injector.get<AppConfig>('APP_CONFIG');\n return appConfig.appLocale.messages;\n }\n\n cancel(variable: any) {\n variable.cancelTokenSource.cancel();\n }\n\n uploadFile(url: any, data: any, variable: any, options?: any) {\n const requestParams = {\n url: url,\n data: data\n }\n return new Promise((resolve, reject) => {\n return this.send(requestParams, variable).then((event: any) => {\n resolve(event.data);\n }, (error: any) => {\n reject(error);\n });\n });\n }\n}\n\nconst httpService = new HttpService();\n\nexport default httpService;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,YAAY,QAAQ,8DAA8D;AAG3F,SAASC,gBAAgB,QAAQ,sCAAsC;AACvE,OAAOC,QAAQ,MAAM,yCAAyC;AAE9D,OAAO,MAAMC,WAAW,CAA8B;EAEpDC,IAAIA,CAACC,OAAY,EAAEC,QAAa,EAAE;IAAA,IAAAC,qBAAA;IAChC,MAAMC,WAAW,GAAGF,QAAQ,CAACE,WAAW;IACxC,IAAIC,OAAY,GAAGJ,OAAO,CAACI,OAAO;MAChCC,WAAgB,GAAGL,OAAO,CAACM,IAAI;MAC/BC,GAAW,GAAGP,OAAO,CAACO,GAAG;IACzBN,QAAQ,CAACO,iBAAiB,GAAGd,KAAK,CAACe,WAAW,CAACC,MAAM,CAAC,CAAC;IACzD,IAAI,CAACd,gBAAgB,CAAC,CAAC,IAAI,CAAC,CAAAK,QAAQ,aAARA,QAAQ,gBAAAC,qBAAA,GAARD,QAAQ,CAAEE,WAAW,cAAAD,qBAAA,uBAArBA,qBAAA,CAAuBS,QAAQ,KAAE,EAAE,EAAE,CAAC,CAA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EG,QAAa,IAAK;QACvDN,OAAO,CAACM,QAAQ,CAAC;MACrB,CAAC,EAAGD,GAAQ,IAAK;QACfJ,MAAM,CAACI,GAAG,CAAC;MACb,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEAI,SAASA,CAAA,EAAG;IACV,MAAMC,SAAS,GAAGvD,QAAQ,CAACwD,GAAG,CAAY,YAAY,CAAC;IACvD,OAAOD,SAAS,CAACE,SAAS,CAACC,QAAQ;EACrC;EAEAC,MAAMA,CAACvD,QAAa,EAAE;IACpBA,QAAQ,CAACO,iBAAiB,CAACgD,MAAM,CAAC,CAAC;EACrC;EAEAC,UAAUA,CAAClD,GAAQ,EAAED,IAAS,EAAEL,QAAa,EAAED,OAAa,EAAE;IAC5D,MAAMkD,aAAa,GAAG;MACpB3C,GAAG,EAAEA,GAAG;MACRD,IAAI,EAAEA;IACR,CAAC;IACD,OAAO,IAAImC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtC,OAAO,IAAI,CAAC5C,IAAI,CAACmD,aAAa,EAAEjD,QAAQ,CAAC,CAAC4C,IAAI,CAAEa,KAAU,IAAK;QAC7DhB,OAAO,CAACgB,KAAK,CAACpD,IAAI,CAAC;MACrB,CAAC,EAAGqD,KAAU,IAAK;QACjBhB,MAAM,CAACgB,KAAK,CAAC;MACf,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;AACF;AAEA,MAAMC,WAAW,GAAG,IAAI9D,WAAW,CAAC,CAAC;AAErC,eAAe8D,WAAW","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { VariableEvents } from './base-variable';
4
5
  import { isEqual, isUndefined, isFunction, forEach, isEmpty } from 'lodash';
5
6
  import { LiveVariable as _LiveVariable } from '@wavemaker/variables/src/model/variable/live-variable';
6
7
  import httpService from '@wavemaker/app-rn-runtime/variables/http.service';
@@ -103,6 +104,7 @@ export class LiveVariable extends _LiveVariable {
103
104
  return Promise.resolve(this);
104
105
  }
105
106
  listRecords(options, onSuccess, onError) {
107
+ this.notify(VariableEvents.BEFORE_INVOKE, [this]);
106
108
  this.filters = this.config.filterProvider && this.config.filterProvider();
107
109
  if (options) {
108
110
  this.filters = deepCopy({}, this.filters, options.filterFields ? options.filterFields : options);
@@ -112,5 +114,17 @@ export class LiveVariable extends _LiveVariable {
112
114
  this.setFilterExpValue(this.filters);
113
115
  return super.listRecords(options, onSuccess, onError);
114
116
  }
117
+ updateRecord(options, success, error) {
118
+ this.notify(VariableEvents.BEFORE_INVOKE, [this]);
119
+ return super.updateRecord(options, success, error);
120
+ }
121
+ insertRecord(options, success, error) {
122
+ this.notify(VariableEvents.BEFORE_INVOKE, [this]);
123
+ return super.insertRecord(options, success, error);
124
+ }
125
+ deleteRecord(options, success, error) {
126
+ this.notify(VariableEvents.BEFORE_INVOKE, [this]);
127
+ return super.deleteRecord(options, success, error);
128
+ }
115
129
  }
116
130
  //# sourceMappingURL=live-variable.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isEqual","isUndefined","isFunction","forEach","isEmpty","LiveVariable","_LiveVariable","httpService","injector","deepCopy","Formatters","_LiveVariableEvents","constructor","config","variableConfig","name","dataSet","paramProvider","inputFields","filterExpressions","filterFields","isList","maxResults","_context","operation","type","autoUpdate","liveSource","orderBy","category","properties","propertiesMap","tableName","tableType","relatedTables","httpClientService","inFlightBehavior","onSuccess","context","args","variable","data","options","onCanUpdate","onBeforeUpdate","dataFilter","inputData","onResult","onBeforeDatasetReady","onError","_defineProperty","get","dateFormatter","init","setFilterExpValue","filter","_this$filterExpressio","rules","r","value","target","invokeOnParamChange","last","params","latest","lastFilter","filters","latestFilter","filterProvider","update","invoke","val","key","Promise","resolve","listRecords"],"sources":["live-variable.ts"],"sourcesContent":["import { VariableConfig, VariableEvents } from './base-variable';\nimport { isEqual, isUndefined, isFunction, forEach, isEmpty } from 'lodash';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\nimport { LiveVariable as _LiveVariable } from '@wavemaker/variables/src/model/variable/live-variable';\nimport httpService from '@wavemaker/app-rn-runtime/variables/http.service';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\nimport { deepCopy } from '@wavemaker/app-rn-runtime/core/utils';\nimport Formatters from '@wavemaker/app-rn-runtime/core/formatters';\n\nexport interface LiveVariableConfig extends VariableConfig {\n baseUrl: string;\n maxResults: number;\n _context: any;\n onCanUpdate: any;\n onBeforeUpdate: any;\n onResult: any;\n onBeforeDatasetReady: any;\n inFlightBehavior: string;\n type: string;\n autoUpdate: boolean;\n orderBy: string;\n category: string;\n liveSource: string;\n propertiesMap: any;\n properties: any;\n tableName: string;\n tableType: string;\n relatedTables: any;\n filterExpressions: any;\n filterProvider: any;\n}\n\nenum _LiveVariableEvents {\n BEFORE_INVOKE = 'beforeInvoke'\n}\nexport type LiveVariableEvents = _LiveVariableEvents | VariableEvents;\n\nexport class LiveVariable extends _LiveVariable {\n params: any = {};\n filters: any = {};\n public appConfig = injector.get<AppConfig>('APP_CONFIG');\n\n constructor(public config: LiveVariableConfig) {\n const variableConfig: any = {\n name: config.name,\n dataSet: config.paramProvider(),\n inputFields: config.paramProvider(),\n filterExpressions: config.filterExpressions,\n filterFields: config.paramProvider(),\n isList: config.isList,\n maxResults: config.maxResults,\n _context: config._context,\n operation: config.operation,\n type: config.type,\n autoUpdate: config.autoUpdate,\n liveSource: config.liveSource,\n orderBy: config.orderBy,\n category: config.category,\n properties: config.properties,\n propertiesMap: config.propertiesMap,\n tableName: config.tableName,\n tableType: config.tableType,\n relatedTables: config.relatedTables,\n httpClientService: httpService,\n inFlightBehavior: config.inFlightBehavior,\n onSuccess: (context: any, args: any) => {\n return config.onSuccess && config.onSuccess(args.variable, args.data, args.options);\n },\n onCanUpdate: (context: any, args: any) => {\n return config.onCanUpdate && config.onCanUpdate(args.variable, args.data, args.options);\n },\n onBeforeUpdate: (context: any, args: any) => {\n return config.onBeforeUpdate && config.onBeforeUpdate(args.variable, args.dataFilter || args.inputData, args.options);\n },\n onResult: (context: any, args: any) => {\n return config.onResult && config.onResult(args.variable, args.data, args.options);\n },\n onBeforeDatasetReady: (context: any, args: any) => {\n return config.onBeforeDatasetReady && config.onBeforeDatasetReady(args.variable, args.data, args.options);\n }\n }\n if (config.onError) {\n variableConfig.onError = (context: any, args: any) => {\n return config.onError && config.onError(args.variable, args.data, args.options);\n };\n }\n super(variableConfig);\n this.dateFormatter = Formatters.get('toDate');\n this.init();\n }\n\n setFilterExpValue(filter: any) {\n this.filterExpressions?.rules.forEach((r: any) => {\n r.value = filter[r.target];\n });\n }\n\n invokeOnParamChange() {\n const last = this.params;\n const latest = this.config.paramProvider();\n if (this.config.operation === 'read') {\n const lastFilter = this.filters;\n const latestFilter = this.config.filterProvider && this.config.filterProvider();\n if (!isEqual(lastFilter, latestFilter)) {\n this.setFilterExpValue(latestFilter);\n if (this.autoUpdate && !isEmpty(latestFilter) && isFunction(this.update)) {\n this.filters = latestFilter;\n this.invoke();\n }\n }\n }\n if (!isEqual(last, latest)) {\n if (this.config.operation === 'read') {\n forEach(latest, (val: any, key: any) => {\n this.filterFields[key] = {\n 'value': val\n };\n });\n } else {\n this.inputFields = latest;\n }\n /* if auto-update set for the variable with read operation only, get its data */\n // @ts-ignore\n if (this.autoUpdate && !isUndefined(latest) && isFunction(this[this.config.operation + 'Record'])) {\n this.invoke();\n }\n }\n return Promise.resolve(this);\n }\n\n listRecords(options? : any, onSuccess?: Function, onError?: Function) {\n this.filters = this.config.filterProvider && this.config.filterProvider();\n if (options) {\n this.filters = deepCopy({} as any, this.filters, options.filterFields ? options.filterFields : options);\n }\n options = options || {};\n options.filterFields = this.filters;\n this.setFilterExpValue(this.filters);\n return super.listRecords(options, onSuccess, onError);\n }\n\n}\n"],"mappings":";;;AACA,SAASA,OAAO,EAAEC,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,OAAO,QAAQ,QAAQ;AAE3E,SAASC,YAAY,IAAIC,aAAa,QAAQ,uDAAuD;AACrG,OAAOC,WAAW,MAAM,kDAAkD;AAC1E,OAAOC,QAAQ,MAAM,yCAAyC;AAC9D,SAASC,QAAQ,QAAQ,sCAAsC;AAC/D,OAAOC,UAAU,MAAM,2CAA2C;AAAC,IAyB9DC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA,EAAnBA,mBAAmB;AAKxB,OAAO,MAAMN,YAAY,SAASC,aAAa,CAAC;EAK9CM,WAAWA,CAAQC,MAA0B,EAAE;IAC7C,MAAMC,cAAmB,GAAG;MAC1BC,IAAI,EAAEF,MAAM,CAACE,IAAI;MACjBC,OAAO,EAAEH,MAAM,CAACI,aAAa,CAAC,CAAC;MAC/BC,WAAW,EAAEL,MAAM,CAACI,aAAa,CAAC,CAAC;MACnCE,iBAAiB,EAAEN,MAAM,CAACM,iBAAiB;MAC3CC,YAAY,EAAEP,MAAM,CAACI,aAAa,CAAC,CAAC;MACpCI,MAAM,EAAER,MAAM,CAACQ,MAAM;MACrBC,UAAU,EAAET,MAAM,CAACS,UAAU;MAC7BC,QAAQ,EAAEV,MAAM,CAACU,QAAQ;MACzBC,SAAS,EAAEX,MAAM,CAACW,SAAS;MAC3BC,IAAI,EAAEZ,MAAM,CAACY,IAAI;MACjBC,UAAU,EAAEb,MAAM,CAACa,UAAU;MAC7BC,UAAU,EAAEd,MAAM,CAACc,UAAU;MAC7BC,OAAO,EAAEf,MAAM,CAACe,OAAO;MACvBC,QA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AM,CAACuD,cAAc,CAAC,CAAC;IACzE,IAAI1B,OAAO,EAAE;MACX,IAAI,CAACwB,OAAO,GAAGzD,QAAQ,CAAC,CAAC,CAAC,EAAS,IAAI,CAACyD,OAAO,EAAExB,OAAO,CAACtB,YAAY,GAAGsB,OAAO,CAACtB,YAAY,GAAGsB,OAAO,CAAC;IACzG;IACAA,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IACvBA,OAAO,CAACtB,YAAY,GAAG,IAAI,CAAC8C,OAAO;IACnC,IAAI,CAACZ,iBAAiB,CAAC,IAAI,CAACY,OAAO,CAAC;IACpC,OAAO,KAAK,CAACS,WAAW,CAACjC,OAAO,EAAEL,SAAS,EAAEY,OAAO,CAAC;EACvD;AAEF","ignoreList":[]}
1
+ {"version":3,"names":["VariableEvents","isEqual","isUndefined","isFunction","forEach","isEmpty","LiveVariable","_LiveVariable","httpService","injector","deepCopy","Formatters","_LiveVariableEvents","constructor","config","variableConfig","name","dataSet","paramProvider","inputFields","filterExpressions","filterFields","isList","maxResults","_context","operation","type","autoUpdate","liveSource","orderBy","category","properties","propertiesMap","tableName","tableType","relatedTables","httpClientService","inFlightBehavior","onSuccess","context","args","variable","data","options","onCanUpdate","onBeforeUpdate","dataFilter","inputData","onResult","onBeforeDatasetReady","onError","_defineProperty","get","dateFormatter","init","setFilterExpValue","filter","_this$filterExpressio","rules","r","value","target","invokeOnParamChange","last","params","latest","lastFilter","filters","latestFilter","filterProvider","update","invoke","val","key","Promise","resolve","listRecords","notify","BEFORE_INVOKE","updateRecord","success","error","insertRecord","deleteRecord"],"sources":["live-variable.ts"],"sourcesContent":["import { VariableConfig, VariableEvents } from './base-variable';\nimport { isEqual, isUndefined, isFunction, forEach, isEmpty } from 'lodash';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\nimport { LiveVariable as _LiveVariable } from '@wavemaker/variables/src/model/variable/live-variable';\nimport httpService from '@wavemaker/app-rn-runtime/variables/http.service';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\nimport { deepCopy } from '@wavemaker/app-rn-runtime/core/utils';\nimport Formatters from '@wavemaker/app-rn-runtime/core/formatters';\n\nexport interface LiveVariableConfig extends VariableConfig {\n baseUrl: string;\n maxResults: number;\n _context: any;\n onCanUpdate: any;\n onBeforeUpdate: any;\n onResult: any;\n onBeforeDatasetReady: any;\n inFlightBehavior: string;\n type: string;\n autoUpdate: boolean;\n orderBy: string;\n category: string;\n liveSource: string;\n propertiesMap: any;\n properties: any;\n tableName: string;\n tableType: string;\n relatedTables: any;\n filterExpressions: any;\n filterProvider: any;\n}\n\nenum _LiveVariableEvents {\n BEFORE_INVOKE = 'beforeInvoke'\n}\nexport type LiveVariableEvents = _LiveVariableEvents | VariableEvents;\n\nexport class LiveVariable extends _LiveVariable {\n params: any = {};\n filters: any = {};\n public appConfig = injector.get<AppConfig>('APP_CONFIG');\n\n constructor(public config: LiveVariableConfig) {\n const variableConfig: any = {\n name: config.name,\n dataSet: config.paramProvider(),\n inputFields: config.paramProvider(),\n filterExpressions: config.filterExpressions,\n filterFields: config.paramProvider(),\n isList: config.isList,\n maxResults: config.maxResults,\n _context: config._context,\n operation: config.operation,\n type: config.type,\n autoUpdate: config.autoUpdate,\n liveSource: config.liveSource,\n orderBy: config.orderBy,\n category: config.category,\n properties: config.properties,\n propertiesMap: config.propertiesMap,\n tableName: config.tableName,\n tableType: config.tableType,\n relatedTables: config.relatedTables,\n httpClientService: httpService,\n inFlightBehavior: config.inFlightBehavior,\n onSuccess: (context: any, args: any) => {\n return config.onSuccess && config.onSuccess(args.variable, args.data, args.options);\n },\n onCanUpdate: (context: any, args: any) => {\n return config.onCanUpdate && config.onCanUpdate(args.variable, args.data, args.options);\n },\n onBeforeUpdate: (context: any, args: any) => {\n return config.onBeforeUpdate && config.onBeforeUpdate(args.variable, args.dataFilter || args.inputData, args.options);\n },\n onResult: (context: any, args: any) => {\n return config.onResult && config.onResult(args.variable, args.data, args.options);\n },\n onBeforeDatasetReady: (context: any, args: any) => {\n return config.onBeforeDatasetReady && config.onBeforeDatasetReady(args.variable, args.data, args.options);\n }\n }\n if (config.onError) {\n variableConfig.onError = (context: any, args: any) => {\n return config.onError && config.onError(args.variable, args.data, args.options);\n };\n }\n super(variableConfig);\n this.dateFormatter = Formatters.get('toDate');\n this.init();\n }\n\n setFilterExpValue(filter: any) {\n this.filterExpressions?.rules.forEach((r: any) => {\n r.value = filter[r.target];\n });\n }\n\n invokeOnParamChange() {\n const last = this.params;\n const latest = this.config.paramProvider();\n if (this.config.operation === 'read') {\n const lastFilter = this.filters;\n const latestFilter = this.config.filterProvider && this.config.filterProvider();\n if (!isEqual(lastFilter, latestFilter)) {\n this.setFilterExpValue(latestFilter);\n if (this.autoUpdate && !isEmpty(latestFilter) && isFunction(this.update)) {\n this.filters = latestFilter;\n this.invoke();\n }\n }\n }\n if (!isEqual(last, latest)) {\n if (this.config.operation === 'read') {\n forEach(latest, (val: any, key: any) => {\n this.filterFields[key] = {\n 'value': val\n };\n });\n } else {\n this.inputFields = latest;\n }\n /* if auto-update set for the variable with read operation only, get its data */\n // @ts-ignore\n if (this.autoUpdate && !isUndefined(latest) && isFunction(this[this.config.operation + 'Record'])) {\n this.invoke();\n }\n }\n return Promise.resolve(this);\n }\n\n listRecords(options? : any, onSuccess?: Function, onError?: Function) {\n this.notify(VariableEvents.BEFORE_INVOKE, [this]);\n this.filters = this.config.filterProvider && this.config.filterProvider();\n if (options) {\n this.filters = deepCopy({} as any, this.filters, options.filterFields ? options.filterFields : options);\n }\n options = options || {};\n options.filterFields = this.filters;\n this.setFilterExpValue(this.filters);\n return super.listRecords(options, onSuccess, onError);\n }\n\n\n updateRecord(options?: any, success?: any, error?: any) {\n this.notify(VariableEvents.BEFORE_INVOKE, [this]);\n return super.updateRecord(options, success, error);\n }\n\n insertRecord(options?: any, success?: any, error?: any) {\n this.notify(VariableEvents.BEFORE_INVOKE, [this]);\n return super.insertRecord(options, success, error);\n }\n\n deleteRecord(options?: any, success?: any, error?: any)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