Skip to content

igxTree BiState selection#9023

Merged
ViktorSlavov merged 1 commit intovslavov/tree-POCfrom
mevtimov/tree-selection
Mar 9, 2021
Merged

igxTree BiState selection#9023
ViktorSlavov merged 1 commit intovslavov/tree-POCfrom
mevtimov/tree-selection

Conversation

@mmart1n
Copy link
Contributor

@mmart1n mmart1n commented Feb 19, 2021

Closes #

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them

@mmart1n mmart1n closed this Feb 19, 2021
@mmart1n mmart1n reopened this Feb 19, 2021
@mmart1n mmart1n changed the base branch from vslavov/tree-POC to master February 19, 2021 10:36
@mmart1n mmart1n changed the base branch from master to vslavov/tree-POC February 19, 2021 10:37
@mmart1n mmart1n changed the base branch from vslavov/tree-POC to master February 19, 2021 10:42
@mmart1n mmart1n changed the base branch from master to vslavov/tree-POC February 19, 2021 10:43
@kdinev
Copy link
Member

kdinev commented Feb 19, 2021

@mmart1n Same suggestion as to @ViktorSlavov: catch up on unit tests and continue the development using a test-driven approach.

@mmart1n mmart1n marked this pull request as ready for review February 22, 2021 17:46
@mmart1n mmart1n requested a review from ViktorSlavov February 22, 2021 18:07
@mmart1n mmart1n changed the title igxTree selection igxTree BiState selection Feb 22, 2021
@mmart1n mmart1n changed the base branch from vslavov/tree-POC to master February 22, 2021 18:42
@mmart1n mmart1n changed the base branch from master to vslavov/tree-POC February 22, 2021 22:15
Copy link
Contributor

@ViktorSlavov ViktorSlavov left a comment

Choose a reason for hiding this comment

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

Looks good! A couple of minor comments.

Test review still pending

</ng-container>
</div>
<ng-container *ngIf="showSelectors">
<div class="igx-tree-node__select-marker" (pointerdown)="$event.preventDefault()" (click)="onSelectorClick($event)">
Copy link
Contributor

Choose a reason for hiding this comment

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

*ngIf can be here, no need for extra wrapper

protected treeService: IgxTreeService,
protected cdr: ChangeDetectorRef,
protected builder: AnimationBuilder,
public element: ElementRef<HTMLElement>,
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for this to be public

}

/**
* @hidden
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @hidden
* @hidden @internal

@Injectable()
export class IgxTreeSelectionService {
public tree: IgxTreeComponent;
public nodeSelection: Set<IgxTreeNodeComponent<any>> = new Set<IgxTreeNodeComponent<any>>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the interface here, not the component itself, as it would be a circular dependency otherwise

Suggested change
public nodeSelection: Set<IgxTreeNodeComponent<any>> = new Set<IgxTreeNodeComponent<any>>();
public nodeSelection: Set<IgxTreeNode<any>> = new Set<IgxTreeNode<any>>();

export class TreeFunctions {

public static getAllNodes(fix) {
return fix.debugElement.queryAll(By.css('igx-tree-node'));
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be constant, as the other query selectors

<ng-container *ngTemplateOutlet="selectMarkerTemplate, context: templateContext">
</ng-container>
</div>
<ng-container *ngIf="showSelectors">
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be moved on the div. No need for an extra wrapper element (even though ng-container is not generated).

*
* ```typescript
* // get the nativeElement of the second node
* let nodeNativeElement = this.tree.nodes.toArray()[1].nativeElement;
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this a bit, so it emphasizes on the property

Suggested change
* let nodeNativeElement = this.tree.nodes.toArray()[1].nativeElement;
* const node: IgxTreeNode = this.tree.nodes.first();
* const nodeElement: HTMLElement = node.nativeElement;

* @param nodes: IgxTreeNodeComponent<any>[]
* @param clearPrevSelection: boolean; if true clears the current selection
*/
public selectAll(nodes?: IgxTreeNodeComponent<any>[], clearPrevSelection?: boolean) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Bit of a nit pick, but I'd prefer clearPrevSelection to be explicitly false instead of undefined

Suggested change
public selectAll(nodes?: IgxTreeNodeComponent<any>[], clearPrevSelection?: boolean) {
public selectAll(nodes?: IgxTreeNodeComponent<any>[], clearPrevSelection = false) {

}
}

public isNodeSelected(node: IgxTreeNodeComponent<any>): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this ever used? Feel like it's a leftover.

@ViktorSlavov ViktorSlavov added 🛠️ status: in-development Issues and PRs with active development on them tree labels Feb 25, 2021
@teodosiah teodosiah added ❌ status: awaiting-test PRs awaiting manual verification and removed 🛠️ status: in-development Issues and PRs with active development on them labels Feb 25, 2021
@ViktorSlavov ViktorSlavov force-pushed the mevtimov/tree-selection branch from 63b8478 to 8cbbdae Compare March 1, 2021 09:44
@ViktorSlavov ViktorSlavov added the squash-merge Merge PR with "Squash and Merge" option label Mar 1, 2021
@mmart1n mmart1n added 🛠️ status: in-development Issues and PRs with active development on them and removed ❌ status: awaiting-test PRs awaiting manual verification labels Mar 1, 2021
@teodosiah teodosiah added ❌ status: awaiting-test PRs awaiting manual verification and removed 🛠️ status: in-development Issues and PRs with active development on them labels Mar 1, 2021
@ViktorSlavov ViktorSlavov mentioned this pull request Mar 1, 2021
@ViktorSlavov ViktorSlavov force-pushed the mevtimov/tree-selection branch from 04295af to b686a5c Compare March 9, 2021 13:15
@ViktorSlavov ViktorSlavov merged commit b686a5c into vslavov/tree-POC Mar 9, 2021
@ViktorSlavov
Copy link
Contributor

ViktorSlavov commented Mar 9, 2021

This is merged cause template changes are only happening here. Additional logic regarding selection is under dev in #9103

@ChronosSF ChronosSF deleted the mevtimov/tree-selection branch June 7, 2024 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

squash-merge Merge PR with "Squash and Merge" option tree ❌ status: awaiting-test PRs awaiting manual verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants