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

feat(input): MockInput 没有匹配到值时默认展示 value 值 #2954

Merged
merged 1 commit into from
Aug 2, 2024
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 .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