@stemy/ngx-utils 19.0.2 → 19.0.4
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 +94 -17
- 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 +4 -3
- 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
|
+
};
|
|
3543
3597
|
}
|
|
3544
|
-
error(message, params
|
|
3545
|
-
this.translateMessage(message, params,
|
|
3598
|
+
error(message, params) {
|
|
3599
|
+
this.translateMessage(message, params, "error");
|
|
3546
3600
|
}
|
|
3547
|
-
info(message, params
|
|
3548
|
-
this.translateMessage(message, params,
|
|
3601
|
+
info(message, params) {
|
|
3602
|
+
this.translateMessage(message, params, "info");
|
|
3549
3603
|
}
|
|
3550
|
-
success(message, params
|
|
3551
|
-
this.translateMessage(message, params,
|
|
3604
|
+
success(message, params) {
|
|
3605
|
+
this.translateMessage(message, params, "success");
|
|
3606
|
+
}
|
|
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,
|
|
@@ -5560,6 +5632,7 @@ const providers = [
|
|
|
5560
5632
|
ApiService,
|
|
5561
5633
|
StaticAuthService,
|
|
5562
5634
|
ConfigService,
|
|
5635
|
+
DialogService,
|
|
5563
5636
|
ErrorHandlerService,
|
|
5564
5637
|
EventsService,
|
|
5565
5638
|
FormatterService,
|
|
@@ -5572,7 +5645,7 @@ const providers = [
|
|
|
5572
5645
|
StateService,
|
|
5573
5646
|
StaticLanguageService,
|
|
5574
5647
|
StorageService,
|
|
5575
|
-
|
|
5648
|
+
BaseToasterService,
|
|
5576
5649
|
TranslatedUrlSerializer,
|
|
5577
5650
|
UniversalService,
|
|
5578
5651
|
WasmService,
|
|
@@ -5820,7 +5893,7 @@ class NgxUtilsModule {
|
|
|
5820
5893
|
},
|
|
5821
5894
|
{
|
|
5822
5895
|
provide: TOASTER_SERVICE,
|
|
5823
|
-
useExisting: (!config ? null : config.toasterService) ||
|
|
5896
|
+
useExisting: (!config ? null : config.toasterService) || BaseToasterService
|
|
5824
5897
|
},
|
|
5825
5898
|
{
|
|
5826
5899
|
provide: PROMISE_SERVICE,
|
|
@@ -5830,6 +5903,10 @@ class NgxUtilsModule {
|
|
|
5830
5903
|
provide: CONFIG_SERVICE,
|
|
5831
5904
|
useExisting: (!config ? null : config.configService) || ConfigService
|
|
5832
5905
|
},
|
|
5906
|
+
{
|
|
5907
|
+
provide: DIALOG_SERVICE,
|
|
5908
|
+
useExisting: (!config ? null : config.dialogService) || DialogService
|
|
5909
|
+
},
|
|
5833
5910
|
{
|
|
5834
5911
|
provide: WASI_IMPLEMENTATION,
|
|
5835
5912
|
useExisting: (!config ? null : config.wasiImplementation) || Wasi
|
|
@@ -5907,5 +5984,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
5907
5984
|
* Generated bundle index. Do not edit.
|
|
5908
5985
|
*/
|
|
5909
5986
|
|
|
5910
|
-
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,
|
|
5987
|
+
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 };
|
|
5911
5988
|
//# sourceMappingURL=stemy-ngx-utils.mjs.map
|