-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from ShankyTiwari/155-merge
Resolved Conflict for PR #155
- Loading branch information
Showing
25 changed files
with
370 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,4 @@ testem.log | |
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
projects/ng-material-multilevel-menu/node_modules/.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
projects/ng-material-multilevel-menu/src/lib/common-utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export class CommonUtils { | ||
|
||
static isNullOrUndefinedOrEmpty = function (object: any): boolean { | ||
return CommonUtils.isNullOrUndefined(object) || object === ''; | ||
}; | ||
|
||
static isNullOrUndefined = function (object: any): boolean { | ||
return object === null || object === undefined; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...erial-multilevel-menu/src/lib/list-item/list-item-content/list-item-content.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.amml-item { | ||
position: relative; | ||
cursor: pointer; | ||
} | ||
|
||
.anml-link { | ||
width: 100%; | ||
display: flex; | ||
justify-content: flex-start; | ||
text-transform: capitalize; | ||
text-decoration: none; | ||
color: inherit; | ||
} | ||
|
||
.anml-data { | ||
width: 100%; | ||
height: 48px; | ||
display: flex; | ||
justify-content: flex-start; | ||
} | ||
|
||
.disabled-amml-item { | ||
opacity: 0.5; | ||
text-decoration: none; | ||
pointer-events: none; | ||
} | ||
|
||
.icon-container { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
} | ||
|
||
.amml-icon-fa { | ||
font-size: 20px; | ||
} | ||
|
||
.label { | ||
line-height: 48px; | ||
font-weight: 400; | ||
} | ||
|
||
.amml-svg-icon { | ||
width: 22px; | ||
height: 22px; | ||
margin-top: -12px; | ||
} | ||
.amml-icon-arrow-container { | ||
direction: ltr; | ||
display: flex; | ||
align-items: center; | ||
} | ||
div[dir="ltr"] .amml-icon { | ||
margin-right: 16px; | ||
} | ||
div[dir="ltr"].amml-submenu { | ||
margin-left: 16px; | ||
} | ||
|
||
div[dir="rtl"] .amml-icon { | ||
margin-left: 16px; | ||
} | ||
div[dir="rtl"].amml-submenu { | ||
margin-right: 16px; | ||
} |
57 changes: 57 additions & 0 deletions
57
...rial-multilevel-menu/src/lib/list-item/list-item-content/list-item-content.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<ng-container *ngTemplateOutlet="node.externalRedirect ? redirectLinkTemplate : routerLinkTemplate"></ng-container> | ||
|
||
<ng-template #redirectLinkTemplate> | ||
<a class="anml-link" [href]="node.link" [target]="getHrefTargetType()"> | ||
<ng-container *ngTemplateOutlet="isRtlLayout ? linkLabelRtlOutlet : linkLabelLtrOutlet"></ng-container> | ||
</a> | ||
</ng-template> | ||
|
||
<ng-template #routerLinkTemplate> | ||
<a class="anml-link" *ngIf="!node.externalRedirect && node.link" [routerLink]="node.link"> | ||
<ng-container *ngTemplateOutlet="isRtlLayout ? linkLabelRtlOutlet : linkLabelLtrOutlet"></ng-container> | ||
</a> | ||
<a class="anml-link" *ngIf="!node.link"> | ||
<ng-container *ngTemplateOutlet="isRtlLayout ? linkLabelRtlOutlet : linkLabelLtrOutlet"></ng-container> | ||
</a> | ||
</ng-template> | ||
|
||
<ng-template #linkLabelLtrOutlet> | ||
<div class="anml-data" [dir]="'ltr'"> | ||
<ng-container *ngTemplateOutlet="iconContainer"></ng-container> | ||
<span class="label">{{node.label}}</span> | ||
</div> | ||
<div class="amml-icon-arrow-container" *ngIf='node.hasChildren'> | ||
<mat-icon [@ExpandedLTR]="nodeExpandStatus()"> | ||
keyboard_arrow_down | ||
</mat-icon> | ||
</div> | ||
</ng-template> | ||
|
||
<ng-template #linkLabelRtlOutlet> | ||
<div class="anml-data" [dir]="'rtl'"> | ||
<ng-container *ngTemplateOutlet="iconContainer"></ng-container> | ||
<span class="label">{{node.label}}</span> | ||
</div> | ||
<div class="amml-icon-arrow-container" *ngIf='node.hasChildren'> | ||
<mat-icon [@ExpandedRTL]="nodeExpandStatus()"> | ||
keyboard_arrow_down | ||
</mat-icon> | ||
</div> | ||
</ng-template> | ||
|
||
<ng-template #iconContainer> | ||
<div class="icon-container" [ngSwitch]="getListIcon(node)"> | ||
<span *ngSwitchCase="'faIcon'" class="amml-icon amml-icon-fa"> | ||
<i [ngClass]="getSelectedFaIcon()"></i> | ||
</span> | ||
<mat-icon *ngSwitchCase="'icon'" class="amml-icon"> | ||
{{getSelectedIcon()}} | ||
</mat-icon> | ||
<mat-icon *ngSwitchCase="'svgIcon'" class="amml-icon amml-svg-icon" | ||
svgIcon="{{getSelectedSvgIcon()}}"> | ||
</mat-icon> | ||
<img *ngSwitchCase="'imageIcon'" matListAvatar class="amml-icon" | ||
src="{{getSelectedImageIcon()}}" alt="{{node.label}}"/> | ||
</div> | ||
</ng-template> | ||
|
25 changes: 25 additions & 0 deletions
25
...l-multilevel-menu/src/lib/list-item/list-item-content/list-item-content.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ListItemContentComponent } from './list-item-content.component'; | ||
|
||
describe('ListItemContentComponent', () => { | ||
let component: ListItemContentComponent; | ||
let fixture: ComponentFixture<ListItemContentComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ ListItemContentComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ListItemContentComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
62 changes: 62 additions & 0 deletions
62
...terial-multilevel-menu/src/lib/list-item/list-item-content/list-item-content.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import {Component, Input, OnInit} from '@angular/core'; | ||
import {MultilevelNode} from '../../app.model'; | ||
import {ExpandedLTR, ExpandedRTL} from '../../animation'; | ||
import {CommonUtils} from '../../common-utils'; | ||
import {CONSTANT} from '../../constants'; | ||
|
||
@Component({ | ||
selector: 'ng-list-item-content', | ||
templateUrl: './list-item-content.component.html', | ||
styleUrls: ['./list-item-content.component.css'], | ||
animations: [ExpandedLTR, ExpandedRTL] | ||
}) | ||
export class ListItemContentComponent implements OnInit { | ||
@Input() node: MultilevelNode; | ||
@Input() isRtlLayout: boolean; | ||
|
||
constructor() { | ||
// NOOP | ||
} | ||
|
||
ngOnInit(): void { | ||
// NOOP | ||
} | ||
|
||
getListIcon(node: MultilevelNode): string { | ||
if (!CommonUtils.isNullOrUndefinedOrEmpty(node.icon)) { | ||
return `icon`; | ||
} else if (!CommonUtils.isNullOrUndefinedOrEmpty(node.faIcon)) { | ||
return `faIcon`; | ||
} else if (!CommonUtils.isNullOrUndefinedOrEmpty(node.imageIcon)) { | ||
return `imageIcon`; | ||
} else if (!CommonUtils.isNullOrUndefinedOrEmpty(node.svgIcon)) { | ||
return `svgIcon`; | ||
} else { | ||
return ``; | ||
} | ||
} | ||
|
||
getHrefTargetType(): string { | ||
return this.node.hrefTargetType ? this.node.hrefTargetType : CONSTANT.DEFAULT_HREF_TARGET_TYPE; | ||
} | ||
|
||
getSelectedSvgIcon(): string { | ||
return this.node.isSelected && this.node.activeSvgIcon ? this.node.activeSvgIcon : this.node.svgIcon; | ||
} | ||
|
||
getSelectedIcon(): string { | ||
return this.node.isSelected && this.node.activeIcon ? this.node.activeIcon : this.node.icon; | ||
} | ||
|
||
getSelectedFaIcon(): string { | ||
return this.node.isSelected && this.node.activeFaIcon ? this.node.activeFaIcon : this.node.faIcon; | ||
} | ||
|
||
getSelectedImageIcon(): string { | ||
return this.node.isSelected && this.node.activeImageIcon ? this.node.activeImageIcon : this.node.imageIcon; | ||
} | ||
|
||
nodeExpandStatus(): string { | ||
return this.node.expanded ? CONSTANT.YES : CONSTANT.NO; | ||
} | ||
} |
64 changes: 1 addition & 63 deletions
64
projects/ng-material-multilevel-menu/src/lib/list-item/list-item.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,3 @@ | ||
.amml-item { | ||
position: relative; | ||
cursor: pointer; | ||
} | ||
|
||
.anml-link { | ||
width: 100%; | ||
display: flex; | ||
justify-content: flex-start; | ||
text-transform: capitalize; | ||
text-decoration: none; | ||
color: inherit; | ||
} | ||
|
||
.anml-data { | ||
.filled { | ||
width: 100%; | ||
height: 48px; | ||
display: flex; | ||
justify-content: flex-start; | ||
} | ||
|
||
.disabled-amml-item { | ||
opacity: 0.5; | ||
text-decoration: none; | ||
pointer-events: none; | ||
} | ||
|
||
.icon-container { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
} | ||
|
||
.amml-icon-fa { | ||
font-size: 20px; | ||
} | ||
|
||
.label { | ||
line-height: 48px; | ||
font-weight: 400; | ||
} | ||
|
||
.amml-svg-icon { | ||
width: 22px; | ||
height: 22px; | ||
margin-top: -12px; | ||
} | ||
.amml-icon-arrow-container { | ||
direction: ltr; | ||
display: flex; | ||
align-items: center; | ||
} | ||
div[dir="ltr"] .amml-icon { | ||
margin-right: 16px; | ||
} | ||
div[dir="ltr"].amml-submenu { | ||
margin-left: 16px; | ||
} | ||
|
||
div[dir="rtl"] .amml-icon { | ||
margin-left: 16px; | ||
} | ||
div[dir="rtl"].amml-submenu { | ||
margin-right: 16px; | ||
} |
Oops, something went wrong.