@rc-component/cascader 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Cascader.d.ts +3 -6
- package/es/Cascader.js +9 -17
- package/es/OptionList/CacheContent.d.ts +1 -1
- package/es/OptionList/Column.js +16 -2
- package/es/OptionList/List.js +2 -2
- package/es/OptionList/useActive.d.ts +2 -2
- package/es/OptionList/useActive.js +0 -1
- package/es/OptionList/useKeyboard.d.ts +2 -2
- package/es/Panel.js +2 -2
- package/es/context.d.ts +2 -2
- package/es/hooks/useEntities.d.ts +1 -1
- package/es/hooks/useEntities.js +1 -1
- package/es/hooks/useOptions.d.ts +2 -3
- package/es/hooks/useSelect.d.ts +2 -3
- package/es/hooks/useSelect.js +1 -1
- package/es/hooks/useValues.d.ts +3 -4
- package/es/hooks/useValues.js +1 -1
- package/es/utils/treeUtil.d.ts +2 -3
- package/es/utils/warningPropsUtil.d.ts +1 -3
- package/es/utils/warningPropsUtil.js +1 -11
- package/lib/Cascader.d.ts +3 -6
- package/lib/Cascader.js +9 -17
- package/lib/OptionList/CacheContent.d.ts +1 -1
- package/lib/OptionList/Column.js +16 -2
- package/lib/OptionList/List.js +2 -2
- package/lib/OptionList/useActive.d.ts +2 -2
- package/lib/OptionList/useKeyboard.d.ts +2 -2
- package/lib/Panel.js +2 -2
- package/lib/context.d.ts +2 -2
- package/lib/hooks/useEntities.d.ts +1 -1
- package/lib/hooks/useEntities.js +1 -1
- package/lib/hooks/useOptions.d.ts +2 -3
- package/lib/hooks/useSelect.d.ts +2 -3
- package/lib/hooks/useSelect.js +1 -1
- package/lib/hooks/useValues.d.ts +3 -4
- package/lib/hooks/useValues.js +1 -1
- package/lib/utils/treeUtil.d.ts +2 -3
- package/lib/utils/warningPropsUtil.d.ts +1 -3
- package/lib/utils/warningPropsUtil.js +1 -12
- package/package.json +6 -5
package/es/Cascader.d.ts
CHANGED
|
@@ -37,14 +37,10 @@ interface BaseCascaderProps<OptionType extends DefaultOptionType = DefaultOption
|
|
|
37
37
|
expandTrigger?: 'hover' | 'click';
|
|
38
38
|
options?: OptionType[];
|
|
39
39
|
/** @private Internal usage. Do not use in your production. */
|
|
40
|
-
|
|
40
|
+
popupPrefixCls?: string;
|
|
41
41
|
loadData?: (selectOptions: OptionType[]) => void;
|
|
42
|
-
/** @deprecated Use `open` instead */
|
|
43
|
-
popupVisible?: boolean;
|
|
44
42
|
popupClassName?: string;
|
|
45
|
-
|
|
46
|
-
/** @deprecated Use `placement` instead */
|
|
47
|
-
popupPlacement?: Placement;
|
|
43
|
+
popupMenuColumnStyle?: React.CSSProperties;
|
|
48
44
|
placement?: Placement;
|
|
49
45
|
builtinPlacements?: BuildInPlacements;
|
|
50
46
|
onPopupVisibleChange?: (open: boolean) => void;
|
|
@@ -66,6 +62,7 @@ export interface CascaderProps<OptionType extends DefaultOptionType = DefaultOpt
|
|
|
66
62
|
onChange?: (value: GetValueType<OptionType, ValueField, Multiple>, selectOptions: GetOptionType<OptionType, Multiple>) => void;
|
|
67
63
|
}
|
|
68
64
|
export type SingleValueType = (string | number)[];
|
|
65
|
+
export type LegacyKey = string | number;
|
|
69
66
|
export type InternalValueType = SingleValueType | SingleValueType[];
|
|
70
67
|
export interface InternalFieldNames extends Required<FieldNames> {
|
|
71
68
|
key: string;
|
package/es/Cascader.js
CHANGED
|
@@ -16,7 +16,7 @@ import OptionList from "./OptionList";
|
|
|
16
16
|
import Panel from "./Panel";
|
|
17
17
|
import { fillFieldNames, SHOW_CHILD, SHOW_PARENT, toPathKeys, toRawValues } from "./utils/commonUtil";
|
|
18
18
|
import { formatStrategyValues, toPathOptions } from "./utils/treeUtil";
|
|
19
|
-
import
|
|
19
|
+
import { warningNullOptions } from "./utils/warningPropsUtil";
|
|
20
20
|
const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
21
21
|
const {
|
|
22
22
|
// MISC
|
|
@@ -39,15 +39,12 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
39
39
|
expandTrigger,
|
|
40
40
|
// Options
|
|
41
41
|
options,
|
|
42
|
-
|
|
42
|
+
popupPrefixCls,
|
|
43
43
|
loadData,
|
|
44
|
-
// Open
|
|
45
|
-
popupVisible,
|
|
46
44
|
open,
|
|
47
45
|
popupClassName,
|
|
48
|
-
|
|
46
|
+
popupMenuColumnStyle,
|
|
49
47
|
popupStyle: customPopupStyle,
|
|
50
|
-
popupPlacement,
|
|
51
48
|
placement,
|
|
52
49
|
onPopupVisibleChange,
|
|
53
50
|
// Icon
|
|
@@ -89,7 +86,7 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
89
86
|
}
|
|
90
87
|
};
|
|
91
88
|
const [mergedShowSearch, searchConfig] = useSearchConfig(showSearch);
|
|
92
|
-
const searchOptions = useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames,
|
|
89
|
+
const searchOptions = useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames, popupPrefixCls || prefixCls, searchConfig, changeOnSelect || multiple);
|
|
93
90
|
|
|
94
91
|
// =========================== Values ===========================
|
|
95
92
|
const getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);
|
|
@@ -139,17 +136,12 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
139
136
|
} = info.values[0];
|
|
140
137
|
onInternalSelect(valueCells);
|
|
141
138
|
};
|
|
142
|
-
|
|
143
|
-
// ============================ Open ============================
|
|
144
|
-
const mergedOpen = open !== undefined ? open : popupVisible;
|
|
145
|
-
const mergedPlacement = placement || popupPlacement;
|
|
146
139
|
const onInternalPopupVisibleChange = nextVisible => {
|
|
147
140
|
onPopupVisibleChange?.(nextVisible);
|
|
148
141
|
};
|
|
149
142
|
|
|
150
143
|
// ========================== Warning ===========================
|
|
151
144
|
if (process.env.NODE_ENV !== 'production') {
|
|
152
|
-
warningProps(props);
|
|
153
145
|
warningNullOptions(mergedOptions, mergedFieldNames);
|
|
154
146
|
}
|
|
155
147
|
|
|
@@ -163,14 +155,14 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
163
155
|
onSelect: onInternalSelect,
|
|
164
156
|
checkable,
|
|
165
157
|
searchOptions,
|
|
166
|
-
|
|
158
|
+
popupPrefixCls,
|
|
167
159
|
loadData,
|
|
168
160
|
expandTrigger,
|
|
169
161
|
expandIcon,
|
|
170
162
|
loadingIcon,
|
|
171
|
-
|
|
163
|
+
popupMenuColumnStyle,
|
|
172
164
|
optionRender
|
|
173
|
-
}), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions,
|
|
165
|
+
}), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, popupPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, popupMenuColumnStyle, optionRender]);
|
|
174
166
|
|
|
175
167
|
// ==============================================================
|
|
176
168
|
// == Render ==
|
|
@@ -212,9 +204,9 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
212
204
|
emptyOptions: emptyOptions
|
|
213
205
|
// Open
|
|
214
206
|
,
|
|
215
|
-
open:
|
|
207
|
+
open: open,
|
|
216
208
|
popupClassName: popupClassName,
|
|
217
|
-
placement:
|
|
209
|
+
placement: placement,
|
|
218
210
|
onPopupVisibleChange: onInternalPopupVisibleChange
|
|
219
211
|
// Children
|
|
220
212
|
,
|
|
@@ -3,5 +3,5 @@ export interface CacheContentProps {
|
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
open?: boolean;
|
|
5
5
|
}
|
|
6
|
-
declare const CacheContent: React.MemoExoticComponent<({ children }: CacheContentProps) => React.ReactElement<
|
|
6
|
+
declare const CacheContent: React.MemoExoticComponent<({ children }: CacheContentProps) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>>>;
|
|
7
7
|
export default CacheContent;
|
package/es/OptionList/Column.js
CHANGED
|
@@ -22,13 +22,14 @@ export default function Column({
|
|
|
22
22
|
}) {
|
|
23
23
|
const menuPrefixCls = `${prefixCls}-menu`;
|
|
24
24
|
const menuItemPrefixCls = `${prefixCls}-menu-item`;
|
|
25
|
+
const menuRef = React.useRef(null);
|
|
25
26
|
const {
|
|
26
27
|
fieldNames,
|
|
27
28
|
changeOnSelect,
|
|
28
29
|
expandTrigger,
|
|
29
30
|
expandIcon,
|
|
30
31
|
loadingIcon,
|
|
31
|
-
|
|
32
|
+
popupMenuColumnStyle,
|
|
32
33
|
optionRender
|
|
33
34
|
} = React.useContext(CascaderContext);
|
|
34
35
|
const hoverOpen = expandTrigger === 'hover';
|
|
@@ -69,10 +70,23 @@ export default function Column({
|
|
|
69
70
|
fullPathKey
|
|
70
71
|
};
|
|
71
72
|
}), [options, checkedSet, fieldNames, halfCheckedSet, loadingKeys, prevValuePath]);
|
|
73
|
+
React.useEffect(() => {
|
|
74
|
+
if (menuRef.current) {
|
|
75
|
+
const selector = `.${menuItemPrefixCls}-active`;
|
|
76
|
+
const activeElement = menuRef.current.querySelector(selector);
|
|
77
|
+
if (activeElement) {
|
|
78
|
+
activeElement.scrollIntoView({
|
|
79
|
+
block: 'nearest',
|
|
80
|
+
inline: 'nearest'
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, [activeValue, menuItemPrefixCls]);
|
|
72
85
|
|
|
73
86
|
// ============================ Render ============================
|
|
74
87
|
return /*#__PURE__*/React.createElement("ul", {
|
|
75
88
|
className: menuPrefixCls,
|
|
89
|
+
ref: menuRef,
|
|
76
90
|
role: "menu"
|
|
77
91
|
}, optionInfoList.map(({
|
|
78
92
|
disabled,
|
|
@@ -123,7 +137,7 @@ export default function Column({
|
|
|
123
137
|
[`${menuItemPrefixCls}-disabled`]: isOptionDisabled(disabled),
|
|
124
138
|
[`${menuItemPrefixCls}-loading`]: isLoading
|
|
125
139
|
}),
|
|
126
|
-
style:
|
|
140
|
+
style: popupMenuColumnStyle,
|
|
127
141
|
role: "menuitemcheckbox",
|
|
128
142
|
title: title,
|
|
129
143
|
"aria-checked": checked,
|
package/es/OptionList/List.js
CHANGED
|
@@ -30,11 +30,11 @@ const RawOptionList = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
30
30
|
changeOnSelect,
|
|
31
31
|
onSelect,
|
|
32
32
|
searchOptions,
|
|
33
|
-
|
|
33
|
+
popupPrefixCls,
|
|
34
34
|
loadData,
|
|
35
35
|
expandTrigger
|
|
36
36
|
} = React.useContext(CascaderContext);
|
|
37
|
-
const mergedPrefixCls =
|
|
37
|
+
const mergedPrefixCls = popupPrefixCls || prefixCls;
|
|
38
38
|
|
|
39
39
|
// ========================= loadData =========================
|
|
40
40
|
const [loadingKeys, setLoadingKeys] = React.useState([]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LegacyKey } from "../Cascader";
|
|
2
2
|
/**
|
|
3
3
|
* Control the active open options path.
|
|
4
4
|
*/
|
|
5
|
-
declare const useActive: (multiple?: boolean, open?: boolean) => [
|
|
5
|
+
declare const useActive: (multiple?: boolean, open?: boolean) => [LegacyKey[], (activeValueCells: LegacyKey[]) => void];
|
|
6
6
|
export default useActive;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RefOptionListProps } from '@rc-component/select/lib/OptionList';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import type { DefaultOptionType, InternalFieldNames, SingleValueType } from '../Cascader';
|
|
4
|
-
declare const _default: (ref: React.Ref<RefOptionListProps>, options: DefaultOptionType[], fieldNames: InternalFieldNames, activeValueCells:
|
|
3
|
+
import type { DefaultOptionType, InternalFieldNames, LegacyKey, SingleValueType } from '../Cascader';
|
|
4
|
+
declare const _default: (ref: React.Ref<RefOptionListProps>, options: DefaultOptionType[], fieldNames: InternalFieldNames, activeValueCells: LegacyKey[], setActiveValueCells: (activeValueCells: LegacyKey[]) => void, onKeyBoardSelect: (valueCells: SingleValueType, option: DefaultOptionType) => void, contextProps: {
|
|
5
5
|
direction?: "ltr" | "rtl" | undefined;
|
|
6
6
|
searchValue: string;
|
|
7
7
|
toggleOpen: (open?: boolean) => void;
|
package/es/Panel.js
CHANGED
|
@@ -85,12 +85,12 @@ export default function Panel(props) {
|
|
|
85
85
|
onSelect: onInternalSelect,
|
|
86
86
|
checkable,
|
|
87
87
|
searchOptions: [],
|
|
88
|
-
|
|
88
|
+
popupPrefixCls: undefined,
|
|
89
89
|
loadData,
|
|
90
90
|
expandTrigger,
|
|
91
91
|
expandIcon,
|
|
92
92
|
loadingIcon,
|
|
93
|
-
|
|
93
|
+
popupMenuColumnStyle: undefined
|
|
94
94
|
}), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, loadData, expandTrigger, expandIcon, loadingIcon]);
|
|
95
95
|
|
|
96
96
|
// ========================= Render =========================
|
package/es/context.d.ts
CHANGED
|
@@ -9,12 +9,12 @@ export interface CascaderContextProps {
|
|
|
9
9
|
onSelect: (valuePath: SingleValueType) => void;
|
|
10
10
|
checkable?: boolean | React.ReactNode;
|
|
11
11
|
searchOptions: DefaultOptionType[];
|
|
12
|
-
|
|
12
|
+
popupPrefixCls?: string;
|
|
13
13
|
loadData?: (selectOptions: DefaultOptionType[]) => void;
|
|
14
14
|
expandTrigger?: 'hover' | 'click';
|
|
15
15
|
expandIcon?: React.ReactNode;
|
|
16
16
|
loadingIcon?: React.ReactNode;
|
|
17
|
-
|
|
17
|
+
popupMenuColumnStyle?: React.CSSProperties;
|
|
18
18
|
optionRender?: CascaderProps['optionRender'];
|
|
19
19
|
}
|
|
20
20
|
declare const CascaderContext: React.Context<CascaderContextProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DefaultOptionType, InternalFieldNames } from '../Cascader';
|
|
2
|
-
import type { DataEntity } from 'rc-tree/lib/interface';
|
|
2
|
+
import type { DataEntity } from '@rc-component/tree/lib/interface';
|
|
3
3
|
export interface OptionsInfo {
|
|
4
4
|
keyEntities: Record<string, DataEntity>;
|
|
5
5
|
pathKeyEntities: Record<string, DataEntity>;
|
package/es/hooks/useEntities.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { convertDataToEntities } from "rc-tree/es/utils/treeUtil";
|
|
2
|
+
import { convertDataToEntities } from "@rc-component/tree/es/utils/treeUtil";
|
|
3
3
|
import { VALUE_SPLIT } from "../utils/commonUtil";
|
|
4
4
|
/** Lazy parse options data into conduct-able info to avoid perf issue in single mode */
|
|
5
5
|
export default ((options, fieldNames) => {
|
package/es/hooks/useOptions.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import type { DefaultOptionType } from '..';
|
|
3
|
-
import type { InternalFieldNames, SingleValueType } from '../Cascader';
|
|
2
|
+
import type { InternalFieldNames, SingleValueType, LegacyKey } from '../Cascader';
|
|
4
3
|
import { type GetEntities } from './useEntities';
|
|
5
4
|
export default function useOptions(mergedFieldNames: InternalFieldNames, options?: DefaultOptionType[]): [
|
|
6
5
|
mergedOptions: DefaultOptionType[],
|
|
7
6
|
getPathKeyEntities: GetEntities,
|
|
8
|
-
getValueByKeyPath: (pathKeys:
|
|
7
|
+
getValueByKeyPath: (pathKeys: LegacyKey[]) => SingleValueType[]
|
|
9
8
|
];
|
package/es/hooks/useSelect.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import type { InternalValueType, ShowCheckedStrategy, SingleValueType } from '../Cascader';
|
|
1
|
+
import type { InternalValueType, LegacyKey, ShowCheckedStrategy, SingleValueType } from '../Cascader';
|
|
3
2
|
import type { GetEntities } from './useEntities';
|
|
4
|
-
export default function useSelect(multiple: boolean, triggerChange: (nextValues: InternalValueType) => void, checkedValues: SingleValueType[], halfCheckedValues: SingleValueType[], missingCheckedValues: SingleValueType[], getPathKeyEntities: GetEntities, getValueByKeyPath: (pathKeys:
|
|
3
|
+
export default function useSelect(multiple: boolean, triggerChange: (nextValues: InternalValueType) => void, checkedValues: SingleValueType[], halfCheckedValues: SingleValueType[], missingCheckedValues: SingleValueType[], getPathKeyEntities: GetEntities, getValueByKeyPath: (pathKeys: LegacyKey[]) => SingleValueType[], showCheckedStrategy?: ShowCheckedStrategy): (valuePath: SingleValueType) => void;
|
package/es/hooks/useSelect.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { conductCheck } from "rc-tree/es/utils/conductUtil";
|
|
1
|
+
import { conductCheck } from "@rc-component/tree/es/utils/conductUtil";
|
|
2
2
|
import { toPathKey, toPathKeys } from "../utils/commonUtil";
|
|
3
3
|
import { formatStrategyValues } from "../utils/treeUtil";
|
|
4
4
|
export default function useSelect(multiple, triggerChange, checkedValues, halfCheckedValues, missingCheckedValues, getPathKeyEntities, getValueByKeyPath, showCheckedStrategy) {
|
package/es/hooks/useValues.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { DataEntity } from 'rc-tree/lib/interface';
|
|
2
|
-
import
|
|
3
|
-
import type { SingleValueType } from '../Cascader';
|
|
1
|
+
import type { DataEntity } from '@rc-component/tree/lib/interface';
|
|
2
|
+
import type { LegacyKey, SingleValueType } from '../Cascader';
|
|
4
3
|
import type { GetMissValues } from './useMissingValues';
|
|
5
|
-
export default function useValues(multiple: boolean, rawValues: SingleValueType[], getPathKeyEntities: () => Record<string, DataEntity>, getValueByKeyPath: (pathKeys:
|
|
4
|
+
export default function useValues(multiple: boolean, rawValues: SingleValueType[], getPathKeyEntities: () => Record<string, DataEntity>, getValueByKeyPath: (pathKeys: LegacyKey[]) => SingleValueType[], getMissingValues: GetMissValues): [
|
|
6
5
|
checkedValues: SingleValueType[],
|
|
7
6
|
halfCheckedValues: SingleValueType[],
|
|
8
7
|
missingCheckedValues: SingleValueType[]
|
package/es/hooks/useValues.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { conductCheck } from "rc-tree/es/utils/conductUtil";
|
|
1
|
+
import { conductCheck } from "@rc-component/tree/es/utils/conductUtil";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { toPathKeys } from "../utils/commonUtil";
|
|
4
4
|
export default function useValues(multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues) {
|
package/es/utils/treeUtil.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SingleValueType, DefaultOptionType, InternalFieldNames, ShowCheckedStrategy } from '../Cascader';
|
|
1
|
+
import type { SingleValueType, DefaultOptionType, InternalFieldNames, ShowCheckedStrategy, LegacyKey } from '../Cascader';
|
|
3
2
|
import type { GetEntities } from '../hooks/useEntities';
|
|
4
|
-
export declare function formatStrategyValues(pathKeys:
|
|
3
|
+
export declare function formatStrategyValues(pathKeys: LegacyKey[], getKeyPathEntities: GetEntities, showCheckedStrategy?: ShowCheckedStrategy): LegacyKey[];
|
|
5
4
|
export declare function toPathOptions(valueCells: SingleValueType, options: DefaultOptionType[], fieldNames: InternalFieldNames, stringMode?: boolean): {
|
|
6
5
|
value: SingleValueType[number];
|
|
7
6
|
index: number;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import type { DefaultOptionType, FieldNames
|
|
2
|
-
declare function warningProps(props: InternalCascaderProps): void;
|
|
1
|
+
import type { DefaultOptionType, FieldNames } from '../Cascader';
|
|
3
2
|
export declare function warningNullOptions(options: DefaultOptionType[], fieldNames: FieldNames): void;
|
|
4
|
-
export default warningProps;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import warning from "@rc-component/util/es/warning";
|
|
2
|
-
function warningProps(props) {
|
|
3
|
-
const {
|
|
4
|
-
popupVisible,
|
|
5
|
-
popupPlacement
|
|
6
|
-
} = props;
|
|
7
|
-
warning(popupVisible === undefined, '`popupVisible` is deprecated. Please use `open` instead.');
|
|
8
|
-
warning(popupPlacement === undefined, '`popupPlacement` is deprecated. Please use `placement` instead.');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
2
|
// value in Cascader options should not be null
|
|
12
3
|
export function warningNullOptions(options, fieldNames) {
|
|
13
4
|
if (options) {
|
|
@@ -25,5 +16,4 @@ export function warningNullOptions(options, fieldNames) {
|
|
|
25
16
|
};
|
|
26
17
|
recursiveOptions(options);
|
|
27
18
|
}
|
|
28
|
-
}
|
|
29
|
-
export default warningProps;
|
|
19
|
+
}
|
package/lib/Cascader.d.ts
CHANGED
|
@@ -37,14 +37,10 @@ interface BaseCascaderProps<OptionType extends DefaultOptionType = DefaultOption
|
|
|
37
37
|
expandTrigger?: 'hover' | 'click';
|
|
38
38
|
options?: OptionType[];
|
|
39
39
|
/** @private Internal usage. Do not use in your production. */
|
|
40
|
-
|
|
40
|
+
popupPrefixCls?: string;
|
|
41
41
|
loadData?: (selectOptions: OptionType[]) => void;
|
|
42
|
-
/** @deprecated Use `open` instead */
|
|
43
|
-
popupVisible?: boolean;
|
|
44
42
|
popupClassName?: string;
|
|
45
|
-
|
|
46
|
-
/** @deprecated Use `placement` instead */
|
|
47
|
-
popupPlacement?: Placement;
|
|
43
|
+
popupMenuColumnStyle?: React.CSSProperties;
|
|
48
44
|
placement?: Placement;
|
|
49
45
|
builtinPlacements?: BuildInPlacements;
|
|
50
46
|
onPopupVisibleChange?: (open: boolean) => void;
|
|
@@ -66,6 +62,7 @@ export interface CascaderProps<OptionType extends DefaultOptionType = DefaultOpt
|
|
|
66
62
|
onChange?: (value: GetValueType<OptionType, ValueField, Multiple>, selectOptions: GetOptionType<OptionType, Multiple>) => void;
|
|
67
63
|
}
|
|
68
64
|
export type SingleValueType = (string | number)[];
|
|
65
|
+
export type LegacyKey = string | number;
|
|
69
66
|
export type InternalValueType = SingleValueType | SingleValueType[];
|
|
70
67
|
export interface InternalFieldNames extends Required<FieldNames> {
|
|
71
68
|
key: string;
|
package/lib/Cascader.js
CHANGED
|
@@ -21,7 +21,7 @@ var _OptionList = _interopRequireDefault(require("./OptionList"));
|
|
|
21
21
|
var _Panel = _interopRequireDefault(require("./Panel"));
|
|
22
22
|
var _commonUtil = require("./utils/commonUtil");
|
|
23
23
|
var _treeUtil = require("./utils/treeUtil");
|
|
24
|
-
var _warningPropsUtil =
|
|
24
|
+
var _warningPropsUtil = require("./utils/warningPropsUtil");
|
|
25
25
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
26
26
|
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; }
|
|
27
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -48,15 +48,12 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
48
48
|
expandTrigger,
|
|
49
49
|
// Options
|
|
50
50
|
options,
|
|
51
|
-
|
|
51
|
+
popupPrefixCls,
|
|
52
52
|
loadData,
|
|
53
|
-
// Open
|
|
54
|
-
popupVisible,
|
|
55
53
|
open,
|
|
56
54
|
popupClassName,
|
|
57
|
-
|
|
55
|
+
popupMenuColumnStyle,
|
|
58
56
|
popupStyle: customPopupStyle,
|
|
59
|
-
popupPlacement,
|
|
60
57
|
placement,
|
|
61
58
|
onPopupVisibleChange,
|
|
62
59
|
// Icon
|
|
@@ -98,7 +95,7 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
98
95
|
}
|
|
99
96
|
};
|
|
100
97
|
const [mergedShowSearch, searchConfig] = (0, _useSearchConfig.default)(showSearch);
|
|
101
|
-
const searchOptions = (0, _useSearchOptions.default)(mergedSearchValue, mergedOptions, mergedFieldNames,
|
|
98
|
+
const searchOptions = (0, _useSearchOptions.default)(mergedSearchValue, mergedOptions, mergedFieldNames, popupPrefixCls || prefixCls, searchConfig, changeOnSelect || multiple);
|
|
102
99
|
|
|
103
100
|
// =========================== Values ===========================
|
|
104
101
|
const getMissingValues = (0, _useMissingValues.default)(mergedOptions, mergedFieldNames);
|
|
@@ -148,17 +145,12 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
148
145
|
} = info.values[0];
|
|
149
146
|
onInternalSelect(valueCells);
|
|
150
147
|
};
|
|
151
|
-
|
|
152
|
-
// ============================ Open ============================
|
|
153
|
-
const mergedOpen = open !== undefined ? open : popupVisible;
|
|
154
|
-
const mergedPlacement = placement || popupPlacement;
|
|
155
148
|
const onInternalPopupVisibleChange = nextVisible => {
|
|
156
149
|
onPopupVisibleChange?.(nextVisible);
|
|
157
150
|
};
|
|
158
151
|
|
|
159
152
|
// ========================== Warning ===========================
|
|
160
153
|
if (process.env.NODE_ENV !== 'production') {
|
|
161
|
-
(0, _warningPropsUtil.default)(props);
|
|
162
154
|
(0, _warningPropsUtil.warningNullOptions)(mergedOptions, mergedFieldNames);
|
|
163
155
|
}
|
|
164
156
|
|
|
@@ -172,14 +164,14 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
172
164
|
onSelect: onInternalSelect,
|
|
173
165
|
checkable,
|
|
174
166
|
searchOptions,
|
|
175
|
-
|
|
167
|
+
popupPrefixCls,
|
|
176
168
|
loadData,
|
|
177
169
|
expandTrigger,
|
|
178
170
|
expandIcon,
|
|
179
171
|
loadingIcon,
|
|
180
|
-
|
|
172
|
+
popupMenuColumnStyle,
|
|
181
173
|
optionRender
|
|
182
|
-
}), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions,
|
|
174
|
+
}), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, popupPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, popupMenuColumnStyle, optionRender]);
|
|
183
175
|
|
|
184
176
|
// ==============================================================
|
|
185
177
|
// == Render ==
|
|
@@ -221,9 +213,9 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
221
213
|
emptyOptions: emptyOptions
|
|
222
214
|
// Open
|
|
223
215
|
,
|
|
224
|
-
open:
|
|
216
|
+
open: open,
|
|
225
217
|
popupClassName: popupClassName,
|
|
226
|
-
placement:
|
|
218
|
+
placement: placement,
|
|
227
219
|
onPopupVisibleChange: onInternalPopupVisibleChange
|
|
228
220
|
// Children
|
|
229
221
|
,
|
|
@@ -3,5 +3,5 @@ export interface CacheContentProps {
|
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
open?: boolean;
|
|
5
5
|
}
|
|
6
|
-
declare const CacheContent: React.MemoExoticComponent<({ children }: CacheContentProps) => React.ReactElement<
|
|
6
|
+
declare const CacheContent: React.MemoExoticComponent<({ children }: CacheContentProps) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>>>;
|
|
7
7
|
export default CacheContent;
|
package/lib/OptionList/Column.js
CHANGED
|
@@ -32,13 +32,14 @@ function Column({
|
|
|
32
32
|
}) {
|
|
33
33
|
const menuPrefixCls = `${prefixCls}-menu`;
|
|
34
34
|
const menuItemPrefixCls = `${prefixCls}-menu-item`;
|
|
35
|
+
const menuRef = React.useRef(null);
|
|
35
36
|
const {
|
|
36
37
|
fieldNames,
|
|
37
38
|
changeOnSelect,
|
|
38
39
|
expandTrigger,
|
|
39
40
|
expandIcon,
|
|
40
41
|
loadingIcon,
|
|
41
|
-
|
|
42
|
+
popupMenuColumnStyle,
|
|
42
43
|
optionRender
|
|
43
44
|
} = React.useContext(_context.default);
|
|
44
45
|
const hoverOpen = expandTrigger === 'hover';
|
|
@@ -79,10 +80,23 @@ function Column({
|
|
|
79
80
|
fullPathKey
|
|
80
81
|
};
|
|
81
82
|
}), [options, checkedSet, fieldNames, halfCheckedSet, loadingKeys, prevValuePath]);
|
|
83
|
+
React.useEffect(() => {
|
|
84
|
+
if (menuRef.current) {
|
|
85
|
+
const selector = `.${menuItemPrefixCls}-active`;
|
|
86
|
+
const activeElement = menuRef.current.querySelector(selector);
|
|
87
|
+
if (activeElement) {
|
|
88
|
+
activeElement.scrollIntoView({
|
|
89
|
+
block: 'nearest',
|
|
90
|
+
inline: 'nearest'
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, [activeValue, menuItemPrefixCls]);
|
|
82
95
|
|
|
83
96
|
// ============================ Render ============================
|
|
84
97
|
return /*#__PURE__*/React.createElement("ul", {
|
|
85
98
|
className: menuPrefixCls,
|
|
99
|
+
ref: menuRef,
|
|
86
100
|
role: "menu"
|
|
87
101
|
}, optionInfoList.map(({
|
|
88
102
|
disabled,
|
|
@@ -133,7 +147,7 @@ function Column({
|
|
|
133
147
|
[`${menuItemPrefixCls}-disabled`]: isOptionDisabled(disabled),
|
|
134
148
|
[`${menuItemPrefixCls}-loading`]: isLoading
|
|
135
149
|
}),
|
|
136
|
-
style:
|
|
150
|
+
style: popupMenuColumnStyle,
|
|
137
151
|
role: "menuitemcheckbox",
|
|
138
152
|
title: title,
|
|
139
153
|
"aria-checked": checked,
|
package/lib/OptionList/List.js
CHANGED
|
@@ -38,11 +38,11 @@ const RawOptionList = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
38
38
|
changeOnSelect,
|
|
39
39
|
onSelect,
|
|
40
40
|
searchOptions,
|
|
41
|
-
|
|
41
|
+
popupPrefixCls,
|
|
42
42
|
loadData,
|
|
43
43
|
expandTrigger
|
|
44
44
|
} = React.useContext(_context.default);
|
|
45
|
-
const mergedPrefixCls =
|
|
45
|
+
const mergedPrefixCls = popupPrefixCls || prefixCls;
|
|
46
46
|
|
|
47
47
|
// ========================= loadData =========================
|
|
48
48
|
const [loadingKeys, setLoadingKeys] = React.useState([]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LegacyKey } from "../Cascader";
|
|
2
2
|
/**
|
|
3
3
|
* Control the active open options path.
|
|
4
4
|
*/
|
|
5
|
-
declare const useActive: (multiple?: boolean, open?: boolean) => [
|
|
5
|
+
declare const useActive: (multiple?: boolean, open?: boolean) => [LegacyKey[], (activeValueCells: LegacyKey[]) => void];
|
|
6
6
|
export default useActive;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RefOptionListProps } from '@rc-component/select/lib/OptionList';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import type { DefaultOptionType, InternalFieldNames, SingleValueType } from '../Cascader';
|
|
4
|
-
declare const _default: (ref: React.Ref<RefOptionListProps>, options: DefaultOptionType[], fieldNames: InternalFieldNames, activeValueCells:
|
|
3
|
+
import type { DefaultOptionType, InternalFieldNames, LegacyKey, SingleValueType } from '../Cascader';
|
|
4
|
+
declare const _default: (ref: React.Ref<RefOptionListProps>, options: DefaultOptionType[], fieldNames: InternalFieldNames, activeValueCells: LegacyKey[], setActiveValueCells: (activeValueCells: LegacyKey[]) => void, onKeyBoardSelect: (valueCells: SingleValueType, option: DefaultOptionType) => void, contextProps: {
|
|
5
5
|
direction?: "ltr" | "rtl" | undefined;
|
|
6
6
|
searchValue: string;
|
|
7
7
|
toggleOpen: (open?: boolean) => void;
|
package/lib/Panel.js
CHANGED
|
@@ -94,12 +94,12 @@ function Panel(props) {
|
|
|
94
94
|
onSelect: onInternalSelect,
|
|
95
95
|
checkable,
|
|
96
96
|
searchOptions: [],
|
|
97
|
-
|
|
97
|
+
popupPrefixCls: undefined,
|
|
98
98
|
loadData,
|
|
99
99
|
expandTrigger,
|
|
100
100
|
expandIcon,
|
|
101
101
|
loadingIcon,
|
|
102
|
-
|
|
102
|
+
popupMenuColumnStyle: undefined
|
|
103
103
|
}), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, loadData, expandTrigger, expandIcon, loadingIcon]);
|
|
104
104
|
|
|
105
105
|
// ========================= Render =========================
|
package/lib/context.d.ts
CHANGED
|
@@ -9,12 +9,12 @@ export interface CascaderContextProps {
|
|
|
9
9
|
onSelect: (valuePath: SingleValueType) => void;
|
|
10
10
|
checkable?: boolean | React.ReactNode;
|
|
11
11
|
searchOptions: DefaultOptionType[];
|
|
12
|
-
|
|
12
|
+
popupPrefixCls?: string;
|
|
13
13
|
loadData?: (selectOptions: DefaultOptionType[]) => void;
|
|
14
14
|
expandTrigger?: 'hover' | 'click';
|
|
15
15
|
expandIcon?: React.ReactNode;
|
|
16
16
|
loadingIcon?: React.ReactNode;
|
|
17
|
-
|
|
17
|
+
popupMenuColumnStyle?: React.CSSProperties;
|
|
18
18
|
optionRender?: CascaderProps['optionRender'];
|
|
19
19
|
}
|
|
20
20
|
declare const CascaderContext: React.Context<CascaderContextProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DefaultOptionType, InternalFieldNames } from '../Cascader';
|
|
2
|
-
import type { DataEntity } from 'rc-tree/lib/interface';
|
|
2
|
+
import type { DataEntity } from '@rc-component/tree/lib/interface';
|
|
3
3
|
export interface OptionsInfo {
|
|
4
4
|
keyEntities: Record<string, DataEntity>;
|
|
5
5
|
pathKeyEntities: Record<string, DataEntity>;
|
package/lib/hooks/useEntities.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _treeUtil = require("rc-tree/lib/utils/treeUtil");
|
|
8
|
+
var _treeUtil = require("@rc-component/tree/lib/utils/treeUtil");
|
|
9
9
|
var _commonUtil = require("../utils/commonUtil");
|
|
10
10
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
11
|
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; }
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import type { DefaultOptionType } from '..';
|
|
3
|
-
import type { InternalFieldNames, SingleValueType } from '../Cascader';
|
|
2
|
+
import type { InternalFieldNames, SingleValueType, LegacyKey } from '../Cascader';
|
|
4
3
|
import { type GetEntities } from './useEntities';
|
|
5
4
|
export default function useOptions(mergedFieldNames: InternalFieldNames, options?: DefaultOptionType[]): [
|
|
6
5
|
mergedOptions: DefaultOptionType[],
|
|
7
6
|
getPathKeyEntities: GetEntities,
|
|
8
|
-
getValueByKeyPath: (pathKeys:
|
|
7
|
+
getValueByKeyPath: (pathKeys: LegacyKey[]) => SingleValueType[]
|
|
9
8
|
];
|
package/lib/hooks/useSelect.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import type { InternalValueType, ShowCheckedStrategy, SingleValueType } from '../Cascader';
|
|
1
|
+
import type { InternalValueType, LegacyKey, ShowCheckedStrategy, SingleValueType } from '../Cascader';
|
|
3
2
|
import type { GetEntities } from './useEntities';
|
|
4
|
-
export default function useSelect(multiple: boolean, triggerChange: (nextValues: InternalValueType) => void, checkedValues: SingleValueType[], halfCheckedValues: SingleValueType[], missingCheckedValues: SingleValueType[], getPathKeyEntities: GetEntities, getValueByKeyPath: (pathKeys:
|
|
3
|
+
export default function useSelect(multiple: boolean, triggerChange: (nextValues: InternalValueType) => void, checkedValues: SingleValueType[], halfCheckedValues: SingleValueType[], missingCheckedValues: SingleValueType[], getPathKeyEntities: GetEntities, getValueByKeyPath: (pathKeys: LegacyKey[]) => SingleValueType[], showCheckedStrategy?: ShowCheckedStrategy): (valuePath: SingleValueType) => void;
|
package/lib/hooks/useSelect.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useSelect;
|
|
7
|
-
var _conductUtil = require("rc-tree/lib/utils/conductUtil");
|
|
7
|
+
var _conductUtil = require("@rc-component/tree/lib/utils/conductUtil");
|
|
8
8
|
var _commonUtil = require("../utils/commonUtil");
|
|
9
9
|
var _treeUtil = require("../utils/treeUtil");
|
|
10
10
|
function useSelect(multiple, triggerChange, checkedValues, halfCheckedValues, missingCheckedValues, getPathKeyEntities, getValueByKeyPath, showCheckedStrategy) {
|
package/lib/hooks/useValues.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { DataEntity } from 'rc-tree/lib/interface';
|
|
2
|
-
import
|
|
3
|
-
import type { SingleValueType } from '../Cascader';
|
|
1
|
+
import type { DataEntity } from '@rc-component/tree/lib/interface';
|
|
2
|
+
import type { LegacyKey, SingleValueType } from '../Cascader';
|
|
4
3
|
import type { GetMissValues } from './useMissingValues';
|
|
5
|
-
export default function useValues(multiple: boolean, rawValues: SingleValueType[], getPathKeyEntities: () => Record<string, DataEntity>, getValueByKeyPath: (pathKeys:
|
|
4
|
+
export default function useValues(multiple: boolean, rawValues: SingleValueType[], getPathKeyEntities: () => Record<string, DataEntity>, getValueByKeyPath: (pathKeys: LegacyKey[]) => SingleValueType[], getMissingValues: GetMissValues): [
|
|
6
5
|
checkedValues: SingleValueType[],
|
|
7
6
|
halfCheckedValues: SingleValueType[],
|
|
8
7
|
missingCheckedValues: SingleValueType[]
|
package/lib/hooks/useValues.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useValues;
|
|
7
|
-
var _conductUtil = require("rc-tree/lib/utils/conductUtil");
|
|
7
|
+
var _conductUtil = require("@rc-component/tree/lib/utils/conductUtil");
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _commonUtil = require("../utils/commonUtil");
|
|
10
10
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
package/lib/utils/treeUtil.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SingleValueType, DefaultOptionType, InternalFieldNames, ShowCheckedStrategy } from '../Cascader';
|
|
1
|
+
import type { SingleValueType, DefaultOptionType, InternalFieldNames, ShowCheckedStrategy, LegacyKey } from '../Cascader';
|
|
3
2
|
import type { GetEntities } from '../hooks/useEntities';
|
|
4
|
-
export declare function formatStrategyValues(pathKeys:
|
|
3
|
+
export declare function formatStrategyValues(pathKeys: LegacyKey[], getKeyPathEntities: GetEntities, showCheckedStrategy?: ShowCheckedStrategy): LegacyKey[];
|
|
5
4
|
export declare function toPathOptions(valueCells: SingleValueType, options: DefaultOptionType[], fieldNames: InternalFieldNames, stringMode?: boolean): {
|
|
6
5
|
value: SingleValueType[number];
|
|
7
6
|
index: number;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import type { DefaultOptionType, FieldNames
|
|
2
|
-
declare function warningProps(props: InternalCascaderProps): void;
|
|
1
|
+
import type { DefaultOptionType, FieldNames } from '../Cascader';
|
|
3
2
|
export declare function warningNullOptions(options: DefaultOptionType[], fieldNames: FieldNames): void;
|
|
4
|
-
export default warningProps;
|
|
@@ -3,19 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
7
6
|
exports.warningNullOptions = warningNullOptions;
|
|
8
7
|
var _warning = _interopRequireDefault(require("@rc-component/util/lib/warning"));
|
|
9
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
function warningProps(props) {
|
|
11
|
-
const {
|
|
12
|
-
popupVisible,
|
|
13
|
-
popupPlacement
|
|
14
|
-
} = props;
|
|
15
|
-
(0, _warning.default)(popupVisible === undefined, '`popupVisible` is deprecated. Please use `open` instead.');
|
|
16
|
-
(0, _warning.default)(popupPlacement === undefined, '`popupPlacement` is deprecated. Please use `placement` instead.');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
9
|
// value in Cascader options should not be null
|
|
20
10
|
function warningNullOptions(options, fieldNames) {
|
|
21
11
|
if (options) {
|
|
@@ -33,5 +23,4 @@ function warningNullOptions(options, fieldNames) {
|
|
|
33
23
|
};
|
|
34
24
|
recursiveOptions(options);
|
|
35
25
|
}
|
|
36
|
-
}
|
|
37
|
-
var _default = exports.default = warningProps;
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rc-component/cascader",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "cascade select ui component for react",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"build": "dumi build",
|
|
34
34
|
"compile": "father build",
|
|
35
35
|
"coverage": "father test --coverage",
|
|
36
|
+
"tsc": "bunx tsc --noEmit",
|
|
36
37
|
"deploy": "UMI_ENV=gh npm run build && gh-pages -d dist",
|
|
37
38
|
"lint": "eslint src/ examples/ --ext .tsx,.ts,.jsx,.jsx",
|
|
38
39
|
"now-build": "npm run build",
|
|
@@ -43,9 +44,9 @@
|
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
46
|
"@rc-component/select": "~1.0.0",
|
|
47
|
+
"@rc-component/tree": "~1.0.0",
|
|
46
48
|
"@rc-component/util": "^1.2.1",
|
|
47
|
-
"classnames": "^2.3.1"
|
|
48
|
-
"rc-tree": "~5.13.1"
|
|
49
|
+
"classnames": "^2.3.1"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@rc-component/father-plugin": "^2.0.2",
|
|
@@ -55,8 +56,8 @@
|
|
|
55
56
|
"@types/classnames": "^2.2.6",
|
|
56
57
|
"@types/enzyme": "^3.1.15",
|
|
57
58
|
"@types/jest": "^29.4.0",
|
|
58
|
-
"@types/react": "^
|
|
59
|
-
"@types/react-dom": "^
|
|
59
|
+
"@types/react": "^19.0.0",
|
|
60
|
+
"@types/react-dom": "^19.0.0",
|
|
60
61
|
"@types/warning": "^3.0.0",
|
|
61
62
|
"@umijs/fabric": "^4.0.0",
|
|
62
63
|
"array-tree-filter": "^3.0.2",
|