@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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@skyux/core'), require('@skyux/indicators'), require('@skyux/theme'), require('@skyux/i18n'), require('rxjs'), require('rxjs/operators'), require('@skyux/forms'), require('intl-tel-input'), require('@skyux/layout'), require('@skyux/lists'), require('@skyux/modals'), require('@angular/animations')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@skyux/lookup', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@skyux/core', '@skyux/indicators', '@skyux/theme', '@skyux/i18n', 'rxjs', 'rxjs/operators', '@skyux/forms', 'intl-tel-input', '@skyux/layout', '@skyux/lists', '@skyux/modals', '@angular/animations'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.skyux = global.skyux || {}, global.skyux.lookup = {}), global.ng.common, global.ng.core, global.ng.forms, global.i1, global.i4, global.i7, global.i5, global.rxjs, global.rxjs.operators, global.i6, null, global.
|
|
5
|
-
})(this, (function (exports, i6$1, i0, i8, i1, i4, i7, i5, rxjs, operators, i6, intlTelInput,
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.skyux = global.skyux || {}, global.skyux.lookup = {}), global.ng.common, global.ng.core, global.ng.forms, global.i1, global.i4, global.i7, global.i5, global.rxjs, global.rxjs.operators, global.i6, null, global.i4$1, global.i7$1, global.i1$1, global.ng.animations));
|
|
5
|
+
})(this, (function (exports, i6$1, i0, i8, i1, i4, i7, i5, rxjs, operators, i6, intlTelInput, i4$1, i7$1, i1$1, animations) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
|
|
31
31
|
var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
|
|
32
32
|
var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
|
|
33
|
-
var
|
|
33
|
+
var i4__namespace$1 = /*#__PURE__*/_interopNamespace(i4$1);
|
|
34
34
|
var i7__namespace$1 = /*#__PURE__*/_interopNamespace(i7$1);
|
|
35
35
|
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
36
36
|
|
|
@@ -109,6 +109,279 @@
|
|
|
109
109
|
}]
|
|
110
110
|
}] });
|
|
111
111
|
|
|
112
|
+
// tslint:disable:no-forward-ref no-use-before-declare
|
|
113
|
+
var SKY_AUTOCOMPLETE_VALUE_ACCESSOR = {
|
|
114
|
+
provide: i8.NG_VALUE_ACCESSOR,
|
|
115
|
+
useExisting: i0.forwardRef(function () { return SkyAutocompleteInputDirective; }),
|
|
116
|
+
multi: true,
|
|
117
|
+
};
|
|
118
|
+
var SKY_AUTOCOMPLETE_VALIDATOR = {
|
|
119
|
+
provide: i8.NG_VALIDATORS,
|
|
120
|
+
useExisting: i0.forwardRef(function () { return SkyAutocompleteInputDirective; }),
|
|
121
|
+
multi: true,
|
|
122
|
+
};
|
|
123
|
+
// tslint:enable
|
|
124
|
+
var SkyAutocompleteInputDirective = /** @class */ (function () {
|
|
125
|
+
function SkyAutocompleteInputDirective(elementRef, renderer) {
|
|
126
|
+
this.elementRef = elementRef;
|
|
127
|
+
this.renderer = renderer;
|
|
128
|
+
this.isFirstChange = true;
|
|
129
|
+
this.ngUnsubscribe = new rxjs.Subject();
|
|
130
|
+
this._blur = new rxjs.Subject();
|
|
131
|
+
this._disabled = false;
|
|
132
|
+
this._focus = new rxjs.Subject();
|
|
133
|
+
this._textChanges = new rxjs.Subject();
|
|
134
|
+
/* istanbul ignore next */
|
|
135
|
+
this.onValidatorChange = function () { };
|
|
136
|
+
}
|
|
137
|
+
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "autocompleteAttribute", {
|
|
138
|
+
get: function () {
|
|
139
|
+
return this._autocompleteAttribute || 'off';
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* Specifies the value for the `autocomplete` attribute on the form input.
|
|
143
|
+
* @default "off"
|
|
144
|
+
*/
|
|
145
|
+
set: function (value) {
|
|
146
|
+
if (!value) {
|
|
147
|
+
this._autocompleteAttribute = 'off';
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
this._autocompleteAttribute = value;
|
|
151
|
+
}
|
|
152
|
+
this.renderer.setAttribute(this.elementRef.nativeElement, 'autocomplete', this.autocompleteAttribute);
|
|
153
|
+
},
|
|
154
|
+
enumerable: false,
|
|
155
|
+
configurable: true
|
|
156
|
+
});
|
|
157
|
+
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "disabled", {
|
|
158
|
+
get: function () {
|
|
159
|
+
return this._disabled;
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
162
|
+
* Indicates whether to disable the autocomplete field.
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
set: function (value) {
|
|
166
|
+
this._disabled = value;
|
|
167
|
+
this.renderer.setProperty(this.elementRef.nativeElement, 'disabled', value);
|
|
168
|
+
},
|
|
169
|
+
enumerable: false,
|
|
170
|
+
configurable: true
|
|
171
|
+
});
|
|
172
|
+
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "blur", {
|
|
173
|
+
get: function () {
|
|
174
|
+
return this._blur.asObservable();
|
|
175
|
+
},
|
|
176
|
+
enumerable: false,
|
|
177
|
+
configurable: true
|
|
178
|
+
});
|
|
179
|
+
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "displayWith", {
|
|
180
|
+
get: function () {
|
|
181
|
+
return this._displayWith;
|
|
182
|
+
},
|
|
183
|
+
set: function (value) {
|
|
184
|
+
this._displayWith = value;
|
|
185
|
+
this.inputTextValue = this.getValueByKey();
|
|
186
|
+
},
|
|
187
|
+
enumerable: false,
|
|
188
|
+
configurable: true
|
|
189
|
+
});
|
|
190
|
+
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "inputElement", {
|
|
191
|
+
/**
|
|
192
|
+
* @internal
|
|
193
|
+
*/
|
|
194
|
+
get: function () {
|
|
195
|
+
return this.elementRef.nativeElement;
|
|
196
|
+
},
|
|
197
|
+
enumerable: false,
|
|
198
|
+
configurable: true
|
|
199
|
+
});
|
|
200
|
+
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "focus", {
|
|
201
|
+
get: function () {
|
|
202
|
+
return this._focus.asObservable();
|
|
203
|
+
},
|
|
204
|
+
enumerable: false,
|
|
205
|
+
configurable: true
|
|
206
|
+
});
|
|
207
|
+
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "inputTextValue", {
|
|
208
|
+
get: function () {
|
|
209
|
+
return this.elementRef.nativeElement.value;
|
|
210
|
+
},
|
|
211
|
+
set: function (value) {
|
|
212
|
+
this.elementRef.nativeElement.value = value || '';
|
|
213
|
+
},
|
|
214
|
+
enumerable: false,
|
|
215
|
+
configurable: true
|
|
216
|
+
});
|
|
217
|
+
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "textChanges", {
|
|
218
|
+
get: function () {
|
|
219
|
+
return this._textChanges.asObservable();
|
|
220
|
+
},
|
|
221
|
+
enumerable: false,
|
|
222
|
+
configurable: true
|
|
223
|
+
});
|
|
224
|
+
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "value", {
|
|
225
|
+
get: function () {
|
|
226
|
+
return this._value;
|
|
227
|
+
},
|
|
228
|
+
set: function (value) {
|
|
229
|
+
var isNewValue = value !== this._value;
|
|
230
|
+
/* istanbul ignore else */
|
|
231
|
+
if (isNewValue) {
|
|
232
|
+
this._value = value;
|
|
233
|
+
this.inputTextValue = this.getValueByKey();
|
|
234
|
+
this.onChange(this._value);
|
|
235
|
+
// Do not mark the field as "dirty"
|
|
236
|
+
// if the field has been initialized with a value.
|
|
237
|
+
if (this.isFirstChange && this.control) {
|
|
238
|
+
this.control.markAsPristine();
|
|
239
|
+
}
|
|
240
|
+
if (this.isFirstChange && this._value) {
|
|
241
|
+
this.isFirstChange = false;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
enumerable: false,
|
|
246
|
+
configurable: true
|
|
247
|
+
});
|
|
248
|
+
SkyAutocompleteInputDirective.prototype.ngOnInit = function () {
|
|
249
|
+
var _this = this;
|
|
250
|
+
var element = this.elementRef.nativeElement;
|
|
251
|
+
this.setAttributes(element);
|
|
252
|
+
rxjs.fromEvent(element, 'input')
|
|
253
|
+
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
254
|
+
.subscribe(function () {
|
|
255
|
+
/** Sanity check */
|
|
256
|
+
if (!_this.disabled) {
|
|
257
|
+
_this._textChanges.next({
|
|
258
|
+
value: _this.elementRef.nativeElement.value,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
rxjs.fromEvent(element, 'blur')
|
|
263
|
+
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
264
|
+
.subscribe(function () {
|
|
265
|
+
/** Sanity check */
|
|
266
|
+
if (!_this.disabled) {
|
|
267
|
+
_this._blur.next();
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
rxjs.fromEvent(element, 'focus')
|
|
271
|
+
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
272
|
+
.subscribe(function () {
|
|
273
|
+
/** Sanity check */
|
|
274
|
+
if (!_this.disabled) {
|
|
275
|
+
_this._focus.next();
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
rxjs.fromEvent(element, 'change')
|
|
279
|
+
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
280
|
+
.subscribe(function () {
|
|
281
|
+
/** Sanity check */
|
|
282
|
+
/* istanbul ignore else */
|
|
283
|
+
if (!_this.disabled) {
|
|
284
|
+
_this.isFirstChange = false;
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
SkyAutocompleteInputDirective.prototype.ngOnDestroy = function () {
|
|
289
|
+
this._blur.complete();
|
|
290
|
+
this._textChanges.complete();
|
|
291
|
+
this.ngUnsubscribe.next();
|
|
292
|
+
this.ngUnsubscribe.complete();
|
|
293
|
+
this._blur = this._textChanges = this.ngUnsubscribe = undefined;
|
|
294
|
+
};
|
|
295
|
+
SkyAutocompleteInputDirective.prototype.writeValue = function (value) {
|
|
296
|
+
this.value = value;
|
|
297
|
+
};
|
|
298
|
+
SkyAutocompleteInputDirective.prototype.registerOnChange = function (fn) {
|
|
299
|
+
this.onChange = fn;
|
|
300
|
+
};
|
|
301
|
+
SkyAutocompleteInputDirective.prototype.registerOnTouched = function (fn) {
|
|
302
|
+
this.onTouched = fn;
|
|
303
|
+
};
|
|
304
|
+
SkyAutocompleteInputDirective.prototype.registerOnValidatorChange = function (fn) {
|
|
305
|
+
this.onValidatorChange = fn;
|
|
306
|
+
};
|
|
307
|
+
SkyAutocompleteInputDirective.prototype.restoreInputTextValueToPreviousState = function () {
|
|
308
|
+
var modelValue = this.getValueByKey();
|
|
309
|
+
// If the search field contains text, make sure that the value
|
|
310
|
+
// matches the selected descriptor key.
|
|
311
|
+
if (this.inputTextValue !== modelValue) {
|
|
312
|
+
this.inputTextValue = modelValue;
|
|
313
|
+
}
|
|
314
|
+
this.onTouched();
|
|
315
|
+
};
|
|
316
|
+
SkyAutocompleteInputDirective.prototype.setDisabledState = function (disabled) {
|
|
317
|
+
this.disabled = disabled;
|
|
318
|
+
};
|
|
319
|
+
SkyAutocompleteInputDirective.prototype.validate = function (control) {
|
|
320
|
+
if (!this.control) {
|
|
321
|
+
this.control = control;
|
|
322
|
+
}
|
|
323
|
+
return;
|
|
324
|
+
};
|
|
325
|
+
// See: https://www.w3.org/TR/wai-aria-practices/#kbd_focus_activedescendant
|
|
326
|
+
SkyAutocompleteInputDirective.prototype.setActiveDescendant = function (descendantId) {
|
|
327
|
+
if (descendantId) {
|
|
328
|
+
this.renderer.setAttribute(this.elementRef.nativeElement, 'aria-activedescendant', descendantId);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
this.renderer.removeAttribute(this.elementRef.nativeElement, 'aria-activedescendant');
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
// Angular automatically constructs these methods.
|
|
335
|
+
/* istanbul ignore next */
|
|
336
|
+
SkyAutocompleteInputDirective.prototype.onChange = function (value) { };
|
|
337
|
+
/* istanbul ignore next */
|
|
338
|
+
SkyAutocompleteInputDirective.prototype.onTouched = function () { };
|
|
339
|
+
SkyAutocompleteInputDirective.prototype.setAttributes = function (element) {
|
|
340
|
+
this.renderer.setAttribute(element, 'autocomplete', this.autocompleteAttribute);
|
|
341
|
+
this.renderer.setAttribute(element, 'autocapitalize', 'none');
|
|
342
|
+
this.renderer.setAttribute(element, 'autocorrect', 'off');
|
|
343
|
+
this.renderer.setAttribute(element, 'spellcheck', 'false');
|
|
344
|
+
this.renderer.addClass(element, 'sky-form-control');
|
|
345
|
+
};
|
|
346
|
+
SkyAutocompleteInputDirective.prototype.getValueByKey = function () {
|
|
347
|
+
return this.value ? this.value[this.displayWith] : undefined;
|
|
348
|
+
};
|
|
349
|
+
return SkyAutocompleteInputDirective;
|
|
350
|
+
}());
|
|
351
|
+
SkyAutocompleteInputDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutocompleteInputDirective, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.Renderer2 }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
352
|
+
SkyAutocompleteInputDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyAutocompleteInputDirective, selector: "input[skyAutocomplete], textarea[skyAutocomplete]", inputs: { autocompleteAttribute: "autocompleteAttribute", disabled: "disabled" }, providers: [SKY_AUTOCOMPLETE_VALUE_ACCESSOR, SKY_AUTOCOMPLETE_VALIDATOR], ngImport: i0__namespace });
|
|
353
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutocompleteInputDirective, decorators: [{
|
|
354
|
+
type: i0.Directive,
|
|
355
|
+
args: [{
|
|
356
|
+
selector: 'input[skyAutocomplete], textarea[skyAutocomplete]',
|
|
357
|
+
providers: [SKY_AUTOCOMPLETE_VALUE_ACCESSOR, SKY_AUTOCOMPLETE_VALIDATOR],
|
|
358
|
+
}]
|
|
359
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.Renderer2 }]; }, propDecorators: { autocompleteAttribute: [{
|
|
360
|
+
type: i0.Input
|
|
361
|
+
}], disabled: [{
|
|
362
|
+
type: i0.Input
|
|
363
|
+
}] } });
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* @internal
|
|
367
|
+
*/
|
|
368
|
+
var SkyAutcompleteSearchAsyncDisabledPipe = /** @class */ (function () {
|
|
369
|
+
function SkyAutcompleteSearchAsyncDisabledPipe() {
|
|
370
|
+
}
|
|
371
|
+
SkyAutcompleteSearchAsyncDisabledPipe.prototype.transform = function (searchAsync, searchAsyncDisabled) {
|
|
372
|
+
return searchAsyncDisabled || searchAsync.observers.length === 0;
|
|
373
|
+
};
|
|
374
|
+
return SkyAutcompleteSearchAsyncDisabledPipe;
|
|
375
|
+
}());
|
|
376
|
+
SkyAutcompleteSearchAsyncDisabledPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutcompleteSearchAsyncDisabledPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
377
|
+
SkyAutcompleteSearchAsyncDisabledPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutcompleteSearchAsyncDisabledPipe, name: "skyAutocompleteSearchAsyncDisabled" });
|
|
378
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutcompleteSearchAsyncDisabledPipe, decorators: [{
|
|
379
|
+
type: i0.Pipe,
|
|
380
|
+
args: [{
|
|
381
|
+
name: 'skyAutocompleteSearchAsyncDisabled',
|
|
382
|
+
}]
|
|
383
|
+
}] });
|
|
384
|
+
|
|
112
385
|
/*! *****************************************************************************
|
|
113
386
|
Copyright (c) Microsoft Corporation.
|
|
114
387
|
|
|
@@ -427,109 +700,6 @@
|
|
|
427
700
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
428
701
|
}
|
|
429
702
|
|
|
430
|
-
/**
|
|
431
|
-
* @internal
|
|
432
|
-
*/
|
|
433
|
-
var SkyAutocompleteMessageType;
|
|
434
|
-
(function (SkyAutocompleteMessageType) {
|
|
435
|
-
/**
|
|
436
|
-
* Closes the dropdown.
|
|
437
|
-
*/
|
|
438
|
-
SkyAutocompleteMessageType[SkyAutocompleteMessageType["CloseDropdown"] = 0] = "CloseDropdown";
|
|
439
|
-
/**
|
|
440
|
-
* Repositions the dropdown.
|
|
441
|
-
*/
|
|
442
|
-
SkyAutocompleteMessageType[SkyAutocompleteMessageType["RepositionDropdown"] = 1] = "RepositionDropdown";
|
|
443
|
-
})(SkyAutocompleteMessageType || (SkyAutocompleteMessageType = {}));
|
|
444
|
-
|
|
445
|
-
// tslint:disable:no-null-keyword
|
|
446
|
-
/* istanbul ignore file */
|
|
447
|
-
// Polyfill for Element.closest().
|
|
448
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
|
|
449
|
-
// Returns the closest ancestor of the current element (or the current element itself) which
|
|
450
|
-
// matches the selectors given in parameter. If there isn't such an ancestor, it returns null.
|
|
451
|
-
if (!Element.prototype.closest) {
|
|
452
|
-
Element.prototype.closest = function (s) {
|
|
453
|
-
var el = this;
|
|
454
|
-
if (!document.documentElement.contains(el)) {
|
|
455
|
-
return null;
|
|
456
|
-
}
|
|
457
|
-
do {
|
|
458
|
-
if (el.matches(s)) {
|
|
459
|
-
return el;
|
|
460
|
-
}
|
|
461
|
-
el = el.parentElement || el.parentNode;
|
|
462
|
-
} while (el !== null && el.nodeType === 1);
|
|
463
|
-
return null;
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
// Polyfill for Element.matches().
|
|
467
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
468
|
-
// Returns true if the element would be selected by the specified selector string.
|
|
469
|
-
if (!Element.prototype.matches) {
|
|
470
|
-
Element.prototype.matches =
|
|
471
|
-
Element.prototype.msMatchesSelector ||
|
|
472
|
-
/* istanbul ignore next */ Element.prototype.webkitMatchesSelector;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* @internal
|
|
477
|
-
*/
|
|
478
|
-
var SkyAutocompleteAdapterService = /** @class */ (function () {
|
|
479
|
-
function SkyAutocompleteAdapterService(coreAdapterService, rendererFactory) {
|
|
480
|
-
this.coreAdapterService = coreAdapterService;
|
|
481
|
-
this.rendererFactory = rendererFactory;
|
|
482
|
-
this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* Adds the className for the provided element.
|
|
486
|
-
*/
|
|
487
|
-
SkyAutocompleteAdapterService.prototype.addCSSClass = function (element, className) {
|
|
488
|
-
/* Sanity check */
|
|
489
|
-
/* istanbul ignore else */
|
|
490
|
-
if (element) {
|
|
491
|
-
this.renderer.addClass(element, className);
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
SkyAutocompleteAdapterService.prototype.getOverlayFocusableElements = function (overlay) {
|
|
495
|
-
return this.coreAdapterService.getFocusableChildren(
|
|
496
|
-
/* Sanity check - calling function also has null check */
|
|
497
|
-
/* istanbul ignore next */
|
|
498
|
-
overlay === null || overlay === void 0 ? void 0 : overlay.componentRef.location.nativeElement, { ignoreTabIndex: true });
|
|
499
|
-
};
|
|
500
|
-
/**
|
|
501
|
-
* Removes the className for the provided element.
|
|
502
|
-
*/
|
|
503
|
-
SkyAutocompleteAdapterService.prototype.removeCSSClass = function (element, className) {
|
|
504
|
-
/* Sanity check */
|
|
505
|
-
/* istanbul ignore else */
|
|
506
|
-
if (element) {
|
|
507
|
-
this.renderer.removeClass(element, className);
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
SkyAutocompleteAdapterService.prototype.setDropdownWidth = function (elementRef, dropdownRef, isInputBox) {
|
|
511
|
-
var parentElement = isInputBox
|
|
512
|
-
? elementRef.nativeElement.closest('.sky-input-box')
|
|
513
|
-
: elementRef.nativeElement;
|
|
514
|
-
if (parentElement) {
|
|
515
|
-
var width = parentElement.getBoundingClientRect().width;
|
|
516
|
-
this.renderer.setStyle(dropdownRef.nativeElement, 'width', width + "px");
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
/**
|
|
520
|
-
* Sets the `tabIndex` of the `element` to the provided `tabIndex`.
|
|
521
|
-
*/
|
|
522
|
-
SkyAutocompleteAdapterService.prototype.setTabIndex = function (element, tabIndex) {
|
|
523
|
-
element.tabIndex = tabIndex;
|
|
524
|
-
};
|
|
525
|
-
return SkyAutocompleteAdapterService;
|
|
526
|
-
}());
|
|
527
|
-
SkyAutocompleteAdapterService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutocompleteAdapterService, deps: [{ token: i1__namespace.SkyCoreAdapterService }, { token: i0__namespace.RendererFactory2 }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
528
|
-
SkyAutocompleteAdapterService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutocompleteAdapterService });
|
|
529
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutocompleteAdapterService, decorators: [{
|
|
530
|
-
type: i0.Injectable
|
|
531
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.SkyCoreAdapterService }, { type: i0__namespace.RendererFactory2 }]; } });
|
|
532
|
-
|
|
533
703
|
/**
|
|
534
704
|
* Removes diacritical characters from strings and replaces them with their normalized equivalent.
|
|
535
705
|
* For example: è becomes e, Å becomes A.
|
|
@@ -538,319 +708,119 @@
|
|
|
538
708
|
return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
539
709
|
}
|
|
540
710
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
if (!searchText) {
|
|
559
|
-
return results;
|
|
560
|
-
}
|
|
561
|
-
var searchTextNormalized = normalizeDiacritics(searchText).toUpperCase();
|
|
562
|
-
var filteredData = filterData(searchText, data);
|
|
563
|
-
var _loop_1 = function (i, n) {
|
|
564
|
-
var result = filteredData[i];
|
|
565
|
-
var isMatch = options.propertiesToSearch.find(function (property) {
|
|
566
|
-
var value = (result[property] || '').toString();
|
|
567
|
-
value = normalizeDiacritics(value).toUpperCase();
|
|
568
|
-
return value.indexOf(searchTextNormalized) > -1;
|
|
569
|
-
});
|
|
570
|
-
if (isMatch) {
|
|
571
|
-
results.push(result);
|
|
572
|
-
}
|
|
573
|
-
};
|
|
574
|
-
for (var i = 0, n = filteredData.length; i < n; i++) {
|
|
575
|
-
_loop_1(i, n);
|
|
711
|
+
/**
|
|
712
|
+
* @internal
|
|
713
|
+
*/
|
|
714
|
+
var SkyAutocompleteAdapterService = /** @class */ (function () {
|
|
715
|
+
function SkyAutocompleteAdapterService(coreAdapterService, rendererFactory) {
|
|
716
|
+
this.coreAdapterService = coreAdapterService;
|
|
717
|
+
this.rendererFactory = rendererFactory;
|
|
718
|
+
this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Adds the className for the provided element.
|
|
722
|
+
*/
|
|
723
|
+
SkyAutocompleteAdapterService.prototype.addCSSClass = function (element, className) {
|
|
724
|
+
/* Sanity check */
|
|
725
|
+
/* istanbul ignore else */
|
|
726
|
+
if (element) {
|
|
727
|
+
this.renderer.addClass(element, className);
|
|
576
728
|
}
|
|
577
|
-
return results;
|
|
578
729
|
};
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
// tslint:disable:no-forward-ref no-use-before-declare
|
|
583
|
-
var SKY_AUTOCOMPLETE_VALUE_ACCESSOR = {
|
|
584
|
-
provide: i8.NG_VALUE_ACCESSOR,
|
|
585
|
-
useExisting: i0.forwardRef(function () { return SkyAutocompleteInputDirective; }),
|
|
586
|
-
multi: true,
|
|
587
|
-
};
|
|
588
|
-
var SKY_AUTOCOMPLETE_VALIDATOR = {
|
|
589
|
-
provide: i8.NG_VALIDATORS,
|
|
590
|
-
useExisting: i0.forwardRef(function () { return SkyAutocompleteInputDirective; }),
|
|
591
|
-
multi: true,
|
|
592
|
-
};
|
|
593
|
-
// tslint:enable
|
|
594
|
-
var SkyAutocompleteInputDirective = /** @class */ (function () {
|
|
595
|
-
function SkyAutocompleteInputDirective(elementRef, renderer) {
|
|
596
|
-
this.elementRef = elementRef;
|
|
597
|
-
this.renderer = renderer;
|
|
598
|
-
this.isFirstChange = true;
|
|
599
|
-
this.ngUnsubscribe = new rxjs.Subject();
|
|
600
|
-
this._blur = new rxjs.Subject();
|
|
601
|
-
this._disabled = false;
|
|
602
|
-
this._focus = new rxjs.Subject();
|
|
603
|
-
this._textChanges = new rxjs.Subject();
|
|
730
|
+
SkyAutocompleteAdapterService.prototype.getOverlayFocusableElements = function (overlay) {
|
|
731
|
+
return this.coreAdapterService.getFocusableChildren(
|
|
732
|
+
/* Sanity check - calling function also has null check */
|
|
604
733
|
/* istanbul ignore next */
|
|
605
|
-
|
|
606
|
-
}
|
|
607
|
-
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "autocompleteAttribute", {
|
|
608
|
-
get: function () {
|
|
609
|
-
return this._autocompleteAttribute || 'off';
|
|
610
|
-
},
|
|
611
|
-
/**
|
|
612
|
-
* Specifies the value for the `autocomplete` attribute on the form input.
|
|
613
|
-
* @default "off"
|
|
614
|
-
*/
|
|
615
|
-
set: function (value) {
|
|
616
|
-
if (!value) {
|
|
617
|
-
this._autocompleteAttribute = 'off';
|
|
618
|
-
}
|
|
619
|
-
else {
|
|
620
|
-
this._autocompleteAttribute = value;
|
|
621
|
-
}
|
|
622
|
-
this.renderer.setAttribute(this.elementRef.nativeElement, 'autocomplete', this.autocompleteAttribute);
|
|
623
|
-
},
|
|
624
|
-
enumerable: false,
|
|
625
|
-
configurable: true
|
|
626
|
-
});
|
|
627
|
-
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "disabled", {
|
|
628
|
-
get: function () {
|
|
629
|
-
return this._disabled;
|
|
630
|
-
},
|
|
631
|
-
/**
|
|
632
|
-
* Indicates whether to disable the autocomplete field.
|
|
633
|
-
* @default false
|
|
634
|
-
*/
|
|
635
|
-
set: function (value) {
|
|
636
|
-
this._disabled = value;
|
|
637
|
-
this.renderer.setProperty(this.elementRef.nativeElement, 'disabled', value);
|
|
638
|
-
},
|
|
639
|
-
enumerable: false,
|
|
640
|
-
configurable: true
|
|
641
|
-
});
|
|
642
|
-
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "blur", {
|
|
643
|
-
get: function () {
|
|
644
|
-
return this._blur.asObservable();
|
|
645
|
-
},
|
|
646
|
-
enumerable: false,
|
|
647
|
-
configurable: true
|
|
648
|
-
});
|
|
649
|
-
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "displayWith", {
|
|
650
|
-
get: function () {
|
|
651
|
-
return this._displayWith;
|
|
652
|
-
},
|
|
653
|
-
set: function (value) {
|
|
654
|
-
this._displayWith = value;
|
|
655
|
-
this.inputTextValue = this.getValueByKey();
|
|
656
|
-
},
|
|
657
|
-
enumerable: false,
|
|
658
|
-
configurable: true
|
|
659
|
-
});
|
|
660
|
-
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "inputElement", {
|
|
661
|
-
/**
|
|
662
|
-
* @internal
|
|
663
|
-
*/
|
|
664
|
-
get: function () {
|
|
665
|
-
return this.elementRef.nativeElement;
|
|
666
|
-
},
|
|
667
|
-
enumerable: false,
|
|
668
|
-
configurable: true
|
|
669
|
-
});
|
|
670
|
-
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "focus", {
|
|
671
|
-
get: function () {
|
|
672
|
-
return this._focus.asObservable();
|
|
673
|
-
},
|
|
674
|
-
enumerable: false,
|
|
675
|
-
configurable: true
|
|
676
|
-
});
|
|
677
|
-
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "inputTextValue", {
|
|
678
|
-
get: function () {
|
|
679
|
-
return this.elementRef.nativeElement.value;
|
|
680
|
-
},
|
|
681
|
-
set: function (value) {
|
|
682
|
-
this.elementRef.nativeElement.value = value || '';
|
|
683
|
-
},
|
|
684
|
-
enumerable: false,
|
|
685
|
-
configurable: true
|
|
686
|
-
});
|
|
687
|
-
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "textChanges", {
|
|
688
|
-
get: function () {
|
|
689
|
-
return this._textChanges.asObservable();
|
|
690
|
-
},
|
|
691
|
-
enumerable: false,
|
|
692
|
-
configurable: true
|
|
693
|
-
});
|
|
694
|
-
Object.defineProperty(SkyAutocompleteInputDirective.prototype, "value", {
|
|
695
|
-
get: function () {
|
|
696
|
-
return this._value;
|
|
697
|
-
},
|
|
698
|
-
set: function (value) {
|
|
699
|
-
var isNewValue = value !== this._value;
|
|
700
|
-
/* istanbul ignore else */
|
|
701
|
-
if (isNewValue) {
|
|
702
|
-
this._value = value;
|
|
703
|
-
this.inputTextValue = this.getValueByKey();
|
|
704
|
-
this.onChange(this._value);
|
|
705
|
-
// Do not mark the field as "dirty"
|
|
706
|
-
// if the field has been initialized with a value.
|
|
707
|
-
if (this.isFirstChange && this.control) {
|
|
708
|
-
this.control.markAsPristine();
|
|
709
|
-
}
|
|
710
|
-
if (this.isFirstChange && this._value) {
|
|
711
|
-
this.isFirstChange = false;
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
},
|
|
715
|
-
enumerable: false,
|
|
716
|
-
configurable: true
|
|
717
|
-
});
|
|
718
|
-
SkyAutocompleteInputDirective.prototype.ngOnInit = function () {
|
|
719
|
-
var _this = this;
|
|
720
|
-
var element = this.elementRef.nativeElement;
|
|
721
|
-
this.setAttributes(element);
|
|
722
|
-
rxjs.fromEvent(element, 'input')
|
|
723
|
-
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
724
|
-
.subscribe(function () {
|
|
725
|
-
/** Sanity check */
|
|
726
|
-
if (!_this.disabled) {
|
|
727
|
-
_this._textChanges.next({
|
|
728
|
-
value: _this.elementRef.nativeElement.value,
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
});
|
|
732
|
-
rxjs.fromEvent(element, 'blur')
|
|
733
|
-
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
734
|
-
.subscribe(function () {
|
|
735
|
-
/** Sanity check */
|
|
736
|
-
if (!_this.disabled) {
|
|
737
|
-
_this._blur.next();
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
rxjs.fromEvent(element, 'focus')
|
|
741
|
-
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
742
|
-
.subscribe(function () {
|
|
743
|
-
/** Sanity check */
|
|
744
|
-
if (!_this.disabled) {
|
|
745
|
-
_this._focus.next();
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
rxjs.fromEvent(element, 'change')
|
|
749
|
-
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
750
|
-
.subscribe(function () {
|
|
751
|
-
/** Sanity check */
|
|
752
|
-
/* istanbul ignore else */
|
|
753
|
-
if (!_this.disabled) {
|
|
754
|
-
_this.isFirstChange = false;
|
|
755
|
-
}
|
|
756
|
-
});
|
|
757
|
-
};
|
|
758
|
-
SkyAutocompleteInputDirective.prototype.ngOnDestroy = function () {
|
|
759
|
-
this._blur.complete();
|
|
760
|
-
this._textChanges.complete();
|
|
761
|
-
this.ngUnsubscribe.next();
|
|
762
|
-
this.ngUnsubscribe.complete();
|
|
763
|
-
this._blur = this._textChanges = this.ngUnsubscribe = undefined;
|
|
764
|
-
};
|
|
765
|
-
SkyAutocompleteInputDirective.prototype.writeValue = function (value) {
|
|
766
|
-
this.value = value;
|
|
767
|
-
};
|
|
768
|
-
SkyAutocompleteInputDirective.prototype.registerOnChange = function (fn) {
|
|
769
|
-
this.onChange = fn;
|
|
770
|
-
};
|
|
771
|
-
SkyAutocompleteInputDirective.prototype.registerOnTouched = function (fn) {
|
|
772
|
-
this.onTouched = fn;
|
|
734
|
+
overlay === null || overlay === void 0 ? void 0 : overlay.componentRef.location.nativeElement, { ignoreTabIndex: true });
|
|
773
735
|
};
|
|
774
|
-
|
|
775
|
-
|
|
736
|
+
/**
|
|
737
|
+
* Removes the className for the provided element.
|
|
738
|
+
*/
|
|
739
|
+
SkyAutocompleteAdapterService.prototype.removeCSSClass = function (element, className) {
|
|
740
|
+
/* Sanity check */
|
|
741
|
+
/* istanbul ignore else */
|
|
742
|
+
if (element) {
|
|
743
|
+
this.renderer.removeClass(element, className);
|
|
744
|
+
}
|
|
776
745
|
};
|
|
777
|
-
|
|
778
|
-
var
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
if (
|
|
782
|
-
|
|
746
|
+
SkyAutocompleteAdapterService.prototype.setDropdownWidth = function (elementRef, dropdownRef, isInputBox) {
|
|
747
|
+
var parentElement = isInputBox
|
|
748
|
+
? elementRef.nativeElement.closest('.sky-input-box')
|
|
749
|
+
: elementRef.nativeElement;
|
|
750
|
+
if (parentElement) {
|
|
751
|
+
var width = parentElement.getBoundingClientRect().width;
|
|
752
|
+
this.renderer.setStyle(dropdownRef.nativeElement, 'width', width + "px");
|
|
783
753
|
}
|
|
784
|
-
this.onTouched();
|
|
785
754
|
};
|
|
786
|
-
|
|
787
|
-
|
|
755
|
+
/**
|
|
756
|
+
* Sets the `tabIndex` of the `element` to the provided `tabIndex`.
|
|
757
|
+
*/
|
|
758
|
+
SkyAutocompleteAdapterService.prototype.setTabIndex = function (element, tabIndex) {
|
|
759
|
+
element.tabIndex = tabIndex;
|
|
788
760
|
};
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
761
|
+
return SkyAutocompleteAdapterService;
|
|
762
|
+
}());
|
|
763
|
+
SkyAutocompleteAdapterService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutocompleteAdapterService, deps: [{ token: i1__namespace.SkyCoreAdapterService }, { token: i0__namespace.RendererFactory2 }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
764
|
+
SkyAutocompleteAdapterService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutocompleteAdapterService });
|
|
765
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutocompleteAdapterService, decorators: [{
|
|
766
|
+
type: i0.Injectable
|
|
767
|
+
}], ctorParameters: function () { return [{ type: i1__namespace.SkyCoreAdapterService }, { type: i0__namespace.RendererFactory2 }]; } });
|
|
768
|
+
|
|
769
|
+
function skyAutocompleteDefaultSearchFunction(options) {
|
|
770
|
+
var filterData = function (searchText, data) {
|
|
771
|
+
return data.filter(function (item) {
|
|
772
|
+
if (!options.searchFilters || !options.searchFilters.length) {
|
|
773
|
+
return true;
|
|
774
|
+
}
|
|
775
|
+
// Find the first failing filter (we can skip the others if one fails).
|
|
776
|
+
var failedFilter = options.searchFilters.find(function (filter) {
|
|
777
|
+
return !filter.call({}, searchText, item);
|
|
778
|
+
});
|
|
779
|
+
return failedFilter === undefined;
|
|
780
|
+
});
|
|
794
781
|
};
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
782
|
+
var search = function (searchText, data) {
|
|
783
|
+
var results = [];
|
|
784
|
+
/* Sanity check - autocomplete will not call search with empty search text */
|
|
785
|
+
/* istanbul ignore if */
|
|
786
|
+
if (!searchText) {
|
|
787
|
+
return results;
|
|
799
788
|
}
|
|
800
|
-
|
|
801
|
-
|
|
789
|
+
var searchTextNormalized = normalizeDiacritics(searchText).toUpperCase();
|
|
790
|
+
var filteredData = filterData(searchText, data);
|
|
791
|
+
var _loop_1 = function (i, n) {
|
|
792
|
+
var result = filteredData[i];
|
|
793
|
+
var isMatch = options.propertiesToSearch.find(function (property) {
|
|
794
|
+
var value = (result[property] || '').toString();
|
|
795
|
+
value = normalizeDiacritics(value).toUpperCase();
|
|
796
|
+
return value.indexOf(searchTextNormalized) > -1;
|
|
797
|
+
});
|
|
798
|
+
if (isMatch) {
|
|
799
|
+
results.push(result);
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
for (var i = 0, n = filteredData.length; i < n; i++) {
|
|
803
|
+
_loop_1(i, n);
|
|
802
804
|
}
|
|
805
|
+
return results;
|
|
803
806
|
};
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
SkyAutocompleteInputDirective.prototype.onChange = function (value) { };
|
|
807
|
-
/* istanbul ignore next */
|
|
808
|
-
SkyAutocompleteInputDirective.prototype.onTouched = function () { };
|
|
809
|
-
SkyAutocompleteInputDirective.prototype.setAttributes = function (element) {
|
|
810
|
-
this.renderer.setAttribute(element, 'autocomplete', this.autocompleteAttribute);
|
|
811
|
-
this.renderer.setAttribute(element, 'autocapitalize', 'none');
|
|
812
|
-
this.renderer.setAttribute(element, 'autocorrect', 'off');
|
|
813
|
-
this.renderer.setAttribute(element, 'spellcheck', 'false');
|
|
814
|
-
this.renderer.addClass(element, 'sky-form-control');
|
|
815
|
-
};
|
|
816
|
-
SkyAutocompleteInputDirective.prototype.getValueByKey = function () {
|
|
817
|
-
return this.value ? this.value[this.displayWith] : undefined;
|
|
818
|
-
};
|
|
819
|
-
return SkyAutocompleteInputDirective;
|
|
820
|
-
}());
|
|
821
|
-
SkyAutocompleteInputDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutocompleteInputDirective, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.Renderer2 }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
822
|
-
SkyAutocompleteInputDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyAutocompleteInputDirective, selector: "input[skyAutocomplete], textarea[skyAutocomplete]", inputs: { autocompleteAttribute: "autocompleteAttribute", disabled: "disabled" }, providers: [SKY_AUTOCOMPLETE_VALUE_ACCESSOR, SKY_AUTOCOMPLETE_VALIDATOR], ngImport: i0__namespace });
|
|
823
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutocompleteInputDirective, decorators: [{
|
|
824
|
-
type: i0.Directive,
|
|
825
|
-
args: [{
|
|
826
|
-
selector: 'input[skyAutocomplete], textarea[skyAutocomplete]',
|
|
827
|
-
providers: [SKY_AUTOCOMPLETE_VALUE_ACCESSOR, SKY_AUTOCOMPLETE_VALIDATOR],
|
|
828
|
-
}]
|
|
829
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.Renderer2 }]; }, propDecorators: { autocompleteAttribute: [{
|
|
830
|
-
type: i0.Input
|
|
831
|
-
}], disabled: [{
|
|
832
|
-
type: i0.Input
|
|
833
|
-
}] } });
|
|
807
|
+
return search;
|
|
808
|
+
}
|
|
834
809
|
|
|
835
810
|
/**
|
|
836
811
|
* @internal
|
|
837
812
|
*/
|
|
838
|
-
var
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
type: i0.Pipe,
|
|
850
|
-
args: [{
|
|
851
|
-
name: 'skyAutocompleteSearchAsyncDisabled',
|
|
852
|
-
}]
|
|
853
|
-
}] });
|
|
813
|
+
var SkyAutocompleteMessageType;
|
|
814
|
+
(function (SkyAutocompleteMessageType) {
|
|
815
|
+
/**
|
|
816
|
+
* Closes the dropdown.
|
|
817
|
+
*/
|
|
818
|
+
SkyAutocompleteMessageType[SkyAutocompleteMessageType["CloseDropdown"] = 0] = "CloseDropdown";
|
|
819
|
+
/**
|
|
820
|
+
* Repositions the dropdown.
|
|
821
|
+
*/
|
|
822
|
+
SkyAutocompleteMessageType[SkyAutocompleteMessageType["RepositionDropdown"] = 1] = "RepositionDropdown";
|
|
823
|
+
})(SkyAutocompleteMessageType || (SkyAutocompleteMessageType = {}));
|
|
854
824
|
|
|
855
825
|
var uniqueId$1 = 0;
|
|
856
826
|
var SkyAutocompleteComponent = /** @class */ (function () {
|
|
@@ -887,6 +857,10 @@
|
|
|
887
857
|
* Fires when users select the button to view all options.
|
|
888
858
|
*/
|
|
889
859
|
this.showMoreClick = new i0.EventEmitter();
|
|
860
|
+
/**
|
|
861
|
+
* Fires when users enter new search information and allows results to be
|
|
862
|
+
* returned via an observable.
|
|
863
|
+
*/
|
|
890
864
|
this.searchAsync = new i0.EventEmitter();
|
|
891
865
|
this.isOpen = false;
|
|
892
866
|
this.isSearchingAsync = false;
|
|
@@ -914,7 +888,7 @@
|
|
|
914
888
|
/**
|
|
915
889
|
* Specifies a static data source for the autocomplete component to search
|
|
916
890
|
* when users enter text. For a dynamic data source such as an array that
|
|
917
|
-
* changes due to server calls, use
|
|
891
|
+
* changes due to server calls, use `search` or `searchAsync` instead.
|
|
918
892
|
*/
|
|
919
893
|
set: function (value) {
|
|
920
894
|
this._data = value;
|
|
@@ -993,7 +967,9 @@
|
|
|
993
967
|
* Specifies a function to dynamically manage the data source when users
|
|
994
968
|
* change the text in the autocomplete field. The search function must return
|
|
995
969
|
* an array or a promise of an array. The `search` property is particularly
|
|
996
|
-
* useful when the data source does not live in the source code.
|
|
970
|
+
* useful when the data source does not live in the source code. If the
|
|
971
|
+
* search requires calling a remote data source, use `searchAsync` instead of
|
|
972
|
+
* `search`.
|
|
997
973
|
*/
|
|
998
974
|
set: function (value) {
|
|
999
975
|
this._search = value;
|
|
@@ -1993,7 +1969,7 @@
|
|
|
1993
1969
|
// Ignoring coverage here as this will be removed in the next release.
|
|
1994
1970
|
// istanbul ignore next
|
|
1995
1971
|
if (!this.includePhoneInfo && !this.hideSelectedCountryFlag) {
|
|
1996
|
-
if ((_b = (_a =
|
|
1972
|
+
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')) {
|
|
1997
1973
|
this.includePhoneInfo = true;
|
|
1998
1974
|
this.hideSelectedCountryFlag = true;
|
|
1999
1975
|
}
|
|
@@ -2143,123 +2119,9 @@
|
|
|
2143
2119
|
SkyLookupResourcesModule,
|
|
2144
2120
|
i7.SkyThemeModule,
|
|
2145
2121
|
],
|
|
2146
|
-
exports: [SkyCountryFieldComponent],
|
|
2147
|
-
}]
|
|
2148
|
-
}] });
|
|
2149
|
-
|
|
2150
|
-
/**
|
|
2151
|
-
* @internal
|
|
2152
|
-
*/
|
|
2153
|
-
var SkyLookupAutocompleteAdapter = /** @class */ (function () {
|
|
2154
|
-
function SkyLookupAutocompleteAdapter() {
|
|
2155
|
-
this.searchAsync = new i0.EventEmitter();
|
|
2156
|
-
}
|
|
2157
|
-
Object.defineProperty(SkyLookupAutocompleteAdapter.prototype, "descriptorProperty", {
|
|
2158
|
-
get: function () {
|
|
2159
|
-
return this._descriptorProperty || 'name';
|
|
2160
|
-
},
|
|
2161
|
-
/**
|
|
2162
|
-
* Specifies an object property to display in the text input after users
|
|
2163
|
-
* select an item in the dropdown list.
|
|
2164
|
-
* @default "name"
|
|
2165
|
-
*/
|
|
2166
|
-
set: function (value) {
|
|
2167
|
-
this._descriptorProperty = value;
|
|
2168
|
-
},
|
|
2169
|
-
enumerable: false,
|
|
2170
|
-
configurable: true
|
|
2171
|
-
});
|
|
2172
|
-
Object.defineProperty(SkyLookupAutocompleteAdapter.prototype, "propertiesToSearch", {
|
|
2173
|
-
get: function () {
|
|
2174
|
-
return this._propertiesToSearch || ['name'];
|
|
2175
|
-
},
|
|
2176
|
-
/**
|
|
2177
|
-
* Specifies an array of object properties to search.
|
|
2178
|
-
* @default ["name"]
|
|
2179
|
-
*/
|
|
2180
|
-
set: function (value) {
|
|
2181
|
-
this._propertiesToSearch = value;
|
|
2182
|
-
},
|
|
2183
|
-
enumerable: false,
|
|
2184
|
-
configurable: true
|
|
2185
|
-
});
|
|
2186
|
-
Object.defineProperty(SkyLookupAutocompleteAdapter.prototype, "search", {
|
|
2187
|
-
get: function () {
|
|
2188
|
-
return (this._search ||
|
|
2189
|
-
skyAutocompleteDefaultSearchFunction({
|
|
2190
|
-
propertiesToSearch: this.propertiesToSearch,
|
|
2191
|
-
searchFilters: this.searchFilters,
|
|
2192
|
-
}));
|
|
2193
|
-
},
|
|
2194
|
-
/**
|
|
2195
|
-
* Specifies a function to dynamically manage the data source when users
|
|
2196
|
-
* change the text in the lookup field. The search function must return
|
|
2197
|
-
* an array or a promise of an array. The `search` property is particularly
|
|
2198
|
-
* useful when the data source does not live in the source code.
|
|
2199
|
-
*/
|
|
2200
|
-
set: function (value) {
|
|
2201
|
-
this._search = value;
|
|
2202
|
-
},
|
|
2203
|
-
enumerable: false,
|
|
2204
|
-
configurable: true
|
|
2205
|
-
});
|
|
2206
|
-
return SkyLookupAutocompleteAdapter;
|
|
2207
|
-
}());
|
|
2208
|
-
SkyLookupAutocompleteAdapter.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAutocompleteAdapter, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2209
|
-
SkyLookupAutocompleteAdapter.ɵdir = i0__namespace.ɵɵ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__namespace });
|
|
2210
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAutocompleteAdapter, decorators: [{
|
|
2211
|
-
type: i0.Directive
|
|
2212
|
-
}], propDecorators: { debounceTime: [{
|
|
2213
|
-
type: i0.Input
|
|
2214
|
-
}], descriptorProperty: [{
|
|
2215
|
-
type: i0.Input
|
|
2216
|
-
}], propertiesToSearch: [{
|
|
2217
|
-
type: i0.Input
|
|
2218
|
-
}], search: [{
|
|
2219
|
-
type: i0.Input
|
|
2220
|
-
}], searchResultTemplate: [{
|
|
2221
|
-
type: i0.Input
|
|
2222
|
-
}], searchTextMinimumCharacters: [{
|
|
2223
|
-
type: i0.Input
|
|
2224
|
-
}], searchFilters: [{
|
|
2225
|
-
type: i0.Input
|
|
2226
|
-
}], searchResultsLimit: [{
|
|
2227
|
-
type: i0.Input
|
|
2228
|
-
}], searchAsync: [{
|
|
2229
|
-
type: i0.Output
|
|
2230
|
-
}] } });
|
|
2231
|
-
|
|
2232
|
-
/**
|
|
2233
|
-
* @internal
|
|
2234
|
-
*/
|
|
2235
|
-
var SkyLookupAdapterService = /** @class */ (function () {
|
|
2236
|
-
function SkyLookupAdapterService() {
|
|
2237
|
-
}
|
|
2238
|
-
SkyLookupAdapterService.prototype.focusInput = function (elRef) {
|
|
2239
|
-
var inputEl = elRef.nativeElement.querySelector('.sky-lookup-input');
|
|
2240
|
-
/* Sanity check */
|
|
2241
|
-
/* istanbul ignore else */
|
|
2242
|
-
if (inputEl) {
|
|
2243
|
-
inputEl.focus();
|
|
2244
|
-
}
|
|
2245
|
-
};
|
|
2246
|
-
return SkyLookupAdapterService;
|
|
2247
|
-
}());
|
|
2248
|
-
SkyLookupAdapterService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAdapterService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2249
|
-
SkyLookupAdapterService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAdapterService });
|
|
2250
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAdapterService, decorators: [{
|
|
2251
|
-
type: i0.Injectable
|
|
2252
|
-
}] });
|
|
2253
|
-
|
|
2254
|
-
/**
|
|
2255
|
-
* @internal
|
|
2256
|
-
* Context for the show more native picker. These values are provided by the lookup component.
|
|
2257
|
-
*/
|
|
2258
|
-
var SkyLookupShowMoreNativePickerContext = /** @class */ (function () {
|
|
2259
|
-
function SkyLookupShowMoreNativePickerContext() {
|
|
2260
|
-
}
|
|
2261
|
-
return SkyLookupShowMoreNativePickerContext;
|
|
2262
|
-
}());
|
|
2122
|
+
exports: [SkyCountryFieldComponent],
|
|
2123
|
+
}]
|
|
2124
|
+
}] });
|
|
2263
2125
|
|
|
2264
2126
|
/**
|
|
2265
2127
|
* @internal
|
|
@@ -2552,6 +2414,279 @@
|
|
|
2552
2414
|
type: i0.Input
|
|
2553
2415
|
}] } });
|
|
2554
2416
|
|
|
2417
|
+
var SkySearchModule = /** @class */ (function () {
|
|
2418
|
+
function SkySearchModule() {
|
|
2419
|
+
}
|
|
2420
|
+
return SkySearchModule;
|
|
2421
|
+
}());
|
|
2422
|
+
SkySearchModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkySearchModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2423
|
+
SkySearchModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkySearchModule, declarations: [SkySearchComponent], imports: [i6$1.CommonModule,
|
|
2424
|
+
i6.SkyInputBoxModule,
|
|
2425
|
+
SkyLookupResourcesModule,
|
|
2426
|
+
i8.FormsModule,
|
|
2427
|
+
i4.SkyIconModule,
|
|
2428
|
+
i7.SkyThemeModule,
|
|
2429
|
+
i1.SkyIdModule], exports: [SkySearchComponent] });
|
|
2430
|
+
SkySearchModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkySearchModule, imports: [[
|
|
2431
|
+
i6$1.CommonModule,
|
|
2432
|
+
i6.SkyInputBoxModule,
|
|
2433
|
+
SkyLookupResourcesModule,
|
|
2434
|
+
i8.FormsModule,
|
|
2435
|
+
i4.SkyIconModule,
|
|
2436
|
+
i7.SkyThemeModule,
|
|
2437
|
+
i1.SkyIdModule,
|
|
2438
|
+
]] });
|
|
2439
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkySearchModule, decorators: [{
|
|
2440
|
+
type: i0.NgModule,
|
|
2441
|
+
args: [{
|
|
2442
|
+
declarations: [SkySearchComponent],
|
|
2443
|
+
imports: [
|
|
2444
|
+
i6$1.CommonModule,
|
|
2445
|
+
i6.SkyInputBoxModule,
|
|
2446
|
+
SkyLookupResourcesModule,
|
|
2447
|
+
i8.FormsModule,
|
|
2448
|
+
i4.SkyIconModule,
|
|
2449
|
+
i7.SkyThemeModule,
|
|
2450
|
+
i1.SkyIdModule,
|
|
2451
|
+
],
|
|
2452
|
+
exports: [SkySearchComponent],
|
|
2453
|
+
}]
|
|
2454
|
+
}] });
|
|
2455
|
+
|
|
2456
|
+
var SkyLookupItemSelectedPipe = /** @class */ (function () {
|
|
2457
|
+
function SkyLookupItemSelectedPipe() {
|
|
2458
|
+
}
|
|
2459
|
+
SkyLookupItemSelectedPipe.prototype.transform = function (id, selectedIdMap) {
|
|
2460
|
+
return selectedIdMap.has(id);
|
|
2461
|
+
};
|
|
2462
|
+
return SkyLookupItemSelectedPipe;
|
|
2463
|
+
}());
|
|
2464
|
+
SkyLookupItemSelectedPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupItemSelectedPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
2465
|
+
SkyLookupItemSelectedPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupItemSelectedPipe, name: "skyLookupItemSelected" });
|
|
2466
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupItemSelectedPipe, decorators: [{
|
|
2467
|
+
type: i0.Pipe,
|
|
2468
|
+
args: [{
|
|
2469
|
+
name: 'skyLookupItemSelected',
|
|
2470
|
+
}]
|
|
2471
|
+
}] });
|
|
2472
|
+
|
|
2473
|
+
/**
|
|
2474
|
+
* @internal
|
|
2475
|
+
* Context for the show more native picker. These values are provided by the lookup component.
|
|
2476
|
+
*/
|
|
2477
|
+
var SkyLookupShowMoreNativePickerAsyncContext = /** @class */ (function () {
|
|
2478
|
+
function SkyLookupShowMoreNativePickerAsyncContext() {
|
|
2479
|
+
}
|
|
2480
|
+
return SkyLookupShowMoreNativePickerAsyncContext;
|
|
2481
|
+
}());
|
|
2482
|
+
|
|
2483
|
+
/**
|
|
2484
|
+
* @internal
|
|
2485
|
+
* Internal component to implement the native picker.
|
|
2486
|
+
*/
|
|
2487
|
+
var SkyLookupShowMoreAsyncModalComponent = /** @class */ (function () {
|
|
2488
|
+
function SkyLookupShowMoreAsyncModalComponent(modalInstance, context, changeDetector) {
|
|
2489
|
+
this.modalInstance = modalInstance;
|
|
2490
|
+
this.context = context;
|
|
2491
|
+
this.changeDetector = changeDetector;
|
|
2492
|
+
/**
|
|
2493
|
+
* @internal
|
|
2494
|
+
* Fires when users select the button to add new options to the list.
|
|
2495
|
+
*/
|
|
2496
|
+
this.addClick = new rxjs.Subject();
|
|
2497
|
+
this.displayedItems = [];
|
|
2498
|
+
this.onlyShowSelected = false;
|
|
2499
|
+
this.isSearching = false;
|
|
2500
|
+
this.hasMoreItems = false;
|
|
2501
|
+
this.isLoadingMore = false;
|
|
2502
|
+
this.offset = 0;
|
|
2503
|
+
this.ngUnsubscribe = new rxjs.Subject();
|
|
2504
|
+
}
|
|
2505
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.ngOnInit = function () {
|
|
2506
|
+
this.searchText = this.context.initialSearch;
|
|
2507
|
+
this.createInitialSelectedItemsMap();
|
|
2508
|
+
this.loadSearchResults();
|
|
2509
|
+
};
|
|
2510
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.ngOnDestroy = function () {
|
|
2511
|
+
this.cancelCurrentSearch();
|
|
2512
|
+
this.ngUnsubscribe.next();
|
|
2513
|
+
this.ngUnsubscribe.complete();
|
|
2514
|
+
};
|
|
2515
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.addButtonClicked = function () {
|
|
2516
|
+
this.addClick.next();
|
|
2517
|
+
};
|
|
2518
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.clearAll = function () {
|
|
2519
|
+
var e_1, _a;
|
|
2520
|
+
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2521
|
+
try {
|
|
2522
|
+
// Only deselect items that have been loaded; items that would be loaded
|
|
2523
|
+
// after an infinite scroll event should remain selected.
|
|
2524
|
+
for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2525
|
+
var item = _c.value;
|
|
2526
|
+
this.selectedIdMap.delete(item[this.context.idProperty]);
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2530
|
+
finally {
|
|
2531
|
+
try {
|
|
2532
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2533
|
+
}
|
|
2534
|
+
finally { if (e_1) throw e_1.error; }
|
|
2535
|
+
}
|
|
2536
|
+
this.updateDisplayedItems();
|
|
2537
|
+
this.changeDetector.markForCheck();
|
|
2538
|
+
};
|
|
2539
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.itemClick = function (selectedItem) {
|
|
2540
|
+
if (this.context.selectMode === 'single') {
|
|
2541
|
+
this.onItemSelect(!selectedItem.selected, selectedItem);
|
|
2542
|
+
}
|
|
2543
|
+
};
|
|
2544
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.onItemSelect = function (newSelectState, itemToSelect) {
|
|
2545
|
+
var itemId = itemToSelect[this.context.idProperty];
|
|
2546
|
+
// Create a new Map so the pipe transform will execute on the next
|
|
2547
|
+
// change detection cycle.
|
|
2548
|
+
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2549
|
+
if (this.context.selectMode === 'single') {
|
|
2550
|
+
if (newSelectState) {
|
|
2551
|
+
this.selectedIdMap.clear();
|
|
2552
|
+
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
else {
|
|
2556
|
+
if (newSelectState) {
|
|
2557
|
+
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2558
|
+
}
|
|
2559
|
+
else {
|
|
2560
|
+
this.selectedIdMap.delete(itemId);
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
this.updateDisplayedItems();
|
|
2564
|
+
};
|
|
2565
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.searchApplied = function (searchText) {
|
|
2566
|
+
this.offset = 0;
|
|
2567
|
+
this.searchText = searchText;
|
|
2568
|
+
this.loadSearchResults();
|
|
2569
|
+
};
|
|
2570
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.selectAll = function () {
|
|
2571
|
+
var e_2, _a;
|
|
2572
|
+
this.selectedIdMap = new Map();
|
|
2573
|
+
try {
|
|
2574
|
+
for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2575
|
+
var item = _c.value;
|
|
2576
|
+
this.selectedIdMap.set(item[this.context.idProperty], item);
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2580
|
+
finally {
|
|
2581
|
+
try {
|
|
2582
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2583
|
+
}
|
|
2584
|
+
finally { if (e_2) throw e_2.error; }
|
|
2585
|
+
}
|
|
2586
|
+
this.updateDisplayedItems();
|
|
2587
|
+
};
|
|
2588
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.infiniteScrollEnd = function () {
|
|
2589
|
+
var _this = this;
|
|
2590
|
+
this.cancelCurrentSearch();
|
|
2591
|
+
/* Sanity check - else case would only happen if this was called directly */
|
|
2592
|
+
/* istanbul ignore else */
|
|
2593
|
+
if (this.hasMoreItems) {
|
|
2594
|
+
this.isLoadingMore = true;
|
|
2595
|
+
this.performSearch(function (result) {
|
|
2596
|
+
_this.items = _this.items.concat(result.items);
|
|
2597
|
+
_this.updateDisplayedItems();
|
|
2598
|
+
_this.isLoadingMore = false;
|
|
2599
|
+
});
|
|
2600
|
+
}
|
|
2601
|
+
};
|
|
2602
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.save = function () {
|
|
2603
|
+
var _this = this;
|
|
2604
|
+
var selectedItems = Array.from(this.selectedIdMap.values(), function (itemData, index) { return ({
|
|
2605
|
+
index: index,
|
|
2606
|
+
itemData: itemData,
|
|
2607
|
+
}); }).sort(function (a, b) {
|
|
2608
|
+
return _this.items.indexOf(a.itemData) < _this.items.indexOf(b.itemData)
|
|
2609
|
+
? -1
|
|
2610
|
+
: 1;
|
|
2611
|
+
});
|
|
2612
|
+
this.modalInstance.save(selectedItems);
|
|
2613
|
+
};
|
|
2614
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.loadSearchResults = function () {
|
|
2615
|
+
var _this = this;
|
|
2616
|
+
this.cancelCurrentSearch();
|
|
2617
|
+
this.isSearching = true;
|
|
2618
|
+
this.performSearch(function (result) {
|
|
2619
|
+
_this.isSearching = false;
|
|
2620
|
+
_this.items = result.items;
|
|
2621
|
+
});
|
|
2622
|
+
};
|
|
2623
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.createInitialSelectedItemsMap = function () {
|
|
2624
|
+
var _this = this;
|
|
2625
|
+
this.selectedIdMap = new Map(this.context.initialValue.map(function (item) { return [
|
|
2626
|
+
item[_this.context.idProperty],
|
|
2627
|
+
item,
|
|
2628
|
+
]; }));
|
|
2629
|
+
};
|
|
2630
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.performSearch = function (processResults) {
|
|
2631
|
+
var _this = this;
|
|
2632
|
+
this.currentSearchSub = this.context
|
|
2633
|
+
.searchAsync({
|
|
2634
|
+
displayType: 'modal',
|
|
2635
|
+
offset: this.offset,
|
|
2636
|
+
searchText: this.searchText || '',
|
|
2637
|
+
continuationData: this.continuationData,
|
|
2638
|
+
})
|
|
2639
|
+
.pipe(operators.take(1))
|
|
2640
|
+
.subscribe(function (result) {
|
|
2641
|
+
processResults(result);
|
|
2642
|
+
_this.continuationData = result.continuationData;
|
|
2643
|
+
_this.hasMoreItems = result.hasMore;
|
|
2644
|
+
_this.offset = _this.items.length;
|
|
2645
|
+
_this.updateDisplayedItems();
|
|
2646
|
+
_this.changeDetector.markForCheck();
|
|
2647
|
+
});
|
|
2648
|
+
};
|
|
2649
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.updateDisplayedItems = function () {
|
|
2650
|
+
var _this = this;
|
|
2651
|
+
if (this.onlyShowSelected) {
|
|
2652
|
+
this.displayedItems = this.items.filter(function (item) { return _this.selectedIdMap.has(item[_this.context.idProperty]); });
|
|
2653
|
+
}
|
|
2654
|
+
else {
|
|
2655
|
+
this.displayedItems = this.items;
|
|
2656
|
+
}
|
|
2657
|
+
};
|
|
2658
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.cancelCurrentSearch = function () {
|
|
2659
|
+
if (this.currentSearchSub) {
|
|
2660
|
+
this.currentSearchSub.unsubscribe();
|
|
2661
|
+
this.currentSearchSub = undefined;
|
|
2662
|
+
this.isLoadingMore = false;
|
|
2663
|
+
this.isSearching = false;
|
|
2664
|
+
}
|
|
2665
|
+
};
|
|
2666
|
+
return SkyLookupShowMoreAsyncModalComponent;
|
|
2667
|
+
}());
|
|
2668
|
+
SkyLookupShowMoreAsyncModalComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupShowMoreAsyncModalComponent, deps: [{ token: i1__namespace$1.SkyModalInstance }, { token: SkyLookupShowMoreNativePickerAsyncContext }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2669
|
+
SkyLookupShowMoreAsyncModalComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyLookupShowMoreAsyncModalComponent, selector: "sky-lookup-show-more-async-modal", ngImport: i0__namespace, 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__namespace$1.λ5, selector: "sky-modal", inputs: ["ariaRole", "tiledBody"] }, { type: i1__namespace$1.λ4, selector: "sky-modal-header" }, { type: i1__namespace$1.λ2, selector: "sky-modal-content" }, { type: i4__namespace.λ14, selector: "sky-wait", inputs: ["ariaLabel", "isWaiting", "isFullPage", "isNonBlocking"] }, { type: i4__namespace$1.λ37, selector: "sky-toolbar" }, { type: i4__namespace$1.λ38, selector: "sky-toolbar-section" }, { type: i4__namespace$1.λ39, selector: "sky-toolbar-item" }, { type: SkySearchComponent, selector: "sky-search", inputs: ["searchText", "expandMode", "debounceTime", "disabled", "placeholderText"], outputs: ["searchApply", "searchChange", "searchClear"] }, { type: i4__namespace$1.λ40, selector: "sky-toolbar-view-actions" }, { type: i4__namespace.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { type: i6__namespace.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: i6__namespace.λ4, selector: "sky-checkbox-label" }, { type: i7__namespace$1.λ11, selector: "sky-repeater", inputs: ["activeIndex", "ariaLabel", "reorderable", "expandMode"], outputs: ["activeIndexChange", "orderChange"] }, { type: i7__namespace$1.λ10, selector: "sky-repeater-item", inputs: ["itemName", "inlineFormConfig", "inlineFormTemplate", "isExpanded", "isSelected", "reorderable", "selectable", "showInlineForm", "tag"], outputs: ["collapse", "expand", "inlineFormClose", "isSelectedChange"] }, { type: i7__namespace$1.λ8, selector: "sky-repeater-item-content" }, { type: i7__namespace$1.λ6, selector: "sky-infinite-scroll", inputs: ["enabled", "loading"], outputs: ["scrollEnd"] }, { type: i1__namespace$1.λ3, selector: "sky-modal-footer" }], directives: [{ type: i6__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.λ3, selector: "[skyViewkeeper]", inputs: ["skyViewkeeper"] }, { type: i7__namespace.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { type: i6__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "skyLibResources": i5__namespace.SkyLibResourcesPipe, "skyLookupItemSelected": SkyLookupItemSelectedPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
2670
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupShowMoreAsyncModalComponent, decorators: [{
|
|
2671
|
+
type: i0.Component,
|
|
2672
|
+
args: [{
|
|
2673
|
+
selector: 'sky-lookup-show-more-async-modal',
|
|
2674
|
+
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",
|
|
2675
|
+
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"],
|
|
2676
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2677
|
+
}]
|
|
2678
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$1.SkyModalInstance }, { type: SkyLookupShowMoreNativePickerAsyncContext }, { type: i0__namespace.ChangeDetectorRef }]; } });
|
|
2679
|
+
|
|
2680
|
+
/**
|
|
2681
|
+
* @internal
|
|
2682
|
+
* Context for the show more native picker. These values are provided by the lookup component.
|
|
2683
|
+
*/
|
|
2684
|
+
var SkyLookupShowMoreNativePickerContext = /** @class */ (function () {
|
|
2685
|
+
function SkyLookupShowMoreNativePickerContext() {
|
|
2686
|
+
}
|
|
2687
|
+
return SkyLookupShowMoreNativePickerContext;
|
|
2688
|
+
}());
|
|
2689
|
+
|
|
2555
2690
|
/**
|
|
2556
2691
|
* @internal
|
|
2557
2692
|
* Internal component to implement the native picker.
|
|
@@ -2718,310 +2853,196 @@
|
|
|
2718
2853
|
var result = items.filter(function (item) { return values.indexOf(item.value) >= 0; });
|
|
2719
2854
|
return Promise.resolve(result);
|
|
2720
2855
|
});
|
|
2721
|
-
}
|
|
2722
|
-
}
|
|
2723
|
-
else {
|
|
2724
|
-
return Promise.resolve(items);
|
|
2725
|
-
}
|
|
2726
|
-
};
|
|
2727
|
-
SkyLookupShowMoreModalComponent.prototype.selectAll = function () {
|
|
2728
|
-
var _this = this;
|
|
2729
|
-
var selectedItems = this.selectedItems;
|
|
2730
|
-
this.displayedItems.forEach(function (item) {
|
|
2731
|
-
if (!item.selected) {
|
|
2732
|
-
item.selected = true;
|
|
2733
|
-
var index_1 = _this.items.indexOf(item);
|
|
2734
|
-
/* Sanity check */
|
|
2735
|
-
/* istanbul ignore else */
|
|
2736
|
-
if (selectedItems.findIndex(function (selectedItem) { return selectedItem.index === index_1; }) < 0) {
|
|
2737
|
-
selectedItems.push({
|
|
2738
|
-
index: index_1,
|
|
2739
|
-
itemData: _this.items[index_1].value,
|
|
2740
|
-
});
|
|
2741
|
-
}
|
|
2742
|
-
}
|
|
2743
|
-
});
|
|
2744
|
-
this.selectedItems = selectedItems;
|
|
2745
|
-
this.updateDataState();
|
|
2746
|
-
this.changeDetector.markForCheck();
|
|
2747
|
-
};
|
|
2748
|
-
SkyLookupShowMoreModalComponent.prototype.updateDataState = function () {
|
|
2749
|
-
var _this = this;
|
|
2750
|
-
var selectedItems = this.selectedItems;
|
|
2751
|
-
this.items.forEach(function (item, index) {
|
|
2752
|
-
item.selected =
|
|
2753
|
-
selectedItems.findIndex(function (selectedItem) { return selectedItem.index === index; }) !== -1;
|
|
2754
|
-
});
|
|
2755
|
-
this.searchItems(this.items).then(function (searchedItems) {
|
|
2756
|
-
if (_this.onlyShowSelected) {
|
|
2757
|
-
searchedItems = searchedItems.filter(function (item) { return item.selected; });
|
|
2758
|
-
}
|
|
2759
|
-
_this.displayedItems = searchedItems.slice(0, _this.itemIndex);
|
|
2760
|
-
if (_this.itemIndex > searchedItems.length) {
|
|
2761
|
-
_this.itemsHaveMore = false;
|
|
2762
|
-
}
|
|
2763
|
-
else {
|
|
2764
|
-
_this.itemsHaveMore = true;
|
|
2765
|
-
}
|
|
2766
|
-
_this.changeDetector.markForCheck();
|
|
2767
|
-
});
|
|
2768
|
-
};
|
|
2769
|
-
SkyLookupShowMoreModalComponent.prototype.updateItemData = function (data) {
|
|
2770
|
-
var _this = this;
|
|
2771
|
-
this.context.items = data;
|
|
2772
|
-
this.items = undefined;
|
|
2773
|
-
this.itemIndex = 10;
|
|
2774
|
-
this.selectedItems.forEach(function (selectedItem) {
|
|
2775
|
-
_this.context.items.forEach(function (item, index) {
|
|
2776
|
-
if (selectedItem.itemData === item) {
|
|
2777
|
-
selectedItem.index = index;
|
|
2778
|
-
}
|
|
2779
|
-
});
|
|
2780
|
-
});
|
|
2781
|
-
this.addItems();
|
|
2782
|
-
this.changeDetector.markForCheck();
|
|
2783
|
-
};
|
|
2784
|
-
return SkyLookupShowMoreModalComponent;
|
|
2785
|
-
}());
|
|
2786
|
-
SkyLookupShowMoreModalComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupShowMoreModalComponent, deps: [{ token: i1__namespace$1.SkyModalInstance }, { token: SkyLookupShowMoreNativePickerContext }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2787
|
-
SkyLookupShowMoreModalComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyLookupShowMoreModalComponent, selector: "skyux-lookup-show-more-modal", ngImport: i0__namespace, 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__namespace$1.λ5, selector: "sky-modal", inputs: ["ariaRole", "tiledBody"] }, { type: i1__namespace$1.λ4, selector: "sky-modal-header" }, { type: i1__namespace$1.λ2, selector: "sky-modal-content" }, { type: i3__namespace.λ37, selector: "sky-toolbar" }, { type: i3__namespace.λ38, selector: "sky-toolbar-section" }, { type: i3__namespace.λ39, selector: "sky-toolbar-item" }, { type: SkySearchComponent, selector: "sky-search", inputs: ["searchText", "expandMode", "debounceTime", "disabled", "placeholderText"], outputs: ["searchApply", "searchChange", "searchClear"] }, { type: i3__namespace.λ40, selector: "sky-toolbar-view-actions" }, { type: i4__namespace.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { type: i6__namespace.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: i6__namespace.λ4, selector: "sky-checkbox-label" }, { type: i7__namespace$1.λ11, selector: "sky-repeater", inputs: ["activeIndex", "ariaLabel", "reorderable", "expandMode"], outputs: ["activeIndexChange", "orderChange"] }, { type: i7__namespace$1.λ10, selector: "sky-repeater-item", inputs: ["itemName", "inlineFormConfig", "inlineFormTemplate", "isExpanded", "isSelected", "reorderable", "selectable", "showInlineForm", "tag"], outputs: ["collapse", "expand", "inlineFormClose", "isSelectedChange"] }, { type: i7__namespace$1.λ8, selector: "sky-repeater-item-content" }, { type: i7__namespace$1.λ6, selector: "sky-infinite-scroll", inputs: ["enabled", "loading"], outputs: ["scrollEnd"] }, { type: i1__namespace$1.λ3, selector: "sky-modal-footer" }], directives: [{ type: i6__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.λ3, selector: "[skyViewkeeper]", inputs: ["skyViewkeeper"] }, { type: i7__namespace.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { type: i6__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "skyLibResources": i5__namespace.SkyLibResourcesPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
2788
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupShowMoreModalComponent, decorators: [{
|
|
2789
|
-
type: i0.Component,
|
|
2790
|
-
args: [{
|
|
2791
|
-
// Suppress this error rather than fix the selector since consumers with unit tests
|
|
2792
|
-
// may be looking for an element with this selector. We can change it in the next major
|
|
2793
|
-
// version of SKY UX.
|
|
2794
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
2795
|
-
selector: 'skyux-lookup-show-more-modal',
|
|
2796
|
-
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",
|
|
2797
|
-
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"],
|
|
2798
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2799
|
-
}]
|
|
2800
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$1.SkyModalInstance }, { type: SkyLookupShowMoreNativePickerContext }, { type: i0__namespace.ChangeDetectorRef }]; } });
|
|
2801
|
-
|
|
2802
|
-
/**
|
|
2803
|
-
* @internal
|
|
2804
|
-
* Context for the show more native picker. These values are provided by the lookup component.
|
|
2805
|
-
*/
|
|
2806
|
-
var SkyLookupShowMoreNativePickerAsyncContext = /** @class */ (function () {
|
|
2807
|
-
function SkyLookupShowMoreNativePickerAsyncContext() {
|
|
2808
|
-
}
|
|
2809
|
-
return SkyLookupShowMoreNativePickerAsyncContext;
|
|
2810
|
-
}());
|
|
2811
|
-
|
|
2812
|
-
var SkyLookupItemSelectedPipe = /** @class */ (function () {
|
|
2813
|
-
function SkyLookupItemSelectedPipe() {
|
|
2814
|
-
}
|
|
2815
|
-
SkyLookupItemSelectedPipe.prototype.transform = function (id, selectedIdMap) {
|
|
2816
|
-
return selectedIdMap.has(id);
|
|
2817
|
-
};
|
|
2818
|
-
return SkyLookupItemSelectedPipe;
|
|
2819
|
-
}());
|
|
2820
|
-
SkyLookupItemSelectedPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupItemSelectedPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
2821
|
-
SkyLookupItemSelectedPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupItemSelectedPipe, name: "skyLookupItemSelected" });
|
|
2822
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupItemSelectedPipe, decorators: [{
|
|
2823
|
-
type: i0.Pipe,
|
|
2824
|
-
args: [{
|
|
2825
|
-
name: 'skyLookupItemSelected',
|
|
2826
|
-
}]
|
|
2827
|
-
}] });
|
|
2828
|
-
|
|
2829
|
-
/**
|
|
2830
|
-
* @internal
|
|
2831
|
-
* Internal component to implement the native picker.
|
|
2832
|
-
*/
|
|
2833
|
-
var SkyLookupShowMoreAsyncModalComponent = /** @class */ (function () {
|
|
2834
|
-
function SkyLookupShowMoreAsyncModalComponent(modalInstance, context, changeDetector) {
|
|
2835
|
-
this.modalInstance = modalInstance;
|
|
2836
|
-
this.context = context;
|
|
2837
|
-
this.changeDetector = changeDetector;
|
|
2838
|
-
/**
|
|
2839
|
-
* @internal
|
|
2840
|
-
* Fires when users select the button to add new options to the list.
|
|
2841
|
-
*/
|
|
2842
|
-
this.addClick = new rxjs.Subject();
|
|
2843
|
-
this.displayedItems = [];
|
|
2844
|
-
this.onlyShowSelected = false;
|
|
2845
|
-
this.isSearching = false;
|
|
2846
|
-
this.hasMoreItems = false;
|
|
2847
|
-
this.isLoadingMore = false;
|
|
2848
|
-
this.offset = 0;
|
|
2849
|
-
this.ngUnsubscribe = new rxjs.Subject();
|
|
2850
|
-
}
|
|
2851
|
-
SkyLookupShowMoreAsyncModalComponent.prototype.ngOnInit = function () {
|
|
2852
|
-
this.searchText = this.context.initialSearch;
|
|
2853
|
-
this.createInitialSelectedItemsMap();
|
|
2854
|
-
this.loadSearchResults();
|
|
2855
|
-
};
|
|
2856
|
-
SkyLookupShowMoreAsyncModalComponent.prototype.ngOnDestroy = function () {
|
|
2857
|
-
this.cancelCurrentSearch();
|
|
2858
|
-
this.ngUnsubscribe.next();
|
|
2859
|
-
this.ngUnsubscribe.complete();
|
|
2860
|
-
};
|
|
2861
|
-
SkyLookupShowMoreAsyncModalComponent.prototype.addButtonClicked = function () {
|
|
2862
|
-
this.addClick.next();
|
|
2863
|
-
};
|
|
2864
|
-
SkyLookupShowMoreAsyncModalComponent.prototype.clearAll = function () {
|
|
2865
|
-
var e_1, _a;
|
|
2866
|
-
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2867
|
-
try {
|
|
2868
|
-
// Only deselect items that have been loaded; items that would be loaded
|
|
2869
|
-
// after an infinite scroll event should remain selected.
|
|
2870
|
-
for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2871
|
-
var item = _c.value;
|
|
2872
|
-
this.selectedIdMap.delete(item[this.context.idProperty]);
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2876
|
-
finally {
|
|
2877
|
-
try {
|
|
2878
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2879
|
-
}
|
|
2880
|
-
finally { if (e_1) throw e_1.error; }
|
|
2881
|
-
}
|
|
2882
|
-
this.updateDisplayedItems();
|
|
2883
|
-
this.changeDetector.markForCheck();
|
|
2884
|
-
};
|
|
2885
|
-
SkyLookupShowMoreAsyncModalComponent.prototype.itemClick = function (selectedItem) {
|
|
2886
|
-
if (this.context.selectMode === 'single') {
|
|
2887
|
-
this.onItemSelect(!selectedItem.selected, selectedItem);
|
|
2888
|
-
}
|
|
2889
|
-
};
|
|
2890
|
-
SkyLookupShowMoreAsyncModalComponent.prototype.onItemSelect = function (newSelectState, itemToSelect) {
|
|
2891
|
-
var itemId = itemToSelect[this.context.idProperty];
|
|
2892
|
-
// Create a new Map so the pipe transform will execute on the next
|
|
2893
|
-
// change detection cycle.
|
|
2894
|
-
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2895
|
-
if (this.context.selectMode === 'single') {
|
|
2896
|
-
if (newSelectState) {
|
|
2897
|
-
this.selectedIdMap.clear();
|
|
2898
|
-
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2899
|
-
}
|
|
2900
|
-
}
|
|
2901
|
-
else {
|
|
2902
|
-
if (newSelectState) {
|
|
2903
|
-
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2904
|
-
}
|
|
2905
|
-
else {
|
|
2906
|
-
this.selectedIdMap.delete(itemId);
|
|
2907
|
-
}
|
|
2908
|
-
}
|
|
2909
|
-
this.updateDisplayedItems();
|
|
2910
|
-
};
|
|
2911
|
-
SkyLookupShowMoreAsyncModalComponent.prototype.searchApplied = function (searchText) {
|
|
2912
|
-
this.offset = 0;
|
|
2913
|
-
this.searchText = searchText;
|
|
2914
|
-
this.loadSearchResults();
|
|
2915
|
-
};
|
|
2916
|
-
SkyLookupShowMoreAsyncModalComponent.prototype.selectAll = function () {
|
|
2917
|
-
var e_2, _a;
|
|
2918
|
-
this.selectedIdMap = new Map();
|
|
2919
|
-
try {
|
|
2920
|
-
for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2921
|
-
var item = _c.value;
|
|
2922
|
-
this.selectedIdMap.set(item[this.context.idProperty], item);
|
|
2923
|
-
}
|
|
2924
|
-
}
|
|
2925
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2926
|
-
finally {
|
|
2927
|
-
try {
|
|
2928
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2929
|
-
}
|
|
2930
|
-
finally { if (e_2) throw e_2.error; }
|
|
2931
|
-
}
|
|
2932
|
-
this.updateDisplayedItems();
|
|
2933
|
-
};
|
|
2934
|
-
SkyLookupShowMoreAsyncModalComponent.prototype.infiniteScrollEnd = function () {
|
|
2935
|
-
var _this = this;
|
|
2936
|
-
this.cancelCurrentSearch();
|
|
2937
|
-
/* Sanity check - else case would only happen if this was called directly */
|
|
2938
|
-
/* istanbul ignore else */
|
|
2939
|
-
if (this.hasMoreItems) {
|
|
2940
|
-
this.isLoadingMore = true;
|
|
2941
|
-
this.performSearch(function (result) {
|
|
2942
|
-
_this.items = _this.items.concat(result.items);
|
|
2943
|
-
_this.updateDisplayedItems();
|
|
2944
|
-
_this.isLoadingMore = false;
|
|
2945
|
-
});
|
|
2946
|
-
}
|
|
2947
|
-
};
|
|
2948
|
-
SkyLookupShowMoreAsyncModalComponent.prototype.save = function () {
|
|
2949
|
-
var _this = this;
|
|
2950
|
-
var selectedItems = Array.from(this.selectedIdMap.values(), function (itemData, index) { return ({
|
|
2951
|
-
index: index,
|
|
2952
|
-
itemData: itemData,
|
|
2953
|
-
}); }).sort(function (a, b) {
|
|
2954
|
-
return _this.items.indexOf(a.itemData) < _this.items.indexOf(b.itemData)
|
|
2955
|
-
? -1
|
|
2956
|
-
: 1;
|
|
2957
|
-
});
|
|
2958
|
-
this.modalInstance.save(selectedItems);
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2858
|
+
else {
|
|
2859
|
+
return Promise.resolve(items);
|
|
2860
|
+
}
|
|
2959
2861
|
};
|
|
2960
|
-
|
|
2862
|
+
SkyLookupShowMoreModalComponent.prototype.selectAll = function () {
|
|
2961
2863
|
var _this = this;
|
|
2962
|
-
this.
|
|
2963
|
-
this.
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2864
|
+
var selectedItems = this.selectedItems;
|
|
2865
|
+
this.displayedItems.forEach(function (item) {
|
|
2866
|
+
if (!item.selected) {
|
|
2867
|
+
item.selected = true;
|
|
2868
|
+
var index_1 = _this.items.indexOf(item);
|
|
2869
|
+
/* Sanity check */
|
|
2870
|
+
/* istanbul ignore else */
|
|
2871
|
+
if (selectedItems.findIndex(function (selectedItem) { return selectedItem.index === index_1; }) < 0) {
|
|
2872
|
+
selectedItems.push({
|
|
2873
|
+
index: index_1,
|
|
2874
|
+
itemData: _this.items[index_1].value,
|
|
2875
|
+
});
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2967
2878
|
});
|
|
2879
|
+
this.selectedItems = selectedItems;
|
|
2880
|
+
this.updateDataState();
|
|
2881
|
+
this.changeDetector.markForCheck();
|
|
2968
2882
|
};
|
|
2969
|
-
|
|
2970
|
-
var _this = this;
|
|
2971
|
-
this.selectedIdMap = new Map(this.context.initialValue.map(function (item) { return [
|
|
2972
|
-
item[_this.context.idProperty],
|
|
2973
|
-
item,
|
|
2974
|
-
]; }));
|
|
2975
|
-
};
|
|
2976
|
-
SkyLookupShowMoreAsyncModalComponent.prototype.performSearch = function (processResults) {
|
|
2883
|
+
SkyLookupShowMoreModalComponent.prototype.updateDataState = function () {
|
|
2977
2884
|
var _this = this;
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
_this.
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2885
|
+
var selectedItems = this.selectedItems;
|
|
2886
|
+
this.items.forEach(function (item, index) {
|
|
2887
|
+
item.selected =
|
|
2888
|
+
selectedItems.findIndex(function (selectedItem) { return selectedItem.index === index; }) !== -1;
|
|
2889
|
+
});
|
|
2890
|
+
this.searchItems(this.items).then(function (searchedItems) {
|
|
2891
|
+
if (_this.onlyShowSelected) {
|
|
2892
|
+
searchedItems = searchedItems.filter(function (item) { return item.selected; });
|
|
2893
|
+
}
|
|
2894
|
+
_this.displayedItems = searchedItems.slice(0, _this.itemIndex);
|
|
2895
|
+
if (_this.itemIndex > searchedItems.length) {
|
|
2896
|
+
_this.itemsHaveMore = false;
|
|
2897
|
+
}
|
|
2898
|
+
else {
|
|
2899
|
+
_this.itemsHaveMore = true;
|
|
2900
|
+
}
|
|
2992
2901
|
_this.changeDetector.markForCheck();
|
|
2993
2902
|
});
|
|
2994
2903
|
};
|
|
2995
|
-
|
|
2904
|
+
SkyLookupShowMoreModalComponent.prototype.updateItemData = function (data) {
|
|
2996
2905
|
var _this = this;
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
this.isSearching = false;
|
|
3010
|
-
}
|
|
2906
|
+
this.context.items = data;
|
|
2907
|
+
this.items = undefined;
|
|
2908
|
+
this.itemIndex = 10;
|
|
2909
|
+
this.selectedItems.forEach(function (selectedItem) {
|
|
2910
|
+
_this.context.items.forEach(function (item, index) {
|
|
2911
|
+
if (selectedItem.itemData === item) {
|
|
2912
|
+
selectedItem.index = index;
|
|
2913
|
+
}
|
|
2914
|
+
});
|
|
2915
|
+
});
|
|
2916
|
+
this.addItems();
|
|
2917
|
+
this.changeDetector.markForCheck();
|
|
3011
2918
|
};
|
|
3012
|
-
return
|
|
2919
|
+
return SkyLookupShowMoreModalComponent;
|
|
3013
2920
|
}());
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type:
|
|
2921
|
+
SkyLookupShowMoreModalComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupShowMoreModalComponent, deps: [{ token: i1__namespace$1.SkyModalInstance }, { token: SkyLookupShowMoreNativePickerContext }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2922
|
+
SkyLookupShowMoreModalComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyLookupShowMoreModalComponent, selector: "skyux-lookup-show-more-modal", ngImport: i0__namespace, 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__namespace$1.λ5, selector: "sky-modal", inputs: ["ariaRole", "tiledBody"] }, { type: i1__namespace$1.λ4, selector: "sky-modal-header" }, { type: i1__namespace$1.λ2, selector: "sky-modal-content" }, { type: i4__namespace$1.λ37, selector: "sky-toolbar" }, { type: i4__namespace$1.λ38, selector: "sky-toolbar-section" }, { type: i4__namespace$1.λ39, selector: "sky-toolbar-item" }, { type: SkySearchComponent, selector: "sky-search", inputs: ["searchText", "expandMode", "debounceTime", "disabled", "placeholderText"], outputs: ["searchApply", "searchChange", "searchClear"] }, { type: i4__namespace$1.λ40, selector: "sky-toolbar-view-actions" }, { type: i4__namespace.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { type: i6__namespace.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: i6__namespace.λ4, selector: "sky-checkbox-label" }, { type: i7__namespace$1.λ11, selector: "sky-repeater", inputs: ["activeIndex", "ariaLabel", "reorderable", "expandMode"], outputs: ["activeIndexChange", "orderChange"] }, { type: i7__namespace$1.λ10, selector: "sky-repeater-item", inputs: ["itemName", "inlineFormConfig", "inlineFormTemplate", "isExpanded", "isSelected", "reorderable", "selectable", "showInlineForm", "tag"], outputs: ["collapse", "expand", "inlineFormClose", "isSelectedChange"] }, { type: i7__namespace$1.λ8, selector: "sky-repeater-item-content" }, { type: i7__namespace$1.λ6, selector: "sky-infinite-scroll", inputs: ["enabled", "loading"], outputs: ["scrollEnd"] }, { type: i1__namespace$1.λ3, selector: "sky-modal-footer" }], directives: [{ type: i6__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.λ3, selector: "[skyViewkeeper]", inputs: ["skyViewkeeper"] }, { type: i7__namespace.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { type: i6__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "skyLibResources": i5__namespace.SkyLibResourcesPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
2923
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupShowMoreModalComponent, decorators: [{
|
|
3017
2924
|
type: i0.Component,
|
|
3018
2925
|
args: [{
|
|
3019
|
-
selector
|
|
3020
|
-
|
|
2926
|
+
// Suppress this error rather than fix the selector since consumers with unit tests
|
|
2927
|
+
// may be looking for an element with this selector. We can change it in the next major
|
|
2928
|
+
// version of SKY UX.
|
|
2929
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
2930
|
+
selector: 'skyux-lookup-show-more-modal',
|
|
2931
|
+
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",
|
|
3021
2932
|
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"],
|
|
3022
2933
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
3023
2934
|
}]
|
|
3024
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$1.SkyModalInstance }, { type:
|
|
2935
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$1.SkyModalInstance }, { type: SkyLookupShowMoreNativePickerContext }, { type: i0__namespace.ChangeDetectorRef }]; } });
|
|
2936
|
+
|
|
2937
|
+
/**
|
|
2938
|
+
* @internal
|
|
2939
|
+
*/
|
|
2940
|
+
var SkyLookupAdapterService = /** @class */ (function () {
|
|
2941
|
+
function SkyLookupAdapterService() {
|
|
2942
|
+
}
|
|
2943
|
+
SkyLookupAdapterService.prototype.focusInput = function (elRef) {
|
|
2944
|
+
var inputEl = elRef.nativeElement.querySelector('.sky-lookup-input');
|
|
2945
|
+
/* Sanity check */
|
|
2946
|
+
/* istanbul ignore else */
|
|
2947
|
+
if (inputEl) {
|
|
2948
|
+
inputEl.focus();
|
|
2949
|
+
}
|
|
2950
|
+
};
|
|
2951
|
+
return SkyLookupAdapterService;
|
|
2952
|
+
}());
|
|
2953
|
+
SkyLookupAdapterService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAdapterService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2954
|
+
SkyLookupAdapterService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAdapterService });
|
|
2955
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAdapterService, decorators: [{
|
|
2956
|
+
type: i0.Injectable
|
|
2957
|
+
}] });
|
|
2958
|
+
|
|
2959
|
+
/**
|
|
2960
|
+
* @internal
|
|
2961
|
+
*/
|
|
2962
|
+
var SkyLookupAutocompleteAdapter = /** @class */ (function () {
|
|
2963
|
+
function SkyLookupAutocompleteAdapter() {
|
|
2964
|
+
/**
|
|
2965
|
+
* Fires when users enter new search information and allows results to be
|
|
2966
|
+
* returned via an observable.
|
|
2967
|
+
*/
|
|
2968
|
+
this.searchAsync = new i0.EventEmitter();
|
|
2969
|
+
}
|
|
2970
|
+
Object.defineProperty(SkyLookupAutocompleteAdapter.prototype, "descriptorProperty", {
|
|
2971
|
+
get: function () {
|
|
2972
|
+
return this._descriptorProperty || 'name';
|
|
2973
|
+
},
|
|
2974
|
+
/**
|
|
2975
|
+
* Specifies an object property to display in the text input after users
|
|
2976
|
+
* select an item in the dropdown list.
|
|
2977
|
+
* @default "name"
|
|
2978
|
+
*/
|
|
2979
|
+
set: function (value) {
|
|
2980
|
+
this._descriptorProperty = value;
|
|
2981
|
+
},
|
|
2982
|
+
enumerable: false,
|
|
2983
|
+
configurable: true
|
|
2984
|
+
});
|
|
2985
|
+
Object.defineProperty(SkyLookupAutocompleteAdapter.prototype, "propertiesToSearch", {
|
|
2986
|
+
get: function () {
|
|
2987
|
+
return this._propertiesToSearch || ['name'];
|
|
2988
|
+
},
|
|
2989
|
+
/**
|
|
2990
|
+
* Specifies an array of object properties to search.
|
|
2991
|
+
* @default ["name"]
|
|
2992
|
+
*/
|
|
2993
|
+
set: function (value) {
|
|
2994
|
+
this._propertiesToSearch = value;
|
|
2995
|
+
},
|
|
2996
|
+
enumerable: false,
|
|
2997
|
+
configurable: true
|
|
2998
|
+
});
|
|
2999
|
+
Object.defineProperty(SkyLookupAutocompleteAdapter.prototype, "search", {
|
|
3000
|
+
get: function () {
|
|
3001
|
+
return (this._search ||
|
|
3002
|
+
skyAutocompleteDefaultSearchFunction({
|
|
3003
|
+
propertiesToSearch: this.propertiesToSearch,
|
|
3004
|
+
searchFilters: this.searchFilters,
|
|
3005
|
+
}));
|
|
3006
|
+
},
|
|
3007
|
+
/**
|
|
3008
|
+
* Specifies a function to dynamically manage the data source when users
|
|
3009
|
+
* change the text in the lookup field. The search function must return
|
|
3010
|
+
* an array or a promise of an array. The `search` property is particularly
|
|
3011
|
+
* useful when the data source does not live in the source code. If the
|
|
3012
|
+
* search requires calling a remote data source, use `searchAsync` instead of
|
|
3013
|
+
* `search`.
|
|
3014
|
+
*/
|
|
3015
|
+
set: function (value) {
|
|
3016
|
+
this._search = value;
|
|
3017
|
+
},
|
|
3018
|
+
enumerable: false,
|
|
3019
|
+
configurable: true
|
|
3020
|
+
});
|
|
3021
|
+
return SkyLookupAutocompleteAdapter;
|
|
3022
|
+
}());
|
|
3023
|
+
SkyLookupAutocompleteAdapter.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAutocompleteAdapter, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
3024
|
+
SkyLookupAutocompleteAdapter.ɵdir = i0__namespace.ɵɵ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__namespace });
|
|
3025
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAutocompleteAdapter, decorators: [{
|
|
3026
|
+
type: i0.Directive
|
|
3027
|
+
}], propDecorators: { debounceTime: [{
|
|
3028
|
+
type: i0.Input
|
|
3029
|
+
}], descriptorProperty: [{
|
|
3030
|
+
type: i0.Input
|
|
3031
|
+
}], propertiesToSearch: [{
|
|
3032
|
+
type: i0.Input
|
|
3033
|
+
}], search: [{
|
|
3034
|
+
type: i0.Input
|
|
3035
|
+
}], searchResultTemplate: [{
|
|
3036
|
+
type: i0.Input
|
|
3037
|
+
}], searchTextMinimumCharacters: [{
|
|
3038
|
+
type: i0.Input
|
|
3039
|
+
}], searchFilters: [{
|
|
3040
|
+
type: i0.Input
|
|
3041
|
+
}], searchResultsLimit: [{
|
|
3042
|
+
type: i0.Input
|
|
3043
|
+
}], searchAsync: [{
|
|
3044
|
+
type: i0.Output
|
|
3045
|
+
}] } });
|
|
3025
3046
|
|
|
3026
3047
|
var SkyLookupComponent = /** @class */ (function (_super) {
|
|
3027
3048
|
__extends(SkyLookupComponent, _super);
|
|
@@ -3519,7 +3540,8 @@
|
|
|
3519
3540
|
}
|
|
3520
3541
|
if (this.data.indexOf(args.item) >= 0) {
|
|
3521
3542
|
if (this.openNativePicker) {
|
|
3522
|
-
|
|
3543
|
+
this.openNativePicker
|
|
3544
|
+
.componentInstance.onItemSelect(true, { value: args.item, selected: false });
|
|
3523
3545
|
}
|
|
3524
3546
|
else {
|
|
3525
3547
|
var newValue = this.value;
|
|
@@ -3637,45 +3659,6 @@
|
|
|
3637
3659
|
}]
|
|
3638
3660
|
}] } });
|
|
3639
3661
|
|
|
3640
|
-
var SkySearchModule = /** @class */ (function () {
|
|
3641
|
-
function SkySearchModule() {
|
|
3642
|
-
}
|
|
3643
|
-
return SkySearchModule;
|
|
3644
|
-
}());
|
|
3645
|
-
SkySearchModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkySearchModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
3646
|
-
SkySearchModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkySearchModule, declarations: [SkySearchComponent], imports: [i6$1.CommonModule,
|
|
3647
|
-
i6.SkyInputBoxModule,
|
|
3648
|
-
SkyLookupResourcesModule,
|
|
3649
|
-
i8.FormsModule,
|
|
3650
|
-
i4.SkyIconModule,
|
|
3651
|
-
i7.SkyThemeModule,
|
|
3652
|
-
i1.SkyIdModule], exports: [SkySearchComponent] });
|
|
3653
|
-
SkySearchModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkySearchModule, imports: [[
|
|
3654
|
-
i6$1.CommonModule,
|
|
3655
|
-
i6.SkyInputBoxModule,
|
|
3656
|
-
SkyLookupResourcesModule,
|
|
3657
|
-
i8.FormsModule,
|
|
3658
|
-
i4.SkyIconModule,
|
|
3659
|
-
i7.SkyThemeModule,
|
|
3660
|
-
i1.SkyIdModule,
|
|
3661
|
-
]] });
|
|
3662
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkySearchModule, decorators: [{
|
|
3663
|
-
type: i0.NgModule,
|
|
3664
|
-
args: [{
|
|
3665
|
-
declarations: [SkySearchComponent],
|
|
3666
|
-
imports: [
|
|
3667
|
-
i6$1.CommonModule,
|
|
3668
|
-
i6.SkyInputBoxModule,
|
|
3669
|
-
SkyLookupResourcesModule,
|
|
3670
|
-
i8.FormsModule,
|
|
3671
|
-
i4.SkyIconModule,
|
|
3672
|
-
i7.SkyThemeModule,
|
|
3673
|
-
i1.SkyIdModule,
|
|
3674
|
-
],
|
|
3675
|
-
exports: [SkySearchComponent],
|
|
3676
|
-
}]
|
|
3677
|
-
}] });
|
|
3678
|
-
|
|
3679
3662
|
var SkyLookupModule = /** @class */ (function () {
|
|
3680
3663
|
function SkyLookupModule() {
|
|
3681
3664
|
}
|
|
@@ -3698,7 +3681,7 @@
|
|
|
3698
3681
|
SkySearchModule,
|
|
3699
3682
|
i7.SkyThemeModule,
|
|
3700
3683
|
i4.SkyTokensModule,
|
|
3701
|
-
|
|
3684
|
+
i4$1.SkyToolbarModule,
|
|
3702
3685
|
i1.SkyViewkeeperModule,
|
|
3703
3686
|
i4.SkyWaitModule], exports: [SkyLookupComponent] });
|
|
3704
3687
|
SkyLookupModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupModule, imports: [[
|
|
@@ -3715,7 +3698,7 @@
|
|
|
3715
3698
|
SkySearchModule,
|
|
3716
3699
|
i7.SkyThemeModule,
|
|
3717
3700
|
i4.SkyTokensModule,
|
|
3718
|
-
|
|
3701
|
+
i4$1.SkyToolbarModule,
|
|
3719
3702
|
i1.SkyViewkeeperModule,
|
|
3720
3703
|
i4.SkyWaitModule,
|
|
3721
3704
|
]] });
|
|
@@ -3742,7 +3725,7 @@
|
|
|
3742
3725
|
SkySearchModule,
|
|
3743
3726
|
i7.SkyThemeModule,
|
|
3744
3727
|
i4.SkyTokensModule,
|
|
3745
|
-
|
|
3728
|
+
i4$1.SkyToolbarModule,
|
|
3746
3729
|
i1.SkyViewkeeperModule,
|
|
3747
3730
|
i4.SkyWaitModule,
|
|
3748
3731
|
],
|