11import React , { CSSProperties , KeyboardEvent , MouseEvent , useEffect , useState } from 'react' ;
2- import { Tabs } from 'antd' ;
2+ import { Spin , Tabs } from 'antd' ;
33import classNames from 'classnames' ;
44import RcDrawer from 'rc-drawer' ;
55
@@ -17,6 +17,7 @@ type TabKey<T extends readOnlyTab> = T[number]['key'];
1717
1818type TabsSlidePane < T extends readOnlyTab > = {
1919 visible : boolean ;
20+ loading ?: boolean ;
2021 rootClassName ?: string ;
2122 bodyClassName ?: string ;
2223 width ?: number | string ;
@@ -32,6 +33,7 @@ type TabsSlidePane<T extends readOnlyTab> = {
3233
3334type NormalSlidePane = {
3435 visible : boolean ;
36+ loading ?: boolean ;
3537 rootClassName ?: string ;
3638 bodyClassName ?: string ;
3739 width ?: number | string ;
@@ -54,6 +56,7 @@ const SlidePane = <T extends readOnlyTab>(props: SlidePaneProps<T>) => {
5456
5557 const {
5658 visible,
59+ loading = false ,
5760 rootClassName,
5861 bodyClassName,
5962 mask = false ,
@@ -94,23 +97,28 @@ const SlidePane = <T extends readOnlyTab>(props: SlidePaneProps<T>) => {
9497 rootClassName = { rootClassName }
9598 { ...motionProps }
9699 >
97- { ! mask && renderButton ( ) }
98- { title && < div className = { `${ slidePrefixCls } -header` } > { title } </ div > }
99- { isFunction ( props ) && (
100- < Tabs
101- destroyInactiveTabPane
102- activeKey = { tabKey }
103- onChange = { setTabKey }
104- className = { `${ slidePrefixCls } -tabs` }
100+ < Spin wrapperClassName = { `${ slidePrefixCls } -nested-loading` } spinning = { loading } >
101+ { ! mask && renderButton ( ) }
102+ { title && < div className = { `${ slidePrefixCls } -header` } > { title } </ div > }
103+ { isFunction ( props ) && (
104+ < Tabs
105+ destroyInactiveTabPane
106+ activeKey = { tabKey }
107+ onChange = { setTabKey }
108+ className = { `${ slidePrefixCls } -tabs` }
109+ >
110+ { props . tabs ?. map ( ( tab : { key : string ; title : React . ReactNode } ) => (
111+ < Tabs . TabPane tab = { tab . title } key = { tab . key } />
112+ ) ) }
113+ </ Tabs >
114+ ) }
115+ < div
116+ className = { classNames ( `${ slidePrefixCls } -body` , bodyClassName ) }
117+ style = { bodyStyle }
105118 >
106- { props . tabs ?. map ( ( tab : { key : string ; title : React . ReactNode } ) => (
107- < Tabs . TabPane tab = { tab . title } key = { tab . key } />
108- ) ) }
109- </ Tabs >
110- ) }
111- < div className = { classNames ( `${ slidePrefixCls } -body` , bodyClassName ) } style = { bodyStyle } >
112- { typeof children === 'function' ? children ( tabKey ) : children }
113- </ div >
119+ { typeof children === 'function' ? children ( tabKey ) : children }
120+ </ div >
121+ </ Spin >
114122 </ RcDrawer >
115123 ) ;
116124} ;
0 commit comments