angular-matecu 4.1.0 → 4.2.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/fesm2022/angular-matecu.mjs +1740 -0
- package/fesm2022/angular-matecu.mjs.map +1 -0
- package/package.json +16 -3
- package/types/angular-matecu.d.ts +490 -0
- package/ng-package.json +0 -7
- package/src/css/main.css +0 -1
- 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 -24
- 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 -10
- 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-autocomplete/matecu-autocomplete.html +0 -36
- package/src/lib/components/matecu-autocomplete/matecu-autocomplete.scss +0 -56
- package/src/lib/components/matecu-autocomplete/matecu-autocomplete.spec.ts +0 -23
- package/src/lib/components/matecu-autocomplete/matecu-autocomplete.ts +0 -336
- package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.html +0 -64
- package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.scss +0 -23
- package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.spec.ts +0 -23
- package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.ts +0 -314
- package/src/lib/components/matecu-file-input/matecu-file-input-customization.md +0 -284
- package/src/lib/components/matecu-file-input/matecu-file-input.example.md +0 -228
- package/src/lib/components/matecu-file-input/matecu-file-input.html +0 -128
- package/src/lib/components/matecu-file-input/matecu-file-input.scss +0 -461
- package/src/lib/components/matecu-file-input/matecu-file-input.spec.ts +0 -340
- package/src/lib/components/matecu-file-input/matecu-file-input.ts +0 -438
- package/src/lib/components/matecu-spinner/matecu-spinner.component.css +0 -15
- package/src/lib/components/matecu-spinner/matecu-spinner.component.html +0 -44
- package/src/lib/components/matecu-spinner/matecu-spinner.component.spec.ts +0 -25
- package/src/lib/components/matecu-spinner/matecu-spinner.component.ts +0 -54
- 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 -9
- 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 -20
- 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 -39
- package/src/lib/types/matecu-alert-dialog.ts +0 -10
- package/src/lib/types/matecu-alert-snackbar.ts +0 -8
- package/src/lib/types/matecu-altert-box-type.ts +0 -6
- package/src/lib/types/matecu-autocomplete.ts +0 -5
- package/src/public-api.ts +0 -42
- package/src/scss/main.scss +0 -2
- package/src/scss/matecu-spinner-module/_matecu-spinner-component.scss +0 -8
- package/src/scss/matecu-topbar-layout/_variables.scss +0 -2
- package/tsconfig.lib.json +0 -17
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import {
|
|
3
|
-
Component,
|
|
4
|
-
EventEmitter,
|
|
5
|
-
HostBinding,
|
|
6
|
-
Input,
|
|
7
|
-
OnInit,
|
|
8
|
-
Output,
|
|
9
|
-
} from '@angular/core';
|
|
10
|
-
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
11
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
12
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
13
|
-
import { Subject } from 'rxjs';
|
|
14
|
-
import {
|
|
15
|
-
debounceTime,
|
|
16
|
-
distinctUntilChanged,
|
|
17
|
-
map,
|
|
18
|
-
takeUntil,
|
|
19
|
-
tap,
|
|
20
|
-
} from 'rxjs/operators';
|
|
21
|
-
|
|
22
|
-
@Component({
|
|
23
|
-
selector: 'matecu-topbar-search',
|
|
24
|
-
templateUrl: './matecu-topbar-search.component.html',
|
|
25
|
-
styleUrls: ['./matecu-topbar-search.component.scss'],
|
|
26
|
-
standalone: true,
|
|
27
|
-
imports: [
|
|
28
|
-
CommonModule,
|
|
29
|
-
FormsModule,
|
|
30
|
-
ReactiveFormsModule,
|
|
31
|
-
MatIconModule,
|
|
32
|
-
MatButtonModule,
|
|
33
|
-
],
|
|
34
|
-
})
|
|
35
|
-
export class MatecuTopbarSearchComponent implements OnInit {
|
|
36
|
-
hasValue = false;
|
|
37
|
-
activeMobileSearch = false;
|
|
38
|
-
inputCtrl = new FormControl('');
|
|
39
|
-
private _value = '';
|
|
40
|
-
private _mobileStyle = false;
|
|
41
|
-
|
|
42
|
-
private destroy$ = new Subject<void>();
|
|
43
|
-
@Input() display = true;
|
|
44
|
-
@Input() placeholder = '';
|
|
45
|
-
@Input() delyValueChanges = 300; // valor en milisegundos
|
|
46
|
-
@Input() get value() {
|
|
47
|
-
return this._value;
|
|
48
|
-
}
|
|
49
|
-
set value(v: string) {
|
|
50
|
-
this._value = v;
|
|
51
|
-
this.inputCtrl.setValue(v);
|
|
52
|
-
}
|
|
53
|
-
@Input() get mobileStyle() {
|
|
54
|
-
return this._mobileStyle;
|
|
55
|
-
}
|
|
56
|
-
set mobileStyle(value: boolean) {
|
|
57
|
-
this._mobileStyle = value;
|
|
58
|
-
this.className = this.className.replace(/mobile-style/g, '').trim();
|
|
59
|
-
if (this._mobileStyle) {
|
|
60
|
-
this.className = `${this.className} mobile-style`;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
@Output() valueChange = new EventEmitter<string>();
|
|
64
|
-
@HostBinding() className = 'matecu-topbar-search';
|
|
65
|
-
@HostBinding('style.display') get color() {
|
|
66
|
-
return this.display ? 'flex' : 'none';
|
|
67
|
-
}
|
|
68
|
-
ngOnInit(): void {
|
|
69
|
-
this.inputCtrl.valueChanges
|
|
70
|
-
.pipe(
|
|
71
|
-
map((value) => value ?? ''),
|
|
72
|
-
tap(this.updateHasValueFn()),
|
|
73
|
-
debounceTime(this.delyValueChanges),
|
|
74
|
-
distinctUntilChanged(),
|
|
75
|
-
tap((value) => this.valueChange.emit(value!)),
|
|
76
|
-
takeUntil(this.destroy$)
|
|
77
|
-
)
|
|
78
|
-
.subscribe();
|
|
79
|
-
}
|
|
80
|
-
toggleActiveMobildeSearch() {
|
|
81
|
-
this.activeMobileSearch = !this.activeMobileSearch;
|
|
82
|
-
}
|
|
83
|
-
clearSearch() {
|
|
84
|
-
this.inputCtrl.setValue('');
|
|
85
|
-
this.activeMobileSearch = false;
|
|
86
|
-
}
|
|
87
|
-
updateHasValueFn() {
|
|
88
|
-
return (value: string): void => {
|
|
89
|
-
this.hasValue = value.length > 0;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<ng-content></ng-content>
|
|
@@ -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,39 +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 =
|
|
17
|
-
typeof customKey === 'string' && customKey.length > 0 ? customKey : this.createKey();
|
|
18
|
-
this.requestsKeys.push(key);
|
|
19
|
-
this.updateStatus();
|
|
20
|
-
return key;
|
|
21
|
-
}
|
|
22
|
-
remove(key: string): void {
|
|
23
|
-
this.requestsKeys = this.requestsKeys.filter((requestKey) => requestKey !== key);
|
|
24
|
-
this.updateStatus();
|
|
25
|
-
}
|
|
26
|
-
clear(): void {
|
|
27
|
-
this.requestsKeys = [];
|
|
28
|
-
this.updateStatus();
|
|
29
|
-
}
|
|
30
|
-
private updateStatus(): void {
|
|
31
|
-
const active = this.requestsKeys.length > 0;
|
|
32
|
-
this.active$.next(active);
|
|
33
|
-
}
|
|
34
|
-
private createKey(): string {
|
|
35
|
-
const time = new Date().getTime();
|
|
36
|
-
const complement = Math.random();
|
|
37
|
-
return `${time}__${complement}`;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -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/public-api.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Public API Surface of angular-matecu
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* spinner
|
|
7
|
-
*/
|
|
8
|
-
export * from './lib/modules/matecu-spinner/matecu-spinner.module';
|
|
9
|
-
export * from './lib/components/matecu-spinner/matecu-spinner.component';
|
|
10
|
-
export * from './lib/services/matecu-spinner.service';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* topbar-layout
|
|
14
|
-
*/
|
|
15
|
-
export * from './lib/modules/matecu-topbar-layout/matecu-topbar-layout.module';
|
|
16
|
-
export * from './lib/components/matecu-topbar-body/matecu-topbar-body.component';
|
|
17
|
-
export * from './lib/components/matecu-topbar-fab/matecu-topbar-fab.component';
|
|
18
|
-
export * from './lib/components/matecu-topbar-layout/matecu-topbar-layout.component';
|
|
19
|
-
export * from './lib/components/matecu-topbar-title/matecu-topbar-title.component';
|
|
20
|
-
export * from './lib/components/matecu-topbar-search/matecu-topbar-search.component';
|
|
21
|
-
export * from './lib/components/matecu-topbar-action/matecu-topbar-action.component';
|
|
22
|
-
export * from './lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component';
|
|
23
|
-
export * from './lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* alert-box
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
export * from './lib/modules/matecu-alert-box/matecu-alert-box.module';
|
|
30
|
-
export * from './lib/components/matecu-alert-box/matecu-alert-box.component';
|
|
31
|
-
export * from './lib/components/matecu-alert-dialog/matecu-alert-dialog.component';
|
|
32
|
-
export * from './lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component';
|
|
33
|
-
export * from './lib/types/matecu-altert-box-type';
|
|
34
|
-
export * from './lib/types/matecu-alert-dialog';
|
|
35
|
-
export * from './lib/services/matecu-snack-bar.service';
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* inputs
|
|
39
|
-
*/
|
|
40
|
-
export * from './lib/components/matecu-autocomplete/matecu-autocomplete';
|
|
41
|
-
export * from './lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple';
|
|
42
|
-
export * from './lib/components/matecu-file-input/matecu-file-input';
|
package/src/scss/main.scss
DELETED
package/tsconfig.lib.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "../../tsconfig.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"outDir": "../../out-tsc/lib",
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": true,
|
|
9
|
-
"types": []
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"src/**/*.ts"
|
|
13
|
-
],
|
|
14
|
-
"exclude": [
|
|
15
|
-
"**/*.spec.ts"
|
|
16
|
-
]
|
|
17
|
-
}
|
package/tsconfig.lib.prod.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "./tsconfig.lib.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"declarationMap": false
|
|
7
|
-
},
|
|
8
|
-
"angularCompilerOptions": {
|
|
9
|
-
"compilationMode": "partial"
|
|
10
|
-
}
|
|
11
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "../../tsconfig.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"outDir": "../../out-tsc/spec",
|
|
7
|
-
"types": [
|
|
8
|
-
"vitest/globals"
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"src/**/*.d.ts",
|
|
13
|
-
"src/**/*.spec.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|