igniteui-angular 12.3.11 → 12.3.14

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.
@@ -26881,9 +26881,8 @@
26881
26881
  * ```
26882
26882
  */
26883
26883
  IgxTextSelectionDirective.prototype.trigger = function () {
26884
- var _this = this;
26885
26884
  if (this.selected && this.nativeElement.value.length) {
26886
- requestAnimationFrame(function () { return _this.nativeElement.setSelectionRange(0, _this.nativeElement.value.length); });
26885
+ this.nativeElement.select();
26887
26886
  }
26888
26887
  };
26889
26888
  return IgxTextSelectionDirective;
@@ -39503,6 +39502,7 @@
39503
39502
  _this._data = [];
39504
39503
  _this._value = '';
39505
39504
  _this._groupKey = '';
39505
+ _this._searchValue = '';
39506
39506
  _this._filteredData = [];
39507
39507
  _this._remoteSelection = {};
39508
39508
  _this._valid = IgxComboState.INITIAL;
@@ -39512,7 +39512,6 @@
39512
39512
  _this._onChangeCallback = rxjs.noop;
39513
39513
  _this._type = null;
39514
39514
  _this._dataType = '';
39515
- _this._searchValue = '';
39516
39515
  _this._itemHeight = null;
39517
39516
  _this._itemsMaxHeight = null;
39518
39517
  _this.onStatusChanged = function () {
@@ -41051,9 +41050,12 @@
41051
41050
  /** @hidden @internal */
41052
41051
  _this.composing = false;
41053
41052
  _this._updateInput = true;
41053
+ // stores the last filtered value - move to common?
41054
+ _this._internalFilter = '';
41054
41055
  _this.findMatch = function (element) {
41055
41056
  var value = _this.displayKey ? element[_this.displayKey] : element;
41056
- return value.toString().toLowerCase().includes(_this.searchValue.trim().toLowerCase());
41057
+ var searchValue = _this.searchValue || _this.comboInput.value;
41058
+ return !!searchValue && value.toString().toLowerCase().includes(searchValue.trim().toLowerCase());
41057
41059
  };
41058
41060
  _this.comboAPI.register(_this);
41059
41061
  return _this;
@@ -41071,6 +41073,24 @@
41071
41073
  enumerable: false,
41072
41074
  configurable: true
41073
41075
  });
41076
+ Object.defineProperty(IgxSimpleComboComponent.prototype, "searchValue", {
41077
+ /** @hidden @internal */
41078
+ get: function () {
41079
+ return this._searchValue;
41080
+ },
41081
+ set: function (val) {
41082
+ this._searchValue = val;
41083
+ },
41084
+ enumerable: false,
41085
+ configurable: true
41086
+ });
41087
+ Object.defineProperty(IgxSimpleComboComponent.prototype, "selectedItem", {
41088
+ get: function () {
41089
+ return this.selectionService.get(this.id).values().next().value;
41090
+ },
41091
+ enumerable: false,
41092
+ configurable: true
41093
+ });
41074
41094
  /** @hidden @internal */
41075
41095
  IgxSimpleComboComponent.prototype.onArrowDown = function (event) {
41076
41096
  if (this.collapsed) {
@@ -41135,6 +41155,15 @@
41135
41155
  _this.dropdown.navigateItem(index);
41136
41156
  }
41137
41157
  });
41158
+ this.dropdown.opening.pipe(operators.takeUntil(this.destroy$)).subscribe(function () {
41159
+ var filtered = _this.filteredData.find(_this.findMatch);
41160
+ if (filtered === undefined || filtered === null) {
41161
+ _this.filterValue = _this.searchValue = _this.comboInput.value;
41162
+ return;
41163
+ }
41164
+ _this._internalFilter = _this.filterValue;
41165
+ _this.filterValue = _this.searchValue = '';
41166
+ });
41138
41167
  this.dropdown.opened.pipe(operators.takeUntil(this.destroy$)).subscribe(function () {
41139
41168
  if (_this.composing) {
41140
41169
  _this.comboInput.focus();
@@ -41149,23 +41178,29 @@
41149
41178
  _this._onTouchedCallback();
41150
41179
  }
41151
41180
  });
41181
+ this.dropdown.closed.pipe(operators.takeUntil(this.destroy$)).subscribe(function () {
41182
+ _this.filterValue = _this._internalFilter = _this.comboInput.value;
41183
+ });
41152
41184
  _super.prototype.ngAfterViewInit.call(this);
41153
41185
  };
41154
41186
  /** @hidden @internal */
41155
41187
  IgxSimpleComboComponent.prototype.handleInputChange = function (event) {
41156
41188
  if (event !== undefined) {
41157
- this.searchValue = typeof event === 'string' ? event : event.target.value;
41189
+ this.filterValue = this._internalFilter = this.searchValue = typeof event === 'string' ? event : event.target.value;
41158
41190
  }
41159
41191
  this._onChangeCallback(this.searchValue);
41160
41192
  if (this.collapsed && this.comboInput.focused) {
41161
41193
  this.open();
41162
- this.dropdown.navigateFirst();
41163
41194
  }
41164
41195
  if (!this.comboInput.value.trim()) {
41165
41196
  // handle clearing of input by space
41166
41197
  this.clearSelection();
41167
41198
  this._onChangeCallback(null);
41168
41199
  }
41200
+ // when filtering the focused item should be the first item or the currently selected item
41201
+ if (!this.dropdown.focusedItem || this.dropdown.focusedItem.id !== this.dropdown.items[0].id) {
41202
+ this.dropdown.navigateFirst();
41203
+ }
41169
41204
  _super.prototype.handleInputChange.call(this, event);
41170
41205
  this.composing = true;
41171
41206
  };
@@ -41182,15 +41217,15 @@
41182
41217
  this.close();
41183
41218
  // manually trigger text selection as it will not be triggered during editing
41184
41219
  this.textSelection.trigger();
41220
+ this.filterValue = this.getElementVal(filtered);
41185
41221
  return;
41186
41222
  }
41187
41223
  if (event.key === this.platformUtil.KEYMAP.BACKSPACE
41188
41224
  || event.key === this.platformUtil.KEYMAP.DELETE) {
41189
41225
  this._updateInput = false;
41190
- this.clearSelection();
41226
+ this.clearSelection(true);
41191
41227
  }
41192
41228
  if (!this.collapsed && event.key === this.platformUtil.KEYMAP.TAB) {
41193
- this.close();
41194
41229
  this.clearOnBlur();
41195
41230
  }
41196
41231
  this.composing = false;
@@ -41336,10 +41371,26 @@
41336
41371
  };
41337
41372
  IgxSimpleComboComponent.prototype.clearOnBlur = function () {
41338
41373
  var filtered = this.filteredData.find(this.findMatch);
41339
- if ((filtered === undefined || filtered === null)) {
41374
+ if (filtered === undefined || filtered === null || !this.selectedItem) {
41375
+ this.clearAndClose();
41376
+ return;
41377
+ }
41378
+ if (this.isPartialMatch(filtered) || this.selectedItem !== this._internalFilter) {
41379
+ this.clearAndClose();
41380
+ }
41381
+ };
41382
+ IgxSimpleComboComponent.prototype.isPartialMatch = function (filtered) {
41383
+ return !!this._internalFilter && this._internalFilter.length !== this.getElementVal(filtered).length;
41384
+ };
41385
+ IgxSimpleComboComponent.prototype.getElementVal = function (element) {
41386
+ return this.displayKey ? element[this.displayKey] : element;
41387
+ };
41388
+ IgxSimpleComboComponent.prototype.clearAndClose = function () {
41389
+ this.clearSelection(true);
41390
+ this._internalFilter = '';
41391
+ this.searchValue = '';
41392
+ if (!this.collapsed) {
41340
41393
  this.close();
41341
- this.clearSelection();
41342
- this.searchValue = '';
41343
41394
  }
41344
41395
  };
41345
41396
  return IgxSimpleComboComponent;
@@ -43810,7 +43861,7 @@
43810
43861
  if (operand instanceof FilteringExpressionsTree) {
43811
43862
  var columnExprTree = operand;
43812
43863
  if (columnExprTree.fieldName === this.column.field) {
43813
- break;
43864
+ continue;
43814
43865
  }
43815
43866
  }
43816
43867
  expressionsTree.filteringOperands.push(operand);
@@ -44244,12 +44295,9 @@
44244
44295
  var col = grid.getColumnByName(field);
44245
44296
  var filteringIgnoreCase = ignoreCase || (col ? col.filteringIgnoreCase : false);
44246
44297
  var filteringTree = grid.filteringExpressionsTree;
44247
- var columnFilteringExpressionsTree = grid.filteringExpressionsTree.find(field);
44298
+ var columnFilteringExpressionsTree = filteringTree.find(field);
44248
44299
  conditionOrExpressionTree = conditionOrExpressionTree !== null && conditionOrExpressionTree !== void 0 ? conditionOrExpressionTree : columnFilteringExpressionsTree;
44249
44300
  var fieldFilterIndex = filteringTree.findIndex(field);
44250
- if (fieldFilterIndex > -1) {
44251
- filteringTree.filteringOperands.splice(fieldFilterIndex, 1);
44252
- }
44253
44301
  var newFilteringTree = this.prepare_filtering_expression(filteringTree, field, value, conditionOrExpressionTree, filteringIgnoreCase, fieldFilterIndex, true);
44254
44302
  var eventArgs = { owner: grid,
44255
44303
  filteringExpressions: newFilteringTree.find(field), cancel: false };
@@ -44607,42 +44655,36 @@
44607
44655
  grid.paginator.page = 0;
44608
44656
  }
44609
44657
  var fieldFilterIndex = filteringTree.findIndex(fieldName);
44610
- if (fieldFilterIndex > -1) {
44611
- filteringTree.filteringOperands.splice(fieldFilterIndex, 1);
44612
- }
44613
44658
  this.prepare_filtering_expression(filteringTree, fieldName, term, conditionOrExpressionsTree, ignoreCase, fieldFilterIndex);
44614
44659
  grid.filteringExpressionsTree = filteringTree;
44615
44660
  };
44616
- /** Modifies the filteringState object to contain the newly added fitering conditions/expressions.
44661
+ /** Modifies the filteringState object to contain the newly added filtering conditions/expressions.
44617
44662
  * If createNewTree is true, filteringState will not be modified (because it directly affects the grid.filteringExpressionsTree),
44618
44663
  * but a new object is created and returned.
44619
44664
  */
44620
44665
  IgxFilteringService.prototype.prepare_filtering_expression = function (filteringState, fieldName, searchVal, conditionOrExpressionsTree, ignoreCase, insertAtIndex, createNewTree) {
44621
44666
  if (insertAtIndex === void 0) { insertAtIndex = -1; }
44622
44667
  if (createNewTree === void 0) { createNewTree = false; }
44623
- var oldExpressionsTreeIndex = filteringState.findIndex(fieldName);
44624
44668
  var expressionsTree = conditionOrExpressionsTree instanceof FilteringExpressionsTree ?
44625
44669
  conditionOrExpressionsTree : null;
44626
44670
  var condition = conditionOrExpressionsTree instanceof FilteringExpressionsTree ?
44627
44671
  null : conditionOrExpressionsTree;
44628
- var newExpression = { fieldName: fieldName, searchVal: searchVal, condition: condition, ignoreCase: ignoreCase };
44629
- var newExpressionsTree = createNewTree ?
44630
- new FilteringExpressionsTree(filteringState.operator, filteringState.fieldName) : filteringState;
44631
- if (oldExpressionsTreeIndex === -1) {
44632
- // no expressions tree found for this field
44633
- if (expressionsTree) {
44634
- if (insertAtIndex > -1) {
44635
- newExpressionsTree.filteringOperands.splice(insertAtIndex, 0, expressionsTree);
44636
- }
44637
- else {
44638
- newExpressionsTree.filteringOperands.push(expressionsTree);
44639
- }
44672
+ var newExpressionsTree = filteringState;
44673
+ if (createNewTree) {
44674
+ newExpressionsTree = new FilteringExpressionsTree(filteringState.operator, filteringState.fieldName);
44675
+ newExpressionsTree.filteringOperands = __spreadArray([], __read(filteringState.filteringOperands));
44676
+ }
44677
+ if (condition) {
44678
+ var newExpression = { fieldName: fieldName, searchVal: searchVal, condition: condition, ignoreCase: ignoreCase };
44679
+ expressionsTree = new FilteringExpressionsTree(filteringState.operator, fieldName);
44680
+ expressionsTree.filteringOperands.push(newExpression);
44681
+ }
44682
+ if (expressionsTree) {
44683
+ if (insertAtIndex > -1) {
44684
+ newExpressionsTree.filteringOperands[insertAtIndex] = expressionsTree;
44640
44685
  }
44641
- else if (condition) {
44642
- // create expressions tree for this field and add the new expression to it
44643
- var newExprTree = new FilteringExpressionsTree(filteringState.operator, fieldName);
44644
- newExprTree.filteringOperands.push(newExpression);
44645
- newExpressionsTree.filteringOperands.push(newExprTree);
44686
+ else {
44687
+ newExpressionsTree.filteringOperands.push(expressionsTree);
44646
44688
  }
44647
44689
  }
44648
44690
  return newExpressionsTree;
@@ -44656,7 +44698,7 @@
44656
44698
  var expressionsTree = expressions;
44657
44699
  if (expressionsTree.operator === exports.FilteringLogic.Or) {
44658
44700
  var andOperatorsCount = this.getChildAndOperatorsCount(expressionsTree);
44659
- // having more that 'And' and operator in the sub-tree means that the filter could not be represented without parentheses.
44701
+ // having more than one 'And' operator in the sub-tree means that the filter could not be represented without parentheses.
44660
44702
  return andOperatorsCount > 1;
44661
44703
  }
44662
44704
  var isComplex = false;
@@ -47786,9 +47828,7 @@
47786
47828
  if (!this.searchValue) {
47787
47829
  var anyFiltered = this.esf.listData.some(function (i) { return i.isFiltered; });
47788
47830
  var anyUnfiltered = this.esf.listData.some(function (i) { return !i.isFiltered; });
47789
- if (anyFiltered && anyUnfiltered) {
47790
- searchAllBtn.indeterminate = true;
47791
- }
47831
+ searchAllBtn.indeterminate = anyFiltered && anyUnfiltered;
47792
47832
  this.esf.listData.forEach(function (i) { return i.isSelected = i.isFiltered; });
47793
47833
  this.displayedListData = this.esf.listData;
47794
47834
  searchAllBtn.label = this.esf.grid.resourceStrings.igx_grid_excel_select_all;