`
})
export class SamActionsListComponent {
/**
* Passes in the content model for the top right items+icons
*/
@Input() contentModel: ToolbarItem[] = [];
/**
* Emitter for interaction handling
*/
@Output() action: EventEmitter = new EventEmitter();
public showMoreActions = [];
public actionClick (item) {
if (!item.disabled) {
this.action.emit(item);
}
}
public dropdownClick(item) {
let matchedItem = this.contentModel.find(modelItem => {
if (modelItem.label === item.label) {
return true;
}
});
if (matchedItem) {
this.actionClick(matchedItem);
}
}
public ngOnChanges(c) {
if (c.contentModel && this.contentModel) {
this.showMoreActions = [];
for (let item of this.contentModel) {
if (item.showMore) {
let showMoreAction = {
name: item.label,
label: item.label,
icon: 'fa ' + item.icon
};
this.showMoreActions.push(showMoreAction);
}
}
}
}
}