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 { FormOutlined } from '@ant-design/icons';
|
||||||
import { FormLayout } from '@formily/antd-v5';
|
import { FormLayout } from '@formily/antd-v5';
|
||||||
import { SchemaOptionsContext } from '@nocobase/schema';
|
import { SchemaOptionsContext } from '@nocobase/schema';
|
||||||
import { createFormBlockSchema, useAPIClient, useCollectionManager } from '@nocobase/client';
|
import { APIClientProvider, createFormBlockSchema, useAPIClient, useCollectionManager } from '@nocobase/client';
|
||||||
import {
|
import {
|
||||||
DataBlockInitializer,
|
DataBlockInitializer,
|
||||||
FormDialog,
|
FormDialog,
|
||||||
@ -30,33 +30,37 @@ export const SettingBlockInitializer = () => {
|
|||||||
onCreateBlockSchema={async ({ item }) => {
|
onCreateBlockSchema={async ({ item }) => {
|
||||||
const collection = cm.getCollection(item.name);
|
const collection = cm.getCollection(item.name);
|
||||||
const titleField = collection.titleField;
|
const titleField = collection.titleField;
|
||||||
const result = await api.resource(collection.name).list();
|
|
||||||
const values = await FormDialog(
|
const values = await FormDialog(
|
||||||
t('Pick a data entry for viewing and editing'),
|
t('Pick a data entry for viewing and editing'),
|
||||||
() => {
|
() => {
|
||||||
return (
|
return (
|
||||||
<SchemaComponentOptions scope={options.scope} components={{ ...options.components }}>
|
<APIClientProvider apiClient={api}>
|
||||||
<FormLayout layout={'vertical'}>
|
<SchemaComponentOptions scope={options.scope} components={{ ...options.components }}>
|
||||||
<SchemaComponent
|
<FormLayout layout={'vertical'}>
|
||||||
schema={{
|
<SchemaComponent
|
||||||
properties: {
|
schema={{
|
||||||
id: {
|
properties: {
|
||||||
title: tval('Please select'),
|
id: {
|
||||||
enum: result.data.data.map((item) => {
|
title: tval('Please select'),
|
||||||
return {
|
required: true,
|
||||||
label: item[titleField].toString(),
|
'x-component': 'RemoteSelect',
|
||||||
value: item.id,
|
'x-component-props': {
|
||||||
};
|
service: {
|
||||||
}),
|
resource: item.name,
|
||||||
required: true,
|
},
|
||||||
'x-component': 'Select',
|
fieldNames: {
|
||||||
'x-decorator': 'FormItem',
|
label: titleField,
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'x-decorator': 'FormItem',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
</FormLayout>
|
||||||
</FormLayout>
|
</SchemaComponentOptions>
|
||||||
</SchemaComponentOptions>
|
</APIClientProvider>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
theme,
|
theme,
|
||||||
|
Loading…
Reference in New Issue
Block a user