@bravobit/bb-foundation 0.23.2 → 0.23.5
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.service.d.ts +4 -3
- package/auth/lib/guards/anonymous.guard.d.ts +5 -4
- package/auth/lib/guards/authenticated.guard.d.ts +5 -4
- package/auth/lib/guards/permission.guard.d.ts +5 -4
- package/auth/lib/interfaces/config.interface.d.ts +8 -0
- package/elements/lib/date-picker/date-picker.component.d.ts +3 -5
- package/esm2020/auth/lib/auth.interceptor.mjs +3 -3
- package/esm2020/auth/lib/auth.module.mjs +4 -4
- package/esm2020/auth/lib/auth.service.mjs +21 -6
- package/esm2020/auth/lib/directives/authenticated.directive.mjs +3 -3
- package/esm2020/auth/lib/directives/permission.directive.mjs +3 -3
- package/esm2020/auth/lib/guards/anonymous.guard.mjs +17 -7
- package/esm2020/auth/lib/guards/authenticated.guard.mjs +17 -7
- package/esm2020/auth/lib/guards/permission.guard.mjs +17 -7
- package/esm2020/auth/lib/interfaces/config.interface.mjs +3 -1
- package/esm2020/auth/lib/permissions/permissions.service.mjs +3 -3
- package/esm2020/collections/lib/collections.module.mjs +4 -4
- package/esm2020/collections/lib/components/collections-pager/collections-pager.component.mjs +3 -3
- package/esm2020/collections/lib/components/collections-viewer/collections-viewer.component.mjs +3 -3
- package/esm2020/collections/lib/components/collections.directive.mjs +12 -12
- package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +3 -3
- package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +3 -3
- package/esm2020/controls/lib/checkbox/checkbox.module.mjs +4 -4
- package/esm2020/controls/lib/control-error/control-error/control-error.component.mjs +3 -3
- package/esm2020/controls/lib/control-error/control-error-submit.directive.mjs +3 -3
- package/esm2020/controls/lib/control-error/control-error.module.mjs +4 -4
- package/esm2020/controls/lib/controls.module.mjs +4 -4
- package/esm2020/controls/lib/form-control/form-control/form-control.component.mjs +3 -3
- package/esm2020/controls/lib/form-control/form-control-addon/form-control-addon.component.mjs +3 -3
- package/esm2020/controls/lib/form-control/form-control-input.directive.mjs +3 -3
- package/esm2020/controls/lib/form-control/form-control.module.mjs +4 -4
- package/esm2020/dashboard/lib/dashboard/dashboard.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-header/dashboard-header.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +3 -3
- package/esm2020/dashboard/lib/dashboard.module.mjs +4 -4
- package/esm2020/dialog/lib/dialog-actions/dialog-actions.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-container/dialog-container.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-header/dialog-header.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-link/dialog-link.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog-modal/dialog-modal.component.mjs +4 -4
- package/esm2020/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +3 -3
- package/esm2020/dialog/lib/dialog.insertion.mjs +3 -3
- package/esm2020/dialog/lib/dialog.module.mjs +4 -4
- package/esm2020/dialog/lib/dialog.service.mjs +3 -3
- package/esm2020/elements/lib/avatar/avatar.component.mjs +3 -3
- package/esm2020/elements/lib/button/button.component.mjs +6 -6
- package/esm2020/elements/lib/checkbox/checkbox.component.mjs +3 -3
- package/esm2020/elements/lib/date-picker/date-picker.component.mjs +27 -29
- package/esm2020/elements/lib/directives/addon.directive.mjs +6 -6
- package/esm2020/elements/lib/directives/form-submit.directive.mjs +3 -3
- package/esm2020/elements/lib/directives/form-submitter.directive.mjs +3 -3
- package/esm2020/elements/lib/directives/input.directive.mjs +6 -6
- package/esm2020/elements/lib/dropdown/dropdown.component.mjs +7 -7
- package/esm2020/elements/lib/elements.module.mjs +4 -4
- package/esm2020/elements/lib/file-picker/file-picker.component.mjs +3 -3
- package/esm2020/elements/lib/form-control/form-control.component.mjs +3 -3
- package/esm2020/elements/lib/form-error/form-error.component.mjs +3 -3
- package/esm2020/elements/lib/form-group/form-group.component.mjs +3 -3
- package/esm2020/elements/lib/icon/icon.component.mjs +3 -3
- package/esm2020/elements/lib/image-picker/image-picker.component.mjs +3 -3
- package/esm2020/elements/lib/pipes/file-image.pipe.mjs +3 -3
- package/esm2020/elements/lib/pipes/file-size.pipe.mjs +3 -3
- package/esm2020/elements/lib/pipes/relative-time.pipe.mjs +3 -3
- package/esm2020/elements/lib/spinner/spinner.component.mjs +3 -3
- package/esm2020/elements/lib/tag/tag.component.mjs +3 -3
- package/esm2020/http/lib/http.module.mjs +5 -5
- package/esm2020/http/lib/interceptors/base-url.interceptor.mjs +3 -3
- package/esm2020/http/lib/interceptors/error.interceptor.mjs +3 -3
- package/esm2020/lib/core/services/clipboard.service.mjs +4 -4
- package/esm2020/lib/core/services/exif.service.mjs +3 -3
- package/esm2020/lib/core/services/file-loader.service.mjs +3 -3
- package/esm2020/lib/core/services/image-converter.service.mjs +3 -3
- package/esm2020/lib/core/services/languages.service.mjs +3 -3
- package/esm2020/lib/core/services/network.service.mjs +4 -4
- package/esm2020/lib/core/services/patch.service.mjs +4 -4
- package/esm2020/localize/lib/dictionary/dictionary.class.mjs +2 -4
- package/esm2020/localize/lib/interfaces/config.interfaces.mjs +1 -1
- package/esm2020/localize/lib/locale.token.mjs +14 -0
- package/esm2020/localize/lib/localize.module.mjs +8 -5
- package/esm2020/localize/lib/localize.pipe.mjs +3 -3
- package/esm2020/localize/lib/localize.service.mjs +33 -11
- package/esm2020/localize/lib/views/localize-string/localize-string.component.mjs +3 -3
- package/esm2020/localize/lib/views/localize-template.directive.mjs +3 -3
- package/esm2020/localize/public_api.mjs +2 -1
- package/esm2020/masking/lib/directives/currency-mask.directive.mjs +3 -3
- package/esm2020/masking/lib/directives/date-mask.directive.mjs +3 -3
- package/esm2020/masking/lib/directives/input-mask.directive.mjs +3 -3
- package/esm2020/masking/lib/masking.module.mjs +4 -4
- package/esm2020/masking/lib/masking.service.mjs +3 -3
- package/esm2020/notifications/lib/notifications-item/notifications-item.component.mjs +3 -3
- package/esm2020/notifications/lib/notifications-list/notifications-list.component.mjs +3 -3
- package/esm2020/notifications/lib/notifications.module.mjs +4 -4
- package/esm2020/notifications/lib/notifications.service.mjs +3 -3
- package/esm2020/recaptcha/lib/recaptcha/recaptcha.component.mjs +49 -15
- package/esm2020/recaptcha/lib/recaptcha-loader.service.mjs +12 -7
- package/esm2020/recaptcha/lib/recaptcha.module.mjs +4 -4
- package/esm2020/storage/lib/storage.service.mjs +3 -3
- package/esm2020/table/lib/components/table/table.component.mjs +9 -9
- package/esm2020/table/lib/components/table-cell/table-cell.component.mjs +3 -3
- package/esm2020/table/lib/components/table-header-cell/table-header-cell.component.mjs +3 -3
- package/esm2020/table/lib/components/table-pager/table-pager.component.mjs +3 -3
- package/esm2020/table/lib/table.module.mjs +4 -4
- package/esm2020/theming/lib/theming.directive.mjs +3 -3
- package/esm2020/theming/lib/theming.module.mjs +4 -4
- package/esm2020/utils/lib/directives/autosize.directive.mjs +3 -3
- package/esm2020/utils/lib/directives/focus-trap.directive.mjs +3 -3
- package/esm2020/utils/lib/directives/focus.directive.mjs +3 -3
- package/esm2020/utils/lib/directives/template.directive.mjs +3 -3
- package/esm2020/utils/lib/utils.module.mjs +4 -4
- package/fesm2015/bravobit-bb-foundation-auth.mjs +80 -38
- package/fesm2015/bravobit-bb-foundation-auth.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-collections.mjs +22 -22
- package/fesm2015/bravobit-bb-foundation-controls.mjs +37 -37
- package/fesm2015/bravobit-bb-foundation-dashboard.mjs +25 -25
- package/fesm2015/bravobit-bb-foundation-dialog.mjs +31 -31
- package/fesm2015/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-elements.mjs +99 -102
- package/fesm2015/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-http.mjs +10 -10
- package/fesm2015/bravobit-bb-foundation-http.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-localize.mjs +73 -35
- package/fesm2015/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-masking.mjs +16 -16
- package/fesm2015/bravobit-bb-foundation-notifications.mjs +13 -13
- package/fesm2015/bravobit-bb-foundation-recaptcha.mjs +64 -25
- package/fesm2015/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-storage.mjs +3 -3
- package/fesm2015/bravobit-bb-foundation-table.mjs +22 -22
- package/fesm2015/bravobit-bb-foundation-theming.mjs +7 -7
- package/fesm2015/bravobit-bb-foundation-utils.mjs +16 -16
- package/fesm2015/bravobit-bb-foundation.mjs +21 -21
- package/fesm2015/bravobit-bb-foundation.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-auth.mjs +80 -38
- package/fesm2020/bravobit-bb-foundation-auth.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-collections.mjs +22 -22
- package/fesm2020/bravobit-bb-foundation-controls.mjs +37 -37
- package/fesm2020/bravobit-bb-foundation-dashboard.mjs +25 -25
- package/fesm2020/bravobit-bb-foundation-dialog.mjs +31 -31
- package/fesm2020/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-elements.mjs +99 -101
- package/fesm2020/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-http.mjs +10 -10
- package/fesm2020/bravobit-bb-foundation-http.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-localize.mjs +62 -30
- package/fesm2020/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-masking.mjs +16 -16
- package/fesm2020/bravobit-bb-foundation-notifications.mjs +13 -13
- package/fesm2020/bravobit-bb-foundation-recaptcha.mjs +61 -23
- package/fesm2020/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-storage.mjs +3 -3
- package/fesm2020/bravobit-bb-foundation-table.mjs +22 -22
- package/fesm2020/bravobit-bb-foundation-theming.mjs +7 -7
- package/fesm2020/bravobit-bb-foundation-utils.mjs +16 -16
- package/fesm2020/bravobit-bb-foundation.mjs +21 -21
- package/fesm2020/bravobit-bb-foundation.mjs.map +1 -1
- package/localize/lib/interfaces/config.interfaces.d.ts +1 -0
- package/localize/lib/locale.token.d.ts +3 -0
- package/localize/lib/localize.module.d.ts +1 -1
- package/localize/lib/localize.service.d.ts +6 -3
- package/localize/public_api.d.ts +1 -0
- package/package.json +1 -1
- package/recaptcha/lib/recaptcha/recaptcha.component.d.ts +11 -3
- package/recaptcha/lib/recaptcha-loader.service.d.ts +4 -2
|
@@ -97,9 +97,9 @@ class BaseUrlInterceptor {
|
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
BaseUrlInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
101
|
-
BaseUrlInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
102
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
100
|
+
BaseUrlInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BaseUrlInterceptor, deps: [{ token: HttpConfig }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
101
|
+
BaseUrlInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BaseUrlInterceptor });
|
|
102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BaseUrlInterceptor, decorators: [{
|
|
103
103
|
type: Injectable
|
|
104
104
|
}], ctorParameters: function () { return [{ type: HttpConfig }]; } });
|
|
105
105
|
|
|
@@ -123,9 +123,9 @@ class ErrorInterceptor {
|
|
|
123
123
|
}));
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
ErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
127
|
-
ErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
128
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
126
|
+
ErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ErrorInterceptor, deps: [{ token: HttpConfig }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
127
|
+
ErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ErrorInterceptor });
|
|
128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ErrorInterceptor, decorators: [{
|
|
129
129
|
type: Injectable
|
|
130
130
|
}], ctorParameters: function () { return [{ type: HttpConfig }]; } });
|
|
131
131
|
|
|
@@ -148,10 +148,10 @@ class HttpModule {
|
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
HttpModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
152
|
-
HttpModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.
|
|
153
|
-
HttpModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.
|
|
154
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
151
|
+
HttpModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: HttpModule, deps: [{ token: HttpModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
152
|
+
HttpModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.1", ngImport: i0, type: HttpModule, imports: [HttpClientModule] });
|
|
153
|
+
HttpModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: HttpModule, imports: [HttpClientModule] });
|
|
154
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: HttpModule, decorators: [{
|
|
155
155
|
type: NgModule,
|
|
156
156
|
args: [{
|
|
157
157
|
imports: [HttpClientModule]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bravobit-bb-foundation-http.mjs","sources":["../../../projects/bb-foundation/http/src/lib/classes/http.config.ts","../../../projects/bb-foundation/http/src/lib/classes/http.error.ts","../../../projects/bb-foundation/http/src/lib/interceptors/base-url.interceptor.ts","../../../projects/bb-foundation/http/src/lib/interceptors/error.interceptor.ts","../../../projects/bb-foundation/http/src/lib/http.module.ts","../../../projects/bb-foundation/http/src/bravobit-bb-foundation-http.ts"],"sourcesContent":["import {HttpConfigAliases, HttpConfigData, HttpConfigUrl} from '../http.interfaces';\n\ndeclare let ngDevMode;\n\nexport class HttpConfig {\n\n readonly aliases: HttpConfigAliases;\n readonly prefix: string;\n readonly defaultAlias: string;\n readonly disableErrorParsing: boolean;\n\n constructor(data: HttpConfigData) {\n // Get the data from the config.\n this.prefix = data?.alias?.prefix ?? '$';\n this.disableErrorParsing = data?.disableErrorParsing ?? false;\n\n // Parse the aliases.\n const standardAlias = data?.alias?.standard ?? 'api';\n this.aliases = this.parseAliases(data?.url, standardAlias);\n\n // Get the default alias.\n const firstAvailableAlias = Object.keys(this.aliases ?? {})?.[0];\n this.defaultAlias = `${this.prefix}${firstAvailableAlias}`;\n }\n\n private parseAliases = (value: HttpConfigUrl, standardAlias: string) => {\n if (typeof value === 'string') {\n value = {[standardAlias]: value};\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const stringRegex = /^[a-zA-Z]+$/;\n for (const alias in value) {\n if (value.hasOwnProperty(alias) && !stringRegex.test(alias)) {\n console?.warn?.(`[HttpModule]: Invalid HTTP-alias in HttpConfig named \"${alias}\"; only latin characters should be used.`);\n }\n }\n }\n\n return value;\n };\n\n}\n","import {HttpErrorResponse} from '@angular/common/http';\n\nexport class HttpError extends HttpErrorResponse {\n\n constructor(error: HttpErrorResponse) {\n super(error);\n }\n\n get<T = any>(token: string, delimiter: string = '.') {\n const error = this.error ?? {};\n return (token ?? '')\n .split(delimiter)\n .reduce((previous, current) => previous?.[current] ? previous?.[current] : null, error) as T;\n }\n\n has(token: string, delimiter: string = '.') {\n return !!this.get(token, delimiter);\n }\n\n includes<T = any>(token: string, value: T) {\n const array = this.get<T[]>(token);\n return (array ?? []).includes(value);\n }\n\n}\n","import {HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';\nimport {HttpConfigAliases} from '../http.interfaces';\nimport {HttpConfig} from '../classes/http.config';\nimport {Injectable} from '@angular/core';\n\ndeclare let ngDevMode;\n\n@Injectable()\nexport class BaseUrlInterceptor implements HttpInterceptor {\n\n // Aliases.\n private readonly _aliases: HttpConfigAliases = this._config?.aliases;\n private readonly _prefix: string = this._config?.prefix;\n private readonly _extractRegex: RegExp = new RegExp(`\\\\${this._prefix}[a-zA-Z]+`);\n\n constructor(private _config: HttpConfig) {\n }\n\n intercept(request: HttpRequest<unknown>, next: HttpHandler) {\n const url = this.getUrlBasedOnAlias(request.url);\n const modified = request.clone({url});\n\n return next.handle(modified);\n }\n\n private getUrlBasedOnAlias(url: string) {\n const matches = this._extractRegex.exec(url);\n if (!matches) {\n return url;\n }\n\n return matches.reduce((previous, current) => {\n const alias = this.getAlias(current);\n if (!alias) {\n return previous;\n }\n\n return previous.replace(current, alias);\n }, url);\n }\n\n private getAlias(value: string) {\n const alias = value.replace(this._prefix, '');\n const fetched = this._aliases?.[alias] ?? null;\n if (fetched) {\n return fetched;\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const available = Object.keys(this._aliases)\n .map(item => `\\$${item}`)\n .join(', ');\n console?.warn?.(`[HttpModule]: Used an invalid HTTP-alias named \"${value}\", skipped parsing; Available aliases is one of (${available}).`);\n }\n\n return null;\n }\n\n}\n","import {HttpErrorResponse, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';\nimport {HttpConfig} from '../classes/http.config';\nimport {HttpError} from '../classes/http.error';\nimport {catchError} from 'rxjs/operators';\nimport {Injectable} from '@angular/core';\nimport {throwError} from 'rxjs';\n\n@Injectable()\nexport class ErrorInterceptor implements HttpInterceptor {\n\n // State.\n private readonly _disabled = this._config?.disableErrorParsing ?? false;\n\n constructor(private _config: HttpConfig) {\n }\n\n intercept(request: HttpRequest<unknown>, next: HttpHandler) {\n return next.handle(request).pipe(\n catchError(error => {\n // If we have a matching http error response\n // re-map it with our custom class (if not disabled).\n if (!this._disabled && error instanceof HttpErrorResponse) {\n const parsed = new HttpError(error);\n return throwError(() => parsed);\n }\n\n // We did not match anything, just re-trow the error.\n return throwError(() => error);\n })\n );\n }\n\n}\n","import {InjectionToken, ModuleWithProviders, NgModule, Optional, SkipSelf} from '@angular/core';\nimport {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';\nimport {BaseUrlInterceptor} from './interceptors/base-url.interceptor';\nimport {ErrorInterceptor} from './interceptors/error.interceptor';\nimport {HttpConfigData} from './http.interfaces';\nimport {HttpConfig} from './classes/http.config';\n\n@NgModule({\n imports: [HttpClientModule]\n})\nexport class HttpModule {\n\n constructor(@Optional() @SkipSelf() private _parent?: HttpModule) {\n if (this._parent) {\n throw new Error('HttpModule is already loaded; Import it in the core module only.');\n }\n }\n\n static forRoot(config: HttpConfigData): ModuleWithProviders<HttpModule> {\n return {\n ngModule: HttpModule,\n providers: [\n {provide: HTTP_CONFIGURATION_DATA, useValue: config},\n {provide: HttpConfig, useFactory: createHttpConfig, deps: [HTTP_CONFIGURATION_DATA]},\n {provide: HTTP_INTERCEPTORS, useClass: BaseUrlInterceptor, multi: true},\n {provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true}\n ]\n };\n }\n\n}\n\nexport const HTTP_CONFIGURATION_DATA = new InjectionToken<HttpConfigData>('HTTP_CONFIGURATION_DATA');\n\nexport function createHttpConfig(data: HttpConfigData) {\n return new HttpConfig(data);\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.HttpConfig"],"mappings":";;;;;;MAIa,UAAU,CAAA;AAOnB,IAAA,WAAA,CAAY,IAAoB,EAAA;;QAcxB,IAAA,CAAA,YAAY,GAAG,CAAC,KAAoB,EAAE,aAAqB,KAAI;;AACnE,YAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC3B,KAAK,GAAG,EAAC,CAAC,aAAa,GAAG,KAAK,EAAC,CAAC;AACpC,aAAA;AAED,YAAA,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,EAAE;gBAC/C,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,gBAAA,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE;AACvB,oBAAA,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;AACzD,wBAAA,CAAA,EAAA,GAAA,OAAO,KAAA,IAAA,IAAP,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAP,OAAO,CAAE,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,C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AA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,YAFT,gBAAgB,CAAA,EAAA,CAAA,CAAA;AAEjB,UAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,YAFT,gBAAgB,CAAA,EAAA,CAAA,CAAA;2FAEjB,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,gBAAgB,CAAC;iBAC9B,CAAA;;wBAGyD,UAAU,EAAA,UAAA,EAAA,CAAA;8BAAnD,QAAQ;;8BAAI,QAAQ;;;MAoBxB,uBAAuB,GAAG,IAAI,cAAc,CAAiB,yBAAyB,EAAE;AAE/F,SAAU,gBAAgB,CAAC,IAAoB,EAAA;AACjD,IAAA,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAChC;;ACpCA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"bravobit-bb-foundation-http.mjs","sources":["../../../projects/bb-foundation/http/src/lib/classes/http.config.ts","../../../projects/bb-foundation/http/src/lib/classes/http.error.ts","../../../projects/bb-foundation/http/src/lib/interceptors/base-url.interceptor.ts","../../../projects/bb-foundation/http/src/lib/interceptors/error.interceptor.ts","../../../projects/bb-foundation/http/src/lib/http.module.ts","../../../projects/bb-foundation/http/src/bravobit-bb-foundation-http.ts"],"sourcesContent":["import {HttpConfigAliases, HttpConfigData, HttpConfigUrl} from '../http.interfaces';\n\ndeclare let ngDevMode;\n\nexport class HttpConfig {\n\n readonly aliases: HttpConfigAliases;\n readonly prefix: string;\n readonly defaultAlias: string;\n readonly disableErrorParsing: boolean;\n\n constructor(data: HttpConfigData) {\n // Get the data from the config.\n this.prefix = data?.alias?.prefix ?? '$';\n this.disableErrorParsing = data?.disableErrorParsing ?? false;\n\n // Parse the aliases.\n const standardAlias = data?.alias?.standard ?? 'api';\n this.aliases = this.parseAliases(data?.url, standardAlias);\n\n // Get the default alias.\n const firstAvailableAlias = Object.keys(this.aliases ?? {})?.[0];\n this.defaultAlias = `${this.prefix}${firstAvailableAlias}`;\n }\n\n private parseAliases = (value: HttpConfigUrl, standardAlias: string) => {\n if (typeof value === 'string') {\n value = {[standardAlias]: value};\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const stringRegex = /^[a-zA-Z]+$/;\n for (const alias in value) {\n if (value.hasOwnProperty(alias) && !stringRegex.test(alias)) {\n console?.warn?.(`[HttpModule]: Invalid HTTP-alias in HttpConfig named \"${alias}\"; only latin characters should be used.`);\n }\n }\n }\n\n return value;\n };\n\n}\n","import {HttpErrorResponse} from '@angular/common/http';\n\nexport class HttpError extends HttpErrorResponse {\n\n constructor(error: HttpErrorResponse) {\n super(error);\n }\n\n get<T = any>(token: string, delimiter: string = '.') {\n const error = this.error ?? {};\n return (token ?? '')\n .split(delimiter)\n .reduce((previous, current) => previous?.[current] ? previous?.[current] : null, error) as T;\n }\n\n has(token: string, delimiter: string = '.') {\n return !!this.get(token, delimiter);\n }\n\n includes<T = any>(token: string, value: T) {\n const array = this.get<T[]>(token);\n return (array ?? []).includes(value);\n }\n\n}\n","import {HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';\nimport {HttpConfigAliases} from '../http.interfaces';\nimport {HttpConfig} from '../classes/http.config';\nimport {Injectable} from '@angular/core';\n\ndeclare let ngDevMode;\n\n@Injectable()\nexport class BaseUrlInterceptor implements HttpInterceptor {\n\n // Aliases.\n private readonly _aliases: HttpConfigAliases = this._config?.aliases;\n private readonly _prefix: string = this._config?.prefix;\n private readonly _extractRegex: RegExp = new RegExp(`\\\\${this._prefix}[a-zA-Z]+`);\n\n constructor(private _config: HttpConfig) {\n }\n\n intercept(request: HttpRequest<unknown>, next: HttpHandler) {\n const url = this.getUrlBasedOnAlias(request.url);\n const modified = request.clone({url});\n\n return next.handle(modified);\n }\n\n private getUrlBasedOnAlias(url: string) {\n const matches = this._extractRegex.exec(url);\n if (!matches) {\n return url;\n }\n\n return matches.reduce((previous, current) => {\n const alias = this.getAlias(current);\n if (!alias) {\n return previous;\n }\n\n return previous.replace(current, alias);\n }, url);\n }\n\n private getAlias(value: string) {\n const alias = value.replace(this._prefix, '');\n const fetched = this._aliases?.[alias] ?? null;\n if (fetched) {\n return fetched;\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const available = Object.keys(this._aliases)\n .map(item => `\\$${item}`)\n .join(', ');\n console?.warn?.(`[HttpModule]: Used an invalid HTTP-alias named \"${value}\", skipped parsing; Available aliases is one of (${available}).`);\n }\n\n return null;\n }\n\n}\n","import {HttpErrorResponse, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';\nimport {HttpConfig} from '../classes/http.config';\nimport {HttpError} from '../classes/http.error';\nimport {catchError} from 'rxjs/operators';\nimport {Injectable} from '@angular/core';\nimport {throwError} from 'rxjs';\n\n@Injectable()\nexport class ErrorInterceptor implements HttpInterceptor {\n\n // State.\n private readonly _disabled = this._config?.disableErrorParsing ?? false;\n\n constructor(private _config: HttpConfig) {\n }\n\n intercept(request: HttpRequest<unknown>, next: HttpHandler) {\n return next.handle(request).pipe(\n catchError(error => {\n // If we have a matching http error response\n // re-map it with our custom class (if not disabled).\n if (!this._disabled && error instanceof HttpErrorResponse) {\n const parsed = new HttpError(error);\n return throwError(() => parsed);\n }\n\n // We did not match anything, just re-trow the error.\n return throwError(() => error);\n })\n );\n }\n\n}\n","import {InjectionToken, ModuleWithProviders, NgModule, Optional, SkipSelf} from '@angular/core';\nimport {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';\nimport {BaseUrlInterceptor} from './interceptors/base-url.interceptor';\nimport {ErrorInterceptor} from './interceptors/error.interceptor';\nimport {HttpConfigData} from './http.interfaces';\nimport {HttpConfig} from './classes/http.config';\n\n@NgModule({\n imports: [HttpClientModule]\n})\nexport class HttpModule {\n\n constructor(@Optional() @SkipSelf() private _parent?: HttpModule) {\n if (this._parent) {\n throw new Error('HttpModule is already loaded; Import it in the core module only.');\n }\n }\n\n static forRoot(config: HttpConfigData): ModuleWithProviders<HttpModule> {\n return {\n ngModule: HttpModule,\n providers: [\n {provide: HTTP_CONFIGURATION_DATA, useValue: config},\n {provide: HttpConfig, useFactory: createHttpConfig, deps: [HTTP_CONFIGURATION_DATA]},\n {provide: HTTP_INTERCEPTORS, useClass: BaseUrlInterceptor, multi: true},\n {provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true}\n ]\n };\n }\n\n}\n\nexport const HTTP_CONFIGURATION_DATA = new InjectionToken<HttpConfigData>('HTTP_CONFIGURATION_DATA');\n\nexport function createHttpConfig(data: HttpConfigData) {\n return new HttpConfig(data);\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.HttpConfig"],"mappings":";;;;;;MAIa,UAAU,CAAA;AAOnB,IAAA,WAAA,CAAY,IAAoB,EAAA;;QAcxB,IAAA,CAAA,YAAY,GAAG,CAAC,KAAoB,EAAE,aAAqB,KAAI;;AACnE,YAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC3B,KAAK,GAAG,EAAC,CAAC,aAAa,GAAG,KAAK,EAAC,CAAC;AACpC,aAAA;AAED,YAAA,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,EAAE;gBAC/C,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,gBAAA,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE;AACvB,oBAAA,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;AACzD,wBAAA,CAAA,EAAA,GAAA,OAAO,KAAA,IAAA,IAAP,OAAO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A,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,YAFT,gBAAgB,CAAA,EAAA,CAAA,CAAA;AAEjB,UAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,YAFT,gBAAgB,CAAA,EAAA,CAAA,CAAA;2FAEjB,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,gBAAgB,CAAC;iBAC9B,CAAA;;;8BAGgB,QAAQ;;8BAAI,QAAQ;;;MAoBxB,uBAAuB,GAAG,IAAI,cAAc,CAAiB,yBAAyB,EAAE;AAE/F,SAAU,gBAAgB,CAAC,IAAoB,EAAA;AACjD,IAAA,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAChC;;ACpCA;;AAEG;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Optional, Inject, Directive, Input, Component, ChangeDetectionStrategy, ViewEncapsulation, ContentChildren, Injectable, Pipe, APP_INITIALIZER,
|
|
2
|
+
import { InjectionToken, Optional, Inject, Directive, Input, Component, ChangeDetectionStrategy, ViewEncapsulation, ContentChildren, Injectable, inject, LOCALE_ID, Pipe, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { formatDate, DOCUMENT, CommonModule } from '@angular/common';
|
|
5
5
|
import { __awaiter, __decorate, __param } from 'tslib';
|
|
6
|
-
import { startWith } from 'rxjs/operators';
|
|
7
|
-
import { Subscription } from 'rxjs';
|
|
6
|
+
import { startWith, map, distinctUntilChanged } from 'rxjs/operators';
|
|
7
|
+
import { Subscription, BehaviorSubject, of } from 'rxjs';
|
|
8
8
|
import * as i2 from '@bravobit/bb-foundation/utils';
|
|
9
9
|
import { UtilsModule } from '@bravobit/bb-foundation/utils';
|
|
10
10
|
import * as i2$1 from '@bravobit/bb-foundation';
|
|
@@ -258,7 +258,6 @@ class LocalizeDictionary {
|
|
|
258
258
|
const dictionaryIds = (Array.isArray(to) ? to : [to]);
|
|
259
259
|
const dictionaries = [];
|
|
260
260
|
for (const dictionaryId of dictionaryIds) {
|
|
261
|
-
console.log(`Making sure dictionary "${dictionaryId}" is loaded.`);
|
|
262
261
|
const dictionary = yield this._localize.load(dictionaryId);
|
|
263
262
|
dictionaries.push(dictionary);
|
|
264
263
|
}
|
|
@@ -280,11 +279,10 @@ class LocalizeDictionary {
|
|
|
280
279
|
}
|
|
281
280
|
}
|
|
282
281
|
const compareDictionaryIds = dictionaries.map(dictionary => dictionary === null || dictionary === void 0 ? void 0 : dictionary.id).join(', ');
|
|
283
|
-
console.log(`Comparing currency dictionary [${this.id}] with [${compareDictionaryIds}]...`);
|
|
284
282
|
for (const warning of warnings) {
|
|
285
283
|
(_a = console === null || console === void 0 ? void 0 : console.warn) === null || _a === void 0 ? void 0 : _a.call(console, `Dictionary "${warning.dictionary}" is missing token "${warning.value}"`);
|
|
286
284
|
}
|
|
287
|
-
(_b = console === null || console === void 0 ? void 0 : console.warn) === null || _b === void 0 ? void 0 : _b.call(console, `Total of ${warnings.length} warning(s) found.`);
|
|
285
|
+
(_b = console === null || console === void 0 ? void 0 : console.warn) === null || _b === void 0 ? void 0 : _b.call(console, `Total of ${warnings.length} warning(s) found while comparing "${this.id}" -> [${compareDictionaryIds}].`);
|
|
288
286
|
}
|
|
289
287
|
});
|
|
290
288
|
}
|
|
@@ -420,9 +418,9 @@ class BbLocalizeTemplate {
|
|
|
420
418
|
this.name = null;
|
|
421
419
|
}
|
|
422
420
|
}
|
|
423
|
-
BbLocalizeTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
424
|
-
BbLocalizeTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.
|
|
425
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
421
|
+
BbLocalizeTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbLocalizeTemplate, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
422
|
+
BbLocalizeTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.1", type: BbLocalizeTemplate, selector: "[bbLocalizeTemplate]", inputs: { name: ["bbLocalizeTemplate", "name"] }, ngImport: i0 });
|
|
423
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbLocalizeTemplate, decorators: [{
|
|
426
424
|
type: Directive,
|
|
427
425
|
args: [{
|
|
428
426
|
selector: '[bbLocalizeTemplate]'
|
|
@@ -500,9 +498,9 @@ class BbLocalizeString {
|
|
|
500
498
|
];
|
|
501
499
|
}
|
|
502
500
|
}
|
|
503
|
-
BbLocalizeString.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
504
|
-
BbLocalizeString.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.
|
|
505
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
501
|
+
BbLocalizeString.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbLocalizeString, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
502
|
+
BbLocalizeString.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.1", type: BbLocalizeString, selector: "bb-localize-string, [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 [bbTemplate]=\"component\">{{ component }}</ng-template>\n</ng-container>\n", styles: [".bb-localize-string{display:inline}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
503
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbLocalizeString, decorators: [{
|
|
506
504
|
type: Component,
|
|
507
505
|
args: [{ selector: 'bb-localize-string, [bb-localize-string]', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: {
|
|
508
506
|
'class': 'bb-localize-string'
|
|
@@ -532,7 +530,9 @@ class Localize {
|
|
|
532
530
|
this._bestMatchingLanguage = this.retrieveBestMatchingLanguage();
|
|
533
531
|
this._loadedDictionaries = new Map();
|
|
534
532
|
// Current dictionary.
|
|
535
|
-
this._current = null;
|
|
533
|
+
this._current$ = new BehaviorSubject(null);
|
|
534
|
+
// State changes.
|
|
535
|
+
this.dictionaryChanges$ = this._current$.asObservable();
|
|
536
536
|
this.convertToParams = (tokenOrParams) => {
|
|
537
537
|
if (typeof tokenOrParams !== 'string') {
|
|
538
538
|
// Destruct the params from the object.
|
|
@@ -551,7 +551,7 @@ class Localize {
|
|
|
551
551
|
return (_a = this._availableLanguages) !== null && _a !== void 0 ? _a : [];
|
|
552
552
|
}
|
|
553
553
|
get current() {
|
|
554
|
-
return this._current;
|
|
554
|
+
return this._current$.getValue();
|
|
555
555
|
}
|
|
556
556
|
load(id) {
|
|
557
557
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -574,19 +574,28 @@ class Localize {
|
|
|
574
574
|
return dictionary;
|
|
575
575
|
});
|
|
576
576
|
}
|
|
577
|
+
loadAllLanguages() {
|
|
578
|
+
var _a;
|
|
579
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
580
|
+
for (const language of this.languages) {
|
|
581
|
+
yield this.load((_a = this.current) === null || _a === void 0 ? void 0 : _a.id);
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
}
|
|
577
585
|
switch(id, options) {
|
|
578
|
-
var _a, _b, _c, _d, _e
|
|
586
|
+
var _a, _b, _c, _d, _e;
|
|
579
587
|
return __awaiter(this, void 0, void 0, function* () {
|
|
580
|
-
|
|
588
|
+
const dictionary = yield this.load(id);
|
|
589
|
+
this._current$.next(dictionary);
|
|
581
590
|
const cache = (_a = options === null || options === void 0 ? void 0 : options.cache) !== null && _a !== void 0 ? _a : true;
|
|
582
591
|
if (cache) {
|
|
583
|
-
this._storage.cookie.set(this._storageToken,
|
|
592
|
+
this._storage.cookie.set(this._storageToken, dictionary === null || dictionary === void 0 ? void 0 : dictionary.id, {});
|
|
584
593
|
}
|
|
585
|
-
const reload = (
|
|
594
|
+
const reload = (_b = options === null || options === void 0 ? void 0 : options.reload) !== null && _b !== void 0 ? _b : false;
|
|
586
595
|
if (reload) {
|
|
587
|
-
(
|
|
596
|
+
(_e = (_d = (_c = this._window) === null || _c === void 0 ? void 0 : _c.location) === null || _d === void 0 ? void 0 : _d.reload) === null || _e === void 0 ? void 0 : _e.call(_d);
|
|
588
597
|
}
|
|
589
|
-
return
|
|
598
|
+
return dictionary;
|
|
590
599
|
});
|
|
591
600
|
}
|
|
592
601
|
select(id) {
|
|
@@ -596,7 +605,11 @@ class Localize {
|
|
|
596
605
|
return this._loadedDictionaries.get(id);
|
|
597
606
|
}
|
|
598
607
|
initialize() {
|
|
599
|
-
return () => __awaiter(this, void 0, void 0, function* () {
|
|
608
|
+
return () => __awaiter(this, void 0, void 0, function* () {
|
|
609
|
+
var _a;
|
|
610
|
+
yield this.switch((_a = this._bestMatchingLanguage) === null || _a === void 0 ? void 0 : _a.id, { reload: false, cache: false });
|
|
611
|
+
return this.compareDictionaries();
|
|
612
|
+
});
|
|
600
613
|
}
|
|
601
614
|
clear() {
|
|
602
615
|
this._storage.cookie.remove(this._storageToken);
|
|
@@ -642,7 +655,7 @@ class Localize {
|
|
|
642
655
|
}
|
|
643
656
|
getDictionary(id) {
|
|
644
657
|
if (id === null || id === undefined) {
|
|
645
|
-
return this.
|
|
658
|
+
return this.current;
|
|
646
659
|
}
|
|
647
660
|
return this.select(id);
|
|
648
661
|
}
|
|
@@ -654,10 +667,21 @@ class Localize {
|
|
|
654
667
|
}
|
|
655
668
|
element.lang = (_d = (_c = (_b = this._bestMatchingLanguage) === null || _b === void 0 ? void 0 : _b.supported) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : (_e = this._bestMatchingLanguage) === null || _e === void 0 ? void 0 : _e.locale;
|
|
656
669
|
}
|
|
670
|
+
compareDictionaries() {
|
|
671
|
+
var _a, _b, _c, _d;
|
|
672
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
673
|
+
const compareDictionaries = (_a = this._config.compareDictionaries) !== null && _a !== void 0 ? _a : false;
|
|
674
|
+
if (!compareDictionaries || !this.current) {
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
const languageIds = (_d = (_c = ((_b = this.languages) !== null && _b !== void 0 ? _b : [])) === null || _c === void 0 ? void 0 : _c.filter(language => { var _a; return (language === null || language === void 0 ? void 0 : language.id) !== ((_a = this.current) === null || _a === void 0 ? void 0 : _a.id); })) === null || _d === void 0 ? void 0 : _d.map(language => language === null || language === void 0 ? void 0 : language.id);
|
|
678
|
+
return yield this.current.compare(languageIds);
|
|
679
|
+
});
|
|
680
|
+
}
|
|
657
681
|
}
|
|
658
|
-
Localize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
659
|
-
Localize.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
660
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
682
|
+
Localize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.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 });
|
|
683
|
+
Localize.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Localize });
|
|
684
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Localize, decorators: [{
|
|
661
685
|
type: Injectable
|
|
662
686
|
}], ctorParameters: function () {
|
|
663
687
|
return [{ type: i1$1.Storage }, { type: i2$1.Languages }, { type: LocalizeMissingHandler }, { type: LocalizeConfig, decorators: [{
|
|
@@ -680,6 +704,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
680
704
|
}] }];
|
|
681
705
|
} });
|
|
682
706
|
|
|
707
|
+
const LOCALIZE_ID = new InjectionToken('An abstraction over locale changes', {
|
|
708
|
+
factory: () => {
|
|
709
|
+
var _a, _b;
|
|
710
|
+
const localize = inject(Localize, { optional: true });
|
|
711
|
+
if (!localize) {
|
|
712
|
+
return of(inject(LOCALE_ID));
|
|
713
|
+
}
|
|
714
|
+
return localize.dictionaryChanges$.pipe(map(dictionary => { var _a; return (_a = dictionary === null || dictionary === void 0 ? void 0 : dictionary.locale) !== null && _a !== void 0 ? _a : null; }), distinctUntilChanged(), startWith((_b = (_a = localize === null || localize === void 0 ? void 0 : localize.current) === null || _a === void 0 ? void 0 : _a.locale) !== null && _b !== void 0 ? _b : null));
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
|
|
683
718
|
class BbLocalize {
|
|
684
719
|
constructor(_localize) {
|
|
685
720
|
this._localize = _localize;
|
|
@@ -713,9 +748,9 @@ class BbLocalize {
|
|
|
713
748
|
return Object.assign(Object.assign({}, params), options);
|
|
714
749
|
}
|
|
715
750
|
}
|
|
716
|
-
BbLocalize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
717
|
-
BbLocalize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.
|
|
718
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
751
|
+
BbLocalize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbLocalize, deps: [{ token: Localize, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
752
|
+
BbLocalize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.1", ngImport: i0, type: BbLocalize, name: "bbLocalize" });
|
|
753
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbLocalize, decorators: [{
|
|
719
754
|
type: Pipe,
|
|
720
755
|
args: [{
|
|
721
756
|
name: 'bbLocalize'
|
|
@@ -728,11 +763,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
728
763
|
|
|
729
764
|
class LocalizeModule {
|
|
730
765
|
static forRoot(config) {
|
|
731
|
-
var _a, _b;
|
|
766
|
+
var _a, _b, _c;
|
|
732
767
|
if (((_a = config === null || config === void 0 ? void 0 : config.languages) === null || _a === void 0 ? void 0 : _a.length) <= 0) {
|
|
733
768
|
throw new Error('One or more languages should be supplied.');
|
|
734
769
|
}
|
|
735
|
-
|
|
770
|
+
if ((config === null || config === void 0 ? void 0 : config.compareDictionaries) && (config === null || config === void 0 ? void 0 : config.mode) === 'manual') {
|
|
771
|
+
(_b = console === null || console === void 0 ? void 0 : console.warn) === null || _b === void 0 ? void 0 : _b.call(console, 'You cannot enable "compareDictionaries" when having mode set to "manual"; This setting will be ignored.');
|
|
772
|
+
}
|
|
773
|
+
const mode = (_c = config === null || config === void 0 ? void 0 : config.mode) !== null && _c !== void 0 ? _c : 'automatic';
|
|
736
774
|
return {
|
|
737
775
|
ngModule: LocalizeModule,
|
|
738
776
|
providers: [
|
|
@@ -758,14 +796,14 @@ class LocalizeModule {
|
|
|
758
796
|
};
|
|
759
797
|
}
|
|
760
798
|
}
|
|
761
|
-
LocalizeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
762
|
-
LocalizeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.
|
|
799
|
+
LocalizeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: LocalizeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
800
|
+
LocalizeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.1", ngImport: i0, type: LocalizeModule, declarations: [BbLocalize,
|
|
763
801
|
BbLocalizeString,
|
|
764
802
|
BbLocalizeTemplate], imports: [CommonModule, UtilsModule], exports: [BbLocalize,
|
|
765
803
|
BbLocalizeString,
|
|
766
804
|
BbLocalizeTemplate] });
|
|
767
|
-
LocalizeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.
|
|
768
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
805
|
+
LocalizeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: LocalizeModule, imports: [CommonModule, UtilsModule] });
|
|
806
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: LocalizeModule, decorators: [{
|
|
769
807
|
type: NgModule,
|
|
770
808
|
args: [{
|
|
771
809
|
imports: [CommonModule, UtilsModule],
|
|
@@ -793,5 +831,5 @@ function getLocale(localize) {
|
|
|
793
831
|
* Generated bundle index. Do not edit.
|
|
794
832
|
*/
|
|
795
833
|
|
|
796
|
-
export { BbLocalize, BbLocalizeString, BbLocalizeTemplate, LOCALIZE_FUNCTION, LOCALIZE_TRANSFORM, Localize, LocalizeConfig, LocalizeDateFunction, LocalizeDictionary, LocalizeDictionaryContext, LocalizeDictionaryData, LocalizeInterpolateTransform, LocalizeLowercaseFunction, LocalizeMissingHandler, LocalizeModule, LocalizeReferenceTransform, LocalizeTransform, LocalizeUppercaseFunction, extraDutchDictionary, extraEnglishDictionary, getLocale, initializeLocale };
|
|
834
|
+
export { BbLocalize, BbLocalizeString, BbLocalizeTemplate, LOCALIZE_FUNCTION, LOCALIZE_ID, LOCALIZE_TRANSFORM, Localize, LocalizeConfig, LocalizeDateFunction, LocalizeDictionary, LocalizeDictionaryContext, LocalizeDictionaryData, LocalizeInterpolateTransform, LocalizeLowercaseFunction, LocalizeMissingHandler, LocalizeModule, LocalizeReferenceTransform, LocalizeTransform, LocalizeUppercaseFunction, extraDutchDictionary, extraEnglishDictionary, getLocale, initializeLocale };
|
|
797
835
|
//# sourceMappingURL=bravobit-bb-foundation-localize.mjs.map
|