@fairys/taro-tools-react 1.0.15 → 1.0.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.
Files changed (44) hide show
  1. package/esm/components/MainPage/index.d.ts +16 -1
  2. package/esm/components/MainPage/index.js +29 -4
  3. package/esm/components/Mesage/index.js +2 -2
  4. package/esm/components/Toast/index.js +2 -2
  5. package/esm/components/connectToastMessage/index.d.ts +12 -1
  6. package/esm/components/connectToastMessage/index.js +3 -3
  7. package/esm/context/{global.data.instance.d.ts → global.message.data.instance.d.ts} +10 -7
  8. package/esm/context/{global.data.instance.js → global.message.data.instance.js} +6 -6
  9. package/esm/context/index.d.ts +1 -1
  10. package/esm/context/index.js +1 -1
  11. package/esm/context/page.data.instance.d.ts +13 -1
  12. package/esm/context/page.data.instance.js +24 -0
  13. package/esm/context/page.info.data.instance.d.ts +2 -0
  14. package/esm/context/page.info.data.instance.js +5 -2
  15. package/esm/styles/index.css +8 -0
  16. package/esm/utils/request.d.ts +2 -2
  17. package/esm/utils/request.js +8 -8
  18. package/lib/components/MainPage/index.d.ts +16 -1
  19. package/lib/components/MainPage/index.js +28 -0
  20. package/lib/components/Mesage/index.js +2 -2
  21. package/lib/components/Toast/index.js +2 -2
  22. package/lib/components/connectToastMessage/index.d.ts +12 -1
  23. package/lib/components/connectToastMessage/index.js +2 -2
  24. package/lib/context/{global.data.instance.d.ts → global.message.data.instance.d.ts} +10 -7
  25. package/lib/context/{global.data.instance.js → global.message.data.instance.js} +14 -14
  26. package/lib/context/index.d.ts +1 -1
  27. package/lib/context/index.js +5 -5
  28. package/lib/context/page.data.instance.d.ts +13 -1
  29. package/lib/context/page.data.instance.js +24 -0
  30. package/lib/context/page.info.data.instance.d.ts +2 -0
  31. package/lib/context/page.info.data.instance.js +5 -2
  32. package/lib/styles/index.css +8 -0
  33. package/lib/utils/request.d.ts +2 -2
  34. package/lib/utils/request.js +8 -8
  35. package/package.json +1 -1
  36. package/src/components/MainPage/index.tsx +62 -2
  37. package/src/components/Mesage/index.tsx +3 -3
  38. package/src/components/Toast/index.tsx +2 -2
  39. package/src/components/connectToastMessage/index.tsx +14 -3
  40. package/src/context/{global.data.instance.ts → global.message.data.instance.ts} +14 -13
  41. package/src/context/index.ts +1 -1
  42. package/src/context/page.data.instance.tsx +56 -2
  43. package/src/context/page.info.data.instance.tsx +8 -2
  44. package/src/utils/request.ts +10 -10
@@ -1,6 +1,9 @@
1
- import { ViewProps } from '@tarojs/components';
1
+ import { ViewProps, ScrollViewProps } from '@tarojs/components';
2
2
  export interface FairysTaroMainPageProps extends ViewProps {
3
3
  }
4
+ /**
5
+ * 主页面(如果外部使用scroll-view组件,需要设置高度,否则内容会出现滚动)
6
+ */
4
7
  export declare const FairysTaroMainPage: (props: FairysTaroMainPageProps) => import("react/jsx-runtime").JSX.Element;
5
8
  /**查询*/
6
9
  export declare const FairysTaroMainPageSearch: (props: FairysTaroMainPageProps) => import("react/jsx-runtime").JSX.Element;
@@ -8,3 +11,15 @@ export declare const FairysTaroMainPageSearch: (props: FairysTaroMainPageProps)
8
11
  export declare const FairysTaroMainPageBody: (props: FairysTaroMainPageProps) => import("react/jsx-runtime").JSX.Element;
9
12
  /**底部*/
10
13
  export declare const FairysTaroMainPageFooter: (props: FairysTaroMainPageProps) => import("react/jsx-runtime").JSX.Element;
14
+ export interface FairysTaroMainPageScrollViewProps extends ScrollViewProps {
15
+ /**下拉刷新状态*/
16
+ refresherStatus?: boolean;
17
+ /**是否还有更多数据*/
18
+ hasMore?: boolean;
19
+ /**加载更多文本*/
20
+ loadMoreText?: React.ReactNode;
21
+ }
22
+ /**
23
+ * 主页面滚动视图
24
+ */
25
+ export declare const FairysTaroMainPageScrollView: (props: FairysTaroMainPageScrollViewProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { View } from "@tarojs/components";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { ScrollView, View } from "@tarojs/components";
3
3
  import clsx from "clsx";
4
- import { useMemo } from "react";
4
+ import { Fragment, useMemo } from "react";
5
5
  const FairysTaroMainPage = (props)=>{
6
6
  const { className: itemClassName, children, ...rest } = props;
7
7
  const cls = useMemo(()=>clsx('fairys_taro-ui-main-page fairystaro__box-border fairystaro__w-full fairystaro__h-full fairystaro__flex fairystaro__flex-col fairystaro__overflow-auto', itemClassName), [
@@ -46,4 +46,29 @@ const FairysTaroMainPageFooter = (props)=>{
46
46
  children: children
47
47
  });
48
48
  };
49
- export { FairysTaroMainPage, FairysTaroMainPageBody, FairysTaroMainPageFooter, FairysTaroMainPageSearch };
49
+ const FairysTaroMainPageScrollView = (props)=>{
50
+ const { className: itemClassName, children, refresherStatus, hasMore = true, loadMoreText, onScrollToLower, ...rest } = props;
51
+ const cls = useMemo(()=>clsx('fairys_taro-ui-main-page-scroll-view fairystaro__box-border fairystaro__w-screen fairystaro__h-screen', itemClassName), [
52
+ itemClassName
53
+ ]);
54
+ return /*#__PURE__*/ jsxs(ScrollView, {
55
+ scrollY: true,
56
+ refresherEnabled: true,
57
+ enhanced: true,
58
+ usingSticky: true,
59
+ refresherTriggered: refresherStatus,
60
+ className: cls,
61
+ ...rest,
62
+ onScrollToLower: (...args)=>{
63
+ if (hasMore) onScrollToLower?.(...args);
64
+ },
65
+ children: [
66
+ children,
67
+ loadMoreText ? /*#__PURE__*/ jsx(View, {
68
+ className: "fairys_taro-ui-main-page-scroll-view-load-more",
69
+ children: loadMoreText
70
+ }) : /*#__PURE__*/ jsx(Fragment, {})
71
+ ]
72
+ });
73
+ };
74
+ export { FairysTaroMainPage, FairysTaroMainPageBody, FairysTaroMainPageFooter, FairysTaroMainPageScrollView, FairysTaroMainPageSearch };
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Fragment, createElement, useMemo } from "react";
3
3
  import { View } from "@tarojs/components";
4
- import { useGlobalData } from "../../context/global.data.instance.js";
4
+ import { useGlobalMessageData } from "../../context/global.message.data.instance.js";
5
5
  import { FairysTaroPortal } from "../Portal/index.js";
6
6
  import clsx from "clsx";
7
7
  const FairysTaroMessageItem = (props)=>{
@@ -99,7 +99,7 @@ const FairysTaroMessage = (props)=>{
99
99
  };
100
100
  const FairysTaroPortalMessage = (props)=>{
101
101
  const { className: messageClassName, ...rest } = props;
102
- const [state] = useGlobalData();
102
+ const [state] = useGlobalMessageData();
103
103
  const messageData = state.messageData;
104
104
  const classNames = useMemo(()=>clsx('fairys_taro-ui-portal-message fairystaro__pointer-events-none fairystaro__position-fixed fairystaro__top-0 fairystaro__right-0 fairystaro__bottom-0 fairystaro__left-0', messageClassName), [
105
105
  messageClassName
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Toast } from "@nutui/nutui-react-taro";
3
3
  import { FairysTaroPortal } from "../Portal/index.js";
4
- import { useGlobalData } from "../../context/global.data.instance.js";
4
+ import { useGlobalMessageData } from "../../context/global.message.data.instance.js";
5
5
  const FairysTaroToast = ()=>{
6
- const [state, proxyInstance] = useGlobalData();
6
+ const [state, proxyInstance] = useGlobalMessageData();
7
7
  const toastConfig = state.toastData;
8
8
  return /*#__PURE__*/ jsx(FairysTaroPortal, {
9
9
  children: /*#__PURE__*/ jsx(Toast, {
@@ -7,4 +7,15 @@ export interface ConnectToastMessageOptions {
7
7
  */
8
8
  isRoot?: boolean;
9
9
  }
10
- export declare const connectToastMessage: (Component: React.FC, options?: ConnectToastMessageOptions) => (props: any) => import("react/jsx-runtime").JSX.Element;
10
+ /**
11
+ * 高阶组件,用于为 React 组件连接 Toast 和 Message 功能
12
+ *
13
+ * 根据不同的运行环境(H5/微信小程序)和组件层级(根页面/子页面),
14
+ * 决定是否渲染 Toast 和 Message 组件,以避免功能冲突和界面遮挡
15
+ *
16
+ * @param Component - 需要被包装的 React 组件
17
+ * @param options - 配置选项
18
+ * @param options.isRoot - 是否为根页面组件,默认为 false
19
+ * @returns 返回一个经过优化的 React 组件,根据环境条件选择性渲染 Toast 和 Message
20
+ */
21
+ export declare const connectToastMessage: (Component: React.FC, options?: ConnectToastMessageOptions) => React.MemoExoticComponent<(props: any) => import("react/jsx-runtime").JSX.Element>;
@@ -1,10 +1,10 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { FairysTaroPortalMessage } from "../Mesage/index.js";
3
3
  import { FairysTaroToast } from "../Toast/index.js";
4
- import { Fragment } from "react";
4
+ import { Fragment, memo } from "react";
5
5
  const connectToastMessage = (Component, options = {})=>{
6
6
  const { isRoot = false } = options;
7
- return (props)=>{
7
+ return /*#__PURE__*/ memo((props)=>{
8
8
  if ('weapp' === process.env.TARO_ENV) return /*#__PURE__*/ jsxs(Fragment, {
9
9
  children: [
10
10
  /*#__PURE__*/ jsx(Component, {
@@ -23,6 +23,6 @@ const connectToastMessage = (Component, options = {})=>{
23
23
  isRoot ? /*#__PURE__*/ jsx(FairysTaroPortalMessage, {}) : /*#__PURE__*/ jsx(Fragment, {})
24
24
  ]
25
25
  });
26
- };
26
+ });
27
27
  };
28
28
  export { connectToastMessage };
@@ -17,7 +17,7 @@ export interface MessageDataType extends FairysTaroMessageItemProps {
17
17
  }
18
18
  export interface ToastDataType extends Partial<TaroToastProps> {
19
19
  }
20
- export interface GlobalDataInstanceState {
20
+ export interface GlobalMessageDataInstanceState {
21
21
  /**弹框提示框*/
22
22
  messageData?: MessageDataType[];
23
23
  /**提示框数据*/
@@ -25,8 +25,11 @@ export interface GlobalDataInstanceState {
25
25
  /**数据默认值不使用*/
26
26
  __defaultValue?: string;
27
27
  }
28
- export declare class GlobalDataInstance extends ProxyInstanceObjectBase<GlobalDataInstanceState> {
29
- store: GlobalDataInstanceState;
28
+ /**
29
+ * 全局消息数据实例
30
+ */
31
+ export declare class GlobalMessageDataInstance extends ProxyInstanceObjectBase<GlobalMessageDataInstanceState> {
32
+ store: GlobalMessageDataInstanceState;
30
33
  /**用于提示信息*/
31
34
  showMessage: (options: Omit<MessageDataType, "__id"> & {
32
35
  __id?: string;
@@ -45,10 +48,10 @@ export declare class GlobalDataInstance extends ProxyInstanceObjectBase<GlobalDa
45
48
  toLoginPage: () => void;
46
49
  }
47
50
  /**
48
- * 全局数据实例
51
+ * 全局消息数据实例
49
52
  */
50
- export declare const globalDataInstance: GlobalDataInstance;
53
+ export declare const globalMessageDataInstance: GlobalMessageDataInstance;
51
54
  /**
52
- * 全局数据状态管理
55
+ * 全局消息数据状态管理
53
56
  */
54
- export declare const useGlobalData: () => [GlobalDataInstanceState, GlobalDataInstance, string | undefined];
57
+ export declare const useGlobalMessageData: () => [GlobalMessageDataInstanceState, GlobalMessageDataInstance, string | undefined];
@@ -3,7 +3,7 @@ import utils_navigate from "../utils/navigate.js";
3
3
  import { createUseId } from "../utils/useId.js";
4
4
  import { ProxyInstanceObjectBase } from "../utils/valtio/instance.js";
5
5
  import { globalSettingDataInstance } from "./global.setting.data.instance.js";
6
- class GlobalDataInstance extends ProxyInstanceObjectBase {
6
+ class GlobalMessageDataInstance extends ProxyInstanceObjectBase {
7
7
  store = proxy({
8
8
  messageData: ref([]),
9
9
  toastData: void 0
@@ -60,13 +60,13 @@ class GlobalDataInstance extends ProxyInstanceObjectBase {
60
60
  });
61
61
  };
62
62
  }
63
- const globalDataInstance = new GlobalDataInstance();
64
- const useGlobalData = ()=>{
65
- const store = useSnapshot(globalDataInstance.store);
63
+ const globalMessageDataInstance = new GlobalMessageDataInstance();
64
+ const useGlobalMessageData = ()=>{
65
+ const store = useSnapshot(globalMessageDataInstance.store);
66
66
  return [
67
67
  store,
68
- globalDataInstance,
68
+ globalMessageDataInstance,
69
69
  store.__defaultValue
70
70
  ];
71
71
  };
72
- export { GlobalDataInstance, globalDataInstance, useGlobalData };
72
+ export { GlobalMessageDataInstance, globalMessageDataInstance, useGlobalMessageData };
@@ -1,4 +1,4 @@
1
- export * from './global.data.instance';
1
+ export * from './global.message.data.instance';
2
2
  export * from './page.data.instance';
3
3
  export * from './page.info.data.instance';
4
4
  export * from './auth.data.instance';
@@ -1,4 +1,4 @@
1
- export * from "./global.data.instance.js";
1
+ export * from "./global.message.data.instance.js";
2
2
  export * from "./page.data.instance.js";
3
3
  export * from "./page.info.data.instance.js";
4
4
  export * from "./auth.data.instance.js";
@@ -2,6 +2,10 @@ import { ProxyInstanceObjectBase } from '../utils/valtio/instance';
2
2
  export interface PageDataInstanceState extends Record<string, any> {
3
3
  /**loading存储*/
4
4
  loading?: Record<string, boolean>;
5
+ /**下拉刷新状态*/
6
+ refresherStatus?: boolean;
7
+ /**上拉加载*/
8
+ loadMoreStatus?: boolean;
5
9
  /**当前页*/
6
10
  page?: number;
7
11
  /**分页数*/
@@ -37,6 +41,10 @@ export interface PageDataInstanceState extends Record<string, any> {
37
41
  query?: Record<string, any>;
38
42
  [s: string]: any;
39
43
  }[];
44
+ /**tab多页签下拉刷新状态*/
45
+ tabRefresherStatus?: Record<string, boolean>;
46
+ /**tab多页签上拉加载状态*/
47
+ tabLoadMoreStatus?: Record<string, boolean>;
40
48
  /**是否是tab多页签*/
41
49
  isTabs?: boolean;
42
50
  /**是否展开查询条件*/
@@ -84,7 +92,11 @@ export declare class PageDataInstance<T extends PageDataInstanceState = PageData
84
92
  updatedSearch: (value?: Record<string, any>) => void;
85
93
  /**更新页面级的 pageLoading */
86
94
  updatedPageLoading: (loading?: boolean) => void;
87
- /**更新页面级的 loadMore */
95
+ /**
96
+ * 更新加载状态对象
97
+ *
98
+ * @param value - 包含页面键和对应加载状态的键值对对象
99
+ */
88
100
  updatedLoading: (value: Record<string, boolean>) => void;
89
101
  /**内置——查询列表*/
90
102
  main_getList: () => Promise<void>;
@@ -30,6 +30,10 @@ class page_data_instance_PageDataInstance extends ProxyInstanceObjectBase {
30
30
  loading: {
31
31
  pageLoading: false
32
32
  },
33
+ tabRefresherStatus: {},
34
+ refresherStatus: false,
35
+ loadMoreStatus: false,
36
+ tabLoadMoreStatus: {},
33
37
  hasLastPage: false
34
38
  };
35
39
  store = proxy({
@@ -126,6 +130,16 @@ class page_data_instance_PageDataInstance extends ProxyInstanceObjectBase {
126
130
  page: this.store[pageField] || 1,
127
131
  pageSize: this.store[pageSizeField] || this.store.defaultPageSize || 20
128
132
  };
133
+ if (1 === payload.page) if (this.store.isTabs) {
134
+ const tabKey = this.store.tabKey;
135
+ if (!this.store.tabRefresherStatus) this.store.tabRefresherStatus = {};
136
+ this.store.tabRefresherStatus[tabKey] = true;
137
+ } else this.store.refresherStatus = true;
138
+ else if (this.store.isTabs) {
139
+ const tabKey = this.store.tabKey;
140
+ if (!this.store.tabLoadMoreStatus) this.store.tabLoadMoreStatus = {};
141
+ this.store.tabLoadMoreStatus[tabKey] = true;
142
+ } else this.store.loadMoreStatus = true;
129
143
  let newParams = this.formateParams({
130
144
  ...payload
131
145
  });
@@ -167,6 +181,16 @@ class page_data_instance_PageDataInstance extends ProxyInstanceObjectBase {
167
181
  this.store.loading.loadMore = false;
168
182
  this.updatedPageLoading(false);
169
183
  }
184
+ if (this.store.isTabs) {
185
+ const tabKey = this.store.tabKey;
186
+ if (!this.store.tabRefresherStatus) this.store.tabRefresherStatus = {};
187
+ if (!this.store.tabLoadMoreStatus) this.store.tabLoadMoreStatus = {};
188
+ this.store.tabLoadMoreStatus[tabKey] = false;
189
+ this.store.tabRefresherStatus[tabKey] = false;
190
+ } else {
191
+ this.store.refresherStatus = false;
192
+ this.store.loadMoreStatus = false;
193
+ }
170
194
  taro.hideLoading();
171
195
  };
172
196
  main_onPageChange = (page)=>{
@@ -8,6 +8,8 @@ export interface PageInfoDataInstanceState extends Record<string, any> {
8
8
  editType?: 'add' | 'edit' | 'info';
9
9
  /**查询详情是否成功*/
10
10
  isInfoSuccess?: boolean;
11
+ /**下拉刷新状态*/
12
+ refresherStatus?: boolean;
11
13
  /**数据默认值不使用*/
12
14
  __defaultValue?: string;
13
15
  }
@@ -3,7 +3,7 @@ import { proxy, ref as external_valtio_ref, useSnapshot } from "valtio";
3
3
  import { ProxyInstanceObjectBase } from "../utils/valtio/instance.js";
4
4
  import { createContext, useContext, useEffect, useMemo, useRef } from "react";
5
5
  import utils_navigate from "../utils/navigate.js";
6
- import { globalDataInstance } from "./global.data.instance.js";
6
+ import { globalMessageDataInstance } from "./global.message.data.instance.js";
7
7
  import { globalSettingDataInstance } from "./global.setting.data.instance.js";
8
8
  import taro, { useDidShow } from "@tarojs/taro";
9
9
  class page_info_data_instance_PageInfoDataInstance extends ProxyInstanceObjectBase {
@@ -14,6 +14,7 @@ class page_info_data_instance_PageInfoDataInstance extends ProxyInstanceObjectBa
14
14
  editType: 'add',
15
15
  editFormData: external_valtio_ref({}),
16
16
  isInfoSuccess: false,
17
+ refresherStatus: false,
17
18
  loading: {
18
19
  pageLoading: false
19
20
  }
@@ -56,6 +57,7 @@ class page_info_data_instance_PageInfoDataInstance extends ProxyInstanceObjectBa
56
57
  taro.showLoading({
57
58
  title: "\u52A0\u8F7D\u4E2D..."
58
59
  });
60
+ this.store.refresherStatus = true;
59
61
  try {
60
62
  this.updatedLoading(true);
61
63
  let newParams = {};
@@ -78,6 +80,7 @@ class page_info_data_instance_PageInfoDataInstance extends ProxyInstanceObjectBa
78
80
  console.log(error);
79
81
  this.updatedLoading(false);
80
82
  }
83
+ this.store.refresherStatus = false;
81
84
  taro.hideLoading();
82
85
  };
83
86
  main_saveInfo = async ()=>{
@@ -92,7 +95,7 @@ class page_info_data_instance_PageInfoDataInstance extends ProxyInstanceObjectBa
92
95
  taro.hideLoading();
93
96
  this.updatedLoading(false);
94
97
  if (result && result.code === globalSettingDataInstance.store.requestSuccessCode) {
95
- if (this.requestSaveInfoConfig?.isShowSuccessMessage === false) globalDataInstance.showMessage({
98
+ if (this.requestSaveInfoConfig?.isShowSuccessMessage === false) globalMessageDataInstance.showMessage({
96
99
  content: result.message || "\u4FDD\u5B58\u6210\u529F"
97
100
  });
98
101
  else taro.showToast({
@@ -83,6 +83,10 @@
83
83
  height: 100%;
84
84
  }
85
85
 
86
+ .fairystaro__h-screen {
87
+ height: 100vh;
88
+ }
89
+
86
90
  .fairystaro__max-h-full {
87
91
  max-height: 100%;
88
92
  }
@@ -95,6 +99,10 @@
95
99
  width: 100%;
96
100
  }
97
101
 
102
+ .fairystaro__w-screen {
103
+ width: 100vw;
104
+ }
105
+
98
106
  .fairystaro__flex {
99
107
  display: flex;
100
108
  }
@@ -41,11 +41,11 @@ export interface RequestInstanceCreateOptions {
41
41
  };
42
42
  dev: Record<string, string | {
43
43
  target: string;
44
- pathRewrite: Record<string, string>;
44
+ pathRewrite?: Record<string, string>;
45
45
  }>;
46
46
  pro: Record<string, string | {
47
47
  target: string;
48
- pathRewrite: Record<string, string>;
48
+ pathRewrite?: Record<string, string>;
49
49
  }>;
50
50
  };
51
51
  /**启用token校验*/
@@ -1,6 +1,6 @@
1
1
  import taro from "@tarojs/taro";
2
2
  import { globalSettingDataInstance } from "../context/global.setting.data.instance.js";
3
- import { globalDataInstance } from "../context/global.data.instance.js";
3
+ import { globalMessageDataInstance } from "../context/global.message.data.instance.js";
4
4
  const codeMessage = {
5
5
  400: "\u53D1\u51FA\u7684\u8BF7\u6C42\u9519\u8BEF",
6
6
  401: "\u7528\u6237\u6CA1\u6709\u6743\u9650",
@@ -21,7 +21,7 @@ const requestResponseHandle = (result, options)=>{
21
21
  const code = result?.data?.code;
22
22
  if (401 === statusCode || 401 === code || code === globalSettingDataInstance.store.tokenExpiredCode) {
23
23
  msg = "\u8BF7\u91CD\u65B0\u767B\u5F55";
24
- globalDataInstance.toLoginPage();
24
+ globalMessageDataInstance.toLoginPage();
25
25
  } else msg = [
26
26
  globalSettingDataInstance.store.requestSuccessCode,
27
27
  200
@@ -35,7 +35,7 @@ const requestResponseHandle = (result, options)=>{
35
35
  duration: 3000,
36
36
  icon: 'none'
37
37
  });
38
- else globalDataInstance.showMessage({
38
+ else globalMessageDataInstance.showMessage({
39
39
  content: msg || "\u8BF7\u6C42\u53D1\u751F\u9519\u8BEF",
40
40
  type: 'error'
41
41
  });
@@ -123,14 +123,14 @@ class RequestInstance {
123
123
  duration: 3000,
124
124
  icon: 'none'
125
125
  });
126
- else globalDataInstance.showMessage({
126
+ else globalMessageDataInstance.showMessage({
127
127
  content: "\u672A\u767B\u5F55",
128
128
  type: 'error'
129
129
  });
130
130
  options?.fail?.({
131
131
  errMsg: "\u672A\u767B\u5F55"
132
132
  });
133
- globalDataInstance.toLoginPage();
133
+ globalMessageDataInstance.toLoginPage();
134
134
  return;
135
135
  }
136
136
  return {
@@ -161,7 +161,7 @@ class RequestInstance {
161
161
  duration: 3000,
162
162
  icon: 'none'
163
163
  });
164
- else globalDataInstance.showMessage({
164
+ else globalMessageDataInstance.showMessage({
165
165
  content: result.errMsg || "\u8BF7\u6C42\u53D1\u751F\u9519\u8BEF",
166
166
  type: 'error'
167
167
  });
@@ -255,7 +255,7 @@ class RequestInstance {
255
255
  duration: 3000,
256
256
  icon: 'none'
257
257
  });
258
- else globalDataInstance.showMessage({
258
+ else globalMessageDataInstance.showMessage({
259
259
  content: result.errMsg || "\u8BF7\u6C42\u53D1\u751F\u9519\u8BEF",
260
260
  type: 'error'
261
261
  });
@@ -306,7 +306,7 @@ class RequestInstance {
306
306
  duration: 3000,
307
307
  icon: 'none'
308
308
  });
309
- else globalDataInstance.showMessage({
309
+ else globalMessageDataInstance.showMessage({
310
310
  content: result.errMsg || "\u8BF7\u6C42\u53D1\u751F\u9519\u8BEF",
311
311
  type: 'error'
312
312
  });
@@ -1,6 +1,9 @@
1
- import { ViewProps } from '@tarojs/components';
1
+ import { ViewProps, ScrollViewProps } from '@tarojs/components';
2
2
  export interface FairysTaroMainPageProps extends ViewProps {
3
3
  }
4
+ /**
5
+ * 主页面(如果外部使用scroll-view组件,需要设置高度,否则内容会出现滚动)
6
+ */
4
7
  export declare const FairysTaroMainPage: (props: FairysTaroMainPageProps) => import("react/jsx-runtime").JSX.Element;
5
8
  /**查询*/
6
9
  export declare const FairysTaroMainPageSearch: (props: FairysTaroMainPageProps) => import("react/jsx-runtime").JSX.Element;
@@ -8,3 +11,15 @@ export declare const FairysTaroMainPageSearch: (props: FairysTaroMainPageProps)
8
11
  export declare const FairysTaroMainPageBody: (props: FairysTaroMainPageProps) => import("react/jsx-runtime").JSX.Element;
9
12
  /**底部*/
10
13
  export declare const FairysTaroMainPageFooter: (props: FairysTaroMainPageProps) => import("react/jsx-runtime").JSX.Element;
14
+ export interface FairysTaroMainPageScrollViewProps extends ScrollViewProps {
15
+ /**下拉刷新状态*/
16
+ refresherStatus?: boolean;
17
+ /**是否还有更多数据*/
18
+ hasMore?: boolean;
19
+ /**加载更多文本*/
20
+ loadMoreText?: React.ReactNode;
21
+ }
22
+ /**
23
+ * 主页面滚动视图
24
+ */
25
+ export declare const FairysTaroMainPageScrollView: (props: FairysTaroMainPageScrollViewProps) => import("react/jsx-runtime").JSX.Element;
@@ -34,6 +34,7 @@ var __webpack_exports__ = {};
34
34
  __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
36
  FairysTaroMainPageFooter: ()=>FairysTaroMainPageFooter,
37
+ FairysTaroMainPageScrollView: ()=>FairysTaroMainPageScrollView,
37
38
  FairysTaroMainPage: ()=>FairysTaroMainPage,
38
39
  FairysTaroMainPageSearch: ()=>FairysTaroMainPageSearch,
39
40
  FairysTaroMainPageBody: ()=>FairysTaroMainPageBody
@@ -87,14 +88,41 @@ const FairysTaroMainPageFooter = (props)=>{
87
88
  children: children
88
89
  });
89
90
  };
91
+ const FairysTaroMainPageScrollView = (props)=>{
92
+ const { className: itemClassName, children, refresherStatus, hasMore = true, loadMoreText, onScrollToLower, ...rest } = props;
93
+ const cls = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro-ui-main-page-scroll-view fairystaro__box-border fairystaro__w-screen fairystaro__h-screen', itemClassName), [
94
+ itemClassName
95
+ ]);
96
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(components_namespaceObject.ScrollView, {
97
+ scrollY: true,
98
+ refresherEnabled: true,
99
+ enhanced: true,
100
+ usingSticky: true,
101
+ refresherTriggered: refresherStatus,
102
+ className: cls,
103
+ ...rest,
104
+ onScrollToLower: (...args)=>{
105
+ if (hasMore) onScrollToLower?.(...args);
106
+ },
107
+ children: [
108
+ children,
109
+ loadMoreText ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
110
+ className: "fairys_taro-ui-main-page-scroll-view-load-more",
111
+ children: loadMoreText
112
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {})
113
+ ]
114
+ });
115
+ };
90
116
  exports.FairysTaroMainPage = __webpack_exports__.FairysTaroMainPage;
91
117
  exports.FairysTaroMainPageBody = __webpack_exports__.FairysTaroMainPageBody;
92
118
  exports.FairysTaroMainPageFooter = __webpack_exports__.FairysTaroMainPageFooter;
119
+ exports.FairysTaroMainPageScrollView = __webpack_exports__.FairysTaroMainPageScrollView;
93
120
  exports.FairysTaroMainPageSearch = __webpack_exports__.FairysTaroMainPageSearch;
94
121
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
95
122
  "FairysTaroMainPage",
96
123
  "FairysTaroMainPageBody",
97
124
  "FairysTaroMainPageFooter",
125
+ "FairysTaroMainPageScrollView",
98
126
  "FairysTaroMainPageSearch"
99
127
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
100
128
  Object.defineProperty(exports, '__esModule', {
@@ -40,7 +40,7 @@ __webpack_require__.d(__webpack_exports__, {
40
40
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
41
41
  const external_react_namespaceObject = require("react");
42
42
  const components_namespaceObject = require("@tarojs/components");
43
- const global_data_instance_js_namespaceObject = require("../../context/global.data.instance.js");
43
+ const global_message_data_instance_js_namespaceObject = require("../../context/global.message.data.instance.js");
44
44
  const index_js_namespaceObject = require("../Portal/index.js");
45
45
  const external_clsx_namespaceObject = require("clsx");
46
46
  var external_clsx_default = /*#__PURE__*/ __webpack_require__.n(external_clsx_namespaceObject);
@@ -139,7 +139,7 @@ const FairysTaroMessage = (props)=>{
139
139
  };
140
140
  const FairysTaroPortalMessage = (props)=>{
141
141
  const { className: messageClassName, ...rest } = props;
142
- const [state] = (0, global_data_instance_js_namespaceObject.useGlobalData)();
142
+ const [state] = (0, global_message_data_instance_js_namespaceObject.useGlobalMessageData)();
143
143
  const messageData = state.messageData;
144
144
  const classNames = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro-ui-portal-message fairystaro__pointer-events-none fairystaro__position-fixed fairystaro__top-0 fairystaro__right-0 fairystaro__bottom-0 fairystaro__left-0', messageClassName), [
145
145
  messageClassName
@@ -29,9 +29,9 @@ __webpack_require__.d(__webpack_exports__, {
29
29
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
30
  const nutui_react_taro_namespaceObject = require("@nutui/nutui-react-taro");
31
31
  const index_js_namespaceObject = require("../Portal/index.js");
32
- const global_data_instance_js_namespaceObject = require("../../context/global.data.instance.js");
32
+ const global_message_data_instance_js_namespaceObject = require("../../context/global.message.data.instance.js");
33
33
  const FairysTaroToast = ()=>{
34
- const [state, proxyInstance] = (0, global_data_instance_js_namespaceObject.useGlobalData)();
34
+ const [state, proxyInstance] = (0, global_message_data_instance_js_namespaceObject.useGlobalMessageData)();
35
35
  const toastConfig = state.toastData;
36
36
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.FairysTaroPortal, {
37
37
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(nutui_react_taro_namespaceObject.Toast, {
@@ -7,4 +7,15 @@ export interface ConnectToastMessageOptions {
7
7
  */
8
8
  isRoot?: boolean;
9
9
  }
10
- export declare const connectToastMessage: (Component: React.FC, options?: ConnectToastMessageOptions) => (props: any) => import("react/jsx-runtime").JSX.Element;
10
+ /**
11
+ * 高阶组件,用于为 React 组件连接 Toast 和 Message 功能
12
+ *
13
+ * 根据不同的运行环境(H5/微信小程序)和组件层级(根页面/子页面),
14
+ * 决定是否渲染 Toast 和 Message 组件,以避免功能冲突和界面遮挡
15
+ *
16
+ * @param Component - 需要被包装的 React 组件
17
+ * @param options - 配置选项
18
+ * @param options.isRoot - 是否为根页面组件,默认为 false
19
+ * @returns 返回一个经过优化的 React 组件,根据环境条件选择性渲染 Toast 和 Message
20
+ */
21
+ export declare const connectToastMessage: (Component: React.FC, options?: ConnectToastMessageOptions) => React.MemoExoticComponent<(props: any) => import("react/jsx-runtime").JSX.Element>;
@@ -32,7 +32,7 @@ const external_Toast_index_js_namespaceObject = require("../Toast/index.js");
32
32
  const external_react_namespaceObject = require("react");
33
33
  const connectToastMessage = (Component, options = {})=>{
34
34
  const { isRoot = false } = options;
35
- return (props)=>{
35
+ return /*#__PURE__*/ (0, external_react_namespaceObject.memo)((props)=>{
36
36
  if ('weapp' === process.env.TARO_ENV) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_react_namespaceObject.Fragment, {
37
37
  children: [
38
38
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Component, {
@@ -51,7 +51,7 @@ const connectToastMessage = (Component, options = {})=>{
51
51
  isRoot ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.FairysTaroPortalMessage, {}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {})
52
52
  ]
53
53
  });
54
- };
54
+ });
55
55
  };
56
56
  exports.connectToastMessage = __webpack_exports__.connectToastMessage;
57
57
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
@@ -17,7 +17,7 @@ export interface MessageDataType extends FairysTaroMessageItemProps {
17
17
  }
18
18
  export interface ToastDataType extends Partial<TaroToastProps> {
19
19
  }
20
- export interface GlobalDataInstanceState {
20
+ export interface GlobalMessageDataInstanceState {
21
21
  /**弹框提示框*/
22
22
  messageData?: MessageDataType[];
23
23
  /**提示框数据*/
@@ -25,8 +25,11 @@ export interface GlobalDataInstanceState {
25
25
  /**数据默认值不使用*/
26
26
  __defaultValue?: string;
27
27
  }
28
- export declare class GlobalDataInstance extends ProxyInstanceObjectBase<GlobalDataInstanceState> {
29
- store: GlobalDataInstanceState;
28
+ /**
29
+ * 全局消息数据实例
30
+ */
31
+ export declare class GlobalMessageDataInstance extends ProxyInstanceObjectBase<GlobalMessageDataInstanceState> {
32
+ store: GlobalMessageDataInstanceState;
30
33
  /**用于提示信息*/
31
34
  showMessage: (options: Omit<MessageDataType, "__id"> & {
32
35
  __id?: string;
@@ -45,10 +48,10 @@ export declare class GlobalDataInstance extends ProxyInstanceObjectBase<GlobalDa
45
48
  toLoginPage: () => void;
46
49
  }
47
50
  /**
48
- * 全局数据实例
51
+ * 全局消息数据实例
49
52
  */
50
- export declare const globalDataInstance: GlobalDataInstance;
53
+ export declare const globalMessageDataInstance: GlobalMessageDataInstance;
51
54
  /**
52
- * 全局数据状态管理
55
+ * 全局消息数据状态管理
53
56
  */
54
- export declare const useGlobalData: () => [GlobalDataInstanceState, GlobalDataInstance, string | undefined];
57
+ export declare const useGlobalMessageData: () => [GlobalMessageDataInstanceState, GlobalMessageDataInstance, string | undefined];