Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: refactoring to Function Component #514

Merged
merged 64 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
caabba6
test: add example test
Wxh16144 Nov 3, 2023
3e6a388
chore: refactor type
Wxh16144 Nov 3, 2023
f49d4ba
chore: bump deps
Wxh16144 Nov 3, 2023
0834880
chore: replace keycode
Wxh16144 Nov 3, 2023
4cf101a
chore: rename
Wxh16144 Nov 3, 2023
23d3c42
chore: update
Wxh16144 Nov 3, 2023
2f23c25
refactor: Options.tsx CS => FC
Wxh16144 Nov 3, 2023
840d03c
chore: update local typo
Wxh16144 Nov 4, 2023
3b141b6
chore: mark depredcated
Wxh16144 Nov 4, 2023
aa9ef54
test: add debug demo
Wxh16144 Nov 6, 2023
748101d
chore: 001
Wxh16144 Nov 7, 2023
429c1e6
chore: update
Wxh16144 Nov 7, 2023
cea540b
Revert "chore: update"
Wxh16144 Nov 7, 2023
a33c1b8
chore: useless
Wxh16144 Nov 8, 2023
8f2e6a0
Revert "chore: useless"
Wxh16144 Nov 8, 2023
e4624df
test: debug
Wxh16144 Nov 19, 2023
ff75159
feat: update pager
Wxh16144 Nov 19, 2023
b03fd1a
chore: update
Wxh16144 Nov 19, 2023
467b886
chore: update
Wxh16144 Nov 19, 2023
2754b44
test: update demo
Wxh16144 Nov 19, 2023
c97235d
chore: fix bug
Wxh16144 Nov 19, 2023
e105db1
chore: fix
Wxh16144 Nov 19, 2023
0d7714a
fix: warper
Wxh16144 Nov 19, 2023
cc2a61e
fix: next
Wxh16144 Nov 19, 2023
4c6f12b
fix: simple disable next
Wxh16144 Nov 19, 2023
18c90d7
test: update test case
Wxh16144 Nov 19, 2023
d80309c
fix: fix simple bug
Wxh16144 Nov 19, 2023
87a20d4
test: update test case
Wxh16144 Nov 19, 2023
a9e0061
test: update test
Wxh16144 Nov 19, 2023
80f4fb1
test: update
Wxh16144 Nov 19, 2023
29520b7
chore: add debug
Wxh16144 Nov 19, 2023
78f2a40
chore: remove debug console
Wxh16144 Nov 19, 2023
af70335
chore: mark deprecated
Wxh16144 Nov 19, 2023
3cfe938
chore: rename
Wxh16144 Nov 19, 2023
47d058a
chore: remove simple
Wxh16144 Nov 19, 2023
8fcc396
chore: update default export
Wxh16144 Nov 19, 2023
f673fad
chore: remove hooks
Wxh16144 Nov 19, 2023
db552d0
chore: fix compile error
Wxh16144 Nov 19, 2023
25a67aa
fix: readonly warn
Wxh16144 Nov 19, 2023
cf14695
test: add case
Wxh16144 Nov 19, 2023
8be7072
chore: update debug demo
Wxh16144 Nov 19, 2023
3e970f9
fix: onsizeChange
Wxh16144 Nov 20, 2023
1bf070a
chore: update
Wxh16144 Nov 20, 2023
bc382ec
chore: fix TS type
Wxh16144 Nov 20, 2023
cb88add
chore: update snap
Wxh16144 Nov 20, 2023
5df8335
test: add exhaustive testing 😒
Wxh16144 Nov 20, 2023
9f72ed9
chore: update collectCoverageFrom
Wxh16144 Nov 20, 2023
88f8ad9
test: add case
Wxh16144 Nov 20, 2023
80655eb
test: add case
Wxh16144 Nov 20, 2023
f68d858
feat: replace keyPress to keyDown
Wxh16144 Nov 20, 2023
b47880a
chore: update note
Wxh16144 Nov 20, 2023
d606729
test: add case
Wxh16144 Nov 20, 2023
0f3ed84
test: add case
Wxh16144 Nov 20, 2023
c4b45f1
test: add case
Wxh16144 Nov 20, 2023
6ed81de
fix: type
Wxh16144 Nov 20, 2023
6d6c486
chore: update demo
Wxh16144 Nov 20, 2023
85874a0
chore: update coverageFrom
Wxh16144 Nov 20, 2023
115b28e
test: fix bad case
Wxh16144 Nov 20, 2023
01777a2
test: add case
Wxh16144 Nov 27, 2023
54ff9db
chore: update comment & test case
Wxh16144 Nov 27, 2023
ed9dac8
test: add case
Wxh16144 Nov 27, 2023
f0edee4
chore: remove debug
Wxh16144 Nov 27, 2023
8e7e387
test: add case
Wxh16144 Nov 28, 2023
e711387
Update jest.config.js
Wxh16144 Nov 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/demo/debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: 调试用
nav:
title: Debug
path: /debug
group: debug
---

<code src="../examples/_debug.tsx"></code>
53 changes: 53 additions & 0 deletions docs/examples/_debug.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import Select from 'rc-select';
import React from 'react';
import '../../assets/index.less';
import type { PaginationProps } from '../../src/interface';
import Pagination from '../../src/Pagination';
import OriginPagination from '../../src/Pagination_deprecated';

const App = () => {
const [origin, setOrigin] = React.useState(false);
const [all, setAll] = React.useState(false);

const props: PaginationProps = {
selectComponentClass: Select,
showSizeChanger: true,
onShowSizeChange: console.log,
onChange: console.warn,
current: 1,
total: 0,
showTotal: (total, range) => `${range[0]} - ${range[1]} of ${total} items`,
};

const originTip = <span style={{ color: 'red' }}>Origin</span>;
const newTip = <span style={{ color: 'green' }}>New</span>;

return (
<>
<h2>{all ? null : origin ? originTip : newTip}</h2>
{!all && (
<button onClick={() => setOrigin((prev) => !prev)}>
切换为{origin ? 'new' : 'origin'}
</button>
)}
<button onClick={() => setAll((prev) => !prev)}>全量</button>
<hr />
{!all &&
React.createElement(origin ? OriginPagination : Pagination, props)}
{all && (
<>
{originTip}
<br />
<OriginPagination {...props} />
<hr />
{newTip}
<br />
<Pagination {...props} />
</>
)}
</>
);
};

export default App;
// export { default } from '../../tests/two-pagination.jsx'
10 changes: 10 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
const pkg = require('./package.json');
module.exports = {
snapshotSerializers: [require.resolve('enzyme-to-json/serializer')],
moduleNameMapper: {
[pkg.name]: '<rootDir>/src/index.ts',
'\\.less$': 'identity-obj-proxy',
},
collectCoverageFrom: [
'src/**',
'!src/Pagination_deprecated.tsx',
Wxh16144 marked this conversation as resolved.
Show resolved Hide resolved
'!src/locale/**',
],
};
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
},
"dependencies": {
"@babel/runtime": "^7.10.1",
"classnames": "^2.2.1",
"rc-util": "^5.32.2"
"classnames": "^2.3.2",
"rc-util": "^5.38.0"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.0",
Expand All @@ -67,6 +67,7 @@
"gh-pages": "^4.0.0",
"glob": "^7.1.6",
"husky": "^8.0.3",
"identity-obj-proxy": "^3.0.0",
"less": "^3.10.3",
"lint-staged": "^15.0.2",
"np": "^7.0.0",
Expand Down
16 changes: 0 additions & 16 deletions src/KeyCode.ts

This file was deleted.

Loading
Loading