Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

victory-zoom-container

Package Overview
Dependencies
Maintainers
24
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

victory-zoom-container - npm Package Compare versions

Comparing version 36.3.2 to 36.4.0

194

es/victory-zoom-container.js
import _isFunction from "lodash/isFunction";
import _defaults from "lodash/defaults";
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -20,10 +24,20 @@

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import PropTypes from "prop-types";

@@ -35,13 +49,13 @@ import React from "react";

export var zoomContainerMixin = function (base) {
var _class, _temp;
var _class;
return _temp = _class =
/*#__PURE__*/
function (_base) {
return _class = /*#__PURE__*/function (_base) {
_inherits(VictoryZoomContainer, _base);
var _super = _createSuper(VictoryZoomContainer);
function VictoryZoomContainer() {
_classCallCheck(this, VictoryZoomContainer);
return _possibleConstructorReturn(this, (VictoryZoomContainer.__proto__ || Object.getPrototypeOf(VictoryZoomContainer)).apply(this, arguments));
return _super.apply(this, arguments);
}

@@ -62,3 +76,3 @@

var radius = Math.max.apply(Math, _toConsumableArray(rangeY));
var groupComponent = React.cloneElement(clipContainerComponent, _objectSpread({
var groupComponent = /*#__PURE__*/React.cloneElement(clipContainerComponent, _objectSpread({
clipWidth: plottableWidth,

@@ -76,3 +90,3 @@ clipHeight: plottableHeight,

} else {
return React.cloneElement(child, {
return /*#__PURE__*/React.cloneElement(child, {
groupComponent: groupComponent

@@ -173,3 +187,3 @@ });

// if zooming is restricted to a dimension, don't squash changes to zoomDomain in other dim
newDomain = _objectSpread({}, zoomDomain, _defineProperty({}, props.zoomDimension, newDomain[props.zoomDimension]));
newDomain = _objectSpread(_objectSpread({}, zoomDomain), {}, _defineProperty({}, props.zoomDimension, newDomain[props.zoomDimension]));
} // don't downsample stacked data

@@ -184,3 +198,3 @@

};
return React.cloneElement(child, _defaults(newProps, child.props));
return /*#__PURE__*/React.cloneElement(child, _defaults(newProps, child.props));
});

@@ -198,88 +212,68 @@ } // Overrides method in VictoryContainer

return VictoryZoomContainer;
}(base), Object.defineProperty(_class, "displayName", {
configurable: true,
enumerable: true,
writable: true,
value: "VictoryZoomContainer"
}), Object.defineProperty(_class, "propTypes", {
configurable: true,
enumerable: true,
writable: true,
value: _objectSpread({}, VictoryContainer.propTypes, {
allowPan: PropTypes.bool,
allowZoom: PropTypes.bool,
clipContainerComponent: PropTypes.element.isRequired,
disable: PropTypes.bool,
downsample: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
minimumZoom: PropTypes.shape({
x: PropTypes.number,
y: PropTypes.number
}),
onZoomDomainChange: PropTypes.func,
zoomDimension: PropTypes.oneOf(["x", "y"]),
zoomDomain: PropTypes.shape({
x: CustomPropTypes.domain,
y: CustomPropTypes.domain
})
}(base), _defineProperty(_class, "displayName", "VictoryZoomContainer"), _defineProperty(_class, "propTypes", _objectSpread(_objectSpread({}, VictoryContainer.propTypes), {}, {
allowPan: PropTypes.bool,
allowZoom: PropTypes.bool,
clipContainerComponent: PropTypes.element.isRequired,
disable: PropTypes.bool,
downsample: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
minimumZoom: PropTypes.shape({
x: PropTypes.number,
y: PropTypes.number
}),
onZoomDomainChange: PropTypes.func,
zoomDimension: PropTypes.oneOf(["x", "y"]),
zoomDomain: PropTypes.shape({
x: CustomPropTypes.domain,
y: CustomPropTypes.domain
})
}), Object.defineProperty(_class, "defaultProps", {
configurable: true,
enumerable: true,
writable: true,
value: _objectSpread({}, VictoryContainer.defaultProps, {
clipContainerComponent: React.createElement(VictoryClipContainer, null),
allowPan: true,
allowZoom: true,
zoomActive: false
})
}), Object.defineProperty(_class, "defaultEvents", {
configurable: true,
enumerable: true,
writable: true,
value: function (props) {
return [{
target: "parent",
eventHandlers: _objectSpread({
onMouseDown: function (evt, targetProps) {
return props.disable ? {} : ZoomHelpers.onMouseDown(evt, targetProps);
},
onTouchStart: function (evt, targetProps) {
return props.disable ? {} : ZoomHelpers.onMouseDown(evt, targetProps);
},
onMouseUp: function (evt, targetProps) {
return props.disable ? {} : ZoomHelpers.onMouseUp(evt, targetProps);
},
onTouchEnd: function (evt, targetProps) {
return props.disable ? {} : ZoomHelpers.onMouseUp(evt, targetProps);
},
onMouseLeave: function (evt, targetProps) {
return props.disable ? {} : ZoomHelpers.onMouseLeave(evt, targetProps);
},
onTouchCancel: function (evt, targetProps) {
return props.disable ? {} : ZoomHelpers.onMouseLeave(evt, targetProps);
},
// eslint-disable-next-line max-params
onMouseMove: function (evt, targetProps, eventKey, ctx) {
if (props.disable) {
return {};
}
})), _defineProperty(_class, "defaultProps", _objectSpread(_objectSpread({}, VictoryContainer.defaultProps), {}, {
clipContainerComponent: /*#__PURE__*/React.createElement(VictoryClipContainer, null),
allowPan: true,
allowZoom: true,
zoomActive: false
})), _defineProperty(_class, "defaultEvents", function (props) {
return [{
target: "parent",
eventHandlers: _objectSpread({
onMouseDown: function (evt, targetProps) {
return props.disable ? {} : ZoomHelpers.onMouseDown(evt, targetProps);
},
onTouchStart: function (evt, targetProps) {
return props.disable ? {} : ZoomHelpers.onMouseDown(evt, targetProps);
},
onMouseUp: function (evt, targetProps) {
return props.disable ? {} : ZoomHelpers.onMouseUp(evt, targetProps);
},
onTouchEnd: function (evt, targetProps) {
return props.disable ? {} : ZoomHelpers.onMouseUp(evt, targetProps);
},
onMouseLeave: function (evt, targetProps) {
return props.disable ? {} : ZoomHelpers.onMouseLeave(evt, targetProps);
},
onTouchCancel: function (evt, targetProps) {
return props.disable ? {} : ZoomHelpers.onMouseLeave(evt, targetProps);
},
// eslint-disable-next-line max-params
onMouseMove: function (evt, targetProps, eventKey, ctx) {
if (props.disable) {
return {};
}
return ZoomHelpers.onMouseMove(evt, targetProps, eventKey, ctx);
},
// eslint-disable-next-line max-params
onTouchMove: function (evt, targetProps, eventKey, ctx) {
if (props.disable) {
return {};
}
return ZoomHelpers.onMouseMove(evt, targetProps, eventKey, ctx);
},
// eslint-disable-next-line max-params
onTouchMove: function (evt, targetProps, eventKey, ctx) {
if (props.disable) {
return {};
}
evt.preventDefault();
return ZoomHelpers.onMouseMove(evt, targetProps, eventKey, ctx);
}
}, props.disable || !props.allowZoom ? {} : {
onWheel: ZoomHelpers.onWheel
})
}];
}
}), _temp;
evt.preventDefault();
return ZoomHelpers.onMouseMove(evt, targetProps, eventKey, ctx);
}
}, props.disable || !props.allowZoom ? {} : {
onWheel: ZoomHelpers.onWheel
})
}];
}), _class;
};
export default zoomContainerMixin(VictoryContainer);

@@ -8,8 +8,12 @@ import _delay from "lodash/delay";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

@@ -60,5 +64,5 @@

var _getDomain$axis = _slicedToArray(this.getDomain(props)[axis], 2),
fromBound = _getDomain$axis[0],
toBound = _getDomain$axis[1];
var _this$getDomain$axis = _slicedToArray(this.getDomain(props)[axis], 2),
fromBound = _this$getDomain$axis[0],
toBound = _this$getDomain$axis[1];

@@ -69,6 +73,6 @@ var percent = this.getScalePercent(evt, props, axis);

var _getScaledDomain = this.getScaledDomain(currentDomain, factor, percent),
_getScaledDomain2 = _slicedToArray(_getScaledDomain, 2),
newMin = _getScaledDomain2[0],
newMax = _getScaledDomain2[1];
var _this$getScaledDomain = this.getScaledDomain(currentDomain, factor, percent),
_this$getScaledDomain2 = _slicedToArray(_this$getScaledDomain, 2),
newMin = _this$getScaledDomain2[0],
newMax = _this$getScaledDomain2[1];

@@ -75,0 +79,0 @@ var newDomain = [newMin > fromBound && newMin < toBound ? newMin : fromBound, newMax < toBound && newMax > fromBound ? newMax : toBound];

@@ -6,6 +6,6 @@ "use strict";

});
Object.defineProperty(exports, "zoomContainerMixin", {
Object.defineProperty(exports, "RawZoomHelpers", {
enumerable: true,
get: function () {
return _victoryZoomContainer.zoomContainerMixin;
return _zoomHelpers.RawZoomHelpers;
}

@@ -25,6 +25,6 @@ });

});
Object.defineProperty(exports, "RawZoomHelpers", {
Object.defineProperty(exports, "zoomContainerMixin", {
enumerable: true,
get: function () {
return _zoomHelpers.RawZoomHelpers;
return _victoryZoomContainer.zoomContainerMixin;
}

@@ -37,2 +37,4 @@ });

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

@@ -6,3 +6,3 @@ "use strict";

});
exports.default = exports.zoomContainerMixin = void 0;
exports.zoomContainerMixin = exports.default = void 0;

@@ -23,14 +23,18 @@ var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -40,24 +44,34 @@

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var DEFAULT_DOWNSAMPLE = 150;
var zoomContainerMixin = function (base) {
var _class, _temp;
var _class;
return _temp = _class =
/*#__PURE__*/
function (_base) {
return _class = /*#__PURE__*/function (_base) {
_inherits(VictoryZoomContainer, _base);
var _super = _createSuper(VictoryZoomContainer);
function VictoryZoomContainer() {
_classCallCheck(this, VictoryZoomContainer);
return _possibleConstructorReturn(this, (VictoryZoomContainer.__proto__ || Object.getPrototypeOf(VictoryZoomContainer)).apply(this, arguments));
return _super.apply(this, arguments);
}

@@ -79,3 +93,3 @@

var groupComponent = _react.default.cloneElement(clipContainerComponent, _objectSpread({
var groupComponent = /*#__PURE__*/_react.default.cloneElement(clipContainerComponent, _objectSpread({
clipWidth: plottableWidth,

@@ -94,3 +108,3 @@ clipHeight: plottableHeight,

} else {
return _react.default.cloneElement(child, {
return /*#__PURE__*/_react.default.cloneElement(child, {
groupComponent: groupComponent

@@ -190,3 +204,3 @@ });

// if zooming is restricted to a dimension, don't squash changes to zoomDomain in other dim
newDomain = _objectSpread({}, zoomDomain, _defineProperty({}, props.zoomDimension, newDomain[props.zoomDimension]));
newDomain = _objectSpread(_objectSpread({}, zoomDomain), {}, _defineProperty({}, props.zoomDimension, newDomain[props.zoomDimension]));
} // don't downsample stacked data

@@ -201,3 +215,3 @@

};
return _react.default.cloneElement(child, (0, _defaults2.default)(newProps, child.props));
return /*#__PURE__*/_react.default.cloneElement(child, (0, _defaults2.default)(newProps, child.props));
});

@@ -215,87 +229,67 @@ } // Overrides method in VictoryContainer

return VictoryZoomContainer;
}(base), Object.defineProperty(_class, "displayName", {
configurable: true,
enumerable: true,
writable: true,
value: "VictoryZoomContainer"
}), Object.defineProperty(_class, "propTypes", {
configurable: true,
enumerable: true,
writable: true,
value: _objectSpread({}, _victoryCore.VictoryContainer.propTypes, {
allowPan: _propTypes.default.bool,
allowZoom: _propTypes.default.bool,
clipContainerComponent: _propTypes.default.element.isRequired,
disable: _propTypes.default.bool,
downsample: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.number]),
minimumZoom: _propTypes.default.shape({
x: _propTypes.default.number,
y: _propTypes.default.number
}),
onZoomDomainChange: _propTypes.default.func,
zoomDimension: _propTypes.default.oneOf(["x", "y"]),
zoomDomain: _propTypes.default.shape({
x: _victoryCore.PropTypes.domain,
y: _victoryCore.PropTypes.domain
})
}(base), _defineProperty(_class, "displayName", "VictoryZoomContainer"), _defineProperty(_class, "propTypes", _objectSpread(_objectSpread({}, _victoryCore.VictoryContainer.propTypes), {}, {
allowPan: _propTypes.default.bool,
allowZoom: _propTypes.default.bool,
clipContainerComponent: _propTypes.default.element.isRequired,
disable: _propTypes.default.bool,
downsample: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.number]),
minimumZoom: _propTypes.default.shape({
x: _propTypes.default.number,
y: _propTypes.default.number
}),
onZoomDomainChange: _propTypes.default.func,
zoomDimension: _propTypes.default.oneOf(["x", "y"]),
zoomDomain: _propTypes.default.shape({
x: _victoryCore.PropTypes.domain,
y: _victoryCore.PropTypes.domain
})
}), Object.defineProperty(_class, "defaultProps", {
configurable: true,
enumerable: true,
writable: true,
value: _objectSpread({}, _victoryCore.VictoryContainer.defaultProps, {
clipContainerComponent: _react.default.createElement(_victoryCore.VictoryClipContainer, null),
allowPan: true,
allowZoom: true,
zoomActive: false
})
}), Object.defineProperty(_class, "defaultEvents", {
configurable: true,
enumerable: true,
writable: true,
value: function (props) {
return [{
target: "parent",
eventHandlers: _objectSpread({
onMouseDown: function (evt, targetProps) {
return props.disable ? {} : _zoomHelpers.default.onMouseDown(evt, targetProps);
},
onTouchStart: function (evt, targetProps) {
return props.disable ? {} : _zoomHelpers.default.onMouseDown(evt, targetProps);
},
onMouseUp: function (evt, targetProps) {
return props.disable ? {} : _zoomHelpers.default.onMouseUp(evt, targetProps);
},
onTouchEnd: function (evt, targetProps) {
return props.disable ? {} : _zoomHelpers.default.onMouseUp(evt, targetProps);
},
onMouseLeave: function (evt, targetProps) {
return props.disable ? {} : _zoomHelpers.default.onMouseLeave(evt, targetProps);
},
onTouchCancel: function (evt, targetProps) {
return props.disable ? {} : _zoomHelpers.default.onMouseLeave(evt, targetProps);
},
// eslint-disable-next-line max-params
onMouseMove: function (evt, targetProps, eventKey, ctx) {
if (props.disable) {
return {};
}
})), _defineProperty(_class, "defaultProps", _objectSpread(_objectSpread({}, _victoryCore.VictoryContainer.defaultProps), {}, {
clipContainerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryClipContainer, null),
allowPan: true,
allowZoom: true,
zoomActive: false
})), _defineProperty(_class, "defaultEvents", function (props) {
return [{
target: "parent",
eventHandlers: _objectSpread({
onMouseDown: function (evt, targetProps) {
return props.disable ? {} : _zoomHelpers.default.onMouseDown(evt, targetProps);
},
onTouchStart: function (evt, targetProps) {
return props.disable ? {} : _zoomHelpers.default.onMouseDown(evt, targetProps);
},
onMouseUp: function (evt, targetProps) {
return props.disable ? {} : _zoomHelpers.default.onMouseUp(evt, targetProps);
},
onTouchEnd: function (evt, targetProps) {
return props.disable ? {} : _zoomHelpers.default.onMouseUp(evt, targetProps);
},
onMouseLeave: function (evt, targetProps) {
return props.disable ? {} : _zoomHelpers.default.onMouseLeave(evt, targetProps);
},
onTouchCancel: function (evt, targetProps) {
return props.disable ? {} : _zoomHelpers.default.onMouseLeave(evt, targetProps);
},
// eslint-disable-next-line max-params
onMouseMove: function (evt, targetProps, eventKey, ctx) {
if (props.disable) {
return {};
}
return _zoomHelpers.default.onMouseMove(evt, targetProps, eventKey, ctx);
},
// eslint-disable-next-line max-params
onTouchMove: function (evt, targetProps, eventKey, ctx) {
if (props.disable) {
return {};
}
return _zoomHelpers.default.onMouseMove(evt, targetProps, eventKey, ctx);
},
// eslint-disable-next-line max-params
onTouchMove: function (evt, targetProps, eventKey, ctx) {
if (props.disable) {
return {};
}
evt.preventDefault();
return _zoomHelpers.default.onMouseMove(evt, targetProps, eventKey, ctx);
}
}, props.disable || !props.allowZoom ? {} : {
onWheel: _zoomHelpers.default.onWheel
})
}];
}
}), _temp;
evt.preventDefault();
return _zoomHelpers.default.onMouseMove(evt, targetProps, eventKey, ctx);
}
}, props.disable || !props.allowZoom ? {} : {
onWheel: _zoomHelpers.default.onWheel
})
}];
}), _class;
};

@@ -302,0 +296,0 @@

@@ -24,8 +24,12 @@ "use strict";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

@@ -73,5 +77,5 @@

var _getDomain$axis = _slicedToArray(this.getDomain(props)[axis], 2),
fromBound = _getDomain$axis[0],
toBound = _getDomain$axis[1];
var _this$getDomain$axis = _slicedToArray(this.getDomain(props)[axis], 2),
fromBound = _this$getDomain$axis[0],
toBound = _this$getDomain$axis[1];

@@ -82,6 +86,6 @@ var percent = this.getScalePercent(evt, props, axis);

var _getScaledDomain = this.getScaledDomain(currentDomain, factor, percent),
_getScaledDomain2 = _slicedToArray(_getScaledDomain, 2),
newMin = _getScaledDomain2[0],
newMax = _getScaledDomain2[1];
var _this$getScaledDomain = this.getScaledDomain(currentDomain, factor, percent),
_this$getScaledDomain2 = _slicedToArray(_this$getScaledDomain, 2),
newMin = _this$getScaledDomain2[0],
newMax = _this$getScaledDomain2[1];

@@ -88,0 +92,0 @@ var newDomain = [newMin > fromBound && newMin < toBound ? newMin : fromBound, newMax < toBound && newMax > fromBound ? newMax : toBound];

{
"name": "victory-zoom-container",
"version": "36.3.2",
"version": "36.4.0",
"description": "Interactive Zoom Component for Victory",

@@ -24,3 +24,3 @@ "keywords": [

"prop-types": "^15.5.8",
"victory-core": "^36.3.2"
"victory-core": "^36.4.0"
},

@@ -34,3 +34,3 @@ "peerDependencies": {

"sideEffects": false,
"gitHead": "18895d1290245732d14332bbbda10336032c9aab"
"gitHead": "2e05481eeb34f9801a90023a131a21aa7deff082"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc