You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
InternshipProject/node_modules/rc-cascader/es/hooks/useSearchConfig.js

31 lines
888 B

import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _typeof from "@babel/runtime/helpers/esm/typeof";
import * as React from 'react';
import warning from "rc-util/es/warning"; // Convert `showSearch` to unique config
export default function useSearchConfig(showSearch) {
return React.useMemo(function () {
if (!showSearch) {
return [false, {}];
}
var searchConfig = {
matchInputWidth: true,
limit: 50
};
if (showSearch && _typeof(showSearch) === 'object') {
searchConfig = _objectSpread(_objectSpread({}, searchConfig), showSearch);
}
if (searchConfig.limit <= 0) {
delete searchConfig.limit;
if (process.env.NODE_ENV !== 'production') {
warning(false, "'limit' of showSearch should be positive number or false.");
}
}
return [true, searchConfig];
}, [showSearch]);
}