@syncfusion/ej2-dropdowns 32.1.25 → 32.2.4

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);
@@ -17242,7 +17261,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17242
17261
  this.unwireListEvents();
17243
17262
  this.wireListEvents();
17244
17263
  };
17245
- MultiSelect.prototype.initialValueUpdate = function (listItems, isInitialVirtualData) {
17264
+ MultiSelect.prototype.initialValueUpdate = function (listItems, isInitialVirtualData, isInitialRender) {
17246
17265
  var _this = this;
17247
17266
  if (this.list) {
17248
17267
  var text = void 0;
@@ -17252,6 +17271,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17252
17271
  this.chipCollectionWrapper.innerHTML = '';
17253
17272
  }
17254
17273
  this.removeListSelection();
17274
+ var formElement = closest(this.inputElement, 'form');
17255
17275
  if (!isNullOrUndefined(this.value)) {
17256
17276
  for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
17257
17277
  value_2 = this.allowObjectBinding ?
@@ -17296,7 +17316,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17296
17316
  }
17297
17317
  else if ((isNullOrUndefined(text) && !this.allowCustomValue) &&
17298
17318
  ((!(this.dataSource instanceof DataManager)) ||
17299
- (this.dataSource instanceof DataManager && isInitialVirtualData))) {
17319
+ (this.dataSource instanceof DataManager && isInitialVirtualData)) && (!this.isAngular || !isInitialRender ||
17320
+ (isNullOrUndefined(formElement) && listItems && listItems.length > 0))) {
17300
17321
  this.value.splice(index, 1);
17301
17322
  index -= 1;
17302
17323
  }
@@ -19402,7 +19423,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
19402
19423
  this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
19403
19424
  this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.viewPortInfo.startIndex > 0 ?
19404
19425
  this.viewPortInfo.endIndex : this.itemCount;
19405
- this.checkInitialValue();
19426
+ this.checkInitialValue(true);
19406
19427
  if (this.element.hasAttribute('data-val')) {
19407
19428
  this.element.setAttribute('data-val', 'false');
19408
19429
  }
@@ -19582,7 +19603,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
19582
19603
  this.value = data.length > 0 ? data : null;
19583
19604
  }
19584
19605
  };
19585
- MultiSelect.prototype.checkInitialValue = function () {
19606
+ MultiSelect.prototype.checkInitialValue = function (isInitialRender) {
19586
19607
  var _this = this;
19587
19608
  if (this.fields.disabled) {
19588
19609
  this.removeDisabledItemsValue(this.value);
@@ -19669,7 +19690,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
19669
19690
  }
19670
19691
  }
19671
19692
  if (!(this.dataSource instanceof DataManager)) {
19672
- this.initialValueUpdate(listItems_3, true);
19693
+ this.initialValueUpdate(listItems_3, true, isInitialRender);
19673
19694
  this.initialUpdate();
19674
19695
  }
19675
19696
  else {