angular-perfect-select 1.1.1 → 2.1.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 CHANGED
@@ -20,9 +20,27 @@ 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
- - **Max Selection Limit** (v1.1.0) - Limit the number of selections in multi-select mode with visual feedback
24
- - **Search Debounce** (v1.1.0) - Configurable debounce delay for async loading to reduce API calls
25
- - **Min Search Length** (v1.1.0) - Require minimum characters before filtering with helpful progress indicator
23
+
24
+ #### v2.1.0 Features 🆕
25
+ - **Drag & Drop Reordering** - Reorder selected tags in multi-select mode with intuitive drag handles
26
+ - **Option Pinning** - Pin frequently used options to the top with persistence support
27
+
28
+ #### v2.0.0 Features
29
+ - **Virtual Scrolling** - Handle 10,000+ options without performance degradation using Angular CDK
30
+ - **Custom Option Templates** - Full control over option rendering with ng-template support
31
+ - **Validation States** - Visual error, warning, success, and info states with custom messages
32
+ - **Advanced Keyboard Shortcuts** - Ctrl+A, Ctrl+C/V, Home/End, and type-ahead navigation
33
+ - **Copy/Paste Support** - Copy selected values and paste comma-separated lists
34
+ - **Option Tooltips** - Display additional information on hover with configurable content
35
+ - **Recent Selections** - Show recently selected items at top with optional persistence
36
+ - **Infinite Scroll** - Load more options as user scrolls with pagination support
37
+
38
+ #### v1.1.0 Features
39
+ - **Max Selection Limit** - Limit the number of selections in multi-select mode with visual feedback
40
+ - **Search Debounce** - Configurable debounce delay for async loading to reduce API calls
41
+ - **Min Search Length** - Require minimum characters before filtering with helpful progress indicator
42
+
43
+ #### Core Features
26
44
  - **Select All / Deselect All** - One-click selection for multi-select mode
27
45
  - **Option Grouping** - Organize options into categories with sticky headers
28
46
  - **Icons in Options** - Add visual elements (SVG or images) to options
@@ -44,19 +62,21 @@ A modern, feature-rich, and fully accessible select component for Angular applic
44
62
  Install using npm:
45
63
 
46
64
  ```bash
47
- npm install angular-perfect-select
65
+ npm install angular-perfect-select @angular/cdk
48
66
  ```
49
67
 
68
+ > **⚠️ 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.
69
+
50
70
  Install using yarn:
51
71
 
52
72
  ```bash
53
- yarn add angular-perfect-select
73
+ yarn add angular-perfect-select @angular/cdk
54
74
  ```
55
75
 
56
76
  Install using pnpm:
57
77
 
58
78
  ```bash
59
- pnpm add angular-perfect-select
79
+ pnpm add angular-perfect-select @angular/cdk
60
80
  ```
61
81
 
62
82
  ## Quick Start
@@ -110,6 +130,47 @@ export class AppModule { }
110
130
 
111
131
  ## Usage Examples
112
132
 
133
+ ### Drag & Drop Reordering (v2.1.0)
134
+
135
+ Reorder selected tags in multi-select mode with drag-and-drop:
136
+
137
+ ```typescript
138
+ <angular-perfect-select
139
+ [options]="options"
140
+ [isMulti]="true"
141
+ [enableDragDrop]="true"
142
+ [dragDropPlaceholder]="'Drop here'"
143
+ [dragDropAnimation]="200"
144
+ (reorder)="handleReorder($event)"
145
+ />
146
+
147
+ // In your component
148
+ handleReorder(event: SelectReorderEvent) {
149
+ console.log('Reordered from', event.previousIndex, 'to', event.currentIndex);
150
+ console.log('New order:', event.values);
151
+ }
152
+ ```
153
+
154
+ ### Option Pinning (v2.1.0)
155
+
156
+ Pin frequently used options to the top of the dropdown:
157
+
158
+ ```typescript
159
+ <angular-perfect-select
160
+ [options]="options"
161
+ [enablePinning]="true"
162
+ [maxPinnedOptions]="3"
163
+ [persistPinnedOptions]="true"
164
+ [pinnedOptionsLabel]="'Favorites'"
165
+ (pin)="handlePin($event)"
166
+ />
167
+
168
+ // In your component
169
+ handlePin(event: SelectPinEvent) {
170
+ console.log('Option', event.option.label, event.pinned ? 'pinned' : 'unpinned');
171
+ }
172
+ ```
173
+
113
174
  ### Max Selection Limit (v1.1.0)
114
175
 
115
176
  Limit the number of selections in multi-select mode:
@@ -157,6 +218,152 @@ Require minimum characters before filtering options:
157
218
  ></ng-perfect-select>
158
219
  ```
159
220
 
221
+ ### Virtual Scrolling (v2.0.0)
222
+
223
+ Handle large datasets (10,000+ options) with virtual scrolling:
224
+
225
+ ```typescript
226
+ <ng-perfect-select
227
+ [options]="hugeDataset"
228
+ [enableVirtualScroll]="true"
229
+ [virtualScrollItemSize]="40"
230
+ [(ngModel)]="selectedValue"
231
+ ></ng-perfect-select>
232
+ ```
233
+
234
+ ### Custom Option Templates (v2.0.0)
235
+
236
+ Provide custom rendering for options:
237
+
238
+ ```typescript
239
+ <ng-perfect-select [options]="options" [(ngModel)]="selectedValue">
240
+ <ng-template #optionTemplate let-option let-selected="selected">
241
+ <div class="custom-option">
242
+ <img [src]="option.avatar" />
243
+ <div>
244
+ <strong>{{option.label}}</strong>
245
+ <span>{{option.email}}</span>
246
+ </div>
247
+ @if (selected) {
248
+ <span class="badge">Selected</span>
249
+ }
250
+ </div>
251
+ </ng-template>
252
+ </ng-perfect-select>
253
+ ```
254
+
255
+ ### Validation States (v2.0.0)
256
+
257
+ Visual validation feedback for forms:
258
+
259
+ ```typescript
260
+ <ng-perfect-select
261
+ [options]="options"
262
+ validationState="error"
263
+ validationMessage="Please select at least one option"
264
+ [(ngModel)]="selectedValue"
265
+ ></ng-perfect-select>
266
+
267
+ <!-- Available states: 'error', 'warning', 'success', 'info', 'default' -->
268
+ ```
269
+
270
+ ### Advanced Keyboard Shortcuts (v2.0.0)
271
+
272
+ Power-user keyboard navigation:
273
+
274
+ - **Ctrl/Cmd+A**: Select all options (multi-select)
275
+ - **Ctrl/Cmd+C**: Copy selected values to clipboard
276
+ - **Ctrl/Cmd+V**: Paste comma-separated values (multi-select)
277
+ - **Home**: Jump to first option
278
+ - **End**: Jump to last option
279
+ - **Type-ahead**: Type characters to jump to matching option
280
+
281
+ ```typescript
282
+ <ng-perfect-select
283
+ [options]="options"
284
+ [enableAdvancedKeyboard]="true"
285
+ [enableCopyPaste]="true"
286
+ [typeAheadDelay]="500"
287
+ [(ngModel)]="selectedValue"
288
+ ></ng-perfect-select>
289
+ ```
290
+
291
+ ### Copy/Paste Support (v2.0.0)
292
+
293
+ Copy selected values and paste comma-separated lists:
294
+
295
+ ```typescript
296
+ <ng-perfect-select
297
+ [options]="options"
298
+ [isMulti]="true"
299
+ [enableCopyPaste]="true"
300
+ [copyDelimiter]="', '"
301
+ [pasteDelimiter]=","
302
+ (copy)="onCopy($event)"
303
+ (paste)="onPaste($event)"
304
+ [(ngModel)]="selectedValues"
305
+ ></ng-perfect-select>
306
+ ```
307
+
308
+ ### Option Tooltips (v2.0.0)
309
+
310
+ Show additional information on hover:
311
+
312
+ ```typescript
313
+ <ng-perfect-select
314
+ [options]="optionsWithTooltips"
315
+ [showTooltips]="true"
316
+ [tooltipDelay]="300"
317
+ [(ngModel)]="selectedValue"
318
+ ></ng-perfect-select>
319
+ ```
320
+
321
+ ```typescript
322
+ // Options with tooltip property
323
+ options = [
324
+ { id: 1, label: 'Option 1', value: 'opt1', tooltip: 'This is a helpful tooltip' },
325
+ { id: 2, label: 'Option 2', value: 'opt2', tooltip: 'Additional information here' }
326
+ ];
327
+ ```
328
+
329
+ ### Recent Selections (v2.0.0)
330
+
331
+ Display recently selected items at the top:
332
+
333
+ ```typescript
334
+ <ng-perfect-select
335
+ [options]="options"
336
+ [showRecentSelections]="true"
337
+ [recentSelectionsLimit]="5"
338
+ [recentSelectionsLabel]="'Recently Selected'"
339
+ [enableRecentSelectionsPersistence]="true"
340
+ [(ngModel)]="selectedValue"
341
+ ></ng-perfect-select>
342
+ ```
343
+
344
+ ### Infinite Scroll (v2.0.0)
345
+
346
+ Load more options as user scrolls:
347
+
348
+ ```typescript
349
+ <ng-perfect-select
350
+ [options]="options"
351
+ [enableInfiniteScroll]="true"
352
+ [infiniteScrollThreshold]="80"
353
+ (scrollEnd)="loadMoreOptions($event)"
354
+ [(ngModel)]="selectedValue"
355
+ ></ng-perfect-select>
356
+ ```
357
+
358
+ ```typescript
359
+ loadMoreOptions(event: SelectScrollEndEvent) {
360
+ // Load more data when user scrolls to 80% of the list
361
+ this.fetchMoreOptions().then(newOptions => {
362
+ this.options = [...this.options, ...newOptions];
363
+ });
364
+ }
365
+ ```
366
+
160
367
  ### Multi-Select with Tags
161
368
 
162
369
  ```typescript
package/dist/README.md CHANGED
@@ -20,9 +20,27 @@ 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
- - **Max Selection Limit** (v1.1.0) - Limit the number of selections in multi-select mode with visual feedback
24
- - **Search Debounce** (v1.1.0) - Configurable debounce delay for async loading to reduce API calls
25
- - **Min Search Length** (v1.1.0) - Require minimum characters before filtering with helpful progress indicator
23
+
24
+ #### v2.1.0 Features 🆕
25
+ - **Drag & Drop Reordering** - Reorder selected tags in multi-select mode with intuitive drag handles
26
+ - **Option Pinning** - Pin frequently used options to the top with persistence support
27
+
28
+ #### v2.0.0 Features
29
+ - **Virtual Scrolling** - Handle 10,000+ options without performance degradation using Angular CDK
30
+ - **Custom Option Templates** - Full control over option rendering with ng-template support
31
+ - **Validation States** - Visual error, warning, success, and info states with custom messages
32
+ - **Advanced Keyboard Shortcuts** - Ctrl+A, Ctrl+C/V, Home/End, and type-ahead navigation
33
+ - **Copy/Paste Support** - Copy selected values and paste comma-separated lists
34
+ - **Option Tooltips** - Display additional information on hover with configurable content
35
+ - **Recent Selections** - Show recently selected items at top with optional persistence
36
+ - **Infinite Scroll** - Load more options as user scrolls with pagination support
37
+
38
+ #### v1.1.0 Features
39
+ - **Max Selection Limit** - Limit the number of selections in multi-select mode with visual feedback
40
+ - **Search Debounce** - Configurable debounce delay for async loading to reduce API calls
41
+ - **Min Search Length** - Require minimum characters before filtering with helpful progress indicator
42
+
43
+ #### Core Features
26
44
  - **Select All / Deselect All** - One-click selection for multi-select mode
27
45
  - **Option Grouping** - Organize options into categories with sticky headers
28
46
  - **Icons in Options** - Add visual elements (SVG or images) to options
@@ -44,19 +62,21 @@ A modern, feature-rich, and fully accessible select component for Angular applic
44
62
  Install using npm:
45
63
 
46
64
  ```bash
47
- npm install angular-perfect-select
65
+ npm install angular-perfect-select @angular/cdk
48
66
  ```
49
67
 
68
+ > **⚠️ 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.
69
+
50
70
  Install using yarn:
51
71
 
52
72
  ```bash
53
- yarn add angular-perfect-select
73
+ yarn add angular-perfect-select @angular/cdk
54
74
  ```
55
75
 
56
76
  Install using pnpm:
57
77
 
58
78
  ```bash
59
- pnpm add angular-perfect-select
79
+ pnpm add angular-perfect-select @angular/cdk
60
80
  ```
61
81
 
62
82
  ## Quick Start
@@ -110,6 +130,47 @@ export class AppModule { }
110
130
 
111
131
  ## Usage Examples
112
132
 
133
+ ### Drag & Drop Reordering (v2.1.0)
134
+
135
+ Reorder selected tags in multi-select mode with drag-and-drop:
136
+
137
+ ```typescript
138
+ <angular-perfect-select
139
+ [options]="options"
140
+ [isMulti]="true"
141
+ [enableDragDrop]="true"
142
+ [dragDropPlaceholder]="'Drop here'"
143
+ [dragDropAnimation]="200"
144
+ (reorder)="handleReorder($event)"
145
+ />
146
+
147
+ // In your component
148
+ handleReorder(event: SelectReorderEvent) {
149
+ console.log('Reordered from', event.previousIndex, 'to', event.currentIndex);
150
+ console.log('New order:', event.values);
151
+ }
152
+ ```
153
+
154
+ ### Option Pinning (v2.1.0)
155
+
156
+ Pin frequently used options to the top of the dropdown:
157
+
158
+ ```typescript
159
+ <angular-perfect-select
160
+ [options]="options"
161
+ [enablePinning]="true"
162
+ [maxPinnedOptions]="3"
163
+ [persistPinnedOptions]="true"
164
+ [pinnedOptionsLabel]="'Favorites'"
165
+ (pin)="handlePin($event)"
166
+ />
167
+
168
+ // In your component
169
+ handlePin(event: SelectPinEvent) {
170
+ console.log('Option', event.option.label, event.pinned ? 'pinned' : 'unpinned');
171
+ }
172
+ ```
173
+
113
174
  ### Max Selection Limit (v1.1.0)
114
175
 
115
176
  Limit the number of selections in multi-select mode:
@@ -157,6 +218,152 @@ Require minimum characters before filtering options:
157
218
  ></ng-perfect-select>
158
219
  ```
159
220
 
221
+ ### Virtual Scrolling (v2.0.0)
222
+
223
+ Handle large datasets (10,000+ options) with virtual scrolling:
224
+
225
+ ```typescript
226
+ <ng-perfect-select
227
+ [options]="hugeDataset"
228
+ [enableVirtualScroll]="true"
229
+ [virtualScrollItemSize]="40"
230
+ [(ngModel)]="selectedValue"
231
+ ></ng-perfect-select>
232
+ ```
233
+
234
+ ### Custom Option Templates (v2.0.0)
235
+
236
+ Provide custom rendering for options:
237
+
238
+ ```typescript
239
+ <ng-perfect-select [options]="options" [(ngModel)]="selectedValue">
240
+ <ng-template #optionTemplate let-option let-selected="selected">
241
+ <div class="custom-option">
242
+ <img [src]="option.avatar" />
243
+ <div>
244
+ <strong>{{option.label}}</strong>
245
+ <span>{{option.email}}</span>
246
+ </div>
247
+ @if (selected) {
248
+ <span class="badge">Selected</span>
249
+ }
250
+ </div>
251
+ </ng-template>
252
+ </ng-perfect-select>
253
+ ```
254
+
255
+ ### Validation States (v2.0.0)
256
+
257
+ Visual validation feedback for forms:
258
+
259
+ ```typescript
260
+ <ng-perfect-select
261
+ [options]="options"
262
+ validationState="error"
263
+ validationMessage="Please select at least one option"
264
+ [(ngModel)]="selectedValue"
265
+ ></ng-perfect-select>
266
+
267
+ <!-- Available states: 'error', 'warning', 'success', 'info', 'default' -->
268
+ ```
269
+
270
+ ### Advanced Keyboard Shortcuts (v2.0.0)
271
+
272
+ Power-user keyboard navigation:
273
+
274
+ - **Ctrl/Cmd+A**: Select all options (multi-select)
275
+ - **Ctrl/Cmd+C**: Copy selected values to clipboard
276
+ - **Ctrl/Cmd+V**: Paste comma-separated values (multi-select)
277
+ - **Home**: Jump to first option
278
+ - **End**: Jump to last option
279
+ - **Type-ahead**: Type characters to jump to matching option
280
+
281
+ ```typescript
282
+ <ng-perfect-select
283
+ [options]="options"
284
+ [enableAdvancedKeyboard]="true"
285
+ [enableCopyPaste]="true"
286
+ [typeAheadDelay]="500"
287
+ [(ngModel)]="selectedValue"
288
+ ></ng-perfect-select>
289
+ ```
290
+
291
+ ### Copy/Paste Support (v2.0.0)
292
+
293
+ Copy selected values and paste comma-separated lists:
294
+
295
+ ```typescript
296
+ <ng-perfect-select
297
+ [options]="options"
298
+ [isMulti]="true"
299
+ [enableCopyPaste]="true"
300
+ [copyDelimiter]="', '"
301
+ [pasteDelimiter]=","
302
+ (copy)="onCopy($event)"
303
+ (paste)="onPaste($event)"
304
+ [(ngModel)]="selectedValues"
305
+ ></ng-perfect-select>
306
+ ```
307
+
308
+ ### Option Tooltips (v2.0.0)
309
+
310
+ Show additional information on hover:
311
+
312
+ ```typescript
313
+ <ng-perfect-select
314
+ [options]="optionsWithTooltips"
315
+ [showTooltips]="true"
316
+ [tooltipDelay]="300"
317
+ [(ngModel)]="selectedValue"
318
+ ></ng-perfect-select>
319
+ ```
320
+
321
+ ```typescript
322
+ // Options with tooltip property
323
+ options = [
324
+ { id: 1, label: 'Option 1', value: 'opt1', tooltip: 'This is a helpful tooltip' },
325
+ { id: 2, label: 'Option 2', value: 'opt2', tooltip: 'Additional information here' }
326
+ ];
327
+ ```
328
+
329
+ ### Recent Selections (v2.0.0)
330
+
331
+ Display recently selected items at the top:
332
+
333
+ ```typescript
334
+ <ng-perfect-select
335
+ [options]="options"
336
+ [showRecentSelections]="true"
337
+ [recentSelectionsLimit]="5"
338
+ [recentSelectionsLabel]="'Recently Selected'"
339
+ [enableRecentSelectionsPersistence]="true"
340
+ [(ngModel)]="selectedValue"
341
+ ></ng-perfect-select>
342
+ ```
343
+
344
+ ### Infinite Scroll (v2.0.0)
345
+
346
+ Load more options as user scrolls:
347
+
348
+ ```typescript
349
+ <ng-perfect-select
350
+ [options]="options"
351
+ [enableInfiniteScroll]="true"
352
+ [infiniteScrollThreshold]="80"
353
+ (scrollEnd)="loadMoreOptions($event)"
354
+ [(ngModel)]="selectedValue"
355
+ ></ng-perfect-select>
356
+ ```
357
+
358
+ ```typescript
359
+ loadMoreOptions(event: SelectScrollEndEvent) {
360
+ // Load more data when user scrolls to 80% of the list
361
+ this.fetchMoreOptions().then(newOptions => {
362
+ this.options = [...this.options, ...newOptions];
363
+ });
364
+ }
365
+ ```
366
+
160
367
  ### Multi-Select with Tags
161
368
 
162
369
  ```typescript