@wavemaker/app-rn-runtime 11.4.0-next.141710 → 11.4.0-next.24561

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.
Files changed (242) hide show
  1. app-rn-runtime/actions/notification-action.js +5 -4
  2. app-rn-runtime/actions/notification-action.js.map +1 -1
  3. app-rn-runtime/components/advanced/carousel/carousel-content/carousel-content.component.js +1 -1
  4. app-rn-runtime/components/advanced/carousel/carousel-content/carousel-content.component.js.map +1 -1
  5. app-rn-runtime/components/advanced/carousel/carousel-template/carousel-template.component.js +1 -1
  6. app-rn-runtime/components/advanced/carousel/carousel-template/carousel-template.component.js.map +1 -1
  7. app-rn-runtime/components/advanced/carousel/carousel.component.js +1 -1
  8. app-rn-runtime/components/advanced/carousel/carousel.component.js.map +1 -1
  9. app-rn-runtime/components/advanced/login/login.component.js +1 -1
  10. app-rn-runtime/components/advanced/login/login.component.js.map +1 -1
  11. app-rn-runtime/components/advanced/network-info-toaster/network-info-toaster.component.js +5 -5
  12. app-rn-runtime/components/advanced/network-info-toaster/network-info-toaster.component.js.map +1 -1
  13. app-rn-runtime/components/advanced/webview/webview.component.js +1 -1
  14. app-rn-runtime/components/advanced/webview/webview.component.js.map +1 -1
  15. app-rn-runtime/components/basic/anchor/anchor.component.js +1 -1
  16. app-rn-runtime/components/basic/anchor/anchor.component.js.map +1 -1
  17. app-rn-runtime/components/basic/button/button.component.js +1 -1
  18. app-rn-runtime/components/basic/button/button.component.js.map +1 -1
  19. app-rn-runtime/components/basic/buttongroup/buttongroup.component.js +1 -1
  20. app-rn-runtime/components/basic/buttongroup/buttongroup.component.js.map +1 -1
  21. app-rn-runtime/components/basic/custom/custom.component.js +25 -0
  22. app-rn-runtime/components/basic/custom/custom.component.js.map +1 -0
  23. app-rn-runtime/components/basic/custom/custom.props.js +16 -0
  24. app-rn-runtime/components/basic/custom/custom.props.js.map +1 -0
  25. app-rn-runtime/components/basic/custom/custom.styles.js +18 -0
  26. app-rn-runtime/components/basic/custom/custom.styles.js.map +1 -0
  27. app-rn-runtime/components/basic/icon/icon.component.js +1 -1
  28. app-rn-runtime/components/basic/icon/icon.component.js.map +1 -1
  29. app-rn-runtime/components/basic/label/label.component.js +1 -1
  30. app-rn-runtime/components/basic/label/label.component.js.map +1 -1
  31. app-rn-runtime/components/basic/lottie/lottie.component.js +137 -0
  32. app-rn-runtime/components/basic/lottie/lottie.component.js.map +1 -0
  33. app-rn-runtime/components/basic/lottie/lottie.props.js +14 -0
  34. app-rn-runtime/components/basic/lottie/lottie.props.js.map +1 -0
  35. app-rn-runtime/components/basic/lottie/lottie.styles.js +11 -0
  36. app-rn-runtime/components/basic/lottie/lottie.styles.js.map +1 -0
  37. app-rn-runtime/components/basic/message/message.component.js +1 -1
  38. app-rn-runtime/components/basic/message/message.component.js.map +1 -1
  39. app-rn-runtime/components/basic/picture/picture.component.js +37 -26
  40. app-rn-runtime/components/basic/picture/picture.component.js.map +1 -1
  41. app-rn-runtime/components/basic/progress-bar/progress-bar.component.js +3 -2
  42. app-rn-runtime/components/basic/progress-bar/progress-bar.component.js.map +1 -1
  43. app-rn-runtime/components/basic/progress-circle/progress-circle.component.js +1 -1
  44. app-rn-runtime/components/basic/progress-circle/progress-circle.component.js.map +1 -1
  45. app-rn-runtime/components/basic/search/search.component.js +4 -1
  46. app-rn-runtime/components/basic/search/search.component.js.map +1 -1
  47. app-rn-runtime/components/basic/spinner/spinner.component.js +10 -10
  48. app-rn-runtime/components/basic/spinner/spinner.component.js.map +1 -1
  49. app-rn-runtime/components/basic/video/video.component.js +56 -0
  50. app-rn-runtime/components/basic/video/video.component.js.map +1 -0
  51. app-rn-runtime/components/basic/video/video.props.js +22 -0
  52. app-rn-runtime/components/basic/video/video.props.js.map +1 -0
  53. app-rn-runtime/components/basic/video/video.styles.js +11 -0
  54. app-rn-runtime/components/basic/video/video.styles.js.map +1 -0
  55. app-rn-runtime/components/container/accordion/accordion.component.js +1 -1
  56. app-rn-runtime/components/container/accordion/accordion.component.js.map +1 -1
  57. app-rn-runtime/components/container/accordion/accordionpane/accordionpane.component.js +1 -1
  58. app-rn-runtime/components/container/accordion/accordionpane/accordionpane.component.js.map +1 -1
  59. app-rn-runtime/components/container/container.component.js +1 -1
  60. app-rn-runtime/components/container/container.component.js.map +1 -1
  61. app-rn-runtime/components/container/layoutgrid/gridcolumn/gridcolumn.component.js +1 -1
  62. app-rn-runtime/components/container/layoutgrid/gridcolumn/gridcolumn.component.js.map +1 -1
  63. app-rn-runtime/components/container/layoutgrid/gridrow/gridrow.component.js +1 -1
  64. app-rn-runtime/components/container/layoutgrid/gridrow/gridrow.component.js.map +1 -1
  65. app-rn-runtime/components/container/layoutgrid/layoutgrid.component.js +1 -1
  66. app-rn-runtime/components/container/layoutgrid/layoutgrid.component.js.map +1 -1
  67. app-rn-runtime/components/container/linearlayout/linearlayout.component.js +1 -1
  68. app-rn-runtime/components/container/linearlayout/linearlayout.component.js.map +1 -1
  69. app-rn-runtime/components/container/linearlayout/linearlayoutitem/linearlayoutitem.component.js +1 -1
  70. app-rn-runtime/components/container/linearlayout/linearlayoutitem/linearlayoutitem.component.js.map +1 -1
  71. app-rn-runtime/components/container/panel/panel-content/panel-content.component.js +1 -1
  72. app-rn-runtime/components/container/panel/panel-content/panel-content.component.js.map +1 -1
  73. app-rn-runtime/components/container/panel/panel-footer/panel-footer.component.js +1 -1
  74. app-rn-runtime/components/container/panel/panel-footer/panel-footer.component.js.map +1 -1
  75. app-rn-runtime/components/container/panel/panel.component.js +1 -1
  76. app-rn-runtime/components/container/panel/panel.component.js.map +1 -1
  77. app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js +12 -4
  78. app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js.map +1 -1
  79. app-rn-runtime/components/container/tabs/tabheader/tabheader.styles.js +2 -1
  80. app-rn-runtime/components/container/tabs/tabheader/tabheader.styles.js.map +1 -1
  81. app-rn-runtime/components/container/tabs/tabpane/tabpane.component.js +5 -2
  82. app-rn-runtime/components/container/tabs/tabpane/tabpane.component.js.map +1 -1
  83. app-rn-runtime/components/container/tabs/tabs.component.js +80 -64
  84. app-rn-runtime/components/container/tabs/tabs.component.js.map +1 -1
  85. app-rn-runtime/components/container/tabs/tabs.props.js +1 -0
  86. app-rn-runtime/components/container/tabs/tabs.props.js.map +1 -1
  87. app-rn-runtime/components/container/tabs/tabs.styles.js +1 -1
  88. app-rn-runtime/components/container/tabs/tabs.styles.js.map +1 -1
  89. app-rn-runtime/components/container/tile/tile.component.js +1 -1
  90. app-rn-runtime/components/container/tile/tile.component.js.map +1 -1
  91. app-rn-runtime/components/container/wizard/wizard.component.js +1 -1
  92. app-rn-runtime/components/container/wizard/wizard.component.js.map +1 -1
  93. app-rn-runtime/components/container/wizard/wizardstep/wizardstep.component.js +1 -1
  94. app-rn-runtime/components/container/wizard/wizardstep/wizardstep.component.js.map +1 -1
  95. app-rn-runtime/components/data/card/card-content/card-content.component.js +1 -1
  96. app-rn-runtime/components/data/card/card-content/card-content.component.js.map +1 -1
  97. app-rn-runtime/components/data/card/card-footer/card-footer.component.js +1 -1
  98. app-rn-runtime/components/data/card/card-footer/card-footer.component.js.map +1 -1
  99. app-rn-runtime/components/data/card/card.component.js +1 -1
  100. app-rn-runtime/components/data/card/card.component.js.map +1 -1
  101. app-rn-runtime/components/data/form/form-action/form-action.component.js +0 -6
  102. app-rn-runtime/components/data/form/form-action/form-action.component.js.map +1 -1
  103. app-rn-runtime/components/data/form/form-body/form-body.component.js +1 -1
  104. app-rn-runtime/components/data/form/form-body/form-body.component.js.map +1 -1
  105. app-rn-runtime/components/data/form/form-field/form-field.component.js +1 -1
  106. app-rn-runtime/components/data/form/form-field/form-field.component.js.map +1 -1
  107. app-rn-runtime/components/data/form/form-footer/form-footer.component.js +1 -1
  108. app-rn-runtime/components/data/form/form-footer/form-footer.component.js.map +1 -1
  109. app-rn-runtime/components/data/form/form.component.js +2 -31
  110. app-rn-runtime/components/data/form/form.component.js.map +1 -1
  111. app-rn-runtime/components/data/list/list-template/list-template.component.js +1 -1
  112. app-rn-runtime/components/data/list/list-template/list-template.component.js.map +1 -1
  113. app-rn-runtime/components/data/list/list.component.js +17 -8
  114. app-rn-runtime/components/data/list/list.component.js.map +1 -1
  115. app-rn-runtime/components/device/barcodescanner/barcodescanner.component.js +3 -2
  116. app-rn-runtime/components/device/barcodescanner/barcodescanner.component.js.map +1 -1
  117. app-rn-runtime/components/device/camera/camera.component.js +9 -4
  118. app-rn-runtime/components/device/camera/camera.component.js.map +1 -1
  119. app-rn-runtime/components/device/camera/camera.props.js +0 -1
  120. app-rn-runtime/components/device/camera/camera.props.js.map +1 -1
  121. app-rn-runtime/components/dialogs/dialog/dialog.component.js +1 -1
  122. app-rn-runtime/components/dialogs/dialog/dialog.component.js.map +1 -1
  123. app-rn-runtime/components/dialogs/dialogactions/dialogactions.component.js +1 -1
  124. app-rn-runtime/components/dialogs/dialogactions/dialogactions.component.js.map +1 -1
  125. app-rn-runtime/components/dialogs/dialogcontent/dialogcontent.component.js +1 -1
  126. app-rn-runtime/components/dialogs/dialogcontent/dialogcontent.component.js.map +1 -1
  127. app-rn-runtime/components/input/baseinput/baseinput.component.js +7 -0
  128. app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
  129. app-rn-runtime/components/input/calendar/calendar.component.js +1 -1
  130. app-rn-runtime/components/input/calendar/calendar.component.js.map +1 -1
  131. app-rn-runtime/components/input/checkbox/checkbox.component.js +1 -16
  132. app-rn-runtime/components/input/checkbox/checkbox.component.js.map +1 -1
  133. app-rn-runtime/components/input/checkboxset/checkboxset.component.js +0 -38
  134. app-rn-runtime/components/input/checkboxset/checkboxset.component.js.map +1 -1
  135. app-rn-runtime/components/input/composite/composite.component.js +1 -1
  136. app-rn-runtime/components/input/composite/composite.component.js.map +1 -1
  137. app-rn-runtime/components/input/epoch/base-datetime.component.js +1 -1
  138. app-rn-runtime/components/input/epoch/base-datetime.component.js.map +1 -1
  139. app-rn-runtime/components/input/fileupload/fileupload.component.js +1 -1
  140. app-rn-runtime/components/input/fileupload/fileupload.component.js.map +1 -1
  141. app-rn-runtime/components/input/number/number.component.js +0 -9
  142. app-rn-runtime/components/input/number/number.component.js.map +1 -1
  143. app-rn-runtime/components/input/radioset/radioset.component.js +0 -40
  144. app-rn-runtime/components/input/radioset/radioset.component.js.map +1 -1
  145. app-rn-runtime/components/input/rating/rating.component.js +1 -1
  146. app-rn-runtime/components/input/rating/rating.component.js.map +1 -1
  147. app-rn-runtime/components/input/slider/slider.component.js +1 -1
  148. app-rn-runtime/components/input/slider/slider.component.js.map +1 -1
  149. app-rn-runtime/components/input/switch/switch.component.js +19 -22
  150. app-rn-runtime/components/input/switch/switch.component.js.map +1 -1
  151. app-rn-runtime/components/input/switch/switch.styles.js +7 -7
  152. app-rn-runtime/components/input/switch/switch.styles.js.map +1 -1
  153. app-rn-runtime/components/input/text/text.component.js +1 -10
  154. app-rn-runtime/components/input/text/text.component.js.map +1 -1
  155. app-rn-runtime/components/input/textarea/textarea.component.js +0 -10
  156. app-rn-runtime/components/input/textarea/textarea.component.js.map +1 -1
  157. app-rn-runtime/components/input/toggle/toggle.component.js +1 -1
  158. app-rn-runtime/components/input/toggle/toggle.component.js.map +1 -1
  159. app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js +1 -1
  160. app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js.map +1 -1
  161. app-rn-runtime/components/navigation/basenav/basenav.props.js +1 -0
  162. app-rn-runtime/components/navigation/basenav/basenav.props.js.map +1 -1
  163. app-rn-runtime/components/navigation/menu/menu.component.js +2 -1
  164. app-rn-runtime/components/navigation/menu/menu.component.js.map +1 -1
  165. app-rn-runtime/components/navigation/navbar/navbar.component.js +2 -0
  166. app-rn-runtime/components/navigation/navbar/navbar.component.js.map +1 -1
  167. app-rn-runtime/components/navigation/navitem/navitem.component.js +4 -3
  168. app-rn-runtime/components/navigation/navitem/navitem.component.js.map +1 -1
  169. app-rn-runtime/components/navigation/navitem/navitem.props.js +1 -0
  170. app-rn-runtime/components/navigation/navitem/navitem.props.js.map +1 -1
  171. app-rn-runtime/components/navigation/popover/popover.component.js +1 -1
  172. app-rn-runtime/components/navigation/popover/popover.component.js.map +1 -1
  173. app-rn-runtime/components/page/content/content.component.js +1 -1
  174. app-rn-runtime/components/page/content/content.component.js.map +1 -1
  175. app-rn-runtime/components/page/left-panel/left-panel.component.js +1 -1
  176. app-rn-runtime/components/page/left-panel/left-panel.component.js.map +1 -1
  177. app-rn-runtime/components/page/page-content/page-content.component.js +2 -2
  178. app-rn-runtime/components/page/page-content/page-content.component.js.map +1 -1
  179. app-rn-runtime/components/page/page.component.js +1 -1
  180. app-rn-runtime/components/page/page.component.js.map +1 -1
  181. app-rn-runtime/components/page/partial/partial.component.js +1 -1
  182. app-rn-runtime/components/page/partial/partial.component.js.map +1 -1
  183. app-rn-runtime/components/page/partial-container/partial-container.component.js +1 -1
  184. app-rn-runtime/components/page/partial-container/partial-container.component.js.map +1 -1
  185. app-rn-runtime/components/page/partial-container/partial-container.styles.js +2 -1
  186. app-rn-runtime/components/page/partial-container/partial-container.styles.js.map +1 -1
  187. app-rn-runtime/components/page/tabbar/tabbar.component.js +2 -1
  188. app-rn-runtime/components/page/tabbar/tabbar.component.js.map +1 -1
  189. app-rn-runtime/components/prefab/prefab-container.component.js +1 -1
  190. app-rn-runtime/components/prefab/prefab-container.component.js.map +1 -1
  191. app-rn-runtime/core/asset.provider.js +5 -0
  192. app-rn-runtime/core/asset.provider.js.map +1 -0
  193. app-rn-runtime/core/base.component.js +113 -41
  194. app-rn-runtime/core/base.component.js.map +1 -1
  195. app-rn-runtime/core/imageSizeEstimator.js +1 -0
  196. app-rn-runtime/core/imageSizeEstimator.js.map +1 -1
  197. app-rn-runtime/core/injector.js +15 -1
  198. app-rn-runtime/core/injector.js.map +1 -1
  199. app-rn-runtime/core/tappable.component.js +9 -2
  200. app-rn-runtime/core/tappable.component.js.map +1 -1
  201. app-rn-runtime/core/utils.js +6 -0
  202. app-rn-runtime/core/utils.js.map +1 -1
  203. app-rn-runtime/gestures/swipe.animation.js +105 -0
  204. app-rn-runtime/gestures/swipe.animation.js.map +1 -0
  205. app-rn-runtime/package.json +33 -32
  206. app-rn-runtime/runtime/App.js +24 -16
  207. app-rn-runtime/runtime/App.js.map +1 -1
  208. app-rn-runtime/runtime/App.navigator.js +2 -12
  209. app-rn-runtime/runtime/App.navigator.js.map +1 -1
  210. app-rn-runtime/runtime/base-fragment.component.js +6 -4
  211. app-rn-runtime/runtime/base-fragment.component.js.map +1 -1
  212. app-rn-runtime/runtime/navigator/drawer.navigator.js +4 -0
  213. app-rn-runtime/runtime/navigator/drawer.navigator.js.map +1 -1
  214. app-rn-runtime/runtime/navigator/stack.navigator.js +5 -1
  215. app-rn-runtime/runtime/navigator/stack.navigator.js.map +1 -1
  216. app-rn-runtime/runtime/services/app-security.service.js.map +1 -1
  217. app-rn-runtime/runtime/services/app-spinner.service.js +5 -1
  218. app-rn-runtime/runtime/services/app-spinner.service.js.map +1 -1
  219. app-rn-runtime/runtime/services/app-toast.service.js +1 -1
  220. app-rn-runtime/runtime/services/app-toast.service.js.map +1 -1
  221. app-rn-runtime/runtime/services/device/camera-service.js +28 -6
  222. app-rn-runtime/runtime/services/device/camera-service.js.map +1 -1
  223. app-rn-runtime/runtime/services/device/scan-service.js +15 -14
  224. app-rn-runtime/runtime/services/device/scan-service.js.map +1 -1
  225. app-rn-runtime/styles/background.component.js +259 -0
  226. app-rn-runtime/styles/background.component.js.map +1 -0
  227. app-rn-runtime/styles/style-prop.validator.js +38 -8
  228. app-rn-runtime/styles/style-prop.validator.js.map +1 -1
  229. app-rn-runtime/styles/style-props.js +93 -0
  230. app-rn-runtime/styles/style-props.js.map +1 -0
  231. app-rn-runtime/styles/theme.js +6 -37
  232. app-rn-runtime/styles/theme.js.map +1 -1
  233. app-rn-runtime/variables/device/camera/capture-image.operation.js.map +1 -1
  234. app-rn-runtime/variables/device/camera/capture-video.operation.js.map +1 -1
  235. app-rn-runtime/variables/device/file/upload-file.operation.js +43 -21
  236. app-rn-runtime/variables/device/file/upload-file.operation.js.map +1 -1
  237. app-rn-runtime/variables/http.service.js +9 -14
  238. app-rn-runtime/variables/http.service.js.map +1 -1
  239. app-rn-runtime/variables/live-variable.js +96 -0
  240. app-rn-runtime/variables/live-variable.js.map +1 -0
  241. app-rn-runtime/variables/service-variable.js +19 -8
  242. app-rn-runtime/variables/service-variable.js.map +1 -1
@@ -15,12 +15,16 @@ export class AppSpinnerService {
15
15
  _defineProperty(this, "count", 0);
16
16
  _defineProperty(this, "image", '');
17
17
  _defineProperty(this, "skeleton", false);
18
+ _defineProperty(this, "defaultDisplayOptions", {});
18
19
  }
19
20
  setImage(path) {
20
21
  this.image = path;
21
22
  }
23
+ setDefaultOptions(options) {
24
+ this.defaultDisplayOptions = options;
25
+ }
22
26
  show() {
23
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
27
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.defaultDisplayOptions;
24
28
  this.skeleton = options.spinner.loader == 'skeleton';
25
29
  if (this.count === 0 && !this.destroy) {
26
30
  setTimeout(() => {
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","appDisplayManagerService","WmSpinner","ThemeVariables","AppSpinnerService","constructor","displayManager","setImage","path","image","show","options","skeleton","spinner","loader","count","destroy","setTimeout","content","styles","appSpinnerContainer","message","delay","hide","call","justifyContent","alignItems","width","height","backgroundColor","INSTANCE","primaryContrastColor","opacity","spinnerService"],"sources":["app-spinner.service.tsx"],"sourcesContent":["import React from 'react';\n\nimport { View, ViewStyle } from 'react-native';\n\nimport { SpinnerService, DisplayOptions } from '@wavemaker/app-rn-runtime/core/spinner.service';\nimport { DisplayManager } from '@wavemaker/app-rn-runtime/core/display.manager';\nimport appDisplayManagerService from '@wavemaker/app-rn-runtime/runtime/services/app-display-manager.service';\nimport WmSpinner from '@wavemaker/app-rn-runtime/components/basic/spinner/spinner.component';\nimport ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';\n\nexport class AppSpinnerService implements SpinnerService {\n public displayOptions = {} as DisplayOptions;\n public destroy: any;\n public delay = 0;\n private count = 0;\n private image: string = '';\n public skeleton: boolean = false;\n constructor(private displayManager: DisplayManager) {}\n\n setImage(path: string) {\n this.image = path;\n }\n\n show(options: DisplayOptions = {}) {\n this.skeleton = options.spinner.loader == 'skeleton';\n if (this.count === 0 && !this.destroy) { \n setTimeout(() => {\n const content = (<>\n {!this.skeleton? \n <View style={styles.appSpinnerContainer}>\n <WmSpinner\n caption={options.message || ''}\n classname=\"global-spinner\"\n lottie={options.spinner}></WmSpinner>\n </View> : null}\n </>);\n this.destroy = this.displayManager.show({ content: content });\n }, this.delay);\n }\n this.count++;\n }\n\n hide() {\n this.skeleton = false;\n if (this.count > 0) {\n this.count--;\n } else {\n this.count = 0;\n }\n if (this.count === 0) {\n setTimeout(() => {\n if (!this.count && this.destroy) {\n this.destroy.call(this.displayManager);\n this.destroy = null;\n }\n }, 300);\n }\n }\n}\n\nconst styles = {\n appSpinnerContainer:{ \n justifyContent: 'center', \n alignItems: 'center', \n width:'100%', \n height:'100%', \n backgroundColor: ThemeVariables.INSTANCE.primaryContrastColor, \n opacity: 0.8 \n } as ViewStyle\n}\n\nconst spinnerService = new AppSpinnerService(appDisplayManagerService);\nexport default spinnerService;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,IAAI,QAAmB,cAAc;AAI9C,OAAOC,wBAAwB,MAAM,wEAAwE;AAC7G,OAAOC,SAAS,MAAM,sEAAsE;AAC5F,OAAOC,cAAc,MAAM,kDAAkD;AAE7E,OAAO,MAAMC,iBAAiB,CAA2B;EAOvDC,WAAW,CAASC,cAA8B,EAAE;IAAA,KAAhCA,cAA8B,GAA9BA,cAA8B;IAAA,wCAN1B,CAAC,CAAC;IAAA;IAAA,+BAEX,CAAC;IAAA,+BACA,CAAC;IAAA,+BACO,EAAE;IAAA,kCACC,KAAK;E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F,CAAC,EAAE,GAAG,CAAC;IACT;EACF;AACF;AAEA,MAAMG,MAAM,GAAG;EACbC,mBAAmB,EAAC;IAClBK,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,KAAK,EAAC,MAAM;IACZC,MAAM,EAAC,MAAM;IACbC,eAAe,EAAE1B,cAAc,CAAC2B,QAAQ,CAACC,oBAAoB;IAC7DC,OAAO,EAAE;EACX;AACF,CAAC;AAED,MAAMC,cAAc,GAAG,IAAI7B,iBAAiB,CAACH,wBAAwB,CAAC;AACtE,eAAegC,cAAc"}
1
+ {"version":3,"names":["React","View","appDisplayManagerService","WmSpinner","ThemeVariables","AppSpinnerService","constructor","displayManager","setImage","path","image","setDefaultOptions","options","defaultDisplayOptions","show","skeleton","spinner","loader","count","destroy","setTimeout","content","styles","appSpinnerContainer","message","delay","hide","call","justifyContent","alignItems","width","height","backgroundColor","INSTANCE","primaryContrastColor","opacity","spinnerService"],"sources":["app-spinner.service.tsx"],"sourcesContent":["import React from 'react';\n\nimport { View, ViewStyle } from 'react-native';\n\nimport { SpinnerService, DisplayOptions } from '@wavemaker/app-rn-runtime/core/spinner.service';\nimport { DisplayManager } from '@wavemaker/app-rn-runtime/core/display.manager';\nimport appDisplayManagerService from '@wavemaker/app-rn-runtime/runtime/services/app-display-manager.service';\nimport WmSpinner from '@wavemaker/app-rn-runtime/components/basic/spinner/spinner.component';\nimport ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';\n\nexport class AppSpinnerService implements SpinnerService {\n public displayOptions = {} as DisplayOptions;\n public destroy: any;\n public delay = 0;\n private count = 0;\n private image: string = '';\n public skeleton: boolean = false;\n private defaultDisplayOptions: DisplayOptions = {} as any;\n constructor(private displayManager: DisplayManager) {}\n\n setImage(path: string) {\n this.image = path;\n }\n\n setDefaultOptions(options: DisplayOptions) {\n this.defaultDisplayOptions = options;\n }\n\n show(options: DisplayOptions = this.defaultDisplayOptions) {\n this.skeleton = options.spinner.loader == 'skeleton';\n if (this.count === 0 && !this.destroy) { \n setTimeout(() => {\n const content = (<>\n {!this.skeleton? \n <View style={styles.appSpinnerContainer}>\n <WmSpinner\n caption={options.message || ''}\n classname=\"global-spinner\"\n lottie={options.spinner}></WmSpinner>\n </View> : null}\n </>);\n this.destroy = this.displayManager.show({ content: content });\n }, this.delay);\n }\n this.count++;\n }\n\n hide() {\n this.skeleton = false;\n if (this.count > 0) {\n this.count--;\n } else {\n this.count = 0;\n }\n if (this.count === 0) {\n setTimeout(() => {\n if (!this.count && this.destroy) {\n this.destroy.call(this.displayManager);\n this.destroy = null;\n }\n }, 300);\n }\n }\n}\n\nconst styles = {\n appSpinnerContainer:{ \n justifyContent: 'center', \n alignItems: 'center', \n width:'100%', \n height:'100%', \n backgroundColor: ThemeVariables.INSTANCE.primaryContrastColor, \n opacity: 0.8 \n } as ViewStyle\n}\n\nconst spinnerService = new AppSpinnerService(appDisplayManagerService);\nexport default spinnerService;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,IAAI,QAAmB,cAAc;AAI9C,OAAOC,wBAAwB,MAAM,wEAAwE;AAC7G,OAAOC,SAAS,MAAM,sEAAsE;AAC5F,OAAOC,cAAc,MAAM,kDAAkD;AAE7E,OAAO,MAAMC,iBAAiB,CAA2B;EAQvDC,WAAW,CAASC,cAA8B,EAAE;IAAA,KAAhCA,cAA8B,GAA9BA,cAA8B;IAAA,wCAP1B,CAAC,CAAC;IAAA;IAAA,+BAEX,CAAC;IAAA,+BACA,CAAC;IAAA,+BACO,EAAE;IAAA,kCACC,KAAK;IAAA,+CACiB,CAAC,CAAC;EACE;EAErDC,QAAQ,CAACC,IAAY,EAAE;IACrB,IAAI,CAACC,KAAK,GAAGD,IAAI;EACnB;EAEAE,iBAAiB,CAACC,OAAuB,EAAE;IACzC,IAAI,CAACC,qBAAqB,GAAGD,OAAO;EACtC;EAEAE,IAAI,GAAuD;IAAA,IAAtDF,OAAuB,uEAAG,IAAI,CAACC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,QAAQ;IACpBC,KAAK,EAAC,MAAM;IACZC,MAAM,EAAC,MAAM;IACbC,eAAe,EAAE5B,cAAc,CAAC6B,QAAQ,CAACC,oBAAoB;IAC7DC,OAAO,EAAE;EACX;AACF,CAAC;AAED,MAAMC,cAAc,GAAG,IAAI/B,iBAAiB,CAACH,wBAAwB,CAAC;AACtE,eAAekC,cAAc"}
@@ -23,7 +23,7 @@ class AppToastService {
23
23
  let timeout;
24
24
  this.refreshCount++;
25
25
  if (i < 0) {
26
- options.elevationIndex = parseInt(this.toastsOpened + this.getAppConfig().app.modalsOpened + 1);
26
+ options.elevationIndex = this.toastsOpened.length + this.getAppConfig().app.modalsOpened + 1;
27
27
  this.toastsOpened.push(options);
28
28
  // hide the toast when toaster is clicked
29
29
  if (options.hideOnClick) {
@@ -1 +1 @@
1
- {"version":3,"names":["injector","AppToastService","getAppConfig","appConfig","get","refresh","refreshCount","showToast","options","i","toastsOpened","findIndex","o","name","timeout","elevationIndex","parseInt","app","modalsOpened","push","hideOnClick","cb","onClick","hideToast","clearTimeout","duration","setTimeout","length","splice","onClose","appToastService"],"sources":["app-toast.service.tsx"],"sourcesContent":["import injector from '@wavemaker/app-rn-runtime/core/injector';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\nimport { ToastOptions, ToastService } from '@wavemaker/app-rn-runtime/core/toast.service';\n\nclass AppToastService implements ToastService {\n\n public toastsOpened = [] as ToastOptions[];\n public appConfig: any;\n public refreshCount = 0;\n\n private getAppConfig() {\n if (!this.appConfig) {\n this.appConfig = injector.get<AppConfig>('APP_CONFIG');\n }\n return this.appConfig;\n }\n \n refresh() {\n this.refreshCount++;\n this.appConfig.refresh();\n }\n\n public showToast(options: ToastOptions) {\n const i = this.toastsOpened.findIndex(o => o.name === options.name);\n let timeout: any;\n this.refreshCount++;\n if (i < 0) {\n options.elevationIndex = parseInt(this.toastsOpened + this.getAppConfig().app.modalsOpened + 1);\n this.toastsOpened.push(options);\n // hide the toast when toaster is clicked\n if (options.hideOnClick) {\n let cb = options.onClick;\n options.onClick = () => {\n cb && cb();\n this.hideToast(options);\n clearTimeout(timeout);\n }\n }\n if (options.duration) {\n timeout = setTimeout(() => {\n this.hideToast(options);\n }, options.duration);\n }\n }\n this.refresh();\n }\n\n public hideToast(options?: ToastOptions) {\n const i = options ? this.toastsOpened.findIndex(o => o.name === options.name) : (this.toastsOpened.length - 1);\n if (i >= 0) {\n const o = this.toastsOpened.splice(i, 1)[0];\n this.refresh();\n options?.onClose && options.onClose();\n }\n }\n}\n\nconst appToastService = new AppToastService();\n\nexport default appToastService;\n"],"mappings":";;;AAAA,OAAOA,QAAQ,MAAM,yCAAyC;AAI9D,MAAMC,eAAe,CAAyB;EAAA;IAAA,sCAEpB,EAAE;IAAA;IAAA,sCAEF,CAAC;EAAA;EAEfC,YAAY,GAAG;IACrB,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,IAAI,CAACA,SAAS,GAAGH,QAAQ,CAACI,GAAG,CAAY,YAAY,CAAC;IACxD;IACA,OAAO,IAAI,CAACD,SAAS;EACvB;EAEAE,OAAO,GAAG;IACR,IAAI,CAACC,YAAY,EAAE;IACnB,IAAI,CAACH,SAAS,CAACE,OAAO,EAAE;EAC1B;EAEOE,SAAS,CAACC,OAAqB,EAAE;IACpC,MAAMC,CAAC,GAAG,IAAI,CAACC,YAAY,CAACC,SAAS,CAACC,CAAC,IAAIA,CAAC,CAACC,IAAI,KAAKL,OAAO,CAACK,IAAI,CAAC;IACnE,IAAIC,OAAY;IAChB,IAAI,CAACR,YAAY,EAAE;IACnB,IAAIG,CAAC,GAAG,CAAC,EAAE;MACTD,OAAO,CAACO,cAAc,GAAGC,QAAQ,CAAC,IAAI,CAACN,YAAY,GAAG,IAAI,CAACR,YAAY,EAAE,CAACe,GAAG,CAACC,YAAY,GAAG,CAAC,CAAC;MAC/F,IAAI,CAACR,YAAY,CAACS,IAAI,CAACX,OAAO,CAAC;MAC7B;MACA,IAAIA,OAAO,CAACY,WAAW,EAAE;QACvB,IAAIC,EAAE,GAAGb,OAAO,CAACc,OAAO;QACxBd,OAAO,CAACc,OAAO,GAAG,MAAM;UACtBD,EAAE,IAAIA,EAAE,EAAE;UACV,IAAI,CAACE,SAAS,CAACf,OAAO,CAAC;UACvBgB,YAAY,CAACV,OAAO,CAAC;QACvB,CAAC;MACH;MACA,IAAIN,OAAO,CAACiB,QAAQ,EAAE;QACpBX,OAAO,GAAGY,UAAU,CAAC,MAAM;UACrB,IAAI,CAACH,SAAS,CAACf,OAAO,CAAC;QAC3B,CAAC,EAAEA,OAAO,CAACiB,QAAQ,CAAC;MACxB;IACJ;IACA,IAAI,CAACpB,OAAO,EAAE;EAClB;EAEOkB,SAAS,CAACf,OAAsB,EAAE;IACrC,MAAMC,CAAC,GAAGD,OAAO,GAAG,IAAI,CAACE,YAAY,CAACC,SAAS,CAACC,CAAC,IAAIA,CAAC,CAACC,IAAI,KAAKL,OAAO,CAACK,IAAI,CAAC,GAAI,IAAI,CAACH,YAAY,CAACiB,MAAM,GAAG,CAAE;IAC9G,IAAIlB,CAAC,IAAI,CAAC,EAAE;MACR,MAAMG,CAAC,GAAG,IAAI,CAACF,YAAY,CAACkB,MAAM,CAACnB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;MAC3C,IAAI,CAACJ,OAAO,EAAE;MACd,CAAAG,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEqB,OAAO,KAAIrB,OAAO,CAACqB,OAAO,EAAE;IACzC;EACJ;AACJ;AAEA,MAAMC,eAAe,GAAG,IAAI7B,eAAe,EAAE;AAE7C,eAAe6B,eAAe"}
1
+ {"version":3,"names":["injector","AppToastService","getAppConfig","appConfig","get","refresh","refreshCount","showToast","options","i","toastsOpened","findIndex","o","name","timeout","elevationIndex","length","app","modalsOpened","push","hideOnClick","cb","onClick","hideToast","clearTimeout","duration","setTimeout","splice","onClose","appToastService"],"sources":["app-toast.service.tsx"],"sourcesContent":["import injector from '@wavemaker/app-rn-runtime/core/injector';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\nimport { ToastOptions, ToastService } from '@wavemaker/app-rn-runtime/core/toast.service';\n\nclass AppToastService implements ToastService {\n\n public toastsOpened = [] as ToastOptions[];\n public appConfig: any;\n public refreshCount = 0;\n\n private getAppConfig() {\n if (!this.appConfig) {\n this.appConfig = injector.get<AppConfig>('APP_CONFIG');\n }\n return this.appConfig;\n }\n \n refresh() {\n this.refreshCount++;\n this.appConfig.refresh();\n }\n\n public showToast(options: ToastOptions) {\n const i = this.toastsOpened.findIndex(o => o.name === options.name);\n let timeout: any;\n this.refreshCount++;\n if (i < 0) {\n options.elevationIndex = this.toastsOpened.length + this.getAppConfig().app.modalsOpened + 1;\n this.toastsOpened.push(options);\n // hide the toast when toaster is clicked\n if (options.hideOnClick) {\n let cb = options.onClick;\n options.onClick = () => {\n cb && cb();\n this.hideToast(options);\n clearTimeout(timeout);\n }\n }\n if (options.duration) {\n timeout = setTimeout(() => {\n this.hideToast(options);\n }, options.duration);\n }\n }\n this.refresh();\n }\n\n public hideToast(options?: ToastOptions) {\n const i = options ? this.toastsOpened.findIndex(o => o.name === options.name) : (this.toastsOpened.length - 1);\n if (i >= 0) {\n const o = this.toastsOpened.splice(i, 1)[0];\n this.refresh();\n options?.onClose && options.onClose();\n }\n }\n}\n\nconst appToastService = new AppToastService();\n\nexport default appToastService;\n"],"mappings":";;;AAAA,OAAOA,QAAQ,MAAM,yCAAyC;AAI9D,MAAMC,eAAe,CAAyB;EAAA;IAAA,sCAEpB,EAAE;IAAA;IAAA,sCAEF,CAAC;EAAA;EAEfC,YAAY,GAAG;IACrB,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,IAAI,CAACA,SAAS,GAAGH,QAAQ,CAACI,GAAG,CAAY,YAAY,CAAC;IACxD;IACA,OAAO,IAAI,CAACD,SAAS;EACvB;EAEAE,OAAO,GAAG;IACR,IAAI,CAACC,YAAY,EAAE;IACnB,IAAI,CAACH,S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AClB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;MAC3C,IAAI,CAACJ,OAAO,EAAE;MACd,CAAAG,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEoB,OAAO,KAAIpB,OAAO,CAACoB,OAAO,EAAE;IACzC;EACJ;AACJ;AAEA,MAAMC,eAAe,GAAG,IAAI5B,eAAe,EAAE;AAE7C,eAAe4B,eAAe"}
@@ -6,6 +6,7 @@ import { ImageBackground, TouchableOpacity, View } from "react-native";
6
6
  import { Ionicons } from "@expo/vector-icons";
7
7
  import { ResizeMode, Video } from "expo-av";
8
8
  import { Camera, CameraType } from "expo-camera";
9
+ import * as FileSystem from "expo-file-system";
9
10
  import permissionManager from '@wavemaker/app-rn-runtime/runtime/services/device/permissions';
10
11
  import appDisplayManagerService from "@wavemaker/app-rn-runtime/runtime/services/app-display-manager.service";
11
12
  const styles = {
@@ -36,14 +37,17 @@ const styles = {
36
37
  },
37
38
  leftWrapper: {
38
39
  flex: 1,
40
+ justifyContent: 'center',
39
41
  alignItems: 'flex-start'
40
42
  },
41
43
  midWrapper: {
42
44
  flex: 1,
45
+ justifyContent: 'center',
43
46
  alignItems: 'center'
44
47
  },
45
48
  rightWrapper: {
46
49
  flex: 1,
50
+ justifyContent: 'center',
47
51
  alignItems: 'flex-end'
48
52
  },
49
53
  circle: {
@@ -79,8 +83,12 @@ export class CameraService {
79
83
  captureType: 'video',
80
84
  onSuccess: o => {
81
85
  destroy.call(this.displayManager);
86
+ /*o.content().catch(() => {}).then(base64 => {
87
+ resolve({videoPath: o.uri, content: base64 || ''});
88
+ });*/
82
89
  resolve({
83
- videoPath: o.uri
90
+ videoPath: o.uri,
91
+ content: ''
84
92
  });
85
93
  },
86
94
  onCancel: () => {
@@ -100,8 +108,11 @@ export class CameraService {
100
108
  captureType: 'image',
101
109
  onSuccess: o => {
102
110
  destroy.call(this.displayManager);
103
- resolve({
104
- imagePath: o.uri
111
+ o.content().catch(() => {}).then(base64 => {
112
+ resolve({
113
+ imagePath: o.uri,
114
+ content: base64 || ''
115
+ });
105
116
  });
106
117
  },
107
118
  onCancel: () => {
@@ -137,6 +148,11 @@ export class CameraView extends React.Component {
137
148
  _defineProperty(this, "camera", {});
138
149
  _defineProperty(this, "startRecord", async () => {
139
150
  this.camera.recordAsync().then(response => {
151
+ response.content = async () => {
152
+ return await FileSystem.readAsStringAsync(response.uri, {
153
+ encoding: 'base64'
154
+ });
155
+ };
140
156
  this.setState({
141
157
  cameraContent: response,
142
158
  isCaptured: true
@@ -182,9 +198,15 @@ export class CameraView extends React.Component {
182
198
  base64: false,
183
199
  skipProcessing: true,
184
200
  onPictureSaved: response => {
201
+ response.content = async () => {
202
+ return await FileSystem.readAsStringAsync(response.uri, {
203
+ encoding: 'base64'
204
+ });
205
+ };
185
206
  this.setState({
186
207
  cameraContent: response,
187
- isCaptured: true
208
+ isCaptured: true,
209
+ showActionBtns: true
188
210
  });
189
211
  }
190
212
  };
@@ -270,7 +292,7 @@ export class CameraView extends React.Component {
270
292
  source: {
271
293
  uri: this.state.cameraContent.uri
272
294
  },
273
- resizeMode: ResizeMode.COVER,
295
+ resizeMode: ResizeMode.CONTAIN,
274
296
  style: {
275
297
  flex: 1
276
298
  }
@@ -284,7 +306,7 @@ export class CameraView extends React.Component {
284
306
  shouldPlay: true,
285
307
  useNativeControls: true,
286
308
  isLooping: true,
287
- resizeMode: ResizeMode.COVER
309
+ resizeMode: ResizeMode.CONTAIN
288
310
  });
289
311
  }
290
312
  render() {
@@ -1 +1 @@
1
- {"version":3,"names":["React","ImageBackground","TouchableOpacity","View","Ionicons","ResizeMode","Video","Camera","CameraType","permissionManager","appDisplayManagerService","styles","preview","top","left","right","flexGrow","backgroundColor","actionBtn","flex","padding","paddingHorizontal","alignSelf","margin","actionBar","flexDirection","justifyContent","position","bottom","leftWrapper","alignItems","midWrapper","rightWrapper","circle","display","outerCircle","borderWidth","height","width","borderRadius","borderColor","innerCircle","CameraService","constructor","displayManager","back","captureVideo","options","Promise","resolve","reject","requestPermissions","then","destroy","show","content","type","o","call","videoPath","uri","captureImage","params","imagePath","CameraViewProps","CameraViewState","CameraView","Component","props","camera","recordAsync","response","setState","cameraContent","isCaptured","state","showActionBtns","recording","stopRecording","toggleCapture","captureType","takePicture","startRecord","stopRecord","quality","base64","skipProcessing","onPictureSaved","takePictureAsync","getActionsTemplate","closeView","onCancel","bind","onSuccess","cameraType","getPreviewTemplate","actions","COVER","render","ref","cameraService"],"sources":["camera-service.tsx"],"sourcesContent":["import React from \"react\";\nimport { ImageBackground, TouchableOpacity, View, ViewStyle } from \"react-native\";\nimport { Ionicons } from \"@expo/vector-icons\";\nimport { ResizeMode, Video } from \"expo-av\";\nimport { Camera, CameraType } from \"expo-camera\";\n\nimport { DisplayManager } from \"@wavemaker/app-rn-runtime/core/display.manager\";\nimport { CaptureVideoOutput } from \"@wavemaker/app-rn-runtime/variables/device/camera/capture-video.operation\";\nimport { CaptureImageOutput } from \"@wavemaker/app-rn-runtime/variables/device/camera/capture-image.operation\";\nimport permissionManager from '@wavemaker/app-rn-runtime/runtime/services/device/permissions';\nimport { CameraInput } from \"@wavemaker/app-rn-runtime/core/device/camera-service\";\nimport { Input } from \"@wavemaker/app-rn-runtime/variables/device/operation.provider\";\nimport appDisplayManagerService from \"@wavemaker/app-rn-runtime/runtime/services/app-display-manager.service\";\nconst styles = {\n preview: {\n top: 0,\n left: 0,\n right: 0,\n flexGrow: 1,\n backgroundColor: 'black'\n },\n actionBtn: {\n flex: 0,\n padding: 15,\n paddingHorizontal: 20,\n alignSelf: 'center',\n margin: 20,\n } as ViewStyle,\n actionBar: {\n flex: 0,\n flexDirection: 'row',\n justifyContent: 'center',\n backgroundColor: 'rgba(0,0,0,0.6)',\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n padding: 20\n } as ViewStyle,\n leftWrapper: {\n flex: 1,\n alignItems: 'flex-start',\n } as ViewStyle,\n midWrapper: {\n flex: 1,\n alignItems: 'center',\n } as ViewStyle,\n rightWrapper: {\n flex: 1,\n alignItems: 'flex-end',\n } as ViewStyle,\n circle: {\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n } as ViewStyle,\n outerCircle: {\n borderWidth: 3,\n height: 50,\n width: 50,\n borderRadius: 25,\n borderColor: 'white'\n },\n innerCircle: {\n borderRadius:2,\n height: 20,\n width:20,\n backgroundColor: 'red'\n }\n};\n\nexport interface CameraVideoInput extends Input {}\n\nexport class CameraService {\n private type= CameraType.back;\n\n constructor(private displayManager: DisplayManager) {\n }\n\n public captureVideo(options?: CameraVideoInput): Promise<CaptureVideoOutput> {\n return new Promise((resolve, reject) => {\n permissionManager.requestPermissions('video').then(() => {\n const destroy = this.displayManager.show({\n content: (<CameraView type={this.type} captureType={'video'} onSuccess={(o) => {\n destroy.call(this.displayManager);\n resolve({videoPath: o.uri});\n }}\n onCancel={() => {\n destroy.call(this.displayManager);\n }}\n ></CameraView>)\n });\n }, reject);\n });\n }\n\n public captureImage(params: CameraInput): Promise<CaptureImageOutput> {\n return new Promise((resolve, reject) => {\n permissionManager.requestPermissions('image').then(() => {\n const destroy = this.displayManager.show({\n content: (<CameraView type={this.type} captureType={'image'} onSuccess={(o) => {\n destroy.call(this.displayManager);\n resolve({imagePath: o.uri});\n }} onCancel={() => {destroy.call(this.displayManager);}}\n ></CameraView>)\n });\n }, reject);\n });\n }\n}\n\ninterface CameraOutput {\n uri: string;\n}\n\nclass CameraViewProps {\n type: 'front' | 'back' = 'back' as CameraType;\n captureType: 'image' | 'video' = 'image';\n onSuccess: (o: CameraOutput) => any = () => {};\n onCancel: () => any = () => {};\n}\n\nclass CameraViewState {\n recording: boolean = false;\n showActionBtns: boolean = false;\n cameraType: CameraType = CameraType.back;\n isCaptured: boolean = false;\n closeView: boolean = false;\n cameraContent: CameraOutput = {} as CameraOutput;\n}\n\nexport class CameraView extends React.Component<CameraViewProps, CameraViewState> {\n private camera: Camera = {} as Camera;\n\n constructor(props: CameraViewProps) {\n super(props);\n this.state = new CameraViewState();\n }\n\n toggleCapture() {\n if (this.props.captureType === 'image') {\n this.takePicture();\n } else {\n if (!this.state.recording) {\n this.startRecord();\n } else {\n this.stopRecord();\n this.setState({showActionBtns: true} as CameraViewState);\n }\n }\n }\n\n async takePicture() {\n const options = {\n quality: 0.5,\n base64: false,\n skipProcessing: true,\n onPictureSaved: (response: any) => {\n this.setState({ cameraContent: response, isCaptured: true } as CameraViewState);\n }\n }\n await this.camera.takePictureAsync(options);\n\n if (this.state.showActionBtns) {\n this.setState({showActionBtns: false} as CameraViewState);\n }\n this.setState({showActionBtns: true} as CameraViewState);\n }\n\n // start recording\n startRecord = async () => {\n this.camera.recordAsync().then((response: any) => {\n this.setState({ cameraContent: response, isCaptured: true } as CameraViewState);\n });\n if (this.state.showActionBtns) {\n this.setState({showActionBtns: false} as CameraViewState);\n }\n\n this.setState({recording: true} as CameraViewState);\n };\n\n // stop recording\n stopRecord = async () => {\n this.camera.stopRecording();\n this.setState({recording: false} as CameraViewState);\n this.setState({showActionBtns: true} as CameraViewState);\n };\n\n getActionsTemplate() {\n return <View style={styles.actionBar}>\n <View style={styles.leftWrapper}>\n <TouchableOpacity\n onPress={() => {\n this.setState({ cameraContent: {uri: ''}, isCaptured: false, closeView: true } as CameraViewState);\n this.props.onCancel();\n }}>\n <Ionicons name='close-circle' size={32} color='white' />\n </TouchableOpacity>\n </View>\n <View style={styles.midWrapper}>\n {!this.state.isCaptured ? <TouchableOpacity style={[styles.circle, styles.outerCircle, this.props.captureType === 'video' && !this.state.recording ? { backgroundColor: \"red\" } : {},\n this.props.captureType === 'image' ? { backgroundColor: \"white\" } : {}]}\n onPress={this.toggleCapture.bind(this)}>\n <View style={[styles.circle as ViewStyle, this.props.captureType === 'image' ? {} : styles.innerCircle, this.props.captureType === 'image' ? { backgroundColor: \"white\" } : {}]}></View>\n </TouchableOpacity> : null}\n </View>\n <View style={styles.rightWrapper}>\n {this.state.showActionBtns ? (<TouchableOpacity\n onPress={() => {\n this.setState({ isCaptured: false, closeView: true } as CameraViewState);\n this.props.onSuccess(this.state.cameraContent);\n this.setState({ cameraContent: {uri: ''} } as CameraViewState);\n }}>\n <Ionicons name='checkmark-circle' size={32} color='white'/>\n </TouchableOpacity>) : (<TouchableOpacity\n onPress={() => {\n this.setState({cameraType: this.state.cameraType === 'back' ? 'front' : 'back'} as CameraViewState);\n }}>\n <Ionicons name='camera-reverse' size={32} color='white' />\n </TouchableOpacity>)}\n </View>\n </View>\n }\n\n getPreviewTemplate(actions: any) {\n return this.props.captureType === 'image' ?\n <ImageBackground source={{uri : this.state.cameraContent.uri}} resizeMode={ResizeMode.COVER} style={{flex: 1}} />\n : <Video\n style={{ flex: 1 }}\n source={{\n uri: this.state.cameraContent.uri,\n }}\n shouldPlay={true}\n useNativeControls\n isLooping\n resizeMode={ResizeMode.COVER}\n ></Video>\n }\n\n render() {\n if (this.state.closeView) {\n return null;\n }\n const actions = this.getActionsTemplate();\n return (\n <View style={styles.preview}>\n {this.state.isCaptured ? (\n this.getPreviewTemplate(actions)\n ) : (\n <Camera type={CameraType[this.state.cameraType]} ref={(ref: Camera) => { this.camera = ref; }}\n style={{flex: 1}}\n onCameraReady={() => {}}>\n\n </Camera>)}\n {actions}\n </View>)\n }\n}\nconst cameraService = new CameraService(appDisplayManagerService);\nexport default cameraService;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,EAAEC,gBAAgB,EAAEC,IAAI,QAAmB,cAAc;AACjF,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,UAAU,EAAEC,KAAK,QAAQ,SAAS;AAC3C,SAASC,MAAM,EAAEC,UAAU,QAAQ,aAAa;AAKhD,OAAOC,iBAAiB,MAAM,+DAA+D;AAG7F,OAAOC,wBAAwB,MAAM,wEAAwE;AAC7G,MAAMC,MAAM,GAAG;EACbC,OAAO,EAAE;IACPC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,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IACA,MAAMM,OAAO,GAAG,IAAI,CAACP,kBAAkB,EAAE;IACzC,oBACE,oBAAC,IAAI;MAAC,KAAK,EAAE9E,MAAM,CAACC;IAAQ,GACzB,IAAI,CAAC+D,KAAK,CAACD,UAAU,GACpB,IAAI,CAACqB,kBAAkB,CAACC,OAAO,CAAC,gBAEhC,oBAAC,MAAM;MAAC,IAAI,EAAExF,UAAU,CAAC,IAAI,CAACmE,KAAK,CAACmB,UAAU,CAAE;MAAC,GAAG,EAAGK,GAAW,IAAK;QAAE,IAAI,CAAC9B,MAAM,GAAG8B,GAAG;MAAE,CAAE;MAC1F,KAAK,EAAE;QAAChF,IAAI,EAAE;MAAC,CAAE;MACjB,aAAa,EAAE,MAAM,CAAC;IAAE,EAElB,EACX6E,OAAO,CACH;EACX;AACF;AACA,MAAMI,aAAa,GAAG,IAAI1D,aAAa,CAAChC,wBAAwB,CAAC;AACjE,eAAe0F,aAAa"}
1
+ {"version":3,"names":["React","ImageBackground","TouchableOpacity","View","Ionicons","ResizeMode","Video","Camera","CameraType","FileSystem","permissionManager","appDisplayManagerService","styles","preview","top","left","right","flexGrow","backgroundColor","actionBtn","flex","padding","paddingHorizontal","alignSelf","margin","actionBar","flexDirection","justifyContent","position","bottom","leftWrapper","alignItems","midWrapper","rightWrapper","circle","display","outerCircle","borderWidth","height","width","borderRadius","borderColor","innerCircle","CameraService","constructor","displayManager","back","captureVideo","options","Promise","resolve","reject","requestPermissions","then","destroy","show","content","type","o","call","videoPath","uri","captureImage","params","catch","base64","imagePath","CameraViewProps","CameraViewState","CameraView","Component","props","camera","recordAsync","response","readAsStringAsync","encoding","setState","cameraContent","isCaptured","state","showActionBtns","recording","stopRecording","toggleCapture","captureType","takePicture","startRecord","stopRecord","quality","skipProcessing","onPictureSaved","takePictureAsync","getActionsTemplate","closeView","onCancel","bind","onSuccess","cameraType","getPreviewTemplate","actions","CONTAIN","render","ref","cameraService"],"sources":["camera-service.tsx"],"sourcesContent":["import React from \"react\";\nimport { ImageBackground, TouchableOpacity, View, ViewStyle } from \"react-native\";\nimport { Ionicons } from \"@expo/vector-icons\";\nimport { ResizeMode, Video } from \"expo-av\";\nimport { Camera, CameraType } from \"expo-camera\";\nimport * as FileSystem from \"expo-file-system\";\n\nimport { DisplayManager } from \"@wavemaker/app-rn-runtime/core/display.manager\";\nimport { CaptureVideoOutput } from \"@wavemaker/app-rn-runtime/variables/device/camera/capture-video.operation\";\nimport { CaptureImageOutput } from \"@wavemaker/app-rn-runtime/variables/device/camera/capture-image.operation\";\nimport permissionManager from '@wavemaker/app-rn-runtime/runtime/services/device/permissions';\nimport { CameraInput } from \"@wavemaker/app-rn-runtime/core/device/camera-service\";\nimport { Input } from \"@wavemaker/app-rn-runtime/variables/device/operation.provider\";\nimport appDisplayManagerService from \"@wavemaker/app-rn-runtime/runtime/services/app-display-manager.service\";\nconst styles = {\n preview: {\n top: 0,\n left: 0,\n right: 0,\n flexGrow: 1,\n backgroundColor: 'black'\n },\n actionBtn: {\n flex: 0,\n padding: 15,\n paddingHorizontal: 20,\n alignSelf: 'center',\n margin: 20,\n } as ViewStyle,\n actionBar: {\n flex: 0,\n flexDirection: 'row',\n justifyContent: 'center',\n backgroundColor: 'rgba(0,0,0,0.6)',\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n padding: 20\n } as ViewStyle,\n leftWrapper: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'flex-start',\n } as ViewStyle,\n midWrapper: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n } as ViewStyle,\n rightWrapper: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'flex-end',\n } as ViewStyle,\n circle: {\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n } as ViewStyle,\n outerCircle: {\n borderWidth: 3,\n height: 50,\n width: 50,\n borderRadius: 25,\n borderColor: 'white'\n },\n innerCircle: {\n borderRadius:2,\n height: 20,\n width:20,\n backgroundColor: 'red'\n }\n};\n\nexport interface CameraVideoInput extends Input {}\n\nexport class CameraService {\n private type= CameraType.back;\n\n constructor(private displayManager: DisplayManager) {\n }\n\n public captureVideo(options?: CameraVideoInput): Promise<CaptureVideoOutput> {\n return new Promise((resolve, reject) => {\n permissionManager.requestPermissions('video').then(() => {\n const destroy = this.displayManager.show({\n content: (<CameraView type={this.type} captureType={'video'} onSuccess={(o) => {\n destroy.call(this.displayManager);\n /*o.content().catch(() => {}).then(base64 => {\n resolve({videoPath: o.uri, content: base64 || ''});\n });*/\n resolve({videoPath: o.uri, content: ''});\n }}\n onCancel={() => {\n destroy.call(this.displayManager);\n }}\n ></CameraView>)\n });\n }, reject);\n });\n }\n\n public captureImage(params: CameraInput): Promise<CaptureImageOutput> {\n return new Promise((resolve, reject) => {\n permissionManager.requestPermissions('image').then(() => {\n const destroy = this.displayManager.show({\n content: (<CameraView type={this.type} captureType={'image'} onSuccess={(o) => {\n destroy.call(this.displayManager);\n o.content().catch(() => {}).then(base64 => {\n resolve({imagePath: o.uri, content: base64 || ''});\n });\n }} onCancel={() => {destroy.call(this.displayManager);}}\n ></CameraView>)\n });\n }, reject);\n });\n }\n}\n\ninterface CameraOutput {\n uri: string;\n content: () => Promise<string>;\n}\n\nclass CameraViewProps {\n type: 'front' | 'back' = 'back' as CameraType;\n captureType: 'image' | 'video' = 'image';\n onSuccess: (o: CameraOutput) => any = () => {};\n onCancel: () => any = () => {};\n}\n\nclass CameraViewState {\n recording: boolean = false;\n showActionBtns: boolean = false;\n cameraType: CameraType = CameraType.back;\n isCaptured: boolean = false;\n closeView: boolean = false;\n cameraContent: CameraOutput = {} as CameraOutput;\n}\n\nexport class CameraView extends React.Component<CameraViewProps, CameraViewState> {\n private camera: Camera = {} as Camera;\n\n constructor(props: CameraViewProps) {\n super(props);\n this.state = new CameraViewState();\n }\n\n toggleCapture() {\n if (this.props.captureType === 'image') {\n this.takePicture();\n } else {\n if (!this.state.recording) {\n this.startRecord();\n } else {\n this.stopRecord();\n this.setState({showActionBtns: true} as CameraViewState);\n }\n }\n }\n\n async takePicture() {\n const options = {\n quality: 0.5,\n base64: false,\n skipProcessing: true,\n onPictureSaved: (response: any) => {\n response.content = async () => {\n return await FileSystem.readAsStringAsync(response.uri, { encoding: 'base64' });\n };\n this.setState({ \n cameraContent: response,\n isCaptured: true,\n showActionBtns: true } as CameraViewState);\n }\n }\n await this.camera.takePictureAsync(options);\n\n if (this.state.showActionBtns) {\n this.setState({showActionBtns: false} as CameraViewState);\n }\n this.setState({showActionBtns: true} as CameraViewState);\n }\n\n // start recording\n startRecord = async () => {\n this.camera.recordAsync().then((response: any) => {\n response.content = async () => {\n return await FileSystem.readAsStringAsync(response.uri, { encoding: 'base64' });\n };\n this.setState({ cameraContent: response, isCaptured: true } as CameraViewState);\n });\n if (this.state.showActionBtns) {\n this.setState({showActionBtns: false} as CameraViewState);\n }\n\n this.setState({recording: true} as CameraViewState);\n };\n\n // stop recording\n stopRecord = async () => {\n this.camera.stopRecording();\n this.setState({recording: false} as CameraViewState);\n this.setState({showActionBtns: true} as CameraViewState);\n };\n\n getActionsTemplate() {\n return <View style={styles.actionBar}>\n <View style={styles.leftWrapper}>\n <TouchableOpacity\n onPress={() => {\n this.setState({ cameraContent: {uri: ''}, isCaptured: false, closeView: true } as CameraViewState);\n this.props.onCancel();\n }}>\n <Ionicons name='close-circle' size={32} color='white' />\n </TouchableOpacity>\n </View>\n <View style={styles.midWrapper}>\n {!this.state.isCaptured ? <TouchableOpacity style={[styles.circle, styles.outerCircle, this.props.captureType === 'video' && !this.state.recording ? { backgroundColor: \"red\" } : {},\n this.props.captureType === 'image' ? { backgroundColor: \"white\" } : {}]}\n onPress={this.toggleCapture.bind(this)}>\n <View style={[styles.circle as ViewStyle, this.props.captureType === 'image' ? {} : styles.innerCircle, this.props.captureType === 'image' ? { backgroundColor: \"white\" } : {}]}></View>\n </TouchableOpacity> : null}\n </View>\n <View style={styles.rightWrapper}>\n {this.state.showActionBtns ? (<TouchableOpacity\n onPress={() => {\n this.setState({ isCaptured: false, closeView: true } as CameraViewState);\n this.props.onSuccess(this.state.cameraContent);\n this.setState({ cameraContent: {uri: ''} } as CameraViewState);\n }}>\n <Ionicons name='checkmark-circle' size={32} color='white'/>\n </TouchableOpacity>) : (<TouchableOpacity\n onPress={() => {\n this.setState({cameraType: this.state.cameraType === 'back' ? 'front' : 'back'} as CameraViewState);\n }}>\n <Ionicons name='camera-reverse' size={32} color='white' />\n </TouchableOpacity>)}\n </View>\n </View>\n }\n\n getPreviewTemplate(actions: any) {\n return this.props.captureType === 'image' ?\n <ImageBackground source={{uri : this.state.cameraContent.uri}} resizeMode={ResizeMode.CONTAIN} style={{flex: 1}} />\n : <Video\n style={{ flex: 1 }}\n source={{\n uri: this.state.cameraContent.uri,\n }}\n shouldPlay={true}\n useNativeControls\n isLooping\n resizeMode={ResizeMode.CONTAIN}\n ></Video>\n }\n\n render() {\n if (this.state.closeView) {\n return null;\n }\n const actions = this.getActionsTemplate();\n return (\n <View style={styles.preview}>\n {this.state.isCaptured ? (\n this.getPreviewTemplate(actions)\n ) : (\n <Camera type={CameraType[this.state.cameraType]} ref={(ref: Camera) => { this.camera = ref; }}\n style={{flex: 1}}\n onCameraReady={() => {}}>\n\n </Camera>)}\n {actions}\n </View>)\n }\n}\nconst cameraService = new CameraService(appDisplayManagerService);\nexport default cameraService;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,EAAEC,gBAAgB,EAAEC,IAAI,QAAmB,cAAc;AACjF,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,UAAU,EAAEC,KAAK,QAAQ,SAAS;AAC3C,SAASC,MAAM,EAAEC,UAAU,QAAQ,aAAa;AAChD,OAAO,KAAKC,UAAU,MAAM,kBAAkB;AAK9C,OAAOC,iBAAiB,MAAM,+DAA+D;AAG7F,OAAOC,wBAAwB,MAAM,wEAAwE;AAC7G,MAAMC,MAAM,GAAG;EACbC,OAAO,EAAE;IACPC,GAAG,EAAE,CAAC;IACNC,IAAI,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BAAwB,CAAC;AACjE,eAAe6F,aAAa"}
@@ -30,8 +30,9 @@ const styles = StyleSheet.create({
30
30
  },
31
31
  closeWrapper: {
32
32
  flex: 1,
33
- alignItems: 'flex-end',
34
- paddingRight: 10
33
+ justifyContent: 'flex-end',
34
+ alignItems: 'center',
35
+ paddingBottom: 32
35
36
  },
36
37
  topWrapper: {
37
38
  flex: 2,
@@ -78,17 +79,7 @@ export class ScanService {
78
79
  style: StyleSheet.absoluteFillObject
79
80
  }, /*#__PURE__*/React.createElement(View, {
80
81
  style: styles.topWrapper
81
- }, /*#__PURE__*/React.createElement(View, {
82
- style: styles.closeWrapper
83
- }, /*#__PURE__*/React.createElement(TouchableOpacity, {
84
- onPress: () => {
85
- destroy.call(this.displayManager);
86
- }
87
- }, /*#__PURE__*/React.createElement(Ionicons, {
88
- name: "close-circle",
89
- size: 32,
90
- color: "white"
91
- })))), /*#__PURE__*/React.createElement(View, {
82
+ }), /*#__PURE__*/React.createElement(View, {
92
83
  style: styles.centerWrapper
93
84
  }, /*#__PURE__*/React.createElement(View, {
94
85
  style: styles.leftWrapper
@@ -98,7 +89,17 @@ export class ScanService {
98
89
  style: styles.rightWrapper
99
90
  })), /*#__PURE__*/React.createElement(View, {
100
91
  style: styles.bottomWrapper
101
- }))
92
+ }, /*#__PURE__*/React.createElement(View, {
93
+ style: styles.closeWrapper
94
+ }, /*#__PURE__*/React.createElement(TouchableOpacity, {
95
+ onPress: () => {
96
+ destroy.call(this.displayManager);
97
+ }
98
+ }, /*#__PURE__*/React.createElement(Ionicons, {
99
+ name: "close-circle",
100
+ size: 48,
101
+ color: "white"
102
+ })))))
102
103
  });
103
104
  }, reject);
104
105
  }).then(response => {
@@ -1 +1 @@
1
- {"version":3,"names":["Camera","Ionicons","BarCodeScanner","Platform","StyleSheet","TouchableOpacity","View","React","permissionManager","appDisplayManagerService","barcodeFormatOptions","opacity","styles","create","container","flex","flexDirection","closeWrapper","alignItems","paddingRight","topWrapper","backgroundColor","centerWrapper","leftWrapper","focused","rightWrapper","bottomWrapper","ScanService","constructor","displayManager","scanBarcode","params","format","barcodeFormat","OS","undefined","Promise","resolve","reject","requestPermissions","then","destroy","show","content","barCodeTypes","Constants","BarCodeType","result","call","absoluteFillObject","response","type","values","Object","index","indexOf","keys","text","data","cancelled","scanService"],"sources":["scan-service.tsx"],"sourcesContent":["import { Camera } from 'expo-camera';\nimport { Ionicons } from '@expo/vector-icons';\nimport { BarCodeScanner } from 'expo-barcode-scanner';\nimport { Platform, StyleSheet, TouchableOpacity, View } from 'react-native';\nimport React from 'react';\nimport { ScanInput, ScanOutput } from '@wavemaker/app-rn-runtime/variables/device/scan/scan.operation';\nimport { DisplayManager } from '@wavemaker/app-rn-runtime/core/display.manager';\nimport permissionManager from '@wavemaker/app-rn-runtime/runtime/services/device/permissions';\nimport appDisplayManagerService from '@wavemaker/app-rn-runtime/runtime/services/app-display-manager.service';\n\ninterface objectMap {\n [key: string]: string\n}\n\nconst barcodeFormatOptions: objectMap = {\n 'ALL': 'ALL',\n 'CODABAR': 'codabar',\n 'CODE_39': 'code39',\n 'CODE_93': 'code93',\n 'CODE_128': 'code128',\n 'DATA_MATRIX': 'datamatrix',\n 'EAN_8': 'ean8',\n 'EAN_13': 'ean13',\n 'ITF': 'itf14',\n 'PDF_417': 'pdf417',\n 'QR_CODE': 'qr',\n 'RSS14': 'rss14',\n 'RSS_EXPANDED': 'rssexpanded',\n 'UPC_E': 'upc_e',\n 'UPC_A': 'upc_a'\n};\nconst opacity = 'rgba(0, 0, 0, 0.6)';\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n flexDirection: 'column'\n },\n closeWrapper: {\n flex: 1,\n alignItems: 'flex-end',\n paddingRight: 10\n },\n topWrapper: {\n flex: 2,\n backgroundColor: opacity\n },\n centerWrapper: {\n flex: 2,\n flexDirection: 'row'\n },\n leftWrapper: {\n flex: 2,\n backgroundColor: opacity\n },\n focused: {\n flex: 10\n },\n rightWrapper: {\n flex: 2,\n backgroundColor: opacity\n },\n bottomWrapper: {\n flex: 2,\n backgroundColor: opacity\n },\n});\n\nexport class ScanService {\n\n constructor(private displayManager: DisplayManager) {}\n\n public scanBarcode(params: ScanInput): Promise<ScanOutput> {\n const format = params?.barcodeFormat || 'ALL';\n const barcodeFormat: string | undefined = Platform.OS === 'ios' ? undefined : barcodeFormatOptions[format];\n return new Promise((resolve, reject) => {\n permissionManager.requestPermissions('camera').then(() => {\n const destroy = this.displayManager.show({\n content: (<Camera\n barCodeScannerSettings={barcodeFormat ? {\n barCodeTypes: [BarCodeScanner.Constants.BarCodeType[barcodeFormat]],\n }: undefined}\n onBarCodeScanned={(result) => {\n destroy.call(this.displayManager);\n resolve(result);\n }}\n style={StyleSheet.absoluteFillObject}\n >\n <View style={styles.topWrapper}>\n <View style={styles.closeWrapper}>\n <TouchableOpacity\n onPress={() => {\n destroy.call(this.displayManager);\n }}>\n <Ionicons name='close-circle' size={32} color='white' />\n </TouchableOpacity>\n </View>\n </View>\n <View style={styles.centerWrapper}>\n <View style={styles.leftWrapper}/>\n <View style={styles.focused}/>\n <View style={styles.rightWrapper}/>\n </View>\n <View style={styles.bottomWrapper}/>\n </Camera>)\n });\n }, reject)\n }).then((response: any) => {\n let format;\n if (response.type) {\n const values = Object.values(BarCodeScanner.Constants.BarCodeType);\n const index = values.indexOf(response.type);\n format = index > -1 ? Object.keys(BarCodeScanner.Constants.BarCodeType)[index] : '';\n }\n return Promise.resolve({\n text: response.data,\n format : format || response.type,\n cancelled : false\n });\n });\n }\n}\nconst scanService = new ScanService(appDisplayManagerService);\nexport default scanService;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,aAAa;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,QAAQ,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAC3E,OAAOC,KAAK,MAAM,OAAO;AAGzB,OAAOC,iBAAiB,MAAM,+DAA+D;AA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,EAAE,eAClC,oBAAC,IAAI;YAAC,KAAK,EAAEX,MAAM,CAACY;UAAQ,EAAE,eAC9B,oBAAC,IAAI;YAAC,KAAK,EAAEZ,MAAM,CAACa;UAAa,EAAE,CAC9B,eACP,oBAAC,IAAI;YAAC,KAAK,EAAEb,MAAM,CAACc;UAAc,EAAE;QAExC,CAAC,CAAC;MACJ,CAAC,EAAEY,MAAM,CAAC;IACZ,CAAC,CAAC,CAACE,IAAI,CAAEU,QAAa,IAAK;MACzB,IAAIlB,MAAM;MACV,IAAIkB,QAAQ,CAACC,IAAI,EAAE;QACjB,MAAMC,MAAM,GAAGC,MAAM,CAACD,MAAM,CAAClD,cAAc,CAAC2C,SAAS,CAACC,WAAW,CAAC;QAClE,MAAMQ,KAAK,GAAGF,MAAM,CAACG,OAAO,CAACL,QAAQ,CAACC,IAAI,CAAC;QAC3CnB,MAAM,GAAGsB,KAAK,GAAG,CAAC,CAAC,GAAGD,MAAM,CAACG,IAAI,CAACtD,cAAc,CAAC2C,SAAS,CAACC,WAAW,CAAC,CAACQ,KAAK,CAAC,GAAG,EAAE;MACrF;MACA,OAAOlB,OAAO,CAACC,OAAO,CAAC;QACrBoB,IAAI,EAAEP,QAAQ,CAACQ,IAAI;QACnB1B,MAAM,EAAGA,MAAM,IAAIkB,QAAQ,CAACC,IAAI;QAChCQ,SAAS,EAAG;MACd,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;AACF;AACA,MAAMC,WAAW,GAAG,IAAIjC,WAAW,CAAClB,wBAAwB,CAAC;AAC7D,eAAemD,WAAW"}
1
+ {"version":3,"names":["Camera","Ionicons","BarCodeScanner","Platform","StyleSheet","TouchableOpacity","View","React","permissionManager","appDisplayManagerService","barcodeFormatOptions","opacity","styles","create","container","flex","flexDirection","closeWrapper","justifyContent","alignItems","paddingBottom","topWrapper","backgroundColor","centerWrapper","leftWrapper","focused","rightWrapper","bottomWrapper","ScanService","constructor","displayManager","scanBarcode","params","format","barcodeFormat","OS","undefined","Promise","resolve","reject","requestPermissions","then","destroy","show","content","barCodeTypes","Constants","BarCodeType","result","call","absoluteFillObject","response","type","values","Object","index","indexOf","keys","text","data","cancelled","scanService"],"sources":["scan-service.tsx"],"sourcesContent":["import { Camera } from 'expo-camera';\nimport { Ionicons } from '@expo/vector-icons';\nimport { BarCodeScanner } from 'expo-barcode-scanner';\nimport { Platform, StyleSheet, TouchableOpacity, View } from 'react-native';\nimport React from 'react';\nimport { ScanInput, ScanOutput } from '@wavemaker/app-rn-runtime/variables/device/scan/scan.operation';\nimport { DisplayManager } from '@wavemaker/app-rn-runtime/core/display.manager';\nimport permissionManager from '@wavemaker/app-rn-runtime/runtime/services/device/permissions';\nimport appDisplayManagerService from '@wavemaker/app-rn-runtime/runtime/services/app-display-manager.service';\n\ninterface objectMap {\n [key: string]: string\n}\n\nconst barcodeFormatOptions: objectMap = {\n 'ALL': 'ALL',\n 'CODABAR': 'codabar',\n 'CODE_39': 'code39',\n 'CODE_93': 'code93',\n 'CODE_128': 'code128',\n 'DATA_MATRIX': 'datamatrix',\n 'EAN_8': 'ean8',\n 'EAN_13': 'ean13',\n 'ITF': 'itf14',\n 'PDF_417': 'pdf417',\n 'QR_CODE': 'qr',\n 'RSS14': 'rss14',\n 'RSS_EXPANDED': 'rssexpanded',\n 'UPC_E': 'upc_e',\n 'UPC_A': 'upc_a'\n};\nconst opacity = 'rgba(0, 0, 0, 0.6)';\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n flexDirection: 'column'\n },\n closeWrapper: {\n flex: 1,\n justifyContent: 'flex-end',\n alignItems: 'center',\n paddingBottom: 32\n },\n topWrapper: {\n flex: 2,\n backgroundColor: opacity\n },\n centerWrapper: {\n flex: 2,\n flexDirection: 'row'\n },\n leftWrapper: {\n flex: 2,\n backgroundColor: opacity\n },\n focused: {\n flex: 10\n },\n rightWrapper: {\n flex: 2,\n backgroundColor: opacity\n },\n bottomWrapper: {\n flex: 2,\n backgroundColor: opacity\n },\n});\n\nexport class ScanService {\n\n constructor(private displayManager: DisplayManager) {}\n\n public scanBarcode(params: ScanInput): Promise<ScanOutput> {\n const format = params?.barcodeFormat || 'ALL';\n const barcodeFormat: string | undefined = Platform.OS === 'ios' ? undefined : barcodeFormatOptions[format];\n return new Promise((resolve, reject) => {\n permissionManager.requestPermissions('camera').then(() => {\n const destroy = this.displayManager.show({\n content: (<Camera\n barCodeScannerSettings={barcodeFormat ? {\n barCodeTypes: [BarCodeScanner.Constants.BarCodeType[barcodeFormat]],\n }: undefined}\n onBarCodeScanned={(result) => {\n destroy.call(this.displayManager);\n resolve(result);\n }}\n style={StyleSheet.absoluteFillObject}\n >\n <View style={styles.topWrapper}>\n </View>\n <View style={styles.centerWrapper}>\n <View style={styles.leftWrapper}/>\n <View style={styles.focused}/>\n <View style={styles.rightWrapper}/>\n </View>\n <View style={styles.bottomWrapper}>\n \n <View style={styles.closeWrapper}>\n <TouchableOpacity\n onPress={() => {\n destroy.call(this.displayManager);\n }}>\n <Ionicons name='close-circle' size={48} color='white' />\n </TouchableOpacity>\n </View>\n </View>\n </Camera>)\n });\n }, reject)\n }).then((response: any) => {\n let format;\n if (response.type) {\n const values = Object.values(BarCodeScanner.Constants.BarCodeType);\n const index = values.indexOf(response.type);\n format = index > -1 ? Object.keys(BarCodeScanner.Constants.BarCodeType)[index] : '';\n }\n return Promise.resolve({\n text: response.data,\n format : format || response.type,\n cancelled : false\n });\n });\n }\n}\nconst scanService = new ScanService(appDisplayManagerService);\nexport default scanService;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,aAAa;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,QAAQ,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAC3E,OAAOC,KAAK,MAAM,OAAO;AAGzB,OAAOC,iBAAiB,MAAM,+DAA+D;AAC7F,OAAOC,wBAAwB,MAAM,wEAAwE;AAM7G,MAAMC,oBAA+B,GA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O,CAACO,IAAI,CAAC,IAAI,CAACnB,cAAc,CAAC;YACnC;UAAE,gBACF,oBAAC,QAAQ;YAAC,IAAI,EAAC,cAAc;YAAC,IAAI,EAAE,EAAG;YAAC,KAAK,EAAC;UAAO,EAAG,CACzC,CAChB,CACF;QAEX,CAAC,CAAC;MACJ,CAAC,EAAES,MAAM,CAAC;IACZ,CAAC,CAAC,CAACE,IAAI,CAAEU,QAAa,IAAK;MACzB,IAAIlB,MAAM;MACV,IAAIkB,QAAQ,CAACC,IAAI,EAAE;QACjB,MAAMC,MAAM,GAAGC,MAAM,CAACD,MAAM,CAACnD,cAAc,CAAC4C,SAAS,CAACC,WAAW,CAAC;QAClE,MAAMQ,KAAK,GAAGF,MAAM,CAACG,OAAO,CAACL,QAAQ,CAACC,IAAI,CAAC;QAC3CnB,MAAM,GAAGsB,KAAK,GAAG,CAAC,CAAC,GAAGD,MAAM,CAACG,IAAI,CAACvD,cAAc,CAAC4C,SAAS,CAACC,WAAW,CAAC,CAACQ,KAAK,CAAC,GAAG,EAAE;MACrF;MACA,OAAOlB,OAAO,CAACC,OAAO,CAAC;QACrBoB,IAAI,EAAEP,QAAQ,CAACQ,IAAI;QACnB1B,MAAM,EAAGA,MAAM,IAAIkB,QAAQ,CAACC,IAAI;QAChCQ,SAAS,EAAG;MACd,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;AACF;AACA,MAAMC,WAAW,GAAG,IAAIjC,WAAW,CAACnB,wBAAwB,CAAC;AAC7D,eAAeoD,WAAW"}
@@ -0,0 +1,259 @@
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
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
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
+ import * as React from 'react';
5
+ import { LinearGradient as ExpoLinearGradient } from 'expo-linear-gradient';
6
+ import { Image, StyleSheet, View } from 'react-native';
7
+ import { isEmpty, isNil, isNumber, isString } from 'lodash-es';
8
+ import imageSizeEstimator from '@wavemaker/app-rn-runtime/core/imageSizeEstimator';
9
+ import { AssetConsumer } from '@wavemaker/app-rn-runtime/core/asset.provider';
10
+ const IMAGE_URL_REGEX = /url\(['|"]?(.+)['|"]?\)$/gi;
11
+ const LINEAT_GRADIENT_REGEX = /linear-gradient\((.+)\)$/gi;
12
+ const BACKGROUND_POSITION_REGEX = /([0-9%]+)[a-z]*\s*([0-9%]+)[a-z]*/g;
13
+ const BACKGROUND_SIZE_REGEX = /([0-9%]+)[a-z]*\s*([0-9%]+)[a-z]*/g;
14
+ export class LinearGradient extends React.Component {
15
+ constructor(props) {
16
+ super(props);
17
+ this.state = this.parse();
18
+ }
19
+ parse() {
20
+ let val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.value;
21
+ let state = {};
22
+ const splits = val.split(',').map(v => v.trim());
23
+ let angle = 0;
24
+ const locations = [];
25
+ if (splits[0].endsWith('deg')) {
26
+ angle = parseInt(splits[0].split('deg')[0]) % 360;
27
+ angle = angle < 0 ? 360 + angle : angle;
28
+ splits.shift();
29
+ }
30
+ angle += 90;
31
+ const delta = Math.round(Math.tan(angle * Math.PI / 180) * 100) / 100;
32
+ if (Math.abs(delta) > 1) {
33
+ state = {
34
+ end: {
35
+ x: -0.5 / delta + 0.5,
36
+ y: 0
37
+ },
38
+ start: {
39
+ x: 0.5 / delta + 0.5,
40
+ y: 1
41
+ }
42
+ };
43
+ } else {
44
+ state = {
45
+ start: {
46
+ x: 0,
47
+ y: -0.5 * delta + 0.5
48
+ },
49
+ end: {
50
+ x: 1,
51
+ y: 0.5 * delta + 0.5
52
+ }
53
+ };
54
+ }
55
+ if (angle >= 270 && angle <= 450) {
56
+ state = {
57
+ start: state.end,
58
+ end: state.start
59
+ };
60
+ }
61
+ state.colors = [];
62
+ state.locations = [];
63
+ splits.map(s => {
64
+ var _s$matchAll$next;
65
+ const p = (_s$matchAll$next = s.matchAll(/\s*([0-9]+)%/g).next()) === null || _s$matchAll$next === void 0 ? void 0 : _s$matchAll$next.value;
66
+ if (p) {
67
+ state.locations.push(parseInt(p[1]) / 100);
68
+ state.colors.push(s.replace(p[0], ''));
69
+ } else {
70
+ state.locations.push(null);
71
+ state.colors.push(s);
72
+ }
73
+ });
74
+ return state;
75
+ }
76
+ componentDidUpdate(prevProps, prevState, snapshot) {
77
+ if (prevProps.value !== this.props.value) {
78
+ this.setState(this.parse());
79
+ }
80
+ }
81
+ render() {
82
+ var _this$props$size, _this$props$style;
83
+ return /*#__PURE__*/React.createElement(View, {
84
+ style: [{
85
+ borderWidth: 0,
86
+ overflow: 'hidden'
87
+ }, StyleSheet.absoluteFill, this.props.style]
88
+ }, /*#__PURE__*/React.createElement(View, {
89
+ style: [StyleSheet.absoluteFill, this.props.middle ? {
90
+ flexDirection: 'row',
91
+ justifyContent: 'center',
92
+ alignItems: 'center'
93
+ } : null]
94
+ }, /*#__PURE__*/React.createElement(ExpoLinearGradient, {
95
+ colors: this.state.colors,
96
+ locations: this.state.locations,
97
+ start: this.state.start,
98
+ end: this.state.end,
99
+ style: [(_this$props$size = this.props.size) !== null && _this$props$size !== void 0 && _this$props$size.width ? this.props.size : StyleSheet.absoluteFill, this.props.position, {
100
+ position: 'absolute',
101
+ borderRadius: (_this$props$style = this.props.style) === null || _this$props$style === void 0 ? void 0 : _this$props$style.borderRadius
102
+ }]
103
+ })), this.props.children);
104
+ }
105
+ }
106
+ export class BackgroundComponent extends React.Component {
107
+ constructor(props) {
108
+ super(props);
109
+ _defineProperty(this, "loadAsset", null);
110
+ this.state = {};
111
+ }
112
+ caluculateSize(imageSrc) {
113
+ if (isNumber(imageSrc)) {
114
+ const {
115
+ width,
116
+ height
117
+ } = Image.resolveAssetSource(imageSrc);
118
+ this.setState({
119
+ naturalImageWidth: width,
120
+ naturalImageHeight: height
121
+ });
122
+ } else if (!isNil(imageSrc)) {
123
+ imageSizeEstimator.getSize(imageSrc.uri, (width, height) => {
124
+ this.setState({
125
+ naturalImageWidth: width,
126
+ naturalImageHeight: height
127
+ });
128
+ });
129
+ }
130
+ }
131
+ getPositionAndSize() {
132
+ var _this$props$size2, _this$getGradient, _this$getGradient$val;
133
+ const result = {};
134
+ if (this.props.resizeMode) {
135
+ result.resizeMode = this.props.resizeMode;
136
+ return result;
137
+ } else if (this.props.position === 'center') {
138
+ result.resizeMode = 'center';
139
+ } else if (this.props.size === 'contain' || this.props.size === 'cover') {
140
+ result.resizeMode = this.props.size;
141
+ return result;
142
+ }
143
+ const size = (_this$props$size2 = this.props.size) === null || _this$props$size2 === void 0 ? void 0 : _this$props$size2.matchAll(BACKGROUND_SIZE_REGEX).next().value;
144
+ result.size = {};
145
+ if (size) {
146
+ result.size.width = size[1].endsWith('%') ? size[1] : parseInt(size[1]);
147
+ result.size.height = size[2].endsWith('%') ? size[2] : parseInt(size[2]);
148
+ }
149
+ if (!result.resizeMode && this.props.position) {
150
+ result.position = {};
151
+ const position = this.props.position.matchAll(BACKGROUND_POSITION_REGEX).next().value;
152
+ result.position.top = position[1].endsWith('%') ? position[1] : parseInt(position[1]);
153
+ result.position.left = position[2].endsWith('%') ? position[2] : parseInt(position[2]);
154
+ }
155
+ if (!((_this$getGradient = this.getGradient()) !== null && _this$getGradient !== void 0 && (_this$getGradient$val = _this$getGradient.value) !== null && _this$getGradient$val !== void 0 && _this$getGradient$val.length)) {
156
+ if (this.props.repeat === 'no-repeat') {
157
+ result.size.width = result.size.width || this.state.naturalImageWidth;
158
+ result.size.height = result.size.height || this.state.naturalImageHeight;
159
+ } else if (this.props.repeat === 'repeat-x') {
160
+ result.resizeMode = 'repeat';
161
+ result.size.width = result.size.width || '100%';
162
+ result.size.height = result.size.height || this.state.naturalImageHeight;
163
+ } else if (this.props.repeat === 'repeat-y') {
164
+ result.resizeMode = 'repeat';
165
+ result.size.width = result.size.width || this.state.naturalImageWidth;
166
+ result.size.height = result.size.height || '100%';
167
+ } else {
168
+ result.resizeMode = 'repeat';
169
+ }
170
+ }
171
+ return result;
172
+ }
173
+ renderLinearGradient(data) {
174
+ const psresult = this.getPositionAndSize();
175
+ return /*#__PURE__*/React.createElement(LinearGradient, {
176
+ value: data || '',
177
+ style: this.props.style,
178
+ size: psresult.size,
179
+ position: psresult.position,
180
+ middle: psresult.resizeMode === 'center'
181
+ });
182
+ }
183
+ componentDidUpdate(prevProps, prevState, snapshot) {
184
+ if (prevProps.image !== this.props.image) {
185
+ this.setImage();
186
+ }
187
+ }
188
+ componentDidMount() {
189
+ setTimeout(() => this.setImage(), 100);
190
+ }
191
+ setImage() {
192
+ var _this$props$image, _source;
193
+ let source = (_this$props$image = this.props.image) === null || _this$props$image === void 0 ? void 0 : _this$props$image.trim();
194
+ if ((_source = source) !== null && _source !== void 0 && _source.startsWith('url')) {
195
+ var _this$props$image2;
196
+ source = (_this$props$image2 = this.props.image) === null || _this$props$image2 === void 0 ? void 0 : _this$props$image2.matchAll(IMAGE_URL_REGEX).next().value[1];
197
+ }
198
+ if (this.loadAsset) {
199
+ source = this.loadAsset(source);
200
+ }
201
+ if (isString(source) && (source.startsWith('data:') || source.startsWith('http') || source.startsWith('file:'))) {
202
+ source = {
203
+ uri: source
204
+ };
205
+ }
206
+ this.caluculateSize(source);
207
+ this.setState({
208
+ imageSrc: source
209
+ });
210
+ }
211
+ getGradient() {
212
+ var _this$props$image3;
213
+ return (_this$props$image3 = this.props.image) === null || _this$props$image3 === void 0 ? void 0 : _this$props$image3.trim().matchAll(LINEAT_GRADIENT_REGEX).next();
214
+ }
215
+ renderImage() {
216
+ const psresult = this.getPositionAndSize();
217
+ return /*#__PURE__*/React.createElement(AssetConsumer, null, loadAsset => {
218
+ this.loadAsset = loadAsset;
219
+ return /*#__PURE__*/React.createElement(View, {
220
+ style: [{
221
+ borderWidth: 0,
222
+ overflow: 'hidden'
223
+ }, StyleSheet.absoluteFill, this.props.style]
224
+ }, /*#__PURE__*/React.createElement(View, {
225
+ style: [StyleSheet.absoluteFill, this.props.position === 'center' ? {
226
+ flexDirection: 'row',
227
+ justifyContent: 'center',
228
+ alignItems: 'center'
229
+ } : null]
230
+ }, /*#__PURE__*/React.createElement(View, {
231
+ style: [{
232
+ position: 'absolute',
233
+ overflow: 'hidden'
234
+ }, psresult.position, isEmpty(psresult.size) ? StyleSheet.absoluteFill : psresult.size]
235
+ }, /*#__PURE__*/React.createElement(Image, {
236
+ source: this.state.imageSrc,
237
+ resizeMode: psresult.resizeMode || 'cover',
238
+ style: [{
239
+ width: '100%',
240
+ height: '100%'
241
+ }, isEmpty(psresult.size) ? {
242
+ minWidth: this.state.naturalImageWidth,
243
+ minHeight: this.state.naturalImageHeight
244
+ } : null]
245
+ }))));
246
+ });
247
+ }
248
+ render() {
249
+ var _gradientData$value;
250
+ const gradientData = this.getGradient();
251
+ if (gradientData !== null && gradientData !== void 0 && (_gradientData$value = gradientData.value) !== null && _gradientData$value !== void 0 && _gradientData$value.length) {
252
+ return this.renderLinearGradient(gradientData.value[1]);
253
+ } else if (this.props.image) {
254
+ return this.renderImage();
255
+ }
256
+ return null;
257
+ }
258
+ }
259
+ //# sourceMappingURL=background.component.js.map