rc-select
Advanced tools
Comparing version 14.1.1 to 14.1.2
@@ -7,3 +7,3 @@ import * as React from 'react'; | ||
*/ | ||
export default function useOptions<OptionType>(options: OptionType[], children: React.ReactNode, fieldNames: FieldNames): { | ||
export default function useOptions<OptionType>(options: OptionType[], children: React.ReactNode, fieldNames: FieldNames, optionFilterProp: string, optionLabelProp: string): { | ||
options: OptionType[]; | ||
@@ -10,0 +10,0 @@ valueOptions: Map<RawValueType, OptionType>; |
@@ -8,3 +8,3 @@ import * as React from 'react'; | ||
export default function useOptions(options, children, fieldNames) { | ||
export default function useOptions(options, children, fieldNames, optionFilterProp, optionLabelProp) { | ||
return React.useMemo(function () { | ||
@@ -21,2 +21,8 @@ var mergedOptions = options; | ||
var setLabelOptions = function setLabelOptions(labelOptionsMap, option, key) { | ||
if (key && typeof key === 'string') { | ||
labelOptionsMap.set(option[key], option); | ||
} | ||
}; | ||
function dig(optionList) { | ||
@@ -31,3 +37,6 @@ var isChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
valueOptions.set(option[fieldNames.value], option); | ||
labelOptions.set(option[fieldNames.label], option); | ||
setLabelOptions(labelOptions, option, fieldNames.label); // https://github.com/ant-design/ant-design/issues/35304 | ||
setLabelOptions(labelOptions, option, optionFilterProp); | ||
setLabelOptions(labelOptions, option, optionLabelProp); | ||
} else { | ||
@@ -45,3 +54,3 @@ dig(option[fieldNames.options], true); | ||
}; | ||
}, [options, children, fieldNames]); | ||
}, [options, children, fieldNames, optionFilterProp, optionLabelProp]); | ||
} |
@@ -126,3 +126,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
var parsedOptions = useOptions(options, children, mergedFieldNames); | ||
var parsedOptions = useOptions(options, children, mergedFieldNames, optionFilterProp, optionLabelProp); | ||
var valueOptions = parsedOptions.valueOptions, | ||
@@ -129,0 +129,0 @@ labelOptions = parsedOptions.labelOptions, |
@@ -7,3 +7,3 @@ import * as React from 'react'; | ||
*/ | ||
export default function useOptions<OptionType>(options: OptionType[], children: React.ReactNode, fieldNames: FieldNames): { | ||
export default function useOptions<OptionType>(options: OptionType[], children: React.ReactNode, fieldNames: FieldNames, optionFilterProp: string, optionLabelProp: string): { | ||
options: OptionType[]; | ||
@@ -10,0 +10,0 @@ valueOptions: Map<RawValueType, OptionType>; |
@@ -18,3 +18,3 @@ "use strict"; | ||
*/ | ||
function useOptions(options, children, fieldNames) { | ||
function useOptions(options, children, fieldNames, optionFilterProp, optionLabelProp) { | ||
return React.useMemo(function () { | ||
@@ -31,2 +31,8 @@ var mergedOptions = options; | ||
var setLabelOptions = function setLabelOptions(labelOptionsMap, option, key) { | ||
if (key && typeof key === 'string') { | ||
labelOptionsMap.set(option[key], option); | ||
} | ||
}; | ||
function dig(optionList) { | ||
@@ -41,3 +47,6 @@ var isChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
valueOptions.set(option[fieldNames.value], option); | ||
labelOptions.set(option[fieldNames.label], option); | ||
setLabelOptions(labelOptions, option, fieldNames.label); // https://github.com/ant-design/ant-design/issues/35304 | ||
setLabelOptions(labelOptions, option, optionFilterProp); | ||
setLabelOptions(labelOptions, option, optionLabelProp); | ||
} else { | ||
@@ -55,3 +64,3 @@ dig(option[fieldNames.options], true); | ||
}; | ||
}, [options, children, fieldNames]); | ||
}, [options, children, fieldNames, optionFilterProp, optionLabelProp]); | ||
} |
@@ -128,3 +128,3 @@ "use strict"; | ||
var parsedOptions = (0, _useOptions.default)(options, children, mergedFieldNames); | ||
var parsedOptions = (0, _useOptions.default)(options, children, mergedFieldNames, optionFilterProp, optionLabelProp); | ||
var valueOptions = parsedOptions.valueOptions, | ||
@@ -131,0 +131,0 @@ labelOptions = parsedOptions.labelOptions, |
{ | ||
"name": "rc-select", | ||
"version": "14.1.1", | ||
"version": "14.1.2", | ||
"description": "React Select", | ||
@@ -5,0 +5,0 @@ "engines": { |
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
288244
6259