@@ -13,27 +13,23 @@ import {
13
13
ErrorBoundary ,
14
14
InlineErrorFormItem ,
15
15
LabelIconTip ,
16
- compareVersions ,
17
16
genCopyable ,
18
17
getFieldPropsOrFormItemProps ,
19
18
stringify ,
20
19
useEditableMap ,
21
20
} from '@ant-design/pro-utils' ;
22
21
import type { DescriptionsProps , FormInstance , FormProps } from 'antd' ;
23
- import { ConfigProvider , Descriptions , Space , version } from 'antd' ;
22
+ import { ConfigProvider , Descriptions , Space } from 'antd' ;
24
23
import type { LabelTooltipType } from 'antd/lib/form/FormItemLabel' ;
25
24
import toArray from 'rc-util/lib/Children/toArray' ;
26
25
import get from 'rc-util/lib/utils/get' ;
27
26
import React , { useContext , useEffect } from 'react' ;
28
27
import type { RequestData } from './useFetchData' ;
29
28
import useFetchData from './useFetchData' ;
30
29
31
- // 兼容代码-----------
32
30
import type { ProFieldFCMode } from '@ant-design/pro-provider' ;
33
31
import { proTheme } from '@ant-design/pro-provider' ;
34
32
import type { DescriptionsItemType } from 'antd/es/descriptions' ;
35
- import 'antd/lib/descriptions/style' ;
36
- //----------------------
37
33
38
34
// todo remove it
39
35
export interface DescriptionsItemProps {
@@ -328,16 +324,13 @@ const schemaToDescriptionsItem = (
328
324
emptyText ?: React . ReactNode ,
329
325
) => {
330
326
const options : JSX . Element [ ] = [ ] ;
331
- const isBigger58 = compareVersions ( version , '5.8.0' ) >= 0 ;
332
327
// 因为 Descriptions 只是个语法糖,children 是不会执行的,所以需要这里处理一下
333
328
const children = items
334
329
?. map ?.( ( item , index ) => {
335
330
if ( React . isValidElement ( item ) ) {
336
- return isBigger58
337
- ? {
338
- children : item ,
339
- }
340
- : item ;
331
+ return {
332
+ children : item ,
333
+ } ;
341
334
}
342
335
const {
343
336
valueEnum,
@@ -389,7 +382,7 @@ const schemaToDescriptionsItem = (
389
382
fieldMode === 'edit' ? text : genCopyable ( text , item , text ) ;
390
383
391
384
const field : DescriptionsItemType | JSX . Element =
392
- isBigger58 && valueType !== 'option'
385
+ valueType !== 'option'
393
386
? ( {
394
387
...restItem ,
395
388
key : restItem . key || restItem . label ?. toString ( ) || index ,
@@ -623,7 +616,6 @@ const ProDescriptions = <
623
616
}
624
617
625
618
const className = context . getPrefixCls ( 'pro-descriptions' ) ;
626
- const isBigger58 = compareVersions ( version , '5.8.0' ) >= 0 ;
627
619
return (
628
620
< ErrorBoundary >
629
621
< FormComponent
@@ -651,10 +643,8 @@ const ProDescriptions = <
651
643
)
652
644
}
653
645
title = { title }
654
- items = { isBigger58 ? ( children as DescriptionsItemType [ ] ) : undefined }
655
- >
656
- { isBigger58 ? null : ( children as JSX . Element [ ] ) }
657
- </ Descriptions >
646
+ items = { children as DescriptionsItemType [ ] }
647
+ />
658
648
</ FormComponent >
659
649
</ ErrorBoundary >
660
650
) ;
0 commit comments