Skip to content

Commit

Permalink
feat(input): MockInput 没有匹配到值时默认展示 value 值
Browse files Browse the repository at this point in the history
  • Loading branch information
zyprepare committed Aug 2, 2024
1 parent 9e91b90 commit c9eb992
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .changeset/five-mails-beg.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"@hi-ui/notification": patch
---

调整通知组件过度样式触发滚动条
fix: 调整通知组件过度样式触发滚动条
5 changes: 5 additions & 0 deletions .changeset/plenty-mice-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/input": minor
---

feat: MockInput 没有匹配到值时默认展示 value 值
5 changes: 5 additions & 0 deletions .changeset/red-gorillas-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/hiui": patch
---

feat(input): MockInput 没有匹配到值时默认展示 value 值
5 changes: 5 additions & 0 deletions .changeset/selfish-steaks-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/hiui": patch
---

fix(notification): 调整通知组件过度样式触发滚动条
2 changes: 1 addition & 1 deletion packages/ui/input/src/MockInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const MockInput = forwardRef<HTMLDivElement | null, MockInputProps>(
const displayItem = useMemo(() => {
if (value === '') return null

const displayItem = data.find((item) => item.id === value)
const displayItem = data.find((item) => item.id === value) || { id: value, title: value }

return displayItem || null
}, [value, data])
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/select/src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const Select = forwardRef<HTMLDivElement | null, SelectProps>(
ref
) => {
const i18n = useLocaleContext()
const innerRef = useRef<PickerHelper>()
const innerRef = useRef<PickerHelper>(null)
const placeholder = isUndef(placeholderProp) ? i18n.get('select.placeholder') : placeholderProp

const [menuVisible, menuVisibleAction] = useUncontrolledToggle({
Expand Down

0 comments on commit c9eb992

Please sign in to comment.