Merge branch 'main' into next

This commit is contained in:
nocobase[bot] 2025-01-20 03:59:29 +00:00
commit 994ba878fc
4 changed files with 91 additions and 2 deletions

View File

@ -48,7 +48,8 @@ export const createFormBlockSettings = new SchemaSettings({
Component: SchemaSettingsDataTemplates,
useVisible() {
const { action } = useFormBlockContext();
return !action;
const schema = useFieldSchema();
return !action && schema?.['x-acl-action'].includes('create');
},
useComponentProps() {
const { name } = useCollection_deprecated();

View File

@ -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',
},
},
},
],
});

View File

@ -39,7 +39,7 @@ export function createBulkEditBlockUISchema(options: {
association,
},
'x-toolbar': 'BlockSchemaToolbar',
'x-settings': 'blockSettings:createForm',
'x-settings': 'blockSettings:bulkEditForm',
'x-component': 'CardItem',
properties: {
[uid()]: {

View File

@ -26,12 +26,14 @@ import {
} from './BulkEditFormActionInitializers';
import { BulkEditFormItemInitializers_deprecated, bulkEditFormItemInitializers } from './BulkEditFormItemInitializers';
import { bulkEditFormItemSettings } from './bulkEditFormItemSettings';
import { bulkEditFormBlockSettings } from './BulkEditFormBlockSettings';
import { BulkEditField } from './component/BulkEditField';
import { useCustomizeBulkEditActionProps } from './utils';
export class PluginActionBulkEditClient extends Plugin {
async load() {
this.app.addComponents({ BulkEditField, BulkEditActionDecorator });
this.app.addScopes({ useCustomizeBulkEditActionProps });
this.app.schemaSettingsManager.add(bulkEditFormBlockSettings);
this.app.schemaSettingsManager.add(deprecatedBulkEditActionSettings);
this.app.schemaSettingsManager.add(bulkEditActionSettings);
this.app.schemaSettingsManager.add(bulkEditFormSubmitActionSettings);