@nutui/nutui-react-taro 3.0.5 → 3.0.7
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 +59 -1
- 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/badge/badge.js +4 -3
- package/dist/cjs/packages/badge/style/badge.scss +4 -0
- package/dist/cjs/packages/badge/style/style.css +9 -6
- package/dist/cjs/packages/badge/style/style.harmony.css +3 -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/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 +7 -4
- package/dist/cjs/packages/datepickerview/style/style.css +3 -0
- 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/style.css +4 -16
- package/dist/cjs/packages/empty/style/style.css +4 -16
- package/dist/cjs/packages/fixednav/style/style.css +9 -6
- package/dist/cjs/packages/imagepreview/style/style.css +4 -4
- package/dist/cjs/packages/indicator/indicator.js +1 -1
- package/dist/cjs/packages/lottie/index.js +5 -5
- package/dist/cjs/packages/lottie/{mp.js → lottiemp.js} +1 -1
- package/dist/cjs/packages/notify/notify.js +44 -13
- package/dist/cjs/packages/notify/style/notify.scss +39 -36
- package/dist/cjs/packages/notify/style/style.css +36 -31
- package/dist/cjs/packages/notify/style/style.harmony.css +36 -31
- package/dist/cjs/packages/numberkeyboard/style/style.css +4 -4
- package/dist/cjs/packages/picker/style/style.css +7 -4
- package/dist/cjs/packages/pickerview/pickerroller.js +7 -2
- package/dist/cjs/packages/pickerview/style/pickerview.scss +3 -0
- package/dist/cjs/packages/pickerview/style/style.css +3 -0
- package/dist/cjs/packages/pickerview/style/style.harmony.css +3 -0
- 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/searchbar/searchbar.js +8 -2
- package/dist/cjs/packages/shortpassword/style/style.css +4 -4
- package/dist/cjs/packages/skeleton/skeleton.js +63 -52
- package/dist/cjs/packages/skeleton/style/index.js +0 -1
- package/dist/cjs/packages/skeleton/style/skeleton.scss +40 -46
- package/dist/cjs/packages/skeleton/style/style.css +32 -175
- package/dist/cjs/packages/skeleton/style/style.harmony.css +32 -42
- package/dist/cjs/packages/switch/style/style.css +5 -0
- package/dist/cjs/packages/switch/style/style.harmony.css +5 -0
- package/dist/cjs/packages/switch/style/switch.scss +5 -0
- package/dist/cjs/packages/switch/switch.js +22 -11
- package/dist/cjs/packages/tabbar/style/style.css +54 -45
- package/dist/cjs/packages/tabbar/style/style.harmony.css +24 -18
- package/dist/cjs/packages/tabbar/style/tabbar.scss +28 -19
- package/dist/cjs/packages/tabbar/tabbar.js +28 -10
- package/dist/cjs/packages/tabbaritem/style/style.css +30 -27
- package/dist/cjs/packages/tabbaritem/style/style.harmony.css +21 -21
- package/dist/cjs/packages/tabbaritem/style/tabbaritem.scss +32 -29
- package/dist/cjs/packages/tabbaritem/tabbaritem.js +38 -14
- 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/badge/base.d.ts +1 -0
- 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/indicator/base.d.ts +1 -1
- package/dist/cjs/types/spec/notify/base.d.ts +7 -2
- package/dist/cjs/types/spec/popover/base.d.ts +7 -0
- package/dist/cjs/types/spec/searchbar/taro.d.ts +10 -7
- package/dist/cjs/types/spec/skeleton/base.d.ts +7 -5
- package/dist/cjs/types/spec/switch/base.d.ts +3 -2
- package/dist/cjs/types/spec/switch/h5.d.ts +1 -1
- package/dist/cjs/types/spec/switch/taro.d.ts +1 -4
- package/dist/cjs/types/spec/tabbar/base.d.ts +7 -4
- 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/badge/badge.js +4 -3
- package/dist/es/packages/badge/style/badge.scss +4 -0
- package/dist/es/packages/badge/style/style.css +9 -6
- package/dist/es/packages/badge/style/style.harmony.css +3 -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/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 +7 -4
- package/dist/es/packages/datepickerview/style/style.css +3 -0
- 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/style.css +4 -16
- package/dist/es/packages/empty/style/style.css +4 -16
- package/dist/es/packages/fixednav/style/style.css +9 -6
- package/dist/es/packages/imagepreview/style/style.css +4 -4
- package/dist/es/packages/indicator/indicator.js +1 -1
- package/dist/es/packages/lottie/index.js +3 -3
- package/dist/es/packages/lottie/{mp.js → lottiemp.js} +1 -1
- package/dist/es/packages/notify/notify.js +45 -14
- package/dist/es/packages/notify/style/notify.scss +39 -36
- package/dist/es/packages/notify/style/style.css +36 -31
- package/dist/es/packages/notify/style/style.harmony.css +36 -31
- package/dist/es/packages/numberkeyboard/style/style.css +4 -4
- package/dist/es/packages/picker/style/style.css +7 -4
- package/dist/es/packages/pickerview/pickerroller.js +7 -2
- package/dist/es/packages/pickerview/style/pickerview.scss +3 -0
- package/dist/es/packages/pickerview/style/style.css +3 -0
- package/dist/es/packages/pickerview/style/style.harmony.css +3 -0
- 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/searchbar/searchbar.js +7 -2
- package/dist/es/packages/shortpassword/style/style.css +4 -4
- package/dist/es/packages/skeleton/skeleton.js +62 -52
- package/dist/es/packages/skeleton/style/index.js +0 -1
- package/dist/es/packages/skeleton/style/skeleton.scss +40 -46
- package/dist/es/packages/skeleton/style/style.css +32 -175
- package/dist/es/packages/skeleton/style/style.harmony.css +32 -42
- package/dist/es/packages/switch/style/style.css +5 -0
- package/dist/es/packages/switch/style/style.harmony.css +5 -0
- package/dist/es/packages/switch/style/switch.scss +5 -0
- package/dist/es/packages/switch/switch.js +21 -11
- package/dist/es/packages/tabbar/style/style.css +54 -45
- package/dist/es/packages/tabbar/style/style.harmony.css +24 -18
- package/dist/es/packages/tabbar/style/tabbar.scss +28 -19
- package/dist/es/packages/tabbar/tabbar.js +27 -10
- package/dist/es/packages/tabbaritem/style/style.css +30 -27
- package/dist/es/packages/tabbaritem/style/style.harmony.css +21 -21
- package/dist/es/packages/tabbaritem/style/tabbaritem.scss +32 -29
- package/dist/es/packages/tabbaritem/tabbaritem.js +38 -14
- 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/badge/base.d.ts +4 -0
- 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/indicator/base.d.ts +1 -1
- package/dist/es/types/spec/notify/base.d.ts +22 -5
- package/dist/es/types/spec/popover/base.d.ts +7 -0
- package/dist/es/types/spec/searchbar/taro.d.ts +10 -7
- package/dist/es/types/spec/skeleton/base.d.ts +19 -14
- package/dist/es/types/spec/switch/base.d.ts +6 -2
- package/dist/es/types/spec/switch/h5.d.ts +1 -1
- package/dist/es/types/spec/switch/taro.d.ts +1 -4
- package/dist/es/types/spec/tabbar/base.d.ts +7 -4
- 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 +683 -552
- package/dist/style.css +1 -1
- package/dist/style.scss +46 -46
- package/dist/styles/theme-jmapp.scss +1 -0
- package/dist/styles/themes/jmapp.css +1 -1
- package/dist/styles/variables-jmapp.scss +237 -50
- package/dist/styles/variables-jrkf.scss +25 -14
- package/dist/styles/variables.scss +38 -51
- 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
- /package/dist/cjs/packages/lottie/{mp.d.ts → lottiemp.d.ts} +0 -0
- /package/dist/cjs/packages/lottie/{web.d.ts → lottieweb.d.ts} +0 -0
- /package/dist/cjs/packages/lottie/{web.js → lottieweb.js} +0 -0
- /package/dist/es/packages/lottie/{mp.d.ts → lottiemp.d.ts} +0 -0
- /package/dist/es/packages/lottie/{web.d.ts → lottieweb.d.ts} +0 -0
- /package/dist/es/packages/lottie/{web.js → lottieweb.js} +0 -0
|
@@ -19,14 +19,15 @@ var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
|
|
|
19
19
|
var _ts_generator = require("@swc/helpers/_/_ts_generator");
|
|
20
20
|
var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
21
21
|
var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
|
|
22
|
-
var _taro =
|
|
22
|
+
var _taro = require("@tarojs/taro");
|
|
23
23
|
var _components = require("@tarojs/components");
|
|
24
24
|
var _iconsreacttaro = require("@nutui/icons-react-taro");
|
|
25
25
|
var _index = /*#__PURE__*/ _interop_require_default._(require("../popup/index"));
|
|
26
26
|
var _getrectbytaro = require("../../utils/get-rect-by-taro");
|
|
27
27
|
var _typings = require("../../utils/typings");
|
|
28
|
-
var _useclientrect = require("../../hooks/use-client-rect");
|
|
29
28
|
var _index1 = require("../configprovider/index");
|
|
29
|
+
var _pxtransform = /*#__PURE__*/ _interop_require_default._(require("../../utils/px-transform"));
|
|
30
|
+
var _useuuid = /*#__PURE__*/ _interop_require_default._(require("../../hooks/use-uuid"));
|
|
30
31
|
var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
|
|
31
32
|
list: [],
|
|
32
33
|
theme: 'light',
|
|
@@ -38,7 +39,6 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
|
|
|
38
39
|
],
|
|
39
40
|
arrowOffset: 0,
|
|
40
41
|
targetId: '',
|
|
41
|
-
className: '',
|
|
42
42
|
showArrow: true,
|
|
43
43
|
closeOnOutsideClick: true,
|
|
44
44
|
closeOnActionClick: true,
|
|
@@ -73,129 +73,100 @@ var Popover = function Popover(props) {
|
|
|
73
73
|
var popoverRef = (0, _react.useRef)(null);
|
|
74
74
|
var popoverContentRef = (0, _react.useRef)(null);
|
|
75
75
|
var _useState = (0, _sliced_to_array._)((0, _react.useState)(false), 2), showPopup = _useState[0], setShowPopup = _useState[1];
|
|
76
|
-
var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(0), 2),
|
|
77
|
-
var _useState2 = (0, _sliced_to_array._)((0, _react.useState)(0), 2),
|
|
78
|
-
var _useState3 = (0, _sliced_to_array._)((0, _react.useState)(), 2),
|
|
76
|
+
var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), popWidth = _useState1[0], setPopWidth = _useState1[1];
|
|
77
|
+
var _useState2 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), popHeight = _useState2[0], setPopHeight = _useState2[1];
|
|
78
|
+
var _useState3 = (0, _sliced_to_array._)((0, _react.useState)(), 2), wrapperPosition = _useState3[0], setWrapperPosition = _useState3[1];
|
|
79
79
|
(0, _react.useEffect)(function() {
|
|
80
80
|
setShowPopup(visible);
|
|
81
81
|
if (visible) {
|
|
82
|
-
|
|
83
|
-
getContentWidth();
|
|
84
|
-
}, 0);
|
|
82
|
+
getWrapperPosition();
|
|
85
83
|
}
|
|
86
84
|
}, [
|
|
87
85
|
visible
|
|
88
86
|
]);
|
|
89
|
-
var
|
|
87
|
+
var uid = (0, _useuuid.default)();
|
|
88
|
+
var popoverId = "popover-".concat(uid);
|
|
89
|
+
var getWrapperPosition = /*#__PURE__*/ function() {
|
|
90
90
|
var _ref = (0, _async_to_generator._)(function() {
|
|
91
|
-
var rect;
|
|
92
91
|
return (0, _ts_generator._)(this, function(_state) {
|
|
93
|
-
(0, _taro.
|
|
94
|
-
var
|
|
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
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
setRootPosition({
|
|
136
|
-
width: rect.width,
|
|
137
|
-
height: rect.height,
|
|
138
|
-
left: rtl ? rect.right : rect.left,
|
|
139
|
-
top: rect.top + distance,
|
|
140
|
-
right: rtl ? rect.left : rect.right
|
|
141
|
-
});
|
|
142
|
-
return [
|
|
143
|
-
2
|
|
144
|
-
];
|
|
145
|
-
}
|
|
146
|
-
});
|
|
92
|
+
(0, _taro.nextTick)(/*#__PURE__*/ (0, _async_to_generator._)(function() {
|
|
93
|
+
var rect, _tmp, width, height, right, left, top;
|
|
94
|
+
return (0, _ts_generator._)(this, function(_state) {
|
|
95
|
+
switch(_state.label){
|
|
96
|
+
case 0:
|
|
97
|
+
if (!targetId) return [
|
|
98
|
+
3,
|
|
99
|
+
2
|
|
100
|
+
];
|
|
101
|
+
return [
|
|
102
|
+
4,
|
|
103
|
+
(0, _getrectbytaro.getRectByTaro)(document.querySelector("#".concat(targetId)), targetId)
|
|
104
|
+
];
|
|
105
|
+
case 1:
|
|
106
|
+
_tmp = _state.sent();
|
|
107
|
+
return [
|
|
108
|
+
3,
|
|
109
|
+
4
|
|
110
|
+
];
|
|
111
|
+
case 2:
|
|
112
|
+
return [
|
|
113
|
+
4,
|
|
114
|
+
(0, _getrectbytaro.getRectByTaro)(popoverRef.current, popoverId)
|
|
115
|
+
];
|
|
116
|
+
case 3:
|
|
117
|
+
_tmp = _state.sent();
|
|
118
|
+
_state.label = 4;
|
|
119
|
+
case 4:
|
|
120
|
+
rect = _tmp;
|
|
121
|
+
width = rect.width, height = rect.height, right = rect.right, left = rect.left, top = rect.top;
|
|
122
|
+
setWrapperPosition({
|
|
123
|
+
width: width,
|
|
124
|
+
height: height,
|
|
125
|
+
left: rtl ? right : left,
|
|
126
|
+
top: top,
|
|
127
|
+
right: rtl ? left : right
|
|
128
|
+
});
|
|
129
|
+
getPopoverContentW();
|
|
130
|
+
return [
|
|
131
|
+
2
|
|
132
|
+
];
|
|
133
|
+
}
|
|
147
134
|
});
|
|
148
|
-
|
|
149
|
-
return _ref.apply(this, arguments);
|
|
150
|
-
};
|
|
151
|
-
}()).exec();
|
|
152
|
-
setTimeout(function() {
|
|
153
|
-
getPopoverContentW();
|
|
154
|
-
}, 300);
|
|
135
|
+
}));
|
|
155
136
|
return [
|
|
156
137
|
2
|
|
157
138
|
];
|
|
158
139
|
});
|
|
159
140
|
});
|
|
160
|
-
return function
|
|
161
|
-
return _ref.apply(this, arguments);
|
|
162
|
-
};
|
|
163
|
-
}();
|
|
164
|
-
var getRectTaro = /*#__PURE__*/ function() {
|
|
165
|
-
var _ref = (0, _async_to_generator._)(function(targetId) {
|
|
166
|
-
return (0, _ts_generator._)(this, function(_state) {
|
|
167
|
-
return [
|
|
168
|
-
2,
|
|
169
|
-
new Promise(function(resolve) {
|
|
170
|
-
(0, _taro.createSelectorQuery)().select("#".concat(targetId)).boundingClientRect().exec(function(res) {
|
|
171
|
-
resolve(res[0]);
|
|
172
|
-
});
|
|
173
|
-
})
|
|
174
|
-
];
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
return function getRectTaro(targetId) {
|
|
141
|
+
return function getWrapperPosition() {
|
|
178
142
|
return _ref.apply(this, arguments);
|
|
179
143
|
};
|
|
180
144
|
}();
|
|
181
145
|
var getPopoverContentW = /*#__PURE__*/ function() {
|
|
182
146
|
var _ref = (0, _async_to_generator._)(function() {
|
|
183
|
-
var rectContent;
|
|
184
147
|
return (0, _ts_generator._)(this, function(_state) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
148
|
+
(0, _taro.nextTick)(/*#__PURE__*/ (0, _async_to_generator._)(function() {
|
|
149
|
+
var rectContent;
|
|
150
|
+
return (0, _ts_generator._)(this, function(_state) {
|
|
151
|
+
switch(_state.label){
|
|
152
|
+
case 0:
|
|
153
|
+
return [
|
|
154
|
+
4,
|
|
155
|
+
(0, _getrectbytaro.getRectByTaro)(popoverContentRef.current)
|
|
156
|
+
];
|
|
157
|
+
case 1:
|
|
158
|
+
rectContent = _state.sent();
|
|
159
|
+
setPopWidth(rectContent.width);
|
|
160
|
+
setPopHeight(rectContent.height);
|
|
161
|
+
return [
|
|
162
|
+
2
|
|
163
|
+
];
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}));
|
|
167
|
+
return [
|
|
168
|
+
2
|
|
169
|
+
];
|
|
199
170
|
});
|
|
200
171
|
});
|
|
201
172
|
return function getPopoverContentW() {
|
|
@@ -204,23 +175,23 @@ var Popover = function Popover(props) {
|
|
|
204
175
|
}();
|
|
205
176
|
var clickAway = function clickAway() {
|
|
206
177
|
if (closeOnOutsideClick) {
|
|
207
|
-
onClick
|
|
208
|
-
onClose
|
|
178
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
179
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
209
180
|
}
|
|
210
181
|
};
|
|
211
|
-
var
|
|
212
|
-
var classes = (0, _classnames.default)((_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix), true), (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(theme), theme === 'dark'), _obj), className);
|
|
182
|
+
var classes = (0, _classnames.default)(classPrefix, (0, _define_property._)({}, "".concat(classPrefix, "-").concat(theme), theme === 'dark'), className);
|
|
213
183
|
var popoverArrow = function popoverArrow() {
|
|
214
184
|
var prefixCls = 'nut-popover-arrow';
|
|
215
|
-
|
|
185
|
+
var direction = location.split('-')[0];
|
|
186
|
+
return "".concat(prefixCls, " ").concat(prefixCls, "-").concat(direction, " ").concat(prefixCls, "-").concat(location);
|
|
216
187
|
};
|
|
217
|
-
var
|
|
188
|
+
var getPopoverPosition = function getPopoverPosition() {
|
|
218
189
|
var styles = {};
|
|
219
|
-
if (!
|
|
190
|
+
if (!wrapperPosition) {
|
|
220
191
|
styles.visibility = 'hidden';
|
|
221
192
|
return styles;
|
|
222
193
|
}
|
|
223
|
-
var width =
|
|
194
|
+
var width = wrapperPosition.width, height = wrapperPosition.height, left = wrapperPosition.left, top = wrapperPosition.top, right = wrapperPosition.right;
|
|
224
195
|
var direction = location.split('-')[0];
|
|
225
196
|
var skew = location.split('-')[1];
|
|
226
197
|
var cross = 0;
|
|
@@ -236,36 +207,36 @@ var Popover = function Popover(props) {
|
|
|
236
207
|
'bottom',
|
|
237
208
|
'top'
|
|
238
209
|
].includes(direction)) {
|
|
239
|
-
var h = direction === 'bottom' ? height + cross : -(
|
|
240
|
-
styles.top =
|
|
210
|
+
var h = direction === 'bottom' ? height + cross : -(popHeight + cross);
|
|
211
|
+
styles.top = (0, _pxtransform.default)(top + h);
|
|
241
212
|
if (!skew) {
|
|
242
|
-
styles[dir] =
|
|
213
|
+
styles[dir] = (0, _pxtransform.default)(-(popWidth - width) / 2 + wrapperPosition[dir] + parallel);
|
|
243
214
|
}
|
|
244
|
-
if (skew === '
|
|
245
|
-
styles.left =
|
|
215
|
+
if (skew === 'left') {
|
|
216
|
+
styles.left = (0, _pxtransform.default)(left + parallel);
|
|
246
217
|
}
|
|
247
|
-
if (skew === '
|
|
248
|
-
styles.left =
|
|
218
|
+
if (skew === 'right') {
|
|
219
|
+
styles.left = (0, _pxtransform.default)(right + parallel);
|
|
249
220
|
}
|
|
250
221
|
}
|
|
251
222
|
if ([
|
|
252
223
|
'left',
|
|
253
224
|
'right'
|
|
254
225
|
].includes(direction)) {
|
|
255
|
-
var contentW = direction === 'left' ? -(
|
|
256
|
-
styles.left =
|
|
226
|
+
var contentW = direction === 'left' ? -(popWidth + cross) : width + cross;
|
|
227
|
+
styles.left = (0, _pxtransform.default)(left + contentW);
|
|
257
228
|
if (!skew) {
|
|
258
|
-
styles.top =
|
|
229
|
+
styles.top = (0, _pxtransform.default)(top - popHeight / 2 + height / 2 - 4 + parallel);
|
|
259
230
|
}
|
|
260
|
-
if (skew === '
|
|
261
|
-
styles.top =
|
|
231
|
+
if (skew === 'top') {
|
|
232
|
+
styles.top = (0, _pxtransform.default)(top + parallel);
|
|
262
233
|
}
|
|
263
|
-
if (skew === '
|
|
264
|
-
styles.top =
|
|
234
|
+
if (skew === 'bottom') {
|
|
235
|
+
styles.top = (0, _pxtransform.default)(top + height + parallel);
|
|
265
236
|
}
|
|
266
237
|
}
|
|
267
238
|
}
|
|
268
|
-
styles.visibility =
|
|
239
|
+
styles.visibility = popWidth === 0 ? 'hidden' : 'initial';
|
|
269
240
|
return styles;
|
|
270
241
|
};
|
|
271
242
|
var popoverArrowStyle = function popoverArrowStyle() {
|
|
@@ -283,10 +254,10 @@ var Popover = function Popover(props) {
|
|
|
283
254
|
if (!skew) {
|
|
284
255
|
styles[dir] = "calc(50% + ".concat(arrowOffset, "px)");
|
|
285
256
|
}
|
|
286
|
-
if (skew === '
|
|
257
|
+
if (skew === 'left') {
|
|
287
258
|
styles[dir] = "".concat(base + arrowOffset, "px");
|
|
288
259
|
}
|
|
289
|
-
if (skew === '
|
|
260
|
+
if (skew === 'right') {
|
|
290
261
|
styles[dir2] = "".concat(base - arrowOffset, "px");
|
|
291
262
|
}
|
|
292
263
|
}
|
|
@@ -297,10 +268,10 @@ var Popover = function Popover(props) {
|
|
|
297
268
|
if (!skew) {
|
|
298
269
|
styles.top = "calc(50% - ".concat(arrowOffset, "px)");
|
|
299
270
|
}
|
|
300
|
-
if (skew === '
|
|
271
|
+
if (skew === 'top') {
|
|
301
272
|
styles.top = "".concat(base - arrowOffset, "px");
|
|
302
273
|
}
|
|
303
|
-
if (skew === '
|
|
274
|
+
if (skew === 'bottom') {
|
|
304
275
|
styles.bottom = "".concat(base + arrowOffset, "px");
|
|
305
276
|
}
|
|
306
277
|
}
|
|
@@ -319,6 +290,7 @@ var Popover = function Popover(props) {
|
|
|
319
290
|
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, !targetId && /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
320
291
|
className: "nut-popover-wrapper",
|
|
321
292
|
ref: popoverRef,
|
|
293
|
+
id: popoverId,
|
|
322
294
|
onClick: function onClick() {
|
|
323
295
|
var _props_onClick;
|
|
324
296
|
props === null || props === void 0 ? void 0 : (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props);
|
|
@@ -331,7 +303,7 @@ var Popover = function Popover(props) {
|
|
|
331
303
|
style: style
|
|
332
304
|
}, Array.isArray(children) ? children[0] : children), /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
333
305
|
className: classes,
|
|
334
|
-
style:
|
|
306
|
+
style: (0, _object_spread._)({}, getPopoverPosition(), style)
|
|
335
307
|
}, /*#__PURE__*/ _react.default.createElement(_index.default, (0, _object_spread._)({
|
|
336
308
|
className: "nut-popover-content nut-popover-content-".concat(location),
|
|
337
309
|
position: "none",
|
|
@@ -346,22 +318,23 @@ var Popover = function Popover(props) {
|
|
|
346
318
|
}, /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.ArrowRadius, {
|
|
347
319
|
width: 8,
|
|
348
320
|
height: 4
|
|
349
|
-
})), Array.isArray(children) ? children[1] :
|
|
321
|
+
})), Array.isArray(children) ? children[1] : null, list.map(function(item, index) {
|
|
322
|
+
var _item_action;
|
|
350
323
|
return /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
351
324
|
className: (0, _classnames.default)({
|
|
352
|
-
'nut-popover-
|
|
353
|
-
'nut-popover-
|
|
325
|
+
'nut-popover-item': true,
|
|
326
|
+
'nut-popover-item-disabled': item.disabled
|
|
354
327
|
}, item.className),
|
|
355
328
|
key: item.key || index,
|
|
356
329
|
onClick: function onClick() {
|
|
357
330
|
return handleSelect(item, index);
|
|
358
331
|
}
|
|
359
332
|
}, item.icon && /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
360
|
-
className: "nut-popover-
|
|
361
|
-
}, item.icon), /*#__PURE__*/ _react.default.createElement(_components.
|
|
362
|
-
className: "nut-popover-
|
|
363
|
-
}, item.name), item.action
|
|
364
|
-
className: "nut-popover-
|
|
333
|
+
className: "nut-popover-item-icon"
|
|
334
|
+
}, item.icon), /*#__PURE__*/ _react.default.createElement(_components.Text, {
|
|
335
|
+
className: "nut-popover-item-name"
|
|
336
|
+
}, item.name), ((_item_action = item.action) === null || _item_action === void 0 ? void 0 : _item_action.icon) && /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
337
|
+
className: "nut-popover-item-action-icon",
|
|
365
338
|
onClick: function onClick(e) {
|
|
366
339
|
var _item_action_onClick, _item_action;
|
|
367
340
|
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
|
}
|