@skyux/lookup 5.5.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/skyux-lookup.umd.js +850 -849
- package/documentation.json +194 -194
- package/esm2015/lib/modules/autocomplete/autocomplete-adapter.service.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/autocomplete-default-search-function.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/autocomplete-input.directive.js +2 -2
- package/esm2015/lib/modules/autocomplete/autocomplete-input.directive.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/autocomplete-search-async-disabled.pipe.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/autocomplete.component.js +3 -3
- package/esm2015/lib/modules/autocomplete/autocomplete.component.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/autocomplete.module.js +1 -1
- package/esm2015/lib/modules/autocomplete/autocomplete.module.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-args.js.map +1 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-function.js.map +1 -1
- package/esm2015/lib/modules/country-field/country-field.component.js +7 -7
- package/esm2015/lib/modules/country-field/country-field.component.js.map +1 -1
- package/esm2015/lib/modules/country-field/country-field.module.js +1 -1
- package/esm2015/lib/modules/country-field/country-field.module.js.map +1 -1
- package/esm2015/lib/modules/lookup/lookup-autocomplete-adapter.js.map +1 -1
- package/esm2015/lib/modules/lookup/lookup-show-more-async-modal.component.js.map +1 -1
- package/esm2015/lib/modules/lookup/lookup-show-more-modal.component.js +6 -6
- package/esm2015/lib/modules/lookup/lookup-show-more-modal.component.js.map +1 -1
- package/esm2015/lib/modules/lookup/lookup.component.js +11 -10
- package/esm2015/lib/modules/lookup/lookup.component.js.map +1 -1
- package/esm2015/lib/modules/lookup/lookup.module.js +4 -4
- package/esm2015/lib/modules/lookup/lookup.module.js.map +1 -1
- package/esm2015/lib/modules/lookup/types/lookup-show-more-config.js.map +1 -1
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-async-context.js.map +1 -1
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-context.js.map +1 -1
- package/esm2015/lib/modules/search/search-adapter.service.js +3 -3
- package/esm2015/lib/modules/search/search-adapter.service.js.map +1 -1
- package/esm2015/lib/modules/search/search.component.js +2 -2
- package/esm2015/lib/modules/search/search.component.js.map +1 -1
- package/esm2015/lib/modules/search/search.module.js +1 -1
- package/esm2015/lib/modules/search/search.module.js.map +1 -1
- package/esm2015/lib/modules/shared/sky-lookup-resources.module.js +1 -1
- package/esm2015/lib/modules/shared/sky-lookup-resources.module.js.map +1 -1
- package/esm2015/testing/country-field/country-field-fixture.js.map +1 -1
- package/esm2015/testing/country-field/country-field-testing.module.js.map +1 -1
- package/esm2015/testing/search/search-fixture.js.map +1 -1
- package/esm2015/testing/search/search-testing.module.js.map +1 -1
- package/fesm2015/skyux-lookup-testing.js.map +1 -1
- package/fesm2015/skyux-lookup.js +582 -581
- package/fesm2015/skyux-lookup.js.map +1 -1
- package/lib/modules/autocomplete/autocomplete-default-search-function.d.ts +1 -1
- package/lib/modules/autocomplete/autocomplete.component.d.ts +2 -2
- package/lib/modules/autocomplete/types/autocomplete-search-async-args.d.ts +1 -1
- package/lib/modules/country-field/country-field.component.d.ts +2 -2
- package/lib/modules/lookup/lookup.component.d.ts +3 -3
- package/lib/modules/search/search.component.d.ts +1 -1
- package/package.json +9 -9
|
@@ -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,149 @@
|
|
|
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
|
-
return
|
|
552
|
-
});
|
|
553
|
-
};
|
|
554
|
-
var search = function (searchText, data) {
|
|
555
|
-
var results = [];
|
|
556
|
-
/* Sanity check - autocomplete will not call search with empty search text */
|
|
557
|
-
/* istanbul ignore if */
|
|
558
|
-
if (!searchText) {
|
|
559
|
-
return results;
|
|
711
|
+
// tslint:disable:no-null-keyword
|
|
712
|
+
/* istanbul ignore file */
|
|
713
|
+
// Polyfill for Element.closest().
|
|
714
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
|
|
715
|
+
// Returns the closest ancestor of the current element (or the current element itself) which
|
|
716
|
+
// matches the selectors given in parameter. If there isn't such an ancestor, it returns null.
|
|
717
|
+
if (!Element.prototype.closest) {
|
|
718
|
+
Element.prototype.closest = function (s) {
|
|
719
|
+
var el = this;
|
|
720
|
+
if (!document.documentElement.contains(el)) {
|
|
721
|
+
return null;
|
|
560
722
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
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);
|
|
723
|
+
do {
|
|
724
|
+
if (el.matches(s)) {
|
|
725
|
+
return el;
|
|
572
726
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
}
|
|
577
|
-
return results;
|
|
727
|
+
el = el.parentElement || el.parentNode;
|
|
728
|
+
} while (el !== null && el.nodeType === 1);
|
|
729
|
+
return null;
|
|
578
730
|
};
|
|
579
|
-
|
|
731
|
+
}
|
|
732
|
+
// Polyfill for Element.matches().
|
|
733
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
734
|
+
// Returns true if the element would be selected by the specified selector string.
|
|
735
|
+
if (!Element.prototype.matches) {
|
|
736
|
+
Element.prototype.matches =
|
|
737
|
+
Element.prototype.msMatchesSelector ||
|
|
738
|
+
/* istanbul ignore next */ Element.prototype.webkitMatchesSelector;
|
|
580
739
|
}
|
|
581
740
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
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();
|
|
604
|
-
/* istanbul ignore next */
|
|
605
|
-
this.onValidatorChange = function () { };
|
|
741
|
+
/**
|
|
742
|
+
* @internal
|
|
743
|
+
*/
|
|
744
|
+
var SkyAutocompleteAdapterService = /** @class */ (function () {
|
|
745
|
+
function SkyAutocompleteAdapterService(coreAdapterService, rendererFactory) {
|
|
746
|
+
this.coreAdapterService = coreAdapterService;
|
|
747
|
+
this.rendererFactory = rendererFactory;
|
|
748
|
+
this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
|
|
606
749
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
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;
|
|
773
|
-
};
|
|
774
|
-
SkyAutocompleteInputDirective.prototype.registerOnValidatorChange = function (fn) {
|
|
775
|
-
this.onValidatorChange = fn;
|
|
776
|
-
};
|
|
777
|
-
SkyAutocompleteInputDirective.prototype.restoreInputTextValueToPreviousState = function () {
|
|
778
|
-
var modelValue = this.getValueByKey();
|
|
779
|
-
// If the search field contains text, make sure that the value
|
|
780
|
-
// matches the selected descriptor key.
|
|
781
|
-
if (this.inputTextValue !== modelValue) {
|
|
782
|
-
this.inputTextValue = modelValue;
|
|
750
|
+
/**
|
|
751
|
+
* Adds the className for the provided element.
|
|
752
|
+
*/
|
|
753
|
+
SkyAutocompleteAdapterService.prototype.addCSSClass = function (element, className) {
|
|
754
|
+
/* Sanity check */
|
|
755
|
+
/* istanbul ignore else */
|
|
756
|
+
if (element) {
|
|
757
|
+
this.renderer.addClass(element, className);
|
|
783
758
|
}
|
|
784
|
-
this.onTouched();
|
|
785
759
|
};
|
|
786
|
-
|
|
787
|
-
this.
|
|
760
|
+
SkyAutocompleteAdapterService.prototype.getOverlayFocusableElements = function (overlay) {
|
|
761
|
+
return this.coreAdapterService.getFocusableChildren(
|
|
762
|
+
/* Sanity check - calling function also has null check */
|
|
763
|
+
/* istanbul ignore next */
|
|
764
|
+
overlay === null || overlay === void 0 ? void 0 : overlay.componentRef.location.nativeElement, { ignoreTabIndex: true });
|
|
788
765
|
};
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
766
|
+
/**
|
|
767
|
+
* Removes the className for the provided element.
|
|
768
|
+
*/
|
|
769
|
+
SkyAutocompleteAdapterService.prototype.removeCSSClass = function (element, className) {
|
|
770
|
+
/* Sanity check */
|
|
771
|
+
/* istanbul ignore else */
|
|
772
|
+
if (element) {
|
|
773
|
+
this.renderer.removeClass(element, className);
|
|
792
774
|
}
|
|
793
|
-
return;
|
|
794
775
|
};
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
this.renderer.
|
|
776
|
+
SkyAutocompleteAdapterService.prototype.setDropdownWidth = function (elementRef, dropdownRef, isInputBox) {
|
|
777
|
+
var parentElement = isInputBox
|
|
778
|
+
? elementRef.nativeElement.closest('.sky-input-box')
|
|
779
|
+
: elementRef.nativeElement;
|
|
780
|
+
if (parentElement) {
|
|
781
|
+
var width = parentElement.getBoundingClientRect().width;
|
|
782
|
+
this.renderer.setStyle(dropdownRef.nativeElement, 'width', width + "px");
|
|
802
783
|
}
|
|
803
784
|
};
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
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;
|
|
785
|
+
/**
|
|
786
|
+
* Sets the `tabIndex` of the `element` to the provided `tabIndex`.
|
|
787
|
+
*/
|
|
788
|
+
SkyAutocompleteAdapterService.prototype.setTabIndex = function (element, tabIndex) {
|
|
789
|
+
element.tabIndex = tabIndex;
|
|
818
790
|
};
|
|
819
|
-
return
|
|
791
|
+
return SkyAutocompleteAdapterService;
|
|
820
792
|
}());
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type:
|
|
824
|
-
type: i0.
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
793
|
+
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 });
|
|
794
|
+
SkyAutocompleteAdapterService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutocompleteAdapterService });
|
|
795
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutocompleteAdapterService, decorators: [{
|
|
796
|
+
type: i0.Injectable
|
|
797
|
+
}], ctorParameters: function () { return [{ type: i1__namespace.SkyCoreAdapterService }, { type: i0__namespace.RendererFactory2 }]; } });
|
|
798
|
+
|
|
799
|
+
function skyAutocompleteDefaultSearchFunction(options) {
|
|
800
|
+
var filterData = function (searchText, data) {
|
|
801
|
+
return data.filter(function (item) {
|
|
802
|
+
if (!options.searchFilters || !options.searchFilters.length) {
|
|
803
|
+
return true;
|
|
804
|
+
}
|
|
805
|
+
// Find the first failing filter (we can skip the others if one fails).
|
|
806
|
+
var failedFilter = options.searchFilters.find(function (filter) {
|
|
807
|
+
return !filter.call({}, searchText, item);
|
|
808
|
+
});
|
|
809
|
+
return failedFilter === undefined;
|
|
810
|
+
});
|
|
811
|
+
};
|
|
812
|
+
var search = function (searchText, data) {
|
|
813
|
+
var results = [];
|
|
814
|
+
/* Sanity check - autocomplete will not call search with empty search text */
|
|
815
|
+
/* istanbul ignore if */
|
|
816
|
+
if (!searchText) {
|
|
817
|
+
return results;
|
|
818
|
+
}
|
|
819
|
+
var searchTextNormalized = normalizeDiacritics(searchText).toUpperCase();
|
|
820
|
+
var filteredData = filterData(searchText, data);
|
|
821
|
+
var _loop_1 = function (i, n) {
|
|
822
|
+
var result = filteredData[i];
|
|
823
|
+
var isMatch = options.propertiesToSearch.find(function (property) {
|
|
824
|
+
var value = (result[property] || '').toString();
|
|
825
|
+
value = normalizeDiacritics(value).toUpperCase();
|
|
826
|
+
return value.indexOf(searchTextNormalized) > -1;
|
|
827
|
+
});
|
|
828
|
+
if (isMatch) {
|
|
829
|
+
results.push(result);
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
for (var i = 0, n = filteredData.length; i < n; i++) {
|
|
833
|
+
_loop_1(i, n);
|
|
834
|
+
}
|
|
835
|
+
return results;
|
|
836
|
+
};
|
|
837
|
+
return search;
|
|
838
|
+
}
|
|
834
839
|
|
|
835
840
|
/**
|
|
836
841
|
* @internal
|
|
837
842
|
*/
|
|
838
|
-
var
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
type: i0.Pipe,
|
|
850
|
-
args: [{
|
|
851
|
-
name: 'skyAutocompleteSearchAsyncDisabled',
|
|
852
|
-
}]
|
|
853
|
-
}] });
|
|
843
|
+
var SkyAutocompleteMessageType;
|
|
844
|
+
(function (SkyAutocompleteMessageType) {
|
|
845
|
+
/**
|
|
846
|
+
* Closes the dropdown.
|
|
847
|
+
*/
|
|
848
|
+
SkyAutocompleteMessageType[SkyAutocompleteMessageType["CloseDropdown"] = 0] = "CloseDropdown";
|
|
849
|
+
/**
|
|
850
|
+
* Repositions the dropdown.
|
|
851
|
+
*/
|
|
852
|
+
SkyAutocompleteMessageType[SkyAutocompleteMessageType["RepositionDropdown"] = 1] = "RepositionDropdown";
|
|
853
|
+
})(SkyAutocompleteMessageType || (SkyAutocompleteMessageType = {}));
|
|
854
854
|
|
|
855
855
|
var uniqueId$1 = 0;
|
|
856
856
|
var SkyAutocompleteComponent = /** @class */ (function () {
|
|
@@ -1993,7 +1993,7 @@
|
|
|
1993
1993
|
// Ignoring coverage here as this will be removed in the next release.
|
|
1994
1994
|
// istanbul ignore next
|
|
1995
1995
|
if (!this.includePhoneInfo && !this.hideSelectedCountryFlag) {
|
|
1996
|
-
if ((_b = (_a =
|
|
1996
|
+
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
1997
|
this.includePhoneInfo = true;
|
|
1998
1998
|
this.hideSelectedCountryFlag = true;
|
|
1999
1999
|
}
|
|
@@ -2144,122 +2144,8 @@
|
|
|
2144
2144
|
i7.SkyThemeModule,
|
|
2145
2145
|
],
|
|
2146
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
|
-
}());
|
|
2147
|
+
}]
|
|
2148
|
+
}] });
|
|
2263
2149
|
|
|
2264
2150
|
/**
|
|
2265
2151
|
* @internal
|
|
@@ -2552,6 +2438,279 @@
|
|
|
2552
2438
|
type: i0.Input
|
|
2553
2439
|
}] } });
|
|
2554
2440
|
|
|
2441
|
+
var SkySearchModule = /** @class */ (function () {
|
|
2442
|
+
function SkySearchModule() {
|
|
2443
|
+
}
|
|
2444
|
+
return SkySearchModule;
|
|
2445
|
+
}());
|
|
2446
|
+
SkySearchModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkySearchModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2447
|
+
SkySearchModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkySearchModule, declarations: [SkySearchComponent], imports: [i6$1.CommonModule,
|
|
2448
|
+
i6.SkyInputBoxModule,
|
|
2449
|
+
SkyLookupResourcesModule,
|
|
2450
|
+
i8.FormsModule,
|
|
2451
|
+
i4.SkyIconModule,
|
|
2452
|
+
i7.SkyThemeModule,
|
|
2453
|
+
i1.SkyIdModule], exports: [SkySearchComponent] });
|
|
2454
|
+
SkySearchModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkySearchModule, imports: [[
|
|
2455
|
+
i6$1.CommonModule,
|
|
2456
|
+
i6.SkyInputBoxModule,
|
|
2457
|
+
SkyLookupResourcesModule,
|
|
2458
|
+
i8.FormsModule,
|
|
2459
|
+
i4.SkyIconModule,
|
|
2460
|
+
i7.SkyThemeModule,
|
|
2461
|
+
i1.SkyIdModule,
|
|
2462
|
+
]] });
|
|
2463
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkySearchModule, decorators: [{
|
|
2464
|
+
type: i0.NgModule,
|
|
2465
|
+
args: [{
|
|
2466
|
+
declarations: [SkySearchComponent],
|
|
2467
|
+
imports: [
|
|
2468
|
+
i6$1.CommonModule,
|
|
2469
|
+
i6.SkyInputBoxModule,
|
|
2470
|
+
SkyLookupResourcesModule,
|
|
2471
|
+
i8.FormsModule,
|
|
2472
|
+
i4.SkyIconModule,
|
|
2473
|
+
i7.SkyThemeModule,
|
|
2474
|
+
i1.SkyIdModule,
|
|
2475
|
+
],
|
|
2476
|
+
exports: [SkySearchComponent],
|
|
2477
|
+
}]
|
|
2478
|
+
}] });
|
|
2479
|
+
|
|
2480
|
+
var SkyLookupItemSelectedPipe = /** @class */ (function () {
|
|
2481
|
+
function SkyLookupItemSelectedPipe() {
|
|
2482
|
+
}
|
|
2483
|
+
SkyLookupItemSelectedPipe.prototype.transform = function (id, selectedIdMap) {
|
|
2484
|
+
return selectedIdMap.has(id);
|
|
2485
|
+
};
|
|
2486
|
+
return SkyLookupItemSelectedPipe;
|
|
2487
|
+
}());
|
|
2488
|
+
SkyLookupItemSelectedPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupItemSelectedPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
2489
|
+
SkyLookupItemSelectedPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupItemSelectedPipe, name: "skyLookupItemSelected" });
|
|
2490
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupItemSelectedPipe, decorators: [{
|
|
2491
|
+
type: i0.Pipe,
|
|
2492
|
+
args: [{
|
|
2493
|
+
name: 'skyLookupItemSelected',
|
|
2494
|
+
}]
|
|
2495
|
+
}] });
|
|
2496
|
+
|
|
2497
|
+
/**
|
|
2498
|
+
* @internal
|
|
2499
|
+
* Context for the show more native picker. These values are provided by the lookup component.
|
|
2500
|
+
*/
|
|
2501
|
+
var SkyLookupShowMoreNativePickerAsyncContext = /** @class */ (function () {
|
|
2502
|
+
function SkyLookupShowMoreNativePickerAsyncContext() {
|
|
2503
|
+
}
|
|
2504
|
+
return SkyLookupShowMoreNativePickerAsyncContext;
|
|
2505
|
+
}());
|
|
2506
|
+
|
|
2507
|
+
/**
|
|
2508
|
+
* @internal
|
|
2509
|
+
* Internal component to implement the native picker.
|
|
2510
|
+
*/
|
|
2511
|
+
var SkyLookupShowMoreAsyncModalComponent = /** @class */ (function () {
|
|
2512
|
+
function SkyLookupShowMoreAsyncModalComponent(modalInstance, context, changeDetector) {
|
|
2513
|
+
this.modalInstance = modalInstance;
|
|
2514
|
+
this.context = context;
|
|
2515
|
+
this.changeDetector = changeDetector;
|
|
2516
|
+
/**
|
|
2517
|
+
* @internal
|
|
2518
|
+
* Fires when users select the button to add new options to the list.
|
|
2519
|
+
*/
|
|
2520
|
+
this.addClick = new rxjs.Subject();
|
|
2521
|
+
this.displayedItems = [];
|
|
2522
|
+
this.onlyShowSelected = false;
|
|
2523
|
+
this.isSearching = false;
|
|
2524
|
+
this.hasMoreItems = false;
|
|
2525
|
+
this.isLoadingMore = false;
|
|
2526
|
+
this.offset = 0;
|
|
2527
|
+
this.ngUnsubscribe = new rxjs.Subject();
|
|
2528
|
+
}
|
|
2529
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.ngOnInit = function () {
|
|
2530
|
+
this.searchText = this.context.initialSearch;
|
|
2531
|
+
this.createInitialSelectedItemsMap();
|
|
2532
|
+
this.loadSearchResults();
|
|
2533
|
+
};
|
|
2534
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.ngOnDestroy = function () {
|
|
2535
|
+
this.cancelCurrentSearch();
|
|
2536
|
+
this.ngUnsubscribe.next();
|
|
2537
|
+
this.ngUnsubscribe.complete();
|
|
2538
|
+
};
|
|
2539
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.addButtonClicked = function () {
|
|
2540
|
+
this.addClick.next();
|
|
2541
|
+
};
|
|
2542
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.clearAll = function () {
|
|
2543
|
+
var e_1, _a;
|
|
2544
|
+
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2545
|
+
try {
|
|
2546
|
+
// Only deselect items that have been loaded; items that would be loaded
|
|
2547
|
+
// after an infinite scroll event should remain selected.
|
|
2548
|
+
for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2549
|
+
var item = _c.value;
|
|
2550
|
+
this.selectedIdMap.delete(item[this.context.idProperty]);
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2554
|
+
finally {
|
|
2555
|
+
try {
|
|
2556
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2557
|
+
}
|
|
2558
|
+
finally { if (e_1) throw e_1.error; }
|
|
2559
|
+
}
|
|
2560
|
+
this.updateDisplayedItems();
|
|
2561
|
+
this.changeDetector.markForCheck();
|
|
2562
|
+
};
|
|
2563
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.itemClick = function (selectedItem) {
|
|
2564
|
+
if (this.context.selectMode === 'single') {
|
|
2565
|
+
this.onItemSelect(!selectedItem.selected, selectedItem);
|
|
2566
|
+
}
|
|
2567
|
+
};
|
|
2568
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.onItemSelect = function (newSelectState, itemToSelect) {
|
|
2569
|
+
var itemId = itemToSelect[this.context.idProperty];
|
|
2570
|
+
// Create a new Map so the pipe transform will execute on the next
|
|
2571
|
+
// change detection cycle.
|
|
2572
|
+
this.selectedIdMap = new Map(this.selectedIdMap);
|
|
2573
|
+
if (this.context.selectMode === 'single') {
|
|
2574
|
+
if (newSelectState) {
|
|
2575
|
+
this.selectedIdMap.clear();
|
|
2576
|
+
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
else {
|
|
2580
|
+
if (newSelectState) {
|
|
2581
|
+
this.selectedIdMap.set(itemId, itemToSelect);
|
|
2582
|
+
}
|
|
2583
|
+
else {
|
|
2584
|
+
this.selectedIdMap.delete(itemId);
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
this.updateDisplayedItems();
|
|
2588
|
+
};
|
|
2589
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.searchApplied = function (searchText) {
|
|
2590
|
+
this.offset = 0;
|
|
2591
|
+
this.searchText = searchText;
|
|
2592
|
+
this.loadSearchResults();
|
|
2593
|
+
};
|
|
2594
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.selectAll = function () {
|
|
2595
|
+
var e_2, _a;
|
|
2596
|
+
this.selectedIdMap = new Map();
|
|
2597
|
+
try {
|
|
2598
|
+
for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2599
|
+
var item = _c.value;
|
|
2600
|
+
this.selectedIdMap.set(item[this.context.idProperty], item);
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2604
|
+
finally {
|
|
2605
|
+
try {
|
|
2606
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2607
|
+
}
|
|
2608
|
+
finally { if (e_2) throw e_2.error; }
|
|
2609
|
+
}
|
|
2610
|
+
this.updateDisplayedItems();
|
|
2611
|
+
};
|
|
2612
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.infiniteScrollEnd = function () {
|
|
2613
|
+
var _this = this;
|
|
2614
|
+
this.cancelCurrentSearch();
|
|
2615
|
+
/* Sanity check - else case would only happen if this was called directly */
|
|
2616
|
+
/* istanbul ignore else */
|
|
2617
|
+
if (this.hasMoreItems) {
|
|
2618
|
+
this.isLoadingMore = true;
|
|
2619
|
+
this.performSearch(function (result) {
|
|
2620
|
+
_this.items = _this.items.concat(result.items);
|
|
2621
|
+
_this.updateDisplayedItems();
|
|
2622
|
+
_this.isLoadingMore = false;
|
|
2623
|
+
});
|
|
2624
|
+
}
|
|
2625
|
+
};
|
|
2626
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.save = function () {
|
|
2627
|
+
var _this = this;
|
|
2628
|
+
var selectedItems = Array.from(this.selectedIdMap.values(), function (itemData, index) { return ({
|
|
2629
|
+
index: index,
|
|
2630
|
+
itemData: itemData,
|
|
2631
|
+
}); }).sort(function (a, b) {
|
|
2632
|
+
return _this.items.indexOf(a.itemData) < _this.items.indexOf(b.itemData)
|
|
2633
|
+
? -1
|
|
2634
|
+
: 1;
|
|
2635
|
+
});
|
|
2636
|
+
this.modalInstance.save(selectedItems);
|
|
2637
|
+
};
|
|
2638
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.loadSearchResults = function () {
|
|
2639
|
+
var _this = this;
|
|
2640
|
+
this.cancelCurrentSearch();
|
|
2641
|
+
this.isSearching = true;
|
|
2642
|
+
this.performSearch(function (result) {
|
|
2643
|
+
_this.isSearching = false;
|
|
2644
|
+
_this.items = result.items;
|
|
2645
|
+
});
|
|
2646
|
+
};
|
|
2647
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.createInitialSelectedItemsMap = function () {
|
|
2648
|
+
var _this = this;
|
|
2649
|
+
this.selectedIdMap = new Map(this.context.initialValue.map(function (item) { return [
|
|
2650
|
+
item[_this.context.idProperty],
|
|
2651
|
+
item,
|
|
2652
|
+
]; }));
|
|
2653
|
+
};
|
|
2654
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.performSearch = function (processResults) {
|
|
2655
|
+
var _this = this;
|
|
2656
|
+
this.currentSearchSub = this.context
|
|
2657
|
+
.searchAsync({
|
|
2658
|
+
displayType: 'modal',
|
|
2659
|
+
offset: this.offset,
|
|
2660
|
+
searchText: this.searchText || '',
|
|
2661
|
+
continuationData: this.continuationData,
|
|
2662
|
+
})
|
|
2663
|
+
.pipe(operators.take(1))
|
|
2664
|
+
.subscribe(function (result) {
|
|
2665
|
+
processResults(result);
|
|
2666
|
+
_this.continuationData = result.continuationData;
|
|
2667
|
+
_this.hasMoreItems = result.hasMore;
|
|
2668
|
+
_this.offset = _this.items.length;
|
|
2669
|
+
_this.updateDisplayedItems();
|
|
2670
|
+
_this.changeDetector.markForCheck();
|
|
2671
|
+
});
|
|
2672
|
+
};
|
|
2673
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.updateDisplayedItems = function () {
|
|
2674
|
+
var _this = this;
|
|
2675
|
+
if (this.onlyShowSelected) {
|
|
2676
|
+
this.displayedItems = this.items.filter(function (item) { return _this.selectedIdMap.has(item[_this.context.idProperty]); });
|
|
2677
|
+
}
|
|
2678
|
+
else {
|
|
2679
|
+
this.displayedItems = this.items;
|
|
2680
|
+
}
|
|
2681
|
+
};
|
|
2682
|
+
SkyLookupShowMoreAsyncModalComponent.prototype.cancelCurrentSearch = function () {
|
|
2683
|
+
if (this.currentSearchSub) {
|
|
2684
|
+
this.currentSearchSub.unsubscribe();
|
|
2685
|
+
this.currentSearchSub = undefined;
|
|
2686
|
+
this.isLoadingMore = false;
|
|
2687
|
+
this.isSearching = false;
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
return SkyLookupShowMoreAsyncModalComponent;
|
|
2691
|
+
}());
|
|
2692
|
+
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 });
|
|
2693
|
+
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 });
|
|
2694
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupShowMoreAsyncModalComponent, decorators: [{
|
|
2695
|
+
type: i0.Component,
|
|
2696
|
+
args: [{
|
|
2697
|
+
selector: 'sky-lookup-show-more-async-modal',
|
|
2698
|
+
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",
|
|
2699
|
+
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"],
|
|
2700
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2701
|
+
}]
|
|
2702
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$1.SkyModalInstance }, { type: SkyLookupShowMoreNativePickerAsyncContext }, { type: i0__namespace.ChangeDetectorRef }]; } });
|
|
2703
|
+
|
|
2704
|
+
/**
|
|
2705
|
+
* @internal
|
|
2706
|
+
* Context for the show more native picker. These values are provided by the lookup component.
|
|
2707
|
+
*/
|
|
2708
|
+
var SkyLookupShowMoreNativePickerContext = /** @class */ (function () {
|
|
2709
|
+
function SkyLookupShowMoreNativePickerContext() {
|
|
2710
|
+
}
|
|
2711
|
+
return SkyLookupShowMoreNativePickerContext;
|
|
2712
|
+
}());
|
|
2713
|
+
|
|
2555
2714
|
/**
|
|
2556
2715
|
* @internal
|
|
2557
2716
|
* Internal component to implement the native picker.
|
|
@@ -2717,311 +2876,191 @@
|
|
|
2717
2876
|
return resultValues_1.then(function (values) {
|
|
2718
2877
|
var result = items.filter(function (item) { return values.indexOf(item.value) >= 0; });
|
|
2719
2878
|
return Promise.resolve(result);
|
|
2720
|
-
});
|
|
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);
|
|
2879
|
+
});
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
else {
|
|
2883
|
+
return Promise.resolve(items);
|
|
2884
|
+
}
|
|
2959
2885
|
};
|
|
2960
|
-
|
|
2886
|
+
SkyLookupShowMoreModalComponent.prototype.selectAll = function () {
|
|
2961
2887
|
var _this = this;
|
|
2962
|
-
this.
|
|
2963
|
-
this.
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2888
|
+
var selectedItems = this.selectedItems;
|
|
2889
|
+
this.displayedItems.forEach(function (item) {
|
|
2890
|
+
if (!item.selected) {
|
|
2891
|
+
item.selected = true;
|
|
2892
|
+
var index_1 = _this.items.indexOf(item);
|
|
2893
|
+
/* Sanity check */
|
|
2894
|
+
/* istanbul ignore else */
|
|
2895
|
+
if (selectedItems.findIndex(function (selectedItem) { return selectedItem.index === index_1; }) < 0) {
|
|
2896
|
+
selectedItems.push({
|
|
2897
|
+
index: index_1,
|
|
2898
|
+
itemData: _this.items[index_1].value,
|
|
2899
|
+
});
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2967
2902
|
});
|
|
2903
|
+
this.selectedItems = selectedItems;
|
|
2904
|
+
this.updateDataState();
|
|
2905
|
+
this.changeDetector.markForCheck();
|
|
2968
2906
|
};
|
|
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) {
|
|
2907
|
+
SkyLookupShowMoreModalComponent.prototype.updateDataState = function () {
|
|
2977
2908
|
var _this = this;
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
_this.
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2909
|
+
var selectedItems = this.selectedItems;
|
|
2910
|
+
this.items.forEach(function (item, index) {
|
|
2911
|
+
item.selected =
|
|
2912
|
+
selectedItems.findIndex(function (selectedItem) { return selectedItem.index === index; }) !== -1;
|
|
2913
|
+
});
|
|
2914
|
+
this.searchItems(this.items).then(function (searchedItems) {
|
|
2915
|
+
if (_this.onlyShowSelected) {
|
|
2916
|
+
searchedItems = searchedItems.filter(function (item) { return item.selected; });
|
|
2917
|
+
}
|
|
2918
|
+
_this.displayedItems = searchedItems.slice(0, _this.itemIndex);
|
|
2919
|
+
if (_this.itemIndex > searchedItems.length) {
|
|
2920
|
+
_this.itemsHaveMore = false;
|
|
2921
|
+
}
|
|
2922
|
+
else {
|
|
2923
|
+
_this.itemsHaveMore = true;
|
|
2924
|
+
}
|
|
2992
2925
|
_this.changeDetector.markForCheck();
|
|
2993
2926
|
});
|
|
2994
2927
|
};
|
|
2995
|
-
|
|
2928
|
+
SkyLookupShowMoreModalComponent.prototype.updateItemData = function (data) {
|
|
2996
2929
|
var _this = this;
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
this.isSearching = false;
|
|
3010
|
-
}
|
|
2930
|
+
this.context.items = data;
|
|
2931
|
+
this.items = undefined;
|
|
2932
|
+
this.itemIndex = 10;
|
|
2933
|
+
this.selectedItems.forEach(function (selectedItem) {
|
|
2934
|
+
_this.context.items.forEach(function (item, index) {
|
|
2935
|
+
if (selectedItem.itemData === item) {
|
|
2936
|
+
selectedItem.index = index;
|
|
2937
|
+
}
|
|
2938
|
+
});
|
|
2939
|
+
});
|
|
2940
|
+
this.addItems();
|
|
2941
|
+
this.changeDetector.markForCheck();
|
|
3011
2942
|
};
|
|
3012
|
-
return
|
|
2943
|
+
return SkyLookupShowMoreModalComponent;
|
|
3013
2944
|
}());
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type:
|
|
2945
|
+
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 });
|
|
2946
|
+
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 });
|
|
2947
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupShowMoreModalComponent, decorators: [{
|
|
3017
2948
|
type: i0.Component,
|
|
3018
2949
|
args: [{
|
|
3019
|
-
selector
|
|
3020
|
-
|
|
2950
|
+
// Suppress this error rather than fix the selector since consumers with unit tests
|
|
2951
|
+
// may be looking for an element with this selector. We can change it in the next major
|
|
2952
|
+
// version of SKY UX.
|
|
2953
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
2954
|
+
selector: 'skyux-lookup-show-more-modal',
|
|
2955
|
+
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
2956
|
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
2957
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
3023
2958
|
}]
|
|
3024
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$1.SkyModalInstance }, { type:
|
|
2959
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$1.SkyModalInstance }, { type: SkyLookupShowMoreNativePickerContext }, { type: i0__namespace.ChangeDetectorRef }]; } });
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
* @internal
|
|
2963
|
+
*/
|
|
2964
|
+
var SkyLookupAdapterService = /** @class */ (function () {
|
|
2965
|
+
function SkyLookupAdapterService() {
|
|
2966
|
+
}
|
|
2967
|
+
SkyLookupAdapterService.prototype.focusInput = function (elRef) {
|
|
2968
|
+
var inputEl = elRef.nativeElement.querySelector('.sky-lookup-input');
|
|
2969
|
+
/* Sanity check */
|
|
2970
|
+
/* istanbul ignore else */
|
|
2971
|
+
if (inputEl) {
|
|
2972
|
+
inputEl.focus();
|
|
2973
|
+
}
|
|
2974
|
+
};
|
|
2975
|
+
return SkyLookupAdapterService;
|
|
2976
|
+
}());
|
|
2977
|
+
SkyLookupAdapterService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAdapterService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2978
|
+
SkyLookupAdapterService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAdapterService });
|
|
2979
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAdapterService, decorators: [{
|
|
2980
|
+
type: i0.Injectable
|
|
2981
|
+
}] });
|
|
2982
|
+
|
|
2983
|
+
/**
|
|
2984
|
+
* @internal
|
|
2985
|
+
*/
|
|
2986
|
+
var SkyLookupAutocompleteAdapter = /** @class */ (function () {
|
|
2987
|
+
function SkyLookupAutocompleteAdapter() {
|
|
2988
|
+
this.searchAsync = new i0.EventEmitter();
|
|
2989
|
+
}
|
|
2990
|
+
Object.defineProperty(SkyLookupAutocompleteAdapter.prototype, "descriptorProperty", {
|
|
2991
|
+
get: function () {
|
|
2992
|
+
return this._descriptorProperty || 'name';
|
|
2993
|
+
},
|
|
2994
|
+
/**
|
|
2995
|
+
* Specifies an object property to display in the text input after users
|
|
2996
|
+
* select an item in the dropdown list.
|
|
2997
|
+
* @default "name"
|
|
2998
|
+
*/
|
|
2999
|
+
set: function (value) {
|
|
3000
|
+
this._descriptorProperty = value;
|
|
3001
|
+
},
|
|
3002
|
+
enumerable: false,
|
|
3003
|
+
configurable: true
|
|
3004
|
+
});
|
|
3005
|
+
Object.defineProperty(SkyLookupAutocompleteAdapter.prototype, "propertiesToSearch", {
|
|
3006
|
+
get: function () {
|
|
3007
|
+
return this._propertiesToSearch || ['name'];
|
|
3008
|
+
},
|
|
3009
|
+
/**
|
|
3010
|
+
* Specifies an array of object properties to search.
|
|
3011
|
+
* @default ["name"]
|
|
3012
|
+
*/
|
|
3013
|
+
set: function (value) {
|
|
3014
|
+
this._propertiesToSearch = value;
|
|
3015
|
+
},
|
|
3016
|
+
enumerable: false,
|
|
3017
|
+
configurable: true
|
|
3018
|
+
});
|
|
3019
|
+
Object.defineProperty(SkyLookupAutocompleteAdapter.prototype, "search", {
|
|
3020
|
+
get: function () {
|
|
3021
|
+
return (this._search ||
|
|
3022
|
+
skyAutocompleteDefaultSearchFunction({
|
|
3023
|
+
propertiesToSearch: this.propertiesToSearch,
|
|
3024
|
+
searchFilters: this.searchFilters,
|
|
3025
|
+
}));
|
|
3026
|
+
},
|
|
3027
|
+
/**
|
|
3028
|
+
* Specifies a function to dynamically manage the data source when users
|
|
3029
|
+
* change the text in the lookup field. The search function must return
|
|
3030
|
+
* an array or a promise of an array. The `search` property is particularly
|
|
3031
|
+
* useful when the data source does not live in the source code.
|
|
3032
|
+
*/
|
|
3033
|
+
set: function (value) {
|
|
3034
|
+
this._search = value;
|
|
3035
|
+
},
|
|
3036
|
+
enumerable: false,
|
|
3037
|
+
configurable: true
|
|
3038
|
+
});
|
|
3039
|
+
return SkyLookupAutocompleteAdapter;
|
|
3040
|
+
}());
|
|
3041
|
+
SkyLookupAutocompleteAdapter.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAutocompleteAdapter, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
3042
|
+
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 });
|
|
3043
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupAutocompleteAdapter, decorators: [{
|
|
3044
|
+
type: i0.Directive
|
|
3045
|
+
}], propDecorators: { debounceTime: [{
|
|
3046
|
+
type: i0.Input
|
|
3047
|
+
}], descriptorProperty: [{
|
|
3048
|
+
type: i0.Input
|
|
3049
|
+
}], propertiesToSearch: [{
|
|
3050
|
+
type: i0.Input
|
|
3051
|
+
}], search: [{
|
|
3052
|
+
type: i0.Input
|
|
3053
|
+
}], searchResultTemplate: [{
|
|
3054
|
+
type: i0.Input
|
|
3055
|
+
}], searchTextMinimumCharacters: [{
|
|
3056
|
+
type: i0.Input
|
|
3057
|
+
}], searchFilters: [{
|
|
3058
|
+
type: i0.Input
|
|
3059
|
+
}], searchResultsLimit: [{
|
|
3060
|
+
type: i0.Input
|
|
3061
|
+
}], searchAsync: [{
|
|
3062
|
+
type: i0.Output
|
|
3063
|
+
}] } });
|
|
3025
3064
|
|
|
3026
3065
|
var SkyLookupComponent = /** @class */ (function (_super) {
|
|
3027
3066
|
__extends(SkyLookupComponent, _super);
|
|
@@ -3519,7 +3558,8 @@
|
|
|
3519
3558
|
}
|
|
3520
3559
|
if (this.data.indexOf(args.item) >= 0) {
|
|
3521
3560
|
if (this.openNativePicker) {
|
|
3522
|
-
|
|
3561
|
+
this.openNativePicker
|
|
3562
|
+
.componentInstance.onItemSelect(true, { value: args.item, selected: false });
|
|
3523
3563
|
}
|
|
3524
3564
|
else {
|
|
3525
3565
|
var newValue = this.value;
|
|
@@ -3637,45 +3677,6 @@
|
|
|
3637
3677
|
}]
|
|
3638
3678
|
}] } });
|
|
3639
3679
|
|
|
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
3680
|
var SkyLookupModule = /** @class */ (function () {
|
|
3680
3681
|
function SkyLookupModule() {
|
|
3681
3682
|
}
|
|
@@ -3698,7 +3699,7 @@
|
|
|
3698
3699
|
SkySearchModule,
|
|
3699
3700
|
i7.SkyThemeModule,
|
|
3700
3701
|
i4.SkyTokensModule,
|
|
3701
|
-
|
|
3702
|
+
i4$1.SkyToolbarModule,
|
|
3702
3703
|
i1.SkyViewkeeperModule,
|
|
3703
3704
|
i4.SkyWaitModule], exports: [SkyLookupComponent] });
|
|
3704
3705
|
SkyLookupModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyLookupModule, imports: [[
|
|
@@ -3715,7 +3716,7 @@
|
|
|
3715
3716
|
SkySearchModule,
|
|
3716
3717
|
i7.SkyThemeModule,
|
|
3717
3718
|
i4.SkyTokensModule,
|
|
3718
|
-
|
|
3719
|
+
i4$1.SkyToolbarModule,
|
|
3719
3720
|
i1.SkyViewkeeperModule,
|
|
3720
3721
|
i4.SkyWaitModule,
|
|
3721
3722
|
]] });
|
|
@@ -3742,7 +3743,7 @@
|
|
|
3742
3743
|
SkySearchModule,
|
|
3743
3744
|
i7.SkyThemeModule,
|
|
3744
3745
|
i4.SkyTokensModule,
|
|
3745
|
-
|
|
3746
|
+
i4$1.SkyToolbarModule,
|
|
3746
3747
|
i1.SkyViewkeeperModule,
|
|
3747
3748
|
i4.SkyWaitModule,
|
|
3748
3749
|
],
|