parent
bd553de501
commit
0d41aa929a
|
@ -1,7 +1,6 @@
|
||||||
import warning, { noteOnce } from '../../vc-util/warning';
|
import warning, { noteOnce } from '../../vc-util/warning';
|
||||||
import type { SelectProps } from '..';
|
import type { SelectProps } from '..';
|
||||||
import { convertChildrenToData } from './legacyUtil';
|
import { convertChildrenToData } from './legacyUtil';
|
||||||
import type { OptionData } from '../interface';
|
|
||||||
import { toArray } from './commonUtil';
|
import { toArray } from './commonUtil';
|
||||||
import type { RawValueType, LabelValueType } from '../interface/generator';
|
import type { RawValueType, LabelValueType } from '../interface/generator';
|
||||||
import { isValidElement } from '../../_util/props-util';
|
import { isValidElement } from '../../_util/props-util';
|
||||||
|
@ -36,23 +35,6 @@ function warningProps(props: SelectProps) {
|
||||||
'Please avoid setting option to disabled in tags mode since user can always type text as tag.',
|
'Please avoid setting option to disabled in tags mode since user can always type text as tag.',
|
||||||
);
|
);
|
||||||
|
|
||||||
// `combobox` & `tags` should option be `string` type
|
|
||||||
if (mode === 'tags' || mode === 'combobox') {
|
|
||||||
const hasNumberValue = mergedOptions.some(item => {
|
|
||||||
if (item.options) {
|
|
||||||
return item.options.some(
|
|
||||||
(opt: OptionData) => typeof ('value' in opt ? opt.value : opt.key) === 'number',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return typeof ('value' in item ? item.value : item.key) === 'number';
|
|
||||||
});
|
|
||||||
|
|
||||||
warning(
|
|
||||||
!hasNumberValue,
|
|
||||||
'`value` of Option should not use number type when `mode` is `tags` or `combobox`.',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// `combobox` should not use `optionLabelProp`
|
// `combobox` should not use `optionLabelProp`
|
||||||
warning(
|
warning(
|
||||||
mode !== 'combobox' || !optionLabelProp,
|
mode !== 'combobox' || !optionLabelProp,
|
||||||
|
|
2
v2-doc
2
v2-doc
|
@ -1 +1 @@
|
||||||
Subproject commit 3f94a02d16bac2377d71e26948ffe45571dae49e
|
Subproject commit 72a50fb9620defe257ea3f0f3256ed678df98b05
|
Loading…
Reference in New Issue