@syncfusion/ej2-dropdowns 32.2.3 → 32.2.6

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.
@@ -5532,37 +5532,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5532
5532
  this.activeIndex = this.index;
5533
5533
  this.initialRemoteRender = false;
5534
5534
  if (this.value && this.dataSource instanceof DataManager) {
5535
- var checkField_1 = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
5536
- var value_1 = this.allowObjectBinding && !isNullOrUndefined(this.value) ?
5537
- getValue(checkField_1, this.value) : this.value;
5538
- var fieldValue_1 = this.fields.value.split('.');
5539
- var checkVal = list.some(function (x) {
5540
- return isNullOrUndefined(x[checkField_1]) && fieldValue_1.length > 1 ?
5541
- _this.checkFieldValue(x, fieldValue_1) === value_1 : x[checkField_1] === value_1;
5542
- });
5543
- if (this.enableVirtualization && this.virtualGroupDataSource) {
5544
- checkVal = this.virtualGroupDataSource.some(function (x) {
5545
- return isNullOrUndefined(x[checkField_1]) && fieldValue_1.length > 1 ?
5546
- _this.checkFieldValue(x, fieldValue_1) === value_1 : x[checkField_1] === value_1;
5547
- });
5548
- }
5549
- if (!checkVal && !this.enableVirtualization) {
5550
- this.dataSource.executeQuery(this.getQuery(this.query).where(new Predicate(checkField_1, 'equal', value_1)))
5551
- .then(function (e) {
5552
- if (e.result.length > 0) {
5553
- if (!_this.enableVirtualization) {
5554
- _this.addItem(e.result, list.length);
5555
- }
5556
- _this.updateValues();
5557
- }
5558
- else {
5559
- _this.updateValues();
5560
- }
5561
- });
5562
- }
5563
- else {
5564
- this.updateValues();
5565
- }
5535
+ var checkField = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
5536
+ var value = this.allowObjectBinding && !isNullOrUndefined(this.value) ?
5537
+ getValue(checkField, this.value) : this.value;
5538
+ this.checkAndFetchItemData(list, value, checkField);
5566
5539
  }
5567
5540
  else {
5568
5541
  this.updateValues();
@@ -5670,6 +5643,46 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5670
5643
  });
5671
5644
  return checkField;
5672
5645
  };
5646
+ DropDownList.prototype.checkAndFetchItemData = function (list, value, checkField) {
5647
+ var _this = this;
5648
+ var fieldValue = this.fields.value.split('.');
5649
+ var checkVal = list.some(function (x) {
5650
+ return isNullOrUndefined(x[checkField]) && fieldValue.length > 1 ?
5651
+ _this.checkFieldValue(x, fieldValue) === value : x[checkField] === value;
5652
+ });
5653
+ if (this.enableVirtualization && this.virtualGroupDataSource) {
5654
+ checkVal = this.virtualGroupDataSource.some(function (x) {
5655
+ return isNullOrUndefined(x[checkField]) && fieldValue.length > 1 ?
5656
+ _this.checkFieldValue(x, fieldValue) === value : x[checkField] === value;
5657
+ });
5658
+ }
5659
+ if (!checkVal && this.dataSource instanceof DataManager) {
5660
+ (this.dataSource).executeQuery(this.getQuery(this.query).where(new Predicate(checkField, 'equal', value)))
5661
+ .then(function (e) {
5662
+ if (e.result.length > 0) {
5663
+ if (!_this.enableVirtualization) {
5664
+ _this.addItem(e.result, list.length);
5665
+ }
5666
+ else {
5667
+ _this.itemData = e.result[0];
5668
+ var dataItem = _this.getItemData();
5669
+ if ((_this.value === dataItem.value && _this.text !== dataItem.text) ||
5670
+ (_this.value !== dataItem.value && _this.text === dataItem.text)) {
5671
+ _this.setProperties({ text: dataItem.text.toString() });
5672
+ Input.setValue(_this.text, _this.inputElement, _this.floatLabelType, _this.showClearButton);
5673
+ }
5674
+ }
5675
+ _this.updateValues();
5676
+ }
5677
+ else {
5678
+ _this.updateValues();
5679
+ }
5680
+ });
5681
+ }
5682
+ else {
5683
+ this.updateValues();
5684
+ }
5685
+ };
5673
5686
  DropDownList.prototype.updateActionCompleteDataValues = function (ulElement, list) {
5674
5687
  this.actionCompleteData = { ulElement: ulElement.cloneNode(true), list: list, isUpdated: true };
5675
5688
  if (this.actionData.list !== this.actionCompleteData.list && this.actionCompleteData.ulElement && this.actionCompleteData.list) {
@@ -5679,10 +5692,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5679
5692
  DropDownList.prototype.addNewItem = function (listData, newElement) {
5680
5693
  var _this = this;
5681
5694
  if (!isNullOrUndefined(this.itemData) && !isNullOrUndefined(newElement)) {
5682
- var value_2 = this.getItemData().value;
5695
+ var value_1 = this.getItemData().value;
5683
5696
  var isExist = listData.some(function (data) {
5684
- return (((typeof data === 'string' || typeof data === 'number' || typeof data === 'boolean') && data === value_2) ||
5685
- (getValue(_this.fields.value, data) === value_2));
5697
+ return (((typeof data === 'string' || typeof data === 'number' || typeof data === 'boolean') && data === value_1) ||
5698
+ (getValue(_this.fields.value, data) === value_1));
5686
5699
  });
5687
5700
  if (!isExist) {
5688
5701
  this.addItem(this.itemData);
@@ -7095,6 +7108,12 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7095
7108
  return { value: void 0 };
7096
7109
  }
7097
7110
  if (this_1.enableVirtualization) {
7111
+ if (newProp.value && this_1.dataSource instanceof DataManager) {
7112
+ var checkField = isNullOrUndefined(this_1.fields.value) ? this_1.fields.text : this_1.fields.value;
7113
+ var value = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ?
7114
+ getValue(checkField, newProp.value) : newProp.value;
7115
+ this_1.checkAndFetchItemData(this_1.listData, value, checkField);
7116
+ }
7098
7117
  this_1.updateValues();
7099
7118
  this_1.updateInputFields();
7100
7119
  this_1.notify('setCurrentViewDataAsync', {
@@ -7123,9 +7142,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7123
7142
  var listLength_2 = this_1.getItems().length;
7124
7143
  var checkField = isNullOrUndefined(this_1.fields.value) ? this_1.fields.text : this_1.fields.value;
7125
7144
  this_1.typedString = '';
7126
- var value_3 = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ?
7145
+ var value_2 = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ?
7127
7146
  getValue(checkField, newProp.value) : newProp.value;
7128
- this_1.dataSource.executeQuery(this_1.getQuery(this_1.query).where(new Predicate(checkField, 'equal', value_3)))
7147
+ this_1.dataSource.executeQuery(this_1.getQuery(this_1.query).where(new Predicate(checkField, 'equal', value_2)))
7129
7148
  .then(function (e) {
7130
7149
  if (e.result.length > 0) {
7131
7150
  _this.addItem(e.result, listLength_2);