@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.
@@ -162,6 +162,7 @@ let QueryBuilder = class QueryBuilder extends Component {
162
162
  this.isValueEmpty = false;
163
163
  this.isPropChange = false;
164
164
  this.isRuleClicked = false;
165
+ this.groupCloned = false;
165
166
  MultiSelect.Inject(CheckBoxSelection);
166
167
  }
167
168
  getPersistData() {
@@ -530,7 +531,7 @@ let QueryBuilder = class QueryBuilder extends Component {
530
531
  break;
531
532
  case target.className.indexOf('e-clone-grp-btn') > -1:
532
533
  this.actionButton = target;
533
- this.cloneGrpBtnClick = true;
534
+ this.cloneGrpBtnClick = this.groupCloned = true;
534
535
  this.isRuleClicked = true;
535
536
  this.groupClone(closest(target, '.e-group-container'));
536
537
  break;
@@ -4140,6 +4141,7 @@ let QueryBuilder = class QueryBuilder extends Component {
4140
4141
  if (this.isAddSuccess || this.element.querySelectorAll('.e-group-container').length <= this.maxGroupCount) {
4141
4142
  groupID = this.element.id + '_' + groupID;
4142
4143
  const groupElem = document.getElementById(groupID);
4144
+ const temp = this.groupIndex;
4143
4145
  const rule = this.getParentGroup(groupElem);
4144
4146
  const grouplen = groups.length;
4145
4147
  if (grouplen) {
@@ -4162,6 +4164,11 @@ let QueryBuilder = class QueryBuilder extends Component {
4162
4164
  not = this.updatedRule.not;
4163
4165
  isLocked = this.updatedRule.isLocked;
4164
4166
  }
4167
+ if (this.groupCloned) {
4168
+ const parent = this.element.querySelector('#' + groupID);
4169
+ const topLevelGroups = parent.querySelectorAll(':scope > .e-group-body > .e-rule-list > .e-group-container');
4170
+ this.groupIndex = topLevelGroups.length > 1 ? topLevelGroups.length - 1 : 0;
4171
+ }
4165
4172
  if (this.groupIndex < 0) {
4166
4173
  if (this.enableNotCondition) {
4167
4174
  rule.rules.push({ 'condition': condition, 'not': not, rules: [] });
@@ -4178,6 +4185,9 @@ let QueryBuilder = class QueryBuilder extends Component {
4178
4185
  rule.rules.splice(this.groupIndex + 1, 0, { condition: condition, rules: [], isLocked: isLocked });
4179
4186
  }
4180
4187
  }
4188
+ if (this.groupCloned) {
4189
+ this.groupIndex = temp;
4190
+ }
4181
4191
  }
4182
4192
  if (!this.headerTemplate) {
4183
4193
  this.disableRuleCondition(groupElem, rule, null, this.enableSeparateConnector ? true : null);
@@ -6692,13 +6702,13 @@ let QueryBuilder = class QueryBuilder extends Component {
6692
6702
  let isCloneGroup = this.showButtons.cloneGroup;
6693
6703
  groupID = groupID.replace(this.element.id + '_', '');
6694
6704
  this.groupIndex = index;
6695
- this.cloneGrpBtnClick = true;
6705
+ this.cloneGrpBtnClick = this.groupCloned = true;
6696
6706
  this.showButtons.cloneGroup = true;
6697
6707
  this.addGroups([{ 'condition': group.condition, 'not': group.not, 'rules': group.rules }], groupID);
6698
6708
  this.groupIndex = -1;
6699
6709
  this.cloneGrpBtnClick = false;
6700
6710
  this.showButtons.cloneGroup = isCloneGroup;
6701
- isCloneGroup = false;
6711
+ isCloneGroup = this.groupCloned = false;
6702
6712
  }
6703
6713
  /**
6704
6714
  * Locks the rule based on the rule ID.
@@ -7247,6 +7257,7 @@ let QueryBuilder = class QueryBuilder extends Component {
7247
7257
  this.groupIndex = Array.prototype.indexOf.call(target.closest('.e-rule-list').children, target.closest('.e-group-container'));
7248
7258
  this.addGroups([{ 'condition': group.condition, 'not': group.not, 'rules': group.rules }], groupId);
7249
7259
  this.groupIndex = -1;
7260
+ this.groupCloned = false;
7250
7261
  }
7251
7262
  ruleClone(target) {
7252
7263
  const ruleElem = closest(target, '.e-rule-container');