@lidorsystems/integralui-web
Version:
IntegralUI Web - Advanced UI Components for Angular
124 lines (106 loc) • 4.31 kB
text/typescript
/*
Copyright © 2016-2019 Lidor Systems. All rights reserved.
This file is part of the "IntegralUI Web" Library.
The contents of this file are subject to the IntegralUI Web License, and may not be used except in compliance with the License.
A copy of the License should have been installed in the product's root installation directory or it can be found at
http://www.lidorsystems.com/products/web/studio/license-agreement.aspx.
This SOFTWARE is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language
governing rights and limitations under the License. Any infringement will be prosecuted under applicable laws.
*/
import { Component, ElementRef, ViewContainerRef, ViewChild, ViewChildren, ViewEncapsulation } from '@angular/core';
export class DropDownButtonSample {
featureContentElem: ElementRef;
public blockHeight: any = "auto";
// List of features
public sideList: Array<any>;
public selectedItem: any = null;
private hoverItem: any = null;
constructor(){
this.sideList = [
{ text: "Overview", link: './overview' },
{ text: "Back to Main", link: '', margin: 50 }
];
this.selectedItem = this.sideList[0];
}
ngAfterContentChecked(){
let self = this;
if (self.featureContentElem && self.featureContentElem.nativeElement.offsetHeight < window.innerHeight - 61)
self.blockHeight = window.innerHeight - 61 + 'px';
else
self.blockHeight = "auto";
}
selectFeature(item: any){
this.selectedItem = item;
}
itemMouseEnter(item: any){
this.hoverItem = item;
}
itemMouseLeave(){
this.hoverItem = null;
}
getItemStyle(item: any){
let style: any = {
color: '#ababab',
'font-weight': 'normal'
}
if (item == this.selectedItem){
style.color = 'white';
style['font-weight'] = 'bold';
}
else if (item == this.hoverItem)
style.color = '#f5f5f5';
return style;
}
}