[React.14] Add checkedLink/valueLink to HTMLAttributes for LinkedStateMixin

This commit is contained in:
Vincent Siao
2015-11-10 23:43:36 -08:00
parent bef72125ab
commit 813f3b03db
3 changed files with 29 additions and 4 deletions
+5
View File
@@ -14,6 +14,11 @@ declare namespace __React {
interface LinkedStateMixin extends Mixin<any, any> {
linkState<T>(key: string): ReactLink<T>;
}
interface HTMLAttributes {
checkedLink?: ReactLink<string>;
valueLink?: ReactLink<string>;
}
namespace __Addons {
export var LinkedStateMixin: LinkedStateMixin;
+19 -2
View File
@@ -466,8 +466,25 @@ React.createFactory(CSSTransitionGroup)({
// LinkedStateMixin addon
// --------------------------------------------------------------------------
React.createClass({
mixins: [LinkedStateMixin],
render: function() { return React.DOM.div(null) }
mixins: [LinkedStateMixin],
getInitialState: function() {
return {
isChecked: false,
message: "hello!"
};
},
render: function() {
return React.DOM.div(null,
React.DOM.input({
type: "checkbox",
checkedLink: this.linkState("isChecked")
}),
React.DOM.input({
type: "text",
valueLink: this.linkState("message")
})
);
}
});
//
+5 -2
View File
@@ -324,8 +324,6 @@ declare namespace __React {
}
interface HTMLProps extends HTMLAttributes, Props<HTMLElement> {
defaultChecked?: boolean;
defaultValue?: string | string[];
}
interface SVGProps extends SVGAttributes, Props<SVGElement> {
@@ -454,6 +452,11 @@ declare namespace __React {
}
interface HTMLAttributes extends DOMAttributes {
// React-specific Attributes
defaultChecked?: boolean;
defaultValue?: string | string[];
// Standard HTML Attributes
accept?: string;
acceptCharset?: string;
accessKey?: string;