@craftsjs/alert 4.0.0 → 5.0.0
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/LICENSE +21 -21
- package/README.md +145 -144
- package/_craftsjs-alert.theme.scss +296 -296
- package/esm2020/craftsjs-alert.mjs +4 -4
- package/esm2020/lib/alert.module.mjs +67 -69
- package/esm2020/lib/components/dialog-alert/components/alert-info/alert-info.component.mjs +13 -13
- package/esm2020/lib/components/dialog-alert/components/alert-success/alert-success.component.mjs +13 -13
- package/esm2020/lib/components/dialog-alert/components/buttons/alert-cancel-button/alert-cancel-button.component.mjs +18 -18
- package/esm2020/lib/components/dialog-alert/components/buttons/alert-ok-button/alert-ok-button.component.mjs +18 -18
- package/esm2020/lib/components/dialog-alert/components/components.mjs +24 -24
- package/esm2020/lib/components/dialog-alert/components/error/error.component.mjs +13 -13
- package/esm2020/lib/components/dialog-alert/components/warning/warning.component.mjs +13 -13
- package/esm2020/lib/components/dialog-alert/dialog-alert.component.mjs +74 -74
- package/esm2020/lib/models/alert-enum.model.mjs +8 -8
- package/esm2020/lib/models/alert.model.mjs +2 -2
- package/esm2020/lib/services/alert.service.mjs +64 -64
- package/esm2020/public-api.mjs +16 -16
- package/fesm2015/craftsjs-alert.mjs +260 -261
- package/fesm2015/craftsjs-alert.mjs.map +1 -1
- package/fesm2020/craftsjs-alert.mjs +258 -259
- package/fesm2020/craftsjs-alert.mjs.map +1 -1
- package/{craftsjs-alert.d.ts → index.d.ts} +5 -5
- package/lib/alert.module.d.ts +20 -20
- package/lib/components/dialog-alert/components/alert-info/alert-info.component.d.ts +5 -5
- package/lib/components/dialog-alert/components/alert-success/alert-success.component.d.ts +5 -5
- package/lib/components/dialog-alert/components/buttons/alert-cancel-button/alert-cancel-button.component.d.ts +7 -7
- package/lib/components/dialog-alert/components/buttons/alert-ok-button/alert-ok-button.component.d.ts +7 -7
- package/lib/components/dialog-alert/components/components.d.ts +6 -6
- package/lib/components/dialog-alert/components/error/error.component.d.ts +5 -5
- package/lib/components/dialog-alert/components/warning/warning.component.d.ts +5 -5
- package/lib/components/dialog-alert/dialog-alert.component.d.ts +20 -20
- package/lib/models/alert-enum.model.d.ts +6 -6
- package/lib/models/alert.model.d.ts +12 -12
- package/lib/services/alert.service.d.ts +16 -16
- package/package.json +9 -9
- package/public-api.d.ts +12 -12
|
@@ -6,295 +6,294 @@ import * as i1$1 from '@angular/material/dialog';
|
|
|
6
6
|
import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
7
7
|
import * as i2 from '@ngx-translate/core';
|
|
8
8
|
import { TranslateModule } from '@ngx-translate/core';
|
|
9
|
-
import * as
|
|
9
|
+
import * as i2$1 from '@angular/common';
|
|
10
10
|
import { CommonModule } from '@angular/common';
|
|
11
|
-
import * as
|
|
11
|
+
import * as i3 from '@craftsjs/core';
|
|
12
12
|
import { DynamicDirective, CoreModule } from '@craftsjs/core';
|
|
13
13
|
|
|
14
|
-
class AlertSuccessComponent {
|
|
15
|
-
}
|
|
16
|
-
AlertSuccessComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
17
|
-
AlertSuccessComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
18
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
19
|
-
type: Component,
|
|
20
|
-
args: [{ selector: 'alert-success', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
21
|
-
class: 'alert-icon alert-icon-success'
|
|
22
|
-
}, template: "<span class=\"alert-icon-success-line alert-icon-success-line-long\"></span>\
|
|
14
|
+
class AlertSuccessComponent {
|
|
15
|
+
}
|
|
16
|
+
AlertSuccessComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertSuccessComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
17
|
+
AlertSuccessComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AlertSuccessComponent, selector: "alert-success", host: { classAttribute: "alert-icon alert-icon-success" }, ngImport: i0, template: "<span class=\"alert-icon-success-line alert-icon-success-line-long\"></span>\n<span class=\"alert-icon-success-line alert-icon-success-line-tip\"></span>\n<div class=\"alert-icon-success-ring\"></div>\n<div class=\"alert-icon-success-hide-corners\"></div>", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
18
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertSuccessComponent, decorators: [{
|
|
19
|
+
type: Component,
|
|
20
|
+
args: [{ selector: 'alert-success', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
21
|
+
class: 'alert-icon alert-icon-success'
|
|
22
|
+
}, template: "<span class=\"alert-icon-success-line alert-icon-success-line-long\"></span>\n<span class=\"alert-icon-success-line alert-icon-success-line-tip\"></span>\n<div class=\"alert-icon-success-ring\"></div>\n<div class=\"alert-icon-success-hide-corners\"></div>" }]
|
|
23
23
|
}] });
|
|
24
24
|
|
|
25
|
-
var AlertEnum;
|
|
26
|
-
(function (AlertEnum) {
|
|
27
|
-
AlertEnum["success"] = "success";
|
|
28
|
-
AlertEnum["error"] = "error";
|
|
29
|
-
AlertEnum["info"] = "info";
|
|
30
|
-
AlertEnum["warning"] = "warning";
|
|
25
|
+
var AlertEnum;
|
|
26
|
+
(function (AlertEnum) {
|
|
27
|
+
AlertEnum["success"] = "success";
|
|
28
|
+
AlertEnum["error"] = "error";
|
|
29
|
+
AlertEnum["info"] = "info";
|
|
30
|
+
AlertEnum["warning"] = "warning";
|
|
31
31
|
})(AlertEnum || (AlertEnum = {}));
|
|
32
32
|
|
|
33
|
-
class AlertInfoComponent {
|
|
34
|
-
}
|
|
35
|
-
AlertInfoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
36
|
-
AlertInfoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
37
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
38
|
-
type: Component,
|
|
39
|
-
args: [{ selector: 'alert-info', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
40
|
-
class: 'alert-icon alert-icon-info'
|
|
41
|
-
}, template: ""
|
|
33
|
+
class AlertInfoComponent {
|
|
34
|
+
}
|
|
35
|
+
AlertInfoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertInfoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
36
|
+
AlertInfoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AlertInfoComponent, selector: "alert-info", host: { classAttribute: "alert-icon alert-icon-info" }, ngImport: i0, template: "", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
37
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertInfoComponent, decorators: [{
|
|
38
|
+
type: Component,
|
|
39
|
+
args: [{ selector: 'alert-info', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
40
|
+
class: 'alert-icon alert-icon-info'
|
|
41
|
+
}, template: "" }]
|
|
42
42
|
}] });
|
|
43
43
|
|
|
44
|
-
class WarningComponent {
|
|
45
|
-
}
|
|
46
|
-
WarningComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
47
|
-
WarningComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
48
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
49
|
-
type: Component,
|
|
50
|
-
args: [{ selector: 'alert-warning', host: {
|
|
51
|
-
class: 'alert-icon alert-icon-warning '
|
|
52
|
-
}, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<span class=\"alert-icon-warning-body\">\
|
|
44
|
+
class WarningComponent {
|
|
45
|
+
}
|
|
46
|
+
WarningComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: WarningComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
47
|
+
WarningComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: WarningComponent, selector: "alert-warning", host: { classAttribute: "alert-icon alert-icon-warning " }, ngImport: i0, template: "<span class=\"alert-icon-warning-body\">\n <span class=\"alert-icon-warning-dot\"></span>\n</span>", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: WarningComponent, decorators: [{
|
|
49
|
+
type: Component,
|
|
50
|
+
args: [{ selector: 'alert-warning', host: {
|
|
51
|
+
class: 'alert-icon alert-icon-warning '
|
|
52
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<span class=\"alert-icon-warning-body\">\n <span class=\"alert-icon-warning-dot\"></span>\n</span>" }]
|
|
53
53
|
}] });
|
|
54
54
|
|
|
55
|
-
class ErrorComponent {
|
|
56
|
-
}
|
|
57
|
-
ErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
58
|
-
ErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
59
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
60
|
-
type: Component,
|
|
61
|
-
args: [{ selector: 'alert-error', host: {
|
|
62
|
-
class: 'alert-icon alert-icon-error'
|
|
63
|
-
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"alert-icon-error-x-mark\">\
|
|
55
|
+
class ErrorComponent {
|
|
56
|
+
}
|
|
57
|
+
ErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
58
|
+
ErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: ErrorComponent, selector: "alert-error", host: { classAttribute: "alert-icon alert-icon-error" }, ngImport: i0, template: "<div class=\"alert-icon-error-x-mark\">\n <span class=\"alert-icon-error-line alert-icon-error-line-left\"></span>\n <span class=\"alert-icon-error-line alert-icon-error-line-right\"></span>\n</div>", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ErrorComponent, decorators: [{
|
|
60
|
+
type: Component,
|
|
61
|
+
args: [{ selector: 'alert-error', host: {
|
|
62
|
+
class: 'alert-icon alert-icon-error'
|
|
63
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"alert-icon-error-x-mark\">\n <span class=\"alert-icon-error-line alert-icon-error-line-left\"></span>\n <span class=\"alert-icon-error-line alert-icon-error-line-right\"></span>\n</div>" }]
|
|
64
64
|
}] });
|
|
65
65
|
|
|
66
|
-
const alertComponents = [
|
|
67
|
-
{
|
|
68
|
-
type: AlertEnum.success,
|
|
69
|
-
component: AlertSuccessComponent
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
type: AlertEnum.info,
|
|
73
|
-
component: AlertInfoComponent
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
type: AlertEnum.warning,
|
|
77
|
-
component: WarningComponent
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
type: AlertEnum.error,
|
|
81
|
-
component: ErrorComponent
|
|
82
|
-
}
|
|
66
|
+
const alertComponents = [
|
|
67
|
+
{
|
|
68
|
+
type: AlertEnum.success,
|
|
69
|
+
component: AlertSuccessComponent
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: AlertEnum.info,
|
|
73
|
+
component: AlertInfoComponent
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: AlertEnum.warning,
|
|
77
|
+
component: WarningComponent
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: AlertEnum.error,
|
|
81
|
+
component: ErrorComponent
|
|
82
|
+
}
|
|
83
83
|
];
|
|
84
84
|
|
|
85
|
-
class AlertOkButtonComponent {
|
|
86
|
-
constructor() {
|
|
87
|
-
this.click = new EventEmitter();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
AlertOkButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
91
|
-
AlertOkButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
92
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
93
|
-
type: Component,
|
|
94
|
-
args: [{ selector: 'alert-ok-button', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button mat-raised-button color=\"primary\" (click)=\"click.emit($event)\">{{'general.ok' | translate}}</button>"
|
|
95
|
-
}], propDecorators: { click: [{
|
|
96
|
-
type: Output
|
|
85
|
+
class AlertOkButtonComponent {
|
|
86
|
+
constructor() {
|
|
87
|
+
this.click = new EventEmitter();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
AlertOkButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertOkButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
91
|
+
AlertOkButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AlertOkButtonComponent, selector: "alert-ok-button", outputs: { click: "click" }, ngImport: i0, template: "<button mat-raised-button color=\"primary\" (click)=\"click.emit($event)\">{{'general.ok' | translate}}</button>", styles: [""], dependencies: [{ kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
92
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertOkButtonComponent, decorators: [{
|
|
93
|
+
type: Component,
|
|
94
|
+
args: [{ selector: 'alert-ok-button', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button mat-raised-button color=\"primary\" (click)=\"click.emit($event)\">{{'general.ok' | translate}}</button>" }]
|
|
95
|
+
}], propDecorators: { click: [{
|
|
96
|
+
type: Output
|
|
97
97
|
}] } });
|
|
98
98
|
|
|
99
|
-
class AlertCancelButtonComponent {
|
|
100
|
-
constructor() {
|
|
101
|
-
this.click = new EventEmitter();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
AlertCancelButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
105
|
-
AlertCancelButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
106
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
107
|
-
type: Component,
|
|
108
|
-
args: [{ selector: 'alert-cancel-button', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button mat-raised-button (click)=\"click.emit($event)\">{{'general.cancel' | translate}}</button>"
|
|
109
|
-
}], propDecorators: { click: [{
|
|
110
|
-
type: Output
|
|
99
|
+
class AlertCancelButtonComponent {
|
|
100
|
+
constructor() {
|
|
101
|
+
this.click = new EventEmitter();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
AlertCancelButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertCancelButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
105
|
+
AlertCancelButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AlertCancelButtonComponent, selector: "alert-cancel-button", outputs: { click: "click" }, ngImport: i0, template: "<button mat-raised-button (click)=\"click.emit($event)\">{{'general.cancel' | translate}}</button>", styles: [""], dependencies: [{ kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertCancelButtonComponent, decorators: [{
|
|
107
|
+
type: Component,
|
|
108
|
+
args: [{ selector: 'alert-cancel-button', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button mat-raised-button (click)=\"click.emit($event)\">{{'general.cancel' | translate}}</button>" }]
|
|
109
|
+
}], propDecorators: { click: [{
|
|
110
|
+
type: Output
|
|
111
111
|
}] } });
|
|
112
112
|
|
|
113
|
-
const CRAFTSJS_ALERT_DATA = new InjectionToken('CraftsjsAlertData');
|
|
114
|
-
class DialogAlertComponent {
|
|
115
|
-
constructor(dialogRef, data) {
|
|
116
|
-
this.dialogRef = dialogRef;
|
|
117
|
-
this.data = data;
|
|
118
|
-
}
|
|
119
|
-
ngOnInit() {
|
|
120
|
-
}
|
|
121
|
-
ngAfterViewInit() {
|
|
122
|
-
this.loadComponents();
|
|
123
|
-
}
|
|
124
|
-
loadComponents() {
|
|
125
|
-
const itemComponent = alertComponents.find(x => x.type === this.data.type);
|
|
126
|
-
const component = itemComponent && itemComponent.component;
|
|
127
|
-
this.resolveComponent(component, this.appDynamic.find(x => x.name === 'alert-icon').viewContainerRef);
|
|
128
|
-
this.resolveComponent(this.data.customBody, this.appDynamic.find(x => x.name === 'alert-body').viewContainerRef);
|
|
129
|
-
this.resolveComponent(this.data.customButtonComponent, this.appDynamic.find(x => x.name === 'alert-buttons').viewContainerRef);
|
|
130
|
-
}
|
|
131
|
-
resolveComponent(component, viewContainerRef) {
|
|
132
|
-
if (!component) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
viewContainerRef.clear();
|
|
136
|
-
if (component instanceof TemplateRef) {
|
|
137
|
-
viewContainerRef.createEmbeddedView(component, { $implicit: this.data, dialogRef: this.dialogRef });
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
const injector = this.createInjector(viewContainerRef.injector);
|
|
141
|
-
viewContainerRef.createComponent(component, {
|
|
142
|
-
injector
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
createInjector(injector) {
|
|
147
|
-
return Injector.create({
|
|
148
|
-
providers: [{
|
|
149
|
-
provide: CRAFTSJS_ALERT_DATA,
|
|
150
|
-
useValue: this.data
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
provide: MatDialogRef,
|
|
154
|
-
useValue: this.dialogRef
|
|
155
|
-
}],
|
|
156
|
-
parent: injector
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
buttonClick(result) {
|
|
160
|
-
this.dialogRef.close({ data: this.data, result });
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
DialogAlertComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
164
|
-
DialogAlertComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
165
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
166
|
-
type: Component,
|
|
167
|
-
args: [{ selector: 'dialog-alert', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<ng-template craftsjsDynamic name=\"alert-icon\"></ng-template>\
|
|
168
|
-
}], ctorParameters: function () {
|
|
169
|
-
return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
|
|
170
|
-
type: Inject,
|
|
171
|
-
args: [MAT_DIALOG_DATA]
|
|
172
|
-
}] }];
|
|
173
|
-
}, propDecorators: { appDynamic: [{
|
|
174
|
-
type: ViewChildren,
|
|
175
|
-
args: [DynamicDirective]
|
|
113
|
+
const CRAFTSJS_ALERT_DATA = new InjectionToken('CraftsjsAlertData');
|
|
114
|
+
class DialogAlertComponent {
|
|
115
|
+
constructor(dialogRef, data) {
|
|
116
|
+
this.dialogRef = dialogRef;
|
|
117
|
+
this.data = data;
|
|
118
|
+
}
|
|
119
|
+
ngOnInit() {
|
|
120
|
+
}
|
|
121
|
+
ngAfterViewInit() {
|
|
122
|
+
this.loadComponents();
|
|
123
|
+
}
|
|
124
|
+
loadComponents() {
|
|
125
|
+
const itemComponent = alertComponents.find(x => x.type === this.data.type);
|
|
126
|
+
const component = itemComponent && itemComponent.component;
|
|
127
|
+
this.resolveComponent(component, this.appDynamic.find(x => x.name === 'alert-icon').viewContainerRef);
|
|
128
|
+
this.resolveComponent(this.data.customBody, this.appDynamic.find(x => x.name === 'alert-body').viewContainerRef);
|
|
129
|
+
this.resolveComponent(this.data.customButtonComponent, this.appDynamic.find(x => x.name === 'alert-buttons').viewContainerRef);
|
|
130
|
+
}
|
|
131
|
+
resolveComponent(component, viewContainerRef) {
|
|
132
|
+
if (!component) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
viewContainerRef.clear();
|
|
136
|
+
if (component instanceof TemplateRef) {
|
|
137
|
+
viewContainerRef.createEmbeddedView(component, { $implicit: this.data, dialogRef: this.dialogRef });
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
const injector = this.createInjector(viewContainerRef.injector);
|
|
141
|
+
viewContainerRef.createComponent(component, {
|
|
142
|
+
injector
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
createInjector(injector) {
|
|
147
|
+
return Injector.create({
|
|
148
|
+
providers: [{
|
|
149
|
+
provide: CRAFTSJS_ALERT_DATA,
|
|
150
|
+
useValue: this.data
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
provide: MatDialogRef,
|
|
154
|
+
useValue: this.dialogRef
|
|
155
|
+
}],
|
|
156
|
+
parent: injector
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
buttonClick(result) {
|
|
160
|
+
this.dialogRef.close({ data: this.data, result });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
DialogAlertComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DialogAlertComponent, deps: [{ token: i1$1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
164
|
+
DialogAlertComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: DialogAlertComponent, selector: "dialog-alert", viewQueries: [{ propertyName: "appDynamic", predicate: DynamicDirective, descendants: true }], ngImport: i0, template: "<ng-template craftsjsDynamic name=\"alert-icon\"></ng-template>\n<div *ngIf=\"data?.title\" class=\"alert-title\">\n <span>\n {{data.title | translate}}\n </span>\n</div>\n<div *ngIf=\"data?.text\" class=\"alert-text\">\n <span>\n {{data.text | translate}}\n </span>\n</div>\n<ng-template craftsjsDynamic name=\"alert-body\"></ng-template>\n<div class=\"alert-footer\" *ngIf=\"!data?.hiddenButtons\">\n <alert-ok-button *ngIf=\"!data?.customButtonComponent\" (click)=\"buttonClick('ok')\">\n </alert-ok-button>\n <alert-cancel-button *ngIf=\"!data?.customButtonComponent && data?.showCancelButton\"\n (click)=\"buttonClick('cancel')\">\n </alert-cancel-button>\n</div>\n<ng-template craftsjsDynamic name=\"alert-buttons\"></ng-template>", styles: [".alert-icon{width:80px;height:80px;border-width:4px;border-style:solid;border-radius:50%;padding:0;position:relative;box-sizing:content-box;margin:20px auto}.alert-icon-custom{width:auto;height:auto;max-width:100%;border:none;border-radius:0}.alert-icon img{max-width:100%;max-height:100%}.alert-title{color:#000000a6;font-weight:600;text-transform:none;position:relative;display:block;font-size:27px;line-height:normal;text-align:center;margin-bottom:0}.alert-title:first-child{margin-top:26px}.alert-title:not(:first-child){padding-bottom:0}.alert-title:not(:last-child){margin-bottom:13px}.alert-text{font-size:16px;position:relative;float:none;line-height:normal;vertical-align:top;text-align:center;display:inline-block;margin:0;padding:0 10px;font-weight:400;color:#000000a3;overflow-wrap:break-word;box-sizing:border-box;width:100%}.alert-text:first-child{margin-top:45px}.alert-text:last-child{margin-bottom:45px}.alert-footer{text-align:right;margin-top:13px;padding:13px 16px;border-radius:inherit;border-top-left-radius:0;border-top-right-radius:0}.alert-footer-button-container{margin:5px;display:inline-block;position:relative}.alert-footer>*{display:inline-block;margin-right:.5em}.alert-footer>:last-child{margin-right:inherit}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.DynamicDirective, selector: "[craftsjsDynamic]", inputs: ["name"] }, { kind: "component", type: AlertOkButtonComponent, selector: "alert-ok-button", outputs: ["click"] }, { kind: "component", type: AlertCancelButtonComponent, selector: "alert-cancel-button", outputs: ["click"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
165
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DialogAlertComponent, decorators: [{
|
|
166
|
+
type: Component,
|
|
167
|
+
args: [{ selector: 'dialog-alert', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<ng-template craftsjsDynamic name=\"alert-icon\"></ng-template>\n<div *ngIf=\"data?.title\" class=\"alert-title\">\n <span>\n {{data.title | translate}}\n </span>\n</div>\n<div *ngIf=\"data?.text\" class=\"alert-text\">\n <span>\n {{data.text | translate}}\n </span>\n</div>\n<ng-template craftsjsDynamic name=\"alert-body\"></ng-template>\n<div class=\"alert-footer\" *ngIf=\"!data?.hiddenButtons\">\n <alert-ok-button *ngIf=\"!data?.customButtonComponent\" (click)=\"buttonClick('ok')\">\n </alert-ok-button>\n <alert-cancel-button *ngIf=\"!data?.customButtonComponent && data?.showCancelButton\"\n (click)=\"buttonClick('cancel')\">\n </alert-cancel-button>\n</div>\n<ng-template craftsjsDynamic name=\"alert-buttons\"></ng-template>", styles: [".alert-icon{width:80px;height:80px;border-width:4px;border-style:solid;border-radius:50%;padding:0;position:relative;box-sizing:content-box;margin:20px auto}.alert-icon-custom{width:auto;height:auto;max-width:100%;border:none;border-radius:0}.alert-icon img{max-width:100%;max-height:100%}.alert-title{color:#000000a6;font-weight:600;text-transform:none;position:relative;display:block;font-size:27px;line-height:normal;text-align:center;margin-bottom:0}.alert-title:first-child{margin-top:26px}.alert-title:not(:first-child){padding-bottom:0}.alert-title:not(:last-child){margin-bottom:13px}.alert-text{font-size:16px;position:relative;float:none;line-height:normal;vertical-align:top;text-align:center;display:inline-block;margin:0;padding:0 10px;font-weight:400;color:#000000a3;overflow-wrap:break-word;box-sizing:border-box;width:100%}.alert-text:first-child{margin-top:45px}.alert-text:last-child{margin-bottom:45px}.alert-footer{text-align:right;margin-top:13px;padding:13px 16px;border-radius:inherit;border-top-left-radius:0;border-top-right-radius:0}.alert-footer-button-container{margin:5px;display:inline-block;position:relative}.alert-footer>*{display:inline-block;margin-right:.5em}.alert-footer>:last-child{margin-right:inherit}\n"] }]
|
|
168
|
+
}], ctorParameters: function () {
|
|
169
|
+
return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
|
|
170
|
+
type: Inject,
|
|
171
|
+
args: [MAT_DIALOG_DATA]
|
|
172
|
+
}] }];
|
|
173
|
+
}, propDecorators: { appDynamic: [{
|
|
174
|
+
type: ViewChildren,
|
|
175
|
+
args: [DynamicDirective]
|
|
176
176
|
}] } });
|
|
177
177
|
|
|
178
|
-
class AlertService {
|
|
179
|
-
constructor(_dialog) {
|
|
180
|
-
this._dialog = _dialog;
|
|
181
|
-
}
|
|
182
|
-
showSimple(title, message) {
|
|
183
|
-
return this._open({
|
|
184
|
-
title,
|
|
185
|
-
text: message
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
showSuccess(title, message) {
|
|
189
|
-
return this._open({
|
|
190
|
-
title,
|
|
191
|
-
text: message,
|
|
192
|
-
type: AlertEnum.success
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
showError(title, message) {
|
|
196
|
-
return this._open({
|
|
197
|
-
title,
|
|
198
|
-
text: message,
|
|
199
|
-
type: AlertEnum.error
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
showInfo(title, message) {
|
|
203
|
-
return this._open({
|
|
204
|
-
title,
|
|
205
|
-
text: message,
|
|
206
|
-
type: AlertEnum.info
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
showWarning(title, message) {
|
|
210
|
-
return this._open({
|
|
211
|
-
title,
|
|
212
|
-
text: message,
|
|
213
|
-
type: AlertEnum.warning
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
showConfirmation(title, message) {
|
|
217
|
-
return this._open({
|
|
218
|
-
title,
|
|
219
|
-
text: message,
|
|
220
|
-
type: AlertEnum.warning,
|
|
221
|
-
showCancelButton: true
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
_open(alertModel) {
|
|
225
|
-
return this._dialog.open(DialogAlertComponent, {
|
|
226
|
-
width: '500px',
|
|
227
|
-
data: alertModel
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
AlertService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
232
|
-
AlertService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
233
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
234
|
-
type: Injectable
|
|
178
|
+
class AlertService {
|
|
179
|
+
constructor(_dialog) {
|
|
180
|
+
this._dialog = _dialog;
|
|
181
|
+
}
|
|
182
|
+
showSimple(title, message) {
|
|
183
|
+
return this._open({
|
|
184
|
+
title,
|
|
185
|
+
text: message
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
showSuccess(title, message) {
|
|
189
|
+
return this._open({
|
|
190
|
+
title,
|
|
191
|
+
text: message,
|
|
192
|
+
type: AlertEnum.success
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
showError(title, message) {
|
|
196
|
+
return this._open({
|
|
197
|
+
title,
|
|
198
|
+
text: message,
|
|
199
|
+
type: AlertEnum.error
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
showInfo(title, message) {
|
|
203
|
+
return this._open({
|
|
204
|
+
title,
|
|
205
|
+
text: message,
|
|
206
|
+
type: AlertEnum.info
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
showWarning(title, message) {
|
|
210
|
+
return this._open({
|
|
211
|
+
title,
|
|
212
|
+
text: message,
|
|
213
|
+
type: AlertEnum.warning
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
showConfirmation(title, message) {
|
|
217
|
+
return this._open({
|
|
218
|
+
title,
|
|
219
|
+
text: message,
|
|
220
|
+
type: AlertEnum.warning,
|
|
221
|
+
showCancelButton: true
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
_open(alertModel) {
|
|
225
|
+
return this._dialog.open(DialogAlertComponent, {
|
|
226
|
+
width: '500px',
|
|
227
|
+
data: alertModel
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
AlertService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertService, deps: [{ token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
232
|
+
AlertService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertService });
|
|
233
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertService, decorators: [{
|
|
234
|
+
type: Injectable
|
|
235
235
|
}], ctorParameters: function () { return [{ type: i1$1.MatDialog }]; } });
|
|
236
236
|
|
|
237
|
-
class AlertModule {
|
|
238
|
-
static forRoot() {
|
|
239
|
-
return {
|
|
240
|
-
ngModule: AlertModule,
|
|
241
|
-
providers: [
|
|
242
|
-
AlertService
|
|
243
|
-
]
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
AlertModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
248
|
-
AlertModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
249
|
-
AlertSuccessComponent,
|
|
250
|
-
AlertInfoComponent,
|
|
251
|
-
WarningComponent,
|
|
252
|
-
ErrorComponent,
|
|
253
|
-
AlertOkButtonComponent,
|
|
254
|
-
AlertCancelButtonComponent], imports: [CommonModule,
|
|
255
|
-
TranslateModule,
|
|
256
|
-
MatButtonModule,
|
|
257
|
-
CoreModule,
|
|
258
|
-
MatDialogModule], exports: [DialogAlertComponent] });
|
|
259
|
-
AlertModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
]
|
|
288
|
-
}]
|
|
237
|
+
class AlertModule {
|
|
238
|
+
static forRoot() {
|
|
239
|
+
return {
|
|
240
|
+
ngModule: AlertModule,
|
|
241
|
+
providers: [
|
|
242
|
+
AlertService
|
|
243
|
+
]
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
AlertModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
248
|
+
AlertModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: AlertModule, declarations: [DialogAlertComponent,
|
|
249
|
+
AlertSuccessComponent,
|
|
250
|
+
AlertInfoComponent,
|
|
251
|
+
WarningComponent,
|
|
252
|
+
ErrorComponent,
|
|
253
|
+
AlertOkButtonComponent,
|
|
254
|
+
AlertCancelButtonComponent], imports: [CommonModule,
|
|
255
|
+
TranslateModule,
|
|
256
|
+
MatButtonModule,
|
|
257
|
+
CoreModule,
|
|
258
|
+
MatDialogModule], exports: [DialogAlertComponent] });
|
|
259
|
+
AlertModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertModule, imports: [CommonModule,
|
|
260
|
+
TranslateModule,
|
|
261
|
+
MatButtonModule,
|
|
262
|
+
CoreModule,
|
|
263
|
+
MatDialogModule] });
|
|
264
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertModule, decorators: [{
|
|
265
|
+
type: NgModule,
|
|
266
|
+
args: [{
|
|
267
|
+
imports: [
|
|
268
|
+
CommonModule,
|
|
269
|
+
TranslateModule,
|
|
270
|
+
MatButtonModule,
|
|
271
|
+
CoreModule,
|
|
272
|
+
MatDialogModule
|
|
273
|
+
],
|
|
274
|
+
declarations: [
|
|
275
|
+
DialogAlertComponent,
|
|
276
|
+
AlertSuccessComponent,
|
|
277
|
+
AlertInfoComponent,
|
|
278
|
+
WarningComponent,
|
|
279
|
+
ErrorComponent,
|
|
280
|
+
AlertOkButtonComponent,
|
|
281
|
+
AlertCancelButtonComponent
|
|
282
|
+
],
|
|
283
|
+
exports: [
|
|
284
|
+
DialogAlertComponent
|
|
285
|
+
]
|
|
286
|
+
}]
|
|
289
287
|
}] });
|
|
290
288
|
|
|
291
|
-
/*
|
|
292
|
-
* Public API Surface of alert
|
|
289
|
+
/*
|
|
290
|
+
* Public API Surface of alert
|
|
293
291
|
*/
|
|
294
292
|
|
|
295
|
-
/**
|
|
296
|
-
* Generated bundle index. Do not edit.
|
|
293
|
+
/**
|
|
294
|
+
* Generated bundle index. Do not edit.
|
|
297
295
|
*/
|
|
298
296
|
|
|
299
297
|
export { AlertCancelButtonComponent, AlertEnum, AlertInfoComponent, AlertModule, AlertOkButtonComponent, AlertService, AlertSuccessComponent, CRAFTSJS_ALERT_DATA, DialogAlertComponent, ErrorComponent, WarningComponent, alertComponents };
|
|
300
298
|
//# sourceMappingURL=craftsjs-alert.mjs.map
|
|
299
|
+
//# sourceMappingURL=craftsjs-alert.mjs.map
|