victory-brush-container 37.3.0 → 37.3.2
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
CHANGED
|
@@ -287,7 +287,6 @@ const Helpers = {
|
|
|
287
287
|
return xMoved || yMoved;
|
|
288
288
|
}
|
|
289
289
|
},
|
|
290
|
-
// eslint-disable-next-line max-statements, complexity
|
|
291
290
|
onMouseDown(evt, targetProps) {
|
|
292
291
|
evt.preventDefault();
|
|
293
292
|
const {
|
|
@@ -380,7 +379,6 @@ const Helpers = {
|
|
|
380
379
|
})
|
|
381
380
|
}] : {};
|
|
382
381
|
},
|
|
383
|
-
// eslint-disable-next-line max-statements, complexity
|
|
384
382
|
onGlobalMouseMove(evt, targetProps) {
|
|
385
383
|
const {
|
|
386
384
|
scale,
|
|
@@ -467,13 +465,11 @@ const Helpers = {
|
|
|
467
465
|
}
|
|
468
466
|
return {};
|
|
469
467
|
},
|
|
470
|
-
// eslint-disable-next-line complexity
|
|
471
468
|
onGlobalMouseUp(evt, targetProps) {
|
|
472
469
|
// if a panning or selection has not been started, ignore the event
|
|
473
470
|
if (!targetProps.isPanning && !targetProps.isSelecting) {
|
|
474
471
|
return {};
|
|
475
472
|
}
|
|
476
|
-
// eslint-disable-line max-statements, complexity
|
|
477
473
|
const {
|
|
478
474
|
x1,
|
|
479
475
|
y1,
|
|
@@ -2969,9 +2965,9 @@ const VictoryContainer = initialProps => {
|
|
|
2969
2965
|
...style,
|
|
2970
2966
|
width: responsive ? style?.width : dimensions.width,
|
|
2971
2967
|
height: responsive ? style?.height : dimensions.height,
|
|
2972
|
-
pointerEvents: "none",
|
|
2973
|
-
touchAction: "none",
|
|
2974
|
-
position: "relative"
|
|
2968
|
+
pointerEvents: style?.pointerEvents ?? "none",
|
|
2969
|
+
touchAction: style?.touchAction ?? "none",
|
|
2970
|
+
position: style?.position ?? "relative"
|
|
2975
2971
|
},
|
|
2976
2972
|
"data-ouia-component-id": ouiaId,
|
|
2977
2973
|
"data-ouia-component-type": ouiaType,
|
|
@@ -3285,7 +3281,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3285
3281
|
|
|
3286
3282
|
|
|
3287
3283
|
|
|
3288
|
-
/* eslint-disable no-use-before-define */
|
|
3289
3284
|
|
|
3290
3285
|
// Private Functions
|
|
3291
3286
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):"object"==typeof exports?exports.VictoryBrushContainer=n(require("react")):t.VictoryBrushContainer=n(t.React)}(self,(function(t){return function(){var n={2596:function(t,n,e){var r=e(2373).Symbol;t.exports=r},6082:function(t){t.exports=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}},8644:function(t){t.exports=function(t,n){for(var e=-1,r=null==t?0:t.length,o=Array(r);++e<r;)o[e]=n(t[e],e,t);return o}},9559:function(t){t.exports=function(t,n){for(var e=-1,r=n.length,o=t.length;++e<r;)t[o+e]=n[e];return t}},4132:function(t,n,e){var r=e(8347),o=e(788),i=Object.prototype.hasOwnProperty;t.exports=function(t,n,e){var a=t[n];i.call(t,n)&&o(a,e)&&(void 0!==e||n in t)||r(t,n,e)}},8347:function(t,n,e){var r=e(5525);t.exports=function(t,n,e){"__proto__"==n&&r?r(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e}},6457:function(t,n,e){var r=e(9559),o=e(3608);t.exports=function t(n,e,i,a,u){var s=-1,c=n.length;for(i||(i=o),u||(u=[]);++s<c;){var l=n[s];e>0&&i(l)?e>1?t(l,e-1,i,a,u):r(u,l):a||(u[u.length]=l)}return u}},4432:function(t,n,e){var r=e(9026),o=e(3110);t.exports=function(t,n){for(var e=0,i=(n=r(n,t)).length;null!=t&&e<i;)t=t[o(n[e++])];return e&&e==i?t:void 0}},6776:function(t){t.exports=function(t,n){return null!=t&&n in Object(t)}},5436:function(t,n,e){var r=e(6371),o=e(5066);t.exports=function(t,n){return r(t,n,(function(n,e){return o(t,e)}))}},6371:function(t,n,e){var r=e(4432),o=e(6539),i=e(9026);t.exports=function(t,n,e){for(var a=-1,u=n.length,s={};++a<u;){var c=n[a],l=r(t,c);e(l,c)&&o(s,i(c,t),l)}return s}},1600:function(t){t.exports=function(t){return function(n){return null==n?void 0:n[t]}}},3301:function(t,n,e){var r=e(4432);t.exports=function(t){return function(n){return r(n,t)}}},6317:function(t,n,e){var r=e(5346),o=e(4280),i=e(201);t.exports=function(t,n){return i(o(t,n,r),t+"")}},6539:function(t,n,e){var r=e(4132),o=e(9026),i=e(9099),a=e(7709),u=e(3110);t.exports=function(t,n,e,s){if(!a(t))return t;for(var c=-1,l=(n=o(n,t)).length,f=l-1,h=t;null!=h&&++c<l;){var x=u(n[c]),y=e;if("__proto__"===x||"constructor"===x||"prototype"===x)return t;if(c!=f){var p=h[x];void 0===(y=s?s(p,x,h):void 0)&&(y=a(p)?p:i(n[c+1])?[]:{})}r(h,x,y),h=h[x]}return t}},6316:function(t,n,e){var r=e(2596),o=e(8644),i=e(163),a=e(1995),u=r?r.prototype:void 0,s=u?u.toString:void 0;t.exports=function t(n){if("string"==typeof n)return n;if(i(n))return o(n,t)+"";if(a(n))return s?s.call(n):"";var e=n+"";return"0"==e&&1/n==-1/0?"-0":e}},9026:function(t,n,e){var r=e(163),o=e(726),i=e(7801),a=e(7010);t.exports=function(t,n){return r(t)?t:o(t,n)?[t]:i(a(t))}},5525:function(t,n,e){var r=e(3743),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},5557:function(t,n,e){var r=e(2645),o=e(4280),i=e(201);t.exports=function(t){return i(o(t,void 0,r),t+"")}},2117:function(t,n,e){var r="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=r},3743:function(t){t.exports=function(t,n){return null==t?void 0:t[n]}},3096:function(t,n,e){var r=e(9026),o=e(5075),i=e(163),a=e(9099),u=e(8454),s=e(3110);t.exports=function(t,n,e){for(var c=-1,l=(n=r(n,t)).length,f=!1;++c<l;){var h=s(n[c]);if(!(f=null!=t&&e(t,h)))break;t=t[h]}return f||++c!=l?f:!!(l=null==t?0:t.length)&&u(l)&&a(h,l)&&(i(t)||o(t))}},3608:function(t,n,e){var r=e(2596),o=e(5075),i=e(163),a=r?r.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(a&&t&&t[a])}},9099:function(t){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t<e}},8286:function(t){t.exports=function(){return!1}},726:function(t,n,e){var r=e(163),o=e(1995),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,n){if(r(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!o(t))||a.test(t)||!i.test(t)||null!=n&&t in Object(n)}},2453:function(t){t.exports=function(t){return t}},4280:function(t,n,e){var r=e(6082),o=Math.max;t.exports=function(t,n,e){return n=o(void 0===n?t.length-1:n,0),function(){for(var i=arguments,a=-1,u=o(i.length-n,0),s=Array(u);++a<u;)s[a]=i[n+a];a=-1;for(var c=Array(n+1);++a<n;)c[a]=i[a];return c[n]=e(s),r(t,this,c)}}},2373:function(t,n,e){var r=e(2117),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},201:function(t){t.exports=function(t){return t}},7801:function(t,n,e){var r=e(2453),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,a=r((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(o,(function(t,e,r,o){n.push(r?o.replace(i,"$1"):e||t)})),n}));t.exports=a},3110:function(t,n,e){var r=e(1995);t.exports=function(t){if("string"==typeof t||r(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},5034:function(t,n,e){var r=e(7709),o=e(6987),i=e(5812),a=Math.max,u=Math.min;t.exports=function(t,n,e){var s,c,l,f,h,x,y=0,p=!1,d=!1,m=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function v(n){var e=s,r=c;return s=c=void 0,y=n,f=t.apply(r,e)}function g(t){return y=t,h=setTimeout(M,n),p?v(t):f}function b(t){var e=t-x;return void 0===x||e>=n||e<0||d&&t-y>=l}function M(){var t=o();if(b(t))return w(t);h=setTimeout(M,function(t){var e=n-(t-x);return d?u(e,l-(t-y)):e}(t))}function w(t){return h=void 0,m&&s?v(t):(s=c=void 0,f)}function D(){var t=o(),e=b(t);if(s=arguments,c=this,x=t,e){if(void 0===h)return g(x);if(d)return clearTimeout(h),h=setTimeout(M,n),v(x)}return void 0===h&&(h=setTimeout(M,n)),f}return n=i(n)||0,r(e)&&(p=!!e.leading,l=(d="maxWait"in e)?a(i(e.maxWait)||0,n):l,m="trailing"in e?!!e.trailing:m),D.cancel=function(){void 0!==h&&clearTimeout(h),y=0,s=x=c=h=void 0},D.flush=function(){return void 0===h?f:w(o())},D}},1893:function(t,n,e){var r=e(6317),o=e(788),i=e(8286),a=e(8855),u=Object.prototype,s=u.hasOwnProperty,c=r((function(t,n){t=Object(t);var e=-1,r=n.length,c=r>2?n[2]:void 0;for(c&&i(n[0],n[1],c)&&(r=1);++e<r;)for(var l=n[e],f=a(l),h=-1,x=f.length;++h<x;){var y=f[h],p=t[y];(void 0===p||o(p,u[y])&&!s.call(t,y))&&(t[y]=l[y])}return t}));t.exports=c},788:function(t){t.exports=function(t,n){return t===n||t!=t&&n!=n}},2645:function(t,n,e){var r=e(6457);t.exports=function(t){return null!=t&&t.length?r(t,1):[]}},5066:function(t,n,e){var r=e(6776),o=e(3096);t.exports=function(t,n){return null!=t&&o(t,n,r)}},5346:function(t){t.exports=function(t){return t}},5075:function(t){t.exports=function(){return!1}},163:function(t){var n=Array.isArray;t.exports=n},8454:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},7709:function(t){t.exports=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},1995:function(t){t.exports=function(){return!1}},8855:function(t){t.exports=function(t){var n=[];if(null!=t)for(var e in Object(t))n.push(e);return n}},6987:function(t,n,e){var r=e(2373);t.exports=function(){return r.Date.now()}},9082:function(t,n,e){var r=e(5436),o=e(5557)((function(t,n){return null==t?{}:r(t,n)}));t.exports=o},8532:function(t,n,e){var r=e(1600),o=e(3301),i=e(726),a=e(3110);t.exports=function(t){return i(t)?r(a(t)):o(t)}},8163:function(t,n,e){var r=e(5034),o=e(7709);t.exports=function(t,n,e){var i=!0,a=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return o(e)&&(i="leading"in e?!!e.leading:i,a="trailing"in e?!!e.trailing:a),r(t,n,{leading:i,maxWait:n,trailing:a})}},5812:function(t){t.exports=function(t){return t}},7010:function(t,n,e){var r=e(6316);t.exports=function(t){return null==t?"":r(t)}},660:function(t,n,e){var r=e(7010),o=0;t.exports=function(t){var n=++o;return r(t)+n}},7491:function(t){var n="undefined"!=typeof Element,e="function"==typeof Map,r="function"==typeof Set,o="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function i(t,a){if(t===a)return!0;if(t&&a&&"object"==typeof t&&"object"==typeof a){if(t.constructor!==a.constructor)return!1;var u,s,c,l;if(Array.isArray(t)){if((u=t.length)!=a.length)return!1;for(s=u;0!=s--;)if(!i(t[s],a[s]))return!1;return!0}if(e&&t instanceof Map&&a instanceof Map){if(t.size!==a.size)return!1;for(l=t.entries();!(s=l.next()).done;)if(!a.has(s.value[0]))return!1;for(l=t.entries();!(s=l.next()).done;)if(!i(s.value[1],a.get(s.value[0])))return!1;return!0}if(r&&t instanceof Set&&a instanceof Set){if(t.size!==a.size)return!1;for(l=t.entries();!(s=l.next()).done;)if(!a.has(s.value[0]))return!1;return!0}if(o&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(a)){if((u=t.length)!=a.length)return!1;for(s=u;0!=s--;)if(t[s]!==a[s])return!1;return!0}if(t.constructor===RegExp)return t.source===a.source&&t.flags===a.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===a.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===a.toString();if((u=(c=Object.keys(t)).length)!==Object.keys(a).length)return!1;for(s=u;0!=s--;)if(!Object.prototype.hasOwnProperty.call(a,c[s]))return!1;if(n&&t instanceof Element)return!1;for(s=u;0!=s--;)if(("_owner"!==c[s]&&"__v"!==c[s]&&"__o"!==c[s]||!t.$$typeof)&&!i(t[c[s]],a[c[s]]))return!1;return!0}return t!=t&&a!=a}t.exports=function(t,n){try{return i(t,n)}catch(t){if((t.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw t}}},9787:function(n){"use strict";n.exports=t}},e={};function r(t){var o=e[t];if(void 0!==o)return o.exports;var i=e[t]={exports:{}};return n[t](i,i.exports,r),i.exports}r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,{a:n}),n},r.d=function(t,n){for(var e in n)r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return function(){"use strict";r.r(o),r.d(o,{BrushHelpers:function(){return N},VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS:function(){return V},VictoryBrushContainer:function(){return k},useVictoryBrushContainer:function(){return $}});var t=r(1893),n=r.n(t),e=r(9787),i=r.n(e);function a(t,n){return u(t)?t(n):t}function u(t){return"function"==typeof t}function s(t,n){if(t)return Object.keys(t).reduce(((e,r)=>(e[r]=n(t[r]),e)),{})}function c(){return c=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},c.apply(this,arguments)}r(9082),r(8532);const l=(0,e.forwardRef)(((t,n)=>{const{desc:e,id:r,tabIndex:o,origin:u,...s}=t,l={vectorEffect:"non-scaling-stroke",id:a(r,t)?.toString(),tabIndex:a(o,t),...s};return e?i().createElement("rect",c({},l,{ref:n}),i().createElement("desc",null,e)):i().createElement("rect",c({},l,{ref:n}))}));function f(t){return Array.isArray(t)&&t.some((t=>t instanceof Date))}function h(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];const o=t.concat(e);return f(o)?new Date(Math.max(...o)):Math.max(...o)}function x(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];const o=t.concat(e);return f(o)?new Date(Math.min(...o)):Math.min(...o)}function y(t,n,e){const{a:r,d:o,e:i,f:a}=n;return"y"===e?o*t+a:r*t+i}function p(t){return!(!t||void 0===t.identifier)}function d(t){if(p(t.nativeEvent))return;const n=t=>"svg"===t.nodeName?t:t.parentNode?n(t.parentNode):t;return n(t.target)}function m(t,n){if(p(t.nativeEvent))return{x:t.nativeEvent.locationX,y:t.nativeEvent.locationY};const e=function(t){return t.changedTouches&&t.changedTouches.length>0}(t)?t.changedTouches[0]:t,r=function(t){return t.getScreenCTM().inverse()}(n||d(e));return{x:y(e.clientX,r,"x"),y:y(e.clientY,r,"y")}}function v(t,n){const{horizontal:e}=t,r=t.scale,o=n||{x:r.x.domain(),y:r.y.domain()};return{x:e?[r.y(o.y[0]),r.y(o.y[1])]:[r.x(o.x[0]),r.x(o.x[1])],y:e?[r.x(o.x[0]),r.x(o.x[1])]:[r.y(o.y[0]),r.y(o.y[1])]}}function g(t,n,e,r){const{polar:o,horizontal:i}=t;if(!o)return{x:i?n.x.invert(r):n.x.invert(e),y:i?n.y.invert(e):n.y.invert(r)};const a=t.origin||{x:0,y:0},u=e-a.x,s=r-a.y,c=Math.abs(u*Math.sqrt(1+Math.pow(-s/u,2))),l=(-Math.atan2(s,u)+2*Math.PI)%(2*Math.PI);return{x:n.x.invert(l),y:n.y.invert(c)}}function b(t){const{x1:n,x2:e,y1:r,y2:o,scale:i}=t,a=g(t,i,n,r),u=g(t,i,e,o),s=(t,n)=>[x([t,n]),h([t,n])];return{x:s(a.x,u.x),y:s(a.y,u.y)}}var M=r(660),w=r.n(M);function D(){return D=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},D.apply(this,arguments)}const B=i().forwardRef(((t,n)=>i().createElement("svg",D({ref:n},t)))),O={startsWith:["data-","aria-"],exactMatch:[]},E=t=>{const n={...t};return Object.fromEntries(Object.entries(n).filter((t=>{let[n]=t;return(t=>!(!(t=>{let n=!1;return O.startsWith.forEach((e=>{new RegExp(`\\b(${e})(\\w|-)+`,"g").test(t)&&(n=!0)})),n})(t)&&!(t=>O.exactMatch.includes(t))(t)))(n)})).map((n=>{let[e,r]=n;return[e,a(r,t)]})))},j=i().createContext(void 0);j.displayName="PortalContext";const S=t=>{let{children:n}=t;const[e,r]=i().useState(new Map),o=i().useCallback(((t,n)=>{r((e=>{const r=new Map(e);return r.set(t,n),r}))}),[r]),a=i().useCallback((t=>{r((n=>{const e=new Map(n);return e.delete(t),e}))}),[r]),u=i().useMemo((()=>({addChild:o,removeChild:a,children:e})),[o,a,e]);return i().createElement(j.Provider,{value:u},n)},A=t=>{let{as:n,...e}=t;const r=i().useContext(j);if(!r)return null;const o=Array.from(r.children.values());return i().cloneElement(n,e,o)};function P(){return P=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},P.apply(this,arguments)}const C={className:"VictoryContainer",portalComponent:i().createElement(B,null),portalZIndex:99,responsive:!0,role:"img"},R=t=>{const{role:n,title:r,desc:o,children:a,className:s,portalZIndex:c,portalComponent:l,width:f,height:h,style:x,tabIndex:y,responsive:p,events:d,ouiaId:m,ouiaSafe:v,ouiaType:g,dimensions:b,ariaDescribedBy:M,ariaLabelledBy:D,viewBox:B,preserveAspectRatio:O,userProps:j,titleId:R,descId:T,containerRef:G,localContainerRef:z}=function(t){const n={...C,...t},{title:r,desc:o,width:i,height:a,responsive:u}=n,s=(0,e.useRef)(null),c=(0,e.useRef)(w()("victory-container-")),l=n.containerId??c.current,f=t=>`${l}-${t}`,h=E(n),x=u?{width:"100%",height:"100%"}:{width:i,height:a},y=u?`0 0 ${i} ${a}`:void 0,p=u?n.preserveAspectRatio:void 0,d=[r&&f("title"),n["aria-labelledby"]].filter(Boolean).join(" ")||void 0,m=[o&&f("desc"),n["aria-describedby"]].filter(Boolean).join(" ")||void 0,v=f("title"),g=f("desc");return{...n,titleId:v,descId:g,dimensions:x,viewBox:y,preserveAspectRatio:p,ariaLabelledBy:d,ariaDescribedBy:m,userProps:h,localContainerRef:s}}(t);return i().useEffect((()=>{if(!d?.onWheel)return;const t=t=>t.preventDefault(),n=z?.current;return n?.addEventListener("wheel",t),()=>{n?.removeEventListener("wheel",t)}}),[]),i().createElement("div",{className:s,style:{...x,width:p?x?.width:b.width,height:p?x?.height:b.height,pointerEvents:"none",touchAction:"none",position:"relative"},"data-ouia-component-id":m,"data-ouia-component-type":g,"data-ouia-safe":v,ref:(_=[z,G],t=>{_.forEach((n=>{u(n)?n(t):null!=n&&(n.current=t)}))})},i().createElement(S,null,i().createElement("svg",P({width:f,height:h,tabIndex:y,role:n,"aria-labelledby":D,"aria-describedby":M,viewBox:B,preserveAspectRatio:O,style:{...b,pointerEvents:"all"}},j,d),r?i().createElement("title",{id:R},r):null,o?i().createElement("desc",{id:T},o):null,a),i().createElement("div",{style:{...b,zIndex:c,position:"absolute",top:0,left:0}},i().createElement(A,{as:l,width:f,height:h,viewBox:B,preserveAspectRatio:O,style:{...b,overflow:"visible"}}))));var _};R.role="container";var T=r(8163),G=r.n(T),z=r(7491),_=r.n(z);const I={getDimension(t){const{horizontal:n,brushDimension:e}=t;return n&&e?"x"===e?"y":"x":e},withinBounds(t,n,e){const{x1:r,x2:o,y1:i,y2:a}=s(n,Number),{x:u,y:c}=s(t,Number),l=e?e/2:0;return u+l>=Math.min(r,o)&&u-l<=Math.max(r,o)&&c+l>=Math.min(i,a)&&c-l<=Math.max(i,a)},getDomainBox(t,e,r){const o=this.getDimension(t),i=n()({},e,t.domain),a=n()({},r,i),u=v(t,i),s=v(t,a);return{x1:"y"!==o?Math.min(...s.x):Math.min(...u.x),x2:"y"!==o?Math.max(...s.x):Math.max(...u.x),y1:"x"!==o?Math.min(...s.y):Math.min(...u.y),y2:"x"!==o?Math.max(...s.y):Math.max(...u.y)}},getHandles(t,n){const e=this.getDimension(t),{x1:r,x2:o,y1:i,y2:a}=n,u=Math.min(r,o),s=Math.max(r,o),c=Math.min(i,a),l=Math.max(i,a),f=t.handleWidth/2;return{left:"y"!==e&&{x1:u-f,x2:u+f,y1:i,y2:a},right:"y"!==e&&{x1:s-f,x2:s+f,y1:i,y2:a},top:"x"!==e&&{x1:r,x2:o,y1:c-f,y2:c+f},bottom:"x"!==e&&{x1:r,x2:o,y1:l-f,y2:l+f}}},getActiveHandles(t,n,e){const r=this.getHandles(n,e),o=["top","bottom","left","right"].reduce(((n,e)=>r[e]&&this.withinBounds(t,r[e])?n.concat(e):n),[]);return o.length&&o},getResizeMutation(t,n){const{x1:e,y1:r,x2:o,y2:i}=t,a={left:{x1:Math.max(e,o),x2:Math.min(e,o),y1:r,y2:i},right:{x1:Math.min(e,o),x2:Math.max(e,o),y1:r,y2:i},top:{y1:Math.max(r,i),y2:Math.min(r,i),x1:e,x2:o},bottom:{y1:Math.min(r,i),y2:Math.max(r,i),x1:e,x2:o}};return n.reduce(((t,n)=>Object.assign(t,a[n])),{})},getMinimumDomain:()=>({x:[0,1/Number.MAX_SAFE_INTEGER],y:[0,1/Number.MAX_SAFE_INTEGER]}),getDefaultBrushArea(t,n,e){const{domain:r,fullDomain:o,scale:i,horizontal:a,allowResize:u}=t,s=u||t.defaultBrushArea?t.defaultBrushArea:"move";if("none"===s)return this.getMinimumDomain();if("disable"===s)return n;if("move"===s){const r=this.getDomainBox(t,o,n),u=t.parentSVG||d(e),s=this.panBox({...t,...r,brushDomain:n,startX:(r.x1+r.x2)/2,startY:(r.y1+r.y2)/2},m(e,u)),c=t.fullDomainBox||this.getDomainBox(t,o);return b({...this.constrainBox(s,c),scale:i,horizontal:a})}return r},getSelectionMutation(t,n,e){const{x:r,y:o}=t,{x1:i,x2:a,y1:u,y2:s}=n;return{x1:"y"!==e?r:i,y1:"x"!==e?o:u,x2:"y"!==e?r:a,y2:"x"!==e?o:s}},panBox(t,e){const{domain:r,startX:o,startY:i}=t,a=this.getDimension(t),u=n()({},t.brushDomain,r),s=n()({},t.fullDomain,r),{x1:c,x2:l,y1:f,y2:h}=t.x1?t:this.getDomainBox(t,s,u),{x:x,y:y}=e,p=o?o-x:0,d=i?i-y:0;return{x1:"y"!==a?Math.min(c,l)-p:Math.min(c,l),x2:"y"!==a?Math.max(c,l)-p:Math.max(c,l),y1:"x"!==a?Math.min(f,h)-d:Math.min(f,h),y2:"x"!==a?Math.max(f,h)-d:Math.max(f,h)}},constrainBox(t,n){const{x1:e,y1:r,x2:o,y2:i}=s(n,Number);return{x1:t.x2>o?o-Math.abs(t.x2-t.x1):Math.max(t.x1,e),y1:t.y2>i?i-Math.abs(t.y2-t.y1):Math.max(t.y1,r),x2:t.x1<e?e+Math.abs(t.x2-t.x1):Math.min(t.x2,o),y2:t.y1<r?r+Math.abs(t.y2-t.y1):Math.min(t.y2,i)}},constrainPoint(t,n){const{x1:e,y1:r,x2:o,y2:i}=s(n,Number);return{x:Math.min(Math.max(t.x,e),o),y:Math.min(Math.max(t.y,r),i)}},hasMoved(t){const{x1:n,x2:e,y1:r,y2:o,mouseMoveThreshold:i}=t,a=this.getDimension(t),u=Math.abs(n-e)>=i,s=Math.abs(r-o)>=i;switch(a){case"x":return u;case"y":return s;default:return u||s}},onMouseDown(t,e){t.preventDefault();const{handleWidth:r,cachedBrushDomain:o,domain:i,allowResize:a,allowDrag:u,allowDraw:s}=e,c=this.getDimension(e),l=a||e.defaultBrushArea?e.defaultBrushArea:"move";if(!a&&!u)return{};const f=e.fullDomainBox||this.getDomainBox(e,i),h=e.parentSVG||d(t),{x:x,y:y}=m(t,h);if(!this.withinBounds({x:x,y:y},f,r))return{};const p=n()({},e.brushDomain,i),v=_()(p,o)?e.currentDomain||p||i:p||i,g=this.getDomainBox(e,i,v),b=a&&this.getActiveHandles({x:x,y:y},e,g);return b?[{target:"parent",mutation:()=>({isSelecting:!0,domainBox:g,fullDomainBox:f,cachedBrushDomain:p,currentDomain:v,parentSVG:h,...this.getResizeMutation(g,b)})}]:this.withinBounds({x:x,y:y},g)&&!_()(i,v)?[{target:"parent",mutation:()=>({isPanning:u,startX:x,startY:y,domainBox:g,fullDomainBox:f,currentDomain:v,cachedBrushDomain:p,parentSVG:h,...g})}]:s?[{target:"parent",mutation:()=>({isSelecting:a||"move"===l,domainBox:g,fullDomainBox:f,parentSVG:h,cachedBrushDomain:p,cachedCurrentDomain:v,currentDomain:this.getMinimumDomain(),...this.getSelectionMutation({x:x,y:y},g,c)})}]:{}},onGlobalMouseMove(t,e){const{scale:r,isPanning:o,isSelecting:i,fullDomainBox:a,onBrushDomainChange:s,allowResize:c,allowDrag:l,horizontal:f,mouseMoveThreshold:h,parentSVG:x}=e,y=this.getDimension(e),{x:p,y:d}=m(t,x);if(!c&&!l||h>0&&!this.hasMoved({...e,x2:p,y2:d}))return{};if(l&&o){const{startX:t,startY:o}=e,i=this.panBox(e,{x:p,y:d}),c=this.constrainBox(i,a),l=b({...c,scale:r,horizontal:f}),h={currentDomain:l,parentSVG:x,startX:i.x2>=a.x2||i.x1<=a.x1?t:p,startY:i.y2>=a.y2||i.y1<=a.y1?o:d,...c};return u(s)&&s(l,n()({},h,e)),[{target:"parent",mutation:()=>h}]}if(c&&i){const{x:t,y:o}=this.constrainPoint({x:"y"!==y?p:e.x2,y:"x"!==y?d:e.y2},a),i=b({x2:t,y2:o,x1:e.x1,y1:e.y1,scale:r,horizontal:f}),c={x2:t,y2:o,currentDomain:i,parentSVG:x};return u(s)&&s(i,n()({},c,e)),[{target:"parent",mutation:()=>c}]}return{}},onGlobalMouseUp(t,e){if(!e.isPanning&&!e.isSelecting)return{};const{x1:r,y1:o,x2:i,y2:a,isPanning:s,isSelecting:c,onBrushDomainChange:l,onBrushDomainChangeEnd:f,onBrushCleared:h,currentDomain:x,allowResize:y,allowDrag:p}=e,d=y||e.defaultBrushArea?e.defaultBrushArea:"move",m={isPanning:!1,isSelecting:!1};if(!y&&(void 0===d||"none"===d)||r!==i&&o!==a)(p&&s||y&&c)&&u(f)&&f(x,n()({},m,e));else{const r=e.cachedCurrentDomain||x,o=this.getDefaultBrushArea(e,r,t);m.currentDomain=o,u(l)&&l(o,n()({},m,e)),u(f)&&f(o,n()({},m,e)),u(h)&&h(o,n()({},m,e))}return[{target:"parent",mutation:()=>m}]}},N={...I,onMouseDown:I.onMouseDown.bind(I),onGlobalMouseUp:I.onGlobalMouseUp.bind(I),onGlobalMouseMove:G()(I.onGlobalMouseMove.bind(I),16,{leading:!0,trailing:!1})},V={allowDrag:!0,allowDraw:!0,allowResize:!0,brushComponent:i().createElement(l,null),brushStyle:{stroke:"transparent",fill:"black",fillOpacity:.1},handleComponent:i().createElement(l,null),handleStyle:{stroke:"transparent",fill:"transparent"},handleWidth:8,mouseMoveThreshold:0},$=t=>{const e={...V,...t},{children:r}=e,o=t=>{const{handleWidth:r,handleStyle:o,handleComponent:a,name:u}=e,s=N.getDomainBox(e,t),{x1:c,x2:l,y1:f,y2:h}=s,{top:x,bottom:y,left:p,right:d}=N.getHandles(e,s),m=Math.abs(l-c)||1,v=Math.abs(h-f)||1,g=a.props&&a.props.style||{},b=n()({},g,o),M=(()=>{const t={yProps:"ns-resize",xProps:"ew-resize"};return!e.allowResize&&e.allowDrag?(t.xProps="move",t.yProps="move"):e.allowResize||e.allowDrag||(t.xProps="auto",t.yProps="auto"),t})(),w={style:b,width:m,height:r,cursor:M.yProps},D={style:b,width:r,height:v,cursor:M.xProps},B={top:x&&Object.assign({x:x.x1,y:x.y1},w),bottom:y&&Object.assign({x:y.x1,y:y.y1},w),left:p&&Object.assign({y:p.y1,x:p.x1},D),right:d&&Object.assign({y:d.y1,x:d.x1},D)},O=["top","bottom","left","right"].reduce(((t,n)=>B[n]?t.concat(i().cloneElement(a,Object.assign({key:`${u}-handle-${n}`},B[n]))):t),[]);return O.length?O:null};return{props:e,children:[...i().Children.toArray(r),...(()=>{const{currentDomain:t,cachedBrushDomain:r}=e,a=n()({},e.brushDomain,e.domain),u=_()(a,r)?n()({},t,a):a,s=(t=>{const{x:r,y:o}=t,{brushStyle:a,brushComponent:u,name:s}=e,c=u.props&&u.props.style,l=e.allowDrag||e.allowResize?"move":"auto";return r[0]!==r[1]&&o[0]!==o[1]?i().cloneElement(u,{key:`${s}-brush`,width:Math.abs(r[1]-r[0])||1,height:Math.abs(o[1]-o[0])||1,x:Math.min(r[0],r[1]),y:Math.min(o[0],o[1]),cursor:l,style:n()({},c,a)}):null})(v(e,u));return s?[s,o(u)]:[]})()]}},k=t=>{const{props:n,children:e}=$(t);return i().createElement(R,n,e)};k.role="container",k.defaultEvents=t=>{const n={...V,...t},e=(t,e)=>(r,o,i,a)=>n.disable||e?.(o)?{}:t(r,{...n,...o},i,a);return[{target:"parent",eventHandlers:{onMouseDown:e(N.onMouseDown),onTouchStart:e(N.onMouseDown),onGlobalMouseMove:e(N.onGlobalMouseMove,(t=>!t.isPanning&&!t.isSelecting)),onGlobalTouchMove:e(N.onGlobalMouseMove,(t=>!t.isPanning&&!t.isSelecting)),onGlobalMouseUp:e(N.onGlobalMouseUp),onGlobalTouchEnd:e(N.onGlobalMouseUp),onGlobalTouchCancel:e(N.onGlobalMouseUp)}}]}}(),o}()}));
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):"object"==typeof exports?exports.VictoryBrushContainer=n(require("react")):t.VictoryBrushContainer=n(t.React)}(self,(function(t){return function(){var n={2596:function(t,n,e){var r=e(2373).Symbol;t.exports=r},6082:function(t){t.exports=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}},8644:function(t){t.exports=function(t,n){for(var e=-1,r=null==t?0:t.length,o=Array(r);++e<r;)o[e]=n(t[e],e,t);return o}},9559:function(t){t.exports=function(t,n){for(var e=-1,r=n.length,o=t.length;++e<r;)t[o+e]=n[e];return t}},4132:function(t,n,e){var r=e(8347),o=e(788),i=Object.prototype.hasOwnProperty;t.exports=function(t,n,e){var a=t[n];i.call(t,n)&&o(a,e)&&(void 0!==e||n in t)||r(t,n,e)}},8347:function(t,n,e){var r=e(5525);t.exports=function(t,n,e){"__proto__"==n&&r?r(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e}},6457:function(t,n,e){var r=e(9559),o=e(3608);t.exports=function t(n,e,i,a,u){var s=-1,c=n.length;for(i||(i=o),u||(u=[]);++s<c;){var l=n[s];e>0&&i(l)?e>1?t(l,e-1,i,a,u):r(u,l):a||(u[u.length]=l)}return u}},4432:function(t,n,e){var r=e(9026),o=e(3110);t.exports=function(t,n){for(var e=0,i=(n=r(n,t)).length;null!=t&&e<i;)t=t[o(n[e++])];return e&&e==i?t:void 0}},6776:function(t){t.exports=function(t,n){return null!=t&&n in Object(t)}},5436:function(t,n,e){var r=e(6371),o=e(5066);t.exports=function(t,n){return r(t,n,(function(n,e){return o(t,e)}))}},6371:function(t,n,e){var r=e(4432),o=e(6539),i=e(9026);t.exports=function(t,n,e){for(var a=-1,u=n.length,s={};++a<u;){var c=n[a],l=r(t,c);e(l,c)&&o(s,i(c,t),l)}return s}},1600:function(t){t.exports=function(t){return function(n){return null==n?void 0:n[t]}}},3301:function(t,n,e){var r=e(4432);t.exports=function(t){return function(n){return r(n,t)}}},6317:function(t,n,e){var r=e(5346),o=e(4280),i=e(201);t.exports=function(t,n){return i(o(t,n,r),t+"")}},6539:function(t,n,e){var r=e(4132),o=e(9026),i=e(9099),a=e(7709),u=e(3110);t.exports=function(t,n,e,s){if(!a(t))return t;for(var c=-1,l=(n=o(n,t)).length,f=l-1,h=t;null!=h&&++c<l;){var x=u(n[c]),y=e;if("__proto__"===x||"constructor"===x||"prototype"===x)return t;if(c!=f){var p=h[x];void 0===(y=s?s(p,x,h):void 0)&&(y=a(p)?p:i(n[c+1])?[]:{})}r(h,x,y),h=h[x]}return t}},6316:function(t,n,e){var r=e(2596),o=e(8644),i=e(163),a=e(1995),u=r?r.prototype:void 0,s=u?u.toString:void 0;t.exports=function t(n){if("string"==typeof n)return n;if(i(n))return o(n,t)+"";if(a(n))return s?s.call(n):"";var e=n+"";return"0"==e&&1/n==-1/0?"-0":e}},9026:function(t,n,e){var r=e(163),o=e(726),i=e(7801),a=e(7010);t.exports=function(t,n){return r(t)?t:o(t,n)?[t]:i(a(t))}},5525:function(t,n,e){var r=e(3743),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},5557:function(t,n,e){var r=e(2645),o=e(4280),i=e(201);t.exports=function(t){return i(o(t,void 0,r),t+"")}},2117:function(t,n,e){var r="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=r},3743:function(t){t.exports=function(t,n){return null==t?void 0:t[n]}},3096:function(t,n,e){var r=e(9026),o=e(5075),i=e(163),a=e(9099),u=e(8454),s=e(3110);t.exports=function(t,n,e){for(var c=-1,l=(n=r(n,t)).length,f=!1;++c<l;){var h=s(n[c]);if(!(f=null!=t&&e(t,h)))break;t=t[h]}return f||++c!=l?f:!!(l=null==t?0:t.length)&&u(l)&&a(h,l)&&(i(t)||o(t))}},3608:function(t,n,e){var r=e(2596),o=e(5075),i=e(163),a=r?r.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(a&&t&&t[a])}},9099:function(t){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t<e}},8286:function(t){t.exports=function(){return!1}},726:function(t,n,e){var r=e(163),o=e(1995),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,n){if(r(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!o(t))||a.test(t)||!i.test(t)||null!=n&&t in Object(n)}},2453:function(t){t.exports=function(t){return t}},4280:function(t,n,e){var r=e(6082),o=Math.max;t.exports=function(t,n,e){return n=o(void 0===n?t.length-1:n,0),function(){for(var i=arguments,a=-1,u=o(i.length-n,0),s=Array(u);++a<u;)s[a]=i[n+a];a=-1;for(var c=Array(n+1);++a<n;)c[a]=i[a];return c[n]=e(s),r(t,this,c)}}},2373:function(t,n,e){var r=e(2117),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},201:function(t){t.exports=function(t){return t}},7801:function(t,n,e){var r=e(2453),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,a=r((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(o,(function(t,e,r,o){n.push(r?o.replace(i,"$1"):e||t)})),n}));t.exports=a},3110:function(t,n,e){var r=e(1995);t.exports=function(t){if("string"==typeof t||r(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},5034:function(t,n,e){var r=e(7709),o=e(6987),i=e(5812),a=Math.max,u=Math.min;t.exports=function(t,n,e){var s,c,l,f,h,x,y=0,p=!1,d=!1,m=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function v(n){var e=s,r=c;return s=c=void 0,y=n,f=t.apply(r,e)}function g(t){return y=t,h=setTimeout(M,n),p?v(t):f}function b(t){var e=t-x;return void 0===x||e>=n||e<0||d&&t-y>=l}function M(){var t=o();if(b(t))return w(t);h=setTimeout(M,function(t){var e=n-(t-x);return d?u(e,l-(t-y)):e}(t))}function w(t){return h=void 0,m&&s?v(t):(s=c=void 0,f)}function D(){var t=o(),e=b(t);if(s=arguments,c=this,x=t,e){if(void 0===h)return g(x);if(d)return clearTimeout(h),h=setTimeout(M,n),v(x)}return void 0===h&&(h=setTimeout(M,n)),f}return n=i(n)||0,r(e)&&(p=!!e.leading,l=(d="maxWait"in e)?a(i(e.maxWait)||0,n):l,m="trailing"in e?!!e.trailing:m),D.cancel=function(){void 0!==h&&clearTimeout(h),y=0,s=x=c=h=void 0},D.flush=function(){return void 0===h?f:w(o())},D}},1893:function(t,n,e){var r=e(6317),o=e(788),i=e(8286),a=e(8855),u=Object.prototype,s=u.hasOwnProperty,c=r((function(t,n){t=Object(t);var e=-1,r=n.length,c=r>2?n[2]:void 0;for(c&&i(n[0],n[1],c)&&(r=1);++e<r;)for(var l=n[e],f=a(l),h=-1,x=f.length;++h<x;){var y=f[h],p=t[y];(void 0===p||o(p,u[y])&&!s.call(t,y))&&(t[y]=l[y])}return t}));t.exports=c},788:function(t){t.exports=function(t,n){return t===n||t!=t&&n!=n}},2645:function(t,n,e){var r=e(6457);t.exports=function(t){return null!=t&&t.length?r(t,1):[]}},5066:function(t,n,e){var r=e(6776),o=e(3096);t.exports=function(t,n){return null!=t&&o(t,n,r)}},5346:function(t){t.exports=function(t){return t}},5075:function(t){t.exports=function(){return!1}},163:function(t){var n=Array.isArray;t.exports=n},8454:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},7709:function(t){t.exports=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},1995:function(t){t.exports=function(){return!1}},8855:function(t){t.exports=function(t){var n=[];if(null!=t)for(var e in Object(t))n.push(e);return n}},6987:function(t,n,e){var r=e(2373);t.exports=function(){return r.Date.now()}},9082:function(t,n,e){var r=e(5436),o=e(5557)((function(t,n){return null==t?{}:r(t,n)}));t.exports=o},8532:function(t,n,e){var r=e(1600),o=e(3301),i=e(726),a=e(3110);t.exports=function(t){return i(t)?r(a(t)):o(t)}},8163:function(t,n,e){var r=e(5034),o=e(7709);t.exports=function(t,n,e){var i=!0,a=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return o(e)&&(i="leading"in e?!!e.leading:i,a="trailing"in e?!!e.trailing:a),r(t,n,{leading:i,maxWait:n,trailing:a})}},5812:function(t){t.exports=function(t){return t}},7010:function(t,n,e){var r=e(6316);t.exports=function(t){return null==t?"":r(t)}},660:function(t,n,e){var r=e(7010),o=0;t.exports=function(t){var n=++o;return r(t)+n}},7491:function(t){var n="undefined"!=typeof Element,e="function"==typeof Map,r="function"==typeof Set,o="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function i(t,a){if(t===a)return!0;if(t&&a&&"object"==typeof t&&"object"==typeof a){if(t.constructor!==a.constructor)return!1;var u,s,c,l;if(Array.isArray(t)){if((u=t.length)!=a.length)return!1;for(s=u;0!=s--;)if(!i(t[s],a[s]))return!1;return!0}if(e&&t instanceof Map&&a instanceof Map){if(t.size!==a.size)return!1;for(l=t.entries();!(s=l.next()).done;)if(!a.has(s.value[0]))return!1;for(l=t.entries();!(s=l.next()).done;)if(!i(s.value[1],a.get(s.value[0])))return!1;return!0}if(r&&t instanceof Set&&a instanceof Set){if(t.size!==a.size)return!1;for(l=t.entries();!(s=l.next()).done;)if(!a.has(s.value[0]))return!1;return!0}if(o&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(a)){if((u=t.length)!=a.length)return!1;for(s=u;0!=s--;)if(t[s]!==a[s])return!1;return!0}if(t.constructor===RegExp)return t.source===a.source&&t.flags===a.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===a.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===a.toString();if((u=(c=Object.keys(t)).length)!==Object.keys(a).length)return!1;for(s=u;0!=s--;)if(!Object.prototype.hasOwnProperty.call(a,c[s]))return!1;if(n&&t instanceof Element)return!1;for(s=u;0!=s--;)if(("_owner"!==c[s]&&"__v"!==c[s]&&"__o"!==c[s]||!t.$$typeof)&&!i(t[c[s]],a[c[s]]))return!1;return!0}return t!=t&&a!=a}t.exports=function(t,n){try{return i(t,n)}catch(t){if((t.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw t}}},9787:function(n){"use strict";n.exports=t}},e={};function r(t){var o=e[t];if(void 0!==o)return o.exports;var i=e[t]={exports:{}};return n[t](i,i.exports,r),i.exports}r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,{a:n}),n},r.d=function(t,n){for(var e in n)r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return function(){"use strict";r.r(o),r.d(o,{BrushHelpers:function(){return N},VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS:function(){return V},VictoryBrushContainer:function(){return k},useVictoryBrushContainer:function(){return $}});var t=r(1893),n=r.n(t),e=r(9787),i=r.n(e);function a(t,n){return u(t)?t(n):t}function u(t){return"function"==typeof t}function s(t,n){if(t)return Object.keys(t).reduce(((e,r)=>(e[r]=n(t[r]),e)),{})}function c(){return c=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},c.apply(this,arguments)}r(9082),r(8532);const l=(0,e.forwardRef)(((t,n)=>{const{desc:e,id:r,tabIndex:o,origin:u,...s}=t,l={vectorEffect:"non-scaling-stroke",id:a(r,t)?.toString(),tabIndex:a(o,t),...s};return e?i().createElement("rect",c({},l,{ref:n}),i().createElement("desc",null,e)):i().createElement("rect",c({},l,{ref:n}))}));function f(t){return Array.isArray(t)&&t.some((t=>t instanceof Date))}function h(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];const o=t.concat(e);return f(o)?new Date(Math.max(...o)):Math.max(...o)}function x(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];const o=t.concat(e);return f(o)?new Date(Math.min(...o)):Math.min(...o)}function y(t,n,e){const{a:r,d:o,e:i,f:a}=n;return"y"===e?o*t+a:r*t+i}function p(t){return!(!t||void 0===t.identifier)}function d(t){if(p(t.nativeEvent))return;const n=t=>"svg"===t.nodeName?t:t.parentNode?n(t.parentNode):t;return n(t.target)}function m(t,n){if(p(t.nativeEvent))return{x:t.nativeEvent.locationX,y:t.nativeEvent.locationY};const e=function(t){return t.changedTouches&&t.changedTouches.length>0}(t)?t.changedTouches[0]:t,r=function(t){return t.getScreenCTM().inverse()}(n||d(e));return{x:y(e.clientX,r,"x"),y:y(e.clientY,r,"y")}}function v(t,n){const{horizontal:e}=t,r=t.scale,o=n||{x:r.x.domain(),y:r.y.domain()};return{x:e?[r.y(o.y[0]),r.y(o.y[1])]:[r.x(o.x[0]),r.x(o.x[1])],y:e?[r.x(o.x[0]),r.x(o.x[1])]:[r.y(o.y[0]),r.y(o.y[1])]}}function g(t,n,e,r){const{polar:o,horizontal:i}=t;if(!o)return{x:i?n.x.invert(r):n.x.invert(e),y:i?n.y.invert(e):n.y.invert(r)};const a=t.origin||{x:0,y:0},u=e-a.x,s=r-a.y,c=Math.abs(u*Math.sqrt(1+Math.pow(-s/u,2))),l=(-Math.atan2(s,u)+2*Math.PI)%(2*Math.PI);return{x:n.x.invert(l),y:n.y.invert(c)}}function b(t){const{x1:n,x2:e,y1:r,y2:o,scale:i}=t,a=g(t,i,n,r),u=g(t,i,e,o),s=(t,n)=>[x([t,n]),h([t,n])];return{x:s(a.x,u.x),y:s(a.y,u.y)}}var M=r(660),w=r.n(M);function D(){return D=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},D.apply(this,arguments)}const B=i().forwardRef(((t,n)=>i().createElement("svg",D({ref:n},t)))),O={startsWith:["data-","aria-"],exactMatch:[]},E=t=>{const n={...t};return Object.fromEntries(Object.entries(n).filter((t=>{let[n]=t;return(t=>!(!(t=>{let n=!1;return O.startsWith.forEach((e=>{new RegExp(`\\b(${e})(\\w|-)+`,"g").test(t)&&(n=!0)})),n})(t)&&!(t=>O.exactMatch.includes(t))(t)))(n)})).map((n=>{let[e,r]=n;return[e,a(r,t)]})))},j=i().createContext(void 0);j.displayName="PortalContext";const S=t=>{let{children:n}=t;const[e,r]=i().useState(new Map),o=i().useCallback(((t,n)=>{r((e=>{const r=new Map(e);return r.set(t,n),r}))}),[r]),a=i().useCallback((t=>{r((n=>{const e=new Map(n);return e.delete(t),e}))}),[r]),u=i().useMemo((()=>({addChild:o,removeChild:a,children:e})),[o,a,e]);return i().createElement(j.Provider,{value:u},n)},A=t=>{let{as:n,...e}=t;const r=i().useContext(j);if(!r)return null;const o=Array.from(r.children.values());return i().cloneElement(n,e,o)};function P(){return P=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},P.apply(this,arguments)}const C={className:"VictoryContainer",portalComponent:i().createElement(B,null),portalZIndex:99,responsive:!0,role:"img"},R=t=>{const{role:n,title:r,desc:o,children:a,className:s,portalZIndex:c,portalComponent:l,width:f,height:h,style:x,tabIndex:y,responsive:p,events:d,ouiaId:m,ouiaSafe:v,ouiaType:g,dimensions:b,ariaDescribedBy:M,ariaLabelledBy:D,viewBox:B,preserveAspectRatio:O,userProps:j,titleId:R,descId:T,containerRef:G,localContainerRef:z}=function(t){const n={...C,...t},{title:r,desc:o,width:i,height:a,responsive:u}=n,s=(0,e.useRef)(null),c=(0,e.useRef)(w()("victory-container-")),l=n.containerId??c.current,f=t=>`${l}-${t}`,h=E(n),x=u?{width:"100%",height:"100%"}:{width:i,height:a},y=u?`0 0 ${i} ${a}`:void 0,p=u?n.preserveAspectRatio:void 0,d=[r&&f("title"),n["aria-labelledby"]].filter(Boolean).join(" ")||void 0,m=[o&&f("desc"),n["aria-describedby"]].filter(Boolean).join(" ")||void 0,v=f("title"),g=f("desc");return{...n,titleId:v,descId:g,dimensions:x,viewBox:y,preserveAspectRatio:p,ariaLabelledBy:d,ariaDescribedBy:m,userProps:h,localContainerRef:s}}(t);return i().useEffect((()=>{if(!d?.onWheel)return;const t=t=>t.preventDefault(),n=z?.current;return n?.addEventListener("wheel",t),()=>{n?.removeEventListener("wheel",t)}}),[]),i().createElement("div",{className:s,style:{...x,width:p?x?.width:b.width,height:p?x?.height:b.height,pointerEvents:x?.pointerEvents??"none",touchAction:x?.touchAction??"none",position:x?.position??"relative"},"data-ouia-component-id":m,"data-ouia-component-type":g,"data-ouia-safe":v,ref:(_=[z,G],t=>{_.forEach((n=>{u(n)?n(t):null!=n&&(n.current=t)}))})},i().createElement(S,null,i().createElement("svg",P({width:f,height:h,tabIndex:y,role:n,"aria-labelledby":D,"aria-describedby":M,viewBox:B,preserveAspectRatio:O,style:{...b,pointerEvents:"all"}},j,d),r?i().createElement("title",{id:R},r):null,o?i().createElement("desc",{id:T},o):null,a),i().createElement("div",{style:{...b,zIndex:c,position:"absolute",top:0,left:0}},i().createElement(A,{as:l,width:f,height:h,viewBox:B,preserveAspectRatio:O,style:{...b,overflow:"visible"}}))));var _};R.role="container";var T=r(8163),G=r.n(T),z=r(7491),_=r.n(z);const I={getDimension(t){const{horizontal:n,brushDimension:e}=t;return n&&e?"x"===e?"y":"x":e},withinBounds(t,n,e){const{x1:r,x2:o,y1:i,y2:a}=s(n,Number),{x:u,y:c}=s(t,Number),l=e?e/2:0;return u+l>=Math.min(r,o)&&u-l<=Math.max(r,o)&&c+l>=Math.min(i,a)&&c-l<=Math.max(i,a)},getDomainBox(t,e,r){const o=this.getDimension(t),i=n()({},e,t.domain),a=n()({},r,i),u=v(t,i),s=v(t,a);return{x1:"y"!==o?Math.min(...s.x):Math.min(...u.x),x2:"y"!==o?Math.max(...s.x):Math.max(...u.x),y1:"x"!==o?Math.min(...s.y):Math.min(...u.y),y2:"x"!==o?Math.max(...s.y):Math.max(...u.y)}},getHandles(t,n){const e=this.getDimension(t),{x1:r,x2:o,y1:i,y2:a}=n,u=Math.min(r,o),s=Math.max(r,o),c=Math.min(i,a),l=Math.max(i,a),f=t.handleWidth/2;return{left:"y"!==e&&{x1:u-f,x2:u+f,y1:i,y2:a},right:"y"!==e&&{x1:s-f,x2:s+f,y1:i,y2:a},top:"x"!==e&&{x1:r,x2:o,y1:c-f,y2:c+f},bottom:"x"!==e&&{x1:r,x2:o,y1:l-f,y2:l+f}}},getActiveHandles(t,n,e){const r=this.getHandles(n,e),o=["top","bottom","left","right"].reduce(((n,e)=>r[e]&&this.withinBounds(t,r[e])?n.concat(e):n),[]);return o.length&&o},getResizeMutation(t,n){const{x1:e,y1:r,x2:o,y2:i}=t,a={left:{x1:Math.max(e,o),x2:Math.min(e,o),y1:r,y2:i},right:{x1:Math.min(e,o),x2:Math.max(e,o),y1:r,y2:i},top:{y1:Math.max(r,i),y2:Math.min(r,i),x1:e,x2:o},bottom:{y1:Math.min(r,i),y2:Math.max(r,i),x1:e,x2:o}};return n.reduce(((t,n)=>Object.assign(t,a[n])),{})},getMinimumDomain:()=>({x:[0,1/Number.MAX_SAFE_INTEGER],y:[0,1/Number.MAX_SAFE_INTEGER]}),getDefaultBrushArea(t,n,e){const{domain:r,fullDomain:o,scale:i,horizontal:a,allowResize:u}=t,s=u||t.defaultBrushArea?t.defaultBrushArea:"move";if("none"===s)return this.getMinimumDomain();if("disable"===s)return n;if("move"===s){const r=this.getDomainBox(t,o,n),u=t.parentSVG||d(e),s=this.panBox({...t,...r,brushDomain:n,startX:(r.x1+r.x2)/2,startY:(r.y1+r.y2)/2},m(e,u)),c=t.fullDomainBox||this.getDomainBox(t,o);return b({...this.constrainBox(s,c),scale:i,horizontal:a})}return r},getSelectionMutation(t,n,e){const{x:r,y:o}=t,{x1:i,x2:a,y1:u,y2:s}=n;return{x1:"y"!==e?r:i,y1:"x"!==e?o:u,x2:"y"!==e?r:a,y2:"x"!==e?o:s}},panBox(t,e){const{domain:r,startX:o,startY:i}=t,a=this.getDimension(t),u=n()({},t.brushDomain,r),s=n()({},t.fullDomain,r),{x1:c,x2:l,y1:f,y2:h}=t.x1?t:this.getDomainBox(t,s,u),{x:x,y:y}=e,p=o?o-x:0,d=i?i-y:0;return{x1:"y"!==a?Math.min(c,l)-p:Math.min(c,l),x2:"y"!==a?Math.max(c,l)-p:Math.max(c,l),y1:"x"!==a?Math.min(f,h)-d:Math.min(f,h),y2:"x"!==a?Math.max(f,h)-d:Math.max(f,h)}},constrainBox(t,n){const{x1:e,y1:r,x2:o,y2:i}=s(n,Number);return{x1:t.x2>o?o-Math.abs(t.x2-t.x1):Math.max(t.x1,e),y1:t.y2>i?i-Math.abs(t.y2-t.y1):Math.max(t.y1,r),x2:t.x1<e?e+Math.abs(t.x2-t.x1):Math.min(t.x2,o),y2:t.y1<r?r+Math.abs(t.y2-t.y1):Math.min(t.y2,i)}},constrainPoint(t,n){const{x1:e,y1:r,x2:o,y2:i}=s(n,Number);return{x:Math.min(Math.max(t.x,e),o),y:Math.min(Math.max(t.y,r),i)}},hasMoved(t){const{x1:n,x2:e,y1:r,y2:o,mouseMoveThreshold:i}=t,a=this.getDimension(t),u=Math.abs(n-e)>=i,s=Math.abs(r-o)>=i;switch(a){case"x":return u;case"y":return s;default:return u||s}},onMouseDown(t,e){t.preventDefault();const{handleWidth:r,cachedBrushDomain:o,domain:i,allowResize:a,allowDrag:u,allowDraw:s}=e,c=this.getDimension(e),l=a||e.defaultBrushArea?e.defaultBrushArea:"move";if(!a&&!u)return{};const f=e.fullDomainBox||this.getDomainBox(e,i),h=e.parentSVG||d(t),{x:x,y:y}=m(t,h);if(!this.withinBounds({x:x,y:y},f,r))return{};const p=n()({},e.brushDomain,i),v=_()(p,o)?e.currentDomain||p||i:p||i,g=this.getDomainBox(e,i,v),b=a&&this.getActiveHandles({x:x,y:y},e,g);return b?[{target:"parent",mutation:()=>({isSelecting:!0,domainBox:g,fullDomainBox:f,cachedBrushDomain:p,currentDomain:v,parentSVG:h,...this.getResizeMutation(g,b)})}]:this.withinBounds({x:x,y:y},g)&&!_()(i,v)?[{target:"parent",mutation:()=>({isPanning:u,startX:x,startY:y,domainBox:g,fullDomainBox:f,currentDomain:v,cachedBrushDomain:p,parentSVG:h,...g})}]:s?[{target:"parent",mutation:()=>({isSelecting:a||"move"===l,domainBox:g,fullDomainBox:f,parentSVG:h,cachedBrushDomain:p,cachedCurrentDomain:v,currentDomain:this.getMinimumDomain(),...this.getSelectionMutation({x:x,y:y},g,c)})}]:{}},onGlobalMouseMove(t,e){const{scale:r,isPanning:o,isSelecting:i,fullDomainBox:a,onBrushDomainChange:s,allowResize:c,allowDrag:l,horizontal:f,mouseMoveThreshold:h,parentSVG:x}=e,y=this.getDimension(e),{x:p,y:d}=m(t,x);if(!c&&!l||h>0&&!this.hasMoved({...e,x2:p,y2:d}))return{};if(l&&o){const{startX:t,startY:o}=e,i=this.panBox(e,{x:p,y:d}),c=this.constrainBox(i,a),l=b({...c,scale:r,horizontal:f}),h={currentDomain:l,parentSVG:x,startX:i.x2>=a.x2||i.x1<=a.x1?t:p,startY:i.y2>=a.y2||i.y1<=a.y1?o:d,...c};return u(s)&&s(l,n()({},h,e)),[{target:"parent",mutation:()=>h}]}if(c&&i){const{x:t,y:o}=this.constrainPoint({x:"y"!==y?p:e.x2,y:"x"!==y?d:e.y2},a),i=b({x2:t,y2:o,x1:e.x1,y1:e.y1,scale:r,horizontal:f}),c={x2:t,y2:o,currentDomain:i,parentSVG:x};return u(s)&&s(i,n()({},c,e)),[{target:"parent",mutation:()=>c}]}return{}},onGlobalMouseUp(t,e){if(!e.isPanning&&!e.isSelecting)return{};const{x1:r,y1:o,x2:i,y2:a,isPanning:s,isSelecting:c,onBrushDomainChange:l,onBrushDomainChangeEnd:f,onBrushCleared:h,currentDomain:x,allowResize:y,allowDrag:p}=e,d=y||e.defaultBrushArea?e.defaultBrushArea:"move",m={isPanning:!1,isSelecting:!1};if(!y&&(void 0===d||"none"===d)||r!==i&&o!==a)(p&&s||y&&c)&&u(f)&&f(x,n()({},m,e));else{const r=e.cachedCurrentDomain||x,o=this.getDefaultBrushArea(e,r,t);m.currentDomain=o,u(l)&&l(o,n()({},m,e)),u(f)&&f(o,n()({},m,e)),u(h)&&h(o,n()({},m,e))}return[{target:"parent",mutation:()=>m}]}},N={...I,onMouseDown:I.onMouseDown.bind(I),onGlobalMouseUp:I.onGlobalMouseUp.bind(I),onGlobalMouseMove:G()(I.onGlobalMouseMove.bind(I),16,{leading:!0,trailing:!1})},V={allowDrag:!0,allowDraw:!0,allowResize:!0,brushComponent:i().createElement(l,null),brushStyle:{stroke:"transparent",fill:"black",fillOpacity:.1},handleComponent:i().createElement(l,null),handleStyle:{stroke:"transparent",fill:"transparent"},handleWidth:8,mouseMoveThreshold:0},$=t=>{const e={...V,...t},{children:r}=e,o=t=>{const{handleWidth:r,handleStyle:o,handleComponent:a,name:u}=e,s=N.getDomainBox(e,t),{x1:c,x2:l,y1:f,y2:h}=s,{top:x,bottom:y,left:p,right:d}=N.getHandles(e,s),m=Math.abs(l-c)||1,v=Math.abs(h-f)||1,g=a.props&&a.props.style||{},b=n()({},g,o),M=(()=>{const t={yProps:"ns-resize",xProps:"ew-resize"};return!e.allowResize&&e.allowDrag?(t.xProps="move",t.yProps="move"):e.allowResize||e.allowDrag||(t.xProps="auto",t.yProps="auto"),t})(),w={style:b,width:m,height:r,cursor:M.yProps},D={style:b,width:r,height:v,cursor:M.xProps},B={top:x&&Object.assign({x:x.x1,y:x.y1},w),bottom:y&&Object.assign({x:y.x1,y:y.y1},w),left:p&&Object.assign({y:p.y1,x:p.x1},D),right:d&&Object.assign({y:d.y1,x:d.x1},D)},O=["top","bottom","left","right"].reduce(((t,n)=>B[n]?t.concat(i().cloneElement(a,Object.assign({key:`${u}-handle-${n}`},B[n]))):t),[]);return O.length?O:null};return{props:e,children:[...i().Children.toArray(r),...(()=>{const{currentDomain:t,cachedBrushDomain:r}=e,a=n()({},e.brushDomain,e.domain),u=_()(a,r)?n()({},t,a):a,s=(t=>{const{x:r,y:o}=t,{brushStyle:a,brushComponent:u,name:s}=e,c=u.props&&u.props.style,l=e.allowDrag||e.allowResize?"move":"auto";return r[0]!==r[1]&&o[0]!==o[1]?i().cloneElement(u,{key:`${s}-brush`,width:Math.abs(r[1]-r[0])||1,height:Math.abs(o[1]-o[0])||1,x:Math.min(r[0],r[1]),y:Math.min(o[0],o[1]),cursor:l,style:n()({},c,a)}):null})(v(e,u));return s?[s,o(u)]:[]})()]}},k=t=>{const{props:n,children:e}=$(t);return i().createElement(R,n,e)};k.role="container",k.defaultEvents=t=>{const n={...V,...t},e=(t,e)=>(r,o,i,a)=>n.disable||e?.(o)?{}:t(r,{...n,...o},i,a);return[{target:"parent",eventHandlers:{onMouseDown:e(N.onMouseDown),onTouchStart:e(N.onMouseDown),onGlobalMouseMove:e(N.onGlobalMouseMove,(t=>!t.isPanning&&!t.isSelecting)),onGlobalTouchMove:e(N.onGlobalMouseMove,(t=>!t.isPanning&&!t.isSelecting)),onGlobalMouseUp:e(N.onGlobalMouseUp),onGlobalTouchEnd:e(N.onGlobalMouseUp),onGlobalTouchCancel:e(N.onGlobalMouseUp)}}]}}(),o}()}));
|
|
2
2
|
//# sourceMappingURL=victory-brush-container.min.js.map
|
package/es/brush-helpers.js
CHANGED
|
@@ -255,7 +255,6 @@ const Helpers = {
|
|
|
255
255
|
return xMoved || yMoved;
|
|
256
256
|
}
|
|
257
257
|
},
|
|
258
|
-
// eslint-disable-next-line max-statements, complexity
|
|
259
258
|
onMouseDown(evt, targetProps) {
|
|
260
259
|
evt.preventDefault();
|
|
261
260
|
const {
|
|
@@ -348,7 +347,6 @@ const Helpers = {
|
|
|
348
347
|
})
|
|
349
348
|
}] : {};
|
|
350
349
|
},
|
|
351
|
-
// eslint-disable-next-line max-statements, complexity
|
|
352
350
|
onGlobalMouseMove(evt, targetProps) {
|
|
353
351
|
const {
|
|
354
352
|
scale,
|
|
@@ -435,13 +433,11 @@ const Helpers = {
|
|
|
435
433
|
}
|
|
436
434
|
return {};
|
|
437
435
|
},
|
|
438
|
-
// eslint-disable-next-line complexity
|
|
439
436
|
onGlobalMouseUp(evt, targetProps) {
|
|
440
437
|
// if a panning or selection has not been started, ignore the event
|
|
441
438
|
if (!targetProps.isPanning && !targetProps.isSelecting) {
|
|
442
439
|
return {};
|
|
443
440
|
}
|
|
444
|
-
// eslint-disable-line max-statements, complexity
|
|
445
441
|
const {
|
|
446
442
|
x1,
|
|
447
443
|
y1,
|
package/lib/brush-helpers.js
CHANGED
|
@@ -262,7 +262,6 @@ const Helpers = {
|
|
|
262
262
|
return xMoved || yMoved;
|
|
263
263
|
}
|
|
264
264
|
},
|
|
265
|
-
// eslint-disable-next-line max-statements, complexity
|
|
266
265
|
onMouseDown(evt, targetProps) {
|
|
267
266
|
evt.preventDefault();
|
|
268
267
|
const {
|
|
@@ -355,7 +354,6 @@ const Helpers = {
|
|
|
355
354
|
})
|
|
356
355
|
}] : {};
|
|
357
356
|
},
|
|
358
|
-
// eslint-disable-next-line max-statements, complexity
|
|
359
357
|
onGlobalMouseMove(evt, targetProps) {
|
|
360
358
|
const {
|
|
361
359
|
scale,
|
|
@@ -442,13 +440,11 @@ const Helpers = {
|
|
|
442
440
|
}
|
|
443
441
|
return {};
|
|
444
442
|
},
|
|
445
|
-
// eslint-disable-next-line complexity
|
|
446
443
|
onGlobalMouseUp(evt, targetProps) {
|
|
447
444
|
// if a panning or selection has not been started, ignore the event
|
|
448
445
|
if (!targetProps.isPanning && !targetProps.isSelecting) {
|
|
449
446
|
return {};
|
|
450
447
|
}
|
|
451
|
-
// eslint-disable-line max-statements, complexity
|
|
452
448
|
const {
|
|
453
449
|
x1,
|
|
454
450
|
y1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-brush-container",
|
|
3
|
-
"version": "37.3.
|
|
3
|
+
"version": "37.3.2",
|
|
4
4
|
"description": "Interactive Brush Component for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lodash": "^4.17.19",
|
|
24
24
|
"react-fast-compare": "^3.2.0",
|
|
25
|
-
"victory-core": "37.3.
|
|
25
|
+
"victory-core": "37.3.2"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": ">=16.6.0"
|
|
@@ -208,11 +208,9 @@
|
|
|
208
208
|
]
|
|
209
209
|
},
|
|
210
210
|
"lint": {
|
|
211
|
-
"command": "
|
|
211
|
+
"command": "eslint src",
|
|
212
212
|
"files": [
|
|
213
|
-
"src/**"
|
|
214
|
-
"../../.eslintignore",
|
|
215
|
-
"../../.eslintrc.js"
|
|
213
|
+
"src/**"
|
|
216
214
|
],
|
|
217
215
|
"output": [],
|
|
218
216
|
"dependencies": [
|
|
@@ -225,11 +223,9 @@
|
|
|
225
223
|
]
|
|
226
224
|
},
|
|
227
225
|
"lint:fix": {
|
|
228
|
-
"command": "
|
|
226
|
+
"command": "eslint --fix src",
|
|
229
227
|
"files": [
|
|
230
|
-
"src/**"
|
|
231
|
-
"../../.eslintignore",
|
|
232
|
-
"../../.eslintrc.js"
|
|
228
|
+
"src/**"
|
|
233
229
|
],
|
|
234
230
|
"output": [],
|
|
235
231
|
"dependencies": [
|
package/src/brush-helpers.ts
CHANGED
|
@@ -222,7 +222,6 @@ const Helpers = {
|
|
|
222
222
|
}
|
|
223
223
|
},
|
|
224
224
|
|
|
225
|
-
// eslint-disable-next-line max-statements, complexity
|
|
226
225
|
onMouseDown(evt, targetProps) {
|
|
227
226
|
evt.preventDefault();
|
|
228
227
|
const {
|
|
@@ -324,7 +323,6 @@ const Helpers = {
|
|
|
324
323
|
: {};
|
|
325
324
|
},
|
|
326
325
|
|
|
327
|
-
// eslint-disable-next-line max-statements, complexity
|
|
328
326
|
onGlobalMouseMove(evt, targetProps) {
|
|
329
327
|
const {
|
|
330
328
|
scale,
|
|
@@ -416,13 +414,12 @@ const Helpers = {
|
|
|
416
414
|
return {};
|
|
417
415
|
},
|
|
418
416
|
|
|
419
|
-
// eslint-disable-next-line complexity
|
|
420
417
|
onGlobalMouseUp(evt, targetProps) {
|
|
421
418
|
// if a panning or selection has not been started, ignore the event
|
|
422
419
|
if (!targetProps.isPanning && !targetProps.isSelecting) {
|
|
423
420
|
return {};
|
|
424
421
|
}
|
|
425
|
-
|
|
422
|
+
|
|
426
423
|
const {
|
|
427
424
|
x1,
|
|
428
425
|
y1,
|