started adding the logic for RSS feeds, started storing metainfo and torrent files in database directly
This commit is contained in:
274
torrent-project/node_modules/react-select/lib/Async.js
generated
vendored
Normal file
274
torrent-project/node_modules/react-select/lib/Async.js
generated
vendored
Normal file
@@ -0,0 +1,274 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _Select = require('./Select');
|
||||
|
||||
var _Select2 = _interopRequireDefault(_Select);
|
||||
|
||||
var _stripDiacritics = require('./utils/stripDiacritics');
|
||||
|
||||
var _stripDiacritics2 = _interopRequireDefault(_stripDiacritics);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var propTypes = {
|
||||
autoload: _propTypes2.default.bool.isRequired, // automatically call the `loadOptions` prop on-mount; defaults to true
|
||||
cache: _propTypes2.default.any, // object to use to cache results; set to null/false to disable caching
|
||||
children: _propTypes2.default.func.isRequired, // Child function responsible for creating the inner Select component; (props: Object): PropTypes.element
|
||||
ignoreAccents: _propTypes2.default.bool, // strip diacritics when filtering; defaults to true
|
||||
ignoreCase: _propTypes2.default.bool, // perform case-insensitive filtering; defaults to true
|
||||
loadOptions: _propTypes2.default.func.isRequired, // callback to load options asynchronously; (inputValue: string, callback: Function): ?Promise
|
||||
loadingPlaceholder: _propTypes2.default.oneOfType([// replaces the placeholder while options are loading
|
||||
_propTypes2.default.string, _propTypes2.default.node]),
|
||||
multi: _propTypes2.default.bool, // multi-value input
|
||||
noResultsText: _propTypes2.default.oneOfType([// field noResultsText, displayed when no options come back from the server
|
||||
_propTypes2.default.string, _propTypes2.default.node]),
|
||||
onChange: _propTypes2.default.func, // onChange handler: function (newValue) {}
|
||||
onInputChange: _propTypes2.default.func, // optional for keeping track of what is being typed
|
||||
options: _propTypes2.default.array.isRequired, // array of options
|
||||
placeholder: _propTypes2.default.oneOfType([// field placeholder, displayed when there's no value (shared with Select)
|
||||
_propTypes2.default.string, _propTypes2.default.node]),
|
||||
searchPromptText: _propTypes2.default.oneOfType([// label to prompt for search input
|
||||
_propTypes2.default.string, _propTypes2.default.node]),
|
||||
value: _propTypes2.default.any // initial field value
|
||||
};
|
||||
|
||||
var defaultCache = {};
|
||||
|
||||
var defaultProps = {
|
||||
autoload: true,
|
||||
cache: defaultCache,
|
||||
children: defaultChildren,
|
||||
ignoreAccents: true,
|
||||
ignoreCase: true,
|
||||
loadingPlaceholder: 'Loading...',
|
||||
options: [],
|
||||
searchPromptText: 'Type to search'
|
||||
};
|
||||
|
||||
var Async = function (_Component) {
|
||||
_inherits(Async, _Component);
|
||||
|
||||
function Async(props, context) {
|
||||
_classCallCheck(this, Async);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (Async.__proto__ || Object.getPrototypeOf(Async)).call(this, props, context));
|
||||
|
||||
_this._cache = props.cache === defaultCache ? {} : props.cache;
|
||||
|
||||
_this.state = {
|
||||
inputValue: '',
|
||||
isLoading: false,
|
||||
options: props.options
|
||||
};
|
||||
|
||||
_this.onInputChange = _this.onInputChange.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Async, [{
|
||||
key: 'componentDidMount',
|
||||
value: function componentDidMount() {
|
||||
var autoload = this.props.autoload;
|
||||
|
||||
|
||||
if (autoload) {
|
||||
this.loadOptions('');
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'componentWillReceiveProps',
|
||||
value: function componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.options !== this.props.options) {
|
||||
this.setState({
|
||||
options: nextProps.options
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'componentWillUnmount',
|
||||
value: function componentWillUnmount() {
|
||||
this._callback = null;
|
||||
}
|
||||
}, {
|
||||
key: 'loadOptions',
|
||||
value: function loadOptions(inputValue) {
|
||||
var _this2 = this;
|
||||
|
||||
var loadOptions = this.props.loadOptions;
|
||||
|
||||
var cache = this._cache;
|
||||
|
||||
if (cache && Object.prototype.hasOwnProperty.call(cache, inputValue)) {
|
||||
this._callback = null;
|
||||
|
||||
this.setState({
|
||||
isLoading: false,
|
||||
options: cache[inputValue]
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var callback = function callback(error, data) {
|
||||
var options = data && data.options || [];
|
||||
|
||||
if (cache) {
|
||||
cache[inputValue] = options;
|
||||
}
|
||||
|
||||
if (callback === _this2._callback) {
|
||||
_this2._callback = null;
|
||||
|
||||
_this2.setState({
|
||||
isLoading: false,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Ignore all but the most recent request
|
||||
this._callback = callback;
|
||||
|
||||
var promise = loadOptions(inputValue, callback);
|
||||
if (promise) {
|
||||
promise.then(function (data) {
|
||||
return callback(null, data);
|
||||
}, function (error) {
|
||||
return callback(error);
|
||||
});
|
||||
}
|
||||
|
||||
if (this._callback && !this.state.isLoading) {
|
||||
this.setState({
|
||||
isLoading: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'onInputChange',
|
||||
value: function onInputChange(inputValue) {
|
||||
var _props = this.props,
|
||||
ignoreAccents = _props.ignoreAccents,
|
||||
ignoreCase = _props.ignoreCase,
|
||||
onInputChange = _props.onInputChange;
|
||||
|
||||
var newInputValue = inputValue;
|
||||
|
||||
if (onInputChange) {
|
||||
var value = onInputChange(newInputValue);
|
||||
// Note: != used deliberately here to catch undefined and null
|
||||
if (value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object') {
|
||||
newInputValue = '' + value;
|
||||
}
|
||||
}
|
||||
|
||||
var transformedInputValue = newInputValue;
|
||||
|
||||
if (ignoreAccents) {
|
||||
transformedInputValue = (0, _stripDiacritics2.default)(transformedInputValue);
|
||||
}
|
||||
|
||||
if (ignoreCase) {
|
||||
transformedInputValue = transformedInputValue.toLowerCase();
|
||||
}
|
||||
|
||||
this.setState({ inputValue: newInputValue });
|
||||
this.loadOptions(transformedInputValue);
|
||||
|
||||
// Return new input value, but without applying toLowerCase() to avoid modifying the user's view case of the input while typing.
|
||||
return newInputValue;
|
||||
}
|
||||
}, {
|
||||
key: 'noResultsText',
|
||||
value: function noResultsText() {
|
||||
var _props2 = this.props,
|
||||
loadingPlaceholder = _props2.loadingPlaceholder,
|
||||
noResultsText = _props2.noResultsText,
|
||||
searchPromptText = _props2.searchPromptText;
|
||||
var _state = this.state,
|
||||
inputValue = _state.inputValue,
|
||||
isLoading = _state.isLoading;
|
||||
|
||||
|
||||
if (isLoading) {
|
||||
return loadingPlaceholder;
|
||||
}
|
||||
if (inputValue && noResultsText) {
|
||||
return noResultsText;
|
||||
}
|
||||
return searchPromptText;
|
||||
}
|
||||
}, {
|
||||
key: 'focus',
|
||||
value: function focus() {
|
||||
this.select.focus();
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this3 = this;
|
||||
|
||||
var _props3 = this.props,
|
||||
children = _props3.children,
|
||||
loadingPlaceholder = _props3.loadingPlaceholder,
|
||||
multi = _props3.multi,
|
||||
onChange = _props3.onChange,
|
||||
placeholder = _props3.placeholder,
|
||||
value = _props3.value;
|
||||
var _state2 = this.state,
|
||||
isLoading = _state2.isLoading,
|
||||
options = _state2.options;
|
||||
|
||||
|
||||
var props = {
|
||||
noResultsText: this.noResultsText(),
|
||||
placeholder: isLoading ? loadingPlaceholder : placeholder,
|
||||
options: isLoading && loadingPlaceholder ? [] : options,
|
||||
ref: function ref(_ref) {
|
||||
return _this3.select = _ref;
|
||||
}
|
||||
};
|
||||
|
||||
return children(_extends({}, this.props, props, {
|
||||
isLoading: isLoading,
|
||||
onInputChange: this.onInputChange
|
||||
}));
|
||||
}
|
||||
}]);
|
||||
|
||||
return Async;
|
||||
}(_react.Component);
|
||||
|
||||
exports.default = Async;
|
||||
|
||||
|
||||
Async.propTypes = propTypes;
|
||||
Async.defaultProps = defaultProps;
|
||||
|
||||
function defaultChildren(props) {
|
||||
return _react2.default.createElement(_Select2.default, props);
|
||||
}
|
107
torrent-project/node_modules/react-select/lib/AsyncCreatable.js
generated
vendored
Normal file
107
torrent-project/node_modules/react-select/lib/AsyncCreatable.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _Select = require('./Select');
|
||||
|
||||
var _Select2 = _interopRequireDefault(_Select);
|
||||
|
||||
var _Async = require('./Async');
|
||||
|
||||
var _Async2 = _interopRequireDefault(_Async);
|
||||
|
||||
var _Creatable = require('./Creatable');
|
||||
|
||||
var _Creatable2 = _interopRequireDefault(_Creatable);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var AsyncCreatableSelect = function (_React$Component) {
|
||||
_inherits(AsyncCreatableSelect, _React$Component);
|
||||
|
||||
function AsyncCreatableSelect() {
|
||||
_classCallCheck(this, AsyncCreatableSelect);
|
||||
|
||||
return _possibleConstructorReturn(this, (AsyncCreatableSelect.__proto__ || Object.getPrototypeOf(AsyncCreatableSelect)).apply(this, arguments));
|
||||
}
|
||||
|
||||
_createClass(AsyncCreatableSelect, [{
|
||||
key: 'focus',
|
||||
value: function focus() {
|
||||
this.select.focus();
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
return _react2.default.createElement(
|
||||
_Async2.default,
|
||||
this.props,
|
||||
function (_ref) {
|
||||
var ref = _ref.ref,
|
||||
asyncProps = _objectWithoutProperties(_ref, ['ref']);
|
||||
|
||||
var asyncRef = ref;
|
||||
return _react2.default.createElement(
|
||||
_Creatable2.default,
|
||||
asyncProps,
|
||||
function (_ref2) {
|
||||
var ref = _ref2.ref,
|
||||
creatableProps = _objectWithoutProperties(_ref2, ['ref']);
|
||||
|
||||
var creatableRef = ref;
|
||||
return _this2.props.children(_extends({}, creatableProps, {
|
||||
ref: function ref(select) {
|
||||
creatableRef(select);
|
||||
asyncRef(select);
|
||||
_this2.select = select;
|
||||
}
|
||||
}));
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}]);
|
||||
|
||||
return AsyncCreatableSelect;
|
||||
}(_react2.default.Component);
|
||||
|
||||
;
|
||||
|
||||
function defaultChildren(props) {
|
||||
return _react2.default.createElement(_Select2.default, props);
|
||||
};
|
||||
|
||||
AsyncCreatableSelect.propTypes = {
|
||||
children: _propTypes2.default.func.isRequired // Child function responsible for creating the inner Select component; (props: Object): PropTypes.element
|
||||
};
|
||||
|
||||
AsyncCreatableSelect.defaultProps = {
|
||||
children: defaultChildren
|
||||
};
|
||||
|
||||
exports.default = AsyncCreatableSelect;
|
373
torrent-project/node_modules/react-select/lib/Creatable.js
generated
vendored
Normal file
373
torrent-project/node_modules/react-select/lib/Creatable.js
generated
vendored
Normal file
@@ -0,0 +1,373 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _Select = require('./Select');
|
||||
|
||||
var _Select2 = _interopRequireDefault(_Select);
|
||||
|
||||
var _defaultFilterOptions = require('./utils/defaultFilterOptions');
|
||||
|
||||
var _defaultFilterOptions2 = _interopRequireDefault(_defaultFilterOptions);
|
||||
|
||||
var _defaultMenuRenderer = require('./utils/defaultMenuRenderer');
|
||||
|
||||
var _defaultMenuRenderer2 = _interopRequireDefault(_defaultMenuRenderer);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var CreatableSelect = function (_React$Component) {
|
||||
_inherits(CreatableSelect, _React$Component);
|
||||
|
||||
function CreatableSelect(props, context) {
|
||||
_classCallCheck(this, CreatableSelect);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (CreatableSelect.__proto__ || Object.getPrototypeOf(CreatableSelect)).call(this, props, context));
|
||||
|
||||
_this.filterOptions = _this.filterOptions.bind(_this);
|
||||
_this.menuRenderer = _this.menuRenderer.bind(_this);
|
||||
_this.onInputKeyDown = _this.onInputKeyDown.bind(_this);
|
||||
_this.onInputChange = _this.onInputChange.bind(_this);
|
||||
_this.onOptionSelect = _this.onOptionSelect.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(CreatableSelect, [{
|
||||
key: 'createNewOption',
|
||||
value: function createNewOption() {
|
||||
var _props = this.props,
|
||||
isValidNewOption = _props.isValidNewOption,
|
||||
newOptionCreator = _props.newOptionCreator,
|
||||
onNewOptionClick = _props.onNewOptionClick,
|
||||
_props$options = _props.options,
|
||||
options = _props$options === undefined ? [] : _props$options,
|
||||
shouldKeyDownEventCreateNewOption = _props.shouldKeyDownEventCreateNewOption;
|
||||
|
||||
|
||||
if (isValidNewOption({ label: this.inputValue })) {
|
||||
var option = newOptionCreator({ label: this.inputValue, labelKey: this.labelKey, valueKey: this.valueKey });
|
||||
var _isOptionUnique = this.isOptionUnique({ option: option });
|
||||
|
||||
// Don't add the same option twice.
|
||||
if (_isOptionUnique) {
|
||||
if (onNewOptionClick) {
|
||||
onNewOptionClick(option);
|
||||
} else {
|
||||
options.unshift(option);
|
||||
|
||||
this.select.selectValue(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'filterOptions',
|
||||
value: function filterOptions() {
|
||||
var _props2 = this.props,
|
||||
filterOptions = _props2.filterOptions,
|
||||
isValidNewOption = _props2.isValidNewOption,
|
||||
promptTextCreator = _props2.promptTextCreator;
|
||||
|
||||
// TRICKY Check currently selected options as well.
|
||||
// Don't display a create-prompt for a value that's selected.
|
||||
// This covers async edge-cases where a newly-created Option isn't yet in the async-loaded array.
|
||||
|
||||
var excludeOptions = (arguments.length <= 2 ? undefined : arguments[2]) || [];
|
||||
|
||||
var filteredOptions = filterOptions.apply(undefined, arguments) || [];
|
||||
|
||||
if (isValidNewOption({ label: this.inputValue })) {
|
||||
var _newOptionCreator = this.props.newOptionCreator;
|
||||
|
||||
|
||||
var option = _newOptionCreator({
|
||||
label: this.inputValue,
|
||||
labelKey: this.labelKey,
|
||||
valueKey: this.valueKey
|
||||
});
|
||||
|
||||
// TRICKY Compare to all options (not just filtered options) in case option has already been selected).
|
||||
// For multi-selects, this would remove it from the filtered list.
|
||||
var _isOptionUnique2 = this.isOptionUnique({
|
||||
option: option,
|
||||
options: excludeOptions.concat(filteredOptions)
|
||||
});
|
||||
|
||||
if (_isOptionUnique2) {
|
||||
var prompt = promptTextCreator(this.inputValue);
|
||||
|
||||
this._createPlaceholderOption = _newOptionCreator({
|
||||
label: prompt,
|
||||
labelKey: this.labelKey,
|
||||
valueKey: this.valueKey
|
||||
});
|
||||
|
||||
filteredOptions.unshift(this._createPlaceholderOption);
|
||||
}
|
||||
}
|
||||
|
||||
return filteredOptions;
|
||||
}
|
||||
}, {
|
||||
key: 'isOptionUnique',
|
||||
value: function isOptionUnique(_ref) {
|
||||
var option = _ref.option,
|
||||
options = _ref.options;
|
||||
var isOptionUnique = this.props.isOptionUnique;
|
||||
|
||||
|
||||
options = options || this.props.options;
|
||||
|
||||
return isOptionUnique({
|
||||
labelKey: this.labelKey,
|
||||
option: option,
|
||||
options: options,
|
||||
valueKey: this.valueKey
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'menuRenderer',
|
||||
value: function menuRenderer(params) {
|
||||
var menuRenderer = this.props.menuRenderer;
|
||||
|
||||
|
||||
return menuRenderer(_extends({}, params, {
|
||||
onSelect: this.onOptionSelect,
|
||||
selectValue: this.onOptionSelect
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: 'onInputChange',
|
||||
value: function onInputChange(input) {
|
||||
var onInputChange = this.props.onInputChange;
|
||||
|
||||
// This value may be needed in between Select mounts (when this.select is null)
|
||||
|
||||
this.inputValue = input;
|
||||
|
||||
if (onInputChange) {
|
||||
this.inputValue = onInputChange(input);
|
||||
}
|
||||
|
||||
return this.inputValue;
|
||||
}
|
||||
}, {
|
||||
key: 'onInputKeyDown',
|
||||
value: function onInputKeyDown(event) {
|
||||
var _props3 = this.props,
|
||||
shouldKeyDownEventCreateNewOption = _props3.shouldKeyDownEventCreateNewOption,
|
||||
onInputKeyDown = _props3.onInputKeyDown;
|
||||
|
||||
var focusedOption = this.select.getFocusedOption();
|
||||
|
||||
if (focusedOption && focusedOption === this._createPlaceholderOption && shouldKeyDownEventCreateNewOption({ keyCode: event.keyCode })) {
|
||||
this.createNewOption();
|
||||
|
||||
// Prevent decorated Select from doing anything additional with this keyDown event
|
||||
event.preventDefault();
|
||||
} else if (onInputKeyDown) {
|
||||
onInputKeyDown(event);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'onOptionSelect',
|
||||
value: function onOptionSelect(option, event) {
|
||||
if (option === this._createPlaceholderOption) {
|
||||
this.createNewOption();
|
||||
} else {
|
||||
this.select.selectValue(option);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'focus',
|
||||
value: function focus() {
|
||||
this.select.focus();
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
var _props4 = this.props,
|
||||
newOptionCreator = _props4.newOptionCreator,
|
||||
shouldKeyDownEventCreateNewOption = _props4.shouldKeyDownEventCreateNewOption,
|
||||
refProp = _props4.ref,
|
||||
restProps = _objectWithoutProperties(_props4, ['newOptionCreator', 'shouldKeyDownEventCreateNewOption', 'ref']);
|
||||
|
||||
var children = this.props.children;
|
||||
|
||||
// We can't use destructuring default values to set the children,
|
||||
// because it won't apply work if `children` is null. A falsy check is
|
||||
// more reliable in real world use-cases.
|
||||
|
||||
if (!children) {
|
||||
children = defaultChildren;
|
||||
}
|
||||
|
||||
var props = _extends({}, restProps, {
|
||||
allowCreate: true,
|
||||
filterOptions: this.filterOptions,
|
||||
menuRenderer: this.menuRenderer,
|
||||
onInputChange: this.onInputChange,
|
||||
onInputKeyDown: this.onInputKeyDown,
|
||||
ref: function ref(_ref2) {
|
||||
_this2.select = _ref2;
|
||||
|
||||
// These values may be needed in between Select mounts (when this.select is null)
|
||||
if (_ref2) {
|
||||
_this2.labelKey = _ref2.props.labelKey;
|
||||
_this2.valueKey = _ref2.props.valueKey;
|
||||
}
|
||||
if (refProp) {
|
||||
refProp(_ref2);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return children(props);
|
||||
}
|
||||
}]);
|
||||
|
||||
return CreatableSelect;
|
||||
}(_react2.default.Component);
|
||||
|
||||
;
|
||||
|
||||
function defaultChildren(props) {
|
||||
return _react2.default.createElement(_Select2.default, props);
|
||||
};
|
||||
|
||||
function isOptionUnique(_ref3) {
|
||||
var option = _ref3.option,
|
||||
options = _ref3.options,
|
||||
labelKey = _ref3.labelKey,
|
||||
valueKey = _ref3.valueKey;
|
||||
|
||||
return options.filter(function (existingOption) {
|
||||
return existingOption[labelKey] === option[labelKey] || existingOption[valueKey] === option[valueKey];
|
||||
}).length === 0;
|
||||
};
|
||||
|
||||
function isValidNewOption(_ref4) {
|
||||
var label = _ref4.label;
|
||||
|
||||
return !!label;
|
||||
};
|
||||
|
||||
function newOptionCreator(_ref5) {
|
||||
var label = _ref5.label,
|
||||
labelKey = _ref5.labelKey,
|
||||
valueKey = _ref5.valueKey;
|
||||
|
||||
var option = {};
|
||||
option[valueKey] = label;
|
||||
option[labelKey] = label;
|
||||
option.className = 'Select-create-option-placeholder';
|
||||
return option;
|
||||
};
|
||||
|
||||
function promptTextCreator(label) {
|
||||
return 'Create option "' + label + '"';
|
||||
}
|
||||
|
||||
function shouldKeyDownEventCreateNewOption(_ref6) {
|
||||
var keyCode = _ref6.keyCode;
|
||||
|
||||
switch (keyCode) {
|
||||
case 9: // TAB
|
||||
case 13: // ENTER
|
||||
case 188:
|
||||
// COMMA
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Default prop methods
|
||||
CreatableSelect.isOptionUnique = isOptionUnique;
|
||||
CreatableSelect.isValidNewOption = isValidNewOption;
|
||||
CreatableSelect.newOptionCreator = newOptionCreator;
|
||||
CreatableSelect.promptTextCreator = promptTextCreator;
|
||||
CreatableSelect.shouldKeyDownEventCreateNewOption = shouldKeyDownEventCreateNewOption;
|
||||
|
||||
CreatableSelect.defaultProps = {
|
||||
filterOptions: _defaultFilterOptions2.default,
|
||||
isOptionUnique: isOptionUnique,
|
||||
isValidNewOption: isValidNewOption,
|
||||
menuRenderer: _defaultMenuRenderer2.default,
|
||||
newOptionCreator: newOptionCreator,
|
||||
promptTextCreator: promptTextCreator,
|
||||
shouldKeyDownEventCreateNewOption: shouldKeyDownEventCreateNewOption
|
||||
};
|
||||
|
||||
CreatableSelect.propTypes = {
|
||||
// Child function responsible for creating the inner Select component
|
||||
// This component can be used to compose HOCs (eg Creatable and Async)
|
||||
// (props: Object): PropTypes.element
|
||||
children: _propTypes2.default.func,
|
||||
|
||||
// See Select.propTypes.filterOptions
|
||||
filterOptions: _propTypes2.default.any,
|
||||
|
||||
// Searches for any matching option within the set of options.
|
||||
// This function prevents duplicate options from being created.
|
||||
// ({ option: Object, options: Array, labelKey: string, valueKey: string }): boolean
|
||||
isOptionUnique: _propTypes2.default.func,
|
||||
|
||||
// Determines if the current input text represents a valid option.
|
||||
// ({ label: string }): boolean
|
||||
isValidNewOption: _propTypes2.default.func,
|
||||
|
||||
// See Select.propTypes.menuRenderer
|
||||
menuRenderer: _propTypes2.default.any,
|
||||
|
||||
// Factory to create new option.
|
||||
// ({ label: string, labelKey: string, valueKey: string }): Object
|
||||
newOptionCreator: _propTypes2.default.func,
|
||||
|
||||
// input change handler: function (inputValue) {}
|
||||
onInputChange: _propTypes2.default.func,
|
||||
|
||||
// input keyDown handler: function (event) {}
|
||||
onInputKeyDown: _propTypes2.default.func,
|
||||
|
||||
// new option click handler: function (option) {}
|
||||
onNewOptionClick: _propTypes2.default.func,
|
||||
|
||||
// See Select.propTypes.options
|
||||
options: _propTypes2.default.array,
|
||||
|
||||
// Creates prompt/placeholder option text.
|
||||
// (filterText: string): string
|
||||
promptTextCreator: _propTypes2.default.func,
|
||||
|
||||
ref: _propTypes2.default.func,
|
||||
|
||||
// Decides if a keyDown event (eg its `keyCode`) should result in the creation of a new option.
|
||||
shouldKeyDownEventCreateNewOption: _propTypes2.default.func
|
||||
};
|
||||
|
||||
exports.default = CreatableSelect;
|
160
torrent-project/node_modules/react-select/lib/Option.js
generated
vendored
Normal file
160
torrent-project/node_modules/react-select/lib/Option.js
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _classnames = require('classnames');
|
||||
|
||||
var _classnames2 = _interopRequireDefault(_classnames);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Option = function (_React$Component) {
|
||||
_inherits(Option, _React$Component);
|
||||
|
||||
function Option(props) {
|
||||
_classCallCheck(this, Option);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (Option.__proto__ || Object.getPrototypeOf(Option)).call(this, props));
|
||||
|
||||
_this.handleMouseDown = _this.handleMouseDown.bind(_this);
|
||||
_this.handleMouseEnter = _this.handleMouseEnter.bind(_this);
|
||||
_this.handleMouseMove = _this.handleMouseMove.bind(_this);
|
||||
_this.handleTouchStart = _this.handleTouchStart.bind(_this);
|
||||
_this.handleTouchEnd = _this.handleTouchEnd.bind(_this);
|
||||
_this.handleTouchMove = _this.handleTouchMove.bind(_this);
|
||||
_this.onFocus = _this.onFocus.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Option, [{
|
||||
key: 'blockEvent',
|
||||
value: function blockEvent(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if (event.target.tagName !== 'A' || !('href' in event.target)) {
|
||||
return;
|
||||
}
|
||||
if (event.target.target) {
|
||||
window.open(event.target.href, event.target.target);
|
||||
} else {
|
||||
window.location.href = event.target.href;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'handleMouseDown',
|
||||
value: function handleMouseDown(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this.props.onSelect(this.props.option, event);
|
||||
}
|
||||
}, {
|
||||
key: 'handleMouseEnter',
|
||||
value: function handleMouseEnter(event) {
|
||||
this.onFocus(event);
|
||||
}
|
||||
}, {
|
||||
key: 'handleMouseMove',
|
||||
value: function handleMouseMove(event) {
|
||||
this.onFocus(event);
|
||||
}
|
||||
}, {
|
||||
key: 'handleTouchEnd',
|
||||
value: function handleTouchEnd(event) {
|
||||
// Check if the view is being dragged, In this case
|
||||
// we don't want to fire the click event (because the user only wants to scroll)
|
||||
if (this.dragging) return;
|
||||
|
||||
this.handleMouseDown(event);
|
||||
}
|
||||
}, {
|
||||
key: 'handleTouchMove',
|
||||
value: function handleTouchMove(event) {
|
||||
// Set a flag that the view is being dragged
|
||||
this.dragging = true;
|
||||
}
|
||||
}, {
|
||||
key: 'handleTouchStart',
|
||||
value: function handleTouchStart(event) {
|
||||
// Set a flag that the view is not being dragged
|
||||
this.dragging = false;
|
||||
}
|
||||
}, {
|
||||
key: 'onFocus',
|
||||
value: function onFocus(event) {
|
||||
if (!this.props.isFocused) {
|
||||
this.props.onFocus(this.props.option, event);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _props = this.props,
|
||||
option = _props.option,
|
||||
instancePrefix = _props.instancePrefix,
|
||||
optionIndex = _props.optionIndex;
|
||||
|
||||
var className = (0, _classnames2.default)(this.props.className, option.className);
|
||||
|
||||
return option.disabled ? _react2.default.createElement(
|
||||
'div',
|
||||
{ className: className,
|
||||
onMouseDown: this.blockEvent,
|
||||
onClick: this.blockEvent },
|
||||
this.props.children
|
||||
) : _react2.default.createElement(
|
||||
'div',
|
||||
{ className: className,
|
||||
style: option.style,
|
||||
role: 'option',
|
||||
'aria-label': option.label,
|
||||
onMouseDown: this.handleMouseDown,
|
||||
onMouseEnter: this.handleMouseEnter,
|
||||
onMouseMove: this.handleMouseMove,
|
||||
onTouchStart: this.handleTouchStart,
|
||||
onTouchMove: this.handleTouchMove,
|
||||
onTouchEnd: this.handleTouchEnd,
|
||||
id: instancePrefix + '-option-' + optionIndex,
|
||||
title: option.title },
|
||||
this.props.children
|
||||
);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Option;
|
||||
}(_react2.default.Component);
|
||||
|
||||
;
|
||||
|
||||
Option.propTypes = {
|
||||
children: _propTypes2.default.node,
|
||||
className: _propTypes2.default.string, // className (based on mouse position)
|
||||
instancePrefix: _propTypes2.default.string.isRequired, // unique prefix for the ids (used for aria)
|
||||
isDisabled: _propTypes2.default.bool, // the option is disabled
|
||||
isFocused: _propTypes2.default.bool, // the option is focused
|
||||
isSelected: _propTypes2.default.bool, // the option is selected
|
||||
onFocus: _propTypes2.default.func, // method to handle mouseEnter on option element
|
||||
onSelect: _propTypes2.default.func, // method to handle click on option element
|
||||
onUnfocus: _propTypes2.default.func, // method to handle mouseLeave on option element
|
||||
option: _propTypes2.default.object.isRequired, // object that is base for that option
|
||||
optionIndex: _propTypes2.default.number // index of the option, used to generate unique ids for aria
|
||||
};
|
||||
|
||||
exports.default = Option;
|
1376
torrent-project/node_modules/react-select/lib/Select.js
generated
vendored
Normal file
1376
torrent-project/node_modules/react-select/lib/Select.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
147
torrent-project/node_modules/react-select/lib/Value.js
generated
vendored
Normal file
147
torrent-project/node_modules/react-select/lib/Value.js
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _classnames = require('classnames');
|
||||
|
||||
var _classnames2 = _interopRequireDefault(_classnames);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Value = function (_React$Component) {
|
||||
_inherits(Value, _React$Component);
|
||||
|
||||
function Value(props) {
|
||||
_classCallCheck(this, Value);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (Value.__proto__ || Object.getPrototypeOf(Value)).call(this, props));
|
||||
|
||||
_this.handleMouseDown = _this.handleMouseDown.bind(_this);
|
||||
_this.onRemove = _this.onRemove.bind(_this);
|
||||
_this.handleTouchEndRemove = _this.handleTouchEndRemove.bind(_this);
|
||||
_this.handleTouchMove = _this.handleTouchMove.bind(_this);
|
||||
_this.handleTouchStart = _this.handleTouchStart.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Value, [{
|
||||
key: 'handleMouseDown',
|
||||
value: function handleMouseDown(event) {
|
||||
if (event.type === 'mousedown' && event.button !== 0) {
|
||||
return;
|
||||
}
|
||||
if (this.props.onClick) {
|
||||
event.stopPropagation();
|
||||
this.props.onClick(this.props.value, event);
|
||||
return;
|
||||
}
|
||||
if (this.props.value.href) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'onRemove',
|
||||
value: function onRemove(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this.props.onRemove(this.props.value);
|
||||
}
|
||||
}, {
|
||||
key: 'handleTouchEndRemove',
|
||||
value: function handleTouchEndRemove(event) {
|
||||
// Check if the view is being dragged, In this case
|
||||
// we don't want to fire the click event (because the user only wants to scroll)
|
||||
if (this.dragging) return;
|
||||
|
||||
// Fire the mouse events
|
||||
this.onRemove(event);
|
||||
}
|
||||
}, {
|
||||
key: 'handleTouchMove',
|
||||
value: function handleTouchMove(event) {
|
||||
// Set a flag that the view is being dragged
|
||||
this.dragging = true;
|
||||
}
|
||||
}, {
|
||||
key: 'handleTouchStart',
|
||||
value: function handleTouchStart(event) {
|
||||
// Set a flag that the view is not being dragged
|
||||
this.dragging = false;
|
||||
}
|
||||
}, {
|
||||
key: 'renderRemoveIcon',
|
||||
value: function renderRemoveIcon() {
|
||||
if (this.props.disabled || !this.props.onRemove) return;
|
||||
return _react2.default.createElement(
|
||||
'span',
|
||||
{ className: 'Select-value-icon',
|
||||
'aria-hidden': 'true',
|
||||
onMouseDown: this.onRemove,
|
||||
onTouchEnd: this.handleTouchEndRemove,
|
||||
onTouchStart: this.handleTouchStart,
|
||||
onTouchMove: this.handleTouchMove },
|
||||
'\xD7'
|
||||
);
|
||||
}
|
||||
}, {
|
||||
key: 'renderLabel',
|
||||
value: function renderLabel() {
|
||||
var className = 'Select-value-label';
|
||||
return this.props.onClick || this.props.value.href ? _react2.default.createElement(
|
||||
'a',
|
||||
{ className: className, href: this.props.value.href, target: this.props.value.target, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown },
|
||||
this.props.children
|
||||
) : _react2.default.createElement(
|
||||
'span',
|
||||
{ className: className, role: 'option', 'aria-selected': 'true', id: this.props.id },
|
||||
this.props.children
|
||||
);
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
return _react2.default.createElement(
|
||||
'div',
|
||||
{ className: (0, _classnames2.default)('Select-value', this.props.value.className),
|
||||
style: this.props.value.style,
|
||||
title: this.props.value.title
|
||||
},
|
||||
this.renderRemoveIcon(),
|
||||
this.renderLabel()
|
||||
);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Value;
|
||||
}(_react2.default.Component);
|
||||
|
||||
;
|
||||
|
||||
Value.propTypes = {
|
||||
children: _propTypes2.default.node,
|
||||
disabled: _propTypes2.default.bool, // disabled prop passed to ReactSelect
|
||||
id: _propTypes2.default.string, // Unique id for the value - used for aria
|
||||
onClick: _propTypes2.default.func, // method to handle click on value label
|
||||
onRemove: _propTypes2.default.func, // method to handle removal of the value
|
||||
value: _propTypes2.default.object.isRequired // the option object for this value
|
||||
};
|
||||
|
||||
exports.default = Value;
|
65
torrent-project/node_modules/react-select/lib/index.js
generated
vendored
Normal file
65
torrent-project/node_modules/react-select/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.defaultFilterOptions = exports.defaultClearRenderer = exports.defaultArrowRenderer = exports.defaultMenuRenderer = exports.Option = exports.Value = exports.Creatable = exports.AsyncCreatable = exports.Async = undefined;
|
||||
|
||||
var _Select = require('./Select');
|
||||
|
||||
var _Select2 = _interopRequireDefault(_Select);
|
||||
|
||||
var _Async = require('./Async');
|
||||
|
||||
var _Async2 = _interopRequireDefault(_Async);
|
||||
|
||||
var _AsyncCreatable = require('./AsyncCreatable');
|
||||
|
||||
var _AsyncCreatable2 = _interopRequireDefault(_AsyncCreatable);
|
||||
|
||||
var _Creatable = require('./Creatable');
|
||||
|
||||
var _Creatable2 = _interopRequireDefault(_Creatable);
|
||||
|
||||
var _Value = require('./Value');
|
||||
|
||||
var _Value2 = _interopRequireDefault(_Value);
|
||||
|
||||
var _Option = require('./Option');
|
||||
|
||||
var _Option2 = _interopRequireDefault(_Option);
|
||||
|
||||
var _defaultMenuRenderer = require('./utils/defaultMenuRenderer');
|
||||
|
||||
var _defaultMenuRenderer2 = _interopRequireDefault(_defaultMenuRenderer);
|
||||
|
||||
var _defaultArrowRenderer = require('./utils/defaultArrowRenderer');
|
||||
|
||||
var _defaultArrowRenderer2 = _interopRequireDefault(_defaultArrowRenderer);
|
||||
|
||||
var _defaultClearRenderer = require('./utils/defaultClearRenderer');
|
||||
|
||||
var _defaultClearRenderer2 = _interopRequireDefault(_defaultClearRenderer);
|
||||
|
||||
var _defaultFilterOptions = require('./utils/defaultFilterOptions');
|
||||
|
||||
var _defaultFilterOptions2 = _interopRequireDefault(_defaultFilterOptions);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
_Select2.default.Async = _Async2.default;
|
||||
_Select2.default.AsyncCreatable = _AsyncCreatable2.default;
|
||||
_Select2.default.Creatable = _Creatable2.default;
|
||||
_Select2.default.Value = _Value2.default;
|
||||
_Select2.default.Option = _Option2.default;
|
||||
|
||||
exports.default = _Select2.default;
|
||||
exports.Async = _Async2.default;
|
||||
exports.AsyncCreatable = _AsyncCreatable2.default;
|
||||
exports.Creatable = _Creatable2.default;
|
||||
exports.Value = _Value2.default;
|
||||
exports.Option = _Option2.default;
|
||||
exports.defaultMenuRenderer = _defaultMenuRenderer2.default;
|
||||
exports.defaultArrowRenderer = _defaultArrowRenderer2.default;
|
||||
exports.defaultClearRenderer = _defaultClearRenderer2.default;
|
||||
exports.defaultFilterOptions = _defaultFilterOptions2.default;
|
29
torrent-project/node_modules/react-select/lib/utils/defaultArrowRenderer.js
generated
vendored
Normal file
29
torrent-project/node_modules/react-select/lib/utils/defaultArrowRenderer.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = arrowRenderer;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function arrowRenderer(_ref) {
|
||||
var onMouseDown = _ref.onMouseDown;
|
||||
|
||||
return _react2.default.createElement('span', {
|
||||
className: 'Select-arrow',
|
||||
onMouseDown: onMouseDown
|
||||
});
|
||||
};
|
||||
|
||||
arrowRenderer.propTypes = {
|
||||
onMouseDown: _propTypes2.default.func
|
||||
};
|
19
torrent-project/node_modules/react-select/lib/utils/defaultClearRenderer.js
generated
vendored
Normal file
19
torrent-project/node_modules/react-select/lib/utils/defaultClearRenderer.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = clearRenderer;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function clearRenderer() {
|
||||
return _react2.default.createElement('span', {
|
||||
className: 'Select-clear',
|
||||
dangerouslySetInnerHTML: { __html: '×' }
|
||||
});
|
||||
};
|
56
torrent-project/node_modules/react-select/lib/utils/defaultFilterOptions.js
generated
vendored
Normal file
56
torrent-project/node_modules/react-select/lib/utils/defaultFilterOptions.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _stripDiacritics = require('./stripDiacritics');
|
||||
|
||||
var _stripDiacritics2 = _interopRequireDefault(_stripDiacritics);
|
||||
|
||||
var _trim = require('./trim');
|
||||
|
||||
var _trim2 = _interopRequireDefault(_trim);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function filterOptions(options, filterValue, excludeOptions, props) {
|
||||
var _this = this;
|
||||
|
||||
if (props.ignoreAccents) {
|
||||
filterValue = (0, _stripDiacritics2.default)(filterValue);
|
||||
}
|
||||
|
||||
if (props.ignoreCase) {
|
||||
filterValue = filterValue.toLowerCase();
|
||||
}
|
||||
|
||||
if (props.trimFilter) {
|
||||
filterValue = (0, _trim2.default)(filterValue);
|
||||
}
|
||||
|
||||
if (excludeOptions) excludeOptions = excludeOptions.map(function (i) {
|
||||
return i[props.valueKey];
|
||||
});
|
||||
|
||||
return options.filter(function (option) {
|
||||
if (excludeOptions && excludeOptions.indexOf(option[props.valueKey]) > -1) return false;
|
||||
if (props.filterOption) return props.filterOption.call(_this, option, filterValue);
|
||||
if (!filterValue) return true;
|
||||
var valueTest = String(option[props.valueKey]);
|
||||
var labelTest = String(option[props.labelKey]);
|
||||
|
||||
if (props.ignoreAccents) {
|
||||
if (props.matchProp !== 'label') valueTest = (0, _stripDiacritics2.default)(valueTest);
|
||||
if (props.matchProp !== 'value') labelTest = (0, _stripDiacritics2.default)(labelTest);
|
||||
}
|
||||
|
||||
if (props.ignoreCase) {
|
||||
if (props.matchProp !== 'label') valueTest = valueTest.toLowerCase();
|
||||
if (props.matchProp !== 'value') labelTest = labelTest.toLowerCase();
|
||||
}
|
||||
return props.matchPos === 'start' ? props.matchProp !== 'label' && valueTest.substr(0, filterValue.length) === filterValue || props.matchProp !== 'value' && labelTest.substr(0, filterValue.length) === filterValue : props.matchProp !== 'label' && valueTest.indexOf(filterValue) >= 0 || props.matchProp !== 'value' && labelTest.indexOf(filterValue) >= 0;
|
||||
});
|
||||
}
|
||||
|
||||
exports.default = filterOptions;
|
75
torrent-project/node_modules/react-select/lib/utils/defaultMenuRenderer.js
generated
vendored
Normal file
75
torrent-project/node_modules/react-select/lib/utils/defaultMenuRenderer.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _classnames = require('classnames');
|
||||
|
||||
var _classnames2 = _interopRequireDefault(_classnames);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function menuRenderer(_ref) {
|
||||
var focusedOption = _ref.focusedOption,
|
||||
focusOption = _ref.focusOption,
|
||||
inputValue = _ref.inputValue,
|
||||
instancePrefix = _ref.instancePrefix,
|
||||
labelKey = _ref.labelKey,
|
||||
onFocus = _ref.onFocus,
|
||||
onOptionRef = _ref.onOptionRef,
|
||||
onSelect = _ref.onSelect,
|
||||
optionClassName = _ref.optionClassName,
|
||||
optionComponent = _ref.optionComponent,
|
||||
optionRenderer = _ref.optionRenderer,
|
||||
options = _ref.options,
|
||||
removeValue = _ref.removeValue,
|
||||
selectValue = _ref.selectValue,
|
||||
valueArray = _ref.valueArray,
|
||||
valueKey = _ref.valueKey;
|
||||
|
||||
var Option = optionComponent;
|
||||
|
||||
return options.map(function (option, i) {
|
||||
var isSelected = valueArray && valueArray.some(function (x) {
|
||||
return x[valueKey] == option[valueKey];
|
||||
});
|
||||
var isFocused = option === focusedOption;
|
||||
var optionClass = (0, _classnames2.default)(optionClassName, {
|
||||
'Select-option': true,
|
||||
'is-selected': isSelected,
|
||||
'is-focused': isFocused,
|
||||
'is-disabled': option.disabled
|
||||
});
|
||||
|
||||
return _react2.default.createElement(
|
||||
Option,
|
||||
{
|
||||
className: optionClass,
|
||||
focusOption: focusOption,
|
||||
inputValue: inputValue,
|
||||
instancePrefix: instancePrefix,
|
||||
isDisabled: option.disabled,
|
||||
isFocused: isFocused,
|
||||
isSelected: isSelected,
|
||||
key: 'option-' + i + '-' + option[valueKey],
|
||||
onFocus: onFocus,
|
||||
onSelect: onSelect,
|
||||
option: option,
|
||||
optionIndex: i,
|
||||
ref: function ref(_ref2) {
|
||||
onOptionRef(_ref2, isFocused);
|
||||
},
|
||||
removeValue: removeValue,
|
||||
selectValue: selectValue
|
||||
},
|
||||
optionRenderer(option, i, inputValue)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
exports.default = menuRenderer;
|
14
torrent-project/node_modules/react-select/lib/utils/stripDiacritics.js
generated
vendored
Normal file
14
torrent-project/node_modules/react-select/lib/utils/stripDiacritics.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
9
torrent-project/node_modules/react-select/lib/utils/trim.js
generated
vendored
Normal file
9
torrent-project/node_modules/react-select/lib/utils/trim.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = trim;
|
||||
function trim(str) {
|
||||
return str.replace(/^\s+|\s+$/g, '');
|
||||
}
|
Reference in New Issue
Block a user