rc-select
Advanced tools
Comparing version 14.11.0 to 14.12.0
@@ -19,3 +19,3 @@ import type { AlignType, BuildInPlacements } from '@rc-component/trigger/lib/interface'; | ||
export interface BaseSelectRef { | ||
focus: () => void; | ||
focus: (options?: FocusOptions) => void; | ||
blur: () => void; | ||
@@ -22,0 +22,0 @@ scrollTo: ScrollTo; |
@@ -24,3 +24,3 @@ import _typeof from "@babel/runtime/helpers/esm/typeof"; | ||
import TransBtn from "./TransBtn"; | ||
import { getSeparatedContent } from "./utils/valueUtil"; | ||
import { getSeparatedContent, isValidCount } from "./utils/valueUtil"; | ||
import SelectContext from "./SelectContext"; | ||
@@ -32,3 +32,3 @@ var DEFAULT_OMIT_PROPS = ['value', 'onChange', 'removeIcon', 'placeholder', 'autoFocus', 'maxTagCount', 'maxTagTextLength', 'maxTagPlaceholder', 'choiceTransitionName', 'onInputKeyDown', 'onPopupScroll', 'tabIndex']; | ||
var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var _customizeRawInputEle, _classNames2; | ||
var _customizeRawInputEle; | ||
var id = props.id, | ||
@@ -197,3 +197,3 @@ prefixCls = props.prefixCls, | ||
var onInternalSearch = function onInternalSearch(searchText, fromTyping, isCompositing) { | ||
if ((rawValues === null || rawValues === void 0 ? void 0 : rawValues.size) >= maxCount) { | ||
if (isValidCount(maxCount) && (rawValues === null || rawValues === void 0 ? void 0 : rawValues.size) >= maxCount) { | ||
return; | ||
@@ -204,3 +204,3 @@ } | ||
onActiveValueChange === null || onActiveValueChange === void 0 || onActiveValueChange(null); | ||
var separatedList = getSeparatedContent(searchText, tokenSeparators, maxCount && maxCount - rawValues.size); | ||
var separatedList = getSeparatedContent(searchText, tokenSeparators, isValidCount(maxCount) ? maxCount - rawValues.size : undefined); | ||
@@ -502,3 +502,3 @@ // Check if match the `tokenSeparators` | ||
// ============================= Select ============================= | ||
var mergedClassName = classNames(prefixCls, className, (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-focused"), mockFocused), _defineProperty(_classNames2, "".concat(prefixCls, "-multiple"), multiple), _defineProperty(_classNames2, "".concat(prefixCls, "-single"), !multiple), _defineProperty(_classNames2, "".concat(prefixCls, "-allow-clear"), allowClear), _defineProperty(_classNames2, "".concat(prefixCls, "-show-arrow"), showSuffixIcon), _defineProperty(_classNames2, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_classNames2, "".concat(prefixCls, "-loading"), loading), _defineProperty(_classNames2, "".concat(prefixCls, "-open"), mergedOpen), _defineProperty(_classNames2, "".concat(prefixCls, "-customize-input"), customizeInputElement), _defineProperty(_classNames2, "".concat(prefixCls, "-show-search"), mergedShowSearch), _classNames2)); | ||
var mergedClassName = classNames(prefixCls, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-focused"), mockFocused), "".concat(prefixCls, "-multiple"), multiple), "".concat(prefixCls, "-single"), !multiple), "".concat(prefixCls, "-allow-clear"), allowClear), "".concat(prefixCls, "-show-arrow"), showSuffixIcon), "".concat(prefixCls, "-disabled"), disabled), "".concat(prefixCls, "-loading"), loading), "".concat(prefixCls, "-open"), mergedOpen), "".concat(prefixCls, "-customize-input"), customizeInputElement), "".concat(prefixCls, "-show-search"), mergedShowSearch)); | ||
@@ -529,5 +529,5 @@ // >>> Selector | ||
onPopupMouseEnter: onPopupMouseEnter | ||
}, customizeRawInputElement ? /*#__PURE__*/React.cloneElement(customizeRawInputElement, { | ||
}, customizeRawInputElement ? ( /*#__PURE__*/React.cloneElement(customizeRawInputElement, { | ||
ref: customizeRawInputRef | ||
}) : /*#__PURE__*/React.createElement(Selector, _extends({}, props, { | ||
})) : /*#__PURE__*/React.createElement(Selector, _extends({}, props, { | ||
domRef: selectorDomRef, | ||
@@ -534,0 +534,0 @@ prefixCls: prefixCls, |
@@ -19,2 +19,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
import { isPlatformMac } from "./utils/platformUtil"; | ||
import { isValidCount } from "./utils/valueUtil"; | ||
@@ -66,3 +67,3 @@ // export interface OptionListProps<OptionsType extends object[]> { | ||
var overMaxCount = React.useMemo(function () { | ||
return multiple && typeof maxCount !== 'undefined' && (rawValues === null || rawValues === void 0 ? void 0 : rawValues.size) >= maxCount; | ||
return multiple && isValidCount(maxCount) && (rawValues === null || rawValues === void 0 ? void 0 : rawValues.size) >= maxCount; | ||
}, [multiple, maxCount, rawValues === null || rawValues === void 0 ? void 0 : rawValues.size]); | ||
@@ -301,3 +302,2 @@ var onListMouseDown = function onListMouseDown(event) { | ||
}, function (item, itemIndex) { | ||
var _classNames; | ||
var group = item.group, | ||
@@ -315,3 +315,3 @@ groupOption = item.groupOption, | ||
return /*#__PURE__*/React.createElement("div", { | ||
className: classNames(itemPrefixCls, "".concat(itemPrefixCls, "-group")), | ||
className: classNames(itemPrefixCls, "".concat(itemPrefixCls, "-group"), data.className), | ||
title: groupTitle | ||
@@ -332,3 +332,3 @@ }, label !== undefined ? label : key); | ||
var optionPrefixCls = "".concat(itemPrefixCls, "-option"); | ||
var optionClassName = classNames(itemPrefixCls, optionPrefixCls, className, (_classNames = {}, _defineProperty(_classNames, "".concat(optionPrefixCls, "-grouped"), groupOption), _defineProperty(_classNames, "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !mergedDisabled), _defineProperty(_classNames, "".concat(optionPrefixCls, "-disabled"), mergedDisabled), _defineProperty(_classNames, "".concat(optionPrefixCls, "-selected"), selected), _classNames)); | ||
var optionClassName = classNames(itemPrefixCls, optionPrefixCls, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(optionPrefixCls, "-grouped"), groupOption), "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !mergedDisabled), "".concat(optionPrefixCls, "-disabled"), mergedDisabled), "".concat(optionPrefixCls, "-selected"), selected)); | ||
var mergedLabel = getLabel(item); | ||
@@ -335,0 +335,0 @@ var iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === 'function' || selected; |
@@ -59,2 +59,4 @@ /** | ||
disabled?: boolean; | ||
className?: string; | ||
title?: string; | ||
[name: string]: any; | ||
@@ -100,2 +102,3 @@ } | ||
listItemHeight?: number; | ||
labelRender?: (props: LabelInValueType) => React.ReactNode; | ||
menuItemSelectedIcon?: RenderNode; | ||
@@ -102,0 +105,0 @@ mode?: 'combobox' | 'multiple' | 'tags'; |
@@ -8,3 +8,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _typeof from "@babel/runtime/helpers/esm/typeof"; | ||
var _excluded = ["id", "mode", "prefixCls", "backfill", "fieldNames", "inputValue", "searchValue", "onSearch", "autoClearSearchValue", "onSelect", "onDeselect", "dropdownMatchSelectWidth", "filterOption", "filterSort", "optionFilterProp", "optionLabelProp", "options", "optionRender", "children", "defaultActiveFirstOption", "menuItemSelectedIcon", "virtual", "direction", "listHeight", "listItemHeight", "value", "defaultValue", "labelInValue", "onChange", "maxCount"]; | ||
var _excluded = ["id", "mode", "prefixCls", "backfill", "fieldNames", "inputValue", "searchValue", "onSearch", "autoClearSearchValue", "onSelect", "onDeselect", "dropdownMatchSelectWidth", "filterOption", "filterSort", "optionFilterProp", "optionLabelProp", "options", "optionRender", "children", "defaultActiveFirstOption", "menuItemSelectedIcon", "virtual", "direction", "listHeight", "listItemHeight", "labelRender", "value", "defaultValue", "labelInValue", "onChange", "maxCount"]; | ||
/** | ||
@@ -92,2 +92,3 @@ * To match accessibility requirement, we always provide an input in the component. | ||
listItemHeight = _props$listItemHeight === void 0 ? 20 : _props$listItemHeight, | ||
labelRender = props.labelRender, | ||
value = props.value, | ||
@@ -220,8 +221,8 @@ defaultValue = props.defaultValue, | ||
return mergedValues.map(function (item) { | ||
var _item$label; | ||
var _ref; | ||
return _objectSpread(_objectSpread({}, item), {}, { | ||
label: (_item$label = item.label) !== null && _item$label !== void 0 ? _item$label : item.value | ||
label: (_ref = typeof labelRender === 'function' ? labelRender(item) : item.label) !== null && _ref !== void 0 ? _ref : item.value | ||
}); | ||
}); | ||
}, [mode, mergedValues]); | ||
}, [mode, mergedValues, labelRender]); | ||
@@ -245,5 +246,4 @@ /** Convert `displayValues` to raw value type set */ | ||
var createTagOption = useRefFunc(function (val, label) { | ||
var _ref; | ||
var mergedLabel = label !== null && label !== void 0 ? label : val; | ||
return _ref = {}, _defineProperty(_ref, mergedFieldNames.value, val), _defineProperty(_ref, mergedFieldNames.label, mergedLabel), _ref; | ||
return _defineProperty(_defineProperty({}, mergedFieldNames.value, val), mergedFieldNames.label, mergedLabel); | ||
}); | ||
@@ -344,5 +344,5 @@ | ||
var onActiveValue = React.useCallback(function (active, index) { | ||
var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref2$source = _ref2.source, | ||
source = _ref2$source === void 0 ? 'keyboard' : _ref2$source; | ||
var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref3$source = _ref3.source, | ||
source = _ref3$source === void 0 ? 'keyboard' : _ref3$source; | ||
setAccessibilityIndex(index); | ||
@@ -349,0 +349,0 @@ if (backfill && mode === 'combobox' && active !== null && source === 'keyboard') { |
@@ -10,4 +10,4 @@ /** | ||
*/ | ||
import type { ScrollTo } from 'rc-virtual-list/lib/List'; | ||
import * as React from 'react'; | ||
import type { ScrollTo } from 'rc-virtual-list/lib/List'; | ||
import type { CustomTagProps, DisplayValueType, Mode, RenderNode } from '../BaseSelect'; | ||
@@ -40,3 +40,3 @@ export interface InnerSelectorProps { | ||
export interface RefSelectorProps { | ||
focus: () => void; | ||
focus: (options?: FocusOptions) => void; | ||
blur: () => void; | ||
@@ -43,0 +43,0 @@ scrollTo?: ScrollTo; |
@@ -13,9 +13,9 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import KeyCode from "rc-util/es/KeyCode"; | ||
import * as React from 'react'; | ||
import { useRef } from 'react'; | ||
import KeyCode from "rc-util/es/KeyCode"; | ||
import useLock from "../hooks/useLock"; | ||
import { isValidateOpenKey } from "../utils/keyUtil"; | ||
import MultipleSelector from "./MultipleSelector"; | ||
import SingleSelector from "./SingleSelector"; | ||
import useLock from "../hooks/useLock"; | ||
import { isValidateOpenKey } from "../utils/keyUtil"; | ||
var Selector = function Selector(props, ref) { | ||
@@ -39,4 +39,4 @@ var inputRef = useRef(null); | ||
return { | ||
focus: function focus() { | ||
inputRef.current.focus(); | ||
focus: function focus(options) { | ||
inputRef.current.focus(options); | ||
}, | ||
@@ -43,0 +43,0 @@ blur: function blur() { |
import type { BaseOptionType, DefaultOptionType } from '../Select'; | ||
import type { FieldNames } from '../Select'; | ||
import type { FlattenOptionData } from '../interface'; | ||
export declare function isValidCount(value?: number): boolean; | ||
export declare function fillFieldNames(fieldNames: FieldNames | undefined, childrenAsData: boolean): { | ||
@@ -5,0 +6,0 @@ label: string; |
@@ -19,2 +19,5 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray"; | ||
} | ||
export function isValidCount(value) { | ||
return typeof value !== 'undefined' && !Number.isNaN(value); | ||
} | ||
export function fillFieldNames(fieldNames, childrenAsData) { | ||
@@ -21,0 +24,0 @@ var _ref = fieldNames || {}, |
@@ -19,3 +19,3 @@ import type { AlignType, BuildInPlacements } from '@rc-component/trigger/lib/interface'; | ||
export interface BaseSelectRef { | ||
focus: () => void; | ||
focus: (options?: FocusOptions) => void; | ||
blur: () => void; | ||
@@ -22,0 +22,0 @@ scrollTo: ScrollTo; |
@@ -41,3 +41,3 @@ "use strict"; | ||
var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var _customizeRawInputEle, _classNames2; | ||
var _customizeRawInputEle; | ||
var id = props.id, | ||
@@ -206,3 +206,3 @@ prefixCls = props.prefixCls, | ||
var onInternalSearch = function onInternalSearch(searchText, fromTyping, isCompositing) { | ||
if ((rawValues === null || rawValues === void 0 ? void 0 : rawValues.size) >= maxCount) { | ||
if ((0, _valueUtil.isValidCount)(maxCount) && (rawValues === null || rawValues === void 0 ? void 0 : rawValues.size) >= maxCount) { | ||
return; | ||
@@ -213,3 +213,3 @@ } | ||
onActiveValueChange === null || onActiveValueChange === void 0 || onActiveValueChange(null); | ||
var separatedList = (0, _valueUtil.getSeparatedContent)(searchText, tokenSeparators, maxCount && maxCount - rawValues.size); | ||
var separatedList = (0, _valueUtil.getSeparatedContent)(searchText, tokenSeparators, (0, _valueUtil.isValidCount)(maxCount) ? maxCount - rawValues.size : undefined); | ||
@@ -511,3 +511,3 @@ // Check if match the `tokenSeparators` | ||
// ============================= Select ============================= | ||
var mergedClassName = (0, _classnames.default)(prefixCls, className, (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-focused"), mockFocused), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-multiple"), multiple), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-single"), !multiple), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-allow-clear"), allowClear), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-show-arrow"), showSuffixIcon), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-disabled"), disabled), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-loading"), loading), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-open"), mergedOpen), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-customize-input"), customizeInputElement), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-show-search"), mergedShowSearch), _classNames2)); | ||
var mergedClassName = (0, _classnames.default)(prefixCls, className, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(prefixCls, "-focused"), mockFocused), "".concat(prefixCls, "-multiple"), multiple), "".concat(prefixCls, "-single"), !multiple), "".concat(prefixCls, "-allow-clear"), allowClear), "".concat(prefixCls, "-show-arrow"), showSuffixIcon), "".concat(prefixCls, "-disabled"), disabled), "".concat(prefixCls, "-loading"), loading), "".concat(prefixCls, "-open"), mergedOpen), "".concat(prefixCls, "-customize-input"), customizeInputElement), "".concat(prefixCls, "-show-search"), mergedShowSearch)); | ||
@@ -538,5 +538,5 @@ // >>> Selector | ||
onPopupMouseEnter: onPopupMouseEnter | ||
}, customizeRawInputElement ? /*#__PURE__*/React.cloneElement(customizeRawInputElement, { | ||
}, customizeRawInputElement ? ( /*#__PURE__*/React.cloneElement(customizeRawInputElement, { | ||
ref: customizeRawInputRef | ||
}) : /*#__PURE__*/React.createElement(_Selector.default, (0, _extends2.default)({}, props, { | ||
})) : /*#__PURE__*/React.createElement(_Selector.default, (0, _extends2.default)({}, props, { | ||
domRef: selectorDomRef, | ||
@@ -543,0 +543,0 @@ prefixCls: prefixCls, |
@@ -26,2 +26,3 @@ "use strict"; | ||
var _platformUtil = require("./utils/platformUtil"); | ||
var _valueUtil = require("./utils/valueUtil"); | ||
var _excluded = ["disabled", "title", "children", "style", "className"]; | ||
@@ -75,3 +76,3 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
var overMaxCount = React.useMemo(function () { | ||
return multiple && typeof maxCount !== 'undefined' && (rawValues === null || rawValues === void 0 ? void 0 : rawValues.size) >= maxCount; | ||
return multiple && (0, _valueUtil.isValidCount)(maxCount) && (rawValues === null || rawValues === void 0 ? void 0 : rawValues.size) >= maxCount; | ||
}, [multiple, maxCount, rawValues === null || rawValues === void 0 ? void 0 : rawValues.size]); | ||
@@ -310,3 +311,2 @@ var onListMouseDown = function onListMouseDown(event) { | ||
}, function (item, itemIndex) { | ||
var _classNames; | ||
var group = item.group, | ||
@@ -324,3 +324,3 @@ groupOption = item.groupOption, | ||
return /*#__PURE__*/React.createElement("div", { | ||
className: (0, _classnames.default)(itemPrefixCls, "".concat(itemPrefixCls, "-group")), | ||
className: (0, _classnames.default)(itemPrefixCls, "".concat(itemPrefixCls, "-group"), data.className), | ||
title: groupTitle | ||
@@ -341,3 +341,3 @@ }, label !== undefined ? label : key); | ||
var optionPrefixCls = "".concat(itemPrefixCls, "-option"); | ||
var optionClassName = (0, _classnames.default)(itemPrefixCls, optionPrefixCls, className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(optionPrefixCls, "-grouped"), groupOption), (0, _defineProperty2.default)(_classNames, "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !mergedDisabled), (0, _defineProperty2.default)(_classNames, "".concat(optionPrefixCls, "-disabled"), mergedDisabled), (0, _defineProperty2.default)(_classNames, "".concat(optionPrefixCls, "-selected"), selected), _classNames)); | ||
var optionClassName = (0, _classnames.default)(itemPrefixCls, optionPrefixCls, className, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(optionPrefixCls, "-grouped"), groupOption), "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !mergedDisabled), "".concat(optionPrefixCls, "-disabled"), mergedDisabled), "".concat(optionPrefixCls, "-selected"), selected)); | ||
var mergedLabel = getLabel(item); | ||
@@ -344,0 +344,0 @@ var iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === 'function' || selected; |
@@ -59,2 +59,4 @@ /** | ||
disabled?: boolean; | ||
className?: string; | ||
title?: string; | ||
[name: string]: any; | ||
@@ -100,2 +102,3 @@ } | ||
listItemHeight?: number; | ||
labelRender?: (props: LabelInValueType) => React.ReactNode; | ||
menuItemSelectedIcon?: RenderNode; | ||
@@ -102,0 +105,0 @@ mode?: 'combobox' | 'multiple' | 'tags'; |
@@ -32,3 +32,3 @@ "use strict"; | ||
var _warningPropsUtil = _interopRequireWildcard(require("./utils/warningPropsUtil")); | ||
var _excluded = ["id", "mode", "prefixCls", "backfill", "fieldNames", "inputValue", "searchValue", "onSearch", "autoClearSearchValue", "onSelect", "onDeselect", "dropdownMatchSelectWidth", "filterOption", "filterSort", "optionFilterProp", "optionLabelProp", "options", "optionRender", "children", "defaultActiveFirstOption", "menuItemSelectedIcon", "virtual", "direction", "listHeight", "listItemHeight", "value", "defaultValue", "labelInValue", "onChange", "maxCount"]; | ||
var _excluded = ["id", "mode", "prefixCls", "backfill", "fieldNames", "inputValue", "searchValue", "onSearch", "autoClearSearchValue", "onSelect", "onDeselect", "dropdownMatchSelectWidth", "filterOption", "filterSort", "optionFilterProp", "optionLabelProp", "options", "optionRender", "children", "defaultActiveFirstOption", "menuItemSelectedIcon", "virtual", "direction", "listHeight", "listItemHeight", "labelRender", "value", "defaultValue", "labelInValue", "onChange", "maxCount"]; | ||
/** | ||
@@ -101,2 +101,3 @@ * To match accessibility requirement, we always provide an input in the component. | ||
listItemHeight = _props$listItemHeight === void 0 ? 20 : _props$listItemHeight, | ||
labelRender = props.labelRender, | ||
value = props.value, | ||
@@ -229,8 +230,8 @@ defaultValue = props.defaultValue, | ||
return mergedValues.map(function (item) { | ||
var _item$label; | ||
var _ref; | ||
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, { | ||
label: (_item$label = item.label) !== null && _item$label !== void 0 ? _item$label : item.value | ||
label: (_ref = typeof labelRender === 'function' ? labelRender(item) : item.label) !== null && _ref !== void 0 ? _ref : item.value | ||
}); | ||
}); | ||
}, [mode, mergedValues]); | ||
}, [mode, mergedValues, labelRender]); | ||
@@ -254,5 +255,4 @@ /** Convert `displayValues` to raw value type set */ | ||
var createTagOption = (0, _useRefFunc.default)(function (val, label) { | ||
var _ref; | ||
var mergedLabel = label !== null && label !== void 0 ? label : val; | ||
return _ref = {}, (0, _defineProperty2.default)(_ref, mergedFieldNames.value, val), (0, _defineProperty2.default)(_ref, mergedFieldNames.label, mergedLabel), _ref; | ||
return (0, _defineProperty2.default)((0, _defineProperty2.default)({}, mergedFieldNames.value, val), mergedFieldNames.label, mergedLabel); | ||
}); | ||
@@ -353,5 +353,5 @@ | ||
var onActiveValue = React.useCallback(function (active, index) { | ||
var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref2$source = _ref2.source, | ||
source = _ref2$source === void 0 ? 'keyboard' : _ref2$source; | ||
var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref3$source = _ref3.source, | ||
source = _ref3$source === void 0 ? 'keyboard' : _ref3$source; | ||
setAccessibilityIndex(index); | ||
@@ -358,0 +358,0 @@ if (backfill && mode === 'combobox' && active !== null && source === 'keyboard') { |
@@ -10,4 +10,4 @@ /** | ||
*/ | ||
import type { ScrollTo } from 'rc-virtual-list/lib/List'; | ||
import * as React from 'react'; | ||
import type { ScrollTo } from 'rc-virtual-list/lib/List'; | ||
import type { CustomTagProps, DisplayValueType, Mode, RenderNode } from '../BaseSelect'; | ||
@@ -40,3 +40,3 @@ export interface InnerSelectorProps { | ||
export interface RefSelectorProps { | ||
focus: () => void; | ||
focus: (options?: FocusOptions) => void; | ||
blur: () => void; | ||
@@ -43,0 +43,0 @@ scrollTo?: ScrollTo; |
@@ -11,9 +11,9 @@ "use strict"; | ||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
var _KeyCode = _interopRequireDefault(require("rc-util/lib/KeyCode")); | ||
var _react = _interopRequireWildcard(require("react")); | ||
var React = _react; | ||
var _KeyCode = _interopRequireDefault(require("rc-util/lib/KeyCode")); | ||
var _useLock3 = _interopRequireDefault(require("../hooks/useLock")); | ||
var _keyUtil = require("../utils/keyUtil"); | ||
var _MultipleSelector = _interopRequireDefault(require("./MultipleSelector")); | ||
var _SingleSelector = _interopRequireDefault(require("./SingleSelector")); | ||
var _useLock3 = _interopRequireDefault(require("../hooks/useLock")); | ||
var _keyUtil = require("../utils/keyUtil"); | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
@@ -49,4 +49,4 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
return { | ||
focus: function focus() { | ||
inputRef.current.focus(); | ||
focus: function focus(options) { | ||
inputRef.current.focus(options); | ||
}, | ||
@@ -53,0 +53,0 @@ blur: function blur() { |
import type { BaseOptionType, DefaultOptionType } from '../Select'; | ||
import type { FieldNames } from '../Select'; | ||
import type { FlattenOptionData } from '../interface'; | ||
export declare function isValidCount(value?: number): boolean; | ||
export declare function fillFieldNames(fieldNames: FieldNames | undefined, childrenAsData: boolean): { | ||
@@ -5,0 +6,0 @@ label: string; |
@@ -11,2 +11,3 @@ "use strict"; | ||
exports.injectPropsWithOption = injectPropsWithOption; | ||
exports.isValidCount = isValidCount; | ||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); | ||
@@ -30,2 +31,5 @@ var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray")); | ||
} | ||
function isValidCount(value) { | ||
return typeof value !== 'undefined' && !Number.isNaN(value); | ||
} | ||
function fillFieldNames(fieldNames, childrenAsData) { | ||
@@ -32,0 +36,0 @@ var _ref = fieldNames || {}, |
{ | ||
"name": "rc-select", | ||
"version": "14.11.0", | ||
"version": "14.12.0", | ||
"description": "React Select", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -133,2 +133,3 @@ # rc-select | ||
| optionRender | Custom rendering options | (oriOption: FlattenOptionData\<BaseOptionType\> , info: { index: number }) => React.ReactNode | - | | ||
| labelRender | Custom rendering label | (props: LabelInValueType) => React.ReactNode | - | | ||
| maxCount | The max number of items can be selected | number | - | | ||
@@ -160,2 +161,4 @@ | ||
| value | default filter by this attribute. if react want you to set key, then key is same as value, you can omit value | String | - | | ||
| className | same as `Option props` | String | '' | | ||
| title | same as `Option props`| String | - | | ||
@@ -162,0 +165,0 @@ ## Development |
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
336850
7350
191