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