@ruc-lib/multi-select 2.0.8 → 3.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 +3 -149
- package/fesm2022/ruc-lib-multi-select.mjs +519 -0
- package/fesm2022/ruc-lib-multi-select.mjs.map +1 -0
- package/index.d.ts +207 -4
- package/package.json +13 -26
- package/esm2020/index.mjs +0 -5
- package/esm2020/lib/animations/animations.mjs +0 -30
- package/esm2020/lib/directives/clickOutside.directive.mjs +0 -31
- package/esm2020/lib/interfaces/multiSelectDefault.mjs +0 -2
- package/esm2020/lib/model/ruc-multi-select.model.mjs +0 -11
- package/esm2020/lib/pipes/filter.pipe.mjs +0 -28
- package/esm2020/lib/pipes/sort.pipe.mjs +0 -38
- package/esm2020/lib/ruclib-multi-select/ruclib-multi-select.component.mjs +0 -361
- package/esm2020/lib/ruclib-multi-select.module.mjs +0 -72
- package/esm2020/ruc-lib-multi-select.mjs +0 -5
- package/fesm2015/ruc-lib-multi-select.mjs +0 -557
- package/fesm2015/ruc-lib-multi-select.mjs.map +0 -1
- package/fesm2020/ruc-lib-multi-select.mjs +0 -558
- package/fesm2020/ruc-lib-multi-select.mjs.map +0 -1
- package/lib/animations/animations.d.ts +0 -1
- package/lib/directives/clickOutside.directive.d.ts +0 -10
- package/lib/interfaces/multiSelectDefault.d.ts +0 -64
- package/lib/model/ruc-multi-select.model.d.ts +0 -9
- package/lib/pipes/filter.pipe.d.ts +0 -7
- package/lib/pipes/sort.pipe.d.ts +0 -9
- package/lib/ruclib-multi-select/ruclib-multi-select.component.d.ts +0 -118
- package/lib/ruclib-multi-select.module.d.ts +0 -20
- package/ruc-lib-multi-select-2.0.6.tgz +0 -0
- package/ruc-lib-multi-select-2.0.7.tgz +0 -0
- package/ruc-lib-multi-select-2.0.9.tgz +0 -0
- package/ruc-lib-multi-select-2.1.0.tgz +0 -0
- package/ruc-lib-multi-select-2.1.1.tgz +0 -0
- package/ruc-lib-multi-select-2.1.2.tgz +0 -0
package/README.md
CHANGED
|
@@ -1,153 +1,7 @@
|
|
|
1
1
|
# ruclib-multi-select
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Running unit tests
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Install the Entire Library
|
|
10
|
-
```bash
|
|
11
|
-
npm install @uxpractice/ruc-lib
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Install Individual Component
|
|
15
|
-
If you only need the Multi-Select component:
|
|
16
|
-
```bash
|
|
17
|
-
npm install @ruc-lib/multi-select
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Usage
|
|
21
|
-
|
|
22
|
-
### 1. Import the Module
|
|
23
|
-
In your Angular module file (e.g., `app.module.ts`), import the `RuclibMultiSelectModule`:
|
|
24
|
-
|
|
25
|
-
```typescript
|
|
26
|
-
import { RuclibMultiSelectModule } from '@ruc-lib/multi-select';
|
|
27
|
-
import { AppComponent } from './app.component';
|
|
28
|
-
import { NgModule } from '@angular/core';
|
|
29
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
30
|
-
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
31
|
-
|
|
32
|
-
@NgModule({
|
|
33
|
-
declarations: [AppComponent],
|
|
34
|
-
imports: [
|
|
35
|
-
BrowserModule,
|
|
36
|
-
BrowserAnimationsModule,
|
|
37
|
-
RuclibMultiSelectModule
|
|
38
|
-
],
|
|
39
|
-
providers: [],
|
|
40
|
-
bootstrap: [AppComponent]
|
|
41
|
-
})
|
|
42
|
-
export class AppModule {}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### 2. Use the Component
|
|
46
|
-
In your component's template, use the `<uxp-ruclib-multi-select>` selector and pass the configuration and data to the respective inputs.
|
|
47
|
-
|
|
48
|
-
```html
|
|
49
|
-
<uxp-ruclib-multi-select
|
|
50
|
-
[dataSource]="dataSourceForMultiSelect"
|
|
51
|
-
[rucInputData]="inputObjectDataMulti"
|
|
52
|
-
[customTheme]="'custom-theme'"
|
|
53
|
-
(rucEvent)="handleEvent($event)">
|
|
54
|
-
</uxp-ruclib-multi-select>
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## API Reference
|
|
58
|
-
|
|
59
|
-
### Component Inputs
|
|
60
|
-
|
|
61
|
-
| Input | Type | Description |
|
|
62
|
-
|----------------|--------------------|--------------------------------------------------|
|
|
63
|
-
| `rucInputData` | `DefaultConfig` | The main configuration object for the component. |
|
|
64
|
-
| `dataSource` | `ListItem[]` | An array of items to be displayed in the dropdown. |
|
|
65
|
-
| `customTheme` | `string` | An optional CSS class for custom theming. |
|
|
66
|
-
|
|
67
|
-
### Component Outputs
|
|
68
|
-
|
|
69
|
-
| Output | Type | Description |
|
|
70
|
-
|------------|--------------------|-----------------------------------------------------------------------------|
|
|
71
|
-
| `rucEvent` | `EventEmitter<any>` | Emits an event whenever a selection changes, an item is deselected, or the input is clicked. |
|
|
72
|
-
|
|
73
|
-
### `DefaultConfig`
|
|
74
|
-
This is the main configuration object for the multi-select component.
|
|
75
|
-
|
|
76
|
-
| Property | Type | Description |
|
|
77
|
-
|---------------------|------------------------|---------------------------------------------------------------------------------------------------------|
|
|
78
|
-
| `singleSelection` | `boolean` | If `true`, allows only a single item to be selected. Defaults to `false`. |
|
|
79
|
-
| `label` | `string` | The label for the multi-select input field. |
|
|
80
|
-
| `showSelectAll` | `boolean` | If `true`, displays a "Select All" checkbox. Defaults to `true`. |
|
|
81
|
-
| `showSelected` | `boolean` | If `true`, displays a "Show Selected" filter. Defaults to `true`. |
|
|
82
|
-
| `appearance` | `'fill' \| 'outline'` | The appearance of the form field. Defaults to `'outline'`. |
|
|
83
|
-
| `scroll` | `boolean` | Enables or disables scrolling within the dropdown. Defaults to `true`. |
|
|
84
|
-
| `placeholder` | `string` | The placeholder text for the search input. |
|
|
85
|
-
| `limit` | `number` | The maximum number of items that can be selected. |
|
|
86
|
-
| `maxDropdownHeight` | `string` | The maximum height of the dropdown container (e.g., `'200px'`). |
|
|
87
|
-
| `maxHeight` | `number` | The maximum height of the options box in pixels. Defaults to `150`. |
|
|
88
|
-
| `disabled` | `boolean` | If `true`, disables the entire component. Defaults to `false`. |
|
|
89
|
-
| `sortBy` | `string` | The property of the `ListItem` to sort by (e.g., `'id'`, `'text'`). |
|
|
90
|
-
| `sortOrder` | `'asc' \| 'desc'` | The order of sorting. |
|
|
91
|
-
|
|
92
|
-
### `ListItem`
|
|
93
|
-
This object defines the configuration for each item in the `dataSource`.
|
|
94
|
-
|
|
95
|
-
| Property | Type | Description |
|
|
96
|
-
|--------------|--------------------|--------------------------------------------------------------------------|
|
|
97
|
-
| `id` | `string \| number` | A unique identifier for the item. |
|
|
98
|
-
| `text` | `string` | The display text for the item. |
|
|
99
|
-
| `isDisabled` | `boolean` | If `true`, this item will be disabled and cannot be selected. |
|
|
100
|
-
| `icon` | `string` | An optional icon to display next to the item. |
|
|
101
|
-
| `childItem` | `any` | Used for creating parent-child relationships. |
|
|
102
|
-
| `grouped` | `boolean` | If `true`, indicates that the item is a group header. |
|
|
103
|
-
|
|
104
|
-
## Example Configuration
|
|
105
|
-
|
|
106
|
-
Here's an example of how to configure the Multi-Select component in your component's TypeScript file.
|
|
107
|
-
|
|
108
|
-
```typescript
|
|
109
|
-
import { Component } from '@angular/core';
|
|
110
|
-
import { DefaultConfig, ListItem } from '@ruc-lib/multi-select';
|
|
111
|
-
|
|
112
|
-
@Component({
|
|
113
|
-
selector: 'app-root',
|
|
114
|
-
templateUrl: './app.component.html',
|
|
115
|
-
})
|
|
116
|
-
export class AppComponent {
|
|
117
|
-
|
|
118
|
-
inputObjectDataMulti: DefaultConfig = {
|
|
119
|
-
singleSelection: false,
|
|
120
|
-
label: 'Cities',
|
|
121
|
-
showSelectAll: true,
|
|
122
|
-
showSelected: true,
|
|
123
|
-
appearance: 'outline',
|
|
124
|
-
scroll: true,
|
|
125
|
-
placeholder: 'Search or select from dropdown',
|
|
126
|
-
limit: 5,
|
|
127
|
-
maxDropdownHeight: '200px',
|
|
128
|
-
maxHeight: 150,
|
|
129
|
-
disabled: false,
|
|
130
|
-
sortBy: 'id',
|
|
131
|
-
sortOrder: 'desc',
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
dataSourceForMultiSelect: ListItem[] = [
|
|
135
|
-
{ text: 'Afghanistan', id: 'AF', isDisabled: true },
|
|
136
|
-
{ text: 'Åland Islands', id: 'AX', isDisabled: false },
|
|
137
|
-
{ text: 'Albania', id: 'AL', isDisabled: false },
|
|
138
|
-
{ text: 'Algeria', id: 'DZ', isDisabled: false },
|
|
139
|
-
];
|
|
140
|
-
|
|
141
|
-
handleEvent(event: any) {
|
|
142
|
-
console.log(event.eventName, event.eventOutput);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
## Contribution
|
|
148
|
-
|
|
149
|
-
Contributions are welcome! Feel free to open issues or pull requests for any enhancements or fixes.
|
|
150
|
-
|
|
151
|
-
## Acknowledgements
|
|
152
|
-
|
|
153
|
-
Thank you for choosing the Multi Select Component. If you have any feedback or suggestions, please let us know!
|
|
7
|
+
Run `nx test ruclib-multi-select` to execute the unit tests.
|