@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.
- package/fesm2022/stemy-ngx-utils.mjs +96 -18
- package/fesm2022/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/common-types.d.ts +48 -4
- package/ngx-utils/ngx-utils.imports.d.ts +2 -2
- package/ngx-utils/ngx-utils.module.d.ts +1 -1
- package/ngx-utils/services/dialog.service.d.ts +10 -0
- package/ngx-utils/services/toaster.service.d.ts +12 -9
- package/package.json +1 -1
- package/public_api.d.ts +3 -2
|
@@ -390,6 +390,7 @@ var StorageMode;
|
|
|
390
390
|
StorageMode[StorageMode["Session"] = 1] = "Session";
|
|
391
391
|
})(StorageMode || (StorageMode = {}));
|
|
392
392
|
const TOASTER_SERVICE = new InjectionToken("toaster-service");
|
|
393
|
+
const DIALOG_SERVICE = new InjectionToken("dialog-service");
|
|
393
394
|
const PROMISE_SERVICE = new InjectionToken("promise-service");
|
|
394
395
|
const WASI_IMPLEMENTATION = new InjectionToken("wasi-implementation");
|
|
395
396
|
// --- Reflect utils ---
|
|
@@ -3052,6 +3053,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
3052
3053
|
args: [SCRIPT_PARAMS]
|
|
3053
3054
|
}] }] });
|
|
3054
3055
|
|
|
3056
|
+
class DialogService {
|
|
3057
|
+
constructor(toaster) {
|
|
3058
|
+
this.toaster = toaster;
|
|
3059
|
+
}
|
|
3060
|
+
dialog(config) {
|
|
3061
|
+
if (!config)
|
|
3062
|
+
return;
|
|
3063
|
+
const button = !config.buttons ? null : config.buttons[0];
|
|
3064
|
+
if (!button)
|
|
3065
|
+
return;
|
|
3066
|
+
this.toaster.handleAsyncMethod(button.method);
|
|
3067
|
+
}
|
|
3068
|
+
confirm(config) {
|
|
3069
|
+
if (!config)
|
|
3070
|
+
return;
|
|
3071
|
+
this.dialog({
|
|
3072
|
+
id: config.id,
|
|
3073
|
+
title: config.title,
|
|
3074
|
+
message: config.message,
|
|
3075
|
+
messageContext: config.messageContext,
|
|
3076
|
+
size: config.size,
|
|
3077
|
+
buttons: config.buttons || [
|
|
3078
|
+
{
|
|
3079
|
+
text: config.okText,
|
|
3080
|
+
classes: config.okClasses,
|
|
3081
|
+
method: config.method
|
|
3082
|
+
},
|
|
3083
|
+
{
|
|
3084
|
+
text: config.cancelText || "button.cancel",
|
|
3085
|
+
classes: config.cancelClasses || "btn-default",
|
|
3086
|
+
method: config.cancelMethod
|
|
3087
|
+
}
|
|
3088
|
+
],
|
|
3089
|
+
onClose: config.cancelMethod,
|
|
3090
|
+
templates: config.templates
|
|
3091
|
+
});
|
|
3092
|
+
}
|
|
3093
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DialogService, deps: [{ token: TOASTER_SERVICE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3094
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DialogService }); }
|
|
3095
|
+
}
|
|
3096
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DialogService, decorators: [{
|
|
3097
|
+
type: Injectable
|
|
3098
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
3099
|
+
type: Inject,
|
|
3100
|
+
args: [TOASTER_SERVICE]
|
|
3101
|
+
}] }] });
|
|
3102
|
+
|
|
3055
3103
|
class ErrorHandlerService extends ErrorHandler {
|
|
3056
3104
|
constructor(injector) {
|
|
3057
3105
|
super();
|
|
@@ -3537,29 +3585,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
3537
3585
|
args: [API_SERVICE]
|
|
3538
3586
|
}] }] });
|
|
3539
3587
|
|
|
3540
|
-
class
|
|
3588
|
+
class BaseToasterService {
|
|
3541
3589
|
constructor(language) {
|
|
3542
3590
|
this.language = language;
|
|
3591
|
+
this.colorMap = {
|
|
3592
|
+
info: "#2F96B4",
|
|
3593
|
+
success: "#51A351",
|
|
3594
|
+
warning: "#F89406",
|
|
3595
|
+
error: "#BD362F"
|
|
3596
|
+
};
|
|
3597
|
+
}
|
|
3598
|
+
error(message, params) {
|
|
3599
|
+
this.translateMessage(message, params, "error");
|
|
3543
3600
|
}
|
|
3544
|
-
|
|
3545
|
-
this.translateMessage(message, params,
|
|
3601
|
+
info(message, params) {
|
|
3602
|
+
this.translateMessage(message, params, "info");
|
|
3546
3603
|
}
|
|
3547
|
-
|
|
3548
|
-
this.translateMessage(message, params,
|
|
3604
|
+
success(message, params) {
|
|
3605
|
+
this.translateMessage(message, params, "success");
|
|
3549
3606
|
}
|
|
3550
|
-
|
|
3551
|
-
this.translateMessage(message, params,
|
|
3607
|
+
warning(message, params) {
|
|
3608
|
+
this.translateMessage(message, params, "warning");
|
|
3609
|
+
}
|
|
3610
|
+
handleAsyncMethod(method) {
|
|
3611
|
+
if (!method)
|
|
3612
|
+
return;
|
|
3613
|
+
method().then(result => {
|
|
3614
|
+
if (result) {
|
|
3615
|
+
this.success(result.message, result.context);
|
|
3616
|
+
}
|
|
3617
|
+
}, reason => {
|
|
3618
|
+
if (!reason || !reason.message)
|
|
3619
|
+
throw new Error("Reason must implement IAsyncMessage interface");
|
|
3620
|
+
this.error(reason.message, reason.context);
|
|
3621
|
+
});
|
|
3552
3622
|
}
|
|
3553
|
-
|
|
3554
|
-
this.
|
|
3623
|
+
translateMessage(message, params, type) {
|
|
3624
|
+
this.language.getTranslation(message, params).then(str => {
|
|
3625
|
+
this.show(message, type);
|
|
3626
|
+
});
|
|
3555
3627
|
}
|
|
3556
|
-
|
|
3557
|
-
|
|
3628
|
+
show(message, type) {
|
|
3629
|
+
console.log(message, `background: ${this.colorMap[type]}; color: #ffffff`);
|
|
3558
3630
|
}
|
|
3559
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
3560
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
3631
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseToasterService, deps: [{ token: LANGUAGE_SERVICE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3632
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseToasterService }); }
|
|
3561
3633
|
}
|
|
3562
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
3634
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseToasterService, decorators: [{
|
|
3563
3635
|
type: Injectable
|
|
3564
3636
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
3565
3637
|
type: Inject,
|
|
@@ -5572,7 +5644,7 @@ const providers = [
|
|
|
5572
5644
|
StateService,
|
|
5573
5645
|
StaticLanguageService,
|
|
5574
5646
|
StorageService,
|
|
5575
|
-
|
|
5647
|
+
BaseToasterService,
|
|
5576
5648
|
TranslatedUrlSerializer,
|
|
5577
5649
|
UniversalService,
|
|
5578
5650
|
WasmService,
|
|
@@ -5820,7 +5892,7 @@ class NgxUtilsModule {
|
|
|
5820
5892
|
},
|
|
5821
5893
|
{
|
|
5822
5894
|
provide: TOASTER_SERVICE,
|
|
5823
|
-
useExisting: (!config ? null : config.toasterService) ||
|
|
5895
|
+
useExisting: (!config ? null : config.toasterService) || BaseToasterService
|
|
5824
5896
|
},
|
|
5825
5897
|
{
|
|
5826
5898
|
provide: PROMISE_SERVICE,
|
|
@@ -5830,6 +5902,10 @@ class NgxUtilsModule {
|
|
|
5830
5902
|
provide: CONFIG_SERVICE,
|
|
5831
5903
|
useExisting: (!config ? null : config.configService) || ConfigService
|
|
5832
5904
|
},
|
|
5905
|
+
{
|
|
5906
|
+
provide: DIALOG_SERVICE,
|
|
5907
|
+
useExisting: (!config ? null : config.dialogService) || DialogService
|
|
5908
|
+
},
|
|
5833
5909
|
{
|
|
5834
5910
|
provide: WASI_IMPLEMENTATION,
|
|
5835
5911
|
useExisting: (!config ? null : config.wasiImplementation) || Wasi
|
|
@@ -5877,7 +5953,7 @@ class NgxUtilsModule {
|
|
|
5877
5953
|
}
|
|
5878
5954
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxUtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
5879
5955
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: NgxUtilsModule, declarations: [ChunkPipe, EntriesPipe, ExtraItemPropertiesPipe, FilterPipe, FindPipe, FormatNumberPipe, GetOffsetPipe, GetTypePipe, GetValuePipe, GlobalTemplatePipe, GroupByPipe, IsTypePipe, JoinPipe, KeysPipe, MapPipe, MaxPipe, MinPipe, PopPipe, ReducePipe, RemapPipe, ReplacePipe, ReversePipe, RoundPipe, SafeHtmlPipe, ShiftPipe, SplitPipe, TranslatePipe, ValuesPipe, AsyncMethodBase, AsyncMethodDirective, BackgroundDirective, DynamicTableTemplateDirective, GlobalTemplateDirective, IconDirective, NgxTemplateOutletDirective, PaginationDirective, PaginationItemDirective, ResourceIfDirective, StickyDirective, StickyClassDirective, UnorderedListItemDirective, UnorderedListTemplateDirective, DynamicTableComponent, PaginationMenuComponent, UnorderedListComponent], imports: [CommonModule,
|
|
5880
|
-
FormsModule], exports: [ChunkPipe, EntriesPipe, ExtraItemPropertiesPipe, FilterPipe, FindPipe, FormatNumberPipe, GetOffsetPipe, GetTypePipe, GetValuePipe, GlobalTemplatePipe, GroupByPipe, IsTypePipe, JoinPipe, KeysPipe, MapPipe, MaxPipe, MinPipe, PopPipe, ReducePipe, RemapPipe, ReplacePipe, ReversePipe, RoundPipe, SafeHtmlPipe, ShiftPipe, SplitPipe, TranslatePipe, ValuesPipe, FormsModule] }); }
|
|
5956
|
+
FormsModule], exports: [ChunkPipe, EntriesPipe, ExtraItemPropertiesPipe, FilterPipe, FindPipe, FormatNumberPipe, GetOffsetPipe, GetTypePipe, GetValuePipe, GlobalTemplatePipe, GroupByPipe, IsTypePipe, JoinPipe, KeysPipe, MapPipe, MaxPipe, MinPipe, PopPipe, ReducePipe, RemapPipe, ReplacePipe, ReversePipe, RoundPipe, SafeHtmlPipe, ShiftPipe, SplitPipe, TranslatePipe, ValuesPipe, AsyncMethodBase, AsyncMethodDirective, BackgroundDirective, DynamicTableTemplateDirective, GlobalTemplateDirective, IconDirective, NgxTemplateOutletDirective, PaginationDirective, PaginationItemDirective, ResourceIfDirective, StickyDirective, StickyClassDirective, UnorderedListItemDirective, UnorderedListTemplateDirective, DynamicTableComponent, PaginationMenuComponent, UnorderedListComponent, FormsModule] }); }
|
|
5881
5957
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxUtilsModule, providers: pipes, imports: [CommonModule,
|
|
5882
5958
|
FormsModule, FormsModule] }); }
|
|
5883
5959
|
}
|
|
@@ -5895,6 +5971,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
5895
5971
|
],
|
|
5896
5972
|
exports: [
|
|
5897
5973
|
...pipes,
|
|
5974
|
+
...directives,
|
|
5975
|
+
...components,
|
|
5898
5976
|
FormsModule
|
|
5899
5977
|
],
|
|
5900
5978
|
providers: pipes
|
|
@@ -5905,5 +5983,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
5905
5983
|
* Generated bundle index. Do not edit.
|
|
5906
5984
|
*/
|
|
5907
5985
|
|
|
5908
|
-
export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService,
|
|
5986
|
+
export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, BaseToasterService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, DIALOG_SERVICE, DateUtils, DialogService, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileSystemEntry, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GenericValue, GetOffsetPipe, GetTypePipe, GetValuePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, Initializer, IsTypePipe, JSONfn, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, LocalHttpService, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, OPTIONS_TOKEN, ObjectType, ObjectUtils, ObservableUtils, OpenApiService, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PopPipe, PromiseService, RESIZE_DELAY, RESIZE_STRATEGY, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, ValuedPromise, ValuesPipe, Vector, WASI_IMPLEMENTATION, WasmService, cachedFactory, cancelablePromise, impatientPromise, provideWithOptions };
|
|
5909
5987
|
//# sourceMappingURL=stemy-ngx-utils.mjs.map
|