Skip to content

Commit

Permalink
feat: formdrawer支持antd^5.13.0版本,解决footer/extra不显示问题 (#36)
Browse files Browse the repository at this point in the history
Co-authored-by: xuyongchao <xuyongchao@bytedance.com>
  • Loading branch information
over58 and xuyongchao authored Apr 10, 2024
1 parent 8bbcf6d commit dc41909
Show file tree
Hide file tree
Showing 6 changed files with 417 additions and 272 deletions.
14 changes: 14 additions & 0 deletions docs/components/FormDrawer.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ export default () => {
<Reset>Reset</Reset>
</FormButtonGroup>
</FormDrawer.Extra>
<FormDrawer.Footer>
<FormButtonGroup align="right">
<Submit
onSubmit={() => {
return new Promise((resolve) => {
setTimeout(resolve, 1000)
})
}}
>
Submit
</Submit>
<Reset>Reset</Reset>
</FormButtonGroup>
</FormDrawer.Footer>
</FormLayout>
)
})
Expand Down
14 changes: 14 additions & 0 deletions docs/components/FormDrawer.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ export default () => {
<Reset>重置</Reset>
</FormButtonGroup>
</FormDrawer.Extra>
<FormDrawer.Footer>
<FormButtonGroup align="right">
<Submit
onSubmit={() => {
return new Promise((resolve) => {
setTimeout(resolve, 1000)
})
}}
>
Submit
</Submit>
<Reset>Reset</Reset>
</FormButtonGroup>
</FormDrawer.Footer>
</FormLayout>
)
})
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@types/react-dom": "^18.0.9",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"antd": "^5.4.0",
"antd": "^5.13.0",
"cross-env": "^7.0.3",
"dumi": "^1.1.0",
"eslint": "^8.28.0",
Expand Down Expand Up @@ -94,4 +94,4 @@
"ts-node": "^10.9.1",
"typescript": "^4.1.5"
}
}
}
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"peerDependencies": {
"@types/react": ">=16.8.0 || >=17.0.0",
"@types/react-dom": ">=16.8.0 || >=17.0.0",
"antd": "^5.1.0",
"antd": "^5.13.0",
"react": ">=16.8.0 || >=17.0.0",
"react-dom": ">=16.8.0",
"react-is": ">=16.8.0 || >=17.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/form-drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const DrawerExtra: ReactFC = (props) => {
const prefixCls = usePrefixCls('drawer')
useLayoutEffect(() => {
const content = ref.current
?.closest(`.${prefixCls}-wrapper-body`)
?.closest(`.${prefixCls}-content`)
?.querySelector(`.${prefixCls}-header`)
if (content) {
if (!extraRef.current) {
Expand Down Expand Up @@ -211,7 +211,7 @@ const DrawerFooter: ReactFC = (props) => {
const footerRef = useRef<HTMLDivElement>()
const prefixCls = usePrefixCls('drawer')
useLayoutEffect(() => {
const content = ref.current?.closest(`.${prefixCls}-wrapper-body`)
const content = ref.current?.closest(`.${prefixCls}-content`)
if (content) {
if (!footerRef.current) {
footerRef.current = content.querySelector(
Expand Down
Loading

0 comments on commit dc41909

Please sign in to comment.