@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.
- package/CHANGELOG.md +31 -0
- package/dist/ej2-querybuilder.min.js +2 -2
- package/dist/ej2-querybuilder.umd.min.js +2 -2
- package/dist/ej2-querybuilder.umd.min.js.map +1 -1
- package/dist/es6/ej2-querybuilder.es2015.js +90 -10
- package/dist/es6/ej2-querybuilder.es2015.js.map +1 -1
- package/dist/es6/ej2-querybuilder.es5.js +90 -10
- package/dist/es6/ej2-querybuilder.es5.js.map +1 -1
- package/dist/global/ej2-querybuilder.min.js +2 -2
- package/dist/global/ej2-querybuilder.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +11 -11
- package/src/query-builder/query-builder-model.d.ts +1 -1
- package/src/query-builder/query-builder.d.ts +5 -1
- package/src/query-builder/query-builder.js +90 -10
|
@@ -90,7 +90,7 @@ __decorate([
|
|
|
90
90
|
Property(false)
|
|
91
91
|
], Rule.prototype, "not", void 0);
|
|
92
92
|
__decorate([
|
|
93
|
-
Property(
|
|
93
|
+
Property(null)
|
|
94
94
|
], Rule.prototype, "isLocked", void 0);
|
|
95
95
|
/**
|
|
96
96
|
* Defines the property for value.
|
|
@@ -1440,12 +1440,22 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
1440
1440
|
changeValue(i, args) {
|
|
1441
1441
|
let element;
|
|
1442
1442
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1443
|
+
if (this.isNumInput && typeof args.value === 'number') {
|
|
1444
|
+
this.isNumInput = false;
|
|
1445
|
+
return;
|
|
1446
|
+
}
|
|
1447
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1443
1448
|
if (args.element && args.element.classList.contains('e-multiselect')) {
|
|
1444
1449
|
const multiSelectArgs = args;
|
|
1445
1450
|
element = multiSelectArgs.element;
|
|
1446
1451
|
}
|
|
1447
1452
|
else if (args.event) {
|
|
1448
1453
|
element = args.event.target;
|
|
1454
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1455
|
+
}
|
|
1456
|
+
else if (args.type === 'input' && args.currentTarget) {
|
|
1457
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1458
|
+
element = args.currentTarget;
|
|
1449
1459
|
}
|
|
1450
1460
|
else {
|
|
1451
1461
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1502,6 +1512,14 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
1502
1512
|
}
|
|
1503
1513
|
else {
|
|
1504
1514
|
value = args.value;
|
|
1515
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1516
|
+
if (args.type === 'input' && args.currentTarget) {
|
|
1517
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1518
|
+
value = Number(args.currentTarget.value);
|
|
1519
|
+
const numericTextBoxObj = getInstance(args.currentTarget, NumericTextBox);
|
|
1520
|
+
numericTextBoxObj.value = value;
|
|
1521
|
+
this.isNumInput = true;
|
|
1522
|
+
}
|
|
1505
1523
|
}
|
|
1506
1524
|
if (args.name === 'input' && this.immediateModeDelay) {
|
|
1507
1525
|
window.clearInterval(this.timer);
|
|
@@ -2343,6 +2361,7 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
2343
2361
|
const numeric = new NumericTextBox(numericTxt);
|
|
2344
2362
|
numeric.appendTo('#' + parentId + '_valuekey' + idx);
|
|
2345
2363
|
numeric.element.setAttribute('aria-label', itemData.label + ' ' + 'Value');
|
|
2364
|
+
numeric.element.oninput = this.changeValue.bind(this, idx);
|
|
2346
2365
|
}
|
|
2347
2366
|
}
|
|
2348
2367
|
processValueString(value, type) {
|
|
@@ -3154,7 +3173,7 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
3154
3173
|
if (this.portals && this.portals.length) {
|
|
3155
3174
|
this.clearQBTemplate();
|
|
3156
3175
|
}
|
|
3157
|
-
popupElement = document.querySelectorAll('.qb-dropdownlist');
|
|
3176
|
+
popupElement = document.querySelectorAll('.qb-dropdownlist.e-popup');
|
|
3158
3177
|
if (popupElement) {
|
|
3159
3178
|
for (i = 0; i < popupElement.length; i++) {
|
|
3160
3179
|
popupElement[i].remove();
|
|
@@ -3992,7 +4011,9 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
3992
4011
|
const ruleCondtion = currentRule.condition;
|
|
3993
4012
|
const notCondition = currentRule.not;
|
|
3994
4013
|
const ruleColl = extend([], currentRule.rules, [], true);
|
|
3995
|
-
const rule =
|
|
4014
|
+
const rule = !isNullOrUndefined(currentRule.isLocked) ?
|
|
4015
|
+
this.getRuleCollection({ condition: ruleCondtion, rules: ruleColl, not: notCondition, isLocked: currentRule.isLocked }, true) :
|
|
4016
|
+
this.getRuleCollection({ condition: ruleCondtion, rules: ruleColl, not: notCondition }, true);
|
|
3996
4017
|
return rule;
|
|
3997
4018
|
}
|
|
3998
4019
|
getRuleCollection(rule, isValidRule) {
|
|
@@ -4025,10 +4046,11 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
4025
4046
|
if ((this.isRefreshed && this.enablePersistence) || (rule.field !== '' && rule.operator !== '' && (rule.value !== '' &&
|
|
4026
4047
|
rule.value !== undefined)) || (customObj && customObj.isQuestion)) {
|
|
4027
4048
|
const condition = rule.condition;
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4049
|
+
const lockedRule = rule.isLocked;
|
|
4050
|
+
rule = { 'label': rule.label, 'field': rule.field, 'operator': rule.operator, 'type': rule.type, 'value': rule.value };
|
|
4051
|
+
if (!isNullOrUndefined(lockedRule)) {
|
|
4052
|
+
rule.isLocked = lockedRule;
|
|
4053
|
+
}
|
|
4032
4054
|
if (condition) {
|
|
4033
4055
|
rule.condition = condition;
|
|
4034
4056
|
}
|
|
@@ -4061,11 +4083,15 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
4061
4083
|
rule = {};
|
|
4062
4084
|
}
|
|
4063
4085
|
else {
|
|
4086
|
+
const isLocked = rule.isLocked;
|
|
4064
4087
|
if (this.enableNotCondition) {
|
|
4065
|
-
rule = { 'condition': rule.condition, 'rules': rule.rules, 'not': rule.not
|
|
4088
|
+
rule = { 'condition': rule.condition, 'rules': rule.rules, 'not': rule.not };
|
|
4066
4089
|
}
|
|
4067
4090
|
else {
|
|
4068
|
-
rule = { 'condition': rule.condition, 'rules': rule.rules
|
|
4091
|
+
rule = { 'condition': rule.condition, 'rules': rule.rules };
|
|
4092
|
+
}
|
|
4093
|
+
if (!isNullOrUndefined(isLocked)) {
|
|
4094
|
+
rule.isLocked = isLocked;
|
|
4069
4095
|
}
|
|
4070
4096
|
if (customObj) {
|
|
4071
4097
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -4106,6 +4132,9 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
4106
4132
|
else {
|
|
4107
4133
|
rule = { condition: this.rule.condition, rules: this.rule.rules };
|
|
4108
4134
|
}
|
|
4135
|
+
if (!isNullOrUndefined(this.rule.isLocked)) {
|
|
4136
|
+
rule.isLocked = this.rule.isLocked;
|
|
4137
|
+
}
|
|
4109
4138
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4110
4139
|
if (this.rule.custom) {
|
|
4111
4140
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -5238,6 +5267,11 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
5238
5267
|
}
|
|
5239
5268
|
}
|
|
5240
5269
|
}
|
|
5270
|
+
else if (sqlString[matchValue.length] && (sqlString[matchValue.length] !== ')') &&
|
|
5271
|
+
!this.checkCondition(sqlString, matchValue)) {
|
|
5272
|
+
matchValue = this.getSingleQuoteString(sqlString, matchValue);
|
|
5273
|
+
}
|
|
5274
|
+
// end
|
|
5241
5275
|
this.parser.push(['String', matchValue]);
|
|
5242
5276
|
return matchValue.length;
|
|
5243
5277
|
}
|
|
@@ -5267,6 +5301,27 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
5267
5301
|
}
|
|
5268
5302
|
return 1;
|
|
5269
5303
|
}
|
|
5304
|
+
checkCondition(sqlString, matchValue) {
|
|
5305
|
+
if (sqlString.slice(matchValue.length + 1, matchValue.length + 4) === 'AND' ||
|
|
5306
|
+
sqlString.slice(matchValue.length + 1, matchValue.length + 3) === 'OR') {
|
|
5307
|
+
return true;
|
|
5308
|
+
}
|
|
5309
|
+
return false;
|
|
5310
|
+
}
|
|
5311
|
+
getSingleQuoteString(sqlString, matchValue) {
|
|
5312
|
+
if (sqlString[matchValue.length] && (sqlString[matchValue.length] !== ')') &&
|
|
5313
|
+
!this.checkCondition(sqlString, matchValue) && sqlString[matchValue.length] !== ',') {
|
|
5314
|
+
const tempStr = sqlString.replace(matchValue, '');
|
|
5315
|
+
// eslint-disable-next-line
|
|
5316
|
+
if (isNullOrUndefined(/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(tempStr))) {
|
|
5317
|
+
// eslint-disable-next-line
|
|
5318
|
+
let parsedValue = /^((?:[^\\']+?|\\.|'')*)'(?!')/.exec(tempStr)[0];
|
|
5319
|
+
matchValue += parsedValue;
|
|
5320
|
+
matchValue = this.getSingleQuoteString(sqlString, matchValue);
|
|
5321
|
+
}
|
|
5322
|
+
}
|
|
5323
|
+
return matchValue;
|
|
5324
|
+
}
|
|
5270
5325
|
checkLiteral() {
|
|
5271
5326
|
const lastParser = this.parser[this.parser.length - 1];
|
|
5272
5327
|
if (!lastParser) {
|
|
@@ -5522,7 +5577,11 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
5522
5577
|
}
|
|
5523
5578
|
else {
|
|
5524
5579
|
rule.type = 'string';
|
|
5525
|
-
|
|
5580
|
+
let val = parser[i + 2][1];
|
|
5581
|
+
if (val && val[0] === '\'') {
|
|
5582
|
+
val = val.substring(1, val.length - 1);
|
|
5583
|
+
}
|
|
5584
|
+
rule.value = val;
|
|
5526
5585
|
}
|
|
5527
5586
|
rule.type = this.getTypeFromColumn(rule);
|
|
5528
5587
|
}
|
|
@@ -5572,6 +5631,27 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
5572
5631
|
}
|
|
5573
5632
|
return rules;
|
|
5574
5633
|
}
|
|
5634
|
+
getValueFromParser(parser, idx) {
|
|
5635
|
+
let value = '';
|
|
5636
|
+
let k;
|
|
5637
|
+
for (k = idx; k < parser.length; k++) {
|
|
5638
|
+
if (parser[k][0] !== 'String' || parser[k][1] === ',' || parser[k][1] === ', ') {
|
|
5639
|
+
break;
|
|
5640
|
+
}
|
|
5641
|
+
else {
|
|
5642
|
+
if (value !== '') {
|
|
5643
|
+
idx += 1;
|
|
5644
|
+
}
|
|
5645
|
+
if (parser[k][1] !== null) {
|
|
5646
|
+
value += parser[k][1];
|
|
5647
|
+
}
|
|
5648
|
+
else {
|
|
5649
|
+
value = null;
|
|
5650
|
+
}
|
|
5651
|
+
}
|
|
5652
|
+
}
|
|
5653
|
+
return { value: value, idx: idx };
|
|
5654
|
+
}
|
|
5575
5655
|
/**
|
|
5576
5656
|
* Clone the Group
|
|
5577
5657
|
*
|