Skip to content

Commit 7f15032

Browse files
authored
Merge branch 'master' into mpopov/button-group-margin-safari-MASTER
2 parents 64553fa + dedf987 commit 7f15032

26 files changed

+321
-227
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ All notable changes for each version of this project will be documented in this
1515
- Added `closeOnEscape` - with it, the dialog can be allowed or prevented from closing when `Esc` is pressed.
1616
- `IgxNavbar`:
1717
- **Breaking Changes** - The `igx-action-icon` has been renamed to `igx-navbar-action`. It should get renamed in your components via `ng update`;
18+
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
19+
- **Breaking Change** - The `selectedRows` method is now an `@Input` property. Setting it to an array of Row IDs will update the grid's selection state, any previous selection will be cleared. Setting it to an empty array will clear the selection entirely.
1820
- `igxGrid`
1921
- Added `onScroll` event, which is emitted when the grid is scrolled vertically or horizontally.
2022
- Each grid now expose a default handling for boolean column types. The column will display `check` or `close` icon, instead of true/false by default.
@@ -46,6 +48,7 @@ The following example shows how you can use the Indigo theme:
4648
}
4749
```
4850

51+
4952
### New Features
5053
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
5154
- Introduced `showSummaryOnCollapse` grid property which allows you to control whether the summary row stays visible when the groupBy / parent row is collapsed.

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-theme.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,15 +1587,16 @@
15871587
}
15881588

15891589
%igx-grid__th--active {
1590-
%grid-cell-header,
1590+
@extend %grid-cell--active;
1591+
15911592
%igx-grid__th--selected,
15921593
%igx-grid__th--selectable {
1593-
@extend %grid-cell--active
1594+
@extend %grid-cell--active;
15941595
}
15951596
}
15961597

15971598
%igx-grid-summary--active {
1598-
@extend %grid-cell--active
1599+
@extend %grid-cell--active;
15991600
}
16001601

16011602
%igx-grid__th--sortable {

projects/igniteui-angular/src/lib/core/styles/themes/schemas/dark/_grid.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,9 @@ $_dark-indigo-grid: extend(
443443

444444
cell-selected-background: (
445445
igx-color: ('grays', 200),
446+
to-opaque: (
447+
igx-color: 'surface',
448+
)
446449
),
447450

448451
cell-selected-text-color: (

projects/igniteui-angular/src/lib/core/styles/themes/schemas/light/_grid.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,8 @@ $_indigo-grid: extend(
688688

689689
cell-selected-background: (
690690
igx-color: ('primary', 50),
691-
rgba: .5
691+
rgba: .5,
692+
to-opaque: #fff
692693
),
693694

694695
cell-active-border-color: (

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

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import {
2525
InjectionToken,
2626
Optional,
2727
DoCheck,
28-
Directive
28+
Directive,
29+
OnChanges,
30+
SimpleChanges
2931
} from '@angular/core';
3032
import ResizeObserver from 'resize-observer-polyfill';
3133
import 'igniteui-trial-watermark';
@@ -1093,6 +1095,26 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
10931095
filteringExpressionsTree: IFilteringExpressionsTree,
10941096
done: (values: any[]) => void) => void;
10951097

1098+
/**
1099+
* Gets/Sets the current selection state.
1100+
* @remarks
1101+
* Represents the selected rows' IDs (primary key or rowData)
1102+
* @example
1103+
* ```html
1104+
* <igx-grid [data]="localData" primaryKey="ID" rowSelection="multiple" [selectedRows]="[0, 1, 2]"><igx-grid>
1105+
* ```
1106+
*/
1107+
@Input()
1108+
public set selectedRows(rowIDs: any[]) {
1109+
rowIDs.length > 0
1110+
? this.selectRows(rowIDs, true)
1111+
: this.deselectAllRows();
1112+
}
1113+
1114+
public get selectedRows(): any[] {
1115+
return this.selectionService.getSelectedRows();
1116+
}
1117+
10961118
/**
10971119
* Emitted when `IgxGridCellComponent` is clicked.
10981120
* @remarks
@@ -5291,18 +5313,6 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
52915313
[...this.unpinnedDataView, ...this.pinnedDataView];
52925314
}
52935315

5294-
/**
5295-
* Get current selection state.
5296-
* @example
5297-
* Returns an array with selected rows' IDs (primaryKey or rowData)
5298-
* ```typescript
5299-
* const selectedRows = this.grid.selectedRows();
5300-
* ```
5301-
*/
5302-
public selectedRows(): any[] {
5303-
return this.selectionService.getSelectedRows();
5304-
}
5305-
53065316
/**
53075317
* Select specified rows by ID.
53085318
* @example
@@ -5487,6 +5497,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
54875497
}
54885498

54895499
for (let [row, set] of selectionMap) {
5500+
row = this.paging ? row + (this.perPage * this.page) : row;
54905501
row = isRemote ? row - this.virtualizationState.startIndex : row;
54915502
if (!source[row] || source[row].detailsData !== undefined) {
54925503
continue;

projects/igniteui-angular/src/lib/grids/grid/grid-clipboard.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,22 @@ describe('IgxGrid - Clipboard #grid', () => {
9090
expect(eventData).toEqual('Downloads\tReleased\r\n127\ttrue\r\n20\t\r\n');
9191
});
9292

93+
it('Copy data when paging is enabled', () => {
94+
grid.paging = true;
95+
grid.perPage = 5;
96+
fix.detectChanges();
97+
grid.page = 1;
98+
fix.detectChanges();
99+
const copySpy = spyOn<any>(grid.onGridCopy, 'emit').and.callThrough();
100+
grid.clipboardOptions.copyHeaders = false;
101+
grid.selectRange({ rowStart: 1, rowEnd: 2, columnStart: 2, columnEnd: 3 });
102+
fix.detectChanges();
103+
104+
const eventData = dispatchCopyEventOnGridBody(fix);
105+
expect(copySpy).toHaveBeenCalledTimes(1);
106+
expect(eventData).toEqual('0\ttrue\r\n1000\t\r\n');
107+
});
108+
93109
it('Disable clipboardOptions', () => {
94110
const copySpy = spyOn<any>(grid.onGridCopy, 'emit').and.callThrough();
95111
grid.clipboardOptions.enabled = false;

0 commit comments

Comments
 (0)