forked from NG-ZORRO/ng-zorro-antd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resize-handles.component.ts
36 lines (31 loc) · 1.08 KB
/
resize-handles.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { NzResizeDirection } from './resize-handle.component';
export const DEFAULT_RESIZE_DIRECTION: NzResizeDirection[] = [
'bottomRight',
'topRight',
'bottomLeft',
'topLeft',
'bottom',
'right',
'top',
'left'
];
@Component({
selector: 'nz-resize-handles',
exportAs: 'nzResizeHandles',
template: ` <nz-resize-handle *ngFor="let dir of directions" [nzDirection]="dir"></nz-resize-handle> `,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class NzResizeHandlesComponent implements OnChanges {
@Input() nzDirections: NzResizeDirection[] = DEFAULT_RESIZE_DIRECTION;
directions = new Set<NzResizeDirection>(this.nzDirections);
ngOnChanges(changes: SimpleChanges): void {
if (changes.nzDirections) {
this.directions = new Set(changes.nzDirections.currentValue);
}
}
}