diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts
index 303cb49ad4..add038de26 100644
--- a/packages/core/client/src/block-provider/hooks/index.ts
+++ b/packages/core/client/src/block-provider/hooks/index.ts
@@ -15,7 +15,6 @@ import { useFilterBlock } from '../../filter-provider/FilterProvider';
import { transformToFilter } from '../../filter-provider/utils';
import { useRecord } from '../../record-provider';
import { removeNullCondition, useActionContext, useCompile } from '../../schema-component';
-import { BulkEditFormItemValueType } from '../../schema-initializer/components';
import { useCurrentUserContext } from '../../user';
import { useLocalVariables, useVariables } from '../../variables';
import { isVariable } from '../../variables/utils/isVariable';
@@ -680,94 +679,6 @@ export const useCustomizeBulkUpdateActionProps = () => {
};
};
-export const useCustomizeBulkEditActionProps = () => {
- const form = useForm();
- const { t } = useTranslation();
- const { field, resource, __parent } = useBlockRequestContext();
- const expressionScope = useContext(SchemaExpressionScopeContext);
- const actionContext = useActionContext();
- const navigate = useNavigate();
- const compile = useCompile();
- const actionField = useField();
- const tableBlockContext = useTableBlockContext();
- const { modal } = App.useApp();
-
- const { rowKey } = tableBlockContext;
- const selectedRecordKeys =
- tableBlockContext.field?.data?.selectedRowKeys ?? expressionScope?.selectedRecordKeys ?? {};
- const { setVisible, fieldSchema: actionSchema } = actionContext;
- return {
- async onClick() {
- const { onSuccess, skipValidator, updateMode } = actionSchema?.['x-action-settings'] ?? {};
- const { filter } = __parent.service.params?.[0] ?? {};
- if (!skipValidator) {
- await form.submit();
- }
- const values = cloneDeep(form.values);
- actionField.data = field.data || {};
- actionField.data.loading = true;
- for (const key in values) {
- if (Object.prototype.hasOwnProperty.call(values, key)) {
- const value = values[key];
- if (BulkEditFormItemValueType.Clear in value) {
- values[key] = null;
- } else if (BulkEditFormItemValueType.ChangedTo in value) {
- values[key] = value[BulkEditFormItemValueType.ChangedTo];
- } else if (BulkEditFormItemValueType.RemainsTheSame in value) {
- delete values[key];
- }
- }
- }
- try {
- const updateData: { filter?: any; values: any; forceUpdate: boolean } = {
- values,
- filter,
- forceUpdate: false,
- };
- if (updateMode === 'selected') {
- if (!selectedRecordKeys?.length) {
- message.error(t('Please select the records to be updated'));
- return;
- }
- updateData.filter = { $and: [{ [rowKey || 'id']: { $in: selectedRecordKeys } }] };
- }
- if (!updateData.filter) {
- updateData.forceUpdate = true;
- }
- await resource.update(updateData);
- actionField.data.loading = false;
- if (!(resource instanceof TableFieldResource)) {
- __parent?.__parent?.service?.refresh?.();
- }
- __parent?.service?.refresh?.();
- setVisible?.(false);
- if (!onSuccess?.successMessage) {
- return;
- }
- if (onSuccess?.manualClose) {
- modal.success({
- title: compile(onSuccess?.successMessage),
- onOk: async () => {
- await form.reset();
- if (onSuccess?.redirecting && onSuccess?.redirectTo) {
- if (isURL(onSuccess.redirectTo)) {
- window.location.href = onSuccess.redirectTo;
- } else {
- navigate(onSuccess.redirectTo);
- }
- }
- },
- });
- } else {
- message.success(compile(onSuccess?.successMessage));
- }
- } finally {
- actionField.data.loading = false;
- }
- },
- };
-};
-
export const useCustomizeRequestActionProps = () => {
const apiClient = useAPIClient();
const navigate = useNavigate();
diff --git a/packages/core/client/src/schema-initializer/buttons/FormActionInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/FormActionInitializers.tsx
index 65868c4ee4..f0eaca5781 100644
--- a/packages/core/client/src/schema-initializer/buttons/FormActionInitializers.tsx
+++ b/packages/core/client/src/schema-initializer/buttons/FormActionInitializers.tsx
@@ -282,119 +282,3 @@ export const updateFormActionInitializers = new SchemaInitializer({
},
],
});
-
-export const bulkEditFormActionInitializers = new SchemaInitializer({
- name: 'BulkEditFormActionInitializers',
- title: '{{t("Configure actions")}}',
- icon: 'SettingOutlined',
- items: [
- {
- type: 'itemGroup',
- title: '{{t("Enable actions")}}',
- name: 'enableActions',
- children: [
- {
- name: 'submit',
- title: '{{t("Submit")}}',
- Component: 'BulkEditSubmitActionInitializer',
- schema: {
- 'x-action-settings': {},
- },
- },
- ],
- },
- {
- name: 'divider',
- type: 'divider',
- },
- {
- type: 'subMenu',
- title: '{{t("Customize")}}',
- name: 'customize',
- children: [
- {
- name: 'popup',
- title: '{{t("Popup")}}',
- Component: 'CustomizeActionInitializer',
- schema: {
- type: 'void',
- title: '{{ t("Popup") }}',
- 'x-action': 'customize:popup',
- 'x-designer': 'Action.Designer',
- 'x-component': 'Action',
- 'x-component-props': {
- openMode: 'drawer',
- },
- properties: {
- drawer: {
- type: 'void',
- title: '{{ t("Popup") }}',
- 'x-component': 'Action.Container',
- 'x-component-props': {
- className: 'nb-action-popup',
- },
- properties: {
- tabs: {
- type: 'void',
- 'x-component': 'Tabs',
- 'x-component-props': {},
- 'x-initializer': 'TabPaneInitializers',
- properties: {
- tab1: {
- type: 'void',
- title: '{{t("Details")}}',
- 'x-component': 'Tabs.TabPane',
- 'x-designer': 'Tabs.Designer',
- 'x-component-props': {},
- properties: {
- grid: {
- type: 'void',
- 'x-component': 'Grid',
- 'x-initializer': 'RecordBlockInitializers',
- properties: {},
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- {
- name: 'saveRecord',
- title: '{{t("Save record")}}',
- Component: 'CustomizeActionInitializer',
- schema: {
- title: '{{ t("Save") }}',
- 'x-component': 'Action',
- 'x-action': 'customize:save',
- 'x-designer': 'Action.Designer',
- 'x-designer-props': {
- modalTip:
- '{{ t("When the button is clicked, the following fields will be assigned and saved together with the fields in the form. If there are overlapping fields, the value here will overwrite the value in the form.") }}',
- },
- 'x-action-settings': {
- assignedValues: {},
- skipValidator: false,
- onSuccess: {
- manualClose: true,
- redirecting: false,
- successMessage: '{{t("Submitted successfully")}}',
- },
- },
- 'x-component-props': {
- useProps: '{{ useUpdateActionProps }}',
- },
- },
- },
- {
- name: 'customRequest',
- title: '{{t("Custom request")}}',
- Component: 'CustomRequestInitializer',
- },
- ],
- },
- ],
-});
diff --git a/packages/core/client/src/schema-initializer/components/index.ts b/packages/core/client/src/schema-initializer/components/index.ts
index 4073716e51..adc976fa4b 100644
--- a/packages/core/client/src/schema-initializer/components/index.ts
+++ b/packages/core/client/src/schema-initializer/components/index.ts
@@ -1,3 +1,2 @@
export * from './assigned-field';
-export * from './BulkEditField';
export * from './CreateRecordAction';
diff --git a/packages/core/client/src/schema-initializer/index.ts b/packages/core/client/src/schema-initializer/index.ts
index da7a8ce3fe..e49b592b35 100644
--- a/packages/core/client/src/schema-initializer/index.ts
+++ b/packages/core/client/src/schema-initializer/index.ts
@@ -1,7 +1,6 @@
import { Plugin } from '../application/Plugin';
import {
blockInitializers,
- bulkEditFormActionInitializers,
createFormActionInitializers,
createFormBlockInitializers,
cusomeizeCreateFormBlockInitializers,
@@ -74,7 +73,6 @@ export class SchemaInitializerPlugin extends Plugin {
this.app.schemaInitializerManager.add(filterFormActionInitializers);
this.app.schemaInitializerManager.add(createFormActionInitializers);
this.app.schemaInitializerManager.add(updateFormActionInitializers);
- this.app.schemaInitializerManager.add(bulkEditFormActionInitializers);
this.app.schemaInitializerManager.add(filterFormItemInitializers);
this.app.schemaInitializerManager.add(gridCardActionInitializers);
this.app.schemaInitializerManager.add(gridCardItemActionInitializers);
diff --git a/packages/core/client/src/schema-initializer/items/index.tsx b/packages/core/client/src/schema-initializer/items/index.tsx
index 39e488556c..0702c65670 100644
--- a/packages/core/client/src/schema-initializer/items/index.tsx
+++ b/packages/core/client/src/schema-initializer/items/index.tsx
@@ -6,7 +6,6 @@ export * from '../../schema-component/antd/association-filter/AssociationFilterD
export * from './ActionInitializer';
export * from './BlockInitializer';
export * from './BulkDestroyActionInitializer';
-export * from './BulkEditSubmitActionInitializer';
export * from './CollectionFieldInitializer';
export * from './CreateActionInitializer';
export * from './CreateChildInitializer';
diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditFormActionInitializers.tsx b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditFormActionInitializers.tsx
new file mode 100644
index 0000000000..f0efb8e5a7
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditFormActionInitializers.tsx
@@ -0,0 +1,116 @@
+import { SchemaInitializer } from '@nocobase/client';
+export const BulkEditFormActionInitializers = new SchemaInitializer({
+ name: 'BulkEditFormActionInitializers',
+ title: '{{t("Configure actions")}}',
+ icon: 'SettingOutlined',
+ items: [
+ {
+ type: 'itemGroup',
+ title: '{{t("Enable actions")}}',
+ name: 'enableActions',
+ children: [
+ {
+ name: 'submit',
+ title: '{{t("Submit")}}',
+ Component: 'BulkEditSubmitActionInitializer',
+ schema: {
+ 'x-action-settings': {},
+ },
+ },
+ ],
+ },
+ {
+ name: 'divider',
+ type: 'divider',
+ },
+ {
+ type: 'subMenu',
+ title: '{{t("Customize")}}',
+ name: 'customize',
+ children: [
+ {
+ name: 'popup',
+ title: '{{t("Popup")}}',
+ Component: 'CustomizeActionInitializer',
+ schema: {
+ type: 'void',
+ title: '{{ t("Popup") }}',
+ 'x-action': 'customize:popup',
+ 'x-designer': 'Action.Designer',
+ 'x-component': 'Action',
+ 'x-component-props': {
+ openMode: 'drawer',
+ },
+ properties: {
+ drawer: {
+ type: 'void',
+ title: '{{ t("Popup") }}',
+ 'x-component': 'Action.Container',
+ 'x-component-props': {
+ className: 'nb-action-popup',
+ },
+ properties: {
+ tabs: {
+ type: 'void',
+ 'x-component': 'Tabs',
+ 'x-component-props': {},
+ 'x-initializer': 'TabPaneInitializers',
+ properties: {
+ tab1: {
+ type: 'void',
+ title: '{{t("Details")}}',
+ 'x-component': 'Tabs.TabPane',
+ 'x-designer': 'Tabs.Designer',
+ 'x-component-props': {},
+ properties: {
+ grid: {
+ type: 'void',
+ 'x-component': 'Grid',
+ 'x-initializer': 'RecordBlockInitializers',
+ properties: {},
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ {
+ name: 'saveRecord',
+ title: '{{t("Save record")}}',
+ Component: 'CustomizeActionInitializer',
+ schema: {
+ title: '{{ t("Save") }}',
+ 'x-component': 'Action',
+ 'x-action': 'customize:save',
+ 'x-designer': 'Action.Designer',
+ 'x-designer-props': {
+ modalTip:
+ '{{ t("When the button is clicked, the following fields will be assigned and saved together with the fields in the form. If there are overlapping fields, the value here will overwrite the value in the form.") }}',
+ },
+ 'x-action-settings': {
+ assignedValues: {},
+ skipValidator: false,
+ onSuccess: {
+ manualClose: true,
+ redirecting: false,
+ successMessage: '{{t("Submitted successfully")}}',
+ },
+ },
+ 'x-component-props': {
+ useProps: '{{ useUpdateActionProps }}',
+ },
+ },
+ },
+ {
+ name: 'customRequest',
+ title: '{{t("Custom request")}}',
+ Component: 'CustomRequestInitializer',
+ },
+ ],
+ },
+ ],
+});
diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditPluginProvider.tsx b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditPluginProvider.tsx
index 07ecf0a368..3b3e01c412 100644
--- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditPluginProvider.tsx
+++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditPluginProvider.tsx
@@ -2,14 +2,19 @@ import { SchemaComponentOptions } from '@nocobase/client';
import React from 'react';
import { CustomizeBulkEditActionInitializer } from './CustomizeBulkEditActionInitializer';
import { CreateFormBulkEditBlockInitializer } from './CreateFormBulkEditBlockInitializer';
-
+import { BulkEditSubmitActionInitializer } from './BulkEditSubmitActionInitializer';
+import { useCustomizeBulkEditActionProps } from './utils';
+import { BulkEditField } from './component/BulkEditField';
export const BulkEditPluginProvider = (props: any) => {
return (