Skip to content

feat(popover-edit): Adds support for spanning multiple columns and se… #15724

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

Conversation

kseamon
Copy link
Collaborator

@kseamon kseamon commented Apr 4, 2019

…tting width of the popup based on the size of the cell(s)

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 4, 2019
@kseamon
Copy link
Collaborator Author

kseamon commented Apr 4, 2019

@crisbeto This uses the approach you suggested in #15691

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

Overall looks for to move forward aside JsDoc and little stuff

cc @crisbeto

Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

Left some nits, but the approach LGTM.

@kseamon kseamon marked this pull request as ready for review April 5, 2019 19:18
@kseamon kseamon requested a review from andrewseguin as a code owner April 5, 2019 19:18
@kseamon kseamon force-pushed the popover-edit-mvp-position-experiment branch 2 times, most recently from b341159 to 77694f0 Compare April 5, 2019 19:46
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

LGTM overall, left a few more nits.

@@ -24,19 +36,39 @@ export abstract class PopoverEditPositionStrategyFactory {
*/
@Injectable()
export class DefaultPopoverEditPositionStrategyFactory extends PopoverEditPositionStrategyFactory {
constructor(protected readonly overlay: Overlay) {
constructor(protected readonly direction: Directionality, protected readonly overlay: Overlay) {
Copy link
Member

Choose a reason for hiding this comment

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

The readonly part here seems a little redudant. If somebody decides to change these, they either know what they're doing or they're shooting themselves in the foot.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I disagree - if someone wants to override these they can do it via the DI system.

Maybe this comes down to philosophy, but IMO readonly and const should be used everywhere that mutability is not a requirement.

}

private _getOverlayCells(): HTMLElement[] {
const cell = closest(this.elementRef.nativeElement!, CELL_SELECTOR) as HTMLElement;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should make closest accept an ElementRef so that we don't have to repeat .nativeElement everywhere. There's also a coerceElement in @angular/cdk/coercion to make it a little easier.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OTOH, next year when Angular Material drops support for IE11 I'd like to remove closest and use the native closet directly.


const row = closest(this.elementRef.nativeElement!, ROW_SELECTOR)!;
const rowCells = Array.from(row.querySelectorAll(CELL_SELECTOR)) as HTMLElement[];
const ownIndex = rowCells.indexOf(cell);
Copy link
Member

Choose a reason for hiding this comment

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

Since you're only using the array for the indexOf, you could shorten it a bit to Array.prototype.indexOf.call(row.querySelectorAll(CELL_SELECTOR), cell).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's also using slice below - my initial implementation did use the Array.prototype methods but @jelbourn said to use Array.from instead.

@kseamon kseamon force-pushed the popover-edit-mvp-position-experiment branch 3 times, most recently from 15cb0f0 to 58382c2 Compare April 8, 2019 19:17
…tting width of the popup based on the size of the cell(s)
@kseamon kseamon force-pushed the popover-edit-mvp-position-experiment branch from 58382c2 to f3080b4 Compare April 8, 2019 19:24
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release target: major This PR is targeted for the next major release and removed target: patch This PR is targeted for the next patch release labels Apr 8, 2019
@andrewseguin andrewseguin merged commit 1a84770 into angular:master Apr 8, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants