Skip to content

Commit 444551f

Browse files
authored
Merge branch '9.1.x' into ibarakov/fix-7072-9.1.x
2 parents e01bebb + 10c3b60 commit 444551f

29 files changed

+159
-122
lines changed

Diff for: .hooks/scripts/templates/default.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var defaults = {
1111
otherLine: 80,
1212
},
1313
issuePattern: '(#)[0-9]+',
14-
typesWithMandatoryIssue: [ 'feat', 'fix', 'test' ],
14+
typesWithMandatoryIssue: [],
1515
guidelinesUrl: 'https://bit.ly/angular-guidelines',
1616
types: [
1717
'feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'build', 'ci', 'revert'
@@ -20,4 +20,4 @@ var defaults = {
2020
oldMessagePath: path.join('.git', 'COMMIT_EDITMSG_OLD')
2121
}
2222

23-
module.exports = defaults;
23+
module.exports = defaults;

Diff for: .hooks/scripts/utils/issue-validator.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ var matchType = require('../common').matchType,
66
module.exports = (lines, options, errors) => {
77
var ticket = new RegExp(options.issuePattern);
88
var whetherIssueIsMandatory = false,
9-
wheterMatchAnyIssueRef = false;
9+
wheterMatchAnyIssueRef = false;
10+
1011

11-
1212
if (matchType(options.typesWithMandatoryIssue, lines[0])) {
1313
whetherIssueIsMandatory = true;
1414
}
@@ -27,7 +27,7 @@ module.exports = (lines, options, errors) => {
2727

2828
if (whetherIssueIsMandatory && !wheterMatchAnyIssueRef) {
2929
errors.push(errorFactory(
30-
`The issue reference for (${options.typesWithMandatoryIssue.join(', ')}) types is mandatory!\n`,
30+
`The issue reference for (${options.typesWithMandatoryIssue.join(', ')}) types is mandatory!\n`,
3131
"Please add at least one related issue. E.g: Closes #31, Closes #45"));
3232
}
33-
}
33+
}

Diff for: CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ All notable changes for each version of this project will be documented in this
77
### General
88
- `IgxHierarchicalGrid`
99
- `onGridInitialized` - New output has been exposed. Emitted after a grid is being initialized for the corresponding row island.
10-
10+
- **Behavioral Change** - When moving a column `DropPosition.None` is now acting like `DropPosition.AfterDropTarget`.
1111
## 9.1.0
1212

1313
### General

Diff for: projects/igniteui-angular/src/lib/date-picker/date-picker.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
<input
2525
class="igx-date-picker__input-date"
2626
igxInput
27-
[igxTextSelection]="true"
2827
type="text"
2928
[value]="transformedDate"
3029
[igxMask]="inputMask"
3130
[placeholder]="mask"
31+
[igxTextSelection]="true"
3232
[disabled]="disabled"
3333
[displayValuePipe]="displayValuePipe"
3434
[focusedValuePipe]="inputValuePipe"

Diff for: projects/igniteui-angular/src/lib/directives/scroll-inertia/scroll_inertia.directive.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ export class IgxScrollInertiaDirective implements OnInit, OnDestroy {
6262
private _nextX;
6363
private _nextY;
6464
private parentElement;
65+
private baseDeltaMultiplier = 1 / 120;
66+
private firefoxDeltaMultiplier = 1 / 30;
6567

6668
ngOnInit(): void {
6769
this._zone.runOutsideAngular(() => {
@@ -106,28 +108,30 @@ export class IgxScrollInertiaDirective implements OnInit, OnDestroy {
106108
if (evt.wheelDeltaX) {
107109
/* Option supported on Chrome, Safari, Opera.
108110
/* 120 is default for mousewheel on these browsers. Other values are for trackpads */
109-
scrollDeltaX = -evt.wheelDeltaX / 120;
111+
scrollDeltaX = -evt.wheelDeltaX * this.baseDeltaMultiplier;
110112

111113
if (-minWheelStep < scrollDeltaX && scrollDeltaX < minWheelStep) {
112114
scrollDeltaX = Math.sign(scrollDeltaX) * minWheelStep;
113115
}
114116
} else if (evt.deltaX) {
115117
/* For other browsers that don't provide wheelDelta, use the deltaY to determine direction and pass default values. */
116-
scrollDeltaX = this.calcAxisCoords(evt.deltaX, -1, 1);
118+
const deltaScaledX = evt.deltaX * (evt.deltaMode === 0 ? this.firefoxDeltaMultiplier : 1);
119+
scrollDeltaX = this.calcAxisCoords(deltaScaledX, -1, 1);
117120
}
118121

119122
/** Get delta for the Y axis */
120123
if (evt.wheelDeltaY) {
121124
/* Option supported on Chrome, Safari, Opera.
122125
/* 120 is default for mousewheel on these browsers. Other values are for trackpads */
123-
scrollDeltaY = -evt.wheelDeltaY / 120;
126+
scrollDeltaY = -evt.wheelDeltaY * this.baseDeltaMultiplier;
124127

125128
if (-minWheelStep < scrollDeltaY && scrollDeltaY < minWheelStep) {
126129
scrollDeltaY = Math.sign(scrollDeltaY) * minWheelStep;
127130
}
128131
} else if (evt.deltaY) {
129132
/* For other browsers that don't provide wheelDelta, use the deltaY to determine direction and pass default values. */
130-
scrollDeltaY = this.calcAxisCoords(evt.deltaY, -1, 1);
133+
const deltaScaledY = evt.deltaY * (evt.deltaMode === 0 ? this.firefoxDeltaMultiplier : 1);
134+
scrollDeltaY = this.calcAxisCoords(deltaScaledY, -1, 1);
131135
}
132136
if (scrollDeltaX && this.IgxScrollInertiaDirection === 'horizontal') {
133137
this._scrollToX(

Diff for: projects/igniteui-angular/src/lib/drop-down/drop-down-item.base.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export class IgxDropDownItemBaseDirective implements DoCheck {
187187
*
188188
* ```html
189189
* <!--set-->
190-
* <igx-dropdown-item *ngFor="let item of items">
190+
* <igx-drop-down-item *ngFor="let item of items">
191191
* <div *ngIf="items.indexOf(item) === 5; then item.isHeader = true">
192192
* {{item.field}}
193193
* </div>

Diff for: projects/igniteui-angular/src/lib/grids/cell.component.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,8 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
760760
return;
761761
}
762762
if (!isLeftClick(event)) {
763+
event.preventDefault();
764+
this.setActiveNode();
763765
this.selectionService.addKeyboardRange();
764766
this.selectionService.initKeyboardState();
765767
this.selectionService.primaryButton = false;
@@ -844,14 +846,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
844846
*/
845847
public activate(event: FocusEvent | KeyboardEvent) {
846848
const node = this.selectionNode;
847-
848-
if (this.grid.navigation.activeNode) {
849-
Object.assign(this.grid.navigation.activeNode, {row: this.rowIndex, column: this.visibleColumnIndex});
850-
} else {
851-
const layout = this.column.columnLayoutChild ? this.grid.navigation.layout(this.visibleColumnIndex) : null;
852-
this.grid.navigation.activeNode = { row: this.rowIndex, column: this.visibleColumnIndex, layout: layout };
853-
}
854-
849+
this.setActiveNode();
855850
const shouldEmitSelection = !this.selectionService.isActiveNode(node);
856851

857852
if (this.selectionService.primaryButton) {
@@ -916,4 +911,13 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
916911
meta.set('pinned', this.grid.isRecordPinnedByViewIndex(this.row.index));
917912
return meta;
918913
}
914+
915+
private setActiveNode() {
916+
if (this.grid.navigation.activeNode) {
917+
Object.assign(this.grid.navigation.activeNode, {row: this.rowIndex, column: this.visibleColumnIndex});
918+
} else {
919+
const layout = this.column.columnLayoutChild ? this.grid.navigation.layout(this.visibleColumnIndex) : null;
920+
this.grid.navigation.activeNode = { row: this.rowIndex, column: this.visibleColumnIndex, layout: layout };
921+
}
922+
}
919923
}

Diff for: projects/igniteui-angular/src/lib/grids/columns/column.component.ts

+24-7
Original file line numberDiff line numberDiff line change
@@ -1584,16 +1584,30 @@ export class IgxColumnComponent implements AfterContentInit {
15841584
this._pinned = true;
15851585
this.pinnedChange.emit(this._pinned);
15861586
this._unpinnedIndex = grid._unpinnedColumns.indexOf(this);
1587-
index = index !== undefined ? index : grid._pinnedColumns.length;
1587+
const rootPinnedCols = grid._pinnedColumns.filter((c) => c.level === 0);
1588+
index = index !== undefined ? index : rootPinnedCols.length;
15881589
const targetColumn = grid._pinnedColumns[index];
15891590
const args = { column: this, insertAtIndex: index, isPinned: true };
15901591
grid.onColumnPinning.emit(args);
15911592

15921593
if (grid._pinnedColumns.indexOf(this) === -1) {
1593-
grid._pinnedColumns.splice(args.insertAtIndex, 0, this);
1594+
if (!grid.hasColumnGroups) {
1595+
grid._pinnedColumns.splice(args.insertAtIndex, 0, this);
1596+
} else {
1597+
// insert based only on root collection
1598+
rootPinnedCols.splice(args.insertAtIndex, 0, this);
1599+
let allPinned = [];
1600+
// re-create hierarchy
1601+
rootPinnedCols.forEach(group => {
1602+
allPinned.push(group);
1603+
allPinned = allPinned.concat(group.allChildren);
1604+
});
1605+
grid._pinnedColumns = allPinned;
1606+
}
15941607

15951608
if (grid._unpinnedColumns.indexOf(this) !== -1) {
1596-
grid._unpinnedColumns.splice(grid._unpinnedColumns.indexOf(this), 1);
1609+
const childrenCount = this.allChildren.length;
1610+
grid._unpinnedColumns.splice(grid._unpinnedColumns.indexOf(this), 1 + childrenCount);
15971611
}
15981612
}
15991613

@@ -1650,13 +1664,16 @@ export class IgxColumnComponent implements AfterContentInit {
16501664

16511665
const targetColumn = grid._unpinnedColumns[index];
16521666

1653-
grid._unpinnedColumns.splice(index, 0, this);
1654-
if (grid._pinnedColumns.indexOf(this) !== -1) {
1655-
grid._pinnedColumns.splice(grid._pinnedColumns.indexOf(this), 1);
1667+
if (!hasIndex) {
1668+
grid._unpinnedColumns.splice(index, 0, this);
1669+
if (grid._pinnedColumns.indexOf(this) !== -1) {
1670+
grid._pinnedColumns.splice(grid._pinnedColumns.indexOf(this), 1);
1671+
}
16561672
}
16571673

1674+
16581675
if (hasIndex) {
1659-
grid._moveColumns(this, targetColumn);
1676+
grid.moveColumn(this, targetColumn);
16601677
}
16611678

16621679
if (this.columnGroup) {

Diff for: projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

+27-51
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,11 @@ import { IgxColumnGroupComponent } from './columns/column-group.component';
149149
import { IGridSortingStrategy } from '../data-operations/sorting-strategy';
150150
import { IgxRowDragGhostDirective, IgxDragIndicatorIconDirective } from './row-drag.directive';
151151
import { isNumber } from 'util';
152+
import { showMessage } from '../core/deprecateDecorators';
152153

153154
const MINIMUM_COLUMN_WIDTH = 136;
154155
const FILTER_ROW_HEIGHT = 50;
155-
156+
let warningShown = false;
156157
// By default row editing overlay outlet is inside grid body so that overlay is hidden below grid header when scrolling.
157158
// In cases when grid has 1-2 rows there isn't enough space in grid body and row editing overlay should be shown above header.
158159
// Default row editing overlay height is higher then row height that is why the case is valid also for row with 2 rows.
@@ -3758,21 +3759,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
37583759
*/
37593760
protected _moveColumns(from: IgxColumnComponent, to: IgxColumnComponent, pos: DropPosition) {
37603761
const list = this.columnList.toArray();
3761-
const fromIndex = list.indexOf(from);
3762-
let toIndex = list.indexOf(to);
3763-
3764-
if (pos === DropPosition.BeforeDropTarget) {
3765-
toIndex--;
3766-
if (toIndex < 0) {
3767-
toIndex = 0;
3768-
}
3769-
}
3770-
3771-
if (pos === DropPosition.AfterDropTarget) {
3772-
toIndex++;
3773-
}
3774-
3775-
list.splice(toIndex, 0, ...list.splice(fromIndex, 1));
3762+
this._reorderColumns(from, to, pos, list);
37763763
const newList = this._resetColumnList(list);
37773764
this.columnList.reset(newList);
37783765
this.columnList.notifyOnChanges();
@@ -3800,39 +3787,27 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
38003787
* @hidden
38013788
*/
38023789
protected _reorderColumns(from: IgxColumnComponent, to: IgxColumnComponent, position: DropPosition, columnCollection: any[]) {
3803-
let dropIndex = columnCollection.indexOf(to);
3804-
3805-
if (to.columnGroup) {
3806-
dropIndex += to.allChildren.length;
3807-
}
3790+
const fromIndex = columnCollection.indexOf(from);
3791+
const childColumnsCount = from.allChildren.length;
3792+
// remove item(s) to be moved.
3793+
const fromCollection = columnCollection.splice(fromIndex, childColumnsCount + 1);
38083794

3809-
if (position === DropPosition.BeforeDropTarget) {
3810-
dropIndex--;
3811-
}
3795+
let dropIndex = columnCollection.indexOf(to);
38123796

38133797
if (position === DropPosition.AfterDropTarget) {
38143798
dropIndex++;
3799+
if (to.columnGroup) {
3800+
dropIndex += to.allChildren.length;
3801+
}
38153802
}
3816-
3817-
columnCollection.splice(dropIndex, 0, ...columnCollection.splice(columnCollection.indexOf(from), 1));
3803+
columnCollection.splice(dropIndex, 0, ...fromCollection);
38183804
}
38193805
/**
38203806
* @hidden
38213807
*/
38223808
protected _moveChildColumns(parent: IgxColumnComponent, from: IgxColumnComponent, to: IgxColumnComponent, pos: DropPosition) {
38233809
const buffer = parent.children.toArray();
3824-
const fromIndex = buffer.indexOf(from);
3825-
let toIndex = buffer.indexOf(to);
3826-
3827-
if (pos === DropPosition.BeforeDropTarget) {
3828-
toIndex--;
3829-
}
3830-
3831-
if (pos === DropPosition.AfterDropTarget) {
3832-
toIndex++;
3833-
}
3834-
3835-
buffer.splice(toIndex, 0, ...buffer.splice(fromIndex, 1));
3810+
this._reorderColumns(from, to, pos, buffer);
38363811
parent.children.reset(buffer);
38373812
}
38383813
/**
@@ -3844,19 +3819,17 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
38443819
*/
38453820
public moveColumn(column: IgxColumnComponent, dropTarget: IgxColumnComponent, pos: DropPosition = DropPosition.None) {
38463821

3822+
if (column === dropTarget) {
3823+
return;
3824+
}
38473825
let position = pos;
3848-
const fromIndex = column.visibleIndex;
3849-
const toIndex = dropTarget.visibleIndex;
3850-
3851-
if (pos === DropPosition.BeforeDropTarget && fromIndex < toIndex) {
3852-
position = DropPosition.BeforeDropTarget;
3853-
} else if (pos === DropPosition.AfterDropTarget && fromIndex > toIndex) {
3854-
position = DropPosition.AfterDropTarget;
3855-
} else {
3856-
position = DropPosition.None;
3826+
if (position === DropPosition.None) {
3827+
warningShown = showMessage(
3828+
'DropPosition.None is deprecated.' +
3829+
'Use DropPosition.AfterDropTarget instead.',
3830+
warningShown);
3831+
position = DropPosition.AfterDropTarget;
38573832
}
3858-
3859-
38603833
if ((column.level !== dropTarget.level) ||
38613834
(column.topLevelParent !== dropTarget.topLevelParent)) {
38623835
return;
@@ -3914,6 +3887,9 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
39143887
if (this.hasColumnLayouts) {
39153888
this.columns.filter(x => x.columnLayout).forEach(x => x.populateVisibleIndexes());
39163889
}
3890+
// after reordering is done reset cached column collections.
3891+
this.resetColumnCollections();
3892+
column.resetCaches();
39173893

39183894
const args = {
39193895
source: column,
@@ -5197,8 +5173,8 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
51975173
* @hidden
51985174
*/
51995175
protected reinitPinStates() {
5200-
this._pinnedColumns = (this.hasColumnGroups) ? this.columnList.filter((c) => c.pinned) :
5201-
this.columnList.filter((c) => c.pinned).sort((a, b) => this._pinnedColumns.indexOf(a) - this._pinnedColumns.indexOf(b));
5176+
this._pinnedColumns = this.columnList
5177+
.filter((c) => c.pinned).sort((a, b) => this._pinnedColumns.indexOf(a) - this._pinnedColumns.indexOf(b));
52025178
this._unpinnedColumns = this.hasColumnGroups ? this.columnList.filter((c) => !c.pinned) :
52035179
this.columnList.filter((c) => !c.pinned)
52045180
.sort((a, b) => this._unpinnedColumns.indexOf(a) - this._unpinnedColumns.indexOf(b));

0 commit comments

Comments
 (0)