From 206169e13513b53346a814bc2401ef98310009a5 Mon Sep 17 00:00:00 2001 From: VLE2FE Date: Tue, 1 Sep 2020 14:41:15 +0200 Subject: [PATCH] added material search --- src/app/app.module.ts | 4 ++- .../documentation-models.component.html | 1 + .../documentation-models.component.scss | 0 .../documentation-models.component.spec.ts | 25 +++++++++++++++++++ .../documentation-models.component.ts | 15 +++++++++++ src/app/materials/materials.component.html | 8 +++++- src/app/materials/materials.component.scss | 12 +++++++++ src/app/materials/materials.component.ts | 5 ++++ 8 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 src/app/documentation/documentation-models/documentation-models.component.html create mode 100644 src/app/documentation/documentation-models/documentation-models.component.scss create mode 100644 src/app/documentation/documentation-models/documentation-models.component.spec.ts create mode 100644 src/app/documentation/documentation-models/documentation-models.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index a2441d2..2d04295 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -34,6 +34,7 @@ import { SizePipe } from './size.pipe'; import { DocumentationArchitectureComponent } from './documentation/documentation-architecture/documentation-architecture.component'; import { MaterialsComponent } from './materials/materials.component'; import { MaterialComponent } from './material/material.component'; +import { DocumentationModelsComponent } from './documentation/documentation-models/documentation-models.component'; @NgModule({ declarations: [ @@ -60,7 +61,8 @@ import { MaterialComponent } from './material/material.component'; SizePipe, DocumentationArchitectureComponent, MaterialsComponent, - MaterialComponent + MaterialComponent, + DocumentationModelsComponent ], imports: [ LocalStorageModule.forRoot({ diff --git a/src/app/documentation/documentation-models/documentation-models.component.html b/src/app/documentation/documentation-models/documentation-models.component.html new file mode 100644 index 0000000..3af7244 --- /dev/null +++ b/src/app/documentation/documentation-models/documentation-models.component.html @@ -0,0 +1 @@ +

documentation-models works!

diff --git a/src/app/documentation/documentation-models/documentation-models.component.scss b/src/app/documentation/documentation-models/documentation-models.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/documentation/documentation-models/documentation-models.component.spec.ts b/src/app/documentation/documentation-models/documentation-models.component.spec.ts new file mode 100644 index 0000000..d1adf71 --- /dev/null +++ b/src/app/documentation/documentation-models/documentation-models.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DocumentationModelsComponent } from './documentation-models.component'; + +describe('DocumentationModelsComponent', () => { + let component: DocumentationModelsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DocumentationModelsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DocumentationModelsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/documentation/documentation-models/documentation-models.component.ts b/src/app/documentation/documentation-models/documentation-models.component.ts new file mode 100644 index 0000000..b7f7b30 --- /dev/null +++ b/src/app/documentation/documentation-models/documentation-models.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-documentation-models', + templateUrl: './documentation-models.component.html', + styleUrls: ['./documentation-models.component.scss'] +}) +export class DocumentationModelsComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/materials/materials.component.html b/src/app/materials/materials.component.html index 0ef6e63..0aa854f 100644 --- a/src/app/materials/materials.component.html +++ b/src/app/materials/materials.component.html @@ -26,6 +26,11 @@ + + @@ -40,7 +45,8 @@ Numbers - + diff --git a/src/app/materials/materials.component.scss b/src/app/materials/materials.component.scss index 637cf7c..ceec451 100644 --- a/src/app/materials/materials.component.scss +++ b/src/app/materials/materials.component.scss @@ -49,3 +49,15 @@ float: right; } } + +.material-search { + width: 300px; + float: left; + position: relative; + + span { + position: absolute; + right: 5px; + top: 24px; + } +} diff --git a/src/app/materials/materials.component.ts b/src/app/materials/materials.component.ts index c6e692b..c7a331a 100644 --- a/src/app/materials/materials.component.ts +++ b/src/app/materials/materials.component.ts @@ -15,6 +15,7 @@ export class MaterialsComponent implements OnInit { materials: MaterialModel[] = []; templateKeys: {key: string, label: string}[] = []; materialStatus = {validated: true, new: true, deleted: false}; + materialSearch = ''; sampleSelect = false; page = 1; @@ -89,4 +90,8 @@ export class MaterialsComponent implements OnInit { return string[0].toUpperCase() + string.slice(1); } + materialFilter(ms) { + return e => e.name.indexOf(ms) >= 0; + } + }