fix: setting block cant search items (#814)
Reviewed-on: daoyoucloud/tachybase#814
This commit is contained in:
parent
5fdd8903e1
commit
5b8bd6e19c
5
.changeset/lucky-humans-tap.md
Normal file
5
.changeset/lucky-humans-tap.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@hera/plugin-core": patch
|
||||
---
|
||||
|
||||
fix setting blocks
|
@ -1,7 +1,7 @@
|
||||
import { FormOutlined } from '@ant-design/icons';
|
||||
import { FormLayout } from '@formily/antd-v5';
|
||||
import { SchemaOptionsContext } from '@nocobase/schema';
|
||||
import { createFormBlockSchema, useAPIClient, useCollectionManager } from '@nocobase/client';
|
||||
import { APIClientProvider, createFormBlockSchema, useAPIClient, useCollectionManager } from '@nocobase/client';
|
||||
import {
|
||||
DataBlockInitializer,
|
||||
FormDialog,
|
||||
@ -30,11 +30,11 @@ export const SettingBlockInitializer = () => {
|
||||
onCreateBlockSchema={async ({ item }) => {
|
||||
const collection = cm.getCollection(item.name);
|
||||
const titleField = collection.titleField;
|
||||
const result = await api.resource(collection.name).list();
|
||||
const values = await FormDialog(
|
||||
t('Pick a data entry for viewing and editing'),
|
||||
() => {
|
||||
return (
|
||||
<APIClientProvider apiClient={api}>
|
||||
<SchemaComponentOptions scope={options.scope} components={{ ...options.components }}>
|
||||
<FormLayout layout={'vertical'}>
|
||||
<SchemaComponent
|
||||
@ -42,14 +42,17 @@ export const SettingBlockInitializer = () => {
|
||||
properties: {
|
||||
id: {
|
||||
title: tval('Please select'),
|
||||
enum: result.data.data.map((item) => {
|
||||
return {
|
||||
label: item[titleField].toString(),
|
||||
value: item.id,
|
||||
};
|
||||
}),
|
||||
required: true,
|
||||
'x-component': 'Select',
|
||||
'x-component': 'RemoteSelect',
|
||||
'x-component-props': {
|
||||
service: {
|
||||
resource: item.name,
|
||||
},
|
||||
fieldNames: {
|
||||
label: titleField,
|
||||
value: 'id',
|
||||
},
|
||||
},
|
||||
'x-decorator': 'FormItem',
|
||||
},
|
||||
},
|
||||
@ -57,6 +60,7 @@ export const SettingBlockInitializer = () => {
|
||||
/>
|
||||
</FormLayout>
|
||||
</SchemaComponentOptions>
|
||||
</APIClientProvider>
|
||||
);
|
||||
},
|
||||
theme,
|
||||
|
Loading…
Reference in New Issue
Block a user