@syncfusion/ej2-querybuilder 33.2.7 → 33.2.10

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.
@@ -204,6 +204,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
204
204
  _this.cloneGrpBtnClick = false;
205
205
  _this.isMiddleGroup = false;
206
206
  _this.cloneRuleBtnClick = false;
207
+ _this.groupConnectorStates = {};
207
208
  _this.isValueEmpty = false;
208
209
  _this.isPropChange = false;
209
210
  _this.isRuleClicked = false;
@@ -4852,6 +4853,17 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
4852
4853
  return visualElement;
4853
4854
  };
4854
4855
  QueryBuilder.prototype.dragStartHandler = function (e) {
4856
+ var _this = this;
4857
+ this.groupConnectorStates = {};
4858
+ var allGroupContainers = this.element.querySelectorAll('.e-group-container');
4859
+ allGroupContainers.forEach(function (grpContainer) {
4860
+ if (grpContainer.id !== '') {
4861
+ var groupRule = _this.getGroup(grpContainer);
4862
+ if (groupRule && groupRule.condition) {
4863
+ _this.groupConnectorStates[grpContainer.id] = groupRule.condition.toUpperCase();
4864
+ }
4865
+ }
4866
+ });
4855
4867
  this.draggedRule = e.target;
4856
4868
  this.isDragEventPrevent = false;
4857
4869
  document.body.classList.add('e-prevent-select');
@@ -4939,6 +4951,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
4939
4951
  if (this.isDragEventPrevent) {
4940
4952
  return;
4941
4953
  }
4954
+ var dropped = false;
4942
4955
  var targetGroup = closest(e.target, '.e-rule-container');
4943
4956
  if (isNullOrUndefined(targetGroup) && e.target.parentElement &&
4944
4957
  e.target.parentElement.classList.contains('e-btn-group') && this.enableSeparateConnector) {
@@ -5041,6 +5054,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5041
5054
  }
5042
5055
  }
5043
5056
  });
5057
+ dropped = true;
5044
5058
  }
5045
5059
  }
5046
5060
  else if (tgrt.classList.contains('e-rule-list') && tgrt.children.length === 0 && !isPreventelem) {
@@ -5071,6 +5085,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5071
5085
  this.addRules([rule], groupId);
5072
5086
  }
5073
5087
  }
5088
+ dropped = true;
5074
5089
  }
5075
5090
  else if (tgrt.classList.contains('e-rule-list') && tgrt.children[0].classList.contains('e-group-container') && !isPreventelem) {
5076
5091
  var groupElem = closest(tgrt, '.e-group-container');
@@ -5125,6 +5140,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5125
5140
  }
5126
5141
  }
5127
5142
  });
5143
+ dropped = true;
5128
5144
  }
5129
5145
  else if ((closest(e.target, '.e-group-container') || e.target.classList.contains('e-group-container')) && !isPreventelem) {
5130
5146
  var rule = void 0;
@@ -5159,10 +5175,14 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5159
5175
  }
5160
5176
  }
5161
5177
  }
5178
+ dropped = true;
5162
5179
  }
5163
5180
  if (!isPreventelem) {
5164
5181
  this.trigger('ruleChange', { previousRule: prevRule, rule: this.getValidRules(), type: 'drag-and-drop' });
5165
5182
  }
5183
+ if (!dropped) {
5184
+ this.restoreGroupConnectorStates();
5185
+ }
5166
5186
  this.prvtEvtTgrDaD = false;
5167
5187
  document.body.classList.remove('e-prevent-select');
5168
5188
  var borderLineElem = this.element.querySelectorAll('.e-drag-rule-bottom-line');
@@ -5522,11 +5542,38 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5522
5542
  if (dragElemnet) {
5523
5543
  remove(dragElemnet);
5524
5544
  }
5545
+ this.restoreGroupConnectorStates();
5525
5546
  if (this.enableSeparateConnector) {
5526
5547
  this.refresh();
5527
5548
  }
5528
5549
  }
5529
5550
  };
5551
+ QueryBuilder.prototype.restoreGroupConnectorStates = function () {
5552
+ var _this = this;
5553
+ var updatedGroupContainers = this.element.querySelectorAll('.e-group-container');
5554
+ updatedGroupContainers.forEach(function (grpContainer) {
5555
+ var groupId = grpContainer.id;
5556
+ if (_this.groupConnectorStates.hasOwnProperty(groupId)) {
5557
+ var savedCondition = _this.groupConnectorStates[groupId];
5558
+ var groupRule = _this.getGroup(grpContainer);
5559
+ if (groupRule) {
5560
+ groupRule.condition = savedCondition.toLowerCase();
5561
+ }
5562
+ var andElem = grpContainer.querySelector('.e-btngroup-and');
5563
+ var orElem = grpContainer.querySelector('.e-btngroup-or');
5564
+ if (andElem && orElem) {
5565
+ if (savedCondition === 'AND') {
5566
+ andElem.checked = true;
5567
+ orElem.checked = false;
5568
+ }
5569
+ else {
5570
+ orElem.checked = true;
5571
+ andElem.checked = false;
5572
+ }
5573
+ }
5574
+ }
5575
+ });
5576
+ };
5530
5577
  QueryBuilder.prototype.windowResizeHandler = function () {
5531
5578
  if (Browser.isDevice || window.innerWidth < 768) {
5532
5579
  this.displayMode = 'Vertical';
@@ -6385,8 +6432,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
6385
6432
  if (this.element.querySelectorAll('.e-group-container').length > this.maxGroupCount) {
6386
6433
  return null;
6387
6434
  }
6388
- if (isNullOrUndefined(this.updatedRule) && this.allowDragAndDrop && this.dragElement &&
6389
- this.dragElement.querySelector('.e-rule-list') && this.dragElement.querySelector('.e-rule-list').querySelector('.e-group-container')) {
6435
+ if (isNullOrUndefined(this.updatedRule) && this.allowDragAndDrop && this.dragElement) {
6390
6436
  this.updatedRule = {
6391
6437
  isLocked: ruleColl[i].isLocked, condition: ruleColl[i].condition,
6392
6438
  not: ruleColl[i].not