-
Notifications
You must be signed in to change notification settings - Fork 467
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(kit): Range
use Slider
inside
#1538
Conversation
Pull request was closed ✔️All saved screenshots (for current PR) were deleted 🗑️ |
Visit the preview URL for this PR (updated for commit 6824717): https://taiga-ui--pr1538-range-refactor-ddqp2l3d.web.app (expires Wed, 06 Apr 2022 08:10:10 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Codecov Report
@@ Coverage Diff @@
## main #1538 +/- ##
==========================================
- Coverage 63.43% 62.32% -1.12%
==========================================
Files 910 696 -214
Lines 9953 8496 -1457
Branches 1920 1658 -262
==========================================
- Hits 6314 5295 -1019
+ Misses 3200 2793 -407
+ Partials 439 408 -31
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
b17be23
to
13cfc63
Compare
Range
use Slider
insideRange
use Slider
inside
Range
use Slider
insideRange
use Slider
inside
* TODO replace with pointer events (when all supported browsers can handle them). | ||
* Dont forget to use setPointerCapture instead of listening all documentRef events | ||
*/ | ||
private readonly pointerDown$ = merge( |
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.
nit: same stream is used in tuiPan, maybe it makes sense to think about sharing this code 🤔
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.
I agree this directive listens to the same events. But it does different things.
Should we create tuiPointerDown$
, tuiPointerMove$
, tuiPointerUp$
services ?
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.
I don't think we need separate services but if we can somehow provide and reuse Pan
it would be nice
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.
Unfortunately, I can't reuse pan service (or I dont understand how to do it).
PanService emits values on every *Move
event but i also need first emission of *Down
-event
5fbefed
to
daecb60
Compare
@import 'taiga-ui-local'; | ||
|
||
.range { | ||
z-index: 1; |
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.
What is this for?
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.
To overlap tick's label
when we click on tick's label, the click event fires on Range
z-index: 1; | ||
|
||
/* (Optionally) expand clickable area as you wish */ | ||
&:after { |
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.
I wonder if it makes sense to add a mixin for that
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.
I am not sure we want support it :)
Range
already has increased clickable area.
Manually expanding it is optional.
And this manually expanded area can be of any shape.
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.
Moreover, creating of pseudo-element is rather simple)
projects/demo/src/modules/components/range/examples/import/insert-template.md
Outdated
Show resolved
Hide resolved
top: @track-height / 2; | ||
left: 0; | ||
right: 0; | ||
z-index: 1; |
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.
What is it for?
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.
Thumb is filled by semi-transparent color during hover.
It will show what happens under it otherwise.
* TODO replace with pointer events (when all supported browsers can handle them). | ||
* Dont forget to use setPointerCapture instead of listening all documentRef events | ||
*/ | ||
private readonly pointerDown$ = merge( |
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.
I don't think we need separate services but if we can somehow provide and reuse Pan
it would be nice
) { | ||
super(control, changeDetectorRef, documentRef, fromToTexts$); | ||
} | ||
|
||
get nativeFocusableElement(): TuiNativeFocusableElement | null { | ||
if (this.computedDisabled || !this.dotLeft || !this.dotRight) { | ||
const [sliderLeftRef, sliderRightRef] = this.slidersRefs; |
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.
Didn't know you could do that :) I would use const {first, last}
:)
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.
Array deconstructing is convenient here because we can choose naming.
Do you think that I should use const {first, last}
instead ?
.pipe( | ||
tap(({clientX, target}) => { | ||
activeThumb = this.detectActiveThumb(clientX, target); | ||
elementRef.nativeElement.focus(); |
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.
I wonder if we should just drop setNativeFocused
completely and use native method everywhere, like here 🤔
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.
I removed usage of setNativeFocused
from kit/components/range
-directory
dfac1cb
to
42128a1
Compare
42128a1
to
f52aecc
Compare
f52aecc
to
6824717
Compare
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Closes #
What is the new behavior?
Does this PR introduce a breaking change?