Skip to content

Commit

Permalink
v2.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Feb 6, 2015
1 parent 8781a47 commit e0dbb79
Show file tree
Hide file tree
Showing 20 changed files with 2,706 additions and 2,523 deletions.
10 changes: 5 additions & 5 deletions browser/react-widgets.js

Large diffs are not rendered by default.

4,972 changes: 2,565 additions & 2,407 deletions docs/docs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var App = React.createClass({
data: data,
selectValues: []
.concat(self.state.selectValues)
.concat(tag)
.concat(tag.id)
})
}

Expand Down
6 changes: 2 additions & 4 deletions lib/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var Calendar = React.createClass({

displayName: "Calendar",

mixins: [require("./mixins/WidgetMixin"), require("./mixins/PureRenderMixin"), require("./mixins/RtlParentContextMixin")],
mixins: [require("./mixins/WidgetMixin"), require("./mixins/TimeoutMixin"), require("./mixins/PureRenderMixin"), require("./mixins/RtlParentContextMixin")],

propTypes: propTypes,

Expand Down Expand Up @@ -196,9 +196,7 @@ var Calendar = React.createClass({

if (+this.props.tabIndex === -1) return;

clearTimeout(this.timer);

this.timer = setTimeout(function () {
this.setTimeout("focus", function () {
if (focused) _this.getDOMNode().focus();

if (focused !== _this.state.focused) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var ComboBox = React.createClass({

displayName: "ComboBox",

mixins: [require("./mixins/WidgetMixin"), require("./mixins/TextSearchMixin"), require("./mixins/DataFilterMixin"), require("./mixins/DataHelpersMixin"), require("./mixins/PopupScrollToMixin"), require("./mixins/RtlParentContextMixin")],
mixins: [require("./mixins/WidgetMixin"), require("./mixins/TimeoutMixin"), require("./mixins/DataFilterMixin"), require("./mixins/DataHelpersMixin"), require("./mixins/PopupScrollToMixin"), require("./mixins/RtlParentContextMixin")],

propTypes: propTypes,

Expand Down
6 changes: 2 additions & 4 deletions lib/DateTimePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var propTypes = {
var DateTimePicker = React.createClass({
displayName: "DateTimePicker",

mixins: [require("./mixins/WidgetMixin"), require("./mixins/PureRenderMixin"), require("./mixins/PopupScrollToMixin"), require("./mixins/RtlParentContextMixin")],
mixins: [require("./mixins/WidgetMixin"), require("./mixins/TimeoutMixin"), require("./mixins/PureRenderMixin"), require("./mixins/PopupScrollToMixin"), require("./mixins/RtlParentContextMixin")],

propTypes: propTypes,

Expand Down Expand Up @@ -257,9 +257,7 @@ var DateTimePicker = React.createClass({
var _this = this;
var input = this.refs.valueInput;

clearTimeout(this.timer);

this.timer = setTimeout(function () {
this.setTimeout("focus", function () {
if (focused) input.getDOMNode().focus();else _this.close();

if (focused !== _this.state.focused) {
Expand Down
23 changes: 11 additions & 12 deletions lib/DropdownList.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var DropdownList = React.createClass({

displayName: "DropdownList",

mixins: [require("./mixins/WidgetMixin"), require("./mixins/PureRenderMixin"), require("./mixins/DataHelpersMixin"), require("./mixins/PopupScrollToMixin"), require("./mixins/RtlParentContextMixin")],
mixins: [require("./mixins/WidgetMixin"), require("./mixins/TimeoutMixin"), require("./mixins/PureRenderMixin"), require("./mixins/DataHelpersMixin"), require("./mixins/PopupScrollToMixin"), require("./mixins/RtlParentContextMixin")],

propTypes: propTypes,

Expand All @@ -76,7 +76,7 @@ var DropdownList = React.createClass({
};
},

componentDidMount: function () {
componentDidMount: function componentDidMount() {
validateList(this.refs.list);
},

Expand Down Expand Up @@ -166,17 +166,17 @@ var DropdownList = React.createClass({
},

_focus: function (focused, e) {
var self = this;
var _this = this;


clearTimeout(self.timer);
self.timer = setTimeout(function () {
if (focused) self.getDOMNode().focus();else self.close();
this.setTimeout("focus", function () {
if (focused) _this.getDOMNode().focus();else _this.close();

if (focused !== self.state.focused) {
self.notify(focused ? "onFocus" : "onBlur", e);
self.setState({ focused: focused });
if (focused !== _this.state.focused) {
_this.notify(focused ? "onFocus" : "onBlur", e);
_this.setState({ focused: focused });
}
}, 0);
});
},

_onSelect: function (data) {
Expand Down Expand Up @@ -242,10 +242,9 @@ var DropdownList = React.createClass({
var _this = this;
var word = ((this._searchTerm || "") + character).toLowerCase();

clearTimeout(this._timer);
this._searchTerm = word;

this._timer = setTimeout(function () {
this.setTimeout("search", function () {
var list = _this.refs.list,
key = _this.props.open ? "focusedItem" : "selectedItem",
item = list.next(_this.state[key], word);
Expand Down
6 changes: 2 additions & 4 deletions lib/Multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var Multiselect = React.createClass({

displayName: "Multiselect",

mixins: [require("./mixins/WidgetMixin"), require("./mixins/DataFilterMixin"), require("./mixins/DataHelpersMixin"), require("./mixins/PopupScrollToMixin"), require("./mixins/RtlParentContextMixin")],
mixins: [require("./mixins/WidgetMixin"), require("./mixins/TimeoutMixin"), require("./mixins/DataFilterMixin"), require("./mixins/DataHelpersMixin"), require("./mixins/PopupScrollToMixin"), require("./mixins/RtlParentContextMixin")],

propTypes: propTypes,

Expand Down Expand Up @@ -237,9 +237,7 @@ var Multiselect = React.createClass({
var _this = this;
if (this.props.disabled === true) return;

clearTimeout(this.timer);

this.timer = setTimeout(function () {
this.setTimeout("focus", function () {
if (focused) {
_this.refs.input.focus();
_this.open();
Expand Down
6 changes: 3 additions & 3 deletions lib/NumberPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var NumberPicker = React.createClass({

displayName: "NumberPicker",

mixins: [require("./mixins/WidgetMixin"), require("./mixins/PureRenderMixin"), require("./mixins/RtlParentContextMixin")],
mixins: [require("./mixins/WidgetMixin"), require("./mixins/TimeoutMixin"), require("./mixins/PureRenderMixin"), require("./mixins/RtlParentContextMixin")],

propTypes: propTypes,

Expand Down Expand Up @@ -187,9 +187,9 @@ var NumberPicker = React.createClass({

_focus: function (focused, e) {
var _this = this;
clearTimeout(this.timer);

this.timer = setTimeout(function () {

this.setTimeout("focus", function () {
var el = _this.refs.input.getDOMNode();

focused && el.focus();
Expand Down
44 changes: 28 additions & 16 deletions lib/SelectList.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var React = require("react"),
PlainList = require("./List"),
GroupableList = require("./ListGroupable"),
validateList = require("./util/validateListInterface"),
filter = require("./util/filter"),
scrollTo = require("./util/dom/scroll");

var propTypes = {
Expand All @@ -30,6 +31,7 @@ var propTypes = {

busy: React.PropTypes.bool,

filter: React.PropTypes.string,
delay: React.PropTypes.number,

disabled: React.PropTypes.oneOfType([React.PropTypes.array, React.PropTypes.bool, React.PropTypes.oneOf(["disabled"])]),
Expand All @@ -47,7 +49,7 @@ var SelectList = React.createClass({

propTypes: propTypes,

mixins: [require("./mixins/WidgetMixin"), require("./mixins/TextSearchMixin"), require("./mixins/DataHelpersMixin"), require("./mixins/RtlParentContextMixin")],
mixins: [require("./mixins/WidgetMixin"), require("./mixins/TimeoutMixin"), require("./mixins/DataHelpersMixin"), require("./mixins/RtlParentContextMixin")],

getDefaultProps: function getDefaultProps() {
return {
Expand Down Expand Up @@ -124,12 +126,13 @@ var SelectList = React.createClass({
"rw-rtl": this.isRtl(),
"rw-loading-mask": this.props.busy
}) }),
React.createElement(List, { ref: "list",
React.createElement(List, _extends({ ref: "list"
}, _.pick(this.props, Object.keys(List.type.propTypes)), {
data: this._data(),
focused: focusedItem,
optID: optID,
itemComponent: this.state.ListItem,
onMove: this._scrollTo })
onMove: this._scrollTo }))
);
},

Expand Down Expand Up @@ -172,7 +175,7 @@ var SelectList = React.createClass({
} else if (this.props.multiple && e.keyCode === 65 && e.ctrlKey) {
e.preventDefault();
this._selectAll();
} else this.search(String.fromCharCode(e.keyCode), this._locate);
} else this.search(String.fromCharCode(e.keyCode));

function change(item, cked) {
if (item) {
Expand Down Expand Up @@ -238,16 +241,15 @@ var SelectList = React.createClass({
},

_focus: function (focused, e) {
var self = this;
var _this = this;

clearTimeout(self.timer);

self.timer = setTimeout(function () {
if (focused) self.getDOMNode().focus();
if (focused !== self.state.focused) {
self.setState({ focused: focused });
this.setTimeout("focus", function () {
if (focused) _this.getDOMNode().focus();
if (focused !== _this.state.focused) {
_this.setState({ focused: focused });
}
}, 0);
});
},

isDisabledItem: function (item) {
Expand All @@ -258,10 +260,20 @@ var SelectList = React.createClass({
return this.isReadOnly() || this._contains(item, this.props.readOnly);
},

_locate: function (word) {
var idx = this.findNextWordIndex(word, this.state.focusedIndex);
search: function (character) {
var _this = this;
var word = ((this._searchTerm || "") + character).toLowerCase(),
list = this.refs.list;

this._searchTerm = word;

if (idx !== -1) this.setFocusedIndex(idx);
this.setTimeout("search", function () {
var focusedItem = list.next(_this.state.focusedItem, word);

_this._searchTerm = "";

if (focusedItem) _this.setState({ focusedItem: focusedItem });
}, this.props.delay);
},

_data: function () {
Expand All @@ -278,6 +290,7 @@ var SelectList = React.createClass({

});


function getListItem(parent) {
return React.createClass({

Expand Down Expand Up @@ -323,5 +336,4 @@ module.exports = SelectList;

module.exports = controlledInput.createControlledClass(SelectList, { value: "onChange" });

module.exports.BaseSelectList = SelectList;
//!focused && self.next(0)
module.exports.BaseSelectList = SelectList;
4 changes: 3 additions & 1 deletion lib/SlideTransition.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ module.exports = React.createClass({
_wrapChild: function (child, ref) {
return React.createElement(
SlideChildGroup,
{ key: child.key, ref: ref, direction: this.props.direction, duration: this.props.duration },
{ key: child.key, ref: ref,
direction: this.props.direction,
duration: this.props.duration },
child
);
},
Expand Down
11 changes: 6 additions & 5 deletions lib/TimeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ module.exports = React.createClass({
preserveDate: React.PropTypes.bool,
culture: React.PropTypes.string },

getDefaultProps: function () {
mixins: [require("./mixins/TimeoutMixin")],

getDefaultProps: function getDefaultProps() {
return {
step: 30,
format: "t",
Expand All @@ -32,7 +34,7 @@ module.exports = React.createClass({
};
},

getInitialState: function () {
getInitialState: function getInitialState() {
var data = this._dates(this.props),
focusedItem = this._closestDate(data, this.props.value);

Expand All @@ -42,7 +44,7 @@ module.exports = React.createClass({
};
},

componentWillReceiveProps: function (nextProps) {
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var data = this._dates(nextProps),
focusedItem = this._closestDate(data, this.props.value);

Expand Down Expand Up @@ -158,10 +160,9 @@ module.exports = React.createClass({
var _this = this;
var word = ((this._searchTerm || "") + character).toLowerCase();

clearTimeout(this._timer);
this._searchTerm = word;

this._timer = setTimeout(function () {
this.setTimeout("search", function () {
var list = _this.refs.list,
item = list.next(_this.state.focusedItem, word);

Expand Down
3 changes: 1 addition & 2 deletions lib/mixins/DataFilterMixin.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use strict";
var React = require("react"),
filters = require("../util/filter"),
helper = require("./DataHelpersMixin"),
_ = require("../util/_");
helper = require("./DataHelpersMixin");

var filterTypes = Object.keys(filters).filter(function (i) {
return i !== "filter";
Expand Down
11 changes: 10 additions & 1 deletion lib/mixins/DataHelpersMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@ module.exports = {
},

_dataIndexOf: function (data, item) {
return _.findIndex(data, this._valueMatcher.bind(null, item), this);
var _this = this;
var idx = -1,
len = data.length,
finder = function (datum) {
return _this._valueMatcher(item, datum);
};

while (++idx < len) if (finder(data[idx])) return idx;

return -1;
},

_valueMatcher: function (a, b) {
Expand Down
Loading

0 comments on commit e0dbb79

Please sign in to comment.