@stemy/ngx-utils 19.0.1 → 19.0.3

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.
@@ -96,13 +96,56 @@ export declare enum StorageMode {
96
96
  Local = 0,
97
97
  Session = 1
98
98
  }
99
+ export type ToastType = "info" | "success" | "warning" | "error";
99
100
  export interface IToasterService {
100
- error(message: string, params?: any, title?: string): void;
101
- info(message: string, params?: any, title?: string): void;
102
- success(message: string, params?: any, title?: string): void;
103
- warning(message: string, params?: any, title?: string): void;
101
+ error(message: string, params?: any): void;
102
+ info(message: string, params?: any): void;
103
+ success(message: string, params?: any): void;
104
+ warning(message: string, params?: any): void;
105
+ handleAsyncMethod(method: AsyncMethod, context?: any): void;
104
106
  }
105
107
  export declare const TOASTER_SERVICE: InjectionToken<IToasterService>;
108
+ export interface IDialogButtonConfig {
109
+ icon?: string;
110
+ text?: string;
111
+ classes?: string;
112
+ method?: AsyncMethod;
113
+ }
114
+ export interface IDialogConfig {
115
+ id?: string;
116
+ title?: string;
117
+ message: string;
118
+ messageContext?: any;
119
+ buttons?: IDialogButtonConfig[];
120
+ onClose?: AsyncMethod;
121
+ size?: string;
122
+ type?: string;
123
+ templates?: {
124
+ [id: string]: TemplateRef<any>;
125
+ };
126
+ }
127
+ export interface IConfirmDialogConfig {
128
+ id?: string;
129
+ title?: string;
130
+ message: string;
131
+ messageContext?: any;
132
+ buttons?: IDialogButtonConfig[];
133
+ method?: AsyncMethod;
134
+ cancelMethod?: AsyncMethod;
135
+ size?: string;
136
+ templates?: {
137
+ [id: string]: TemplateRef<any>;
138
+ };
139
+ okText?: string;
140
+ okClasses?: string;
141
+ cancelText?: string;
142
+ cancelClasses?: string;
143
+ }
144
+ export interface IDialogService {
145
+ dialog(config: IDialogConfig): void;
146
+ confirm(config: IConfirmDialogConfig): void;
147
+ }
148
+ export declare const DIALOG_SERVICE: InjectionToken<IDialogService>;
106
149
  export interface IPromiseService {
107
150
  zone: NgZone;
108
151
  count: number;
@@ -359,6 +402,7 @@ export interface IModuleConfig {
359
402
  toasterService?: Type<IToasterService>;
360
403
  promiseService?: Type<IPromiseService>;
361
404
  configService?: Type<IConfigService>;
405
+ dialogService?: Type<IDialogService>;
362
406
  wasiImplementation?: Type<IWasi>;
363
407
  initializeApp?: (injector: Injector) => AppInitializerFunc;
364
408
  baseUrl?: (injector: Injector) => string;
@@ -18,7 +18,7 @@ import { OpenApiService } from "./services/open-api.service";
18
18
  import { StateService } from "./services/state.service";
19
19
  import { StaticLanguageService } from "./services/static-language.service";
20
20
  import { StorageService } from "./services/storage.service";
21
- import { ConsoleToasterService } from "./services/toaster.service";
21
+ import { BaseToasterService } from "./services/toaster.service";
22
22
  import { TranslatedUrlSerializer } from "./services/translated-url.serializer";
23
23
  import { UniversalService } from "./services/universal.service";
24
24
  import { WasmService } from "./services/wasm.service";
@@ -50,7 +50,7 @@ import { UnorderedListComponent } from "./components/unordered-list/unordered-li
50
50
  export declare const pipes: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof TranslatePipe)[];
51
51
  export declare const directives: (typeof AsyncMethodBase | typeof BackgroundDirective | typeof DynamicTableTemplateDirective | typeof GlobalTemplateDirective | typeof IconDirective | typeof NgxTemplateOutletDirective | typeof PaginationDirective | typeof PaginationItemDirective | typeof ResourceIfDirective | typeof StickyDirective | typeof StickyClassDirective | typeof UnorderedListItemDirective | typeof UnorderedListTemplateDirective)[];
52
52
  export declare const components: (typeof DynamicTableComponent | typeof PaginationMenuComponent | typeof UnorderedListComponent)[];
53
- export declare const providers: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | 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 | {
53
+ export declare const providers: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | 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 BaseToasterService | typeof TranslatedUrlSerializer | typeof UniversalService | typeof WasmService | typeof DeviceDetectorService | {
54
54
  provide: import("@angular/core").InjectionToken<import("@angular/platform-browser").EventManagerPlugin[]>;
55
55
  useClass: typeof ResizeEventPlugin;
56
56
  multi: boolean;
@@ -56,6 +56,6 @@ export declare class NgxUtilsModule {
56
56
  static provideUtils(config?: IModuleConfig): EnvironmentProviders;
57
57
  constructor();
58
58
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxUtilsModule, never>;
59
- static ɵmod: i0.ɵɵNgModuleDeclaration<NgxUtilsModule, [typeof i1.ChunkPipe, typeof i2.EntriesPipe, typeof i3.ExtraItemPropertiesPipe, typeof i4.FilterPipe, typeof i5.FindPipe, typeof i6.FormatNumberPipe, typeof i7.GetOffsetPipe, typeof i8.GetTypePipe, typeof i9.GetValuePipe, typeof i10.GlobalTemplatePipe, typeof i11.GroupByPipe, typeof i12.IsTypePipe, typeof i13.JoinPipe, typeof i14.KeysPipe, typeof i15.MapPipe, typeof i16.MaxPipe, typeof i17.MinPipe, typeof i18.PopPipe, typeof i19.ReducePipe, typeof i20.RemapPipe, typeof i21.ReplacePipe, typeof i22.ReversePipe, typeof i23.RoundPipe, typeof i24.SafeHtmlPipe, typeof i25.ShiftPipe, typeof i26.SplitPipe, typeof i27.TranslatePipe, typeof i28.ValuesPipe, typeof i29.AsyncMethodBase, typeof i30.AsyncMethodDirective, typeof i31.BackgroundDirective, typeof i32.DynamicTableTemplateDirective, typeof i33.GlobalTemplateDirective, typeof i34.IconDirective, typeof i35.NgxTemplateOutletDirective, typeof i36.PaginationDirective, typeof i37.PaginationItemDirective, typeof i38.ResourceIfDirective, typeof i39.StickyDirective, typeof i40.StickyClassDirective, typeof i41.UnorderedListItemDirective, typeof i42.UnorderedListTemplateDirective, typeof i43.DynamicTableComponent, typeof i44.PaginationMenuComponent, typeof i45.UnorderedListComponent], [typeof i46.CommonModule, typeof i47.FormsModule], [typeof i1.ChunkPipe, typeof i2.EntriesPipe, typeof i3.ExtraItemPropertiesPipe, typeof i4.FilterPipe, typeof i5.FindPipe, typeof i6.FormatNumberPipe, typeof i7.GetOffsetPipe, typeof i8.GetTypePipe, typeof i9.GetValuePipe, typeof i10.GlobalTemplatePipe, typeof i11.GroupByPipe, typeof i12.IsTypePipe, typeof i13.JoinPipe, typeof i14.KeysPipe, typeof i15.MapPipe, typeof i16.MaxPipe, typeof i17.MinPipe, typeof i18.PopPipe, typeof i19.ReducePipe, typeof i20.RemapPipe, typeof i21.ReplacePipe, typeof i22.ReversePipe, typeof i23.RoundPipe, typeof i24.SafeHtmlPipe, typeof i25.ShiftPipe, typeof i26.SplitPipe, typeof i27.TranslatePipe, typeof i28.ValuesPipe, typeof i47.FormsModule]>;
59
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxUtilsModule, [typeof i1.ChunkPipe, typeof i2.EntriesPipe, typeof i3.ExtraItemPropertiesPipe, typeof i4.FilterPipe, typeof i5.FindPipe, typeof i6.FormatNumberPipe, typeof i7.GetOffsetPipe, typeof i8.GetTypePipe, typeof i9.GetValuePipe, typeof i10.GlobalTemplatePipe, typeof i11.GroupByPipe, typeof i12.IsTypePipe, typeof i13.JoinPipe, typeof i14.KeysPipe, typeof i15.MapPipe, typeof i16.MaxPipe, typeof i17.MinPipe, typeof i18.PopPipe, typeof i19.ReducePipe, typeof i20.RemapPipe, typeof i21.ReplacePipe, typeof i22.ReversePipe, typeof i23.RoundPipe, typeof i24.SafeHtmlPipe, typeof i25.ShiftPipe, typeof i26.SplitPipe, typeof i27.TranslatePipe, typeof i28.ValuesPipe, typeof i29.AsyncMethodBase, typeof i30.AsyncMethodDirective, typeof i31.BackgroundDirective, typeof i32.DynamicTableTemplateDirective, typeof i33.GlobalTemplateDirective, typeof i34.IconDirective, typeof i35.NgxTemplateOutletDirective, typeof i36.PaginationDirective, typeof i37.PaginationItemDirective, typeof i38.ResourceIfDirective, typeof i39.StickyDirective, typeof i40.StickyClassDirective, typeof i41.UnorderedListItemDirective, typeof i42.UnorderedListTemplateDirective, typeof i43.DynamicTableComponent, typeof i44.PaginationMenuComponent, typeof i45.UnorderedListComponent], [typeof i46.CommonModule, typeof i47.FormsModule], [typeof i1.ChunkPipe, typeof i2.EntriesPipe, typeof i3.ExtraItemPropertiesPipe, typeof i4.FilterPipe, typeof i5.FindPipe, typeof i6.FormatNumberPipe, typeof i7.GetOffsetPipe, typeof i8.GetTypePipe, typeof i9.GetValuePipe, typeof i10.GlobalTemplatePipe, typeof i11.GroupByPipe, typeof i12.IsTypePipe, typeof i13.JoinPipe, typeof i14.KeysPipe, typeof i15.MapPipe, typeof i16.MaxPipe, typeof i17.MinPipe, typeof i18.PopPipe, typeof i19.ReducePipe, typeof i20.RemapPipe, typeof i21.ReplacePipe, typeof i22.ReversePipe, typeof i23.RoundPipe, typeof i24.SafeHtmlPipe, typeof i25.ShiftPipe, typeof i26.SplitPipe, typeof i27.TranslatePipe, typeof i28.ValuesPipe, typeof i29.AsyncMethodBase, typeof i30.AsyncMethodDirective, typeof i31.BackgroundDirective, typeof i32.DynamicTableTemplateDirective, typeof i33.GlobalTemplateDirective, typeof i34.IconDirective, typeof i35.NgxTemplateOutletDirective, typeof i36.PaginationDirective, typeof i37.PaginationItemDirective, typeof i38.ResourceIfDirective, typeof i39.StickyDirective, typeof i40.StickyClassDirective, typeof i41.UnorderedListItemDirective, typeof i42.UnorderedListTemplateDirective, typeof i43.DynamicTableComponent, typeof i44.PaginationMenuComponent, typeof i45.UnorderedListComponent, typeof i47.FormsModule]>;
60
60
  static ɵinj: i0.ɵɵInjectorDeclaration<NgxUtilsModule>;
61
61
  }
@@ -0,0 +1,10 @@
1
+ import { IConfirmDialogConfig, IDialogConfig, IDialogService, IToasterService } from "../common-types";
2
+ import * as i0 from "@angular/core";
3
+ export declare class DialogService implements IDialogService {
4
+ readonly toaster: IToasterService;
5
+ constructor(toaster: IToasterService);
6
+ dialog(config: IDialogConfig): void;
7
+ confirm(config: IConfirmDialogConfig): void;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<DialogService, never>;
9
+ static ɵprov: i0.ɵɵInjectableDeclaration<DialogService>;
10
+ }
@@ -1,13 +1,16 @@
1
- import { ILanguageService, IToasterService } from "../common-types";
1
+ import { AsyncMethod, ILanguageService, IToasterService, ToastType } from "../common-types";
2
2
  import * as i0 from "@angular/core";
3
- export declare class ConsoleToasterService implements IToasterService {
3
+ export declare class BaseToasterService<T = any> implements IToasterService {
4
4
  private language;
5
+ protected colorMap: Record<ToastType, string>;
5
6
  constructor(language: ILanguageService);
6
- error(message: string, params?: any, title?: string): void;
7
- info(message: string, params?: any, title?: string): void;
8
- success(message: string, params?: any, title?: string): void;
9
- warning(message: string, params?: any, title?: string): void;
10
- private translateMessage;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<ConsoleToasterService, never>;
12
- static ɵprov: i0.ɵɵInjectableDeclaration<ConsoleToasterService>;
7
+ error(message: string, params?: any): void;
8
+ info(message: string, params?: any): void;
9
+ success(message: string, params?: any): void;
10
+ warning(message: string, params?: any): void;
11
+ handleAsyncMethod(method: AsyncMethod): void;
12
+ protected translateMessage(message: string, params: any, type: ToastType): void;
13
+ protected show(message: string, type: ToastType): any;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaseToasterService<any>, never>;
15
+ static ɵprov: i0.ɵɵInjectableDeclaration<BaseToasterService<any>>;
13
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stemy/ngx-utils",
3
- "version": "19.0.1",
3
+ "version": "19.0.3",
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, 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, ILanguageSetting, ILanguageSettings, ILanguageService, LANGUAGE_SERVICE, IAuthService, RouteValidator, IRouteData, IRoute, AUTH_SERVICE, IAclComponent, IDialogButtonConfig, IDialogConfig, IConfirmDialogConfig, IDialogService, DIALOG_SERVICE, IPromiseService, PROMISE_SERVICE, IWasi, IWasmExports, IWasm, IWasmAsync, WASI_IMPLEMENTATION, IRouteStateInfo, NavigationUrlParam, StorageMode, ToastType, IToasterService, TOASTER_SERVICE, IAsyncMessage, AsyncMethod, 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";
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";
@@ -31,6 +31,7 @@ export { StaticAuthService } from "./ngx-utils/services/auth.service";
31
31
  export { BaseHttpClient } from "./ngx-utils/services/base-http.client";
32
32
  export { BaseHttpService } from "./ngx-utils/services/base-http.service";
33
33
  export { ConfigService } from "./ngx-utils/services/config.service";
34
+ export { DialogService } from "./ngx-utils/services/dialog.service";
34
35
  export { ErrorHandlerService } from "./ngx-utils/services/error-handler.service";
35
36
  export { EventsService } from "./ngx-utils/services/events.service";
36
37
  export { FormatterService } from "./ngx-utils/services/formatter.service";
@@ -42,7 +43,7 @@ export { OpenApiService } from "./ngx-utils/services/open-api.service";
42
43
  export { IStateInfo, StateService } from "./ngx-utils/services/state.service";
43
44
  export { StaticLanguageService } from "./ngx-utils/services/static-language.service";
44
45
  export { StorageService } from "./ngx-utils/services/storage.service";
45
- export { ConsoleToasterService } from "./ngx-utils/services/toaster.service";
46
+ export { BaseToasterService } from "./ngx-utils/services/toaster.service";
46
47
  export { IUrlDictionary, TranslatedUrlSerializer } from "./ngx-utils/services/translated-url.serializer";
47
48
  export { PromiseService } from "./ngx-utils/services/promise.service";
48
49
  export { ResizeEventPlugin } from "./ngx-utils/plugins/resize-event.plugin";