@eui/core 15.0.0-rc.1 → 15.0.0-rc.2

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.
@@ -6,7 +6,7 @@ import { InjectionToken, Injectable, Inject, Injector, NgModule, Optional, APP_I
6
6
  import * as extendProxy from 'extend';
7
7
  import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';
8
8
  import { MomentDateAdapter } from '@angular/material-moment-adapter';
9
- import { LOCATION_INITIALIZED, DOCUMENT, isPlatformBrowser, getLocaleId, registerLocaleData } from '@angular/common';
9
+ import { LOCATION_INITIALIZED, DOCUMENT, isPlatformBrowser, getLocaleId } from '@angular/common';
10
10
  import { throwError, forkJoin, of, BehaviorSubject, defer, merge, fromEvent, Observable, Subject, from } from 'rxjs';
11
11
  import { debounceTime, distinctUntilChanged, map, catchError, switchMap, tap, filter, take, mapTo, mergeMap, concatMap, takeUntil } from 'rxjs/operators';
12
12
  import * as i1$1 from '@ngrx/store';
@@ -4124,23 +4124,31 @@ class LocaleService extends EuiService {
4124
4124
  * @param locale array of locale to load
4125
4125
  */
4126
4126
  loadLocale(locale) {
4127
- locale = Array.isArray(locale) ? locale : [locale];
4128
- const localeImports = this.filterRegisteredLocales(locale).map(this.importDataAndExtraLocale.bind(this));
4129
- // in case localeImports array is empty because locale exists, Observable still needs to complete
4130
- if (localeImports.length < 1) {
4131
- return of({ success: true });
4132
- }
4133
- return forkJoin(...localeImports).pipe(takeUntil(this.subNotifier), map(localeData => {
4134
- // filter out null results and registerLocaleData including extra
4135
- localeData.filter(({ data }) => data)
4136
- .forEach(({ data, localeId, extraData }) => registerLocaleData(data, localeId, extraData));
4137
- return { success: true };
4138
- }), catchError(error => {
4139
- if (this.log) {
4140
- this.logger.debug(`Locale load error: ${error.message}`, error);
4141
- }
4142
- return of({ success: false, error: error });
4143
- }));
4127
+ // locale = Array.isArray(locale) ? locale : [locale];
4128
+ // const localeImports: Observable<{ data: any, localeId: string, extraData: any }>[]
4129
+ // = this.filterRegisteredLocales(locale).map(this.importDataAndExtraLocale.bind(this));
4130
+ //
4131
+ // // in case localeImports array is empty because locale exists, Observable still needs to complete
4132
+ // if (localeImports.length < 1) {
4133
+ // return of({ success: true });
4134
+ // }
4135
+ //
4136
+ // return forkJoin(...localeImports).pipe(
4137
+ // takeUntil(this.subNotifier),
4138
+ // map(localeData => {
4139
+ // // filter out null results and registerLocaleData including extra
4140
+ // localeData.filter(({ data }) => data)
4141
+ // .forEach(({ data, localeId, extraData }) => registerLocaleData(data, localeId, extraData));
4142
+ // return { success: true };
4143
+ // }),
4144
+ // catchError(error => {
4145
+ // if (this.log) {
4146
+ // this.logger.debug(`Locale load error: ${error.message}`, error);
4147
+ // }
4148
+ // return of({ success: false, error: error });
4149
+ // })
4150
+ // );
4151
+ return of({ success: true });
4144
4152
  }
4145
4153
  /**
4146
4154
  * listen for language changes and dynamically set locale accordingly. In case of non registered locale register it
@@ -4211,57 +4219,6 @@ class LocaleService extends EuiService {
4211
4219
  }
4212
4220
  });
4213
4221
  }
4214
- /**
4215
- * returns an Observable which loads the locale based on provided ID
4216
- *
4217
- * @param id the locale id e.g. en, el-CY
4218
- * @private
4219
- */
4220
- importLocale(id) {
4221
- // in case of an error, catch it and return null
4222
- return import(
4223
- /* webpackExclude: /\.d\.ts$/ */
4224
- /* webpackMode: "lazy-once" */
4225
- /* webpackChunkName: "i18n-base" */
4226
- `@/../node_modules/@angular/common/locales/${id}`)
4227
- .then(m => m.default)
4228
- .catch(error => {
4229
- if (this.log) {
4230
- this.logger.debug(`Locale with ID: "${id}" failed to load. Error: ${error.message}`, error);
4231
- }
4232
- return null;
4233
- });
4234
- }
4235
- /**
4236
- * returns a Promise which loads the locale based on provided ID
4237
- *
4238
- * @param id the locale id e.g. en, el-CY
4239
- * @private
4240
- */
4241
- importExtraLocale(id) {
4242
- // in case of an error, catch it and return null
4243
- return import(
4244
- /* webpackExclude: /\.d\.ts$/ */
4245
- /* webpackMode: "lazy-once" */
4246
- /* webpackChunkName: "i18n-extra" */
4247
- `@/../node_modules/@angular/common/locales/extra/${id}`)
4248
- .then(m => m.default)
4249
- .catch(error => {
4250
- if (this.log) {
4251
- this.logger.debug(`Extra Locale with ID: "${id}" failed to load. Error: ${error.message}`, error);
4252
- }
4253
- return null;
4254
- });
4255
- }
4256
- /**
4257
- * Imports Locale and then Extra. It returns the Object which registerLocale(...) function needs.
4258
- *
4259
- * @param localeId The id of the locale
4260
- * @private
4261
- */
4262
- importDataAndExtraLocale(localeId) {
4263
- return from(this.importLocale(localeId)).pipe(mergeMap((data) => from(this.importExtraLocale(localeId)).pipe(map((extraData) => Object.assign({}, { data, localeId, extraData }))), 1));
4264
- }
4265
4222
  }
4266
4223
  /** @nocollapse */ LocaleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.4", ngImport: i0, type: LocaleService, deps: [{ token: StoreService }, { token: GLOBAL_CONFIG_TOKEN }, { token: LOCALE_ID }, { token: LOCALE_ID_MAPPER, optional: true }, { token: I18nService, optional: true }, { token: LogService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
4267
4224
  /** @nocollapse */ LocaleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.4", ngImport: i0, type: LocaleService, providedIn: 'root' });