@bravobit/bb-foundation 0.33.0 → 0.40.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.config.d.ts +5 -0
- package/auth/lib/auth.interceptor.d.ts +2 -2
- package/auth/lib/auth.module.d.ts +1 -4
- package/auth/lib/auth.service.d.ts +2 -2
- package/auth/lib/directives/authenticated.directive.d.ts +11 -4
- package/auth/lib/guards/anonymous.guard.d.ts +2 -15
- package/auth/lib/guards/authenticated.guard.d.ts +2 -15
- package/auth/lib/interfaces/config.interface.d.ts +2 -1
- package/auth/public_api.d.ts +1 -0
- package/collections/lib/collections.module.d.ts +12 -3
- package/collections/lib/components/collections-actions/collections-actions.component.d.ts +10 -0
- package/collections/lib/components/collections-grid/collections-grid.component.d.ts +18 -0
- package/collections/lib/components/collections-pager/collections-pager.component.d.ts +15 -14
- package/collections/lib/components/collections-table/collections-table.component.d.ts +24 -0
- package/collections/lib/components/collections-table-label/collections-table-label.component.d.ts +11 -0
- package/collections/lib/components/collections-table-sorting/collections-table-sorting.component.d.ts +18 -0
- package/collections/lib/components/collections-viewer/collections-viewer.component.d.ts +9 -5
- package/collections/lib/directives/collections-data-row.directive.d.ts +14 -0
- package/collections/lib/directives/collections-data.directive.d.ts +14 -0
- package/collections/lib/directives/collections-empty.directive.d.ts +14 -0
- package/collections/lib/directives/collections-error.directive.d.ts +14 -0
- package/collections/lib/directives/collections-initial.directive.d.ts +11 -0
- package/collections/lib/directives/collections-item.directive.d.ts +14 -0
- package/collections/public_api.d.ts +11 -1
- package/dashboard/lib/dashboard/dashboard.component.d.ts +5 -8
- package/dashboard/lib/dashboard-header/dashboard-header.component.d.ts +3 -5
- package/dashboard/lib/dashboard-menu/dashboard-menu.component.d.ts +1 -1
- package/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.d.ts +4 -7
- package/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.d.ts +3 -5
- package/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.d.ts +6 -11
- package/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.d.ts +2 -2
- package/dashboard/lib/dashboard.module.d.ts +1 -4
- package/dialog/lib/dialog-actions/dialog-actions.component.d.ts +1 -1
- package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +2 -2
- package/dialog/lib/dialog-container/dialog-container.component.d.ts +2 -2
- package/dialog/lib/dialog-header/dialog-header.component.d.ts +1 -1
- package/dialog/lib/dialog-link/dialog-link.component.d.ts +1 -1
- package/dialog/lib/dialog-modal/dialog-modal.component.d.ts +1 -1
- package/dialog/lib/dialog-overlay/dialog-overlay.component.d.ts +2 -2
- package/dialog/lib/dialog.config.d.ts +3 -0
- package/dialog/lib/dialog.insertion.d.ts +1 -1
- package/dialog/lib/dialog.interfaces.d.ts +2 -0
- package/dialog/lib/dialog.module.d.ts +2 -4
- package/dialog/lib/directives/confirm.directive.d.ts +13 -0
- package/dialog/public_api.d.ts +2 -0
- package/elements/lib/avatar/avatar.component.d.ts +2 -1
- package/elements/lib/button/button.component.d.ts +12 -14
- package/elements/lib/checkbox/checkbox.component.d.ts +29 -22
- package/elements/lib/checkbox-group/checkbox-group.component.d.ts +13 -0
- package/elements/lib/date-picker/date-picker.component.d.ts +17 -10
- package/elements/lib/directives/addon.directive.d.ts +2 -2
- package/elements/lib/directives/extra-error-controls.directive.d.ts +13 -0
- package/elements/lib/directives/form-submit.directive.d.ts +1 -1
- package/elements/lib/directives/form-submitter.directive.d.ts +1 -1
- package/elements/lib/directives/image-upload.directive.d.ts +1 -1
- package/elements/lib/directives/input.directive.d.ts +9 -31
- package/elements/lib/elements.config.d.ts +84 -0
- package/elements/lib/elements.module.d.ts +20 -102
- package/elements/lib/file-picker/file-picker.component.d.ts +14 -10
- package/elements/lib/form-control/form-control.component.d.ts +8 -9
- package/elements/lib/form-error/form-error.component.d.ts +12 -9
- package/elements/lib/form-group/form-group.component.d.ts +4 -7
- package/elements/lib/icon/icon.component.d.ts +4 -4
- package/elements/lib/image-picker/image-picker.component.d.ts +9 -9
- package/elements/lib/multi-file-control/multi-file-control.component.d.ts +58 -0
- package/elements/lib/pipes/date.pipe.d.ts +9 -0
- package/elements/lib/pipes/file-image.pipe.d.ts +1 -1
- package/elements/lib/pipes/file-size.pipe.d.ts +1 -1
- package/elements/lib/pipes/relative-time.pipe.d.ts +1 -1
- package/elements/lib/radio-button/radio-button.component.d.ts +18 -0
- package/elements/lib/radio-group/radio-group.component.d.ts +38 -0
- package/elements/lib/spinner/spinner.component.d.ts +4 -7
- package/elements/public_api.d.ts +8 -3
- package/esm2022/auth/lib/auth.config.mjs +16 -0
- package/esm2022/auth/lib/auth.interceptor.mjs +10 -7
- package/esm2022/auth/lib/auth.module.mjs +9 -19
- package/esm2022/auth/lib/auth.service.mjs +22 -13
- package/esm2022/auth/lib/directives/authenticated.directive.mjs +45 -11
- package/esm2022/auth/lib/guards/anonymous.guard.mjs +27 -51
- package/esm2022/auth/lib/guards/authenticated.guard.mjs +30 -54
- package/esm2022/auth/lib/helpers/jwt.helper.mjs +2 -2
- package/esm2022/auth/lib/interfaces/config.interface.mjs +2 -3
- package/esm2022/auth/public_api.mjs +2 -1
- package/esm2022/collections/lib/collections.module.mjs +53 -23
- package/esm2022/collections/lib/components/collections-actions/collections-actions.component.mjs +39 -0
- package/esm2022/collections/lib/components/collections-grid/collections-grid.component.mjs +52 -0
- package/esm2022/collections/lib/components/collections-pager/collections-pager.component.mjs +51 -60
- package/esm2022/collections/lib/components/collections-table/collections-table.component.mjs +86 -0
- package/esm2022/collections/lib/components/collections-table-label/collections-table-label.component.mjs +33 -0
- package/esm2022/collections/lib/components/collections-table-sorting/collections-table-sorting.component.mjs +62 -0
- package/esm2022/collections/lib/components/collections-viewer/collections-viewer.component.mjs +10 -7
- package/esm2022/collections/lib/directives/collections-data-row.directive.mjs +26 -0
- package/esm2022/collections/lib/directives/collections-data.directive.mjs +26 -0
- package/esm2022/collections/lib/directives/collections-empty.directive.mjs +26 -0
- package/esm2022/collections/lib/directives/collections-error.directive.mjs +26 -0
- package/esm2022/collections/lib/directives/collections-initial.directive.mjs +22 -0
- package/esm2022/collections/lib/directives/collections-item.directive.mjs +26 -0
- package/esm2022/collections/public_api.mjs +12 -2
- package/esm2022/combobox/combobox/combobox-container.directive.mjs +3 -3
- package/esm2022/combobox/combobox/combobox.component.mjs +6 -6
- package/esm2022/combobox/combobox-label.directive.mjs +3 -3
- package/esm2022/combobox/combobox-option.directive.mjs +3 -3
- package/esm2022/combobox/combobox-panel/combobox-panel.component.mjs +5 -5
- package/esm2022/dashboard/lib/dashboard/dashboard.component.mjs +17 -24
- package/esm2022/dashboard/lib/dashboard-header/dashboard-header.component.mjs +12 -15
- package/esm2022/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +7 -8
- package/esm2022/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +20 -15
- package/esm2022/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +15 -14
- package/esm2022/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +20 -27
- package/esm2022/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +6 -10
- package/esm2022/dashboard/lib/dashboard.module.mjs +30 -27
- package/esm2022/dialog/lib/dialog-actions/dialog-actions.component.mjs +6 -6
- package/esm2022/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +12 -15
- package/esm2022/dialog/lib/dialog-container/dialog-container.component.mjs +10 -7
- package/esm2022/dialog/lib/dialog-header/dialog-header.component.mjs +5 -6
- package/esm2022/dialog/lib/dialog-link/dialog-link.component.mjs +5 -5
- package/esm2022/dialog/lib/dialog-modal/dialog-modal.component.mjs +7 -7
- package/esm2022/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +11 -7
- package/esm2022/dialog/lib/dialog.config.mjs +8 -0
- package/esm2022/dialog/lib/dialog.insertion.mjs +6 -5
- package/esm2022/dialog/lib/dialog.interfaces.mjs +3 -1
- package/esm2022/dialog/lib/dialog.module.mjs +17 -25
- package/esm2022/dialog/lib/dialog.service.mjs +8 -5
- package/esm2022/dialog/lib/directives/confirm.directive.mjs +50 -0
- package/esm2022/dialog/public_api.mjs +3 -1
- package/esm2022/elements/lib/avatar/avatar.component.mjs +15 -14
- package/esm2022/elements/lib/button/button.component.mjs +37 -32
- package/esm2022/elements/lib/checkbox/checkbox.component.mjs +86 -47
- package/esm2022/elements/lib/checkbox-group/checkbox-group.component.mjs +36 -0
- package/esm2022/elements/lib/date-picker/date-picker.component.mjs +64 -51
- package/esm2022/elements/lib/directives/addon.directive.mjs +11 -13
- package/esm2022/elements/lib/directives/extra-error-controls.directive.mjs +43 -0
- package/esm2022/elements/lib/directives/form-submit.directive.mjs +6 -5
- package/esm2022/elements/lib/directives/form-submitter.directive.mjs +6 -5
- package/esm2022/elements/lib/directives/image-upload.directive.mjs +6 -5
- package/esm2022/elements/lib/directives/input.directive.mjs +21 -110
- package/esm2022/elements/lib/elements.config.mjs +42 -0
- package/esm2022/elements/lib/elements.module.mjs +38 -77
- package/esm2022/elements/lib/file-picker/file-picker.component.mjs +36 -24
- package/esm2022/elements/lib/form-control/form-control.component.mjs +21 -24
- package/esm2022/elements/lib/form-error/form-error.component.mjs +35 -60
- package/esm2022/elements/lib/form-group/form-group.component.mjs +15 -12
- package/esm2022/elements/lib/icon/icon.component.mjs +19 -24
- package/esm2022/elements/lib/image-picker/image-picker.component.mjs +33 -19
- package/esm2022/elements/lib/multi-file-control/multi-file-control.component.mjs +165 -0
- package/esm2022/elements/lib/pipes/date.pipe.mjs +30 -0
- package/esm2022/elements/lib/pipes/file-image.pipe.mjs +6 -5
- package/esm2022/elements/lib/pipes/file-size.pipe.mjs +6 -5
- package/esm2022/elements/lib/pipes/relative-time.pipe.mjs +6 -5
- package/esm2022/elements/lib/radio-button/radio-button.component.mjs +59 -0
- package/esm2022/elements/lib/radio-group/radio-group.component.mjs +102 -0
- package/esm2022/elements/lib/spinner/spinner.component.mjs +12 -13
- package/esm2022/elements/public_api.mjs +9 -4
- package/esm2022/http/lib/http.config.mjs +18 -0
- package/esm2022/http/lib/http.interfaces.mjs +4 -2
- package/esm2022/http/lib/http.module.mjs +9 -22
- package/esm2022/http/lib/interceptors/base-url.interceptor.mjs +9 -5
- package/esm2022/http/lib/interceptors/error.interceptor.mjs +10 -6
- package/esm2022/http/public_api.mjs +2 -1
- package/esm2022/lib/core/miscellaneous/coercion.mjs +5 -0
- package/esm2022/lib/core/services/exif.service.mjs +3 -3
- package/esm2022/lib/core/services/file-loader.service.mjs +3 -3
- package/esm2022/lib/core/services/files.service.mjs +3 -3
- package/esm2022/lib/core/services/image-converter.service.mjs +3 -3
- package/esm2022/lib/core/services/languages.service.mjs +3 -3
- package/esm2022/lib/core/services/network.service.mjs +3 -3
- package/esm2022/lib/core/services/patch.service.mjs +3 -3
- package/esm2022/localize/lib/interfaces/config.interfaces.mjs +2 -7
- package/esm2022/localize/lib/interfaces/functions.interfaces.mjs +6 -6
- package/esm2022/localize/lib/localizations/dutch.localization.mjs +19 -1
- package/esm2022/localize/lib/localizations/english.localization.mjs +19 -1
- package/esm2022/localize/lib/localize.config.mjs +43 -0
- package/esm2022/localize/lib/localize.module.mjs +10 -54
- package/esm2022/localize/lib/localize.pipe.mjs +6 -5
- package/esm2022/localize/lib/localize.service.mjs +26 -13
- package/esm2022/localize/lib/localize.tokens.mjs +18 -0
- package/esm2022/localize/lib/transforms/interpolate.transform.mjs +3 -2
- package/esm2022/localize/lib/transforms/plural.transform.mjs +5 -3
- package/esm2022/localize/lib/transforms/reference.transform.mjs +5 -3
- package/esm2022/localize/lib/views/localize-string/localize-string.component.mjs +6 -10
- package/esm2022/localize/lib/views/localize-template.directive.mjs +6 -5
- package/esm2022/localize/public_api.mjs +3 -3
- package/esm2022/masking/lib/directives/currency-mask.directive.mjs +6 -5
- package/esm2022/masking/lib/directives/date-mask.directive.mjs +6 -5
- package/esm2022/masking/lib/directives/input-mask.directive.mjs +6 -5
- package/esm2022/masking/lib/masking.module.mjs +6 -6
- package/esm2022/masking/lib/masking.service.mjs +3 -3
- package/esm2022/notifications/lib/notifications-item/notifications-item.component.mjs +7 -9
- package/esm2022/notifications/lib/notifications-list/notifications-list.component.mjs +8 -8
- package/esm2022/notifications/lib/notifications.config.mjs +8 -0
- package/esm2022/notifications/lib/notifications.interfaces.mjs +3 -1
- package/esm2022/notifications/lib/notifications.module.mjs +8 -18
- package/esm2022/notifications/lib/notifications.service.mjs +14 -8
- package/esm2022/notifications/public_api.mjs +2 -1
- package/esm2022/permissions/lib/directives/permission.directive.mjs +6 -5
- package/esm2022/permissions/lib/guards/permission.guard.mjs +23 -54
- package/esm2022/permissions/lib/permissions.config.mjs +20 -0
- package/esm2022/permissions/lib/permissions.interface.mjs +3 -1
- package/esm2022/permissions/lib/permissions.module.mjs +9 -23
- package/esm2022/permissions/lib/permissions.service.mjs +8 -5
- package/esm2022/permissions/public_api.mjs +2 -1
- package/esm2022/public_api.mjs +2 -10
- package/esm2022/recaptcha/lib/recaptcha/recaptcha.component.mjs +12 -13
- package/esm2022/recaptcha/lib/recaptcha-loader.service.mjs +21 -36
- package/esm2022/recaptcha/lib/recaptcha.config.mjs +8 -0
- package/esm2022/recaptcha/lib/recaptcha.module.mjs +8 -8
- package/esm2022/recaptcha/public_api.mjs +2 -1
- package/esm2022/select/bravobit-bb-foundation-select.mjs +5 -0
- package/esm2022/select/lib/select/select.component.mjs +214 -0
- package/esm2022/select/lib/select-label.directive.mjs +17 -0
- package/esm2022/select/lib/select-option-group.directive.mjs +17 -0
- package/esm2022/select/lib/select-option.directive.mjs +17 -0
- package/esm2022/select/lib/select.module.mjs +35 -0
- package/esm2022/select/public_api.mjs +6 -0
- package/esm2022/storage/lib/storage.service.mjs +3 -3
- package/esm2022/storage/lib/strategies/polyfill-storage.strategy.mjs +2 -5
- package/esm2022/table/lib/components/table/table.component.mjs +21 -22
- package/esm2022/table/lib/components/table-cell/table-cell.component.mjs +5 -5
- package/esm2022/table/lib/components/table-header-cell/table-header-cell.component.mjs +14 -14
- package/esm2022/table/lib/components/table-pager/table-pager.component.mjs +15 -17
- package/esm2022/table/lib/table.module.mjs +23 -21
- package/esm2022/tooltip/lib/tooltip-container/tooltip-container.component.mjs +11 -17
- package/esm2022/tooltip/lib/tooltip.directive.mjs +17 -27
- package/esm2022/tooltip/lib/tooltip.module.mjs +7 -22
- package/esm2022/tooltip/public_api.mjs +2 -2
- package/esm2022/utils/lib/directives/autosize.directive.mjs +9 -7
- package/esm2022/utils/lib/directives/focus-trap.directive.mjs +6 -5
- package/esm2022/utils/lib/directives/focus.directive.mjs +6 -5
- package/esm2022/utils/lib/directives/template.directive.mjs +6 -5
- package/esm2022/utils/lib/utils.module.mjs +6 -6
- package/fesm2022/bravobit-bb-foundation-auth.mjs +140 -175
- package/fesm2022/bravobit-bb-foundation-auth.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-collections.mjs +451 -106
- package/fesm2022/bravobit-bb-foundation-collections.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-combobox.mjs +18 -18
- package/fesm2022/bravobit-bb-foundation-combobox.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dashboard.mjs +106 -116
- package/fesm2022/bravobit-bb-foundation-dashboard.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dialog.mjs +125 -70
- package/fesm2022/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-elements.mjs +1652 -1378
- package/fesm2022/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-http.mjs +38 -27
- package/fesm2022/bravobit-bb-foundation-http.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-localize.mjs +310 -264
- package/fesm2022/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-masking.mjs +23 -20
- package/fesm2022/bravobit-bb-foundation-masking.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-notifications.mjs +67 -62
- package/fesm2022/bravobit-bb-foundation-notifications.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-permissions.mjs +54 -72
- package/fesm2022/bravobit-bb-foundation-permissions.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs +44 -54
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-select.mjs +292 -0
- package/fesm2022/bravobit-bb-foundation-select.mjs.map +1 -0
- package/fesm2022/bravobit-bb-foundation-storage.mjs +4 -7
- package/fesm2022/bravobit-bb-foundation-storage.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-table.mjs +67 -66
- package/fesm2022/bravobit-bb-foundation-table.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-tooltip.mjs +31 -61
- package/fesm2022/bravobit-bb-foundation-tooltip.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-utils.mjs +28 -23
- package/fesm2022/bravobit-bb-foundation-utils.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation.mjs +27 -144
- package/fesm2022/bravobit-bb-foundation.mjs.map +1 -1
- package/http/lib/http.config.d.ts +5 -0
- package/http/lib/http.interfaces.d.ts +3 -0
- package/http/lib/http.module.d.ts +2 -6
- package/http/public_api.d.ts +1 -0
- package/lib/core/miscellaneous/coercion.d.ts +2 -0
- package/localize/lib/interfaces/config.interfaces.d.ts +1 -1
- package/localize/lib/interfaces/functions.interfaces.d.ts +0 -2
- package/localize/lib/localizations/dutch.localization.d.ts +18 -0
- package/localize/lib/localizations/english.localization.d.ts +18 -0
- package/localize/lib/localize.config.d.ts +6 -0
- package/localize/lib/localize.module.d.ts +2 -7
- package/localize/lib/localize.pipe.d.ts +1 -1
- package/localize/lib/localize.service.d.ts +4 -4
- package/localize/lib/localize.tokens.d.ts +11 -0
- package/localize/lib/views/localize-string/localize-string.component.d.ts +1 -1
- package/localize/lib/views/localize-template.directive.d.ts +1 -1
- package/localize/public_api.d.ts +2 -2
- package/masking/lib/directives/currency-mask.directive.d.ts +1 -1
- package/masking/lib/directives/date-mask.directive.d.ts +1 -1
- package/masking/lib/directives/input-mask.directive.d.ts +1 -1
- package/masking/lib/masking.module.d.ts +1 -1
- package/notifications/lib/notifications-item/notifications-item.component.d.ts +1 -1
- package/notifications/lib/notifications-list/notifications-list.component.d.ts +1 -1
- package/notifications/lib/notifications.config.d.ts +3 -0
- package/notifications/lib/notifications.interfaces.d.ts +2 -1
- package/notifications/lib/notifications.module.d.ts +1 -5
- package/notifications/public_api.d.ts +1 -0
- package/package.json +17 -22
- package/permissions/lib/directives/permission.directive.d.ts +1 -1
- package/permissions/lib/guards/permission.guard.d.ts +3 -15
- package/permissions/lib/permissions.config.d.ts +3 -0
- package/permissions/lib/permissions.interface.d.ts +2 -1
- package/permissions/lib/permissions.module.d.ts +1 -1
- package/permissions/public_api.d.ts +1 -0
- package/public_api.d.ts +1 -9
- package/recaptcha/lib/recaptcha/recaptcha.component.d.ts +4 -7
- package/recaptcha/lib/recaptcha-loader.service.d.ts +9 -13
- package/recaptcha/lib/recaptcha.config.d.ts +3 -0
- package/recaptcha/lib/recaptcha.module.d.ts +2 -2
- package/recaptcha/public_api.d.ts +1 -0
- package/{theming → select}/index.d.ts +1 -1
- package/select/lib/select/select.component.d.ts +77 -0
- package/select/lib/select-label.directive.d.ts +8 -0
- package/select/lib/select-option-group.directive.d.ts +8 -0
- package/select/lib/select-option.directive.d.ts +8 -0
- package/select/lib/select.module.d.ts +10 -0
- package/select/public_api.d.ts +5 -0
- package/styles/colors.scss +20 -0
- package/styles/grid.scss +98 -0
- package/styles/reset.scss +65 -0
- package/styles/theme.scss +88 -0
- package/table/lib/components/table/table.component.d.ts +4 -6
- package/table/lib/components/table-cell/table-cell.component.d.ts +1 -1
- package/table/lib/components/table-header-cell/table-header-cell.component.d.ts +4 -7
- package/table/lib/components/table-pager/table-pager.component.d.ts +4 -8
- package/table/lib/table.module.d.ts +1 -5
- package/tooltip/lib/tooltip-container/tooltip-container.component.d.ts +3 -4
- package/tooltip/lib/tooltip.directive.d.ts +8 -17
- package/tooltip/lib/tooltip.module.d.ts +2 -5
- package/tooltip/public_api.d.ts +1 -1
- package/utils/lib/directives/autosize.directive.d.ts +2 -1
- package/utils/lib/directives/focus-trap.directive.d.ts +1 -1
- package/utils/lib/directives/focus.directive.d.ts +1 -1
- package/utils/lib/directives/template.directive.d.ts +1 -1
- package/utils/lib/utils.module.d.ts +1 -1
- package/auth/lib/directives/abstract.directive.d.ts +0 -12
- package/collections/lib/components/collections.directive.d.ts +0 -17
- package/controls/index.d.ts +0 -5
- package/controls/lib/checkbox/checkbox/checkbox.component.d.ts +0 -51
- package/controls/lib/checkbox/checkbox-group/checkbox-group.component.d.ts +0 -23
- package/controls/lib/checkbox/checkbox.module.d.ts +0 -10
- package/controls/lib/control-error/control-error/control-error.animation.d.ts +0 -1
- package/controls/lib/control-error/control-error/control-error.component.d.ts +0 -17
- package/controls/lib/control-error/control-error-submit.directive.d.ts +0 -15
- package/controls/lib/control-error/control-error.defaults.d.ts +0 -2
- package/controls/lib/control-error/control-error.interface.d.ts +0 -12
- package/controls/lib/control-error/control-error.module.d.ts +0 -9
- package/controls/lib/control-error/control-error.utils.d.ts +0 -3
- package/controls/lib/controls.interfaces.d.ts +0 -4
- package/controls/lib/controls.module.d.ts +0 -14
- package/controls/lib/form-control/form-control/form-control.component.d.ts +0 -29
- package/controls/lib/form-control/form-control-addon/form-control-addon.component.d.ts +0 -6
- package/controls/lib/form-control/form-control-input.directive.d.ts +0 -35
- package/controls/lib/form-control/form-control.module.d.ts +0 -12
- package/controls/lib/radio/radio-button/radio-button.component.d.ts +0 -24
- package/controls/lib/radio/radio-group/radio-group.component.d.ts +0 -53
- package/controls/lib/radio/radio.module.d.ts +0 -11
- package/controls/lib/toggle/toggle/toggle.component.d.ts +0 -45
- package/controls/lib/toggle/toggle-group/toggle-group.component.d.ts +0 -23
- package/controls/lib/toggle/toggle.module.d.ts +0 -10
- package/controls/public_api.d.ts +0 -20
- package/elements/lib/dropdown/dropdown.component.d.ts +0 -21
- package/elements/lib/tag/tag.component.d.ts +0 -7
- package/esm2022/auth/lib/directives/abstract.directive.mjs +0 -40
- package/esm2022/collections/lib/components/collections.directive.mjs +0 -43
- package/esm2022/controls/bravobit-bb-foundation-controls.mjs +0 -5
- package/esm2022/controls/lib/checkbox/checkbox/checkbox.component.mjs +0 -178
- package/esm2022/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +0 -68
- package/esm2022/controls/lib/checkbox/checkbox.module.mjs +0 -20
- package/esm2022/controls/lib/control-error/control-error/control-error.animation.mjs +0 -14
- package/esm2022/controls/lib/control-error/control-error/control-error.component.mjs +0 -63
- package/esm2022/controls/lib/control-error/control-error-submit.directive.mjs +0 -47
- package/esm2022/controls/lib/control-error/control-error.defaults.mjs +0 -26
- package/esm2022/controls/lib/control-error/control-error.interface.mjs +0 -3
- package/esm2022/controls/lib/control-error/control-error.module.mjs +0 -19
- package/esm2022/controls/lib/control-error/control-error.utils.mjs +0 -20
- package/esm2022/controls/lib/controls.interfaces.mjs +0 -2
- package/esm2022/controls/lib/controls.module.mjs +0 -62
- package/esm2022/controls/lib/form-control/form-control/form-control.component.mjs +0 -79
- package/esm2022/controls/lib/form-control/form-control-addon/form-control-addon.component.mjs +0 -22
- package/esm2022/controls/lib/form-control/form-control-input.directive.mjs +0 -124
- package/esm2022/controls/lib/form-control/form-control.module.mjs +0 -34
- package/esm2022/controls/lib/radio/radio-button/radio-button.component.mjs +0 -75
- package/esm2022/controls/lib/radio/radio-group/radio-group.component.mjs +0 -168
- package/esm2022/controls/lib/radio/radio.module.mjs +0 -21
- package/esm2022/controls/lib/toggle/toggle/toggle.component.mjs +0 -153
- package/esm2022/controls/lib/toggle/toggle-group/toggle-group.component.mjs +0 -62
- package/esm2022/controls/lib/toggle/toggle.module.mjs +0 -20
- package/esm2022/controls/public_api.mjs +0 -21
- package/esm2022/elements/lib/dropdown/dropdown.component.mjs +0 -100
- package/esm2022/elements/lib/tag/tag.component.mjs +0 -18
- package/esm2022/lib/core/mixins/can-disable.mjs +0 -16
- package/esm2022/lib/core/mixins/can-hide-errors.mjs +0 -16
- package/esm2022/lib/core/mixins/can-load.mjs +0 -16
- package/esm2022/lib/core/mixins/constructor.mjs +0 -2
- package/esm2022/lib/core/mixins/has-error.mjs +0 -16
- package/esm2022/lib/core/mixins/is-focused.mjs +0 -16
- package/esm2022/lib/core/mixins/is-grouped.mjs +0 -16
- package/esm2022/lib/core/mixins/is-readonly.mjs +0 -16
- package/esm2022/lib/core/mixins/is-required.mjs +0 -16
- package/esm2022/localize/lib/interfaces/transforms.interfaces.mjs +0 -3
- package/esm2022/localize/lib/locale.token.mjs +0 -14
- package/esm2022/theming/bravobit-bb-foundation-theming.mjs +0 -5
- package/esm2022/theming/lib/themes/checkbox-group.theme.mjs +0 -17
- package/esm2022/theming/lib/themes/checkbox.theme.mjs +0 -35
- package/esm2022/theming/lib/themes/control-error.theme.mjs +0 -11
- package/esm2022/theming/lib/themes/form-control-addon.theme.mjs +0 -6
- package/esm2022/theming/lib/themes/form-control.theme.mjs +0 -45
- package/esm2022/theming/lib/themes/radio-button.theme.mjs +0 -29
- package/esm2022/theming/lib/themes/radio-group.theme.mjs +0 -20
- package/esm2022/theming/lib/themes/toggle-group.theme.mjs +0 -17
- package/esm2022/theming/lib/themes/toggle.theme.mjs +0 -28
- package/esm2022/theming/lib/theming.data.mjs +0 -90
- package/esm2022/theming/lib/theming.directive.mjs +0 -38
- package/esm2022/theming/lib/theming.interface.mjs +0 -2
- package/esm2022/theming/lib/theming.module.mjs +0 -16
- package/esm2022/theming/lib/utils/theming.variable.mjs +0 -41
- package/esm2022/theming/public_api.mjs +0 -10
- package/fesm2022/bravobit-bb-foundation-controls.mjs +0 -1191
- package/fesm2022/bravobit-bb-foundation-controls.mjs.map +0 -1
- package/fesm2022/bravobit-bb-foundation-theming.mjs +0 -381
- package/fesm2022/bravobit-bb-foundation-theming.mjs.map +0 -1
- package/lib/core/mixins/can-disable.d.ts +0 -6
- package/lib/core/mixins/can-hide-errors.d.ts +0 -6
- package/lib/core/mixins/can-load.d.ts +0 -6
- package/lib/core/mixins/constructor.d.ts +0 -1
- package/lib/core/mixins/has-error.d.ts +0 -6
- package/lib/core/mixins/is-focused.d.ts +0 -6
- package/lib/core/mixins/is-grouped.d.ts +0 -6
- package/lib/core/mixins/is-readonly.d.ts +0 -6
- package/lib/core/mixins/is-required.d.ts +0 -6
- package/localize/lib/interfaces/transforms.interfaces.d.ts +0 -3
- package/localize/lib/locale.token.d.ts +0 -3
- package/theming/lib/themes/checkbox-group.theme.d.ts +0 -16
- package/theming/lib/themes/checkbox.theme.d.ts +0 -32
- package/theming/lib/themes/control-error.theme.d.ts +0 -9
- package/theming/lib/themes/form-control-addon.theme.d.ts +0 -5
- package/theming/lib/themes/form-control.theme.d.ts +0 -32
- package/theming/lib/themes/radio-button.theme.d.ts +0 -26
- package/theming/lib/themes/radio-group.theme.d.ts +0 -17
- package/theming/lib/themes/toggle-group.theme.d.ts +0 -16
- package/theming/lib/themes/toggle.theme.d.ts +0 -25
- package/theming/lib/theming.data.d.ts +0 -17
- package/theming/lib/theming.directive.d.ts +0 -13
- package/theming/lib/theming.interface.d.ts +0 -34
- package/theming/lib/theming.module.d.ts +0 -7
- package/theming/lib/utils/theming.variable.d.ts +0 -16
- package/theming/public_api.d.ts +0 -9
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { InjectionToken, Optional, Inject, Directive, Input, Component, ChangeDetectionStrategy, ViewEncapsulation, ContentChildren, Injectable, inject, LOCALE_ID, Pipe, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
3
|
-
import * as i1 from '@angular/common';
|
|
4
|
-
import { formatDate, DOCUMENT, CommonModule } from '@angular/common';
|
|
1
|
+
import { formatDate, DOCUMENT } from '@angular/common';
|
|
5
2
|
import { __decorate, __param } from 'tslib';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import * as i2$1 from '@bravobit/bb-foundation';
|
|
3
|
+
import { map, distinctUntilChanged, startWith } from 'rxjs/operators';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { Injectable, Optional, Inject, InjectionToken, inject, LOCALE_ID, Directive, Input, Component, ChangeDetectionStrategy, ViewEncapsulation, ContentChildren, Pipe, APP_INITIALIZER, makeEnvironmentProviders, NgModule } from '@angular/core';
|
|
6
|
+
import * as i2 from '@bravobit/bb-foundation';
|
|
11
7
|
import { WINDOW } from '@bravobit/bb-foundation';
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// The configuration that can be passed when
|
|
16
|
-
// the user initializes the localize module.
|
|
17
|
-
//
|
|
18
|
-
class LocalizeConfig {
|
|
19
|
-
}
|
|
8
|
+
import { BehaviorSubject, of, Subscription } from 'rxjs';
|
|
9
|
+
import * as i1 from '@bravobit/bb-foundation/storage';
|
|
10
|
+
import { BbTemplate } from '@bravobit/bb-foundation/utils';
|
|
20
11
|
|
|
21
12
|
//
|
|
22
13
|
// These are the options that the user has
|
|
@@ -24,13 +15,11 @@ class LocalizeConfig {
|
|
|
24
15
|
//
|
|
25
16
|
|
|
26
17
|
//
|
|
27
|
-
// This is the
|
|
28
|
-
//
|
|
29
|
-
//
|
|
18
|
+
// This is the interface that handles the localize functions.
|
|
19
|
+
// every localize function needs to conform to this interface.
|
|
20
|
+
// The interface allows the user to transform a token into
|
|
21
|
+
// another value.
|
|
30
22
|
//
|
|
31
|
-
const LOCALIZE_FUNCTION = new InjectionToken('localize_function');
|
|
32
|
-
|
|
33
|
-
const LOCALIZE_TRANSFORM = new InjectionToken('localize_transform');
|
|
34
23
|
|
|
35
24
|
//
|
|
36
25
|
// This function transform the value
|
|
@@ -95,6 +84,24 @@ const extraEnglishDictionary = {
|
|
|
95
84
|
'minlength': 'Expected a minimum of {{requiredLength}} characters but got {{actualLength}} characters.',
|
|
96
85
|
'maxlength': 'Expected a maximum of {{requiredLength}} characters but got {{actualLength}} characters.'
|
|
97
86
|
},
|
|
87
|
+
'select': {
|
|
88
|
+
'not_found_text': 'No items found',
|
|
89
|
+
'clear_all_text': 'Clear all',
|
|
90
|
+
'loading_text': 'Loading...',
|
|
91
|
+
'type_to_search_text': 'Typ to search',
|
|
92
|
+
'add_tag_text': 'Add tag'
|
|
93
|
+
},
|
|
94
|
+
'multi-file-control': {
|
|
95
|
+
'choose_file': 'Choose a file',
|
|
96
|
+
'choose_file_text': '@element(label) or drag and drop files here'
|
|
97
|
+
},
|
|
98
|
+
'collection': {
|
|
99
|
+
'search_label': 'Search...',
|
|
100
|
+
'showing_label': 'Showing @element(start) to @element(end) of @element(total) results',
|
|
101
|
+
'no_results_label': 'There are no results for @element(query). Try a different search term to find results...',
|
|
102
|
+
'empty_label': 'There are no results...',
|
|
103
|
+
'error_label': 'It seems that an error occurred while using the application.'
|
|
104
|
+
},
|
|
98
105
|
'tables': {
|
|
99
106
|
'search': 'Search...',
|
|
100
107
|
'loading': 'Loading...',
|
|
@@ -140,6 +147,24 @@ const extraDutchDictionary = {
|
|
|
140
147
|
'minlength': 'Verwachtte minimaal {{requiredLength}} tekens, maar kreeg {{actualLength}} tekens.',
|
|
141
148
|
'maxlength': 'Verwachtte maximaal {{requiredLength}} tekens, maar kreeg {{actualLength}} tekens.'
|
|
142
149
|
},
|
|
150
|
+
'select': {
|
|
151
|
+
'not_found_text': 'Geen items gevonden',
|
|
152
|
+
'clear_all_text': 'Wis alles',
|
|
153
|
+
'loading_text': 'Aan het laden...',
|
|
154
|
+
'type_to_search_text': 'Typ om te zoeken',
|
|
155
|
+
'add_tag_text': 'Tag toevoegen'
|
|
156
|
+
},
|
|
157
|
+
'multi-file-control': {
|
|
158
|
+
'choose_file': 'Kies een bestand',
|
|
159
|
+
'choose_file_text': '@element(label) of sleep de bestanden hiernaartoe'
|
|
160
|
+
},
|
|
161
|
+
'collection': {
|
|
162
|
+
'search_label': 'Zoeken...',
|
|
163
|
+
'showing_label': 'Toont @element(start) tot @element(end) van @element(total) resultaten',
|
|
164
|
+
'no_results_label': 'Er zijn geen resultaten voor @element(query). Probeer een andere zoekterm om resultaten te vinden...',
|
|
165
|
+
'empty_label': 'Er zijn geen resultaten...',
|
|
166
|
+
'error_label': 'Het lijkt erop dat een fout is opgetreden tijdens het gebruiken van de applicatie.'
|
|
167
|
+
},
|
|
143
168
|
'tables': {
|
|
144
169
|
'search': 'Zoeken...',
|
|
145
170
|
'loading': 'Aan het laden...',
|
|
@@ -331,6 +356,208 @@ class LocalizeTransform {
|
|
|
331
356
|
}
|
|
332
357
|
}
|
|
333
358
|
|
|
359
|
+
class Localize {
|
|
360
|
+
constructor(_storage, _languages, _window, _document, _config, _transforms, _missingHandler) {
|
|
361
|
+
this._storage = _storage;
|
|
362
|
+
this._languages = _languages;
|
|
363
|
+
this._window = _window;
|
|
364
|
+
this._document = _document;
|
|
365
|
+
this._config = _config;
|
|
366
|
+
this._transforms = _transforms;
|
|
367
|
+
this._missingHandler = _missingHandler;
|
|
368
|
+
// Readonly data.
|
|
369
|
+
this._storageToken = this._config?.storageToken ?? 'bb-language-dictionary-id';
|
|
370
|
+
this._availableLanguages = this?._config?.languages ?? [];
|
|
371
|
+
this._bestMatchingLanguage = this.retrieveBestMatchingLanguage();
|
|
372
|
+
this._loadedDictionaries = new Map();
|
|
373
|
+
// Current dictionary.
|
|
374
|
+
this._current$ = new BehaviorSubject(null);
|
|
375
|
+
// State changes.
|
|
376
|
+
this.dictionaryChanges$ = this._current$.asObservable();
|
|
377
|
+
this.convertToParams = (tokenOrParams) => {
|
|
378
|
+
if (typeof tokenOrParams !== 'string') {
|
|
379
|
+
// Destruct the params from the object.
|
|
380
|
+
const { token, optional, dictionary, data } = tokenOrParams;
|
|
381
|
+
// Make sure all parameters are valid
|
|
382
|
+
// by type safe adding them.
|
|
383
|
+
return { token: token, optional: optional ?? false, dictionary: dictionary ?? null, data: data ?? {} };
|
|
384
|
+
}
|
|
385
|
+
// If the parameter is a string fill in the blanks.
|
|
386
|
+
return { token: tokenOrParams, optional: false, dictionary: null, data: {} };
|
|
387
|
+
};
|
|
388
|
+
this.renderDocumentLanguage();
|
|
389
|
+
}
|
|
390
|
+
get languages() {
|
|
391
|
+
return this._availableLanguages ?? [];
|
|
392
|
+
}
|
|
393
|
+
get current() {
|
|
394
|
+
return this._current$.getValue();
|
|
395
|
+
}
|
|
396
|
+
async load(id) {
|
|
397
|
+
if (id === null || id === undefined) {
|
|
398
|
+
throw new Error(`Cannot load language with id: "${id}".`);
|
|
399
|
+
}
|
|
400
|
+
if (this._loadedDictionaries.has(id)) {
|
|
401
|
+
return this._loadedDictionaries.get(id);
|
|
402
|
+
}
|
|
403
|
+
const language = this.languages?.find(language => language?.id === id);
|
|
404
|
+
if (!language || !language?.data) {
|
|
405
|
+
console?.warn?.(`No language was found with id: "${id}"; Defaulting to first available language.`);
|
|
406
|
+
const languageId = this.languages?.[0]?.id ?? null;
|
|
407
|
+
return this.load(languageId);
|
|
408
|
+
}
|
|
409
|
+
const dictionaryDataValues = await language?.data?.();
|
|
410
|
+
const dictionary = this.createDictionary(dictionaryDataValues, language);
|
|
411
|
+
this._loadedDictionaries.set(id, dictionary);
|
|
412
|
+
return dictionary;
|
|
413
|
+
}
|
|
414
|
+
async loadAllLanguages() {
|
|
415
|
+
for (const language of this.languages) {
|
|
416
|
+
await this.load(language?.id);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
async switch(id, options) {
|
|
420
|
+
const dictionary = await this.load(id);
|
|
421
|
+
this._current$.next(dictionary);
|
|
422
|
+
const cache = options?.cache ?? true;
|
|
423
|
+
if (cache) {
|
|
424
|
+
this._storage.cookie.set(this._storageToken, dictionary?.id, {});
|
|
425
|
+
}
|
|
426
|
+
const reload = options?.reload ?? false;
|
|
427
|
+
if (reload) {
|
|
428
|
+
this._window?.location?.reload?.();
|
|
429
|
+
}
|
|
430
|
+
return dictionary;
|
|
431
|
+
}
|
|
432
|
+
select(id) {
|
|
433
|
+
if (!this._loadedDictionaries.has(id)) {
|
|
434
|
+
throw new Error(`Dictionary with id: "${id}" not loaded; Load dictionary first before using .select(:id).`);
|
|
435
|
+
}
|
|
436
|
+
return this._loadedDictionaries.get(id);
|
|
437
|
+
}
|
|
438
|
+
initialize() {
|
|
439
|
+
return async () => {
|
|
440
|
+
await this.switch(this._bestMatchingLanguage?.id, { reload: false, cache: false });
|
|
441
|
+
return this.compareDictionaries();
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
clear() {
|
|
445
|
+
this._storage.cookie.remove(this._storageToken);
|
|
446
|
+
}
|
|
447
|
+
transform(value, data = {}) {
|
|
448
|
+
return (this._transforms ?? []).reduce((previous, current) => {
|
|
449
|
+
return current.execute(previous, data, this);
|
|
450
|
+
}, value);
|
|
451
|
+
}
|
|
452
|
+
translate(tokenOrParams) {
|
|
453
|
+
// 1. Convert to the params.
|
|
454
|
+
const params = this.convertToParams(tokenOrParams);
|
|
455
|
+
// 2. Try to find the translation in the dictionary.
|
|
456
|
+
const dictionary = this.getDictionary(params?.dictionary);
|
|
457
|
+
const searchResult = !!dictionary ? dictionary.get(params?.token) : null;
|
|
458
|
+
// 3. Verify the translation was found.
|
|
459
|
+
if (!searchResult) {
|
|
460
|
+
if (!this._missingHandler) {
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
463
|
+
return this._missingHandler.handle(params);
|
|
464
|
+
}
|
|
465
|
+
return this.transform(searchResult, params?.data);
|
|
466
|
+
}
|
|
467
|
+
retrieveBestMatchingLanguage() {
|
|
468
|
+
return this.getLanguageFromStorage()
|
|
469
|
+
?? this.getBestBrowserMatchLanguage()
|
|
470
|
+
?? this._availableLanguages?.[0];
|
|
471
|
+
}
|
|
472
|
+
getLanguageFromStorage() {
|
|
473
|
+
// Get id from the storage.
|
|
474
|
+
const id = this._storage.cookie.get(this._storageToken);
|
|
475
|
+
// Return the language based on the storage id.
|
|
476
|
+
return this._availableLanguages.find(item => item?.id === id);
|
|
477
|
+
}
|
|
478
|
+
getBestBrowserMatchLanguage() {
|
|
479
|
+
// Loop through all browser languages and return the
|
|
480
|
+
// best matching language.
|
|
481
|
+
return this._languages.all.map(({ code, region }) => {
|
|
482
|
+
const languageCode = [code, region].filter(data => !!data).join('-');
|
|
483
|
+
return this._availableLanguages.find(item => item?.supported?.includes(languageCode));
|
|
484
|
+
}).filter(item => !!item).find((_, index) => index === 0);
|
|
485
|
+
}
|
|
486
|
+
createDictionary(data, language) {
|
|
487
|
+
return new LocalizeDictionary(language?.id, language?.locale, language?.supported, data?.data, this);
|
|
488
|
+
}
|
|
489
|
+
getDictionary(id) {
|
|
490
|
+
if (id === null || id === undefined) {
|
|
491
|
+
return this.current;
|
|
492
|
+
}
|
|
493
|
+
return this.select(id);
|
|
494
|
+
}
|
|
495
|
+
renderDocumentLanguage() {
|
|
496
|
+
const element = this._document?.documentElement;
|
|
497
|
+
if (!element) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
element.lang = this._bestMatchingLanguage?.supported?.[0] ?? this._bestMatchingLanguage?.locale;
|
|
501
|
+
}
|
|
502
|
+
async compareDictionaries() {
|
|
503
|
+
const compareDictionaries = this._config.compareDictionaries ?? false;
|
|
504
|
+
if (!compareDictionaries || !this.current) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
const languageIds = (this.languages ?? [])
|
|
508
|
+
?.filter(language => language?.id !== this.current?.id)
|
|
509
|
+
?.map(language => language?.id);
|
|
510
|
+
return await this.current.compare(languageIds);
|
|
511
|
+
}
|
|
512
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: Localize, deps: [{ token: i1.Storage }, { token: i2.Languages }, { token: WINDOW, optional: true }, { token: DOCUMENT, optional: true }, { token: LOCALIZE_CONFIG, optional: true }, { token: LOCALIZE_TRANSFORM, optional: true }, { token: LOCALIZE_MISSING_HANDLER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
513
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: Localize, providedIn: 'root' }); }
|
|
514
|
+
}
|
|
515
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: Localize, decorators: [{
|
|
516
|
+
type: Injectable,
|
|
517
|
+
args: [{
|
|
518
|
+
providedIn: 'root'
|
|
519
|
+
}]
|
|
520
|
+
}], ctorParameters: () => [{ type: i1.Storage }, { type: i2.Languages }, { type: Window, decorators: [{
|
|
521
|
+
type: Optional
|
|
522
|
+
}, {
|
|
523
|
+
type: Inject,
|
|
524
|
+
args: [WINDOW]
|
|
525
|
+
}] }, { type: Document, decorators: [{
|
|
526
|
+
type: Optional
|
|
527
|
+
}, {
|
|
528
|
+
type: Inject,
|
|
529
|
+
args: [DOCUMENT]
|
|
530
|
+
}] }, { type: undefined, decorators: [{
|
|
531
|
+
type: Optional
|
|
532
|
+
}, {
|
|
533
|
+
type: Inject,
|
|
534
|
+
args: [LOCALIZE_CONFIG]
|
|
535
|
+
}] }, { type: undefined, decorators: [{
|
|
536
|
+
type: Optional
|
|
537
|
+
}, {
|
|
538
|
+
type: Inject,
|
|
539
|
+
args: [LOCALIZE_TRANSFORM]
|
|
540
|
+
}] }, { type: LocalizeMissingHandler, decorators: [{
|
|
541
|
+
type: Optional
|
|
542
|
+
}, {
|
|
543
|
+
type: Inject,
|
|
544
|
+
args: [LOCALIZE_MISSING_HANDLER]
|
|
545
|
+
}] }] });
|
|
546
|
+
|
|
547
|
+
const LOCALIZE_FUNCTION = new InjectionToken('localize function');
|
|
548
|
+
const LOCALIZE_CONFIG = new InjectionToken('localize config');
|
|
549
|
+
const LOCALIZE_TRANSFORM = new InjectionToken('localize transform');
|
|
550
|
+
const LOCALIZE_MISSING_HANDLER = new InjectionToken('localize missing handler');
|
|
551
|
+
const LOCALIZE_ID = new InjectionToken('An abstraction over locale changes', {
|
|
552
|
+
factory: () => {
|
|
553
|
+
const localize = inject(Localize, { optional: true });
|
|
554
|
+
if (!localize) {
|
|
555
|
+
return of(inject(LOCALE_ID));
|
|
556
|
+
}
|
|
557
|
+
return localize.dictionaryChanges$.pipe(map(dictionary => dictionary?.locale ?? null), distinctUntilChanged(), startWith(localize?.current?.locale ?? null));
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
|
|
334
561
|
let LocalizePluralTransform = class LocalizePluralTransform extends LocalizeTransform {
|
|
335
562
|
constructor(config) {
|
|
336
563
|
super();
|
|
@@ -380,7 +607,8 @@ let LocalizePluralTransform = class LocalizePluralTransform extends LocalizeTran
|
|
|
380
607
|
}
|
|
381
608
|
};
|
|
382
609
|
LocalizePluralTransform = __decorate([
|
|
383
|
-
__param(0, Optional())
|
|
610
|
+
__param(0, Optional()),
|
|
611
|
+
__param(0, Inject(LOCALIZE_CONFIG))
|
|
384
612
|
], LocalizePluralTransform);
|
|
385
613
|
|
|
386
614
|
let LocalizeInterpolateTransform = class LocalizeInterpolateTransform extends LocalizeTransform {
|
|
@@ -428,6 +656,7 @@ let LocalizeInterpolateTransform = class LocalizeInterpolateTransform extends Lo
|
|
|
428
656
|
};
|
|
429
657
|
LocalizeInterpolateTransform = __decorate([
|
|
430
658
|
__param(0, Optional()),
|
|
659
|
+
__param(0, Inject(LOCALIZE_CONFIG)),
|
|
431
660
|
__param(1, Optional()),
|
|
432
661
|
__param(1, Inject(LOCALIZE_FUNCTION))
|
|
433
662
|
], LocalizeInterpolateTransform);
|
|
@@ -450,7 +679,8 @@ let LocalizeReferenceTransform = class LocalizeReferenceTransform extends Locali
|
|
|
450
679
|
}
|
|
451
680
|
};
|
|
452
681
|
LocalizeReferenceTransform = __decorate([
|
|
453
|
-
__param(0, Optional())
|
|
682
|
+
__param(0, Optional()),
|
|
683
|
+
__param(0, Inject(LOCALIZE_CONFIG))
|
|
454
684
|
], LocalizeReferenceTransform);
|
|
455
685
|
|
|
456
686
|
class BbLocalizeTemplate {
|
|
@@ -459,13 +689,14 @@ class BbLocalizeTemplate {
|
|
|
459
689
|
// Inputs.
|
|
460
690
|
this.name = null;
|
|
461
691
|
}
|
|
462
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
463
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.
|
|
692
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbLocalizeTemplate, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
693
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.5", type: BbLocalizeTemplate, isStandalone: true, selector: "[bbLocalizeTemplate]", inputs: { name: ["bbLocalizeTemplate", "name"] }, ngImport: i0 }); }
|
|
464
694
|
}
|
|
465
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
695
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbLocalizeTemplate, decorators: [{
|
|
466
696
|
type: Directive,
|
|
467
697
|
args: [{
|
|
468
|
-
selector: '[bbLocalizeTemplate]'
|
|
698
|
+
selector: '[bbLocalizeTemplate]',
|
|
699
|
+
standalone: true
|
|
469
700
|
}]
|
|
470
701
|
}], ctorParameters: () => [{ type: i0.TemplateRef }], propDecorators: { name: [{
|
|
471
702
|
type: Input,
|
|
@@ -536,15 +767,12 @@ class BbLocalizeString {
|
|
|
536
767
|
end.replace(escape, '\\$&')
|
|
537
768
|
];
|
|
538
769
|
}
|
|
539
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
540
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
770
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbLocalizeString, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
771
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbLocalizeString, isStandalone: true, selector: "[bb-localize-string]", inputs: { substitutions: "substitutions", value: ["bb-localize-string", "value"] }, host: { classAttribute: "bb-localize-string" }, queries: [{ propertyName: "items", predicate: BbLocalizeTemplate }], ngImport: i0, template: "@for (component of components; track component) {\n <ng-template [bbTemplate]=\"component\">{{ component }}</ng-template>\n}\n", styles: [""], dependencies: [{ kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
541
772
|
}
|
|
542
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
773
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbLocalizeString, decorators: [{
|
|
543
774
|
type: Component,
|
|
544
|
-
args: [{ selector: '[bb-localize-string]', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
545
|
-
'class': 'bb-localize-string',
|
|
546
|
-
'ngSkipHydration': 'true'
|
|
547
|
-
}, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, template: "<ng-container *ngFor=\"let component of components\">\n <ng-template [bbTemplate]=\"component\">{{ component }}</ng-template>\n</ng-container>\n", styles: [".bb-localize-string{display:inline}\n"] }]
|
|
775
|
+
args: [{ selector: '[bb-localize-string]', changeDetection: ChangeDetectionStrategy.OnPush, host: { 'class': 'bb-localize-string' }, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, standalone: true, imports: [BbTemplate], template: "@for (component of components; track component) {\n <ng-template [bbTemplate]=\"component\">{{ component }}</ng-template>\n}\n" }]
|
|
548
776
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { items: [{
|
|
549
777
|
type: ContentChildren,
|
|
550
778
|
args: [BbLocalizeTemplate]
|
|
@@ -555,190 +783,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImpor
|
|
|
555
783
|
args: ['bb-localize-string']
|
|
556
784
|
}] } });
|
|
557
785
|
|
|
558
|
-
class Localize {
|
|
559
|
-
constructor(_storage, _languages, _missingHandler, _config, _window, _document, _transforms) {
|
|
560
|
-
this._storage = _storage;
|
|
561
|
-
this._languages = _languages;
|
|
562
|
-
this._missingHandler = _missingHandler;
|
|
563
|
-
this._config = _config;
|
|
564
|
-
this._window = _window;
|
|
565
|
-
this._document = _document;
|
|
566
|
-
this._transforms = _transforms;
|
|
567
|
-
// Readonly data.
|
|
568
|
-
this._storageToken = this._config?.storageToken ?? 'bb-language-dictionary-id';
|
|
569
|
-
this._availableLanguages = this?._config?.languages ?? [];
|
|
570
|
-
this._bestMatchingLanguage = this.retrieveBestMatchingLanguage();
|
|
571
|
-
this._loadedDictionaries = new Map();
|
|
572
|
-
// Current dictionary.
|
|
573
|
-
this._current$ = new BehaviorSubject(null);
|
|
574
|
-
// State changes.
|
|
575
|
-
this.dictionaryChanges$ = this._current$.asObservable();
|
|
576
|
-
this.convertToParams = (tokenOrParams) => {
|
|
577
|
-
if (typeof tokenOrParams !== 'string') {
|
|
578
|
-
// Destruct the params from the object.
|
|
579
|
-
const { token, optional, dictionary, data } = tokenOrParams;
|
|
580
|
-
// Make sure all parameters are valid
|
|
581
|
-
// by type safe adding them.
|
|
582
|
-
return { token: token, optional: optional ?? false, dictionary: dictionary ?? null, data: data ?? {} };
|
|
583
|
-
}
|
|
584
|
-
// If the parameter is a string fill in the blanks.
|
|
585
|
-
return { token: tokenOrParams, optional: false, dictionary: null, data: {} };
|
|
586
|
-
};
|
|
587
|
-
this.renderDocumentLanguage();
|
|
588
|
-
}
|
|
589
|
-
get languages() {
|
|
590
|
-
return this._availableLanguages ?? [];
|
|
591
|
-
}
|
|
592
|
-
get current() {
|
|
593
|
-
return this._current$.getValue();
|
|
594
|
-
}
|
|
595
|
-
async load(id) {
|
|
596
|
-
if (id === null || id === undefined) {
|
|
597
|
-
throw new Error(`Cannot load language with id: "${id}".`);
|
|
598
|
-
}
|
|
599
|
-
if (this._loadedDictionaries.has(id)) {
|
|
600
|
-
return this._loadedDictionaries.get(id);
|
|
601
|
-
}
|
|
602
|
-
const language = this.languages?.find(language => language?.id === id);
|
|
603
|
-
if (!language || !language?.data) {
|
|
604
|
-
console?.warn?.(`No language was found with id: "${id}"; Defaulting to first available language.`);
|
|
605
|
-
const languageId = this.languages?.[0]?.id ?? null;
|
|
606
|
-
return this.load(languageId);
|
|
607
|
-
}
|
|
608
|
-
const dictionaryDataValues = await language?.data?.();
|
|
609
|
-
const dictionary = this.createDictionary(dictionaryDataValues, language);
|
|
610
|
-
this._loadedDictionaries.set(id, dictionary);
|
|
611
|
-
return dictionary;
|
|
612
|
-
}
|
|
613
|
-
async loadAllLanguages() {
|
|
614
|
-
for (const language of this.languages) {
|
|
615
|
-
await this.load(language?.id);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
async switch(id, options) {
|
|
619
|
-
const dictionary = await this.load(id);
|
|
620
|
-
this._current$.next(dictionary);
|
|
621
|
-
const cache = options?.cache ?? true;
|
|
622
|
-
if (cache) {
|
|
623
|
-
this._storage.cookie.set(this._storageToken, dictionary?.id, {});
|
|
624
|
-
}
|
|
625
|
-
const reload = options?.reload ?? false;
|
|
626
|
-
if (reload) {
|
|
627
|
-
this._window?.location?.reload?.();
|
|
628
|
-
}
|
|
629
|
-
return dictionary;
|
|
630
|
-
}
|
|
631
|
-
select(id) {
|
|
632
|
-
if (!this._loadedDictionaries.has(id)) {
|
|
633
|
-
throw new Error(`Dictionary with id: "${id}" not loaded; Load dictionary first before using .select(:id).`);
|
|
634
|
-
}
|
|
635
|
-
return this._loadedDictionaries.get(id);
|
|
636
|
-
}
|
|
637
|
-
initialize() {
|
|
638
|
-
return async () => {
|
|
639
|
-
await this.switch(this._bestMatchingLanguage?.id, { reload: false, cache: false });
|
|
640
|
-
return this.compareDictionaries();
|
|
641
|
-
};
|
|
642
|
-
}
|
|
643
|
-
clear() {
|
|
644
|
-
this._storage.cookie.remove(this._storageToken);
|
|
645
|
-
}
|
|
646
|
-
transform(value, data = {}) {
|
|
647
|
-
return (this._transforms ?? []).reduce((previous, current) => {
|
|
648
|
-
return current.execute(previous, data, this);
|
|
649
|
-
}, value);
|
|
650
|
-
}
|
|
651
|
-
translate(tokenOrParams) {
|
|
652
|
-
// 1. Convert to the params.
|
|
653
|
-
const params = this.convertToParams(tokenOrParams);
|
|
654
|
-
// 2. Try to find the translation in the dictionary.
|
|
655
|
-
const dictionary = this.getDictionary(params?.dictionary);
|
|
656
|
-
const searchResult = !!dictionary ? dictionary.get(params?.token) : null;
|
|
657
|
-
// 3. Verify the translation was found.
|
|
658
|
-
if (!searchResult) {
|
|
659
|
-
return this._missingHandler.handle(params);
|
|
660
|
-
}
|
|
661
|
-
return this.transform(searchResult, params?.data);
|
|
662
|
-
}
|
|
663
|
-
retrieveBestMatchingLanguage() {
|
|
664
|
-
return this.getLanguageFromStorage()
|
|
665
|
-
?? this.getBestBrowserMatchLanguage()
|
|
666
|
-
?? this._availableLanguages?.[0];
|
|
667
|
-
}
|
|
668
|
-
getLanguageFromStorage() {
|
|
669
|
-
// Get id from the storage.
|
|
670
|
-
const id = this._storage.cookie.get(this._storageToken);
|
|
671
|
-
// Return the language based on the storage id.
|
|
672
|
-
return this._availableLanguages.find(item => item?.id === id);
|
|
673
|
-
}
|
|
674
|
-
getBestBrowserMatchLanguage() {
|
|
675
|
-
// Loop through all browser languages and return the
|
|
676
|
-
// best matching language.
|
|
677
|
-
return this._languages.all.map(({ code, region }) => {
|
|
678
|
-
const languageCode = [code, region].filter(data => !!data).join('-');
|
|
679
|
-
return this._availableLanguages.find(item => item?.supported?.includes(languageCode));
|
|
680
|
-
}).filter(item => !!item).find((_, index) => index === 0);
|
|
681
|
-
}
|
|
682
|
-
createDictionary(data, language) {
|
|
683
|
-
return new LocalizeDictionary(language?.id, language?.locale, language?.supported, data?.data, this);
|
|
684
|
-
}
|
|
685
|
-
getDictionary(id) {
|
|
686
|
-
if (id === null || id === undefined) {
|
|
687
|
-
return this.current;
|
|
688
|
-
}
|
|
689
|
-
return this.select(id);
|
|
690
|
-
}
|
|
691
|
-
renderDocumentLanguage() {
|
|
692
|
-
const element = this._document?.documentElement;
|
|
693
|
-
if (!element) {
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
696
|
-
element.lang = this._bestMatchingLanguage?.supported?.[0] ?? this._bestMatchingLanguage?.locale;
|
|
697
|
-
}
|
|
698
|
-
async compareDictionaries() {
|
|
699
|
-
const compareDictionaries = this._config.compareDictionaries ?? false;
|
|
700
|
-
if (!compareDictionaries || !this.current) {
|
|
701
|
-
return;
|
|
702
|
-
}
|
|
703
|
-
const languageIds = (this.languages ?? [])
|
|
704
|
-
?.filter(language => language?.id !== this.current?.id)
|
|
705
|
-
?.map(language => language?.id);
|
|
706
|
-
return await this.current.compare(languageIds);
|
|
707
|
-
}
|
|
708
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Localize, deps: [{ token: i1$1.Storage }, { token: i2$1.Languages }, { token: LocalizeMissingHandler }, { token: LocalizeConfig, optional: true }, { token: WINDOW, optional: true }, { token: DOCUMENT, optional: true }, { token: LOCALIZE_TRANSFORM, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
709
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Localize }); }
|
|
710
|
-
}
|
|
711
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Localize, decorators: [{
|
|
712
|
-
type: Injectable
|
|
713
|
-
}], ctorParameters: () => [{ type: i1$1.Storage }, { type: i2$1.Languages }, { type: LocalizeMissingHandler }, { type: LocalizeConfig, decorators: [{
|
|
714
|
-
type: Optional
|
|
715
|
-
}] }, { type: Window, decorators: [{
|
|
716
|
-
type: Optional
|
|
717
|
-
}, {
|
|
718
|
-
type: Inject,
|
|
719
|
-
args: [WINDOW]
|
|
720
|
-
}] }, { type: Document, decorators: [{
|
|
721
|
-
type: Optional
|
|
722
|
-
}, {
|
|
723
|
-
type: Inject,
|
|
724
|
-
args: [DOCUMENT]
|
|
725
|
-
}] }, { type: undefined, decorators: [{
|
|
726
|
-
type: Optional
|
|
727
|
-
}, {
|
|
728
|
-
type: Inject,
|
|
729
|
-
args: [LOCALIZE_TRANSFORM]
|
|
730
|
-
}] }] });
|
|
731
|
-
|
|
732
|
-
const LOCALIZE_ID = new InjectionToken('An abstraction over locale changes', {
|
|
733
|
-
factory: () => {
|
|
734
|
-
const localize = inject(Localize, { optional: true });
|
|
735
|
-
if (!localize) {
|
|
736
|
-
return of(inject(LOCALE_ID));
|
|
737
|
-
}
|
|
738
|
-
return localize.dictionaryChanges$.pipe(map(dictionary => dictionary?.locale ?? null), distinctUntilChanged(), startWith(localize?.current?.locale ?? null));
|
|
739
|
-
}
|
|
740
|
-
});
|
|
741
|
-
|
|
742
786
|
class BbLocalize {
|
|
743
787
|
constructor(_localize) {
|
|
744
788
|
this._localize = _localize;
|
|
@@ -770,65 +814,73 @@ class BbLocalize {
|
|
|
770
814
|
// Return the combined params and options.
|
|
771
815
|
return { ...params, ...options };
|
|
772
816
|
}
|
|
773
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
774
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.
|
|
817
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbLocalize, deps: [{ token: Localize, optional: true }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
818
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.5", ngImport: i0, type: BbLocalize, isStandalone: true, name: "bbLocalize" }); }
|
|
775
819
|
}
|
|
776
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
820
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbLocalize, decorators: [{
|
|
777
821
|
type: Pipe,
|
|
778
822
|
args: [{
|
|
779
|
-
name: 'bbLocalize'
|
|
823
|
+
name: 'bbLocalize',
|
|
824
|
+
standalone: true
|
|
780
825
|
}]
|
|
781
826
|
}], ctorParameters: () => [{ type: Localize, decorators: [{
|
|
782
827
|
type: Optional
|
|
783
828
|
}] }] });
|
|
784
829
|
|
|
830
|
+
function provideLocalizeConfig(config) {
|
|
831
|
+
if (config?.languages?.length <= 0) {
|
|
832
|
+
throw new Error('One or more languages should be supplied.');
|
|
833
|
+
}
|
|
834
|
+
if (config?.compareDictionaries && config?.mode === 'manual') {
|
|
835
|
+
console?.warn?.('You cannot enable "compareDictionaries" when having mode set to "manual"; This setting will be ignored.');
|
|
836
|
+
}
|
|
837
|
+
const mode = config?.mode ?? 'automatic';
|
|
838
|
+
const automaticProviders = mode === 'automatic'
|
|
839
|
+
? [
|
|
840
|
+
{ provide: APP_INITIALIZER, deps: [Localize], useFactory: initializeLocale, multi: true },
|
|
841
|
+
{ provide: LOCALE_ID, deps: [Localize], useFactory: getLocale }
|
|
842
|
+
]
|
|
843
|
+
: [];
|
|
844
|
+
return makeEnvironmentProviders([
|
|
845
|
+
{ provide: LOCALIZE_CONFIG, useValue: config },
|
|
846
|
+
...automaticProviders,
|
|
847
|
+
{ provide: LOCALIZE_FUNCTION, useClass: LocalizeLowercaseFunction, multi: true },
|
|
848
|
+
{ provide: LOCALIZE_FUNCTION, useClass: LocalizeUppercaseFunction, multi: true },
|
|
849
|
+
{ provide: LOCALIZE_FUNCTION, useClass: LocalizeDateFunction, multi: true },
|
|
850
|
+
{ provide: LOCALIZE_TRANSFORM, useClass: LocalizePluralTransform, deps: [LOCALIZE_CONFIG], multi: true },
|
|
851
|
+
{ provide: LOCALIZE_TRANSFORM, useClass: LocalizeReferenceTransform, deps: [LOCALIZE_CONFIG], multi: true },
|
|
852
|
+
{ provide: LOCALIZE_TRANSFORM, useClass: LocalizeInterpolateTransform, deps: [LOCALIZE_CONFIG, LOCALIZE_FUNCTION], multi: true },
|
|
853
|
+
{ provide: LOCALIZE_MISSING_HANDLER, useClass: LocalizeMissingHandler }
|
|
854
|
+
]);
|
|
855
|
+
}
|
|
856
|
+
function initializeLocale(localize) {
|
|
857
|
+
return localize.initialize();
|
|
858
|
+
}
|
|
859
|
+
function getLocale(localize) {
|
|
860
|
+
return localize?.current?.locale ?? null;
|
|
861
|
+
}
|
|
862
|
+
|
|
785
863
|
class LocalizeModule {
|
|
786
864
|
static forRoot(config) {
|
|
787
|
-
if (config?.languages?.length <= 0) {
|
|
788
|
-
throw new Error('One or more languages should be supplied.');
|
|
789
|
-
}
|
|
790
|
-
if (config?.compareDictionaries && config?.mode === 'manual') {
|
|
791
|
-
console?.warn?.('You cannot enable "compareDictionaries" when having mode set to "manual"; This setting will be ignored.');
|
|
792
|
-
}
|
|
793
|
-
const mode = config?.mode ?? 'automatic';
|
|
794
865
|
return {
|
|
795
866
|
ngModule: LocalizeModule,
|
|
796
867
|
providers: [
|
|
797
|
-
|
|
798
|
-
...(mode === 'automatic' ? [
|
|
799
|
-
{ provide: APP_INITIALIZER, deps: [Localize], useFactory: initializeLocale, multi: true },
|
|
800
|
-
{ provide: LOCALE_ID, deps: [Localize], useFactory: getLocale }
|
|
801
|
-
] : []),
|
|
802
|
-
// Config provider.
|
|
803
|
-
{ provide: LocalizeConfig, useValue: config },
|
|
804
|
-
// Function providers.
|
|
805
|
-
{ provide: LOCALIZE_FUNCTION, useClass: LocalizeLowercaseFunction, multi: true },
|
|
806
|
-
{ provide: LOCALIZE_FUNCTION, useClass: LocalizeUppercaseFunction, multi: true },
|
|
807
|
-
{ provide: LOCALIZE_FUNCTION, useClass: LocalizeDateFunction, multi: true },
|
|
808
|
-
// Transform providers.
|
|
809
|
-
{ provide: LOCALIZE_TRANSFORM, useClass: LocalizePluralTransform, deps: [LocalizeConfig], multi: true },
|
|
810
|
-
{ provide: LOCALIZE_TRANSFORM, useClass: LocalizeReferenceTransform, deps: [LocalizeConfig], multi: true },
|
|
811
|
-
{ provide: LOCALIZE_TRANSFORM, useClass: LocalizeInterpolateTransform, deps: [LocalizeConfig, LOCALIZE_FUNCTION], multi: true },
|
|
812
|
-
// Handler providers.
|
|
813
|
-
{ provide: LocalizeMissingHandler, useClass: LocalizeMissingHandler },
|
|
814
|
-
// Service providers.
|
|
815
|
-
Localize
|
|
868
|
+
provideLocalizeConfig(config)
|
|
816
869
|
]
|
|
817
870
|
};
|
|
818
871
|
}
|
|
819
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
820
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.
|
|
872
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: LocalizeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
873
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.5", ngImport: i0, type: LocalizeModule, imports: [BbLocalize,
|
|
821
874
|
BbLocalizeString,
|
|
822
|
-
BbLocalizeTemplate],
|
|
875
|
+
BbLocalizeTemplate], exports: [BbLocalize,
|
|
823
876
|
BbLocalizeString,
|
|
824
877
|
BbLocalizeTemplate] }); }
|
|
825
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.
|
|
878
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: LocalizeModule }); }
|
|
826
879
|
}
|
|
827
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
880
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: LocalizeModule, decorators: [{
|
|
828
881
|
type: NgModule,
|
|
829
882
|
args: [{
|
|
830
|
-
imports: [
|
|
831
|
-
declarations: [
|
|
883
|
+
imports: [
|
|
832
884
|
BbLocalize,
|
|
833
885
|
BbLocalizeString,
|
|
834
886
|
BbLocalizeTemplate
|
|
@@ -840,16 +892,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImpor
|
|
|
840
892
|
]
|
|
841
893
|
}]
|
|
842
894
|
}] });
|
|
843
|
-
function initializeLocale(localize) {
|
|
844
|
-
return localize.initialize();
|
|
845
|
-
}
|
|
846
|
-
function getLocale(localize) {
|
|
847
|
-
return localize?.current?.locale ?? null;
|
|
848
|
-
}
|
|
849
895
|
|
|
850
896
|
/**
|
|
851
897
|
* Generated bundle index. Do not edit.
|
|
852
898
|
*/
|
|
853
899
|
|
|
854
|
-
export { BbLocalize, BbLocalizeString, BbLocalizeTemplate, LOCALIZE_FUNCTION, LOCALIZE_ID, LOCALIZE_TRANSFORM, Localize,
|
|
900
|
+
export { BbLocalize, BbLocalizeString, BbLocalizeTemplate, LOCALIZE_CONFIG, LOCALIZE_FUNCTION, LOCALIZE_ID, LOCALIZE_MISSING_HANDLER, LOCALIZE_TRANSFORM, Localize, LocalizeDateFunction, LocalizeDictionary, LocalizeDictionaryContext, LocalizeDictionaryData, LocalizeInterpolateTransform, LocalizeLowercaseFunction, LocalizeMissingHandler, LocalizeModule, LocalizePluralTransform, LocalizeReferenceTransform, LocalizeTransform, LocalizeUppercaseFunction, extraDutchDictionary, extraEnglishDictionary, getLocale, initializeLocale, provideLocalizeConfig };
|
|
855
901
|
//# sourceMappingURL=bravobit-bb-foundation-localize.mjs.map
|