@wavemaker/app-rn-runtime 11.4.0-next.24562 → 11.4.0-next.24564
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.
app-rn-runtime/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker/app-rn-runtime",
|
|
3
|
-
"version": "11.4.0-next.
|
|
3
|
+
"version": "11.4.0-next.24564",
|
|
4
4
|
"description": "''",
|
|
5
5
|
"main": "index",
|
|
6
6
|
"module": "index",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@react-navigation/native": "^6.0.16",
|
|
50
50
|
"@react-navigation/stack": "^6.3.7",
|
|
51
51
|
"@types/lodash-es": "^4.17.6",
|
|
52
|
-
"@wavemaker/variables": "11.4.0-next.
|
|
52
|
+
"@wavemaker/variables": "11.4.0-next.24564",
|
|
53
53
|
"axios": "^1.4.0",
|
|
54
54
|
"color": "4.2.3",
|
|
55
55
|
"cross-env": "^5.2.0",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"typescript": "^4.9.3",
|
|
128
128
|
"victory-native": "^36.6.11",
|
|
129
129
|
"yargs": "^16.2.0",
|
|
130
|
-
"@wavemaker/variables": "11.4.0-next.
|
|
130
|
+
"@wavemaker/variables": "11.4.0-next.24564"
|
|
131
131
|
},
|
|
132
132
|
"jest": {
|
|
133
133
|
"preset": "react-native",
|
|
@@ -42,7 +42,7 @@ export class LiveVariable extends _LiveVariable {
|
|
|
42
42
|
return config.onCanUpdate && config.onCanUpdate(args.variable, args.data, args.options);
|
|
43
43
|
},
|
|
44
44
|
onBeforeUpdate: (context, args) => {
|
|
45
|
-
return config.onBeforeUpdate && config.onBeforeUpdate(args.variable, args.
|
|
45
|
+
return config.onBeforeUpdate && config.onBeforeUpdate(args.variable, args.dataFilter || args.inputData, args.options);
|
|
46
46
|
},
|
|
47
47
|
onResult: (context, args) => {
|
|
48
48
|
return config.onResult && config.onResult(args.variable, args.data, args.options);
|
|
@@ -57,6 +57,12 @@ export class LiveVariable extends _LiveVariable {
|
|
|
57
57
|
_defineProperty(this, "filters", {});
|
|
58
58
|
_defineProperty(this, "appConfig", injector.get('APP_CONFIG'));
|
|
59
59
|
}
|
|
60
|
+
setFilterExpValue(filter) {
|
|
61
|
+
var _this$filterExpressio;
|
|
62
|
+
(_this$filterExpressio = this.filterExpressions) === null || _this$filterExpressio === void 0 ? void 0 : _this$filterExpressio.rules.forEach(r => {
|
|
63
|
+
r.value = filter[r.target];
|
|
64
|
+
});
|
|
65
|
+
}
|
|
60
66
|
invokeOnParamChange() {
|
|
61
67
|
const last = this.params;
|
|
62
68
|
const latest = this.config.paramProvider();
|
|
@@ -64,10 +70,7 @@ export class LiveVariable extends _LiveVariable {
|
|
|
64
70
|
const lastFilter = this.filters;
|
|
65
71
|
const latestFilter = this.config.filterProvider && this.config.filterProvider();
|
|
66
72
|
if (!isEqual(lastFilter, latestFilter)) {
|
|
67
|
-
|
|
68
|
-
(_this$filterExpressio = this.filterExpressions) === null || _this$filterExpressio === void 0 ? void 0 : _this$filterExpressio.rules.forEach(r => {
|
|
69
|
-
r.value = latestFilter[r.target];
|
|
70
|
-
});
|
|
73
|
+
this.setFilterExpValue(latestFilter);
|
|
71
74
|
if (this.autoUpdate && !isEmpty(latestFilter) && isFunction(this.update)) {
|
|
72
75
|
this.filters = latestFilter;
|
|
73
76
|
this.invoke();
|
|
@@ -92,5 +95,12 @@ export class LiveVariable extends _LiveVariable {
|
|
|
92
95
|
}
|
|
93
96
|
return Promise.resolve(this);
|
|
94
97
|
}
|
|
98
|
+
listRecords(options, onSuccess, onError) {
|
|
99
|
+
this.filters = this.config.filterProvider && this.config.filterProvider();
|
|
100
|
+
options = options || {};
|
|
101
|
+
options.filterFields = this.filters;
|
|
102
|
+
this.setFilterExpValue(this.filters);
|
|
103
|
+
return super.listRecords(options, onSuccess, onError);
|
|
104
|
+
}
|
|
95
105
|
}
|
|
96
106
|
//# sourceMappingURL=live-variable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isEqual","isUndefined","isFunction","forEach","isEmpty","LiveVariable","_LiveVariable","httpService","injector","_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","onSuccess","context","args","variable","data","options","onError","onCanUpdate","onBeforeUpdate","onResult","onBeforeDatasetReady","get","
|
|
1
|
+
{"version":3,"names":["isEqual","isUndefined","isFunction","forEach","isEmpty","LiveVariable","_LiveVariable","httpService","injector","_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","onSuccess","context","args","variable","data","options","onError","onCanUpdate","onBeforeUpdate","dataFilter","inputData","onResult","onBeforeDatasetReady","get","setFilterExpValue","filter","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';\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 = {\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 onSuccess: (context: any, args: any) => {\n return config.onSuccess && config.onSuccess(args.variable, args.data, args.options);\n },\n onError: (context: any, args: any) => {\n return config.onError && config.onError(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 super(variableConfig);\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 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;AAAC,IAyB1DC,mBAAmB;AAAA,WAAnBA,mBAAmB;EAAnBA,mBAAmB;AAAA,GAAnBA,mBAAmB,KAAnBA,mBAAmB;AAKxB,OAAO,MAAMJ,YAAY,SAASC,aAAa,CAAC;EAK9CI,WAAW,CAAQC,MAA0B,EAAE;IAC7C,MAAMC,cAAc,GAAG;MACrBC,IAAI,EAAEF,MAAM,CAACE,IAAI;MACjBC,OAAO,EAAEH,MAAM,CAACI,aAAa,EAAE;MAC/BC,WAAW,EAAEL,MAAM,CAACI,aAAa,EAAE;MACnCE,iBAAiB,EAAEN,MAAM,CAACM,iBAAiB;MAC3CC,YAAY,EAAEP,MAAM,CAACI,aAAa,EAAE;MACpCI,MAAM,EAAER,MAAM,CAACQ,MAAM;MACrBC,UAAU,EAAET,MAAM,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