@bravobit/bb-foundation 0.16.5 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (426) 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/collections/bravobit-bb-foundation-collections.d.ts +5 -5
  25. package/collections/lib/collection.d.ts +43 -43
  26. package/collections/lib/collections.module.d.ts +10 -10
  27. package/collections/lib/components/collections-pager/collections-pager.component.d.ts +34 -34
  28. package/collections/lib/components/collections-viewer/collections-viewer.component.d.ts +12 -12
  29. package/collections/lib/components/collections.directive.d.ts +17 -17
  30. package/collections/lib/interfaces/collection.interface.d.ts +26 -26
  31. package/collections/lib/providers/api-collection.provider.d.ts +17 -15
  32. package/collections/lib/providers/collection.provider.d.ts +6 -6
  33. package/collections/lib/providers/local-collection.provider.d.ts +8 -8
  34. package/collections/public_api.d.ts +9 -9
  35. package/controls/bravobit-bb-foundation-controls.d.ts +5 -5
  36. package/controls/lib/checkbox/checkbox/checkbox.component.d.ts +47 -47
  37. package/controls/lib/checkbox/checkbox-group/checkbox-group.component.d.ts +18 -18
  38. package/controls/lib/checkbox/checkbox.module.d.ts +9 -9
  39. package/controls/lib/controls.module.d.ts +7 -7
  40. package/controls/public_api.d.ts +4 -4
  41. package/dashboard/bravobit-bb-foundation-dashboard.d.ts +5 -5
  42. package/dashboard/lib/dashboard/dashboard.component.d.ts +19 -19
  43. package/dashboard/lib/dashboard-header/dashboard-header.component.d.ts +11 -11
  44. package/dashboard/lib/dashboard-menu/dashboard-menu.component.d.ts +9 -9
  45. package/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.d.ts +11 -11
  46. package/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.d.ts +21 -21
  47. package/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.d.ts +27 -27
  48. package/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.d.ts +16 -16
  49. package/dashboard/lib/dashboard.module.d.ts +16 -16
  50. package/dashboard/public_api.d.ts +8 -8
  51. package/dialog/bravobit-bb-foundation-dialog.d.ts +5 -5
  52. package/dialog/lib/dialog-actions/dialog-actions.component.d.ts +5 -5
  53. package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +16 -16
  54. package/dialog/lib/dialog-container/dialog-container.component.d.ts +24 -24
  55. package/dialog/lib/dialog-header/dialog-header.component.d.ts +9 -9
  56. package/dialog/lib/dialog-link/dialog-link.component.d.ts +5 -5
  57. package/dialog/lib/dialog-modal/dialog-modal.component.d.ts +12 -12
  58. package/dialog/lib/dialog-overlay/dialog-overlay.component.d.ts +22 -22
  59. package/dialog/lib/dialog.injector.d.ts +8 -8
  60. package/dialog/lib/dialog.insertion.d.ts +8 -8
  61. package/dialog/lib/dialog.interfaces.d.ts +3 -3
  62. package/dialog/lib/dialog.module.d.ts +19 -19
  63. package/dialog/lib/dialog.ref.d.ts +8 -8
  64. package/dialog/lib/dialog.service.d.ts +19 -19
  65. package/dialog/public_api.d.ts +9 -9
  66. package/elements/bravobit-bb-foundation-elements.d.ts +5 -5
  67. package/elements/lib/avatar/avatar.component.d.ts +25 -25
  68. package/elements/lib/button/button.component.d.ts +23 -23
  69. package/elements/lib/checkbox/checkbox.component.d.ts +27 -27
  70. package/elements/lib/date-picker/date-picker.component.d.ts +69 -69
  71. package/elements/lib/directives/addon.directive.d.ts +9 -9
  72. package/elements/lib/directives/autosize.directive.d.ts +18 -18
  73. package/elements/lib/directives/focus-trap.directive.d.ts +17 -17
  74. package/elements/lib/directives/focus.directive.d.ts +14 -14
  75. package/elements/lib/directives/form-submit.directive.d.ts +17 -17
  76. package/elements/lib/directives/input.directive.d.ts +38 -38
  77. package/elements/lib/directives/template.directive.d.ts +10 -10
  78. package/elements/lib/dropdown/dropdown.component.d.ts +21 -21
  79. package/elements/lib/elements.interfaces.d.ts +25 -25
  80. package/elements/lib/elements.module.d.ts +116 -116
  81. package/elements/lib/file-picker/file-picker.component.d.ts +49 -49
  82. package/elements/lib/form-control/form-control.component.d.ts +21 -21
  83. package/elements/lib/form-error/form-error.component.d.ts +29 -29
  84. package/elements/lib/form-group/form-group.component.d.ts +10 -10
  85. package/elements/lib/icon/icon.component.d.ts +22 -22
  86. package/elements/lib/image-picker/image-picker.component.d.ts +38 -38
  87. package/elements/lib/pipes/file-image.pipe.d.ts +13 -13
  88. package/elements/lib/pipes/file-size.pipe.d.ts +8 -8
  89. package/elements/lib/pipes/relative-time.pipe.d.ts +19 -19
  90. package/elements/lib/spinner/spinner.component.d.ts +12 -12
  91. package/elements/lib/tag/tag.component.d.ts +7 -7
  92. package/elements/public_api.d.ts +25 -25
  93. package/esm2020/auth/bravobit-bb-foundation-auth.mjs +4 -4
  94. package/esm2020/auth/lib/auth.interceptor.mjs +93 -94
  95. package/esm2020/auth/lib/auth.module.mjs +54 -54
  96. package/esm2020/auth/lib/auth.service.mjs +281 -276
  97. package/esm2020/auth/lib/auth.session.mjs +131 -131
  98. package/esm2020/auth/lib/directives/authenticated.directive.mjs +31 -31
  99. package/esm2020/auth/lib/directives/permission.directive.mjs +80 -80
  100. package/esm2020/auth/lib/directives/role.directive.mjs +37 -37
  101. package/esm2020/auth/lib/guards/anonymous.guard.mjs +34 -34
  102. package/esm2020/auth/lib/guards/authenticated.guard.mjs +35 -35
  103. package/esm2020/auth/lib/helpers/jwt.helper.mjs +69 -69
  104. package/esm2020/auth/lib/helpers/mapper.helper.mjs +35 -35
  105. package/esm2020/auth/lib/interfaces/config.interface.mjs +3 -3
  106. package/esm2020/auth/lib/interfaces/mapper.interface.mjs +2 -2
  107. package/esm2020/auth/lib/interfaces/provider.interface.mjs +2 -2
  108. package/esm2020/auth/lib/interfaces/token.interface.mjs +2 -2
  109. package/esm2020/auth/lib/permissions.service.mjs +56 -56
  110. package/esm2020/auth/lib/providers/email.provider.mjs +25 -25
  111. package/esm2020/auth/lib/providers/verify.provider.mjs +19 -19
  112. package/esm2020/auth/lib/tokens/use-authorization.token.mjs +3 -3
  113. package/esm2020/auth/public_api.mjs +19 -19
  114. package/esm2020/bravobit-bb-foundation.mjs +4 -4
  115. package/esm2020/collections/bravobit-bb-foundation-collections.mjs +4 -4
  116. package/esm2020/collections/lib/collection.mjs +102 -102
  117. package/esm2020/collections/lib/collections.module.mjs +54 -54
  118. package/esm2020/collections/lib/components/collections-pager/collections-pager.component.mjs +123 -123
  119. package/esm2020/collections/lib/components/collections-viewer/collections-viewer.component.mjs +31 -31
  120. package/esm2020/collections/lib/components/collections.directive.mjs +43 -43
  121. package/esm2020/collections/lib/interfaces/collection.interface.mjs +2 -2
  122. package/esm2020/collections/lib/providers/api-collection.provider.mjs +71 -71
  123. package/esm2020/collections/lib/providers/collection.provider.mjs +13 -13
  124. package/esm2020/collections/lib/providers/local-collection.provider.mjs +16 -16
  125. package/esm2020/collections/public_api.mjs +10 -10
  126. package/esm2020/controls/bravobit-bb-foundation-controls.mjs +4 -4
  127. package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +153 -153
  128. package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +48 -48
  129. package/esm2020/controls/lib/checkbox/checkbox.module.mjs +19 -19
  130. package/esm2020/controls/lib/controls.module.mjs +16 -16
  131. package/esm2020/controls/public_api.mjs +5 -5
  132. package/esm2020/dashboard/bravobit-bb-foundation-dashboard.mjs +4 -4
  133. package/esm2020/dashboard/lib/dashboard/dashboard.component.mjs +56 -56
  134. package/esm2020/dashboard/lib/dashboard-header/dashboard-header.component.mjs +30 -30
  135. package/esm2020/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +31 -31
  136. package/esm2020/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +29 -29
  137. package/esm2020/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +75 -75
  138. package/esm2020/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +99 -99
  139. package/esm2020/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +62 -62
  140. package/esm2020/dashboard/lib/dashboard.module.mjs +47 -47
  141. package/esm2020/dashboard/public_api.mjs +9 -9
  142. package/esm2020/dialog/bravobit-bb-foundation-dialog.mjs +4 -4
  143. package/esm2020/dialog/lib/dialog-actions/dialog-actions.component.mjs +12 -12
  144. package/esm2020/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +37 -37
  145. package/esm2020/dialog/lib/dialog-container/dialog-container.component.mjs +153 -153
  146. package/esm2020/dialog/lib/dialog-header/dialog-header.component.mjs +25 -25
  147. package/esm2020/dialog/lib/dialog-link/dialog-link.component.mjs +11 -11
  148. package/esm2020/dialog/lib/dialog-modal/dialog-modal.component.mjs +46 -46
  149. package/esm2020/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +134 -134
  150. package/esm2020/dialog/lib/dialog.injector.mjs +18 -18
  151. package/esm2020/dialog/lib/dialog.insertion.mjs +16 -16
  152. package/esm2020/dialog/lib/dialog.interfaces.mjs +3 -3
  153. package/esm2020/dialog/lib/dialog.module.mjs +70 -70
  154. package/esm2020/dialog/lib/dialog.ref.mjs +22 -22
  155. package/esm2020/dialog/lib/dialog.service.mjs +77 -77
  156. package/esm2020/dialog/public_api.mjs +10 -10
  157. package/esm2020/elements/bravobit-bb-foundation-elements.mjs +4 -4
  158. package/esm2020/elements/lib/avatar/avatar.component.mjs +145 -145
  159. package/esm2020/elements/lib/button/button.component.mjs +61 -61
  160. package/esm2020/elements/lib/checkbox/checkbox.component.mjs +73 -73
  161. package/esm2020/elements/lib/date-picker/date-picker.component.mjs +304 -304
  162. package/esm2020/elements/lib/directives/addon.directive.mjs +29 -29
  163. package/esm2020/elements/lib/directives/autosize.directive.mjs +72 -72
  164. package/esm2020/elements/lib/directives/focus-trap.directive.mjs +77 -77
  165. package/esm2020/elements/lib/directives/focus.directive.mjs +39 -39
  166. package/esm2020/elements/lib/directives/form-submit.directive.mjs +50 -50
  167. package/esm2020/elements/lib/directives/input.directive.mjs +136 -136
  168. package/esm2020/elements/lib/directives/template.directive.mjs +28 -28
  169. package/esm2020/elements/lib/dropdown/dropdown.component.mjs +100 -100
  170. package/esm2020/elements/lib/elements.interfaces.mjs +4 -4
  171. package/esm2020/elements/lib/elements.module.mjs +177 -177
  172. package/esm2020/elements/lib/file-picker/file-picker.component.mjs +236 -236
  173. package/esm2020/elements/lib/form-control/form-control.component.mjs +49 -49
  174. package/esm2020/elements/lib/form-error/form-error.component.mjs +108 -108
  175. package/esm2020/elements/lib/form-group/form-group.component.mjs +18 -18
  176. package/esm2020/elements/lib/icon/icon.component.mjs +102 -102
  177. package/esm2020/elements/lib/image-picker/image-picker.component.mjs +106 -106
  178. package/esm2020/elements/lib/pipes/file-image.pipe.mjs +42 -42
  179. package/esm2020/elements/lib/pipes/file-size.pipe.mjs +28 -28
  180. package/esm2020/elements/lib/pipes/relative-time.pipe.mjs +94 -94
  181. package/esm2020/elements/lib/spinner/spinner.component.mjs +25 -25
  182. package/esm2020/elements/lib/tag/tag.component.mjs +18 -18
  183. package/esm2020/elements/public_api.mjs +26 -26
  184. package/esm2020/http/bravobit-bb-foundation-http.mjs +4 -4
  185. package/esm2020/http/lib/classes/http.config.mjs +29 -29
  186. package/esm2020/http/lib/classes/http.error.mjs +20 -20
  187. package/esm2020/http/lib/http.interfaces.mjs +2 -2
  188. package/esm2020/http/lib/http.module.mjs +43 -43
  189. package/esm2020/http/lib/interceptors/base-url.interceptor.mjs +50 -50
  190. package/esm2020/http/lib/interceptors/error.interceptor.mjs +32 -32
  191. package/esm2020/http/public_api.mjs +7 -7
  192. package/esm2020/lib/core/miscellaneous/regex.mjs +5 -5
  193. package/esm2020/lib/core/miscellaneous/validator.mjs +85 -85
  194. package/esm2020/lib/core/mixins/can-disable.mjs +16 -16
  195. package/esm2020/lib/core/mixins/can-hide-errors.mjs +16 -16
  196. package/esm2020/lib/core/mixins/can-load.mjs +16 -16
  197. package/esm2020/lib/core/mixins/constructor.mjs +2 -2
  198. package/esm2020/lib/core/mixins/has-error.mjs +16 -16
  199. package/esm2020/lib/core/mixins/is-focused.mjs +16 -16
  200. package/esm2020/lib/core/mixins/is-grouped.mjs +16 -16
  201. package/esm2020/lib/core/mixins/is-readonly.mjs +16 -16
  202. package/esm2020/lib/core/mixins/is-required.mjs +16 -16
  203. package/esm2020/lib/core/services/clipboard.service.mjs +70 -70
  204. package/esm2020/lib/core/services/exif.service.mjs +163 -163
  205. package/esm2020/lib/core/services/file-loader.service.mjs +87 -87
  206. package/esm2020/lib/core/services/image-converter.service.mjs +123 -123
  207. package/esm2020/lib/core/services/languages.service.mjs +74 -74
  208. package/esm2020/lib/core/services/network.service.mjs +55 -55
  209. package/esm2020/lib/core/services/patch.service.mjs +63 -63
  210. package/esm2020/lib/core/services/platform.service.mjs +42 -42
  211. package/esm2020/lib/core/tokens/accept-language.token.mjs +3 -3
  212. package/esm2020/lib/core/tokens/base-url.token.mjs +3 -3
  213. package/esm2020/lib/core/tokens/cookie.token.mjs +3 -3
  214. package/esm2020/lib/core/tokens/location.token.mjs +6 -6
  215. package/esm2020/lib/core/tokens/navigator.token.mjs +6 -6
  216. package/esm2020/lib/core/tokens/window.token.mjs +12 -12
  217. package/esm2020/localize/bravobit-bb-foundation-localize.mjs +4 -4
  218. package/esm2020/localize/lib/functions/date.function.mjs +18 -18
  219. package/esm2020/localize/lib/functions/lowercase.function.mjs +13 -13
  220. package/esm2020/localize/lib/functions/uppercase.function.mjs +13 -13
  221. package/esm2020/localize/lib/handlers/missing.handler.mjs +15 -17
  222. package/esm2020/localize/lib/interfaces/config.interfaces.mjs +7 -10
  223. package/esm2020/localize/lib/interfaces/functions.interfaces.mjs +8 -8
  224. package/esm2020/localize/lib/interfaces/handlers.interfaces.mjs +2 -2
  225. package/esm2020/localize/lib/interfaces/options.interfaces.mjs +6 -6
  226. package/esm2020/localize/lib/localizations/dutch.localization.mjs +45 -53
  227. package/esm2020/localize/lib/localizations/english.localization.mjs +45 -53
  228. package/esm2020/localize/lib/localize.dictionary.mjs +26 -135
  229. package/esm2020/localize/lib/localize.module.mjs +71 -72
  230. package/esm2020/localize/lib/localize.pipe.mjs +49 -49
  231. package/esm2020/localize/lib/localize.service.mjs +205 -280
  232. package/esm2020/localize/lib/views/localize-string/localize-string.component.mjs +88 -88
  233. package/esm2020/localize/lib/views/localize-template-or-string.directive.mjs +28 -28
  234. package/esm2020/localize/lib/views/localize-template.directive.mjs +21 -21
  235. package/esm2020/localize/public_api.mjs +17 -18
  236. package/esm2020/notifications/bravobit-bb-foundation-notifications.mjs +4 -4
  237. package/esm2020/notifications/lib/notifications-item/notifications-item.component.mjs +100 -100
  238. package/esm2020/notifications/lib/notifications-list/notifications-list.component.mjs +47 -47
  239. package/esm2020/notifications/lib/notifications.animations.mjs +28 -28
  240. package/esm2020/notifications/lib/notifications.injector.mjs +18 -18
  241. package/esm2020/notifications/lib/notifications.interfaces.mjs +20 -20
  242. package/esm2020/notifications/lib/notifications.module.mjs +30 -30
  243. package/esm2020/notifications/lib/notifications.service.mjs +145 -145
  244. package/esm2020/notifications/public_api.mjs +4 -4
  245. package/esm2020/public_api.mjs +29 -29
  246. package/esm2020/recaptcha/bravobit-bb-foundation-recaptcha.mjs +4 -4
  247. package/esm2020/recaptcha/lib/recaptcha/recaptcha.component.mjs +185 -185
  248. package/esm2020/recaptcha/lib/recaptcha-loader.service.mjs +90 -90
  249. package/esm2020/recaptcha/lib/recaptcha.interface.mjs +3 -3
  250. package/esm2020/recaptcha/lib/recaptcha.module.mjs +27 -27
  251. package/esm2020/recaptcha/public_api.mjs +5 -5
  252. package/esm2020/rxjs/bravobit-bb-foundation-rxjs.mjs +4 -4
  253. package/esm2020/rxjs/lib/operators/combine-latest-map.operator.mjs +10 -10
  254. package/esm2020/rxjs/lib/operators/filter-nil.operator.mjs +5 -5
  255. package/esm2020/rxjs/public_api.mjs +3 -3
  256. package/esm2020/storage/bravobit-bb-foundation-storage.mjs +4 -4
  257. package/esm2020/storage/lib/interfaces/attributes.interface.mjs +2 -2
  258. package/esm2020/storage/lib/interfaces/memory.interface.mjs +2 -2
  259. package/esm2020/storage/lib/interfaces/strategy.interface.mjs +2 -2
  260. package/esm2020/storage/lib/storage.service.mjs +109 -109
  261. package/esm2020/storage/lib/strategies/cookie-storage.strategy.mjs +142 -142
  262. package/esm2020/storage/lib/strategies/memory-storage.strategy.mjs +56 -56
  263. package/esm2020/storage/lib/strategies/polyfill-storage.strategy.mjs +102 -102
  264. package/esm2020/storage/public_api.mjs +8 -8
  265. package/esm2020/table/bravobit-bb-foundation-table.mjs +4 -4
  266. package/esm2020/table/lib/components/table/table.component.mjs +191 -191
  267. package/esm2020/table/lib/components/table-cell/table-cell.component.mjs +11 -11
  268. package/esm2020/table/lib/components/table-header-cell/table-header-cell.component.mjs +131 -131
  269. package/esm2020/table/lib/components/table-pager/table-pager.component.mjs +136 -136
  270. package/esm2020/table/lib/data/datasource.data.mjs +32 -32
  271. package/esm2020/table/lib/data/generic.data.mjs +72 -72
  272. package/esm2020/table/lib/interfaces/datasource.interface.mjs +2 -2
  273. package/esm2020/table/lib/interfaces/table.interfaces.mjs +2 -2
  274. package/esm2020/table/lib/table.module.mjs +42 -42
  275. package/esm2020/table/public_api.mjs +10 -10
  276. package/fesm2015/bravobit-bb-foundation-auth.mjs +930 -926
  277. package/fesm2015/bravobit-bb-foundation-auth.mjs.map +1 -1
  278. package/fesm2015/bravobit-bb-foundation-collections.mjs +423 -423
  279. package/fesm2015/bravobit-bb-foundation-collections.mjs.map +1 -1
  280. package/fesm2015/bravobit-bb-foundation-controls.mjs +216 -216
  281. package/fesm2015/bravobit-bb-foundation-controls.mjs.map +1 -1
  282. package/fesm2015/bravobit-bb-foundation-dashboard.mjs +382 -382
  283. package/fesm2015/bravobit-bb-foundation-dashboard.mjs.map +1 -1
  284. package/fesm2015/bravobit-bb-foundation-dialog.mjs +542 -542
  285. package/fesm2015/bravobit-bb-foundation-dialog.mjs.map +1 -1
  286. package/fesm2015/bravobit-bb-foundation-elements.mjs +1971 -1971
  287. package/fesm2015/bravobit-bb-foundation-elements.mjs.map +1 -1
  288. package/fesm2015/bravobit-bb-foundation-http.mjs +156 -156
  289. package/fesm2015/bravobit-bb-foundation-http.mjs.map +1 -1
  290. package/fesm2015/bravobit-bb-foundation-localize.mjs +611 -812
  291. package/fesm2015/bravobit-bb-foundation-localize.mjs.map +1 -1
  292. package/fesm2015/bravobit-bb-foundation-notifications.mjs +348 -348
  293. package/fesm2015/bravobit-bb-foundation-notifications.mjs.map +1 -1
  294. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs +290 -290
  295. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
  296. package/fesm2015/bravobit-bb-foundation-rxjs.mjs +7 -7
  297. package/fesm2015/bravobit-bb-foundation-rxjs.mjs.map +1 -1
  298. package/fesm2015/bravobit-bb-foundation-storage.mjs +401 -401
  299. package/fesm2015/bravobit-bb-foundation-storage.mjs.map +1 -1
  300. package/fesm2015/bravobit-bb-foundation-table.mjs +571 -571
  301. package/fesm2015/bravobit-bb-foundation-table.mjs.map +1 -1
  302. package/fesm2015/bravobit-bb-foundation.mjs +860 -860
  303. package/fesm2015/bravobit-bb-foundation.mjs.map +1 -1
  304. package/fesm2020/bravobit-bb-foundation-auth.mjs +882 -878
  305. package/fesm2020/bravobit-bb-foundation-auth.mjs.map +1 -1
  306. package/fesm2020/bravobit-bb-foundation-collections.mjs +413 -413
  307. package/fesm2020/bravobit-bb-foundation-collections.mjs.map +1 -1
  308. package/fesm2020/bravobit-bb-foundation-controls.mjs +214 -214
  309. package/fesm2020/bravobit-bb-foundation-controls.mjs.map +1 -1
  310. package/fesm2020/bravobit-bb-foundation-dashboard.mjs +370 -370
  311. package/fesm2020/bravobit-bb-foundation-dashboard.mjs.map +1 -1
  312. package/fesm2020/bravobit-bb-foundation-dialog.mjs +541 -541
  313. package/fesm2020/bravobit-bb-foundation-dialog.mjs.map +1 -1
  314. package/fesm2020/bravobit-bb-foundation-elements.mjs +1928 -1928
  315. package/fesm2020/bravobit-bb-foundation-elements.mjs.map +1 -1
  316. package/fesm2020/bravobit-bb-foundation-http.mjs +148 -148
  317. package/fesm2020/bravobit-bb-foundation-http.mjs.map +1 -1
  318. package/fesm2020/bravobit-bb-foundation-localize.mjs +590 -798
  319. package/fesm2020/bravobit-bb-foundation-localize.mjs.map +1 -1
  320. package/fesm2020/bravobit-bb-foundation-notifications.mjs +346 -346
  321. package/fesm2020/bravobit-bb-foundation-notifications.mjs.map +1 -1
  322. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs +280 -280
  323. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
  324. package/fesm2020/bravobit-bb-foundation-rxjs.mjs +10 -10
  325. package/fesm2020/bravobit-bb-foundation-rxjs.mjs.map +1 -1
  326. package/fesm2020/bravobit-bb-foundation-storage.mjs +396 -396
  327. package/fesm2020/bravobit-bb-foundation-storage.mjs.map +1 -1
  328. package/fesm2020/bravobit-bb-foundation-table.mjs +560 -560
  329. package/fesm2020/bravobit-bb-foundation-table.mjs.map +1 -1
  330. package/fesm2020/bravobit-bb-foundation.mjs +832 -832
  331. package/fesm2020/bravobit-bb-foundation.mjs.map +1 -1
  332. package/http/bravobit-bb-foundation-http.d.ts +5 -5
  333. package/http/lib/classes/http.config.d.ts +9 -9
  334. package/http/lib/classes/http.error.d.ts +7 -7
  335. package/http/lib/http.interfaces.d.ts +12 -12
  336. package/http/lib/http.module.d.ts +15 -15
  337. package/http/lib/interceptors/base-url.interceptor.d.ts +15 -15
  338. package/http/lib/interceptors/error.interceptor.d.ts +11 -11
  339. package/http/public_api.d.ts +6 -6
  340. package/lib/core/miscellaneous/regex.d.ts +4 -4
  341. package/lib/core/miscellaneous/validator.d.ts +13 -13
  342. package/lib/core/mixins/can-disable.d.ts +6 -6
  343. package/lib/core/mixins/can-hide-errors.d.ts +6 -6
  344. package/lib/core/mixins/can-load.d.ts +6 -6
  345. package/lib/core/mixins/constructor.d.ts +1 -1
  346. package/lib/core/mixins/has-error.d.ts +6 -6
  347. package/lib/core/mixins/is-focused.d.ts +6 -6
  348. package/lib/core/mixins/is-grouped.d.ts +6 -6
  349. package/lib/core/mixins/is-readonly.d.ts +6 -6
  350. package/lib/core/mixins/is-required.d.ts +6 -6
  351. package/lib/core/services/clipboard.service.d.ts +18 -18
  352. package/lib/core/services/exif.service.d.ts +15 -15
  353. package/lib/core/services/file-loader.service.d.ts +13 -13
  354. package/lib/core/services/image-converter.service.d.ts +21 -21
  355. package/lib/core/services/languages.service.d.ts +16 -16
  356. package/lib/core/services/network.service.d.ts +14 -14
  357. package/lib/core/services/patch.service.d.ts +16 -16
  358. package/lib/core/services/platform.service.d.ts +18 -18
  359. package/lib/core/tokens/accept-language.token.d.ts +2 -2
  360. package/lib/core/tokens/base-url.token.d.ts +2 -2
  361. package/lib/core/tokens/cookie.token.d.ts +2 -2
  362. package/lib/core/tokens/location.token.d.ts +2 -2
  363. package/lib/core/tokens/navigator.token.d.ts +2 -2
  364. package/lib/core/tokens/window.token.d.ts +2 -2
  365. package/localize/bravobit-bb-foundation-localize.d.ts +5 -5
  366. package/localize/lib/functions/date.function.d.ts +5 -5
  367. package/localize/lib/functions/lowercase.function.d.ts +5 -5
  368. package/localize/lib/functions/uppercase.function.d.ts +5 -5
  369. package/localize/lib/handlers/missing.handler.d.ts +6 -6
  370. package/localize/lib/interfaces/config.interfaces.d.ts +18 -9
  371. package/localize/lib/interfaces/functions.interfaces.d.ts +9 -9
  372. package/localize/lib/interfaces/handlers.interfaces.d.ts +6 -6
  373. package/localize/lib/interfaces/options.interfaces.d.ts +10 -10
  374. package/localize/lib/localizations/dutch.localization.d.ts +44 -51
  375. package/localize/lib/localizations/english.localization.d.ts +44 -51
  376. package/localize/lib/localize.dictionary.d.ts +7 -24
  377. package/localize/lib/localize.module.d.ts +17 -18
  378. package/localize/lib/localize.pipe.d.ts +12 -12
  379. package/localize/lib/localize.service.d.ts +40 -52
  380. package/localize/lib/views/localize-string/localize-string.component.d.ts +23 -23
  381. package/localize/lib/views/localize-template-or-string.directive.d.ts +10 -10
  382. package/localize/lib/views/localize-template.directive.d.ts +9 -9
  383. package/localize/public_api.d.ts +16 -17
  384. package/notifications/bravobit-bb-foundation-notifications.d.ts +5 -5
  385. package/notifications/lib/notifications-item/notifications-item.component.d.ts +34 -34
  386. package/notifications/lib/notifications-list/notifications-list.component.d.ts +16 -16
  387. package/notifications/lib/notifications.animations.d.ts +1 -1
  388. package/notifications/lib/notifications.injector.d.ts +8 -8
  389. package/notifications/lib/notifications.interfaces.d.ts +49 -49
  390. package/notifications/lib/notifications.module.d.ts +13 -13
  391. package/notifications/lib/notifications.service.d.ts +34 -34
  392. package/notifications/public_api.d.ts +3 -3
  393. package/package.json +6 -6
  394. package/public_api.d.ts +25 -25
  395. package/recaptcha/bravobit-bb-foundation-recaptcha.d.ts +5 -5
  396. package/recaptcha/lib/recaptcha/recaptcha.component.d.ts +47 -47
  397. package/recaptcha/lib/recaptcha-loader.service.d.ts +22 -22
  398. package/recaptcha/lib/recaptcha.interface.d.ts +14 -14
  399. package/recaptcha/lib/recaptcha.module.d.ts +10 -10
  400. package/recaptcha/public_api.d.ts +4 -4
  401. package/rxjs/bravobit-bb-foundation-rxjs.d.ts +5 -5
  402. package/rxjs/lib/operators/combine-latest-map.operator.d.ts +8 -8
  403. package/rxjs/lib/operators/filter-nil.operator.d.ts +1 -1
  404. package/rxjs/public_api.d.ts +2 -2
  405. package/storage/bravobit-bb-foundation-storage.d.ts +5 -5
  406. package/storage/lib/interfaces/attributes.interface.d.ts +13 -13
  407. package/storage/lib/interfaces/memory.interface.d.ts +7 -7
  408. package/storage/lib/interfaces/strategy.interface.d.ts +17 -17
  409. package/storage/lib/storage.service.d.ts +26 -26
  410. package/storage/lib/strategies/cookie-storage.strategy.d.ts +20 -20
  411. package/storage/lib/strategies/memory-storage.strategy.d.ts +11 -11
  412. package/storage/lib/strategies/polyfill-storage.strategy.d.ts +15 -15
  413. package/storage/public_api.d.ts +7 -7
  414. package/table/bravobit-bb-foundation-table.d.ts +5 -5
  415. package/table/lib/components/table/table.component.d.ts +56 -56
  416. package/table/lib/components/table-cell/table-cell.component.d.ts +5 -5
  417. package/table/lib/components/table-header-cell/table-header-cell.component.d.ts +29 -29
  418. package/table/lib/components/table-pager/table-pager.component.d.ts +41 -41
  419. package/table/lib/data/datasource.data.d.ts +14 -14
  420. package/table/lib/data/generic.data.d.ts +23 -23
  421. package/table/lib/interfaces/datasource.interface.d.ts +17 -17
  422. package/table/lib/interfaces/table.interfaces.d.ts +1 -1
  423. package/table/lib/table.module.d.ts +14 -14
  424. package/table/public_api.d.ts +9 -9
  425. package/esm2020/localize/lib/interfaces/dictionary.interfaces.mjs +0 -8
  426. package/localize/lib/interfaces/dictionary.interfaces.d.ts +0 -12
@@ -1,891 +1,891 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { PLATFORM_ID, Injectable, Inject, InjectionToken, Optional, inject } from '@angular/core';
3
3
  import { isPlatformBrowser, DOCUMENT, formatDate } from '@angular/common';
4
- import { mapTo, map, distinctUntilChanged, shareReplay, debounceTime, startWith } from 'rxjs/operators';
4
+ import { map, distinctUntilChanged, shareReplay, debounceTime, startWith } from 'rxjs/operators';
5
5
  import { of, fromEvent, Observable, merge, Subscription } from 'rxjs';
6
6
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
7
7
 
8
- let hasV8BreakIterator;
9
- try {
10
- hasV8BreakIterator = (typeof Intl !== 'undefined' && Intl.v8BreakIterator);
11
- }
12
- catch {
13
- hasV8BreakIterator = false;
14
- }
15
- class Platform {
16
- constructor(_platformId) {
17
- this._platformId = _platformId;
18
- // Browser check.
19
- this.isBrowser = this._platformId
20
- ? isPlatformBrowser(this._platformId)
21
- : typeof document === 'object' && !!document;
22
- // Is checks.
23
- this.isEdge = this.isBrowser && /(edge)/i.test(navigator.userAgent);
24
- this.isTrident = this.isBrowser && /(msie|trident)/i.test(navigator.userAgent);
25
- this.isBlink = this.isBrowser && (!!(window.chrome || hasV8BreakIterator) && typeof CSS !== 'undefined' && !this.isEdge && !this.isTrident);
26
- this.isWebkit = this.isBrowser && /AppleWebKit/i.test(navigator.userAgent) && !this.isBlink && !this.isEdge && !this.isTrident;
27
- this.isChrome = this.isBrowser && /Google Inc./.test(navigator.vendor);
28
- this.isFirefox = this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);
29
- this.isSafari = this.isBrowser && /safari/i.test(navigator.userAgent) && this.isWebkit;
30
- this.isAndroid = this.isBrowser && /android/i.test(navigator.userAgent) && !this.isTrident;
31
- this.isIos = this.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);
32
- this.isDesktop = this.isBrowser && !(/(iPhone|iPod|iPad|Android|BlackBerry|IEMobile)/.test(navigator.userAgent));
33
- }
34
- }
35
- Platform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Platform, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
36
- Platform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Platform, providedIn: 'root' });
37
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Platform, decorators: [{
38
- type: Injectable,
39
- args: [{
40
- providedIn: 'root'
41
- }]
42
- }], ctorParameters: function () { return [{ type: Object, decorators: [{
43
- type: Inject,
44
- args: [PLATFORM_ID]
8
+ let hasV8BreakIterator;
9
+ try {
10
+ hasV8BreakIterator = (typeof Intl !== 'undefined' && Intl.v8BreakIterator);
11
+ }
12
+ catch {
13
+ hasV8BreakIterator = false;
14
+ }
15
+ class Platform {
16
+ constructor(_platformId) {
17
+ this._platformId = _platformId;
18
+ // Browser check.
19
+ this.isBrowser = this._platformId
20
+ ? isPlatformBrowser(this._platformId)
21
+ : typeof document === 'object' && !!document;
22
+ // Is checks.
23
+ this.isEdge = this.isBrowser && /(edge)/i.test(navigator.userAgent);
24
+ this.isTrident = this.isBrowser && /(msie|trident)/i.test(navigator.userAgent);
25
+ this.isBlink = this.isBrowser && (!!(window.chrome || hasV8BreakIterator) && typeof CSS !== 'undefined' && !this.isEdge && !this.isTrident);
26
+ this.isWebkit = this.isBrowser && /AppleWebKit/i.test(navigator.userAgent) && !this.isBlink && !this.isEdge && !this.isTrident;
27
+ this.isChrome = this.isBrowser && /Google Inc./.test(navigator.vendor);
28
+ this.isFirefox = this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);
29
+ this.isSafari = this.isBrowser && /safari/i.test(navigator.userAgent) && this.isWebkit;
30
+ this.isAndroid = this.isBrowser && /android/i.test(navigator.userAgent) && !this.isTrident;
31
+ this.isIos = this.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);
32
+ this.isDesktop = this.isBrowser && !(/(iPhone|iPod|iPad|Android|BlackBerry|IEMobile)/.test(navigator.userAgent));
33
+ }
34
+ }
35
+ Platform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Platform, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
36
+ Platform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Platform, providedIn: 'root' });
37
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Platform, decorators: [{
38
+ type: Injectable,
39
+ args: [{
40
+ providedIn: 'root'
41
+ }]
42
+ }], ctorParameters: function () { return [{ type: Object, decorators: [{
43
+ type: Inject,
44
+ args: [PLATFORM_ID]
45
45
  }] }]; } });
46
46
 
47
- class FileLoader {
48
- constructor() {
49
- this.isFile = (input) => {
50
- return 'File' in window && input instanceof File;
51
- };
52
- this.isBlob = (input) => {
53
- return 'Blob' in window && input instanceof Blob;
54
- };
55
- this.blobToFile = (blob, fileName) => {
56
- const anyBlob = blob;
57
- anyBlob.lastModifiedDate = new Date();
58
- anyBlob.name = fileName;
59
- return anyBlob;
60
- };
61
- }
62
- fromDataUrl(value, name = 'file') {
63
- if (!value) {
64
- return null;
65
- }
66
- try {
67
- // Convert base64 to raw binary data held in a string.
68
- const byteString = window.atob(value.split(',')[1]);
69
- // Separate out the mime component.
70
- const mimeString = value
71
- .split(',')[0]
72
- .split(':')[1]
73
- .split(';')[0];
74
- // Write the bytes of the string to an ArrayBuffer.
75
- const arrayBuffer = new ArrayBuffer(byteString.length);
76
- const uint8Array = new Uint8Array(arrayBuffer);
77
- for (let index = 0; index < byteString.length; index++) {
78
- uint8Array[index] = byteString.charCodeAt(index);
79
- }
80
- const dataView = new DataView(arrayBuffer);
81
- const blob = new Blob([dataView.buffer], { type: mimeString });
82
- return this.createFile(blob, name);
83
- }
84
- catch {
85
- return null;
86
- }
87
- }
88
- asDataUrl(file) {
89
- return this.read(file, 'dataurl');
90
- }
91
- asArrayBuffer(file) {
92
- return this.read(file, 'arraybuffer');
93
- }
94
- async read(file, type) {
95
- return new Promise((resolve, reject) => {
96
- const isFileLike = this.isFile(file) || this.isBlob(file);
97
- if (!file || !isFileLike) {
98
- return reject('Invalid file');
99
- }
100
- const reader = new FileReader();
101
- reader.onerror = () => reject('Error file read');
102
- reader.onabort = () => reject('Abort file read');
103
- reader.onload = () => {
104
- const result = reader.result;
105
- return resolve(result);
106
- };
107
- if (type === 'dataurl') {
108
- reader.readAsDataURL(file);
109
- }
110
- else if (type === 'arraybuffer') {
111
- reader.readAsArrayBuffer(file);
112
- }
113
- });
114
- }
115
- createFile(blob, name) {
116
- if (!navigator['msSaveBlob']) {
117
- return new File([blob], name, { lastModified: Date.now(), type: blob?.type });
118
- }
119
- const blobFile = new Blob([blob], { type: blob?.type });
120
- return this.blobToFile(blobFile, name);
121
- }
122
- }
123
- FileLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: FileLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
124
- FileLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: FileLoader, providedIn: 'root' });
125
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: FileLoader, decorators: [{
126
- type: Injectable,
127
- args: [{
128
- providedIn: 'root'
129
- }]
47
+ class FileLoader {
48
+ constructor() {
49
+ this.isFile = (input) => {
50
+ return 'File' in window && input instanceof File;
51
+ };
52
+ this.isBlob = (input) => {
53
+ return 'Blob' in window && input instanceof Blob;
54
+ };
55
+ this.blobToFile = (blob, fileName) => {
56
+ const anyBlob = blob;
57
+ anyBlob.lastModifiedDate = new Date();
58
+ anyBlob.name = fileName;
59
+ return anyBlob;
60
+ };
61
+ }
62
+ fromDataUrl(value, name = 'file') {
63
+ if (!value) {
64
+ return null;
65
+ }
66
+ try {
67
+ // Convert base64 to raw binary data held in a string.
68
+ const byteString = window.atob(value.split(',')[1]);
69
+ // Separate out the mime component.
70
+ const mimeString = value
71
+ .split(',')[0]
72
+ .split(':')[1]
73
+ .split(';')[0];
74
+ // Write the bytes of the string to an ArrayBuffer.
75
+ const arrayBuffer = new ArrayBuffer(byteString.length);
76
+ const uint8Array = new Uint8Array(arrayBuffer);
77
+ for (let index = 0; index < byteString.length; index++) {
78
+ uint8Array[index] = byteString.charCodeAt(index);
79
+ }
80
+ const dataView = new DataView(arrayBuffer);
81
+ const blob = new Blob([dataView.buffer], { type: mimeString });
82
+ return this.createFile(blob, name);
83
+ }
84
+ catch {
85
+ return null;
86
+ }
87
+ }
88
+ asDataUrl(file) {
89
+ return this.read(file, 'dataurl');
90
+ }
91
+ asArrayBuffer(file) {
92
+ return this.read(file, 'arraybuffer');
93
+ }
94
+ async read(file, type) {
95
+ return new Promise((resolve, reject) => {
96
+ const isFileLike = this.isFile(file) || this.isBlob(file);
97
+ if (!file || !isFileLike) {
98
+ return reject('Invalid file');
99
+ }
100
+ const reader = new FileReader();
101
+ reader.onerror = () => reject('Error file read');
102
+ reader.onabort = () => reject('Abort file read');
103
+ reader.onload = () => {
104
+ const result = reader.result;
105
+ return resolve(result);
106
+ };
107
+ if (type === 'dataurl') {
108
+ reader.readAsDataURL(file);
109
+ }
110
+ else if (type === 'arraybuffer') {
111
+ reader.readAsArrayBuffer(file);
112
+ }
113
+ });
114
+ }
115
+ createFile(blob, name) {
116
+ if (!navigator['msSaveBlob']) {
117
+ return new File([blob], name, { lastModified: Date.now(), type: blob?.type });
118
+ }
119
+ const blobFile = new Blob([blob], { type: blob?.type });
120
+ return this.blobToFile(blobFile, name);
121
+ }
122
+ }
123
+ FileLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: FileLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
124
+ FileLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: FileLoader, providedIn: 'root' });
125
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: FileLoader, decorators: [{
126
+ type: Injectable,
127
+ args: [{
128
+ providedIn: 'root'
129
+ }]
130
130
  }] });
131
131
 
132
- class Exif {
133
- constructor(_platform, _fileLoader) {
134
- this._platform = _platform;
135
- this._fileLoader = _fileLoader;
136
- this.transformImage = (image, type, orientation, quality = 100) => {
137
- // Create the canvas and context.
138
- const canvas = document.createElement('canvas');
139
- const context = canvas.getContext('2d');
140
- // Validate the context exists.
141
- if (!context) {
142
- return null;
143
- }
144
- // Set the canvas size based on the image.
145
- const { width, height } = image;
146
- canvas.width = width;
147
- canvas.height = height;
148
- // Validate the orientation is correct
149
- // else flip the canvas sizes.
150
- if (4 < orientation && orientation < 9) {
151
- canvas.width = height;
152
- canvas.height = width;
153
- }
154
- // Transform the context based on the orientation.
155
- switch (orientation) {
156
- case 2:
157
- context.transform(-1, 0, 0, 1, width, 0);
158
- break;
159
- case 3:
160
- context.transform(-1, 0, 0, -1, width, height);
161
- break;
162
- case 4:
163
- context.transform(1, 0, 0, -1, 0, height);
164
- break;
165
- case 5:
166
- context.transform(0, 1, 1, 0, 0, 0);
167
- break;
168
- case 6:
169
- context.transform(0, 1, -1, 0, height, 0);
170
- break;
171
- case 7:
172
- context.transform(0, -1, -1, 0, height, width);
173
- break;
174
- case 8:
175
- context.transform(0, -1, 1, 0, 0, width);
176
- break;
177
- default:
178
- break;
179
- }
180
- // Draw the image on the context and return the data URL.
181
- context.drawImage(image, 0, 0, width, height);
182
- return canvas.toDataURL(type, quality / 100);
183
- };
184
- this.getSupportedCanvasType = (fileType) => {
185
- switch (fileType) {
186
- case 'image/jpeg':
187
- case 'image/jpg':
188
- return 'image/jpeg';
189
- case 'image/x-windows-bmp':
190
- case 'image/bmp':
191
- return 'image/bmp';
192
- default:
193
- return 'image/png';
194
- }
195
- };
196
- this.getOrientation = (buffer) => {
197
- // Create a new data view.
198
- const view = new DataView(buffer);
199
- if (view.getUint16(0, false) !== 0xFFD8) {
200
- return -2;
201
- }
202
- const length = view.byteLength;
203
- let offset = 2;
204
- while (offset < length) {
205
- if (view.getUint16(offset + 2, false) <= 8) {
206
- return -1;
207
- }
208
- const marker = view.getUint16(offset, false);
209
- offset += 2;
210
- if (marker === 0xFFE1) {
211
- if (view.getUint32(offset += 2, false) !== 0x45786966) {
212
- return -1;
213
- }
214
- const little = view.getUint16(offset += 6, false) === 0x4949;
215
- offset += view.getUint32(offset + 4, little);
216
- const tags = view.getUint16(offset, little);
217
- offset += 2;
218
- for (let index = 0; index < tags; index++) {
219
- if (view.getUint16(offset + index * 12, little) === 0x0112) {
220
- return view.getUint16(offset + index * 12 + 8, little);
221
- }
222
- }
223
- }
224
- else if ((marker & 0xFF00) !== 0xFF00) {
225
- break;
226
- }
227
- else {
228
- offset += view.getUint16(offset, false);
229
- }
230
- }
231
- return -1;
232
- };
233
- }
234
- async strip(file, quality = 100) {
235
- // Validate we are on a browser.
236
- if (!this._platform.isBrowser) {
237
- return file;
238
- }
239
- // Validate the file exists and is
240
- // an instance of a File object.
241
- if (!file || !(file instanceof File)) {
242
- return file;
243
- }
244
- // Only jpeg images need correction.
245
- if (!['image/jpeg'].includes(file.type)) {
246
- return file;
247
- }
248
- try {
249
- // Read the file as an array buffer and data url.
250
- const arrayBuffer = await this._fileLoader.asArrayBuffer(file);
251
- const dataUrl = await this._fileLoader.asDataUrl(file);
252
- // Create an image element.
253
- const imageElement = await this.createImageElement(dataUrl);
254
- // Get the orientation by using the buffer.
255
- const orientation = this.getOrientation(arrayBuffer);
256
- // Transform the image to remove the orientation.
257
- const canvasType = this.getSupportedCanvasType(file.type);
258
- const imageUrl = this.transformImage(imageElement, canvasType, orientation, quality);
259
- // Validate the image url exists.
260
- if (!imageUrl) {
261
- return file;
262
- }
263
- // Transform the image url to a file.
264
- return this._fileLoader.fromDataUrl(imageUrl, file.name);
265
- }
266
- catch {
267
- // When something goes wrong we
268
- // just return the default file.
269
- return file;
270
- }
271
- }
272
- async createImageElement(dataUrl) {
273
- return new Promise((resolve, reject) => {
274
- const image = new Image();
275
- image.src = dataUrl;
276
- image.onerror = () => reject('Error image create');
277
- image.onabort = () => reject('Abort image create');
278
- image.onload = () => resolve(image);
279
- });
280
- }
281
- }
282
- Exif.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Exif, deps: [{ token: Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable });
283
- Exif.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Exif, providedIn: 'root' });
284
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Exif, decorators: [{
285
- type: Injectable,
286
- args: [{
287
- providedIn: 'root'
288
- }]
132
+ class Exif {
133
+ constructor(_platform, _fileLoader) {
134
+ this._platform = _platform;
135
+ this._fileLoader = _fileLoader;
136
+ this.transformImage = (image, type, orientation, quality = 100) => {
137
+ // Create the canvas and context.
138
+ const canvas = document.createElement('canvas');
139
+ const context = canvas.getContext('2d');
140
+ // Validate the context exists.
141
+ if (!context) {
142
+ return null;
143
+ }
144
+ // Set the canvas size based on the image.
145
+ const { width, height } = image;
146
+ canvas.width = width;
147
+ canvas.height = height;
148
+ // Validate the orientation is correct
149
+ // else flip the canvas sizes.
150
+ if (4 < orientation && orientation < 9) {
151
+ canvas.width = height;
152
+ canvas.height = width;
153
+ }
154
+ // Transform the context based on the orientation.
155
+ switch (orientation) {
156
+ case 2:
157
+ context.transform(-1, 0, 0, 1, width, 0);
158
+ break;
159
+ case 3:
160
+ context.transform(-1, 0, 0, -1, width, height);
161
+ break;
162
+ case 4:
163
+ context.transform(1, 0, 0, -1, 0, height);
164
+ break;
165
+ case 5:
166
+ context.transform(0, 1, 1, 0, 0, 0);
167
+ break;
168
+ case 6:
169
+ context.transform(0, 1, -1, 0, height, 0);
170
+ break;
171
+ case 7:
172
+ context.transform(0, -1, -1, 0, height, width);
173
+ break;
174
+ case 8:
175
+ context.transform(0, -1, 1, 0, 0, width);
176
+ break;
177
+ default:
178
+ break;
179
+ }
180
+ // Draw the image on the context and return the data URL.
181
+ context.drawImage(image, 0, 0, width, height);
182
+ return canvas.toDataURL(type, quality / 100);
183
+ };
184
+ this.getSupportedCanvasType = (fileType) => {
185
+ switch (fileType) {
186
+ case 'image/jpeg':
187
+ case 'image/jpg':
188
+ return 'image/jpeg';
189
+ case 'image/x-windows-bmp':
190
+ case 'image/bmp':
191
+ return 'image/bmp';
192
+ default:
193
+ return 'image/png';
194
+ }
195
+ };
196
+ this.getOrientation = (buffer) => {
197
+ // Create a new data view.
198
+ const view = new DataView(buffer);
199
+ if (view.getUint16(0, false) !== 0xFFD8) {
200
+ return -2;
201
+ }
202
+ const length = view.byteLength;
203
+ let offset = 2;
204
+ while (offset < length) {
205
+ if (view.getUint16(offset + 2, false) <= 8) {
206
+ return -1;
207
+ }
208
+ const marker = view.getUint16(offset, false);
209
+ offset += 2;
210
+ if (marker === 0xFFE1) {
211
+ if (view.getUint32(offset += 2, false) !== 0x45786966) {
212
+ return -1;
213
+ }
214
+ const little = view.getUint16(offset += 6, false) === 0x4949;
215
+ offset += view.getUint32(offset + 4, little);
216
+ const tags = view.getUint16(offset, little);
217
+ offset += 2;
218
+ for (let index = 0; index < tags; index++) {
219
+ if (view.getUint16(offset + index * 12, little) === 0x0112) {
220
+ return view.getUint16(offset + index * 12 + 8, little);
221
+ }
222
+ }
223
+ }
224
+ else if ((marker & 0xFF00) !== 0xFF00) {
225
+ break;
226
+ }
227
+ else {
228
+ offset += view.getUint16(offset, false);
229
+ }
230
+ }
231
+ return -1;
232
+ };
233
+ }
234
+ async strip(file, quality = 100) {
235
+ // Validate we are on a browser.
236
+ if (!this._platform.isBrowser) {
237
+ return file;
238
+ }
239
+ // Validate the file exists and is
240
+ // an instance of a File object.
241
+ if (!file || !(file instanceof File)) {
242
+ return file;
243
+ }
244
+ // Only jpeg images need correction.
245
+ if (!['image/jpeg'].includes(file.type)) {
246
+ return file;
247
+ }
248
+ try {
249
+ // Read the file as an array buffer and data url.
250
+ const arrayBuffer = await this._fileLoader.asArrayBuffer(file);
251
+ const dataUrl = await this._fileLoader.asDataUrl(file);
252
+ // Create an image element.
253
+ const imageElement = await this.createImageElement(dataUrl);
254
+ // Get the orientation by using the buffer.
255
+ const orientation = this.getOrientation(arrayBuffer);
256
+ // Transform the image to remove the orientation.
257
+ const canvasType = this.getSupportedCanvasType(file.type);
258
+ const imageUrl = this.transformImage(imageElement, canvasType, orientation, quality);
259
+ // Validate the image url exists.
260
+ if (!imageUrl) {
261
+ return file;
262
+ }
263
+ // Transform the image url to a file.
264
+ return this._fileLoader.fromDataUrl(imageUrl, file.name);
265
+ }
266
+ catch {
267
+ // When something goes wrong we
268
+ // just return the default file.
269
+ return file;
270
+ }
271
+ }
272
+ async createImageElement(dataUrl) {
273
+ return new Promise((resolve, reject) => {
274
+ const image = new Image();
275
+ image.src = dataUrl;
276
+ image.onerror = () => reject('Error image create');
277
+ image.onabort = () => reject('Abort image create');
278
+ image.onload = () => resolve(image);
279
+ });
280
+ }
281
+ }
282
+ Exif.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Exif, deps: [{ token: Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable });
283
+ Exif.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Exif, providedIn: 'root' });
284
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Exif, decorators: [{
285
+ type: Injectable,
286
+ args: [{
287
+ providedIn: 'root'
288
+ }]
289
289
  }], ctorParameters: function () { return [{ type: Platform }, { type: FileLoader }]; } });
290
290
 
291
- class ImageConverter {
292
- constructor(_exif, _platform, _fileLoader) {
293
- this._exif = _exif;
294
- this._platform = _platform;
295
- this._fileLoader = _fileLoader;
296
- // Data.
297
- this._types = ['image/png', 'image/jpeg'];
298
- this.calculateOffsetAndDimensions = (image, canvasWidth, canvasHeight) => {
299
- const originalWidth = image.width;
300
- const originalHeight = image.height;
301
- const widthRatio = canvasWidth / originalWidth;
302
- const heightRatio = canvasHeight / originalHeight;
303
- let width;
304
- let height;
305
- if (originalWidth > originalHeight) {
306
- height = originalHeight * heightRatio;
307
- width = (originalWidth / originalHeight) * height;
308
- }
309
- else {
310
- width = originalWidth * widthRatio;
311
- height = (originalHeight / originalWidth) * width;
312
- }
313
- let xOffset = 0;
314
- let yOffset = 0;
315
- if (canvasHeight === height) {
316
- xOffset = -((width - canvasWidth) / 2);
317
- }
318
- else if (canvasWidth === width) {
319
- yOffset = -((height - canvasHeight) / 2);
320
- }
321
- return { xOffset, yOffset, width, height };
322
- };
323
- }
324
- async toDataUri(contents, options = null) {
325
- // Check if the current platform is a browser.
326
- if (!this._platform.isBrowser) {
327
- return null;
328
- }
329
- // Get the image.
330
- const image = await this.getImage(contents);
331
- // Get the canvas width and height.
332
- const canvasWidth = options?.width || image?.width;
333
- const canvasHeight = options?.height || image?.height;
334
- // Get the canvas and context.
335
- const canvas = document.createElement('canvas');
336
- const context = canvas.getContext('2d');
337
- // Validate the context exists.
338
- if (!context) {
339
- return null;
340
- }
341
- // Set the width and height.
342
- canvas.width = canvasWidth;
343
- canvas.height = canvasHeight;
344
- // When the canvas sizes are 0 we have failed.
345
- if (canvas?.width === 0 && canvas?.height === 0) {
346
- return null;
347
- }
348
- // Check if dimensions where supplied, else create the image.
349
- if (!options) {
350
- // Draw the image.
351
- context.drawImage(image, 0, 0);
352
- // Convert the canvas to a data url.
353
- return canvas.toDataURL(this._types[0]);
354
- }
355
- // Get the dimensions and offsets.
356
- const { width, height, xOffset, yOffset } = this.calculateOffsetAndDimensions(image, canvasWidth, canvasHeight);
357
- // Draw the image.
358
- context.drawImage(image, 0, 0, image.width, image.height, xOffset, yOffset, width, height);
359
- // Convert the canvas to a data url.
360
- return canvas.toDataURL(this._types[0]);
361
- }
362
- async fileToImage(file, types = this._types) {
363
- // Check if the file matches an image.
364
- if (!types.includes(file.type)) {
365
- throw new Error('The selected file does not meet the required format.');
366
- }
367
- let stripped = null;
368
- try {
369
- stripped = await this._exif.strip(file, 90);
370
- }
371
- catch {
372
- // Do nothing.
373
- }
374
- // Ge the data uri.
375
- const dataUri = await this._fileLoader.asDataUrl(stripped ?? file);
376
- // Convert the data URI to a image element.
377
- return await this.stringToImage(dataUri);
378
- }
379
- stringToImage(src) {
380
- return new Promise((resolve, reject) => {
381
- const image = new Image();
382
- image.src = src;
383
- image.onload = () => resolve(image);
384
- image.onerror = error => reject(error);
385
- });
386
- }
387
- async getImage(contents) {
388
- // If the contents is already an HTML image element just return it.
389
- if (contents instanceof HTMLImageElement) {
390
- return contents;
391
- }
392
- // If the contents is a file convert it to an HTML image element.
393
- if (contents instanceof File) {
394
- return this.fileToImage(contents);
395
- }
396
- // If the contents is a string convert it to an HTML image element.
397
- return this.stringToImage(contents);
398
- }
399
- }
400
- ImageConverter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: ImageConverter, deps: [{ token: Exif }, { token: Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable });
401
- ImageConverter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: ImageConverter, providedIn: 'root' });
402
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: ImageConverter, decorators: [{
403
- type: Injectable,
404
- args: [{
405
- providedIn: 'root'
406
- }]
291
+ class ImageConverter {
292
+ constructor(_exif, _platform, _fileLoader) {
293
+ this._exif = _exif;
294
+ this._platform = _platform;
295
+ this._fileLoader = _fileLoader;
296
+ // Data.
297
+ this._types = ['image/png', 'image/jpeg'];
298
+ this.calculateOffsetAndDimensions = (image, canvasWidth, canvasHeight) => {
299
+ const originalWidth = image.width;
300
+ const originalHeight = image.height;
301
+ const widthRatio = canvasWidth / originalWidth;
302
+ const heightRatio = canvasHeight / originalHeight;
303
+ let width;
304
+ let height;
305
+ if (originalWidth > originalHeight) {
306
+ height = originalHeight * heightRatio;
307
+ width = (originalWidth / originalHeight) * height;
308
+ }
309
+ else {
310
+ width = originalWidth * widthRatio;
311
+ height = (originalHeight / originalWidth) * width;
312
+ }
313
+ let xOffset = 0;
314
+ let yOffset = 0;
315
+ if (canvasHeight === height) {
316
+ xOffset = -((width - canvasWidth) / 2);
317
+ }
318
+ else if (canvasWidth === width) {
319
+ yOffset = -((height - canvasHeight) / 2);
320
+ }
321
+ return { xOffset, yOffset, width, height };
322
+ };
323
+ }
324
+ async toDataUri(contents, options = null) {
325
+ // Check if the current platform is a browser.
326
+ if (!this._platform.isBrowser) {
327
+ return null;
328
+ }
329
+ // Get the image.
330
+ const image = await this.getImage(contents);
331
+ // Get the canvas width and height.
332
+ const canvasWidth = options?.width || image?.width;
333
+ const canvasHeight = options?.height || image?.height;
334
+ // Get the canvas and context.
335
+ const canvas = document.createElement('canvas');
336
+ const context = canvas.getContext('2d');
337
+ // Validate the context exists.
338
+ if (!context) {
339
+ return null;
340
+ }
341
+ // Set the width and height.
342
+ canvas.width = canvasWidth;
343
+ canvas.height = canvasHeight;
344
+ // When the canvas sizes are 0 we have failed.
345
+ if (canvas?.width === 0 && canvas?.height === 0) {
346
+ return null;
347
+ }
348
+ // Check if dimensions where supplied, else create the image.
349
+ if (!options) {
350
+ // Draw the image.
351
+ context.drawImage(image, 0, 0);
352
+ // Convert the canvas to a data url.
353
+ return canvas.toDataURL(this._types[0]);
354
+ }
355
+ // Get the dimensions and offsets.
356
+ const { width, height, xOffset, yOffset } = this.calculateOffsetAndDimensions(image, canvasWidth, canvasHeight);
357
+ // Draw the image.
358
+ context.drawImage(image, 0, 0, image.width, image.height, xOffset, yOffset, width, height);
359
+ // Convert the canvas to a data url.
360
+ return canvas.toDataURL(this._types[0]);
361
+ }
362
+ async fileToImage(file, types = this._types) {
363
+ // Check if the file matches an image.
364
+ if (!types.includes(file.type)) {
365
+ throw new Error('The selected file does not meet the required format.');
366
+ }
367
+ let stripped = null;
368
+ try {
369
+ stripped = await this._exif.strip(file, 90);
370
+ }
371
+ catch {
372
+ // Do nothing.
373
+ }
374
+ // Ge the data uri.
375
+ const dataUri = await this._fileLoader.asDataUrl(stripped ?? file);
376
+ // Convert the data URI to a image element.
377
+ return await this.stringToImage(dataUri);
378
+ }
379
+ stringToImage(src) {
380
+ return new Promise((resolve, reject) => {
381
+ const image = new Image();
382
+ image.src = src;
383
+ image.onload = () => resolve(image);
384
+ image.onerror = error => reject(error);
385
+ });
386
+ }
387
+ async getImage(contents) {
388
+ // If the contents is already an HTML image element just return it.
389
+ if (contents instanceof HTMLImageElement) {
390
+ return contents;
391
+ }
392
+ // If the contents is a file convert it to an HTML image element.
393
+ if (contents instanceof File) {
394
+ return this.fileToImage(contents);
395
+ }
396
+ // If the contents is a string convert it to an HTML image element.
397
+ return this.stringToImage(contents);
398
+ }
399
+ }
400
+ ImageConverter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: ImageConverter, deps: [{ token: Exif }, { token: Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable });
401
+ ImageConverter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: ImageConverter, providedIn: 'root' });
402
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: ImageConverter, decorators: [{
403
+ type: Injectable,
404
+ args: [{
405
+ providedIn: 'root'
406
+ }]
407
407
  }], ctorParameters: function () { return [{ type: Exif }, { type: Platform }, { type: FileLoader }]; } });
408
408
 
409
409
  const ACCEPT_LANGUAGE = new InjectionToken('AcceptLanguage');
410
410
 
411
- class Languages {
412
- constructor(_acceptLanguage) {
413
- this._acceptLanguage = _acceptLanguage;
414
- // Data.
415
- this._data = [];
416
- this.getLanguages = () => {
417
- // If defined we must be in a server environment.
418
- if (this._acceptLanguage) {
419
- return this._acceptLanguage;
420
- }
421
- // Try to get the languages from the navigator.
422
- if (typeof navigator !== 'object') {
423
- return null;
424
- }
425
- let t = 'anguage';
426
- let n = navigator;
427
- let f = n['l' + t + 's'];
428
- const data = f && f.length ? f : (t = n['l' + t] ||
429
- n['browserL' + t] ||
430
- n['userL' + t]) ? [t] : t;
431
- return typeof data === 'string'
432
- ? data
433
- : data.join(';');
434
- };
435
- this._data = this.initialize();
436
- }
437
- get all() {
438
- return this._data;
439
- }
440
- initialize() {
441
- // Get the languages.
442
- const data = this.getLanguages();
443
- // Parse all languages by using a regex.
444
- const strings = (data || '')
445
- .match(/((([a-zA-Z]+(-[a-zA-Z0-9]+){0,2})|\*)(;q=[0-1](\.[0-9]+)?)?)*/g);
446
- // Get the content by parsing the strings.
447
- const content = strings.map(item => {
448
- if (!item) {
449
- return null;
450
- }
451
- const bits = item.split(';');
452
- const ietf = bits[0].split('-');
453
- const hasScript = ietf.length === 3;
454
- return {
455
- code: ietf[0],
456
- script: hasScript ? ietf[1] : null,
457
- region: hasScript ? ietf[2] : ietf[1],
458
- quality: bits[1] ? parseFloat(bits[1].split('=')[1]) : 1.0
459
- };
460
- });
461
- // Filter out all the empty items
462
- // and sort them by the quality.
463
- return content
464
- .filter(item => !!item)
465
- .sort((a, b) => b.quality - a.quality);
466
- }
467
- }
468
- Languages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Languages, deps: [{ token: ACCEPT_LANGUAGE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
469
- Languages.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Languages, providedIn: 'root' });
470
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Languages, decorators: [{
471
- type: Injectable,
472
- args: [{
473
- providedIn: 'root'
474
- }]
475
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
476
- type: Optional
477
- }, {
478
- type: Inject,
479
- args: [ACCEPT_LANGUAGE]
411
+ class Languages {
412
+ constructor(_acceptLanguage) {
413
+ this._acceptLanguage = _acceptLanguage;
414
+ // Data.
415
+ this._data = [];
416
+ this.getLanguages = () => {
417
+ // If defined we must be in a server environment.
418
+ if (this._acceptLanguage) {
419
+ return this._acceptLanguage;
420
+ }
421
+ // Try to get the languages from the navigator.
422
+ if (typeof navigator !== 'object') {
423
+ return null;
424
+ }
425
+ let t = 'anguage';
426
+ let n = navigator;
427
+ let f = n['l' + t + 's'];
428
+ const data = f && f.length ? f : (t = n['l' + t] ||
429
+ n['browserL' + t] ||
430
+ n['userL' + t]) ? [t] : t;
431
+ return typeof data === 'string'
432
+ ? data
433
+ : data.join(';');
434
+ };
435
+ this._data = this.initialize();
436
+ }
437
+ get all() {
438
+ return this._data;
439
+ }
440
+ initialize() {
441
+ // Get the languages.
442
+ const data = this.getLanguages();
443
+ // Parse all languages by using a regex.
444
+ const strings = (data || '')
445
+ .match(/((([a-zA-Z]+(-[a-zA-Z0-9]+){0,2})|\*)(;q=[0-1](\.[0-9]+)?)?)*/g);
446
+ // Get the content by parsing the strings.
447
+ const content = strings.map(item => {
448
+ if (!item) {
449
+ return null;
450
+ }
451
+ const bits = item.split(';');
452
+ const ietf = bits[0].split('-');
453
+ const hasScript = ietf.length === 3;
454
+ return {
455
+ code: ietf[0],
456
+ script: hasScript ? ietf[1] : null,
457
+ region: hasScript ? ietf[2] : ietf[1],
458
+ quality: bits[1] ? parseFloat(bits[1].split('=')[1]) : 1.0
459
+ };
460
+ });
461
+ // Filter out all the empty items
462
+ // and sort them by the quality.
463
+ return content
464
+ .filter(item => !!item)
465
+ .sort((a, b) => b.quality - a.quality);
466
+ }
467
+ }
468
+ Languages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Languages, deps: [{ token: ACCEPT_LANGUAGE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
469
+ Languages.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Languages, providedIn: 'root' });
470
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Languages, decorators: [{
471
+ type: Injectable,
472
+ args: [{
473
+ providedIn: 'root'
474
+ }]
475
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
476
+ type: Optional
477
+ }, {
478
+ type: Inject,
479
+ args: [ACCEPT_LANGUAGE]
480
480
  }] }]; } });
481
481
 
482
- const WINDOW = new InjectionToken('An abstraction over global window object', {
483
- factory: () => {
484
- const { defaultView } = inject(DOCUMENT);
485
- if (!defaultView) {
486
- throw new Error('Window is not available');
487
- }
488
- return defaultView;
489
- }
482
+ const WINDOW = new InjectionToken('An abstraction over global window object', {
483
+ factory: () => {
484
+ const { defaultView } = inject(DOCUMENT);
485
+ if (!defaultView) {
486
+ throw new Error('Window is not available');
487
+ }
488
+ return defaultView;
489
+ }
490
490
  });
491
491
 
492
- const NAVIGATOR = new InjectionToken('An abstraction over window.navigator object', {
493
- factory: () => inject(WINDOW).navigator
492
+ const NAVIGATOR = new InjectionToken('An abstraction over window.navigator object', {
493
+ factory: () => inject(WINDOW).navigator
494
494
  });
495
495
 
496
- class Network {
497
- constructor(_platform, _window, _navigator) {
498
- this._platform = _platform;
499
- this._window = _window;
500
- this._navigator = _navigator;
501
- // Data.
502
- this._online$ = of(true);
503
- this.getOnlineObservable();
504
- }
505
- online() {
506
- return this._online$;
507
- }
508
- getOnlineObservable() {
509
- // Validate we are on a browser.
510
- if (!this._platform.isBrowser) {
511
- return;
512
- }
513
- // Get all the events from the window.
514
- const online$ = fromEvent(this._window, 'online').pipe(mapTo(true));
515
- const offline$ = fromEvent(this._window, 'offline').pipe(mapTo(false));
516
- const now$ = new Observable(subscriber => {
517
- subscriber.next(this._navigator?.onLine);
518
- subscriber.complete();
519
- });
520
- // Merge all event so we get notified when
521
- // a user is online/offline.
522
- this._online$ = merge(now$, online$, offline$).pipe(map(value => value), distinctUntilChanged(), shareReplay(1));
523
- }
524
- }
525
- Network.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Network, deps: [{ token: Platform }, { token: WINDOW, optional: true }, { token: NAVIGATOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
526
- Network.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Network, providedIn: 'root' });
527
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Network, decorators: [{
528
- type: Injectable,
529
- args: [{
530
- providedIn: 'root'
531
- }]
532
- }], ctorParameters: function () { return [{ type: Platform }, { type: undefined, decorators: [{
533
- type: Optional
534
- }, {
535
- type: Inject,
536
- args: [WINDOW]
537
- }] }, { type: undefined, decorators: [{
538
- type: Optional
539
- }, {
540
- type: Inject,
541
- args: [NAVIGATOR]
496
+ class Network {
497
+ constructor(_platform, _window, _navigator) {
498
+ this._platform = _platform;
499
+ this._window = _window;
500
+ this._navigator = _navigator;
501
+ // Data.
502
+ this._online$ = of(true);
503
+ this.getOnlineObservable();
504
+ }
505
+ online() {
506
+ return this._online$;
507
+ }
508
+ getOnlineObservable() {
509
+ // Validate we are on a browser.
510
+ if (!this._platform.isBrowser) {
511
+ return;
512
+ }
513
+ // Get all the events from the window.
514
+ const online$ = fromEvent(this._window, 'online').pipe(map(() => true));
515
+ const offline$ = fromEvent(this._window, 'offline').pipe(map(() => false));
516
+ const now$ = new Observable(subscriber => {
517
+ subscriber.next(this._navigator?.onLine);
518
+ subscriber.complete();
519
+ });
520
+ // Merge all event so we get notified when
521
+ // a user is online/offline.
522
+ this._online$ = merge(now$, online$, offline$).pipe(map(value => value), distinctUntilChanged(), shareReplay(1));
523
+ }
524
+ }
525
+ Network.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Network, deps: [{ token: Platform }, { token: WINDOW, optional: true }, { token: NAVIGATOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
526
+ Network.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Network, providedIn: 'root' });
527
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Network, decorators: [{
528
+ type: Injectable,
529
+ args: [{
530
+ providedIn: 'root'
531
+ }]
532
+ }], ctorParameters: function () { return [{ type: Platform }, { type: undefined, decorators: [{
533
+ type: Optional
534
+ }, {
535
+ type: Inject,
536
+ args: [WINDOW]
537
+ }] }, { type: undefined, decorators: [{
538
+ type: Optional
539
+ }, {
540
+ type: Inject,
541
+ args: [NAVIGATOR]
542
542
  }] }]; } });
543
543
 
544
- class Patch {
545
- constructor(_platform, _window, _document) {
546
- this._platform = _platform;
547
- this._window = _window;
548
- this._document = _document;
549
- this._hasPatchedMobileVerticalHeight = false;
550
- // Subscriptions.
551
- this._subscription = new Subscription();
552
- }
553
- mobileVerticalHeight() {
554
- // Check if the user has already patched
555
- // the mobile vertical height.
556
- if (this._hasPatchedMobileVerticalHeight) {
557
- return;
558
- }
559
- this.periodicallySetDocumentVerticalProperty();
560
- this._hasPatchedMobileVerticalHeight = true;
561
- }
562
- ngOnDestroy() {
563
- this._subscription?.unsubscribe();
564
- }
565
- periodicallySetDocumentVerticalProperty() {
566
- // Validate we are using a browser.
567
- if (!this._platform.isBrowser) {
568
- return;
569
- }
570
- // Listen to a debounced window resize event.
571
- const resize$ = fromEvent(this._window, 'resize').pipe(debounceTime(25), startWith(0));
572
- // Subscribe to the resize observable.
573
- const subscription = resize$.subscribe(() => {
574
- const verticalHeight = this._window?.innerHeight * 0.01;
575
- this._document?.documentElement?.style?.setProperty('--vh', `${verticalHeight}px`);
576
- });
577
- // Save the subscription so we can destroy it later.
578
- this._subscription.add(subscription);
579
- }
580
- }
581
- Patch.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Patch, deps: [{ token: Platform }, { token: WINDOW, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
582
- Patch.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Patch, providedIn: 'root' });
583
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Patch, decorators: [{
584
- type: Injectable,
585
- args: [{
586
- providedIn: 'root'
587
- }]
588
- }], ctorParameters: function () { return [{ type: Platform }, { type: undefined, decorators: [{
589
- type: Optional
590
- }, {
591
- type: Inject,
592
- args: [WINDOW]
593
- }] }, { type: undefined, decorators: [{
594
- type: Optional
595
- }, {
596
- type: Inject,
597
- args: [DOCUMENT]
544
+ class Patch {
545
+ constructor(_platform, _window, _document) {
546
+ this._platform = _platform;
547
+ this._window = _window;
548
+ this._document = _document;
549
+ this._hasPatchedMobileVerticalHeight = false;
550
+ // Subscriptions.
551
+ this._subscription = new Subscription();
552
+ }
553
+ mobileVerticalHeight() {
554
+ // Check if the user has already patched
555
+ // the mobile vertical height.
556
+ if (this._hasPatchedMobileVerticalHeight) {
557
+ return;
558
+ }
559
+ this.periodicallySetDocumentVerticalProperty();
560
+ this._hasPatchedMobileVerticalHeight = true;
561
+ }
562
+ ngOnDestroy() {
563
+ this._subscription?.unsubscribe();
564
+ }
565
+ periodicallySetDocumentVerticalProperty() {
566
+ // Validate we are using a browser.
567
+ if (!this._platform.isBrowser) {
568
+ return;
569
+ }
570
+ // Listen to a debounced window resize event.
571
+ const resize$ = fromEvent(this._window, 'resize').pipe(debounceTime(25), startWith(0));
572
+ // Subscribe to the resize observable.
573
+ const subscription = resize$.subscribe(() => {
574
+ const verticalHeight = this._window?.innerHeight * 0.01;
575
+ this._document?.documentElement?.style?.setProperty('--vh', `${verticalHeight}px`);
576
+ });
577
+ // Save the subscription so we can destroy it later.
578
+ this._subscription.add(subscription);
579
+ }
580
+ }
581
+ Patch.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Patch, deps: [{ token: Platform }, { token: WINDOW, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
582
+ Patch.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Patch, providedIn: 'root' });
583
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Patch, decorators: [{
584
+ type: Injectable,
585
+ args: [{
586
+ providedIn: 'root'
587
+ }]
588
+ }], ctorParameters: function () { return [{ type: Platform }, { type: undefined, decorators: [{
589
+ type: Optional
590
+ }, {
591
+ type: Inject,
592
+ args: [WINDOW]
593
+ }] }, { type: undefined, decorators: [{
594
+ type: Optional
595
+ }, {
596
+ type: Inject,
597
+ args: [DOCUMENT]
598
598
  }] }]; } });
599
599
 
600
- class Clipboard {
601
- constructor(_document) {
602
- this._document = _document;
603
- }
604
- copy(text) {
605
- const pendingCopy = this.beginCopy(text);
606
- const successful = pendingCopy.copy();
607
- pendingCopy.destroy();
608
- return successful;
609
- }
610
- beginCopy(text) {
611
- return new ClipboardCopy(text, this._document);
612
- }
613
- }
614
- Clipboard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Clipboard, deps: [{ token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
615
- Clipboard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Clipboard, providedIn: 'root' });
616
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Clipboard, decorators: [{
617
- type: Injectable,
618
- args: [{
619
- providedIn: 'root'
620
- }]
621
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
622
- type: Optional
623
- }, {
624
- type: Inject,
625
- args: [DOCUMENT]
626
- }] }]; } });
627
- class ClipboardCopy {
628
- constructor(_text, _document) {
629
- this._text = _text;
630
- this._document = _document;
631
- this.initialize();
632
- }
633
- copy() {
634
- const textarea = this._textarea;
635
- let successful = false;
636
- try {
637
- const currentFocus = this._document.activeElement;
638
- textarea?.select?.();
639
- textarea?.setSelectionRange?.(0, textarea?.value?.length);
640
- successful = this._document?.execCommand?.('copy');
641
- currentFocus?.focus?.();
642
- }
643
- catch {
644
- // Do nothing.
645
- }
646
- return successful;
647
- }
648
- destroy() {
649
- this._textarea?.parentNode?.removeChild?.(this._textarea);
650
- this._textarea = undefined;
651
- }
652
- initialize() {
653
- const textarea = this._textarea = this._document.createElement('textarea');
654
- const styles = textarea.style;
655
- // Hide the element for display and accessibility. Set a fixed position so the page layout
656
- // isn't affected. We use `fixed` with `top: 0`, because focus is moved into the textarea
657
- // for a split second and if it's off-screen, some browsers will attempt to scroll it into view.
658
- styles.position = 'fixed';
659
- styles.top = styles.opacity = '0';
660
- styles.left = '-999em';
661
- textarea.setAttribute('aria-hidden', 'true');
662
- textarea.value = this._text;
663
- this._document.body.appendChild(textarea);
664
- }
600
+ class Clipboard {
601
+ constructor(_document) {
602
+ this._document = _document;
603
+ }
604
+ copy(text) {
605
+ const pendingCopy = this.beginCopy(text);
606
+ const successful = pendingCopy.copy();
607
+ pendingCopy.destroy();
608
+ return successful;
609
+ }
610
+ beginCopy(text) {
611
+ return new ClipboardCopy(text, this._document);
612
+ }
613
+ }
614
+ Clipboard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Clipboard, deps: [{ token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
615
+ Clipboard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Clipboard, providedIn: 'root' });
616
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Clipboard, decorators: [{
617
+ type: Injectable,
618
+ args: [{
619
+ providedIn: 'root'
620
+ }]
621
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
622
+ type: Optional
623
+ }, {
624
+ type: Inject,
625
+ args: [DOCUMENT]
626
+ }] }]; } });
627
+ class ClipboardCopy {
628
+ constructor(_text, _document) {
629
+ this._text = _text;
630
+ this._document = _document;
631
+ this.initialize();
632
+ }
633
+ copy() {
634
+ const textarea = this._textarea;
635
+ let successful = false;
636
+ try {
637
+ const currentFocus = this._document.activeElement;
638
+ textarea?.select?.();
639
+ textarea?.setSelectionRange?.(0, textarea?.value?.length);
640
+ successful = this._document?.execCommand?.('copy');
641
+ currentFocus?.focus?.();
642
+ }
643
+ catch {
644
+ // Do nothing.
645
+ }
646
+ return successful;
647
+ }
648
+ destroy() {
649
+ this._textarea?.parentNode?.removeChild?.(this._textarea);
650
+ this._textarea = undefined;
651
+ }
652
+ initialize() {
653
+ const textarea = this._textarea = this._document.createElement('textarea');
654
+ const styles = textarea.style;
655
+ // Hide the element for display and accessibility. Set a fixed position so the page layout
656
+ // isn't affected. We use `fixed` with `top: 0`, because focus is moved into the textarea
657
+ // for a split second and if it's off-screen, some browsers will attempt to scroll it into view.
658
+ styles.position = 'fixed';
659
+ styles.top = styles.opacity = '0';
660
+ styles.left = '-999em';
661
+ textarea.setAttribute('aria-hidden', 'true');
662
+ textarea.value = this._text;
663
+ this._document.body.appendChild(textarea);
664
+ }
665
665
  }
666
666
 
667
- function mixinDisabled(base) {
668
- return class extends base {
669
- constructor(...args) {
670
- super(...args);
671
- this._disable = false;
672
- }
673
- get disabled() {
674
- return this._disable;
675
- }
676
- set disabled(value) {
677
- this._disable = coerceBooleanProperty(value);
678
- }
679
- };
667
+ function mixinDisabled(base) {
668
+ return class extends base {
669
+ constructor(...args) {
670
+ super(...args);
671
+ this._disable = false;
672
+ }
673
+ get disabled() {
674
+ return this._disable;
675
+ }
676
+ set disabled(value) {
677
+ this._disable = coerceBooleanProperty(value);
678
+ }
679
+ };
680
680
  }
681
681
 
682
- function mixinLoad(base) {
683
- return class extends base {
684
- constructor(...args) {
685
- super(...args);
686
- this._loading = false;
687
- }
688
- get loading() {
689
- return this._loading;
690
- }
691
- set loading(value) {
692
- this._loading = coerceBooleanProperty(value);
693
- }
694
- };
682
+ function mixinLoad(base) {
683
+ return class extends base {
684
+ constructor(...args) {
685
+ super(...args);
686
+ this._loading = false;
687
+ }
688
+ get loading() {
689
+ return this._loading;
690
+ }
691
+ set loading(value) {
692
+ this._loading = coerceBooleanProperty(value);
693
+ }
694
+ };
695
695
  }
696
696
 
697
- function mixinError(base) {
698
- return class extends base {
699
- constructor(...args) {
700
- super(...args);
701
- this._error = false;
702
- }
703
- get error() {
704
- return this._error;
705
- }
706
- set error(value) {
707
- this._error = coerceBooleanProperty(value);
708
- }
709
- };
697
+ function mixinError(base) {
698
+ return class extends base {
699
+ constructor(...args) {
700
+ super(...args);
701
+ this._error = false;
702
+ }
703
+ get error() {
704
+ return this._error;
705
+ }
706
+ set error(value) {
707
+ this._error = coerceBooleanProperty(value);
708
+ }
709
+ };
710
710
  }
711
711
 
712
- function mixinHideErrors(base) {
713
- return class extends base {
714
- constructor(...args) {
715
- super(...args);
716
- this._hideErrors = false;
717
- }
718
- get hideErrors() {
719
- return this._hideErrors;
720
- }
721
- set hideErrors(value) {
722
- this._hideErrors = coerceBooleanProperty(value);
723
- }
724
- };
712
+ function mixinHideErrors(base) {
713
+ return class extends base {
714
+ constructor(...args) {
715
+ super(...args);
716
+ this._hideErrors = false;
717
+ }
718
+ get hideErrors() {
719
+ return this._hideErrors;
720
+ }
721
+ set hideErrors(value) {
722
+ this._hideErrors = coerceBooleanProperty(value);
723
+ }
724
+ };
725
725
  }
726
726
 
727
- function mixinFocused(base) {
728
- return class extends base {
729
- constructor(...args) {
730
- super(...args);
731
- this._focused = false;
732
- }
733
- get focused() {
734
- return this._focused;
735
- }
736
- set focused(value) {
737
- this._focused = coerceBooleanProperty(value);
738
- }
739
- };
727
+ function mixinFocused(base) {
728
+ return class extends base {
729
+ constructor(...args) {
730
+ super(...args);
731
+ this._focused = false;
732
+ }
733
+ get focused() {
734
+ return this._focused;
735
+ }
736
+ set focused(value) {
737
+ this._focused = coerceBooleanProperty(value);
738
+ }
739
+ };
740
740
  }
741
741
 
742
- function mixinGrouped(base) {
743
- return class extends base {
744
- constructor(...args) {
745
- super(...args);
746
- this._grouped = false;
747
- }
748
- get grouped() {
749
- return this._grouped;
750
- }
751
- set grouped(value) {
752
- this._grouped = coerceBooleanProperty(value);
753
- }
754
- };
742
+ function mixinGrouped(base) {
743
+ return class extends base {
744
+ constructor(...args) {
745
+ super(...args);
746
+ this._grouped = false;
747
+ }
748
+ get grouped() {
749
+ return this._grouped;
750
+ }
751
+ set grouped(value) {
752
+ this._grouped = coerceBooleanProperty(value);
753
+ }
754
+ };
755
755
  }
756
756
 
757
- function mixinReadonly(base) {
758
- return class extends base {
759
- constructor(...args) {
760
- super(...args);
761
- this._readonly = false;
762
- }
763
- get readonly() {
764
- return this._readonly;
765
- }
766
- set readonly(value) {
767
- this._readonly = coerceBooleanProperty(value);
768
- }
769
- };
757
+ function mixinReadonly(base) {
758
+ return class extends base {
759
+ constructor(...args) {
760
+ super(...args);
761
+ this._readonly = false;
762
+ }
763
+ get readonly() {
764
+ return this._readonly;
765
+ }
766
+ set readonly(value) {
767
+ this._readonly = coerceBooleanProperty(value);
768
+ }
769
+ };
770
770
  }
771
771
 
772
- function mixinRequired(base) {
773
- return class extends base {
774
- constructor(...args) {
775
- super(...args);
776
- this._required = false;
777
- }
778
- get required() {
779
- return this._required;
780
- }
781
- set required(value) {
782
- this._required = coerceBooleanProperty(value);
783
- }
784
- };
772
+ function mixinRequired(base) {
773
+ return class extends base {
774
+ constructor(...args) {
775
+ super(...args);
776
+ this._required = false;
777
+ }
778
+ get required() {
779
+ return this._required;
780
+ }
781
+ set required(value) {
782
+ this._required = coerceBooleanProperty(value);
783
+ }
784
+ };
785
785
  }
786
786
 
787
787
  const BASE_URL = new InjectionToken('BaseUrl');
788
788
 
789
789
  const COOKIE = new InjectionToken('Cookie');
790
790
 
791
- const LOCATION = new InjectionToken('An abstraction over window.location object', {
792
- factory: () => inject(WINDOW).location
791
+ const LOCATION = new InjectionToken('An abstraction over window.location object', {
792
+ factory: () => inject(WINDOW).location
793
793
  });
794
794
 
795
- const BbRegex = {
796
- email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
797
- fullNumber: /^\d*[1-9]\d*$/
795
+ const BbRegex = {
796
+ email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
797
+ fullNumber: /^\d*[1-9]\d*$/
798
798
  };
799
799
 
800
- class BbValidator {
801
- static email(control) {
802
- if (isEmptyInputValue(control.value)) {
803
- return null;
804
- }
805
- return BbRegex.email.test(control.value) ? null : { email: true };
806
- }
807
- static fullNumber(control) {
808
- if (isEmptyInputValue(control.value)) {
809
- return null;
810
- }
811
- return BbRegex.fullNumber.test(control.value) ? null : { fullNumber: true };
812
- }
813
- static maxFileSize(bytes) {
814
- const validator = (control) => {
815
- const value = control.value;
816
- // Validate if the value is a file.
817
- if (!(value instanceof File)) {
818
- return null;
819
- }
820
- if (value.size <= bytes) {
821
- return null;
822
- }
823
- let maxSize = '0 Bytes';
824
- if (bytes !== 0) {
825
- const k = 1024;
826
- const dm = 2;
827
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
828
- const index = Math.floor(Math.log(bytes) / Math.log(k));
829
- maxSize = parseFloat((bytes / Math.pow(k, index)).toFixed(dm)) + ' ' + sizes[index];
830
- }
831
- return { maxFileSize: { maxSize } };
832
- };
833
- return validator;
834
- }
835
- static confirm(fieldName, error = 'confirm') {
836
- const validator = (control) => {
837
- if (isEmptyInputValue(control.value)) {
838
- return null;
839
- }
840
- const field = control?.parent?.get(fieldName);
841
- return control?.value === field?.value
842
- ? null
843
- : { [error]: true };
844
- };
845
- return validator;
846
- }
847
- static maxDate(date, error = 'maxDate') {
848
- const formattedDate = date.toString() !== 'Invalid Date'
849
- ? formatDate(date, 'yyyy-MM-dd', 'en-US')
850
- : null;
851
- const validator = (control) => {
852
- if (isEmptyInputValue(control.value)) {
853
- return null;
854
- }
855
- const controlDate = new Date(control.value);
856
- return controlDate.getTime() > date.getTime()
857
- ? { [error]: { date: formattedDate } }
858
- : null;
859
- };
860
- return validator;
861
- }
862
- static minDate(date, error = 'minDate') {
863
- const formattedDate = date.toString() !== 'Invalid Date'
864
- ? formatDate(date, 'yyyy-MM-dd', 'en-US')
865
- : null;
866
- const validator = (control) => {
867
- if (isEmptyInputValue(control.value)) {
868
- return null;
869
- }
870
- const controlDate = new Date(control.value);
871
- return controlDate.getTime() < date.getTime()
872
- ? { [error]: { date: formattedDate } }
873
- : null;
874
- };
875
- return validator;
876
- }
877
- }
878
- function isEmptyInputValue(value) {
879
- // We don't check for string here so it also works with arrays.
880
- return value == null || value.length === 0;
800
+ class BbValidator {
801
+ static email(control) {
802
+ if (isEmptyInputValue(control.value)) {
803
+ return null;
804
+ }
805
+ return BbRegex.email.test(control.value) ? null : { email: true };
806
+ }
807
+ static fullNumber(control) {
808
+ if (isEmptyInputValue(control.value)) {
809
+ return null;
810
+ }
811
+ return BbRegex.fullNumber.test(control.value) ? null : { fullNumber: true };
812
+ }
813
+ static maxFileSize(bytes) {
814
+ const validator = (control) => {
815
+ const value = control.value;
816
+ // Validate if the value is a file.
817
+ if (!(value instanceof File)) {
818
+ return null;
819
+ }
820
+ if (value.size <= bytes) {
821
+ return null;
822
+ }
823
+ let maxSize = '0 Bytes';
824
+ if (bytes !== 0) {
825
+ const k = 1024;
826
+ const dm = 2;
827
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
828
+ const index = Math.floor(Math.log(bytes) / Math.log(k));
829
+ maxSize = parseFloat((bytes / Math.pow(k, index)).toFixed(dm)) + ' ' + sizes[index];
830
+ }
831
+ return { maxFileSize: { maxSize } };
832
+ };
833
+ return validator;
834
+ }
835
+ static confirm(fieldName, error = 'confirm') {
836
+ const validator = (control) => {
837
+ if (isEmptyInputValue(control.value)) {
838
+ return null;
839
+ }
840
+ const field = control?.parent?.get(fieldName);
841
+ return control?.value === field?.value
842
+ ? null
843
+ : { [error]: true };
844
+ };
845
+ return validator;
846
+ }
847
+ static maxDate(date, error = 'maxDate') {
848
+ const formattedDate = date.toString() !== 'Invalid Date'
849
+ ? formatDate(date, 'yyyy-MM-dd', 'en-US')
850
+ : null;
851
+ const validator = (control) => {
852
+ if (isEmptyInputValue(control.value)) {
853
+ return null;
854
+ }
855
+ const controlDate = new Date(control.value);
856
+ return controlDate.getTime() > date.getTime()
857
+ ? { [error]: { date: formattedDate } }
858
+ : null;
859
+ };
860
+ return validator;
861
+ }
862
+ static minDate(date, error = 'minDate') {
863
+ const formattedDate = date.toString() !== 'Invalid Date'
864
+ ? formatDate(date, 'yyyy-MM-dd', 'en-US')
865
+ : null;
866
+ const validator = (control) => {
867
+ if (isEmptyInputValue(control.value)) {
868
+ return null;
869
+ }
870
+ const controlDate = new Date(control.value);
871
+ return controlDate.getTime() < date.getTime()
872
+ ? { [error]: { date: formattedDate } }
873
+ : null;
874
+ };
875
+ return validator;
876
+ }
877
+ }
878
+ function isEmptyInputValue(value) {
879
+ // We don't check for string here so it also works with arrays.
880
+ return value == null || value.length === 0;
881
881
  }
882
882
 
883
- /*
884
- * Public API Surface of bb-foundation
883
+ /*
884
+ * Public API Surface of bb-foundation
885
885
  */
886
886
 
887
- /**
888
- * Generated bundle index. Do not edit.
887
+ /**
888
+ * Generated bundle index. Do not edit.
889
889
  */
890
890
 
891
891
  export { ACCEPT_LANGUAGE, BASE_URL, BbRegex, BbValidator, COOKIE, Clipboard, ClipboardCopy, Exif, FileLoader, ImageConverter, LOCATION, Languages, NAVIGATOR, Network, Patch, Platform, WINDOW, mixinDisabled, mixinError, mixinFocused, mixinGrouped, mixinHideErrors, mixinLoad, mixinReadonly, mixinRequired };