Skip to content

Commit eea1e33

Browse files
authored
fix: avoid deep @rc-component input and select imports (ant-design#58119)
* fix: avoid deep @rc-component input and select imports * fix: align rc select dependent versions
1 parent 4e1eb5b commit eea1e33

6 files changed

Lines changed: 13 additions & 15 deletions

File tree

components/_util/hooks/useAllowClear.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useMemo } from 'react';
22
import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled';
3-
import type { BaseInputProps } from '@rc-component/input/lib/interface';
3+
import type { BaseInputProps } from '@rc-component/input';
44

55
import fallbackProp from '../fallbackProp';
66
import { isPlainObject } from '../is';

components/cascader/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type {
77
SearchConfig,
88
} from '@rc-component/cascader';
99
import RcCascader from '@rc-component/cascader';
10-
import type { Placement } from '@rc-component/select/lib/BaseSelect';
1110
import { omit } from '@rc-component/util';
1211
import { clsx } from 'clsx';
1312

@@ -390,7 +389,7 @@ const Cascader = React.forwardRef<CascaderRef, CascaderProps<any>>((props, ref)
390389
});
391390

392391
// ===================== Placement =====================
393-
const memoPlacement = React.useMemo<Placement>(() => {
392+
const memoPlacement = React.useMemo<SelectCommonPlacement>(() => {
394393
if (placement !== undefined) {
395394
return placement;
396395
}

components/pagination/__tests__/index.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
import type { OptionFC } from '@rc-component/select/lib/Option';
32

43
import type { PaginationProps } from '..';
54
import Pagination from '..';
@@ -58,7 +57,7 @@ describe('Pagination', () => {
5857
it('should support custom selectComponentClass', () => {
5958
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
6059

61-
const CustomSelect: React.FC<{ className?: string }> & { Option: OptionFC } = ({
60+
const CustomSelect: React.FC<{ className?: string }> & { Option: typeof Select.Option } = ({
6261
className,
6362
...props
6463
}) => <Select className={`${className} custom-select`} {...props} />;

components/select/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// TODO: 4.0 - codemod should help to change `filterOption` to support node props.
22
import * as React from 'react';
3-
import type { BaseSelectRef, SelectProps as RcSelectProps } from '@rc-component/select';
4-
import RcSelect, { OptGroup, Option } from '@rc-component/select';
5-
import type { OptionProps } from '@rc-component/select/lib/Option';
63
import type {
74
BaseOptionType,
5+
BaseSelectRef,
86
DefaultOptionType,
7+
OptionProps,
8+
SelectProps as RcSelectProps,
99
SearchConfig,
10-
} from '@rc-component/select/lib/Select';
10+
} from '@rc-component/select';
11+
import RcSelect, { OptGroup, Option } from '@rc-component/select';
1112
import { omit } from '@rc-component/util';
1213
import { clsx } from 'clsx';
1314

components/tree-select/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from 'react';
22
import type { BaseSelectRef } from '@rc-component/select';
3-
import type { Placement } from '@rc-component/select/lib/BaseSelect';
43
import type { TreeSelectProps as RcTreeSelectProps } from '@rc-component/tree-select';
54
import RcTreeSelect, {
65
SHOW_ALL,
@@ -369,7 +368,7 @@ const InternalTreeSelect: InternalTreeSelectRef = (props, ref) => {
369368
const selectProps = omit(restProps, ['suffixIcon', 'removeIcon', 'clearIcon']);
370369

371370
// ===================== Placement =====================
372-
const memoizedPlacement = React.useMemo<Placement>(() => {
371+
const memoizedPlacement = React.useMemo<SelectCommonPlacement>(() => {
373372
if (placement !== undefined) {
374373
return placement;
375374
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"@ant-design/icons": "^6.2.3",
115115
"@ant-design/react-slick": "~2.0.0",
116116
"@babel/runtime": "^7.29.2",
117-
"@rc-component/cascader": "~1.15.0",
117+
"@rc-component/cascader": "~1.16.0",
118118
"@rc-component/checkbox": "~2.0.0",
119119
"@rc-component/collapse": "~1.2.0",
120120
"@rc-component/color-picker": "~3.1.1",
@@ -123,7 +123,7 @@
123123
"@rc-component/dropdown": "~1.0.2",
124124
"@rc-component/form": "~1.8.1",
125125
"@rc-component/image": "~1.9.0",
126-
"@rc-component/input": "~1.3.0",
126+
"@rc-component/input": "~1.3.1",
127127
"@rc-component/input-number": "~1.6.2",
128128
"@rc-component/mentions": "~1.9.0",
129129
"@rc-component/menu": "~1.3.0",
@@ -137,7 +137,7 @@
137137
"@rc-component/rate": "~1.0.1",
138138
"@rc-component/resize-observer": "^1.1.2",
139139
"@rc-component/segmented": "~1.3.0",
140-
"@rc-component/select": "~1.6.15",
140+
"@rc-component/select": "~1.7.1",
141141
"@rc-component/slider": "~1.0.1",
142142
"@rc-component/steps": "~1.2.2",
143143
"@rc-component/switch": "~1.0.3",
@@ -146,7 +146,7 @@
146146
"@rc-component/tooltip": "~1.4.0",
147147
"@rc-component/tour": "~2.4.0",
148148
"@rc-component/tree": "~1.3.1",
149-
"@rc-component/tree-select": "~1.9.0",
149+
"@rc-component/tree-select": "~1.10.0",
150150
"@rc-component/trigger": "^3.9.0",
151151
"@rc-component/upload": "~1.1.0",
152152
"@rc-component/util": "^1.11.1",

0 commit comments

Comments
 (0)