angular-matecu 2.0.6 → 2.0.9
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 +29 -0
- package/angular-matecu.code-workspace +10 -0
- package/karma.conf.js +44 -0
- package/ng-package.json +13 -0
- package/package.json +7 -15
- package/src/lib/modules/matecu-alert-box/components/matecu-alert-box/matecu-alert-box.component.html +11 -0
- package/src/lib/modules/matecu-alert-box/components/matecu-alert-box/matecu-alert-box.component.scss +39 -0
- package/src/lib/modules/matecu-alert-box/components/matecu-alert-box/matecu-alert-box.component.spec.ts +25 -0
- package/src/lib/modules/matecu-alert-box/components/matecu-alert-box/matecu-alert-box.component.ts +56 -0
- package/src/lib/modules/matecu-alert-box/components/matecu-alert-dialog/matecu-alert-dialog.component.html +14 -0
- package/src/lib/modules/matecu-alert-box/components/matecu-alert-dialog/matecu-alert-dialog.component.scss +5 -0
- package/src/lib/modules/matecu-alert-box/components/matecu-alert-dialog/matecu-alert-dialog.component.spec.ts +25 -0
- package/src/lib/modules/matecu-alert-box/components/matecu-alert-dialog/matecu-alert-dialog.component.ts +47 -0
- package/src/lib/modules/matecu-alert-box/matecu-alert-box.module.ts +17 -0
- package/src/lib/modules/matecu-alert-box/matecu-alert-snack-bar/matecu-alert-snack-bar.component.css +0 -0
- package/src/lib/modules/matecu-alert-box/matecu-alert-snack-bar/matecu-alert-snack-bar.component.html +1 -0
- package/src/lib/modules/matecu-alert-box/matecu-alert-snack-bar/matecu-alert-snack-bar.component.spec.ts +25 -0
- package/src/lib/modules/matecu-alert-box/matecu-alert-snack-bar/matecu-alert-snack-bar.component.ts +15 -0
- package/src/lib/modules/matecu-alert-box/matecu-snack-bar-alert/matecu-snack-bar-alert.component.html +8 -0
- package/src/lib/modules/matecu-alert-box/matecu-snack-bar-alert/matecu-snack-bar-alert.component.scss +34 -0
- package/src/lib/modules/matecu-alert-box/matecu-snack-bar-alert/matecu-snack-bar-alert.component.spec.ts +25 -0
- package/src/lib/modules/matecu-alert-box/matecu-snack-bar-alert/matecu-snack-bar-alert.component.ts +41 -0
- package/src/lib/modules/matecu-alert-box/services/matecu-snack-bar.service.spec.ts +16 -0
- package/src/lib/modules/matecu-alert-box/services/matecu-snack-bar.service.ts +66 -0
- package/src/lib/modules/matecu-alert-box/types/matecu-alert-dialog.ts +10 -0
- package/src/lib/modules/matecu-alert-box/types/matecu-alert-snackbar.ts +8 -0
- package/src/lib/modules/matecu-alert-box/types/matecu-altert-box-type.ts +6 -0
- package/src/lib/modules/matecu-spinner/components/matecu-spinner/matecu-spinner.component.css +15 -0
- package/src/lib/modules/matecu-spinner/components/matecu-spinner/matecu-spinner.component.html +35 -0
- package/src/lib/modules/matecu-spinner/components/matecu-spinner/matecu-spinner.component.spec.ts +25 -0
- package/src/lib/modules/matecu-spinner/components/matecu-spinner/matecu-spinner.component.ts +47 -0
- package/src/lib/modules/matecu-spinner/components/matecu-spinner/spinner-loader.component.scss +13 -0
- package/src/lib/modules/matecu-spinner/matecu-spinner.module.ts +17 -0
- package/src/lib/modules/matecu-spinner/services/matecu-spinner.service.spec.ts +16 -0
- package/src/lib/modules/matecu-spinner/services/matecu-spinner.service.ts +40 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-actions/matecu-topbar-actions.component.html +1 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-actions/matecu-topbar-actions.component.scss +8 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-actions/matecu-topbar-actions.component.spec.ts +25 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-actions/matecu-topbar-actions.component.ts +12 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-body/matecu-topbar-body.component.html +1 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-body/matecu-topbar-body.component.scss +9 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-body/matecu-topbar-body.component.spec.ts +25 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-body/matecu-topbar-body.component.ts +23 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-fab/matecu-topbar-fab.component.html +3 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-fab/matecu-topbar-fab.component.scss +26 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-fab/matecu-topbar-fab.component.spec.ts +25 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-fab/matecu-topbar-fab.component.ts +27 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-layout/matecu-topbar-layout.component.html +23 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-layout/matecu-topbar-layout.component.scss +48 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-layout/matecu-topbar-layout.component.spec.ts +25 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-layout/matecu-topbar-layout.component.ts +93 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-search/matecu-topbar-search.component.html +12 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-search/matecu-topbar-search.component.scss +101 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-search/matecu-topbar-search.component.spec.ts +25 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-search/matecu-topbar-search.component.ts +79 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-title/matecu-topbar-title.component.html +1 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-title/matecu-topbar-title.component.scss +13 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-title/matecu-topbar-title.component.spec.ts +25 -0
- package/src/lib/modules/matecu-topbar-layout/components/matecu-topbar-title/matecu-topbar-title.component.ts +16 -0
- package/src/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.ts +40 -0
- package/src/lib/modules/matecu-topbar-layout/scss/variables.scss +2 -0
- package/{public-api.d.ts → src/public-api.ts} +8 -0
- package/src/test.ts +28 -0
- package/tsconfig.lib.json +25 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/tslint.json +17 -0
- package/angular-matecu.d.ts +0 -5
- package/bundles/angular-matecu.umd.js +0 -681
- package/bundles/angular-matecu.umd.js.map +0 -1
- package/esm2015/angular-matecu.js +0 -5
- package/esm2015/lib/modules/matecu-alert-box/components/matecu-alert-box/matecu-alert-box.component.js +0 -69
- package/esm2015/lib/modules/matecu-alert-box/components/matecu-alert-dialog/matecu-alert-dialog.component.js +0 -55
- package/esm2015/lib/modules/matecu-alert-box/matecu-alert-box.module.js +0 -23
- package/esm2015/lib/modules/matecu-alert-box/types/matecu-alert-dialog.js +0 -2
- package/esm2015/lib/modules/matecu-alert-box/types/matecu-altert-box-type.js +0 -8
- package/esm2015/lib/modules/matecu-spinner/components/matecu-spinner/matecu-spinner.component.js +0 -61
- package/esm2015/lib/modules/matecu-spinner/matecu-spinner.module.js +0 -24
- package/esm2015/lib/modules/matecu-spinner/services/matecu-spinner.service.js +0 -44
- package/esm2015/lib/modules/matecu-topbar-layout/components/matecu-topbar-actions/matecu-topbar-actions.component.js +0 -17
- package/esm2015/lib/modules/matecu-topbar-layout/components/matecu-topbar-body/matecu-topbar-body.component.js +0 -32
- package/esm2015/lib/modules/matecu-topbar-layout/components/matecu-topbar-fab/matecu-topbar-fab.component.js +0 -36
- package/esm2015/lib/modules/matecu-topbar-layout/components/matecu-topbar-layout/matecu-topbar-layout.component.js +0 -103
- package/esm2015/lib/modules/matecu-topbar-layout/components/matecu-topbar-search/matecu-topbar-search.component.js +0 -85
- package/esm2015/lib/modules/matecu-topbar-layout/components/matecu-topbar-title/matecu-topbar-title.component.js +0 -23
- package/esm2015/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.js +0 -70
- package/esm2015/public-api.js +0 -28
- package/fesm2015/angular-matecu.js +0 -603
- package/fesm2015/angular-matecu.js.map +0 -1
- package/lib/modules/matecu-alert-box/components/matecu-alert-box/matecu-alert-box.component.d.ts +0 -19
- package/lib/modules/matecu-alert-box/components/matecu-alert-dialog/matecu-alert-dialog.component.d.ts +0 -22
- package/lib/modules/matecu-alert-box/matecu-alert-box.module.d.ts +0 -12
- package/lib/modules/matecu-alert-box/types/matecu-alert-dialog.d.ts +0 -9
- package/lib/modules/matecu-alert-box/types/matecu-altert-box-type.d.ts +0 -6
- package/lib/modules/matecu-spinner/components/matecu-spinner/matecu-spinner.component.d.ts +0 -20
- package/lib/modules/matecu-spinner/matecu-spinner.module.d.ts +0 -8
- package/lib/modules/matecu-spinner/services/matecu-spinner.service.d.ts +0 -15
- package/lib/modules/matecu-topbar-layout/components/matecu-topbar-actions/matecu-topbar-actions.component.d.ts +0 -8
- package/lib/modules/matecu-topbar-layout/components/matecu-topbar-body/matecu-topbar-body.component.d.ts +0 -11
- package/lib/modules/matecu-topbar-layout/components/matecu-topbar-fab/matecu-topbar-fab.component.d.ts +0 -13
- package/lib/modules/matecu-topbar-layout/components/matecu-topbar-layout/matecu-topbar-layout.component.d.ts +0 -30
- package/lib/modules/matecu-topbar-layout/components/matecu-topbar-search/matecu-topbar-search.component.d.ts +0 -26
- package/lib/modules/matecu-topbar-layout/components/matecu-topbar-title/matecu-topbar-title.component.d.ts +0 -9
- package/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.d.ts +0 -17
package/src/lib/modules/matecu-spinner/components/matecu-spinner/matecu-spinner.component.html
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<ng-container *ngIf="active">
|
|
2
|
+
<svg xmlns:svg="http://www.w3.org/2000/svg" [attr.width]="size" [attr.height]="size"
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" viewBox="0 0 128 128" xml:space="preserve">
|
|
4
|
+
<rect x="0" y="0" width="100%" height="100%" fill="transparent" />
|
|
5
|
+
<g>
|
|
6
|
+
<path class="matecu-spinner__100" d="M122.5 69.25H96.47a33.1 33.1 0 0 0 0-10.5h26.05a5.25 5.25 0 0 1 0 10.5z" [attr.fill]="color"
|
|
7
|
+
fill-opacity="1" />
|
|
8
|
+
<path class="matecu-spinner__30" d="M112.04 97.83L89.47 84.8a33.1 33.1 0 0 0 5.25-9.1l22.57 13.03a5.25 5.25 0 0 1-5.28 9.1z" [attr.fill]="color"
|
|
9
|
+
fill-opacity="0.3" />
|
|
10
|
+
<path class="matecu-spinner__30" d="M88.68 117.35L75.65 94.78a33.1 33.1 0 0 0 9.1-5.25l13.02 22.57a5.25 5.25 0 1 1-9.1 5.25z"
|
|
11
|
+
[attr.fill]="color" fill-opacity="0.3" />
|
|
12
|
+
<path class="matecu-spinner__30" d="M58.7 122.57V96.5a33.1 33.1 0 0 0 10.5 0v26.07a5.25 5.25 0 0 1-10.5 0z" [attr.fill]="color"
|
|
13
|
+
fill-opacity="0.3" />
|
|
14
|
+
<path class="matecu-spinner__30" d="M30.1 112.1l13.04-22.57a33.1 33.1 0 0 0 9.1 5.25L39.2 117.35a5.25 5.25 0 1 1-9.1-5.25z" [attr.fill]="color"
|
|
15
|
+
fill-opacity="0.3" />
|
|
16
|
+
<path class="matecu-spinner__30" d="M10.6 88.74L33.16 75.7a33.1 33.1 0 0 0 5.25 9.1L15.88 97.83a5.25 5.25 0 1 1-5.25-9.1z" [attr.fill]="color"
|
|
17
|
+
fill-opacity="0.3" />
|
|
18
|
+
<path class="matecu-spinner__40" d="M5.37 58.75h26.06a33.1 33.1 0 0 0 0 10.5H5.37a5.25 5.25 0 0 1 0-10.5z" [attr.fill]="color"
|
|
19
|
+
fill-opacity="0.4" />
|
|
20
|
+
<path class="matecu-spinner__50" d="M15.85 30.17L38.4 43.2a33.1 33.1 0 0 0-5.24 9.1L10.6 39.25a5.25 5.25 0 1 1 5.25-9.1z" [attr.fill]="color"
|
|
21
|
+
fill-opacity="0.5" />
|
|
22
|
+
<path class="matecu-spinner__60" d="M39.2 10.65l13.03 22.57a33.1 33.1 0 0 0-9.1 5.25l-13-22.57a5.25 5.25 0 1 1 9.1-5.25z" [attr.fill]="color"
|
|
23
|
+
fill-opacity="0.6" />
|
|
24
|
+
<path class="matecu-spinner__70" d="M69.2 5.43V31.5a33.1 33.1 0 0 0-10.5 0V5.42a5.25 5.25 0 1 1 10.5 0z" [attr.fill]="color"
|
|
25
|
+
fill-opacity="0.7" />
|
|
26
|
+
<path class="matecu-spinner__80" d="M97.77 15.9L84.75 38.47a33.1 33.1 0 0 0-9.1-5.25l13.03-22.57a5.25 5.25 0 1 1 9.1 5.25z" [attr.fill]="color"
|
|
27
|
+
fill-opacity="0.8" />
|
|
28
|
+
<path class="matecu-spinner__90" d="M117.3 39.26L94.7 52.3a33.1 33.1 0 0 0-5.25-9.1l22.57-13.03a5.25 5.25 0 0 1 5.25 9.1z" [attr.fill]="color"
|
|
29
|
+
fill-opacity="0.9" />
|
|
30
|
+
<animateTransform attributeName="transform" type="rotate"
|
|
31
|
+
values="0 64 64;30 64 64;60 64 64;90 64 64;120 64 64;150 64 64;180 64 64;210 64 64;240 64 64;270 64 64;300 64 64;330 64 64"
|
|
32
|
+
calcMode="discrete" dur="600ms" repeatCount="indefinite"></animateTransform>
|
|
33
|
+
</g>
|
|
34
|
+
</svg>
|
|
35
|
+
</ng-container>
|
package/src/lib/modules/matecu-spinner/components/matecu-spinner/matecu-spinner.component.spec.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { MatecuSpinnerComponent } from './matecu-spinner.component';
|
|
4
|
+
|
|
5
|
+
describe('MatecuSpinnerComponent', () => {
|
|
6
|
+
let component: MatecuSpinnerComponent;
|
|
7
|
+
let fixture: ComponentFixture<MatecuSpinnerComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ MatecuSpinnerComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(MatecuSpinnerComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Component, HostBinding, Input, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
import { MatecuSpinnerService } from '../../services/matecu-spinner.service';
|
|
4
|
+
import { takeUntil, tap } from 'rxjs/operators';
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'matecu-spinner',
|
|
7
|
+
templateUrl: './matecu-spinner.component.html',
|
|
8
|
+
styleUrls: ['./matecu-spinner.component.css']
|
|
9
|
+
})
|
|
10
|
+
export class MatecuSpinnerComponent implements OnInit, OnDestroy {
|
|
11
|
+
|
|
12
|
+
private destroy$ = new Subject();
|
|
13
|
+
private hiddenClass = 'matecu-spinner--hidden';
|
|
14
|
+
private activeCache = false;
|
|
15
|
+
@HostBinding('class') className = 'matecu-spinner';
|
|
16
|
+
@Input() color = '#2196F3';
|
|
17
|
+
@Input() global = false;
|
|
18
|
+
get active(): boolean{
|
|
19
|
+
return this.activeCache;
|
|
20
|
+
}
|
|
21
|
+
@Input() set active(value: boolean) {
|
|
22
|
+
if (this.global) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this.activeCache = value;
|
|
26
|
+
this.className = value
|
|
27
|
+
? this.className.replace(` ${this.hiddenClass}`, '')
|
|
28
|
+
: (this.className += ` ${this.hiddenClass}`);
|
|
29
|
+
}
|
|
30
|
+
@Input() size = '70px';
|
|
31
|
+
|
|
32
|
+
constructor(
|
|
33
|
+
private spinnerService: MatecuSpinnerService,
|
|
34
|
+
) {}
|
|
35
|
+
ngOnDestroy(): void {
|
|
36
|
+
this.destroy$.next();
|
|
37
|
+
this.destroy$.complete();
|
|
38
|
+
}
|
|
39
|
+
ngOnInit(): void {
|
|
40
|
+
if (this.global) {
|
|
41
|
+
this.spinnerService.watch().pipe(
|
|
42
|
+
tap(value => this.activeCache = value),
|
|
43
|
+
takeUntil(this.destroy$)
|
|
44
|
+
).subscribe();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { MatecuSpinnerComponent } from './components/matecu-spinner/matecu-spinner.component';
|
|
4
|
+
import { MatecuSpinnerService } from './services/matecu-spinner.service';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@NgModule({
|
|
9
|
+
declarations: [MatecuSpinnerComponent],
|
|
10
|
+
imports: [
|
|
11
|
+
CommonModule
|
|
12
|
+
],
|
|
13
|
+
exports: [
|
|
14
|
+
MatecuSpinnerComponent
|
|
15
|
+
]
|
|
16
|
+
})
|
|
17
|
+
export class MatecuSpinnerModule { }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { MatecuSpinnerService } from './matecu-spinner.service';
|
|
4
|
+
|
|
5
|
+
describe('MatecuSpinnerService', () => {
|
|
6
|
+
let service: MatecuSpinnerService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(MatecuSpinnerService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root',
|
|
6
|
+
})
|
|
7
|
+
export class MatecuSpinnerService {
|
|
8
|
+
private active$ = new BehaviorSubject<boolean>(false);
|
|
9
|
+
private requestsKeys: string[] = [];
|
|
10
|
+
constructor() {}
|
|
11
|
+
|
|
12
|
+
watch(): Observable<boolean> {
|
|
13
|
+
return this.active$.pipe();
|
|
14
|
+
}
|
|
15
|
+
add(customKey?: string): string {
|
|
16
|
+
const key = (typeof(customKey) === 'string' && customKey.length > 0) ? customKey : this.createKey();
|
|
17
|
+
this.requestsKeys.push(key);
|
|
18
|
+
this.updateStatus();
|
|
19
|
+
return key;
|
|
20
|
+
}
|
|
21
|
+
remove(key: string): void {
|
|
22
|
+
this.requestsKeys = this.requestsKeys.filter(
|
|
23
|
+
(requestKey) => requestKey !== key
|
|
24
|
+
);
|
|
25
|
+
this.updateStatus();
|
|
26
|
+
}
|
|
27
|
+
clear(): void {
|
|
28
|
+
this.requestsKeys = [];
|
|
29
|
+
this.updateStatus();
|
|
30
|
+
}
|
|
31
|
+
private updateStatus(): void {
|
|
32
|
+
const active = this.requestsKeys.length > 0;
|
|
33
|
+
this.active$.next(active);
|
|
34
|
+
}
|
|
35
|
+
private createKey(): string {
|
|
36
|
+
const time = new Date().getTime();
|
|
37
|
+
const complement = Math.random();
|
|
38
|
+
return `${time}__${complement}`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<ng-content></ng-content>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { MatecuTopbarActionsComponent } from './matecu-topbar-actions.component';
|
|
4
|
+
|
|
5
|
+
describe('MatecuTopbarActionsComponent', () => {
|
|
6
|
+
let component: MatecuTopbarActionsComponent;
|
|
7
|
+
let fixture: ComponentFixture<MatecuTopbarActionsComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ MatecuTopbarActionsComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(MatecuTopbarActionsComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'matecu-topbar-actions',
|
|
5
|
+
templateUrl: './matecu-topbar-actions.component.html',
|
|
6
|
+
styleUrls: ['./matecu-topbar-actions.component.scss'],
|
|
7
|
+
})
|
|
8
|
+
export class MatecuTopbarActionsComponent implements OnInit {
|
|
9
|
+
constructor() {}
|
|
10
|
+
|
|
11
|
+
ngOnInit(): void {}
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<ng-content></ng-content>
|
|
@@ -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,23 @@
|
|
|
1
|
+
import { Component, ElementRef, HostBinding, OnInit } 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
|
+
})
|
|
8
|
+
export class MatecuTopbarBodyComponent implements OnInit {
|
|
9
|
+
@HostBinding('class') className = 'matecu-topbar-body';
|
|
10
|
+
constructor(private elementRef: ElementRef) {}
|
|
11
|
+
|
|
12
|
+
ngOnInit(): void {}
|
|
13
|
+
|
|
14
|
+
scrollTop(): void {
|
|
15
|
+
const element = this.elementRef.nativeElement;
|
|
16
|
+
if (!!element) {
|
|
17
|
+
element.scroll({
|
|
18
|
+
top: 0,
|
|
19
|
+
behavior: 'smooth',
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: flex-end;
|
|
4
|
+
height: 100%;
|
|
5
|
+
position: relative;
|
|
6
|
+
z-index: 2;
|
|
7
|
+
button {
|
|
8
|
+
transform: translateY(50%);
|
|
9
|
+
&.extended {
|
|
10
|
+
border-radius: 27px;
|
|
11
|
+
height: 55px;
|
|
12
|
+
width: auto;
|
|
13
|
+
padding: 0 1rem !important;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
@media screen and (max-width: 768px) {
|
|
17
|
+
height: auto;
|
|
18
|
+
position: fixed;
|
|
19
|
+
bottom: 1rem;
|
|
20
|
+
right: 1rem;
|
|
21
|
+
transform: initial;
|
|
22
|
+
button {
|
|
23
|
+
transform: translateY(0);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -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,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
EventEmitter,
|
|
4
|
+
HostBinding,
|
|
5
|
+
Input,
|
|
6
|
+
OnInit,
|
|
7
|
+
Output,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: 'matecu-topbar-fab',
|
|
12
|
+
templateUrl: './matecu-topbar-fab.component.html',
|
|
13
|
+
styleUrls: ['./matecu-topbar-fab.component.scss'],
|
|
14
|
+
})
|
|
15
|
+
export class MatecuTopbarFabComponent implements OnInit {
|
|
16
|
+
@Input() color = 'accent';
|
|
17
|
+
@Input() extended = false;
|
|
18
|
+
@Output() clickAction = new EventEmitter<void>();
|
|
19
|
+
constructor() {}
|
|
20
|
+
|
|
21
|
+
@HostBinding('class') className = 'matecu-topbar-fab';
|
|
22
|
+
ngOnInit(): void {}
|
|
23
|
+
|
|
24
|
+
onClickAction(): void {
|
|
25
|
+
this.clickAction.emit();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<mat-toolbar [color]="color">
|
|
2
|
+
<ng-container *ngIf="navMenu">
|
|
3
|
+
<div class="matecu-topbar-layout__menu-btn">
|
|
4
|
+
<button mat-icon-button type="button" (click)="onClickNavMenu()">
|
|
5
|
+
<mat-icon>menu</mat-icon>
|
|
6
|
+
</button>
|
|
7
|
+
</div>
|
|
8
|
+
</ng-container>
|
|
9
|
+
<ng-content select="matecu-topbar-fab"></ng-content>
|
|
10
|
+
<ng-content select="matecu-topbar-title"></ng-content>
|
|
11
|
+
<ng-content select="matecu-topbar-search"></ng-content>
|
|
12
|
+
<ng-content select="matecu-topbar-actions"></ng-content>
|
|
13
|
+
<ng-container *ngIf="actionMenu">
|
|
14
|
+
<div class="matecu-topbar-layout__more-actions-btn">
|
|
15
|
+
<button type="button" (click)="onClickActionMenu()" mat-icon-button>
|
|
16
|
+
<mat-icon>more_vert</mat-icon>
|
|
17
|
+
</button>
|
|
18
|
+
</div>
|
|
19
|
+
</ng-container>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</mat-toolbar>
|
|
23
|
+
<ng-content select="matecu-topbar-body"></ng-content>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@import '../../scss/variables.scss';
|
|
2
|
+
:host,
|
|
3
|
+
.matecu-topbar-layout {
|
|
4
|
+
display: grid;
|
|
5
|
+
height: 100vh;
|
|
6
|
+
max-width: 100vw;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
grid-template-rows: auto 1fr;
|
|
9
|
+
position: relative;
|
|
10
|
+
&,
|
|
11
|
+
* {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
// overflow: hidden;
|
|
15
|
+
mat-toolbar {
|
|
16
|
+
position: relative;
|
|
17
|
+
height: $toolbar-height;
|
|
18
|
+
max-height: $toolbar-height;
|
|
19
|
+
|
|
20
|
+
transition: all 300ms;
|
|
21
|
+
align-items: flex-start;
|
|
22
|
+
}
|
|
23
|
+
&__menu-btn,
|
|
24
|
+
&__more-actions-btn {
|
|
25
|
+
min-height: $toolbar-height;
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
}
|
|
29
|
+
&__menu-btn {
|
|
30
|
+
@media screen and (max-width: 425px) {
|
|
31
|
+
margin-right: auto;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
:host.matecu-topbar-layout--prominent {
|
|
36
|
+
.mat-toolbar {
|
|
37
|
+
height: $toolbar-prominent-height;
|
|
38
|
+
max-height: $toolbar-prominent-height;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
:host.matecu-topbar-layout--scrolling {
|
|
42
|
+
.mat-toolbar {
|
|
43
|
+
height: $toolbar-height;
|
|
44
|
+
max-height: $toolbar-height;
|
|
45
|
+
box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.2),
|
|
46
|
+
0px 6px 10px 0px rgba(0, 0, 0, 0.14), 0px 1px 18px 0px rgba(0, 0, 0, 0.12);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -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,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AfterViewInit,
|
|
3
|
+
Component,
|
|
4
|
+
ElementRef,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
HostBinding,
|
|
7
|
+
Input,
|
|
8
|
+
OnInit,
|
|
9
|
+
Output,
|
|
10
|
+
ViewChild,
|
|
11
|
+
} from '@angular/core';
|
|
12
|
+
import { FormControl } from '@angular/forms';
|
|
13
|
+
import { ParamMap } from '@angular/router';
|
|
14
|
+
import { fromEvent, Observable, of } from 'rxjs';
|
|
15
|
+
import { map, tap } from 'rxjs/operators';
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'matecu-topbar-layout',
|
|
18
|
+
templateUrl: './matecu-topbar-layout.component.html',
|
|
19
|
+
styleUrls: ['./matecu-topbar-layout.component.scss'],
|
|
20
|
+
})
|
|
21
|
+
export class MatecuTopbarLayoutComponent implements AfterViewInit {
|
|
22
|
+
@HostBinding('class') className = 'matecu-topbar-layout';
|
|
23
|
+
showSearchInput = false;
|
|
24
|
+
search = false;
|
|
25
|
+
searchInput: FormControl = new FormControl();
|
|
26
|
+
isProminent = false;
|
|
27
|
+
private scrollingClass = 'matecu-topbar-layout--scrolling';
|
|
28
|
+
private prominentClass = 'matecu-topbar-layout--prominent';
|
|
29
|
+
@Input() color = 'primary';
|
|
30
|
+
@Input() navMenu = true;
|
|
31
|
+
@Input() actionMenu = false;
|
|
32
|
+
@Output() clickNavMenu = new EventEmitter<void>();
|
|
33
|
+
@Output() clickActionMenu = new EventEmitter<void>();
|
|
34
|
+
@Input() set prominent(value: boolean) {
|
|
35
|
+
this.isProminent = value;
|
|
36
|
+
if (value) {
|
|
37
|
+
this.className += ' ' + this.prominentClass;
|
|
38
|
+
} else {
|
|
39
|
+
const regex = new RegExp(this.prominentClass, 'ig');
|
|
40
|
+
this.className = this.className.replace(regex, '').trim();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
constructor() {}
|
|
44
|
+
|
|
45
|
+
ngAfterViewInit(): void {
|
|
46
|
+
this.spyScroll().subscribe();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
toogleSearch(): void {
|
|
50
|
+
this.showSearchInput = !this.showSearchInput;
|
|
51
|
+
}
|
|
52
|
+
closeSearch(): void {
|
|
53
|
+
this.showSearchInput = false;
|
|
54
|
+
this.searchInput.reset();
|
|
55
|
+
}
|
|
56
|
+
onMenuClick(): void {}
|
|
57
|
+
onClickNavMenu(): void {
|
|
58
|
+
this.clickNavMenu.emit();
|
|
59
|
+
}
|
|
60
|
+
onClickActionMenu(): void {
|
|
61
|
+
this.clickActionMenu.emit();
|
|
62
|
+
}
|
|
63
|
+
spyScroll(): Observable<HTMLElement | null> {
|
|
64
|
+
const scrollabe: HTMLElement | null = document.querySelector(
|
|
65
|
+
'.matecu-topbar-body'
|
|
66
|
+
);
|
|
67
|
+
if (!scrollabe) {
|
|
68
|
+
return of(null);
|
|
69
|
+
}
|
|
70
|
+
return fromEvent(scrollabe, 'scroll').pipe(
|
|
71
|
+
tap(() => this.applyScrollStyles(scrollabe)),
|
|
72
|
+
map(() => scrollabe)
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
applyScrollStyles(scrollabe: HTMLElement): void {
|
|
76
|
+
if (!scrollabe) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const maxScrollHeight = scrollabe.scrollHeight;
|
|
80
|
+
const screenHeight = screen.availHeight;
|
|
81
|
+
if (screenHeight > maxScrollHeight) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const scrollPosition = scrollabe.scrollTop;
|
|
85
|
+
if (scrollPosition > 20) {
|
|
86
|
+
this.className += ' ' + this.scrollingClass;
|
|
87
|
+
}
|
|
88
|
+
if (scrollPosition < 10) {
|
|
89
|
+
const regexp = new RegExp(this.scrollingClass, 'ig');
|
|
90
|
+
this.className = this.className.replace(regexp, '').trim();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<button mat-icon-button class="only-mobile" (click)="toogleSearch()">
|
|
2
|
+
<mat-icon>search</mat-icon>
|
|
3
|
+
</button>
|
|
4
|
+
|
|
5
|
+
<div class="matecu-topbar-search__input" [ngClass]="{'mobile-input-active': showMobileInput}">
|
|
6
|
+
<mat-icon>search</mat-icon>
|
|
7
|
+
<input [type]="inputType" [formControl]="searchInput" [placeholder]="searchPlaceholder" />
|
|
8
|
+
<button mat-icon-button (click)="closeMobile()" [ngClass]="{'show-btn': showDescktopCleanBtn}">
|
|
9
|
+
<mat-icon>close</mat-icon>
|
|
10
|
+
</button>
|
|
11
|
+
|
|
12
|
+
</div>
|