1
- import * as React from 'react' ;
1
+ import type { BaseSelectProps , BaseSelectPropsWithoutPrivate , BaseSelectRef } from 'rc-select' ;
2
+ import { BaseSelect } from 'rc-select' ;
3
+ import type { DisplayValueType , Placement } from 'rc-select/lib/BaseSelect' ;
2
4
import useId from 'rc-select/lib/hooks/useId' ;
3
5
import { conductCheck } from 'rc-tree/lib/utils/conductUtil' ;
4
6
import useMergedState from 'rc-util/lib/hooks/useMergedState' ;
5
- import type { DisplayValueType , Placement } from 'rc-select/lib/BaseSelect' ;
6
- import type { BaseSelectRef , BaseSelectPropsWithoutPrivate , BaseSelectProps } from 'rc-select' ;
7
- import { BaseSelect } from 'rc-select' ;
8
- import OptionList from './OptionList' ;
7
+ import * as React from 'react' ;
9
8
import CascaderContext from './context' ;
10
- import { fillFieldNames , toPathKey , toPathKeys , SHOW_PARENT , SHOW_CHILD } from './utils/commonUtil' ;
11
9
import useDisplayValues from './hooks/useDisplayValues' ;
12
- import useRefFunc from './hooks/useRefFunc' ;
13
10
import useEntities from './hooks/useEntities' ;
14
- import { formatStrategyValues , toPathOptions } from './utils/treeUtil' ;
11
+ import useMissingValues from './hooks/useMissingValues' ;
12
+ import useRefFunc from './hooks/useRefFunc' ;
15
13
import useSearchConfig from './hooks/useSearchConfig' ;
16
14
import useSearchOptions from './hooks/useSearchOptions' ;
17
- import warning from 'rc-util/lib/warning' ;
18
- import useMissingValues from './hooks/useMissingValues' ;
15
+ import OptionList from './OptionList' ;
16
+ import { fillFieldNames , SHOW_CHILD , SHOW_PARENT , toPathKey , toPathKeys } from './utils/commonUtil' ;
17
+ import { formatStrategyValues , toPathOptions } from './utils/treeUtil' ;
18
+ import warningProps , { warningNullOptions } from './utils/warningPropsUtil' ;
19
19
20
20
export interface ShowSearchType < OptionType extends BaseOptionType = DefaultOptionType > {
21
21
filter ?: ( inputValue : string , options : OptionType [ ] , fieldNames : FieldNames ) => boolean ;
@@ -134,7 +134,7 @@ export type CascaderProps<OptionType extends BaseOptionType = DefaultOptionType>
134
134
| SingleCascaderProps < OptionType >
135
135
| MultipleCascaderProps < OptionType > ;
136
136
137
- type InternalCascaderProps < OptionType extends BaseOptionType = DefaultOptionType > = Omit <
137
+ export type InternalCascaderProps < OptionType extends BaseOptionType = DefaultOptionType > = Omit <
138
138
SingleCascaderProps < OptionType > | MultipleCascaderProps < OptionType > ,
139
139
'onChange'
140
140
> & {
@@ -412,22 +412,6 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
412
412
} ;
413
413
414
414
// ============================ Open ============================
415
- if ( process . env . NODE_ENV !== 'production' ) {
416
- warning (
417
- ! onPopupVisibleChange ,
418
- '`onPopupVisibleChange` is deprecated. Please use `onDropdownVisibleChange` instead.' ,
419
- ) ;
420
- warning ( popupVisible === undefined , '`popupVisible` is deprecated. Please use `open` instead.' ) ;
421
- warning (
422
- popupClassName === undefined ,
423
- '`popupClassName` is deprecated. Please use `dropdownClassName` instead.' ,
424
- ) ;
425
- warning (
426
- popupPlacement === undefined ,
427
- '`popupPlacement` is deprecated. Please use `placement` instead.' ,
428
- ) ;
429
- }
430
-
431
415
const mergedOpen = open !== undefined ? open : popupVisible ;
432
416
433
417
const mergedDropdownClassName = dropdownClassName || popupClassName ;
@@ -439,6 +423,12 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
439
423
onPopupVisibleChange ?.( nextVisible ) ;
440
424
} ;
441
425
426
+ // ========================== Warning ===========================
427
+ if ( process . env . NODE_ENV !== 'production' ) {
428
+ warningProps ( props ) ;
429
+ warningNullOptions ( mergedOptions , mergedFieldNames ) ;
430
+ }
431
+
442
432
// ========================== Context ===========================
443
433
const cascaderContext = React . useMemo (
444
434
( ) => ( {
0 commit comments