|
1 | 1 | import { |
2 | 2 | Component, Input, HostBinding, HostListener, EventEmitter, ViewContainerRef, ViewChild, |
3 | | - ElementRef, Renderer |
4 | 3 | } from '@angular/core'; |
5 | | -import {SuiTransition} from "../transition/transition"; |
6 | 4 |
|
7 | 5 | @Component({ |
8 | 6 | selector: 'sui-select-option', |
@@ -35,56 +33,3 @@ export class SuiSelectOption { |
35 | 33 | return false; |
36 | 34 | } |
37 | 35 | } |
38 | | - |
39 | | -@Component({ |
40 | | - selector: 'sui-select-multi-label', |
41 | | - template: ` |
42 | | -<span #optionRenderTarget></span> |
43 | | -<span *ngIf="!useTemplate">{{ readValue(value) }}</span> |
44 | | -<i class="delete icon" (click)="deselectOption()"></i> |
45 | | -` |
46 | | -}) |
47 | | -export class SuiSelectMultiLabel { |
48 | | - @HostBinding('class.ui') |
49 | | - @HostBinding('class.label') classes = true; |
50 | | - |
51 | | - private _transition:SuiTransition; |
52 | | - constructor(private el:ElementRef, private renderer:Renderer) { |
53 | | - this._transition = new SuiTransition(el, renderer); |
54 | | - this._transition.animate({ |
55 | | - name: "scale", |
56 | | - direction: "in", |
57 | | - display: "inline-block", |
58 | | - duration: 100 |
59 | | - }); |
60 | | - } |
61 | | - |
62 | | - public useTemplate:boolean = false; |
63 | | - |
64 | | - @HostListener('click', ['$event']) |
65 | | - public click(event:MouseEvent):boolean { |
66 | | - event.stopPropagation(); |
67 | | - return false; |
68 | | - } |
69 | | - |
70 | | - public readValue = (value:any) => ""; |
71 | | - |
72 | | - @Input() |
73 | | - public value:any; |
74 | | - |
75 | | - public selected:EventEmitter<any> = new EventEmitter<any>(); |
76 | | - |
77 | | - @ViewChild('optionRenderTarget', { read: ViewContainerRef }) |
78 | | - public viewContainerRef:ViewContainerRef; |
79 | | - |
80 | | - public deselectOption() { |
81 | | - event.stopPropagation(); |
82 | | - this._transition.animate({ |
83 | | - name: "scale", |
84 | | - direction: "out", |
85 | | - duration: 100, |
86 | | - callback: () => this.selected.emit(this.value) |
87 | | - }); |
88 | | - return false; |
89 | | - } |
90 | | -} |
0 commit comments