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.
Files changed (114) hide show
  1. package/README.md +73 -26
  2. package/karma.conf.js +44 -0
  3. package/ng-package.json +13 -0
  4. package/package.json +6 -21
  5. package/src/lib/components/matecu-alert-box/matecu-alert-box.component.html +11 -0
  6. package/src/lib/components/matecu-alert-box/matecu-alert-box.component.scss +39 -0
  7. package/src/lib/components/matecu-alert-box/matecu-alert-box.component.spec.ts +25 -0
  8. package/src/lib/components/matecu-alert-box/matecu-alert-box.component.ts +60 -0
  9. package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.html +14 -0
  10. package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.scss +5 -0
  11. package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.spec.ts +25 -0
  12. package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.ts +53 -0
  13. package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.html +8 -0
  14. package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.scss +34 -0
  15. package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.spec.ts +25 -0
  16. package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.ts +45 -0
  17. package/src/lib/components/matecu-spinner/matecu-spinner.component.css +15 -0
  18. package/src/lib/components/matecu-spinner/matecu-spinner.component.html +35 -0
  19. package/src/lib/components/matecu-spinner/matecu-spinner.component.spec.ts +25 -0
  20. package/src/lib/components/matecu-spinner/matecu-spinner.component.ts +50 -0
  21. package/src/lib/components/matecu-spinner/spinner-loader.component.scss +13 -0
  22. package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.html +1 -0
  23. package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.scss +19 -0
  24. package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.spec.ts +25 -0
  25. package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.ts +14 -0
  26. package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.html +1 -0
  27. package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.scss +14 -0
  28. package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.spec.ts +25 -0
  29. package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.ts +11 -0
  30. package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.html +3 -0
  31. package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.scss +19 -0
  32. package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.spec.ts +25 -0
  33. package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.ts +31 -0
  34. package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.html +1 -0
  35. package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.scss +8 -0
  36. package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.spec.ts +23 -0
  37. package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.ts +11 -0
  38. package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.html +13 -0
  39. package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.scss +34 -0
  40. package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.spec.ts +23 -0
  41. package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.ts +18 -0
  42. package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.html +7 -0
  43. package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.scss +49 -0
  44. package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.spec.ts +25 -0
  45. package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.ts +112 -0
  46. package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.html +29 -0
  47. package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.scss +90 -0
  48. package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.spec.ts +25 -0
  49. package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.ts +92 -0
  50. package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.html +1 -0
  51. package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.scss +91 -0
  52. package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.spec.ts +25 -0
  53. package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.ts +14 -0
  54. package/src/lib/modules/matecu-alert-box/matecu-alert-box.module.ts +16 -0
  55. package/src/lib/modules/matecu-spinner/matecu-spinner.module.ts +14 -0
  56. package/src/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.ts +45 -0
  57. package/src/lib/services/matecu-snack-bar.service.spec.ts +16 -0
  58. package/src/lib/services/matecu-snack-bar.service.ts +66 -0
  59. package/src/lib/services/matecu-spinner.service.spec.ts +16 -0
  60. package/src/lib/services/matecu-spinner.service.ts +40 -0
  61. package/src/lib/types/matecu-alert-dialog.ts +10 -0
  62. package/{lib/types/matecu-alert-snackbar.d.ts → src/lib/types/matecu-alert-snackbar.ts} +5 -4
  63. package/src/lib/types/matecu-altert-box-type.ts +6 -0
  64. package/{public-api.d.ts → src/public-api.ts} +7 -0
  65. package/src/test.ts +17 -0
  66. package/tsconfig.lib.json +24 -0
  67. package/tsconfig.lib.prod.json +10 -0
  68. package/tsconfig.spec.json +17 -0
  69. package/tslint.json +17 -0
  70. package/angular-matecu-4.0.0.tgz +0 -0
  71. package/esm2022/angular-matecu.mjs +0 -5
  72. package/esm2022/lib/components/matecu-alert-box/matecu-alert-box.component.mjs +0 -67
  73. package/esm2022/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.mjs +0 -54
  74. package/esm2022/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.mjs +0 -43
  75. package/esm2022/lib/components/matecu-spinner/matecu-spinner.component.mjs +0 -58
  76. package/esm2022/lib/components/matecu-topbar-action/matecu-topbar-action.component.mjs +0 -18
  77. package/esm2022/lib/components/matecu-topbar-body/matecu-topbar-body.component.mjs +0 -17
  78. package/esm2022/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.mjs +0 -43
  79. package/esm2022/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.mjs +0 -12
  80. package/esm2022/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.mjs +0 -29
  81. package/esm2022/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.mjs +0 -112
  82. package/esm2022/lib/components/matecu-topbar-search/matecu-topbar-search.component.mjs +0 -93
  83. package/esm2022/lib/components/matecu-topbar-title/matecu-topbar-title.component.mjs +0 -18
  84. package/esm2022/lib/modules/matecu-alert-box/matecu-alert-box.module.mjs +0 -24
  85. package/esm2022/lib/modules/matecu-spinner/matecu-spinner.module.mjs +0 -22
  86. package/esm2022/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.mjs +0 -83
  87. package/esm2022/lib/services/matecu-snack-bar.service.mjs +0 -66
  88. package/esm2022/lib/services/matecu-spinner.service.mjs +0 -44
  89. package/esm2022/lib/types/matecu-alert-dialog.mjs +0 -2
  90. package/esm2022/lib/types/matecu-alert-snackbar.mjs +0 -2
  91. package/esm2022/lib/types/matecu-altert-box-type.mjs +0 -8
  92. package/esm2022/public-api.mjs +0 -32
  93. package/fesm2022/angular-matecu.mjs +0 -735
  94. package/fesm2022/angular-matecu.mjs.map +0 -1
  95. package/index.d.ts +0 -5
  96. package/lib/components/matecu-alert-box/matecu-alert-box.component.d.ts +0 -19
  97. package/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.d.ts +0 -22
  98. package/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.d.ts +0 -20
  99. package/lib/components/matecu-spinner/matecu-spinner.component.d.ts +0 -20
  100. package/lib/components/matecu-topbar-action/matecu-topbar-action.component.d.ts +0 -9
  101. package/lib/components/matecu-topbar-body/matecu-topbar-body.component.d.ts +0 -6
  102. package/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.d.ts +0 -12
  103. package/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.d.ts +0 -5
  104. package/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.d.ts +0 -8
  105. package/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.d.ts +0 -27
  106. package/lib/components/matecu-topbar-search/matecu-topbar-search.component.d.ts +0 -27
  107. package/lib/components/matecu-topbar-title/matecu-topbar-title.component.d.ts +0 -9
  108. package/lib/modules/matecu-alert-box/matecu-alert-box.module.d.ts +0 -14
  109. package/lib/modules/matecu-spinner/matecu-spinner.module.d.ts +0 -8
  110. package/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.d.ts +0 -19
  111. package/lib/services/matecu-snack-bar.service.d.ts +0 -17
  112. package/lib/services/matecu-spinner.service.d.ts +0 -15
  113. package/lib/types/matecu-alert-dialog.d.ts +0 -9
  114. package/lib/types/matecu-altert-box-type.d.ts +0 -6
@@ -0,0 +1,90 @@
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
+ .matecu-topbar-search {
15
+ &,
16
+ * {
17
+ box-sizing: border-box;
18
+ outline: none;
19
+ }
20
+ margin: $mtb-search-margin;
21
+ position: relative;
22
+ display: flex;
23
+ align-items: center;
24
+ color: var(--mtb-search-color, $search-text-color);
25
+ max-height: var(--bar-height, 64px);
26
+
27
+ input {
28
+ width: var(--mtb-search-width, 200px);
29
+ min-width: var(--mtb-search-width, 200px);
30
+ height: var(--mtb-search-height, 40px);
31
+ padding: var(--mtb-search-pading, 3px 35px);
32
+ border-radius: 4px;
33
+ border: 1px solid;
34
+ border: var(--mtb-search-border, none);
35
+ background-color: var(--search-background-color, #ffffff4d);
36
+ color: currentColor;
37
+ transition: all 300ms ease-in-out;
38
+ &::placeholder {
39
+ color: var(--mtb-search-color, $search-text-color);
40
+ opacity: 1; /* Firefox */
41
+ }
42
+ &:focus {
43
+ min-width: var(--mtb-search-width-large, 290px);
44
+ }
45
+ }
46
+
47
+ &__icon {
48
+ position: absolute;
49
+ top: 50%;
50
+ transform: translateY(-50%);
51
+ padding: 0px;
52
+ &--search {
53
+ left: 6px;
54
+ }
55
+ &--clear {
56
+ border: 0px;
57
+ background: 0px;
58
+ cursor: pointer;
59
+ color: currentColor;
60
+ right: 6px;
61
+ }
62
+ }
63
+ }
64
+ .mobile-style.matecu-topbar-search {
65
+ position: absolute;
66
+ top: 0px;
67
+ left: 0px;
68
+ right: 0px;
69
+ border-bottom: 1px solid;
70
+ border-bottom-color: var(--mtb-search-border-bottom-color, #ededed);
71
+ z-index: 3;
72
+ padding: 0px;
73
+ margin: 0px;
74
+ height: 64px;
75
+ color: var(--mtb-search-mobile-color, #000);
76
+ transform: translateY(-120%);
77
+ transition: all 300ms ease-in-out;
78
+ &.active-mobile {
79
+ transform: translateY(0);
80
+ }
81
+ input {
82
+ background-color: #fff;
83
+ height: 100%;
84
+ width: 100%;
85
+ border-radius: 0px;
86
+ &::placeholder {
87
+ color: var(--mtb-search-mobile-color, #000);
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,25 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { MatecuTopbarSearchComponent } from './matecu-topbar-search.component';
4
+
5
+ describe('MatecuTopbarSearchComponent', () => {
6
+ let component: MatecuTopbarSearchComponent;
7
+ let fixture: ComponentFixture<MatecuTopbarSearchComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [ MatecuTopbarSearchComponent ]
12
+ })
13
+ .compileComponents();
14
+ });
15
+
16
+ beforeEach(() => {
17
+ fixture = TestBed.createComponent(MatecuTopbarSearchComponent);
18
+ component = fixture.componentInstance;
19
+ fixture.detectChanges();
20
+ });
21
+
22
+ it('should create', () => {
23
+ expect(component).toBeTruthy();
24
+ });
25
+ });
@@ -0,0 +1,92 @@
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
+ }
@@ -0,0 +1 @@
1
+ <ng-content></ng-content>
@@ -0,0 +1,91 @@
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
+ }
@@ -0,0 +1,25 @@
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
+ });
@@ -0,0 +1,14 @@
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
+ }
@@ -0,0 +1,16 @@
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 { }
@@ -0,0 +1,14 @@
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 { }
@@ -0,0 +1,45 @@
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 {}
@@ -0,0 +1,16 @@
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
+ });
@@ -0,0 +1,66 @@
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
+ }
@@ -0,0 +1,16 @@
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
+ });
@@ -0,0 +1,40 @@
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
+ }
@@ -0,0 +1,10 @@
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
+ }
@@ -1,7 +1,8 @@
1
1
  import { MatecuAlertBoxType } from './matecu-altert-box-type';
2
+
2
3
  export interface MatecuAlertSnackBarData {
3
- message: string;
4
- title: string;
5
- action?: string;
6
- type: MatecuAlertBoxType;
4
+ message: string;
5
+ title: string;
6
+ action?: string;
7
+ type: MatecuAlertBoxType
7
8
  }
@@ -0,0 +1,6 @@
1
+ export enum MatecuAlertBoxType {
2
+ warning = 'warning',
3
+ success = 'success',
4
+ danger = 'danger',
5
+ info = 'info',
6
+ }
@@ -1,9 +1,14 @@
1
+ /*
2
+ * Public API Surface of angular-matecu
3
+ */
4
+
1
5
  /**
2
6
  * spinner
3
7
  */
4
8
  export * from './lib/modules/matecu-spinner/matecu-spinner.module';
5
9
  export * from './lib/components/matecu-spinner/matecu-spinner.component';
6
10
  export * from './lib/services/matecu-spinner.service';
11
+
7
12
  /**
8
13
  * topbar-layout
9
14
  */
@@ -16,9 +21,11 @@ export * from './lib/components/matecu-topbar-search/matecu-topbar-search.compon
16
21
  export * from './lib/components/matecu-topbar-action/matecu-topbar-action.component';
17
22
  export * from './lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component';
18
23
  export * from './lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component';
24
+
19
25
  /**
20
26
  * alert-box
21
27
  */
28
+
22
29
  export * from './lib/modules/matecu-alert-box/matecu-alert-box.module';
23
30
  export * from './lib/components/matecu-alert-box/matecu-alert-box.component';
24
31
  export * from './lib/components/matecu-alert-dialog/matecu-alert-dialog.component';
package/src/test.ts ADDED
@@ -0,0 +1,17 @@
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
+ );
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,10 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "./tsconfig.lib.json",
4
+ "compilerOptions": {
5
+ "declarationMap": false
6
+ },
7
+ "angularCompilerOptions": {
8
+ "compilationMode": "partial"
9
+ }
10
+ }