fix: fix Checkbox not disabled when itemsLits is empty (#40038)

* fix: fix Checkbox not disabled when itemsLits is empty

* revert

* fix

* update snap

* fix: update snap

* update snap

* update snap

* revert
This commit is contained in:
lijianan 2023-01-05 20:34:31 +08:00 committed by GitHub
parent e4dd7096af
commit ae67ad20c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 529 additions and 353 deletions

View File

@ -38402,13 +38402,14 @@ exports[`ConfigProvider components Transfer configProvider 1`] = `
class="config-transfer-list-header"
>
<label
class="config-checkbox-wrapper config-transfer-list-checkbox"
class="config-checkbox-wrapper config-checkbox-wrapper-disabled config-transfer-list-checkbox"
>
<span
class="config-checkbox"
class="config-checkbox config-checkbox-disabled"
>
<input
class="config-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -38561,13 +38562,14 @@ exports[`ConfigProvider components Transfer configProvider 1`] = `
class="config-transfer-list-header"
>
<label
class="config-checkbox-wrapper config-transfer-list-checkbox"
class="config-checkbox-wrapper config-checkbox-wrapper-disabled config-transfer-list-checkbox"
>
<span
class="config-checkbox"
class="config-checkbox config-checkbox-disabled"
>
<input
class="config-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -38946,13 +38948,14 @@ exports[`ConfigProvider components Transfer configProvider componentSize large 1
class="config-transfer-list-header"
>
<label
class="config-checkbox-wrapper config-transfer-list-checkbox"
class="config-checkbox-wrapper config-checkbox-wrapper-disabled config-transfer-list-checkbox"
>
<span
class="config-checkbox"
class="config-checkbox config-checkbox-disabled"
>
<input
class="config-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -39105,13 +39108,14 @@ exports[`ConfigProvider components Transfer configProvider componentSize large 1
class="config-transfer-list-header"
>
<label
class="config-checkbox-wrapper config-transfer-list-checkbox"
class="config-checkbox-wrapper config-checkbox-wrapper-disabled config-transfer-list-checkbox"
>
<span
class="config-checkbox"
class="config-checkbox config-checkbox-disabled"
>
<input
class="config-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -39217,13 +39221,14 @@ exports[`ConfigProvider components Transfer configProvider componentSize middle
class="config-transfer-list-header"
>
<label
class="config-checkbox-wrapper config-transfer-list-checkbox"
class="config-checkbox-wrapper config-checkbox-wrapper-disabled config-transfer-list-checkbox"
>
<span
class="config-checkbox"
class="config-checkbox config-checkbox-disabled"
>
<input
class="config-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -39376,13 +39381,14 @@ exports[`ConfigProvider components Transfer configProvider componentSize middle
class="config-transfer-list-header"
>
<label
class="config-checkbox-wrapper config-transfer-list-checkbox"
class="config-checkbox-wrapper config-checkbox-wrapper-disabled config-transfer-list-checkbox"
>
<span
class="config-checkbox"
class="config-checkbox config-checkbox-disabled"
>
<input
class="config-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -39488,13 +39494,14 @@ exports[`ConfigProvider components Transfer configProvider virtual and dropdownM
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -39647,13 +39654,14 @@ exports[`ConfigProvider components Transfer configProvider virtual and dropdownM
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -39759,13 +39767,14 @@ exports[`ConfigProvider components Transfer normal 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -39918,13 +39927,14 @@ exports[`ConfigProvider components Transfer normal 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -40030,13 +40040,14 @@ exports[`ConfigProvider components Transfer prefixCls 1`] = `
class="prefix-Transfer-list-header"
>
<label
class="ant-checkbox-wrapper prefix-Transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled prefix-Transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -40189,13 +40200,14 @@ exports[`ConfigProvider components Transfer prefixCls 1`] = `
class="prefix-Transfer-list-header"
>
<label
class="ant-checkbox-wrapper prefix-Transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled prefix-Transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
value=""
/>

View File

@ -489,13 +489,14 @@ exports[`renders ./components/empty/demo/config-provider.tsx extend context corr
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -778,13 +779,14 @@ exports[`renders ./components/empty/demo/config-provider.tsx extend context corr
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span

View File

@ -296,13 +296,14 @@ exports[`renders ./components/empty/demo/config-provider.tsx correctly 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -456,13 +457,14 @@ exports[`renders ./components/empty/demo/config-provider.tsx correctly 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span

View File

@ -12,13 +12,14 @@ exports[`renders ./components/transfer/demo/advanced.tsx extend context correctl
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -387,13 +388,14 @@ exports[`renders ./components/transfer/demo/advanced.tsx extend context correctl
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -1654,13 +1656,14 @@ exports[`renders ./components/transfer/demo/custom-item.tsx extend context corre
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -1944,13 +1947,14 @@ exports[`renders ./components/transfer/demo/custom-item.tsx extend context corre
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -4465,13 +4469,14 @@ exports[`renders ./components/transfer/demo/search.tsx extend context correctly
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -4820,13 +4825,14 @@ exports[`renders ./components/transfer/demo/search.tsx extend context correctly
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -5135,13 +5141,14 @@ exports[`renders ./components/transfer/demo/status.tsx extend context correctly
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -5424,13 +5431,14 @@ exports[`renders ./components/transfer/demo/status.tsx extend context correctly
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -5667,13 +5675,14 @@ exports[`renders ./components/transfer/demo/status.tsx extend context correctly
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -6022,13 +6031,14 @@ exports[`renders ./components/transfer/demo/status.tsx extend context correctly
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span

View File

@ -12,13 +12,14 @@ exports[`renders ./components/transfer/demo/advanced.tsx correctly 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -258,13 +259,14 @@ exports[`renders ./components/transfer/demo/advanced.tsx correctly 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -1138,13 +1140,14 @@ exports[`renders ./components/transfer/demo/custom-item.tsx correctly 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -1299,13 +1302,14 @@ exports[`renders ./components/transfer/demo/custom-item.tsx correctly 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -2862,13 +2866,14 @@ exports[`renders ./components/transfer/demo/search.tsx correctly 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -3088,13 +3093,14 @@ exports[`renders ./components/transfer/demo/search.tsx correctly 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -3274,13 +3280,14 @@ exports[`renders ./components/transfer/demo/status.tsx correctly 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -3434,13 +3441,14 @@ exports[`renders ./components/transfer/demo/status.tsx correctly 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -3548,13 +3556,14 @@ exports[`renders ./components/transfer/demo/status.tsx correctly 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
@ -3774,13 +3783,14 @@ exports[`renders ./components/transfer/demo/status.tsx correctly 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span

View File

@ -11,13 +11,14 @@ exports[`Transfer rtl render component should be rendered correctly in RTL direc
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-checkbox-rtl ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-rtl ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -170,13 +171,14 @@ exports[`Transfer rtl render component should be rendered correctly in RTL direc
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-checkbox-rtl ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-rtl ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -933,13 +935,14 @@ exports[`Transfer should support render value and label in item 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
value=""
/>
@ -1182,13 +1185,14 @@ exports[`immutable data dataSource is frozen 1`] = `
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled ant-transfer-list-checkbox"
>
<span
class="ant-checkbox"
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
value=""
/>

View File

@ -238,7 +238,7 @@ const TransferList = <RecordType extends KeyWiseTransferItem>(
const checkBox = (
<Checkbox
disabled={disabled}
disabled={filteredItems.length === 0 || props.disabled}
checked={checkStatus === 'all'}
indeterminate={checkStatus === 'part'}
className={`${prefixCls}-checkbox`}