Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tree-select): 修复 valueDisplay 清空按钮不展示问题 #1757

Merged
merged 2 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/select-input/useSingle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default function useSingle(props: TdSelectInputProps) {
{...commonInputProps}
autoWidth={props.autoWidth}
placeholder={singleValueDisplay ? '' : props.placeholder}
value={singleValueDisplay ? undefined : displayedValue}
value={singleValueDisplay ? ' ' : displayedValue}
label={
<>
{props.label}
Expand Down
2 changes: 1 addition & 1 deletion src/select/_example/custom-selected.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const CustomSelected = () => {
clearable
defaultValue={'1'}
style={{ width: '300px', marginRight: '20px' }}
valueDisplay={({ value }) => `选中${value}`}
valueDisplay={({ value }) => (value ? `选中${value}` : null)}
>
{options.map((v, i) => (
<Select.Option value={v.value} key={i}>
Expand Down
24 changes: 16 additions & 8 deletions test/snap/__snapshots__/csr.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -68646,6 +68646,7 @@ exports[`csr snapshot test > csr test src/date-picker/_example/panel.jsx 1`] = `
>
<div
class="t-input__wrap"
value=" "
>
<div
class="t-input t-is-readonly t-size-m t-align-left t-is-default t-input--prefix t-input--suffix"
Expand All @@ -68660,7 +68661,7 @@ exports[`csr snapshot test > csr test src/date-picker/_example/panel.jsx 1`] = `
placeholder=""
readonly=""
type="text"
value=""
value=" "
/>
<span
class="t-input__suffix t-input__suffix-icon"
Expand Down Expand Up @@ -73293,6 +73294,7 @@ exports[`csr snapshot test > csr test src/date-picker/_example/panel.jsx 1`] = `
>
<div
class="t-input__wrap"
value=" "
>
<div
class="t-input t-is-readonly t-size-m t-align-left t-is-default t-input--prefix t-input--suffix"
Expand All @@ -73307,7 +73309,7 @@ exports[`csr snapshot test > csr test src/date-picker/_example/panel.jsx 1`] = `
placeholder=""
readonly=""
type="text"
value=""
value=" "
/>
<span
class="t-input__suffix t-input__suffix-icon"
Expand Down Expand Up @@ -156782,6 +156784,7 @@ exports[`csr snapshot test > csr test src/select/_example/custom-selected.jsx 1`
>
<div
class="t-input__wrap"
value=" "
>
<div
class="t-input t-is-readonly t-size-m t-align-left t-is-default t-input--prefix t-input--suffix"
Expand All @@ -156796,7 +156799,7 @@ exports[`csr snapshot test > csr test src/select/_example/custom-selected.jsx 1`
placeholder=""
readonly=""
type="text"
value=""
value=" "
/>
<span
class="t-input__suffix t-input__suffix-icon"
Expand Down Expand Up @@ -156911,6 +156914,7 @@ exports[`csr snapshot test > csr test src/select/_example/custom-selected.jsx 1`
>
<div
class="t-input__wrap"
value=" "
>
<div
class="t-input t-is-readonly t-size-m t-align-left t-is-default t-input--prefix t-input--suffix"
Expand All @@ -156925,7 +156929,7 @@ exports[`csr snapshot test > csr test src/select/_example/custom-selected.jsx 1`
placeholder=""
readonly=""
type="text"
value=""
value=" "
/>
<span
class="t-input__suffix t-input__suffix-icon"
Expand Down Expand Up @@ -162769,6 +162773,7 @@ exports[`csr snapshot test > csr test src/select-input/_example/custom-tag.jsx 1
>
<div
class="t-input__wrap"
value=" "
>
<div
class="t-input t-is-readonly t-size-m t-align-left t-is-default t-input--prefix"
Expand All @@ -162789,7 +162794,7 @@ exports[`csr snapshot test > csr test src/select-input/_example/custom-tag.jsx 1
placeholder=""
readonly=""
type="text"
value=""
value=" "
/>
</div>
</div>
Expand Down Expand Up @@ -162983,6 +162988,7 @@ exports[`csr snapshot test > csr test src/select-input/_example/custom-tag.jsx 1
>
<div
class="t-input__wrap"
value=" "
>
<div
class="t-input t-is-readonly t-size-m t-align-left t-is-default t-input--prefix"
Expand All @@ -163003,7 +163009,7 @@ exports[`csr snapshot test > csr test src/select-input/_example/custom-tag.jsx 1
placeholder=""
readonly=""
type="text"
value=""
value=" "
/>
</div>
</div>
Expand Down Expand Up @@ -261155,6 +261161,7 @@ exports[`csr snapshot test > csr test src/tree-select/_example/valuedisplay.jsx
>
<div
class="t-input__wrap"
value=" "
>
<div
class="t-input t-is-readonly t-size-m t-align-left t-is-default t-input--prefix t-input--suffix"
Expand All @@ -261169,7 +261176,7 @@ exports[`csr snapshot test > csr test src/tree-select/_example/valuedisplay.jsx
placeholder=""
readonly=""
type="text"
value=""
value=" "
/>
<span
class="t-input__suffix t-input__suffix-icon"
Expand Down Expand Up @@ -261305,6 +261312,7 @@ exports[`csr snapshot test > csr test src/tree-select/_example/valuedisplay.jsx
>
<div
class="t-input__wrap"
value=" "
>
<div
class="t-input t-is-readonly t-size-m t-align-left t-is-default t-input--prefix t-input--suffix"
Expand All @@ -261319,7 +261327,7 @@ exports[`csr snapshot test > csr test src/tree-select/_example/valuedisplay.jsx
placeholder=""
readonly=""
type="text"
value=""
value=" "
/>
<span
class="t-input__suffix t-input__suffix-icon"
Expand Down