mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
227
web/node_modules/react-select/async/dist/react-select.cjs.dev.js
generated
vendored
Normal file
227
web/node_modules/react-select/async/dist/react-select.cjs.dev.js
generated
vendored
Normal file
|
@ -0,0 +1,227 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var _extends = require('@babel/runtime/helpers/extends');
|
||||
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
||||
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
||||
var index = require('../../dist/index-fe3694ff.cjs.dev.js');
|
||||
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
||||
var _createClass = require('@babel/runtime/helpers/createClass');
|
||||
var _inherits = require('@babel/runtime/helpers/inherits');
|
||||
var React = require('react');
|
||||
var base_dist_reactSelect = require('../../dist/Select-92d95971.cjs.dev.js');
|
||||
var stateManager = require('../../dist/stateManager-80f4e9df.cjs.dev.js');
|
||||
require('@emotion/react');
|
||||
require('@babel/runtime/helpers/taggedTemplateLiteral');
|
||||
require('@babel/runtime/helpers/typeof');
|
||||
require('react-input-autosize');
|
||||
require('react-dom');
|
||||
require('@babel/runtime/helpers/toConsumableArray');
|
||||
require('memoize-one');
|
||||
|
||||
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
||||
|
||||
var _extends__default = /*#__PURE__*/_interopDefault(_extends);
|
||||
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefault(_objectWithoutProperties);
|
||||
var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
|
||||
var _classCallCheck__default = /*#__PURE__*/_interopDefault(_classCallCheck);
|
||||
var _createClass__default = /*#__PURE__*/_interopDefault(_createClass);
|
||||
var _inherits__default = /*#__PURE__*/_interopDefault(_inherits);
|
||||
var React__default = /*#__PURE__*/_interopDefault(React);
|
||||
|
||||
var defaultProps = {
|
||||
cacheOptions: false,
|
||||
defaultOptions: false,
|
||||
filterOption: null,
|
||||
isLoading: false
|
||||
};
|
||||
var makeAsyncSelect = function makeAsyncSelect(SelectComponent) {
|
||||
var _class, _temp;
|
||||
|
||||
return _temp = _class = /*#__PURE__*/function (_Component) {
|
||||
_inherits__default['default'](Async, _Component);
|
||||
|
||||
var _super = index._createSuper(Async);
|
||||
|
||||
function Async(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck__default['default'](this, Async);
|
||||
|
||||
_this = _super.call(this);
|
||||
_this.select = void 0;
|
||||
_this.lastRequest = void 0;
|
||||
_this.mounted = false;
|
||||
|
||||
_this.handleInputChange = function (newValue, actionMeta) {
|
||||
var _this$props = _this.props,
|
||||
cacheOptions = _this$props.cacheOptions,
|
||||
onInputChange = _this$props.onInputChange; // TODO
|
||||
|
||||
var inputValue = index.handleInputChange(newValue, actionMeta, onInputChange);
|
||||
|
||||
if (!inputValue) {
|
||||
delete _this.lastRequest;
|
||||
|
||||
_this.setState({
|
||||
inputValue: '',
|
||||
loadedInputValue: '',
|
||||
loadedOptions: [],
|
||||
isLoading: false,
|
||||
passEmptyOptions: false
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (cacheOptions && _this.state.optionsCache[inputValue]) {
|
||||
_this.setState({
|
||||
inputValue: inputValue,
|
||||
loadedInputValue: inputValue,
|
||||
loadedOptions: _this.state.optionsCache[inputValue],
|
||||
isLoading: false,
|
||||
passEmptyOptions: false
|
||||
});
|
||||
} else {
|
||||
var request = _this.lastRequest = {};
|
||||
|
||||
_this.setState({
|
||||
inputValue: inputValue,
|
||||
isLoading: true,
|
||||
passEmptyOptions: !_this.state.loadedInputValue
|
||||
}, function () {
|
||||
_this.loadOptions(inputValue, function (options) {
|
||||
if (!_this.mounted) return;
|
||||
if (request !== _this.lastRequest) return;
|
||||
delete _this.lastRequest;
|
||||
|
||||
_this.setState(function (state) {
|
||||
return {
|
||||
isLoading: false,
|
||||
loadedInputValue: inputValue,
|
||||
loadedOptions: options || [],
|
||||
passEmptyOptions: false,
|
||||
optionsCache: options ? index._objectSpread2(index._objectSpread2({}, state.optionsCache), {}, _defineProperty__default['default']({}, inputValue, options)) : state.optionsCache
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return inputValue;
|
||||
};
|
||||
|
||||
_this.state = {
|
||||
defaultOptions: Array.isArray(props.defaultOptions) ? props.defaultOptions : undefined,
|
||||
inputValue: typeof props.inputValue !== 'undefined' ? props.inputValue : '',
|
||||
isLoading: props.defaultOptions === true,
|
||||
loadedOptions: [],
|
||||
passEmptyOptions: false,
|
||||
optionsCache: {},
|
||||
prevDefaultOptions: undefined,
|
||||
prevCacheOptions: undefined
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass__default['default'](Async, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
var _this2 = this;
|
||||
|
||||
this.mounted = true;
|
||||
var defaultOptions = this.props.defaultOptions;
|
||||
var inputValue = this.state.inputValue;
|
||||
|
||||
if (defaultOptions === true) {
|
||||
this.loadOptions(inputValue, function (options) {
|
||||
if (!_this2.mounted) return;
|
||||
var isLoading = !!_this2.lastRequest;
|
||||
|
||||
_this2.setState({
|
||||
defaultOptions: options || [],
|
||||
isLoading: isLoading
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.mounted = false;
|
||||
}
|
||||
}, {
|
||||
key: "focus",
|
||||
value: function focus() {
|
||||
this.select.focus();
|
||||
}
|
||||
}, {
|
||||
key: "blur",
|
||||
value: function blur() {
|
||||
this.select.blur();
|
||||
}
|
||||
}, {
|
||||
key: "loadOptions",
|
||||
value: function loadOptions(inputValue, callback) {
|
||||
var loadOptions = this.props.loadOptions;
|
||||
if (!loadOptions) return callback();
|
||||
var loader = loadOptions(inputValue, callback);
|
||||
|
||||
if (loader && typeof loader.then === 'function') {
|
||||
loader.then(callback, function () {
|
||||
return callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this3 = this;
|
||||
|
||||
var _this$props2 = this.props;
|
||||
_this$props2.loadOptions;
|
||||
var isLoadingProp = _this$props2.isLoading,
|
||||
props = _objectWithoutProperties__default['default'](_this$props2, ["loadOptions", "isLoading"]);
|
||||
|
||||
var _this$state = this.state,
|
||||
defaultOptions = _this$state.defaultOptions,
|
||||
inputValue = _this$state.inputValue,
|
||||
isLoading = _this$state.isLoading,
|
||||
loadedInputValue = _this$state.loadedInputValue,
|
||||
loadedOptions = _this$state.loadedOptions,
|
||||
passEmptyOptions = _this$state.passEmptyOptions;
|
||||
var options = passEmptyOptions ? [] : inputValue && loadedInputValue ? loadedOptions : defaultOptions || [];
|
||||
return /*#__PURE__*/React__default['default'].createElement(SelectComponent, _extends__default['default']({}, props, {
|
||||
ref: function ref(_ref) {
|
||||
_this3.select = _ref;
|
||||
},
|
||||
options: options,
|
||||
isLoading: isLoading || isLoadingProp,
|
||||
onInputChange: this.handleInputChange
|
||||
}));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(props, state) {
|
||||
var newCacheOptionsState = props.cacheOptions !== state.prevCacheOptions ? {
|
||||
prevCacheOptions: props.cacheOptions,
|
||||
optionsCache: {}
|
||||
} : {};
|
||||
var newDefaultOptionsState = props.defaultOptions !== state.prevDefaultOptions ? {
|
||||
prevDefaultOptions: props.defaultOptions,
|
||||
defaultOptions: Array.isArray(props.defaultOptions) ? props.defaultOptions : undefined
|
||||
} : {};
|
||||
return index._objectSpread2(index._objectSpread2({}, newCacheOptionsState), newDefaultOptionsState);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Async;
|
||||
}(React.Component), _class.defaultProps = defaultProps, _temp;
|
||||
};
|
||||
var SelectState = stateManager.manageState(base_dist_reactSelect.Select);
|
||||
var Async = makeAsyncSelect(SelectState);
|
||||
|
||||
exports.default = Async;
|
||||
exports.defaultProps = defaultProps;
|
||||
exports.makeAsyncSelect = makeAsyncSelect;
|
7
web/node_modules/react-select/async/dist/react-select.cjs.js
generated
vendored
Normal file
7
web/node_modules/react-select/async/dist/react-select.cjs.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
module.exports = require("./react-select.cjs.prod.js");
|
||||
} else {
|
||||
module.exports = require("./react-select.cjs.dev.js");
|
||||
}
|
3
web/node_modules/react-select/async/dist/react-select.cjs.js.flow
generated
vendored
Normal file
3
web/node_modules/react-select/async/dist/react-select.cjs.js.flow
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
// @flow
|
||||
export * from "../../src/Async.js";
|
||||
export { default } from "../../src/Async.js";
|
151
web/node_modules/react-select/async/dist/react-select.cjs.prod.js
generated
vendored
Normal file
151
web/node_modules/react-select/async/dist/react-select.cjs.prod.js
generated
vendored
Normal file
|
@ -0,0 +1,151 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
});
|
||||
|
||||
var _extends = require("@babel/runtime/helpers/extends"), _objectWithoutProperties = require("@babel/runtime/helpers/objectWithoutProperties"), _defineProperty = require("@babel/runtime/helpers/defineProperty"), index = require("../../dist/index-ea9e225d.cjs.prod.js"), _classCallCheck = require("@babel/runtime/helpers/classCallCheck"), _createClass = require("@babel/runtime/helpers/createClass"), _inherits = require("@babel/runtime/helpers/inherits"), React = require("react"), base_dist_reactSelect = require("../../dist/Select-fd7cb895.cjs.prod.js"), stateManager = require("../../dist/stateManager-799f6a0f.cjs.prod.js");
|
||||
|
||||
function _interopDefault(e) {
|
||||
return e && e.__esModule ? e : {
|
||||
default: e
|
||||
};
|
||||
}
|
||||
|
||||
require("@emotion/react"), require("@babel/runtime/helpers/taggedTemplateLiteral"),
|
||||
require("@babel/runtime/helpers/typeof"), require("react-input-autosize"), require("react-dom"),
|
||||
require("@babel/runtime/helpers/toConsumableArray"), require("memoize-one");
|
||||
|
||||
var _extends__default = _interopDefault(_extends), _objectWithoutProperties__default = _interopDefault(_objectWithoutProperties), _defineProperty__default = _interopDefault(_defineProperty), _classCallCheck__default = _interopDefault(_classCallCheck), _createClass__default = _interopDefault(_createClass), _inherits__default = _interopDefault(_inherits), React__default = _interopDefault(React), defaultProps = {
|
||||
cacheOptions: !1,
|
||||
defaultOptions: !1,
|
||||
filterOption: null,
|
||||
isLoading: !1
|
||||
}, makeAsyncSelect = function(SelectComponent) {
|
||||
var _class, _temp;
|
||||
return _temp = _class = function(_Component) {
|
||||
_inherits__default.default(Async, _Component);
|
||||
var _super = index._createSuper(Async);
|
||||
function Async(props) {
|
||||
var _this;
|
||||
return _classCallCheck__default.default(this, Async), (_this = _super.call(this)).select = void 0,
|
||||
_this.lastRequest = void 0, _this.mounted = !1, _this.handleInputChange = function(newValue, actionMeta) {
|
||||
var _this$props = _this.props, cacheOptions = _this$props.cacheOptions, onInputChange = _this$props.onInputChange, inputValue = index.handleInputChange(newValue, actionMeta, onInputChange);
|
||||
if (!inputValue) return delete _this.lastRequest, void _this.setState({
|
||||
inputValue: "",
|
||||
loadedInputValue: "",
|
||||
loadedOptions: [],
|
||||
isLoading: !1,
|
||||
passEmptyOptions: !1
|
||||
});
|
||||
if (cacheOptions && _this.state.optionsCache[inputValue]) _this.setState({
|
||||
inputValue: inputValue,
|
||||
loadedInputValue: inputValue,
|
||||
loadedOptions: _this.state.optionsCache[inputValue],
|
||||
isLoading: !1,
|
||||
passEmptyOptions: !1
|
||||
}); else {
|
||||
var request = _this.lastRequest = {};
|
||||
_this.setState({
|
||||
inputValue: inputValue,
|
||||
isLoading: !0,
|
||||
passEmptyOptions: !_this.state.loadedInputValue
|
||||
}, (function() {
|
||||
_this.loadOptions(inputValue, (function(options) {
|
||||
_this.mounted && request === _this.lastRequest && (delete _this.lastRequest, _this.setState((function(state) {
|
||||
return {
|
||||
isLoading: !1,
|
||||
loadedInputValue: inputValue,
|
||||
loadedOptions: options || [],
|
||||
passEmptyOptions: !1,
|
||||
optionsCache: options ? index._objectSpread2(index._objectSpread2({}, state.optionsCache), {}, _defineProperty__default.default({}, inputValue, options)) : state.optionsCache
|
||||
};
|
||||
})));
|
||||
}));
|
||||
}));
|
||||
}
|
||||
return inputValue;
|
||||
}, _this.state = {
|
||||
defaultOptions: Array.isArray(props.defaultOptions) ? props.defaultOptions : void 0,
|
||||
inputValue: void 0 !== props.inputValue ? props.inputValue : "",
|
||||
isLoading: !0 === props.defaultOptions,
|
||||
loadedOptions: [],
|
||||
passEmptyOptions: !1,
|
||||
optionsCache: {},
|
||||
prevDefaultOptions: void 0,
|
||||
prevCacheOptions: void 0
|
||||
}, _this;
|
||||
}
|
||||
return _createClass__default.default(Async, [ {
|
||||
key: "componentDidMount",
|
||||
value: function() {
|
||||
var _this2 = this;
|
||||
this.mounted = !0;
|
||||
var defaultOptions = this.props.defaultOptions, inputValue = this.state.inputValue;
|
||||
!0 === defaultOptions && this.loadOptions(inputValue, (function(options) {
|
||||
if (_this2.mounted) {
|
||||
var isLoading = !!_this2.lastRequest;
|
||||
_this2.setState({
|
||||
defaultOptions: options || [],
|
||||
isLoading: isLoading
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function() {
|
||||
this.mounted = !1;
|
||||
}
|
||||
}, {
|
||||
key: "focus",
|
||||
value: function() {
|
||||
this.select.focus();
|
||||
}
|
||||
}, {
|
||||
key: "blur",
|
||||
value: function() {
|
||||
this.select.blur();
|
||||
}
|
||||
}, {
|
||||
key: "loadOptions",
|
||||
value: function(inputValue, callback) {
|
||||
var loadOptions = this.props.loadOptions;
|
||||
if (!loadOptions) return callback();
|
||||
var loader = loadOptions(inputValue, callback);
|
||||
loader && "function" == typeof loader.then && loader.then(callback, (function() {
|
||||
return callback();
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function() {
|
||||
var _this3 = this, _this$props2 = this.props;
|
||||
_this$props2.loadOptions;
|
||||
var isLoadingProp = _this$props2.isLoading, props = _objectWithoutProperties__default.default(_this$props2, [ "loadOptions", "isLoading" ]), _this$state = this.state, defaultOptions = _this$state.defaultOptions, inputValue = _this$state.inputValue, isLoading = _this$state.isLoading, loadedInputValue = _this$state.loadedInputValue, loadedOptions = _this$state.loadedOptions, options = _this$state.passEmptyOptions ? [] : inputValue && loadedInputValue ? loadedOptions : defaultOptions || [];
|
||||
return React__default.default.createElement(SelectComponent, _extends__default.default({}, props, {
|
||||
ref: function(_ref) {
|
||||
_this3.select = _ref;
|
||||
},
|
||||
options: options,
|
||||
isLoading: isLoading || isLoadingProp,
|
||||
onInputChange: this.handleInputChange
|
||||
}));
|
||||
}
|
||||
} ], [ {
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function(props, state) {
|
||||
var newCacheOptionsState = props.cacheOptions !== state.prevCacheOptions ? {
|
||||
prevCacheOptions: props.cacheOptions,
|
||||
optionsCache: {}
|
||||
} : {}, newDefaultOptionsState = props.defaultOptions !== state.prevDefaultOptions ? {
|
||||
prevDefaultOptions: props.defaultOptions,
|
||||
defaultOptions: Array.isArray(props.defaultOptions) ? props.defaultOptions : void 0
|
||||
} : {};
|
||||
return index._objectSpread2(index._objectSpread2({}, newCacheOptionsState), newDefaultOptionsState);
|
||||
}
|
||||
} ]), Async;
|
||||
}(React.Component), _class.defaultProps = defaultProps, _temp;
|
||||
}, SelectState = stateManager.manageState(base_dist_reactSelect.Select), Async = makeAsyncSelect(SelectState);
|
||||
|
||||
exports.default = Async, exports.defaultProps = defaultProps, exports.makeAsyncSelect = makeAsyncSelect;
|
212
web/node_modules/react-select/async/dist/react-select.esm.js
generated
vendored
Normal file
212
web/node_modules/react-select/async/dist/react-select.esm.js
generated
vendored
Normal file
|
@ -0,0 +1,212 @@
|
|||
import _extends from '@babel/runtime/helpers/esm/extends';
|
||||
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
||||
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
||||
import { _ as _createSuper, H as handleInputChange, a as _objectSpread2 } from '../../dist/index-4bd03571.esm.js';
|
||||
import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
|
||||
import _createClass from '@babel/runtime/helpers/esm/createClass';
|
||||
import _inherits from '@babel/runtime/helpers/esm/inherits';
|
||||
import React, { Component } from 'react';
|
||||
import { S as Select } from '../../dist/Select-dbb12e54.esm.js';
|
||||
import { m as manageState } from '../../dist/stateManager-845a3300.esm.js';
|
||||
import '@emotion/react';
|
||||
import '@babel/runtime/helpers/taggedTemplateLiteral';
|
||||
import '@babel/runtime/helpers/typeof';
|
||||
import 'react-input-autosize';
|
||||
import 'react-dom';
|
||||
import '@babel/runtime/helpers/toConsumableArray';
|
||||
import 'memoize-one';
|
||||
|
||||
var defaultProps = {
|
||||
cacheOptions: false,
|
||||
defaultOptions: false,
|
||||
filterOption: null,
|
||||
isLoading: false
|
||||
};
|
||||
var makeAsyncSelect = function makeAsyncSelect(SelectComponent) {
|
||||
var _class, _temp;
|
||||
|
||||
return _temp = _class = /*#__PURE__*/function (_Component) {
|
||||
_inherits(Async, _Component);
|
||||
|
||||
var _super = _createSuper(Async);
|
||||
|
||||
function Async(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Async);
|
||||
|
||||
_this = _super.call(this);
|
||||
_this.select = void 0;
|
||||
_this.lastRequest = void 0;
|
||||
_this.mounted = false;
|
||||
|
||||
_this.handleInputChange = function (newValue, actionMeta) {
|
||||
var _this$props = _this.props,
|
||||
cacheOptions = _this$props.cacheOptions,
|
||||
onInputChange = _this$props.onInputChange; // TODO
|
||||
|
||||
var inputValue = handleInputChange(newValue, actionMeta, onInputChange);
|
||||
|
||||
if (!inputValue) {
|
||||
delete _this.lastRequest;
|
||||
|
||||
_this.setState({
|
||||
inputValue: '',
|
||||
loadedInputValue: '',
|
||||
loadedOptions: [],
|
||||
isLoading: false,
|
||||
passEmptyOptions: false
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (cacheOptions && _this.state.optionsCache[inputValue]) {
|
||||
_this.setState({
|
||||
inputValue: inputValue,
|
||||
loadedInputValue: inputValue,
|
||||
loadedOptions: _this.state.optionsCache[inputValue],
|
||||
isLoading: false,
|
||||
passEmptyOptions: false
|
||||
});
|
||||
} else {
|
||||
var request = _this.lastRequest = {};
|
||||
|
||||
_this.setState({
|
||||
inputValue: inputValue,
|
||||
isLoading: true,
|
||||
passEmptyOptions: !_this.state.loadedInputValue
|
||||
}, function () {
|
||||
_this.loadOptions(inputValue, function (options) {
|
||||
if (!_this.mounted) return;
|
||||
if (request !== _this.lastRequest) return;
|
||||
delete _this.lastRequest;
|
||||
|
||||
_this.setState(function (state) {
|
||||
return {
|
||||
isLoading: false,
|
||||
loadedInputValue: inputValue,
|
||||
loadedOptions: options || [],
|
||||
passEmptyOptions: false,
|
||||
optionsCache: options ? _objectSpread2(_objectSpread2({}, state.optionsCache), {}, _defineProperty({}, inputValue, options)) : state.optionsCache
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return inputValue;
|
||||
};
|
||||
|
||||
_this.state = {
|
||||
defaultOptions: Array.isArray(props.defaultOptions) ? props.defaultOptions : undefined,
|
||||
inputValue: typeof props.inputValue !== 'undefined' ? props.inputValue : '',
|
||||
isLoading: props.defaultOptions === true,
|
||||
loadedOptions: [],
|
||||
passEmptyOptions: false,
|
||||
optionsCache: {},
|
||||
prevDefaultOptions: undefined,
|
||||
prevCacheOptions: undefined
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Async, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
var _this2 = this;
|
||||
|
||||
this.mounted = true;
|
||||
var defaultOptions = this.props.defaultOptions;
|
||||
var inputValue = this.state.inputValue;
|
||||
|
||||
if (defaultOptions === true) {
|
||||
this.loadOptions(inputValue, function (options) {
|
||||
if (!_this2.mounted) return;
|
||||
var isLoading = !!_this2.lastRequest;
|
||||
|
||||
_this2.setState({
|
||||
defaultOptions: options || [],
|
||||
isLoading: isLoading
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.mounted = false;
|
||||
}
|
||||
}, {
|
||||
key: "focus",
|
||||
value: function focus() {
|
||||
this.select.focus();
|
||||
}
|
||||
}, {
|
||||
key: "blur",
|
||||
value: function blur() {
|
||||
this.select.blur();
|
||||
}
|
||||
}, {
|
||||
key: "loadOptions",
|
||||
value: function loadOptions(inputValue, callback) {
|
||||
var loadOptions = this.props.loadOptions;
|
||||
if (!loadOptions) return callback();
|
||||
var loader = loadOptions(inputValue, callback);
|
||||
|
||||
if (loader && typeof loader.then === 'function') {
|
||||
loader.then(callback, function () {
|
||||
return callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this3 = this;
|
||||
|
||||
var _this$props2 = this.props;
|
||||
_this$props2.loadOptions;
|
||||
var isLoadingProp = _this$props2.isLoading,
|
||||
props = _objectWithoutProperties(_this$props2, ["loadOptions", "isLoading"]);
|
||||
|
||||
var _this$state = this.state,
|
||||
defaultOptions = _this$state.defaultOptions,
|
||||
inputValue = _this$state.inputValue,
|
||||
isLoading = _this$state.isLoading,
|
||||
loadedInputValue = _this$state.loadedInputValue,
|
||||
loadedOptions = _this$state.loadedOptions,
|
||||
passEmptyOptions = _this$state.passEmptyOptions;
|
||||
var options = passEmptyOptions ? [] : inputValue && loadedInputValue ? loadedOptions : defaultOptions || [];
|
||||
return /*#__PURE__*/React.createElement(SelectComponent, _extends({}, props, {
|
||||
ref: function ref(_ref) {
|
||||
_this3.select = _ref;
|
||||
},
|
||||
options: options,
|
||||
isLoading: isLoading || isLoadingProp,
|
||||
onInputChange: this.handleInputChange
|
||||
}));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(props, state) {
|
||||
var newCacheOptionsState = props.cacheOptions !== state.prevCacheOptions ? {
|
||||
prevCacheOptions: props.cacheOptions,
|
||||
optionsCache: {}
|
||||
} : {};
|
||||
var newDefaultOptionsState = props.defaultOptions !== state.prevDefaultOptions ? {
|
||||
prevDefaultOptions: props.defaultOptions,
|
||||
defaultOptions: Array.isArray(props.defaultOptions) ? props.defaultOptions : undefined
|
||||
} : {};
|
||||
return _objectSpread2(_objectSpread2({}, newCacheOptionsState), newDefaultOptionsState);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Async;
|
||||
}(Component), _class.defaultProps = defaultProps, _temp;
|
||||
};
|
||||
var SelectState = manageState(Select);
|
||||
var Async = makeAsyncSelect(SelectState);
|
||||
|
||||
export default Async;
|
||||
export { defaultProps, makeAsyncSelect };
|
7
web/node_modules/react-select/async/package.json
generated
vendored
Normal file
7
web/node_modules/react-select/async/package.json
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"main": "dist/react-select.cjs.js",
|
||||
"module": "dist/react-select.esm.js",
|
||||
"preconstruct": {
|
||||
"source": "../src/Async"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue