@bravobit/bb-foundation 0.20.3 → 0.21.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 → index.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/collections/{bravobit-bb-foundation-collections.d.ts → index.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 +19 -19
- 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 → index.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 +22 -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 → index.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 → index.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 → index.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 -93
- package/esm2020/auth/lib/auth.module.mjs +54 -54
- package/esm2020/auth/lib/auth.service.mjs +281 -281
- 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 +61 -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 +68 -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 -15
- package/esm2020/localize/lib/interfaces/config.interfaces.mjs +7 -7
- 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 -45
- package/esm2020/localize/lib/localizations/english.localization.mjs +45 -45
- package/esm2020/localize/lib/localize.dictionary.mjs +26 -26
- package/esm2020/localize/lib/localize.module.mjs +71 -71
- package/esm2020/localize/lib/localize.pipe.mjs +49 -49
- package/esm2020/localize/lib/localize.service.mjs +207 -207
- 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 -17
- package/esm2020/masking/bravobit-bb-foundation-masking.mjs +5 -0
- package/esm2020/masking/lib/input-mask.directive.mjs +110 -0
- package/esm2020/masking/lib/input-mask.interface.mjs +2 -0
- package/esm2020/masking/lib/masking.module.mjs +16 -0
- package/esm2020/masking/lib/masking.service.mjs +94 -0
- package/esm2020/masking/public_api.mjs +5 -0
- 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/esm2020/theming/bravobit-bb-foundation-theming.mjs +5 -0
- package/esm2020/theming/lib/themes/checkbox-group.theme.mjs +2 -0
- package/esm2020/theming/lib/themes/checkbox.theme.mjs +2 -0
- package/esm2020/theming/lib/theming.interface.mjs +3 -0
- package/esm2020/theming/lib/theming.module.mjs +38 -0
- package/esm2020/theming/lib/theming.service.mjs +100 -0
- package/esm2020/theming/public_api.mjs +4 -0
- package/fesm2015/bravobit-bb-foundation-auth.mjs +930 -930
- 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 +229 -216
- package/fesm2015/bravobit-bb-foundation-controls.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-dashboard.mjs +383 -383
- package/fesm2015/bravobit-bb-foundation-dashboard.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-dialog.mjs +541 -543
- package/fesm2015/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-elements.mjs +1977 -1977
- 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 +608 -608
- package/fesm2015/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-masking.mjs +235 -0
- package/fesm2015/bravobit-bb-foundation-masking.mjs.map +1 -0
- package/fesm2015/bravobit-bb-foundation-notifications.mjs +349 -349
- 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 +575 -575
- package/fesm2015/bravobit-bb-foundation-table.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-theming.mjs +153 -0
- package/fesm2015/bravobit-bb-foundation-theming.mjs.map +1 -0
- package/fesm2015/bravobit-bb-foundation.mjs +859 -859
- package/fesm2015/bravobit-bb-foundation.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-auth.mjs +882 -882
- 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 +227 -214
- package/fesm2020/bravobit-bb-foundation-controls.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-dashboard.mjs +371 -371
- package/fesm2020/bravobit-bb-foundation-dashboard.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-dialog.mjs +540 -542
- package/fesm2020/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-elements.mjs +1934 -1934
- 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 +587 -587
- package/fesm2020/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-masking.mjs +223 -0
- package/fesm2020/bravobit-bb-foundation-masking.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-notifications.mjs +347 -347
- 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 +564 -564
- package/fesm2020/bravobit-bb-foundation-table.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-theming.mjs +143 -0
- package/fesm2020/bravobit-bb-foundation-theming.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation.mjs +831 -831
- package/fesm2020/bravobit-bb-foundation.mjs.map +1 -1
- package/http/{bravobit-bb-foundation-http.d.ts → index.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/{bravobit-bb-foundation.d.ts → index.d.ts} +5 -5
- 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 → index.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 -18
- 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 -44
- package/localize/lib/localizations/english.localization.d.ts +44 -44
- package/localize/lib/localize.dictionary.d.ts +7 -7
- package/localize/lib/localize.module.d.ts +17 -17
- package/localize/lib/localize.pipe.d.ts +12 -12
- package/localize/lib/localize.service.d.ts +40 -40
- 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 -16
- package/masking/index.d.ts +5 -0
- package/masking/lib/input-mask.directive.d.ts +36 -0
- package/masking/lib/input-mask.interface.d.ts +20 -0
- package/masking/lib/masking.module.d.ts +7 -0
- package/masking/lib/masking.service.d.ts +12 -0
- package/masking/public_api.d.ts +4 -0
- package/notifications/{bravobit-bb-foundation-notifications.d.ts → index.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 +36 -19
- package/public_api.d.ts +25 -25
- package/recaptcha/{bravobit-bb-foundation-recaptcha.d.ts → index.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 → index.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 → index.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 → index.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/theming/index.d.ts +5 -0
- package/theming/lib/themes/checkbox-group.theme.d.ts +5 -0
- package/theming/lib/themes/checkbox.theme.d.ts +19 -0
- package/theming/lib/theming.interface.d.ts +14 -0
- package/theming/lib/theming.module.d.ts +13 -0
- package/theming/lib/theming.service.d.ts +24 -0
- package/theming/public_api.d.ts +3 -0
- package/auth/package.json +0 -10
- package/collections/package.json +0 -10
- package/controls/package.json +0 -10
- package/dashboard/package.json +0 -10
- package/dialog/package.json +0 -10
- package/elements/package.json +0 -10
- package/http/package.json +0 -10
- package/localize/package.json +0 -10
- package/notifications/package.json +0 -10
- package/recaptcha/package.json +0 -10
- package/rxjs/package.json +0 -10
- package/storage/package.json +0 -10
- package/table/package.json +0 -10
|
@@ -6,445 +6,445 @@ import * as i1 from '@angular/common';
|
|
|
6
6
|
import { CommonModule } from '@angular/common';
|
|
7
7
|
import { FormControl } from '@angular/forms';
|
|
8
8
|
|
|
9
|
-
class CollectionProvider {
|
|
10
|
-
formatArrayToCollectionData(items) {
|
|
11
|
-
var _a;
|
|
12
|
-
const count = (_a = items === null || items === void 0 ? void 0 : items.length) !== null && _a !== void 0 ? _a : 1;
|
|
13
|
-
return {
|
|
14
|
-
pageSize: count,
|
|
15
|
-
totalEntries: count,
|
|
16
|
-
pageNumber: 1,
|
|
17
|
-
totalPages: 1,
|
|
18
|
-
data: items
|
|
19
|
-
};
|
|
20
|
-
}
|
|
9
|
+
class CollectionProvider {
|
|
10
|
+
formatArrayToCollectionData(items) {
|
|
11
|
+
var _a;
|
|
12
|
+
const count = (_a = items === null || items === void 0 ? void 0 : items.length) !== null && _a !== void 0 ? _a : 1;
|
|
13
|
+
return {
|
|
14
|
+
pageSize: count,
|
|
15
|
+
totalEntries: count,
|
|
16
|
+
pageNumber: 1,
|
|
17
|
+
totalPages: 1,
|
|
18
|
+
data: items
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
class ApiCollectionProvider extends CollectionProvider {
|
|
24
|
-
constructor(endpoint, httpClient) {
|
|
25
|
-
super();
|
|
26
|
-
this.endpoint = endpoint;
|
|
27
|
-
this.httpClient = httpClient;
|
|
28
|
-
// State.
|
|
29
|
-
this.extraParams = {};
|
|
30
|
-
}
|
|
31
|
-
append(name, value) {
|
|
32
|
-
this.extraParams[name] = isObservable(value) ? value : of(value);
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
transform(request) {
|
|
36
|
-
const endpoint$ = isObservable(this.endpoint) ? this.endpoint : of(this.endpoint);
|
|
37
|
-
const params = this.getBackendFormat(request);
|
|
38
|
-
const extraParams$ = this.getExtraParams(this.extraParams);
|
|
39
|
-
return combineLatest([endpoint$, extraParams$]).pipe(switchMap(([endpoint, extraParams]) => {
|
|
40
|
-
return this.httpClient.get(endpoint, {
|
|
41
|
-
params: Object.assign(Object.assign({}, params), extraParams)
|
|
42
|
-
});
|
|
43
|
-
}), map(response => this.formatToCollectionData(response)));
|
|
44
|
-
}
|
|
45
|
-
getExtraParams(params) {
|
|
46
|
-
const keys = Object.keys(params !== null && params !== void 0 ? params : {});
|
|
47
|
-
if (keys.length <= 0) {
|
|
48
|
-
return of({});
|
|
49
|
-
}
|
|
50
|
-
const observables$ = keys.map(key => params === null || params === void 0 ? void 0 : params[key]);
|
|
51
|
-
return combineLatest(observables$).pipe(map(data => {
|
|
52
|
-
return data.reduce((previous, current, index) => {
|
|
53
|
-
if (current === null || current === undefined) {
|
|
54
|
-
return previous;
|
|
55
|
-
}
|
|
56
|
-
const key = keys === null || keys === void 0 ? void 0 : keys[index];
|
|
57
|
-
return Object.assign(Object.assign({}, previous), { [key]: current });
|
|
58
|
-
}, {});
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
formatToCollectionData(response) {
|
|
62
|
-
if (Array.isArray(response)) {
|
|
63
|
-
return this.formatArrayToCollectionData(response);
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
pageSize: response === null || response === void 0 ? void 0 : response.page_size,
|
|
67
|
-
pageNumber: response === null || response === void 0 ? void 0 : response.page_number,
|
|
68
|
-
totalPages: response === null || response === void 0 ? void 0 : response.total_pages,
|
|
69
|
-
totalEntries: response === null || response === void 0 ? void 0 : response.total_entries,
|
|
70
|
-
data: response === null || response === void 0 ? void 0 : response.data
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
getBackendFormat(request) {
|
|
74
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
75
|
-
const params = {};
|
|
76
|
-
params['page'] = (_a = request === null || request === void 0 ? void 0 : request.pageNumber) !== null && _a !== void 0 ? _a : 1;
|
|
77
|
-
params['page_size'] = (_b = request === null || request === void 0 ? void 0 : request.pageSize) !== null && _b !== void 0 ? _b : 25;
|
|
78
|
-
if (request === null || request === void 0 ? void 0 : request.sort) {
|
|
79
|
-
const sort = Array.isArray(request === null || request === void 0 ? void 0 : request.sort) ? request === null || request === void 0 ? void 0 : request.sort : [request === null || request === void 0 ? void 0 : request.sort];
|
|
80
|
-
const filteredSort = sort === null || sort === void 0 ? void 0 : sort.filter(item => !!(item === null || item === void 0 ? void 0 : item.name) && !!(item === null || item === void 0 ? void 0 : item.direction));
|
|
81
|
-
params['sort'] = (_c = filteredSort === null || filteredSort === void 0 ? void 0 : filteredSort.map(item => item === null || item === void 0 ? void 0 : item.name)) === null || _c === void 0 ? void 0 : _c.join(',');
|
|
82
|
-
params['sort_direction'] = (_d = filteredSort === null || filteredSort === void 0 ? void 0 : filteredSort.map(item => item === null || item === void 0 ? void 0 : item.direction)) === null || _d === void 0 ? void 0 : _d.join(',');
|
|
83
|
-
}
|
|
84
|
-
if ((request === null || request === void 0 ? void 0 : request.query) && ((_e = request === null || request === void 0 ? void 0 : request.query) === null || _e === void 0 ? void 0 : _e.length) > 0 && (request === null || request === void 0 ? void 0 : request.queryFields) && ((_f = request === null || request === void 0 ? void 0 : request.queryFields) === null || _f === void 0 ? void 0 : _f.length) > 0) {
|
|
85
|
-
params['query'] = request === null || request === void 0 ? void 0 : request.query;
|
|
86
|
-
params['query_fields'] = (_g = request === null || request === void 0 ? void 0 : request.queryFields) === null || _g === void 0 ? void 0 : _g.join(',');
|
|
87
|
-
}
|
|
88
|
-
return params;
|
|
89
|
-
}
|
|
23
|
+
class ApiCollectionProvider extends CollectionProvider {
|
|
24
|
+
constructor(endpoint, httpClient) {
|
|
25
|
+
super();
|
|
26
|
+
this.endpoint = endpoint;
|
|
27
|
+
this.httpClient = httpClient;
|
|
28
|
+
// State.
|
|
29
|
+
this.extraParams = {};
|
|
30
|
+
}
|
|
31
|
+
append(name, value) {
|
|
32
|
+
this.extraParams[name] = isObservable(value) ? value : of(value);
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
transform(request) {
|
|
36
|
+
const endpoint$ = isObservable(this.endpoint) ? this.endpoint : of(this.endpoint);
|
|
37
|
+
const params = this.getBackendFormat(request);
|
|
38
|
+
const extraParams$ = this.getExtraParams(this.extraParams);
|
|
39
|
+
return combineLatest([endpoint$, extraParams$]).pipe(switchMap(([endpoint, extraParams]) => {
|
|
40
|
+
return this.httpClient.get(endpoint, {
|
|
41
|
+
params: Object.assign(Object.assign({}, params), extraParams)
|
|
42
|
+
});
|
|
43
|
+
}), map(response => this.formatToCollectionData(response)));
|
|
44
|
+
}
|
|
45
|
+
getExtraParams(params) {
|
|
46
|
+
const keys = Object.keys(params !== null && params !== void 0 ? params : {});
|
|
47
|
+
if (keys.length <= 0) {
|
|
48
|
+
return of({});
|
|
49
|
+
}
|
|
50
|
+
const observables$ = keys.map(key => params === null || params === void 0 ? void 0 : params[key]);
|
|
51
|
+
return combineLatest(observables$).pipe(map(data => {
|
|
52
|
+
return data.reduce((previous, current, index) => {
|
|
53
|
+
if (current === null || current === undefined) {
|
|
54
|
+
return previous;
|
|
55
|
+
}
|
|
56
|
+
const key = keys === null || keys === void 0 ? void 0 : keys[index];
|
|
57
|
+
return Object.assign(Object.assign({}, previous), { [key]: current });
|
|
58
|
+
}, {});
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
formatToCollectionData(response) {
|
|
62
|
+
if (Array.isArray(response)) {
|
|
63
|
+
return this.formatArrayToCollectionData(response);
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
pageSize: response === null || response === void 0 ? void 0 : response.page_size,
|
|
67
|
+
pageNumber: response === null || response === void 0 ? void 0 : response.page_number,
|
|
68
|
+
totalPages: response === null || response === void 0 ? void 0 : response.total_pages,
|
|
69
|
+
totalEntries: response === null || response === void 0 ? void 0 : response.total_entries,
|
|
70
|
+
data: response === null || response === void 0 ? void 0 : response.data
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
getBackendFormat(request) {
|
|
74
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
75
|
+
const params = {};
|
|
76
|
+
params['page'] = (_a = request === null || request === void 0 ? void 0 : request.pageNumber) !== null && _a !== void 0 ? _a : 1;
|
|
77
|
+
params['page_size'] = (_b = request === null || request === void 0 ? void 0 : request.pageSize) !== null && _b !== void 0 ? _b : 25;
|
|
78
|
+
if (request === null || request === void 0 ? void 0 : request.sort) {
|
|
79
|
+
const sort = Array.isArray(request === null || request === void 0 ? void 0 : request.sort) ? request === null || request === void 0 ? void 0 : request.sort : [request === null || request === void 0 ? void 0 : request.sort];
|
|
80
|
+
const filteredSort = sort === null || sort === void 0 ? void 0 : sort.filter(item => !!(item === null || item === void 0 ? void 0 : item.name) && !!(item === null || item === void 0 ? void 0 : item.direction));
|
|
81
|
+
params['sort'] = (_c = filteredSort === null || filteredSort === void 0 ? void 0 : filteredSort.map(item => item === null || item === void 0 ? void 0 : item.name)) === null || _c === void 0 ? void 0 : _c.join(',');
|
|
82
|
+
params['sort_direction'] = (_d = filteredSort === null || filteredSort === void 0 ? void 0 : filteredSort.map(item => item === null || item === void 0 ? void 0 : item.direction)) === null || _d === void 0 ? void 0 : _d.join(',');
|
|
83
|
+
}
|
|
84
|
+
if ((request === null || request === void 0 ? void 0 : request.query) && ((_e = request === null || request === void 0 ? void 0 : request.query) === null || _e === void 0 ? void 0 : _e.length) > 0 && (request === null || request === void 0 ? void 0 : request.queryFields) && ((_f = request === null || request === void 0 ? void 0 : request.queryFields) === null || _f === void 0 ? void 0 : _f.length) > 0) {
|
|
85
|
+
params['query'] = request === null || request === void 0 ? void 0 : request.query;
|
|
86
|
+
params['query_fields'] = (_g = request === null || request === void 0 ? void 0 : request.queryFields) === null || _g === void 0 ? void 0 : _g.join(',');
|
|
87
|
+
}
|
|
88
|
+
return params;
|
|
89
|
+
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
class LocalCollectionProvider extends CollectionProvider {
|
|
93
|
-
constructor(_items) {
|
|
94
|
-
super();
|
|
95
|
-
this._items = _items;
|
|
96
|
-
}
|
|
97
|
-
transform(request) {
|
|
98
|
-
const items$ = Array.isArray(this._items)
|
|
99
|
-
? of(this._items)
|
|
100
|
-
: this._items;
|
|
101
|
-
return items$.pipe(map(items => this.formatArrayToCollectionData(items)));
|
|
102
|
-
}
|
|
92
|
+
class LocalCollectionProvider extends CollectionProvider {
|
|
93
|
+
constructor(_items) {
|
|
94
|
+
super();
|
|
95
|
+
this._items = _items;
|
|
96
|
+
}
|
|
97
|
+
transform(request) {
|
|
98
|
+
const items$ = Array.isArray(this._items)
|
|
99
|
+
? of(this._items)
|
|
100
|
+
: this._items;
|
|
101
|
+
return items$.pipe(map(items => this.formatArrayToCollectionData(items)));
|
|
102
|
+
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
class BbCollectionsData {
|
|
106
|
-
}
|
|
107
|
-
BbCollectionsData.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
108
|
-
BbCollectionsData.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
109
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
110
|
-
type: Directive,
|
|
111
|
-
args: [{
|
|
112
|
-
selector: '[bbCollectionsData]'
|
|
113
|
-
}]
|
|
114
|
-
}] });
|
|
115
|
-
class BbCollectionsEmpty {
|
|
116
|
-
}
|
|
117
|
-
BbCollectionsEmpty.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
118
|
-
BbCollectionsEmpty.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
119
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
120
|
-
type: Directive,
|
|
121
|
-
args: [{
|
|
122
|
-
selector: '[bbCollectionsEmpty]'
|
|
123
|
-
}]
|
|
124
|
-
}] });
|
|
125
|
-
class BbCollectionsError {
|
|
126
|
-
}
|
|
127
|
-
BbCollectionsError.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
128
|
-
BbCollectionsError.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
129
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
130
|
-
type: Directive,
|
|
131
|
-
args: [{
|
|
132
|
-
selector: '[bbCollectionsError]'
|
|
133
|
-
}]
|
|
134
|
-
}] });
|
|
135
|
-
class BbCollectionsInitial {
|
|
136
|
-
}
|
|
137
|
-
BbCollectionsInitial.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
138
|
-
BbCollectionsInitial.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
139
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
140
|
-
type: Directive,
|
|
141
|
-
args: [{
|
|
142
|
-
selector: '[bbCollectionsInitial]'
|
|
143
|
-
}]
|
|
105
|
+
class BbCollectionsData {
|
|
106
|
+
}
|
|
107
|
+
BbCollectionsData.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCollectionsData, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
108
|
+
BbCollectionsData.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: BbCollectionsData, selector: "[bbCollectionsData]", ngImport: i0 });
|
|
109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCollectionsData, decorators: [{
|
|
110
|
+
type: Directive,
|
|
111
|
+
args: [{
|
|
112
|
+
selector: '[bbCollectionsData]'
|
|
113
|
+
}]
|
|
114
|
+
}] });
|
|
115
|
+
class BbCollectionsEmpty {
|
|
116
|
+
}
|
|
117
|
+
BbCollectionsEmpty.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCollectionsEmpty, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
118
|
+
BbCollectionsEmpty.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: BbCollectionsEmpty, selector: "[bbCollectionsEmpty]", ngImport: i0 });
|
|
119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCollectionsEmpty, decorators: [{
|
|
120
|
+
type: Directive,
|
|
121
|
+
args: [{
|
|
122
|
+
selector: '[bbCollectionsEmpty]'
|
|
123
|
+
}]
|
|
124
|
+
}] });
|
|
125
|
+
class BbCollectionsError {
|
|
126
|
+
}
|
|
127
|
+
BbCollectionsError.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCollectionsError, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
128
|
+
BbCollectionsError.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: BbCollectionsError, selector: "[bbCollectionsError]", ngImport: i0 });
|
|
129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCollectionsError, decorators: [{
|
|
130
|
+
type: Directive,
|
|
131
|
+
args: [{
|
|
132
|
+
selector: '[bbCollectionsError]'
|
|
133
|
+
}]
|
|
134
|
+
}] });
|
|
135
|
+
class BbCollectionsInitial {
|
|
136
|
+
}
|
|
137
|
+
BbCollectionsInitial.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCollectionsInitial, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
138
|
+
BbCollectionsInitial.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: BbCollectionsInitial, selector: "[bbCollectionsInitial]", ngImport: i0 });
|
|
139
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCollectionsInitial, decorators: [{
|
|
140
|
+
type: Directive,
|
|
141
|
+
args: [{
|
|
142
|
+
selector: '[bbCollectionsInitial]'
|
|
143
|
+
}]
|
|
144
144
|
}] });
|
|
145
145
|
|
|
146
|
-
class BbCollectionsViewer {
|
|
147
|
-
constructor() {
|
|
148
|
-
// Inputs.
|
|
149
|
-
this.collection = null;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
BbCollectionsViewer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
153
|
-
BbCollectionsViewer.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
154
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
155
|
-
type: Component,
|
|
156
|
-
args: [{ selector: '[bb-collections-viewer]', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-collections-viewer' }, preserveWhitespaces: false, template: "<ng-container *ngIf=\"collection?.data$ | async as data\"\n [ngSwitch]=\"data?.state\">\n <ng-container *ngSwitchDefault>\n <ng-container *ngTemplateOutlet=\"dataTemplate; context: {items: data?.response?.data}\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"'initial'\">\n <ng-container *ngTemplateOutlet=\"initialTemplate\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"'empty'\">\n <ng-container *ngTemplateOutlet=\"emptyTemplate; context: {query: data?.request?.query}\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"'error'\">\n <ng-container *ngTemplateOutlet=\"errorTemplate; context: {error: data?.error}\"></ng-container>\n </ng-container>\n</ng-container>\n", styles: [".bb-collections-viewer{display:block}\n"] }]
|
|
157
|
-
}], propDecorators: { dataTemplate: [{
|
|
158
|
-
type: ContentChild,
|
|
159
|
-
args: [BbCollectionsData, { read: TemplateRef, static: false }]
|
|
160
|
-
}], emptyTemplate: [{
|
|
161
|
-
type: ContentChild,
|
|
162
|
-
args: [BbCollectionsEmpty, { read: TemplateRef, static: false }]
|
|
163
|
-
}], errorTemplate: [{
|
|
164
|
-
type: ContentChild,
|
|
165
|
-
args: [BbCollectionsError, { read: TemplateRef, static: false }]
|
|
166
|
-
}], initialTemplate: [{
|
|
167
|
-
type: ContentChild,
|
|
168
|
-
args: [BbCollectionsInitial, { read: TemplateRef, static: false }]
|
|
169
|
-
}], collection: [{
|
|
170
|
-
type: Input
|
|
146
|
+
class BbCollectionsViewer {
|
|
147
|
+
constructor() {
|
|
148
|
+
// Inputs.
|
|
149
|
+
this.collection = null;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
BbCollectionsViewer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCollectionsViewer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
153
|
+
BbCollectionsViewer.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbCollectionsViewer, selector: "[bb-collections-viewer]", inputs: { collection: "collection" }, host: { classAttribute: "bb-collections-viewer" }, queries: [{ propertyName: "dataTemplate", first: true, predicate: BbCollectionsData, descendants: true, read: TemplateRef }, { propertyName: "emptyTemplate", first: true, predicate: BbCollectionsEmpty, descendants: true, read: TemplateRef }, { propertyName: "errorTemplate", first: true, predicate: BbCollectionsError, descendants: true, read: TemplateRef }, { propertyName: "initialTemplate", first: true, predicate: BbCollectionsInitial, descendants: true, read: TemplateRef }], ngImport: i0, template: "<ng-container *ngIf=\"collection?.data$ | async as data\"\r\n [ngSwitch]=\"data?.state\">\r\n <ng-container *ngSwitchDefault>\r\n <ng-container *ngTemplateOutlet=\"dataTemplate; context: {items: data?.response?.data}\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'initial'\">\r\n <ng-container *ngTemplateOutlet=\"initialTemplate\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'empty'\">\r\n <ng-container *ngTemplateOutlet=\"emptyTemplate; context: {query: data?.request?.query}\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'error'\">\r\n <ng-container *ngTemplateOutlet=\"errorTemplate; context: {error: data?.error}\"></ng-container>\r\n </ng-container>\r\n</ng-container>\r\n", styles: [".bb-collections-viewer{display:block}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
154
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCollectionsViewer, decorators: [{
|
|
155
|
+
type: Component,
|
|
156
|
+
args: [{ selector: '[bb-collections-viewer]', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-collections-viewer' }, preserveWhitespaces: false, template: "<ng-container *ngIf=\"collection?.data$ | async as data\"\r\n [ngSwitch]=\"data?.state\">\r\n <ng-container *ngSwitchDefault>\r\n <ng-container *ngTemplateOutlet=\"dataTemplate; context: {items: data?.response?.data}\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'initial'\">\r\n <ng-container *ngTemplateOutlet=\"initialTemplate\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'empty'\">\r\n <ng-container *ngTemplateOutlet=\"emptyTemplate; context: {query: data?.request?.query}\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'error'\">\r\n <ng-container *ngTemplateOutlet=\"errorTemplate; context: {error: data?.error}\"></ng-container>\r\n </ng-container>\r\n</ng-container>\r\n", styles: [".bb-collections-viewer{display:block}\n"] }]
|
|
157
|
+
}], propDecorators: { dataTemplate: [{
|
|
158
|
+
type: ContentChild,
|
|
159
|
+
args: [BbCollectionsData, { read: TemplateRef, static: false }]
|
|
160
|
+
}], emptyTemplate: [{
|
|
161
|
+
type: ContentChild,
|
|
162
|
+
args: [BbCollectionsEmpty, { read: TemplateRef, static: false }]
|
|
163
|
+
}], errorTemplate: [{
|
|
164
|
+
type: ContentChild,
|
|
165
|
+
args: [BbCollectionsError, { read: TemplateRef, static: false }]
|
|
166
|
+
}], initialTemplate: [{
|
|
167
|
+
type: ContentChild,
|
|
168
|
+
args: [BbCollectionsInitial, { read: TemplateRef, static: false }]
|
|
169
|
+
}], collection: [{
|
|
170
|
+
type: Input
|
|
171
171
|
}] } });
|
|
172
172
|
|
|
173
|
-
class BbCollectionsPager {
|
|
174
|
-
constructor() {
|
|
175
|
-
// Readonly data.
|
|
176
|
-
this.maxAmountOfButtons = 5;
|
|
177
|
-
this.cache$ = new BehaviorSubject({});
|
|
178
|
-
// State and subscriptions.
|
|
179
|
-
this._label = null;
|
|
180
|
-
this._collection = null;
|
|
181
|
-
this._subscription = null;
|
|
182
|
-
}
|
|
183
|
-
// Inputs.
|
|
184
|
-
set label(value) {
|
|
185
|
-
this._label = value;
|
|
186
|
-
this.cache$.next(this.cache$.getValue());
|
|
187
|
-
}
|
|
188
|
-
set collection(collection) {
|
|
189
|
-
this._collection = collection;
|
|
190
|
-
this.observeCollectionChanges();
|
|
191
|
-
}
|
|
192
|
-
ngOnInit() {
|
|
193
|
-
this.data$ = this.cache$.pipe(map(cache => {
|
|
194
|
-
var _a, _b, _c, _d;
|
|
195
|
-
const pageSize = (_a = cache === null || cache === void 0 ? void 0 : cache.pageSize) !== null && _a !== void 0 ? _a : 1;
|
|
196
|
-
const pageNumber = (_b = cache === null || cache === void 0 ? void 0 : cache.pageNumber) !== null && _b !== void 0 ? _b : 1;
|
|
197
|
-
const totalPages = Math.max(0, (_c = cache === null || cache === void 0 ? void 0 : cache.totalPages) !== null && _c !== void 0 ? _c : 1);
|
|
198
|
-
const totalEntries = Math.max(0, (_d = cache === null || cache === void 0 ? void 0 : cache.totalEntries) !== null && _d !== void 0 ? _d : 0);
|
|
199
|
-
const fromStart = Math.max(0, Math.min((pageSize * (pageNumber - 1)) + 1, totalEntries));
|
|
200
|
-
const fromEnd = Math.max(0, Math.min((fromStart - 1) + pageSize, totalEntries));
|
|
201
|
-
const pages = this.filterActivePages(pageNumber, totalPages);
|
|
202
|
-
const allowNext = pageNumber < totalPages;
|
|
203
|
-
const allowPrevious = pageNumber > 1;
|
|
204
|
-
return {
|
|
205
|
-
totalPages,
|
|
206
|
-
pages,
|
|
207
|
-
pageNumber,
|
|
208
|
-
allowNext,
|
|
209
|
-
allowPrevious,
|
|
210
|
-
label: this.calculateLabel(fromStart, fromEnd, totalEntries)
|
|
211
|
-
};
|
|
212
|
-
}));
|
|
213
|
-
}
|
|
214
|
-
ngOnDestroy() {
|
|
215
|
-
var _a;
|
|
216
|
-
(_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
217
|
-
}
|
|
218
|
-
setPage(pageNumber, totalPages) {
|
|
219
|
-
var _a, _b, _c, _d;
|
|
220
|
-
// Calculate the new value.
|
|
221
|
-
const newValue = Math.min(totalPages, Math.max(1, pageNumber));
|
|
222
|
-
// Validate the value is actually different.
|
|
223
|
-
const currentValue = (_b = (_a = this._collection) === null || _a === void 0 ? void 0 : _a.pageNumberControl) === null || _b === void 0 ? void 0 : _b.value;
|
|
224
|
-
if (currentValue === newValue) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
(_d = (_c = this._collection) === null || _c === void 0 ? void 0 : _c.pageNumberControl) === null || _d === void 0 ? void 0 : _d.setValue(pageNumber);
|
|
228
|
-
}
|
|
229
|
-
observeCollectionChanges() {
|
|
230
|
-
var _a, _b, _c, _d, _e;
|
|
231
|
-
if (!this._collection) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
if (this._subscription) {
|
|
235
|
-
(_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
236
|
-
}
|
|
237
|
-
const pageNumber = (_c = (_b = this._collection) === null || _b === void 0 ? void 0 : _b.pageNumberControl) === null || _c === void 0 ? void 0 : _c.value;
|
|
238
|
-
const pageSize = (_e = (_d = this._collection) === null || _d === void 0 ? void 0 : _d.pageSizeControl) === null || _e === void 0 ? void 0 : _e.value;
|
|
239
|
-
this.cache$.next({ pageNumber, pageSize });
|
|
240
|
-
this._subscription = this._collection.raw$.subscribe(data => {
|
|
241
|
-
if (data) {
|
|
242
|
-
this.cache$.next(data);
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
calculateLabel(start, end, total) {
|
|
247
|
-
var _a;
|
|
248
|
-
const startPoint = '[start]';
|
|
249
|
-
const endPoint = '[end]';
|
|
250
|
-
const totalPoint = '[total]';
|
|
251
|
-
const label = (_a = this._label) !== null && _a !== void 0 ? _a : `Showing ${startPoint} to ${endPoint} of ${totalPoint} results`;
|
|
252
|
-
return label
|
|
253
|
-
.replace(startPoint, `<strong>${start}</strong>`)
|
|
254
|
-
.replace(endPoint, `<strong>${end}</strong>`)
|
|
255
|
-
.replace(totalPoint, `<strong>${total}</strong>`);
|
|
256
|
-
}
|
|
257
|
-
calculatePages(pageNumber, totalPages) {
|
|
258
|
-
const min = 1;
|
|
259
|
-
const max = totalPages;
|
|
260
|
-
const amount = Math.max(1, this.maxAmountOfButtons);
|
|
261
|
-
const data = Array(amount)
|
|
262
|
-
.fill(0)
|
|
263
|
-
.map((_, index) => pageNumber + (index - 1));
|
|
264
|
-
// Validate if the minimum value less than
|
|
265
|
-
// the first value.
|
|
266
|
-
if (data[0] < min) {
|
|
267
|
-
return data.map(item => item + 1);
|
|
268
|
-
}
|
|
269
|
-
// Calculate the difference with the max
|
|
270
|
-
// if this value is higher than 0 we should minus it.
|
|
271
|
-
const lastValueInArray = data[data.length - 1];
|
|
272
|
-
const differenceWithMax = lastValueInArray - max;
|
|
273
|
-
if (differenceWithMax > 0) {
|
|
274
|
-
return data.map(item => item - differenceWithMax);
|
|
275
|
-
}
|
|
276
|
-
// Just return the default data.
|
|
277
|
-
return data;
|
|
278
|
-
}
|
|
279
|
-
filterActivePages(pageNumber, totalPages) {
|
|
280
|
-
return this.calculatePages(pageNumber, totalPages)
|
|
281
|
-
.filter(page => page > 0 && page <= totalPages)
|
|
282
|
-
.map(page => ({ page, active: pageNumber === page }));
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
BbCollectionsPager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
286
|
-
BbCollectionsPager.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
287
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
288
|
-
type: Component,
|
|
289
|
-
args: [{ selector: 'bb-collections-pager', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-collections-pager' }, preserveWhitespaces: false, template: "<ng-container *ngIf=\"data$ | async as data\">\n <div [innerHTML]=\"data?.label\"\n class=\"bb-collections-pager-text\">\n </div>\n\n <div class=\"bb-collections-pager-container\">\n <ul class=\"bb-collections-pager-list\">\n <li class=\"bb-collections-pager-item\"\n title=\"Previous page\">\n <button [disabled]=\"!data?.allowPrevious\"\n (click)=\"setPage(data?.pageNumber - 1, data?.totalPages)\"\n class=\"bb-collections-pager-button arrow first\"\n type=\"button\">\n ←\n </button>\n </li>\n <li *ngFor=\"let item of data?.pages\"\n [title]=\"'Page ' + item?.page\"\n class=\"bb-collections-pager-item\">\n <button [class.active]=\"item?.active\"\n (click)=\"setPage(item?.page, data?.totalPages)\"\n class=\"bb-collections-pager-button\"\n type=\"button\">\n {{ item?.page }}\n </button>\n </li>\n <li class=\"bb-collections-pager-item\"\n title=\"Next page\">\n <button [disabled]=\"!data?.allowNext\"\n (click)=\"setPage(data?.pageNumber + 1, data?.totalPages)\"\n class=\"bb-collections-pager-button arrow last\"\n type=\"button\">\n →\n </button>\n </li>\n </ul>\n </div>\n</ng-container>\n", styles: [".bb-collections-pager{display:flex;align-items:center;flex-direction:column-reverse}.bb-collections-pager-text{display:block;margin-top:10px}.bb-collections-pager-text>strong{font-weight:500}.bb-collections-pager-container{width:100%;display:flex;overflow-x:auto;align-items:center;justify-content:center}.bb-collections-pager-list{display:flex;border-radius:6px;align-items:center;background-color:#fff;border:1px solid rgba(67,90,111,.3);box-shadow:#435a6f24 0 1px 2px inset}.bb-collections-pager-item:not(:last-child){border-right:1px solid #cccccc}.bb-collections-pager-button{height:34px;border:none;display:flex;padding:0 4px;min-width:40px;-webkit-appearance:none;appearance:none;min-height:34px;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center;background-color:transparent}.bb-collections-pager-button:hover,.bb-collections-pager-button:focus,.bb-collections-pager-button:active,.bb-collections-pager-button.active{color:#1565c0;font-weight:500}.bb-collections-pager-button:hover,.bb-collections-pager-button:focus{background-color:#1565c00d}.bb-collections-pager-button:active,.bb-collections-pager-button.active{background-color:#1565c033}.bb-collections-pager-button:not(.arrow):hover,.bb-collections-pager-button:not(.arrow):focus{outline:1px solid rgba(21,101,192,.5)}.bb-collections-pager-button:not(.arrow):focus,.bb-collections-pager-button:not(.arrow):active{outline:1px solid #1565c0;box-shadow:#1565c066 0 0 0 3px}.bb-collections-pager-button:not(.arrow).active{outline:1px solid #1565c0}.bb-collections-pager-button.arrow{font-weight:500}.bb-collections-pager-button.arrow.first{border-top-left-radius:2px;border-bottom-left-radius:2px}.bb-collections-pager-button.arrow.last{border-top-right-radius:2px;border-bottom-right-radius:2px}.bb-collections-pager-button:disabled{color:#000;outline:none;opacity:.25;cursor:default;pointer-events:none;background-color:transparent}@media only screen and (min-width: 768px){.bb-collections-pager{flex-wrap:wrap;align-items:center;flex-direction:row;justify-content:space-between}.bb-collections-pager-text{margin-top:0}.bb-collections-pager-container{width:auto;overflow-x:unset}}\n"] }]
|
|
290
|
-
}], propDecorators: { label: [{
|
|
291
|
-
type: Input
|
|
292
|
-
}], collection: [{
|
|
293
|
-
type: Input
|
|
173
|
+
class BbCollectionsPager {
|
|
174
|
+
constructor() {
|
|
175
|
+
// Readonly data.
|
|
176
|
+
this.maxAmountOfButtons = 5;
|
|
177
|
+
this.cache$ = new BehaviorSubject({});
|
|
178
|
+
// State and subscriptions.
|
|
179
|
+
this._label = null;
|
|
180
|
+
this._collection = null;
|
|
181
|
+
this._subscription = null;
|
|
182
|
+
}
|
|
183
|
+
// Inputs.
|
|
184
|
+
set label(value) {
|
|
185
|
+
this._label = value;
|
|
186
|
+
this.cache$.next(this.cache$.getValue());
|
|
187
|
+
}
|
|
188
|
+
set collection(collection) {
|
|
189
|
+
this._collection = collection;
|
|
190
|
+
this.observeCollectionChanges();
|
|
191
|
+
}
|
|
192
|
+
ngOnInit() {
|
|
193
|
+
this.data$ = this.cache$.pipe(map(cache => {
|
|
194
|
+
var _a, _b, _c, _d;
|
|
195
|
+
const pageSize = (_a = cache === null || cache === void 0 ? void 0 : cache.pageSize) !== null && _a !== void 0 ? _a : 1;
|
|
196
|
+
const pageNumber = (_b = cache === null || cache === void 0 ? void 0 : cache.pageNumber) !== null && _b !== void 0 ? _b : 1;
|
|
197
|
+
const totalPages = Math.max(0, (_c = cache === null || cache === void 0 ? void 0 : cache.totalPages) !== null && _c !== void 0 ? _c : 1);
|
|
198
|
+
const totalEntries = Math.max(0, (_d = cache === null || cache === void 0 ? void 0 : cache.totalEntries) !== null && _d !== void 0 ? _d : 0);
|
|
199
|
+
const fromStart = Math.max(0, Math.min((pageSize * (pageNumber - 1)) + 1, totalEntries));
|
|
200
|
+
const fromEnd = Math.max(0, Math.min((fromStart - 1) + pageSize, totalEntries));
|
|
201
|
+
const pages = this.filterActivePages(pageNumber, totalPages);
|
|
202
|
+
const allowNext = pageNumber < totalPages;
|
|
203
|
+
const allowPrevious = pageNumber > 1;
|
|
204
|
+
return {
|
|
205
|
+
totalPages,
|
|
206
|
+
pages,
|
|
207
|
+
pageNumber,
|
|
208
|
+
allowNext,
|
|
209
|
+
allowPrevious,
|
|
210
|
+
label: this.calculateLabel(fromStart, fromEnd, totalEntries)
|
|
211
|
+
};
|
|
212
|
+
}));
|
|
213
|
+
}
|
|
214
|
+
ngOnDestroy() {
|
|
215
|
+
var _a;
|
|
216
|
+
(_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
217
|
+
}
|
|
218
|
+
setPage(pageNumber, totalPages) {
|
|
219
|
+
var _a, _b, _c, _d;
|
|
220
|
+
// Calculate the new value.
|
|
221
|
+
const newValue = Math.min(totalPages, Math.max(1, pageNumber));
|
|
222
|
+
// Validate the value is actually different.
|
|
223
|
+
const currentValue = (_b = (_a = this._collection) === null || _a === void 0 ? void 0 : _a.pageNumberControl) === null || _b === void 0 ? void 0 : _b.value;
|
|
224
|
+
if (currentValue === newValue) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
(_d = (_c = this._collection) === null || _c === void 0 ? void 0 : _c.pageNumberControl) === null || _d === void 0 ? void 0 : _d.setValue(pageNumber);
|
|
228
|
+
}
|
|
229
|
+
observeCollectionChanges() {
|
|
230
|
+
var _a, _b, _c, _d, _e;
|
|
231
|
+
if (!this._collection) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (this._subscription) {
|
|
235
|
+
(_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
236
|
+
}
|
|
237
|
+
const pageNumber = (_c = (_b = this._collection) === null || _b === void 0 ? void 0 : _b.pageNumberControl) === null || _c === void 0 ? void 0 : _c.value;
|
|
238
|
+
const pageSize = (_e = (_d = this._collection) === null || _d === void 0 ? void 0 : _d.pageSizeControl) === null || _e === void 0 ? void 0 : _e.value;
|
|
239
|
+
this.cache$.next({ pageNumber, pageSize });
|
|
240
|
+
this._subscription = this._collection.raw$.subscribe(data => {
|
|
241
|
+
if (data) {
|
|
242
|
+
this.cache$.next(data);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
calculateLabel(start, end, total) {
|
|
247
|
+
var _a;
|
|
248
|
+
const startPoint = '[start]';
|
|
249
|
+
const endPoint = '[end]';
|
|
250
|
+
const totalPoint = '[total]';
|
|
251
|
+
const label = (_a = this._label) !== null && _a !== void 0 ? _a : `Showing ${startPoint} to ${endPoint} of ${totalPoint} results`;
|
|
252
|
+
return label
|
|
253
|
+
.replace(startPoint, `<strong>${start}</strong>`)
|
|
254
|
+
.replace(endPoint, `<strong>${end}</strong>`)
|
|
255
|
+
.replace(totalPoint, `<strong>${total}</strong>`);
|
|
256
|
+
}
|
|
257
|
+
calculatePages(pageNumber, totalPages) {
|
|
258
|
+
const min = 1;
|
|
259
|
+
const max = totalPages;
|
|
260
|
+
const amount = Math.max(1, this.maxAmountOfButtons);
|
|
261
|
+
const data = Array(amount)
|
|
262
|
+
.fill(0)
|
|
263
|
+
.map((_, index) => pageNumber + (index - 1));
|
|
264
|
+
// Validate if the minimum value less than
|
|
265
|
+
// the first value.
|
|
266
|
+
if (data[0] < min) {
|
|
267
|
+
return data.map(item => item + 1);
|
|
268
|
+
}
|
|
269
|
+
// Calculate the difference with the max
|
|
270
|
+
// if this value is higher than 0 we should minus it.
|
|
271
|
+
const lastValueInArray = data[data.length - 1];
|
|
272
|
+
const differenceWithMax = lastValueInArray - max;
|
|
273
|
+
if (differenceWithMax > 0) {
|
|
274
|
+
return data.map(item => item - differenceWithMax);
|
|
275
|
+
}
|
|
276
|
+
// Just return the default data.
|
|
277
|
+
return data;
|
|
278
|
+
}
|
|
279
|
+
filterActivePages(pageNumber, totalPages) {
|
|
280
|
+
return this.calculatePages(pageNumber, totalPages)
|
|
281
|
+
.filter(page => page > 0 && page <= totalPages)
|
|
282
|
+
.map(page => ({ page, active: pageNumber === page }));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
BbCollectionsPager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCollectionsPager, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
286
|
+
BbCollectionsPager.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbCollectionsPager, selector: "bb-collections-pager", inputs: { label: "label", collection: "collection" }, host: { classAttribute: "bb-collections-pager" }, ngImport: i0, template: "<ng-container *ngIf=\"data$ | async as data\">\r\n <div [innerHTML]=\"data?.label\"\r\n class=\"bb-collections-pager-text\">\r\n </div>\r\n\r\n <div class=\"bb-collections-pager-container\">\r\n <ul class=\"bb-collections-pager-list\">\r\n <li class=\"bb-collections-pager-item\"\r\n title=\"Previous page\">\r\n <button [disabled]=\"!data?.allowPrevious\"\r\n (click)=\"setPage(data?.pageNumber - 1, data?.totalPages)\"\r\n class=\"bb-collections-pager-button arrow first\"\r\n type=\"button\">\r\n ←\r\n </button>\r\n </li>\r\n <li *ngFor=\"let item of data?.pages\"\r\n [title]=\"'Page ' + item?.page\"\r\n class=\"bb-collections-pager-item\">\r\n <button [class.active]=\"item?.active\"\r\n (click)=\"setPage(item?.page, data?.totalPages)\"\r\n class=\"bb-collections-pager-button\"\r\n type=\"button\">\r\n {{ item?.page }}\r\n </button>\r\n </li>\r\n <li class=\"bb-collections-pager-item\"\r\n title=\"Next page\">\r\n <button [disabled]=\"!data?.allowNext\"\r\n (click)=\"setPage(data?.pageNumber + 1, data?.totalPages)\"\r\n class=\"bb-collections-pager-button arrow last\"\r\n type=\"button\">\r\n →\r\n </button>\r\n </li>\r\n </ul>\r\n </div>\r\n</ng-container>\r\n", styles: [".bb-collections-pager{display:flex;align-items:center;flex-direction:column-reverse}.bb-collections-pager-text{display:block;margin-top:10px}.bb-collections-pager-text>strong{font-weight:500}.bb-collections-pager-container{width:100%;display:flex;overflow-x:auto;align-items:center;justify-content:center}.bb-collections-pager-list{display:flex;border-radius:6px;align-items:center;background-color:#fff;border:1px solid rgba(67,90,111,.3);box-shadow:#435a6f24 0 1px 2px inset}.bb-collections-pager-item:not(:last-child){border-right:1px solid #cccccc}.bb-collections-pager-button{height:34px;border:none;display:flex;padding:0 4px;min-width:40px;-webkit-appearance:none;appearance:none;min-height:34px;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center;background-color:transparent}.bb-collections-pager-button:hover,.bb-collections-pager-button:focus,.bb-collections-pager-button:active,.bb-collections-pager-button.active{color:#1565c0;font-weight:500}.bb-collections-pager-button:hover,.bb-collections-pager-button:focus{background-color:#1565c00d}.bb-collections-pager-button:active,.bb-collections-pager-button.active{background-color:#1565c033}.bb-collections-pager-button:not(.arrow):hover,.bb-collections-pager-button:not(.arrow):focus{outline:1px solid rgba(21,101,192,.5)}.bb-collections-pager-button:not(.arrow):focus,.bb-collections-pager-button:not(.arrow):active{outline:1px solid #1565c0;box-shadow:#1565c066 0 0 0 3px}.bb-collections-pager-button:not(.arrow).active{outline:1px solid #1565c0}.bb-collections-pager-button.arrow{font-weight:500}.bb-collections-pager-button.arrow.first{border-top-left-radius:2px;border-bottom-left-radius:2px}.bb-collections-pager-button.arrow.last{border-top-right-radius:2px;border-bottom-right-radius:2px}.bb-collections-pager-button:disabled{color:#000;outline:none;opacity:.25;cursor:default;pointer-events:none;background-color:transparent}@media only screen and (min-width: 768px){.bb-collections-pager{flex-wrap:wrap;align-items:center;flex-direction:row;justify-content:space-between}.bb-collections-pager-text{margin-top:0}.bb-collections-pager-container{width:auto;overflow-x:unset}}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCollectionsPager, decorators: [{
|
|
288
|
+
type: Component,
|
|
289
|
+
args: [{ selector: 'bb-collections-pager', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-collections-pager' }, preserveWhitespaces: false, template: "<ng-container *ngIf=\"data$ | async as data\">\r\n <div [innerHTML]=\"data?.label\"\r\n class=\"bb-collections-pager-text\">\r\n </div>\r\n\r\n <div class=\"bb-collections-pager-container\">\r\n <ul class=\"bb-collections-pager-list\">\r\n <li class=\"bb-collections-pager-item\"\r\n title=\"Previous page\">\r\n <button [disabled]=\"!data?.allowPrevious\"\r\n (click)=\"setPage(data?.pageNumber - 1, data?.totalPages)\"\r\n class=\"bb-collections-pager-button arrow first\"\r\n type=\"button\">\r\n ←\r\n </button>\r\n </li>\r\n <li *ngFor=\"let item of data?.pages\"\r\n [title]=\"'Page ' + item?.page\"\r\n class=\"bb-collections-pager-item\">\r\n <button [class.active]=\"item?.active\"\r\n (click)=\"setPage(item?.page, data?.totalPages)\"\r\n class=\"bb-collections-pager-button\"\r\n type=\"button\">\r\n {{ item?.page }}\r\n </button>\r\n </li>\r\n <li class=\"bb-collections-pager-item\"\r\n title=\"Next page\">\r\n <button [disabled]=\"!data?.allowNext\"\r\n (click)=\"setPage(data?.pageNumber + 1, data?.totalPages)\"\r\n class=\"bb-collections-pager-button arrow last\"\r\n type=\"button\">\r\n →\r\n </button>\r\n </li>\r\n </ul>\r\n </div>\r\n</ng-container>\r\n", styles: [".bb-collections-pager{display:flex;align-items:center;flex-direction:column-reverse}.bb-collections-pager-text{display:block;margin-top:10px}.bb-collections-pager-text>strong{font-weight:500}.bb-collections-pager-container{width:100%;display:flex;overflow-x:auto;align-items:center;justify-content:center}.bb-collections-pager-list{display:flex;border-radius:6px;align-items:center;background-color:#fff;border:1px solid rgba(67,90,111,.3);box-shadow:#435a6f24 0 1px 2px inset}.bb-collections-pager-item:not(:last-child){border-right:1px solid #cccccc}.bb-collections-pager-button{height:34px;border:none;display:flex;padding:0 4px;min-width:40px;-webkit-appearance:none;appearance:none;min-height:34px;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center;background-color:transparent}.bb-collections-pager-button:hover,.bb-collections-pager-button:focus,.bb-collections-pager-button:active,.bb-collections-pager-button.active{color:#1565c0;font-weight:500}.bb-collections-pager-button:hover,.bb-collections-pager-button:focus{background-color:#1565c00d}.bb-collections-pager-button:active,.bb-collections-pager-button.active{background-color:#1565c033}.bb-collections-pager-button:not(.arrow):hover,.bb-collections-pager-button:not(.arrow):focus{outline:1px solid rgba(21,101,192,.5)}.bb-collections-pager-button:not(.arrow):focus,.bb-collections-pager-button:not(.arrow):active{outline:1px solid #1565c0;box-shadow:#1565c066 0 0 0 3px}.bb-collections-pager-button:not(.arrow).active{outline:1px solid #1565c0}.bb-collections-pager-button.arrow{font-weight:500}.bb-collections-pager-button.arrow.first{border-top-left-radius:2px;border-bottom-left-radius:2px}.bb-collections-pager-button.arrow.last{border-top-right-radius:2px;border-bottom-right-radius:2px}.bb-collections-pager-button:disabled{color:#000;outline:none;opacity:.25;cursor:default;pointer-events:none;background-color:transparent}@media only screen and (min-width: 768px){.bb-collections-pager{flex-wrap:wrap;align-items:center;flex-direction:row;justify-content:space-between}.bb-collections-pager-text{margin-top:0}.bb-collections-pager-container{width:auto;overflow-x:unset}}\n"] }]
|
|
290
|
+
}], propDecorators: { label: [{
|
|
291
|
+
type: Input
|
|
292
|
+
}], collection: [{
|
|
293
|
+
type: Input
|
|
294
294
|
}] } });
|
|
295
295
|
|
|
296
|
-
class Collection {
|
|
297
|
-
constructor(_provider, _initialValues = {}) {
|
|
298
|
-
var _a, _b, _c, _d, _e;
|
|
299
|
-
this._provider = _provider;
|
|
300
|
-
this._initialValues = _initialValues;
|
|
301
|
-
this.raw$ = new BehaviorSubject(null);
|
|
302
|
-
this.loading$ = new BehaviorSubject(true);
|
|
303
|
-
// State.
|
|
304
|
-
this._formatter = null;
|
|
305
|
-
this._refresh$ = new BehaviorSubject(0);
|
|
306
|
-
this._requestCache = null;
|
|
307
|
-
this.controlToObservable = (control) => {
|
|
308
|
-
return control.valueChanges.pipe(distinctUntilChanged(), startWith(control === null || control === void 0 ? void 0 : control.value));
|
|
309
|
-
};
|
|
310
|
-
this.queryControl = new FormControl((_a = _initialValues === null || _initialValues === void 0 ? void 0 : _initialValues.query) !== null && _a !== void 0 ? _a : null);
|
|
311
|
-
this.queryFieldsControl = new FormControl((_b = _initialValues === null || _initialValues === void 0 ? void 0 : _initialValues.queryFields) !== null && _b !== void 0 ? _b : []);
|
|
312
|
-
this.pageNumberControl = new FormControl((_c = _initialValues === null || _initialValues === void 0 ? void 0 : _initialValues.pageNumber) !== null && _c !== void 0 ? _c : 1);
|
|
313
|
-
this.pageSizeControl = new FormControl((_d = _initialValues === null || _initialValues === void 0 ? void 0 : _initialValues.pageSize) !== null && _d !== void 0 ? _d : 25);
|
|
314
|
-
this.sortControl = new FormControl((_e = _initialValues === null || _initialValues === void 0 ? void 0 : _initialValues.sort) !== null && _e !== void 0 ? _e : null);
|
|
315
|
-
this.data$ = this.getData();
|
|
316
|
-
}
|
|
317
|
-
refresh() {
|
|
318
|
-
this._refresh$.next(0);
|
|
319
|
-
}
|
|
320
|
-
setFormatter(callback) {
|
|
321
|
-
this._formatter = callback;
|
|
322
|
-
return this;
|
|
323
|
-
}
|
|
324
|
-
getData() {
|
|
325
|
-
const data$ = this.request.pipe(tap(() => this.loading$.next(true)), map(request => this.validateRequest(request)), switchMap(request => {
|
|
326
|
-
return this._provider.transform(request).pipe(tap(response => this.cacheCollectionData(response)), map(response => ({ response, request, initial: false })), catchError(error => of({
|
|
327
|
-
error,
|
|
328
|
-
request,
|
|
329
|
-
response: null,
|
|
330
|
-
initial: false
|
|
331
|
-
})));
|
|
332
|
-
}), startWith({ initial: true, response: null }));
|
|
333
|
-
return combineLatest([data$, this.loading$.asObservable()]).pipe(switchMap(([data, loading]) => {
|
|
334
|
-
const combined = Object.assign(Object.assign({}, data), { loading });
|
|
335
|
-
return this.formatResponse(data === null || data === void 0 ? void 0 : data.response).pipe(map(response => (Object.assign(Object.assign({}, combined), { response, state: this.getState(combined) }))));
|
|
336
|
-
}));
|
|
337
|
-
}
|
|
338
|
-
formatResponse(response) {
|
|
339
|
-
var _a, _b, _c;
|
|
340
|
-
if (!response || !this._formatter) {
|
|
341
|
-
return of(response);
|
|
342
|
-
}
|
|
343
|
-
const items = (_a = response === null || response === void 0 ? void 0 : response.data) !== null && _a !== void 0 ? _a : [];
|
|
344
|
-
const data = (_c = (_b = this._formatter) === null || _b === void 0 ? void 0 : _b.call(this, items)) !== null && _c !== void 0 ? _c : items;
|
|
345
|
-
const data$ = isObservable(data) ? data : of(data);
|
|
346
|
-
return data$.pipe(map(data => (Object.assign(Object.assign({}, response), { data }))));
|
|
347
|
-
}
|
|
348
|
-
validateRequest(request) {
|
|
349
|
-
var _a, _b, _c, _d;
|
|
350
|
-
// We should reset the page number whenever we change the query or the page size.
|
|
351
|
-
if (this._requestCache && request && (((_a = this._requestCache) === null || _a === void 0 ? void 0 : _a.query) !== (request === null || request === void 0 ? void 0 : request.query) || ((_b = this._requestCache) === null || _b === void 0 ? void 0 : _b.pageSize) !== (request === null || request === void 0 ? void 0 : request.pageSize))) {
|
|
352
|
-
(_c = this.pageNumberControl) === null || _c === void 0 ? void 0 : _c.setValue(1, { emitEvent: false });
|
|
353
|
-
request.pageNumber = (_d = this.pageNumberControl) === null || _d === void 0 ? void 0 : _d.value;
|
|
354
|
-
}
|
|
355
|
-
this._requestCache = Object.assign({}, request);
|
|
356
|
-
return request;
|
|
357
|
-
}
|
|
358
|
-
getState(data) {
|
|
359
|
-
var _a, _b, _c;
|
|
360
|
-
if (!!(data === null || data === void 0 ? void 0 : data.error)) {
|
|
361
|
-
return "error" /* Error */;
|
|
362
|
-
}
|
|
363
|
-
if (!!(data === null || data === void 0 ? void 0 : data.initial)) {
|
|
364
|
-
return "initial" /* Initial */;
|
|
365
|
-
}
|
|
366
|
-
const count = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
|
367
|
-
if (count <= 0) {
|
|
368
|
-
return "empty" /* Empty */;
|
|
369
|
-
}
|
|
370
|
-
return "data" /* Data */;
|
|
371
|
-
}
|
|
372
|
-
cacheCollectionData(data) {
|
|
373
|
-
this.raw$.next(data);
|
|
374
|
-
this.loading$.next(false);
|
|
375
|
-
}
|
|
376
|
-
get request() {
|
|
377
|
-
const pageNumber$ = this.controlToObservable(this.pageNumberControl);
|
|
378
|
-
const pageSize$ = this.controlToObservable(this.pageSizeControl);
|
|
379
|
-
const query$ = this.getQueryObservable();
|
|
380
|
-
const queryFields$ = this.controlToObservable(this.queryFieldsControl);
|
|
381
|
-
const sort$ = this.controlToObservable(this.sortControl);
|
|
382
|
-
return combineLatest([pageNumber$, pageSize$, query$, queryFields$, sort$, this._refresh$.asObservable()]).pipe(map(([pageNumber, pageSize, query, queryFields, sort]) => ({
|
|
383
|
-
pageNumber,
|
|
384
|
-
pageSize,
|
|
385
|
-
query,
|
|
386
|
-
queryFields,
|
|
387
|
-
sort
|
|
388
|
-
})));
|
|
389
|
-
}
|
|
390
|
-
getQueryObservable() {
|
|
391
|
-
var _a;
|
|
392
|
-
return this.queryControl.valueChanges.pipe(debounceTime(400), distinctUntilChanged(), startWith((_a = this.queryControl) === null || _a === void 0 ? void 0 : _a.value));
|
|
393
|
-
}
|
|
296
|
+
class Collection {
|
|
297
|
+
constructor(_provider, _initialValues = {}) {
|
|
298
|
+
var _a, _b, _c, _d, _e;
|
|
299
|
+
this._provider = _provider;
|
|
300
|
+
this._initialValues = _initialValues;
|
|
301
|
+
this.raw$ = new BehaviorSubject(null);
|
|
302
|
+
this.loading$ = new BehaviorSubject(true);
|
|
303
|
+
// State.
|
|
304
|
+
this._formatter = null;
|
|
305
|
+
this._refresh$ = new BehaviorSubject(0);
|
|
306
|
+
this._requestCache = null;
|
|
307
|
+
this.controlToObservable = (control) => {
|
|
308
|
+
return control.valueChanges.pipe(distinctUntilChanged(), startWith(control === null || control === void 0 ? void 0 : control.value));
|
|
309
|
+
};
|
|
310
|
+
this.queryControl = new FormControl((_a = _initialValues === null || _initialValues === void 0 ? void 0 : _initialValues.query) !== null && _a !== void 0 ? _a : null);
|
|
311
|
+
this.queryFieldsControl = new FormControl((_b = _initialValues === null || _initialValues === void 0 ? void 0 : _initialValues.queryFields) !== null && _b !== void 0 ? _b : []);
|
|
312
|
+
this.pageNumberControl = new FormControl((_c = _initialValues === null || _initialValues === void 0 ? void 0 : _initialValues.pageNumber) !== null && _c !== void 0 ? _c : 1);
|
|
313
|
+
this.pageSizeControl = new FormControl((_d = _initialValues === null || _initialValues === void 0 ? void 0 : _initialValues.pageSize) !== null && _d !== void 0 ? _d : 25);
|
|
314
|
+
this.sortControl = new FormControl((_e = _initialValues === null || _initialValues === void 0 ? void 0 : _initialValues.sort) !== null && _e !== void 0 ? _e : null);
|
|
315
|
+
this.data$ = this.getData();
|
|
316
|
+
}
|
|
317
|
+
refresh() {
|
|
318
|
+
this._refresh$.next(0);
|
|
319
|
+
}
|
|
320
|
+
setFormatter(callback) {
|
|
321
|
+
this._formatter = callback;
|
|
322
|
+
return this;
|
|
323
|
+
}
|
|
324
|
+
getData() {
|
|
325
|
+
const data$ = this.request.pipe(tap(() => this.loading$.next(true)), map(request => this.validateRequest(request)), switchMap(request => {
|
|
326
|
+
return this._provider.transform(request).pipe(tap(response => this.cacheCollectionData(response)), map(response => ({ response, request, initial: false })), catchError(error => of({
|
|
327
|
+
error,
|
|
328
|
+
request,
|
|
329
|
+
response: null,
|
|
330
|
+
initial: false
|
|
331
|
+
})));
|
|
332
|
+
}), startWith({ initial: true, response: null }));
|
|
333
|
+
return combineLatest([data$, this.loading$.asObservable()]).pipe(switchMap(([data, loading]) => {
|
|
334
|
+
const combined = Object.assign(Object.assign({}, data), { loading });
|
|
335
|
+
return this.formatResponse(data === null || data === void 0 ? void 0 : data.response).pipe(map(response => (Object.assign(Object.assign({}, combined), { response, state: this.getState(combined) }))));
|
|
336
|
+
}));
|
|
337
|
+
}
|
|
338
|
+
formatResponse(response) {
|
|
339
|
+
var _a, _b, _c;
|
|
340
|
+
if (!response || !this._formatter) {
|
|
341
|
+
return of(response);
|
|
342
|
+
}
|
|
343
|
+
const items = (_a = response === null || response === void 0 ? void 0 : response.data) !== null && _a !== void 0 ? _a : [];
|
|
344
|
+
const data = (_c = (_b = this._formatter) === null || _b === void 0 ? void 0 : _b.call(this, items)) !== null && _c !== void 0 ? _c : items;
|
|
345
|
+
const data$ = isObservable(data) ? data : of(data);
|
|
346
|
+
return data$.pipe(map(data => (Object.assign(Object.assign({}, response), { data }))));
|
|
347
|
+
}
|
|
348
|
+
validateRequest(request) {
|
|
349
|
+
var _a, _b, _c, _d;
|
|
350
|
+
// We should reset the page number whenever we change the query or the page size.
|
|
351
|
+
if (this._requestCache && request && (((_a = this._requestCache) === null || _a === void 0 ? void 0 : _a.query) !== (request === null || request === void 0 ? void 0 : request.query) || ((_b = this._requestCache) === null || _b === void 0 ? void 0 : _b.pageSize) !== (request === null || request === void 0 ? void 0 : request.pageSize))) {
|
|
352
|
+
(_c = this.pageNumberControl) === null || _c === void 0 ? void 0 : _c.setValue(1, { emitEvent: false });
|
|
353
|
+
request.pageNumber = (_d = this.pageNumberControl) === null || _d === void 0 ? void 0 : _d.value;
|
|
354
|
+
}
|
|
355
|
+
this._requestCache = Object.assign({}, request);
|
|
356
|
+
return request;
|
|
357
|
+
}
|
|
358
|
+
getState(data) {
|
|
359
|
+
var _a, _b, _c;
|
|
360
|
+
if (!!(data === null || data === void 0 ? void 0 : data.error)) {
|
|
361
|
+
return "error" /* CollectionState.Error */;
|
|
362
|
+
}
|
|
363
|
+
if (!!(data === null || data === void 0 ? void 0 : data.initial)) {
|
|
364
|
+
return "initial" /* CollectionState.Initial */;
|
|
365
|
+
}
|
|
366
|
+
const count = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
|
367
|
+
if (count <= 0) {
|
|
368
|
+
return "empty" /* CollectionState.Empty */;
|
|
369
|
+
}
|
|
370
|
+
return "data" /* CollectionState.Data */;
|
|
371
|
+
}
|
|
372
|
+
cacheCollectionData(data) {
|
|
373
|
+
this.raw$.next(data);
|
|
374
|
+
this.loading$.next(false);
|
|
375
|
+
}
|
|
376
|
+
get request() {
|
|
377
|
+
const pageNumber$ = this.controlToObservable(this.pageNumberControl);
|
|
378
|
+
const pageSize$ = this.controlToObservable(this.pageSizeControl);
|
|
379
|
+
const query$ = this.getQueryObservable();
|
|
380
|
+
const queryFields$ = this.controlToObservable(this.queryFieldsControl);
|
|
381
|
+
const sort$ = this.controlToObservable(this.sortControl);
|
|
382
|
+
return combineLatest([pageNumber$, pageSize$, query$, queryFields$, sort$, this._refresh$.asObservable()]).pipe(map(([pageNumber, pageSize, query, queryFields, sort]) => ({
|
|
383
|
+
pageNumber,
|
|
384
|
+
pageSize,
|
|
385
|
+
query,
|
|
386
|
+
queryFields,
|
|
387
|
+
sort
|
|
388
|
+
})));
|
|
389
|
+
}
|
|
390
|
+
getQueryObservable() {
|
|
391
|
+
var _a;
|
|
392
|
+
return this.queryControl.valueChanges.pipe(debounceTime(400), distinctUntilChanged(), startWith((_a = this.queryControl) === null || _a === void 0 ? void 0 : _a.value));
|
|
393
|
+
}
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
-
class CollectionsModule {
|
|
397
|
-
}
|
|
398
|
-
CollectionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
399
|
-
CollectionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
400
|
-
// Components.
|
|
401
|
-
BbCollectionsViewer,
|
|
402
|
-
BbCollectionsPager,
|
|
403
|
-
// Directives.
|
|
404
|
-
BbCollectionsData,
|
|
405
|
-
BbCollectionsEmpty,
|
|
406
|
-
BbCollectionsError,
|
|
407
|
-
BbCollectionsInitial
|
|
408
|
-
], imports: [CommonModule], exports: [
|
|
409
|
-
// Components.
|
|
410
|
-
BbCollectionsViewer,
|
|
411
|
-
BbCollectionsPager,
|
|
412
|
-
// Directives.
|
|
413
|
-
BbCollectionsData,
|
|
414
|
-
BbCollectionsEmpty,
|
|
415
|
-
BbCollectionsError,
|
|
416
|
-
BbCollectionsInitial
|
|
417
|
-
] });
|
|
418
|
-
CollectionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
419
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
420
|
-
type: NgModule,
|
|
421
|
-
args: [{
|
|
422
|
-
imports: [CommonModule],
|
|
423
|
-
declarations: [
|
|
424
|
-
// Components.
|
|
425
|
-
BbCollectionsViewer,
|
|
426
|
-
BbCollectionsPager,
|
|
427
|
-
// Directives.
|
|
428
|
-
BbCollectionsData,
|
|
429
|
-
BbCollectionsEmpty,
|
|
430
|
-
BbCollectionsError,
|
|
431
|
-
BbCollectionsInitial
|
|
432
|
-
],
|
|
433
|
-
exports: [
|
|
434
|
-
// Components.
|
|
435
|
-
BbCollectionsViewer,
|
|
436
|
-
BbCollectionsPager,
|
|
437
|
-
// Directives.
|
|
438
|
-
BbCollectionsData,
|
|
439
|
-
BbCollectionsEmpty,
|
|
440
|
-
BbCollectionsError,
|
|
441
|
-
BbCollectionsInitial
|
|
442
|
-
]
|
|
443
|
-
}]
|
|
396
|
+
class CollectionsModule {
|
|
397
|
+
}
|
|
398
|
+
CollectionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: CollectionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
399
|
+
CollectionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.3", ngImport: i0, type: CollectionsModule, declarations: [
|
|
400
|
+
// Components.
|
|
401
|
+
BbCollectionsViewer,
|
|
402
|
+
BbCollectionsPager,
|
|
403
|
+
// Directives.
|
|
404
|
+
BbCollectionsData,
|
|
405
|
+
BbCollectionsEmpty,
|
|
406
|
+
BbCollectionsError,
|
|
407
|
+
BbCollectionsInitial
|
|
408
|
+
], imports: [CommonModule], exports: [
|
|
409
|
+
// Components.
|
|
410
|
+
BbCollectionsViewer,
|
|
411
|
+
BbCollectionsPager,
|
|
412
|
+
// Directives.
|
|
413
|
+
BbCollectionsData,
|
|
414
|
+
BbCollectionsEmpty,
|
|
415
|
+
BbCollectionsError,
|
|
416
|
+
BbCollectionsInitial
|
|
417
|
+
] });
|
|
418
|
+
CollectionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: CollectionsModule, imports: [CommonModule] });
|
|
419
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: CollectionsModule, decorators: [{
|
|
420
|
+
type: NgModule,
|
|
421
|
+
args: [{
|
|
422
|
+
imports: [CommonModule],
|
|
423
|
+
declarations: [
|
|
424
|
+
// Components.
|
|
425
|
+
BbCollectionsViewer,
|
|
426
|
+
BbCollectionsPager,
|
|
427
|
+
// Directives.
|
|
428
|
+
BbCollectionsData,
|
|
429
|
+
BbCollectionsEmpty,
|
|
430
|
+
BbCollectionsError,
|
|
431
|
+
BbCollectionsInitial
|
|
432
|
+
],
|
|
433
|
+
exports: [
|
|
434
|
+
// Components.
|
|
435
|
+
BbCollectionsViewer,
|
|
436
|
+
BbCollectionsPager,
|
|
437
|
+
// Directives.
|
|
438
|
+
BbCollectionsData,
|
|
439
|
+
BbCollectionsEmpty,
|
|
440
|
+
BbCollectionsError,
|
|
441
|
+
BbCollectionsInitial
|
|
442
|
+
]
|
|
443
|
+
}]
|
|
444
444
|
}] });
|
|
445
445
|
|
|
446
|
-
/**
|
|
447
|
-
* Generated bundle index. Do not edit.
|
|
446
|
+
/**
|
|
447
|
+
* Generated bundle index. Do not edit.
|
|
448
448
|
*/
|
|
449
449
|
|
|
450
450
|
export { ApiCollectionProvider, BbCollectionsData, BbCollectionsEmpty, BbCollectionsError, BbCollectionsInitial, BbCollectionsPager, BbCollectionsViewer, Collection, CollectionProvider, CollectionsModule, LocalCollectionProvider };
|