Skip to content

Commit

Permalink
Fixed #11298 and Fixed #11297
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitfindikli committed Mar 11, 2022
1 parent 6e80d00 commit cc5b0d7
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/app/components/orderlist/orderlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import {CdkDragDrop, DragDropModule, moveItemInArray} from '@angular/cdk/drag-dr
<div [ngClass]="{'p-orderlist p-component': true, 'p-orderlist-striped': stripedRows, 'p-orderlist-controls-left': controlsPosition === 'left',
'p-orderlist-controls-right': controlsPosition === 'right'}" [ngStyle]="style" [class]="styleClass">
<div class="p-orderlist-controls">
<button type="button" pButton pRipple icon="pi pi-angle-up" (click)="moveUp()"></button>
<button type="button" pButton pRipple icon="pi pi-angle-double-up" (click)="moveTop()"></button>
<button type="button" pButton pRipple icon="pi pi-angle-down" (click)="moveDown()"></button>
<button type="button" pButton pRipple icon="pi pi-angle-double-down" (click)="moveBottom()"></button>
<button type="button" [disabled]="moveDisabled()" pButton pRipple icon="pi pi-angle-up" (click)="moveUp()"></button>
<button type="button" [disabled]="moveDisabled()" pButton pRipple icon="pi pi-angle-double-up" (click)="moveTop()"></button>
<button type="button" [disabled]="moveDisabled()" pButton pRipple icon="pi pi-angle-down" (click)="moveDown()"></button>
<button type="button" [disabled]="moveDisabled()" pButton pRipple icon="pi pi-angle-double-down" (click)="moveBottom()"></button>
</div>
<div class="p-orderlist-list-container">
<div class="p-orderlist-header" *ngIf="header || headerTemplate">
Expand All @@ -25,13 +25,13 @@ import {CdkDragDrop, DragDropModule, moveItemInArray} from '@angular/cdk/drag-dr
</div>
<div class="p-orderlist-filter-container" *ngIf="filterBy">
<div class="p-orderlist-filter">
<input type="text" role="textbox" (keyup)="onFilterKeyup($event)" class="p-orderlist-filter-input p-inputtext p-component" [attr.placeholder]="filterPlaceholder" [attr.aria-label]="ariaFilterLabel">
<input type="text" role="textbox" (keyup)="onFilterKeyup($event)" [disabled]="disabled" class="p-orderlist-filter-input p-inputtext p-component" [attr.placeholder]="filterPlaceholder" [attr.aria-label]="ariaFilterLabel">
<span class="p-orderlist-filter-icon pi pi-search"></span>
</div>
</div>
<ul #listelement cdkDropList (cdkDropListDropped)="onDrop($event)" class="p-orderlist-list" [ngStyle]="listStyle">
<ng-template ngFor [ngForTrackBy]="trackBy" let-item [ngForOf]="value" let-i="index" let-l="last">
<li class="p-orderlist-item" tabindex="0" [ngClass]="{'p-highlight':isSelected(item)}" cdkDrag pRipple [cdkDragData]="item" [cdkDragDisabled]="!dragdrop"
<li class="p-orderlist-item" tabindex="0" [ngClass]="{'p-highlight':isSelected(item), 'p-disabled': disabled}" cdkDrag pRipple [cdkDragData]="item" [cdkDragDisabled]="!dragdrop"
(click)="onItemClick($event,item,i)" (touchend)="onItemTouchEnd()" (keydown)="onItemKeydown($event,item,i)"
*ngIf="isItemVisible(item)" role="option" [attr.aria-selected]="isSelected(item)">
<ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
Expand Down Expand Up @@ -88,6 +88,8 @@ export class OrderList implements AfterViewChecked,AfterContentInit {

@Input() stripedRows: boolean;

@Input() disabled: boolean = false;

@Output() selectionChange: EventEmitter<any> = new EventEmitter();

@Input() trackBy: Function = (index: number, item: any) => item;
Expand All @@ -110,7 +112,7 @@ export class OrderList implements AfterViewChecked,AfterContentInit {

public emptyFilterMessageTemplate: TemplateRef<any>;

_selection: any[];
_selection: any[] = [];

movedUp: boolean;

Expand Down Expand Up @@ -439,6 +441,12 @@ export class OrderList implements AfterViewChecked,AfterContentInit {
return null;
}

moveDisabled(){
if(this.disabled || !this.selection.length) {
return true;
}
}

createStyle() {
if (!this.styleElement) {
this.el.nativeElement.children[0].setAttribute(this.id, '');
Expand Down

0 comments on commit cc5b0d7

Please sign in to comment.