@apipass/messages 0.1.6-alpha.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.
- package/README.md +33 -0
- package/apipass-messages.d.ts +5 -0
- package/assets/css/buttons.scss +112 -0
- package/assets/css/colors.scss +34 -0
- package/assets/css/fonts.scss +24 -0
- package/assets/css/inputs.scss +197 -0
- package/assets/css/pt_sans.scss +144 -0
- package/assets/css/spacing.scss +28 -0
- package/assets/css/texts.scss +18 -0
- package/bundles/apipass-messages.umd.js +273 -0
- package/bundles/apipass-messages.umd.js.map +1 -0
- package/bundles/apipass-messages.umd.min.js +2 -0
- package/bundles/apipass-messages.umd.min.js.map +1 -0
- package/esm2015/apipass-messages.js +5 -0
- package/esm2015/message-box/message-box.component.js +145 -0
- package/esm2015/messages.module.js +39 -0
- package/esm2015/messages.service.js +46 -0
- package/esm2015/public-api.js +4 -0
- package/fesm2015/apipass-messages.js +226 -0
- package/fesm2015/apipass-messages.js.map +1 -0
- package/message-box/message-box.component.d.ts +16 -0
- package/messages.module.d.ts +9 -0
- package/messages.service.d.ts +22 -0
- package/package.json +26 -0
- package/public-api.d.ts +3 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { ɵɵinject, ɵɵdefineInjectable, ɵsetClassMetadata, Injectable, ɵɵelementStart, ɵɵtext, ɵɵelementEnd, ɵɵnextContext, ɵɵadvance, ɵɵtextInterpolate, ɵɵelement, ɵɵproperty, ɵɵsanitizeHtml, ɵɵtemplate, ɵɵtextInterpolate1, ɵɵgetCurrentView, ɵɵlistener, ɵɵrestoreView, ɵɵclassMapInterpolate1, EventEmitter, ɵɵdefineComponent, Component, Input, Output, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule } from '@angular/core';
|
|
2
|
+
import { BodyOutputType, ToasterService, ToasterModule } from 'angular2-toaster';
|
|
3
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
4
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import { NgIf, NgForOf, CommonModule } from '@angular/common';
|
|
6
|
+
|
|
7
|
+
class MessagesService {
|
|
8
|
+
constructor(toasterService, translate) {
|
|
9
|
+
this.toasterService = toasterService;
|
|
10
|
+
this.translate = translate;
|
|
11
|
+
}
|
|
12
|
+
successMessage(title, body, positionClass) {
|
|
13
|
+
this.customMessage('success', title, body || '', positionClass);
|
|
14
|
+
}
|
|
15
|
+
errorMessage(body, positionClass) {
|
|
16
|
+
this.customMessage('error', this.translate.instant('MESSAGE.ERROR'), body, positionClass);
|
|
17
|
+
}
|
|
18
|
+
errorMessages(error, positionClass) {
|
|
19
|
+
var _a;
|
|
20
|
+
(_a = error === null || error === void 0 ? void 0 : error.causes) === null || _a === void 0 ? void 0 : _a.forEach(item => {
|
|
21
|
+
const errorMessage = item.code ? this.translate.instant(`EXCEPTIONS_CODE.${item.code}`) : item.message;
|
|
22
|
+
this.customMessage('error', this.translate.instant('MESSAGE.ERROR'), errorMessage, positionClass);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
warningMessage(body, positionClass) {
|
|
26
|
+
this.customMessage('error', this.translate.instant('MESSAGE.WARNING'), body, positionClass);
|
|
27
|
+
}
|
|
28
|
+
customMessage(type, title, body, positionClass) {
|
|
29
|
+
const message = {
|
|
30
|
+
type,
|
|
31
|
+
title,
|
|
32
|
+
timeout: 30000,
|
|
33
|
+
body,
|
|
34
|
+
bodyOutputType: BodyOutputType.TrustedHtml
|
|
35
|
+
};
|
|
36
|
+
const toastContainer = document.getElementById('toast-container');
|
|
37
|
+
toastContainer.className = positionClass || 'toast-top-right';
|
|
38
|
+
this.toasterService.pop(message);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
MessagesService.ɵfac = function MessagesService_Factory(t) { return new (t || MessagesService)(ɵɵinject(ToasterService), ɵɵinject(TranslateService)); };
|
|
42
|
+
MessagesService.ɵprov = ɵɵdefineInjectable({ token: MessagesService, factory: MessagesService.ɵfac });
|
|
43
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(MessagesService, [{
|
|
44
|
+
type: Injectable
|
|
45
|
+
}], function () { return [{ type: ToasterService }, { type: TranslateService }]; }, null); })();
|
|
46
|
+
|
|
47
|
+
function MessageBoxComponent_div_0_strong_3_Template(rf, ctx) { if (rf & 1) {
|
|
48
|
+
ɵɵelementStart(0, "strong", 9);
|
|
49
|
+
ɵɵtext(1);
|
|
50
|
+
ɵɵelementEnd();
|
|
51
|
+
} if (rf & 2) {
|
|
52
|
+
const ctx_r1 = ɵɵnextContext(2);
|
|
53
|
+
ɵɵadvance(1);
|
|
54
|
+
ɵɵtextInterpolate(ctx_r1.title);
|
|
55
|
+
} }
|
|
56
|
+
function MessageBoxComponent_div_0_span_4_Template(rf, ctx) { if (rf & 1) {
|
|
57
|
+
ɵɵelementStart(0, "span", 10);
|
|
58
|
+
ɵɵtext(1);
|
|
59
|
+
ɵɵelementEnd();
|
|
60
|
+
} if (rf & 2) {
|
|
61
|
+
const ctx_r2 = ɵɵnextContext(2);
|
|
62
|
+
ɵɵadvance(1);
|
|
63
|
+
ɵɵtextInterpolate(ctx_r2.message);
|
|
64
|
+
} }
|
|
65
|
+
function MessageBoxComponent_div_0_div_5_span_1_span_1_Template(rf, ctx) { if (rf & 1) {
|
|
66
|
+
ɵɵelement(0, "span", 17);
|
|
67
|
+
} if (rf & 2) {
|
|
68
|
+
const item_r9 = ctx.$implicit;
|
|
69
|
+
ɵɵproperty("innerHTML", item_r9.message, ɵɵsanitizeHtml);
|
|
70
|
+
} }
|
|
71
|
+
function MessageBoxComponent_div_0_div_5_span_1_Template(rf, ctx) { if (rf & 1) {
|
|
72
|
+
ɵɵelementStart(0, "span", 15);
|
|
73
|
+
ɵɵtemplate(1, MessageBoxComponent_div_0_div_5_span_1_span_1_Template, 1, 1, "span", 16);
|
|
74
|
+
ɵɵelementEnd();
|
|
75
|
+
} if (rf & 2) {
|
|
76
|
+
const error_r4 = ɵɵnextContext().$implicit;
|
|
77
|
+
ɵɵadvance(1);
|
|
78
|
+
ɵɵproperty("ngForOf", error_r4);
|
|
79
|
+
} }
|
|
80
|
+
function MessageBoxComponent_div_0_div_5_span_2_Template(rf, ctx) { if (rf & 1) {
|
|
81
|
+
ɵɵelement(0, "span", 17);
|
|
82
|
+
} if (rf & 2) {
|
|
83
|
+
const error_r4 = ɵɵnextContext().$implicit;
|
|
84
|
+
ɵɵproperty("innerHTML", error_r4, ɵɵsanitizeHtml);
|
|
85
|
+
} }
|
|
86
|
+
function MessageBoxComponent_div_0_div_5_pre_3_Template(rf, ctx) { if (rf & 1) {
|
|
87
|
+
ɵɵelementStart(0, "pre");
|
|
88
|
+
ɵɵtext(1);
|
|
89
|
+
ɵɵelementEnd();
|
|
90
|
+
} if (rf & 2) {
|
|
91
|
+
const error_r4 = ɵɵnextContext().$implicit;
|
|
92
|
+
const ctx_r7 = ɵɵnextContext(2);
|
|
93
|
+
ɵɵadvance(1);
|
|
94
|
+
ɵɵtextInterpolate1(" ", ctx_r7.getErrorAsString(error_r4), "\n ");
|
|
95
|
+
} }
|
|
96
|
+
function MessageBoxComponent_div_0_div_5_Template(rf, ctx) { if (rf & 1) {
|
|
97
|
+
ɵɵelementStart(0, "div", 11);
|
|
98
|
+
ɵɵtemplate(1, MessageBoxComponent_div_0_div_5_span_1_Template, 2, 1, "span", 12);
|
|
99
|
+
ɵɵtemplate(2, MessageBoxComponent_div_0_div_5_span_2_Template, 1, 1, "span", 13);
|
|
100
|
+
ɵɵtemplate(3, MessageBoxComponent_div_0_div_5_pre_3_Template, 2, 1, "pre", 14);
|
|
101
|
+
ɵɵelementEnd();
|
|
102
|
+
} if (rf & 2) {
|
|
103
|
+
const error_r4 = ctx.$implicit;
|
|
104
|
+
const ctx_r3 = ɵɵnextContext(2);
|
|
105
|
+
ɵɵadvance(1);
|
|
106
|
+
ɵɵproperty("ngIf", ctx_r3.compilerError && ctx_r3.isArray(error_r4));
|
|
107
|
+
ɵɵadvance(1);
|
|
108
|
+
ɵɵproperty("ngIf", (!ctx_r3.compilerError || ctx_r3.compilerError && !ctx_r3.isArray(error_r4)) && !ctx_r3.isErrorObject(error_r4));
|
|
109
|
+
ɵɵadvance(1);
|
|
110
|
+
ɵɵproperty("ngIf", !ctx_r3.compilerError && ctx_r3.isErrorObject(error_r4));
|
|
111
|
+
} }
|
|
112
|
+
function MessageBoxComponent_div_0_Template(rf, ctx) { if (rf & 1) {
|
|
113
|
+
const _r14 = ɵɵgetCurrentView();
|
|
114
|
+
ɵɵelementStart(0, "div", 1);
|
|
115
|
+
ɵɵelementStart(1, "div", 2);
|
|
116
|
+
ɵɵelementStart(2, "div", 3);
|
|
117
|
+
ɵɵtemplate(3, MessageBoxComponent_div_0_strong_3_Template, 2, 1, "strong", 4);
|
|
118
|
+
ɵɵtemplate(4, MessageBoxComponent_div_0_span_4_Template, 2, 1, "span", 5);
|
|
119
|
+
ɵɵtemplate(5, MessageBoxComponent_div_0_div_5_Template, 4, 3, "div", 6);
|
|
120
|
+
ɵɵelementStart(6, "button", 7);
|
|
121
|
+
ɵɵlistener("click", function MessageBoxComponent_div_0_Template_button_click_6_listener() { ɵɵrestoreView(_r14); const ctx_r13 = ɵɵnextContext(); return ctx_r13.close(); });
|
|
122
|
+
ɵɵelementStart(7, "span", 8);
|
|
123
|
+
ɵɵtext(8, "\u00D7");
|
|
124
|
+
ɵɵelementEnd();
|
|
125
|
+
ɵɵelementEnd();
|
|
126
|
+
ɵɵelementEnd();
|
|
127
|
+
ɵɵelementEnd();
|
|
128
|
+
ɵɵelementEnd();
|
|
129
|
+
} if (rf & 2) {
|
|
130
|
+
const ctx_r0 = ɵɵnextContext();
|
|
131
|
+
ɵɵadvance(2);
|
|
132
|
+
ɵɵclassMapInterpolate1("alert ", ctx_r0.type, " alert-dismissible fade show");
|
|
133
|
+
ɵɵadvance(1);
|
|
134
|
+
ɵɵproperty("ngIf", ctx_r0.title);
|
|
135
|
+
ɵɵadvance(1);
|
|
136
|
+
ɵɵproperty("ngIf", ctx_r0.message);
|
|
137
|
+
ɵɵadvance(1);
|
|
138
|
+
ɵɵproperty("ngForOf", ctx_r0.errors);
|
|
139
|
+
} }
|
|
140
|
+
class MessageBoxComponent {
|
|
141
|
+
constructor() {
|
|
142
|
+
this.type = 'alert-danger';
|
|
143
|
+
this.title = '';
|
|
144
|
+
this.message = '';
|
|
145
|
+
this.compilerError = false;
|
|
146
|
+
this.errors = [];
|
|
147
|
+
this.onClose = new EventEmitter();
|
|
148
|
+
}
|
|
149
|
+
close() {
|
|
150
|
+
this.onClose.next();
|
|
151
|
+
}
|
|
152
|
+
isArray(error) {
|
|
153
|
+
return Array.isArray(error);
|
|
154
|
+
}
|
|
155
|
+
isErrorObject(error) {
|
|
156
|
+
return error instanceof Object || this.isArray(error);
|
|
157
|
+
}
|
|
158
|
+
getErrorAsString(error) {
|
|
159
|
+
return JSON.stringify(error, undefined, 2);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
MessageBoxComponent.ɵfac = function MessageBoxComponent_Factory(t) { return new (t || MessageBoxComponent)(); };
|
|
163
|
+
MessageBoxComponent.ɵcmp = ɵɵdefineComponent({ type: MessageBoxComponent, selectors: [["message-box"]], inputs: { type: "type", title: "title", message: "message", compilerError: "compilerError", errors: "errors" }, outputs: { onClose: "onClose" }, decls: 1, vars: 1, consts: [["class", "error-box row", 4, "ngIf"], [1, "error-box", "row"], [1, "col-12"], ["role", "alert"], ["class", "title", 4, "ngIf"], ["class", "detail-message", 4, "ngIf"], ["class", "alert-text", 4, "ngFor", "ngForOf"], ["type", "button", "aria-label", "Close", 1, "close", 3, "click"], ["aria-hidden", "true"], [1, "title"], [1, "detail-message"], [1, "alert-text"], ["class", "causes", 4, "ngIf"], ["class", "error-text", 3, "innerHTML", 4, "ngIf"], [4, "ngIf"], [1, "causes"], ["class", "error-text", 3, "innerHTML", 4, "ngFor", "ngForOf"], [1, "error-text", 3, "innerHTML"]], template: function MessageBoxComponent_Template(rf, ctx) { if (rf & 1) {
|
|
164
|
+
ɵɵtemplate(0, MessageBoxComponent_div_0_Template, 9, 6, "div", 0);
|
|
165
|
+
} if (rf & 2) {
|
|
166
|
+
ɵɵproperty("ngIf", ctx.errors.length > 0);
|
|
167
|
+
} }, directives: [NgIf, NgForOf], styles: [".error-box[_ngcontent-%COMP%] .alert[_ngcontent-%COMP%]{padding:10px 15px!important;width:100%}.error-box[_ngcontent-%COMP%] .alert[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{margin-right:5px;word-break:break-word}.error-box[_ngcontent-%COMP%] .causes[_ngcontent-%COMP%]{word-break:break-word}"] });
|
|
168
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(MessageBoxComponent, [{
|
|
169
|
+
type: Component,
|
|
170
|
+
args: [{
|
|
171
|
+
selector: 'message-box',
|
|
172
|
+
templateUrl: 'message-box.component.html',
|
|
173
|
+
styleUrls: ['message-box.component.scss']
|
|
174
|
+
}]
|
|
175
|
+
}], null, { type: [{
|
|
176
|
+
type: Input
|
|
177
|
+
}], title: [{
|
|
178
|
+
type: Input
|
|
179
|
+
}], message: [{
|
|
180
|
+
type: Input
|
|
181
|
+
}], compilerError: [{
|
|
182
|
+
type: Input
|
|
183
|
+
}], errors: [{
|
|
184
|
+
type: Input
|
|
185
|
+
}], onClose: [{
|
|
186
|
+
type: Output
|
|
187
|
+
}] }); })();
|
|
188
|
+
|
|
189
|
+
class MessagesModule {
|
|
190
|
+
}
|
|
191
|
+
MessagesModule.ɵmod = ɵɵdefineNgModule({ type: MessagesModule });
|
|
192
|
+
MessagesModule.ɵinj = ɵɵdefineInjector({ factory: function MessagesModule_Factory(t) { return new (t || MessagesModule)(); }, providers: [MessagesService], imports: [[
|
|
193
|
+
CommonModule,
|
|
194
|
+
FormsModule,
|
|
195
|
+
ReactiveFormsModule,
|
|
196
|
+
ToasterModule
|
|
197
|
+
]] });
|
|
198
|
+
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(MessagesModule, { declarations: [MessageBoxComponent], imports: [CommonModule,
|
|
199
|
+
FormsModule,
|
|
200
|
+
ReactiveFormsModule,
|
|
201
|
+
ToasterModule], exports: [MessageBoxComponent] }); })();
|
|
202
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(MessagesModule, [{
|
|
203
|
+
type: NgModule,
|
|
204
|
+
args: [{
|
|
205
|
+
imports: [
|
|
206
|
+
CommonModule,
|
|
207
|
+
FormsModule,
|
|
208
|
+
ReactiveFormsModule,
|
|
209
|
+
ToasterModule
|
|
210
|
+
],
|
|
211
|
+
declarations: [
|
|
212
|
+
MessageBoxComponent
|
|
213
|
+
],
|
|
214
|
+
exports: [
|
|
215
|
+
MessageBoxComponent
|
|
216
|
+
],
|
|
217
|
+
providers: [MessagesService]
|
|
218
|
+
}]
|
|
219
|
+
}], null, null); })();
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Generated bundle index. Do not edit.
|
|
223
|
+
*/
|
|
224
|
+
|
|
225
|
+
export { MessageBoxComponent, MessagesModule, MessagesService };
|
|
226
|
+
//# sourceMappingURL=apipass-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apipass-messages.js","sources":["../../../projects/messages/src/messages.service.ts","../../../projects/messages/src/message-box/message-box.component.html","../../../projects/messages/src/message-box/message-box.component.ts","../../../projects/messages/src/messages.module.ts","../../../projects/messages/src/apipass-messages.ts"],"sourcesContent":["import {Injectable} from '@angular/core';\nimport {BodyOutputType, Toast, ToasterService} from 'angular2-toaster';\nimport {TranslateService} from '@ngx-translate/core';\n\n@Injectable()\nexport class MessagesService {\n\n private toasterService: ToasterService;\n private translate: TranslateService;\n\n constructor(toasterService: ToasterService, translate: TranslateService) {\n this.toasterService = toasterService;\n this.translate = translate;\n }\n\n public successMessage(title: string, body?: string, positionClass?: string): void {\n this.customMessage('success', title, body || '', positionClass);\n }\n\n public errorMessage(body: string, positionClass?: string): void {\n this.customMessage('error', this.translate.instant('MESSAGE.ERROR'), body, positionClass);\n }\n\n public errorMessages(error: {\n statusCode: string,\n timestamp: string,\n causes: Array<{ code: string, message: string }>\n },\n positionClass?: string): void {\n error?.causes?.forEach(item => {\n const errorMessage = item.code ? this.translate.instant(`EXCEPTIONS_CODE.${item.code}`) : item.message;\n this.customMessage('error', this.translate.instant('MESSAGE.ERROR'), errorMessage, positionClass);\n });\n }\n\n public warningMessage(body: string, positionClass?: string): void {\n this.customMessage('error', this.translate.instant('MESSAGE.WARNING'), body, positionClass);\n }\n\n public customMessage(type: string, title: string, body: string, positionClass?: any): void {\n const message: Toast = {\n type,\n title,\n timeout: 30000,\n body,\n bodyOutputType: BodyOutputType.TrustedHtml\n };\n const toastContainer: any = document.getElementById('toast-container');\n toastContainer.className = positionClass || 'toast-top-right';\n this.toasterService.pop(message);\n }\n}\n","<div class=\"error-box row\" *ngIf=\"errors.length > 0\">\n <div class=\"col-12\">\n <div class=\"alert {{type}} alert-dismissible fade show\" role=\"alert\">\n <strong class=\"title\" *ngIf=\"title\">{{title}}</strong>\n <span class=\"detail-message\" *ngIf=\"message\">{{message}}</span>\n <div class=\"alert-text\" *ngFor=\"let error of errors\">\n <span class=\"causes\" *ngIf=\"compilerError && isArray(error)\">\n <span class=\"error-text\" *ngFor=\"let item of error\" [innerHTML]=\"item.message\"></span>\n </span>\n\n <span class=\"error-text\"\n *ngIf=\"(!compilerError || (compilerError && !isArray(error))) && !isErrorObject(error)\" [innerHTML]=\"error\"></span>\n <pre *ngIf=\"!compilerError && isErrorObject(error)\">\n {{getErrorAsString(error)}}\n </pre>\n </div>\n <button type=\"button\" class=\"close\" (click)=\"close()\" aria-label=\"Close\">\n <span aria-hidden=\"true\">×</span>\n </button>\n </div>\n </div>\n</div>\n","import { Component, Input, EventEmitter, Output } from '@angular/core';\n\n@Component({\n selector: 'message-box',\n templateUrl: 'message-box.component.html',\n styleUrls: ['message-box.component.scss']\n})\nexport class MessageBoxComponent {\n\n @Input() public type = 'alert-danger';\n @Input() public title = '';\n @Input() public message = '';\n @Input() public compilerError = false;\n @Input() public errors: [] = [];\n\n @Output() public onClose = new EventEmitter<void>();\n\n public close(): void {\n this.onClose.next();\n }\n\n public isArray(error: any): boolean {\n return Array.isArray(error);\n }\n\n public isErrorObject(error: any): boolean {\n return error instanceof Object || this.isArray(error);\n }\n\n public getErrorAsString(error: any): string {\n return JSON.stringify(error, undefined, 2);\n }\n\n}\n","import {NgModule} from '@angular/core';\nimport {FormsModule, ReactiveFormsModule} from '@angular/forms';\nimport {CommonModule} from '@angular/common';\nimport {MessageBoxComponent} from './message-box/message-box.component';\nimport {MessagesService} from './messages.service';\nimport {ToasterModule} from 'angular2-toaster';\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n ToasterModule\n ],\n declarations: [\n MessageBoxComponent\n ],\n exports: [\n MessageBoxComponent\n ],\n providers: [MessagesService]\n})\nexport class MessagesModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i0.ɵɵelementStart","i0.ɵɵtext","i0.ɵɵelementEnd","i0.ɵɵadvance","i0.ɵɵtextInterpolate","i0.ɵɵelement","i0.ɵɵproperty","i0.ɵɵtemplate","i0.ɵɵtextInterpolate1","i0.ɵɵlistener","i0.ɵɵclassMapInterpolate1"],"mappings":";;;;;;MAKa,eAAe;IAK1B,YAAY,cAA8B,EAAE,SAA2B;QACrE,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;KAC5B;IAEM,cAAc,CAAC,KAAa,EAAE,IAAa,EAAE,aAAsB;QACxE,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,IAAI,EAAE,EAAE,aAAa,CAAC,CAAC;KACjE;IAEM,YAAY,CAAC,IAAY,EAAE,aAAsB;QACtD,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,eAAe,CAAC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,CAAC,KAAU;QAChC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;KAC5C;;sFAxBU,mBAAmB;qDAAnB,mBAAmB;QDPhCC,iEACE;;QADyBD,yCAAyB;;+CCOvC,mBAAmB;cAL/B,SAAS;eAAC;gBACT,QAAQ,EAAE,aAAa;gBACvB,WAAW,EAAE,4BAA4B;gBACzC,SAAS,EAAE,CAAC,4BAA4B,CAAC;aAC1C;gBAGiB,IAAI;kBAAnB,KAAK;YACU,KAAK;kBAApB,KAAK;YACU,OAAO;kBAAtB,KAAK;YACU,aAAa;kBAA5B,KAAK;YACU,MAAM;kBAArB,KAAK;YAEW,OAAO;kBAAvB,MAAM;;;MCOI,cAAc;;+CAAd,cAAc;wGAAd,cAAc,mBAFd,CAAC,eAAe,CAAC,YAZnB;YACP,YAAY;YACZ,WAAW;YACX,mBAAmB;YACnB,aAAa;SACd;qFASU,cAAc,mBAPvB,mBAAmB,aANnB,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,aAAa,aAMb,mBAAmB;+CAIV,cAAc;cAf1B,QAAQ;eAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,aAAa;iBACd;gBACD,YAAY,EAAE;oBACZ,mBAAmB;iBACpB;gBACD,OAAO,EAAE;oBACP,mBAAmB;iBACpB;gBACD,SAAS,EAAE,CAAC,eAAe,CAAC;aAC7B;;;ACrBD;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class MessageBoxComponent {
|
|
4
|
+
type: string;
|
|
5
|
+
title: string;
|
|
6
|
+
message: string;
|
|
7
|
+
compilerError: boolean;
|
|
8
|
+
errors: [];
|
|
9
|
+
onClose: EventEmitter<void>;
|
|
10
|
+
close(): void;
|
|
11
|
+
isArray(error: any): boolean;
|
|
12
|
+
isErrorObject(error: any): boolean;
|
|
13
|
+
getErrorAsString(error: any): string;
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDef<MessageBoxComponent, never>;
|
|
15
|
+
static ɵcmp: i0.ɵɵComponentDefWithMeta<MessageBoxComponent, "message-box", never, { "type": "type"; "title": "title"; "message": "message"; "compilerError": "compilerError"; "errors": "errors"; }, { "onClose": "onClose"; }, never, never>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./message-box/message-box.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "@angular/forms";
|
|
5
|
+
import * as i4 from "angular2-toaster";
|
|
6
|
+
export declare class MessagesModule {
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDefWithMeta<MessagesModule, [typeof i1.MessageBoxComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i3.ReactiveFormsModule, typeof i4.ToasterModule], [typeof i1.MessageBoxComponent]>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDef<MessagesModule>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ToasterService } from 'angular2-toaster';
|
|
2
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class MessagesService {
|
|
5
|
+
private toasterService;
|
|
6
|
+
private translate;
|
|
7
|
+
constructor(toasterService: ToasterService, translate: TranslateService);
|
|
8
|
+
successMessage(title: string, body?: string, positionClass?: string): void;
|
|
9
|
+
errorMessage(body: string, positionClass?: string): void;
|
|
10
|
+
errorMessages(error: {
|
|
11
|
+
statusCode: string;
|
|
12
|
+
timestamp: string;
|
|
13
|
+
causes: Array<{
|
|
14
|
+
code: string;
|
|
15
|
+
message: string;
|
|
16
|
+
}>;
|
|
17
|
+
}, positionClass?: string): void;
|
|
18
|
+
warningMessage(body: string, positionClass?: string): void;
|
|
19
|
+
customMessage(type: string, title: string, body: string, positionClass?: any): void;
|
|
20
|
+
static ɵfac: i0.ɵɵFactoryDef<MessagesService, never>;
|
|
21
|
+
static ɵprov: i0.ɵɵInjectableDef<MessagesService>;
|
|
22
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@apipass/messages",
|
|
3
|
+
"version": "0.1.6-alpha.2",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/animations": "^10.0.11",
|
|
6
|
+
"@angular/cdk": "^10.1.3",
|
|
7
|
+
"@angular/common": "^10.0.11",
|
|
8
|
+
"@angular/core": "^10.0.11",
|
|
9
|
+
"@angular/forms": "^10.0.11"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@ngx-translate/core": "^13.0.0",
|
|
13
|
+
"angular2-toaster": "^8.0.0",
|
|
14
|
+
"tslib": "2.0.0"
|
|
15
|
+
},
|
|
16
|
+
"main": "bundles/apipass-messages.umd.js",
|
|
17
|
+
"module": "fesm2015/apipass-messages.js",
|
|
18
|
+
"es2015": "fesm2015/apipass-messages.js",
|
|
19
|
+
"esm2015": "esm2015/apipass-messages.js",
|
|
20
|
+
"fesm2015": "fesm2015/apipass-messages.js",
|
|
21
|
+
"typings": "apipass-messages.d.ts",
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"scripts": {
|
|
24
|
+
"prepublishOnly": "node --eval \"console.error('ERROR: Trying to publish a package that has been compiled by Ivy. This is not allowed.\\nPlease delete and rebuild the package, without compiling with Ivy, before attempting to publish.\\n')\" && exit 1"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/public-api.d.ts
ADDED