@unnilouis.org/vs-chipdropdown 9.0.9 → 9.1.2
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 +76 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,24 +1,87 @@
|
|
|
1
|
-
|
|
1
|
+
📦 Chip Dropdown Package - <lib-vs-chipdd-cmp>
|
|
2
|
+
This component provides a multi-select dropdown with autocomplete, infinite scroll, and search functionality. It displays selected items as chips and is ideal when users need to choose multiple options.
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
🔧 Usage
|
|
5
|
+
<lib-vs-chipdd-cmp
|
|
6
|
+
[InputFields]="inputaccount"
|
|
7
|
+
(dataEvent)="chipfunction($event)">
|
|
8
|
+
</lib-vs-chipdd-cmp>
|
|
4
9
|
|
|
5
|
-
## Code scaffolding
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
> Note: Don't forget to add `--project vs-chipdropdown` or else it will be added to the default project in your `angular.json` file.
|
|
11
|
+
📥 Inputs
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
1. InputFields
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
Pass an object to configure the dropdown. It supports both API-driven and frontend static data.
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
Supported keys:
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
method: HTTP method to call the API (GET, POST, etc.)
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
url: Backend API endpoint
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
searchkey: Key to be used for searching within the dropdown
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
params: Default query/body params for the API request (e.g., { flag: 1 })
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
displaykey: Key in the response object used to display dropdown values
|
|
28
|
+
|
|
29
|
+
label: Label of the dropdown
|
|
30
|
+
|
|
31
|
+
Outputkey: Key to emit through the dataEvent output (optional)
|
|
32
|
+
|
|
33
|
+
If omitted, the entire selected object(s) will be emitted.
|
|
34
|
+
|
|
35
|
+
formcontrolname: Name of the FormControl defined in the parent form
|
|
36
|
+
|
|
37
|
+
fronentdata: Set true to use frontend data (disables API call)
|
|
38
|
+
|
|
39
|
+
data: Array of objects used as options in frontend mode
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
2. formGroup (Optional)
|
|
43
|
+
Pass the parent form's FormGroup to enable form integration and auto-patching selected values.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
📤 Output
|
|
47
|
+
3. dataEvent
|
|
48
|
+
An output event that emits the selected dropdown data whenever the selection changes.
|
|
49
|
+
|
|
50
|
+
Example:
|
|
51
|
+
|
|
52
|
+
chipfunction(event: any) {
|
|
53
|
+
console.log('Selected items:', event);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
✅ Example InputFields Object
|
|
58
|
+
|
|
59
|
+
this.inputaccount = {
|
|
60
|
+
method: 'POST',
|
|
61
|
+
url: 'https://your.api/multiselect',
|
|
62
|
+
params: { flag: 2 },
|
|
63
|
+
displaykey: 'account_name',
|
|
64
|
+
Outputkey: 'account_id',
|
|
65
|
+
label: 'Accounts',
|
|
66
|
+
formcontrolname: 'selectedAccounts',
|
|
67
|
+
fronentdata: false,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
🧩 Use Cases
|
|
71
|
+
|
|
72
|
+
Multi-select dropdowns with autocomplete
|
|
73
|
+
|
|
74
|
+
Displaying selected items as chips
|
|
75
|
+
|
|
76
|
+
API-driven or static list of options
|
|
77
|
+
|
|
78
|
+
Search-enabled large datasets
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
💡 Tips
|
|
82
|
+
|
|
83
|
+
Use Outputkey if you only want to emit specific values (like IDs or names).
|
|
84
|
+
|
|
85
|
+
If you need the full object, simply skip the Outputkey.
|
|
86
|
+
|
|
87
|
+
Works well with Angular Reactive Forms.
|
package/package.json
CHANGED