@eui/core 17.0.1 → 17.0.2-snapshot-1701743166803

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.
@@ -1,14 +1,3 @@
1
- /**
2
- * Angular is using a gulp task to generate the locales that we dynamically import. This task can be found here
3
- * https://github.com/angular/angular/blob/master/tools/gulp-tasks/cldr/cldr-data.js
4
- * That task is utilizing the CLDR library to load and construct the locale for each region. This service is responsible
5
- * to load those locale dynamically upon request and to update the state of the eUI app.
6
- *
7
- * Parts that are handles through configuration:
8
- * - update of the LOCALE_ID token
9
- * - initial dynamical load of locales
10
- * - bind to translation service for locale changes
11
- */
12
1
  import { InjectionToken, OnDestroy } from '@angular/core';
13
2
  import { EuiService, EuiServiceStatus, GlobalConfig, LocaleServiceConfig, LocaleState } from '@eui/base';
14
3
  import { Observable } from 'rxjs';
@@ -16,8 +5,20 @@ import { StoreService } from '../store';
16
5
  import { LogService } from '../log';
17
6
  import { I18nService } from '../i18n';
18
7
  import * as i0 from "@angular/core";
19
- export type LocaleMapper = (locale: string) => any;
8
+ export type LocaleMapper = (locale: string) => string;
20
9
  export declare const LOCALE_ID_MAPPER: InjectionToken<LocaleMapper>;
10
+ /**
11
+ * LocaleService is responsible for managing locale states and configurations in an Angular application.
12
+ * It utilizes the CLDR library to load and construct the locale for each region. This service allows
13
+ * for dynamic loading of locales upon request and updates the state of the EUI app accordingly.
14
+ *
15
+ * Key functionalities include:
16
+ * - Binding to a translation service for locale changes.
17
+ * - Updating the Angular LOCALE_ID token.
18
+ *
19
+ * @template T - Extends LocaleState, representing the state structure for locales.
20
+ * @extends EuiService<T | LocaleState>
21
+ */
21
22
  export declare class LocaleService<T extends LocaleState = LocaleState> extends EuiService<T | LocaleState> implements OnDestroy {
22
23
  protected store: StoreService;
23
24
  protected baseGlobalConfig: GlobalConfig;
@@ -30,39 +31,81 @@ export declare class LocaleService<T extends LocaleState = LocaleState> extends
30
31
  protected config: LocaleServiceConfig;
31
32
  constructor(store: StoreService, baseGlobalConfig: GlobalConfig, locale_id: string, localeMapper: LocaleMapper, i18n: I18nService, log: LogService);
32
33
  ngOnDestroy(): void;
34
+ /**
35
+ * Retrieves the state of the locale service. This method is overloaded to allow different ways of accessing the state.
36
+ *
37
+ * @template K - The type of the value to be returned. Defaults to the type of the locale state (T).
38
+ *
39
+ * @param {((state: T) => K)} [mapFn] - A function that maps the state to a specific form.
40
+ * Takes the current state as an argument and returns the transformed state.
41
+ * @returns {Observable<K>} - An observable that emits the transformed state.
42
+ */
33
43
  getState<K = T>(mapFn?: (state: T) => K): Observable<K>;
44
+ /**
45
+ * @template a - A key that extends the keys of the state type T.
46
+ * @param {a} [key] - A specific key to access a part of the state.
47
+ * The key should be a property name of the state object.
48
+ * @returns {Observable<T[a]>} - An observable that emits the value of the specified key in the state.
49
+ * @param key
50
+ */
34
51
  getState<a extends keyof T>(key?: a): Observable<T[a]>;
52
+ /**
53
+ * Initializes the LocaleService with necessary configurations and state.
54
+ * Binds language changes to the state and dynamically loads the appropriate locales.
55
+ *
56
+ * @param {LocaleState | undefined} [state] - Optional initial state for the locale service.
57
+ * @returns {Observable<EuiServiceStatus>} - Observable emitting the status of the initialization.
58
+ */
35
59
  init(state?: LocaleState | undefined): Observable<EuiServiceStatus>;
36
60
  /**
37
- * dynamically load locale and update the state
61
+ * Updates the locale state within the application. If the new state is not available,
62
+ * it throws an error. Also updates the global LOCALE_ID token if configured to do so.
63
+ *
64
+ * @param {LocaleState} state - The new state to be set for the locale.
65
+ * @throws Will throw an error if the locale for the given state id is not available.
38
66
  */
39
67
  updateState(state: LocaleState): void;
68
+ /**
69
+ * @deprecated eui does not offer a way to dynamically add locale it will be removed in future versions
70
+ *
71
+ * @param id
72
+ */
40
73
  addLocale(id: string): Observable<EuiServiceStatus>;
74
+ /**
75
+ * Retrieves the previous locale used in the application.
76
+ *
77
+ * @returns {string} - The previous locale identifier.
78
+ */
41
79
  get previousLocale(): string;
80
+ /**
81
+ * Retrieves the current locale used in the application.
82
+ *
83
+ * @returns {string} - The current locale identifier.
84
+ */
42
85
  get currentLocale(): string;
43
86
  /**
44
- * load and register locale data dynamically
87
+ * @deprecated eui does not offer a way to dynamically add locale it will be removed in future versions
45
88
  *
46
- * @param locale array of locale to load
89
+ * Dynamically loads and registers locale data based on the given locale identifiers.
90
+ *
91
+ * @param {string[] | string} locale - An array of locale identifiers or a single locale identifier.
92
+ * @returns {Observable<EuiServiceStatus>} - Observable emitting the status of the loading process.
93
+ * @private
47
94
  */
48
95
  private loadLocale;
49
96
  /**
50
- * listen for language changes and dynamically set locale accordingly. In case of non registered locale register it
51
- * dynamically.
97
+ * Listens for language changes and dynamically sets the locale accordingly.
98
+ *
99
+ * @private
52
100
  */
53
101
  private bindTranslateServiceLangChangeToState;
54
102
  /**
55
- * retrieve locales from browser
103
+ * Retrieves an array of locale identifiers supported by the browser.
56
104
  *
57
- * @param options
105
+ * @returns {string[] | undefined} - An array of browser locale identifiers or undefined if not available.
106
+ * @private
58
107
  */
59
108
  private getBrowserLocales;
60
- /**
61
- * if locale is already registered filtered out.
62
- *
63
- * @param locales A string array contains all locale id e.g. ["el", "el-CY"]
64
- */
65
- private filterRegisteredLocales;
66
109
  static ɵfac: i0.ɵɵFactoryDeclaration<LocaleService<any>, [null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>;
67
110
  static ɵprov: i0.ɵɵInjectableDeclaration<LocaleService<any>>;
68
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"locale.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/locale/locale.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAsB,cAAc,EAAa,SAAS,EAAY,MAAM,eAAe,CAAC;AAEnG,OAAO,EACH,UAAU,EACV,gBAAgB,EAGhB,YAAY,EACZ,mBAAmB,EACnB,WAAW,EAEd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAA2B,MAAM,MAAM,CAAC;AAE3D,OAA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2-snapshot-1701743166803",
4
+ "tag": "snapshot",
5
5
  "description": "eUI core package - holding UI components for Desktop applications",
6
6
  "homepage": "https://eui.ecdevops.eu",
7
7
  "author": "ec.europa.eui@gmail.com",