-
Notifications
You must be signed in to change notification settings - Fork 160
Expand file tree
/
Copy pathselect.sample.html
More file actions
200 lines (190 loc) · 8.75 KB
/
select.sample.html
File metadata and controls
200 lines (190 loc) · 8.75 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<div class="select-sample">
<section class="select-sample__section">
<h1 class="select-sample__title">Select with ngModel, set items OnInit</h1>
<size-selector #sizeSelector></size-selector>
<div class="select-sample__row">
<button igxButton="contained" (click)="handleOpen()">Open</button>
<button igxButton="outlined" (click)="handleClose()">Close</button>
<button igxButton (click)="isDisabled = !isDisabled">toggle Disable</button>
<button igxButton (click)="openCustomOverlaySettings()">open Custom Overlay</button>
</div>
<igx-select #sizeSelect
required
[placeholder]="'Pick One'"
[(ngModel)]="value"
[ngModelOptions]="{updateOn: 'blur'}"
#selectModel="ngModel"
(opening)="testOnOpening($event)"
(opened)="testOnOpened()"
(closing)="testOnClosing($event)"
(closed)="testOnClosed()"
(selectionChanging)="testOnSelection($event)"
[disabled]="isDisabled"
[style.--ig-size]="'var(--ig-size-' + sizeSelector.size + ')'">
<label igxLabel>Sample Label</label>
<igx-prefix igxPrefix>
<igx-icon>alarm</igx-icon>
</igx-prefix>
<igx-select-item>
None
</igx-select-item>
@for (item of items; track item; let inx = $index) {
<igx-select-item [value]="item.field">
<igx-icon igxPrefix>alarm</igx-icon>
{{ item.field }}
<igx-icon igxSuffix>notifications_active</igx-icon>
</igx-select-item>
}
<ng-template igxSelectHeader>
<div class="custom-select-header" (click)="headerFootedClick($event);">
Header content
</div>
</ng-template>
<ng-template igxSelectFooter>
<div class="custom-select-footer" (click)="headerFootedClick($event);">
<div>Footer content</div>
<button igxButton="contained" (click)="btnClick()">Click Me!</button>
</div>
</ng-template>
</igx-select>
<div>Model: {{selectModel.value}}</div>
</section>
<section class="select-sample__section">
<h1 class="select-sample__title">Select - declare items in html template</h1>
<igx-select #select2
[placeholder]="'Pick One'"
[value]="value"
(opening)="testOnOpening($event)"
(opened)="testOnOpened()"
(closing)="testOnClosing($event)"
(closed)="testOnClosed()"
(selectionChanging)="testOnSelection($event)"
[disabled]="false"
[type]="'box'">
<label igxLabel>Sample Label</label>
<igx-prefix>
<igx-icon>favorite</igx-icon>
</igx-prefix>
<igx-suffix>
<igx-icon>alarm</igx-icon>
</igx-suffix>
<igx-hint>I am a Hint</igx-hint>
<igx-select-item>None</igx-select-item>
<igx-select-item [value]="1">Sofia</igx-select-item>
<igx-select-item [value]="2">London</igx-select-item>
<igx-select-item [value]="3">Paris</igx-select-item>
<igx-select-item [value]="4">New York</igx-select-item>
</igx-select>
</section>
<section class="select-sample__section">
<h1 class="select-sample__title">Select - disabled item</h1>
<igx-select #select3
[placeholder]="'Pick One'"
(opening)="testOnOpening($event)"
(opened)="testOnOpened()"
(closing)="testOnClosing($event)"
(closed)="testOnClosed()"
(selectionChanging)="testOnSelection($event)"
[disabled]="false"
[type]="'border'">
<label igxLabel>Sample Label</label>
<igx-icon igxPrefix>favorite</igx-icon>
<igx-hint>I am a Hint</igx-hint>
<igx-select-item [value] = "'Apple'" [disabled]="true">Apple</igx-select-item>
<igx-select-item [value] = "'Orange'">Orange</igx-select-item>
<igx-select-item [value] = "'Grapes'">Grapes</igx-select-item>
<igx-select-item [value] = "'Banana'">Banana</igx-select-item>
</igx-select>
</section>
<section class="select-sample__section">
<h1 class="select-sample__title">TEST: @if/@else inside @for</h1>
<igx-select #nestedTest [placeholder]="'Pick One'">
<label igxLabel>Odd/Even Select</label>
@for (item of testItems; track item; let e = $even) {
@if (e) {
<igx-select-item [value]="item">odd: {{ item }}</igx-select-item>
} @else {
<igx-select-item [value]="item">even: {{ item }}</igx-select-item>
}
}
</igx-select>
</section>
<section class="select-sample__section">
<h1 class="select-sample__title">Select - using Groups</h1>
<igx-select #select4
[placeholder]="'Pick One'"
[value]="value"
(opening)="testOnOpening($event)"
(opened)="testOnOpened()"
(closing)="testOnClosing($event)"
(closed)="testOnClosed()"
(selectionChanging)="testOnSelection($event)"
[disabled]="false">
<label igxLabel>Group</label>
<igx-prefix igxPrefix>
<igx-icon>alarm</igx-icon>
</igx-prefix>
<igx-select-item value="1">OutsideGroup</igx-select-item>
<igx-select-item-group label="Group">
<igx-select-item [disabled]="true" value="2">
<igx-icon igxPrefix>alarm</igx-icon>
InsideGroup1
<igx-icon igxSuffix>alarm</igx-icon>
</igx-select-item>
<igx-select-item value="3">
<igx-icon igxPrefix>alarm</igx-icon>
InsideGroup2
<igx-icon igxSuffix>alarm</igx-icon>
</igx-select-item>
<igx-select-item value="4">
<igx-icon igxPrefix>alarm</igx-icon>
InsideGroup3
<igx-icon igxSuffix>alarm</igx-icon>
</igx-select-item>
</igx-select-item-group>
</igx-select>
</section>
<section class="select-sample__section">
<h1 class="select-sample__title"> Select in a Form</h1>
<form class="select-sample__form" [formGroup]="reactiveForm" (ngSubmit)="onSubmitReactive()">
<igx-select formControlName="citiesSelect" #selectReactive [placeholder]="'City'">
<label igxLabel>Choose a city</label>
<igx-prefix igxPrefix>
<igx-icon>alarm</igx-icon>
</igx-prefix>
@for (city of cities; track city; let inx = $index) {
<igx-select-item [value]="city">
{{ city }}
</igx-select-item>
}
</igx-select>
<button type="submit" igxButton="contained" [disabled]="!reactiveForm.valid">Submit</button>
</form>
</section>
<section class="select-sample__section">
<h1 class="select-sample__title">Select - dynamically change required</h1>
<div class="select-sample__row">
<button igxButton="contained" (click)="selectBanana()">Select Banana</button>
<button igxButton="contained" (click)="setToNull()">Set To Null</button>
</div>
<igx-switch [(ngModel)]="selectRequired" [ngModelOptions]="{standalone: true}">Required</igx-switch>
<form class="select-sample__form">
<igx-select #model="ngModel"
[(ngModel)]="selected"
[ngModelOptions]="{standalone: true}"
[required]="selectRequired"
[placeholder]="'Pick One'">
<label igxLabel>Favorite fruit</label>
<span igxPrefix>Fruit</span>
<igx-select-item> None </igx-select-item>
@for (fruit of fruits; track fruit) {
<igx-select-item [value]="fruit">
{{fruit}}
</igx-select-item>
}
</igx-select>
<div>Selected: {{selected}}</div>
<div>Valid: {{model.valid}}</div>
</form>
</section>
</div>