mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
Merge branch 'next' into develop
This commit is contained in:
commit
9992b5fd75
@ -47,6 +47,10 @@ export const updateSubmitActionSettings = new SchemaSettings({
|
|||||||
collectionName: name,
|
collectionName: name,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
useVisible() {
|
||||||
|
const fieldSchema = useFieldSchema();
|
||||||
|
return !fieldSchema.parent['x-initializer'].includes('bulkEditForm');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'secondConfirmation',
|
name: 'secondConfirmation',
|
||||||
@ -63,10 +67,18 @@ export const updateSubmitActionSettings = new SchemaSettings({
|
|||||||
{
|
{
|
||||||
name: 'assignFieldValues',
|
name: 'assignFieldValues',
|
||||||
Component: AssignedFieldValues,
|
Component: AssignedFieldValues,
|
||||||
|
useVisible() {
|
||||||
|
const fieldSchema = useFieldSchema();
|
||||||
|
return !fieldSchema.parent['x-initializer'].includes('bulkEditForm');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'skipRequiredValidation',
|
name: 'skipRequiredValidation',
|
||||||
Component: SkipValidation,
|
Component: SkipValidation,
|
||||||
|
useVisible() {
|
||||||
|
const fieldSchema = useFieldSchema();
|
||||||
|
return !fieldSchema.parent['x-initializer'].includes('bulkEditForm');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'afterSuccessfulSubmission',
|
name: 'afterSuccessfulSubmission',
|
||||||
|
@ -18,8 +18,13 @@ import {
|
|||||||
useDesignable,
|
useDesignable,
|
||||||
useOpenModeContext,
|
useOpenModeContext,
|
||||||
useSchemaToolbar,
|
useSchemaToolbar,
|
||||||
|
SecondConFirm,
|
||||||
|
WorkflowConfig,
|
||||||
|
AfterSuccess,
|
||||||
|
RefreshDataBlockRequest,
|
||||||
} from '@nocobase/client';
|
} from '@nocobase/client';
|
||||||
import { ModalProps } from 'antd';
|
import { ModalProps } from 'antd';
|
||||||
|
import { isValid } from '@formily/shared';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
@ -165,3 +170,53 @@ export const bulkEditActionSettings = new SchemaSettings({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
/**
|
||||||
|
* 批量编辑表单的submit 按钮
|
||||||
|
*/
|
||||||
|
export const bulkEditFormSubmitActionSettings = new SchemaSettings({
|
||||||
|
name: 'actionSettings:bulkEditSubmit',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
name: 'editButton',
|
||||||
|
Component: ActionDesigner.ButtonEditor,
|
||||||
|
useComponentProps() {
|
||||||
|
const { buttonEditorProps } = useSchemaToolbar();
|
||||||
|
return buttonEditorProps;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'secondConfirmation',
|
||||||
|
Component: SecondConFirm,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'workflowConfig',
|
||||||
|
Component: WorkflowConfig,
|
||||||
|
useVisible() {
|
||||||
|
const fieldSchema = useFieldSchema();
|
||||||
|
return isValid(fieldSchema?.['x-action-settings']?.triggerWorkflows);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'afterSuccessfulSubmission',
|
||||||
|
Component: AfterSuccess,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'refreshDataBlockRequest',
|
||||||
|
Component: RefreshDataBlockRequest,
|
||||||
|
useComponentProps() {
|
||||||
|
return {
|
||||||
|
isPopupAction: true,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'remove',
|
||||||
|
sort: 100,
|
||||||
|
Component: RemoveButton as any,
|
||||||
|
useComponentProps() {
|
||||||
|
const { removeButtonProps } = useSchemaToolbar();
|
||||||
|
return removeButtonProps;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
@ -18,7 +18,7 @@ export const BulkEditSubmitActionInitializer = (props) => {
|
|||||||
'x-use-component-props': 'useCustomizeBulkEditActionProps',
|
'x-use-component-props': 'useCustomizeBulkEditActionProps',
|
||||||
// 'x-designer': 'Action.Designer',
|
// 'x-designer': 'Action.Designer',
|
||||||
'x-toolbar': 'ActionSchemaToolbar',
|
'x-toolbar': 'ActionSchemaToolbar',
|
||||||
'x-settings': 'actionSettings:updateSubmit',
|
'x-settings': 'actionSettings:bulkEditSubmit',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
htmlType: 'submit',
|
htmlType: 'submit',
|
||||||
|
@ -8,7 +8,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Plugin, useActionAvailable } from '@nocobase/client';
|
import { Plugin, useActionAvailable } from '@nocobase/client';
|
||||||
import { bulkEditActionSettings, deprecatedBulkEditActionSettings } from './BulkEditAction.Settings';
|
import {
|
||||||
|
bulkEditActionSettings,
|
||||||
|
deprecatedBulkEditActionSettings,
|
||||||
|
bulkEditFormSubmitActionSettings,
|
||||||
|
} from './BulkEditAction.Settings';
|
||||||
import { BulkEditActionDecorator } from './BulkEditActionDecorator';
|
import { BulkEditActionDecorator } from './BulkEditActionDecorator';
|
||||||
import { BulkEditActionInitializer } from './BulkEditActionInitializer';
|
import { BulkEditActionInitializer } from './BulkEditActionInitializer';
|
||||||
import {
|
import {
|
||||||
@ -30,6 +34,7 @@ export class PluginActionBulkEditClient extends Plugin {
|
|||||||
this.app.addScopes({ useCustomizeBulkEditActionProps });
|
this.app.addScopes({ useCustomizeBulkEditActionProps });
|
||||||
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(bulkEditFormItemSettings);
|
this.app.schemaSettingsManager.add(bulkEditFormItemSettings);
|
||||||
this.app.schemaInitializerManager.add(BulkEditFormItemInitializers_deprecated);
|
this.app.schemaInitializerManager.add(BulkEditFormItemInitializers_deprecated);
|
||||||
this.app.schemaInitializerManager.add(bulkEditFormItemInitializers);
|
this.app.schemaInitializerManager.add(bulkEditFormItemInitializers);
|
||||||
|
@ -88,7 +88,6 @@ export const useCustomizeBulkEditActionProps = () => {
|
|||||||
const actionField = useField();
|
const actionField = useField();
|
||||||
const tableBlockContext = useTableBlockContext();
|
const tableBlockContext = useTableBlockContext();
|
||||||
const { modal } = App.useApp();
|
const { modal } = App.useApp();
|
||||||
|
|
||||||
const { rowKey } = tableBlockContext;
|
const { rowKey } = tableBlockContext;
|
||||||
const selectedRecordKeys =
|
const selectedRecordKeys =
|
||||||
tableBlockContext.field?.data?.selectedRowKeys ?? expressionScope?.selectedRecordKeys ?? {};
|
tableBlockContext.field?.data?.selectedRowKeys ?? expressionScope?.selectedRecordKeys ?? {};
|
||||||
@ -98,6 +97,7 @@ export const useCustomizeBulkEditActionProps = () => {
|
|||||||
async onClick() {
|
async onClick() {
|
||||||
const { updateMode } = actionSchema?.['x-action-settings'] ?? {};
|
const { updateMode } = actionSchema?.['x-action-settings'] ?? {};
|
||||||
const { onSuccess, skipValidator, triggerWorkflows } = fieldSchema?.['x-action-settings'] ?? {};
|
const { onSuccess, skipValidator, triggerWorkflows } = fieldSchema?.['x-action-settings'] ?? {};
|
||||||
|
const { refreshDataBlockRequest } = fieldSchema?.['x-component-props'] ?? {};
|
||||||
const { manualClose, redirecting, redirectTo, successMessage, actionAfterSuccess } = onSuccess || {};
|
const { manualClose, redirecting, redirectTo, successMessage, actionAfterSuccess } = onSuccess || {};
|
||||||
const { filter } = __parent.service.params?.[0] ?? {};
|
const { filter } = __parent.service.params?.[0] ?? {};
|
||||||
|
|
||||||
@ -125,13 +125,13 @@ export const useCustomizeBulkEditActionProps = () => {
|
|||||||
}
|
}
|
||||||
await resource.update(updateData);
|
await resource.update(updateData);
|
||||||
actionField.data.loading = false;
|
actionField.data.loading = false;
|
||||||
if (!(resource instanceof TableFieldResource)) {
|
|
||||||
__parent?.__parent?.service?.refresh?.();
|
|
||||||
}
|
|
||||||
if (actionAfterSuccess === 'previous' || (!actionAfterSuccess && redirecting !== true)) {
|
if (actionAfterSuccess === 'previous' || (!actionAfterSuccess && redirecting !== true)) {
|
||||||
setVisible?.(false);
|
setVisible?.(false);
|
||||||
}
|
}
|
||||||
setSubmitted(true);
|
if (refreshDataBlockRequest !== false) {
|
||||||
|
setSubmitted(true);
|
||||||
|
}
|
||||||
if (!successMessage) {
|
if (!successMessage) {
|
||||||
if (((redirecting && !actionAfterSuccess) || actionAfterSuccess === 'redirect') && redirectTo) {
|
if (((redirecting && !actionAfterSuccess) || actionAfterSuccess === 'redirect') && redirectTo) {
|
||||||
if (isURL(redirectTo)) {
|
if (isURL(redirectTo)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user