@fairys/taro-tools-react 1.0.32 → 1.0.34
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/components/custom-tab-bar/index.css +39 -0
- package/esm/components/custom-tab-bar/index.d.ts +57 -0
- package/esm/components/custom-tab-bar/index.js +114 -0
- package/esm/components/index.d.ts +1 -0
- package/esm/components/index.js +1 -0
- package/esm/context/global.data.instance.d.ts +27 -0
- package/esm/context/global.data.instance.js +40 -0
- package/esm/context/global.message.data.instance.d.ts +0 -7
- package/esm/context/global.message.data.instance.js +0 -23
- package/esm/context/index.d.ts +1 -0
- package/esm/context/index.js +1 -0
- package/esm/context/page.data.instance.d.ts +2 -0
- package/esm/context/page.data.instance.js +4 -1
- package/esm/context/page.info.data.instance.d.ts +2 -0
- package/esm/context/page.info.data.instance.js +4 -1
- package/esm/styles/index.css +18 -0
- package/esm/utils/request.js +3 -2
- package/lib/components/custom-tab-bar/index.css +39 -0
- package/lib/components/custom-tab-bar/index.d.ts +57 -0
- package/lib/components/custom-tab-bar/index.js +165 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +9 -0
- package/lib/context/global.data.instance.d.ts +27 -0
- package/lib/context/global.data.instance.js +91 -0
- package/lib/context/global.message.data.instance.d.ts +0 -7
- package/lib/context/global.message.data.instance.js +0 -34
- package/lib/context/index.d.ts +1 -0
- package/lib/context/index.js +9 -0
- package/lib/context/page.data.instance.d.ts +2 -0
- package/lib/context/page.data.instance.js +4 -1
- package/lib/context/page.info.data.instance.d.ts +2 -0
- package/lib/context/page.info.data.instance.js +4 -1
- package/lib/styles/index.css +18 -0
- package/lib/utils/request.js +3 -2
- package/package.json +1 -1
- package/src/components/custom-tab-bar/index.css +38 -0
- package/src/components/custom-tab-bar/index.tsx +169 -0
- package/src/components/index.ts +1 -0
- package/src/context/global.data.instance.ts +69 -0
- package/src/context/global.message.data.instance.ts +1 -34
- package/src/context/index.ts +1 -0
- package/src/context/page.data.instance.tsx +9 -0
- package/src/context/page.info.data.instance.tsx +8 -0
- package/src/utils/request.ts +3 -2
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
fairysTaroCustomTabBarState: ()=>fairysTaroCustomTabBarState,
|
|
37
|
+
useFairysTaroCustomTabBarPageStyle: ()=>useFairysTaroCustomTabBarPageStyle,
|
|
38
|
+
FairysTaroCustomTabBar: ()=>FairysTaroCustomTabBar
|
|
39
|
+
});
|
|
40
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
41
|
+
const external_valtio_namespaceObject = require("valtio");
|
|
42
|
+
const components_namespaceObject = require("@tarojs/components");
|
|
43
|
+
const taro_namespaceObject = require("@tarojs/taro");
|
|
44
|
+
var taro_default = /*#__PURE__*/ __webpack_require__.n(taro_namespaceObject);
|
|
45
|
+
const external_react_namespaceObject = require("react");
|
|
46
|
+
const external_clsx_namespaceObject = require("clsx");
|
|
47
|
+
var external_clsx_default = /*#__PURE__*/ __webpack_require__.n(external_clsx_namespaceObject);
|
|
48
|
+
let fairysTaroCustomTabBarRender;
|
|
49
|
+
const fairysTaroCustomTabBarState = (0, external_valtio_namespaceObject.proxy)({
|
|
50
|
+
selected: '',
|
|
51
|
+
items: (0, external_valtio_namespaceObject.ref)([]),
|
|
52
|
+
isUpdatedItems: false,
|
|
53
|
+
color: 'rgb(156 163 175)',
|
|
54
|
+
selectedColor: '#000',
|
|
55
|
+
onSwitchTab: (url)=>{
|
|
56
|
+
fairysTaroCustomTabBarState.selected = url;
|
|
57
|
+
taro_default().switchTab({
|
|
58
|
+
url
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
onUpdatedItems: (items)=>{
|
|
62
|
+
fairysTaroCustomTabBarState.items = (0, external_valtio_namespaceObject.ref)(items);
|
|
63
|
+
fairysTaroCustomTabBarState.isUpdatedItems = true;
|
|
64
|
+
},
|
|
65
|
+
onSetTabBarRender: (_tabBarRender)=>{
|
|
66
|
+
fairysTaroCustomTabBarRender = _tabBarRender;
|
|
67
|
+
fairysTaroCustomTabBarState.isUpdatedItems = false;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const FairysTaroCustomTabBarItemBase = (props)=>{
|
|
71
|
+
const { item } = props;
|
|
72
|
+
const { selected, color, selectedColor } = (0, external_valtio_namespaceObject.useSnapshot)(fairysTaroCustomTabBarState);
|
|
73
|
+
const isSelected = selected === item.url;
|
|
74
|
+
const className = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro_custom_tab_bar_item', item.className), [
|
|
75
|
+
item.className
|
|
76
|
+
]);
|
|
77
|
+
const imgClassName = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro_custom_tab_bar_item_img', item.selectedIconClassName, {
|
|
78
|
+
fairys_taro_custom_tab_bar_item_img_selected: isSelected
|
|
79
|
+
}), [
|
|
80
|
+
item.selectedIconClassName,
|
|
81
|
+
isSelected
|
|
82
|
+
]);
|
|
83
|
+
const imgStyle = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
84
|
+
opacity: isSelected ? 1 : 0.6
|
|
85
|
+
}), [
|
|
86
|
+
isSelected
|
|
87
|
+
]);
|
|
88
|
+
const textClassName = (0, external_react_namespaceObject.useMemo)(()=>external_clsx_default()('fairys_taro_custom_tab_bar_item_text', item.selectedTextClassName, {
|
|
89
|
+
fairys_taro_custom_tab_bar_item_text_selected: isSelected
|
|
90
|
+
}), [
|
|
91
|
+
item.selectedTextClassName,
|
|
92
|
+
isSelected
|
|
93
|
+
]);
|
|
94
|
+
const textStyle = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
95
|
+
color: isSelected ? selectedColor : color
|
|
96
|
+
}), [
|
|
97
|
+
isSelected,
|
|
98
|
+
color,
|
|
99
|
+
selectedColor
|
|
100
|
+
]);
|
|
101
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(components_namespaceObject.CoverView, {
|
|
102
|
+
onClick: ()=>fairysTaroCustomTabBarState.onSwitchTab(item.url),
|
|
103
|
+
style: item.style,
|
|
104
|
+
className: className,
|
|
105
|
+
children: [
|
|
106
|
+
item.icon ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.CoverImage, {
|
|
107
|
+
src: isSelected ? item.selectedIcon || item.icon : item.icon,
|
|
108
|
+
className: imgClassName,
|
|
109
|
+
style: {
|
|
110
|
+
...imgStyle,
|
|
111
|
+
...(isSelected ? item.selectedIconStyle : item.iconStyle) || {}
|
|
112
|
+
}
|
|
113
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_namespaceObject.Fragment, {}),
|
|
114
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.CoverView, {
|
|
115
|
+
className: textClassName,
|
|
116
|
+
style: {
|
|
117
|
+
...(isSelected ? item.selectedTextStyle : item.textStyle) || {},
|
|
118
|
+
...textStyle
|
|
119
|
+
},
|
|
120
|
+
children: item.text
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
}, item.url);
|
|
124
|
+
};
|
|
125
|
+
const FairysTaroCustomTabBarBase = ()=>{
|
|
126
|
+
const { items } = (0, external_valtio_namespaceObject.useSnapshot)(fairysTaroCustomTabBarState);
|
|
127
|
+
const _itemsRender = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
128
|
+
if (false === fairysTaroCustomTabBarState.isUpdatedItems && fairysTaroCustomTabBarRender) return fairysTaroCustomTabBarRender;
|
|
129
|
+
const render = items.map((item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FairysTaroCustomTabBarItemBase, {
|
|
130
|
+
item: item
|
|
131
|
+
}, item.url));
|
|
132
|
+
fairysTaroCustomTabBarState.onSetTabBarRender(render);
|
|
133
|
+
return render;
|
|
134
|
+
}, [
|
|
135
|
+
items
|
|
136
|
+
]);
|
|
137
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(components_namespaceObject.CoverView, {
|
|
138
|
+
className: "fairys_taro_custom_tab_bar",
|
|
139
|
+
children: [
|
|
140
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.CoverView, {
|
|
141
|
+
className: "fairys_taro_custom_tab_bar-border"
|
|
142
|
+
}),
|
|
143
|
+
_itemsRender
|
|
144
|
+
]
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const FairysTaroCustomTabBar = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(()=>(0, external_react_namespaceObject.useMemo)(()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FairysTaroCustomTabBarBase, {}), []));
|
|
148
|
+
const useFairysTaroCustomTabBarPageStyle = ()=>(0, external_react_namespaceObject.useMemo)(()=>{
|
|
149
|
+
const height = taro_default().getSystemInfoSync().windowHeight;
|
|
150
|
+
return {
|
|
151
|
+
height: height - 60,
|
|
152
|
+
overflowY: 'auto'
|
|
153
|
+
};
|
|
154
|
+
}, []);
|
|
155
|
+
exports.FairysTaroCustomTabBar = __webpack_exports__.FairysTaroCustomTabBar;
|
|
156
|
+
exports.fairysTaroCustomTabBarState = __webpack_exports__.fairysTaroCustomTabBarState;
|
|
157
|
+
exports.useFairysTaroCustomTabBarPageStyle = __webpack_exports__.useFairysTaroCustomTabBarPageStyle;
|
|
158
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
159
|
+
"FairysTaroCustomTabBar",
|
|
160
|
+
"fairysTaroCustomTabBarState",
|
|
161
|
+
"useFairysTaroCustomTabBarPageStyle"
|
|
162
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
163
|
+
Object.defineProperty(exports, '__esModule', {
|
|
164
|
+
value: true
|
|
165
|
+
});
|
package/lib/components/index.js
CHANGED
|
@@ -17,6 +17,9 @@ var __webpack_modules__ = {
|
|
|
17
17
|
},
|
|
18
18
|
"./connectToastMessage": function(module) {
|
|
19
19
|
module.exports = require("./connectToastMessage/index.js");
|
|
20
|
+
},
|
|
21
|
+
"./custom-tab-bar": function(module) {
|
|
22
|
+
module.exports = require("./custom-tab-bar/index.js");
|
|
20
23
|
}
|
|
21
24
|
};
|
|
22
25
|
var __webpack_module_cache__ = {};
|
|
@@ -98,6 +101,12 @@ var __webpack_exports__ = {};
|
|
|
98
101
|
return _MainPage__WEBPACK_IMPORTED_MODULE_5__[key];
|
|
99
102
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
100
103
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
104
|
+
var _custom_tab_bar__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./custom-tab-bar");
|
|
105
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
106
|
+
for(var __WEBPACK_IMPORT_KEY__ in _custom_tab_bar__WEBPACK_IMPORTED_MODULE_6__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
107
|
+
return _custom_tab_bar__WEBPACK_IMPORTED_MODULE_6__[key];
|
|
108
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
109
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
101
110
|
})();
|
|
102
111
|
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
103
112
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ProxyInstanceObjectBase } from '../utils/valtio/instance';
|
|
2
|
+
export interface GlobalDataInstanceState {
|
|
3
|
+
/**数据默认值不使用*/
|
|
4
|
+
__defaultValue?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 全局数据实例
|
|
8
|
+
*/
|
|
9
|
+
export declare class GlobalDataInstance extends ProxyInstanceObjectBase<GlobalDataInstanceState> {
|
|
10
|
+
store: GlobalDataInstanceState;
|
|
11
|
+
/**
|
|
12
|
+
* 跳转登录页面前执行
|
|
13
|
+
*/
|
|
14
|
+
onBeforetToLoginPage?: () => boolean | void;
|
|
15
|
+
/**跳转 redirect 路由*/
|
|
16
|
+
toRedirect: () => void;
|
|
17
|
+
/**跳转登录页面*/
|
|
18
|
+
toLoginPage: () => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 全局数据实例
|
|
22
|
+
*/
|
|
23
|
+
export declare const globalDataInstance: GlobalDataInstance;
|
|
24
|
+
/**
|
|
25
|
+
* 全局数据状态管理
|
|
26
|
+
*/
|
|
27
|
+
export declare const useGlobalData: () => [GlobalDataInstanceState, GlobalDataInstance, string | undefined];
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
useGlobalData: ()=>useGlobalData,
|
|
37
|
+
GlobalDataInstance: ()=>GlobalDataInstance,
|
|
38
|
+
globalDataInstance: ()=>globalDataInstance
|
|
39
|
+
});
|
|
40
|
+
const external_valtio_namespaceObject = require("valtio");
|
|
41
|
+
const navigate_js_namespaceObject = require("../utils/navigate.js");
|
|
42
|
+
var navigate_js_default = /*#__PURE__*/ __webpack_require__.n(navigate_js_namespaceObject);
|
|
43
|
+
const instance_js_namespaceObject = require("../utils/valtio/instance.js");
|
|
44
|
+
const external_global_setting_data_instance_js_namespaceObject = require("./global.setting.data.instance.js");
|
|
45
|
+
const taro_namespaceObject = require("@tarojs/taro");
|
|
46
|
+
var taro_default = /*#__PURE__*/ __webpack_require__.n(taro_namespaceObject);
|
|
47
|
+
const external_auth_data_instance_js_namespaceObject = require("./auth.data.instance.js");
|
|
48
|
+
class GlobalDataInstance extends instance_js_namespaceObject.ProxyInstanceObjectBase {
|
|
49
|
+
store = (0, external_valtio_namespaceObject.proxy)({});
|
|
50
|
+
onBeforetToLoginPage;
|
|
51
|
+
toRedirect = ()=>{
|
|
52
|
+
const currentPath = taro_default().getCurrentInstance().router?.params?.redirect || '';
|
|
53
|
+
if (currentPath) navigate_js_default().navigateTo({
|
|
54
|
+
url: currentPath
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
toLoginPage = ()=>{
|
|
58
|
+
external_auth_data_instance_js_namespaceObject.authDataInstance.clear();
|
|
59
|
+
if (this.onBeforetToLoginPage) {
|
|
60
|
+
const f = this.onBeforetToLoginPage();
|
|
61
|
+
if (false === f) return;
|
|
62
|
+
}
|
|
63
|
+
const loginPageRoute = external_global_setting_data_instance_js_namespaceObject.globalSettingDataInstance.store.loginPageRoute || '';
|
|
64
|
+
const isLoginPage = navigate_js_default().isCurrentPage(loginPageRoute || '');
|
|
65
|
+
const _loginPageRoute = `${loginPageRoute || ''}`.replace(/^\//, '');
|
|
66
|
+
if (isLoginPage) return;
|
|
67
|
+
taro_default().navigateTo({
|
|
68
|
+
url: `/${_loginPageRoute}`
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const globalDataInstance = new GlobalDataInstance();
|
|
73
|
+
const useGlobalData = ()=>{
|
|
74
|
+
const store = (0, external_valtio_namespaceObject.useSnapshot)(globalDataInstance.store);
|
|
75
|
+
return [
|
|
76
|
+
store,
|
|
77
|
+
globalDataInstance,
|
|
78
|
+
store.__defaultValue
|
|
79
|
+
];
|
|
80
|
+
};
|
|
81
|
+
exports.GlobalDataInstance = __webpack_exports__.GlobalDataInstance;
|
|
82
|
+
exports.globalDataInstance = __webpack_exports__.globalDataInstance;
|
|
83
|
+
exports.useGlobalData = __webpack_exports__.useGlobalData;
|
|
84
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
85
|
+
"GlobalDataInstance",
|
|
86
|
+
"globalDataInstance",
|
|
87
|
+
"useGlobalData"
|
|
88
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
89
|
+
Object.defineProperty(exports, '__esModule', {
|
|
90
|
+
value: true
|
|
91
|
+
});
|
|
@@ -40,13 +40,6 @@ export declare class GlobalMessageDataInstance extends ProxyInstanceObjectBase<G
|
|
|
40
40
|
showToast: (config?: Partial<ToastDataType>) => void;
|
|
41
41
|
/**隐藏Toast */
|
|
42
42
|
hideToast: () => void;
|
|
43
|
-
/**
|
|
44
|
-
* 跳转登录页面前执行
|
|
45
|
-
*/
|
|
46
|
-
onBeforetToLoginPage?: () => boolean | void;
|
|
47
|
-
toRedirect: () => void;
|
|
48
|
-
/**跳转登录页面*/
|
|
49
|
-
toLoginPage: () => void;
|
|
50
43
|
}
|
|
51
44
|
/**
|
|
52
45
|
* 全局消息数据实例
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
(()=>{
|
|
13
4
|
__webpack_require__.d = (exports1, definition)=>{
|
|
14
5
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -38,13 +29,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
38
29
|
useGlobalMessageData: ()=>useGlobalMessageData
|
|
39
30
|
});
|
|
40
31
|
const external_valtio_namespaceObject = require("valtio");
|
|
41
|
-
const navigate_js_namespaceObject = require("../utils/navigate.js");
|
|
42
|
-
var navigate_js_default = /*#__PURE__*/ __webpack_require__.n(navigate_js_namespaceObject);
|
|
43
32
|
const useId_js_namespaceObject = require("../utils/useId.js");
|
|
44
33
|
const instance_js_namespaceObject = require("../utils/valtio/instance.js");
|
|
45
|
-
const external_global_setting_data_instance_js_namespaceObject = require("./global.setting.data.instance.js");
|
|
46
|
-
const taro_namespaceObject = require("@tarojs/taro");
|
|
47
|
-
var taro_default = /*#__PURE__*/ __webpack_require__.n(taro_namespaceObject);
|
|
48
34
|
class GlobalMessageDataInstance extends instance_js_namespaceObject.ProxyInstanceObjectBase {
|
|
49
35
|
store = (0, external_valtio_namespaceObject.proxy)({
|
|
50
36
|
messageData: (0, external_valtio_namespaceObject.ref)([]),
|
|
@@ -87,26 +73,6 @@ class GlobalMessageDataInstance extends instance_js_namespaceObject.ProxyInstanc
|
|
|
87
73
|
visible: false
|
|
88
74
|
});
|
|
89
75
|
};
|
|
90
|
-
onBeforetToLoginPage;
|
|
91
|
-
toRedirect = ()=>{
|
|
92
|
-
const currentPath = taro_default().getCurrentInstance().router?.params?.redirect || '';
|
|
93
|
-
if (currentPath) navigate_js_default().navigateTo({
|
|
94
|
-
url: currentPath
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
toLoginPage = ()=>{
|
|
98
|
-
if (this.onBeforetToLoginPage) {
|
|
99
|
-
const f = this.onBeforetToLoginPage();
|
|
100
|
-
if (false === f) return;
|
|
101
|
-
}
|
|
102
|
-
const loginPageRoute = external_global_setting_data_instance_js_namespaceObject.globalSettingDataInstance.store.loginPageRoute || '';
|
|
103
|
-
const isLoginPage = navigate_js_default().isCurrentPage(loginPageRoute || '');
|
|
104
|
-
const _loginPageRoute = `${loginPageRoute || ''}`.replace(/^\//, '');
|
|
105
|
-
if (isLoginPage) return;
|
|
106
|
-
taro_default().navigateTo({
|
|
107
|
-
url: `/${_loginPageRoute}`
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
76
|
}
|
|
111
77
|
const globalMessageDataInstance = new GlobalMessageDataInstance();
|
|
112
78
|
const useGlobalMessageData = ()=>{
|
package/lib/context/index.d.ts
CHANGED
package/lib/context/index.js
CHANGED
|
@@ -3,6 +3,9 @@ var __webpack_modules__ = {
|
|
|
3
3
|
"./auth.data.instance": function(module) {
|
|
4
4
|
module.exports = require("./auth.data.instance.js");
|
|
5
5
|
},
|
|
6
|
+
"./global.data.instance": function(module) {
|
|
7
|
+
module.exports = require("./global.data.instance.js");
|
|
8
|
+
},
|
|
6
9
|
"./global.message.data.instance": function(module) {
|
|
7
10
|
module.exports = require("./global.message.data.instance.js");
|
|
8
11
|
},
|
|
@@ -89,6 +92,12 @@ var __webpack_exports__ = {};
|
|
|
89
92
|
return _global_setting_data_instance__WEBPACK_IMPORTED_MODULE_4__[key];
|
|
90
93
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
91
94
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
95
|
+
var _global_data_instance__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./global.data.instance");
|
|
96
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
97
|
+
for(var __WEBPACK_IMPORT_KEY__ in _global_data_instance__WEBPACK_IMPORTED_MODULE_5__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
98
|
+
return _global_data_instance__WEBPACK_IMPORTED_MODULE_5__[key];
|
|
99
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
100
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
92
101
|
})();
|
|
93
102
|
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
94
103
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -160,6 +160,8 @@ export interface PageDataInstanceContextProviderProps<T extends PageDataInstance
|
|
|
160
160
|
valueFields?: M['valueFields'];
|
|
161
161
|
/**是否是第一次加载*/
|
|
162
162
|
isMountLoad?: boolean;
|
|
163
|
+
/**是否使用 useDidShow*/
|
|
164
|
+
isDidShowLoad?: boolean;
|
|
163
165
|
/**页面标题*/
|
|
164
166
|
title?: string;
|
|
165
167
|
/**成功状态码
|
|
@@ -350,7 +350,7 @@ const usePageDataInstanceContext = ()=>{
|
|
|
350
350
|
return PageDataInstance;
|
|
351
351
|
};
|
|
352
352
|
function PageDataInstanceContextProvider(props) {
|
|
353
|
-
const { instance, children, initialValues, is_scroll_page, defaultTabKey, tabItems, defaultPageSize, onBefore, getList, onAfter, onExtraData, onError, getResetValues, defaultQuery, codeFields, valueFields, isMountLoad, title, responseSuccessCode, responseListField, responseTotalField } = props;
|
|
353
|
+
const { instance, children, initialValues, is_scroll_page, defaultTabKey, tabItems, defaultPageSize, onBefore, getList, onAfter, onExtraData, onError, getResetValues, defaultQuery, codeFields, valueFields, isMountLoad, title, responseSuccessCode, responseListField, responseTotalField, isDidShowLoad } = props;
|
|
354
354
|
const pageInstance = usePageDataInstance(instance);
|
|
355
355
|
instance.onBefore = onBefore;
|
|
356
356
|
instance.getList = getList;
|
|
@@ -376,6 +376,9 @@ function PageDataInstanceContextProvider(props) {
|
|
|
376
376
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
377
377
|
if (isMountLoad) pageInstance.main_onSearch();
|
|
378
378
|
}, []);
|
|
379
|
+
(0, taro_namespaceObject.useDidShow)(()=>{
|
|
380
|
+
if (isDidShowLoad) pageInstance.main_onSearch();
|
|
381
|
+
});
|
|
379
382
|
(0, taro_namespaceObject.useDidShow)(()=>{
|
|
380
383
|
if (title) taro_default().setNavigationBarTitle({
|
|
381
384
|
title
|
|
@@ -83,6 +83,8 @@ export interface PageInfoDataInstanceContextProviderProps<T extends PageInfoData
|
|
|
83
83
|
title?: string;
|
|
84
84
|
/**页面一加载是否请求详情接口*/
|
|
85
85
|
isMountRequestInfo?: boolean;
|
|
86
|
+
/**是否使用 useDidShow*/
|
|
87
|
+
isDidShowRequestInfo?: boolean;
|
|
86
88
|
/**自定义hooks,挂载参数和设置完初始值后执行*/
|
|
87
89
|
useHooks?: (instance: M) => void;
|
|
88
90
|
}
|
|
@@ -177,7 +177,7 @@ const usePageInfoDataInstanceContext = ()=>{
|
|
|
177
177
|
return PageInfoDataInstance;
|
|
178
178
|
};
|
|
179
179
|
function PageInfoDataInstanceContextProvider(props) {
|
|
180
|
-
const { instance, children, initialValues, requestInfoConfig, requestSaveInfoConfig, isProxy, title, isMountRequestInfo, useHooks } = props;
|
|
180
|
+
const { instance, children, initialValues, requestInfoConfig, requestSaveInfoConfig, isProxy, title, isMountRequestInfo, useHooks, isDidShowRequestInfo } = props;
|
|
181
181
|
const pageInfoInstance = usePageInfoDataInstance(instance);
|
|
182
182
|
pageInfoInstance.requestInfoConfig = requestInfoConfig;
|
|
183
183
|
pageInfoInstance.requestSaveInfoConfig = requestSaveInfoConfig;
|
|
@@ -196,6 +196,9 @@ function PageInfoDataInstanceContextProvider(props) {
|
|
|
196
196
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
197
197
|
if (isMountRequestInfo) pageInfoInstance.main_getInfo();
|
|
198
198
|
}, []);
|
|
199
|
+
(0, taro_namespaceObject.useDidShow)(()=>{
|
|
200
|
+
if (isDidShowRequestInfo) pageInfoInstance.main_getInfo();
|
|
201
|
+
});
|
|
199
202
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PageInfoDataInstanceContext.Provider, {
|
|
200
203
|
value: pageInfoInstance,
|
|
201
204
|
children: children
|
package/lib/styles/index.css
CHANGED
|
@@ -181,6 +181,11 @@
|
|
|
181
181
|
font-size: 12.8px;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
.fairystaro__text-black {
|
|
185
|
+
--un-text-opacity: 1;
|
|
186
|
+
color: rgb(0 0 0 / var(--un-text-opacity));
|
|
187
|
+
}
|
|
188
|
+
|
|
184
189
|
.fairystaro__text-color-_zkh1_blue_zhk2_ {
|
|
185
190
|
color: #00f;
|
|
186
191
|
}
|
|
@@ -197,10 +202,23 @@
|
|
|
197
202
|
color: red;
|
|
198
203
|
}
|
|
199
204
|
|
|
205
|
+
.fairystaro__text-gray-400 {
|
|
206
|
+
--un-text-opacity: 1;
|
|
207
|
+
color: rgb(156 163 175 / var(--un-text-opacity));
|
|
208
|
+
}
|
|
209
|
+
|
|
200
210
|
.fairystaro__font-bold {
|
|
201
211
|
font-weight: 700;
|
|
202
212
|
}
|
|
203
213
|
|
|
214
|
+
.fairystaro__opacity-100 {
|
|
215
|
+
opacity: 1;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.fairystaro__opacity-60 {
|
|
219
|
+
opacity: .6;
|
|
220
|
+
}
|
|
221
|
+
|
|
204
222
|
@keyframes fairys_taro_loading_transform {
|
|
205
223
|
0% {
|
|
206
224
|
--fairys-enter-loading-transform-color: #00a98e;
|
package/lib/utils/request.js
CHANGED
|
@@ -41,6 +41,7 @@ const taro_namespaceObject = require("@tarojs/taro");
|
|
|
41
41
|
var taro_default = /*#__PURE__*/ __webpack_require__.n(taro_namespaceObject);
|
|
42
42
|
const global_setting_data_instance_js_namespaceObject = require("../context/global.setting.data.instance.js");
|
|
43
43
|
const global_message_data_instance_js_namespaceObject = require("../context/global.message.data.instance.js");
|
|
44
|
+
const global_data_instance_js_namespaceObject = require("../context/global.data.instance.js");
|
|
44
45
|
const codeMessage = {
|
|
45
46
|
400: "\u53D1\u51FA\u7684\u8BF7\u6C42\u9519\u8BEF",
|
|
46
47
|
401: "\u7528\u6237\u6CA1\u6709\u6743\u9650",
|
|
@@ -62,7 +63,7 @@ const requestResponseHandle = (result, options)=>{
|
|
|
62
63
|
const code = result?.data?.code;
|
|
63
64
|
if (401 === statusCode || 401 === code || code === global_setting_data_instance_js_namespaceObject.globalSettingDataInstance.store.tokenExpiredCode) {
|
|
64
65
|
msg = "\u8BF7\u91CD\u65B0\u767B\u5F55";
|
|
65
|
-
|
|
66
|
+
global_data_instance_js_namespaceObject.globalDataInstance.toLoginPage();
|
|
66
67
|
} else msg = [
|
|
67
68
|
global_setting_data_instance_js_namespaceObject.globalSettingDataInstance.store.requestSuccessCode,
|
|
68
69
|
requestSuccessCode,
|
|
@@ -174,7 +175,7 @@ class RequestInstance {
|
|
|
174
175
|
options?.fail?.({
|
|
175
176
|
errMsg: "\u672A\u767B\u5F55"
|
|
176
177
|
});
|
|
177
|
-
|
|
178
|
+
global_data_instance_js_namespaceObject.globalDataInstance.toLoginPage();
|
|
178
179
|
return;
|
|
179
180
|
}
|
|
180
181
|
return {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "SunLxy <1011771396@qq.com>",
|
|
4
4
|
"description": "框架组件库",
|
|
5
5
|
"homepage": "https://github.com/autumn-fairy-tales/fairys-taro-react",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.34",
|
|
7
7
|
"main": "esm/index.js",
|
|
8
8
|
"types": "esm/index.d.ts",
|
|
9
9
|
"module": "esm/index.js",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.fairys_taro_custom_tab_bar {
|
|
2
|
+
position: fixed;
|
|
3
|
+
bottom: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
height: 60px;
|
|
7
|
+
background: white;
|
|
8
|
+
display: flex;
|
|
9
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.fairys_taro_custom_tab_bar-border {
|
|
13
|
+
background-color: rgba(0, 0, 0, 0.33);
|
|
14
|
+
position: absolute;
|
|
15
|
+
left: 0;
|
|
16
|
+
top: 0;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 1px;
|
|
19
|
+
transform: scaleY(0.5);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.fairys_taro_custom_tab_bar_item {
|
|
23
|
+
flex: 1;
|
|
24
|
+
text-align: center;
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
align-items: center;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.fairys_taro_custom_tab_bar_item cover-image {
|
|
32
|
+
width: 54px;
|
|
33
|
+
height: 54px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.fairys_taro_custom_tab_bar_item cover-view {
|
|
37
|
+
font-size: 14px;
|
|
38
|
+
}
|