Skip to content

Column selection #6831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 87 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
e0847f0
feat(columnSelection): Add column selecation functionality #6578
nrobakova Feb 26, 2020
ef21b71
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
nrobakova Feb 26, 2020
782d554
chore(*): update selectMultipleColumns
nrobakova Feb 26, 2020
080fc76
chore(*): update styles and tests
nrobakova Feb 26, 2020
450fc37
chore(*): add columns selection with Shif+click
nrobakova Feb 28, 2020
46f1051
chore(*): update for cell aria-selected
nrobakova Feb 28, 2020
ef346bb
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
nrobakova Feb 28, 2020
7db8f22
Merge branch 'master' into nrobakova/column-selection
nrobakova Feb 28, 2020
1534c50
chore(*): update failing tests
nrobakova Feb 28, 2020
78520df
Merge branch 'nrobakova/column-selection' of https://github.com/Ignit…
nrobakova Feb 28, 2020
a444fbc
chore(*): update hgrid and tgrid tests
nrobakova Feb 28, 2020
7ea66ad
Merge branch 'master' into nrobakova/column-selection
nrobakova Feb 28, 2020
7869c63
chore(*): hover children when hover parent group
nrobakova Feb 28, 2020
bb84751
Merge branch 'nrobakova/column-selection' of https://github.com/Ignit…
nrobakova Feb 28, 2020
8cfafc4
chore(*): merge to master
nrobakova Mar 9, 2020
82fee6a
chore(*): update column selection in ESF
nrobakova Mar 9, 2020
111626d
chore(*): update change log and readme
nrobakova Mar 9, 2020
73bb564
chore(*): update column selection sample sample
nrobakova Mar 9, 2020
b0ae888
chore(*): merge to master
nrobakova Mar 9, 2020
044df82
Merge branch 'master' into nrobakova/column-selection
nrobakova Mar 10, 2020
423065f
chore(*): update for column groups
nrobakova Mar 10, 2020
fa7916a
chore(*): update when move a selectable column
nrobakova Mar 10, 2020
5ff7309
Merge branch 'nrobakova/column-selection' of https://github.com/Ignit…
nrobakova Mar 10, 2020
7eeed4e
Merge branch 'master' into nrobakova/column-selection
nrobakova Mar 10, 2020
4efe963
chore(*): update seeting column selection
nrobakova Mar 10, 2020
ee2a3f0
Merge branch 'nrobakova/column-selection' of https://github.com/Ignit…
nrobakova Mar 10, 2020
762f2cc
chore(*): update selected property
nrobakova Mar 10, 2020
3a333ae
chore(*): update event parameter when select a column
nrobakova Mar 11, 2020
60c987a
chore(*): fix hovering column group and selection in ESF
nrobakova Mar 12, 2020
549d73c
Update projects/igniteui-angular/src/lib/grids/columns/column-group.c…
nrobakova Mar 12, 2020
bceddee
Update projects/igniteui-angular/src/lib/grids/columns/column-group.c…
nrobakova Mar 12, 2020
9449348
Update projects/igniteui-angular/src/lib/grids/columns/column.compone…
nrobakova Mar 12, 2020
ea576ba
Update projects/igniteui-angular/src/lib/grids/columns/column-group.c…
nrobakova Mar 12, 2020
461069d
Update projects/igniteui-angular/src/lib/grids/columns/column.compone…
nrobakova Mar 12, 2020
b24e0f6
Update projects/igniteui-angular/src/lib/grids/columns/column.compone…
nrobakova Mar 12, 2020
b8ace57
Update projects/igniteui-angular/src/lib/grids/columns/column.compone…
nrobakova Mar 12, 2020
fb142c5
Merge branch 'master' into nrobakova/column-selection
nrobakova Mar 12, 2020
88748d7
chore(*): update selection of column group
nrobakova Mar 12, 2020
f4c0719
test(grid): add column selection tests #6885
nrobakova Mar 12, 2020
518a1b7
Merge branch 'nrobakova/column-selection' of https://github.com/Ignit…
nrobakova Mar 12, 2020
a128024
refactor(grid): change column selected background color
simeonoff Mar 12, 2020
2b0ca51
Merge branch 'master' into nrobakova/column-selection
nrobakova Mar 12, 2020
730e6f4
refactor(grid): adjust cell background to work with column selection
simeonoff Mar 13, 2020
0a4452b
Merge branch 'nrobakova/column-selection' of github.com:IgniteUI/igni…
simeonoff Mar 13, 2020
6f8a39a
chore(*): update failing tests
nrobakova Mar 13, 2020
cae3d4a
Merge branch 'nrobakova/column-selection' of https://github.com/Ignit…
nrobakova Mar 13, 2020
a8da70f
chore(*): add select all method
nrobakova Mar 13, 2020
d6926b0
Merge branch 'nrobakova/column-selection' of https://github.com/Ignit…
nrobakova Mar 13, 2020
01ea440
chore(*): add selection tests
nrobakova Mar 13, 2020
5e36073
chore(*): small update to selection tests
nrobakova Mar 13, 2020
b0bbf2c
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
nrobakova Mar 13, 2020
1e1d937
chore(*): update for ESF min max height
nrobakova Mar 13, 2020
686cb03
chore(*): update for column groups selection
nrobakova Mar 16, 2020
2abc489
chore(*): update order in ESF
nrobakova Mar 16, 2020
baa6815
Merge branch 'master' into nrobakova/column-selection
nrobakova Mar 16, 2020
916d3f9
Merge branch 'nrobakova/column-selection' of https://github.com/Ignit…
nrobakova Mar 16, 2020
7fb0277
test(*): add excel style filtering column selection tests
Aleksandyr Mar 16, 2020
0587898
merge
Aleksandyr Mar 16, 2020
982adba
test(*): remove column selection click header func
Aleksandyr Mar 16, 2020
f5af9fa
chore(*): update tests for selecting groups
nrobakova Mar 16, 2020
53260c3
Merge branch 'nrobakova/column-selection-tests' of https://github.com…
nrobakova Mar 16, 2020
afb972c
test(column-selection): verify all cells selection when using esf
Aleksandyr Mar 16, 2020
b7e6530
chore(*): add column selection integration tests
nrobakova Mar 16, 2020
a47b89e
Merge branch 'nrobakova/column-selection-tests' of https://github.com…
Aleksandyr Mar 17, 2020
cd09250
chore(*): update selected property for column group
nrobakova Mar 17, 2020
f876538
Merge branch 'nrobakova/column-selection' of https://github.com/Ignit…
Aleksandyr Mar 17, 2020
378c4ec
test(column-group/selection): column group selection tests
Aleksandyr Mar 17, 2020
f84b993
Merge branch 'nrobakova/column-selection' of https://github.com/Ignit…
nrobakova Mar 17, 2020
b84c97f
chore(*): update for column groups
nrobakova Mar 17, 2020
e64592d
merge: conflickts
nrobakova Mar 17, 2020
e924fe3
chore(*): update for column groups
nrobakova Mar 17, 2020
2e17d8b
chore(*): revert update for column groups
nrobakova Mar 17, 2020
17c0f98
merge: merge conflicts
nrobakova Mar 17, 2020
b725425
merge
Aleksandyr Mar 17, 2020
39006ae
Merge branch 'nrobakova/column-selection-tests' of https://github.com…
Aleksandyr Mar 17, 2020
f075b4c
test(column-group/selection): finalize whole suite around col group/s…
Aleksandyr Mar 17, 2020
6747fdb
chore(*): update failing tests
nrobakova Mar 18, 2020
0bff6a6
test(column-selection): add hidden col api seleciton manipulation
Aleksandyr Mar 18, 2020
7eafb75
Merge branch 'nrobakova/column-selection-tests' of https://github.com…
Aleksandyr Mar 18, 2020
d81301e
chore(*): update for the group
nrobakova Mar 18, 2020
134bb78
Merge branch 'nrobakova/column-selection' of https://github.com/Ignit…
nrobakova Mar 18, 2020
ff44da3
chore(*): remove input for selectable for groups
nrobakova Mar 18, 2020
a7f263e
Merge branch 'master' into nrobakova/column-selection
nrobakova Mar 18, 2020
fe98835
Merge branch 'nrobakova/column-selection' of https://github.com/Ignit…
nrobakova Mar 18, 2020
9efa049
chore(*): update failing master details tests
nrobakova Mar 18, 2020
8e7929b
Merge pull request #6900 from IgniteUI/nrobakova/column-selection-tests
zdrawku Mar 18, 2020
68daeb9
merge: merge master
nrobakova Mar 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes for each version of this project will be documented in this

## 9.1.0

### General
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
- **Behavioral Change** - When a column is sortable sort indicator is always visible. The column is sorted when click on it.

### Themes
- **Breaking Change** Change the default `$legacy-support` value to false in the `igx-theme` function.

Expand All @@ -17,14 +21,25 @@ All notable changes for each version of this project will be documented in this
```typescript
public pinningConfiguration: IPinningConfig = { columns: ColumnPinningPosition.End };
```
- Added functionality for column selection.
- `selected` property has been added to the IgxColumnComponent; Allows you to set whether the column is selected.
- `selectable` property has been added to the IgxColumnComponent; Allows you to set whether the column is selectable.
- `onColumnSelectionChange` event is added for the `IgxGrid`. It is emitted when the column selection is changed.
- `excelStyleSelectingTemplate` property is introduced to IgxGrid, which allows you to set a custom template for the selecting a column in the Excel Style Filter.
- `selectedColumns` API method is added for the `IgxGrid`. It allows to get all selected columns.
- `selectColumns` API method is added for the `IgxGrid`. It allows to select columns by passing array of IgxColumnComponent or column fields.
- `deselectColumns` API method is added for the `IgxGrid`. It allows to deselect columns by passing array of IgxColumnComponent or column fields.
- `deselectAllColumns` API method is added for the `IgxGrid`. It allows to deselect all columns.
- `getSelectedColumnsData` API method is added for the `IgxGrid`. It allows to get the selected columns data.

- `IgxCombo`:
- Added `autoFocusSearch` input that allows to manipulate the combo's opening behavior. When the property is `true` (by default), the combo's search input is focused on open. When set to `false`, the focus goes to the combo items container, which can be used to prevent the software keyboard from activating on mobile devices when opening the combo.

### RTL Support
- `igxSlider` have full right-to-left (RTL) support.

## 9.0.1
- **Breaking Changes**
- **Breaking Changes**
- Remove `$base-color` from igx-typography. The igx-typography class now inherits the parent color.

## 9.0.0
Expand Down
2 changes: 2 additions & 0 deletions projects/igniteui-angular/src/lib/core/i18n/grid-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export interface IGridResourceStrings {
igx_grid_excel_show?: string;
igx_grid_excel_pin?: string;
igx_grid_excel_unpin?: string;
igx_grid_excel_select?: string;
igx_grid_excel_text_filter?: string;
igx_grid_excel_number_filter?: string;
igx_grid_excel_date_filter?: string;
Expand Down Expand Up @@ -162,6 +163,7 @@ export const GridResourceStringsEN: IGridResourceStrings = {
igx_grid_excel_show: 'Show column',
igx_grid_excel_pin: 'Pin column',
igx_grid_excel_unpin: 'Unpin column',
igx_grid_excel_select: 'Select column',
igx_grid_excel_text_filter: 'Text filter',
igx_grid_excel_number_filter: 'Number filter',
igx_grid_excel_date_filter: 'Date filter',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@
@extend %grid-excel-actions__action !optional;
}

@include e(actions-select) {
@extend %grid-excel-actions__action !optional;
}

@include e(actions-selected) {
@extend %grid-excel-actions__action !optional;
@extend %grid-excel-actions--selected !optional;
}

@include e(actions-filter) {
@extend %grid-excel-actions__action !optional;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@
padding: rem(8px) rem(16px);
}

%grid-excel-actions--selected {
igx-icon {
color: igx-color($palette, 'secondary');
}
}

%grid-excel-move {
margin-bottom: rem(8px);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@
@extend %igx-grid__th--sortable !optional;
}

@include e(th, $m: selectable) {
@extend %igx-grid__th--selectable !optional;
}

@include e(th, $m: filtrable) {
@extend %igx-grid__th--filtrable !optional;
}
Expand All @@ -245,6 +249,10 @@
@extend %igx-grid__th--sorted !optional;
}

@include e(th, $m: selected) {
@extend %igx-grid__th--selected !optional;
}

@include e(th, $m: number) {
@extend %grid-cell-number !optional;
}
Expand Down Expand Up @@ -301,6 +309,14 @@
@extend %grid-cell--selected !optional;
}

@include e(td, $m: column-selected) {
@extend %grid-cell--column-selected !optional;
}

@include e(td, $mods: (selected, column-selected)) {
@extend %grid-cell--cross-selected !optional;
}

@include e(tr, $mods: (selected, filtered)) {
@extend %grid-row--selected--filtered !optional;
}
Expand Down Expand Up @@ -372,6 +388,10 @@
@extend %grid-cell--pinned-selected !optional;
}

@include e(td, $mods: (pinned, column-selected)) {
@extend %grid-cell--pinned--column-selected !optional;
}

@include e(td-text) {
@extend %grid-cell-text !optional;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,20 @@
}
}

%grid-cell--column-selected {
color: --var($theme, 'row-selected-text-color');
background: --var($theme, 'row-selected-background');

&:hover {
background: --var($theme, 'row-selected-hover-background');
color: --var($theme, 'row-selected-text-color');
}
}

%grid-cell--cross-selected {
background: --var($theme, 'row-selected-cell-background');
}

%igx-grid__td--edited {
%grid-cell-text {
font-style: italic;
Expand Down Expand Up @@ -1331,6 +1345,16 @@
// border-bottom: 0;
}

%grid-cell--pinned--column-selected {
color: --var($theme, 'row-selected-text-color');
background: --var($theme, 'row-selected-background');

&:hover {
background: --var($theme, 'row-selected-hover-background');
color: --var($theme, 'row-selected-text-color');
}
}

%grid-cell--pinned-last {
border-#{$right}: map-get($cell-pin, 'style') map-get($cell-pin, 'color') !important;

Expand Down Expand Up @@ -1447,36 +1471,29 @@
justify-content: normal;
}

%igx-grid__th--selectable {
color: --var($theme, 'row-selected-text-color');
background: --var($theme, 'row-selected-background');
opacity: .7;
}

%igx-grid__th--selected {
color: --var($theme, 'row-selected-text-color');
background: --var($theme, 'row-selected-cell-background');
}

%igx-grid__th--sortable {
&:hover {
.sort-icon {
cursor: pointer;
opacity: .7;

%grid-cell-header-title {
cursor: pointer;
&:hover {
opacity: 1;
}

.sort-icon {
opacity: .7;

&:hover {
opacity: 1;
}
}
}
}

%igx-grid__th--sorted {
%grid-cell-header-title {
opacity: 1;
}

&:hover{
.sort-icon {
opacity: 1;
}
}

.sort-icon {
opacity: 1;
color: --var($theme, 'sorted-header-icon-color');
Expand Down
8 changes: 8 additions & 0 deletions projects/igniteui-angular/src/lib/grids/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ A list of the events emitted by the **igx-grid**:
|`onColumnMovingStart`|Emitted when a column moving starts. Returns the moved column object.|
|`onSelection`|Emitted when a cell is selected. Returns the cell object.|
|`onRowSelectionChange`|Emitted when a row selection has changed. Returns array with old and new selected rows' IDs and the target row, if available.|
|`onColumnSelectionChange`|Emitted when a column selection has changed. Returns array with old and new selected column' fields|
|`onColumnInit`|Emitted when the grid columns are initialized. Returns the column object.|
|`onSortingDone`|Emitted when sorting is performed through the UI. Returns the sorting expression.|
|`onFilteringDone`|Emitted when filtering is performed through the UI. Returns the filtering expressions tree of the column for which the filtering was performed.|
Expand Down Expand Up @@ -290,6 +291,11 @@ Here is a list of all public methods exposed by **igx-grid**:
|`deselectRows(rowIDs: any[])`|Removes the specified row(s) from the grid's selection in the `selectionAPI`.|
|`selectAllRows()`|Marks all rows as selected in the grid `selectionAPI`.|
|`deselectAllRows()`|Sets the grid's row selection in the `selectionAPI` to `[]`.|
|`selectedColumns()`|Returns array of the currently selected columns|
|`selectColumns(columns: string[] | IgxColumnComponent[], clearCurrentSelection?: boolean)`|Marks the specified columns as selected in the grid `selectionAPI`. `clearCurrentSelection` first empties the grid's selection array.|
|`deselectColumns(columns: string[] | IgxColumnComponent[])`|Removes the specified columns from the grid's selection in the `selectionAPI`.|
|`deselectAllColumns()`|Sets the grid's column selection in the `selectionAPI` to `[]`.|
|`getSelectedColumnsData()`|Gets the the data form current selected columns.|
|`findNext(text: string, caseSensitive?: boolean, exactMatch?: boolean)`|Highlights all occurrences of the specified text and marks the next occurrence as active.|
|`findPrev(text: string, caseSensitive?: boolean, exactMatch?: boolean)`|Highlights all occurrences of the specified text and marks the previous occurrence as active.|
|`clearSearch(text: string, caseSensitive?: boolean)`|Removes all search highlights from the grid.|
Expand Down Expand Up @@ -324,6 +330,8 @@ Inputs available on the **IgxGridColumnComponent** to define columns:
|`hidden`|boolean|Visibility of the column|
|`movable`|boolean|Set column to be movable|
|`resizable`|boolean|Set column to be resizable|
|`selectable`|boolean|Set column to be selectable|
|`selected`|boolean|Set column to be selected|
|`width`|string|Columns width|
|`minWidth`|string|Columns minimal width|
|`maxWidth`|string|Columns miximum width|
Expand Down
18 changes: 17 additions & 1 deletion projects/igniteui-angular/src/lib/grids/cell.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,18 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
@Input()
width = '';

@HostBinding('attr.aria-selected')
get ariaSelected() {
return this.selected || this.column.selected || this.row.selected;
}

/**
* Gets whether the cell is selected.
* ```typescript
* let isSelected = this.cell.selected;
* ```
* @memberof IgxGridCellComponent
*/
@HostBinding('attr.aria-selected')
@HostBinding('class.igx-grid__td--selected')
get selected() {
return this.selectionService.selected(this.selectionNode);
Expand All @@ -458,6 +462,18 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
this.grid.notifyChanges();
}

/**
* Gets whether the cell column is selected.
* ```typescript
* let isCellColumnSelected = this.cell.columnSelected;
* ```
* @memberof IgxGridCellComponent
*/
@HostBinding('class.igx-grid__td--column-selected')
get columnSelected() {
return this.selectionService.isColumnSelected(this.column.field);
}

@HostBinding('class.igx-grid__td--edited')
get dirty() {
if (this.grid.rowEditable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,19 @@ export class IgxColumnGroupComponent extends IgxColumnComponent implements After
*/
public set filters(classRef: any) { }

/**
* Returns if the column group is selectable
* ```typescript
* let columnGroupSelectable = this.columnGroup.selectable;
* ```
* @memberof IgxColumnGroupComponent
*/
public get selectable(): boolean {
return this.children && this.children.some(child => child.selectable);
}

public set selectable(value: boolean) {}

/**
* Returns a reference to the body template.
* ```typescript
Expand Down Expand Up @@ -206,13 +219,40 @@ export class IgxColumnGroupComponent extends IgxColumnComponent implements After
if (this._hidden || !this.collapsible) {
this.children.forEach(child => child.hidden = this._hidden);
} else {
this.children.forEach(c => {
if (c.visibleWhenCollapsed === undefined) {c.hidden = false; return; }
this.children.forEach(c => {
if (c.visibleWhenCollapsed === undefined) { c.hidden = false; return; }
c.hidden = this.expanded ? c.visibleWhenCollapsed : !c.visibleWhenCollapsed;
});
}
}

/**
* Returns if the column group is selected.
* ```typescript
* let isSelected = this.columnGroup.selected;
* ```
* @memberof IgxColumnGroupComponent
*/
get selected(): boolean {
const selectableChildren = this.allChildren.filter(c => !c.columnGroup && c.selectable && !c.hidden);
return selectableChildren.length > 0 && selectableChildren.every(c => c.selected);
}

/**
* Enables/Disables the column group selection.
* ```html
* <igx-column [selected] = "true"></igx-column>
* ```
* @memberof IgxColumnGroupComponent
*/
set selected(value: boolean) {
if (this.selectable) {
this.children.forEach(c => {
c.selected = value;
});
}
}

/**
*@hidden
*/
Expand Down Expand Up @@ -299,6 +339,24 @@ export class IgxColumnGroupComponent extends IgxColumnComponent implements After

set width(val) { }

/**
*@hidden
*/
public get applySelectableClass(): boolean {
return this._applySelectableClass;
}

/**
*@hidden
*/
public set applySelectableClass(value: boolean) {
if (this.selectable) {
this._applySelectableClass = value;
this.children.forEach(c => {
c.applySelectableClass = value;
});
}
}
// constructor(public gridAPI: GridBaseAPIService<IgxGridBaseDirective & IGridDataBindable>, public cdr: ChangeDetectorRef) {
// // D.P. constructor duplication due to es6 compilation, might be obsolete in the future
// super(gridAPI, cdr);
Expand Down
Loading