@wavemaker/app-rn-runtime 11.4.0-next.25501 → 11.4.0-next.26251
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/actions/notification-action.js +5 -4
- app-rn-runtime/actions/notification-action.js.map +1 -1
- app-rn-runtime/components/container/tabs/tabpane/tabpane.component.js +4 -1
- app-rn-runtime/components/container/tabs/tabpane/tabpane.component.js.map +1 -1
- app-rn-runtime/components/container/tabs/tabs.component.js +25 -10
- app-rn-runtime/components/container/tabs/tabs.component.js.map +1 -1
- app-rn-runtime/components/data/form/form.component.js +1 -1
- app-rn-runtime/components/data/form/form.component.js.map +1 -1
- app-rn-runtime/components/data/list/list.component.js +16 -4
- app-rn-runtime/components/data/list/list.component.js.map +1 -1
- app-rn-runtime/components/device/barcodescanner/barcodescanner.component.js +2 -1
- app-rn-runtime/components/device/barcodescanner/barcodescanner.component.js.map +1 -1
- app-rn-runtime/components/device/camera/camera.component.js +6 -4
- app-rn-runtime/components/device/camera/camera.component.js.map +1 -1
- app-rn-runtime/components/device/camera/camera.props.js +0 -1
- app-rn-runtime/components/device/camera/camera.props.js.map +1 -1
- app-rn-runtime/components/input/baseinput/baseinput.component.js +7 -0
- app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
- app-rn-runtime/components/page/partial-container/partial-container.styles.js +2 -1
- app-rn-runtime/components/page/partial-container/partial-container.styles.js.map +1 -1
- app-rn-runtime/core/injector.js +15 -1
- app-rn-runtime/core/injector.js.map +1 -1
- app-rn-runtime/core/tappable.component.js +9 -2
- app-rn-runtime/core/tappable.component.js.map +1 -1
- app-rn-runtime/core/utils.js +6 -0
- app-rn-runtime/core/utils.js.map +1 -1
- app-rn-runtime/package.json +5 -5
- app-rn-runtime/runtime/App.js +13 -14
- app-rn-runtime/runtime/App.js.map +1 -1
- app-rn-runtime/runtime/App.navigator.js +2 -12
- app-rn-runtime/runtime/App.navigator.js.map +1 -1
- app-rn-runtime/runtime/services/device/camera-service.js +28 -6
- app-rn-runtime/runtime/services/device/camera-service.js.map +1 -1
- app-rn-runtime/runtime/services/device/scan-service.js +15 -14
- app-rn-runtime/runtime/services/device/scan-service.js.map +1 -1
- app-rn-runtime/variables/device/camera/capture-image.operation.js.map +1 -1
- app-rn-runtime/variables/device/camera/capture-video.operation.js.map +1 -1
- app-rn-runtime/variables/device/file/upload-file.operation.js +43 -21
- app-rn-runtime/variables/device/file/upload-file.operation.js.map +1 -1
- app-rn-runtime/variables/service-variable.js +12 -7
- app-rn-runtime/variables/service-variable.js.map +1 -1
|
@@ -13,6 +13,7 @@ export default class WmCamera extends BaseComponent {
|
|
|
13
13
|
constructor(props) {
|
|
14
14
|
super(props, DEFAULT_CLASS, new WmCameraProps());
|
|
15
15
|
_defineProperty(this, "camera", null);
|
|
16
|
+
_defineProperty(this, "localFile", '');
|
|
16
17
|
}
|
|
17
18
|
onCameraTap() {
|
|
18
19
|
const props = this.state.props;
|
|
@@ -25,22 +26,23 @@ export default class WmCamera extends BaseComponent {
|
|
|
25
26
|
imageTargetHeight: props.imagetargetheight
|
|
26
27
|
};
|
|
27
28
|
this.camera.captureImage(params).then(res => {
|
|
28
|
-
this.updateModel(null, res.imagePath);
|
|
29
|
+
this.updateModel(null, res.imagePath, res.content);
|
|
29
30
|
});
|
|
30
31
|
} else {
|
|
31
32
|
this.camera.captureVideo().then(res => {
|
|
32
|
-
this.updateModel(null, res.videoPath);
|
|
33
|
+
this.updateModel(null, res.videoPath, res.content);
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
updateModel($event, value) {
|
|
37
|
+
updateModel($event, value, content) {
|
|
37
38
|
value = (value.startsWith('file://') ? '' : 'file://') + value;
|
|
39
|
+
this.localFile = content;
|
|
38
40
|
this.updateState({
|
|
39
41
|
props: {
|
|
40
42
|
datavalue: value,
|
|
41
43
|
localFilePath: value
|
|
42
44
|
}
|
|
43
|
-
}, this.invokeEventCallback.bind(this, 'onSuccess', [null, this.proxy, value]));
|
|
45
|
+
}, this.invokeEventCallback.bind(this, 'onSuccess', [null, this.proxy, value, this.localFile]));
|
|
44
46
|
}
|
|
45
47
|
renderWidget(props) {
|
|
46
48
|
return /*#__PURE__*/React.createElement(CameraConsumer, null, cameraService => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","BaseComponent","BaseComponentState","WmCameraProps","DEFAULT_CLASS","WmButton","CameraConsumer","WmCameraState","WmCamera","constructor","props","onCameraTap","state","capturetype","params","allowImageEdit","allowedit","imageQuality","imagequality","imageEncodingType","imageencodingtype","imageTargetWidth","imagetargetwidth","imageTargetHeight","imagetargetheight","camera","captureImage","then","res","updateModel","imagePath","captureVideo","videoPath","$event","value","startsWith","updateState","datavalue","localFilePath","invokeEventCallback","bind","proxy","renderWidget","cameraService","styles","root","iconclass","button","iconsize"],"sources":["camera.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\n\nimport WmCameraProps from './camera.props';\nimport { DEFAULT_CLASS, WmCameraStyles } from './camera.styles';\nimport WmButton from '@wavemaker/app-rn-runtime/components/basic/button/button.component';\nimport { CaptureImageOutput } from '@wavemaker/app-rn-runtime/variables/device/camera/capture-image.operation';\nimport { CameraConsumer, CameraInput, CameraService } from \"@wavemaker/app-rn-runtime/core/device/camera-service\";\nimport { CaptureVideoOutput } from '@wavemaker/app-rn-runtime/variables/device/camera/capture-video.operation';\n\n\nexport class WmCameraState extends BaseComponentState<WmCameraProps> {}\n\nexport default class WmCamera extends BaseComponent<WmCameraProps, WmCameraState, WmCameraStyles> {\n private camera: CameraService = null as any;\n constructor(props: WmCameraProps) {\n super(props, DEFAULT_CLASS, new WmCameraProps());\n }\n\n onCameraTap() {\n const props = this.state.props;\n if (props.capturetype === 'IMAGE') {\n const params: CameraInput = {\n allowImageEdit: props.allowedit,\n imageQuality: props.imagequality,\n imageEncodingType: props.imageencodingtype,\n imageTargetWidth: props.imagetargetwidth,\n imageTargetHeight: props.imagetargetheight\n };\n\n this.camera.captureImage(params).then((res: CaptureImageOutput) => {\n this.updateModel(null, res.imagePath);\n });\n } else {\n this.camera.captureVideo().then((res: CaptureVideoOutput) => {\n this.updateModel(null, res.videoPath);\n });\n }\n\n }\n\n private updateModel($event: any, value: any) {\n value = (value.startsWith('file://') ? '' : 'file://') + value;\n this.updateState({\n props: {\n datavalue: value,\n localFilePath: value\n }\n } as WmCameraState, this.invokeEventCallback.bind(this, 'onSuccess', [null, this.proxy, value]));\n }\n\n renderWidget(props: WmCameraProps) {\n return (\n <CameraConsumer>\n {(cameraService: CameraService) => {\n this.camera = cameraService;\n return <View style={this.styles.root}>\n <WmButton iconclass={props.iconclass} styles={this.styles.button} iconsize={props.iconsize} onTap={this.onCameraTap.bind(this)}></WmButton>\n </View>\n }}\n </CameraConsumer>\n );\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,OAAOC,aAAa,MAAM,gBAAgB;AAC1C,SAASC,aAAa,QAAwB,iBAAiB;AAC/D,OAAOC,QAAQ,MAAM,oEAAoE;AAEzF,SAASC,cAAc,QAAoC,sDAAsD;AAIjH,OAAO,MAAMC,aAAa,SAASL,kBAAkB,CAAgB;AAErE,eAAe,MAAMM,QAAQ,SAASP,aAAa,CAA+C;
|
|
1
|
+
{"version":3,"names":["React","View","BaseComponent","BaseComponentState","WmCameraProps","DEFAULT_CLASS","WmButton","CameraConsumer","WmCameraState","WmCamera","constructor","props","onCameraTap","state","capturetype","params","allowImageEdit","allowedit","imageQuality","imagequality","imageEncodingType","imageencodingtype","imageTargetWidth","imagetargetwidth","imageTargetHeight","imagetargetheight","camera","captureImage","then","res","updateModel","imagePath","content","captureVideo","videoPath","$event","value","startsWith","localFile","updateState","datavalue","localFilePath","invokeEventCallback","bind","proxy","renderWidget","cameraService","styles","root","iconclass","button","iconsize"],"sources":["camera.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\n\nimport WmCameraProps from './camera.props';\nimport { DEFAULT_CLASS, WmCameraStyles } from './camera.styles';\nimport WmButton from '@wavemaker/app-rn-runtime/components/basic/button/button.component';\nimport { CaptureImageOutput } from '@wavemaker/app-rn-runtime/variables/device/camera/capture-image.operation';\nimport { CameraConsumer, CameraInput, CameraService } from \"@wavemaker/app-rn-runtime/core/device/camera-service\";\nimport { CaptureVideoOutput } from '@wavemaker/app-rn-runtime/variables/device/camera/capture-video.operation';\n\n\nexport class WmCameraState extends BaseComponentState<WmCameraProps> {}\n\nexport default class WmCamera extends BaseComponent<WmCameraProps, WmCameraState, WmCameraStyles> {\n private camera: CameraService = null as any;\n public localFile: string = '';\n constructor(props: WmCameraProps) {\n super(props, DEFAULT_CLASS, new WmCameraProps());\n }\n\n onCameraTap() {\n const props = this.state.props;\n if (props.capturetype === 'IMAGE') {\n const params: CameraInput = {\n allowImageEdit: props.allowedit,\n imageQuality: props.imagequality,\n imageEncodingType: props.imageencodingtype,\n imageTargetWidth: props.imagetargetwidth,\n imageTargetHeight: props.imagetargetheight\n };\n\n this.camera.captureImage(params).then((res: CaptureImageOutput) => {\n this.updateModel(null, res.imagePath, res.content);\n });\n } else {\n this.camera.captureVideo().then((res: CaptureVideoOutput) => {\n this.updateModel(null, res.videoPath, res.content);\n });\n }\n\n }\n\n private updateModel($event: any, value: any, content: string) {\n value = (value.startsWith('file://') ? '' : 'file://') + value;\n this.localFile = content;\n this.updateState({\n props: {\n datavalue: value,\n localFilePath: value\n }\n } as WmCameraState, this.invokeEventCallback.bind(this, 'onSuccess', [null, this.proxy, value, this.localFile]));\n }\n\n renderWidget(props: WmCameraProps) {\n return (\n <CameraConsumer>\n {(cameraService: CameraService) => {\n this.camera = cameraService;\n return <View style={this.styles.root}>\n <WmButton iconclass={props.iconclass} styles={this.styles.button} iconsize={props.iconsize} onTap={this.onCameraTap.bind(this)}></WmButton>\n </View>\n }}\n </CameraConsumer>\n );\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,OAAOC,aAAa,MAAM,gBAAgB;AAC1C,SAASC,aAAa,QAAwB,iBAAiB;AAC/D,OAAOC,QAAQ,MAAM,oEAAoE;AAEzF,SAASC,cAAc,QAAoC,sDAAsD;AAIjH,OAAO,MAAMC,aAAa,SAASL,kBAAkB,CAAgB;AAErE,eAAe,MAAMM,QAAQ,SAASP,aAAa,CAA+C;EAGhGQ,WAAW,CAACC,KAAoB,EAAE;IAChC,KAAK,CAACA,KAAK,EAAEN,aAAa,EAAE,IAAID,aAAa,EAAE,CAAC;IAAC,gCAHnB,IAAI;IAAA,mCACT,EAAE;EAG7B;EAEAQ,WAAW,GAAG;IACZ,MAAMD,KAAK,GAAG,IAAI,CAACE,KAAK,CAACF,KAAK;IAC9B,IAAIA,KAAK,CAACG,WAAW,KAAK,OAAO,EAAE;MACjC,MAAMC,MAAmB,GAAG;QAC1BC,cAAc,EAAEL,KAAK,CAACM,SAAS;QAC/BC,YAAY,EAAEP,KAAK,CAACQ,YAAY;QAChCC,iBAAiB,EAAET,KAAK,CAACU,iBAAiB;QAC1CC,gBAAgB,EAAEX,KAAK,CAACY,gBAAgB;QACxCC,iBAAiB,EAAEb,KAAK,CAACc;MAC3B,CAAC;MAED,IAAI,CAACC,MAAM,CAACC,YAAY,CAACZ,MAAM,CAAC,CAACa,IAAI,CAAEC,GAAuB,IAAK;QACjE,IAAI,CAACC,WAAW,CAAC,IAAI,EAAED,GAAG,CAACE,SAAS,EAAEF,GAAG,CAACG,OAAO,CAAC;MACpD,CAAC,CAAC;IACJ,CAAC,MAAM;MACL,IAAI,CAACN,MAAM,CAACO,YAAY,EAAE,CAACL,IAAI,CAAEC,GAAuB,IAAK;QAC3D,IAAI,CAACC,WAAW,CAAC,IAAI,EAAED,GAAG,CAACK,SAAS,EAAEL,GAAG,CAACG,OAAO,CAAC;MACpD,CAAC,CAAC;IACJ;EAEF;EAEQF,WAAW,CAACK,MAAW,EAAEC,KAAU,EAAEJ,OAAe,EAAE;IAC5DI,KAAK,GAAG,CAACA,KAAK,CAACC,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,SAAS,IAAID,KAAK;IAC9D,IAAI,CAACE,SAAS,GAAGN,OAAO;IACxB,IAAI,CAACO,WAAW,CAAC;MACf5B,KAAK,EAAE;QACL6B,SAAS,EAAEJ,KAAK;QAChBK,aAAa,EAAEL;MACjB;IACF,CAAC,EAAmB,IAAI,CAACM,mBAAmB,CAACC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,CAACC,KAAK,EAAER,KAAK,EAAE,IAAI,CAACE,SAAS,CAAC,CAAC,CAAC;EAClH;EAEAO,YAAY,CAAClC,KAAoB,EAAE;IACjC,oBACM,oBAAC,cAAc,QACTmC,aAA4B,IAAK;MACnC,IAAI,CAACpB,MAAM,GAAGoB,aAAa;MAC3B,oBAAO,oBAAC,IAAI;QAAC,KAAK,EAAE,IAAI,CAACC,MAAM,CAACC;MAAK,gBACnC,oBAAC,QAAQ;QAAC,SAAS,EAAErC,KAAK,CAACsC,SAAU;QAAC,MAAM,EAAE,IAAI,CAACF,MAAM,CAACG,MAAO;QAAC,QAAQ,EAAEvC,KAAK,CAACwC,QAAS;QAAC,KAAK,EAAE,IAAI,CAACvC,WAAW,CAAC+B,IAAI,CAAC,IAAI;MAAE,EAAY,CACtI;IACT,CAAC,CACc;EAEzB;AACF"}
|
|
@@ -14,7 +14,6 @@ export default class WmCameraProps extends BaseProps {
|
|
|
14
14
|
_defineProperty(this, "imagetargetwidth", null);
|
|
15
15
|
_defineProperty(this, "imagetargetheight", null);
|
|
16
16
|
_defineProperty(this, "datavalue", void 0);
|
|
17
|
-
_defineProperty(this, "localFile", '');
|
|
18
17
|
_defineProperty(this, "localFilePath", '');
|
|
19
18
|
}
|
|
20
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseProps","WmCameraProps"],"sources":["camera.props.ts"],"sourcesContent":["import { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class WmCameraProps extends BaseProps {\n allowedit: boolean = false;\n capturetype: string = 'IMAGE';\n iconclass: string = 'wm-sl-l sl-camera';\n iconsize: number = 16;\n imagequality: number = 80;\n imageencodingtype: string = 'JPEG';\n imagetargetwidth: number = null as any;\n imagetargetheight: number = null as any;\n datavalue: any;\n
|
|
1
|
+
{"version":3,"names":["BaseProps","WmCameraProps"],"sources":["camera.props.ts"],"sourcesContent":["import { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class WmCameraProps extends BaseProps {\n allowedit: boolean = false;\n capturetype: string = 'IMAGE';\n iconclass: string = 'wm-sl-l sl-camera';\n iconsize: number = 16;\n imagequality: number = 80;\n imageencodingtype: string = 'JPEG';\n imagetargetwidth: number = null as any;\n imagetargetheight: number = null as any;\n datavalue: any;\n localFilePath: string = '';\n}\n"],"mappings":";;;AAAA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,aAAa,SAASD,SAAS,CAAC;EAAA;IAAA;IAAA,mCAC9B,KAAK;IAAA,qCACJ,OAAO;IAAA,mCACT,mBAAmB;IAAA,kCACpB,EAAE;IAAA,sCACE,EAAE;IAAA,2CACG,MAAM;IAAA,0CACP,IAAI;IAAA,2CACH,IAAI;IAAA;IAAA,uCAER,EAAE;EAAA;AAC5B"}
|
|
@@ -6,6 +6,7 @@ import { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/cor
|
|
|
6
6
|
import { isString } from 'lodash';
|
|
7
7
|
import { Platform } from 'react-native';
|
|
8
8
|
import { validateField } from '@wavemaker/app-rn-runtime/core/utils';
|
|
9
|
+
import Injector from '@wavemaker/app-rn-runtime/core/injector';
|
|
9
10
|
export class BaseInputState extends BaseComponentState {
|
|
10
11
|
constructor() {
|
|
11
12
|
super(...arguments);
|
|
@@ -31,6 +32,10 @@ export class BaseInputComponent extends BaseComponent {
|
|
|
31
32
|
var _this$widgetRef;
|
|
32
33
|
this === null || this === void 0 ? void 0 : (_this$widgetRef = this.widgetRef) === null || _this$widgetRef === void 0 ? void 0 : _this$widgetRef.focus();
|
|
33
34
|
}
|
|
35
|
+
blur() {
|
|
36
|
+
var _this$widgetRef2, _this$widgetRef3;
|
|
37
|
+
(this === null || this === void 0 ? void 0 : (_this$widgetRef2 = this.widgetRef) === null || _this$widgetRef2 === void 0 ? void 0 : _this$widgetRef2.blur) && (this === null || this === void 0 ? void 0 : (_this$widgetRef3 = this.widgetRef) === null || _this$widgetRef3 === void 0 ? void 0 : _this$widgetRef3.blur());
|
|
38
|
+
}
|
|
34
39
|
onPropertyChange(name, $new, $old) {
|
|
35
40
|
switch (name) {
|
|
36
41
|
case 'type':
|
|
@@ -106,6 +111,7 @@ export class BaseInputComponent extends BaseComponent {
|
|
|
106
111
|
});
|
|
107
112
|
}
|
|
108
113
|
onBlur(event) {
|
|
114
|
+
Injector.FOCUSED_ELEMENT.remove();
|
|
109
115
|
this.isTouched = true;
|
|
110
116
|
let newVal = event.target.value || this.state.textValue;
|
|
111
117
|
let oldVal = this.state.props.datavalue || '';
|
|
@@ -131,6 +137,7 @@ export class BaseInputComponent extends BaseComponent {
|
|
|
131
137
|
});
|
|
132
138
|
}
|
|
133
139
|
onFocus(event) {
|
|
140
|
+
Injector.FOCUSED_ELEMENT.set(this);
|
|
134
141
|
this.invokeEventCallback('onFocus', [event, this.proxy]);
|
|
135
142
|
}
|
|
136
143
|
onKeyPress(event) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DEFAULT_CLASS","BaseComponent","BaseComponentState","isString","Platform","validateField","BaseInputState","BaseInputComponent","constructor","props","defaultClass","defaultProps","defaultState","focus","widgetRef","onPropertyChange","name","$new","$old","keyboardType","type","updateState","textValue","isDefault","state","onFieldChange","bind","onChange","event","updateon","updateDatavalue","target","value","onChangeText","validate","invokeChange","e","OS","cursor","selectionStart","setState","source","oldValue","datavalue","autotrim","trim","invokeEventCallback","proxy","onBlur","isTouched","newVal","oldVal","setTimeout","triggerValidation","validationObj","isValid","errorType","onFocus","onKeyPress"],"sources":["baseinput.component.ts"],"sourcesContent":["import { DEFAULT_CLASS } from \"@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles\";\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport BaseInputProps from './baseinput.props';\nimport { isString } from 'lodash';\nimport { BaseInputStyles } from './baseinput.styles';\nimport { Platform, TextInput } from 'react-native';\nimport { validateField } from '@wavemaker/app-rn-runtime/core/utils';\n\nexport class BaseInputState <T extends BaseInputProps> extends BaseComponentState<T> {\n keyboardType: any = 'default';\n isValid: boolean = true;\n textValue: string = '';\n isDefault = false;\n errorType: string = '';\n}\nexport abstract class BaseInputComponent< T extends BaseInputProps, S extends BaseInputState<T>, L extends BaseInputStyles> extends BaseComponent<T, S, L> {\n public widgetRef: TextInput | null = null;\n isTouched: boolean = false;\n private cursor: any = 0;\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n }\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'type':\n let keyboardType;\n if (this.props.type === 'number') {\n keyboardType = 'numeric';\n } else if (this.props.type === 'tel') {\n keyboardType = 'phone-pad';\n } else if (this.props.type === 'email') {\n keyboardType = 'email-address';\n }\n this.updateState({\n keyboardType: keyboardType,\n } as S);\n break;\n case 'datavalue':\n this.updateState({\n textValue: $new\n } as S\n );\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n }\n }\n\n onChange(event: any) {\n if (this.state.props.updateon === 'default') {\n this.updateDatavalue(event.target.value, event);\n }\n }\n\n onChangeText(value: any) {\n this.updateState({\n textValue: value\n } as S, () => {\n if (this.state.props.updateon === 'default') {\n this.validate(value);\n this.updateDatavalue(value, null);\n }\n }\n );\n }\n\n invokeChange(e: any) {\n if (Platform.OS === 'web') {\n this.cursor = e.target.selectionStart;\n this.setState({ textValue: e.target.value });\n }\n }\n\n updateDatavalue(value: any, event?: any, source?: any) {\n const props = this.state.props;\n const oldValue = props.datavalue;\n if (value === oldValue) {\n return;\n }\n\n // autotrim\n if (props.autotrim && props.datavalue && isString(props.datavalue)) {\n value = value.trim();\n }\n\n this.updateState({\n props: {\n datavalue: value\n }\n } as S, () => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, value, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [ event, this.proxy]);\n }\n })\n\n }\n\n onBlur(event: any) {\n this.isTouched = true;\n let newVal = event.target.value || this.state.textValue;\n let oldVal = this.state.props.datavalue || '';\n this.validate(newVal);\n if (newVal === '') {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n })\n }\n if (this.state.props.updateon === 'blur') {\n if (oldVal !== newVal) {\n this.updateDatavalue(newVal, event, 'blur');\n } else {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n }\n\n onFocus(event: any) {\n this.invokeEventCallback('onFocus', [ event, this.proxy]);\n }\n\n onKeyPress(event: any) {\n this.invokeEventCallback('onKeypress', [ event, this.proxy]);\n }\n}\n"],"mappings":";;;AAAA,SAASA,aAAa,QAAQ,wEAAwE;AACtG,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,SAASC,QAAQ,QAAQ,QAAQ;AAEjC,SAASC,QAAQ,QAAmB,cAAc;AAClD,SAASC,aAAa,QAAQ,sCAAsC;
|
|
1
|
+
{"version":3,"names":["DEFAULT_CLASS","BaseComponent","BaseComponentState","isString","Platform","validateField","Injector","BaseInputState","BaseInputComponent","constructor","props","defaultClass","defaultProps","defaultState","focus","widgetRef","blur","onPropertyChange","name","$new","$old","keyboardType","type","updateState","textValue","isDefault","state","onFieldChange","bind","onChange","event","updateon","updateDatavalue","target","value","onChangeText","validate","invokeChange","e","OS","cursor","selectionStart","setState","source","oldValue","datavalue","autotrim","trim","invokeEventCallback","proxy","onBlur","FOCUSED_ELEMENT","remove","isTouched","newVal","oldVal","setTimeout","triggerValidation","validationObj","isValid","errorType","onFocus","set","onKeyPress"],"sources":["baseinput.component.ts"],"sourcesContent":["import { DEFAULT_CLASS } from \"@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles\";\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport BaseInputProps from './baseinput.props';\nimport { isString } from 'lodash';\nimport { BaseInputStyles } from './baseinput.styles';\nimport { Platform, TextInput } from 'react-native';\nimport { validateField } from '@wavemaker/app-rn-runtime/core/utils';\nimport Injector from '@wavemaker/app-rn-runtime/core/injector';\n\nexport class BaseInputState <T extends BaseInputProps> extends BaseComponentState<T> {\n keyboardType: any = 'default';\n isValid: boolean = true;\n textValue: string = '';\n isDefault = false;\n errorType: string = '';\n}\nexport abstract class BaseInputComponent< T extends BaseInputProps, S extends BaseInputState<T>, L extends BaseInputStyles> extends BaseComponent<T, S, L> {\n public widgetRef: TextInput | null = null;\n isTouched: boolean = false;\n private cursor: any = 0;\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n }\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n blur() {\n this?.widgetRef?.blur && this?.widgetRef?.blur();\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'type':\n let keyboardType;\n if (this.props.type === 'number') {\n keyboardType = 'numeric';\n } else if (this.props.type === 'tel') {\n keyboardType = 'phone-pad';\n } else if (this.props.type === 'email') {\n keyboardType = 'email-address';\n }\n this.updateState({\n keyboardType: keyboardType,\n } as S);\n break;\n case 'datavalue':\n this.updateState({\n textValue: $new\n } as S\n );\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n }\n }\n\n onChange(event: any) {\n if (this.state.props.updateon === 'default') {\n this.updateDatavalue(event.target.value, event);\n }\n }\n\n onChangeText(value: any) {\n this.updateState({\n textValue: value\n } as S, () => {\n if (this.state.props.updateon === 'default') {\n this.validate(value);\n this.updateDatavalue(value, null);\n }\n }\n );\n }\n\n invokeChange(e: any) {\n if (Platform.OS === 'web') {\n this.cursor = e.target.selectionStart;\n this.setState({ textValue: e.target.value });\n }\n }\n\n updateDatavalue(value: any, event?: any, source?: any) {\n const props = this.state.props;\n const oldValue = props.datavalue;\n if (value === oldValue) {\n return;\n }\n\n // autotrim\n if (props.autotrim && props.datavalue && isString(props.datavalue)) {\n value = value.trim();\n }\n\n this.updateState({\n props: {\n datavalue: value\n }\n } as S, () => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, value, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [ event, this.proxy]);\n }\n })\n\n }\n\n onBlur(event: any) {\n Injector.FOCUSED_ELEMENT.remove();\n this.isTouched = true;\n let newVal = event.target.value || this.state.textValue;\n let oldVal = this.state.props.datavalue || '';\n this.validate(newVal);\n if (newVal === '') {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n })\n }\n if (this.state.props.updateon === 'blur') {\n if (oldVal !== newVal) {\n this.updateDatavalue(newVal, event, 'blur');\n } else {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n }\n\n onFocus(event: any) {\n Injector.FOCUSED_ELEMENT.set(this);\n this.invokeEventCallback('onFocus', [ event, this.proxy]);\n }\n\n onKeyPress(event: any) {\n this.invokeEventCallback('onKeypress', [ event, this.proxy]);\n }\n}\n"],"mappings":";;;AAAA,SAASA,aAAa,QAAQ,wEAAwE;AACtG,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,SAASC,QAAQ,QAAQ,QAAQ;AAEjC,SAASC,QAAQ,QAAmB,cAAc;AAClD,SAASC,aAAa,QAAQ,sCAAsC;AACpE,OAAOC,QAAQ,MAAM,yCAAyC;AAE9D,OAAO,MAAMC,cAAc,SAAoCL,kBAAkB,CAAI;EAAA;IAAA;IAAA,sCAC/D,SAAS;IAAA,iCACV,IAAI;IAAA,mCACH,EAAE;IAAA,mCACV,KAAK;IAAA,mCACG,EAAE;EAAA;AACxB;AACA,OAAO,MAAeM,kBAAkB,SAA4FP,aAAa,CAAU;EAIzJQ,WAAW,CAACC,KAAQ,EAAmF;IAAA,IAA1EC,YAAoB,uEAAGX,aAAa;IAAA,IAAEY,YAAgB;IAAA,IAAEC,YAAgB;IACnG,KAAK,CAACH,KAAK,EAAEC,YAAY,EAAEC,YAAY,EAAEC,YAAY,CAAC;IAAC,KAD5BF,YAAoB,GAApBA,YAAoB;IAAA,mCAHZ,IAAI;IAAA,mCACpB,KAAK;IAAA,gCACJ,CAAC;EAGvB;EAEAG,KAAK,GAAG;IAAA;IACN,IAAI,aAAJ,IAAI,0CAAJ,IAAI,CAAEC,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ACF;EAEAb,QAAQ,CAACF,KAAU,EAAE;IACnB,MAAMwB,aAAa,GAAGrD,aAAa,CAAC,IAAI,CAACqB,KAAK,CAAChB,KAAK,EAAEwB,KAAK,CAAC;IAC5D,IAAI,CAACX,WAAW,CAAC;MACfoC,OAAO,EAAED,aAAa,CAACC,OAAO;MAC9BC,SAAS,EAAEF,aAAa,CAACE;IAC3B,CAAC,CAAM;EACT;EAEAC,OAAO,CAAC/B,KAAU,EAAE;IAClBxB,QAAQ,CAAC6C,eAAe,CAACW,GAAG,CAAC,IAAI,CAAC;IAClC,IAAI,CAACd,mBAAmB,CAAC,SAAS,EAAE,CAAElB,KAAK,EAAE,IAAI,CAACmB,KAAK,CAAC,CAAC;EAC3D;EAEAc,UAAU,CAACjC,KAAU,EAAE;IACrB,IAAI,CAACkB,mBAAmB,CAAC,YAAY,EAAE,CAAElB,KAAK,EAAE,IAAI,CAACmB,KAAK,CAAC,CAAC;EAC9D;AACF"}
|
|
@@ -4,7 +4,8 @@ export const DEFAULT_CLASS = 'app-partial-container';
|
|
|
4
4
|
BASE_THEME.registerStyle((themeVariables, addStyle) => {
|
|
5
5
|
const defaultStyles = defineStyles({
|
|
6
6
|
root: {
|
|
7
|
-
width: '100%'
|
|
7
|
+
width: '100%',
|
|
8
|
+
backgroundColor: themeVariables.pageContentBgColor
|
|
8
9
|
},
|
|
9
10
|
text: {}
|
|
10
11
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","width","text"],"sources":["partial-container.styles.ts"],"sourcesContent":["import BASE_THEME from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport type WmPartialContainerStyles = BaseStyles & {};\n\nexport const DEFAULT_CLASS = 'app-partial-container';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: WmPartialContainerStyles = defineStyles({\n root: {\n width: '100%'\n },\n text: {}\n });\n\n addStyle(DEFAULT_CLASS, '', defaultStyles);\n});"],"mappings":"AAAA,OAAOA,UAAU,MAAM,wCAAwC;AAC/D,SAAqBC,YAAY,QAAQ,+CAA+C;AAIxF,OAAO,MAAMC,aAAa,GAAG,uBAAuB;AACpDF,UAAU,CAACG,aAAa,CAAC,CAACC,cAAc,EAAEC,QAAQ,KAAK;EACnD,MAAMC,aAAuC,GAAGL,YAAY,CAAC;IACzDM,IAAI,EAAE;MACFC,KAAK,EAAE;
|
|
1
|
+
{"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","width","backgroundColor","pageContentBgColor","text"],"sources":["partial-container.styles.ts"],"sourcesContent":["import BASE_THEME from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport type WmPartialContainerStyles = BaseStyles & {};\n\nexport const DEFAULT_CLASS = 'app-partial-container';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: WmPartialContainerStyles = defineStyles({\n root: {\n width: '100%',\n backgroundColor: themeVariables.pageContentBgColor\n },\n text: {}\n });\n\n addStyle(DEFAULT_CLASS, '', defaultStyles);\n});"],"mappings":"AAAA,OAAOA,UAAU,MAAM,wCAAwC;AAC/D,SAAqBC,YAAY,QAAQ,+CAA+C;AAIxF,OAAO,MAAMC,aAAa,GAAG,uBAAuB;AACpDF,UAAU,CAACG,aAAa,CAAC,CAACC,cAAc,EAAEC,QAAQ,KAAK;EACnD,MAAMC,aAAuC,GAAGL,YAAY,CAAC;IACzDM,IAAI,EAAE;MACFC,KAAK,EAAE,MAAM;MACbC,eAAe,EAAEL,cAAc,CAACM;IACpC,CAAC;IACDC,IAAI,EAAE,CAAC;EACX,CAAC,CAAC;EAEFN,QAAQ,CAACH,aAAa,EAAE,EAAE,EAAEI,aAAa,CAAC;AAC9C,CAAC,CAAC"}
|
app-rn-runtime/core/injector.js
CHANGED
|
@@ -5,8 +5,22 @@ const get = t => {
|
|
|
5
5
|
const set = (t, o) => {
|
|
6
6
|
map.set(t, o);
|
|
7
7
|
};
|
|
8
|
+
const remove = t => {
|
|
9
|
+
const v = map.get(t);
|
|
10
|
+
v && map.delete(t);
|
|
11
|
+
return v;
|
|
12
|
+
};
|
|
13
|
+
const getInstance = key => {
|
|
14
|
+
return {
|
|
15
|
+
set: o => set(key, o),
|
|
16
|
+
get: () => get(key),
|
|
17
|
+
remove: () => remove(key)
|
|
18
|
+
};
|
|
19
|
+
};
|
|
8
20
|
export default {
|
|
9
21
|
set: set,
|
|
10
|
-
get: get
|
|
22
|
+
get: get,
|
|
23
|
+
remove: remove,
|
|
24
|
+
FOCUSED_ELEMENT: getInstance('FOCUSED_ELEMENT')
|
|
11
25
|
};
|
|
12
26
|
//# sourceMappingURL=injector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["map","Map","get","t","set","o"],"sources":["injector.ts"],"sourcesContent":["const map = new Map<string, any>();\n\nconst get = <T>(t :string): T => {\n return map.get(t) as T;\n};\n\nconst set = <T>(t :string, o: T) => {\n map.set(t, o);\n};\n\nexport default {\n set: set,\n get: get\n};"],"mappings":"AAAA,MAAMA,GAAG,GAAG,IAAIC,GAAG,EAAe;AAElC,MAAMC,GAAG,GAAOC,CAAS,IAAQ;EAC7B,OAAOH,GAAG,CAACE,GAAG,CAACC,CAAC,CAAC;AACrB,CAAC;AAED,MAAMC,GAAG,GAAG,CAAID,CAAS,EAAEE,CAAI,KAAK;EAChCL,GAAG,CAACI,GAAG,CAACD,CAAC,EAAEE,CAAC,CAAC;AACjB,CAAC;AAED,eAAe;
|
|
1
|
+
{"version":3,"names":["map","Map","get","t","set","o","remove","v","delete","getInstance","key","FOCUSED_ELEMENT"],"sources":["injector.ts"],"sourcesContent":["const map = new Map<string, any>();\n\nconst get = <T>(t :string): T => {\n return map.get(t) as T;\n};\n\nconst set = <T>(t :string, o: T) => {\n map.set(t, o);\n};\n\nconst remove = <T>(t :string): T => {\n const v = map.get(t) as T;\n v && map.delete(t);\n return v;\n};\n\nconst getInstance = <T>(key: string) => {\n return {\n set: (o: T) => set(key, o),\n get: () => get(key) as T,\n remove: () => remove(key) as T\n }\n};\nexport default {\n set: set,\n get: get,\n remove: remove,\n FOCUSED_ELEMENT: getInstance<any>('FOCUSED_ELEMENT')\n};"],"mappings":"AAAA,MAAMA,GAAG,GAAG,IAAIC,GAAG,EAAe;AAElC,MAAMC,GAAG,GAAOC,CAAS,IAAQ;EAC7B,OAAOH,GAAG,CAACE,GAAG,CAACC,CAAC,CAAC;AACrB,CAAC;AAED,MAAMC,GAAG,GAAG,CAAID,CAAS,EAAEE,CAAI,KAAK;EAChCL,GAAG,CAACI,GAAG,CAACD,CAAC,EAAEE,CAAC,CAAC;AACjB,CAAC;AAED,MAAMC,MAAM,GAAQH,CAAS,IAAQ;EACjC,MAAMI,CAAC,GAAGP,GAAG,CAACE,GAAG,CAACC,CAAC,CAAM;EACzBI,CAAC,IAAIP,GAAG,CAACQ,MAAM,CAACL,CAAC,CAAC;EAClB,OAAOI,CAAC;AACZ,CAAC;AAED,MAAME,WAAW,GAAOC,GAAW,IAAK;EACpC,OAAO;IACHN,GAAG,EAAGC,CAAI,IAAKD,GAAG,CAACM,GAAG,EAAEL,CAAC,CAAC;IAC1BH,GAAG,EAAE,MAAMA,GAAG,CAACQ,GAAG,CAAM;IACxBJ,MAAM,EAAE,MAAMA,MAAM,CAACI,GAAG;EAC5B,CAAC;AACL,CAAC;AACD,eAAe;EACXN,GAAG,EAAEA,GAAG;EACRF,GAAG,EAAEA,GAAG;EACRI,MAAM,EAAEA,MAAM;EACdK,eAAe,EAAEF,WAAW,CAAM,iBAAiB;AACvD,CAAC"}
|
|
@@ -5,6 +5,7 @@ import React from "react";
|
|
|
5
5
|
import { View } from "react-native";
|
|
6
6
|
import { TouchableOpacity } from "react-native";
|
|
7
7
|
import { get } from "lodash";
|
|
8
|
+
import injector from "./injector";
|
|
8
9
|
export class TapEvent {
|
|
9
10
|
constructor() {
|
|
10
11
|
_defineProperty(this, "propagationEnabled", true);
|
|
@@ -30,12 +31,18 @@ export class Tappable extends React.Component {
|
|
|
30
31
|
}
|
|
31
32
|
const syntheticEvent = Tappable.CURRENT_EVENT;
|
|
32
33
|
if (syntheticEvent.propagationEnabled) {
|
|
34
|
+
var _injector$FOCUSED_ELE;
|
|
35
|
+
(_injector$FOCUSED_ELE = injector.FOCUSED_ELEMENT.get()) === null || _injector$FOCUSED_ELE === void 0 ? void 0 : _injector$FOCUSED_ELE.blur();
|
|
33
36
|
if (delta < 500) {
|
|
34
37
|
this.props.onDoubleTap && this.props.onDoubleTap(e);
|
|
35
|
-
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
target === null || target === void 0 ? void 0 : target.invokeEventCallback('onDoubletap', [syntheticEvent, target]);
|
|
40
|
+
}, 200);
|
|
36
41
|
}
|
|
37
42
|
this.props.onTap && this.props.onTap(e || syntheticEvent);
|
|
38
|
-
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
target === null || target === void 0 ? void 0 : target.invokeEventCallback('onTap', [syntheticEvent, target]);
|
|
45
|
+
}, 200);
|
|
39
46
|
}
|
|
40
47
|
}
|
|
41
48
|
render() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","TouchableOpacity","get","TapEvent","constructor","stopPropagation","propagationEnabled","Tappable","Component","props","onPress","e","delta","Date","getTime","lastPress","target","CURRENT_EVENT","setTimeout","syntheticEvent","onDoubleTap","invokeEventCallback","onTap","render","onDoubletap","proxy","styles","children"],"sources":["tappable.component.tsx"],"sourcesContent":["import { BaseComponent } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport React from \"react\";\nimport { GestureResponderEvent, View } from \"react-native\";\nimport { TouchableOpacity } from \"react-native\";\nimport { get } from \"lodash\";\n\ninterface TappableProps {\n children?: any\n styles?: any;\n target?: BaseComponent<any, any, any>;\n onTap?: (e: any) => void;\n onDoubleTap?: (e: any) => void;\n}\n\nexport class TapEvent {\n propagationEnabled = true;\n\n constructor() {\n\n }\n\n stopPropagation() {\n this.propagationEnabled = false;\n }\n}\n\nexport class Tappable extends React.Component<TappableProps, any> {\n private lastPress = 0;\n\n static CURRENT_EVENT: TapEvent = null as any;\n\n constructor(props: any) {\n super(props);\n }\n\n onPress(e?: GestureResponderEvent): void {\n const delta = new Date().getTime() - this.lastPress;\n this.lastPress = this.lastPress > 0 ? 0: new Date().getTime();\n const target = this.props.target;\n if (!Tappable.CURRENT_EVENT) {\n Tappable.CURRENT_EVENT = new TapEvent();\n setTimeout(() => {\n Tappable.CURRENT_EVENT = null as any;\n }, 10);\n }\n const syntheticEvent = Tappable.CURRENT_EVENT;\n if (syntheticEvent.propagationEnabled) {\n if(delta < 500) {\n this.props.onDoubleTap && this.props.onDoubleTap(e);\n target?.invokeEventCallback('onDoubletap', [syntheticEvent, target]);\n }\n this.props.onTap && this.props.onTap(e || syntheticEvent);\n target?.invokeEventCallback('onTap', [syntheticEvent, target]);\n }\n }\n\n render() {\n const target = this.props.target;\n if (target?.props.onTap || target?.props.onDoubletap || this.props.onTap || this.props.onDoubleTap) {\n return (\n <TouchableOpacity disabled={get(target?.proxy, 'disabled')}\n style={this.props.styles}\n onPress={() => this.onPress()}>\n {this.props.children}\n </TouchableOpacity>\n );\n }\n return (<View style={this.props.styles}>{this.props.children}</View>);\n }\n}\n"],"mappings":";;;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAgCC,IAAI,QAAQ,cAAc;AAC1D,SAASC,gBAAgB,QAAQ,cAAc;AAC/C,SAASC,GAAG,QAAQ,QAAQ;
|
|
1
|
+
{"version":3,"names":["React","View","TouchableOpacity","get","injector","TapEvent","constructor","stopPropagation","propagationEnabled","Tappable","Component","props","onPress","e","delta","Date","getTime","lastPress","target","CURRENT_EVENT","setTimeout","syntheticEvent","FOCUSED_ELEMENT","blur","onDoubleTap","invokeEventCallback","onTap","render","onDoubletap","proxy","styles","children"],"sources":["tappable.component.tsx"],"sourcesContent":["import { BaseComponent } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport React from \"react\";\nimport { GestureResponderEvent, View } from \"react-native\";\nimport { TouchableOpacity } from \"react-native\";\nimport { get } from \"lodash\";\nimport injector from \"./injector\";\n\ninterface TappableProps {\n children?: any\n styles?: any;\n target?: BaseComponent<any, any, any>;\n onTap?: (e: any) => void;\n onDoubleTap?: (e: any) => void;\n}\n\nexport class TapEvent {\n propagationEnabled = true;\n\n constructor() {\n\n }\n\n stopPropagation() {\n this.propagationEnabled = false;\n }\n}\n\nexport class Tappable extends React.Component<TappableProps, any> {\n private lastPress = 0;\n\n static CURRENT_EVENT: TapEvent = null as any;\n\n constructor(props: any) {\n super(props);\n }\n\n onPress(e?: GestureResponderEvent): void {\n const delta = new Date().getTime() - this.lastPress;\n this.lastPress = this.lastPress > 0 ? 0: new Date().getTime();\n const target = this.props.target;\n if (!Tappable.CURRENT_EVENT) {\n Tappable.CURRENT_EVENT = new TapEvent();\n setTimeout(() => {\n Tappable.CURRENT_EVENT = null as any;\n }, 10);\n }\n const syntheticEvent = Tappable.CURRENT_EVENT;\n if (syntheticEvent.propagationEnabled) {\n injector.FOCUSED_ELEMENT.get()?.blur();\n if(delta < 500) {\n this.props.onDoubleTap && this.props.onDoubleTap(e);\n setTimeout(() => {\n target?.invokeEventCallback('onDoubletap', [syntheticEvent, target]);\n }, 200);\n }\n this.props.onTap && this.props.onTap(e || syntheticEvent);\n setTimeout(() => {\n target?.invokeEventCallback('onTap', [syntheticEvent, target]);\n }, 200);\n }\n }\n\n render() {\n const target = this.props.target;\n if (target?.props.onTap || target?.props.onDoubletap || this.props.onTap || this.props.onDoubleTap) {\n return (\n <TouchableOpacity disabled={get(target?.proxy, 'disabled')}\n style={this.props.styles}\n onPress={() => this.onPress()}>\n {this.props.children}\n </TouchableOpacity>\n );\n }\n return (<View style={this.props.styles}>{this.props.children}</View>);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n-runtime/core/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import moment from "moment";
|
|
3
|
+
import * as FileSystem from "expo-file-system";
|
|
3
4
|
import { isFunction, includes, isUndefined, isNull, orderBy, groupBy, toLower, get, forEach, sortBy, cloneDeep, keys, values, isArray, isString, isNumber } from 'lodash';
|
|
4
5
|
const GROUP_BY_OPTIONS = {
|
|
5
6
|
ALPHABET: 'alphabet',
|
|
@@ -285,4 +286,9 @@ export const validateField = (props, value) => {
|
|
|
285
286
|
isValid: true
|
|
286
287
|
};
|
|
287
288
|
};
|
|
289
|
+
export const toBase64 = function (path) {
|
|
290
|
+
return FileSystem.readAsStringAsync(path, {
|
|
291
|
+
encoding: 'base64'
|
|
292
|
+
});
|
|
293
|
+
};
|
|
288
294
|
//# sourceMappingURL=utils.js.map
|
app-rn-runtime/core/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","moment","isFunction","includes","isUndefined","isNull","orderBy","groupBy","toLower","get","forEach","sortBy","cloneDeep","keys","values","isArray","isString","isNumber","GROUP_BY_OPTIONS","ALPHABET","WORD","OTHERS","TIME_ROLLUP_OPTIONS","HOUR","DAY","WEEK","MONTH","YEAR","_deepCopy","o1","o2","o","Object","k","v","deepCopy","objects","toBoolean","val","undefined","toNumber","parseFloat","e","encodeUrl","url","splits","split","hash","params","length","map","p","encodeURIComponent","join","encodeURI","isWebPreviewMode","OS","isDevMode","__DEV__","widgetsWithUndefinedValue","isAndroid","test","window","navigator","userAgent","isIos","getGroupKey","fieldDef","groupby","widgetScope","innerItem","apply","proxy","getGroupedData","fieldDefs","match","orderby","dateFormat","groupKey","groupedLiData","concatStr","toString","trim","substr","replace","format","getSortedGroupedData","getOrderedDataset","dataSet","items","fields","directions","obj","item","push","_groupedData","groupkey","index","liData","key","data","_groupIndex","isDefined","unStringify","defaultVal","number","parseInt","isNaN","retryIfFails","fn","interval","maxRetries","onBeforeRetry","Promise","resolve","retryCount","tryFn","reject","errorFn","errArgs","arguments","setTimeout","then","retry","getAbortableDefer","_defer","promise","onAbort","isAborted","abort","validateField","props","value","requiredCheck","regexCheck","required","errorType","isValid","regexp","condition","RegExp","maxchars","mindate","Date","datavalue","startOf","toDate","maxdate","endOf"],"sources":["utils.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport moment from \"moment\";\nimport { isFunction, includes, isUndefined, isNull, orderBy, groupBy, toLower, get, forEach, sortBy, cloneDeep, keys, values, isArray, isString, isNumber} from 'lodash';\n\ndeclare const window: any;\nconst GROUP_BY_OPTIONS = {\n ALPHABET: 'alphabet',\n WORD: 'word',\n OTHERS: 'Others'\n};\nconst TIME_ROLLUP_OPTIONS = {\n HOUR: 'hour',\n DAY: 'day',\n WEEK: 'week',\n MONTH: 'month',\n YEAR: 'year'\n};\n\nconst _deepCopy = (o1: any, ...o2: any) => {\n o2.forEach((o: any) => {\n if (o) {\n Object.keys(o).forEach(k => {\n const v = o[k];\n if (v && !isString(v) && !isArray(v) && typeof v === 'object') {\n o1[k] = _deepCopy(o1[k] || {}, o[k]);\n } else {\n o1[k] = _deepCopy(v);\n }\n });\n }\n });\n return o1;\n};\n\nexport const deepCopy = (...objects: any) => _deepCopy({}, ...objects);\n\nexport const toBoolean = (val: any) => {\n return val === true\n || val === 'true'\n || !(val === false\n || val === null\n || val === undefined\n || val === '');\n};\n\nexport const toNumber = (val: any) => {\n try {\n return parseFloat(val) || 0;\n } catch(e) {\n return 0;\n }\n};\n\n/**\n * this method encodes the url and returns the encoded string\n */\n export const encodeUrl = (url: string): string => {\n let splits = url.split('#');\n const hash = splits[1];\n splits = splits[0].split('?');\n let params = '';\n if (splits.length > 1) {\n params = splits[1].split('&')\n .map(p => p.split('='))\n .map(p => p[0] +'=' + encodeURIComponent(p[1]))\n .join('&');\n }\n return encodeURI(splits[0]) + (params ? '?' + params: '') + (hash ? '#'+ hash : '');\n};\n\nexport const isWebPreviewMode = () => Platform.OS === 'web';\n\nexport const isDevMode = () => isWebPreviewMode() || __DEV__;\n\nexport const widgetsWithUndefinedValue = ['checkbox', 'toggle'];\n\nexport const isAndroid = () => (Platform.OS === 'android' || (Platform.OS === 'web' && /android/i.test(window.navigator.userAgent)));\n\nexport const isIos = () => (Platform.OS === 'ios' || (Platform.OS === 'web' && /iPhone|iPad/i.test(window.navigator.userAgent)));\n\nconst getGroupKey = (fieldDef: any, groupby: string, widgetScope: any, innerItem?: any) => isFunction(groupby) ? groupby.apply(widgetScope.proxy, [innerItem ? fieldDef[innerItem] : fieldDef]) : get(innerItem ? fieldDef[innerItem] : fieldDef, groupby);\n\n/**\n * This method prepares the grouped data.\n *\n * @param fieldDefs array of objects i.e. dataset\n * @param groupby string groupby\n * @param match string match\n * @param orderby string orderby\n * @param dateFormat string date format\n */\nexport const getGroupedData = (fieldDefs: any, groupby: string, match: string, orderby: string, dateFormat: string, widgetScope: any, innerItem?: any) => {\n\n // handling case-in-sensitive scenario\n // ordering the data based on groupby field. If there is innerItem then apply orderby using the innerItem's containing the groupby field.\n fieldDefs = orderBy(fieldDefs, fieldDef => {\n const groupKey = getGroupKey(fieldDef, groupby, widgetScope, innerItem);\n if (groupKey) {\n return toLower(groupKey);\n }\n return '';\n });\n\n // extract the grouped data based on the field obtained from 'groupDataByField'.\n const groupedLiData = groupBy(fieldDefs, function (fieldDef) {\n let concatStr = getGroupKey(fieldDef, groupby, widgetScope, innerItem);\n // by default set the undefined groupKey as 'others'\n if (isUndefined(concatStr) || isNull(concatStr) || concatStr.toString().trim() === '') {\n return GROUP_BY_OPTIONS.OTHERS;\n }\n // if match prop is alphabetic ,get the starting alphabet of the word as key.\n if (match === GROUP_BY_OPTIONS.ALPHABET) {\n concatStr = concatStr.substr(0, 1);\n }\n\n // if match contains the time options then get the concatStr using 'getTimeRolledUpString'\n if (includes(values(TIME_ROLLUP_OPTIONS), match)) {\n dateFormat = dateFormat && dateFormat.replace(/d/g, 'D');\n dateFormat = dateFormat && dateFormat.replace(/y/g, 'Y');\n concatStr = moment(concatStr).format(dateFormat);\n }\n\n return concatStr;\n });\n\n return getSortedGroupedData(groupedLiData, groupby, orderby, innerItem);\n};\n\n/**\n * function to get the ordered dataset based on the given orderby\n */\nexport const getOrderedDataset = (dataSet: any, orderby: string, innerItem?: any) => {\n if (!orderBy) {\n return cloneDeep(dataSet);\n }\n\n // The order by only works when the dataset contains list of objects.\n const items = orderby && orderby.split(','),\n fields: any = [],\n directions: any = [];\n items && items.forEach( obj => {\n const item = obj.split(':');\n fields.push(innerItem ? innerItem + '.' + item[0] : item[0]);\n directions.push(item[1]);\n });\n return orderBy(dataSet, fields, directions);\n};\n\n\n/**\n * This method returns sorted data based to groupkey.\n * Returns a array of objects, each object containing key which is groupKey and data is the sorted data which is sorted by groupby field in the data.\n *\n * @param groupedLiData, grouped data object with key as the groupKey and its value as the array of objects grouped under the groupKey.\n * @param groupBy, string groupby property\n * @returns {any[]}\n */\nexport const getSortedGroupedData = (groupedLiData: any, groupBy: string, orderby: string, innerItem?: any) => {\n const _groupedData: any = [];\n forEach(keys(groupedLiData), (groupkey, index) => {\n const liData = getOrderedDataset(groupedLiData[groupkey], orderby, innerItem);\n _groupedData.push({\n key: groupkey,\n data: sortBy(liData, data => {\n data._groupIndex = index;\n return get(data, groupBy) || get(data[innerItem], groupBy);\n })\n });\n });\n return _groupedData;\n};\n\nexport const isDefined = (v: any) => typeof v !== 'undefined';\n\n// try to convert the chekedvalue and unchecked values to boolean/number\nexport const unStringify = (val: any, defaultVal?: boolean) => {\n if (val === null) {\n return defaultVal;\n }\n\n if (val === true || val === 'true') {\n return true;\n }\n\n if (val === false || val === 'false') {\n return false;\n }\n\n const number = parseInt(val, 10);\n if (!isNaN(number)) {\n return number;\n }\n return val;\n};\n\n/**\n * This function invokes the given the function (fn) until the function successfully executes or the maximum number\n * of retries is reached or onBeforeRetry returns false.\n *\n * @param fn - a function that is needs to be invoked. The function can also return a promise as well.\n * @param interval - minimum time gap between successive retries. This argument should be greater or equal to 0.\n * @param maxRetries - maximum number of retries. This argument should be greater than 0. For all other values,\n * maxRetries is infinity.\n * @param onBeforeRetry - a callback function that will be invoked before re-invoking again. This function can\n * return false or a promise that is resolved to false to stop further retry attempts.\n * @returns {*} a promise that is resolved when fn is success (or) maximum retry attempts reached\n * (or) onBeforeRetry returned false.\n */\nexport const retryIfFails = (fn: Function, interval: number, maxRetries: number, onBeforeRetry = () => Promise.resolve(false)) => {\n let retryCount = 0;\n const tryFn = () => {\n retryCount++;\n if (isFunction(fn)) {\n return fn();\n }\n };\n maxRetries = (isNumber(maxRetries) && maxRetries > 0 ? maxRetries : 0);\n interval = (isNumber(interval) && interval > 0 ? interval : 0);\n return new Promise((resolve, reject) => {\n const errorFn = function () {\n const errArgs = arguments;\n setTimeout(() => {\n Promise.resolve().then(() => onBeforeRetry()).then(function (retry) {\n if (retry !== false && (!maxRetries || retryCount <= maxRetries)) {\n Promise.resolve().then(() => tryFn()).then(resolve, errorFn);\n } else {\n reject(errArgs);\n }\n }, () => reject(errArgs));\n }, interval);\n };\n Promise.resolve().then(() => tryFn()).then(resolve, errorFn);\n });\n};\n\n/**\n * Promise of a defer created using this function, has abort function that will reject the defer when called.\n * @returns {*} angular defer object\n */\nexport const getAbortableDefer = () => {\n const _defer: any = {\n promise: null,\n reject: null,\n resolve: null,\n onAbort: () => { },\n isAborted: false\n };\n _defer.promise = new Promise((resolve, reject) => {\n _defer.resolve = resolve;\n _defer.reject = reject;\n });\n _defer.promise.abort = () => {\n _defer.onAbort && _defer.onAbort();\n _defer.reject('aborted');\n _defer.isAborted = true;\n };\n return _defer;\n};\n\nexport const validateField = (props: any, value: any) => {\n let requiredCheck = true, regexCheck = true;\n if (props.required) {\n if (isArray(value)) {\n requiredCheck = value.length === 0 ? false : true\n } else {\n requiredCheck = !value ? false : true\n }\n if (!requiredCheck) {\n return {\n errorType : 'required',\n isValid: false\n }\n }\n }\n if (value && props.regexp) {\n const condition = new RegExp(\"^\" + props.regexp + \"$\", 'g');\n regexCheck = condition.test(value);\n if (!regexCheck) {\n return {\n errorType : 'regexp',\n isValid: false\n }\n }\n }\n if (value && props.maxchars && value.length > props.maxchars) {\n return {\n errorType : 'maxchars',\n isValid: false\n }\n\n }\n if (value && props.mindate && new Date(props.datavalue) < moment(props.mindate).startOf('day').toDate()) {\n return {\n errorType : 'mindate',\n isValid: false\n }\n }\n if (value && props.maxdate && new Date(props.datavalue) > moment(props.maxdate).endOf('day').toDate()) {\n return {\n errorType : 'maxdate',\n isValid: false\n }\n }\n\n return {\n isValid: true\n }\n};\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,MAAM,MAAM,QAAQ;AAC3B,SAASC,UAAU,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,OAAO,EAAEC,GAAG,EAAEC,OAAO,EAAEC,MAAM,EAAEC,SAAS,EAAEC,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,QAAQ,QAAO,QAAQ;AAGxK,MAAMC,gBAAgB,GAAG;EACvBC,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACV,CAAC;AACD,MAAMC,mBAAmB,GAAG;EAC1BC,IAAI,EAAE,MAAM;EACZC,GAAG,EAAE,KAAK;EACVC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE;AACR,CAAC;AAED,MAAMC,SAAS,GAAG,UAACC,EAAO,EAAiB;EAAA,kCAAZC,EAAE;IAAFA,EAAE;EAAA;EAC7BA,EAAE,CAACpB,OAAO,CAAEqB,CAAM,IAAK;IACnB,IAAIA,CAAC,EAAE;MACHC,MAAM,CAACnB,IAAI,CAACkB,CAAC,CAAC,CAACrB,OAAO,CAACuB,CAAC,IAAI;QACxB,MAAMC,CAAC,GAAGH,CAAC,CAACE,CAAC,CAAC;QACd,IAAIC,CAAC,IAA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AAIC,MAAM,CAAC,GAAG,GAAGT,KAAK,CAACO,MAAM,GAAG,GAAG,EAAE,GAAG,CAAC;IAC3DJ,UAAU,GAAGK,SAAS,CAAC9E,IAAI,CAACuE,KAAK,CAAC;IAClC,IAAI,CAACE,UAAU,EAAE;MACf,OAAO;QACLE,SAAS,EAAG,QAAQ;QACpBC,OAAO,EAAE;MACX,CAAC;IACH;EACF;EACA,IAAIL,KAAK,IAAID,KAAK,CAACU,QAAQ,IAAIT,KAAK,CAACnF,MAAM,GAAGkF,KAAK,CAACU,QAAQ,EAAE;IAC5D,OAAO;MACLL,SAAS,EAAG,UAAU;MACtBC,OAAO,EAAE;IACX,CAAC;EAEH;EACA,IAAIL,KAAK,IAAID,KAAK,CAACW,OAAO,IAAI,IAAIC,IAAI,CAACZ,KAAK,CAACa,SAAS,CAAC,GAAG/I,MAAM,CAACkI,KAAK,CAACW,OAAO,CAAC,CAACG,OAAO,CAAC,KAAK,CAAC,CAACC,MAAM,EAAE,EAAE;IACvG,OAAO;MACLV,SAAS,EAAG,SAAS;MACrBC,OAAO,EAAE;IACX,CAAC;EACH;EACA,IAAIL,KAAK,IAAID,KAAK,CAACgB,OAAO,IAAI,IAAIJ,IAAI,CAACZ,KAAK,CAACa,SAAS,CAAC,GAAG/I,MAAM,CAACkI,KAAK,CAACgB,OAAO,CAAC,CAACC,KAAK,CAAC,KAAK,CAAC,CAACF,MAAM,EAAE,EAAE;IACrG,OAAO;MACLV,SAAS,EAAG,SAAS;MACrBC,OAAO,EAAE;IACX,CAAC;EACH;EAEA,OAAO;IACLA,OAAO,EAAE;EACX,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"names":["Platform","moment","FileSystem","isFunction","includes","isUndefined","isNull","orderBy","groupBy","toLower","get","forEach","sortBy","cloneDeep","keys","values","isArray","isString","isNumber","GROUP_BY_OPTIONS","ALPHABET","WORD","OTHERS","TIME_ROLLUP_OPTIONS","HOUR","DAY","WEEK","MONTH","YEAR","_deepCopy","o1","o2","o","Object","k","v","deepCopy","objects","toBoolean","val","undefined","toNumber","parseFloat","e","encodeUrl","url","splits","split","hash","params","length","map","p","encodeURIComponent","join","encodeURI","isWebPreviewMode","OS","isDevMode","__DEV__","widgetsWithUndefinedValue","isAndroid","test","window","navigator","userAgent","isIos","getGroupKey","fieldDef","groupby","widgetScope","innerItem","apply","proxy","getGroupedData","fieldDefs","match","orderby","dateFormat","groupKey","groupedLiData","concatStr","toString","trim","substr","replace","format","getSortedGroupedData","getOrderedDataset","dataSet","items","fields","directions","obj","item","push","_groupedData","groupkey","index","liData","key","data","_groupIndex","isDefined","unStringify","defaultVal","number","parseInt","isNaN","retryIfFails","fn","interval","maxRetries","onBeforeRetry","Promise","resolve","retryCount","tryFn","reject","errorFn","errArgs","arguments","setTimeout","then","retry","getAbortableDefer","_defer","promise","onAbort","isAborted","abort","validateField","props","value","requiredCheck","regexCheck","required","errorType","isValid","regexp","condition","RegExp","maxchars","mindate","Date","datavalue","startOf","toDate","maxdate","endOf","toBase64","path","readAsStringAsync","encoding"],"sources":["utils.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport moment from \"moment\";\nimport * as FileSystem from \"expo-file-system\";\nimport { isFunction, includes, isUndefined, isNull, orderBy, groupBy, toLower, get, forEach, sortBy, cloneDeep, keys, values, isArray, isString, isNumber} from 'lodash';\n\ndeclare const window: any;\nconst GROUP_BY_OPTIONS = {\n ALPHABET: 'alphabet',\n WORD: 'word',\n OTHERS: 'Others'\n};\nconst TIME_ROLLUP_OPTIONS = {\n HOUR: 'hour',\n DAY: 'day',\n WEEK: 'week',\n MONTH: 'month',\n YEAR: 'year'\n};\n\nconst _deepCopy = (o1: any, ...o2: any) => {\n o2.forEach((o: any) => {\n if (o) {\n Object.keys(o).forEach(k => {\n const v = o[k];\n if (v && !isString(v) && !isArray(v) && typeof v === 'object') {\n o1[k] = _deepCopy(o1[k] || {}, o[k]);\n } else {\n o1[k] = _deepCopy(v);\n }\n });\n }\n });\n return o1;\n};\n\nexport const deepCopy = (...objects: any) => _deepCopy({}, ...objects);\n\nexport const toBoolean = (val: any) => {\n return val === true\n || val === 'true'\n || !(val === false\n || val === null\n || val === undefined\n || val === '');\n};\n\nexport const toNumber = (val: any) => {\n try {\n return parseFloat(val) || 0;\n } catch(e) {\n return 0;\n }\n};\n\n/**\n * this method encodes the url and returns the encoded string\n */\n export const encodeUrl = (url: string): string => {\n let splits = url.split('#');\n const hash = splits[1];\n splits = splits[0].split('?');\n let params = '';\n if (splits.length > 1) {\n params = splits[1].split('&')\n .map(p => p.split('='))\n .map(p => p[0] +'=' + encodeURIComponent(p[1]))\n .join('&');\n }\n return encodeURI(splits[0]) + (params ? '?' + params: '') + (hash ? '#'+ hash : '');\n};\n\nexport const isWebPreviewMode = () => Platform.OS === 'web';\n\nexport const isDevMode = () => isWebPreviewMode() || __DEV__;\n\nexport const widgetsWithUndefinedValue = ['checkbox', 'toggle'];\n\nexport const isAndroid = () => (Platform.OS === 'android' || (Platform.OS === 'web' && /android/i.test(window.navigator.userAgent)));\n\nexport const isIos = () => (Platform.OS === 'ios' || (Platform.OS === 'web' && /iPhone|iPad/i.test(window.navigator.userAgent)));\n\nconst getGroupKey = (fieldDef: any, groupby: string, widgetScope: any, innerItem?: any) => isFunction(groupby) ? groupby.apply(widgetScope.proxy, [innerItem ? fieldDef[innerItem] : fieldDef]) : get(innerItem ? fieldDef[innerItem] : fieldDef, groupby);\n\n/**\n * This method prepares the grouped data.\n *\n * @param fieldDefs array of objects i.e. dataset\n * @param groupby string groupby\n * @param match string match\n * @param orderby string orderby\n * @param dateFormat string date format\n */\nexport const getGroupedData = (fieldDefs: any, groupby: string, match: string, orderby: string, dateFormat: string, widgetScope: any, innerItem?: any) => {\n\n // handling case-in-sensitive scenario\n // ordering the data based on groupby field. If there is innerItem then apply orderby using the innerItem's containing the groupby field.\n fieldDefs = orderBy(fieldDefs, fieldDef => {\n const groupKey = getGroupKey(fieldDef, groupby, widgetScope, innerItem);\n if (groupKey) {\n return toLower(groupKey);\n }\n return '';\n });\n\n // extract the grouped data based on the field obtained from 'groupDataByField'.\n const groupedLiData = groupBy(fieldDefs, function (fieldDef) {\n let concatStr = getGroupKey(fieldDef, groupby, widgetScope, innerItem);\n // by default set the undefined groupKey as 'others'\n if (isUndefined(concatStr) || isNull(concatStr) || concatStr.toString().trim() === '') {\n return GROUP_BY_OPTIONS.OTHERS;\n }\n // if match prop is alphabetic ,get the starting alphabet of the word as key.\n if (match === GROUP_BY_OPTIONS.ALPHABET) {\n concatStr = concatStr.substr(0, 1);\n }\n\n // if match contains the time options then get the concatStr using 'getTimeRolledUpString'\n if (includes(values(TIME_ROLLUP_OPTIONS), match)) {\n dateFormat = dateFormat && dateFormat.replace(/d/g, 'D');\n dateFormat = dateFormat && dateFormat.replace(/y/g, 'Y');\n concatStr = moment(concatStr).format(dateFormat);\n }\n\n return concatStr;\n });\n\n return getSortedGroupedData(groupedLiData, groupby, orderby, innerItem);\n};\n\n/**\n * function to get the ordered dataset based on the given orderby\n */\nexport const getOrderedDataset = (dataSet: any, orderby: string, innerItem?: any) => {\n if (!orderBy) {\n return cloneDeep(dataSet);\n }\n\n // The order by only works when the dataset contains list of objects.\n const items = orderby && orderby.split(','),\n fields: any = [],\n directions: any = [];\n items && items.forEach( obj => {\n const item = obj.split(':');\n fields.push(innerItem ? innerItem + '.' + item[0] : item[0]);\n directions.push(item[1]);\n });\n return orderBy(dataSet, fields, directions);\n};\n\n\n/**\n * This method returns sorted data based to groupkey.\n * Returns a array of objects, each object containing key which is groupKey and data is the sorted data which is sorted by groupby field in the data.\n *\n * @param groupedLiData, grouped data object with key as the groupKey and its value as the array of objects grouped under the groupKey.\n * @param groupBy, string groupby property\n * @returns {any[]}\n */\nexport const getSortedGroupedData = (groupedLiData: any, groupBy: string, orderby: string, innerItem?: any) => {\n const _groupedData: any = [];\n forEach(keys(groupedLiData), (groupkey, index) => {\n const liData = getOrderedDataset(groupedLiData[groupkey], orderby, innerItem);\n _groupedData.push({\n key: groupkey,\n data: sortBy(liData, data => {\n data._groupIndex = index;\n return get(data, groupBy) || get(data[innerItem], groupBy);\n })\n });\n });\n return _groupedData;\n};\n\nexport const isDefined = (v: any) => typeof v !== 'undefined';\n\n// try to convert the chekedvalue and unchecked values to boolean/number\nexport const unStringify = (val: any, defaultVal?: boolean) => {\n if (val === null) {\n return defaultVal;\n }\n\n if (val === true || val === 'true') {\n return true;\n }\n\n if (val === false || val === 'false') {\n return false;\n }\n\n const number = parseInt(val, 10);\n if (!isNaN(number)) {\n return number;\n }\n return val;\n};\n\n/**\n * This function invokes the given the function (fn) until the function successfully executes or the maximum number\n * of retries is reached or onBeforeRetry returns false.\n *\n * @param fn - a function that is needs to be invoked. The function can also return a promise as well.\n * @param interval - minimum time gap between successive retries. This argument should be greater or equal to 0.\n * @param maxRetries - maximum number of retries. This argument should be greater than 0. For all other values,\n * maxRetries is infinity.\n * @param onBeforeRetry - a callback function that will be invoked before re-invoking again. This function can\n * return false or a promise that is resolved to false to stop further retry attempts.\n * @returns {*} a promise that is resolved when fn is success (or) maximum retry attempts reached\n * (or) onBeforeRetry returned false.\n */\nexport const retryIfFails = (fn: Function, interval: number, maxRetries: number, onBeforeRetry = () => Promise.resolve(false)) => {\n let retryCount = 0;\n const tryFn = () => {\n retryCount++;\n if (isFunction(fn)) {\n return fn();\n }\n };\n maxRetries = (isNumber(maxRetries) && maxRetries > 0 ? maxRetries : 0);\n interval = (isNumber(interval) && interval > 0 ? interval : 0);\n return new Promise((resolve, reject) => {\n const errorFn = function () {\n const errArgs = arguments;\n setTimeout(() => {\n Promise.resolve().then(() => onBeforeRetry()).then(function (retry) {\n if (retry !== false && (!maxRetries || retryCount <= maxRetries)) {\n Promise.resolve().then(() => tryFn()).then(resolve, errorFn);\n } else {\n reject(errArgs);\n }\n }, () => reject(errArgs));\n }, interval);\n };\n Promise.resolve().then(() => tryFn()).then(resolve, errorFn);\n });\n};\n\n/**\n * Promise of a defer created using this function, has abort function that will reject the defer when called.\n * @returns {*} angular defer object\n */\nexport const getAbortableDefer = () => {\n const _defer: any = {\n promise: null,\n reject: null,\n resolve: null,\n onAbort: () => { },\n isAborted: false\n };\n _defer.promise = new Promise((resolve, reject) => {\n _defer.resolve = resolve;\n _defer.reject = reject;\n });\n _defer.promise.abort = () => {\n _defer.onAbort && _defer.onAbort();\n _defer.reject('aborted');\n _defer.isAborted = true;\n };\n return _defer;\n};\n\nexport const validateField = (props: any, value: any) => {\n let requiredCheck = true, regexCheck = true;\n if (props.required) {\n if (isArray(value)) {\n requiredCheck = value.length === 0 ? false : true\n } else {\n requiredCheck = !value ? false : true\n }\n if (!requiredCheck) {\n return {\n errorType : 'required',\n isValid: false\n }\n }\n }\n if (value && props.regexp) {\n const condition = new RegExp(\"^\" + props.regexp + \"$\", 'g');\n regexCheck = condition.test(value);\n if (!regexCheck) {\n return {\n errorType : 'regexp',\n isValid: false\n }\n }\n }\n if (value && props.maxchars && value.length > props.maxchars) {\n return {\n errorType : 'maxchars',\n isValid: false\n }\n\n }\n if (value && props.mindate && new Date(props.datavalue) < moment(props.mindate).startOf('day').toDate()) {\n return {\n errorType : 'mindate',\n isValid: false\n }\n }\n if (value && props.maxdate && new Date(props.datavalue) > moment(props.maxdate).endOf('day').toDate()) {\n return {\n errorType : 'maxdate',\n isValid: false\n }\n }\n\n return {\n isValid: true\n }\n};\n\n\nexport const toBase64 = function(path: string) {\n return FileSystem.readAsStringAsync(path, { encoding: 'base64' });\n};"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,MAAM,MAAM,QAAQ;AAC3B,OAAO,KAAKC,UAAU,MAAM,kBAAkB;AAC9C,SAASC,UAAU,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,OAAO,EAAEC,GAAG,EAAEC,OAAO,EAAEC,MAAM,EAAEC,SAAS,EAAEC,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,QAAQ,QAA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MACrBC,OAAO,EAAE;IACX,CAAC;EACH;EACA,IAAIL,KAAK,IAAID,KAAK,CAACgB,OAAO,IAAI,IAAIJ,IAAI,CAACZ,KAAK,CAACa,SAAS,CAAC,GAAGhJ,MAAM,CAACmI,KAAK,CAACgB,OAAO,CAAC,CAACC,KAAK,CAAC,KAAK,CAAC,CAACF,MAAM,EAAE,EAAE;IACrG,OAAO;MACLV,SAAS,EAAG,SAAS;MACrBC,OAAO,EAAE;IACX,CAAC;EACH;EAEA,OAAO;IACLA,OAAO,EAAE;EACX,CAAC;AACH,CAAC;AAGD,OAAO,MAAMY,QAAQ,GAAG,UAASC,IAAY,EAAE;EAC7C,OAAOrJ,UAAU,CAACsJ,iBAAiB,CAACD,IAAI,EAAE;IAAEE,QAAQ,EAAE;EAAS,CAAC,CAAC;AACnE,CAAC"}
|
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.26251",
|
|
4
4
|
"description": "''",
|
|
5
5
|
"main": "index",
|
|
6
6
|
"module": "index",
|
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
"example": "yarn --cwd example",
|
|
22
22
|
"pods": "cd example && pod-install --quiet",
|
|
23
23
|
"bootstrap": "yarn example && yarn && yarn pods",
|
|
24
|
-
"watch": "npm-watch build"
|
|
25
|
-
"publish-patch": "npm run build -- --production=true && node scripts/npm-publish.js"
|
|
24
|
+
"watch": "npm-watch build"
|
|
26
25
|
},
|
|
27
26
|
"keywords": [
|
|
28
27
|
"react-native",
|
|
@@ -50,7 +49,7 @@
|
|
|
50
49
|
"@react-navigation/native": "^6.0.16",
|
|
51
50
|
"@react-navigation/stack": "^6.3.7",
|
|
52
51
|
"@types/lodash-es": "^4.17.6",
|
|
53
|
-
"@wavemaker/variables": "11.4.0-next.
|
|
52
|
+
"@wavemaker/variables": "11.4.0-next.26251",
|
|
54
53
|
"axios": "^0.21.1",
|
|
55
54
|
"color": "4.2.3",
|
|
56
55
|
"cross-env": "^5.2.0",
|
|
@@ -106,6 +105,7 @@
|
|
|
106
105
|
"expo-contacts": "~11.0.1",
|
|
107
106
|
"expo-device": "~5.0.0",
|
|
108
107
|
"expo-document-picker": "~11.0.1",
|
|
108
|
+
"expo-file-system": "^15.1.1",
|
|
109
109
|
"expo-location": "~15.0.1",
|
|
110
110
|
"expo-network": "~5.0.0",
|
|
111
111
|
"expo-splash-screen": "~0.17.5",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"typescript": "^4.9.3",
|
|
127
127
|
"victory-native": "^36.5.3",
|
|
128
128
|
"yargs": "^16.2.0",
|
|
129
|
-
"@wavemaker/variables": "11.4.0-next.
|
|
129
|
+
"@wavemaker/variables": "11.4.0-next.26251"
|
|
130
130
|
},
|
|
131
131
|
"jest": {
|
|
132
132
|
"preset": "react-native",
|
app-rn-runtime/runtime/App.js
CHANGED
|
@@ -3,9 +3,9 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
3
3
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import axios from 'axios';
|
|
6
|
-
import { Platform, TouchableOpacity, View } from 'react-native';
|
|
6
|
+
import { Platform, TouchableOpacity, View, StatusBar } from 'react-native';
|
|
7
7
|
import ProtoTypes from 'prop-types';
|
|
8
|
-
import { SafeAreaProvider, SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
|
8
|
+
import { SafeAreaProvider, SafeAreaInsetsContext, SafeAreaView } from 'react-native-safe-area-context';
|
|
9
9
|
import { DefaultTheme, Provider as PaperProvider } from 'react-native-paper';
|
|
10
10
|
import { Linking } from 'react-native';
|
|
11
11
|
import { NativeModulesProxy } from 'expo-modules-core';
|
|
@@ -17,6 +17,7 @@ import StorageService from '@wavemaker/app-rn-runtime/core/storage.service';
|
|
|
17
17
|
import injector from '@wavemaker/app-rn-runtime/core/injector';
|
|
18
18
|
import formatters from '@wavemaker/app-rn-runtime/core/formatters';
|
|
19
19
|
import { deepCopy, isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';
|
|
20
|
+
import * as Utils from '@wavemaker/app-rn-runtime/core/utils';
|
|
20
21
|
import { ModalProvider } from '@wavemaker/app-rn-runtime/core/modal.service';
|
|
21
22
|
import { FixedViewContainer } from '@wavemaker/app-rn-runtime/core/fixed-view.component';
|
|
22
23
|
import { ToastProvider } from '@wavemaker/app-rn-runtime/core/toast.service';
|
|
@@ -71,6 +72,7 @@ class DrawerImpl {
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
const SUPPORTED_SERVICES = {
|
|
75
|
+
Utils: Utils,
|
|
74
76
|
StorageService: StorageService,
|
|
75
77
|
AppDisplayManagerService: AppDisplayManagerService
|
|
76
78
|
};
|
|
@@ -267,7 +269,7 @@ export default class BaseApp extends React.Component {
|
|
|
267
269
|
watcher: this.watcher,
|
|
268
270
|
render: watch => {
|
|
269
271
|
watch(() => AppToastService.refreshCount);
|
|
270
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, AppToastService.toastsOpened.map((o, i) => /*#__PURE__*/React.createElement(View, {
|
|
272
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, AppToastService.toastsOpened.map((o, i) => this.getProviders( /*#__PURE__*/React.createElement(View, {
|
|
271
273
|
key: i,
|
|
272
274
|
style: [{
|
|
273
275
|
position: 'absolute',
|
|
@@ -282,7 +284,7 @@ export default class BaseApp extends React.Component {
|
|
|
282
284
|
type: o.type,
|
|
283
285
|
caption: o.text,
|
|
284
286
|
hideclose: true
|
|
285
|
-
})))));
|
|
287
|
+
}))))));
|
|
286
288
|
}
|
|
287
289
|
});
|
|
288
290
|
}
|
|
@@ -386,14 +388,11 @@ export default class BaseApp extends React.Component {
|
|
|
386
388
|
left: 0,
|
|
387
389
|
right: 0
|
|
388
390
|
};
|
|
389
|
-
return _this2.getProviders( /*#__PURE__*/React.createElement(
|
|
390
|
-
style:
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
paddingRight: insets === null || insets === void 0 ? void 0 : insets.right
|
|
395
|
-
}]
|
|
396
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
391
|
+
return _this2.getProviders( /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
392
|
+
style: {
|
|
393
|
+
flex: 1
|
|
394
|
+
}
|
|
395
|
+
}, /*#__PURE__*/React.createElement(StatusBar, null), /*#__PURE__*/React.createElement(FixedViewContainer, null, /*#__PURE__*/React.createElement(View, {
|
|
397
396
|
style: styles.container
|
|
398
397
|
}, /*#__PURE__*/React.createElement(AppNavigator, {
|
|
399
398
|
app: _this2,
|
|
@@ -402,10 +401,10 @@ export default class BaseApp extends React.Component {
|
|
|
402
401
|
hideDrawer: ((_this2$appConfig$draw = _this2.appConfig.drawer) === null || _this2$appConfig$draw === void 0 ? void 0 : _this2$appConfig$draw.getContent()) === null,
|
|
403
402
|
drawerContent: () => _this2.appConfig.drawer ? _this2.getProviders(_this2.appConfig.drawer.getContent()) : null,
|
|
404
403
|
drawerAnimation: (_this2$appConfig$draw2 = _this2.appConfig.drawer) === null || _this2$appConfig$draw2 === void 0 ? void 0 : _this2$appConfig$draw2.getAnimation()
|
|
405
|
-
}), commonPartial), /*#__PURE__*/React.createElement(WmNetworkInfoToaster, {
|
|
404
|
+
}), commonPartial, _this2.renderToasters(), _this2.renderDialogs(), _this2.renderDisplayManager()), /*#__PURE__*/React.createElement(WmNetworkInfoToaster, {
|
|
406
405
|
appLocale: _this2.appConfig.appLocale
|
|
407
406
|
}))));
|
|
408
|
-
})
|
|
407
|
+
}))));
|
|
409
408
|
}
|
|
410
409
|
}
|
|
411
410
|
const styles = {
|