Skip to content

Commit

Permalink
fix(comp:select): the onSearch should be called when the intput is clear
Browse files Browse the repository at this point in the history
  • Loading branch information
danranVm committed Jun 26, 2023
1 parent feb5a33 commit d6fdd9b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
5 changes: 4 additions & 1 deletion packages/components/cascader/src/Cascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ export default defineComponent({
setInputValue(value)
props.searchable && callEmit(props.onSearch, value)
}
const handleSearchClear = () => setInputValue('')
const handleSearchClear = () => {
setInputValue('')
props.searchable && callEmit(props.onSearch, '')
}
const renderContent = () => {
const { searchable, overlayRender } = props
const searchValue = inputValue.value
Expand Down
7 changes: 2 additions & 5 deletions packages/components/notification/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import type { ExtractInnerPropTypes, ExtractPublicPropTypes, MaybeArray, VKey }
import type { ButtonProps } from '@idux/components/button'
import type { DefineComponent, HTMLAttributes, PropType, VNode, VNodeProps } from 'vue'

// 挑出部分必填的属性
type PickRequire<T, U extends keyof T> = Pick<T, Exclude<keyof T, U>> & Required<Pick<T, U>>

export interface NotificationButtonProps<K = VKey> extends ButtonProps {
key?: K
text?: string | VNode
Expand Down Expand Up @@ -69,8 +66,8 @@ export type NotificationComponent = DefineComponent<
export type NotificationInstance = InstanceType<DefineComponent<NotificationProps>>

// 通过useNotification的配置
export interface NotificationOptions<K = VKey> extends PickRequire<NotificationProps, 'title' | 'content'> {
key: K
export interface NotificationOptions<K = VKey> extends NotificationProps {
key?: K
contentProps?: Record<string, unknown> | VNodeProps
onDestroy?: (key: K) => void
}
Expand Down
5 changes: 4 additions & 1 deletion packages/components/select/src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ export default defineComponent({
setInputValue(value)
props.searchable && callEmit(props.onSearch, value)
}
const handleSearchClear = () => setInputValue('')
const handleSearchClear = () => {
setInputValue('')
props.searchable && callEmit(props.onSearch, '')
}

children.unshift(
<div class={`${mergedPrefixCls.value}-overlay-search-wrapper`}>
Expand Down
5 changes: 4 additions & 1 deletion packages/components/tree-select/src/content/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ export default defineComponent({
setInputValue(value)
props.searchable && callEmit(props.onSearch, value)
}
const handleClear = () => setInputValue('')
const handleClear = () => {
setInputValue('')
props.searchable && callEmit(props.onSearch, '')
}

return () => {
const {
Expand Down

0 comments on commit d6fdd9b

Please sign in to comment.