angular-matecu 4.0.2 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/esm2022/angular-matecu.mjs +5 -0
- package/esm2022/lib/components/matecu-alert-box/matecu-alert-box.component.mjs +67 -0
- package/esm2022/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.mjs +54 -0
- package/esm2022/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.mjs +43 -0
- package/esm2022/lib/components/matecu-spinner/matecu-spinner.component.mjs +58 -0
- package/esm2022/lib/components/matecu-topbar-action/matecu-topbar-action.component.mjs +18 -0
- package/esm2022/lib/components/matecu-topbar-body/matecu-topbar-body.component.mjs +17 -0
- package/esm2022/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.mjs +43 -0
- package/esm2022/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.mjs +12 -0
- package/esm2022/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.mjs +29 -0
- package/esm2022/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.mjs +112 -0
- package/esm2022/lib/components/matecu-topbar-search/matecu-topbar-search.component.mjs +93 -0
- package/esm2022/lib/components/matecu-topbar-title/matecu-topbar-title.component.mjs +18 -0
- package/esm2022/lib/modules/matecu-alert-box/matecu-alert-box.module.mjs +24 -0
- package/esm2022/lib/modules/matecu-spinner/matecu-spinner.module.mjs +22 -0
- package/esm2022/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.mjs +83 -0
- package/esm2022/lib/services/matecu-snack-bar.service.mjs +66 -0
- package/esm2022/lib/services/matecu-spinner.service.mjs +44 -0
- package/esm2022/lib/types/matecu-alert-dialog.mjs +2 -0
- package/esm2022/lib/types/matecu-alert-snackbar.mjs +2 -0
- package/esm2022/lib/types/matecu-altert-box-type.mjs +8 -0
- package/esm2022/public-api.mjs +32 -0
- package/fesm2022/angular-matecu.mjs +735 -0
- package/fesm2022/angular-matecu.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/matecu-alert-box/matecu-alert-box.component.d.ts +19 -0
- package/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.d.ts +22 -0
- package/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.d.ts +20 -0
- package/lib/components/matecu-spinner/matecu-spinner.component.d.ts +20 -0
- package/lib/components/matecu-topbar-action/matecu-topbar-action.component.d.ts +9 -0
- package/lib/components/matecu-topbar-body/matecu-topbar-body.component.d.ts +6 -0
- package/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.d.ts +12 -0
- package/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.d.ts +5 -0
- package/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.d.ts +8 -0
- package/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.d.ts +27 -0
- package/lib/components/matecu-topbar-search/matecu-topbar-search.component.d.ts +27 -0
- package/lib/components/matecu-topbar-title/matecu-topbar-title.component.d.ts +9 -0
- package/lib/modules/matecu-alert-box/matecu-alert-box.module.d.ts +14 -0
- package/lib/modules/matecu-spinner/matecu-spinner.module.d.ts +8 -0
- package/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.d.ts +19 -0
- package/lib/services/matecu-snack-bar.service.d.ts +17 -0
- package/lib/services/matecu-spinner.service.d.ts +15 -0
- package/lib/types/matecu-alert-dialog.d.ts +9 -0
- package/{src/lib/types/matecu-alert-snackbar.ts → lib/types/matecu-alert-snackbar.d.ts} +4 -5
- package/lib/types/matecu-altert-box-type.d.ts +6 -0
- package/package.json +20 -4
- package/{src/public-api.ts → public-api.d.ts} +0 -7
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -13
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.html +0 -11
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.scss +0 -39
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.spec.ts +0 -25
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.ts +0 -60
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.html +0 -14
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.scss +0 -5
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.spec.ts +0 -25
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.ts +0 -53
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.html +0 -8
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.scss +0 -34
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.spec.ts +0 -25
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.ts +0 -45
- package/src/lib/components/matecu-spinner/matecu-spinner.component.css +0 -15
- package/src/lib/components/matecu-spinner/matecu-spinner.component.html +0 -35
- package/src/lib/components/matecu-spinner/matecu-spinner.component.spec.ts +0 -25
- package/src/lib/components/matecu-spinner/matecu-spinner.component.ts +0 -50
- package/src/lib/components/matecu-spinner/spinner-loader.component.scss +0 -13
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.html +0 -1
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.scss +0 -19
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.ts +0 -14
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.html +0 -1
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.scss +0 -14
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.ts +0 -11
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.html +0 -3
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.scss +0 -19
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.ts +0 -31
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.html +0 -1
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.scss +0 -8
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.spec.ts +0 -23
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.ts +0 -11
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.html +0 -13
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.scss +0 -34
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.spec.ts +0 -23
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.ts +0 -18
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.html +0 -7
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.scss +0 -49
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.ts +0 -112
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.html +0 -29
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.scss +0 -90
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.ts +0 -92
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.html +0 -1
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.scss +0 -91
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.ts +0 -14
- package/src/lib/modules/matecu-alert-box/matecu-alert-box.module.ts +0 -16
- package/src/lib/modules/matecu-spinner/matecu-spinner.module.ts +0 -14
- package/src/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.ts +0 -45
- package/src/lib/services/matecu-snack-bar.service.spec.ts +0 -16
- package/src/lib/services/matecu-snack-bar.service.ts +0 -66
- package/src/lib/services/matecu-spinner.service.spec.ts +0 -16
- package/src/lib/services/matecu-spinner.service.ts +0 -40
- package/src/lib/types/matecu-alert-dialog.ts +0 -10
- package/src/lib/types/matecu-altert-box-type.ts +0 -6
- package/src/test.ts +0 -17
- package/tsconfig.lib.json +0 -24
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -17
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
$search-text-color: var(--mtb-bar-color, #fff);
|
|
2
|
-
$mtb-search-margin: var(--mtb-search-margin, 10px);
|
|
3
|
-
.matecu-topbar-search-mobile-only {
|
|
4
|
-
display: none;
|
|
5
|
-
border: none;
|
|
6
|
-
background: none;
|
|
7
|
-
cursor: pointer;
|
|
8
|
-
color: var(--mtb-search-color, $search-text-color);
|
|
9
|
-
margin: $mtb-search-margin;
|
|
10
|
-
&.mobile-style {
|
|
11
|
-
display: block;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
:host,
|
|
15
|
-
.matecu-topbar-search {
|
|
16
|
-
&,
|
|
17
|
-
* {
|
|
18
|
-
box-sizing: border-box;
|
|
19
|
-
outline: none;
|
|
20
|
-
}
|
|
21
|
-
margin: $mtb-search-margin;
|
|
22
|
-
position: relative;
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
color: var(--mtb-search-color, $search-text-color);
|
|
26
|
-
max-height: var(--bar-height, 64px);
|
|
27
|
-
|
|
28
|
-
input {
|
|
29
|
-
width: var(--mtb-search-width, 200px);
|
|
30
|
-
min-width: var(--mtb-search-width, 200px);
|
|
31
|
-
height: var(--mtb-search-height, 40px);
|
|
32
|
-
padding: var(--mtb-search-pading, 3px 35px);
|
|
33
|
-
border-radius: 4px;
|
|
34
|
-
border: 1px solid;
|
|
35
|
-
border: var(--mtb-search-border, none);
|
|
36
|
-
background-color: var(--search-background-color, #ffffff4d);
|
|
37
|
-
color: currentColor;
|
|
38
|
-
transition: all 300ms ease-in-out;
|
|
39
|
-
&::placeholder {
|
|
40
|
-
color: var(--mtb-search-color, $search-text-color);
|
|
41
|
-
opacity: 1; /* Firefox */
|
|
42
|
-
}
|
|
43
|
-
&:focus {
|
|
44
|
-
min-width: var(--mtb-search-width-large, 290px);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&__icon {
|
|
49
|
-
position: absolute;
|
|
50
|
-
top: 50%;
|
|
51
|
-
transform: translateY(-50%);
|
|
52
|
-
padding: 0px;
|
|
53
|
-
&--search {
|
|
54
|
-
left: 6px;
|
|
55
|
-
}
|
|
56
|
-
&--clear {
|
|
57
|
-
border: 0px;
|
|
58
|
-
background: 0px;
|
|
59
|
-
cursor: pointer;
|
|
60
|
-
color: currentColor;
|
|
61
|
-
right: 6px;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
.mobile-style.matecu-topbar-search {
|
|
66
|
-
position: absolute;
|
|
67
|
-
top: 0px;
|
|
68
|
-
left: 0px;
|
|
69
|
-
right: 0px;
|
|
70
|
-
border-bottom: 1px solid;
|
|
71
|
-
border-bottom-color: var(--mtb-search-border-bottom-color, #ededed);
|
|
72
|
-
z-index: 3;
|
|
73
|
-
padding: 0px;
|
|
74
|
-
margin: 0px;
|
|
75
|
-
height: 64px;
|
|
76
|
-
color: var(--mtb-search-mobile-color, #000);
|
|
77
|
-
transform: translateY(-120%);
|
|
78
|
-
transition: all 300ms ease-in-out;
|
|
79
|
-
&.active-mobile {
|
|
80
|
-
transform: translateY(0);
|
|
81
|
-
}
|
|
82
|
-
input {
|
|
83
|
-
background-color: #fff;
|
|
84
|
-
height: 100%;
|
|
85
|
-
width: 100%;
|
|
86
|
-
border-radius: 0px;
|
|
87
|
-
&::placeholder {
|
|
88
|
-
color: var(--mtb-search-mobile-color, #000);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { MatecuTopbarTitleComponent } from './matecu-topbar-title.component';
|
|
4
|
-
|
|
5
|
-
describe('MatecuTopbarTitleComponent', () => {
|
|
6
|
-
let component: MatecuTopbarTitleComponent;
|
|
7
|
-
let fixture: ComponentFixture<MatecuTopbarTitleComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ MatecuTopbarTitleComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(MatecuTopbarTitleComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Component, HostBinding, OnInit } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'matecu-topbar-title',
|
|
5
|
-
templateUrl: './matecu-topbar-title.component.html',
|
|
6
|
-
styleUrls: ['./matecu-topbar-title.component.scss'],
|
|
7
|
-
standalone: true,
|
|
8
|
-
})
|
|
9
|
-
export class MatecuTopbarTitleComponent implements OnInit {
|
|
10
|
-
@HostBinding('class') className = 'matecu-topbar-title';
|
|
11
|
-
constructor() {}
|
|
12
|
-
|
|
13
|
-
ngOnInit(): void {}
|
|
14
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { MatecuAlertBoxComponent } from '../../components/matecu-alert-box/matecu-alert-box.component';
|
|
4
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
5
|
-
import { MatecuAlertDialogComponent } from '../../components/matecu-alert-dialog/matecu-alert-dialog.component';
|
|
6
|
-
import { MatDialogModule } from '@angular/material/dialog';
|
|
7
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
8
|
-
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
|
9
|
-
import { MatecuAlertSnackBarComponent } from '../../components/matecu-alert-snack-bar/matecu-alert-snack-bar.component';
|
|
10
|
-
|
|
11
|
-
@NgModule({
|
|
12
|
-
declarations: [],
|
|
13
|
-
imports: [CommonModule, MatIconModule, MatDialogModule, MatButtonModule, MatSnackBarModule, MatecuAlertBoxComponent, MatecuAlertDialogComponent, MatecuAlertSnackBarComponent],
|
|
14
|
-
exports: [MatecuAlertBoxComponent]
|
|
15
|
-
})
|
|
16
|
-
export class MatecuAlertBoxModule { }
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { MatecuSpinnerComponent } from '../../components/matecu-spinner/matecu-spinner.component';
|
|
4
|
-
|
|
5
|
-
@NgModule({
|
|
6
|
-
declarations: [],
|
|
7
|
-
imports: [
|
|
8
|
-
CommonModule, MatecuSpinnerComponent
|
|
9
|
-
],
|
|
10
|
-
exports: [
|
|
11
|
-
MatecuSpinnerComponent
|
|
12
|
-
]
|
|
13
|
-
})
|
|
14
|
-
export class MatecuSpinnerModule { }
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { MatecuTopbarLayoutComponent } from '../../components/matecu-topbar-layout/matecu-topbar-layout.component';
|
|
4
|
-
import { MatecuTopbarTitleComponent } from '../../components/matecu-topbar-title/matecu-topbar-title.component';
|
|
5
|
-
import { MatecuTopbarBodyComponent } from '../../components/matecu-topbar-body/matecu-topbar-body.component';
|
|
6
|
-
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
7
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
8
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
9
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
10
|
-
import { MatecuTopbarFabComponent } from '../../components/matecu-topbar-fab/matecu-topbar-fab.component';
|
|
11
|
-
import { MatecuTopbarSearchComponent } from '../../components/matecu-topbar-search/matecu-topbar-search.component';
|
|
12
|
-
import { MatecuTopbarActionComponent } from '../../components/matecu-topbar-action/matecu-topbar-action.component';
|
|
13
|
-
import { MatecuTopbarHeaderRowComponent } from '../../components/matecu-topbar-header-row/matecu-topbar-header-row.component';
|
|
14
|
-
import { MatecuTopbarHeaderColumnComponent } from '../../components/matecu-topbar-header-column/matecu-topbar-header-column.component';
|
|
15
|
-
|
|
16
|
-
@NgModule({
|
|
17
|
-
declarations: [],
|
|
18
|
-
imports: [
|
|
19
|
-
CommonModule,
|
|
20
|
-
MatToolbarModule,
|
|
21
|
-
MatIconModule,
|
|
22
|
-
FormsModule,
|
|
23
|
-
ReactiveFormsModule,
|
|
24
|
-
MatButtonModule,
|
|
25
|
-
MatecuTopbarLayoutComponent,
|
|
26
|
-
MatecuTopbarTitleComponent,
|
|
27
|
-
MatecuTopbarBodyComponent,
|
|
28
|
-
MatecuTopbarFabComponent,
|
|
29
|
-
MatecuTopbarSearchComponent,
|
|
30
|
-
MatecuTopbarActionComponent,
|
|
31
|
-
MatecuTopbarHeaderRowComponent,
|
|
32
|
-
MatecuTopbarHeaderColumnComponent,
|
|
33
|
-
],
|
|
34
|
-
exports: [
|
|
35
|
-
MatecuTopbarLayoutComponent,
|
|
36
|
-
MatecuTopbarTitleComponent,
|
|
37
|
-
MatecuTopbarBodyComponent,
|
|
38
|
-
MatecuTopbarFabComponent,
|
|
39
|
-
MatecuTopbarSearchComponent,
|
|
40
|
-
MatecuTopbarActionComponent,
|
|
41
|
-
MatecuTopbarHeaderRowComponent,
|
|
42
|
-
MatecuTopbarHeaderColumnComponent,
|
|
43
|
-
],
|
|
44
|
-
})
|
|
45
|
-
export class MatecuTopbarLayoutModule {}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { MatecuSnackBarService } from './matecu-snack-bar.service';
|
|
4
|
-
|
|
5
|
-
describe('MatecuSnackBarService', () => {
|
|
6
|
-
let service: MatecuSnackBarService;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
TestBed.configureTestingModule({});
|
|
10
|
-
service = TestBed.inject(MatecuSnackBarService);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should be created', () => {
|
|
14
|
-
expect(service).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { MatSnackBar, MatSnackBarConfig, MatSnackBarRef, TextOnlySnackBar } from '@angular/material/snack-bar';
|
|
3
|
-
import { MatecuAlertSnackBarComponent } from '../components/matecu-alert-snack-bar/matecu-alert-snack-bar.component';
|
|
4
|
-
import { MatecuAlertSnackBarData } from '../types/matecu-alert-snackbar';
|
|
5
|
-
import { MatecuAlertBoxType } from '../types/matecu-altert-box-type';
|
|
6
|
-
|
|
7
|
-
@Injectable({
|
|
8
|
-
providedIn: 'root'
|
|
9
|
-
})
|
|
10
|
-
export class MatecuSnackBarService {
|
|
11
|
-
|
|
12
|
-
constructor(private snackBar: MatSnackBar) { }
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
openError(error: string | Error, title?: string | null, action?: string, config?: MatSnackBarConfig<any>): MatSnackBarRef<MatecuAlertSnackBarComponent> {
|
|
17
|
-
const message = this.getErrorMessage(error);
|
|
18
|
-
const titleStr = title || 'ERROR';
|
|
19
|
-
const type = MatecuAlertBoxType.danger;
|
|
20
|
-
return this.openAlert(message, titleStr, type, action, config);
|
|
21
|
-
}
|
|
22
|
-
openSuccess(message: string, title?: string | null, action?: string, config?: MatSnackBarConfig<any>): MatSnackBarRef<MatecuAlertSnackBarComponent> {
|
|
23
|
-
const titleStr = title || 'OK';
|
|
24
|
-
const type = MatecuAlertBoxType.success;
|
|
25
|
-
return this.openAlert(message, titleStr, type, action, config);
|
|
26
|
-
}
|
|
27
|
-
openWarning(message: string, title?: string | null, action?: string, config?: MatSnackBarConfig<any>): MatSnackBarRef<MatecuAlertSnackBarComponent> {
|
|
28
|
-
const titleStr = title || 'WARNING';
|
|
29
|
-
const type = MatecuAlertBoxType.warning;
|
|
30
|
-
return this.openAlert(message, titleStr, type, action, config);
|
|
31
|
-
}
|
|
32
|
-
openInfo(message: string, title?: string | null, action?: string, config?: MatSnackBarConfig<any>): MatSnackBarRef<MatecuAlertSnackBarComponent> {
|
|
33
|
-
const titleStr = title || 'INFO';
|
|
34
|
-
const type = MatecuAlertBoxType.info;
|
|
35
|
-
return this.openAlert(message, titleStr, type, action, config);
|
|
36
|
-
}
|
|
37
|
-
open(message: string, action?: string, config?: MatSnackBarConfig<any>): MatSnackBarRef<TextOnlySnackBar> {
|
|
38
|
-
return this.snackBar.open(message, action, config);
|
|
39
|
-
}
|
|
40
|
-
dismiss(): void {
|
|
41
|
-
this.snackBar.dismiss()
|
|
42
|
-
}
|
|
43
|
-
private openAlert(message: string, title: string, type: MatecuAlertBoxType, action?: string, config?: MatSnackBarConfig<any>) {
|
|
44
|
-
|
|
45
|
-
const data: MatecuAlertSnackBarData = {
|
|
46
|
-
message,
|
|
47
|
-
title,
|
|
48
|
-
action,
|
|
49
|
-
type
|
|
50
|
-
}
|
|
51
|
-
const dialogConfig = { ...config, data }
|
|
52
|
-
|
|
53
|
-
return this.snackBar.openFromComponent(MatecuAlertSnackBarComponent, dialogConfig);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
private getErrorMessage(err: string | Error): string {
|
|
57
|
-
const error = new Error()
|
|
58
|
-
if (typeof err === 'string') {
|
|
59
|
-
return err;
|
|
60
|
-
}
|
|
61
|
-
if (err instanceof Error) {
|
|
62
|
-
return err.message;
|
|
63
|
-
}
|
|
64
|
-
return '';
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { MatecuSpinnerService } from './matecu-spinner.service';
|
|
4
|
-
|
|
5
|
-
describe('MatecuSpinnerService', () => {
|
|
6
|
-
let service: MatecuSpinnerService;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
TestBed.configureTestingModule({});
|
|
10
|
-
service = TestBed.inject(MatecuSpinnerService);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should be created', () => {
|
|
14
|
-
expect(service).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
|
-
|
|
4
|
-
@Injectable({
|
|
5
|
-
providedIn: 'root',
|
|
6
|
-
})
|
|
7
|
-
export class MatecuSpinnerService {
|
|
8
|
-
private active$ = new BehaviorSubject<boolean>(false);
|
|
9
|
-
private requestsKeys: string[] = [];
|
|
10
|
-
constructor() {}
|
|
11
|
-
|
|
12
|
-
watch(): Observable<boolean> {
|
|
13
|
-
return this.active$.pipe();
|
|
14
|
-
}
|
|
15
|
-
add(customKey?: string): string {
|
|
16
|
-
const key = (typeof(customKey) === 'string' && customKey.length > 0) ? customKey : this.createKey();
|
|
17
|
-
this.requestsKeys.push(key);
|
|
18
|
-
this.updateStatus();
|
|
19
|
-
return key;
|
|
20
|
-
}
|
|
21
|
-
remove(key: string): void {
|
|
22
|
-
this.requestsKeys = this.requestsKeys.filter(
|
|
23
|
-
(requestKey) => requestKey !== key
|
|
24
|
-
);
|
|
25
|
-
this.updateStatus();
|
|
26
|
-
}
|
|
27
|
-
clear(): void {
|
|
28
|
-
this.requestsKeys = [];
|
|
29
|
-
this.updateStatus();
|
|
30
|
-
}
|
|
31
|
-
private updateStatus(): void {
|
|
32
|
-
const active = this.requestsKeys.length > 0;
|
|
33
|
-
this.active$.next(active);
|
|
34
|
-
}
|
|
35
|
-
private createKey(): string {
|
|
36
|
-
const time = new Date().getTime();
|
|
37
|
-
const complement = Math.random();
|
|
38
|
-
return `${time}__${complement}`;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { MatecuAlertBoxType } from './matecu-altert-box-type';
|
|
2
|
-
|
|
3
|
-
export interface MatecuAlertDialogData {
|
|
4
|
-
message: string;
|
|
5
|
-
title?: string | null | undefined;
|
|
6
|
-
action?: string | null | undefined;
|
|
7
|
-
icon?: boolean | null | undefined;
|
|
8
|
-
type?: MatecuAlertBoxType | string | null | undefined;
|
|
9
|
-
dismissText?: string | null | undefined;
|
|
10
|
-
}
|
package/src/test.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
-
|
|
3
|
-
import 'zone.js';
|
|
4
|
-
import 'zone.js/testing';
|
|
5
|
-
import { getTestBed } from '@angular/core/testing';
|
|
6
|
-
import {
|
|
7
|
-
BrowserDynamicTestingModule,
|
|
8
|
-
platformBrowserDynamicTesting
|
|
9
|
-
} from '@angular/platform-browser-dynamic/testing';
|
|
10
|
-
|
|
11
|
-
// First, initialize the Angular testing environment.
|
|
12
|
-
getTestBed().initTestEnvironment(
|
|
13
|
-
BrowserDynamicTestingModule,
|
|
14
|
-
platformBrowserDynamicTesting(), {
|
|
15
|
-
teardown: { destroyAfterEach: false }
|
|
16
|
-
}
|
|
17
|
-
);
|
package/tsconfig.lib.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/lib",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"inlineSources": true,
|
|
9
|
-
"types": [],
|
|
10
|
-
"lib": [
|
|
11
|
-
"dom",
|
|
12
|
-
"es2018"
|
|
13
|
-
]
|
|
14
|
-
},
|
|
15
|
-
"angularCompilerOptions": {
|
|
16
|
-
"skipTemplateCodegen": true,
|
|
17
|
-
"strictMetadataEmit": true,
|
|
18
|
-
"enableResourceInlining": true
|
|
19
|
-
},
|
|
20
|
-
"exclude": [
|
|
21
|
-
"src/test.ts",
|
|
22
|
-
"**/*.spec.ts"
|
|
23
|
-
]
|
|
24
|
-
}
|
package/tsconfig.lib.prod.json
DELETED
package/tsconfig.spec.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/spec",
|
|
6
|
-
"types": [
|
|
7
|
-
"jasmine"
|
|
8
|
-
]
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"src/test.ts"
|
|
12
|
-
],
|
|
13
|
-
"include": [
|
|
14
|
-
"**/*.spec.ts",
|
|
15
|
-
"**/*.d.ts"
|
|
16
|
-
]
|
|
17
|
-
}
|
package/tslint.json
DELETED