@bravobit/bb-foundation 0.29.2 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth/lib/auth.service.d.ts +1 -2
- package/esm2022/auth/lib/auth.interceptor.mjs +5 -5
- package/esm2022/auth/lib/auth.module.mjs +4 -4
- package/esm2022/auth/lib/auth.service.mjs +10 -11
- package/esm2022/auth/lib/directives/authenticated.directive.mjs +5 -5
- package/esm2022/auth/lib/guards/anonymous.guard.mjs +5 -5
- package/esm2022/auth/lib/guards/authenticated.guard.mjs +5 -5
- package/esm2022/collections/lib/collections.module.mjs +4 -4
- package/esm2022/collections/lib/components/collections-pager/collections-pager.component.mjs +4 -4
- package/esm2022/collections/lib/components/collections-viewer/collections-viewer.component.mjs +3 -3
- package/esm2022/collections/lib/components/collections.directive.mjs +12 -12
- package/esm2022/controls/lib/checkbox/checkbox/checkbox.component.mjs +5 -5
- package/esm2022/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +5 -5
- package/esm2022/controls/lib/checkbox/checkbox.module.mjs +4 -4
- package/esm2022/controls/lib/control-error/control-error/control-error.component.mjs +6 -6
- package/esm2022/controls/lib/control-error/control-error-submit.directive.mjs +4 -4
- package/esm2022/controls/lib/control-error/control-error.module.mjs +4 -4
- package/esm2022/controls/lib/controls.module.mjs +4 -4
- package/esm2022/controls/lib/form-control/form-control/form-control.component.mjs +6 -6
- package/esm2022/controls/lib/form-control/form-control-addon/form-control-addon.component.mjs +4 -4
- package/esm2022/controls/lib/form-control/form-control-input.directive.mjs +6 -6
- package/esm2022/controls/lib/form-control/form-control.module.mjs +4 -4
- package/esm2022/controls/lib/radio/radio-button/radio-button.component.mjs +5 -5
- package/esm2022/controls/lib/radio/radio-group/radio-group.component.mjs +6 -6
- package/esm2022/controls/lib/radio/radio.module.mjs +4 -4
- package/esm2022/controls/lib/toggle/toggle/toggle.component.mjs +5 -5
- package/esm2022/controls/lib/toggle/toggle-group/toggle-group.component.mjs +5 -5
- package/esm2022/controls/lib/toggle/toggle.module.mjs +4 -4
- package/esm2022/dashboard/lib/dashboard/dashboard.component.mjs +5 -5
- package/esm2022/dashboard/lib/dashboard-header/dashboard-header.component.mjs +5 -5
- package/esm2022/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +3 -3
- package/esm2022/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +4 -4
- package/esm2022/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +4 -4
- package/esm2022/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +6 -6
- package/esm2022/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +6 -6
- package/esm2022/dashboard/lib/dashboard.module.mjs +4 -4
- package/esm2022/dialog/lib/dialog-actions/dialog-actions.component.mjs +3 -3
- package/esm2022/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +5 -5
- package/esm2022/dialog/lib/dialog-container/dialog-container.component.mjs +5 -5
- package/esm2022/dialog/lib/dialog-header/dialog-header.component.mjs +3 -3
- package/esm2022/dialog/lib/dialog-link/dialog-link.component.mjs +4 -4
- package/esm2022/dialog/lib/dialog-modal/dialog-modal.component.mjs +6 -6
- package/esm2022/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +5 -5
- package/esm2022/dialog/lib/dialog.insertion.mjs +4 -4
- package/esm2022/dialog/lib/dialog.module.mjs +4 -4
- package/esm2022/dialog/lib/dialog.service.mjs +4 -4
- package/esm2022/elements/lib/avatar/avatar.component.mjs +3 -3
- package/esm2022/elements/lib/button/button.component.mjs +9 -9
- package/esm2022/elements/lib/checkbox/checkbox.component.mjs +5 -5
- package/esm2022/elements/lib/date-picker/date-picker.component.mjs +6 -6
- package/esm2022/elements/lib/directives/addon.directive.mjs +6 -6
- package/esm2022/elements/lib/directives/form-submit.directive.mjs +5 -5
- package/esm2022/elements/lib/directives/form-submitter.directive.mjs +3 -3
- package/esm2022/elements/lib/directives/input.directive.mjs +11 -11
- package/esm2022/elements/lib/dropdown/dropdown.component.mjs +10 -10
- package/esm2022/elements/lib/elements.module.mjs +4 -4
- package/esm2022/elements/lib/file-picker/file-picker.component.mjs +6 -6
- package/esm2022/elements/lib/form-control/form-control.component.mjs +4 -4
- package/esm2022/elements/lib/form-error/form-error.component.mjs +6 -6
- package/esm2022/elements/lib/form-group/form-group.component.mjs +3 -3
- package/esm2022/elements/lib/icon/icon.component.mjs +6 -6
- package/esm2022/elements/lib/image-picker/image-picker.component.mjs +5 -5
- package/esm2022/elements/lib/pipes/file-image.pipe.mjs +4 -4
- package/esm2022/elements/lib/pipes/file-size.pipe.mjs +3 -3
- package/esm2022/elements/lib/pipes/relative-time.pipe.mjs +5 -5
- package/esm2022/elements/lib/spinner/spinner.component.mjs +3 -3
- package/esm2022/elements/lib/tag/tag.component.mjs +3 -3
- package/esm2022/http/lib/http.module.mjs +7 -7
- package/esm2022/http/lib/interceptors/base-url.interceptor.mjs +5 -5
- package/esm2022/http/lib/interceptors/error.interceptor.mjs +4 -4
- package/esm2022/lib/core/services/clipboard.service.mjs +5 -5
- package/esm2022/lib/core/services/exif.service.mjs +4 -4
- package/esm2022/lib/core/services/file-loader.service.mjs +3 -3
- package/esm2022/lib/core/services/image-converter.service.mjs +4 -4
- package/esm2022/lib/core/services/languages.service.mjs +5 -5
- package/esm2022/lib/core/services/network.service.mjs +5 -5
- package/esm2022/lib/core/services/patch.service.mjs +5 -5
- package/esm2022/localize/lib/interfaces/config.interfaces.mjs +1 -1
- package/esm2022/localize/lib/localize.module.mjs +7 -5
- package/esm2022/localize/lib/localize.pipe.mjs +5 -5
- package/esm2022/localize/lib/localize.service.mjs +7 -7
- package/esm2022/localize/lib/transforms/interpolate.transform.mjs +3 -2
- package/esm2022/localize/lib/transforms/plural.transform.mjs +56 -0
- package/esm2022/localize/lib/transforms/reference.transform.mjs +3 -2
- package/esm2022/localize/lib/views/localize-string/localize-string.component.mjs +9 -10
- package/esm2022/localize/lib/views/localize-template.directive.mjs +5 -5
- package/esm2022/localize/public_api.mjs +2 -1
- package/esm2022/masking/lib/directives/currency-mask.directive.mjs +6 -6
- package/esm2022/masking/lib/directives/date-mask.directive.mjs +6 -6
- package/esm2022/masking/lib/directives/input-mask.directive.mjs +6 -6
- package/esm2022/masking/lib/masking.module.mjs +4 -4
- package/esm2022/masking/lib/masking.service.mjs +5 -5
- package/esm2022/notifications/lib/notifications-item/notifications-item.component.mjs +5 -5
- package/esm2022/notifications/lib/notifications-list/notifications-list.component.mjs +5 -5
- package/esm2022/notifications/lib/notifications.module.mjs +4 -4
- package/esm2022/notifications/lib/notifications.service.mjs +5 -5
- package/esm2022/permissions/lib/directives/permission.directive.mjs +5 -5
- package/esm2022/permissions/lib/guards/permission.guard.mjs +5 -5
- package/esm2022/permissions/lib/permissions.module.mjs +4 -4
- package/esm2022/permissions/lib/permissions.service.mjs +4 -4
- package/esm2022/recaptcha/lib/recaptcha/recaptcha.component.mjs +6 -6
- package/esm2022/recaptcha/lib/recaptcha-loader.service.mjs +5 -5
- package/esm2022/recaptcha/lib/recaptcha.module.mjs +4 -4
- package/esm2022/storage/lib/storage.service.mjs +5 -5
- package/esm2022/table/lib/components/table/table.component.mjs +9 -9
- package/esm2022/table/lib/components/table-cell/table-cell.component.mjs +3 -3
- package/esm2022/table/lib/components/table-header-cell/table-header-cell.component.mjs +6 -6
- package/esm2022/table/lib/components/table-pager/table-pager.component.mjs +5 -5
- package/esm2022/table/lib/table.module.mjs +4 -4
- package/esm2022/theming/lib/theming.directive.mjs +5 -5
- package/esm2022/theming/lib/theming.module.mjs +4 -4
- package/esm2022/tooltip/lib/tooltip-container/tooltip-container.component.mjs +6 -6
- package/esm2022/tooltip/lib/tooltip.directive.mjs +5 -5
- package/esm2022/tooltip/lib/tooltip.module.mjs +4 -4
- package/esm2022/utils/lib/directives/autosize.directive.mjs +5 -5
- package/esm2022/utils/lib/directives/focus-trap.directive.mjs +5 -5
- package/esm2022/utils/lib/directives/focus.directive.mjs +4 -4
- package/esm2022/utils/lib/directives/template.directive.mjs +5 -5
- package/esm2022/utils/lib/utils.module.mjs +4 -4
- package/fesm2022/bravobit-bb-foundation-auth.mjs +31 -32
- package/fesm2022/bravobit-bb-foundation-auth.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-collections.mjs +23 -23
- package/fesm2022/bravobit-bb-foundation-collections.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-controls.mjs +74 -74
- package/fesm2022/bravobit-bb-foundation-controls.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dashboard.mjs +34 -34
- package/fesm2022/bravobit-bb-foundation-dashboard.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dialog.mjs +40 -40
- package/fesm2022/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-elements.mjs +104 -104
- package/fesm2022/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-http.mjs +15 -15
- package/fesm2022/bravobit-bb-foundation-http.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-localize.mjs +82 -30
- package/fesm2022/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-masking.mjs +25 -25
- package/fesm2022/bravobit-bb-foundation-masking.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-notifications.mjs +18 -18
- package/fesm2022/bravobit-bb-foundation-notifications.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-permissions.mjs +17 -17
- package/fesm2022/bravobit-bb-foundation-permissions.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs +14 -14
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-rxjs.mjs +1 -1
- package/fesm2022/bravobit-bb-foundation-storage.mjs +5 -5
- package/fesm2022/bravobit-bb-foundation-table.mjs +26 -26
- package/fesm2022/bravobit-bb-foundation-table.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-theming.mjs +8 -8
- package/fesm2022/bravobit-bb-foundation-theming.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-tooltip.mjs +13 -13
- package/fesm2022/bravobit-bb-foundation-tooltip.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-utils.mjs +20 -20
- package/fesm2022/bravobit-bb-foundation-utils.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation.mjs +31 -31
- package/localize/lib/interfaces/config.interfaces.d.ts +1 -0
- package/localize/lib/transforms/plural.transform.d.ts +17 -0
- package/localize/lib/views/localize-string/localize-string.component.d.ts +1 -1
- package/localize/public_api.d.ts +1 -0
- package/package.json +36 -36
|
@@ -102,15 +102,15 @@ class BaseUrlInterceptor {
|
|
|
102
102
|
}
|
|
103
103
|
return null;
|
|
104
104
|
}
|
|
105
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
106
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
105
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: BaseUrlInterceptor, deps: [{ token: HttpConfig }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
106
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: BaseUrlInterceptor }); }
|
|
107
107
|
}
|
|
108
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
108
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: BaseUrlInterceptor, decorators: [{
|
|
109
109
|
type: Injectable
|
|
110
|
-
}], ctorParameters:
|
|
110
|
+
}], ctorParameters: () => [{ type: HttpConfig }, { type: Object, decorators: [{
|
|
111
111
|
type: Inject,
|
|
112
112
|
args: [PLATFORM_ID]
|
|
113
|
-
}] }]
|
|
113
|
+
}] }] });
|
|
114
114
|
|
|
115
115
|
class ErrorInterceptor {
|
|
116
116
|
constructor(_config) {
|
|
@@ -130,12 +130,12 @@ class ErrorInterceptor {
|
|
|
130
130
|
return throwError(() => error);
|
|
131
131
|
}));
|
|
132
132
|
}
|
|
133
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
134
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
133
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: ErrorInterceptor, deps: [{ token: HttpConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
134
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: ErrorInterceptor }); }
|
|
135
135
|
}
|
|
136
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
136
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: ErrorInterceptor, decorators: [{
|
|
137
137
|
type: Injectable
|
|
138
|
-
}], ctorParameters:
|
|
138
|
+
}], ctorParameters: () => [{ type: HttpConfig }] });
|
|
139
139
|
|
|
140
140
|
class HttpModule {
|
|
141
141
|
constructor(_parent) {
|
|
@@ -155,20 +155,20 @@ class HttpModule {
|
|
|
155
155
|
]
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
159
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
160
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
158
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: HttpModule, deps: [{ token: HttpModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
159
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.2", ngImport: i0, type: HttpModule, imports: [HttpClientModule] }); }
|
|
160
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: HttpModule, imports: [HttpClientModule] }); }
|
|
161
161
|
}
|
|
162
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
162
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: HttpModule, decorators: [{
|
|
163
163
|
type: NgModule,
|
|
164
164
|
args: [{
|
|
165
165
|
imports: [HttpClientModule]
|
|
166
166
|
}]
|
|
167
|
-
}], ctorParameters:
|
|
167
|
+
}], ctorParameters: () => [{ type: HttpModule, decorators: [{
|
|
168
168
|
type: Optional
|
|
169
169
|
}, {
|
|
170
170
|
type: SkipSelf
|
|
171
|
-
}] }]
|
|
171
|
+
}] }] });
|
|
172
172
|
const HTTP_CONFIGURATION_DATA = new InjectionToken('HTTP_CONFIGURATION_DATA');
|
|
173
173
|
function createHttpConfig(data) {
|
|
174
174
|
return new HttpConfig(data);
|
|
@@ -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 {HttpConfigAlias, HttpConfigData, HttpConfigUrl} from '../http.interfaces';\n\ndeclare let ngDevMode;\n\nexport class HttpConfig {\n\n readonly aliases: HttpConfigAlias[];\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 = this.aliases?.[0]?.alias ?? null;\n this.defaultAlias = `${this.prefix}${firstAvailableAlias}`;\n }\n\n private parseAliases = (value: HttpConfigUrl, standardAlias: string) => {\n if (!Array.isArray(value)) {\n value = [{alias: standardAlias, url: value}];\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const stringRegex = /^[a-zA-Z]+$/;\n for (const item of value) {\n if (!!item?.alias && !stringRegex.test(item?.alias)) {\n console?.warn?.(`[HttpModule]: Invalid HTTP-alias in HttpConfig named \"${item?.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 {HttpConfigAlias, HttpConfigPlatformUrl} from '../http.interfaces';\nimport {Inject, Injectable, PLATFORM_ID} from '@angular/core';\nimport {HttpConfig} from '../classes/http.config';\nimport {isPlatformServer} from '@angular/common';\n\ndeclare let ngDevMode;\n\n@Injectable()\nexport class BaseUrlInterceptor implements HttpInterceptor {\n\n // Aliases.\n private readonly _aliases: HttpConfigAlias[] = 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 @Inject(PLATFORM_ID) private _platformId: Object) {\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 const stringAlias = this.convertUrlToString(alias?.url);\n if (!stringAlias) {\n return previous;\n }\n\n return previous.replace(current, stringAlias);\n }, url);\n }\n\n private convertUrlToString(url: HttpConfigPlatformUrl) {\n if (typeof url === 'string') {\n return url;\n }\n\n return isPlatformServer(this._platformId)\n ? url?.server ?? url?.browser ?? null\n : url?.browser ?? null;\n }\n\n private getAlias(value: string) {\n const alias = value.replace(this._prefix, '');\n const fetched = this._aliases?.find(item => item.alias === alias) ?? null;\n if (fetched) {\n return fetched;\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const available = this._aliases\n .map(item => `\\$${item?.alias}`)\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;AAcxB,QAAA,IAAA,CAAA,YAAY,GAAG,CAAC,KAAoB,EAAE,aAAqB,KAAI;AACnE,YAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,K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AAE,IAAI,EAAC;AACxE,aAAA;SACJ,CAAC;KACL;8GAlBQ,UAAU,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAAV,IAAA,SAAA,IAAA,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,EAAA;AAEjB,IAAA,SAAA,IAAA,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,EAAA;;2FAEjB,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,gBAAgB,CAAC;AAC9B,iBAAA,CAAA;;0BAGgB,QAAQ;;0BAAI,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 {HttpConfigAlias, HttpConfigData, HttpConfigUrl} from '../http.interfaces';\n\ndeclare let ngDevMode;\n\nexport class HttpConfig {\n\n readonly aliases: HttpConfigAlias[];\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 = this.aliases?.[0]?.alias ?? null;\n this.defaultAlias = `${this.prefix}${firstAvailableAlias}`;\n }\n\n private parseAliases = (value: HttpConfigUrl, standardAlias: string) => {\n if (!Array.isArray(value)) {\n value = [{alias: standardAlias, url: value}];\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const stringRegex = /^[a-zA-Z]+$/;\n for (const item of value) {\n if (!!item?.alias && !stringRegex.test(item?.alias)) {\n console?.warn?.(`[HttpModule]: Invalid HTTP-alias in HttpConfig named \"${item?.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 {HttpConfigAlias, HttpConfigPlatformUrl} from '../http.interfaces';\nimport {Inject, Injectable, PLATFORM_ID} from '@angular/core';\nimport {HttpConfig} from '../classes/http.config';\nimport {isPlatformServer} from '@angular/common';\n\ndeclare let ngDevMode;\n\n@Injectable()\nexport class BaseUrlInterceptor implements HttpInterceptor {\n\n // Aliases.\n private readonly _aliases: HttpConfigAlias[] = 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 @Inject(PLATFORM_ID) private _platformId: Object) {\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 const stringAlias = this.convertUrlToString(alias?.url);\n if (!stringAlias) {\n return previous;\n }\n\n return previous.replace(current, stringAlias);\n }, url);\n }\n\n private convertUrlToString(url: HttpConfigPlatformUrl) {\n if (typeof url === 'string') {\n return url;\n }\n\n return isPlatformServer(this._platformId)\n ? url?.server ?? url?.browser ?? null\n : url?.browser ?? null;\n }\n\n private getAlias(value: string) {\n const alias = value.replace(this._prefix, '');\n const fetched = this._aliases?.find(item => item.alias === alias) ?? null;\n if (fetched) {\n return fetched;\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const available = this._aliases\n .map(item => `\\$${item?.alias}`)\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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.HttpConfig"],"mappings":";;;;;;;MAIa,UAAU,CAAA;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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
|
-
import {
|
|
5
|
+
import { __param, __decorate } from 'tslib';
|
|
6
6
|
import { startWith, map, distinctUntilChanged } from 'rxjs/operators';
|
|
7
7
|
import { Subscription, BehaviorSubject, of } from 'rxjs';
|
|
8
8
|
import * as i2 from '@bravobit/bb-foundation/utils';
|
|
@@ -331,6 +331,58 @@ class LocalizeTransform {
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
+
let LocalizePluralTransform = class LocalizePluralTransform extends LocalizeTransform {
|
|
335
|
+
constructor(config) {
|
|
336
|
+
super();
|
|
337
|
+
this.config = config;
|
|
338
|
+
this.substitutions = this.config?.substitutions?.plural ?? ['@plural(', ')'];
|
|
339
|
+
this.defaultAmount = 'default';
|
|
340
|
+
this.multiItemRegex = new RegExp(`(?<value>=([0-9]+|${this.defaultAmount}): *[^,]+)`, 'g');
|
|
341
|
+
this.singleItemRegex = new RegExp(`(=(?<amount>[0-9]+|${this.defaultAmount}): *(?<sentence>.+))`);
|
|
342
|
+
}
|
|
343
|
+
execute(value, data, _) {
|
|
344
|
+
const matches = this.getMatches(value, this.substitutions);
|
|
345
|
+
return matches.reduce((previous, current) => {
|
|
346
|
+
const [variable, content] = current.token?.split('|');
|
|
347
|
+
const amount = this.extractAmount(variable, data);
|
|
348
|
+
const pluralToken = this.parsePluralToken(content, amount);
|
|
349
|
+
return previous.replace(current?.match, pluralToken ?? current?.match);
|
|
350
|
+
}, value);
|
|
351
|
+
}
|
|
352
|
+
extractAmount(variable, data) {
|
|
353
|
+
const trimmedVariable = variable?.trim();
|
|
354
|
+
const value = data?.[trimmedVariable] ?? null;
|
|
355
|
+
return typeof value === 'string' || typeof value === 'number'
|
|
356
|
+
? value
|
|
357
|
+
: null;
|
|
358
|
+
}
|
|
359
|
+
parsePluralToken(value, amount) {
|
|
360
|
+
const plural = this.getPluralObject(value);
|
|
361
|
+
return plural?.[amount] ?? plural?.[this.defaultAmount] ?? null;
|
|
362
|
+
}
|
|
363
|
+
splitMatches(value) {
|
|
364
|
+
let match = this.multiItemRegex.exec(value);
|
|
365
|
+
const matches = [];
|
|
366
|
+
while (match !== null) {
|
|
367
|
+
matches.push(match[0]);
|
|
368
|
+
match = this.multiItemRegex.exec(value);
|
|
369
|
+
}
|
|
370
|
+
return matches;
|
|
371
|
+
}
|
|
372
|
+
getPluralObject(value) {
|
|
373
|
+
const matches = this.splitMatches(value);
|
|
374
|
+
return matches.reduce((previous, current) => {
|
|
375
|
+
const result = current.match(this.singleItemRegex);
|
|
376
|
+
const amount = result.groups['amount'].trim();
|
|
377
|
+
const sentence = result.groups['sentence'].trim();
|
|
378
|
+
return { ...previous, [amount]: sentence };
|
|
379
|
+
}, {});
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
LocalizePluralTransform = __decorate([
|
|
383
|
+
__param(0, Optional())
|
|
384
|
+
], LocalizePluralTransform);
|
|
385
|
+
|
|
334
386
|
let LocalizeInterpolateTransform = class LocalizeInterpolateTransform extends LocalizeTransform {
|
|
335
387
|
constructor(config, functions) {
|
|
336
388
|
super();
|
|
@@ -407,15 +459,15 @@ class BbLocalizeTemplate {
|
|
|
407
459
|
// Inputs.
|
|
408
460
|
this.name = null;
|
|
409
461
|
}
|
|
410
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
411
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
462
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: BbLocalizeTemplate, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
463
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.2", type: BbLocalizeTemplate, selector: "[bbLocalizeTemplate]", inputs: { name: ["bbLocalizeTemplate", "name"] }, ngImport: i0 }); }
|
|
412
464
|
}
|
|
413
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
465
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: BbLocalizeTemplate, decorators: [{
|
|
414
466
|
type: Directive,
|
|
415
467
|
args: [{
|
|
416
468
|
selector: '[bbLocalizeTemplate]'
|
|
417
469
|
}]
|
|
418
|
-
}], ctorParameters:
|
|
470
|
+
}], ctorParameters: () => [{ type: i0.TemplateRef }], propDecorators: { name: [{
|
|
419
471
|
type: Input,
|
|
420
472
|
args: ['bbLocalizeTemplate']
|
|
421
473
|
}] } });
|
|
@@ -431,7 +483,7 @@ class BbLocalizeString {
|
|
|
431
483
|
constructor(_changeDetection) {
|
|
432
484
|
this._changeDetection = _changeDetection;
|
|
433
485
|
// Inputs.
|
|
434
|
-
this.substitutions = ['
|
|
486
|
+
this.substitutions = ['@element(', ')'];
|
|
435
487
|
// Data.
|
|
436
488
|
this.components = [];
|
|
437
489
|
// Subscriptions.
|
|
@@ -484,21 +536,20 @@ class BbLocalizeString {
|
|
|
484
536
|
end.replace(escape, '\\$&')
|
|
485
537
|
];
|
|
486
538
|
}
|
|
487
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
488
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
539
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: BbLocalizeString, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
540
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.2", type: BbLocalizeString, 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: "<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 }); }
|
|
489
541
|
}
|
|
490
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
542
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: BbLocalizeString, decorators: [{
|
|
491
543
|
type: Component,
|
|
492
|
-
args: [{ selector: '
|
|
493
|
-
|
|
494
|
-
}, 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"] }]
|
|
495
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { items: [{
|
|
544
|
+
args: [{ selector: '[bb-localize-string]', changeDetection: ChangeDetectionStrategy.OnPush, host: { 'class': 'bb-localize-string' }, 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"] }]
|
|
545
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { items: [{
|
|
496
546
|
type: ContentChildren,
|
|
497
547
|
args: [BbLocalizeTemplate]
|
|
498
548
|
}], substitutions: [{
|
|
499
549
|
type: Input
|
|
500
550
|
}], value: [{
|
|
501
|
-
type: Input
|
|
551
|
+
type: Input,
|
|
552
|
+
args: ['bb-localize-string']
|
|
502
553
|
}] } });
|
|
503
554
|
|
|
504
555
|
class Localize {
|
|
@@ -558,7 +609,7 @@ class Localize {
|
|
|
558
609
|
}
|
|
559
610
|
async loadAllLanguages() {
|
|
560
611
|
for (const language of this.languages) {
|
|
561
|
-
await this.load(
|
|
612
|
+
await this.load(language?.id);
|
|
562
613
|
}
|
|
563
614
|
}
|
|
564
615
|
async switch(id, options) {
|
|
@@ -651,12 +702,12 @@ class Localize {
|
|
|
651
702
|
?.map(language => language?.id);
|
|
652
703
|
return await this.current.compare(languageIds);
|
|
653
704
|
}
|
|
654
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
655
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
705
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", 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 }); }
|
|
706
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: Localize }); }
|
|
656
707
|
}
|
|
657
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
708
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: Localize, decorators: [{
|
|
658
709
|
type: Injectable
|
|
659
|
-
}], ctorParameters:
|
|
710
|
+
}], ctorParameters: () => [{ type: i1$1.Storage }, { type: i2$1.Languages }, { type: LocalizeMissingHandler }, { type: LocalizeConfig, decorators: [{
|
|
660
711
|
type: Optional
|
|
661
712
|
}] }, { type: Window, decorators: [{
|
|
662
713
|
type: Optional
|
|
@@ -673,7 +724,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImpor
|
|
|
673
724
|
}, {
|
|
674
725
|
type: Inject,
|
|
675
726
|
args: [LOCALIZE_TRANSFORM]
|
|
676
|
-
}] }]
|
|
727
|
+
}] }] });
|
|
677
728
|
|
|
678
729
|
const LOCALIZE_ID = new InjectionToken('An abstraction over locale changes', {
|
|
679
730
|
factory: () => {
|
|
@@ -716,17 +767,17 @@ class BbLocalize {
|
|
|
716
767
|
// Return the combined params and options.
|
|
717
768
|
return { ...params, ...options };
|
|
718
769
|
}
|
|
719
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
720
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
770
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: BbLocalize, deps: [{ token: Localize, optional: true }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
771
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.0.2", ngImport: i0, type: BbLocalize, name: "bbLocalize" }); }
|
|
721
772
|
}
|
|
722
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
773
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: BbLocalize, decorators: [{
|
|
723
774
|
type: Pipe,
|
|
724
775
|
args: [{
|
|
725
776
|
name: 'bbLocalize'
|
|
726
777
|
}]
|
|
727
|
-
}], ctorParameters:
|
|
778
|
+
}], ctorParameters: () => [{ type: Localize, decorators: [{
|
|
728
779
|
type: Optional
|
|
729
|
-
}] }]
|
|
780
|
+
}] }] });
|
|
730
781
|
|
|
731
782
|
class LocalizeModule {
|
|
732
783
|
static forRoot(config) {
|
|
@@ -752,6 +803,7 @@ class LocalizeModule {
|
|
|
752
803
|
{ provide: LOCALIZE_FUNCTION, useClass: LocalizeUppercaseFunction, multi: true },
|
|
753
804
|
{ provide: LOCALIZE_FUNCTION, useClass: LocalizeDateFunction, multi: true },
|
|
754
805
|
// Transform providers.
|
|
806
|
+
{ provide: LOCALIZE_TRANSFORM, useClass: LocalizePluralTransform, deps: [LocalizeConfig], multi: true },
|
|
755
807
|
{ provide: LOCALIZE_TRANSFORM, useClass: LocalizeReferenceTransform, deps: [LocalizeConfig], multi: true },
|
|
756
808
|
{ provide: LOCALIZE_TRANSFORM, useClass: LocalizeInterpolateTransform, deps: [LocalizeConfig, LOCALIZE_FUNCTION], multi: true },
|
|
757
809
|
// Handler providers.
|
|
@@ -761,15 +813,15 @@ class LocalizeModule {
|
|
|
761
813
|
]
|
|
762
814
|
};
|
|
763
815
|
}
|
|
764
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
765
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
816
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: LocalizeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
817
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.2", ngImport: i0, type: LocalizeModule, declarations: [BbLocalize,
|
|
766
818
|
BbLocalizeString,
|
|
767
819
|
BbLocalizeTemplate], imports: [CommonModule, UtilsModule], exports: [BbLocalize,
|
|
768
820
|
BbLocalizeString,
|
|
769
821
|
BbLocalizeTemplate] }); }
|
|
770
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
822
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: LocalizeModule, imports: [CommonModule, UtilsModule] }); }
|
|
771
823
|
}
|
|
772
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
824
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: LocalizeModule, decorators: [{
|
|
773
825
|
type: NgModule,
|
|
774
826
|
args: [{
|
|
775
827
|
imports: [CommonModule, UtilsModule],
|
|
@@ -796,5 +848,5 @@ function getLocale(localize) {
|
|
|
796
848
|
* Generated bundle index. Do not edit.
|
|
797
849
|
*/
|
|
798
850
|
|
|
799
|
-
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 };
|
|
851
|
+
export { BbLocalize, BbLocalizeString, BbLocalizeTemplate, LOCALIZE_FUNCTION, LOCALIZE_ID, LOCALIZE_TRANSFORM, Localize, LocalizeConfig, LocalizeDateFunction, LocalizeDictionary, LocalizeDictionaryContext, LocalizeDictionaryData, LocalizeInterpolateTransform, LocalizeLowercaseFunction, LocalizeMissingHandler, LocalizeModule, LocalizePluralTransform, LocalizeReferenceTransform, LocalizeTransform, LocalizeUppercaseFunction, extraDutchDictionary, extraEnglishDictionary, getLocale, initializeLocale };
|
|
800
852
|
//# sourceMappingURL=bravobit-bb-foundation-localize.mjs.map
|