From 0eb1c31514aa131469281e0b979f367719fce120 Mon Sep 17 00:00:00 2001 From: Junyi Date: Tue, 16 May 2023 16:07:56 +0700 Subject: [PATCH] feat(client): allow search by title in collection select (#1869) --- .../src/collection-manager/templates/expression.tsx | 2 +- .../antd/collection-select/CollectionSelect.tsx | 10 +++++++++- .../plugins/workflow/src/client/schemas/collection.ts | 5 ++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/core/client/src/collection-manager/templates/expression.tsx b/packages/core/client/src/collection-manager/templates/expression.tsx index 1bd9adc5a7..2f50b90b17 100644 --- a/packages/core/client/src/collection-manager/templates/expression.tsx +++ b/packages/core/client/src/collection-manager/templates/expression.tsx @@ -35,7 +35,7 @@ export const expression: ICollectionTemplate = { title: '{{t("Collection")}}', 'x-component': 'CollectionSelect', 'x-component-props': { - multiple: true, + // multiple: true, }, }, }, diff --git a/packages/core/client/src/schema-component/antd/collection-select/CollectionSelect.tsx b/packages/core/client/src/schema-component/antd/collection-select/CollectionSelect.tsx index d02dac90a0..3a3dadead2 100644 --- a/packages/core/client/src/schema-component/antd/collection-select/CollectionSelect.tsx +++ b/packages/core/client/src/schema-component/antd/collection-select/CollectionSelect.tsx @@ -28,7 +28,15 @@ export const CollectionSelect = connect( const options = useOptions(props); const { t } = useTranslation(); - return (option?.label ?? '').includes(input)} + options={options} + /> + ); }, mapReadPretty( observer((props: CollectionSelectProps) => { diff --git a/packages/plugins/workflow/src/client/schemas/collection.ts b/packages/plugins/workflow/src/client/schemas/collection.ts index 0af9cf0e1b..582534641b 100644 --- a/packages/plugins/workflow/src/client/schemas/collection.ts +++ b/packages/plugins/workflow/src/client/schemas/collection.ts @@ -7,12 +7,11 @@ export const collection = { type: 'string', title: '{{t("Collection")}}', required: true, - 'x-reactions': ['{{useCollectionDataSource()}}'], + 'x-reactions': [], 'x-decorator': 'FormItem', - 'x-component': 'Select', + 'x-component': 'CollectionSelect', 'x-component-props': { dropdownMatchSelectWidth: false, - placeholder: '{{t("Select collection")}}', }, };