angular-matecu 4.0.0 → 4.0.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 +73 -26
- package/karma.conf.js +44 -0
- package/ng-package.json +13 -0
- package/package.json +6 -21
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.html +11 -0
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.scss +39 -0
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.spec.ts +25 -0
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.ts +60 -0
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.html +14 -0
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.scss +5 -0
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.spec.ts +25 -0
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.ts +53 -0
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.html +8 -0
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.scss +34 -0
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.spec.ts +25 -0
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.ts +45 -0
- package/src/lib/components/matecu-spinner/matecu-spinner.component.css +15 -0
- package/src/lib/components/matecu-spinner/matecu-spinner.component.html +35 -0
- package/src/lib/components/matecu-spinner/matecu-spinner.component.spec.ts +25 -0
- package/src/lib/components/matecu-spinner/matecu-spinner.component.ts +50 -0
- package/src/lib/components/matecu-spinner/spinner-loader.component.scss +13 -0
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.html +1 -0
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.scss +19 -0
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.spec.ts +25 -0
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.ts +14 -0
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.html +1 -0
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.scss +14 -0
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.spec.ts +25 -0
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.ts +11 -0
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.html +3 -0
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.scss +19 -0
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.spec.ts +25 -0
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.ts +31 -0
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.html +1 -0
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.scss +8 -0
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.spec.ts +23 -0
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.ts +11 -0
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.html +13 -0
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.scss +34 -0
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.spec.ts +23 -0
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.ts +18 -0
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.html +7 -0
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.scss +49 -0
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.spec.ts +25 -0
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.ts +112 -0
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.html +29 -0
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.scss +90 -0
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.spec.ts +25 -0
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.ts +92 -0
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.html +1 -0
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.scss +91 -0
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.spec.ts +25 -0
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.ts +14 -0
- package/src/lib/modules/matecu-alert-box/matecu-alert-box.module.ts +16 -0
- package/src/lib/modules/matecu-spinner/matecu-spinner.module.ts +14 -0
- package/src/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.ts +45 -0
- package/src/lib/services/matecu-snack-bar.service.spec.ts +16 -0
- package/src/lib/services/matecu-snack-bar.service.ts +66 -0
- package/src/lib/services/matecu-spinner.service.spec.ts +16 -0
- package/src/lib/services/matecu-spinner.service.ts +40 -0
- package/src/lib/types/matecu-alert-dialog.ts +10 -0
- package/{lib/types/matecu-alert-snackbar.d.ts → src/lib/types/matecu-alert-snackbar.ts} +5 -4
- package/src/lib/types/matecu-altert-box-type.ts +6 -0
- package/{public-api.d.ts → src/public-api.ts} +7 -0
- package/src/test.ts +17 -0
- package/tsconfig.lib.json +24 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/tslint.json +17 -0
- package/angular-matecu-4.0.0.tgz +0 -0
- package/esm2022/angular-matecu.mjs +0 -5
- package/esm2022/lib/components/matecu-alert-box/matecu-alert-box.component.mjs +0 -67
- package/esm2022/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.mjs +0 -54
- package/esm2022/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.mjs +0 -43
- package/esm2022/lib/components/matecu-spinner/matecu-spinner.component.mjs +0 -58
- package/esm2022/lib/components/matecu-topbar-action/matecu-topbar-action.component.mjs +0 -18
- package/esm2022/lib/components/matecu-topbar-body/matecu-topbar-body.component.mjs +0 -17
- package/esm2022/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.mjs +0 -43
- package/esm2022/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.mjs +0 -12
- package/esm2022/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.mjs +0 -29
- package/esm2022/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.mjs +0 -112
- package/esm2022/lib/components/matecu-topbar-search/matecu-topbar-search.component.mjs +0 -93
- package/esm2022/lib/components/matecu-topbar-title/matecu-topbar-title.component.mjs +0 -18
- package/esm2022/lib/modules/matecu-alert-box/matecu-alert-box.module.mjs +0 -24
- package/esm2022/lib/modules/matecu-spinner/matecu-spinner.module.mjs +0 -22
- package/esm2022/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.mjs +0 -83
- package/esm2022/lib/services/matecu-snack-bar.service.mjs +0 -66
- package/esm2022/lib/services/matecu-spinner.service.mjs +0 -44
- package/esm2022/lib/types/matecu-alert-dialog.mjs +0 -2
- package/esm2022/lib/types/matecu-alert-snackbar.mjs +0 -2
- package/esm2022/lib/types/matecu-altert-box-type.mjs +0 -8
- package/esm2022/public-api.mjs +0 -32
- package/fesm2022/angular-matecu.mjs +0 -735
- package/fesm2022/angular-matecu.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/components/matecu-alert-box/matecu-alert-box.component.d.ts +0 -19
- package/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.d.ts +0 -22
- package/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.d.ts +0 -20
- package/lib/components/matecu-spinner/matecu-spinner.component.d.ts +0 -20
- package/lib/components/matecu-topbar-action/matecu-topbar-action.component.d.ts +0 -9
- package/lib/components/matecu-topbar-body/matecu-topbar-body.component.d.ts +0 -6
- package/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.d.ts +0 -12
- package/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.d.ts +0 -5
- package/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.d.ts +0 -8
- package/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.d.ts +0 -27
- package/lib/components/matecu-topbar-search/matecu-topbar-search.component.d.ts +0 -27
- package/lib/components/matecu-topbar-title/matecu-topbar-title.component.d.ts +0 -9
- package/lib/modules/matecu-alert-box/matecu-alert-box.module.d.ts +0 -14
- package/lib/modules/matecu-spinner/matecu-spinner.module.d.ts +0 -8
- package/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.d.ts +0 -19
- package/lib/services/matecu-snack-bar.service.d.ts +0 -17
- package/lib/services/matecu-spinner.service.d.ts +0 -15
- package/lib/types/matecu-alert-dialog.d.ts +0 -9
- package/lib/types/matecu-altert-box-type.d.ts +0 -6
package/README.md
CHANGED
|
@@ -159,50 +159,96 @@ El contenido de la página tiene una función que se puede llamar para realizar
|
|
|
159
159
|
|
|
160
160
|
Importar módulo o componentes
|
|
161
161
|
|
|
162
|
+
```
|
|
163
|
+
// ...
|
|
162
164
|
import { MatecuTopbarLayoutModule } from 'angular-matecu';
|
|
163
|
-
|
|
164
|
-
import {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
165
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
166
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
167
|
+
// Se pueden importar los componentes de forma individual
|
|
168
|
+
// ...
|
|
169
|
+
@NgModule({
|
|
170
|
+
|
|
171
|
+
declarations: [AppComponent],
|
|
172
|
+
imports: [
|
|
173
|
+
// ...
|
|
174
|
+
MatecuTopbarLayoutModule,
|
|
175
|
+
MatIconModule,
|
|
176
|
+
MatButtonModule
|
|
177
|
+
// ...
|
|
178
|
+
],
|
|
179
|
+
providers: [],
|
|
180
|
+
bootstrap: [AppComponent],
|
|
181
|
+
})
|
|
182
|
+
export class AppModule {}
|
|
183
|
+
```
|
|
172
184
|
|
|
173
185
|
Agregar a la plantilla de algún componente:
|
|
174
186
|
|
|
175
187
|
```
|
|
176
188
|
<matecu-topbar-layout #topbar>
|
|
177
189
|
<matecu-topbar-header-row first-row>
|
|
178
|
-
|
|
190
|
+
<matecu-topbar-header-column left-column>
|
|
179
191
|
<matecu-topbar-action>
|
|
180
|
-
|
|
192
|
+
<button mat-icon-button><mat-icon>menu</mat-icon></button>
|
|
181
193
|
</matecu-topbar-action>
|
|
182
194
|
<matecu-topbar-fab>
|
|
183
|
-
|
|
195
|
+
<button mat-fab><mat-icon>add</mat-icon></button>
|
|
184
196
|
</matecu-topbar-fab>
|
|
185
197
|
<matecu-topbar-title>Topbar Layout</matecu-topbar-title>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
198
|
+
</matecu-topbar-header-column>
|
|
199
|
+
<matecu-topbar-header-column right-column>
|
|
200
|
+
<matecu-topbar-search
|
|
201
|
+
placeholder="Buscar..."
|
|
202
|
+
(valueChange)="searchFunction($event)"
|
|
203
|
+
></matecu-topbar-search>
|
|
190
204
|
<matecu-topbar-action>
|
|
191
|
-
|
|
205
|
+
<button mat-icon-button><mat-icon>more_vert</mat-icon></button>
|
|
192
206
|
</matecu-topbar-action>
|
|
193
|
-
|
|
207
|
+
</matecu-topbar-header-column>
|
|
194
208
|
</matecu-topbar-header-row>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
Regresar al inicio
|
|
200
|
-
</button>
|
|
201
|
-
</matecu-topbar-body>
|
|
202
|
-
|
|
209
|
+
<matecu-topbar-body>
|
|
210
|
+
Contenido de la página .....
|
|
211
|
+
<button (click)="topbar.scrollTop()">Regresar al inicio</button>
|
|
212
|
+
</matecu-topbar-body>
|
|
203
213
|
</matecu-topbar-layout>
|
|
214
|
+
|
|
204
215
|
```
|
|
205
216
|
|
|
217
|
+
Agregar al componente el método para capturar el texto de búsqueda
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
import { Component } from '@angular/core';
|
|
221
|
+
|
|
222
|
+
@Component({
|
|
223
|
+
selector: 'app-root',
|
|
224
|
+
templateUrl: './app.component.html',
|
|
225
|
+
styleUrls: ['./app.component.scss'],
|
|
226
|
+
})
|
|
227
|
+
export class AppComponent {
|
|
228
|
+
searchFunction(searchText: string) {
|
|
229
|
+
console.log(searchText);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Ajustar los colores y los estilos en el archivo de css del componente o el archivo de css global
|
|
237
|
+
|
|
238
|
+
````
|
|
239
|
+
// global
|
|
240
|
+
:root {
|
|
241
|
+
// ...
|
|
242
|
+
--mtb-primary-color: red;
|
|
243
|
+
// ...
|
|
244
|
+
}
|
|
245
|
+
// en el componente
|
|
246
|
+
:host {
|
|
247
|
+
// ...
|
|
248
|
+
--mtb-primary-color: red;
|
|
249
|
+
// ...
|
|
250
|
+
}
|
|
251
|
+
```
|
|
206
252
|
## Componentes
|
|
207
253
|
|
|
208
254
|
### MatecuTopbarLayout:
|
|
@@ -305,3 +351,4 @@ Crea un contenedor para agregar el contenido de la página
|
|
|
305
351
|
--mtb-body-padding: Padding para el contenido
|
|
306
352
|
--mtb-body-background: Fondo del contenido;
|
|
307
353
|
--mtb-body-padding-button: Padding inferior (Es utilizado para asignar un espacio al Botón principal (FAB) cuando tiene asignados los estilos para dispositivos móviles)
|
|
354
|
+
````
|
package/karma.conf.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Karma configuration file, see link for more information
|
|
2
|
+
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
+
|
|
4
|
+
module.exports = function (config) {
|
|
5
|
+
config.set({
|
|
6
|
+
basePath: '',
|
|
7
|
+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
+
plugins: [
|
|
9
|
+
require('karma-jasmine'),
|
|
10
|
+
require('karma-chrome-launcher'),
|
|
11
|
+
require('karma-jasmine-html-reporter'),
|
|
12
|
+
require('karma-coverage'),
|
|
13
|
+
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
+
],
|
|
15
|
+
client: {
|
|
16
|
+
jasmine: {
|
|
17
|
+
// you can add configuration options for Jasmine here
|
|
18
|
+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
19
|
+
// for example, you can disable the random execution with `random: false`
|
|
20
|
+
// or set a specific seed with `seed: 4321`
|
|
21
|
+
},
|
|
22
|
+
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
23
|
+
},
|
|
24
|
+
jasmineHtmlReporter: {
|
|
25
|
+
suppressAll: true // removes the duplicated traces
|
|
26
|
+
},
|
|
27
|
+
coverageReporter: {
|
|
28
|
+
dir: require('path').join(__dirname, '../../coverage/angular-matecu'),
|
|
29
|
+
subdir: '.',
|
|
30
|
+
reporters: [
|
|
31
|
+
{ type: 'html' },
|
|
32
|
+
{ type: 'text-summary' }
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
reporters: ['progress', 'kjhtml'],
|
|
36
|
+
port: 9876,
|
|
37
|
+
colors: true,
|
|
38
|
+
logLevel: config.LOG_INFO,
|
|
39
|
+
autoWatch: true,
|
|
40
|
+
browsers: ['Chrome'],
|
|
41
|
+
singleRun: false,
|
|
42
|
+
restartOnFileChange: true
|
|
43
|
+
});
|
|
44
|
+
};
|
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "angular-matecu",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^15.x || ^16.x",
|
|
6
|
-
"@angular/core": "^15.x || ^16.x",
|
|
7
|
-
"@angular/material": "^15.x || ^16.x"
|
|
5
|
+
"@angular/common": "^15.x || ^16.x || ^17.x" ,
|
|
6
|
+
"@angular/core": "^15.x || ^16.x || ^17.x",
|
|
7
|
+
"@angular/material": "^15.x || ^16.x || ^17.x"
|
|
8
8
|
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
"module": "fesm2022/angular-matecu.mjs",
|
|
13
|
-
"typings": "index.d.ts",
|
|
14
|
-
"exports": {
|
|
15
|
-
"./package.json": {
|
|
16
|
-
"default": "./package.json"
|
|
17
|
-
},
|
|
18
|
-
".": {
|
|
19
|
-
"types": "./index.d.ts",
|
|
20
|
-
"esm2022": "./esm2022/angular-matecu.mjs",
|
|
21
|
-
"esm": "./esm2022/angular-matecu.mjs",
|
|
22
|
-
"default": "./fesm2022/angular-matecu.mjs"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"sideEffects": false
|
|
9
|
+
"dependencies": {},
|
|
10
|
+
"devDependencies": {}
|
|
26
11
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
:host.matecu-alert-box {
|
|
2
|
+
display: flex;
|
|
3
|
+
padding: 1rem;
|
|
4
|
+
border-radius: 0.25rem;
|
|
5
|
+
position: relative;
|
|
6
|
+
border: 1px solid rgb(224, 224, 224);
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
margin: 1rem 0;
|
|
9
|
+
|
|
10
|
+
&--success {
|
|
11
|
+
color: rgb(15, 80, 50);
|
|
12
|
+
background-color: rgb(210, 230, 220);
|
|
13
|
+
border-color: rgb(186, 220, 205);
|
|
14
|
+
}
|
|
15
|
+
&--danger {
|
|
16
|
+
color: rgb(130, 30, 40);
|
|
17
|
+
background-color: rgb(248, 215, 218);
|
|
18
|
+
border-color: rgb(245, 194, 199);
|
|
19
|
+
}
|
|
20
|
+
&--warning {
|
|
21
|
+
color: rgb(100, 77, 3);
|
|
22
|
+
background-color: rgb(255, 243, 205);
|
|
23
|
+
border-color: rgb(255, 236, 180);
|
|
24
|
+
}
|
|
25
|
+
&--info {
|
|
26
|
+
color: rgb(5, 81, 96);
|
|
27
|
+
background-color: rgb(207, 244, 252);
|
|
28
|
+
border-color: rgb(182, 239, 251);
|
|
29
|
+
}
|
|
30
|
+
.matecu-alert-box {
|
|
31
|
+
&__icon {
|
|
32
|
+
display: flex;
|
|
33
|
+
margin-right: 1rem;
|
|
34
|
+
}
|
|
35
|
+
&__content {
|
|
36
|
+
align-self: center;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { MatecuAlertBoxComponent } from './matecu-alert-box.component';
|
|
4
|
+
|
|
5
|
+
describe('MatecuAlertBoxComponent', () => {
|
|
6
|
+
let component: MatecuAlertBoxComponent;
|
|
7
|
+
let fixture: ComponentFixture<MatecuAlertBoxComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ MatecuAlertBoxComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(MatecuAlertBoxComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, HostBinding, Input, OnInit } from '@angular/core';
|
|
3
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
4
|
+
import { MatecuAlertBoxType } from '../../types/matecu-altert-box-type';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'matecu-alert-box',
|
|
8
|
+
templateUrl: './matecu-alert-box.component.html',
|
|
9
|
+
styleUrls: ['./matecu-alert-box.component.scss'],
|
|
10
|
+
standalone: true,
|
|
11
|
+
imports: [CommonModule, MatIconModule]
|
|
12
|
+
})
|
|
13
|
+
export class MatecuAlertBoxComponent implements OnInit {
|
|
14
|
+
classNameBase = 'matecu-alert-box';
|
|
15
|
+
alertColor?: MatecuAlertBoxType | undefined | string | null;
|
|
16
|
+
iconValue?: string | null | undefined;
|
|
17
|
+
private alertIcon = false;
|
|
18
|
+
get color(): MatecuAlertBoxType | undefined | string | null {
|
|
19
|
+
return this.alertColor;
|
|
20
|
+
}
|
|
21
|
+
@Input() set color(value: MatecuAlertBoxType | undefined | string | null) {
|
|
22
|
+
this.alertColor = value;
|
|
23
|
+
if (!!value) {
|
|
24
|
+
this.className = `${this.classNameBase} ${this.classNameBase}--${value}`;
|
|
25
|
+
} else {
|
|
26
|
+
this.className = this.classNameBase;
|
|
27
|
+
}
|
|
28
|
+
this.updateIcon();
|
|
29
|
+
}
|
|
30
|
+
get icon(): boolean {
|
|
31
|
+
return this.alertIcon;
|
|
32
|
+
}
|
|
33
|
+
@Input() set icon(value: boolean) {
|
|
34
|
+
this.alertIcon = value;
|
|
35
|
+
}
|
|
36
|
+
@HostBinding('class') className = this.classNameBase;
|
|
37
|
+
constructor() { }
|
|
38
|
+
|
|
39
|
+
ngOnInit(): void { }
|
|
40
|
+
|
|
41
|
+
private updateIcon(): void {
|
|
42
|
+
switch (this.color) {
|
|
43
|
+
case MatecuAlertBoxType.danger:
|
|
44
|
+
this.iconValue = 'dangerous';
|
|
45
|
+
break;
|
|
46
|
+
case MatecuAlertBoxType.warning:
|
|
47
|
+
this.iconValue = 'warning';
|
|
48
|
+
break;
|
|
49
|
+
case MatecuAlertBoxType.success:
|
|
50
|
+
this.iconValue = 'check_circle';
|
|
51
|
+
break;
|
|
52
|
+
case MatecuAlertBoxType.info:
|
|
53
|
+
this.iconValue = 'info';
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
this.iconValue = null;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<h2 mat-dialog-title *ngIf="hasTitle">{{dialogData.title}}</h2>
|
|
2
|
+
<mat-dialog-content>
|
|
3
|
+
|
|
4
|
+
<matecu-alert-box [color]="dialogData.type" [icon]="!!dialogData.icon">
|
|
5
|
+
{{dialogData.message}}
|
|
6
|
+
</matecu-alert-box>
|
|
7
|
+
|
|
8
|
+
</mat-dialog-content>
|
|
9
|
+
<mat-dialog-actions *ngIf="showActions" align="end">
|
|
10
|
+
<button mat-button color="primary" tabindex="-1" mat-dialog-close
|
|
11
|
+
*ngIf="hasDismissBtn">{{dialogData.dismissText}}</button>
|
|
12
|
+
<button mat-button color="primary" tabindex="-2" (click)="activateAction()"
|
|
13
|
+
*ngIf="hasActionBtn">{{dialogData.action}}</button>
|
|
14
|
+
</mat-dialog-actions>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { MatecuAlertDialogComponent } from './matecu-alert-dialog.component';
|
|
4
|
+
|
|
5
|
+
describe('MatecuAlertDialogComponent', () => {
|
|
6
|
+
let component: MatecuAlertDialogComponent;
|
|
7
|
+
let fixture: ComponentFixture<MatecuAlertDialogComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ MatecuAlertDialogComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(MatecuAlertDialogComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, Inject, OnInit } from '@angular/core';
|
|
3
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
4
|
+
import { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule } from '@angular/material/dialog';
|
|
5
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
6
|
+
import { MatecuAlertDialogData } from '../../types/matecu-alert-dialog';
|
|
7
|
+
import { MatecuAlertBoxComponent } from '../matecu-alert-box/matecu-alert-box.component';
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'matecu-alert-dialog',
|
|
10
|
+
templateUrl: './matecu-alert-dialog.component.html',
|
|
11
|
+
styleUrls: ['./matecu-alert-dialog.component.scss'],
|
|
12
|
+
standalone: true,
|
|
13
|
+
imports: [CommonModule, MatDialogModule, MatIconModule, MatecuAlertBoxComponent, MatButtonModule]
|
|
14
|
+
})
|
|
15
|
+
export class MatecuAlertDialogComponent implements OnInit {
|
|
16
|
+
hasTitle = false;
|
|
17
|
+
hasDismissBtn = false;
|
|
18
|
+
hasActionBtn = false;
|
|
19
|
+
showActions = false;
|
|
20
|
+
constructor(
|
|
21
|
+
@Inject(MAT_DIALOG_DATA) public dialogData: MatecuAlertDialogData,
|
|
22
|
+
public dialogRef: MatDialogRef<MatecuAlertDialogComponent>
|
|
23
|
+
) {
|
|
24
|
+
this.setHasTitle();
|
|
25
|
+
this.setHasDismissBtn();
|
|
26
|
+
this.setHasActionBtn();
|
|
27
|
+
this.setShowActions();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ngOnInit(): void { }
|
|
31
|
+
|
|
32
|
+
activateAction(): void {
|
|
33
|
+
this.dialogRef.close(true);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private setHasTitle(): void {
|
|
37
|
+
this.hasTitle = this.isValidString(this.dialogData.title);
|
|
38
|
+
}
|
|
39
|
+
private setHasDismissBtn(): void {
|
|
40
|
+
this.hasDismissBtn = this.isValidString(this.dialogData.dismissText);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private setHasActionBtn(): void {
|
|
44
|
+
this.hasActionBtn = this.isValidString(this.dialogData.action);
|
|
45
|
+
}
|
|
46
|
+
private setShowActions(): void {
|
|
47
|
+
this.showActions = this.hasActionBtn || this.hasDismissBtn;
|
|
48
|
+
}
|
|
49
|
+
private isValidString(str: string | null | undefined): boolean {
|
|
50
|
+
const isValid = typeof str === 'string' && str.trim().length > 0;
|
|
51
|
+
return isValid;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
:host.matecu-alert-snackbar {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
> * {
|
|
5
|
+
&:not(:first-child) {
|
|
6
|
+
margin-left: 10px;
|
|
7
|
+
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
&--success {
|
|
12
|
+
strong {
|
|
13
|
+
|
|
14
|
+
color: rgb(32, 219, 32);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
&--danger {
|
|
18
|
+
strong {
|
|
19
|
+
color: red;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
&--warning {
|
|
23
|
+
strong {
|
|
24
|
+
color: orange;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
&--info {
|
|
28
|
+
strong {
|
|
29
|
+
color: rgb(7, 160, 237)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { MatecuAlertSnackBarComponent } from './matecu-alert-snack-bar.component';
|
|
4
|
+
|
|
5
|
+
describe('MatecuAlertSnackBarComponent', () => {
|
|
6
|
+
let component: MatecuAlertSnackBarComponent;
|
|
7
|
+
let fixture: ComponentFixture<MatecuAlertSnackBarComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ MatecuAlertSnackBarComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(MatecuAlertSnackBarComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, HostBinding, Inject, OnInit } from '@angular/core';
|
|
3
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
4
|
+
import { MatSnackBarModule, MatSnackBarRef, MAT_SNACK_BAR_DATA } from '@angular/material/snack-bar';
|
|
5
|
+
import { MatecuAlertSnackBarData } from '../../types/matecu-alert-snackbar';
|
|
6
|
+
import { MatecuAlertBoxType } from '../../types/matecu-altert-box-type';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'matecu-alert-snack-bar',
|
|
10
|
+
templateUrl: './matecu-alert-snack-bar.component.html',
|
|
11
|
+
styleUrls: ['./matecu-alert-snack-bar.component.scss'],
|
|
12
|
+
standalone: true,
|
|
13
|
+
imports: [CommonModule, MatButtonModule, MatSnackBarModule]
|
|
14
|
+
})
|
|
15
|
+
export class MatecuAlertSnackBarComponent {
|
|
16
|
+
|
|
17
|
+
title: string;
|
|
18
|
+
message: string;
|
|
19
|
+
action?: string;
|
|
20
|
+
classNameBase = 'matecu-alert-snackbar';
|
|
21
|
+
alertColor!: MatecuAlertBoxType;
|
|
22
|
+
get color(): MatecuAlertBoxType {
|
|
23
|
+
return this.alertColor;
|
|
24
|
+
}
|
|
25
|
+
set color(value: MatecuAlertBoxType) {
|
|
26
|
+
this.alertColor = value;
|
|
27
|
+
this.className = `${this.classNameBase} ${this.classNameBase}--${value}`;
|
|
28
|
+
}
|
|
29
|
+
@HostBinding('class') className = this.classNameBase;
|
|
30
|
+
constructor(
|
|
31
|
+
@Inject(MAT_SNACK_BAR_DATA) public data: MatecuAlertSnackBarData,
|
|
32
|
+
private snackBarRef: MatSnackBarRef<MatecuAlertSnackBarComponent>) {
|
|
33
|
+
this.title = data.title;
|
|
34
|
+
this.message = data.message;
|
|
35
|
+
this.action = data.action;
|
|
36
|
+
this.color = data.type;
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
dismiss(): void {
|
|
41
|
+
this.snackBarRef.dismissWithAction();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<ng-container *ngIf="active">
|
|
2
|
+
<svg xmlns:svg="http://www.w3.org/2000/svg" [attr.width]="size" [attr.height]="size"
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" viewBox="0 0 128 128" xml:space="preserve">
|
|
4
|
+
<rect x="0" y="0" width="100%" height="100%" fill="transparent" />
|
|
5
|
+
<g>
|
|
6
|
+
<path class="matecu-spinner__100" d="M122.5 69.25H96.47a33.1 33.1 0 0 0 0-10.5h26.05a5.25 5.25 0 0 1 0 10.5z" [attr.fill]="color"
|
|
7
|
+
fill-opacity="1" />
|
|
8
|
+
<path class="matecu-spinner__30" d="M112.04 97.83L89.47 84.8a33.1 33.1 0 0 0 5.25-9.1l22.57 13.03a5.25 5.25 0 0 1-5.28 9.1z" [attr.fill]="color"
|
|
9
|
+
fill-opacity="0.3" />
|
|
10
|
+
<path class="matecu-spinner__30" d="M88.68 117.35L75.65 94.78a33.1 33.1 0 0 0 9.1-5.25l13.02 22.57a5.25 5.25 0 1 1-9.1 5.25z"
|
|
11
|
+
[attr.fill]="color" fill-opacity="0.3" />
|
|
12
|
+
<path class="matecu-spinner__30" d="M58.7 122.57V96.5a33.1 33.1 0 0 0 10.5 0v26.07a5.25 5.25 0 0 1-10.5 0z" [attr.fill]="color"
|
|
13
|
+
fill-opacity="0.3" />
|
|
14
|
+
<path class="matecu-spinner__30" d="M30.1 112.1l13.04-22.57a33.1 33.1 0 0 0 9.1 5.25L39.2 117.35a5.25 5.25 0 1 1-9.1-5.25z" [attr.fill]="color"
|
|
15
|
+
fill-opacity="0.3" />
|
|
16
|
+
<path class="matecu-spinner__30" d="M10.6 88.74L33.16 75.7a33.1 33.1 0 0 0 5.25 9.1L15.88 97.83a5.25 5.25 0 1 1-5.25-9.1z" [attr.fill]="color"
|
|
17
|
+
fill-opacity="0.3" />
|
|
18
|
+
<path class="matecu-spinner__40" d="M5.37 58.75h26.06a33.1 33.1 0 0 0 0 10.5H5.37a5.25 5.25 0 0 1 0-10.5z" [attr.fill]="color"
|
|
19
|
+
fill-opacity="0.4" />
|
|
20
|
+
<path class="matecu-spinner__50" d="M15.85 30.17L38.4 43.2a33.1 33.1 0 0 0-5.24 9.1L10.6 39.25a5.25 5.25 0 1 1 5.25-9.1z" [attr.fill]="color"
|
|
21
|
+
fill-opacity="0.5" />
|
|
22
|
+
<path class="matecu-spinner__60" d="M39.2 10.65l13.03 22.57a33.1 33.1 0 0 0-9.1 5.25l-13-22.57a5.25 5.25 0 1 1 9.1-5.25z" [attr.fill]="color"
|
|
23
|
+
fill-opacity="0.6" />
|
|
24
|
+
<path class="matecu-spinner__70" d="M69.2 5.43V31.5a33.1 33.1 0 0 0-10.5 0V5.42a5.25 5.25 0 1 1 10.5 0z" [attr.fill]="color"
|
|
25
|
+
fill-opacity="0.7" />
|
|
26
|
+
<path class="matecu-spinner__80" d="M97.77 15.9L84.75 38.47a33.1 33.1 0 0 0-9.1-5.25l13.03-22.57a5.25 5.25 0 1 1 9.1 5.25z" [attr.fill]="color"
|
|
27
|
+
fill-opacity="0.8" />
|
|
28
|
+
<path class="matecu-spinner__90" d="M117.3 39.26L94.7 52.3a33.1 33.1 0 0 0-5.25-9.1l22.57-13.03a5.25 5.25 0 0 1 5.25 9.1z" [attr.fill]="color"
|
|
29
|
+
fill-opacity="0.9" />
|
|
30
|
+
<animateTransform attributeName="transform" type="rotate"
|
|
31
|
+
values="0 64 64;30 64 64;60 64 64;90 64 64;120 64 64;150 64 64;180 64 64;210 64 64;240 64 64;270 64 64;300 64 64;330 64 64"
|
|
32
|
+
calcMode="discrete" dur="600ms" repeatCount="indefinite"></animateTransform>
|
|
33
|
+
</g>
|
|
34
|
+
</svg>
|
|
35
|
+
</ng-container>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { MatecuSpinnerComponent } from './matecu-spinner.component';
|
|
4
|
+
|
|
5
|
+
describe('MatecuSpinnerComponent', () => {
|
|
6
|
+
let component: MatecuSpinnerComponent;
|
|
7
|
+
let fixture: ComponentFixture<MatecuSpinnerComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ MatecuSpinnerComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(MatecuSpinnerComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|