Skip to content

Commit c268bcb

Browse files
authored
Merge pull request #6230 from IgniteUI/slider-ticks-refactoring
Slider ticks enhancements
2 parents 1759bd5 + 5e8714e commit c268bcb

File tree

12 files changed

+162
-153
lines changed

12 files changed

+162
-153
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ All notable changes for each version of this project will be documented in this
6666
- `ticksOrientation` input was added. Allows to change ticks orientation to top|bottom|mirror.
6767
- `tickLabelsOrientation` input was added. Allows you to change the rotation of all tick labels from horizontal to vertical(toptobottom, bottomtotop).
6868
- `igxSliderTickLabel` directive has been introduced. Allows you to set a custom template for all tick labels.
69+
- `isContinuous` - input has been deleted. The option is not supported anymore.
6970

7071
- `IgxCarousel`:
7172
- `keyboardSupport` input is added, which can be used to enable and disable keyboard navigation
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"@scheme": "../../common/schema/binding.schema.json",
3+
"changes": [
4+
{
5+
"name": "isContinuous",
6+
"replaceWith": "continuous",
7+
"owner": {
8+
"selector": "igx-slider",
9+
"type": "component"
10+
}
11+
}
12+
]
13+
}

projects/igniteui-angular/src/lib/core/utils.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { Injectable, PLATFORM_ID, Inject } from '@angular/core';
22
import { isPlatformBrowser } from '@angular/common';
3+
import { Observable } from 'rxjs';
4+
import ResizeObserver from 'resize-observer-polyfill';
35

46
/**
57
*@hidden
@@ -321,3 +323,20 @@ export const NAVIGATION_KEYS = new Set([
321323
export const ROW_EXPAND_KEYS = new Set('right down arrowright arrowdown'.split(' '));
322324
export const ROW_COLLAPSE_KEYS = new Set('left up arrowleft arrowup'.split(' '));
323325
export const SUPPORTED_KEYS = new Set([...Array.from(NAVIGATION_KEYS), 'tab', 'enter', 'f2', 'escape', 'esc']);
326+
327+
/**
328+
* @hidden
329+
* @internal
330+
*
331+
* Creates a new ResizeObserver on `target` and returns it as an Observable.
332+
*/
333+
export function resizeObservable(target: HTMLElement): Observable<ResizeObserverEntry[]> {
334+
return new Observable((observer) => {
335+
const instance = new ResizeObserver((entries: ResizeObserverEntry[]) => {
336+
observer.next(entries);
337+
});
338+
instance.observe(target);
339+
const unsubscribe = () => instance.disconnect();
340+
return unsubscribe;
341+
});
342+
}

projects/igniteui-angular/src/lib/slider/label/thumb-label.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, NgModule, Input, TemplateRef, HostBinding, ElementRef } from '@angular/core';
1+
import { Component, Input, TemplateRef, HostBinding, ElementRef } from '@angular/core';
22
import { SliderHandle } from '../slider.common';
33

44
@Component({

projects/igniteui-angular/src/lib/slider/slider.common.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ export enum SliderHandle {
7373
* Slider Tick labels Orientation
7474
*/
7575
export enum TickLabelsOrientation {
76-
horizontal,
77-
toptobottom,
78-
bottomtotop
76+
Horizontal,
77+
TopToBottom,
78+
BottomToTop
7979
}
8080

8181
/**
8282
* Slider Ticks orientation
8383
*/
8484
export enum TicksOrientation {
85-
top,
86-
bottom,
87-
mirror
85+
Top,
86+
Bottom,
87+
Mirror
8888
}

projects/igniteui-angular/src/lib/slider/slider.component.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,7 @@ describe('IgxSlider', () => {
14001400
expect(ticksTop).toBeNull();
14011401

14021402
fixture.componentInstance.showTicks = true;
1403-
fixture.componentInstance.ticksOrientation = TicksOrientation.mirror;
1403+
fixture.componentInstance.ticksOrientation = TicksOrientation.Mirror;
14041404
fixture.detectChanges();
14051405

14061406
ticks = fixture.debugElement.nativeElement.querySelector(SLIDER_TICKS_ELEMENT);
@@ -1470,7 +1470,7 @@ describe('IgxSlider', () => {
14701470

14711471
expect(bottomTicks).not.toBeNull();
14721472

1473-
fixture.componentInstance.ticksOrientation = TicksOrientation.top;
1473+
fixture.componentInstance.ticksOrientation = TicksOrientation.Top;
14741474
fixture.detectChanges();
14751475

14761476
let topTIcks = fixture.debugElement.nativeElement.querySelector(SLIDER_TICKS_TOP_ELEMENT);
@@ -1479,7 +1479,7 @@ describe('IgxSlider', () => {
14791479
expect(topTIcks).not.toBeNull();
14801480
expect(bottomTicks).toBeNull();
14811481

1482-
fixture.componentInstance.ticksOrientation = TicksOrientation.mirror;
1482+
fixture.componentInstance.ticksOrientation = TicksOrientation.Mirror;
14831483
fixture.detectChanges();
14841484

14851485
topTIcks = fixture.debugElement.nativeElement.querySelector(SLIDER_TICKS_TOP_ELEMENT);
@@ -1499,15 +1499,15 @@ describe('IgxSlider', () => {
14991499
expect(labelsBottomTop).toBeNull();
15001500
expect(labelsTopBottom).toBeNull();
15011501

1502-
fixture.componentInstance.tickLabelsOrientation = TickLabelsOrientation.bottomtotop;
1502+
fixture.componentInstance.tickLabelsOrientation = TickLabelsOrientation.BottomToTop;
15031503
fixture.detectChanges();
15041504

15051505
labelsBottomTop = nativeElem.querySelector(BOTTOM_TO_TOP_TICK_LABLES);
15061506
labelsTopBottom = nativeElem.querySelector(TOP_TO_BOTTOM_TICK_LABLES);
15071507
expect(labelsBottomTop).not.toBeNull();
15081508
expect(labelsTopBottom).toBeNull();
15091509

1510-
fixture.componentInstance.tickLabelsOrientation = TickLabelsOrientation.toptobottom;
1510+
fixture.componentInstance.tickLabelsOrientation = TickLabelsOrientation.TopToBottom;
15111511
fixture.detectChanges();
15121512

15131513
labelsBottomTop = nativeElem.querySelector(BOTTOM_TO_TOP_TICK_LABLES);
@@ -1596,10 +1596,10 @@ export class SliderTicksComponent {
15961596
public primaryTicks = 0;
15971597
public secondaryTicks = 0;
15981598
public showTicks = true;
1599-
public ticksOrientation = TicksOrientation.bottom;
1599+
public ticksOrientation = TicksOrientation.Bottom;
16001600
public primaryTickLabels = true;
16011601
public secondaryTickLabels = true;
1602-
public tickLabelsOrientation = TickLabelsOrientation.horizontal;
1602+
public tickLabelsOrientation = TickLabelsOrientation.Horizontal;
16031603
}
16041604
@Component({
16051605
selector: 'igx-slider-test-component',

0 commit comments

Comments
 (0)