@wavemaker/app-rn-runtime 12.0.0-next.45102 → 12.0.0-next.45128

Sign up to get free protection for your applications and to get access to all the features.
Files changed (292) hide show
  1. app-rn-runtime/components/advanced/carousel/carousel.component.js +31 -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/icon/icon.component.js +14 -6
  18. app-rn-runtime/components/basic/icon/icon.component.js.map +1 -1
  19. app-rn-runtime/components/basic/label/label.component.js +13 -3
  20. app-rn-runtime/components/basic/label/label.component.js.map +1 -1
  21. app-rn-runtime/components/basic/label/label.styles.js.map +1 -1
  22. app-rn-runtime/components/basic/message/message.component.js.map +1 -1
  23. app-rn-runtime/components/basic/picture/picture.component.js +1 -2
  24. app-rn-runtime/components/basic/picture/picture.component.js.map +1 -1
  25. app-rn-runtime/components/basic/progress-bar/progress-bar.component.js +2 -2
  26. app-rn-runtime/components/basic/progress-bar/progress-bar.component.js.map +1 -1
  27. app-rn-runtime/components/basic/progress-circle/progress-circle.component.js +5 -5
  28. app-rn-runtime/components/basic/progress-circle/progress-circle.component.js.map +1 -1
  29. app-rn-runtime/components/basic/search/search.component.js +9 -0
  30. app-rn-runtime/components/basic/search/search.component.js.map +1 -1
  31. app-rn-runtime/components/basic/search/search.props.js +2 -0
  32. app-rn-runtime/components/basic/search/search.props.js.map +1 -1
  33. app-rn-runtime/components/basic/search/search.styles.js +5 -0
  34. app-rn-runtime/components/basic/search/search.styles.js.map +1 -1
  35. app-rn-runtime/components/basic/skeleton/skeleton.component.js +4 -3
  36. app-rn-runtime/components/basic/skeleton/skeleton.component.js.map +1 -1
  37. app-rn-runtime/components/basic/skeleton/skeleton.props.js +9 -1
  38. app-rn-runtime/components/basic/skeleton/skeleton.props.js.map +1 -1
  39. app-rn-runtime/components/basic/spinner/spinner.component.js +2 -3
  40. app-rn-runtime/components/basic/spinner/spinner.component.js.map +1 -1
  41. app-rn-runtime/components/basic/spinner/spinner.styles.js +3 -2
  42. app-rn-runtime/components/basic/spinner/spinner.styles.js.map +1 -1
  43. app-rn-runtime/components/basic/video/video.component.js.map +1 -1
  44. app-rn-runtime/components/basic/video/video.styles.js +4 -1
  45. app-rn-runtime/components/basic/video/video.styles.js.map +1 -1
  46. app-rn-runtime/components/chart/area-chart/area-chart.component.js +2 -1
  47. app-rn-runtime/components/chart/area-chart/area-chart.component.js.map +1 -1
  48. app-rn-runtime/components/chart/area-chart/area-chart.styles.js +7 -1
  49. app-rn-runtime/components/chart/area-chart/area-chart.styles.js.map +1 -1
  50. app-rn-runtime/components/chart/bar-chart/bar-chart.styles.js +7 -1
  51. app-rn-runtime/components/chart/bar-chart/bar-chart.styles.js.map +1 -1
  52. app-rn-runtime/components/chart/basechart.component.js +54 -2
  53. app-rn-runtime/components/chart/basechart.component.js.map +1 -1
  54. app-rn-runtime/components/chart/basechart.props.js +3 -2
  55. app-rn-runtime/components/chart/basechart.props.js.map +1 -1
  56. app-rn-runtime/components/chart/basechart.styles.js +4 -0
  57. app-rn-runtime/components/chart/basechart.styles.js.map +1 -1
  58. app-rn-runtime/components/chart/bubble-chart/bubble-chart.component.js +15 -3
  59. app-rn-runtime/components/chart/bubble-chart/bubble-chart.component.js.map +1 -1
  60. app-rn-runtime/components/chart/bubble-chart/bubble-chart.styles.js +7 -1
  61. app-rn-runtime/components/chart/bubble-chart/bubble-chart.styles.js.map +1 -1
  62. app-rn-runtime/components/chart/column-chart/column-chart.styles.js +7 -1
  63. app-rn-runtime/components/chart/column-chart/column-chart.styles.js.map +1 -1
  64. app-rn-runtime/components/chart/donut-chart/donut-chart.styles.js +7 -1
  65. app-rn-runtime/components/chart/donut-chart/donut-chart.styles.js.map +1 -1
  66. app-rn-runtime/components/chart/line-chart/line-chart.props.js +2 -0
  67. app-rn-runtime/components/chart/line-chart/line-chart.props.js.map +1 -1
  68. app-rn-runtime/components/chart/line-chart/line-chart.styles.js +7 -1
  69. app-rn-runtime/components/chart/line-chart/line-chart.styles.js.map +1 -1
  70. app-rn-runtime/components/chart/pie-chart/pie-chart.component.js +6 -2
  71. app-rn-runtime/components/chart/pie-chart/pie-chart.component.js.map +1 -1
  72. app-rn-runtime/components/chart/pie-chart/pie-chart.styles.js +7 -1
  73. app-rn-runtime/components/chart/pie-chart/pie-chart.styles.js.map +1 -1
  74. app-rn-runtime/components/chart/stack-chart/stack-chart.component.js +37 -11
  75. app-rn-runtime/components/chart/stack-chart/stack-chart.component.js.map +1 -1
  76. app-rn-runtime/components/container/accordion/accordion.component.js +61 -12
  77. app-rn-runtime/components/container/accordion/accordion.component.js.map +1 -1
  78. app-rn-runtime/components/container/accordion/accordion.props.js.map +1 -1
  79. app-rn-runtime/components/container/accordion/accordion.styles.js +5 -0
  80. app-rn-runtime/components/container/accordion/accordion.styles.js.map +1 -1
  81. app-rn-runtime/components/container/accordion/accordionpane/accordionpane.component.js +11 -1
  82. app-rn-runtime/components/container/accordion/accordionpane/accordionpane.component.js.map +1 -1
  83. app-rn-runtime/components/container/container.component.js +36 -2
  84. app-rn-runtime/components/container/container.component.js.map +1 -1
  85. app-rn-runtime/components/container/container.styles.js +7 -0
  86. app-rn-runtime/components/container/container.styles.js.map +1 -1
  87. app-rn-runtime/components/container/layoutgrid/gridcolumn/gridcolumn.component.js.map +1 -1
  88. app-rn-runtime/components/container/layoutgrid/gridrow/gridrow.component.js +5 -1
  89. app-rn-runtime/components/container/layoutgrid/gridrow/gridrow.component.js.map +1 -1
  90. app-rn-runtime/components/container/layoutgrid/gridrow/gridrow.styles.js +6 -1
  91. app-rn-runtime/components/container/layoutgrid/gridrow/gridrow.styles.js.map +1 -1
  92. app-rn-runtime/components/container/layoutgrid/layoutgrid.component.js +28 -2
  93. app-rn-runtime/components/container/layoutgrid/layoutgrid.component.js.map +1 -1
  94. app-rn-runtime/components/container/layoutgrid/layoutgrid.props.js.map +1 -1
  95. app-rn-runtime/components/container/layoutgrid/layoutgrid.styles.js +4 -1
  96. app-rn-runtime/components/container/layoutgrid/layoutgrid.styles.js.map +1 -1
  97. app-rn-runtime/components/container/linearlayout/linearlayout.component.js +31 -5
  98. app-rn-runtime/components/container/linearlayout/linearlayout.component.js.map +1 -1
  99. app-rn-runtime/components/container/linearlayout/linearlayout.props.js.map +1 -1
  100. app-rn-runtime/components/container/linearlayout/linearlayout.styles.js +4 -1
  101. app-rn-runtime/components/container/linearlayout/linearlayout.styles.js.map +1 -1
  102. app-rn-runtime/components/container/panel/panel.component.js +47 -6
  103. app-rn-runtime/components/container/panel/panel.component.js.map +1 -1
  104. app-rn-runtime/components/container/panel/panel.props.js.map +1 -1
  105. app-rn-runtime/components/container/panel/panel.styles.js +3 -0
  106. app-rn-runtime/components/container/panel/panel.styles.js.map +1 -1
  107. app-rn-runtime/components/container/partial-host.component.js.map +1 -1
  108. app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js +3 -4
  109. app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js.map +1 -1
  110. app-rn-runtime/components/container/tabs/tabheader/tabheader.props.js.map +1 -1
  111. app-rn-runtime/components/container/tabs/tabpane/tabpane.component.js +11 -1
  112. app-rn-runtime/components/container/tabs/tabpane/tabpane.component.js.map +1 -1
  113. app-rn-runtime/components/container/tabs/tabpane/tabpane.props.js.map +1 -1
  114. app-rn-runtime/components/container/tabs/tabs.component.js +41 -5
  115. app-rn-runtime/components/container/tabs/tabs.component.js.map +1 -1
  116. app-rn-runtime/components/container/tabs/tabs.props.js.map +1 -1
  117. app-rn-runtime/components/container/tabs/tabs.styles.js +4 -1
  118. app-rn-runtime/components/container/tabs/tabs.styles.js.map +1 -1
  119. app-rn-runtime/components/container/tile/tile.component.js +28 -2
  120. app-rn-runtime/components/container/tile/tile.component.js.map +1 -1
  121. app-rn-runtime/components/container/tile/tile.props.js.map +1 -1
  122. app-rn-runtime/components/container/tile/tile.styles.js +6 -1
  123. app-rn-runtime/components/container/tile/tile.styles.js.map +1 -1
  124. app-rn-runtime/components/container/wizard/wizard.component.js +62 -13
  125. app-rn-runtime/components/container/wizard/wizard.component.js.map +1 -1
  126. app-rn-runtime/components/container/wizard/wizard.props.js.map +1 -1
  127. app-rn-runtime/components/container/wizard/wizard.styles.js +3 -0
  128. app-rn-runtime/components/container/wizard/wizard.styles.js.map +1 -1
  129. app-rn-runtime/components/container/wizard/wizardstep/wizardstep.component.js +4 -1
  130. app-rn-runtime/components/container/wizard/wizardstep/wizardstep.component.js.map +1 -1
  131. app-rn-runtime/components/data/card/card-content/card-content.component.js +6 -2
  132. app-rn-runtime/components/data/card/card-content/card-content.component.js.map +1 -1
  133. app-rn-runtime/components/data/card/card-content/card-content.styles.js +4 -1
  134. app-rn-runtime/components/data/card/card-content/card-content.styles.js.map +1 -1
  135. app-rn-runtime/components/data/card/card.component.js +18 -0
  136. app-rn-runtime/components/data/card/card.component.js.map +1 -1
  137. app-rn-runtime/components/data/card/card.styles.js +3 -0
  138. app-rn-runtime/components/data/card/card.styles.js.map +1 -1
  139. app-rn-runtime/components/data/form/form-field/form-field.component.js.map +1 -1
  140. app-rn-runtime/components/data/form/form.component.js +1 -1
  141. app-rn-runtime/components/data/form/form.component.js.map +1 -1
  142. app-rn-runtime/components/data/form/form.props.js +1 -0
  143. app-rn-runtime/components/data/form/form.props.js.map +1 -1
  144. app-rn-runtime/components/data/list/list-template/list-template.component.js +15 -1
  145. app-rn-runtime/components/data/list/list-template/list-template.component.js.map +1 -1
  146. app-rn-runtime/components/data/list/list-template/list-template.props.js +1 -0
  147. app-rn-runtime/components/data/list/list-template/list-template.props.js.map +1 -1
  148. app-rn-runtime/components/data/list/list-template/list-template.styles.js +11 -1
  149. app-rn-runtime/components/data/list/list-template/list-template.styles.js.map +1 -1
  150. app-rn-runtime/components/data/list/list.component.js +54 -33
  151. app-rn-runtime/components/data/list/list.component.js.map +1 -1
  152. app-rn-runtime/components/data/list/list.props.js +1 -0
  153. app-rn-runtime/components/data/list/list.props.js.map +1 -1
  154. app-rn-runtime/components/data/list/list.styles.js +9 -0
  155. app-rn-runtime/components/data/list/list.styles.js.map +1 -1
  156. app-rn-runtime/components/dialogs/dialog/dialog.component.js +5 -3
  157. app-rn-runtime/components/dialogs/dialog/dialog.component.js.map +1 -1
  158. app-rn-runtime/components/dialogs/dialog/dialog.styles.js.map +1 -1
  159. app-rn-runtime/components/input/basedataset/basedataset.component.js.map +1 -1
  160. app-rn-runtime/components/input/baseinput/baseinput.component.js +11 -4
  161. app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
  162. app-rn-runtime/components/input/baseinput/baseinput.props.js +1 -0
  163. app-rn-runtime/components/input/baseinput/baseinput.props.js.map +1 -1
  164. app-rn-runtime/components/input/basenumber/basenumber.component.js +25 -12
  165. app-rn-runtime/components/input/basenumber/basenumber.component.js.map +1 -1
  166. app-rn-runtime/components/input/basenumber/basenumber.props.js +2 -0
  167. app-rn-runtime/components/input/basenumber/basenumber.props.js.map +1 -1
  168. app-rn-runtime/components/input/checkbox/checkbox.component.js +5 -6
  169. app-rn-runtime/components/input/checkbox/checkbox.component.js.map +1 -1
  170. app-rn-runtime/components/input/checkbox/checkbox.styles.js.map +1 -1
  171. app-rn-runtime/components/input/checkboxset/checkboxset.component.js +24 -3
  172. app-rn-runtime/components/input/checkboxset/checkboxset.component.js.map +1 -1
  173. app-rn-runtime/components/input/checkboxset/checkboxset.props.js +1 -0
  174. app-rn-runtime/components/input/checkboxset/checkboxset.props.js.map +1 -1
  175. app-rn-runtime/components/input/checkboxset/checkboxset.styles.js +1 -0
  176. app-rn-runtime/components/input/checkboxset/checkboxset.styles.js.map +1 -1
  177. app-rn-runtime/components/input/chips/chips.component.js +3 -2
  178. app-rn-runtime/components/input/chips/chips.component.js.map +1 -1
  179. app-rn-runtime/components/input/currency/currency.component.js +16 -1
  180. app-rn-runtime/components/input/currency/currency.component.js.map +1 -1
  181. app-rn-runtime/components/input/epoch/base-datetime.component.js +22 -5
  182. app-rn-runtime/components/input/epoch/base-datetime.component.js.map +1 -1
  183. app-rn-runtime/components/input/epoch/wheel-date-picker.component.js +123 -12
  184. app-rn-runtime/components/input/epoch/wheel-date-picker.component.js.map +1 -1
  185. app-rn-runtime/components/input/epoch/wheelpicker/wheelpicker.component.js.map +1 -1
  186. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.component.js +4 -0
  187. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.component.js.map +1 -1
  188. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.props.js +2 -0
  189. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.props.js.map +1 -1
  190. app-rn-runtime/components/input/fileupload/fileupload.component.js +4 -2
  191. app-rn-runtime/components/input/fileupload/fileupload.component.js.map +1 -1
  192. app-rn-runtime/components/input/fileupload/fileupload.props.js +1 -0
  193. app-rn-runtime/components/input/fileupload/fileupload.props.js.map +1 -1
  194. app-rn-runtime/components/input/number/number.component.js +6 -3
  195. app-rn-runtime/components/input/number/number.component.js.map +1 -1
  196. app-rn-runtime/components/input/radioset/radioset.component.js +27 -7
  197. app-rn-runtime/components/input/radioset/radioset.component.js.map +1 -1
  198. app-rn-runtime/components/input/radioset/radioset.props.js +1 -0
  199. app-rn-runtime/components/input/radioset/radioset.props.js.map +1 -1
  200. app-rn-runtime/components/input/radioset/radioset.styles.js +1 -0
  201. app-rn-runtime/components/input/radioset/radioset.styles.js.map +1 -1
  202. app-rn-runtime/components/input/select/select.component.js +23 -9
  203. app-rn-runtime/components/input/select/select.component.js.map +1 -1
  204. app-rn-runtime/components/input/switch/switch.component.js +2 -2
  205. app-rn-runtime/components/input/switch/switch.component.js.map +1 -1
  206. app-rn-runtime/components/input/text/text.component.js +21 -0
  207. app-rn-runtime/components/input/text/text.component.js.map +1 -1
  208. app-rn-runtime/components/input/text/text.props.js +2 -0
  209. app-rn-runtime/components/input/text/text.props.js.map +1 -1
  210. app-rn-runtime/components/input/text/text.styles.js.map +1 -1
  211. app-rn-runtime/components/input/textarea/textarea.component.js +21 -0
  212. app-rn-runtime/components/input/textarea/textarea.component.js.map +1 -1
  213. app-rn-runtime/components/input/textarea/textarea.props.js +2 -0
  214. app-rn-runtime/components/input/textarea/textarea.props.js.map +1 -1
  215. app-rn-runtime/components/input/toggle/toggle.component.js +2 -4
  216. app-rn-runtime/components/input/toggle/toggle.component.js.map +1 -1
  217. app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js +2 -2
  218. app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js.map +1 -1
  219. app-rn-runtime/components/navigation/basenav/basenav.component.js.map +1 -1
  220. app-rn-runtime/components/navigation/navitem/navitem.component.js +2 -3
  221. app-rn-runtime/components/navigation/navitem/navitem.component.js.map +1 -1
  222. app-rn-runtime/components/navigation/popover/popover.component.js.map +1 -1
  223. app-rn-runtime/components/page/content/content.component.js +19 -4
  224. app-rn-runtime/components/page/content/content.component.js.map +1 -1
  225. app-rn-runtime/components/page/page-content/page-content.component.js +27 -2
  226. app-rn-runtime/components/page/page-content/page-content.component.js.map +1 -1
  227. app-rn-runtime/components/page/page-content/page-content.props.js +2 -2
  228. app-rn-runtime/components/page/page-content/page-content.props.js.map +1 -1
  229. app-rn-runtime/components/page/page-content/page-content.styles.js +6 -1
  230. app-rn-runtime/components/page/page-content/page-content.styles.js.map +1 -1
  231. app-rn-runtime/components/page/page.component.js.map +1 -1
  232. app-rn-runtime/components/page/page.props.js.map +1 -1
  233. app-rn-runtime/components/page/page.styles.js +7 -1
  234. app-rn-runtime/components/page/page.styles.js.map +1 -1
  235. app-rn-runtime/components/page/partial/partial.component.js +27 -1
  236. app-rn-runtime/components/page/partial/partial.component.js.map +1 -1
  237. app-rn-runtime/components/page/partial/partial.props.js.map +1 -1
  238. app-rn-runtime/components/page/partial/partial.styles.js +6 -1
  239. app-rn-runtime/components/page/partial/partial.styles.js.map +1 -1
  240. app-rn-runtime/components/page/tabbar/curve.js.map +1 -1
  241. app-rn-runtime/components/page/tabbar/tabbar.component.js.map +1 -1
  242. app-rn-runtime/components/page/tabbar/tabbar.props.js +1 -0
  243. app-rn-runtime/components/page/tabbar/tabbar.props.js.map +1 -1
  244. app-rn-runtime/components/prefab/prefab-container.component.js +27 -1
  245. app-rn-runtime/components/prefab/prefab-container.component.js.map +1 -1
  246. app-rn-runtime/components/prefab/prefab-container.props.js.map +1 -1
  247. app-rn-runtime/components/prefab/prefab-container.styles.js +6 -1
  248. app-rn-runtime/components/prefab/prefab-container.styles.js.map +1 -1
  249. app-rn-runtime/core/base.component.js +5 -3
  250. app-rn-runtime/core/base.component.js.map +1 -1
  251. app-rn-runtime/core/components/textinput.component.js +4 -3
  252. app-rn-runtime/core/components/textinput.component.js.map +1 -1
  253. app-rn-runtime/core/formatters.js.map +1 -1
  254. app-rn-runtime/core/key.extractor.js.map +1 -1
  255. app-rn-runtime/core/props.provider.js +4 -1
  256. app-rn-runtime/core/props.provider.js.map +1 -1
  257. app-rn-runtime/core/storage.service.js.map +1 -1
  258. app-rn-runtime/core/tappable.component.js +34 -27
  259. app-rn-runtime/core/tappable.component.js.map +1 -1
  260. app-rn-runtime/core/ui-preferences.context.js +7 -0
  261. app-rn-runtime/core/ui-preferences.context.js.map +1 -0
  262. app-rn-runtime/core/utils.js +87 -4
  263. app-rn-runtime/core/utils.js.map +1 -1
  264. app-rn-runtime/package.json +30 -7
  265. app-rn-runtime/runtime/App.js +4 -8
  266. app-rn-runtime/runtime/App.js.map +1 -1
  267. app-rn-runtime/runtime/App.navigator.js.map +1 -1
  268. app-rn-runtime/runtime/base-fragment.component.js +43 -13
  269. app-rn-runtime/runtime/base-fragment.component.js.map +1 -1
  270. app-rn-runtime/runtime/base-page.component.js.map +1 -1
  271. app-rn-runtime/runtime/base-partial.component.js.map +1 -1
  272. app-rn-runtime/runtime/base-prefab.component.js.map +1 -1
  273. app-rn-runtime/runtime/navigator/stack.navigator.js.map +1 -1
  274. app-rn-runtime/runtime/services/app-i18n.service.js +10 -0
  275. app-rn-runtime/runtime/services/app-i18n.service.js.map +1 -1
  276. app-rn-runtime/runtime/services/app-security.service.js +42 -2
  277. app-rn-runtime/runtime/services/app-security.service.js.map +1 -1
  278. app-rn-runtime/runtime/services/app-spinner.service.js +1 -1
  279. app-rn-runtime/runtime/services/app-spinner.service.js.map +1 -1
  280. app-rn-runtime/runtime/services/webprocess.service.js.map +1 -1
  281. app-rn-runtime/runtime/watcher.js.map +1 -1
  282. app-rn-runtime/styles/background.component.js +1 -0
  283. app-rn-runtime/styles/background.component.js.map +1 -1
  284. app-rn-runtime/styles/style-prop.validator.js.map +1 -1
  285. app-rn-runtime/styles/theme.js +5 -0
  286. app-rn-runtime/styles/theme.js.map +1 -1
  287. app-rn-runtime/styles/theme.variables.js +1 -0
  288. app-rn-runtime/styles/theme.variables.js.map +1 -1
  289. app-rn-runtime/variables/base-variable.js.map +1 -1
  290. app-rn-runtime/variables/device/file/upload-file.operation.js.map +1 -1
  291. app-rn-runtime/variables/device-variable.js.map +1 -1
  292. app-rn-runtime/variables/service-variable.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["BaseComponent","BaseComponentState","find","isString","isEqual","isFunction","includes","get","forEach","isObject","isArray","filter","trim","uniqBy","uniqWith","getGroupedData","getOrderedDataset","isDefined","validateField","DEFAULT_CLASS","BaseDatasetState","constructor","args","_defineProperty","BaseDatasetComponent","props","defaultClass","defaultProps","defaultState","onPropertyChange","name","$new","$old","state","setDataItems","dataset","setGroupData","dataItems","dataValue","isDefault","updateState","onFieldChange","bind","items","groupby","groupedData","match","orderby","dateformat","onDataItemsUpdate","validate","value","validationObj","setState","isValid","errorType","updateDatavalue","Promise","resolve","datavalue","computeDisplayValue","onValueChange","datafield","selectedItem","item","key","dataObject","onChange","getItemKey","oldValue","then","invokeEventCallback","undefined","proxy","displayValue","selected","map","displayexp","displayfield","getUniqObjsByDataField","data","allowEmptyFields","uniqData","isAllFields","obj","propsObj","allowEmpty","datavalueItems","split","s","i","toString","push","isSelected","length","df","d","datafieldValue","_get","_get2","displaylabel","getDisplayExpression","imgSrc","displayimagesrc","icon","iconclass","isUpdated"],"sources":["basedataset.component.ts"],"sourcesContent":["import { BaseComponent, BaseComponentState } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport BaseDatasetProps from '@wavemaker/app-rn-runtime/components/input/basedataset/basedataset.props';\nimport { find, isString, isEqual,isEmpty, isFunction, includes, get, forEach, isObject, isArray, filter, trim, uniqBy, uniqWith } from 'lodash';\nimport { getGroupedData, getOrderedDataset, isDefined, validateField } from \"@wavemaker/app-rn-runtime/core/utils\";\nimport { DEFAULT_CLASS, BaseDatasetStyles } from \"@wavemaker/app-rn-runtime/components/input/basedataset/basedataset.styles\";\n\nexport class BaseDatasetState <T extends BaseDatasetProps> extends BaseComponentState<T> {\n dataItems: any;\n groupedData: any;\n isDefault = false;\n isValid = true;\n errorType = '';\n}\n\nexport abstract class BaseDatasetComponent< T extends BaseDatasetProps, S extends BaseDatasetState<T>, L extends BaseDatasetStyles> extends BaseComponent<T, S, L> {\n\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n const props = this.state.props;\n switch (name) {\n case 'dataset':\n this.setDataItems($new);\n break;\n case 'getDisplayExpression':\n case 'displayfield':\n case 'displaylabel':\n case 'displayimagesrc':\n case 'datafield':\n case 'orderby':\n this.setDataItems(this.state.props.dataset);\n break;\n case 'groupby':\n case 'match':\n this.setGroupData(this.state.dataItems);\n case 'datavalue':\n this.setDataItems(this.state.props.dataset, { dataValue: $new });\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n }\n }\n\n setGroupData(items: any) {\n const dataItems = items;\n const props = this.state.props;\n if (props.groupby) {\n const groupedData = dataItems && getGroupedData(dataItems, props.groupby, props.match, props.orderby, props.dateformat, this, 'dataObject');\n this.updateState({ groupedData: groupedData } as S, () => this.onDataItemsUpdate());\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.setState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n }\n\n updateDatavalue(value: any) {\n return new Promise<void>((resolve) => {\n this.updateState({\n props: { datavalue: value }\n } as S,\n () => {\n this.computeDisplayValue();\n resolve();\n });\n });\n }\n\n onValueChange(value: any) {\n if (this.state.props.datafield === 'All Fields') {\n const selectedItem = find(this.state.dataItems, (item) => isEqual(item.key, value));\n value = selectedItem && selectedItem.dataObject;\n }\n this.onChange(value);\n }\n\n getItemKey(value: any) {\n const selectedItem = find(this.state.dataItems, (item) => isEqual(item.dataObject, value));\n return selectedItem && selectedItem.key;\n }\n\n onChange(value: any) {\n const oldValue = this.state.props.datavalue;\n this.validate(value);\n this.updateDatavalue(value)\n .then(() => {\n if (value !== oldValue) {\n if (this.props.onFieldChange) {\n this.props.onFieldChange('datavalue', value, oldValue);\n } else {\n this.invokeEventCallback('onChange', [\n undefined,\n this.proxy,\n value,\n oldValue,\n ]);\n }\n }\n });\n }\n\n computeDisplayValue() {\n this.updateState({\n props: {\n displayValue: ((this.state.dataItems || [] as any)\n .filter((item: any) => item.selected)\n .map((item: any) => item.displayexp || item.displayfield))[0] || ''\n }\n } as S);\n }\n\n onDataItemsUpdate() {\n this.computeDisplayValue();\n }\n\n getUniqObjsByDataField(\n data: any,\n allowEmptyFields: boolean = true\n ) {\n let uniqData;\n const isAllFields = this.state.props.datafield === 'All Fields';\n\n uniqData = isAllFields ? uniqWith(data, isEqual) : uniqBy(data, 'datafield');\n\n if (!this.state.props.displayfield || allowEmptyFields) {\n return uniqData;\n }\n\n // return objects having non empty datafield and display field values.\n return filter(uniqData, (obj) => {\n if (isAllFields) {\n return trim(obj.displayfield);\n }\n return trim(obj.datafield) && trim(obj.displayfield);\n });\n }\n\n setDataItems(dataset: any, propsObj?: { [key: string]: any }, allowEmpty: boolean = true) {\n const name = this.props.name;\n const props = this.state.props;\n const datavalue = propsObj ? propsObj['dataValue'] : props.datavalue;\n let dataItems: any = [];\n let datavalueItems: any = [];\n if (typeof datavalue === 'string') {\n datavalueItems = datavalue.split(',');\n datavalueItems = allowEmpty ? datavalueItems : datavalueItems.map((item: any) => item.trim());\n } else if (isArray(datavalue)) {\n datavalueItems = datavalue;\n } else {\n if (isDefined(datavalue)) {\n datavalueItems = [datavalue];\n }\n }\n if (typeof dataset === 'string') {\n dataset = dataset.split(',');\n }\n if (isArray(dataset) && !isObject(dataset[0])) {\n dataItems = dataset.map((s, i) => {\n s = isString(s) ? s.trim() : s;\n return {\n key: `${name}_item${i}`,\n dataObject: s,\n displayfield: s.toString(),\n datafield: s,\n selected: includes(datavalueItems, s) || includes(datavalueItems, s.toString()) || datavalue === s ? true : false,\n };\n });\n } else if (dataset) {\n if (isObject(dataset) && !isArray(dataset)) {\n forEach(dataset, (value, key) => {\n if (isDefined(key) && key !== null) {\n dataItems.push({key: `${name}_item${key}`, displayfield: value, datafield: key, dataObject: dataset});\n }\n });\n } else {\n const isSelected = (item: any) => {\n if (datavalueItems.length) {\n let datafield = this.state.props.datafield;\n if (!datafield) {\n datafield = 'All Fields';\n }\n if (datafield === 'All Fields') {\n return includes(datavalueItems, item);\n }\n let df = get(item, datafield);\n if (isDefined(df) && df !== null) {\n return (includes(datavalueItems, df) || includes(datavalueItems, df.toString()));\n }\n }\n return false;\n };\n forEach(dataset as any[], (d, i) => {\n let datafieldValue = this.state.props.datafield === 'All Fields' ? d : get(d, this.state.props.datafield);\n if (isDefined(datafieldValue) && datafieldValue !== null) {\n dataItems.push({\n key: `${name}_item${i}`,\n dataObject: d,\n displayfield: (get(d, this.state.props.displayfield))?.toString() || (get(d, this.state.props.displaylabel))?.toString(),\n datafield: datafieldValue,\n displayexp: this.state.props.getDisplayExpression ? this.state.props.getDisplayExpression(d) : get(d, this.state.props.displayfield),\n selected: isSelected(d),\n imgSrc: isFunction(this.state.props.displayimagesrc) ? this.state.props.displayimagesrc(d) : get(d, this.state.props.displayimagesrc),\n icon: d[this.props.iconclass]\n });\n }\n });\n }\n }\n if (dataItems.length) {\n dataItems = this.getUniqObjsByDataField(dataItems, allowEmpty);\n }\n const isUpdated = !isEqual(dataItems, this.state.dataItems);\n if (props.groupby) {\n this.setGroupData(dataItems);\n this.updateState({ dataItems: dataItems } as S, () => isUpdated && this.onDataItemsUpdate());\n } else if (props.orderby) {\n this.updateState({ dataItems: getOrderedDataset(dataItems, props.orderby, 'dataObject')} as S, () => isUpdated && this.onDataItemsUpdate());\n } else {\n this.updateState({ dataItems: dataItems } as S, () => isUpdated && this.onDataItemsUpdate());\n }\n }\n}\n"],"mappings":";;;AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,SAASC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAUC,UAAU,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,QAAQ,QAA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SAAS,EAAEA;MAAU,CAAC,EAAO,MAAMqE,SAAS,IAAI,IAAI,CAACzD,iBAAiB,CAAC,CAAC,CAAC;IAC9F;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["BaseComponent","BaseComponentState","find","isString","isEqual","isFunction","includes","get","forEach","isObject","isArray","filter","trim","uniqBy","uniqWith","getGroupedData","getOrderedDataset","isDefined","validateField","DEFAULT_CLASS","BaseDatasetState","constructor","args","_defineProperty","BaseDatasetComponent","props","defaultClass","defaultProps","defaultState","onPropertyChange","name","$new","$old","state","setDataItems","dataset","setGroupData","dataItems","dataValue","isDefault","updateState","onFieldChange","bind","items","groupby","groupedData","match","orderby","dateformat","onDataItemsUpdate","validate","value","validationObj","setState","isValid","errorType","updateDatavalue","Promise","resolve","datavalue","computeDisplayValue","onValueChange","datafield","selectedItem","item","key","dataObject","onChange","getItemKey","oldValue","then","invokeEventCallback","undefined","proxy","displayValue","selected","map","displayexp","displayfield","getUniqObjsByDataField","data","allowEmptyFields","uniqData","isAllFields","obj","propsObj","allowEmpty","datavalueItems","split","s","i","toString","push","isSelected","length","df","d","datafieldValue","_get","_get2","displaylabel","getDisplayExpression","imgSrc","displayimagesrc","icon","iconclass","isUpdated"],"sources":["basedataset.component.ts"],"sourcesContent":["import { BaseComponent, BaseComponentState } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport BaseDatasetProps from '@wavemaker/app-rn-runtime/components/input/basedataset/basedataset.props';\nimport { find, isString, isEqual,isEmpty, isFunction, includes, get, forEach, isObject, isArray, filter, trim, uniqBy, uniqWith } from 'lodash';\nimport { getGroupedData, getOrderedDataset, isDefined, validateField } from \"@wavemaker/app-rn-runtime/core/utils\";\nimport { DEFAULT_CLASS, BaseDatasetStyles } from \"@wavemaker/app-rn-runtime/components/input/basedataset/basedataset.styles\";\n\nexport class BaseDatasetState <T extends BaseDatasetProps> extends BaseComponentState<T> {\n dataItems: any;\n groupedData: any;\n isDefault = false;\n isValid = true;\n errorType = '';\n}\n\nexport abstract class BaseDatasetComponent< T extends BaseDatasetProps, S extends BaseDatasetState<T>, L extends BaseDatasetStyles> extends BaseComponent<T, S, L> {\n\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n const props = this.state.props;\n switch (name) {\n case 'dataset':\n this.setDataItems($new);\n break;\n case 'getDisplayExpression':\n case 'displayfield':\n case 'displaylabel':\n case 'displayimagesrc':\n case 'datafield':\n case 'orderby':\n this.setDataItems(this.state.props.dataset);\n break;\n case 'groupby':\n case 'match':\n this.setGroupData(this.state.dataItems);\n case 'datavalue':\n this.setDataItems(this.state.props.dataset, { dataValue: $new });\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n }\n }\n\n setGroupData(items: any) {\n const dataItems = items;\n const props = this.state.props;\n if (props.groupby) {\n const groupedData = dataItems && getGroupedData(dataItems, props.groupby, props.match, props.orderby, props.dateformat, this, 'dataObject');\n this.updateState({ groupedData: groupedData } as S, () => this.onDataItemsUpdate());\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.setState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n }\n\n updateDatavalue(value: any) {\n return new Promise<void>((resolve) => {\n this.updateState({\n props: { datavalue: value }\n } as S,\n () => {\n this.computeDisplayValue();\n resolve();\n });\n });\n }\n\n onValueChange(value: any) {\n if (this.state.props.datafield === 'All Fields') {\n const selectedItem = find(this.state.dataItems, (item) => isEqual(item.key, value));\n value = selectedItem && selectedItem.dataObject;\n }\n this.onChange(value);\n }\n\n getItemKey(value: any) {\n const selectedItem = find(this.state.dataItems, (item) => isEqual(item.dataObject, value));\n return selectedItem && selectedItem.key;\n }\n\n onChange(value: any) {\n const oldValue = this.state.props.datavalue;\n this.validate(value);\n this.updateDatavalue(value)\n .then(() => {\n if (value !== oldValue) {\n if (this.props.onFieldChange) {\n this.props.onFieldChange('datavalue', value, oldValue);\n } else {\n this.invokeEventCallback('onChange', [\n undefined,\n this.proxy,\n value,\n oldValue,\n ]);\n }\n }\n });\n }\n\n computeDisplayValue() {\n this.updateState({\n props: {\n displayValue: ((this.state.dataItems || [] as any)\n .filter((item: any) => item.selected)\n .map((item: any) => item.displayexp || item.displayfield))[0] || ''\n }\n } as S);\n }\n\n onDataItemsUpdate() {\n this.computeDisplayValue();\n }\n\n getUniqObjsByDataField(\n data: any,\n allowEmptyFields: boolean = true\n ) {\n let uniqData;\n const isAllFields = this.state.props.datafield === 'All Fields';\n\n uniqData = isAllFields ? uniqWith(data, isEqual) : uniqBy(data, 'datafield');\n\n if (!this.state.props.displayfield || allowEmptyFields) {\n return uniqData;\n }\n\n // return objects having non empty datafield and display field values.\n return filter(uniqData, (obj) => {\n if (isAllFields) {\n return trim(obj.displayfield);\n }\n return trim(obj.datafield) && trim(obj.displayfield);\n });\n }\n\n setDataItems(dataset: any, propsObj?: { [key: string]: any }, allowEmpty: boolean = true) {\n const name = this.props.name;\n const props = this.state.props;\n const datavalue = propsObj ? propsObj['dataValue'] : props.datavalue;\n let dataItems: any = [];\n let datavalueItems: any = [];\n if (typeof datavalue === 'string') {\n datavalueItems = datavalue.split(',');\n datavalueItems = allowEmpty ? datavalueItems : datavalueItems.map((item: any) => item.trim());\n } else if (isArray(datavalue)) {\n datavalueItems = datavalue;\n } else {\n if (isDefined(datavalue)) {\n datavalueItems = [datavalue];\n }\n }\n if (typeof dataset === 'string') {\n dataset = dataset.split(',');\n }\n if (isArray(dataset) && !isObject(dataset[0])) {\n dataItems = dataset.map((s, i) => {\n s = isString(s) ? s.trim() : s;\n return {\n key: `${name}_item${i}`,\n dataObject: s,\n displayfield: s.toString(),\n datafield: s,\n selected: includes(datavalueItems, s) || includes(datavalueItems, s.toString()) || datavalue === s ? true : false,\n };\n });\n } else if (dataset) {\n if (isObject(dataset) && !isArray(dataset)) {\n forEach(dataset, (value, key) => {\n if (isDefined(key) && key !== null) {\n dataItems.push({key: `${name}_item${key}`, displayfield: value, datafield: key, dataObject: dataset});\n }\n });\n } else {\n const isSelected = (item: any) => {\n if (datavalueItems.length) {\n let datafield = this.state.props.datafield;\n if (!datafield) {\n datafield = 'All Fields';\n }\n if (datafield === 'All Fields') {\n return includes(datavalueItems, item);\n }\n let df = get(item, datafield);\n if (isDefined(df) && df !== null) {\n return (includes(datavalueItems, df) || includes(datavalueItems, df.toString()));\n }\n }\n return false;\n };\n forEach(dataset as any[], (d, i) => {\n let datafieldValue = this.state.props.datafield === 'All Fields' ? d : get(d, this.state.props.datafield);\n if (isDefined(datafieldValue) && datafieldValue !== null) {\n dataItems.push({\n key: `${name}_item${i}`,\n dataObject: d,\n displayfield: (get(d, this.state.props.displayfield))?.toString() || (get(d, this.state.props.displaylabel))?.toString(),\n datafield: datafieldValue,\n displayexp: this.state.props.getDisplayExpression ? this.state.props.getDisplayExpression(d) : get(d, this.state.props.displayfield),\n selected: isSelected(d),\n imgSrc: isFunction(this.state.props.displayimagesrc) ? this.state.props.displayimagesrc(d) : get(d, this.state.props.displayimagesrc),\n icon: d[this.props.iconclass]\n });\n }\n });\n }\n }\n if (dataItems.length) {\n dataItems = this.getUniqObjsByDataField(dataItems, allowEmpty);\n }\n const isUpdated = !isEqual(dataItems, this.state.dataItems);\n if (props.groupby) {\n this.setGroupData(dataItems);\n this.updateState({ dataItems: dataItems } as S, () => isUpdated && this.onDataItemsUpdate());\n } else if (props.orderby) {\n this.updateState({ dataItems: getOrderedDataset(dataItems, props.orderby, 'dataObject')} as S, () => isUpdated && this.onDataItemsUpdate());\n } else {\n this.updateState({ dataItems: dataItems } as S, () => isUpdated && this.onDataItemsUpdate());\n }\n }\n}\n"],"mappings":";;;AAAA,SAASA,aAAa,EAAEC,kBAAk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AAS,EAAErB,iBAAiB,CAACqB,SAAS,EAAEZ,KAAK,CAACsB,OAAO,EAAE,YAAY;MAAC,CAAC,EAAO,MAAM2D,SAAS,IAAI,IAAI,CAACzD,iBAAiB,CAAC,CAAC,CAAC;IAC7I,CAAC,MAAM;MACL,IAAI,CAACT,WAAW,CAAC;QAAEH,SAAS,EAAEA;MAAU,CAAC,EAAO,MAAMqE,SAAS,IAAI,IAAI,CAACzD,iBAAiB,CAAC,CAAC,CAAC;IAC9F;EACF;AACF","ignoreList":[]}
@@ -96,11 +96,18 @@ export class BaseInputComponent extends BaseComponent {
96
96
  if (props.autotrim && props.datavalue && isString(props.datavalue)) {
97
97
  value = value.trim();
98
98
  }
99
- this.updateState({
100
- props: {
101
- datavalue: value
99
+ new Promise(resolve => {
100
+ if (props.hastwowaybinding) {
101
+ this.setProp("datavalue", value);
102
+ resolve(true);
103
+ } else {
104
+ this.updateState({
105
+ props: {
106
+ datavalue: value
107
+ }
108
+ }, () => resolve(true));
102
109
  }
103
- }, () => {
110
+ }).then(() => {
104
111
  !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, value, oldValue]);
105
112
  if (source === 'blur') {
106
113
  this.invokeEventCallback('onBlur', [event, this.proxy]);
@@ -1 +1 @@
1
- {"version":3,"names":["DEFAULT_CLASS","BaseComponent","BaseComponentState","isString","Platform","validateField","Injector","BaseInputState","constructor","args","_defineProperty","BaseInputComponent","props","defaultClass","defaultProps","defaultState","focus","_this$widgetRef","widgetRef","blur","_this$widgetRef2","_this$widgetRef3","onPropertyChange","name","$new","$old","keyboardType","type","updateState","textValue","isDefault","state","onFieldChange","bind","onChange","event","updateon","updateDatavalue","target","value","onChangeText","validate","invokeChange","e","OS","cursor","selectionStart","setState","source","oldValue","datavalue","autotrim","trim","invokeEventCallback","proxy","onBlur","FOCUSED_ELEMENT","remove","isTouched","newVal","oldVal","undefined","setTimeout","triggerValidation","validationObj","isValid","errorType","onFocus","_this$closestTappable","set","closestTappable","triggerTap","onKeyPress"],"sources":["baseinput.component.ts"],"sourcesContent":["import { DEFAULT_CLASS } from '@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport BaseInputProps from './baseinput.props';\nimport { isString } from 'lodash';\nimport { BaseInputStyles } from './baseinput.styles';\nimport { Platform, TextInput } from 'react-native';\nimport { validateField } from '@wavemaker/app-rn-runtime/core/utils';\nimport Injector from '@wavemaker/app-rn-runtime/core/injector';\n\nexport class BaseInputState <T extends BaseInputProps> extends BaseComponentState<T> {\n keyboardType: any = 'default';\n isValid: boolean = true;\n textValue: string = '';\n isDefault = false;\n errorType: string = '';\n}\nexport abstract class BaseInputComponent< T extends BaseInputProps, S extends BaseInputState<T>, L extends BaseInputStyles> extends BaseComponent<T, S, L> {\n public widgetRef: TextInput | null = null;\n isTouched: boolean = false;\n private cursor: any = 0;\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n }\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n blur() {\n this?.widgetRef?.blur && this?.widgetRef?.blur();\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'type':\n let keyboardType;\n if (this.props.type === 'number') {\n keyboardType = 'numeric';\n } else if (this.props.type === 'tel') {\n keyboardType = 'phone-pad';\n } else if (this.props.type === 'email') {\n keyboardType = 'email-address';\n }\n this.updateState({\n keyboardType: keyboardType,\n } as S);\n break;\n case 'datavalue':\n this.updateState({\n textValue: $new\n } as S\n );\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n }\n }\n\n onChange(event: any) {\n if (this.state.props.updateon === 'default') {\n this.updateDatavalue(event.target.value, event);\n }\n }\n\n onChangeText(value: any) {\n this.updateState({\n textValue: value\n } as S, () => {\n if (this.state.props.updateon === 'default') {\n this.validate(value);\n this.updateDatavalue(value, null);\n }\n }\n );\n }\n\n invokeChange(e: any) {\n if (Platform.OS === 'web') {\n this.cursor = e.target.selectionStart;\n this.setState({ textValue: e.target.value });\n }\n }\n\n updateDatavalue(value: any, event?: any, source?: any) {\n const props = this.state.props;\n const oldValue = props.datavalue;\n if (value === oldValue) {\n return;\n }\n\n // autotrim\n if (props.autotrim && props.datavalue && isString(props.datavalue)) {\n value = value.trim();\n }\n\n this.updateState({\n props: {\n datavalue: value\n }\n } as S, () => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, value, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [ event, this.proxy]);\n }\n })\n\n }\n\n onBlur(event: any) {\n Injector.FOCUSED_ELEMENT.remove();\n this.isTouched = true;\n let newVal = this.state.textValue;\n let oldVal = this.state.props.datavalue || '';\n this.validate(newVal);\n if (newVal === '' || newVal == undefined) {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n },10)\n }\n if (this.state.props.updateon === 'blur') {\n if (oldVal !== newVal) {\n this.updateDatavalue(newVal, event, 'blur');\n } else {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.setState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n }\n\n onFocus(event: any) {\n // When input widgets are inside list widget and try to focus the field, list is selecting but unable to enter values in input fields\n // because on tap event of list is triggering after 200ms timeout So added 250ms timeout here\n setTimeout(() => {\n Injector.FOCUSED_ELEMENT.set(this);\n this.invokeEventCallback('onFocus', [ event, this.proxy]);\n this.closestTappable?.triggerTap();\n }, 250);\n\n }\n\n onKeyPress(event: any) {\n this.invokeEventCallback('onKeypress', [ event, this.proxy]);\n }\n}\n"],"mappings":";;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,EAAED,aAAa,CAACC,OAAO;MAC9BC,SAAS,EAAEF,aAAa,CAACE;IAC3B,CAAM,CAAC;EACT;EAEAC,OAAOA,CAAChC,KAAU,EAAE;IAClB;IACA;IACA2B,UAAU,CAAC,MAAM;MAAA,IAAAM,qBAAA;MACf9D,QAAQ,CAACkD,eAAe,CAACa,GAAG,CAAC,IAAI,CAAC;MAClC,IAAI,CAAChB,mBAAmB,CAAC,SAAS,EAAE,CAAElB,KAAK,EAAE,IAAI,CAACmB,KAAK,CAAC,CAAC;MACzD,CAAAc,qBAAA,OAAI,CAACE,eAAe,cAAAF,qBAAA,eAApBA,qBAAA,CAAsBG,UAAU,CAAC,CAAC;IACpC,CAAC,EAAE,GAAG,CAAC;EAET;EAEAC,UAAUA,CAACrC,KAAU,EAAE;IACrB,IAAI,CAACkB,mBAAmB,CAAC,YAAY,EAAE,CAAElB,KAAK,EAAE,IAAI,CAACmB,KAAK,CAAC,CAAC;EAC9D;AACF","ignoreList":[]}
1
+ {"version":3,"names":["DEFAULT_CLASS","BaseComponent","BaseComponentState","isString","Platform","validateField","Injector","BaseInputState","constructor","args","_defineProperty","BaseInputComponent","props","defaultClass","defaultProps","defaultState","focus","_this$widgetRef","widgetRef","blur","_this$widgetRef2","_this$widgetRef3","onPropertyChange","name","$new","$old","keyboardType","type","updateState","textValue","isDefault","state","onFieldChange","bind","onChange","event","updateon","updateDatavalue","target","value","onChangeText","validate","invokeChange","e","OS","cursor","selectionStart","setState","source","oldValue","datavalue","autotrim","trim","Promise","resolve","hastwowaybinding","setProp","then","invokeEventCallback","proxy","onBlur","FOCUSED_ELEMENT","remove","isTouched","newVal","oldVal","undefined","setTimeout","triggerValidation","validationObj","isValid","errorType","onFocus","_this$closestTappable","set","closestTappable","triggerTap","onKeyPress"],"sources":["baseinput.component.ts"],"sourcesContent":["import { DEFAULT_CLASS } from '@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport BaseInputProps from './baseinput.props';\nimport { isString } from 'lodash';\nimport { BaseInputStyles } from './baseinput.styles';\nimport { Platform, TextInput } from 'react-native';\nimport { validateField } from '@wavemaker/app-rn-runtime/core/utils';\nimport Injector from '@wavemaker/app-rn-runtime/core/injector';\n\nexport class BaseInputState <T extends BaseInputProps> extends BaseComponentState<T> {\n keyboardType: any = 'default';\n isValid: boolean = true;\n textValue: string = '';\n isDefault = false;\n errorType: string = '';\n}\nexport abstract class BaseInputComponent< T extends BaseInputProps, S extends BaseInputState<T>, L extends BaseInputStyles> extends BaseComponent<T, S, L> {\n public widgetRef: TextInput | null = null;\n isTouched: boolean = false;\n private cursor: any = 0;\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n }\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n blur() {\n this?.widgetRef?.blur && this?.widgetRef?.blur();\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'type':\n let keyboardType;\n if (this.props.type === 'number') {\n keyboardType = 'numeric';\n } else if (this.props.type === 'tel') {\n keyboardType = 'phone-pad';\n } else if (this.props.type === 'email') {\n keyboardType = 'email-address';\n }\n this.updateState({\n keyboardType: keyboardType,\n } as S);\n break;\n case 'datavalue':\n this.updateState({\n textValue: $new\n } as S\n );\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n }\n }\n\n onChange(event: any) {\n if (this.state.props.updateon === 'default') {\n this.updateDatavalue(event.target.value, event);\n }\n }\n\n onChangeText(value: any) {\n this.updateState({\n textValue: value\n } as S, () => {\n if (this.state.props.updateon === 'default') {\n this.validate(value);\n this.updateDatavalue(value, null);\n }\n }\n );\n }\n\n invokeChange(e: any) {\n if (Platform.OS === 'web') {\n this.cursor = e.target.selectionStart;\n this.setState({ textValue: e.target.value });\n }\n }\n\n updateDatavalue(value: any, event?: any, source?: any) {\n const props = this.state.props;\n const oldValue = props.datavalue;\n if (value === oldValue) {\n return;\n }\n\n // autotrim\n if (props.autotrim && props.datavalue && isString(props.datavalue)) {\n value = value.trim();\n }\n new Promise((resolve) => {\n if (props.hastwowaybinding) {\n this.setProp(\"datavalue\", value);\n resolve(true);\n } else {\n this.updateState({\n props: {\n datavalue: value\n }\n } as S, () => resolve(true));\n }\n }).then(() => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, value, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [ event, this.proxy]);\n }\n })\n }\n\n onBlur(event: any) {\n Injector.FOCUSED_ELEMENT.remove();\n this.isTouched = true;\n let newVal = this.state.textValue;\n let oldVal = this.state.props.datavalue || '';\n this.validate(newVal);\n if (newVal === '' || newVal == undefined) {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n },10)\n }\n if (this.state.props.updateon === 'blur') {\n if (oldVal !== newVal) {\n this.updateDatavalue(newVal, event, 'blur');\n } else {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.setState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n }\n\n onFocus(event: any) {\n // When input widgets are inside list widget and try to focus the field, list is selecting but unable to enter values in input fields\n // because on tap event of list is triggering after 200ms timeout So added 250ms timeout here\n setTimeout(() => {\n Injector.FOCUSED_ELEMENT.set(this);\n this.invokeEventCallback('onFocus', [ event, this.proxy]);\n this.closestTappable?.triggerTap();\n }, 250);\n\n }\n\n onKeyPress(event: any) {\n this.invokeEventCallback('onKeypress', [ event, this.proxy]);\n }\n}\n"],"mappings":";;;AAAA,SAASA,aAAa,QAAQ,wEAAwE;AACtG,SAASC,aAAa,EAAEC,kBA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AK,CAAC,CAAC;MACzD;IACF;EACF;EAEAlB,QAAQA,CAACF,KAAU,EAAE;IACnB,MAAM8B,aAAa,GAAGhE,aAAa,CAAC,IAAI,CAAC0B,KAAK,CAACnB,KAAK,EAAE2B,KAAK,CAAC;IAC5D,IAAI,CAACQ,QAAQ,CAAC;MACZuB,OAAO,EAAED,aAAa,CAACC,OAAO;MAC9BC,SAAS,EAAEF,aAAa,CAACE;IAC3B,CAAM,CAAC;EACT;EAEAC,OAAOA,CAACrC,KAAU,EAAE;IAClB;IACA;IACAgC,UAAU,CAAC,MAAM;MAAA,IAAAM,qBAAA;MACfnE,QAAQ,CAACuD,eAAe,CAACa,GAAG,CAAC,IAAI,CAAC;MAClC,IAAI,CAAChB,mBAAmB,CAAC,SAAS,EAAE,CAAEvB,KAAK,EAAE,IAAI,CAACwB,KAAK,CAAC,CAAC;MACzD,CAAAc,qBAAA,OAAI,CAACE,eAAe,cAAAF,qBAAA,eAApBA,qBAAA,CAAsBG,UAAU,CAAC,CAAC;IACpC,CAAC,EAAE,GAAG,CAAC;EAET;EAEAC,UAAUA,CAAC1C,KAAU,EAAE;IACrB,IAAI,CAACuB,mBAAmB,CAAC,YAAY,EAAE,CAAEvB,KAAK,EAAE,IAAI,CAACwB,KAAK,CAAC,CAAC;EAC9D;AACF","ignoreList":[]}
@@ -9,6 +9,7 @@ export default class BaseInputProps extends BaseProps {
9
9
  _defineProperty(this, "autocomplete", true);
10
10
  _defineProperty(this, "autotrim", true);
11
11
  _defineProperty(this, "datavalue", void 0);
12
+ _defineProperty(this, "hastwowaybinding", false);
12
13
  _defineProperty(this, "maxchars", null);
13
14
  _defineProperty(this, "readonly", null);
14
15
  _defineProperty(this, "regexp", null);
@@ -1 +1 @@
1
- {"version":3,"names":["BaseProps","BaseInputProps","constructor","args","_defineProperty","undefined"],"sources":["baseinput.props.ts"],"sourcesContent":["import {AccessibilityRole} from \"react-native\";\nimport { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class BaseInputProps extends BaseProps {\n autofocus: boolean = null as any;\n autocomplete: boolean = true;\n autotrim: boolean = true;\n datavalue: any;\n maxchars: number = null as any;\n readonly: boolean = null as any;\n regexp: string = null as any;\n type: string = 'text';\n updateon: string = 'blur' as any;\n required?: boolean = false as any;\n checkFormField?: any;\n onFieldChange?: any;\n triggerValidation?: any;\n accessibilitylabel?: string = undefined;\n hint?: string = undefined;\n accessibilityrole?: AccessibilityRole;\n accessibilitylabelledby?: string = undefined;\n maskchar: string = null as any;\n displayformat: string = null as any;\n}\n"],"mappings":";;;AACA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,cAAc,SAASD,SAAS,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBAC/B,IAAI;IAAAA,eAAA,uBACD,IAAI;IAAAA,eAAA,mBACR,IAAI;IAAAA,eAAA;IAAAA,eAAA,mBAEL,IAAI;IAAAA,eAAA,mBACH,IAAI;IAAAA,eAAA,iBACP,IAAI;IAAAA,eAAA,eACN,MAAM;IAAAA,eAAA,mBACF,MAAM;IAAAA,eAAA,mBACJ,KAAK;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,6BAIIC,SAAS;IAAAD,eAAA,eACvBC,SAAS;IAAAD,eAAA;IAAAA,eAAA,kCAEUC,SAAS;IAAAD,eAAA,mBACzB,IAAI;IAAAA,eAAA,wBACC,IAAI;EAAA;AAC9B","ignoreList":[]}
1
+ {"version":3,"names":["BaseProps","BaseInputProps","constructor","args","_defineProperty","undefined"],"sources":["baseinput.props.ts"],"sourcesContent":["import {AccessibilityRole} from \"react-native\";\nimport { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class BaseInputProps extends BaseProps {\n autofocus: boolean = null as any;\n autocomplete: boolean = true;\n autotrim: boolean = true;\n datavalue: any;\n hastwowaybinding = false;\n maxchars: number = null as any;\n readonly: boolean = null as any;\n regexp: string = null as any;\n type: string = 'text';\n updateon: string = 'blur' as any;\n required?: boolean = false as any;\n checkFormField?: any;\n onFieldChange?: any;\n triggerValidation?: any;\n accessibilitylabel?: string = undefined;\n hint?: string = undefined;\n accessibilityrole?: AccessibilityRole;\n accessibilitylabelledby?: string = undefined;\n maskchar: string = null as any;\n displayformat: string = null as any;\n}\n"],"mappings":";;;AACA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,cAAc,SAASD,SAAS,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBAC/B,IAAI;IAAAA,eAAA,uBACD,IAAI;IAAAA,eAAA,mBACR,IAAI;IAAAA,eAAA;IAAAA,eAAA,2BAEL,KAAK;IAAAA,eAAA,mBACL,IAAI;IAAAA,eAAA,mBACH,IAAI;IAAAA,eAAA,iBACP,IAAI;IAAAA,eAAA,eACN,MAAM;IAAAA,eAAA,mBACF,MAAM;IAAAA,eAAA,mBACJ,KAAK;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,6BAIIC,SAAS;IAAAD,eAAA,eACvBC,SAAS;IAAAD,eAAA;IAAAA,eAAA,kCAEUC,SAAS;IAAAD,eAAA,mBACzB,IAAI;IAAAA,eAAA,wBACC,IAAI;EAAA;AAC9B","ignoreList":[]}
@@ -66,21 +66,22 @@ export class BaseNumberComponent extends BaseComponent {
66
66
  }
67
67
  return isValidText;
68
68
  }
69
- onChangeText(value, type) {
70
- const isValidTextOnDevice = this.validateOnDevice(value, type);
69
+ onChangeText(value, type, shouldFormateToNumber) {
70
+ const newValue = shouldFormateToNumber ? `${this.parseNumber(value.replace(/[^0-9.]/g, ''))}` : value;
71
+ const isValidTextOnDevice = this.validateOnDevice(newValue, type);
71
72
  if (!isValidTextOnDevice) {
72
73
  return;
73
74
  }
74
- const decimalPlacesInNumber = countDecimalDigits(value);
75
+ const decimalPlacesInNumber = countDecimalDigits(newValue);
75
76
  if (this.props.decimalPlaces < decimalPlacesInNumber) {
76
77
  return;
77
78
  }
78
79
  this.updateState({
79
- textValue: value
80
+ textValue: newValue
80
81
  }, () => {
81
82
  if (this.state.props.updateon === 'default') {
82
- this.validate(value);
83
- this.updateDatavalue(value, null);
83
+ this.validate(newValue);
84
+ this.updateDatavalue(newValue, null);
84
85
  }
85
86
  });
86
87
  }
@@ -155,19 +156,26 @@ export class BaseNumberComponent extends BaseComponent {
155
156
  this.invokeEventCallback('onError', [event, this.proxy, value, oldValue]);
156
157
  return;
157
158
  }
158
- this.updateState({
159
- props: {
160
- datavalue: model || Number(value)
159
+ new Promise(resolve => {
160
+ if (props.hastwowaybinding) {
161
+ this.setProp("datavalue", value);
162
+ resolve(true);
163
+ } else {
164
+ this.updateState({
165
+ props: {
166
+ datavalue: model || Number(value)
167
+ }
168
+ }, () => resolve(true));
161
169
  }
162
- }, () => {
170
+ }).then(() => {
163
171
  !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, model, oldValue]);
164
172
  if (source === 'blur') {
165
173
  this.invokeEventCallback('onBlur', [event, this.proxy]);
166
174
  }
167
175
  });
168
176
  }
169
- onBlur(event) {
170
- let newVal = event.target.value || this.state.textValue;
177
+ onBlur(event, isDisplayValuePresent) {
178
+ let newVal = isDisplayValuePresent ? this.state.textValue : event.target.value || this.state.textValue;
171
179
  this.validate(newVal);
172
180
  if (newVal === '' || newVal == undefined) {
173
181
  setTimeout(() => {
@@ -308,6 +316,11 @@ export class BaseNumberComponent extends BaseComponent {
308
316
  } else {
309
317
  this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);
310
318
  }
319
+ break;
320
+ case 'displayValue':
321
+ this.updateState({
322
+ displayValue: $new
323
+ });
311
324
  }
312
325
  }
313
326
  }
@@ -1 +1 @@
1
- {"version":3,"names":["includes","intersection","isNaN","isFinite","toArray","isNil","BaseComponent","BaseComponentState","DEFAULT_CLASS","Platform","countDecimalDigits","validateField","BaseNumberState","constructor","args","_defineProperty","BaseNumberComponent","props","defaultClass","defaultProps","defaultState","DECIMAL","GROUP","onChange","event","state","updateon","updateDatavalue","target","value","focus","_this$widgetRef","widgetRef","validateOnDevice","type","_value$match","isCurrencyField","isValidText","test","Number","match","length","onChangeText","isValidTextOnDevice","decimalPlacesInNumber","decimalPlaces","updateState","textValue","validate","invokeChange","e","OS","cursor","selectionStart","setState","validationObj","isValid","errorType","handleValidation","regexp","condition","RegExp","parseNumber","val","parts","split","NaN","number","join","decimal","sum","parseFloat","toFixed","Object","is","source","model","toString","oldValue","datavalue","validNumber","isValidNumber","invokeEventCallback","proxy","onFieldChange","onBlur","newVal","undefined","setTimeout","triggerValidation","oldVal","onFocus","countDecimals","decimalValue","validateInputEntry","$event","ctrlKey","key","validity","inputValue","step","preventDefault","getValueInRange","minvalue","maxvalue","required","isInteger","resetValidations","onPropertyChange","name","$new","$old","isDefault","bind"],"sources":["basenumber.component.ts"],"sourcesContent":["import { includes, intersection, isNaN, isFinite, toArray, isNil } from 'lodash';\nimport BaseNumberProps from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.props';\nimport { BaseComponent, BaseComponentState } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport { BaseNumberStyles } from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.styles';\nimport { DEFAULT_CLASS } from \"@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles\";\nimport { Platform, TextInput } from 'react-native';\nimport { countDecimalDigits, validateField } from '@wavemaker/app-rn-runtime/core/utils';\n\nexport class BaseNumberState <T extends BaseNumberProps> extends BaseComponentState<T> {\n isValid: boolean = true;\n textValue: string = '';\n isDefault = false;\n errorType = '';\n}\n\nexport abstract class BaseNumberComponent< T extends BaseNumberProps, S extends BaseNumberState<T>, L extends BaseNumberStyles> extends BaseComponent<T, S, L> {\n private DECIMAL;\n private GROUP;\n public widgetRef: TextInput | null = null;\n private cursor: any = 0;\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n this.DECIMAL = '.';\n this.GROUP = ',';\n }\n\n onChange(event: any) {\n if (this.state.props.updateon === 'default') {\n this.updateDatavalue(event.target.value, event);\n }\n }\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n validateOnDevice(value: string, type: 'number' | 'currency') {\n const isCurrencyField = type === 'currency';\n let isValidText = true;\n\n // * no alphabets except E, may contain E only once\n if (/[a-df-zA-DF-Z]/.test(value) || !/^[^eE]*[eE]?[^eE]*$/.test(value)) {\n isValidText = false;\n }\n\n // * currency only: check for negative number\n if (isCurrencyField && (Number(value) < 0 || /-/g.test(value))) {\n isValidText = false;\n }\n\n // * number only: not more than one minus and doesn't end with minus (-)\n if (!isCurrencyField && (Number(value.match(/-/g)?.length) > 1) || /\\w-/.test(value)) {\n isValidText = false;\n }\n\n // * check for more than one decimal point\n if (/^\\d*\\.\\d*\\..*$/.test(value)) {\n isValidText = false;\n }\n\n // * check for spaces and comma\n if (/[\\s,]/.test(value)) {\n isValidText = false;\n }\n\n return isValidText;\n }\n\n onChangeText(value: string, type: 'number' | 'currency') {\n const isValidTextOnDevice = this.validateOnDevice(value, type);\n if (!isValidTextOnDevice) {\n return;\n }\n\n const decimalPlacesInNumber = countDecimalDigits(value);\n\n if (this.props.decimalPlaces < decimalPlacesInNumber) {\n return;\n }\n\n this.updateState({\n textValue: value\n } as S, () => {\n if (this.state.props.updateon === 'default') {\n this.validate(value);\n this.updateDatavalue(value, null);\n }\n }\n );\n }\n\n invokeChange(e: any) {\n if (Platform.OS === 'web') {\n this.cursor = e.target.selectionStart;\n this.setState({ textValue: e.target.value });\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n\n }\n\n handleValidation(value: any) {\n const props = this.state.props;\n if (props.regexp) {\n const condition = new RegExp(props.regexp, 'g');\n return condition.test(value);\n }\n return true;\n }\n\n /**\n * Method parses the Localized number(string) to a valid number.\n * if the string dose not result to a valid number then returns NaN.\n * @param {string} val Localized number.\n * @returns {number}\n */\n private parseNumber(val: string): any {\n // splits string into two parts. decimal and number.\n const parts = val.split(this.DECIMAL);\n if (!parts.length) {\n return;\n }\n if (parts.length > 2) {\n return NaN;\n }\n // If number have decimal point and not have a decimal value then return.\n if (parts[1] === '') {\n return NaN;\n }\n // replaces all group separators form the number.\n const number = Number(parts[0].split(this.GROUP).join(''));\n const decimal = Number(`0.${parts[1] || 0}`);\n if (Number.isNaN(number) || Number.isNaN(decimal)) {\n return NaN;\n }\n const sum = parts.length > 1 ? parseFloat((number + decimal).toFixed(parts[1].length)) : number + decimal;\n // if the number is negative then calculate the number as number - decimal\n // Ex: number = -123 and decimal = 0.45 then number - decimal = -123-045 = -123.45\n // If entered number is -0.1 to -0.9 then the number is -0 and decimal is 0.1 to 0.9. Now calaculate the number as number-decimal\n // Ex: number = -0 and decimal = 0.1 then number-decimal = -0-0.1 = -0.1\n if (number === 0) {\n return Object.is(0, number) ? sum : number - decimal;\n }\n return number > 0 ? sum : number - decimal;\n }\n\n updateDatavalue(value: any, event?: any, source?: any) {\n const model = value && this.parseNumber(value.toString());\n const props = this.state.props;\n const oldValue = props.datavalue;\n if (value === oldValue) {\n return;\n }\n const validNumber = this.isValidNumber(model) || value == oldValue + '.';\n if (!validNumber) {\n this.invokeEventCallback('onError', [ event, this.proxy, value, oldValue ]);\n return;\n }\n\n this.updateState({\n props: {\n datavalue: model || Number(value)\n }\n } as S, () => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, model, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n });\n }\n\n onBlur(event: any) {\n let newVal = event.target.value || this.state.textValue;\n this.validate(newVal);\n if (newVal === '' || newVal == undefined) {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n },10)\n }\n if (this.state.props.updateon === 'blur') {\n let oldVal = this.state.props.datavalue || '';\n if (oldVal !== newVal) {\n this.updateDatavalue(newVal, event, 'blur');\n } else {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n }\n }\n\n onFocus(event: any) {\n this.invokeEventCallback('onFocus', [ event, this.proxy]);\n }\n\n /**\n * returns the number of decimal places a number have.\n * @param value: number\n * @returns {number}\n */\n private countDecimals(value: any) {\n if (value && ((value % 1) !== 0)) {\n const decimalValue = value.toString().split('.')[1];\n return decimalValue && decimalValue.length;\n }\n return 0;\n }\n\n public validateInputEntry($event: any) {\n const props = this.state.props;\n\n // allow actions if control key is pressed or if backspace is pressed. (for Mozilla).\n if ($event.ctrlKey || includes(['Backspace', 'ArrowRight', 'ArrowLeft', 'Tab', 'Enter', 'Delete'], $event.key)) {\n return;\n }\n\n const validity = new RegExp(`^[\\\\d\\\\s-,.e+${this.GROUP}${this.DECIMAL}]$`, 'i');\n const inputValue = $event.target.value;\n // validates entering of decimal values only when user provides decimal limit(i.e step contains decimal values).\n if (inputValue && this.countDecimals(props.step) && (this.countDecimals(inputValue) >= this.countDecimals(props.step))) {\n $event.preventDefault();\n }\n // validates if user entered an invalid character.\n if (!validity.test($event.key)) {\n $event.preventDefault();\n }\n // a decimal value can be entered only once in the input.\n if (includes(inputValue, this.DECIMAL) && $event.key === this.DECIMAL) {\n $event.preventDefault();\n }\n // 'e' can be entered only once in the input.\n if (intersection(toArray(inputValue), ['e', 'E']).length && includes('eE', $event.key)) {\n $event.preventDefault();\n }\n if ((includes(inputValue, '+') || includes(inputValue, '-')) && ($event.key === '+' || $event.key === '-')) {\n $event.preventDefault();\n }\n this.invokeEventCallback('onKeypress', [ $event, this.proxy]);\n }\n\n /**\n * returns a valid number by validating the minimum and maximum values.\n * @param {number} value\n * @returns {number}\n */\n private getValueInRange(value: number): number {\n const props = this.state.props;\n if (!isNil(value) && !isNaN(props.minvalue) && value < props.minvalue) {\n this.updateState({ errorType: 'minvalue'} as S);\n return props.minvalue;\n }\n if (!isNil(value) && !isNaN(props.maxvalue) && value > props.maxvalue) {\n this.updateState({ errorType: 'maxvalue'} as S);\n return props.maxvalue;\n }\n return value;\n }\n\n /**\n * Adds validations for the number before updating the widget model. like validating min and max value for the widget.\n * @param {number} val number to be validated\n * @returns {number}\n */\n private isValidNumber(val: number): boolean {\n const props = this.state.props;\n\n //empty number widget should not show validation error when required is false\n // @ts-ignore\n if (this.state.props.required === false && val === '') {\n return true;\n }\n // id number is infinite then consider it as invalid value\n if (isNaN(val) || !isFinite(val) || (!Number.isInteger(props.step) &&\n this.countDecimals(val) > this.countDecimals(props.step))) {\n this.updateState({\n isValid: false,\n } as S);\n return false;\n }\n if (val !== this.getValueInRange(val)) {\n this.updateState({\n isValid: false,\n } as S);\n return true;\n }\n this.resetValidations();\n return true;\n }\n\n // resets all the flags related to the widget's validation.\n protected resetValidations() {\n this.updateState({\n isValid: true,\n } as S);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'minvalue':\n case 'maxvalue':\n if ($new|| $old) {\n this.isValidNumber($new);\n }\n break;\n case 'datavalue':\n this.updateState({\n textValue: $new,\n } as S);\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n }\n }\n}\n"],"mappings":";;;AAAA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,QAAQ,QAAQ;AAEhF,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,SAASC,aAAa,QAAQ,wEAAwE;AACtG,SAASC,QAAQ,QAAmB,cAAc;AAClD,SAASC,kBAAkB,EAAEC,aAAa,QAAQ,sCAAsC;AAExF,OAAO,MAAMC,eAAe,SAAqCL,kBAAkB,CAAI;EAAAM,YAAA,GAAAC,IAAA;IAAA,SAAAA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EAAE;IACX,CAAM,CAAC;EACT;EAEAoD,gBAAgBA,CAACC,IAAY,EAAEC,IAAS,EAAEC,IAAS,EAAE;IACnD,QAAQF,IAAI;MACV,KAAK,UAAU;MACf,KAAK,UAAU;QACb,IAAIC,IAAI,IAAGC,IAAI,EAAE;UACf,IAAI,CAAC9B,aAAa,CAAC6B,IAAI,CAAC;QAC1B;QACA;MACF,KAAK,WAAW;QACd,IAAI,CAAChE,WAAW,CAAC;UACfC,SAAS,EAAE+D;QACb,CAAM,CAAC;QACP,MAAME,SAAS,GAAG,IAAI,CAACvF,KAAK,CAACuF,SAAS;QACtC,IAAIA,SAAS,EAAE;UACb,IAAI,CAAClE,WAAW,CAAC;YAAEkE,SAAS,EAAE;UAAM,CAAC,EAAO,IAAI,CAAC/F,KAAK,CAACmE,aAAa,IAAI,IAAI,CAACnE,KAAK,CAACmE,aAAa,CAAC6B,IAAI,CAAC,IAAI,EAAE,WAAW,EAAEH,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC,CAAC;QAClJ,CAAC,MAAM;UACL,IAAI,CAAC/F,KAAK,CAACmE,aAAa,IAAI,IAAI,CAACnE,KAAK,CAACmE,aAAa,CAAC,WAAW,EAAE0B,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC;QAC1F;IACJ;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["includes","intersection","isNaN","isFinite","toArray","isNil","BaseComponent","BaseComponentState","DEFAULT_CLASS","Platform","countDecimalDigits","validateField","BaseNumberState","constructor","args","_defineProperty","BaseNumberComponent","props","defaultClass","defaultProps","defaultState","DECIMAL","GROUP","onChange","event","state","updateon","updateDatavalue","target","value","focus","_this$widgetRef","widgetRef","validateOnDevice","type","_value$match","isCurrencyField","isValidText","test","Number","match","length","onChangeText","shouldFormateToNumber","newValue","parseNumber","replace","isValidTextOnDevice","decimalPlacesInNumber","decimalPlaces","updateState","textValue","validate","invokeChange","e","OS","cursor","selectionStart","setState","validationObj","isValid","errorType","handleValidation","regexp","condition","RegExp","val","parts","split","NaN","number","join","decimal","sum","parseFloat","toFixed","Object","is","source","model","toString","oldValue","datavalue","validNumber","isValidNumber","invokeEventCallback","proxy","Promise","resolve","hastwowaybinding","setProp","then","onFieldChange","onBlur","isDisplayValuePresent","newVal","undefined","setTimeout","triggerValidation","oldVal","onFocus","countDecimals","decimalValue","validateInputEntry","$event","ctrlKey","key","validity","inputValue","step","preventDefault","getValueInRange","minvalue","maxvalue","required","isInteger","resetValidations","onPropertyChange","name","$new","$old","isDefault","bind","displayValue"],"sources":["basenumber.component.ts"],"sourcesContent":["import { includes, intersection, isNaN, isFinite, toArray, isNil } from 'lodash';\nimport BaseNumberProps from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.props';\nimport { BaseComponent, BaseComponentState } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport { BaseNumberStyles } from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.styles';\nimport { DEFAULT_CLASS } from \"@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles\";\nimport { Platform, TextInput } from 'react-native';\nimport { countDecimalDigits, validateField } from '@wavemaker/app-rn-runtime/core/utils';\n\nexport class BaseNumberState <T extends BaseNumberProps> extends BaseComponentState<T> {\n isValid: boolean = true;\n textValue: string = '';\n isDefault = false;\n errorType = '';\n}\n\nexport abstract class BaseNumberComponent< T extends BaseNumberProps, S extends BaseNumberState<T>, L extends BaseNumberStyles> extends BaseComponent<T, S, L> {\n private DECIMAL;\n private GROUP;\n public widgetRef: TextInput | null = null;\n private cursor: any = 0;\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n this.DECIMAL = '.';\n this.GROUP = ',';\n }\n\n onChange(event: any) {\n if (this.state.props.updateon === 'default') {\n this.updateDatavalue(event.target.value, event);\n }\n }\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n validateOnDevice(value: string, type: 'number' | 'currency') {\n const isCurrencyField = type === 'currency';\n let isValidText = true;\n\n // * no alphabets except E, may contain E only once\n if (/[a-df-zA-DF-Z]/.test(value) || !/^[^eE]*[eE]?[^eE]*$/.test(value)) {\n isValidText = false;\n }\n\n // * currency only: check for negative number\n if (isCurrencyField && (Number(value) < 0 || /-/g.test(value))) {\n isValidText = false;\n }\n\n // * number only: not more than one minus and doesn't end with minus (-)\n if (!isCurrencyField && (Number(value.match(/-/g)?.length) > 1) || /\\w-/.test(value)) {\n isValidText = false;\n }\n\n // * check for more than one decimal point\n if (/^\\d*\\.\\d*\\..*$/.test(value)) {\n isValidText = false;\n }\n\n // * check for spaces and comma\n if (/[\\s,]/.test(value)) {\n isValidText = false;\n }\n\n return isValidText;\n }\n\n onChangeText(value: string, type: 'number' | 'currency', shouldFormateToNumber?: boolean) {\n const newValue = shouldFormateToNumber ? `${this.parseNumber(value.replace(/[^0-9.]/g, ''))}` : value;\n const isValidTextOnDevice = this.validateOnDevice(newValue, type);\n if (!isValidTextOnDevice) {\n return;\n }\n\n const decimalPlacesInNumber = countDecimalDigits(newValue);\n\n if (this.props.decimalPlaces < decimalPlacesInNumber) {\n return;\n }\n\n this.updateState({\n textValue: newValue\n } as S, () => {\n if (this.state.props.updateon === 'default') {\n this.validate(newValue);\n this.updateDatavalue(newValue, null);\n }\n }\n );\n }\n\n invokeChange(e: any) {\n if (Platform.OS === 'web') {\n this.cursor = e.target.selectionStart;\n this.setState({ textValue: e.target.value });\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n\n }\n\n handleValidation(value: any) {\n const props = this.state.props;\n if (props.regexp) {\n const condition = new RegExp(props.regexp, 'g');\n return condition.test(value);\n }\n return true;\n }\n\n /**\n * Method parses the Localized number(string) to a valid number.\n * if the string dose not result to a valid number then returns NaN.\n * @param {string} val Localized number.\n * @returns {number}\n */\n private parseNumber(val: string): any {\n // splits string into two parts. decimal and number.\n const parts = val.split(this.DECIMAL);\n if (!parts.length) {\n return;\n }\n if (parts.length > 2) {\n return NaN;\n }\n // If number have decimal point and not have a decimal value then return.\n if (parts[1] === '') {\n return NaN;\n }\n // replaces all group separators form the number.\n const number = Number(parts[0].split(this.GROUP).join(''));\n const decimal = Number(`0.${parts[1] || 0}`);\n if (Number.isNaN(number) || Number.isNaN(decimal)) {\n return NaN;\n }\n const sum = parts.length > 1 ? parseFloat((number + decimal).toFixed(parts[1].length)) : number + decimal;\n // if the number is negative then calculate the number as number - decimal\n // Ex: number = -123 and decimal = 0.45 then number - decimal = -123-045 = -123.45\n // If entered number is -0.1 to -0.9 then the number is -0 and decimal is 0.1 to 0.9. Now calaculate the number as number-decimal\n // Ex: number = -0 and decimal = 0.1 then number-decimal = -0-0.1 = -0.1\n if (number === 0) {\n return Object.is(0, number) ? sum : number - decimal;\n }\n return number > 0 ? sum : number - decimal;\n }\n\n updateDatavalue(value: any, event?: any, source?: any) {\n const model = value && this.parseNumber(value.toString());\n const props = this.state.props;\n const oldValue = props.datavalue;\n if (value === oldValue) {\n return;\n }\n const validNumber = this.isValidNumber(model) || value == oldValue + '.';\n if (!validNumber) {\n this.invokeEventCallback('onError', [ event, this.proxy, value, oldValue ]);\n return;\n }\n\n new Promise((resolve) => {\n if (props.hastwowaybinding) {\n this.setProp(\"datavalue\", value);\n resolve(true);\n } else {\n this.updateState({\n props: {\n datavalue: model || Number(value)\n }\n } as S, () => resolve(true));\n }\n }).then(() => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, model, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n });\n }\n\n onBlur(event: any, isDisplayValuePresent?: boolean) {\n let newVal = isDisplayValuePresent ? this.state.textValue : event.target.value || this.state.textValue;\n this.validate(newVal);\n if (newVal === '' || newVal == undefined) {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n },10)\n }\n if (this.state.props.updateon === 'blur') {\n let oldVal = this.state.props.datavalue || '';\n if (oldVal !== newVal) {\n this.updateDatavalue(newVal, event, 'blur');\n } else {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n }\n }\n\n onFocus(event: any) {\n this.invokeEventCallback('onFocus', [ event, this.proxy]);\n }\n\n /**\n * returns the number of decimal places a number have.\n * @param value: number\n * @returns {number}\n */\n private countDecimals(value: any) {\n if (value && ((value % 1) !== 0)) {\n const decimalValue = value.toString().split('.')[1];\n return decimalValue && decimalValue.length;\n }\n return 0;\n }\n\n public validateInputEntry($event: any) {\n const props = this.state.props;\n\n // allow actions if control key is pressed or if backspace is pressed. (for Mozilla).\n if ($event.ctrlKey || includes(['Backspace', 'ArrowRight', 'ArrowLeft', 'Tab', 'Enter', 'Delete'], $event.key)) {\n return;\n }\n\n const validity = new RegExp(`^[\\\\d\\\\s-,.e+${this.GROUP}${this.DECIMAL}]$`, 'i');\n const inputValue = $event.target.value;\n // validates entering of decimal values only when user provides decimal limit(i.e step contains decimal values).\n if (inputValue && this.countDecimals(props.step) && (this.countDecimals(inputValue) >= this.countDecimals(props.step))) {\n $event.preventDefault();\n }\n // validates if user entered an invalid character.\n if (!validity.test($event.key)) {\n $event.preventDefault();\n }\n // a decimal value can be entered only once in the input.\n if (includes(inputValue, this.DECIMAL) && $event.key === this.DECIMAL) {\n $event.preventDefault();\n }\n // 'e' can be entered only once in the input.\n if (intersection(toArray(inputValue), ['e', 'E']).length && includes('eE', $event.key)) {\n $event.preventDefault();\n }\n if ((includes(inputValue, '+') || includes(inputValue, '-')) && ($event.key === '+' || $event.key === '-')) {\n $event.preventDefault();\n }\n this.invokeEventCallback('onKeypress', [ $event, this.proxy]);\n }\n\n /**\n * returns a valid number by validating the minimum and maximum values.\n * @param {number} value\n * @returns {number}\n */\n private getValueInRange(value: number): number {\n const props = this.state.props;\n if (!isNil(value) && !isNaN(props.minvalue) && value < props.minvalue) {\n this.updateState({ errorType: 'minvalue'} as S);\n return props.minvalue;\n }\n if (!isNil(value) && !isNaN(props.maxvalue) && value > props.maxvalue) {\n this.updateState({ errorType: 'maxvalue'} as S);\n return props.maxvalue;\n }\n return value;\n }\n\n /**\n * Adds validations for the number before updating the widget model. like validating min and max value for the widget.\n * @param {number} val number to be validated\n * @returns {number}\n */\n private isValidNumber(val: number): boolean {\n const props = this.state.props;\n\n //empty number widget should not show validation error when required is false\n // @ts-ignore\n if (this.state.props.required === false && val === '') {\n return true;\n }\n // id number is infinite then consider it as invalid value\n if (isNaN(val) || !isFinite(val) || (!Number.isInteger(props.step) &&\n this.countDecimals(val) > this.countDecimals(props.step))) {\n this.updateState({\n isValid: false,\n } as S);\n return false;\n }\n if (val !== this.getValueInRange(val)) {\n this.updateState({\n isValid: false,\n } as S);\n return true;\n }\n this.resetValidations();\n return true;\n }\n\n // resets all the flags related to the widget's validation.\n protected resetValidations() {\n this.updateState({\n isValid: true,\n } as S);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'minvalue':\n case 'maxvalue':\n if ($new|| $old) {\n this.isValidNumber($new);\n }\n break;\n case 'datavalue':\n this.updateState({\n textValue: $new,\n } as S);\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n break;\n case 'displayValue': \n this.updateState({\n displayValue: $new,\n } as any)\n }\n }\n}\n"],"mappings":";;;AAAA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,QAAQ,QAAQ;AAEhF,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,SAASC,aAAa,QAAQ,wEAAwE;AACtG,SAASC,QAAQ,QAAmB,cAAc;AAClD,SAASC,kBAAkB,EAAEC,aAAa,QAAQ,sCAAsC;AAExF,OAAO,MAAMC,eAAe,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C,MAAM;UACL,IAAI,CAACxG,KAAK,CAAC2E,aAAa,IAAI,IAAI,CAAC3E,KAAK,CAAC2E,aAAa,CAAC,WAAW,EAAE2B,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC;QAC1F;QACA;MACF,KAAK,cAAc;QACjB,IAAI,CAACvE,WAAW,CAAC;UACfyE,YAAY,EAAEJ;QAChB,CAAQ,CAAC;IACb;EACF;AACF","ignoreList":[]}
@@ -6,6 +6,7 @@ export default class BaseNumberProps extends BaseProps {
6
6
  constructor(...args) {
7
7
  super(...args);
8
8
  _defineProperty(this, "datavalue", void 0);
9
+ _defineProperty(this, "hastwowaybinding", false);
9
10
  _defineProperty(this, "minvalue", null);
10
11
  _defineProperty(this, "maxvalue", null);
11
12
  _defineProperty(this, "step", 1);
@@ -20,6 +21,7 @@ export default class BaseNumberProps extends BaseProps {
20
21
  _defineProperty(this, "hint", undefined);
21
22
  _defineProperty(this, "accessibilityrole", void 0);
22
23
  _defineProperty(this, "accessibilitylabelledby", undefined);
24
+ _defineProperty(this, "displayValue", void 0);
23
25
  }
24
26
  }
25
27
  //# sourceMappingURL=basenumber.props.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BaseProps","BaseNumberProps","constructor","args","_defineProperty","undefined"],"sources":["basenumber.props.ts"],"sourcesContent":["import {AccessibilityRole} from \"react-native\";\nimport { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class BaseNumberProps extends BaseProps {\n datavalue: any;\n minvalue: number = null as any;\n maxvalue: number = null as any;\n step: number = 1;\n updateon: string = 'blur' as any;\n readonly: boolean = null as any;\n regexp: string = null as any;\n onFieldChange: any;\n required: boolean = false;\n triggerValidation: any;\n decimalPlaces: number = 2;\n accessibilitylabel?: string = undefined;\n hint?: string = undefined;\n accessibilityrole?: AccessibilityRole;\n accessibilitylabelledby?: string = undefined;\n}\n"],"mappings":";;;AACA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,eAAe,SAASD,SAAS,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA;IAAAA,eAAA,mBAElC,IAAI;IAAAA,eAAA,mBACJ,IAAI;IAAAA,eAAA,eACR,CAAC;IAAAA,eAAA,mBACG,MAAM;IAAAA,eAAA,mBACL,IAAI;IAAAA,eAAA,iBACP,IAAI;IAAAA,eAAA;IAAAA,eAAA,mBAED,KAAK;IAAAA,eAAA;IAAAA,eAAA,wBAED,CAAC;IAAAA,eAAA,6BACKC,SAAS;IAAAD,eAAA,eACvBC,SAAS;IAAAD,eAAA;IAAAA,eAAA,kCAEUC,SAAS;EAAA;AAC9C","ignoreList":[]}
1
+ {"version":3,"names":["BaseProps","BaseNumberProps","constructor","args","_defineProperty","undefined"],"sources":["basenumber.props.ts"],"sourcesContent":["import {AccessibilityRole} from \"react-native\";\nimport { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class BaseNumberProps extends BaseProps {\n datavalue: any;\n hastwowaybinding = false;\n minvalue: number = null as any;\n maxvalue: number = null as any;\n step: number = 1;\n updateon: string = 'blur' as any;\n readonly: boolean = null as any;\n regexp: string = null as any;\n onFieldChange: any;\n required: boolean = false;\n triggerValidation: any;\n decimalPlaces: number = 2;\n accessibilitylabel?: string = undefined;\n hint?: string = undefined;\n accessibilityrole?: AccessibilityRole;\n accessibilitylabelledby?: string = undefined;\n displayValue?: string;\n}\n"],"mappings":";;;AACA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,eAAe,SAASD,SAAS,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA;IAAAA,eAAA,2BAElC,KAAK;IAAAA,eAAA,mBACL,IAAI;IAAAA,eAAA,mBACJ,IAAI;IAAAA,eAAA,eACR,CAAC;IAAAA,eAAA,mBACG,MAAM;IAAAA,eAAA,mBACL,IAAI;IAAAA,eAAA,iBACP,IAAI;IAAAA,eAAA;IAAAA,eAAA,mBAED,KAAK;IAAAA,eAAA;IAAAA,eAAA,wBAED,CAAC;IAAAA,eAAA,6BACKC,SAAS;IAAAD,eAAA,eACvBC,SAAS;IAAAD,eAAA;IAAAA,eAAA,kCAEUC,SAAS;IAAAD,eAAA;EAAA;AAE9C","ignoreList":[]}
@@ -53,13 +53,11 @@ export default class WmCheckbox extends BaseComponent {
53
53
  });
54
54
  }
55
55
  onPress() {
56
- if (!this.state.props.readonly) {
57
- this.invokeEventCallback('onFocus', [null, this.proxy]);
58
- }
59
- this.invokeEventCallback('onTap', [null, this.proxy]);
60
- if (this.state.props.disabled) {
56
+ if (this.state.props.disabled || this.state.props.readonly) {
61
57
  return;
62
58
  }
59
+ this.invokeEventCallback('onFocus', [null, this.proxy]);
60
+ this.invokeEventCallback('onTap', [null, this.proxy]);
63
61
  const oldValue = this.state.props.datavalue;
64
62
  const value = !this.state.isChecked;
65
63
  this.validate(value);
@@ -93,7 +91,8 @@ export default class WmCheckbox extends BaseComponent {
93
91
  }), this._background, /*#__PURE__*/React.createElement(WmIcon, {
94
92
  iconclass: "wi wi-check",
95
93
  styles: this.state.isChecked ? this.styles.checkicon : this.styles.uncheckicon,
96
- disabled: props.readonly || props.disabled
94
+ disabled: props.readonly || props.disabled,
95
+ id: this.getTestId('checkbox')
97
96
  }), /*#__PURE__*/React.createElement(Text, _extends({}, this.getTestPropsForLabel(), {
98
97
  style: this.styles.text
99
98
  }), props.caption));
@@ -1 +1 @@
1
- {"version":3,"names":["React","Text","TouchableOpacity","BaseComponent","BaseComponentState","WmIcon","unStringify","validateField","WmCheckboxProps","DEFAULT_CLASS","AccessibilityWidgetType","getAccessibilityProps","WmCheckboxState","constructor","args","_defineProperty","WmCheckbox","props","setChecked","dataValue","checkedvalue","value","updateState","isChecked","onPropertyChange","name","$new","$old","state","datavalue","updateDatavalue","validate","validationObj","isValid","errorType","onPress","readonly","invokeEventCallback","proxy","disabled","oldValue","uncheckedvalue","onFieldChange","renderWidget","createElement","_extends","getTestPropsForAction","style","styles","root","bind","CHECKBOX","hint","checked","accessibilityRole","accessibilityLabel","caption","_background","iconclass","checkicon","uncheckicon","getTestPropsForLabel","text"],"sources":["checkbox.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, TouchableOpacity } from 'react-native';\n\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport {unStringify, validateField} from '@wavemaker/app-rn-runtime/core/utils';\n\nimport WmCheckboxProps from './checkbox.props';\nimport { DEFAULT_CLASS, WmCheckboxStyles } from './checkbox.styles';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\n\nexport class WmCheckboxState extends BaseComponentState<WmCheckboxProps> {\n isChecked: boolean = false;\n isValid: boolean = true;\n errorType = '';\n}\n\nexport default class WmCheckbox extends BaseComponent<WmCheckboxProps, WmCheckboxState, WmCheckboxStyles> {\n\n constructor(props: WmCheckboxProps) {\n super(props, DEFAULT_CLASS, new WmCheckboxProps(), new WmCheckboxState());\n }\n\n setChecked(dataValue: any, checkedvalue: any) {\n const value = unStringify(dataValue) === unStringify(checkedvalue, true);\n this.updateState({ isChecked: value } as WmCheckboxState);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'checkedvalue':\n this.setChecked(this.state.props.datavalue, $new);\n break;\n case 'datavalue':\n this.setChecked($new, this.state.props.checkedvalue);\n break;\n }\n }\n\n updateDatavalue(value: any) {\n this.updateState({ props: { datavalue: value }} as WmCheckboxState);\n }\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as WmCheckboxState);\n }\n\n onPress() {\n if (!this.state.props.readonly) {\n this.invokeEventCallback('onFocus', [null, this.proxy]);\n }\n this.invokeEventCallback('onTap', [null, this.proxy]);\n if (this.state.props.disabled) {\n return;\n }\n const oldValue = this.state.props.datavalue;\n const value = !this.state.isChecked;\n this.validate(value);\n this.updateState({ isChecked: value } as WmCheckboxState);\n const dataValue = value === true ? this.state.props.checkedvalue : this.state.props.uncheckedvalue;\n this.updateState({ props: { datavalue: dataValue } } as WmCheckboxState,\n () => {\n if (!this.props.onFieldChange) {\n this.invokeEventCallback('onChange', [null, this.proxy, dataValue, oldValue]);\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', dataValue, oldValue);\n }\n this.invokeEventCallback('onBlur', [ null, this.proxy ]);\n });\n }\n\n renderWidget(props: WmCheckboxProps) {\n return (\n <TouchableOpacity {...this.getTestPropsForAction()} style={this.styles.root} onPress={this.onPress.bind(this)} {...getAccessibilityProps(AccessibilityWidgetType.CHECKBOX, {hint: props?.hint, checked: this.state.isChecked})} accessibilityRole='checkbox' accessibilityLabel={`Checkbox for ${props.caption}`}>\n {this._background}\n <WmIcon iconclass=\"wi wi-check\" styles={this.state.isChecked ? this.styles.checkicon : this.styles.uncheckicon} disabled={props.readonly || props.disabled}/>\n <Text {...this.getTestPropsForLabel()} style={this.styles.text}>{props.caption}</Text>\n </TouchableOpacity>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AAErD,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAOC,MAAM,MAAM,gEAAgE;AACnF,SAAQC,WAAW,EAAEC,aAAa,QAAO,sCAAsC;AAE/E,OAAOC,eAAe,MAAM,kBAAkB;AAC9C,SAASC,aAAa,QAA0B,mBAAmB;AACnE,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAO,MAAMC,eAAe,SAASR,kBAAkB,CAAkB;EAAAS,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBAClD,KAAK;IAAAA,eAAA,kBACP,IAAI;IAAAA,eAAA,oBACX,EAAE;EAAA;AAChB;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4C,aAAA,CAAC1C,gBAAgB,EAAA2C,QAAA,KAAK,IAAI,CAACC,qBAAqB,CAAC,CAAC;MAAEC,KAAK,EAAE,IAAI,CAACC,MAAM,CAACC,IAAK;MAACd,OAAO,EAAE,IAAI,CAACA,OAAO,CAACe,IAAI,CAAC,IAAI;IAAE,GAAKvC,qBAAqB,CAACD,uBAAuB,CAACyC,QAAQ,EAAE;MAACC,IAAI,EAAEnC,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEmC,IAAI;MAAEC,OAAO,EAAE,IAAI,CAACzB,KAAK,CAACL;IAAS,CAAC,CAAC;MAAE+B,iBAAiB,EAAC,UAAU;MAACC,kBAAkB,EAAG,gBAAetC,KAAK,CAACuC,OAAQ;IAAE,IAC5S,IAAI,CAACC,WAAW,eACjBzD,KAAA,CAAA4C,aAAA,CAACvC,MAAM;MAACqD,SAAS,EAAC,aAAa;MAACV,MAAM,EAAE,IAAI,CAACpB,KAAK,CAACL,SAAS,GAAG,IAAI,CAACyB,MAAM,CAACW,SAAS,GAAG,IAAI,CAACX,MAAM,CAACY,WAAY;MAACrB,QAAQ,EAAEtB,KAAK,CAACmB,QAAQ,IAAInB,KAAK,CAACsB;IAAS,CAAC,CAAC,eAC7JvC,KAAA,CAAA4C,aAAA,CAAC3C,IAAI,EAAA4C,QAAA,KAAK,IAAI,CAACgB,oBAAoB,CAAC,CAAC;MAAEd,KAAK,EAAE,IAAI,CAACC,MAAM,CAACc;IAAK,IAAE7C,KAAK,CAACuC,OAAc,CACvE,CAAC;EAEvB;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","Text","TouchableOpacity","BaseComponent","BaseComponentState","WmIcon","unStringify","validateField","WmCheckboxProps","DEFAULT_CLASS","AccessibilityWidgetType","getAccessibilityProps","WmCheckboxState","constructor","args","_defineProperty","WmCheckbox","props","setChecked","dataValue","checkedvalue","value","updateState","isChecked","onPropertyChange","name","$new","$old","state","datavalue","updateDatavalue","validate","validationObj","isValid","errorType","onPress","disabled","readonly","invokeEventCallback","proxy","oldValue","uncheckedvalue","onFieldChange","renderWidget","createElement","_extends","getTestPropsForAction","style","styles","root","bind","CHECKBOX","hint","checked","accessibilityRole","accessibilityLabel","caption","_background","iconclass","checkicon","uncheckicon","id","getTestId","getTestPropsForLabel","text"],"sources":["checkbox.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, TouchableOpacity } from 'react-native';\n\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport {unStringify, validateField} from '@wavemaker/app-rn-runtime/core/utils';\n\nimport WmCheckboxProps from './checkbox.props';\nimport { DEFAULT_CLASS, WmCheckboxStyles } from './checkbox.styles';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\n\nexport class WmCheckboxState extends BaseComponentState<WmCheckboxProps> {\n isChecked: boolean = false;\n isValid: boolean = true;\n errorType = '';\n}\n\nexport default class WmCheckbox extends BaseComponent<WmCheckboxProps, WmCheckboxState, WmCheckboxStyles> {\n\n constructor(props: WmCheckboxProps) {\n super(props, DEFAULT_CLASS, new WmCheckboxProps(), new WmCheckboxState());\n }\n\n setChecked(dataValue: any, checkedvalue: any) {\n const value = unStringify(dataValue) === unStringify(checkedvalue, true);\n this.updateState({ isChecked: value } as WmCheckboxState);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'checkedvalue':\n this.setChecked(this.state.props.datavalue, $new);\n break;\n case 'datavalue':\n this.setChecked($new, this.state.props.checkedvalue);\n break;\n }\n }\n\n updateDatavalue(value: any) {\n this.updateState({ props: { datavalue: value }} as WmCheckboxState);\n }\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as WmCheckboxState);\n }\n\n onPress() {\n if (this.state.props.disabled || this.state.props.readonly) {\n return;\n }\n this.invokeEventCallback('onFocus', [null, this.proxy]);\n this.invokeEventCallback('onTap', [null, this.proxy]);\n const oldValue = this.state.props.datavalue;\n const value = !this.state.isChecked;\n this.validate(value);\n this.updateState({ isChecked: value } as WmCheckboxState);\n const dataValue = value === true ? this.state.props.checkedvalue : this.state.props.uncheckedvalue;\n this.updateState({ props: { datavalue: dataValue } } as WmCheckboxState,\n () => {\n if (!this.props.onFieldChange) {\n this.invokeEventCallback('onChange', [null, this.proxy, dataValue, oldValue]);\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', dataValue, oldValue);\n }\n this.invokeEventCallback('onBlur', [ null, this.proxy ]);\n });\n }\n\n renderWidget(props: WmCheckboxProps) {\n return (\n <TouchableOpacity {...this.getTestPropsForAction()} style={this.styles.root} onPress={this.onPress.bind(this)} {...getAccessibilityProps(AccessibilityWidgetType.CHECKBOX, {hint: props?.hint, checked: this.state.isChecked})} accessibilityRole='checkbox' accessibilityLabel={`Checkbox for ${props.caption}`}>\n {this._background}\n <WmIcon iconclass=\"wi wi-check\" styles={this.state.isChecked ? this.styles.checkicon : this.styles.uncheckicon} disabled={props.readonly || props.disabled} id={this.getTestId('checkbox')}/>\n <Text {...this.getTestPropsForLabel()} style={this.styles.text}>{props.caption}</Text>\n </TouchableOpacity>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AAErD,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAOC,MAAM,MAAM,gEAAgE;AACnF,SAAQC,WAAW,EAAEC,aAAa,QAAO,sCAAsC;AAE/E,OAAOC,eAAe,MAAM,kBAAkB;AAC9C,SAASC,aAAa,QAA0B,mBAAmB;AACnE,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAO,MAAMC,eAAe,SAASR,kBAAkB,CAAkB;EAAAS,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAA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EAEAI,YAAYA,CAAC1B,KAAsB,EAAE;IACnC,oBACEjB,KAAA,CAAA4C,aAAA,CAAC1C,gBAAgB,EAAA2C,QAAA,KAAK,IAAI,CAACC,qBAAqB,CAAC,CAAC;MAAEC,KAAK,EAAE,IAAI,CAACC,MAAM,CAACC,IAAK;MAACd,OAAO,EAAE,IAAI,CAACA,OAAO,CAACe,IAAI,CAAC,IAAI;IAAE,GAAKvC,qBAAqB,CAACD,uBAAuB,CAACyC,QAAQ,EAAE;MAACC,IAAI,EAAEnC,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEmC,IAAI;MAAEC,OAAO,EAAE,IAAI,CAACzB,KAAK,CAACL;IAAS,CAAC,CAAC;MAAE+B,iBAAiB,EAAC,UAAU;MAACC,kBAAkB,EAAE,gBAAgBtC,KAAK,CAACuC,OAAO;IAAG,IAC5S,IAAI,CAACC,WAAW,eACjBzD,KAAA,CAAA4C,aAAA,CAACvC,MAAM;MAACqD,SAAS,EAAC,aAAa;MAACV,MAAM,EAAE,IAAI,CAACpB,KAAK,CAACL,SAAS,GAAG,IAAI,CAACyB,MAAM,CAACW,SAAS,GAAG,IAAI,CAACX,MAAM,CAACY,WAAY;MAACxB,QAAQ,EAAEnB,KAAK,CAACoB,QAAQ,IAAIpB,KAAK,CAACmB,QAAS;MAACyB,EAAE,EAAE,IAAI,CAACC,SAAS,CAAC,UAAU;IAAE,CAAC,CAAC,eAC7L9D,KAAA,CAAA4C,aAAA,CAAC3C,IAAI,EAAA4C,QAAA,KAAK,IAAI,CAACkB,oBAAoB,CAAC,CAAC;MAAEhB,KAAK,EAAE,IAAI,CAACC,MAAM,CAACgB;IAAK,IAAE/C,KAAK,CAACuC,OAAc,CACvE,CAAC;EAEvB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","flexDirection","alignContent","text","alignSelf","fontFamily","baseFont","fontSize","color","labelDefaultColor","marginLeft","skeleton","width","height","checkicon","borderRadius","backgroundColor","primaryColor","justifyContent","alignItems","borderColor","checkedBorderColor","icon","checkedIconColor","padding","uncheckicon","borderWidth","uncheckedBorderColor","uncheckedBgColor","opacity","checkedDisabledColor"],"sources":["checkbox.styles.ts"],"sourcesContent":["import BASE_THEME, { AllStyle } from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { WmSkeletonStyles } from '../../basic/skeleton/skeleton.styles';\nimport { WmIconStyles } from '../../basic/icon/icon.styles';\n\nexport type WmCheckboxStyles = BaseStyles & {\n skeleton: WmSkeletonStyles;\n checkicon: WmIconStyles;\n uncheckicon: WmIconStyles;\n};\n\nexport const DEFAULT_CLASS = 'app-checkbox';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: WmCheckboxStyles = defineStyles({\n root: {\n flexDirection: 'row',\n alignContent: 'center',\n },\n text: {\n alignSelf: 'center',\n fontFamily: themeVariables.baseFont,\n fontSize: 16,\n color: themeVariables.labelDefaultColor,\n marginLeft: 8\n },\n skeleton: {\n root: {\n width: '100%',\n height: 16\n }\n } as any as WmSkeletonStyles,\n checkicon : {\n root: {\n width: 20,\n height: 20,\n borderRadius: 4,\n backgroundColor: themeVariables.primaryColor,\n justifyContent: 'center',\n alignItems: 'center',\n borderColor: themeVariables.checkedBorderColor,\n },\n text: {\n fontSize: 18,\n },\n icon : {\n color: themeVariables.checkedIconColor,\n padding: 0\n }\n } as WmIconStyles,\n uncheckicon : {\n root: {\n width: 20,\n height: 20,\n borderWidth: 2,\n borderRadius: 4,\n borderColor: themeVariables.uncheckedBorderColor,\n backgroundColor: themeVariables.uncheckedBgColor,\n },\n text: {},\n icon : {\n color: 'transparent',\n }\n } as WmIconStyles,\n });\n\n\n addStyle(DEFAULT_CLASS + '-disabled', '', {\n root : {\n opacity: 0.8\n },\n text : {\n color: themeVariables.checkedDisabledColor\n }\n });\n\n addSt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C;MACDzB,IAAI,EAAE,CAAC,CAAC;MACRmB,IAAI,EAAG;QACLd,KAAK,EAAE;MACT;IACJ;EACA,CAAC,CAAC;EAGJV,QAAQ,CAACH,aAAa,GAAG,WAAW,EAAE,EAAE,EAAE;IACxCK,IAAI,EAAG;MACL6B,OAAO,EAAE;IACX,CAAC;IACD1B,IAAI,EAAG;MACLK,KAAK,EAAEX,cAAc,CAACiC;IACxB;EACF,CAAC,CAAC;EAEFhC,QAAQ,CAACH,aAAa,EAAE,EAAE,EAAEI,aAAa,CAAC;AAC5C,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","flexDirection","alignContent","text","alignSelf","fontFamily","baseFont","fontSize","color","labelDefaultColor","marginLeft","skeleton","width","height","checkicon","borderRadius","backgroundColor","primaryColor","justifyContent","alignItems","borderColor","checkedBorderColor","icon","checkedIconColor","padding","uncheckicon","borderWidth","uncheckedBorderColor","uncheckedBgColor","opacity","checkedDisabledColor"],"sources":["checkbox.styles.ts"],"sourcesContent":["import BASE_THEME, { AllStyle } from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { WmSkeletonStyles } from '@wavemaker/app-rn-runtime/components/basic/skeleton/skeleton.styles';\nimport { WmIconStyles } from '@wavemaker/app-rn-runtime/components/basic/icon/icon.styles';\n\nexport type WmCheckboxStyles = BaseStyles & {\n skeleton: WmSkeletonStyles;\n checkicon: WmIconStyles;\n uncheckicon: WmIconStyles;\n};\n\nexport const DEFAULT_CLASS = 'app-checkbox';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: WmCheckboxStyles = defineStyles({\n root: {\n flexDirection: 'row',\n alignContent: 'center',\n },\n text: {\n alignSelf: 'center',\n fontFamily: themeVariables.baseFont,\n fontSize: 16,\n color: themeVariables.labelDefaultColor,\n marginLeft: 8\n },\n skeleton: {\n root: {\n width: '100%',\n height: 16\n }\n } as any as WmSkeletonStyles,\n checkicon : {\n root: {\n width: 20,\n height: 20,\n borderRadius: 4,\n backgroundColor: themeVariables.primaryColor,\n justifyContent: 'center',\n alignItems: 'center',\n borderColor: themeVariables.checkedBorderColor,\n },\n text: {\n fontSize: 18,\n },\n icon : {\n color: themeVariables.checkedIconColor,\n padding: 0\n }\n } as WmIconStyles,\n uncheckicon : {\n root: {\n width: 20,\n height: 20,\n borderWidth: 2,\n borderRadius: 4,\n borderColor: themeVariables.uncheckedBorderColor,\n backgroundColor: themeVariables.uncheckedBgColor,\n },\n text: {},\n icon : {\n color: 'transparent',\n }\n } as WmIconStyles,\n });\n\n\n addStyle(DEFAULT_CLASS + '-disabled', '', {\n root : {\n opacity: 0.8\n },\n text : {\n color: themeVariables.checkedDisabledColor\n }\n });\n\n addStyle(DEFAULT_CLASS, '', defaultStyles);\n });\n"],"mappings":"AAAA,OAAOA,UAAU,MAAoB,wCAAwC;AAC7E,SAAqBC,YAAY,QAAQ,+CAA+C;AAUxF,OAAO,MAAMC,aAAa,GAAG,cAAc;AAC3CF,UAAU,CAACG,aAAa,CAAC,CAACC,cAAc,EAAEC,QAAQ,KAAK;EACnD,MAAMC,aAA+B,GAAGL,YAAY,CAAC;IACjDM,IAAI,EAAE;MACJC,aAAa,EAAE,KAAK;MACpBC,YAAY,EAAE;IAChB,CAAC;IACDC,IAAI,EAAE;MACJC,SAAS,EAAE,QAAQ;MACnBC,UAAU,EAAER,cAAc,CAACS,QAAQ;MACnCC,QAAQ,EAAE,EAAE;MACZC,KAAK,EAAEX,cAAc,CAACY,iBAAiB;MACvCC,UAAU,EAAE;IACd,CAAC;IACDC,QAAQ,EAAE;MACRX,IAAI,EAAE;QACJY,KAAK,EAAE,MAAM;QACbC,MAAM,EAAE;MACV;IACF,CAA4B;IAC5BC,SAAS,EAAG;MACVd,IAAI,EAAE;QACJY,KAAK,EAAE,EAAE;QACTC,MAAM,EAAE,EAAE;QACVE,YAAY,EAAE,CAAC;QACfC,eAAe,EAAEnB,cAAc,CAACoB,YAAY;QAC5CC,cAAc,EAAE,QAAQ;QACxBC,UAAU,EAAE,QAAQ;QACpBC,WAAW,EAAEvB,cAAc,CAACwB;MAC9B,CAAC;MACDlB,IAAI,EAAE;QACJI,QAAQ,EAAE;MACZ,CAAC;MACDe,IAAI,EAAG;QACLd,KAAK,EAAEX,cAAc,CAAC0B,gBAAgB;QACtCC,OAAO,EAAE;MACX;IACJ,CAAiB;IACfC,WAAW,EAAG;MACZzB,IAAI,EAAE;QACJY,KAAK,EAAE,EAAE;QACTC,MAAM,EAAE,EAAE;QACVa,WAAW,EAAE,CAAC;QACdX,YAAY,EAAE,CAAC;QACfK,WAAW,EAAEvB,cAAc,CAAC8B,oBAAoB;QAChDX,eAAe,EAAEnB,cAAc,CAAC+B;MAClC,CAAC;MACDzB,IAAI,EAAE,CAAC,CAAC;MACRmB,IAAI,EAAG;QACLd,KAAK,EAAE;MACT;IACJ;EACA,CAAC,CAAC;EAGJV,QAAQ,CAACH,aAAa,GAAG,WAAW,EAAE,EAAE,EAAE;IACxCK,IAAI,EAAG;MACL6B,OAAO,EAAE;IACX,CAAC;IACD1B,IAAI,EAAG;MACLK,KAAK,EAAEX,cAAc,CAACiC;IACxB;EACF,CAAC,CAAC;EAEFhC,QAAQ,CAACH,aAAa,EAAE,EAAE,EAAEI,aAAa,CAAC;AAC5C,CAAC,CAAC","ignoreList":[]}
@@ -11,6 +11,8 @@ import { DEFAULT_CLASS } from './checkboxset.styles';
11
11
  import { BaseDatasetComponent, BaseDatasetState } from '@wavemaker/app-rn-runtime/components/input/basedataset/basedataset.component';
12
12
  import WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';
13
13
  import { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';
14
+ import { getNumberOfEmptyObjects } from '@wavemaker/app-rn-runtime/core/utils';
15
+ import WmLabel from '@wavemaker/app-rn-runtime/components/basic/label/label.component';
14
16
  export class WmCheckboxsetState extends BaseDatasetState {
15
17
  constructor(...args) {
16
18
  super(...args);
@@ -23,10 +25,10 @@ export default class WmCheckboxset extends BaseDatasetComponent {
23
25
  super(props, DEFAULT_CLASS, new WmCheckboxsetProps());
24
26
  }
25
27
  onPress(item) {
26
- this.invokeEventCallback('onTap', [null, this.proxy]);
27
28
  if (this.state.props.disabled || this.state.props.readonly) {
28
29
  return;
29
30
  }
31
+ this.invokeEventCallback('onTap', [null, this.proxy]);
30
32
  item.selected = !item.selected;
31
33
  const selectedValue = [];
32
34
  const selectedItem = find(this.state.dataItems, d => isEqual(d.key, item.key));
@@ -65,9 +67,10 @@ export default class WmCheckboxset extends BaseDatasetComponent {
65
67
  }), /*#__PURE__*/React.createElement(WmIcon, {
66
68
  iconclass: "wi wi-check",
67
69
  styles: item.selected ? this.styles.checkicon : this.styles.uncheckicon,
68
- disabled: props.readonly || props.disabled
70
+ disabled: props.readonly || props.disabled,
71
+ id: this.getTestId('item' + index)
69
72
  }), !isEmpty(this.state.template) && this.props.renderitempartial ? this.props.renderitempartial(item.dataObject, index, this.state.template) : /*#__PURE__*/React.createElement(Text, _extends({}, this.getTestPropsForLabel(index + ''), {
70
- style: this.styles.text
73
+ style: [this.styles.text, item.selected ? this.styles.selectedLabel : null]
71
74
  }), displayText));
72
75
  }
73
76
  computeDisplayValue() {
@@ -111,6 +114,24 @@ export default class WmCheckboxset extends BaseDatasetComponent {
111
114
  }
112
115
  }, items && items.length ? items.map((item, index) => this.renderChild(item, index, colWidth)) : null);
113
116
  }
117
+ renderSkeleton(props) {
118
+ var _ref;
119
+ const noOfColumns = props.itemsperrow.xs || 1;
120
+ const colWidth = Math.round(100 / noOfColumns) + '%';
121
+ return [...getNumberOfEmptyObjects((_ref = props.numberofskeletonitems) !== null && _ref !== void 0 ? _ref : 3)].map(_ => {
122
+ return /*#__PURE__*/React.createElement(View, {
123
+ style: [this.styles.item, {
124
+ width: colWidth
125
+ }]
126
+ }, /*#__PURE__*/React.createElement(WmIcon, {
127
+ styles: this.styles.checkicon
128
+ }), /*#__PURE__*/React.createElement(WmLabel, {
129
+ styles: {
130
+ root: this.styles.text
131
+ }
132
+ }));
133
+ });
134
+ }
114
135
  renderWidget(props) {
115
136
  const items = this.state.dataItems;
116
137
  return /*#__PURE__*/React.createElement(ScrollView, {