@nutui/nutui-react-taro 3.0.6 → 3.0.8
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/CHANGELOG.md +51 -15
- package/dist/cjs/packages/actionsheet/style/style.css +4 -4
- package/dist/cjs/packages/address/style/style.css +4 -4
- package/dist/cjs/packages/audio/style/style.css +4 -16
- package/dist/cjs/packages/avatar/style/style.css +4 -0
- package/dist/cjs/packages/button/style/button.scss +4 -20
- package/dist/cjs/packages/button/style/style.css +4 -16
- package/dist/cjs/packages/button/style/style.harmony.css +2 -14
- package/dist/cjs/packages/calendar/style/style.css +4 -4
- package/dist/cjs/packages/cascader/cascader.js +2 -1
- package/dist/cjs/packages/cascader/style/style.css +4 -4
- package/dist/cjs/packages/collapse/style/style.css +22 -7
- package/dist/cjs/packages/collapseitem/collapseitem.js +63 -77
- package/dist/cjs/packages/collapseitem/style/collapseitem.scss +22 -5
- package/dist/cjs/packages/collapseitem/style/style.css +22 -7
- package/dist/cjs/packages/collapseitem/style/style.harmony.css +22 -7
- package/dist/cjs/packages/configprovider/types.d.ts +1 -1
- package/dist/cjs/packages/datepicker/style/style.css +4 -4
- package/dist/cjs/packages/dialog/content.d.ts +11 -3
- package/dist/cjs/packages/dialog/content.js +4 -4
- package/dist/cjs/packages/dialog/dialog.d.ts +39 -4
- package/dist/cjs/packages/dialog/dialog.js +14 -13
- package/dist/cjs/packages/dialog/index.d.ts +1 -1
- package/dist/cjs/packages/dialog/style/dialog.scss +1 -0
- package/dist/cjs/packages/dialog/style/style.css +5 -16
- package/dist/cjs/packages/dialog/style/style.harmony.css +1 -0
- package/dist/cjs/packages/empty/style/style.css +4 -16
- package/dist/cjs/packages/image/image.js +10 -9
- package/dist/cjs/packages/image/style/image.scss +4 -1
- package/dist/cjs/packages/image/style/style.css +4 -0
- package/dist/cjs/packages/image/style/style.harmony.css +4 -0
- package/dist/cjs/packages/imagepreview/style/style.css +8 -4
- package/dist/cjs/packages/numberkeyboard/style/style.css +4 -4
- package/dist/cjs/packages/picker/style/style.css +4 -4
- package/dist/cjs/packages/popover/popover.d.ts +0 -7
- package/dist/cjs/packages/popover/popover.js +114 -141
- package/dist/cjs/packages/popover/style/popover.scss +48 -51
- package/dist/cjs/packages/popover/style/style.css +64 -70
- package/dist/cjs/packages/popover/style/style.harmony.css +64 -60
- package/dist/cjs/packages/popup/style/popup.scss +4 -4
- package/dist/cjs/packages/popup/style/style.css +4 -4
- package/dist/cjs/packages/popup/style/style.harmony.css +4 -4
- package/dist/cjs/packages/resultpage/style/style.css +4 -16
- package/dist/cjs/packages/shortpassword/style/style.css +4 -4
- package/dist/cjs/packages/sidebar/sidebar.js +11 -3
- package/dist/cjs/packages/skeleton/skeleton.js +1 -2
- package/dist/cjs/packages/swipe/swipe.js +1 -1
- package/dist/cjs/packages/switch/switch.js +53 -8
- package/dist/cjs/packages/tabpane/tabpane.js +2 -2
- package/dist/cjs/packages/timeselect/style/style.css +4 -4
- package/dist/cjs/packages/tour/style/style.css +64 -70
- package/dist/cjs/packages/tour/tour.js +3 -4
- package/dist/cjs/types/spec/dialog/base.d.ts +50 -1
- package/dist/cjs/types/spec/dialog/base.js +7 -0
- package/dist/cjs/types/spec/dialog/h5.d.ts +4 -1
- package/dist/cjs/types/spec/dialog/taro.d.ts +8 -2
- package/dist/cjs/types/spec/popover/base.d.ts +7 -0
- package/dist/cjs/utils/get-rect-by-taro.js +10 -0
- package/dist/cjs/utils/lru.d.ts +8 -0
- package/dist/cjs/utils/lru.js +58 -0
- package/dist/es/packages/actionsheet/style/style.css +4 -4
- package/dist/es/packages/address/style/style.css +4 -4
- package/dist/es/packages/audio/style/style.css +4 -16
- package/dist/es/packages/avatar/style/style.css +4 -0
- package/dist/es/packages/button/style/button.scss +4 -20
- package/dist/es/packages/button/style/style.css +4 -16
- package/dist/es/packages/button/style/style.harmony.css +2 -14
- package/dist/es/packages/calendar/style/style.css +4 -4
- package/dist/es/packages/cascader/cascader.js +2 -1
- package/dist/es/packages/cascader/style/style.css +4 -4
- package/dist/es/packages/collapse/style/style.css +22 -7
- package/dist/es/packages/collapseitem/collapseitem.js +65 -79
- package/dist/es/packages/collapseitem/style/collapseitem.scss +22 -5
- package/dist/es/packages/collapseitem/style/style.css +22 -7
- package/dist/es/packages/collapseitem/style/style.harmony.css +22 -7
- package/dist/es/packages/configprovider/types.d.ts +1 -1
- package/dist/es/packages/datepicker/style/style.css +4 -4
- package/dist/es/packages/dialog/content.d.ts +11 -3
- package/dist/es/packages/dialog/content.js +4 -4
- package/dist/es/packages/dialog/dialog.d.ts +39 -4
- package/dist/es/packages/dialog/dialog.js +14 -13
- package/dist/es/packages/dialog/index.d.ts +1 -1
- package/dist/es/packages/dialog/style/dialog.scss +1 -0
- package/dist/es/packages/dialog/style/style.css +5 -16
- package/dist/es/packages/dialog/style/style.harmony.css +1 -0
- package/dist/es/packages/empty/style/style.css +4 -16
- package/dist/es/packages/image/image.js +10 -10
- package/dist/es/packages/image/style/image.scss +4 -1
- package/dist/es/packages/image/style/style.css +4 -0
- package/dist/es/packages/image/style/style.harmony.css +4 -0
- package/dist/es/packages/imagepreview/style/style.css +8 -4
- package/dist/es/packages/numberkeyboard/style/style.css +4 -4
- package/dist/es/packages/picker/style/style.css +4 -4
- package/dist/es/packages/popover/popover.d.ts +0 -7
- package/dist/es/packages/popover/popover.js +115 -142
- package/dist/es/packages/popover/style/popover.scss +48 -51
- package/dist/es/packages/popover/style/style.css +64 -70
- package/dist/es/packages/popover/style/style.harmony.css +64 -60
- package/dist/es/packages/popup/style/popup.scss +4 -4
- package/dist/es/packages/popup/style/style.css +4 -4
- package/dist/es/packages/popup/style/style.harmony.css +4 -4
- package/dist/es/packages/resultpage/style/style.css +4 -16
- package/dist/es/packages/shortpassword/style/style.css +4 -4
- package/dist/es/packages/sidebar/sidebar.js +11 -3
- package/dist/es/packages/skeleton/skeleton.js +1 -2
- package/dist/es/packages/swipe/swipe.js +2 -2
- package/dist/es/packages/switch/switch.js +53 -8
- package/dist/es/packages/tabpane/tabpane.js +2 -2
- package/dist/es/packages/timeselect/style/style.css +4 -4
- package/dist/es/packages/tour/style/style.css +64 -70
- package/dist/es/packages/tour/tour.js +3 -4
- package/dist/es/types/spec/dialog/base.d.ts +83 -1
- package/dist/es/types/spec/dialog/base.js +1 -1
- package/dist/es/types/spec/dialog/h5.d.ts +4 -1
- package/dist/es/types/spec/dialog/taro.d.ts +8 -2
- package/dist/es/types/spec/popover/base.d.ts +7 -0
- package/dist/es/utils/get-rect-by-taro.js +9 -0
- package/dist/es/utils/lru.d.ts +8 -0
- package/dist/es/utils/lru.js +49 -0
- package/dist/nutui.react.umd.js +339 -286
- package/dist/style.css +1 -1
- package/dist/style.scss +52 -52
- package/dist/styles/theme-jmapp.scss +1 -0
- package/dist/styles/themes/dark.css +1 -1
- package/dist/styles/themes/default.css +1 -1
- package/dist/styles/themes/jmapp.css +1 -1
- package/dist/styles/themes/jrkf.css +1 -1
- package/dist/styles/variables-jmapp.scss +215 -49
- package/dist/styles/variables-jrkf.scss +2 -13
- package/dist/styles/variables.scss +7 -14
- package/package.json +1 -1
- package/dist/cjs/packages/dialog/types.d.ts +0 -57
- package/dist/cjs/packages/dialog/types.js +0 -4
- package/dist/cjs/packages/dialog/types.taro.d.ts +0 -10
- package/dist/es/packages/dialog/types.d.ts +0 -57
- package/dist/es/packages/dialog/types.js +0 -1
- package/dist/es/packages/dialog/types.taro.d.ts +0 -10
|
@@ -7,14 +7,15 @@ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
|
7
7
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
8
8
|
import React, { useEffect, useRef, useState } from "react";
|
|
9
9
|
import classNames from "classnames";
|
|
10
|
-
import
|
|
11
|
-
import { View } from "@tarojs/components";
|
|
10
|
+
import { nextTick } from "@tarojs/taro";
|
|
11
|
+
import { Text, View } from "@tarojs/components";
|
|
12
12
|
import { ArrowRadius } from "@nutui/icons-react-taro";
|
|
13
13
|
import Popup from "../popup/index";
|
|
14
14
|
import { getRectByTaro } from "../../utils/get-rect-by-taro";
|
|
15
15
|
import { ComponentDefaults } from "../../utils/typings";
|
|
16
|
-
import { getRect } from "../../hooks/use-client-rect";
|
|
17
16
|
import { useRtl } from "../configprovider/index";
|
|
17
|
+
import pxTransform from "../../utils/px-transform";
|
|
18
|
+
import useUuid from "../../hooks/use-uuid";
|
|
18
19
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
19
20
|
list: [],
|
|
20
21
|
theme: 'light',
|
|
@@ -26,7 +27,6 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
|
26
27
|
],
|
|
27
28
|
arrowOffset: 0,
|
|
28
29
|
targetId: '',
|
|
29
|
-
className: '',
|
|
30
30
|
showArrow: true,
|
|
31
31
|
closeOnOutsideClick: true,
|
|
32
32
|
closeOnActionClick: true,
|
|
@@ -61,129 +61,100 @@ export var Popover = function(props) {
|
|
|
61
61
|
var popoverRef = useRef(null);
|
|
62
62
|
var popoverContentRef = useRef(null);
|
|
63
63
|
var _useState = _sliced_to_array(useState(false), 2), showPopup = _useState[0], setShowPopup = _useState[1];
|
|
64
|
-
var _useState1 = _sliced_to_array(useState(0), 2),
|
|
65
|
-
var _useState2 = _sliced_to_array(useState(0), 2),
|
|
66
|
-
var _useState3 = _sliced_to_array(useState(), 2),
|
|
64
|
+
var _useState1 = _sliced_to_array(useState(0), 2), popWidth = _useState1[0], setPopWidth = _useState1[1];
|
|
65
|
+
var _useState2 = _sliced_to_array(useState(0), 2), popHeight = _useState2[0], setPopHeight = _useState2[1];
|
|
66
|
+
var _useState3 = _sliced_to_array(useState(), 2), wrapperPosition = _useState3[0], setWrapperPosition = _useState3[1];
|
|
67
67
|
useEffect(function() {
|
|
68
68
|
setShowPopup(visible);
|
|
69
69
|
if (visible) {
|
|
70
|
-
|
|
71
|
-
getContentWidth();
|
|
72
|
-
}, 0);
|
|
70
|
+
getWrapperPosition();
|
|
73
71
|
}
|
|
74
72
|
}, [
|
|
75
73
|
visible
|
|
76
74
|
]);
|
|
77
|
-
var
|
|
75
|
+
var uid = useUuid();
|
|
76
|
+
var popoverId = "popover-".concat(uid);
|
|
77
|
+
var getWrapperPosition = /*#__PURE__*/ function() {
|
|
78
78
|
var _ref = _async_to_generator(function() {
|
|
79
|
-
var rect;
|
|
80
79
|
return _ts_generator(this, function(_state) {
|
|
81
|
-
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
setRootPosition({
|
|
124
|
-
width: rect.width,
|
|
125
|
-
height: rect.height,
|
|
126
|
-
left: rtl ? rect.right : rect.left,
|
|
127
|
-
top: rect.top + distance,
|
|
128
|
-
right: rtl ? rect.left : rect.right
|
|
129
|
-
});
|
|
130
|
-
return [
|
|
131
|
-
2
|
|
132
|
-
];
|
|
133
|
-
}
|
|
134
|
-
});
|
|
80
|
+
nextTick(/*#__PURE__*/ _async_to_generator(function() {
|
|
81
|
+
var rect, _tmp, width, height, right, left, top;
|
|
82
|
+
return _ts_generator(this, function(_state) {
|
|
83
|
+
switch(_state.label){
|
|
84
|
+
case 0:
|
|
85
|
+
if (!targetId) return [
|
|
86
|
+
3,
|
|
87
|
+
2
|
|
88
|
+
];
|
|
89
|
+
return [
|
|
90
|
+
4,
|
|
91
|
+
getRectByTaro(document.querySelector("#".concat(targetId)), targetId)
|
|
92
|
+
];
|
|
93
|
+
case 1:
|
|
94
|
+
_tmp = _state.sent();
|
|
95
|
+
return [
|
|
96
|
+
3,
|
|
97
|
+
4
|
|
98
|
+
];
|
|
99
|
+
case 2:
|
|
100
|
+
return [
|
|
101
|
+
4,
|
|
102
|
+
getRectByTaro(popoverRef.current, popoverId)
|
|
103
|
+
];
|
|
104
|
+
case 3:
|
|
105
|
+
_tmp = _state.sent();
|
|
106
|
+
_state.label = 4;
|
|
107
|
+
case 4:
|
|
108
|
+
rect = _tmp;
|
|
109
|
+
width = rect.width, height = rect.height, right = rect.right, left = rect.left, top = rect.top;
|
|
110
|
+
setWrapperPosition({
|
|
111
|
+
width: width,
|
|
112
|
+
height: height,
|
|
113
|
+
left: rtl ? right : left,
|
|
114
|
+
top: top,
|
|
115
|
+
right: rtl ? left : right
|
|
116
|
+
});
|
|
117
|
+
getPopoverContentW();
|
|
118
|
+
return [
|
|
119
|
+
2
|
|
120
|
+
];
|
|
121
|
+
}
|
|
135
122
|
});
|
|
136
|
-
|
|
137
|
-
return _ref.apply(this, arguments);
|
|
138
|
-
};
|
|
139
|
-
}()).exec();
|
|
140
|
-
setTimeout(function() {
|
|
141
|
-
getPopoverContentW();
|
|
142
|
-
}, 300);
|
|
123
|
+
}));
|
|
143
124
|
return [
|
|
144
125
|
2
|
|
145
126
|
];
|
|
146
127
|
});
|
|
147
128
|
});
|
|
148
|
-
return function
|
|
149
|
-
return _ref.apply(this, arguments);
|
|
150
|
-
};
|
|
151
|
-
}();
|
|
152
|
-
var getRectTaro = /*#__PURE__*/ function() {
|
|
153
|
-
var _ref = _async_to_generator(function(targetId) {
|
|
154
|
-
return _ts_generator(this, function(_state) {
|
|
155
|
-
return [
|
|
156
|
-
2,
|
|
157
|
-
new Promise(function(resolve) {
|
|
158
|
-
createSelectorQuery().select("#".concat(targetId)).boundingClientRect().exec(function(res) {
|
|
159
|
-
resolve(res[0]);
|
|
160
|
-
});
|
|
161
|
-
})
|
|
162
|
-
];
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
return function getRectTaro(targetId) {
|
|
129
|
+
return function getWrapperPosition() {
|
|
166
130
|
return _ref.apply(this, arguments);
|
|
167
131
|
};
|
|
168
132
|
}();
|
|
169
133
|
var getPopoverContentW = /*#__PURE__*/ function() {
|
|
170
134
|
var _ref = _async_to_generator(function() {
|
|
171
|
-
var rectContent;
|
|
172
135
|
return _ts_generator(this, function(_state) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
136
|
+
nextTick(/*#__PURE__*/ _async_to_generator(function() {
|
|
137
|
+
var rectContent;
|
|
138
|
+
return _ts_generator(this, function(_state) {
|
|
139
|
+
switch(_state.label){
|
|
140
|
+
case 0:
|
|
141
|
+
return [
|
|
142
|
+
4,
|
|
143
|
+
getRectByTaro(popoverContentRef.current)
|
|
144
|
+
];
|
|
145
|
+
case 1:
|
|
146
|
+
rectContent = _state.sent();
|
|
147
|
+
setPopWidth(rectContent.width);
|
|
148
|
+
setPopHeight(rectContent.height);
|
|
149
|
+
return [
|
|
150
|
+
2
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}));
|
|
155
|
+
return [
|
|
156
|
+
2
|
|
157
|
+
];
|
|
187
158
|
});
|
|
188
159
|
});
|
|
189
160
|
return function getPopoverContentW() {
|
|
@@ -192,23 +163,23 @@ export var Popover = function(props) {
|
|
|
192
163
|
}();
|
|
193
164
|
var clickAway = function() {
|
|
194
165
|
if (closeOnOutsideClick) {
|
|
195
|
-
onClick
|
|
196
|
-
onClose
|
|
166
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
167
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
197
168
|
}
|
|
198
169
|
};
|
|
199
|
-
var
|
|
200
|
-
var classes = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix), true), _define_property(_obj, "".concat(classPrefix, "-").concat(theme), theme === 'dark'), _obj), className);
|
|
170
|
+
var classes = classNames(classPrefix, _define_property({}, "".concat(classPrefix, "-").concat(theme), theme === 'dark'), className);
|
|
201
171
|
var popoverArrow = function() {
|
|
202
172
|
var prefixCls = 'nut-popover-arrow';
|
|
203
|
-
|
|
173
|
+
var direction = location.split('-')[0];
|
|
174
|
+
return "".concat(prefixCls, " ").concat(prefixCls, "-").concat(direction, " ").concat(prefixCls, "-").concat(location);
|
|
204
175
|
};
|
|
205
|
-
var
|
|
176
|
+
var getPopoverPosition = function() {
|
|
206
177
|
var styles = {};
|
|
207
|
-
if (!
|
|
178
|
+
if (!wrapperPosition) {
|
|
208
179
|
styles.visibility = 'hidden';
|
|
209
180
|
return styles;
|
|
210
181
|
}
|
|
211
|
-
var width =
|
|
182
|
+
var width = wrapperPosition.width, height = wrapperPosition.height, left = wrapperPosition.left, top = wrapperPosition.top, right = wrapperPosition.right;
|
|
212
183
|
var direction = location.split('-')[0];
|
|
213
184
|
var skew = location.split('-')[1];
|
|
214
185
|
var cross = 0;
|
|
@@ -224,36 +195,36 @@ export var Popover = function(props) {
|
|
|
224
195
|
'bottom',
|
|
225
196
|
'top'
|
|
226
197
|
].includes(direction)) {
|
|
227
|
-
var h = direction === 'bottom' ? height + cross : -(
|
|
228
|
-
styles.top =
|
|
198
|
+
var h = direction === 'bottom' ? height + cross : -(popHeight + cross);
|
|
199
|
+
styles.top = pxTransform(top + h);
|
|
229
200
|
if (!skew) {
|
|
230
|
-
styles[dir] =
|
|
201
|
+
styles[dir] = pxTransform(-(popWidth - width) / 2 + wrapperPosition[dir] + parallel);
|
|
231
202
|
}
|
|
232
|
-
if (skew === '
|
|
233
|
-
styles.left =
|
|
203
|
+
if (skew === 'left') {
|
|
204
|
+
styles.left = pxTransform(left + parallel);
|
|
234
205
|
}
|
|
235
|
-
if (skew === '
|
|
236
|
-
styles.left =
|
|
206
|
+
if (skew === 'right') {
|
|
207
|
+
styles.left = pxTransform(right + parallel);
|
|
237
208
|
}
|
|
238
209
|
}
|
|
239
210
|
if ([
|
|
240
211
|
'left',
|
|
241
212
|
'right'
|
|
242
213
|
].includes(direction)) {
|
|
243
|
-
var contentW = direction === 'left' ? -(
|
|
244
|
-
styles.left =
|
|
214
|
+
var contentW = direction === 'left' ? -(popWidth + cross) : width + cross;
|
|
215
|
+
styles.left = pxTransform(left + contentW);
|
|
245
216
|
if (!skew) {
|
|
246
|
-
styles.top =
|
|
217
|
+
styles.top = pxTransform(top - popHeight / 2 + height / 2 - 4 + parallel);
|
|
247
218
|
}
|
|
248
|
-
if (skew === '
|
|
249
|
-
styles.top =
|
|
219
|
+
if (skew === 'top') {
|
|
220
|
+
styles.top = pxTransform(top + parallel);
|
|
250
221
|
}
|
|
251
|
-
if (skew === '
|
|
252
|
-
styles.top =
|
|
222
|
+
if (skew === 'bottom') {
|
|
223
|
+
styles.top = pxTransform(top + height + parallel);
|
|
253
224
|
}
|
|
254
225
|
}
|
|
255
226
|
}
|
|
256
|
-
styles.visibility =
|
|
227
|
+
styles.visibility = popWidth === 0 ? 'hidden' : 'initial';
|
|
257
228
|
return styles;
|
|
258
229
|
};
|
|
259
230
|
var popoverArrowStyle = function() {
|
|
@@ -271,10 +242,10 @@ export var Popover = function(props) {
|
|
|
271
242
|
if (!skew) {
|
|
272
243
|
styles[dir] = "calc(50% + ".concat(arrowOffset, "px)");
|
|
273
244
|
}
|
|
274
|
-
if (skew === '
|
|
245
|
+
if (skew === 'left') {
|
|
275
246
|
styles[dir] = "".concat(base + arrowOffset, "px");
|
|
276
247
|
}
|
|
277
|
-
if (skew === '
|
|
248
|
+
if (skew === 'right') {
|
|
278
249
|
styles[dir2] = "".concat(base - arrowOffset, "px");
|
|
279
250
|
}
|
|
280
251
|
}
|
|
@@ -285,10 +256,10 @@ export var Popover = function(props) {
|
|
|
285
256
|
if (!skew) {
|
|
286
257
|
styles.top = "calc(50% - ".concat(arrowOffset, "px)");
|
|
287
258
|
}
|
|
288
|
-
if (skew === '
|
|
259
|
+
if (skew === 'top') {
|
|
289
260
|
styles.top = "".concat(base - arrowOffset, "px");
|
|
290
261
|
}
|
|
291
|
-
if (skew === '
|
|
262
|
+
if (skew === 'bottom') {
|
|
292
263
|
styles.bottom = "".concat(base + arrowOffset, "px");
|
|
293
264
|
}
|
|
294
265
|
}
|
|
@@ -307,6 +278,7 @@ export var Popover = function(props) {
|
|
|
307
278
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, !targetId && /*#__PURE__*/ React.createElement(View, {
|
|
308
279
|
className: "nut-popover-wrapper",
|
|
309
280
|
ref: popoverRef,
|
|
281
|
+
id: popoverId,
|
|
310
282
|
onClick: function() {
|
|
311
283
|
var _props_onClick;
|
|
312
284
|
props === null || props === void 0 ? void 0 : (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props);
|
|
@@ -319,7 +291,7 @@ export var Popover = function(props) {
|
|
|
319
291
|
style: style
|
|
320
292
|
}, Array.isArray(children) ? children[0] : children), /*#__PURE__*/ React.createElement(View, {
|
|
321
293
|
className: classes,
|
|
322
|
-
style:
|
|
294
|
+
style: _object_spread({}, getPopoverPosition(), style)
|
|
323
295
|
}, /*#__PURE__*/ React.createElement(Popup, _object_spread({
|
|
324
296
|
className: "nut-popover-content nut-popover-content-".concat(location),
|
|
325
297
|
position: "none",
|
|
@@ -334,22 +306,23 @@ export var Popover = function(props) {
|
|
|
334
306
|
}, /*#__PURE__*/ React.createElement(ArrowRadius, {
|
|
335
307
|
width: 8,
|
|
336
308
|
height: 4
|
|
337
|
-
})), Array.isArray(children) ? children[1] :
|
|
309
|
+
})), Array.isArray(children) ? children[1] : null, list.map(function(item, index) {
|
|
310
|
+
var _item_action;
|
|
338
311
|
return /*#__PURE__*/ React.createElement(View, {
|
|
339
312
|
className: classNames({
|
|
340
|
-
'nut-popover-
|
|
341
|
-
'nut-popover-
|
|
313
|
+
'nut-popover-item': true,
|
|
314
|
+
'nut-popover-item-disabled': item.disabled
|
|
342
315
|
}, item.className),
|
|
343
316
|
key: item.key || index,
|
|
344
317
|
onClick: function() {
|
|
345
318
|
return handleSelect(item, index);
|
|
346
319
|
}
|
|
347
320
|
}, item.icon && /*#__PURE__*/ React.createElement(View, {
|
|
348
|
-
className: "nut-popover-
|
|
349
|
-
}, item.icon), /*#__PURE__*/ React.createElement(
|
|
350
|
-
className: "nut-popover-
|
|
351
|
-
}, item.name), item.action
|
|
352
|
-
className: "nut-popover-
|
|
321
|
+
className: "nut-popover-item-icon"
|
|
322
|
+
}, item.icon), /*#__PURE__*/ React.createElement(Text, {
|
|
323
|
+
className: "nut-popover-item-name"
|
|
324
|
+
}, item.name), ((_item_action = item.action) === null || _item_action === void 0 ? void 0 : _item_action.icon) && /*#__PURE__*/ React.createElement(View, {
|
|
325
|
+
className: "nut-popover-item-action-icon",
|
|
353
326
|
onClick: function(e) {
|
|
354
327
|
var _item_action_onClick, _item_action;
|
|
355
328
|
return (_item_action = item.action) === null || _item_action === void 0 ? void 0 : (_item_action_onClick = _item_action.onClick) === null || _item_action_onClick === void 0 ? void 0 : _item_action_onClick.call(_item_action, e);
|
|
@@ -30,13 +30,14 @@
|
|
|
30
30
|
transform: rotate(90deg) translateY(-50%);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
&.nut-popover-arrow-left-
|
|
33
|
+
&.nut-popover-arrow-left-top {
|
|
34
34
|
top: 16px;
|
|
35
35
|
right: -8px;
|
|
36
36
|
transform: rotate(90deg) translateY(0%);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
&.nut-popover-arrow-left-
|
|
39
|
+
&.nut-popover-arrow-left-bottom {
|
|
40
|
+
top: auto;
|
|
40
41
|
bottom: 16px;
|
|
41
42
|
right: -8px;
|
|
42
43
|
transform: rotate(90deg) translateY(0%);
|
|
@@ -51,13 +52,13 @@
|
|
|
51
52
|
transform: rotate(-90deg) translateY(-50%);
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
&.nut-popover-arrow-right-
|
|
55
|
+
&.nut-popover-arrow-right-top {
|
|
55
56
|
top: 16px;
|
|
56
57
|
left: -8px;
|
|
57
58
|
transform: rotate(-90deg) translateY(0%);
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
&.nut-popover-arrow-right-
|
|
61
|
+
&.nut-popover-arrow-right-bottom {
|
|
61
62
|
bottom: 16px;
|
|
62
63
|
left: -8px;
|
|
63
64
|
transform: rotate(-90deg) translateY(0%);
|
|
@@ -75,13 +76,16 @@
|
|
|
75
76
|
max-height: initial;
|
|
76
77
|
overflow-y: initial;
|
|
77
78
|
|
|
78
|
-
|
|
79
|
+
&-group {
|
|
80
|
+
padding: 0 $popover-padding;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.nut-popover-item {
|
|
79
84
|
display: flex;
|
|
80
85
|
align-items: center;
|
|
81
86
|
justify-content: center;
|
|
82
|
-
padding: 0 $popover-menu-item-padding;
|
|
83
87
|
border-bottom: 1px solid $popover-divider-color;
|
|
84
|
-
max-width: $popover-
|
|
88
|
+
max-width: $popover-item-width;
|
|
85
89
|
word-wrap: break-word;
|
|
86
90
|
|
|
87
91
|
&:last-child {
|
|
@@ -89,48 +93,42 @@
|
|
|
89
93
|
border-bottom: none;
|
|
90
94
|
}
|
|
91
95
|
|
|
92
|
-
&-icon
|
|
96
|
+
&-icon,
|
|
97
|
+
&-action-icon {
|
|
93
98
|
display: flex;
|
|
94
99
|
justify-content: center;
|
|
95
100
|
align-items: center;
|
|
96
|
-
width:
|
|
97
|
-
height:
|
|
98
|
-
font-size:
|
|
101
|
+
width: $font-size-s;
|
|
102
|
+
height: $font-size-s;
|
|
103
|
+
font-size: $font-size-s;
|
|
99
104
|
.nut-icon {
|
|
100
|
-
width:
|
|
101
|
-
height:
|
|
102
|
-
font-size:
|
|
105
|
+
width: $font-size-s;
|
|
106
|
+
height: $font-size-s;
|
|
107
|
+
font-size: $font-size-s;
|
|
103
108
|
}
|
|
104
109
|
}
|
|
105
110
|
|
|
111
|
+
&-icon {
|
|
112
|
+
margin-right: $spacing-xxs;
|
|
113
|
+
}
|
|
114
|
+
|
|
106
115
|
&-name {
|
|
107
116
|
width: calc(100% - 34px);
|
|
108
117
|
word-break: keep-all;
|
|
109
|
-
margin: 0 8px 0 4px;
|
|
110
118
|
flex: 1;
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
&-action-icon {
|
|
114
|
-
display: flex;
|
|
115
|
-
justify-content: center;
|
|
116
|
-
align-items: center;
|
|
117
|
-
width: 12px;
|
|
118
|
-
height: 12px;
|
|
119
|
-
font-size: 12px;
|
|
120
122
|
color: $color-text;
|
|
121
|
-
|
|
122
|
-
width: 12px;
|
|
123
|
-
height: 12px;
|
|
124
|
-
font-size: 12px;
|
|
125
|
-
}
|
|
123
|
+
margin-left: $spacing-base;
|
|
126
124
|
}
|
|
127
125
|
|
|
128
|
-
&.nut-popover-
|
|
126
|
+
&.nut-popover-item-disabled {
|
|
129
127
|
color: $popover-disable-color;
|
|
130
128
|
cursor: not-allowed;
|
|
131
129
|
}
|
|
132
130
|
|
|
133
|
-
&.nut-popover-
|
|
131
|
+
&.nut-popover-taroitem {
|
|
134
132
|
display: flex;
|
|
135
133
|
}
|
|
136
134
|
}
|
|
@@ -143,18 +141,18 @@
|
|
|
143
141
|
}
|
|
144
142
|
}
|
|
145
143
|
|
|
146
|
-
&-top-
|
|
144
|
+
&-top-right {
|
|
147
145
|
right: 0;
|
|
148
|
-
.nut-popover-arrow-top-
|
|
146
|
+
.nut-popover-arrow-top-right {
|
|
149
147
|
right: 16px;
|
|
150
148
|
bottom: -3.5px;
|
|
151
149
|
transform: rotate(180deg) translateX(0%);
|
|
152
150
|
}
|
|
153
151
|
}
|
|
154
152
|
|
|
155
|
-
&-top-
|
|
153
|
+
&-top-left {
|
|
156
154
|
left: 0;
|
|
157
|
-
.nut-popover-arrow-top-
|
|
155
|
+
.nut-popover-arrow-top-left {
|
|
158
156
|
left: 16px;
|
|
159
157
|
bottom: -3.5px;
|
|
160
158
|
transform: rotate(180deg) translateX(0%);
|
|
@@ -168,35 +166,35 @@
|
|
|
168
166
|
}
|
|
169
167
|
}
|
|
170
168
|
|
|
171
|
-
&-bottom-
|
|
169
|
+
&-bottom-right {
|
|
172
170
|
right: 0;
|
|
173
|
-
.nut-popover-arrow-bottom-
|
|
171
|
+
.nut-popover-arrow-bottom-right {
|
|
174
172
|
right: 16px;
|
|
175
173
|
transform: translateX(0%);
|
|
176
174
|
}
|
|
177
175
|
}
|
|
178
176
|
|
|
179
|
-
&-bottom-
|
|
177
|
+
&-bottom-left {
|
|
180
178
|
left: 0;
|
|
181
|
-
.nut-popover-arrow-bottom-
|
|
179
|
+
.nut-popover-arrow-bottom-left {
|
|
182
180
|
left: 16px;
|
|
183
181
|
transform: translateX(0%);
|
|
184
182
|
}
|
|
185
183
|
}
|
|
186
184
|
|
|
187
|
-
&-left-
|
|
185
|
+
&-left-bottom {
|
|
188
186
|
bottom: 0;
|
|
189
187
|
}
|
|
190
188
|
|
|
191
|
-
&-left-
|
|
189
|
+
&-left-top {
|
|
192
190
|
top: 0;
|
|
193
191
|
}
|
|
194
192
|
|
|
195
|
-
&-right-
|
|
193
|
+
&-right-bottom {
|
|
196
194
|
bottom: 0;
|
|
197
195
|
}
|
|
198
196
|
|
|
199
|
-
&-right-
|
|
197
|
+
&-right-top {
|
|
200
198
|
top: 0;
|
|
201
199
|
}
|
|
202
200
|
}
|
|
@@ -215,7 +213,7 @@
|
|
|
215
213
|
.nut-popover-content {
|
|
216
214
|
background: $popover-text-color !important;
|
|
217
215
|
color: $popover-content-background-color !important;
|
|
218
|
-
.nut-popover-
|
|
216
|
+
.nut-popover-item {
|
|
219
217
|
&-action-icon {
|
|
220
218
|
color: rgba(255, 255, 255, 0.8);
|
|
221
219
|
}
|
|
@@ -226,7 +224,7 @@
|
|
|
226
224
|
[dir='rtl'] .nut-popover,
|
|
227
225
|
.nut-rtl .nut-popover {
|
|
228
226
|
.nut-popover-content {
|
|
229
|
-
.nut-popover-
|
|
227
|
+
.nut-popover-item {
|
|
230
228
|
&-name {
|
|
231
229
|
margin-left: 0;
|
|
232
230
|
margin-right: 4px;
|
|
@@ -234,7 +232,6 @@
|
|
|
234
232
|
|
|
235
233
|
&-action-icon {
|
|
236
234
|
right: auto;
|
|
237
|
-
left: $popover-menu-item-padding;
|
|
238
235
|
}
|
|
239
236
|
}
|
|
240
237
|
&-top {
|
|
@@ -244,21 +241,21 @@
|
|
|
244
241
|
transform: translateX(50%);
|
|
245
242
|
}
|
|
246
243
|
}
|
|
247
|
-
&-top-
|
|
244
|
+
&-top-right {
|
|
248
245
|
right: auto;
|
|
249
246
|
left: 0;
|
|
250
247
|
|
|
251
|
-
.nut-popover-arrow-top-
|
|
248
|
+
.nut-popover-arrow-top-right {
|
|
252
249
|
right: auto;
|
|
253
250
|
left: 16px;
|
|
254
251
|
}
|
|
255
252
|
}
|
|
256
253
|
|
|
257
|
-
&-top-
|
|
254
|
+
&-top-left {
|
|
258
255
|
left: auto;
|
|
259
256
|
right: 0;
|
|
260
257
|
|
|
261
|
-
.nut-popover-arrow-top-
|
|
258
|
+
.nut-popover-arrow-top-left {
|
|
262
259
|
left: auto;
|
|
263
260
|
right: 16px;
|
|
264
261
|
}
|
|
@@ -271,22 +268,22 @@
|
|
|
271
268
|
transform: translateX(50%);
|
|
272
269
|
}
|
|
273
270
|
}
|
|
274
|
-
&-bottom-
|
|
271
|
+
&-bottom-right {
|
|
275
272
|
right: auto;
|
|
276
273
|
|
|
277
274
|
left: 0;
|
|
278
275
|
|
|
279
|
-
.nut-popover-arrow-bottom-
|
|
276
|
+
.nut-popover-arrow-bottom-right {
|
|
280
277
|
right: auto;
|
|
281
278
|
left: 16px;
|
|
282
279
|
}
|
|
283
280
|
}
|
|
284
281
|
|
|
285
|
-
&-bottom-
|
|
282
|
+
&-bottom-left {
|
|
286
283
|
left: auto;
|
|
287
284
|
right: 0;
|
|
288
285
|
|
|
289
|
-
.nut-popover-arrow-bottom-
|
|
286
|
+
.nut-popover-arrow-bottom-left {
|
|
290
287
|
left: auto;
|
|
291
288
|
right: 16px;
|
|
292
289
|
}
|