ng-select2-component 8.0.3 → 8.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/AUTHORS.md +16 -14
- package/CHANGELOG.md +319 -280
- package/LICENSE.md +21 -21
- package/README.md +344 -338
- package/bundles/ng-select2-component.umd.js +2634 -2445
- package/bundles/ng-select2-component.umd.js.map +1 -1
- package/bundles/ng-select2-component.umd.min.js +1 -1
- package/bundles/ng-select2-component.umd.min.js.map +1 -1
- package/esm2015/lib/select2-const.js +57 -57
- package/esm2015/lib/select2-hint.component.js +12 -12
- package/esm2015/lib/select2-interfaces.js +134 -134
- package/esm2015/lib/select2-label.component.js +12 -12
- package/esm2015/lib/select2-utils.js +415 -384
- package/esm2015/lib/select2.component.js +1530 -1384
- package/esm2015/lib/select2.module.js +23 -39
- package/esm2015/ng-select2-component.js +10 -10
- package/esm2015/public_api.js +17 -17
- package/fesm2015/ng-select2-component.js +2160 -2000
- package/fesm2015/ng-select2-component.js.map +1 -1
- package/lib/select2-const.d.ts +7 -7
- package/lib/select2-hint.component.d.ts +2 -2
- package/lib/select2-interfaces.d.ts +54 -54
- package/lib/select2-label.component.d.ts +2 -2
- package/lib/select2-utils.d.ts +24 -20
- package/lib/select2.component.d.ts +221 -207
- package/lib/select2.module.d.ts +2 -2
- package/ng-select2-component.d.ts +4 -4
- package/ng-select2-component.metadata.json +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +8 -8
|
@@ -1,207 +1,221 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
get
|
|
66
|
-
set
|
|
67
|
-
/**
|
|
68
|
-
get
|
|
69
|
-
set
|
|
70
|
-
/**
|
|
71
|
-
get
|
|
72
|
-
set
|
|
73
|
-
/** Whether
|
|
74
|
-
get
|
|
75
|
-
set
|
|
76
|
-
/** Whether
|
|
77
|
-
get
|
|
78
|
-
set
|
|
79
|
-
/**
|
|
80
|
-
get
|
|
81
|
-
set
|
|
82
|
-
/**
|
|
83
|
-
get
|
|
84
|
-
set
|
|
85
|
-
/**
|
|
86
|
-
get
|
|
87
|
-
set
|
|
88
|
-
|
|
89
|
-
get
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
private
|
|
105
|
-
|
|
106
|
-
private
|
|
107
|
-
private
|
|
108
|
-
private
|
|
109
|
-
private
|
|
110
|
-
private
|
|
111
|
-
private
|
|
112
|
-
private
|
|
113
|
-
private
|
|
114
|
-
private
|
|
115
|
-
private
|
|
116
|
-
private
|
|
117
|
-
|
|
118
|
-
private
|
|
119
|
-
private
|
|
120
|
-
private
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
private
|
|
124
|
-
|
|
125
|
-
private
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
private
|
|
155
|
-
private
|
|
156
|
-
private
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
*
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*/
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
private
|
|
204
|
-
private
|
|
205
|
-
private
|
|
206
|
-
|
|
207
|
-
|
|
1
|
+
import { ConnectedPosition } from '@angular/cdk/overlay';
|
|
2
|
+
import { ViewportRuler } from '@angular/cdk/scrolling';
|
|
3
|
+
import { AfterViewInit, ChangeDetectorRef, DoCheck, EventEmitter, OnDestroy, OnInit, TemplateRef } from '@angular/core';
|
|
4
|
+
import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms';
|
|
5
|
+
import { Select2Data, Select2Group, Select2Option, Select2RemoveEvent, Select2ScrollEvent, Select2SearchEvent, Select2UpdateEvent, Select2UpdateValue } from './select2-interfaces';
|
|
6
|
+
export declare class Select2 implements ControlValueAccessor, OnInit, OnDestroy, DoCheck, AfterViewInit {
|
|
7
|
+
protected _viewportRuler: ViewportRuler;
|
|
8
|
+
private _changeDetectorRef;
|
|
9
|
+
private _parentForm;
|
|
10
|
+
private _parentFormGroup;
|
|
11
|
+
_control: NgControl;
|
|
12
|
+
_data: Select2Data;
|
|
13
|
+
/** data of options & optiongrps */
|
|
14
|
+
set data(data: Select2Data);
|
|
15
|
+
minCharForSearch: number;
|
|
16
|
+
displaySearchStatus: 'default' | 'hidden' | 'always';
|
|
17
|
+
placeholder: string;
|
|
18
|
+
customSearchEnabled: boolean;
|
|
19
|
+
limitSelection: number;
|
|
20
|
+
listPosition: 'above' | 'below' | 'auto';
|
|
21
|
+
get multiple(): any;
|
|
22
|
+
set multiple(value: any);
|
|
23
|
+
/** use the material style */
|
|
24
|
+
get overlay(): any;
|
|
25
|
+
set overlay(value: any);
|
|
26
|
+
/** use the material style */
|
|
27
|
+
styleMode: 'material' | 'noStyle' | 'default';
|
|
28
|
+
/** message when no result */
|
|
29
|
+
noResultMessage: string;
|
|
30
|
+
/** maximum results limit (0 = no limit) */
|
|
31
|
+
maxResults: number;
|
|
32
|
+
/** message when maximum results */
|
|
33
|
+
maxResultsMessage: string;
|
|
34
|
+
/** infinite scroll distance */
|
|
35
|
+
infiniteScrollDistance: number;
|
|
36
|
+
/** infinite scroll distance */
|
|
37
|
+
infiniteScrollThrottle: number;
|
|
38
|
+
/** infinite scroll activated */
|
|
39
|
+
get infiniteScroll(): any;
|
|
40
|
+
set infiniteScroll(value: any);
|
|
41
|
+
/** use it for change the pattern of the filter search */
|
|
42
|
+
editPattern: (str: string) => string;
|
|
43
|
+
/** template for formating */
|
|
44
|
+
templates: TemplateRef<any> | {
|
|
45
|
+
[key: string]: TemplateRef<any>;
|
|
46
|
+
};
|
|
47
|
+
/** the max height of the results container when opening the select */
|
|
48
|
+
resultMaxHeight: string;
|
|
49
|
+
update: EventEmitter<Select2UpdateEvent<Select2UpdateValue>>;
|
|
50
|
+
open: EventEmitter<Select2>;
|
|
51
|
+
close: EventEmitter<Select2>;
|
|
52
|
+
focus: EventEmitter<Select2>;
|
|
53
|
+
blur: EventEmitter<Select2>;
|
|
54
|
+
search: EventEmitter<Select2SearchEvent<Select2UpdateValue>>;
|
|
55
|
+
scroll: EventEmitter<Select2ScrollEvent>;
|
|
56
|
+
removeOption: EventEmitter<Select2RemoveEvent<Select2UpdateValue>>;
|
|
57
|
+
option: Select2Option | Select2Option[] | null;
|
|
58
|
+
isOpen: boolean;
|
|
59
|
+
searchStyle: string;
|
|
60
|
+
/** Whether the element is focused or not. */
|
|
61
|
+
focused: boolean;
|
|
62
|
+
filteredData: Select2Data;
|
|
63
|
+
get select2Options(): Select2Option[];
|
|
64
|
+
get select2Option(): Select2Option;
|
|
65
|
+
get searchText(): string;
|
|
66
|
+
set searchText(text: string);
|
|
67
|
+
/** minimal data of show the search field */
|
|
68
|
+
get minCountForSearch(): number | string;
|
|
69
|
+
set minCountForSearch(value: number | string);
|
|
70
|
+
/** Unique id of the element. */
|
|
71
|
+
get id(): string;
|
|
72
|
+
set id(value: string);
|
|
73
|
+
/** Whether the element is required. */
|
|
74
|
+
get required(): any;
|
|
75
|
+
set required(value: any);
|
|
76
|
+
/** Whether selected items should be hidden. */
|
|
77
|
+
get disabled(): any;
|
|
78
|
+
set disabled(value: any);
|
|
79
|
+
/** Whether items are hidden when has. */
|
|
80
|
+
get hideSelectedItems(): any;
|
|
81
|
+
set hideSelectedItems(value: any);
|
|
82
|
+
/** Whether the element is readonly. */
|
|
83
|
+
get readonly(): any;
|
|
84
|
+
set readonly(value: any);
|
|
85
|
+
/** The input element's value. */
|
|
86
|
+
get value(): Select2UpdateValue;
|
|
87
|
+
set value(value: Select2UpdateValue);
|
|
88
|
+
/** Tab index for the select2 element. */
|
|
89
|
+
get tabIndex(): number;
|
|
90
|
+
set tabIndex(value: number);
|
|
91
|
+
/** reset with no selected value */
|
|
92
|
+
get resettable(): any;
|
|
93
|
+
set resettable(value: any);
|
|
94
|
+
get ariaInvalid(): boolean;
|
|
95
|
+
get classMaterial(): boolean;
|
|
96
|
+
get classNostyle(): boolean;
|
|
97
|
+
get select2above(): boolean;
|
|
98
|
+
overlayWidth: number;
|
|
99
|
+
overlayHeight: number;
|
|
100
|
+
_triggerRect: DOMRect;
|
|
101
|
+
_dropdownRect: DOMRect;
|
|
102
|
+
get _positions(): ConnectedPosition[];
|
|
103
|
+
maxResultsExceeded: boolean;
|
|
104
|
+
private _minCountForSearch?;
|
|
105
|
+
private cdkConnectedOverlay;
|
|
106
|
+
private selection;
|
|
107
|
+
private resultContainer;
|
|
108
|
+
private results;
|
|
109
|
+
private searchInput;
|
|
110
|
+
private dropdown;
|
|
111
|
+
private hoveringValue;
|
|
112
|
+
private innerSearchText;
|
|
113
|
+
private isSearchboxHidden;
|
|
114
|
+
private selectionElement;
|
|
115
|
+
private get resultsElement();
|
|
116
|
+
private _stateChanges;
|
|
117
|
+
/** Tab index for the element. */
|
|
118
|
+
private _tabIndex;
|
|
119
|
+
private _disabled;
|
|
120
|
+
private _required;
|
|
121
|
+
private _readonly;
|
|
122
|
+
private _multiple;
|
|
123
|
+
private _overlay;
|
|
124
|
+
private _resettable;
|
|
125
|
+
private _hideSelectedItems;
|
|
126
|
+
private _clickDetection;
|
|
127
|
+
private _clickDetectionFc;
|
|
128
|
+
private _id;
|
|
129
|
+
private _uid;
|
|
130
|
+
private _value;
|
|
131
|
+
private _previousNativeValue;
|
|
132
|
+
private _infiniteScroll;
|
|
133
|
+
private _overlayPosition;
|
|
134
|
+
constructor(_viewportRuler: ViewportRuler, _changeDetectorRef: ChangeDetectorRef, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _control: NgControl, tabIndex: string);
|
|
135
|
+
/** View -> model callback called when select has been touched */
|
|
136
|
+
private _onTouched;
|
|
137
|
+
/** View -> model callback called when value changes */
|
|
138
|
+
private _onChange;
|
|
139
|
+
ngOnInit(): void;
|
|
140
|
+
ngAfterViewInit(): void;
|
|
141
|
+
ngDoCheck(): void;
|
|
142
|
+
ngOnDestroy(): void;
|
|
143
|
+
updateSearchBox(): void;
|
|
144
|
+
hideSearch(): boolean;
|
|
145
|
+
getOptionStyle(option: Select2Option): string;
|
|
146
|
+
mouseenter(option: Select2Option): void;
|
|
147
|
+
click(option: Select2Option): void;
|
|
148
|
+
reset(e: MouseEvent): void;
|
|
149
|
+
prevChange(event: Event): void;
|
|
150
|
+
toggleOpenAndClose(): void;
|
|
151
|
+
hasTemplate(option: Select2Option | Select2Group, defaut: string): boolean;
|
|
152
|
+
getTemplate(option: Select2Option | Select2Group, defaut: string): any;
|
|
153
|
+
triggerRect(): void;
|
|
154
|
+
private testSelection;
|
|
155
|
+
private testValueChange;
|
|
156
|
+
private updateFilteredData;
|
|
157
|
+
private clickDetection;
|
|
158
|
+
private clickExit;
|
|
159
|
+
private ifParentContainsClass;
|
|
160
|
+
private ifParentContainsId;
|
|
161
|
+
private getParentElementByClass;
|
|
162
|
+
private getParentElementById;
|
|
163
|
+
private containClasses;
|
|
164
|
+
focusin(): void;
|
|
165
|
+
focusout(): void;
|
|
166
|
+
select(option: Select2Option | null): void;
|
|
167
|
+
keyDown(e: KeyboardEvent): void;
|
|
168
|
+
openKey(e: KeyboardEvent): void;
|
|
169
|
+
trackBy(_index: number, item: Select2Option): any;
|
|
170
|
+
searchUpdate(e: Event): void;
|
|
171
|
+
isSelected(option: Select2Option): "true" | "false";
|
|
172
|
+
isDisabled(option: Select2Option): "true" | "false";
|
|
173
|
+
removeSelection(e: MouseEvent, option: Select2Option): void;
|
|
174
|
+
/**
|
|
175
|
+
* Sets the model value. Implemented as part of ControlValueAccessor.
|
|
176
|
+
* @param value
|
|
177
|
+
*/
|
|
178
|
+
writeValue(value: any): void;
|
|
179
|
+
/**
|
|
180
|
+
* Saves a callback function to be invoked when the select's value
|
|
181
|
+
* changes from user input. Part of the ControlValueAccessor interface
|
|
182
|
+
* required to integrate with Angular's core forms API.
|
|
183
|
+
*
|
|
184
|
+
* @param fn Callback to be triggered when the value changes.
|
|
185
|
+
*/
|
|
186
|
+
registerOnChange(fn: (value: any) => void): void;
|
|
187
|
+
/**
|
|
188
|
+
* Saves a callback function to be invoked when the select is blurred
|
|
189
|
+
* by the user. Part of the ControlValueAccessor interface required
|
|
190
|
+
* to integrate with Angular's core forms API.
|
|
191
|
+
*
|
|
192
|
+
* @param fn Callback to be triggered when the component has been touched.
|
|
193
|
+
*/
|
|
194
|
+
registerOnTouched(fn: () => {}): void;
|
|
195
|
+
/**
|
|
196
|
+
* Sets whether the component should be disabled.
|
|
197
|
+
* Implemented as part of ControlValueAccessor.
|
|
198
|
+
* @param isDisabled
|
|
199
|
+
*/
|
|
200
|
+
setDisabledState(isDisabled: boolean): void;
|
|
201
|
+
onScroll(way: 'up' | 'down'): void;
|
|
202
|
+
_isErrorState(): boolean;
|
|
203
|
+
private moveUp;
|
|
204
|
+
private moveDown;
|
|
205
|
+
private updateScrollFromOption;
|
|
206
|
+
private selectByEnter;
|
|
207
|
+
private _testKey;
|
|
208
|
+
private _getKey;
|
|
209
|
+
private _isKey;
|
|
210
|
+
/**
|
|
211
|
+
* Sets the selected option based on a value. If no option can be
|
|
212
|
+
* found with the designated value, the select trigger is cleared.
|
|
213
|
+
*/
|
|
214
|
+
private _setSelectionByValue;
|
|
215
|
+
/** Does some manual dirty checking on the native input `value` property. */
|
|
216
|
+
private _dirtyCheckNativeValue;
|
|
217
|
+
private _coerceBooleanProperty;
|
|
218
|
+
private _focusSearchboxOrResultsElement;
|
|
219
|
+
private _focus;
|
|
220
|
+
private _isAbobeOverlay;
|
|
221
|
+
}
|
package/lib/select2.module.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare class Select2Module {
|
|
2
|
-
}
|
|
1
|
+
export declare class Select2Module {
|
|
2
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated bundle index. Do not edit.
|
|
3
|
-
*/
|
|
4
|
-
export * from './public_api';
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './public_api';
|