mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-12 17:47:08 +01:00
Rename dropdown type enum & add pass as variable to use like an Enum
This commit is contained in:
parent
561db8607a
commit
9a4190bedf
4 changed files with 11 additions and 8 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue