@@ -6,6 +6,7 @@ import * as React from 'react';
66import { useEffect , useState } from 'react' ;
77import type { EditableConfig , Tab , TabsLocale } from '../interface' ;
88import AddButton from './AddButton' ;
9+ import { getRemovable } from '../util' ;
910
1011export interface OperationNodeProps {
1112 prefixCls : string ;
@@ -83,17 +84,18 @@ function OperationNode(
8384 aria-label = { dropdownAriaLabel !== undefined ? dropdownAriaLabel : 'expanded dropdown' }
8485 >
8586 { tabs . map ( tab => {
86- const removable = editable && tab . closable !== false && ! tab . disabled ;
87+ const { closable, disabled, closeIcon, key, label } = tab ;
88+ const removable = getRemovable ( closable , closeIcon , editable , disabled ) ;
8789 return (
8890 < MenuItem
89- key = { tab . key }
90- id = { `${ popupId } -${ tab . key } ` }
91+ key = { key }
92+ id = { `${ popupId } -${ key } ` }
9193 role = "option"
92- aria-controls = { id && `${ id } -panel-${ tab . key } ` }
93- disabled = { tab . disabled }
94+ aria-controls = { id && `${ id } -panel-${ key } ` }
95+ disabled = { disabled }
9496 >
9597 { /* {tab.tab} */ }
96- < span > { tab . label } </ span >
98+ < span > { label } </ span >
9799 { removable && (
98100 < button
99101 type = "button"
@@ -102,10 +104,10 @@ function OperationNode(
102104 className = { `${ dropdownPrefix } -menu-item-remove` }
103105 onClick = { e => {
104106 e . stopPropagation ( ) ;
105- onRemoveTab ( e , tab . key ) ;
107+ onRemoveTab ( e , key ) ;
106108 } }
107109 >
108- { tab . closeIcon || editable . removeIcon || '×' }
110+ { closeIcon || editable . removeIcon || '×' }
109111 </ button >
110112 ) }
111113 </ MenuItem >
0 commit comments