@syncfusion/ej2-querybuilder 26.2.4 → 26.2.8

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.
@@ -1,4 +1,4 @@
1
- import { ChildProperty, Property, Collection, Component, closest, isNullOrUndefined, extend, remove, getComponent, removeClass, Animation, addClass, select, append, detach, rippleEffect, getInstance, getValue, Browser, classList, Internationalization, getUniqueID, L10n, Draggable, compile, EventHandler, cldrData, Event, Complex, NotifyPropertyChanges } from '@syncfusion/ej2-base';
1
+ import { ChildProperty, Property, Collection, Component, closest, isNullOrUndefined, extend, remove, getComponent, removeClass, Animation, addClass, select, append, detach, rippleEffect, getInstance, getValue, getNumericObject, Browser, classList, Internationalization, getUniqueID, L10n, Draggable, compile, EventHandler, cldrData, Event, Complex, NotifyPropertyChanges } from '@syncfusion/ej2-base';
2
2
  import { Button, CheckBox, RadioButton } from '@syncfusion/ej2-buttons';
3
3
  import { MultiSelect, CheckBoxSelection, DropDownList, DropDownTree } from '@syncfusion/ej2-dropdowns';
4
4
  import { Query, DataManager, Deferred, Predicate } from '@syncfusion/ej2-data';
@@ -159,6 +159,7 @@ let QueryBuilder = class QueryBuilder extends Component {
159
159
  this.cloneGrpBtnClick = false;
160
160
  this.isMiddleGroup = false;
161
161
  this.cloneRuleBtnClick = false;
162
+ this.isValueEmpty = false;
162
163
  this.dragStopHandler = (e) => {
163
164
  if (this.isDragEventPrevent) {
164
165
  return;
@@ -2232,6 +2233,11 @@ let QueryBuilder = class QueryBuilder extends Component {
2232
2233
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2233
2234
  const elem = args.currentTarget;
2234
2235
  const numericTextBoxObj = getInstance(elem, NumericTextBox);
2236
+ const decimalSeparator = getValue('decimal', getNumericObject(this.locale));
2237
+ if (isNaN(value) && elem.value.indexOf(decimalSeparator) !== -1) {
2238
+ let numberValue = parseFloat(args.currentTarget.value);
2239
+ value = numberValue;
2240
+ }
2235
2241
  numericTextBoxObj.value = value;
2236
2242
  this.isNumInput = true;
2237
2243
  }
@@ -2607,7 +2613,15 @@ let QueryBuilder = class QueryBuilder extends Component {
2607
2613
  operatorList = this.customOperators[this.selectedColumn.type + 'Operator'];
2608
2614
  }
2609
2615
  const height = (this.element.className.indexOf('e-device') > -1) ? '250px' : '200px';
2610
- let value = operatorList[0].value;
2616
+ let operator;
2617
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2618
+ operatorList.forEach((obj) => {
2619
+ if ('value' in obj && typeof obj.value === 'string' && obj.value.toLowerCase() === rule.operator.toLowerCase()) {
2620
+ operator = obj.value;
2621
+ }
2622
+ });
2623
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2624
+ let value = operator ? operator : operatorList[0].value;
2611
2625
  let ddlIdx = 0;
2612
2626
  if (!this.autoSelectOperator) {
2613
2627
  value = '';
@@ -5028,6 +5042,7 @@ let QueryBuilder = class QueryBuilder extends Component {
5028
5042
  * @returns {RuleModel} - Valid rule or rules collection
5029
5043
  */
5030
5044
  getValidRules(currentRule) {
5045
+ this.isValueEmpty = true;
5031
5046
  if (!currentRule) {
5032
5047
  currentRule = this.getRules();
5033
5048
  }
@@ -5037,6 +5052,7 @@ let QueryBuilder = class QueryBuilder extends Component {
5037
5052
  const rule = !isNullOrUndefined(currentRule.isLocked) ?
5038
5053
  this.getRuleCollection({ condition: ruleCondtion, rules: ruleColl, not: notCondition, isLocked: currentRule.isLocked }, true) :
5039
5054
  this.getRuleCollection({ condition: ruleCondtion, rules: ruleColl, not: notCondition }, true);
5055
+ this.isValueEmpty = false;
5040
5056
  return rule;
5041
5057
  }
5042
5058
  getRuleCollection(rule, isValidRule) {
@@ -5066,8 +5082,9 @@ let QueryBuilder = class QueryBuilder extends Component {
5066
5082
  rule.value = null;
5067
5083
  }
5068
5084
  }
5069
- if ((this.isRefreshed && this.enablePersistence) || (rule.field !== '' && rule.operator !== '' && (rule.value !== '' &&
5070
- rule.value !== undefined)) || (customObj && customObj.isQuestion)) {
5085
+ if ((this.isRefreshed && this.enablePersistence) || (rule.field !== '' && rule.operator !== '' &&
5086
+ (this.isValueEmpty ? rule.value !== '' && rule.value !== undefined : rule.value !== undefined)) ||
5087
+ (customObj && customObj.isQuestion)) {
5071
5088
  const condition = rule.condition;
5072
5089
  const lockedRule = rule.isLocked;
5073
5090
  rule = { 'label': rule.label, 'field': rule.field, 'operator': rule.operator, 'type': rule.type, 'value': rule.value };