@nutui/nutui-react-taro 3.0.6 → 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 +34 -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/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 +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/style.css +4 -16
- package/dist/cjs/packages/empty/style/style.css +4 -16
- package/dist/cjs/packages/imagepreview/style/style.css +4 -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/switch/switch.js +2 -2
- 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/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 +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/style.css +4 -16
- package/dist/es/packages/empty/style/style.css +4 -16
- package/dist/es/packages/imagepreview/style/style.css +4 -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/switch/switch.js +2 -2
- 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 +266 -260
- 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 +214 -49
- package/dist/styles/variables-jrkf.scss +2 -13
- package/dist/styles/variables.scss +3 -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
|
@@ -94,18 +94,6 @@
|
|
|
94
94
|
.nut-button-round {
|
|
95
95
|
border-radius: var(--nutui-button-border-radius, var(--nutui-radius-s, 6px));
|
|
96
96
|
}
|
|
97
|
-
.nut-button-round-xlarge {
|
|
98
|
-
border-radius: var(--nutui-button-xlarge-border-radius, var(--nutui-radius-base, 8px));
|
|
99
|
-
}
|
|
100
|
-
.nut-button-round-large {
|
|
101
|
-
border-radius: var(--nutui-button-large-border-radius, var(--nutui-radius-base, 8px));
|
|
102
|
-
}
|
|
103
|
-
.nut-button-round-small {
|
|
104
|
-
border-radius: var(--nutui-button-small-border-radius, var(--nutui-radius-s, 6px));
|
|
105
|
-
}
|
|
106
|
-
.nut-button-round-mini {
|
|
107
|
-
border-radius: var(--nutui-button-mini-border-radius, var(--nutui-radius-xs, 4px));
|
|
108
|
-
}
|
|
109
97
|
.nut-button-default {
|
|
110
98
|
padding: var(--nutui-button-default-padding, 0px 12px);
|
|
111
99
|
border-style: solid;
|
|
@@ -131,7 +119,7 @@
|
|
|
131
119
|
height: var(--nutui-button-xlarge-height, 48px);
|
|
132
120
|
padding: var(--nutui-button-xlarge-padding, 0px 24px);
|
|
133
121
|
font-size: var(--nutui-button-xlarge-font-size, var(--nutui-font-size-xl, 18px));
|
|
134
|
-
border-radius: var(--nutui-radius-base, 8px);
|
|
122
|
+
border-radius: var(--nutui-button-xlarge-border-radius, var(--nutui-radius-base, 8px));
|
|
135
123
|
}
|
|
136
124
|
.nut-button-xlarge .nut-button-text {
|
|
137
125
|
margin-left: var(--nutui-button-xlarge-text-icon-margin, 6px);
|
|
@@ -151,7 +139,7 @@
|
|
|
151
139
|
height: var(--nutui-button-large-height, 40px);
|
|
152
140
|
padding: var(--nutui-button-large-padding, 0px 16px);
|
|
153
141
|
font-size: var(--nutui-button-large-font-size, var(--nutui-font-size-l, 16px));
|
|
154
|
-
border-radius: var(--nutui-radius-
|
|
142
|
+
border-radius: var(--nutui-button-large-border-radius, var(--nutui-radius-base, 8px));
|
|
155
143
|
}
|
|
156
144
|
.nut-button-large .nut-button-text {
|
|
157
145
|
margin-left: var(--nutui-button-xlarge-text-icon-margin, 6px);
|
|
@@ -171,7 +159,7 @@
|
|
|
171
159
|
height: var(--nutui-button-small-height, 28px);
|
|
172
160
|
padding: var(--nutui-button-small-padding, 0px 8px);
|
|
173
161
|
font-size: var(--nutui-button-small-font-size, var(--nutui-font-size-s, 12px));
|
|
174
|
-
border-radius: var(--nutui-radius-
|
|
162
|
+
border-radius: var(--nutui-button-small-border-radius, var(--nutui-radius-s, 6px));
|
|
175
163
|
}
|
|
176
164
|
.nut-button-small .nut-icon {
|
|
177
165
|
font-size: var(--nutui-button-small-font-size, var(--nutui-font-size-s, 12px));
|
|
@@ -185,7 +173,7 @@
|
|
|
185
173
|
height: var(--nutui-button-mini-height, 24px);
|
|
186
174
|
padding: var(--nutui-button-mini-padding, 0px 8px);
|
|
187
175
|
font-size: var(--nutui-button-mini-font-size, var(--nutui-font-size-xs, 11px));
|
|
188
|
-
border-radius: var(--nutui-radius-xs, 4px);
|
|
176
|
+
border-radius: var(--nutui-button-mini-border-radius, var(--nutui-radius-xs, 4px));
|
|
189
177
|
}
|
|
190
178
|
.nut-button-mini .nut-icon {
|
|
191
179
|
font-size: var(--nutui-button-mini-font-size, var(--nutui-font-size-xs, 11px));
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
.nut-popup {
|
|
62
62
|
position: fixed;
|
|
63
|
-
min-height:
|
|
63
|
+
min-height: 26%;
|
|
64
64
|
max-height: 100%;
|
|
65
65
|
background-color: var(--nutui-overlay-content-bg-color, var(--nutui-color-background-overlay, #ffffff));
|
|
66
66
|
-webkit-overflow-scrolling: touch;
|
|
@@ -198,12 +198,12 @@
|
|
|
198
198
|
transform: scale(0.8);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
.nut-popup-slide-
|
|
201
|
+
.nut-popup-slide-none-enter-active {
|
|
202
202
|
animation-fill-mode: both;
|
|
203
203
|
animation-name: popup-scale-fade-in;
|
|
204
204
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
205
205
|
}
|
|
206
|
-
.nut-popup-slide-
|
|
206
|
+
.nut-popup-slide-none-exit-active {
|
|
207
207
|
animation-fill-mode: both;
|
|
208
208
|
animation-name: popup-scale-fade-out;
|
|
209
209
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
@@ -330,7 +330,7 @@
|
|
|
330
330
|
animation-name: popup-slide-left-exit;
|
|
331
331
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
332
332
|
}
|
|
333
|
-
.nut-popup-slide-
|
|
333
|
+
.nut-popup-slide-none-exit-done.nut-popup, .nut-popup-slide-center-exit-done.nut-popup, .nut-popup-slide-left-exit-done.nut-popup, .nut-popup-slide-right-exit-done.nut-popup, .nut-popup-slide-top-exit-done.nut-popup, .nut-popup-slide-bottom-exit-done.nut-popup {
|
|
334
334
|
display: none;
|
|
335
335
|
}
|
|
336
336
|
.nut-popup .nut-overflow-hidden {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
.nut-popup {
|
|
62
62
|
position: fixed;
|
|
63
|
-
min-height:
|
|
63
|
+
min-height: 26%;
|
|
64
64
|
max-height: 100%;
|
|
65
65
|
background-color: var(--nutui-overlay-content-bg-color, var(--nutui-color-background-overlay, #ffffff));
|
|
66
66
|
-webkit-overflow-scrolling: touch;
|
|
@@ -198,12 +198,12 @@
|
|
|
198
198
|
transform: scale(0.8);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
.nut-popup-slide-
|
|
201
|
+
.nut-popup-slide-none-enter-active {
|
|
202
202
|
animation-fill-mode: both;
|
|
203
203
|
animation-name: popup-scale-fade-in;
|
|
204
204
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
205
205
|
}
|
|
206
|
-
.nut-popup-slide-
|
|
206
|
+
.nut-popup-slide-none-exit-active {
|
|
207
207
|
animation-fill-mode: both;
|
|
208
208
|
animation-name: popup-scale-fade-out;
|
|
209
209
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
@@ -330,7 +330,7 @@
|
|
|
330
330
|
animation-name: popup-slide-left-exit;
|
|
331
331
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
332
332
|
}
|
|
333
|
-
.nut-popup-slide-
|
|
333
|
+
.nut-popup-slide-none-exit-done.nut-popup, .nut-popup-slide-center-exit-done.nut-popup, .nut-popup-slide-left-exit-done.nut-popup, .nut-popup-slide-right-exit-done.nut-popup, .nut-popup-slide-top-exit-done.nut-popup, .nut-popup-slide-bottom-exit-done.nut-popup {
|
|
334
334
|
display: none;
|
|
335
335
|
}
|
|
336
336
|
.nut-popup .nut-overflow-hidden {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
.nut-popup {
|
|
62
62
|
position: fixed;
|
|
63
|
-
min-height:
|
|
63
|
+
min-height: 26%;
|
|
64
64
|
max-height: 100%;
|
|
65
65
|
background-color: var(--nutui-overlay-content-bg-color, var(--nutui-color-background-overlay, #ffffff));
|
|
66
66
|
-webkit-overflow-scrolling: touch;
|
|
@@ -198,12 +198,12 @@
|
|
|
198
198
|
transform: scale(0.8);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
.nut-popup-slide-
|
|
201
|
+
.nut-popup-slide-none-enter-active {
|
|
202
202
|
animation-fill-mode: both;
|
|
203
203
|
animation-name: popup-scale-fade-in;
|
|
204
204
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
205
205
|
}
|
|
206
|
-
.nut-popup-slide-
|
|
206
|
+
.nut-popup-slide-none-exit-active {
|
|
207
207
|
animation-fill-mode: both;
|
|
208
208
|
animation-name: popup-scale-fade-out;
|
|
209
209
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
@@ -330,7 +330,7 @@
|
|
|
330
330
|
animation-name: popup-slide-left-exit;
|
|
331
331
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
332
332
|
}
|
|
333
|
-
.nut-popup-slide-
|
|
333
|
+
.nut-popup-slide-none-exit-done.nut-popup, .nut-popup-slide-center-exit-done.nut-popup, .nut-popup-slide-left-exit-done.nut-popup, .nut-popup-slide-right-exit-done.nut-popup, .nut-popup-slide-top-exit-done.nut-popup, .nut-popup-slide-bottom-exit-done.nut-popup {
|
|
334
334
|
display: none;
|
|
335
335
|
}
|
|
336
336
|
.nut-popup .nut-overflow-hidden {
|
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
2
|
import { TaroPopoverProps } from "../../types";
|
|
3
|
-
export interface RootPosition {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
left: number;
|
|
7
|
-
top: number;
|
|
8
|
-
right: number;
|
|
9
|
-
}
|
|
10
3
|
export declare const Popover: FunctionComponent<Partial<TaroPopoverProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'>>;
|
|
@@ -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);
|