@syncfusion/ej2-querybuilder 33.1.44 → 33.1.49

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.
@@ -4132,31 +4132,33 @@ let QueryBuilder = class QueryBuilder extends Component {
4132
4132
  if (this.portals && this.portals.length) {
4133
4133
  this.clearQBTemplate();
4134
4134
  }
4135
- let qbDdlElems = this.element.querySelectorAll('.qb-dropdownlist');
4136
- if (!qbDdlElems || qbDdlElems.length === 0) {
4137
- qbDdlElems = document.querySelectorAll('.qb-dropdownlist');
4138
- }
4139
- for (i = 0; i < qbDdlElems.length; i++) {
4140
- const ddlElem = qbDdlElems[i];
4141
- const targetInput = ddlElem.tagName === 'INPUT' ? ddlElem : ddlElem.querySelector('input');
4142
- if (targetInput) {
4143
- const ddlInst = getComponent(targetInput, 'dropdownlist');
4144
- if (ddlInst) {
4145
- if (ddlInst.close) {
4146
- ddlInst.close = null;
4147
- }
4148
- if (ddlInst.open) {
4149
- ddlInst.open = null;
4150
- }
4151
- if (ddlInst.change) {
4152
- ddlInst.change = null;
4135
+ const qbDdlElems = this.element.querySelectorAll('.qb-dropdownlist');
4136
+ if (qbDdlElems && qbDdlElems.length > 0) {
4137
+ for (i = 0; i < qbDdlElems.length; i++) {
4138
+ const ddlElem = qbDdlElems[i];
4139
+ if (this.element.contains(ddlElem)) {
4140
+ const targetInput = ddlElem.tagName === 'INPUT' ? ddlElem : ddlElem.querySelector('input');
4141
+ if (targetInput) {
4142
+ const ddlInst = getComponent(targetInput, 'dropdownlist');
4143
+ if (ddlInst) {
4144
+ if (ddlInst.close) {
4145
+ ddlInst.close = null;
4146
+ }
4147
+ if (ddlInst.open) {
4148
+ ddlInst.open = null;
4149
+ }
4150
+ if (ddlInst.change) {
4151
+ ddlInst.change = null;
4152
+ }
4153
+ ddlInst.destroy();
4154
+ }
4153
4155
  }
4154
- ddlInst.destroy();
4155
4156
  }
4156
4157
  }
4157
4158
  }
4158
- const popupElement = document.querySelectorAll('.qb-dropdownlist.e-popup');
4159
- if (popupElement) {
4159
+ // Cleanup orphaned popup elements
4160
+ const popupElement = this.element.querySelectorAll('.e-popup.e-dropdownlist');
4161
+ if (popupElement && popupElement.length > 0) {
4160
4162
  for (i = 0; i < popupElement.length; i++) {
4161
4163
  popupElement[i].remove();
4162
4164
  }
@@ -4219,7 +4221,7 @@ let QueryBuilder = class QueryBuilder extends Component {
4219
4221
  const parent = this.element.querySelector('#' + groupID);
4220
4222
  const allContainers = parent.querySelectorAll(':scope > .e-group-body > .e-rule-list > [class*="-container"]');
4221
4223
  const topLevelGroups = parent.querySelectorAll(':scope > .e-group-body > .e-rule-list > .e-group-container');
4222
- if (topLevelGroups.length > 0 && groupID !== 'querybuilder_group0' && !(this.isAngular && groupID === 'ej2-querybuilder_0_group0')) {
4224
+ if (topLevelGroups.length > 0 && groupID !== 'querybuilder_group0' && !(this.isAngular && groupID === this.initialID + '_group0')) {
4223
4225
  let lastGroupIndex = -1;
4224
4226
  const lastGroup = topLevelGroups[topLevelGroups.length - 1];
4225
4227
  for (let i = 0; i < allContainers.length; i++) {
@@ -4562,6 +4564,7 @@ let QueryBuilder = class QueryBuilder extends Component {
4562
4564
  }
4563
4565
  preRender() {
4564
4566
  this.element.id = this.element.id || getUniqueID('ej2-querybuilder');
4567
+ this.initialID = this.element.id;
4565
4568
  this.defaultLocale = {
4566
4569
  StartsWith: 'Starts With',
4567
4570
  DoesNotStartWith: 'Does Not Start With',
@@ -5365,6 +5368,7 @@ let QueryBuilder = class QueryBuilder extends Component {
5365
5368
  if (this.headerTemplate && isRoot) {
5366
5369
  this.isRoot = true;
5367
5370
  }
5371
+ this.clearQBTemplate();
5368
5372
  this.reset();
5369
5373
  this.groupIdCounter = 1;
5370
5374
  this.ruleIdCounter = 0;