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

fix(editable-select): 已有自定义于远程筛选,不进行默认label过滤 (#1794) #1795

Merged
merged 1 commit into from
Mar 18, 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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { computed, ComputedRef, getCurrentInstance, nextTick, onMounted, reactive, ref, Ref, SetupContext, watch } from 'vue';
import { EditableSelectProps, Option, Options } from '../editable-select-types';
import { createI18nTranslate } from '../../../locale/create';
import { isNil } from 'lodash';
import { isFunction, isNil } from 'lodash';

export interface UseSelectStatesReturnType {
hoveringIndex: number;
Expand Down Expand Up @@ -54,9 +54,16 @@ export function useSelect(
const t = createI18nTranslate('DEditableSelect', app);
const cachedOptions = ref(props.options);

const hasCustomFilter = () => {
return (props.remote && isFunction(props.remoteMethod)) || isFunction(props.filterMethod);
};

// computed
const filteredOptions = computed(() => {
return cachedOptions.value.filter((option) => {
if (hasCustomFilter()) {
return true;
}
return option.label.toLocaleLowerCase().includes(states.query.toLocaleLowerCase().trim());
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-devui",
"version": "1.6.3-markdown.2",
"version": "1.6.3-editable-select.1",
"license": "MIT",
"description": "DevUI components based on Vite and Vue3",
"keywords": [
Expand Down
Loading