@bravura/ui 3.8.0 → 4.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 (267) hide show
  1. package/CHANGELOG.md +579 -557
  2. package/LICENSE +6 -6
  3. package/README.md +56 -54
  4. package/alert/alert-container.component.d.ts +1 -1
  5. package/alert/alert-message.component.d.ts +1 -1
  6. package/behavior/await.directive.d.ts +1 -1
  7. package/behavior/observe-content-class.directive.d.ts +1 -1
  8. package/behavior/sizing.directive.d.ts +1 -1
  9. package/clip-note/clip-note.directive.d.ts +1 -1
  10. package/currency-input/currency-input.directive.d.ts +1 -1
  11. package/decimal-input/decimal-input.directive.d.ts +1 -1
  12. package/discrete-input/discrete-input.component.d.ts +1 -1
  13. package/esm2022/alert/alert-container.component.mjs +207 -0
  14. package/esm2022/alert/alert-message.component.mjs +101 -0
  15. package/esm2022/alert/alert.module.mjs +22 -0
  16. package/{esm2020 → esm2022}/alert/public-api.mjs +1 -1
  17. package/esm2022/alert/testing/test-api.mjs +44 -0
  18. package/{esm2020 → esm2022}/behavior/await.directive.mjs +6 -6
  19. package/esm2022/behavior/behavior.module.mjs +37 -0
  20. package/{esm2020 → esm2022}/behavior/observe-content-class.directive.mjs +5 -5
  21. package/{esm2020 → esm2022}/behavior/public-api.mjs +1 -1
  22. package/esm2022/behavior/sizing-monitor.directive.mjs +31 -0
  23. package/esm2022/behavior/sizing.directive.mjs +256 -0
  24. package/esm2022/clip-note/clip-note.component.mjs +216 -0
  25. package/esm2022/clip-note/clip-note.directive.mjs +141 -0
  26. package/esm2022/clip-note/clip-note.module.mjs +32 -0
  27. package/{esm2020 → esm2022}/clip-note/public-api.mjs +1 -1
  28. package/{esm2020 → esm2022}/common/common-utils.mjs +1 -1
  29. package/{esm2020 → esm2022}/common/common.module.mjs +7 -7
  30. package/{esm2020 → esm2022}/common/public-api.mjs +1 -1
  31. package/{esm2020 → esm2022}/currency-input/currency-input.directive.mjs +6 -6
  32. package/esm2022/currency-input/currency-input.module.mjs +19 -0
  33. package/{esm2020 → esm2022}/currency-input/public-api.mjs +1 -1
  34. package/{esm2020 → esm2022}/decimal-input/decimal-input.directive.mjs +9 -9
  35. package/{esm2020 → esm2022}/decimal-input/decimal-input.module.mjs +5 -5
  36. package/esm2022/discrete-input/discrete-input.component.mjs +337 -0
  37. package/esm2022/discrete-input/discrete-input.module.mjs +21 -0
  38. package/{esm2020 → esm2022}/discrete-input/public-api.mjs +1 -1
  39. package/esm2022/file-upload/file-upload.component.mjs +400 -0
  40. package/esm2022/file-upload/file-upload.module.mjs +44 -0
  41. package/esm2022/file-upload/file-upload.service.mjs +29 -0
  42. package/{esm2020 → esm2022}/file-upload/public-api.mjs +1 -1
  43. package/esm2022/form-field/form-field.component.mjs +82 -0
  44. package/esm2022/form-field/form-field.module.mjs +33 -0
  45. package/{esm2020 → esm2022}/form-field/public-api.mjs +1 -1
  46. package/esm2022/icon-font/icon-font.module.mjs +22 -0
  47. package/{esm2020 → esm2022}/icon-font/icon.directive.mjs +5 -5
  48. package/{esm2020 → esm2022}/icon-font/public-api.mjs +1 -1
  49. package/{esm2020 → esm2022}/icon-font/utilities.mjs +1 -1
  50. package/esm2022/panel/panel-section.component.mjs +41 -0
  51. package/esm2022/panel/panel.component.mjs +87 -0
  52. package/esm2022/panel/panel.module.mjs +23 -0
  53. package/{esm2020 → esm2022}/panel/public-api.mjs +1 -1
  54. package/esm2022/panel/tinted.directive.mjs +60 -0
  55. package/esm2022/phone-number/phone-number.directive.mjs +188 -0
  56. package/{esm2020 → esm2022}/phone-number/phone-number.module.mjs +5 -5
  57. package/{esm2020 → esm2022}/phone-number/phone-number.pipe.mjs +6 -6
  58. package/esm2022/phone-number/phone-number.validator.mjs +64 -0
  59. package/{esm2020 → esm2022}/phone-number/public-api.mjs +1 -1
  60. package/{esm2020 → esm2022}/public-api.mjs +1 -1
  61. package/esm2022/radio-panel/radio-panel-item.component.mjs +93 -0
  62. package/esm2022/radio-panel/radio-panel.component.mjs +81 -0
  63. package/{esm2020 → esm2022}/radio-panel/radio-panel.module.mjs +5 -5
  64. package/esm2022/radio-panel/testing/test-api.mjs +46 -0
  65. package/{esm2020 → esm2022}/selection-panel/public-api.mjs +1 -1
  66. package/esm2022/selection-panel/selection-panel-item.component.mjs +166 -0
  67. package/esm2022/selection-panel/selection-panel.directive.mjs +119 -0
  68. package/esm2022/selection-panel/selection-panel.module.mjs +23 -0
  69. package/{esm2020 → esm2022}/skeletons/public-api.mjs +1 -1
  70. package/esm2022/skeletons/skeleton-loader-presets.directive.mjs +83 -0
  71. package/{esm2020 → esm2022}/skeletons/skeleton-loader.component.mjs +5 -5
  72. package/esm2022/skeletons/skeletons.module.mjs +35 -0
  73. package/{esm2020 → esm2022}/stepper/public-api.mjs +1 -1
  74. package/{esm2020 → esm2022}/stepper/stepper-animation.mjs +1 -1
  75. package/esm2022/stepper/stepper.component.mjs +176 -0
  76. package/esm2022/stepper/stepper.module.mjs +52 -0
  77. package/{esm2020 → esm2022}/tooltip/public-api.mjs +1 -1
  78. package/esm2022/tooltip/tooltip.component.mjs +63 -0
  79. package/esm2022/tooltip/tooltip.directive.mjs +148 -0
  80. package/esm2022/tooltip/tooltip.module.mjs +25 -0
  81. package/{fesm2020 → fesm2022}/bravura-ui-alert-testing.mjs +2 -2
  82. package/fesm2022/bravura-ui-alert-testing.mjs.map +1 -0
  83. package/fesm2022/bravura-ui-alert.mjs +327 -0
  84. package/fesm2022/bravura-ui-alert.mjs.map +1 -0
  85. package/{fesm2020 → fesm2022}/bravura-ui-behavior.mjs +45 -45
  86. package/fesm2022/bravura-ui-behavior.mjs.map +1 -0
  87. package/{fesm2020 → fesm2022}/bravura-ui-clip-note.mjs +70 -70
  88. package/fesm2022/bravura-ui-clip-note.mjs.map +1 -0
  89. package/{fesm2020 → fesm2022}/bravura-ui-common.mjs +6 -6
  90. package/fesm2022/bravura-ui-common.mjs.map +1 -0
  91. package/{fesm2020 → fesm2022}/bravura-ui-currency-input.mjs +11 -11
  92. package/fesm2022/bravura-ui-currency-input.mjs.map +1 -0
  93. package/{fesm2020 → fesm2022}/bravura-ui-decimal-input.mjs +12 -12
  94. package/fesm2022/bravura-ui-decimal-input.mjs.map +1 -0
  95. package/{fesm2020 → fesm2022}/bravura-ui-discrete-input.mjs +48 -48
  96. package/fesm2022/bravura-ui-discrete-input.mjs.map +1 -0
  97. package/fesm2022/bravura-ui-file-upload.mjs +474 -0
  98. package/fesm2022/bravura-ui-file-upload.mjs.map +1 -0
  99. package/{fesm2020 → fesm2022}/bravura-ui-form-field.mjs +19 -19
  100. package/fesm2022/bravura-ui-form-field.mjs.map +1 -0
  101. package/{fesm2020 → fesm2022}/bravura-ui-icon-font.mjs +8 -8
  102. package/fesm2022/bravura-ui-icon-font.mjs.map +1 -0
  103. package/fesm2022/bravura-ui-panel.mjs +206 -0
  104. package/fesm2022/bravura-ui-panel.mjs.map +1 -0
  105. package/{fesm2020 → fesm2022}/bravura-ui-phone-number.mjs +30 -30
  106. package/fesm2022/bravura-ui-phone-number.mjs.map +1 -0
  107. package/{fesm2020 → fesm2022}/bravura-ui-radio-panel-testing.mjs +5 -6
  108. package/fesm2022/bravura-ui-radio-panel-testing.mjs.map +1 -0
  109. package/{fesm2020 → fesm2022}/bravura-ui-radio-panel.mjs +31 -31
  110. package/fesm2022/bravura-ui-radio-panel.mjs.map +1 -0
  111. package/fesm2022/bravura-ui-selection-panel.mjs +306 -0
  112. package/fesm2022/bravura-ui-selection-panel.mjs.map +1 -0
  113. package/{fesm2020 → fesm2022}/bravura-ui-skeletons.mjs +43 -43
  114. package/fesm2022/bravura-ui-skeletons.mjs.map +1 -0
  115. package/fesm2022/bravura-ui-stepper.mjs +251 -0
  116. package/fesm2022/bravura-ui-stepper.mjs.map +1 -0
  117. package/{fesm2020 → fesm2022}/bravura-ui-tooltip.mjs +32 -24
  118. package/fesm2022/bravura-ui-tooltip.mjs.map +1 -0
  119. package/fesm2022/bravura-ui.mjs.map +1 -0
  120. package/file-upload/file-upload.component.d.ts +1 -1
  121. package/form-field/form-field.component.d.ts +1 -1
  122. package/icon-font/icon.directive.d.ts +1 -1
  123. package/package.json +76 -120
  124. package/panel/panel.component.d.ts +1 -1
  125. package/panel/tinted.directive.d.ts +1 -1
  126. package/phone-number/phone-number.directive.d.ts +1 -1
  127. package/phone-number/phone-number.validator.d.ts +2 -2
  128. package/radio-panel/radio-panel-item.component.d.ts +1 -1
  129. package/radio-panel/radio-panel.component.d.ts +1 -1
  130. package/radio-panel/testing/test-api.d.ts +2 -3
  131. package/selection-panel/selection-panel-item.component.d.ts +1 -1
  132. package/selection-panel/selection-panel.directive.d.ts +1 -1
  133. package/skeletons/skeleton-loader-presets.directive.d.ts +3 -3
  134. package/stepper/stepper.component.d.ts +1 -1
  135. package/theme/_bui-card.scss +56 -56
  136. package/theme/_ui-theme.scss +112 -112
  137. package/theme/global-style-by-bootstrap.scss +3 -3
  138. package/theme/global-style-by-tailwind.scss +3 -3
  139. package/theme/scrollbar.scss +40 -40
  140. package/tooltip/tooltip.component.d.ts +2 -0
  141. package/tooltip/tooltip.directive.d.ts +3 -5
  142. package/esm2020/alert/alert-container.component.mjs +0 -207
  143. package/esm2020/alert/alert-message.component.mjs +0 -102
  144. package/esm2020/alert/alert.module.mjs +0 -22
  145. package/esm2020/alert/testing/test-api.mjs +0 -44
  146. package/esm2020/behavior/behavior.module.mjs +0 -37
  147. package/esm2020/behavior/sizing-monitor.directive.mjs +0 -31
  148. package/esm2020/behavior/sizing.directive.mjs +0 -256
  149. package/esm2020/clip-note/clip-note.component.mjs +0 -216
  150. package/esm2020/clip-note/clip-note.directive.mjs +0 -141
  151. package/esm2020/clip-note/clip-note.module.mjs +0 -32
  152. package/esm2020/currency-input/currency-input.module.mjs +0 -19
  153. package/esm2020/discrete-input/discrete-input.component.mjs +0 -337
  154. package/esm2020/discrete-input/discrete-input.module.mjs +0 -21
  155. package/esm2020/file-upload/file-upload.component.mjs +0 -400
  156. package/esm2020/file-upload/file-upload.module.mjs +0 -44
  157. package/esm2020/file-upload/file-upload.service.mjs +0 -29
  158. package/esm2020/form-field/form-field.component.mjs +0 -82
  159. package/esm2020/form-field/form-field.module.mjs +0 -33
  160. package/esm2020/icon-font/icon-font.module.mjs +0 -22
  161. package/esm2020/panel/panel-section.component.mjs +0 -41
  162. package/esm2020/panel/panel.component.mjs +0 -87
  163. package/esm2020/panel/panel.module.mjs +0 -23
  164. package/esm2020/panel/tinted.directive.mjs +0 -60
  165. package/esm2020/phone-number/phone-number.directive.mjs +0 -188
  166. package/esm2020/phone-number/phone-number.validator.mjs +0 -64
  167. package/esm2020/radio-panel/radio-panel-item.component.mjs +0 -93
  168. package/esm2020/radio-panel/radio-panel.component.mjs +0 -81
  169. package/esm2020/radio-panel/testing/test-api.mjs +0 -47
  170. package/esm2020/selection-panel/selection-panel-item.component.mjs +0 -166
  171. package/esm2020/selection-panel/selection-panel.directive.mjs +0 -119
  172. package/esm2020/selection-panel/selection-panel.module.mjs +0 -23
  173. package/esm2020/skeletons/skeleton-loader-presets.directive.mjs +0 -83
  174. package/esm2020/skeletons/skeletons.module.mjs +0 -35
  175. package/esm2020/stepper/stepper.component.mjs +0 -176
  176. package/esm2020/stepper/stepper.module.mjs +0 -52
  177. package/esm2020/tooltip/tooltip.component.mjs +0 -54
  178. package/esm2020/tooltip/tooltip.directive.mjs +0 -149
  179. package/esm2020/tooltip/tooltip.module.mjs +0 -25
  180. package/fesm2015/bravura-ui-alert-testing.mjs +0 -64
  181. package/fesm2015/bravura-ui-alert-testing.mjs.map +0 -1
  182. package/fesm2015/bravura-ui-alert.mjs +0 -340
  183. package/fesm2015/bravura-ui-alert.mjs.map +0 -1
  184. package/fesm2015/bravura-ui-behavior.mjs +0 -515
  185. package/fesm2015/bravura-ui-behavior.mjs.map +0 -1
  186. package/fesm2015/bravura-ui-clip-note.mjs +0 -393
  187. package/fesm2015/bravura-ui-clip-note.mjs.map +0 -1
  188. package/fesm2015/bravura-ui-common.mjs +0 -96
  189. package/fesm2015/bravura-ui-common.mjs.map +0 -1
  190. package/fesm2015/bravura-ui-currency-input.mjs +0 -300
  191. package/fesm2015/bravura-ui-currency-input.mjs.map +0 -1
  192. package/fesm2015/bravura-ui-decimal-input.mjs +0 -145
  193. package/fesm2015/bravura-ui-decimal-input.mjs.map +0 -1
  194. package/fesm2015/bravura-ui-discrete-input.mjs +0 -365
  195. package/fesm2015/bravura-ui-discrete-input.mjs.map +0 -1
  196. package/fesm2015/bravura-ui-file-upload.mjs +0 -478
  197. package/fesm2015/bravura-ui-file-upload.mjs.map +0 -1
  198. package/fesm2015/bravura-ui-form-field.mjs +0 -120
  199. package/fesm2015/bravura-ui-form-field.mjs.map +0 -1
  200. package/fesm2015/bravura-ui-icon-font.mjs +0 -178
  201. package/fesm2015/bravura-ui-icon-font.mjs.map +0 -1
  202. package/fesm2015/bravura-ui-panel.mjs +0 -210
  203. package/fesm2015/bravura-ui-panel.mjs.map +0 -1
  204. package/fesm2015/bravura-ui-phone-number.mjs +0 -327
  205. package/fesm2015/bravura-ui-phone-number.mjs.map +0 -1
  206. package/fesm2015/bravura-ui-radio-panel-testing.mjs +0 -63
  207. package/fesm2015/bravura-ui-radio-panel-testing.mjs.map +0 -1
  208. package/fesm2015/bravura-ui-radio-panel.mjs +0 -200
  209. package/fesm2015/bravura-ui-radio-panel.mjs.map +0 -1
  210. package/fesm2015/bravura-ui-selection-panel.mjs +0 -311
  211. package/fesm2015/bravura-ui-selection-panel.mjs.map +0 -1
  212. package/fesm2015/bravura-ui-skeletons.mjs +0 -195
  213. package/fesm2015/bravura-ui-skeletons.mjs.map +0 -1
  214. package/fesm2015/bravura-ui-stepper.mjs +0 -253
  215. package/fesm2015/bravura-ui-stepper.mjs.map +0 -1
  216. package/fesm2015/bravura-ui-tooltip.mjs +0 -229
  217. package/fesm2015/bravura-ui-tooltip.mjs.map +0 -1
  218. package/fesm2015/bravura-ui.mjs.map +0 -1
  219. package/fesm2020/bravura-ui-alert-testing.mjs.map +0 -1
  220. package/fesm2020/bravura-ui-alert.mjs +0 -328
  221. package/fesm2020/bravura-ui-alert.mjs.map +0 -1
  222. package/fesm2020/bravura-ui-behavior.mjs.map +0 -1
  223. package/fesm2020/bravura-ui-clip-note.mjs.map +0 -1
  224. package/fesm2020/bravura-ui-common.mjs.map +0 -1
  225. package/fesm2020/bravura-ui-currency-input.mjs.map +0 -1
  226. package/fesm2020/bravura-ui-decimal-input.mjs.map +0 -1
  227. package/fesm2020/bravura-ui-discrete-input.mjs.map +0 -1
  228. package/fesm2020/bravura-ui-file-upload.mjs +0 -474
  229. package/fesm2020/bravura-ui-file-upload.mjs.map +0 -1
  230. package/fesm2020/bravura-ui-form-field.mjs.map +0 -1
  231. package/fesm2020/bravura-ui-icon-font.mjs.map +0 -1
  232. package/fesm2020/bravura-ui-panel.mjs +0 -206
  233. package/fesm2020/bravura-ui-panel.mjs.map +0 -1
  234. package/fesm2020/bravura-ui-phone-number.mjs.map +0 -1
  235. package/fesm2020/bravura-ui-radio-panel-testing.mjs.map +0 -1
  236. package/fesm2020/bravura-ui-radio-panel.mjs.map +0 -1
  237. package/fesm2020/bravura-ui-selection-panel.mjs +0 -306
  238. package/fesm2020/bravura-ui-selection-panel.mjs.map +0 -1
  239. package/fesm2020/bravura-ui-skeletons.mjs.map +0 -1
  240. package/fesm2020/bravura-ui-stepper.mjs +0 -251
  241. package/fesm2020/bravura-ui-stepper.mjs.map +0 -1
  242. package/fesm2020/bravura-ui-tooltip.mjs.map +0 -1
  243. package/fesm2020/bravura-ui.mjs +0 -8
  244. package/fesm2020/bravura-ui.mjs.map +0 -1
  245. /package/{esm2020 → esm2022}/alert/bravura-ui-alert.mjs +0 -0
  246. /package/{esm2020 → esm2022}/alert/testing/bravura-ui-alert-testing.mjs +0 -0
  247. /package/{esm2020 → esm2022}/behavior/bravura-ui-behavior.mjs +0 -0
  248. /package/{esm2020 → esm2022}/bravura-ui.mjs +0 -0
  249. /package/{esm2020 → esm2022}/clip-note/bravura-ui-clip-note.mjs +0 -0
  250. /package/{esm2020 → esm2022}/common/bravura-ui-common.mjs +0 -0
  251. /package/{esm2020 → esm2022}/currency-input/bravura-ui-currency-input.mjs +0 -0
  252. /package/{esm2020 → esm2022}/decimal-input/bravura-ui-decimal-input.mjs +0 -0
  253. /package/{esm2020 → esm2022}/decimal-input/public-api.mjs +0 -0
  254. /package/{esm2020 → esm2022}/discrete-input/bravura-ui-discrete-input.mjs +0 -0
  255. /package/{esm2020 → esm2022}/file-upload/bravura-ui-file-upload.mjs +0 -0
  256. /package/{esm2020 → esm2022}/form-field/bravura-ui-form-field.mjs +0 -0
  257. /package/{esm2020 → esm2022}/icon-font/bravura-ui-icon-font.mjs +0 -0
  258. /package/{esm2020 → esm2022}/panel/bravura-ui-panel.mjs +0 -0
  259. /package/{esm2020 → esm2022}/phone-number/bravura-ui-phone-number.mjs +0 -0
  260. /package/{esm2020 → esm2022}/radio-panel/bravura-ui-radio-panel.mjs +0 -0
  261. /package/{esm2020 → esm2022}/radio-panel/public-api.mjs +0 -0
  262. /package/{esm2020 → esm2022}/radio-panel/testing/bravura-ui-radio-panel-testing.mjs +0 -0
  263. /package/{esm2020 → esm2022}/selection-panel/bravura-ui-selection-panel.mjs +0 -0
  264. /package/{esm2020 → esm2022}/skeletons/bravura-ui-skeletons.mjs +0 -0
  265. /package/{esm2020 → esm2022}/stepper/bravura-ui-stepper.mjs +0 -0
  266. /package/{esm2020 → esm2022}/tooltip/bravura-ui-tooltip.mjs +0 -0
  267. /package/{fesm2015 → fesm2022}/bravura-ui.mjs +0 -0
@@ -1,300 +0,0 @@
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, true, 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
- const val = input
217
- .replace(this._ds, 'd')
218
- .replace(/[^0-9d-]/g, '')
219
- .replace('d', '.');
220
- return parseFloat(val);
221
- }
222
- get _0Text() {
223
- const decimalStr = this.baseUnitOnly ? '' : `${this._ds}00`;
224
- return this._trailing ? `0${decimalStr} ${this._symbol}` : `${this._symbol}0${decimalStr}`;
225
- }
226
- }
227
- CurrencyInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", 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 });
228
- CurrencyInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.6", 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 });
229
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: CurrencyInputDirective, decorators: [{
230
- type: Directive,
231
- args: [{
232
- selector: 'input[buiCurrencyInput],input[currencyCode],input[data-type=currency]',
233
- providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CurrencyInputDirective), multi: true }]
234
- }]
235
- }], ctorParameters: function () {
236
- return [{ type: i0.ElementRef, decorators: [{
237
- type: Self
238
- }] }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
239
- type: Inject,
240
- args: [LOCALE_ID]
241
- }] }, { type: undefined, decorators: [{
242
- type: Inject,
243
- args: [DEFAULT_CURRENCY_CODE]
244
- }] }, { type: i1.MatFormField, decorators: [{
245
- type: Optional
246
- }, {
247
- type: Inject,
248
- args: [MAT_FORM_FIELD]
249
- }] }];
250
- }, propDecorators: { allowNegative: [{
251
- type: Input
252
- }], currencyCode: [{
253
- type: Input
254
- }], baseUnitOnly: [{
255
- type: Input
256
- }], format: [{
257
- type: Input
258
- }], placeholder: [{
259
- type: HostBinding,
260
- args: ['placeholder']
261
- }], autocomplete: [{
262
- type: HostBinding,
263
- args: ['autocomplete']
264
- }], type: [{
265
- type: HostBinding,
266
- args: ['type']
267
- }], inputMode: [{
268
- type: HostBinding,
269
- args: ['attr.inputmode']
270
- }], onInput: [{
271
- type: HostListener,
272
- args: ['input']
273
- }], onFocus: [{
274
- type: HostListener,
275
- args: ['focus']
276
- }], onblur: [{
277
- type: HostListener,
278
- args: ['blur']
279
- }] } });
280
-
281
- class CurrencyInputModule {
282
- }
283
- CurrencyInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: CurrencyInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
284
- CurrencyInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.6", ngImport: i0, type: CurrencyInputModule, declarations: [CurrencyInputDirective], imports: [CommonModule], exports: [CurrencyInputDirective] });
285
- CurrencyInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: CurrencyInputModule, imports: [CommonModule] });
286
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: CurrencyInputModule, decorators: [{
287
- type: NgModule,
288
- args: [{
289
- declarations: [CurrencyInputDirective],
290
- imports: [CommonModule],
291
- exports: [CurrencyInputDirective]
292
- }]
293
- }] });
294
-
295
- /**
296
- * Generated bundle index. Do not edit.
297
- */
298
-
299
- export { CurrencyInputDirective, CurrencyInputModule };
300
- //# sourceMappingURL=bravura-ui-currency-input.mjs.map
@@ -1 +0,0 @@
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, true, 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\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,CAAC;AAGd,QAAA,IAAS,CAAA,SAAA,GAAG,SAAS,CAAC;AAEtB,QAAA,IAAM,CAAA,MAAA,GAAG,aAAa,CAAC;AACvB,QAAA,IAAO,CAAA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;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;;;;"}
@@ -1,145 +0,0 @@
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
- const resolvedValue = this._el.nativeElement.value;
40
- this.change(resolvedValue === '' || resolvedValue === null || resolvedValue === undefined ? null : Number(resolvedValue));
41
- }
42
- onKeypress(evt) {
43
- const target = evt.target;
44
- const value = target.value;
45
- const isSpace = evt.key === ' ';
46
- if (isSpace ||
47
- (!['.', '-'].includes(evt.key) && isNaN(Number(evt.key))) ||
48
- (evt.key === '.' && value.indexOf('.') > 0)) {
49
- evt.preventDefault();
50
- }
51
- }
52
- onblur() {
53
- this.onTouch();
54
- this._resetDecimalPlaces();
55
- }
56
- writeValue(value) {
57
- this._renderer.setProperty(this._el.nativeElement, 'value', value);
58
- this._resetDecimalPlaces();
59
- }
60
- registerOnChange(fn) {
61
- this.change = fn;
62
- }
63
- registerOnTouched(fn) {
64
- this.onTouch = fn;
65
- }
66
- _resetDecimalPlaces() {
67
- const value = this._el.nativeElement.value;
68
- if (value === '' || value === null || value === undefined) {
69
- return;
70
- }
71
- const splitValues = value.split('.');
72
- let newValue = '';
73
- if (splitValues[1] && splitValues[1].length > this.buiDecimalInput) {
74
- newValue = value.substring(0, splitValues[0].length + 1 + this.buiDecimalInput);
75
- }
76
- else {
77
- this.buiDecimalInput = this.buiDecimalInput < 0 ? 0 : this.buiDecimalInput;
78
- newValue = Number(value).toFixed(this.buiDecimalInput);
79
- }
80
- this._renderer.setProperty(this._el.nativeElement, 'value', newValue);
81
- }
82
- }
83
- DecimalInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: DecimalInputDirective, deps: [{ token: i0.ElementRef, self: true }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
84
- DecimalInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.6", type: DecimalInputDirective, selector: "input[buiDecimalInput]", inputs: { buiDecimalInput: "buiDecimalInput" }, host: { listeners: { "input": "onInput()", "keypress": "onKeypress($event)", "blur": "onblur()" }, properties: { "placeholder": "this.placeholder", "autocomplete": "this.autocomplete", "type": "this.type", "attr.inputmode": "this.inputMode" } }, providers: [
85
- DecimalPipe,
86
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DecimalInputDirective), multi: true }
87
- ], usesOnChanges: true, ngImport: i0 });
88
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: DecimalInputDirective, decorators: [{
89
- type: Directive,
90
- args: [{
91
- selector: 'input[buiDecimalInput]',
92
- providers: [
93
- DecimalPipe,
94
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DecimalInputDirective), multi: true }
95
- ]
96
- }]
97
- }], ctorParameters: function () {
98
- return [{ type: i0.ElementRef, decorators: [{
99
- type: Self
100
- }] }, { type: i0.Renderer2 }];
101
- }, propDecorators: { buiDecimalInput: [{
102
- type: Input
103
- }], placeholder: [{
104
- type: HostBinding,
105
- args: ['placeholder']
106
- }], autocomplete: [{
107
- type: HostBinding,
108
- args: ['autocomplete']
109
- }], type: [{
110
- type: HostBinding,
111
- args: ['type']
112
- }], inputMode: [{
113
- type: HostBinding,
114
- args: ['attr.inputmode']
115
- }], onInput: [{
116
- type: HostListener,
117
- args: ['input']
118
- }], onKeypress: [{
119
- type: HostListener,
120
- args: ['keypress', ['$event']]
121
- }], onblur: [{
122
- type: HostListener,
123
- args: ['blur']
124
- }] } });
125
-
126
- class DecimalInputModule {
127
- }
128
- DecimalInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: DecimalInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
129
- DecimalInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.6", ngImport: i0, type: DecimalInputModule, declarations: [DecimalInputDirective], imports: [CommonModule], exports: [DecimalInputDirective] });
130
- DecimalInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: DecimalInputModule, imports: [CommonModule] });
131
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: DecimalInputModule, decorators: [{
132
- type: NgModule,
133
- args: [{
134
- declarations: [DecimalInputDirective],
135
- imports: [CommonModule],
136
- exports: [DecimalInputDirective]
137
- }]
138
- }] });
139
-
140
- /**
141
- * Generated bundle index. Do not edit.
142
- */
143
-
144
- export { DecimalInputDirective, DecimalInputModule };
145
- //# sourceMappingURL=bravura-ui-decimal-input.mjs.map
@@ -1 +0,0 @@
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\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\tconst resolvedValue = this._el.nativeElement.value;\n\t\tthis.change(\n\t\t\tresolvedValue === '' || resolvedValue === null || resolvedValue === undefined ? null : Number(resolvedValue)\n\t\t);\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('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\tthis._resetDecimalPlaces();\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,aAAa,GAAG,CAAC,CAAM,KAAM,GAAC,CAAC;AAE5C;;AAEG;MAQU,qBAAqB,CAAA;IAsBjC,WAA4B,CAAA,GAAiC,EAAU,SAAoB,EAAA;AAA/D,QAAA,IAAG,CAAA,GAAA,GAAH,GAAG,CAA8B;AAAU,QAAA,IAAS,CAAA,SAAA,GAAT,SAAS,CAAW;AArB3F;;AAEG;AAEH,QAAA,IAAe,CAAA,eAAA,GAAW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