angular-matecu 4.0.7 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +347 -130
  2. package/ng-package.json +7 -0
  3. package/package.json +6 -21
  4. package/src/lib/components/matecu-alert-box/matecu-alert-box.component.html +11 -0
  5. package/src/lib/components/matecu-alert-box/matecu-alert-box.component.scss +39 -0
  6. package/src/lib/components/matecu-alert-box/matecu-alert-box.component.spec.ts +25 -0
  7. package/src/lib/components/matecu-alert-box/matecu-alert-box.component.ts +60 -0
  8. package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.html +24 -0
  9. package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.scss +5 -0
  10. package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.spec.ts +25 -0
  11. package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.ts +53 -0
  12. package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.html +10 -0
  13. package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.scss +34 -0
  14. package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.spec.ts +25 -0
  15. package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.ts +45 -0
  16. package/src/lib/components/matecu-autocomplete/matecu-autocomplete.html +36 -0
  17. package/src/lib/components/matecu-autocomplete/matecu-autocomplete.scss +56 -0
  18. package/src/lib/components/matecu-autocomplete/matecu-autocomplete.spec.ts +23 -0
  19. package/src/lib/components/matecu-autocomplete/matecu-autocomplete.ts +336 -0
  20. package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.html +64 -0
  21. package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.scss +23 -0
  22. package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.spec.ts +23 -0
  23. package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.ts +314 -0
  24. package/src/lib/components/matecu-file-input/matecu-file-input-customization.md +284 -0
  25. package/src/lib/components/matecu-file-input/matecu-file-input.example.md +228 -0
  26. package/src/lib/components/matecu-file-input/matecu-file-input.html +128 -0
  27. package/src/lib/components/matecu-file-input/matecu-file-input.scss +461 -0
  28. package/src/lib/components/matecu-file-input/matecu-file-input.spec.ts +340 -0
  29. package/src/lib/components/matecu-file-input/matecu-file-input.ts +438 -0
  30. package/src/lib/components/matecu-spinner/matecu-spinner.component.css +15 -0
  31. package/src/lib/components/matecu-spinner/matecu-spinner.component.html +44 -0
  32. package/src/lib/components/matecu-spinner/matecu-spinner.component.spec.ts +25 -0
  33. package/src/lib/components/matecu-spinner/matecu-spinner.component.ts +54 -0
  34. package/src/lib/components/matecu-spinner/spinner-loader.component.scss +13 -0
  35. package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.html +1 -0
  36. package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.scss +19 -0
  37. package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.spec.ts +25 -0
  38. package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.ts +14 -0
  39. package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.html +1 -0
  40. package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.scss +14 -0
  41. package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.spec.ts +25 -0
  42. package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.ts +11 -0
  43. package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.html +3 -0
  44. package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.scss +19 -0
  45. package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.spec.ts +25 -0
  46. package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.ts +31 -0
  47. package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.html +1 -0
  48. package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.scss +8 -0
  49. package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.spec.ts +23 -0
  50. package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.ts +11 -0
  51. package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.html +9 -0
  52. package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.scss +34 -0
  53. package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.spec.ts +23 -0
  54. package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.ts +18 -0
  55. package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.html +7 -0
  56. package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.scss +49 -0
  57. package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.spec.ts +25 -0
  58. package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.ts +112 -0
  59. package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.html +20 -0
  60. package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.scss +90 -0
  61. package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.spec.ts +25 -0
  62. package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.ts +92 -0
  63. package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.html +1 -0
  64. package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.scss +91 -0
  65. package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.spec.ts +25 -0
  66. package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.ts +14 -0
  67. package/src/lib/modules/matecu-alert-box/matecu-alert-box.module.ts +16 -0
  68. package/src/lib/modules/matecu-spinner/matecu-spinner.module.ts +14 -0
  69. package/src/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.ts +45 -0
  70. package/src/lib/services/matecu-snack-bar.service.spec.ts +16 -0
  71. package/src/lib/services/matecu-snack-bar.service.ts +66 -0
  72. package/src/lib/services/matecu-spinner.service.spec.ts +16 -0
  73. package/src/lib/services/matecu-spinner.service.ts +39 -0
  74. package/src/lib/types/matecu-alert-dialog.ts +10 -0
  75. package/{lib/types/matecu-alert-snackbar.d.ts → src/lib/types/matecu-alert-snackbar.ts} +5 -4
  76. package/src/lib/types/matecu-altert-box-type.ts +6 -0
  77. package/src/lib/types/matecu-autocomplete.ts +5 -0
  78. package/{public-api.d.ts → src/public-api.ts} +14 -0
  79. package/tsconfig.lib.json +17 -0
  80. package/tsconfig.lib.prod.json +11 -0
  81. package/tsconfig.spec.json +15 -0
  82. package/CHANGELOG.md +0 -22
  83. package/esm2022/angular-matecu.mjs +0 -5
  84. package/esm2022/lib/components/matecu-alert-box/matecu-alert-box.component.mjs +0 -67
  85. package/esm2022/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.mjs +0 -54
  86. package/esm2022/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.mjs +0 -43
  87. package/esm2022/lib/components/matecu-spinner/matecu-spinner.component.mjs +0 -58
  88. package/esm2022/lib/components/matecu-topbar-action/matecu-topbar-action.component.mjs +0 -18
  89. package/esm2022/lib/components/matecu-topbar-body/matecu-topbar-body.component.mjs +0 -17
  90. package/esm2022/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.mjs +0 -43
  91. package/esm2022/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.mjs +0 -12
  92. package/esm2022/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.mjs +0 -29
  93. package/esm2022/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.mjs +0 -112
  94. package/esm2022/lib/components/matecu-topbar-search/matecu-topbar-search.component.mjs +0 -93
  95. package/esm2022/lib/components/matecu-topbar-title/matecu-topbar-title.component.mjs +0 -18
  96. package/esm2022/lib/modules/matecu-alert-box/matecu-alert-box.module.mjs +0 -24
  97. package/esm2022/lib/modules/matecu-spinner/matecu-spinner.module.mjs +0 -22
  98. package/esm2022/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.mjs +0 -83
  99. package/esm2022/lib/services/matecu-snack-bar.service.mjs +0 -66
  100. package/esm2022/lib/services/matecu-spinner.service.mjs +0 -44
  101. package/esm2022/lib/types/matecu-alert-dialog.mjs +0 -2
  102. package/esm2022/lib/types/matecu-alert-snackbar.mjs +0 -2
  103. package/esm2022/lib/types/matecu-altert-box-type.mjs +0 -8
  104. package/esm2022/public-api.mjs +0 -32
  105. package/fesm2022/angular-matecu.mjs +0 -735
  106. package/fesm2022/angular-matecu.mjs.map +0 -1
  107. package/index.d.ts +0 -5
  108. package/lib/components/matecu-alert-box/matecu-alert-box.component.d.ts +0 -19
  109. package/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.d.ts +0 -22
  110. package/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.d.ts +0 -20
  111. package/lib/components/matecu-spinner/matecu-spinner.component.d.ts +0 -20
  112. package/lib/components/matecu-topbar-action/matecu-topbar-action.component.d.ts +0 -9
  113. package/lib/components/matecu-topbar-body/matecu-topbar-body.component.d.ts +0 -6
  114. package/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.d.ts +0 -12
  115. package/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.d.ts +0 -5
  116. package/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.d.ts +0 -8
  117. package/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.d.ts +0 -27
  118. package/lib/components/matecu-topbar-search/matecu-topbar-search.component.d.ts +0 -27
  119. package/lib/components/matecu-topbar-title/matecu-topbar-title.component.d.ts +0 -9
  120. package/lib/modules/matecu-alert-box/matecu-alert-box.module.d.ts +0 -14
  121. package/lib/modules/matecu-spinner/matecu-spinner.module.d.ts +0 -8
  122. package/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.d.ts +0 -19
  123. package/lib/services/matecu-snack-bar.service.d.ts +0 -17
  124. package/lib/services/matecu-spinner.service.d.ts +0 -15
  125. package/lib/types/matecu-alert-dialog.d.ts +0 -9
  126. package/lib/types/matecu-altert-box-type.d.ts +0 -6
@@ -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,39 @@
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
+ }
@@ -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
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * [value,label]
3
+ */
4
+ export type MatecuAutocompleteOption = [string, string];
5
+ export type MatecuAutocompleteFilterFn = (optionLabel: string, search: string) => boolean;
@@ -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';
@@ -26,3 +33,10 @@ export * from './lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.co
26
33
  export * from './lib/types/matecu-altert-box-type';
27
34
  export * from './lib/types/matecu-alert-dialog';
28
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';
@@ -0,0 +1,17 @@
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
+ }
@@ -0,0 +1,11 @@
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
+ }
@@ -0,0 +1,15 @@
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
+ }
package/CHANGELOG.md DELETED
@@ -1,22 +0,0 @@
1
- Versión 4.0
2
-
3
- - Se cambio la estructura de los componentes relacionados con MatecuTopbarLayout
4
- - El color de la barra de MatecuTopbarLayout ya no se obtiene del tema de material design se puede asignar con la variable css --mtb-primary-color
5
- - Se cambio el selector para identifcar la primera y segunda fila MatecuTopbarHeaderRow se usan los atributos first-row y second-row según corresponda
6
- - Se agrego MatecuTopbarHeaderColumn para agregar elementos a la barra puede ser con atributo left-column o right-column
7
- - El output e input de MatecuTopbarSearch es valueChange y value respectivamente.
8
- - MatecuTopbarFab ya no incluye el botón ni su respectiva acción, se deben agregar como contenido.
9
- - Se quitaron los estilos para dispositivos móviles ahora se ajusta con la propiedad mobileStyle de algunos componentes
10
- Versión 3.0
11
-
12
- ## Standalone components
13
-
14
- - Se cambiaron todos los componentes a tipo standalone. El uso de módulos queda obsoleto y sera removido en futuras versiones
15
-
16
- ## TopbarLayout
17
-
18
- - Se quito el boton de navegación pricipal, input navMenu y output clickNavMenu fueron removidos
19
- - Se quito el boton de navegación pricipal, input actionMenu y output clickActionMenu fueron removidos
20
- - Se elimino componente matecu-topbar-actions queda en su lugar matecu-topbar-action que se puede utilizar en multiple ocaciones
21
- - Es obligatorio agrupar todos los elementos del topbar excepto matecu-topbar-body dentro del elemento matecu-topbar-header-row
22
- - Es obligatorio importar MatSnackBarModule para usar el componente matecu-alert-snack-bar
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './public-api';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci1tYXRlY3UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9wcm9qZWN0cy9hbmd1bGFyLW1hdGVjdS9zcmMvYW5ndWxhci1tYXRlY3UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==