@syncfusion/ej2-querybuilder 31.2.15 → 31.2.16

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.
@@ -207,6 +207,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
207
207
  _this.isValueEmpty = false;
208
208
  _this.isPropChange = false;
209
209
  _this.isRuleClicked = false;
210
+ _this.groupCloned = false;
210
211
  MultiSelect.Inject(CheckBoxSelection);
211
212
  return _this;
212
213
  }
@@ -584,7 +585,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
584
585
  break;
585
586
  case target.className.indexOf('e-clone-grp-btn') > -1:
586
587
  this.actionButton = target;
587
- this.cloneGrpBtnClick = true;
588
+ this.cloneGrpBtnClick = this.groupCloned = true;
588
589
  this.isRuleClicked = true;
589
590
  this.groupClone(closest(target, '.e-group-container'));
590
591
  break;
@@ -4210,6 +4211,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
4210
4211
  if (this.isAddSuccess || this.element.querySelectorAll('.e-group-container').length <= this.maxGroupCount) {
4211
4212
  groupID = this.element.id + '_' + groupID;
4212
4213
  var groupElem = document.getElementById(groupID);
4214
+ var temp = this.groupIndex;
4213
4215
  var rule = this.getParentGroup(groupElem);
4214
4216
  var grouplen = groups.length;
4215
4217
  if (grouplen) {
@@ -4232,6 +4234,11 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
4232
4234
  not = this.updatedRule.not;
4233
4235
  isLocked = this.updatedRule.isLocked;
4234
4236
  }
4237
+ if (this.groupCloned) {
4238
+ var parent_1 = this.element.querySelector('#' + groupID);
4239
+ var topLevelGroups = parent_1.querySelectorAll(':scope > .e-group-body > .e-rule-list > .e-group-container');
4240
+ this.groupIndex = topLevelGroups.length > 1 ? topLevelGroups.length - 1 : 0;
4241
+ }
4235
4242
  if (this.groupIndex < 0) {
4236
4243
  if (this.enableNotCondition) {
4237
4244
  rule.rules.push({ 'condition': condition, 'not': not, rules: [] });
@@ -4248,6 +4255,9 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
4248
4255
  rule.rules.splice(this.groupIndex + 1, 0, { condition: condition, rules: [], isLocked: isLocked });
4249
4256
  }
4250
4257
  }
4258
+ if (this.groupCloned) {
4259
+ this.groupIndex = temp;
4260
+ }
4251
4261
  }
4252
4262
  if (!this.headerTemplate) {
4253
4263
  this.disableRuleCondition(groupElem, rule, null, this.enableSeparateConnector ? true : null);
@@ -6769,13 +6779,13 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
6769
6779
  var isCloneGroup = this.showButtons.cloneGroup;
6770
6780
  groupID = groupID.replace(this.element.id + '_', '');
6771
6781
  this.groupIndex = index;
6772
- this.cloneGrpBtnClick = true;
6782
+ this.cloneGrpBtnClick = this.groupCloned = true;
6773
6783
  this.showButtons.cloneGroup = true;
6774
6784
  this.addGroups([{ 'condition': group.condition, 'not': group.not, 'rules': group.rules }], groupID);
6775
6785
  this.groupIndex = -1;
6776
6786
  this.cloneGrpBtnClick = false;
6777
6787
  this.showButtons.cloneGroup = isCloneGroup;
6778
- isCloneGroup = false;
6788
+ isCloneGroup = this.groupCloned = false;
6779
6789
  };
6780
6790
  /**
6781
6791
  * Locks the rule based on the rule ID.
@@ -7324,6 +7334,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
7324
7334
  this.groupIndex = Array.prototype.indexOf.call(target.closest('.e-rule-list').children, target.closest('.e-group-container'));
7325
7335
  this.addGroups([{ 'condition': group.condition, 'not': group.not, 'rules': group.rules }], groupId);
7326
7336
  this.groupIndex = -1;
7337
+ this.groupCloned = false;
7327
7338
  };
7328
7339
  QueryBuilder.prototype.ruleClone = function (target) {
7329
7340
  var ruleElem = closest(target, '.e-rule-container');