Sha256: f2625e2a4fcdb6f5cd70a4eda63825d264c57976b478c9e8af6c593ec97013d2
Contents?: true
Size: 1.7 KB
Versions: 32
Compression:
Stored size: 1.7 KB
Contents
var InteractiveLabel = React.createClass({displayName: "InteractiveLabel", getInitialState: function () { return { value: this.props.labelValue }; }, componentWillReceiveProps: function(nextProps) { this.setState({ value: nextProps.labelValue }); }, onBlur: function(event) { this.onSubmit(); return false; }, onSubmit: function(event) { if(this.props.id != undefined) { $("#"+this.props.id).attr("v", this.state.value); } this.props.onValueChange(this.props.labelName, this.props.labelKey, this.state.value); if(event != undefined) { event.preventDefault(); } return false; }, handleChange: function(event) { this.setState({value: event.target.value}); }, render: function() { return ( React.createElement("form", {onSubmit: this.onSubmit}, this.props.id != undefined ? React.createElement("input", { id: this.props.id, className: "pointer", value: this.state.value, onKeyPress: this.props.onKeyPress, onChange: this.handleChange, onBlur: this.onBlur}) : React.createElement("input", { className: "pointer", value: this.state.value, onKeyPress: this.props.onKeyPress, onChange: this.handleChange, onBlur: this.onBlur}) ) ) } });
Version data entries
32 entries across 32 versions & 1 rubygems