fix: add schema item max stack exceeded
This commit is contained in:
parent
d3c3322fd4
commit
a44c582b1d
@ -143,6 +143,15 @@ export class PluginCoreClient extends Plugin {
|
||||
(item as SchemaSettingOptions).Component = AfterSuccess;
|
||||
}
|
||||
});
|
||||
|
||||
// 预览区块需要提前加进来,没法放在 afterload 中,这块后面需要重构
|
||||
const previewBlockItem = {
|
||||
title: tval('preview block'),
|
||||
name: 'previewBlock',
|
||||
type: 'itemGroup',
|
||||
children: [],
|
||||
};
|
||||
this.app.schemaInitializerManager.get('popup:common:addBlock').add(previewBlockItem.name, previewBlockItem);
|
||||
}
|
||||
|
||||
async registerActions() {
|
||||
@ -319,13 +328,6 @@ export class PluginCoreClient extends Plugin {
|
||||
addCustomComponent.name,
|
||||
addCustomComponent,
|
||||
);
|
||||
const previewBlockItem = {
|
||||
title: tval('preview block'),
|
||||
name: 'previewBlock',
|
||||
type: 'itemGroup',
|
||||
children: [],
|
||||
};
|
||||
this.app.schemaInitializerManager.get('RecordBlockInitializers').add(previewBlockItem.name, previewBlockItem);
|
||||
}
|
||||
|
||||
async registerInterfaces() {
|
||||
|
@ -1,41 +0,0 @@
|
||||
import { useField, useFieldSchema, useForm } from '@formily/react';
|
||||
import {
|
||||
SchemaSettingsSelectItem,
|
||||
useCollection,
|
||||
useCollectionField,
|
||||
useCollectionManager,
|
||||
useDesignable,
|
||||
} from '@nocobase/client';
|
||||
import React from 'react';
|
||||
|
||||
export const SchemaSettingCollection = () => {
|
||||
const fieldSchema = useFieldSchema();
|
||||
const field = useField();
|
||||
const collections = useCollectionManager();
|
||||
const options = collections?.dataSource['options']?.collections.map((value) => {
|
||||
return {
|
||||
label: value.name,
|
||||
value: value.name,
|
||||
};
|
||||
});
|
||||
const { dn } = useDesignable();
|
||||
return (
|
||||
<SchemaSettingsSelectItem
|
||||
key="component-field"
|
||||
title="Edit Collection"
|
||||
options={options}
|
||||
value={fieldSchema['collectionName']}
|
||||
onChange={(name) => {
|
||||
fieldSchema['collectionName'] = name;
|
||||
fieldSchema['name'] = 'custom.' + name;
|
||||
const schema = {
|
||||
['x-uid']: fieldSchema['x-uid'],
|
||||
collectionName: name,
|
||||
name: 'custom.' + name,
|
||||
};
|
||||
void dn.emit('patch', { schema });
|
||||
dn.refresh();
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
import { useField, useFieldSchema } from '@formily/react';
|
||||
import { SchemaSettingsSelectItem, useDesignable } from '@nocobase/client';
|
||||
import { SchemaSettingsSelectItem, useCollectionManager, useDesignable } from '@nocobase/client';
|
||||
import { useFieldComponents } from '../schema-initializer/FilterFormItemCustomInitializer/FilterFormItemCustom';
|
||||
import React from 'react';
|
||||
|
||||
@ -28,3 +28,35 @@ export const SchemaSettingComponent = () => {
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export const SchemaSettingCollection = () => {
|
||||
const fieldSchema = useFieldSchema();
|
||||
const field = useField();
|
||||
const collections = useCollectionManager();
|
||||
const options = collections?.dataSource['options']?.collections.map((value) => {
|
||||
return {
|
||||
label: value.name,
|
||||
value: value.name,
|
||||
};
|
||||
});
|
||||
const { dn } = useDesignable();
|
||||
return (
|
||||
<SchemaSettingsSelectItem
|
||||
key="component-field"
|
||||
title="Edit Collection"
|
||||
options={options}
|
||||
value={fieldSchema['collectionName']}
|
||||
onChange={(name) => {
|
||||
fieldSchema['collectionName'] = name;
|
||||
fieldSchema['name'] = 'custom.' + name;
|
||||
const schema = {
|
||||
['x-uid']: fieldSchema['x-uid'],
|
||||
collectionName: name,
|
||||
name: 'custom.' + name,
|
||||
};
|
||||
void dn.emit('patch', { schema });
|
||||
dn.refresh();
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -34,8 +34,7 @@ import { EditFormulaTitleField, EditTitle, EditTitleField } from '../../schema-s
|
||||
import _ from 'lodash';
|
||||
import { SchemaSettingsRemove } from '../../components/FormFilter/SchemaSettingsRemove';
|
||||
import { useTranslation } from '../../locale';
|
||||
import { SchemaSettingComponent } from '../../schema-components/SchemaSettingsFieldComponent';
|
||||
import { SchemaSettingCollection } from '../../schema-components/SchemaSettingsFieldComponent copy';
|
||||
import { SchemaSettingComponent, SchemaSettingCollection } from '../../schema-components/SchemaSettingsFieldComponent';
|
||||
|
||||
export const useFieldComponents = () => {
|
||||
const { t } = useTranslation();
|
||||
|
@ -118,7 +118,7 @@ export class PluginRentalClient extends Plugin {
|
||||
return name === 'settlements';
|
||||
},
|
||||
});
|
||||
this.app.schemaInitializerManager.addItem('RecordBlockInitializers', 'previewBlock.record', {
|
||||
this.app.schemaInitializerManager.addItem('popup:common:addBlock', 'previewBlock.record', {
|
||||
key: 'record',
|
||||
type: 'item',
|
||||
title: tval('record'),
|
||||
@ -127,7 +127,7 @@ export class PluginRentalClient extends Plugin {
|
||||
usePdfPath: '{{ useRecordPdfPath }}',
|
||||
target: 'record',
|
||||
});
|
||||
this.app.schemaInitializerManager.addItem('RecordBlockInitializers', 'previewBlock.waybill', {
|
||||
this.app.schemaInitializerManager.addItem('popup:common:addBlock', 'previewBlock.waybill', {
|
||||
key: 'waybill',
|
||||
type: 'item',
|
||||
title: tval('waybill'),
|
||||
@ -136,7 +136,7 @@ export class PluginRentalClient extends Plugin {
|
||||
usePdfPath: '{{ useWaybillPdfPath }}',
|
||||
target: 'waybill',
|
||||
});
|
||||
this.app.schemaInitializerManager.addItem('RecordBlockInitializers', 'previewBlock.settlement', {
|
||||
this.app.schemaInitializerManager.addItem('popup:common:addBlock', 'previewBlock.settlement', {
|
||||
key: 'settlement',
|
||||
type: 'item',
|
||||
title: tval('settlement'),
|
||||
|
Loading…
Reference in New Issue
Block a user