-
Notifications
You must be signed in to change notification settings - Fork 671
Expand file tree
/
Copy pathitem-dxi.ts
More file actions
147 lines (123 loc) · 3.39 KB
/
Copy pathitem-dxi.ts
File metadata and controls
147 lines (123 loc) · 3.39 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/* tslint:disable:max-line-length */
import {
Component,
NgModule,
Host,
ElementRef,
Renderer2,
Inject,
AfterViewInit,
SkipSelf,
Input
} from '@angular/core';
import { DOCUMENT } from '@angular/common';
import type { NativeEventInfo } from 'devextreme/common/core/events';
import type { ButtonStyle, ButtonType } from 'devextreme/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-action-sheet-item',
template: '<ng-content></ng-content>',
styles: [':host { display: block; }'],
imports: [ DxIntegrationModule ],
providers: [
NestedOptionHost,
DxTemplateHost,
{
provide: PROPERTY_TOKEN_items,
useExisting: DxiActionSheetItemComponent,
}
]
})
export class DxiActionSheetItemComponent extends CollectionNestedOption implements AfterViewInit,
IDxTemplateHost {
@Input()
get disabled(): boolean {
return this._getOption('disabled');
}
set disabled(value: boolean) {
this._setOption('disabled', value);
}
@Input()
get icon(): string {
return this._getOption('icon');
}
set icon(value: string) {
this._setOption('icon', value);
}
@Input()
get onClick(): ((e: NativeEventInfo<any>) => void) {
return this._getOption('onClick');
}
set onClick(value: ((e: NativeEventInfo<any>) => void)) {
this._setOption('onClick', value);
}
@Input()
get stylingMode(): ButtonStyle {
return this._getOption('stylingMode');
}
set stylingMode(value: ButtonStyle) {
this._setOption('stylingMode', 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 type(): ButtonType | string {
return this._getOption('type');
}
set type(value: ButtonType | string) {
this._setOption('type', 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: [
DxiActionSheetItemComponent
],
exports: [
DxiActionSheetItemComponent
],
})
export class DxiActionSheetItemModule { }