@bravura/ui 1.21.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -0
  3. package/alert/alert-container.component.d.ts +1 -1
  4. package/alert/alert-message.component.d.ts +1 -1
  5. package/alert/{bravura-ui-alert.d.ts → index.d.ts} +0 -0
  6. package/behavior/await.directive.d.ts +1 -1
  7. package/behavior/{bravura-ui-behavior.d.ts → index.d.ts} +0 -0
  8. package/behavior/sizing-monitor.directive.d.ts +1 -1
  9. package/behavior/sizing.directive.d.ts +1 -1
  10. package/common/{bravura-ui-common.d.ts → index.d.ts} +0 -0
  11. package/currency-input/currency-input.directive.d.ts +1 -1
  12. package/currency-input/{bravura-ui-currency-input.d.ts → index.d.ts} +0 -0
  13. package/decimal-input/decimal-input.directive.d.ts +1 -1
  14. package/decimal-input/{bravura-ui-decimal-input.d.ts → index.d.ts} +0 -0
  15. package/discrete-input/discrete-input.component.d.ts +6 -5
  16. package/discrete-input/{bravura-ui-discrete-input.d.ts → index.d.ts} +0 -0
  17. package/esm2020/alert/alert-container.component.mjs +201 -0
  18. package/esm2020/alert/alert-message.component.mjs +92 -0
  19. package/esm2020/alert/alert.module.mjs +22 -0
  20. package/{esm2015/alert/bravura-ui-alert.js → esm2020/alert/bravura-ui-alert.mjs} +0 -0
  21. package/{esm2015/alert/public-api.js → esm2020/alert/public-api.mjs} +0 -0
  22. package/{esm2015/behavior/await.directive.js → esm2020/behavior/await.directive.mjs} +4 -4
  23. package/esm2020/behavior/behavior.module.mjs +25 -0
  24. package/{esm2015/behavior/bravura-ui-behavior.js → esm2020/behavior/bravura-ui-behavior.mjs} +0 -0
  25. package/{esm2015/behavior/public-api.js → esm2020/behavior/public-api.mjs} +0 -0
  26. package/{esm2015/behavior/sizing-monitor.directive.js → esm2020/behavior/sizing-monitor.directive.mjs} +4 -4
  27. package/{esm2015/behavior/sizing.directive.js → esm2020/behavior/sizing.directive.mjs} +4 -4
  28. package/{esm2015/bravura-ui.js → esm2020/bravura-ui.mjs} +0 -0
  29. package/{esm2015/common/bravura-ui-common.js → esm2020/common/bravura-ui-common.mjs} +0 -0
  30. package/{esm2015/common/common-utils.js → esm2020/common/common-utils.mjs} +0 -0
  31. package/esm2020/common/common.module.mjs +52 -0
  32. package/{esm2015/common/public-api.js → esm2020/common/public-api.mjs} +0 -0
  33. package/{esm2015/currency-input/bravura-ui-currency-input.js → esm2020/currency-input/bravura-ui-currency-input.mjs} +0 -0
  34. package/esm2020/currency-input/currency-input.directive.mjs +279 -0
  35. package/esm2020/currency-input/currency-input.module.mjs +19 -0
  36. package/{esm2015/currency-input/public-api.js → esm2020/currency-input/public-api.mjs} +0 -0
  37. package/{esm2015/decimal-input/bravura-ui-decimal-input.js → esm2020/decimal-input/bravura-ui-decimal-input.mjs} +0 -0
  38. package/{esm2015/decimal-input/decimal-input.directive.js → esm2020/decimal-input/decimal-input.directive.mjs} +4 -4
  39. package/esm2020/decimal-input/decimal-input.module.mjs +19 -0
  40. package/{esm2015/decimal-input/public-api.js → esm2020/decimal-input/public-api.mjs} +0 -0
  41. package/{esm2015/discrete-input/bravura-ui-discrete-input.js → esm2020/discrete-input/bravura-ui-discrete-input.mjs} +0 -0
  42. package/esm2020/discrete-input/discrete-input.component.mjs +326 -0
  43. package/esm2020/discrete-input/discrete-input.module.mjs +21 -0
  44. package/{esm2015/discrete-input/public-api.js → esm2020/discrete-input/public-api.mjs} +0 -0
  45. package/{esm2015/file-upload/bravura-ui-file-upload.js → esm2020/file-upload/bravura-ui-file-upload.mjs} +0 -0
  46. package/esm2020/file-upload/file-upload.component.mjs +356 -0
  47. package/{esm2015/file-upload/file-upload.module.js → esm2020/file-upload/file-upload.module.mjs} +11 -13
  48. package/{esm2015/file-upload/file-upload.service.js → esm2020/file-upload/file-upload.service.mjs} +4 -4
  49. package/{esm2015/file-upload/public-api.js → esm2020/file-upload/public-api.mjs} +0 -0
  50. package/{esm2015/form-field/bravura-ui-form-field.js → esm2020/form-field/bravura-ui-form-field.mjs} +0 -0
  51. package/esm2020/form-field/form-field.component.mjs +96 -0
  52. package/esm2020/form-field/form-field.module.mjs +20 -0
  53. package/{esm2015/form-field/public-api.js → esm2020/form-field/public-api.mjs} +0 -0
  54. package/{esm2015/icon-font/bravura-ui-icon-font.js → esm2020/icon-font/bravura-ui-icon-font.mjs} +0 -0
  55. package/esm2020/icon-font/icon-font.module.mjs +22 -0
  56. package/{esm2015/icon-font/icon.directive.js → esm2020/icon-font/icon.directive.mjs} +4 -4
  57. package/{esm2015/icon-font/public-api.js → esm2020/icon-font/public-api.mjs} +0 -0
  58. package/{esm2015/icon-font/utilities.js → esm2020/icon-font/utilities.mjs} +0 -0
  59. package/{esm2015/phone-number/bravura-ui-phone-number.js → esm2020/phone-number/bravura-ui-phone-number.mjs} +0 -0
  60. package/esm2020/phone-number/phone-number.directive.mjs +187 -0
  61. package/esm2020/phone-number/phone-number.module.mjs +24 -0
  62. package/{esm2015/phone-number/phone-number.pipe.js → esm2020/phone-number/phone-number.pipe.mjs} +4 -4
  63. package/{esm2015/phone-number/phone-number.validator.js → esm2020/phone-number/phone-number.validator.mjs} +4 -4
  64. package/{esm2015/phone-number/public-api.js → esm2020/phone-number/public-api.mjs} +0 -0
  65. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  66. package/{esm2015/radio-panel/bravura-ui-radio-panel.js → esm2020/radio-panel/bravura-ui-radio-panel.mjs} +0 -0
  67. package/{esm2015/radio-panel/public-api.js → esm2020/radio-panel/public-api.mjs} +0 -0
  68. package/esm2020/radio-panel/radio-panel-item.component.mjs +97 -0
  69. package/esm2020/radio-panel/radio-panel.component.mjs +89 -0
  70. package/esm2020/radio-panel/radio-panel.module.mjs +25 -0
  71. package/{esm2015/selection-panel/bravura-ui-selection-panel.js → esm2020/selection-panel/bravura-ui-selection-panel.mjs} +0 -0
  72. package/{esm2015/selection-panel/public-api.js → esm2020/selection-panel/public-api.mjs} +0 -0
  73. package/esm2020/selection-panel/selection-panel-item.component.mjs +166 -0
  74. package/esm2020/selection-panel/selection-panel.directive.mjs +119 -0
  75. package/esm2020/selection-panel/selection-panel.module.mjs +23 -0
  76. package/{esm2015/skeletons/bravura-ui-skeletons.js → esm2020/skeletons/bravura-ui-skeletons.mjs} +0 -0
  77. package/{esm2015/skeletons/public-api.js → esm2020/skeletons/public-api.mjs} +0 -0
  78. package/esm2020/skeletons/skeleton-loader-presets.directive.mjs +83 -0
  79. package/{esm2015/skeletons/skeleton-loader.component.js → esm2020/skeletons/skeleton-loader.component.mjs} +4 -4
  80. package/esm2020/skeletons/skeletons.module.mjs +35 -0
  81. package/{esm2015/stepper/bravura-ui-stepper.js → esm2020/stepper/bravura-ui-stepper.mjs} +0 -0
  82. package/{esm2015/stepper/public-api.js → esm2020/stepper/public-api.mjs} +0 -0
  83. package/esm2020/stepper/stepper-animation.mjs +23 -0
  84. package/esm2020/stepper/stepper.component.mjs +166 -0
  85. package/{esm2015/stepper/stepper.module.js → esm2020/stepper/stepper.module.mjs} +13 -15
  86. package/{esm2015/tooltip/bravura-ui-tooltip.js → esm2020/tooltip/bravura-ui-tooltip.mjs} +0 -0
  87. package/{esm2015/tooltip/public-api.js → esm2020/tooltip/public-api.mjs} +0 -0
  88. package/esm2020/tooltip/tooltip.component.mjs +51 -0
  89. package/{esm2015/tooltip/tooltip.directive.js → esm2020/tooltip/tooltip.directive.mjs} +4 -4
  90. package/esm2020/tooltip/tooltip.module.mjs +25 -0
  91. package/fesm2015/bravura-ui-alert.mjs +324 -0
  92. package/fesm2015/bravura-ui-alert.mjs.map +1 -0
  93. package/fesm2015/bravura-ui-behavior.mjs +407 -0
  94. package/fesm2015/bravura-ui-behavior.mjs.map +1 -0
  95. package/fesm2015/bravura-ui-common.mjs +74 -0
  96. package/fesm2015/bravura-ui-common.mjs.map +1 -0
  97. package/fesm2015/bravura-ui-currency-input.mjs +303 -0
  98. package/fesm2015/bravura-ui-currency-input.mjs.map +1 -0
  99. package/fesm2015/bravura-ui-decimal-input.mjs +147 -0
  100. package/fesm2015/bravura-ui-decimal-input.mjs.map +1 -0
  101. package/fesm2015/bravura-ui-discrete-input.mjs +354 -0
  102. package/fesm2015/bravura-ui-discrete-input.mjs.map +1 -0
  103. package/fesm2015/bravura-ui-file-upload.mjs +434 -0
  104. package/fesm2015/bravura-ui-file-upload.mjs.map +1 -0
  105. package/fesm2015/{bravura-ui-form-field.js → bravura-ui-form-field.mjs} +12 -23
  106. package/fesm2015/bravura-ui-form-field.mjs.map +1 -0
  107. package/fesm2015/{bravura-ui-icon-font.js → bravura-ui-icon-font.mjs} +8 -8
  108. package/fesm2015/bravura-ui-icon-font.mjs.map +1 -0
  109. package/fesm2015/{bravura-ui-phone-number.js → bravura-ui-phone-number.mjs} +34 -30
  110. package/fesm2015/bravura-ui-phone-number.mjs.map +1 -0
  111. package/fesm2015/bravura-ui-radio-panel.mjs +212 -0
  112. package/fesm2015/bravura-ui-radio-panel.mjs.map +1 -0
  113. package/fesm2015/{bravura-ui-selection-panel.js → bravura-ui-selection-panel.mjs} +24 -28
  114. package/fesm2015/bravura-ui-selection-panel.mjs.map +1 -0
  115. package/fesm2015/bravura-ui-skeletons.mjs +195 -0
  116. package/fesm2015/bravura-ui-skeletons.mjs.map +1 -0
  117. package/fesm2015/bravura-ui-stepper.mjs +243 -0
  118. package/fesm2015/bravura-ui-stepper.mjs.map +1 -0
  119. package/fesm2015/bravura-ui-tooltip.mjs +195 -0
  120. package/fesm2015/bravura-ui-tooltip.mjs.map +1 -0
  121. package/fesm2015/{bravura-ui.js → bravura-ui.mjs} +1 -1
  122. package/fesm2015/bravura-ui.mjs.map +1 -0
  123. package/fesm2020/bravura-ui-alert.mjs +312 -0
  124. package/fesm2020/bravura-ui-alert.mjs.map +1 -0
  125. package/{fesm2015/bravura-ui-behavior.js → fesm2020/bravura-ui-behavior.mjs} +14 -14
  126. package/fesm2020/bravura-ui-behavior.mjs.map +1 -0
  127. package/{fesm2015/bravura-ui-common.js → fesm2020/bravura-ui-common.mjs} +7 -7
  128. package/fesm2020/bravura-ui-common.mjs.map +1 -0
  129. package/{fesm2015/bravura-ui-currency-input.js → fesm2020/bravura-ui-currency-input.mjs} +9 -10
  130. package/fesm2020/bravura-ui-currency-input.mjs.map +1 -0
  131. package/{fesm2015/bravura-ui-decimal-input.js → fesm2020/bravura-ui-decimal-input.mjs} +8 -8
  132. package/fesm2020/bravura-ui-decimal-input.mjs.map +1 -0
  133. package/{fesm2015/bravura-ui-discrete-input.js → fesm2020/bravura-ui-discrete-input.mjs} +18 -26
  134. package/fesm2020/bravura-ui-discrete-input.mjs.map +1 -0
  135. package/fesm2020/bravura-ui-file-upload.mjs +430 -0
  136. package/fesm2020/bravura-ui-file-upload.mjs.map +1 -0
  137. package/fesm2020/bravura-ui-form-field.mjs +119 -0
  138. package/fesm2020/bravura-ui-form-field.mjs.map +1 -0
  139. package/fesm2020/bravura-ui-icon-font.mjs +178 -0
  140. package/fesm2020/bravura-ui-icon-font.mjs.map +1 -0
  141. package/fesm2020/bravura-ui-phone-number.mjs +317 -0
  142. package/fesm2020/bravura-ui-phone-number.mjs.map +1 -0
  143. package/fesm2020/bravura-ui-radio-panel.mjs +209 -0
  144. package/fesm2020/bravura-ui-radio-panel.mjs.map +1 -0
  145. package/fesm2020/bravura-ui-selection-panel.mjs +306 -0
  146. package/fesm2020/bravura-ui-selection-panel.mjs.map +1 -0
  147. package/{fesm2015/bravura-ui-skeletons.js → fesm2020/bravura-ui-skeletons.mjs} +13 -13
  148. package/fesm2020/bravura-ui-skeletons.mjs.map +1 -0
  149. package/{fesm2015/bravura-ui-stepper.js → fesm2020/bravura-ui-stepper.mjs} +27 -44
  150. package/fesm2020/bravura-ui-stepper.mjs.map +1 -0
  151. package/{fesm2015/bravura-ui-tooltip.js → fesm2020/bravura-ui-tooltip.mjs} +13 -22
  152. package/fesm2020/bravura-ui-tooltip.mjs.map +1 -0
  153. package/fesm2020/bravura-ui.mjs +8 -0
  154. package/fesm2020/bravura-ui.mjs.map +1 -0
  155. package/file-upload/file-upload.component.d.ts +1 -1
  156. package/file-upload/{bravura-ui-file-upload.d.ts → index.d.ts} +0 -0
  157. package/form-field/form-field.component.d.ts +1 -1
  158. package/form-field/{bravura-ui-form-field.d.ts → index.d.ts} +0 -0
  159. package/icon-font/icon.directive.d.ts +1 -1
  160. package/icon-font/{bravura-ui-icon-font.d.ts → index.d.ts} +0 -0
  161. package/{bravura-ui.d.ts → index.d.ts} +0 -0
  162. package/package.json +149 -14
  163. package/phone-number/{bravura-ui-phone-number.d.ts → index.d.ts} +0 -0
  164. package/phone-number/phone-number.directive.d.ts +1 -1
  165. package/phone-number/phone-number.pipe.d.ts +1 -1
  166. package/phone-number/phone-number.validator.d.ts +1 -1
  167. package/radio-panel/{bravura-ui-radio-panel.d.ts → index.d.ts} +0 -0
  168. package/radio-panel/radio-panel-item.component.d.ts +1 -1
  169. package/radio-panel/radio-panel.component.d.ts +1 -1
  170. package/selection-panel/{bravura-ui-selection-panel.d.ts → index.d.ts} +0 -0
  171. package/selection-panel/selection-panel-item.component.d.ts +1 -1
  172. package/selection-panel/selection-panel.directive.d.ts +1 -1
  173. package/skeletons/{bravura-ui-skeletons.d.ts → index.d.ts} +0 -0
  174. package/skeletons/skeleton-loader-presets.directive.d.ts +1 -1
  175. package/skeletons/skeleton-loader.component.d.ts +1 -1
  176. package/stepper/{bravura-ui-stepper.d.ts → index.d.ts} +0 -0
  177. package/stepper/stepper.component.d.ts +1 -1
  178. package/theme/_ui-theme.scss +1 -1
  179. package/tooltip/{bravura-ui-tooltip.d.ts → index.d.ts} +0 -0
  180. package/tooltip/tooltip.component.d.ts +1 -1
  181. package/tooltip/tooltip.directive.d.ts +1 -1
  182. package/alert/package.json +0 -10
  183. package/behavior/package.json +0 -10
  184. package/bundles/bravura-ui-alert.umd.js +0 -745
  185. package/bundles/bravura-ui-alert.umd.js.map +0 -1
  186. package/bundles/bravura-ui-behavior.umd.js +0 -788
  187. package/bundles/bravura-ui-behavior.umd.js.map +0 -1
  188. package/bundles/bravura-ui-common.umd.js +0 -103
  189. package/bundles/bravura-ui-common.umd.js.map +0 -1
  190. package/bundles/bravura-ui-currency-input.umd.js +0 -335
  191. package/bundles/bravura-ui-currency-input.umd.js.map +0 -1
  192. package/bundles/bravura-ui-decimal-input.umd.js +0 -176
  193. package/bundles/bravura-ui-decimal-input.umd.js.map +0 -1
  194. package/bundles/bravura-ui-discrete-input.umd.js +0 -747
  195. package/bundles/bravura-ui-discrete-input.umd.js.map +0 -1
  196. package/bundles/bravura-ui-file-upload.umd.js +0 -845
  197. package/bundles/bravura-ui-file-upload.umd.js.map +0 -1
  198. package/bundles/bravura-ui-form-field.umd.js +0 -494
  199. package/bundles/bravura-ui-form-field.umd.js.map +0 -1
  200. package/bundles/bravura-ui-icon-font.umd.js +0 -539
  201. package/bundles/bravura-ui-icon-font.umd.js.map +0 -1
  202. package/bundles/bravura-ui-phone-number.umd.js +0 -690
  203. package/bundles/bravura-ui-phone-number.umd.js.map +0 -1
  204. package/bundles/bravura-ui-radio-panel.umd.js +0 -595
  205. package/bundles/bravura-ui-radio-panel.umd.js.map +0 -1
  206. package/bundles/bravura-ui-selection-panel.umd.js +0 -699
  207. package/bundles/bravura-ui-selection-panel.umd.js.map +0 -1
  208. package/bundles/bravura-ui-skeletons.umd.js +0 -525
  209. package/bundles/bravura-ui-skeletons.umd.js.map +0 -1
  210. package/bundles/bravura-ui-stepper.umd.js +0 -613
  211. package/bundles/bravura-ui-stepper.umd.js.map +0 -1
  212. package/bundles/bravura-ui-tooltip.umd.js +0 -586
  213. package/bundles/bravura-ui-tooltip.umd.js.map +0 -1
  214. package/bundles/bravura-ui.umd.js +0 -18
  215. package/bundles/bravura-ui.umd.js.map +0 -1
  216. package/common/package.json +0 -10
  217. package/currency-input/package.json +0 -10
  218. package/decimal-input/package.json +0 -10
  219. package/discrete-input/package.json +0 -10
  220. package/esm2015/alert/alert-container.component.js +0 -220
  221. package/esm2015/alert/alert-message.component.js +0 -98
  222. package/esm2015/alert/alert.module.js +0 -22
  223. package/esm2015/behavior/behavior.module.js +0 -25
  224. package/esm2015/common/common.module.js +0 -52
  225. package/esm2015/currency-input/currency-input.directive.js +0 -280
  226. package/esm2015/currency-input/currency-input.module.js +0 -19
  227. package/esm2015/decimal-input/decimal-input.module.js +0 -19
  228. package/esm2015/discrete-input/discrete-input.component.js +0 -334
  229. package/esm2015/discrete-input/discrete-input.module.js +0 -21
  230. package/esm2015/file-upload/file-upload.component.js +0 -367
  231. package/esm2015/form-field/form-field.component.js +0 -107
  232. package/esm2015/form-field/form-field.module.js +0 -20
  233. package/esm2015/icon-font/icon-font.module.js +0 -22
  234. package/esm2015/phone-number/phone-number.directive.js +0 -192
  235. package/esm2015/phone-number/phone-number.module.js +0 -24
  236. package/esm2015/radio-panel/radio-panel-item.component.js +0 -109
  237. package/esm2015/radio-panel/radio-panel.component.js +0 -98
  238. package/esm2015/radio-panel/radio-panel.module.js +0 -25
  239. package/esm2015/selection-panel/selection-panel-item.component.js +0 -174
  240. package/esm2015/selection-panel/selection-panel.directive.js +0 -120
  241. package/esm2015/selection-panel/selection-panel.module.js +0 -23
  242. package/esm2015/skeletons/skeleton-loader-presets.directive.js +0 -83
  243. package/esm2015/skeletons/skeletons.module.js +0 -35
  244. package/esm2015/stepper/stepper-animation.js +0 -23
  245. package/esm2015/stepper/stepper.component.js +0 -181
  246. package/esm2015/tooltip/tooltip.component.js +0 -59
  247. package/esm2015/tooltip/tooltip.module.js +0 -26
  248. package/fesm2015/bravura-ui-alert.js +0 -337
  249. package/fesm2015/bravura-ui-alert.js.map +0 -1
  250. package/fesm2015/bravura-ui-behavior.js.map +0 -1
  251. package/fesm2015/bravura-ui-common.js.map +0 -1
  252. package/fesm2015/bravura-ui-currency-input.js.map +0 -1
  253. package/fesm2015/bravura-ui-decimal-input.js.map +0 -1
  254. package/fesm2015/bravura-ui-discrete-input.js.map +0 -1
  255. package/fesm2015/bravura-ui-file-upload.js +0 -443
  256. package/fesm2015/bravura-ui-file-upload.js.map +0 -1
  257. package/fesm2015/bravura-ui-form-field.js.map +0 -1
  258. package/fesm2015/bravura-ui-icon-font.js.map +0 -1
  259. package/fesm2015/bravura-ui-phone-number.js.map +0 -1
  260. package/fesm2015/bravura-ui-radio-panel.js +0 -230
  261. package/fesm2015/bravura-ui-radio-panel.js.map +0 -1
  262. package/fesm2015/bravura-ui-selection-panel.js.map +0 -1
  263. package/fesm2015/bravura-ui-skeletons.js.map +0 -1
  264. package/fesm2015/bravura-ui-stepper.js.map +0 -1
  265. package/fesm2015/bravura-ui-tooltip.js.map +0 -1
  266. package/fesm2015/bravura-ui.js.map +0 -1
  267. package/file-upload/package.json +0 -10
  268. package/form-field/package.json +0 -10
  269. package/icon-font/package.json +0 -10
  270. package/phone-number/package.json +0 -10
  271. package/radio-panel/package.json +0 -10
  272. package/selection-panel/package.json +0 -10
  273. package/skeletons/package.json +0 -10
  274. package/stepper/package.json +0 -10
  275. package/tooltip/package.json +0 -10
@@ -0,0 +1,303 @@
1
+ import { getCurrencySymbol, DecimalPipe, CommonModule } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { ɵfindLocaleData, LOCALE_ID, DEFAULT_CURRENCY_CODE, forwardRef, Directive, Self, Inject, Optional, Input, HostBinding, HostListener, NgModule } from '@angular/core';
4
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
5
+ import * as i1 from '@angular/material/form-field';
6
+ import { MAT_FORM_FIELD } from '@angular/material/form-field';
7
+ import { MatInput } from '@angular/material/input';
8
+ import { noop } from 'rxjs';
9
+
10
+ /* tslint:disable:no-empty */
11
+ const noop_consumer = (_) => { };
12
+ /**
13
+ * This directive will enhance an input element to format the numbers entered to a currency amount.
14
+ */
15
+ class CurrencyInputDirective {
16
+ constructor(_el, _renderer, _locale, _defaultCurrencyCode, _field) {
17
+ this._el = _el;
18
+ this._renderer = _renderer;
19
+ this._locale = _locale;
20
+ this._defaultCurrencyCode = _defaultCurrencyCode;
21
+ this._field = _field;
22
+ /**
23
+ * true to allow negative input, otherwise false
24
+ * Default to false.
25
+ */
26
+ this.allowNegative = false;
27
+ /**
28
+ * Provide the currency code to format the entered amount.
29
+ * Uses angular token DEFAULT_CURRENCY_CODE by default.
30
+ */
31
+ this.currencyCode = '';
32
+ /**
33
+ * true if no decimal digits allowed, otherwise false.
34
+ * Default to false.
35
+ */
36
+ this.baseUnitOnly = false;
37
+ /**
38
+ * The format the of the amount either in wide or narrow.
39
+ */
40
+ this.format = 'wide';
41
+ this.placeholder = '';
42
+ this.autocomplete = 'off';
43
+ this.type = 'text';
44
+ this.inputMode = 'decimal';
45
+ this.change = noop_consumer;
46
+ this.onTouch = noop;
47
+ this._symbol = '$';
48
+ this._ds = '.'; // decimal separator
49
+ this._trailing = false;
50
+ const userAgent = navigator.userAgent;
51
+ this._safari = !userAgent.match(/Firefox/i) && !userAgent.match(/Chrome/i) && !!userAgent.match(/safari/i);
52
+ this._currencyUpdated();
53
+ }
54
+ ngOnInit() { }
55
+ ngOnChanges() {
56
+ this._currencyUpdated();
57
+ this.onInput();
58
+ }
59
+ onInput() {
60
+ this._formatCurrency(this._el, false, true);
61
+ }
62
+ onFocus() {
63
+ this._formatCurrency(this._el, false, true);
64
+ }
65
+ onblur() {
66
+ this.onTouch();
67
+ this._formatCurrency(this._el, true, false);
68
+ }
69
+ writeValue(value) {
70
+ value = this._decimalPipe.transform(value);
71
+ this._renderer.setProperty(this._el.nativeElement, 'value', value);
72
+ this._formatCurrency(this._el, false, false);
73
+ }
74
+ registerOnChange(fn) {
75
+ this.change = fn;
76
+ }
77
+ registerOnTouched(fn) {
78
+ this.onTouch = fn;
79
+ }
80
+ _updatePlaceholder() {
81
+ var _a;
82
+ this.placeholder = this.placeholder || this._0Text;
83
+ if (((_a = this._field) === null || _a === void 0 ? void 0 : _a._control) instanceof MatInput) {
84
+ this._field._control.placeholder = this.placeholder;
85
+ }
86
+ }
87
+ _currencyUpdated() {
88
+ this.currencyCode = this.currencyCode || this._defaultCurrencyCode;
89
+ this._symbol = getCurrencySymbol(this.currencyCode, this.format, this._locale) || '$';
90
+ const localeData = ɵfindLocaleData(this._locale);
91
+ this._ds = localeData[13][0];
92
+ this._decimalPipe = new DecimalPipe(this._locale);
93
+ const curFormat = localeData[14][2];
94
+ this._trailing = curFormat.indexOf('¤') > 0;
95
+ this._updatePlaceholder();
96
+ }
97
+ _formatCurrency(input, blur, focus) {
98
+ // appends $ to value, validates decimal side
99
+ // and puts cursor back in right position.
100
+ // get input value
101
+ let input_val = input.nativeElement.value;
102
+ // don't validate empty input
103
+ if (input_val === '') {
104
+ this.change(null);
105
+ return;
106
+ }
107
+ const minus = this.allowNegative ? '-' : '';
108
+ // remove non digit values except currency symbol, decimal separator and hypen
109
+ const reg = new RegExp(`[^0-9${minus}${this._symbol}${this._ds}]`, 'g');
110
+ let sanitiseValue = input_val.replace(reg, '');
111
+ if (sanitiseValue === '' || sanitiseValue === this._symbol) {
112
+ this.change(null);
113
+ this._renderer.setProperty(input.nativeElement, 'value', '');
114
+ return;
115
+ }
116
+ else if ((this.allowNegative && sanitiseValue === `-${this._symbol}`) ||
117
+ sanitiseValue === '-' ||
118
+ sanitiseValue === '--') {
119
+ this.change(null);
120
+ this._renderer.setProperty(input.nativeElement, 'value', '-');
121
+ return;
122
+ }
123
+ const negative = this.allowNegative && input_val.indexOf('-') >= 0;
124
+ // original length
125
+ const original_len = input_val.length;
126
+ // initial caret position
127
+ let caret_pos = input.nativeElement.selectionStart;
128
+ input_val = input_val.replace(RegExp(`[^0-9${minus}${this._ds}]`, 'g'), '').replace(/^\.\./, '');
129
+ // check for decimal
130
+ if (input_val.indexOf(this._ds) >= 0) {
131
+ // get position of first decimal
132
+ // this prevents multiple decimals from
133
+ // being entered
134
+ let decimal_pos = input_val.indexOf(this._ds);
135
+ // split number by decimal point
136
+ let left_side = input_val.substring(0, decimal_pos);
137
+ let right_side = input_val.substring(decimal_pos);
138
+ // add commas to left side of number
139
+ left_side = this._formatNumber(left_side, blur) || '';
140
+ // no value append a zero for decimal values
141
+ if (!left_side.length) {
142
+ left_side = '0';
143
+ }
144
+ if (!this.baseUnitOnly) {
145
+ // validate right side
146
+ right_side = right_side.replace(/\D/g, '');
147
+ // Limit decimal to only 2 digits
148
+ let v = Number(`0.${right_side}`);
149
+ if (v) {
150
+ const length = right_side.length > 1 ? 2 : 1;
151
+ right_side = v.toFixed(length).substring(2, 4);
152
+ }
153
+ // On blur make sure 2 numbers after decimal
154
+ if (blur) {
155
+ right_side += '00';
156
+ }
157
+ right_side = right_side.substring(0, 2);
158
+ // join number by .
159
+ input_val = left_side + this._ds + right_side;
160
+ }
161
+ else {
162
+ input_val = left_side;
163
+ }
164
+ }
165
+ else {
166
+ input_val = this._formatNumber(input_val, blur);
167
+ // final formatting
168
+ if (blur && !this.baseUnitOnly) {
169
+ input_val += `${this._ds}00`;
170
+ }
171
+ }
172
+ const numStr = input_val;
173
+ // append the currency symbol
174
+ if (!this._safari || !focus) {
175
+ if (this._trailing) {
176
+ input_val = input_val + ' ' + this._symbol;
177
+ }
178
+ else {
179
+ input_val = this._symbol + input_val;
180
+ }
181
+ }
182
+ if (negative) {
183
+ // append the hypen back to the value if a negative value was entered
184
+ input_val = `-${input_val}`;
185
+ }
186
+ const num = this._convert((negative ? '-' : '') + numStr);
187
+ // update control value first with the number
188
+ this.change(Number(num));
189
+ if (blur && num === 0) {
190
+ input_val = this._0Text;
191
+ }
192
+ // update dom with the formatted value
193
+ this._renderer.setProperty(input.nativeElement, 'value', input_val);
194
+ // put caret back in the right position
195
+ let updated_len = input_val.length;
196
+ if (caret_pos) {
197
+ caret_pos = updated_len - original_len + caret_pos;
198
+ if (input_val.substring(caret_pos - this._symbol.length) === this._symbol && this._trailing) {
199
+ caret_pos -= this._symbol.length + 1;
200
+ }
201
+ }
202
+ if (!this._safari) {
203
+ input.nativeElement.setSelectionRange(caret_pos, caret_pos);
204
+ }
205
+ }
206
+ // format the number into currency format
207
+ _formatNumber(n, blur = false) {
208
+ // format number 1000000 to 1,234,567
209
+ n = n.replace(/\D/g, '');
210
+ if (blur) {
211
+ n = n.replace(/^0+/, '');
212
+ }
213
+ return this._decimalPipe.transform(n, '1.0-0');
214
+ }
215
+ _convert(input) {
216
+ if (!input) {
217
+ return NaN;
218
+ }
219
+ const val = input
220
+ .replace(this._ds, 'd')
221
+ .replace(/[^0-9d-]/g, '')
222
+ .replace('d', '.');
223
+ return parseFloat(val);
224
+ }
225
+ get _0Text() {
226
+ const decimalStr = this.baseUnitOnly ? '' : `${this._ds}00`;
227
+ return this._trailing ? `0${decimalStr} ${this._symbol}` : `${this._symbol}0${decimalStr}`;
228
+ }
229
+ }
230
+ CurrencyInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CurrencyInputDirective, deps: [{ token: i0.ElementRef, self: true }, { token: i0.Renderer2 }, { token: LOCALE_ID }, { token: DEFAULT_CURRENCY_CODE }, { token: MAT_FORM_FIELD, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
231
+ CurrencyInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: CurrencyInputDirective, selector: "input[buiCurrencyInput],input[currencyCode],input[data-type=currency]", inputs: { allowNegative: "allowNegative", currencyCode: "currencyCode", baseUnitOnly: "baseUnitOnly", format: "format" }, host: { listeners: { "input": "onInput()", "focus": "onFocus()", "blur": "onblur()" }, properties: { "placeholder": "this.placeholder", "autocomplete": "this.autocomplete", "type": "this.type", "attr.inputmode": "this.inputMode" } }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CurrencyInputDirective), multi: true }], usesOnChanges: true, ngImport: i0 });
232
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CurrencyInputDirective, decorators: [{
233
+ type: Directive,
234
+ args: [{
235
+ selector: 'input[buiCurrencyInput],input[currencyCode],input[data-type=currency]',
236
+ providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CurrencyInputDirective), multi: true }]
237
+ }]
238
+ }], ctorParameters: function () {
239
+ return [{ type: i0.ElementRef, decorators: [{
240
+ type: Self
241
+ }] }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
242
+ type: Inject,
243
+ args: [LOCALE_ID]
244
+ }] }, { type: undefined, decorators: [{
245
+ type: Inject,
246
+ args: [DEFAULT_CURRENCY_CODE]
247
+ }] }, { type: i1.MatFormField, decorators: [{
248
+ type: Optional
249
+ }, {
250
+ type: Inject,
251
+ args: [MAT_FORM_FIELD]
252
+ }] }];
253
+ }, propDecorators: { allowNegative: [{
254
+ type: Input
255
+ }], currencyCode: [{
256
+ type: Input
257
+ }], baseUnitOnly: [{
258
+ type: Input
259
+ }], format: [{
260
+ type: Input
261
+ }], placeholder: [{
262
+ type: HostBinding,
263
+ args: ['placeholder']
264
+ }], autocomplete: [{
265
+ type: HostBinding,
266
+ args: ['autocomplete']
267
+ }], type: [{
268
+ type: HostBinding,
269
+ args: ['type']
270
+ }], inputMode: [{
271
+ type: HostBinding,
272
+ args: ['attr.inputmode']
273
+ }], onInput: [{
274
+ type: HostListener,
275
+ args: ['input']
276
+ }], onFocus: [{
277
+ type: HostListener,
278
+ args: ['focus']
279
+ }], onblur: [{
280
+ type: HostListener,
281
+ args: ['blur']
282
+ }] } });
283
+
284
+ class CurrencyInputModule {
285
+ }
286
+ CurrencyInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CurrencyInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
287
+ CurrencyInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: CurrencyInputModule, declarations: [CurrencyInputDirective], imports: [CommonModule], exports: [CurrencyInputDirective] });
288
+ CurrencyInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CurrencyInputModule, imports: [CommonModule] });
289
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CurrencyInputModule, decorators: [{
290
+ type: NgModule,
291
+ args: [{
292
+ declarations: [CurrencyInputDirective],
293
+ imports: [CommonModule],
294
+ exports: [CurrencyInputDirective]
295
+ }]
296
+ }] });
297
+
298
+ /**
299
+ * Generated bundle index. Do not edit.
300
+ */
301
+
302
+ export { CurrencyInputDirective, CurrencyInputModule };
303
+ //# sourceMappingURL=bravura-ui-currency-input.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bravura-ui-currency-input.mjs","sources":["../../../projects/ui/currency-input/currency-input.directive.ts","../../../projects/ui/currency-input/currency-input.module.ts","../../../projects/ui/currency-input/bravura-ui-currency-input.ts"],"sourcesContent":["import { DecimalPipe, getCurrencySymbol } from '@angular/common';\nimport {\n\tDEFAULT_CURRENCY_CODE,\n\tDirective,\n\tElementRef,\n\tforwardRef,\n\tHostBinding,\n\tHostListener,\n\tInject,\n\tInput,\n\tLOCALE_ID,\n\tOnChanges,\n\tOnInit,\n\tOptional,\n\tRenderer2,\n\tSelf,\n\tɵfindLocaleData\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { MatFormField, MAT_FORM_FIELD } from '@angular/material/form-field';\nimport { MatInput } from '@angular/material/input';\nimport { noop } from 'rxjs';\n\n/* tslint:disable:no-empty */\nexport const noop_consumer = (_: any) => {};\n\n/**\n * This directive will enhance an input element to format the numbers entered to a currency amount.\n */\n@Directive({\n\tselector: 'input[buiCurrencyInput],input[currencyCode],input[data-type=currency]',\n\tproviders: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CurrencyInputDirective), multi: true }]\n})\nexport class CurrencyInputDirective implements OnInit, OnChanges, ControlValueAccessor {\n\t/**\n\t * true to allow negative input, otherwise false\n\t * Default to false.\n\t */\n\t@Input()\n\tallowNegative: boolean = false;\n\n\t/**\n\t * Provide the currency code to format the entered amount.\n\t * Uses angular token DEFAULT_CURRENCY_CODE by default.\n\t */\n\t@Input()\n\tcurrencyCode: string = '';\n\n\t/**\n\t * true if no decimal digits allowed, otherwise false.\n\t * Default to false.\n\t */\n\t@Input()\n\tbaseUnitOnly = false;\n\n\t/**\n\t * The format the of the amount either in wide or narrow.\n\t */\n\t@Input()\n\tformat: 'narrow' | 'wide' = 'wide';\n\n\t@HostBinding('placeholder')\n\tprivate placeholder: string = '';\n\n\t@HostBinding('autocomplete')\n\tprivate autocomplete = 'off';\n\n\t@HostBinding('type')\n\tprivate type = 'text';\n\n\t@HostBinding('attr.inputmode')\n\tprivate inputMode = 'decimal';\n\n\tprivate change = noop_consumer;\n\tprivate onTouch = noop;\n\tprivate _safari: boolean;\n\tprivate _symbol: string = '$';\n\tprivate _decimalPipe!: DecimalPipe;\n\n\tprivate _ds = '.'; // decimal separator\n\tprivate _trailing = false;\n\n\tconstructor(\n\t\t@Self() private _el: ElementRef<HTMLInputElement>,\n\t\tprivate _renderer: Renderer2,\n\t\t@Inject(LOCALE_ID) private _locale: string,\n\t\t@Inject(DEFAULT_CURRENCY_CODE) private _defaultCurrencyCode: string,\n\t\t@Optional() @Inject(MAT_FORM_FIELD) private _field?: MatFormField\n\t) {\n\t\tconst userAgent = navigator.userAgent;\n\t\tthis._safari = !userAgent.match(/Firefox/i) && !userAgent.match(/Chrome/i) && !!userAgent.match(/safari/i);\n\t\tthis._currencyUpdated();\n\t}\n\n\tngOnInit() {}\n\n\tngOnChanges(): void {\n\t\tthis._currencyUpdated();\n\t\tthis.onInput();\n\t}\n\n\t@HostListener('input')\n\tonInput() {\n\t\tthis._formatCurrency(this._el, false, true);\n\t}\n\n\t@HostListener('focus')\n\tonFocus() {\n\t\tthis._formatCurrency(this._el, false, true);\n\t}\n\n\t@HostListener('blur')\n\tonblur() {\n\t\tthis.onTouch();\n\t\tthis._formatCurrency(this._el, true, false);\n\t}\n\n\twriteValue(value: any) {\n\t\tvalue = this._decimalPipe.transform(value);\n\t\tthis._renderer.setProperty(this._el.nativeElement, 'value', value);\n\t\tthis._formatCurrency(this._el, false, false);\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.change = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouch = fn;\n\t}\n\n\tprivate _updatePlaceholder() {\n\t\tthis.placeholder = this.placeholder || this._0Text;\n\t\tif (this._field?._control instanceof MatInput) {\n\t\t\tthis._field._control.placeholder = this.placeholder;\n\t\t}\n\t}\n\n\tprivate _currencyUpdated() {\n\t\tthis.currencyCode = this.currencyCode || this._defaultCurrencyCode;\n\t\tthis._symbol = getCurrencySymbol(this.currencyCode, this.format, this._locale) || '$';\n\t\tconst localeData = ɵfindLocaleData(this._locale);\n\t\tthis._ds = localeData[13][0];\n\t\tthis._decimalPipe = new DecimalPipe(this._locale);\n\t\tconst curFormat: string = localeData[14][2];\n\t\tthis._trailing = curFormat.indexOf('¤') > 0;\n\t\tthis._updatePlaceholder();\n\t}\n\n\tprivate _formatCurrency(input: ElementRef<HTMLInputElement>, blur: boolean, focus: boolean) {\n\t\t// appends $ to value, validates decimal side\n\t\t// and puts cursor back in right position.\n\t\t// get input value\n\t\tlet input_val = input.nativeElement.value;\n\n\t\t// don't validate empty input\n\t\tif (input_val === '') {\n\t\t\tthis.change(null);\n\t\t\treturn;\n\t\t}\n\n\t\tconst minus = this.allowNegative ? '-' : '';\n\n\t\t// remove non digit values except currency symbol, decimal separator and hypen\n\t\tconst reg = new RegExp(`[^0-9${minus}${this._symbol}${this._ds}]`, 'g');\n\n\t\tlet sanitiseValue = input_val.replace(reg, '');\n\n\t\tif (sanitiseValue === '' || sanitiseValue === this._symbol) {\n\t\t\tthis.change(null);\n\t\t\tthis._renderer.setProperty(input.nativeElement, 'value', '');\n\t\t\treturn;\n\t\t} else if (\n\t\t\t(this.allowNegative && sanitiseValue === `-${this._symbol}`) ||\n\t\t\tsanitiseValue === '-' ||\n\t\t\tsanitiseValue === '--'\n\t\t) {\n\t\t\tthis.change(null);\n\t\t\tthis._renderer.setProperty(input.nativeElement, 'value', '-');\n\t\t\treturn;\n\t\t}\n\n\t\tconst negative = this.allowNegative && input_val.indexOf('-') >= 0;\n\n\t\t// original length\n\t\tconst original_len = input_val.length;\n\n\t\t// initial caret position\n\t\tlet caret_pos = input.nativeElement.selectionStart;\n\n\t\tinput_val = input_val.replace(RegExp(`[^0-9${minus}${this._ds}]`, 'g'), '').replace(/^\\.\\./, '');\n\t\t// check for decimal\n\t\tif (input_val.indexOf(this._ds) >= 0) {\n\t\t\t// get position of first decimal\n\t\t\t// this prevents multiple decimals from\n\t\t\t// being entered\n\t\t\tlet decimal_pos = input_val.indexOf(this._ds);\n\n\t\t\t// split number by decimal point\n\t\t\tlet left_side = input_val.substring(0, decimal_pos);\n\t\t\tlet right_side = input_val.substring(decimal_pos);\n\n\t\t\t// add commas to left side of number\n\t\t\tleft_side = this._formatNumber(left_side, blur) || '';\n\n\t\t\t// no value append a zero for decimal values\n\t\t\tif (!left_side.length) {\n\t\t\t\tleft_side = '0';\n\t\t\t}\n\n\t\t\tif (!this.baseUnitOnly) {\n\t\t\t\t// validate right side\n\t\t\t\tright_side = right_side.replace(/\\D/g, '');\n\n\t\t\t\t// Limit decimal to only 2 digits\n\t\t\t\tlet v = Number(`0.${right_side}`);\n\t\t\t\tif (v) {\n\t\t\t\t\tconst length = right_side.length > 1 ? 2 : 1;\n\t\t\t\t\tright_side = v.toFixed(length).substring(2, 4);\n\t\t\t\t}\n\n\t\t\t\t// On blur make sure 2 numbers after decimal\n\t\t\t\tif (blur) {\n\t\t\t\t\tright_side += '00';\n\t\t\t\t}\n\n\t\t\t\tright_side = right_side.substring(0, 2);\n\n\t\t\t\t// join number by .\n\t\t\t\tinput_val = left_side + this._ds + right_side;\n\t\t\t} else {\n\t\t\t\tinput_val = left_side;\n\t\t\t}\n\t\t} else {\n\t\t\tinput_val = this._formatNumber(input_val, blur);\n\n\t\t\t// final formatting\n\t\t\tif (blur && !this.baseUnitOnly) {\n\t\t\t\tinput_val += `${this._ds}00`;\n\t\t\t}\n\t\t}\n\n\t\tconst numStr = input_val;\n\t\t// append the currency symbol\n\t\tif (!this._safari || !focus) {\n\t\t\tif (this._trailing) {\n\t\t\t\tinput_val = input_val + ' ' + this._symbol;\n\t\t\t} else {\n\t\t\t\tinput_val = this._symbol + input_val;\n\t\t\t}\n\t\t}\n\n\t\tif (negative) {\n\t\t\t// append the hypen back to the value if a negative value was entered\n\t\t\tinput_val = `-${input_val}`;\n\t\t}\n\n\t\tconst num = this._convert((negative ? '-' : '') + numStr);\n\n\t\t// update control value first with the number\n\t\tthis.change(Number(num));\n\n\t\tif (blur && num === 0) {\n\t\t\tinput_val = this._0Text;\n\t\t}\n\n\t\t// update dom with the formatted value\n\t\tthis._renderer.setProperty(input.nativeElement, 'value', input_val);\n\t\t// put caret back in the right position\n\t\tlet updated_len = input_val.length;\n\t\tif (caret_pos) {\n\t\t\tcaret_pos = updated_len - original_len + caret_pos;\n\t\t\tif (input_val.substring(caret_pos - this._symbol.length) === this._symbol && this._trailing) {\n\t\t\t\tcaret_pos -= this._symbol.length + 1;\n\t\t\t}\n\t\t}\n\t\tif (!this._safari) {\n\t\t\tinput.nativeElement.setSelectionRange(caret_pos, caret_pos);\n\t\t}\n\t}\n\n\t// format the number into currency format\n\tprivate _formatNumber(n: string, blur: boolean = false) {\n\t\t// format number 1000000 to 1,234,567\n\t\tn = n.replace(/\\D/g, '');\n\t\tif (blur) {\n\t\t\tn = n.replace(/^0+/, '');\n\t\t}\n\t\treturn this._decimalPipe.transform(n, '1.0-0') as string;\n\t}\n\n\tprivate _convert(input: string): number {\n\t\tif (!input) {\n\t\t\treturn NaN;\n\t\t}\n\t\tconst val = input\n\t\t\t.replace(this._ds, 'd')\n\t\t\t.replace(/[^0-9d-]/g, '')\n\t\t\t.replace('d', '.');\n\t\treturn parseFloat(val);\n\t}\n\n\tprivate get _0Text(): string {\n\t\tconst decimalStr = this.baseUnitOnly ? '' : `${this._ds}00`;\n\t\treturn this._trailing ? `0${decimalStr} ${this._symbol}` : `${this._symbol}0${decimalStr}`;\n\t}\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { CurrencyInputDirective } from './currency-input.directive';\n\n@NgModule({\n\tdeclarations: [CurrencyInputDirective],\n\timports: [CommonModule],\n\texports: [CurrencyInputDirective]\n})\nexport class CurrencyInputModule {}\n\nexport { CurrencyInputDirective };\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAuBA;AACO,MAAM,aAAa,GAAG,CAAC,CAAM,KAAM,GAAC,CAAC;AAE5C;;AAEG;MAKU,sBAAsB,CAAA;IAiDlC,WACiB,CAAA,GAAiC,EACzC,SAAoB,EACD,OAAe,EACH,oBAA4B,EACvB,MAAqB,EAAA;AAJjD,QAAA,IAAG,CAAA,GAAA,GAAH,GAAG,CAA8B;AACzC,QAAA,IAAS,CAAA,SAAA,GAAT,SAAS,CAAW;AACD,QAAA,IAAO,CAAA,OAAA,GAAP,OAAO,CAAQ;AACH,QAAA,IAAoB,CAAA,oBAAA,GAApB,oBAAoB,CAAQ;AACvB,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAe;AArDlE;;;AAGG;AAEH,QAAA,IAAa,CAAA,aAAA,GAAY,KAAK,CAAC;AAE/B;;;AAGG;AAEH,QAAA,IAAY,CAAA,YAAA,GAAW,EAAE,CAAC;AAE1B;;;AAGG;AAEH,QAAA,IAAY,CAAA,YAAA,GAAG,KAAK,CAAC;AAErB;;AAEG;AAEH,QAAA,IAAM,CAAA,MAAA,GAAsB,MAAM,CAAC;AAG3B,QAAA,IAAW,CAAA,WAAA,GAAW,EAAE,CAAC;AAGzB,QAAA,IAAY,CAAA,YAAA,GAAG,KAAK,CAAC;AAGrB,QAAA,IAAI,CAAA,IAAA,GAAG,MAAM,CAA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A;sBADhB,WAAW;uBAAC,gBAAgB,CAAA;gBAgC7B,OAAO,EAAA,CAAA;sBADN,YAAY;uBAAC,OAAO,CAAA;gBAMrB,OAAO,EAAA,CAAA;sBADN,YAAY;uBAAC,OAAO,CAAA;gBAMrB,MAAM,EAAA,CAAA;sBADL,YAAY;uBAAC,MAAM,CAAA;;;MCtGR,mBAAmB,CAAA;;gHAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAnB,mBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,EAJhB,YAAA,EAAA,CAAA,sBAAsB,CAC3B,EAAA,OAAA,EAAA,CAAA,YAAY,aACZ,sBAAsB,CAAA,EAAA,CAAA,CAAA;AAEpB,mBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YAHrB,YAAY,CAAA,EAAA,CAAA,CAAA;2FAGV,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAL/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACT,YAAY,EAAE,CAAC,sBAAsB,CAAC;oBACtC,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,sBAAsB,CAAC;iBACjC,CAAA;;;ACRD;;AAEG;;;;"}
@@ -0,0 +1,147 @@
1
+ import { DecimalPipe, CommonModule } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { forwardRef, Directive, Self, Input, HostBinding, HostListener, NgModule } from '@angular/core';
4
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
5
+ import { noop } from 'rxjs';
6
+
7
+ /* tslint:disable:no-empty */
8
+ const noop_consumer = (_) => { };
9
+ /**
10
+ * This directive will enhance an input element to format the numbers entered to a decimal amount.
11
+ */
12
+ class DecimalInputDirective {
13
+ constructor(_el, _renderer) {
14
+ this._el = _el;
15
+ this._renderer = _renderer;
16
+ /**
17
+ * number of decimal places allowed
18
+ */
19
+ this.buiDecimalInput = 2;
20
+ this.placeholder = '';
21
+ this.autocomplete = 'off';
22
+ this.type = 'number';
23
+ this.inputMode = 'decimal';
24
+ this.change = noop_consumer;
25
+ this.onTouch = noop;
26
+ }
27
+ ngOnChanges() {
28
+ this.buiDecimalInput = this.buiDecimalInput || 2;
29
+ this.onInput();
30
+ }
31
+ onInput() {
32
+ const value = this._el.nativeElement.value;
33
+ const decimalPart = value.split('.')[1];
34
+ if (decimalPart && decimalPart.length > this.buiDecimalInput) {
35
+ const indexOfPeriod = value.indexOf('.');
36
+ const newValue = value.substring(0, indexOfPeriod + this.buiDecimalInput + 1);
37
+ this._renderer.setProperty(this._el.nativeElement, 'value', newValue);
38
+ }
39
+ this.change(Number(this._el.nativeElement.value));
40
+ }
41
+ onKeypress(evt) {
42
+ const target = evt.target;
43
+ const value = target.value;
44
+ const isSpace = evt.key === ' ';
45
+ if (isSpace ||
46
+ (!['.', '-'].includes(evt.key) && isNaN(Number(evt.key))) ||
47
+ (evt.key === '.' && value.indexOf('.') > 0)) {
48
+ evt.preventDefault();
49
+ }
50
+ }
51
+ onFocus() { }
52
+ onblur() {
53
+ this.onTouch();
54
+ this._resetDecimalPlaces();
55
+ }
56
+ writeValue(value) {
57
+ this._renderer.setProperty(this._el.nativeElement, 'value', value);
58
+ }
59
+ registerOnChange(fn) {
60
+ this.change = fn;
61
+ }
62
+ registerOnTouched(fn) {
63
+ this.onTouch = fn;
64
+ }
65
+ _resetDecimalPlaces() {
66
+ const value = this._el.nativeElement.value;
67
+ if (value === '' || value === null || value === undefined) {
68
+ return;
69
+ }
70
+ const splitValues = value.split('.');
71
+ let newValue = '';
72
+ if (splitValues[1] && splitValues[1].length > this.buiDecimalInput) {
73
+ newValue = value.substring(0, splitValues[0].length + 1 + this.buiDecimalInput);
74
+ }
75
+ else {
76
+ this.buiDecimalInput = this.buiDecimalInput < 0 ? 0 : this.buiDecimalInput;
77
+ newValue = Number(value).toFixed(this.buiDecimalInput);
78
+ }
79
+ this._renderer.setProperty(this._el.nativeElement, 'value', newValue);
80
+ }
81
+ }
82
+ DecimalInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DecimalInputDirective, deps: [{ token: i0.ElementRef, self: true }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
83
+ DecimalInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: DecimalInputDirective, selector: "input[buiDecimalInput]", inputs: { buiDecimalInput: "buiDecimalInput" }, host: { listeners: { "input": "onInput()", "keypress": "onKeypress($event)", "focus": "onFocus()", "blur": "onblur()" }, properties: { "placeholder": "this.placeholder", "autocomplete": "this.autocomplete", "type": "this.type", "attr.inputmode": "this.inputMode" } }, providers: [
84
+ DecimalPipe,
85
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DecimalInputDirective), multi: true }
86
+ ], usesOnChanges: true, ngImport: i0 });
87
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DecimalInputDirective, decorators: [{
88
+ type: Directive,
89
+ args: [{
90
+ selector: 'input[buiDecimalInput]',
91
+ providers: [
92
+ DecimalPipe,
93
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DecimalInputDirective), multi: true }
94
+ ]
95
+ }]
96
+ }], ctorParameters: function () {
97
+ return [{ type: i0.ElementRef, decorators: [{
98
+ type: Self
99
+ }] }, { type: i0.Renderer2 }];
100
+ }, propDecorators: { buiDecimalInput: [{
101
+ type: Input
102
+ }], placeholder: [{
103
+ type: HostBinding,
104
+ args: ['placeholder']
105
+ }], autocomplete: [{
106
+ type: HostBinding,
107
+ args: ['autocomplete']
108
+ }], type: [{
109
+ type: HostBinding,
110
+ args: ['type']
111
+ }], inputMode: [{
112
+ type: HostBinding,
113
+ args: ['attr.inputmode']
114
+ }], onInput: [{
115
+ type: HostListener,
116
+ args: ['input']
117
+ }], onKeypress: [{
118
+ type: HostListener,
119
+ args: ['keypress', ['$event']]
120
+ }], onFocus: [{
121
+ type: HostListener,
122
+ args: ['focus']
123
+ }], onblur: [{
124
+ type: HostListener,
125
+ args: ['blur']
126
+ }] } });
127
+
128
+ class DecimalInputModule {
129
+ }
130
+ DecimalInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DecimalInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
131
+ DecimalInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: DecimalInputModule, declarations: [DecimalInputDirective], imports: [CommonModule], exports: [DecimalInputDirective] });
132
+ DecimalInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DecimalInputModule, imports: [CommonModule] });
133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DecimalInputModule, decorators: [{
134
+ type: NgModule,
135
+ args: [{
136
+ declarations: [DecimalInputDirective],
137
+ imports: [CommonModule],
138
+ exports: [DecimalInputDirective]
139
+ }]
140
+ }] });
141
+
142
+ /**
143
+ * Generated bundle index. Do not edit.
144
+ */
145
+
146
+ export { DecimalInputDirective, DecimalInputModule };
147
+ //# sourceMappingURL=bravura-ui-decimal-input.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bravura-ui-decimal-input.mjs","sources":["../../../projects/ui/decimal-input/decimal-input.directive.ts","../../../projects/ui/decimal-input/decimal-input.module.ts","../../../projects/ui/decimal-input/bravura-ui-decimal-input.ts"],"sourcesContent":["import { DecimalPipe } from '@angular/common';\nimport {\n\tDirective,\n\tElementRef,\n\tforwardRef,\n\tHostBinding,\n\tHostListener,\n\tInput,\n\tOnChanges,\n\tRenderer2,\n\tSelf\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { noop } from 'rxjs';\n\n/* tslint:disable:no-empty */\nexport const noop_consumer = (_: any) => {};\n\n/**\n * This directive will enhance an input element to format the numbers entered to a decimal amount.\n */\n@Directive({\n\tselector: 'input[buiDecimalInput]',\n\tproviders: [\n\t\tDecimalPipe,\n\t\t{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DecimalInputDirective), multi: true }\n\t]\n})\nexport class DecimalInputDirective implements OnChanges, ControlValueAccessor {\n\t/**\n\t * number of decimal places allowed\n\t */\n\t@Input()\n\tbuiDecimalInput: number = 2;\n\n\t@HostBinding('placeholder')\n\tprivate placeholder: string = '';\n\n\t@HostBinding('autocomplete')\n\tprivate autocomplete = 'off';\n\n\t@HostBinding('type')\n\tprivate type = 'number';\n\n\t@HostBinding('attr.inputmode')\n\tprivate inputMode = 'decimal';\n\n\tprivate change = noop_consumer;\n\tprivate onTouch = noop;\n\n\tconstructor(@Self() private _el: ElementRef<HTMLInputElement>, private _renderer: Renderer2) {}\n\n\tngOnChanges(): void {\n\t\tthis.buiDecimalInput = this.buiDecimalInput || 2;\n\t\tthis.onInput();\n\t}\n\n\t@HostListener('input')\n\tonInput() {\n\t\tconst value = this._el.nativeElement.value;\n\t\tconst decimalPart = value.split('.')[1];\n\n\t\tif (decimalPart && decimalPart.length > this.buiDecimalInput) {\n\t\t\tconst indexOfPeriod = value.indexOf('.');\n\t\t\tconst newValue = value.substring(0, indexOfPeriod + this.buiDecimalInput + 1);\n\t\t\tthis._renderer.setProperty(this._el.nativeElement, 'value', newValue);\n\t\t}\n\t\tthis.change(Number(this._el.nativeElement.value));\n\t}\n\n\t@HostListener('keypress', ['$event'])\n\tonKeypress(evt: KeyboardEvent) {\n\t\tconst target = evt.target as HTMLInputElement;\n\t\tconst value = target.value;\n\t\tconst isSpace = evt.key === ' ';\n\n\t\tif (\n\t\t\tisSpace ||\n\t\t\t(!['.', '-'].includes(evt.key) && isNaN(Number(evt.key))) ||\n\t\t\t(evt.key === '.' && value.indexOf('.') > 0)\n\t\t) {\n\t\t\tevt.preventDefault();\n\t\t}\n\t}\n\n\t@HostListener('focus')\n\tonFocus() {}\n\n\t@HostListener('blur')\n\tonblur() {\n\t\tthis.onTouch();\n\t\tthis._resetDecimalPlaces();\n\t}\n\n\twriteValue(value: any) {\n\t\tthis._renderer.setProperty(this._el.nativeElement, 'value', value);\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.change = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouch = fn;\n\t}\n\n\tprivate _resetDecimalPlaces() {\n\t\tconst value = this._el.nativeElement.value;\n\t\tif (value === '' || value === null || value === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tconst splitValues = value.split('.');\n\t\tlet newValue = '';\n\t\tif (splitValues[1] && splitValues[1].length > this.buiDecimalInput) {\n\t\t\tnewValue = value.substring(0, splitValues[0].length + 1 + this.buiDecimalInput);\n\t\t} else {\n\t\t\tthis.buiDecimalInput = this.buiDecimalInput < 0 ? 0 : this.buiDecimalInput;\n\t\t\tnewValue = Number(value).toFixed(this.buiDecimalInput);\n\t\t}\n\t\tthis._renderer.setProperty(this._el.nativeElement, 'value', newValue);\n\t}\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { DecimalInputDirective } from './decimal-input.directive';\n\n@NgModule({\n\tdeclarations: [DecimalInputDirective],\n\timports: [CommonModule],\n\texports: [DecimalInputDirective]\n})\nexport class DecimalInputModule {}\nexport { DecimalInputDirective };\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAeA;AACO,MAAM,aA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