@stemy/ngx-utils 17.4.0 → 17.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,8 +35,9 @@ export interface ITranslation {
35
35
  translation: string;
36
36
  }
37
37
  export interface ITranslations {
38
- [key: string]: any;
38
+ [key: string]: string;
39
39
  }
40
+ export type GlobalTranslations = Record<string, ITranslations>;
40
41
  export interface ILanguageSetting {
41
42
  unavailable?: string;
42
43
  [key: string]: string | boolean | number;
@@ -258,6 +259,10 @@ export interface IHttpService {
258
259
  makeListParams(page: number, itemsPerPage: number, orderBy?: string, orderDescending?: boolean, filter?: string): IHttpParams;
259
260
  }
260
261
  export declare const EXPRESS_REQUEST: InjectionToken<Request>;
262
+ export interface IBaseHttpClient extends HttpClient {
263
+ requestHeaders: IHttpHeaders;
264
+ requestParams: IHttpParams;
265
+ }
261
266
  export interface IApiService extends IHttpService {
262
267
  cache: any;
263
268
  client: HttpClient;
@@ -331,6 +336,7 @@ export declare class IConfiguration {
331
336
  [key: string]: any;
332
337
  }
333
338
  export interface IConfigService {
339
+ readonly http: IBaseHttpClient;
334
340
  readonly config: IConfiguration;
335
341
  readonly injector: Injector;
336
342
  readonly load: () => Promise<IConfiguration>;
@@ -54,8 +54,8 @@ import { PaginationMenuComponent } from "./components/pagination-menu/pagination
54
54
  import { UnorderedListComponent } from "./components/unordered-list/unordered-list.component";
55
55
  export declare const pipes: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof TranslatePipe)[];
56
56
  export declare const directives: (typeof AsyncMethodBase | typeof BackgroundDirective | typeof DropdownDirective | typeof DropdownContentDirective | typeof DropdownToggleDirective | typeof DynamicTableTemplateDirective | typeof GlobalTemplateDirective | typeof IconDirective | typeof NgxTemplateOutletDirective | typeof PaginationDirective | typeof PaginationItemDirective | typeof ResourceIfDirective | typeof StickyDirective | typeof StickyClassDirective | typeof UnorderedListItemDirective | typeof UnorderedListTemplateDirective)[];
57
- export declare const components: (typeof DropdownBoxComponent | typeof DynamicTableComponent | typeof PaginationMenuComponent | typeof UnorderedListComponent)[];
58
- export declare const providers: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof TranslatePipe | typeof BaseHttpClient | typeof BaseHttpService | typeof AuthGuard | typeof AclService | typeof StaticAuthService | typeof ConfigService | typeof ErrorHandlerService | typeof EventsService | typeof FormatterService | typeof GlobalTemplateService | typeof IconService | typeof StaticLanguageService | typeof OpenApiService | typeof PromiseService | typeof StateService | typeof StorageService | typeof ConsoleToasterService | typeof TranslatedUrlSerializer | typeof UniversalService | typeof WasmService | typeof DeviceDetectorService | {
57
+ export declare const components: (typeof UnorderedListComponent | typeof DropdownBoxComponent | typeof DynamicTableComponent | typeof PaginationMenuComponent)[];
58
+ export declare const providers: (typeof UniversalService | typeof StateService | typeof AuthGuard | typeof BaseHttpClient | typeof StorageService | typeof BaseHttpService | typeof WasmService | typeof AclService | typeof StaticAuthService | typeof ConfigService | typeof ErrorHandlerService | typeof EventsService | typeof FormatterService | typeof GlobalTemplateService | typeof IconService | typeof StaticLanguageService | typeof OpenApiService | typeof ConsoleToasterService | typeof TranslatedUrlSerializer | typeof PromiseService | typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof TranslatePipe | typeof DeviceDetectorService | {
59
59
  provide: import("@angular/core").InjectionToken<import("@angular/platform-browser").EventManagerPlugin[]>;
60
60
  useClass: typeof ResizeEventPlugin;
61
61
  multi: boolean;
@@ -4,7 +4,7 @@ import * as i0 from "@angular/core";
4
4
  export declare class TranslatePipe implements PipeTransform {
5
5
  readonly cdr: ChangeDetectorRef;
6
6
  readonly language: ILanguageService;
7
- private lang;
7
+ private dictionary;
8
8
  private disabled;
9
9
  private query;
10
10
  private args;
@@ -1,7 +1,7 @@
1
1
  import { HttpClient, HttpHandler, HttpHeaders, HttpParams } from "@angular/common/http";
2
- import { IHttpHeaders, IHttpParams } from "../common-types";
2
+ import { IBaseHttpClient, IHttpHeaders, IHttpParams } from "../common-types";
3
3
  import * as i0 from "@angular/core";
4
- export declare class BaseHttpClient extends HttpClient {
4
+ export declare class BaseHttpClient extends HttpClient implements IBaseHttpClient {
5
5
  requestHeaders: IHttpHeaders;
6
6
  requestParams: IHttpParams;
7
7
  renewTokenFunc: () => void;
@@ -1,10 +1,10 @@
1
1
  import { Injector } from "@angular/core";
2
- import { HttpClient } from "@angular/common/http";
3
2
  import { UniversalService } from "./universal.service";
4
3
  import { IConfigService, IConfiguration } from "../common-types";
4
+ import { BaseHttpClient } from "./base-http.client";
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class ConfigService implements IConfigService {
7
- readonly http: HttpClient;
7
+ readonly http: BaseHttpClient;
8
8
  readonly universal: UniversalService;
9
9
  readonly injector: Injector;
10
10
  readonly rootElement: any;
@@ -17,7 +17,7 @@ export declare class ConfigService implements IConfigService {
17
17
  get load(): () => Promise<IConfiguration>;
18
18
  get config(): IConfiguration;
19
19
  get configUrl(): string;
20
- constructor(http: HttpClient, universal: UniversalService, injector: Injector, rootElement: any, baseUrl: string, baseConfig?: IConfiguration, scriptParams?: any);
20
+ constructor(http: BaseHttpClient, universal: UniversalService, injector: Injector, rootElement: any, baseUrl: string, baseConfig?: IConfiguration, scriptParams?: any);
21
21
  protected initService(): void;
22
22
  protected loadJson(): Promise<IConfiguration>;
23
23
  protected prepareConfig(config: IConfiguration): Promise<IConfiguration>;
@@ -4,6 +4,7 @@ export declare class EventsService {
4
4
  readonly eventForwarded: EventEmitter<Event>;
5
5
  readonly stickyUpdated: EventEmitter<boolean>;
6
6
  readonly languageChanged: EventEmitter<string>;
7
+ readonly editLanguageChanged: EventEmitter<string>;
7
8
  private sticky;
8
9
  get isSticky(): boolean;
9
10
  constructor();
@@ -3,7 +3,7 @@ import { ILanguageSetting, ILanguageSettings, ITranslations } from "../common-ty
3
3
  import { StaticLanguageService } from "./static-language.service";
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class LanguageService extends StaticLanguageService {
6
- protected translationRequests: ITranslations;
6
+ protected translationRequests: Record<string, Promise<ITranslations>>;
7
7
  protected settingsPromise: Promise<ILanguageSettings>;
8
8
  protected languageSettings: BehaviorSubject<ILanguageSettings>;
9
9
  get currentLanguage(): string;
@@ -14,7 +14,7 @@ export declare class LanguageService extends StaticLanguageService {
14
14
  initFromSettings(): Promise<any>;
15
15
  getTranslation(key: string, params?: any): Promise<string>;
16
16
  protected useLanguage(lang: string): Promise<ITranslations>;
17
- protected loadDictionary(): Promise<any>;
17
+ getDictionary(lang?: string): Promise<ITranslations>;
18
18
  protected loadSettings(): Promise<ILanguageSettings>;
19
19
  static ɵfac: i0.ɵɵFactoryDeclaration<LanguageService, never>;
20
20
  static ɵprov: i0.ɵɵInjectableDeclaration<LanguageService>;
@@ -1,4 +1,4 @@
1
- import { IConfigService, IConfiguration, ILanguageService, IPromiseService, ITranslation, ITranslations } from "../common-types";
1
+ import { GlobalTranslations, IConfigService, IConfiguration, ILanguageService, IPromiseService, ITranslation, ITranslations } from "../common-types";
2
2
  import { EventsService } from "./events.service";
3
3
  import { StorageService } from "./storage.service";
4
4
  import { UniversalService } from "./universal.service";
@@ -28,11 +28,14 @@ export declare class StaticLanguageService implements ILanguageService {
28
28
  protected currentLang: string;
29
29
  protected disableTrans: boolean;
30
30
  protected languageList: string[];
31
- protected readonly translations: ITranslations;
31
+ protected readonly translations: GlobalTranslations;
32
+ protected overrideTranslations: GlobalTranslations;
33
+ protected mergedTranslations: GlobalTranslations;
32
34
  constructor(events: EventsService, storage: StorageService, configs: IConfigService, promises: IPromiseService, client: BaseHttpClient);
33
35
  protected initService(): void;
34
36
  replaceLanguages(languages: string[]): void;
35
37
  addLanguages(languages: string[]): void;
38
+ setOverrideTranslations(translations: GlobalTranslations): void;
36
39
  getTranslationSync(key: string, params?: any): string;
37
40
  getTranslation(key: string, params?: any): Promise<string>;
38
41
  getTranslations(...keys: string[]): Promise<ITranslations>;
@@ -41,6 +44,7 @@ export declare class StaticLanguageService implements ILanguageService {
41
44
  protected interpolate(expr: string | Function, params?: any): string;
42
45
  protected interpolateString(expr: string, params?: any): string;
43
46
  protected getDefaultLanguage(): string;
47
+ protected mergeTranslations(): void;
44
48
  static ɵfac: i0.ɵɵFactoryDeclaration<StaticLanguageService, never>;
45
49
  static ɵprov: i0.ɵɵInjectableDeclaration<StaticLanguageService>;
46
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stemy/ngx-utils",
3
- "version": "17.4.0",
3
+ "version": "17.4.2",
4
4
  "license": "MIT",
5
5
  "public": true,
6
6
  "repository": "https://github.com/stemyke/ngx-utils.git",
package/public_api.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { TypedFactoryProvider, TypedValueProvider, CachedProvider, CachedFactory, OPTIONS_TOKEN, IResolveFactory, CanvasColor, IIconService, ICON_SERVICE, ITranslation, ITranslations, ILanguageSetting, ILanguageSettings, ILanguageService, LANGUAGE_SERVICE, IAuthService, RouteValidator, IRouteData, IRoute, AUTH_SERVICE, IAclComponent, IPromiseService, PROMISE_SERVICE, IWasi, IWasmExports, IWasm, IWasmAsync, WASI_IMPLEMENTATION, IRouteStateInfo, NavigationUrlParam, StorageMode, IToasterService, TOASTER_SERVICE, IAsyncMessage, AsyncMethod, DropdownAttachTo, UnorderedListTemplate, UnorderedListTemplates, UnorderedListStyle, IAjaxRequestDetails, AjaxRequestCallback, ScriptType, IScriptPromises, IStylePromises, ISearchObservable, FactoryDependencies, ObjectType, ITimer, IExtraProperties, IGroupMap, TranslationQuery, IPageInfo, IPaginationData, PaginationDataLoader, PaginationItemContext, IHttpHeaders, IHttpParams, IRequestOptions, IIssueContext, IProgress, ProgressListener, PromiseExecutor, HttpPromise, IHttpService, EXPRESS_REQUEST, IApiService, API_SERVICE, IOpenApiSchemaProperty, IOpenApiSchema, IOpenApiSchemas, ITableOrders, ITableColumn, ITableColumns, TableColumns, ITableTemplate, ITableTemplates, ITableDataQuery, TableDataLoader, ResourceIfContext, APP_BASE_URL, IConfiguration, IConfigService, CONFIG_SERVICE, BASE_CONFIG, SCRIPT_PARAMS, ROOT_ELEMENT, RESIZE_DELAY, ResizeEventStrategy, RESIZE_STRATEGY, ErrorHandlerCallback, ERROR_HANDLER, GlobalComponentModifier, AppInitializerFunc, IModuleConfig, ValuedPromise } from "./ngx-utils/common-types";
1
+ export { TypedFactoryProvider, TypedValueProvider, CachedProvider, CachedFactory, OPTIONS_TOKEN, IResolveFactory, CanvasColor, IIconService, ICON_SERVICE, ITranslation, ITranslations, GlobalTranslations, ILanguageSetting, ILanguageSettings, ILanguageService, LANGUAGE_SERVICE, IAuthService, RouteValidator, IRouteData, IRoute, AUTH_SERVICE, IAclComponent, IPromiseService, PROMISE_SERVICE, IWasi, IWasmExports, IWasm, IWasmAsync, WASI_IMPLEMENTATION, IRouteStateInfo, NavigationUrlParam, StorageMode, IToasterService, TOASTER_SERVICE, IAsyncMessage, AsyncMethod, DropdownAttachTo, UnorderedListTemplate, UnorderedListTemplates, UnorderedListStyle, IAjaxRequestDetails, AjaxRequestCallback, ScriptType, IScriptPromises, IStylePromises, ISearchObservable, FactoryDependencies, ObjectType, ITimer, IExtraProperties, IGroupMap, TranslationQuery, IPageInfo, IPaginationData, PaginationDataLoader, PaginationItemContext, IHttpHeaders, IHttpParams, IRequestOptions, IIssueContext, IProgress, ProgressListener, PromiseExecutor, HttpPromise, IHttpService, EXPRESS_REQUEST, IBaseHttpClient, IApiService, API_SERVICE, IOpenApiSchemaProperty, IOpenApiSchema, IOpenApiSchemas, ITableOrders, ITableColumn, ITableColumns, TableColumns, ITableTemplate, ITableTemplates, ITableDataQuery, TableDataLoader, ResourceIfContext, APP_BASE_URL, IConfiguration, IConfigService, CONFIG_SERVICE, BASE_CONFIG, SCRIPT_PARAMS, ROOT_ELEMENT, RESIZE_DELAY, ResizeEventStrategy, RESIZE_STRATEGY, ErrorHandlerCallback, ERROR_HANDLER, GlobalComponentModifier, AppInitializerFunc, IModuleConfig, ValuedPromise } from "./ngx-utils/common-types";
2
2
  export { AjaxRequestHandler } from "./ngx-utils/utils/ajax-request-handler";
3
3
  export { ArrayUtils } from "./ngx-utils/utils/array.utils";
4
4
  export { AuthGuard } from "./ngx-utils/utils/auth.guard";