@exhaustive-ui/mcp 22.5.0 → 22.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/cards/accordion.md +5 -2
- package/data/cards/animateonscroll.md +8 -5
- package/data/cards/autocomplete.md +8 -3
- package/data/cards/autofocus.md +4 -2
- package/data/cards/avatar.md +4 -2
- package/data/cards/badge.md +2 -1
- package/data/cards/breadcrumb.md +3 -1
- package/data/cards/button.md +8 -2
- package/data/cards/card.md +2 -1
- package/data/cards/carousel.md +7 -5
- package/data/cards/cascadeselect.md +2 -6
- package/data/cards/chart.md +9 -7
- package/data/cards/checkbox.md +4 -3
- package/data/cards/chip.md +2 -1
- package/data/cards/classnames.md +21 -3
- package/data/cards/colorpicker.md +2 -1
- package/data/cards/confirmdialog.md +35 -5
- package/data/cards/confirmpopup.md +25 -3
- package/data/cards/contextmenu.md +1 -7
- package/data/cards/dataview.md +28 -9
- package/data/cards/datepicker.md +4 -3
- package/data/cards/dialog.md +3 -3
- package/data/cards/divider.md +2 -1
- package/data/cards/dock.md +24 -3
- package/data/cards/dragdrop.md +5 -1
- package/data/cards/drawer.md +3 -3
- package/data/cards/dynamicdialog.md +41 -14
- package/data/cards/editor.md +1 -1
- package/data/cards/fieldset.md +2 -1
- package/data/cards/fileinput.md +1 -1
- package/data/cards/fileupload.md +7 -8
- package/data/cards/floatlabel.md +1 -1
- package/data/cards/fluid.md +7 -5
- package/data/cards/focustrap.md +6 -2
- package/data/cards/galleria.md +18 -25
- package/data/cards/iconfield.md +3 -2
- package/data/cards/iftalabel.md +1 -1
- package/data/cards/image.md +4 -2
- package/data/cards/imagecompare.md +4 -3
- package/data/cards/inplace.md +2 -1
- package/data/cards/inputgroup.md +14 -3
- package/data/cards/inputmask.md +2 -2
- package/data/cards/inputnumber.md +4 -3
- package/data/cards/inputotp.md +2 -2
- package/data/cards/inputtext.md +2 -2
- package/data/cards/keyfilter.md +2 -1
- package/data/cards/knob.md +3 -2
- package/data/cards/listbox.md +5 -3
- package/data/cards/megamenu.md +7 -8
- package/data/cards/menu.md +3 -7
- package/data/cards/menubar.md +3 -7
- package/data/cards/message.md +2 -1
- package/data/cards/metergroup.md +3 -7
- package/data/cards/multiselect.md +5 -9
- package/data/cards/orderlist.md +6 -4
- package/data/cards/organizationchart.md +33 -6
- package/data/cards/overlay.md +2 -1
- package/data/cards/paginator.md +2 -1
- package/data/cards/panel.md +2 -1
- package/data/cards/panelmenu.md +4 -13
- package/data/cards/password.md +6 -3
- package/data/cards/picklist.md +9 -5
- package/data/cards/popover.md +6 -5
- package/data/cards/progressbar.md +4 -3
- package/data/cards/progressspinner.md +2 -1
- package/data/cards/radiobutton.md +4 -3
- package/data/cards/rating.md +1 -1
- package/data/cards/ripple.md +2 -1
- package/data/cards/scrollpanel.md +2 -1
- package/data/cards/scrolltop.md +5 -3
- package/data/cards/select.md +2 -1
- package/data/cards/selectbutton.md +6 -2
- package/data/cards/skeleton.md +2 -1
- package/data/cards/slider.md +4 -3
- package/data/cards/speeddial.md +7 -4
- package/data/cards/splitbutton.md +21 -18
- package/data/cards/splitter.md +2 -1
- package/data/cards/stepper.md +8 -3
- package/data/cards/styleclass.md +4 -2
- package/data/cards/table.md +46 -11
- package/data/cards/tabs.md +2 -1
- package/data/cards/tag.md +2 -1
- package/data/cards/terminal.md +31 -22
- package/data/cards/textarea.md +3 -2
- package/data/cards/tieredmenu.md +1 -6
- package/data/cards/timeline.md +5 -5
- package/data/cards/toast.md +7 -8
- package/data/cards/togglebutton.md +1 -1
- package/data/cards/toggleswitch.md +4 -3
- package/data/cards/toolbar.md +8 -8
- package/data/cards/tooltip.md +2 -1
- package/data/cards/tree.md +3 -6
- package/data/cards/treeselect.md +6 -7
- package/data/cards/treetable.md +52 -31
- package/data/components/accordion.md +31 -23
- package/data/components/animateonscroll.md +18 -15
- package/data/components/autocomplete.md +162 -93
- package/data/components/autofocus.md +9 -7
- package/data/components/avatar.md +56 -43
- package/data/components/badge.md +27 -18
- package/data/components/blockui.md +15 -8
- package/data/components/breadcrumb.md +20 -14
- package/data/components/button.md +121 -94
- package/data/components/card.md +12 -10
- package/data/components/carousel.md +75 -53
- package/data/components/cascadeselect.md +271 -238
- package/data/components/chart.md +88 -74
- package/data/components/checkbox.md +107 -73
- package/data/components/chip.md +20 -16
- package/data/components/classnames.md +22 -4
- package/data/components/colorpicker.md +54 -36
- package/data/components/confirmdialog.md +146 -43
- package/data/components/confirmpopup.md +95 -22
- package/data/components/contextmenu.md +110 -39
- package/data/components/dataview.md +176 -83
- package/data/components/datepicker.md +171 -141
- package/data/components/dialog.md +80 -68
- package/data/components/divider.md +17 -12
- package/data/components/dock.md +63 -27
- package/data/components/dragdrop.md +26 -12
- package/data/components/drawer.md +67 -48
- package/data/components/dynamicdialog.md +22 -13
- package/data/components/editor.md +42 -33
- package/data/components/fieldset.md +20 -17
- package/data/components/fileinput.md +92 -35
- package/data/components/fileupload.md +101 -61
- package/data/components/floatlabel.md +20 -11
- package/data/components/fluid.md +11 -9
- package/data/components/focustrap.md +11 -7
- package/data/components/galleria.md +224 -83
- package/data/components/iconfield.md +23 -15
- package/data/components/iftalabel.md +15 -9
- package/data/components/image.md +31 -26
- package/data/components/imagecompare.md +8 -6
- package/data/components/inplace.md +27 -22
- package/data/components/inputgroup.md +53 -29
- package/data/components/inputmask.md +107 -85
- package/data/components/inputnumber.md +127 -89
- package/data/components/inputotp.md +55 -42
- package/data/components/inputtext.md +72 -50
- package/data/components/keyfilter.md +6 -3
- package/data/components/knob.md +70 -58
- package/data/components/listbox.md +171 -141
- package/data/components/megamenu.md +24 -23
- package/data/components/menu.md +37 -34
- package/data/components/menubar.md +27 -22
- package/data/components/message.md +44 -32
- package/data/components/metergroup.md +48 -17
- package/data/components/multiselect.md +232 -168
- package/data/components/orderlist.md +55 -48
- package/data/components/organizationchart.md +182 -13
- package/data/components/overlay.md +31 -26
- package/data/components/paginator.md +49 -34
- package/data/components/panel.md +23 -19
- package/data/components/panelmenu.md +51 -25
- package/data/components/password.md +104 -91
- package/data/components/picklist.md +92 -70
- package/data/components/popover.md +68 -46
- package/data/components/progressbar.md +28 -22
- package/data/components/progressspinner.md +13 -11
- package/data/components/radiobutton.md +69 -35
- package/data/components/rating.md +48 -40
- package/data/components/ripple.md +8 -6
- package/data/components/scroller.md +29 -29
- package/data/components/scrollpanel.md +9 -7
- package/data/components/scrolltop.md +20 -18
- package/data/components/select.md +248 -169
- package/data/components/selectbutton.md +118 -56
- package/data/components/skeleton.md +22 -18
- package/data/components/slider.md +73 -49
- package/data/components/speeddial.md +77 -59
- package/data/components/splitbutton.md +354 -329
- package/data/components/splitter.md +22 -18
- package/data/components/stepper.md +38 -21
- package/data/components/styleclass.md +12 -6
- package/data/components/table.md +523 -314
- package/data/components/tabs.md +44 -26
- package/data/components/tag.md +18 -14
- package/data/components/terminal.md +38 -27
- package/data/components/textarea.md +82 -47
- package/data/components/tieredmenu.md +34 -29
- package/data/components/timeline.md +29 -28
- package/data/components/toast.md +115 -57
- package/data/components/togglebutton.md +53 -39
- package/data/components/toggleswitch.md +41 -28
- package/data/components/toolbar.md +19 -18
- package/data/components/tooltip.md +43 -32
- package/data/components/tree.md +114 -81
- package/data/components/treeselect.md +176 -174
- package/data/components/treetable.md +1250 -1045
- package/data/components.json +4122 -4080
- package/data/llms-full.txt +8784 -6249
- package/data/manifest.json +154 -15
- package/data/pages/tailwind.md +20 -10
- package/data/snapshot.json +2 -2
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -11,11 +11,13 @@ Screen Reader Value to describe the component can either be provided via label t
|
|
|
11
11
|
This example demonstrates an advanced use case with templating, object handling, dropdown, and multiple mode.
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import {
|
|
14
|
+
import { CommonModule } from '@angular/common';
|
|
15
|
+
import { Component, OnInit, signal, inject } from '@angular/core';
|
|
15
16
|
import { FormsModule } from '@angular/forms';
|
|
16
17
|
import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
17
|
-
import {
|
|
18
|
+
import { ChipModule } from '@exhaustive-ui/core/chip';
|
|
18
19
|
import { Product } from '@/domain/product';
|
|
20
|
+
import { ProductService } from '@/service/productservice';
|
|
19
21
|
|
|
20
22
|
@Component({
|
|
21
23
|
template: `
|
|
@@ -25,6 +27,7 @@ import { Product } from '@/domain/product';
|
|
|
25
27
|
[suggestions]="filteredProducts"
|
|
26
28
|
(completeMethod)="filterProducts($event)"
|
|
27
29
|
inputId="advanced-chips"
|
|
30
|
+
ariaLabel="Products"
|
|
28
31
|
[multiple]="true"
|
|
29
32
|
[fluid]="true"
|
|
30
33
|
[typeahead]="false"
|
|
@@ -45,7 +48,7 @@ import { Product } from '@/domain/product';
|
|
|
45
48
|
</ng-template>
|
|
46
49
|
<ng-template let-value #selecteditem>
|
|
47
50
|
@if (value.price) {
|
|
48
|
-
<div class="flex
|
|
51
|
+
<div class="flex items-center gap-2">
|
|
49
52
|
<span class="font-semibold">{{ value.name }}</span>
|
|
50
53
|
<span class="text-primary text-sm font-bold">\${{ value.price }}</span>
|
|
51
54
|
</div>
|
|
@@ -57,28 +60,33 @@ import { Product } from '@/domain/product';
|
|
|
57
60
|
</div>
|
|
58
61
|
`,
|
|
59
62
|
standalone: true,
|
|
60
|
-
imports: [AutoCompleteModule,
|
|
63
|
+
imports: [CommonModule, FormsModule, AutoCompleteModule, ChipModule],
|
|
61
64
|
providers: [ProductService]
|
|
62
65
|
})
|
|
63
66
|
export class AutocompleteAdvancedChipsDemo implements OnInit {
|
|
64
67
|
private productService = inject(ProductService);
|
|
68
|
+
|
|
65
69
|
products = signal<Product[]>([]);
|
|
66
70
|
|
|
67
71
|
ngOnInit() {
|
|
68
72
|
this.productService.getProductsSmall().then((data) => this.products.set(data));
|
|
69
73
|
}
|
|
70
74
|
|
|
75
|
+
selectedProducts = signal<any[]>([]);
|
|
76
|
+
|
|
77
|
+
filteredProducts: Product[] = [];
|
|
78
|
+
|
|
71
79
|
filterProducts(event: any) {
|
|
72
80
|
let filtered: Product[] = [];
|
|
73
81
|
let query = event.query;
|
|
74
|
-
|
|
82
|
+
|
|
75
83
|
for (let i = 0; i < this.products().length; i++) {
|
|
76
84
|
let product = this.products()[i];
|
|
77
85
|
if (product.name?.toLowerCase().indexOf(query.toLowerCase()) == 0) {
|
|
78
86
|
filtered.push(product);
|
|
79
87
|
}
|
|
80
88
|
}
|
|
81
|
-
|
|
89
|
+
|
|
82
90
|
this.filteredProducts = filtered;
|
|
83
91
|
}
|
|
84
92
|
|
|
@@ -115,18 +123,29 @@ import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
|
115
123
|
@Component({
|
|
116
124
|
template: `
|
|
117
125
|
<div class="card">
|
|
118
|
-
<label for="chips-blur" class="font-bold mb-2 block">With Add On Blur</label>
|
|
119
|
-
<p-auto-complete [(ngModel)]="valueBlur" inputId="chips-blur" multiple fluid [typeahead]="false" [addOnBlur]="true" placeholder="Type and click outside to add..." />
|
|
120
|
-
<label for="chips-tab" class="font-bold mt-8 mb-2 block">With Add On Tab</label>
|
|
121
|
-
<p-auto-complete [(ngModel)]="valueTab" inputId="chips-tab" multiple fluid [typeahead]="false" [addOnTab]="true" placeholder="Type and press Tab to add..." />
|
|
122
|
-
<label for="chips-separator" class="font-bold mt-8 mb-2 block">With Separator (Comma)</label>
|
|
123
|
-
<p-auto-complete [(ngModel)]="valueSeparator" inputId="chips-separator" multiple fluid [typeahead]="false" separator="," placeholder="Type items separated by comma..." />
|
|
124
|
-
<label for="chips-combined" class="font-bold mt-8 mb-2 block">Combined Features</label>
|
|
125
|
-
<p-auto-complete
|
|
126
|
+
<label id="chips-blur-label" for="chips-blur" class="font-bold mb-2 block">With Add On Blur</label>
|
|
127
|
+
<p-auto-complete [(ngModel)]="valueBlur" inputId="chips-blur" ariaLabelledBy="chips-blur-label" multiple fluid [typeahead]="false" [addOnBlur]="true" placeholder="Type and click outside to add..." />
|
|
128
|
+
<label id="chips-tab-label" for="chips-tab" class="font-bold mt-8 mb-2 block">With Add On Tab</label>
|
|
129
|
+
<p-auto-complete [(ngModel)]="valueTab" inputId="chips-tab" ariaLabelledBy="chips-tab-label" multiple fluid [typeahead]="false" [addOnTab]="true" placeholder="Type and press Tab to add..." />
|
|
130
|
+
<label id="chips-separator-label" for="chips-separator" class="font-bold mt-8 mb-2 block">With Separator (Comma)</label>
|
|
131
|
+
<p-auto-complete [(ngModel)]="valueSeparator" inputId="chips-separator" ariaLabelledBy="chips-separator-label" multiple fluid [typeahead]="false" separator="," placeholder="Type items separated by comma..." />
|
|
132
|
+
<label id="chips-combined-label" for="chips-combined" class="font-bold mt-8 mb-2 block">Combined Features</label>
|
|
133
|
+
<p-auto-complete
|
|
134
|
+
[(ngModel)]="valueCombined"
|
|
135
|
+
inputId="chips-combined"
|
|
136
|
+
ariaLabelledBy="chips-combined-label"
|
|
137
|
+
multiple
|
|
138
|
+
fluid
|
|
139
|
+
[typeahead]="false"
|
|
140
|
+
[addOnBlur]="true"
|
|
141
|
+
[addOnTab]="true"
|
|
142
|
+
separator=","
|
|
143
|
+
placeholder="Use Tab, Blur, or Comma to add items..."
|
|
144
|
+
/>
|
|
126
145
|
</div>
|
|
127
146
|
`,
|
|
128
147
|
standalone: true,
|
|
129
|
-
imports: [
|
|
148
|
+
imports: [FormsModule, AutoCompleteModule]
|
|
130
149
|
})
|
|
131
150
|
export class AutocompleteBasicChipsDemo {
|
|
132
151
|
valueBlur: any[] = [];
|
|
@@ -141,6 +160,7 @@ export class AutocompleteBasicChipsDemo {
|
|
|
141
160
|
AutoComplete uses ngModel for two-way binding, requires a list of suggestions and a completeMethod to query for the results. The completeMethod gets the query text as event.query property and should update the suggestions with the search results.
|
|
142
161
|
|
|
143
162
|
```typescript
|
|
163
|
+
import { CommonModule } from '@angular/common';
|
|
144
164
|
import { Component } from '@angular/core';
|
|
145
165
|
import { FormsModule } from '@angular/forms';
|
|
146
166
|
import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
@@ -153,14 +173,15 @@ interface AutoCompleteCompleteEvent {
|
|
|
153
173
|
@Component({
|
|
154
174
|
template: `
|
|
155
175
|
<div class="card flex justify-center">
|
|
156
|
-
<p-auto-complete [(ngModel)]="value" [suggestions]="items" (completeMethod)="search($event)" />
|
|
176
|
+
<p-auto-complete [(ngModel)]="value" ariaLabel="Search" [suggestions]="items" (completeMethod)="search($event)" />
|
|
157
177
|
</div>
|
|
158
178
|
`,
|
|
159
179
|
standalone: true,
|
|
160
|
-
imports: [
|
|
180
|
+
imports: [CommonModule, FormsModule, AutoCompleteModule]
|
|
161
181
|
})
|
|
162
182
|
export class AutocompleteBasicDemo {
|
|
163
183
|
items: any[] = [];
|
|
184
|
+
|
|
164
185
|
value: any;
|
|
165
186
|
|
|
166
187
|
search(event: AutoCompleteCompleteEvent) {
|
|
@@ -186,14 +207,15 @@ interface AutoCompleteCompleteEvent {
|
|
|
186
207
|
@Component({
|
|
187
208
|
template: `
|
|
188
209
|
<div class="card flex justify-center">
|
|
189
|
-
<p-auto-complete [(ngModel)]="value" [suggestions]="items" (completeMethod)="search($event)" [showClear]="true" inputStyleClass="w-56" />
|
|
210
|
+
<p-auto-complete [(ngModel)]="value" ariaLabel="Search" [suggestions]="items" (completeMethod)="search($event)" [showClear]="true" inputStyleClass="w-56" />
|
|
190
211
|
</div>
|
|
191
212
|
`,
|
|
192
213
|
standalone: true,
|
|
193
|
-
imports: [
|
|
214
|
+
imports: [FormsModule, AutoCompleteModule]
|
|
194
215
|
})
|
|
195
216
|
export class AutocompleteClearIconDemo {
|
|
196
217
|
items: any[] = [];
|
|
218
|
+
|
|
197
219
|
value: any;
|
|
198
220
|
|
|
199
221
|
search(event: AutoCompleteCompleteEvent) {
|
|
@@ -219,15 +241,15 @@ interface AutoCompleteCompleteEvent {
|
|
|
219
241
|
@Component({
|
|
220
242
|
template: `
|
|
221
243
|
<div class="card flex justify-center">
|
|
222
|
-
<p-auto-complete [(ngModel)]="selectedItem" [suggestions]="suggestions" placeholder="Disabled" (completeMethod)="search($event)" [disabled]="true" />
|
|
244
|
+
<p-auto-complete [(ngModel)]="selectedItem" ariaLabel="Search" [suggestions]="suggestions" placeholder="Disabled" (completeMethod)="search($event)" [disabled]="true" />
|
|
223
245
|
</div>
|
|
224
246
|
`,
|
|
225
247
|
standalone: true,
|
|
226
|
-
imports: [
|
|
248
|
+
imports: [FormsModule, AutoCompleteModule]
|
|
227
249
|
})
|
|
228
250
|
export class AutocompleteDisabledDemo {
|
|
229
|
-
items: any[] | undefined;
|
|
230
251
|
selectedItem: any;
|
|
252
|
+
|
|
231
253
|
suggestions: any[] | undefined;
|
|
232
254
|
|
|
233
255
|
search(event: AutoCompleteCompleteEvent) {
|
|
@@ -253,19 +275,20 @@ interface AutoCompleteCompleteEvent {
|
|
|
253
275
|
@Component({
|
|
254
276
|
template: `
|
|
255
277
|
<div class="card flex justify-center">
|
|
256
|
-
<p-auto-complete [(ngModel)]="value" [dropdown]="true" [suggestions]="items" (completeMethod)="search($event)" />
|
|
278
|
+
<p-auto-complete [(ngModel)]="value" ariaLabel="Search" [dropdown]="true" [suggestions]="items" (completeMethod)="search($event)" />
|
|
257
279
|
</div>
|
|
258
280
|
`,
|
|
259
281
|
standalone: true,
|
|
260
|
-
imports: [
|
|
282
|
+
imports: [FormsModule, AutoCompleteModule]
|
|
261
283
|
})
|
|
262
284
|
export class AutocompleteDropdownDemo {
|
|
263
285
|
items: any[] | undefined;
|
|
286
|
+
|
|
264
287
|
value: any;
|
|
265
288
|
|
|
266
289
|
search(event: AutoCompleteCompleteEvent) {
|
|
267
290
|
let _items = [...Array(10).keys()];
|
|
268
|
-
|
|
291
|
+
|
|
269
292
|
this.items = event.query ? [...Array(10).keys()].map((item) => event.query + '-' + item) : _items;
|
|
270
293
|
}
|
|
271
294
|
}
|
|
@@ -288,15 +311,15 @@ interface AutoCompleteCompleteEvent {
|
|
|
288
311
|
@Component({
|
|
289
312
|
template: `
|
|
290
313
|
<div class="card flex justify-center">
|
|
291
|
-
<p-auto-complete [(ngModel)]="selectedItem" [suggestions]="suggestions" (completeMethod)="search($event)" variant="filled" />
|
|
314
|
+
<p-auto-complete [(ngModel)]="selectedItem" ariaLabel="Search" [suggestions]="suggestions" (completeMethod)="search($event)" variant="filled" />
|
|
292
315
|
</div>
|
|
293
316
|
`,
|
|
294
317
|
standalone: true,
|
|
295
|
-
imports: [
|
|
318
|
+
imports: [FormsModule, AutoCompleteModule]
|
|
296
319
|
})
|
|
297
320
|
export class AutocompleteFilledDemo {
|
|
298
|
-
items: any[] | undefined;
|
|
299
321
|
selectedItem: any;
|
|
322
|
+
|
|
300
323
|
suggestions: any[] | undefined;
|
|
301
324
|
|
|
302
325
|
search(event: AutoCompleteCompleteEvent) {
|
|
@@ -312,6 +335,7 @@ A floating label appears on top of the input field when focused. Visit FloatLabe
|
|
|
312
335
|
```typescript
|
|
313
336
|
import { Component } from '@angular/core';
|
|
314
337
|
import { FormsModule } from '@angular/forms';
|
|
338
|
+
import { RouterModule } from '@angular/router';
|
|
315
339
|
import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
316
340
|
import { FloatLabelModule } from '@exhaustive-ui/core/floatlabel';
|
|
317
341
|
|
|
@@ -338,12 +362,15 @@ interface AutoCompleteCompleteEvent {
|
|
|
338
362
|
</div>
|
|
339
363
|
`,
|
|
340
364
|
standalone: true,
|
|
341
|
-
imports: [AutoCompleteModule, FloatLabelModule,
|
|
365
|
+
imports: [FormsModule, AutoCompleteModule, FloatLabelModule, RouterModule]
|
|
342
366
|
})
|
|
343
367
|
export class AutocompleteFloatLabelDemo {
|
|
344
368
|
value1: string | undefined;
|
|
369
|
+
|
|
345
370
|
value2: string | undefined;
|
|
371
|
+
|
|
346
372
|
value3: string | undefined;
|
|
373
|
+
|
|
347
374
|
items: any[] | undefined;
|
|
348
375
|
|
|
349
376
|
search(event: AutoCompleteCompleteEvent) {
|
|
@@ -369,14 +396,15 @@ interface AutoCompleteCompleteEvent {
|
|
|
369
396
|
@Component({
|
|
370
397
|
template: `
|
|
371
398
|
<div class="card">
|
|
372
|
-
<p-auto-complete [(ngModel)]="value" [suggestions]="items" (completeMethod)="search($event)" fluid />
|
|
399
|
+
<p-auto-complete [(ngModel)]="value" ariaLabel="Search" [suggestions]="items" (completeMethod)="search($event)" fluid />
|
|
373
400
|
</div>
|
|
374
401
|
`,
|
|
375
402
|
standalone: true,
|
|
376
|
-
imports: [
|
|
403
|
+
imports: [FormsModule, AutoCompleteModule]
|
|
377
404
|
})
|
|
378
405
|
export class AutocompleteFluidDemo {
|
|
379
406
|
items: any[] = [];
|
|
407
|
+
|
|
380
408
|
value: any;
|
|
381
409
|
|
|
382
410
|
search(event: AutoCompleteCompleteEvent) {
|
|
@@ -403,17 +431,20 @@ interface AutoCompleteCompleteEvent {
|
|
|
403
431
|
@Component({
|
|
404
432
|
template: `
|
|
405
433
|
<div class="card flex justify-center">
|
|
406
|
-
<p-auto-complete [(ngModel)]="selectedCountry" [forceSelection]="true" [suggestions]="filteredCountries" (completeMethod)="filterCountry($event)" optionLabel="name" />
|
|
434
|
+
<p-auto-complete [(ngModel)]="selectedCountry" ariaLabel="Country" [forceSelection]="true" [suggestions]="filteredCountries" (completeMethod)="filterCountry($event)" optionLabel="name" />
|
|
407
435
|
</div>
|
|
408
436
|
`,
|
|
409
437
|
standalone: true,
|
|
410
|
-
imports: [
|
|
438
|
+
imports: [FormsModule, AutoCompleteModule],
|
|
411
439
|
providers: [CountryService]
|
|
412
440
|
})
|
|
413
441
|
export class AutocompleteForceSelectionDemo implements OnInit {
|
|
414
442
|
private countryService = inject(CountryService);
|
|
443
|
+
|
|
415
444
|
countries: any[] | undefined;
|
|
445
|
+
|
|
416
446
|
selectedCountry: any;
|
|
447
|
+
|
|
417
448
|
filteredCountries: any[] | undefined;
|
|
418
449
|
|
|
419
450
|
ngOnInit() {
|
|
@@ -425,14 +456,14 @@ export class AutocompleteForceSelectionDemo implements OnInit {
|
|
|
425
456
|
filterCountry(event: AutoCompleteCompleteEvent) {
|
|
426
457
|
let filtered: any[] = [];
|
|
427
458
|
let query = event.query;
|
|
428
|
-
|
|
459
|
+
|
|
429
460
|
for (let i = 0; i < (this.countries as any[]).length; i++) {
|
|
430
461
|
let country = (this.countries as any[])[i];
|
|
431
462
|
if (country.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {
|
|
432
463
|
filtered.push(country);
|
|
433
464
|
}
|
|
434
465
|
}
|
|
435
|
-
|
|
466
|
+
|
|
436
467
|
this.filteredCountries = filtered;
|
|
437
468
|
}
|
|
438
469
|
}
|
|
@@ -443,10 +474,11 @@ export class AutocompleteForceSelectionDemo implements OnInit {
|
|
|
443
474
|
Option grouping is enabled when group property is set to true . group template is available to customize the option groups. All templates get the option instance as the default local template variable.
|
|
444
475
|
|
|
445
476
|
```typescript
|
|
446
|
-
import { Component, OnInit } from '@angular/core';
|
|
477
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
478
|
+
import { CommonModule } from '@angular/common';
|
|
447
479
|
import { FormsModule } from '@angular/forms';
|
|
480
|
+
import { FilterService, SelectItemGroup } from '@exhaustive-ui/core/api';
|
|
448
481
|
import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
449
|
-
import { SelectItemGroup, FilterService } from '@exhaustive-ui/core/api';
|
|
450
482
|
|
|
451
483
|
interface AutoCompleteCompleteEvent {
|
|
452
484
|
originalEvent: Event;
|
|
@@ -456,7 +488,7 @@ interface AutoCompleteCompleteEvent {
|
|
|
456
488
|
@Component({
|
|
457
489
|
template: `
|
|
458
490
|
<div class="card flex justify-center">
|
|
459
|
-
<p-auto-complete [(ngModel)]="selectedCity" [group]="true" [suggestions]="filteredGroups" (completeMethod)="filterGroupedCity($event)" placeholder="Hint: type 'a'">
|
|
491
|
+
<p-auto-complete [(ngModel)]="selectedCity" ariaLabel="City" [group]="true" [suggestions]="filteredGroups" (completeMethod)="filterGroupedCity($event)" placeholder="Hint: type 'a'">
|
|
460
492
|
<ng-template let-group #group>
|
|
461
493
|
<div class="flex items-center">
|
|
462
494
|
<img src="https://exhaustive-ui.com/demo/flag/flag_placeholder.png" [class]="'mr-2 flag flag-' + group.value" style="width: 20px" />
|
|
@@ -467,11 +499,15 @@ interface AutoCompleteCompleteEvent {
|
|
|
467
499
|
</div>
|
|
468
500
|
`,
|
|
469
501
|
standalone: true,
|
|
470
|
-
imports: [
|
|
502
|
+
imports: [CommonModule, FormsModule, AutoCompleteModule]
|
|
471
503
|
})
|
|
472
504
|
export class AutocompleteGroupDemo implements OnInit {
|
|
505
|
+
private filterService = inject(FilterService);
|
|
506
|
+
|
|
473
507
|
selectedCity: any;
|
|
508
|
+
|
|
474
509
|
filteredGroups: any[] | undefined;
|
|
510
|
+
|
|
475
511
|
groupedCities: SelectItemGroup[] | undefined;
|
|
476
512
|
|
|
477
513
|
ngOnInit() {
|
|
@@ -512,7 +548,7 @@ export class AutocompleteGroupDemo implements OnInit {
|
|
|
512
548
|
filterGroupedCity(event: AutoCompleteCompleteEvent) {
|
|
513
549
|
let query = event.query;
|
|
514
550
|
let filteredGroups = [];
|
|
515
|
-
|
|
551
|
+
|
|
516
552
|
for (let optgroup of this.groupedCities as SelectItemGroup[]) {
|
|
517
553
|
let filteredSubOptions = this.filterService.filter(optgroup.items, ['label'], query, 'contains');
|
|
518
554
|
if (filteredSubOptions && filteredSubOptions.length) {
|
|
@@ -523,7 +559,7 @@ export class AutocompleteGroupDemo implements OnInit {
|
|
|
523
559
|
});
|
|
524
560
|
}
|
|
525
561
|
}
|
|
526
|
-
|
|
562
|
+
|
|
527
563
|
this.filteredGroups = filteredGroups;
|
|
528
564
|
}
|
|
529
565
|
}
|
|
@@ -536,6 +572,7 @@ IftaLabel is used to create infield top aligned labels. Visit IftaLabel document
|
|
|
536
572
|
```typescript
|
|
537
573
|
import { Component } from '@angular/core';
|
|
538
574
|
import { FormsModule } from '@angular/forms';
|
|
575
|
+
import { RouterModule } from '@angular/router';
|
|
539
576
|
import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
540
577
|
import { IftaLabelModule } from '@exhaustive-ui/core/iftalabel';
|
|
541
578
|
|
|
@@ -554,10 +591,11 @@ interface AutoCompleteCompleteEvent {
|
|
|
554
591
|
</div>
|
|
555
592
|
`,
|
|
556
593
|
standalone: true,
|
|
557
|
-
imports: [AutoCompleteModule, IftaLabelModule,
|
|
594
|
+
imports: [FormsModule, AutoCompleteModule, IftaLabelModule, RouterModule]
|
|
558
595
|
})
|
|
559
596
|
export class AutocompleteIftaLabelDemo {
|
|
560
597
|
items: any[] | undefined;
|
|
598
|
+
|
|
561
599
|
value: any;
|
|
562
600
|
|
|
563
601
|
search(event: AutoCompleteCompleteEvent) {
|
|
@@ -583,16 +621,18 @@ interface AutoCompleteCompleteEvent {
|
|
|
583
621
|
@Component({
|
|
584
622
|
template: `
|
|
585
623
|
<div class="card flex flex-wrap justify-center gap-4">
|
|
586
|
-
<p-auto-complete [(ngModel)]="value1" [suggestions]="suggestions" [invalid]="!value1" (completeMethod)="search($event)" placeholder="Code" />
|
|
587
|
-
<p-auto-complete [(ngModel)]="value2" [suggestions]="suggestions" [invalid]="!value2" (completeMethod)="search($event)" variant="filled" placeholder="Code" />
|
|
624
|
+
<p-auto-complete [(ngModel)]="value1" ariaLabel="Code" [suggestions]="suggestions" [invalid]="!value1" (completeMethod)="search($event)" placeholder="Code" />
|
|
625
|
+
<p-auto-complete [(ngModel)]="value2" ariaLabel="Code" [suggestions]="suggestions" [invalid]="!value2" (completeMethod)="search($event)" variant="filled" placeholder="Code" />
|
|
588
626
|
</div>
|
|
589
627
|
`,
|
|
590
628
|
standalone: true,
|
|
591
|
-
imports: [
|
|
629
|
+
imports: [FormsModule, AutoCompleteModule]
|
|
592
630
|
})
|
|
593
631
|
export class AutocompleteInvalidDemo {
|
|
594
632
|
value1: any;
|
|
633
|
+
|
|
595
634
|
value2: any;
|
|
635
|
+
|
|
596
636
|
suggestions: any[] | undefined;
|
|
597
637
|
|
|
598
638
|
search(event: AutoCompleteCompleteEvent) {
|
|
@@ -618,18 +658,20 @@ interface AutoCompleteCompleteEvent {
|
|
|
618
658
|
@Component({
|
|
619
659
|
template: `
|
|
620
660
|
<div class="card">
|
|
621
|
-
<label for="multiple-ac-1" class="font-bold mb-2 block">With Typeahead</label>
|
|
622
|
-
<p-auto-complete [(ngModel)]="value1" inputId="multiple-ac-1" multiple fluid [suggestions]="items" (completeMethod)="search($event)" />
|
|
623
|
-
<label for="multiple-ac-2" class="font-bold mt-8 mb-2 block">Without Typeahead</label>
|
|
624
|
-
<p-auto-complete [(ngModel)]="value2" inputId="multiple-ac-2" multiple fluid (completeMethod)="search($event)" [typeahead]="false" />
|
|
661
|
+
<label id="multiple-ac-1-label" for="multiple-ac-1" class="font-bold mb-2 block">With Typeahead</label>
|
|
662
|
+
<p-auto-complete [(ngModel)]="value1" inputId="multiple-ac-1" ariaLabelledBy="multiple-ac-1-label" multiple fluid [suggestions]="items" (completeMethod)="search($event)" />
|
|
663
|
+
<label id="multiple-ac-2-label" for="multiple-ac-2" class="font-bold mt-8 mb-2 block">Without Typeahead</label>
|
|
664
|
+
<p-auto-complete [(ngModel)]="value2" inputId="multiple-ac-2" ariaLabelledBy="multiple-ac-2-label" multiple fluid (completeMethod)="search($event)" [typeahead]="false" />
|
|
625
665
|
</div>
|
|
626
666
|
`,
|
|
627
667
|
standalone: true,
|
|
628
|
-
imports: [
|
|
668
|
+
imports: [FormsModule, AutoCompleteModule]
|
|
629
669
|
})
|
|
630
670
|
export class AutocompleteMultipleDemo {
|
|
631
671
|
value1: any[] | undefined;
|
|
672
|
+
|
|
632
673
|
value2: any[] | undefined;
|
|
674
|
+
|
|
633
675
|
items: any[] | undefined;
|
|
634
676
|
|
|
635
677
|
search(event: AutoCompleteCompleteEvent) {
|
|
@@ -647,7 +689,6 @@ import { Component, OnInit, inject } from '@angular/core';
|
|
|
647
689
|
import { FormsModule } from '@angular/forms';
|
|
648
690
|
import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
649
691
|
import { CountryService } from '@/service/countryservice';
|
|
650
|
-
import { Country } from '@/domain/customer';
|
|
651
692
|
|
|
652
693
|
interface AutoCompleteCompleteEvent {
|
|
653
694
|
originalEvent: Event;
|
|
@@ -657,17 +698,20 @@ interface AutoCompleteCompleteEvent {
|
|
|
657
698
|
@Component({
|
|
658
699
|
template: `
|
|
659
700
|
<div class="card flex justify-center">
|
|
660
|
-
<p-auto-complete [(ngModel)]="selectedCountry" [suggestions]="filteredCountries" (completeMethod)="filterCountry($event)" optionLabel="name" />
|
|
701
|
+
<p-auto-complete [(ngModel)]="selectedCountry" ariaLabel="Country" [suggestions]="filteredCountries" (completeMethod)="filterCountry($event)" optionLabel="name" />
|
|
661
702
|
</div>
|
|
662
703
|
`,
|
|
663
704
|
standalone: true,
|
|
664
|
-
imports: [
|
|
705
|
+
imports: [FormsModule, AutoCompleteModule],
|
|
665
706
|
providers: [CountryService]
|
|
666
707
|
})
|
|
667
708
|
export class AutocompleteObjectsDemo implements OnInit {
|
|
668
709
|
private countryService = inject(CountryService);
|
|
710
|
+
|
|
669
711
|
countries: any[] | undefined;
|
|
712
|
+
|
|
670
713
|
selectedCountry: any;
|
|
714
|
+
|
|
671
715
|
filteredCountries: any[] | undefined;
|
|
672
716
|
|
|
673
717
|
ngOnInit() {
|
|
@@ -679,14 +723,14 @@ export class AutocompleteObjectsDemo implements OnInit {
|
|
|
679
723
|
filterCountry(event: AutoCompleteCompleteEvent) {
|
|
680
724
|
let filtered: any[] = [];
|
|
681
725
|
let query = event.query;
|
|
682
|
-
|
|
726
|
+
|
|
683
727
|
for (let i = 0; i < (this.countries as any[]).length; i++) {
|
|
684
728
|
let country = (this.countries as any[])[i];
|
|
685
729
|
if (country.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {
|
|
686
730
|
filtered.push(country);
|
|
687
731
|
}
|
|
688
732
|
}
|
|
689
|
-
|
|
733
|
+
|
|
690
734
|
this.filteredCountries = filtered;
|
|
691
735
|
}
|
|
692
736
|
}
|
|
@@ -698,12 +742,13 @@ AutoComplete can also be used with reactive forms. In this case, the formControl
|
|
|
698
742
|
|
|
699
743
|
```typescript
|
|
700
744
|
import { Component, inject } from '@angular/core';
|
|
701
|
-
import { ReactiveFormsModule } from '@angular/forms';
|
|
745
|
+
import { FormBuilder, FormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
746
|
+
import { CommonModule } from '@angular/common';
|
|
747
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
702
748
|
import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
703
|
-
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
704
749
|
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
750
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
705
751
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
706
|
-
import { MessageService } from '@exhaustive-ui/core/api';
|
|
707
752
|
|
|
708
753
|
interface AutoCompleteCompleteEvent {
|
|
709
754
|
originalEvent: Event;
|
|
@@ -716,7 +761,7 @@ interface AutoCompleteCompleteEvent {
|
|
|
716
761
|
<div class="card flex justify-center">
|
|
717
762
|
<form [formGroup]="exampleForm" (ngSubmit)="onSubmit()" class="flex justify-center flex-col gap-4 md:w-56">
|
|
718
763
|
<div class="flex flex-col gap-1">
|
|
719
|
-
<p-auto-complete formControlName="value" [suggestions]="items" [invalid]="isInvalid('value')" (completeMethod)="search($event)" fluid />
|
|
764
|
+
<p-auto-complete formControlName="value" ariaLabel="Value" [suggestions]="items" [invalid]="isInvalid('value')" (completeMethod)="search($event)" fluid />
|
|
720
765
|
@if (isInvalid('value')) {
|
|
721
766
|
<p-message severity="error" size="small" variant="simple">Value is required.</p-message>
|
|
722
767
|
}
|
|
@@ -726,18 +771,24 @@ interface AutoCompleteCompleteEvent {
|
|
|
726
771
|
</div>
|
|
727
772
|
`,
|
|
728
773
|
standalone: true,
|
|
729
|
-
imports: [
|
|
774
|
+
imports: [ReactiveFormsModule, AutoCompleteModule, ToastModule, MessageModule, ButtonModule, CommonModule],
|
|
775
|
+
providers: [MessageService]
|
|
730
776
|
})
|
|
731
777
|
export class AutocompleteReactiveFormsDemo {
|
|
778
|
+
private fb = inject(FormBuilder);
|
|
779
|
+
|
|
732
780
|
messageService = inject(MessageService);
|
|
781
|
+
|
|
733
782
|
items: any[] | undefined;
|
|
783
|
+
|
|
734
784
|
exampleForm: FormGroup | undefined;
|
|
785
|
+
|
|
735
786
|
formSubmitted: boolean = false;
|
|
736
787
|
|
|
737
788
|
constructor() {
|
|
738
789
|
this.exampleForm = this.fb.group({
|
|
739
|
-
|
|
740
|
-
|
|
790
|
+
value: ['', Validators.required]
|
|
791
|
+
});
|
|
741
792
|
}
|
|
742
793
|
|
|
743
794
|
search(event: AutoCompleteCompleteEvent) {
|
|
@@ -767,11 +818,11 @@ AutoComplete can also be used with Angular Signal Forms , the @angular/forms/sig
|
|
|
767
818
|
```typescript
|
|
768
819
|
import { Component, inject, signal } from '@angular/core';
|
|
769
820
|
import { form, FormField, required, submit } from '@angular/forms/signals';
|
|
821
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
770
822
|
import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
771
|
-
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
772
|
-
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
773
823
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
774
|
-
import {
|
|
824
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
825
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
775
826
|
|
|
776
827
|
interface AutoCompleteCompleteEvent {
|
|
777
828
|
originalEvent: Event;
|
|
@@ -784,7 +835,7 @@ interface AutoCompleteCompleteEvent {
|
|
|
784
835
|
<div class="card flex justify-center">
|
|
785
836
|
<form novalidate (submit)="onSubmit($event)" class="flex justify-center flex-col gap-4 md:w-56">
|
|
786
837
|
<div class="flex flex-col gap-1">
|
|
787
|
-
<p-auto-complete [formField]="exampleForm.value" [suggestions]="items" (completeMethod)="search($event)" fluid />
|
|
838
|
+
<p-auto-complete [formField]="exampleForm.value" ariaLabel="Value" [suggestions]="items" (completeMethod)="search($event)" fluid />
|
|
788
839
|
@let value = exampleForm.value();
|
|
789
840
|
@if (value.invalid() && value.touched()) {
|
|
790
841
|
<p-message severity="error" size="small" variant="simple">Value is required.</p-message>
|
|
@@ -795,12 +846,16 @@ interface AutoCompleteCompleteEvent {
|
|
|
795
846
|
</div>
|
|
796
847
|
`,
|
|
797
848
|
standalone: true,
|
|
798
|
-
imports: [AutoCompleteModule,
|
|
849
|
+
imports: [FormField, AutoCompleteModule, ButtonModule, ToastModule, MessageModule],
|
|
850
|
+
providers: [MessageService]
|
|
799
851
|
})
|
|
800
852
|
export class AutocompleteSignalformsDemo {
|
|
801
853
|
messageService = inject(MessageService);
|
|
854
|
+
|
|
802
855
|
items: any[] | undefined;
|
|
856
|
+
|
|
803
857
|
model = signal({ value: '' });
|
|
858
|
+
|
|
804
859
|
exampleForm = form(this.model, (f) => {
|
|
805
860
|
required(f.value);
|
|
806
861
|
});
|
|
@@ -831,18 +886,21 @@ import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
|
831
886
|
@Component({
|
|
832
887
|
template: `
|
|
833
888
|
<div class="card flex flex-col items-center gap-4">
|
|
834
|
-
<p-auto-complete [(ngModel)]="value1" [suggestions]="items" (completeMethod)="search()" size="small" placeholder="Small" dropdown />
|
|
835
|
-
<p-auto-complete [(ngModel)]="value2" [suggestions]="items" (completeMethod)="search()" placeholder="Normal" dropdown />
|
|
836
|
-
<p-auto-complete [(ngModel)]="value3" [suggestions]="items" (completeMethod)="search()" size="large" placeholder="Large" dropdown />
|
|
889
|
+
<p-auto-complete [(ngModel)]="value1" ariaLabel="Small" [suggestions]="items" (completeMethod)="search()" size="small" placeholder="Small" dropdown />
|
|
890
|
+
<p-auto-complete [(ngModel)]="value2" ariaLabel="Normal" [suggestions]="items" (completeMethod)="search()" placeholder="Normal" dropdown />
|
|
891
|
+
<p-auto-complete [(ngModel)]="value3" ariaLabel="Large" [suggestions]="items" (completeMethod)="search()" size="large" placeholder="Large" dropdown />
|
|
837
892
|
</div>
|
|
838
893
|
`,
|
|
839
894
|
standalone: true,
|
|
840
|
-
imports: [
|
|
895
|
+
imports: [FormsModule, AutoCompleteModule]
|
|
841
896
|
})
|
|
842
897
|
export class AutocompleteSizesDemo {
|
|
843
898
|
items: any[] | undefined;
|
|
899
|
+
|
|
844
900
|
value1: any;
|
|
901
|
+
|
|
845
902
|
value2: any;
|
|
903
|
+
|
|
846
904
|
value3: any;
|
|
847
905
|
|
|
848
906
|
search() {
|
|
@@ -856,7 +914,8 @@ export class AutocompleteSizesDemo {
|
|
|
856
914
|
AutoComplete offers multiple templates for customization through templating.
|
|
857
915
|
|
|
858
916
|
```typescript
|
|
859
|
-
import { Component,
|
|
917
|
+
import { Component, inject } from '@angular/core';
|
|
918
|
+
import { CommonModule } from '@angular/common';
|
|
860
919
|
import { FormsModule } from '@angular/forms';
|
|
861
920
|
import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
862
921
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
@@ -870,7 +929,7 @@ interface AutoCompleteCompleteEvent {
|
|
|
870
929
|
@Component({
|
|
871
930
|
template: `
|
|
872
931
|
<div class="card flex justify-center">
|
|
873
|
-
<p-auto-complete [(ngModel)]="selectedCountryAdvanced" [suggestions]="filteredCountries" (completeMethod)="filterCountry($event)" optionLabel="name">
|
|
932
|
+
<p-auto-complete [(ngModel)]="selectedCountryAdvanced" ariaLabel="Country" [suggestions]="filteredCountries" (completeMethod)="filterCountry($event)" optionLabel="name">
|
|
874
933
|
<ng-template let-country #item>
|
|
875
934
|
<div class="flex items-center gap-2">
|
|
876
935
|
<img src="https://exhaustive-ui.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + country.code.toLowerCase()" style="width: 18px" />
|
|
@@ -889,13 +948,16 @@ interface AutoCompleteCompleteEvent {
|
|
|
889
948
|
</div>
|
|
890
949
|
`,
|
|
891
950
|
standalone: true,
|
|
892
|
-
imports: [AutoCompleteModule, ButtonModule
|
|
951
|
+
imports: [CommonModule, FormsModule, AutoCompleteModule, ButtonModule],
|
|
893
952
|
providers: [CountryService]
|
|
894
953
|
})
|
|
895
|
-
export class AutocompleteTemplateDemo
|
|
954
|
+
export class AutocompleteTemplateDemo {
|
|
896
955
|
private countryService = inject(CountryService);
|
|
956
|
+
|
|
897
957
|
countries: any[] | undefined;
|
|
958
|
+
|
|
898
959
|
selectedCountryAdvanced: any[] | undefined;
|
|
960
|
+
|
|
899
961
|
filteredCountries: any[] | undefined;
|
|
900
962
|
|
|
901
963
|
ngOnInit() {
|
|
@@ -907,7 +969,7 @@ export class AutocompleteTemplateDemo implements OnInit {
|
|
|
907
969
|
filterCountry(event: AutoCompleteCompleteEvent) {
|
|
908
970
|
let filtered: any[] = [];
|
|
909
971
|
let query = event.query;
|
|
910
|
-
|
|
972
|
+
|
|
911
973
|
for (let i = 0; i < (this.countries as any[]).length; i++) {
|
|
912
974
|
let country = (this.countries as any[])[i];
|
|
913
975
|
if (country.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {
|
|
@@ -923,12 +985,14 @@ export class AutocompleteTemplateDemo implements OnInit {
|
|
|
923
985
|
|
|
924
986
|
```typescript
|
|
925
987
|
import { Component, inject } from '@angular/core';
|
|
988
|
+
import { CommonModule } from '@angular/common';
|
|
926
989
|
import { FormsModule } from '@angular/forms';
|
|
990
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
991
|
+
import { AutoCompleteCompleteEvent } from '@exhaustive-ui/core/autocomplete';
|
|
927
992
|
import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
928
|
-
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
929
993
|
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
994
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
930
995
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
931
|
-
import { MessageService } from '@exhaustive-ui/core/api';
|
|
932
996
|
|
|
933
997
|
@Component({
|
|
934
998
|
template: `
|
|
@@ -936,7 +1000,7 @@ import { MessageService } from '@exhaustive-ui/core/api';
|
|
|
936
1000
|
<div class="card flex justify-center">
|
|
937
1001
|
<form #exampleForm="ngForm" (ngSubmit)="onSubmit(exampleForm)" class="flex justify-center flex-col gap-4 md:w-56">
|
|
938
1002
|
<div class="flex flex-col gap-1">
|
|
939
|
-
<p-auto-complete #val="ngModel" [(ngModel)]="value" [suggestions]="items" [invalid]="val.invalid && (val.touched || exampleForm.submitted)" name="val" (completeMethod)="search($event)" required fluid />
|
|
1003
|
+
<p-auto-complete #val="ngModel" ariaLabel="Value" [(ngModel)]="value" [suggestions]="items" [invalid]="val.invalid && (val.touched || exampleForm.submitted)" name="val" (completeMethod)="search($event)" required fluid />
|
|
940
1004
|
@if (val.invalid && (val.touched || exampleForm.submitted)) {
|
|
941
1005
|
<p-message severity="error" size="small" variant="simple">Value is required.</p-message>
|
|
942
1006
|
}
|
|
@@ -946,11 +1010,14 @@ import { MessageService } from '@exhaustive-ui/core/api';
|
|
|
946
1010
|
</div>
|
|
947
1011
|
`,
|
|
948
1012
|
standalone: true,
|
|
949
|
-
imports: [
|
|
1013
|
+
imports: [CommonModule, FormsModule, AutoCompleteModule, ToastModule, MessageModule, ButtonModule],
|
|
1014
|
+
providers: [MessageService]
|
|
950
1015
|
})
|
|
951
1016
|
export class AutocompleteTemplateDrivenFormsDemo {
|
|
952
1017
|
messageService = inject(MessageService);
|
|
1018
|
+
|
|
953
1019
|
items: any[] = [];
|
|
1020
|
+
|
|
954
1021
|
value: any;
|
|
955
1022
|
|
|
956
1023
|
search(event: AutoCompleteCompleteEvent) {
|
|
@@ -971,7 +1038,7 @@ export class AutocompleteTemplateDrivenFormsDemo {
|
|
|
971
1038
|
Virtual scrolling is an efficient way of rendering the options by displaying a small subset of data in the viewport at any time. When dealing with huge number of options, it is suggested to enable virtual scrolling to avoid performance issues. Usage is simple as setting virtualScroll property to true and defining virtualScrollItemSize to specify the height of an item.
|
|
972
1039
|
|
|
973
1040
|
```typescript
|
|
974
|
-
import { Component
|
|
1041
|
+
import { Component } from '@angular/core';
|
|
975
1042
|
import { FormsModule } from '@angular/forms';
|
|
976
1043
|
import { AutoCompleteModule } from '@exhaustive-ui/core/autocomplete';
|
|
977
1044
|
|
|
@@ -983,38 +1050,40 @@ interface AutoCompleteCompleteEvent {
|
|
|
983
1050
|
@Component({
|
|
984
1051
|
template: `
|
|
985
1052
|
<div class="card flex justify-center">
|
|
986
|
-
<p-auto-complete [(ngModel)]="selectedItem" [virtualScroll]="true" [suggestions]="filteredItems" [virtualScrollItemSize]="34" (completeMethod)="filterItems($event)" optionLabel="label" [dropdown]="true" />
|
|
1053
|
+
<p-auto-complete [(ngModel)]="selectedItem" ariaLabel="Item" [virtualScroll]="true" [suggestions]="filteredItems" [virtualScrollItemSize]="34" (completeMethod)="filterItems($event)" optionLabel="label" [dropdown]="true" />
|
|
987
1054
|
</div>
|
|
988
1055
|
`,
|
|
989
1056
|
standalone: true,
|
|
990
|
-
imports: [
|
|
1057
|
+
imports: [FormsModule, AutoCompleteModule]
|
|
991
1058
|
})
|
|
992
|
-
export class AutocompleteVirtualScrollDemo
|
|
1059
|
+
export class AutocompleteVirtualScrollDemo {
|
|
993
1060
|
selectedItem: any;
|
|
1061
|
+
|
|
994
1062
|
filteredItems: any[] | undefined;
|
|
995
|
-
items: any[] | undefined;
|
|
996
1063
|
|
|
997
|
-
|
|
998
|
-
this.items = [];
|
|
999
|
-
for (let i = 0; i < 10000; i++) {
|
|
1000
|
-
this.items.push({ label: 'Item ' + i, value: 'Item ' + i });
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1064
|
+
items: any[] | undefined;
|
|
1003
1065
|
|
|
1004
1066
|
filterItems(event: AutoCompleteCompleteEvent) {
|
|
1005
1067
|
//in a real application, make a request to a remote url with the query and return filtered results, for demo we filter at client side
|
|
1006
1068
|
let filtered: any[] = [];
|
|
1007
1069
|
let query = event.query;
|
|
1008
|
-
|
|
1070
|
+
|
|
1009
1071
|
for (let i = 0; i < (this.items as any[]).length; i++) {
|
|
1010
1072
|
let item = (this.items as any[])[i];
|
|
1011
1073
|
if (item.label.toLowerCase().indexOf(query.toLowerCase()) == 0) {
|
|
1012
1074
|
filtered.push(item);
|
|
1013
1075
|
}
|
|
1014
1076
|
}
|
|
1015
|
-
|
|
1077
|
+
|
|
1016
1078
|
this.filteredItems = filtered;
|
|
1017
1079
|
}
|
|
1080
|
+
|
|
1081
|
+
ngOnInit() {
|
|
1082
|
+
this.items = [];
|
|
1083
|
+
for (let i = 0; i < 10000; i++) {
|
|
1084
|
+
this.items.push({ label: 'Item ' + i, value: 'Item ' + i });
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1018
1087
|
}
|
|
1019
1088
|
```
|
|
1020
1089
|
|