@fe-free/core 1.4.7 → 1.4.8

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,12 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 1.4.8
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: crud
8
+ - @fe-free/tool@1.4.8
9
+
3
10
  ## 1.4.7
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -35,7 +35,7 @@
35
35
  "react-syntax-highlighter": "^15.5.0",
36
36
  "vanilla-jsoneditor": "^0.23.1",
37
37
  "zustand": "^4.5.4",
38
- "@fe-free/tool": "1.4.7"
38
+ "@fe-free/tool": "1.4.8"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@ant-design/pro-components": "^2.8.7",
package/src/crud/crud.tsx CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { ActionType } from '@ant-design/pro-components';
2
- import { Button, Space } from 'antd';
2
+ import { Button, message, Space } from 'antd';
3
+ import { isString } from 'lodash-es';
3
4
  import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';
4
5
  import type { TableProps } from '../table';
5
6
  import { Table } from '../table';
@@ -73,7 +74,17 @@ function CRUDComponent<
73
74
  (record) => {
74
75
  return () => {
75
76
  if (requestDeleteByRecord) {
77
+ let content = '删除成功';
78
+ if (deleteProps?.successText) {
79
+ content = isString(deleteProps.successText)
80
+ ? deleteProps.successText
81
+ : deleteProps.successText();
82
+ }
76
83
  return requestDeleteByRecord(record).then(() => {
84
+ message.open({
85
+ type: 'success',
86
+ content,
87
+ });
77
88
  actionRef.current?.reload();
78
89
  });
79
90
  }
@@ -81,7 +92,7 @@ function CRUDComponent<
81
92
  throw new Error('没有传 requestDeleteByRecord');
82
93
  };
83
94
  },
84
- [requestDeleteByRecord],
95
+ [deleteProps, requestDeleteByRecord],
85
96
  );
86
97
 
87
98
  const handleReload = useCallback(() => {
@@ -98,6 +98,8 @@ interface CRUDProps<DataSource = any, Key = string> {
98
98
  desc?: string;
99
99
  /** 文本 */
100
100
  operateText?: string;
101
+ /** 成功文案 */
102
+ successText?: string | (() => string);
101
103
  };
102
104
 
103
105
  // *** 批量操作 ***