@nutui/nutui-react 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/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 +46 -44
- package/dist/cjs/packages/collapseitem/style/collapseitem.scss +22 -5
- package/dist/cjs/packages/collapseitem/style/style.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/confirm.d.ts +2 -3
- package/dist/cjs/packages/dialog/confirm.js +4 -18
- package/dist/cjs/packages/dialog/content.d.ts +11 -3
- package/dist/cjs/packages/dialog/dialog.d.ts +1 -1
- package/dist/cjs/packages/dialog/dialog.js +98 -69
- 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.js +72 -65
- package/dist/cjs/packages/popover/style/popover.scss +48 -51
- package/dist/cjs/packages/popover/style/style.css +64 -70
- package/dist/cjs/packages/popup/style/popup.scss +4 -4
- package/dist/cjs/packages/popup/style/style.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/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/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 +47 -45
- package/dist/es/packages/collapseitem/style/collapseitem.scss +22 -5
- package/dist/es/packages/collapseitem/style/style.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/confirm.d.ts +2 -3
- package/dist/es/packages/dialog/confirm.js +1 -8
- package/dist/es/packages/dialog/content.d.ts +11 -3
- package/dist/es/packages/dialog/dialog.d.ts +1 -1
- package/dist/es/packages/dialog/dialog.js +98 -69
- 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.js +72 -65
- package/dist/es/packages/popover/style/popover.scss +48 -51
- package/dist/es/packages/popover/style/style.css +64 -70
- package/dist/es/packages/popup/style/popup.scss +4 -4
- package/dist/es/packages/popup/style/style.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/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 +227 -249
- package/dist/style.css +1 -1
- package/dist/style.scss +42 -42
- 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/dialogwrap.d.ts +0 -4
- package/dist/cjs/packages/dialog/dialogwrap.js +0 -79
- package/dist/cjs/packages/dialog/types.d.ts +0 -57
- package/dist/cjs/packages/dialog/types.js +0 -11
- package/dist/es/packages/dialog/dialogwrap.d.ts +0 -4
- package/dist/es/packages/dialog/dialogwrap.js +0 -60
- package/dist/es/packages/dialog/types.d.ts +0 -57
- package/dist/es/packages/dialog/types.js +0 -1
|
@@ -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 {
|
|
@@ -71,12 +71,12 @@ var Popover = function Popover(props) {
|
|
|
71
71
|
var popoverRef = (0, _react.useRef)(null);
|
|
72
72
|
var popoverContentRef = (0, _react.useRef)(null);
|
|
73
73
|
var _useState = (0, _sliced_to_array._)((0, _react.useState)(false), 2), showPopup = _useState[0], setShowPopup = _useState[1];
|
|
74
|
-
var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(), 2),
|
|
74
|
+
var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(), 2), wrapperPosition = _useState1[0], setWrapperPosition = _useState1[1];
|
|
75
75
|
(0, _react.useEffect)(function() {
|
|
76
76
|
setShowPopup(visible);
|
|
77
77
|
if (visible) {
|
|
78
78
|
setTimeout(function() {
|
|
79
|
-
|
|
79
|
+
getWrapperPosition();
|
|
80
80
|
}, 0);
|
|
81
81
|
}
|
|
82
82
|
}, [
|
|
@@ -84,25 +84,10 @@ var Popover = function Popover(props) {
|
|
|
84
84
|
location
|
|
85
85
|
]);
|
|
86
86
|
var update = (0, _react.useRef)(function(e) {
|
|
87
|
-
|
|
87
|
+
getWrapperPosition();
|
|
88
88
|
});
|
|
89
|
-
(0, _react.useEffect)(function() {
|
|
90
|
-
if (visible) {
|
|
91
|
-
scrollableParents.forEach(function(parent) {
|
|
92
|
-
parent.addEventListener('scroll', update.current, {
|
|
93
|
-
passive: true
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
} else {
|
|
97
|
-
scrollableParents.forEach(function(parent) {
|
|
98
|
-
return parent.removeEventListener('scroll', update.current);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}, [
|
|
102
|
-
visible
|
|
103
|
-
]);
|
|
104
|
-
var element = null;
|
|
105
89
|
var targetSet = [];
|
|
90
|
+
var element = null;
|
|
106
91
|
if (_canusedom.canUseDom && targetId) {
|
|
107
92
|
element = document.querySelector("#".concat(targetId));
|
|
108
93
|
targetSet = [
|
|
@@ -115,39 +100,59 @@ var Popover = function Popover(props) {
|
|
|
115
100
|
popoverContentRef.current
|
|
116
101
|
];
|
|
117
102
|
}
|
|
118
|
-
(0, _useclickaway.default)(function() {
|
|
119
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
120
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
121
|
-
}, targetSet, 'touchstart', true, visible, closeOnOutsideClick);
|
|
122
103
|
var scrollableParents = (0, _react.useMemo)(function() {
|
|
123
104
|
return (0, _getscrollparent.getAllScrollableParents)(element || popoverRef.current);
|
|
124
105
|
}, [
|
|
125
106
|
element,
|
|
126
107
|
popoverRef.current
|
|
127
108
|
]);
|
|
128
|
-
|
|
109
|
+
(0, _react.useEffect)(function() {
|
|
110
|
+
if (visible) {
|
|
111
|
+
scrollableParents.forEach(function(parent) {
|
|
112
|
+
parent.addEventListener('scroll', update.current, {
|
|
113
|
+
passive: true
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
} else {
|
|
117
|
+
scrollableParents.forEach(function(parent) {
|
|
118
|
+
return parent.removeEventListener('scroll', update.current);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}, [
|
|
122
|
+
visible
|
|
123
|
+
]);
|
|
124
|
+
(0, _useclickaway.default)(function() {
|
|
125
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
126
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
127
|
+
}, targetSet, 'touchstart', true, visible, closeOnOutsideClick);
|
|
128
|
+
var getWrapperPosition = function getWrapperPosition() {
|
|
129
129
|
var rect = (0, _useclientrect.getRect)(targetId ? document.querySelector("#".concat(targetId)) : popoverRef.current);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
var distance = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
|
|
131
|
+
var width = rect.width, height = rect.height, right = rect.right, left = rect.left, top = rect.top;
|
|
132
|
+
setWrapperPosition({
|
|
133
|
+
width: width,
|
|
134
|
+
height: height,
|
|
135
|
+
left: rtl ? right : left,
|
|
136
|
+
top: top + distance,
|
|
137
|
+
right: rtl ? left : right
|
|
136
138
|
});
|
|
137
139
|
};
|
|
138
|
-
var
|
|
139
|
-
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);
|
|
140
|
+
var classes = (0, _classnames.default)(classPrefix, (0, _define_property._)({}, "".concat(classPrefix, "-").concat(theme), theme === 'dark'), className);
|
|
140
141
|
var popoverArrow = function popoverArrow() {
|
|
141
142
|
var prefixCls = 'nut-popover-arrow';
|
|
142
|
-
|
|
143
|
+
var direction = location.split('-')[0];
|
|
144
|
+
return "".concat(prefixCls, " ").concat(prefixCls, "-").concat(direction, " ").concat(prefixCls, "-").concat(location);
|
|
143
145
|
};
|
|
144
|
-
var
|
|
146
|
+
var getPopoverPosition = function getPopoverPosition() {
|
|
145
147
|
var _popoverContentRef_current, _popoverContentRef_current1;
|
|
146
148
|
var styles = {};
|
|
147
|
-
if (!
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
if (!wrapperPosition) {
|
|
150
|
+
styles.visibility = 'hidden';
|
|
151
|
+
return styles;
|
|
152
|
+
}
|
|
153
|
+
var popWidth = (_popoverContentRef_current = popoverContentRef.current) === null || _popoverContentRef_current === void 0 ? void 0 : _popoverContentRef_current.clientWidth;
|
|
154
|
+
var popHeight = (_popoverContentRef_current1 = popoverContentRef.current) === null || _popoverContentRef_current1 === void 0 ? void 0 : _popoverContentRef_current1.clientHeight;
|
|
155
|
+
var width = wrapperPosition.width, height = wrapperPosition.height, left = wrapperPosition.left, top = wrapperPosition.top, right = wrapperPosition.right;
|
|
151
156
|
var direction = location.split('-')[0];
|
|
152
157
|
var skew = location.split('-')[1];
|
|
153
158
|
var cross = 0;
|
|
@@ -163,15 +168,15 @@ var Popover = function Popover(props) {
|
|
|
163
168
|
'bottom',
|
|
164
169
|
'top'
|
|
165
170
|
].includes(direction)) {
|
|
166
|
-
var h = direction === 'bottom' ? height + cross : -(
|
|
171
|
+
var h = direction === 'bottom' ? height + cross : -(popHeight + cross);
|
|
167
172
|
styles.top = "".concat(top + h, "px");
|
|
168
173
|
if (!skew) {
|
|
169
|
-
styles[dir] = "".concat(-(
|
|
174
|
+
styles[dir] = "".concat(-(popWidth - width) / 2 + wrapperPosition[dir] + parallel, "px");
|
|
170
175
|
}
|
|
171
|
-
if (skew === '
|
|
176
|
+
if (skew === 'left') {
|
|
172
177
|
styles.left = "".concat(left + parallel, "px");
|
|
173
178
|
}
|
|
174
|
-
if (skew === '
|
|
179
|
+
if (skew === 'right') {
|
|
175
180
|
styles.left = "".concat(right + parallel, "px");
|
|
176
181
|
}
|
|
177
182
|
}
|
|
@@ -179,22 +184,23 @@ var Popover = function Popover(props) {
|
|
|
179
184
|
'left',
|
|
180
185
|
'right'
|
|
181
186
|
].includes(direction)) {
|
|
182
|
-
var contentW = direction === 'left' ? -(
|
|
187
|
+
var contentW = direction === 'left' ? -(popWidth + cross) : width + cross;
|
|
183
188
|
styles.left = "".concat(left + contentW, "px");
|
|
184
189
|
if (!skew) {
|
|
185
|
-
styles.top = "".concat(top -
|
|
190
|
+
styles.top = "".concat(top - popHeight / 2 + height / 2 - 4 + parallel, "px");
|
|
186
191
|
}
|
|
187
|
-
if (skew === '
|
|
192
|
+
if (skew === 'top') {
|
|
188
193
|
styles.top = "".concat(top + parallel, "px");
|
|
189
194
|
}
|
|
190
|
-
if (skew === '
|
|
195
|
+
if (skew === 'bottom') {
|
|
191
196
|
styles.top = "".concat(top + height + parallel, "px");
|
|
192
197
|
}
|
|
193
198
|
}
|
|
194
199
|
}
|
|
200
|
+
styles.visibility = popWidth === 0 ? 'hidden' : 'initial';
|
|
195
201
|
return styles;
|
|
196
202
|
};
|
|
197
|
-
var
|
|
203
|
+
var popoverArrowStyle = function popoverArrowStyle() {
|
|
198
204
|
var styles = {};
|
|
199
205
|
var direction = location.split('-')[0];
|
|
200
206
|
var skew = location.split('-')[1];
|
|
@@ -209,10 +215,10 @@ var Popover = function Popover(props) {
|
|
|
209
215
|
if (!skew) {
|
|
210
216
|
styles[dir] = "calc(50% + ".concat(arrowOffset, "px)");
|
|
211
217
|
}
|
|
212
|
-
if (skew === '
|
|
218
|
+
if (skew === 'left') {
|
|
213
219
|
styles[dir] = "".concat(base + arrowOffset, "px");
|
|
214
220
|
}
|
|
215
|
-
if (skew === '
|
|
221
|
+
if (skew === 'right') {
|
|
216
222
|
styles[dir2] = "".concat(base - arrowOffset, "px");
|
|
217
223
|
}
|
|
218
224
|
}
|
|
@@ -223,10 +229,10 @@ var Popover = function Popover(props) {
|
|
|
223
229
|
if (!skew) {
|
|
224
230
|
styles.top = "calc(50% - ".concat(arrowOffset, "px)");
|
|
225
231
|
}
|
|
226
|
-
if (skew === '
|
|
232
|
+
if (skew === 'top') {
|
|
227
233
|
styles.top = "".concat(base - arrowOffset, "px");
|
|
228
234
|
}
|
|
229
|
-
if (skew === '
|
|
235
|
+
if (skew === 'bottom') {
|
|
230
236
|
styles.bottom = "".concat(base + arrowOffset, "px");
|
|
231
237
|
}
|
|
232
238
|
}
|
|
@@ -235,28 +241,28 @@ var Popover = function Popover(props) {
|
|
|
235
241
|
};
|
|
236
242
|
var handleSelect = function handleSelect(item, index) {
|
|
237
243
|
if (!item.disabled) {
|
|
238
|
-
onSelect
|
|
244
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(item, index);
|
|
239
245
|
}
|
|
240
246
|
if (closeOnActionClick) {
|
|
241
|
-
onClick
|
|
242
|
-
onClose
|
|
247
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
248
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
243
249
|
}
|
|
244
250
|
};
|
|
245
251
|
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, !targetId && /*#__PURE__*/ _react.default.createElement("div", {
|
|
246
252
|
className: "nut-popover-wrapper",
|
|
247
253
|
ref: popoverRef,
|
|
248
254
|
onClick: function onClick1() {
|
|
249
|
-
onClick
|
|
255
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
250
256
|
if (!visible) {
|
|
251
|
-
onOpen
|
|
257
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
252
258
|
} else {
|
|
253
|
-
onClose
|
|
259
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
254
260
|
}
|
|
255
261
|
},
|
|
256
262
|
style: style
|
|
257
263
|
}, Array.isArray(children) ? children[0] : children), /*#__PURE__*/ (0, _reactdom.createPortal)(/*#__PURE__*/ _react.default.createElement("div", {
|
|
258
264
|
className: classes,
|
|
259
|
-
style:
|
|
265
|
+
style: (0, _object_spread._)({}, getPopoverPosition(), style)
|
|
260
266
|
}, /*#__PURE__*/ _react.default.createElement(_index.default, (0, _object_spread._)({
|
|
261
267
|
className: "nut-popover-content nut-popover-content-".concat(location),
|
|
262
268
|
visible: showPopup,
|
|
@@ -268,26 +274,27 @@ var Popover = function Popover(props) {
|
|
|
268
274
|
ref: popoverContentRef
|
|
269
275
|
}, showArrow && /*#__PURE__*/ _react.default.createElement("div", {
|
|
270
276
|
className: popoverArrow(),
|
|
271
|
-
style:
|
|
277
|
+
style: popoverArrowStyle()
|
|
272
278
|
}, /*#__PURE__*/ _react.default.createElement(_iconsreact.ArrowRadius, {
|
|
273
279
|
width: 8,
|
|
274
280
|
height: 4
|
|
275
281
|
})), Array.isArray(children) ? children[1] : null, list.map(function(item, index) {
|
|
282
|
+
var _item_action;
|
|
276
283
|
return /*#__PURE__*/ _react.default.createElement("div", {
|
|
277
284
|
className: (0, _classnames.default)({
|
|
278
|
-
'nut-popover-
|
|
279
|
-
'nut-popover-
|
|
285
|
+
'nut-popover-item': true,
|
|
286
|
+
'nut-popover-item-disabled': item.disabled
|
|
280
287
|
}, item.className),
|
|
281
288
|
key: item.key || index,
|
|
282
289
|
onClick: function onClick() {
|
|
283
290
|
return handleSelect(item, index);
|
|
284
291
|
}
|
|
285
292
|
}, item.icon && /*#__PURE__*/ _react.default.createElement("div", {
|
|
286
|
-
className: "nut-popover-
|
|
293
|
+
className: "nut-popover-item-icon"
|
|
287
294
|
}, item.icon), /*#__PURE__*/ _react.default.createElement("div", {
|
|
288
|
-
className: "nut-popover-
|
|
289
|
-
}, item.name), item.action
|
|
290
|
-
className: "nut-popover-
|
|
295
|
+
className: "nut-popover-item-name"
|
|
296
|
+
}, item.name), ((_item_action = item.action) === null || _item_action === void 0 ? void 0 : _item_action.icon) && /*#__PURE__*/ _react.default.createElement("div", {
|
|
297
|
+
className: "nut-popover-item-action-icon",
|
|
291
298
|
onClick: function onClick(e) {
|
|
292
299
|
var _item_action_onClick, _item_action;
|
|
293
300
|
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
|
}
|