@ng-matero/ng-select 0.6.0 → 1.0.1
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 +155 -2
- package/_index.scss +232 -0
- package/fesm2022/ng-matero-ng-select.mjs +1146 -1144
- package/fesm2022/ng-matero-ng-select.mjs.map +1 -1
- package/index.d.ts +183 -184
- package/package.json +5 -22
- package/src/lib/ng-select.scss +219 -0
- package/scss/_mixins.scss +0 -5
- package/scss/ant.design.theme.scss +0 -412
- package/scss/default.theme.scss +0 -451
- package/scss/material.theme.scss +0 -431
- package/themes/ant.design.theme.css +0 -1
- package/themes/ant.design.theme.css.map +0 -1
- package/themes/default.theme.css +0 -1
- package/themes/default.theme.css.map +0 -1
- package/themes/material.theme.css +0 -1
- package/themes/material.theme.css.map +0 -1
|
@@ -1,74 +1,9 @@
|
|
|
1
1
|
import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { Injectable,
|
|
4
|
-
import { animationFrameScheduler, asapScheduler, Subject, fromEvent, merge } from 'rxjs';
|
|
5
|
-
import { takeUntil, auditTime, startWith, tap, debounceTime, filter, map } from 'rxjs/operators';
|
|
3
|
+
import { Injectable, inject, ElementRef, booleanAttribute, Input, ChangeDetectionStrategy, Component, EventEmitter, Renderer2, NgZone, ViewChild, Output, ViewEncapsulation, Directive, TemplateRef, InjectionToken, ChangeDetectorRef, HostAttributeToken, forwardRef, numberAttribute, ContentChild, ContentChildren, NgModule } from '@angular/core';
|
|
6
4
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
get dimensions() {
|
|
10
|
-
return this._dimensions;
|
|
11
|
-
}
|
|
12
|
-
_dimensions = {
|
|
13
|
-
itemHeight: 0,
|
|
14
|
-
panelHeight: 0,
|
|
15
|
-
itemsPerViewport: 0,
|
|
16
|
-
};
|
|
17
|
-
calculateItems(scrollPos, itemsLength, buffer) {
|
|
18
|
-
const d = this._dimensions;
|
|
19
|
-
const scrollHeight = d.itemHeight * itemsLength;
|
|
20
|
-
const scrollTop = Math.max(0, scrollPos);
|
|
21
|
-
const indexByScrollTop = (scrollTop / scrollHeight) * itemsLength;
|
|
22
|
-
let end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));
|
|
23
|
-
const maxStartEnd = end;
|
|
24
|
-
const maxStart = Math.max(0, maxStartEnd - d.itemsPerViewport);
|
|
25
|
-
let start = Math.min(maxStart, Math.floor(indexByScrollTop));
|
|
26
|
-
let topPadding = d.itemHeight * Math.ceil(start) - d.itemHeight * Math.min(start, buffer);
|
|
27
|
-
topPadding = !isNaN(topPadding) ? topPadding : 0;
|
|
28
|
-
start = !isNaN(start) ? start : -1;
|
|
29
|
-
end = !isNaN(end) ? end : -1;
|
|
30
|
-
start -= buffer;
|
|
31
|
-
start = Math.max(0, start);
|
|
32
|
-
end += buffer;
|
|
33
|
-
end = Math.min(itemsLength, end);
|
|
34
|
-
return {
|
|
35
|
-
topPadding,
|
|
36
|
-
scrollHeight,
|
|
37
|
-
start,
|
|
38
|
-
end,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
setDimensions(itemHeight, panelHeight) {
|
|
42
|
-
const itemsPerViewport = Math.max(1, Math.floor(panelHeight / itemHeight));
|
|
43
|
-
this._dimensions = {
|
|
44
|
-
itemHeight,
|
|
45
|
-
panelHeight,
|
|
46
|
-
itemsPerViewport,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
getScrollTo(itemTop, itemHeight, lastScroll) {
|
|
50
|
-
const { panelHeight } = this.dimensions;
|
|
51
|
-
const itemBottom = itemTop + itemHeight;
|
|
52
|
-
const top = lastScroll;
|
|
53
|
-
const bottom = top + panelHeight;
|
|
54
|
-
if (panelHeight >= itemBottom && lastScroll === itemTop) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
if (itemBottom > bottom) {
|
|
58
|
-
return top + itemBottom - bottom;
|
|
59
|
-
}
|
|
60
|
-
else if (itemTop <= top) {
|
|
61
|
-
return itemTop;
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgDropdownPanelUtils, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
66
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgDropdownPanelUtils, providedIn: 'root' });
|
|
67
|
-
}
|
|
68
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgDropdownPanelUtils, decorators: [{
|
|
69
|
-
type: Injectable,
|
|
70
|
-
args: [{ providedIn: 'root' }]
|
|
71
|
-
}] });
|
|
5
|
+
import { Subject, animationFrameScheduler, asapScheduler, fromEvent, merge } from 'rxjs';
|
|
6
|
+
import { takeUntil, auditTime, startWith, tap, debounceTime, filter, map } from 'rxjs/operators';
|
|
72
7
|
|
|
73
8
|
const unescapedHTMLExp = /[&<>"']/g;
|
|
74
9
|
const hasUnescapedHTMLExp = RegExp(unescapedHTMLExp.source);
|
|
@@ -107,573 +42,6 @@ var KeyCode;
|
|
|
107
42
|
KeyCode["Backspace"] = "Backspace";
|
|
108
43
|
})(KeyCode || (KeyCode = {}));
|
|
109
44
|
|
|
110
|
-
const CSS_POSITIONS = ['top', 'right', 'bottom', 'left'];
|
|
111
|
-
const SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? animationFrameScheduler : asapScheduler;
|
|
112
|
-
class NgDropdownPanel {
|
|
113
|
-
listboxId = '';
|
|
114
|
-
items = [];
|
|
115
|
-
markedItem;
|
|
116
|
-
position = 'auto';
|
|
117
|
-
appendTo;
|
|
118
|
-
bufferAmount = 4;
|
|
119
|
-
virtualScroll = false;
|
|
120
|
-
multiple = false;
|
|
121
|
-
headerTemplate;
|
|
122
|
-
footerTemplate;
|
|
123
|
-
filterValue = null;
|
|
124
|
-
update = new EventEmitter();
|
|
125
|
-
scroll = new EventEmitter();
|
|
126
|
-
scrollToEnd = new EventEmitter();
|
|
127
|
-
outsideClick = new EventEmitter();
|
|
128
|
-
scrollHostElRef;
|
|
129
|
-
scrollContentElRef;
|
|
130
|
-
scrollSpacerElRef;
|
|
131
|
-
_document = inject(DOCUMENT, { optional: true });
|
|
132
|
-
_renderer = inject(Renderer2);
|
|
133
|
-
_zone = inject(NgZone);
|
|
134
|
-
_elementRef = inject(ElementRef);
|
|
135
|
-
_panelUtils = inject(NgDropdownPanelUtils);
|
|
136
|
-
_destroy$ = new Subject();
|
|
137
|
-
_dropdown = this._elementRef.nativeElement;
|
|
138
|
-
_select;
|
|
139
|
-
_parent;
|
|
140
|
-
_scrollHost;
|
|
141
|
-
_scrollContent;
|
|
142
|
-
_scrollSpacer;
|
|
143
|
-
_scrollToEndFired = false;
|
|
144
|
-
_updateScrollHeight = false;
|
|
145
|
-
_lastScrollPosition = 0;
|
|
146
|
-
get currentPosition() {
|
|
147
|
-
return this._currentPosition;
|
|
148
|
-
}
|
|
149
|
-
_currentPosition = 'auto';
|
|
150
|
-
get itemsLength() {
|
|
151
|
-
return this._itemsLength;
|
|
152
|
-
}
|
|
153
|
-
set itemsLength(value) {
|
|
154
|
-
if (value !== this._itemsLength) {
|
|
155
|
-
this._itemsLength = value;
|
|
156
|
-
this._onItemsLengthChanged();
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
_itemsLength;
|
|
160
|
-
get _startOffset() {
|
|
161
|
-
if (this.markedItem) {
|
|
162
|
-
const { itemHeight, panelHeight } = this._panelUtils.dimensions;
|
|
163
|
-
const offset = this.markedItem.index * itemHeight;
|
|
164
|
-
return panelHeight > offset ? 0 : offset;
|
|
165
|
-
}
|
|
166
|
-
return 0;
|
|
167
|
-
}
|
|
168
|
-
ngOnInit() {
|
|
169
|
-
this._select = this._dropdown.parentElement;
|
|
170
|
-
this._scrollHost = this.scrollHostElRef.nativeElement;
|
|
171
|
-
this._scrollContent = this.scrollContentElRef.nativeElement;
|
|
172
|
-
this._scrollSpacer = this.scrollSpacerElRef.nativeElement;
|
|
173
|
-
this._handleScroll();
|
|
174
|
-
this._handleOutsideClick();
|
|
175
|
-
this._appendDropdown();
|
|
176
|
-
this._setupMousedownListener();
|
|
177
|
-
}
|
|
178
|
-
ngOnChanges(changes) {
|
|
179
|
-
if (changes['items']) {
|
|
180
|
-
const change = changes['items'];
|
|
181
|
-
this._onItemsChange(change.currentValue, change.firstChange);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
ngOnDestroy() {
|
|
185
|
-
this._destroy$.next();
|
|
186
|
-
this._destroy$.complete();
|
|
187
|
-
this._destroy$.unsubscribe();
|
|
188
|
-
if (this.appendTo) {
|
|
189
|
-
this._renderer.removeChild(this._dropdown.parentNode, this._dropdown);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
scrollTo(option, startFromOption = false) {
|
|
193
|
-
if (!option) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
const index = this.items.indexOf(option);
|
|
197
|
-
if (index < 0 || index >= this.itemsLength) {
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
let scrollTo;
|
|
201
|
-
if (this.virtualScroll) {
|
|
202
|
-
const itemHeight = this._panelUtils.dimensions.itemHeight;
|
|
203
|
-
scrollTo = this._panelUtils.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
const item = this._dropdown.querySelector(`#${option.htmlId}`);
|
|
207
|
-
const lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;
|
|
208
|
-
scrollTo = this._panelUtils.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);
|
|
209
|
-
}
|
|
210
|
-
if (isDefined(scrollTo)) {
|
|
211
|
-
this._scrollHost.scrollTop = scrollTo;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
scrollToTag() {
|
|
215
|
-
const panel = this._scrollHost;
|
|
216
|
-
panel.scrollTop = panel.scrollHeight - panel.clientHeight;
|
|
217
|
-
}
|
|
218
|
-
adjustPosition() {
|
|
219
|
-
this._updateYPosition();
|
|
220
|
-
}
|
|
221
|
-
_handleDropdownPosition() {
|
|
222
|
-
this._currentPosition = this._calculateCurrentPosition(this._dropdown);
|
|
223
|
-
if (CSS_POSITIONS.includes(this._currentPosition)) {
|
|
224
|
-
this._updateDropdownClass(this._currentPosition);
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
this._updateDropdownClass('bottom');
|
|
228
|
-
}
|
|
229
|
-
if (this.appendTo) {
|
|
230
|
-
this._updateYPosition();
|
|
231
|
-
}
|
|
232
|
-
this._dropdown.style.opacity = '1';
|
|
233
|
-
}
|
|
234
|
-
_updateDropdownClass(currentPosition) {
|
|
235
|
-
CSS_POSITIONS.forEach(position => {
|
|
236
|
-
const REMOVE_CSS_CLASS = `ng-select-${position}`;
|
|
237
|
-
this._renderer.removeClass(this._dropdown, REMOVE_CSS_CLASS);
|
|
238
|
-
this._renderer.removeClass(this._select, REMOVE_CSS_CLASS);
|
|
239
|
-
});
|
|
240
|
-
const ADD_CSS_CLASS = `ng-select-${currentPosition}`;
|
|
241
|
-
this._renderer.addClass(this._dropdown, ADD_CSS_CLASS);
|
|
242
|
-
this._renderer.addClass(this._select, ADD_CSS_CLASS);
|
|
243
|
-
}
|
|
244
|
-
_handleScroll() {
|
|
245
|
-
this._zone.runOutsideAngular(() => {
|
|
246
|
-
fromEvent(this._scrollHost, 'scroll')
|
|
247
|
-
.pipe(takeUntil(this._destroy$), auditTime(0, SCROLL_SCHEDULER))
|
|
248
|
-
.subscribe(e => {
|
|
249
|
-
const path = e.path || (e.composedPath && e.composedPath());
|
|
250
|
-
if (!path || (path.length === 0 && !e.target)) {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
const scrollTop = !path || path.length === 0 ? e.target.scrollTop : path[0].scrollTop;
|
|
254
|
-
this._onContentScrolled(scrollTop);
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
_handleOutsideClick() {
|
|
259
|
-
if (!this._document) {
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
this._zone.runOutsideAngular(() => {
|
|
263
|
-
merge(fromEvent(this._document, 'touchstart', { capture: true }), fromEvent(this._document, 'click', { capture: true }))
|
|
264
|
-
.pipe(takeUntil(this._destroy$))
|
|
265
|
-
.subscribe($event => this._checkToClose($event));
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
_checkToClose($event) {
|
|
269
|
-
if (this._select.contains($event.target) || this._dropdown.contains($event.target)) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
const path = $event.path || ($event.composedPath && $event.composedPath());
|
|
273
|
-
if ($event.target &&
|
|
274
|
-
$event.target.shadowRoot &&
|
|
275
|
-
path &&
|
|
276
|
-
path[0] &&
|
|
277
|
-
this._select.contains(path[0])) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
this._zone.run(() => this.outsideClick.emit());
|
|
281
|
-
}
|
|
282
|
-
_onItemsChange(items, firstChange) {
|
|
283
|
-
this.items = items || [];
|
|
284
|
-
this._scrollToEndFired = false;
|
|
285
|
-
this.itemsLength = items.length;
|
|
286
|
-
if (this.virtualScroll) {
|
|
287
|
-
this._updateItemsRange(firstChange);
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
this._setVirtualHeight();
|
|
291
|
-
this._updateItems(firstChange);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
_updateItems(firstChange) {
|
|
295
|
-
this.update.emit(this.items);
|
|
296
|
-
if (firstChange === false) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
this._zone.runOutsideAngular(() => {
|
|
300
|
-
Promise.resolve().then(() => {
|
|
301
|
-
const panelHeight = this._scrollHost.clientHeight;
|
|
302
|
-
this._panelUtils.setDimensions(0, panelHeight);
|
|
303
|
-
this._handleDropdownPosition();
|
|
304
|
-
this.scrollTo(this.markedItem, firstChange);
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
_updateItemsRange(firstChange) {
|
|
309
|
-
this._zone.runOutsideAngular(() => {
|
|
310
|
-
this._measureDimensions().then(() => {
|
|
311
|
-
if (firstChange) {
|
|
312
|
-
this._renderItemsRange(this._startOffset);
|
|
313
|
-
this._handleDropdownPosition();
|
|
314
|
-
}
|
|
315
|
-
else {
|
|
316
|
-
this._renderItemsRange();
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
_onContentScrolled(scrollTop) {
|
|
322
|
-
if (this.virtualScroll) {
|
|
323
|
-
this._renderItemsRange(scrollTop);
|
|
324
|
-
}
|
|
325
|
-
this._lastScrollPosition = scrollTop;
|
|
326
|
-
this._fireScrollToEnd(scrollTop);
|
|
327
|
-
}
|
|
328
|
-
_updateVirtualHeight(height) {
|
|
329
|
-
if (this._updateScrollHeight) {
|
|
330
|
-
this._scrollSpacer.style.height = `${height}px`;
|
|
331
|
-
this._updateScrollHeight = false;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
_setVirtualHeight() {
|
|
335
|
-
if (!this._scrollSpacer) {
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
this._scrollSpacer.style.height = `0px`;
|
|
339
|
-
}
|
|
340
|
-
_onItemsLengthChanged() {
|
|
341
|
-
this._updateScrollHeight = true;
|
|
342
|
-
}
|
|
343
|
-
_renderItemsRange(scrollTop) {
|
|
344
|
-
if (scrollTop && this._lastScrollPosition === scrollTop) {
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
scrollTop = scrollTop || this._scrollHost.scrollTop;
|
|
348
|
-
const range = this._panelUtils.calculateItems(scrollTop, this.itemsLength, this.bufferAmount);
|
|
349
|
-
this._updateVirtualHeight(range.scrollHeight);
|
|
350
|
-
this._scrollContent.style.transform = `translateY(${range.topPadding}px)`;
|
|
351
|
-
this._zone.run(() => {
|
|
352
|
-
this.update.emit(this.items.slice(range.start, range.end));
|
|
353
|
-
this.scroll.emit({ start: range.start, end: range.end });
|
|
354
|
-
});
|
|
355
|
-
if (isDefined(scrollTop) && this._lastScrollPosition === 0) {
|
|
356
|
-
this._scrollHost.scrollTop = scrollTop;
|
|
357
|
-
this._lastScrollPosition = scrollTop;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
_measureDimensions() {
|
|
361
|
-
if (this._panelUtils.dimensions.itemHeight > 0 || this.itemsLength === 0) {
|
|
362
|
-
return Promise.resolve(this._panelUtils.dimensions);
|
|
363
|
-
}
|
|
364
|
-
const [first] = this.items;
|
|
365
|
-
this.update.emit([first]);
|
|
366
|
-
return Promise.resolve().then(() => {
|
|
367
|
-
const option = this._dropdown.querySelector(`#${first.htmlId}`);
|
|
368
|
-
const optionHeight = option.clientHeight;
|
|
369
|
-
this._scrollSpacer.style.height = `${optionHeight * this.itemsLength}px`;
|
|
370
|
-
const panelHeight = this._scrollHost.clientHeight;
|
|
371
|
-
this._panelUtils.setDimensions(optionHeight, panelHeight);
|
|
372
|
-
return this._panelUtils.dimensions;
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
_fireScrollToEnd(scrollTop) {
|
|
376
|
-
if (this._scrollToEndFired || scrollTop === 0) {
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
const padding = this.virtualScroll ? this._scrollSpacer : this._scrollContent;
|
|
380
|
-
if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight - 1) {
|
|
381
|
-
this._zone.run(() => this.scrollToEnd.emit());
|
|
382
|
-
this._scrollToEndFired = true;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
_calculateCurrentPosition(dropdownEl) {
|
|
386
|
-
if (this.position !== 'auto') {
|
|
387
|
-
return this.position;
|
|
388
|
-
}
|
|
389
|
-
const selectRect = this._select.getBoundingClientRect();
|
|
390
|
-
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
|
391
|
-
const offsetTop = selectRect.top + window.pageYOffset;
|
|
392
|
-
const height = selectRect.height;
|
|
393
|
-
const dropdownHeight = dropdownEl.getBoundingClientRect().height;
|
|
394
|
-
if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {
|
|
395
|
-
return 'top';
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
return 'bottom';
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
_appendDropdown() {
|
|
402
|
-
if (!this.appendTo) {
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
this._parent = this._dropdown.shadowRoot
|
|
406
|
-
? this._dropdown.shadowRoot.querySelector(this.appendTo)
|
|
407
|
-
: document.querySelector(this.appendTo);
|
|
408
|
-
if (!this._parent) {
|
|
409
|
-
throw new Error(`appendTo selector ${this.appendTo} did not found any parent element`);
|
|
410
|
-
}
|
|
411
|
-
this._updateXPosition();
|
|
412
|
-
this._parent.appendChild(this._dropdown);
|
|
413
|
-
}
|
|
414
|
-
_updateXPosition() {
|
|
415
|
-
const select = this._select.getBoundingClientRect();
|
|
416
|
-
const parent = this._parent.getBoundingClientRect();
|
|
417
|
-
const offsetLeft = select.left - parent.left;
|
|
418
|
-
this._dropdown.style.left = offsetLeft + 'px';
|
|
419
|
-
this._dropdown.style.width = select.width + 'px';
|
|
420
|
-
this._dropdown.style.minWidth = select.width + 'px';
|
|
421
|
-
}
|
|
422
|
-
_updateYPosition() {
|
|
423
|
-
const select = this._select.getBoundingClientRect();
|
|
424
|
-
const parent = this._parent.getBoundingClientRect();
|
|
425
|
-
const delta = select.height;
|
|
426
|
-
if (this._currentPosition === 'top') {
|
|
427
|
-
const offsetBottom = parent.bottom - select.bottom;
|
|
428
|
-
this._dropdown.style.bottom = offsetBottom + delta + 'px';
|
|
429
|
-
this._dropdown.style.top = 'auto';
|
|
430
|
-
}
|
|
431
|
-
else if (this._currentPosition === 'bottom') {
|
|
432
|
-
const offsetTop = select.top - parent.top;
|
|
433
|
-
this._dropdown.style.top = offsetTop + delta + 'px';
|
|
434
|
-
this._dropdown.style.bottom = 'auto';
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
_setupMousedownListener() {
|
|
438
|
-
this._zone.runOutsideAngular(() => {
|
|
439
|
-
fromEvent(this._dropdown, 'mousedown')
|
|
440
|
-
.pipe(takeUntil(this._destroy$))
|
|
441
|
-
.subscribe(event => {
|
|
442
|
-
const target = event.target;
|
|
443
|
-
if (target.tagName === 'INPUT') {
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
event.preventDefault();
|
|
447
|
-
});
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgDropdownPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
451
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: NgDropdownPanel, isStandalone: true, selector: "ng-dropdown-panel", inputs: { listboxId: "listboxId", items: "items", markedItem: "markedItem", position: "position", appendTo: "appendTo", bufferAmount: "bufferAmount", virtualScroll: ["virtualScroll", "virtualScroll", booleanAttribute], multiple: ["multiple", "multiple", booleanAttribute], headerTemplate: "headerTemplate", footerTemplate: "footerTemplate", filterValue: "filterValue" }, outputs: { update: "update", scroll: "scroll", scrollToEnd: "scrollToEnd", outsideClick: "outsideClick" }, host: { properties: { "class.ng-select-multiple": "multiple" }, classAttribute: "ng-dropdown-panel" }, viewQueries: [{ propertyName: "scrollHostElRef", first: true, predicate: ["scrollHost"], descendants: true, read: ElementRef, static: true }, { propertyName: "scrollContentElRef", first: true, predicate: ["scrollContent"], descendants: true, read: ElementRef, static: true }, { propertyName: "scrollSpacerElRef", first: true, predicate: ["scrollSpacer"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
452
|
-
@if (headerTemplate) {
|
|
453
|
-
<div class="ng-dropdown-header">
|
|
454
|
-
<ng-container
|
|
455
|
-
[ngTemplateOutlet]="headerTemplate"
|
|
456
|
-
[ngTemplateOutletContext]="{ searchTerm: filterValue }"
|
|
457
|
-
/>
|
|
458
|
-
</div>
|
|
459
|
-
}
|
|
460
|
-
<div
|
|
461
|
-
#scrollHost
|
|
462
|
-
class="ng-dropdown-panel-items"
|
|
463
|
-
[class.ng-select-virtual-scroll-host]="virtualScroll"
|
|
464
|
-
[attr.id]="listboxId"
|
|
465
|
-
[attr.aria-multiselectable]="multiple"
|
|
466
|
-
role="listbox"
|
|
467
|
-
>
|
|
468
|
-
<div #scrollSpacer [class.ng-select-virtual-scroll-spacer]="virtualScroll"></div>
|
|
469
|
-
<div
|
|
470
|
-
#scrollContent
|
|
471
|
-
[class.ng-select-virtual-scroll-content]="virtualScroll && items.length"
|
|
472
|
-
role="presentation"
|
|
473
|
-
>
|
|
474
|
-
<ng-content />
|
|
475
|
-
</div>
|
|
476
|
-
</div>
|
|
477
|
-
@if (footerTemplate) {
|
|
478
|
-
<div class="ng-dropdown-footer">
|
|
479
|
-
<ng-container
|
|
480
|
-
[ngTemplateOutlet]="footerTemplate"
|
|
481
|
-
[ngTemplateOutletContext]="{ searchTerm: filterValue }"
|
|
482
|
-
/>
|
|
483
|
-
</div>
|
|
484
|
-
}
|
|
485
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
486
|
-
}
|
|
487
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgDropdownPanel, decorators: [{
|
|
488
|
-
type: Component,
|
|
489
|
-
args: [{
|
|
490
|
-
selector: 'ng-dropdown-panel',
|
|
491
|
-
template: `
|
|
492
|
-
@if (headerTemplate) {
|
|
493
|
-
<div class="ng-dropdown-header">
|
|
494
|
-
<ng-container
|
|
495
|
-
[ngTemplateOutlet]="headerTemplate"
|
|
496
|
-
[ngTemplateOutletContext]="{ searchTerm: filterValue }"
|
|
497
|
-
/>
|
|
498
|
-
</div>
|
|
499
|
-
}
|
|
500
|
-
<div
|
|
501
|
-
#scrollHost
|
|
502
|
-
class="ng-dropdown-panel-items"
|
|
503
|
-
[class.ng-select-virtual-scroll-host]="virtualScroll"
|
|
504
|
-
[attr.id]="listboxId"
|
|
505
|
-
[attr.aria-multiselectable]="multiple"
|
|
506
|
-
role="listbox"
|
|
507
|
-
>
|
|
508
|
-
<div #scrollSpacer [class.ng-select-virtual-scroll-spacer]="virtualScroll"></div>
|
|
509
|
-
<div
|
|
510
|
-
#scrollContent
|
|
511
|
-
[class.ng-select-virtual-scroll-content]="virtualScroll && items.length"
|
|
512
|
-
role="presentation"
|
|
513
|
-
>
|
|
514
|
-
<ng-content />
|
|
515
|
-
</div>
|
|
516
|
-
</div>
|
|
517
|
-
@if (footerTemplate) {
|
|
518
|
-
<div class="ng-dropdown-footer">
|
|
519
|
-
<ng-container
|
|
520
|
-
[ngTemplateOutlet]="footerTemplate"
|
|
521
|
-
[ngTemplateOutletContext]="{ searchTerm: filterValue }"
|
|
522
|
-
/>
|
|
523
|
-
</div>
|
|
524
|
-
}
|
|
525
|
-
`,
|
|
526
|
-
imports: [NgTemplateOutlet],
|
|
527
|
-
host: {
|
|
528
|
-
'class': 'ng-dropdown-panel',
|
|
529
|
-
'[class.ng-select-multiple]': 'multiple',
|
|
530
|
-
},
|
|
531
|
-
encapsulation: ViewEncapsulation.None,
|
|
532
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
533
|
-
}]
|
|
534
|
-
}], propDecorators: { listboxId: [{
|
|
535
|
-
type: Input
|
|
536
|
-
}], items: [{
|
|
537
|
-
type: Input
|
|
538
|
-
}], markedItem: [{
|
|
539
|
-
type: Input
|
|
540
|
-
}], position: [{
|
|
541
|
-
type: Input
|
|
542
|
-
}], appendTo: [{
|
|
543
|
-
type: Input
|
|
544
|
-
}], bufferAmount: [{
|
|
545
|
-
type: Input
|
|
546
|
-
}], virtualScroll: [{
|
|
547
|
-
type: Input,
|
|
548
|
-
args: [{ transform: booleanAttribute }]
|
|
549
|
-
}], multiple: [{
|
|
550
|
-
type: Input,
|
|
551
|
-
args: [{ transform: booleanAttribute }]
|
|
552
|
-
}], headerTemplate: [{
|
|
553
|
-
type: Input
|
|
554
|
-
}], footerTemplate: [{
|
|
555
|
-
type: Input
|
|
556
|
-
}], filterValue: [{
|
|
557
|
-
type: Input
|
|
558
|
-
}], update: [{
|
|
559
|
-
type: Output
|
|
560
|
-
}], scroll: [{
|
|
561
|
-
type: Output
|
|
562
|
-
}], scrollToEnd: [{
|
|
563
|
-
type: Output
|
|
564
|
-
}], outsideClick: [{
|
|
565
|
-
type: Output
|
|
566
|
-
}], scrollHostElRef: [{
|
|
567
|
-
type: ViewChild,
|
|
568
|
-
args: ['scrollHost', { read: ElementRef, static: true }]
|
|
569
|
-
}], scrollContentElRef: [{
|
|
570
|
-
type: ViewChild,
|
|
571
|
-
args: ['scrollContent', { read: ElementRef, static: true }]
|
|
572
|
-
}], scrollSpacerElRef: [{
|
|
573
|
-
type: ViewChild,
|
|
574
|
-
args: ['scrollSpacer', { read: ElementRef, static: true }]
|
|
575
|
-
}] } });
|
|
576
|
-
|
|
577
|
-
class NgOption {
|
|
578
|
-
value;
|
|
579
|
-
disabled = false;
|
|
580
|
-
elementRef = inject(ElementRef);
|
|
581
|
-
stateChange$ = new Subject();
|
|
582
|
-
_previousLabel = '';
|
|
583
|
-
get label() {
|
|
584
|
-
return (this.elementRef.nativeElement.textContent || '').trim();
|
|
585
|
-
}
|
|
586
|
-
ngOnChanges(changes) {
|
|
587
|
-
if (changes['disabled']) {
|
|
588
|
-
this.stateChange$.next({
|
|
589
|
-
value: this.value,
|
|
590
|
-
disabled: this.disabled,
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
ngAfterViewChecked() {
|
|
595
|
-
if (this.label !== this._previousLabel) {
|
|
596
|
-
this._previousLabel = this.label;
|
|
597
|
-
this.stateChange$.next({
|
|
598
|
-
value: this.value,
|
|
599
|
-
disabled: this.disabled,
|
|
600
|
-
label: this.elementRef.nativeElement.innerHTML,
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
ngOnDestroy() {
|
|
605
|
-
this.stateChange$.complete();
|
|
606
|
-
}
|
|
607
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOption, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
608
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.3.12", type: NgOption, isStandalone: true, selector: "ng-option", inputs: { value: "value", disabled: ["disabled", "disabled", booleanAttribute] }, usesOnChanges: true, ngImport: i0, template: `
|
|
609
|
-
<ng-content />
|
|
610
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
611
|
-
}
|
|
612
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOption, decorators: [{
|
|
613
|
-
type: Component,
|
|
614
|
-
args: [{
|
|
615
|
-
selector: 'ng-option',
|
|
616
|
-
template: `
|
|
617
|
-
<ng-content />
|
|
618
|
-
`,
|
|
619
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
620
|
-
}]
|
|
621
|
-
}], propDecorators: { value: [{
|
|
622
|
-
type: Input
|
|
623
|
-
}], disabled: [{
|
|
624
|
-
type: Input,
|
|
625
|
-
args: [{ transform: booleanAttribute }]
|
|
626
|
-
}] } });
|
|
627
|
-
|
|
628
|
-
class NgOptionHighlight {
|
|
629
|
-
term = '';
|
|
630
|
-
elementRef = inject(ElementRef);
|
|
631
|
-
renderer = inject(Renderer2);
|
|
632
|
-
element = this.elementRef.nativeElement;
|
|
633
|
-
label = '';
|
|
634
|
-
get _canHighlight() {
|
|
635
|
-
return this.term && this.label;
|
|
636
|
-
}
|
|
637
|
-
ngOnChanges() {
|
|
638
|
-
if (this._canHighlight) {
|
|
639
|
-
this._highlightLabel();
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
ngAfterViewInit() {
|
|
643
|
-
this.label = this.element.innerHTML;
|
|
644
|
-
if (this._canHighlight) {
|
|
645
|
-
this._highlightLabel();
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
_escapeRegExp(str) {
|
|
649
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
650
|
-
}
|
|
651
|
-
_highlightLabel() {
|
|
652
|
-
const label = this.label;
|
|
653
|
-
if (!this.term) {
|
|
654
|
-
this._setInnerHtml(label);
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
const alternationString = this._escapeRegExp(this.term).replace(' ', '|');
|
|
658
|
-
const termRegex = new RegExp(alternationString, 'gi');
|
|
659
|
-
this._setInnerHtml(label.replace(termRegex, `<span class="highlighted">$&</span>`));
|
|
660
|
-
}
|
|
661
|
-
_setInnerHtml(html) {
|
|
662
|
-
this.renderer.setProperty(this.elementRef.nativeElement, 'innerHTML', html);
|
|
663
|
-
}
|
|
664
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOptionHighlight, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
665
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgOptionHighlight, isStandalone: true, selector: "[ngOptionHighlight]", inputs: { term: ["ngOptionHighlight", "term"] }, usesOnChanges: true, ngImport: i0 });
|
|
666
|
-
}
|
|
667
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOptionHighlight, decorators: [{
|
|
668
|
-
type: Directive,
|
|
669
|
-
args: [{
|
|
670
|
-
selector: '[ngOptionHighlight]',
|
|
671
|
-
}]
|
|
672
|
-
}], propDecorators: { term: [{
|
|
673
|
-
type: Input,
|
|
674
|
-
args: ['ngOptionHighlight']
|
|
675
|
-
}] } });
|
|
676
|
-
|
|
677
45
|
const diacritics = {
|
|
678
46
|
'\u24B6': 'A',
|
|
679
47
|
'\uFF21': 'A',
|
|
@@ -1521,562 +889,1149 @@ function stripSpecialChars(text) {
|
|
|
1521
889
|
return text.replace(/[^\u0000-\u007E]/g, match);
|
|
1522
890
|
}
|
|
1523
891
|
|
|
1524
|
-
class ItemsList {
|
|
1525
|
-
_ngSelect;
|
|
1526
|
-
_selectionModel;
|
|
1527
|
-
_groups;
|
|
1528
|
-
constructor(_ngSelect, _selectionModel) {
|
|
1529
|
-
this._ngSelect = _ngSelect;
|
|
1530
|
-
this._selectionModel = _selectionModel;
|
|
1531
|
-
}
|
|
1532
|
-
get items() {
|
|
1533
|
-
return this._items;
|
|
1534
|
-
}
|
|
1535
|
-
_items = [];
|
|
1536
|
-
get filteredItems() {
|
|
1537
|
-
return this._filteredItems;
|
|
1538
|
-
}
|
|
1539
|
-
_filteredItems = [];
|
|
1540
|
-
get markedIndex() {
|
|
1541
|
-
return this._markedIndex;
|
|
892
|
+
class ItemsList {
|
|
893
|
+
_ngSelect;
|
|
894
|
+
_selectionModel;
|
|
895
|
+
_groups;
|
|
896
|
+
constructor(_ngSelect, _selectionModel) {
|
|
897
|
+
this._ngSelect = _ngSelect;
|
|
898
|
+
this._selectionModel = _selectionModel;
|
|
899
|
+
}
|
|
900
|
+
get items() {
|
|
901
|
+
return this._items;
|
|
902
|
+
}
|
|
903
|
+
_items = [];
|
|
904
|
+
get filteredItems() {
|
|
905
|
+
return this._filteredItems;
|
|
906
|
+
}
|
|
907
|
+
_filteredItems = [];
|
|
908
|
+
get markedIndex() {
|
|
909
|
+
return this._markedIndex;
|
|
910
|
+
}
|
|
911
|
+
_markedIndex = -1;
|
|
912
|
+
get selectedItems() {
|
|
913
|
+
return this._selectionModel.value;
|
|
914
|
+
}
|
|
915
|
+
get markedItem() {
|
|
916
|
+
return this._filteredItems[this._markedIndex];
|
|
917
|
+
}
|
|
918
|
+
get noItemsToSelect() {
|
|
919
|
+
return this._ngSelect.hideSelected && this._items.length === this.selectedItems.length;
|
|
920
|
+
}
|
|
921
|
+
get maxItemsSelected() {
|
|
922
|
+
return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this.selectedItems.length;
|
|
923
|
+
}
|
|
924
|
+
get lastSelectedItem() {
|
|
925
|
+
let i = this.selectedItems.length - 1;
|
|
926
|
+
for (; i >= 0; i--) {
|
|
927
|
+
const item = this.selectedItems[i];
|
|
928
|
+
if (!item.disabled) {
|
|
929
|
+
return item;
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
return null;
|
|
933
|
+
}
|
|
934
|
+
setItems(items) {
|
|
935
|
+
this._items = items.map((item, index) => this.mapItem(item, index));
|
|
936
|
+
if (this._ngSelect.groupBy) {
|
|
937
|
+
this._groups = this._groupBy(this._items, this._ngSelect.groupBy);
|
|
938
|
+
this._items = this._flatten(this._groups);
|
|
939
|
+
}
|
|
940
|
+
else {
|
|
941
|
+
this._groups = new Map();
|
|
942
|
+
this._groups.set(undefined, this._items);
|
|
943
|
+
}
|
|
944
|
+
this._filteredItems = [...this._items];
|
|
945
|
+
}
|
|
946
|
+
select(item) {
|
|
947
|
+
if (item.selected || this.maxItemsSelected) {
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
const multiple = this._ngSelect.multiple;
|
|
951
|
+
if (!multiple) {
|
|
952
|
+
this.clearSelected();
|
|
953
|
+
}
|
|
954
|
+
this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel);
|
|
955
|
+
if (this._ngSelect.hideSelected) {
|
|
956
|
+
this._hideSelected(item);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
unselect(item) {
|
|
960
|
+
if (!item.selected) {
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
this._selectionModel.unselect(item, this._ngSelect.multiple);
|
|
964
|
+
if (this._ngSelect.hideSelected && isDefined(item.index) && this._ngSelect.multiple) {
|
|
965
|
+
this._showSelected(item);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
findItem(value) {
|
|
969
|
+
let findBy;
|
|
970
|
+
if (this._ngSelect.compareWith) {
|
|
971
|
+
findBy = item => this._ngSelect.compareWith(item.value, value);
|
|
972
|
+
}
|
|
973
|
+
else if (this._ngSelect.bindValue) {
|
|
974
|
+
findBy = item => !item.children &&
|
|
975
|
+
this.resolveNested(item.value, this._ngSelect.bindValue) === value;
|
|
976
|
+
}
|
|
977
|
+
else {
|
|
978
|
+
findBy = item => item.value === value ||
|
|
979
|
+
!!(!item.children &&
|
|
980
|
+
item.label &&
|
|
981
|
+
item.label === this.resolveNested(value, this._ngSelect.bindLabel));
|
|
982
|
+
}
|
|
983
|
+
return this._items.find(item => findBy(item));
|
|
984
|
+
}
|
|
985
|
+
addItem(item) {
|
|
986
|
+
const option = this.mapItem(item, this._items.length);
|
|
987
|
+
this._items.push(option);
|
|
988
|
+
this._filteredItems.push(option);
|
|
989
|
+
return option;
|
|
990
|
+
}
|
|
991
|
+
clearSelected(keepDisabled = false) {
|
|
992
|
+
this._selectionModel.clear(keepDisabled);
|
|
993
|
+
this._items.forEach(item => {
|
|
994
|
+
item.selected = keepDisabled && item.selected && item.disabled;
|
|
995
|
+
item.marked = false;
|
|
996
|
+
});
|
|
997
|
+
if (this._ngSelect.hideSelected) {
|
|
998
|
+
this.resetFilteredItems();
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
findByLabel(term) {
|
|
1002
|
+
term = stripSpecialChars(term).toLocaleLowerCase();
|
|
1003
|
+
return this.filteredItems.find(item => {
|
|
1004
|
+
const label = stripSpecialChars(item.label).toLocaleLowerCase();
|
|
1005
|
+
return label.startsWith(term);
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
filter(term) {
|
|
1009
|
+
if (!term) {
|
|
1010
|
+
this.resetFilteredItems();
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
this._filteredItems = [];
|
|
1014
|
+
term = this._ngSelect.searchFn ? term : stripSpecialChars(term).toLocaleLowerCase();
|
|
1015
|
+
const match = this._ngSelect.searchFn || this._defaultSearchFn;
|
|
1016
|
+
const hideSelected = this._ngSelect.hideSelected;
|
|
1017
|
+
for (const key of Array.from(this._groups.keys())) {
|
|
1018
|
+
const matchedItems = [];
|
|
1019
|
+
for (const item of this._groups.get(key)) {
|
|
1020
|
+
if (hideSelected && ((item.parent && item.parent.selected) || item.selected)) {
|
|
1021
|
+
continue;
|
|
1022
|
+
}
|
|
1023
|
+
const searchItem = this._ngSelect.searchFn ? item.value : item;
|
|
1024
|
+
if (match(term, searchItem)) {
|
|
1025
|
+
matchedItems.push(item);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
if (matchedItems.length > 0) {
|
|
1029
|
+
const [last] = matchedItems.slice(-1);
|
|
1030
|
+
if (last.parent) {
|
|
1031
|
+
const head = this._items.find(x => x === last.parent);
|
|
1032
|
+
this._filteredItems.push(head);
|
|
1033
|
+
}
|
|
1034
|
+
this._filteredItems.push(...matchedItems);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
resetFilteredItems() {
|
|
1039
|
+
if (this._filteredItems.length === this._items.length) {
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1042
|
+
if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {
|
|
1043
|
+
this._filteredItems = this._items.filter(x => !x.selected);
|
|
1044
|
+
}
|
|
1045
|
+
else {
|
|
1046
|
+
this._filteredItems = this._items;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
unmarkItem() {
|
|
1050
|
+
this._markedIndex = -1;
|
|
1051
|
+
}
|
|
1052
|
+
markNextItem() {
|
|
1053
|
+
this._stepToItem(+1);
|
|
1054
|
+
}
|
|
1055
|
+
markPreviousItem() {
|
|
1056
|
+
this._stepToItem(-1);
|
|
1057
|
+
}
|
|
1058
|
+
markItem(item) {
|
|
1059
|
+
this._markedIndex = this._filteredItems.indexOf(item);
|
|
1060
|
+
}
|
|
1061
|
+
markSelectedOrDefault(markDefault) {
|
|
1062
|
+
if (this._filteredItems.length === 0) {
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
const lastMarkedIndex = this._getLastMarkedIndex();
|
|
1066
|
+
if (lastMarkedIndex > -1) {
|
|
1067
|
+
this._markedIndex = lastMarkedIndex;
|
|
1068
|
+
}
|
|
1069
|
+
else {
|
|
1070
|
+
this._markedIndex = markDefault ? this.filteredItems.findIndex(x => !x.disabled) : -1;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
resolveNested(option, key) {
|
|
1074
|
+
if (!isObject(option)) {
|
|
1075
|
+
return option;
|
|
1076
|
+
}
|
|
1077
|
+
if (key.indexOf('.') === -1) {
|
|
1078
|
+
return option[key];
|
|
1079
|
+
}
|
|
1080
|
+
else {
|
|
1081
|
+
const keys = key.split('.');
|
|
1082
|
+
let value = option;
|
|
1083
|
+
for (let i = 0, len = keys.length; i < len; ++i) {
|
|
1084
|
+
if (value == null) {
|
|
1085
|
+
return null;
|
|
1086
|
+
}
|
|
1087
|
+
value = value[keys[i]];
|
|
1088
|
+
}
|
|
1089
|
+
return value;
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
mapItem(item, index) {
|
|
1093
|
+
const label = isDefined(item.$ngOptionLabel)
|
|
1094
|
+
? item.$ngOptionLabel
|
|
1095
|
+
: this.resolveNested(item, this._ngSelect.bindLabel);
|
|
1096
|
+
const value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
|
|
1097
|
+
return {
|
|
1098
|
+
index,
|
|
1099
|
+
label: isDefined(label) ? label.toString() : '',
|
|
1100
|
+
value,
|
|
1101
|
+
viewValue: item.viewValue || label,
|
|
1102
|
+
disabled: item.disabled,
|
|
1103
|
+
htmlId: `${this._ngSelect._uid}-option-${index}`,
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
mapSelectedItems() {
|
|
1107
|
+
const multiple = this._ngSelect.multiple;
|
|
1108
|
+
for (const selected of this.selectedItems) {
|
|
1109
|
+
const value = this._ngSelect.bindValue
|
|
1110
|
+
? this.resolveNested(selected.value, this._ngSelect.bindValue)
|
|
1111
|
+
: selected.value;
|
|
1112
|
+
const item = isDefined(value) ? this.findItem(value) : null;
|
|
1113
|
+
this._selectionModel.unselect(selected, multiple);
|
|
1114
|
+
this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);
|
|
1115
|
+
}
|
|
1116
|
+
if (this._ngSelect.hideSelected) {
|
|
1117
|
+
this._filteredItems = this.filteredItems.filter(x => this.selectedItems.indexOf(x) === -1);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
_showSelected(item) {
|
|
1121
|
+
this._filteredItems.push(item);
|
|
1122
|
+
if (item.parent) {
|
|
1123
|
+
const parent = item.parent;
|
|
1124
|
+
const parentExists = this._filteredItems.find(x => x === parent);
|
|
1125
|
+
if (!parentExists) {
|
|
1126
|
+
this._filteredItems.push(parent);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
else if (item.children) {
|
|
1130
|
+
for (const child of item.children) {
|
|
1131
|
+
child.selected = false;
|
|
1132
|
+
this._filteredItems.push(child);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
this._filteredItems = [...this._filteredItems.sort((a, b) => a.index - b.index)];
|
|
1136
|
+
}
|
|
1137
|
+
_hideSelected(item) {
|
|
1138
|
+
this._filteredItems = this._filteredItems.filter(x => x !== item);
|
|
1139
|
+
if (item.parent) {
|
|
1140
|
+
const children = item.parent.children;
|
|
1141
|
+
if (children.every(x => x.selected)) {
|
|
1142
|
+
this._filteredItems = this._filteredItems.filter(x => x !== item.parent);
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
else if (item.children) {
|
|
1146
|
+
this._filteredItems = this.filteredItems.filter(x => x.parent !== item);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
_defaultSearchFn(search, opt) {
|
|
1150
|
+
const label = stripSpecialChars(opt.label).toLocaleLowerCase();
|
|
1151
|
+
return label.indexOf(search) > -1;
|
|
1152
|
+
}
|
|
1153
|
+
_getNextItemIndex(steps) {
|
|
1154
|
+
if (steps > 0) {
|
|
1155
|
+
return this._markedIndex >= this._filteredItems.length - 1 ? 0 : this._markedIndex + 1;
|
|
1156
|
+
}
|
|
1157
|
+
return this._markedIndex <= 0 ? this._filteredItems.length - 1 : this._markedIndex - 1;
|
|
1158
|
+
}
|
|
1159
|
+
_stepToItem(steps) {
|
|
1160
|
+
if (this._filteredItems.length === 0 || this._filteredItems.every(x => x.disabled)) {
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
this._markedIndex = this._getNextItemIndex(steps);
|
|
1164
|
+
if (this.markedItem?.disabled) {
|
|
1165
|
+
this._stepToItem(steps);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
_getLastMarkedIndex() {
|
|
1169
|
+
if (this._ngSelect.hideSelected) {
|
|
1170
|
+
return -1;
|
|
1171
|
+
}
|
|
1172
|
+
if (this._markedIndex > -1 && this.markedItem == null) {
|
|
1173
|
+
return -1;
|
|
1174
|
+
}
|
|
1175
|
+
const selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);
|
|
1176
|
+
if (this.lastSelectedItem && selectedIndex < 0) {
|
|
1177
|
+
return -1;
|
|
1178
|
+
}
|
|
1179
|
+
return Math.max(this.markedIndex, selectedIndex);
|
|
1180
|
+
}
|
|
1181
|
+
_groupBy(items, prop) {
|
|
1182
|
+
const groups = new Map();
|
|
1183
|
+
if (items.length === 0) {
|
|
1184
|
+
return groups;
|
|
1185
|
+
}
|
|
1186
|
+
// Check if items are already grouped by given key.
|
|
1187
|
+
if (Array.isArray(items[0].value[prop])) {
|
|
1188
|
+
for (const item of items) {
|
|
1189
|
+
const children = (item.value[prop] || []).map((x, index) => this.mapItem(x, index));
|
|
1190
|
+
groups.set(item, children);
|
|
1191
|
+
}
|
|
1192
|
+
return groups;
|
|
1193
|
+
}
|
|
1194
|
+
const isFnKey = isFunction(this._ngSelect.groupBy);
|
|
1195
|
+
const keyFn = (item) => {
|
|
1196
|
+
const key = isFnKey ? prop(item.value) : item.value[prop];
|
|
1197
|
+
return isDefined(key) ? key : undefined;
|
|
1198
|
+
};
|
|
1199
|
+
// Group items by key.
|
|
1200
|
+
for (const item of items) {
|
|
1201
|
+
const key = keyFn(item);
|
|
1202
|
+
const group = groups.get(key);
|
|
1203
|
+
if (group) {
|
|
1204
|
+
group.push(item);
|
|
1205
|
+
}
|
|
1206
|
+
else {
|
|
1207
|
+
groups.set(key, [item]);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
return groups;
|
|
1211
|
+
}
|
|
1212
|
+
_flatten(groups) {
|
|
1213
|
+
const isGroupByFn = isFunction(this._ngSelect.groupBy);
|
|
1214
|
+
const items = [];
|
|
1215
|
+
let groupIndex = 0;
|
|
1216
|
+
for (const key of groups.keys()) {
|
|
1217
|
+
let i = items.length;
|
|
1218
|
+
if (key == null) {
|
|
1219
|
+
const withoutGroup = groups.get(undefined) || [];
|
|
1220
|
+
items.push(...withoutGroup.map(x => {
|
|
1221
|
+
x.index = i++;
|
|
1222
|
+
return x;
|
|
1223
|
+
}));
|
|
1224
|
+
continue;
|
|
1225
|
+
}
|
|
1226
|
+
const isObjectKey = isObject(key);
|
|
1227
|
+
const parent = {
|
|
1228
|
+
label: isObjectKey ? '' : String(key),
|
|
1229
|
+
children: null,
|
|
1230
|
+
parent: null,
|
|
1231
|
+
index: i++,
|
|
1232
|
+
disabled: !this._ngSelect.selectableGroup,
|
|
1233
|
+
htmlId: `${this._ngSelect._uid}-group-${groupIndex}-heading`,
|
|
1234
|
+
};
|
|
1235
|
+
const groupKey = isGroupByFn
|
|
1236
|
+
? this._ngSelect.bindLabel
|
|
1237
|
+
: this._ngSelect.groupBy;
|
|
1238
|
+
const groupValue = this._ngSelect.groupValue ||
|
|
1239
|
+
(() => {
|
|
1240
|
+
if (isObjectKey) {
|
|
1241
|
+
return key.value;
|
|
1242
|
+
}
|
|
1243
|
+
return { [groupKey]: key };
|
|
1244
|
+
});
|
|
1245
|
+
const children = groups.get(key).map(x => {
|
|
1246
|
+
x.parent = parent;
|
|
1247
|
+
x.children = null;
|
|
1248
|
+
x.index = i++;
|
|
1249
|
+
return x;
|
|
1250
|
+
});
|
|
1251
|
+
parent.children = children;
|
|
1252
|
+
parent.value = groupValue(key, children.map(x => x.value));
|
|
1253
|
+
items.push(parent);
|
|
1254
|
+
items.push(...children);
|
|
1255
|
+
groupIndex++;
|
|
1256
|
+
}
|
|
1257
|
+
return items;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
class NgSelectConfig {
|
|
1262
|
+
placeholder;
|
|
1263
|
+
fixedPlaceholder = false;
|
|
1264
|
+
notFoundText = 'No items found';
|
|
1265
|
+
typeToSearchText = 'Type to search';
|
|
1266
|
+
addTagText = 'Add item';
|
|
1267
|
+
loadingText = 'Loading...';
|
|
1268
|
+
clearAllText = 'Clear all';
|
|
1269
|
+
virtualScroll = false;
|
|
1270
|
+
openOnEnter = true;
|
|
1271
|
+
appendTo;
|
|
1272
|
+
bindValue;
|
|
1273
|
+
bindLabel;
|
|
1274
|
+
clearSearchOnAdd;
|
|
1275
|
+
deselectOnClick;
|
|
1276
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1277
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, providedIn: 'root' });
|
|
1278
|
+
}
|
|
1279
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, decorators: [{
|
|
1280
|
+
type: Injectable,
|
|
1281
|
+
args: [{ providedIn: 'root' }]
|
|
1282
|
+
}] });
|
|
1283
|
+
|
|
1284
|
+
class NgSelectOption {
|
|
1285
|
+
value;
|
|
1286
|
+
disabled = false;
|
|
1287
|
+
elementRef = inject(ElementRef);
|
|
1288
|
+
stateChange$ = new Subject();
|
|
1289
|
+
_previousLabel = '';
|
|
1290
|
+
get label() {
|
|
1291
|
+
return (this.elementRef.nativeElement.textContent || '').trim();
|
|
1292
|
+
}
|
|
1293
|
+
ngOnChanges(changes) {
|
|
1294
|
+
if (changes['disabled']) {
|
|
1295
|
+
this.stateChange$.next({
|
|
1296
|
+
value: this.value,
|
|
1297
|
+
disabled: this.disabled,
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
ngAfterViewChecked() {
|
|
1302
|
+
if (this.label !== this._previousLabel) {
|
|
1303
|
+
this._previousLabel = this.label;
|
|
1304
|
+
this.stateChange$.next({
|
|
1305
|
+
value: this.value,
|
|
1306
|
+
disabled: this.disabled,
|
|
1307
|
+
label: this.elementRef.nativeElement.innerHTML,
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
ngOnDestroy() {
|
|
1312
|
+
this.stateChange$.complete();
|
|
1313
|
+
}
|
|
1314
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOption, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1315
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.3.12", type: NgSelectOption, isStandalone: true, selector: "ng-option, ng-select-option", inputs: { value: "value", disabled: ["disabled", "disabled", booleanAttribute] }, usesOnChanges: true, ngImport: i0, template: `
|
|
1316
|
+
<ng-content />
|
|
1317
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1318
|
+
}
|
|
1319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOption, decorators: [{
|
|
1320
|
+
type: Component,
|
|
1321
|
+
args: [{
|
|
1322
|
+
selector: 'ng-option, ng-select-option',
|
|
1323
|
+
template: `
|
|
1324
|
+
<ng-content />
|
|
1325
|
+
`,
|
|
1326
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1327
|
+
}]
|
|
1328
|
+
}], propDecorators: { value: [{
|
|
1329
|
+
type: Input
|
|
1330
|
+
}], disabled: [{
|
|
1331
|
+
type: Input,
|
|
1332
|
+
args: [{ transform: booleanAttribute }]
|
|
1333
|
+
}] } });
|
|
1334
|
+
|
|
1335
|
+
class NgSelectPanelUtils {
|
|
1336
|
+
get dimensions() {
|
|
1337
|
+
return this._dimensions;
|
|
1338
|
+
}
|
|
1339
|
+
_dimensions = {
|
|
1340
|
+
itemHeight: 0,
|
|
1341
|
+
panelHeight: 0,
|
|
1342
|
+
itemsPerViewport: 0,
|
|
1343
|
+
};
|
|
1344
|
+
calculateItems(scrollPos, itemsLength, buffer) {
|
|
1345
|
+
const d = this._dimensions;
|
|
1346
|
+
const scrollHeight = d.itemHeight * itemsLength;
|
|
1347
|
+
const scrollTop = Math.max(0, scrollPos);
|
|
1348
|
+
const indexByScrollTop = (scrollTop / scrollHeight) * itemsLength;
|
|
1349
|
+
let end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));
|
|
1350
|
+
const maxStartEnd = end;
|
|
1351
|
+
const maxStart = Math.max(0, maxStartEnd - d.itemsPerViewport);
|
|
1352
|
+
let start = Math.min(maxStart, Math.floor(indexByScrollTop));
|
|
1353
|
+
let topPadding = d.itemHeight * Math.ceil(start) - d.itemHeight * Math.min(start, buffer);
|
|
1354
|
+
topPadding = !isNaN(topPadding) ? topPadding : 0;
|
|
1355
|
+
start = !isNaN(start) ? start : -1;
|
|
1356
|
+
end = !isNaN(end) ? end : -1;
|
|
1357
|
+
start -= buffer;
|
|
1358
|
+
start = Math.max(0, start);
|
|
1359
|
+
end += buffer;
|
|
1360
|
+
end = Math.min(itemsLength, end);
|
|
1361
|
+
return {
|
|
1362
|
+
topPadding,
|
|
1363
|
+
scrollHeight,
|
|
1364
|
+
start,
|
|
1365
|
+
end,
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
setDimensions(itemHeight, panelHeight) {
|
|
1369
|
+
const itemsPerViewport = Math.max(1, Math.floor(panelHeight / itemHeight));
|
|
1370
|
+
this._dimensions = {
|
|
1371
|
+
itemHeight,
|
|
1372
|
+
panelHeight,
|
|
1373
|
+
itemsPerViewport,
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
getScrollTo(itemTop, itemHeight, lastScroll) {
|
|
1377
|
+
const { panelHeight } = this.dimensions;
|
|
1378
|
+
const itemBottom = itemTop + itemHeight;
|
|
1379
|
+
const top = lastScroll;
|
|
1380
|
+
const bottom = top + panelHeight;
|
|
1381
|
+
if (panelHeight >= itemBottom && lastScroll === itemTop) {
|
|
1382
|
+
return null;
|
|
1383
|
+
}
|
|
1384
|
+
if (itemBottom > bottom) {
|
|
1385
|
+
return top + itemBottom - bottom;
|
|
1386
|
+
}
|
|
1387
|
+
else if (itemTop <= top) {
|
|
1388
|
+
return itemTop;
|
|
1389
|
+
}
|
|
1390
|
+
return null;
|
|
1391
|
+
}
|
|
1392
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelUtils, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1393
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelUtils });
|
|
1394
|
+
}
|
|
1395
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelUtils, decorators: [{
|
|
1396
|
+
type: Injectable
|
|
1397
|
+
}] });
|
|
1398
|
+
|
|
1399
|
+
const CSS_POSITIONS = ['top', 'right', 'bottom', 'left'];
|
|
1400
|
+
const SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? animationFrameScheduler : asapScheduler;
|
|
1401
|
+
class NgSelectPanel {
|
|
1402
|
+
listboxId = '';
|
|
1403
|
+
items = [];
|
|
1404
|
+
markedItem;
|
|
1405
|
+
position = 'auto';
|
|
1406
|
+
appendTo;
|
|
1407
|
+
bufferAmount = 4;
|
|
1408
|
+
virtualScroll = false;
|
|
1409
|
+
multiple = false;
|
|
1410
|
+
headerTemplate;
|
|
1411
|
+
footerTemplate;
|
|
1412
|
+
filterValue = null;
|
|
1413
|
+
update = new EventEmitter();
|
|
1414
|
+
scroll = new EventEmitter();
|
|
1415
|
+
scrollToEnd = new EventEmitter();
|
|
1416
|
+
outsideClick = new EventEmitter();
|
|
1417
|
+
scrollHostElRef;
|
|
1418
|
+
scrollContentElRef;
|
|
1419
|
+
scrollSpacerElRef;
|
|
1420
|
+
_document = inject(DOCUMENT, { optional: true });
|
|
1421
|
+
_renderer = inject(Renderer2);
|
|
1422
|
+
_zone = inject(NgZone);
|
|
1423
|
+
_elementRef = inject(ElementRef);
|
|
1424
|
+
_panelUtils = inject(NgSelectPanelUtils);
|
|
1425
|
+
_destroy$ = new Subject();
|
|
1426
|
+
_dropdown = this._elementRef.nativeElement;
|
|
1427
|
+
_select;
|
|
1428
|
+
_parent;
|
|
1429
|
+
_scrollHost;
|
|
1430
|
+
_scrollContent;
|
|
1431
|
+
_scrollSpacer;
|
|
1432
|
+
_scrollToEndFired = false;
|
|
1433
|
+
_updateScrollHeight = false;
|
|
1434
|
+
_lastScrollPosition = 0;
|
|
1435
|
+
get currentPosition() {
|
|
1436
|
+
return this._currentPosition;
|
|
1542
1437
|
}
|
|
1543
|
-
|
|
1544
|
-
get
|
|
1545
|
-
return this.
|
|
1438
|
+
_currentPosition = 'auto';
|
|
1439
|
+
get itemsLength() {
|
|
1440
|
+
return this._itemsLength;
|
|
1546
1441
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
1442
|
+
set itemsLength(value) {
|
|
1443
|
+
if (value !== this._itemsLength) {
|
|
1444
|
+
this._itemsLength = value;
|
|
1445
|
+
this._onItemsLengthChanged();
|
|
1446
|
+
}
|
|
1549
1447
|
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1448
|
+
_itemsLength;
|
|
1449
|
+
get _startOffset() {
|
|
1450
|
+
if (this.markedItem) {
|
|
1451
|
+
const { itemHeight, panelHeight } = this._panelUtils.dimensions;
|
|
1452
|
+
const offset = this.markedItem.index * itemHeight;
|
|
1453
|
+
return panelHeight > offset ? 0 : offset;
|
|
1454
|
+
}
|
|
1455
|
+
return 0;
|
|
1552
1456
|
}
|
|
1553
|
-
|
|
1554
|
-
|
|
1457
|
+
ngOnInit() {
|
|
1458
|
+
this._select = this._dropdown.parentElement;
|
|
1459
|
+
this._scrollHost = this.scrollHostElRef.nativeElement;
|
|
1460
|
+
this._scrollContent = this.scrollContentElRef.nativeElement;
|
|
1461
|
+
this._scrollSpacer = this.scrollSpacerElRef.nativeElement;
|
|
1462
|
+
this._handleScroll();
|
|
1463
|
+
this._handleOutsideClick();
|
|
1464
|
+
this._appendDropdown();
|
|
1465
|
+
this._setupMousedownListener();
|
|
1555
1466
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
if (!item.disabled) {
|
|
1561
|
-
return item;
|
|
1562
|
-
}
|
|
1467
|
+
ngOnChanges(changes) {
|
|
1468
|
+
if (changes['items']) {
|
|
1469
|
+
const change = changes['items'];
|
|
1470
|
+
this._onItemsChange(change.currentValue, change.firstChange);
|
|
1563
1471
|
}
|
|
1564
|
-
return null;
|
|
1565
1472
|
}
|
|
1566
|
-
|
|
1567
|
-
this.
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
else {
|
|
1573
|
-
this._groups = new Map();
|
|
1574
|
-
this._groups.set(undefined, this._items);
|
|
1473
|
+
ngOnDestroy() {
|
|
1474
|
+
this._destroy$.next();
|
|
1475
|
+
this._destroy$.complete();
|
|
1476
|
+
this._destroy$.unsubscribe();
|
|
1477
|
+
if (this.appendTo) {
|
|
1478
|
+
this._renderer.removeChild(this._dropdown.parentNode, this._dropdown);
|
|
1575
1479
|
}
|
|
1576
|
-
this._filteredItems = [...this._items];
|
|
1577
1480
|
}
|
|
1578
|
-
|
|
1579
|
-
if (
|
|
1481
|
+
scrollTo(option, startFromOption = false) {
|
|
1482
|
+
if (!option) {
|
|
1580
1483
|
return;
|
|
1581
1484
|
}
|
|
1582
|
-
const
|
|
1583
|
-
if (
|
|
1584
|
-
this.clearSelected();
|
|
1585
|
-
}
|
|
1586
|
-
this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel);
|
|
1587
|
-
if (this._ngSelect.hideSelected) {
|
|
1588
|
-
this._hideSelected(item);
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
unselect(item) {
|
|
1592
|
-
if (!item.selected) {
|
|
1485
|
+
const index = this.items.indexOf(option);
|
|
1486
|
+
if (index < 0 || index >= this.itemsLength) {
|
|
1593
1487
|
return;
|
|
1594
1488
|
}
|
|
1595
|
-
|
|
1596
|
-
if (this.
|
|
1597
|
-
this.
|
|
1598
|
-
|
|
1599
|
-
}
|
|
1600
|
-
findItem(value) {
|
|
1601
|
-
let findBy;
|
|
1602
|
-
if (this._ngSelect.compareWith) {
|
|
1603
|
-
findBy = item => this._ngSelect.compareWith(item.value, value);
|
|
1604
|
-
}
|
|
1605
|
-
else if (this._ngSelect.bindValue) {
|
|
1606
|
-
findBy = item => !item.children &&
|
|
1607
|
-
this.resolveNested(item.value, this._ngSelect.bindValue) === value;
|
|
1489
|
+
let scrollTo;
|
|
1490
|
+
if (this.virtualScroll) {
|
|
1491
|
+
const itemHeight = this._panelUtils.dimensions.itemHeight;
|
|
1492
|
+
scrollTo = this._panelUtils.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);
|
|
1608
1493
|
}
|
|
1609
1494
|
else {
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
item.label === this.resolveNested(value, this._ngSelect.bindLabel));
|
|
1495
|
+
const item = this._dropdown.querySelector(`#${option.htmlId}`);
|
|
1496
|
+
const lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;
|
|
1497
|
+
scrollTo = this._panelUtils.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);
|
|
1614
1498
|
}
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
addItem(item) {
|
|
1618
|
-
const option = this.mapItem(item, this._items.length);
|
|
1619
|
-
this._items.push(option);
|
|
1620
|
-
this._filteredItems.push(option);
|
|
1621
|
-
return option;
|
|
1622
|
-
}
|
|
1623
|
-
clearSelected(keepDisabled = false) {
|
|
1624
|
-
this._selectionModel.clear(keepDisabled);
|
|
1625
|
-
this._items.forEach(item => {
|
|
1626
|
-
item.selected = keepDisabled && item.selected && item.disabled;
|
|
1627
|
-
item.marked = false;
|
|
1628
|
-
});
|
|
1629
|
-
if (this._ngSelect.hideSelected) {
|
|
1630
|
-
this.resetFilteredItems();
|
|
1499
|
+
if (isDefined(scrollTo)) {
|
|
1500
|
+
this._scrollHost.scrollTop = scrollTo;
|
|
1631
1501
|
}
|
|
1632
1502
|
}
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
const label = stripSpecialChars(item.label).toLocaleLowerCase();
|
|
1637
|
-
return label.substr(0, term.length) === term;
|
|
1638
|
-
});
|
|
1503
|
+
scrollToTag() {
|
|
1504
|
+
const panel = this._scrollHost;
|
|
1505
|
+
panel.scrollTop = panel.scrollHeight - panel.clientHeight;
|
|
1639
1506
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
this.resetFilteredItems();
|
|
1643
|
-
return;
|
|
1644
|
-
}
|
|
1645
|
-
this._filteredItems = [];
|
|
1646
|
-
term = this._ngSelect.searchFn ? term : stripSpecialChars(term).toLocaleLowerCase();
|
|
1647
|
-
const match = this._ngSelect.searchFn || this._defaultSearchFn;
|
|
1648
|
-
const hideSelected = this._ngSelect.hideSelected;
|
|
1649
|
-
for (const key of Array.from(this._groups.keys())) {
|
|
1650
|
-
const matchedItems = [];
|
|
1651
|
-
for (const item of this._groups.get(key)) {
|
|
1652
|
-
if (hideSelected && ((item.parent && item.parent.selected) || item.selected)) {
|
|
1653
|
-
continue;
|
|
1654
|
-
}
|
|
1655
|
-
const searchItem = this._ngSelect.searchFn ? item.value : item;
|
|
1656
|
-
if (match(term, searchItem)) {
|
|
1657
|
-
matchedItems.push(item);
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
if (matchedItems.length > 0) {
|
|
1661
|
-
const [last] = matchedItems.slice(-1);
|
|
1662
|
-
if (last.parent) {
|
|
1663
|
-
const head = this._items.find(x => x === last.parent);
|
|
1664
|
-
this._filteredItems.push(head);
|
|
1665
|
-
}
|
|
1666
|
-
this._filteredItems.push(...matchedItems);
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1507
|
+
adjustPosition() {
|
|
1508
|
+
this._updateYPosition();
|
|
1669
1509
|
}
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {
|
|
1675
|
-
this._filteredItems = this._items.filter(x => !x.selected);
|
|
1510
|
+
_handleDropdownPosition() {
|
|
1511
|
+
this._currentPosition = this._calculateCurrentPosition(this._dropdown);
|
|
1512
|
+
if (CSS_POSITIONS.includes(this._currentPosition)) {
|
|
1513
|
+
this._updateDropdownClass(this._currentPosition);
|
|
1676
1514
|
}
|
|
1677
1515
|
else {
|
|
1678
|
-
this.
|
|
1516
|
+
this._updateDropdownClass('bottom');
|
|
1679
1517
|
}
|
|
1518
|
+
if (this.appendTo) {
|
|
1519
|
+
this._updateYPosition();
|
|
1520
|
+
}
|
|
1521
|
+
this._dropdown.style.opacity = '1';
|
|
1680
1522
|
}
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1523
|
+
_updateDropdownClass(currentPosition) {
|
|
1524
|
+
CSS_POSITIONS.forEach(position => {
|
|
1525
|
+
const REMOVE_CSS_CLASS = `ng-select-${position}`;
|
|
1526
|
+
this._renderer.removeClass(this._dropdown, REMOVE_CSS_CLASS);
|
|
1527
|
+
this._renderer.removeClass(this._select, REMOVE_CSS_CLASS);
|
|
1528
|
+
});
|
|
1529
|
+
const ADD_CSS_CLASS = `ng-select-${currentPosition}`;
|
|
1530
|
+
this._renderer.addClass(this._dropdown, ADD_CSS_CLASS);
|
|
1531
|
+
this._renderer.addClass(this._select, ADD_CSS_CLASS);
|
|
1686
1532
|
}
|
|
1687
|
-
|
|
1688
|
-
this.
|
|
1533
|
+
_handleScroll() {
|
|
1534
|
+
this._zone.runOutsideAngular(() => {
|
|
1535
|
+
fromEvent(this._scrollHost, 'scroll')
|
|
1536
|
+
.pipe(takeUntil(this._destroy$), auditTime(0, SCROLL_SCHEDULER))
|
|
1537
|
+
.subscribe(e => {
|
|
1538
|
+
const path = e.path || (e.composedPath && e.composedPath());
|
|
1539
|
+
if (!path || (path.length === 0 && !e.target)) {
|
|
1540
|
+
return;
|
|
1541
|
+
}
|
|
1542
|
+
const scrollTop = !path || path.length === 0 ? e.target.scrollTop : path[0].scrollTop;
|
|
1543
|
+
this._onContentScrolled(scrollTop);
|
|
1544
|
+
});
|
|
1545
|
+
});
|
|
1689
1546
|
}
|
|
1690
|
-
|
|
1691
|
-
|
|
1547
|
+
_handleOutsideClick() {
|
|
1548
|
+
if (!this._document) {
|
|
1549
|
+
return;
|
|
1550
|
+
}
|
|
1551
|
+
this._zone.runOutsideAngular(() => {
|
|
1552
|
+
merge(fromEvent(this._document, 'touchstart', { capture: true }), fromEvent(this._document, 'click', { capture: true }))
|
|
1553
|
+
.pipe(takeUntil(this._destroy$))
|
|
1554
|
+
.subscribe(e => this._checkToClose(e));
|
|
1555
|
+
});
|
|
1692
1556
|
}
|
|
1693
|
-
|
|
1694
|
-
if (this.
|
|
1557
|
+
_checkToClose(e) {
|
|
1558
|
+
if (this._select.contains(e.target) || this._dropdown.contains(e.target)) {
|
|
1695
1559
|
return;
|
|
1696
1560
|
}
|
|
1697
|
-
const
|
|
1698
|
-
if (
|
|
1699
|
-
|
|
1561
|
+
const path = e.path || (e.composedPath && e.composedPath());
|
|
1562
|
+
if (e.target && e.target.shadowRoot && path && path[0] && this._select.contains(path[0])) {
|
|
1563
|
+
return;
|
|
1700
1564
|
}
|
|
1701
|
-
|
|
1702
|
-
|
|
1565
|
+
if (this._coordinatesWithin(e, this._dropdown) || this._coordinatesWithin(e, this._select)) {
|
|
1566
|
+
return;
|
|
1703
1567
|
}
|
|
1568
|
+
this._zone.run(() => this.outsideClick.emit());
|
|
1704
1569
|
}
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1570
|
+
_coordinatesWithin(e, element) {
|
|
1571
|
+
const clickX = e.clientX;
|
|
1572
|
+
const clickY = e.clientY;
|
|
1573
|
+
const rect = element.getBoundingClientRect();
|
|
1574
|
+
return (clickX >= rect.left && clickX <= rect.right && clickY >= rect.top && clickY <= rect.bottom);
|
|
1575
|
+
}
|
|
1576
|
+
_onItemsChange(items, firstChange) {
|
|
1577
|
+
this.items = items || [];
|
|
1578
|
+
this._scrollToEndFired = false;
|
|
1579
|
+
this.itemsLength = items.length;
|
|
1580
|
+
if (this.virtualScroll) {
|
|
1581
|
+
this._updateItemsRange(firstChange);
|
|
1711
1582
|
}
|
|
1712
1583
|
else {
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
for (let i = 0, len = keys.length; i < len; ++i) {
|
|
1716
|
-
if (value == null) {
|
|
1717
|
-
return null;
|
|
1718
|
-
}
|
|
1719
|
-
value = value[keys[i]];
|
|
1720
|
-
}
|
|
1721
|
-
return value;
|
|
1584
|
+
this._setVirtualHeight();
|
|
1585
|
+
this._updateItems(firstChange);
|
|
1722
1586
|
}
|
|
1723
1587
|
}
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
const value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
|
|
1729
|
-
return {
|
|
1730
|
-
index,
|
|
1731
|
-
label: isDefined(label) ? label.toString() : '',
|
|
1732
|
-
value,
|
|
1733
|
-
viewValue: item.viewValue || label,
|
|
1734
|
-
disabled: item.disabled,
|
|
1735
|
-
htmlId: `${this._ngSelect._uid}-option-${index}`,
|
|
1736
|
-
};
|
|
1737
|
-
}
|
|
1738
|
-
mapSelectedItems() {
|
|
1739
|
-
const multiple = this._ngSelect.multiple;
|
|
1740
|
-
for (const selected of this.selectedItems) {
|
|
1741
|
-
const value = this._ngSelect.bindValue
|
|
1742
|
-
? this.resolveNested(selected.value, this._ngSelect.bindValue)
|
|
1743
|
-
: selected.value;
|
|
1744
|
-
const item = isDefined(value) ? this.findItem(value) : null;
|
|
1745
|
-
this._selectionModel.unselect(selected, multiple);
|
|
1746
|
-
this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);
|
|
1588
|
+
_updateItems(firstChange) {
|
|
1589
|
+
this.update.emit(this.items);
|
|
1590
|
+
if (firstChange === false) {
|
|
1591
|
+
return;
|
|
1747
1592
|
}
|
|
1748
|
-
|
|
1749
|
-
|
|
1593
|
+
this._zone.runOutsideAngular(() => {
|
|
1594
|
+
Promise.resolve().then(() => {
|
|
1595
|
+
const panelHeight = this._scrollHost.clientHeight;
|
|
1596
|
+
this._panelUtils.setDimensions(0, panelHeight);
|
|
1597
|
+
this._handleDropdownPosition();
|
|
1598
|
+
this.scrollTo(this.markedItem, firstChange);
|
|
1599
|
+
});
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1602
|
+
_updateItemsRange(firstChange) {
|
|
1603
|
+
this._zone.runOutsideAngular(() => {
|
|
1604
|
+
this._measureDimensions().then(() => {
|
|
1605
|
+
if (firstChange) {
|
|
1606
|
+
this._renderItemsRange(this._startOffset);
|
|
1607
|
+
this._handleDropdownPosition();
|
|
1608
|
+
}
|
|
1609
|
+
else {
|
|
1610
|
+
this._renderItemsRange();
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
_onContentScrolled(scrollTop) {
|
|
1616
|
+
if (this.virtualScroll) {
|
|
1617
|
+
this._renderItemsRange(scrollTop);
|
|
1750
1618
|
}
|
|
1619
|
+
this._lastScrollPosition = scrollTop;
|
|
1620
|
+
this._fireScrollToEnd(scrollTop);
|
|
1751
1621
|
}
|
|
1752
|
-
|
|
1753
|
-
this.
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
const parentExists = this._filteredItems.find(x => x === parent);
|
|
1757
|
-
if (!parentExists) {
|
|
1758
|
-
this._filteredItems.push(parent);
|
|
1759
|
-
}
|
|
1622
|
+
_updateVirtualHeight(height) {
|
|
1623
|
+
if (this._updateScrollHeight) {
|
|
1624
|
+
this._scrollSpacer.style.height = `${height}px`;
|
|
1625
|
+
this._updateScrollHeight = false;
|
|
1760
1626
|
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
}
|
|
1627
|
+
}
|
|
1628
|
+
_setVirtualHeight() {
|
|
1629
|
+
if (!this._scrollSpacer) {
|
|
1630
|
+
return;
|
|
1766
1631
|
}
|
|
1767
|
-
this.
|
|
1632
|
+
this._scrollSpacer.style.height = `0px`;
|
|
1768
1633
|
}
|
|
1769
|
-
|
|
1770
|
-
this.
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
}
|
|
1634
|
+
_onItemsLengthChanged() {
|
|
1635
|
+
this._updateScrollHeight = true;
|
|
1636
|
+
}
|
|
1637
|
+
_renderItemsRange(scrollTop) {
|
|
1638
|
+
if (scrollTop && this._lastScrollPosition === scrollTop) {
|
|
1639
|
+
return;
|
|
1776
1640
|
}
|
|
1777
|
-
|
|
1778
|
-
|
|
1641
|
+
scrollTop = scrollTop || this._scrollHost.scrollTop;
|
|
1642
|
+
const range = this._panelUtils.calculateItems(scrollTop, this.itemsLength, this.bufferAmount);
|
|
1643
|
+
this._updateVirtualHeight(range.scrollHeight);
|
|
1644
|
+
this._scrollContent.style.transform = `translateY(${range.topPadding}px)`;
|
|
1645
|
+
this._zone.run(() => {
|
|
1646
|
+
this.update.emit(this.items.slice(range.start, range.end));
|
|
1647
|
+
this.scroll.emit({ start: range.start, end: range.end });
|
|
1648
|
+
});
|
|
1649
|
+
if (isDefined(scrollTop) && this._lastScrollPosition === 0) {
|
|
1650
|
+
this._scrollHost.scrollTop = scrollTop;
|
|
1651
|
+
this._lastScrollPosition = scrollTop;
|
|
1779
1652
|
}
|
|
1780
1653
|
}
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
}
|
|
1785
|
-
_getNextItemIndex(steps) {
|
|
1786
|
-
if (steps > 0) {
|
|
1787
|
-
return this._markedIndex >= this._filteredItems.length - 1 ? 0 : this._markedIndex + 1;
|
|
1654
|
+
_measureDimensions() {
|
|
1655
|
+
if (this._panelUtils.dimensions.itemHeight > 0 || this.itemsLength === 0) {
|
|
1656
|
+
return Promise.resolve(this._panelUtils.dimensions);
|
|
1788
1657
|
}
|
|
1789
|
-
|
|
1658
|
+
const [first] = this.items;
|
|
1659
|
+
this.update.emit([first]);
|
|
1660
|
+
return Promise.resolve().then(() => {
|
|
1661
|
+
const option = this._dropdown.querySelector(`#${first.htmlId}`);
|
|
1662
|
+
const optionHeight = option.clientHeight;
|
|
1663
|
+
this._scrollSpacer.style.height = `${optionHeight * this.itemsLength}px`;
|
|
1664
|
+
const panelHeight = this._scrollHost.clientHeight;
|
|
1665
|
+
this._panelUtils.setDimensions(optionHeight, panelHeight);
|
|
1666
|
+
return this._panelUtils.dimensions;
|
|
1667
|
+
});
|
|
1790
1668
|
}
|
|
1791
|
-
|
|
1792
|
-
if (this.
|
|
1669
|
+
_fireScrollToEnd(scrollTop) {
|
|
1670
|
+
if (this._scrollToEndFired || scrollTop === 0) {
|
|
1793
1671
|
return;
|
|
1794
1672
|
}
|
|
1795
|
-
this.
|
|
1796
|
-
if (this.
|
|
1797
|
-
this.
|
|
1673
|
+
const padding = this.virtualScroll ? this._scrollSpacer : this._scrollContent;
|
|
1674
|
+
if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight - 1) {
|
|
1675
|
+
this._zone.run(() => this.scrollToEnd.emit());
|
|
1676
|
+
this._scrollToEndFired = true;
|
|
1798
1677
|
}
|
|
1799
1678
|
}
|
|
1800
|
-
|
|
1801
|
-
if (this.
|
|
1802
|
-
return
|
|
1679
|
+
_calculateCurrentPosition(dropdownEl) {
|
|
1680
|
+
if (this.position !== 'auto') {
|
|
1681
|
+
return this.position;
|
|
1803
1682
|
}
|
|
1804
|
-
|
|
1805
|
-
|
|
1683
|
+
const selectRect = this._select.getBoundingClientRect();
|
|
1684
|
+
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
|
1685
|
+
const offsetTop = selectRect.top + window.pageYOffset;
|
|
1686
|
+
const height = selectRect.height;
|
|
1687
|
+
const dropdownHeight = dropdownEl.getBoundingClientRect().height;
|
|
1688
|
+
if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {
|
|
1689
|
+
return 'top';
|
|
1806
1690
|
}
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
return -1;
|
|
1691
|
+
else {
|
|
1692
|
+
return 'bottom';
|
|
1810
1693
|
}
|
|
1811
|
-
return Math.max(this.markedIndex, selectedIndex);
|
|
1812
1694
|
}
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
return groups;
|
|
1695
|
+
_appendDropdown() {
|
|
1696
|
+
if (!this.appendTo) {
|
|
1697
|
+
return;
|
|
1817
1698
|
}
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
}
|
|
1824
|
-
return groups;
|
|
1699
|
+
this._parent = this._dropdown.shadowRoot
|
|
1700
|
+
? this._dropdown.shadowRoot.querySelector(this.appendTo)
|
|
1701
|
+
: document.querySelector(this.appendTo);
|
|
1702
|
+
if (!this._parent) {
|
|
1703
|
+
throw new Error(`appendTo selector ${this.appendTo} did not found any parent element`);
|
|
1825
1704
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1705
|
+
this._updateXPosition();
|
|
1706
|
+
this._parent.appendChild(this._dropdown);
|
|
1707
|
+
}
|
|
1708
|
+
_updateXPosition() {
|
|
1709
|
+
const select = this._select.getBoundingClientRect();
|
|
1710
|
+
const parent = this._parent.getBoundingClientRect();
|
|
1711
|
+
const offsetLeft = select.left - parent.left;
|
|
1712
|
+
this._dropdown.style.left = offsetLeft + 'px';
|
|
1713
|
+
this._dropdown.style.width = select.width + 'px';
|
|
1714
|
+
this._dropdown.style.minWidth = select.width + 'px';
|
|
1715
|
+
}
|
|
1716
|
+
_updateYPosition() {
|
|
1717
|
+
const select = this._select.getBoundingClientRect();
|
|
1718
|
+
const parent = this._parent.getBoundingClientRect();
|
|
1719
|
+
const delta = select.height;
|
|
1720
|
+
if (this._currentPosition === 'top') {
|
|
1721
|
+
const offsetBottom = parent.bottom - select.bottom;
|
|
1722
|
+
this._dropdown.style.bottom = offsetBottom + delta + 'px';
|
|
1723
|
+
this._dropdown.style.top = 'auto';
|
|
1724
|
+
}
|
|
1725
|
+
else if (this._currentPosition === 'bottom') {
|
|
1726
|
+
const offsetTop = select.top - parent.top;
|
|
1727
|
+
this._dropdown.style.top = offsetTop + delta + 'px';
|
|
1728
|
+
this._dropdown.style.bottom = 'auto';
|
|
1841
1729
|
}
|
|
1842
|
-
return groups;
|
|
1843
1730
|
}
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
return x;
|
|
1855
|
-
}));
|
|
1856
|
-
continue;
|
|
1857
|
-
}
|
|
1858
|
-
const isObjectKey = isObject(key);
|
|
1859
|
-
const parent = {
|
|
1860
|
-
label: isObjectKey ? '' : String(key),
|
|
1861
|
-
children: null,
|
|
1862
|
-
parent: null,
|
|
1863
|
-
index: i++,
|
|
1864
|
-
disabled: !this._ngSelect.selectableGroup,
|
|
1865
|
-
htmlId: `${this._ngSelect._uid}-group-${groupIndex}-heading`,
|
|
1866
|
-
};
|
|
1867
|
-
const groupKey = isGroupByFn
|
|
1868
|
-
? this._ngSelect.bindLabel
|
|
1869
|
-
: this._ngSelect.groupBy;
|
|
1870
|
-
const groupValue = this._ngSelect.groupValue ||
|
|
1871
|
-
(() => {
|
|
1872
|
-
if (isObjectKey) {
|
|
1873
|
-
return key.value;
|
|
1874
|
-
}
|
|
1875
|
-
return { [groupKey]: key };
|
|
1876
|
-
});
|
|
1877
|
-
const children = groups.get(key).map(x => {
|
|
1878
|
-
x.parent = parent;
|
|
1879
|
-
x.children = null;
|
|
1880
|
-
x.index = i++;
|
|
1881
|
-
return x;
|
|
1731
|
+
_setupMousedownListener() {
|
|
1732
|
+
this._zone.runOutsideAngular(() => {
|
|
1733
|
+
fromEvent(this._dropdown, 'mousedown')
|
|
1734
|
+
.pipe(takeUntil(this._destroy$))
|
|
1735
|
+
.subscribe(event => {
|
|
1736
|
+
const target = event.target;
|
|
1737
|
+
if (target.tagName === 'INPUT') {
|
|
1738
|
+
return;
|
|
1739
|
+
}
|
|
1740
|
+
event.preventDefault();
|
|
1882
1741
|
});
|
|
1883
|
-
|
|
1884
|
-
parent.value = groupValue(key, children.map(x => x.value));
|
|
1885
|
-
items.push(parent);
|
|
1886
|
-
items.push(...children);
|
|
1887
|
-
groupIndex++;
|
|
1888
|
-
}
|
|
1889
|
-
return items;
|
|
1742
|
+
});
|
|
1890
1743
|
}
|
|
1744
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1745
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: NgSelectPanel, isStandalone: true, selector: "ng-select-panel", inputs: { listboxId: "listboxId", items: "items", markedItem: "markedItem", position: "position", appendTo: "appendTo", bufferAmount: "bufferAmount", virtualScroll: ["virtualScroll", "virtualScroll", booleanAttribute], multiple: ["multiple", "multiple", booleanAttribute], headerTemplate: "headerTemplate", footerTemplate: "footerTemplate", filterValue: "filterValue" }, outputs: { update: "update", scroll: "scroll", scrollToEnd: "scrollToEnd", outsideClick: "outsideClick" }, host: { properties: { "class.ng-select-multiple": "multiple" }, classAttribute: "ng-select-panel" }, providers: [NgSelectPanelUtils], viewQueries: [{ propertyName: "scrollHostElRef", first: true, predicate: ["scrollHost"], descendants: true, read: ElementRef, static: true }, { propertyName: "scrollContentElRef", first: true, predicate: ["scrollContent"], descendants: true, read: ElementRef, static: true }, { propertyName: "scrollSpacerElRef", first: true, predicate: ["scrollSpacer"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
1746
|
+
@if (headerTemplate) {
|
|
1747
|
+
<div class="ng-select-panel-header">
|
|
1748
|
+
<ng-container
|
|
1749
|
+
[ngTemplateOutlet]="headerTemplate"
|
|
1750
|
+
[ngTemplateOutletContext]="{ searchTerm: filterValue }"
|
|
1751
|
+
/>
|
|
1752
|
+
</div>
|
|
1753
|
+
}
|
|
1754
|
+
<div
|
|
1755
|
+
#scrollHost
|
|
1756
|
+
class="ng-select-listbox"
|
|
1757
|
+
[class.ng-select-virtual-scroll-host]="virtualScroll"
|
|
1758
|
+
[attr.id]="listboxId"
|
|
1759
|
+
[attr.aria-multiselectable]="multiple"
|
|
1760
|
+
role="listbox"
|
|
1761
|
+
>
|
|
1762
|
+
<div
|
|
1763
|
+
#scrollContent
|
|
1764
|
+
[class.ng-select-virtual-scroll-content]="virtualScroll && items.length"
|
|
1765
|
+
role="presentation"
|
|
1766
|
+
>
|
|
1767
|
+
<ng-content />
|
|
1768
|
+
</div>
|
|
1769
|
+
<div #scrollSpacer [class.ng-select-virtual-scroll-spacer]="virtualScroll"></div>
|
|
1770
|
+
</div>
|
|
1771
|
+
@if (footerTemplate) {
|
|
1772
|
+
<div class="ng-select-panel-footer">
|
|
1773
|
+
<ng-container
|
|
1774
|
+
[ngTemplateOutlet]="footerTemplate"
|
|
1775
|
+
[ngTemplateOutletContext]="{ searchTerm: filterValue }"
|
|
1776
|
+
/>
|
|
1777
|
+
</div>
|
|
1778
|
+
}
|
|
1779
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1891
1780
|
}
|
|
1781
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanel, decorators: [{
|
|
1782
|
+
type: Component,
|
|
1783
|
+
args: [{
|
|
1784
|
+
selector: 'ng-select-panel',
|
|
1785
|
+
template: `
|
|
1786
|
+
@if (headerTemplate) {
|
|
1787
|
+
<div class="ng-select-panel-header">
|
|
1788
|
+
<ng-container
|
|
1789
|
+
[ngTemplateOutlet]="headerTemplate"
|
|
1790
|
+
[ngTemplateOutletContext]="{ searchTerm: filterValue }"
|
|
1791
|
+
/>
|
|
1792
|
+
</div>
|
|
1793
|
+
}
|
|
1794
|
+
<div
|
|
1795
|
+
#scrollHost
|
|
1796
|
+
class="ng-select-listbox"
|
|
1797
|
+
[class.ng-select-virtual-scroll-host]="virtualScroll"
|
|
1798
|
+
[attr.id]="listboxId"
|
|
1799
|
+
[attr.aria-multiselectable]="multiple"
|
|
1800
|
+
role="listbox"
|
|
1801
|
+
>
|
|
1802
|
+
<div
|
|
1803
|
+
#scrollContent
|
|
1804
|
+
[class.ng-select-virtual-scroll-content]="virtualScroll && items.length"
|
|
1805
|
+
role="presentation"
|
|
1806
|
+
>
|
|
1807
|
+
<ng-content />
|
|
1808
|
+
</div>
|
|
1809
|
+
<div #scrollSpacer [class.ng-select-virtual-scroll-spacer]="virtualScroll"></div>
|
|
1810
|
+
</div>
|
|
1811
|
+
@if (footerTemplate) {
|
|
1812
|
+
<div class="ng-select-panel-footer">
|
|
1813
|
+
<ng-container
|
|
1814
|
+
[ngTemplateOutlet]="footerTemplate"
|
|
1815
|
+
[ngTemplateOutletContext]="{ searchTerm: filterValue }"
|
|
1816
|
+
/>
|
|
1817
|
+
</div>
|
|
1818
|
+
}
|
|
1819
|
+
`,
|
|
1820
|
+
imports: [NgTemplateOutlet],
|
|
1821
|
+
host: {
|
|
1822
|
+
'class': 'ng-select-panel',
|
|
1823
|
+
'[class.ng-select-multiple]': 'multiple',
|
|
1824
|
+
},
|
|
1825
|
+
encapsulation: ViewEncapsulation.None,
|
|
1826
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1827
|
+
providers: [NgSelectPanelUtils],
|
|
1828
|
+
}]
|
|
1829
|
+
}], propDecorators: { listboxId: [{
|
|
1830
|
+
type: Input
|
|
1831
|
+
}], items: [{
|
|
1832
|
+
type: Input
|
|
1833
|
+
}], markedItem: [{
|
|
1834
|
+
type: Input
|
|
1835
|
+
}], position: [{
|
|
1836
|
+
type: Input
|
|
1837
|
+
}], appendTo: [{
|
|
1838
|
+
type: Input
|
|
1839
|
+
}], bufferAmount: [{
|
|
1840
|
+
type: Input
|
|
1841
|
+
}], virtualScroll: [{
|
|
1842
|
+
type: Input,
|
|
1843
|
+
args: [{ transform: booleanAttribute }]
|
|
1844
|
+
}], multiple: [{
|
|
1845
|
+
type: Input,
|
|
1846
|
+
args: [{ transform: booleanAttribute }]
|
|
1847
|
+
}], headerTemplate: [{
|
|
1848
|
+
type: Input
|
|
1849
|
+
}], footerTemplate: [{
|
|
1850
|
+
type: Input
|
|
1851
|
+
}], filterValue: [{
|
|
1852
|
+
type: Input
|
|
1853
|
+
}], update: [{
|
|
1854
|
+
type: Output
|
|
1855
|
+
}], scroll: [{
|
|
1856
|
+
type: Output
|
|
1857
|
+
}], scrollToEnd: [{
|
|
1858
|
+
type: Output
|
|
1859
|
+
}], outsideClick: [{
|
|
1860
|
+
type: Output
|
|
1861
|
+
}], scrollHostElRef: [{
|
|
1862
|
+
type: ViewChild,
|
|
1863
|
+
args: ['scrollHost', { read: ElementRef, static: true }]
|
|
1864
|
+
}], scrollContentElRef: [{
|
|
1865
|
+
type: ViewChild,
|
|
1866
|
+
args: ['scrollContent', { read: ElementRef, static: true }]
|
|
1867
|
+
}], scrollSpacerElRef: [{
|
|
1868
|
+
type: ViewChild,
|
|
1869
|
+
args: ['scrollSpacer', { read: ElementRef, static: true }]
|
|
1870
|
+
}] } });
|
|
1892
1871
|
|
|
1893
|
-
class
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
notFoundText = 'No items found';
|
|
1897
|
-
typeToSearchText = 'Type to search';
|
|
1898
|
-
addTagText = 'Add item';
|
|
1899
|
-
loadingText = 'Loading...';
|
|
1900
|
-
clearAllText = 'Clear all';
|
|
1901
|
-
virtualScroll = false;
|
|
1902
|
-
openOnEnter = true;
|
|
1903
|
-
appendTo;
|
|
1904
|
-
bindValue;
|
|
1905
|
-
bindLabel;
|
|
1906
|
-
clearSearchOnAdd;
|
|
1907
|
-
deselectOnClick;
|
|
1908
|
-
appearance = 'underline';
|
|
1909
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1910
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, providedIn: 'root' });
|
|
1911
|
-
}
|
|
1912
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, decorators: [{
|
|
1913
|
-
type: Injectable,
|
|
1914
|
-
args: [{ providedIn: 'root' }]
|
|
1915
|
-
}] });
|
|
1916
|
-
|
|
1917
|
-
class NgItemLabel {
|
|
1918
|
-
ngItemLabel = '';
|
|
1919
|
-
escape = true;
|
|
1872
|
+
class NgSelectLabelRenderer {
|
|
1873
|
+
ngSelectLabelValue = '';
|
|
1874
|
+
ngSelectLabelEscape = true;
|
|
1920
1875
|
element = inject(ElementRef);
|
|
1921
1876
|
ngOnChanges() {
|
|
1922
|
-
this.element.nativeElement.innerHTML = this.
|
|
1923
|
-
? escapeHTML(this.
|
|
1924
|
-
: this.
|
|
1877
|
+
this.element.nativeElement.innerHTML = this.ngSelectLabelEscape
|
|
1878
|
+
? escapeHTML(this.ngSelectLabelValue)
|
|
1879
|
+
: this.ngSelectLabelValue;
|
|
1925
1880
|
}
|
|
1926
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1927
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
1881
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLabelRenderer, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1882
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectLabelRenderer, isStandalone: true, selector: "[ngSelectLabelValue]", inputs: { ngSelectLabelValue: "ngSelectLabelValue", ngSelectLabelEscape: "ngSelectLabelEscape" }, usesOnChanges: true, ngImport: i0 });
|
|
1928
1883
|
}
|
|
1929
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1884
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLabelRenderer, decorators: [{
|
|
1930
1885
|
type: Directive,
|
|
1931
1886
|
args: [{
|
|
1932
|
-
selector: '[
|
|
1887
|
+
selector: '[ngSelectLabelValue]',
|
|
1933
1888
|
}]
|
|
1934
|
-
}], propDecorators: {
|
|
1889
|
+
}], propDecorators: { ngSelectLabelValue: [{
|
|
1935
1890
|
type: Input
|
|
1936
|
-
}],
|
|
1891
|
+
}], ngSelectLabelEscape: [{
|
|
1937
1892
|
type: Input
|
|
1938
1893
|
}] } });
|
|
1939
|
-
class
|
|
1894
|
+
class NgSelectOptionTemplate {
|
|
1940
1895
|
template = inject(TemplateRef);
|
|
1941
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1942
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
1896
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOptionTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1897
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectOptionTemplate, isStandalone: true, selector: "[ngSelectOption]", ngImport: i0 });
|
|
1943
1898
|
}
|
|
1944
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1899
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOptionTemplate, decorators: [{
|
|
1945
1900
|
type: Directive,
|
|
1946
1901
|
args: [{
|
|
1947
|
-
selector: '[
|
|
1902
|
+
selector: '[ngSelectOption]',
|
|
1948
1903
|
}]
|
|
1949
1904
|
}] });
|
|
1950
|
-
class
|
|
1905
|
+
class NgSelectOptgroupTemplate {
|
|
1951
1906
|
template = inject(TemplateRef);
|
|
1952
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1953
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
1907
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOptgroupTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1908
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectOptgroupTemplate, isStandalone: true, selector: "[ngSelectOptgroup]", ngImport: i0 });
|
|
1954
1909
|
}
|
|
1955
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1910
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOptgroupTemplate, decorators: [{
|
|
1956
1911
|
type: Directive,
|
|
1957
1912
|
args: [{
|
|
1958
|
-
selector: '[
|
|
1913
|
+
selector: '[ngSelectOptgroup]',
|
|
1959
1914
|
}]
|
|
1960
1915
|
}] });
|
|
1961
|
-
class
|
|
1916
|
+
class NgSelectLabelTemplate {
|
|
1962
1917
|
template = inject(TemplateRef);
|
|
1963
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1964
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
1918
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLabelTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1919
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectLabelTemplate, isStandalone: true, selector: "[ngSelectLabel]", ngImport: i0 });
|
|
1965
1920
|
}
|
|
1966
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1921
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLabelTemplate, decorators: [{
|
|
1967
1922
|
type: Directive,
|
|
1968
1923
|
args: [{
|
|
1969
|
-
selector: '[
|
|
1924
|
+
selector: '[ngSelectLabel]',
|
|
1970
1925
|
}]
|
|
1971
1926
|
}] });
|
|
1972
|
-
class
|
|
1927
|
+
class NgSelectMultiLabelTemplate {
|
|
1973
1928
|
template = inject(TemplateRef);
|
|
1974
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1975
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
1929
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectMultiLabelTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1930
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectMultiLabelTemplate, isStandalone: true, selector: "[ngSelectMultiLabel]", ngImport: i0 });
|
|
1976
1931
|
}
|
|
1977
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1932
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectMultiLabelTemplate, decorators: [{
|
|
1978
1933
|
type: Directive,
|
|
1979
1934
|
args: [{
|
|
1980
|
-
selector: '[
|
|
1935
|
+
selector: '[ngSelectMultiLabel]',
|
|
1981
1936
|
}]
|
|
1982
1937
|
}] });
|
|
1983
|
-
class
|
|
1938
|
+
class NgSelectPanelHeaderTemplate {
|
|
1984
1939
|
template = inject(TemplateRef);
|
|
1985
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1986
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
1940
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelHeaderTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1941
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectPanelHeaderTemplate, isStandalone: true, selector: "[ngSelectPanelHeader]", ngImport: i0 });
|
|
1987
1942
|
}
|
|
1988
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1943
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelHeaderTemplate, decorators: [{
|
|
1989
1944
|
type: Directive,
|
|
1990
1945
|
args: [{
|
|
1991
|
-
selector: '[
|
|
1946
|
+
selector: '[ngSelectPanelHeader]',
|
|
1992
1947
|
}]
|
|
1993
1948
|
}] });
|
|
1994
|
-
class
|
|
1949
|
+
class NgSelectPanelFooterTemplate {
|
|
1995
1950
|
template = inject(TemplateRef);
|
|
1996
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1997
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
1951
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelFooterTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1952
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectPanelFooterTemplate, isStandalone: true, selector: "[ngSelectPanelFooter]", ngImport: i0 });
|
|
1998
1953
|
}
|
|
1999
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1954
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelFooterTemplate, decorators: [{
|
|
2000
1955
|
type: Directive,
|
|
2001
1956
|
args: [{
|
|
2002
|
-
selector: '[
|
|
1957
|
+
selector: '[ngSelectPanelFooter]',
|
|
2003
1958
|
}]
|
|
2004
1959
|
}] });
|
|
2005
|
-
class
|
|
1960
|
+
class NgSelectNotFoundTemplate {
|
|
2006
1961
|
template = inject(TemplateRef);
|
|
2007
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
2008
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
1962
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectNotFoundTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1963
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectNotFoundTemplate, isStandalone: true, selector: "[ngSelectNotFound]", ngImport: i0 });
|
|
2009
1964
|
}
|
|
2010
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1965
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectNotFoundTemplate, decorators: [{
|
|
2011
1966
|
type: Directive,
|
|
2012
1967
|
args: [{
|
|
2013
|
-
selector: '[
|
|
1968
|
+
selector: '[ngSelectNotFound]',
|
|
2014
1969
|
}]
|
|
2015
1970
|
}] });
|
|
2016
|
-
class
|
|
1971
|
+
class NgSelectPlaceholderTemplate {
|
|
2017
1972
|
template = inject(TemplateRef);
|
|
2018
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
2019
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
1973
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPlaceholderTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1974
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectPlaceholderTemplate, isStandalone: true, selector: "[ngSelectPlaceholder]", ngImport: i0 });
|
|
2020
1975
|
}
|
|
2021
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1976
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPlaceholderTemplate, decorators: [{
|
|
2022
1977
|
type: Directive,
|
|
2023
1978
|
args: [{
|
|
2024
|
-
selector: '[
|
|
1979
|
+
selector: '[ngSelectPlaceholder]',
|
|
2025
1980
|
}]
|
|
2026
1981
|
}] });
|
|
2027
|
-
class
|
|
1982
|
+
class NgSelectTypeToSearchTemplate {
|
|
2028
1983
|
template = inject(TemplateRef);
|
|
2029
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
2030
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
1984
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectTypeToSearchTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1985
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectTypeToSearchTemplate, isStandalone: true, selector: "[ngSelectTypeToSearch]", ngImport: i0 });
|
|
2031
1986
|
}
|
|
2032
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1987
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectTypeToSearchTemplate, decorators: [{
|
|
2033
1988
|
type: Directive,
|
|
2034
1989
|
args: [{
|
|
2035
|
-
selector: '[
|
|
1990
|
+
selector: '[ngSelectTypeToSearch]',
|
|
2036
1991
|
}]
|
|
2037
1992
|
}] });
|
|
2038
|
-
class
|
|
1993
|
+
class NgSelectLoadingTextTemplate {
|
|
2039
1994
|
template = inject(TemplateRef);
|
|
2040
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
2041
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
1995
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLoadingTextTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1996
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectLoadingTextTemplate, isStandalone: true, selector: "[ngSelectLoadingText]", ngImport: i0 });
|
|
2042
1997
|
}
|
|
2043
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1998
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLoadingTextTemplate, decorators: [{
|
|
2044
1999
|
type: Directive,
|
|
2045
2000
|
args: [{
|
|
2046
|
-
selector: '[
|
|
2001
|
+
selector: '[ngSelectLoadingText]',
|
|
2047
2002
|
}]
|
|
2048
2003
|
}] });
|
|
2049
|
-
class
|
|
2004
|
+
class NgSelectTagTemplate {
|
|
2050
2005
|
template = inject(TemplateRef);
|
|
2051
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
2052
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
2006
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectTagTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2007
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectTagTemplate, isStandalone: true, selector: "[ngSelectTag]", ngImport: i0 });
|
|
2053
2008
|
}
|
|
2054
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
2009
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectTagTemplate, decorators: [{
|
|
2055
2010
|
type: Directive,
|
|
2056
2011
|
args: [{
|
|
2057
|
-
selector: '[
|
|
2012
|
+
selector: '[ngSelectTag]',
|
|
2058
2013
|
}]
|
|
2059
2014
|
}] });
|
|
2060
|
-
class
|
|
2015
|
+
class NgSelectLoadingTemplate {
|
|
2061
2016
|
template = inject(TemplateRef);
|
|
2062
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
2063
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
2017
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLoadingTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2018
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectLoadingTemplate, isStandalone: true, selector: "[ngSelectLoading]", ngImport: i0 });
|
|
2064
2019
|
}
|
|
2065
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
2020
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLoadingTemplate, decorators: [{
|
|
2066
2021
|
type: Directive,
|
|
2067
2022
|
args: [{
|
|
2068
|
-
selector: '[
|
|
2023
|
+
selector: '[ngSelectLoading]',
|
|
2069
2024
|
}]
|
|
2070
2025
|
}] });
|
|
2071
|
-
class
|
|
2026
|
+
class NgSelectClearButtonTemplate {
|
|
2072
2027
|
template = inject(TemplateRef);
|
|
2073
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
2074
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type:
|
|
2028
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectClearButtonTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2029
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectClearButtonTemplate, isStandalone: true, selector: "[ngSelectClearButton]", ngImport: i0 });
|
|
2075
2030
|
}
|
|
2076
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
2031
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectClearButtonTemplate, decorators: [{
|
|
2077
2032
|
type: Directive,
|
|
2078
2033
|
args: [{
|
|
2079
|
-
selector: '[
|
|
2034
|
+
selector: '[ngSelectClearButton]',
|
|
2080
2035
|
}]
|
|
2081
2036
|
}] });
|
|
2082
2037
|
|
|
@@ -2169,7 +2124,7 @@ class NgSelect {
|
|
|
2169
2124
|
bindLabel = this._config.bindLabel;
|
|
2170
2125
|
bindValue = this._config.bindValue;
|
|
2171
2126
|
placeholder = this._config.placeholder;
|
|
2172
|
-
fixedPlaceholder = this._config.fixedPlaceholder;
|
|
2127
|
+
fixedPlaceholder = this._config.fixedPlaceholder ?? false;
|
|
2173
2128
|
appendTo = this._config.appendTo;
|
|
2174
2129
|
panelPosition = 'auto';
|
|
2175
2130
|
panelDisabled = false;
|
|
@@ -2205,7 +2160,6 @@ class NgSelect {
|
|
|
2205
2160
|
searchFn = null;
|
|
2206
2161
|
keyDownFn = (e) => true;
|
|
2207
2162
|
trackByFn = null;
|
|
2208
|
-
appearance = this._config.appearance;
|
|
2209
2163
|
tabIndex;
|
|
2210
2164
|
inputAttrs = {};
|
|
2211
2165
|
ariaLabel;
|
|
@@ -2298,14 +2252,14 @@ class NgSelect {
|
|
|
2298
2252
|
optgroupTemplate;
|
|
2299
2253
|
labelTemplate;
|
|
2300
2254
|
multiLabelTemplate;
|
|
2301
|
-
|
|
2302
|
-
|
|
2255
|
+
panelHeaderTemplate;
|
|
2256
|
+
panelFooterTemplate;
|
|
2303
2257
|
notFoundTemplate;
|
|
2304
2258
|
placeholderTemplate;
|
|
2305
2259
|
typeToSearchTemplate;
|
|
2306
2260
|
loadingTextTemplate;
|
|
2307
2261
|
tagTemplate;
|
|
2308
|
-
|
|
2262
|
+
loadingTemplate;
|
|
2309
2263
|
clearButtonTemplate;
|
|
2310
2264
|
itemsList = new ItemsList(this, this.newSelectionModel?.() ?? DefaultSelectionModelFactory());
|
|
2311
2265
|
element = this._elementRef.nativeElement;
|
|
@@ -2357,7 +2311,7 @@ class NgSelect {
|
|
|
2357
2311
|
return this.editableSearchTerm && !this.multiple;
|
|
2358
2312
|
}
|
|
2359
2313
|
get _isTypeahead() {
|
|
2360
|
-
return this.typeahead && this.typeahead.
|
|
2314
|
+
return this.typeahead && this.typeahead.observed;
|
|
2361
2315
|
}
|
|
2362
2316
|
get _validTerm() {
|
|
2363
2317
|
const term = this.searchTerm?.trim();
|
|
@@ -2495,33 +2449,34 @@ class NgSelect {
|
|
|
2495
2449
|
}
|
|
2496
2450
|
}
|
|
2497
2451
|
handleMousedown(e) {
|
|
2498
|
-
if (this.preventToggleOnRightClick && e.button === 2)
|
|
2452
|
+
if (this.preventToggleOnRightClick && e.button === 2)
|
|
2499
2453
|
return;
|
|
2500
|
-
}
|
|
2501
2454
|
const target = e.target;
|
|
2502
|
-
|
|
2455
|
+
const isInput = target.tagName === 'INPUT';
|
|
2456
|
+
const isClearClick = !!target.closest('.ng-select-clear');
|
|
2457
|
+
const isArrowClick = !!target.closest('.ng-select-arrow');
|
|
2458
|
+
const isValueRemoveClick = !!target.closest('.ng-select-value-remove');
|
|
2459
|
+
if (!isInput) {
|
|
2503
2460
|
e.preventDefault();
|
|
2504
2461
|
}
|
|
2505
|
-
if (
|
|
2462
|
+
if (isClearClick) {
|
|
2506
2463
|
this.handleClearClick();
|
|
2507
2464
|
return;
|
|
2508
2465
|
}
|
|
2509
|
-
if (
|
|
2466
|
+
if (isArrowClick) {
|
|
2510
2467
|
this.handleArrowClick();
|
|
2511
2468
|
return;
|
|
2512
2469
|
}
|
|
2513
|
-
if (
|
|
2470
|
+
if (isValueRemoveClick) {
|
|
2514
2471
|
return;
|
|
2515
2472
|
}
|
|
2516
2473
|
if (!this.focused) {
|
|
2517
2474
|
this.focus();
|
|
2518
2475
|
}
|
|
2519
|
-
if (this.searchable) {
|
|
2520
|
-
|
|
2521
|
-
}
|
|
2522
|
-
else {
|
|
2523
|
-
this.toggle();
|
|
2476
|
+
if (this.searchable && this.isOpen) {
|
|
2477
|
+
return;
|
|
2524
2478
|
}
|
|
2479
|
+
this.toggle();
|
|
2525
2480
|
}
|
|
2526
2481
|
handleArrowClick() {
|
|
2527
2482
|
if (this.isOpen) {
|
|
@@ -3006,17 +2961,17 @@ class NgSelect {
|
|
|
3006
2961
|
}
|
|
3007
2962
|
}
|
|
3008
2963
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3009
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: NgSelect, isStandalone: true, selector: "ng-select", inputs: { bindLabel: "bindLabel", bindValue: "bindValue", placeholder: "placeholder", fixedPlaceholder: "fixedPlaceholder", appendTo: "appendTo", panelPosition: "panelPosition", panelDisabled: ["panelDisabled", "panelDisabled", booleanAttribute], readonly: ["readonly", "readonly", booleanAttribute], multiple: ["multiple", "multiple", booleanAttribute], searchable: ["searchable", "searchable", booleanAttribute], clearable: ["clearable", "clearable", booleanAttribute], clearOnBackspace: ["clearOnBackspace", "clearOnBackspace", booleanAttribute], clearAllText: "clearAllText", loading: ["loading", "loading", booleanAttribute], loadingText: "loadingText", closeOnSelect: ["closeOnSelect", "closeOnSelect", booleanAttribute], hideSelected: ["hideSelected", "hideSelected", booleanAttribute], selectOnTab: ["selectOnTab", "selectOnTab", booleanAttribute], openOnEnter: ["openOnEnter", "openOnEnter", booleanAttribute], virtualScroll: ["virtualScroll", "virtualScroll", booleanAttribute], bufferAmount: ["bufferAmount", "bufferAmount", numberAttribute], selectableGroup: ["selectableGroup", "selectableGroup", booleanAttribute], selectableGroupAsModel: ["selectableGroupAsModel", "selectableGroupAsModel", booleanAttribute], searchWhileComposing: ["searchWhileComposing", "searchWhileComposing", booleanAttribute], editableSearchTerm: ["editableSearchTerm", "editableSearchTerm", booleanAttribute], maxSelectedItems: ["maxSelectedItems", "maxSelectedItems", numberAttribute], minTermLength: ["minTermLength", "minTermLength", numberAttribute], markFirst: ["markFirst", "markFirst", booleanAttribute], preventToggleOnRightClick: ["preventToggleOnRightClick", "preventToggleOnRightClick", booleanAttribute], addTag: "addTag", addTagText: "addTagText", notFoundText: "notFoundText", typeahead: "typeahead", typeToSearchText: "typeToSearchText", groupBy: "groupBy", groupValue: "groupValue", searchFn: "searchFn", keyDownFn: "keyDownFn", trackByFn: "trackByFn",
|
|
2964
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: NgSelect, isStandalone: true, selector: "ng-select", inputs: { bindLabel: "bindLabel", bindValue: "bindValue", placeholder: "placeholder", fixedPlaceholder: "fixedPlaceholder", appendTo: "appendTo", panelPosition: "panelPosition", panelDisabled: ["panelDisabled", "panelDisabled", booleanAttribute], readonly: ["readonly", "readonly", booleanAttribute], multiple: ["multiple", "multiple", booleanAttribute], searchable: ["searchable", "searchable", booleanAttribute], clearable: ["clearable", "clearable", booleanAttribute], clearOnBackspace: ["clearOnBackspace", "clearOnBackspace", booleanAttribute], clearAllText: "clearAllText", loading: ["loading", "loading", booleanAttribute], loadingText: "loadingText", closeOnSelect: ["closeOnSelect", "closeOnSelect", booleanAttribute], hideSelected: ["hideSelected", "hideSelected", booleanAttribute], selectOnTab: ["selectOnTab", "selectOnTab", booleanAttribute], openOnEnter: ["openOnEnter", "openOnEnter", booleanAttribute], virtualScroll: ["virtualScroll", "virtualScroll", booleanAttribute], bufferAmount: ["bufferAmount", "bufferAmount", numberAttribute], selectableGroup: ["selectableGroup", "selectableGroup", booleanAttribute], selectableGroupAsModel: ["selectableGroupAsModel", "selectableGroupAsModel", booleanAttribute], searchWhileComposing: ["searchWhileComposing", "searchWhileComposing", booleanAttribute], editableSearchTerm: ["editableSearchTerm", "editableSearchTerm", booleanAttribute], maxSelectedItems: ["maxSelectedItems", "maxSelectedItems", numberAttribute], minTermLength: ["minTermLength", "minTermLength", numberAttribute], markFirst: ["markFirst", "markFirst", booleanAttribute], preventToggleOnRightClick: ["preventToggleOnRightClick", "preventToggleOnRightClick", booleanAttribute], addTag: "addTag", addTagText: "addTagText", notFoundText: "notFoundText", typeahead: "typeahead", typeToSearchText: "typeToSearchText", groupBy: "groupBy", groupValue: "groupValue", searchFn: "searchFn", keyDownFn: "keyDownFn", trackByFn: "trackByFn", tabIndex: ["tabIndex", "tabIndex", numberAttribute], inputAttrs: "inputAttrs", ariaLabel: "ariaLabel", ariaLabelledby: "ariaLabelledby", ariaDescribedby: "ariaDescribedby", panelClass: "panelClass", inputId: "inputId", items: "items", compareWith: "compareWith", clearSearchOnAdd: ["clearSearchOnAdd", "clearSearchOnAdd", booleanAttribute], deselectOnClick: ["deselectOnClick", "deselectOnClick", booleanAttribute] }, outputs: { blurEvent: "blur", focusEvent: "focus", changeEvent: "change", openEvent: "open", closeEvent: "close", searchEvent: "search", clearEvent: "clear", addEvent: "add", removeEvent: "remove", scroll: "scroll", scrollToEnd: "scrollToEnd" }, host: { listeners: { "keydown": "handleKeyDown($event)" }, properties: { "class.ng-select-single": "!multiple", "class.ng-select-multiple": "multiple", "class.ng-select-typeahead": "typeahead", "class.ng-select-taggable": "addTag", "class.ng-select-searchable": "searchable", "class.ng-select-clearable": "clearable", "class.ng-select-opened": "isOpen", "class.ng-select-filtered": "filtered", "class.ng-select-disabled": "disabled" }, classAttribute: "ng-select" }, providers: [
|
|
3010
2965
|
{
|
|
3011
2966
|
provide: NG_VALUE_ACCESSOR,
|
|
3012
2967
|
useExisting: forwardRef(() => NgSelect),
|
|
3013
2968
|
multi: true,
|
|
3014
2969
|
},
|
|
3015
|
-
], queries: [{ propertyName: "optionTemplate", first: true, predicate: NgOptionTemplate, descendants: true, read: TemplateRef }, { propertyName: "optgroupTemplate", first: true, predicate: NgOptgroupTemplate, descendants: true, read: TemplateRef }, { propertyName: "labelTemplate", first: true, predicate: NgLabelTemplate, descendants: true, read: TemplateRef }, { propertyName: "multiLabelTemplate", first: true, predicate: NgMultiLabelTemplate, descendants: true, read: TemplateRef }, { propertyName: "headerTemplate", first: true, predicate: NgHeaderTemplate, descendants: true, read: TemplateRef }, { propertyName: "footerTemplate", first: true, predicate: NgFooterTemplate, descendants: true, read: TemplateRef }, { propertyName: "notFoundTemplate", first: true, predicate: NgNotFoundTemplate, descendants: true, read: TemplateRef }, { propertyName: "placeholderTemplate", first: true, predicate: NgPlaceholderTemplate, descendants: true, read: TemplateRef }, { propertyName: "typeToSearchTemplate", first: true, predicate: NgTypeToSearchTemplate, descendants: true, read: TemplateRef }, { propertyName: "loadingTextTemplate", first: true, predicate: NgLoadingTextTemplate, descendants: true, read: TemplateRef }, { propertyName: "tagTemplate", first: true, predicate: NgTagTemplate, descendants: true, read: TemplateRef }, { propertyName: "loadingSpinnerTemplate", first: true, predicate: NgLoadingSpinnerTemplate, descendants: true, read: TemplateRef }, { propertyName: "clearButtonTemplate", first: true, predicate: NgClearButtonTemplate, descendants: true, read: TemplateRef }, { propertyName: "ngOptions", predicate: NgOption, descendants: true }], viewQueries: [{ propertyName: "dropdownPanel", first: true, predicate: i0.forwardRef(() => NgDropdownPanel), descendants: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, static: true }, { propertyName: "clearButton", first: true, predicate: ["clearButton"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/mouse-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n\n<div class=\"ng-select-visually-hidden\">\n <div role=\"status\" aria-atomic=\"true\" aria-live=\"polite\">\n @if (isOpen && showNoItemsFound) {\n {{ notFoundText }}\n }\n </div>\n <div [attr.id]=\"_viewValuesId\">{{ selectedViewValuesStr }}</div>\n</div>\n\n<div\n class=\"ng-select-container\"\n [class.ng-appearance-outline]=\"appearance === 'outline'\"\n [class.ng-has-value]=\"hasValue\"\n (mousedown)=\"handleMousedown($event)\"\n>\n <div class=\"ng-value-container\">\n @if ((selectedItems.length === 0 && !searchTerm) || fixedPlaceholder) {\n <ng-template #defaultPlaceholderTemplate>\n <div class=\"ng-placeholder\">{{ placeholder }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"placeholderTemplate || defaultPlaceholderTemplate\" />\n }\n\n @if ((!multiLabelTemplate || !multiple) && selectedItems.length > 0) {\n @for (item of selectedItems; track trackByOption($index, item)) {\n <div class=\"ng-value\" [class.ng-value-disabled]=\"item.disabled\">\n <ng-template #defaultLabelTemplate>\n <span\n class=\"ng-value-label\"\n [ngItemLabel]=\"item.label || ''\"\n [escape]=\"escapeHTML\"\n ></span>\n <span class=\"ng-value-remove\" (click)=\"unselect(item)\" role=\"button\">\u00D7</span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\"\n />\n </div>\n }\n }\n\n @if (multiple && multiLabelTemplate && selectedValues.length > 0) {\n <ng-template\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\"\n />\n }\n\n <div class=\"ng-input\">\n <input\n #searchInput\n [disabled]=\"disabled\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [value]=\"searchTerm ?? ''\"\n (change)=\"$event.stopPropagation()\"\n (input)=\"filter(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n [tabIndex]=\"tabIndex\"\n [attr.id]=\"inputId\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-haspopup]=\"panelDisabled ? 'false' : 'listbox'\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-controls]=\"isOpen ? _listboxId : null\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n role=\"combobox\"\n />\n </div>\n </div>\n\n @if (loading) {\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-select-spinner\"></div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"loadingSpinnerTemplate || defaultLoadingSpinnerTemplate\" />\n }\n\n @if (showClearButton) {\n @if (clearButtonTemplate) {\n <ng-container [ngTemplateOutlet]=\"clearButtonTemplate\" />\n } @else {\n <span #clearButton class=\"ng-clear-wrapper\" [title]=\"clearAllText\" aria-hidden=\"true\">\n <span class=\"ng-clear\">\u00D7</span>\n </span>\n }\n }\n\n @if (!panelDisabled) {\n <span class=\"ng-arrow-wrapper\" aria-hidden=\"true\">\n <span class=\"ng-arrow\"></span>\n </span>\n }\n</div>\n\n@if (isOpen) {\n <ng-dropdown-panel\n [class]=\"appendTo ? _classList : null\"\n [multiple]=\"multiple\"\n [listboxId]=\"_listboxId\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"panelPosition\"\n [headerTemplate]=\"headerTemplate\"\n [footerTemplate]=\"footerTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit()\"\n (outsideClick)=\"close()\"\n >\n @for (item of viewPortItems; track trackByOption($index, item)) {\n <div\n class=\"ng-option\"\n [class.ng-option-disabled]=\"item.disabled\"\n [class.ng-option-selected]=\"item.selected\"\n [class.ng-optgroup]=\"item.children\"\n [class.ng-option]=\"!item.children\"\n [class.ng-option-child]=\"!!item.parent\"\n [class.ng-option-marked]=\"item === itemsList.markedItem\"\n [attr.id]=\"item.htmlId\"\n [attr.role]=\"item.children ? 'group' : 'option'\"\n [attr.aria-disabled]=\"item.disabled ?? false\"\n [attr.aria-selected]=\"item.selected ?? false\"\n [attr.aria-setsize]=\"itemsList.filteredItems.length\"\n [attr.aria-posinset]=\"(item.index || 0) + 1\"\n (click)=\"toggleItem(item)\"\n (mouseover)=\"onItemHover(item)\"\n >\n <ng-template #defaultOptionTemplate>\n <span\n class=\"ng-option-label\"\n [ngItemLabel]=\"item.label || ''\"\n [escape]=\"escapeHTML\"\n ></span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"\n item.children\n ? optgroupTemplate || defaultOptionTemplate\n : optionTemplate || defaultOptionTemplate\n \"\n [ngTemplateOutletContext]=\"{\n item: item.value,\n item$: item,\n index: item.index,\n searchTerm: searchTerm,\n }\"\n />\n </div>\n }\n\n @if (showAddTag) {\n <div\n class=\"ng-option\"\n [class.ng-option-marked]=\"!itemsList.markedItem\"\n role=\"option\"\n [attr.aria-disabled]=\"false\"\n [attr.aria-selected]=\"false\"\n (click)=\"selectTag()\"\n (mouseover)=\"itemsList.unmarkItem()\"\n >\n <ng-template #defaultTagTemplate>\n <span>\n <span class=\"ng-tag-label\">{{ addTagText }}</span>\n \"{{ searchTerm }}\"\n </span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n </div>\n }\n\n @if (showNoItemsFound) {\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ notFoundText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n @if (showTypeToSearch) {\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ typeToSearchText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\" />\n }\n @if (loading && itemsList.filteredItems.length === 0) {\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ loadingText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n </ng-dropdown-panel>\n}\n", styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block}.ng-select.ng-select-opened .ng-select-container{z-index:1010}.ng-select.ng-select-disabled .ng-placeholder,.ng-select.ng-select-disabled .ng-value{-webkit-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder,.ng-select .ng-has-value .ng-placeholder{display:none}.ng-select .ng-select-container{box-sizing:border-box;position:relative;display:flex;width:100%;outline:none;overflow:hidden;cursor:default}.ng-select .ng-value-container{display:flex;flex:1}.ng-select .ng-input{box-sizing:border-box}.ng-select .ng-input>input{width:100%;padding:0;background:transparent;border:none;box-shadow:none;outline:none;cursor:default}.ng-select .ng-input>input::-ms-clear{display:none}.ng-select .ng-input>input[readonly]{width:0;-webkit-user-select:unset;user-select:unset}.ng-select.ng-select-single.ng-select-filtered .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-value-container,.ng-select.ng-select-single .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-value-remove{display:none}.ng-select.ng-select-single .ng-input{position:absolute;left:0;right:0}.ng-select.ng-select-multiple.ng-select-disabled .ng-value-remove{display:none}.ng-select.ng-select-multiple .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-placeholder{position:absolute}.ng-select.ng-select-multiple .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-value-remove{cursor:pointer}.ng-select.ng-select-multiple .ng-value-disabled .ng-value-remove{display:none}.ng-select.ng-select-multiple .ng-input{flex:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;user-select:none}.ng-select .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-arrow-wrapper{position:relative;text-align:center;-webkit-user-select:none;user-select:none;cursor:pointer}.ng-select .ng-arrow{position:relative;display:inline-block;height:0;width:0;pointer-events:none}.ng-dropdown-panel{box-sizing:border-box;position:absolute;z-index:1080;width:100%;opacity:0;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-optgroup,.ng-dropdown-panel .ng-option{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-option{display:block;cursor:pointer}.ng-dropdown-panel .ng-option.disabled{cursor:default}.ng-dropdown-panel .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-option-label:empty:before{content:\"\\200b\"}.ng-select-virtual-scroll-host{position:relative;display:block;overflow:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch}.ng-select-virtual-scroll-content{position:absolute;top:0;left:0;width:100%;height:100%}.ng-select-virtual-scroll-spacer{width:1px;opacity:0}.ng-select-visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;border:0;clip-path:rect(0 0 0 0);white-space:nowrap}.ng-select-spinner{position:relative;width:16px;height:16px;margin:0 4px;font-size:10px;text-indent:-9999em;border-radius:50%;border:2px solid rgba(66,66,66,.2);border-left-color:#424242;animation:load8 .8s infinite linear}@keyframes load8{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgItemLabel, selector: "[ngItemLabel]", inputs: ["ngItemLabel", "escape"] }, { kind: "component", type: NgDropdownPanel, selector: "ng-dropdown-panel", inputs: ["listboxId", "items", "markedItem", "position", "appendTo", "bufferAmount", "virtualScroll", "multiple", "headerTemplate", "footerTemplate", "filterValue"], outputs: ["update", "scroll", "scrollToEnd", "outsideClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2970
|
+
], queries: [{ propertyName: "optionTemplate", first: true, predicate: NgSelectOptionTemplate, descendants: true, read: TemplateRef }, { propertyName: "optgroupTemplate", first: true, predicate: NgSelectOptgroupTemplate, descendants: true, read: TemplateRef }, { propertyName: "labelTemplate", first: true, predicate: NgSelectLabelTemplate, descendants: true, read: TemplateRef }, { propertyName: "multiLabelTemplate", first: true, predicate: NgSelectMultiLabelTemplate, descendants: true, read: TemplateRef }, { propertyName: "panelHeaderTemplate", first: true, predicate: NgSelectPanelHeaderTemplate, descendants: true, read: TemplateRef }, { propertyName: "panelFooterTemplate", first: true, predicate: NgSelectPanelFooterTemplate, descendants: true, read: TemplateRef }, { propertyName: "notFoundTemplate", first: true, predicate: NgSelectNotFoundTemplate, descendants: true, read: TemplateRef }, { propertyName: "placeholderTemplate", first: true, predicate: NgSelectPlaceholderTemplate, descendants: true, read: TemplateRef }, { propertyName: "typeToSearchTemplate", first: true, predicate: NgSelectTypeToSearchTemplate, descendants: true, read: TemplateRef }, { propertyName: "loadingTextTemplate", first: true, predicate: NgSelectLoadingTextTemplate, descendants: true, read: TemplateRef }, { propertyName: "tagTemplate", first: true, predicate: NgSelectTagTemplate, descendants: true, read: TemplateRef }, { propertyName: "loadingTemplate", first: true, predicate: NgSelectLoadingTemplate, descendants: true, read: TemplateRef }, { propertyName: "clearButtonTemplate", first: true, predicate: NgSelectClearButtonTemplate, descendants: true, read: TemplateRef }, { propertyName: "ngOptions", predicate: NgSelectOption, descendants: true }], viewQueries: [{ propertyName: "dropdownPanel", first: true, predicate: i0.forwardRef(() => NgSelectPanel), descendants: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, static: true }, { propertyName: "clearButton", first: true, predicate: ["clearButton"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/mouse-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n\n<div class=\"ng-select-visually-hidden\">\n <div role=\"status\" aria-atomic=\"true\" aria-live=\"polite\">\n @if (isOpen && showNoItemsFound) {\n {{ notFoundText }}\n }\n </div>\n\n <div [attr.id]=\"_viewValuesId\">{{ selectedViewValuesStr }}</div>\n</div>\n\n<div\n class=\"ng-select-control\"\n [class.ng-select-has-value]=\"hasValue\"\n (mousedown)=\"handleMousedown($event)\"\n>\n <div class=\"ng-select-value-container\">\n @if ((selectedItems.length === 0 && !searchTerm) || fixedPlaceholder) {\n <ng-template #defaultPlaceholderTemplate>\n <div class=\"ng-select-placeholder\">{{ placeholder }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"placeholderTemplate || defaultPlaceholderTemplate\" />\n }\n\n @if ((!multiLabelTemplate || !multiple) && selectedItems.length > 0) {\n @for (item of selectedItems; track trackByOption($index, item)) {\n <div class=\"ng-select-value\" [class.ng-select-value-disabled]=\"item.disabled\">\n <ng-template #defaultLabelTemplate>\n <span\n class=\"ng-select-value-label\"\n [ngSelectLabelValue]=\"item.label || ''\"\n [ngSelectLabelEscape]=\"escapeHTML\"\n ></span>\n @if (multiple) {\n <span class=\"ng-select-value-remove\" (click)=\"unselect(item)\" role=\"button\">\n <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z\"\n />\n </svg>\n </span>\n }\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\"\n />\n </div>\n }\n }\n\n @if (multiple && multiLabelTemplate && selectedValues.length > 0) {\n <ng-template\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\"\n />\n }\n\n <div class=\"ng-select-input-container\">\n <input\n #searchInput\n class=\"ng-select-input\"\n [disabled]=\"disabled\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [value]=\"searchTerm ?? ''\"\n (change)=\"$event.stopPropagation()\"\n (input)=\"filter(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n [tabIndex]=\"tabIndex\"\n [attr.id]=\"inputId\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-haspopup]=\"panelDisabled ? 'false' : 'listbox'\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-controls]=\"isOpen ? _listboxId : null\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n role=\"combobox\"\n />\n </div>\n </div>\n\n @if (loading) {\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-select-spinner\"></div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"loadingTemplate || defaultLoadingSpinnerTemplate\" />\n }\n\n @if (showClearButton) {\n @if (clearButtonTemplate) {\n <ng-container [ngTemplateOutlet]=\"clearButtonTemplate\" />\n } @else {\n <span #clearButton class=\"ng-select-clear\" [title]=\"clearAllText\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z\"\n />\n </svg>\n </span>\n }\n }\n\n @if (!panelDisabled) {\n <span class=\"ng-select-arrow\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z\"\n />\n </svg>\n </span>\n }\n</div>\n\n@if (isOpen) {\n <ng-select-panel\n [class]=\"appendTo ? _classList : null\"\n [multiple]=\"multiple\"\n [listboxId]=\"_listboxId\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"panelPosition\"\n [headerTemplate]=\"panelHeaderTemplate\"\n [footerTemplate]=\"panelFooterTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit()\"\n (outsideClick)=\"close()\"\n >\n @for (item of viewPortItems; track trackByOption($index, item)) {\n <div\n class=\"ng-select-option\"\n [class.ng-select-option-disabled]=\"item.disabled\"\n [class.ng-select-option-selected]=\"item.selected\"\n [class.ng-select-optgroup]=\"item.children\"\n [class.ng-select-option]=\"!item.children\"\n [class.ng-select-option-child]=\"!!item.parent\"\n [class.ng-select-option-marked]=\"item === itemsList.markedItem\"\n [attr.id]=\"item.htmlId\"\n [attr.role]=\"item.children ? 'group' : 'option'\"\n [attr.aria-disabled]=\"item.disabled ?? false\"\n [attr.aria-selected]=\"item.selected ?? false\"\n [attr.aria-setsize]=\"itemsList.filteredItems.length\"\n [attr.aria-posinset]=\"(item.index || 0) + 1\"\n (click)=\"toggleItem(item)\"\n (mouseover)=\"onItemHover(item)\"\n >\n <ng-template #defaultOptionTemplate>\n <span\n class=\"ng-select-option-label\"\n [ngSelectLabelValue]=\"item.label || ''\"\n [ngSelectLabelEscape]=\"escapeHTML\"\n ></span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"\n item.children\n ? optgroupTemplate || defaultOptionTemplate\n : optionTemplate || defaultOptionTemplate\n \"\n [ngTemplateOutletContext]=\"{\n item: item.value,\n item$: item,\n index: item.index,\n searchTerm: searchTerm,\n }\"\n />\n </div>\n }\n\n @if (showAddTag) {\n <div\n class=\"ng-select-option ng-select-tag-option\"\n [class.ng-select-option-marked]=\"!itemsList.markedItem\"\n role=\"option\"\n [attr.aria-disabled]=\"false\"\n [attr.aria-selected]=\"false\"\n (click)=\"selectTag()\"\n (mouseover)=\"itemsList.unmarkItem()\"\n >\n <ng-template #defaultTagTemplate>\n <span class=\"ng-select-tag-option-label\">{{ addTagText }}</span>\n <span class=\"ng-select-tag-option-value\">\"{{ searchTerm }}\"</span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n </div>\n }\n\n @if (showNoItemsFound) {\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-select-option ng-select-option-disabled\">{{ notFoundText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n @if (showTypeToSearch) {\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-select-option ng-select-option-disabled\">{{ typeToSearchText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\" />\n }\n @if (loading && itemsList.filteredItems.length === 0) {\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-select-option ng-select-option-disabled\">{{ loadingText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n </ng-select-panel>\n}\n", styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block}.ng-select-control{box-sizing:border-box;position:relative;display:flex;width:100%;outline:none;overflow:hidden}.ng-select-opened .ng-select-control{z-index:1010}.ng-select-value-container{position:relative;display:flex;flex:1;flex-wrap:wrap;align-items:center}.ng-select-input-container{position:relative;box-sizing:border-box}.ng-select-value-remove svg{width:14px;height:14px}.ng-select-input{width:100%;padding:0;background:transparent;border:none;box-shadow:none;outline:none;cursor:default}.ng-select-input[readonly]{width:0;-webkit-user-select:unset;user-select:unset}.ng-select-clear,.ng-select-arrow{position:relative;-webkit-user-select:none;user-select:none}.ng-select-clear svg,.ng-select-arrow svg{width:20px;height:20px}.ng-select-visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;border:0;overflow:hidden;white-space:nowrap;clip-path:inset(50%)}.ng-select-disabled .ng-select-placeholder,.ng-select-disabled .ng-select-value{-webkit-user-select:none;user-select:none}.ng-select-disabled .ng-select-clear,.ng-select-disabled .ng-select-arrow{pointer-events:none}.ng-select-filtered .ng-select-placeholder,.ng-select-has-value .ng-select-placeholder{display:none}.ng-select-single.ng-select-filtered .ng-select-value{visibility:hidden}.ng-select-single .ng-select-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select-single .ng-select-input-container{position:absolute;left:0;right:0}.ng-select-multiple .ng-select-placeholder{position:absolute}.ng-select-multiple .ng-select-value{display:inline-flex;align-items:center;overflow:hidden}.ng-select-multiple .ng-select-value.ng-select-value-disabled{-webkit-user-select:none;user-select:none}.ng-select-multiple.ng-select-disabled .ng-select-value-remove,.ng-select-multiple .ng-select-value-disabled .ng-select-value-remove{display:none}.ng-select-multiple .ng-select-input-container{flex:1}.ng-select-panel{box-sizing:border-box;position:absolute;z-index:1080;width:100%;opacity:0;-webkit-overflow-scrolling:touch}.ng-select-listbox{max-height:300px;overflow-y:auto}.ng-select-option,.ng-select-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select-option-highlighted{font-weight:700;text-decoration:underline}.ng-select-option-label:empty:before{content:\"\\200b\"}.ng-select-virtual-scroll-host{position:relative;overflow:hidden auto;-webkit-overflow-scrolling:touch}.ng-select-virtual-scroll-content{position:absolute;top:0;left:0;width:100%;contain:content}.ng-select-virtual-scroll-spacer{width:1px;opacity:0}.ng-select-spinner{position:relative;width:16px;height:16px;margin:auto 4px;border-radius:50%;border:2px solid rgba(66,66,66,.2);border-left-color:#666;animation:ng-select-spinning .8s infinite linear}@keyframes ng-select-spinning{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgSelectLabelRenderer, selector: "[ngSelectLabelValue]", inputs: ["ngSelectLabelValue", "ngSelectLabelEscape"] }, { kind: "component", type: NgSelectPanel, selector: "ng-select-panel", inputs: ["listboxId", "items", "markedItem", "position", "appendTo", "bufferAmount", "virtualScroll", "multiple", "headerTemplate", "footerTemplate", "filterValue"], outputs: ["update", "scroll", "scrollToEnd", "outsideClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3016
2971
|
}
|
|
3017
2972
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelect, decorators: [{
|
|
3018
2973
|
type: Component,
|
|
3019
|
-
args: [{ selector: 'ng-select', imports: [NgTemplateOutlet,
|
|
2974
|
+
args: [{ selector: 'ng-select', imports: [NgTemplateOutlet, NgSelectLabelRenderer, NgSelectPanel], host: {
|
|
3020
2975
|
'class': 'ng-select',
|
|
3021
2976
|
'[class.ng-select-single]': '!multiple',
|
|
3022
2977
|
'[class.ng-select-multiple]': 'multiple',
|
|
@@ -3034,7 +2989,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
3034
2989
|
useExisting: forwardRef(() => NgSelect),
|
|
3035
2990
|
multi: true,
|
|
3036
2991
|
},
|
|
3037
|
-
], template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/mouse-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n\n<div class=\"ng-select-visually-hidden\">\n <div role=\"status\" aria-atomic=\"true\" aria-live=\"polite\">\n @if (isOpen && showNoItemsFound) {\n {{ notFoundText }}\n }\n </div>\n <div [attr.id]=\"_viewValuesId\">{{ selectedViewValuesStr }}</div>\n</div>\n\n<div\n class=\"ng-select-container\"\n [class.ng-appearance-outline]=\"appearance === 'outline'\"\n [class.ng-has-value]=\"hasValue\"\n (mousedown)=\"handleMousedown($event)\"\n>\n <div class=\"ng-value-container\">\n @if ((selectedItems.length === 0 && !searchTerm) || fixedPlaceholder) {\n <ng-template #defaultPlaceholderTemplate>\n <div class=\"ng-placeholder\">{{ placeholder }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"placeholderTemplate || defaultPlaceholderTemplate\" />\n }\n\n @if ((!multiLabelTemplate || !multiple) && selectedItems.length > 0) {\n @for (item of selectedItems; track trackByOption($index, item)) {\n <div class=\"ng-value\" [class.ng-value-disabled]=\"item.disabled\">\n <ng-template #defaultLabelTemplate>\n <span\n class=\"ng-value-label\"\n [ngItemLabel]=\"item.label || ''\"\n [escape]=\"escapeHTML\"\n ></span>\n <span class=\"ng-value-remove\" (click)=\"unselect(item)\" role=\"button\">\u00D7</span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\"\n />\n </div>\n }\n }\n\n @if (multiple && multiLabelTemplate && selectedValues.length > 0) {\n <ng-template\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\"\n />\n }\n\n <div class=\"ng-input\">\n <input\n #searchInput\n [disabled]=\"disabled\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [value]=\"searchTerm ?? ''\"\n (change)=\"$event.stopPropagation()\"\n (input)=\"filter(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n [tabIndex]=\"tabIndex\"\n [attr.id]=\"inputId\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-haspopup]=\"panelDisabled ? 'false' : 'listbox'\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-controls]=\"isOpen ? _listboxId : null\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n role=\"combobox\"\n />\n </div>\n </div>\n\n @if (loading) {\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-select-spinner\"></div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"loadingSpinnerTemplate || defaultLoadingSpinnerTemplate\" />\n }\n\n @if (showClearButton) {\n @if (clearButtonTemplate) {\n <ng-container [ngTemplateOutlet]=\"clearButtonTemplate\" />\n } @else {\n <span #clearButton class=\"ng-clear-wrapper\" [title]=\"clearAllText\" aria-hidden=\"true\">\n <span class=\"ng-clear\">\u00D7</span>\n </span>\n }\n }\n\n @if (!panelDisabled) {\n <span class=\"ng-arrow-wrapper\" aria-hidden=\"true\">\n <span class=\"ng-arrow\"></span>\n </span>\n }\n</div>\n\n@if (isOpen) {\n <ng-dropdown-panel\n [class]=\"appendTo ? _classList : null\"\n [multiple]=\"multiple\"\n [listboxId]=\"_listboxId\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"panelPosition\"\n [headerTemplate]=\"headerTemplate\"\n [footerTemplate]=\"footerTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit()\"\n (outsideClick)=\"close()\"\n >\n @for (item of viewPortItems; track trackByOption($index, item)) {\n <div\n class=\"ng-option\"\n [class.ng-option-disabled]=\"item.disabled\"\n [class.ng-option-selected]=\"item.selected\"\n [class.ng-optgroup]=\"item.children\"\n [class.ng-option]=\"!item.children\"\n [class.ng-option-child]=\"!!item.parent\"\n [class.ng-option-marked]=\"item === itemsList.markedItem\"\n [attr.id]=\"item.htmlId\"\n [attr.role]=\"item.children ? 'group' : 'option'\"\n [attr.aria-disabled]=\"item.disabled ?? false\"\n [attr.aria-selected]=\"item.selected ?? false\"\n [attr.aria-setsize]=\"itemsList.filteredItems.length\"\n [attr.aria-posinset]=\"(item.index || 0) + 1\"\n (click)=\"toggleItem(item)\"\n (mouseover)=\"onItemHover(item)\"\n >\n <ng-template #defaultOptionTemplate>\n <span\n class=\"ng-option-label\"\n [ngItemLabel]=\"item.label || ''\"\n [escape]=\"escapeHTML\"\n ></span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"\n item.children\n ? optgroupTemplate || defaultOptionTemplate\n : optionTemplate || defaultOptionTemplate\n \"\n [ngTemplateOutletContext]=\"{\n item: item.value,\n item$: item,\n index: item.index,\n searchTerm: searchTerm,\n }\"\n />\n </div>\n }\n\n @if (showAddTag) {\n <div\n class=\"ng-option\"\n [class.ng-option-marked]=\"!itemsList.markedItem\"\n role=\"option\"\n [attr.aria-disabled]=\"false\"\n [attr.aria-selected]=\"false\"\n (click)=\"selectTag()\"\n (mouseover)=\"itemsList.unmarkItem()\"\n >\n <ng-template #defaultTagTemplate>\n <span>\n <span class=\"ng-tag-label\">{{ addTagText }}</span>\n \"{{ searchTerm }}\"\n </span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n </div>\n }\n\n @if (showNoItemsFound) {\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ notFoundText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n @if (showTypeToSearch) {\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ typeToSearchText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\" />\n }\n @if (loading && itemsList.filteredItems.length === 0) {\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ loadingText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n </ng-dropdown-panel>\n}\n", styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block}.ng-select.ng-select-opened .ng-select-container{z-index:1010}.ng-select.ng-select-disabled .ng-placeholder,.ng-select.ng-select-disabled .ng-value{-webkit-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder,.ng-select .ng-has-value .ng-placeholder{display:none}.ng-select .ng-select-container{box-sizing:border-box;position:relative;display:flex;width:100%;outline:none;overflow:hidden;cursor:default}.ng-select .ng-value-container{display:flex;flex:1}.ng-select .ng-input{box-sizing:border-box}.ng-select .ng-input>input{width:100%;padding:0;background:transparent;border:none;box-shadow:none;outline:none;cursor:default}.ng-select .ng-input>input::-ms-clear{display:none}.ng-select .ng-input>input[readonly]{width:0;-webkit-user-select:unset;user-select:unset}.ng-select.ng-select-single.ng-select-filtered .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-value-container,.ng-select.ng-select-single .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-value-remove{display:none}.ng-select.ng-select-single .ng-input{position:absolute;left:0;right:0}.ng-select.ng-select-multiple.ng-select-disabled .ng-value-remove{display:none}.ng-select.ng-select-multiple .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-placeholder{position:absolute}.ng-select.ng-select-multiple .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-value-remove{cursor:pointer}.ng-select.ng-select-multiple .ng-value-disabled .ng-value-remove{display:none}.ng-select.ng-select-multiple .ng-input{flex:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;user-select:none}.ng-select .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-arrow-wrapper{position:relative;text-align:center;-webkit-user-select:none;user-select:none;cursor:pointer}.ng-select .ng-arrow{position:relative;display:inline-block;height:0;width:0;pointer-events:none}.ng-dropdown-panel{box-sizing:border-box;position:absolute;z-index:1080;width:100%;opacity:0;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-optgroup,.ng-dropdown-panel .ng-option{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-option{display:block;cursor:pointer}.ng-dropdown-panel .ng-option.disabled{cursor:default}.ng-dropdown-panel .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-option-label:empty:before{content:\"\\200b\"}.ng-select-virtual-scroll-host{position:relative;display:block;overflow:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch}.ng-select-virtual-scroll-content{position:absolute;top:0;left:0;width:100%;height:100%}.ng-select-virtual-scroll-spacer{width:1px;opacity:0}.ng-select-visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;border:0;clip-path:rect(0 0 0 0);white-space:nowrap}.ng-select-spinner{position:relative;width:16px;height:16px;margin:0 4px;font-size:10px;text-indent:-9999em;border-radius:50%;border:2px solid rgba(66,66,66,.2);border-left-color:#424242;animation:load8 .8s infinite linear}@keyframes load8{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
|
|
2992
|
+
], template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/mouse-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n\n<div class=\"ng-select-visually-hidden\">\n <div role=\"status\" aria-atomic=\"true\" aria-live=\"polite\">\n @if (isOpen && showNoItemsFound) {\n {{ notFoundText }}\n }\n </div>\n\n <div [attr.id]=\"_viewValuesId\">{{ selectedViewValuesStr }}</div>\n</div>\n\n<div\n class=\"ng-select-control\"\n [class.ng-select-has-value]=\"hasValue\"\n (mousedown)=\"handleMousedown($event)\"\n>\n <div class=\"ng-select-value-container\">\n @if ((selectedItems.length === 0 && !searchTerm) || fixedPlaceholder) {\n <ng-template #defaultPlaceholderTemplate>\n <div class=\"ng-select-placeholder\">{{ placeholder }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"placeholderTemplate || defaultPlaceholderTemplate\" />\n }\n\n @if ((!multiLabelTemplate || !multiple) && selectedItems.length > 0) {\n @for (item of selectedItems; track trackByOption($index, item)) {\n <div class=\"ng-select-value\" [class.ng-select-value-disabled]=\"item.disabled\">\n <ng-template #defaultLabelTemplate>\n <span\n class=\"ng-select-value-label\"\n [ngSelectLabelValue]=\"item.label || ''\"\n [ngSelectLabelEscape]=\"escapeHTML\"\n ></span>\n @if (multiple) {\n <span class=\"ng-select-value-remove\" (click)=\"unselect(item)\" role=\"button\">\n <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z\"\n />\n </svg>\n </span>\n }\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\"\n />\n </div>\n }\n }\n\n @if (multiple && multiLabelTemplate && selectedValues.length > 0) {\n <ng-template\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\"\n />\n }\n\n <div class=\"ng-select-input-container\">\n <input\n #searchInput\n class=\"ng-select-input\"\n [disabled]=\"disabled\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [value]=\"searchTerm ?? ''\"\n (change)=\"$event.stopPropagation()\"\n (input)=\"filter(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n [tabIndex]=\"tabIndex\"\n [attr.id]=\"inputId\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-haspopup]=\"panelDisabled ? 'false' : 'listbox'\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-controls]=\"isOpen ? _listboxId : null\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n role=\"combobox\"\n />\n </div>\n </div>\n\n @if (loading) {\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-select-spinner\"></div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"loadingTemplate || defaultLoadingSpinnerTemplate\" />\n }\n\n @if (showClearButton) {\n @if (clearButtonTemplate) {\n <ng-container [ngTemplateOutlet]=\"clearButtonTemplate\" />\n } @else {\n <span #clearButton class=\"ng-select-clear\" [title]=\"clearAllText\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z\"\n />\n </svg>\n </span>\n }\n }\n\n @if (!panelDisabled) {\n <span class=\"ng-select-arrow\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z\"\n />\n </svg>\n </span>\n }\n</div>\n\n@if (isOpen) {\n <ng-select-panel\n [class]=\"appendTo ? _classList : null\"\n [multiple]=\"multiple\"\n [listboxId]=\"_listboxId\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"panelPosition\"\n [headerTemplate]=\"panelHeaderTemplate\"\n [footerTemplate]=\"panelFooterTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit()\"\n (outsideClick)=\"close()\"\n >\n @for (item of viewPortItems; track trackByOption($index, item)) {\n <div\n class=\"ng-select-option\"\n [class.ng-select-option-disabled]=\"item.disabled\"\n [class.ng-select-option-selected]=\"item.selected\"\n [class.ng-select-optgroup]=\"item.children\"\n [class.ng-select-option]=\"!item.children\"\n [class.ng-select-option-child]=\"!!item.parent\"\n [class.ng-select-option-marked]=\"item === itemsList.markedItem\"\n [attr.id]=\"item.htmlId\"\n [attr.role]=\"item.children ? 'group' : 'option'\"\n [attr.aria-disabled]=\"item.disabled ?? false\"\n [attr.aria-selected]=\"item.selected ?? false\"\n [attr.aria-setsize]=\"itemsList.filteredItems.length\"\n [attr.aria-posinset]=\"(item.index || 0) + 1\"\n (click)=\"toggleItem(item)\"\n (mouseover)=\"onItemHover(item)\"\n >\n <ng-template #defaultOptionTemplate>\n <span\n class=\"ng-select-option-label\"\n [ngSelectLabelValue]=\"item.label || ''\"\n [ngSelectLabelEscape]=\"escapeHTML\"\n ></span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"\n item.children\n ? optgroupTemplate || defaultOptionTemplate\n : optionTemplate || defaultOptionTemplate\n \"\n [ngTemplateOutletContext]=\"{\n item: item.value,\n item$: item,\n index: item.index,\n searchTerm: searchTerm,\n }\"\n />\n </div>\n }\n\n @if (showAddTag) {\n <div\n class=\"ng-select-option ng-select-tag-option\"\n [class.ng-select-option-marked]=\"!itemsList.markedItem\"\n role=\"option\"\n [attr.aria-disabled]=\"false\"\n [attr.aria-selected]=\"false\"\n (click)=\"selectTag()\"\n (mouseover)=\"itemsList.unmarkItem()\"\n >\n <ng-template #defaultTagTemplate>\n <span class=\"ng-select-tag-option-label\">{{ addTagText }}</span>\n <span class=\"ng-select-tag-option-value\">\"{{ searchTerm }}\"</span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n </div>\n }\n\n @if (showNoItemsFound) {\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-select-option ng-select-option-disabled\">{{ notFoundText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n @if (showTypeToSearch) {\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-select-option ng-select-option-disabled\">{{ typeToSearchText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\" />\n }\n @if (loading && itemsList.filteredItems.length === 0) {\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-select-option ng-select-option-disabled\">{{ loadingText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n </ng-select-panel>\n}\n", styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block}.ng-select-control{box-sizing:border-box;position:relative;display:flex;width:100%;outline:none;overflow:hidden}.ng-select-opened .ng-select-control{z-index:1010}.ng-select-value-container{position:relative;display:flex;flex:1;flex-wrap:wrap;align-items:center}.ng-select-input-container{position:relative;box-sizing:border-box}.ng-select-value-remove svg{width:14px;height:14px}.ng-select-input{width:100%;padding:0;background:transparent;border:none;box-shadow:none;outline:none;cursor:default}.ng-select-input[readonly]{width:0;-webkit-user-select:unset;user-select:unset}.ng-select-clear,.ng-select-arrow{position:relative;-webkit-user-select:none;user-select:none}.ng-select-clear svg,.ng-select-arrow svg{width:20px;height:20px}.ng-select-visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;border:0;overflow:hidden;white-space:nowrap;clip-path:inset(50%)}.ng-select-disabled .ng-select-placeholder,.ng-select-disabled .ng-select-value{-webkit-user-select:none;user-select:none}.ng-select-disabled .ng-select-clear,.ng-select-disabled .ng-select-arrow{pointer-events:none}.ng-select-filtered .ng-select-placeholder,.ng-select-has-value .ng-select-placeholder{display:none}.ng-select-single.ng-select-filtered .ng-select-value{visibility:hidden}.ng-select-single .ng-select-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select-single .ng-select-input-container{position:absolute;left:0;right:0}.ng-select-multiple .ng-select-placeholder{position:absolute}.ng-select-multiple .ng-select-value{display:inline-flex;align-items:center;overflow:hidden}.ng-select-multiple .ng-select-value.ng-select-value-disabled{-webkit-user-select:none;user-select:none}.ng-select-multiple.ng-select-disabled .ng-select-value-remove,.ng-select-multiple .ng-select-value-disabled .ng-select-value-remove{display:none}.ng-select-multiple .ng-select-input-container{flex:1}.ng-select-panel{box-sizing:border-box;position:absolute;z-index:1080;width:100%;opacity:0;-webkit-overflow-scrolling:touch}.ng-select-listbox{max-height:300px;overflow-y:auto}.ng-select-option,.ng-select-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select-option-highlighted{font-weight:700;text-decoration:underline}.ng-select-option-label:empty:before{content:\"\\200b\"}.ng-select-virtual-scroll-host{position:relative;overflow:hidden auto;-webkit-overflow-scrolling:touch}.ng-select-virtual-scroll-content{position:absolute;top:0;left:0;width:100%;contain:content}.ng-select-virtual-scroll-spacer{width:1px;opacity:0}.ng-select-spinner{position:relative;width:16px;height:16px;margin:auto 4px;border-radius:50%;border:2px solid rgba(66,66,66,.2);border-left-color:#666;animation:ng-select-spinning .8s infinite linear}@keyframes ng-select-spinning{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
|
|
3038
2993
|
}], ctorParameters: () => [], propDecorators: { bindLabel: [{
|
|
3039
2994
|
type: Input
|
|
3040
2995
|
}], bindValue: [{
|
|
@@ -3134,8 +3089,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
3134
3089
|
type: Input
|
|
3135
3090
|
}], trackByFn: [{
|
|
3136
3091
|
type: Input
|
|
3137
|
-
}], appearance: [{
|
|
3138
|
-
type: Input
|
|
3139
3092
|
}], tabIndex: [{
|
|
3140
3093
|
type: Input,
|
|
3141
3094
|
args: [{ transform: numberAttribute }]
|
|
@@ -3194,7 +3147,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
3194
3147
|
type: Output
|
|
3195
3148
|
}], dropdownPanel: [{
|
|
3196
3149
|
type: ViewChild,
|
|
3197
|
-
args: [forwardRef(() =>
|
|
3150
|
+
args: [forwardRef(() => NgSelectPanel)]
|
|
3198
3151
|
}], searchInput: [{
|
|
3199
3152
|
type: ViewChild,
|
|
3200
3153
|
args: ['searchInput', { static: true }]
|
|
@@ -3203,81 +3156,81 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
3203
3156
|
args: ['clearButton']
|
|
3204
3157
|
}], ngOptions: [{
|
|
3205
3158
|
type: ContentChildren,
|
|
3206
|
-
args: [
|
|
3159
|
+
args: [NgSelectOption, { descendants: true }]
|
|
3207
3160
|
}], optionTemplate: [{
|
|
3208
3161
|
type: ContentChild,
|
|
3209
|
-
args: [
|
|
3162
|
+
args: [NgSelectOptionTemplate, { read: TemplateRef }]
|
|
3210
3163
|
}], optgroupTemplate: [{
|
|
3211
3164
|
type: ContentChild,
|
|
3212
|
-
args: [
|
|
3165
|
+
args: [NgSelectOptgroupTemplate, { read: TemplateRef }]
|
|
3213
3166
|
}], labelTemplate: [{
|
|
3214
3167
|
type: ContentChild,
|
|
3215
|
-
args: [
|
|
3168
|
+
args: [NgSelectLabelTemplate, { read: TemplateRef }]
|
|
3216
3169
|
}], multiLabelTemplate: [{
|
|
3217
3170
|
type: ContentChild,
|
|
3218
|
-
args: [
|
|
3219
|
-
}],
|
|
3171
|
+
args: [NgSelectMultiLabelTemplate, { read: TemplateRef }]
|
|
3172
|
+
}], panelHeaderTemplate: [{
|
|
3220
3173
|
type: ContentChild,
|
|
3221
|
-
args: [
|
|
3222
|
-
}],
|
|
3174
|
+
args: [NgSelectPanelHeaderTemplate, { read: TemplateRef }]
|
|
3175
|
+
}], panelFooterTemplate: [{
|
|
3223
3176
|
type: ContentChild,
|
|
3224
|
-
args: [
|
|
3177
|
+
args: [NgSelectPanelFooterTemplate, { read: TemplateRef }]
|
|
3225
3178
|
}], notFoundTemplate: [{
|
|
3226
3179
|
type: ContentChild,
|
|
3227
|
-
args: [
|
|
3180
|
+
args: [NgSelectNotFoundTemplate, { read: TemplateRef }]
|
|
3228
3181
|
}], placeholderTemplate: [{
|
|
3229
3182
|
type: ContentChild,
|
|
3230
|
-
args: [
|
|
3183
|
+
args: [NgSelectPlaceholderTemplate, { read: TemplateRef }]
|
|
3231
3184
|
}], typeToSearchTemplate: [{
|
|
3232
3185
|
type: ContentChild,
|
|
3233
|
-
args: [
|
|
3186
|
+
args: [NgSelectTypeToSearchTemplate, { read: TemplateRef }]
|
|
3234
3187
|
}], loadingTextTemplate: [{
|
|
3235
3188
|
type: ContentChild,
|
|
3236
|
-
args: [
|
|
3189
|
+
args: [NgSelectLoadingTextTemplate, { read: TemplateRef }]
|
|
3237
3190
|
}], tagTemplate: [{
|
|
3238
3191
|
type: ContentChild,
|
|
3239
|
-
args: [
|
|
3240
|
-
}],
|
|
3192
|
+
args: [NgSelectTagTemplate, { read: TemplateRef }]
|
|
3193
|
+
}], loadingTemplate: [{
|
|
3241
3194
|
type: ContentChild,
|
|
3242
|
-
args: [
|
|
3195
|
+
args: [NgSelectLoadingTemplate, { read: TemplateRef }]
|
|
3243
3196
|
}], clearButtonTemplate: [{
|
|
3244
3197
|
type: ContentChild,
|
|
3245
|
-
args: [
|
|
3198
|
+
args: [NgSelectClearButtonTemplate, { read: TemplateRef }]
|
|
3246
3199
|
}] } });
|
|
3247
3200
|
|
|
3248
3201
|
class NgSelectModule {
|
|
3249
3202
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3250
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: NgSelectModule, imports: [
|
|
3251
|
-
NgOption,
|
|
3203
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: NgSelectModule, imports: [NgSelectPanel,
|
|
3252
3204
|
NgSelect,
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3205
|
+
NgSelectOption,
|
|
3206
|
+
NgSelectOptgroupTemplate,
|
|
3207
|
+
NgSelectOptionTemplate,
|
|
3208
|
+
NgSelectLabelTemplate,
|
|
3209
|
+
NgSelectMultiLabelTemplate,
|
|
3210
|
+
NgSelectPanelHeaderTemplate,
|
|
3211
|
+
NgSelectPanelFooterTemplate,
|
|
3212
|
+
NgSelectPlaceholderTemplate,
|
|
3213
|
+
NgSelectClearButtonTemplate,
|
|
3214
|
+
NgSelectNotFoundTemplate,
|
|
3215
|
+
NgSelectTypeToSearchTemplate,
|
|
3216
|
+
NgSelectLoadingTextTemplate,
|
|
3217
|
+
NgSelectTagTemplate,
|
|
3218
|
+
NgSelectLoadingTemplate,
|
|
3219
|
+
NgSelectLabelRenderer], exports: [NgSelect,
|
|
3220
|
+
NgSelectOption,
|
|
3221
|
+
NgSelectOptgroupTemplate,
|
|
3222
|
+
NgSelectOptionTemplate,
|
|
3223
|
+
NgSelectLabelTemplate,
|
|
3224
|
+
NgSelectMultiLabelTemplate,
|
|
3225
|
+
NgSelectPanelHeaderTemplate,
|
|
3226
|
+
NgSelectPanelFooterTemplate,
|
|
3227
|
+
NgSelectPlaceholderTemplate,
|
|
3228
|
+
NgSelectClearButtonTemplate,
|
|
3229
|
+
NgSelectNotFoundTemplate,
|
|
3230
|
+
NgSelectTypeToSearchTemplate,
|
|
3231
|
+
NgSelectLoadingTextTemplate,
|
|
3232
|
+
NgSelectTagTemplate,
|
|
3233
|
+
NgSelectLoadingTemplate] });
|
|
3281
3234
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectModule, providers: [
|
|
3282
3235
|
{
|
|
3283
3236
|
provide: SELECTION_MODEL_FACTORY,
|
|
@@ -3289,40 +3242,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
3289
3242
|
type: NgModule,
|
|
3290
3243
|
args: [{
|
|
3291
3244
|
imports: [
|
|
3292
|
-
|
|
3293
|
-
NgOption,
|
|
3245
|
+
NgSelectPanel,
|
|
3294
3246
|
NgSelect,
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3247
|
+
NgSelectOption,
|
|
3248
|
+
NgSelectOptgroupTemplate,
|
|
3249
|
+
NgSelectOptionTemplate,
|
|
3250
|
+
NgSelectLabelTemplate,
|
|
3251
|
+
NgSelectMultiLabelTemplate,
|
|
3252
|
+
NgSelectPanelHeaderTemplate,
|
|
3253
|
+
NgSelectPanelFooterTemplate,
|
|
3254
|
+
NgSelectPlaceholderTemplate,
|
|
3255
|
+
NgSelectClearButtonTemplate,
|
|
3256
|
+
NgSelectNotFoundTemplate,
|
|
3257
|
+
NgSelectTypeToSearchTemplate,
|
|
3258
|
+
NgSelectLoadingTextTemplate,
|
|
3259
|
+
NgSelectTagTemplate,
|
|
3260
|
+
NgSelectLoadingTemplate,
|
|
3261
|
+
NgSelectLabelRenderer,
|
|
3309
3262
|
],
|
|
3310
3263
|
exports: [
|
|
3311
3264
|
NgSelect,
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3265
|
+
NgSelectOption,
|
|
3266
|
+
NgSelectOptgroupTemplate,
|
|
3267
|
+
NgSelectOptionTemplate,
|
|
3268
|
+
NgSelectLabelTemplate,
|
|
3269
|
+
NgSelectMultiLabelTemplate,
|
|
3270
|
+
NgSelectPanelHeaderTemplate,
|
|
3271
|
+
NgSelectPanelFooterTemplate,
|
|
3272
|
+
NgSelectPlaceholderTemplate,
|
|
3273
|
+
NgSelectClearButtonTemplate,
|
|
3274
|
+
NgSelectNotFoundTemplate,
|
|
3275
|
+
NgSelectTypeToSearchTemplate,
|
|
3276
|
+
NgSelectLoadingTextTemplate,
|
|
3277
|
+
NgSelectTagTemplate,
|
|
3278
|
+
NgSelectLoadingTemplate,
|
|
3326
3279
|
],
|
|
3327
3280
|
providers: [
|
|
3328
3281
|
{
|
|
@@ -3333,6 +3286,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
3333
3286
|
}]
|
|
3334
3287
|
}] });
|
|
3335
3288
|
|
|
3289
|
+
class NgSelectOptionHighlight {
|
|
3290
|
+
term = '';
|
|
3291
|
+
elementRef = inject(ElementRef);
|
|
3292
|
+
renderer = inject(Renderer2);
|
|
3293
|
+
element = this.elementRef.nativeElement;
|
|
3294
|
+
label = '';
|
|
3295
|
+
get _canHighlight() {
|
|
3296
|
+
return this.term && this.label;
|
|
3297
|
+
}
|
|
3298
|
+
ngOnChanges() {
|
|
3299
|
+
if (this._canHighlight) {
|
|
3300
|
+
this._highlightLabel();
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
ngAfterViewInit() {
|
|
3304
|
+
this.label = this.element.innerHTML;
|
|
3305
|
+
if (this._canHighlight) {
|
|
3306
|
+
this._highlightLabel();
|
|
3307
|
+
}
|
|
3308
|
+
}
|
|
3309
|
+
_escapeRegExp(str) {
|
|
3310
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
3311
|
+
}
|
|
3312
|
+
_highlightLabel() {
|
|
3313
|
+
const label = this.label;
|
|
3314
|
+
if (!this.term) {
|
|
3315
|
+
this._setInnerHtml(label);
|
|
3316
|
+
return;
|
|
3317
|
+
}
|
|
3318
|
+
const alternationString = this._escapeRegExp(this.term).replace(' ', '|');
|
|
3319
|
+
const termRegex = new RegExp(alternationString, 'gi');
|
|
3320
|
+
this._setInnerHtml(label.replace(termRegex, `<span class="ng-select-option-highlighted">$&</span>`));
|
|
3321
|
+
}
|
|
3322
|
+
_setInnerHtml(html) {
|
|
3323
|
+
this.renderer.setProperty(this.elementRef.nativeElement, 'innerHTML', html);
|
|
3324
|
+
}
|
|
3325
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOptionHighlight, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3326
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectOptionHighlight, isStandalone: true, selector: "[ngOptionHighlight]", inputs: { term: ["ngOptionHighlight", "term"] }, usesOnChanges: true, ngImport: i0 });
|
|
3327
|
+
}
|
|
3328
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOptionHighlight, decorators: [{
|
|
3329
|
+
type: Directive,
|
|
3330
|
+
args: [{
|
|
3331
|
+
selector: '[ngOptionHighlight]',
|
|
3332
|
+
}]
|
|
3333
|
+
}], propDecorators: { term: [{
|
|
3334
|
+
type: Input,
|
|
3335
|
+
args: ['ngOptionHighlight']
|
|
3336
|
+
}] } });
|
|
3337
|
+
|
|
3336
3338
|
/*
|
|
3337
3339
|
* Public API Surface of ng-select
|
|
3338
3340
|
*/
|
|
@@ -3341,5 +3343,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
3341
3343
|
* Generated bundle index. Do not edit.
|
|
3342
3344
|
*/
|
|
3343
3345
|
|
|
3344
|
-
export { DefaultSelectionModel, DefaultSelectionModelFactory,
|
|
3346
|
+
export { DefaultSelectionModel, DefaultSelectionModelFactory, NgSelect, NgSelectClearButtonTemplate, NgSelectConfig, NgSelectLabelRenderer, NgSelectLabelTemplate, NgSelectLoadingTemplate, NgSelectLoadingTextTemplate, NgSelectModule, NgSelectMultiLabelTemplate, NgSelectNotFoundTemplate, NgSelectOptgroupTemplate, NgSelectOption, NgSelectOptionHighlight, NgSelectOptionTemplate, NgSelectPanel, NgSelectPanelFooterTemplate, NgSelectPanelHeaderTemplate, NgSelectPanelUtils, NgSelectPlaceholderTemplate, NgSelectTagTemplate, NgSelectTypeToSearchTemplate, SELECTION_MODEL_FACTORY };
|
|
3345
3347
|
//# sourceMappingURL=ng-matero-ng-select.mjs.map
|