@syncfusion/ej2-querybuilder 25.1.35 → 25.1.38

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.
@@ -1813,7 +1813,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
1813
1813
  this.GetRootColumnName(rule.field) === this.GetRootColumnName(this.previousColumn.field))) {
1814
1814
  var subField = this.selectedColumn.columns;
1815
1815
  for (var i = 0; i < subField.length; i++) {
1816
- if (rule.field === subField[i].field) {
1816
+ if (rule.field === subField[i].field || rule.field.indexOf(subField[i].field + this.separator) > -1) {
1817
1817
  dropDownList.value = subField[i].field;
1818
1818
  this.selectedColumn = subField[i];
1819
1819
  subFieldValue = true;
@@ -2183,17 +2183,11 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
2183
2183
  if (!this.dataColl.length && values.length) {
2184
2184
  isValues = true;
2185
2185
  }
2186
- var fieldValue = this.selectedRule.field;
2187
- var isNested = this.selectedRule.field.indexOf(this.separator);
2188
- if (isNested !== 0 && this.fieldMode !== 'DropdownTree') {
2189
- var nest = this.selectedRule.field.split(this.separator);
2190
- fieldValue = nest[nest.length - 1];
2191
- }
2192
2186
  var multiSelectValue;
2193
2187
  multiSelectValue = {
2194
2188
  dataSource: isValues ? values : (isFetched ? ds : this.dataManager),
2195
2189
  query: new Query([rule.field]),
2196
- fields: { text: fieldValue, value: fieldValue },
2190
+ fields: { text: this.selectedRule.field, value: this.selectedRule.field },
2197
2191
  placeholder: this.l10n.getConstant('SelectValue'),
2198
2192
  value: selectedValue,
2199
2193
  mode: 'CheckBox',
@@ -2324,7 +2318,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
2324
2318
  var columnData = this.getItemData(parentId);
2325
2319
  var selectedValue;
2326
2320
  var isTemplate = (typeof columnData.template === 'string');
2327
- if (this.isImportRules || this.ruleIndex > -1 || this.groupIndex > -1 || this.isPublic || isTemplate) {
2321
+ if (this.isImportRules || this.ruleIndex > -1 || this.groupIndex > -1 || this.isPublic || isTemplate || rule.value != '') {
2328
2322
  selectedValue = rule.value;
2329
2323
  }
2330
2324
  else {
@@ -2363,7 +2357,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
2363
2357
  QueryBuilder.prototype.renderNumberValue = function (parentId, rule, operator, idx, ruleValElem, itemData, length) {
2364
2358
  var columnData = this.getItemData(parentId);
2365
2359
  var isTemplate = (typeof columnData.template === 'string');
2366
- var selectedVal = (this.isImportRules || this.ruleIndex > -1 || this.groupIndex > -1 || this.isPublic || isTemplate) ? rule.value : this.setDefaultValue(parentId, false, true);
2360
+ var selectedVal = (this.isImportRules || this.ruleIndex > -1 || this.groupIndex > -1 || this.isPublic || isTemplate || typeof rule.value === 'number') ? rule.value : this.setDefaultValue(parentId, false, true);
2367
2361
  if ((operator === 'in' || operator === 'notin') && (this.dataColl.length || columnData.values)) {
2368
2362
  selectedVal = (this.isImportRules || this.ruleIndex > -1 || this.groupIndex > -1) ? rule.value : this.setDefaultValue(parentId, true, false);
2369
2363
  this.renderMultiSelect(columnData, parentId, idx, selectedVal, columnData.values);
@@ -2499,6 +2493,10 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
2499
2493
  var datePicker = void 0;
2500
2494
  var place = this.l10n.getConstant('SelectValue');
2501
2495
  var isTemplate = (typeof itemData.template === 'string');
2496
+ if (rule.value && !isNullOrUndefined(format)) {
2497
+ selVal = (length_1 > 1) ? rule.value[i] : rule.value;
2498
+ selectedValue = this.parseDate(selVal, format) || new Date();
2499
+ }
2502
2500
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2503
2501
  if (!itemData.field && !itemData.key && itemData.value) {
2504
2502
  if (itemData.value instanceof Date) {
@@ -2599,7 +2597,15 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
2599
2597
  isCheck = values[i].toString().toLowerCase() === itemData.value.toString().toLowerCase();
2600
2598
  }
2601
2599
  else if (i === 0) {
2602
- isCheck = true;
2600
+ if (typeof rule.value === 'boolean') {
2601
+ isCheck = rule.value ? true : false;
2602
+ }
2603
+ else {
2604
+ isCheck = true;
2605
+ }
2606
+ }
2607
+ if (typeof rule.value === 'boolean' && i === 1) {
2608
+ isCheck = !rule.value ? true : false;
2603
2609
  }
2604
2610
  value = values[i].toString();
2605
2611
  orgValue = values[i];
@@ -2616,7 +2622,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
2616
2622
  var radiobutton = new RadioButton(radioBtn);
2617
2623
  radiobutton.appendTo('#' + parentId + '_valuekey' + i);
2618
2624
  if (isCheck) {
2619
- this.updateRules(radiobutton.element, orgValue, 0);
2625
+ this.updateRules(radiobutton.element, orgValue, 0, true);
2620
2626
  }
2621
2627
  };
2622
2628
  QueryBuilder.prototype.getOperatorIndex = function (ddlObj, rule) {
@@ -5118,6 +5124,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5118
5124
  */
5119
5125
  QueryBuilder.prototype.cloneRule = function (ruleID, groupID, index) {
5120
5126
  var getRule = this.getRule(ruleID.replace(this.element.id + '_', ''));
5127
+ var isCloneRule = this.showButtons.cloneRule;
5121
5128
  groupID = groupID.replace(this.element.id + '_', '');
5122
5129
  this.ruleIndex = index;
5123
5130
  this.cloneRuleBtnClick = true;
@@ -5128,7 +5135,8 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5128
5135
  }], groupID);
5129
5136
  this.ruleIndex = -1;
5130
5137
  this.cloneRuleBtnClick = false;
5131
- this.showButtons.cloneRule = false;
5138
+ this.showButtons.cloneRule = isCloneRule;
5139
+ isCloneRule = false;
5132
5140
  };
5133
5141
  /**
5134
5142
  * Clones the group based on the group ID to the specific group.
@@ -5141,6 +5149,7 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5141
5149
  QueryBuilder.prototype.cloneGroup = function (groupID, parentGroupID, index) {
5142
5150
  parentGroupID = parentGroupID.replace(this.element.id + '_', '');
5143
5151
  var group = this.getGroup(parentGroupID);
5152
+ var isCloneGroup = this.showButtons.cloneGroup;
5144
5153
  groupID = groupID.replace(this.element.id + '_', '');
5145
5154
  this.groupIndex = index;
5146
5155
  this.cloneGrpBtnClick = true;
@@ -5148,7 +5157,8 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5148
5157
  this.addGroups([{ 'condition': group.condition, 'not': group.not, 'rules': group.rules }], groupID);
5149
5158
  this.groupIndex = -1;
5150
5159
  this.cloneGrpBtnClick = false;
5151
- this.showButtons.cloneGroup = false;
5160
+ this.showButtons.cloneGroup = isCloneGroup;
5161
+ isCloneGroup = false;
5152
5162
  };
5153
5163
  /**
5154
5164
  * Locks the rule based on the rule ID.
@@ -5157,6 +5167,9 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5157
5167
  * @returns {void}
5158
5168
  */
5159
5169
  QueryBuilder.prototype.lockRule = function (ruleID) {
5170
+ if (ruleID.indexOf(this.element.id) < 0) {
5171
+ ruleID = this.element.id + '_' + ruleID;
5172
+ }
5160
5173
  var target = document.getElementById(ruleID).querySelectorAll('.e-lock-rule-btn')[0];
5161
5174
  this.ruleLock(target);
5162
5175
  };
@@ -5167,6 +5180,9 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5167
5180
  * @returns {void}
5168
5181
  */
5169
5182
  QueryBuilder.prototype.lockGroup = function (groupID) {
5183
+ if (groupID.indexOf(this.element.id) < 0) {
5184
+ groupID = this.element.id + '_' + groupID;
5185
+ }
5170
5186
  var target = document.getElementById(groupID).querySelectorAll('.e-lock-grp-btn')[0];
5171
5187
  this.groupLock(target);
5172
5188
  };
@@ -5262,9 +5278,9 @@ var QueryBuilder = /** @__PURE__ @class */ (function (_super) {
5262
5278
  return matchValue.length;
5263
5279
  }
5264
5280
  // eslint-disable-next-line
5265
- if (this.checkLiteral() && /^'?([a-z_][a-z0-9 _.\[\]\(\)]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(sqlString)) {
5281
+ if (this.checkLiteral() && /^'?([a-z_][a-z0-9 _.\[\]\(\)-]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(sqlString)) {
5266
5282
  // eslint-disable-next-line
5267
- matchValue = /^'?([a-z_][a-z0-9 _.\[\]\(\)]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(sqlString)[1];
5283
+ matchValue = /^'?([a-z_][a-z0-9 _.\[\]\(\)-]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(sqlString)[1];
5268
5284
  this.parser.push(['Literal', matchValue]);
5269
5285
  return matchValue.length + 2;
5270
5286
  }