@craftsjs/alert 3.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.
Files changed (51) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +145 -143
  3. package/_craftsjs-alert.theme.scss +296 -296
  4. package/{esm2015/craftsjs-alert.js → esm2020/craftsjs-alert.mjs} +4 -4
  5. package/esm2020/lib/alert.module.mjs +67 -0
  6. package/esm2020/lib/components/dialog-alert/components/alert-info/alert-info.component.mjs +13 -0
  7. package/esm2020/lib/components/dialog-alert/components/alert-success/alert-success.component.mjs +13 -0
  8. package/esm2020/lib/components/dialog-alert/components/buttons/alert-cancel-button/alert-cancel-button.component.mjs +18 -0
  9. package/esm2020/lib/components/dialog-alert/components/buttons/alert-ok-button/alert-ok-button.component.mjs +18 -0
  10. package/{esm2015/lib/components/dialog-alert/components/components.js → esm2020/lib/components/dialog-alert/components/components.mjs} +24 -24
  11. package/esm2020/lib/components/dialog-alert/components/error/error.component.mjs +13 -0
  12. package/esm2020/lib/components/dialog-alert/components/warning/warning.component.mjs +13 -0
  13. package/esm2020/lib/components/dialog-alert/dialog-alert.component.mjs +74 -0
  14. package/{esm2015/lib/models/alert-enum.model.js → esm2020/lib/models/alert-enum.model.mjs} +8 -8
  15. package/esm2020/lib/models/alert.model.mjs +2 -0
  16. package/esm2020/lib/services/alert.service.mjs +64 -0
  17. package/{esm2015/public-api.js → esm2020/public-api.mjs} +16 -16
  18. package/fesm2015/craftsjs-alert.mjs +299 -0
  19. package/fesm2015/craftsjs-alert.mjs.map +1 -0
  20. package/fesm2020/craftsjs-alert.mjs +297 -0
  21. package/fesm2020/craftsjs-alert.mjs.map +1 -0
  22. package/{craftsjs-alert.d.ts → index.d.ts} +5 -4
  23. package/lib/alert.module.d.ts +20 -4
  24. package/lib/components/dialog-alert/components/alert-info/alert-info.component.d.ts +5 -2
  25. package/lib/components/dialog-alert/components/alert-success/alert-success.component.d.ts +5 -2
  26. package/lib/components/dialog-alert/components/buttons/alert-cancel-button/alert-cancel-button.component.d.ts +7 -4
  27. package/lib/components/dialog-alert/components/buttons/alert-ok-button/alert-ok-button.component.d.ts +7 -4
  28. package/lib/components/dialog-alert/components/components.d.ts +6 -6
  29. package/lib/components/dialog-alert/components/error/error.component.d.ts +5 -2
  30. package/lib/components/dialog-alert/components/warning/warning.component.d.ts +5 -2
  31. package/lib/components/dialog-alert/dialog-alert.component.d.ts +20 -18
  32. package/lib/models/alert-enum.model.d.ts +6 -6
  33. package/lib/models/alert.model.d.ts +12 -12
  34. package/lib/services/alert.service.d.ts +16 -13
  35. package/package.json +27 -15
  36. package/public-api.d.ts +12 -12
  37. package/bundles/craftsjs-alert.umd.js +0 -334
  38. package/bundles/craftsjs-alert.umd.js.map +0 -1
  39. package/craftsjs-alert.metadata.json +0 -1
  40. package/esm2015/lib/alert.module.js +0 -55
  41. package/esm2015/lib/components/dialog-alert/components/alert-info/alert-info.component.js +0 -16
  42. package/esm2015/lib/components/dialog-alert/components/alert-success/alert-success.component.js +0 -16
  43. package/esm2015/lib/components/dialog-alert/components/buttons/alert-cancel-button/alert-cancel-button.component.js +0 -18
  44. package/esm2015/lib/components/dialog-alert/components/buttons/alert-ok-button/alert-ok-button.component.js +0 -18
  45. package/esm2015/lib/components/dialog-alert/components/error/error.component.js +0 -16
  46. package/esm2015/lib/components/dialog-alert/components/warning/warning.component.js +0 -16
  47. package/esm2015/lib/components/dialog-alert/dialog-alert.component.js +0 -67
  48. package/esm2015/lib/models/alert.model.js +0 -2
  49. package/esm2015/lib/services/alert.service.js +0 -64
  50. package/fesm2015/craftsjs-alert.js +0 -302
  51. package/fesm2015/craftsjs-alert.js.map +0 -1
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 Craftsjs
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Craftsjs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,143 +1,145 @@
1
- # craftsjs alert
2
-
3
- craftsjs alert is a library for angular
4
-
5
- [See demo](http://craftsjs.com/admin/components/modals-alerts)
6
-
7
- [Example code](https://stackblitz.com/edit/angular-alert-craftsjs)
8
-
9
- ## Getting Started
10
- To get started, let's install the package through npm:
11
-
12
- Choose the version corresponding to your Angular version:
13
-
14
- | Angular | @craftsjs/alert |
15
- | ------- | --------------- |
16
- | 12 | 3.x |
17
- | 11 | 2.x |
18
- | 10 | 1.x |
19
-
20
- ```
21
- npm i @craftsjs/alert --S
22
- ```
23
-
24
- Install peer dependencies
25
-
26
- ```
27
- npm i
28
- @craftsjs/core
29
- @ngx-translate/core
30
- @angular/material
31
- @angular/cdk
32
- @angular/animations --S
33
- ```
34
-
35
- ## Configuration
36
-
37
- - First, you have to configure the library @ngx-translate/core to have the translation into the alert
38
-
39
- The library is configured as follows:
40
-
41
- ```typescript
42
- import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
43
- import { HttpClient, HttpClientModule } from '@angular/common/http';
44
- import { TranslateHttpLoader } from '@ngx-translate/http-loader';
45
- export function createTranslateLoader(http: HttpClient) {
46
- return new TranslateHttpLoader(http, './assets/i18n/', '.json');
47
- }
48
- @NgModule({
49
- imports: [
50
- HttpClientModule,
51
- TranslateModule.forRoot({
52
- loader: {
53
- provide: TranslateLoader,
54
- useFactory: (createTranslateLoader),
55
- deps: [HttpClient]
56
- }
57
- })
58
- ]
59
- })
60
- export class AppModule { }
61
- ```
62
-
63
- ## How to use
64
-
65
- - Import the module AlertModule into the AppModule
66
-
67
- ```typescript
68
- import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
69
- import { AlertModule } from '@craftsjs/alert';
70
- @NgModule({
71
- imports: [
72
- BrowserModule,
73
- BrowserAnimationsModule,
74
- AlertModule.forRoot()
75
- ]
76
- })
77
- export class AppModule { }
78
- ```
79
-
80
- ```typescript
81
- @Component()
82
- export class AlertComponent {
83
-
84
- constructor(private _alertService: AlertService) { }
85
-
86
- openDialog() {
87
- this._alertService.showSimple('Alert', 'Simple alert');
88
- // this._alertService.showSuccess('Success', 'Saved successfully');
89
- // this._alertService.showWarning('Warn', 'Warning');
90
- // this._alertService.showInfo('Info', 'Information');
91
- // this._alertService.showError('Error', 'Error');
92
- }
93
-
94
- openDialodgConfirmation(){
95
- const dialog = this._alertService.showConfirmation('Confirmation', 'Are you sure delete alert?');
96
- dialog.beforeClose().subscribe((result) => {
97
- if (!result) { return; }
98
- switch (result.result) {
99
- case 'ok':
100
- console.log('ok');
101
- break;
102
- case 'cancel':
103
- console.log('cancel');
104
- break;
105
- }
106
- });
107
- }
108
- }
109
- ```
110
-
111
- ```html
112
- <button type="button" mat-raised-button color="primary" (click)="openDialog()">Alert warning</button>
113
- ```
114
-
115
- - Finally, it is important to import the styles to the application
116
-
117
- ```scss
118
- @import '~@craftsjs/alert/craftsjs-alert.theme';
119
- @import '~@angular/material/theming';
120
-
121
- $craftsjs-app-primary: mat-palette($mat-teal, 800);
122
- $craftsjs-app-accent: mat-palette($mat-pink, 800, A100, 100);
123
- $craftsjs-app-warn: mat-palette($mat-red);
124
- $craftsjs-app-theme: mat-light-theme($craftsjs-app-primary, $craftsjs-app-accent, $craftsjs-app-warn);
125
- $craftsjs-theme-variables: (
126
- color-info: #20a9d2,
127
- color-success: #5cb85c,
128
- color-danger: #d43934,
129
- color-warning: #e09d3d
130
- );
131
-
132
- @include mat-core();
133
- body.theme-default{
134
- @include angular-material-theme($craftsjs-app-theme);
135
- @include alert($craftsjs-theme-variables);
136
- }
137
- ```
138
-
139
- - Don't forget to put the theme-default class in the html body
140
-
141
- ```html
142
- <body class="theme-default"></body>
143
- ```
1
+ # craftsjs alert
2
+
3
+ craftsjs alert is a library for angular
4
+
5
+ [See demo](http://craftsjs.com/admin/components/modals-alerts)
6
+
7
+ [Example code](https://stackblitz.com/edit/angular-alert-craftsjs)
8
+
9
+ ## Getting Started
10
+ To get started, let's install the package through npm:
11
+
12
+ Choose the version corresponding to your Angular version:
13
+
14
+ | Angular | @craftsjs/alert |
15
+ | ------- | --------------- |
16
+ | 15 | 5.x |
17
+ | 13 | 4.x |
18
+ | 12 | 3.x |
19
+ | 11 | 2.x |
20
+ | 10 | 1.x |
21
+
22
+ ```
23
+ npm i @craftsjs/alert --S
24
+ ```
25
+
26
+ Install peer dependencies
27
+
28
+ ```
29
+ npm i
30
+ @craftsjs/core
31
+ @ngx-translate/core
32
+ @angular/material
33
+ @angular/cdk
34
+ @angular/animations --S
35
+ ```
36
+
37
+ ## Configuration
38
+
39
+ - First, you have to configure the library @ngx-translate/core to have the translation into the alert
40
+
41
+ The library is configured as follows:
42
+
43
+ ```typescript
44
+ import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
45
+ import { HttpClient, HttpClientModule } from '@angular/common/http';
46
+ import { TranslateHttpLoader } from '@ngx-translate/http-loader';
47
+ export function createTranslateLoader(http: HttpClient) {
48
+ return new TranslateHttpLoader(http, './assets/i18n/', '.json');
49
+ }
50
+ @NgModule({
51
+ imports: [
52
+ HttpClientModule,
53
+ TranslateModule.forRoot({
54
+ loader: {
55
+ provide: TranslateLoader,
56
+ useFactory: (createTranslateLoader),
57
+ deps: [HttpClient]
58
+ }
59
+ })
60
+ ]
61
+ })
62
+ export class AppModule { }
63
+ ```
64
+
65
+ ## How to use
66
+
67
+ - Import the module AlertModule into the AppModule
68
+
69
+ ```typescript
70
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
71
+ import { AlertModule } from '@craftsjs/alert';
72
+ @NgModule({
73
+ imports: [
74
+ BrowserModule,
75
+ BrowserAnimationsModule,
76
+ AlertModule.forRoot()
77
+ ]
78
+ })
79
+ export class AppModule { }
80
+ ```
81
+
82
+ ```typescript
83
+ @Component()
84
+ export class AlertComponent {
85
+
86
+ constructor(private _alertService: AlertService) { }
87
+
88
+ openDialog() {
89
+ this._alertService.showSimple('Alert', 'Simple alert');
90
+ // this._alertService.showSuccess('Success', 'Saved successfully');
91
+ // this._alertService.showWarning('Warn', 'Warning');
92
+ // this._alertService.showInfo('Info', 'Information');
93
+ // this._alertService.showError('Error', 'Error');
94
+ }
95
+
96
+ openDialodgConfirmation(){
97
+ const dialog = this._alertService.showConfirmation('Confirmation', 'Are you sure delete alert?');
98
+ dialog.beforeClose().subscribe((result) => {
99
+ if (!result) { return; }
100
+ switch (result.result) {
101
+ case 'ok':
102
+ console.log('ok');
103
+ break;
104
+ case 'cancel':
105
+ console.log('cancel');
106
+ break;
107
+ }
108
+ });
109
+ }
110
+ }
111
+ ```
112
+
113
+ ```html
114
+ <button type="button" mat-raised-button color="primary" (click)="openDialog()">Alert warning</button>
115
+ ```
116
+
117
+ - Finally, it is important to import the styles to the application
118
+
119
+ ```scss
120
+ @import '~@craftsjs/alert/craftsjs-alert.theme';
121
+ @import '~@angular/material/theming';
122
+
123
+ $craftsjs-app-primary: mat-palette($mat-teal, 800);
124
+ $craftsjs-app-accent: mat-palette($mat-pink, 800, A100, 100);
125
+ $craftsjs-app-warn: mat-palette($mat-red);
126
+ $craftsjs-app-theme: mat-light-theme($craftsjs-app-primary, $craftsjs-app-accent, $craftsjs-app-warn);
127
+ $craftsjs-theme-variables: (
128
+ color-info: #20a9d2,
129
+ color-success: #5cb85c,
130
+ color-danger: #d43934,
131
+ color-warning: #e09d3d
132
+ );
133
+
134
+ @include mat-core();
135
+ body.theme-default{
136
+ @include angular-material-theme($craftsjs-app-theme);
137
+ @include alert($craftsjs-theme-variables);
138
+ }
139
+ ```
140
+
141
+ - Don't forget to put the theme-default class in the html body
142
+
143
+ ```html
144
+ <body class="theme-default"></body>
145
+ ```