Rename dropdown type enum & add pass as variable to use like an Enum

This commit is contained in:
Michael Shamoon
2020-12-19 20:19:37 -08:00
parent 28283c0a07
commit ba7f030901
4 changed files with 11 additions and 8 deletions

View File

@@ -1,12 +1,12 @@
<div class="btn-group" ngbDropdown role="group" (openChange)="dropdownOpenChange($event)" #dropdown="ngbDropdown">
<button class="btn btn-sm" id="dropdown{{title}}" ngbDropdownToggle [ngClass]="type !== 'actions' && itemsSelected?.length > 0 ? 'btn-primary' : 'btn-outline-primary'">
<button class="btn btn-sm" id="dropdown{{title}}" ngbDropdownToggle [ngClass]="type !== types.Editing && itemsSelected?.length > 0 ? 'btn-primary' : 'btn-outline-primary'">
<div class="d-none d-md-inline">{{title}}</div>
<div class="d-inline-block d-md-none">
<svg class="toolbaricon" fill="currentColor">
<use attr.xlink:href="assets/bootstrap-icons.svg#{{icon}}" />
</svg>
</div>
<ng-container *ngIf="type !== 'actions' && itemsSelected?.length > 0">
<ng-container *ngIf="type !== types.Editing && itemsSelected?.length > 0">
<div class="badge bg-secondary text-light rounded-pill badge-corner">
{{itemsSelected?.length}}
</div>

View File

@@ -19,7 +19,7 @@ export enum SelectableItemState {
export enum FilterableDropdownType {
Filtering = 'filtering',
Actions = 'actions'
Editing = 'editing'
}
@Component({
@@ -47,7 +47,7 @@ export class FilterableDropdownComponent {
@Input()
set selectableItems (selectableItems: SelectableItem[]) {
if (this.type == FilterableDropdownType.Actions && this.dropdown?.isOpen()) return
if (this.type == FilterableDropdownType.Editing && this.dropdown?.isOpen()) return
else this._selectableItems = selectableItems
}
@@ -75,6 +75,8 @@ export class FilterableDropdownComponent {
@Input()
type: FilterableDropdownType = FilterableDropdownType.Filtering
types = FilterableDropdownType
@Input()
singular: boolean = false