mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2026-04-23 00:19:14 +00:00
mail..
This commit is contained in:
@@ -3,16 +3,4 @@
|
||||
#main-navigation {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
.nav-item {
|
||||
|
||||
.nav-link {
|
||||
background-color: map-get($background, raised-button);
|
||||
color: map_get($foreground, text);
|
||||
|
||||
&:hover {
|
||||
background-color: map-get($background, hover);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {MaterialModule} from './material.module';
|
||||
import {FlexLayoutModule} from '@angular/flex-layout';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { MaterialModule } from './material.module';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
|
||||
|
||||
import {
|
||||
FuseMdSidenavHelperDirective,
|
||||
FuseMdSidenavTogglerDirective
|
||||
} from '../directives/md-sidenav-helper/md-sidenav-helper.directive';
|
||||
import {PerfectScrollbarModule} from 'ngx-perfect-scrollbar';
|
||||
import {KeysPipe} from '../pipes/keys';
|
||||
import {HtmlToPlaintextPipe} from '../pipes//htmlToPlaintext';
|
||||
import { FusePipesModule } from '../pipes/pipes.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
FuseMdSidenavHelperDirective,
|
||||
FuseMdSidenavTogglerDirective,
|
||||
KeysPipe,
|
||||
HtmlToPlaintextPipe
|
||||
FuseMdSidenavTogglerDirective
|
||||
],
|
||||
imports : [
|
||||
FlexLayoutModule,
|
||||
MaterialModule,
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
FusePipesModule,
|
||||
PerfectScrollbarModule
|
||||
],
|
||||
exports : [
|
||||
@@ -32,9 +32,8 @@ import {HtmlToPlaintextPipe} from '../pipes//htmlToPlaintext';
|
||||
FormsModule,
|
||||
FuseMdSidenavHelperDirective,
|
||||
FuseMdSidenavTogglerDirective,
|
||||
PerfectScrollbarModule,
|
||||
KeysPipe,
|
||||
HtmlToPlaintextPipe
|
||||
FusePipesModule,
|
||||
PerfectScrollbarModule
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
22
src/app/core/pipes/getById.pipe.ts
Normal file
22
src/app/core/pipes/getById.pipe.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({name: 'getById'})
|
||||
export class GetByIdPipe implements PipeTransform
|
||||
{
|
||||
transform(value: any[], id: number, property: string ): any
|
||||
{
|
||||
const foundItem = value.find(item => {
|
||||
if ( item.id )
|
||||
{
|
||||
return item.id === id;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
if ( foundItem )
|
||||
{
|
||||
return foundItem[property];
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/app/core/pipes/keys.pipe.ts
Normal file
23
src/app/core/pipes/keys.pipe.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({name: 'keys'})
|
||||
export class KeysPipe implements PipeTransform
|
||||
{
|
||||
transform(value: any, args: string[]): any
|
||||
{
|
||||
const keys: any[] = [];
|
||||
|
||||
for ( const key in value )
|
||||
{
|
||||
if ( value.hasOwnProperty(key) )
|
||||
{
|
||||
keys.push({
|
||||
key : key,
|
||||
value: value[key]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
import {Pipe, PipeTransform} from '@angular/core';
|
||||
|
||||
@Pipe({name: 'keys'})
|
||||
export class KeysPipe implements PipeTransform
|
||||
{
|
||||
transform(value: any, args: string[]): any
|
||||
{
|
||||
let keys: any[] = [];
|
||||
for ( let key in value )
|
||||
{
|
||||
keys.push({key: key, value: value[key]});
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
}
|
||||
27
src/app/core/pipes/pipes.module.ts
Normal file
27
src/app/core/pipes/pipes.module.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { KeysPipe } from './keys.pipe';
|
||||
import { GetByIdPipe } from './getById.pipe';
|
||||
import { HtmlToPlaintextPipe } from './htmlToPlaintext.pipe';
|
||||
import { SearchPipe } from './search.pipe';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
KeysPipe,
|
||||
GetByIdPipe,
|
||||
HtmlToPlaintextPipe,
|
||||
SearchPipe
|
||||
],
|
||||
imports : [],
|
||||
exports : [
|
||||
KeysPipe,
|
||||
GetByIdPipe,
|
||||
HtmlToPlaintextPipe,
|
||||
SearchPipe
|
||||
]
|
||||
})
|
||||
|
||||
export class FusePipesModule
|
||||
{
|
||||
|
||||
}
|
||||
49
src/app/core/pipes/search.pipe.ts
Normal file
49
src/app/core/pipes/search.pipe.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'filter'
|
||||
})
|
||||
export class SearchPipe implements PipeTransform
|
||||
{
|
||||
transform(items: any, term: string): any
|
||||
{
|
||||
if ( term === undefined )
|
||||
{
|
||||
return items;
|
||||
}
|
||||
|
||||
return this.filter(items, term);
|
||||
}
|
||||
|
||||
filter(items: any, term: string)
|
||||
{
|
||||
return items.filter(item => {
|
||||
|
||||
for ( const property in item )
|
||||
{
|
||||
if ( !item.hasOwnProperty(property) || !item[property] )
|
||||
{
|
||||
console.log('continueing...');
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( Array.isArray(item[property]) )
|
||||
{
|
||||
console.log('is Array');
|
||||
return this.filter(item[property], term);
|
||||
}
|
||||
|
||||
if ( item[property].toString().toLowerCase().includes(term.toLowerCase()) )
|
||||
{
|
||||
console.log('found!');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user