react-select-async-paginate
Advanced tools
Comparing version 0.3.5 to 0.3.6
@@ -130,22 +130,58 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(oldProps) { | ||
var _this$props = this.props, | ||
cacheUniq = _this$props.cacheUniq, | ||
inputValue = _this$props.inputValue, | ||
menuIsOpen = _this$props.menuIsOpen; | ||
value: function () { | ||
var _componentDidUpdate = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
_regeneratorRuntime.mark(function _callee3(oldProps) { | ||
var _this$props, cacheUniq, defaultOptions, inputValue, menuIsOpen; | ||
if (oldProps.cacheUniq !== cacheUniq) { | ||
this.setState({ | ||
optionsCache: {} | ||
}); | ||
} else { | ||
if (inputValue !== oldProps.inputValue) { | ||
this.handleInputChange(inputValue); | ||
} | ||
return _regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_this$props = this.props, cacheUniq = _this$props.cacheUniq, defaultOptions = _this$props.defaultOptions, inputValue = _this$props.inputValue, menuIsOpen = _this$props.menuIsOpen; | ||
if (menuIsOpen && !oldProps.menuIsOpen) { | ||
this.onMenuOpen(); | ||
} | ||
if (!(oldProps.cacheUniq !== cacheUniq)) { | ||
_context3.next = 8; | ||
break; | ||
} | ||
this.setState({ | ||
optionsCache: {} | ||
}); | ||
if (!(defaultOptions === true)) { | ||
_context3.next = 6; | ||
break; | ||
} | ||
_context3.next = 6; | ||
return this.loadOptions(); | ||
case 6: | ||
_context3.next = 10; | ||
break; | ||
case 8: | ||
if (inputValue !== oldProps.inputValue) { | ||
this.handleInputChange(inputValue); | ||
} | ||
if (menuIsOpen && !oldProps.menuIsOpen) { | ||
this.onMenuOpen(); | ||
} | ||
case 10: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
} | ||
}, _callee3, this); | ||
})); | ||
function componentDidUpdate(_x) { | ||
return _componentDidUpdate.apply(this, arguments); | ||
} | ||
} | ||
return componentDidUpdate; | ||
}() | ||
}, { | ||
@@ -156,7 +192,7 @@ key: "onMenuOpen", | ||
/*#__PURE__*/ | ||
_regeneratorRuntime.mark(function _callee3() { | ||
_regeneratorRuntime.mark(function _callee4() { | ||
var optionsCache; | ||
return _regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
return _regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
switch (_context4.prev = _context4.next) { | ||
case 0: | ||
@@ -166,7 +202,7 @@ optionsCache = this.state.optionsCache; | ||
if (optionsCache['']) { | ||
_context3.next = 4; | ||
_context4.next = 4; | ||
break; | ||
} | ||
_context3.next = 4; | ||
_context4.next = 4; | ||
return this.loadOptions(); | ||
@@ -176,6 +212,6 @@ | ||
case "end": | ||
return _context3.stop(); | ||
return _context4.stop(); | ||
} | ||
} | ||
}, _callee3, this); | ||
}, _callee4, this); | ||
})); | ||
@@ -206,7 +242,7 @@ | ||
/*#__PURE__*/ | ||
_regeneratorRuntime.mark(function _callee4(search) { | ||
_regeneratorRuntime.mark(function _callee5(search) { | ||
var optionsCache; | ||
return _regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
return _regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
while (1) { | ||
switch (_context4.prev = _context4.next) { | ||
switch (_context5.prev = _context5.next) { | ||
case 0: | ||
@@ -216,7 +252,7 @@ optionsCache = this.state.optionsCache; | ||
if (optionsCache[search]) { | ||
_context4.next = 4; | ||
_context5.next = 4; | ||
break; | ||
} | ||
_context4.next = 4; | ||
_context5.next = 4; | ||
return this.loadOptions(); | ||
@@ -226,9 +262,9 @@ | ||
case "end": | ||
return _context4.stop(); | ||
return _context5.stop(); | ||
} | ||
} | ||
}, _callee4, this); | ||
}, _callee5, this); | ||
})); | ||
function handleInputChange(_x) { | ||
function handleInputChange(_x2) { | ||
return _handleInputChange.apply(this, arguments); | ||
@@ -244,8 +280,8 @@ } | ||
/*#__PURE__*/ | ||
_regeneratorRuntime.mark(function _callee5() { | ||
_regeneratorRuntime.mark(function _callee6() { | ||
var inputValue, optionsCache, currentOptions, debounceTimeout, newInputValue, hasError, additional, options, hasMore, _loadOptions2, response, newAdditional, reduceOptions; | ||
return _regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
return _regeneratorRuntime.wrap(function _callee6$(_context6) { | ||
while (1) { | ||
switch (_context5.prev = _context5.next) { | ||
switch (_context6.prev = _context6.next) { | ||
case 0: | ||
@@ -257,10 +293,10 @@ inputValue = this.props.inputValue; | ||
if (!(currentOptions.isLoading || !currentOptions.hasMore)) { | ||
_context5.next = 5; | ||
_context6.next = 5; | ||
break; | ||
} | ||
return _context5.abrupt("return"); | ||
return _context6.abrupt("return"); | ||
case 5: | ||
_context5.next = 7; | ||
_context6.next = 7; | ||
return this.setState(function (prevState) { | ||
@@ -278,7 +314,7 @@ return { | ||
if (!(debounceTimeout > 0)) { | ||
_context5.next = 16; | ||
_context6.next = 16; | ||
break; | ||
} | ||
_context5.next = 11; | ||
_context6.next = 11; | ||
return sleep(debounceTimeout); | ||
@@ -290,7 +326,7 @@ | ||
if (!(inputValue !== newInputValue)) { | ||
_context5.next = 16; | ||
_context6.next = 16; | ||
break; | ||
} | ||
_context5.next = 15; | ||
_context6.next = 15; | ||
return this.setState(function (prevState) { | ||
@@ -305,12 +341,12 @@ return { | ||
case 15: | ||
return _context5.abrupt("return"); | ||
return _context6.abrupt("return"); | ||
case 16: | ||
_context5.prev = 16; | ||
_context6.prev = 16; | ||
_loadOptions2 = this.props.loadOptions; | ||
_context5.next = 20; | ||
_context6.next = 20; | ||
return _loadOptions2(inputValue, currentOptions.options, currentOptions.additional); | ||
case 20: | ||
response = _context5.sent; | ||
response = _context6.sent; | ||
options = response.options; | ||
@@ -320,8 +356,8 @@ hasMore = response.hasMore; | ||
hasError = false; | ||
_context5.next = 30; | ||
_context6.next = 30; | ||
break; | ||
case 27: | ||
_context5.prev = 27; | ||
_context5.t0 = _context5["catch"](16); | ||
_context6.prev = 27; | ||
_context6.t0 = _context6["catch"](16); | ||
hasError = true; | ||
@@ -331,7 +367,7 @@ | ||
if (!hasError) { | ||
_context5.next = 35; | ||
_context6.next = 35; | ||
break; | ||
} | ||
_context5.next = 33; | ||
_context6.next = 33; | ||
return this.setState(function (prevState) { | ||
@@ -346,3 +382,3 @@ return { | ||
case 33: | ||
_context5.next = 39; | ||
_context6.next = 39; | ||
break; | ||
@@ -353,3 +389,3 @@ | ||
reduceOptions = this.props.reduceOptions; | ||
_context5.next = 39; | ||
_context6.next = 39; | ||
return this.setState(function (prevState) { | ||
@@ -369,6 +405,6 @@ return { | ||
case "end": | ||
return _context5.stop(); | ||
return _context6.stop(); | ||
} | ||
} | ||
}, _callee5, this, [[16, 27]]); | ||
}, _callee6, this, [[16, 27]]); | ||
})); | ||
@@ -375,0 +411,0 @@ |
@@ -155,22 +155,58 @@ "use strict"; | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(oldProps) { | ||
var _this$props = this.props, | ||
cacheUniq = _this$props.cacheUniq, | ||
inputValue = _this$props.inputValue, | ||
menuIsOpen = _this$props.menuIsOpen; | ||
value: function () { | ||
var _componentDidUpdate = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee3(oldProps) { | ||
var _this$props, cacheUniq, defaultOptions, inputValue, menuIsOpen; | ||
if (oldProps.cacheUniq !== cacheUniq) { | ||
this.setState({ | ||
optionsCache: {} | ||
}); | ||
} else { | ||
if (inputValue !== oldProps.inputValue) { | ||
this.handleInputChange(inputValue); | ||
} | ||
return _regenerator["default"].wrap(function _callee3$(_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_this$props = this.props, cacheUniq = _this$props.cacheUniq, defaultOptions = _this$props.defaultOptions, inputValue = _this$props.inputValue, menuIsOpen = _this$props.menuIsOpen; | ||
if (menuIsOpen && !oldProps.menuIsOpen) { | ||
this.onMenuOpen(); | ||
} | ||
if (!(oldProps.cacheUniq !== cacheUniq)) { | ||
_context3.next = 8; | ||
break; | ||
} | ||
this.setState({ | ||
optionsCache: {} | ||
}); | ||
if (!(defaultOptions === true)) { | ||
_context3.next = 6; | ||
break; | ||
} | ||
_context3.next = 6; | ||
return this.loadOptions(); | ||
case 6: | ||
_context3.next = 10; | ||
break; | ||
case 8: | ||
if (inputValue !== oldProps.inputValue) { | ||
this.handleInputChange(inputValue); | ||
} | ||
if (menuIsOpen && !oldProps.menuIsOpen) { | ||
this.onMenuOpen(); | ||
} | ||
case 10: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
} | ||
}, _callee3, this); | ||
})); | ||
function componentDidUpdate(_x) { | ||
return _componentDidUpdate.apply(this, arguments); | ||
} | ||
} | ||
return componentDidUpdate; | ||
}() | ||
}, { | ||
@@ -181,7 +217,7 @@ key: "onMenuOpen", | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee3() { | ||
_regenerator["default"].mark(function _callee4() { | ||
var optionsCache; | ||
return _regenerator["default"].wrap(function _callee3$(_context3) { | ||
return _regenerator["default"].wrap(function _callee4$(_context4) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
switch (_context4.prev = _context4.next) { | ||
case 0: | ||
@@ -191,7 +227,7 @@ optionsCache = this.state.optionsCache; | ||
if (optionsCache['']) { | ||
_context3.next = 4; | ||
_context4.next = 4; | ||
break; | ||
} | ||
_context3.next = 4; | ||
_context4.next = 4; | ||
return this.loadOptions(); | ||
@@ -201,6 +237,6 @@ | ||
case "end": | ||
return _context3.stop(); | ||
return _context4.stop(); | ||
} | ||
} | ||
}, _callee3, this); | ||
}, _callee4, this); | ||
})); | ||
@@ -231,7 +267,7 @@ | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee4(search) { | ||
_regenerator["default"].mark(function _callee5(search) { | ||
var optionsCache; | ||
return _regenerator["default"].wrap(function _callee4$(_context4) { | ||
return _regenerator["default"].wrap(function _callee5$(_context5) { | ||
while (1) { | ||
switch (_context4.prev = _context4.next) { | ||
switch (_context5.prev = _context5.next) { | ||
case 0: | ||
@@ -241,7 +277,7 @@ optionsCache = this.state.optionsCache; | ||
if (optionsCache[search]) { | ||
_context4.next = 4; | ||
_context5.next = 4; | ||
break; | ||
} | ||
_context4.next = 4; | ||
_context5.next = 4; | ||
return this.loadOptions(); | ||
@@ -251,9 +287,9 @@ | ||
case "end": | ||
return _context4.stop(); | ||
return _context5.stop(); | ||
} | ||
} | ||
}, _callee4, this); | ||
}, _callee5, this); | ||
})); | ||
function handleInputChange(_x) { | ||
function handleInputChange(_x2) { | ||
return _handleInputChange.apply(this, arguments); | ||
@@ -269,8 +305,8 @@ } | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee5() { | ||
_regenerator["default"].mark(function _callee6() { | ||
var inputValue, optionsCache, currentOptions, debounceTimeout, newInputValue, hasError, additional, options, hasMore, _loadOptions2, response, newAdditional, reduceOptions; | ||
return _regenerator["default"].wrap(function _callee5$(_context5) { | ||
return _regenerator["default"].wrap(function _callee6$(_context6) { | ||
while (1) { | ||
switch (_context5.prev = _context5.next) { | ||
switch (_context6.prev = _context6.next) { | ||
case 0: | ||
@@ -282,10 +318,10 @@ inputValue = this.props.inputValue; | ||
if (!(currentOptions.isLoading || !currentOptions.hasMore)) { | ||
_context5.next = 5; | ||
_context6.next = 5; | ||
break; | ||
} | ||
return _context5.abrupt("return"); | ||
return _context6.abrupt("return"); | ||
case 5: | ||
_context5.next = 7; | ||
_context6.next = 7; | ||
return this.setState(function (prevState) { | ||
@@ -303,7 +339,7 @@ return { | ||
if (!(debounceTimeout > 0)) { | ||
_context5.next = 16; | ||
_context6.next = 16; | ||
break; | ||
} | ||
_context5.next = 11; | ||
_context6.next = 11; | ||
return sleep(debounceTimeout); | ||
@@ -315,7 +351,7 @@ | ||
if (!(inputValue !== newInputValue)) { | ||
_context5.next = 16; | ||
_context6.next = 16; | ||
break; | ||
} | ||
_context5.next = 15; | ||
_context6.next = 15; | ||
return this.setState(function (prevState) { | ||
@@ -330,12 +366,12 @@ return { | ||
case 15: | ||
return _context5.abrupt("return"); | ||
return _context6.abrupt("return"); | ||
case 16: | ||
_context5.prev = 16; | ||
_context6.prev = 16; | ||
_loadOptions2 = this.props.loadOptions; | ||
_context5.next = 20; | ||
_context6.next = 20; | ||
return _loadOptions2(inputValue, currentOptions.options, currentOptions.additional); | ||
case 20: | ||
response = _context5.sent; | ||
response = _context6.sent; | ||
options = response.options; | ||
@@ -345,8 +381,8 @@ hasMore = response.hasMore; | ||
hasError = false; | ||
_context5.next = 30; | ||
_context6.next = 30; | ||
break; | ||
case 27: | ||
_context5.prev = 27; | ||
_context5.t0 = _context5["catch"](16); | ||
_context6.prev = 27; | ||
_context6.t0 = _context6["catch"](16); | ||
hasError = true; | ||
@@ -356,7 +392,7 @@ | ||
if (!hasError) { | ||
_context5.next = 35; | ||
_context6.next = 35; | ||
break; | ||
} | ||
_context5.next = 33; | ||
_context6.next = 33; | ||
return this.setState(function (prevState) { | ||
@@ -371,3 +407,3 @@ return { | ||
case 33: | ||
_context5.next = 39; | ||
_context6.next = 39; | ||
break; | ||
@@ -378,3 +414,3 @@ | ||
reduceOptions = this.props.reduceOptions; | ||
_context5.next = 39; | ||
_context6.next = 39; | ||
return this.setState(function (prevState) { | ||
@@ -394,6 +430,6 @@ return { | ||
case "end": | ||
return _context5.stop(); | ||
return _context6.stop(); | ||
} | ||
} | ||
}, _callee5, this, [[16, 27]]); | ||
}, _callee6, this, [[16, 27]]); | ||
})); | ||
@@ -400,0 +436,0 @@ |
{ | ||
"name": "react-select-async-paginate", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "Wrapper above react-select that supports pagination on menu scroll", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
65418
1399