@cloudtower/eagle 0.32.34 → 0.32.35

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.
@@ -22,6 +22,7 @@ var ModalActions = /* @__PURE__ */ ((ModalActions2) => {
22
22
  ModalActions2["POP_MODAL"] = "POP_MODAL";
23
23
  ModalActions2["REMOVE_MODAL"] = "REMOVE_MODAL";
24
24
  ModalActions2["CLOSE_MODAL"] = "CLOSE_MODAL";
25
+ ModalActions2["RESET_MODAL"] = "RESET_MODAL";
25
26
  return ModalActions2;
26
27
  })(ModalActions || {});
27
28
  const initialModalState = {
@@ -55,6 +56,8 @@ const modalReducer = (state = initialModalState, action) => {
55
56
  return __spreadProps(__spreadValues({}, state), {
56
57
  closeId: action.id
57
58
  });
59
+ case "RESET_MODAL" /* RESET_MODAL */:
60
+ return initialModalState;
58
61
  default:
59
62
  return state;
60
63
  }
@@ -9,3 +9,4 @@ export declare const useKitSelector: <Selected extends unknown>(selector: (state
9
9
  export declare const usePushModal: () => <K extends string | number>(modal: ModalType<IModalProps[K]>) => void;
10
10
  export declare const useCloseModal: () => (id: number) => void;
11
11
  export declare const usePopModal: () => () => void;
12
+ export declare const useResetModal: () => () => void;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  export type CloseCb = {
3
3
  onClose: () => void;
4
+ closeAllModal: () => void;
4
5
  modalId: number;
5
6
  };
6
7
  export type ModalType<TProps> = TProps extends void ? {
@@ -21,7 +22,8 @@ export declare enum ModalActions {
21
22
  PUSH_MODAL = "PUSH_MODAL",
22
23
  POP_MODAL = "POP_MODAL",
23
24
  REMOVE_MODAL = "REMOVE_MODAL",
24
- CLOSE_MODAL = "CLOSE_MODAL"
25
+ CLOSE_MODAL = "CLOSE_MODAL",
26
+ RESET_MODAL = "RESET_MODAL"
25
27
  }
26
28
  type PUSH_MODAL<TProps> = {
27
29
  type: ModalActions.PUSH_MODAL;
@@ -38,7 +40,10 @@ type CLOSE_MODAL = {
38
40
  type: ModalActions.CLOSE_MODAL;
39
41
  id: number;
40
42
  };
41
- export type Actions = PUSH_MODAL<unknown> | POP_MODAL | REMOVE_MODAL | CLOSE_MODAL;
43
+ type RESET_MODAL = {
44
+ type: ModalActions.RESET_MODAL;
45
+ };
46
+ export type Actions = PUSH_MODAL<unknown> | POP_MODAL | REMOVE_MODAL | CLOSE_MODAL | RESET_MODAL;
42
47
  export declare const initialModalState: ModalState;
43
48
  export declare const modalReducer: (state: ModalState | undefined, action: Actions) => ModalState;
44
49
  export interface IModalProps {
@@ -12,7 +12,7 @@ declare const Demo: (props: {
12
12
  *
13
13
  * ModalStack 会向上查找 KitStoreContext, 如果未查找到,会使用 eagle 提供的默认 store。
14
14
  *
15
- * usePushModal,usePopModal,useCloseModal 与 ModalStack 同理。
15
+ * usePushModal,usePopModal,useCloseModal, useResetModal 与 ModalStack 同理。
16
16
  */
17
17
  declare const meta: Meta<typeof Demo>;
18
18
  export default meta;
@@ -9,3 +9,7 @@ export declare const WithAside: {
9
9
  (): React.JSX.Element;
10
10
  args: {};
11
11
  };
12
+ /**
13
+ * 点击弹窗中的 close all modal 按钮,会清理掉页面中的所有弹窗
14
+ */
15
+ export declare const CloseAllModal: () => React.JSX.Element;