@syncfusion/ej2-querybuilder 31.1.22 → 31.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/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 +67 -0
- package/dist/es6/ej2-querybuilder.es2015.js.map +1 -1
- package/dist/es6/ej2-querybuilder.es5.js +67 -0
- 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 +7 -7
- package/src/query-builder/query-builder-model.d.ts +7 -0
- package/src/query-builder/query-builder.d.ts +8 -0
- package/src/query-builder/query-builder.js +67 -0
- package/styles/bds-lite.css +1 -1
- package/styles/bds.css +1 -1
- package/styles/bootstrap-dark-lite.css +1 -1
- package/styles/bootstrap-dark.css +1 -1
- package/styles/bootstrap-lite.css +1 -1
- package/styles/bootstrap.css +1 -1
- package/styles/bootstrap4-lite.css +1 -1
- package/styles/bootstrap4.css +1 -1
- package/styles/bootstrap5-dark-lite.css +1 -1
- package/styles/bootstrap5-dark.css +1 -1
- package/styles/bootstrap5-lite.css +1 -1
- package/styles/bootstrap5.3-lite.css +1 -1
- package/styles/bootstrap5.3.css +1 -1
- package/styles/bootstrap5.css +1 -1
- package/styles/fabric-dark-lite.css +1 -1
- package/styles/fabric-dark.css +1 -1
- package/styles/fabric-lite.css +1 -1
- package/styles/fabric.css +1 -1
- package/styles/fluent-dark-lite.css +1 -1
- package/styles/fluent-dark.css +1 -1
- package/styles/fluent-lite.css +1 -1
- package/styles/fluent.css +1 -1
- package/styles/fluent2-lite.css +1 -1
- package/styles/fluent2.css +1 -1
- package/styles/highcontrast-light-lite.css +1 -1
- package/styles/highcontrast-light.css +1 -1
- package/styles/highcontrast-lite.css +1 -1
- package/styles/highcontrast.css +1 -1
- package/styles/material-dark-lite.css +1 -1
- package/styles/material-dark.css +1 -1
- package/styles/material-lite.css +1 -1
- package/styles/material.css +1 -1
- package/styles/material3-dark-lite.css +3 -3
- package/styles/material3-dark.css +3 -3
- package/styles/material3-lite.css +3 -3
- package/styles/material3.css +3 -3
- package/styles/query-builder/_bds-definition.scss +2 -0
- package/styles/query-builder/_bootstrap-dark-definition.scss +2 -2
- package/styles/query-builder/_bootstrap-definition.scss +2 -0
- package/styles/query-builder/_bootstrap4-definition.scss +2 -0
- package/styles/query-builder/_bootstrap5-definition.scss +2 -0
- package/styles/query-builder/_bootstrap5.3-definition.scss +2 -0
- package/styles/query-builder/_fabric-dark-definition.scss +2 -0
- package/styles/query-builder/_fabric-definition.scss +2 -0
- package/styles/query-builder/_fluent-definition.scss +2 -0
- package/styles/query-builder/_fluent2-definition.scss +2 -0
- package/styles/query-builder/_fusionnew-definition.scss +2 -0
- package/styles/query-builder/_highcontrast-definition.scss +2 -0
- package/styles/query-builder/_highcontrast-light-definition.scss +2 -0
- package/styles/query-builder/_material-dark-definition.scss +2 -0
- package/styles/query-builder/_material-definition.scss +2 -0
- package/styles/query-builder/_material3-definition.scss +2 -0
- package/styles/query-builder/_tailwind-definition.scss +2 -0
- package/styles/query-builder/_tailwind3-definition.scss +2 -0
- package/styles/query-builder/_theme.scss +3 -3
- package/styles/query-builder/bds.css +1 -1
- package/styles/query-builder/bootstrap-dark.css +1 -1
- package/styles/query-builder/bootstrap.css +1 -1
- package/styles/query-builder/bootstrap4.css +1 -1
- package/styles/query-builder/bootstrap5-dark.css +1 -1
- package/styles/query-builder/bootstrap5.3.css +1 -1
- package/styles/query-builder/bootstrap5.css +1 -1
- package/styles/query-builder/fabric-dark.css +1 -1
- package/styles/query-builder/fabric.css +1 -1
- package/styles/query-builder/fluent-dark.css +1 -1
- package/styles/query-builder/fluent.css +1 -1
- package/styles/query-builder/fluent2.css +1 -1
- package/styles/query-builder/highcontrast-light.css +1 -1
- package/styles/query-builder/highcontrast.css +1 -1
- package/styles/query-builder/material-dark.css +1 -1
- package/styles/query-builder/material.css +1 -1
- package/styles/query-builder/material3-dark.css +3 -3
- package/styles/query-builder/material3.css +3 -3
- package/styles/query-builder/tailwind-dark.css +1 -1
- package/styles/query-builder/tailwind.css +1 -1
- package/styles/query-builder/tailwind3.css +1 -1
- package/styles/tailwind-dark-lite.css +1 -1
- package/styles/tailwind-dark.css +1 -1
- package/styles/tailwind-lite.css +1 -1
- package/styles/tailwind.css +1 -1
- package/styles/tailwind3-lite.css +1 -1
- package/styles/tailwind3.css +1 -1
|
@@ -161,6 +161,7 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
161
161
|
this.cloneRuleBtnClick = false;
|
|
162
162
|
this.isValueEmpty = false;
|
|
163
163
|
this.isPropChange = false;
|
|
164
|
+
this.isRuleClicked = false;
|
|
164
165
|
MultiSelect.Inject(CheckBoxSelection);
|
|
165
166
|
}
|
|
166
167
|
getPersistData() {
|
|
@@ -516,6 +517,7 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
516
517
|
case target.className.indexOf('e-clone-rule-btn') > -1:
|
|
517
518
|
this.actionButton = target;
|
|
518
519
|
this.cloneRuleBtnClick = true;
|
|
520
|
+
this.isRuleClicked = true;
|
|
519
521
|
this.ruleClone(target);
|
|
520
522
|
break;
|
|
521
523
|
case target.className.indexOf('e-lock-rule-btn') > -1:
|
|
@@ -529,6 +531,7 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
529
531
|
case target.className.indexOf('e-clone-grp-btn') > -1:
|
|
530
532
|
this.actionButton = target;
|
|
531
533
|
this.cloneGrpBtnClick = true;
|
|
534
|
+
this.isRuleClicked = true;
|
|
532
535
|
this.groupClone(closest(target, '.e-group-container'));
|
|
533
536
|
break;
|
|
534
537
|
case target.className.indexOf('e-deletegroup') > -1:
|
|
@@ -688,9 +691,11 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
688
691
|
}
|
|
689
692
|
}
|
|
690
693
|
else if (event.element.children[0].className.indexOf('e-addrule') > -1) {
|
|
694
|
+
this.isRuleClicked = true;
|
|
691
695
|
this.addRuleElement(closest(target, '.e-group-container'), {});
|
|
692
696
|
}
|
|
693
697
|
else if (event.element.children[0].className.indexOf('e-addgroup') > -1) {
|
|
698
|
+
this.isRuleClicked = true;
|
|
694
699
|
this.addGroupElement(true, closest(target, '.e-group-container'), '', true);
|
|
695
700
|
}
|
|
696
701
|
}
|
|
@@ -889,6 +894,10 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
889
894
|
if (!this.isImportRules) {
|
|
890
895
|
this.updateAddedRule(trgt, rule, newRule, isRlTmp, pId, this.enableSeparateConnector ? true : null);
|
|
891
896
|
}
|
|
897
|
+
if (this.rule.condition === '' && (this.isRuleClicked || this.rule.rules.length > 1)) {
|
|
898
|
+
this.rule.condition = 'and';
|
|
899
|
+
}
|
|
900
|
+
this.isRuleClicked = false;
|
|
892
901
|
const ruleCount = this.rule.rules.length;
|
|
893
902
|
if (!column || (column && !column.ruleTemplate) || !rule.field) {
|
|
894
903
|
if (ruleCount > 20) {
|
|
@@ -2274,11 +2283,46 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
2274
2283
|
changeValueSuccessCallBack(args, element, i, groupID, ruleID) {
|
|
2275
2284
|
if (!args.cancel) {
|
|
2276
2285
|
this.updateRules(element, args.value, i);
|
|
2286
|
+
this.setSecondDateMinFromFirst(element, i);
|
|
2277
2287
|
if (!this.isImportRules) {
|
|
2278
2288
|
this.trigger('change', { groupID: groupID, ruleID: ruleID, value: args.value, cancel: false, type: 'value' });
|
|
2279
2289
|
}
|
|
2280
2290
|
}
|
|
2281
2291
|
}
|
|
2292
|
+
setSecondDateMinFromFirst(element, valueIndex) {
|
|
2293
|
+
if (valueIndex !== 0) {
|
|
2294
|
+
return;
|
|
2295
|
+
}
|
|
2296
|
+
const ruleElem = closest(element, '.e-rule-container');
|
|
2297
|
+
if (!ruleElem) {
|
|
2298
|
+
return;
|
|
2299
|
+
}
|
|
2300
|
+
const operatorDropdownElement = ruleElem.querySelector('.e-rule-operator .e-dropdownlist');
|
|
2301
|
+
if (!operatorDropdownElement) {
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
const operatorDropdown = getComponent(operatorDropdownElement, 'dropdownlist');
|
|
2305
|
+
const operatorValue = operatorDropdown && operatorDropdown.value ? operatorDropdown.value.toString().toLowerCase() : '';
|
|
2306
|
+
if (operatorValue.indexOf('between') < 0) {
|
|
2307
|
+
return;
|
|
2308
|
+
}
|
|
2309
|
+
const firstDateElement = document.getElementById(ruleElem.id + '_valuekey0');
|
|
2310
|
+
const secondDateElement = document.getElementById(ruleElem.id + '_valuekey1');
|
|
2311
|
+
if (!firstDateElement || !secondDateElement) {
|
|
2312
|
+
return;
|
|
2313
|
+
}
|
|
2314
|
+
const firstDatePicker = getComponent(firstDateElement, 'datepicker');
|
|
2315
|
+
const secondDatePicker = getComponent(secondDateElement, 'datepicker');
|
|
2316
|
+
if (!firstDatePicker || !secondDatePicker || !(firstDatePicker.value instanceof Date)) {
|
|
2317
|
+
return;
|
|
2318
|
+
}
|
|
2319
|
+
const nextDay = new Date(firstDatePicker.value.getTime());
|
|
2320
|
+
nextDay.setDate(nextDay.getDate() + 1);
|
|
2321
|
+
secondDatePicker.min = nextDay;
|
|
2322
|
+
if (secondDatePicker.value instanceof Date && secondDatePicker.value.getTime() < nextDay.getTime()) {
|
|
2323
|
+
secondDatePicker.value = nextDay;
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2282
2326
|
fieldClose(id) {
|
|
2283
2327
|
if (this.isFieldChange || this.isDestroy) {
|
|
2284
2328
|
return;
|
|
@@ -3258,6 +3302,12 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
3258
3302
|
selVal = (length > 1) ? rule.value[i] : rule.value;
|
|
3259
3303
|
selectedValue = this.parseDate(selVal, format) || new Date();
|
|
3260
3304
|
}
|
|
3305
|
+
if (!isNullOrUndefined(itemData) && itemData.value && !isTemplate) {
|
|
3306
|
+
const parsedDate = this.parseDate(itemData.value.toString(), itemData.format);
|
|
3307
|
+
if (parsedDate && !isNaN(parsedDate.getTime())) {
|
|
3308
|
+
selectedValue = parsedDate;
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3261
3311
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3262
3312
|
if (!itemData.field && !itemData.key && itemData.value) {
|
|
3263
3313
|
if (itemData.value instanceof Date) {
|
|
@@ -3299,6 +3349,19 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
3299
3349
|
value: selectedValue, locale: this.getLocale(), placeholder: place,
|
|
3300
3350
|
format: formatObj.format, change: this.changeValue.bind(this, i)
|
|
3301
3351
|
};
|
|
3352
|
+
if (!isNullOrUndefined(column) && !isNullOrUndefined(column.values) && column.values.length > 0) {
|
|
3353
|
+
const parsedDate = this.parseDate(column.values[i], format);
|
|
3354
|
+
if (!isNullOrUndefined(parsedDate) && parsedDate instanceof Date) {
|
|
3355
|
+
datePicker.value = parsedDate;
|
|
3356
|
+
if (i === 1) {
|
|
3357
|
+
const parsedMinDate = this.parseDate(column.values[0], format);
|
|
3358
|
+
if (parsedMinDate instanceof Date && !isNaN(parsedMinDate.getTime())) {
|
|
3359
|
+
parsedMinDate.setDate(parsedMinDate.getDate() + 1);
|
|
3360
|
+
datePicker.min = parsedMinDate;
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3302
3365
|
if (this.valueModel && this.valueModel.datePickerModel) {
|
|
3303
3366
|
datePicker = Object.assign({}, datePicker, this.valueModel.datePickerModel);
|
|
3304
3367
|
}
|
|
@@ -4028,6 +4091,7 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
4028
4091
|
}
|
|
4029
4092
|
classList(this.element, [], ['e-rtl', 'e-responsive', 'e-device']);
|
|
4030
4093
|
this.isDestroy = false;
|
|
4094
|
+
super.destroy();
|
|
4031
4095
|
}
|
|
4032
4096
|
/**
|
|
4033
4097
|
* Adds single or multiple rules.
|
|
@@ -7418,6 +7482,9 @@ let QueryBuilder = class QueryBuilder extends Component {
|
|
|
7418
7482
|
__decorate([
|
|
7419
7483
|
Event()
|
|
7420
7484
|
], QueryBuilder.prototype, "created", void 0);
|
|
7485
|
+
__decorate([
|
|
7486
|
+
Event()
|
|
7487
|
+
], QueryBuilder.prototype, "destroyed", void 0);
|
|
7421
7488
|
__decorate([
|
|
7422
7489
|
Event()
|
|
7423
7490
|
], QueryBuilder.prototype, "actionBegin", void 0);
|