angular-multiselect3 10.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.
Files changed (40) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +306 -0
  3. package/esm2022/angular-multiselect.mjs +5 -0
  4. package/esm2022/lib/clickOutside.mjs +58 -0
  5. package/esm2022/lib/list-filter.mjs +59 -0
  6. package/esm2022/lib/menu-item.mjs +352 -0
  7. package/esm2022/lib/multiselect.component.mjs +1038 -0
  8. package/esm2022/lib/multiselect.interface.mjs +2 -0
  9. package/esm2022/lib/multiselect.model.mjs +9 -0
  10. package/esm2022/lib/multiselect.service.mjs +28 -0
  11. package/esm2022/lib/virtual-scroll/defaultoptions.mjs +2 -0
  12. package/esm2022/lib/virtual-scroll/idimension.mjs +2 -0
  13. package/esm2022/lib/virtual-scroll/ipageinfo.mjs +2 -0
  14. package/esm2022/lib/virtual-scroll/iviewport.mjs +2 -0
  15. package/esm2022/lib/virtual-scroll/virtual-scroll.mjs +1162 -0
  16. package/esm2022/lib/virtual-scroll/wrapgroupdimension.mjs +2 -0
  17. package/esm2022/lib/virtual-scroll/wrapgroupdimensions.mjs +2 -0
  18. package/esm2022/public_api.mjs +7 -0
  19. package/fesm2022/angular-multiselect.mjs +2689 -0
  20. package/fesm2022/angular-multiselect.mjs.map +1 -0
  21. package/index.d.ts +5 -0
  22. package/lib/clickOutside.d.ts +17 -0
  23. package/lib/list-filter.d.ts +12 -0
  24. package/lib/menu-item.d.ts +36 -0
  25. package/lib/multiselect.component.d.ts +134 -0
  26. package/lib/multiselect.interface.d.ts +34 -0
  27. package/lib/multiselect.model.d.ts +5 -0
  28. package/lib/multiselect.service.d.ts +11 -0
  29. package/lib/virtual-scroll/defaultoptions.d.ts +11 -0
  30. package/lib/virtual-scroll/idimension.d.ts +12 -0
  31. package/lib/virtual-scroll/ipageinfo.d.ts +9 -0
  32. package/lib/virtual-scroll/iviewport.d.ts +5 -0
  33. package/lib/virtual-scroll/virtual-scroll.d.ts +132 -0
  34. package/lib/virtual-scroll/wrapgroupdimension.d.ts +5 -0
  35. package/lib/virtual-scroll/wrapgroupdimensions.d.ts +7 -0
  36. package/package.json +37 -0
  37. package/public_api.d.ts +6 -0
  38. package/themes/dark.theme.scss +113 -0
  39. package/themes/default.theme.css +107 -0
  40. package/themes/default.theme.scss +155 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2016 Cuppa Labs
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,306 @@
1
+ # Angular 2/4/6/8 Multiselect Dropdown
2
+ [![npm version](https://img.shields.io/npm/v/angular2-multiselect-dropdown.svg)](https://www.npmjs.com/package/angular2-multiselect-dropdown)
3
+ [![downloads](https://img.shields.io/npm/dt/angular2-multiselect-dropdown.svg)](https://www.npmjs.com/package/angular2-multiselect-dropdown)
4
+ [![license](https://img.shields.io/github/license/cuppalabs/angular2-multiselect-dropdown.svg)](https://www.npmjs.com/package/angular2-multiselect-dropdown)
5
+
6
+ Angular 2 multiselect dropdown component for web applications. Easy to integrate and use.
7
+
8
+ ![](https://cuppalabs.github.io/angular2-multiselect-dropdown/assets/img/multiselect.jpeg)
9
+
10
+ # Important Notice !!
11
+ ##### From v3.0.0 onwards, you need to include `default.theme.css` file to get the basic styling of the dropdown. Refer to `themes and theming` section below
12
+
13
+
14
+ # [Documentation](http://cuppalabs.github.io/components/multiselectDropdown) | [Demos / Examples](https://cuppalabs.github.io/angular2-multiselect-dropdown).
15
+
16
+ ## Table of Contents
17
+ ##### 1. Getting Started
18
+ ##### 2. Installation
19
+ ##### 3. Usage
20
+ ##### 4 Theming
21
+ ##### 5. Templates
22
+ ##### 6. Template Driven Forms support
23
+ ##### 7. Reactive Forms support
24
+ ##### 8. Settings configuration
25
+ ##### 9. Callbacks and events
26
+ ##### 10. Lazy lodaing - handle large data lists
27
+ ##### 11. Group By feature
28
+ ##### 12. Search filter for both plain list and grouped list
29
+ ##### 13. Custom Search / Search API
30
+
31
+
32
+
33
+
34
+
35
+ ## Getting Started
36
+ ### Installation
37
+ - The Mutiselect Dropdown package is published on the [npm](https://www.npmjs.com/package/angular2-multiselect-dropdown) Registry.
38
+ - Install the package :
39
+ `npm install angular2-multiselect-dropdown`
40
+
41
+ - Once installed import `AngularMultiSelectModule` from the installed package into your module as follows:
42
+
43
+ ## Dependencies
44
+
45
+ Latest version available for each version of Angular
46
+
47
+ | angular2-multiselect-dropdown | Angular |
48
+ | ----------------------------- | ----------- |
49
+ | 10.0.0 | 18.X.X |
50
+ | 9.0.0 | 17.X.X |
51
+ | 8.0.0 | 16.X.X |
52
+ | 7.0.0 | 15.X.X |
53
+ | 6.0.0 | 14.X.X |
54
+
55
+
56
+ ### Usage
57
+ Import `AngularMultiSelectModule` into `NgModule` in `app.module.ts`. Angular's `FormsModule` is also required.
58
+ ```js
59
+ import { AngularMultiSelectModule } from 'angular2-multiselect-dropdown';
60
+ import { FormsModule } from '@angular/forms';
61
+
62
+ @NgModule({
63
+ // ...
64
+ imports: [
65
+ AngularMultiSelectModule,
66
+ FormsModule
67
+ ]
68
+ // ...
69
+ })
70
+
71
+ ```
72
+
73
+ Declare the component data variables and options in your component where you want to consume the dropdown component.
74
+
75
+ ```js
76
+
77
+ import { Component, OnInit } from '@angular/core';
78
+
79
+ export class AppComponent implements OnInit {
80
+ dropdownList = [];
81
+ selectedItems = [];
82
+ dropdownSettings = {};
83
+ ngOnInit(){
84
+ this.dropdownList = [
85
+ {"id":1,"itemName":"India"},
86
+ {"id":2,"itemName":"Singapore"},
87
+ {"id":3,"itemName":"Australia"},
88
+ {"id":4,"itemName":"Canada"},
89
+ {"id":5,"itemName":"South Korea"},
90
+ {"id":6,"itemName":"Germany"},
91
+ {"id":7,"itemName":"France"},
92
+ {"id":8,"itemName":"Russia"},
93
+ {"id":9,"itemName":"Italy"},
94
+ {"id":10,"itemName":"Sweden"}
95
+ ];
96
+ this.selectedItems = [
97
+ {"id":2,"itemName":"Singapore"},
98
+ {"id":3,"itemName":"Australia"},
99
+ {"id":4,"itemName":"Canada"},
100
+ {"id":5,"itemName":"South Korea"}
101
+ ];
102
+ this.dropdownSettings = {
103
+ singleSelection: false,
104
+ text:"Select Countries",
105
+ selectAllText:'Select All',
106
+ unSelectAllText:'UnSelect All',
107
+ enableSearchFilter: true,
108
+ classes:"myclass custom-class"
109
+ };
110
+ }
111
+ onItemSelect(item:any){
112
+ console.log(item);
113
+ console.log(this.selectedItems);
114
+ }
115
+ OnItemDeSelect(item:any){
116
+ console.log(item);
117
+ console.log(this.selectedItems);
118
+ }
119
+ onSelectAll(items: any){
120
+ console.log(items);
121
+ }
122
+ onDeSelectAll(items: any){
123
+ console.log(items);
124
+ }
125
+ }
126
+ ```
127
+
128
+ Add the following component tag in you template
129
+ ```html
130
+ <angular2-multiselect [data]="dropdownList" [(ngModel)]="selectedItems"
131
+ [settings]="dropdownSettings"
132
+ (onSelect)="onItemSelect($event)"
133
+ (onDeSelect)="OnItemDeSelect($event)"
134
+ (onSelectAll)="onSelectAll($event)"
135
+ (onDeSelectAll)="onDeSelectAll($event)"></angular2-multiselect>
136
+
137
+ ```
138
+
139
+ ### Themes and Theming
140
+
141
+ - From v3.0.0 onwards, you need to include `default.theme.css` file to get the basic styling of the dropdown.
142
+ - The component package has a themes folder in node_modules at `angular2-multiselect-dropdown\themes\default.theme.css`
143
+ - Include the `default.theme.css` in `angular-cli.json` (for versions below angular 6) and `angular.json` (for version 6 or more).
144
+ - [Refer this file](https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/master/angular.json) on how to add the css file to your angular project.
145
+
146
+ You can create your own theme from now on. You can have a look at example scss theming file at [Default theme](https://github.com/CuppaLabs/angular2-multiselect-dropdown/tree/master/src/themes/default.theme.scss)
147
+
148
+
149
+ ### Template - For custom html of menu item
150
+
151
+ ```html
152
+ <angular2-multiselect [data]="dropdownList" [(ngModel)]="selectedItems" [settings]="dropdownSettings">
153
+ <c-item>
154
+ <ng-template let-item="item">
155
+ <label style="color: #333;min-width: 150px;">{{item.itemName}}</label>
156
+ <img [src]="item.image" style="width: 30px; border: 1px solid #efefef;margin-right: 20px;" />
157
+ <label>Capital - {{item.capital}}</label>
158
+ </ng-template>
159
+ </c-item>
160
+ </angular2-multiselect>
161
+
162
+ ```
163
+
164
+ ### Template - For custom html of Selected item - badge
165
+
166
+ ```html
167
+ <angular2-multiselect [data]="dropdownList" [(ngModel)]="selectedItems" [settings]="dropdownSettings">
168
+ <c-badge>
169
+ <ng-template let-item="item">
170
+ <label style="margin: 0px;">{{item.itemName}}</label>
171
+ <img [src]="item.image" style="width: 16px; margin-right: 5px;" />
172
+ </ng-template>
173
+ </c-badge>
174
+ </angular2-multiselect>
175
+
176
+ ```
177
+
178
+ ### Template Driven Forms support
179
+
180
+ ```html
181
+
182
+ <form (ngSubmit)="onSubmit()" #loginForm="ngForm" style="border: 1px solid #ccc; padding: 10px;">
183
+ <div class="form-group">
184
+ <label for="name">Skills</label>
185
+ <angular2-multiselect [data]="itemList" [(ngModel)]="formModel.skills"
186
+ [settings]="settings"
187
+ (onSelect)="onItemSelect($event)"
188
+ (onDeSelect)="OnItemDeSelect($event)"
189
+ (onSelectAll)="onSelectAll($event)"
190
+ (onDeSelectAll)="onDeSelectAll($event)" name="skills">
191
+ </angular2-multiselect>
192
+ </div>
193
+ </form>
194
+
195
+ ```
196
+
197
+ ```js
198
+
199
+ formModel = {
200
+ name: '',
201
+ email: 'ascasc@aa.com',
202
+ skills: [{ "id": 1, "itemName": "Angular" }]
203
+ };
204
+
205
+ ```
206
+
207
+ ### Reactive Forms support
208
+
209
+ ```html
210
+
211
+ <form [formGroup]="userForm" novalidate style="border: 1px solid #ccc; padding: 10px;">
212
+ <div class="form-group">
213
+ <label for="name">Skills</label>
214
+ <angular2-multiselect [data]="itemList" [(ngModel)]="selectedItems"
215
+ [settings]="settings"
216
+ (onSelect)="onItemSelect($event)"
217
+ (onDeSelect)="OnItemDeSelect($event)"
218
+ (onSelectAll)="onSelectAll($event)"
219
+ (onDeSelectAll)="onDeSelectAll($event)" formControlName="skills">
220
+ </angular2-multiselect>
221
+ </div>
222
+ </form>
223
+
224
+ ```
225
+
226
+ ```js
227
+ userForm: FormGroup;
228
+ this.userForm = this.fb.group({
229
+ name: '',
230
+ email: ['', Validators.required],
231
+ skills: [[], Validators.required]
232
+ });
233
+
234
+ ```
235
+
236
+ ### Settings
237
+ The following list of settings are supported by the component. Configure the settings to meet your requirement.
238
+
239
+ | Setting |Type | Description | Default Value |
240
+ |:--- |:--- |:--- |:--- |
241
+ | singleSelection | Boolean | To set the dropdown for single item selection only. | false |
242
+ | text | String | Text to be show in the dropdown, when no items are selected. | 'Select' |
243
+ | enableCheckAll | Boolean | Enable the option to select all items in list | false |
244
+ | selectAllText | String | Text to display as the label of select all option | Select All |
245
+ | unSelectAllText | String | Text to display as the label of unSelect option | UnSelect All |
246
+ | enableSearchFilter | Boolean | Enable filter option for the list. | false |
247
+ | enableFilterSelectAll | Boolean | A 'select all' checkbox to select all filtered results. | true |
248
+ | filterSelectAllText | String | Text to display as the label of select all option | Select all filtered results |
249
+ | filterUnSelectAllText | String | Text to display as the label of unSelect option | UnSelect all filtered results |
250
+ | maxHeight | Number | Set maximum height of the dropdown list in px. | 300 |
251
+ | badgeShowLimit | Number | Limit the number of badges/items to show in the input field. If not set will show all selected. | All |
252
+ | classes | String | Custom classes to the dropdown component. Classes are added to the dropdown selector tag. To add multiple classes, the value should be space separated class names.| '' |
253
+ | limitSelection | Number | Limit the selection of number of items from the dropdown list. Once the limit is reached, all unselected items gets disabled. | none |
254
+ | disabled | Boolean | Disable the dropdown | false |
255
+ | searchPlaceholderText | String | Custom text for the search placeholder text. Default value would be 'Search' | 'Search' |
256
+ | groupBy | String | Name of the field by which the list should be grouped. | none |
257
+ | selectGroup | Boolean | Select a group at once. GroupBy should be enabled, to use this. | false |
258
+ | searchAutofocus | Boolean | Autofocus search input field| true |
259
+ | labelKey | String | The property name which should be rendered as label in the dropdown| itemName |
260
+ | primaryKey | String | The property by which the object is identified. Default is 'id'.| id |
261
+ | position | String | Set the position of the dropdown list to 'top' or 'bottom'| bottom |
262
+ | noDataLabel | String | Label text when no data is available in the list| 'No Data Available' |
263
+ | searchBy | Array | Search the list by certain properties of the list item. Ex: ["itemName, "id","name"]. Deafult is , it will search the list by all the properties of list item | [] |
264
+ | lazyLoading | Boolean | Enable lazy loading. Used to render large datasets. | false |
265
+ | showCheckbox | Boolean | Show or hide checkboxes in the list | true |
266
+ | addNewItemOnFilter | Boolean | Whe you filter items and if, the item is not found, you can add the text as new item to the list | false |
267
+ | addNewButtonText | String | The text in the button when `addNewItemOnFilter` is enabled | 'Add' |
268
+ | escapeToClose | boolean | Press excape key to close the dropdown | true |
269
+ | autoPosition | boolean | Enable dropdown to open either on 'top' or 'bottom' Ex: settings = { position: 'bottom', autoPosition: false }; open the dropdown always at bottom | true |
270
+ | tagToBody | boolean | If the dropdown to be appended to body or not ? | true |
271
+
272
+ ### Events
273
+ - `onSelect` - Return the selected item on selection.
274
+ Example : (onSelect)="onItemSelect($event)"
275
+ - `onDeSelect` - Return the un-selected item on un-selecting.
276
+ Example : (onDeSelect)="OnItemDeSelect($event)"
277
+ - `onSelectAll` - Return the list of all selected items.
278
+ Example : (onSelectAll)="onSelectAll($event)"
279
+ - `onDeSelectAll` - Returns an empty array.
280
+ Example : (onDeSelectAll)="onDeSelectAll($event)"
281
+ - `onGroupSelect` - Returns the selected group items as an array.
282
+ Example: (onGroupSelect)="onGroupSelect($event)"
283
+ - `onGroupDeSelect` - Returns the sun-elected group items as an array.
284
+ Example: (onGroupDeSelect)="onGroupDeSelect($event)"
285
+ - `onOpen` - Callback method fired after the dropdown opens
286
+ Example : (onOpen)="onOpen($event)"
287
+ - `onClose` - Callback method, fired when the dropdown is closed
288
+ Example : (onClose)="onClose($event)"
289
+ - `onScrollToEnd` - Callback event fired when the dropdown list is scrolled to the end. Usually used with virtual scrolling, to load data on scroll.
290
+ Example : (onScrollToEnd)="fetchMore($event)"
291
+ - `onAddFilterNewItem` - Callback event fired when you click the `Add` button which will appear when `addNewItemOnFilter` setting is enabled.
292
+ Example : (onAddFilterNewItem)="onAddItem($event)"
293
+ - `onFilterSelectAll` - Callback event fired when the list is filtered and all filtered items are selected with select all filtered items checkbox.
294
+ Example : (onFilterSelectAll)="onFilterSelectAll($event)"
295
+ - `onFilterDeSelectAll` - Callback event fired when the list is filtered and all filtered items are de-selected with de-select all filtered items checkbox.
296
+ Example : (onFilterDeSelectAll)="onFilterDeSelectAll($event)"
297
+
298
+ ## Run locally
299
+ - Clone the repository or downlod the .zip,.tar files.
300
+ - Run `npm install`
301
+ - Run `ng serve` for a dev server
302
+ - Navigate to `http://localhost:4200/`
303
+ The app will automatically reload if you change any of the source files.
304
+
305
+ ## License
306
+ MIT License.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public_api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci1tdWx0aXNlbGVjdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3Byb2plY3RzL2FuZ3VsYXIyLW11bHRpc2VsZWN0LWRyb3Bkb3duLWxpYi9zcmMvYW5ndWxhci1tdWx0aXNlbGVjdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpY19hcGknO1xuIl19
@@ -0,0 +1,58 @@
1
+ import { Directive, Output, EventEmitter, HostListener, Input, } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export class ClickOutsideDirective {
4
+ _elementRef;
5
+ constructor(_elementRef) {
6
+ this._elementRef = _elementRef;
7
+ }
8
+ enabled;
9
+ clickOutside = new EventEmitter();
10
+ onClick(event, targetElement) {
11
+ console.log('clicked outside');
12
+ if (!targetElement || !this.enabled) {
13
+ return;
14
+ }
15
+ const clickedInside = this._elementRef.nativeElement.contains(targetElement);
16
+ if (!clickedInside) {
17
+ this.clickOutside.emit(event);
18
+ }
19
+ }
20
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
21
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: ClickOutsideDirective, selector: "[clickOutside]", inputs: { enabled: "enabled" }, outputs: { clickOutside: "clickOutside" }, host: { listeners: { "document:pointerdown": "onClick($event,$event.target)", "document:touchstart": "onClick($event,$event.target)" } }, ngImport: i0 });
22
+ }
23
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ClickOutsideDirective, decorators: [{
24
+ type: Directive,
25
+ args: [{
26
+ selector: '[clickOutside]',
27
+ }]
28
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { enabled: [{
29
+ type: Input
30
+ }], clickOutside: [{
31
+ type: Output
32
+ }], onClick: [{
33
+ type: HostListener,
34
+ args: ['document:pointerdown', ['$event', '$event.target']]
35
+ }, {
36
+ type: HostListener,
37
+ args: ['document:touchstart', ['$event', '$event.target']]
38
+ }] } });
39
+ export class ScrollDirective {
40
+ scroll = new EventEmitter();
41
+ onClick(event, targetElement) {
42
+ this.scroll.emit(event);
43
+ }
44
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
45
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: ScrollDirective, selector: "[scroll]", outputs: { scroll: "scroll" }, host: { listeners: { "scroll": "onClick($event)" } }, ngImport: i0 });
46
+ }
47
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScrollDirective, decorators: [{
48
+ type: Directive,
49
+ args: [{
50
+ selector: '[scroll]',
51
+ }]
52
+ }], propDecorators: { scroll: [{
53
+ type: Output
54
+ }], onClick: [{
55
+ type: HostListener,
56
+ args: ['scroll', ['$event']]
57
+ }] } });
58
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpY2tPdXRzaWRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vcHJvamVjdHMvYW5ndWxhcjItbXVsdGlzZWxlY3QtZHJvcGRvd24tbGliL3NyYy9saWIvY2xpY2tPdXRzaWRlLnRzIl0sIm5hbWVzIjpbXS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ddKVxuICBASG9zdExpc3RlbmVyKCdkb2N1bWVudDp0b3VjaHN0YXJ0JywgWyckZXZlbnQnLCAnJGV2ZW50LnRhcmdldCddKVxuICBvbkNsaWNrKGV2ZW50OiBNb3VzZUV2ZW50LCB0YXJnZXRFbGVtZW50OiBIVE1MRWxlbWVudCk6IHZvaWQge1xuICAgIGNvbnNvbGUubG9nKCdjbGlja2VkIG91dHNpZGUnKTtcbiAgICBpZiAoIXRhcmdldEVsZW1lbnQgfHwgIXRoaXMuZW5hYmxlZCkge1xuICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIGNvbnN0IGNsaWNrZWRJbnNpZGUgPVxuICAgICAgdGhpcy5fZWxlbWVudFJlZi5uYXRpdmVFbGVtZW50LmNvbnRhaW5zKHRhcmdldEVsZW1lbnQpO1xuICAgIGlmICghY2xpY2tlZEluc2lkZSkge1xuICAgICAgdGhpcy5jbGlja091dHNpZGUuZW1pdChldmVudCk7XG4gICAgfVxuICB9XG59XG5cbkBEaXJlY3RpdmUoe1xuICBzZWxlY3RvcjogJ1tzY3JvbGxdJyxcbn0pXG5leHBvcnQgY2xhc3MgU2Nyb2xsRGlyZWN0aXZlIHtcbiAgQE91dHB1dCgpXG4gIHB1YmxpYyBzY3JvbGwgPSBuZXcgRXZlbnRFbWl0dGVyPE1vdXNlRXZlbnQ+KCk7XG5cbiAgQEhvc3RMaXN0ZW5lcignc2Nyb2xsJywgWyckZXZlbnQnXSlcbiAgcHVibGljIG9uQ2xpY2soZXZlbnQ6IE1vdXNlRXZlbnQsIHRhcmdldEVsZW1lbnQ6IEhUTUxFbGVtZW50KTogdm9pZCB7XG4gICAgdGhpcy5zY3JvbGwuZW1pdChldmVudCk7XG4gIH1cbn1cbiJdfQ==
@@ -0,0 +1,59 @@
1
+ import { Pipe } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ import * as i1 from "./multiselect.service";
4
+ export class ListFilterPipe {
5
+ ds;
6
+ filteredList = [];
7
+ constructor(ds) {
8
+ this.ds = ds;
9
+ }
10
+ transform(items, filter, searchBy) {
11
+ if (!items || !filter || filter == "") {
12
+ return items;
13
+ }
14
+ this.filteredList = items.filter((item) => this.applyFilter(item, filter, searchBy));
15
+ return this.filteredList;
16
+ }
17
+ applyFilter(item, filter, searchBy) {
18
+ let found = false;
19
+ if (searchBy.length > 0) {
20
+ if (item.grpTitle) {
21
+ found = true;
22
+ }
23
+ else {
24
+ for (var t = 0; t < searchBy.length; t++) {
25
+ if (filter && item[searchBy[t]] && item[searchBy[t]] != "") {
26
+ if (item[searchBy[t]].toString().toLowerCase().indexOf(filter.toLowerCase()) >= 0) {
27
+ found = true;
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
33
+ else {
34
+ if (item.grpTitle) {
35
+ found = true;
36
+ }
37
+ else {
38
+ for (var prop in item) {
39
+ if (filter && item[prop]) {
40
+ if (item[prop].toString().toLowerCase().indexOf(filter.toLowerCase()) >= 0) {
41
+ found = true;
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ return found;
48
+ }
49
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ListFilterPipe, deps: [{ token: i1.DataService }], target: i0.ɵɵFactoryTarget.Pipe });
50
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: ListFilterPipe, name: "listFilter" });
51
+ }
52
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ListFilterPipe, decorators: [{
53
+ type: Pipe,
54
+ args: [{
55
+ name: 'listFilter',
56
+ pure: true
57
+ }]
58
+ }], ctorParameters: () => [{ type: i1.DataService }] });
59
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlzdC1maWx0ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9wcm9qZWN0cy9hbmd1bGFyMi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b3VuZCA9IGZhbHNlO1xuICAgICAgICBpZiAoc2VhcmNoQnkubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgaWYgKGl0ZW0uZ3JwVGl0bGUpIHtcbiAgICAgICAgICAgICAgICBmb3VuZCA9IHRydWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMDsgdCA8IHNlYXJjaEJ5Lmxlbmd0aDsgdCsrKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChmaWx0ZXIgJiYgaXRlbVtzZWFyY2hCeVt0XV0gJiYgaXRlbVtzZWFyY2hCeVt0XV0gIT0gXCJcIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZW1bc2VhcmNoQnlbdF1dLnRvU3RyaW5nKCkudG9Mb3dlckNhc2UoKS5pbmRleE9mKGZpbHRlci50b0xvd2VyQ2FzZSgpKSA+PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm91bmQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAoaXRlbS5ncnBUaXRsZSkge1xuICAgICAgICAgICAgICAgIGZvdW5kID0gdHJ1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGZvciAodmFyIHByb3AgaW4gaXRlbSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZmlsdGVyICYmIGl0ZW1bcHJvcF0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdGVtW3Byb3BdLnRvU3RyaW5nKCkudG9Mb3dlckNhc2UoKS5pbmRleE9mKGZpbHRlci50b0xvd2VyQ2FzZSgpKSA+PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm91bmQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGZvdW5kO1xuICAgIH1cbn0iXX0=