diff --git a/packages/core/client/src/css-variable/CSSVariableProvider.tsx b/packages/core/client/src/css-variable/CSSVariableProvider.tsx index fd6fb67b7a..ad9dd732d7 100644 --- a/packages/core/client/src/css-variable/CSSVariableProvider.tsx +++ b/packages/core/client/src/css-variable/CSSVariableProvider.tsx @@ -30,6 +30,8 @@ export const CSSVariableProvider = ({ children }) => { document.body.style.setProperty('--marginSM', `${token.marginSM}px`); document.body.style.setProperty('--colorInfoBg', token.colorInfoBg); document.body.style.setProperty('--colorInfoBorder', token.colorInfoBorder); + document.body.style.setProperty('--colorWarningBg', token.colorWarningBg); + document.body.style.setProperty('--colorWarningBorder', token.colorWarningBorder); document.body.style.setProperty('--colorText', token.colorText); document.body.style.setProperty('--colorPrimaryText', token.colorPrimaryText); document.body.style.setProperty('--colorPrimaryTextActive', token.colorPrimaryTextActive); diff --git a/packages/plugins/@nocobase/plugin-export/src/client/ExportDesigner.tsx b/packages/plugins/@nocobase/plugin-export/src/client/ExportDesigner.tsx index 8f02fa317c..f765cf8e5c 100644 --- a/packages/plugins/@nocobase/plugin-export/src/client/ExportDesigner.tsx +++ b/packages/plugins/@nocobase/plugin-export/src/client/ExportDesigner.tsx @@ -10,13 +10,13 @@ import { useDesignable, } from '@nocobase/client'; import React, { useEffect, useState } from 'react'; -import { useTranslation } from 'react-i18next'; import { useShared } from './useShared'; +import { useExportTranslation } from './locale'; export const ExportDesigner = () => { const field = useField(); const fieldSchema = useFieldSchema(); - const { t } = useTranslation(); + const { t } = useExportTranslation(); const { dn } = useDesignable(); const [schema, setSchema] = useState(); const { schema: pageSchema } = useShared(); @@ -94,6 +94,7 @@ export const ExportDesigner = () => { title={t('Exportable fields')} schema={schema} initialValues={{ exportSettings: fieldSchema?.['x-action-settings']?.exportSettings }} + scope={{ t }} components={{ ArrayItems }} onSubmit={({ exportSettings }) => { fieldSchema['x-action-settings']['exportSettings'] = exportSettings diff --git a/packages/plugins/@nocobase/plugin-export/src/client/locale/index.ts b/packages/plugins/@nocobase/plugin-export/src/client/locale/index.ts new file mode 100644 index 0000000000..2c705192ee --- /dev/null +++ b/packages/plugins/@nocobase/plugin-export/src/client/locale/index.ts @@ -0,0 +1,7 @@ +import { useTranslation } from 'react-i18next'; + +export const NAMESPACE = 'export'; + +export function useExportTranslation() { + return useTranslation([NAMESPACE, 'client'], { nsMode: 'fallback' }); +} diff --git a/packages/plugins/@nocobase/plugin-export/src/client/useExportAction.ts b/packages/plugins/@nocobase/plugin-export/src/client/useExportAction.ts index ecb98aca4c..148fcd7087 100644 --- a/packages/plugins/@nocobase/plugin-export/src/client/useExportAction.ts +++ b/packages/plugins/@nocobase/plugin-export/src/client/useExportAction.ts @@ -8,7 +8,8 @@ import { } from '@nocobase/client'; import lodash from 'lodash'; import { saveAs } from 'file-saver'; -import { useTranslation } from 'react-i18next'; +import { App } from 'antd'; +import { useExportTranslation } from './locale'; export const useExportAction = () => { const { service, resource } = useBlockRequestContext(); @@ -17,9 +18,17 @@ export const useExportAction = () => { const compile = useCompile(); const { getCollectionJoinField } = useCollectionManager_deprecated(); const { name, title, getField } = useCollection_deprecated(); - const { t } = useTranslation(); + const { t } = useExportTranslation(); + const { modal } = App.useApp(); return { async onClick() { + const confirmed = await modal.confirm({ + title: t('Export'), + content: t('Export warning'), + }); + if (!confirmed) { + return; + } const { exportSettings } = lodash.cloneDeep(actionSchema?.['x-action-settings'] ?? {}); exportSettings.forEach((es) => { const { uiSchema, interface: fieldInterface } = diff --git a/packages/plugins/@nocobase/plugin-export/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-export/src/locale/en-US.json new file mode 100644 index 0000000000..ef90998f42 --- /dev/null +++ b/packages/plugins/@nocobase/plugin-export/src/locale/en-US.json @@ -0,0 +1,3 @@ +{ + "Export warning": "Only a small amount of data can be exported (preferably within 1000 rows), and a large amount of data will cause the system to freeze. Please use the Action: Export records pro plugin for large data exports." +} diff --git a/packages/plugins/@nocobase/plugin-export/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-export/src/locale/zh-CN.json new file mode 100644 index 0000000000..fe4cfd9082 --- /dev/null +++ b/packages/plugins/@nocobase/plugin-export/src/locale/zh-CN.json @@ -0,0 +1,3 @@ +{ + "Export warning": "仅支持少量数据导出(最好1000行以内),大量数据会导致系统卡住。请通过 Action: Export records pro 插件实现大量数据导出。" +} diff --git a/packages/plugins/@nocobase/plugin-import/src/client/ImportActionInitializer.tsx b/packages/plugins/@nocobase/plugin-import/src/client/ImportActionInitializer.tsx index 1156e7f618..72cdb89c35 100644 --- a/packages/plugins/@nocobase/plugin-import/src/client/ImportActionInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-import/src/client/ImportActionInitializer.tsx @@ -85,6 +85,21 @@ export const ImportActionInitializer = () => { type: 'void', 'x-component': 'FormLayout', properties: { + warning: { + type: 'void', + 'x-component': 'Markdown.Void', + 'x-editable': false, + 'x-component-props': { + style: { + padding: `var(--paddingContentVerticalSM)`, + backgroundColor: `var(--colorWarningBg)`, + border: `1px solid var(--colorWarningBorder)`, + color: `var(--colorText)`, + marginBottom: `var(--marginSM)`, + }, + content: `{{ t("Import warning", {ns: "${NAMESPACE}" }) }}`, + }, + }, download: { type: 'void', title: `{{ t("Step 1: Download template", {ns: "${NAMESPACE}" }) }}`, diff --git a/packages/plugins/@nocobase/plugin-import/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-import/src/locale/en-US.json index b21d2b3ac3..fd1cf84a82 100644 --- a/packages/plugins/@nocobase/plugin-import/src/locale/en-US.json +++ b/packages/plugins/@nocobase/plugin-import/src/locale/en-US.json @@ -8,7 +8,8 @@ "Download template": "Download template", "Step 1: Download template": "Step 1: Download template", "Step 2: Upload Excel": "Step 2: Upload Excel", - "Download tip": "- Download the template and fill in the data according to the format \r\n - Import only the first worksheet \r\n - Support single import of up to 10,000 rows of data \r\n - Do not change the header of the template to prevent import failure", + "Download tip": "- Download the template and fill in the data according to the format \r\n - Import only the first worksheet \r\n - Support single import of up to 1,000 rows of data \r\n - Do not change the header of the template to prevent import failure", + "Import warning": "Only a small amount of data can be imported (preferably within 1000 rows), and a large amount of data will cause the system to freeze. Please use the Action: Import records pro plugin for large data imports.", "Upload placeholder": "Drag and drop the file here or click to upload, file size should not exceed 30M", "Excel data importing": "Excel data importing", "Import done, total success have {{successCount}} , total failure have {{failureCount}}": "Import is complete, with a total of {{successCount}} successful and {{failureCount}} failed", diff --git a/packages/plugins/@nocobase/plugin-import/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-import/src/locale/zh-CN.json index 40b5e0a888..b7e318643c 100644 --- a/packages/plugins/@nocobase/plugin-import/src/locale/zh-CN.json +++ b/packages/plugins/@nocobase/plugin-import/src/locale/zh-CN.json @@ -8,7 +8,8 @@ "Download template": "下载模板", "Step 1: Download template": "1.下载模板", "Step 2: Upload Excel": "2.上传完善后的表格", - "Download tip": "- 下载模板后,按格式填写数据\r\n - 只导入第一张工作表\r\n - 支持单次导入不超过10000行数据\r\n - 请勿改模板表头,防止导入失败", + "Download tip": "- 下载模板后,按格式填写数据\r\n - 只导入第一张工作表\r\n - 支持单次导入不超过1000行数据\r\n - 请勿改模板表头,防止导入失败", + "Import warning": "仅支持少量数据导入(最好1000行以内),大量数据会导致系统卡住。请通过 Action: Import records pro 插件实现大量数据导入。", "Upload placeholder": "将文件拖曳到此处或点击上传,文件大小不超过10M", "Excel data importing": "数据导入中,请勿关闭窗口", "Import done, total success have {{successCount}} , total failure have {{failureCount}}": "导入完成,共导入成功{{successCount}}条数据,共导入失败{{failureCount}}条数据",