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.
- package/README.md +73 -26
- package/karma.conf.js +44 -0
- package/ng-package.json +13 -0
- package/package.json +6 -21
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.html +11 -0
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.scss +39 -0
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.spec.ts +25 -0
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.ts +60 -0
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.html +14 -0
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.scss +5 -0
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.spec.ts +25 -0
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.ts +53 -0
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.html +8 -0
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.scss +34 -0
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.spec.ts +25 -0
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.ts +45 -0
- package/src/lib/components/matecu-spinner/matecu-spinner.component.css +15 -0
- package/src/lib/components/matecu-spinner/matecu-spinner.component.html +35 -0
- package/src/lib/components/matecu-spinner/matecu-spinner.component.spec.ts +25 -0
- package/src/lib/components/matecu-spinner/matecu-spinner.component.ts +50 -0
- package/src/lib/components/matecu-spinner/spinner-loader.component.scss +13 -0
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.html +1 -0
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.scss +19 -0
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.spec.ts +25 -0
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.ts +14 -0
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.html +1 -0
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.scss +14 -0
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.spec.ts +25 -0
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.ts +11 -0
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.html +3 -0
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.scss +19 -0
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.spec.ts +25 -0
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.ts +31 -0
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.html +1 -0
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.scss +8 -0
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.spec.ts +23 -0
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.ts +11 -0
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.html +13 -0
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.scss +34 -0
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.spec.ts +23 -0
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.ts +18 -0
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.html +7 -0
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.scss +49 -0
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.spec.ts +25 -0
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.ts +112 -0
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.html +29 -0
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.scss +90 -0
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.spec.ts +25 -0
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.ts +92 -0
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.html +1 -0
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.scss +91 -0
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.spec.ts +25 -0
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.ts +14 -0
- package/src/lib/modules/matecu-alert-box/matecu-alert-box.module.ts +16 -0
- package/src/lib/modules/matecu-spinner/matecu-spinner.module.ts +14 -0
- package/src/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.ts +45 -0
- package/src/lib/services/matecu-snack-bar.service.spec.ts +16 -0
- package/src/lib/services/matecu-snack-bar.service.ts +66 -0
- package/src/lib/services/matecu-spinner.service.spec.ts +16 -0
- package/src/lib/services/matecu-spinner.service.ts +40 -0
- package/src/lib/types/matecu-alert-dialog.ts +10 -0
- package/{lib/types/matecu-alert-snackbar.d.ts → src/lib/types/matecu-alert-snackbar.ts} +5 -4
- package/src/lib/types/matecu-altert-box-type.ts +6 -0
- package/{public-api.d.ts → src/public-api.ts} +7 -0
- package/src/test.ts +17 -0
- package/tsconfig.lib.json +24 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/tslint.json +17 -0
- package/angular-matecu-4.0.0.tgz +0 -0
- package/esm2022/angular-matecu.mjs +0 -5
- package/esm2022/lib/components/matecu-alert-box/matecu-alert-box.component.mjs +0 -67
- package/esm2022/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.mjs +0 -54
- package/esm2022/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.mjs +0 -43
- package/esm2022/lib/components/matecu-spinner/matecu-spinner.component.mjs +0 -58
- package/esm2022/lib/components/matecu-topbar-action/matecu-topbar-action.component.mjs +0 -18
- package/esm2022/lib/components/matecu-topbar-body/matecu-topbar-body.component.mjs +0 -17
- package/esm2022/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.mjs +0 -43
- package/esm2022/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.mjs +0 -12
- package/esm2022/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.mjs +0 -29
- package/esm2022/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.mjs +0 -112
- package/esm2022/lib/components/matecu-topbar-search/matecu-topbar-search.component.mjs +0 -93
- package/esm2022/lib/components/matecu-topbar-title/matecu-topbar-title.component.mjs +0 -18
- package/esm2022/lib/modules/matecu-alert-box/matecu-alert-box.module.mjs +0 -24
- package/esm2022/lib/modules/matecu-spinner/matecu-spinner.module.mjs +0 -22
- package/esm2022/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.mjs +0 -83
- package/esm2022/lib/services/matecu-snack-bar.service.mjs +0 -66
- package/esm2022/lib/services/matecu-spinner.service.mjs +0 -44
- package/esm2022/lib/types/matecu-alert-dialog.mjs +0 -2
- package/esm2022/lib/types/matecu-alert-snackbar.mjs +0 -2
- package/esm2022/lib/types/matecu-altert-box-type.mjs +0 -8
- package/esm2022/public-api.mjs +0 -32
- package/fesm2022/angular-matecu.mjs +0 -735
- package/fesm2022/angular-matecu.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/components/matecu-alert-box/matecu-alert-box.component.d.ts +0 -19
- package/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.d.ts +0 -22
- package/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.d.ts +0 -20
- package/lib/components/matecu-spinner/matecu-spinner.component.d.ts +0 -20
- package/lib/components/matecu-topbar-action/matecu-topbar-action.component.d.ts +0 -9
- package/lib/components/matecu-topbar-body/matecu-topbar-body.component.d.ts +0 -6
- package/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.d.ts +0 -12
- package/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.d.ts +0 -5
- package/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.d.ts +0 -8
- package/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.d.ts +0 -27
- package/lib/components/matecu-topbar-search/matecu-topbar-search.component.d.ts +0 -27
- package/lib/components/matecu-topbar-title/matecu-topbar-title.component.d.ts +0 -9
- package/lib/modules/matecu-alert-box/matecu-alert-box.module.d.ts +0 -14
- package/lib/modules/matecu-spinner/matecu-spinner.module.d.ts +0 -8
- package/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.d.ts +0 -19
- package/lib/services/matecu-snack-bar.service.d.ts +0 -17
- package/lib/services/matecu-spinner.service.d.ts +0 -15
- package/lib/types/matecu-alert-dialog.d.ts +0 -9
- package/lib/types/matecu-altert-box-type.d.ts +0 -6
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, HostBinding, Input, OnDestroy, OnInit } from '@angular/core';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { takeUntil, tap } from 'rxjs/operators';
|
|
5
|
+
import { MatecuSpinnerService } from '../../services/matecu-spinner.service';
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'matecu-spinner',
|
|
8
|
+
templateUrl: './matecu-spinner.component.html',
|
|
9
|
+
styleUrls: ['./matecu-spinner.component.css'],
|
|
10
|
+
standalone: true,
|
|
11
|
+
imports: [CommonModule]
|
|
12
|
+
})
|
|
13
|
+
export class MatecuSpinnerComponent implements OnInit, OnDestroy {
|
|
14
|
+
|
|
15
|
+
private destroy$ = new Subject();
|
|
16
|
+
private hiddenClass = 'matecu-spinner--hidden';
|
|
17
|
+
private activeCache = false;
|
|
18
|
+
@HostBinding('class') className = 'matecu-spinner';
|
|
19
|
+
@Input() color = '#2196F3';
|
|
20
|
+
@Input() global = false;
|
|
21
|
+
get active(): boolean {
|
|
22
|
+
return this.activeCache;
|
|
23
|
+
}
|
|
24
|
+
@Input() set active(value: boolean) {
|
|
25
|
+
if (this.global) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.activeCache = value;
|
|
29
|
+
this.className = value
|
|
30
|
+
? this.className.replace(` ${this.hiddenClass}`, '')
|
|
31
|
+
: (this.className += ` ${this.hiddenClass}`);
|
|
32
|
+
}
|
|
33
|
+
@Input() size = '70px';
|
|
34
|
+
|
|
35
|
+
constructor(
|
|
36
|
+
private spinnerService: MatecuSpinnerService,
|
|
37
|
+
) { }
|
|
38
|
+
ngOnDestroy(): void {
|
|
39
|
+
this.destroy$.next();
|
|
40
|
+
this.destroy$.complete();
|
|
41
|
+
}
|
|
42
|
+
ngOnInit(): void {
|
|
43
|
+
if (this.global) {
|
|
44
|
+
this.spinnerService.watch().pipe(
|
|
45
|
+
tap(value => this.activeCache = value),
|
|
46
|
+
takeUntil(this.destroy$)
|
|
47
|
+
).subscribe();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<ng-content></ng-content>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--mtb-bar-height: 64px;
|
|
3
|
+
--mtb-action-padding: 10px;
|
|
4
|
+
--mtb-action-margin: 0px;
|
|
5
|
+
}
|
|
6
|
+
:host,
|
|
7
|
+
.matecu-topbar-action {
|
|
8
|
+
&,
|
|
9
|
+
* {
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
outline: none;
|
|
12
|
+
}
|
|
13
|
+
height: 100%;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: flex-start;
|
|
16
|
+
max-height: var(--mtb-bar-height);
|
|
17
|
+
padding: var(--mtb-action-padding);
|
|
18
|
+
margin: var(--mtb-action-margin);
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { MatecuTopbarActionComponent } from './matecu-topbar-action.component';
|
|
4
|
+
|
|
5
|
+
describe('MatecuTopbarActionsComponent', () => {
|
|
6
|
+
let component: MatecuTopbarActionComponent;
|
|
7
|
+
let fixture: ComponentFixture<MatecuTopbarActionComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [MatecuTopbarActionComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(MatecuTopbarActionComponent);
|
|
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-action',
|
|
5
|
+
templateUrl: './matecu-topbar-action.component.html',
|
|
6
|
+
styleUrls: ['./matecu-topbar-action.component.scss'],
|
|
7
|
+
standalone: true,
|
|
8
|
+
})
|
|
9
|
+
export class MatecuTopbarActionComponent implements OnInit {
|
|
10
|
+
@HostBinding('class') className = 'matecu-topbar-action';
|
|
11
|
+
constructor() {}
|
|
12
|
+
|
|
13
|
+
ngOnInit(): void {}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<ng-content></ng-content>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
:host,
|
|
2
|
+
.matecu-topbar-body {
|
|
3
|
+
display: block;
|
|
4
|
+
&,
|
|
5
|
+
* {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
outline: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
padding: var(--mtb-body-padding, 30px);
|
|
11
|
+
background-color: var(--mtb-body-background, auto);
|
|
12
|
+
overflow-y: auto;
|
|
13
|
+
padding-bottom: var(--mtb-body-padding-button, 60px);
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { MatecuTopbarBodyComponent } from './matecu-topbar-body.component';
|
|
4
|
+
|
|
5
|
+
describe('MatecuTopbarBodyComponent', () => {
|
|
6
|
+
let component: MatecuTopbarBodyComponent;
|
|
7
|
+
let fixture: ComponentFixture<MatecuTopbarBodyComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ MatecuTopbarBodyComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(MatecuTopbarBodyComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Component, HostBinding } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'matecu-topbar-body',
|
|
5
|
+
templateUrl: './matecu-topbar-body.component.html',
|
|
6
|
+
styleUrls: ['./matecu-topbar-body.component.scss'],
|
|
7
|
+
standalone: true,
|
|
8
|
+
})
|
|
9
|
+
export class MatecuTopbarBodyComponent {
|
|
10
|
+
@HostBinding('class') className = 'matecu-topbar-body';
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
:host,
|
|
2
|
+
.matecu-topbar-fab {
|
|
3
|
+
&,
|
|
4
|
+
* {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
outline: none;
|
|
7
|
+
}
|
|
8
|
+
display: flex;
|
|
9
|
+
align-self: flex-end;
|
|
10
|
+
align-items: flex-start;
|
|
11
|
+
transform: translateY(50%);
|
|
12
|
+
transition: all 300ms ease-in-out;
|
|
13
|
+
&.mobile-style {
|
|
14
|
+
position: absolute;
|
|
15
|
+
transform: translate(0);
|
|
16
|
+
bottom: var(--mtb-fab-mobile-bottom-position, 20px);
|
|
17
|
+
right: var(--mtb-fab-mobile-right-position, 20px);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { MatecuTopbarFabComponent } from './matecu-topbar-fab.component';
|
|
4
|
+
|
|
5
|
+
describe('MatecuTopbarFabComponent', () => {
|
|
6
|
+
let component: MatecuTopbarFabComponent;
|
|
7
|
+
let fixture: ComponentFixture<MatecuTopbarFabComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ MatecuTopbarFabComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(MatecuTopbarFabComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<ng-content></ng-content>
|
package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.spec.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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 {}
|
|
@@ -0,0 +1,13 @@
|
|
|
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>
|
|
@@ -0,0 +1,34 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
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>
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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>
|