@syncfusion/ej2-querybuilder 32.2.8 → 32.2.9

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.
@@ -4288,9 +4288,18 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
4288
4288
  if (this.groupCloned && this.target instanceof HTMLElement &&
4289
4289
  this.getGroup(this.target).rules.length > 1) {
4290
4290
  var parent_1 = this.element.querySelector('#' + groupID);
4291
+ var allContainers = parent_1.querySelectorAll(':scope > .e-group-body > .e-rule-list > [class*="-container"]');
4291
4292
  var topLevelGroups = parent_1.querySelectorAll(':scope > .e-group-body > .e-rule-list > .e-group-container');
4292
- if (groupID !== 'querybuilder_group0' && !(this.isAngular && groupID === 'ej2-querybuilder_0_group0')) {
4293
- this.groupIndex = topLevelGroups.length > 1 ? topLevelGroups.length - 1 : 0;
4293
+ if (topLevelGroups.length > 0 && groupID !== 'querybuilder_group0' && !(this.isAngular && groupID === 'ej2-querybuilder_0_group0')) {
4294
+ var lastGroupIndex = -1;
4295
+ var lastGroup = topLevelGroups[topLevelGroups.length - 1];
4296
+ for (var i = 0; i < allContainers.length; i++) {
4297
+ if (allContainers[i] === lastGroup) {
4298
+ lastGroupIndex = i;
4299
+ break;
4300
+ }
4301
+ }
4302
+ this.groupIndex = lastGroupIndex - 1;
4294
4303
  }
4295
4304
  }
4296
4305
  if (this.groupIndex < 0) {