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