@fairys/taro-tools-react 1.0.4 → 1.0.5
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/esm/context/auth.data.instance.d.ts +3 -3
- package/esm/context/auth.data.instance.js +6 -6
- package/esm/context/global.data.instance.d.ts +4 -0
- package/esm/context/global.data.instance.js +5 -0
- package/lib/components/EnterLoading/index.d.ts +14 -0
- package/lib/components/EnterLoading/index.js +112 -0
- package/lib/components/MainPage/index.d.ts +10 -0
- package/lib/components/MainPage/index.js +102 -0
- package/lib/components/Mesage/index.d.ts +48 -0
- package/lib/components/Mesage/index.js +172 -0
- package/lib/components/Portal/index.d.ts +8 -0
- package/lib/components/Portal/index.js +45 -0
- package/lib/components/Toast/index.d.ts +1 -0
- package/lib/components/Toast/index.js +54 -0
- package/lib/components/connectToastMessage/index.d.ts +10 -0
- package/lib/components/connectToastMessage/index.js +62 -0
- package/lib/components/index.d.ts +6 -0
- package/lib/components/index.js +105 -0
- package/lib/context/auth.data.instance.d.ts +81 -0
- package/lib/context/auth.data.instance.js +155 -0
- package/lib/context/global.data.instance.d.ts +54 -0
- package/lib/context/global.data.instance.js +122 -0
- package/lib/context/global.setting.data.instance.d.ts +56 -0
- package/lib/context/global.setting.data.instance.js +79 -0
- package/lib/context/index.d.ts +5 -0
- package/lib/context/index.js +96 -0
- package/lib/context/page.data.instance.d.ts +151 -0
- package/lib/context/page.data.instance.js +382 -0
- package/lib/context/page.info.data.instance.d.ts +93 -0
- package/lib/context/page.info.data.instance.js +226 -0
- package/lib/index.d.ts +3 -0
- package/lib/styles/index.css +715 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +87 -0
- package/lib/utils/navigate.d.ts +109 -0
- package/lib/utils/navigate.js +99 -0
- package/lib/utils/request.d.ts +179 -0
- package/lib/utils/request.js +358 -0
- package/lib/utils/useId.d.ts +2 -0
- package/lib/utils/useId.js +50 -0
- package/lib/utils/valtio/index.d.ts +9 -0
- package/lib/utils/valtio/index.js +99 -0
- package/lib/utils/valtio/instance.d.ts +17 -0
- package/lib/utils/valtio/instance.js +80 -0
- package/package.json +4 -3
- package/src/context/auth.data.instance.ts +6 -6
- package/src/context/global.data.instance.ts +11 -0
- package/src/utils/navigate.ts +1 -0
|
@@ -58,17 +58,17 @@ export declare class AuthDataInstance<T = any> {
|
|
|
58
58
|
* @param menuPermission 菜单权限
|
|
59
59
|
* @returns 是否有指定菜单权限
|
|
60
60
|
*/
|
|
61
|
-
hasMenuPermission(menuPermission: string)
|
|
61
|
+
hasMenuPermission: (menuPermission: string) => boolean;
|
|
62
62
|
/**
|
|
63
63
|
* 判断是否有指定权限
|
|
64
64
|
* @param permission 权限
|
|
65
65
|
* @returns 是否有指定权限
|
|
66
66
|
*/
|
|
67
|
-
hasPermission(permission: string)
|
|
67
|
+
hasPermission: (permission: string) => boolean;
|
|
68
68
|
/**
|
|
69
69
|
* 清除登录凭证(token)、权限列表、菜单权限列表、用户信息
|
|
70
70
|
*/
|
|
71
|
-
clear()
|
|
71
|
+
clear: () => void;
|
|
72
72
|
/**
|
|
73
73
|
* 初始化认证数据实例
|
|
74
74
|
*/
|
|
@@ -68,20 +68,20 @@ class AuthDataInstance {
|
|
|
68
68
|
}
|
|
69
69
|
return this.store.menusPermissions || [];
|
|
70
70
|
}
|
|
71
|
-
hasMenuPermission(menuPermission)
|
|
71
|
+
hasMenuPermission = (menuPermission)=>{
|
|
72
72
|
if (!globalSettingDataInstance.store.isEnableAuth) return true;
|
|
73
73
|
return this.menusPermissions.includes(menuPermission);
|
|
74
|
-
}
|
|
75
|
-
hasPermission(permission)
|
|
74
|
+
};
|
|
75
|
+
hasPermission = (permission)=>{
|
|
76
76
|
if (!globalSettingDataInstance.store.isEnableAuth) return true;
|
|
77
77
|
return this.permissions.includes(permission);
|
|
78
|
-
}
|
|
79
|
-
clear()
|
|
78
|
+
};
|
|
79
|
+
clear = ()=>{
|
|
80
80
|
this.token = '';
|
|
81
81
|
this.permissions = [];
|
|
82
82
|
this.menusPermissions = [];
|
|
83
83
|
this.userInfo = void 0;
|
|
84
|
-
}
|
|
84
|
+
};
|
|
85
85
|
constructor(){
|
|
86
86
|
try {
|
|
87
87
|
this.store.userInfo = this.userInfo;
|
|
@@ -37,6 +37,10 @@ export declare class GlobalDataInstance extends ProxyInstanceObjectBase<GlobalDa
|
|
|
37
37
|
showToast: (config?: Partial<ToastDataType>) => void;
|
|
38
38
|
/**隐藏Toast */
|
|
39
39
|
hideToast: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* 跳转登录页面前执行
|
|
42
|
+
*/
|
|
43
|
+
onBeforetToLoginPage?: () => boolean | void;
|
|
40
44
|
/**跳转登录页面*/
|
|
41
45
|
toLoginPage: () => void;
|
|
42
46
|
}
|
|
@@ -45,7 +45,12 @@ class GlobalDataInstance extends ProxyInstanceObjectBase {
|
|
|
45
45
|
visible: false
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
|
+
onBeforetToLoginPage;
|
|
48
49
|
toLoginPage = ()=>{
|
|
50
|
+
if (this.onBeforetToLoginPage) {
|
|
51
|
+
const f = this.onBeforetToLoginPage();
|
|
52
|
+
if (false === f) return;
|
|
53
|
+
}
|
|
49
54
|
const loginPageRoute = globalSettingDataInstance.store.loginPageRoute || '';
|
|
50
55
|
const isLoginPage = utils_navigate.isCurrentPage(loginPageRoute || '');
|
|
51
56
|
const _loginPageRoute = `${loginPageRoute || ''}`.replace(/^\//, '');
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ViewProps } from '@tarojs/components';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface FairysTaroLoadingProps extends ViewProps {
|
|
4
|
+
/**加载标题*/
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
/**加载提示*/
|
|
7
|
+
tips?: ReactNode;
|
|
8
|
+
/**是否显示加载动画*/
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
/**是否显示在 Portal 中*/
|
|
11
|
+
isPortal?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const FairysTaroLoadingMain: import("react").ForwardRefExoticComponent<Omit<Omit<FairysTaroLoadingProps, "loading" | "isPortal">, "ref"> & import("react").RefAttributes<ViewProps>>;
|
|
14
|
+
export declare const FairysTaroLoading: import("react").ForwardRefExoticComponent<Omit<FairysTaroLoadingProps, "ref"> & import("react").RefAttributes<ViewProps>>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
FairysTaroLoading: ()=>FairysTaroLoading,
|
|
37
|
+
FairysTaroLoadingMain: ()=>FairysTaroLoadingMain
|
|
38
|
+
});
|
|
39
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
40
|
+
const external_clsx_namespaceObject = require("clsx");
|
|
41
|
+
var external_clsx_default = /*#__PURE__*/ __webpack_require__.n(external_clsx_namespaceObject);
|
|
42
|
+
const components_namespaceObject = require("@tarojs/components");
|
|
43
|
+
const external_react_namespaceObject = require("react");
|
|
44
|
+
const index_js_namespaceObject = require("../Portal/index.js");
|
|
45
|
+
const FairysTaroLoadingMain = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((props, ref)=>{
|
|
46
|
+
const { title = '', tips = "\u8F7D\u5165\u4E2D", className, ...rest } = props;
|
|
47
|
+
const classNames = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro_loading fairystaro__bg-white_xg_90', className), [
|
|
48
|
+
className
|
|
49
|
+
]);
|
|
50
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {
|
|
51
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(components_namespaceObject.View, {
|
|
52
|
+
...rest,
|
|
53
|
+
ref: ref,
|
|
54
|
+
className: classNames,
|
|
55
|
+
children: [
|
|
56
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(components_namespaceObject.View, {
|
|
57
|
+
className: "fairys_taro_loading-main",
|
|
58
|
+
children: [
|
|
59
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
60
|
+
className: "square"
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
63
|
+
className: "square"
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
66
|
+
className: "square"
|
|
67
|
+
}),
|
|
68
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
69
|
+
className: "square"
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
}),
|
|
73
|
+
title ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
74
|
+
className: "name",
|
|
75
|
+
children: title
|
|
76
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {}),
|
|
77
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(components_namespaceObject.View, {
|
|
78
|
+
className: "tips",
|
|
79
|
+
children: [
|
|
80
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.Text, {
|
|
81
|
+
children: tips
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.Text, {
|
|
84
|
+
className: "loading-dots"
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
})
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
const FairysTaroLoading = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((props, ref)=>{
|
|
93
|
+
const { loading = false, isPortal = true, ...rest } = props;
|
|
94
|
+
return loading ? isPortal ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.FairysTaroPortal, {
|
|
95
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FairysTaroLoadingMain, {
|
|
96
|
+
...rest,
|
|
97
|
+
ref: ref
|
|
98
|
+
})
|
|
99
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FairysTaroLoadingMain, {
|
|
100
|
+
...rest,
|
|
101
|
+
ref: ref
|
|
102
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {});
|
|
103
|
+
});
|
|
104
|
+
exports.FairysTaroLoading = __webpack_exports__.FairysTaroLoading;
|
|
105
|
+
exports.FairysTaroLoadingMain = __webpack_exports__.FairysTaroLoadingMain;
|
|
106
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
107
|
+
"FairysTaroLoading",
|
|
108
|
+
"FairysTaroLoadingMain"
|
|
109
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
110
|
+
Object.defineProperty(exports, '__esModule', {
|
|
111
|
+
value: true
|
|
112
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ViewProps } from '@tarojs/components';
|
|
2
|
+
export interface FairysTaroMainPageProps extends ViewProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const FairysTaroMainPage: (props: FairysTaroMainPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
/**查询*/
|
|
6
|
+
export declare const FairysTaroMainPageSearch: (props: FairysTaroMainPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
/**内容*/
|
|
8
|
+
export declare const FairysTaroMainPageBody: (props: FairysTaroMainPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
/**底部*/
|
|
10
|
+
export declare const FairysTaroMainPageFooter: (props: FairysTaroMainPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
FairysTaroMainPageFooter: ()=>FairysTaroMainPageFooter,
|
|
37
|
+
FairysTaroMainPage: ()=>FairysTaroMainPage,
|
|
38
|
+
FairysTaroMainPageSearch: ()=>FairysTaroMainPageSearch,
|
|
39
|
+
FairysTaroMainPageBody: ()=>FairysTaroMainPageBody
|
|
40
|
+
});
|
|
41
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
42
|
+
const components_namespaceObject = require("@tarojs/components");
|
|
43
|
+
const external_clsx_namespaceObject = require("clsx");
|
|
44
|
+
var external_clsx_default = /*#__PURE__*/ __webpack_require__.n(external_clsx_namespaceObject);
|
|
45
|
+
const external_react_namespaceObject = require("react");
|
|
46
|
+
const FairysTaroMainPage = (props)=>{
|
|
47
|
+
const { className: itemClassName, children, ...rest } = props;
|
|
48
|
+
const cls = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro-ui-main-page fairystaro__box-border fairystaro__w-full fairystaro__h-full fairystaro__flex fairystaro__flex-col fairystaro__overflow-auto', itemClassName), [
|
|
49
|
+
itemClassName
|
|
50
|
+
]);
|
|
51
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
52
|
+
className: cls,
|
|
53
|
+
...rest,
|
|
54
|
+
children: children
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const FairysTaroMainPageSearch = (props)=>{
|
|
58
|
+
const { className: itemClassName, children, ...rest } = props;
|
|
59
|
+
const cls = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro-ui-main-page-search fairystaro__box-border fairystaro__w-full', itemClassName), [
|
|
60
|
+
itemClassName
|
|
61
|
+
]);
|
|
62
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
63
|
+
className: cls,
|
|
64
|
+
...rest,
|
|
65
|
+
children: children
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const FairysTaroMainPageBody = (props)=>{
|
|
69
|
+
const { className: itemClassName, children, ...rest } = props;
|
|
70
|
+
const cls = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro-ui-main-page-body fairystaro__box-border fairystaro__w-full fairystaro__flex-1 fairystaro__overflow-auto', itemClassName), [
|
|
71
|
+
itemClassName
|
|
72
|
+
]);
|
|
73
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
74
|
+
className: cls,
|
|
75
|
+
...rest,
|
|
76
|
+
children: children
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const FairysTaroMainPageFooter = (props)=>{
|
|
80
|
+
const { className: itemClassName, children, ...rest } = props;
|
|
81
|
+
const cls = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro-ui-main-page-footer fairystaro__box-border fairystaro__w-full', itemClassName), [
|
|
82
|
+
itemClassName
|
|
83
|
+
]);
|
|
84
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
85
|
+
className: cls,
|
|
86
|
+
...rest,
|
|
87
|
+
children: children
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
exports.FairysTaroMainPage = __webpack_exports__.FairysTaroMainPage;
|
|
91
|
+
exports.FairysTaroMainPageBody = __webpack_exports__.FairysTaroMainPageBody;
|
|
92
|
+
exports.FairysTaroMainPageFooter = __webpack_exports__.FairysTaroMainPageFooter;
|
|
93
|
+
exports.FairysTaroMainPageSearch = __webpack_exports__.FairysTaroMainPageSearch;
|
|
94
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
95
|
+
"FairysTaroMainPage",
|
|
96
|
+
"FairysTaroMainPageBody",
|
|
97
|
+
"FairysTaroMainPageFooter",
|
|
98
|
+
"FairysTaroMainPageSearch"
|
|
99
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
100
|
+
Object.defineProperty(exports, '__esModule', {
|
|
101
|
+
value: true
|
|
102
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ViewProps } from '@tarojs/components';
|
|
2
|
+
export interface FairysTaroMessageItemProps extends Omit<ViewProps, 'style'> {
|
|
3
|
+
/**
|
|
4
|
+
* 提示内容
|
|
5
|
+
*/
|
|
6
|
+
title?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* 提示框类型
|
|
9
|
+
* @default none
|
|
10
|
+
*/
|
|
11
|
+
type?: 'none' | 'success' | 'error' | 'warning' | 'info';
|
|
12
|
+
/**
|
|
13
|
+
* 自定义图标
|
|
14
|
+
*/
|
|
15
|
+
icon?: React.ReactNode;
|
|
16
|
+
/**消息项是否显示边框*/
|
|
17
|
+
bordered?: boolean;
|
|
18
|
+
/**图标 className*/
|
|
19
|
+
iconClassName?: string;
|
|
20
|
+
/**图标 style*/
|
|
21
|
+
iconStyle?: React.CSSProperties;
|
|
22
|
+
/**标题 className*/
|
|
23
|
+
titleClassName?: string;
|
|
24
|
+
/**标题 style*/
|
|
25
|
+
titleStyle?: React.CSSProperties;
|
|
26
|
+
/**内容 className*/
|
|
27
|
+
bodyClassName?: string;
|
|
28
|
+
/**内容 style*/
|
|
29
|
+
bodyStyle?: React.CSSProperties;
|
|
30
|
+
/**样式*/
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
/**图标颜色*/
|
|
33
|
+
iconColor?: string;
|
|
34
|
+
/**边框颜色*/
|
|
35
|
+
borderColor?: string;
|
|
36
|
+
/**背景颜色*/
|
|
37
|
+
backgroundColor?: string;
|
|
38
|
+
/**文本颜色*/
|
|
39
|
+
color?: string;
|
|
40
|
+
/**是否显示图标*/
|
|
41
|
+
showIcon?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export declare const FairysTaroMessageItem: (props: FairysTaroMessageItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export interface FairysTaroMessageProps extends ViewProps {
|
|
45
|
+
}
|
|
46
|
+
export declare const FairysTaroMessage: (props: FairysTaroMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
/**消息组件(用于全局消息提示)*/
|
|
48
|
+
export declare const FairysTaroPortalMessage: (props: FairysTaroMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
FairysTaroMessage: ()=>FairysTaroMessage,
|
|
37
|
+
FairysTaroMessageItem: ()=>FairysTaroMessageItem,
|
|
38
|
+
FairysTaroPortalMessage: ()=>FairysTaroPortalMessage
|
|
39
|
+
});
|
|
40
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
41
|
+
const external_react_namespaceObject = require("react");
|
|
42
|
+
const components_namespaceObject = require("@tarojs/components");
|
|
43
|
+
const global_data_instance_js_namespaceObject = require("../../context/global.data.instance.js");
|
|
44
|
+
const index_js_namespaceObject = require("../Portal/index.js");
|
|
45
|
+
const external_clsx_namespaceObject = require("clsx");
|
|
46
|
+
var external_clsx_default = /*#__PURE__*/ __webpack_require__.n(external_clsx_namespaceObject);
|
|
47
|
+
const FairysTaroMessageItem = (props)=>{
|
|
48
|
+
const { title, children, type = 'info', className: itemClassName, bordered = true, iconClassName, iconStyle = {}, titleClassName, titleStyle, bodyClassName, bodyStyle, icon, iconColor, borderColor, backgroundColor, style = {}, color, showIcon = true, ...rest } = props;
|
|
49
|
+
const isIcon = !!icon;
|
|
50
|
+
const isIconString = 'string' == typeof icon;
|
|
51
|
+
const className = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro-ui-message-item', `fairys_taro-ui-message-icon-${type}`, 'fairystaro__box-border fairystaro__flex fairystaro__flex-row fairystaro__gap-_zkh1_0_dl_4rem_zhk2_ fairystaro__p-y-_zkh1_0_dl_4rem_zhk2_ fairystaro__p-x-_zkh1_0_dl_4rem_zhk2_ fairystaro__rounded-md fairystaro__text-_zkh1_0_dl_8rem_zhk2_', {
|
|
52
|
+
'fairystaro__border fairystaro__border-solid': bordered
|
|
53
|
+
}, itemClassName), [
|
|
54
|
+
type,
|
|
55
|
+
itemClassName,
|
|
56
|
+
bordered
|
|
57
|
+
]);
|
|
58
|
+
const classIconName = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro-ui-message-icon fairystaro__box-border fairystaro__text-_zkh1_0_dl_6rem_zhk2_', iconClassName, {
|
|
59
|
+
'ant-design--close-circle-outlined': 'error' === type && !isIcon,
|
|
60
|
+
'ant-design--exclamation-circle-outlined': 'warning' === type && !isIcon,
|
|
61
|
+
'ant-design--check-circle-outlined': 'success' === type && !isIcon,
|
|
62
|
+
'ant-design--info-circle-outlined': 'info' === type && !isIcon,
|
|
63
|
+
'fairystaro__text-color-_zkh1_red_zhk2_': 'error' === type,
|
|
64
|
+
'fairystaro__text-color-_zkh1_orange_zhk2_': 'warning' === type,
|
|
65
|
+
'fairystaro__text-color-_zkh1_green_zhk2_': 'success' === type,
|
|
66
|
+
'fairystaro__text-color-_zkh1_blue_zhk2_': 'info' === type
|
|
67
|
+
}), [
|
|
68
|
+
type,
|
|
69
|
+
iconClassName,
|
|
70
|
+
isIcon
|
|
71
|
+
]);
|
|
72
|
+
const lastIconClassName = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()(classIconName, isIconString ? icon : ''), [
|
|
73
|
+
classIconName,
|
|
74
|
+
isIconString,
|
|
75
|
+
icon
|
|
76
|
+
]);
|
|
77
|
+
const titleClassNames = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro-ui-message-item-title fairystaro__font-bold fairystaro__text-_zkh1_0_dl_6rem_zhk2_', titleClassName), [
|
|
78
|
+
titleClassName
|
|
79
|
+
]);
|
|
80
|
+
const _iconStyle = {
|
|
81
|
+
...iconStyle
|
|
82
|
+
};
|
|
83
|
+
if (iconColor) _iconStyle.color = iconColor;
|
|
84
|
+
const _style = {
|
|
85
|
+
...style
|
|
86
|
+
};
|
|
87
|
+
if (borderColor) _style.borderColor = borderColor;
|
|
88
|
+
if (backgroundColor) _style.backgroundColor = backgroundColor;
|
|
89
|
+
if (color) _style.color = color;
|
|
90
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(components_namespaceObject.View, {
|
|
91
|
+
className: className,
|
|
92
|
+
...rest,
|
|
93
|
+
style: _style,
|
|
94
|
+
children: [
|
|
95
|
+
showIcon ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(components_namespaceObject.View, {
|
|
96
|
+
className: "fairystaro__flex fairystaro__flex-row fairystaro__justify-center fairystaro__p-t-_zkh1_0_dl_15rem_zhk2_",
|
|
97
|
+
children: [
|
|
98
|
+
isIcon ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
99
|
+
className: classIconName,
|
|
100
|
+
style: _iconStyle
|
|
101
|
+
}),
|
|
102
|
+
isIcon && !isIconString ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
103
|
+
className: classIconName,
|
|
104
|
+
style: _iconStyle,
|
|
105
|
+
children: icon
|
|
106
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {}),
|
|
107
|
+
isIcon && isIconString ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
108
|
+
className: lastIconClassName,
|
|
109
|
+
style: _iconStyle
|
|
110
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {})
|
|
111
|
+
]
|
|
112
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {}),
|
|
113
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(components_namespaceObject.View, {
|
|
114
|
+
children: [
|
|
115
|
+
title ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
116
|
+
className: titleClassNames,
|
|
117
|
+
style: titleStyle,
|
|
118
|
+
children: title
|
|
119
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {}),
|
|
120
|
+
children ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
121
|
+
className: external_clsx_default()('fairys_taro-ui-message-item-body fairystaro__text-_zkh1_0_dl_6rem_zhk2_', bodyClassName),
|
|
122
|
+
style: bodyStyle,
|
|
123
|
+
children: children
|
|
124
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {})
|
|
125
|
+
]
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const FairysTaroMessage = (props)=>{
|
|
131
|
+
const { className: messageClassName, ...rest } = props;
|
|
132
|
+
const classNames = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro-ui-message fairystaro__box-border fairystaro__p-2 fairystaro__flex fairystaro__flex-col fairystaro__items-center fairystaro__gap-2 fairystaro__max-w-full fairystaro__max-h-full', messageClassName), [
|
|
133
|
+
messageClassName
|
|
134
|
+
]);
|
|
135
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.View, {
|
|
136
|
+
...rest,
|
|
137
|
+
className: classNames
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
const FairysTaroPortalMessage = (props)=>{
|
|
141
|
+
const { className: messageClassName, ...rest } = props;
|
|
142
|
+
const [state] = (0, global_data_instance_js_namespaceObject.useGlobalData)();
|
|
143
|
+
const messageData = state.messageData;
|
|
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
|
+
messageClassName
|
|
146
|
+
]);
|
|
147
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.FairysTaroPortal, {
|
|
148
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FairysTaroMessage, {
|
|
149
|
+
...rest,
|
|
150
|
+
className: classNames,
|
|
151
|
+
children: messageData.map((item)=>{
|
|
152
|
+
const { content, visible, __id, ...rest } = item;
|
|
153
|
+
if (visible) return /*#__PURE__*/ (0, external_react_namespaceObject.createElement)(FairysTaroMessageItem, {
|
|
154
|
+
...rest,
|
|
155
|
+
key: __id
|
|
156
|
+
}, content);
|
|
157
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {}, `${__id}_hidden`);
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
exports.FairysTaroMessage = __webpack_exports__.FairysTaroMessage;
|
|
163
|
+
exports.FairysTaroMessageItem = __webpack_exports__.FairysTaroMessageItem;
|
|
164
|
+
exports.FairysTaroPortalMessage = __webpack_exports__.FairysTaroPortalMessage;
|
|
165
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
166
|
+
"FairysTaroMessage",
|
|
167
|
+
"FairysTaroMessageItem",
|
|
168
|
+
"FairysTaroPortalMessage"
|
|
169
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
170
|
+
Object.defineProperty(exports, '__esModule', {
|
|
171
|
+
value: true
|
|
172
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
FairysTaroPortal: ()=>FairysTaroPortal
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_react_dom_namespaceObject = require("react-dom");
|
|
31
|
+
const components_namespaceObject = require("@tarojs/components");
|
|
32
|
+
const FairysTaroPortal = (props)=>{
|
|
33
|
+
const { children, domContainer } = props;
|
|
34
|
+
if ('weapp' === process.env.TARO_ENV) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.RootPortal, {
|
|
35
|
+
children: children
|
|
36
|
+
});
|
|
37
|
+
return /*#__PURE__*/ (0, external_react_dom_namespaceObject.createPortal)(children, domContainer || document.body);
|
|
38
|
+
};
|
|
39
|
+
exports.FairysTaroPortal = __webpack_exports__.FairysTaroPortal;
|
|
40
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
41
|
+
"FairysTaroPortal"
|
|
42
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
43
|
+
Object.defineProperty(exports, '__esModule', {
|
|
44
|
+
value: true
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FairysTaroToast: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
FairysTaroToast: ()=>FairysTaroToast
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const nutui_react_taro_namespaceObject = require("@nutui/nutui-react-taro");
|
|
31
|
+
const index_js_namespaceObject = require("../Portal/index.js");
|
|
32
|
+
const global_data_instance_js_namespaceObject = require("../../context/global.data.instance.js");
|
|
33
|
+
const FairysTaroToast = ()=>{
|
|
34
|
+
const [state, proxyInstance] = (0, global_data_instance_js_namespaceObject.useGlobalData)();
|
|
35
|
+
const toastConfig = state.toastData;
|
|
36
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.FairysTaroPortal, {
|
|
37
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(nutui_react_taro_namespaceObject.Toast, {
|
|
38
|
+
type: "text",
|
|
39
|
+
...toastConfig,
|
|
40
|
+
visible: toastConfig?.visible || false,
|
|
41
|
+
onClose: ()=>{
|
|
42
|
+
toastConfig?.onClose?.();
|
|
43
|
+
proxyInstance.hideToast();
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
exports.FairysTaroToast = __webpack_exports__.FairysTaroToast;
|
|
49
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
50
|
+
"FairysTaroToast"
|
|
51
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
52
|
+
Object.defineProperty(exports, '__esModule', {
|
|
53
|
+
value: true
|
|
54
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ConnectToastMessageOptions {
|
|
3
|
+
/**
|
|
4
|
+
* 是否是根页面,
|
|
5
|
+
* 在 h5 中,只有入口文件才需要展示 message 组件 和 toast 组件
|
|
6
|
+
* 在微信中,所有页面都需要展示 message 组件 和 toast 组件, 入口文件不展示
|
|
7
|
+
*/
|
|
8
|
+
isRoot?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const connectToastMessage: (Component: React.FC, options?: ConnectToastMessageOptions) => (props: any) => import("react/jsx-runtime").JSX.Element;
|