-
-
Notifications
You must be signed in to change notification settings - Fork 329
refactor: refactoring to Function Component #514
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
Merged
MadCcc
merged 64 commits into
react-component:master
from
Wxh16144-forks:wuxh/refactor-FC
Nov 28, 2023
Merged
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 3e6a388
chore: refactor type
Wxh16144 f49d4ba
chore: bump deps
Wxh16144 0834880
chore: replace keycode
Wxh16144 4cf101a
chore: rename
Wxh16144 23d3c42
chore: update
Wxh16144 2f23c25
refactor: Options.tsx CS => FC
Wxh16144 840d03c
chore: update local typo
Wxh16144 3b141b6
chore: mark depredcated
Wxh16144 aa9ef54
test: add debug demo
Wxh16144 748101d
chore: 001
Wxh16144 429c1e6
chore: update
Wxh16144 cea540b
Revert "chore: update"
Wxh16144 a33c1b8
chore: useless
Wxh16144 8f2e6a0
Revert "chore: useless"
Wxh16144 e4624df
test: debug
Wxh16144 ff75159
feat: update pager
Wxh16144 b03fd1a
chore: update
Wxh16144 467b886
chore: update
Wxh16144 2754b44
test: update demo
Wxh16144 c97235d
chore: fix bug
Wxh16144 e105db1
chore: fix
Wxh16144 0d7714a
fix: warper
Wxh16144 cc2a61e
fix: next
Wxh16144 4c6f12b
fix: simple disable next
Wxh16144 18c90d7
test: update test case
Wxh16144 d80309c
fix: fix simple bug
Wxh16144 87a20d4
test: update test case
Wxh16144 a9e0061
test: update test
Wxh16144 80f4fb1
test: update
Wxh16144 29520b7
chore: add debug
Wxh16144 78f2a40
chore: remove debug console
Wxh16144 af70335
chore: mark deprecated
Wxh16144 3cfe938
chore: rename
Wxh16144 47d058a
chore: remove simple
Wxh16144 8fcc396
chore: update default export
Wxh16144 f673fad
chore: remove hooks
Wxh16144 db552d0
chore: fix compile error
Wxh16144 25a67aa
fix: readonly warn
Wxh16144 cf14695
test: add case
Wxh16144 8be7072
chore: update debug demo
Wxh16144 3e970f9
fix: onsizeChange
Wxh16144 1bf070a
chore: update
Wxh16144 bc382ec
chore: fix TS type
Wxh16144 cb88add
chore: update snap
Wxh16144 5df8335
test: add exhaustive testing 😒
Wxh16144 9f72ed9
chore: update collectCoverageFrom
Wxh16144 88f8ad9
test: add case
Wxh16144 80655eb
test: add case
Wxh16144 f68d858
feat: replace keyPress to keyDown
Wxh16144 b47880a
chore: update note
Wxh16144 d606729
test: add case
Wxh16144 0f3ed84
test: add case
Wxh16144 c4b45f1
test: add case
Wxh16144 6ed81de
fix: type
Wxh16144 6d6c486
chore: update demo
Wxh16144 85874a0
chore: update coverageFrom
Wxh16144 115b28e
test: fix bad case
Wxh16144 01777a2
test: add case
Wxh16144 54ff9db
chore: update comment & test case
Wxh16144 ed9dac8
test: add case
Wxh16144 f0edee4
chore: remove debug
Wxh16144 8e7e387
test: add case
Wxh16144 e711387
Update jest.config.js
Wxh16144 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
'!src/locale/**', | ||
], | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.