angular-matecu 4.0.2 → 4.0.3
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/esm2022/angular-matecu.mjs +5 -0
- package/esm2022/lib/components/matecu-alert-box/matecu-alert-box.component.mjs +67 -0
- package/esm2022/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.mjs +54 -0
- package/esm2022/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.mjs +43 -0
- package/esm2022/lib/components/matecu-spinner/matecu-spinner.component.mjs +58 -0
- package/esm2022/lib/components/matecu-topbar-action/matecu-topbar-action.component.mjs +18 -0
- package/esm2022/lib/components/matecu-topbar-body/matecu-topbar-body.component.mjs +17 -0
- package/esm2022/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.mjs +43 -0
- package/esm2022/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.mjs +12 -0
- package/esm2022/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.mjs +29 -0
- package/esm2022/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.mjs +112 -0
- package/esm2022/lib/components/matecu-topbar-search/matecu-topbar-search.component.mjs +93 -0
- package/esm2022/lib/components/matecu-topbar-title/matecu-topbar-title.component.mjs +18 -0
- package/esm2022/lib/modules/matecu-alert-box/matecu-alert-box.module.mjs +24 -0
- package/esm2022/lib/modules/matecu-spinner/matecu-spinner.module.mjs +22 -0
- package/esm2022/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.mjs +83 -0
- package/esm2022/lib/services/matecu-snack-bar.service.mjs +66 -0
- package/esm2022/lib/services/matecu-spinner.service.mjs +44 -0
- package/esm2022/lib/types/matecu-alert-dialog.mjs +2 -0
- package/esm2022/lib/types/matecu-alert-snackbar.mjs +2 -0
- package/esm2022/lib/types/matecu-altert-box-type.mjs +8 -0
- package/esm2022/public-api.mjs +32 -0
- package/fesm2022/angular-matecu.mjs +735 -0
- package/fesm2022/angular-matecu.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/matecu-alert-box/matecu-alert-box.component.d.ts +19 -0
- package/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.d.ts +22 -0
- package/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.d.ts +20 -0
- package/lib/components/matecu-spinner/matecu-spinner.component.d.ts +20 -0
- package/lib/components/matecu-topbar-action/matecu-topbar-action.component.d.ts +9 -0
- package/lib/components/matecu-topbar-body/matecu-topbar-body.component.d.ts +6 -0
- package/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.d.ts +12 -0
- package/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.d.ts +5 -0
- package/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.d.ts +8 -0
- package/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.d.ts +27 -0
- package/lib/components/matecu-topbar-search/matecu-topbar-search.component.d.ts +27 -0
- package/lib/components/matecu-topbar-title/matecu-topbar-title.component.d.ts +9 -0
- package/lib/modules/matecu-alert-box/matecu-alert-box.module.d.ts +14 -0
- package/lib/modules/matecu-spinner/matecu-spinner.module.d.ts +8 -0
- package/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.d.ts +19 -0
- package/lib/services/matecu-snack-bar.service.d.ts +17 -0
- package/lib/services/matecu-spinner.service.d.ts +15 -0
- package/lib/types/matecu-alert-dialog.d.ts +9 -0
- package/{src/lib/types/matecu-alert-snackbar.ts → lib/types/matecu-alert-snackbar.d.ts} +4 -5
- package/lib/types/matecu-altert-box-type.d.ts +6 -0
- package/package.json +19 -4
- package/{src/public-api.ts → public-api.d.ts} +0 -7
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -13
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.html +0 -11
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.scss +0 -39
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.spec.ts +0 -25
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.ts +0 -60
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.html +0 -14
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.scss +0 -5
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.spec.ts +0 -25
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.ts +0 -53
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.html +0 -8
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.scss +0 -34
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.spec.ts +0 -25
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.ts +0 -45
- package/src/lib/components/matecu-spinner/matecu-spinner.component.css +0 -15
- package/src/lib/components/matecu-spinner/matecu-spinner.component.html +0 -35
- package/src/lib/components/matecu-spinner/matecu-spinner.component.spec.ts +0 -25
- package/src/lib/components/matecu-spinner/matecu-spinner.component.ts +0 -50
- package/src/lib/components/matecu-spinner/spinner-loader.component.scss +0 -13
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.html +0 -1
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.scss +0 -19
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.ts +0 -14
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.html +0 -1
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.scss +0 -14
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.ts +0 -11
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.html +0 -3
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.scss +0 -19
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.ts +0 -31
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.html +0 -1
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.scss +0 -8
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.spec.ts +0 -23
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.ts +0 -11
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.html +0 -13
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.scss +0 -34
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.spec.ts +0 -23
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.ts +0 -18
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.html +0 -7
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.scss +0 -49
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.ts +0 -112
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.html +0 -29
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.scss +0 -90
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.ts +0 -92
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.html +0 -1
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.scss +0 -91
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.ts +0 -14
- package/src/lib/modules/matecu-alert-box/matecu-alert-box.module.ts +0 -16
- package/src/lib/modules/matecu-spinner/matecu-spinner.module.ts +0 -14
- package/src/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.ts +0 -45
- package/src/lib/services/matecu-snack-bar.service.spec.ts +0 -16
- package/src/lib/services/matecu-snack-bar.service.ts +0 -66
- package/src/lib/services/matecu-spinner.service.spec.ts +0 -16
- package/src/lib/services/matecu-spinner.service.ts +0 -40
- package/src/lib/types/matecu-alert-dialog.ts +0 -10
- package/src/lib/types/matecu-altert-box-type.ts +0 -6
- package/src/test.ts +0 -17
- package/tsconfig.lib.json +0 -24
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -17
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { Component, HostBinding, Input } from '@angular/core';
|
|
3
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'matecu-topbar-fab',
|
|
7
|
-
templateUrl: './matecu-topbar-fab.component.html',
|
|
8
|
-
styleUrls: ['./matecu-topbar-fab.component.scss'],
|
|
9
|
-
standalone: true,
|
|
10
|
-
imports: [CommonModule, MatButtonModule],
|
|
11
|
-
})
|
|
12
|
-
export class MatecuTopbarFabComponent {
|
|
13
|
-
private _mobileStyle = false;
|
|
14
|
-
private mainClassName = 'matecu-topbar-fab';
|
|
15
|
-
@Input() display = true;
|
|
16
|
-
@Input() get mobileStyle() {
|
|
17
|
-
return this._mobileStyle;
|
|
18
|
-
}
|
|
19
|
-
set mobileStyle(value: boolean) {
|
|
20
|
-
this._mobileStyle = value;
|
|
21
|
-
this.className = this.className.replace(/mobile-style/g, '').trim();
|
|
22
|
-
if (this._mobileStyle) {
|
|
23
|
-
this.className = `${this.className} mobile-style`;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@HostBinding('class') className = this.mainClassName;
|
|
28
|
-
@HostBinding('style.display') get color() {
|
|
29
|
-
return this.display ? 'flex' : 'none';
|
|
30
|
-
}
|
|
31
|
-
}
|
package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<ng-content></ng-content>
|
package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.spec.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { MatecuTopbarHeaderColumnComponent } from './matecu-topbar-header-column.component';
|
|
4
|
-
|
|
5
|
-
describe('MatecuTopbarHeaderColumnComponent', () => {
|
|
6
|
-
let component: MatecuTopbarHeaderColumnComponent;
|
|
7
|
-
let fixture: ComponentFixture<MatecuTopbarHeaderColumnComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [ MatecuTopbarHeaderColumnComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(MatecuTopbarHeaderColumnComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'matecu-topbar-header-column',
|
|
6
|
-
standalone: true,
|
|
7
|
-
imports: [CommonModule],
|
|
8
|
-
templateUrl: './matecu-topbar-header-column.component.html',
|
|
9
|
-
styleUrls: ['./matecu-topbar-header-column.component.scss'],
|
|
10
|
-
})
|
|
11
|
-
export class MatecuTopbarHeaderColumnComponent {}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<ng-container *ngIf="display">
|
|
2
|
-
<div
|
|
3
|
-
class="matecu-topbar-header-row__column matecu-topbar-header-row__column--left"
|
|
4
|
-
>
|
|
5
|
-
<ng-content select="matecu-topbar-header-column[left-column]"></ng-content>
|
|
6
|
-
</div>
|
|
7
|
-
|
|
8
|
-
<div
|
|
9
|
-
class="matecu-topbar-header-row__column matecu-topbar-header-row__column--right"
|
|
10
|
-
>
|
|
11
|
-
<ng-content select="matecu-topbar-header-column[right-column]"></ng-content>
|
|
12
|
-
</div>
|
|
13
|
-
</ng-container>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
--mtb-row-padding: 0px;
|
|
3
|
-
--mtb-row-margin: 0;
|
|
4
|
-
--mtb-row-max-width: 100%;
|
|
5
|
-
--mtb-row-min-width: 320px;
|
|
6
|
-
}
|
|
7
|
-
:host,
|
|
8
|
-
.matecu-topbar-header-row {
|
|
9
|
-
&,
|
|
10
|
-
* {
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
outline: none;
|
|
13
|
-
}
|
|
14
|
-
padding: var(--mtb-row-padding);
|
|
15
|
-
margin: var(--mtb-row-margin);
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: flex-start;
|
|
18
|
-
justify-content: flex-start;
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
width: 100%;
|
|
21
|
-
height: 100%;
|
|
22
|
-
max-width: var(--mtb-row-max-width);
|
|
23
|
-
min-width: var(--mtb-row-min-width);
|
|
24
|
-
&__column {
|
|
25
|
-
display: flex;
|
|
26
|
-
height: 100%;
|
|
27
|
-
min-height: var(--mtb-bar-height, 64px);
|
|
28
|
-
align-items: flex-start;
|
|
29
|
-
&--right {
|
|
30
|
-
margin-left: auto;
|
|
31
|
-
justify-content: flex-end;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.spec.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { MatecuTopbarHeaderRowComponent } from './matecu-topbar-header-row.component';
|
|
4
|
-
|
|
5
|
-
describe('MatecuTopbarRowComponent', () => {
|
|
6
|
-
let component: MatecuTopbarHeaderRowComponent;
|
|
7
|
-
let fixture: ComponentFixture<MatecuTopbarHeaderRowComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [MatecuTopbarHeaderRowComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(MatecuTopbarHeaderRowComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Component, HostBinding, Input } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'matecu-topbar-header-row',
|
|
7
|
-
standalone: true,
|
|
8
|
-
imports: [CommonModule, MatToolbarModule],
|
|
9
|
-
templateUrl: './matecu-topbar-header-row.component.html',
|
|
10
|
-
styleUrls: ['./matecu-topbar-header-row.component.scss'],
|
|
11
|
-
})
|
|
12
|
-
export class MatecuTopbarHeaderRowComponent {
|
|
13
|
-
@Input() display = true;
|
|
14
|
-
@HostBinding('class') className = 'matecu-topbar-header-row';
|
|
15
|
-
@HostBinding('style.display') get color() {
|
|
16
|
-
return this.display ? 'flex' : 'none';
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<div class="matecu-topbar-layout__bar">
|
|
2
|
-
<ng-content select="matecu-topbar-header-row[first-row]"></ng-content>
|
|
3
|
-
<ng-content select="matecu-topbar-header-row[second-row]"></ng-content>
|
|
4
|
-
</div>
|
|
5
|
-
<div class="matecu-topbar-layout__body" #mtbBody>
|
|
6
|
-
<ng-content select="matecu-topbar-body"></ng-content>
|
|
7
|
-
</div>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
:host,
|
|
2
|
-
.matecu-topbar-layout {
|
|
3
|
-
position: relative;
|
|
4
|
-
box-sizing: border-box;
|
|
5
|
-
* {
|
|
6
|
-
box-sizing: border-box;
|
|
7
|
-
}
|
|
8
|
-
display: grid;
|
|
9
|
-
grid-template-rows: auto 1fr;
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
border: var(--mtb-border, none);
|
|
12
|
-
margin: var(--mtb-margin, 0px);
|
|
13
|
-
padding: 0px;
|
|
14
|
-
width: var(--mtb-width, 100%);
|
|
15
|
-
height: var(--mtb-height, 100vh);
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
|
|
18
|
-
&__bar {
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
align-items: center;
|
|
22
|
-
justify-content: flex-start;
|
|
23
|
-
background-color: var(--mtb-primary-color, #3f51b5);
|
|
24
|
-
color: var(--mtb-bar-color, #fff);
|
|
25
|
-
width: 100%;
|
|
26
|
-
padding: 0px;
|
|
27
|
-
margin: 0px;
|
|
28
|
-
min-height: var(--mtb-bar-height, 64px);
|
|
29
|
-
transition: all 300ms;
|
|
30
|
-
}
|
|
31
|
-
&__body {
|
|
32
|
-
padding: 0px;
|
|
33
|
-
margin: 0px;
|
|
34
|
-
overflow-y: auto;
|
|
35
|
-
}
|
|
36
|
-
&.prominent {
|
|
37
|
-
.matecu-topbar-layout__bar {
|
|
38
|
-
min-height: var(--mtb-bar-prominent-height, 128px);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
&.scrolled {
|
|
42
|
-
.matecu-topbar-layout__bar {
|
|
43
|
-
box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.2),
|
|
44
|
-
0px 6px 10px 0px rgba(0, 0, 0, 0.14),
|
|
45
|
-
0px 1px 18px 0px rgba(0, 0, 0, 0.12);
|
|
46
|
-
min-height: var(--mtb-bar-height, 64px);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { MatecuTopbarLayoutComponent } from './matecu-topbar-layout.component';
|
|
4
|
-
|
|
5
|
-
describe('MatecuTopbarLayoutComponent', () => {
|
|
6
|
-
let component: MatecuTopbarLayoutComponent;
|
|
7
|
-
let fixture: ComponentFixture<MatecuTopbarLayoutComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ MatecuTopbarLayoutComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(MatecuTopbarLayoutComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import {
|
|
3
|
-
AfterViewInit,
|
|
4
|
-
ChangeDetectorRef,
|
|
5
|
-
Component,
|
|
6
|
-
ElementRef,
|
|
7
|
-
EventEmitter,
|
|
8
|
-
HostBinding,
|
|
9
|
-
Input,
|
|
10
|
-
NgZone,
|
|
11
|
-
OnDestroy,
|
|
12
|
-
Output,
|
|
13
|
-
ViewChild,
|
|
14
|
-
} from '@angular/core';
|
|
15
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
16
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
17
|
-
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
18
|
-
import { fromEvent, Subject } from 'rxjs';
|
|
19
|
-
import { takeUntil, tap } from 'rxjs/operators';
|
|
20
|
-
@Component({
|
|
21
|
-
selector: 'matecu-topbar-layout',
|
|
22
|
-
templateUrl: './matecu-topbar-layout.component.html',
|
|
23
|
-
styleUrls: ['./matecu-topbar-layout.component.scss'],
|
|
24
|
-
standalone: true,
|
|
25
|
-
imports: [CommonModule, MatButtonModule, MatIconModule, MatToolbarModule],
|
|
26
|
-
})
|
|
27
|
-
export class MatecuTopbarLayoutComponent implements AfterViewInit, OnDestroy {
|
|
28
|
-
private _scrolled = false;
|
|
29
|
-
private _prominent = false;
|
|
30
|
-
get scrolled() {
|
|
31
|
-
return this._scrolled;
|
|
32
|
-
}
|
|
33
|
-
set scrolled(value: boolean) {
|
|
34
|
-
this._scrolled = value;
|
|
35
|
-
this.className = this.className.replace(/scrolled/g, '').trim();
|
|
36
|
-
if (this.scrolled) {
|
|
37
|
-
this.className = `${this.className} scrolled`;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
private destroy$ = new Subject<void>();
|
|
41
|
-
@Input() mobileStyle = false;
|
|
42
|
-
@Output() mobileStyleChange = new EventEmitter<boolean>();
|
|
43
|
-
@Input() mobileWidth = 768;
|
|
44
|
-
@Output() whenResize = new EventEmitter<number>();
|
|
45
|
-
@Input() get prominent() {
|
|
46
|
-
return this._prominent;
|
|
47
|
-
}
|
|
48
|
-
set prominent(value: boolean) {
|
|
49
|
-
this._prominent = value;
|
|
50
|
-
this.className = this.className.replace(/prominent/g, '').trim();
|
|
51
|
-
if (this.prominent) {
|
|
52
|
-
this.className = `${this.className} prominent`;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
@HostBinding('class') className = 'matecu-topbar-layout';
|
|
56
|
-
@ViewChild('mtbBody') bodyElement?: ElementRef;
|
|
57
|
-
|
|
58
|
-
constructor(
|
|
59
|
-
private elementRef: ElementRef,
|
|
60
|
-
private changeDetector: ChangeDetectorRef,
|
|
61
|
-
private zone: NgZone
|
|
62
|
-
) {}
|
|
63
|
-
ngOnDestroy(): void {
|
|
64
|
-
this.destroy$.next();
|
|
65
|
-
this.destroy$.complete();
|
|
66
|
-
}
|
|
67
|
-
private spyScroll(scrollabe: HTMLElement) {
|
|
68
|
-
if (!scrollabe) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const maxScrollHeight = scrollabe.scrollHeight;
|
|
72
|
-
const scrollableHeight = scrollabe.clientHeight;
|
|
73
|
-
if (scrollableHeight > maxScrollHeight) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const scrollPosition = scrollabe.scrollTop;
|
|
77
|
-
this.scrolled = scrollPosition > 20;
|
|
78
|
-
}
|
|
79
|
-
ngAfterViewInit(): void {
|
|
80
|
-
const layoutElement = this.elementRef.nativeElement;
|
|
81
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
82
|
-
const width = layoutElement?.clientWidth;
|
|
83
|
-
if (!width) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
this.mobileStyle = width <= this.mobileWidth;
|
|
87
|
-
this.zone.run(() => {
|
|
88
|
-
this.mobileStyleChange.emit(this.mobileStyle);
|
|
89
|
-
this.whenResize.emit(width);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
resizeObserver.observe(layoutElement!);
|
|
93
|
-
this.destroy$.pipe(tap(() => resizeObserver.disconnect())).subscribe();
|
|
94
|
-
if (this.bodyElement) {
|
|
95
|
-
fromEvent(this.bodyElement.nativeElement, 'scroll')
|
|
96
|
-
.pipe(
|
|
97
|
-
tap(() => this.spyScroll(this.bodyElement?.nativeElement!)),
|
|
98
|
-
takeUntil(this.destroy$)
|
|
99
|
-
)
|
|
100
|
-
.subscribe();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
scrollTop() {
|
|
104
|
-
if (!this.bodyElement) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
this.bodyElement.nativeElement.scroll({
|
|
108
|
-
top: 0,
|
|
109
|
-
behavior: 'smooth',
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<ng-container *ngIf="display">
|
|
2
|
-
<button
|
|
3
|
-
class="matecu-topbar-search-mobile-only"
|
|
4
|
-
[ngClass]="{ 'mobile-style': mobileStyle }"
|
|
5
|
-
(click)="toggleActiveMobildeSearch()"
|
|
6
|
-
>
|
|
7
|
-
<mat-icon>search</mat-icon>
|
|
8
|
-
</button>
|
|
9
|
-
<div
|
|
10
|
-
class="matecu-topbar-search"
|
|
11
|
-
[ngClass]="{
|
|
12
|
-
'mobile-style': mobileStyle,
|
|
13
|
-
'active-mobile': activeMobileSearch
|
|
14
|
-
}"
|
|
15
|
-
>
|
|
16
|
-
<span class="matecu-topbar-search__icon matecu-topbar-search__icon--search">
|
|
17
|
-
<mat-icon>search</mat-icon>
|
|
18
|
-
</span>
|
|
19
|
-
<ng-container *ngIf="hasValue || mobileStyle">
|
|
20
|
-
<button
|
|
21
|
-
class="matecu-topbar-search__icon matecu-topbar-search__icon--clear"
|
|
22
|
-
(click)="clearSearch()"
|
|
23
|
-
>
|
|
24
|
-
<mat-icon>close</mat-icon>
|
|
25
|
-
</button>
|
|
26
|
-
</ng-container>
|
|
27
|
-
<input type="text" [placeholder]="placeholder" [formControl]="inputCtrl" />
|
|
28
|
-
</div>
|
|
29
|
-
</ng-container>
|
|
@@ -1,90 +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
|
-
.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
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -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>
|