Skip to content

Commit

Permalink
feat: select support searchPosition (30%)
Browse files Browse the repository at this point in the history
  • Loading branch information
pointhalo committed Jun 11, 2024
1 parent a4f790c commit f68d8ad
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
1 change: 1 addition & 0 deletions packages/semi-foundation/select/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
}

handleKeyPress(e: KeyboardEvent) {
console.log('handleKeyPress');
if (e && e.key === ENTER_KEY) {
this.handleClick(e);
}
Expand Down
47 changes: 24 additions & 23 deletions packages/semi-ui/select/_story/select.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3570,28 +3570,29 @@ export const UpdateOtherKeyNotInList = () => {
};

export const SearchPosition = () => {
return (
<>
<Select
filter
searchPosition='dropdown'
onChangeWithObject
placeholder={'single searchPosition=dropdown'}
optionList={optionList}
searchPlaceholder='dropdown input place'
style={{ width: 320 }}
/>
<Select
filter
multiple
placeholder={'multiple searchPosition=dropdown'}
searchPosition='dropdown'
onChangeWithObject
searchPlaceholder='dropdown input place'
optionList={optionList}
style={{ width: 320 }}
/>


return
(
<>
<Select
filter
searchPosition='dropdown'
onChangeWithObject
placeholder={'single searchPosition=dropdown'}
optionList={optionList}
searchPlaceholder='dropdown input place'
style={{ width: 320 }}
/>
<Select
filter
multiple
placeholder={'multiple searchPosition=dropdown'}
searchPosition='dropdown'
onChangeWithObject
searchPlaceholder='dropdown input place'
optionList={optionList}
style={{ width: 320 }}
/>
</>
)
)
}
2 changes: 1 addition & 1 deletion packages/semi-ui/select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
defaultActiveFirstOption: PropTypes.bool,
triggerRender: PropTypes.func,
stopPropagation: PropTypes.bool,
searchPosition: PropTypes.bool,
searchPosition: PropTypes.string,
// motion doesn't need to be exposed
motion: PropTypes.bool,

Expand Down

0 comments on commit f68d8ad

Please sign in to comment.