react-select-search
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -6,2 +6,8 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function groupOptions(options) { | ||
@@ -11,3 +17,4 @@ var nextOptions = []; | ||
if ('groupId' in option) { | ||
var nextOption = Object.assign({}, option); | ||
var nextOption = _objectSpread({}, option); | ||
var groupIndex = nextOptions.findIndex(function (el) { | ||
@@ -14,0 +21,0 @@ return 'groupId' in el && el.groupId === nextOption.groupId; |
@@ -5,2 +5,9 @@ "use strict"; | ||
exports["default"] = search; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var Fuse = null; | ||
@@ -22,3 +29,3 @@ | ||
return fuse.search(value).map(function (item, index) { | ||
return Object.assign({}, item, { | ||
return _objectSpread(_objectSpread({}, item), {}, { | ||
index: index | ||
@@ -25,0 +32,0 @@ }); |
@@ -117,3 +117,3 @@ "use strict"; | ||
}, [focus, value, highlighted, selectRef, multiple]); | ||
var shouldRenderOptions = true; | ||
var shouldRenderOptions; | ||
@@ -200,5 +200,9 @@ switch (printOptions) { | ||
renderOption: function renderOption(domProps, option, snapshot, className) { | ||
return /*#__PURE__*/_react["default"].createElement("button", _extends({ | ||
className: className | ||
}, domProps), option.name); | ||
return ( | ||
/*#__PURE__*/ | ||
// eslint-disable-next-line react/button-has-type | ||
_react["default"].createElement("button", _extends({ | ||
className: className | ||
}, domProps), option.name) | ||
); | ||
}, | ||
@@ -205,0 +209,0 @@ renderGroupHeader: function renderGroupHeader(name) { |
@@ -63,3 +63,3 @@ "use strict"; | ||
highlighted: -1, | ||
changed: null | ||
changed: false | ||
}), | ||
@@ -255,3 +255,8 @@ state = _useState[0], | ||
(0, _react.useEffect)(function () { | ||
if (state.changed) { | ||
if (state.changed !== false) { | ||
setState(function (oldState) { | ||
return _objectSpread(_objectSpread({}, oldState), {}, { | ||
changed: false | ||
}); | ||
}); | ||
onChange.apply(void 0, state.changed); | ||
@@ -258,0 +263,0 @@ } |
@@ -0,1 +1,7 @@ | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
export default function groupOptions(options) { | ||
@@ -5,3 +11,4 @@ const nextOptions = []; | ||
if ('groupId' in option) { | ||
const nextOption = Object.assign({}, option); | ||
const nextOption = _objectSpread({}, option); | ||
const groupIndex = nextOptions.findIndex(el => 'groupId' in el && el.groupId === nextOption.groupId); | ||
@@ -8,0 +15,0 @@ nextOption.index = i; |
@@ -0,1 +1,7 @@ | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
let Fuse = null; | ||
@@ -16,3 +22,3 @@ | ||
const fuse = new Fuse(options, fuseOptions); | ||
return fuse.search(value).map((item, index) => Object.assign({}, item, { | ||
return fuse.search(value).map((item, index) => _objectSpread(_objectSpread({}, item), {}, { | ||
index | ||
@@ -19,0 +25,0 @@ })); |
@@ -98,3 +98,3 @@ function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
}, [focus, value, highlighted, selectRef, multiple]); | ||
let shouldRenderOptions = true; | ||
let shouldRenderOptions; | ||
@@ -178,3 +178,6 @@ switch (printOptions) { | ||
closeOnSelect: true, | ||
renderOption: (domProps, option, snapshot, className) => /*#__PURE__*/React.createElement("button", _extends({ | ||
renderOption: (domProps, option, snapshot, className) => | ||
/*#__PURE__*/ | ||
// eslint-disable-next-line react/button-has-type | ||
React.createElement("button", _extends({ | ||
className: className | ||
@@ -181,0 +184,0 @@ }, domProps), option.name), |
@@ -37,3 +37,3 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
highlighted: -1, | ||
changed: null | ||
changed: false | ||
}); | ||
@@ -203,3 +203,6 @@ const { | ||
useEffect(() => { | ||
if (state.changed) { | ||
if (state.changed !== false) { | ||
setState(oldState => _objectSpread(_objectSpread({}, oldState), {}, { | ||
changed: false | ||
})); | ||
onChange(...state.changed); | ||
@@ -206,0 +209,0 @@ } |
{ | ||
"name": "react-select-search", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Lightweight select component for React", | ||
@@ -52,3 +52,3 @@ "main": "dist/esm/index.js", | ||
"@storybook/react": "^5.3.18", | ||
"babel-eslint": "^8.2.1", | ||
"babel-eslint": "^10.1.0", | ||
"babel-loader": "^8.1.0", | ||
@@ -61,10 +61,10 @@ "babel-plugin-transform-react-remove-prop-types": "^0.4.24", | ||
"enzyme-to-json": "^3.4.4", | ||
"eslint": "^4.11.0", | ||
"eslint-config-airbnb": "^16.1.0", | ||
"eslint": "^7.0.0", | ||
"eslint-config-airbnb": "^18.1.0", | ||
"eslint-plugin-import": "^2.20.2", | ||
"eslint-plugin-jsx-a11y": "^6.2.3", | ||
"eslint-plugin-react": "^7.19.0", | ||
"eslint-plugin-react-hooks": "^2.5.1", | ||
"eslint-plugin-react": "^7.20.0", | ||
"eslint-plugin-react-hooks": "^4.0.2", | ||
"fuse.js": "^3.4.5", | ||
"jest": "^25.5.4", | ||
"jest": "^26.0.1", | ||
"prop-types": "^15.7.2", | ||
@@ -71,0 +71,0 @@ "react": "^16.13.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82989
1591