@wavemaker/app-rn-runtime 12.0.0-next.141131 → 12.0.0-next.141138

Sign up to get free protection for your applications and to get access to all the features.
Files changed (321) hide show
  1. app-rn-runtime/components/advanced/carousel/carousel.component.js +32 -5
  2. app-rn-runtime/components/advanced/carousel/carousel.component.js.map +1 -1
  3. app-rn-runtime/components/advanced/carousel/carousel.props.js +1 -0
  4. app-rn-runtime/components/advanced/carousel/carousel.props.js.map +1 -1
  5. app-rn-runtime/components/advanced/carousel/carousel.styles.js +15 -0
  6. app-rn-runtime/components/advanced/carousel/carousel.styles.js.map +1 -1
  7. app-rn-runtime/components/advanced/webview/webview.component.js.map +1 -1
  8. app-rn-runtime/components/basic/anchor/anchor.component.js +15 -5
  9. app-rn-runtime/components/basic/anchor/anchor.component.js.map +1 -1
  10. app-rn-runtime/components/basic/anchor/anchor.styles.js +3 -0
  11. app-rn-runtime/components/basic/anchor/anchor.styles.js.map +1 -1
  12. app-rn-runtime/components/basic/animatedview.component.js +6 -2
  13. app-rn-runtime/components/basic/animatedview.component.js.map +1 -1
  14. app-rn-runtime/components/basic/audio/audio.component.js.map +1 -1
  15. app-rn-runtime/components/basic/button/button.component.js +20 -6
  16. app-rn-runtime/components/basic/button/button.component.js.map +1 -1
  17. app-rn-runtime/components/basic/custom/custom.component.js +1 -1
  18. app-rn-runtime/components/basic/custom/custom.component.js.map +1 -1
  19. app-rn-runtime/components/basic/icon/icon.component.js +14 -6
  20. app-rn-runtime/components/basic/icon/icon.component.js.map +1 -1
  21. app-rn-runtime/components/basic/label/label.component.js +13 -3
  22. app-rn-runtime/components/basic/label/label.component.js.map +1 -1
  23. app-rn-runtime/components/basic/label/label.styles.js.map +1 -1
  24. app-rn-runtime/components/basic/lottie/lottie.component.js +3 -1
  25. app-rn-runtime/components/basic/lottie/lottie.component.js.map +1 -1
  26. app-rn-runtime/components/basic/message/message.component.js.map +1 -1
  27. app-rn-runtime/components/basic/picture/picture.component.js +1 -2
  28. app-rn-runtime/components/basic/picture/picture.component.js.map +1 -1
  29. app-rn-runtime/components/basic/progress-bar/progress-bar.component.js +2 -2
  30. app-rn-runtime/components/basic/progress-bar/progress-bar.component.js.map +1 -1
  31. app-rn-runtime/components/basic/progress-circle/progress-circle.component.js +5 -5
  32. app-rn-runtime/components/basic/progress-circle/progress-circle.component.js.map +1 -1
  33. app-rn-runtime/components/basic/search/search.component.js +10 -1
  34. app-rn-runtime/components/basic/search/search.component.js.map +1 -1
  35. app-rn-runtime/components/basic/search/search.props.js +3 -0
  36. app-rn-runtime/components/basic/search/search.props.js.map +1 -1
  37. app-rn-runtime/components/basic/search/search.styles.js +5 -0
  38. app-rn-runtime/components/basic/search/search.styles.js.map +1 -1
  39. app-rn-runtime/components/basic/skeleton/skeleton.component.js +6 -3
  40. app-rn-runtime/components/basic/skeleton/skeleton.component.js.map +1 -1
  41. app-rn-runtime/components/basic/skeleton/skeleton.props.js +9 -1
  42. app-rn-runtime/components/basic/skeleton/skeleton.props.js.map +1 -1
  43. app-rn-runtime/components/basic/spinner/spinner.component.js +2 -3
  44. app-rn-runtime/components/basic/spinner/spinner.component.js.map +1 -1
  45. app-rn-runtime/components/basic/spinner/spinner.styles.js +3 -2
  46. app-rn-runtime/components/basic/spinner/spinner.styles.js.map +1 -1
  47. app-rn-runtime/components/basic/video/video.component.js.map +1 -1
  48. app-rn-runtime/components/basic/video/video.styles.js +4 -1
  49. app-rn-runtime/components/basic/video/video.styles.js.map +1 -1
  50. app-rn-runtime/components/chart/area-chart/area-chart.component.js +2 -1
  51. app-rn-runtime/components/chart/area-chart/area-chart.component.js.map +1 -1
  52. app-rn-runtime/components/chart/area-chart/area-chart.styles.js +7 -1
  53. app-rn-runtime/components/chart/area-chart/area-chart.styles.js.map +1 -1
  54. app-rn-runtime/components/chart/bar-chart/bar-chart.styles.js +7 -1
  55. app-rn-runtime/components/chart/bar-chart/bar-chart.styles.js.map +1 -1
  56. app-rn-runtime/components/chart/basechart.component.js +54 -2
  57. app-rn-runtime/components/chart/basechart.component.js.map +1 -1
  58. app-rn-runtime/components/chart/basechart.props.js +3 -2
  59. app-rn-runtime/components/chart/basechart.props.js.map +1 -1
  60. app-rn-runtime/components/chart/basechart.styles.js +4 -0
  61. app-rn-runtime/components/chart/basechart.styles.js.map +1 -1
  62. app-rn-runtime/components/chart/bubble-chart/bubble-chart.component.js +15 -3
  63. app-rn-runtime/components/chart/bubble-chart/bubble-chart.component.js.map +1 -1
  64. app-rn-runtime/components/chart/bubble-chart/bubble-chart.styles.js +7 -1
  65. app-rn-runtime/components/chart/bubble-chart/bubble-chart.styles.js.map +1 -1
  66. app-rn-runtime/components/chart/column-chart/column-chart.styles.js +7 -1
  67. app-rn-runtime/components/chart/column-chart/column-chart.styles.js.map +1 -1
  68. app-rn-runtime/components/chart/donut-chart/donut-chart.styles.js +7 -1
  69. app-rn-runtime/components/chart/donut-chart/donut-chart.styles.js.map +1 -1
  70. app-rn-runtime/components/chart/line-chart/line-chart.props.js +2 -0
  71. app-rn-runtime/components/chart/line-chart/line-chart.props.js.map +1 -1
  72. app-rn-runtime/components/chart/line-chart/line-chart.styles.js +7 -1
  73. app-rn-runtime/components/chart/line-chart/line-chart.styles.js.map +1 -1
  74. app-rn-runtime/components/chart/pie-chart/pie-chart.component.js +6 -2
  75. app-rn-runtime/components/chart/pie-chart/pie-chart.component.js.map +1 -1
  76. app-rn-runtime/components/chart/pie-chart/pie-chart.styles.js +7 -1
  77. app-rn-runtime/components/chart/pie-chart/pie-chart.styles.js.map +1 -1
  78. app-rn-runtime/components/chart/stack-chart/stack-chart.component.js +37 -11
  79. app-rn-runtime/components/chart/stack-chart/stack-chart.component.js.map +1 -1
  80. app-rn-runtime/components/container/accordion/accordion.component.js +61 -12
  81. app-rn-runtime/components/container/accordion/accordion.component.js.map +1 -1
  82. app-rn-runtime/components/container/accordion/accordion.props.js.map +1 -1
  83. app-rn-runtime/components/container/accordion/accordion.styles.js +5 -0
  84. app-rn-runtime/components/container/accordion/accordion.styles.js.map +1 -1
  85. app-rn-runtime/components/container/accordion/accordionpane/accordionpane.component.js +11 -1
  86. app-rn-runtime/components/container/accordion/accordionpane/accordionpane.component.js.map +1 -1
  87. app-rn-runtime/components/container/container.component.js +44 -3
  88. app-rn-runtime/components/container/container.component.js.map +1 -1
  89. app-rn-runtime/components/container/container.props.js +1 -0
  90. app-rn-runtime/components/container/container.props.js.map +1 -1
  91. app-rn-runtime/components/container/container.styles.js +7 -0
  92. app-rn-runtime/components/container/container.styles.js.map +1 -1
  93. app-rn-runtime/components/container/layoutgrid/gridcolumn/gridcolumn.component.js.map +1 -1
  94. app-rn-runtime/components/container/layoutgrid/gridrow/gridrow.component.js +5 -1
  95. app-rn-runtime/components/container/layoutgrid/gridrow/gridrow.component.js.map +1 -1
  96. app-rn-runtime/components/container/layoutgrid/gridrow/gridrow.styles.js +6 -1
  97. app-rn-runtime/components/container/layoutgrid/gridrow/gridrow.styles.js.map +1 -1
  98. app-rn-runtime/components/container/layoutgrid/layoutgrid.component.js +28 -2
  99. app-rn-runtime/components/container/layoutgrid/layoutgrid.component.js.map +1 -1
  100. app-rn-runtime/components/container/layoutgrid/layoutgrid.props.js.map +1 -1
  101. app-rn-runtime/components/container/layoutgrid/layoutgrid.styles.js +4 -1
  102. app-rn-runtime/components/container/layoutgrid/layoutgrid.styles.js.map +1 -1
  103. app-rn-runtime/components/container/linearlayout/linearlayout.component.js +31 -5
  104. app-rn-runtime/components/container/linearlayout/linearlayout.component.js.map +1 -1
  105. app-rn-runtime/components/container/linearlayout/linearlayout.props.js.map +1 -1
  106. app-rn-runtime/components/container/linearlayout/linearlayout.styles.js +4 -1
  107. app-rn-runtime/components/container/linearlayout/linearlayout.styles.js.map +1 -1
  108. app-rn-runtime/components/container/panel/panel.component.js +47 -6
  109. app-rn-runtime/components/container/panel/panel.component.js.map +1 -1
  110. app-rn-runtime/components/container/panel/panel.props.js.map +1 -1
  111. app-rn-runtime/components/container/panel/panel.styles.js +3 -0
  112. app-rn-runtime/components/container/panel/panel.styles.js.map +1 -1
  113. app-rn-runtime/components/container/partial-host.component.js.map +1 -1
  114. app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js +3 -4
  115. app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js.map +1 -1
  116. app-rn-runtime/components/container/tabs/tabheader/tabheader.props.js.map +1 -1
  117. app-rn-runtime/components/container/tabs/tabpane/tabpane.component.js +11 -1
  118. app-rn-runtime/components/container/tabs/tabpane/tabpane.component.js.map +1 -1
  119. app-rn-runtime/components/container/tabs/tabpane/tabpane.props.js +1 -0
  120. app-rn-runtime/components/container/tabs/tabpane/tabpane.props.js.map +1 -1
  121. app-rn-runtime/components/container/tabs/tabs.component.js +44 -6
  122. app-rn-runtime/components/container/tabs/tabs.component.js.map +1 -1
  123. app-rn-runtime/components/container/tabs/tabs.props.js.map +1 -1
  124. app-rn-runtime/components/container/tabs/tabs.styles.js +4 -1
  125. app-rn-runtime/components/container/tabs/tabs.styles.js.map +1 -1
  126. app-rn-runtime/components/container/tile/tile.component.js +28 -2
  127. app-rn-runtime/components/container/tile/tile.component.js.map +1 -1
  128. app-rn-runtime/components/container/tile/tile.props.js.map +1 -1
  129. app-rn-runtime/components/container/tile/tile.styles.js +6 -1
  130. app-rn-runtime/components/container/tile/tile.styles.js.map +1 -1
  131. app-rn-runtime/components/container/wizard/wizard.component.js +62 -13
  132. app-rn-runtime/components/container/wizard/wizard.component.js.map +1 -1
  133. app-rn-runtime/components/container/wizard/wizard.props.js.map +1 -1
  134. app-rn-runtime/components/container/wizard/wizard.styles.js +3 -0
  135. app-rn-runtime/components/container/wizard/wizard.styles.js.map +1 -1
  136. app-rn-runtime/components/container/wizard/wizardstep/wizardstep.component.js +4 -1
  137. app-rn-runtime/components/container/wizard/wizardstep/wizardstep.component.js.map +1 -1
  138. app-rn-runtime/components/data/card/card-content/card-content.component.js +6 -2
  139. app-rn-runtime/components/data/card/card-content/card-content.component.js.map +1 -1
  140. app-rn-runtime/components/data/card/card-content/card-content.styles.js +4 -1
  141. app-rn-runtime/components/data/card/card-content/card-content.styles.js.map +1 -1
  142. app-rn-runtime/components/data/card/card.component.js +18 -0
  143. app-rn-runtime/components/data/card/card.component.js.map +1 -1
  144. app-rn-runtime/components/data/card/card.styles.js +3 -0
  145. app-rn-runtime/components/data/card/card.styles.js.map +1 -1
  146. app-rn-runtime/components/data/form/form-field/form-field.component.js.map +1 -1
  147. app-rn-runtime/components/data/form/form.component.js +1 -1
  148. app-rn-runtime/components/data/form/form.component.js.map +1 -1
  149. app-rn-runtime/components/data/form/form.props.js +1 -0
  150. app-rn-runtime/components/data/form/form.props.js.map +1 -1
  151. app-rn-runtime/components/data/list/list-template/list-template.component.js +15 -1
  152. app-rn-runtime/components/data/list/list-template/list-template.component.js.map +1 -1
  153. app-rn-runtime/components/data/list/list-template/list-template.props.js +1 -0
  154. app-rn-runtime/components/data/list/list-template/list-template.props.js.map +1 -1
  155. app-rn-runtime/components/data/list/list-template/list-template.styles.js +11 -1
  156. app-rn-runtime/components/data/list/list-template/list-template.styles.js.map +1 -1
  157. app-rn-runtime/components/data/list/list.component.js +54 -33
  158. app-rn-runtime/components/data/list/list.component.js.map +1 -1
  159. app-rn-runtime/components/data/list/list.props.js +1 -0
  160. app-rn-runtime/components/data/list/list.props.js.map +1 -1
  161. app-rn-runtime/components/data/list/list.styles.js +9 -0
  162. app-rn-runtime/components/data/list/list.styles.js.map +1 -1
  163. app-rn-runtime/components/dialogs/dialog/dialog.component.js +5 -3
  164. app-rn-runtime/components/dialogs/dialog/dialog.component.js.map +1 -1
  165. app-rn-runtime/components/dialogs/dialog/dialog.styles.js.map +1 -1
  166. app-rn-runtime/components/input/basedataset/basedataset.component.js.map +1 -1
  167. app-rn-runtime/components/input/baseinput/baseinput.component.js +57 -14
  168. app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
  169. app-rn-runtime/components/input/baseinput/baseinput.props.js +1 -0
  170. app-rn-runtime/components/input/baseinput/baseinput.props.js.map +1 -1
  171. app-rn-runtime/components/input/basenumber/basenumber.component.js +40 -14
  172. app-rn-runtime/components/input/basenumber/basenumber.component.js.map +1 -1
  173. app-rn-runtime/components/input/basenumber/basenumber.props.js +2 -0
  174. app-rn-runtime/components/input/basenumber/basenumber.props.js.map +1 -1
  175. app-rn-runtime/components/input/checkbox/checkbox.component.js +7 -8
  176. app-rn-runtime/components/input/checkbox/checkbox.component.js.map +1 -1
  177. app-rn-runtime/components/input/checkbox/checkbox.styles.js +3 -1
  178. app-rn-runtime/components/input/checkbox/checkbox.styles.js.map +1 -1
  179. app-rn-runtime/components/input/checkboxset/checkboxset.component.js +24 -3
  180. app-rn-runtime/components/input/checkboxset/checkboxset.component.js.map +1 -1
  181. app-rn-runtime/components/input/checkboxset/checkboxset.props.js +1 -0
  182. app-rn-runtime/components/input/checkboxset/checkboxset.props.js.map +1 -1
  183. app-rn-runtime/components/input/checkboxset/checkboxset.styles.js +1 -0
  184. app-rn-runtime/components/input/checkboxset/checkboxset.styles.js.map +1 -1
  185. app-rn-runtime/components/input/chips/chips.component.js +3 -2
  186. app-rn-runtime/components/input/chips/chips.component.js.map +1 -1
  187. app-rn-runtime/components/input/currency/currency.component.js +19 -2
  188. app-rn-runtime/components/input/currency/currency.component.js.map +1 -1
  189. app-rn-runtime/components/input/currency/currency.styles.js +6 -1
  190. app-rn-runtime/components/input/currency/currency.styles.js.map +1 -1
  191. app-rn-runtime/components/input/epoch/base-datetime.component.js +26 -8
  192. app-rn-runtime/components/input/epoch/base-datetime.component.js.map +1 -1
  193. app-rn-runtime/components/input/epoch/wheel-date-picker.component.js +123 -12
  194. app-rn-runtime/components/input/epoch/wheel-date-picker.component.js.map +1 -1
  195. app-rn-runtime/components/input/epoch/wheelpicker/wheelpicker.component.js.map +1 -1
  196. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.component.js +4 -0
  197. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.component.js.map +1 -1
  198. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.props.js +2 -0
  199. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.props.js.map +1 -1
  200. app-rn-runtime/components/input/fileupload/fileupload.component.js +4 -2
  201. app-rn-runtime/components/input/fileupload/fileupload.component.js.map +1 -1
  202. app-rn-runtime/components/input/fileupload/fileupload.props.js +1 -0
  203. app-rn-runtime/components/input/fileupload/fileupload.props.js.map +1 -1
  204. app-rn-runtime/components/input/number/number.component.js +9 -4
  205. app-rn-runtime/components/input/number/number.component.js.map +1 -1
  206. app-rn-runtime/components/input/number/number.styles.js +3 -0
  207. app-rn-runtime/components/input/number/number.styles.js.map +1 -1
  208. app-rn-runtime/components/input/radioset/radioset.component.js +39 -14
  209. app-rn-runtime/components/input/radioset/radioset.component.js.map +1 -1
  210. app-rn-runtime/components/input/radioset/radioset.props.js +2 -0
  211. app-rn-runtime/components/input/radioset/radioset.props.js.map +1 -1
  212. app-rn-runtime/components/input/radioset/radioset.styles.js +7 -0
  213. app-rn-runtime/components/input/radioset/radioset.styles.js.map +1 -1
  214. app-rn-runtime/components/input/select/select.component.js +23 -9
  215. app-rn-runtime/components/input/select/select.component.js.map +1 -1
  216. app-rn-runtime/components/input/switch/switch.component.js +2 -2
  217. app-rn-runtime/components/input/switch/switch.component.js.map +1 -1
  218. app-rn-runtime/components/input/text/text.component.js +26 -2
  219. app-rn-runtime/components/input/text/text.component.js.map +1 -1
  220. app-rn-runtime/components/input/text/text.props.js +3 -0
  221. app-rn-runtime/components/input/text/text.props.js.map +1 -1
  222. app-rn-runtime/components/input/text/text.styles.js +3 -0
  223. app-rn-runtime/components/input/text/text.styles.js.map +1 -1
  224. app-rn-runtime/components/input/textarea/textarea.component.js +24 -1
  225. app-rn-runtime/components/input/textarea/textarea.component.js.map +1 -1
  226. app-rn-runtime/components/input/textarea/textarea.props.js +2 -0
  227. app-rn-runtime/components/input/textarea/textarea.props.js.map +1 -1
  228. app-rn-runtime/components/input/textarea/textarea.styles.js +3 -0
  229. app-rn-runtime/components/input/textarea/textarea.styles.js.map +1 -1
  230. app-rn-runtime/components/input/toggle/toggle.component.js +2 -4
  231. app-rn-runtime/components/input/toggle/toggle.component.js.map +1 -1
  232. app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js +2 -2
  233. app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js.map +1 -1
  234. app-rn-runtime/components/navigation/basenav/basenav.component.js.map +1 -1
  235. app-rn-runtime/components/navigation/navitem/navitem.component.js +2 -3
  236. app-rn-runtime/components/navigation/navitem/navitem.component.js.map +1 -1
  237. app-rn-runtime/components/navigation/popover/popover.component.js.map +1 -1
  238. app-rn-runtime/components/page/content/content.component.js.map +1 -1
  239. app-rn-runtime/components/page/left-panel/left-panel.component.js +4 -1
  240. app-rn-runtime/components/page/left-panel/left-panel.component.js.map +1 -1
  241. app-rn-runtime/components/page/page-content/page-content.component.js +70 -14
  242. app-rn-runtime/components/page/page-content/page-content.component.js.map +1 -1
  243. app-rn-runtime/components/page/page-content/page-content.props.js +2 -2
  244. app-rn-runtime/components/page/page-content/page-content.props.js.map +1 -1
  245. app-rn-runtime/components/page/page-content/page-content.styles.js +6 -1
  246. app-rn-runtime/components/page/page-content/page-content.styles.js.map +1 -1
  247. app-rn-runtime/components/page/page.component.js.map +1 -1
  248. app-rn-runtime/components/page/page.props.js.map +1 -1
  249. app-rn-runtime/components/page/page.styles.js +7 -1
  250. app-rn-runtime/components/page/page.styles.js.map +1 -1
  251. app-rn-runtime/components/page/partial/partial.component.js +27 -1
  252. app-rn-runtime/components/page/partial/partial.component.js.map +1 -1
  253. app-rn-runtime/components/page/partial/partial.props.js.map +1 -1
  254. app-rn-runtime/components/page/partial/partial.styles.js +6 -1
  255. app-rn-runtime/components/page/partial/partial.styles.js.map +1 -1
  256. app-rn-runtime/components/page/tabbar/curve.js.map +1 -1
  257. app-rn-runtime/components/page/tabbar/tabbar.component.js.map +1 -1
  258. app-rn-runtime/components/page/tabbar/tabbar.props.js +1 -0
  259. app-rn-runtime/components/page/tabbar/tabbar.props.js.map +1 -1
  260. app-rn-runtime/components/prefab/prefab-container.component.js +27 -1
  261. app-rn-runtime/components/prefab/prefab-container.component.js.map +1 -1
  262. app-rn-runtime/components/prefab/prefab-container.props.js.map +1 -1
  263. app-rn-runtime/components/prefab/prefab-container.styles.js +6 -1
  264. app-rn-runtime/components/prefab/prefab-container.styles.js.map +1 -1
  265. app-rn-runtime/core/AppConfig.js.map +1 -1
  266. app-rn-runtime/core/base.component.js +35 -7
  267. app-rn-runtime/core/base.component.js.map +1 -1
  268. app-rn-runtime/core/components/textinput.component.js +13 -10
  269. app-rn-runtime/core/components/textinput.component.js.map +1 -1
  270. app-rn-runtime/core/formatters.js.map +1 -1
  271. app-rn-runtime/core/key.extractor.js.map +1 -1
  272. app-rn-runtime/core/props.provider.js +4 -1
  273. app-rn-runtime/core/props.provider.js.map +1 -1
  274. app-rn-runtime/core/storage.service.js +15 -0
  275. app-rn-runtime/core/storage.service.js.map +1 -1
  276. app-rn-runtime/core/tappable.component.js +34 -27
  277. app-rn-runtime/core/tappable.component.js.map +1 -1
  278. app-rn-runtime/core/ui-preferences.context.js +7 -0
  279. app-rn-runtime/core/ui-preferences.context.js.map +1 -0
  280. app-rn-runtime/core/utils.js +87 -4
  281. app-rn-runtime/core/utils.js.map +1 -1
  282. app-rn-runtime/core/wm-component-tree.js +58 -0
  283. app-rn-runtime/core/wm-component-tree.js.map +1 -0
  284. app-rn-runtime/package.json +39 -9
  285. app-rn-runtime/runtime/App.js +21 -10
  286. app-rn-runtime/runtime/App.js.map +1 -1
  287. app-rn-runtime/runtime/App.navigator.js +1 -0
  288. app-rn-runtime/runtime/App.navigator.js.map +1 -1
  289. app-rn-runtime/runtime/base-fragment.component.js +61 -13
  290. app-rn-runtime/runtime/base-fragment.component.js.map +1 -1
  291. app-rn-runtime/runtime/base-page.component.js +10 -0
  292. app-rn-runtime/runtime/base-page.component.js.map +1 -1
  293. app-rn-runtime/runtime/base-partial.component.js +3 -0
  294. app-rn-runtime/runtime/base-partial.component.js.map +1 -1
  295. app-rn-runtime/runtime/base-prefab.component.js.map +1 -1
  296. app-rn-runtime/runtime/navigator/drawer.navigator.js +19 -10
  297. app-rn-runtime/runtime/navigator/drawer.navigator.js.map +1 -1
  298. app-rn-runtime/runtime/navigator/stack.navigator.js.map +1 -1
  299. app-rn-runtime/runtime/services/app-i18n.service.js +10 -0
  300. app-rn-runtime/runtime/services/app-i18n.service.js.map +1 -1
  301. app-rn-runtime/runtime/services/app-security.service.js +42 -2
  302. app-rn-runtime/runtime/services/app-security.service.js.map +1 -1
  303. app-rn-runtime/runtime/services/app-spinner.service.js +1 -1
  304. app-rn-runtime/runtime/services/app-spinner.service.js.map +1 -1
  305. app-rn-runtime/runtime/services/webprocess.service.js.map +1 -1
  306. app-rn-runtime/runtime/watcher.js.map +1 -1
  307. app-rn-runtime/styles/background.component.js +1 -0
  308. app-rn-runtime/styles/background.component.js.map +1 -1
  309. app-rn-runtime/styles/style-prop.validator.js.map +1 -1
  310. app-rn-runtime/styles/theme.js +10 -0
  311. app-rn-runtime/styles/theme.js.map +1 -1
  312. app-rn-runtime/styles/theme.variables.js +2 -1
  313. app-rn-runtime/styles/theme.variables.js.map +1 -1
  314. app-rn-runtime/variables/base-variable.js.map +1 -1
  315. app-rn-runtime/variables/device/file/upload-file.operation.js.map +1 -1
  316. app-rn-runtime/variables/device-variable.js.map +1 -1
  317. app-rn-runtime/variables/http.service.js +5 -1
  318. app-rn-runtime/variables/http.service.js.map +1 -1
  319. app-rn-runtime/variables/live-variable.js +14 -0
  320. app-rn-runtime/variables/live-variable.js.map +1 -1
  321. app-rn-runtime/variables/service-variable.js.map +1 -1
@@ -23,6 +23,7 @@ const WmCursor = /*#__PURE__*/React.memo(props => {
23
23
  runAnimation();
24
24
  }, []);
25
25
  return /*#__PURE__*/React.createElement(Animated.View, {
26
+ testID: "wm-custom-cursor",
26
27
  style: {
27
28
  backgroundColor: props.color,
28
29
  width: 2,
@@ -33,9 +34,8 @@ const WmCursor = /*#__PURE__*/React.memo(props => {
33
34
  });
34
35
  });
35
36
  export const WMTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
36
- var _props$floatingLabel;
37
+ var _props$customDisplayV, _props$floatingLabel;
37
38
  const [selectRange, setSelectRange] = useState(null);
38
- const [isInputFocused, setIsInputFocused] = useState(false);
39
39
  const [iMask, setIMask] = useState(null);
40
40
  const [displayCursor, setDisplayCursor] = useState(false);
41
41
  const value = useRef(props.value || '');
@@ -123,17 +123,17 @@ export const WMTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
123
123
  }, [iMask, value, displayValue, props.onChangeText]);
124
124
  const valueExpr = Platform.OS === 'web' ? 'value' : 'defaultValue';
125
125
  const opts = {};
126
- opts[valueExpr] = value.current;
126
+ opts[valueExpr] = (_props$customDisplayV = props.customDisplayValue) !== null && _props$customDisplayV !== void 0 ? _props$customDisplayV : value.current;
127
127
  const textStyle = Object.assign({}, ...(isArray(props.style) ? props.style : [props.style]));
128
128
  const hideInput = props.displayformat || props.maskchar;
129
- return /*#__PURE__*/React.createElement(React.Fragment, null, props.floatingLabel ? /*#__PURE__*/React.createElement(FloatingLabel, {
130
- moveUp: !!(value.current || isInputFocused || displayValue),
129
+ return /*#__PURE__*/React.createElement(React.Fragment, null, props.background, props.floatingLabel ? /*#__PURE__*/React.createElement(FloatingLabel, {
130
+ moveUp: !!(value.current || props.isInputFocused || displayValue),
131
131
  label: (_props$floatingLabel = props.floatingLabel) !== null && _props$floatingLabel !== void 0 ? _props$floatingLabel : props.placeholder,
132
132
  style: {
133
133
  ...(props.floatingLabelStyle || []),
134
- ...(isInputFocused ? props.activeFloatingLabelStyle || {} : {})
134
+ ...(props.isInputFocused ? props.activeFloatingLabelStyle || {} : {})
135
135
  }
136
- }) : null, /*#__PURE__*/React.createElement(TextInput, _extends({}, props, hideInput ? opts : {}, {
136
+ }) : null, /*#__PURE__*/React.createElement(TextInput, _extends({}, props, hideInput || props.customDisplayValue ? opts : {}, {
137
137
  placeholder: props.floatingLabel || displayValue ? '' : props.placeholder,
138
138
  style: [props.style, hideInput ? {
139
139
  color: 'transparent',
@@ -144,14 +144,12 @@ export const WMTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
144
144
  onFocus: e => {
145
145
  var _props$onFocus;
146
146
  (_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 || _props$onFocus.call(props, e);
147
- setIsInputFocused(true);
148
147
  setDisplayCursor(true);
149
148
  element.current = e.target;
150
149
  },
151
150
  onBlur: e => {
152
151
  var _props$onBlur;
153
152
  props === null || props === void 0 || (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
154
- setIsInputFocused(false);
155
153
  setDisplayCursor(false);
156
154
  },
157
155
  ref: ref,
@@ -159,6 +157,10 @@ export const WMTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
159
157
  onSelectionChange: onSelectionChange,
160
158
  caretHidden: !!(selectRange !== null && selectRange !== void 0 && selectRange.end),
161
159
  onChangeText: text => {
160
+ if (props.autoCapitalize && props.autoCapitalize === 'characters') {
161
+ onChangeText(text.toUpperCase());
162
+ return;
163
+ }
162
164
  onChangeText(text);
163
165
  }
164
166
  }, hideInput ? {
@@ -166,7 +168,8 @@ export const WMTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
166
168
  cursorColor: 'transparent',
167
169
  onChange: () => {}
168
170
  } : {}, {
169
- contextMenuHidden: !props.allowContentSelection
171
+ contextMenuHidden: !props.allowContentSelection,
172
+ autoCapitalize: props.autoCapitalize
170
173
  })), hideInput ? /*#__PURE__*/React.createElement(View, {
171
174
  style: [props.style, {
172
175
  display: 'flex',
@@ -1 +1 @@
1
- {"version":3,"names":["React","useCallback","useEffect","useRef","useState","Animated","Platform","Text","TextInput","View","isArray","IMask","FloatingLabel","WmCursor","memo","props","opacityAnimation","Value","current","runAnimation","timing","toValue","duration","useNativeDriver","start","createElement","style","backgroundColor","color","width","marginHorizontal","height","opacity","WMTextInput","forwardRef","ref","_props$floatingLabel","selectRange","setSelectRange","isInputFocused","setIsInputFocused","iMask","setIMask","displayCursor","setDisplayCursor","value","x","forceUpdate","displayValue","setDisplayValue","element","displayformat","MaskedPattern","mask","skipInvalid","lazy","definitions","typedValue","defaultValue","onChangeText","setTimeout","OS","maskchar","_element$current","setSelectionRange","length","onSelectionChange","e","_e$nativeEvent","selection","nativeEvent","allowContentSelection","end","text","_value","substring","slice","formattedValue","replace","valueExpr","opts","textStyle","Object","assign","hideInput","Fragment","floatingLabel","moveUp","label","placeholder","floatingLabelStyle","activeFloatingLabelStyle","_extends","borderColor","zIndex","onFocus","_props$onFocus","call","target","onBlur","_props$onBlur","caretHidden","selectionColor","cursorColor","onChange","contextMenuHidden","display","flexDirection","alignItems","marginTop","minHeight","undefined","padding","fontFamily","fontSize","fontWeight"],"sources":["textinput.component.tsx"],"sourcesContent":["import React, { ForwardedRef, useCallback, useEffect, useRef, useState } from 'react';\nimport { Animated, Platform, Text, TextInput, TextInputProps, TextStyle, View } from 'react-native';\nimport { isArray } from 'lodash';\nimport IMask from 'imask';\nimport { FloatingLabel } from './floatinglabel.component';\n\ninterface SelectRange {\n start: number,\n end: number\n}\n\nconst WmCursor = React.memo((props: {\n color: string,\n height: number\n}) => {\n const opacityAnimation = useRef(new Animated.Value(0.5)).current;\n const runAnimation = useCallback(() => {\n Animated.timing(opacityAnimation, {\n toValue: 0.2,\n duration: 500,\n useNativeDriver: true\n }).start(() => {\n Animated.timing(opacityAnimation, {\n toValue: 0.6,\n duration: 500,\n useNativeDriver: true\n }).start(runAnimation);\n });\n }, []);\n useEffect(() => {\n runAnimation();\n }, []);\n return (\n <Animated.View style={{\n backgroundColor: props.color,\n width: 2,\n marginHorizontal: 1,\n height: props.height,\n opacity: opacityAnimation\n }}></Animated.View>\n );\n});\n\nexport const WMTextInput = React.forwardRef((props: (TextInputProps & \n {allowContentSelection: boolean,\n displayformat: string,\n maskchar: string,\n floatingLabel: string\n floatingLabelStyle: TextStyle,\n activeFloatingLabelStyle: TextStyle\n }), \n ref: ForwardedRef<TextInput>) => {\n const [selectRange, setSelectRange] = useState<SelectRange>(null as any);\n const [isInputFocused, setIsInputFocused] = useState(false);\n const [iMask, setIMask] = useState(null as any);\n const [displayCursor, setDisplayCursor] = useState(false);\n const value = useRef(props.value || '');\n const [x, forceUpdate] = useState(1);\n const [displayValue, setDisplayValue] = useState('');\n const element = useRef(null as any);\n // iMask initialization\n useEffect(() => {\n const iMask: any = props.displayformat ? new IMask.MaskedPattern({\n mask: props.displayformat,\n skipInvalid: true,\n lazy: false,\n definitions: {\n '9': /\\d/,\n 'A': /[a-zA-Z]/,\n 'a': /[a-z]/,\n '*': /\\w/\n }\n }) : null;\n if (iMask) {\n iMask.typedValue = value;\n setDisplayValue(iMask.displayValue)\n setIMask(iMask);\n }\n },[props.displayformat]);\n // set default value\n useEffect(() => {\n const defaultValue = props.defaultValue || props.value || '';\n if (defaultValue && !value.current) {\n value.current = defaultValue;\n onChangeText(defaultValue);\n }\n },[props.defaultValue, props.value]);\n // set cursor position in windows\n useEffect(() => {\n setTimeout(() => {\n if (Platform.OS === 'web' && (props.displayformat || props.maskchar)) {\n element?.current?.setSelectionRange(value.current.length, value.current.length);\n }\n }, 100);\n }, [value.current, props]);\n const onSelectionChange = useCallback((e: any) => {\n if (Platform.OS !== 'android') {\n return;\n }\n const selection = e?.nativeEvent?.selection;\n if (!props.allowContentSelection\n && selection\n && selection.end - selection.start > 0) {\n setSelectRange({\n start: value.current.length + 2,\n end: value.current.length + 2\n });\n } else if (selectRange && selectRange.end > 0){\n setSelectRange(null as any);\n }\n }, [props.allowContentSelection, value]);\n // when text changes\n const onChangeText = useCallback((text: string) => {\n if (!(iMask || props.maskchar)) {\n value.current = text;\n props.onChangeText && props.onChangeText(text);\n return;\n }\n let _value = value.current || '';\n if (value.current.length - text.length > 0) {\n _value = _value.substring(0, _value.length - (value.current.length - text.length));\n } else if (text.length - value.current.length > 0) {\n _value += text.slice(-1 * (text.length - value.current.length));\n }\n let formattedValue = _value;\n if(props.maskchar) {\n formattedValue = (_value.replace(/./g, props.maskchar));\n }\n if (iMask) {\n iMask.typedValue = _value;\n formattedValue = iMask.displayValue;\n }\n if (formattedValue !== displayValue) {\n value.current = _value;\n props.onChangeText && props.onChangeText(_value);\n }\n forceUpdate(x+ 1);\n setDisplayValue(formattedValue);\n }, [iMask, value, displayValue, props.onChangeText]);\n const valueExpr = Platform.OS === 'web' ? 'value' : 'defaultValue';\n const opts = {} as any;\n opts[valueExpr] = value.current;\n const textStyle = Object.assign({}, ...isArray(props.style) ? props.style: [props.style]);\n const hideInput = props.displayformat || props.maskchar;\n return (\n <>\n {props.floatingLabel ? (\n <FloatingLabel\n moveUp={!!(value.current || isInputFocused || displayValue)}\n label={props.floatingLabel ?? props.placeholder} \n style={{\n ...(props.floatingLabelStyle || []),\n ...(isInputFocused ? (props.activeFloatingLabelStyle || {}) : {})\n }}/>\n ) : null}\n <TextInput\n {...props}\n {...hideInput ? opts: {}}\n placeholder={props.floatingLabel || displayValue ? '' : props.placeholder }\n style={[props.style, hideInput ? {\n color: 'transparent', \n backgroundColor: 'transparent',\n borderColor: 'transparent',\n zIndex: 1\n } : {}]}\n onFocus={(e) => {\n props.onFocus?.(e);\n setIsInputFocused(true);\n setDisplayCursor(true);\n element.current = e.target;\n }}\n onBlur={(e) => {\n props?.onBlur?.(e);\n setIsInputFocused(false);\n setDisplayCursor(false);\n }}\n ref={ref}\n selection={selectRange}\n onSelectionChange={onSelectionChange}\n caretHidden={!!selectRange?.end}\n onChangeText={(text) => {\n onChangeText(text);\n }}\n {...hideInput ? {\n selectionColor: 'transparent',\n cursorColor: 'transparent',\n onChange : () => {}\n }: {}}\n contextMenuHidden={!props.allowContentSelection}\n ></TextInput>\n {\n hideInput ? (\n <View style={[props.style, {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n marginTop: -1 * (textStyle.height || textStyle.minHeight || 0)\n + (textStyle.marginTop || 0)}]}>\n <Text style={{ \n width: undefined,\n backgroundColor: 'transparent', \n borderColor: 'transparent',\n padding: 0,\n display: 'flex',\n color: textStyle.color,\n fontFamily: textStyle.fontFamily,\n fontSize: textStyle.fontSize,\n fontWeight: textStyle.fontWeight\n }}>\n {displayValue}\n </Text>\n {\n (displayCursor && !props.displayformat) ? React.createElement(WmCursor, {\n color: textStyle.color || '#000000',\n height: textStyle.fontSize || 14\n }) : null\n }\n </View>\n ) : null\n }\n </>\n );\n});"],"mappings":";AAAA,OAAOA,KAAK,IAAkBC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACrF,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,SAAS,EAA6BC,IAAI,QAAQ,cAAc;AACnG,SAASC,OAAO,QAAQ,QAAQ;AAChC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAQ,2BAA2B;AAOzD,MAAMC,QAAQ,gBAAGb,KAAK,CAACc,IAAI,CAAEC,KAG5B,IAAK;EACJ,MAAMC,gBAAgB,GAAGb,MAAM,CAAC,IAAIE,QAAQ,CAACY,KAAK,CAAC,GAAG,CAAC,CAAC,CAACC,OAAO;EAChE,MAAMC,YAAY,GAAGlB,WAAW,CAAC,MAAM;IACrCI,QAAQ,CAACe,MAAM,CAACJ,gBAAgB,EAAE;MAChCK,OAAO,EAAE,GAAG;MACZC,QAAQ,EAAE,GAAG;MACbC,eAAe,EAAE;IACnB,CAAC,CAAC,CAACC,KAAK,CAAC,MAAM;MACbnB,QAAQ,CAACe,MAAM,CAACJ,gBAAgB,EAAE;QAChCK,OAAO,EAAE,GAAG;QACZC,QAAQ,EAAE,GAAG;QACbC,eAAe,EAAE;MACnB,CAAC,CAAC,CAACC,KAAK,CAACL,YAAY,CAAC;IACxB,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EACNjB,SAAS,CAAC,MAAM;IACdiB,YAAY,CAAC,CAAC;EAChB,CAAC,EAAE,EAAE,CAAC;EACN,oBACEnB,KAAA,CAA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I;IAACmB,KAAK,EAAE;MACXG,KAAK,EAAEkF,SAAS;MAChBpF,eAAe,EAAE,aAAa;MAC9BkE,WAAW,EAAE,aAAa;MAC1BmB,OAAO,EAAE,CAAC;MACVN,OAAO,EAAE,MAAM;MACf9E,KAAK,EAAEqD,SAAS,CAACrD,KAAK;MACtBqF,UAAU,EAAEhC,SAAS,CAACgC,UAAU;MAChCC,QAAQ,EAAEjC,SAAS,CAACiC,QAAQ;MAC5BC,UAAU,EAAElC,SAAS,CAACkC;IACtB;EAAE,GACDnE,YACG,CAAC,EAEJL,aAAa,IAAI,CAAC5B,KAAK,CAACoC,aAAa,gBAAInD,KAAK,CAACyB,aAAa,CAACZ,QAAQ,EAAE;IACtEe,KAAK,EAAEqD,SAAS,CAACrD,KAAK,IAAI,SAAS;IACnCG,MAAM,EAAEkD,SAAS,CAACiC,QAAQ,IAAI;EAChC,CAAC,CAAC,GAAG,IAEH,CAAC,GACL,IAEN,CAAC;AAET,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useCallback","useEffect","useRef","useState","Animated","Platform","Text","TextInput","View","isArray","IMask","FloatingLabel","WmCursor","memo","props","opacityAnimation","Value","current","runAnimation","timing","toValue","duration","useNativeDriver","start","createElement","testID","style","backgroundColor","color","width","marginHorizontal","height","opacity","WMTextInput","forwardRef","ref","_props$customDisplayV","_props$floatingLabel","selectRange","setSelectRange","iMask","setIMask","displayCursor","setDisplayCursor","value","x","forceUpdate","displayValue","setDisplayValue","element","displayformat","MaskedPattern","mask","skipInvalid","lazy","definitions","typedValue","defaultValue","onChangeText","setTimeout","OS","maskchar","_element$current","setSelectionRange","length","onSelectionChange","e","_e$nativeEvent","selection","nativeEvent","allowContentSelection","end","text","_value","substring","slice","formattedValue","replace","valueExpr","opts","customDisplayValue","textStyle","Object","assign","hideInput","Fragment","background","floatingLabel","moveUp","isInputFocused","label","placeholder","floatingLabelStyle","activeFloatingLabelStyle","_extends","borderColor","zIndex","onFocus","_props$onFocus","call","target","onBlur","_props$onBlur","caretHidden","autoCapitalize","toUpperCase","selectionColor","cursorColor","onChange","contextMenuHidden","display","flexDirection","alignItems","marginTop","minHeight","undefined","padding","fontFamily","fontSize","fontWeight"],"sources":["textinput.component.tsx"],"sourcesContent":["import React, { ForwardedRef, useCallback, useEffect, useRef, useState } from 'react';\nimport { Animated, Platform, Text, TextInput, TextInputProps, TextStyle, View } from 'react-native';\nimport { isArray } from 'lodash';\nimport IMask from 'imask';\nimport { FloatingLabel } from './floatinglabel.component';\n\ninterface SelectRange {\n start: number,\n end: number\n}\n\nconst WmCursor = React.memo((props: {\n color: string,\n height: number\n}) => {\n const opacityAnimation = useRef(new Animated.Value(0.5)).current;\n const runAnimation = useCallback(() => {\n Animated.timing(opacityAnimation, {\n toValue: 0.2,\n duration: 500,\n useNativeDriver: true\n }).start(() => {\n Animated.timing(opacityAnimation, {\n toValue: 0.6,\n duration: 500,\n useNativeDriver: true\n }).start(runAnimation);\n });\n }, []);\n useEffect(() => {\n runAnimation();\n }, []);\n return (\n <Animated.View \n testID=\"wm-custom-cursor\"\n style={{\n backgroundColor: props.color,\n width: 2,\n marginHorizontal: 1,\n height: props.height,\n opacity: opacityAnimation\n }}></Animated.View>\n );\n});\n\nexport const WMTextInput = React.forwardRef((props: (TextInputProps & \n {allowContentSelection: boolean,\n displayformat: string,\n maskchar: string,\n floatingLabel: string\n floatingLabelStyle: TextStyle,\n activeFloatingLabelStyle: TextStyle,\n customDisplayValue?: string,\n isInputFocused: boolean\n autoCapitalize?: string,\n background?: React.ReactNode\n }), \n ref: ForwardedRef<TextInput>) => {\n const [selectRange, setSelectRange] = useState<SelectRange>(null as any);\n const [iMask, setIMask] = useState(null as any);\n const [displayCursor, setDisplayCursor] = useState(false);\n const value = useRef(props.value || '');\n const [x, forceUpdate] = useState(1);\n const [displayValue, setDisplayValue] = useState('');\n const element = useRef(null as any);\n // iMask initialization\n useEffect(() => {\n const iMask: any = props.displayformat ? new IMask.MaskedPattern({\n mask: props.displayformat,\n skipInvalid: true,\n lazy: false,\n definitions: {\n '9': /\\d/,\n 'A': /[a-zA-Z]/,\n 'a': /[a-z]/,\n '*': /\\w/\n }\n }) : null;\n if (iMask) {\n iMask.typedValue = value;\n setDisplayValue(iMask.displayValue)\n setIMask(iMask);\n }\n },[props.displayformat]);\n // set default value\n useEffect(() => {\n const defaultValue = props.defaultValue || props.value || '';\n if (defaultValue && !value.current) {\n value.current = defaultValue;\n onChangeText(defaultValue);\n }\n },[props.defaultValue, props.value]);\n // set cursor position in windows\n useEffect(() => {\n setTimeout(() => {\n if (Platform.OS === 'web' && (props.displayformat || props.maskchar)) {\n element?.current?.setSelectionRange(value.current.length, value.current.length);\n }\n }, 100);\n }, [value.current, props]);\n const onSelectionChange = useCallback((e: any) => {\n if (Platform.OS !== 'android') {\n return;\n }\n const selection = e?.nativeEvent?.selection;\n if (!props.allowContentSelection\n && selection\n && selection.end - selection.start > 0) {\n setSelectRange({\n start: value.current.length + 2,\n end: value.current.length + 2\n });\n } else if (selectRange && selectRange.end > 0){\n setSelectRange(null as any);\n }\n }, [props.allowContentSelection, value]);\n // when text changes\n const onChangeText = useCallback((text: string) => {\n if (!(iMask || props.maskchar)) {\n value.current = text;\n props.onChangeText && props.onChangeText(text);\n return;\n }\n let _value = value.current || '';\n if (value.current.length - text.length > 0) {\n _value = _value.substring(0, _value.length - (value.current.length - text.length));\n } else if (text.length - value.current.length > 0) {\n _value += text.slice(-1 * (text.length - value.current.length));\n }\n let formattedValue = _value;\n if(props.maskchar) {\n formattedValue = (_value.replace(/./g, props.maskchar));\n }\n if (iMask) {\n iMask.typedValue = _value;\n formattedValue = iMask.displayValue;\n }\n if (formattedValue !== displayValue) {\n value.current = _value;\n props.onChangeText && props.onChangeText(_value);\n }\n forceUpdate(x+ 1);\n setDisplayValue(formattedValue);\n }, [iMask, value, displayValue, props.onChangeText]);\n const valueExpr = Platform.OS === 'web' ? 'value' : 'defaultValue';\n const opts = {} as any;\n opts[valueExpr] = props.customDisplayValue ?? value.current;\n const textStyle = Object.assign({}, ...isArray(props.style) ? props.style: [props.style]);\n const hideInput = props.displayformat || props.maskchar;\n return (\n <>\n {props.background}\n {props.floatingLabel ? (\n <FloatingLabel\n moveUp={!!(value.current || props.isInputFocused || displayValue)}\n label={props.floatingLabel ?? props.placeholder} \n style={{\n ...(props.floatingLabelStyle || []),\n ...(props.isInputFocused ? (props.activeFloatingLabelStyle || {}) : {})\n }}/>\n ) : null}\n <TextInput\n {...props}\n {...hideInput || props.customDisplayValue ? opts: {}}\n placeholder={props.floatingLabel || displayValue ? '' : props.placeholder }\n style={[props.style, hideInput ? {\n color: 'transparent', \n backgroundColor: 'transparent',\n borderColor: 'transparent',\n zIndex: 1\n } : {}]}\n onFocus={(e) => {\n props.onFocus?.(e);\n setDisplayCursor(true);\n element.current = e.target;\n }}\n onBlur={(e) => {\n props?.onBlur?.(e);\n setDisplayCursor(false);\n }}\n ref={ref}\n selection={selectRange}\n onSelectionChange={onSelectionChange}\n caretHidden={!!selectRange?.end}\n onChangeText={(text) => {\n if(props.autoCapitalize && props.autoCapitalize === 'characters') {\n onChangeText(text.toUpperCase());\n return;\n }\n onChangeText(text);\n }}\n {...hideInput ? {\n selectionColor: 'transparent',\n cursorColor: 'transparent',\n onChange : () => {}\n }: {}}\n contextMenuHidden={!props.allowContentSelection}\n autoCapitalize={props.autoCapitalize}\n ></TextInput>\n {\n hideInput ? (\n <View style={[props.style, {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n marginTop: -1 * (textStyle.height || textStyle.minHeight || 0)\n + (textStyle.marginTop || 0)}]}>\n <Text style={{ \n width: undefined,\n backgroundColor: 'transparent', \n borderColor: 'transparent',\n padding: 0,\n display: 'flex',\n color: textStyle.color,\n fontFamily: textStyle.fontFamily,\n fontSize: textStyle.fontSize,\n fontWeight: textStyle.fontWeight\n }}>\n {displayValue}\n </Text>\n {\n (displayCursor && !props.displayformat) ? React.createElement(WmCursor, {\n color: textStyle.color || '#000000',\n height: textStyle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E,gBACjClH,KAAA,CAAAyB,aAAA,CAAClB,IAAI;IAACoB,KAAK,EAAE;MACXG,KAAK,EAAEsF,SAAS;MAChBxF,eAAe,EAAE,aAAa;MAC9BoE,WAAW,EAAE,aAAa;MAC1BqB,OAAO,EAAE,CAAC;MACVN,OAAO,EAAE,MAAM;MACflF,KAAK,EAAEqD,SAAS,CAACrD,KAAK;MACtByF,UAAU,EAAEpC,SAAS,CAACoC,UAAU;MAChCC,QAAQ,EAAErC,SAAS,CAACqC,QAAQ;MAC5BC,UAAU,EAAEtC,SAAS,CAACsC;IACtB;EAAE,GACDxE,YACG,CAAC,EAEJL,aAAa,IAAI,CAAC5B,KAAK,CAACoC,aAAa,gBAAInD,KAAK,CAACyB,aAAa,CAACZ,QAAQ,EAAE;IACtEgB,KAAK,EAAEqD,SAAS,CAACrD,KAAK,IAAI,SAAS;IACnCG,MAAM,EAAEkD,SAAS,CAACqC,QAAQ,IAAI;EAChC,CAAC,CAAC,GAAG,IAEH,CAAC,GACL,IAEN,CAAC;AAET,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["parseInt","moment","CURRENCY_INFO","injector","DateToStringFormatter","format","input","replaceAll","_moment","ISO_8601","Math","floor","valueOf","toString","utc","isValid","PrependFormatter","prefix","undefined","AppendFormatter","suffix","NumberToStringFormatter","fractionSize","i18nService","I18nService","get","selectedLocale","getSelectedLocale","formatCurrency","Intl","NumberFormat","minimumFractionDigits","maximumFractionDigits","isNaN","CurrencyFormatter","data","currencySymbol","fracSize","_currencySymbol","symbol","_val","isNegativeNumber","startsWith","replace","TimeFromNowFormatter","timestamp","fromNow","StringToNumberFormatter","createFormatter","key","defaultFormatter","params","output","customFormatter","formatters","Map"],"sources":["formatters.ts"],"sourcesContent":["import { parseInt } from 'lodash';\nimport moment from 'moment';\nimport { CURRENCY_INFO, Currency } from './constants/currency-constants';\nimport { DateFormatter } from '@wavemaker/variables/src/types/date-formatter';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\n\nexport interface Formatter {\n format: (input: any, ...params: any) => any;\n}\n\nexport class DateToStringFormatter implements DateFormatter {\n public format(input: Date, format: string): string {\n \n if (!input) return '';\n\n format = format.replaceAll('y', 'Y').replaceAll('d', 'D').replaceAll('E','d');\n let _moment = moment(input, [\n moment.ISO_8601,\n \"YYYY\",\n \"YYYY-MM\",\n \"YYYYMMDD\",\n \"YYYY-MM-DD\",\n \"YYYY-MM-DDTHH\",\n \"YYYY-MM-DDTHH:mm\",\n \"YYYY-MM-DDTHH:mm:ss\",\n \"YYYY-MM-DDTHH:mm:ss.SSS\",\n \"YYYY-MM-DD HH:mm:ss\",\n \"MM/DD/YYYY\",\n \"MM-DD-YYYY\",\n \"YYYY/MM/DD\",\n \"YYYY/MM\",\n \"D MMM YYYY\",\n \"MMM D YYYY\",\n \"MMMM D YYYY\",\n \"D MMMM YYYY\",\n \"D-MMM-YYYY\",\n \"D/MMM/YYYY\",\n \"YYYY-WWW\", \n \"YYYY-WWW-E\",\n \"YYYY-DDD\",\n \"YYYY-DDDTHH\",\n \"YYYY-DDDTHH:mm\",\n \"YYYY-DDDTHH:mm:ss\",\n \"YYYY-DDDTHH:mm:ss.SSS\",\n \"YYYY-DDD HH:mm:ss\",\n \"YYYY-MM-DDTHH:mm:ssZ\",\n \"YYYY-MM-DDTHH:mm:ss+00:00\",\n \"YYYY-MM-DDTHH:mm:ss-00:00\",\n \"YYYY-MM-DDTHH:mm:ss.SSSZ\",\n \"YYYY-MM-DDTHH:mm:ss.SSS+00:00\",\n \"YYYY-MM-DDTHH:mm:ss.SSS-00:00\",\n \"ddd, DD MMM YYYY HH:mm:ss ZZ\",\n \"DD MMM YYYY HH:mm:ss ZZ\",\n ], true);\n\n if (format === 'timestamp')\n return Math.floor(_moment.valueOf() / 1000).toString();\n\n if (format === 'UTC')\n return moment.utc(input).toString();\n\n return _moment.isValid() ? _moment.format(format) : input.toString();\n }\n}\n\nexport class PrependFormatter implements Formatter {\n\n public format(input: any, prefix: string): string {\n return (prefix || '') + (input !== null || input != undefined ? input : '');\n }\n}\n\nexport class AppendFormatter implements Formatter {\n\n public format(input: any, suffix: string): string {\n return (input !== null || input != undefined ? input : '') + (suffix || '');\n }\n}\n\nexport class NumberToStringFormatter implements Formatter {\n\n public format(input: number, fractionSize: number): string {\n const i18nService = injector.I18nService.get();\n const selectedLocale = i18nService.getSelectedLocale();\n let formatCurrency = new Intl.NumberFormat(selectedLocale,{\n minimumFractionDigits: fractionSize,\n maximumFractionDigits: fractionSize,\n });\n return isNaN(input) ? '': formatCurrency.format(input);\n }\n}\n\nexport class CurrencyFormatter implements Formatter {\n\n public format(data: number, currencySymbol: string, fracSize: number) {\n const _currencySymbol = ((((CURRENCY_INFO as any)[currencySymbol]) || {}) as Currency).symbol || currencySymbol || '';\n let _val = new NumberToStringFormatter().format(data, fracSize);\n const isNegativeNumber = _val.startsWith('-');\n if (isNegativeNumber) {\n _val = _val.replace('-','');\n }\n return _val ? isNegativeNumber ? '-'+ _currencySymbol +_val :_currencySymbol + _val : '';\n }\n}\n\nexport class TimeFromNowFormatter implements Formatter {\n public format(timestamp: Date) {\n return timestamp ? moment(timestamp).fromNow() : undefined;\n }\n}\n\nexport class StringToNumberFormatter implements Formatter {\n public format(input: string) {\n return parseInt(input);\n }\n}\n\nconst createFormatter = (key: string, defaultFormatter: Formatter) => {\n return {\n format: (input: any, ...params: any) => {\n const output = defaultFormatter.format(input, ...params);\n const customFormatter = formatters.get(`custom.${key}`);\n return customFormatter ? customFormatter.format(output, ...params): output;\n }\n };\n};\n\nconst formatters = new Map<string, Formatter>([\n ['numberToString', createFormatter('numberToString' , new NumberToStringFormatter())],\n ['prefix', createFormatter('prefix', new PrependFormatter())],\n ['suffix', createFormatter('suffix', new AppendFormatter())],\n ['stringToNumber', createFormatter('stringToNumber',new StringToNumberFormatter())],\n ['timeFromNow', createFormatter('timeFromNow', new TimeFromNowFormatter())],\n ['toDate', createFormatter('toDate', new DateToStringFormatter())],\n ['toCurrency', create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1C,CAAC,gBAAgB,EAAEP,eAAe,CAAC,gBAAgB,EAAG,IAAI3B,uBAAuB,CAAC,CAAC,CAAC,CAAC,EACrF,CAAC,QAAQ,EAAE2B,eAAe,CAAC,QAAQ,EAAE,IAAIhC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAC7D,CAAC,QAAQ,EAAEgC,eAAe,CAAC,QAAQ,EAAE,IAAI7B,eAAe,CAAC,CAAC,CAAC,CAAC,EAC5D,CAAC,gBAAgB,EAAE6B,eAAe,CAAC,gBAAgB,EAAC,IAAID,uBAAuB,CAAC,CAAC,CAAC,CAAC,EACnF,CAAC,aAAa,EAAEC,eAAe,CAAC,aAAa,EAAE,IAAIJ,oBAAoB,CAAC,CAAC,CAAC,CAAC,EAC3E,CAAC,QAAQ,EAAEI,eAAe,CAAC,QAAQ,EAAE,IAAI5C,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAClE,CAAC,YAAY,EAAE4C,eAAe,CAAC,YAAY,EAAE,IAAId,iBAAiB,CAAC,CAAC,CAAC,CAAC,CACzE,CAAC;AAEF,eAAeoB,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["parseInt","moment","CURRENCY_INFO","injector","DateToStringFormatter","format","input","replaceAll","_moment","ISO_8601","Math","floor","valueOf","toString","utc","isValid","PrependFormatter","prefix","undefined","AppendFormatter","suffix","NumberToStringFormatter","fractionSize","i18nService","I18nService","get","selectedLocale","getSelectedLocale","formatCurrency","Intl","NumberFormat","minimumFractionDigits","maximumFractionDigits","isNaN","CurrencyFormatter","data","currencySymbol","fracSize","_currencySymbol","symbol","_val","isNegativeNumber","startsWith","replace","TimeFromNowFormatter","timestamp","fromNow","StringToNumberFormatter","createFormatter","key","defaultFormatter","params","output","customFormatter","formatters","Map"],"sources":["formatters.ts"],"sourcesContent":["import { parseInt } from 'lodash';\nimport moment from 'moment';\nimport { CURRENCY_INFO, Currency } from './constants/currency-constants';\nimport { DateFormatter } from '@wavemaker/variables/src/types/date-formatter';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\n\nexport interface Formatter {\n format: (input: any, ...params: any) => any;\n}\n\nexport class DateToStringFormatter implements DateFormatter {\n public format(input: Date, format: string): string {\n \n if (!input) return '';\n\n format = format.replaceAll('y', 'Y').replaceAll('d', 'D').replaceAll('E','d');\n let _moment = moment(input, [\n moment.ISO_8601,\n \"YYYY\",\n \"YYYY-MM\",\n \"YYYYMMDD\",\n \"YYYY-MM-DD\",\n \"YYYY-MM-DDTHH\",\n \"YYYY-MM-DDTHH:mm\",\n \"YYYY-MM-DDTHH:mm:ss\",\n \"YYYY-MM-DDTHH:mm:ss.SSS\",\n \"YYYY-MM-DD HH:mm:ss\",\n \"MM/DD/YYYY\",\n \"MM-DD-YYYY\",\n \"YYYY/MM/DD\",\n \"YYYY/MM\",\n \"D MMM YYYY\",\n \"MMM D YYYY\",\n \"MMMM D YYYY\",\n \"D MMMM YYYY\",\n \"D-MMM-YYYY\",\n \"D/MMM/YYYY\",\n \"YYYY-WWW\", \n \"YYYY-WWW-E\",\n \"YYYY-DDD\",\n \"YYYY-DDDTHH\",\n \"YYYY-DDDTHH:mm\",\n \"YYYY-DDDTHH:mm:ss\",\n \"YYYY-DDDTHH:mm:ss.SSS\",\n \"YYYY-DDD HH:mm:ss\",\n \"YYYY-MM-DDTHH:mm:ssZ\",\n \"YYYY-MM-DDTHH:mm:ss+00:00\",\n \"YYYY-MM-DDTHH:mm:ss-00:00\",\n \"YYYY-MM-DDTHH:mm:ss.SSSZ\",\n \"YYYY-MM-DDTHH:mm:ss.SSS+00:00\",\n \"YYYY-MM-DDTHH:mm:ss.SSS-00:00\",\n \"ddd, DD MMM YYYY HH:mm:ss ZZ\",\n \"DD MMM YYYY HH:mm:ss ZZ\",\n ], true);\n\n if (format === 'timestamp')\n return Math.floor(_moment.valueOf() / 1000).toString();\n\n if (format === 'UTC')\n return moment.utc(input).toString();\n\n return _moment.isValid() ? _moment.format(format) : input.toString();\n }\n}\n\nexport class PrependFormatter implements Formatter {\n\n public format(input: any, prefix: string): string {\n return (prefix || '') + (input !== null || input != undefined ? input : '');\n }\n}\n\nexport class AppendFormatter implements Formatter {\n\n public format(input: any, suffix: string): string {\n return (input !== null || input != undefined ? input : '') + (suffix || '');\n }\n}\n\nexport class NumberToStringFormatter implements Formatter {\n\n public format(input: number, fractionSize: number): string {\n const i18nService = injector.I18nService.get();\n const selectedLocale = i18nService.getSelectedLocale();\n let formatCurrency = new Intl.NumberFormat(selectedLocale,{\n minimumFractionDigits: fractionSize,\n maximumFractionDigits: fractionSize,\n });\n return isNaN(input) ? '': formatCurrency.format(input);\n }\n}\n\nexport class CurrencyFormatter implements Formatter {\n\n public format(data: number, currencySymbol: string, fracSize: number) {\n const _currencySymbol = ((((CURRENCY_INFO as any)[currencySymbol]) || {}) as Currency).symbol || currencySymbol || '';\n let _val = new NumberToStringFormatter().format(data, fracSize);\n const isNegativeNumber = _val.startsWith('-');\n if (isNegativeNumber) {\n _val = _val.replace('-','');\n }\n return _val ? isNegativeNumber ? '-'+ _currencySymbol +_val :_currencySymbol + _val : '';\n }\n}\n\nexport class TimeFromNowFormatter implements Formatter {\n public format(timestamp: Date) {\n return timestamp ? moment(timestamp).fromNow() : undefined;\n }\n}\n\nexport class StringToNumberFormatter implements Formatter {\n public format(input: string) {\n return parseInt(input);\n }\n}\n\nconst createFormatter = (key: string, defaultFormatter: Formatter) => {\n return {\n format: (input: any, ...params: any) => {\n const output = defaultFormatter.format(input, ...params);\n const customFormatter = formatters.get(`custom.${key}`);\n return customFormatter ? customFormatter.format(output, ...params): output;\n }\n };\n};\n\nconst formatters = new Map<string, Formatter>([\n ['numberToString', createFormatter('numberToString' , new NumberToStringFormatter())],\n ['prefix', createFormatter('prefix', new PrependFormatter())],\n ['suffix', createFormatter('suffix', new AppendFormatter())],\n ['stringToNumber', createFormatter('stringToNumber',new StringToNumberFormatter())],\n ['timeFromNow', createFormatter('timeFromNow', new TimeFromNowFormatter())],\n ['toDate', createFormatter('toDate', new DateToStringFormatter())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AAG,CAAoB,CAC1C,CAAC,gBAAgB,EAAEP,eAAe,CAAC,gBAAgB,EAAG,IAAI3B,uBAAuB,CAAC,CAAC,CAAC,CAAC,EACrF,CAAC,QAAQ,EAAE2B,eAAe,CAAC,QAAQ,EAAE,IAAIhC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAC7D,CAAC,QAAQ,EAAEgC,eAAe,CAAC,QAAQ,EAAE,IAAI7B,eAAe,CAAC,CAAC,CAAC,CAAC,EAC5D,CAAC,gBAAgB,EAAE6B,eAAe,CAAC,gBAAgB,EAAC,IAAID,uBAAuB,CAAC,CAAC,CAAC,CAAC,EACnF,CAAC,aAAa,EAAEC,eAAe,CAAC,aAAa,EAAE,IAAIJ,oBAAoB,CAAC,CAAC,CAAC,CAAC,EAC3E,CAAC,QAAQ,EAAEI,eAAe,CAAC,QAAQ,EAAE,IAAI5C,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAClE,CAAC,YAAY,EAAE4C,eAAe,CAAC,YAAY,EAAE,IAAId,iBAAiB,CAAC,CAAC,CAAC,CAAC,CACzE,CAAC;AAEF,eAAeoB,UAAU","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["DefaultKeyExtractor","constructor","_defineProperty","Map","getKey","o","create","k","store","get","Date","now","nextKey","set","clear"],"sources":["key.extractor.ts"],"sourcesContent":["export class DefaultKeyExtractor {\n store = new Map<any, string>();\n nextKey = 1;\n \n getKey(o : any, create = false) {\n let k = this.store.get(o);\n if (!k && create) {\n k = `key:${Date.now()}:${this.nextKey++}`;\n this.store.set(o, k)\n }\n return k;\n }\n \n clear() {\n this.store = new Map();\n }\n}"],"mappings":";;;AAAA,OAAO,MAAMA,mBAAmB,CAAC;EAAAC,YAAA;IAAAC,eAAA,gBACrB,IAAIC,GAAG,CAAc,CAAC;IAAAD,eAAA,kBACpB,CAAC;EAAA;EAEXE,MAAMA,CAACC,CAAO,EAAEC,MAAM,GAAG,KAAK,EAAE;IAC9B,IAAIC,CAAC,GAAG,IAAI,CAACC,KAAK,CAACC,GAAG,CAACJ,CAAC,CAAC;IACzB,IAAI,CAACE,CAAC,IAAID,MAAM,EAAE;MAChBC,CAAC,GAAI,OAAMG,IAAI,CAACC,GAAG,CAAC,CAAE,IAAG,IAAI,CAACC,OAAO,EAAG,EAAC;MACzC,IAAI,CAACJ,KAAK,CAACK,GAAG,CAACR,CAAC,EAAEE,CAAC,CAAC;IACtB;IACA,OAAOA,CAAC;EACV;EAEAO,KAAKA,CAAA,EAAG;IACN,IAAI,CAACN,KAAK,GAAG,IAAIL,GAAG,CAAC,CAAC;EACxB;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["DefaultKeyExtractor","constructor","_defineProperty","Map","getKey","o","create","k","store","get","Date","now","nextKey","set","clear"],"sources":["key.extractor.ts"],"sourcesContent":["export class DefaultKeyExtractor {\n store = new Map<any, string>();\n nextKey = 1;\n \n getKey(o : any, create = false) {\n let k = this.store.get(o);\n if (!k && create) {\n k = `key:${Date.now()}:${this.nextKey++}`;\n this.store.set(o, k)\n }\n return k;\n }\n \n clear() {\n this.store = new Map();\n }\n}"],"mappings":";;;AAAA,OAAO,MAAMA,mBAAmB,CAAC;EAAAC,YAAA;IAAAC,eAAA,gBACrB,IAAIC,GAAG,CAAc,CAAC;IAAAD,eAAA,kBACpB,CAAC;EAAA;EAEXE,MAAMA,CAACC,CAAO,EAAEC,MAAM,GAAG,KAAK,EAAE;IAC9B,IAAIC,CAAC,GAAG,IAAI,CAACC,KAAK,CAACC,GAAG,CAACJ,CAAC,CAAC;IACzB,IAAI,CAACE,CAAC,IAAID,MAAM,EAAE;MAChBC,CAAC,GAAG,OAAOG,IAAI,CAACC,GAAG,CAAC,CAAC,IAAI,IAAI,CAACC,OAAO,EAAE,EAAE;MACzC,IAAI,CAACJ,KAAK,CAACK,GAAG,CAACR,CAAC,EAAEE,CAAC,CAAC;IACtB;IACA,OAAOA,CAAC;EACV;EAEAO,KAAKA,CAAA,EAAG;IACN,IAAI,CAACN,KAAK,GAAG,IAAIL,GAAG,CAAC,CAAC;EACxB;AACJ","ignoreList":[]}
@@ -46,6 +46,10 @@ export class PropsProvider {
46
46
  setDefault(propName, value) {
47
47
  this.defaultProps[propName] = value;
48
48
  }
49
+ overrideProp(propName, value) {
50
+ this.overriddenProps[propName] = value;
51
+ this.isDirty = true;
52
+ }
49
53
  check(nextProps) {
50
54
  if (!nextProps) {
51
55
  nextProps = assign({}, this.defaultProps, this.initprops);
@@ -68,7 +72,6 @@ export class PropsProvider {
68
72
 
69
73
  // sets the property. But, value gets overriden when the original prop changes.
70
74
  set(name, value) {
71
- this.oldProps[name] = value;
72
75
  const oldValue = this.oldProps[name];
73
76
  if (oldValue !== value) {
74
77
  this.oldProps[name] = value;
@@ -1 +1 @@
1
- {"version":3,"names":["assign","isNil","PropsProvider","constructor","defaultProps","initprops","onChange","name","$new","$old","_defineProperty","Object","keys","forEach","k","propertyNames","propsProxy","Proxy","get","target","prop","receiver","propName","toString","value","overriddenProps","hasOwnProperty","oldProps","set","has","isDirty","oldValue","setDefault","check","nextProps","result","reduce","b","flag"],"sources":["props.provider.ts"],"sourcesContent":["import { assign, isNil } from \"lodash-es\";\nimport { BaseProps } from \"./base.component\";\n\nexport class PropsProvider<T extends BaseProps> {\n private oldProps: any = {};\n private overriddenProps: any = {};\n private propsProxy: T;\n private isDirty = false;\n private propertyNames = {} as any;\n\n constructor(private defaultProps: T, private initprops: T, private onChange = (name: string, $new: any, $old: any) => {}) {\n this.initprops = this.initprops || {};\n Object.keys(defaultProps).forEach(k => this.propertyNames[k] = true);\n Object.keys(initprops).forEach(k => this.propertyNames[k] = true);\n //@ts-ignore\n this.propsProxy = (new Proxy({}, {\n get: (target, prop, receiver): any => {\n const propName = prop.toString();\n let value = (this.defaultProps as any)[propName];\n if (this.overriddenProps.hasOwnProperty(propName)) {\n value = this.overriddenProps[propName];\n } else if (this.oldProps.hasOwnProperty(propName)) {\n value = this.oldProps[propName];\n }\n return value;\n },\n set: (target: any, prop, value: any): any => {\n const propName = prop.toString();\n if (!this.has(propName)) {\n return true;\n }\n this.isDirty = this.isDirty || this.overriddenProps[propName] !== value;\n this.overriddenProps[propName] = value;\n if (this.oldProps[propName] !== value) {\n const oldValue = this.oldProps[propName];\n this.onChange(propName, value, oldValue);\n this.oldProps[propName] = value;\n }\n return true;\n }\n }));\n }\n\n setDefault(propName: string, value: any) {\n (this.defaultProps as any)[propName] = value;\n }\n\n check(nextProps?: T) {\n if (!nextProps) {\n nextProps = assign({}, this.defaultProps, this.initprops);\n }\n const result = Object.keys(nextProps).reduce((b, k) => {\n let flag = false;\n //@ts-ignore\n const value = nextProps[k];\n const oldValue = this.oldProps[k];\n if (isNil(this.overriddenProps[k])\n && (!this.oldProps.hasOwnProperty(k)\n || this.oldProps[k] !== value)) {\n this.oldProps[k] = value;\n this.onChange(k, value, oldValue);\n flag = true;\n }\n return b || flag;\n }, false) || this.isDirty;\n\n this.isDirty = false;\n return result;\n }\n\n // sets the property. But, value gets overriden when the original prop changes.\n set(name: string, value: any) {\n this.oldProps[name] = value;\n const oldValue = this.oldProps[name];\n if(oldValue !== value) {\n this.oldProps[name] = value;\n this.onChange(name, value, oldValue);\n }\n }\n\n has(propName: string) {\n return !!this.propertyNames[propName];\n }\n\n get() {\n return this.propsProxy;\n }\n}\n"],"mappings":";;;AAAA,SAASA,MAAM,EAAEC,KAAK,QAAQ,WAAW;AAGzC,OAAO,MAAMC,aAAa,CAAsB;EAO5CC,WAAWA,CAASC,YAAe,EAAUC,SAAY,EAAUC,QAAQ,GAAGA,CAACC,IAAY,EAAEC,IAAS,EAAEC,IAAS,KAAK,CAAC,CAAC,EAAE;IAAA,KAAtGL,YAAe,GAAfA,YAAe;IAAA,KAAUC,SAAY,GAAZA,SAAY;IAAA,KAAUC,QAAQ,GAARA,QAAQ;IAAAI,eAAA,mBANnD,CAAC,CAAC;IAAAA,eAAA,0BACK,CAAC,CAAC;IAAAA,eAAA;IAAAA,eAAA,kBAEf,KAAK;IAAAA,eAAA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EAAEO,QAAQ,CAAC;QACjCO,IAAI,GAAG,IAAI;MACf;MACA,OAAOD,CAAC,IAAIC,IAAI;IACpB,CAAC,EAAE,KAAK,CAAC,IAAI,IAAI,CAACR,OAAO;IAE3B,IAAI,CAACA,OAAO,GAAG,KAAK;IACpB,OAAOK,MAAM;EACf;;EAEA;EACAP,GAAGA,CAACrB,IAAY,EAAEiB,KAAU,EAAE;IAC1B,IAAI,CAACG,QAAQ,CAACpB,IAAI,CAAC,GAAGiB,KAAK;IAC3B,MAAMO,QAAQ,GAAG,IAAI,CAACJ,QAAQ,CAACpB,IAAI,CAAC;IACpC,IAAGwB,QAAQ,KAAKP,KAAK,EAAE;MACnB,IAAI,CAACG,QAAQ,CAACpB,IAAI,CAAC,GAAGiB,KAAK;MAC3B,IAAI,CAAClB,QAAQ,CAACC,IAAI,EAAEiB,KAAK,EAAEO,QAAQ,CAAC;IACxC;EACJ;EAEAF,GAAGA,CAACP,QAAgB,EAAE;IAClB,OAAO,CAAC,CAAC,IAAI,CAACP,aAAa,CAACO,QAAQ,CAAC;EACzC;EAEAJ,GAAGA,CAAA,EAAG;IACF,OAAO,IAAI,CAACF,UAAU;EAC1B;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["assign","isNil","PropsProvider","constructor","defaultProps","initprops","onChange","name","$new","$old","_defineProperty","Object","keys","forEach","k","propertyNames","propsProxy","Proxy","get","target","prop","receiver","propName","toString","value","overriddenProps","hasOwnProperty","oldProps","set","has","isDirty","oldValue","setDefault","overrideProp","check","nextProps","result","reduce","b","flag"],"sources":["props.provider.ts"],"sourcesContent":["import { assign, isNil } from \"lodash-es\";\nimport { BaseProps } from \"./base.component\";\n\nexport class PropsProvider<T extends BaseProps> {\n private oldProps: any = {};\n private overriddenProps: any = {};\n private propsProxy: T;\n private isDirty = false;\n private propertyNames = {} as any;\n\n constructor(private defaultProps: T, private initprops: T, private onChange = (name: string, $new: any, $old: any) => {}) {\n this.initprops = this.initprops || {};\n Object.keys(defaultProps).forEach(k => this.propertyNames[k] = true);\n Object.keys(initprops).forEach(k => this.propertyNames[k] = true);\n //@ts-ignore\n this.propsProxy = (new Proxy({}, {\n get: (target, prop, receiver): any => {\n const propName = prop.toString();\n let value = (this.defaultProps as any)[propName];\n if (this.overriddenProps.hasOwnProperty(propName)) {\n value = this.overriddenProps[propName];\n } else if (this.oldProps.hasOwnProperty(propName)) {\n value = this.oldProps[propName];\n }\n return value;\n },\n set: (target: any, prop, value: any): any => {\n const propName = prop.toString();\n if (!this.has(propName)) {\n return true;\n }\n this.isDirty = this.isDirty || this.overriddenProps[propName] !== value;\n this.overriddenProps[propName] = value;\n if (this.oldProps[propName] !== value) {\n const oldValue = this.oldProps[propName];\n this.onChange(propName, value, oldValue);\n this.oldProps[propName] = value;\n }\n return true;\n }\n }));\n }\n\n setDefault(propName: string, value: any) {\n (this.defaultProps as any)[propName] = value;\n }\n overrideProp(propName: string, value: any) {\n (this.overriddenProps as any)[propName] = value;\n this.isDirty = true;\n }\n\n check(nextProps?: T) {\n if (!nextProps) {\n nextProps = assign({}, this.defaultProps, this.initprops);\n }\n const result = Object.keys(nextProps).reduce((b, k) => {\n let flag = false;\n //@ts-ignore\n const value = nextProps[k];\n const oldValue = this.oldProps[k];\n if (isNil(this.overriddenProps[k])\n && (!this.oldProps.hasOwnProperty(k)\n || this.oldProps[k] !== value)) {\n this.oldProps[k] = value;\n this.onChange(k, value, oldValue);\n flag = true;\n }\n return b || flag;\n }, false) || this.isDirty;\n\n this.isDirty = false;\n return result;\n }\n\n // sets the property. But, value gets overriden when the original prop changes.\n set(name: string, value: any) {\n const oldValue = this.oldProps[name];\n if(oldValue !== value) {\n this.oldProps[name] = value;\n this.onChange(name, value, oldValue);\n }\n }\n\n has(propName: string) {\n return !!this.propertyNames[propName];\n }\n\n get() {\n return this.propsProxy;\n }\n}\n"],"mappings":";;;AAAA,SAASA,MAAM,EAAEC,KAAK,QAAQ,WAAW;AAGzC,OAAO,MAAMC,aAAa,CAAsB;EAO5CC,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removeItem(this.getKey(key), callback);
20
20
  }
21
+ async getAll() {
22
+ const keys = await AsyncStorage.getAllKeys();
23
+ const entries = await Promise.all(keys.map(async k => {
24
+ const v = await AsyncStorage.getItem(k);
25
+ return {
26
+ key: k,
27
+ value: v
28
+ };
29
+ }));
30
+ const o = {};
31
+ entries.forEach(e => {
32
+ o[e.key] = e.value;
33
+ });
34
+ return o;
35
+ }
21
36
  }
22
37
  export default new StorageService();
23
38
  //# sourceMappingURL=storage.service.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AsyncStorage","StorageService","constructor","_defineProperty","getKey","key","target","getItem","callback","setItem","value","removeItem"],"sources":["storage.service.ts"],"sourcesContent":["import AsyncStorage from '@react-native-async-storage/async-storage';\n\nexport class StorageService {\n public target = 'GLOBAL';\n\n private getKey(key: string) {\n return `${this.target}_${key}`;\n }\n \n getItem(key: string, callback?: (error?: Error | null, result?: string | null) => void): Promise<string | null> {\n return AsyncStorage.getItem(this.getKey(key), callback);\n }\n setItem(key: string, value: string, callback?: (error?: Error | null) => void): Promise<void> {\n return AsyncStorage.setItem(this.getKey(key), value, callback);\n }\n removeItem(key: string, callback?: (error?: Error | null) => void): Promise<void> {\n return AsyncStorage.removeItem(this.getKey(key), callback);\n }\n}\n\nexport default new StorageService();\n"],"mappings":";;;AAAA,OAAOA,YAAY,MAAM,2CAA2C;AAEpE,OAAO,MAAMC,cAAc,CAAC;EAAAC,YAAA;IAAAC,eAAA,iBACV,QAAQ;EAAA;EAEhBC,MAAMA,CAACC,GAAW,EAAE;IAC1B,OAAQ,GAAE,IAAI,CAACC,MAAO,IAAGD,GAAI,EAAC;EAChC;EAEAE,OAAOA,CAACF,GAAW,EAAEG,QAAiE,EAA0B;IAC9G,OAAOR,YAAY,CAACO,OAAO,CAAC,IAAI,CAACH,MAAM,CAACC,GAAG,CAAC,EAAEG,QAAQ,CAAC;EACzD;EACAC,OAAOA,CAACJ,GAAW,EAAEK,KAAa,EAAEF,QAAyC,EAAiB;IAC5F,OAAOR,YAAY,CAACS,OAAO,CAAC,IAAI,CAACL,MAAM,CAACC,GAAG,CAAC,EAAEK,KAAK,EAAEF,QAAQ,CAAC;EAChE;EACAG,UAAUA,CAACN,GAAW,EAAEG,QAAyC,EAAiB;IAChF,OAAOR,YAAY,CAACW,UAAU,CAAC,IAAI,CAACP,MAAM,CAACC,GAAG,CAAC,EAAEG,QAAQ,CAAC;EAC5D;AACF;AAEA,eAAe,IAAIP,cAAc,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["AsyncStorage","StorageService","constructor","_defineProperty","getKey","key","target","getItem","callback","setItem","value","removeItem","getAll","keys","getAllKeys","entries","Promise","all","map","k","v","o","forEach","e"],"sources":["storage.service.ts"],"sourcesContent":["import AsyncStorage from '@react-native-async-storage/async-storage';\n\nexport class StorageService {\n public target = 'GLOBAL';\n\n private getKey(key: string) {\n return `${this.target}_${key}`;\n }\n \n getItem(key: string, callback?: (error?: Error | null, result?: string | null) => void): Promise<string | null> {\n return AsyncStorage.getItem(this.getKey(key), callback);\n }\n setItem(key: string, value: string, callback?: (error?: Error | null) => void): Promise<void> {\n return AsyncStorage.setItem(this.getKey(key), value, callback);\n }\n removeItem(key: string, callback?: (error?: Error | null) => void): Promise<void> {\n return AsyncStorage.removeItem(this.getKey(key), callback);\n }\n\n async getAll() {\n const keys = await AsyncStorage.getAllKeys();\n const entries = await Promise.all(keys.map(async k => {\n const v = await AsyncStorage.getItem(k);\n return {\n key: k,\n value: v\n };\n }));\n const o = {} as any;\n entries.forEach((e) => {\n o[e.key] = e.value;\n });\n return o;\n }\n}\n\nexport default new StorageService();\n"],"mappings":";;;AAAA,OAAOA,YAAY,MAAM,2CAA2C;AAEpE,OAAO,MAAMC,cAAc,CAAC;EAAAC,YAAA;IAAAC,eAAA,iBACV,QAAQ;EAAA;EAEhBC,MAAMA,CAACC,GAAW,EAAE;IAC1B,OAAO,GAAG,IAAI,CAACC,MAAM,IAAID,GAAG,EAAE;EAChC;EAEAE,OAAOA,CAACF,GAAW,EAAEG,QAAiE,EAA0B;IAC9G,OAAOR,YAAY,CAACO,OAAO,CAAC,IAAI,CAACH,MAAM,CAACC,GAAG,CAAC,EAAEG,QAAQ,CAAC;EACzD;EACAC,OAAOA,CAACJ,GAAW,EAAEK,KAAa,EAAEF,QAAyC,EAAiB;IAC5F,OAAOR,YAAY,CAACS,OAAO,CAAC,IAAI,CAACL,MAAM,CAACC,GAAG,CAAC,EAAEK,KAAK,EAAEF,QAAQ,CAAC;EAChE;EACAG,UAAUA,CAACN,GAAW,EAAEG,QAAyC,EAAiB;IAChF,OAAOR,YAAY,CAACW,UAAU,CAAC,IAAI,CAACP,MAAM,CAACC,GAAG,CAAC,EAAEG,QAAQ,CAAC;EAC5D;EAEA,MAAMI,MAAMA,CAAA,EAAG;IACb,MAAMC,IAAI,GAAG,MAAMb,YAAY,CAACc,UAAU,CAAC,CAAC;IAC5C,MAAMC,OAAO,GAAG,MAAMC,OAAO,CAACC,GAAG,CAACJ,IAAI,CAACK,GAAG,CAAC,MAAMC,CAAC,IAAI;MACpD,MAAMC,CAAC,GAAG,MAAMpB,YAAY,CAACO,OAAO,CAACY,CAAC,CAAC;MACvC,OAAO;QACLd,GAAG,EAAEc,CAAC;QACNT,KAAK,EAAEU;MACT,CAAC;IACH,CAAC,CAAC,CAAC;IACH,MAAMC,CAAC,GAAG,CAAC,CAAQ;IACnBN,OAAO,CAACO,OAAO,CAAEC,CAAC,IAAK;MACrBF,CAAC,CAACE,CAAC,CAAClB,GAAG,CAAC,GAAGkB,CAAC,CAACb,KAAK;IACpB,CAAC,CAAC;IACF,OAAOW,CAAC;EACV;AACF;AAEA,eAAe,IAAIpB,cAAc,CAAC,CAAC","ignoreList":[]}
@@ -3,11 +3,13 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
3
3
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
4
4
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
5
  import React from "react";
6
- import { Platform, View } from "react-native";
6
+ import { Platform, View, TouchableOpacity } from "react-native";
7
7
  import { get } from "lodash";
8
8
  import injector from "./injector";
9
9
  import { TouchableRipple } from "react-native-paper";
10
10
  export const TappableContext = /*#__PURE__*/React.createContext(null);
11
+ import { UIPreferencesConsumer } from "./ui-preferences.context";
12
+ export const ParentTappableContext = /*#__PURE__*/React.createContext(null);
11
13
  export class SyntheticEvent {
12
14
  constructor() {
13
15
  // as the event is being used in onPress, onPressOut and onLongTap the TapEvent is renamed to SyntheticEvent
@@ -107,33 +109,38 @@ export class Tappable extends React.Component {
107
109
  }
108
110
  render() {
109
111
  const target = this.props.target;
112
+ const commonProps = {
113
+ ...(Platform.OS === 'android' || Platform.OS === 'web' ? {
114
+ accessibilityLabel: this.props.testID,
115
+ testID: this.props.testID
116
+ } : {
117
+ // accessible: false,
118
+ testID: this.props.testID
119
+ }),
120
+ ...this.props.accessibilityProps,
121
+ disabled: get(target === null || target === void 0 ? void 0 : target.proxy, 'disabled'),
122
+ style: this.props.styles,
123
+ onPress: e => {
124
+ var _e$target;
125
+ if ((e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.tagName) === 'INPUT') {
126
+ return;
127
+ }
128
+ this.onPress(new SyntheticEvent());
129
+ },
130
+ onLongPress: e => this.onLongTap(new SyntheticEvent()),
131
+ onPressOut: e => this.onPressOut(new SyntheticEvent())
132
+ };
110
133
  if (target !== null && target !== void 0 && target.props.onTap || target !== null && target !== void 0 && target.props.onLongtap || target !== null && target !== void 0 && target.props.onDoubletap || this.props.onTap || this.props.onLongTap || this.props.onDoubleTap) {
111
- return /*#__PURE__*/React.createElement(TappableContext.Consumer, null, parent => {
112
- this.setParent(parent);
113
- return /*#__PURE__*/React.createElement(TappableContext.Provider, {
114
- value: this
115
- }, /*#__PURE__*/React.createElement(TouchableRipple, _extends({
116
- rippleColor: this.props.rippleColor,
117
- borderless: true
118
- }, Platform.OS === 'android' || Platform.OS === 'web' ? {
119
- accessibilityLabel: this.props.testID,
120
- testID: this.props.testID
121
- } : {
122
- // accessible: false,
123
- testID: this.props.testID
124
- }, this.props.accessibilityProps, {
125
- disabled: get(target === null || target === void 0 ? void 0 : target.proxy, 'disabled'),
126
- style: this.props.styles,
127
- onPress: e => {
128
- var _e$target;
129
- if ((e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.tagName) === 'INPUT') {
130
- return;
131
- }
132
- this.onPress(new SyntheticEvent());
133
- },
134
- onLongPress: e => this.onLongTap(new SyntheticEvent()),
135
- onPressOut: e => this.onPressOut(new SyntheticEvent())
136
- }), /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children)));
134
+ return /*#__PURE__*/React.createElement(UIPreferencesConsumer, null, preferences => {
135
+ return preferences.enableRipple != false ? /*#__PURE__*/React.createElement(ParentTappableContext.Consumer, null, parent => {
136
+ this.setParent(parent);
137
+ return /*#__PURE__*/React.createElement(ParentTappableContext.Provider, {
138
+ value: this
139
+ }, /*#__PURE__*/React.createElement(TouchableRipple, _extends({
140
+ rippleColor: this.props.rippleColor,
141
+ borderless: true
142
+ }, commonProps), /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children)));
143
+ }) : /*#__PURE__*/React.createElement(TouchableOpacity, commonProps, /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children));
137
144
  });
138
145
  }
139
146
  return /*#__PURE__*/React.createElement(View, {
@@ -1 +1 @@
1
- {"version":3,"names":["React","Platform","View","get","injector","TouchableRipple","TappableContext","createContext","SyntheticEvent","constructor","_defineProperty","stopPropagation","propagationEnabled","Tappable","Component","props","triggerTap","e","_this$parent","target","onTap","invokeEventCallback","parent","onPress","_this$props$target","lastPress","Date","now","onTouchStart","currentTime","tapDelta","lastTap","isLongTap","_injector$FOCUSED_ELE","FOCUSED_ELEMENT","blur","lastDoubleTap","onDoubleTap","setTimeout","_this$parent2","onLongTap","_this$props$target2","_this$parent3","onPressOut","onTouchEnd","_this$props$target3","_this$parent4","setParent","render","onLongtap","onDoubletap","createElement","Consumer","Provider","value","_extends","rippleColor","borderless","OS","accessibilityLabel","testID","accessibilityProps","disabled","proxy","style","styles","_e$target","tagName","onLongPress","Fragment","children"],"sources":["tappable.component.tsx"],"sourcesContent":["import { BaseComponent } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport React from \"react\";\nimport { GestureResponderEvent, Platform, View } from \"react-native\";\nimport { get } from \"lodash\";\nimport injector from \"./injector\";\nimport { TouchableRipple } from \"react-native-paper\";\nimport ThemeVariables from \"../styles/theme.variables\";\nimport { isDefined } from \"./utils\";\n\nexport const TappableContext = React.createContext<Tappable>(null as any);\n\ninterface TappableProps {\n testID?: string;\n children?: any\n styles?: any;\n target?: BaseComponent<any, any, any>;\n onTap?: (e: any) => void;\n onLongTap?: (e: any) => void; \n onDoubleTap?: (e: any) => void;\n onTouchStart? : (e: any) => void;\n onTouchEnd? : (e: any) => void;\n rippleColor?: string;\n accessibilityProps?: any;\n}\n\nexport class SyntheticEvent {\n // as the event is being used in onPress, onPressOut and onLongTap the TapEvent is renamed to SyntheticEvent\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 private lastTap = 0;\n private lastDoubleTap = 0;\n private isLongTap = false;\n private parent:Tappable = null as any;\n \n constructor(props: any) {\n super(props);\n }\n\n async triggerTap(e = new SyntheticEvent()) {\n if (!e.propagationEnabled) {\n return;\n }\n const target = this.props.target;\n if (this.props.onTap) {\n await this.props.onTap(e);\n } else {\n await target?.invokeEventCallback('onTap', [e, target]);\n }\n this.parent?.triggerTap(e);\n }\n\n onPress(e: SyntheticEvent): void { \n this.lastPress = Date.now();\n const target = this.props.target;\n this.props.onTouchStart && this.props.onTouchStart(e);\n this.props.target?.invokeEventCallback('onTouchstart', [e, this.props.target]);\n const currentTime = Date.now();\n const tapDelta = currentTime - this.lastTap;\n if (this.isLongTap) {\n this.isLongTap = false;\n return;\n }\n if (e.propagationEnabled) {\n injector.FOCUSED_ELEMENT.get()?.blur();\n if(this.lastDoubleTap !== this.lastTap \n && tapDelta < 500) {\n this.props.onDoubleTap && this.props.onDoubleTap(e);\n setTimeout(() => {\n target?.invokeEventCallback('onDoubletap', [e, target]);\n }, 200);\n this.lastDoubleTap = currentTime;\n }\n setTimeout(() => {\n if (!e.propagationEnabled) {\n return;\n }\n if (this.props.onTap) {\n this.props.onTap(e);\n } else {\n target?.invokeEventCallback('onTap', [e, target]);\n }\n this.parent?.onPress(e);\n }, 200);\n this.lastTap = currentTime;\n }\n }\n\n onLongTap(e: SyntheticEvent): void {\n if(!e.propagationEnabled){\n return;\n }\n this.props.onLongTap && this.props.onLongTap(e);\n setTimeout(() => {\n this.props.target?.invokeEventCallback('onLongtap', [e, this.props.target]);\n this.parent?.onPressOut(e);\n }, 200);\n this.isLongTap = true;\n }\n \n onPressOut(e: SyntheticEvent): void {\n if(!e.propagationEnabled){\n return;\n } \n this.props.onTouchEnd && this.props.onTouchEnd(e);\n setTimeout(() => {\n this.props.target?.invokeEventCallback('onTouchend', [e, this.props.target]);\n this.parent?.onPressOut(e);\n }, 200);\n this.isLongTap = false;\n }\n private setParent(parent: Tappable) {\n if (parent && this.parent !== parent) {\n this.parent = parent;\n }\n }\n\n render() {\n const target = this.props.target;\n if (target?.props.onTap \n || target?.props.onLongtap \n || target?.props.onDoubletap \n || this.props.onTap \n || this.props.onLongTap \n || this.props.onDoubleTap) {\n return (\n <TappableContext.Consumer>{(parent) => {\n this.setParent(parent);\n return( <TappableContext.Provider value={this}>\n <TouchableRipple\n rippleColor={this.props.rippleColor}\n borderless = {true}\n {...(Platform.OS === 'android' || Platform.OS === 'web') ? {\n accessibilityLabel: this.props.testID,\n testID: this.props.testID\n }: {\n // accessible: false,\n testID: this.props.testID\n }} \n {...this.props.accessibilityProps}\n disabled={get(target?.proxy, 'disabled')}\n style={this.props.styles}\n onPress={(e?: GestureResponderEvent) => {\n if ((e?.target as any)?.tagName === 'INPUT') {\n return;\n }\n this.onPress(new SyntheticEvent())\n }}\n onLongPress={(e?: GestureResponderEvent) => this.onLongTap(new SyntheticEvent())}\n onPressOut={(e?: GestureResponderEvent) => this.onPressOut(new SyntheticEvent())}>\n <>{this.props.children}</>\n </TouchableRipple>\n </TappableContext.Provider>)}}</TappableContext.Consumer>\n \n );\n }\n return (<View style={this.props.styles}>{this.props.children}</View>);\n }\n}\n"],"mappings":";;;;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAgCC,QAAQ,EAAEC,IAAI,QAAQ,cAAc;AACpE,SAASC,GAAG,QAAQ,QAAQ;AAC5B,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,eAAe,QAAQ,oBAAoB;AAIpD,OAAO,MAAMC,eAAe,gBAAGN,KAAK,CAACO,aAAa,CAAW,IAAW,CAAC;AAgBzE,OAAO,MAAMC,cAAc,CAAC;EAIxBC,WAAWA,CAAA,EAAG;IAHd;IAAAC,eAAA,6BACqB,IAAI;EAIzB;EAEAC,eAAeA,CAAA,EAAG;IACd,IAAI,CAACC,kBAAkB,GAAG,KAAK;EACnC;AACJ;AAEA,OAAO,MAAMC,QAAQ,SAASb,KAAK,CAACc,SAAS,CAAqB;EAO9DL,WAAWA,CAACM,KAAU,EAAE;IACpB,KAAK,CAACA,KAAK,CAAC;IAACL,eAAA,oBAPG,CAAC;IAAAA,eAAA,kBACH,CAAC;IAAAA,eAAA,wBACK,CAAC;IAAAA,eAAA,oBACL,KAAK;IAAAA,eAAA,iBACC,IAAI;EAI9B;EAEA,MAAMM,UAAUA,CAACC,CAAC,GAAG,IAAIT,cAAc,CAAC,CAAC,EAAE;IAAA,IAAAU,YAAA;IACvC,IAAI,CAACD,CAAC,CAAC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AA,CAAoBC,OAAO,MAAK,OAAO,EAAE;cACzC;YACJ;YACA,IAAI,CAAC5C,OAAO,CAAC,IAAIf,cAAc,CAAC,CAAC,CAAC;UACtC,CAAE;UACF4D,WAAW,EAAGnD,CAAyB,IAAK,IAAI,CAACuB,SAAS,CAAC,IAAIhC,cAAc,CAAC,CAAC,CAAE;UACjFmC,UAAU,EAAG1B,CAAyB,IAAK,IAAI,CAAC0B,UAAU,CAAC,IAAInC,cAAc,CAAC,CAAC;QAAE,iBAC7ER,KAAA,CAAAmD,aAAA,CAAAnD,KAAA,CAAAqE,QAAA,QAAG,IAAI,CAACtD,KAAK,CAACuD,QAAW,CACZ,CACS,CAAC;MAAC,CAA4B,CAAC;IAGjE;IACA,oBAAQtE,KAAA,CAAAmD,aAAA,CAACjD,IAAI;MAAC8D,KAAK,EAAE,IAAI,CAACjD,KAAK,CAACkD;IAAO,GAAE,IAAI,CAAClD,KAAK,CAACuD,QAAe,CAAC;EACxE;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["React","Platform","View","TouchableOpacity","get","injector","TouchableRipple","TappableContext","createContext","UIPreferencesConsumer","ParentTappableContext","SyntheticEvent","constructor","_defineProperty","stopPropagation","propagationEnabled","Tappable","Component","props","triggerTap","e","_this$parent","target","onTap","invokeEventCallback","parent","onPress","_this$props$target","lastPress","Date","now","onTouchStart","currentTime","tapDelta","lastTap","isLongTap","_injector$FOCUSED_ELE","FOCUSED_ELEMENT","blur","lastDoubleTap","onDoubleTap","setTimeout","_this$parent2","onLongTap","_this$props$target2","_this$parent3","onPressOut","onTouchEnd","_this$props$target3","_this$parent4","setParent","render","commonProps","OS","accessibilityLabel","testID","accessibilityProps","disabled","proxy","style","styles","_e$target","tagName","onLongPress","onLongtap","onDoubletap","createElement","preferences","enableRipple","Consumer","Provider","value","_extends","rippleColor","borderless","Fragment","children"],"sources":["tappable.component.tsx"],"sourcesContent":["import { BaseComponent } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport React from \"react\";\nimport { GestureResponderEvent, Platform, View, TouchableOpacity } from \"react-native\";\nimport { get } from \"lodash\";\nimport injector from \"./injector\";\nimport { TouchableRipple } from \"react-native-paper\";\nimport ThemeVariables from \"../styles/theme.variables\";\nimport { isDefined } from \"./utils\";\n\nexport const TappableContext = React.createContext<Tappable>(null as any);\nimport { UIPreferencesConsumer, UI_PREFERENCES } from \"./ui-preferences.context\";\n\nexport const ParentTappableContext = React.createContext<Tappable>(null as any);\ninterface TappableProps {\n testID?: string;\n children?: any\n styles?: any;\n target?: BaseComponent<any, any, any>;\n onTap?: (e: any) => void;\n onLongTap?: (e: any) => void; \n onDoubleTap?: (e: any) => void;\n onTouchStart? : (e: any) => void;\n onTouchEnd? : (e: any) => void;\n rippleColor?: string;\n accessibilityProps?: any;\n}\n\nexport class SyntheticEvent {\n // as the event is being used in onPress, onPressOut and onLongTap the TapEvent is renamed to SyntheticEvent\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 private lastTap = 0;\n private lastDoubleTap = 0;\n private isLongTap = false;\n private parent:Tappable = null as any;\n \n constructor(props: any) {\n super(props);\n }\n\n async triggerTap(e = new SyntheticEvent()) {\n if (!e.propagationEnabled) {\n return;\n }\n const target = this.props.target;\n if (this.props.onTap) {\n await this.props.onTap(e);\n } else {\n await target?.invokeEventCallback('onTap', [e, target]);\n }\n this.parent?.triggerTap(e);\n }\n\n onPress(e: SyntheticEvent): void { \n this.lastPress = Date.now();\n const target = this.props.target;\n this.props.onTouchStart && this.props.onTouchStart(e);\n this.props.target?.invokeEventCallback('onTouchstart', [e, this.props.target]);\n const currentTime = Date.now();\n const tapDelta = currentTime - this.lastTap;\n if (this.isLongTap) {\n this.isLongTap = false;\n return;\n }\n if (e.propagationEnabled) {\n injector.FOCUSED_ELEMENT.get()?.blur();\n if(this.lastDoubleTap !== this.lastTap \n && tapDelta < 500) {\n this.props.onDoubleTap && this.props.onDoubleTap(e);\n setTimeout(() => {\n target?.invokeEventCallback('onDoubletap', [e, target]);\n }, 200);\n this.lastDoubleTap = currentTime;\n }\n setTimeout(() => {\n if (!e.propagationEnabled) {\n return;\n }\n if (this.props.onTap) {\n this.props.onTap(e);\n } else {\n target?.invokeEventCallback('onTap', [e, target]);\n }\n this.parent?.onPress(e);\n }, 200);\n this.lastTap = currentTime;\n }\n }\n\n onLongTap(e: SyntheticEvent): void {\n if(!e.propagationEnabled){\n return;\n }\n this.props.onLongTap && this.props.onLongTap(e);\n setTimeout(() => {\n this.props.target?.invokeEventCallback('onLongtap', [e, this.props.target]);\n this.parent?.onPressOut(e);\n }, 200);\n this.isLongTap = true;\n }\n \n onPressOut(e: SyntheticEvent): void {\n if(!e.propagationEnabled){\n return;\n } \n this.props.onTouchEnd && this.props.onTouchEnd(e);\n setTimeout(() => {\n this.props.target?.invokeEventCallback('onTouchend', [e, this.props.target]);\n this.parent?.onPressOut(e);\n }, 200);\n this.isLongTap = false;\n }\n private setParent(parent: Tappable) {\n if (parent && this.parent !== parent) {\n this.parent = parent;\n }\n }\n\n render() {\n const target = this.props.target;\n const commonProps = {\n ...(Platform.OS === 'android' || Platform.OS === 'web') ? {\n accessibilityLabel: this.props.testID,\n testID: this.props.testID\n }: {\n // accessible: false,\n testID: this.props.testID\n },\n ...this.props.accessibilityProps,\n disabled:get(target?.proxy, 'disabled'),\n style:this.props.styles,\n onPress:(e?: GestureResponderEvent) => {\n if ((e?.target as any)?.tagName === 'INPUT') {\n return;\n }\n this.onPress(new SyntheticEvent())\n },\n onLongPress:(e?: GestureResponderEvent) => this.onLongTap(new SyntheticEvent()),\n onPressOut:(e?: GestureResponderEvent) => this.onPressOut(new SyntheticEvent())\n };\n if (target?.props.onTap \n || target?.props.onLongtap \n || target?.props.onDoubletap \n || this.props.onTap \n || this.props.onLongTap \n || this.props.onDoubleTap) {\n return (\n <UIPreferencesConsumer>\n {(preferences: UI_PREFERENCES) => {\n return preferences.enableRipple != false ? (\n <ParentTappableContext.Consumer>{(parent) => {\n this.setParent(parent);\n return( <ParentTappableContext.Provider value={this}>\n <TouchableRipple rippleColor={this.props.rippleColor} borderless={true} {...commonProps}>\n <>{this.props.children}</>\n </TouchableRipple>\n </ParentTappableContext.Provider>)}}</ParentTappableContext.Consumer>): (\n <TouchableOpacity {...commonProps}>\n <>{this.props.children}</>\n </TouchableOpacity>);\n }}\n </UIPreferencesConsumer>\n );\n }\n return (<View style={this.props.styles}>{this.props.children}</View>);\n }\n}\n"],"mappings":";;;;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAgCC,QAAQ,EAAEC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AACtF,SAASC,GAAG,QAAQ,QAAQ;AAC5B,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,eAAe,QAAQ,oBAAoB;AAIpD,OAAO,MAAMC,eAAe,gBAAGP,KAAK,CAACQ,aAAa,CAAW,IAAW,CAAC;AACzE,SAASC,qBAAqB,QAAwB,0BAA0B;AAEhF,OAAO,MAAMC,qBAAqB,gBAAGV,KAAK,CAACQ,aAAa,CAAW,IAAW,CAAC;AAe/E,OAAO,MAAMG,cAAc,CAAC;EAIxBC,WAAWA,CAAA,EAAG;IAHd;IAAAC,eAAA,6BACqB,IAAI;EAIzB;EAEAC,eAAeA,CAAA,EAAG;IACd,IAAI,CAACC,kBAAkB,GAAG,KAAK;EACnC;AACJ;AAEA,OAAO,MAAMC,QAAQ,SAAShB,KAAK,CAACiB,SAAS,CAAqB;EAO9DL,WAAWA,CAACM,KAAU,EAAE;IACpB,KAAK,CAACA,KAAK,CAAC;IAACL,eAAA,oBAPG,CAAC;IAAAA,eAAA,kBACH,CAAC;IAAAA,eAAA,wBACK,CAAC;IAAAA,eAAA,oBACL,KAAK;IAAAA,eAAA,iBACC,IAAI;EAI9B;EAEA,MAAMM,UAAUA,CAACC,CAAC,GAAG,IAAIT,cAAc,CAAC,CAAC,EAAE;IAAA,IA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AAK,CAACsB,WAAW,EAAE;MAC3B,oBACAxC,KAAA,CAAAkE,aAAA,CAACzD,qBAAqB,QAChB0D,WAA2B,IAAK;QAC9B,OAAOA,WAAW,CAACC,YAAY,IAAI,KAAK,gBACpCpE,KAAA,CAAAkE,aAAA,CAACxD,qBAAqB,CAAC2D,QAAQ,QAAG5C,MAAM,IAAK;UACzC,IAAI,CAACyB,SAAS,CAACzB,MAAM,CAAC;UACtB,oBAAQzB,KAAA,CAAAkE,aAAA,CAACxD,qBAAqB,CAAC4D,QAAQ;YAACC,KAAK,EAAE;UAAK,gBAC5DvE,KAAA,CAAAkE,aAAA,CAAC5D,eAAe,EAAAkE,QAAA;YAACC,WAAW,EAAE,IAAI,CAACvD,KAAK,CAACuD,WAAY;YAACC,UAAU,EAAE;UAAK,GAAKtB,WAAW,gBACnFpD,KAAA,CAAAkE,aAAA,CAAAlE,KAAA,CAAA2E,QAAA,QAAG,IAAI,CAACzD,KAAK,CAAC0D,QAAW,CACZ,CACe,CAAC;QAAC,CAAkC,CAAC,gBACrE5E,KAAA,CAAAkE,aAAA,CAAC/D,gBAAgB,EAAKiD,WAAW,eAC7BpD,KAAA,CAAAkE,aAAA,CAAAlE,KAAA,CAAA2E,QAAA,QAAG,IAAI,CAACzD,KAAK,CAAC0D,QAAW,CACX,CAAE;MACxB,CACmB,CAAC;IAE5B;IACA,oBAAQ5E,KAAA,CAAAkE,aAAA,CAAChE,IAAI;MAACyD,KAAK,EAAE,IAAI,CAACzC,KAAK,CAAC0C;IAAO,GAAE,IAAI,CAAC1C,KAAK,CAAC0D,QAAe,CAAC;EACxE;AACJ","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ const UIPreferencesContext = /*#__PURE__*/React.createContext({
3
+ enableRipple: true
4
+ });
5
+ export const UIPreferencesProvider = UIPreferencesContext.Provider;
6
+ export const UIPreferencesConsumer = UIPreferencesContext.Consumer;
7
+ //# sourceMappingURL=ui-preferences.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","UIPreferencesContext","createContext","enableRipple","UIPreferencesProvider","Provider","UIPreferencesConsumer","Consumer"],"sources":["ui-preferences.context.ts"],"sourcesContent":["import React from \"react\";\n\nexport interface UI_PREFERENCES {\n enableRipple: boolean;\n}\n \nconst UIPreferencesContext = React.createContext<UI_PREFERENCES>({enableRipple: true});\n\nexport const UIPreferencesProvider = UIPreferencesContext.Provider;\nexport const UIPreferencesConsumer = UIPreferencesContext.Consumer;"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAMzB,MAAMC,oBAAoB,gBAAGD,KAAK,CAACE,aAAa,CAAiB;EAACC,YAAY,EAAE;AAAI,CAAC,CAAC;AAEtF,OAAO,MAAMC,qBAAqB,GAAGH,oBAAoB,CAACI,QAAQ;AAClE,OAAO,MAAMC,qBAAqB,GAAGL,oBAAoB,CAACM,QAAQ","ignoreList":[]}
@@ -2,6 +2,7 @@ import { Platform } from 'react-native';
2
2
  import moment from "moment";
3
3
  import * as FileSystem from "expo-file-system";
4
4
  import { isFunction, includes, isUndefined, isNull, orderBy, groupBy, toLower, get, forEach, sortBy, cloneDeep, keys, values, isArray, isString, isNumber } from 'lodash';
5
+ import * as mime from 'react-native-mime-types';
5
6
  import ThemeVariables from '../styles/theme.variables';
6
7
  const GROUP_BY_OPTIONS = {
7
8
  ALPHABET: 'alphabet',
@@ -335,19 +336,26 @@ export function removeUndefinedKeys(obj) {
335
336
  function getDaysInMonth(month, year) {
336
337
  return new Date(year, month, 0).getDate();
337
338
  }
338
- export const getDates = (month = 0,
339
+ export const getDates = (startDate, endDate, month = 0,
339
340
  // zero-based
340
341
  year = new Date().getFullYear()) => {
341
342
  const daysInMonth = getDaysInMonth(month, year);
342
343
  const dates = Array.from({
343
344
  length: daysInMonth
344
345
  }, (v, i) => i + 1);
345
- return dates;
346
+ const datesInRange = dates.filter(date => date >= startDate);
347
+ return datesInRange;
346
348
  };
347
349
  export const monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
348
- export const getMonths = () => {
350
+ export const getMonths = (startMonth, endMonth) => {
349
351
  const months = monthNames.map(name => name.substring(0, 3));
350
- return months;
352
+ const monthRange = months.filter((_, index) => index >= startMonth);
353
+ return monthRange;
354
+ };
355
+ export const getMonthIndex = (monthName, shortName = true) => {
356
+ const months = shortName ? monthNames.map(name => name.substring(0, 3)) : monthNames;
357
+ const monthNumber = months.findIndex(name => name === monthName);
358
+ return monthNumber;
351
359
  };
352
360
  export const getYearRange = (startYear = 1950, endYear = 2060) => {
353
361
  const years = [];
@@ -443,4 +451,79 @@ export const parseLinearGradient = gradient => {
443
451
  end
444
452
  };
445
453
  };
454
+ export const validateInputOnDevice = (value, type) => {
455
+ var _value$match;
456
+ const isCurrencyField = type === 'currency';
457
+ let isValidText = true;
458
+ let validText = value;
459
+
460
+ // * no alphabets except E, may contain E only once
461
+ if (/[a-df-zA-DF-Z]/.test(value) || !/^[^eE]*[eE]?[^eE]*$/.test(value)) {
462
+ isValidText = false;
463
+ validText = validText.replace(/[a-df-zA-DF-Z]/g, '');
464
+ validText = validText.replace(/([eE])\1+/g, 'e');
465
+ }
466
+
467
+ // * currency only: check for negative number
468
+ if (isCurrencyField && (Number(value) < 0 || /-/g.test(value))) {
469
+ isValidText = false;
470
+ validText = validText.replace(/-/g, '');
471
+ }
472
+
473
+ // * number only: not more than one minus and doesn't end with minus (-)
474
+ if (!isCurrencyField && Number((_value$match = value.match(/-/g)) === null || _value$match === void 0 ? void 0 : _value$match.length) > 1 || /\w-/.test(value)) {
475
+ isValidText = false;
476
+ validText = validText.replace(/-/g, '');
477
+ validText = validText.replace(/\w-/g, '');
478
+ }
479
+
480
+ // * check for more than one decimal point
481
+ if (/^\d*\.\d*\..*$/.test(value)) {
482
+ isValidText = false;
483
+ validText = validText.replace(/\.(?=\.*\.)/g, '');
484
+ }
485
+
486
+ // * check for spaces and comma
487
+ if (/[\s,]/.test(value)) {
488
+ isValidText = false;
489
+ validText = validText.replace(/[\s,]/, '');
490
+ }
491
+ return {
492
+ isValidText,
493
+ validText
494
+ };
495
+ };
496
+ export const isDateFormatAsPerPattern = (datePattern, dateString) => {
497
+ try {
498
+ var _date$format;
499
+ // * format dateString as per datePattern
500
+ const date = moment(dateString, datePattern, true);
501
+
502
+ // * check date is valid and matches the format
503
+ return date.isValid() && typeof dateString === 'string' && (dateString === null || dateString === void 0 ? void 0 : dateString.toUpperCase()) === ((_date$format = date.format(datePattern)) === null || _date$format === void 0 ? void 0 : _date$format.toUpperCase());
504
+ } catch (error) {
505
+ // * if not able to parse date string
506
+ return false;
507
+ }
508
+ };
509
+ export const getMimeType = extensions => {
510
+ if (!extensions) return '*/*';
511
+ let hasInvalidExtension = false;
512
+ let wildCards = ['image/*', 'audio/*', 'video/*'];
513
+ let extensionList = extensions.split(' ');
514
+ let mimeType = extensionList.map(extension => {
515
+ let type = mime.lookup(extension);
516
+ let isWildCardExtension = wildCards.includes(extension);
517
+ // * invalid extension, also not in wildcards
518
+ hasInvalidExtension = !type && !isWildCardExtension;
519
+ return type ? type : isWildCardExtension ? extension : '';
520
+ }).filter(type => type);
521
+ if (hasInvalidExtension) return '*/*';
522
+ return mimeType;
523
+ };
524
+ export function getNumberOfEmptyObjects(noOfItems) {
525
+ return Array.from({
526
+ length: noOfItems
527
+ }, () => ({}));
528
+ }
446
529
  //# sourceMappingURL=utils.js.map