@bravobit/bb-foundation 0.15.6 → 0.16.3
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/auth/lib/auth.interceptor.d.ts +1 -1
- package/auth/lib/auth.service.d.ts +1 -1
- package/auth/package.json +5 -5
- package/collections/lib/collection.d.ts +1 -1
- package/collections/package.json +5 -5
- package/controls/bravobit-bb-foundation-controls.d.ts +5 -0
- package/controls/lib/checkbox/checkbox/checkbox.component.d.ts +47 -0
- package/controls/lib/checkbox/checkbox-group/checkbox-group.component.d.ts +18 -0
- package/controls/lib/checkbox/checkbox.module.d.ts +9 -0
- package/controls/lib/controls.module.d.ts +7 -0
- package/controls/package.json +10 -0
- package/controls/public_api.d.ts +4 -0
- package/dashboard/package.json +5 -5
- package/dialog/package.json +5 -5
- package/elements/package.json +5 -5
- package/{esm2015/auth/bravobit-bb-foundation-auth.js → esm2020/auth/bravobit-bb-foundation-auth.mjs} +0 -0
- package/esm2020/auth/lib/auth.interceptor.mjs +94 -0
- package/{esm2015/auth/lib/auth.module.js → esm2020/auth/lib/auth.module.mjs} +5 -5
- package/esm2020/auth/lib/auth.service.mjs +276 -0
- package/esm2020/auth/lib/auth.session.mjs +131 -0
- package/{esm2015/auth/lib/directives/authenticated.directive.js → esm2020/auth/lib/directives/authenticated.directive.mjs} +5 -6
- package/esm2020/auth/lib/directives/permission.directive.mjs +80 -0
- package/esm2020/auth/lib/directives/role.directive.mjs +37 -0
- package/esm2020/auth/lib/guards/anonymous.guard.mjs +34 -0
- package/esm2020/auth/lib/guards/authenticated.guard.mjs +35 -0
- package/{esm2015/auth/lib/helpers/jwt.helper.js → esm2020/auth/lib/helpers/jwt.helper.mjs} +3 -3
- package/{esm2015/auth/lib/helpers/mapper.helper.js → esm2020/auth/lib/helpers/mapper.helper.mjs} +4 -4
- package/{esm2015/auth/lib/interfaces/config.interface.js → esm2020/auth/lib/interfaces/config.interface.mjs} +0 -0
- package/{esm2015/auth/lib/interfaces/mapper.interface.js → esm2020/auth/lib/interfaces/mapper.interface.mjs} +0 -0
- package/{esm2015/auth/lib/interfaces/provider.interface.js → esm2020/auth/lib/interfaces/provider.interface.mjs} +0 -0
- package/{esm2015/auth/lib/interfaces/token.interface.js → esm2020/auth/lib/interfaces/token.interface.mjs} +0 -0
- package/esm2020/auth/lib/permissions.service.mjs +56 -0
- package/esm2020/auth/lib/providers/email.provider.mjs +25 -0
- package/esm2020/auth/lib/providers/verify.provider.mjs +19 -0
- package/{esm2015/auth/lib/tokens/use-authorization.token.js → esm2020/auth/lib/tokens/use-authorization.token.mjs} +0 -0
- package/{esm2015/auth/public_api.js → esm2020/auth/public_api.mjs} +0 -0
- package/{esm2015/bravobit-bb-foundation.js → esm2020/bravobit-bb-foundation.mjs} +0 -0
- package/{esm2015/collections/bravobit-bb-foundation-collections.js → esm2020/collections/bravobit-bb-foundation-collections.mjs} +0 -0
- package/esm2020/collections/lib/collection.mjs +102 -0
- package/{esm2015/collections/lib/collections.module.js → esm2020/collections/lib/collections.module.mjs} +5 -5
- package/esm2020/collections/lib/components/collections-pager/collections-pager.component.mjs +123 -0
- package/esm2020/collections/lib/components/collections-viewer/collections-viewer.component.mjs +31 -0
- package/{esm2015/collections/lib/components/collections.directive.js → esm2020/collections/lib/components/collections.directive.mjs} +13 -13
- package/{esm2015/collections/lib/interfaces/collection.interface.js → esm2020/collections/lib/interfaces/collection.interface.mjs} +0 -0
- package/esm2020/collections/lib/providers/api-collection.provider.mjs +71 -0
- package/esm2020/collections/lib/providers/collection.provider.mjs +13 -0
- package/{esm2015/collections/lib/providers/local-collection.provider.js → esm2020/collections/lib/providers/local-collection.provider.mjs} +0 -0
- package/{esm2015/collections/public_api.js → esm2020/collections/public_api.mjs} +0 -0
- package/esm2020/controls/bravobit-bb-foundation-controls.mjs +5 -0
- package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +153 -0
- package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +48 -0
- package/esm2020/controls/lib/checkbox/checkbox.module.mjs +19 -0
- package/esm2020/controls/lib/controls.module.mjs +16 -0
- package/esm2020/controls/public_api.mjs +5 -0
- package/{esm2015/dashboard/bravobit-bb-foundation-dashboard.js → esm2020/dashboard/bravobit-bb-foundation-dashboard.mjs} +0 -0
- package/esm2020/dashboard/lib/dashboard/dashboard.component.mjs +56 -0
- package/esm2020/dashboard/lib/dashboard-header/dashboard-header.component.mjs +30 -0
- package/esm2020/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +31 -0
- package/esm2020/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +29 -0
- package/esm2020/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +75 -0
- package/esm2020/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +99 -0
- package/esm2020/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +62 -0
- package/{esm2015/dashboard/lib/dashboard.module.js → esm2020/dashboard/lib/dashboard.module.mjs} +5 -5
- package/{esm2015/dashboard/public_api.js → esm2020/dashboard/public_api.mjs} +0 -0
- package/{esm2015/dialog/bravobit-bb-foundation-dialog.js → esm2020/dialog/bravobit-bb-foundation-dialog.mjs} +0 -0
- package/esm2020/dialog/lib/dialog-actions/dialog-actions.component.mjs +12 -0
- package/esm2020/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +37 -0
- package/{esm2015/dialog/lib/dialog-container/dialog-container.component.js → esm2020/dialog/lib/dialog-container/dialog-container.component.mjs} +6 -15
- package/esm2020/dialog/lib/dialog-header/dialog-header.component.mjs +25 -0
- package/esm2020/dialog/lib/dialog-link/dialog-link.component.mjs +11 -0
- package/esm2020/dialog/lib/dialog-modal/dialog-modal.component.mjs +46 -0
- package/esm2020/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +134 -0
- package/{esm2015/dialog/lib/dialog.injector.js → esm2020/dialog/lib/dialog.injector.mjs} +0 -0
- package/{esm2015/dialog/lib/dialog.insertion.js → esm2020/dialog/lib/dialog.insertion.mjs} +4 -4
- package/{esm2015/dialog/lib/dialog.interfaces.js → esm2020/dialog/lib/dialog.interfaces.mjs} +0 -0
- package/{esm2015/dialog/lib/dialog.module.js → esm2020/dialog/lib/dialog.module.mjs} +5 -9
- package/{esm2015/dialog/lib/dialog.ref.js → esm2020/dialog/lib/dialog.ref.mjs} +0 -0
- package/{esm2015/dialog/lib/dialog.service.js → esm2020/dialog/lib/dialog.service.mjs} +5 -5
- package/{esm2015/dialog/public_api.js → esm2020/dialog/public_api.mjs} +0 -0
- package/{esm2015/elements/bravobit-bb-foundation-elements.js → esm2020/elements/bravobit-bb-foundation-elements.mjs} +0 -0
- package/esm2020/elements/lib/avatar/avatar.component.mjs +142 -0
- package/esm2020/elements/lib/button/button.component.mjs +61 -0
- package/esm2020/elements/lib/checkbox/checkbox.component.mjs +73 -0
- package/esm2020/elements/lib/date-picker/date-picker.component.mjs +304 -0
- package/{esm2015/elements/lib/directives/addon.directive.js → esm2020/elements/lib/directives/addon.directive.mjs} +7 -7
- package/esm2020/elements/lib/directives/autosize.directive.mjs +72 -0
- package/{esm2015/elements/lib/directives/focus-trap.directive.js → esm2020/elements/lib/directives/focus-trap.directive.mjs} +4 -4
- package/{esm2015/elements/lib/directives/focus.directive.js → esm2020/elements/lib/directives/focus.directive.mjs} +4 -4
- package/esm2020/elements/lib/directives/form-submit.directive.mjs +50 -0
- package/esm2020/elements/lib/directives/input.directive.mjs +136 -0
- package/{esm2015/elements/lib/directives/template.directive.js → esm2020/elements/lib/directives/template.directive.mjs} +4 -4
- package/esm2020/elements/lib/dropdown/dropdown.component.mjs +100 -0
- package/{esm2015/elements/lib/elements.interfaces.js → esm2020/elements/lib/elements.interfaces.mjs} +0 -0
- package/{esm2015/elements/lib/elements.module.js → esm2020/elements/lib/elements.module.mjs} +5 -5
- package/esm2020/elements/lib/file-picker/file-picker.component.mjs +236 -0
- package/esm2020/elements/lib/form-control/form-control.component.mjs +49 -0
- package/esm2020/elements/lib/form-error/form-error.component.mjs +108 -0
- package/esm2020/elements/lib/form-group/form-group.component.mjs +18 -0
- package/esm2020/elements/lib/icon/icon.component.mjs +102 -0
- package/esm2020/elements/lib/image-picker/image-picker.component.mjs +106 -0
- package/esm2020/elements/lib/pipes/file-image.pipe.mjs +42 -0
- package/{esm2015/elements/lib/pipes/file-size.pipe.js → esm2020/elements/lib/pipes/file-size.pipe.mjs} +4 -4
- package/esm2020/elements/lib/pipes/relative-time.pipe.mjs +94 -0
- package/esm2020/elements/lib/spinner/spinner.component.mjs +25 -0
- package/esm2020/elements/lib/tag/tag.component.mjs +18 -0
- package/{esm2015/elements/public_api.js → esm2020/elements/public_api.mjs} +0 -0
- package/{esm2015/http/bravobit-bb-foundation-http.js → esm2020/http/bravobit-bb-foundation-http.mjs} +0 -0
- package/esm2020/http/lib/classes/http.config.mjs +29 -0
- package/esm2020/http/lib/classes/http.error.mjs +20 -0
- package/{esm2015/http/lib/http.interfaces.js → esm2020/http/lib/http.interfaces.mjs} +0 -0
- package/{esm2015/http/lib/http.module.js → esm2020/http/lib/http.module.mjs} +5 -5
- package/esm2020/http/lib/interceptors/base-url.interceptor.mjs +50 -0
- package/esm2020/http/lib/interceptors/error.interceptor.mjs +32 -0
- package/{esm2015/http/public_api.js → esm2020/http/public_api.mjs} +0 -0
- package/{esm2015/lib/core/miscellaneous/regex.js → esm2020/lib/core/miscellaneous/regex.mjs} +0 -0
- package/esm2020/lib/core/miscellaneous/validator.mjs +85 -0
- package/esm2020/lib/core/mixins/can-disable.mjs +16 -0
- package/{esm2015/lib/core/mixins/can-hide-errors.js → esm2020/lib/core/mixins/can-hide-errors.mjs} +2 -2
- package/esm2020/lib/core/mixins/can-load.mjs +16 -0
- package/{esm2015/lib/core/mixins/constructor.js → esm2020/lib/core/mixins/constructor.mjs} +0 -0
- package/esm2020/lib/core/mixins/has-error.mjs +16 -0
- package/esm2020/lib/core/mixins/is-focused.mjs +16 -0
- package/esm2020/lib/core/mixins/is-grouped.mjs +16 -0
- package/esm2020/lib/core/mixins/is-readonly.mjs +16 -0
- package/esm2020/lib/core/mixins/is-required.mjs +16 -0
- package/esm2020/lib/core/services/clipboard.service.mjs +70 -0
- package/esm2020/lib/core/services/exif.service.mjs +163 -0
- package/esm2020/lib/core/services/file-loader.service.mjs +87 -0
- package/esm2020/lib/core/services/image-converter.service.mjs +123 -0
- package/{esm2015/lib/core/services/languages.service.js → esm2020/lib/core/services/languages.service.mjs} +4 -4
- package/{esm2015/lib/core/services/network.service.js → esm2020/lib/core/services/network.service.mjs} +5 -6
- package/esm2020/lib/core/services/patch.service.mjs +63 -0
- package/{esm2015/lib/core/services/platform.service.js → esm2020/lib/core/services/platform.service.mjs} +5 -5
- package/{esm2015/lib/core/tokens/accept-language.token.js → esm2020/lib/core/tokens/accept-language.token.mjs} +0 -0
- package/{esm2015/lib/core/tokens/base-url.token.js → esm2020/lib/core/tokens/base-url.token.mjs} +0 -0
- package/{esm2015/lib/core/tokens/cookie.token.js → esm2020/lib/core/tokens/cookie.token.mjs} +0 -0
- package/{esm2015/lib/core/tokens/location.token.js → esm2020/lib/core/tokens/location.token.mjs} +0 -0
- package/{esm2015/lib/core/tokens/navigator.token.js → esm2020/lib/core/tokens/navigator.token.mjs} +0 -0
- package/{esm2015/lib/core/tokens/window.token.js → esm2020/lib/core/tokens/window.token.mjs} +0 -0
- package/{esm2015/localize/bravobit-bb-foundation-localize.js → esm2020/localize/bravobit-bb-foundation-localize.mjs} +0 -0
- package/{esm2015/localize/lib/functions/date.function.js → esm2020/localize/lib/functions/date.function.mjs} +0 -0
- package/{esm2015/localize/lib/functions/lowercase.function.js → esm2020/localize/lib/functions/lowercase.function.mjs} +0 -0
- package/{esm2015/localize/lib/functions/uppercase.function.js → esm2020/localize/lib/functions/uppercase.function.mjs} +0 -0
- package/{esm2015/localize/lib/handlers/missing.handler.js → esm2020/localize/lib/handlers/missing.handler.mjs} +0 -0
- package/{esm2015/localize/lib/interfaces/config.interfaces.js → esm2020/localize/lib/interfaces/config.interfaces.mjs} +0 -0
- package/{esm2015/localize/lib/interfaces/dictionary.interfaces.js → esm2020/localize/lib/interfaces/dictionary.interfaces.mjs} +0 -0
- package/{esm2015/localize/lib/interfaces/functions.interfaces.js → esm2020/localize/lib/interfaces/functions.interfaces.mjs} +0 -0
- package/{esm2015/localize/lib/interfaces/handlers.interfaces.js → esm2020/localize/lib/interfaces/handlers.interfaces.mjs} +0 -0
- package/{esm2015/localize/lib/interfaces/options.interfaces.js → esm2020/localize/lib/interfaces/options.interfaces.mjs} +0 -0
- package/{esm2015/localize/lib/localizations/dutch.localization.js → esm2020/localize/lib/localizations/dutch.localization.mjs} +0 -0
- package/{esm2015/localize/lib/localizations/english.localization.js → esm2020/localize/lib/localizations/english.localization.mjs} +0 -0
- package/esm2020/localize/lib/localize.dictionary.mjs +135 -0
- package/{esm2015/localize/lib/localize.module.js → esm2020/localize/lib/localize.module.mjs} +5 -5
- package/{esm2015/localize/lib/localize.pipe.js → esm2020/localize/lib/localize.pipe.mjs} +5 -5
- package/esm2020/localize/lib/localize.service.mjs +277 -0
- package/esm2020/localize/lib/views/localize-string/localize-string.component.mjs +88 -0
- package/{esm2015/localize/lib/views/localize-template-or-string.directive.js → esm2020/localize/lib/views/localize-template-or-string.directive.mjs} +4 -4
- package/{esm2015/localize/lib/views/localize-template.directive.js → esm2020/localize/lib/views/localize-template.directive.mjs} +4 -4
- package/{esm2015/localize/public_api.js → esm2020/localize/public_api.mjs} +0 -0
- package/{esm2015/notifications/bravobit-bb-foundation-notifications.js → esm2020/notifications/bravobit-bb-foundation-notifications.mjs} +0 -0
- package/esm2020/notifications/lib/notifications-item/notifications-item.component.mjs +100 -0
- package/esm2020/notifications/lib/notifications-list/notifications-list.component.mjs +47 -0
- package/{esm2015/notifications/lib/notifications.animations.js → esm2020/notifications/lib/notifications.animations.mjs} +0 -0
- package/{esm2015/notifications/lib/notifications.injector.js → esm2020/notifications/lib/notifications.injector.mjs} +0 -0
- package/{esm2015/notifications/lib/notifications.interfaces.js → esm2020/notifications/lib/notifications.interfaces.mjs} +0 -0
- package/{esm2015/notifications/lib/notifications.module.js → esm2020/notifications/lib/notifications.module.mjs} +6 -7
- package/{esm2015/notifications/lib/notifications.service.js → esm2020/notifications/lib/notifications.service.mjs} +5 -5
- package/{esm2015/notifications/public_api.js → esm2020/notifications/public_api.mjs} +0 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +1 -2
- package/{esm2015/recaptcha/bravobit-bb-foundation-recaptcha.js → esm2020/recaptcha/bravobit-bb-foundation-recaptcha.mjs} +0 -0
- package/esm2020/recaptcha/lib/recaptcha/recaptcha.component.mjs +185 -0
- package/esm2020/recaptcha/lib/recaptcha-loader.service.mjs +90 -0
- package/{esm2015/recaptcha/lib/recaptcha.interface.js → esm2020/recaptcha/lib/recaptcha.interface.mjs} +0 -0
- package/{esm2015/recaptcha/lib/recaptcha.module.js → esm2020/recaptcha/lib/recaptcha.module.mjs} +5 -5
- package/{esm2015/recaptcha/public_api.js → esm2020/recaptcha/public_api.mjs} +0 -0
- package/{esm2015/rxjs/bravobit-bb-foundation-rxjs.js → esm2020/rxjs/bravobit-bb-foundation-rxjs.mjs} +0 -0
- package/esm2020/rxjs/lib/operators/combine-latest-map.operator.mjs +10 -0
- package/{esm2015/rxjs/lib/operators/filter-nil.operator.js → esm2020/rxjs/lib/operators/filter-nil.operator.mjs} +0 -0
- package/{esm2015/rxjs/public_api.js → esm2020/rxjs/public_api.mjs} +0 -0
- package/{esm2015/storage/bravobit-bb-foundation-storage.js → esm2020/storage/bravobit-bb-foundation-storage.mjs} +0 -0
- package/{esm2015/storage/lib/interfaces/attributes.interface.js → esm2020/storage/lib/interfaces/attributes.interface.mjs} +0 -0
- package/{esm2015/storage/lib/interfaces/memory.interface.js → esm2020/storage/lib/interfaces/memory.interface.mjs} +0 -0
- package/{esm2015/storage/lib/interfaces/strategy.interface.js → esm2020/storage/lib/interfaces/strategy.interface.mjs} +0 -0
- package/esm2020/storage/lib/storage.service.mjs +109 -0
- package/esm2020/storage/lib/strategies/cookie-storage.strategy.mjs +142 -0
- package/{esm2015/storage/lib/strategies/memory-storage.strategy.js → esm2020/storage/lib/strategies/memory-storage.strategy.mjs} +2 -2
- package/esm2020/storage/lib/strategies/polyfill-storage.strategy.mjs +102 -0
- package/{esm2015/storage/public_api.js → esm2020/storage/public_api.mjs} +0 -0
- package/{esm2015/table/bravobit-bb-foundation-table.js → esm2020/table/bravobit-bb-foundation-table.mjs} +0 -0
- package/esm2020/table/lib/components/table/table.component.mjs +191 -0
- package/esm2020/table/lib/components/table-cell/table-cell.component.mjs +11 -0
- package/esm2020/table/lib/components/table-header-cell/table-header-cell.component.mjs +131 -0
- package/esm2020/table/lib/components/table-pager/table-pager.component.mjs +136 -0
- package/esm2020/table/lib/data/datasource.data.mjs +32 -0
- package/esm2020/table/lib/data/generic.data.mjs +72 -0
- package/{esm2015/table/lib/interfaces/datasource.interface.js → esm2020/table/lib/interfaces/datasource.interface.mjs} +0 -0
- package/{esm2015/table/lib/interfaces/table.interfaces.js → esm2020/table/lib/interfaces/table.interfaces.mjs} +0 -0
- package/{esm2015/table/lib/table.module.js → esm2020/table/lib/table.module.mjs} +5 -5
- package/{esm2015/table/public_api.js → esm2020/table/public_api.mjs} +0 -0
- package/fesm2015/{bravobit-bb-foundation-auth.js → bravobit-bb-foundation-auth.mjs} +79 -68
- package/fesm2015/bravobit-bb-foundation-auth.mjs.map +1 -0
- package/fesm2015/{bravobit-bb-foundation-collections.js → bravobit-bb-foundation-collections.mjs} +45 -57
- package/fesm2015/bravobit-bb-foundation-collections.mjs.map +1 -0
- package/fesm2015/bravobit-bb-foundation-controls.mjs +235 -0
- package/fesm2015/bravobit-bb-foundation-controls.mjs.map +1 -0
- package/fesm2015/bravobit-bb-foundation-dashboard.mjs +416 -0
- package/fesm2015/bravobit-bb-foundation-dashboard.mjs.map +1 -0
- package/fesm2015/{bravobit-bb-foundation-dialog.js → bravobit-bb-foundation-dialog.mjs} +45 -106
- package/fesm2015/bravobit-bb-foundation-dialog.mjs.map +1 -0
- package/fesm2015/{bravobit-bb-foundation-elements.js → bravobit-bb-foundation-elements.mjs} +195 -303
- package/fesm2015/bravobit-bb-foundation-elements.mjs.map +1 -0
- package/fesm2015/{bravobit-bb-foundation-http.js → bravobit-bb-foundation-http.mjs} +18 -16
- package/fesm2015/bravobit-bb-foundation-http.mjs.map +1 -0
- package/fesm2015/{bravobit-bb-foundation-localize.js → bravobit-bb-foundation-localize.mjs} +63 -69
- package/fesm2015/bravobit-bb-foundation-localize.mjs.map +1 -0
- package/fesm2015/bravobit-bb-foundation-notifications.mjs +377 -0
- package/fesm2015/bravobit-bb-foundation-notifications.mjs.map +1 -0
- package/fesm2015/{bravobit-bb-foundation-recaptcha.js → bravobit-bb-foundation-recaptcha.mjs} +40 -47
- package/fesm2015/bravobit-bb-foundation-recaptcha.mjs.map +1 -0
- package/fesm2015/{bravobit-bb-foundation-rxjs.js → bravobit-bb-foundation-rxjs.mjs} +1 -1
- package/fesm2015/bravobit-bb-foundation-rxjs.mjs.map +1 -0
- package/fesm2015/{bravobit-bb-foundation-storage.js → bravobit-bb-foundation-storage.mjs} +12 -10
- package/fesm2015/bravobit-bb-foundation-storage.mjs.map +1 -0
- package/fesm2015/bravobit-bb-foundation-table.mjs +603 -0
- package/fesm2015/bravobit-bb-foundation-table.mjs.map +1 -0
- package/fesm2015/{bravobit-bb-foundation.js → bravobit-bb-foundation.mjs} +76 -69
- package/fesm2015/bravobit-bb-foundation.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-auth.mjs +928 -0
- package/fesm2020/bravobit-bb-foundation-auth.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-collections.mjs +441 -0
- package/fesm2020/bravobit-bb-foundation-collections.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-controls.mjs +233 -0
- package/fesm2020/bravobit-bb-foundation-controls.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-dashboard.mjs +404 -0
- package/fesm2020/bravobit-bb-foundation-dashboard.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-dialog.mjs +584 -0
- package/fesm2020/bravobit-bb-foundation-dialog.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-elements.mjs +1994 -0
- package/fesm2020/bravobit-bb-foundation-elements.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-http.mjs +168 -0
- package/fesm2020/bravobit-bb-foundation-http.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-localize.mjs +832 -0
- package/fesm2020/bravobit-bb-foundation-localize.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-notifications.mjs +375 -0
- package/fesm2020/bravobit-bb-foundation-notifications.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-recaptcha.mjs +300 -0
- package/fesm2020/bravobit-bb-foundation-recaptcha.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-rxjs.mjs +21 -0
- package/fesm2020/bravobit-bb-foundation-rxjs.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-storage.mjs +413 -0
- package/fesm2020/bravobit-bb-foundation-storage.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation-table.mjs +592 -0
- package/fesm2020/bravobit-bb-foundation-table.mjs.map +1 -0
- package/fesm2020/bravobit-bb-foundation.mjs +892 -0
- package/fesm2020/bravobit-bb-foundation.mjs.map +1 -0
- package/http/package.json +5 -5
- package/localize/package.json +5 -5
- package/notifications/package.json +5 -5
- package/package.json +126 -8
- package/public_api.d.ts +0 -1
- package/recaptcha/package.json +5 -5
- package/rxjs/package.json +5 -5
- package/storage/package.json +5 -5
- package/table/package.json +5 -5
- package/bundles/bravobit-bb-foundation-auth.umd.js +0 -1483
- package/bundles/bravobit-bb-foundation-auth.umd.js.map +0 -1
- package/bundles/bravobit-bb-foundation-collections.umd.js +0 -868
- package/bundles/bravobit-bb-foundation-collections.umd.js.map +0 -1
- package/bundles/bravobit-bb-foundation-dashboard.umd.js +0 -876
- package/bundles/bravobit-bb-foundation-dashboard.umd.js.map +0 -1
- package/bundles/bravobit-bb-foundation-dialog.umd.js +0 -716
- package/bundles/bravobit-bb-foundation-dialog.umd.js.map +0 -1
- package/bundles/bravobit-bb-foundation-elements.umd.js +0 -2768
- package/bundles/bravobit-bb-foundation-elements.umd.js.map +0 -1
- package/bundles/bravobit-bb-foundation-http.umd.js +0 -535
- package/bundles/bravobit-bb-foundation-http.umd.js.map +0 -1
- package/bundles/bravobit-bb-foundation-localize.umd.js +0 -1292
- package/bundles/bravobit-bb-foundation-localize.umd.js.map +0 -1
- package/bundles/bravobit-bb-foundation-notifications.umd.js +0 -794
- package/bundles/bravobit-bb-foundation-notifications.umd.js.map +0 -1
- package/bundles/bravobit-bb-foundation-recaptcha.umd.js +0 -683
- package/bundles/bravobit-bb-foundation-recaptcha.umd.js.map +0 -1
- package/bundles/bravobit-bb-foundation-rxjs.umd.js +0 -29
- package/bundles/bravobit-bb-foundation-rxjs.umd.js.map +0 -1
- package/bundles/bravobit-bb-foundation-storage.umd.js +0 -799
- package/bundles/bravobit-bb-foundation-storage.umd.js.map +0 -1
- package/bundles/bravobit-bb-foundation-table.umd.js +0 -1084
- package/bundles/bravobit-bb-foundation-table.umd.js.map +0 -1
- package/bundles/bravobit-bb-foundation.umd.js +0 -1440
- package/bundles/bravobit-bb-foundation.umd.js.map +0 -1
- package/esm2015/auth/lib/auth.interceptor.js +0 -95
- package/esm2015/auth/lib/auth.service.js +0 -299
- package/esm2015/auth/lib/auth.session.js +0 -136
- package/esm2015/auth/lib/directives/permission.directive.js +0 -81
- package/esm2015/auth/lib/directives/role.directive.js +0 -38
- package/esm2015/auth/lib/guards/anonymous.guard.js +0 -35
- package/esm2015/auth/lib/guards/authenticated.guard.js +0 -36
- package/esm2015/auth/lib/permissions.service.js +0 -58
- package/esm2015/auth/lib/providers/email.provider.js +0 -26
- package/esm2015/auth/lib/providers/verify.provider.js +0 -20
- package/esm2015/collections/lib/collection.js +0 -104
- package/esm2015/collections/lib/components/collections-pager/collections-pager.component.js +0 -136
- package/esm2015/collections/lib/components/collections-viewer/collections-viewer.component.js +0 -39
- package/esm2015/collections/lib/providers/api-collection.provider.js +0 -69
- package/esm2015/collections/lib/providers/collection.provider.js +0 -14
- package/esm2015/dashboard/lib/dashboard/dashboard.component.js +0 -64
- package/esm2015/dashboard/lib/dashboard-header/dashboard-header.component.js +0 -41
- package/esm2015/dashboard/lib/dashboard-menu/dashboard-menu.component.js +0 -39
- package/esm2015/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.js +0 -38
- package/esm2015/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.js +0 -83
- package/esm2015/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.js +0 -110
- package/esm2015/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.js +0 -71
- package/esm2015/dialog/lib/dialog-actions/dialog-actions.component.js +0 -20
- package/esm2015/dialog/lib/dialog-confirm/dialog-confirm.component.js +0 -45
- package/esm2015/dialog/lib/dialog-header/dialog-header.component.js +0 -33
- package/esm2015/dialog/lib/dialog-link/dialog-link.component.js +0 -19
- package/esm2015/dialog/lib/dialog-modal/dialog-modal.component.js +0 -54
- package/esm2015/dialog/lib/dialog-overlay/dialog-overlay.component.js +0 -143
- package/esm2015/elements/lib/avatar/avatar.component.js +0 -151
- package/esm2015/elements/lib/button/button.component.js +0 -79
- package/esm2015/elements/lib/checkbox/checkbox.component.js +0 -83
- package/esm2015/elements/lib/date-picker/date-picker.component.js +0 -322
- package/esm2015/elements/lib/directives/autosize.directive.js +0 -74
- package/esm2015/elements/lib/directives/form-submit.directive.js +0 -53
- package/esm2015/elements/lib/directives/input.directive.js +0 -139
- package/esm2015/elements/lib/dropdown/dropdown.component.js +0 -111
- package/esm2015/elements/lib/file-picker/file-picker.component.js +0 -247
- package/esm2015/elements/lib/form-control/form-control.component.js +0 -58
- package/esm2015/elements/lib/form-error/form-error.component.js +0 -116
- package/esm2015/elements/lib/form-group/form-group.component.js +0 -27
- package/esm2015/elements/lib/icon/icon.component.js +0 -110
- package/esm2015/elements/lib/image-picker/image-picker.component.js +0 -119
- package/esm2015/elements/lib/pipes/file-image.pipe.js +0 -45
- package/esm2015/elements/lib/pipes/relative-time.pipe.js +0 -96
- package/esm2015/elements/lib/spinner/spinner.component.js +0 -34
- package/esm2015/elements/lib/tag/tag.component.js +0 -26
- package/esm2015/http/lib/classes/http.config.js +0 -31
- package/esm2015/http/lib/classes/http.error.js +0 -21
- package/esm2015/http/lib/interceptors/base-url.interceptor.js +0 -52
- package/esm2015/http/lib/interceptors/error.interceptor.js +0 -33
- package/esm2015/lib/core/coercions/boolean-coercion.js +0 -4
- package/esm2015/lib/core/miscellaneous/validator.js +0 -86
- package/esm2015/lib/core/mixins/can-disable.js +0 -16
- package/esm2015/lib/core/mixins/can-load.js +0 -16
- package/esm2015/lib/core/mixins/has-error.js +0 -16
- package/esm2015/lib/core/mixins/is-focused.js +0 -16
- package/esm2015/lib/core/mixins/is-grouped.js +0 -16
- package/esm2015/lib/core/mixins/is-readonly.js +0 -16
- package/esm2015/lib/core/mixins/is-required.js +0 -16
- package/esm2015/lib/core/services/clipboard.service.js +0 -72
- package/esm2015/lib/core/services/exif.service.js +0 -168
- package/esm2015/lib/core/services/file-loader.service.js +0 -90
- package/esm2015/lib/core/services/image-converter.service.js +0 -130
- package/esm2015/lib/core/services/patch.service.js +0 -65
- package/esm2015/localize/lib/localize.dictionary.js +0 -137
- package/esm2015/localize/lib/localize.service.js +0 -282
- package/esm2015/localize/lib/views/localize-string/localize-string.component.js +0 -99
- package/esm2015/notifications/lib/notifications-item/notifications-item.component.js +0 -108
- package/esm2015/notifications/lib/notifications-list/notifications-list.component.js +0 -56
- package/esm2015/recaptcha/lib/recaptcha/recaptcha.component.js +0 -199
- package/esm2015/recaptcha/lib/recaptcha-loader.service.js +0 -93
- package/esm2015/rxjs/lib/operators/combine-latest-map.operator.js +0 -7
- package/esm2015/storage/lib/storage.service.js +0 -111
- package/esm2015/storage/lib/strategies/cookie-storage.strategy.js +0 -143
- package/esm2015/storage/lib/strategies/polyfill-storage.strategy.js +0 -102
- package/esm2015/table/lib/components/table/table.component.js +0 -204
- package/esm2015/table/lib/components/table-cell/table-cell.component.js +0 -19
- package/esm2015/table/lib/components/table-header-cell/table-header-cell.component.js +0 -143
- package/esm2015/table/lib/components/table-pager/table-pager.component.js +0 -146
- package/esm2015/table/lib/data/datasource.data.js +0 -32
- package/esm2015/table/lib/data/generic.data.js +0 -73
- package/fesm2015/bravobit-bb-foundation-auth.js.map +0 -1
- package/fesm2015/bravobit-bb-foundation-collections.js.map +0 -1
- package/fesm2015/bravobit-bb-foundation-dashboard.js +0 -468
- package/fesm2015/bravobit-bb-foundation-dashboard.js.map +0 -1
- package/fesm2015/bravobit-bb-foundation-dialog.js.map +0 -1
- package/fesm2015/bravobit-bb-foundation-elements.js.map +0 -1
- package/fesm2015/bravobit-bb-foundation-http.js.map +0 -1
- package/fesm2015/bravobit-bb-foundation-localize.js.map +0 -1
- package/fesm2015/bravobit-bb-foundation-notifications.js +0 -393
- package/fesm2015/bravobit-bb-foundation-notifications.js.map +0 -1
- package/fesm2015/bravobit-bb-foundation-recaptcha.js.map +0 -1
- package/fesm2015/bravobit-bb-foundation-rxjs.js.map +0 -1
- package/fesm2015/bravobit-bb-foundation-storage.js.map +0 -1
- package/fesm2015/bravobit-bb-foundation-table.js +0 -636
- package/fesm2015/bravobit-bb-foundation-table.js.map +0 -1
- package/fesm2015/bravobit-bb-foundation.js.map +0 -1
- package/lib/core/coercions/boolean-coercion.d.ts +0 -1
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
import { BehaviorSubject, of, combineLatest } from 'rxjs';
|
|
2
|
+
import { filter, switchMap, map, share, tap, catchError, debounceTime, distinctUntilChanged, startWith } from 'rxjs/operators';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { forwardRef, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Directive, TemplateRef, ContentChildren, ContentChild, Optional, Host, Attribute, HostListener, NgModule } from '@angular/core';
|
|
5
|
+
import * as i4 from '@angular/forms';
|
|
6
|
+
import { NG_VALUE_ACCESSOR, FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
7
|
+
import * as i1 from '@bravobit/bb-foundation/elements';
|
|
8
|
+
import { ElementsModule } from '@bravobit/bb-foundation/elements';
|
|
9
|
+
import { mixinDisabled } from '@bravobit/bb-foundation';
|
|
10
|
+
import * as i3 from '@angular/common';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
import * as i5 from '@bravobit/bb-foundation/localize';
|
|
13
|
+
import { LocalizeModule } from '@bravobit/bb-foundation/localize';
|
|
14
|
+
|
|
15
|
+
class DataSourceRequest {
|
|
16
|
+
constructor() {
|
|
17
|
+
// Data.
|
|
18
|
+
this._request$ = new BehaviorSubject(null);
|
|
19
|
+
this._loading$ = new BehaviorSubject(true);
|
|
20
|
+
}
|
|
21
|
+
get loading() {
|
|
22
|
+
return this._loading$.asObservable();
|
|
23
|
+
}
|
|
24
|
+
get when() {
|
|
25
|
+
return this._request$.pipe(filter(data => !!data));
|
|
26
|
+
}
|
|
27
|
+
startLoading() {
|
|
28
|
+
this._loading$.next(true);
|
|
29
|
+
}
|
|
30
|
+
stopLoading() {
|
|
31
|
+
this._loading$.next(false);
|
|
32
|
+
}
|
|
33
|
+
update(params = {}) {
|
|
34
|
+
const currentValue = this._request$.getValue();
|
|
35
|
+
// Set the page number to 1 if the query or page size was changed.
|
|
36
|
+
if (currentValue && params && ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.query) !== (params === null || params === void 0 ? void 0 : params.query) || (currentValue === null || currentValue === void 0 ? void 0 : currentValue.pageSize) !== (params === null || params === void 0 ? void 0 : params.pageSize))) {
|
|
37
|
+
params.pageNumber = 1;
|
|
38
|
+
}
|
|
39
|
+
this._request$.next(Object.assign(Object.assign({}, currentValue), params));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
class DataSource {
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
class GenericDataSource extends DataSource {
|
|
46
|
+
constructor(httpClient, endpoint) {
|
|
47
|
+
super();
|
|
48
|
+
// Data.
|
|
49
|
+
this._items$ = new BehaviorSubject([]);
|
|
50
|
+
this._fn = data => data;
|
|
51
|
+
this.formatResponse = (data) => {
|
|
52
|
+
return {
|
|
53
|
+
pageSize: data === null || data === void 0 ? void 0 : data['page_size'],
|
|
54
|
+
pageNumber: data === null || data === void 0 ? void 0 : data['page_number'],
|
|
55
|
+
totalPages: data === null || data === void 0 ? void 0 : data['total_pages'],
|
|
56
|
+
totalEntries: data === null || data === void 0 ? void 0 : data['total_entries'],
|
|
57
|
+
data: data === null || data === void 0 ? void 0 : data['data']
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
this.formatParams = (data) => {
|
|
61
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
62
|
+
const params = {};
|
|
63
|
+
params['page'] = `${(_a = data === null || data === void 0 ? void 0 : data.pageNumber) !== null && _a !== void 0 ? _a : 1}`;
|
|
64
|
+
params['page_size'] = `${(_b = data === null || data === void 0 ? void 0 : data.pageSize) !== null && _b !== void 0 ? _b : 25}`;
|
|
65
|
+
const sort = ((_c = data === null || data === void 0 ? void 0 : data.sort) !== null && _c !== void 0 ? _c : [])
|
|
66
|
+
.map(({ name }) => name)
|
|
67
|
+
.filter(name => !!name)
|
|
68
|
+
.join(',');
|
|
69
|
+
const sortDirection = ((_d = data === null || data === void 0 ? void 0 : data.sort) !== null && _d !== void 0 ? _d : [])
|
|
70
|
+
.map(({ direction }) => direction)
|
|
71
|
+
.filter(direction => !!direction)
|
|
72
|
+
.join(',');
|
|
73
|
+
if ((sort === null || sort === void 0 ? void 0 : sort.length) > 0 && (sortDirection === null || sortDirection === void 0 ? void 0 : sortDirection.length) > 0) {
|
|
74
|
+
params['sort'] = sort;
|
|
75
|
+
params['sort_direction'] = sortDirection;
|
|
76
|
+
}
|
|
77
|
+
if ((data === null || data === void 0 ? void 0 : data.query) && ((_e = data === null || data === void 0 ? void 0 : data.query) === null || _e === void 0 ? void 0 : _e.length) > 0 && (data === null || data === void 0 ? void 0 : data.queryFields) && ((_f = data === null || data === void 0 ? void 0 : data.queryFields) === null || _f === void 0 ? void 0 : _f.length) > 0) {
|
|
78
|
+
params['query'] = data === null || data === void 0 ? void 0 : data.query;
|
|
79
|
+
params['query_fields'] = (_g = data === null || data === void 0 ? void 0 : data.queryFields) === null || _g === void 0 ? void 0 : _g.join(',');
|
|
80
|
+
}
|
|
81
|
+
return params;
|
|
82
|
+
};
|
|
83
|
+
this._httpClient = httpClient;
|
|
84
|
+
this._endpoint$ = typeof endpoint === 'string'
|
|
85
|
+
? of(endpoint)
|
|
86
|
+
: endpoint;
|
|
87
|
+
}
|
|
88
|
+
append(item) {
|
|
89
|
+
const currentValue = this._items$.getValue();
|
|
90
|
+
const newValue = [...currentValue, item];
|
|
91
|
+
this._items$.next(newValue);
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
data(fn) {
|
|
95
|
+
this._fn = fn;
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
handle(request) {
|
|
99
|
+
const extraParams$ = this._items$.pipe(switchMap(items => (items === null || items === void 0 ? void 0 : items.length) <= 0 ? of([]) : combineLatest(items)), map(items => items.reduce((previous, current) => (Object.assign(Object.assign({}, previous), (current !== null && current !== void 0 ? current : {}))), {})));
|
|
100
|
+
return combineLatest([request.when, this._endpoint$, extraParams$]).pipe(switchMap(([params, endpoint, extraParams]) => {
|
|
101
|
+
// Start the loading.
|
|
102
|
+
request.startLoading();
|
|
103
|
+
const formattedParams = this.formatParams(params);
|
|
104
|
+
const combinedParams = Object.assign(Object.assign({}, formattedParams), extraParams);
|
|
105
|
+
return this._httpClient.get(endpoint, {
|
|
106
|
+
params: combinedParams
|
|
107
|
+
}).pipe(map(data => this.formatResponse(data)), map(result => {
|
|
108
|
+
var _a;
|
|
109
|
+
return (Object.assign(Object.assign({}, result), { data: this._fn((_a = result === null || result === void 0 ? void 0 : result.data) !== null && _a !== void 0 ? _a : []) }));
|
|
110
|
+
}));
|
|
111
|
+
}), share());
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
class BbTablePagerBase {
|
|
116
|
+
}
|
|
117
|
+
const BbTablePagerMixinBase = mixinDisabled(BbTablePagerBase);
|
|
118
|
+
class BbTablePager extends BbTablePagerMixinBase {
|
|
119
|
+
constructor() {
|
|
120
|
+
super(...arguments);
|
|
121
|
+
// Inputs.
|
|
122
|
+
this.amountOfButtons = 5;
|
|
123
|
+
this.showArrowButtons = true;
|
|
124
|
+
// Methods.
|
|
125
|
+
this.onChange = () => ({});
|
|
126
|
+
this.onTouched = () => ({});
|
|
127
|
+
this.trackByIndex = (_, item) => item.page;
|
|
128
|
+
// Data.
|
|
129
|
+
this._totalPages$ = new BehaviorSubject(1);
|
|
130
|
+
this._pageNumber$ = new BehaviorSubject(1);
|
|
131
|
+
}
|
|
132
|
+
ngOnInit() {
|
|
133
|
+
// Validate the previous button is disabled.
|
|
134
|
+
this.isPreviousDisabled$ = this._pageNumber$.pipe(map(pageNumber => pageNumber === 1));
|
|
135
|
+
// Validate the next button is disabled.
|
|
136
|
+
this.isNextDisabled$ = combineLatest([this._pageNumber$, this._totalPages$]).pipe(map(([pageNumber, totalPages]) => pageNumber === totalPages));
|
|
137
|
+
// Create the list with page numbers.
|
|
138
|
+
this.list$ = combineLatest([this._pageNumber$, this._totalPages$]).pipe(map(([pageNumber, totalPages]) => this.filterActivePages(pageNumber, totalPages)), share());
|
|
139
|
+
}
|
|
140
|
+
get pageNumber() {
|
|
141
|
+
return this._pageNumber$.getValue();
|
|
142
|
+
}
|
|
143
|
+
set pageNumber(newValue) {
|
|
144
|
+
this.update(newValue);
|
|
145
|
+
}
|
|
146
|
+
get totalPages() {
|
|
147
|
+
return this._totalPages$.getValue();
|
|
148
|
+
}
|
|
149
|
+
set totalPages(newValue) {
|
|
150
|
+
const newTotalPages = Math.max(1, newValue);
|
|
151
|
+
this._totalPages$.next(newTotalPages);
|
|
152
|
+
}
|
|
153
|
+
registerOnChange(fn) {
|
|
154
|
+
this.onChange = fn;
|
|
155
|
+
}
|
|
156
|
+
registerOnTouched(fn) {
|
|
157
|
+
this.onTouched = fn;
|
|
158
|
+
}
|
|
159
|
+
setDisabledState(isDisabled) {
|
|
160
|
+
this.disabled = isDisabled;
|
|
161
|
+
}
|
|
162
|
+
writeValue(newValue) {
|
|
163
|
+
this.update(newValue, false);
|
|
164
|
+
}
|
|
165
|
+
goToPrevious() {
|
|
166
|
+
const newValue = this._pageNumber$.getValue() - 1;
|
|
167
|
+
return this.update(newValue);
|
|
168
|
+
}
|
|
169
|
+
goToNext() {
|
|
170
|
+
const newValue = this._pageNumber$.getValue() + 1;
|
|
171
|
+
return this.update(newValue);
|
|
172
|
+
}
|
|
173
|
+
goToIndex(index) {
|
|
174
|
+
return this.update(index);
|
|
175
|
+
}
|
|
176
|
+
update(pageNumber, notify = true) {
|
|
177
|
+
// You can only update when not disabled.
|
|
178
|
+
if (this.disabled) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
// Calculate the new value.
|
|
182
|
+
const newValue = Math.min(this.totalPages, Math.max(1, pageNumber));
|
|
183
|
+
// Don't do anything if the page number is the same.
|
|
184
|
+
if (this._pageNumber$.getValue() === newValue) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
// Push the new value.
|
|
188
|
+
this._pageNumber$.next(newValue);
|
|
189
|
+
if (notify) {
|
|
190
|
+
return this.onChange(pageNumber);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
calculatePages(pageNumber) {
|
|
194
|
+
const min = 1;
|
|
195
|
+
const max = this.totalPages;
|
|
196
|
+
const amount = Math.max(1, this.amountOfButtons);
|
|
197
|
+
const data = Array(amount)
|
|
198
|
+
.fill(0)
|
|
199
|
+
.map((_, index) => pageNumber + (index - 1));
|
|
200
|
+
// Validate if the minimum value less than
|
|
201
|
+
// the first value.
|
|
202
|
+
if (data[0] < min) {
|
|
203
|
+
return data.map(item => item + 1);
|
|
204
|
+
}
|
|
205
|
+
// Calculate the difference with the max
|
|
206
|
+
// if this value is higher than 0 we should minus it.
|
|
207
|
+
const lastValueInArray = data[data.length - 1];
|
|
208
|
+
const differenceWithMax = lastValueInArray - max;
|
|
209
|
+
if (differenceWithMax > 0) {
|
|
210
|
+
return data.map(item => item - differenceWithMax);
|
|
211
|
+
}
|
|
212
|
+
// Just return the default data.
|
|
213
|
+
return data;
|
|
214
|
+
}
|
|
215
|
+
filterActivePages(pageNumber, totalPages) {
|
|
216
|
+
return this.calculatePages(pageNumber)
|
|
217
|
+
.filter(page => page > 0 && page <= totalPages)
|
|
218
|
+
.map(page => ({ page, active: pageNumber === page }));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
BbTablePager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTablePager, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
222
|
+
BbTablePager.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbTablePager, selector: "bb-table-pager", inputs: { disabled: "disabled", amountOfButtons: "amountOfButtons", showArrowButtons: "showArrowButtons", pageNumber: "pageNumber", totalPages: "totalPages" }, host: { properties: { "class.disabled": "disabled" }, classAttribute: "bb-table-pager" }, providers: [
|
|
223
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbTablePager), multi: true }
|
|
224
|
+
], usesInheritance: true, ngImport: i0, template: "<ul class=\"bb-pager-list\">\n <!-- The previous page arrow button. -->\n <li *ngIf=\"showArrowButtons\"\n class=\"bb-pager-list-item\"\n title=\"Previous page\">\n <button [disabled]=\"isPreviousDisabled$ | async\"\n (click)=\"goToPrevious()\"\n class=\"bb-pager-list-button\"\n type=\"button\">\n <bb-icon src=\"material:keyboard_arrow_left\"></bb-icon>\n </button>\n </li>\n\n <!-- The list of number buttons to navigate through the list. -->\n <ng-container *ngIf=\"list$ | async as list\">\n <li *ngFor=\"let item of list; trackBy: trackByIndex\"\n [title]=\"'Page ' + item?.page\"\n class=\"bb-pager-list-item\">\n <button (click)=\"goToIndex(item?.page)\"\n [class.active]=\"item?.active\"\n class=\"bb-pager-list-button\"\n type=\"button\">\n {{ item?.page }}\n </button>\n </li>\n </ng-container>\n\n <!-- The next page arrow button. -->\n <li *ngIf=\"showArrowButtons\"\n class=\"bb-pager-list-item\"\n title=\"Next page\">\n <button [disabled]=\"isNextDisabled$ | async\"\n (click)=\"goToNext()\"\n class=\"bb-pager-list-button\"\n type=\"button\">\n <bb-icon src=\"material:keyboard_arrow_right\"></bb-icon>\n </button>\n </li>\n</ul>\n", styles: [".bb-table-pager{flex:1;display:flex;align-items:center;justify-content:flex-end}.bb-table-pager.disabled{opacity:.5;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-pager-list{display:flex}.bb-pager-list-item{margin-left:8px}.bb-pager-list-button{padding:0;color:#3d464d;line-height:1;min-width:32px;font-size:16px;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-weight:500;min-height:32px;-webkit-user-select:none;user-select:none;border-radius:4px;align-items:center;display:inline-flex;justify-content:center;border:1px solid #b6bbc1;transition-duration:.2s;background-color:transparent;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:color,border-color,opacity,background-color;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-pager-list-button:hover,.bb-pager-list-button:focus{background-color:#0000000a}.bb-pager-list-button.active,.bb-pager-list-button.active:hover{color:#2196f3;cursor:default;border-color:#2196f3;background-color:transparent}.bb-pager-list-button:disabled{opacity:.35;cursor:default;pointer-events:none}\n"], components: [{ type: i1.BbIcon, selector: "bb-icon", inputs: ["alt", "size", "src", "ariaHidden"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
225
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTablePager, decorators: [{
|
|
226
|
+
type: Component,
|
|
227
|
+
args: [{ selector: 'bb-table-pager', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
228
|
+
'class': 'bb-table-pager',
|
|
229
|
+
'[class.disabled]': 'disabled'
|
|
230
|
+
}, inputs: ['disabled'], encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, providers: [
|
|
231
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbTablePager), multi: true }
|
|
232
|
+
], template: "<ul class=\"bb-pager-list\">\n <!-- The previous page arrow button. -->\n <li *ngIf=\"showArrowButtons\"\n class=\"bb-pager-list-item\"\n title=\"Previous page\">\n <button [disabled]=\"isPreviousDisabled$ | async\"\n (click)=\"goToPrevious()\"\n class=\"bb-pager-list-button\"\n type=\"button\">\n <bb-icon src=\"material:keyboard_arrow_left\"></bb-icon>\n </button>\n </li>\n\n <!-- The list of number buttons to navigate through the list. -->\n <ng-container *ngIf=\"list$ | async as list\">\n <li *ngFor=\"let item of list; trackBy: trackByIndex\"\n [title]=\"'Page ' + item?.page\"\n class=\"bb-pager-list-item\">\n <button (click)=\"goToIndex(item?.page)\"\n [class.active]=\"item?.active\"\n class=\"bb-pager-list-button\"\n type=\"button\">\n {{ item?.page }}\n </button>\n </li>\n </ng-container>\n\n <!-- The next page arrow button. -->\n <li *ngIf=\"showArrowButtons\"\n class=\"bb-pager-list-item\"\n title=\"Next page\">\n <button [disabled]=\"isNextDisabled$ | async\"\n (click)=\"goToNext()\"\n class=\"bb-pager-list-button\"\n type=\"button\">\n <bb-icon src=\"material:keyboard_arrow_right\"></bb-icon>\n </button>\n </li>\n</ul>\n", styles: [".bb-table-pager{flex:1;display:flex;align-items:center;justify-content:flex-end}.bb-table-pager.disabled{opacity:.5;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-pager-list{display:flex}.bb-pager-list-item{margin-left:8px}.bb-pager-list-button{padding:0;color:#3d464d;line-height:1;min-width:32px;font-size:16px;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-weight:500;min-height:32px;-webkit-user-select:none;user-select:none;border-radius:4px;align-items:center;display:inline-flex;justify-content:center;border:1px solid #b6bbc1;transition-duration:.2s;background-color:transparent;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:color,border-color,opacity,background-color;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-pager-list-button:hover,.bb-pager-list-button:focus{background-color:#0000000a}.bb-pager-list-button.active,.bb-pager-list-button.active:hover{color:#2196f3;cursor:default;border-color:#2196f3;background-color:transparent}.bb-pager-list-button:disabled{opacity:.35;cursor:default;pointer-events:none}\n"] }]
|
|
233
|
+
}], propDecorators: { amountOfButtons: [{
|
|
234
|
+
type: Input
|
|
235
|
+
}], showArrowButtons: [{
|
|
236
|
+
type: Input
|
|
237
|
+
}], pageNumber: [{
|
|
238
|
+
type: Input
|
|
239
|
+
}], totalPages: [{
|
|
240
|
+
type: Input
|
|
241
|
+
}] } });
|
|
242
|
+
|
|
243
|
+
class BbTableColumnDef {
|
|
244
|
+
}
|
|
245
|
+
BbTableColumnDef.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTableColumnDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
246
|
+
BbTableColumnDef.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbTableColumnDef, selector: "[bbTableColumnDef]", ngImport: i0 });
|
|
247
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTableColumnDef, decorators: [{
|
|
248
|
+
type: Directive,
|
|
249
|
+
args: [{
|
|
250
|
+
selector: '[bbTableColumnDef]'
|
|
251
|
+
}]
|
|
252
|
+
}] });
|
|
253
|
+
class BbTableRowDef {
|
|
254
|
+
}
|
|
255
|
+
BbTableRowDef.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTableRowDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
256
|
+
BbTableRowDef.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbTableRowDef, selector: "[bbTableRowDef]", ngImport: i0 });
|
|
257
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTableRowDef, decorators: [{
|
|
258
|
+
type: Directive,
|
|
259
|
+
args: [{
|
|
260
|
+
selector: '[bbTableRowDef]'
|
|
261
|
+
}]
|
|
262
|
+
}] });
|
|
263
|
+
class BbTable {
|
|
264
|
+
constructor() {
|
|
265
|
+
// Inputs.
|
|
266
|
+
this.identifier = null;
|
|
267
|
+
this.queryFields = [];
|
|
268
|
+
this.sortingStrategy = 'single';
|
|
269
|
+
this.header = true;
|
|
270
|
+
this.footer = true;
|
|
271
|
+
// Sizes.
|
|
272
|
+
this._sizes = [25, 50, 75, 100];
|
|
273
|
+
// Optimizations.
|
|
274
|
+
this.trackByFn = (index, item) => this.identifier ? item[this.identifier] : index;
|
|
275
|
+
this.trackByValue = (_, item) => item;
|
|
276
|
+
this.queryControl = new FormControl('');
|
|
277
|
+
// State.
|
|
278
|
+
this._headerCount = 0;
|
|
279
|
+
}
|
|
280
|
+
get sizes() {
|
|
281
|
+
return this._sizes;
|
|
282
|
+
}
|
|
283
|
+
set sizes(newValue) {
|
|
284
|
+
this.updateSizes(newValue);
|
|
285
|
+
}
|
|
286
|
+
ngOnInit() {
|
|
287
|
+
this.composeForm();
|
|
288
|
+
this.watchDataChanges();
|
|
289
|
+
}
|
|
290
|
+
ngOnDestroy() {
|
|
291
|
+
var _a;
|
|
292
|
+
(_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
293
|
+
}
|
|
294
|
+
get headerCount() {
|
|
295
|
+
return this._headerCount;
|
|
296
|
+
}
|
|
297
|
+
get sortControl() {
|
|
298
|
+
var _a;
|
|
299
|
+
return (_a = this.form) === null || _a === void 0 ? void 0 : _a.get('sort');
|
|
300
|
+
}
|
|
301
|
+
get pageNumberControl() {
|
|
302
|
+
var _a;
|
|
303
|
+
return (_a = this.form) === null || _a === void 0 ? void 0 : _a.get('pageNumber');
|
|
304
|
+
}
|
|
305
|
+
get pageSizeControl() {
|
|
306
|
+
var _a;
|
|
307
|
+
return (_a = this.form) === null || _a === void 0 ? void 0 : _a.get('pageSize');
|
|
308
|
+
}
|
|
309
|
+
refresh() {
|
|
310
|
+
return this.request.update();
|
|
311
|
+
}
|
|
312
|
+
setHeaderCount(amount) {
|
|
313
|
+
this._headerCount += amount;
|
|
314
|
+
}
|
|
315
|
+
updateSizes(newValue) {
|
|
316
|
+
// Validate the sizes has at least one value.
|
|
317
|
+
if (newValue.length <= 0) {
|
|
318
|
+
throw new Error('Cannot set an empty array as the sizes.');
|
|
319
|
+
}
|
|
320
|
+
// Set the new size.
|
|
321
|
+
this._sizes = newValue;
|
|
322
|
+
// Validate that the form exists already.
|
|
323
|
+
if (!this.form) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
// Check if the current selected value is
|
|
327
|
+
// in the new sizes array.
|
|
328
|
+
const pageSizeControl = this.form.get('pageSize');
|
|
329
|
+
if (this._sizes.includes(pageSizeControl.value)) {
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
// Set the first value in the array as
|
|
333
|
+
// the new value.
|
|
334
|
+
const firstValue = this._sizes[0];
|
|
335
|
+
pageSizeControl.setValue(firstValue);
|
|
336
|
+
}
|
|
337
|
+
composeForm() {
|
|
338
|
+
// Setup the form.
|
|
339
|
+
this.form = new FormGroup({
|
|
340
|
+
pageSize: new FormControl(this._sizes[0]),
|
|
341
|
+
pageNumber: new FormControl(1),
|
|
342
|
+
sort: new FormGroup({})
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
watchDataChanges() {
|
|
346
|
+
// Create a new request.
|
|
347
|
+
this.request = new DataSourceRequest();
|
|
348
|
+
this.isLoading$ = this.request.loading;
|
|
349
|
+
if (!this.dataSource) {
|
|
350
|
+
this.data$ = of({ state: 'error_datasource' }).pipe(tap(() => this.request.stopLoading()));
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
// Pass the request to the data source.
|
|
354
|
+
this.data$ = this.dataSource.handle(this.request).pipe(tap(() => this.request.stopLoading()), map(result => {
|
|
355
|
+
const count = (result && result.data && result.data.length) || 0;
|
|
356
|
+
if (count <= 0) {
|
|
357
|
+
return { state: 'empty', result };
|
|
358
|
+
}
|
|
359
|
+
return { state: 'success', result };
|
|
360
|
+
}), catchError(error => {
|
|
361
|
+
var _a, _b;
|
|
362
|
+
this.request.stopLoading();
|
|
363
|
+
const statusCode = (_a = error === null || error === void 0 ? void 0 : error.status) !== null && _a !== void 0 ? _a : null;
|
|
364
|
+
const states = {
|
|
365
|
+
0: 'error_down',
|
|
366
|
+
401: 'error_unauthorized',
|
|
367
|
+
403: 'error_forbidden',
|
|
368
|
+
404: 'error_not_found',
|
|
369
|
+
500: 'error_server'
|
|
370
|
+
};
|
|
371
|
+
return of({ state: (_b = states === null || states === void 0 ? void 0 : states[statusCode]) !== null && _b !== void 0 ? _b : 'error_unknown', statusCode: statusCode });
|
|
372
|
+
}));
|
|
373
|
+
// Subscribe to the data changes.
|
|
374
|
+
this.subscribeToChanges();
|
|
375
|
+
}
|
|
376
|
+
subscribeToChanges() {
|
|
377
|
+
const form$ = this.getFormChanges();
|
|
378
|
+
const query$ = this.getQueryChanges();
|
|
379
|
+
this._subscription = combineLatest([form$, query$]).subscribe(([form, query]) => {
|
|
380
|
+
const { pageNumber, pageSize } = form;
|
|
381
|
+
const sort = Object.keys(form.sort)
|
|
382
|
+
.map(name => ({ name, direction: form.sort[name] }))
|
|
383
|
+
.filter(item => ['asc', 'desc'].includes(item.direction));
|
|
384
|
+
this.request.startLoading();
|
|
385
|
+
return this.request.update({
|
|
386
|
+
sort,
|
|
387
|
+
query,
|
|
388
|
+
pageSize,
|
|
389
|
+
pageNumber,
|
|
390
|
+
queryFields: this.queryFields
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
getQueryChanges() {
|
|
395
|
+
return this.queryControl.valueChanges.pipe(debounceTime(400), distinctUntilChanged(), startWith(this.queryControl.value));
|
|
396
|
+
}
|
|
397
|
+
getFormChanges() {
|
|
398
|
+
return this.form.valueChanges.pipe(startWith(this.form.value));
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
BbTable.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
402
|
+
BbTable.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbTable, selector: "bb-table", inputs: { identifier: "identifier", dataSource: "dataSource", queryFields: "queryFields", sortingStrategy: "sortingStrategy", header: "header", footer: "footer", sizes: "sizes" }, host: { classAttribute: "bb-table" }, queries: [{ propertyName: "tableRowTemplate", first: true, predicate: BbTableRowDef, descendants: true, read: TemplateRef }, { propertyName: "tableColumnTemplates", predicate: BbTableColumnDef, read: TemplateRef }], ngImport: i0, template: "<!--\n This is the header of the table. It can be a user\n defined custom header or just the default header.\n-->\n\n<header *ngIf=\"(header === true ? headerTemplate : header) as template\"\n class=\"bb-table-top-actions\">\n <ng-container *ngTemplateOutlet=\"template\"></ng-container>\n</header>\n\n<!--\n This is the table that contains the\n rows and columns.\n-->\n\n<div class=\"bb-table-wrapper\">\n <div *ngIf=\"isLoading$ | async\"\n class=\"bb-table-progress\">\n <div class=\"bb-table-indeterminate\"></div>\n </div>\n <table class=\"bb-table-container\">\n <thead>\n <tr>\n <ng-content select=\"bb-table-header-cell\"></ng-content>\n </tr>\n </thead>\n <tbody *ngIf=\"data$ | async as data; else isLoadingTemplate\"\n [ngSwitch]=\"data?.state\">\n <ng-container *ngSwitchCase=\"'success'\">\n <ng-container *ngIf=\"!!tableRowTemplate; else tableCellsTemplates\">\n <ng-container\n *ngTemplateOutlet=\"tableRowTemplate; context: {data: data?.result?.data || []}\"></ng-container>\n </ng-container>\n\n <ng-template #tableCellsTemplates>\n <tr *ngFor=\"let item of data?.result?.data; trackBy: trackByFn\">\n <ng-container *ngFor=\"let template of tableColumnTemplates\">\n <ng-container *ngTemplateOutlet=\"template; context: {item: item}\"></ng-container>\n </ng-container>\n </tr>\n </ng-template>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'empty'\">\n <ng-container\n *ngTemplateOutlet=\"errorTemplate; context: data\"></ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'error_datasource'\">\n <ng-container\n *ngTemplateOutlet=\"errorTemplate; context: data\"></ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'error_not_found'\">\n <ng-container\n *ngTemplateOutlet=\"errorTemplate; context: data\"></ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'error_server'\">\n <ng-container\n *ngTemplateOutlet=\"errorTemplate; context: data\"></ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'error_down'\">\n <ng-container\n *ngTemplateOutlet=\"errorTemplate; context: data\"></ng-container>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <ng-container\n *ngTemplateOutlet=\"errorTemplate; context: data\"></ng-container>\n </ng-container>\n </tbody>\n </table>\n</div>\n\n<footer *ngIf=\"(footer === true ? footerTemplate : footer) as template\"\n class=\"bb-table-bottom-actions\">\n <ng-container *ngTemplateOutlet=\"template\"></ng-container>\n</footer>\n\n<ng-template #isLoadingTemplate>\n <tr>\n <td [attr.colspan]=\"headerCount\"\n class=\"bb-table-template\">\n <div class=\"bb-table-template-content\">\n {{ 'tables.loading' | bbLocalize }}\n </div>\n </td>\n </tr>\n</ng-template>\n\n<!--\n This is the template that will be used when the user has not\n supplied a custom header template.\n-->\n\n<ng-template #headerTemplate>\n <ng-content></ng-content>\n <bb-form-control>\n <input [formControl]=\"queryControl\"\n [placeholder]=\"'tables.search' | bbLocalize\"\n bbInput\n autocomplete=\"off\">\n <bb-icon *ngIf=\"queryControl?.value?.length <= 0; else closeButtonTemplate\"\n bbSuffix\n src=\"material:search\">\n </bb-icon>\n </bb-form-control>\n</ng-template>\n\n<!--\n This is the template that will be used when the user has not\n supplied a custom footer template.\n-->\n\n<ng-template #footerTemplate>\n <bb-form-control *ngIf=\"sizes?.length > 1\">\n <select [formControl]=\"pageSizeControl\"\n bbInput\n title=\"Sizes\">\n <option *ngFor=\"let item of sizes; trackBy: trackByValue\"\n [ngValue]=\"item\">\n {{ item }} / {{ 'tables.page' | bbLocalize }}\n </option>\n </select>\n </bb-form-control>\n\n <bb-table-pager [totalPages]=\"(data$ | async)?.result?.totalPages\"\n [formControl]=\"pageNumberControl\">\n </bb-table-pager>\n</ng-template>\n\n<!--\n This the template that will be used when the user\n has filled in some data in the query control.\n-->\n\n<ng-template #closeButtonTemplate>\n <button bbSuffix\n (click)=\"queryControl?.patchValue('')\"\n type=\"button\"\n class=\"bb-table-progress-close-query\">\n <bb-icon src=\"material:close\"></bb-icon>\n </button>\n</ng-template>\n\n<ng-template #errorTemplate let-state=\"state\" let-status=\"statusCode\">\n <tr>\n <td [attr.colspan]=\"headerCount\"\n class=\"bb-table-template\">\n <div class=\"bb-table-template-content\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"64\" height=\"41\">\n <g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(0 1)\">\n <ellipse cx=\"32\" cy=\"33\" fill=\"#F5F5F5\" rx=\"32\" ry=\"7\"></ellipse>\n <g fill-rule=\"nonzero\" stroke=\"#D9D9D9\">\n <path\n d=\"M55 12.7605604L44.8543047 1.25739633C44.3674414.47382661 43.6558789 0 42.9067617 0H21.0932383c-.7491172 0-1.4606797.47395025-1.947543 1.25739633L9 12.7605604V22h46v-9.2394396z\"></path>\n <path fill=\"#FAFAFA\"\n d=\"M41.6132813 15.9315c0-1.6056489.9936718-2.931266 2.2264179-2.9315H55v18.1371277C55 33.2589574 53.6793867 35 52.0504297 35H11.94957031C10.32052344 35 9 33.2588404 9 31.1371277V13h11.1603008c1.2327461 0 2.226418 1.3228085 2.226418 2.9284574v.0211809c0 1.6056489 1.0049921 2.9015426 2.2377382 2.9015426h14.751086c1.2327461 0 2.2377383-1.3078298 2.2377383-2.9134788V15.9315z\"></path>\n </g>\n </g>\n </svg>\n <span *ngIf=\"state as stateLabel\">{{ ('tables.' + stateLabel) | bbLocalize }}</span>\n <span *ngIf=\"status as statusCode\"\n class=\"bb-table-template-content-code\">(HTTP {{ statusCode }})</span>\n </div>\n </td>\n </tr>\n</ng-template>\n", styles: [".bb-table{width:100%;display:block;box-shadow:0 6px 6px -6px #0000001a}.bb-table.plain{box-shadow:none}.bb-table.plain>.bb-table-wrapper{border-top-left-radius:0;border-top-right-radius:0}.bb-table-wrapper{overflow-x:auto;position:relative;background-color:#fff;border-top-left-radius:4px;border-top-right-radius:4px}.bb-table-container{width:100%}.bb-table-container td{border-bottom:1px solid #d8d8d8}.bb-table-top-actions{display:flex;flex-wrap:wrap;flex-direction:column;padding:20px 20px 10px;background-color:#fff;justify-content:flex-end;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:1px solid #d8d8d8}.bb-table-top-actions>*{margin-left:0;margin-bottom:10px}.bb-table-top-actions+.bb-table-wrapper{border-radius:0}.bb-table-bottom-actions{height:60px;display:flex;padding:0 20px;overflow-x:auto;align-items:center;background-color:#fff;border-bottom-left-radius:4px;border-bottom-right-radius:4px}.bb-table-template{border:none;background-color:#f5f5f5;border-bottom:1px solid #d8d8d8}.bb-table-template-content{padding:20px;display:flex;color:#3d464d;font-size:14px;line-height:1.2;font-weight:400;min-height:140px;text-align:center;align-items:center;flex-direction:column;justify-content:center}.bb-table-template-content>svg{margin-bottom:12px}.bb-table-template-content-code{opacity:.5;margin-top:5px;display:inline-block}.bb-table-progress{top:0;left:0;right:0;opacity:0;width:100%;height:4px;display:block;overflow:hidden;position:absolute;background-color:#2f408b4d;animation:fadeIn .25s cubic-bezier(0,0,.2,1) .1s forwards}.bb-table-progress .bb-table-indeterminate{background-color:#2f408b}.bb-table-progress .bb-table-indeterminate:before{top:0;left:0;bottom:0;content:\"\";position:absolute;will-change:left,right;background-color:inherit;animation:indeterminate 2.1s cubic-bezier(.65,.815,.735,.395) infinite}.bb-table-progress .bb-table-indeterminate:after{top:0;left:0;bottom:0;content:\"\";position:absolute;animation-delay:1.15s;will-change:left,right;background-color:inherit;animation:indeterminate-short 2.1s cubic-bezier(.165,.84,.44,1) infinite}.bb-table-progress-close-query{padding:0;border:none;border-radius:4px;background-color:transparent;transition:background-color .25s cubic-bezier(0,0,.2,1)}.bb-table-progress-close-query:hover{background-color:#00000014}.bb-table-progress-close-query:focus{background-color:#0000001f}.bb-table-progress-close-query:active{background-color:#00000029}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes indeterminate{0%{left:-35%;right:100%}60%{left:100%;right:-90%}to{left:100%;right:-90%}}@keyframes indeterminate-short{0%{left:-200%;right:100%}60%{left:107%;right:-8%}to{left:107%;right:-8%}}@media only screen and (min-width: 768px){.bb-table-top-actions{flex-direction:row}.bb-table-top-actions>*:not(:first-child){margin-left:10px;margin-bottom:10px}}\n"], components: [{ type: i1.BbFormControl, selector: "bb-form-control", inputs: ["grouped", "hideErrors", "label", "hint"] }, { type: i1.BbIcon, selector: "bb-icon", inputs: ["alt", "size", "src", "ariaHidden"] }, { type: BbTablePager, selector: "bb-table-pager", inputs: ["disabled", "amountOfButtons", "showArrowButtons", "pageNumber", "totalPages"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i1.BbInput, selector: "input[bbInput], textarea[bbInput]", inputs: ["readonly"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i1.BbSuffix, selector: "[bbSuffix]" }, { type: i1.BbSelect, selector: "select[bbInput]", inputs: ["disabled", "required"] }, { type: i4.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i4.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i4.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }], pipes: { "async": i3.AsyncPipe, "bbLocalize": i5.BbLocalize }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTable, decorators: [{
|
|
404
|
+
type: Component,
|
|
405
|
+
args: [{ selector: 'bb-table', host: { 'class': 'bb-table' }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, template: "<!--\n This is the header of the table. It can be a user\n defined custom header or just the default header.\n-->\n\n<header *ngIf=\"(header === true ? headerTemplate : header) as template\"\n class=\"bb-table-top-actions\">\n <ng-container *ngTemplateOutlet=\"template\"></ng-container>\n</header>\n\n<!--\n This is the table that contains the\n rows and columns.\n-->\n\n<div class=\"bb-table-wrapper\">\n <div *ngIf=\"isLoading$ | async\"\n class=\"bb-table-progress\">\n <div class=\"bb-table-indeterminate\"></div>\n </div>\n <table class=\"bb-table-container\">\n <thead>\n <tr>\n <ng-content select=\"bb-table-header-cell\"></ng-content>\n </tr>\n </thead>\n <tbody *ngIf=\"data$ | async as data; else isLoadingTemplate\"\n [ngSwitch]=\"data?.state\">\n <ng-container *ngSwitchCase=\"'success'\">\n <ng-container *ngIf=\"!!tableRowTemplate; else tableCellsTemplates\">\n <ng-container\n *ngTemplateOutlet=\"tableRowTemplate; context: {data: data?.result?.data || []}\"></ng-container>\n </ng-container>\n\n <ng-template #tableCellsTemplates>\n <tr *ngFor=\"let item of data?.result?.data; trackBy: trackByFn\">\n <ng-container *ngFor=\"let template of tableColumnTemplates\">\n <ng-container *ngTemplateOutlet=\"template; context: {item: item}\"></ng-container>\n </ng-container>\n </tr>\n </ng-template>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'empty'\">\n <ng-container\n *ngTemplateOutlet=\"errorTemplate; context: data\"></ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'error_datasource'\">\n <ng-container\n *ngTemplateOutlet=\"errorTemplate; context: data\"></ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'error_not_found'\">\n <ng-container\n *ngTemplateOutlet=\"errorTemplate; context: data\"></ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'error_server'\">\n <ng-container\n *ngTemplateOutlet=\"errorTemplate; context: data\"></ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'error_down'\">\n <ng-container\n *ngTemplateOutlet=\"errorTemplate; context: data\"></ng-container>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <ng-container\n *ngTemplateOutlet=\"errorTemplate; context: data\"></ng-container>\n </ng-container>\n </tbody>\n </table>\n</div>\n\n<footer *ngIf=\"(footer === true ? footerTemplate : footer) as template\"\n class=\"bb-table-bottom-actions\">\n <ng-container *ngTemplateOutlet=\"template\"></ng-container>\n</footer>\n\n<ng-template #isLoadingTemplate>\n <tr>\n <td [attr.colspan]=\"headerCount\"\n class=\"bb-table-template\">\n <div class=\"bb-table-template-content\">\n {{ 'tables.loading' | bbLocalize }}\n </div>\n </td>\n </tr>\n</ng-template>\n\n<!--\n This is the template that will be used when the user has not\n supplied a custom header template.\n-->\n\n<ng-template #headerTemplate>\n <ng-content></ng-content>\n <bb-form-control>\n <input [formControl]=\"queryControl\"\n [placeholder]=\"'tables.search' | bbLocalize\"\n bbInput\n autocomplete=\"off\">\n <bb-icon *ngIf=\"queryControl?.value?.length <= 0; else closeButtonTemplate\"\n bbSuffix\n src=\"material:search\">\n </bb-icon>\n </bb-form-control>\n</ng-template>\n\n<!--\n This is the template that will be used when the user has not\n supplied a custom footer template.\n-->\n\n<ng-template #footerTemplate>\n <bb-form-control *ngIf=\"sizes?.length > 1\">\n <select [formControl]=\"pageSizeControl\"\n bbInput\n title=\"Sizes\">\n <option *ngFor=\"let item of sizes; trackBy: trackByValue\"\n [ngValue]=\"item\">\n {{ item }} / {{ 'tables.page' | bbLocalize }}\n </option>\n </select>\n </bb-form-control>\n\n <bb-table-pager [totalPages]=\"(data$ | async)?.result?.totalPages\"\n [formControl]=\"pageNumberControl\">\n </bb-table-pager>\n</ng-template>\n\n<!--\n This the template that will be used when the user\n has filled in some data in the query control.\n-->\n\n<ng-template #closeButtonTemplate>\n <button bbSuffix\n (click)=\"queryControl?.patchValue('')\"\n type=\"button\"\n class=\"bb-table-progress-close-query\">\n <bb-icon src=\"material:close\"></bb-icon>\n </button>\n</ng-template>\n\n<ng-template #errorTemplate let-state=\"state\" let-status=\"statusCode\">\n <tr>\n <td [attr.colspan]=\"headerCount\"\n class=\"bb-table-template\">\n <div class=\"bb-table-template-content\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"64\" height=\"41\">\n <g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(0 1)\">\n <ellipse cx=\"32\" cy=\"33\" fill=\"#F5F5F5\" rx=\"32\" ry=\"7\"></ellipse>\n <g fill-rule=\"nonzero\" stroke=\"#D9D9D9\">\n <path\n d=\"M55 12.7605604L44.8543047 1.25739633C44.3674414.47382661 43.6558789 0 42.9067617 0H21.0932383c-.7491172 0-1.4606797.47395025-1.947543 1.25739633L9 12.7605604V22h46v-9.2394396z\"></path>\n <path fill=\"#FAFAFA\"\n d=\"M41.6132813 15.9315c0-1.6056489.9936718-2.931266 2.2264179-2.9315H55v18.1371277C55 33.2589574 53.6793867 35 52.0504297 35H11.94957031C10.32052344 35 9 33.2588404 9 31.1371277V13h11.1603008c1.2327461 0 2.226418 1.3228085 2.226418 2.9284574v.0211809c0 1.6056489 1.0049921 2.9015426 2.2377382 2.9015426h14.751086c1.2327461 0 2.2377383-1.3078298 2.2377383-2.9134788V15.9315z\"></path>\n </g>\n </g>\n </svg>\n <span *ngIf=\"state as stateLabel\">{{ ('tables.' + stateLabel) | bbLocalize }}</span>\n <span *ngIf=\"status as statusCode\"\n class=\"bb-table-template-content-code\">(HTTP {{ statusCode }})</span>\n </div>\n </td>\n </tr>\n</ng-template>\n", styles: [".bb-table{width:100%;display:block;box-shadow:0 6px 6px -6px #0000001a}.bb-table.plain{box-shadow:none}.bb-table.plain>.bb-table-wrapper{border-top-left-radius:0;border-top-right-radius:0}.bb-table-wrapper{overflow-x:auto;position:relative;background-color:#fff;border-top-left-radius:4px;border-top-right-radius:4px}.bb-table-container{width:100%}.bb-table-container td{border-bottom:1px solid #d8d8d8}.bb-table-top-actions{display:flex;flex-wrap:wrap;flex-direction:column;padding:20px 20px 10px;background-color:#fff;justify-content:flex-end;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:1px solid #d8d8d8}.bb-table-top-actions>*{margin-left:0;margin-bottom:10px}.bb-table-top-actions+.bb-table-wrapper{border-radius:0}.bb-table-bottom-actions{height:60px;display:flex;padding:0 20px;overflow-x:auto;align-items:center;background-color:#fff;border-bottom-left-radius:4px;border-bottom-right-radius:4px}.bb-table-template{border:none;background-color:#f5f5f5;border-bottom:1px solid #d8d8d8}.bb-table-template-content{padding:20px;display:flex;color:#3d464d;font-size:14px;line-height:1.2;font-weight:400;min-height:140px;text-align:center;align-items:center;flex-direction:column;justify-content:center}.bb-table-template-content>svg{margin-bottom:12px}.bb-table-template-content-code{opacity:.5;margin-top:5px;display:inline-block}.bb-table-progress{top:0;left:0;right:0;opacity:0;width:100%;height:4px;display:block;overflow:hidden;position:absolute;background-color:#2f408b4d;animation:fadeIn .25s cubic-bezier(0,0,.2,1) .1s forwards}.bb-table-progress .bb-table-indeterminate{background-color:#2f408b}.bb-table-progress .bb-table-indeterminate:before{top:0;left:0;bottom:0;content:\"\";position:absolute;will-change:left,right;background-color:inherit;animation:indeterminate 2.1s cubic-bezier(.65,.815,.735,.395) infinite}.bb-table-progress .bb-table-indeterminate:after{top:0;left:0;bottom:0;content:\"\";position:absolute;animation-delay:1.15s;will-change:left,right;background-color:inherit;animation:indeterminate-short 2.1s cubic-bezier(.165,.84,.44,1) infinite}.bb-table-progress-close-query{padding:0;border:none;border-radius:4px;background-color:transparent;transition:background-color .25s cubic-bezier(0,0,.2,1)}.bb-table-progress-close-query:hover{background-color:#00000014}.bb-table-progress-close-query:focus{background-color:#0000001f}.bb-table-progress-close-query:active{background-color:#00000029}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes indeterminate{0%{left:-35%;right:100%}60%{left:100%;right:-90%}to{left:100%;right:-90%}}@keyframes indeterminate-short{0%{left:-200%;right:100%}60%{left:107%;right:-8%}to{left:107%;right:-8%}}@media only screen and (min-width: 768px){.bb-table-top-actions{flex-direction:row}.bb-table-top-actions>*:not(:first-child){margin-left:10px;margin-bottom:10px}}\n"] }]
|
|
406
|
+
}], propDecorators: { tableColumnTemplates: [{
|
|
407
|
+
type: ContentChildren,
|
|
408
|
+
args: [BbTableColumnDef, { read: TemplateRef }]
|
|
409
|
+
}], tableRowTemplate: [{
|
|
410
|
+
type: ContentChild,
|
|
411
|
+
args: [BbTableRowDef, { read: TemplateRef, static: false }]
|
|
412
|
+
}], identifier: [{
|
|
413
|
+
type: Input
|
|
414
|
+
}], dataSource: [{
|
|
415
|
+
type: Input
|
|
416
|
+
}], queryFields: [{
|
|
417
|
+
type: Input
|
|
418
|
+
}], sortingStrategy: [{
|
|
419
|
+
type: Input
|
|
420
|
+
}], header: [{
|
|
421
|
+
type: Input
|
|
422
|
+
}], footer: [{
|
|
423
|
+
type: Input
|
|
424
|
+
}], sizes: [{
|
|
425
|
+
type: Input
|
|
426
|
+
}] } });
|
|
427
|
+
|
|
428
|
+
class BbTableCell {
|
|
429
|
+
}
|
|
430
|
+
BbTableCell.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTableCell, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
431
|
+
BbTableCell.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbTableCell, selector: "bb-table-cell", host: { classAttribute: "bb-table-cell" }, ngImport: i0, template: "<div>\n <ng-content></ng-content>\n</div>", styles: [".bb-table-cell{color:#848f99;font-size:14px;text-align:left;line-height:1.2;font-weight:400;padding:12px 20px;display:table-cell;word-wrap:break-word;vertical-align:middle;background-color:#f5f5f5;border-bottom:1px solid #d8d8d8}.bb-table-cell:not(:last-child){border-right:1px solid #d8d8d8}.bb-table-cell.fit{width:1%;white-space:nowrap}.bb-table-cell.left{text-align:left}.bb-table-cell.center{text-align:center}.bb-table-cell.right{text-align:right}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
432
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTableCell, decorators: [{
|
|
433
|
+
type: Component,
|
|
434
|
+
args: [{ selector: 'bb-table-cell', changeDetection: ChangeDetectionStrategy.OnPush, host: { 'class': 'bb-table-cell' }, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, template: "<div>\n <ng-content></ng-content>\n</div>", styles: [".bb-table-cell{color:#848f99;font-size:14px;text-align:left;line-height:1.2;font-weight:400;padding:12px 20px;display:table-cell;word-wrap:break-word;vertical-align:middle;background-color:#f5f5f5;border-bottom:1px solid #d8d8d8}.bb-table-cell:not(:last-child){border-right:1px solid #d8d8d8}.bb-table-cell.fit{width:1%;white-space:nowrap}.bb-table-cell.left{text-align:left}.bb-table-cell.center{text-align:center}.bb-table-cell.right{text-align:right}\n"] }]
|
|
435
|
+
}] });
|
|
436
|
+
|
|
437
|
+
class BbTableHeaderCellBase {
|
|
438
|
+
}
|
|
439
|
+
const BbTableHeaderCellMixinBase = mixinDisabled(BbTableHeaderCellBase);
|
|
440
|
+
class BbTableHeaderCell extends BbTableHeaderCellMixinBase {
|
|
441
|
+
constructor(_table, _name) {
|
|
442
|
+
super();
|
|
443
|
+
this._table = _table;
|
|
444
|
+
this._name = _name;
|
|
445
|
+
// Constants.
|
|
446
|
+
this._sortDirections = ['none', 'asc', 'desc'];
|
|
447
|
+
this._control = new FormControl(this._sortDirections[0]);
|
|
448
|
+
this.logWarning = (message) => {
|
|
449
|
+
console && console.warn && console.warn(message);
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
// Sort.
|
|
453
|
+
set sort(value) {
|
|
454
|
+
// Check if the new value is a valid value.
|
|
455
|
+
if (!this._sortDirections.includes(value)) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
// Set the value.
|
|
459
|
+
this._control.setValue(value);
|
|
460
|
+
}
|
|
461
|
+
get sort() {
|
|
462
|
+
return this._control.value;
|
|
463
|
+
}
|
|
464
|
+
ngOnInit() {
|
|
465
|
+
var _a, _b, _c, _d;
|
|
466
|
+
// Validate that the name and table are set.
|
|
467
|
+
(_b = (_a = this._table) === null || _a === void 0 ? void 0 : _a.setHeaderCount) === null || _b === void 0 ? void 0 : _b.call(_a, 1);
|
|
468
|
+
if (!this._table || !this._name) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
// Check if the control already exists in the table.
|
|
472
|
+
if ((_c = this._table.sortControl) === null || _c === void 0 ? void 0 : _c.contains(this._name)) {
|
|
473
|
+
this.disabled = true;
|
|
474
|
+
return this.logWarning(`BbTableHeaderCell: The name "${this._name}" is not unique in the table; Control was not registered.`);
|
|
475
|
+
}
|
|
476
|
+
// Register the header cell with the table.
|
|
477
|
+
(_d = this._table.sortControl) === null || _d === void 0 ? void 0 : _d.addControl(this._name, this._control);
|
|
478
|
+
// Get all the value changes.
|
|
479
|
+
this.valueChanges$ = this._control.valueChanges.pipe(startWith(this._control.value));
|
|
480
|
+
}
|
|
481
|
+
ngOnDestroy() {
|
|
482
|
+
var _a, _b, _c, _d, _e, _f;
|
|
483
|
+
(_b = (_a = this._table) === null || _a === void 0 ? void 0 : _a.setHeaderCount) === null || _b === void 0 ? void 0 : _b.call(_a, -1);
|
|
484
|
+
// Validate that the name and table are set.
|
|
485
|
+
if (!this._table || !this._name) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
// Un-register the header cell with the table.
|
|
489
|
+
if ((_d = (_c = this._table) === null || _c === void 0 ? void 0 : _c.sortControl) === null || _d === void 0 ? void 0 : _d.contains(this._name)) {
|
|
490
|
+
(_f = (_e = this._table) === null || _e === void 0 ? void 0 : _e.sortControl) === null || _f === void 0 ? void 0 : _f.removeControl(this._name);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
get isDisabled() {
|
|
494
|
+
return this.disabled || !this._name;
|
|
495
|
+
}
|
|
496
|
+
onClick() {
|
|
497
|
+
// Check if the header cell is disabled.
|
|
498
|
+
if (this.isDisabled) {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
// Find the index of the current sort and
|
|
502
|
+
// create the new index.
|
|
503
|
+
const index = this._sortDirections.findIndex(item => item === this._control.value);
|
|
504
|
+
const newIndex = (index + 1) % this._sortDirections.length;
|
|
505
|
+
const newSort = this._sortDirections[newIndex];
|
|
506
|
+
// Set the new sort.
|
|
507
|
+
return this.updateTableAndHeaderCell(newSort);
|
|
508
|
+
}
|
|
509
|
+
updateTableAndHeaderCell(value) {
|
|
510
|
+
// Check if the new value is a valid value.
|
|
511
|
+
if (!this._sortDirections.includes(value)) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
// Validate the table exists.
|
|
515
|
+
if (!this._table) {
|
|
516
|
+
return this._control.setValue(value);
|
|
517
|
+
}
|
|
518
|
+
// Handle the single sorting strategy.
|
|
519
|
+
if (this._table.sortingStrategy === 'single') {
|
|
520
|
+
return this.handleSingleSortingStrategy(value);
|
|
521
|
+
}
|
|
522
|
+
// Default case when no other strategy
|
|
523
|
+
// is used.
|
|
524
|
+
return this._control.setValue(value);
|
|
525
|
+
}
|
|
526
|
+
handleSingleSortingStrategy(value) {
|
|
527
|
+
var _a, _b;
|
|
528
|
+
// Get the sort control.
|
|
529
|
+
const control = this._table.sortControl;
|
|
530
|
+
// Set each value to false since we only want to
|
|
531
|
+
// sort on one property at a time with this strategy.
|
|
532
|
+
const newValue = Object.keys(control.controls).reduce((previous, current) => {
|
|
533
|
+
previous[current] = current === this._name ? value : 'none';
|
|
534
|
+
return previous;
|
|
535
|
+
}, {});
|
|
536
|
+
// Patch the entire sort value.
|
|
537
|
+
(_b = (_a = this._table) === null || _a === void 0 ? void 0 : _a.sortControl) === null || _b === void 0 ? void 0 : _b.patchValue(newValue);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
BbTableHeaderCell.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTableHeaderCell, deps: [{ token: BbTable, host: true, optional: true }, { token: 'name', attribute: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
541
|
+
BbTableHeaderCell.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbTableHeaderCell, selector: "bb-table-header-cell", inputs: { disabled: "disabled", sort: "sort" }, host: { listeners: { "click": "onClick()" }, properties: { "class.disabled": "isDisabled" }, classAttribute: "bb-table-header-cell" }, usesInheritance: true, ngImport: i0, template: "<!-- The content. -->\n<ng-content></ng-content>\n\n<!-- The indicator for the sort direction. -->\n<ng-container *ngIf=\"valueChanges$ | async as value\">\n <button *ngIf=\"!isDisabled\"\n [class.asc]=\"value === 'asc'\"\n [class.desc]=\"value === 'desc'\"\n class=\"bb-table-header-cell-toggle\"\n type=\"button\"></button>\n</ng-container>\n", styles: [".bb-table-header-cell{height:50px;color:#212529;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;padding:10px 20px;position:relative;display:table-cell;vertical-align:middle;border-bottom:1px solid #d8d8d8}.bb-table-header-cell:active>.bb-table-header-cell-toggle{background-color:#00000014}.bb-table-header-cell:not(.disabled){padding-right:52px}.bb-table-header-cell.fit{width:1%;white-space:nowrap}.bb-table-header-cell.left{text-align:left}.bb-table-header-cell.center{text-align:center}.bb-table-header-cell.right{text-align:right}.bb-table-header-cell.disabled{cursor:default;pointer-events:none}.bb-table-header-cell-toggle{top:50%;right:14px;width:22px;border:none;height:22px;margin-left:auto;position:absolute;border-radius:4px;transform:translateY(-50%);background-position:center;background-repeat:no-repeat;background-color:transparent;transition:background-color .2s cubic-bezier(0,0,.2,1);background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 9 15\" width=\"9\" height=\"15\"%3E%3Cpath fill=\"%23dcdcdc\" d=\"M4.5 0L0 7h9z\"%3E%3C/path%3E%3Cpath fill=\"%23dcdcdc\" d=\"M4.5 15L9 8H0z\"%3E%3C/path%3E%3C/svg%3E')}.bb-table-header-cell-toggle.desc{background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 9 15\" width=\"9\" height=\"15\"%3E%3Cpath fill=\"%23dcdcdc\" d=\"M4.5 0L0 7h9z\"%3E%3C/path%3E%3Cpath fill=\"black\" d=\"M4.5 15L9 8H0z\"%3E%3C/path%3E%3C/svg%3E')}.bb-table-header-cell-toggle.asc{background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 9 15\" width=\"9\" height=\"15\"%3E%3Cpath fill=\"black\" d=\"M4.5 0L0 7h9z\"%3E%3C/path%3E%3Cpath fill=\"%23dcdcdc\" d=\"M4.5 15L9 8H0z\"%3E%3C/path%3E%3C/svg%3E')}\n"], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
542
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTableHeaderCell, decorators: [{
|
|
543
|
+
type: Component,
|
|
544
|
+
args: [{ selector: 'bb-table-header-cell', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
545
|
+
'class': 'bb-table-header-cell',
|
|
546
|
+
'[class.disabled]': 'isDisabled'
|
|
547
|
+
}, inputs: ['disabled'], encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, template: "<!-- The content. -->\n<ng-content></ng-content>\n\n<!-- The indicator for the sort direction. -->\n<ng-container *ngIf=\"valueChanges$ | async as value\">\n <button *ngIf=\"!isDisabled\"\n [class.asc]=\"value === 'asc'\"\n [class.desc]=\"value === 'desc'\"\n class=\"bb-table-header-cell-toggle\"\n type=\"button\"></button>\n</ng-container>\n", styles: [".bb-table-header-cell{height:50px;color:#212529;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;padding:10px 20px;position:relative;display:table-cell;vertical-align:middle;border-bottom:1px solid #d8d8d8}.bb-table-header-cell:active>.bb-table-header-cell-toggle{background-color:#00000014}.bb-table-header-cell:not(.disabled){padding-right:52px}.bb-table-header-cell.fit{width:1%;white-space:nowrap}.bb-table-header-cell.left{text-align:left}.bb-table-header-cell.center{text-align:center}.bb-table-header-cell.right{text-align:right}.bb-table-header-cell.disabled{cursor:default;pointer-events:none}.bb-table-header-cell-toggle{top:50%;right:14px;width:22px;border:none;height:22px;margin-left:auto;position:absolute;border-radius:4px;transform:translateY(-50%);background-position:center;background-repeat:no-repeat;background-color:transparent;transition:background-color .2s cubic-bezier(0,0,.2,1);background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 9 15\" width=\"9\" height=\"15\"%3E%3Cpath fill=\"%23dcdcdc\" d=\"M4.5 0L0 7h9z\"%3E%3C/path%3E%3Cpath fill=\"%23dcdcdc\" d=\"M4.5 15L9 8H0z\"%3E%3C/path%3E%3C/svg%3E')}.bb-table-header-cell-toggle.desc{background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 9 15\" width=\"9\" height=\"15\"%3E%3Cpath fill=\"%23dcdcdc\" d=\"M4.5 0L0 7h9z\"%3E%3C/path%3E%3Cpath fill=\"black\" d=\"M4.5 15L9 8H0z\"%3E%3C/path%3E%3C/svg%3E')}.bb-table-header-cell-toggle.asc{background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 9 15\" width=\"9\" height=\"15\"%3E%3Cpath fill=\"black\" d=\"M4.5 0L0 7h9z\"%3E%3C/path%3E%3Cpath fill=\"%23dcdcdc\" d=\"M4.5 15L9 8H0z\"%3E%3C/path%3E%3C/svg%3E')}\n"] }]
|
|
548
|
+
}], ctorParameters: function () {
|
|
549
|
+
return [{ type: BbTable, decorators: [{
|
|
550
|
+
type: Optional
|
|
551
|
+
}, {
|
|
552
|
+
type: Host
|
|
553
|
+
}] }, { type: undefined, decorators: [{
|
|
554
|
+
type: Optional
|
|
555
|
+
}, {
|
|
556
|
+
type: Attribute,
|
|
557
|
+
args: ['name']
|
|
558
|
+
}] }];
|
|
559
|
+
}, propDecorators: { sort: [{
|
|
560
|
+
type: Input
|
|
561
|
+
}], onClick: [{
|
|
562
|
+
type: HostListener,
|
|
563
|
+
args: ['click']
|
|
564
|
+
}] } });
|
|
565
|
+
|
|
566
|
+
const DECLARATIONS_EXPORTS = [
|
|
567
|
+
BbTable,
|
|
568
|
+
BbTableColumnDef,
|
|
569
|
+
BbTableRowDef,
|
|
570
|
+
BbTableHeaderCell,
|
|
571
|
+
BbTableCell,
|
|
572
|
+
BbTablePager
|
|
573
|
+
];
|
|
574
|
+
class TableModule {
|
|
575
|
+
}
|
|
576
|
+
TableModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: TableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
577
|
+
TableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: TableModule, declarations: [BbTable,
|
|
578
|
+
BbTableColumnDef,
|
|
579
|
+
BbTableRowDef,
|
|
580
|
+
BbTableHeaderCell,
|
|
581
|
+
BbTableCell,
|
|
582
|
+
BbTablePager], imports: [CommonModule, ReactiveFormsModule, ElementsModule, LocalizeModule], exports: [BbTable,
|
|
583
|
+
BbTableColumnDef,
|
|
584
|
+
BbTableRowDef,
|
|
585
|
+
BbTableHeaderCell,
|
|
586
|
+
BbTableCell,
|
|
587
|
+
BbTablePager] });
|
|
588
|
+
TableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: TableModule, imports: [[CommonModule, ReactiveFormsModule, ElementsModule, LocalizeModule]] });
|
|
589
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: TableModule, decorators: [{
|
|
590
|
+
type: NgModule,
|
|
591
|
+
args: [{
|
|
592
|
+
imports: [CommonModule, ReactiveFormsModule, ElementsModule, LocalizeModule],
|
|
593
|
+
declarations: [...DECLARATIONS_EXPORTS],
|
|
594
|
+
exports: [...DECLARATIONS_EXPORTS]
|
|
595
|
+
}]
|
|
596
|
+
}] });
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Generated bundle index. Do not edit.
|
|
600
|
+
*/
|
|
601
|
+
|
|
602
|
+
export { BbTable, BbTableCell, BbTableColumnDef, BbTableHeaderCell, BbTablePager, BbTableRowDef, DataSource, DataSourceRequest, GenericDataSource, TableModule };
|
|
603
|
+
//# sourceMappingURL=bravobit-bb-foundation-table.mjs.map
|