@rc-component/trigger 2.0.0 → 2.1.0
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/es/index.d.ts +1 -0
- package/es/index.js +5 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +5 -0
- package/package.json +1 -1
package/es/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { ActionType, AlignType, AnimationType, ArrowTypeOuter, BuildInPlace
|
|
|
4
4
|
export type { ActionType, AlignType, ArrowTypeOuter as ArrowType, BuildInPlacements, };
|
|
5
5
|
export interface TriggerRef {
|
|
6
6
|
nativeElement: HTMLElement;
|
|
7
|
+
popupElement: HTMLElement;
|
|
7
8
|
forceAlign: VoidFunction;
|
|
8
9
|
}
|
|
9
10
|
export interface TriggerProps {
|
package/es/index.js
CHANGED
|
@@ -106,7 +106,11 @@ export function generateTrigger() {
|
|
|
106
106
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
107
107
|
popupEle = _React$useState4[0],
|
|
108
108
|
setPopupEle = _React$useState4[1];
|
|
109
|
+
|
|
110
|
+
// Used for forwardRef popup. Not use internal
|
|
111
|
+
var externalPopupRef = React.useRef(null);
|
|
109
112
|
var setPopupRef = useEvent(function (node) {
|
|
113
|
+
externalPopupRef.current = node;
|
|
110
114
|
if (isDOM(node) && popupEle !== node) {
|
|
111
115
|
setPopupEle(node);
|
|
112
116
|
}
|
|
@@ -272,6 +276,7 @@ export function generateTrigger() {
|
|
|
272
276
|
React.useImperativeHandle(ref, function () {
|
|
273
277
|
return {
|
|
274
278
|
nativeElement: externalForwardRef.current,
|
|
279
|
+
popupElement: externalPopupRef.current,
|
|
275
280
|
forceAlign: triggerAlign
|
|
276
281
|
};
|
|
277
282
|
});
|
package/lib/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { ActionType, AlignType, AnimationType, ArrowTypeOuter, BuildInPlace
|
|
|
4
4
|
export type { ActionType, AlignType, ArrowTypeOuter as ArrowType, BuildInPlacements, };
|
|
5
5
|
export interface TriggerRef {
|
|
6
6
|
nativeElement: HTMLElement;
|
|
7
|
+
popupElement: HTMLElement;
|
|
7
8
|
forceAlign: VoidFunction;
|
|
8
9
|
}
|
|
9
10
|
export interface TriggerProps {
|
package/lib/index.js
CHANGED
|
@@ -114,7 +114,11 @@ function generateTrigger() {
|
|
|
114
114
|
_React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
|
|
115
115
|
popupEle = _React$useState4[0],
|
|
116
116
|
setPopupEle = _React$useState4[1];
|
|
117
|
+
|
|
118
|
+
// Used for forwardRef popup. Not use internal
|
|
119
|
+
var externalPopupRef = React.useRef(null);
|
|
117
120
|
var setPopupRef = (0, _useEvent.default)(function (node) {
|
|
121
|
+
externalPopupRef.current = node;
|
|
118
122
|
if ((0, _findDOMNode.isDOM)(node) && popupEle !== node) {
|
|
119
123
|
setPopupEle(node);
|
|
120
124
|
}
|
|
@@ -280,6 +284,7 @@ function generateTrigger() {
|
|
|
280
284
|
React.useImperativeHandle(ref, function () {
|
|
281
285
|
return {
|
|
282
286
|
nativeElement: externalForwardRef.current,
|
|
287
|
+
popupElement: externalPopupRef.current,
|
|
283
288
|
forceAlign: triggerAlign
|
|
284
289
|
};
|
|
285
290
|
});
|