>>1,o=e[r];if(!(void 0!==o&&0P(l,n))void 0!==u&&0>P(u,l)?(e[r]=u,e[a]=n,r=a):(e[r]=l,e[i]=n,r=i);else{if(!(void 0!==u&&0>P(u,n)))break e;e[r]=u,e[a]=n,r=a}}}return t}return null}function P(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var O=[],N=[],M=1,j=null,D=3,I=!1,R=!1,z=!1;function L(e){for(var t=C(N);null!==t;){if(null===t.callback)_(N);else{if(!(t.startTime<=e))break;_(N),t.sortIndex=t.expirationTime,S(O,t)}t=C(N)}}function F(e){if(z=!1,L(e),!R)if(null!==C(O))R=!0,r(A);else{var t=C(N);null!==t&&o(F,t.startTime-e)}}function A(e,n){R=!1,z&&(z=!1,i()),I=!0;var r=D;try{for(L(n),j=C(O);null!==j&&(!(j.expirationTime>n)||e&&!l());){var a=j.callback;if(null!==a){j.callback=null,D=j.priorityLevel;var u=a(j.expirationTime<=n);n=t.unstable_now(),"function"===typeof u?j.callback=u:j===C(O)&&_(O),L(n)}else _(O);j=C(O)}if(null!==j)var s=!0;else{var c=C(N);null!==c&&o(F,c.startTime-n),s=!1}return s}finally{j=null,D=r,I=!1}}function H(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var W=a;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){R||I||(R=!0,r(A))},t.unstable_getCurrentPriorityLevel=function(){return D},t.unstable_getFirstCallbackNode=function(){return C(O)},t.unstable_next=function(e){switch(D){case 1:case 2:case 3:var t=3;break;default:t=D}var n=D;D=t;try{return e()}finally{D=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=W,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=D;D=e;try{return t()}finally{D=n}},t.unstable_scheduleCallback=function(e,n,l){var a=t.unstable_now();if("object"===typeof l&&null!==l){var u=l.delay;u="number"===typeof u&&0a?(e.sortIndex=u,S(N,e),null===C(O)&&e===C(N)&&(z?i():z=!0,o(F,u-a))):(e.sortIndex=l,S(O,e),R||I||(R=!0,r(A))),e},t.unstable_shouldYield=function(){var e=t.unstable_now();L(e);var n=C(O);return n!==j&&null!==j&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTime1?arguments[1]:void 0)}})},function(e,t,n){var r=n(45),o=n(34),i=n(30),l=n(29),a=n(75),u=[].push,s=function(e){var t=1==e,n=2==e,s=3==e,c=4==e,f=6==e,p=5==e||f;return function(d,h,m,v){for(var y,g,b=i(d),w=o(b),x=r(h,m,3),k=l(w.length),E=0,T=v||a,S=t?T(d,k):n?T(d,0):void 0;k>E;E++)if((p||E in w)&&(g=x(y=w[E],E,b),e))if(t)S[E]=g;else if(g)switch(e){case 3:return!0;case 5:return y;case 6:return E;case 2:u.call(S,y)}else if(c)return!1;return f?-1:s||c?c:S}};e.exports={forEach:s(0),map:s(1),filter:s(2),some:s(3),every:s(4),find:s(5),findIndex:s(6)}},function(e,t,n){var r=n(13),o=n(7),i=n(10),l=Object.defineProperty,a={},u=function(e){throw e};e.exports=function(e,t){if(i(a,e))return a[e];t||(t={});var n=[][e],s=!!i(t,"ACCESSORS")&&t.ACCESSORS,c=i(t,0)?t[0]:u,f=i(t,1)?t[1]:void 0;return a[e]=!!n&&!o((function(){if(s&&!r)return!0;var e={length:-1};s?l(e,1,{enumerable:!0,get:u}):e[1]=1,n.call(e,c,f)}))}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}},function(e,t){function n(t){return"function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){"use strict";var r=n(130);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,l){if(l!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}]]);
\ No newline at end of file
diff --git a/docs/static/js/index.4ca12b27.chunk.js b/docs/static/js/index.4ca12b27.chunk.js
new file mode 100644
index 0000000..b350715
--- /dev/null
+++ b/docs/static/js/index.4ca12b27.chunk.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{120:function(e,t,n){},121:function(e,t,n){},122:function(e,t,n){},131:function(e,t,n){"use strict";n.r(t);var r=n(0),a=n.n(r),o=n(3),i=n.n(o),l=(n(120),n(121),n(122),n(47),n(124),n(2)),c=n.n(l),p=n(8),s=n.n(p),f=n(1),u=n.n(f),m=n(9),d=n.n(m),v=n(19),g=n.n(v),b=n(49),h=n(21),E=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;of)o.style.left="50%";else{var d=m.left+p/2-o.offsetWidth/2;Object(h.a)(o,{left:d})}else if(s>u)o.style.top="50%";else{var v=m.top+s/2-o.offsetHeight/2;Object(h.a)(o,{top:v})}t.feedback=null}}}})),u()(c()(t),"saveFeedback",(function(e,n,r){t.feedback=r})),u()(c()(t),"getPopup",(function(){var e=t.props,n=e.prefixCls,r=e.title,o=e.visibleArrow,i=e.role,l="function"===typeof r?r():r;return a.a.createElement(a.a.Fragment,null,o?a.a.createElement("div",{className:n+"-arrow",ref:t.arrowRef}):null,a.a.createElement("div",{className:n+"-inner",role:i},l))})),t}s()(t,e);var n=t.prototype;return n.componentDidMount=function(){this.componentDidUpdate()},n.componentDidUpdate=function(){this.adjustArrowPosition()},n.render=function(){var e=this.props,t=(e.title,e.visible),n=e.defaultVisible,r=e.trigger,o=e.arrowSize,i=e.offset,l=e.visibleArrow,c=(e.keepArrowAtCenter,e.destroyTooltipOnHide),p=e.transition,s=(e.role,g()(e,["title","visible","defaultVisible","trigger","arrowSize","offset","visibleArrow","keepArrowAtCenter","destroyTooltipOnHide","transition","role"]));return a.a.createElement(b.a,d()({},s,{ref:this.triggerRef,popupTransition:p,action:r,adjustPosition:this.saveFeedback,offset:l?i+o:i,destroyPopupOnHide:c,defaultPopupVisible:n,popupVisible:t,popup:this.getPopup}))},t}(a.a.Component);u()(E,"defaultProps",{prefixCls:"rw-tooltip",placement:"top",defaultVisible:!1,visibleArrow:!0,keepArrowAtCenter:!1,destroyTooltipOnHide:!0,arrowSize:6,offset:0,delay:100,trigger:["hover"],outsideHideEventName:["mousedown","click"],transition:{classNames:{appear:"tooltip-animated",appearActive:"tooltip-fade-in",appearDone:"",enter:"tooltip-animated",enterActive:"tooltip-fade-in",enterDone:"",exit:"tooltip-animated",exitActive:"tooltip-fade-out",exitDone:""},timeout:290},role:"tooltip"});var w=E;function y(e){var t=e.text,n=g()(e,["text"]);return a.a.createElement(w,d()({title:"Title----111itle----111itle----111"},n),a.a.createElement("button",null,t||n.placement))}var A=[{label:"\u57fa\u672c\u529f\u80fd",component:function(e){function t(){for(var t,n=arguments.length,r=new Array(n),a=0;a {
+ /** 提示文字 */
title?: React.ReactNode | (() => React.ReactNode);
+ /** 提示框位置,可选 top left right bottom topLeft topRight bottomLeft bottomRight leftTop leftBottom rightTop rightBottom */
+ placement?: TriggerProps["placement"];
+ /** 默认是否显隐 */
defaultVisible?: boolean;
+ /** 用于手动控制浮层显隐,受控 */
visible?: boolean;
// TODO:
// color?: string;
-
+ /** 触发行为,可选 "click" | "contextMenu" | "focus" | "hover" 可使用数组设置多个触发行为 */
trigger?: TriggerProps["action"];
-
+ /** 提示框偏移量 */
offset?: number;
-
+ /** 是否显示提示箭头 */
visibleArrow?: boolean;
+ /** 箭头大小,默认为:6 */
arrowSize?: number;
+ /** 箭头保持在中间 */
keepArrowAtCenter?: boolean;
+ /** 关闭后是否销毁 */
destroyTooltipOnHide?: boolean;
-
+ /** 提示动画,参考 react-transition-group*/
transition?: TriggerProps["popupTransition"];
-
+ /** 显示隐藏的回调 */
onVisibleChange?: (visible: boolean) => void;
-
role?: string;
}
@@ -40,6 +48,7 @@ export interface TooltipState {}
export class Tooltip extends React.Component {
static defaultProps: TooltipProps = {
prefixCls: "rw-tooltip",
+ placement: "top",
defaultVisible: false,
visibleArrow: true,
keepArrowAtCenter: false,
@@ -62,6 +71,13 @@ export class Tooltip extends React.Component {
exitDone: "",
},
timeout: 290,
+ // addEndListener(node: HTMLElement, cb: () => void) {
+ // const next = () => {
+ // node.removeEventListener("animationend", next);
+ // cb();
+ // };
+ // node.addEventListener("animationend", next);
+ // },
},
role: "tooltip",
};
diff --git a/style/package.json b/style/package.json
index 045a01f..833cb69 100644
--- a/style/package.json
+++ b/style/package.json
@@ -1,5 +1,5 @@
{
- "name": "react-widget-popover/style",
+ "name": "react-widget-tooltip/style",
"private": true,
"main": "../cjs/style/index.js",
"module": "../esm/style/index.js"