angular-perfect-select 1.1.0 → 2.0.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/README.md +271 -3
- package/dist/README.md +271 -3
- package/dist/fesm2022/angular-perfect-select.mjs +376 -10
- package/dist/fesm2022/angular-perfect-select.mjs.map +1 -1
- package/dist/index.d.ts +76 -3
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -20,6 +20,23 @@ A modern, feature-rich, and fully accessible select component for Angular applic
|
|
|
20
20
|
- **Forms Integration** - Full support for Angular template-driven and reactive forms
|
|
21
21
|
|
|
22
22
|
### Advanced Features
|
|
23
|
+
|
|
24
|
+
#### v2.0.0 Features 🆕
|
|
25
|
+
- **Virtual Scrolling** - Handle 10,000+ options without performance degradation using Angular CDK
|
|
26
|
+
- **Custom Option Templates** - Full control over option rendering with ng-template support
|
|
27
|
+
- **Validation States** - Visual error, warning, success, and info states with custom messages
|
|
28
|
+
- **Advanced Keyboard Shortcuts** - Ctrl+A, Ctrl+C/V, Home/End, and type-ahead navigation
|
|
29
|
+
- **Copy/Paste Support** - Copy selected values and paste comma-separated lists
|
|
30
|
+
- **Option Tooltips** - Display additional information on hover with configurable content
|
|
31
|
+
- **Recent Selections** - Show recently selected items at top with optional persistence
|
|
32
|
+
- **Infinite Scroll** - Load more options as user scrolls with pagination support
|
|
33
|
+
|
|
34
|
+
#### v1.1.0 Features
|
|
35
|
+
- **Max Selection Limit** - Limit the number of selections in multi-select mode with visual feedback
|
|
36
|
+
- **Search Debounce** - Configurable debounce delay for async loading to reduce API calls
|
|
37
|
+
- **Min Search Length** - Require minimum characters before filtering with helpful progress indicator
|
|
38
|
+
|
|
39
|
+
#### Core Features
|
|
23
40
|
- **Select All / Deselect All** - One-click selection for multi-select mode
|
|
24
41
|
- **Option Grouping** - Organize options into categories with sticky headers
|
|
25
42
|
- **Icons in Options** - Add visual elements (SVG or images) to options
|
|
@@ -41,19 +58,21 @@ A modern, feature-rich, and fully accessible select component for Angular applic
|
|
|
41
58
|
Install using npm:
|
|
42
59
|
|
|
43
60
|
```bash
|
|
44
|
-
npm install angular-perfect-select
|
|
61
|
+
npm install angular-perfect-select @angular/cdk
|
|
45
62
|
```
|
|
46
63
|
|
|
64
|
+
> **⚠️ v2.0.0 Breaking Change**: Angular CDK is now a required peer dependency. Make sure to install `@angular/cdk@^20.0.0` alongside the package.
|
|
65
|
+
|
|
47
66
|
Install using yarn:
|
|
48
67
|
|
|
49
68
|
```bash
|
|
50
|
-
yarn add angular-perfect-select
|
|
69
|
+
yarn add angular-perfect-select @angular/cdk
|
|
51
70
|
```
|
|
52
71
|
|
|
53
72
|
Install using pnpm:
|
|
54
73
|
|
|
55
74
|
```bash
|
|
56
|
-
pnpm add angular-perfect-select
|
|
75
|
+
pnpm add angular-perfect-select @angular/cdk
|
|
57
76
|
```
|
|
58
77
|
|
|
59
78
|
## Quick Start
|
|
@@ -105,3 +124,252 @@ import { PerfectSelectComponent } from 'angular-perfect-select';
|
|
|
105
124
|
export class AppModule { }
|
|
106
125
|
```
|
|
107
126
|
|
|
127
|
+
## Usage Examples
|
|
128
|
+
|
|
129
|
+
### Max Selection Limit (v1.1.0)
|
|
130
|
+
|
|
131
|
+
Limit the number of selections in multi-select mode:
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
<ng-perfect-select
|
|
135
|
+
[options]="options"
|
|
136
|
+
[isMulti]="true"
|
|
137
|
+
[maxSelectedOptions]="3"
|
|
138
|
+
maxSelectedMessage="You can only select up to 3 items"
|
|
139
|
+
[(ngModel)]="selectedValues"
|
|
140
|
+
></ng-perfect-select>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Search Debounce (v1.1.0)
|
|
144
|
+
|
|
145
|
+
Add debouncing to async search to reduce API calls:
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
<ng-perfect-select
|
|
149
|
+
[options]="[]"
|
|
150
|
+
[loadOptions]="loadCountries"
|
|
151
|
+
[debounceTime]="500"
|
|
152
|
+
[(ngModel)]="selectedCountry"
|
|
153
|
+
></ng-perfect-select>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
loadCountries = async (searchTerm: string): Promise<SelectOption[]> => {
|
|
158
|
+
const response = await fetch(`/api/countries?search=${searchTerm}`);
|
|
159
|
+
return response.json();
|
|
160
|
+
};
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Minimum Search Length (v1.1.0)
|
|
164
|
+
|
|
165
|
+
Require minimum characters before filtering options:
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
<ng-perfect-select
|
|
169
|
+
[options]="largeDataset"
|
|
170
|
+
[minSearchLength]="3"
|
|
171
|
+
minSearchMessage="Please enter at least 3 characters"
|
|
172
|
+
[(ngModel)]="selectedValue"
|
|
173
|
+
></ng-perfect-select>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Virtual Scrolling (v2.0.0)
|
|
177
|
+
|
|
178
|
+
Handle large datasets (10,000+ options) with virtual scrolling:
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
<ng-perfect-select
|
|
182
|
+
[options]="hugeDataset"
|
|
183
|
+
[enableVirtualScroll]="true"
|
|
184
|
+
[virtualScrollItemSize]="40"
|
|
185
|
+
[(ngModel)]="selectedValue"
|
|
186
|
+
></ng-perfect-select>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Custom Option Templates (v2.0.0)
|
|
190
|
+
|
|
191
|
+
Provide custom rendering for options:
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
<ng-perfect-select [options]="options" [(ngModel)]="selectedValue">
|
|
195
|
+
<ng-template #optionTemplate let-option let-selected="selected">
|
|
196
|
+
<div class="custom-option">
|
|
197
|
+
<img [src]="option.avatar" />
|
|
198
|
+
<div>
|
|
199
|
+
<strong>{{option.label}}</strong>
|
|
200
|
+
<span>{{option.email}}</span>
|
|
201
|
+
</div>
|
|
202
|
+
@if (selected) {
|
|
203
|
+
<span class="badge">Selected</span>
|
|
204
|
+
}
|
|
205
|
+
</div>
|
|
206
|
+
</ng-template>
|
|
207
|
+
</ng-perfect-select>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Validation States (v2.0.0)
|
|
211
|
+
|
|
212
|
+
Visual validation feedback for forms:
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
<ng-perfect-select
|
|
216
|
+
[options]="options"
|
|
217
|
+
validationState="error"
|
|
218
|
+
validationMessage="Please select at least one option"
|
|
219
|
+
[(ngModel)]="selectedValue"
|
|
220
|
+
></ng-perfect-select>
|
|
221
|
+
|
|
222
|
+
<!-- Available states: 'error', 'warning', 'success', 'info', 'default' -->
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Advanced Keyboard Shortcuts (v2.0.0)
|
|
226
|
+
|
|
227
|
+
Power-user keyboard navigation:
|
|
228
|
+
|
|
229
|
+
- **Ctrl/Cmd+A**: Select all options (multi-select)
|
|
230
|
+
- **Ctrl/Cmd+C**: Copy selected values to clipboard
|
|
231
|
+
- **Ctrl/Cmd+V**: Paste comma-separated values (multi-select)
|
|
232
|
+
- **Home**: Jump to first option
|
|
233
|
+
- **End**: Jump to last option
|
|
234
|
+
- **Type-ahead**: Type characters to jump to matching option
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
<ng-perfect-select
|
|
238
|
+
[options]="options"
|
|
239
|
+
[enableAdvancedKeyboard]="true"
|
|
240
|
+
[enableCopyPaste]="true"
|
|
241
|
+
[typeAheadDelay]="500"
|
|
242
|
+
[(ngModel)]="selectedValue"
|
|
243
|
+
></ng-perfect-select>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Copy/Paste Support (v2.0.0)
|
|
247
|
+
|
|
248
|
+
Copy selected values and paste comma-separated lists:
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
<ng-perfect-select
|
|
252
|
+
[options]="options"
|
|
253
|
+
[isMulti]="true"
|
|
254
|
+
[enableCopyPaste]="true"
|
|
255
|
+
[copyDelimiter]="', '"
|
|
256
|
+
[pasteDelimiter]=","
|
|
257
|
+
(copy)="onCopy($event)"
|
|
258
|
+
(paste)="onPaste($event)"
|
|
259
|
+
[(ngModel)]="selectedValues"
|
|
260
|
+
></ng-perfect-select>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Option Tooltips (v2.0.0)
|
|
264
|
+
|
|
265
|
+
Show additional information on hover:
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
<ng-perfect-select
|
|
269
|
+
[options]="optionsWithTooltips"
|
|
270
|
+
[showTooltips]="true"
|
|
271
|
+
[tooltipDelay]="300"
|
|
272
|
+
[(ngModel)]="selectedValue"
|
|
273
|
+
></ng-perfect-select>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
// Options with tooltip property
|
|
278
|
+
options = [
|
|
279
|
+
{ id: 1, label: 'Option 1', value: 'opt1', tooltip: 'This is a helpful tooltip' },
|
|
280
|
+
{ id: 2, label: 'Option 2', value: 'opt2', tooltip: 'Additional information here' }
|
|
281
|
+
];
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Recent Selections (v2.0.0)
|
|
285
|
+
|
|
286
|
+
Display recently selected items at the top:
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
<ng-perfect-select
|
|
290
|
+
[options]="options"
|
|
291
|
+
[showRecentSelections]="true"
|
|
292
|
+
[recentSelectionsLimit]="5"
|
|
293
|
+
[recentSelectionsLabel]="'Recently Selected'"
|
|
294
|
+
[enableRecentSelectionsPersistence]="true"
|
|
295
|
+
[(ngModel)]="selectedValue"
|
|
296
|
+
></ng-perfect-select>
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Infinite Scroll (v2.0.0)
|
|
300
|
+
|
|
301
|
+
Load more options as user scrolls:
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
<ng-perfect-select
|
|
305
|
+
[options]="options"
|
|
306
|
+
[enableInfiniteScroll]="true"
|
|
307
|
+
[infiniteScrollThreshold]="80"
|
|
308
|
+
(scrollEnd)="loadMoreOptions($event)"
|
|
309
|
+
[(ngModel)]="selectedValue"
|
|
310
|
+
></ng-perfect-select>
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
loadMoreOptions(event: SelectScrollEndEvent) {
|
|
315
|
+
// Load more data when user scrolls to 80% of the list
|
|
316
|
+
this.fetchMoreOptions().then(newOptions => {
|
|
317
|
+
this.options = [...this.options, ...newOptions];
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Multi-Select with Tags
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
<ng-perfect-select
|
|
326
|
+
[options]="options"
|
|
327
|
+
[isMulti]="true"
|
|
328
|
+
placeholder="Select multiple..."
|
|
329
|
+
[(ngModel)]="selectedValues"
|
|
330
|
+
></ng-perfect-select>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Async Loading with Caching
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
<ng-perfect-select
|
|
337
|
+
[loadOptions]="loadRemoteData"
|
|
338
|
+
[cacheOptions]="true"
|
|
339
|
+
[defaultOptions]="true"
|
|
340
|
+
[(ngModel)]="selectedValue"
|
|
341
|
+
></ng-perfect-select>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Creatable Options
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
<ng-perfect-select
|
|
348
|
+
[options]="options"
|
|
349
|
+
[isCreatable]="true"
|
|
350
|
+
(createOption)="onCreateOption($event)"
|
|
351
|
+
[(ngModel)]="selectedValue"
|
|
352
|
+
></ng-perfect-select>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### With Themes and Styling
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
<ng-perfect-select
|
|
359
|
+
[options]="options"
|
|
360
|
+
theme="purple"
|
|
361
|
+
selectSize="large"
|
|
362
|
+
containerSize="lg"
|
|
363
|
+
[(ngModel)]="selectedValue"
|
|
364
|
+
></ng-perfect-select>
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## Documentation
|
|
368
|
+
|
|
369
|
+
For complete documentation, examples, and interactive playground, visit:
|
|
370
|
+
**[https://angular-perfect-select.ishansasika.dev](https://angular-perfect-select.ishansasika.dev)**
|
|
371
|
+
|
|
372
|
+
## License
|
|
373
|
+
|
|
374
|
+
MIT © [Ishan Karunaratne](https://ishansasika.dev)
|
|
375
|
+
|
package/dist/README.md
CHANGED
|
@@ -20,6 +20,23 @@ A modern, feature-rich, and fully accessible select component for Angular applic
|
|
|
20
20
|
- **Forms Integration** - Full support for Angular template-driven and reactive forms
|
|
21
21
|
|
|
22
22
|
### Advanced Features
|
|
23
|
+
|
|
24
|
+
#### v2.0.0 Features 🆕
|
|
25
|
+
- **Virtual Scrolling** - Handle 10,000+ options without performance degradation using Angular CDK
|
|
26
|
+
- **Custom Option Templates** - Full control over option rendering with ng-template support
|
|
27
|
+
- **Validation States** - Visual error, warning, success, and info states with custom messages
|
|
28
|
+
- **Advanced Keyboard Shortcuts** - Ctrl+A, Ctrl+C/V, Home/End, and type-ahead navigation
|
|
29
|
+
- **Copy/Paste Support** - Copy selected values and paste comma-separated lists
|
|
30
|
+
- **Option Tooltips** - Display additional information on hover with configurable content
|
|
31
|
+
- **Recent Selections** - Show recently selected items at top with optional persistence
|
|
32
|
+
- **Infinite Scroll** - Load more options as user scrolls with pagination support
|
|
33
|
+
|
|
34
|
+
#### v1.1.0 Features
|
|
35
|
+
- **Max Selection Limit** - Limit the number of selections in multi-select mode with visual feedback
|
|
36
|
+
- **Search Debounce** - Configurable debounce delay for async loading to reduce API calls
|
|
37
|
+
- **Min Search Length** - Require minimum characters before filtering with helpful progress indicator
|
|
38
|
+
|
|
39
|
+
#### Core Features
|
|
23
40
|
- **Select All / Deselect All** - One-click selection for multi-select mode
|
|
24
41
|
- **Option Grouping** - Organize options into categories with sticky headers
|
|
25
42
|
- **Icons in Options** - Add visual elements (SVG or images) to options
|
|
@@ -41,19 +58,21 @@ A modern, feature-rich, and fully accessible select component for Angular applic
|
|
|
41
58
|
Install using npm:
|
|
42
59
|
|
|
43
60
|
```bash
|
|
44
|
-
npm install angular-perfect-select
|
|
61
|
+
npm install angular-perfect-select @angular/cdk
|
|
45
62
|
```
|
|
46
63
|
|
|
64
|
+
> **⚠️ v2.0.0 Breaking Change**: Angular CDK is now a required peer dependency. Make sure to install `@angular/cdk@^20.0.0` alongside the package.
|
|
65
|
+
|
|
47
66
|
Install using yarn:
|
|
48
67
|
|
|
49
68
|
```bash
|
|
50
|
-
yarn add angular-perfect-select
|
|
69
|
+
yarn add angular-perfect-select @angular/cdk
|
|
51
70
|
```
|
|
52
71
|
|
|
53
72
|
Install using pnpm:
|
|
54
73
|
|
|
55
74
|
```bash
|
|
56
|
-
pnpm add angular-perfect-select
|
|
75
|
+
pnpm add angular-perfect-select @angular/cdk
|
|
57
76
|
```
|
|
58
77
|
|
|
59
78
|
## Quick Start
|
|
@@ -105,3 +124,252 @@ import { PerfectSelectComponent } from 'angular-perfect-select';
|
|
|
105
124
|
export class AppModule { }
|
|
106
125
|
```
|
|
107
126
|
|
|
127
|
+
## Usage Examples
|
|
128
|
+
|
|
129
|
+
### Max Selection Limit (v1.1.0)
|
|
130
|
+
|
|
131
|
+
Limit the number of selections in multi-select mode:
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
<ng-perfect-select
|
|
135
|
+
[options]="options"
|
|
136
|
+
[isMulti]="true"
|
|
137
|
+
[maxSelectedOptions]="3"
|
|
138
|
+
maxSelectedMessage="You can only select up to 3 items"
|
|
139
|
+
[(ngModel)]="selectedValues"
|
|
140
|
+
></ng-perfect-select>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Search Debounce (v1.1.0)
|
|
144
|
+
|
|
145
|
+
Add debouncing to async search to reduce API calls:
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
<ng-perfect-select
|
|
149
|
+
[options]="[]"
|
|
150
|
+
[loadOptions]="loadCountries"
|
|
151
|
+
[debounceTime]="500"
|
|
152
|
+
[(ngModel)]="selectedCountry"
|
|
153
|
+
></ng-perfect-select>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
loadCountries = async (searchTerm: string): Promise<SelectOption[]> => {
|
|
158
|
+
const response = await fetch(`/api/countries?search=${searchTerm}`);
|
|
159
|
+
return response.json();
|
|
160
|
+
};
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Minimum Search Length (v1.1.0)
|
|
164
|
+
|
|
165
|
+
Require minimum characters before filtering options:
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
<ng-perfect-select
|
|
169
|
+
[options]="largeDataset"
|
|
170
|
+
[minSearchLength]="3"
|
|
171
|
+
minSearchMessage="Please enter at least 3 characters"
|
|
172
|
+
[(ngModel)]="selectedValue"
|
|
173
|
+
></ng-perfect-select>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Virtual Scrolling (v2.0.0)
|
|
177
|
+
|
|
178
|
+
Handle large datasets (10,000+ options) with virtual scrolling:
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
<ng-perfect-select
|
|
182
|
+
[options]="hugeDataset"
|
|
183
|
+
[enableVirtualScroll]="true"
|
|
184
|
+
[virtualScrollItemSize]="40"
|
|
185
|
+
[(ngModel)]="selectedValue"
|
|
186
|
+
></ng-perfect-select>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Custom Option Templates (v2.0.0)
|
|
190
|
+
|
|
191
|
+
Provide custom rendering for options:
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
<ng-perfect-select [options]="options" [(ngModel)]="selectedValue">
|
|
195
|
+
<ng-template #optionTemplate let-option let-selected="selected">
|
|
196
|
+
<div class="custom-option">
|
|
197
|
+
<img [src]="option.avatar" />
|
|
198
|
+
<div>
|
|
199
|
+
<strong>{{option.label}}</strong>
|
|
200
|
+
<span>{{option.email}}</span>
|
|
201
|
+
</div>
|
|
202
|
+
@if (selected) {
|
|
203
|
+
<span class="badge">Selected</span>
|
|
204
|
+
}
|
|
205
|
+
</div>
|
|
206
|
+
</ng-template>
|
|
207
|
+
</ng-perfect-select>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Validation States (v2.0.0)
|
|
211
|
+
|
|
212
|
+
Visual validation feedback for forms:
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
<ng-perfect-select
|
|
216
|
+
[options]="options"
|
|
217
|
+
validationState="error"
|
|
218
|
+
validationMessage="Please select at least one option"
|
|
219
|
+
[(ngModel)]="selectedValue"
|
|
220
|
+
></ng-perfect-select>
|
|
221
|
+
|
|
222
|
+
<!-- Available states: 'error', 'warning', 'success', 'info', 'default' -->
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Advanced Keyboard Shortcuts (v2.0.0)
|
|
226
|
+
|
|
227
|
+
Power-user keyboard navigation:
|
|
228
|
+
|
|
229
|
+
- **Ctrl/Cmd+A**: Select all options (multi-select)
|
|
230
|
+
- **Ctrl/Cmd+C**: Copy selected values to clipboard
|
|
231
|
+
- **Ctrl/Cmd+V**: Paste comma-separated values (multi-select)
|
|
232
|
+
- **Home**: Jump to first option
|
|
233
|
+
- **End**: Jump to last option
|
|
234
|
+
- **Type-ahead**: Type characters to jump to matching option
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
<ng-perfect-select
|
|
238
|
+
[options]="options"
|
|
239
|
+
[enableAdvancedKeyboard]="true"
|
|
240
|
+
[enableCopyPaste]="true"
|
|
241
|
+
[typeAheadDelay]="500"
|
|
242
|
+
[(ngModel)]="selectedValue"
|
|
243
|
+
></ng-perfect-select>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Copy/Paste Support (v2.0.0)
|
|
247
|
+
|
|
248
|
+
Copy selected values and paste comma-separated lists:
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
<ng-perfect-select
|
|
252
|
+
[options]="options"
|
|
253
|
+
[isMulti]="true"
|
|
254
|
+
[enableCopyPaste]="true"
|
|
255
|
+
[copyDelimiter]="', '"
|
|
256
|
+
[pasteDelimiter]=","
|
|
257
|
+
(copy)="onCopy($event)"
|
|
258
|
+
(paste)="onPaste($event)"
|
|
259
|
+
[(ngModel)]="selectedValues"
|
|
260
|
+
></ng-perfect-select>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Option Tooltips (v2.0.0)
|
|
264
|
+
|
|
265
|
+
Show additional information on hover:
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
<ng-perfect-select
|
|
269
|
+
[options]="optionsWithTooltips"
|
|
270
|
+
[showTooltips]="true"
|
|
271
|
+
[tooltipDelay]="300"
|
|
272
|
+
[(ngModel)]="selectedValue"
|
|
273
|
+
></ng-perfect-select>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
// Options with tooltip property
|
|
278
|
+
options = [
|
|
279
|
+
{ id: 1, label: 'Option 1', value: 'opt1', tooltip: 'This is a helpful tooltip' },
|
|
280
|
+
{ id: 2, label: 'Option 2', value: 'opt2', tooltip: 'Additional information here' }
|
|
281
|
+
];
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Recent Selections (v2.0.0)
|
|
285
|
+
|
|
286
|
+
Display recently selected items at the top:
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
<ng-perfect-select
|
|
290
|
+
[options]="options"
|
|
291
|
+
[showRecentSelections]="true"
|
|
292
|
+
[recentSelectionsLimit]="5"
|
|
293
|
+
[recentSelectionsLabel]="'Recently Selected'"
|
|
294
|
+
[enableRecentSelectionsPersistence]="true"
|
|
295
|
+
[(ngModel)]="selectedValue"
|
|
296
|
+
></ng-perfect-select>
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Infinite Scroll (v2.0.0)
|
|
300
|
+
|
|
301
|
+
Load more options as user scrolls:
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
<ng-perfect-select
|
|
305
|
+
[options]="options"
|
|
306
|
+
[enableInfiniteScroll]="true"
|
|
307
|
+
[infiniteScrollThreshold]="80"
|
|
308
|
+
(scrollEnd)="loadMoreOptions($event)"
|
|
309
|
+
[(ngModel)]="selectedValue"
|
|
310
|
+
></ng-perfect-select>
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
loadMoreOptions(event: SelectScrollEndEvent) {
|
|
315
|
+
// Load more data when user scrolls to 80% of the list
|
|
316
|
+
this.fetchMoreOptions().then(newOptions => {
|
|
317
|
+
this.options = [...this.options, ...newOptions];
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Multi-Select with Tags
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
<ng-perfect-select
|
|
326
|
+
[options]="options"
|
|
327
|
+
[isMulti]="true"
|
|
328
|
+
placeholder="Select multiple..."
|
|
329
|
+
[(ngModel)]="selectedValues"
|
|
330
|
+
></ng-perfect-select>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Async Loading with Caching
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
<ng-perfect-select
|
|
337
|
+
[loadOptions]="loadRemoteData"
|
|
338
|
+
[cacheOptions]="true"
|
|
339
|
+
[defaultOptions]="true"
|
|
340
|
+
[(ngModel)]="selectedValue"
|
|
341
|
+
></ng-perfect-select>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Creatable Options
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
<ng-perfect-select
|
|
348
|
+
[options]="options"
|
|
349
|
+
[isCreatable]="true"
|
|
350
|
+
(createOption)="onCreateOption($event)"
|
|
351
|
+
[(ngModel)]="selectedValue"
|
|
352
|
+
></ng-perfect-select>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### With Themes and Styling
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
<ng-perfect-select
|
|
359
|
+
[options]="options"
|
|
360
|
+
theme="purple"
|
|
361
|
+
selectSize="large"
|
|
362
|
+
containerSize="lg"
|
|
363
|
+
[(ngModel)]="selectedValue"
|
|
364
|
+
></ng-perfect-select>
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## Documentation
|
|
368
|
+
|
|
369
|
+
For complete documentation, examples, and interactive playground, visit:
|
|
370
|
+
**[https://angular-perfect-select.ishansasika.dev](https://angular-perfect-select.ishansasika.dev)**
|
|
371
|
+
|
|
372
|
+
## License
|
|
373
|
+
|
|
374
|
+
MIT © [Ishan Karunaratne](https://ishansasika.dev)
|
|
375
|
+
|