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