mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
fix: remove form data template from bulk edit action form (#6098)
This commit is contained in:
parent
f617fcdc54
commit
a36f1151f0
@ -48,7 +48,8 @@ export const createFormBlockSettings = new SchemaSettings({
|
|||||||
Component: SchemaSettingsDataTemplates,
|
Component: SchemaSettingsDataTemplates,
|
||||||
useVisible() {
|
useVisible() {
|
||||||
const { action } = useFormBlockContext();
|
const { action } = useFormBlockContext();
|
||||||
return !action;
|
const schema = useFieldSchema();
|
||||||
|
return !action && schema?.['x-acl-action'].includes('create');
|
||||||
},
|
},
|
||||||
useComponentProps() {
|
useComponentProps() {
|
||||||
const { name } = useCollection_deprecated();
|
const { name } = useCollection_deprecated();
|
||||||
|
@ -0,0 +1,86 @@
|
|||||||
|
/**
|
||||||
|
* This file is part of the NocoBase (R) project.
|
||||||
|
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||||
|
* Authors: NocoBase Team.
|
||||||
|
*
|
||||||
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||||
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { useFieldSchema } from '@formily/react';
|
||||||
|
import {
|
||||||
|
SchemaSettings,
|
||||||
|
useBlockTemplateContext,
|
||||||
|
SchemaSettingsLayoutItem,
|
||||||
|
SchemaSettingsDataTemplates,
|
||||||
|
useFormBlockContext,
|
||||||
|
SchemaSettingsFormItemTemplate,
|
||||||
|
useCollection,
|
||||||
|
useCollection_deprecated,
|
||||||
|
SchemaSettingsBlockHeightItem,
|
||||||
|
SchemaSettingsBlockTitleItem,
|
||||||
|
SchemaSettingsLinkageRules,
|
||||||
|
} from '@nocobase/client';
|
||||||
|
|
||||||
|
export const bulkEditFormBlockSettings = new SchemaSettings({
|
||||||
|
name: 'blockSettings:bulkEditForm',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
name: 'title',
|
||||||
|
Component: SchemaSettingsBlockTitleItem,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'setTheBlockHeight',
|
||||||
|
Component: SchemaSettingsBlockHeightItem,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'linkageRules',
|
||||||
|
Component: SchemaSettingsLinkageRules,
|
||||||
|
useComponentProps() {
|
||||||
|
const { name } = useCollection_deprecated();
|
||||||
|
return {
|
||||||
|
collectionName: name,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'divider',
|
||||||
|
type: 'divider',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'formItemTemplate',
|
||||||
|
Component: SchemaSettingsFormItemTemplate,
|
||||||
|
useComponentProps() {
|
||||||
|
const { componentNamePrefix } = useBlockTemplateContext();
|
||||||
|
const { name } = useCollection();
|
||||||
|
const fieldSchema = useFieldSchema();
|
||||||
|
const defaultResource =
|
||||||
|
fieldSchema?.['x-decorator-props']?.resource || fieldSchema?.['x-decorator-props']?.association;
|
||||||
|
return {
|
||||||
|
componentName: `${componentNamePrefix}FormItem`,
|
||||||
|
collectionName: name,
|
||||||
|
resourceName: defaultResource,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'setBlockLayout',
|
||||||
|
Component: SchemaSettingsLayoutItem,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'divider2',
|
||||||
|
type: 'divider',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'remove',
|
||||||
|
type: 'remove',
|
||||||
|
componentProps: {
|
||||||
|
removeParentsIfNoChildren: true,
|
||||||
|
breakRemoveOn: {
|
||||||
|
'x-component': 'Grid',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
@ -39,7 +39,7 @@ export function createBulkEditBlockUISchema(options: {
|
|||||||
association,
|
association,
|
||||||
},
|
},
|
||||||
'x-toolbar': 'BlockSchemaToolbar',
|
'x-toolbar': 'BlockSchemaToolbar',
|
||||||
'x-settings': 'blockSettings:createForm',
|
'x-settings': 'blockSettings:bulkEditForm',
|
||||||
'x-component': 'CardItem',
|
'x-component': 'CardItem',
|
||||||
properties: {
|
properties: {
|
||||||
[uid()]: {
|
[uid()]: {
|
||||||
|
@ -26,12 +26,14 @@ import {
|
|||||||
} from './BulkEditFormActionInitializers';
|
} from './BulkEditFormActionInitializers';
|
||||||
import { BulkEditFormItemInitializers_deprecated, bulkEditFormItemInitializers } from './BulkEditFormItemInitializers';
|
import { BulkEditFormItemInitializers_deprecated, bulkEditFormItemInitializers } from './BulkEditFormItemInitializers';
|
||||||
import { bulkEditFormItemSettings } from './bulkEditFormItemSettings';
|
import { bulkEditFormItemSettings } from './bulkEditFormItemSettings';
|
||||||
|
import { bulkEditFormBlockSettings } from './BulkEditFormBlockSettings';
|
||||||
import { BulkEditField } from './component/BulkEditField';
|
import { BulkEditField } from './component/BulkEditField';
|
||||||
import { useCustomizeBulkEditActionProps } from './utils';
|
import { useCustomizeBulkEditActionProps } from './utils';
|
||||||
export class PluginActionBulkEditClient extends Plugin {
|
export class PluginActionBulkEditClient extends Plugin {
|
||||||
async load() {
|
async load() {
|
||||||
this.app.addComponents({ BulkEditField, BulkEditActionDecorator });
|
this.app.addComponents({ BulkEditField, BulkEditActionDecorator });
|
||||||
this.app.addScopes({ useCustomizeBulkEditActionProps });
|
this.app.addScopes({ useCustomizeBulkEditActionProps });
|
||||||
|
this.app.schemaSettingsManager.add(bulkEditFormBlockSettings);
|
||||||
this.app.schemaSettingsManager.add(deprecatedBulkEditActionSettings);
|
this.app.schemaSettingsManager.add(deprecatedBulkEditActionSettings);
|
||||||
this.app.schemaSettingsManager.add(bulkEditActionSettings);
|
this.app.schemaSettingsManager.add(bulkEditActionSettings);
|
||||||
this.app.schemaSettingsManager.add(bulkEditFormSubmitActionSettings);
|
this.app.schemaSettingsManager.add(bulkEditFormSubmitActionSettings);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user