react-toolkits 2.13.16 → 2.13.17

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,11 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 2.13.17
4
+
5
+ ### Patch Changes
6
+
7
+ - 5e18613: feat: add Skelton for modal
8
+
3
9
  ## 2.13.16
4
10
 
5
11
  ### Patch Changes
package/lib/index.d.ts CHANGED
@@ -157,7 +157,7 @@ interface UseModalProps extends Omit<ModalProps, 'open' | 'confirmLoading' | 'on
157
157
  }
158
158
  declare function useModal(props: UseModalProps): {
159
159
  id: number;
160
- show: () => void;
160
+ show: () => Promise<void>;
161
161
  hide: () => void;
162
162
  modal: react_jsx_runtime.JSX.Element;
163
163
  };
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@ import { jwtDecode } from 'jwt-decode';
3
3
  import { useStore, create, createStore } from 'zustand';
4
4
  import { persist, createJSONStorage } from 'zustand/middleware';
5
5
  import * as Antd2 from 'antd';
6
- import { Modal, Form, Spin, Result, Table, Button, Card, Input, Select, theme, Space, Tag, Typography, Alert, Divider, Menu, App, Switch, InputNumber, Row, Col, Breadcrumb, Descriptions, Skeleton, Empty, Dropdown, Tooltip, Popconfirm, Collapse, Checkbox } from 'antd';
6
+ import { Modal, Skeleton, Form, Spin, Result, Table, Button, Card, Input, Select, theme, Space, Tag, Typography, Alert, Divider, Menu, App, Switch, InputNumber, Row, Col, Breadcrumb, Descriptions, Empty, Dropdown, Tooltip, Popconfirm, Collapse, Checkbox } from 'antd';
7
7
  import { forwardRef, lazy, useContext, useMemo, useState, useEffect, useImperativeHandle, cloneElement, useRef, createContext, memo, useCallback, Fragment as Fragment$1, Suspense } from 'react';
8
8
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
9
  import { last, has, template, get, isEqual, first } from 'lodash-es';
@@ -1043,9 +1043,12 @@ function useModal(props) {
1043
1043
  const open = isOpen(_id);
1044
1044
  const [confirmLoading, setConfirmLoading] = useState(false);
1045
1045
  const isRenderFunction = typeof content === "function";
1046
- const _show = () => {
1046
+ const [loading, setLoading] = useState(false);
1047
+ const _show = async () => {
1047
1048
  show(_id);
1048
- afterOpen?.();
1049
+ setLoading(true);
1050
+ await afterOpen?.();
1051
+ setLoading(false);
1049
1052
  };
1050
1053
  const _hide = () => {
1051
1054
  hide(_id);
@@ -1062,7 +1065,7 @@ function useModal(props) {
1062
1065
  setConfirmLoading(false);
1063
1066
  }
1064
1067
  };
1065
- const internalModal = /* @__PURE__ */ jsx(Modal, { ...modalProps, open, confirmLoading, onOk, onCancel, children: isRenderFunction ? content({ hide: _hide }) : content });
1068
+ const internalModal = /* @__PURE__ */ jsx(Modal, { ...modalProps, open, confirmLoading, onOk, onCancel, children: /* @__PURE__ */ jsx(Skeleton, { loading, children: isRenderFunction ? content({ hide: _hide }) : content }) });
1066
1069
  return {
1067
1070
  id: _id,
1068
1071
  show: _show,