@skyux/lookup 5.5.0 → 5.6.2
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 +1034 -1049
- package/documentation.json +664 -782
- package/esm2015/lib/modules/autocomplete/autocomplete-adapter.service.js +0 -1
- 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 +6 -5
- 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 +11 -5
- 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 +9 -9
- 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 +7 -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 +16 -14
- 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 +523 -538
- package/fesm2015/skyux-lookup.js.map +1 -1
- package/lib/modules/autocomplete/autocomplete-adapter.service.d.ts +0 -1
- package/lib/modules/autocomplete/autocomplete-default-search-function.d.ts +1 -1
- package/lib/modules/autocomplete/autocomplete.component.d.ts +10 -4
- package/lib/modules/autocomplete/types/autocomplete-search-async-args.d.ts +1 -1
- package/lib/modules/country-field/country-field.component.d.ts +5 -5
- package/lib/modules/lookup/lookup-autocomplete-adapter.d.ts +7 -1
- package/lib/modules/lookup/lookup.component.d.ts +3 -3
- package/lib/modules/search/search.component.d.ts +1 -1
- package/package.json +21 -18
- package/esm2015/lib/polyfills.js +0 -30
- package/esm2015/lib/polyfills.js.map +0 -1
- package/lib/polyfills.d.ts +0 -0
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,
|
|
@@ -264,7 +116,8 @@ class SkyAutocompleteInputDirective {
|
|
|
264
116
|
this._disabled = false;
|
|
265
117
|
this._focus = new Subject();
|
|
266
118
|
this._textChanges = new Subject();
|
|
267
|
-
|
|
119
|
+
// istanbul ignore next
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
268
121
|
this.onValidatorChange = () => { };
|
|
269
122
|
}
|
|
270
123
|
/**
|
|
@@ -428,9 +281,9 @@ class SkyAutocompleteInputDirective {
|
|
|
428
281
|
}
|
|
429
282
|
}
|
|
430
283
|
// Angular automatically constructs these methods.
|
|
431
|
-
|
|
284
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
432
285
|
onChange(value) { }
|
|
433
|
-
|
|
286
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
434
287
|
onTouched() { }
|
|
435
288
|
setAttributes(element) {
|
|
436
289
|
this.renderer.setAttribute(element, 'autocomplete', this.autocompleteAttribute);
|
|
@@ -474,6 +327,124 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
474
327
|
}]
|
|
475
328
|
}] });
|
|
476
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Removes diacritical characters from strings and replaces them with their normalized equivalent.
|
|
332
|
+
* For example: è becomes e, Å becomes A.
|
|
333
|
+
*/
|
|
334
|
+
function normalizeDiacritics(value) {
|
|
335
|
+
return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* @internal
|
|
340
|
+
*/
|
|
341
|
+
class SkyAutocompleteAdapterService {
|
|
342
|
+
constructor(coreAdapterService, rendererFactory) {
|
|
343
|
+
this.coreAdapterService = coreAdapterService;
|
|
344
|
+
this.rendererFactory = rendererFactory;
|
|
345
|
+
this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Adds the className for the provided element.
|
|
349
|
+
*/
|
|
350
|
+
addCSSClass(element, className) {
|
|
351
|
+
/* Sanity check */
|
|
352
|
+
/* istanbul ignore else */
|
|
353
|
+
if (element) {
|
|
354
|
+
this.renderer.addClass(element, className);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
getOverlayFocusableElements(overlay) {
|
|
358
|
+
return this.coreAdapterService.getFocusableChildren(
|
|
359
|
+
/* Sanity check - calling function also has null check */
|
|
360
|
+
/* istanbul ignore next */
|
|
361
|
+
overlay === null || overlay === void 0 ? void 0 : overlay.componentRef.location.nativeElement, { ignoreTabIndex: true });
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Removes the className for the provided element.
|
|
365
|
+
*/
|
|
366
|
+
removeCSSClass(element, className) {
|
|
367
|
+
/* Sanity check */
|
|
368
|
+
/* istanbul ignore else */
|
|
369
|
+
if (element) {
|
|
370
|
+
this.renderer.removeClass(element, className);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
setDropdownWidth(elementRef, dropdownRef, isInputBox) {
|
|
374
|
+
const parentElement = isInputBox
|
|
375
|
+
? elementRef.nativeElement.closest('.sky-input-box')
|
|
376
|
+
: elementRef.nativeElement;
|
|
377
|
+
if (parentElement) {
|
|
378
|
+
const width = parentElement.getBoundingClientRect().width;
|
|
379
|
+
this.renderer.setStyle(dropdownRef.nativeElement, 'width', `${width}px`);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Sets the `tabIndex` of the `element` to the provided `tabIndex`.
|
|
384
|
+
*/
|
|
385
|
+
setTabIndex(element, tabIndex) {
|
|
386
|
+
element.tabIndex = tabIndex;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
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 });
|
|
390
|
+
SkyAutocompleteAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyAutocompleteAdapterService });
|
|
391
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyAutocompleteAdapterService, decorators: [{
|
|
392
|
+
type: Injectable
|
|
393
|
+
}], ctorParameters: function () { return [{ type: i1.SkyCoreAdapterService }, { type: i0.RendererFactory2 }]; } });
|
|
394
|
+
|
|
395
|
+
function skyAutocompleteDefaultSearchFunction(options) {
|
|
396
|
+
const filterData = function (searchText, data) {
|
|
397
|
+
return data.filter((item) => {
|
|
398
|
+
if (!options.searchFilters || !options.searchFilters.length) {
|
|
399
|
+
return true;
|
|
400
|
+
}
|
|
401
|
+
// Find the first failing filter (we can skip the others if one fails).
|
|
402
|
+
const failedFilter = options.searchFilters.find((filter) => {
|
|
403
|
+
return !filter.call({}, searchText, item);
|
|
404
|
+
});
|
|
405
|
+
return failedFilter === undefined;
|
|
406
|
+
});
|
|
407
|
+
};
|
|
408
|
+
const search = function (searchText, data) {
|
|
409
|
+
const results = [];
|
|
410
|
+
/* Sanity check - autocomplete will not call search with empty search text */
|
|
411
|
+
/* istanbul ignore if */
|
|
412
|
+
if (!searchText) {
|
|
413
|
+
return results;
|
|
414
|
+
}
|
|
415
|
+
const searchTextNormalized = normalizeDiacritics(searchText).toUpperCase();
|
|
416
|
+
const filteredData = filterData(searchText, data);
|
|
417
|
+
for (let i = 0, n = filteredData.length; i < n; i++) {
|
|
418
|
+
const result = filteredData[i];
|
|
419
|
+
const isMatch = options.propertiesToSearch.find((property) => {
|
|
420
|
+
let value = (result[property] || '').toString();
|
|
421
|
+
value = normalizeDiacritics(value).toUpperCase();
|
|
422
|
+
return value.indexOf(searchTextNormalized) > -1;
|
|
423
|
+
});
|
|
424
|
+
if (isMatch) {
|
|
425
|
+
results.push(result);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return results;
|
|
429
|
+
};
|
|
430
|
+
return search;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* @internal
|
|
435
|
+
*/
|
|
436
|
+
var SkyAutocompleteMessageType;
|
|
437
|
+
(function (SkyAutocompleteMessageType) {
|
|
438
|
+
/**
|
|
439
|
+
* Closes the dropdown.
|
|
440
|
+
*/
|
|
441
|
+
SkyAutocompleteMessageType[SkyAutocompleteMessageType["CloseDropdown"] = 0] = "CloseDropdown";
|
|
442
|
+
/**
|
|
443
|
+
* Repositions the dropdown.
|
|
444
|
+
*/
|
|
445
|
+
SkyAutocompleteMessageType[SkyAutocompleteMessageType["RepositionDropdown"] = 1] = "RepositionDropdown";
|
|
446
|
+
})(SkyAutocompleteMessageType || (SkyAutocompleteMessageType = {}));
|
|
447
|
+
|
|
477
448
|
let uniqueId$1 = 0;
|
|
478
449
|
class SkyAutocompleteComponent {
|
|
479
450
|
constructor(changeDetector, elementRef, affixService, adapterService, overlayService, inputBoxHostSvc) {
|
|
@@ -509,6 +480,10 @@ class SkyAutocompleteComponent {
|
|
|
509
480
|
* Fires when users select the button to view all options.
|
|
510
481
|
*/
|
|
511
482
|
this.showMoreClick = new EventEmitter();
|
|
483
|
+
/**
|
|
484
|
+
* Fires when users enter new search information and allows results to be
|
|
485
|
+
* returned via an observable.
|
|
486
|
+
*/
|
|
512
487
|
this.searchAsync = new EventEmitter();
|
|
513
488
|
this.isOpen = false;
|
|
514
489
|
this.isSearchingAsync = false;
|
|
@@ -532,7 +507,7 @@ class SkyAutocompleteComponent {
|
|
|
532
507
|
/**
|
|
533
508
|
* Specifies a static data source for the autocomplete component to search
|
|
534
509
|
* when users enter text. For a dynamic data source such as an array that
|
|
535
|
-
* changes due to server calls, use
|
|
510
|
+
* changes due to server calls, use `search` or `searchAsync` instead.
|
|
536
511
|
*/
|
|
537
512
|
set data(value) {
|
|
538
513
|
this._data = value;
|
|
@@ -587,7 +562,9 @@ class SkyAutocompleteComponent {
|
|
|
587
562
|
* Specifies a function to dynamically manage the data source when users
|
|
588
563
|
* change the text in the autocomplete field. The search function must return
|
|
589
564
|
* an array or a promise of an array. The `search` property is particularly
|
|
590
|
-
* useful when the data source does not live in the source code.
|
|
565
|
+
* useful when the data source does not live in the source code. If the
|
|
566
|
+
* search requires calling a remote data source, use `searchAsync` instead of
|
|
567
|
+
* `search`.
|
|
591
568
|
*/
|
|
592
569
|
set search(value) {
|
|
593
570
|
this._search = value;
|
|
@@ -1271,9 +1248,9 @@ class SkyCountryFieldComponent {
|
|
|
1271
1248
|
this._disabled = false;
|
|
1272
1249
|
this._includePhoneInfo = false;
|
|
1273
1250
|
// Angular automatically constructs these methods.
|
|
1274
|
-
|
|
1251
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1275
1252
|
this.onChange = (value) => { };
|
|
1276
|
-
|
|
1253
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1277
1254
|
this.onTouched = () => { };
|
|
1278
1255
|
this.setupCountries();
|
|
1279
1256
|
this.countrySearchFormControl = new FormControl();
|
|
@@ -1338,7 +1315,7 @@ class SkyCountryFieldComponent {
|
|
|
1338
1315
|
set selectedCountry(newCountry) {
|
|
1339
1316
|
if (!this.countriesAreEqual(this.selectedCountry, newCountry)) {
|
|
1340
1317
|
if (newCountry && newCountry.iso2) {
|
|
1341
|
-
|
|
1318
|
+
const isoCountry = this.countries.find((country) => country.iso2 === newCountry.iso2);
|
|
1342
1319
|
if (isoCountry) {
|
|
1343
1320
|
newCountry = isoCountry;
|
|
1344
1321
|
}
|
|
@@ -1518,7 +1495,7 @@ class SkyCountryFieldComponent {
|
|
|
1518
1495
|
// Ignoring coverage here as this will be removed in the next release.
|
|
1519
1496
|
// istanbul ignore next
|
|
1520
1497
|
if (!this.includePhoneInfo && !this.hideSelectedCountryFlag) {
|
|
1521
|
-
if ((_b = (_a =
|
|
1498
|
+
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
1499
|
this.includePhoneInfo = true;
|
|
1523
1500
|
this.hideSelectedCountryFlag = true;
|
|
1524
1501
|
}
|
|
@@ -1545,7 +1522,7 @@ class SkyCountryFieldComponent {
|
|
|
1545
1522
|
sortCountriesWithSelectedAndDefault(selectedCountry) {
|
|
1546
1523
|
let selectedCountryIndex;
|
|
1547
1524
|
let selectedCountryData;
|
|
1548
|
-
|
|
1525
|
+
const sortedNewCountries = this.countries.sort((a, b) => {
|
|
1549
1526
|
if (((this.defaultCountryData &&
|
|
1550
1527
|
this.countriesEqual(a, this.defaultCountryData)) ||
|
|
1551
1528
|
a.name < b.name) &&
|
|
@@ -1665,101 +1642,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1665
1642
|
}]
|
|
1666
1643
|
}] });
|
|
1667
1644
|
|
|
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
1645
|
/**
|
|
1764
1646
|
* @internal
|
|
1765
1647
|
*/
|
|
@@ -1774,9 +1656,9 @@ class SkySearchAdapterService {
|
|
|
1774
1656
|
this.getInputEl(searchEl).focus();
|
|
1775
1657
|
}
|
|
1776
1658
|
startInputAnimation(searchEl) {
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1659
|
+
const buttonWidth = this.getSearchOpenButtonEl(searchEl).clientWidth;
|
|
1660
|
+
const offsetWidth = this.getSearchContainerEl(searchEl).offsetLeft;
|
|
1661
|
+
const minWidth = buttonWidth + offsetWidth;
|
|
1780
1662
|
this.getInputContainerEl(searchEl).style.minWidth =
|
|
1781
1663
|
minWidth.toString() + 'px';
|
|
1782
1664
|
this.renderer.setStyle(this.getInputContainerEl(searchEl), 'min-width', minWidth.toString() + 'px');
|
|
@@ -2048,6 +1930,238 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
2048
1930
|
type: Input
|
|
2049
1931
|
}] } });
|
|
2050
1932
|
|
|
1933
|
+
class SkySearchModule {
|
|
1934
|
+
}
|
|
1935
|
+
SkySearchModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1936
|
+
SkySearchModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, declarations: [SkySearchComponent], imports: [CommonModule,
|
|
1937
|
+
SkyInputBoxModule,
|
|
1938
|
+
SkyLookupResourcesModule,
|
|
1939
|
+
FormsModule,
|
|
1940
|
+
SkyIconModule,
|
|
1941
|
+
SkyThemeModule,
|
|
1942
|
+
SkyIdModule], exports: [SkySearchComponent] });
|
|
1943
|
+
SkySearchModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, imports: [[
|
|
1944
|
+
CommonModule,
|
|
1945
|
+
SkyInputBoxModule,
|
|
1946
|
+
SkyLookupResourcesModule,
|
|
1947
|
+
FormsModule,
|
|
1948
|
+
SkyIconModule,
|
|
1949
|
+
SkyThemeModule,
|
|
1950
|
+
SkyIdModule,
|
|
1951
|
+
]] });
|
|
1952
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, decorators: [{
|
|
1953
|
+
type: NgModule,
|
|
1954
|
+
args: [{
|
|
1955
|
+
declarations: [SkySearchComponent],
|
|
1956
|
+
imports: [
|
|
1957
|
+
CommonModule,
|
|
1958
|
+
SkyInputBoxModule,
|
|
1959
|
+
SkyLookupResourcesModule,
|
|
1960
|
+
FormsModule,
|
|
1961
|
+
SkyIconModule,
|
|
1962
|
+
SkyThemeModule,
|
|
1963
|
+
SkyIdModule,
|
|
1964
|
+
],
|
|
1965
|
+
exports: [SkySearchComponent],
|
|
1966
|
+
}]
|
|
1967
|
+
}] });
|
|
1968
|
+
|
|
1969
|
+
class SkyLookupItemSelectedPipe {
|
|
1970
|
+
transform(id, selectedIdMap) {
|
|
1971
|
+
return selectedIdMap.has(id);
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
SkyLookupItemSelectedPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupItemSelectedPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1975
|
+
SkyLookupItemSelectedPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupItemSelectedPipe, name: "skyLookupItemSelected" });
|
|
1976
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupItemSelectedPipe, decorators: [{
|
|
1977
|
+
type: Pipe,
|
|
1978
|
+
args: [{
|
|
1979
|
+
name: 'skyLookupItemSelected',
|
|
1980
|
+
}]
|
|
1981
|
+
}] });
|
|
1982
|
+
|
|
1983
|
+
/**
|
|
1984
|
+
* @internal
|
|
1985
|
+
* Context for the show more native picker. These values are provided by the lookup component.
|
|
1986
|
+
*/
|
|
1987
|
+
class SkyLookupShowMoreNativePickerAsyncContext {
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
/**
|
|
1991
|
+
* @internal
|
|
1992
|
+
* Internal component to implement the native picker.
|
|
1993
|
+
*/
|
|
1994
|
+
class SkyLookupShowMoreAsyncModalComponent {
|
|
1995
|
+
constructor(modalInstance, context, changeDetector) {
|
|
1996
|
+
this.modalInstance = modalInstance;
|
|
1997
|
+
this.context = context;
|
|
1998
|
+
this.changeDetector = changeDetector;
|
|
1999
|
+
/**
|
|
2000
|
+
* @internal
|
|
2001
|
+
* Fires when users select the button to add new options to the list.
|
|
2002
|
+
*/
|
|
2003
|
+
this.addClick = new Subject();
|
|
2004
|
+
this.displayedItems = [];
|
|
2005
|
+
this.onlyShowSelected = false;
|
|
2006
|
+
this.isSearching = false;
|
|
2007
|
+
this.hasMoreItems = false;
|
|
2008
|
+
this.isLoadingMore = false;
|
|
2009
|
+
this.offset = 0;
|
|
2010
|
+
this.ngUnsubscribe = new Subject();
|
|
2011
|
+
}
|
|
2012
|
+
ngOnInit() {
|
|
2013
|
+
this.searchText = this.context.initialSearch;
|
|
2014
|
+
this.createInitialSelectedItemsMap();
|
|
2015
|
+
this.loadSearchResults();
|
|
2016
|
+
}
|
|
2017
|
+
ngOnDestroy() {
|
|
2018
|
+
this.cancelCurrentSearch();
|
|
2019
|
+
this.ngUnsubscribe.next();
|
|
2020
|
+
this.ngUnsubscribe.complete();
|
|
2021
|
+
}
|
|
2022
|
+
addButtonClicked() {
|
|
2023
|
+
this.addClick.next();
|
|
2024
|
+
}
|
|
2025
|
+
clearAll() {
|
|
2026
|
+
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2027
|
+
// Only deselect items that have been loaded; items that would be loaded
|
|
2028
|
+
// after an infinite scroll event should remain selected.
|
|
2029
|
+
for (const item of this.items) {
|
|
2030
|
+
this.selectedIdMap.delete(item[this.context.idProperty]);
|
|
2031
|
+
}
|
|
2032
|
+
this.updateDisplayedItems();
|
|
2033
|
+
this.changeDetector.markForCheck();
|
|
2034
|
+
}
|
|
2035
|
+
itemClick(selectedItem) {
|
|
2036
|
+
if (this.context.selectMode === 'single') {
|
|
2037
|
+
this.onItemSelect(!selectedItem.selected, selectedItem);
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
onItemSelect(newSelectState, itemToSelect) {
|
|
2041
|
+
const itemId = itemToSelect[this.context.idProperty];
|
|
2042
|
+
// Create a new Map so the pipe transform will execute on the next
|
|
2043
|
+
// change detection cycle.
|
|
2044
|
+
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2045
|
+
if (this.context.selectMode === 'single') {
|
|
2046
|
+
if (newSelectState) {
|
|
2047
|
+
this.selectedIdMap.clear();
|
|
2048
|
+
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
else {
|
|
2052
|
+
if (newSelectState) {
|
|
2053
|
+
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2054
|
+
}
|
|
2055
|
+
else {
|
|
2056
|
+
this.selectedIdMap.delete(itemId);
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
this.updateDisplayedItems();
|
|
2060
|
+
}
|
|
2061
|
+
searchApplied(searchText) {
|
|
2062
|
+
this.offset = 0;
|
|
2063
|
+
this.searchText = searchText;
|
|
2064
|
+
this.loadSearchResults();
|
|
2065
|
+
}
|
|
2066
|
+
selectAll() {
|
|
2067
|
+
this.selectedIdMap = new Map();
|
|
2068
|
+
for (const item of this.items) {
|
|
2069
|
+
this.selectedIdMap.set(item[this.context.idProperty], item);
|
|
2070
|
+
}
|
|
2071
|
+
this.updateDisplayedItems();
|
|
2072
|
+
}
|
|
2073
|
+
infiniteScrollEnd() {
|
|
2074
|
+
this.cancelCurrentSearch();
|
|
2075
|
+
/* Sanity check - else case would only happen if this was called directly */
|
|
2076
|
+
/* istanbul ignore else */
|
|
2077
|
+
if (this.hasMoreItems) {
|
|
2078
|
+
this.isLoadingMore = true;
|
|
2079
|
+
this.performSearch((result) => {
|
|
2080
|
+
this.items = this.items.concat(result.items);
|
|
2081
|
+
this.updateDisplayedItems();
|
|
2082
|
+
this.isLoadingMore = false;
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
save() {
|
|
2087
|
+
const selectedItems = Array.from(this.selectedIdMap.values(), (itemData, index) => ({
|
|
2088
|
+
index,
|
|
2089
|
+
itemData,
|
|
2090
|
+
})).sort((a, b) => {
|
|
2091
|
+
return this.items.indexOf(a.itemData) < this.items.indexOf(b.itemData)
|
|
2092
|
+
? -1
|
|
2093
|
+
: 1;
|
|
2094
|
+
});
|
|
2095
|
+
this.modalInstance.save(selectedItems);
|
|
2096
|
+
}
|
|
2097
|
+
loadSearchResults() {
|
|
2098
|
+
this.cancelCurrentSearch();
|
|
2099
|
+
this.isSearching = true;
|
|
2100
|
+
this.performSearch((result) => {
|
|
2101
|
+
this.isSearching = false;
|
|
2102
|
+
this.items = result.items;
|
|
2103
|
+
});
|
|
2104
|
+
}
|
|
2105
|
+
createInitialSelectedItemsMap() {
|
|
2106
|
+
this.selectedIdMap = new Map(this.context.initialValue.map((item) => [
|
|
2107
|
+
item[this.context.idProperty],
|
|
2108
|
+
item,
|
|
2109
|
+
]));
|
|
2110
|
+
}
|
|
2111
|
+
performSearch(processResults) {
|
|
2112
|
+
this.currentSearchSub = this.context
|
|
2113
|
+
.searchAsync({
|
|
2114
|
+
displayType: 'modal',
|
|
2115
|
+
offset: this.offset,
|
|
2116
|
+
searchText: this.searchText || '',
|
|
2117
|
+
continuationData: this.continuationData,
|
|
2118
|
+
})
|
|
2119
|
+
.pipe(take(1))
|
|
2120
|
+
.subscribe((result) => {
|
|
2121
|
+
processResults(result);
|
|
2122
|
+
this.continuationData = result.continuationData;
|
|
2123
|
+
this.hasMoreItems = result.hasMore;
|
|
2124
|
+
this.offset = this.items.length;
|
|
2125
|
+
this.updateDisplayedItems();
|
|
2126
|
+
this.changeDetector.markForCheck();
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
2129
|
+
updateDisplayedItems() {
|
|
2130
|
+
if (this.onlyShowSelected) {
|
|
2131
|
+
this.displayedItems = this.items.filter((item) => this.selectedIdMap.has(item[this.context.idProperty]));
|
|
2132
|
+
}
|
|
2133
|
+
else {
|
|
2134
|
+
this.displayedItems = this.items;
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
cancelCurrentSearch() {
|
|
2138
|
+
if (this.currentSearchSub) {
|
|
2139
|
+
this.currentSearchSub.unsubscribe();
|
|
2140
|
+
this.currentSearchSub = undefined;
|
|
2141
|
+
this.isLoadingMore = false;
|
|
2142
|
+
this.isSearching = false;
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
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 });
|
|
2147
|
+
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 });
|
|
2148
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupShowMoreAsyncModalComponent, decorators: [{
|
|
2149
|
+
type: Component,
|
|
2150
|
+
args: [{
|
|
2151
|
+
selector: 'sky-lookup-show-more-async-modal',
|
|
2152
|
+
templateUrl: './lookup-show-more-async-modal.component.html',
|
|
2153
|
+
styleUrls: ['./lookup-show-more-async-modal.component.scss'],
|
|
2154
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2155
|
+
}]
|
|
2156
|
+
}], ctorParameters: function () { return [{ type: i1$1.SkyModalInstance }, { type: SkyLookupShowMoreNativePickerAsyncContext }, { type: i0.ChangeDetectorRef }]; } });
|
|
2157
|
+
|
|
2158
|
+
/**
|
|
2159
|
+
* @internal
|
|
2160
|
+
* Context for the show more native picker. These values are provided by the lookup component.
|
|
2161
|
+
*/
|
|
2162
|
+
class SkyLookupShowMoreNativePickerContext {
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2051
2165
|
/**
|
|
2052
2166
|
* @internal
|
|
2053
2167
|
* Internal component to implement the native picker.
|
|
@@ -2098,7 +2212,7 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2098
2212
|
}
|
|
2099
2213
|
addItems() {
|
|
2100
2214
|
if (!this.items || this.items.length === 0) {
|
|
2101
|
-
|
|
2215
|
+
const selectedItems = this.selectedItems.slice();
|
|
2102
2216
|
this.items = this.context.items
|
|
2103
2217
|
? this.context.items.map((item) => {
|
|
2104
2218
|
return {
|
|
@@ -2173,9 +2287,9 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2173
2287
|
}
|
|
2174
2288
|
}
|
|
2175
2289
|
else {
|
|
2176
|
-
|
|
2290
|
+
const selectedItems = this.selectedItems;
|
|
2177
2291
|
const allItemsIndex = this.items.findIndex((item) => item.value === itemToSelect.value);
|
|
2178
|
-
|
|
2292
|
+
const selectedItemsIndex = selectedItems.findIndex((selectedItem) => selectedItem.index === allItemsIndex);
|
|
2179
2293
|
if (newSelectState && selectedItemsIndex === -1) {
|
|
2180
2294
|
selectedItems.push({
|
|
2181
2295
|
index: allItemsIndex,
|
|
@@ -2199,7 +2313,7 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2199
2313
|
this.updateDataState();
|
|
2200
2314
|
}
|
|
2201
2315
|
searchItems(items) {
|
|
2202
|
-
|
|
2316
|
+
const searchText = this.searchText;
|
|
2203
2317
|
if (searchText) {
|
|
2204
2318
|
const resultValues = this.context.search(searchText, items.map((item) => {
|
|
2205
2319
|
return item.value;
|
|
@@ -2220,7 +2334,7 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2220
2334
|
}
|
|
2221
2335
|
}
|
|
2222
2336
|
selectAll() {
|
|
2223
|
-
|
|
2337
|
+
const selectedItems = this.selectedItems;
|
|
2224
2338
|
this.displayedItems.forEach((item) => {
|
|
2225
2339
|
if (!item.selected) {
|
|
2226
2340
|
item.selected = true;
|
|
@@ -2234,250 +2348,155 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2234
2348
|
});
|
|
2235
2349
|
}
|
|
2236
2350
|
}
|
|
2237
|
-
});
|
|
2238
|
-
this.selectedItems = selectedItems;
|
|
2239
|
-
this.updateDataState();
|
|
2240
|
-
this.changeDetector.markForCheck();
|
|
2241
|
-
}
|
|
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);
|
|
2373
|
-
}
|
|
2374
|
-
}
|
|
2375
|
-
else {
|
|
2376
|
-
if (newSelectState) {
|
|
2377
|
-
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2351
|
+
});
|
|
2352
|
+
this.selectedItems = selectedItems;
|
|
2353
|
+
this.updateDataState();
|
|
2354
|
+
this.changeDetector.markForCheck();
|
|
2355
|
+
}
|
|
2356
|
+
updateDataState() {
|
|
2357
|
+
const selectedItems = this.selectedItems;
|
|
2358
|
+
this.items.forEach((item, index) => {
|
|
2359
|
+
item.selected =
|
|
2360
|
+
selectedItems.findIndex((selectedItem) => selectedItem.index === index) !== -1;
|
|
2361
|
+
});
|
|
2362
|
+
this.searchItems(this.items).then((searchedItems) => {
|
|
2363
|
+
if (this.onlyShowSelected) {
|
|
2364
|
+
searchedItems = searchedItems.filter((item) => item.selected);
|
|
2365
|
+
}
|
|
2366
|
+
this.displayedItems = searchedItems.slice(0, this.itemIndex);
|
|
2367
|
+
if (this.itemIndex > searchedItems.length) {
|
|
2368
|
+
this.itemsHaveMore = false;
|
|
2378
2369
|
}
|
|
2379
2370
|
else {
|
|
2380
|
-
this.
|
|
2371
|
+
this.itemsHaveMore = true;
|
|
2381
2372
|
}
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
}
|
|
2385
|
-
searchApplied(searchText) {
|
|
2386
|
-
this.offset = 0;
|
|
2387
|
-
this.searchText = searchText;
|
|
2388
|
-
this.loadSearchResults();
|
|
2373
|
+
this.changeDetector.markForCheck();
|
|
2374
|
+
});
|
|
2389
2375
|
}
|
|
2390
|
-
|
|
2391
|
-
this.
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2376
|
+
updateItemData(data) {
|
|
2377
|
+
this.context.items = data;
|
|
2378
|
+
this.items = undefined;
|
|
2379
|
+
this.itemIndex = 10;
|
|
2380
|
+
this.selectedItems.forEach((selectedItem) => {
|
|
2381
|
+
this.context.items.forEach((item, index) => {
|
|
2382
|
+
if (selectedItem.itemData === item) {
|
|
2383
|
+
selectedItem.index = index;
|
|
2384
|
+
}
|
|
2385
|
+
});
|
|
2386
|
+
});
|
|
2387
|
+
this.addItems();
|
|
2388
|
+
this.changeDetector.markForCheck();
|
|
2396
2389
|
}
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2390
|
+
}
|
|
2391
|
+
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 });
|
|
2392
|
+
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 });
|
|
2393
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupShowMoreModalComponent, decorators: [{
|
|
2394
|
+
type: Component,
|
|
2395
|
+
args: [{
|
|
2396
|
+
// Suppress this error rather than fix the selector since consumers with unit tests
|
|
2397
|
+
// may be looking for an element with this selector. We can change it in the next major
|
|
2398
|
+
// version of SKY UX.
|
|
2399
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
2400
|
+
selector: 'skyux-lookup-show-more-modal',
|
|
2401
|
+
templateUrl: './lookup-show-more-modal.component.html',
|
|
2402
|
+
styleUrls: ['./lookup-show-more-modal.component.scss'],
|
|
2403
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2404
|
+
}]
|
|
2405
|
+
}], ctorParameters: function () { return [{ type: i1$1.SkyModalInstance }, { type: SkyLookupShowMoreNativePickerContext }, { type: i0.ChangeDetectorRef }]; } });
|
|
2406
|
+
|
|
2407
|
+
/**
|
|
2408
|
+
* @internal
|
|
2409
|
+
*/
|
|
2410
|
+
class SkyLookupAdapterService {
|
|
2411
|
+
focusInput(elRef) {
|
|
2412
|
+
const inputEl = elRef.nativeElement.querySelector('.sky-lookup-input');
|
|
2413
|
+
/* Sanity check */
|
|
2400
2414
|
/* 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
|
-
});
|
|
2415
|
+
if (inputEl) {
|
|
2416
|
+
inputEl.focus();
|
|
2408
2417
|
}
|
|
2409
2418
|
}
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2419
|
+
}
|
|
2420
|
+
SkyLookupAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2421
|
+
SkyLookupAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAdapterService });
|
|
2422
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAdapterService, decorators: [{
|
|
2423
|
+
type: Injectable
|
|
2424
|
+
}] });
|
|
2425
|
+
|
|
2426
|
+
/**
|
|
2427
|
+
* @internal
|
|
2428
|
+
*/
|
|
2429
|
+
class SkyLookupAutocompleteAdapter {
|
|
2430
|
+
constructor() {
|
|
2431
|
+
/**
|
|
2432
|
+
* Fires when users enter new search information and allows results to be
|
|
2433
|
+
* returned via an observable.
|
|
2434
|
+
*/
|
|
2435
|
+
this.searchAsync = new EventEmitter();
|
|
2420
2436
|
}
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2437
|
+
/**
|
|
2438
|
+
* Specifies an object property to display in the text input after users
|
|
2439
|
+
* select an item in the dropdown list.
|
|
2440
|
+
* @default "name"
|
|
2441
|
+
*/
|
|
2442
|
+
set descriptorProperty(value) {
|
|
2443
|
+
this._descriptorProperty = value;
|
|
2428
2444
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
item[this.context.idProperty],
|
|
2432
|
-
item,
|
|
2433
|
-
]));
|
|
2445
|
+
get descriptorProperty() {
|
|
2446
|
+
return this._descriptorProperty || 'name';
|
|
2434
2447
|
}
|
|
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
|
-
});
|
|
2448
|
+
/**
|
|
2449
|
+
* Specifies an array of object properties to search.
|
|
2450
|
+
* @default ["name"]
|
|
2451
|
+
*/
|
|
2452
|
+
set propertiesToSearch(value) {
|
|
2453
|
+
this._propertiesToSearch = value;
|
|
2452
2454
|
}
|
|
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
|
-
}
|
|
2455
|
+
get propertiesToSearch() {
|
|
2456
|
+
return this._propertiesToSearch || ['name'];
|
|
2460
2457
|
}
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2458
|
+
/**
|
|
2459
|
+
* Specifies a function to dynamically manage the data source when users
|
|
2460
|
+
* change the text in the lookup field. The search function must return
|
|
2461
|
+
* an array or a promise of an array. The `search` property is particularly
|
|
2462
|
+
* useful when the data source does not live in the source code. If the
|
|
2463
|
+
* search requires calling a remote data source, use `searchAsync` instead of
|
|
2464
|
+
* `search`.
|
|
2465
|
+
*/
|
|
2466
|
+
set search(value) {
|
|
2467
|
+
this._search = value;
|
|
2468
|
+
}
|
|
2469
|
+
get search() {
|
|
2470
|
+
return (this._search ||
|
|
2471
|
+
skyAutocompleteDefaultSearchFunction({
|
|
2472
|
+
propertiesToSearch: this.propertiesToSearch,
|
|
2473
|
+
searchFilters: this.searchFilters,
|
|
2474
|
+
}));
|
|
2468
2475
|
}
|
|
2469
2476
|
}
|
|
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
|
-
|
|
2477
|
+
SkyLookupAutocompleteAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAutocompleteAdapter, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2478
|
+
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 });
|
|
2479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAutocompleteAdapter, decorators: [{
|
|
2480
|
+
type: Directive
|
|
2481
|
+
}], propDecorators: { debounceTime: [{
|
|
2482
|
+
type: Input
|
|
2483
|
+
}], descriptorProperty: [{
|
|
2484
|
+
type: Input
|
|
2485
|
+
}], propertiesToSearch: [{
|
|
2486
|
+
type: Input
|
|
2487
|
+
}], search: [{
|
|
2488
|
+
type: Input
|
|
2489
|
+
}], searchResultTemplate: [{
|
|
2490
|
+
type: Input
|
|
2491
|
+
}], searchTextMinimumCharacters: [{
|
|
2492
|
+
type: Input
|
|
2493
|
+
}], searchFilters: [{
|
|
2494
|
+
type: Input
|
|
2495
|
+
}], searchResultsLimit: [{
|
|
2496
|
+
type: Input
|
|
2497
|
+
}], searchAsync: [{
|
|
2498
|
+
type: Output
|
|
2499
|
+
}] } });
|
|
2481
2500
|
|
|
2482
2501
|
class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
2483
2502
|
constructor(changeDetector, elementRef, windowRef, ngControl, adapter, modalService, resourcesService, inputBoxHostSvc, themeSvc) {
|
|
@@ -2513,9 +2532,9 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2513
2532
|
this.idle = new Subject();
|
|
2514
2533
|
this.markForTokenFocusOnKeyUp = false;
|
|
2515
2534
|
// Angular automatically constructs these methods.
|
|
2516
|
-
|
|
2535
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2517
2536
|
this.onChange = (value) => { };
|
|
2518
|
-
|
|
2537
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2519
2538
|
this.onTouched = () => { };
|
|
2520
2539
|
ngControl.valueAccessor = this;
|
|
2521
2540
|
}
|
|
@@ -2539,7 +2558,7 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2539
2558
|
* @default "mulitple"
|
|
2540
2559
|
*/
|
|
2541
2560
|
set selectMode(value) {
|
|
2542
|
-
|
|
2561
|
+
const multipleToSingle = value === 'single' && this.selectMode === 'multiple';
|
|
2543
2562
|
this._selectMode = value;
|
|
2544
2563
|
this.updateForSelectMode();
|
|
2545
2564
|
if (multipleToSingle) {
|
|
@@ -2774,8 +2793,9 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2774
2793
|
let isValueInTextBox = false;
|
|
2775
2794
|
if (this.selectMode === 'single') {
|
|
2776
2795
|
isValueInTextBox =
|
|
2777
|
-
this.autocompleteInputDirective.
|
|
2778
|
-
this.autocompleteInputDirective.
|
|
2796
|
+
this.autocompleteInputDirective.value &&
|
|
2797
|
+
this.autocompleteInputDirective.inputTextValue ===
|
|
2798
|
+
this.autocompleteInputDirective.value[this.descriptorProperty];
|
|
2779
2799
|
}
|
|
2780
2800
|
this.openPicker(isValueInTextBox ? '' : this.autocompleteInputDirective.inputTextValue);
|
|
2781
2801
|
this.autocompleteInputDirective.restoreInputTextValueToPreviousState();
|
|
@@ -2789,7 +2809,7 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2789
2809
|
}
|
|
2790
2810
|
createNativePickerInstance(initialSearch) {
|
|
2791
2811
|
var _a;
|
|
2792
|
-
|
|
2812
|
+
const initialValue = this.value;
|
|
2793
2813
|
const modalConfig = ((_a = this.showMoreConfig) === null || _a === void 0 ? void 0 : _a.nativePickerConfig) || {};
|
|
2794
2814
|
if (!modalConfig.itemTemplate) {
|
|
2795
2815
|
modalConfig.itemTemplate = this.searchResultTemplate;
|
|
@@ -2840,7 +2860,7 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2840
2860
|
});
|
|
2841
2861
|
}
|
|
2842
2862
|
else {
|
|
2843
|
-
|
|
2863
|
+
const initialValue = this.value;
|
|
2844
2864
|
this.openNativePicker = this.createNativePickerInstance(initialSearch);
|
|
2845
2865
|
this.openNativePicker.componentInstance.addClick.subscribe(() => {
|
|
2846
2866
|
this.addButtonClicked();
|
|
@@ -2942,7 +2962,8 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2942
2962
|
}
|
|
2943
2963
|
if (this.data.indexOf(args.item) >= 0) {
|
|
2944
2964
|
if (this.openNativePicker) {
|
|
2945
|
-
|
|
2965
|
+
this.openNativePicker
|
|
2966
|
+
.componentInstance.onItemSelect(true, { value: args.item, selected: false });
|
|
2946
2967
|
}
|
|
2947
2968
|
else {
|
|
2948
2969
|
let newValue = this.value;
|
|
@@ -3057,42 +3078,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
3057
3078
|
}]
|
|
3058
3079
|
}] } });
|
|
3059
3080
|
|
|
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
3081
|
class SkyLookupModule {
|
|
3097
3082
|
}
|
|
3098
3083
|
SkyLookupModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|