Skip to content
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

igxGrid - refactor header and filter cell components 6.2.x #3017

Merged
merged 39 commits into from
Nov 23, 2018

Conversation

SAndreeva
Copy link
Contributor

@SAndreeva SAndreeva commented Nov 14, 2018

Closes #2972, Closes #2926, Closes #2923, Closes #2917, Closes #2783, Closes #3027, Closes #2938.

This PR introduces the following changes that are with high regression potential:

  • a new component (header group) to accommodate the header and filtering cell components;
  • all column moving and column resizing related DOM structures are moved to the new header group component;
  • MCH are hierarchical structure, comprising of these header group components, only the deepest groups should have a header and a filter cell;
  • the old header component is cleaned up, it takes care only for sorting;
  • column resizing base logic is moved to a separate service;

# Conflicts:
#	projects/igniteui-angular/src/lib/grids/column.component.ts
#	projects/igniteui-angular/src/lib/grids/grid-header.component.ts
#	projects/igniteui-angular/src/lib/grids/grid/grid.component.html
#	projects/igniteui-angular/src/lib/grids/grid/grid.component.ts
#	projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.component.html
# Conflicts:
#	projects/igniteui-angular/src/lib/grids/column.component.ts
#	projects/igniteui-angular/src/lib/grids/grid-base.component.ts
#	projects/igniteui-angular/src/lib/grids/grid-header-group.component.html
#	projects/igniteui-angular/src/lib/grids/grid-header-group.component.ts
#	projects/igniteui-angular/src/lib/grids/grid/grid.component.html
#	projects/igniteui-angular/src/lib/grids/grid/grid.component.ts
#	projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.component.html
import { DefaultSortingStrategy, ISortingStrategy } from '../data-operations/sorting-strategy';
import { valToPxlsUsingRange, flatten } from '../core/utils';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valToPxlsUsingRange name sounds weird. Could we change it to something like getNodeSizeViaRange?

@SAndreeva SAndreeva added 💥 status: in-test PRs currently being tested and removed 🛠️ status: in-development Issues and PRs with active development on them labels Nov 21, 2018
@npaunov npaunov added ✅ status: verified Applies to PRs that have passed manual verification and removed 💥 status: in-test PRs currently being tested labels Nov 21, 2018
@@ -575,8 +575,8 @@ export class IgxDragDirective implements OnInit, OnDestroy {
* Create dragGhost element - copy of the base element. Bind all needed events.
* @param event Pointer event required when the dragGhost is being initialized.
*/
protected createDragGhost(event) {
this._dragGhost = this.element.nativeElement.cloneNode(true);
protected createDragGhost(event, node = null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might define the type of the node so if someone needs to use this method to be aware of the type.

/**
* @hidden
*/
get headerCheckboxWidth() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all paths return value.

public resizeEndTimeout = isFirefox() ? 200 : 0;
public column: IgxColumnComponent;

private pinnedMaxWidth;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put private members before the public ones.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add type to this member.


public startResizePos: number;
public isColumnResizing: boolean;
public resizeCursor: any = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this could be 'string' instead of 'any'.

}
}

public autosizeColumnOnDblClick() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might document the public members (methods, properties) even though this service is for internal use only.

}
}

public resizeColumn(event) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put a type on the argument.

selector: 'igx-grid-header-group',
templateUrl: './grid-header-group.component.html'
})
export class IgxGridHeaderGroupComponent implements DoCheck {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might document all public members even thought this class is excluded from typedoc generation.

'igx-grid__th--filtering': this.isFiltered
};

Object.entries(classList).forEach(([klass, value]) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

klass should be class.

if (!this.column.pinned) {
return null;
}
return 9999 - this.grid.pinnedColumns.indexOf(this.column);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic number (9999) should be defined as constant in the class.

bkulov
bkulov previously approved these changes Nov 22, 2018

if (this.moreIcon) {
this.filteringService.columnToMoreIconHidden.set(this.column.field, true);
}
this.cdr.detectChanges();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this extra change detection cycle here?

Copy link
Contributor

@bkulov bkulov Nov 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The idea is to initially show all chips, measure them and hide the ones which don't fit.

rkaraivanov
rkaraivanov previously approved these changes Nov 22, 2018
@bkulov bkulov dismissed stale reviews from rkaraivanov and themself via 67910c3 November 22, 2018 15:26
bkulov
bkulov previously approved these changes Nov 22, 2018
@kdinev kdinev merged commit 00a73cf into 6.2.x Nov 23, 2018
@kdinev kdinev deleted the SAndreeva/header-group-component-6.2.x branch November 23, 2018 08:17
bkulov pushed a commit that referenced this pull request Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grid: general version: 6.2.x ✅ status: verified Applies to PRs that have passed manual verification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants