@syncfusion/ej2-dropdowns 20.3.59 → 20.3.60

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.
@@ -6,9 +6,6 @@ import { Input, TextBox } from '@syncfusion/ej2-inputs';
6
6
  import { Button, createCheckBox } from '@syncfusion/ej2-buttons';
7
7
  import { TreeView } from '@syncfusion/ej2-navigations';
8
8
 
9
- /**
10
- * IncrementalSearch module file
11
- */
12
9
  var queryString = '';
13
10
  var prevString = '';
14
11
  var matches$1 = [];
@@ -81,7 +78,7 @@ function incrementalSearch(keyCode, items, selectedIndex, ignoreCase, elementId)
81
78
  * @param {boolean} ignoreCase - Specifies the case sensitive option for search operation.
82
79
  * @returns {Element | number} Returns the search matched items.
83
80
  */
84
- function Search(inputVal, items, searchType, ignoreCase) {
81
+ function Search(inputVal, items, searchType, ignoreCase, dataSource, fields, type) {
85
82
  var listItems = items;
86
83
  ignoreCase = ignoreCase !== undefined && ignoreCase !== null ? ignoreCase : true;
87
84
  var itemData = { item: null, index: null };
@@ -89,14 +86,32 @@ function Search(inputVal, items, searchType, ignoreCase) {
89
86
  var strLength = inputVal.length;
90
87
  var queryStr = ignoreCase ? inputVal.toLocaleLowerCase() : inputVal;
91
88
  queryStr = escapeCharRegExp(queryStr);
92
- for (var i = 0, itemsData = listItems; i < itemsData.length; i++) {
89
+ var _loop_1 = function (i, itemsData) {
93
90
  var item = itemsData[i];
94
- var text = (ignoreCase ? item.textContent.toLocaleLowerCase() : item.textContent).replace(/^\s+|\s+$/g, '');
91
+ var text = void 0;
92
+ var filterValue;
93
+ if (items && dataSource) {
94
+ var checkField_1 = item;
95
+ var fieldValue_1 = fields.text.split('.');
96
+ dataSource.filter(function (data) {
97
+ Array.prototype.slice.call(fieldValue_1).forEach(function (value) {
98
+ if (type === 'object' && checkField_1.textContent.toString().indexOf(data[value]) !== -1 && checkField_1.getAttribute('data-value') === data[fields.value] || type === 'string' && checkField_1.textContent.toString().indexOf(data) !== -1) {
99
+ filterValue = type === 'object' ? data[value] : data;
100
+ }
101
+ });
102
+ });
103
+ }
104
+ text = dataSource && filterValue ? (ignoreCase ? filterValue.toLocaleLowerCase() : filterValue).replace(/^\s+|\s+$/g, '') : (ignoreCase ? item.textContent.toLocaleLowerCase() : item.textContent).replace(/^\s+|\s+$/g, '');
95
105
  if ((searchType === 'Equal' && text === queryStr) || (searchType === 'StartsWith' && text.substr(0, strLength) === queryStr) || (searchType === 'EndsWith' && text.substr(text.length - queryStr.length) === queryStr) || (searchType === 'Contains' && new RegExp(queryStr, "g").test(text))) {
96
106
  itemData.item = item;
97
107
  itemData.index = i;
98
- return { item: item, index: i };
108
+ return { value: { item: item, index: i } };
99
109
  }
110
+ };
111
+ for (var i = 0, itemsData = listItems; i < itemsData.length; i++) {
112
+ var state_1 = _loop_1(i, itemsData);
113
+ if (typeof state_1 === "object")
114
+ return state_1.value;
100
115
  }
101
116
  return itemData;
102
117
  }
@@ -1212,7 +1227,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1212
1227
  * Adds a new item to the popup list. By default, new item appends to the list as the last item,
1213
1228
  * but you can insert based on the index parameter.
1214
1229
  *
1215
- * @param { Object[] } items - Specifies an array of JSON data or a JSON data.
1230
+ * @param { Object[] } items - Specifies an array of JSON data or a JSON data.
1216
1231
  * @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
1217
1232
  * @returns {void}
1218
1233
  * @deprecated
@@ -2494,10 +2509,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
2494
2509
  attributes(this.targetElement(), { 'aria-describedby': this.inputElement.id != '' ? this.inputElement.id : this.element.id });
2495
2510
  this.targetElement().removeAttribute('aria-live');
2496
2511
  }
2497
- if (!isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
2512
+ if (this.isPopupOpen && !isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
2498
2513
  attributes(this.targetElement(), { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
2499
2514
  }
2500
- else if (!isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-active')[0])) {
2515
+ else if (this.isPopupOpen && !isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-active')[0])) {
2501
2516
  attributes(this.targetElement(), { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-active')[0].id });
2502
2517
  }
2503
2518
  };
@@ -2817,9 +2832,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
2817
2832
  /**
2818
2833
  * To filter the data from given data source by using query
2819
2834
  *
2820
- * @param {Object[] | DataManager } dataSource - Set the data source to filter.
2821
- * @param {Query} query - Specify the query to filter the data.
2822
- * @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
2835
+ * @param {Object[] | DataManager } dataSource - Set the data source to filter.
2836
+ * @param {Query} query - Specify the query to filter the data.
2837
+ * @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
2823
2838
  * @returns {void}
2824
2839
  * @deprecated
2825
2840
  */
@@ -7690,7 +7705,9 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
7690
7705
  if ((Browser.isDevice && !this.isDropDownClick || !Browser.isDevice) &&
7691
7706
  !isNullOrUndefined(this.liCollections) && this.liCollections.length > 0) {
7692
7707
  var inputValue = this.inputElement.value;
7693
- var activeItem = Search(inputValue, this.liCollections, this.filterType, true);
7708
+ var dataSource = this.sortedData;
7709
+ var type = this.typeOfData(dataSource).typeof;
7710
+ var activeItem = Search(inputValue, this.liCollections, this.filterType, true, dataSource, this.fields, type);
7694
7711
  var activeElement = activeItem.item;
7695
7712
  if (!isNullOrUndefined(activeElement)) {
7696
7713
  var count = this.getIndexByValue(activeElement.getAttribute('data-value')) - 1;
@@ -8091,7 +8108,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
8091
8108
  * Adds a new item to the combobox popup list. By default, new item appends to the list as the last item,
8092
8109
  * but you can insert based on the index parameter.
8093
8110
  *
8094
- * @param { Object[] } items - Specifies an array of JSON data or a JSON data.
8111
+ * @param { Object[] } items - Specifies an array of JSON data or a JSON data.
8095
8112
  * @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
8096
8113
  * @returns {void}
8097
8114
  * @deprecated
@@ -8102,9 +8119,9 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
8102
8119
  /**
8103
8120
  * To filter the data from given data source by using query
8104
8121
  *
8105
- * @param {Object[] | DataManager } dataSource - Set the data source to filter.
8106
- * @param {Query} query - Specify the query to filter the data.
8107
- * @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
8122
+ * @param {Object[] | DataManager } dataSource - Set the data source to filter.
8123
+ * @param {Query} query - Specify the query to filter the data.
8124
+ * @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
8108
8125
  * @returns {void}
8109
8126
  * @deprecated
8110
8127
  */
@@ -8151,10 +8168,12 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
8151
8168
  return;
8152
8169
  }
8153
8170
  if (this.getModuleName() === 'combobox' && this.inputElement.value.trim() !== '') {
8154
- var searchItem = Search(this.inputElement.value, this.liCollections, 'Equal', true);
8171
+ var dataSource = this.sortedData;
8172
+ var type = this.typeOfData(dataSource).typeof;
8173
+ var searchItem = Search(this.inputElement.value, this.liCollections, 'Equal', true, dataSource, this.fields, type);
8155
8174
  this.selectedLI = searchItem.item;
8156
8175
  if (isNullOrUndefined(searchItem.index)) {
8157
- searchItem.index = Search(this.inputElement.value, this.liCollections, 'StartsWith', true).index;
8176
+ searchItem.index = Search(this.inputElement.value, this.liCollections, 'StartsWith', true, dataSource, this.fields, type).index;
8158
8177
  }
8159
8178
  this.activeIndex = searchItem.index;
8160
8179
  if (!isNullOrUndefined(this.selectedLI)) {
@@ -8443,9 +8462,9 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
8443
8462
  /**
8444
8463
  * To filter the data from given data source by using query
8445
8464
  *
8446
- * @param {Object[] | DataManager } dataSource - Set the data source to filter.
8447
- * @param {Query} query - Specify the query to filter the data.
8448
- * @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
8465
+ * @param {Object[] | DataManager } dataSource - Set the data source to filter.
8466
+ * @param {Query} query - Specify the query to filter the data.
8467
+ * @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
8449
8468
  * @returns {void}
8450
8469
  * @deprecated
8451
8470
  */
@@ -8485,7 +8504,9 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
8485
8504
  AutoComplete.prototype.postBackAction = function () {
8486
8505
  if (this.autofill && !isNullOrUndefined(this.liCollections[0]) && this.searchList) {
8487
8506
  var items = [this.liCollections[0]];
8488
- var searchItem = Search(this.inputElement.value, items, 'StartsWith', this.ignoreCase);
8507
+ var dataSource = this.listData;
8508
+ var type = this.typeOfData(dataSource).typeof;
8509
+ var searchItem = Search(this.inputElement.value, items, 'StartsWith', this.ignoreCase, dataSource, this.fields, type);
8489
8510
  this.searchList = false;
8490
8511
  if (!isNullOrUndefined(searchItem.item)) {
8491
8512
  _super.prototype.setAutoFill.call(this, this.liCollections[0], true);
@@ -9524,9 +9545,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9524
9545
  /**
9525
9546
  * To filter the multiselect data from given data source by using query
9526
9547
  *
9527
- * @param {Object[] | DataManager } dataSource - Set the data source to filter.
9528
- * @param {Query} query - Specify the query to filter the data.
9529
- * @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
9548
+ * @param {Object[] | DataManager } dataSource - Set the data source to filter.
9549
+ * @param {Query} query - Specify the query to filter the data.
9550
+ * @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
9530
9551
  * @returns {void}
9531
9552
  */
9532
9553
  MultiSelect.prototype.filter = function (dataSource, query, fields) {
@@ -12534,7 +12555,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12534
12555
  * Adds a new item to the multiselect popup list. By default, new item appends to the list as the last item,
12535
12556
  * but you can insert based on the index parameter.
12536
12557
  *
12537
- * @param { Object[] } items - Specifies an array of JSON data or a JSON data.
12558
+ * @param { Object[] } items - Specifies an array of JSON data or a JSON data.
12538
12559
  * @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
12539
12560
  * @returns {void}
12540
12561
  */