Skip to content

Commit 9ffd1f0

Browse files
authored
chore: bump @rc-component deps (#631)
* chore: bump deps * test: fix test case * test: lint * chore: rm now file * chore: fix lint * fix: depreacted api * fix: lint * chore: clean up
1 parent 1867fce commit 9ffd1f0

24 files changed

+379
-215
lines changed

README.md

+52-52
Large diffs are not rendered by default.

assets/select.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
@import '~rc-select/assets/index';
1+
@import '~@rc-component/select/assets/index';
22

33
@select-prefix: ~'rc-tree-select';

examples/basic.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class Demo extends React.Component {
124124
console.log(args);
125125
};
126126

127-
onDropdownVisibleChange = visible => {
127+
onPopupVisibleChange = visible => {
128128
const { value } = this.state;
129129
console.log(visible, value);
130130
if (Array.isArray(value) && value.length > 1 && value.length < 3) {
@@ -205,8 +205,8 @@ class Demo extends React.Component {
205205
console.log('onChange', val, ...args);
206206
this.setState({ value: val });
207207
}}
208-
onDropdownVisibleChange={v => {
209-
console.log('single onDropdownVisibleChange', v);
208+
onPopupVisibleChange={v => {
209+
console.log('single onPopupVisibleChange', v);
210210
this.setState({
211211
tsOpen: v,
212212
});
@@ -259,11 +259,11 @@ class Demo extends React.Component {
259259
choiceTransitionName="rc-tree-select-selection__choice-zoom"
260260
style={{ width: 300 }}
261261
// dropdownStyle={{ height: 200, overflow: 'auto' }}
262-
dropdownAlign={{
262+
popupAlign={{
263263
overflow: { adjustY: 0, adjustX: 0 },
264264
offset: [0, 2],
265265
}}
266-
onDropdownVisibleChange={this.onDropdownVisibleChange}
266+
onPopupVisibleChange={this.onPopupVisibleChange}
267267
placeholder={<i>请下拉选择</i>}
268268
treeLine
269269
maxTagTextLength={10}
@@ -327,7 +327,7 @@ class Demo extends React.Component {
327327
<h2>Testing in extreme conditions (Boundary conditions test) </h2>
328328
<TreeSelect
329329
style={{ width: 200 }}
330-
dropdownStyle={{ maxHeight: 200, overflow: 'auto' }}
330+
popupStyle={{ maxHeight: 200, overflow: 'auto' }}
331331
defaultValue="leaf1"
332332
multiple
333333
treeCheckable

examples/custom-icons.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function Demo() {
8686
placeholder={<span>Please Select</span>}
8787
transitionName="rc-tree-select-dropdown-slide-up"
8888
style={{ width: 300 }}
89-
dropdownStyle={{ maxHeight: 200, overflow: 'auto', zIndex: 1500 }}
89+
popupStyle={{ maxHeight: 200, overflow: 'auto', zIndex: 1500 }}
9090
showSearch
9191
allowClear
9292
{...iconProps}
@@ -99,7 +99,7 @@ function Demo() {
9999
placeholder={<span>Please Select</span>}
100100
transitionName="rc-tree-select-dropdown-slide-up"
101101
style={{ width: 300 }}
102-
dropdownStyle={{ maxHeight: 200, overflow: 'auto', zIndex: 1500 }}
102+
popupStyle={{ maxHeight: 200, overflow: 'auto', zIndex: 1500 }}
103103
showSearch
104104
allowClear
105105
{...iconPropsFunction}

examples/filter.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Demo extends React.Component {
8282
<h2>use treeDataSimpleMode</h2>
8383
<TreeSelect
8484
style={{ width: 300 }}
85-
dropdownStyle={{ maxHeight: 200, overflow: 'auto' }}
85+
popupStyle={{ maxHeight: 200, overflow: 'auto' }}
8686
placeholder={<i>请下拉选择</i>}
8787
treeLine
8888
maxTagTextLength={10}

examples/form.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { Component } from 'react';
2-
import Select from 'rc-select';
2+
import Select from '@rc-component/select';
33
import Form, { useForm, Field } from 'rc-field-form';
44
import TreeSelect from '../src';
5-
import 'rc-select/assets/index.less';
5+
import '@rc-component/select/assets/index.less';
66
import '../assets/index.less';
77
import { gData } from './utils/dataUtil';
88

examples/width.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import TreeSelect, { TreeNode } from '../src';
44

55
function Demo() {
66
return (
7-
<TreeSelect style={{ width: 120 }} dropdownMatchSelectWidth={false} treeDefaultExpandAll>
7+
<TreeSelect style={{ width: 120 }} popupMatchSelectWidth={false} treeDefaultExpandAll>
88
<TreeNode value="parent 1" title="parent 1">
99
<TreeNode value="parent 1-0 sdfsdfsdsdfsd" title="parent 1-0 sdfsdfsd">
1010
<TreeNode value="leaf1 sdfsdf" title="leaf1" />

now.json

-11
This file was deleted.

package.json

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "rc-tree-select",
3-
"version": "5.27.0",
2+
"name": "@rc-component/tree-select",
3+
"version": "1.0.0",
44
"description": "tree-select ui component for react",
55
"keywords": [
66
"react",
@@ -35,7 +35,7 @@
3535
"lint": "eslint src/ examples/ --ext .tsx,.ts,.jsx,.js",
3636
"now-build": "npm run build",
3737
"prepare": "husky && dumi setup",
38-
"prepublishOnly": "npm run compile && np --yolo --no-publish --any-branch",
38+
"prepublishOnly": "npm run compile && rc-np",
3939
"prettier": "prettier '{src,tests}/**/*.{ts,tsx}' 'tests/**/*.js' --write",
4040
"start": "dumi dev",
4141
"test": "rc-test"
@@ -44,15 +44,15 @@
4444
"*": "prettier --write --ignore-unknown"
4545
},
4646
"dependencies": {
47-
"@babel/runtime": "^7.25.7",
4847
"classnames": "2.x",
49-
"rc-select": "~14.16.2",
50-
"rc-tree": "~5.13.0",
51-
"rc-util": "^5.43.0"
48+
"@rc-component/select": "~1.0.0",
49+
"rc-tree": "~5.13.1",
50+
"@rc-component/util": "^1.2.1"
5251
},
5352
"devDependencies": {
54-
"@rc-component/father-plugin": "^1.1.0",
55-
"@rc-component/trigger": "^1.18.3",
53+
"@rc-component/father-plugin": "^2.0.2",
54+
"@rc-component/np": "^1.0.3",
55+
"@rc-component/trigger": "^3.0.0",
5656
"@testing-library/react": "^12.1.5",
5757
"@types/jest": "^29.5.13",
5858
"@types/node": "^22.7.5",
@@ -73,7 +73,6 @@
7373
"glob": "^11.0.0",
7474
"husky": "^9.1.6",
7575
"lint-staged": "^15.2.10",
76-
"np": "^10.0.7",
7776
"prettier": "^3.3.3",
7877
"rc-dialog": "^9.6.0",
7978
"rc-field-form": "^2.4.0",

src/OptionList.tsx

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { useBaseProps } from 'rc-select';
2-
import type { RefOptionListProps } from 'rc-select/lib/OptionList';
1+
import { useBaseProps } from '@rc-component/select';
2+
import type { RefOptionListProps } from '@rc-component/select/lib/OptionList';
33
import type { TreeProps } from 'rc-tree';
44
import Tree from 'rc-tree';
55
import { UnstableContext } from 'rc-tree';
66
import type { EventDataNode, ScrollTo } from 'rc-tree/lib/interface';
7-
import KeyCode from 'rc-util/lib/KeyCode';
8-
import useMemo from 'rc-util/lib/hooks/useMemo';
7+
import KeyCode from '@rc-component/util/lib/KeyCode';
8+
import useMemo from '@rc-component/util/lib/hooks/useMemo';
99
import * as React from 'react';
1010
import LegacyContext from './LegacyContext';
1111
import TreeSelectContext from './TreeSelectContext';
1212
import type { DataNode, Key, SafeKey } from './interface';
1313
import { getAllKeys, isCheckDisabled } from './utils/valueUtil';
14-
import { useEvent } from 'rc-util';
14+
import { useEvent } from '@rc-component/util';
1515

1616
const HIDDEN_STYLE = {
1717
width: 0,
@@ -43,7 +43,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
4343
treeData,
4444
fieldNames,
4545
onSelect,
46-
dropdownMatchSelectWidth,
46+
popupMatchSelectWidth,
4747
treeExpandAction,
4848
treeTitleRender,
4949
onPopupScroll,
@@ -263,6 +263,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
263263
}
264264

265265
setActiveKey(nextActiveKey);
266+
// eslint-disable-next-line react-hooks/exhaustive-deps
266267
}, [open, searchValue]);
267268

268269
// ========================= Keyboard =========================
@@ -305,6 +306,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
305306

306307
const hasLoadDataFn = useMemo(
307308
() => (searchValue ? false : true),
309+
// eslint-disable-next-line react-hooks/exhaustive-deps
308310
[searchValue, treeExpandedKeys || expandedKeys],
309311
([preSearchValue], [nextSearchValue, nextExcludeSearchExpandedKeys]) =>
310312
preSearchValue !== nextSearchValue && !!(nextSearchValue || nextExcludeSearchExpandedKeys),
@@ -347,7 +349,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
347349
height={listHeight}
348350
itemHeight={listItemHeight}
349351
itemScrollOffset={listItemScrollOffset}
350-
virtual={virtual !== false && dropdownMatchSelectWidth !== false}
352+
virtual={virtual !== false && popupMatchSelectWidth !== false}
351353
multiple={multiple}
352354
icon={treeIcon}
353355
showIcon={showTreeIcon}

src/TreeSelect.tsx

+15-25
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import type { BaseSelectPropsWithoutPrivate, BaseSelectRef } from 'rc-select';
2-
import { BaseSelect } from 'rc-select';
3-
import useId from 'rc-select/lib/hooks/useId';
1+
import type { BaseSelectPropsWithoutPrivate, BaseSelectRef } from '@rc-component/select';
2+
import { BaseSelect } from '@rc-component/select';
3+
import useId from '@rc-component/select/lib/hooks/useId';
44
import type { IconType } from 'rc-tree/lib/interface';
55
import type { ExpandAction } from 'rc-tree/lib/Tree';
66
import { conductCheck } from 'rc-tree/lib/utils/conductUtil';
7-
import useMergedState from 'rc-util/lib/hooks/useMergedState';
8-
import warning from 'rc-util/lib/warning';
7+
import useMergedState from '@rc-component/util/lib/hooks/useMergedState';
98
import * as React from 'react';
109
import useCache from './hooks/useCache';
1110
import useCheckedKeys from './hooks/useCheckedKeys';
@@ -93,7 +92,7 @@ export interface TreeSelectProps<ValueType = any, OptionType extends DataNode =
9392
listHeight?: number;
9493
listItemHeight?: number;
9594
listItemScrollOffset?: number;
96-
onDropdownVisibleChange?: (open: boolean) => void;
95+
onPopupVisibleChange?: (open: boolean) => void;
9796
treeTitleRender?: (node: OptionType) => React.ReactNode;
9897

9998
// >>> Tree
@@ -163,8 +162,8 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
163162
listItemHeight = 20,
164163
listItemScrollOffset = 0,
165164

166-
onDropdownVisibleChange,
167-
dropdownMatchSelectWidth = true,
165+
onPopupVisibleChange,
166+
popupMatchSelectWidth = true,
168167

169168
// Tree
170169
treeLine,
@@ -582,22 +581,13 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
582581
);
583582

584583
// ========================== Dropdown ==========================
585-
const onInternalDropdownVisibleChange = React.useCallback(
584+
const onInternalPopupVisibleChange = React.useCallback(
586585
(open: boolean) => {
587-
if (onDropdownVisibleChange) {
588-
const legacyParam = {};
589-
590-
Object.defineProperty(legacyParam, 'documentClickClose', {
591-
get() {
592-
warning(false, 'Second param of `onDropdownVisibleChange` has been removed.');
593-
return false;
594-
},
595-
});
596-
597-
(onDropdownVisibleChange as any)(open, legacyParam);
586+
if (onPopupVisibleChange) {
587+
onPopupVisibleChange(open);
598588
}
599589
},
600-
[onDropdownVisibleChange],
590+
[onPopupVisibleChange],
601591
);
602592

603593
// ====================== Display Change ========================
@@ -619,7 +609,7 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
619609
const treeSelectContext = React.useMemo<TreeSelectContextProps>(() => {
620610
return {
621611
virtual,
622-
dropdownMatchSelectWidth,
612+
popupMatchSelectWidth,
623613
listHeight,
624614
listItemHeight,
625615
listItemScrollOffset,
@@ -636,7 +626,7 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
636626
};
637627
}, [
638628
virtual,
639-
dropdownMatchSelectWidth,
629+
popupMatchSelectWidth,
640630
listHeight,
641631
listItemHeight,
642632
listItemScrollOffset,
@@ -716,8 +706,8 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
716706
// >>> Options
717707
OptionList={OptionList}
718708
emptyOptions={!mergedTreeData.length}
719-
onDropdownVisibleChange={onInternalDropdownVisibleChange}
720-
dropdownMatchSelectWidth={dropdownMatchSelectWidth}
709+
onPopupVisibleChange={onInternalPopupVisibleChange}
710+
popupMatchSelectWidth={popupMatchSelectWidth}
721711
/>
722712
</LegacyContext.Provider>
723713
</TreeSelectContext.Provider>

src/TreeSelectContext.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type useDataEntities from './hooks/useDataEntities';
55

66
export interface TreeSelectContextProps {
77
virtual?: boolean;
8-
dropdownMatchSelectWidth?: boolean | number;
8+
popupMatchSelectWidth?: boolean | number;
99
listHeight: number;
1010
listItemHeight: number;
1111
listItemScrollOffset?: number;

src/hooks/useDataEntities.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import { convertDataToEntities } from 'rc-tree/lib/utils/treeUtil';
33
import type { DataEntity } from 'rc-tree/lib/interface';
44
import type { SafeKey, FieldNames } from '../interface';
5-
import warning from 'rc-util/lib/warning';
5+
import warning from '@rc-component/util/lib/warning';
66
import { isNil } from '../utils/valueUtil';
77

88
export default (treeData: any, fieldNames: FieldNames) =>

src/utils/legacyUtil.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
2-
import toArray from 'rc-util/lib/Children/toArray';
3-
import warning from 'rc-util/lib/warning';
2+
import toArray from '@rc-component/util/lib/Children/toArray';
3+
import warning from '@rc-component/util/lib/warning';
44
import type {
55
DataNode,
66
ChangeEventExtra,

src/utils/warningPropsUtil.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import warning from 'rc-util/lib/warning';
1+
import warning from '@rc-component/util/lib/warning';
22
import type { TreeSelectProps } from '../TreeSelect';
33
import { toArray } from './valueUtil';
44

tests/Select.SearchInput.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { useState } from 'react';
33
import { mount } from 'enzyme';
44
import { render, fireEvent } from '@testing-library/react';
55
import TreeSelect, { TreeNode } from '../src';
6-
import KeyCode from 'rc-util/lib/KeyCode';
6+
import KeyCode from '@rc-component/util/lib/KeyCode';
77

88
describe('TreeSelect.SearchInput', () => {
99
it('select item will clean searchInput', () => {

tests/Select.maxCount.spec.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { render, fireEvent, within } from '@testing-library/react';
2-
import KeyCode from 'rc-util/lib/KeyCode';
2+
import KeyCode from '@rc-component/util/lib/KeyCode';
33
import { keyDown, keyUp } from './util';
44
import React from 'react';
55
import TreeSelect from '../src';
@@ -104,7 +104,7 @@ describe('TreeSelect.maxCount', () => {
104104
});
105105

106106
it('should respect maxCount when checking parent node in treeCheckable mode', () => {
107-
const treeData = [
107+
const data = [
108108
{
109109
key: '0',
110110
value: '0',
@@ -120,7 +120,7 @@ describe('TreeSelect.maxCount', () => {
120120
const handleChange = jest.fn();
121121
const { container } = render(
122122
<TreeSelect
123-
treeData={treeData}
123+
treeData={data}
124124
treeCheckable
125125
multiple
126126
maxCount={2}

tests/Select.multiple.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-undef */
22
import { render, fireEvent, within } from '@testing-library/react';
33
import { mount } from 'enzyme';
4-
import KeyCode from 'rc-util/lib/KeyCode';
4+
import KeyCode from '@rc-component/util/lib/KeyCode';
55
import React from 'react';
66
import TreeSelect, { TreeNode } from '../src';
77
import focusTest from './shared/focusTest';

0 commit comments

Comments
 (0)