mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-03 04:38:38 -04:00
Use ES6 classes instead of React.createClass and editing prototypes
This commit is contained in:
@ -4,24 +4,25 @@ var Combobox = require('react-widgets').Combobox;
|
||||
|
||||
var getAccountDisplayList = require('../utils').getAccountDisplayList;
|
||||
|
||||
module.exports = React.createClass({
|
||||
displayName: "AccountCombobox",
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
class AccountCombobox extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.onAccountChange = this.handleAccountChange.bind(this);
|
||||
this.defaultProps = {
|
||||
includeRoot: true,
|
||||
disabled: false,
|
||||
rootName: "New Top-level Account"
|
||||
};
|
||||
},
|
||||
handleAccountChange: function(account) {
|
||||
}
|
||||
}
|
||||
handleAccountChange(account) {
|
||||
if (this.props.onChange != null &&
|
||||
account.hasOwnProperty('AccountId') &&
|
||||
(this.props.accounts.hasOwnProperty([account.AccountId]) ||
|
||||
account.AccountId == -1)) {
|
||||
this.props.onChange(account)
|
||||
}
|
||||
},
|
||||
render: function() {
|
||||
}
|
||||
render() {
|
||||
var accounts = getAccountDisplayList(this.props.accounts, this.props.accountChildren, this.props.includeRoot, this.props.rootName);
|
||||
var className = "";
|
||||
if (this.props.className)
|
||||
@ -32,7 +33,7 @@ module.exports = React.createClass({
|
||||
valueField='AccountId'
|
||||
textField='Name'
|
||||
defaultValue={this.props.value}
|
||||
onChange={this.handleAccountChange}
|
||||
onChange={this.onAccountChange}
|
||||
ref="account"
|
||||
disabled={this.props.disabled}
|
||||
suggest
|
||||
@ -40,4 +41,6 @@ module.exports = React.createClass({
|
||||
className={className} />
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = AccountCombobox;
|
||||
|
Reference in New Issue
Block a user