Latest build
parent
956ea5778b
commit
e40c77442e
|
@ -90,7 +90,7 @@ var factory = function factory(Chip, Input) {
|
|||
if (_this.state.focus) _this.setState({ focus: false });
|
||||
if (_this.props.onBlur) _this.props.onBlur(event, _this.state.active);
|
||||
}, _this.handleQueryChange = function (value) {
|
||||
_this.setState({ query: value, showAllSuggestions: false });
|
||||
_this.setState({ query: value, showAllSuggestions: false, active: null });
|
||||
}, _this.handleQueryFocus = function () {
|
||||
_this.refs.suggestions.scrollTop = 0;
|
||||
_this.setState({ active: '', focus: true });
|
||||
|
@ -418,6 +418,8 @@ var factory = function factory(Chip, Input) {
|
|||
onFocus: this.handleQueryFocus,
|
||||
onKeyDown: this.handleQueryKeyDown,
|
||||
onKeyUp: this.handleQueryKeyUp,
|
||||
theme: theme,
|
||||
themeNamespace: 'input',
|
||||
value: this.state.query
|
||||
})),
|
||||
this.renderSuggestions(),
|
||||
|
@ -449,7 +451,6 @@ var factory = function factory(Chip, Input) {
|
|||
autocomplete: _react.PropTypes.string,
|
||||
focus: _react.PropTypes.string,
|
||||
input: _react.PropTypes.string,
|
||||
label: _react.PropTypes.string,
|
||||
suggestion: _react.PropTypes.string,
|
||||
suggestions: _react.PropTypes.string,
|
||||
up: _react.PropTypes.string,
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
position: relative;
|
||||
padding: $unit 0;
|
||||
&.focus {
|
||||
.label {
|
||||
color: $autocomplete-color-primary;
|
||||
}
|
||||
.suggestions {
|
||||
max-height: $autocomplete-overflow-max-height;
|
||||
visibility: visible;
|
||||
|
@ -19,12 +16,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: $font-size-tiny;
|
||||
color: $color-text-secondary;
|
||||
transition: color $animation-duration $animation-curve-default;
|
||||
}
|
||||
|
||||
.values {
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
}
|
||||
|
||||
.input {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
|
|
|
@ -108,7 +108,7 @@ var factory = function factory(Input, DatePickerDialog) {
|
|||
_createClass(DatePicker, [{
|
||||
key: 'componentWillReceiveProps',
|
||||
value: function componentWillReceiveProps(nextProps) {
|
||||
if (this.state.active !== nextProps.active) {
|
||||
if (nextProps.active !== this.props.active && this.state.active !== nextProps.active) {
|
||||
this.setState({ active: nextProps.active });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,6 @@
|
|||
.body {
|
||||
flex-grow: 2;
|
||||
padding: $dialog-content-padding;
|
||||
overflow-y: auto;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,11 @@ var factory = function factory(Input) {
|
|||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
||||
active: false,
|
||||
up: false
|
||||
}, _this.getDocumentEvents = function () {
|
||||
return {
|
||||
click: _this.handleDocumentClick,
|
||||
touchend: _this.handleDocumentClick
|
||||
};
|
||||
}, _this.close = function () {
|
||||
if (_this.state.active) {
|
||||
_this.setState({ active: false });
|
||||
|
@ -78,6 +83,7 @@ var factory = function factory(Input) {
|
|||
var up = _this.props.auto ? client.top > screen_height / 2 + client.height : false;
|
||||
if (_this.props.onClick) _this.props.onClick(event);
|
||||
if (_this.props.onFocus) _this.props.onFocus(event);
|
||||
if (_this.inputNode) _this.inputNode.blur();
|
||||
_this.setState({ active: true, up: up });
|
||||
}, _this.handleSelect = function (item, event) {
|
||||
if (_this.props.onBlur) _this.props.onBlur(event);
|
||||
|
@ -133,21 +139,21 @@ var factory = function factory(Input) {
|
|||
key: 'componentWillUpdate',
|
||||
value: function componentWillUpdate(nextProps, nextState) {
|
||||
if (!this.state.active && nextState.active) {
|
||||
_events2.default.addEventsToDocument({ click: this.handleDocumentClick });
|
||||
_events2.default.addEventsToDocument(this.getDocumentEvents());
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'componentDidUpdate',
|
||||
value: function componentDidUpdate(prevProps, prevState) {
|
||||
if (prevState.active && !this.state.active) {
|
||||
_events2.default.removeEventsFromDocument({ click: this.handleDocumentClick });
|
||||
_events2.default.removeEventsFromDocument(this.getDocumentEvents());
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'componentWillUnmount',
|
||||
value: function componentWillUnmount() {
|
||||
if (this.state.active) {
|
||||
_events2.default.removeEventsFromDocument({ click: this.handleDocumentClick });
|
||||
_events2.default.removeEventsFromDocument(this.getDocumentEvents());
|
||||
}
|
||||
}
|
||||
}, {
|
||||
|
@ -187,7 +193,8 @@ var factory = function factory(Input) {
|
|||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _classnames2;
|
||||
var _classnames2,
|
||||
_this2 = this;
|
||||
|
||||
var _props = this.props,
|
||||
template = _props.template,
|
||||
|
@ -210,6 +217,9 @@ var factory = function factory(Input) {
|
|||
onClick: this.handleClick,
|
||||
required: this.props.required,
|
||||
readOnly: true,
|
||||
ref: function ref(node) {
|
||||
_this2.inputNode = node && node.getWrappedInstance();
|
||||
},
|
||||
type: template && selected ? 'hidden' : null,
|
||||
value: selected && selected.label ? selected.label : ''
|
||||
})),
|
||||
|
|
|
@ -100,7 +100,7 @@ var factory = function factory(TimePickerDialog, Input) {
|
|||
_createClass(TimePicker, [{
|
||||
key: 'componentWillReceiveProps',
|
||||
value: function componentWillReceiveProps(nextProps) {
|
||||
if (this.state.active !== nextProps.active) {
|
||||
if (nextProps.active !== this.props.active && this.state.active !== nextProps.active) {
|
||||
this.setState({ active: nextProps.active });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ var factory = function factory(Dialog) {
|
|||
|
||||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = TimePickerDialog.__proto__ || Object.getPrototypeOf(TimePickerDialog)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
||||
display: 'hours',
|
||||
displayTime: _this.props.value
|
||||
displayTime: new Date(_this.props.value.getTime())
|
||||
}, _this.handleClockChange = function (value) {
|
||||
_this.setState({ displayTime: value });
|
||||
}, _this.handleSelect = function (event) {
|
||||
|
@ -62,6 +62,13 @@ var factory = function factory(Dialog) {
|
|||
}
|
||||
|
||||
_createClass(TimePickerDialog, [{
|
||||
key: 'componentWillUpdate',
|
||||
value: function componentWillUpdate(nextProps) {
|
||||
if (nextProps.value.getTime() !== this.state.displayTime.getTime()) {
|
||||
this.setState({ displayTime: new Date(nextProps.value.getTime()) });
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'componentDidUpdate',
|
||||
value: function componentDidUpdate(prevProps) {
|
||||
if (!prevProps.active && this.props.active) {
|
||||
|
|
Loading…
Reference in New Issue