mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-10 04:25:08 +00:00
Navigation interface
This commit is contained in:
parent
a29c4b01ad
commit
f693298f3a
|
@ -6,21 +6,37 @@
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- item.url -->
|
<!-- item.url -->
|
||||||
<a class="nav-link" *ngIf="item.url && !item.function" (click)="toggleOpen($event)"
|
<a class="nav-link" *ngIf="item.url && !item.externalUrl && !item.function" (click)="toggleOpen($event)"
|
||||||
|
[routerLink]="[item.url]" routerLinkActive="active"
|
||||||
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}"
|
||||||
|
[target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.externalUrl -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && item.externalUrl && !item.function" (click)="toggleOpen($event)"
|
||||||
|
[href]="item.url" [target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.function -->
|
||||||
|
<span class="nav-link" *ngIf="!item.url && item.function"
|
||||||
|
(click)="toggleOpen($event);item.function()" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<!-- item.url && item.function -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && !item.externalUrl && item.function"
|
||||||
|
(click)="toggleOpen($event);item.function()"
|
||||||
[routerLink]="[item.url]" routerLinkActive="active"
|
[routerLink]="[item.url]" routerLinkActive="active"
|
||||||
[routerLinkActiveOptions]="{exact: item.exactMatch || false}" matRipple>
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}" matRipple>
|
||||||
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- item.function -->
|
<!-- item.externalUrl && item.function -->
|
||||||
<span class="nav-link" *ngIf="!item.url && item.function" (click)="toggleOpen($event);item.function()" matRipple>
|
<a class="nav-link" *ngIf="item.url && item.externalUrl && item.function"
|
||||||
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
(click)="toggleOpen($event);item.function()"
|
||||||
</span>
|
[href]="item.url" [target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
|
|
||||||
<!-- item.url && item.function -->
|
|
||||||
<a class="nav-link" *ngIf="item.url && item.function" (click)="toggleOpen($event);item.function()"
|
|
||||||
[routerLink]="[item.url]" routerLinkActive="active"
|
|
||||||
[routerLinkActiveOptions]="{exact: item.exactMatch || false}" matRipple>
|
|
||||||
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,9 @@ import { NavigationEnd, Router } from '@angular/router';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { filter, takeUntil } from 'rxjs/operators';
|
import { filter, takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
import { FuseNavigationService } from '../../navigation.service';
|
import { FuseNavigationItem } from '@fuse/types';
|
||||||
import { fuseAnimations } from '@fuse/animations';
|
import { fuseAnimations } from '@fuse/animations';
|
||||||
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-nav-vertical-collapse',
|
selector : 'fuse-nav-vertical-collapse',
|
||||||
|
@ -15,7 +16,7 @@ import { fuseAnimations } from '@fuse/animations';
|
||||||
export class FuseNavVerticalCollapseComponent implements OnInit, OnDestroy
|
export class FuseNavVerticalCollapseComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@Input()
|
@Input()
|
||||||
item: any;
|
item: FuseNavigationItem;
|
||||||
|
|
||||||
@HostBinding('class')
|
@HostBinding('class')
|
||||||
classes = 'nav-collapse nav-item';
|
classes = 'nav-collapse nav-item';
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { Component, HostBinding, Input } from '@angular/core';
|
import { Component, HostBinding, Input } from '@angular/core';
|
||||||
|
|
||||||
|
import { FuseNavigationItem } from '@fuse/types';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-nav-vertical-group',
|
selector : 'fuse-nav-vertical-group',
|
||||||
templateUrl: './nav-vertical-group.component.html',
|
templateUrl: './nav-vertical-group.component.html',
|
||||||
|
@ -11,7 +13,7 @@ export class FuseNavVerticalGroupComponent
|
||||||
classes = 'nav-group nav-item';
|
classes = 'nav-group nav-item';
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
item: any;
|
item: FuseNavigationItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|
|
@ -1,21 +1,36 @@
|
||||||
<ng-container *ngIf="!item.hidden">
|
<ng-container *ngIf="!item.hidden">
|
||||||
|
|
||||||
<!-- item.url -->
|
<!-- item.url -->
|
||||||
<a class="nav-link" *ngIf="item.url && !item.function"
|
<a class="nav-link" *ngIf="item.url && !item.externalUrl && !item.function"
|
||||||
[routerLink]="[item.url]" routerLinkActive="active"
|
[routerLink]="[item.url]" routerLinkActive="active"
|
||||||
[routerLinkActiveOptions]="{exact: item.exactMatch || false}" matRipple>
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}"
|
||||||
|
[target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.externalUrl -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && item.externalUrl && !item.function"
|
||||||
|
[href]="item.url" [target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- item.function -->
|
<!-- item.function -->
|
||||||
<span class="nav-link" *ngIf="!item.url && item.function" (click)="item.function()" matRipple>
|
<span class="nav-link" *ngIf="!item.url && item.function"
|
||||||
|
(click)="item.function()" matRipple>
|
||||||
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<!-- item.url && item.function -->
|
<!-- item.url && item.function -->
|
||||||
<a class="nav-link" *ngIf="item.url && item.function" (click)="item.function()"
|
<a class="nav-link" *ngIf="item.url && !item.externalUrl && item.function" (click)="item.function()"
|
||||||
[routerLink]="[item.url]" routerLinkActive="active"
|
[routerLink]="[item.url]" routerLinkActive="active"
|
||||||
[routerLinkActiveOptions]="{exact: item.exactMatch || false}" matRipple>
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}"
|
||||||
|
[target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.externalUrl && item.function -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && item.externalUrl && item.function" (click)="item.function()"
|
||||||
|
[href]="item.url" [target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { Component, HostBinding, Input } from '@angular/core';
|
import { Component, HostBinding, Input } from '@angular/core';
|
||||||
|
|
||||||
|
import { FuseNavigationItem } from '@fuse/types';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-nav-vertical-item',
|
selector : 'fuse-nav-vertical-item',
|
||||||
templateUrl: './nav-vertical-item.component.html',
|
templateUrl: './nav-vertical-item.component.html',
|
||||||
|
@ -11,7 +13,7 @@ export class FuseNavVerticalItemComponent
|
||||||
classes = 'nav-item';
|
classes = 'nav-item';
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
item: any;
|
item: FuseNavigationItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|
26
src/@fuse/types/fuse-navigation.ts
Normal file
26
src/@fuse/types/fuse-navigation.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
export interface FuseNavigationItem
|
||||||
|
{
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
type: 'item' | 'group' | 'collapse';
|
||||||
|
translate?: string;
|
||||||
|
icon?: string;
|
||||||
|
hidden?: boolean;
|
||||||
|
url?: string;
|
||||||
|
exactMatch?: boolean;
|
||||||
|
externalUrl?: boolean;
|
||||||
|
openInNewTab?: boolean;
|
||||||
|
function?: any;
|
||||||
|
badge?: {
|
||||||
|
title?: string;
|
||||||
|
translate?: string;
|
||||||
|
bg?: string;
|
||||||
|
fg?: string;
|
||||||
|
};
|
||||||
|
children?: FuseNavigationItem[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FuseNavigation extends FuseNavigationItem
|
||||||
|
{
|
||||||
|
children?: FuseNavigationItem[];
|
||||||
|
}
|
|
@ -1 +1,2 @@
|
||||||
export * from './fuse-config';
|
export * from './fuse-config';
|
||||||
|
export * from './fuse-navigation';
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user