igniteui-angular 12.3.19 → 12.3.20

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.
@@ -5594,6 +5594,17 @@
5594
5594
  enumerable: false,
5595
5595
  configurable: true
5596
5596
  });
5597
+ Object.defineProperty(IgxForOfDirective.prototype, "isRTL", {
5598
+ /**
5599
+ * @hidden
5600
+ */
5601
+ get: function () {
5602
+ var dir = window.getComputedStyle(this.dc.instance._viewContainer.element.nativeElement).getPropertyValue('direction');
5603
+ return dir === 'rtl';
5604
+ },
5605
+ enumerable: false,
5606
+ configurable: true
5607
+ });
5597
5608
  Object.defineProperty(IgxForOfDirective.prototype, "sizesCache", {
5598
5609
  get: function () {
5599
5610
  return this._sizesCache;
@@ -5830,7 +5841,7 @@
5830
5841
  return;
5831
5842
  }
5832
5843
  if (this.igxForScrollOrientation === 'horizontal') {
5833
- this.scrollPosition = nextScroll;
5844
+ this.scrollPosition = this.isRTL ? -nextScroll : nextScroll;
5834
5845
  }
5835
5846
  else {
5836
5847
  var maxVirtScrollTop = this._virtHeight - containerSize;
@@ -5851,7 +5862,7 @@
5851
5862
  * ```
5852
5863
  */
5853
5864
  IgxForOfDirective.prototype.scrollNext = function () {
5854
- var scr = Math.ceil(this.scrollPosition);
5865
+ var scr = Math.abs(Math.ceil(this.scrollPosition));
5855
5866
  var endIndex = this.getIndexAt(scr + parseInt(this.igxForContainerSize, 10), this.sizesCache);
5856
5867
  this.scrollTo(endIndex);
5857
5868
  };
@@ -5874,7 +5885,7 @@
5874
5885
  */
5875
5886
  IgxForOfDirective.prototype.scrollNextPage = function () {
5876
5887
  if (this.igxForScrollOrientation === 'horizontal') {
5877
- this.scrollPosition += parseInt(this.igxForContainerSize, 10);
5888
+ this.scrollPosition += this.isRTL ? -parseInt(this.igxForContainerSize, 10) : parseInt(this.igxForContainerSize, 10);
5878
5889
  }
5879
5890
  else {
5880
5891
  this.addScrollTop(parseInt(this.igxForContainerSize, 10));
@@ -5889,7 +5900,7 @@
5889
5900
  */
5890
5901
  IgxForOfDirective.prototype.scrollPrevPage = function () {
5891
5902
  if (this.igxForScrollOrientation === 'horizontal') {
5892
- this.scrollPosition -= parseInt(this.igxForContainerSize, 10);
5903
+ this.scrollPosition -= this.isRTL ? -parseInt(this.igxForContainerSize, 10) : parseInt(this.igxForContainerSize, 10);
5893
5904
  }
5894
5905
  else {
5895
5906
  var containerSize = (parseInt(this.igxForContainerSize, 10));
@@ -6209,9 +6220,16 @@
6209
6220
  return;
6210
6221
  }
6211
6222
  var prevStartIndex = this.state.startIndex;
6223
+ var scrLeft = event.target.scrollLeft;
6212
6224
  // Updating horizontal chunks
6213
- var scrollOffset = this.fixedUpdateAllElements(event.target.scrollLeft);
6214
- this.dc.instance._viewContainer.element.nativeElement.style.left = -scrollOffset + 'px';
6225
+ var scrollOffset = this.fixedUpdateAllElements(Math.abs(event.target.scrollLeft));
6226
+ if (scrLeft < 0) {
6227
+ // RTL
6228
+ this.dc.instance._viewContainer.element.nativeElement.style.left = scrollOffset + 'px';
6229
+ }
6230
+ else {
6231
+ this.dc.instance._viewContainer.element.nativeElement.style.left = -scrollOffset + 'px';
6232
+ }
6215
6233
  this.dc.changeDetectorRef.detectChanges();
6216
6234
  if (prevStartIndex !== this.state.startIndex) {
6217
6235
  this.chunkLoad.emit(this.state);
@@ -6778,8 +6796,15 @@
6778
6796
  return;
6779
6797
  }
6780
6798
  // Updating horizontal chunks
6781
- var scrollOffset = this.fixedUpdateAllElements(scrollAmount);
6782
- this.dc.instance._viewContainer.element.nativeElement.style.left = -scrollOffset + 'px';
6799
+ var scrollOffset = this.fixedUpdateAllElements(Math.abs(scrollAmount));
6800
+ if (scrollAmount < 0) {
6801
+ // RTL
6802
+ this.dc.instance._viewContainer.element.nativeElement.style.left = scrollOffset + 'px';
6803
+ }
6804
+ else {
6805
+ // LTR
6806
+ this.dc.instance._viewContainer.element.nativeElement.style.left = -scrollOffset + 'px';
6807
+ }
6783
6808
  };
6784
6809
  IgxGridForOfDirective.prototype.getItemSize = function (item) {
6785
6810
  var size = 0;
@@ -49220,9 +49245,15 @@
49220
49245
  return;
49221
49246
  }
49222
49247
  if (shift && alt && this.isToggleKey(key) && !column.columnGroup && column.groupable) {
49223
- direction = direction ? exports.SortingDirection.Desc : exports.SortingDirection.Asc;
49248
+ direction = direction || exports.SortingDirection.Asc;
49224
49249
  if (key.includes('right')) {
49225
- this.grid.groupBy({ fieldName: column.field, dir: direction, ignoreCase: false });
49250
+ this.grid.groupBy({
49251
+ fieldName: column.field,
49252
+ dir: direction,
49253
+ ignoreCase: column.sortingIgnoreCase,
49254
+ strategy: column.sortStrategy,
49255
+ groupingComparer: column.groupingComparer,
49256
+ });
49226
49257
  }
49227
49258
  else {
49228
49259
  this.grid.clearGrouping(column.field);
@@ -50684,6 +50715,7 @@
50684
50715
  this.updateSorting(id);
50685
50716
  };
50686
50717
  IgxGroupByAreaDirective.prototype.onDragDrop = function (event) {
50718
+ var _a;
50687
50719
  var drag = event.detail.owner;
50688
50720
  if (drag instanceof IgxColumnMovingDragDirective) {
50689
50721
  var column_1 = drag.column;
@@ -50694,7 +50726,7 @@
50694
50726
  if (column_1.groupable && !isGrouped && !column_1.columnGroup && !!column_1.field) {
50695
50727
  var groupingExpression = {
50696
50728
  fieldName: column_1.field,
50697
- dir: exports.SortingDirection.Asc,
50729
+ dir: ((_a = this.grid.sortingExpressions.find(function (expr) { return expr.fieldName === column_1.field; })) === null || _a === void 0 ? void 0 : _a.dir) || exports.SortingDirection.Asc,
50698
50730
  ignoreCase: column_1.sortingIgnoreCase,
50699
50731
  strategy: column_1.sortStrategy,
50700
50732
  groupingComparer: column_1.groupingComparer
@@ -57882,7 +57914,8 @@
57882
57914
  this._setupServices();
57883
57915
  this._setupListeners();
57884
57916
  this.rowListDiffer = this.differs.find([]).create(null);
57885
- this.columnListDiffer = this.differs.find([]).create(null);
57917
+ // compare based on field, not on object ref.
57918
+ this.columnListDiffer = this.differs.find([]).create(function (index, col) { return col.field; });
57886
57919
  this.calcWidth = this.width && this.width.indexOf('%') === -1 ? parseInt(this.width, 10) : 0;
57887
57920
  this.shouldGenerate = this.autoGenerate;
57888
57921
  };
@@ -60538,6 +60571,21 @@
60538
60571
  console.warn('The row with the specified PK or index is outside of the current data view.');
60539
60572
  }
60540
60573
  };
60574
+ /**
60575
+ * Update internal column's collection.
60576
+ *
60577
+ * @hidden
60578
+ */
60579
+ IgxGridBaseDirective.prototype.updateColumns = function (newColumns) {
60580
+ var _this = this;
60581
+ // update internal collections to retain order.
60582
+ this._pinnedColumns = newColumns
60583
+ .filter(function (c) { return c.pinned; }).sort(function (a, b) { return _this._pinnedColumns.indexOf(a) - _this._pinnedColumns.indexOf(b); });
60584
+ this._unpinnedColumns = newColumns.filter(function (c) { return !c.pinned; });
60585
+ this.columnList.reset(newColumns);
60586
+ this.columnList.notifyOnChanges();
60587
+ this._columns = this.columnList.toArray();
60588
+ };
60541
60589
  /**
60542
60590
  * Enters add mode by spawning the UI at the specified index.
60543
60591
  *
@@ -60762,9 +60810,7 @@
60762
60810
  var list = this.columnList.toArray();
60763
60811
  this._reorderColumns(from, to, pos, list);
60764
60812
  var newList = this._resetColumnList(list);
60765
- this.columnList.reset(newList);
60766
- this.columnList.notifyOnChanges();
60767
- this._columns = this.columnList.toArray();
60813
+ this.updateColumns(newList);
60768
60814
  };
60769
60815
  /**
60770
60816
  * @hidden
@@ -61201,6 +61247,20 @@
61201
61247
  IgxGridBaseDirective.prototype.generateDataFields = function (data) {
61202
61248
  return Object.keys(data && data.length !== 0 ? data[0] : []);
61203
61249
  };
61250
+ /**
61251
+ * @hidden
61252
+ * @internal
61253
+ */
61254
+ IgxGridBaseDirective.prototype._getResolvedDataIndex = function (index) {
61255
+ var newIndex = index;
61256
+ if ((index < 0 || index >= this.dataView.length) && this.pagingMode === 1 && this.paginator.page !== 0) {
61257
+ newIndex = index - this.paginator.perPage * this.paginator.page;
61258
+ }
61259
+ else if (this.gridAPI.grid.verticalScrollContainer.isRemote) {
61260
+ newIndex = index - this.gridAPI.grid.virtualizationState.startIndex;
61261
+ }
61262
+ return newIndex;
61263
+ };
61204
61264
  /**
61205
61265
  * @hidden
61206
61266
  */
@@ -61246,10 +61306,12 @@
61246
61306
  IgxGridBaseDirective.prototype.reinitPinStates = function () {
61247
61307
  var _this = this;
61248
61308
  this._pinnedColumns = this.columnList
61249
- .filter(function (c) { return c.pinned; }).sort(function (a, b) { return _this._pinnedColumns.indexOf(a) - _this._pinnedColumns.indexOf(b); });
61309
+ .filter(function (c) { return c.pinned; })
61310
+ .sort(function (a, b) { return _this._pinnedColumns.indexOf(a) - _this._pinnedColumns.indexOf(b); });
61250
61311
  this._unpinnedColumns = this.hasColumnGroups ? this.columnList.filter(function (c) { return !c.pinned; }) :
61251
61312
  this.columnList.filter(function (c) { return !c.pinned; })
61252
- .sort(function (a, b) { return a.index - b.index; });
61313
+ .sort(function (a, b) { return _this._unpinnedColumns.findIndex(function (x) { return x.field === a.field; }) -
61314
+ _this._unpinnedColumns.findIndex(function (x) { return x.field === b.field; }); });
61253
61315
  };
61254
61316
  IgxGridBaseDirective.prototype.extractDataFromSelection = function (source, formatters, headers, columnData) {
61255
61317
  var e_4, _h, e_5, _j, e_6, _k;
@@ -70259,19 +70321,8 @@
70259
70321
  */
70260
70322
  IgxGridComponent.prototype.createRow = function (index, data) {
70261
70323
  var row;
70262
- var rec;
70263
- if (index < 0 || index >= this.dataView.length) {
70264
- if (this.pagingMode === 1 && this.paginator.page !== 0) {
70265
- rec = data !== null && data !== void 0 ? data : this.dataView[index - this.paginator.perPage * this.paginator.page];
70266
- }
70267
- else if (index >= this.dataView.length) {
70268
- var virtIndex = index - this.gridAPI.grid.virtualizationState.startIndex;
70269
- rec = data !== null && data !== void 0 ? data : this.dataView[virtIndex];
70270
- }
70271
- }
70272
- else {
70273
- rec = data !== null && data !== void 0 ? data : this.dataView[index];
70274
- }
70324
+ var dataIndex = this._getResolvedDataIndex(index);
70325
+ var rec = data !== null && data !== void 0 ? data : this.dataView[dataIndex];
70275
70326
  if (rec && this.isGroupByRecord(rec)) {
70276
70327
  row = new IgxGroupByRow(this, index, rec);
70277
70328
  }
@@ -70582,8 +70633,7 @@
70582
70633
  newColumns.push(ref_1.instance);
70583
70634
  }
70584
70635
  });
70585
- context.currGrid.columnList.reset(newColumns);
70586
- context.currGrid.columnList.notifyOnChanges();
70636
+ context.grid.updateColumns(newColumns);
70587
70637
  }
70588
70638
  },
70589
70639
  groupBy: {
@@ -70917,7 +70967,8 @@
70917
70967
  expr_1.searchVal = new Set(expr_1.searchVal);
70918
70968
  }
70919
70969
  else {
70920
- expr_1.searchVal = expr_1.searchVal && (dataType === 'date') ? new Date(Date.parse(expr_1.searchVal)) : expr_1.searchVal;
70970
+ expr_1.searchVal = expr_1.searchVal && (dataType === 'date' || dataType === 'dateTime')
70971
+ ? new Date(Date.parse(expr_1.searchVal)) : expr_1.searchVal;
70921
70972
  }
70922
70973
  expr_1.condition = this_1.generateFilteringCondition(dataType, expr_1.condition.name);
70923
70974
  expressionsTree.filteringOperands.push(expr_1);
@@ -74016,7 +74067,8 @@
74016
74067
  */
74017
74068
  IgxTreeGridComponent.prototype.createRow = function (index, data) {
74018
74069
  var row;
74019
- var rec = data !== null && data !== void 0 ? data : this.dataView[index];
74070
+ var dataIndex = this._getResolvedDataIndex(index);
74071
+ var rec = data !== null && data !== void 0 ? data : this.dataView[dataIndex];
74020
74072
  if (this.isSummaryRow(rec)) {
74021
74073
  row = new IgxSummaryRow(this, index, rec.summaries, exports.GridInstanceType.TreeGrid);
74022
74074
  }
@@ -77383,7 +77435,8 @@
77383
77435
  */
77384
77436
  IgxHierarchicalGridComponent.prototype.createRow = function (index, data) {
77385
77437
  var row;
77386
- var rec = data !== null && data !== void 0 ? data : this.dataView[index];
77438
+ var dataIndex = this._getResolvedDataIndex(index);
77439
+ var rec = data !== null && data !== void 0 ? data : this.dataView[dataIndex];
77387
77440
  if (!row && rec && !rec.childGridsData) {
77388
77441
  row = new IgxHierarchicalGridRow(this, index, rec);
77389
77442
  }
@@ -77776,7 +77829,10 @@
77776
77829
  result.push(v);
77777
77830
  var childGridsData = {};
77778
77831
  childKeys.forEach(function (childKey) {
77779
- var childData = v[childKey] ? v[childKey] : null;
77832
+ if (!v[childKey]) {
77833
+ v[childKey] = [];
77834
+ }
77835
+ var childData = v[childKey];
77780
77836
  childGridsData[childKey] = childData;
77781
77837
  });
77782
77838
  if (grid.gridAPI.get_row_expansion_state(v)) {