@syncfusion/ej2-querybuilder 25.1.42 → 25.2.4

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.
@@ -122,7 +122,7 @@ var Rule = /** @__PURE__ @class */ (function (_super) {
122
122
  Property(false)
123
123
  ], Rule.prototype, "not", void 0);
124
124
  __decorate([
125
- Property(false)
125
+ Property(null)
126
126
  ], Rule.prototype, "isLocked", void 0);
127
127
  return Rule;
128
128
  }(ChildProperty));
@@ -1494,12 +1494,22 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
1494
1494
  var _this = this;
1495
1495
  var element;
1496
1496
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1497
+ if (this.isNumInput && typeof args.value === 'number') {
1498
+ this.isNumInput = false;
1499
+ return;
1500
+ }
1501
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1497
1502
  if (args.element && args.element.classList.contains('e-multiselect')) {
1498
1503
  var multiSelectArgs = args;
1499
1504
  element = multiSelectArgs.element;
1500
1505
  }
1501
1506
  else if (args.event) {
1502
1507
  element = args.event.target;
1508
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1509
+ }
1510
+ else if (args.type === 'input' && args.currentTarget) {
1511
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1512
+ element = args.currentTarget;
1503
1513
  }
1504
1514
  else {
1505
1515
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1556,6 +1566,14 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
1556
1566
  }
1557
1567
  else {
1558
1568
  value = args.value;
1569
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1570
+ if (args.type === 'input' && args.currentTarget) {
1571
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1572
+ value = Number(args.currentTarget.value);
1573
+ var numericTextBoxObj = getInstance(args.currentTarget, NumericTextBox);
1574
+ numericTextBoxObj.value = value;
1575
+ this.isNumInput = true;
1576
+ }
1559
1577
  }
1560
1578
  if (args.name === 'input' && this.immediateModeDelay) {
1561
1579
  window.clearInterval(this.timer);
@@ -2405,6 +2423,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
2405
2423
  var numeric = new NumericTextBox(numericTxt);
2406
2424
  numeric.appendTo('#' + parentId + '_valuekey' + idx);
2407
2425
  numeric.element.setAttribute('aria-label', itemData.label + ' ' + 'Value');
2426
+ numeric.element.oninput = this.changeValue.bind(this, idx);
2408
2427
  }
2409
2428
  };
2410
2429
  QueryBuilder.prototype.processValueString = function (value, type) {
@@ -3217,7 +3236,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
3217
3236
  if (this.portals && this.portals.length) {
3218
3237
  this.clearQBTemplate();
3219
3238
  }
3220
- popupElement = document.querySelectorAll('.qb-dropdownlist');
3239
+ popupElement = document.querySelectorAll('.qb-dropdownlist.e-popup');
3221
3240
  if (popupElement) {
3222
3241
  for (i = 0; i < popupElement.length; i++) {
3223
3242
  popupElement[i].remove();
@@ -4059,7 +4078,9 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
4059
4078
  var ruleCondtion = currentRule.condition;
4060
4079
  var notCondition = currentRule.not;
4061
4080
  var ruleColl = extend([], currentRule.rules, [], true);
4062
- var rule = this.getRuleCollection({ condition: ruleCondtion, rules: ruleColl, not: notCondition }, true);
4081
+ var rule = !isNullOrUndefined(currentRule.isLocked) ?
4082
+ this.getRuleCollection({ condition: ruleCondtion, rules: ruleColl, not: notCondition, isLocked: currentRule.isLocked }, true) :
4083
+ this.getRuleCollection({ condition: ruleCondtion, rules: ruleColl, not: notCondition }, true);
4063
4084
  return rule;
4064
4085
  };
4065
4086
  QueryBuilder.prototype.getRuleCollection = function (rule, isValidRule) {
@@ -4092,10 +4113,11 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
4092
4113
  if ((this.isRefreshed && this.enablePersistence) || (rule.field !== '' && rule.operator !== '' && (rule.value !== '' &&
4093
4114
  rule.value !== undefined)) || (customObj && customObj.isQuestion)) {
4094
4115
  var condition = rule.condition;
4095
- rule = {
4096
- 'label': rule.label, 'field': rule.field, 'operator': rule.operator, 'type': rule.type, 'value': rule.value,
4097
- 'isLocked': rule.isLocked
4098
- };
4116
+ var lockedRule = rule.isLocked;
4117
+ rule = { 'label': rule.label, 'field': rule.field, 'operator': rule.operator, 'type': rule.type, 'value': rule.value };
4118
+ if (!isNullOrUndefined(lockedRule)) {
4119
+ rule.isLocked = lockedRule;
4120
+ }
4099
4121
  if (condition) {
4100
4122
  rule.condition = condition;
4101
4123
  }
@@ -4128,11 +4150,15 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
4128
4150
  rule = {};
4129
4151
  }
4130
4152
  else {
4153
+ var isLocked = rule.isLocked;
4131
4154
  if (this.enableNotCondition) {
4132
- rule = { 'condition': rule.condition, 'rules': rule.rules, 'not': rule.not, 'isLocked': rule.isLocked };
4155
+ rule = { 'condition': rule.condition, 'rules': rule.rules, 'not': rule.not };
4133
4156
  }
4134
4157
  else {
4135
- rule = { 'condition': rule.condition, 'rules': rule.rules, 'isLocked': rule.isLocked };
4158
+ rule = { 'condition': rule.condition, 'rules': rule.rules };
4159
+ }
4160
+ if (!isNullOrUndefined(isLocked)) {
4161
+ rule.isLocked = isLocked;
4136
4162
  }
4137
4163
  if (customObj) {
4138
4164
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -4173,6 +4199,9 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
4173
4199
  else {
4174
4200
  rule = { condition: this.rule.condition, rules: this.rule.rules };
4175
4201
  }
4202
+ if (!isNullOrUndefined(this.rule.isLocked)) {
4203
+ rule.isLocked = this.rule.isLocked;
4204
+ }
4176
4205
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4177
4206
  if (this.rule.custom) {
4178
4207
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -5306,6 +5335,11 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5306
5335
  }
5307
5336
  }
5308
5337
  }
5338
+ else if (sqlString[matchValue.length] && (sqlString[matchValue.length] !== ')') &&
5339
+ !this.checkCondition(sqlString, matchValue)) {
5340
+ matchValue = this.getSingleQuoteString(sqlString, matchValue);
5341
+ }
5342
+ // end
5309
5343
  this.parser.push(['String', matchValue]);
5310
5344
  return matchValue.length;
5311
5345
  }
@@ -5335,6 +5369,27 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5335
5369
  }
5336
5370
  return 1;
5337
5371
  };
5372
+ QueryBuilder.prototype.checkCondition = function (sqlString, matchValue) {
5373
+ if (sqlString.slice(matchValue.length + 1, matchValue.length + 4) === 'AND' ||
5374
+ sqlString.slice(matchValue.length + 1, matchValue.length + 3) === 'OR') {
5375
+ return true;
5376
+ }
5377
+ return false;
5378
+ };
5379
+ QueryBuilder.prototype.getSingleQuoteString = function (sqlString, matchValue) {
5380
+ if (sqlString[matchValue.length] && (sqlString[matchValue.length] !== ')') &&
5381
+ !this.checkCondition(sqlString, matchValue) && sqlString[matchValue.length] !== ',') {
5382
+ var tempStr = sqlString.replace(matchValue, '');
5383
+ // eslint-disable-next-line
5384
+ if (isNullOrUndefined(/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(tempStr))) {
5385
+ // eslint-disable-next-line
5386
+ var parsedValue = /^((?:[^\\']+?|\\.|'')*)'(?!')/.exec(tempStr)[0];
5387
+ matchValue += parsedValue;
5388
+ matchValue = this.getSingleQuoteString(sqlString, matchValue);
5389
+ }
5390
+ }
5391
+ return matchValue;
5392
+ };
5338
5393
  QueryBuilder.prototype.checkLiteral = function () {
5339
5394
  var lastParser = this.parser[this.parser.length - 1];
5340
5395
  if (!lastParser) {
@@ -5590,7 +5645,11 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5590
5645
  }
5591
5646
  else {
5592
5647
  rule.type = 'string';
5593
- rule.value = parser[i + 2][1] ? parser[i + 2][1].replace(/'/g, '') : parser[i + 2][1];
5648
+ var val = parser[i + 2][1];
5649
+ if (val && val[0] === '\'') {
5650
+ val = val.substring(1, val.length - 1);
5651
+ }
5652
+ rule.value = val;
5594
5653
  }
5595
5654
  rule.type = this.getTypeFromColumn(rule);
5596
5655
  }
@@ -5640,6 +5699,27 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5640
5699
  }
5641
5700
  return rules;
5642
5701
  };
5702
+ QueryBuilder.prototype.getValueFromParser = function (parser, idx) {
5703
+ var value = '';
5704
+ var k;
5705
+ for (k = idx; k < parser.length; k++) {
5706
+ if (parser[k][0] !== 'String' || parser[k][1] === ',' || parser[k][1] === ', ') {
5707
+ break;
5708
+ }
5709
+ else {
5710
+ if (value !== '') {
5711
+ idx += 1;
5712
+ }
5713
+ if (parser[k][1] !== null) {
5714
+ value += parser[k][1];
5715
+ }
5716
+ else {
5717
+ value = null;
5718
+ }
5719
+ }
5720
+ }
5721
+ return { value: value, idx: idx };
5722
+ };
5643
5723
  /**
5644
5724
  * Clone the Group
5645
5725
  *