@stemy/ngx-utils 17.5.0 → 17.5.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.
@@ -67,6 +67,12 @@ export interface ILanguageService {
67
67
  getTranslationFromArray(translations: ITranslation[], params?: any, lang?: string): string;
68
68
  }
69
69
  export declare const LANGUAGE_SERVICE: InjectionToken<ILanguageService>;
70
+ export interface IUserData {
71
+ _id?: string;
72
+ id?: string;
73
+ email?: string;
74
+ [key: string]: any;
75
+ }
70
76
  export interface IAuthService {
71
77
  isAuthenticated: boolean;
72
78
  userChanged: EventEmitter<any>;
@@ -163,12 +169,14 @@ export interface IAjaxRequestDetails {
163
169
  }
164
170
  export type AjaxRequestCallback = (details: IAjaxRequestDetails, params: any) => void;
165
171
  export type ScriptType = "text/javascript" | "module";
166
- export interface IScriptPromises {
167
- [src: string]: Promise<HTMLScriptElement>;
168
- }
169
- export interface IStylePromises {
170
- [src: string]: Promise<HTMLLinkElement>;
171
- }
172
+ export interface LoadableElement extends HTMLElement {
173
+ readyState?: string;
174
+ onreadystatechange?: Function;
175
+ }
176
+ export type LoaderPromises<T extends LoadableElement> = Record<string, {
177
+ elem: T;
178
+ promise: Promise<T>;
179
+ }>;
172
180
  export interface ISearchObservable {
173
181
  search: string;
174
182
  getSearchResults(token: string): Promise<any[]>;
@@ -55,7 +55,7 @@ import { UnorderedListComponent } from "./components/unordered-list/unordered-li
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
57
  export declare const components: (typeof UnorderedListComponent | typeof DropdownBoxComponent | typeof DynamicTableComponent | typeof PaginationMenuComponent)[];
58
- export declare const providers: (typeof DeviceDetectorService | 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 | {
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;
@@ -1,12 +1,16 @@
1
- import { EventEmitter } from "@angular/core";
1
+ import { Subject } from "rxjs";
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class EventsService {
4
- readonly eventForwarded: EventEmitter<Event>;
5
- readonly stickyUpdated: EventEmitter<boolean>;
6
- readonly languageChanged: EventEmitter<string>;
7
- readonly editLanguageChanged: EventEmitter<string>;
4
+ readonly eventForwarded: Subject<Event>;
5
+ readonly stickyUpdated: Subject<boolean>;
6
+ readonly languageChanged: Subject<string>;
7
+ readonly editLanguageChanged: Subject<string>;
8
+ readonly translationsEnabled: Subject<boolean>;
9
+ readonly userChanged: Subject<any>;
8
10
  private sticky;
11
+ private user;
9
12
  get isSticky(): boolean;
13
+ get isAuthenticated(): boolean;
10
14
  constructor();
11
15
  event(e: Event): void;
12
16
  updateSticky(sticky: boolean): void;
@@ -12,9 +12,10 @@ export declare class LanguageService extends StaticLanguageService {
12
12
  get $settings(): Observable<ILanguageSetting>;
13
13
  protected initService(): void;
14
14
  initFromSettings(): Promise<any>;
15
- getTranslation(key: string, params?: any): Promise<string>;
15
+ protected selectLanguage(lang: string): string;
16
16
  protected useLanguage(lang: string): Promise<ITranslations>;
17
- getDictionary(lang?: string): Promise<ITranslations>;
17
+ getDictionary(lang: string): Promise<ITranslations>;
18
+ protected loadDictionary(): Promise<ITranslations>;
18
19
  protected loadSettings(): Promise<ILanguageSettings>;
19
20
  static ɵfac: i0.ɵɵFactoryDeclaration<LanguageService, never>;
20
21
  static ɵprov: i0.ɵɵInjectableDeclaration<LanguageService>;
@@ -5,6 +5,7 @@ import { UniversalService } from "./universal.service";
5
5
  import { BaseHttpClient } from "./base-http.client";
6
6
  import { HttpClient } from "@angular/common/http";
7
7
  import * as i0 from "@angular/core";
8
+ export declare const EMPTY_DICT: ITranslations;
8
9
  export declare class StaticLanguageService implements ILanguageService {
9
10
  readonly events: EventsService;
10
11
  readonly storage: StorageService;
@@ -19,6 +20,8 @@ export declare class StaticLanguageService implements ILanguageService {
19
20
  set currentLanguage(lang: string);
20
21
  get editLanguage(): string;
21
22
  set editLanguage(lang: string);
23
+ get enableTranslations(): boolean;
24
+ set enableTranslations(value: boolean);
22
25
  get disableTranslations(): boolean;
23
26
  set disableTranslations(value: boolean);
24
27
  get httpClient(): HttpClient;
@@ -26,7 +29,7 @@ export declare class StaticLanguageService implements ILanguageService {
26
29
  get universal(): UniversalService;
27
30
  protected editLang: string;
28
31
  protected currentLang: string;
29
- protected disableTrans: boolean;
32
+ protected enableTrans: boolean;
30
33
  protected languageList: string[];
31
34
  protected readonly translations: GlobalTranslations;
32
35
  protected overrideTranslations: GlobalTranslations;
@@ -36,13 +39,15 @@ export declare class StaticLanguageService implements ILanguageService {
36
39
  replaceLanguages(languages: string[]): void;
37
40
  addLanguages(languages: string[]): void;
38
41
  setOverrideTranslations(translations: GlobalTranslations): void;
39
- getTranslationSync(key: string, params?: any): string;
42
+ getTranslationSync(key: string, params?: Object): string;
40
43
  getTranslation(key: string, params?: any): Promise<string>;
41
44
  getTranslations(...keys: string[]): Promise<ITranslations>;
42
45
  getTranslationFromObject(translations: ITranslations, params?: any, lang?: string): string;
43
46
  getTranslationFromArray(translations: ITranslation[], params?: any, lang?: string): string;
44
- protected interpolate(expr: string | Function, params?: any): string;
45
- protected interpolateString(expr: string, params?: any): string;
47
+ protected loadDictionary(): Promise<ITranslations>;
48
+ protected setDictionary(lang: string, dictionary: ITranslations): ITranslations;
49
+ protected interpolate(expr: string | Function, params?: Object): string;
50
+ protected interpolateString(expr: string, params?: Object): string;
46
51
  protected getDefaultLanguage(): string;
47
52
  protected mergeTranslations(): void;
48
53
  static ɵfac: i0.ɵɵFactoryDeclaration<StaticLanguageService, never>;
@@ -1,7 +1,8 @@
1
- import { ScriptType, IScriptPromises, IStylePromises } from "../common-types";
1
+ import { ScriptType } from "../common-types";
2
2
  export declare class LoaderUtils {
3
- static scriptPromises: IScriptPromises;
4
- static stylePromises: IStylePromises;
5
- static loadScript(src: string, async?: boolean, type?: ScriptType): Promise<HTMLScriptElement>;
6
- static loadStyle(src: string): Promise<HTMLLinkElement>;
3
+ private static promises;
4
+ static loadScript(src: string | URL, async?: boolean, type?: ScriptType, parent?: Node, time?: boolean | string): Promise<HTMLScriptElement>;
5
+ static loadStyle(src: string | URL, parent?: Node, time?: boolean | string): Promise<HTMLLinkElement>;
6
+ private static updateSrc;
7
+ private static loadElement;
7
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stemy/ngx-utils",
3
- "version": "17.5.0",
3
+ "version": "17.5.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, 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";
1
+ export { TypedFactoryProvider, TypedValueProvider, CachedProvider, CachedFactory, OPTIONS_TOKEN, IResolveFactory, CanvasColor, IIconService, ICON_SERVICE, ITranslation, ITranslations, GlobalTranslations, ILanguageSetting, ILanguageSettings, ILanguageService, LANGUAGE_SERVICE, IUserData, 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, LoadableElement, LoaderPromises, 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";