Skip to content

Commit b9eab46

Browse files
committed
chore(): fix host properties for MD components.
1 parent dff4795 commit b9eab46

File tree

9 files changed

+38
-35
lines changed

9 files changed

+38
-35
lines changed

gulpfile.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -650,23 +650,21 @@ gulp.task('build', ['build.js', 'build.dart']);
650650

651651
// ------------
652652
// angular material testing rules
653-
gulp.task('build/css.js.dev', function() {
653+
gulp.task('build.js.material', ['build.js.dev'], function() {
654654
return gulp.src('modules/*/src/**/*.scss')
655655
.pipe(sass())
656656
.pipe(autoprefixer())
657657
.pipe(gulp.dest(CONFIG.dest.js.dev.es5));
658658
});
659659

660660
// TODO: this target is temporary until we find a way to use the SASS transformer
661-
gulp.task('build/css.dart', function() {
662-
return gulp.src('dist/dart/angular2_material/lib/src/**/*.scss')
661+
gulp.task('build.dart.material', ['build/packages.dart'], function() {
662+
return gulp.src('dist/dart/angular2_material/src/**/*.scss')
663663
.pipe(sass())
664664
.pipe(autoprefixer())
665665
.pipe(gulp.dest('dist/dart/angular2_material/lib/src'));
666666
});
667667

668-
gulp.task('build.material', ['build.js.dev', 'build/css.js.dev']);
669-
670668

671669
gulp.task('cleanup.builder', function() {
672670
angularBuilder.cleanup();

modules/angular2/src/facade/browser.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Dart version of browser APIs. This library depends on 'dart:html' and
33
* therefore can only run in the browser.
44
*/
5-
library angular2.src.facade.browser;
5+
library angular2.src.facade.browser;
66

77
import 'dart:js' show context;
88

@@ -12,6 +12,7 @@ export 'dart:html' show
1212
window,
1313
Element,
1414
Node,
15+
MouseEvent,
1516
KeyboardEvent,
1617
Event;
1718

modules/angular2/src/facade/browser.es6

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ export {win as window};
88
export var document = window.document;
99
export var location = window.location;
1010
export var gc = window.gc ? () => window.gc() : () => null;
11+
export {Event as Event};
12+
export {MouseEvent as MouseEvent};
13+
export {KeyboardEvent as KeyboardEvent};

modules/angular2/src/facade/browser.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ export {win as window};
1212
export var document = window.document;
1313
export var location = window.location;
1414
export var gc = window.gc ? () => window.gc() : () => null;
15+
export const Event = Event;
16+
export const MouseEvent = MouseEvent;
17+
export const KeyboardEvent = KeyboardEvent;

modules/angular2_material/src/components/checkbox/checkbox.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {Component, View, Attribute} from 'angular2/angular2';
22
import {isPresent} from 'angular2/src/facade/lang';
33
import {KEY_SPACE} from 'angular2_material/src/core/constants'
44
import {KeyboardEvent} from 'angular2/src/facade/browser';
5+
import {NumberWrapper} from 'angular2/src/facade/lang';
56

67
@Component({
78
selector: 'md-checkbox',
@@ -34,12 +35,12 @@ export class MdCheckbox {
3435
role: string;
3536

3637
/** Setter for tabindex */
37-
tabindex: any;
38+
tabindex: number;
3839

3940
constructor(@Attribute('tabindex') tabindex: string) {
4041
this.role = 'checkbox';
4142
this.checked = false;
42-
this.tabindex = isPresent(tabindex) ? tabindex : '0';
43+
this.tabindex = isPresent(tabindex) ? NumberWrapper.parseInt(tabindex, 10) : 0;
4344
}
4445

4546
get disabled() {

modules/angular2_material/src/components/progress-linear/progress_linear.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {Math} from 'angular2/src/facade/math';
1313
'role': 'attr.role',
1414
'ariaValuemin': 'attr.aria-valuemin',
1515
'ariaValuemax': 'attr.aria-valuemax',
16-
'ariaValuenow': 'attr.aria-valuenow'
16+
'value': 'attr.aria-valuenow'
1717
}
1818
})
1919
@View({
@@ -30,23 +30,17 @@ export class MdProgressLinear {
3030
/** The render mode for the progress bar. */
3131
mode: string;
3232

33-
/** Attribute setter for aria-valuenow. */
34-
ariaValueNowSetter: Function;
35-
3633
/** CSS `transform` property applied to the primary bar. */
3734
primaryBarTransform: string;
3835

3936
/** CSS `transform` property applied to the secondary bar. */
4037
secondaryBarTransform: string;
4138

42-
43-
role:any;
44-
ariaValuemin:any;
45-
ariaValuemax:any;
46-
ariaValuenow:any;
39+
role: string;
40+
ariaValuemin: string;
41+
ariaValuemax: string;
4742

4843
constructor(@Attribute('md-mode') mode: string) {
49-
this.ariaValueNowSetter = ariaValueNowSetter;
5044
this.primaryBarTransform = '';
5145
this.secondaryBarTransform = '';
5246

@@ -64,7 +58,6 @@ export class MdProgressLinear {
6458
set value(v) {
6559
if (isPresent(v)) {
6660
this.value_ = MdProgressLinear.clamp(v);
67-
this.ariaValueNowSetter(this.value_);
6861
}
6962
}
7063

modules/angular2_material/src/components/radio/radio_button.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Component, View, Parent, Ancestor, Attribute} from 'angular2/angular2';
22
import {Optional} from 'angular2/src/di/annotations';
33
import {MdRadioDispatcher} from 'angular2_material/src/components/radio/radio_dispatcher'
44
import {onChange} from 'angular2/src/core/annotations/annotations';
5-
import {isPresent, StringWrapper} from 'angular2/src/facade/lang';
5+
import {isPresent, StringWrapper, NumberWrapper} from 'angular2/src/facade/lang';
66
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
77
import {ListWrapper} from 'angular2/src/facade/collection';
88
import {KEY_UP, KEY_DOWN, KEY_SPACE} from 'angular2_material/src/core/constants'
@@ -69,9 +69,9 @@ export class MdRadioButton {
6969
/** Dispatcher for coordinating radio unique-selection by name. */
7070
radioDispatcher: MdRadioDispatcher;
7171

72-
tabindex:any;
73-
74-
role:any;
72+
tabindex: number;
73+
74+
role: string;
7575

7676
constructor(
7777
@Optional() @Parent() radioGroup: MdRadioGroup,
@@ -105,7 +105,9 @@ export class MdRadioButton {
105105

106106
// If the user has not set a tabindex, default to zero (in the normal document flow).
107107
if (!isPresent(radioGroup)) {
108-
this.tabindex = isPresent(tabindex) ? tabindex : '0';
108+
this.tabindex = isPresent(tabindex) ? NumberWrapper.parseInt(tabindex, 10) : 0;
109+
} else {
110+
this.tabindex = -1;
109111
}
110112
}
111113

@@ -169,12 +171,12 @@ export class MdRadioButton {
169171
'value': 'value'
170172
},
171173
hostListeners: {
172-
'keydown': 'onKeydown($event)'
174+
// TODO(jelbourn): Remove ^ when event retargeting is fixed.
175+
'^keydown': 'onKeydown($event)'
173176
},
174177
hostProperties: {
175178
'tabindex': 'tabindex',
176179
'role': 'attr.role',
177-
'checked': 'attr.aria-checked',
178180
'disabled': 'attr.aria-disabled',
179181
'activedescendant': 'attr.aria-activedescendant'
180182
}
@@ -202,11 +204,11 @@ export class MdRadioGroup {
202204
/** The ID of the selected radio button. */
203205
selectedRadioId: string;
204206

205-
change:EventEmitter;
207+
change: EventEmitter;
206208

207-
tabindex:any;
209+
tabindex: number;
208210

209-
role:any;
211+
role: string;
210212

211213
constructor(
212214
@Attribute('tabindex') tabindex: string,
@@ -225,7 +227,7 @@ export class MdRadioGroup {
225227
this.disabled = isPresent(disabled);
226228

227229
// If the user has not set a tabindex, default to zero (in the normal document flow).
228-
this.tabindex = isPresent(tabindex) ? tabindex : '0';
230+
this.tabindex = isPresent(tabindex) ? NumberWrapper.parseInt(tabindex, 10) : 0;
229231
}
230232

231233
/** Gets the name of this group, as to be applied in the HTML 'name' attribute. */
@@ -319,6 +321,7 @@ export class MdRadioGroup {
319321

320322
this.radioDispatcher.notify(this.name_);
321323
radio.checked = true;
324+
ObservableWrapper.callNext(this.change, null);
322325

323326
this.value = radio.value;
324327
this.selectedRadioId = radio.id;

modules/angular2_material/src/components/switcher/switch.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {Component, View, Attribute} from 'angular2/angular2';
22
import {isPresent} from 'angular2/src/facade/lang';
33
import {KEY_SPACE} from 'angular2_material/src/core/constants'
44
import {KeyboardEvent} from 'angular2/src/facade/browser';
5+
import {NumberWrapper} from 'angular2/src/facade/lang';
56

67
// TODO(jelbourn): without gesture support, this is identical to MdCheckbox.
78

@@ -31,13 +32,13 @@ export class MdSwitch {
3132
/** Whether this switch is disabled. */
3233
disabled_: boolean;
3334

34-
tabindex:any;
35-
role:any;
35+
tabindex: number;
36+
role: string;
3637

3738
constructor(@Attribute('tabindex') tabindex: string) {
3839
this.role = 'checkbox';
3940
this.checked = false;
40-
this.tabindex = isPresent(tabindex) ? tabindex : '0';
41+
this.tabindex = isPresent(tabindex) ? NumberWrapper.parseInt(tabindex, 10) : 0;
4142
}
4243

4344
get disabled() {

modules/examples/src/material/demo_common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ export function commonDemoSetup(): void {
1313
}
1414

1515
@Injectable()
16-
@IMPLEMENTS(UrlResolver)
17-
export class DemoUrlResolver {
16+
export class DemoUrlResolver extends UrlResolver {
1817
static a;
1918

2019
isInPubServe:boolean;
2120

2221
constructor() {
22+
super();
2323
if (isBlank(UrlResolver.a)) {
2424
UrlResolver.a = DOM.createElement('a');
2525
}

0 commit comments

Comments
 (0)