Skip to content

Commit c1ca588

Browse files
authored
Merge branch 'master' into fix/search-cause-all-load-data
2 parents 91d4cac + 3b919b5 commit c1ca588

19 files changed

+253
-423
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,3 @@ updates:
44
directory: "/"
55
schedule:
66
interval: daily
7-
time: "21:00"
8-
open-pull-requests-limit: 10
9-
ignore:
10-
- dependency-name: rc-trigger
11-
versions:
12-
- 5.2.1
13-
- 5.2.2
14-
- 5.2.3
15-
- 5.2.4
16-
- 5.2.5
17-
- dependency-name: "@types/react"
18-
versions:
19-
- 17.0.0
20-
- 17.0.1
21-
- 17.0.2
22-
- 17.0.3
23-
- dependency-name: np
24-
versions:
25-
- 7.2.0
26-
- 7.3.0
27-
- 7.4.0
28-
- dependency-name: "@types/react-dom"
29-
versions:
30-
- 17.0.0
31-
- 17.0.1
32-
- 17.0.2
33-
- dependency-name: typescript
34-
versions:
35-
- 4.1.3
36-
- 4.1.4
37-
- 4.1.5
38-
- 4.2.2
39-
- 4.2.3
40-
- dependency-name: react
41-
versions:
42-
- 17.0.1
43-
- dependency-name: rc-dialog
44-
versions:
45-
- 8.5.1
46-
- dependency-name: react-dom
47-
versions:
48-
- 17.0.0

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ node_modules
2323
dist
2424
*.css
2525
build
26-
lib/*
26+
lib
2727
coverage
2828
yarn.lock
2929
package-lock.json
30-
es/*
30+
es
3131
# dumi
3232
.dumi/tmp
3333
.dumi/tmp-test

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lint-staged

examples/form.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const errorStyle = {
2121
};
2222

2323
class TreeSelectInput extends Component<{
24-
onChange?: Function;
24+
onChange?: (value: string[]) => void;
2525
style: React.CSSProperties;
2626
}> {
2727
onChange = (value, ...args) => {
@@ -105,11 +105,7 @@ const Demo = () => {
105105
>
106106
{(control, { errors }) => (
107107
<div>
108-
<TreeSelectInput
109-
{...tProps}
110-
{...control}
111-
style={{ width: 300 }}
112-
/>
108+
<TreeSelectInput {...tProps} {...control} style={{ width: 300 }} />
113109

114110
<p style={errorStyle}>{errors.join(',')}</p>
115111
</div>
@@ -122,18 +118,11 @@ const Demo = () => {
122118
<div>
123119
<Field
124120
name="select"
125-
rules={[
126-
{ required: true, type: 'array', message: 'select 需要必填' },
127-
]}
121+
rules={[{ required: true, type: 'array', message: 'select 需要必填' }]}
128122
>
129123
{(control, { errors }) => (
130124
<div>
131-
<Select
132-
style={{ width: 200 }}
133-
{...control}
134-
allowClear
135-
mode="multiple"
136-
>
125+
<Select style={{ width: 200 }} {...control} allowClear mode="multiple">
137126
<Option value="jack">jack</Option>
138127
<Option value="lucy">lucy</Option>
139128
<Option value="disabled" disabled>

examples/utils/big-data-generator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { generateData, calcTotal } from './dataUtil';
33

44
interface GenProps {
5-
onGen: Function;
5+
onGen: (data: any[]) => void;
66
x: number;
77
y: number;
88
z: number;

package.json

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rc-tree-select",
3-
"version": "5.23.0",
3+
"version": "5.24.1",
44
"description": "tree-select ui component for react",
55
"keywords": [
66
"react",
@@ -34,49 +34,54 @@
3434
"compile": "father build",
3535
"lint": "eslint src/ examples/ --ext .tsx,.ts,.jsx,.js",
3636
"now-build": "npm run build",
37-
"prepare": "dumi setup",
37+
"prepare": "husky && dumi setup",
3838
"prepublishOnly": "npm run compile && np --yolo --no-publish --any-branch",
3939
"prettier": "prettier '{src,tests}/**/*.{ts,tsx}' 'tests/**/*.js' --write",
4040
"start": "dumi dev",
4141
"test": "rc-test"
4242
},
43+
"lint-staged": {
44+
"*": "prettier --write --ignore-unknown"
45+
},
4346
"dependencies": {
44-
"@babel/runtime": "^7.10.1",
47+
"@babel/runtime": "^7.25.7",
4548
"classnames": "2.x",
46-
"rc-select": "~14.15.0",
47-
"rc-tree": "~5.9.0",
48-
"rc-util": "^5.16.1"
49+
"rc-select": "~14.15.2",
50+
"rc-tree": "~5.10.1",
51+
"rc-util": "^5.43.0"
4952
},
5053
"devDependencies": {
51-
"@rc-component/father-plugin": "^1.0.0",
52-
"@rc-component/trigger": "^1.5.0",
53-
"@testing-library/react": "^12.0.0",
54-
"@types/jest": "^29.5.12",
55-
"@types/node": "^20.9.0",
56-
"@types/react": "^16.8.19",
57-
"@types/react-dom": "^18.2.19",
58-
"@types/warning": "^3.0.0",
54+
"@rc-component/father-plugin": "^1.1.0",
55+
"@rc-component/trigger": "^1.18.3",
56+
"@testing-library/react": "^12.1.5",
57+
"@types/jest": "^29.5.13",
58+
"@types/node": "^22.7.5",
59+
"@types/react": "^18.3.11",
60+
"@types/react-dom": "^18.3.1",
61+
"@types/warning": "^3.0.3",
5962
"@umijs/fabric": "^4.0.1",
60-
"cross-env": "^7.0.2",
61-
"dumi": "^2.0.0",
62-
"enzyme": "^3.10.0",
63-
"enzyme-adapter-react-16": "^1.1.1",
64-
"enzyme-to-json": "^3.4.0",
65-
"eslint": "^8.56.0",
66-
"eslint-plugin-jest": "^27.6.0",
67-
"eslint-plugin-unicorn": "^52.0.0",
68-
"father": "^4.0.0",
69-
"glob": "^7.1.6",
70-
"np": "^10.0.5",
71-
"prettier": "^3.1.1",
72-
"rc-dialog": "^7.5.7",
73-
"rc-field-form": "^2.0.0",
74-
"rc-test": "^7.0.4",
75-
"rc-virtual-list": "^3.0.0",
76-
"react": "^16.8.0",
77-
"react-dom": "^16.8.0",
78-
"typescript": "^5.0.0",
79-
"cheerio": "1.0.0-rc.12"
63+
"cheerio": "1.0.0-rc.12",
64+
"cross-env": "^7.0.3",
65+
"dumi": "^2.4.12",
66+
"enzyme": "^3.11.0",
67+
"enzyme-adapter-react-16": "^1.15.8",
68+
"enzyme-to-json": "^3.6.2",
69+
"eslint": "^8.57.1",
70+
"eslint-plugin-jest": "^27.9.0",
71+
"eslint-plugin-unicorn": "^56.0.0",
72+
"father": "^4.5.0",
73+
"glob": "^11.0.0",
74+
"husky": "^9.1.6",
75+
"lint-staged": "^15.2.10",
76+
"np": "^10.0.7",
77+
"prettier": "^3.3.3",
78+
"rc-dialog": "^9.6.0",
79+
"rc-field-form": "^2.4.0",
80+
"rc-test": "^7.1.1",
81+
"rc-virtual-list": "^3.14.8",
82+
"react": "^16.0.0",
83+
"react-dom": "^16.0.0",
84+
"typescript": "^5.6.3"
8085
},
8186
"peerDependencies": {
8287
"react": "*",

src/LegacyContext.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import type { DataEntity, IconType } from 'rc-tree/lib/interface';
3-
import type { Key, LegacyDataNode, RawValueType } from './interface';
3+
import type { LegacyDataNode, SafeKey, Key } from './interface';
44

55
interface LegacyContextProps {
66
checkable: boolean | React.ReactNode;
@@ -20,7 +20,7 @@ interface LegacyContextProps {
2020
loadData: (treeNode: LegacyDataNode) => Promise<unknown>;
2121
onTreeLoad: (loadedKeys: Key[]) => void;
2222

23-
keyEntities: Record<RawValueType, DataEntity<any>>;
23+
keyEntities: Record<SafeKey, DataEntity<any>>;
2424
}
2525

2626
const LegacySelectContext = React.createContext<LegacyContextProps>(null);

src/OptionList.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import useMemo from 'rc-util/lib/hooks/useMemo';
88
import * as React from 'react';
99
import LegacyContext from './LegacyContext';
1010
import TreeSelectContext from './TreeSelectContext';
11-
import type { Key, TreeDataNode } from './interface';
11+
import type { Key, SafeKey } from './interface';
1212
import { getAllKeys, isCheckDisabled } from './utils/valueUtil';
1313

1414
const HIDDEN_STYLE = {
@@ -78,7 +78,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
7878

7979
// ========================== Active ==========================
8080
const [activeKey, setActiveKey] = React.useState<Key>(null);
81-
const activeEntity = keyEntities[activeKey];
81+
const activeEntity = keyEntities[activeKey as SafeKey];
8282

8383
// ========================== Values ==========================
8484
const mergedCheckedKeys = React.useMemo(() => {
@@ -143,7 +143,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
143143
event.preventDefault();
144144
};
145145

146-
const onInternalSelect = (__: React.Key[], info: TreeEventInfo) => {
146+
const onInternalSelect = (__: Key[], info: TreeEventInfo) => {
147147
const { node } = info;
148148

149149
if (checkable && isCheckDisabled(node)) {
@@ -237,7 +237,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
237237
ref={treeRef}
238238
focusable={false}
239239
prefixCls={`${prefixCls}-tree`}
240-
treeData={memoTreeData as TreeDataNode[]}
240+
treeData={memoTreeData}
241241
height={listHeight}
242242
itemHeight={listItemHeight}
243243
itemScrollOffset={listItemScrollOffset}

0 commit comments

Comments
 (0)