Skip to content

Commit 9fc83e1

Browse files
committed
feat(material-experimental/mdc-slider): add skeleton code for MatSlider
* add method stubs for MDCSliderAdapter implementation * add basic setup for MDCSliderFoundation in MatSlider
1 parent 3e7ff8a commit 9fc83e1

File tree

1 file changed

+160
-2
lines changed
  • src/material-experimental/mdc-slider

1 file changed

+160
-2
lines changed

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

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

9-
import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';
9+
import {
10+
AfterViewInit,
11+
ChangeDetectionStrategy,
12+
Component,
13+
OnDestroy,
14+
ViewEncapsulation,
15+
} from '@angular/core';
16+
import {SpecificEventListener, EventType} from '@material/base';
17+
import {
18+
MDCSliderAdapter,
19+
MDCSliderFoundation,
20+
Thumb,
21+
TickMark,
22+
} from '@material/slider';
1023

24+
/**
25+
* Allows users to select from a range of values by moving the slider thumb. It is similar in
26+
* behavior to the native `<input type="range">` element.
27+
*/
1128
@Component({
1229
selector: 'mat-slider',
1330
templateUrl: 'slider.html',
1431
styleUrls: ['slider.css'],
1532
changeDetection: ChangeDetectionStrategy.OnPush,
1633
encapsulation: ViewEncapsulation.None,
1734
})
18-
export class MatSlider {}
35+
export class MatSlider implements AfterViewInit, OnDestroy {
36+
/** Instance of the MDC slider foundation for this slider. */
37+
private _foundation = new MDCSliderFoundation(new SliderAdapter());
38+
39+
ngAfterViewInit() {
40+
this._foundation.init();
41+
this._foundation.layout();
42+
}
43+
44+
ngOnDestroy() {
45+
this._foundation.destroy();
46+
}
47+
}
48+
49+
class SliderAdapter implements MDCSliderAdapter {
50+
constructor() {}
51+
hasClass(className: string): boolean {
52+
throw new Error('Method not implemented.');
53+
}
54+
addClass(className: string): void {
55+
throw new Error('Method not implemented.');
56+
}
57+
removeClass(className: string): void {
58+
throw new Error('Method not implemented.');
59+
}
60+
getAttribute(attribute: string): string | null {
61+
throw new Error('Method not implemented.');
62+
}
63+
addThumbClass(className: string, thumb: Thumb): void {
64+
throw new Error('Method not implemented.');
65+
}
66+
removeThumbClass(className: string, thumb: Thumb): void {
67+
throw new Error('Method not implemented.');
68+
}
69+
getInputValue(thumb: Thumb): string {
70+
throw new Error('Method not implemented.');
71+
}
72+
setInputValue(value: string, thumb: Thumb): void {
73+
throw new Error('Method not implemented.');
74+
}
75+
getInputAttribute(attribute: string, thumb: Thumb): string | null {
76+
throw new Error('Method not implemented.');
77+
}
78+
setInputAttribute(attribute: string, value: string, thumb: Thumb): void {
79+
throw new Error('Method not implemented.');
80+
}
81+
removeInputAttribute(attribute: string, thumb: Thumb): void {
82+
throw new Error('Method not implemented.');
83+
}
84+
focusInput(thumb: Thumb): void {
85+
throw new Error('Method not implemented.');
86+
}
87+
isInputFocused(thumb: Thumb): boolean {
88+
throw new Error('Method not implemented.');
89+
}
90+
getThumbKnobWidth(thumb: Thumb): number {
91+
throw new Error('Method not implemented.');
92+
}
93+
getThumbBoundingClientRect(thumb: Thumb): ClientRect {
94+
throw new Error('Method not implemented.');
95+
}
96+
getBoundingClientRect(): ClientRect {
97+
throw new Error('Method not implemented.');
98+
}
99+
isRTL(): boolean {
100+
throw new Error('Method not implemented.');
101+
}
102+
setThumbStyleProperty(propertyName: string, value: string, thumb: Thumb): void {
103+
throw new Error('Method not implemented.');
104+
}
105+
removeThumbStyleProperty(propertyName: string, thumb: Thumb): void {
106+
throw new Error('Method not implemented.');
107+
}
108+
setTrackActiveStyleProperty(propertyName: string, value: string): void {
109+
throw new Error('Method not implemented.');
110+
}
111+
removeTrackActiveStyleProperty(propertyName: string): void {
112+
throw new Error('Method not implemented.');
113+
}
114+
setValueIndicatorText(value: number, thumb: Thumb): void {
115+
throw new Error('Method not implemented.');
116+
}
117+
getValueToAriaValueTextFn(): ((value: number) => string) | null {
118+
throw new Error('Method not implemented.');
119+
}
120+
updateTickMarks(tickMarks: TickMark[]): void {
121+
throw new Error('Method not implemented.');
122+
}
123+
setPointerCapture(pointerId: number): void {
124+
throw new Error('Method not implemented.');
125+
}
126+
emitChangeEvent(value: number, thumb: Thumb): void {
127+
throw new Error('Method not implemented.');
128+
}
129+
emitInputEvent(value: number, thumb: Thumb): void {
130+
throw new Error('Method not implemented.');
131+
}
132+
emitDragStartEvent(value: number, thumb: Thumb): void {
133+
throw new Error('Method not implemented.');
134+
}
135+
emitDragEndEvent(value: number, thumb: Thumb): void {
136+
throw new Error('Method not implemented.');
137+
}
138+
registerEventHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void {
139+
throw new Error('Method not implemented.');
140+
}
141+
deregisterEventHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void {
142+
throw new Error('Method not implemented.');
143+
}
144+
registerThumbEventHandler<K extends EventType>
145+
(thumb: Thumb, evtType: K, handler: SpecificEventListener<K>): void {
146+
throw new Error('Method not implemented.');
147+
}
148+
deregisterThumbEventHandler<K extends EventType>
149+
(thumb: Thumb, evtType: K, handler: SpecificEventListener<K>): void {
150+
throw new Error('Method not implemented.');
151+
}
152+
registerInputEventHandler<K extends EventType>
153+
(thumb: Thumb, evtType: K, handler: SpecificEventListener<K>): void {
154+
throw new Error('Method not implemented.');
155+
}
156+
deregisterInputEventHandler<K extends EventType>
157+
(thumb: Thumb, evtType: K, handler: SpecificEventListener<K>): void {
158+
throw new Error('Method not implemented.');
159+
}
160+
registerBodyEventHandler<K extends EventType>
161+
(evtType: K, handler: SpecificEventListener<K>): void {
162+
throw new Error('Method not implemented.');
163+
}
164+
deregisterBodyEventHandler<K extends EventType>
165+
(evtType: K, handler: SpecificEventListener<K>): void {
166+
throw new Error('Method not implemented.');
167+
}
168+
registerWindowEventHandler<K extends EventType>
169+
(evtType: K, handler: SpecificEventListener<K>): void {
170+
throw new Error('Method not implemented.');
171+
}
172+
deregisterWindowEventHandler<K extends EventType>
173+
(evtType: K, handler: SpecificEventListener<K>): void {
174+
throw new Error('Method not implemented.');
175+
}
176+
}

0 commit comments

Comments
 (0)