From a1b11418e53218e5bbf26492c40c0ccb16651c75 Mon Sep 17 00:00:00 2001 From: GreatZP Date: Mon, 18 Mar 2024 16:50:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(editable-select):=20=E5=B7=B2=E6=9C=89?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E4=BA=8E=E8=BF=9C=E7=A8=8B=E7=AD=9B?= =?UTF-8?q?=E9=80=89=EF=BC=8C=E4=B8=8D=E8=BF=9B=E8=A1=8C=E9=BB=98=E8=AE=A4?= =?UTF-8?q?label=E8=BF=87=E6=BB=A4=20(#1794)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devui/editable-select/src/composables/use-select.ts | 9 ++++++++- packages/devui-vue/package.json | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/devui-vue/devui/editable-select/src/composables/use-select.ts b/packages/devui-vue/devui/editable-select/src/composables/use-select.ts index c167fbf295..7ac279b1d4 100644 --- a/packages/devui-vue/devui/editable-select/src/composables/use-select.ts +++ b/packages/devui-vue/devui/editable-select/src/composables/use-select.ts @@ -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; @@ -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()); }); }); diff --git a/packages/devui-vue/package.json b/packages/devui-vue/package.json index 2992568eb6..1cbec3fd4e 100644 --- a/packages/devui-vue/package.json +++ b/packages/devui-vue/package.json @@ -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": [