@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.
@@ -1756,7 +1756,7 @@ let QueryBuilder = class QueryBuilder extends Component {
1756
1756
  this.GetRootColumnName(rule.field) === this.GetRootColumnName(this.previousColumn.field))) {
1757
1757
  const subField = this.selectedColumn.columns;
1758
1758
  for (let i = 0; i < subField.length; i++) {
1759
- if (rule.field === subField[i].field) {
1759
+ if (rule.field === subField[i].field || rule.field.indexOf(subField[i].field + this.separator) > -1) {
1760
1760
  dropDownList.value = subField[i].field;
1761
1761
  this.selectedColumn = subField[i];
1762
1762
  subFieldValue = true;
@@ -2122,17 +2122,11 @@ let QueryBuilder = class QueryBuilder extends Component {
2122
2122
  if (!this.dataColl.length && values.length) {
2123
2123
  isValues = true;
2124
2124
  }
2125
- let fieldValue = this.selectedRule.field;
2126
- const isNested = this.selectedRule.field.indexOf(this.separator);
2127
- if (isNested !== 0 && this.fieldMode !== 'DropdownTree') {
2128
- const nest = this.selectedRule.field.split(this.separator);
2129
- fieldValue = nest[nest.length - 1];
2130
- }
2131
2125
  let multiSelectValue;
2132
2126
  multiSelectValue = {
2133
2127
  dataSource: isValues ? values : (isFetched ? ds : this.dataManager),
2134
2128
  query: new Query([rule.field]),
2135
- fields: { text: fieldValue, value: fieldValue },
2129
+ fields: { text: this.selectedRule.field, value: this.selectedRule.field },
2136
2130
  placeholder: this.l10n.getConstant('SelectValue'),
2137
2131
  value: selectedValue,
2138
2132
  mode: 'CheckBox',
@@ -2262,7 +2256,7 @@ let QueryBuilder = class QueryBuilder extends Component {
2262
2256
  const columnData = this.getItemData(parentId);
2263
2257
  let selectedValue;
2264
2258
  const isTemplate = (typeof columnData.template === 'string');
2265
- if (this.isImportRules || this.ruleIndex > -1 || this.groupIndex > -1 || this.isPublic || isTemplate) {
2259
+ if (this.isImportRules || this.ruleIndex > -1 || this.groupIndex > -1 || this.isPublic || isTemplate || rule.value != '') {
2266
2260
  selectedValue = rule.value;
2267
2261
  }
2268
2262
  else {
@@ -2301,7 +2295,7 @@ let QueryBuilder = class QueryBuilder extends Component {
2301
2295
  renderNumberValue(parentId, rule, operator, idx, ruleValElem, itemData, length) {
2302
2296
  const columnData = this.getItemData(parentId);
2303
2297
  const isTemplate = (typeof columnData.template === 'string');
2304
- let selectedVal = (this.isImportRules || this.ruleIndex > -1 || this.groupIndex > -1 || this.isPublic || isTemplate) ? rule.value : this.setDefaultValue(parentId, false, true);
2298
+ let selectedVal = (this.isImportRules || this.ruleIndex > -1 || this.groupIndex > -1 || this.isPublic || isTemplate || typeof rule.value === 'number') ? rule.value : this.setDefaultValue(parentId, false, true);
2305
2299
  if ((operator === 'in' || operator === 'notin') && (this.dataColl.length || columnData.values)) {
2306
2300
  selectedVal = (this.isImportRules || this.ruleIndex > -1 || this.groupIndex > -1) ? rule.value : this.setDefaultValue(parentId, true, false);
2307
2301
  this.renderMultiSelect(columnData, parentId, idx, selectedVal, columnData.values);
@@ -2437,6 +2431,10 @@ let QueryBuilder = class QueryBuilder extends Component {
2437
2431
  let datePicker;
2438
2432
  const place = this.l10n.getConstant('SelectValue');
2439
2433
  const isTemplate = (typeof itemData.template === 'string');
2434
+ if (rule.value && !isNullOrUndefined(format)) {
2435
+ selVal = (length > 1) ? rule.value[i] : rule.value;
2436
+ selectedValue = this.parseDate(selVal, format) || new Date();
2437
+ }
2440
2438
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2441
2439
  if (!itemData.field && !itemData.key && itemData.value) {
2442
2440
  if (itemData.value instanceof Date) {
@@ -2537,7 +2535,15 @@ let QueryBuilder = class QueryBuilder extends Component {
2537
2535
  isCheck = values[i].toString().toLowerCase() === itemData.value.toString().toLowerCase();
2538
2536
  }
2539
2537
  else if (i === 0) {
2540
- isCheck = true;
2538
+ if (typeof rule.value === 'boolean') {
2539
+ isCheck = rule.value ? true : false;
2540
+ }
2541
+ else {
2542
+ isCheck = true;
2543
+ }
2544
+ }
2545
+ if (typeof rule.value === 'boolean' && i === 1) {
2546
+ isCheck = !rule.value ? true : false;
2541
2547
  }
2542
2548
  value = values[i].toString();
2543
2549
  orgValue = values[i];
@@ -2554,7 +2560,7 @@ let QueryBuilder = class QueryBuilder extends Component {
2554
2560
  const radiobutton = new RadioButton(radioBtn);
2555
2561
  radiobutton.appendTo('#' + parentId + '_valuekey' + i);
2556
2562
  if (isCheck) {
2557
- this.updateRules(radiobutton.element, orgValue, 0);
2563
+ this.updateRules(radiobutton.element, orgValue, 0, true);
2558
2564
  }
2559
2565
  }
2560
2566
  getOperatorIndex(ddlObj, rule) {
@@ -5050,6 +5056,7 @@ let QueryBuilder = class QueryBuilder extends Component {
5050
5056
  */
5051
5057
  cloneRule(ruleID, groupID, index) {
5052
5058
  const getRule = this.getRule(ruleID.replace(this.element.id + '_', ''));
5059
+ let isCloneRule = this.showButtons.cloneRule;
5053
5060
  groupID = groupID.replace(this.element.id + '_', '');
5054
5061
  this.ruleIndex = index;
5055
5062
  this.cloneRuleBtnClick = true;
@@ -5060,7 +5067,8 @@ let QueryBuilder = class QueryBuilder extends Component {
5060
5067
  }], groupID);
5061
5068
  this.ruleIndex = -1;
5062
5069
  this.cloneRuleBtnClick = false;
5063
- this.showButtons.cloneRule = false;
5070
+ this.showButtons.cloneRule = isCloneRule;
5071
+ isCloneRule = false;
5064
5072
  }
5065
5073
  /**
5066
5074
  * Clones the group based on the group ID to the specific group.
@@ -5073,6 +5081,7 @@ let QueryBuilder = class QueryBuilder extends Component {
5073
5081
  cloneGroup(groupID, parentGroupID, index) {
5074
5082
  parentGroupID = parentGroupID.replace(this.element.id + '_', '');
5075
5083
  const group = this.getGroup(parentGroupID);
5084
+ let isCloneGroup = this.showButtons.cloneGroup;
5076
5085
  groupID = groupID.replace(this.element.id + '_', '');
5077
5086
  this.groupIndex = index;
5078
5087
  this.cloneGrpBtnClick = true;
@@ -5080,7 +5089,8 @@ let QueryBuilder = class QueryBuilder extends Component {
5080
5089
  this.addGroups([{ 'condition': group.condition, 'not': group.not, 'rules': group.rules }], groupID);
5081
5090
  this.groupIndex = -1;
5082
5091
  this.cloneGrpBtnClick = false;
5083
- this.showButtons.cloneGroup = false;
5092
+ this.showButtons.cloneGroup = isCloneGroup;
5093
+ isCloneGroup = false;
5084
5094
  }
5085
5095
  /**
5086
5096
  * Locks the rule based on the rule ID.
@@ -5089,6 +5099,9 @@ let QueryBuilder = class QueryBuilder extends Component {
5089
5099
  * @returns {void}
5090
5100
  */
5091
5101
  lockRule(ruleID) {
5102
+ if (ruleID.indexOf(this.element.id) < 0) {
5103
+ ruleID = this.element.id + '_' + ruleID;
5104
+ }
5092
5105
  const target = document.getElementById(ruleID).querySelectorAll('.e-lock-rule-btn')[0];
5093
5106
  this.ruleLock(target);
5094
5107
  }
@@ -5099,6 +5112,9 @@ let QueryBuilder = class QueryBuilder extends Component {
5099
5112
  * @returns {void}
5100
5113
  */
5101
5114
  lockGroup(groupID) {
5115
+ if (groupID.indexOf(this.element.id) < 0) {
5116
+ groupID = this.element.id + '_' + groupID;
5117
+ }
5102
5118
  const target = document.getElementById(groupID).querySelectorAll('.e-lock-grp-btn')[0];
5103
5119
  this.groupLock(target);
5104
5120
  }
@@ -5194,9 +5210,9 @@ let QueryBuilder = class QueryBuilder extends Component {
5194
5210
  return matchValue.length;
5195
5211
  }
5196
5212
  // eslint-disable-next-line
5197
- if (this.checkLiteral() && /^'?([a-z_][a-z0-9 _.\[\]\(\)]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(sqlString)) {
5213
+ if (this.checkLiteral() && /^'?([a-z_][a-z0-9 _.\[\]\(\)-]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(sqlString)) {
5198
5214
  // eslint-disable-next-line
5199
- matchValue = /^'?([a-z_][a-z0-9 _.\[\]\(\)]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(sqlString)[1];
5215
+ matchValue = /^'?([a-z_][a-z0-9 _.\[\]\(\)-]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(sqlString)[1];
5200
5216
  this.parser.push(['Literal', matchValue]);
5201
5217
  return matchValue.length + 2;
5202
5218
  }