@skyux/lookup 5.5.0-beta.0 → 5.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/skyux-lookup.umd.js +837 -854
- package/documentation.json +195 -189
- 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 +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 +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 +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 +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 +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 +456 -473
- 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 +2 -2
- 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,
|
|
@@ -474,6 +326,124 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
474
326
|
}]
|
|
475
327
|
}] });
|
|
476
328
|
|
|
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
|
+
/**
|
|
338
|
+
* @internal
|
|
339
|
+
*/
|
|
340
|
+
class SkyAutocompleteAdapterService {
|
|
341
|
+
constructor(coreAdapterService, rendererFactory) {
|
|
342
|
+
this.coreAdapterService = coreAdapterService;
|
|
343
|
+
this.rendererFactory = rendererFactory;
|
|
344
|
+
this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Adds the className for the provided element.
|
|
348
|
+
*/
|
|
349
|
+
addCSSClass(element, className) {
|
|
350
|
+
/* Sanity check */
|
|
351
|
+
/* istanbul ignore else */
|
|
352
|
+
if (element) {
|
|
353
|
+
this.renderer.addClass(element, className);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
getOverlayFocusableElements(overlay) {
|
|
357
|
+
return this.coreAdapterService.getFocusableChildren(
|
|
358
|
+
/* Sanity check - calling function also has null check */
|
|
359
|
+
/* istanbul ignore next */
|
|
360
|
+
overlay === null || overlay === void 0 ? void 0 : overlay.componentRef.location.nativeElement, { ignoreTabIndex: true });
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Removes the className for the provided element.
|
|
364
|
+
*/
|
|
365
|
+
removeCSSClass(element, className) {
|
|
366
|
+
/* Sanity check */
|
|
367
|
+
/* istanbul ignore else */
|
|
368
|
+
if (element) {
|
|
369
|
+
this.renderer.removeClass(element, className);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
setDropdownWidth(elementRef, dropdownRef, isInputBox) {
|
|
373
|
+
const parentElement = isInputBox
|
|
374
|
+
? elementRef.nativeElement.closest('.sky-input-box')
|
|
375
|
+
: elementRef.nativeElement;
|
|
376
|
+
if (parentElement) {
|
|
377
|
+
const width = parentElement.getBoundingClientRect().width;
|
|
378
|
+
this.renderer.setStyle(dropdownRef.nativeElement, 'width', `${width}px`);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Sets the `tabIndex` of the `element` to the provided `tabIndex`.
|
|
383
|
+
*/
|
|
384
|
+
setTabIndex(element, tabIndex) {
|
|
385
|
+
element.tabIndex = tabIndex;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
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 });
|
|
389
|
+
SkyAutocompleteAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyAutocompleteAdapterService });
|
|
390
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyAutocompleteAdapterService, decorators: [{
|
|
391
|
+
type: Injectable
|
|
392
|
+
}], ctorParameters: function () { return [{ type: i1.SkyCoreAdapterService }, { type: i0.RendererFactory2 }]; } });
|
|
393
|
+
|
|
394
|
+
function skyAutocompleteDefaultSearchFunction(options) {
|
|
395
|
+
const filterData = function (searchText, data) {
|
|
396
|
+
return data.filter((item) => {
|
|
397
|
+
if (!options.searchFilters || !options.searchFilters.length) {
|
|
398
|
+
return true;
|
|
399
|
+
}
|
|
400
|
+
// Find the first failing filter (we can skip the others if one fails).
|
|
401
|
+
const failedFilter = options.searchFilters.find((filter) => {
|
|
402
|
+
return !filter.call({}, searchText, item);
|
|
403
|
+
});
|
|
404
|
+
return failedFilter === undefined;
|
|
405
|
+
});
|
|
406
|
+
};
|
|
407
|
+
const search = function (searchText, data) {
|
|
408
|
+
const results = [];
|
|
409
|
+
/* Sanity check - autocomplete will not call search with empty search text */
|
|
410
|
+
/* istanbul ignore if */
|
|
411
|
+
if (!searchText) {
|
|
412
|
+
return results;
|
|
413
|
+
}
|
|
414
|
+
const searchTextNormalized = normalizeDiacritics(searchText).toUpperCase();
|
|
415
|
+
const filteredData = filterData(searchText, data);
|
|
416
|
+
for (let i = 0, n = filteredData.length; i < n; i++) {
|
|
417
|
+
const result = filteredData[i];
|
|
418
|
+
const isMatch = options.propertiesToSearch.find((property) => {
|
|
419
|
+
let value = (result[property] || '').toString();
|
|
420
|
+
value = normalizeDiacritics(value).toUpperCase();
|
|
421
|
+
return value.indexOf(searchTextNormalized) > -1;
|
|
422
|
+
});
|
|
423
|
+
if (isMatch) {
|
|
424
|
+
results.push(result);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return results;
|
|
428
|
+
};
|
|
429
|
+
return search;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* @internal
|
|
434
|
+
*/
|
|
435
|
+
var SkyAutocompleteMessageType;
|
|
436
|
+
(function (SkyAutocompleteMessageType) {
|
|
437
|
+
/**
|
|
438
|
+
* Closes the dropdown.
|
|
439
|
+
*/
|
|
440
|
+
SkyAutocompleteMessageType[SkyAutocompleteMessageType["CloseDropdown"] = 0] = "CloseDropdown";
|
|
441
|
+
/**
|
|
442
|
+
* Repositions the dropdown.
|
|
443
|
+
*/
|
|
444
|
+
SkyAutocompleteMessageType[SkyAutocompleteMessageType["RepositionDropdown"] = 1] = "RepositionDropdown";
|
|
445
|
+
})(SkyAutocompleteMessageType || (SkyAutocompleteMessageType = {}));
|
|
446
|
+
|
|
477
447
|
let uniqueId$1 = 0;
|
|
478
448
|
class SkyAutocompleteComponent {
|
|
479
449
|
constructor(changeDetector, elementRef, affixService, adapterService, overlayService, inputBoxHostSvc) {
|
|
@@ -509,6 +479,10 @@ class SkyAutocompleteComponent {
|
|
|
509
479
|
* Fires when users select the button to view all options.
|
|
510
480
|
*/
|
|
511
481
|
this.showMoreClick = new EventEmitter();
|
|
482
|
+
/**
|
|
483
|
+
* Fires when users enter new search information and allows results to be
|
|
484
|
+
* returned via an observable.
|
|
485
|
+
*/
|
|
512
486
|
this.searchAsync = new EventEmitter();
|
|
513
487
|
this.isOpen = false;
|
|
514
488
|
this.isSearchingAsync = false;
|
|
@@ -532,7 +506,7 @@ class SkyAutocompleteComponent {
|
|
|
532
506
|
/**
|
|
533
507
|
* Specifies a static data source for the autocomplete component to search
|
|
534
508
|
* when users enter text. For a dynamic data source such as an array that
|
|
535
|
-
* changes due to server calls, use
|
|
509
|
+
* changes due to server calls, use `search` or `searchAsync` instead.
|
|
536
510
|
*/
|
|
537
511
|
set data(value) {
|
|
538
512
|
this._data = value;
|
|
@@ -587,7 +561,9 @@ class SkyAutocompleteComponent {
|
|
|
587
561
|
* Specifies a function to dynamically manage the data source when users
|
|
588
562
|
* change the text in the autocomplete field. The search function must return
|
|
589
563
|
* 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.
|
|
564
|
+
* useful when the data source does not live in the source code. If the
|
|
565
|
+
* search requires calling a remote data source, use `searchAsync` instead of
|
|
566
|
+
* `search`.
|
|
591
567
|
*/
|
|
592
568
|
set search(value) {
|
|
593
569
|
this._search = value;
|
|
@@ -1338,7 +1314,7 @@ class SkyCountryFieldComponent {
|
|
|
1338
1314
|
set selectedCountry(newCountry) {
|
|
1339
1315
|
if (!this.countriesAreEqual(this.selectedCountry, newCountry)) {
|
|
1340
1316
|
if (newCountry && newCountry.iso2) {
|
|
1341
|
-
|
|
1317
|
+
const isoCountry = this.countries.find((country) => country.iso2 === newCountry.iso2);
|
|
1342
1318
|
if (isoCountry) {
|
|
1343
1319
|
newCountry = isoCountry;
|
|
1344
1320
|
}
|
|
@@ -1518,7 +1494,7 @@ class SkyCountryFieldComponent {
|
|
|
1518
1494
|
// Ignoring coverage here as this will be removed in the next release.
|
|
1519
1495
|
// istanbul ignore next
|
|
1520
1496
|
if (!this.includePhoneInfo && !this.hideSelectedCountryFlag) {
|
|
1521
|
-
if ((_b = (_a =
|
|
1497
|
+
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
1498
|
this.includePhoneInfo = true;
|
|
1523
1499
|
this.hideSelectedCountryFlag = true;
|
|
1524
1500
|
}
|
|
@@ -1545,7 +1521,7 @@ class SkyCountryFieldComponent {
|
|
|
1545
1521
|
sortCountriesWithSelectedAndDefault(selectedCountry) {
|
|
1546
1522
|
let selectedCountryIndex;
|
|
1547
1523
|
let selectedCountryData;
|
|
1548
|
-
|
|
1524
|
+
const sortedNewCountries = this.countries.sort((a, b) => {
|
|
1549
1525
|
if (((this.defaultCountryData &&
|
|
1550
1526
|
this.countriesEqual(a, this.defaultCountryData)) ||
|
|
1551
1527
|
a.name < b.name) &&
|
|
@@ -1668,104 +1644,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1668
1644
|
/**
|
|
1669
1645
|
* @internal
|
|
1670
1646
|
*/
|
|
1671
|
-
class
|
|
1672
|
-
constructor() {
|
|
1673
|
-
this.
|
|
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
|
-
/**
|
|
1764
|
-
* @internal
|
|
1765
|
-
*/
|
|
1766
|
-
class SkySearchAdapterService {
|
|
1767
|
-
constructor(renderer) {
|
|
1768
|
-
this.renderer = renderer;
|
|
1647
|
+
class SkySearchAdapterService {
|
|
1648
|
+
constructor(renderer) {
|
|
1649
|
+
this.renderer = renderer;
|
|
1769
1650
|
}
|
|
1770
1651
|
selectInput(searchEl) {
|
|
1771
1652
|
this.getInputEl(searchEl).select();
|
|
@@ -1774,9 +1655,9 @@ class SkySearchAdapterService {
|
|
|
1774
1655
|
this.getInputEl(searchEl).focus();
|
|
1775
1656
|
}
|
|
1776
1657
|
startInputAnimation(searchEl) {
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1658
|
+
const buttonWidth = this.getSearchOpenButtonEl(searchEl).clientWidth;
|
|
1659
|
+
const offsetWidth = this.getSearchContainerEl(searchEl).offsetLeft;
|
|
1660
|
+
const minWidth = buttonWidth + offsetWidth;
|
|
1780
1661
|
this.getInputContainerEl(searchEl).style.minWidth =
|
|
1781
1662
|
minWidth.toString() + 'px';
|
|
1782
1663
|
this.renderer.setStyle(this.getInputContainerEl(searchEl), 'min-width', minWidth.toString() + 'px');
|
|
@@ -2048,6 +1929,238 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
2048
1929
|
type: Input
|
|
2049
1930
|
}] } });
|
|
2050
1931
|
|
|
1932
|
+
class SkySearchModule {
|
|
1933
|
+
}
|
|
1934
|
+
SkySearchModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1935
|
+
SkySearchModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, declarations: [SkySearchComponent], imports: [CommonModule,
|
|
1936
|
+
SkyInputBoxModule,
|
|
1937
|
+
SkyLookupResourcesModule,
|
|
1938
|
+
FormsModule,
|
|
1939
|
+
SkyIconModule,
|
|
1940
|
+
SkyThemeModule,
|
|
1941
|
+
SkyIdModule], exports: [SkySearchComponent] });
|
|
1942
|
+
SkySearchModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, imports: [[
|
|
1943
|
+
CommonModule,
|
|
1944
|
+
SkyInputBoxModule,
|
|
1945
|
+
SkyLookupResourcesModule,
|
|
1946
|
+
FormsModule,
|
|
1947
|
+
SkyIconModule,
|
|
1948
|
+
SkyThemeModule,
|
|
1949
|
+
SkyIdModule,
|
|
1950
|
+
]] });
|
|
1951
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, decorators: [{
|
|
1952
|
+
type: NgModule,
|
|
1953
|
+
args: [{
|
|
1954
|
+
declarations: [SkySearchComponent],
|
|
1955
|
+
imports: [
|
|
1956
|
+
CommonModule,
|
|
1957
|
+
SkyInputBoxModule,
|
|
1958
|
+
SkyLookupResourcesModule,
|
|
1959
|
+
FormsModule,
|
|
1960
|
+
SkyIconModule,
|
|
1961
|
+
SkyThemeModule,
|
|
1962
|
+
SkyIdModule,
|
|
1963
|
+
],
|
|
1964
|
+
exports: [SkySearchComponent],
|
|
1965
|
+
}]
|
|
1966
|
+
}] });
|
|
1967
|
+
|
|
1968
|
+
class SkyLookupItemSelectedPipe {
|
|
1969
|
+
transform(id, selectedIdMap) {
|
|
1970
|
+
return selectedIdMap.has(id);
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
SkyLookupItemSelectedPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupItemSelectedPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1974
|
+
SkyLookupItemSelectedPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupItemSelectedPipe, name: "skyLookupItemSelected" });
|
|
1975
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupItemSelectedPipe, decorators: [{
|
|
1976
|
+
type: Pipe,
|
|
1977
|
+
args: [{
|
|
1978
|
+
name: 'skyLookupItemSelected',
|
|
1979
|
+
}]
|
|
1980
|
+
}] });
|
|
1981
|
+
|
|
1982
|
+
/**
|
|
1983
|
+
* @internal
|
|
1984
|
+
* Context for the show more native picker. These values are provided by the lookup component.
|
|
1985
|
+
*/
|
|
1986
|
+
class SkyLookupShowMoreNativePickerAsyncContext {
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
/**
|
|
1990
|
+
* @internal
|
|
1991
|
+
* Internal component to implement the native picker.
|
|
1992
|
+
*/
|
|
1993
|
+
class SkyLookupShowMoreAsyncModalComponent {
|
|
1994
|
+
constructor(modalInstance, context, changeDetector) {
|
|
1995
|
+
this.modalInstance = modalInstance;
|
|
1996
|
+
this.context = context;
|
|
1997
|
+
this.changeDetector = changeDetector;
|
|
1998
|
+
/**
|
|
1999
|
+
* @internal
|
|
2000
|
+
* Fires when users select the button to add new options to the list.
|
|
2001
|
+
*/
|
|
2002
|
+
this.addClick = new Subject();
|
|
2003
|
+
this.displayedItems = [];
|
|
2004
|
+
this.onlyShowSelected = false;
|
|
2005
|
+
this.isSearching = false;
|
|
2006
|
+
this.hasMoreItems = false;
|
|
2007
|
+
this.isLoadingMore = false;
|
|
2008
|
+
this.offset = 0;
|
|
2009
|
+
this.ngUnsubscribe = new Subject();
|
|
2010
|
+
}
|
|
2011
|
+
ngOnInit() {
|
|
2012
|
+
this.searchText = this.context.initialSearch;
|
|
2013
|
+
this.createInitialSelectedItemsMap();
|
|
2014
|
+
this.loadSearchResults();
|
|
2015
|
+
}
|
|
2016
|
+
ngOnDestroy() {
|
|
2017
|
+
this.cancelCurrentSearch();
|
|
2018
|
+
this.ngUnsubscribe.next();
|
|
2019
|
+
this.ngUnsubscribe.complete();
|
|
2020
|
+
}
|
|
2021
|
+
addButtonClicked() {
|
|
2022
|
+
this.addClick.next();
|
|
2023
|
+
}
|
|
2024
|
+
clearAll() {
|
|
2025
|
+
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2026
|
+
// Only deselect items that have been loaded; items that would be loaded
|
|
2027
|
+
// after an infinite scroll event should remain selected.
|
|
2028
|
+
for (const item of this.items) {
|
|
2029
|
+
this.selectedIdMap.delete(item[this.context.idProperty]);
|
|
2030
|
+
}
|
|
2031
|
+
this.updateDisplayedItems();
|
|
2032
|
+
this.changeDetector.markForCheck();
|
|
2033
|
+
}
|
|
2034
|
+
itemClick(selectedItem) {
|
|
2035
|
+
if (this.context.selectMode === 'single') {
|
|
2036
|
+
this.onItemSelect(!selectedItem.selected, selectedItem);
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
onItemSelect(newSelectState, itemToSelect) {
|
|
2040
|
+
const itemId = itemToSelect[this.context.idProperty];
|
|
2041
|
+
// Create a new Map so the pipe transform will execute on the next
|
|
2042
|
+
// change detection cycle.
|
|
2043
|
+
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2044
|
+
if (this.context.selectMode === 'single') {
|
|
2045
|
+
if (newSelectState) {
|
|
2046
|
+
this.selectedIdMap.clear();
|
|
2047
|
+
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
else {
|
|
2051
|
+
if (newSelectState) {
|
|
2052
|
+
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2053
|
+
}
|
|
2054
|
+
else {
|
|
2055
|
+
this.selectedIdMap.delete(itemId);
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
this.updateDisplayedItems();
|
|
2059
|
+
}
|
|
2060
|
+
searchApplied(searchText) {
|
|
2061
|
+
this.offset = 0;
|
|
2062
|
+
this.searchText = searchText;
|
|
2063
|
+
this.loadSearchResults();
|
|
2064
|
+
}
|
|
2065
|
+
selectAll() {
|
|
2066
|
+
this.selectedIdMap = new Map();
|
|
2067
|
+
for (const item of this.items) {
|
|
2068
|
+
this.selectedIdMap.set(item[this.context.idProperty], item);
|
|
2069
|
+
}
|
|
2070
|
+
this.updateDisplayedItems();
|
|
2071
|
+
}
|
|
2072
|
+
infiniteScrollEnd() {
|
|
2073
|
+
this.cancelCurrentSearch();
|
|
2074
|
+
/* Sanity check - else case would only happen if this was called directly */
|
|
2075
|
+
/* istanbul ignore else */
|
|
2076
|
+
if (this.hasMoreItems) {
|
|
2077
|
+
this.isLoadingMore = true;
|
|
2078
|
+
this.performSearch((result) => {
|
|
2079
|
+
this.items = this.items.concat(result.items);
|
|
2080
|
+
this.updateDisplayedItems();
|
|
2081
|
+
this.isLoadingMore = false;
|
|
2082
|
+
});
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
save() {
|
|
2086
|
+
const selectedItems = Array.from(this.selectedIdMap.values(), (itemData, index) => ({
|
|
2087
|
+
index,
|
|
2088
|
+
itemData,
|
|
2089
|
+
})).sort((a, b) => {
|
|
2090
|
+
return this.items.indexOf(a.itemData) < this.items.indexOf(b.itemData)
|
|
2091
|
+
? -1
|
|
2092
|
+
: 1;
|
|
2093
|
+
});
|
|
2094
|
+
this.modalInstance.save(selectedItems);
|
|
2095
|
+
}
|
|
2096
|
+
loadSearchResults() {
|
|
2097
|
+
this.cancelCurrentSearch();
|
|
2098
|
+
this.isSearching = true;
|
|
2099
|
+
this.performSearch((result) => {
|
|
2100
|
+
this.isSearching = false;
|
|
2101
|
+
this.items = result.items;
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
createInitialSelectedItemsMap() {
|
|
2105
|
+
this.selectedIdMap = new Map(this.context.initialValue.map((item) => [
|
|
2106
|
+
item[this.context.idProperty],
|
|
2107
|
+
item,
|
|
2108
|
+
]));
|
|
2109
|
+
}
|
|
2110
|
+
performSearch(processResults) {
|
|
2111
|
+
this.currentSearchSub = this.context
|
|
2112
|
+
.searchAsync({
|
|
2113
|
+
displayType: 'modal',
|
|
2114
|
+
offset: this.offset,
|
|
2115
|
+
searchText: this.searchText || '',
|
|
2116
|
+
continuationData: this.continuationData,
|
|
2117
|
+
})
|
|
2118
|
+
.pipe(take(1))
|
|
2119
|
+
.subscribe((result) => {
|
|
2120
|
+
processResults(result);
|
|
2121
|
+
this.continuationData = result.continuationData;
|
|
2122
|
+
this.hasMoreItems = result.hasMore;
|
|
2123
|
+
this.offset = this.items.length;
|
|
2124
|
+
this.updateDisplayedItems();
|
|
2125
|
+
this.changeDetector.markForCheck();
|
|
2126
|
+
});
|
|
2127
|
+
}
|
|
2128
|
+
updateDisplayedItems() {
|
|
2129
|
+
if (this.onlyShowSelected) {
|
|
2130
|
+
this.displayedItems = this.items.filter((item) => this.selectedIdMap.has(item[this.context.idProperty]));
|
|
2131
|
+
}
|
|
2132
|
+
else {
|
|
2133
|
+
this.displayedItems = this.items;
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
cancelCurrentSearch() {
|
|
2137
|
+
if (this.currentSearchSub) {
|
|
2138
|
+
this.currentSearchSub.unsubscribe();
|
|
2139
|
+
this.currentSearchSub = undefined;
|
|
2140
|
+
this.isLoadingMore = false;
|
|
2141
|
+
this.isSearching = false;
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
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 });
|
|
2146
|
+
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 });
|
|
2147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupShowMoreAsyncModalComponent, decorators: [{
|
|
2148
|
+
type: Component,
|
|
2149
|
+
args: [{
|
|
2150
|
+
selector: 'sky-lookup-show-more-async-modal',
|
|
2151
|
+
templateUrl: './lookup-show-more-async-modal.component.html',
|
|
2152
|
+
styleUrls: ['./lookup-show-more-async-modal.component.scss'],
|
|
2153
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2154
|
+
}]
|
|
2155
|
+
}], ctorParameters: function () { return [{ type: i1$1.SkyModalInstance }, { type: SkyLookupShowMoreNativePickerAsyncContext }, { type: i0.ChangeDetectorRef }]; } });
|
|
2156
|
+
|
|
2157
|
+
/**
|
|
2158
|
+
* @internal
|
|
2159
|
+
* Context for the show more native picker. These values are provided by the lookup component.
|
|
2160
|
+
*/
|
|
2161
|
+
class SkyLookupShowMoreNativePickerContext {
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2051
2164
|
/**
|
|
2052
2165
|
* @internal
|
|
2053
2166
|
* Internal component to implement the native picker.
|
|
@@ -2098,7 +2211,7 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2098
2211
|
}
|
|
2099
2212
|
addItems() {
|
|
2100
2213
|
if (!this.items || this.items.length === 0) {
|
|
2101
|
-
|
|
2214
|
+
const selectedItems = this.selectedItems.slice();
|
|
2102
2215
|
this.items = this.context.items
|
|
2103
2216
|
? this.context.items.map((item) => {
|
|
2104
2217
|
return {
|
|
@@ -2173,9 +2286,9 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2173
2286
|
}
|
|
2174
2287
|
}
|
|
2175
2288
|
else {
|
|
2176
|
-
|
|
2289
|
+
const selectedItems = this.selectedItems;
|
|
2177
2290
|
const allItemsIndex = this.items.findIndex((item) => item.value === itemToSelect.value);
|
|
2178
|
-
|
|
2291
|
+
const selectedItemsIndex = selectedItems.findIndex((selectedItem) => selectedItem.index === allItemsIndex);
|
|
2179
2292
|
if (newSelectState && selectedItemsIndex === -1) {
|
|
2180
2293
|
selectedItems.push({
|
|
2181
2294
|
index: allItemsIndex,
|
|
@@ -2199,7 +2312,7 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2199
2312
|
this.updateDataState();
|
|
2200
2313
|
}
|
|
2201
2314
|
searchItems(items) {
|
|
2202
|
-
|
|
2315
|
+
const searchText = this.searchText;
|
|
2203
2316
|
if (searchText) {
|
|
2204
2317
|
const resultValues = this.context.search(searchText, items.map((item) => {
|
|
2205
2318
|
return item.value;
|
|
@@ -2220,7 +2333,7 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2220
2333
|
}
|
|
2221
2334
|
}
|
|
2222
2335
|
selectAll() {
|
|
2223
|
-
|
|
2336
|
+
const selectedItems = this.selectedItems;
|
|
2224
2337
|
this.displayedItems.forEach((item) => {
|
|
2225
2338
|
if (!item.selected) {
|
|
2226
2339
|
item.selected = true;
|
|
@@ -2240,7 +2353,7 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2240
2353
|
this.changeDetector.markForCheck();
|
|
2241
2354
|
}
|
|
2242
2355
|
updateDataState() {
|
|
2243
|
-
|
|
2356
|
+
const selectedItems = this.selectedItems;
|
|
2244
2357
|
this.items.forEach((item, index) => {
|
|
2245
2358
|
item.selected =
|
|
2246
2359
|
selectedItems.findIndex((selectedItem) => selectedItem.index === index) !== -1;
|
|
@@ -2275,7 +2388,7 @@ class SkyLookupShowMoreModalComponent {
|
|
|
2275
2388
|
}
|
|
2276
2389
|
}
|
|
2277
2390
|
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:
|
|
2391
|
+
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 });
|
|
2279
2392
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupShowMoreModalComponent, decorators: [{
|
|
2280
2393
|
type: Component,
|
|
2281
2394
|
args: [{
|
|
@@ -2292,192 +2405,97 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
2292
2405
|
|
|
2293
2406
|
/**
|
|
2294
2407
|
* @internal
|
|
2295
|
-
* Context for the show more native picker. These values are provided by the lookup component.
|
|
2296
2408
|
*/
|
|
2297
|
-
class
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2409
|
+
class SkyLookupAdapterService {
|
|
2410
|
+
focusInput(elRef) {
|
|
2411
|
+
const inputEl = elRef.nativeElement.querySelector('.sky-lookup-input');
|
|
2412
|
+
/* Sanity check */
|
|
2413
|
+
/* istanbul ignore else */
|
|
2414
|
+
if (inputEl) {
|
|
2415
|
+
inputEl.focus();
|
|
2416
|
+
}
|
|
2303
2417
|
}
|
|
2304
2418
|
}
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
2308
|
-
type:
|
|
2309
|
-
args: [{
|
|
2310
|
-
name: 'skyLookupItemSelected',
|
|
2311
|
-
}]
|
|
2419
|
+
SkyLookupAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2420
|
+
SkyLookupAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAdapterService });
|
|
2421
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAdapterService, decorators: [{
|
|
2422
|
+
type: Injectable
|
|
2312
2423
|
}] });
|
|
2313
2424
|
|
|
2314
2425
|
/**
|
|
2315
2426
|
* @internal
|
|
2316
|
-
* Internal component to implement the native picker.
|
|
2317
2427
|
*/
|
|
2318
|
-
class
|
|
2319
|
-
constructor(
|
|
2320
|
-
this.modalInstance = modalInstance;
|
|
2321
|
-
this.context = context;
|
|
2322
|
-
this.changeDetector = changeDetector;
|
|
2428
|
+
class SkyLookupAutocompleteAdapter {
|
|
2429
|
+
constructor() {
|
|
2323
2430
|
/**
|
|
2324
|
-
*
|
|
2325
|
-
*
|
|
2431
|
+
* Fires when users enter new search information and allows results to be
|
|
2432
|
+
* returned via an observable.
|
|
2326
2433
|
*/
|
|
2327
|
-
this.
|
|
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);
|
|
2378
|
-
}
|
|
2379
|
-
else {
|
|
2380
|
-
this.selectedIdMap.delete(itemId);
|
|
2381
|
-
}
|
|
2382
|
-
}
|
|
2383
|
-
this.updateDisplayedItems();
|
|
2384
|
-
}
|
|
2385
|
-
searchApplied(searchText) {
|
|
2386
|
-
this.offset = 0;
|
|
2387
|
-
this.searchText = searchText;
|
|
2388
|
-
this.loadSearchResults();
|
|
2389
|
-
}
|
|
2390
|
-
selectAll() {
|
|
2391
|
-
this.selectedIdMap = new Map();
|
|
2392
|
-
for (const item of this.items) {
|
|
2393
|
-
this.selectedIdMap.set(item[this.context.idProperty], item);
|
|
2394
|
-
}
|
|
2395
|
-
this.updateDisplayedItems();
|
|
2396
|
-
}
|
|
2397
|
-
infiniteScrollEnd() {
|
|
2398
|
-
this.cancelCurrentSearch();
|
|
2399
|
-
/* Sanity check - else case would only happen if this was called directly */
|
|
2400
|
-
/* istanbul ignore else */
|
|
2401
|
-
if (this.hasMoreItems) {
|
|
2402
|
-
this.isLoadingMore = true;
|
|
2403
|
-
this.performSearch((result) => {
|
|
2404
|
-
this.items = this.items.concat(result.items);
|
|
2405
|
-
this.updateDisplayedItems();
|
|
2406
|
-
this.isLoadingMore = false;
|
|
2407
|
-
});
|
|
2408
|
-
}
|
|
2434
|
+
this.searchAsync = new EventEmitter();
|
|
2409
2435
|
}
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
: 1;
|
|
2418
|
-
});
|
|
2419
|
-
this.modalInstance.save(selectedItems);
|
|
2436
|
+
/**
|
|
2437
|
+
* Specifies an object property to display in the text input after users
|
|
2438
|
+
* select an item in the dropdown list.
|
|
2439
|
+
* @default "name"
|
|
2440
|
+
*/
|
|
2441
|
+
set descriptorProperty(value) {
|
|
2442
|
+
this._descriptorProperty = value;
|
|
2420
2443
|
}
|
|
2421
|
-
|
|
2422
|
-
this.
|
|
2423
|
-
this.isSearching = true;
|
|
2424
|
-
this.performSearch((result) => {
|
|
2425
|
-
this.isSearching = false;
|
|
2426
|
-
this.items = result.items;
|
|
2427
|
-
});
|
|
2444
|
+
get descriptorProperty() {
|
|
2445
|
+
return this._descriptorProperty || 'name';
|
|
2428
2446
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2447
|
+
/**
|
|
2448
|
+
* Specifies an array of object properties to search.
|
|
2449
|
+
* @default ["name"]
|
|
2450
|
+
*/
|
|
2451
|
+
set propertiesToSearch(value) {
|
|
2452
|
+
this._propertiesToSearch = value;
|
|
2434
2453
|
}
|
|
2435
|
-
|
|
2436
|
-
this.
|
|
2437
|
-
.searchAsync({
|
|
2438
|
-
displayType: 'modal',
|
|
2439
|
-
offset: this.offset,
|
|
2440
|
-
searchText: this.searchText || '',
|
|
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
|
-
});
|
|
2454
|
+
get propertiesToSearch() {
|
|
2455
|
+
return this._propertiesToSearch || ['name'];
|
|
2452
2456
|
}
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2457
|
+
/**
|
|
2458
|
+
* Specifies a function to dynamically manage the data source when users
|
|
2459
|
+
* change the text in the lookup field. The search function must return
|
|
2460
|
+
* an array or a promise of an array. The `search` property is particularly
|
|
2461
|
+
* useful when the data source does not live in the source code. If the
|
|
2462
|
+
* search requires calling a remote data source, use `searchAsync` instead of
|
|
2463
|
+
* `search`.
|
|
2464
|
+
*/
|
|
2465
|
+
set search(value) {
|
|
2466
|
+
this._search = value;
|
|
2460
2467
|
}
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
}
|
|
2468
|
+
get search() {
|
|
2469
|
+
return (this._search ||
|
|
2470
|
+
skyAutocompleteDefaultSearchFunction({
|
|
2471
|
+
propertiesToSearch: this.propertiesToSearch,
|
|
2472
|
+
searchFilters: this.searchFilters,
|
|
2473
|
+
}));
|
|
2468
2474
|
}
|
|
2469
2475
|
}
|
|
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
|
-
|
|
2476
|
+
SkyLookupAutocompleteAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAutocompleteAdapter, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2477
|
+
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 });
|
|
2478
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupAutocompleteAdapter, decorators: [{
|
|
2479
|
+
type: Directive
|
|
2480
|
+
}], propDecorators: { debounceTime: [{
|
|
2481
|
+
type: Input
|
|
2482
|
+
}], descriptorProperty: [{
|
|
2483
|
+
type: Input
|
|
2484
|
+
}], propertiesToSearch: [{
|
|
2485
|
+
type: Input
|
|
2486
|
+
}], search: [{
|
|
2487
|
+
type: Input
|
|
2488
|
+
}], searchResultTemplate: [{
|
|
2489
|
+
type: Input
|
|
2490
|
+
}], searchTextMinimumCharacters: [{
|
|
2491
|
+
type: Input
|
|
2492
|
+
}], searchFilters: [{
|
|
2493
|
+
type: Input
|
|
2494
|
+
}], searchResultsLimit: [{
|
|
2495
|
+
type: Input
|
|
2496
|
+
}], searchAsync: [{
|
|
2497
|
+
type: Output
|
|
2498
|
+
}] } });
|
|
2481
2499
|
|
|
2482
2500
|
class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
2483
2501
|
constructor(changeDetector, elementRef, windowRef, ngControl, adapter, modalService, resourcesService, inputBoxHostSvc, themeSvc) {
|
|
@@ -2539,7 +2557,7 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2539
2557
|
* @default "mulitple"
|
|
2540
2558
|
*/
|
|
2541
2559
|
set selectMode(value) {
|
|
2542
|
-
|
|
2560
|
+
const multipleToSingle = value === 'single' && this.selectMode === 'multiple';
|
|
2543
2561
|
this._selectMode = value;
|
|
2544
2562
|
this.updateForSelectMode();
|
|
2545
2563
|
if (multipleToSingle) {
|
|
@@ -2789,7 +2807,7 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2789
2807
|
}
|
|
2790
2808
|
createNativePickerInstance(initialSearch) {
|
|
2791
2809
|
var _a;
|
|
2792
|
-
|
|
2810
|
+
const initialValue = this.value;
|
|
2793
2811
|
const modalConfig = ((_a = this.showMoreConfig) === null || _a === void 0 ? void 0 : _a.nativePickerConfig) || {};
|
|
2794
2812
|
if (!modalConfig.itemTemplate) {
|
|
2795
2813
|
modalConfig.itemTemplate = this.searchResultTemplate;
|
|
@@ -2840,7 +2858,7 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2840
2858
|
});
|
|
2841
2859
|
}
|
|
2842
2860
|
else {
|
|
2843
|
-
|
|
2861
|
+
const initialValue = this.value;
|
|
2844
2862
|
this.openNativePicker = this.createNativePickerInstance(initialSearch);
|
|
2845
2863
|
this.openNativePicker.componentInstance.addClick.subscribe(() => {
|
|
2846
2864
|
this.addButtonClicked();
|
|
@@ -2942,7 +2960,8 @@ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
|
2942
2960
|
}
|
|
2943
2961
|
if (this.data.indexOf(args.item) >= 0) {
|
|
2944
2962
|
if (this.openNativePicker) {
|
|
2945
|
-
|
|
2963
|
+
this.openNativePicker
|
|
2964
|
+
.componentInstance.onItemSelect(true, { value: args.item, selected: false });
|
|
2946
2965
|
}
|
|
2947
2966
|
else {
|
|
2948
2967
|
let newValue = this.value;
|
|
@@ -3057,42 +3076,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
3057
3076
|
}]
|
|
3058
3077
|
}] } });
|
|
3059
3078
|
|
|
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
3079
|
class SkyLookupModule {
|
|
3097
3080
|
}
|
|
3098
3081
|
SkyLookupModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|