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.
@@ -4916,6 +4916,13 @@ class IgxForOfDirective {
4916
4916
  this.scrollComponent.nativeElement.scrollTop = val;
4917
4917
  }
4918
4918
  }
4919
+ /**
4920
+ * @hidden
4921
+ */
4922
+ get isRTL() {
4923
+ const dir = window.getComputedStyle(this.dc.instance._viewContainer.element.nativeElement).getPropertyValue('direction');
4924
+ return dir === 'rtl';
4925
+ }
4919
4926
  get sizesCache() {
4920
4927
  return this._sizesCache;
4921
4928
  }
@@ -5138,7 +5145,7 @@ class IgxForOfDirective {
5138
5145
  return;
5139
5146
  }
5140
5147
  if (this.igxForScrollOrientation === 'horizontal') {
5141
- this.scrollPosition = nextScroll;
5148
+ this.scrollPosition = this.isRTL ? -nextScroll : nextScroll;
5142
5149
  }
5143
5150
  else {
5144
5151
  const maxVirtScrollTop = this._virtHeight - containerSize;
@@ -5159,7 +5166,7 @@ class IgxForOfDirective {
5159
5166
  * ```
5160
5167
  */
5161
5168
  scrollNext() {
5162
- const scr = Math.ceil(this.scrollPosition);
5169
+ const scr = Math.abs(Math.ceil(this.scrollPosition));
5163
5170
  const endIndex = this.getIndexAt(scr + parseInt(this.igxForContainerSize, 10), this.sizesCache);
5164
5171
  this.scrollTo(endIndex);
5165
5172
  }
@@ -5182,7 +5189,7 @@ class IgxForOfDirective {
5182
5189
  */
5183
5190
  scrollNextPage() {
5184
5191
  if (this.igxForScrollOrientation === 'horizontal') {
5185
- this.scrollPosition += parseInt(this.igxForContainerSize, 10);
5192
+ this.scrollPosition += this.isRTL ? -parseInt(this.igxForContainerSize, 10) : parseInt(this.igxForContainerSize, 10);
5186
5193
  }
5187
5194
  else {
5188
5195
  this.addScrollTop(parseInt(this.igxForContainerSize, 10));
@@ -5197,7 +5204,7 @@ class IgxForOfDirective {
5197
5204
  */
5198
5205
  scrollPrevPage() {
5199
5206
  if (this.igxForScrollOrientation === 'horizontal') {
5200
- this.scrollPosition -= parseInt(this.igxForContainerSize, 10);
5207
+ this.scrollPosition -= this.isRTL ? -parseInt(this.igxForContainerSize, 10) : parseInt(this.igxForContainerSize, 10);
5201
5208
  }
5202
5209
  else {
5203
5210
  const containerSize = (parseInt(this.igxForContainerSize, 10));
@@ -5515,9 +5522,16 @@ class IgxForOfDirective {
5515
5522
  return;
5516
5523
  }
5517
5524
  const prevStartIndex = this.state.startIndex;
5525
+ const scrLeft = event.target.scrollLeft;
5518
5526
  // Updating horizontal chunks
5519
- const scrollOffset = this.fixedUpdateAllElements(event.target.scrollLeft);
5520
- this.dc.instance._viewContainer.element.nativeElement.style.left = -scrollOffset + 'px';
5527
+ const scrollOffset = this.fixedUpdateAllElements(Math.abs(event.target.scrollLeft));
5528
+ if (scrLeft < 0) {
5529
+ // RTL
5530
+ this.dc.instance._viewContainer.element.nativeElement.style.left = scrollOffset + 'px';
5531
+ }
5532
+ else {
5533
+ this.dc.instance._viewContainer.element.nativeElement.style.left = -scrollOffset + 'px';
5534
+ }
5521
5535
  this.dc.changeDetectorRef.detectChanges();
5522
5536
  if (prevStartIndex !== this.state.startIndex) {
5523
5537
  this.chunkLoad.emit(this.state);
@@ -6064,8 +6078,15 @@ class IgxGridForOfDirective extends IgxForOfDirective {
6064
6078
  return;
6065
6079
  }
6066
6080
  // Updating horizontal chunks
6067
- const scrollOffset = this.fixedUpdateAllElements(scrollAmount);
6068
- this.dc.instance._viewContainer.element.nativeElement.style.left = -scrollOffset + 'px';
6081
+ const scrollOffset = this.fixedUpdateAllElements(Math.abs(scrollAmount));
6082
+ if (scrollAmount < 0) {
6083
+ // RTL
6084
+ this.dc.instance._viewContainer.element.nativeElement.style.left = scrollOffset + 'px';
6085
+ }
6086
+ else {
6087
+ // LTR
6088
+ this.dc.instance._viewContainer.element.nativeElement.style.left = -scrollOffset + 'px';
6089
+ }
6069
6090
  }
6070
6091
  getItemSize(item) {
6071
6092
  let size = 0;
@@ -44274,9 +44295,15 @@ class IgxGridNavigationService {
44274
44295
  return;
44275
44296
  }
44276
44297
  if (shift && alt && this.isToggleKey(key) && !column.columnGroup && column.groupable) {
44277
- direction = direction ? SortingDirection.Desc : SortingDirection.Asc;
44298
+ direction = direction || SortingDirection.Asc;
44278
44299
  if (key.includes('right')) {
44279
- this.grid.groupBy({ fieldName: column.field, dir: direction, ignoreCase: false });
44300
+ this.grid.groupBy({
44301
+ fieldName: column.field,
44302
+ dir: direction,
44303
+ ignoreCase: column.sortingIgnoreCase,
44304
+ strategy: column.sortStrategy,
44305
+ groupingComparer: column.groupingComparer,
44306
+ });
44280
44307
  }
44281
44308
  else {
44282
44309
  this.grid.clearGrouping(column.field);
@@ -45541,6 +45568,7 @@ class IgxGroupByAreaDirective {
45541
45568
  this.updateSorting(id);
45542
45569
  }
45543
45570
  onDragDrop(event) {
45571
+ var _a;
45544
45572
  const drag = event.detail.owner;
45545
45573
  if (drag instanceof IgxColumnMovingDragDirective) {
45546
45574
  const column = drag.column;
@@ -45551,7 +45579,7 @@ class IgxGroupByAreaDirective {
45551
45579
  if (column.groupable && !isGrouped && !column.columnGroup && !!column.field) {
45552
45580
  const groupingExpression = {
45553
45581
  fieldName: column.field,
45554
- dir: SortingDirection.Asc,
45582
+ dir: ((_a = this.grid.sortingExpressions.find(expr => expr.fieldName === column.field)) === null || _a === void 0 ? void 0 : _a.dir) || SortingDirection.Asc,
45555
45583
  ignoreCase: column.sortingIgnoreCase,
45556
45584
  strategy: column.sortStrategy,
45557
45585
  groupingComparer: column.groupingComparer
@@ -51620,7 +51648,8 @@ class IgxGridBaseDirective extends DisplayDensityBase {
51620
51648
  this._setupServices();
51621
51649
  this._setupListeners();
51622
51650
  this.rowListDiffer = this.differs.find([]).create(null);
51623
- this.columnListDiffer = this.differs.find([]).create(null);
51651
+ // compare based on field, not on object ref.
51652
+ this.columnListDiffer = this.differs.find([]).create((index, col) => col.field);
51624
51653
  this.calcWidth = this.width && this.width.indexOf('%') === -1 ? parseInt(this.width, 10) : 0;
51625
51654
  this.shouldGenerate = this.autoGenerate;
51626
51655
  }
@@ -54021,6 +54050,20 @@ class IgxGridBaseDirective extends DisplayDensityBase {
54021
54050
  console.warn('The row with the specified PK or index is outside of the current data view.');
54022
54051
  }
54023
54052
  }
54053
+ /**
54054
+ * Update internal column's collection.
54055
+ *
54056
+ * @hidden
54057
+ */
54058
+ updateColumns(newColumns) {
54059
+ // update internal collections to retain order.
54060
+ this._pinnedColumns = newColumns
54061
+ .filter((c) => c.pinned).sort((a, b) => this._pinnedColumns.indexOf(a) - this._pinnedColumns.indexOf(b));
54062
+ this._unpinnedColumns = newColumns.filter((c) => !c.pinned);
54063
+ this.columnList.reset(newColumns);
54064
+ this.columnList.notifyOnChanges();
54065
+ this._columns = this.columnList.toArray();
54066
+ }
54024
54067
  /**
54025
54068
  * Enters add mode by spawning the UI at the specified index.
54026
54069
  *
@@ -54232,9 +54275,7 @@ class IgxGridBaseDirective extends DisplayDensityBase {
54232
54275
  const list = this.columnList.toArray();
54233
54276
  this._reorderColumns(from, to, pos, list);
54234
54277
  const newList = this._resetColumnList(list);
54235
- this.columnList.reset(newList);
54236
- this.columnList.notifyOnChanges();
54237
- this._columns = this.columnList.toArray();
54278
+ this.updateColumns(newList);
54238
54279
  }
54239
54280
  /**
54240
54281
  * @hidden
@@ -54662,6 +54703,20 @@ class IgxGridBaseDirective extends DisplayDensityBase {
54662
54703
  generateDataFields(data) {
54663
54704
  return Object.keys(data && data.length !== 0 ? data[0] : []);
54664
54705
  }
54706
+ /**
54707
+ * @hidden
54708
+ * @internal
54709
+ */
54710
+ _getResolvedDataIndex(index) {
54711
+ let newIndex = index;
54712
+ if ((index < 0 || index >= this.dataView.length) && this.pagingMode === 1 && this.paginator.page !== 0) {
54713
+ newIndex = index - this.paginator.perPage * this.paginator.page;
54714
+ }
54715
+ else if (this.gridAPI.grid.verticalScrollContainer.isRemote) {
54716
+ newIndex = index - this.gridAPI.grid.virtualizationState.startIndex;
54717
+ }
54718
+ return newIndex;
54719
+ }
54665
54720
  /**
54666
54721
  * @hidden
54667
54722
  */
@@ -54704,10 +54759,12 @@ class IgxGridBaseDirective extends DisplayDensityBase {
54704
54759
  */
54705
54760
  reinitPinStates() {
54706
54761
  this._pinnedColumns = this.columnList
54707
- .filter((c) => c.pinned).sort((a, b) => this._pinnedColumns.indexOf(a) - this._pinnedColumns.indexOf(b));
54762
+ .filter((c) => c.pinned)
54763
+ .sort((a, b) => this._pinnedColumns.indexOf(a) - this._pinnedColumns.indexOf(b));
54708
54764
  this._unpinnedColumns = this.hasColumnGroups ? this.columnList.filter((c) => !c.pinned) :
54709
54765
  this.columnList.filter((c) => !c.pinned)
54710
- .sort((a, b) => a.index - b.index);
54766
+ .sort((a, b) => this._unpinnedColumns.findIndex(x => x.field === a.field) -
54767
+ this._unpinnedColumns.findIndex(x => x.field === b.field));
54711
54768
  }
54712
54769
  extractDataFromSelection(source, formatters = false, headers = false, columnData) {
54713
54770
  var _a;
@@ -62613,19 +62670,8 @@ class IgxGridComponent extends IgxGridBaseDirective {
62613
62670
  */
62614
62671
  createRow(index, data) {
62615
62672
  let row;
62616
- let rec;
62617
- if (index < 0 || index >= this.dataView.length) {
62618
- if (this.pagingMode === 1 && this.paginator.page !== 0) {
62619
- rec = data !== null && data !== void 0 ? data : this.dataView[index - this.paginator.perPage * this.paginator.page];
62620
- }
62621
- else if (index >= this.dataView.length) {
62622
- const virtIndex = index - this.gridAPI.grid.virtualizationState.startIndex;
62623
- rec = data !== null && data !== void 0 ? data : this.dataView[virtIndex];
62624
- }
62625
- }
62626
- else {
62627
- rec = data !== null && data !== void 0 ? data : this.dataView[index];
62628
- }
62673
+ const dataIndex = this._getResolvedDataIndex(index);
62674
+ const rec = data !== null && data !== void 0 ? data : this.dataView[dataIndex];
62629
62675
  if (rec && this.isGroupByRecord(rec)) {
62630
62676
  row = new IgxGroupByRow(this, index, rec);
62631
62677
  }
@@ -62897,8 +62943,7 @@ class IgxGridStateDirective {
62897
62943
  newColumns.push(ref.instance);
62898
62944
  }
62899
62945
  });
62900
- context.currGrid.columnList.reset(newColumns);
62901
- context.currGrid.columnList.notifyOnChanges();
62946
+ context.grid.updateColumns(newColumns);
62902
62947
  }
62903
62948
  },
62904
62949
  groupBy: {
@@ -63210,7 +63255,8 @@ class IgxGridStateDirective {
63210
63255
  expr.searchVal = new Set(expr.searchVal);
63211
63256
  }
63212
63257
  else {
63213
- expr.searchVal = expr.searchVal && (dataType === 'date') ? new Date(Date.parse(expr.searchVal)) : expr.searchVal;
63258
+ expr.searchVal = expr.searchVal && (dataType === 'date' || dataType === 'dateTime')
63259
+ ? new Date(Date.parse(expr.searchVal)) : expr.searchVal;
63214
63260
  }
63215
63261
  expr.condition = this.generateFilteringCondition(dataType, expr.condition.name);
63216
63262
  expressionsTree.filteringOperands.push(expr);
@@ -65969,7 +66015,8 @@ class IgxTreeGridComponent extends IgxGridBaseDirective {
65969
66015
  */
65970
66016
  createRow(index, data) {
65971
66017
  let row;
65972
- const rec = data !== null && data !== void 0 ? data : this.dataView[index];
66018
+ const dataIndex = this._getResolvedDataIndex(index);
66019
+ const rec = data !== null && data !== void 0 ? data : this.dataView[dataIndex];
65973
66020
  if (this.isSummaryRow(rec)) {
65974
66021
  row = new IgxSummaryRow(this, index, rec.summaries, GridInstanceType.TreeGrid);
65975
66022
  }
@@ -68952,7 +68999,8 @@ class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirective {
68952
68999
  */
68953
69000
  createRow(index, data) {
68954
69001
  let row;
68955
- const rec = data !== null && data !== void 0 ? data : this.dataView[index];
69002
+ const dataIndex = this._getResolvedDataIndex(index);
69003
+ const rec = data !== null && data !== void 0 ? data : this.dataView[dataIndex];
68956
69004
  if (!row && rec && !rec.childGridsData) {
68957
69005
  row = new IgxHierarchicalGridRow(this, index, rec);
68958
69006
  }
@@ -69303,7 +69351,10 @@ class IgxGridHierarchicalPipe {
69303
69351
  result.push(v);
69304
69352
  const childGridsData = {};
69305
69353
  childKeys.forEach((childKey) => {
69306
- const childData = v[childKey] ? v[childKey] : null;
69354
+ if (!v[childKey]) {
69355
+ v[childKey] = [];
69356
+ }
69357
+ const childData = v[childKey];
69307
69358
  childGridsData[childKey] = childData;
69308
69359
  });
69309
69360
  if (grid.gridAPI.get_row_expansion_state(v)) {