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

feat(module:date-picker): support DOWN_ARROW/UP_ARROW/LEFT_ARROW/RIGH… #2237

Closed
wants to merge 3 commits into from

Conversation

wilsoncook
Copy link
Member

…T_ARROW/PAGE_DOWN/PAGE_UP/ENTER hotkeys

close #2094

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Application (the showcase website) / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #2094

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@codecov
Copy link

codecov bot commented Oct 3, 2018

Codecov Report

Merging #2237 into master will increase coverage by 0.07%.
The diff coverage is 29.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2237      +/-   ##
==========================================
+ Coverage    95.5%   95.57%   +0.07%     
==========================================
  Files         495      486       -9     
  Lines       12098    12053      -45     
  Branches     1689     1608      -81     
==========================================
- Hits        11554    11520      -34     
- Misses        172      186      +14     
+ Partials      372      347      -25
Impacted Files Coverage Δ
...nents/date-picker/lib/date/date-table.component.ts 98.23% <100%> (ø) ⬆️
...omponents/date-picker/abstract-picker.component.ts 98.8% <100%> (ø) ⬆️
...te-picker/lib/popups/date-range-popup.component.ts 77.53% <25.71%> (-17.64%) ⬇️
...omponents/date-picker/lib/candy-date/candy-date.ts 99.09% <66.66%> (-0.91%) ⬇️
components/timeline/nz-timeline.component.ts 92.3% <0%> (-3.62%) ⬇️
.../auto-complete/nz-autocomplete-option.component.ts 93.87% <0%> (-1.78%) ⬇️
components/skeleton/nz-skeleton.component.ts 98.46% <0%> (-1.54%) ⬇️
components/date-picker/range-picker.component.ts 87.5% <0%> (-1.39%) ⬇️
components/date-picker/date-picker.component.ts 87.5% <0%> (-1.39%) ⬇️
components/date-picker/month-picker.component.ts 88.88% <0%> (-1.12%) ⬇️
... and 158 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e5535d2...47bb3e4. Read the comment docs.

@wzhudev
Copy link
Member

wzhudev commented Oct 12, 2018

Some other components like select, cascader have similar behaviors. Should abstract these behaviors in another pr later.

@@ -741,6 +867,11 @@ describe('NzDatePickerComponent', () => {
fixture.detectChanges();
}

function triggerKeydown(node: Node, keyCode: number, ctrlKey: boolean = false, metaKey: boolean = false): void {
// tslint:disable-next-line:no-any
dispatchEvent(node, new KeyboardEvent('keydown', { keyCode, ctrlKey, metaKey } as any)); // NOTE: don't use `dispatchKeyboardEvent` (not reliable), it will always set `event.metaKey` tobe `true`
Copy link
Contributor

Choose a reason for hiding this comment

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

s/tobe/to be

}

const ctrlKey = event.ctrlKey || event.metaKey; // NOTE: metaKey is the "⌘ Command" key on `MAC` and the "⊞ Windows" key on `Windows`
switch (event.keyCode) {

Choose a reason for hiding this comment

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

Maybe it is a good idea that the event.preventDefault() should be outside the switch block

@vthinkxie
Copy link
Member

@wilsoncook rebase needed.

@vthinkxie
Copy link
Member

As there is no update for a long time, the current PR has been closed. If you have any questions, feel free to open another PR, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

日期选择的快捷方式不起作用。
5 participants