@nutui/nutui-react-taro 1.5.11-beta.0 → 1.5.11-beta.2
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/dist/esm/MenuItem.js +3 -3
- package/dist/esm/{menuitem.taro-fed68a19.js → menuitem.taro-fee49a85.js} +29 -17
- package/dist/esm/nutui-react.es.js +1 -1
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.mjs +180 -150
- package/dist/nutui.react.umd.js +180 -150
- package/dist/packages/menuitem/menuitem.scss +3 -3
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables.scss +1 -0
- package/package.json +1 -1
package/dist/esm/MenuItem.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { M as MenuItem } from './menuitem.taro-
|
|
1
|
+
import { M as MenuItem } from './menuitem.taro-fee49a85.js';
|
|
2
2
|
import 'react';
|
|
3
|
+
import '@tarojs/taro';
|
|
4
|
+
import '@tarojs/components';
|
|
3
5
|
import 'classnames';
|
|
4
6
|
import 'react-transition-group';
|
|
5
|
-
import '@tarojs/taro';
|
|
6
7
|
import './icon.taro-296a1bec.js';
|
|
7
8
|
import './bem-350c1702.js';
|
|
8
9
|
import '@bem-react/classname';
|
|
9
10
|
import './overlay.taro-21e87fb1.js';
|
|
10
|
-
import '@tarojs/components';
|
|
11
11
|
import './typings-b9828dba.js';
|
|
12
12
|
|
|
13
13
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React__default, { forwardRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
1
|
+
import React__default, { forwardRef, useState, useEffect, useMemo, useCallback, useImperativeHandle } from 'react';
|
|
2
|
+
import { getSystemInfoSync, usePageScroll } from '@tarojs/taro';
|
|
3
|
+
import { View } from '@tarojs/components';
|
|
2
4
|
import classNames from 'classnames';
|
|
3
5
|
import { CSSTransition } from 'react-transition-group';
|
|
4
|
-
import { getSystemInfoSync } from '@tarojs/taro';
|
|
5
6
|
import { I as Icon } from './icon.taro-296a1bec.js';
|
|
6
7
|
import { O as Overlay } from './overlay.taro-21e87fb1.js';
|
|
7
8
|
import { C as ComponentDefaults } from './typings-b9828dba.js';
|
|
@@ -34,6 +35,19 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
34
35
|
useEffect(() => {
|
|
35
36
|
getParentOffset();
|
|
36
37
|
}, [_showPopup]);
|
|
38
|
+
const windowHeight = useMemo(() => getSystemInfoSync().windowHeight, []);
|
|
39
|
+
const updateItemOffset = useCallback(() => {
|
|
40
|
+
const p = parent.parent().current;
|
|
41
|
+
p.getBoundingClientRect().then((rect) => {
|
|
42
|
+
if (rect) {
|
|
43
|
+
setPosition({
|
|
44
|
+
height: rect.height,
|
|
45
|
+
top: rect.top,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}, [direction, windowHeight]);
|
|
50
|
+
usePageScroll(updateItemOffset);
|
|
37
51
|
useImperativeHandle(ref, () => ({
|
|
38
52
|
toggle: parent.toggleItemShow,
|
|
39
53
|
}));
|
|
@@ -75,47 +89,45 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
75
89
|
};
|
|
76
90
|
const getPosition = () => {
|
|
77
91
|
return direction === 'down'
|
|
78
|
-
? {
|
|
92
|
+
? { top: `${position.top + position.height}px` }
|
|
79
93
|
: {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
height: `${window.innerHeight}px`,
|
|
94
|
+
bottom: `${getSystemInfoSync().windowHeight - position.top}px`,
|
|
95
|
+
top: '0',
|
|
96
|
+
height: 'initial',
|
|
84
97
|
};
|
|
85
98
|
};
|
|
86
99
|
const placeholderStyle = () => {
|
|
87
100
|
if (direction === 'down') {
|
|
88
101
|
return {
|
|
89
102
|
height: `${position.top + position.height}px`,
|
|
90
|
-
top: 'auto',
|
|
91
|
-
bottom: '-100%',
|
|
92
103
|
...isShow(),
|
|
104
|
+
...style,
|
|
93
105
|
};
|
|
94
106
|
}
|
|
95
107
|
return {
|
|
96
108
|
height: `${getSystemInfoSync().windowHeight - position.top}px`,
|
|
97
|
-
|
|
98
|
-
top: '0',
|
|
109
|
+
top: 'auto',
|
|
99
110
|
...isShow(),
|
|
111
|
+
...style,
|
|
100
112
|
};
|
|
101
113
|
};
|
|
102
|
-
return (React__default.createElement(
|
|
103
|
-
React__default.createElement(
|
|
114
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
115
|
+
React__default.createElement(View, { className: `placeholder-element ${classNames({
|
|
104
116
|
up: direction === 'up',
|
|
105
117
|
})}`, style: placeholderStyle(), onClick: () => parent.toggleItemShow(orderKey) }),
|
|
106
118
|
React__default.createElement(Overlay, { overlayClass: "nut-menu__overlay", style: getPosition(), lockScroll: parent.lockScroll, visible: _showPopup, closeOnClickOverlay: parent.closeOnClickOverlay, onClick: () => {
|
|
107
119
|
parent.closeOnClickOverlay && parent.toggleItemShow(orderKey);
|
|
108
120
|
} }),
|
|
109
|
-
React__default.createElement(
|
|
121
|
+
React__default.createElement(View, { className: direction === 'down'
|
|
110
122
|
? 'nut-menu-item__wrap'
|
|
111
123
|
: 'nut-menu-item__wrap-up', style: {
|
|
112
124
|
// ...getPosition(),
|
|
113
125
|
...isShow(),
|
|
114
126
|
} },
|
|
115
127
|
React__default.createElement(CSSTransition, { in: _showPopup, timeout: 100, classNames: direction === 'down' ? 'menu-item' : 'menu-item-up' },
|
|
116
|
-
React__default.createElement(
|
|
128
|
+
React__default.createElement(View, { className: "nut-menu-item__content" },
|
|
117
129
|
options?.map((item, index) => {
|
|
118
|
-
return (React__default.createElement(
|
|
130
|
+
return (React__default.createElement(View, { className: `nut-menu-item__option ${classNames({
|
|
119
131
|
active: item.value === _value,
|
|
120
132
|
})}`, key: item.text, style: {
|
|
121
133
|
flexBasis: `${100 / columns}%`,
|
|
@@ -123,7 +135,7 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
123
135
|
handleClick(item);
|
|
124
136
|
} },
|
|
125
137
|
item.value === _value ? (React__default.createElement(Icon, { classPrefix: iconClassPrefix, fontClassName: iconFontClassName, className: getIconCName(item.value, value), name: optionsIcon, color: activeColor })) : null,
|
|
126
|
-
React__default.createElement(
|
|
138
|
+
React__default.createElement(View, { className: getIconCName(item.value, value), style: {
|
|
127
139
|
color: `${item.value === _value ? activeColor : ''}`,
|
|
128
140
|
} }, item.text)));
|
|
129
141
|
}),
|
|
@@ -17,7 +17,7 @@ export { E as Elevator } from './elevator.taro-a883f7ad.js';
|
|
|
17
17
|
export { F as FixedNav } from './fixednav.taro-1f05acaf.js';
|
|
18
18
|
export { I as Indicator } from './indicator.taro-cba8b010.js';
|
|
19
19
|
export { M as Menu } from './menu.taro-7e4038a1.js';
|
|
20
|
-
export { M as MenuItem } from './menuitem.taro-
|
|
20
|
+
export { M as MenuItem } from './menuitem.taro-fee49a85.js';
|
|
21
21
|
export { N as NavBar } from './navbar.taro-777c4705.js';
|
|
22
22
|
export { P as Pagination } from './pagination.taro-715a173b.js';
|
|
23
23
|
export { S as SideNavBar } from './sidenavbar.taro-c307b35e.js';
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED
package/dist/locales/zh-CN.js
CHANGED
package/dist/locales/zh-TW.js
CHANGED
package/dist/locales/zh-UG.js
CHANGED