@eui/core 19.0.0-next.9 → 19.0.0-rc.10
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/docs/classes/ActivatedRouteAction.html +17 -8
- package/docs/classes/AddApiQueueItemAction.html +17 -8
- package/docs/classes/AddAppLoadedConfigModulesAction.html +17 -8
- package/docs/classes/ApiQueueServiceMock.html +34 -9
- package/docs/classes/AsyncStorageService.html +7 -6
- package/docs/classes/AsyncStorageServiceMock.html +7 -6
- package/docs/classes/CssUtils.html +7 -6
- package/docs/classes/EmptyApiQueueAction.html +17 -8
- package/docs/classes/ErrorSubClass.html +7 -6
- package/docs/classes/EuiCoreRootGuardClass.html +7 -6
- package/docs/classes/EuiError.html +7 -6
- package/docs/classes/I18nResourceImpl.html +7 -6
- package/docs/classes/InitStoreAction.html +17 -8
- package/docs/classes/LogServiceMock.html +7 -6
- package/docs/classes/RemoveApiQueueItemAction.html +17 -8
- package/docs/classes/StorageService.html +7 -6
- package/docs/classes/StorageServiceMock.html +7 -6
- package/docs/classes/TranslateServiceMock.html +7 -6
- package/docs/classes/UpdateAppConnectionAction.html +17 -8
- package/docs/classes/UpdateAppStatusAction.html +17 -8
- package/docs/classes/UpdateAppVersionAction.html +17 -8
- package/docs/classes/UpdateCurrentModuleAction.html +17 -8
- package/docs/classes/UpdateI18nStateAction.html +17 -8
- package/docs/classes/UpdateLocaleStateAction.html +17 -8
- package/docs/classes/UpdateNotificationsListAction.html +17 -8
- package/docs/classes/UpdateUserDashboardAction.html +17 -8
- package/docs/classes/UpdateUserDetailsAction.html +17 -8
- package/docs/classes/UpdateUserPreferencesAction.html +17 -8
- package/docs/classes/UpdateUserRightsAction.html +17 -8
- package/docs/classes/UpdateUserStateAction.html +17 -8
- package/docs/dependencies.html +47 -66
- package/docs/directives/TranslateMockDirective.html +7 -6
- package/docs/index.html +9 -8
- package/docs/injectables/ApiQueueService.html +25 -8
- package/docs/injectables/EuiAppShellService.html +16 -7
- package/docs/injectables/EuiDynamicComponentService.html +7 -6
- package/docs/injectables/EuiDynamicMenuService.html +7 -6
- package/docs/injectables/EuiGrowlService.html +7 -6
- package/docs/injectables/EuiLoaderService.html +7 -6
- package/docs/injectables/EuiPermissionService.html +7 -6
- package/docs/injectables/EuiThemeService.html +7 -6
- package/docs/injectables/EuiTimezoneService.html +7 -6
- package/docs/injectables/GlobalErrorHandler.html +8 -7
- package/docs/injectables/I18nLoader.html +7 -6
- package/docs/injectables/I18nService.html +200 -23
- package/docs/injectables/I18nServiceMock.html +44 -7
- package/docs/injectables/LocalForageService.html +7 -6
- package/docs/injectables/LocalStorageService.html +7 -6
- package/docs/injectables/LocaleService.html +126 -50
- package/docs/injectables/LocaleServiceMock.html +15 -47
- package/docs/injectables/LogService.html +7 -6
- package/docs/injectables/SessionStorageService.html +7 -6
- package/docs/injectables/StoreService.html +280 -71
- package/docs/injectables/StoreServiceMock.html +15 -36
- package/docs/injectables/UserService.html +104 -27
- package/docs/injectables/UserServiceMock.html +45 -7
- package/docs/interceptors/AddLangParamInterceptor.html +9 -8
- package/docs/interceptors/CachePreventionInterceptor.html +9 -8
- package/docs/interceptors/CorsSecurityInterceptor.html +9 -8
- package/docs/interceptors/CsrfPreventionInterceptor.html +9 -8
- package/docs/interceptors/EuLoginSessionTimeoutHandlingInterceptor.html +9 -8
- package/docs/interceptors/HttpErrorHandlerInterceptor.html +11 -10
- package/docs/interceptors/UxRequestErrorModelInterceptor.html +11 -10
- package/docs/interfaces/Action.html +271 -0
- package/docs/interfaces/ActionReducer.html +270 -0
- package/docs/interfaces/Dependency.html +7 -6
- package/docs/interfaces/EuiTimeZone.html +7 -6
- package/docs/interfaces/IEuiTheme.html +7 -6
- package/docs/interfaces/Library.html +7 -6
- package/docs/interfaces/LoadedResources.html +7 -6
- package/docs/interfaces/LoadedResourcesError.html +7 -6
- package/docs/interfaces/MemoizedSelector.html +408 -0
- package/docs/interfaces/MemoizedSelectorWithProps.html +415 -0
- package/docs/interfaces/ModuleLoadEvent.html +7 -6
- package/docs/interfaces/Policy.html +7 -6
- package/docs/interfaces/ResourceError.html +7 -6
- package/docs/interfaces/ThemeState.html +7 -6
- package/docs/interfaces/TranslationKeys.html +224 -0
- package/docs/interfaces/UIState.html +7 -6
- package/docs/interfaces/body.html +7 -6
- package/docs/js/libs/bootstrap-native.js +1 -1
- package/docs/js/menu-wc.js +33 -21
- package/docs/js/menu-wc_es5.js +1 -1
- package/docs/js/menu.js +10 -11
- package/docs/js/search/search-lunr.js +6 -8
- package/docs/js/search/search.js +107 -102
- package/docs/js/search/search_index.js +2 -2
- package/docs/license.html +7 -6
- package/docs/miscellaneous/enumerations.html +42 -16
- package/docs/miscellaneous/functions.html +944 -66
- package/docs/miscellaneous/typealiases.html +239 -19
- package/docs/miscellaneous/variables.html +290 -169
- package/docs/modules/CoreModule.html +7 -6
- package/docs/modules/I18nModule.html +7 -6
- package/docs/modules/LogModule.html +7 -6
- package/docs/modules/TranslateMockModule.html +7 -6
- package/docs/modules.html +7 -6
- package/docs/pipes/TranslateMockPipe.html +7 -6
- package/docs/properties.html +7 -6
- package/docs/styles/compodoc.css +11 -8
- package/fesm2022/eui-core.mjs +663 -488
- package/fesm2022/eui-core.mjs.map +1 -1
- package/lib/eui-core.module.d.ts.map +1 -1
- package/lib/services/app/eui-init-app.d.ts +10 -1
- package/lib/services/app/eui-init-app.d.ts.map +1 -1
- package/lib/services/app/eui-pre-init-app.d.ts.map +1 -1
- package/lib/services/app/eui-startup.d.ts.map +1 -1
- package/lib/services/app/index.d.ts +1 -0
- package/lib/services/app/index.d.ts.map +1 -1
- package/lib/services/config/defaults.d.ts.map +1 -1
- package/lib/services/eui-app-shell.service.d.ts +1 -1
- package/lib/services/eui-app-shell.service.d.ts.map +1 -1
- package/lib/services/i18n/i18n.loader.d.ts +10 -1
- package/lib/services/i18n/i18n.loader.d.ts.map +1 -1
- package/lib/services/i18n/i18n.service.d.ts +32 -8
- package/lib/services/i18n/i18n.service.d.ts.map +1 -1
- package/lib/services/locale/locale.service.d.ts +18 -32
- package/lib/services/locale/locale.service.d.ts.map +1 -1
- package/lib/services/locale/locale.service.mock.d.ts +1 -1
- package/lib/services/locale/locale.service.mock.d.ts.map +1 -1
- package/lib/services/permission/permission.service.d.ts.map +1 -1
- package/lib/services/queue/api-queue.service.d.ts +18 -3
- package/lib/services/queue/api-queue.service.d.ts.map +1 -1
- package/lib/services/queue/api-queue.service.mock.d.ts +2 -2
- package/lib/services/queue/api-queue.service.mock.d.ts.map +1 -1
- package/lib/services/store/actions/app.actions.d.ts +37 -1
- package/lib/services/store/actions/app.actions.d.ts.map +1 -1
- package/lib/services/store/actions/i18n.actions.d.ts +10 -1
- package/lib/services/store/actions/i18n.actions.d.ts.map +1 -1
- package/lib/services/store/actions/locale.actions.d.ts +10 -1
- package/lib/services/store/actions/locale.actions.d.ts.map +1 -1
- package/lib/services/store/actions/notifications.actions.d.ts +10 -1
- package/lib/services/store/actions/notifications.actions.d.ts.map +1 -1
- package/lib/services/store/actions/user.actions.d.ts +22 -1
- package/lib/services/store/actions/user.actions.d.ts.map +1 -1
- package/lib/services/store/index.d.ts +0 -1
- package/lib/services/store/index.d.ts.map +1 -1
- package/lib/services/store/ngrx_kit.d.ts +54 -0
- package/lib/services/store/ngrx_kit.d.ts.map +1 -0
- package/lib/services/store/reducers/app.reducers.d.ts +4 -1
- package/lib/services/store/reducers/app.reducers.d.ts.map +1 -1
- package/lib/services/store/reducers/core.reducers.d.ts +4 -1
- package/lib/services/store/reducers/core.reducers.d.ts.map +1 -1
- package/lib/services/store/reducers/i18n.reducers.d.ts +4 -1
- package/lib/services/store/reducers/i18n.reducers.d.ts.map +1 -1
- package/lib/services/store/reducers/locale.reducers.d.ts +4 -1
- package/lib/services/store/reducers/locale.reducers.d.ts.map +1 -1
- package/lib/services/store/reducers/meta.reducers.d.ts +5 -1
- package/lib/services/store/reducers/meta.reducers.d.ts.map +1 -1
- package/lib/services/store/reducers/notifications.reducers.d.ts +4 -1
- package/lib/services/store/reducers/notifications.reducers.d.ts.map +1 -1
- package/lib/services/store/reducers/user.reducers.d.ts +4 -1
- package/lib/services/store/reducers/user.reducers.d.ts.map +1 -1
- package/lib/services/store/store.service.d.ts +40 -12
- package/lib/services/store/store.service.d.ts.map +1 -1
- package/lib/services/user/user.service.d.ts +32 -6
- package/lib/services/user/user.service.d.ts.map +1 -1
- package/package.json +2 -2
- package/docs/injectables/CoreAppEffects.html +0 -468
- package/lib/services/store/effects/app.effects.d.ts +0 -21
- package/lib/services/store/effects/app.effects.d.ts.map +0 -1
- package/lib/services/store/effects/index.d.ts +0 -4
- package/lib/services/store/effects/index.d.ts.map +0 -1
package/fesm2022/eui-core.mjs
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import * as i1 from '@eui/base';
|
|
2
|
-
import { LogLevel, ConsoleAppender, initialAppState, initialUserState, initialNotificationsState, initialI18nState, initialLocaleState, Logger, LoggerMock,
|
|
2
|
+
import { LogLevel, ConsoleAppender, initialAppState, initialUserState, initialNotificationsState, initialI18nState, initialLocaleState, Logger, LoggerMock, initialCoreState, xhr, mergeAll, getI18nLoaderConfig, EuiLazyService, getI18nServiceConfigFromBase, getBrowserDefaultLanguage, EuiEuLanguages, EuiService, getUserState, getLocaleServiceConfigFromBase, transformToUxHttpResponse } from '@eui/base';
|
|
3
3
|
export * from '@eui/base';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { InjectionToken,
|
|
5
|
+
import { InjectionToken, inject, PLATFORM_ID, Injectable, Inject, Injector, NgModule, signal, computed, runInInjectionContext, Optional, SkipSelf, provideAppInitializer, ErrorHandler, LOCALE_ID } from '@angular/core';
|
|
6
6
|
import * as extendProxy from 'extend';
|
|
7
|
-
import * as i1$1 from '@ngrx/effects';
|
|
8
|
-
import { createEffect, ofType } from '@ngrx/effects';
|
|
9
|
-
import { merge, fromEvent, of, throwError, forkJoin, from, BehaviorSubject, defer, firstValueFrom, Subject } from 'rxjs';
|
|
10
|
-
import { map, mergeMap, tap, debounceTime, distinctUntilChanged, take, switchMap, catchError, concatMap, filter, takeUntil } from 'rxjs/operators';
|
|
11
7
|
import { isPlatformBrowser, LOCATION_INITIALIZED, DOCUMENT, isPlatformServer, getLocaleId, registerLocaleData } from '@angular/common';
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
8
|
+
import { filter, debounceTime, distinctUntilChanged, tap, take, map, switchMap, catchError, concatMap, takeUntil } from 'rxjs/operators';
|
|
9
|
+
import { toObservable } from '@angular/core/rxjs-interop';
|
|
10
|
+
import { isEqual } from 'lodash';
|
|
11
|
+
import { of, forkJoin, from, Subject, BehaviorSubject, defer, firstValueFrom } from 'rxjs';
|
|
16
12
|
import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';
|
|
17
13
|
import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
|
18
|
-
import * as i1$
|
|
14
|
+
import * as i1$2 from '@angular/common/http';
|
|
19
15
|
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
|
|
20
|
-
import * as i1$
|
|
16
|
+
import * as i1$1 from '@angular/router';
|
|
21
17
|
import { NavigationEnd } from '@angular/router';
|
|
18
|
+
import { createSelector } from 'reselect';
|
|
19
|
+
import * as i1$3 from '@ngx-translate/core';
|
|
20
|
+
import { TranslateLoader } from '@ngx-translate/core';
|
|
22
21
|
import { By } from '@angular/platform-browser';
|
|
23
22
|
import { FormGroup, FormArray } from '@angular/forms';
|
|
24
23
|
import { DomPortalOutlet, ComponentPortal, PortalInjector } from '@angular/cdk/portal';
|
|
25
|
-
import isEqual from 'lodash-es/isEqual';
|
|
24
|
+
import isEqual$1 from 'lodash-es/isEqual';
|
|
26
25
|
import get from 'lodash-es/get';
|
|
27
26
|
import * as lf from 'localforage';
|
|
28
27
|
import localeFr from '@angular/common/locales/fr';
|
|
29
28
|
import localeEl from '@angular/common/locales/el';
|
|
29
|
+
import { of as of$1 } from 'rxjs/internal/observable/of';
|
|
30
30
|
|
|
31
31
|
/** default log configuration */
|
|
32
32
|
const DEFAULT_LOG_CONFIG = {
|
|
@@ -43,10 +43,7 @@ const DEFAULT_I18N_SERVICE_CONFIG = {
|
|
|
43
43
|
};
|
|
44
44
|
const DEFAULT_I18N_LOADER_CONFIG = {};
|
|
45
45
|
const DEFAULT_LOCALE_SERVICE_CONFIG = {
|
|
46
|
-
available: ['en'],
|
|
47
|
-
registered: ['en'],
|
|
48
46
|
bindWithTranslate: false,
|
|
49
|
-
affectGlobalLocale: false,
|
|
50
47
|
};
|
|
51
48
|
const DEFAULT_HTTP_ERROR_HANDLER_CONFIG = {
|
|
52
49
|
routes: [],
|
|
@@ -161,6 +158,9 @@ function mergeAppJsonConfigToAppConfig(euiAppConfig, envAppJsonConfig, merge, is
|
|
|
161
158
|
return Object.assign({}, euiAppConfig, envAppJsonConfig, deepMerged);
|
|
162
159
|
}
|
|
163
160
|
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated it will be removed in the next major version
|
|
163
|
+
*/
|
|
164
164
|
var CoreAppActionTypes;
|
|
165
165
|
(function (CoreAppActionTypes) {
|
|
166
166
|
CoreAppActionTypes["INIT_STORE"] = "[App] Init store";
|
|
@@ -174,60 +174,90 @@ var CoreAppActionTypes;
|
|
|
174
174
|
CoreAppActionTypes["REMOVE_API_QUEUE_ITEM"] = "[App] Remove API queue item";
|
|
175
175
|
CoreAppActionTypes["EMPTY_API_QUEUE"] = "[App] empty API queue";
|
|
176
176
|
})(CoreAppActionTypes || (CoreAppActionTypes = {}));
|
|
177
|
+
/**
|
|
178
|
+
* @deprecated it will be removed in the next major version
|
|
179
|
+
*/
|
|
177
180
|
class InitStoreAction {
|
|
178
181
|
constructor(payload) {
|
|
179
182
|
this.payload = payload;
|
|
180
183
|
this.type = CoreAppActionTypes.INIT_STORE;
|
|
181
184
|
}
|
|
182
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* @deprecated it will be removed in the next major version
|
|
188
|
+
*/
|
|
183
189
|
class UpdateAppVersionAction {
|
|
184
190
|
constructor(payload) {
|
|
185
191
|
this.payload = payload;
|
|
186
192
|
this.type = CoreAppActionTypes.UPDATE_APP_VERSION;
|
|
187
193
|
}
|
|
188
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* @deprecated it will be removed in the next major version
|
|
197
|
+
*/
|
|
189
198
|
class UpdateAppConnectionAction {
|
|
190
199
|
constructor(payload) {
|
|
191
200
|
this.payload = payload;
|
|
192
201
|
this.type = CoreAppActionTypes.UPDATE_APP_CONNECTION;
|
|
193
202
|
}
|
|
194
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* @deprecated it will be removed in the next major version
|
|
206
|
+
*/
|
|
195
207
|
class AddAppLoadedConfigModulesAction {
|
|
196
208
|
constructor(payload) {
|
|
197
209
|
this.payload = payload;
|
|
198
210
|
this.type = CoreAppActionTypes.ADD_APP_LOADED_CONFIG_MODULES;
|
|
199
211
|
}
|
|
200
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* @deprecated it will be removed in the next major version
|
|
215
|
+
*/
|
|
201
216
|
class UpdateAppStatusAction {
|
|
202
217
|
constructor(payload) {
|
|
203
218
|
this.payload = payload;
|
|
204
219
|
this.type = CoreAppActionTypes.UPDATE_APP_STATUS;
|
|
205
220
|
}
|
|
206
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* @deprecated it will be removed in the next major version
|
|
224
|
+
*/
|
|
207
225
|
class UpdateCurrentModuleAction {
|
|
208
226
|
constructor(payload) {
|
|
209
227
|
this.payload = payload;
|
|
210
228
|
this.type = CoreAppActionTypes.UPDATE_CURRENT_MODULE;
|
|
211
229
|
}
|
|
212
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* @deprecated it will be removed in the next major version
|
|
233
|
+
*/
|
|
213
234
|
class ActivatedRouteAction {
|
|
214
235
|
constructor(payload) {
|
|
215
236
|
this.payload = payload;
|
|
216
237
|
this.type = CoreAppActionTypes.ACTIVATED_ROUTE;
|
|
217
238
|
}
|
|
218
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* @deprecated it will be removed in the next major version
|
|
242
|
+
*/
|
|
219
243
|
class AddApiQueueItemAction {
|
|
220
244
|
constructor(payload) {
|
|
221
245
|
this.payload = payload;
|
|
222
246
|
this.type = CoreAppActionTypes.ADD_API_QUEUE_ITEM;
|
|
223
247
|
}
|
|
224
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* @deprecated it will be removed in the next major version
|
|
251
|
+
*/
|
|
225
252
|
class RemoveApiQueueItemAction {
|
|
226
253
|
constructor(payload) {
|
|
227
254
|
this.payload = payload;
|
|
228
255
|
this.type = CoreAppActionTypes.REMOVE_API_QUEUE_ITEM;
|
|
229
256
|
}
|
|
230
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* @deprecated it will be removed in the next major version
|
|
260
|
+
*/
|
|
231
261
|
class EmptyApiQueueAction {
|
|
232
262
|
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
233
263
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -237,10 +267,16 @@ class EmptyApiQueueAction {
|
|
|
237
267
|
}
|
|
238
268
|
}
|
|
239
269
|
|
|
270
|
+
/**
|
|
271
|
+
* @deprecated it will be removed in the next major version
|
|
272
|
+
*/
|
|
240
273
|
var CoreI18nActionTypes;
|
|
241
274
|
(function (CoreI18nActionTypes) {
|
|
242
275
|
CoreI18nActionTypes["UPDATE_I18N_STATE"] = "[I18n] Update I18n State";
|
|
243
276
|
})(CoreI18nActionTypes || (CoreI18nActionTypes = {}));
|
|
277
|
+
/**
|
|
278
|
+
* @deprecated it will be removed in the next major version
|
|
279
|
+
*/
|
|
244
280
|
class UpdateI18nStateAction {
|
|
245
281
|
constructor(payload) {
|
|
246
282
|
this.payload = payload;
|
|
@@ -248,6 +284,9 @@ class UpdateI18nStateAction {
|
|
|
248
284
|
}
|
|
249
285
|
}
|
|
250
286
|
|
|
287
|
+
/**
|
|
288
|
+
* @deprecated it will be removed in the next major version
|
|
289
|
+
*/
|
|
251
290
|
var CoreUserActionTypes;
|
|
252
291
|
(function (CoreUserActionTypes) {
|
|
253
292
|
CoreUserActionTypes["UPDATE_USER_STATE"] = "[User] Update User state";
|
|
@@ -256,30 +295,45 @@ var CoreUserActionTypes;
|
|
|
256
295
|
CoreUserActionTypes["UPDATE_USER_RIGHTS"] = "[User] Update rights";
|
|
257
296
|
CoreUserActionTypes["UPDATE_USER_DASHBOARD"] = "[User] Update dashboard";
|
|
258
297
|
})(CoreUserActionTypes || (CoreUserActionTypes = {}));
|
|
298
|
+
/**
|
|
299
|
+
* @deprecated it will be removed in the next major version
|
|
300
|
+
*/
|
|
259
301
|
class UpdateUserStateAction {
|
|
260
302
|
constructor(payload) {
|
|
261
303
|
this.payload = payload;
|
|
262
304
|
this.type = CoreUserActionTypes.UPDATE_USER_STATE;
|
|
263
305
|
}
|
|
264
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* @deprecated it will be removed in the next major version
|
|
309
|
+
*/
|
|
265
310
|
class UpdateUserDetailsAction {
|
|
266
311
|
constructor(payload) {
|
|
267
312
|
this.payload = payload;
|
|
268
313
|
this.type = CoreUserActionTypes.UPDATE_USER_DETAILS;
|
|
269
314
|
}
|
|
270
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* @deprecated it will be removed in the next major version
|
|
318
|
+
*/
|
|
271
319
|
class UpdateUserPreferencesAction {
|
|
272
320
|
constructor(payload) {
|
|
273
321
|
this.payload = payload;
|
|
274
322
|
this.type = CoreUserActionTypes.UPDATE_USER_PREFERENCES;
|
|
275
323
|
}
|
|
276
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* @deprecated it will be removed in the next major version
|
|
327
|
+
*/
|
|
277
328
|
class UpdateUserRightsAction {
|
|
278
329
|
constructor(payload) {
|
|
279
330
|
this.payload = payload;
|
|
280
331
|
this.type = CoreUserActionTypes.UPDATE_USER_RIGHTS;
|
|
281
332
|
}
|
|
282
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* @deprecated it will be removed in the next major version
|
|
336
|
+
*/
|
|
283
337
|
class UpdateUserDashboardAction {
|
|
284
338
|
constructor(payload) {
|
|
285
339
|
this.payload = payload;
|
|
@@ -287,10 +341,16 @@ class UpdateUserDashboardAction {
|
|
|
287
341
|
}
|
|
288
342
|
}
|
|
289
343
|
|
|
344
|
+
/**
|
|
345
|
+
* @deprecated it will be removed in the next major version
|
|
346
|
+
*/
|
|
290
347
|
var CoreNotificationsActionTypes;
|
|
291
348
|
(function (CoreNotificationsActionTypes) {
|
|
292
349
|
CoreNotificationsActionTypes["UPDATE_NOTIFICATIONS_LIST"] = "[Notif] Update list";
|
|
293
350
|
})(CoreNotificationsActionTypes || (CoreNotificationsActionTypes = {}));
|
|
351
|
+
/**
|
|
352
|
+
* @deprecated it will be removed in the next major version
|
|
353
|
+
*/
|
|
294
354
|
class UpdateNotificationsListAction {
|
|
295
355
|
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
296
356
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -300,10 +360,16 @@ class UpdateNotificationsListAction {
|
|
|
300
360
|
}
|
|
301
361
|
}
|
|
302
362
|
|
|
363
|
+
/**
|
|
364
|
+
* @deprecated it will be removed in the next major version
|
|
365
|
+
*/
|
|
303
366
|
var CoreLocaleActionTypes;
|
|
304
367
|
(function (CoreLocaleActionTypes) {
|
|
305
368
|
CoreLocaleActionTypes["UPDATE_LOCALE_STATE"] = "[Locale] Update Locale State";
|
|
306
369
|
})(CoreLocaleActionTypes || (CoreLocaleActionTypes = {}));
|
|
370
|
+
/**
|
|
371
|
+
* @deprecated it will be removed in the next major version
|
|
372
|
+
*/
|
|
307
373
|
class UpdateLocaleStateAction {
|
|
308
374
|
constructor(payload) {
|
|
309
375
|
this.payload = payload;
|
|
@@ -311,150 +377,8 @@ class UpdateLocaleStateAction {
|
|
|
311
377
|
}
|
|
312
378
|
}
|
|
313
379
|
|
|
314
|
-
class EuiGrowlService {
|
|
315
|
-
constructor() {
|
|
316
|
-
this.growlMessages = [];
|
|
317
|
-
this.isGrowlSticky = false;
|
|
318
|
-
this.isCloseAllSticky = false;
|
|
319
|
-
this.growlLife = 3000;
|
|
320
|
-
this.growlPosition = 'bottom-right';
|
|
321
|
-
this.growlCallback = null;
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* displays a growl UxMessage item, isSticky
|
|
325
|
-
*/
|
|
326
|
-
growl(msg, isSticky, isMultiple, life, position, callback) {
|
|
327
|
-
if (msg.severity !== 'info' && msg.severity !== 'warning' && msg.severity !== 'success' && msg.severity !== 'danger') {
|
|
328
|
-
throw new Error('EuiGrowlService.growl() ERROR : message severity must be either : success, warning, info, danger');
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
if (isMultiple === undefined || !isMultiple) {
|
|
332
|
-
this.growlMessages = [];
|
|
333
|
-
}
|
|
334
|
-
this.growlMessages = this.growlMessages.concat(msg);
|
|
335
|
-
msg.life = life || msg.life;
|
|
336
|
-
msg.sticky = isSticky || msg.sticky;
|
|
337
|
-
if (life === undefined || isNaN(life)) {
|
|
338
|
-
if (msg.severity === 'danger') {
|
|
339
|
-
isSticky = true;
|
|
340
|
-
}
|
|
341
|
-
else {
|
|
342
|
-
this.growlLife = 3000;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
else {
|
|
346
|
-
this.growlLife = life;
|
|
347
|
-
}
|
|
348
|
-
if (isSticky) {
|
|
349
|
-
this.isGrowlSticky = isSticky;
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
352
|
-
this.isGrowlSticky = false;
|
|
353
|
-
}
|
|
354
|
-
if (position) {
|
|
355
|
-
this.growlPosition = position;
|
|
356
|
-
}
|
|
357
|
-
if (callback) {
|
|
358
|
-
this.growlCallback = callback;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
clearGrowl() {
|
|
363
|
-
this.growlMessages = [];
|
|
364
|
-
}
|
|
365
|
-
growlSuccess(msg, position) {
|
|
366
|
-
this.growl({ severity: 'success', summary: 'SUCCESS', detail: msg }, false, false, undefined, position);
|
|
367
|
-
}
|
|
368
|
-
growlError(msg, position) {
|
|
369
|
-
this.growl({ severity: 'danger', summary: 'ERROR', detail: msg }, false, false, undefined, position);
|
|
370
|
-
}
|
|
371
|
-
growlWarning(msg, position) {
|
|
372
|
-
this.growl({ severity: 'warning', summary: 'WARNING', detail: msg }, false, false, undefined, position);
|
|
373
|
-
}
|
|
374
|
-
growlInfo(msg, position) {
|
|
375
|
-
this.growl({ severity: 'info', summary: 'INFO', detail: msg }, false, false, undefined, position);
|
|
376
|
-
}
|
|
377
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: EuiGrowlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
378
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: EuiGrowlService, providedIn: 'root' }); }
|
|
379
|
-
}
|
|
380
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: EuiGrowlService, decorators: [{
|
|
381
|
-
type: Injectable,
|
|
382
|
-
args: [{
|
|
383
|
-
providedIn: 'root',
|
|
384
|
-
}]
|
|
385
|
-
}] });
|
|
386
|
-
|
|
387
|
-
class CoreAppEffects {
|
|
388
|
-
constructor(actions,
|
|
389
|
-
// TODO: remove on eUI 14
|
|
390
|
-
showConnectionStatus, translateService, asService, platformId) {
|
|
391
|
-
this.actions = actions;
|
|
392
|
-
this.showConnectionStatus = showConnectionStatus;
|
|
393
|
-
this.translateService = translateService;
|
|
394
|
-
this.asService = asService;
|
|
395
|
-
this.platformId = platformId;
|
|
396
|
-
this.getAppConnectionInformation = createEffect(() => {
|
|
397
|
-
if (isPlatformBrowser(this.platformId)) {
|
|
398
|
-
return merge(fromEvent(window, 'online').pipe(map(() => true)), fromEvent(window, 'offline').pipe(map(() => false))).pipe(map((connected) => new UpdateAppConnectionAction(connected)));
|
|
399
|
-
}
|
|
400
|
-
else {
|
|
401
|
-
return of(new UpdateAppConnectionAction(false));
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
this.activatedRoute = createEffect(() => this.actions.pipe(ofType(CoreAppActionTypes.ACTIVATED_ROUTE), map((action) => action.payload), mergeMap((route) => {
|
|
405
|
-
// extract the module name, if defined
|
|
406
|
-
const module = route.snapshot.data['module'] || 'undefined';
|
|
407
|
-
return [new UpdateCurrentModuleAction(module)];
|
|
408
|
-
})));
|
|
409
|
-
this.updateAppConnection = createEffect(() => this.actions.pipe(ofType(CoreAppActionTypes.UPDATE_APP_CONNECTION), map((action) => action.payload), tap((connected) => {
|
|
410
|
-
// check if feature is enabled
|
|
411
|
-
const isFeatureEnabled = this.showConnectionStatus?.enabled;
|
|
412
|
-
// extract lifespan if any
|
|
413
|
-
const lifespan = this.showConnectionStatus?.messageBox?.lifespan || 0;
|
|
414
|
-
// if the user needs to be informed about the connection status
|
|
415
|
-
if (isFeatureEnabled) {
|
|
416
|
-
if (connected) {
|
|
417
|
-
this.translateService.get('eui.CONNECTED').subscribe((translation) => {
|
|
418
|
-
this.asService.growl({ severity: 'success', summary: 'MESSAGE', detail: translation, life: lifespan }, lifespan < 1, false);
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
else {
|
|
422
|
-
this.translateService.get('eui.NOTCONNECTED').subscribe((translation) => {
|
|
423
|
-
this.asService.growl({ severity: 'danger', summary: 'ERROR', detail: translation, life: lifespan }, lifespan < 1, false);
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
})), { dispatch: false });
|
|
428
|
-
}
|
|
429
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CoreAppEffects, deps: [{ token: i1$1.Actions }, { token: SHOW_CONNECTION_STATUS_TOKEN }, { token: i1$2.TranslateService }, { token: EuiGrowlService }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
430
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CoreAppEffects }); }
|
|
431
|
-
}
|
|
432
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: CoreAppEffects, decorators: [{
|
|
433
|
-
type: Injectable
|
|
434
|
-
}], ctorParameters: () => [{ type: i1$1.Actions }, { type: undefined, decorators: [{
|
|
435
|
-
type: Inject,
|
|
436
|
-
args: [SHOW_CONNECTION_STATUS_TOKEN]
|
|
437
|
-
}] }, { type: i1$2.TranslateService }, { type: EuiGrowlService }, { type: undefined, decorators: [{
|
|
438
|
-
type: Inject,
|
|
439
|
-
args: [PLATFORM_ID]
|
|
440
|
-
}] }] });
|
|
441
|
-
|
|
442
|
-
const CoreModuleEffects = [CoreAppEffects];
|
|
443
|
-
|
|
444
380
|
const updateAppVersion = (state, action) => ({ ...state, version: action.payload });
|
|
445
381
|
const updateAppConnection = (state, action) => ({ ...state, connected: action.payload });
|
|
446
|
-
const AddAppLoadedConfigModules = (state, action) => ({
|
|
447
|
-
...state,
|
|
448
|
-
loadedConfigModules: {
|
|
449
|
-
lastAddedModule: action.payload.moduleName,
|
|
450
|
-
modulesConfig: {
|
|
451
|
-
...state.loadedConfigModules.modulesConfig,
|
|
452
|
-
[action.payload.moduleName]: {
|
|
453
|
-
...action.payload.moduleConfig,
|
|
454
|
-
},
|
|
455
|
-
},
|
|
456
|
-
},
|
|
457
|
-
});
|
|
458
382
|
const updateAppStatus = (state, action) => ({ ...state, status: action.payload });
|
|
459
383
|
const updateCurrentModule = (state, action) => Object.assign({}, state, { currentModule: action.payload });
|
|
460
384
|
const addApiQueueItem = (state, action) => {
|
|
@@ -480,13 +404,15 @@ Object.assign({}, state, { apiQueue: {} });
|
|
|
480
404
|
const actionToReducerMap$4 = {
|
|
481
405
|
[CoreAppActionTypes.UPDATE_APP_VERSION]: updateAppVersion,
|
|
482
406
|
[CoreAppActionTypes.UPDATE_APP_CONNECTION]: updateAppConnection,
|
|
483
|
-
[CoreAppActionTypes.ADD_APP_LOADED_CONFIG_MODULES]: AddAppLoadedConfigModules,
|
|
484
407
|
[CoreAppActionTypes.UPDATE_APP_STATUS]: updateAppStatus,
|
|
485
408
|
[CoreAppActionTypes.UPDATE_CURRENT_MODULE]: updateCurrentModule,
|
|
486
409
|
[CoreAppActionTypes.ADD_API_QUEUE_ITEM]: addApiQueueItem,
|
|
487
410
|
[CoreAppActionTypes.REMOVE_API_QUEUE_ITEM]: removeApiQueueItem,
|
|
488
411
|
[CoreAppActionTypes.EMPTY_API_QUEUE]: emptyApiQueue,
|
|
489
412
|
};
|
|
413
|
+
/**
|
|
414
|
+
* @deprecated it will be removed in the next major version
|
|
415
|
+
*/
|
|
490
416
|
const coreAppReducers = (state = initialAppState, action) => {
|
|
491
417
|
if (actionToReducerMap$4[action.type]) {
|
|
492
418
|
return actionToReducerMap$4[action.type](state, action);
|
|
@@ -529,6 +455,9 @@ const actionToReducerMap$3 = {
|
|
|
529
455
|
[CoreUserActionTypes.UPDATE_USER_RIGHTS]: updateUserRights,
|
|
530
456
|
[CoreUserActionTypes.UPDATE_USER_DASHBOARD]: updateUserDashboard,
|
|
531
457
|
};
|
|
458
|
+
/**
|
|
459
|
+
* @deprecated it will be removed in the next major version
|
|
460
|
+
*/
|
|
532
461
|
const coreUserReducers = (state = initialUserState, action) => {
|
|
533
462
|
if (actionToReducerMap$3[action.type]) {
|
|
534
463
|
return actionToReducerMap$3[action.type](state, action);
|
|
@@ -540,6 +469,9 @@ const updateNotificationsList = (state, action) => Object.assign({}, state, { li
|
|
|
540
469
|
const actionToReducerMap$2 = {
|
|
541
470
|
[CoreNotificationsActionTypes.UPDATE_NOTIFICATIONS_LIST]: updateNotificationsList,
|
|
542
471
|
};
|
|
472
|
+
/**
|
|
473
|
+
* @deprecated it will be removed in the next major version
|
|
474
|
+
*/
|
|
543
475
|
const coreNotificationsReducers = (state = initialNotificationsState, action) => {
|
|
544
476
|
if (actionToReducerMap$2[action.type]) {
|
|
545
477
|
return actionToReducerMap$2[action.type](state, action);
|
|
@@ -547,13 +479,22 @@ const coreNotificationsReducers = (state = initialNotificationsState, action) =>
|
|
|
547
479
|
return state;
|
|
548
480
|
};
|
|
549
481
|
|
|
482
|
+
/**
|
|
483
|
+
* @deprecated it will be removed in the next major version
|
|
484
|
+
*/
|
|
550
485
|
const updateI18nState = (state, action) => ({
|
|
551
486
|
...state,
|
|
552
487
|
...action.payload,
|
|
553
488
|
});
|
|
489
|
+
/**
|
|
490
|
+
* @deprecated it will be removed in the next major version
|
|
491
|
+
*/
|
|
554
492
|
const actionToReducerMap$1 = {
|
|
555
493
|
[CoreI18nActionTypes.UPDATE_I18N_STATE]: updateI18nState,
|
|
556
494
|
};
|
|
495
|
+
/**
|
|
496
|
+
* @deprecated it will be removed in the next major version
|
|
497
|
+
*/
|
|
557
498
|
const corI18nReducers = (state = initialI18nState, action) => {
|
|
558
499
|
if (actionToReducerMap$1[action.type]) {
|
|
559
500
|
return actionToReducerMap$1[action.type](state, action);
|
|
@@ -561,13 +502,22 @@ const corI18nReducers = (state = initialI18nState, action) => {
|
|
|
561
502
|
return state;
|
|
562
503
|
};
|
|
563
504
|
|
|
505
|
+
/**
|
|
506
|
+
* @deprecated it will be removed in the next major version
|
|
507
|
+
*/
|
|
564
508
|
const updateLocaleState = (state, action) => ({
|
|
565
509
|
...state,
|
|
566
510
|
...action.payload,
|
|
567
511
|
});
|
|
512
|
+
/**
|
|
513
|
+
* @deprecated it will be removed in the next major version
|
|
514
|
+
*/
|
|
568
515
|
const actionToReducerMap = {
|
|
569
516
|
[CoreLocaleActionTypes.UPDATE_LOCALE_STATE]: updateLocaleState,
|
|
570
517
|
};
|
|
518
|
+
/**
|
|
519
|
+
* @deprecated it will be removed in the next major version
|
|
520
|
+
*/
|
|
571
521
|
const coreLocaleReducers = (state = initialLocaleState, action) => {
|
|
572
522
|
if (actionToReducerMap[action.type]) {
|
|
573
523
|
return actionToReducerMap[action.type](state, action);
|
|
@@ -575,6 +525,9 @@ const coreLocaleReducers = (state = initialLocaleState, action) => {
|
|
|
575
525
|
return state;
|
|
576
526
|
};
|
|
577
527
|
|
|
528
|
+
/**
|
|
529
|
+
* @deprecated it will be removed in the next major version
|
|
530
|
+
*/
|
|
578
531
|
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
579
532
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
580
533
|
const coreReducers = Object.assign({}, {
|
|
@@ -615,6 +568,7 @@ const disallowedKeys = ['loadedConfigModules', 'connect', 'currentModule', 'stat
|
|
|
615
568
|
/**
|
|
616
569
|
* filters the AppState by removing those keys from the state and return a new state Object
|
|
617
570
|
* @param app the AppState
|
|
571
|
+
* @deprecated it will be removed in the next major version
|
|
618
572
|
*/
|
|
619
573
|
const filterAppState = (app) => {
|
|
620
574
|
// in case app is undefined or null it should return empty object
|
|
@@ -633,6 +587,7 @@ const filterAppState = (app) => {
|
|
|
633
587
|
/**
|
|
634
588
|
*
|
|
635
589
|
* @param storage Type of storage to load the state from
|
|
590
|
+
* @deprecated it will be removed in the next major version
|
|
636
591
|
*/
|
|
637
592
|
const loadState = (storage = localStorage) => {
|
|
638
593
|
if (!storage) {
|
|
@@ -717,10 +672,10 @@ class LogService extends Logger {
|
|
|
717
672
|
}
|
|
718
673
|
return logger;
|
|
719
674
|
}
|
|
720
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
721
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
675
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LogService, deps: [{ token: BASE_LOGGER_NAME_TOKEN }, { token: LOG_LEVEL_TOKEN }, { token: LOG_APPENDERS_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
676
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LogService }); }
|
|
722
677
|
}
|
|
723
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
678
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LogService, decorators: [{
|
|
724
679
|
type: Injectable
|
|
725
680
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
726
681
|
type: Inject,
|
|
@@ -817,11 +772,11 @@ class LogModule {
|
|
|
817
772
|
],
|
|
818
773
|
};
|
|
819
774
|
}
|
|
820
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
821
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.
|
|
822
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.
|
|
775
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
776
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: LogModule }); }
|
|
777
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LogModule }); }
|
|
823
778
|
}
|
|
824
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
779
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LogModule, decorators: [{
|
|
825
780
|
type: NgModule
|
|
826
781
|
}] });
|
|
827
782
|
|
|
@@ -834,77 +789,99 @@ var BrowserStorageType;
|
|
|
834
789
|
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
835
790
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
836
791
|
class StoreService {
|
|
837
|
-
constructor(
|
|
838
|
-
this.store = store;
|
|
792
|
+
constructor(logService, platformId) {
|
|
839
793
|
this.logService = logService;
|
|
840
794
|
this.platformId = platformId;
|
|
841
795
|
/**
|
|
842
796
|
* autoSave handlers to call before saving in local Storage
|
|
843
797
|
*/
|
|
844
|
-
// eslint-disable-next-line
|
|
845
798
|
this._autoSaveHandlers = {};
|
|
799
|
+
this.isHandlingAutoSave = false;
|
|
800
|
+
this.injector = inject(Injector);
|
|
846
801
|
if (isPlatformBrowser(this.platformId)) {
|
|
847
802
|
this._storage = localStorage;
|
|
848
803
|
}
|
|
804
|
+
this.state = signal({});
|
|
805
|
+
toObservable(this.state)
|
|
806
|
+
.pipe(filter(() => this.isHandlingAutoSave), debounceTime(1000), distinctUntilChanged())
|
|
807
|
+
.subscribe((state) => {
|
|
808
|
+
this.saveState(state);
|
|
809
|
+
});
|
|
849
810
|
}
|
|
850
|
-
// use init with just version info, to update to user state, UserService.updateState
|
|
851
|
-
// initializeStore(version?: string, userDetails?: BaseUserDetails) {
|
|
852
|
-
// this.dispatch(new InitStoreAction({ version, userDetails }));
|
|
853
|
-
// }
|
|
854
811
|
init(version, storageType) {
|
|
855
812
|
if (isPlatformBrowser(this.platformId)) {
|
|
856
|
-
|
|
813
|
+
// This action must be dispatched from an app initializer
|
|
814
|
+
// We load the state from a storage and compare the version and userId with the provided ones.
|
|
815
|
+
// If they are the same, we merge the local state into the initial state.
|
|
816
|
+
// If there is a mismatch, we don't merge the local state, but update only the initial state.
|
|
857
817
|
this._storage = storageType === BrowserStorageType.session ? sessionStorage : localStorage;
|
|
818
|
+
// load the state from the localStorage
|
|
819
|
+
let localState = loadState(this._storage);
|
|
820
|
+
localState = { ...localState, app: { ...localState?.app, version } };
|
|
821
|
+
this.updateState(this.deepMerge(localState, { ...initialCoreState }));
|
|
858
822
|
}
|
|
859
823
|
}
|
|
860
|
-
|
|
824
|
+
/**
|
|
825
|
+
* Add an autoSave handler for a specific state slice
|
|
826
|
+
* @param stateSlice
|
|
827
|
+
* @param handler
|
|
828
|
+
* @deprecated it will be removed in the next major version
|
|
829
|
+
*/
|
|
861
830
|
addAutoSaveHandler(stateSlice, handler) {
|
|
862
|
-
if (!this.store) {
|
|
863
|
-
if (this.logService) {
|
|
864
|
-
this.logService.warn('StoreService.addAutoSaveHandler() not available without NGRX');
|
|
865
|
-
}
|
|
866
|
-
return;
|
|
867
|
-
}
|
|
868
831
|
this._autoSaveHandlers[stateSlice] = handler;
|
|
869
832
|
}
|
|
870
833
|
handleAutoSave() {
|
|
871
|
-
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
this.store.pipe(debounceTime(1000), distinctUntilChanged()).subscribe((state) => {
|
|
875
|
-
this.saveState(state);
|
|
876
|
-
});
|
|
834
|
+
this.isHandlingAutoSave = true;
|
|
877
835
|
}
|
|
878
836
|
/**
|
|
879
837
|
* Proxy to NGRX store.dispatch()
|
|
880
838
|
* that allows to intercept if the store is present
|
|
839
|
+
*
|
|
840
|
+
* @deprecated it will be removed in the next version support of NGRX will cease
|
|
881
841
|
*/
|
|
882
|
-
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
883
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
884
842
|
dispatch(action) {
|
|
885
|
-
|
|
886
|
-
return this.store.dispatch(action);
|
|
887
|
-
}
|
|
843
|
+
console.warn('eUI does not PROXY to NGRX store.dispatch() anymore');
|
|
888
844
|
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
845
|
+
updateState(state, reducer) {
|
|
846
|
+
if (reducer) {
|
|
847
|
+
this.state.update(currentState => {
|
|
848
|
+
const newState = reducer(currentState, state);
|
|
849
|
+
return {
|
|
850
|
+
...newState,
|
|
851
|
+
};
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
else {
|
|
855
|
+
this.state.update(currentState => this.deepMerge(currentState, { ...state }));
|
|
895
856
|
}
|
|
896
857
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
858
|
+
select(keyOrMapFn) {
|
|
859
|
+
let computedState = computed(() => this.state());
|
|
860
|
+
if (keyOrMapFn) {
|
|
861
|
+
switch (typeof keyOrMapFn) {
|
|
862
|
+
case 'function':
|
|
863
|
+
computedState = computed(() => {
|
|
864
|
+
const state = this.state();
|
|
865
|
+
return keyOrMapFn(state);
|
|
866
|
+
});
|
|
867
|
+
break;
|
|
868
|
+
case 'string':
|
|
869
|
+
computedState = computed(() => {
|
|
870
|
+
const state = this.state();
|
|
871
|
+
if (!keyOrMapFn) {
|
|
872
|
+
return state;
|
|
873
|
+
}
|
|
874
|
+
const keys = keyOrMapFn.split('.');
|
|
875
|
+
// Traverse the object based on the dot notation
|
|
876
|
+
return keys.reduce((acc, currKey) => {
|
|
877
|
+
return acc && acc[currKey] !== undefined ? acc[currKey] : undefined;
|
|
878
|
+
}, state);
|
|
879
|
+
});
|
|
880
|
+
break;
|
|
881
|
+
}
|
|
906
882
|
}
|
|
907
|
-
|
|
883
|
+
// Use `runInInjectionContext` to ensure `toObservable` is within Angular injection context
|
|
884
|
+
return runInInjectionContext(this.injector, () => toObservable(computedState).pipe(distinctUntilChanged((x, y) => isEqual(x, y))));
|
|
908
885
|
}
|
|
909
886
|
/**
|
|
910
887
|
* filters and save the state with the Browser storage
|
|
@@ -930,17 +907,46 @@ class StoreService {
|
|
|
930
907
|
// Ignore write errors.
|
|
931
908
|
}
|
|
932
909
|
}
|
|
933
|
-
|
|
934
|
-
|
|
910
|
+
/**
|
|
911
|
+
* deep merge two objects
|
|
912
|
+
* @param target the object that will be merged into
|
|
913
|
+
* @param source the object that will be merged from
|
|
914
|
+
*/
|
|
915
|
+
deepMerge(target, source) {
|
|
916
|
+
const output = Object.assign({}, target);
|
|
917
|
+
if (this.isObject(target) && this.isObject(source)) {
|
|
918
|
+
Object.keys(source).forEach(key => {
|
|
919
|
+
if (this.isObject(source[key])) {
|
|
920
|
+
if (!(key in target)) {
|
|
921
|
+
Object.assign(output, { [key]: source[key] });
|
|
922
|
+
}
|
|
923
|
+
else {
|
|
924
|
+
output[key] = this.deepMerge(target[key], source[key]);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
else {
|
|
928
|
+
Object.assign(output, { [key]: source[key] });
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
return output;
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* checks if the given item is an object
|
|
936
|
+
* @param item the item that will be checked
|
|
937
|
+
*/
|
|
938
|
+
isObject(item) {
|
|
939
|
+
return item && typeof item === 'object' && !Array.isArray(item);
|
|
940
|
+
}
|
|
941
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: StoreService, deps: [{ token: LogService, optional: true }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
942
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: StoreService, providedIn: 'root' }); }
|
|
935
943
|
}
|
|
936
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
944
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: StoreService, decorators: [{
|
|
937
945
|
type: Injectable,
|
|
938
946
|
args: [{
|
|
939
947
|
providedIn: 'root',
|
|
940
948
|
}]
|
|
941
|
-
}], ctorParameters: () => [{ type:
|
|
942
|
-
type: Optional
|
|
943
|
-
}] }, { type: LogService, decorators: [{
|
|
949
|
+
}], ctorParameters: () => [{ type: LogService, decorators: [{
|
|
944
950
|
type: Optional
|
|
945
951
|
}] }, { type: undefined, decorators: [{
|
|
946
952
|
type: Inject,
|
|
@@ -950,7 +956,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
950
956
|
const PLATFORM_BROWSER_ID = 'browser';
|
|
951
957
|
class StoreServiceMock extends StoreService {
|
|
952
958
|
constructor() {
|
|
953
|
-
super(null,
|
|
959
|
+
super(null, PLATFORM_BROWSER_ID);
|
|
954
960
|
}
|
|
955
961
|
init() { }
|
|
956
962
|
addAutoSaveHandler() { }
|
|
@@ -959,39 +965,13 @@ class StoreServiceMock extends StoreService {
|
|
|
959
965
|
select() {
|
|
960
966
|
return of({});
|
|
961
967
|
}
|
|
962
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
963
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
968
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: StoreServiceMock, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
969
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: StoreServiceMock }); }
|
|
964
970
|
}
|
|
965
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
971
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: StoreServiceMock, decorators: [{
|
|
966
972
|
type: Injectable
|
|
967
973
|
}], ctorParameters: () => [] });
|
|
968
974
|
|
|
969
|
-
const euiInitApp = (injector) => () => new Promise((resolve) => {
|
|
970
|
-
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
971
|
-
locationInitialized.then(() => {
|
|
972
|
-
const appConfig = injector.get(CONFIG_TOKEN);
|
|
973
|
-
// necessary config parameters
|
|
974
|
-
let appVersion;
|
|
975
|
-
if (appConfig && appConfig.versions && appConfig.versions.app) {
|
|
976
|
-
appVersion = appConfig.versions.app;
|
|
977
|
-
}
|
|
978
|
-
else {
|
|
979
|
-
appVersion = '0.0.0';
|
|
980
|
-
}
|
|
981
|
-
let storageType;
|
|
982
|
-
if (appConfig && appConfig['saveStateStorage']) {
|
|
983
|
-
storageType = appConfig['saveStateStorage'];
|
|
984
|
-
}
|
|
985
|
-
else {
|
|
986
|
-
storageType = BrowserStorageType.local;
|
|
987
|
-
}
|
|
988
|
-
const storeService = injector.get(StoreService);
|
|
989
|
-
storeService.init(appVersion, storageType);
|
|
990
|
-
storeService.handleAutoSave();
|
|
991
|
-
resolve(null);
|
|
992
|
-
});
|
|
993
|
-
});
|
|
994
|
-
|
|
995
975
|
function getCoreProviders() {
|
|
996
976
|
return [
|
|
997
977
|
// core config
|
|
@@ -1005,7 +985,6 @@ function getCoreProviders() {
|
|
|
1005
985
|
{ provide: SHOW_CONNECTION_STATUS_TOKEN, useFactory: getShowConnectionStatus, deps: [GLOBAL_CONFIG_TOKEN] },
|
|
1006
986
|
{ provide: LogService, useFactory: euiLogServiceFactory, deps: [Injector, BASE_NAME_TOKEN, ROOT_LOG_CONFIG_TOKEN] },
|
|
1007
987
|
{ provide: HTTP_ERROR_HANDLER_CONFIG_TOKEN, useFactory: getHttpErrorHandlingConfig, deps: [CONFIG_TOKEN] },
|
|
1008
|
-
{ provide: APP_INITIALIZER, useFactory: euiInitApp, multi: true, deps: [Injector] },
|
|
1009
988
|
];
|
|
1010
989
|
}
|
|
1011
990
|
function getDependencyProviders() {
|
|
@@ -1025,6 +1004,21 @@ function getCoreChildProviders(moduleName) {
|
|
|
1025
1004
|
];
|
|
1026
1005
|
}
|
|
1027
1006
|
|
|
1007
|
+
const AddAppLoadedConfigModules = (state, action) => ({
|
|
1008
|
+
...state,
|
|
1009
|
+
app: {
|
|
1010
|
+
...state.app,
|
|
1011
|
+
loadedConfigModules: {
|
|
1012
|
+
lastAddedModule: action.moduleName,
|
|
1013
|
+
modulesConfig: {
|
|
1014
|
+
...state.app.loadedConfigModules.modulesConfig,
|
|
1015
|
+
[action.moduleName]: {
|
|
1016
|
+
...action.moduleConfig,
|
|
1017
|
+
},
|
|
1018
|
+
},
|
|
1019
|
+
},
|
|
1020
|
+
},
|
|
1021
|
+
});
|
|
1028
1022
|
const CORE_ROOT_GUARD = new InjectionToken('Internal Theme ForRoot Guard');
|
|
1029
1023
|
class CoreModule {
|
|
1030
1024
|
/**
|
|
@@ -1062,14 +1056,14 @@ class CoreModule {
|
|
|
1062
1056
|
const storeService = injector.get(StoreService);
|
|
1063
1057
|
const moduleName = injector.get(MODULE_NAME_TOKEN);
|
|
1064
1058
|
const moduleConfig = injector.get(MODULE_CONFIG_TOKEN);
|
|
1065
|
-
storeService.
|
|
1059
|
+
storeService.updateState({ moduleName, moduleConfig }, AddAppLoadedConfigModules);
|
|
1066
1060
|
}
|
|
1067
1061
|
}
|
|
1068
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
1069
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.
|
|
1070
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.
|
|
1062
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CoreModule, deps: [{ token: CORE_ROOT_GUARD, optional: true }, { token: CoreModule, optional: true, skipSelf: true }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1063
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: CoreModule }); }
|
|
1064
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CoreModule }); }
|
|
1071
1065
|
}
|
|
1072
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
1066
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CoreModule, decorators: [{
|
|
1073
1067
|
type: NgModule
|
|
1074
1068
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1075
1069
|
type: Optional
|
|
@@ -1102,8 +1096,7 @@ async function preInitApp(envConfig) {
|
|
|
1102
1096
|
const envDynamicConfig = envConfig && envConfig.envDynamicConfig;
|
|
1103
1097
|
if (envDynamicConfig) {
|
|
1104
1098
|
// load the local configuration file, if defined
|
|
1105
|
-
|
|
1106
|
-
envConfig.loadedEnvDynamicConfig = euiAppJsonConfig;
|
|
1099
|
+
envConfig.loadedEnvDynamicConfig = await loadEuiDynamicEnvironmentConfig(envDynamicConfig.uri, envDynamicConfig.configTimeout || 2000);
|
|
1107
1100
|
return envConfig;
|
|
1108
1101
|
}
|
|
1109
1102
|
return envConfig;
|
|
@@ -1134,6 +1127,70 @@ async function loadEuiDynamicEnvironmentConfig(url, timeout) {
|
|
|
1134
1127
|
return null;
|
|
1135
1128
|
}
|
|
1136
1129
|
|
|
1130
|
+
const init = () => {
|
|
1131
|
+
const locationInitialized = inject(LOCATION_INITIALIZED, { optional: true }) || Promise.resolve(null);
|
|
1132
|
+
const appConfig = inject(CONFIG_TOKEN);
|
|
1133
|
+
const storeService = inject(StoreService);
|
|
1134
|
+
return new Promise(resolve => {
|
|
1135
|
+
locationInitialized.then(() => {
|
|
1136
|
+
// necessary config parameters
|
|
1137
|
+
let appVersion;
|
|
1138
|
+
if (appConfig && appConfig.versions && appConfig.versions.app) {
|
|
1139
|
+
appVersion = appConfig.versions.app;
|
|
1140
|
+
}
|
|
1141
|
+
else {
|
|
1142
|
+
appVersion = '0.0.0';
|
|
1143
|
+
}
|
|
1144
|
+
let storageType;
|
|
1145
|
+
if (appConfig && appConfig['saveStateStorage']) {
|
|
1146
|
+
storageType = appConfig['saveStateStorage'];
|
|
1147
|
+
}
|
|
1148
|
+
else {
|
|
1149
|
+
storageType = BrowserStorageType.local;
|
|
1150
|
+
}
|
|
1151
|
+
storeService.init(appVersion, storageType);
|
|
1152
|
+
storeService.handleAutoSave();
|
|
1153
|
+
resolve(null);
|
|
1154
|
+
});
|
|
1155
|
+
});
|
|
1156
|
+
};
|
|
1157
|
+
/**
|
|
1158
|
+
* Initializes the app with the necessary configurations. Use this in combination with `provideAppInitializer(euiInitApp_Env)`
|
|
1159
|
+
*/
|
|
1160
|
+
function provideEuiInitializer() {
|
|
1161
|
+
return provideAppInitializer(init);
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Initializes the app with the necessary configurations
|
|
1165
|
+
* @param injector
|
|
1166
|
+
* @deprecated Use `provideEuiInitializer()` instead. Beware that this should be declared as Environment providers.
|
|
1167
|
+
*/
|
|
1168
|
+
const euiInitApp = (injector) => () => new Promise((resolve) => {
|
|
1169
|
+
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
1170
|
+
locationInitialized.then(() => {
|
|
1171
|
+
const appConfig = injector.get(CONFIG_TOKEN);
|
|
1172
|
+
// necessary config parameters
|
|
1173
|
+
let appVersion;
|
|
1174
|
+
if (appConfig && appConfig.versions && appConfig.versions.app) {
|
|
1175
|
+
appVersion = appConfig.versions.app;
|
|
1176
|
+
}
|
|
1177
|
+
else {
|
|
1178
|
+
appVersion = '0.0.0';
|
|
1179
|
+
}
|
|
1180
|
+
let storageType;
|
|
1181
|
+
if (appConfig && appConfig['saveStateStorage']) {
|
|
1182
|
+
storageType = appConfig['saveStateStorage'];
|
|
1183
|
+
}
|
|
1184
|
+
else {
|
|
1185
|
+
storageType = BrowserStorageType.local;
|
|
1186
|
+
}
|
|
1187
|
+
const storeService = injector.get(StoreService);
|
|
1188
|
+
storeService.init(appVersion, storageType);
|
|
1189
|
+
storeService.handleAutoSave();
|
|
1190
|
+
resolve(null);
|
|
1191
|
+
});
|
|
1192
|
+
});
|
|
1193
|
+
|
|
1137
1194
|
const errorCodes = {
|
|
1138
1195
|
ERR_GENERIC: 'ERR_GENERIC',
|
|
1139
1196
|
};
|
|
@@ -1191,10 +1248,10 @@ class GlobalErrorHandler extends ErrorHandler {
|
|
|
1191
1248
|
// throw error;
|
|
1192
1249
|
super.handleError(error);
|
|
1193
1250
|
}
|
|
1194
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
1195
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
1251
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: GlobalErrorHandler, deps: [{ token: LogService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1252
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: GlobalErrorHandler, providedIn: 'root' }); }
|
|
1196
1253
|
}
|
|
1197
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
1254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: GlobalErrorHandler, decorators: [{
|
|
1198
1255
|
type: Injectable,
|
|
1199
1256
|
args: [{
|
|
1200
1257
|
providedIn: 'root',
|
|
@@ -1246,15 +1303,88 @@ class HttpErrorHandlerInterceptor {
|
|
|
1246
1303
|
// return the first matching route, if any
|
|
1247
1304
|
return routes.length > 0 ? routes[0] : null;
|
|
1248
1305
|
}
|
|
1249
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
1250
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
1306
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: HttpErrorHandlerInterceptor, deps: [{ token: HTTP_ERROR_HANDLER_CONFIG_TOKEN }, { token: i0.Injector }, { token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1307
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: HttpErrorHandlerInterceptor }); }
|
|
1251
1308
|
}
|
|
1252
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
1309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: HttpErrorHandlerInterceptor, decorators: [{
|
|
1253
1310
|
type: Injectable
|
|
1254
1311
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1255
1312
|
type: Inject,
|
|
1256
1313
|
args: [HTTP_ERROR_HANDLER_CONFIG_TOKEN]
|
|
1257
|
-
}] }, { type: i0.Injector }, { type: i1$
|
|
1314
|
+
}] }, { type: i0.Injector }, { type: i1$1.Router }] });
|
|
1315
|
+
|
|
1316
|
+
class EuiGrowlService {
|
|
1317
|
+
constructor() {
|
|
1318
|
+
this.growlMessages = [];
|
|
1319
|
+
this.isGrowlSticky = false;
|
|
1320
|
+
this.isCloseAllSticky = false;
|
|
1321
|
+
this.growlLife = 3000;
|
|
1322
|
+
this.growlPosition = 'bottom-right';
|
|
1323
|
+
this.growlCallback = null;
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* displays a growl UxMessage item, isSticky
|
|
1327
|
+
*/
|
|
1328
|
+
growl(msg, isSticky, isMultiple, life, position, callback) {
|
|
1329
|
+
if (msg.severity !== 'info' && msg.severity !== 'warning' && msg.severity !== 'success' && msg.severity !== 'danger') {
|
|
1330
|
+
throw new Error('EuiGrowlService.growl() ERROR : message severity must be either : success, warning, info, danger');
|
|
1331
|
+
}
|
|
1332
|
+
else {
|
|
1333
|
+
if (isMultiple === undefined || !isMultiple) {
|
|
1334
|
+
this.growlMessages = [];
|
|
1335
|
+
}
|
|
1336
|
+
this.growlMessages = this.growlMessages.concat(msg);
|
|
1337
|
+
msg.life = life || msg.life;
|
|
1338
|
+
msg.sticky = isSticky || msg.sticky;
|
|
1339
|
+
if (life === undefined || isNaN(life)) {
|
|
1340
|
+
if (msg.severity === 'danger') {
|
|
1341
|
+
isSticky = true;
|
|
1342
|
+
}
|
|
1343
|
+
else {
|
|
1344
|
+
this.growlLife = 3000;
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
else {
|
|
1348
|
+
this.growlLife = life;
|
|
1349
|
+
}
|
|
1350
|
+
if (isSticky) {
|
|
1351
|
+
this.isGrowlSticky = isSticky;
|
|
1352
|
+
}
|
|
1353
|
+
else {
|
|
1354
|
+
this.isGrowlSticky = false;
|
|
1355
|
+
}
|
|
1356
|
+
if (position) {
|
|
1357
|
+
this.growlPosition = position;
|
|
1358
|
+
}
|
|
1359
|
+
if (callback) {
|
|
1360
|
+
this.growlCallback = callback;
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
clearGrowl() {
|
|
1365
|
+
this.growlMessages = [];
|
|
1366
|
+
}
|
|
1367
|
+
growlSuccess(msg, position) {
|
|
1368
|
+
this.growl({ severity: 'success', summary: 'SUCCESS', detail: msg }, false, false, undefined, position);
|
|
1369
|
+
}
|
|
1370
|
+
growlError(msg, position) {
|
|
1371
|
+
this.growl({ severity: 'danger', summary: 'ERROR', detail: msg }, false, false, undefined, position);
|
|
1372
|
+
}
|
|
1373
|
+
growlWarning(msg, position) {
|
|
1374
|
+
this.growl({ severity: 'warning', summary: 'WARNING', detail: msg }, false, false, undefined, position);
|
|
1375
|
+
}
|
|
1376
|
+
growlInfo(msg, position) {
|
|
1377
|
+
this.growl({ severity: 'info', summary: 'INFO', detail: msg }, false, false, undefined, position);
|
|
1378
|
+
}
|
|
1379
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiGrowlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1380
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiGrowlService, providedIn: 'root' }); }
|
|
1381
|
+
}
|
|
1382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiGrowlService, decorators: [{
|
|
1383
|
+
type: Injectable,
|
|
1384
|
+
args: [{
|
|
1385
|
+
providedIn: 'root',
|
|
1386
|
+
}]
|
|
1387
|
+
}] });
|
|
1258
1388
|
|
|
1259
1389
|
function AlertHttpErrorCallbackFn(error) {
|
|
1260
1390
|
alert(error.statusText);
|
|
@@ -1310,9 +1440,39 @@ class ApiQueueService {
|
|
|
1310
1440
|
this.store = store;
|
|
1311
1441
|
this.http = http;
|
|
1312
1442
|
this.logService = logService;
|
|
1443
|
+
/**
|
|
1444
|
+
* A state reducer that adds an item to the API queue.
|
|
1445
|
+
* @param state
|
|
1446
|
+
* @param action
|
|
1447
|
+
*/
|
|
1448
|
+
this.addApiQueueItem = (state, action) => {
|
|
1449
|
+
// apply the timestamp to the queue item
|
|
1450
|
+
action.item.timestamp = new Date().getTime();
|
|
1451
|
+
// update the queue
|
|
1452
|
+
const apiQueue = Object.assign({}, state.app?.apiQueue, { [action.id]: action.item });
|
|
1453
|
+
return Object.assign({}, state, { app: { ...state.app, apiQueue } });
|
|
1454
|
+
};
|
|
1455
|
+
/**
|
|
1456
|
+
* A state reducer that removes an item from the API queue.
|
|
1457
|
+
* @param state
|
|
1458
|
+
* @param action
|
|
1459
|
+
*/
|
|
1460
|
+
this.removeApiQueueItem = (state, action) => {
|
|
1461
|
+
// remove the specified id from the list of item ids and recreate the apiQueue from the remaining ids
|
|
1462
|
+
const apiQueue = Object.keys(state.app.apiQueue)
|
|
1463
|
+
.filter((id) => id !== action.payload)
|
|
1464
|
+
.reduce((queue, key) => {
|
|
1465
|
+
queue[key] = state.app.apiQueue[key];
|
|
1466
|
+
return queue;
|
|
1467
|
+
}, {});
|
|
1468
|
+
return Object.assign({}, state, { app: { ...state.app, apiQueue } });
|
|
1469
|
+
};
|
|
1313
1470
|
if (logService) {
|
|
1314
1471
|
this.logger = logService.getLogger('core.ApiQueueService');
|
|
1315
1472
|
}
|
|
1473
|
+
this.getAppState = (state) => state.app;
|
|
1474
|
+
this.getApiQueue = createSelector(this.getAppState, (state) => state.apiQueue);
|
|
1475
|
+
this.getApiQueueItem = (itemId) => createSelector(this.getAppState, (state) => state.apiQueue[itemId]);
|
|
1316
1476
|
}
|
|
1317
1477
|
/**
|
|
1318
1478
|
* Adds an item to the queue by dispatching an action to the store.
|
|
@@ -1341,7 +1501,7 @@ class ApiQueueService {
|
|
|
1341
1501
|
if (allowedMethods.indexOf(item.method) < 0) {
|
|
1342
1502
|
throw new Error(`[ApiQueue] method "${item.method}" is not allowed`);
|
|
1343
1503
|
}
|
|
1344
|
-
this.store.
|
|
1504
|
+
this.store.updateState({ id, item }, this.addApiQueueItem);
|
|
1345
1505
|
}
|
|
1346
1506
|
/**
|
|
1347
1507
|
* Retrieves the current state of the API queue and converts it into an array of Observables.
|
|
@@ -1365,7 +1525,7 @@ class ApiQueueService {
|
|
|
1365
1525
|
* });
|
|
1366
1526
|
*/
|
|
1367
1527
|
getQueue() {
|
|
1368
|
-
return this.store.select(getApiQueue).pipe(take(1), map((queue) => {
|
|
1528
|
+
return this.store.select(this.getApiQueue).pipe(take(1), map((queue) => {
|
|
1369
1529
|
const queueArray = queue && Object.values(queue);
|
|
1370
1530
|
if (!queueArray || queueArray.length < 1) {
|
|
1371
1531
|
this.logger?.warn('No items in the queue exist.');
|
|
@@ -1399,7 +1559,7 @@ class ApiQueueService {
|
|
|
1399
1559
|
* });
|
|
1400
1560
|
*/
|
|
1401
1561
|
getQueueItem(id) {
|
|
1402
|
-
return this.store.select(getApiQueueItem(id)).pipe(take(1), map((queue) => {
|
|
1562
|
+
return this.store.select(this.getApiQueueItem(id)).pipe(take(1), map((queue) => {
|
|
1403
1563
|
if (!queue) {
|
|
1404
1564
|
this.logger?.warn(`Queue item with id "${id}" does not exist`);
|
|
1405
1565
|
return null;
|
|
@@ -1426,7 +1586,7 @@ class ApiQueueService {
|
|
|
1426
1586
|
* // The item with ID 'item123' will be dispatched for removal from the queue.
|
|
1427
1587
|
*/
|
|
1428
1588
|
removeQueueItem(id) {
|
|
1429
|
-
this.store.
|
|
1589
|
+
this.store.updateState({ payload: id }, this.removeApiQueueItem);
|
|
1430
1590
|
}
|
|
1431
1591
|
/**
|
|
1432
1592
|
* Clears all items from the API queue.
|
|
@@ -1444,7 +1604,7 @@ class ApiQueueService {
|
|
|
1444
1604
|
* // This will dispatch an action to empty the entire API queue.
|
|
1445
1605
|
*/
|
|
1446
1606
|
removeAllQueueItem() {
|
|
1447
|
-
this.store.
|
|
1607
|
+
this.store.updateState({ app: { apiQueue: {} } });
|
|
1448
1608
|
}
|
|
1449
1609
|
/**
|
|
1450
1610
|
* Processes an item from the API queue identified by its ID.
|
|
@@ -1466,10 +1626,8 @@ class ApiQueueService {
|
|
|
1466
1626
|
* }
|
|
1467
1627
|
* });
|
|
1468
1628
|
*/
|
|
1469
|
-
// TODO: Replace `any` with a more specific type or make the method generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
1470
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1471
1629
|
processQueueItem(id) {
|
|
1472
|
-
return this.store.select(getApiQueueItem(id)).pipe(take(1), switchMap((queue) => {
|
|
1630
|
+
return this.store.select(this.getApiQueueItem(id)).pipe(take(1), switchMap((queue) => {
|
|
1473
1631
|
if (!queue) {
|
|
1474
1632
|
this.logger?.warn(`Queue item with id "${id}" does not exist`);
|
|
1475
1633
|
return of(null);
|
|
@@ -1497,10 +1655,8 @@ class ApiQueueService {
|
|
|
1497
1655
|
* // Handle the array of responses or errors
|
|
1498
1656
|
* });
|
|
1499
1657
|
*/
|
|
1500
|
-
// TODO: Refine the return type to be more specific or implement generics, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
1501
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1502
1658
|
processAllQueueItems(continueOnError = true) {
|
|
1503
|
-
return this.store.select(getApiQueue).pipe(map((queue) => Object.entries(queue).map(([key, value]) => this.buildHttpRequest(key, value).pipe(catchError((error) => {
|
|
1659
|
+
return this.store.select(this.getApiQueue).pipe(map((queue) => Object.entries(queue).map(([key, value]) => this.buildHttpRequest(key, value).pipe(catchError((error) => {
|
|
1504
1660
|
this.logger?.error(`Queue Item with id ${key} failed.`, error.message, error.stack);
|
|
1505
1661
|
if (!continueOnError) {
|
|
1506
1662
|
throw error;
|
|
@@ -1529,10 +1685,8 @@ class ApiQueueService {
|
|
|
1529
1685
|
* // Handle each response in the order of queue processing
|
|
1530
1686
|
* });
|
|
1531
1687
|
*/
|
|
1532
|
-
// TODO: Refine the return type for more specific or implement generics, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
1533
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1534
1688
|
processAllQueueItemsSequential(ascending = true) {
|
|
1535
|
-
return this.store.select(getApiQueue).pipe(switchMap((queue) => from(Object.entries(queue)
|
|
1689
|
+
return this.store.select(this.getApiQueue).pipe(switchMap((queue) => from(Object.entries(queue)
|
|
1536
1690
|
.sort((a, b) => (ascending ? this.sortOnTimestamp(a, b) : this.sortOnTimestamp(b, a)))
|
|
1537
1691
|
.map(([id, item]) => this.buildHttpRequest(id, item)))
|
|
1538
1692
|
.pipe(concatMap(x => x))));
|
|
@@ -1581,21 +1735,18 @@ class ApiQueueService {
|
|
|
1581
1735
|
*
|
|
1582
1736
|
* @template T - The expected type of the HTTP response. Defaults to `any`.
|
|
1583
1737
|
*/
|
|
1584
|
-
// TODO: add type for T and deprecate old function
|
|
1585
|
-
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
1586
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1587
1738
|
buildHttpRequest(id, item) {
|
|
1588
1739
|
return this.http[item.method.toLowerCase()](item.uri, item.payload).pipe(tap(() => this.removeQueueItem(id)));
|
|
1589
1740
|
}
|
|
1590
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
1591
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
1741
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ApiQueueService, deps: [{ token: StoreService }, { token: i1$2.HttpClient }, { token: LogService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1742
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ApiQueueService, providedIn: 'root' }); }
|
|
1592
1743
|
}
|
|
1593
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
1744
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ApiQueueService, decorators: [{
|
|
1594
1745
|
type: Injectable,
|
|
1595
1746
|
args: [{
|
|
1596
1747
|
providedIn: 'root',
|
|
1597
1748
|
}]
|
|
1598
|
-
}], ctorParameters: () => [{ type: StoreService }, { type: i1$
|
|
1749
|
+
}], ctorParameters: () => [{ type: StoreService }, { type: i1$2.HttpClient }, { type: LogService, decorators: [{
|
|
1599
1750
|
type: Optional
|
|
1600
1751
|
}] }] });
|
|
1601
1752
|
|
|
@@ -1610,15 +1761,11 @@ class ApiQueueServiceMock extends ApiQueueService {
|
|
|
1610
1761
|
return of({ uri: id, method: 'GET' });
|
|
1611
1762
|
}
|
|
1612
1763
|
removeAllQueueItem() { }
|
|
1613
|
-
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
1614
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1615
1764
|
processAllQueueItems() {
|
|
1616
1765
|
return of({});
|
|
1617
1766
|
}
|
|
1618
1767
|
addQueueItem() { }
|
|
1619
1768
|
removeQueueItem() { }
|
|
1620
|
-
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
1621
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1622
1769
|
processQueueItem() {
|
|
1623
1770
|
return of({});
|
|
1624
1771
|
}
|
|
@@ -1808,20 +1955,13 @@ class I18nLoader {
|
|
|
1808
1955
|
* @param lang the resource language to load
|
|
1809
1956
|
* @returns Observable<any>
|
|
1810
1957
|
*/
|
|
1811
|
-
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
1812
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1813
1958
|
loadResource(resource, lang) {
|
|
1814
1959
|
// the path to the resource
|
|
1815
1960
|
const path = resource.getPath(lang);
|
|
1816
1961
|
// load the translations from the path
|
|
1817
1962
|
return this.http.get(path).pipe(
|
|
1818
1963
|
// preprocess the translations using the resource compiler
|
|
1819
|
-
|
|
1820
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1821
|
-
map((translations) => resource.compileTranslations(translations, lang)),
|
|
1822
|
-
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
1823
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1824
|
-
map((translations) => {
|
|
1964
|
+
map((translations) => resource.compileTranslations(translations, lang)), map((translations) => {
|
|
1825
1965
|
// resource loaded properly, send a info message
|
|
1826
1966
|
this.logger?.info(`I18n resource loaded from path ${path}`);
|
|
1827
1967
|
// return the translations
|
|
@@ -1842,12 +1982,12 @@ class I18nLoader {
|
|
|
1842
1982
|
}
|
|
1843
1983
|
return undefined;
|
|
1844
1984
|
}
|
|
1845
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
1846
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
1985
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: I18nLoader, deps: [{ token: i1$2.HttpClient }, { token: LogService, optional: true }, { token: CONFIG_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1986
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: I18nLoader }); }
|
|
1847
1987
|
}
|
|
1848
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
1988
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: I18nLoader, decorators: [{
|
|
1849
1989
|
type: Injectable
|
|
1850
|
-
}], ctorParameters: () => [{ type: i1$
|
|
1990
|
+
}], ctorParameters: () => [{ type: i1$2.HttpClient }, { type: LogService, decorators: [{
|
|
1851
1991
|
type: Optional
|
|
1852
1992
|
}] }, { type: undefined, decorators: [{
|
|
1853
1993
|
type: Inject,
|
|
@@ -1860,7 +2000,9 @@ const translateConfig = {
|
|
|
1860
2000
|
},
|
|
1861
2001
|
};
|
|
1862
2002
|
|
|
2003
|
+
const getLastAddedModule = (state) => state.app.loadedConfigModules.lastAddedModule;
|
|
1863
2004
|
class I18nService extends EuiLazyService {
|
|
2005
|
+
static { this.DEFAULT_STATE = { activeLang: 'en' }; }
|
|
1864
2006
|
constructor(baseGlobalConfig, translateService, logService, store, document) {
|
|
1865
2007
|
super({ activeLang: 'en' });
|
|
1866
2008
|
this.baseGlobalConfig = baseGlobalConfig;
|
|
@@ -1868,29 +2010,58 @@ class I18nService extends EuiLazyService {
|
|
|
1868
2010
|
this.logService = logService;
|
|
1869
2011
|
this.store = store;
|
|
1870
2012
|
this.document = document;
|
|
2013
|
+
/**
|
|
2014
|
+
* a single signal holding the state - initial state is null
|
|
2015
|
+
*/
|
|
2016
|
+
this.state = signal(I18nService.DEFAULT_STATE);
|
|
2017
|
+
this.injector = inject(Injector);
|
|
2018
|
+
this.subNotifier = new Subject();
|
|
1871
2019
|
this.config = getI18nServiceConfigFromBase(this.baseGlobalConfig);
|
|
1872
2020
|
this.onModuleLoad = new BehaviorSubject({ ready: false, name: null });
|
|
1873
2021
|
}
|
|
2022
|
+
ngOnDestroy() {
|
|
2023
|
+
this.subNotifier.next(void 0);
|
|
2024
|
+
this.subNotifier.complete();
|
|
2025
|
+
}
|
|
1874
2026
|
getState(keyOrMapFn) {
|
|
1875
|
-
let
|
|
1876
|
-
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
1877
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1878
|
-
const dotNotationToObject = (obj, key) => key.split('.').reduce((slice, i) => slice[i], obj);
|
|
2027
|
+
let computedState = computed(() => this.state());
|
|
1879
2028
|
if (keyOrMapFn) {
|
|
1880
2029
|
switch (typeof keyOrMapFn) {
|
|
1881
2030
|
case 'function':
|
|
1882
|
-
|
|
2031
|
+
computedState = computed(() => {
|
|
2032
|
+
const state = this.state();
|
|
2033
|
+
return keyOrMapFn(state);
|
|
2034
|
+
});
|
|
1883
2035
|
break;
|
|
1884
2036
|
case 'string':
|
|
1885
|
-
|
|
2037
|
+
computedState = computed(() => {
|
|
2038
|
+
const state = this.state();
|
|
2039
|
+
if (!keyOrMapFn) {
|
|
2040
|
+
return state;
|
|
2041
|
+
}
|
|
2042
|
+
const keys = keyOrMapFn.split('.');
|
|
2043
|
+
// Traverse the object based on the dot notation
|
|
2044
|
+
return keys.reduce((acc, currKey) => {
|
|
2045
|
+
return acc && acc[currKey] !== undefined ? acc[currKey] : undefined;
|
|
2046
|
+
}, state);
|
|
2047
|
+
});
|
|
1886
2048
|
break;
|
|
1887
2049
|
}
|
|
1888
2050
|
}
|
|
1889
|
-
|
|
2051
|
+
// Use `runInInjectionContext` to ensure `toObservable` is within Angular injection context
|
|
2052
|
+
return runInInjectionContext(this.injector, () => toObservable(computedState).pipe(takeUntil(this.subNotifier), distinctUntilChanged((x, y) => isEqual(x, y))));
|
|
1890
2053
|
}
|
|
1891
|
-
updateState(
|
|
1892
|
-
|
|
1893
|
-
|
|
2054
|
+
updateState(state, reducer) {
|
|
2055
|
+
if (state.activeLang) {
|
|
2056
|
+
this.updateHTMLDOMLang(state.activeLang);
|
|
2057
|
+
}
|
|
2058
|
+
this.state.update(currentState => super.deepMerge(currentState, { ...state }));
|
|
2059
|
+
}
|
|
2060
|
+
/**
|
|
2061
|
+
* This method is used to get the state as readonly signal.
|
|
2062
|
+
*/
|
|
2063
|
+
getSignal() {
|
|
2064
|
+
return this.state.asReadonly();
|
|
1894
2065
|
}
|
|
1895
2066
|
init(langState) {
|
|
1896
2067
|
const initLang = langState && langState.activeLang ? langState.activeLang : this.preparedDefaultLanguage();
|
|
@@ -1905,6 +2076,15 @@ class I18nService extends EuiLazyService {
|
|
|
1905
2076
|
}
|
|
1906
2077
|
return of({ success: false, error: 'Initial active lang should be string' });
|
|
1907
2078
|
}
|
|
2079
|
+
/**
|
|
2080
|
+
* A pipe function that could serve as a wrapper of another observable
|
|
2081
|
+
* e.g. ngx-translate i18n.onReady('my_module').pipe(switchMap(()=>translate.get('eui.KEY')));
|
|
2082
|
+
* WARNING: onReady will emit only once for a loaded Module, going to another and then going back will not result
|
|
2083
|
+
* into another emission.
|
|
2084
|
+
*
|
|
2085
|
+
* @param moduleName the name of the module that has been given through the eUI globalConfig. In case non provided
|
|
2086
|
+
* fetch module name from the state.
|
|
2087
|
+
*/
|
|
1908
2088
|
onReady(moduleName) {
|
|
1909
2089
|
return this.onModuleLoad.pipe(switchMap((evt) => moduleName
|
|
1910
2090
|
? of(evt)
|
|
@@ -1979,13 +2159,13 @@ class I18nService extends EuiLazyService {
|
|
|
1979
2159
|
return this.config.defaultLanguage;
|
|
1980
2160
|
}
|
|
1981
2161
|
/**
|
|
1982
|
-
* @param
|
|
2162
|
+
* @param initLanguage if given default language to override default language coming from the
|
|
1983
2163
|
* configuration token.
|
|
1984
2164
|
*/
|
|
1985
2165
|
setup(initLanguage) {
|
|
1986
2166
|
// use the default config as a reference base
|
|
1987
2167
|
this.config = Object.assign({}, DEFAULT_I18N_SERVICE_CONFIG, this.config);
|
|
1988
|
-
// configure the
|
|
2168
|
+
// configure the translation config service
|
|
1989
2169
|
if (this.config.languages) {
|
|
1990
2170
|
this.translateService.addLangs(EuiEuLanguages.getLanguageCodes(this.config.languages));
|
|
1991
2171
|
if (this.logService) {
|
|
@@ -2010,7 +2190,9 @@ class I18nService extends EuiLazyService {
|
|
|
2010
2190
|
}), catchError((error) => of({ success: false, error })));
|
|
2011
2191
|
}
|
|
2012
2192
|
bindActiveLangStateToTranslateService() {
|
|
2013
|
-
this.
|
|
2193
|
+
this.getState((s) => s.activeLang)
|
|
2194
|
+
.pipe(takeUntil(this.subNotifier))
|
|
2195
|
+
.subscribe((lang) => {
|
|
2014
2196
|
if (lang !== null && this.translateService.currentLang !== lang) {
|
|
2015
2197
|
this.use(lang);
|
|
2016
2198
|
}
|
|
@@ -2054,10 +2236,10 @@ class I18nService extends EuiLazyService {
|
|
|
2054
2236
|
updateHTMLDOMLang(lang) {
|
|
2055
2237
|
this.document.documentElement.lang = lang;
|
|
2056
2238
|
}
|
|
2057
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
2058
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
2239
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: I18nService, deps: [{ token: GLOBAL_CONFIG_TOKEN }, { token: i1$3.TranslateService }, { token: LogService, optional: true }, { token: StoreService }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2240
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: I18nService, providedIn: 'root' }); }
|
|
2059
2241
|
}
|
|
2060
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
2242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: I18nService, decorators: [{
|
|
2061
2243
|
type: Injectable,
|
|
2062
2244
|
args: [{
|
|
2063
2245
|
providedIn: 'root',
|
|
@@ -2065,7 +2247,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
2065
2247
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
2066
2248
|
type: Inject,
|
|
2067
2249
|
args: [GLOBAL_CONFIG_TOKEN]
|
|
2068
|
-
}] }, { type: i1$
|
|
2250
|
+
}] }, { type: i1$3.TranslateService }, { type: LogService, decorators: [{
|
|
2069
2251
|
type: Optional
|
|
2070
2252
|
}] }, { type: StoreService }, { type: Document, decorators: [{
|
|
2071
2253
|
type: Inject,
|
|
@@ -2544,6 +2726,8 @@ class EuiPermissionService extends EuiService {
|
|
|
2544
2726
|
* });
|
|
2545
2727
|
*/
|
|
2546
2728
|
getState() {
|
|
2729
|
+
const getUserState = (state) => state.user;
|
|
2730
|
+
const getUserRights = createSelector(getUserState, (state) => state.rights);
|
|
2547
2731
|
return this.store.select(getUserRights);
|
|
2548
2732
|
}
|
|
2549
2733
|
/**
|
|
@@ -2564,7 +2748,7 @@ class EuiPermissionService extends EuiService {
|
|
|
2564
2748
|
* permissionService.updateState(newUserRights);
|
|
2565
2749
|
*/
|
|
2566
2750
|
updateState(rights) {
|
|
2567
|
-
this.store.
|
|
2751
|
+
this.store.updateState({ user: { rights: rights || [] } });
|
|
2568
2752
|
}
|
|
2569
2753
|
/**
|
|
2570
2754
|
* Checks if the user has the specified attribute permission.
|
|
@@ -2658,10 +2842,10 @@ class EuiPermissionService extends EuiService {
|
|
|
2658
2842
|
}
|
|
2659
2843
|
return rights.every((right) => this.userRights.find((uRight) => uRight.id === right.id));
|
|
2660
2844
|
}
|
|
2661
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
2662
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
2845
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiPermissionService, deps: [{ token: LogService, optional: true }, { token: StoreService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2846
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiPermissionService, providedIn: 'root' }); }
|
|
2663
2847
|
}
|
|
2664
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
2848
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiPermissionService, decorators: [{
|
|
2665
2849
|
type: Injectable,
|
|
2666
2850
|
args: [{
|
|
2667
2851
|
providedIn: 'root',
|
|
@@ -2721,10 +2905,10 @@ class EuiDynamicMenuService {
|
|
|
2721
2905
|
return true;
|
|
2722
2906
|
});
|
|
2723
2907
|
}
|
|
2724
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
2725
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
2908
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiDynamicMenuService, deps: [{ token: EuiPermissionService }, { token: StoreService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2909
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiDynamicMenuService, providedIn: 'root' }); }
|
|
2726
2910
|
}
|
|
2727
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
2911
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiDynamicMenuService, decorators: [{
|
|
2728
2912
|
type: Injectable,
|
|
2729
2913
|
args: [{
|
|
2730
2914
|
providedIn: 'root',
|
|
@@ -2789,10 +2973,10 @@ class EuiDynamicComponentService {
|
|
|
2789
2973
|
injectorTokens.set(DYNAMIC_COMPONENT_CONFIG, data);
|
|
2790
2974
|
return new PortalInjector(this.injector, injectorTokens);
|
|
2791
2975
|
}
|
|
2792
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
2793
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
2976
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiDynamicComponentService, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.Injector }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2977
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiDynamicComponentService }); }
|
|
2794
2978
|
}
|
|
2795
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
2979
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiDynamicComponentService, decorators: [{
|
|
2796
2980
|
type: Injectable
|
|
2797
2981
|
}], ctorParameters: () => [{ type: i0.ComponentFactoryResolver }, { type: i0.Injector }, { type: i0.ApplicationRef }] });
|
|
2798
2982
|
|
|
@@ -2993,7 +3177,7 @@ class EuiAppShellService {
|
|
|
2993
3177
|
key
|
|
2994
3178
|
? this.state$.pipe(map((state) => get(state, key)),
|
|
2995
3179
|
// filter((state) => state),
|
|
2996
|
-
distinctUntilChanged((x, y) => isEqual(x, y)))
|
|
3180
|
+
distinctUntilChanged((x, y) => isEqual$1(x, y)))
|
|
2997
3181
|
: this.state$);
|
|
2998
3182
|
}
|
|
2999
3183
|
sidebarToggle() {
|
|
@@ -3160,13 +3344,12 @@ class EuiAppShellService {
|
|
|
3160
3344
|
const body = res;
|
|
3161
3345
|
return body || {};
|
|
3162
3346
|
}
|
|
3163
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3164
3347
|
handleError(error) {
|
|
3165
3348
|
console.error('An error occurred', error);
|
|
3166
3349
|
return Promise.reject(error.message || error);
|
|
3167
3350
|
}
|
|
3168
3351
|
bindActiveLanguageToAppShellState() {
|
|
3169
|
-
this.
|
|
3352
|
+
this.i18nService.getState((s) => s.activeLang).subscribe((activeLang) => {
|
|
3170
3353
|
if (activeLang !== this.state.activeLanguage) {
|
|
3171
3354
|
this.setState({
|
|
3172
3355
|
...this.state,
|
|
@@ -3175,10 +3358,10 @@ class EuiAppShellService {
|
|
|
3175
3358
|
}
|
|
3176
3359
|
});
|
|
3177
3360
|
}
|
|
3178
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
3179
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
3361
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiAppShellService, deps: [{ token: GLOBAL_CONFIG_TOKEN, optional: true }, { token: i1$2.HttpClient }, { token: PLATFORM_ID }, { token: DOCUMENT }, { token: i1$1.Router }, { token: StoreService }, { token: I18nService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3362
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiAppShellService, providedIn: 'root' }); }
|
|
3180
3363
|
}
|
|
3181
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
3364
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiAppShellService, decorators: [{
|
|
3182
3365
|
type: Injectable,
|
|
3183
3366
|
args: [{
|
|
3184
3367
|
providedIn: 'root',
|
|
@@ -3188,13 +3371,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
3188
3371
|
}, {
|
|
3189
3372
|
type: Inject,
|
|
3190
3373
|
args: [GLOBAL_CONFIG_TOKEN]
|
|
3191
|
-
}] }, { type: i1$
|
|
3374
|
+
}] }, { type: i1$2.HttpClient }, { type: undefined, decorators: [{
|
|
3192
3375
|
type: Inject,
|
|
3193
3376
|
args: [PLATFORM_ID]
|
|
3194
3377
|
}] }, { type: Document, decorators: [{
|
|
3195
3378
|
type: Inject,
|
|
3196
3379
|
args: [DOCUMENT]
|
|
3197
|
-
}] }, { type: i1$
|
|
3380
|
+
}] }, { type: i1$1.Router }, { type: StoreService }, { type: I18nService, decorators: [{
|
|
3198
3381
|
type: Optional
|
|
3199
3382
|
}] }] });
|
|
3200
3383
|
|
|
@@ -3905,10 +4088,10 @@ class EuiTimezoneService {
|
|
|
3905
4088
|
getTimezone(tz) {
|
|
3906
4089
|
return EUI_TIMEZONES.find((item) => item.name === tz);
|
|
3907
4090
|
}
|
|
3908
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
3909
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
4091
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiTimezoneService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4092
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiTimezoneService }); }
|
|
3910
4093
|
}
|
|
3911
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
4094
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiTimezoneService, decorators: [{
|
|
3912
4095
|
type: Injectable
|
|
3913
4096
|
}] });
|
|
3914
4097
|
|
|
@@ -4095,10 +4278,10 @@ class EuiThemeService {
|
|
|
4095
4278
|
}
|
|
4096
4279
|
}
|
|
4097
4280
|
}
|
|
4098
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
4099
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
4281
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiThemeService, deps: [{ token: DOCUMENT }, { token: GLOBAL_CONFIG_TOKEN, optional: true }, { token: EuiAppShellService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4282
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiThemeService, providedIn: 'root' }); }
|
|
4100
4283
|
}
|
|
4101
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
4284
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiThemeService, decorators: [{
|
|
4102
4285
|
type: Injectable,
|
|
4103
4286
|
args: [{
|
|
4104
4287
|
providedIn: 'root',
|
|
@@ -4247,10 +4430,10 @@ class LocalStorageService extends StorageService {
|
|
|
4247
4430
|
}
|
|
4248
4431
|
}
|
|
4249
4432
|
}
|
|
4250
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
4251
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
4433
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocalStorageService, deps: [{ token: LogService, optional: true }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4434
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocalStorageService }); }
|
|
4252
4435
|
}
|
|
4253
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
4436
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocalStorageService, decorators: [{
|
|
4254
4437
|
type: Injectable
|
|
4255
4438
|
}], ctorParameters: () => [{ type: LogService, decorators: [{
|
|
4256
4439
|
type: Optional
|
|
@@ -4325,10 +4508,10 @@ class SessionStorageService extends StorageService {
|
|
|
4325
4508
|
}
|
|
4326
4509
|
}
|
|
4327
4510
|
}
|
|
4328
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
4329
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
4511
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SessionStorageService, deps: [{ token: LogService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4512
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SessionStorageService }); }
|
|
4330
4513
|
}
|
|
4331
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
4514
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SessionStorageService, decorators: [{
|
|
4332
4515
|
type: Injectable
|
|
4333
4516
|
}], ctorParameters: () => [{ type: LogService, decorators: [{
|
|
4334
4517
|
type: Optional
|
|
@@ -4431,10 +4614,10 @@ class LocalForageService extends AsyncStorageService {
|
|
|
4431
4614
|
},
|
|
4432
4615
|
}));
|
|
4433
4616
|
}
|
|
4434
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
4435
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
4617
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocalForageService, deps: [{ token: LOCAL_FORAGE_SERVICE_CONFIG_TOKEN, optional: true }, { token: LogService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4618
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocalForageService }); }
|
|
4436
4619
|
}
|
|
4437
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
4620
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocalForageService, decorators: [{
|
|
4438
4621
|
type: Injectable
|
|
4439
4622
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
4440
4623
|
type: Inject,
|
|
@@ -4460,8 +4643,9 @@ const LOCALE_ID_MAPPER = new InjectionToken('localeIdMapper');
|
|
|
4460
4643
|
* @extends EuiService<T | LocaleState>
|
|
4461
4644
|
*/
|
|
4462
4645
|
class LocaleService extends EuiService {
|
|
4646
|
+
static { this.DEFAULT_STATE = { id: 'en-US' }; }
|
|
4463
4647
|
constructor(store, baseGlobalConfig, locale_id, localeMapper, i18n, log) {
|
|
4464
|
-
super({ id:
|
|
4648
|
+
super({ id: locale_id || Intl.DateTimeFormat().resolvedOptions().locale });
|
|
4465
4649
|
this.store = store;
|
|
4466
4650
|
this.baseGlobalConfig = baseGlobalConfig;
|
|
4467
4651
|
this.locale_id = locale_id;
|
|
@@ -4469,6 +4653,11 @@ class LocaleService extends EuiService {
|
|
|
4469
4653
|
this.i18n = i18n;
|
|
4470
4654
|
this.log = log;
|
|
4471
4655
|
this.subNotifier = new Subject();
|
|
4656
|
+
/**
|
|
4657
|
+
* a single signal holding the state - initial state is null
|
|
4658
|
+
*/
|
|
4659
|
+
this.state = signal(LocaleService.DEFAULT_STATE);
|
|
4660
|
+
this.injector = inject(Injector);
|
|
4472
4661
|
if (log) {
|
|
4473
4662
|
this.logger = log.getLogger('core.LocaleService');
|
|
4474
4663
|
}
|
|
@@ -4485,46 +4674,55 @@ class LocaleService extends EuiService {
|
|
|
4485
4674
|
/**
|
|
4486
4675
|
* @param {((state: T) => K) | string} [keyOrMapFn] - Either a mapping function or a string key.
|
|
4487
4676
|
* If a string is provided, it uses dot notation to access nested properties.
|
|
4488
|
-
* @returns {Observable<K
|
|
4677
|
+
* @returns {Observable<Partial<K>>} - An observable that emits the selected or transformed state.
|
|
4489
4678
|
*
|
|
4490
4679
|
* If no parameter is provided, the method returns the entire state.
|
|
4491
4680
|
* @param keyOrMapFn
|
|
4492
4681
|
*/
|
|
4493
4682
|
getState(keyOrMapFn) {
|
|
4494
|
-
let
|
|
4495
|
-
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
4496
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4497
|
-
const dotNotationToObject = (obj, key) => key.split('.').reduce((slice, i) => slice[i], obj);
|
|
4683
|
+
let computedState = computed(() => this.state());
|
|
4498
4684
|
if (keyOrMapFn) {
|
|
4499
4685
|
switch (typeof keyOrMapFn) {
|
|
4500
4686
|
case 'function':
|
|
4501
|
-
|
|
4687
|
+
computedState = computed(() => {
|
|
4688
|
+
const state = this.state();
|
|
4689
|
+
return keyOrMapFn(state);
|
|
4690
|
+
});
|
|
4502
4691
|
break;
|
|
4503
4692
|
case 'string':
|
|
4504
|
-
|
|
4693
|
+
computedState = computed(() => {
|
|
4694
|
+
const state = this.state();
|
|
4695
|
+
if (!keyOrMapFn) {
|
|
4696
|
+
return state;
|
|
4697
|
+
}
|
|
4698
|
+
const keys = keyOrMapFn.split('.');
|
|
4699
|
+
// Traverse the object based on the dot notation
|
|
4700
|
+
return keys.reduce((acc, currKey) => {
|
|
4701
|
+
return acc && acc[currKey] !== undefined ? acc[currKey] : undefined;
|
|
4702
|
+
}, state);
|
|
4703
|
+
});
|
|
4505
4704
|
break;
|
|
4506
4705
|
}
|
|
4507
4706
|
}
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
map((state) => (state ? state : this.stateInstance ? this.stateInstance : this.locale_id)));
|
|
4707
|
+
// Use `runInInjectionContext` to ensure `toObservable` is within Angular injection context
|
|
4708
|
+
return runInInjectionContext(this.injector, () => toObservable(computedState).pipe(distinctUntilChanged((x, y) => isEqual(x, y))));
|
|
4511
4709
|
}
|
|
4512
4710
|
/**
|
|
4513
4711
|
* Initializes the LocaleService with necessary configurations and state.
|
|
4514
4712
|
* Binds language changes to the state and dynamically loads the appropriate locales.
|
|
4515
4713
|
*
|
|
4516
|
-
* @param {LocaleState
|
|
4714
|
+
* @param {LocaleState} [state] - Optional initial state for the locale service.
|
|
4517
4715
|
* @returns {Observable<EuiServiceStatus>} - Observable emitting the status of the initialization.
|
|
4518
4716
|
*/
|
|
4519
4717
|
init(state) {
|
|
4520
4718
|
super.initEuiService();
|
|
4719
|
+
state = state || { id: this.currentLocale };
|
|
4521
4720
|
// bind language changes to locale changes
|
|
4522
4721
|
if (this.config?.bindWithTranslate) {
|
|
4523
4722
|
this.bindTranslateServiceLangChangeToState();
|
|
4524
4723
|
}
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
return this.loadLocale(availableLocales).pipe(takeUntil(this.subNotifier), tap(() => this.updateState(state || { id: this.currentLocale })));
|
|
4724
|
+
return of({ success: true })
|
|
4725
|
+
.pipe(tap(() => this.updateState(state)));
|
|
4528
4726
|
}
|
|
4529
4727
|
/**
|
|
4530
4728
|
* Updates the locale state within the application. If the new state is not available,
|
|
@@ -4534,30 +4732,30 @@ class LocaleService extends EuiService {
|
|
|
4534
4732
|
* @throws Will throw an error if the locale for the given state id is not available.
|
|
4535
4733
|
*/
|
|
4536
4734
|
updateState(state) {
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
this.locale_id = id;
|
|
4735
|
+
if (state?.id) {
|
|
4736
|
+
// check if locale is available otherwise throw error
|
|
4737
|
+
try {
|
|
4738
|
+
const id = this.localeMapper(state.id);
|
|
4739
|
+
this.state.update(currentState => super.deepMerge(currentState, { ...state, id }));
|
|
4543
4740
|
}
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4741
|
+
catch (e) {
|
|
4742
|
+
const message = `Locale for '${state.id}' is not available.\n` +
|
|
4743
|
+
`Please use addLocale('${state.id}') first`;
|
|
4744
|
+
if (this.log) {
|
|
4745
|
+
this.logger.info(message, e);
|
|
4746
|
+
}
|
|
4747
|
+
throw new Error(message);
|
|
4550
4748
|
}
|
|
4551
|
-
|
|
4749
|
+
}
|
|
4750
|
+
else {
|
|
4751
|
+
this.state.update(currentState => this.deepMerge(currentState, { ...state }));
|
|
4552
4752
|
}
|
|
4553
4753
|
}
|
|
4554
4754
|
/**
|
|
4555
|
-
*
|
|
4556
|
-
*
|
|
4557
|
-
* @param id
|
|
4755
|
+
* This method is used to get the state as readonly signal.
|
|
4558
4756
|
*/
|
|
4559
|
-
|
|
4560
|
-
return this.
|
|
4757
|
+
getSignal() {
|
|
4758
|
+
return this.state.asReadonly();
|
|
4561
4759
|
}
|
|
4562
4760
|
/**
|
|
4563
4761
|
* Retrieves the previous locale used in the application.
|
|
@@ -4575,19 +4773,6 @@ class LocaleService extends EuiService {
|
|
|
4575
4773
|
get currentLocale() {
|
|
4576
4774
|
return this.stateInstance?.id;
|
|
4577
4775
|
}
|
|
4578
|
-
/**
|
|
4579
|
-
* @deprecated eui does not offer a way to dynamically add locale it will be removed in future versions
|
|
4580
|
-
*
|
|
4581
|
-
* Dynamically loads and registers locale data based on the given locale identifiers.
|
|
4582
|
-
*
|
|
4583
|
-
* @param {string[] | string} locale - An array of locale identifiers or a single locale identifier.
|
|
4584
|
-
* @returns {Observable<EuiServiceStatus>} - Observable emitting the status of the loading process.
|
|
4585
|
-
* @private
|
|
4586
|
-
*/
|
|
4587
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4588
|
-
loadLocale(locale) {
|
|
4589
|
-
return of({ success: true });
|
|
4590
|
-
}
|
|
4591
4776
|
/**
|
|
4592
4777
|
* Listens for language changes and dynamically sets the locale accordingly.
|
|
4593
4778
|
*
|
|
@@ -4597,58 +4782,29 @@ class LocaleService extends EuiService {
|
|
|
4597
4782
|
if (this.i18n) {
|
|
4598
4783
|
this.i18n.onStateChange
|
|
4599
4784
|
.pipe(takeUntil(this.subNotifier),
|
|
4600
|
-
//
|
|
4601
|
-
|
|
4602
|
-
//
|
|
4603
|
-
|
|
4604
|
-
|
|
4785
|
+
// Only processes state changes when the language actually changes
|
|
4786
|
+
// Example: With activeLang='en', ignores changes between 'en-US' and 'en-GB'
|
|
4787
|
+
// Checks: activeLang exists, has 2+ chars, and differs from current locale's primary language
|
|
4788
|
+
filter((state) => state?.activeLang !== null &&
|
|
4789
|
+
state?.activeLang !== undefined &&
|
|
4790
|
+
state?.activeLang.length > 1 &&
|
|
4791
|
+
state.activeLang.toLowerCase() !== this.stateInstance?.id.slice(0, 2).toLowerCase()),
|
|
4605
4792
|
// to check if registration of locale otherwise register it
|
|
4606
|
-
|
|
4607
|
-
// getLocaleId may throw Error(`Missing locale data for the locale "${locale}".`);
|
|
4608
|
-
switchMap((i18state) => {
|
|
4609
|
-
// check if activeLang is null or undefined
|
|
4610
|
-
if (!i18state.activeLang) {
|
|
4611
|
-
return throwError('Has i18nService initialized? If not make sure i18nService.init().subscribe(..)');
|
|
4612
|
-
}
|
|
4613
|
-
return of(this.localeMapper(i18state.activeLang));
|
|
4614
|
-
}), catchError((error) => {
|
|
4615
|
-
if (this.log) {
|
|
4616
|
-
this.logger.debug(error);
|
|
4617
|
-
}
|
|
4618
|
-
return this.loadLocale(value?.activeLang).pipe(filter((s) => s.success), map(() => this.localeMapper(value?.activeLang)), catchError((e) => {
|
|
4619
|
-
if (this.log) {
|
|
4620
|
-
this.logger.debug('Something went terribly really wrong during locale loading', e.err.message);
|
|
4621
|
-
}
|
|
4622
|
-
return of(e);
|
|
4623
|
-
}));
|
|
4624
|
-
}))),
|
|
4793
|
+
map((state) => this.localeMapper(state.activeLang)),
|
|
4625
4794
|
// update the "available" array attribute with newly registered
|
|
4626
4795
|
switchMap((id) => this.getState().pipe(take(1), map((state) => {
|
|
4627
4796
|
const available = state['available'] ? state['available'] : [];
|
|
4628
4797
|
return { ...state, id, available: Array.from(new Set([...available, id])) };
|
|
4629
4798
|
}))))
|
|
4630
4799
|
.subscribe((state) => {
|
|
4631
|
-
this.updateState(state);
|
|
4800
|
+
return this.updateState(state);
|
|
4632
4801
|
});
|
|
4633
4802
|
}
|
|
4634
4803
|
}
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
*
|
|
4638
|
-
* @returns {string[] | undefined} - An array of browser locale identifiers or undefined if not available.
|
|
4639
|
-
* @private
|
|
4640
|
-
*/
|
|
4641
|
-
getBrowserLocales() {
|
|
4642
|
-
const browserLocales = navigator.languages === undefined ? [navigator.language] : navigator.languages;
|
|
4643
|
-
if (!browserLocales) {
|
|
4644
|
-
return undefined;
|
|
4645
|
-
}
|
|
4646
|
-
return browserLocales.map((locale) => locale.trim());
|
|
4647
|
-
}
|
|
4648
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", 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 }); }
|
|
4649
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: LocaleService, providedIn: 'root' }); }
|
|
4804
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", 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 }); }
|
|
4805
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocaleService, providedIn: 'root' }); }
|
|
4650
4806
|
}
|
|
4651
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
4807
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocaleService, decorators: [{
|
|
4652
4808
|
type: Injectable,
|
|
4653
4809
|
args: [{
|
|
4654
4810
|
providedIn: 'root',
|
|
@@ -4672,7 +4828,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
4672
4828
|
|
|
4673
4829
|
class LocaleServiceMock extends LocaleService {
|
|
4674
4830
|
constructor(locale_id) {
|
|
4675
|
-
super(null, { locale: {
|
|
4831
|
+
super(null, { locale: {} }, locale_id, null, null, null);
|
|
4676
4832
|
this.locale_id = locale_id;
|
|
4677
4833
|
this.DEFAULT_LOCALE = 'en';
|
|
4678
4834
|
this.stateSubject = new BehaviorSubject({ id: this.DEFAULT_LOCALE });
|
|
@@ -4694,10 +4850,10 @@ class LocaleServiceMock extends LocaleService {
|
|
|
4694
4850
|
this.DEFAULT_LOCALE = state.id || 'en';
|
|
4695
4851
|
return of({ success: true });
|
|
4696
4852
|
}
|
|
4697
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
4698
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
4853
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocaleServiceMock, deps: [{ token: LOCALE_ID, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4854
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocaleServiceMock }); }
|
|
4699
4855
|
}
|
|
4700
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
4856
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocaleServiceMock, decorators: [{
|
|
4701
4857
|
type: Injectable
|
|
4702
4858
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
4703
4859
|
type: Optional
|
|
@@ -4991,10 +5147,10 @@ class EuiLoaderService {
|
|
|
4991
5147
|
this.loadStyle(dependency);
|
|
4992
5148
|
}
|
|
4993
5149
|
}
|
|
4994
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
4995
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
5150
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5151
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiLoaderService, providedIn: 'root' }); }
|
|
4996
5152
|
}
|
|
4997
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
5153
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuiLoaderService, decorators: [{
|
|
4998
5154
|
type: Injectable,
|
|
4999
5155
|
args: [{
|
|
5000
5156
|
providedIn: 'root',
|
|
@@ -5002,53 +5158,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
5002
5158
|
}] });
|
|
5003
5159
|
|
|
5004
5160
|
class UserService extends EuiService {
|
|
5161
|
+
static { this.DEFAULT_STATE = { userId: 'annonymous' }; }
|
|
5005
5162
|
constructor(store) {
|
|
5006
|
-
super(
|
|
5163
|
+
super(UserService.DEFAULT_STATE);
|
|
5007
5164
|
this.store = store;
|
|
5165
|
+
/**
|
|
5166
|
+
* a single signal holding the state - initial state is null
|
|
5167
|
+
*/
|
|
5168
|
+
this.state = signal(UserService.DEFAULT_STATE);
|
|
5169
|
+
this.injector = inject(Injector);
|
|
5008
5170
|
}
|
|
5009
|
-
init(
|
|
5171
|
+
init(state) {
|
|
5010
5172
|
super.initEuiService();
|
|
5011
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
5012
|
-
this.updateState(
|
|
5013
|
-
return of({ success: true });
|
|
5173
|
+
if (Object.prototype.hasOwnProperty.call(state, 'userId')) {
|
|
5174
|
+
this.updateState(state);
|
|
5175
|
+
return of$1({ success: true });
|
|
5014
5176
|
}
|
|
5015
|
-
return of({ success: false, error: 'Init object should be instance of BaseUserState' });
|
|
5177
|
+
return of$1({ success: false, error: 'Init object should be instance of BaseUserState' });
|
|
5016
5178
|
}
|
|
5017
5179
|
getState(keyOrMapFn) {
|
|
5018
|
-
let
|
|
5019
|
-
const dotNotationToObject = (obj, key) => key.split('.').reduce((slice, i) => slice[i], obj);
|
|
5180
|
+
let computedState = computed(() => this.state());
|
|
5020
5181
|
if (keyOrMapFn) {
|
|
5021
5182
|
switch (typeof keyOrMapFn) {
|
|
5022
5183
|
case 'function':
|
|
5023
|
-
|
|
5184
|
+
computedState = computed(() => {
|
|
5185
|
+
const state = this.state();
|
|
5186
|
+
return keyOrMapFn(state);
|
|
5187
|
+
});
|
|
5024
5188
|
break;
|
|
5025
5189
|
case 'string':
|
|
5026
|
-
|
|
5190
|
+
computedState = computed(() => {
|
|
5191
|
+
const state = this.state();
|
|
5192
|
+
const keys = keyOrMapFn.split('.');
|
|
5193
|
+
// Traverse the object based on the dot notation
|
|
5194
|
+
return keys.reduce((acc, currKey) => {
|
|
5195
|
+
return acc && acc[currKey] !== undefined ? acc[currKey] : undefined;
|
|
5196
|
+
}, state);
|
|
5197
|
+
});
|
|
5027
5198
|
break;
|
|
5028
5199
|
}
|
|
5029
5200
|
}
|
|
5030
|
-
|
|
5201
|
+
// Use `runInInjectionContext` to ensure `toObservable` is within Angular injection context
|
|
5202
|
+
return runInInjectionContext(this.injector, () => toObservable(computedState).pipe(distinctUntilChanged((x, y) => isEqual(x, y))));
|
|
5031
5203
|
}
|
|
5032
|
-
updateState(
|
|
5033
|
-
// if (typeof pathOrReducer === 'string') {
|
|
5034
|
-
// let dotNotationToObject = (obj, key) => key.split('.').reduce((obj, i) => obj[i], obj);
|
|
5035
|
-
//
|
|
5036
|
-
// const customReducer = (state: UserState, action: UpdateUserDetailsAction): UserState => {
|
|
5037
|
-
// return Object.assign({}, dotNotationToObject(state, pathOrReducer), action.payload);
|
|
5038
|
-
// };
|
|
5039
|
-
// this.store.dispatchAction(userState, 'user', customReducer);
|
|
5040
|
-
// }
|
|
5204
|
+
updateState(state, reducer) {
|
|
5041
5205
|
if (reducer) {
|
|
5042
|
-
this.
|
|
5206
|
+
this.state.update(currentState => {
|
|
5207
|
+
const newState = reducer(currentState, state);
|
|
5208
|
+
return {
|
|
5209
|
+
...newState,
|
|
5210
|
+
};
|
|
5211
|
+
});
|
|
5043
5212
|
}
|
|
5044
5213
|
else {
|
|
5045
|
-
this.
|
|
5214
|
+
this.state.update(currentState => this.deepMerge(currentState, { ...state }));
|
|
5046
5215
|
}
|
|
5047
5216
|
}
|
|
5048
|
-
|
|
5049
|
-
|
|
5217
|
+
/**
|
|
5218
|
+
* This method is used to get the signal of the service.
|
|
5219
|
+
*/
|
|
5220
|
+
getSignal() {
|
|
5221
|
+
return this.state.asReadonly();
|
|
5222
|
+
}
|
|
5223
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: UserService, deps: [{ token: StoreService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5224
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: UserService, providedIn: 'root' }); }
|
|
5050
5225
|
}
|
|
5051
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
5226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: UserService, decorators: [{
|
|
5052
5227
|
type: Injectable,
|
|
5053
5228
|
args: [{
|
|
5054
5229
|
providedIn: 'root',
|
|
@@ -5068,10 +5243,10 @@ class UserServiceMock extends UserService {
|
|
|
5068
5243
|
updateState(userState, reducer) {
|
|
5069
5244
|
/* empty */
|
|
5070
5245
|
}
|
|
5071
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
5072
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
5246
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: UserServiceMock, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5247
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: UserServiceMock }); }
|
|
5073
5248
|
}
|
|
5074
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
5249
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: UserServiceMock, decorators: [{
|
|
5075
5250
|
type: Injectable
|
|
5076
5251
|
}], ctorParameters: () => [] });
|
|
5077
5252
|
|
|
@@ -5100,12 +5275,12 @@ class AddLangParamInterceptor {
|
|
|
5100
5275
|
params: req.params.set(langParam, langValue),
|
|
5101
5276
|
}));
|
|
5102
5277
|
}
|
|
5103
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
5104
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
5278
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AddLangParamInterceptor, deps: [{ token: i1$3.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5279
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AddLangParamInterceptor }); }
|
|
5105
5280
|
}
|
|
5106
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
5281
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AddLangParamInterceptor, decorators: [{
|
|
5107
5282
|
type: Injectable
|
|
5108
|
-
}], ctorParameters: () => [{ type: i1$
|
|
5283
|
+
}], ctorParameters: () => [{ type: i1$3.TranslateService }] });
|
|
5109
5284
|
|
|
5110
5285
|
class CachePreventionInterceptor {
|
|
5111
5286
|
intercept(req, next) {
|
|
@@ -5119,10 +5294,10 @@ class CachePreventionInterceptor {
|
|
|
5119
5294
|
headers: req.headers.set('Cache-Control', 'No-Cache'),
|
|
5120
5295
|
}));
|
|
5121
5296
|
}
|
|
5122
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
5123
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
5297
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CachePreventionInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5298
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CachePreventionInterceptor }); }
|
|
5124
5299
|
}
|
|
5125
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
5300
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CachePreventionInterceptor, decorators: [{
|
|
5126
5301
|
type: Injectable
|
|
5127
5302
|
}] });
|
|
5128
5303
|
|
|
@@ -5132,10 +5307,10 @@ class CorsSecurityInterceptor {
|
|
|
5132
5307
|
withCredentials: true,
|
|
5133
5308
|
}));
|
|
5134
5309
|
}
|
|
5135
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
5136
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
5310
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CorsSecurityInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5311
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CorsSecurityInterceptor }); }
|
|
5137
5312
|
}
|
|
5138
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
5313
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CorsSecurityInterceptor, decorators: [{
|
|
5139
5314
|
type: Injectable
|
|
5140
5315
|
}] });
|
|
5141
5316
|
|
|
@@ -5145,10 +5320,10 @@ class CsrfPreventionInterceptor {
|
|
|
5145
5320
|
headers: request.headers.set('X-Requested-With', 'XMLHttpRequest'),
|
|
5146
5321
|
}));
|
|
5147
5322
|
}
|
|
5148
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
5149
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
5323
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CsrfPreventionInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5324
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CsrfPreventionInterceptor }); }
|
|
5150
5325
|
}
|
|
5151
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
5326
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CsrfPreventionInterceptor, decorators: [{
|
|
5152
5327
|
type: Injectable
|
|
5153
5328
|
}] });
|
|
5154
5329
|
|
|
@@ -5215,10 +5390,10 @@ class EuLoginSessionTimeoutHandlingInterceptor {
|
|
|
5215
5390
|
reauthenticate() {
|
|
5216
5391
|
document.location.reload();
|
|
5217
5392
|
}
|
|
5218
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
5219
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
5393
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuLoginSessionTimeoutHandlingInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5394
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuLoginSessionTimeoutHandlingInterceptor }); }
|
|
5220
5395
|
}
|
|
5221
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
5396
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EuLoginSessionTimeoutHandlingInterceptor, decorators: [{
|
|
5222
5397
|
type: Injectable
|
|
5223
5398
|
}] });
|
|
5224
5399
|
|
|
@@ -5242,10 +5417,10 @@ class UxRequestErrorModelInterceptor {
|
|
|
5242
5417
|
return of(err);
|
|
5243
5418
|
}));
|
|
5244
5419
|
}
|
|
5245
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
5246
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.
|
|
5420
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: UxRequestErrorModelInterceptor, deps: [{ token: UX_ERROR_MAPPING_HANDLER_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5421
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: UxRequestErrorModelInterceptor }); }
|
|
5247
5422
|
}
|
|
5248
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
5423
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: UxRequestErrorModelInterceptor, decorators: [{
|
|
5249
5424
|
type: Injectable
|
|
5250
5425
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
5251
5426
|
type: Inject,
|
|
@@ -5258,5 +5433,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
5258
5433
|
* Generated bundle index. Do not edit.
|
|
5259
5434
|
*/
|
|
5260
5435
|
|
|
5261
|
-
export { ActivatedRouteAction, AddApiQueueItemAction, AddAppLoadedConfigModulesAction, AddLangParamInterceptor, AlertHttpErrorCallbackFn, ApiQueueService, ApiQueueServiceMock, AsyncStorageService, AsyncStorageServiceMock, BASE_LOGGER_NAME_TOKEN, BASE_NAME_TOKEN, BrowserStorageType, CONFIG_TOKEN, CORE_ROOT_GUARD, CachePreventionInterceptor, ConsoleHttpErrorCallbackFn, CoreAppActionTypes,
|
|
5436
|
+
export { ActivatedRouteAction, AddApiQueueItemAction, AddAppLoadedConfigModulesAction, AddLangParamInterceptor, AlertHttpErrorCallbackFn, ApiQueueService, ApiQueueServiceMock, AsyncStorageService, AsyncStorageServiceMock, BASE_LOGGER_NAME_TOKEN, BASE_NAME_TOKEN, BrowserStorageType, CONFIG_TOKEN, CORE_ROOT_GUARD, CachePreventionInterceptor, ConsoleHttpErrorCallbackFn, CoreAppActionTypes, CoreI18nActionTypes, CoreLocaleActionTypes, CoreModule, CoreNotificationsActionTypes, CoreUserActionTypes, CorsSecurityInterceptor, CsrfPreventionInterceptor, CssUtils, DYNAMIC_COMPONENT_CONFIG, EUI_CONFIG_TOKEN, EUI_COUNTRIES, EUI_TIMEZONES, EmptyApiQueueAction, ErrorSubClass, EuLoginSessionTimeoutHandlingInterceptor, EuiAppShellService, EuiCoreRootGuardClass, EuiDynamicComponentService, EuiDynamicMenuService, EuiError, EuiGrowlService, EuiLoaderService, EuiPermissionService, EuiTheme, EuiThemeService, EuiTimezoneService, GLOBAL_CONFIG_TOKEN, GlobalErrorHandler, GrowlHttpErrorCallbackFn, HTTP_ERROR_HANDLER_CONFIG_TOKEN, HttpErrorHandlerInterceptor, I18nLoader, I18nResourceImpl, I18nService, InitStoreAction, LANG_PARAM_KEY, LOCALE_ID_MAPPER, LOCAL_FORAGE_SERVICE_CONFIG_TOKEN, LOG_APPENDERS_TOKEN, LOG_LEVEL_TOKEN, LocalForageService, LocalStorageService, LocaleService, LocaleServiceMock, LogHttpErrorCallbackFn, LogModule, LogService, LogServiceMock, MODULE_CONFIG_TOKEN, MODULE_NAME_TOKEN, PLATFORM_BROWSER_ID, ROOT_LOG_CONFIG_TOKEN, RemoveApiQueueItemAction, SHOW_CONNECTION_STATUS_TOKEN, SessionStorageService, Status, StorageService, StorageServiceMock, StoreService, StoreServiceMock, UX_ERROR_MAPPING_HANDLER_TOKEN, UpdateAppConnectionAction, UpdateAppStatusAction, UpdateAppVersionAction, UpdateCurrentModuleAction, UpdateI18nStateAction, UpdateLocaleStateAction, UpdateNotificationsListAction, UpdateUserDashboardAction, UpdateUserDetailsAction, UpdateUserPreferencesAction, UpdateUserRightsAction, UpdateUserStateAction, UserService, UserServiceMock, UxRequestErrorModelInterceptor, closestMatchingParent, consumeEvent, corI18nReducers, coreAppReducers, coreLocaleReducers, coreNotificationsReducers, coreUserReducers, createEuiCoreRootGuard, diffDays, diffDaysFromToday, errorCodes, euiCoreRootGuardClass, euiInitApp, formatNumber, getGlobalConfig, getHttpErrorHandlingConfig, getModuleConfig, getRootLogConfig, getShowConnectionStatus, getViewElement, handleError, isDefined, loadEuiDynamicEnvironmentConfig, loadState, localForage, localStorageSync, markControlsTouched, markFormGroupTouched, mergeAppHandlerConfigToAppConfig, mergeAppJsonConfigToAppConfig, offset, parentOffsetEl, position, preInitApp, prepareEuiAppConfigToken, provideEuiInitializer, coreReducers as reducers, sessionStorageSync, translateConfig, uniqueId, validateEmail };
|
|
5262
5437
|
//# sourceMappingURL=eui-core.mjs.map
|