Skip to content

Commit 5cbe03c

Browse files
committed
feat(material-experimental/mdc-slider): add skeleton code for
MatSliderAdapter * create slider-adapter.ts * add method stubs for MDCSliderAdapter implementation * add MDCSliderFoundation class variable to MatSlider
1 parent 3e7ff8a commit 5cbe03c

File tree

2 files changed

+156
-2
lines changed

2 files changed

+156
-2
lines changed
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
import {SpecificEventListener, EventType} from '@material/base';
10+
import {MDCSliderAdapter, Thumb, TickMark} from '@material/slider';
11+
12+
export class SliderAdapter implements MDCSliderAdapter {
13+
hasClass(className: string): boolean {
14+
throw Error('Method not implemented.');
15+
}
16+
addClass(className: string): void {
17+
throw Error('Method not implemented.');
18+
}
19+
removeClass(className: string): void {
20+
throw Error('Method not implemented.');
21+
}
22+
getAttribute(attribute: string): string | null {
23+
throw Error('Method not implemented.');
24+
}
25+
addThumbClass(className: string, thumb: Thumb): void {
26+
throw Error('Method not implemented.');
27+
}
28+
removeThumbClass(className: string, thumb: Thumb): void {
29+
throw Error('Method not implemented.');
30+
}
31+
getInputValue(thumb: Thumb): string {
32+
throw Error('Method not implemented.');
33+
}
34+
setInputValue(value: string, thumb: Thumb): void {
35+
throw Error('Method not implemented.');
36+
}
37+
getInputAttribute(attribute: string, thumb: Thumb): string | null {
38+
throw Error('Method not implemented.');
39+
}
40+
setInputAttribute(attribute: string, value: string, thumb: Thumb): void {
41+
throw Error('Method not implemented.');
42+
}
43+
removeInputAttribute(attribute: string, thumb: Thumb): void {
44+
throw Error('Method not implemented.');
45+
}
46+
focusInput(thumb: Thumb): void {
47+
throw Error('Method not implemented.');
48+
}
49+
isInputFocused(thumb: Thumb): boolean {
50+
throw Error('Method not implemented.');
51+
}
52+
getThumbKnobWidth(thumb: Thumb): number {
53+
throw Error('Method not implemented.');
54+
}
55+
getThumbBoundingClientRect(thumb: Thumb): ClientRect {
56+
throw Error('Method not implemented.');
57+
}
58+
getBoundingClientRect(): ClientRect {
59+
throw Error('Method not implemented.');
60+
}
61+
isRTL(): boolean {
62+
throw Error('Method not implemented.');
63+
}
64+
setThumbStyleProperty(propertyName: string, value: string, thumb: Thumb): void {
65+
throw Error('Method not implemented.');
66+
}
67+
removeThumbStyleProperty(propertyName: string, thumb: Thumb): void {
68+
throw Error('Method not implemented.');
69+
}
70+
setTrackActiveStyleProperty(propertyName: string, value: string): void {
71+
throw Error('Method not implemented.');
72+
}
73+
removeTrackActiveStyleProperty(propertyName: string): void {
74+
throw Error('Method not implemented.');
75+
}
76+
setValueIndicatorText(value: number, thumb: Thumb): void {
77+
throw Error('Method not implemented.');
78+
}
79+
getValueToAriaValueTextFn(): ((value: number) => string) | null {
80+
throw Error('Method not implemented.');
81+
}
82+
updateTickMarks(tickMarks: TickMark[]): void {
83+
throw Error('Method not implemented.');
84+
}
85+
setPointerCapture(pointerId: number): void {
86+
throw Error('Method not implemented.');
87+
}
88+
emitChangeEvent(value: number, thumb: Thumb): void {
89+
throw Error('Method not implemented.');
90+
}
91+
emitInputEvent(value: number, thumb: Thumb): void {
92+
throw Error('Method not implemented.');
93+
}
94+
emitDragStartEvent(value: number, thumb: Thumb): void {
95+
throw Error('Method not implemented.');
96+
}
97+
emitDragEndEvent(value: number, thumb: Thumb): void {
98+
throw Error('Method not implemented.');
99+
}
100+
registerEventHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void {
101+
throw Error('Method not implemented.');
102+
}
103+
deregisterEventHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void {
104+
throw Error('Method not implemented.');
105+
}
106+
registerThumbEventHandler<K extends EventType>
107+
(thumb: Thumb, evtType: K, handler: SpecificEventListener<K>): void {
108+
throw Error('Method not implemented.');
109+
}
110+
deregisterThumbEventHandler<K extends EventType>
111+
(thumb: Thumb, evtType: K, handler: SpecificEventListener<K>): void {
112+
throw Error('Method not implemented.');
113+
}
114+
registerInputEventHandler<K extends EventType>
115+
(thumb: Thumb, evtType: K, handler: SpecificEventListener<K>): void {
116+
throw Error('Method not implemented.');
117+
}
118+
deregisterInputEventHandler<K extends EventType>
119+
(thumb: Thumb, evtType: K, handler: SpecificEventListener<K>): void {
120+
throw Error('Method not implemented.');
121+
}
122+
registerBodyEventHandler<K extends EventType>
123+
(evtType: K, handler: SpecificEventListener<K>): void {
124+
throw Error('Method not implemented.');
125+
}
126+
deregisterBodyEventHandler<K extends EventType>
127+
(evtType: K, handler: SpecificEventListener<K>): void {
128+
throw Error('Method not implemented.');
129+
}
130+
registerWindowEventHandler<K extends EventType>
131+
(evtType: K, handler: SpecificEventListener<K>): void {
132+
throw Error('Method not implemented.');
133+
}
134+
deregisterWindowEventHandler<K extends EventType>
135+
(evtType: K, handler: SpecificEventListener<K>): void {
136+
throw Error('Method not implemented.');
137+
}
138+
}

src/material-experimental/mdc-slider/slider.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,29 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';
9+
import {
10+
ChangeDetectionStrategy,
11+
Component,
12+
ViewEncapsulation,
13+
} from '@angular/core';
14+
import {MDCSliderFoundation} from '@material/slider';
15+
import {SliderAdapter} from './slider-adapter';
1016

17+
/**
18+
* Allows users to select from a range of values by moving the slider thumb. It is similar in
19+
* behavior to the native `<input type="range">` element.
20+
*/
1121
@Component({
1222
selector: 'mat-slider',
1323
templateUrl: 'slider.html',
1424
styleUrls: ['slider.css'],
1525
changeDetection: ChangeDetectionStrategy.OnPush,
1626
encapsulation: ViewEncapsulation.None,
1727
})
18-
export class MatSlider {}
28+
export class MatSlider {
29+
30+
/** Instance of the MDC slider foundation for this slider. */
31+
32+
// tslint:disable-next-line:no-unused-variable
33+
private _foundation = new MDCSliderFoundation(new SliderAdapter());
34+
}

0 commit comments

Comments
 (0)