mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
fix: save as template not working if fields containing nest properties (#6543)
* fix: save as template not working if fields containing nest properties * fix: hide old blocks save as template * fix: unit tests failing * fix: unit tests for hiding old save template option * fix: unit test failing for save as template
This commit is contained in:
parent
befdd5366c
commit
aa51c693d6
@ -50,7 +50,7 @@ describe('CollectionSelect', () => {
|
||||
>
|
||||
<div
|
||||
aria-label="block-item-demo title"
|
||||
class="nb-block-item nb-form-item css-9qorhu ant-nb-block-item css-dev-only-do-not-override-11aiz3o"
|
||||
class="nb-block-item nb-form-item css-9qorhu ant-nb-block-item css-dev-only-do-not-override-1rquknz"
|
||||
role="button"
|
||||
>
|
||||
<div
|
||||
@ -191,7 +191,7 @@ describe('CollectionSelect', () => {
|
||||
>
|
||||
<div
|
||||
aria-label="block-item-demo title"
|
||||
class="nb-block-item nb-form-item css-9qorhu ant-nb-block-item css-dev-only-do-not-override-11aiz3o"
|
||||
class="nb-block-item nb-form-item css-9qorhu ant-nb-block-item css-dev-only-do-not-override-1rquknz"
|
||||
role="button"
|
||||
>
|
||||
<div
|
||||
|
@ -343,14 +343,14 @@ export const TableBlockDesigner = () => {
|
||||
}}
|
||||
/>
|
||||
<SchemaSettingsConnectDataBlocks type={FilterBlockType.TABLE} emptyDescription={t('No blocks to connect')} />
|
||||
{supportTemplate && <SchemaSettingsDivider />}
|
||||
{/* {supportTemplate && <SchemaSettingsDivider />}
|
||||
{supportTemplate && (
|
||||
<SchemaSettingsTemplate
|
||||
componentName={`${componentNamePrefix}Table`}
|
||||
collectionName={name}
|
||||
resourceName={defaultResource}
|
||||
/>
|
||||
)}
|
||||
)} */}
|
||||
<SchemaSettingsDivider />
|
||||
<SchemaSettingsRemove
|
||||
removeParentsIfNoChildren
|
||||
|
@ -233,10 +233,10 @@ describe('Table.settings', () => {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Save as template',
|
||||
type: 'modal',
|
||||
},
|
||||
// {
|
||||
// title: 'Save as template',
|
||||
// type: 'modal',
|
||||
// },
|
||||
{
|
||||
title: 'Delete',
|
||||
type: 'delete',
|
||||
@ -299,7 +299,12 @@ describe('Table.settings', () => {
|
||||
|
||||
test('menu list', async () => {
|
||||
await renderSettings(getRenderSettingsOptions());
|
||||
await checkTableSettings();
|
||||
await checkTableSettings([
|
||||
{
|
||||
title: 'Save as template',
|
||||
type: 'modal',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test('old schema', async () => {
|
||||
|
@ -23,7 +23,7 @@ import { useLocation } from 'react-router-dom';
|
||||
|
||||
const blockDecoratorMenuMaps = {
|
||||
TableBlockProvider: ['Table', 'table'],
|
||||
FormBlockProvider: ['Form', 'form'],
|
||||
FormBlockProvider: ['FormItem', 'form'],
|
||||
DetailsBlockProvider: ['Details', 'details'],
|
||||
'List.Decorator': ['List', 'list'],
|
||||
'GridCard.Decorator': ['GridCard', 'gridCard'],
|
||||
@ -281,6 +281,7 @@ function getTemplateSchemaFromPage(schema: ISchema) {
|
||||
if (s['x-template-root-uid']) {
|
||||
return;
|
||||
}
|
||||
t = t || {};
|
||||
_.merge(t, _.omit(s, ['x-uid', 'properties']));
|
||||
t['x-uid'] = uid();
|
||||
if (s.properties) {
|
||||
@ -288,7 +289,7 @@ function getTemplateSchemaFromPage(schema: ISchema) {
|
||||
if (s.properties[key]['x-template-root-uid']) {
|
||||
continue;
|
||||
}
|
||||
_.set(t, `properties.${key}`, {});
|
||||
_.set(t, `properties.['${key}']`, {});
|
||||
traverseSchema(s.properties[key], t.properties[key]);
|
||||
}
|
||||
}
|
||||
|
@ -169,6 +169,9 @@ export class PluginBlockTemplateClient extends Plugin {
|
||||
'blockSettings:createForm',
|
||||
'blockSettings:details',
|
||||
'blockSettings:detailsWithPagination',
|
||||
'blockSettings:multiDataDetails',
|
||||
'blockSettings:singleDataDetails',
|
||||
'blockSettings:stepsForm',
|
||||
'blockSettings:filterCollapse',
|
||||
'blockSettings:filterForm',
|
||||
'blockSettings:gantt',
|
||||
@ -176,6 +179,13 @@ export class PluginBlockTemplateClient extends Plugin {
|
||||
'blockSettings:kanban',
|
||||
'blockSettings:list',
|
||||
'blockSettings:table',
|
||||
'blockSettings:tree',
|
||||
'ReadPrettyFormSettings',
|
||||
'GanttBlockSettings',
|
||||
'FormV1Settings',
|
||||
'FormSettings',
|
||||
'FormItemSettings',
|
||||
'FormDetailsSettings',
|
||||
];
|
||||
if (blockSettings.includes(key)) {
|
||||
// schemaSetting.add('template-saveAsTemplateItem', saveAsTemplateSetting);
|
||||
|
@ -154,8 +154,12 @@ export function formSchemaPatch(currentSchema: ISchema, options?: any) {
|
||||
return key !== 'grid';
|
||||
});
|
||||
if (actionKey) {
|
||||
_.set(currentSchema, `properties.${comKey}.x-use-component-props`, 'useEditFormBlockProps');
|
||||
_.set(currentSchema, `properties.${comKey}.properties.${actionKey}.x-initializer`, 'editForm:configureActions');
|
||||
_.set(currentSchema, `properties.['${comKey}'].x-use-component-props`, 'useEditFormBlockProps');
|
||||
_.set(
|
||||
currentSchema,
|
||||
`properties.['${comKey}'].properties.['${actionKey}'].x-initializer`,
|
||||
'editForm:configureActions',
|
||||
);
|
||||
|
||||
const actionBarSchema = _.get(currentSchema, `properties.${comKey}.properties.${actionKey}.properties`, {});
|
||||
for (const key in actionBarSchema) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user