@skyux/lookup 5.6.0 → 5.7.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.
Files changed (27) hide show
  1. package/bundles/skyux-lookup.umd.js +30 -44
  2. package/documentation.json +527 -645
  3. package/esm2015/lib/modules/autocomplete/autocomplete-adapter.service.js +0 -1
  4. package/esm2015/lib/modules/autocomplete/autocomplete-adapter.service.js.map +1 -1
  5. package/esm2015/lib/modules/autocomplete/autocomplete-input.directive.js +4 -3
  6. package/esm2015/lib/modules/autocomplete/autocomplete-input.directive.js.map +1 -1
  7. package/esm2015/lib/modules/autocomplete/autocomplete.component.js +11 -3
  8. package/esm2015/lib/modules/autocomplete/autocomplete.component.js.map +1 -1
  9. package/esm2015/lib/modules/country-field/country-field.component.js +2 -2
  10. package/esm2015/lib/modules/country-field/country-field.component.js.map +1 -1
  11. package/esm2015/lib/modules/lookup/lookup-autocomplete-adapter.js +7 -1
  12. package/esm2015/lib/modules/lookup/lookup-autocomplete-adapter.js.map +1 -1
  13. package/esm2015/lib/modules/lookup/lookup.component.js +5 -4
  14. package/esm2015/lib/modules/lookup/lookup.component.js.map +1 -1
  15. package/esm2015/lib/modules/shared/sky-lookup-resources.module.js +1 -1
  16. package/esm2015/lib/modules/shared/sky-lookup-resources.module.js.map +1 -1
  17. package/fesm2015/skyux-lookup.js +30 -44
  18. package/fesm2015/skyux-lookup.js.map +1 -1
  19. package/lib/modules/autocomplete/autocomplete-adapter.service.d.ts +0 -1
  20. package/lib/modules/autocomplete/autocomplete.component.d.ts +8 -2
  21. package/lib/modules/country-field/country-field.component.d.ts +3 -3
  22. package/lib/modules/lookup/lookup-autocomplete-adapter.d.ts +7 -1
  23. package/lib/modules/shared/sky-lookup-resources.module.d.ts +1 -1
  24. package/package.json +21 -18
  25. package/esm2015/lib/polyfills.js +0 -30
  26. package/esm2015/lib/polyfills.js.map +0 -1
  27. package/lib/polyfills.d.ts +0 -0
@@ -37,7 +37,7 @@
37
37
  /**
38
38
  * NOTICE: DO NOT MODIFY THIS FILE!
39
39
  * The contents of this file were automatically generated by
40
- * the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-lookup' schematic.
40
+ * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-lookup' schematic.
41
41
  * To update this file, simply rerun the command.
42
42
  */
43
43
  var RESOURCES = {
@@ -131,7 +131,8 @@
131
131
  this._disabled = false;
132
132
  this._focus = new rxjs.Subject();
133
133
  this._textChanges = new rxjs.Subject();
134
- /* istanbul ignore next */
134
+ // istanbul ignore next
135
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
135
136
  this.onValidatorChange = function () { };
136
137
  }
137
138
  Object.defineProperty(SkyAutocompleteInputDirective.prototype, "autocompleteAttribute", {
@@ -332,9 +333,9 @@
332
333
  }
333
334
  };
334
335
  // Angular automatically constructs these methods.
335
- /* istanbul ignore next */
336
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
336
337
  SkyAutocompleteInputDirective.prototype.onChange = function (value) { };
337
- /* istanbul ignore next */
338
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
338
339
  SkyAutocompleteInputDirective.prototype.onTouched = function () { };
339
340
  SkyAutocompleteInputDirective.prototype.setAttributes = function (element) {
340
341
  this.renderer.setAttribute(element, 'autocomplete', this.autocompleteAttribute);
@@ -708,36 +709,6 @@
708
709
  return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
709
710
  }
710
711
 
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;
722
- }
723
- do {
724
- if (el.matches(s)) {
725
- return el;
726
- }
727
- el = el.parentElement || el.parentNode;
728
- } while (el !== null && el.nodeType === 1);
729
- return null;
730
- };
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;
739
- }
740
-
741
712
  /**
742
713
  * @internal
743
714
  */
@@ -887,6 +858,10 @@
887
858
  * Fires when users select the button to view all options.
888
859
  */
889
860
  this.showMoreClick = new i0.EventEmitter();
861
+ /**
862
+ * Fires when users enter new search information and allows results to be
863
+ * returned via an observable.
864
+ */
890
865
  this.searchAsync = new i0.EventEmitter();
891
866
  this.isOpen = false;
892
867
  this.isSearchingAsync = false;
@@ -914,7 +889,7 @@
914
889
  /**
915
890
  * Specifies a static data source for the autocomplete component to search
916
891
  * when users enter text. For a dynamic data source such as an array that
917
- * changes due to server calls, use the `search` property instead.
892
+ * changes due to server calls, use `search` or `searchAsync` instead.
918
893
  */
919
894
  set: function (value) {
920
895
  this._data = value;
@@ -993,7 +968,9 @@
993
968
  * Specifies a function to dynamically manage the data source when users
994
969
  * change the text in the autocomplete field. The search function must return
995
970
  * an array or a promise of an array. The `search` property is particularly
996
- * useful when the data source does not live in the source code.
971
+ * useful when the data source does not live in the source code. If the
972
+ * search requires calling a remote data source, use `searchAsync` instead of
973
+ * `search`.
997
974
  */
998
975
  set: function (value) {
999
976
  this._search = value;
@@ -1298,7 +1275,9 @@
1298
1275
  this.currentSearchSub = this.performSearch()
1299
1276
  .pipe(operators.take(1))
1300
1277
  .subscribe(function (result) {
1301
- var items = result.items;
1278
+ var items = result.items.filter(function (item) {
1279
+ return item && _this.descriptorProperty in item;
1280
+ });
1302
1281
  _this.isSearchingAsync = false;
1303
1282
  _this._searchResults = items.map(function (r, i) {
1304
1283
  var result = {
@@ -1721,9 +1700,9 @@
1721
1700
  this._disabled = false;
1722
1701
  this._includePhoneInfo = false;
1723
1702
  // Angular automatically constructs these methods.
1724
- /* istanbul ignore next */
1703
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
1725
1704
  this.onChange = function (value) { };
1726
- /* istanbul ignore next */
1705
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
1727
1706
  this.onTouched = function () { };
1728
1707
  this.setupCountries();
1729
1708
  this.countrySearchFormControl = new i8.FormControl();
@@ -2985,6 +2964,10 @@
2985
2964
  */
2986
2965
  var SkyLookupAutocompleteAdapter = /** @class */ (function () {
2987
2966
  function SkyLookupAutocompleteAdapter() {
2967
+ /**
2968
+ * Fires when users enter new search information and allows results to be
2969
+ * returned via an observable.
2970
+ */
2988
2971
  this.searchAsync = new i0.EventEmitter();
2989
2972
  }
2990
2973
  Object.defineProperty(SkyLookupAutocompleteAdapter.prototype, "descriptorProperty", {
@@ -3028,7 +3011,9 @@
3028
3011
  * Specifies a function to dynamically manage the data source when users
3029
3012
  * change the text in the lookup field. The search function must return
3030
3013
  * 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.
3014
+ * useful when the data source does not live in the source code. If the
3015
+ * search requires calling a remote data source, use `searchAsync` instead of
3016
+ * `search`.
3032
3017
  */
3033
3018
  set: function (value) {
3034
3019
  this._search = value;
@@ -3097,9 +3082,9 @@
3097
3082
  _this.idle = new rxjs.Subject();
3098
3083
  _this.markForTokenFocusOnKeyUp = false;
3099
3084
  // Angular automatically constructs these methods.
3100
- /* istanbul ignore next */
3085
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3101
3086
  _this.onChange = function (value) { };
3102
- /* istanbul ignore next */
3087
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3103
3088
  _this.onTouched = function () { };
3104
3089
  ngControl.valueAccessor = _this;
3105
3090
  return _this;
@@ -3386,8 +3371,9 @@
3386
3371
  var isValueInTextBox = false;
3387
3372
  if (this.selectMode === 'single') {
3388
3373
  isValueInTextBox =
3389
- this.autocompleteInputDirective.inputTextValue ===
3390
- this.autocompleteInputDirective.value[this.descriptorProperty];
3374
+ this.autocompleteInputDirective.value &&
3375
+ this.autocompleteInputDirective.inputTextValue ===
3376
+ this.autocompleteInputDirective.value[this.descriptorProperty];
3391
3377
  }
3392
3378
  this.openPicker(isValueInTextBox ? '' : this.autocompleteInputDirective.inputTextValue);
3393
3379
  this.autocompleteInputDirective.restoreInputTextValueToPreviousState();