fix: select focus logic #3099
parent
2e61e9cb50
commit
cc35671d7b
|
@ -1,4 +1,4 @@
|
||||||
import { onBeforeUpdate, Ref, ref } from 'vue';
|
import { onMounted, Ref, ref } from 'vue';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar with `useLock`, but this hook will always execute last value.
|
* Similar with `useLock`, but this hook will always execute last value.
|
||||||
|
@ -14,12 +14,11 @@ export default function useDelayReset(
|
||||||
window.clearTimeout(delay);
|
window.clearTimeout(delay);
|
||||||
};
|
};
|
||||||
|
|
||||||
onBeforeUpdate(() => {
|
onMounted(() => {
|
||||||
cancelLatest();
|
cancelLatest();
|
||||||
});
|
});
|
||||||
const delaySetBool = (value: boolean, callback: () => void) => {
|
const delaySetBool = (value: boolean, callback: () => void) => {
|
||||||
cancelLatest();
|
cancelLatest();
|
||||||
|
|
||||||
delay = window.setTimeout(() => {
|
delay = window.setTimeout(() => {
|
||||||
bool.value = value;
|
bool.value = value;
|
||||||
if (callback) {
|
if (callback) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { warning } from '../../vc-util/warning';
|
import { warning } from '../../vc-util/warning';
|
||||||
import { VNodeChild } from 'vue';
|
import { isVNode, VNodeChild } from 'vue';
|
||||||
import {
|
import {
|
||||||
OptionsType as SelectOptionsType,
|
OptionsType as SelectOptionsType,
|
||||||
OptionData,
|
OptionData,
|
||||||
|
@ -163,7 +163,15 @@ export const getLabeledValue: GetLabeledValue<FlattenOptionData[]> = (
|
||||||
};
|
};
|
||||||
|
|
||||||
function toRawString(content: VNodeChild): string {
|
function toRawString(content: VNodeChild): string {
|
||||||
return toArray(content).join('');
|
return toArray(content)
|
||||||
|
.map(item => {
|
||||||
|
if (isVNode(item)) {
|
||||||
|
return item?.el?.innerText || item?.el?.wholeText;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Filter single option if match the search text */
|
/** Filter single option if match the search text */
|
||||||
|
@ -177,7 +185,6 @@ function getFilterFunction(optionFilterProp: string) {
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.includes(lowerSearchText);
|
.includes(lowerSearchText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Option value search
|
// Option value search
|
||||||
const rawValue = option[optionFilterProp];
|
const rawValue = option[optionFilterProp];
|
||||||
const value = toRawString(rawValue).toLowerCase();
|
const value = toRawString(rawValue).toLowerCase();
|
||||||
|
|
Loading…
Reference in New Issue