Skip to content

Commit

Permalink
chore(kit): Range add not-chromium Edge support (16-18)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsbarsukov authored and actions-user committed Apr 5, 2022
1 parent 6df9d6a commit 6824717
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
```html
<tui-range [max]="10" [(ngModel)]="model"></tui-range>
<tui-range
[max]="10"
[(ngModel)]="model"
></tui-range>

<tui-range [formControl]="testValue" [max]="10"></tui-range>
<tui-range
[formControl]="testValue"
[max]="10"
></tui-range>
```
10 changes: 8 additions & 2 deletions projects/demo/src/modules/components/range/range.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
<p i18n>Component allows to choose a part of a range</p>

<tui-notification status="warning">
<p i18n class="tui-space_top-0">
<p
i18n
class="tui-space_top-0"
>
This component is being refactored.
Soon&nbsp;(next&nbsp;major&nbsp;release) you will see the fresh
version of it!
Expand Down Expand Up @@ -53,7 +56,10 @@
[content]="example3"
>
<tui-notification class="tui-space_bottom-8">
<p i18n class="tui-space_top-0">
<p
i18n
class="tui-space_top-0"
>
Use mixin
<code>tui-slider-ticks-labels</code>
to arrange ticks' labels (it places them strictly below
Expand Down
5 changes: 3 additions & 2 deletions projects/kit/components/range/range-change.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {DOCUMENT} from '@angular/common';
import {Directive, ElementRef, Inject} from '@angular/core';
import {clamp, round, TuiDestroyService, typedFromEvent} from '@taiga-ui/cdk';
import {TUI_FLOATING_PRECISION} from '@taiga-ui/kit/constants';
import {merge, Observable, race} from 'rxjs';
import {merge, Observable} from 'rxjs';
import {filter, map, repeat, startWith, switchMap, takeUntil, tap} from 'rxjs/operators';

import {TuiRangeComponent} from './range.component';
Expand Down Expand Up @@ -54,8 +54,9 @@ export class TuiRangeChangeDirective {
}),
switchMap(event => this.pointerMove$.pipe(startWith(event))),
map(({clientX}) => clamp(this.getFractionFromEvents(clientX), 0, 1)),
takeUntil(race(this.pointerUp$, destroy$)),
takeUntil(this.pointerUp$),
repeat(),
takeUntil(destroy$),
)
.subscribe(fraction => {
const value = this.range.getValueFromFraction(
Expand Down
9 changes: 9 additions & 0 deletions projects/kit/components/range/range.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@
&::-moz-range-progress {
background: transparent;
}

/* Not-chromium Edge (16-18) */
&::-ms-track {
background: transparent;
}

&::-ms-fill-lower {
background: transparent;
}
}
}

Expand Down
10 changes: 8 additions & 2 deletions projects/kit/components/range/range.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@
</div>

<!-- TODO backward compatibility only (remove in v3.0) -->
<div *ngIf="segmented" class="segments">
<div
*ngIf="segmented"
class="segments"
>
<span
*tuiRepeatTimes="let tickIndex of segments + 1"
automation-id="tui-slider__segment"
class="segment"
>
<ng-container *ngIf="fromToTexts$ | async as fromToText">
<span *ngIf="!isNew" class="number">
<span
*ngIf="!isNew"
class="number"
>
{{ getSegmentPrefix(tickIndex, fromToText) }} {{ tickIndex |
tuiSliderTickLabel:segments:computedKeySteps | tuiFormatNumber
}}
Expand Down
2 changes: 2 additions & 0 deletions projects/kit/components/slider/slider.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
:host._old-edge {
&::-ms-thumb {
background: @thumb-color;
border-radius: 50%;
}

&::-ms-fill-lower {
Expand All @@ -163,5 +164,6 @@

&::-ms-track {
background: @track-color;
border: none;
}
}

0 comments on commit 6824717

Please sign in to comment.