@syncfusion/ej2-querybuilder 31.2.12 → 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);
@@ -4634,7 +4644,13 @@ let QueryBuilder = class QueryBuilder extends Component {
4634
4644
  this.customOperators['numberOperator'] = this.customOperators['numberOperator'].concat(numberOper); // tslint:disable-line
4635
4645
  if (this.dataSource instanceof DataManager) {
4636
4646
  this.dataManager = this.dataSource;
4637
- this.executeDataManager(new Query().take(1));
4647
+ if (this.columns && this.columns.length) {
4648
+ this.dataColl = this.columns;
4649
+ this.initControl();
4650
+ }
4651
+ else {
4652
+ this.executeDataManager(new Query().take(1));
4653
+ }
4638
4654
  }
4639
4655
  else {
4640
4656
  this.dataManager = new DataManager(this.dataSource);
@@ -4657,7 +4673,8 @@ let QueryBuilder = class QueryBuilder extends Component {
4657
4673
  isReplaceDragEle: true,
4658
4674
  isPreventSelect: false,
4659
4675
  abort: '.e-parent-header',
4660
- isDragScroll: true
4676
+ isDragScroll: true,
4677
+ enableAutoScroll: true
4661
4678
  });
4662
4679
  }
4663
4680
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -6685,13 +6702,13 @@ let QueryBuilder = class QueryBuilder extends Component {
6685
6702
  let isCloneGroup = this.showButtons.cloneGroup;
6686
6703
  groupID = groupID.replace(this.element.id + '_', '');
6687
6704
  this.groupIndex = index;
6688
- this.cloneGrpBtnClick = true;
6705
+ this.cloneGrpBtnClick = this.groupCloned = true;
6689
6706
  this.showButtons.cloneGroup = true;
6690
6707
  this.addGroups([{ 'condition': group.condition, 'not': group.not, 'rules': group.rules }], groupID);
6691
6708
  this.groupIndex = -1;
6692
6709
  this.cloneGrpBtnClick = false;
6693
6710
  this.showButtons.cloneGroup = isCloneGroup;
6694
- isCloneGroup = false;
6711
+ isCloneGroup = this.groupCloned = false;
6695
6712
  }
6696
6713
  /**
6697
6714
  * Locks the rule based on the rule ID.
@@ -7240,6 +7257,7 @@ let QueryBuilder = class QueryBuilder extends Component {
7240
7257
  this.groupIndex = Array.prototype.indexOf.call(target.closest('.e-rule-list').children, target.closest('.e-group-container'));
7241
7258
  this.addGroups([{ 'condition': group.condition, 'not': group.not, 'rules': group.rules }], groupId);
7242
7259
  this.groupIndex = -1;
7260
+ this.groupCloned = false;
7243
7261
  }
7244
7262
  ruleClone(target) {
7245
7263
  const ruleElem = closest(target, '.e-rule-container');