@skyux/lookup 5.5.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/skyux-lookup.umd.js +850 -849
- package/documentation.json +194 -194
- package/esm2015/lib/modules/autocomplete/autocomplete-adapter.service.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/autocomplete-default-search-function.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/autocomplete-input.directive.js +2 -2
- package/esm2015/lib/modules/autocomplete/autocomplete-input.directive.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/autocomplete-search-async-disabled.pipe.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/autocomplete.component.js +3 -3
- package/esm2015/lib/modules/autocomplete/autocomplete.component.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/autocomplete.module.js +1 -1
- package/esm2015/lib/modules/autocomplete/autocomplete.module.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-args.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-function.js.map +1 -1
- package/esm2015/lib/modules/country-field/country-field.component.js +7 -7
- package/esm2015/lib/modules/country-field/country-field.component.js.map +1 -1
- package/esm2015/lib/modules/country-field/country-field.module.js +1 -1
- package/esm2015/lib/modules/country-field/country-field.module.js.map +1 -1
- package/esm2015/lib/modules/lookup/lookup-autocomplete-adapter.js.map +1 -1
- package/esm2015/lib/modules/lookup/lookup-show-more-async-modal.component.js.map +1 -1
- package/esm2015/lib/modules/lookup/lookup-show-more-modal.component.js +6 -6
- package/esm2015/lib/modules/lookup/lookup-show-more-modal.component.js.map +1 -1
- package/esm2015/lib/modules/lookup/lookup.component.js +11 -10
- package/esm2015/lib/modules/lookup/lookup.component.js.map +1 -1
- package/esm2015/lib/modules/lookup/lookup.module.js +4 -4
- package/esm2015/lib/modules/lookup/lookup.module.js.map +1 -1
- package/esm2015/lib/modules/lookup/types/lookup-show-more-config.js.map +1 -1
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-async-context.js.map +1 -1
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-context.js.map +1 -1
- package/esm2015/lib/modules/search/search-adapter.service.js +3 -3
- package/esm2015/lib/modules/search/search-adapter.service.js.map +1 -1
- package/esm2015/lib/modules/search/search.component.js +2 -2
- package/esm2015/lib/modules/search/search.component.js.map +1 -1
- package/esm2015/lib/modules/search/search.module.js +1 -1
- package/esm2015/lib/modules/search/search.module.js.map +1 -1
- package/esm2015/lib/modules/shared/sky-lookup-resources.module.js +1 -1
- package/esm2015/lib/modules/shared/sky-lookup-resources.module.js.map +1 -1
- package/esm2015/testing/country-field/country-field-fixture.js.map +1 -1
- package/esm2015/testing/country-field/country-field-testing.module.js.map +1 -1
- package/esm2015/testing/search/search-fixture.js.map +1 -1
- package/esm2015/testing/search/search-testing.module.js.map +1 -1
- package/fesm2015/skyux-lookup-testing.js.map +1 -1
- package/fesm2015/skyux-lookup.js +582 -581
- package/fesm2015/skyux-lookup.js.map +1 -1
- package/lib/modules/autocomplete/autocomplete-default-search-function.d.ts +1 -1
- package/lib/modules/autocomplete/autocomplete.component.d.ts +2 -2
- package/lib/modules/autocomplete/types/autocomplete-search-async-args.d.ts +1 -1
- package/lib/modules/country-field/country-field.component.d.ts +2 -2
- package/lib/modules/lookup/lookup.component.d.ts +3 -3
- package/lib/modules/search/search.component.d.ts +1 -1
- package/package.json +9 -9
package/fesm2015/skyux-lookup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i6$1 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { NgModule,
|
|
4
|
+
import { NgModule, forwardRef, Directive, Input, Pipe, Injectable, EventEmitter, TemplateRef, ElementRef, Component, ChangeDetectionStrategy, Optional, Output, ViewChild, ContentChild, ViewEncapsulation, Self } from '@angular/core';
|
|
5
5
|
import * as i8 from '@angular/forms';
|
|
6
6
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule, FormControl, NgModel, NgControl, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import * as i1 from '@skyux/core';
|
|
@@ -12,12 +12,12 @@ import * as i7 from '@skyux/theme';
|
|
|
12
12
|
import { SkyThemeModule } from '@skyux/theme';
|
|
13
13
|
import * as i5 from '@skyux/i18n';
|
|
14
14
|
import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
|
|
15
|
-
import * as i6 from '@skyux/forms';
|
|
16
|
-
import { SkyInputBoxModule, SkyCheckboxModule } from '@skyux/forms';
|
|
17
15
|
import { Subject, fromEvent, of, from } from 'rxjs';
|
|
18
16
|
import { takeUntil, debounceTime, switchMap, take, map, distinctUntilChanged } from 'rxjs/operators';
|
|
17
|
+
import * as i6 from '@skyux/forms';
|
|
18
|
+
import { SkyInputBoxModule, SkyCheckboxModule } from '@skyux/forms';
|
|
19
19
|
import 'intl-tel-input';
|
|
20
|
-
import * as
|
|
20
|
+
import * as i4$1 from '@skyux/layout';
|
|
21
21
|
import { SkyToolbarModule } from '@skyux/layout';
|
|
22
22
|
import * as i7$1 from '@skyux/lists';
|
|
23
23
|
import { SkyInfiniteScrollModule, SkyRepeaterModule } from '@skyux/lists';
|
|
@@ -94,154 +94,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
94
94
|
}]
|
|
95
95
|
}] });
|
|
96
96
|
|
|
97
|
-
/**
|
|
98
|
-
* @internal
|
|
99
|
-
*/
|
|
100
|
-
var SkyAutocompleteMessageType;
|
|
101
|
-
(function (SkyAutocompleteMessageType) {
|
|
102
|
-
/**
|
|
103
|
-
* Closes the dropdown.
|
|
104
|
-
*/
|
|
105
|
-
SkyAutocompleteMessageType[SkyAutocompleteMessageType["CloseDropdown"] = 0] = "CloseDropdown";
|
|
106
|
-
/**
|
|
107
|
-
* Repositions the dropdown.
|
|
108
|
-
*/
|
|
109
|
-
SkyAutocompleteMessageType[SkyAutocompleteMessageType["RepositionDropdown"] = 1] = "RepositionDropdown";
|
|
110
|
-
})(SkyAutocompleteMessageType || (SkyAutocompleteMessageType = {}));
|
|
111
|
-
|
|
112
|
-
// tslint:disable:no-null-keyword
|
|
113
|
-
/* istanbul ignore file */
|
|
114
|
-
// Polyfill for Element.closest().
|
|
115
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
|
|
116
|
-
// Returns the closest ancestor of the current element (or the current element itself) which
|
|
117
|
-
// matches the selectors given in parameter. If there isn't such an ancestor, it returns null.
|
|
118
|
-
if (!Element.prototype.closest) {
|
|
119
|
-
Element.prototype.closest = function (s) {
|
|
120
|
-
let el = this;
|
|
121
|
-
if (!document.documentElement.contains(el)) {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
do {
|
|
125
|
-
if (el.matches(s)) {
|
|
126
|
-
return el;
|
|
127
|
-
}
|
|
128
|
-
el = el.parentElement || el.parentNode;
|
|
129
|
-
} while (el !== null && el.nodeType === 1);
|
|
130
|
-
return null;
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
// Polyfill for Element.matches().
|
|
134
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
135
|
-
// Returns true if the element would be selected by the specified selector string.
|
|
136
|
-
if (!Element.prototype.matches) {
|
|
137
|
-
Element.prototype.matches =
|
|
138
|
-
Element.prototype.msMatchesSelector ||
|
|
139
|
-
/* istanbul ignore next */ Element.prototype.webkitMatchesSelector;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* @internal
|
|
144
|
-
*/
|
|
145
|
-
class SkyAutocompleteAdapterService {
|
|
146
|
-
constructor(coreAdapterService, rendererFactory) {
|
|
147
|
-
this.coreAdapterService = coreAdapterService;
|
|
148
|
-
this.rendererFactory = rendererFactory;
|
|
149
|
-
this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Adds the className for the provided element.
|
|
153
|
-
*/
|
|
154
|
-
addCSSClass(element, className) {
|
|
155
|
-
/* Sanity check */
|
|
156
|
-
/* istanbul ignore else */
|
|
157
|
-
if (element) {
|
|
158
|
-
this.renderer.addClass(element, className);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
getOverlayFocusableElements(overlay) {
|
|
162
|
-
return this.coreAdapterService.getFocusableChildren(
|
|
163
|
-
/* Sanity check - calling function also has null check */
|
|
164
|
-
/* istanbul ignore next */
|
|
165
|
-
overlay === null || overlay === void 0 ? void 0 : overlay.componentRef.location.nativeElement, { ignoreTabIndex: true });
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Removes the className for the provided element.
|
|
169
|
-
*/
|
|
170
|
-
removeCSSClass(element, className) {
|
|
171
|
-
/* Sanity check */
|
|
172
|
-
/* istanbul ignore else */
|
|
173
|
-
if (element) {
|
|
174
|
-
this.renderer.removeClass(element, className);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
setDropdownWidth(elementRef, dropdownRef, isInputBox) {
|
|
178
|
-
const parentElement = isInputBox
|
|
179
|
-
? elementRef.nativeElement.closest('.sky-input-box')
|
|
180
|
-
: elementRef.nativeElement;
|
|
181
|
-
if (parentElement) {
|
|
182
|
-
const width = parentElement.getBoundingClientRect().width;
|
|
183
|
-
this.renderer.setStyle(dropdownRef.nativeElement, 'width', `${width}px`);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Sets the `tabIndex` of the `element` to the provided `tabIndex`.
|
|
188
|
-
*/
|
|
189
|
-
setTabIndex(element, tabIndex) {
|
|
190
|
-
element.tabIndex = tabIndex;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
SkyAutocompleteAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyAutocompleteAdapterService, deps: [{ token: i1.SkyCoreAdapterService }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
194
|
-
SkyAutocompleteAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyAutocompleteAdapterService });
|
|
195
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyAutocompleteAdapterService, decorators: [{
|
|
196
|
-
type: Injectable
|
|
197
|
-
}], ctorParameters: function () { return [{ type: i1.SkyCoreAdapterService }, { type: i0.RendererFactory2 }]; } });
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Removes diacritical characters from strings and replaces them with their normalized equivalent.
|
|
201
|
-
* For example: è becomes e, Å becomes A.
|
|
202
|
-
*/
|
|
203
|
-
function normalizeDiacritics(value) {
|
|
204
|
-
return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function skyAutocompleteDefaultSearchFunction(options) {
|
|
208
|
-
const filterData = function (searchText, data) {
|
|
209
|
-
return data.filter((item) => {
|
|
210
|
-
if (!options.searchFilters || !options.searchFilters.length) {
|
|
211
|
-
return true;
|
|
212
|
-
}
|
|
213
|
-
// Find the first failing filter (we can skip the others if one fails).
|
|
214
|
-
const failedFilter = options.searchFilters.find((filter) => {
|
|
215
|
-
return !filter.call({}, searchText, item);
|
|
216
|
-
});
|
|
217
|
-
return failedFilter === undefined;
|
|
218
|
-
});
|
|
219
|
-
};
|
|
220
|
-
const search = function (searchText, data) {
|
|
221
|
-
const results = [];
|
|
222
|
-
/* Sanity check - autocomplete will not call search with empty search text */
|
|
223
|
-
/* istanbul ignore if */
|
|
224
|
-
if (!searchText) {
|
|
225
|
-
return results;
|
|
226
|
-
}
|
|
227
|
-
const searchTextNormalized = normalizeDiacritics(searchText).toUpperCase();
|
|
228
|
-
const filteredData = filterData(searchText, data);
|
|
229
|
-
for (let i = 0, n = filteredData.length; i < n; i++) {
|
|
230
|
-
const result = filteredData[i];
|
|
231
|
-
const isMatch = options.propertiesToSearch.find((property) => {
|
|
232
|
-
let value = (result[property] || '').toString();
|
|
233
|
-
value = normalizeDiacritics(value).toUpperCase();
|
|
234
|
-
return value.indexOf(searchTextNormalized) > -1;
|
|
235
|
-
});
|
|
236
|
-
if (isMatch) {
|
|
237
|
-
results.push(result);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return results;
|
|
241
|
-
};
|
|
242
|
-
return search;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
97
|
// tslint:disable:no-forward-ref no-use-before-declare
|
|
246
98
|
const SKY_AUTOCOMPLETE_VALUE_ACCESSOR = {
|
|
247
99
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -474,65 +326,213 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
474
326
|
}]
|
|
475
327
|
}] });
|
|
476
328
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
this.
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
* These are typically the search results and action buttons, but could also be
|
|
524
|
-
* elements provided in the consumer's own template.
|
|
525
|
-
*/
|
|
526
|
-
this.overlayFocusableElements = [];
|
|
527
|
-
this._selectionChange = new EventEmitter();
|
|
528
|
-
const id = ++uniqueId$1;
|
|
529
|
-
this.resultsListId = `sky-autocomplete-list-${id}`;
|
|
530
|
-
this.resultsWrapperId = `sky-autocomplete-wrapper-${id}`;
|
|
329
|
+
/**
|
|
330
|
+
* Removes diacritical characters from strings and replaces them with their normalized equivalent.
|
|
331
|
+
* For example: è becomes e, Å becomes A.
|
|
332
|
+
*/
|
|
333
|
+
function normalizeDiacritics(value) {
|
|
334
|
+
return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// tslint:disable:no-null-keyword
|
|
338
|
+
/* istanbul ignore file */
|
|
339
|
+
// Polyfill for Element.closest().
|
|
340
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
|
|
341
|
+
// Returns the closest ancestor of the current element (or the current element itself) which
|
|
342
|
+
// matches the selectors given in parameter. If there isn't such an ancestor, it returns null.
|
|
343
|
+
if (!Element.prototype.closest) {
|
|
344
|
+
Element.prototype.closest = function (s) {
|
|
345
|
+
let el = this;
|
|
346
|
+
if (!document.documentElement.contains(el)) {
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
do {
|
|
350
|
+
if (el.matches(s)) {
|
|
351
|
+
return el;
|
|
352
|
+
}
|
|
353
|
+
el = el.parentElement || el.parentNode;
|
|
354
|
+
} while (el !== null && el.nodeType === 1);
|
|
355
|
+
return null;
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
// Polyfill for Element.matches().
|
|
359
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
360
|
+
// Returns true if the element would be selected by the specified selector string.
|
|
361
|
+
if (!Element.prototype.matches) {
|
|
362
|
+
Element.prototype.matches =
|
|
363
|
+
Element.prototype.msMatchesSelector ||
|
|
364
|
+
/* istanbul ignore next */ Element.prototype.webkitMatchesSelector;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* @internal
|
|
369
|
+
*/
|
|
370
|
+
class SkyAutocompleteAdapterService {
|
|
371
|
+
constructor(coreAdapterService, rendererFactory) {
|
|
372
|
+
this.coreAdapterService = coreAdapterService;
|
|
373
|
+
this.rendererFactory = rendererFactory;
|
|
374
|
+
this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
|
|
531
375
|
}
|
|
532
376
|
/**
|
|
533
|
-
*
|
|
534
|
-
|
|
535
|
-
|
|
377
|
+
* Adds the className for the provided element.
|
|
378
|
+
*/
|
|
379
|
+
addCSSClass(element, className) {
|
|
380
|
+
/* Sanity check */
|
|
381
|
+
/* istanbul ignore else */
|
|
382
|
+
if (element) {
|
|
383
|
+
this.renderer.addClass(element, className);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
getOverlayFocusableElements(overlay) {
|
|
387
|
+
return this.coreAdapterService.getFocusableChildren(
|
|
388
|
+
/* Sanity check - calling function also has null check */
|
|
389
|
+
/* istanbul ignore next */
|
|
390
|
+
overlay === null || overlay === void 0 ? void 0 : overlay.componentRef.location.nativeElement, { ignoreTabIndex: true });
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Removes the className for the provided element.
|
|
394
|
+
*/
|
|
395
|
+
removeCSSClass(element, className) {
|
|
396
|
+
/* Sanity check */
|
|
397
|
+
/* istanbul ignore else */
|
|
398
|
+
if (element) {
|
|
399
|
+
this.renderer.removeClass(element, className);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
setDropdownWidth(elementRef, dropdownRef, isInputBox) {
|
|
403
|
+
const parentElement = isInputBox
|
|
404
|
+
? elementRef.nativeElement.closest('.sky-input-box')
|
|
405
|
+
: elementRef.nativeElement;
|
|
406
|
+
if (parentElement) {
|
|
407
|
+
const width = parentElement.getBoundingClientRect().width;
|
|
408
|
+
this.renderer.setStyle(dropdownRef.nativeElement, 'width', `${width}px`);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Sets the `tabIndex` of the `element` to the provided `tabIndex`.
|
|
413
|
+
*/
|
|
414
|
+
setTabIndex(element, tabIndex) {
|
|
415
|
+
element.tabIndex = tabIndex;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
SkyAutocompleteAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyAutocompleteAdapterService, deps: [{ token: i1.SkyCoreAdapterService }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
419
|
+
SkyAutocompleteAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyAutocompleteAdapterService });
|
|
420
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyAutocompleteAdapterService, decorators: [{
|
|
421
|
+
type: Injectable
|
|
422
|
+
}], ctorParameters: function () { return [{ type: i1.SkyCoreAdapterService }, { type: i0.RendererFactory2 }]; } });
|
|
423
|
+
|
|
424
|
+
function skyAutocompleteDefaultSearchFunction(options) {
|
|
425
|
+
const filterData = function (searchText, data) {
|
|
426
|
+
return data.filter((item) => {
|
|
427
|
+
if (!options.searchFilters || !options.searchFilters.length) {
|
|
428
|
+
return true;
|
|
429
|
+
}
|
|
430
|
+
// Find the first failing filter (we can skip the others if one fails).
|
|
431
|
+
const failedFilter = options.searchFilters.find((filter) => {
|
|
432
|
+
return !filter.call({}, searchText, item);
|
|
433
|
+
});
|
|
434
|
+
return failedFilter === undefined;
|
|
435
|
+
});
|
|
436
|
+
};
|
|
437
|
+
const search = function (searchText, data) {
|
|
438
|
+
const results = [];
|
|
439
|
+
/* Sanity check - autocomplete will not call search with empty search text */
|
|
440
|
+
/* istanbul ignore if */
|
|
441
|
+
if (!searchText) {
|
|
442
|
+
return results;
|
|
443
|
+
}
|
|
444
|
+
const searchTextNormalized = normalizeDiacritics(searchText).toUpperCase();
|
|
445
|
+
const filteredData = filterData(searchText, data);
|
|
446
|
+
for (let i = 0, n = filteredData.length; i < n; i++) {
|
|
447
|
+
const result = filteredData[i];
|
|
448
|
+
const isMatch = options.propertiesToSearch.find((property) => {
|
|
449
|
+
let value = (result[property] || '').toString();
|
|
450
|
+
value = normalizeDiacritics(value).toUpperCase();
|
|
451
|
+
return value.indexOf(searchTextNormalized) > -1;
|
|
452
|
+
});
|
|
453
|
+
if (isMatch) {
|
|
454
|
+
results.push(result);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return results;
|
|
458
|
+
};
|
|
459
|
+
return search;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* @internal
|
|
464
|
+
*/
|
|
465
|
+
var SkyAutocompleteMessageType;
|
|
466
|
+
(function (SkyAutocompleteMessageType) {
|
|
467
|
+
/**
|
|
468
|
+
* Closes the dropdown.
|
|
469
|
+
*/
|
|
470
|
+
SkyAutocompleteMessageType[SkyAutocompleteMessageType["CloseDropdown"] = 0] = "CloseDropdown";
|
|
471
|
+
/**
|
|
472
|
+
* Repositions the dropdown.
|
|
473
|
+
*/
|
|
474
|
+
SkyAutocompleteMessageType[SkyAutocompleteMessageType["RepositionDropdown"] = 1] = "RepositionDropdown";
|
|
475
|
+
})(SkyAutocompleteMessageType || (SkyAutocompleteMessageType = {}));
|
|
476
|
+
|
|
477
|
+
let uniqueId$1 = 0;
|
|
478
|
+
class SkyAutocompleteComponent {
|
|
479
|
+
constructor(changeDetector, elementRef, affixService, adapterService, overlayService, inputBoxHostSvc) {
|
|
480
|
+
this.changeDetector = changeDetector;
|
|
481
|
+
this.elementRef = elementRef;
|
|
482
|
+
this.affixService = affixService;
|
|
483
|
+
this.adapterService = adapterService;
|
|
484
|
+
this.overlayService = overlayService;
|
|
485
|
+
this.inputBoxHostSvc = inputBoxHostSvc;
|
|
486
|
+
/**
|
|
487
|
+
* @internal
|
|
488
|
+
* Indicates whether to display a button in the dropdown that opens a picker where users can view all options.
|
|
489
|
+
*/
|
|
490
|
+
this.enableShowMore = false;
|
|
491
|
+
/**
|
|
492
|
+
* @internal
|
|
493
|
+
* Indicates whether to display a button that lets users add options to the data source.
|
|
494
|
+
*/
|
|
495
|
+
this.showAddButton = false;
|
|
496
|
+
/**
|
|
497
|
+
* @internal
|
|
498
|
+
* Allows async search to be disabled even when a listener is specified for
|
|
499
|
+
* the `searchAsync` output.
|
|
500
|
+
*/
|
|
501
|
+
this.searchAsyncDisabled = false;
|
|
502
|
+
/**
|
|
503
|
+
* @internal
|
|
504
|
+
* Fires when users select the button to add options to the data source.
|
|
505
|
+
*/
|
|
506
|
+
this.addClick = new EventEmitter();
|
|
507
|
+
/**
|
|
508
|
+
* @internal
|
|
509
|
+
* Fires when users select the button to view all options.
|
|
510
|
+
*/
|
|
511
|
+
this.showMoreClick = new EventEmitter();
|
|
512
|
+
this.searchAsync = new EventEmitter();
|
|
513
|
+
this.isOpen = false;
|
|
514
|
+
this.isSearchingAsync = false;
|
|
515
|
+
/**
|
|
516
|
+
* Index that indicates which descendant of the overlay currently has focus.
|
|
517
|
+
*/
|
|
518
|
+
this.activeElementIndex = -1;
|
|
519
|
+
this.inputDirectiveUnsubscribe = new Subject();
|
|
520
|
+
this.ngUnsubscribe = new Subject();
|
|
521
|
+
/**
|
|
522
|
+
* Elements within the autocomplete dropdown that are focusable.
|
|
523
|
+
* These are typically the search results and action buttons, but could also be
|
|
524
|
+
* elements provided in the consumer's own template.
|
|
525
|
+
*/
|
|
526
|
+
this.overlayFocusableElements = [];
|
|
527
|
+
this._selectionChange = new EventEmitter();
|
|
528
|
+
const id = ++uniqueId$1;
|
|
529
|
+
this.resultsListId = `sky-autocomplete-list-${id}`;
|
|
530
|
+
this.resultsWrapperId = `sky-autocomplete-wrapper-${id}`;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Specifies a static data source for the autocomplete component to search
|
|
534
|
+
* when users enter text. For a dynamic data source such as an array that
|
|
535
|
+
* changes due to server calls, use the `search` property instead.
|
|
536
536
|
*/
|
|
537
537
|
set data(value) {
|
|
538
538
|
this._data = value;
|
|
@@ -1338,7 +1338,7 @@ class SkyCountryFieldComponent {
|
|
|
1338
1338
|
set selectedCountry(newCountry) {
|
|
1339
1339
|
if (!this.countriesAreEqual(this.selectedCountry, newCountry)) {
|
|
1340
1340
|
if (newCountry && newCountry.iso2) {
|
|
1341
|
-
|
|
1341
|
+
const isoCountry = this.countries.find((country) => country.iso2 === newCountry.iso2);
|
|
1342
1342
|
if (isoCountry) {
|
|
1343
1343
|
newCountry = isoCountry;
|
|
1344
1344
|
}
|
|
@@ -1518,7 +1518,7 @@ class SkyCountryFieldComponent {
|
|
|
1518
1518
|
// Ignoring coverage here as this will be removed in the next release.
|
|
1519
1519
|
// istanbul ignore next
|
|
1520
1520
|
if (!this.includePhoneInfo && !this.hideSelectedCountryFlag) {
|
|
1521
|
-
if ((_b = (_a =
|
|
1521
|
+
if ((_b = (_a = this.elRef.nativeElement.parentElement) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.contains('sky-phone-field-country-search')) {
|
|
1522
1522
|
this.includePhoneInfo = true;
|
|
1523
1523
|
this.hideSelectedCountryFlag = true;
|
|
1524
1524
|
}
|
|
@@ -1545,7 +1545,7 @@ class SkyCountryFieldComponent {
|
|
|
1545
1545
|
sortCountriesWithSelectedAndDefault(selectedCountry) {
|
|
1546
1546
|
let selectedCountryIndex;
|
|
1547
1547
|
let selectedCountryData;
|
|
1548
|
-
|
|
1548
|
+
const sortedNewCountries = this.countries.sort((a, b) => {
|
|
1549
1549
|
if (((this.defaultCountryData &&
|
|
1550
1550
|
this.countriesEqual(a, this.defaultCountryData)) ||
|
|
1551
1551
|
a.name < b.name) &&
|
|
@@ -1665,101 +1665,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1665
1665
|
}]
|
|
1666
1666
|
}] });
|
|
1667
1667
|
|
|
1668
|
-
/**
|
|
1669
|
-
* @internal
|
|
1670
|
-
*/
|
|
1671
|
-
class SkyLookupAutocompleteAdapter {
|
|
1672
|
-
constructor() {
|
|
1673
|
-
this.searchAsync = new EventEmitter();
|
|
1674
|
-
}
|
|
1675
|
-
/**
|
|
1676
|
-
* Specifies an object property to display in the text input after users
|
|
1677
|
-
* select an item in the dropdown list.
|
|
1678
|
-
* @default "name"
|
|
1679
|
-
*/
|
|
1680
|
-
set descriptorProperty(value) {
|
|
1681
|
-
this._descriptorProperty = value;
|
|
1682
|
-
}
|
|
1683
|
-
get descriptorProperty() {
|
|
1684
|
-
return this._descriptorProperty || 'name';
|
|
1685
|
-
}
|
|
1686
|
-
/**
|
|
1687
|
-
* Specifies an array of object properties to search.
|
|
1688
|
-
* @default ["name"]
|
|
1689
|
-
*/
|
|
1690
|
-
set propertiesToSearch(value) {
|
|
1691
|
-
this._propertiesToSearch = value;
|
|
1692
|
-
}
|
|
1693
|
-
get propertiesToSearch() {
|
|
1694
|
-
return this._propertiesToSearch || ['name'];
|
|
1695
|
-
}
|
|
1696
|
-
/**
|
|
1697
|
-
* Specifies a function to dynamically manage the data source when users
|
|
1698
|
-
* change the text in the lookup field. The search function must return
|
|
1699
|
-
* an array or a promise of an array. The `search` property is particularly
|
|
1700
|
-
* useful when the data source does not live in the source code.
|
|
1701
|
-
*/
|
|
1702
|
-
set search(value) {
|
|
1703
|
-
this._search = value;
|
|
1704
|
-
}
|
|
1705
|
-
get search() {
|
|
1706
|
-
return (this._search ||
|
|
1707
|
-
skyAutocompleteDefaultSearchFunction({
|
|
1708
|
-
propertiesToSearch: this.propertiesToSearch,
|
|
1709
|
-
searchFilters: this.searchFilters,
|
|
1710
|
-
}));
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
SkyLookupAutocompleteAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAutocompleteAdapter, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1714
|
-
SkyLookupAutocompleteAdapter.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyLookupAutocompleteAdapter, inputs: { debounceTime: "debounceTime", descriptorProperty: "descriptorProperty", propertiesToSearch: "propertiesToSearch", search: "search", searchResultTemplate: "searchResultTemplate", searchTextMinimumCharacters: "searchTextMinimumCharacters", searchFilters: "searchFilters", searchResultsLimit: "searchResultsLimit" }, outputs: { searchAsync: "searchAsync" }, ngImport: i0 });
|
|
1715
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAutocompleteAdapter, decorators: [{
|
|
1716
|
-
type: Directive
|
|
1717
|
-
}], propDecorators: { debounceTime: [{
|
|
1718
|
-
type: Input
|
|
1719
|
-
}], descriptorProperty: [{
|
|
1720
|
-
type: Input
|
|
1721
|
-
}], propertiesToSearch: [{
|
|
1722
|
-
type: Input
|
|
1723
|
-
}], search: [{
|
|
1724
|
-
type: Input
|
|
1725
|
-
}], searchResultTemplate: [{
|
|
1726
|
-
type: Input
|
|
1727
|
-
}], searchTextMinimumCharacters: [{
|
|
1728
|
-
type: Input
|
|
1729
|
-
}], searchFilters: [{
|
|
1730
|
-
type: Input
|
|
1731
|
-
}], searchResultsLimit: [{
|
|
1732
|
-
type: Input
|
|
1733
|
-
}], searchAsync: [{
|
|
1734
|
-
type: Output
|
|
1735
|
-
}] } });
|
|
1736
|
-
|
|
1737
|
-
/**
|
|
1738
|
-
* @internal
|
|
1739
|
-
*/
|
|
1740
|
-
class SkyLookupAdapterService {
|
|
1741
|
-
focusInput(elRef) {
|
|
1742
|
-
const inputEl = elRef.nativeElement.querySelector('.sky-lookup-input');
|
|
1743
|
-
/* Sanity check */
|
|
1744
|
-
/* istanbul ignore else */
|
|
1745
|
-
if (inputEl) {
|
|
1746
|
-
inputEl.focus();
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
SkyLookupAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1751
|
-
SkyLookupAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAdapterService });
|
|
1752
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAdapterService, decorators: [{
|
|
1753
|
-
type: Injectable
|
|
1754
|
-
}] });
|
|
1755
|
-
|
|
1756
|
-
/**
|
|
1757
|
-
* @internal
|
|
1758
|
-
* Context for the show more native picker. These values are provided by the lookup component.
|
|
1759
|
-
*/
|
|
1760
|
-
class SkyLookupShowMoreNativePickerContext {
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
1668
|
/**
|
|
1764
1669
|
* @internal
|
|
1765
1670
|
*/
|
|
@@ -1774,9 +1679,9 @@ class SkySearchAdapterService {
|
|
|
1774
1679
|
this.getInputEl(searchEl).focus();
|
|
1775
1680
|
}
|
|
1776
1681
|
startInputAnimation(searchEl) {
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1682
|
+
const buttonWidth = this.getSearchOpenButtonEl(searchEl).clientWidth;
|
|
1683
|
+
const offsetWidth = this.getSearchContainerEl(searchEl).offsetLeft;
|
|
1684
|
+
const minWidth = buttonWidth + offsetWidth;
|
|
1780
1685
|
this.getInputContainerEl(searchEl).style.minWidth =
|
|
1781
1686
|
minWidth.toString() + 'px';
|
|
1782
1687
|
this.renderer.setStyle(this.getInputContainerEl(searchEl), 'min-width', minWidth.toString() + 'px');
|
|
@@ -2048,9 +1953,241 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
2048
1953
|
type: Input
|
|
2049
1954
|
}] } });
|
|
2050
1955
|
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
1956
|
+
class SkySearchModule {
|
|
1957
|
+
}
|
|
1958
|
+
SkySearchModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1959
|
+
SkySearchModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, declarations: [SkySearchComponent], imports: [CommonModule,
|
|
1960
|
+
SkyInputBoxModule,
|
|
1961
|
+
SkyLookupResourcesModule,
|
|
1962
|
+
FormsModule,
|
|
1963
|
+
SkyIconModule,
|
|
1964
|
+
SkyThemeModule,
|
|
1965
|
+
SkyIdModule], exports: [SkySearchComponent] });
|
|
1966
|
+
SkySearchModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, imports: [[
|
|
1967
|
+
CommonModule,
|
|
1968
|
+
SkyInputBoxModule,
|
|
1969
|
+
SkyLookupResourcesModule,
|
|
1970
|
+
FormsModule,
|
|
1971
|
+
SkyIconModule,
|
|
1972
|
+
SkyThemeModule,
|
|
1973
|
+
SkyIdModule,
|
|
1974
|
+
]] });
|
|
1975
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, decorators: [{
|
|
1976
|
+
type: NgModule,
|
|
1977
|
+
args: [{
|
|
1978
|
+
declarations: [SkySearchComponent],
|
|
1979
|
+
imports: [
|
|
1980
|
+
CommonModule,
|
|
1981
|
+
SkyInputBoxModule,
|
|
1982
|
+
SkyLookupResourcesModule,
|
|
1983
|
+
FormsModule,
|
|
1984
|
+
SkyIconModule,
|
|
1985
|
+
SkyThemeModule,
|
|
1986
|
+
SkyIdModule,
|
|
1987
|
+
],
|
|
1988
|
+
exports: [SkySearchComponent],
|
|
1989
|
+
}]
|
|
1990
|
+
}] });
|
|
1991
|
+
|
|
1992
|
+
class SkyLookupItemSelectedPipe {
|
|
1993
|
+
transform(id, selectedIdMap) {
|
|
1994
|
+
return selectedIdMap.has(id);
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
SkyLookupItemSelectedPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupItemSelectedPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1998
|
+
SkyLookupItemSelectedPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupItemSelectedPipe, name: "skyLookupItemSelected" });
|
|
1999
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupItemSelectedPipe, decorators: [{
|
|
2000
|
+
type: Pipe,
|
|
2001
|
+
args: [{
|
|
2002
|
+
name: 'skyLookupItemSelected',
|
|
2003
|
+
}]
|
|
2004
|
+
}] });
|
|
2005
|
+
|
|
2006
|
+
/**
|
|
2007
|
+
* @internal
|
|
2008
|
+
* Context for the show more native picker. These values are provided by the lookup component.
|
|
2009
|
+
*/
|
|
2010
|
+
class SkyLookupShowMoreNativePickerAsyncContext {
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
/**
|
|
2014
|
+
* @internal
|
|
2015
|
+
* Internal component to implement the native picker.
|
|
2016
|
+
*/
|
|
2017
|
+
class SkyLookupShowMoreAsyncModalComponent {
|
|
2018
|
+
constructor(modalInstance, context, changeDetector) {
|
|
2019
|
+
this.modalInstance = modalInstance;
|
|
2020
|
+
this.context = context;
|
|
2021
|
+
this.changeDetector = changeDetector;
|
|
2022
|
+
/**
|
|
2023
|
+
* @internal
|
|
2024
|
+
* Fires when users select the button to add new options to the list.
|
|
2025
|
+
*/
|
|
2026
|
+
this.addClick = new Subject();
|
|
2027
|
+
this.displayedItems = [];
|
|
2028
|
+
this.onlyShowSelected = false;
|
|
2029
|
+
this.isSearching = false;
|
|
2030
|
+
this.hasMoreItems = false;
|
|
2031
|
+
this.isLoadingMore = false;
|
|
2032
|
+
this.offset = 0;
|
|
2033
|
+
this.ngUnsubscribe = new Subject();
|
|
2034
|
+
}
|
|
2035
|
+
ngOnInit() {
|
|
2036
|
+
this.searchText = this.context.initialSearch;
|
|
2037
|
+
this.createInitialSelectedItemsMap();
|
|
2038
|
+
this.loadSearchResults();
|
|
2039
|
+
}
|
|
2040
|
+
ngOnDestroy() {
|
|
2041
|
+
this.cancelCurrentSearch();
|
|
2042
|
+
this.ngUnsubscribe.next();
|
|
2043
|
+
this.ngUnsubscribe.complete();
|
|
2044
|
+
}
|
|
2045
|
+
addButtonClicked() {
|
|
2046
|
+
this.addClick.next();
|
|
2047
|
+
}
|
|
2048
|
+
clearAll() {
|
|
2049
|
+
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2050
|
+
// Only deselect items that have been loaded; items that would be loaded
|
|
2051
|
+
// after an infinite scroll event should remain selected.
|
|
2052
|
+
for (const item of this.items) {
|
|
2053
|
+
this.selectedIdMap.delete(item[this.context.idProperty]);
|
|
2054
|
+
}
|
|
2055
|
+
this.updateDisplayedItems();
|
|
2056
|
+
this.changeDetector.markForCheck();
|
|
2057
|
+
}
|
|
2058
|
+
itemClick(selectedItem) {
|
|
2059
|
+
if (this.context.selectMode === 'single') {
|
|
2060
|
+
this.onItemSelect(!selectedItem.selected, selectedItem);
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
onItemSelect(newSelectState, itemToSelect) {
|
|
2064
|
+
const itemId = itemToSelect[this.context.idProperty];
|
|
2065
|
+
// Create a new Map so the pipe transform will execute on the next
|
|
2066
|
+
// change detection cycle.
|
|
2067
|
+
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2068
|
+
if (this.context.selectMode === 'single') {
|
|
2069
|
+
if (newSelectState) {
|
|
2070
|
+
this.selectedIdMap.clear();
|
|
2071
|
+
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
else {
|
|
2075
|
+
if (newSelectState) {
|
|
2076
|
+
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2077
|
+
}
|
|
2078
|
+
else {
|
|
2079
|
+
this.selectedIdMap.delete(itemId);
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
this.updateDisplayedItems();
|
|
2083
|
+
}
|
|
2084
|
+
searchApplied(searchText) {
|
|
2085
|
+
this.offset = 0;
|
|
2086
|
+
this.searchText = searchText;
|
|
2087
|
+
this.loadSearchResults();
|
|
2088
|
+
}
|
|
2089
|
+
selectAll() {
|
|
2090
|
+
this.selectedIdMap = new Map();
|
|
2091
|
+
for (const item of this.items) {
|
|
2092
|
+
this.selectedIdMap.set(item[this.context.idProperty], item);
|
|
2093
|
+
}
|
|
2094
|
+
this.updateDisplayedItems();
|
|
2095
|
+
}
|
|
2096
|
+
infiniteScrollEnd() {
|
|
2097
|
+
this.cancelCurrentSearch();
|
|
2098
|
+
/* Sanity check - else case would only happen if this was called directly */
|
|
2099
|
+
/* istanbul ignore else */
|
|
2100
|
+
if (this.hasMoreItems) {
|
|
2101
|
+
this.isLoadingMore = true;
|
|
2102
|
+
this.performSearch((result) => {
|
|
2103
|
+
this.items = this.items.concat(result.items);
|
|
2104
|
+
this.updateDisplayedItems();
|
|
2105
|
+
this.isLoadingMore = false;
|
|
2106
|
+
});
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
save() {
|
|
2110
|
+
const selectedItems = Array.from(this.selectedIdMap.values(), (itemData, index) => ({
|
|
2111
|
+
index,
|
|
2112
|
+
itemData,
|
|
2113
|
+
})).sort((a, b) => {
|
|
2114
|
+
return this.items.indexOf(a.itemData) < this.items.indexOf(b.itemData)
|
|
2115
|
+
? -1
|
|
2116
|
+
: 1;
|
|
2117
|
+
});
|
|
2118
|
+
this.modalInstance.save(selectedItems);
|
|
2119
|
+
}
|
|
2120
|
+
loadSearchResults() {
|
|
2121
|
+
this.cancelCurrentSearch();
|
|
2122
|
+
this.isSearching = true;
|
|
2123
|
+
this.performSearch((result) => {
|
|
2124
|
+
this.isSearching = false;
|
|
2125
|
+
this.items = result.items;
|
|
2126
|
+
});
|
|
2127
|
+
}
|
|
2128
|
+
createInitialSelectedItemsMap() {
|
|
2129
|
+
this.selectedIdMap = new Map(this.context.initialValue.map((item) => [
|
|
2130
|
+
item[this.context.idProperty],
|
|
2131
|
+
item,
|
|
2132
|
+
]));
|
|
2133
|
+
}
|
|
2134
|
+
performSearch(processResults) {
|
|
2135
|
+
this.currentSearchSub = this.context
|
|
2136
|
+
.searchAsync({
|
|
2137
|
+
displayType: 'modal',
|
|
2138
|
+
offset: this.offset,
|
|
2139
|
+
searchText: this.searchText || '',
|
|
2140
|
+
continuationData: this.continuationData,
|
|
2141
|
+
})
|
|
2142
|
+
.pipe(take(1))
|
|
2143
|
+
.subscribe((result) => {
|
|
2144
|
+
processResults(result);
|
|
2145
|
+
this.continuationData = result.continuationData;
|
|
2146
|
+
this.hasMoreItems = result.hasMore;
|
|
2147
|
+
this.offset = this.items.length;
|
|
2148
|
+
this.updateDisplayedItems();
|
|
2149
|
+
this.changeDetector.markForCheck();
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
updateDisplayedItems() {
|
|
2153
|
+
if (this.onlyShowSelected) {
|
|
2154
|
+
this.displayedItems = this.items.filter((item) => this.selectedIdMap.has(item[this.context.idProperty]));
|
|
2155
|
+
}
|
|
2156
|
+
else {
|
|
2157
|
+
this.displayedItems = this.items;
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
cancelCurrentSearch() {
|
|
2161
|
+
if (this.currentSearchSub) {
|
|
2162
|
+
this.currentSearchSub.unsubscribe();
|
|
2163
|
+
this.currentSearchSub = undefined;
|
|
2164
|
+
this.isLoadingMore = false;
|
|
2165
|
+
this.isSearching = false;
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
SkyLookupShowMoreAsyncModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupShowMoreAsyncModalComponent, deps: [{ token: i1$1.SkyModalInstance }, { token: SkyLookupShowMoreNativePickerAsyncContext }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2170
|
+
SkyLookupShowMoreAsyncModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyLookupShowMoreAsyncModalComponent, selector: "sky-lookup-show-more-async-modal", ngImport: i0, template: "<sky-modal>\n <sky-modal-header>\n <ng-container *ngIf=\"context.userConfig?.title; else defaultTitle\">\n {{ context.userConfig.title }}\n </ng-container>\n </sky-modal-header>\n <sky-modal-content>\n <sky-wait [isWaiting]=\"isSearching\"></sky-wait>\n <div\n [skyViewkeeper]=\"[\n '.sky-lookup-show-more-modal-toolbar',\n '.sky-lookup-show-more-modal-muiltiselect-toolbar'\n ]\"\n >\n <sky-toolbar class=\"sky-lookup-show-more-modal-toolbar\">\n <sky-toolbar-section>\n <sky-toolbar-item>\n <sky-search\n [debounceTime]=\"250\"\n [searchText]=\"searchText\"\n (searchApply)=\"searchApplied($event)\"\n >\n </sky-search>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <button\n *ngIf=\"context.showAddButton\"\n type=\"button\"\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-add\"\n (click)=\"addButtonClicked()\"\n >\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"add\"\n iconType=\"skyux\"\n ></sky-icon>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"plus-circle\"></sky-icon>\n {{ 'skyux_lookup_show_more_add' | skyLibResources }}\n </button>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n <sky-toolbar\n *ngIf=\"context.selectMode === 'multiple'\"\n class=\"sky-lookup-show-more-modal-muiltiselect-toolbar\"\n >\n <sky-toolbar-section>\n <sky-toolbar-item>\n <button\n class=\"\n sky-btn sky-btn-link sky-lookup-show-more-modal-select-all-btn\n \"\n type=\"button\"\n (click)=\"selectAll()\"\n >\n {{\n 'skyux_lookup_show_more_select_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-item>\n <button\n class=\"\n sky-btn sky-btn-link sky-lookup-show-more-modal-clear-all-btn\n \"\n type=\"button\"\n (click)=\"clearAll()\"\n >\n {{\n 'skyux_lookup_show_more_clear_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <sky-checkbox\n [(checked)]=\"onlyShowSelected\"\n (change)=\"updateDisplayedItems()\"\n >\n <sky-checkbox-label>\n {{\n 'skyux_lookup_show_more_show_selected_option_title'\n | skyLibResources\n }}\n </sky-checkbox-label>\n </sky-checkbox>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n </div>\n <div\n *ngIf=\"!isSearching && displayedItems.length === 0\"\n class=\"sky-font-deemphasized sky-lookup-show-more-no-results\"\n >\n {{ 'skyux_lookup_show_more_no_results' | skyLibResources }}\n </div>\n <sky-repeater class=\"sky-lookup-show-more-repeater\" expandMode=\"none\">\n <sky-repeater-item\n *ngFor=\"let item of displayedItems\"\n [isSelected]=\"\n item[context.idProperty] | skyLookupItemSelected: selectedIdMap\n \"\n [selectable]=\"context.selectMode === 'multiple'\"\n (click)=\"itemClick(item)\"\n (keyup.enter)=\"itemClick(item)\"\n (isSelectedChange)=\"onItemSelect($event, item)\"\n >\n <sky-repeater-item-content>\n <ng-container\n *ngTemplateOutlet=\"\n context.userConfig?.itemTemplate\n ? context.userConfig?.itemTemplate\n : defaultItemTemplate;\n context: { item: item }\n \"\n >\n </ng-container>\n </sky-repeater-item-content>\n </sky-repeater-item>\n </sky-repeater>\n <sky-infinite-scroll\n [enabled]=\"hasMoreItems\"\n [loading]=\"isLoadingMore\"\n (scrollEnd)=\"infiniteScrollEnd()\"\n >\n </sky-infinite-scroll>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n class=\"\n sky-btn\n sky-btn-primary\n sky-margin-inline-compact\n sky-lookup-show-more-modal-save\n \"\n type=\"button\"\n [disabled]=\"isSearching\"\n (click)=\"save()\"\n >\n {{ 'skyux_lookup_show_more_select' | skyLibResources }}\n </button>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-close\"\n type=\"button\"\n (click)=\"modalInstance.close()\"\n >\n {{ 'skyux_lookup_show_more_cancel' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n\n<ng-template let-item=\"item\" #defaultItemTemplate>\n {{ item[context.descriptorProperty] }}\n</ng-template>\n\n<ng-template #defaultTitle>\n <ng-container *ngIf=\"context.selectMode === 'single'\">\n {{ 'skyux_lookup_show_more_modal_title_single' | skyLibResources }}\n </ng-container>\n <ng-container *ngIf=\"context.selectMode === 'multiple'\">\n {{ 'skyux_lookup_show_more_modal_title_multiple' | skyLibResources }}\n </ng-container>\n</ng-template>\n", styles: [".sky-lookup-show-more-no-results{padding:20px 0}:host-context(.sky-theme-modern) .sky-lookup-show-more-no-results{padding:30px 0}.sky-theme-modern .sky-lookup-show-more-no-results{padding:30px 0}\n"], components: [{ type: i1$1.λ5, selector: "sky-modal", inputs: ["ariaRole", "tiledBody"] }, { type: i1$1.λ4, selector: "sky-modal-header" }, { type: i1$1.λ2, selector: "sky-modal-content" }, { type: i4.λ14, selector: "sky-wait", inputs: ["ariaLabel", "isWaiting", "isFullPage", "isNonBlocking"] }, { type: i4$1.λ37, selector: "sky-toolbar" }, { type: i4$1.λ38, selector: "sky-toolbar-section" }, { type: i4$1.λ39, selector: "sky-toolbar-item" }, { type: SkySearchComponent, selector: "sky-search", inputs: ["searchText", "expandMode", "debounceTime", "disabled", "placeholderText"], outputs: ["searchApply", "searchChange", "searchClear"] }, { type: i4$1.λ40, selector: "sky-toolbar-view-actions" }, { type: i4.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { type: i6.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: i6.λ4, selector: "sky-checkbox-label" }, { type: i7$1.λ11, selector: "sky-repeater", inputs: ["activeIndex", "ariaLabel", "reorderable", "expandMode"], outputs: ["activeIndexChange", "orderChange"] }, { type: i7$1.λ10, selector: "sky-repeater-item", inputs: ["itemName", "inlineFormConfig", "inlineFormTemplate", "isExpanded", "isSelected", "reorderable", "selectable", "showInlineForm", "tag"], outputs: ["collapse", "expand", "inlineFormClose", "isSelectedChange"] }, { type: i7$1.λ8, selector: "sky-repeater-item-content" }, { type: i7$1.λ6, selector: "sky-infinite-scroll", inputs: ["enabled", "loading"], outputs: ["scrollEnd"] }, { type: i1$1.λ3, selector: "sky-modal-footer" }], directives: [{ type: i6$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.λ3, selector: "[skyViewkeeper]", inputs: ["skyViewkeeper"] }, { type: i7.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { type: i6$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "skyLibResources": i5.SkyLibResourcesPipe, "skyLookupItemSelected": SkyLookupItemSelectedPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2171
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupShowMoreAsyncModalComponent, decorators: [{
|
|
2172
|
+
type: Component,
|
|
2173
|
+
args: [{
|
|
2174
|
+
selector: 'sky-lookup-show-more-async-modal',
|
|
2175
|
+
templateUrl: './lookup-show-more-async-modal.component.html',
|
|
2176
|
+
styleUrls: ['./lookup-show-more-async-modal.component.scss'],
|
|
2177
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2178
|
+
}]
|
|
2179
|
+
}], ctorParameters: function () { return [{ type: i1$1.SkyModalInstance }, { type: SkyLookupShowMoreNativePickerAsyncContext }, { type: i0.ChangeDetectorRef }]; } });
|
|
2180
|
+
|
|
2181
|
+
/**
|
|
2182
|
+
* @internal
|
|
2183
|
+
* Context for the show more native picker. These values are provided by the lookup component.
|
|
2184
|
+
*/
|
|
2185
|
+
class SkyLookupShowMoreNativePickerContext {
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
/**
|
|
2189
|
+
* @internal
|
|
2190
|
+
* Internal component to implement the native picker.
|
|
2054
2191
|
*/
|
|
2055
2192
|
class SkyLookupShowMoreModalComponent {
|
|
2056
2193
|
constructor(modalInstance, context, changeDetector) {
|
|
@@ -2098,7 +2235,7 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2098
2235
|
}
|
|
2099
2236
|
addItems() {
|
|
2100
2237
|
if (!this.items || this.items.length === 0) {
|
|
2101
|
-
|
|
2238
|
+
const selectedItems = this.selectedItems.slice();
|
|
2102
2239
|
this.items = this.context.items
|
|
2103
2240
|
? this.context.items.map((item) => {
|
|
2104
2241
|
return {
|
|
@@ -2173,9 +2310,9 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2173
2310
|
}
|
|
2174
2311
|
}
|
|
2175
2312
|
else {
|
|
2176
|
-
|
|
2313
|
+
const selectedItems = this.selectedItems;
|
|
2177
2314
|
const allItemsIndex = this.items.findIndex((item) => item.value === itemToSelect.value);
|
|
2178
|
-
|
|
2315
|
+
const selectedItemsIndex = selectedItems.findIndex((selectedItem) => selectedItem.index === allItemsIndex);
|
|
2179
2316
|
if (newSelectState && selectedItemsIndex === -1) {
|
|
2180
2317
|
selectedItems.push({
|
|
2181
2318
|
index: allItemsIndex,
|
|
@@ -2199,7 +2336,7 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2199
2336
|
this.updateDataState();
|
|
2200
2337
|
}
|
|
2201
2338
|
searchItems(items) {
|
|
2202
|
-
|
|
2339
|
+
const searchText = this.searchText;
|
|
2203
2340
|
if (searchText) {
|
|
2204
2341
|
const resultValues = this.context.search(searchText, items.map((item) => {
|
|
2205
2342
|
return item.value;
|
|
@@ -2220,7 +2357,7 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2220
2357
|
}
|
|
2221
2358
|
}
|
|
2222
2359
|
selectAll() {
|
|
2223
|
-
|
|
2360
|
+
const selectedItems = this.selectedItems;
|
|
2224
2361
|
this.displayedItems.forEach((item) => {
|
|
2225
2362
|
if (!item.selected) {
|
|
2226
2363
|
item.selected = true;
|
|
@@ -2239,245 +2376,144 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2239
2376
|
this.updateDataState();
|
|
2240
2377
|
this.changeDetector.markForCheck();
|
|
2241
2378
|
}
|
|
2242
|
-
updateDataState() {
|
|
2243
|
-
|
|
2244
|
-
this.items.forEach((item, index) => {
|
|
2245
|
-
item.selected =
|
|
2246
|
-
selectedItems.findIndex((selectedItem) => selectedItem.index === index) !== -1;
|
|
2247
|
-
});
|
|
2248
|
-
this.searchItems(this.items).then((searchedItems) => {
|
|
2249
|
-
if (this.onlyShowSelected) {
|
|
2250
|
-
searchedItems = searchedItems.filter((item) => item.selected);
|
|
2251
|
-
}
|
|
2252
|
-
this.displayedItems = searchedItems.slice(0, this.itemIndex);
|
|
2253
|
-
if (this.itemIndex > searchedItems.length) {
|
|
2254
|
-
this.itemsHaveMore = false;
|
|
2255
|
-
}
|
|
2256
|
-
else {
|
|
2257
|
-
this.itemsHaveMore = true;
|
|
2258
|
-
}
|
|
2259
|
-
this.changeDetector.markForCheck();
|
|
2260
|
-
});
|
|
2261
|
-
}
|
|
2262
|
-
updateItemData(data) {
|
|
2263
|
-
this.context.items = data;
|
|
2264
|
-
this.items = undefined;
|
|
2265
|
-
this.itemIndex = 10;
|
|
2266
|
-
this.selectedItems.forEach((selectedItem) => {
|
|
2267
|
-
this.context.items.forEach((item, index) => {
|
|
2268
|
-
if (selectedItem.itemData === item) {
|
|
2269
|
-
selectedItem.index = index;
|
|
2270
|
-
}
|
|
2271
|
-
});
|
|
2272
|
-
});
|
|
2273
|
-
this.addItems();
|
|
2274
|
-
this.changeDetector.markForCheck();
|
|
2275
|
-
}
|
|
2276
|
-
}
|
|
2277
|
-
SkyLookupShowMoreModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupShowMoreModalComponent, deps: [{ token: i1$1.SkyModalInstance }, { token: SkyLookupShowMoreNativePickerContext }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2278
|
-
SkyLookupShowMoreModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyLookupShowMoreModalComponent, selector: "skyux-lookup-show-more-modal", ngImport: i0, template: "<sky-modal>\n <sky-modal-header>\n <ng-container *ngIf=\"context.userConfig?.title; else defaultTitle\">\n {{ context.userConfig.title }}\n </ng-container>\n </sky-modal-header>\n <sky-modal-content>\n <div\n [skyViewkeeper]=\"[\n '.sky-lookup-show-more-modal-toolbar',\n '.sky-lookup-show-more-modal-muiltiselect-toolbar'\n ]\"\n >\n <sky-toolbar class=\"sky-lookup-show-more-modal-toolbar\">\n <sky-toolbar-section>\n <sky-toolbar-item>\n <sky-search\n [debounceTime]=\"250\"\n [searchText]=\"searchText\"\n (searchApply)=\"searchApplied($event)\"\n >\n </sky-search>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <button\n *ngIf=\"context.showAddButton\"\n type=\"button\"\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-add\"\n (click)=\"addButtonClicked()\"\n >\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"add\"\n iconType=\"skyux\"\n ></sky-icon>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"plus-circle\"></sky-icon>\n {{ 'skyux_lookup_show_more_add' | skyLibResources }}\n </button>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n <sky-toolbar\n *ngIf=\"context.selectMode === 'multiple'\"\n class=\"sky-lookup-show-more-modal-muiltiselect-toolbar\"\n >\n <sky-toolbar-section>\n <sky-toolbar-item>\n <button\n class=\"\n sky-btn sky-btn-link sky-lookup-show-more-modal-select-all-btn\n \"\n type=\"button\"\n (click)=\"selectAll()\"\n >\n {{\n 'skyux_lookup_show_more_select_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-item>\n <button\n class=\"\n sky-btn sky-btn-link sky-lookup-show-more-modal-clear-all-btn\n \"\n type=\"button\"\n (click)=\"clearAll()\"\n >\n {{\n 'skyux_lookup_show_more_clear_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <sky-checkbox\n [(checked)]=\"onlyShowSelected\"\n (change)=\"updateDataState()\"\n >\n <sky-checkbox-label>\n {{\n 'skyux_lookup_show_more_show_selected_option_title'\n | skyLibResources\n }}\n </sky-checkbox-label>\n </sky-checkbox>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n </div>\n <div\n *ngIf=\"displayedItems.length === 0\"\n class=\"sky-font-deemphasized sky-lookup-show-more-no-results\"\n >\n {{ 'skyux_lookup_show_more_no_results' | skyLibResources }}\n </div>\n <sky-repeater class=\"sky-lookup-show-more-repeater\" expandMode=\"none\">\n <sky-repeater-item\n *ngFor=\"let item of displayedItems\"\n [selectable]=\"context.selectMode === 'multiple'\"\n [(isSelected)]=\"item.selected\"\n (click)=\"itemClick(item)\"\n (keyup.enter)=\"itemClick(item)\"\n (isSelectedChange)=\"onItemSelect($event, item)\"\n >\n <sky-repeater-item-content>\n <ng-container\n *ngTemplateOutlet=\"\n context.userConfig?.itemTemplate\n ? context.userConfig?.itemTemplate\n : defaultItemTemplate;\n context: { item: item.value }\n \"\n >\n </ng-container>\n </sky-repeater-item-content>\n </sky-repeater-item>\n </sky-repeater>\n <sky-infinite-scroll [enabled]=\"itemsHaveMore\" (scrollEnd)=\"addItems()\">\n </sky-infinite-scroll>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n class=\"\n sky-btn\n sky-btn-primary\n sky-margin-inline-compact\n sky-lookup-show-more-modal-save\n \"\n type=\"button\"\n (click)=\"modalInstance.save(selectedItems)\"\n >\n {{ 'skyux_lookup_show_more_select' | skyLibResources }}\n </button>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-close\"\n type=\"button\"\n (click)=\"modalInstance.close()\"\n >\n {{ 'skyux_lookup_show_more_cancel' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n\n<ng-template let-item=\"item\" #defaultItemTemplate>\n {{ item[context.descriptorProperty] }}\n</ng-template>\n\n<ng-template #defaultTitle>\n <ng-container *ngIf=\"context.selectMode === 'single'\">\n {{ 'skyux_lookup_show_more_modal_title_single' | skyLibResources }}\n </ng-container>\n <ng-container *ngIf=\"context.selectMode === 'multiple'\">\n {{ 'skyux_lookup_show_more_modal_title_multiple' | skyLibResources }}\n </ng-container>\n</ng-template>\n", styles: [".sky-lookup-show-more-no-results{padding:20px 0}:host-context(.sky-theme-modern) .sky-lookup-show-more-no-results{padding:30px 0}.sky-theme-modern .sky-lookup-show-more-no-results{padding:30px 0}\n"], components: [{ type: i1$1.λ5, selector: "sky-modal", inputs: ["ariaRole", "tiledBody"] }, { type: i1$1.λ4, selector: "sky-modal-header" }, { type: i1$1.λ2, selector: "sky-modal-content" }, { type: i3.λ37, selector: "sky-toolbar" }, { type: i3.λ38, selector: "sky-toolbar-section" }, { type: i3.λ39, selector: "sky-toolbar-item" }, { type: SkySearchComponent, selector: "sky-search", inputs: ["searchText", "expandMode", "debounceTime", "disabled", "placeholderText"], outputs: ["searchApply", "searchChange", "searchClear"] }, { type: i3.λ40, selector: "sky-toolbar-view-actions" }, { type: i4.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { type: i6.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: i6.λ4, selector: "sky-checkbox-label" }, { type: i7$1.λ11, selector: "sky-repeater", inputs: ["activeIndex", "ariaLabel", "reorderable", "expandMode"], outputs: ["activeIndexChange", "orderChange"] }, { type: i7$1.λ10, selector: "sky-repeater-item", inputs: ["itemName", "inlineFormConfig", "inlineFormTemplate", "isExpanded", "isSelected", "reorderable", "selectable", "showInlineForm", "tag"], outputs: ["collapse", "expand", "inlineFormClose", "isSelectedChange"] }, { type: i7$1.λ8, selector: "sky-repeater-item-content" }, { type: i7$1.λ6, selector: "sky-infinite-scroll", inputs: ["enabled", "loading"], outputs: ["scrollEnd"] }, { type: i1$1.λ3, selector: "sky-modal-footer" }], directives: [{ type: i6$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.λ3, selector: "[skyViewkeeper]", inputs: ["skyViewkeeper"] }, { type: i7.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { type: i6$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "skyLibResources": i5.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2279
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupShowMoreModalComponent, decorators: [{
|
|
2280
|
-
type: Component,
|
|
2281
|
-
args: [{
|
|
2282
|
-
// Suppress this error rather than fix the selector since consumers with unit tests
|
|
2283
|
-
// may be looking for an element with this selector. We can change it in the next major
|
|
2284
|
-
// version of SKY UX.
|
|
2285
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
2286
|
-
selector: 'skyux-lookup-show-more-modal',
|
|
2287
|
-
templateUrl: './lookup-show-more-modal.component.html',
|
|
2288
|
-
styleUrls: ['./lookup-show-more-modal.component.scss'],
|
|
2289
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2290
|
-
}]
|
|
2291
|
-
}], ctorParameters: function () { return [{ type: i1$1.SkyModalInstance }, { type: SkyLookupShowMoreNativePickerContext }, { type: i0.ChangeDetectorRef }]; } });
|
|
2292
|
-
|
|
2293
|
-
/**
|
|
2294
|
-
* @internal
|
|
2295
|
-
* Context for the show more native picker. These values are provided by the lookup component.
|
|
2296
|
-
*/
|
|
2297
|
-
class SkyLookupShowMoreNativePickerAsyncContext {
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
class SkyLookupItemSelectedPipe {
|
|
2301
|
-
transform(id, selectedIdMap) {
|
|
2302
|
-
return selectedIdMap.has(id);
|
|
2303
|
-
}
|
|
2304
|
-
}
|
|
2305
|
-
SkyLookupItemSelectedPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupItemSelectedPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2306
|
-
SkyLookupItemSelectedPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupItemSelectedPipe, name: "skyLookupItemSelected" });
|
|
2307
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupItemSelectedPipe, decorators: [{
|
|
2308
|
-
type: Pipe,
|
|
2309
|
-
args: [{
|
|
2310
|
-
name: 'skyLookupItemSelected',
|
|
2311
|
-
}]
|
|
2312
|
-
}] });
|
|
2313
|
-
|
|
2314
|
-
/**
|
|
2315
|
-
* @internal
|
|
2316
|
-
* Internal component to implement the native picker.
|
|
2317
|
-
*/
|
|
2318
|
-
class SkyLookupShowMoreAsyncModalComponent {
|
|
2319
|
-
constructor(modalInstance, context, changeDetector) {
|
|
2320
|
-
this.modalInstance = modalInstance;
|
|
2321
|
-
this.context = context;
|
|
2322
|
-
this.changeDetector = changeDetector;
|
|
2323
|
-
/**
|
|
2324
|
-
* @internal
|
|
2325
|
-
* Fires when users select the button to add new options to the list.
|
|
2326
|
-
*/
|
|
2327
|
-
this.addClick = new Subject();
|
|
2328
|
-
this.displayedItems = [];
|
|
2329
|
-
this.onlyShowSelected = false;
|
|
2330
|
-
this.isSearching = false;
|
|
2331
|
-
this.hasMoreItems = false;
|
|
2332
|
-
this.isLoadingMore = false;
|
|
2333
|
-
this.offset = 0;
|
|
2334
|
-
this.ngUnsubscribe = new Subject();
|
|
2335
|
-
}
|
|
2336
|
-
ngOnInit() {
|
|
2337
|
-
this.searchText = this.context.initialSearch;
|
|
2338
|
-
this.createInitialSelectedItemsMap();
|
|
2339
|
-
this.loadSearchResults();
|
|
2340
|
-
}
|
|
2341
|
-
ngOnDestroy() {
|
|
2342
|
-
this.cancelCurrentSearch();
|
|
2343
|
-
this.ngUnsubscribe.next();
|
|
2344
|
-
this.ngUnsubscribe.complete();
|
|
2345
|
-
}
|
|
2346
|
-
addButtonClicked() {
|
|
2347
|
-
this.addClick.next();
|
|
2348
|
-
}
|
|
2349
|
-
clearAll() {
|
|
2350
|
-
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2351
|
-
// Only deselect items that have been loaded; items that would be loaded
|
|
2352
|
-
// after an infinite scroll event should remain selected.
|
|
2353
|
-
for (const item of this.items) {
|
|
2354
|
-
this.selectedIdMap.delete(item[this.context.idProperty]);
|
|
2355
|
-
}
|
|
2356
|
-
this.updateDisplayedItems();
|
|
2357
|
-
this.changeDetector.markForCheck();
|
|
2358
|
-
}
|
|
2359
|
-
itemClick(selectedItem) {
|
|
2360
|
-
if (this.context.selectMode === 'single') {
|
|
2361
|
-
this.onItemSelect(!selectedItem.selected, selectedItem);
|
|
2362
|
-
}
|
|
2363
|
-
}
|
|
2364
|
-
onItemSelect(newSelectState, itemToSelect) {
|
|
2365
|
-
const itemId = itemToSelect[this.context.idProperty];
|
|
2366
|
-
// Create a new Map so the pipe transform will execute on the next
|
|
2367
|
-
// change detection cycle.
|
|
2368
|
-
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2369
|
-
if (this.context.selectMode === 'single') {
|
|
2370
|
-
if (newSelectState) {
|
|
2371
|
-
this.selectedIdMap.clear();
|
|
2372
|
-
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2379
|
+
updateDataState() {
|
|
2380
|
+
const selectedItems = this.selectedItems;
|
|
2381
|
+
this.items.forEach((item, index) => {
|
|
2382
|
+
item.selected =
|
|
2383
|
+
selectedItems.findIndex((selectedItem) => selectedItem.index === index) !== -1;
|
|
2384
|
+
});
|
|
2385
|
+
this.searchItems(this.items).then((searchedItems) => {
|
|
2386
|
+
if (this.onlyShowSelected) {
|
|
2387
|
+
searchedItems = searchedItems.filter((item) => item.selected);
|
|
2373
2388
|
}
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2389
|
+
this.displayedItems = searchedItems.slice(0, this.itemIndex);
|
|
2390
|
+
if (this.itemIndex > searchedItems.length) {
|
|
2391
|
+
this.itemsHaveMore = false;
|
|
2378
2392
|
}
|
|
2379
2393
|
else {
|
|
2380
|
-
this.
|
|
2394
|
+
this.itemsHaveMore = true;
|
|
2381
2395
|
}
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
}
|
|
2385
|
-
searchApplied(searchText) {
|
|
2386
|
-
this.offset = 0;
|
|
2387
|
-
this.searchText = searchText;
|
|
2388
|
-
this.loadSearchResults();
|
|
2396
|
+
this.changeDetector.markForCheck();
|
|
2397
|
+
});
|
|
2389
2398
|
}
|
|
2390
|
-
|
|
2391
|
-
this.
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2399
|
+
updateItemData(data) {
|
|
2400
|
+
this.context.items = data;
|
|
2401
|
+
this.items = undefined;
|
|
2402
|
+
this.itemIndex = 10;
|
|
2403
|
+
this.selectedItems.forEach((selectedItem) => {
|
|
2404
|
+
this.context.items.forEach((item, index) => {
|
|
2405
|
+
if (selectedItem.itemData === item) {
|
|
2406
|
+
selectedItem.index = index;
|
|
2407
|
+
}
|
|
2408
|
+
});
|
|
2409
|
+
});
|
|
2410
|
+
this.addItems();
|
|
2411
|
+
this.changeDetector.markForCheck();
|
|
2396
2412
|
}
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2413
|
+
}
|
|
2414
|
+
SkyLookupShowMoreModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupShowMoreModalComponent, deps: [{ token: i1$1.SkyModalInstance }, { token: SkyLookupShowMoreNativePickerContext }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2415
|
+
SkyLookupShowMoreModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyLookupShowMoreModalComponent, selector: "skyux-lookup-show-more-modal", ngImport: i0, template: "<sky-modal>\n <sky-modal-header>\n <ng-container *ngIf=\"context.userConfig?.title; else defaultTitle\">\n {{ context.userConfig.title }}\n </ng-container>\n </sky-modal-header>\n <sky-modal-content>\n <div\n [skyViewkeeper]=\"[\n '.sky-lookup-show-more-modal-toolbar',\n '.sky-lookup-show-more-modal-muiltiselect-toolbar'\n ]\"\n >\n <sky-toolbar class=\"sky-lookup-show-more-modal-toolbar\">\n <sky-toolbar-section>\n <sky-toolbar-item>\n <sky-search\n [debounceTime]=\"250\"\n [searchText]=\"searchText\"\n (searchApply)=\"searchApplied($event)\"\n >\n </sky-search>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <button\n *ngIf=\"context.showAddButton\"\n type=\"button\"\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-add\"\n (click)=\"addButtonClicked()\"\n >\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"add\"\n iconType=\"skyux\"\n ></sky-icon>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"plus-circle\"></sky-icon>\n {{ 'skyux_lookup_show_more_add' | skyLibResources }}\n </button>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n <sky-toolbar\n *ngIf=\"context.selectMode === 'multiple'\"\n class=\"sky-lookup-show-more-modal-muiltiselect-toolbar\"\n >\n <sky-toolbar-section>\n <sky-toolbar-item>\n <button\n class=\"\n sky-btn sky-btn-link sky-lookup-show-more-modal-select-all-btn\n \"\n type=\"button\"\n (click)=\"selectAll()\"\n >\n {{\n 'skyux_lookup_show_more_select_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-item>\n <button\n class=\"\n sky-btn sky-btn-link sky-lookup-show-more-modal-clear-all-btn\n \"\n type=\"button\"\n (click)=\"clearAll()\"\n >\n {{\n 'skyux_lookup_show_more_clear_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <sky-checkbox\n [(checked)]=\"onlyShowSelected\"\n (change)=\"updateDataState()\"\n >\n <sky-checkbox-label>\n {{\n 'skyux_lookup_show_more_show_selected_option_title'\n | skyLibResources\n }}\n </sky-checkbox-label>\n </sky-checkbox>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n </div>\n <div\n *ngIf=\"displayedItems.length === 0\"\n class=\"sky-font-deemphasized sky-lookup-show-more-no-results\"\n >\n {{ 'skyux_lookup_show_more_no_results' | skyLibResources }}\n </div>\n <sky-repeater class=\"sky-lookup-show-more-repeater\" expandMode=\"none\">\n <sky-repeater-item\n *ngFor=\"let item of displayedItems\"\n [selectable]=\"context.selectMode === 'multiple'\"\n [(isSelected)]=\"item.selected\"\n (click)=\"itemClick(item)\"\n (keyup.enter)=\"itemClick(item)\"\n (isSelectedChange)=\"onItemSelect($event, item)\"\n >\n <sky-repeater-item-content>\n <ng-container\n *ngTemplateOutlet=\"\n context.userConfig?.itemTemplate\n ? context.userConfig?.itemTemplate\n : defaultItemTemplate;\n context: { item: item.value }\n \"\n >\n </ng-container>\n </sky-repeater-item-content>\n </sky-repeater-item>\n </sky-repeater>\n <sky-infinite-scroll [enabled]=\"itemsHaveMore\" (scrollEnd)=\"addItems()\">\n </sky-infinite-scroll>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n class=\"\n sky-btn\n sky-btn-primary\n sky-margin-inline-compact\n sky-lookup-show-more-modal-save\n \"\n type=\"button\"\n (click)=\"modalInstance.save(selectedItems)\"\n >\n {{ 'skyux_lookup_show_more_select' | skyLibResources }}\n </button>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-close\"\n type=\"button\"\n (click)=\"modalInstance.close()\"\n >\n {{ 'skyux_lookup_show_more_cancel' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n\n<ng-template let-item=\"item\" #defaultItemTemplate>\n {{ item[context.descriptorProperty] }}\n</ng-template>\n\n<ng-template #defaultTitle>\n <ng-container *ngIf=\"context.selectMode === 'single'\">\n {{ 'skyux_lookup_show_more_modal_title_single' | skyLibResources }}\n </ng-container>\n <ng-container *ngIf=\"context.selectMode === 'multiple'\">\n {{ 'skyux_lookup_show_more_modal_title_multiple' | skyLibResources }}\n </ng-container>\n</ng-template>\n", styles: [".sky-lookup-show-more-no-results{padding:20px 0}:host-context(.sky-theme-modern) .sky-lookup-show-more-no-results{padding:30px 0}.sky-theme-modern .sky-lookup-show-more-no-results{padding:30px 0}\n"], components: [{ type: i1$1.λ5, selector: "sky-modal", inputs: ["ariaRole", "tiledBody"] }, { type: i1$1.λ4, selector: "sky-modal-header" }, { type: i1$1.λ2, selector: "sky-modal-content" }, { type: i4$1.λ37, selector: "sky-toolbar" }, { type: i4$1.λ38, selector: "sky-toolbar-section" }, { type: i4$1.λ39, selector: "sky-toolbar-item" }, { type: SkySearchComponent, selector: "sky-search", inputs: ["searchText", "expandMode", "debounceTime", "disabled", "placeholderText"], outputs: ["searchApply", "searchChange", "searchClear"] }, { type: i4$1.λ40, selector: "sky-toolbar-view-actions" }, { type: i4.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { type: i6.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: i6.λ4, selector: "sky-checkbox-label" }, { type: i7$1.λ11, selector: "sky-repeater", inputs: ["activeIndex", "ariaLabel", "reorderable", "expandMode"], outputs: ["activeIndexChange", "orderChange"] }, { type: i7$1.λ10, selector: "sky-repeater-item", inputs: ["itemName", "inlineFormConfig", "inlineFormTemplate", "isExpanded", "isSelected", "reorderable", "selectable", "showInlineForm", "tag"], outputs: ["collapse", "expand", "inlineFormClose", "isSelectedChange"] }, { type: i7$1.λ8, selector: "sky-repeater-item-content" }, { type: i7$1.λ6, selector: "sky-infinite-scroll", inputs: ["enabled", "loading"], outputs: ["scrollEnd"] }, { type: i1$1.λ3, selector: "sky-modal-footer" }], directives: [{ type: i6$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.λ3, selector: "[skyViewkeeper]", inputs: ["skyViewkeeper"] }, { type: i7.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { type: i6$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "skyLibResources": i5.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2416
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupShowMoreModalComponent, decorators: [{
|
|
2417
|
+
type: Component,
|
|
2418
|
+
args: [{
|
|
2419
|
+
// Suppress this error rather than fix the selector since consumers with unit tests
|
|
2420
|
+
// may be looking for an element with this selector. We can change it in the next major
|
|
2421
|
+
// version of SKY UX.
|
|
2422
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
2423
|
+
selector: 'skyux-lookup-show-more-modal',
|
|
2424
|
+
templateUrl: './lookup-show-more-modal.component.html',
|
|
2425
|
+
styleUrls: ['./lookup-show-more-modal.component.scss'],
|
|
2426
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2427
|
+
}]
|
|
2428
|
+
}], ctorParameters: function () { return [{ type: i1$1.SkyModalInstance }, { type: SkyLookupShowMoreNativePickerContext }, { type: i0.ChangeDetectorRef }]; } });
|
|
2429
|
+
|
|
2430
|
+
/**
|
|
2431
|
+
* @internal
|
|
2432
|
+
*/
|
|
2433
|
+
class SkyLookupAdapterService {
|
|
2434
|
+
focusInput(elRef) {
|
|
2435
|
+
const inputEl = elRef.nativeElement.querySelector('.sky-lookup-input');
|
|
2436
|
+
/* Sanity check */
|
|
2400
2437
|
/* istanbul ignore else */
|
|
2401
|
-
if (
|
|
2402
|
-
|
|
2403
|
-
this.performSearch((result) => {
|
|
2404
|
-
this.items = this.items.concat(result.items);
|
|
2405
|
-
this.updateDisplayedItems();
|
|
2406
|
-
this.isLoadingMore = false;
|
|
2407
|
-
});
|
|
2438
|
+
if (inputEl) {
|
|
2439
|
+
inputEl.focus();
|
|
2408
2440
|
}
|
|
2409
2441
|
}
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2442
|
+
}
|
|
2443
|
+
SkyLookupAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2444
|
+
SkyLookupAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAdapterService });
|
|
2445
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAdapterService, decorators: [{
|
|
2446
|
+
type: Injectable
|
|
2447
|
+
}] });
|
|
2448
|
+
|
|
2449
|
+
/**
|
|
2450
|
+
* @internal
|
|
2451
|
+
*/
|
|
2452
|
+
class SkyLookupAutocompleteAdapter {
|
|
2453
|
+
constructor() {
|
|
2454
|
+
this.searchAsync = new EventEmitter();
|
|
2420
2455
|
}
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2456
|
+
/**
|
|
2457
|
+
* Specifies an object property to display in the text input after users
|
|
2458
|
+
* select an item in the dropdown list.
|
|
2459
|
+
* @default "name"
|
|
2460
|
+
*/
|
|
2461
|
+
set descriptorProperty(value) {
|
|
2462
|
+
this._descriptorProperty = value;
|
|
2428
2463
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
item[this.context.idProperty],
|
|
2432
|
-
item,
|
|
2433
|
-
]));
|
|
2464
|
+
get descriptorProperty() {
|
|
2465
|
+
return this._descriptorProperty || 'name';
|
|
2434
2466
|
}
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
continuationData: this.continuationData,
|
|
2442
|
-
})
|
|
2443
|
-
.pipe(take(1))
|
|
2444
|
-
.subscribe((result) => {
|
|
2445
|
-
processResults(result);
|
|
2446
|
-
this.continuationData = result.continuationData;
|
|
2447
|
-
this.hasMoreItems = result.hasMore;
|
|
2448
|
-
this.offset = this.items.length;
|
|
2449
|
-
this.updateDisplayedItems();
|
|
2450
|
-
this.changeDetector.markForCheck();
|
|
2451
|
-
});
|
|
2467
|
+
/**
|
|
2468
|
+
* Specifies an array of object properties to search.
|
|
2469
|
+
* @default ["name"]
|
|
2470
|
+
*/
|
|
2471
|
+
set propertiesToSearch(value) {
|
|
2472
|
+
this._propertiesToSearch = value;
|
|
2452
2473
|
}
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
this.displayedItems = this.items.filter((item) => this.selectedIdMap.has(item[this.context.idProperty]));
|
|
2456
|
-
}
|
|
2457
|
-
else {
|
|
2458
|
-
this.displayedItems = this.items;
|
|
2459
|
-
}
|
|
2474
|
+
get propertiesToSearch() {
|
|
2475
|
+
return this._propertiesToSearch || ['name'];
|
|
2460
2476
|
}
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2477
|
+
/**
|
|
2478
|
+
* Specifies a function to dynamically manage the data source when users
|
|
2479
|
+
* change the text in the lookup field. The search function must return
|
|
2480
|
+
* an array or a promise of an array. The `search` property is particularly
|
|
2481
|
+
* useful when the data source does not live in the source code.
|
|
2482
|
+
*/
|
|
2483
|
+
set search(value) {
|
|
2484
|
+
this._search = value;
|
|
2485
|
+
}
|
|
2486
|
+
get search() {
|
|
2487
|
+
return (this._search ||
|
|
2488
|
+
skyAutocompleteDefaultSearchFunction({
|
|
2489
|
+
propertiesToSearch: this.propertiesToSearch,
|
|
2490
|
+
searchFilters: this.searchFilters,
|
|
2491
|
+
}));
|
|
2468
2492
|
}
|
|
2469
2493
|
}
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
2473
|
-
type:
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2494
|
+
SkyLookupAutocompleteAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAutocompleteAdapter, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2495
|
+
SkyLookupAutocompleteAdapter.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyLookupAutocompleteAdapter, inputs: { debounceTime: "debounceTime", descriptorProperty: "descriptorProperty", propertiesToSearch: "propertiesToSearch", search: "search", searchResultTemplate: "searchResultTemplate", searchTextMinimumCharacters: "searchTextMinimumCharacters", searchFilters: "searchFilters", searchResultsLimit: "searchResultsLimit" }, outputs: { searchAsync: "searchAsync" }, ngImport: i0 });
|
|
2496
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAutocompleteAdapter, decorators: [{
|
|
2497
|
+
type: Directive
|
|
2498
|
+
}], propDecorators: { debounceTime: [{
|
|
2499
|
+
type: Input
|
|
2500
|
+
}], descriptorProperty: [{
|
|
2501
|
+
type: Input
|
|
2502
|
+
}], propertiesToSearch: [{
|
|
2503
|
+
type: Input
|
|
2504
|
+
}], search: [{
|
|
2505
|
+
type: Input
|
|
2506
|
+
}], searchResultTemplate: [{
|
|
2507
|
+
type: Input
|
|
2508
|
+
}], searchTextMinimumCharacters: [{
|
|
2509
|
+
type: Input
|
|
2510
|
+
}], searchFilters: [{
|
|
2511
|
+
type: Input
|
|
2512
|
+
}], searchResultsLimit: [{
|
|
2513
|
+
type: Input
|
|
2514
|
+
}], searchAsync: [{
|
|
2515
|
+
type: Output
|
|
2516
|
+
}] } });
|
|
2481
2517
|
|
|
2482
2518
|
class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
2483
2519
|
constructor(changeDetector, elementRef, windowRef, ngControl, adapter, modalService, resourcesService, inputBoxHostSvc, themeSvc) {
|
|
@@ -2539,7 +2575,7 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2539
2575
|
* @default "mulitple"
|
|
2540
2576
|
*/
|
|
2541
2577
|
set selectMode(value) {
|
|
2542
|
-
|
|
2578
|
+
const multipleToSingle = value === 'single' && this.selectMode === 'multiple';
|
|
2543
2579
|
this._selectMode = value;
|
|
2544
2580
|
this.updateForSelectMode();
|
|
2545
2581
|
if (multipleToSingle) {
|
|
@@ -2789,7 +2825,7 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2789
2825
|
}
|
|
2790
2826
|
createNativePickerInstance(initialSearch) {
|
|
2791
2827
|
var _a;
|
|
2792
|
-
|
|
2828
|
+
const initialValue = this.value;
|
|
2793
2829
|
const modalConfig = ((_a = this.showMoreConfig) === null || _a === void 0 ? void 0 : _a.nativePickerConfig) || {};
|
|
2794
2830
|
if (!modalConfig.itemTemplate) {
|
|
2795
2831
|
modalConfig.itemTemplate = this.searchResultTemplate;
|
|
@@ -2840,7 +2876,7 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2840
2876
|
});
|
|
2841
2877
|
}
|
|
2842
2878
|
else {
|
|
2843
|
-
|
|
2879
|
+
const initialValue = this.value;
|
|
2844
2880
|
this.openNativePicker = this.createNativePickerInstance(initialSearch);
|
|
2845
2881
|
this.openNativePicker.componentInstance.addClick.subscribe(() => {
|
|
2846
2882
|
this.addButtonClicked();
|
|
@@ -2942,7 +2978,8 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2942
2978
|
}
|
|
2943
2979
|
if (this.data.indexOf(args.item) >= 0) {
|
|
2944
2980
|
if (this.openNativePicker) {
|
|
2945
|
-
|
|
2981
|
+
this.openNativePicker
|
|
2982
|
+
.componentInstance.onItemSelect(true, { value: args.item, selected: false });
|
|
2946
2983
|
}
|
|
2947
2984
|
else {
|
|
2948
2985
|
let newValue = this.value;
|
|
@@ -3057,42 +3094,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
3057
3094
|
}]
|
|
3058
3095
|
}] } });
|
|
3059
3096
|
|
|
3060
|
-
class SkySearchModule {
|
|
3061
|
-
}
|
|
3062
|
-
SkySearchModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3063
|
-
SkySearchModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, declarations: [SkySearchComponent], imports: [CommonModule,
|
|
3064
|
-
SkyInputBoxModule,
|
|
3065
|
-
SkyLookupResourcesModule,
|
|
3066
|
-
FormsModule,
|
|
3067
|
-
SkyIconModule,
|
|
3068
|
-
SkyThemeModule,
|
|
3069
|
-
SkyIdModule], exports: [SkySearchComponent] });
|
|
3070
|
-
SkySearchModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, imports: [[
|
|
3071
|
-
CommonModule,
|
|
3072
|
-
SkyInputBoxModule,
|
|
3073
|
-
SkyLookupResourcesModule,
|
|
3074
|
-
FormsModule,
|
|
3075
|
-
SkyIconModule,
|
|
3076
|
-
SkyThemeModule,
|
|
3077
|
-
SkyIdModule,
|
|
3078
|
-
]] });
|
|
3079
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, decorators: [{
|
|
3080
|
-
type: NgModule,
|
|
3081
|
-
args: [{
|
|
3082
|
-
declarations: [SkySearchComponent],
|
|
3083
|
-
imports: [
|
|
3084
|
-
CommonModule,
|
|
3085
|
-
SkyInputBoxModule,
|
|
3086
|
-
SkyLookupResourcesModule,
|
|
3087
|
-
FormsModule,
|
|
3088
|
-
SkyIconModule,
|
|
3089
|
-
SkyThemeModule,
|
|
3090
|
-
SkyIdModule,
|
|
3091
|
-
],
|
|
3092
|
-
exports: [SkySearchComponent],
|
|
3093
|
-
}]
|
|
3094
|
-
}] });
|
|
3095
|
-
|
|
3096
3097
|
class SkyLookupModule {
|
|
3097
3098
|
}
|
|
3098
3099
|
SkyLookupModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|