mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
ADF-2974] New Buttons Menu component version (#3429)
* [ADF-2974] Buttons injected from parent html component * [ADF-2974] New version of buttons menu component * [ADF-2974] Updated unit tests * [ADF-2974] Updated documentation * [ADF-2974] Removed unused variable * [ADF-2974] Fixed failing test at analytics report parameters * [ADF-2974] Removed fdescribe * [ADF-2974] Moved mock inside testing file for buttons menu component
This commit is contained in:
committed by
Eugenio Romano
parent
1838818295
commit
3759a7967c
@@ -15,25 +15,30 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* tslint:disable:component-selector no-access-missing-member no-input-rename */
|
||||
|
||||
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { MenuButton } from './menu-button.model';
|
||||
import { Component, ContentChildren, QueryList, AfterContentInit } from '@angular/core';
|
||||
import { MatMenuItem } from '@angular/material';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-buttons-action-menu',
|
||||
templateUrl: './buttons-menu.component.html'
|
||||
templateUrl: './buttons-menu.component.html',
|
||||
styleUrls: ['./buttons-menu.component.scss']
|
||||
})
|
||||
|
||||
export class ButtonsMenuComponent implements OnChanges {
|
||||
/** Array of buttons that defines the menu. */
|
||||
@Input() buttons: MenuButton[];
|
||||
export class ButtonsMenuComponent implements AfterContentInit {
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
this.buttons = changes['buttons'].currentValue;
|
||||
@ContentChildren(MatMenuItem) buttons: QueryList<MatMenuItem>;
|
||||
|
||||
isMenuEmpty: boolean;
|
||||
|
||||
ngAfterContentInit() {
|
||||
if (this.buttons.length > 0) {
|
||||
this.isMenuEmpty = false;
|
||||
} else {
|
||||
this.isMenuEmpty = true;
|
||||
}
|
||||
}
|
||||
|
||||
hasButtons() {
|
||||
return this.buttons.length > 0 ? true : false;
|
||||
isMobile(): boolean {
|
||||
return !!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user