@bravobit/bb-foundation 0.14.2 → 0.15.1

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 (413) hide show
  1. package/README.md +47 -47
  2. package/auth/bravobit-bb-foundation-auth.d.ts +5 -5
  3. package/auth/lib/auth.interceptor.d.ts +21 -21
  4. package/auth/lib/auth.module.d.ts +15 -15
  5. package/auth/lib/auth.service.d.ts +59 -59
  6. package/auth/lib/auth.session.d.ts +34 -34
  7. package/auth/lib/directives/authenticated.directive.d.ts +14 -14
  8. package/auth/lib/directives/permission.directive.d.ts +24 -24
  9. package/auth/lib/directives/role.directive.d.ts +16 -16
  10. package/auth/lib/guards/anonymous.guard.d.ts +11 -11
  11. package/auth/lib/guards/authenticated.guard.d.ts +11 -11
  12. package/auth/lib/helpers/jwt.helper.d.ts +8 -8
  13. package/auth/lib/helpers/mapper.helper.d.ts +23 -23
  14. package/auth/lib/interfaces/config.interface.d.ts +12 -12
  15. package/auth/lib/interfaces/mapper.interface.d.ts +19 -19
  16. package/auth/lib/interfaces/provider.interface.d.ts +16 -16
  17. package/auth/lib/interfaces/token.interface.d.ts +11 -11
  18. package/auth/lib/permissions.service.d.ts +14 -14
  19. package/auth/lib/providers/email.provider.d.ts +15 -15
  20. package/auth/lib/providers/verify.provider.d.ts +13 -13
  21. package/auth/lib/tokens/use-authorization.token.d.ts +2 -2
  22. package/auth/public_api.d.ts +18 -18
  23. package/bravobit-bb-foundation.d.ts +5 -5
  24. package/bundles/bravobit-bb-foundation-auth.umd.js +1400 -1402
  25. package/bundles/bravobit-bb-foundation-auth.umd.js.map +1 -1
  26. package/bundles/bravobit-bb-foundation-collections.umd.js +851 -0
  27. package/bundles/bravobit-bb-foundation-collections.umd.js.map +1 -0
  28. package/bundles/bravobit-bb-foundation-dashboard.umd.js +817 -819
  29. package/bundles/bravobit-bb-foundation-dashboard.umd.js.map +1 -1
  30. package/bundles/bravobit-bb-foundation-dialog.umd.js +649 -651
  31. package/bundles/bravobit-bb-foundation-dialog.umd.js.map +1 -1
  32. package/bundles/bravobit-bb-foundation-elements.umd.js +2651 -2653
  33. package/bundles/bravobit-bb-foundation-elements.umd.js.map +1 -1
  34. package/bundles/bravobit-bb-foundation-http.umd.js +488 -490
  35. package/bundles/bravobit-bb-foundation-http.umd.js.map +1 -1
  36. package/bundles/bravobit-bb-foundation-localize.umd.js +1208 -1210
  37. package/bundles/bravobit-bb-foundation-localize.umd.js.map +1 -1
  38. package/bundles/bravobit-bb-foundation-notifications.umd.js +743 -745
  39. package/bundles/bravobit-bb-foundation-notifications.umd.js.map +1 -1
  40. package/bundles/bravobit-bb-foundation-recaptcha.umd.js +640 -642
  41. package/bundles/bravobit-bb-foundation-recaptcha.umd.js.map +1 -1
  42. package/bundles/bravobit-bb-foundation-rxjs.umd.js +13 -13
  43. package/bundles/bravobit-bb-foundation-rxjs.umd.js.map +1 -1
  44. package/bundles/bravobit-bb-foundation-storage.umd.js +756 -758
  45. package/bundles/bravobit-bb-foundation-storage.umd.js.map +1 -1
  46. package/bundles/bravobit-bb-foundation-table.umd.js +993 -995
  47. package/bundles/bravobit-bb-foundation-table.umd.js.map +1 -1
  48. package/bundles/bravobit-bb-foundation.umd.js +1336 -1263
  49. package/bundles/bravobit-bb-foundation.umd.js.map +1 -1
  50. package/collections/bravobit-bb-foundation-collections.d.ts +5 -0
  51. package/collections/lib/collection.d.ts +40 -0
  52. package/collections/lib/collections.module.d.ts +10 -0
  53. package/collections/lib/components/collections-pager/collections-pager.component.d.ts +34 -0
  54. package/collections/lib/components/collections-viewer/collections-viewer.component.d.ts +12 -0
  55. package/collections/lib/components/collections.directive.d.ts +17 -0
  56. package/collections/lib/interfaces/collection.interface.d.ts +26 -0
  57. package/collections/lib/providers/api-collection.provider.d.ts +15 -0
  58. package/collections/lib/providers/collection.provider.d.ts +6 -0
  59. package/collections/lib/providers/local-collection.provider.d.ts +8 -0
  60. package/collections/package.json +10 -0
  61. package/collections/public_api.d.ts +9 -0
  62. package/dashboard/bravobit-bb-foundation-dashboard.d.ts +5 -5
  63. package/dashboard/lib/dashboard/dashboard.component.d.ts +19 -19
  64. package/dashboard/lib/dashboard-header/dashboard-header.component.d.ts +11 -11
  65. package/dashboard/lib/dashboard-menu/dashboard-menu.component.d.ts +9 -9
  66. package/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.d.ts +11 -11
  67. package/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.d.ts +21 -21
  68. package/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.d.ts +27 -27
  69. package/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.d.ts +16 -16
  70. package/dashboard/lib/dashboard.module.d.ts +16 -16
  71. package/dashboard/public_api.d.ts +8 -8
  72. package/dialog/bravobit-bb-foundation-dialog.d.ts +5 -5
  73. package/dialog/lib/dialog-actions/dialog-actions.component.d.ts +5 -5
  74. package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +16 -16
  75. package/dialog/lib/dialog-container/dialog-container.component.d.ts +24 -24
  76. package/dialog/lib/dialog-header/dialog-header.component.d.ts +9 -9
  77. package/dialog/lib/dialog-link/dialog-link.component.d.ts +5 -5
  78. package/dialog/lib/dialog-modal/dialog-modal.component.d.ts +12 -12
  79. package/dialog/lib/dialog-overlay/dialog-overlay.component.d.ts +22 -22
  80. package/dialog/lib/dialog.injector.d.ts +8 -8
  81. package/dialog/lib/dialog.insertion.d.ts +8 -8
  82. package/dialog/lib/dialog.interfaces.d.ts +3 -3
  83. package/dialog/lib/dialog.module.d.ts +19 -19
  84. package/dialog/lib/dialog.ref.d.ts +8 -8
  85. package/dialog/lib/dialog.service.d.ts +19 -19
  86. package/dialog/public_api.d.ts +9 -9
  87. package/elements/bravobit-bb-foundation-elements.d.ts +5 -5
  88. package/elements/lib/avatar/avatar.component.d.ts +25 -25
  89. package/elements/lib/button/button.component.d.ts +23 -23
  90. package/elements/lib/checkbox/checkbox.component.d.ts +27 -27
  91. package/elements/lib/date-picker/date-picker.component.d.ts +69 -69
  92. package/elements/lib/directives/addon.directive.d.ts +9 -9
  93. package/elements/lib/directives/autosize.directive.d.ts +18 -18
  94. package/elements/lib/directives/focus-trap.directive.d.ts +17 -17
  95. package/elements/lib/directives/focus.directive.d.ts +14 -14
  96. package/elements/lib/directives/form-submit.directive.d.ts +17 -17
  97. package/elements/lib/directives/input.directive.d.ts +38 -38
  98. package/elements/lib/directives/template.directive.d.ts +10 -10
  99. package/elements/lib/dropdown/dropdown.component.d.ts +21 -21
  100. package/elements/lib/elements.interfaces.d.ts +25 -25
  101. package/elements/lib/elements.module.d.ts +116 -116
  102. package/elements/lib/file-picker/file-picker.component.d.ts +49 -49
  103. package/elements/lib/form-control/form-control.component.d.ts +21 -21
  104. package/elements/lib/form-error/form-error.component.d.ts +29 -29
  105. package/elements/lib/form-group/form-group.component.d.ts +10 -10
  106. package/elements/lib/icon/icon.component.d.ts +22 -22
  107. package/elements/lib/image-picker/image-picker.component.d.ts +38 -38
  108. package/elements/lib/pipes/file-image.pipe.d.ts +13 -13
  109. package/elements/lib/pipes/file-size.pipe.d.ts +8 -8
  110. package/elements/lib/pipes/relative-time.pipe.d.ts +19 -19
  111. package/elements/lib/spinner/spinner.component.d.ts +12 -12
  112. package/elements/lib/tag/tag.component.d.ts +7 -7
  113. package/elements/public_api.d.ts +25 -25
  114. package/esm2015/auth/bravobit-bb-foundation-auth.js +4 -4
  115. package/esm2015/auth/lib/auth.interceptor.js +95 -95
  116. package/esm2015/auth/lib/auth.module.js +54 -54
  117. package/esm2015/auth/lib/auth.service.js +299 -299
  118. package/esm2015/auth/lib/auth.session.js +136 -136
  119. package/esm2015/auth/lib/directives/authenticated.directive.js +32 -32
  120. package/esm2015/auth/lib/directives/permission.directive.js +81 -81
  121. package/esm2015/auth/lib/directives/role.directive.js +38 -38
  122. package/esm2015/auth/lib/guards/anonymous.guard.js +35 -35
  123. package/esm2015/auth/lib/guards/authenticated.guard.js +36 -36
  124. package/esm2015/auth/lib/helpers/jwt.helper.js +69 -69
  125. package/esm2015/auth/lib/helpers/mapper.helper.js +35 -35
  126. package/esm2015/auth/lib/interfaces/config.interface.js +3 -3
  127. package/esm2015/auth/lib/interfaces/mapper.interface.js +2 -2
  128. package/esm2015/auth/lib/interfaces/provider.interface.js +2 -2
  129. package/esm2015/auth/lib/interfaces/token.interface.js +2 -2
  130. package/esm2015/auth/lib/permissions.service.js +58 -58
  131. package/esm2015/auth/lib/providers/email.provider.js +26 -26
  132. package/esm2015/auth/lib/providers/verify.provider.js +20 -20
  133. package/esm2015/auth/lib/tokens/use-authorization.token.js +3 -3
  134. package/esm2015/auth/public_api.js +19 -19
  135. package/esm2015/bravobit-bb-foundation.js +4 -4
  136. package/esm2015/collections/bravobit-bb-foundation-collections.js +5 -0
  137. package/esm2015/collections/lib/collection.js +88 -0
  138. package/esm2015/collections/lib/collections.module.js +54 -0
  139. package/esm2015/collections/lib/components/collections-pager/collections-pager.component.js +136 -0
  140. package/esm2015/collections/lib/components/collections-viewer/collections-viewer.component.js +39 -0
  141. package/esm2015/collections/lib/components/collections.directive.js +43 -0
  142. package/esm2015/collections/lib/interfaces/collection.interface.js +2 -0
  143. package/esm2015/collections/lib/providers/api-collection.provider.js +69 -0
  144. package/esm2015/collections/lib/providers/collection.provider.js +14 -0
  145. package/esm2015/collections/lib/providers/local-collection.provider.js +16 -0
  146. package/esm2015/collections/public_api.js +10 -0
  147. package/esm2015/dashboard/bravobit-bb-foundation-dashboard.js +4 -4
  148. package/esm2015/dashboard/lib/dashboard/dashboard.component.js +64 -64
  149. package/esm2015/dashboard/lib/dashboard-header/dashboard-header.component.js +41 -41
  150. package/esm2015/dashboard/lib/dashboard-menu/dashboard-menu.component.js +39 -39
  151. package/esm2015/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.js +38 -38
  152. package/esm2015/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.js +83 -83
  153. package/esm2015/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.js +110 -110
  154. package/esm2015/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.js +71 -71
  155. package/esm2015/dashboard/lib/dashboard.module.js +47 -47
  156. package/esm2015/dashboard/public_api.js +9 -9
  157. package/esm2015/dialog/bravobit-bb-foundation-dialog.js +4 -4
  158. package/esm2015/dialog/lib/dialog-actions/dialog-actions.component.js +20 -20
  159. package/esm2015/dialog/lib/dialog-confirm/dialog-confirm.component.js +45 -45
  160. package/esm2015/dialog/lib/dialog-container/dialog-container.component.js +162 -162
  161. package/esm2015/dialog/lib/dialog-header/dialog-header.component.js +33 -33
  162. package/esm2015/dialog/lib/dialog-link/dialog-link.component.js +19 -19
  163. package/esm2015/dialog/lib/dialog-modal/dialog-modal.component.js +54 -54
  164. package/esm2015/dialog/lib/dialog-overlay/dialog-overlay.component.js +143 -143
  165. package/esm2015/dialog/lib/dialog.injector.js +18 -18
  166. package/esm2015/dialog/lib/dialog.insertion.js +16 -16
  167. package/esm2015/dialog/lib/dialog.interfaces.js +3 -3
  168. package/esm2015/dialog/lib/dialog.module.js +74 -74
  169. package/esm2015/dialog/lib/dialog.ref.js +22 -22
  170. package/esm2015/dialog/lib/dialog.service.js +77 -77
  171. package/esm2015/dialog/public_api.js +10 -10
  172. package/esm2015/elements/bravobit-bb-foundation-elements.js +4 -4
  173. package/esm2015/elements/lib/avatar/avatar.component.js +151 -151
  174. package/esm2015/elements/lib/button/button.component.js +79 -79
  175. package/esm2015/elements/lib/checkbox/checkbox.component.js +83 -83
  176. package/esm2015/elements/lib/date-picker/date-picker.component.js +322 -322
  177. package/esm2015/elements/lib/directives/addon.directive.js +29 -29
  178. package/esm2015/elements/lib/directives/autosize.directive.js +74 -74
  179. package/esm2015/elements/lib/directives/focus-trap.directive.js +77 -77
  180. package/esm2015/elements/lib/directives/focus.directive.js +39 -39
  181. package/esm2015/elements/lib/directives/form-submit.directive.js +53 -53
  182. package/esm2015/elements/lib/directives/input.directive.js +139 -139
  183. package/esm2015/elements/lib/directives/template.directive.js +28 -28
  184. package/esm2015/elements/lib/dropdown/dropdown.component.js +111 -111
  185. package/esm2015/elements/lib/elements.interfaces.js +4 -4
  186. package/esm2015/elements/lib/elements.module.js +177 -177
  187. package/esm2015/elements/lib/file-picker/file-picker.component.js +247 -247
  188. package/esm2015/elements/lib/form-control/form-control.component.js +58 -58
  189. package/esm2015/elements/lib/form-error/form-error.component.js +116 -116
  190. package/esm2015/elements/lib/form-group/form-group.component.js +27 -27
  191. package/esm2015/elements/lib/icon/icon.component.js +110 -110
  192. package/esm2015/elements/lib/image-picker/image-picker.component.js +119 -119
  193. package/esm2015/elements/lib/pipes/file-image.pipe.js +45 -45
  194. package/esm2015/elements/lib/pipes/file-size.pipe.js +28 -28
  195. package/esm2015/elements/lib/pipes/relative-time.pipe.js +96 -96
  196. package/esm2015/elements/lib/spinner/spinner.component.js +34 -34
  197. package/esm2015/elements/lib/tag/tag.component.js +26 -26
  198. package/esm2015/elements/public_api.js +26 -26
  199. package/esm2015/http/bravobit-bb-foundation-http.js +4 -4
  200. package/esm2015/http/lib/classes/http.config.js +31 -31
  201. package/esm2015/http/lib/classes/http.error.js +21 -21
  202. package/esm2015/http/lib/http.interfaces.js +2 -2
  203. package/esm2015/http/lib/http.module.js +43 -43
  204. package/esm2015/http/lib/interceptors/base-url.interceptor.js +52 -52
  205. package/esm2015/http/lib/interceptors/error.interceptor.js +33 -33
  206. package/esm2015/http/public_api.js +7 -7
  207. package/esm2015/lib/core/coercions/boolean-coercion.js +4 -4
  208. package/esm2015/lib/core/miscellaneous/regex.js +5 -5
  209. package/esm2015/lib/core/miscellaneous/validator.js +86 -86
  210. package/esm2015/lib/core/mixins/can-disable.js +16 -16
  211. package/esm2015/lib/core/mixins/can-hide-errors.js +16 -16
  212. package/esm2015/lib/core/mixins/can-load.js +16 -16
  213. package/esm2015/lib/core/mixins/constructor.js +2 -2
  214. package/esm2015/lib/core/mixins/has-error.js +16 -16
  215. package/esm2015/lib/core/mixins/is-focused.js +16 -16
  216. package/esm2015/lib/core/mixins/is-grouped.js +16 -16
  217. package/esm2015/lib/core/mixins/is-readonly.js +16 -16
  218. package/esm2015/lib/core/mixins/is-required.js +16 -16
  219. package/esm2015/lib/core/services/clipboard.service.js +72 -0
  220. package/esm2015/lib/core/services/exif.service.js +168 -168
  221. package/esm2015/lib/core/services/file-loader.service.js +90 -90
  222. package/esm2015/lib/core/services/image-converter.service.js +130 -130
  223. package/esm2015/lib/core/services/languages.service.js +74 -74
  224. package/esm2015/lib/core/services/network.service.js +56 -56
  225. package/esm2015/lib/core/services/patch.service.js +65 -65
  226. package/esm2015/lib/core/services/platform.service.js +42 -42
  227. package/esm2015/lib/core/tokens/accept-language.token.js +3 -3
  228. package/esm2015/lib/core/tokens/base-url.token.js +3 -3
  229. package/esm2015/lib/core/tokens/cookie.token.js +3 -3
  230. package/esm2015/lib/core/tokens/location.token.js +6 -6
  231. package/esm2015/lib/core/tokens/navigator.token.js +6 -6
  232. package/esm2015/lib/core/tokens/window.token.js +12 -12
  233. package/esm2015/localize/bravobit-bb-foundation-localize.js +4 -4
  234. package/esm2015/localize/lib/functions/date.function.js +18 -18
  235. package/esm2015/localize/lib/functions/lowercase.function.js +13 -13
  236. package/esm2015/localize/lib/functions/uppercase.function.js +13 -13
  237. package/esm2015/localize/lib/handlers/missing.handler.js +17 -17
  238. package/esm2015/localize/lib/interfaces/config.interfaces.js +10 -10
  239. package/esm2015/localize/lib/interfaces/dictionary.interfaces.js +8 -8
  240. package/esm2015/localize/lib/interfaces/functions.interfaces.js +8 -8
  241. package/esm2015/localize/lib/interfaces/handlers.interfaces.js +2 -2
  242. package/esm2015/localize/lib/interfaces/options.interfaces.js +6 -6
  243. package/esm2015/localize/lib/localizations/dutch.localization.js +53 -53
  244. package/esm2015/localize/lib/localizations/english.localization.js +53 -53
  245. package/esm2015/localize/lib/localize.dictionary.js +137 -137
  246. package/esm2015/localize/lib/localize.module.js +69 -69
  247. package/esm2015/localize/lib/localize.pipe.js +49 -49
  248. package/esm2015/localize/lib/localize.service.js +282 -282
  249. package/esm2015/localize/lib/views/localize-string/localize-string.component.js +99 -99
  250. package/esm2015/localize/lib/views/localize-template-or-string.directive.js +28 -28
  251. package/esm2015/localize/lib/views/localize-template.directive.js +21 -21
  252. package/esm2015/localize/public_api.js +18 -18
  253. package/esm2015/notifications/bravobit-bb-foundation-notifications.js +4 -4
  254. package/esm2015/notifications/lib/notifications-item/notifications-item.component.js +108 -108
  255. package/esm2015/notifications/lib/notifications-list/notifications-list.component.js +56 -56
  256. package/esm2015/notifications/lib/notifications.animations.js +28 -28
  257. package/esm2015/notifications/lib/notifications.injector.js +18 -18
  258. package/esm2015/notifications/lib/notifications.interfaces.js +20 -20
  259. package/esm2015/notifications/lib/notifications.module.js +31 -31
  260. package/esm2015/notifications/lib/notifications.service.js +145 -145
  261. package/esm2015/notifications/public_api.js +4 -4
  262. package/esm2015/public_api.js +30 -29
  263. package/esm2015/recaptcha/bravobit-bb-foundation-recaptcha.js +4 -4
  264. package/esm2015/recaptcha/lib/recaptcha/recaptcha.component.js +199 -199
  265. package/esm2015/recaptcha/lib/recaptcha-loader.service.js +93 -93
  266. package/esm2015/recaptcha/lib/recaptcha.interface.js +3 -3
  267. package/esm2015/recaptcha/lib/recaptcha.module.js +27 -27
  268. package/esm2015/recaptcha/public_api.js +5 -5
  269. package/esm2015/rxjs/bravobit-bb-foundation-rxjs.js +4 -4
  270. package/esm2015/rxjs/lib/operators/combine-latest-map.operator.js +7 -7
  271. package/esm2015/rxjs/lib/operators/filter-nil.operator.js +5 -5
  272. package/esm2015/rxjs/public_api.js +3 -3
  273. package/esm2015/storage/bravobit-bb-foundation-storage.js +4 -4
  274. package/esm2015/storage/lib/interfaces/attributes.interface.js +2 -2
  275. package/esm2015/storage/lib/interfaces/memory.interface.js +2 -2
  276. package/esm2015/storage/lib/interfaces/strategy.interface.js +2 -2
  277. package/esm2015/storage/lib/storage.service.js +111 -111
  278. package/esm2015/storage/lib/strategies/cookie-storage.strategy.js +143 -143
  279. package/esm2015/storage/lib/strategies/memory-storage.strategy.js +56 -56
  280. package/esm2015/storage/lib/strategies/polyfill-storage.strategy.js +102 -102
  281. package/esm2015/storage/public_api.js +8 -8
  282. package/esm2015/table/bravobit-bb-foundation-table.js +4 -4
  283. package/esm2015/table/lib/components/table/table.component.js +183 -183
  284. package/esm2015/table/lib/components/table-cell/table-cell.component.js +19 -19
  285. package/esm2015/table/lib/components/table-header-cell/table-header-cell.component.js +141 -141
  286. package/esm2015/table/lib/components/table-pager/table-pager.component.js +146 -146
  287. package/esm2015/table/lib/data/datasource.data.js +32 -32
  288. package/esm2015/table/lib/data/generic.data.js +73 -73
  289. package/esm2015/table/lib/interfaces/datasource.interface.js +2 -2
  290. package/esm2015/table/lib/interfaces/table.interfaces.js +2 -2
  291. package/esm2015/table/lib/table.module.js +39 -39
  292. package/esm2015/table/public_api.js +10 -10
  293. package/fesm2015/bravobit-bb-foundation-auth.js +915 -915
  294. package/fesm2015/bravobit-bb-foundation-auth.js.map +1 -1
  295. package/fesm2015/bravobit-bb-foundation-collections.js +447 -0
  296. package/fesm2015/bravobit-bb-foundation-collections.js.map +1 -0
  297. package/fesm2015/bravobit-bb-foundation-dashboard.js +434 -434
  298. package/fesm2015/bravobit-bb-foundation-dashboard.js.map +1 -1
  299. package/fesm2015/bravobit-bb-foundation-dialog.js +603 -603
  300. package/fesm2015/bravobit-bb-foundation-dialog.js.map +1 -1
  301. package/fesm2015/bravobit-bb-foundation-elements.js +2076 -2076
  302. package/fesm2015/bravobit-bb-foundation-elements.js.map +1 -1
  303. package/fesm2015/bravobit-bb-foundation-http.js +154 -154
  304. package/fesm2015/bravobit-bb-foundation-http.js.map +1 -1
  305. package/fesm2015/bravobit-bb-foundation-localize.js +796 -796
  306. package/fesm2015/bravobit-bb-foundation-localize.js.map +1 -1
  307. package/fesm2015/bravobit-bb-foundation-notifications.js +364 -364
  308. package/fesm2015/bravobit-bb-foundation-notifications.js.map +1 -1
  309. package/fesm2015/bravobit-bb-foundation-recaptcha.js +297 -297
  310. package/fesm2015/bravobit-bb-foundation-recaptcha.js.map +1 -1
  311. package/fesm2015/bravobit-bb-foundation-rxjs.js +7 -7
  312. package/fesm2015/bravobit-bb-foundation-rxjs.js.map +1 -1
  313. package/fesm2015/bravobit-bb-foundation-storage.js +399 -399
  314. package/fesm2015/bravobit-bb-foundation-storage.js.map +1 -1
  315. package/fesm2015/bravobit-bb-foundation-table.js +578 -578
  316. package/fesm2015/bravobit-bb-foundation-table.js.map +1 -1
  317. package/fesm2015/bravobit-bb-foundation.js +854 -785
  318. package/fesm2015/bravobit-bb-foundation.js.map +1 -1
  319. package/http/bravobit-bb-foundation-http.d.ts +5 -5
  320. package/http/lib/classes/http.config.d.ts +9 -9
  321. package/http/lib/classes/http.error.d.ts +7 -7
  322. package/http/lib/http.interfaces.d.ts +12 -12
  323. package/http/lib/http.module.d.ts +15 -15
  324. package/http/lib/interceptors/base-url.interceptor.d.ts +15 -15
  325. package/http/lib/interceptors/error.interceptor.d.ts +11 -11
  326. package/http/public_api.d.ts +6 -6
  327. package/lib/core/coercions/boolean-coercion.d.ts +1 -1
  328. package/lib/core/miscellaneous/regex.d.ts +4 -4
  329. package/lib/core/miscellaneous/validator.d.ts +13 -13
  330. package/lib/core/mixins/can-disable.d.ts +6 -6
  331. package/lib/core/mixins/can-hide-errors.d.ts +6 -6
  332. package/lib/core/mixins/can-load.d.ts +6 -6
  333. package/lib/core/mixins/constructor.d.ts +1 -1
  334. package/lib/core/mixins/has-error.d.ts +6 -6
  335. package/lib/core/mixins/is-focused.d.ts +6 -6
  336. package/lib/core/mixins/is-grouped.d.ts +6 -6
  337. package/lib/core/mixins/is-readonly.d.ts +6 -6
  338. package/lib/core/mixins/is-required.d.ts +6 -6
  339. package/lib/core/services/clipboard.service.d.ts +18 -0
  340. package/lib/core/services/exif.service.d.ts +15 -15
  341. package/lib/core/services/file-loader.service.d.ts +13 -13
  342. package/lib/core/services/image-converter.service.d.ts +21 -21
  343. package/lib/core/services/languages.service.d.ts +16 -16
  344. package/lib/core/services/network.service.d.ts +14 -14
  345. package/lib/core/services/patch.service.d.ts +16 -16
  346. package/lib/core/services/platform.service.d.ts +18 -18
  347. package/lib/core/tokens/accept-language.token.d.ts +2 -2
  348. package/lib/core/tokens/base-url.token.d.ts +2 -2
  349. package/lib/core/tokens/cookie.token.d.ts +2 -2
  350. package/lib/core/tokens/location.token.d.ts +2 -2
  351. package/lib/core/tokens/navigator.token.d.ts +2 -2
  352. package/lib/core/tokens/window.token.d.ts +2 -2
  353. package/localize/bravobit-bb-foundation-localize.d.ts +5 -5
  354. package/localize/lib/functions/date.function.d.ts +5 -5
  355. package/localize/lib/functions/lowercase.function.d.ts +5 -5
  356. package/localize/lib/functions/uppercase.function.d.ts +5 -5
  357. package/localize/lib/handlers/missing.handler.d.ts +6 -6
  358. package/localize/lib/interfaces/config.interfaces.d.ts +8 -8
  359. package/localize/lib/interfaces/dictionary.interfaces.d.ts +12 -12
  360. package/localize/lib/interfaces/functions.interfaces.d.ts +9 -9
  361. package/localize/lib/interfaces/handlers.interfaces.d.ts +6 -6
  362. package/localize/lib/interfaces/options.interfaces.d.ts +10 -10
  363. package/localize/lib/localizations/dutch.localization.d.ts +51 -51
  364. package/localize/lib/localizations/english.localization.d.ts +51 -51
  365. package/localize/lib/localize.dictionary.d.ts +24 -24
  366. package/localize/lib/localize.module.d.ts +18 -18
  367. package/localize/lib/localize.pipe.d.ts +12 -12
  368. package/localize/lib/localize.service.d.ts +51 -51
  369. package/localize/lib/views/localize-string/localize-string.component.d.ts +23 -23
  370. package/localize/lib/views/localize-template-or-string.directive.d.ts +10 -10
  371. package/localize/lib/views/localize-template.directive.d.ts +9 -9
  372. package/localize/public_api.d.ts +17 -17
  373. package/notifications/bravobit-bb-foundation-notifications.d.ts +5 -5
  374. package/notifications/lib/notifications-item/notifications-item.component.d.ts +34 -34
  375. package/notifications/lib/notifications-list/notifications-list.component.d.ts +16 -16
  376. package/notifications/lib/notifications.animations.d.ts +1 -1
  377. package/notifications/lib/notifications.injector.d.ts +8 -8
  378. package/notifications/lib/notifications.interfaces.d.ts +49 -49
  379. package/notifications/lib/notifications.module.d.ts +13 -13
  380. package/notifications/lib/notifications.service.d.ts +34 -34
  381. package/notifications/public_api.d.ts +3 -3
  382. package/package.json +5 -5
  383. package/public_api.d.ts +26 -25
  384. package/recaptcha/bravobit-bb-foundation-recaptcha.d.ts +5 -5
  385. package/recaptcha/lib/recaptcha/recaptcha.component.d.ts +47 -47
  386. package/recaptcha/lib/recaptcha-loader.service.d.ts +22 -22
  387. package/recaptcha/lib/recaptcha.interface.d.ts +14 -14
  388. package/recaptcha/lib/recaptcha.module.d.ts +10 -10
  389. package/recaptcha/public_api.d.ts +4 -4
  390. package/rxjs/bravobit-bb-foundation-rxjs.d.ts +5 -5
  391. package/rxjs/lib/operators/combine-latest-map.operator.d.ts +8 -8
  392. package/rxjs/lib/operators/filter-nil.operator.d.ts +1 -1
  393. package/rxjs/public_api.d.ts +2 -2
  394. package/storage/bravobit-bb-foundation-storage.d.ts +5 -5
  395. package/storage/lib/interfaces/attributes.interface.d.ts +13 -13
  396. package/storage/lib/interfaces/memory.interface.d.ts +7 -7
  397. package/storage/lib/interfaces/strategy.interface.d.ts +17 -17
  398. package/storage/lib/storage.service.d.ts +26 -26
  399. package/storage/lib/strategies/cookie-storage.strategy.d.ts +20 -20
  400. package/storage/lib/strategies/memory-storage.strategy.d.ts +11 -11
  401. package/storage/lib/strategies/polyfill-storage.strategy.d.ts +15 -15
  402. package/storage/public_api.d.ts +7 -7
  403. package/table/bravobit-bb-foundation-table.d.ts +5 -5
  404. package/table/lib/components/table/table.component.d.ts +48 -48
  405. package/table/lib/components/table-cell/table-cell.component.d.ts +5 -5
  406. package/table/lib/components/table-header-cell/table-header-cell.component.d.ts +29 -29
  407. package/table/lib/components/table-pager/table-pager.component.d.ts +41 -41
  408. package/table/lib/data/datasource.data.d.ts +14 -14
  409. package/table/lib/data/generic.data.d.ts +23 -23
  410. package/table/lib/interfaces/datasource.interface.d.ts +17 -17
  411. package/table/lib/interfaces/table.interfaces.d.ts +1 -1
  412. package/table/lib/table.module.d.ts +14 -14
  413. package/table/public_api.d.ts +9 -9
@@ -14,836 +14,836 @@ import * as i3 from '@bravobit/bb-foundation';
14
14
  import { LOCATION, BASE_URL } from '@bravobit/bb-foundation';
15
15
  import * as i2 from '@bravobit/bb-foundation/storage';
16
16
 
17
- //
18
- // The configuration that can be passed when
19
- // the user initializes the localize module.
20
- //
21
- class LocalizeConfig {
22
- constructor() {
23
- this.dictionary = [];
24
- }
17
+ //
18
+ // The configuration that can be passed when
19
+ // the user initializes the localize module.
20
+ //
21
+ class LocalizeConfig {
22
+ constructor() {
23
+ this.dictionary = [];
24
+ }
25
25
  }
26
26
 
27
27
  //
28
28
 
29
- //
30
- // This is the injection token that will be injected
31
- // into the service so that the all localize functions
32
- // can retrieved and used.
33
- //
29
+ //
30
+ // This is the injection token that will be injected
31
+ // into the service so that the all localize functions
32
+ // can retrieved and used.
33
+ //
34
34
  const LOCALIZE_FUNCTION = new InjectionToken('localize_function');
35
35
 
36
- //
37
- // This is the injection token that will be injected
38
- // into the service so that the all extra dictionaries
39
- // can retrieved and used.
40
- //
36
+ //
37
+ // This is the injection token that will be injected
38
+ // into the service so that the all extra dictionaries
39
+ // can retrieved and used.
40
+ //
41
41
  const LOCALIZE_EXTRA_DICTIONARY = new InjectionToken('localize_extra_dictionary');
42
42
 
43
- //
44
- // This function transform the value
45
- // to a lowercase variant of the value.
46
- //
47
- class LocalizeLowercaseFunction {
48
- keyword() {
49
- return 'lowercase';
50
- }
51
- transform(value) {
52
- return (value || '').toLowerCase();
53
- }
43
+ //
44
+ // This function transform the value
45
+ // to a lowercase variant of the value.
46
+ //
47
+ class LocalizeLowercaseFunction {
48
+ keyword() {
49
+ return 'lowercase';
50
+ }
51
+ transform(value) {
52
+ return (value || '').toLowerCase();
53
+ }
54
54
  }
55
55
 
56
- //
57
- // This function transform the value
58
- // to a uppercase variant of the value.
59
- //
60
- class LocalizeUppercaseFunction {
61
- keyword() {
62
- return 'uppercase';
63
- }
64
- transform(value) {
65
- return (value || '').toUpperCase();
66
- }
56
+ //
57
+ // This function transform the value
58
+ // to a uppercase variant of the value.
59
+ //
60
+ class LocalizeUppercaseFunction {
61
+ keyword() {
62
+ return 'uppercase';
63
+ }
64
+ transform(value) {
65
+ return (value || '').toUpperCase();
66
+ }
67
67
  }
68
68
 
69
- //
70
- // This function transform the value
71
- // to a localized date.
72
- //
73
- class LocalizeDateFunction {
74
- keyword() {
75
- return 'date';
76
- }
77
- transform(value, locale) {
78
- const date = new Date(value);
79
- if (date.toString() === 'Invalid Date') {
80
- return '?';
81
- }
82
- return formatDate(date, 'longDate', locale);
83
- }
69
+ //
70
+ // This function transform the value
71
+ // to a localized date.
72
+ //
73
+ class LocalizeDateFunction {
74
+ keyword() {
75
+ return 'date';
76
+ }
77
+ transform(value, locale) {
78
+ const date = new Date(value);
79
+ if (date.toString() === 'Invalid Date') {
80
+ return '?';
81
+ }
82
+ return formatDate(date, 'longDate', locale);
83
+ }
84
84
  }
85
85
 
86
- const LOCALIZATION_EXTRA_ENGLISH = {
87
- provide: LOCALIZE_EXTRA_DICTIONARY,
88
- useValue: {
89
- locale: 'en-US',
90
- data: {
91
- 'form-control-errors': {
92
- 'unknown': 'The field has an unknown error.',
93
- 'required': 'This field is required.',
94
- 'pattern': 'Invalid format.',
95
- 'email': 'The field does not match a valid email address.',
96
- 'emailTaken': 'The e-mail is already taken.',
97
- 'passwordMatch': 'The passwords don\'t match.',
98
- 'confirm': 'The field does not match.',
99
- 'fullNumber': 'The field should be a full number.',
100
- 'min': 'Minimum amount should be {{min}}.',
101
- 'max': 'Maximum amount should be {{max}}.',
102
- 'invalidFileType': 'The file type is not allowed.',
103
- 'maxFileSize': 'The file has exceed the maximum amount of {{maxSize}}.',
104
- 'minDate': 'The first accepted date is {{date|date}}.',
105
- 'maxDate': 'The last accepted date is {{date|date}}.',
106
- 'invalidDate': 'The field contains an invalid date.',
107
- 'minlength': 'Expected a minimum of {{requiredLength}} characters but got {{actualLength}} characters.',
108
- 'maxlength': 'Expected a maximum of {{requiredLength}} characters but got {{actualLength}} characters.'
109
- },
110
- 'tables': {
111
- 'search': 'Search...',
112
- 'loading': 'Loading...',
113
- 'empty': 'There is nothing to find here.',
114
- 'page': 'page',
115
- 'error_datasource': 'No data source was provided.',
116
- 'error_unauthorized': 'You need to be authenticated to view this data.',
117
- 'error_forbidden': 'You do not have access to view this data.',
118
- 'error_not_found': 'The data was not found.',
119
- 'error_server': 'A server error occurred while fetching data from the server.',
120
- 'error_down': 'It looks like the server is down.',
121
- 'error_unknown': 'A unknown error occurred.'
122
- },
123
- 'file-picker': {
124
- 'choose': 'Choose file',
125
- 'remove': 'Remove file',
126
- 'drop': 'or drag and drop file here'
127
- },
128
- 'times': {
129
- 'tomorrow_at': 'Tomorrow at {{date}}',
130
- 'today_at': 'Today at {{date}}',
131
- 'yesterday_at': 'Yesterday at {{date}}'
132
- }
133
- }
134
- },
135
- multi: true
86
+ const LOCALIZATION_EXTRA_ENGLISH = {
87
+ provide: LOCALIZE_EXTRA_DICTIONARY,
88
+ useValue: {
89
+ locale: 'en-US',
90
+ data: {
91
+ 'form-control-errors': {
92
+ 'unknown': 'The field has an unknown error.',
93
+ 'required': 'This field is required.',
94
+ 'pattern': 'Invalid format.',
95
+ 'email': 'The field does not match a valid email address.',
96
+ 'emailTaken': 'The e-mail is already taken.',
97
+ 'passwordMatch': 'The passwords don\'t match.',
98
+ 'confirm': 'The field does not match.',
99
+ 'fullNumber': 'The field should be a full number.',
100
+ 'min': 'Minimum amount should be {{min}}.',
101
+ 'max': 'Maximum amount should be {{max}}.',
102
+ 'invalidFileType': 'The file type is not allowed.',
103
+ 'maxFileSize': 'The file has exceed the maximum amount of {{maxSize}}.',
104
+ 'minDate': 'The first accepted date is {{date|date}}.',
105
+ 'maxDate': 'The last accepted date is {{date|date}}.',
106
+ 'invalidDate': 'The field contains an invalid date.',
107
+ 'minlength': 'Expected a minimum of {{requiredLength}} characters but got {{actualLength}} characters.',
108
+ 'maxlength': 'Expected a maximum of {{requiredLength}} characters but got {{actualLength}} characters.'
109
+ },
110
+ 'tables': {
111
+ 'search': 'Search...',
112
+ 'loading': 'Loading...',
113
+ 'empty': 'There is nothing to find here.',
114
+ 'page': 'page',
115
+ 'error_datasource': 'No data source was provided.',
116
+ 'error_unauthorized': 'You need to be authenticated to view this data.',
117
+ 'error_forbidden': 'You do not have access to view this data.',
118
+ 'error_not_found': 'The data was not found.',
119
+ 'error_server': 'A server error occurred while fetching data from the server.',
120
+ 'error_down': 'It looks like the server is down.',
121
+ 'error_unknown': 'A unknown error occurred.'
122
+ },
123
+ 'file-picker': {
124
+ 'choose': 'Choose file',
125
+ 'remove': 'Remove file',
126
+ 'drop': 'or drag and drop file here'
127
+ },
128
+ 'times': {
129
+ 'tomorrow_at': 'Tomorrow at {{date}}',
130
+ 'today_at': 'Today at {{date}}',
131
+ 'yesterday_at': 'Yesterday at {{date}}'
132
+ }
133
+ }
134
+ },
135
+ multi: true
136
136
  };
137
137
 
138
- const LOCALIZATION_EXTRA_DUTCH = {
139
- provide: LOCALIZE_EXTRA_DICTIONARY,
140
- useValue: {
141
- locale: 'nl-NL',
142
- data: {
143
- 'form-control-errors': {
144
- 'unknown': 'Het veld heeft een onbekende fout.',
145
- 'required': 'Dit veld is verplicht.',
146
- 'pattern': 'Ongeldig formaat.',
147
- 'email': 'Het veld komt niet overeen met een geldig e-mailadres.',
148
- 'emailTaken': 'Het e-mailadres is al bezet.',
149
- 'passwordMatch': 'De wachtwoorden komen niet overeen.',
150
- 'confirm': 'Het veld komt niet overeen.',
151
- 'fullNumber': 'Het veld moet een volledig getal zijn.',
152
- 'min': 'Minimum hoeveelheid moet {{min}} zijn.',
153
- 'max': 'Maximum hoeveelheid moet {{max}} zijn.',
154
- 'invalidFileType': 'Het type bestand is niet toegestaan.',
155
- 'maxFileSize': 'Het bestand heeft de maximum hoeveelheid van {{maxSize}} overschreden.',
156
- 'minDate': 'De eerst mogelijke datum is {{date|date}}.',
157
- 'maxDate': 'De laatst mogelijke datum is {{date|date}}.',
158
- 'invalidDate': 'Het veld bevat een ongeldige datum.',
159
- 'minlength': 'Verwachtte minimaal {{requiredLength}} tekens, maar kreeg {{actualLength}} tekens.',
160
- 'maxlength': 'Verwachtte maximaal {{requiredLength}} tekens, maar kreeg {{actualLength}} tekens.'
161
- },
162
- 'tables': {
163
- 'search': 'Zoeken...',
164
- 'loading': 'Aan het laden...',
165
- 'empty': 'Er is hier niets te vinden.',
166
- 'page': 'pagina',
167
- 'error_datasource': 'Er is geen gegevensbron verstrekt.',
168
- 'error_unauthorized': 'U moet ingelogd zijn om deze gegevens te bekijken.',
169
- 'error_forbidden': 'U hebt geen toegang om deze gegevens te bekijken.',
170
- 'error_not_found': 'De gegevens zijn niet gevonden.',
171
- 'error_server': 'Er is een serverfout opgetreden bij het ophalen van gegevens van de server.',
172
- 'error_down': 'Het lijkt erop dat de server down is.',
173
- 'error_unknown': 'Er is een onbekende fout opgetreden bij het ophalen van gegevens van de server.'
174
- },
175
- 'file-picker': {
176
- 'choose': 'Kies bestand',
177
- 'remove': 'Verwijder bestand',
178
- 'drop': 'of sleep het bestand hiernaartoe'
179
- },
180
- 'times': {
181
- 'tomorrow_at': 'Morgen om {{date}}',
182
- 'today_at': 'Vandaag om {{date}}',
183
- 'yesterday_at': 'Gisteren om {{date}}'
184
- }
185
- }
186
- },
187
- multi: true
138
+ const LOCALIZATION_EXTRA_DUTCH = {
139
+ provide: LOCALIZE_EXTRA_DICTIONARY,
140
+ useValue: {
141
+ locale: 'nl-NL',
142
+ data: {
143
+ 'form-control-errors': {
144
+ 'unknown': 'Het veld heeft een onbekende fout.',
145
+ 'required': 'Dit veld is verplicht.',
146
+ 'pattern': 'Ongeldig formaat.',
147
+ 'email': 'Het veld komt niet overeen met een geldig e-mailadres.',
148
+ 'emailTaken': 'Het e-mailadres is al bezet.',
149
+ 'passwordMatch': 'De wachtwoorden komen niet overeen.',
150
+ 'confirm': 'Het veld komt niet overeen.',
151
+ 'fullNumber': 'Het veld moet een volledig getal zijn.',
152
+ 'min': 'Minimum hoeveelheid moet {{min}} zijn.',
153
+ 'max': 'Maximum hoeveelheid moet {{max}} zijn.',
154
+ 'invalidFileType': 'Het type bestand is niet toegestaan.',
155
+ 'maxFileSize': 'Het bestand heeft de maximum hoeveelheid van {{maxSize}} overschreden.',
156
+ 'minDate': 'De eerst mogelijke datum is {{date|date}}.',
157
+ 'maxDate': 'De laatst mogelijke datum is {{date|date}}.',
158
+ 'invalidDate': 'Het veld bevat een ongeldige datum.',
159
+ 'minlength': 'Verwachtte minimaal {{requiredLength}} tekens, maar kreeg {{actualLength}} tekens.',
160
+ 'maxlength': 'Verwachtte maximaal {{requiredLength}} tekens, maar kreeg {{actualLength}} tekens.'
161
+ },
162
+ 'tables': {
163
+ 'search': 'Zoeken...',
164
+ 'loading': 'Aan het laden...',
165
+ 'empty': 'Er is hier niets te vinden.',
166
+ 'page': 'pagina',
167
+ 'error_datasource': 'Er is geen gegevensbron verstrekt.',
168
+ 'error_unauthorized': 'U moet ingelogd zijn om deze gegevens te bekijken.',
169
+ 'error_forbidden': 'U hebt geen toegang om deze gegevens te bekijken.',
170
+ 'error_not_found': 'De gegevens zijn niet gevonden.',
171
+ 'error_server': 'Er is een serverfout opgetreden bij het ophalen van gegevens van de server.',
172
+ 'error_down': 'Het lijkt erop dat de server down is.',
173
+ 'error_unknown': 'Er is een onbekende fout opgetreden bij het ophalen van gegevens van de server.'
174
+ },
175
+ 'file-picker': {
176
+ 'choose': 'Kies bestand',
177
+ 'remove': 'Verwijder bestand',
178
+ 'drop': 'of sleep het bestand hiernaartoe'
179
+ },
180
+ 'times': {
181
+ 'tomorrow_at': 'Morgen om {{date}}',
182
+ 'today_at': 'Vandaag om {{date}}',
183
+ 'yesterday_at': 'Gisteren om {{date}}'
184
+ }
185
+ }
186
+ },
187
+ multi: true
188
188
  };
189
189
 
190
- class LocalizeMissingHandler {
191
- constructor() {
192
- this.log = (message) => {
193
- console && console.warn && console.warn(message);
194
- };
195
- }
196
- handle(params) {
197
- // Log to the console when the token was not found
198
- // if the user did not mark it as optional.
199
- if (!params.optional) {
200
- this.log(`Localize: The token with name: "${params.token}" was not found.`);
201
- }
202
- // Return the default token back.
203
- return params.token;
204
- }
190
+ class LocalizeMissingHandler {
191
+ constructor() {
192
+ this.log = (message) => {
193
+ console && console.warn && console.warn(message);
194
+ };
195
+ }
196
+ handle(params) {
197
+ // Log to the console when the token was not found
198
+ // if the user did not mark it as optional.
199
+ if (!params.optional) {
200
+ this.log(`Localize: The token with name: "${params.token}" was not found.`);
201
+ }
202
+ // Return the default token back.
203
+ return params.token;
204
+ }
205
205
  }
206
206
 
207
- class BbLocalizeTemplate {
208
- constructor(templateRef) {
209
- this.templateRef = templateRef;
210
- // Inputs.
211
- this.name = null;
212
- }
213
- }
214
- BbLocalizeTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: BbLocalizeTemplate, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
215
- BbLocalizeTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.4", type: BbLocalizeTemplate, selector: "[bbLocalizeTemplate]", inputs: { name: ["bbLocalizeTemplate", "name"] }, ngImport: i0 });
216
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: BbLocalizeTemplate, decorators: [{
217
- type: Directive,
218
- args: [{
219
- selector: '[bbLocalizeTemplate]'
220
- }]
221
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { name: [{
222
- type: Input,
223
- args: ['bbLocalizeTemplate']
207
+ class BbLocalizeTemplate {
208
+ constructor(templateRef) {
209
+ this.templateRef = templateRef;
210
+ // Inputs.
211
+ this.name = null;
212
+ }
213
+ }
214
+ BbLocalizeTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbLocalizeTemplate, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
215
+ BbLocalizeTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: BbLocalizeTemplate, selector: "[bbLocalizeTemplate]", inputs: { name: ["bbLocalizeTemplate", "name"] }, ngImport: i0 });
216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbLocalizeTemplate, decorators: [{
217
+ type: Directive,
218
+ args: [{
219
+ selector: '[bbLocalizeTemplate]'
220
+ }]
221
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { name: [{
222
+ type: Input,
223
+ args: ['bbLocalizeTemplate']
224
224
  }] } });
225
225
 
226
- class BbLocalizeTemplateOrString {
227
- constructor(_templateRef, _viewContainerRef) {
228
- this._templateRef = _templateRef;
229
- this._viewContainerRef = _viewContainerRef;
230
- }
231
- set bbLocalizeTemplateOrString(content) {
232
- // Get the template.
233
- const template = content instanceof TemplateRef
234
- ? content
235
- : this._templateRef;
236
- // Clear the view container ref and create the view.
237
- this._viewContainerRef.clear();
238
- this._viewContainerRef.createEmbeddedView(template);
239
- }
240
- }
241
- BbLocalizeTemplateOrString.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: BbLocalizeTemplateOrString, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
242
- BbLocalizeTemplateOrString.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.4", type: BbLocalizeTemplateOrString, selector: "[bbLocalizeTemplateOrString]", inputs: { bbLocalizeTemplateOrString: "bbLocalizeTemplateOrString" }, ngImport: i0 });
243
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: BbLocalizeTemplateOrString, decorators: [{
244
- type: Directive,
245
- args: [{
246
- selector: '[bbLocalizeTemplateOrString]'
247
- }]
248
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbLocalizeTemplateOrString: [{
249
- type: Input
226
+ class BbLocalizeTemplateOrString {
227
+ constructor(_templateRef, _viewContainerRef) {
228
+ this._templateRef = _templateRef;
229
+ this._viewContainerRef = _viewContainerRef;
230
+ }
231
+ set bbLocalizeTemplateOrString(content) {
232
+ // Get the template.
233
+ const template = content instanceof TemplateRef
234
+ ? content
235
+ : this._templateRef;
236
+ // Clear the view container ref and create the view.
237
+ this._viewContainerRef.clear();
238
+ this._viewContainerRef.createEmbeddedView(template);
239
+ }
240
+ }
241
+ BbLocalizeTemplateOrString.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbLocalizeTemplateOrString, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
242
+ BbLocalizeTemplateOrString.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: BbLocalizeTemplateOrString, selector: "[bbLocalizeTemplateOrString]", inputs: { bbLocalizeTemplateOrString: "bbLocalizeTemplateOrString" }, ngImport: i0 });
243
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbLocalizeTemplateOrString, decorators: [{
244
+ type: Directive,
245
+ args: [{
246
+ selector: '[bbLocalizeTemplateOrString]'
247
+ }]
248
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbLocalizeTemplateOrString: [{
249
+ type: Input
250
250
  }] } });
251
251
 
252
- class BbLocalizeString {
253
- constructor(_changeDetection) {
254
- this._changeDetection = _changeDetection;
255
- // Inputs.
256
- this.substitutions = ['[', ']'];
257
- // Data.
258
- this.components = [];
259
- // Subscriptions.
260
- this._subscription = new Subscription();
261
- // State.
262
- this._value = null;
263
- }
264
- set value(value) {
265
- this._value = value;
266
- this.revalidate();
267
- }
268
- get value() {
269
- return this._value;
270
- }
271
- ngAfterViewInit() {
272
- this.observeItemChanges();
273
- }
274
- ngOnDestroy() {
275
- var _a;
276
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
277
- }
278
- observeItemChanges() {
279
- const subscription = this.items.changes.pipe(startWith(0)).subscribe(() => this.revalidate());
280
- this._subscription.add(subscription);
281
- }
282
- revalidate() {
283
- var _a, _b;
284
- const items = (_b = (_a = this.items) === null || _a === void 0 ? void 0 : _a.toArray()) !== null && _b !== void 0 ? _b : [];
285
- if (items.length <= 0) {
286
- return;
287
- }
288
- this.setComponents(items);
289
- }
290
- setComponents(items) {
291
- const [start, end] = this.substitutions;
292
- const templates = items.reduce((previous, current) => {
293
- var _a, _b;
294
- const template = (_a = current === null || current === void 0 ? void 0 : current.templateRef) !== null && _a !== void 0 ? _a : null;
295
- const name = (_b = current === null || current === void 0 ? void 0 : current.name) !== null && _b !== void 0 ? _b : null;
296
- if (!template || !name) {
297
- return previous;
298
- }
299
- return Object.assign(Object.assign({}, previous), { [`${start}${name}${end}`]: template });
300
- }, {});
301
- this.components = this.getStringComponents(this._value)
302
- .map(component => { var _a, _b; return (_b = (_a = templates === null || templates === void 0 ? void 0 : templates[component]) !== null && _a !== void 0 ? _a : component) !== null && _b !== void 0 ? _b : null; })
303
- .filter(item => !!item);
304
- this._changeDetection.detectChanges();
305
- }
306
- getStringComponents(value) {
307
- const [start, end] = this.getSubstitutions();
308
- const regex = new RegExp(`(${start}[a-zA-Z]+${end})`, 'g');
309
- return value.split(regex);
310
- }
311
- getSubstitutions() {
312
- const [start, end] = this.substitutions;
313
- const escape = /[.*+?^${}()|[\]\\]/g;
314
- return [
315
- start.replace(escape, '\\$&'),
316
- end.replace(escape, '\\$&')
317
- ];
318
- }
319
- }
320
- BbLocalizeString.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: BbLocalizeString, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
321
- BbLocalizeString.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.4", type: BbLocalizeString, selector: "bb-localize-string", inputs: { substitutions: "substitutions", value: "value" }, host: { classAttribute: "bb-localize-string" }, queries: [{ propertyName: "items", predicate: BbLocalizeTemplate }], ngImport: i0, template: "<ng-container *ngFor=\"let component of components\">\r\n <ng-template [bbLocalizeTemplateOrString]=\"component\">{{ component }}</ng-template>\r\n</ng-container>\r\n", styles: [".bb-localize-string{display:inline}"], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: BbLocalizeTemplateOrString, selector: "[bbLocalizeTemplateOrString]", inputs: ["bbLocalizeTemplateOrString"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
322
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: BbLocalizeString, decorators: [{
323
- type: Component,
324
- args: [{
325
- selector: 'bb-localize-string',
326
- templateUrl: './localize-string.component.html',
327
- styleUrls: ['./localize-string.component.scss'],
328
- changeDetection: ChangeDetectionStrategy.OnPush,
329
- encapsulation: ViewEncapsulation.None,
330
- preserveWhitespaces: false,
331
- host: {
332
- 'class': 'bb-localize-string'
333
- }
334
- }]
335
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { items: [{
336
- type: ContentChildren,
337
- args: [BbLocalizeTemplate]
338
- }], substitutions: [{
339
- type: Input
340
- }], value: [{
341
- type: Input
252
+ class BbLocalizeString {
253
+ constructor(_changeDetection) {
254
+ this._changeDetection = _changeDetection;
255
+ // Inputs.
256
+ this.substitutions = ['[', ']'];
257
+ // Data.
258
+ this.components = [];
259
+ // Subscriptions.
260
+ this._subscription = new Subscription();
261
+ // State.
262
+ this._value = null;
263
+ }
264
+ set value(value) {
265
+ this._value = value;
266
+ this.revalidate();
267
+ }
268
+ get value() {
269
+ return this._value;
270
+ }
271
+ ngAfterViewInit() {
272
+ this.observeItemChanges();
273
+ }
274
+ ngOnDestroy() {
275
+ var _a;
276
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
277
+ }
278
+ observeItemChanges() {
279
+ const subscription = this.items.changes.pipe(startWith(0)).subscribe(() => this.revalidate());
280
+ this._subscription.add(subscription);
281
+ }
282
+ revalidate() {
283
+ var _a, _b;
284
+ const items = (_b = (_a = this.items) === null || _a === void 0 ? void 0 : _a.toArray()) !== null && _b !== void 0 ? _b : [];
285
+ if (items.length <= 0) {
286
+ return;
287
+ }
288
+ this.setComponents(items);
289
+ }
290
+ setComponents(items) {
291
+ const [start, end] = this.substitutions;
292
+ const templates = items.reduce((previous, current) => {
293
+ var _a, _b;
294
+ const template = (_a = current === null || current === void 0 ? void 0 : current.templateRef) !== null && _a !== void 0 ? _a : null;
295
+ const name = (_b = current === null || current === void 0 ? void 0 : current.name) !== null && _b !== void 0 ? _b : null;
296
+ if (!template || !name) {
297
+ return previous;
298
+ }
299
+ return Object.assign(Object.assign({}, previous), { [`${start}${name}${end}`]: template });
300
+ }, {});
301
+ this.components = this.getStringComponents(this._value)
302
+ .map(component => { var _a, _b; return (_b = (_a = templates === null || templates === void 0 ? void 0 : templates[component]) !== null && _a !== void 0 ? _a : component) !== null && _b !== void 0 ? _b : null; })
303
+ .filter(item => !!item);
304
+ this._changeDetection.detectChanges();
305
+ }
306
+ getStringComponents(value) {
307
+ const [start, end] = this.getSubstitutions();
308
+ const regex = new RegExp(`(${start}[a-zA-Z]+${end})`, 'g');
309
+ return value.split(regex);
310
+ }
311
+ getSubstitutions() {
312
+ const [start, end] = this.substitutions;
313
+ const escape = /[.*+?^${}()|[\]\\]/g;
314
+ return [
315
+ start.replace(escape, '\\$&'),
316
+ end.replace(escape, '\\$&')
317
+ ];
318
+ }
319
+ }
320
+ BbLocalizeString.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbLocalizeString, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
321
+ BbLocalizeString.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", type: BbLocalizeString, selector: "bb-localize-string", inputs: { substitutions: "substitutions", value: "value" }, host: { classAttribute: "bb-localize-string" }, queries: [{ propertyName: "items", predicate: BbLocalizeTemplate }], ngImport: i0, template: "<ng-container *ngFor=\"let component of components\">\n <ng-template [bbLocalizeTemplateOrString]=\"component\">{{ component }}</ng-template>\n</ng-container>\n", styles: [".bb-localize-string{display:inline}\n"], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: BbLocalizeTemplateOrString, selector: "[bbLocalizeTemplateOrString]", inputs: ["bbLocalizeTemplateOrString"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
322
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbLocalizeString, decorators: [{
323
+ type: Component,
324
+ args: [{
325
+ selector: 'bb-localize-string',
326
+ templateUrl: './localize-string.component.html',
327
+ styleUrls: ['./localize-string.component.scss'],
328
+ changeDetection: ChangeDetectionStrategy.OnPush,
329
+ encapsulation: ViewEncapsulation.None,
330
+ preserveWhitespaces: false,
331
+ host: {
332
+ 'class': 'bb-localize-string'
333
+ }
334
+ }]
335
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { items: [{
336
+ type: ContentChildren,
337
+ args: [BbLocalizeTemplate]
338
+ }], substitutions: [{
339
+ type: Input
340
+ }], value: [{
341
+ type: Input
342
342
  }] } });
343
343
 
344
- class LocalizeDictionary {
345
- constructor({ id, data, locale, supportedLanguages }, baseUrl, http) {
346
- // Dictionary data.
347
- this._data = {};
348
- this._url = null;
349
- this.isAbsoluteUrl = (url) => {
350
- if (url.indexOf('//') === 0) {
351
- return true;
352
- }
353
- if (url.indexOf('://') === -1) {
354
- return false;
355
- }
356
- if (url.indexOf('.') === -1) {
357
- return false;
358
- }
359
- if (url.indexOf('/') === -1) {
360
- return false;
361
- }
362
- if (url.indexOf(':') > url.indexOf('/')) {
363
- return false;
364
- }
365
- return url.indexOf('://') < url.indexOf('.');
366
- };
367
- this.recursiveSearchValue = (data, value) => {
368
- if (typeof data === 'undefined' || typeof data === 'string') {
369
- return undefined;
370
- }
371
- return data[value];
372
- };
373
- this._id = id;
374
- this._locale = locale || 'en-US';
375
- this._supportedLanguages = supportedLanguages || [];
376
- this._http = http;
377
- this.stateKey = makeStateKey(`locale:${this._id}`);
378
- // Set the correct variable to the url or data.
379
- if (typeof data === 'string') {
380
- this._url = this.getUrl(data, baseUrl);
381
- }
382
- else {
383
- this._data = data;
384
- }
385
- }
386
- get id() {
387
- return this._id;
388
- }
389
- get locale() {
390
- return this._locale;
391
- }
392
- get supportedLanguages() {
393
- return this._supportedLanguages;
394
- }
395
- get data() {
396
- return this._data;
397
- }
398
- load(data) {
399
- return __awaiter(this, void 0, void 0, function* () {
400
- // Check if data was passed.
401
- if (data) {
402
- this.setData(data);
403
- return true;
404
- }
405
- // If the url was not set the data was already loaded
406
- // return true because it was successful.
407
- if (!this._url) {
408
- return true;
409
- }
410
- try {
411
- // Try to load the data via a HTTP request.
412
- const context = new HttpContext().set(USE_AUTHORIZATION, false);
413
- const result = yield this._http.get(this._url, { context })
414
- .toPromise();
415
- // Set the data.
416
- this.setData(result);
417
- // Return true because it succeeded.
418
- return true;
419
- }
420
- catch (_a) {
421
- // Return false because it failed.
422
- return false;
423
- }
424
- });
425
- }
426
- combine(extraDictionary, mode = 'prepend') {
427
- // Validate that the locale matches.
428
- if (extraDictionary.locale !== this._locale) {
429
- return;
430
- }
431
- // Extract the extra data.
432
- const extraData = extraDictionary.data || {};
433
- // If the selected mode is prepend
434
- // add the data in front.
435
- if (mode === 'prepend') {
436
- this._data = Object.assign(Object.assign({}, extraData), this._data);
437
- return;
438
- }
439
- // If the selected mode is append
440
- // add the data in the back.
441
- this._data = Object.assign(Object.assign({}, this._data), extraData);
442
- }
443
- search(token) {
444
- // Check if the token is present in the
445
- // data, if so return it.
446
- if (this._data[token]) {
447
- return this._data[token];
448
- }
449
- // Values might be nested in objects this means we need
450
- // to split them on the dot and search them recursively
451
- // in the data.
452
- const value = (token || '')
453
- .split('.')
454
- .filter(value => !!value)
455
- .reduce(this.recursiveSearchValue, this._data);
456
- // Check if the value is a string
457
- // if this is true it can be returned.
458
- if (typeof value === 'string') {
459
- return value;
460
- }
461
- // This means the translation was incorrect.
462
- return null;
463
- }
464
- setData(data) {
465
- this._data = data || {};
466
- this._url = null;
467
- }
468
- getUrl(value, baseUrl) {
469
- const isAbsolute = this.isAbsoluteUrl(value);
470
- if (isAbsolute || !baseUrl) {
471
- return value;
472
- }
473
- return [baseUrl, value].join('/');
474
- }
344
+ class LocalizeDictionary {
345
+ constructor({ id, data, locale, supportedLanguages }, baseUrl, http) {
346
+ // Dictionary data.
347
+ this._data = {};
348
+ this._url = null;
349
+ this.isAbsoluteUrl = (url) => {
350
+ if (url.indexOf('//') === 0) {
351
+ return true;
352
+ }
353
+ if (url.indexOf('://') === -1) {
354
+ return false;
355
+ }
356
+ if (url.indexOf('.') === -1) {
357
+ return false;
358
+ }
359
+ if (url.indexOf('/') === -1) {
360
+ return false;
361
+ }
362
+ if (url.indexOf(':') > url.indexOf('/')) {
363
+ return false;
364
+ }
365
+ return url.indexOf('://') < url.indexOf('.');
366
+ };
367
+ this.recursiveSearchValue = (data, value) => {
368
+ if (typeof data === 'undefined' || typeof data === 'string') {
369
+ return undefined;
370
+ }
371
+ return data[value];
372
+ };
373
+ this._id = id;
374
+ this._locale = locale || 'en-US';
375
+ this._supportedLanguages = supportedLanguages || [];
376
+ this._http = http;
377
+ this.stateKey = makeStateKey(`locale:${this._id}`);
378
+ // Set the correct variable to the url or data.
379
+ if (typeof data === 'string') {
380
+ this._url = this.getUrl(data, baseUrl);
381
+ }
382
+ else {
383
+ this._data = data;
384
+ }
385
+ }
386
+ get id() {
387
+ return this._id;
388
+ }
389
+ get locale() {
390
+ return this._locale;
391
+ }
392
+ get supportedLanguages() {
393
+ return this._supportedLanguages;
394
+ }
395
+ get data() {
396
+ return this._data;
397
+ }
398
+ load(data) {
399
+ return __awaiter(this, void 0, void 0, function* () {
400
+ // Check if data was passed.
401
+ if (data) {
402
+ this.setData(data);
403
+ return true;
404
+ }
405
+ // If the url was not set the data was already loaded
406
+ // return true because it was successful.
407
+ if (!this._url) {
408
+ return true;
409
+ }
410
+ try {
411
+ // Try to load the data via a HTTP request.
412
+ const context = new HttpContext().set(USE_AUTHORIZATION, false);
413
+ const result = yield this._http.get(this._url, { context })
414
+ .toPromise();
415
+ // Set the data.
416
+ this.setData(result);
417
+ // Return true because it succeeded.
418
+ return true;
419
+ }
420
+ catch (_a) {
421
+ // Return false because it failed.
422
+ return false;
423
+ }
424
+ });
425
+ }
426
+ combine(extraDictionary, mode = 'prepend') {
427
+ // Validate that the locale matches.
428
+ if (extraDictionary.locale !== this._locale) {
429
+ return;
430
+ }
431
+ // Extract the extra data.
432
+ const extraData = extraDictionary.data || {};
433
+ // If the selected mode is prepend
434
+ // add the data in front.
435
+ if (mode === 'prepend') {
436
+ this._data = Object.assign(Object.assign({}, extraData), this._data);
437
+ return;
438
+ }
439
+ // If the selected mode is append
440
+ // add the data in the back.
441
+ this._data = Object.assign(Object.assign({}, this._data), extraData);
442
+ }
443
+ search(token) {
444
+ // Check if the token is present in the
445
+ // data, if so return it.
446
+ if (this._data[token]) {
447
+ return this._data[token];
448
+ }
449
+ // Values might be nested in objects this means we need
450
+ // to split them on the dot and search them recursively
451
+ // in the data.
452
+ const value = (token || '')
453
+ .split('.')
454
+ .filter(value => !!value)
455
+ .reduce(this.recursiveSearchValue, this._data);
456
+ // Check if the value is a string
457
+ // if this is true it can be returned.
458
+ if (typeof value === 'string') {
459
+ return value;
460
+ }
461
+ // This means the translation was incorrect.
462
+ return null;
463
+ }
464
+ setData(data) {
465
+ this._data = data || {};
466
+ this._url = null;
467
+ }
468
+ getUrl(value, baseUrl) {
469
+ const isAbsolute = this.isAbsoluteUrl(value);
470
+ if (isAbsolute || !baseUrl) {
471
+ return value;
472
+ }
473
+ return [baseUrl, value].join('/');
474
+ }
475
475
  }
476
476
 
477
- class Localize {
478
- constructor(_http, _storage, _platform, _languages, _state, _config, _missingHandler, _document, _location, _baseUrl, _functions, _extras) {
479
- this._http = _http;
480
- this._storage = _storage;
481
- this._platform = _platform;
482
- this._languages = _languages;
483
- this._state = _state;
484
- this._config = _config;
485
- this._missingHandler = _missingHandler;
486
- this._document = _document;
487
- this._location = _location;
488
- this._baseUrl = _baseUrl;
489
- this._functions = _functions;
490
- this._extras = _extras;
491
- this._storageToken = 'bb-language-dictionary-id';
492
- this.convertToParams = (tokenOrParams) => {
493
- if (typeof tokenOrParams !== 'string') {
494
- // Destruct the params from the object.
495
- const { token, optional, data } = tokenOrParams;
496
- // Make sure all parameters are valid
497
- // by type safe adding them.
498
- return { token: token, optional: optional || false, data: data || {} };
499
- }
500
- // If the parameter is a string fill in the blanks.
501
- return { token: tokenOrParams, optional: false, data: {} };
502
- };
503
- this.getMatches = (value, substitutions) => {
504
- // Get the matching substitutions.
505
- const { start, end } = substitutions;
506
- // Compose a regex that will find the matches.
507
- const regex = new RegExp(`${start}([^${end}]+)${end}`, 'g');
508
- // Execute the regex to find matches.
509
- let match = regex.exec(value);
510
- const matches = [];
511
- while (match !== null) {
512
- // Push a new match.
513
- matches.push({
514
- match: match[0],
515
- token: match[1]
516
- });
517
- // Try to find more matches.
518
- match = regex.exec(value);
519
- }
520
- // Return the processed value.
521
- return matches.filter(item => !!item);
522
- };
523
- this.reload = () => { var _a; return (_a = this._location) === null || _a === void 0 ? void 0 : _a.reload(); };
524
- // Check if at least one language was passed in the config.
525
- if (this._config.dictionary.length < 1) {
526
- throw new Error('Localize: one or more languages should be supplied.');
527
- }
528
- // Gather the dictionaries.
529
- this._dictionaries = this._config.dictionary.map(item => {
530
- return new LocalizeDictionary(item, this._baseUrl, this._http);
531
- });
532
- // Save the best matching current dictionary.
533
- this._currentDictionary = this.retrieveBestMatchingDictionary();
534
- // Gather all the localize functions.
535
- this._functionMiddleware = this._functions.reduce((previous, current) => {
536
- previous[current.keyword()] = current;
537
- return previous;
538
- }, {});
539
- this.renderDocumentLanguage();
540
- }
541
- get dictionaries() {
542
- return this._dictionaries;
543
- }
544
- get current() {
545
- return this._currentDictionary;
546
- }
547
- get locale() {
548
- return this._currentDictionary.locale;
549
- }
550
- initialize() {
551
- return () => __awaiter(this, void 0, void 0, function* () { return this.load(this._currentDictionary); });
552
- }
553
- change(id, reload = true) {
554
- // Try to fetch the dictionary.
555
- const dictionary = this._dictionaries.find(item => item.id === id);
556
- // Validate the dictionary exists.
557
- if (!dictionary) {
558
- throw new Error(`Localize: Could not find dictionary with id: "${id}"`);
559
- }
560
- // Save the language in the storage.
561
- this._storage.cookie.set(this._storageToken, dictionary.id, {});
562
- // Just quit if we don't need to reload.
563
- if (!reload) {
564
- return;
565
- }
566
- // We need to reload the application for the translations.
567
- return this.reload();
568
- }
569
- clear(reload = true) {
570
- // Remove the language in the local storage.
571
- this._storage.cookie.remove(this._storageToken);
572
- // Just quit if we don't need to reload.
573
- if (!reload) {
574
- return;
575
- }
576
- // We need to reload the application for the translations.
577
- return this.reload();
578
- }
579
- translate(tokenOrParams) {
580
- // 1. Convert to the params.
581
- const params = this.convertToParams(tokenOrParams);
582
- // 2. Try to find the translation in the dictionary.
583
- const searchResult = this._currentDictionary.search(params.token);
584
- // 3. Verify the translation was found.
585
- if (!searchResult) {
586
- return this._missingHandler.handle(params);
587
- }
588
- // 4. Find references in the translation that need to be translated as well.
589
- const processResult = this.findReferencesInTranslation(searchResult);
590
- // 5. Parse the interpolation data.
591
- return this.parseInterpolationData(processResult, params.data);
592
- }
593
- parseInterpolationData(value, data) {
594
- // Get the interpolation substitutions.
595
- const substitutions = this.getSubstitutions('interpolation', ['{{', '}}']);
596
- // Get all matches in the value.
597
- const matches = this.getMatches(value, substitutions);
598
- // Replace all matches with the parsed value.
599
- return matches.reduce((previous, current) => {
600
- // Try to parse the token.
601
- const interpolatedToken = this.interpolateFunctionData(current.token, data);
602
- // Replace the match with the parsed token.
603
- return previous.replace(current.match, interpolatedToken);
604
- }, `${value}`);
605
- }
606
- interpolateFunctionData(value, interpolationData) {
607
- // Get the token and the methods by splitting
608
- // on the pipe symbol.
609
- const [token, ...methods] = value.split('|').map(item => item.trim());
610
- // Get the value for the token from
611
- // the interpolation data.
612
- const interpolationValue = interpolationData[token] || token;
613
- // Loop through all the middleware methods and try to
614
- // conform the string to the given parameters.
615
- return methods.reduce((string, middlewareName) => {
616
- // Try to retrieve the middleware from the collection.
617
- const middleware = this._functionMiddleware[middlewareName];
618
- // If the middleware is missing return an error
619
- // so that the user knows it was not found.
620
- if (!middleware) {
621
- return string;
622
- }
623
- // Execute the middleware function with the string.
624
- return middleware.transform(string, this.locale);
625
- }, `${interpolationValue}`);
626
- }
627
- findReferencesInTranslation(value) {
628
- // Get the reference substitutions.
629
- const substitutions = this.getSubstitutions('references', ['#(', ')']);
630
- // Get all matches in the value.
631
- const matches = this.getMatches(value, substitutions);
632
- // Replace all matches with the translated value.
633
- return matches.reduce((previous, current) => {
634
- // Try to translate the token.
635
- const translatedToken = this.translate(current.token);
636
- // Replace the match with the translated token.
637
- return previous.replace(current.match, translatedToken);
638
- }, value);
639
- }
640
- getSubstitutions(type, defaultValue) {
641
- const substitutions = (this._config
642
- && this._config.substitutions
643
- && this._config.substitutions[type]);
644
- // Get the substitutions.
645
- const value = (!substitutions || substitutions.length !== 2)
646
- ? defaultValue
647
- : substitutions;
648
- // Escape both substitutions so that they
649
- // can be used.
650
- const escape = /[.*+?^${}()|[\]\\]/g;
651
- const start = value[0].replace(escape, '\\$&');
652
- const end = value[1].replace(escape, '\\$&');
653
- // Return the substitutions.
654
- return { start, end };
655
- }
656
- retrieveBestMatchingDictionary() {
657
- // Get the dictionary based on storage.
658
- const storageDictionary = this.getDictionaryFromStorage();
659
- // Get the dictionary based on the supported language.
660
- const browserDictionary = this.getBestBrowserMatchDictionary();
661
- // Get the dictionary based on the first index.
662
- const firstDictionary = this._dictionaries[0];
663
- // Return the best matching dictionary.
664
- return storageDictionary || browserDictionary || firstDictionary;
665
- }
666
- getDictionaryFromStorage() {
667
- // Get dictionary id from the storage..
668
- const dictionaryId = this._storage.cookie.get(this._storageToken);
669
- // Return the dictionary based on the storage dictionary id.
670
- return this._dictionaries.find(item => item.id === dictionaryId);
671
- }
672
- getBestBrowserMatchDictionary() {
673
- // Loop through all browser languages and return the
674
- // best matching dictionary.
675
- return this._languages.all.map(({ code, region }) => {
676
- const languageCode = [code, region].filter(data => !!data).join('-');
677
- return this._dictionaries.find(item => item.supportedLanguages.includes(languageCode));
678
- }).filter(item => !!item).find((_, index) => index === 0);
679
- }
680
- load(dictionary) {
681
- var _a, _b, _c, _d;
682
- return __awaiter(this, void 0, void 0, function* () {
683
- const data = ((_a = this._state) === null || _a === void 0 ? void 0 : _a.hasKey(dictionary.stateKey))
684
- ? (_b = this._state) === null || _b === void 0 ? void 0 : _b.get(dictionary.stateKey, {})
685
- : null;
686
- // Try to load the dictionary data.
687
- const loaded = yield dictionary.load(data);
688
- // Verify the data was loaded.
689
- if (!loaded) {
690
- throw new Error(`Localize: Could not correctly fetch the data from: "${dictionary.id}"`);
691
- }
692
- if (!this._platform.isBrowser && this._state) {
693
- (_c = this._state) === null || _c === void 0 ? void 0 : _c.set(dictionary === null || dictionary === void 0 ? void 0 : dictionary.stateKey, (_d = dictionary === null || dictionary === void 0 ? void 0 : dictionary.data) !== null && _d !== void 0 ? _d : {});
694
- }
695
- // Combine the extra dictionary data.
696
- (this._extras || []).forEach(extraDictionary => dictionary.combine(extraDictionary));
697
- // Return the dictionary.
698
- return dictionary;
699
- });
700
- }
701
- renderDocumentLanguage() {
702
- var _a, _b, _c, _d, _e;
703
- const element = (_a = this._document) === null || _a === void 0 ? void 0 : _a.documentElement;
704
- if (!element) {
705
- return;
706
- }
707
- element.lang = (_d = (_c = (_b = this._currentDictionary) === null || _b === void 0 ? void 0 : _b.supportedLanguages) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : (_e = this._currentDictionary) === null || _e === void 0 ? void 0 : _e.locale;
708
- }
709
- }
710
- Localize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: Localize, deps: [{ token: i1$1.HttpClient }, { token: i2.Storage }, { token: i3.Platform }, { token: i3.Languages }, { token: i4.TransferState, optional: true }, { token: LocalizeConfig, optional: true }, { token: LocalizeMissingHandler }, { token: DOCUMENT, optional: true }, { token: LOCATION, optional: true }, { token: BASE_URL, optional: true }, { token: LOCALIZE_FUNCTION, optional: true }, { token: LOCALIZE_EXTRA_DICTIONARY, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
711
- Localize.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: Localize });
712
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: Localize, decorators: [{
713
- type: Injectable
714
- }], ctorParameters: function () { return [{ type: i1$1.HttpClient }, { type: i2.Storage }, { type: i3.Platform }, { type: i3.Languages }, { type: i4.TransferState, decorators: [{
715
- type: Optional
716
- }] }, { type: LocalizeConfig, decorators: [{
717
- type: Optional
718
- }] }, { type: LocalizeMissingHandler }, { type: undefined, decorators: [{
719
- type: Optional
720
- }, {
721
- type: Inject,
722
- args: [DOCUMENT]
723
- }] }, { type: undefined, decorators: [{
724
- type: Optional
725
- }, {
726
- type: Inject,
727
- args: [LOCATION]
728
- }] }, { type: undefined, decorators: [{
729
- type: Optional
730
- }, {
731
- type: Inject,
732
- args: [BASE_URL]
733
- }] }, { type: undefined, decorators: [{
734
- type: Optional
735
- }, {
736
- type: Inject,
737
- args: [LOCALIZE_FUNCTION]
738
- }] }, { type: undefined, decorators: [{
739
- type: Optional
740
- }, {
741
- type: Inject,
742
- args: [LOCALIZE_EXTRA_DICTIONARY]
477
+ class Localize {
478
+ constructor(_http, _storage, _platform, _languages, _state, _config, _missingHandler, _document, _location, _baseUrl, _functions, _extras) {
479
+ this._http = _http;
480
+ this._storage = _storage;
481
+ this._platform = _platform;
482
+ this._languages = _languages;
483
+ this._state = _state;
484
+ this._config = _config;
485
+ this._missingHandler = _missingHandler;
486
+ this._document = _document;
487
+ this._location = _location;
488
+ this._baseUrl = _baseUrl;
489
+ this._functions = _functions;
490
+ this._extras = _extras;
491
+ this._storageToken = 'bb-language-dictionary-id';
492
+ this.convertToParams = (tokenOrParams) => {
493
+ if (typeof tokenOrParams !== 'string') {
494
+ // Destruct the params from the object.
495
+ const { token, optional, data } = tokenOrParams;
496
+ // Make sure all parameters are valid
497
+ // by type safe adding them.
498
+ return { token: token, optional: optional || false, data: data || {} };
499
+ }
500
+ // If the parameter is a string fill in the blanks.
501
+ return { token: tokenOrParams, optional: false, data: {} };
502
+ };
503
+ this.getMatches = (value, substitutions) => {
504
+ // Get the matching substitutions.
505
+ const { start, end } = substitutions;
506
+ // Compose a regex that will find the matches.
507
+ const regex = new RegExp(`${start}([^${end}]+)${end}`, 'g');
508
+ // Execute the regex to find matches.
509
+ let match = regex.exec(value);
510
+ const matches = [];
511
+ while (match !== null) {
512
+ // Push a new match.
513
+ matches.push({
514
+ match: match[0],
515
+ token: match[1]
516
+ });
517
+ // Try to find more matches.
518
+ match = regex.exec(value);
519
+ }
520
+ // Return the processed value.
521
+ return matches.filter(item => !!item);
522
+ };
523
+ this.reload = () => { var _a; return (_a = this._location) === null || _a === void 0 ? void 0 : _a.reload(); };
524
+ // Check if at least one language was passed in the config.
525
+ if (this._config.dictionary.length < 1) {
526
+ throw new Error('Localize: one or more languages should be supplied.');
527
+ }
528
+ // Gather the dictionaries.
529
+ this._dictionaries = this._config.dictionary.map(item => {
530
+ return new LocalizeDictionary(item, this._baseUrl, this._http);
531
+ });
532
+ // Save the best matching current dictionary.
533
+ this._currentDictionary = this.retrieveBestMatchingDictionary();
534
+ // Gather all the localize functions.
535
+ this._functionMiddleware = this._functions.reduce((previous, current) => {
536
+ previous[current.keyword()] = current;
537
+ return previous;
538
+ }, {});
539
+ this.renderDocumentLanguage();
540
+ }
541
+ get dictionaries() {
542
+ return this._dictionaries;
543
+ }
544
+ get current() {
545
+ return this._currentDictionary;
546
+ }
547
+ get locale() {
548
+ return this._currentDictionary.locale;
549
+ }
550
+ initialize() {
551
+ return () => __awaiter(this, void 0, void 0, function* () { return this.load(this._currentDictionary); });
552
+ }
553
+ change(id, reload = true) {
554
+ // Try to fetch the dictionary.
555
+ const dictionary = this._dictionaries.find(item => item.id === id);
556
+ // Validate the dictionary exists.
557
+ if (!dictionary) {
558
+ throw new Error(`Localize: Could not find dictionary with id: "${id}"`);
559
+ }
560
+ // Save the language in the storage.
561
+ this._storage.cookie.set(this._storageToken, dictionary.id, {});
562
+ // Just quit if we don't need to reload.
563
+ if (!reload) {
564
+ return;
565
+ }
566
+ // We need to reload the application for the translations.
567
+ return this.reload();
568
+ }
569
+ clear(reload = true) {
570
+ // Remove the language in the local storage.
571
+ this._storage.cookie.remove(this._storageToken);
572
+ // Just quit if we don't need to reload.
573
+ if (!reload) {
574
+ return;
575
+ }
576
+ // We need to reload the application for the translations.
577
+ return this.reload();
578
+ }
579
+ translate(tokenOrParams) {
580
+ // 1. Convert to the params.
581
+ const params = this.convertToParams(tokenOrParams);
582
+ // 2. Try to find the translation in the dictionary.
583
+ const searchResult = this._currentDictionary.search(params.token);
584
+ // 3. Verify the translation was found.
585
+ if (!searchResult) {
586
+ return this._missingHandler.handle(params);
587
+ }
588
+ // 4. Find references in the translation that need to be translated as well.
589
+ const processResult = this.findReferencesInTranslation(searchResult);
590
+ // 5. Parse the interpolation data.
591
+ return this.parseInterpolationData(processResult, params.data);
592
+ }
593
+ parseInterpolationData(value, data) {
594
+ // Get the interpolation substitutions.
595
+ const substitutions = this.getSubstitutions('interpolation', ['{{', '}}']);
596
+ // Get all matches in the value.
597
+ const matches = this.getMatches(value, substitutions);
598
+ // Replace all matches with the parsed value.
599
+ return matches.reduce((previous, current) => {
600
+ // Try to parse the token.
601
+ const interpolatedToken = this.interpolateFunctionData(current.token, data);
602
+ // Replace the match with the parsed token.
603
+ return previous.replace(current.match, interpolatedToken);
604
+ }, `${value}`);
605
+ }
606
+ interpolateFunctionData(value, interpolationData) {
607
+ // Get the token and the methods by splitting
608
+ // on the pipe symbol.
609
+ const [token, ...methods] = value.split('|').map(item => item.trim());
610
+ // Get the value for the token from
611
+ // the interpolation data.
612
+ const interpolationValue = interpolationData[token] || token;
613
+ // Loop through all the middleware methods and try to
614
+ // conform the string to the given parameters.
615
+ return methods.reduce((string, middlewareName) => {
616
+ // Try to retrieve the middleware from the collection.
617
+ const middleware = this._functionMiddleware[middlewareName];
618
+ // If the middleware is missing return an error
619
+ // so that the user knows it was not found.
620
+ if (!middleware) {
621
+ return string;
622
+ }
623
+ // Execute the middleware function with the string.
624
+ return middleware.transform(string, this.locale);
625
+ }, `${interpolationValue}`);
626
+ }
627
+ findReferencesInTranslation(value) {
628
+ // Get the reference substitutions.
629
+ const substitutions = this.getSubstitutions('references', ['#(', ')']);
630
+ // Get all matches in the value.
631
+ const matches = this.getMatches(value, substitutions);
632
+ // Replace all matches with the translated value.
633
+ return matches.reduce((previous, current) => {
634
+ // Try to translate the token.
635
+ const translatedToken = this.translate(current.token);
636
+ // Replace the match with the translated token.
637
+ return previous.replace(current.match, translatedToken);
638
+ }, value);
639
+ }
640
+ getSubstitutions(type, defaultValue) {
641
+ const substitutions = (this._config
642
+ && this._config.substitutions
643
+ && this._config.substitutions[type]);
644
+ // Get the substitutions.
645
+ const value = (!substitutions || substitutions.length !== 2)
646
+ ? defaultValue
647
+ : substitutions;
648
+ // Escape both substitutions so that they
649
+ // can be used.
650
+ const escape = /[.*+?^${}()|[\]\\]/g;
651
+ const start = value[0].replace(escape, '\\$&');
652
+ const end = value[1].replace(escape, '\\$&');
653
+ // Return the substitutions.
654
+ return { start, end };
655
+ }
656
+ retrieveBestMatchingDictionary() {
657
+ // Get the dictionary based on storage.
658
+ const storageDictionary = this.getDictionaryFromStorage();
659
+ // Get the dictionary based on the supported language.
660
+ const browserDictionary = this.getBestBrowserMatchDictionary();
661
+ // Get the dictionary based on the first index.
662
+ const firstDictionary = this._dictionaries[0];
663
+ // Return the best matching dictionary.
664
+ return storageDictionary || browserDictionary || firstDictionary;
665
+ }
666
+ getDictionaryFromStorage() {
667
+ // Get dictionary id from the storage..
668
+ const dictionaryId = this._storage.cookie.get(this._storageToken);
669
+ // Return the dictionary based on the storage dictionary id.
670
+ return this._dictionaries.find(item => item.id === dictionaryId);
671
+ }
672
+ getBestBrowserMatchDictionary() {
673
+ // Loop through all browser languages and return the
674
+ // best matching dictionary.
675
+ return this._languages.all.map(({ code, region }) => {
676
+ const languageCode = [code, region].filter(data => !!data).join('-');
677
+ return this._dictionaries.find(item => item.supportedLanguages.includes(languageCode));
678
+ }).filter(item => !!item).find((_, index) => index === 0);
679
+ }
680
+ load(dictionary) {
681
+ var _a, _b, _c, _d;
682
+ return __awaiter(this, void 0, void 0, function* () {
683
+ const data = ((_a = this._state) === null || _a === void 0 ? void 0 : _a.hasKey(dictionary.stateKey))
684
+ ? (_b = this._state) === null || _b === void 0 ? void 0 : _b.get(dictionary.stateKey, {})
685
+ : null;
686
+ // Try to load the dictionary data.
687
+ const loaded = yield dictionary.load(data);
688
+ // Verify the data was loaded.
689
+ if (!loaded) {
690
+ throw new Error(`Localize: Could not correctly fetch the data from: "${dictionary.id}"`);
691
+ }
692
+ if (!this._platform.isBrowser && this._state) {
693
+ (_c = this._state) === null || _c === void 0 ? void 0 : _c.set(dictionary === null || dictionary === void 0 ? void 0 : dictionary.stateKey, (_d = dictionary === null || dictionary === void 0 ? void 0 : dictionary.data) !== null && _d !== void 0 ? _d : {});
694
+ }
695
+ // Combine the extra dictionary data.
696
+ (this._extras || []).forEach(extraDictionary => dictionary.combine(extraDictionary));
697
+ // Return the dictionary.
698
+ return dictionary;
699
+ });
700
+ }
701
+ renderDocumentLanguage() {
702
+ var _a, _b, _c, _d, _e;
703
+ const element = (_a = this._document) === null || _a === void 0 ? void 0 : _a.documentElement;
704
+ if (!element) {
705
+ return;
706
+ }
707
+ element.lang = (_d = (_c = (_b = this._currentDictionary) === null || _b === void 0 ? void 0 : _b.supportedLanguages) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : (_e = this._currentDictionary) === null || _e === void 0 ? void 0 : _e.locale;
708
+ }
709
+ }
710
+ Localize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: Localize, deps: [{ token: i1$1.HttpClient }, { token: i2.Storage }, { token: i3.Platform }, { token: i3.Languages }, { token: i4.TransferState, optional: true }, { token: LocalizeConfig, optional: true }, { token: LocalizeMissingHandler }, { token: DOCUMENT, optional: true }, { token: LOCATION, optional: true }, { token: BASE_URL, optional: true }, { token: LOCALIZE_FUNCTION, optional: true }, { token: LOCALIZE_EXTRA_DICTIONARY, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
711
+ Localize.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: Localize });
712
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: Localize, decorators: [{
713
+ type: Injectable
714
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }, { type: i2.Storage }, { type: i3.Platform }, { type: i3.Languages }, { type: i4.TransferState, decorators: [{
715
+ type: Optional
716
+ }] }, { type: LocalizeConfig, decorators: [{
717
+ type: Optional
718
+ }] }, { type: LocalizeMissingHandler }, { type: undefined, decorators: [{
719
+ type: Optional
720
+ }, {
721
+ type: Inject,
722
+ args: [DOCUMENT]
723
+ }] }, { type: undefined, decorators: [{
724
+ type: Optional
725
+ }, {
726
+ type: Inject,
727
+ args: [LOCATION]
728
+ }] }, { type: undefined, decorators: [{
729
+ type: Optional
730
+ }, {
731
+ type: Inject,
732
+ args: [BASE_URL]
733
+ }] }, { type: undefined, decorators: [{
734
+ type: Optional
735
+ }, {
736
+ type: Inject,
737
+ args: [LOCALIZE_FUNCTION]
738
+ }] }, { type: undefined, decorators: [{
739
+ type: Optional
740
+ }, {
741
+ type: Inject,
742
+ args: [LOCALIZE_EXTRA_DICTIONARY]
743
743
  }] }]; } });
744
744
 
745
- class BbLocalize {
746
- constructor(_localize) {
747
- this._localize = _localize;
748
- }
749
- transform(tokenOrParams, args) {
750
- // Validate that the localize service
751
- // exists in the pipe.
752
- if (!this._localize) {
753
- return tokenOrParams;
754
- }
755
- // Combine the params with the options
756
- // to form the localize params.
757
- const params = this.combineParamsWithOptions(tokenOrParams, args);
758
- // Try to localize the value.
759
- return this._localize.translate(params);
760
- }
761
- combineParamsWithOptions(tokenOrParams, args) {
762
- // Gather the extras.
763
- const extras = args || {};
764
- // Loop through all the keys to find the set options.
765
- const options = Object.keys(extras).reduce((previous, current) => {
766
- if (typeof extras[current] === 'undefined') {
767
- return previous;
768
- }
769
- previous[current] = extras[current];
770
- return previous;
771
- }, {});
772
- // Convert the string token to a params object.
773
- const params = typeof tokenOrParams === 'string'
774
- ? { token: tokenOrParams, optional: false, data: {} }
775
- : tokenOrParams;
776
- // Return the combined params and options.
777
- return Object.assign(Object.assign({}, params), options);
778
- }
779
- }
780
- BbLocalize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: BbLocalize, deps: [{ token: Localize, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
781
- BbLocalize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: BbLocalize, name: "bbLocalize" });
782
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: BbLocalize, decorators: [{
783
- type: Pipe,
784
- args: [{
785
- name: 'bbLocalize'
786
- }]
787
- }], ctorParameters: function () { return [{ type: Localize, decorators: [{
788
- type: Optional
745
+ class BbLocalize {
746
+ constructor(_localize) {
747
+ this._localize = _localize;
748
+ }
749
+ transform(tokenOrParams, args) {
750
+ // Validate that the localize service
751
+ // exists in the pipe.
752
+ if (!this._localize) {
753
+ return tokenOrParams;
754
+ }
755
+ // Combine the params with the options
756
+ // to form the localize params.
757
+ const params = this.combineParamsWithOptions(tokenOrParams, args);
758
+ // Try to localize the value.
759
+ return this._localize.translate(params);
760
+ }
761
+ combineParamsWithOptions(tokenOrParams, args) {
762
+ // Gather the extras.
763
+ const extras = args || {};
764
+ // Loop through all the keys to find the set options.
765
+ const options = Object.keys(extras).reduce((previous, current) => {
766
+ if (typeof extras[current] === 'undefined') {
767
+ return previous;
768
+ }
769
+ previous[current] = extras[current];
770
+ return previous;
771
+ }, {});
772
+ // Convert the string token to a params object.
773
+ const params = typeof tokenOrParams === 'string'
774
+ ? { token: tokenOrParams, optional: false, data: {} }
775
+ : tokenOrParams;
776
+ // Return the combined params and options.
777
+ return Object.assign(Object.assign({}, params), options);
778
+ }
779
+ }
780
+ BbLocalize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbLocalize, deps: [{ token: Localize, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
781
+ BbLocalize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbLocalize, name: "bbLocalize" });
782
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbLocalize, decorators: [{
783
+ type: Pipe,
784
+ args: [{
785
+ name: 'bbLocalize'
786
+ }]
787
+ }], ctorParameters: function () { return [{ type: Localize, decorators: [{
788
+ type: Optional
789
789
  }] }]; } });
790
790
 
791
- class LocalizeModule {
792
- static forRoot(config) {
793
- return {
794
- ngModule: LocalizeModule,
795
- providers: [
796
- // Angular providers.
797
- { provide: APP_INITIALIZER, deps: [Localize], useFactory: initializeLocale, multi: true },
798
- { provide: LOCALE_ID, deps: [Localize], useFactory: getLocale },
799
- // Config provider.
800
- { provide: LocalizeConfig, useValue: config },
801
- // Function providers.
802
- { provide: LOCALIZE_FUNCTION, useClass: LocalizeLowercaseFunction, multi: true },
803
- { provide: LOCALIZE_FUNCTION, useClass: LocalizeUppercaseFunction, multi: true },
804
- { provide: LOCALIZE_FUNCTION, useClass: LocalizeDateFunction, multi: true },
805
- // Handler providers.
806
- { provide: LocalizeMissingHandler, useClass: LocalizeMissingHandler },
807
- // Service providers.
808
- Localize
809
- ]
810
- };
811
- }
812
- }
813
- LocalizeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: LocalizeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
814
- LocalizeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: LocalizeModule, declarations: [BbLocalize,
815
- BbLocalizeString,
816
- BbLocalizeTemplate,
817
- BbLocalizeTemplateOrString], imports: [CommonModule, HttpClientModule], exports: [BbLocalize,
818
- BbLocalizeString,
819
- BbLocalizeTemplate] });
820
- LocalizeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: LocalizeModule, imports: [[CommonModule, HttpClientModule]] });
821
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.4", ngImport: i0, type: LocalizeModule, decorators: [{
822
- type: NgModule,
823
- args: [{
824
- imports: [CommonModule, HttpClientModule],
825
- declarations: [
826
- BbLocalize,
827
- BbLocalizeString,
828
- BbLocalizeTemplate,
829
- BbLocalizeTemplateOrString
830
- ],
831
- exports: [
832
- BbLocalize,
833
- BbLocalizeString,
834
- BbLocalizeTemplate
835
- ]
836
- }]
837
- }] });
838
- function initializeLocale(localize) {
839
- return localize.initialize();
840
- }
841
- function getLocale(localize) {
842
- return localize.locale;
791
+ class LocalizeModule {
792
+ static forRoot(config) {
793
+ return {
794
+ ngModule: LocalizeModule,
795
+ providers: [
796
+ // Angular providers.
797
+ { provide: APP_INITIALIZER, deps: [Localize], useFactory: initializeLocale, multi: true },
798
+ { provide: LOCALE_ID, deps: [Localize], useFactory: getLocale },
799
+ // Config provider.
800
+ { provide: LocalizeConfig, useValue: config },
801
+ // Function providers.
802
+ { provide: LOCALIZE_FUNCTION, useClass: LocalizeLowercaseFunction, multi: true },
803
+ { provide: LOCALIZE_FUNCTION, useClass: LocalizeUppercaseFunction, multi: true },
804
+ { provide: LOCALIZE_FUNCTION, useClass: LocalizeDateFunction, multi: true },
805
+ // Handler providers.
806
+ { provide: LocalizeMissingHandler, useClass: LocalizeMissingHandler },
807
+ // Service providers.
808
+ Localize
809
+ ]
810
+ };
811
+ }
812
+ }
813
+ LocalizeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: LocalizeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
814
+ LocalizeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: LocalizeModule, declarations: [BbLocalize,
815
+ BbLocalizeString,
816
+ BbLocalizeTemplate,
817
+ BbLocalizeTemplateOrString], imports: [CommonModule, HttpClientModule], exports: [BbLocalize,
818
+ BbLocalizeString,
819
+ BbLocalizeTemplate] });
820
+ LocalizeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: LocalizeModule, imports: [[CommonModule, HttpClientModule]] });
821
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: LocalizeModule, decorators: [{
822
+ type: NgModule,
823
+ args: [{
824
+ imports: [CommonModule, HttpClientModule],
825
+ declarations: [
826
+ BbLocalize,
827
+ BbLocalizeString,
828
+ BbLocalizeTemplate,
829
+ BbLocalizeTemplateOrString
830
+ ],
831
+ exports: [
832
+ BbLocalize,
833
+ BbLocalizeString,
834
+ BbLocalizeTemplate
835
+ ]
836
+ }]
837
+ }] });
838
+ function initializeLocale(localize) {
839
+ return localize.initialize();
840
+ }
841
+ function getLocale(localize) {
842
+ return localize.locale;
843
843
  }
844
844
 
845
- /**
846
- * Generated bundle index. Do not edit.
845
+ /**
846
+ * Generated bundle index. Do not edit.
847
847
  */
848
848
 
849
849
  export { BbLocalize, BbLocalizeString, BbLocalizeTemplate, LOCALIZATION_EXTRA_DUTCH, LOCALIZATION_EXTRA_ENGLISH, LOCALIZE_EXTRA_DICTIONARY, LOCALIZE_FUNCTION, Localize, LocalizeConfig, LocalizeDateFunction, LocalizeDictionary, LocalizeLowercaseFunction, LocalizeMissingHandler, LocalizeModule, LocalizeUppercaseFunction, getLocale, initializeLocale };