@fe-free/core 4.0.4 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 5.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat: i18n
8
+
9
+ ### Patch Changes
10
+
11
+ - @fe-free/icons@5.0.0
12
+ - @fe-free/tool@5.0.0
13
+
14
+ ## 4.0.5
15
+
16
+ ### Patch Changes
17
+
18
+ - @fe-free/icons@4.0.5
19
+ - @fe-free/tool@4.0.5
20
+
3
21
  ## 4.0.4
4
22
 
5
23
  ### Patch Changes
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'i18next-cli';
2
+
3
+ export default defineConfig({
4
+ locales: ['zh-CN', 'en-US'],
5
+ extract: {
6
+ primaryLanguage: 'zh-CN',
7
+ secondaryLanguages: ['en-US'],
8
+ input: ['./src/**/*.{js,jsx,ts,tsx}'],
9
+ output: './src/locales/{{language}}/{{namespace}}.json',
10
+ },
11
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "4.0.4",
3
+ "version": "5.0.0",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -50,10 +50,10 @@
50
50
  "i18next-icu": "^2.4.1",
51
51
  "react": "^19.2.0",
52
52
  "react-i18next": "^16.4.0",
53
- "@fe-free/tool": "4.0.4",
54
- "@fe-free/icons": "4.0.4"
53
+ "@fe-free/icons": "5.0.0",
54
+ "@fe-free/tool": "5.0.0"
55
55
  },
56
56
  "scripts": {
57
- "test": "echo \"Error: no test specified\" && exit 1"
57
+ "i18n-extract": "rm -rf ./src/locales/zh-CN && npx i18next-cli extract"
58
58
  }
59
59
  }
@@ -22,11 +22,17 @@ function getPathname(src?: string) {
22
22
 
23
23
  function CheckUpdate({ basename }: { basename: string }) {
24
24
  const { modal } = App.useApp();
25
+ const { t } = useTranslation();
25
26
 
26
27
  useEffect(() => {
27
28
  const mainScript = document.querySelector('[data-name="mainScript"]');
28
29
  if (!mainScript) {
29
- console.log('没找到 [data-name="mainScript"],不启用更新提醒');
30
+ console.log(
31
+ t(
32
+ '@fe-free/core.app.mainScriptNotFound',
33
+ '没找到 [data-name="mainScript"],不启用更新提醒',
34
+ ),
35
+ );
30
36
  return;
31
37
  }
32
38
 
@@ -48,10 +54,10 @@ function CheckUpdate({ basename }: { basename: string }) {
48
54
  }
49
55
 
50
56
  modal.confirm({
51
- title: '发现新版本',
52
- content: '请及时刷新页面更新,以避免影响使用',
53
- okText: '刷新',
54
- cancelText: '稍后更新',
57
+ title: t('@fe-free/core.app.newVersionFound', '发现新版本'),
58
+ content: t('@fe-free/core.app.refreshPrompt', '请及时刷新页面更新,以避免影响使用'),
59
+ okText: t('@fe-free/core.app.refresh', '刷新'),
60
+ cancelText: t('@fe-free/core.app.updateLater', '稍后更新'),
55
61
  onOk: () => {
56
62
  window.location.reload();
57
63
  },
@@ -80,7 +86,7 @@ function CheckUpdate({ basename }: { basename: string }) {
80
86
  return () => {
81
87
  clearInterval(timer);
82
88
  };
83
- }, []);
89
+ }, [t]);
84
90
 
85
91
  return null;
86
92
  }
@@ -148,13 +154,12 @@ function CoreAppBase(props: CoreAppProps) {
148
154
  }, [configProviderProps?.locale, i18n.language]);
149
155
 
150
156
  return (
151
- <ProConfigProvider
152
- {...proConfigProviderProps}
153
- // 集成好 customValueTypeMap
154
- valueTypeMap={{ ...customValueTypeMap, ...proConfigProviderProps?.valueTypeMap }}
155
- >
156
- {/* 集成好 locale */}
157
- <ConfigProvider {...configProviderProps} locale={locale} theme={theme}>
157
+ <ConfigProvider {...configProviderProps} locale={locale} theme={theme}>
158
+ <ProConfigProvider
159
+ {...proConfigProviderProps}
160
+ // 集成好 customValueTypeMap
161
+ valueTypeMap={{ ...customValueTypeMap, ...proConfigProviderProps?.valueTypeMap }}
162
+ >
158
163
  <App
159
164
  {...appProps}
160
165
  className={classNames('fec-app', appProps?.className, {
@@ -167,8 +172,8 @@ function CoreAppBase(props: CoreAppProps) {
167
172
  {children}
168
173
  </Router>
169
174
  </App>
170
- </ConfigProvider>
171
- </ProConfigProvider>
175
+ </ProConfigProvider>
176
+ </ConfigProvider>
172
177
  );
173
178
  }
174
179
 
package/src/crud/crud.tsx CHANGED
@@ -2,6 +2,7 @@ import type { ActionType } from '@ant-design/pro-components';
2
2
  import { Button } from 'antd';
3
3
  import classNames from 'classnames';
4
4
  import { useCallback, useImperativeHandle, useMemo, useRef } from 'react';
5
+ import { useTranslation } from 'react-i18next';
5
6
  import { CRUDDetail } from './crud_detail';
6
7
  import './style.scss';
7
8
  import { getTableScroll, Table } from './table';
@@ -33,6 +34,7 @@ function CRUD<DataSource extends Record<string, any> = any, Key extends string |
33
34
  ref,
34
35
  } = props;
35
36
 
37
+ const { t } = useTranslation();
36
38
  useTips(props);
37
39
 
38
40
  const actionRef = useRef<ActionType | undefined>(undefined);
@@ -102,7 +104,7 @@ function CRUD<DataSource extends Record<string, any> = any, Key extends string |
102
104
 
103
105
  if (actions.includes('batch_delete') && requestDeleteByRecords) {
104
106
  const batchDeleteAction = {
105
- btnText: '批量删除',
107
+ btnText: t('@fe-free/core.crud.batchDelete', '批量删除'),
106
108
  danger: true,
107
109
  onClick: async (_, { selectedRows }) => {
108
110
  await requestDeleteByRecords(selectedRows);
@@ -112,7 +114,7 @@ function CRUD<DataSource extends Record<string, any> = any, Key extends string |
112
114
  }
113
115
 
114
116
  return bas;
115
- }, [actions, originBatchActions, requestDeleteByRecords]);
117
+ }, [actions, originBatchActions, requestDeleteByRecords, t]);
116
118
 
117
119
  const { rowSelection, tableAlertRender, tableAlertOptionRender } = useRowSelection<
118
120
  DataSource,
@@ -1,6 +1,7 @@
1
1
  import { DeleteOutlined } from '@fe-free/icons';
2
2
  import { App } from 'antd';
3
3
  import { useCallback } from 'react';
4
+ import { useTranslation } from 'react-i18next';
4
5
  import { OperateBtn } from './helper';
5
6
 
6
7
  interface Params {
@@ -14,14 +15,15 @@ interface Params {
14
15
  function useDelete(params: Params) {
15
16
  const { name, desc, onDelete } = params;
16
17
  const { modal } = App.useApp();
18
+ const { t } = useTranslation();
17
19
 
18
20
  const doDelete = useCallback(async () => {
19
21
  await new Promise((resolve) => {
20
22
  modal.confirm({
21
- title: `确认删除 “${name} 吗?`,
22
- content: desc || '删除后不可恢复,请谨慎操作',
23
- okText: '确定',
24
- cancelText: '取消',
23
+ title: t('@fe-free/core.crud.deleteConfirm', '确认删除 "{name}" 吗?', { name }),
24
+ content: desc || t('@fe-free/core.crud.deleteWarning', '删除后不可恢复,请谨慎操作'),
25
+ okText: t('@fe-free/core.crud.confirm', '确定'),
26
+ cancelText: t('@fe-free/core.crud.cancel', '取消'),
25
27
  onOk: () => {
26
28
  resolve(onDelete());
27
29
  },
@@ -30,7 +32,7 @@ function useDelete(params: Params) {
30
32
  },
31
33
  });
32
34
  });
33
- }, [modal, name, desc, onDelete]);
35
+ }, [modal, name, desc, onDelete, t]);
34
36
 
35
37
  return {
36
38
  doDelete,
@@ -40,10 +42,11 @@ function useDelete(params: Params) {
40
42
  function OperateDelete(props: Params) {
41
43
  const { name, desc, onDelete, operateText, disabled } = props;
42
44
  const { doDelete } = useDelete({ name, desc, onDelete, operateText });
45
+ const { t } = useTranslation();
43
46
 
44
47
  return (
45
48
  <OperateBtn
46
- title="删除"
49
+ title={t('@fe-free/core.crud.delete', '删除')}
47
50
  icon={<DeleteOutlined />}
48
51
  operateText={operateText}
49
52
  disabled={disabled}
@@ -3,6 +3,7 @@ import { App, Spin } from 'antd';
3
3
  import classNames from 'classnames';
4
4
  import { isString } from 'lodash-es';
5
5
  import { useCallback, useMemo, useState } from 'react';
6
+ import { useTranslation } from 'react-i18next';
6
7
  import type { CRUDProps } from './types';
7
8
 
8
9
  /**
@@ -15,18 +16,17 @@ import type { CRUDProps } from './types';
15
16
  type action = 'create' | 'read' | 'read_detail' | 'update' | 'delete';
16
17
 
17
18
  // 先不管类型
18
- interface CRUDDetailProps
19
- extends Pick<
20
- CRUDProps,
21
- | 'requestGetByRecord'
22
- | 'createProps'
23
- | 'readProps'
24
- | 'requestCreateByValues'
25
- | 'updateProps'
26
- | 'requestUpdateByValues'
27
- | 'detailForm'
28
- | 'detailFormInstance'
29
- > {
19
+ interface CRUDDetailProps extends Pick<
20
+ CRUDProps,
21
+ | 'requestGetByRecord'
22
+ | 'createProps'
23
+ | 'readProps'
24
+ | 'requestCreateByValues'
25
+ | 'updateProps'
26
+ | 'requestUpdateByValues'
27
+ | 'detailForm'
28
+ | 'detailFormInstance'
29
+ > {
30
30
  action: action;
31
31
  id?: string;
32
32
  record?: any;
@@ -55,6 +55,7 @@ function CRUDDetail(props: CRUDDetailProps) {
55
55
  const [loading, setLoading] = useState(id ? true : false);
56
56
  const [form] = ProForm.useForm(detailFormInstance);
57
57
  const { message } = App.useApp();
58
+ const { t } = useTranslation();
58
59
 
59
60
  const handleFinish = useCallback(
60
61
  async (values) => {
@@ -63,7 +64,7 @@ function CRUDDetail(props: CRUDDetailProps) {
63
64
  if (action === 'create' && requestCreateByValues) {
64
65
  result = await requestCreateByValues(values);
65
66
 
66
- let content = '新建成功';
67
+ let content = t('@fe-free/core.crud.createSuccess', '新建成功');
67
68
  if (createProps?.successText) {
68
69
  content = isString(createProps.successText)
69
70
  ? createProps.successText
@@ -78,7 +79,7 @@ function CRUDDetail(props: CRUDDetailProps) {
78
79
  if (action === 'update' && requestUpdateByValues) {
79
80
  result = await requestUpdateByValues(values);
80
81
 
81
- let content = '更新成功';
82
+ let content = t('@fe-free/core.crud.updateSuccess', '更新成功');
82
83
  if (updateProps?.successText) {
83
84
  content = isString(updateProps.successText)
84
85
  ? updateProps.successText
@@ -106,7 +107,16 @@ function CRUDDetail(props: CRUDDetailProps) {
106
107
  }, 10);
107
108
  }
108
109
  },
109
- [action, requestCreateByValues, requestUpdateByValues, onSuccess, createProps, updateProps],
110
+ [
111
+ action,
112
+ requestCreateByValues,
113
+ requestUpdateByValues,
114
+ onSuccess,
115
+ t,
116
+ createProps,
117
+ message,
118
+ updateProps,
119
+ ],
110
120
  );
111
121
 
112
122
  const handleOpenChange = useCallback(
@@ -172,23 +182,23 @@ function CRUDDetail(props: CRUDDetailProps) {
172
182
 
173
183
  const title = useMemo(() => {
174
184
  if (action === 'create') {
175
- return '新建';
185
+ return t('@fe-free/core.crud.create', '新建');
176
186
  }
177
187
  if (action === 'read') {
178
- return '查看';
188
+ return t('@fe-free/core.crud.read', '查看');
179
189
  }
180
190
  if (action === 'update') {
181
- return '编辑';
191
+ return t('@fe-free/core.crud.update', '编辑');
182
192
  }
183
193
 
184
194
  return '';
185
- }, [action]);
195
+ }, [action, t]);
186
196
 
187
197
  const submitter = useMemo(() => {
188
198
  const result = {
189
199
  searchConfig: {
190
- submitText: '确定',
191
- resetText: '取消',
200
+ submitText: t('@fe-free/core.crud.confirm', '确定'),
201
+ resetText: t('@fe-free/core.crud.cancel', '取消'),
192
202
  },
193
203
  };
194
204
  if (action === 'create') {
@@ -223,6 +233,7 @@ function CRUDDetail(props: CRUDDetailProps) {
223
233
  readProps?.submitText,
224
234
  updateProps?.resetText,
225
235
  updateProps?.submitText,
236
+ t,
226
237
  ]);
227
238
 
228
239
  return (
@@ -2,6 +2,7 @@ import { EditOutlined, EyeOutlined } from '@fe-free/icons';
2
2
  import { App } from 'antd';
3
3
  import { isString } from 'lodash-es';
4
4
  import { useCallback, useMemo } from 'react';
5
+ import { useTranslation } from 'react-i18next';
5
6
  import { routeTool } from '../route';
6
7
  import { OperateDelete } from './crud_delete';
7
8
  import { CRUDDetail } from './crud_detail';
@@ -20,6 +21,7 @@ function useOperate(props, detailProps, actionRef) {
20
21
  requestDeleteByRecord,
21
22
  } = props;
22
23
  const { message } = App.useApp();
24
+ const { t } = useTranslation();
23
25
 
24
26
  const idField = tableProps.rowKey || 'id';
25
27
 
@@ -27,7 +29,7 @@ function useOperate(props, detailProps, actionRef) {
27
29
  (record) => {
28
30
  return () => {
29
31
  if (requestDeleteByRecord) {
30
- let content = '删除成功';
32
+ let content = t('@fe-free/core.crud.deleteSuccess', '删除成功');
31
33
  if (deleteProps?.successText) {
32
34
  content = isString(deleteProps.successText)
33
35
  ? deleteProps.successText
@@ -42,10 +44,12 @@ function useOperate(props, detailProps, actionRef) {
42
44
  });
43
45
  }
44
46
 
45
- throw new Error('没有传 requestDeleteByRecord');
47
+ throw new Error(
48
+ t('@fe-free/core.crud.requestDeleteByRecordRequired', '没有传 requestDeleteByRecord'),
49
+ );
46
50
  };
47
51
  },
48
- [actionRef, deleteProps, message, requestDeleteByRecord],
52
+ [actionRef, deleteProps, message, requestDeleteByRecord, t],
49
53
  );
50
54
 
51
55
  const handleReload = useCallback(() => {
@@ -62,7 +66,7 @@ function useOperate(props, detailProps, actionRef) {
62
66
  if (disabled) {
63
67
  return (
64
68
  <OperateBtn
65
- title="查看"
69
+ title={t('@fe-free/core.crud.read', '查看')}
66
70
  icon={<EyeOutlined />}
67
71
  operateText={readProps?.operateText}
68
72
  disabled
@@ -77,7 +81,7 @@ function useOperate(props, detailProps, actionRef) {
77
81
  onSuccess={handleReload}
78
82
  trigger={
79
83
  <OperateBtn
80
- title="查看"
84
+ title={t('@fe-free/core.crud.read', '查看')}
81
85
  icon={<EyeOutlined />}
82
86
  operateText={readProps?.operateText}
83
87
  />
@@ -90,7 +94,7 @@ function useOperate(props, detailProps, actionRef) {
90
94
  }
91
95
  return null;
92
96
  },
93
- [detailProps, handleReload, idField, readProps],
97
+ [detailProps, handleReload, idField, readProps, t],
94
98
  );
95
99
 
96
100
  const readDetailOperate = useCallback(
@@ -101,7 +105,7 @@ function useOperate(props, detailProps, actionRef) {
101
105
  if (disabled) {
102
106
  return (
103
107
  <OperateBtn
104
- title="查看"
108
+ title={t('@fe-free/core.crud.read', '查看')}
105
109
  icon={<EyeOutlined />}
106
110
  operateText={readProps?.operateText}
107
111
  disabled
@@ -110,7 +114,7 @@ function useOperate(props, detailProps, actionRef) {
110
114
  } else {
111
115
  return (
112
116
  <OperateBtn
113
- title="查看"
117
+ title={t('@fe-free/core.crud.read', '查看')}
114
118
  icon={<EyeOutlined />}
115
119
  operateText={readProps?.operateText}
116
120
  onClick={() => {
@@ -129,7 +133,7 @@ function useOperate(props, detailProps, actionRef) {
129
133
  }
130
134
  return null;
131
135
  },
132
- [detailIdIndex, readProps],
136
+ [detailIdIndex, readProps, t],
133
137
  );
134
138
 
135
139
  const updateOperate = useCallback(
@@ -141,7 +145,7 @@ function useOperate(props, detailProps, actionRef) {
141
145
  if (disabled) {
142
146
  return (
143
147
  <OperateBtn
144
- title="编辑"
148
+ title={t('@fe-free/core.crud.update', '编辑')}
145
149
  icon={<EditOutlined />}
146
150
  operateText={updateProps?.operateText}
147
151
  disabled
@@ -156,7 +160,7 @@ function useOperate(props, detailProps, actionRef) {
156
160
  onSuccess={handleReload}
157
161
  trigger={
158
162
  <OperateBtn
159
- title="编辑"
163
+ title={t('@fe-free/core.crud.update', '编辑')}
160
164
  icon={<EditOutlined />}
161
165
  operateText={updateProps?.operateText}
162
166
  />
@@ -170,7 +174,7 @@ function useOperate(props, detailProps, actionRef) {
170
174
 
171
175
  return null;
172
176
  },
173
- [detailProps, handleReload, idField, updateProps],
177
+ [detailProps, handleReload, idField, updateProps, t],
174
178
  );
175
179
 
176
180
  const deleteOperate = useCallback(
@@ -196,7 +200,7 @@ function useOperate(props, detailProps, actionRef) {
196
200
 
197
201
  const newColumns = useMemo(() => {
198
202
  const operateColumn = {
199
- title: '操作',
203
+ title: t('@fe-free/core.crud.operate', '操作'),
200
204
  fixed: 'right',
201
205
  align: 'center',
202
206
  width: operateColumnProps?.width || 120,
@@ -253,6 +257,7 @@ function useOperate(props, detailProps, actionRef) {
253
257
  readDetailOperate,
254
258
  updateOperate,
255
259
  deleteOperate,
260
+ t,
256
261
  ]);
257
262
 
258
263
  return {
@@ -2,6 +2,7 @@ import type { ActionType } from '@ant-design/pro-components';
2
2
  import { App } from 'antd';
3
3
  import type { MutableRefObject } from 'react';
4
4
  import { useCallback, useMemo } from 'react';
5
+ import { useTranslation } from 'react-i18next';
5
6
  import { LoadingButton } from '../button';
6
7
  import type { CRUDProps } from './types';
7
8
 
@@ -15,6 +16,7 @@ function useRowSelection<DataSource, Key>({
15
16
  actionRef?: MutableRefObject<ActionType | undefined>;
16
17
  }) {
17
18
  const { modal } = App.useApp();
19
+ const { t } = useTranslation();
18
20
 
19
21
  const rowSelection = useMemo(
20
22
  () => ({
@@ -23,18 +25,23 @@ function useRowSelection<DataSource, Key>({
23
25
  [originRowSelection],
24
26
  );
25
27
 
26
- const tableAlertRender = useCallback(({ selectedRowKeys, onCleanSelected }) => {
27
- return (
28
- <div>
29
- <span>
30
- 已选 {selectedRowKeys.length} 项
31
- <a style={{ marginInlineStart: 8 }} onClick={onCleanSelected}>
32
- 取消选择
33
- </a>
34
- </span>
35
- </div>
36
- );
37
- }, []);
28
+ const tableAlertRender = useCallback(
29
+ ({ selectedRowKeys, onCleanSelected }) => {
30
+ return (
31
+ <div>
32
+ <span>
33
+ {t('@fe-free/core.crud.selectedItems', '已选 {num} 项', {
34
+ num: selectedRowKeys.length,
35
+ })}
36
+ <a style={{ marginInlineStart: 8 }} onClick={onCleanSelected}>
37
+ {t('@fe-free/core.crud.clearSelection', '取消选择')}
38
+ </a>
39
+ </span>
40
+ </div>
41
+ );
42
+ },
43
+ [t],
44
+ );
38
45
 
39
46
  const tableAlertOptionRender = useCallback(
40
47
  ({ selectedRowKeys, selectedRows }) => {
@@ -51,7 +58,13 @@ function useRowSelection<DataSource, Key>({
51
58
  if (action.danger) {
52
59
  await new Promise((resolve) => {
53
60
  modal.confirm({
54
- title: `确定要执行 ${action.btnText} 吗?`,
61
+ title: t(
62
+ '@fe-free/core.crud.batchActionConfirm',
63
+ '确定要执行 {action} 吗?',
64
+ {
65
+ action: action.btnText,
66
+ },
67
+ ),
55
68
  onOk: () => {
56
69
  resolve(
57
70
  action.onClick(event, {
@@ -81,7 +94,7 @@ function useRowSelection<DataSource, Key>({
81
94
  </div>
82
95
  );
83
96
  },
84
- [actionRef, batchActions, modal],
97
+ [actionRef, batchActions, modal, t],
85
98
  );
86
99
 
87
100
  if (!batchActions || batchActions.length === 0) {
@@ -1,49 +1,86 @@
1
1
  import { useEffect } from 'react';
2
+ import { useTranslation } from 'react-i18next';
2
3
  import type { CRUDProps } from './types';
3
4
 
4
5
  function useTips<DataSource, Key>(props: CRUDProps<DataSource, Key>) {
6
+ const { t } = useTranslation();
5
7
  useEffect(() => {
6
8
  if (props.actions.includes('create')) {
7
9
  if (!props.requestCreateByValues) {
8
- console.warn('actions 包含 create 时,需要传递 requestCreateByValues');
10
+ console.warn(
11
+ t(
12
+ 'core.crud.warnCreateRequestCreateByValues',
13
+ 'actions 包含 create 时,需要传递 requestCreateByValues',
14
+ ),
15
+ );
9
16
  }
10
17
  if (!props.detailForm) {
11
- console.warn('actions 包含 create 时,需要传递 detailForm');
18
+ console.warn(
19
+ t(
20
+ '@fe-free/core.crud.warnCreateDetailForm',
21
+ 'actions 包含 create 时,需要传递 detailForm',
22
+ ),
23
+ );
12
24
  }
13
25
  }
14
26
 
15
27
  if (props.actions.includes('read')) {
16
28
  if (!props.requestGetByRecord) {
17
- console.warn('actions 包含 read 时,需要传递 requestGetByRecord');
29
+ console.warn(
30
+ t(
31
+ 'core.crud.warnReadRequestGetByRecord',
32
+ 'actions 包含 read 时,需要传递 requestGetByRecord',
33
+ ),
34
+ );
18
35
  }
19
36
  if (!props.detailForm) {
20
- console.warn('actions 包含 read 时,需要传递 detailForm');
37
+ console.warn(
38
+ t('@fe-free/core.crud.warnReadDetailForm', 'actions 包含 read 时,需要传递 detailForm'),
39
+ );
21
40
  }
22
41
  }
23
42
 
24
43
  if (props.actions.includes('update')) {
25
44
  if (!props.requestGetByRecord || !props.requestUpdateByValues) {
26
45
  console.warn(
27
- 'actions 包含 update 时,需要传递 requestGetByRecord 和 requestUpdateByValues',
46
+ t(
47
+ 'core.crud.warnUpdateRequest',
48
+ 'actions 包含 update 时,需要传递 requestGetByRecord 和 requestUpdateByValues',
49
+ ),
28
50
  );
29
51
  }
30
52
  if (!props.detailForm) {
31
- console.warn('actions 包含 update 时,需要传递 detailForm');
53
+ console.warn(
54
+ t(
55
+ '@fe-free/core.crud.warnUpdateDetailForm',
56
+ 'actions 包含 update 时,需要传递 detailForm',
57
+ ),
58
+ );
32
59
  }
33
60
  }
34
61
 
35
62
  if (props.actions.includes('delete')) {
36
63
  if (!props.deleteProps?.nameIndex || !props.requestDeleteByRecord) {
37
- console.warn('actions 包含 delete 时,需要传递 deleteProps 和 requestDeleteByRecord');
64
+ console.warn(
65
+ t(
66
+ 'core.crud.warnDeleteProps',
67
+ 'actions 包含 delete 时,需要传递 deleteProps 和 requestDeleteByRecord',
68
+ ),
69
+ );
38
70
  }
39
71
  }
40
72
 
41
73
  if (props.actions.includes('batch_delete')) {
42
74
  if (!props.requestDeleteByRecords) {
43
- console.warn('actions 包含 batch_delete 时,需要传递 requestDeleteByRecords');
75
+ console.warn(
76
+ t(
77
+ 'core.crud.warnBatchDeleteRequestDeleteByRecords',
78
+ 'actions 包含 batch_delete 时,需要传递 requestDeleteByRecords',
79
+ ),
80
+ );
44
81
  }
45
82
  }
46
- }, []);
83
+ }, [props, t]);
47
84
  }
48
85
 
49
86
  export { useTips };