-
Notifications
You must be signed in to change notification settings - Fork 670
Expand file tree
/
Copy pathitem-dxi.ts
More file actions
129 lines (107 loc) · 2.83 KB
/
Copy pathitem-dxi.ts
File metadata and controls
129 lines (107 loc) · 2.83 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* tslint:disable:max-line-length */
import {
Component,
NgModule,
Host,
ElementRef,
Renderer2,
Inject,
AfterViewInit,
SkipSelf,
Input
} from '@angular/core';
import { DOCUMENT } from '@angular/common';
import {
DxIntegrationModule,
NestedOptionHost,
extractTemplate,
DxTemplateDirective,
IDxTemplateHost,
DxTemplateHost,
} from 'devextreme-angular/core';
import { CollectionNestedOption } from 'devextreme-angular/core';
import { PROPERTY_TOKEN_items } from 'devextreme-angular/core/tokens';
@Component({
selector: 'dxi-autocomplete-item',
template: '<ng-content></ng-content>',
styles: [':host { display: block; }'],
imports: [ DxIntegrationModule ],
providers: [
NestedOptionHost,
DxTemplateHost,
{
provide: PROPERTY_TOKEN_items,
useExisting: DxiAutocompleteItemComponent,
}
]
})
export class DxiAutocompleteItemComponent extends CollectionNestedOption implements AfterViewInit,
IDxTemplateHost {
@Input()
get disabled(): boolean {
return this._getOption('disabled');
}
set disabled(value: boolean) {
this._setOption('disabled', value);
}
@Input()
get html(): string {
return this._getOption('html');
}
set html(value: string) {
this._setOption('html', value);
}
@Input()
get template(): any {
return this._getOption('template');
}
set template(value: any) {
this._setOption('template', value);
}
@Input()
get text(): string {
return this._getOption('text');
}
set text(value: string) {
this._setOption('text', value);
}
@Input()
get visible(): boolean {
return this._getOption('visible');
}
set visible(value: boolean) {
this._setOption('visible', value);
}
protected get _optionPath() {
return 'items';
}
constructor(@SkipSelf() @Host() parentOptionHost: NestedOptionHost,
@Host() optionHost: NestedOptionHost,
private renderer: Renderer2,
@Inject(DOCUMENT) private document: any,
@Host() templateHost: DxTemplateHost,
private element: ElementRef) {
super();
parentOptionHost.setNestedOption(this);
optionHost.setHost(this, this._fullOptionPath.bind(this));
templateHost.setHost(this);
}
setTemplate(template: DxTemplateDirective) {
this.template = template;
}
ngAfterViewInit() {
extractTemplate(this, this.element, this.renderer, this.document);
}
ngOnDestroy() {
this._deleteRemovedOptions(this._fullOptionPath());
}
}
@NgModule({
imports: [
DxiAutocompleteItemComponent
],
exports: [
DxiAutocompleteItemComponent
],
})
export class DxiAutocompleteItemModule { }