@syncfusion/ej2-querybuilder 19.4.47 → 19.4.48

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.
@@ -680,12 +680,19 @@ let QueryBuilder = class QueryBuilder extends Component {
680
680
  else {
681
681
  groupElem = closest(target, '.e-group-container');
682
682
  rules = this.getParentGroup(groupElem);
683
+ const custom = rule.custom;
683
684
  if (Object.keys(rule).length) {
684
685
  rules.rules.push({
685
686
  'field': rule.field, 'type': rule.type, 'label': rule.label, 'operator': rule.operator, value: rule.value
686
687
  });
688
+ if (custom) {
689
+ rules.rules[rules.rules.length - 1].custom = custom;
690
+ }
687
691
  }
688
692
  else {
693
+ if (custom) {
694
+ newRule.custom = custom;
695
+ }
689
696
  rules.rules.push(newRule);
690
697
  }
691
698
  }
@@ -1303,6 +1310,7 @@ let QueryBuilder = class QueryBuilder extends Component {
1303
1310
  ruleElem = ruleElem.previousElementSibling;
1304
1311
  index++;
1305
1312
  }
1313
+ rules.rules[index].value = '';
1306
1314
  this.changeRule(rules.rules[index], args);
1307
1315
  }
1308
1316
  }
@@ -1390,6 +1398,9 @@ let QueryBuilder = class QueryBuilder extends Component {
1390
1398
  getComponent(tooltipElem[i], 'tooltip').destroy();
1391
1399
  }
1392
1400
  if (!args.cancel) {
1401
+ if (this.selectedColumn === null) {
1402
+ return;
1403
+ }
1393
1404
  tempRule.type = this.selectedColumn.type;
1394
1405
  if (ruleElem.querySelector('.e-template')) {
1395
1406
  rule.value = '';
@@ -3385,7 +3396,11 @@ let QueryBuilder = class QueryBuilder extends Component {
3385
3396
  }
3386
3397
  }
3387
3398
  const isTemplateRendered = clnruleElem.querySelector('.e-template-value');
3388
- detach(clnruleElem);
3399
+ try {
3400
+ detach(clnruleElem);
3401
+ }
3402
+ catch (err) {
3403
+ }
3389
3404
  if (column && column.ruleTemplate) {
3390
3405
  this.clearQBTemplate([clnruleElem.id]);
3391
3406
  }
@@ -3505,10 +3520,14 @@ let QueryBuilder = class QueryBuilder extends Component {
3505
3520
  }
3506
3521
  }
3507
3522
  if ((this.isRefreshed && this.enablePersistence) || (this.rule.field !== '' && rule.operator !== '' && (rule.value !== '' &&
3508
- rule.value !== undefined))) {
3523
+ rule.value !== undefined)) || (customObj && customObj.isQuestion)) {
3524
+ const condition = rule.condition;
3509
3525
  rule = {
3510
3526
  'label': rule.label, 'field': rule.field, 'operator': rule.operator, 'type': rule.type, 'value': rule.value
3511
3527
  };
3528
+ if (condition) {
3529
+ rule.condition = condition;
3530
+ }
3512
3531
  if (customObj) {
3513
3532
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3514
3533
  rule.custom = customObj;
@@ -3817,6 +3836,12 @@ let QueryBuilder = class QueryBuilder extends Component {
3817
3836
  break;
3818
3837
  }
3819
3838
  }
3839
+ else if (field.indexOf(this.separator) > -1) {
3840
+ if (columns[i].field === field.split(this.separator)[0]) {
3841
+ column = columns[i];
3842
+ break;
3843
+ }
3844
+ }
3820
3845
  }
3821
3846
  return column;
3822
3847
  }
@@ -3906,7 +3931,7 @@ let QueryBuilder = class QueryBuilder extends Component {
3906
3931
  }
3907
3932
  if (!(operator.indexOf('null') > -1 || operator.indexOf('empty') > -1)) {
3908
3933
  for (let j = 0, jLen = value.length; j < jLen; j++) {
3909
- if (value[j] !== '') {
3934
+ if (value[j] !== '' || ((operator === 'in' || operator === 'notin') && column.type === 'string')) {
3910
3935
  if (j === 0) {
3911
3936
  const gte = 'greaterthanorequal';
3912
3937
  switch (operator) {
@@ -4205,7 +4230,7 @@ let QueryBuilder = class QueryBuilder extends Component {
4205
4230
  else {
4206
4231
  queryStr += '(';
4207
4232
  }
4208
- const condition = rules.condition;
4233
+ let condition = rules.condition;
4209
4234
  if (rules.not) {
4210
4235
  if (isRoot) {
4211
4236
  queryStr += 'NOT (';
@@ -4284,8 +4309,14 @@ let QueryBuilder = class QueryBuilder extends Component {
4284
4309
  }
4285
4310
  queryStr += rule.field + ' ' + this.operators[rule.operator] + ' ' + valueStr;
4286
4311
  }
4312
+ if (rule.condition && rule.condition != '') {
4313
+ condition = rule.condition;
4314
+ }
4287
4315
  }
4288
4316
  if (j !== jLen - 1) {
4317
+ if (condition === '') {
4318
+ condition = rules.rules[j].condition;
4319
+ }
4289
4320
  queryStr += ' ' + condition.toUpperCase() + ' ';
4290
4321
  }
4291
4322
  }