@fe-free/core 3.0.37 → 3.0.38

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,13 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 3.0.38
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: some
8
+ - @fe-free/icons@3.0.38
9
+ - @fe-free/tool@3.0.38
10
+
3
11
  ## 3.0.37
4
12
 
5
13
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "3.0.37",
3
+ "version": "3.0.38",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -46,8 +46,8 @@
46
46
  "antd": "^5.27.1",
47
47
  "dayjs": "~1.11.10",
48
48
  "react": "^19.2.0",
49
- "@fe-free/tool": "3.0.37",
50
- "@fe-free/icons": "3.0.37"
49
+ "@fe-free/tool": "3.0.38",
50
+ "@fe-free/icons": "3.0.38"
51
51
  },
52
52
  "scripts": {
53
53
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,5 +1,5 @@
1
1
  import { DeleteOutlined } from '@fe-free/icons';
2
- import { Modal, Tooltip } from 'antd';
2
+ import { App, Tooltip } from 'antd';
3
3
  import { useCallback } from 'react';
4
4
 
5
5
  interface Params {
@@ -12,10 +12,11 @@ interface Params {
12
12
 
13
13
  function useDelete(params: Params) {
14
14
  const { name, desc, onDelete } = params;
15
+ const { modal } = App.useApp();
15
16
 
16
17
  const doDelete = useCallback(async () => {
17
18
  await new Promise((resolve) => {
18
- Modal.confirm({
19
+ modal.confirm({
19
20
  title: `确认删除 “${name}” 吗?`,
20
21
  content: desc || '删除后不可恢复,请谨慎操作',
21
22
  okText: '确定',
@@ -28,7 +29,7 @@ function useDelete(params: Params) {
28
29
  },
29
30
  });
30
31
  });
31
- }, [name, desc, onDelete]);
32
+ }, [modal, name, desc, onDelete]);
32
33
 
33
34
  return {
34
35
  doDelete,
@@ -1,5 +1,5 @@
1
1
  import { DrawerForm, ProForm } from '@ant-design/pro-components';
2
- import { message, Spin } from 'antd';
2
+ 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';
@@ -54,6 +54,7 @@ function CRUDDetail(props: CRUDDetailProps) {
54
54
  const [isOpen, setIsOpen] = useState(false);
55
55
  const [loading, setLoading] = useState(id ? true : false);
56
56
  const [form] = ProForm.useForm(detailFormInstance);
57
+ const { message } = App.useApp();
57
58
 
58
59
  const handleFinish = useCallback(
59
60
  async (values) => {
@@ -1,5 +1,5 @@
1
1
  import type { ActionType } from '@ant-design/pro-components';
2
- import { Modal } from 'antd';
2
+ import { App } from 'antd';
3
3
  import type { MutableRefObject } from 'react';
4
4
  import { useCallback, useMemo } from 'react';
5
5
  import { LoadingButton } from '../button';
@@ -14,6 +14,8 @@ function useRowSelection<DataSource, Key>({
14
14
  batchActions?: CRUDProps<DataSource, Key>['batchActions'];
15
15
  actionRef?: MutableRefObject<ActionType | undefined>;
16
16
  }) {
17
+ const { modal } = App.useApp();
18
+
17
19
  const rowSelection = useMemo(
18
20
  () => ({
19
21
  ...originRowSelection,
@@ -48,7 +50,7 @@ function useRowSelection<DataSource, Key>({
48
50
  onClick={async (event) => {
49
51
  if (action.danger) {
50
52
  await new Promise((resolve) => {
51
- Modal.confirm({
53
+ modal.confirm({
52
54
  title: `确定要执行 ${action.btnText} 吗?`,
53
55
  onOk: () => {
54
56
  resolve(
@@ -79,7 +81,7 @@ function useRowSelection<DataSource, Key>({
79
81
  </div>
80
82
  );
81
83
  },
82
- [actionRef, batchActions],
84
+ [actionRef, batchActions, modal],
83
85
  );
84
86
 
85
87
  if (!batchActions || batchActions.length === 0) {
@@ -1,3 +1,4 @@
1
+ // eslint-disable-next-line no-restricted-imports
1
2
  import { message } from 'antd';
2
3
  import type { AxiosRequestConfig, AxiosResponse } from 'axios';
3
4
  import { AxiosError } from 'axios';
@@ -1,6 +1,6 @@
1
1
  import { DeleteOutlined, InboxOutlined, PlusOutlined, UploadOutlined } from '@fe-free/icons';
2
2
  import type { UploadProps as AntdUploadProps, UploadFile } from 'antd';
3
- import { Upload as AntdUpload, Avatar, Button, message } from 'antd';
3
+ import { Upload as AntdUpload, App, Avatar, Button } from 'antd';
4
4
  import type { UploadChangeParam } from 'antd/es/upload';
5
5
  import classNames from 'classnames';
6
6
  import type { ReactNode } from 'react';
@@ -26,6 +26,7 @@ interface UploadProps extends UploadBaseProps {
26
26
  function useUpload(
27
27
  props: ImageUploadProps & { onChangeOriginal?: (info: UploadChangeParam<UploadFile>) => void },
28
28
  ) {
29
+ const { message } = App.useApp();
29
30
  const { value, onChange, multiple, maxCount, onChangeOriginal } = props;
30
31
  // 转换成 Upload 格式。
31
32
  const defaultFileList = useMemo(() => {