mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-02-02 13:17:57 +01:00
feat(InputMenu/SelectMenu): allow lazy search (#1705)
Co-authored-by: chenying <chenying@addcn.com> Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -130,6 +130,8 @@ Pass a function to the `search` prop to customize the search behavior and filter
|
|||||||
|
|
||||||
Use the `debounce` prop to adjust the delay of the function.
|
Use the `debounce` prop to adjust the delay of the function.
|
||||||
|
|
||||||
|
Use the `searchLazy` prop to control the immediacy of data requests. :u-badge{label="New" class="!rounded-full" variant="subtle"}
|
||||||
|
|
||||||
::component-example
|
::component-example
|
||||||
---
|
---
|
||||||
component: 'input-menu-example-search-async'
|
component: 'input-menu-example-search-async'
|
||||||
|
|||||||
@@ -150,6 +150,8 @@ Pass a function to the `searchable` prop to customize the search behavior and fi
|
|||||||
|
|
||||||
Use the `debounce` prop to adjust the delay of the function.
|
Use the `debounce` prop to adjust the delay of the function.
|
||||||
|
|
||||||
|
Use the `searchableLazy` prop to control the immediacy of data requests. :u-badge{label="New" class="!rounded-full" variant="subtle"}
|
||||||
|
|
||||||
::component-example
|
::component-example
|
||||||
---
|
---
|
||||||
component: 'select-menu-example-search-async'
|
component: 'select-menu-example-search-async'
|
||||||
|
|||||||
@@ -249,6 +249,10 @@ export default defineComponent({
|
|||||||
type: Array,
|
type: Array,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
|
searchLazy: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
debounce: {
|
debounce: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 200
|
default: 200
|
||||||
@@ -407,6 +411,8 @@ export default defineComponent({
|
|||||||
return child !== null && child !== undefined && String(child).search(new RegExp(query.value, 'i')) !== -1
|
return child !== null && child !== undefined && String(child).search(new RegExp(query.value, 'i')) !== -1
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}, [], {
|
||||||
|
lazy: props.searchLazy
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(container, (value) => {
|
watch(container, (value) => {
|
||||||
|
|||||||
@@ -249,6 +249,10 @@ export default defineComponent({
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'Search...'
|
default: 'Search...'
|
||||||
},
|
},
|
||||||
|
searchableLazy: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
clearSearchOnClose: {
|
clearSearchOnClose: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: () => configMenu.default.clearSearchOnClose
|
default: () => configMenu.default.clearSearchOnClose
|
||||||
@@ -470,6 +474,8 @@ export default defineComponent({
|
|||||||
return child !== null && child !== undefined && String(child).search(new RegExp(query.value, 'i')) !== -1
|
return child !== null && child !== undefined && String(child).search(new RegExp(query.value, 'i')) !== -1
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}, [], {
|
||||||
|
lazy: props.searchableLazy
|
||||||
})
|
})
|
||||||
|
|
||||||
const createOption = computed(() => {
|
const createOption = computed(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user