From 8133e8cf3b37b2be764616493ade7c7a7678fce1 Mon Sep 17 00:00:00 2001 From: yiminghe Date: Fri, 27 Nov 2015 16:15:05 +0800 Subject: add gregorianCalendarLocale prop --- src/module/Select.jsx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/module/Select.jsx') diff --git a/src/module/Select.jsx b/src/module/Select.jsx index 2b69623..be4c025 100644 --- a/src/module/Select.jsx +++ b/src/module/Select.jsx @@ -22,6 +22,7 @@ const Select = React.createClass({ propTypes: { prefixCls: PropTypes.string, options: PropTypes.array, + gregorianCalendarLocale: PropTypes.object, selectedIndex: PropTypes.number, type: PropTypes.string, onSelect: PropTypes.func, @@ -37,23 +38,19 @@ const Select = React.createClass({ this.scrollToSelected(200); }, - onSelect(event) { - // do nothing when select selected option - if (event.target.getAttribute('class') === 'selected') { - return; - } - // change combobox selection + onSelect(value) { const { onSelect, type } = this.props; - const value = parseInt(event.target.innerHTML, 10); onSelect(type, value); }, getOptions() { - const { options, selectedIndex } = this.props; + const { options, selectedIndex, prefixCls } = this.props; return options.map((item, index) => { - const cls = classnames({ selected: selectedIndex === index}); - const ref = selectedIndex === index ? 'selected' : null; - return
  • {item}
  • ; + const selected = selectedIndex === index; + const cls = classnames({ + [`${prefixCls}-select-option-selected`]: selected, + }); + return
  • {item}
  • ; }); }, -- cgit v1.2.3