-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10 +/- ##
==========================================
+ Coverage 99.64% 99.71% +0.07%
==========================================
Files 9 10 +1
Lines 280 350 +70
Branches 42 53 +11
==========================================
+ Hits 279 349 +70
Misses 1 1
Continue to review full report at Codecov.
|
} | ||
}); | ||
|
||
this.flyout.onRowIteratorPreviousClick.subscribe(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prefix "on" should be used for the listener, not the event itself. In this case, consumers are subscribing to an observable event, so the name shouldn't be prefixed with "on".
(Also, I know this feature is going to be used by grid rows, but we probably shouldn't include the "row" keyword to the event name. To me, it communicates an enforced pattern that isn't always applicable. What if the buttons iterated through a list or a group of action buttons?)
Something like the following?
this.flyout.previousIteratorButtonClick.subscribe(...)
// or...
this.flyout.iteratorPreviousButtonClick.subscribe(...)
// or...
this.flyout.iterator.previousButtonClick.subscribe(...)
(That last example matches the config pattern, if you wanted to go that route.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The visual test (and the future demo) should also demonstrate that these subscriptions need to be completed in ngOnDestroy
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call about the "row" keyword. I've removed all references to "row" in the codebase. I've also gone with the this.flyout.iterator.previousButtonClick
pattern.
useValue: record | ||
}], | ||
rowIterator: { | ||
previousIsDisabled: previousIsDisabled, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previousButtonDisabled
It might be easier for people to remember the property name if we use the pattern set by the HTML standard for the disabled
attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is done
@@ -3,7 +3,7 @@ import { | |||
} from '@angular/core'; | |||
|
|||
import { | |||
SkyFlyoutService | |||
SkyFlyoutService, SkyFlyoutInstance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiline import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,4 @@ | |||
export interface SkyFlyoutIterator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should rename this to SkyFlyoutIteratorConfig
so that we can use the SkyFlyoutIterator
type for the public SkyFlyoutInstance.iterator
property?
<div class="sky-flyout-header-content"> | ||
|
||
<div *ngIf="config?.iterator" | ||
id="row-iterators" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why you need an id
on this element? If so, it will need an auto-increment applied to keep it unique.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was meant as a unique identifier to easily locate the buttons in the unit test. Isn't there only ever one flyout open at a time?
</div> | ||
|
||
</div> | ||
<div class="sky-flyout-header-buttons"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be a few extra tabs in the template, here.
@@ -251,6 +251,18 @@ export class SkyFlyoutComponent implements OnDestroy, OnInit { | |||
this.adapter.toggleIframePointerEvents(true); | |||
} | |||
|
|||
public onIteratorPreviousClick() { | |||
if (this.config.iterator && !this.config.iterator.previousButtonDisabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these methods are isolated to the buttons' click events, do we need the conditions? For these events to be executed, the iterator
configuration must already exist, and the event won't be triggered if the button is natively disabled. You might be safe to simply call the emit
methods without any condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah true, but these are public methods. I think I was just adding extra safeguards here in case they were used for something else in the future. Could I persuade you on this one in the interest of being extra cautious?
} from '@angular/core'; | ||
|
||
import { | ||
Subject | ||
} from 'rxjs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 'rxjs/Subject'
until we can update to the latest version of RxJS (they've improved their imports in later versions, and don't pull in more than they ought to).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
The next row/previous row buttons look good from a UX perspective. |
@@ -60,7 +65,8 @@ import { | |||
SkyFlyoutResourcesModule | |||
], | |||
exports: [ | |||
SkyFlyoutComponent | |||
SkyFlyoutComponent, | |||
SkyFlyoutIteratorComponent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't want to export the iterator component to the consumers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops. That was an oversight. Fixed.
public closed = new EventEmitter<void>(); | ||
public componentInstance: T; | ||
public isOpen = true; | ||
|
||
public iteratorPreviousButtonClick = new EventEmitter<void>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The EventEmitter
instance variables should be getters, so that the consumer cannot reassign them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
} | ||
|
||
public onIteratorNextButtonClick() { | ||
if (this.config.showIterator && !this.config.iteratorNextButtonDisabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These events should never be emitted if the underlying button is disabled, so isn't the this.config.iteratorNextButtonDisabled
check redundant? (Same for the previous button.)
@@ -1,4 +1,8 @@ | |||
export enum SkyFlyoutMessageType { | |||
Open = 0, | |||
Close = 1 | |||
Close = 1, | |||
IteratorNextButtonEnabled = 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Message types should be verbs, EnableIteratorNextButton
. Also, you can let the enum
auto-increment the IDs by writing it this way:
export enum SkyFlyoutMessageType {
Open = 0,
Close,
EnableIteratorNextButton,
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good tip. Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful.
Addresses blackbaud/skyux2#2143