Merge pull request 'fix: add schema item max stack exceeded' (#422) from fix_max_stack into @hera/dev
Reviewed-on: daoyoucloud/tachycode#422
This commit is contained in:
commit
1d8a97bdc0
@ -143,6 +143,15 @@ export class PluginCoreClient extends Plugin {
|
|||||||
(item as SchemaSettingOptions).Component = AfterSuccess;
|
(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() {
|
async registerActions() {
|
||||||
@ -319,13 +328,6 @@ export class PluginCoreClient extends Plugin {
|
|||||||
addCustomComponent.name,
|
addCustomComponent.name,
|
||||||
addCustomComponent,
|
addCustomComponent,
|
||||||
);
|
);
|
||||||
const previewBlockItem = {
|
|
||||||
title: tval('preview block'),
|
|
||||||
name: 'previewBlock',
|
|
||||||
type: 'itemGroup',
|
|
||||||
children: [],
|
|
||||||
};
|
|
||||||
this.app.schemaInitializerManager.get('RecordBlockInitializers').add(previewBlockItem.name, previewBlockItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async registerInterfaces() {
|
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 { 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 { useFieldComponents } from '../schema-initializer/FilterFormItemCustomInitializer/FilterFormItemCustom';
|
||||||
import React from 'react';
|
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 _ from 'lodash';
|
||||||
import { SchemaSettingsRemove } from '../../components/FormFilter/SchemaSettingsRemove';
|
import { SchemaSettingsRemove } from '../../components/FormFilter/SchemaSettingsRemove';
|
||||||
import { useTranslation } from '../../locale';
|
import { useTranslation } from '../../locale';
|
||||||
import { SchemaSettingComponent } from '../../schema-components/SchemaSettingsFieldComponent';
|
import { SchemaSettingComponent, SchemaSettingCollection } from '../../schema-components/SchemaSettingsFieldComponent';
|
||||||
import { SchemaSettingCollection } from '../../schema-components/SchemaSettingsFieldComponent copy';
|
|
||||||
|
|
||||||
export const useFieldComponents = () => {
|
export const useFieldComponents = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -118,7 +118,7 @@ export class PluginRentalClient extends Plugin {
|
|||||||
return name === 'settlements';
|
return name === 'settlements';
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
this.app.schemaInitializerManager.addItem('RecordBlockInitializers', 'previewBlock.record', {
|
this.app.schemaInitializerManager.addItem('popup:common:addBlock', 'previewBlock.record', {
|
||||||
key: 'record',
|
key: 'record',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: tval('record'),
|
title: tval('record'),
|
||||||
@ -127,7 +127,7 @@ export class PluginRentalClient extends Plugin {
|
|||||||
usePdfPath: '{{ useRecordPdfPath }}',
|
usePdfPath: '{{ useRecordPdfPath }}',
|
||||||
target: 'record',
|
target: 'record',
|
||||||
});
|
});
|
||||||
this.app.schemaInitializerManager.addItem('RecordBlockInitializers', 'previewBlock.waybill', {
|
this.app.schemaInitializerManager.addItem('popup:common:addBlock', 'previewBlock.waybill', {
|
||||||
key: 'waybill',
|
key: 'waybill',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: tval('waybill'),
|
title: tval('waybill'),
|
||||||
@ -136,7 +136,7 @@ export class PluginRentalClient extends Plugin {
|
|||||||
usePdfPath: '{{ useWaybillPdfPath }}',
|
usePdfPath: '{{ useWaybillPdfPath }}',
|
||||||
target: 'waybill',
|
target: 'waybill',
|
||||||
});
|
});
|
||||||
this.app.schemaInitializerManager.addItem('RecordBlockInitializers', 'previewBlock.settlement', {
|
this.app.schemaInitializerManager.addItem('popup:common:addBlock', 'previewBlock.settlement', {
|
||||||
key: 'settlement',
|
key: 'settlement',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: tval('settlement'),
|
title: tval('settlement'),
|
||||||
|
Loading…
Reference in New Issue
Block a user