victory-zoom-container
Advanced tools
Comparing version 36.8.2 to 36.8.3
# victory-zoom-container | ||
## 36.8.3 | ||
### Patch Changes | ||
- Migrate victory-zoom-container to TypeScript ([#2730](https://github.com/FormidableLabs/victory/pull/2730)) | ||
## 36.8.2 | ||
@@ -4,0 +10,0 @@ |
@@ -1,57 +0,3 @@ | ||
import * as React from "react"; | ||
import { DomainTuple, VictoryContainerProps } from "victory-core"; | ||
export type ZoomDimensionType = "x" | "y"; | ||
export interface VictoryZoomContainerProps extends VictoryContainerProps { | ||
allowPan?: boolean; | ||
allowZoom?: boolean; | ||
clipContainerComponent?: React.ReactElement; | ||
disable?: boolean; | ||
downsample?: number | boolean; | ||
minimumZoom?: { x?: number; y?: number }; | ||
onZoomDomainChange?: ( | ||
domain: { x: DomainTuple; y: DomainTuple }, | ||
props: VictoryZoomContainerProps, | ||
) => void; | ||
zoomDimension?: ZoomDimensionType; | ||
zoomDomain?: { x?: DomainTuple; y?: DomainTuple }; | ||
} | ||
export class VictoryZoomContainer extends React.Component< | ||
VictoryZoomContainerProps, | ||
any | ||
> {} | ||
export const RawZoomHelpers: { | ||
checkDomainEquality(a: any, b: any): any; | ||
scale(currentDomain: any, evt: any, props: any, axis: any): any; | ||
getScaledDomain(currentDomain: any, factor: any, percent: any): any; | ||
getMinimumDomain(point: any, props: any, axis: any): any; | ||
zoommingOut(evt: any): any; | ||
getScaleFactor(evt: any): any; | ||
getScalePercent(evt: any, props: any, axis: any): any; | ||
getPosition(evt: any, props: any, originalDomain: any): any; | ||
pan(currentDomain: any, originalDomain: any, delta: any): any; | ||
getDomainScale(domain: any, scale: any, axis: any): any; | ||
handleAnimation(ctx: any): any; | ||
getLastDomain(targetProps: any, originalDomain: any): any; | ||
getDomain(props: any): any; | ||
onMouseDown(evt: any, targetProps: any): any; | ||
onMouseUp(evt: any, targetProps: any): any; | ||
onMouseLeave(evt: any, targetProps: any): any; | ||
onMouseMove(evt: any, targetProps: any, eventKey: any, ctx: any): any; | ||
onWheel(evt: any, targetProps: any, eventKey: any, ctx: any): any; | ||
}; | ||
export const ZoomHelpers: Pick< | ||
typeof RawZoomHelpers, | ||
| "checkDomainEquality" | ||
| "onMouseDown" | ||
| "onMouseUp" | ||
| "onMouseLeave" | ||
| "onMouseMove" | ||
| "onWheel" | ||
>; | ||
export const zoomContainerMixin: (base: Function) => Function; | ||
export * from "./victory-zoom-container"; | ||
export * from "./zoom-helpers"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export { zoomContainerMixin, default as VictoryZoomContainer } from "./victory-zoom-container"; | ||
export { default as ZoomHelpers, RawZoomHelpers } from "./zoom-helpers"; | ||
export * from "./victory-zoom-container"; | ||
export * from "./zoom-helpers"; |
@@ -42,12 +42,12 @@ import _isFunction from "lodash/isFunction"; | ||
import PropTypes from "prop-types"; | ||
import React from "react"; | ||
import ZoomHelpers from "./zoom-helpers"; | ||
import { VictoryContainer, VictoryClipContainer, Data, PropTypes as CustomPropTypes } from "victory-core"; | ||
import { ZoomHelpers } from "./zoom-helpers"; | ||
import { VictoryContainer, VictoryClipContainer, Data } from "victory-core"; | ||
var DEFAULT_DOWNSAMPLE = 150; | ||
export var zoomContainerMixin = function (base) { | ||
export function zoomContainerMixin(Base) { | ||
var _class; | ||
return _class = /*#__PURE__*/function (_base) { | ||
_inherits(VictoryZoomContainer, _base); | ||
// @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'." | ||
return _class = /*#__PURE__*/function (_Base) { | ||
_inherits(VictoryZoomContainer, _Base); | ||
@@ -152,4 +152,3 @@ var _super = _createSuper(VictoryZoomContainer); | ||
var childComponents = React.Children.toArray(props.children); // eslint-disable-next-line max-statements | ||
var childComponents = React.Children.toArray(props.children); | ||
return childComponents.map(function (child) { | ||
@@ -208,19 +207,3 @@ var role = child.type && child.type.role; | ||
return VictoryZoomContainer; | ||
}(base), _class.displayName = "VictoryZoomContainer", _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 | ||
}) | ||
}), _class.defaultProps = _objectSpread(_objectSpread({}, VictoryContainer.defaultProps), {}, { | ||
}(Base), _class.displayName = "VictoryZoomContainer", _class.defaultProps = _objectSpread(_objectSpread({}, VictoryContainer.defaultProps), {}, { | ||
clipContainerComponent: /*#__PURE__*/React.createElement(VictoryClipContainer, null), | ||
@@ -274,5 +257,3 @@ allowPan: true, | ||
}, _class; | ||
}; | ||
export default zoomContainerMixin(VictoryContainer); // @ts-expect-error IMPORTANT: when converting this file to TypeScript, you must export the type as well: | ||
// export const VictoryZoomContainer = zoomContainerMixin(VictoryContainer); | ||
// export type VictoryZoomContainer = typeof VictoryZoomContainer; | ||
} | ||
export var VictoryZoomContainer = zoomContainerMixin(VictoryContainer); |
@@ -23,3 +23,3 @@ import _delay from "lodash/delay"; | ||
import { Selection, Collection, Wrapper } from "victory-core"; | ||
var RawZoomHelpers = { | ||
export var RawZoomHelpers = { | ||
checkDomainEquality: function (a, b) { | ||
@@ -388,5 +388,3 @@ var checkDimension = function (dim) { | ||
}; | ||
export { RawZoomHelpers }; // allow victory-native to extend these helpers | ||
export default { | ||
export var ZoomHelpers = { | ||
checkDomainEquality: RawZoomHelpers.checkDomainEquality.bind(RawZoomHelpers), | ||
@@ -393,0 +391,0 @@ onMouseDown: RawZoomHelpers.onMouseDown.bind(RawZoomHelpers), |
@@ -1,57 +0,3 @@ | ||
import * as React from "react"; | ||
import { DomainTuple, VictoryContainerProps } from "victory-core"; | ||
export type ZoomDimensionType = "x" | "y"; | ||
export interface VictoryZoomContainerProps extends VictoryContainerProps { | ||
allowPan?: boolean; | ||
allowZoom?: boolean; | ||
clipContainerComponent?: React.ReactElement; | ||
disable?: boolean; | ||
downsample?: number | boolean; | ||
minimumZoom?: { x?: number; y?: number }; | ||
onZoomDomainChange?: ( | ||
domain: { x: DomainTuple; y: DomainTuple }, | ||
props: VictoryZoomContainerProps, | ||
) => void; | ||
zoomDimension?: ZoomDimensionType; | ||
zoomDomain?: { x?: DomainTuple; y?: DomainTuple }; | ||
} | ||
export class VictoryZoomContainer extends React.Component< | ||
VictoryZoomContainerProps, | ||
any | ||
> {} | ||
export const RawZoomHelpers: { | ||
checkDomainEquality(a: any, b: any): any; | ||
scale(currentDomain: any, evt: any, props: any, axis: any): any; | ||
getScaledDomain(currentDomain: any, factor: any, percent: any): any; | ||
getMinimumDomain(point: any, props: any, axis: any): any; | ||
zoommingOut(evt: any): any; | ||
getScaleFactor(evt: any): any; | ||
getScalePercent(evt: any, props: any, axis: any): any; | ||
getPosition(evt: any, props: any, originalDomain: any): any; | ||
pan(currentDomain: any, originalDomain: any, delta: any): any; | ||
getDomainScale(domain: any, scale: any, axis: any): any; | ||
handleAnimation(ctx: any): any; | ||
getLastDomain(targetProps: any, originalDomain: any): any; | ||
getDomain(props: any): any; | ||
onMouseDown(evt: any, targetProps: any): any; | ||
onMouseUp(evt: any, targetProps: any): any; | ||
onMouseLeave(evt: any, targetProps: any): any; | ||
onMouseMove(evt: any, targetProps: any, eventKey: any, ctx: any): any; | ||
onWheel(evt: any, targetProps: any, eventKey: any, ctx: any): any; | ||
}; | ||
export const ZoomHelpers: Pick< | ||
typeof RawZoomHelpers, | ||
| "checkDomainEquality" | ||
| "onMouseDown" | ||
| "onMouseUp" | ||
| "onMouseLeave" | ||
| "onMouseMove" | ||
| "onWheel" | ||
>; | ||
export const zoomContainerMixin: (base: Function) => Function; | ||
export * from "./victory-zoom-container"; | ||
export * from "./zoom-helpers"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -6,33 +6,27 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "RawZoomHelpers", { | ||
enumerable: true, | ||
get: function () { | ||
return _zoomHelpers.RawZoomHelpers; | ||
} | ||
}); | ||
Object.defineProperty(exports, "VictoryZoomContainer", { | ||
enumerable: true, | ||
get: function () { | ||
return _victoryZoomContainer.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "ZoomHelpers", { | ||
enumerable: true, | ||
get: function () { | ||
return _zoomHelpers.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "zoomContainerMixin", { | ||
enumerable: true, | ||
get: function () { | ||
return _victoryZoomContainer.zoomContainerMixin; | ||
} | ||
}); | ||
var _victoryZoomContainer = _interopRequireWildcard(require("./victory-zoom-container")); | ||
var _victoryZoomContainer = require("./victory-zoom-container"); | ||
var _zoomHelpers = _interopRequireWildcard(require("./zoom-helpers")); | ||
Object.keys(_victoryZoomContainer).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _victoryZoomContainer[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _victoryZoomContainer[key]; | ||
} | ||
}); | ||
}); | ||
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); } | ||
var _zoomHelpers = require("./zoom-helpers"); | ||
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; } | ||
Object.keys(_zoomHelpers).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _zoomHelpers[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _zoomHelpers[key]; | ||
} | ||
}); | ||
}); |
@@ -6,3 +6,4 @@ "use strict"; | ||
}); | ||
exports.zoomContainerMixin = exports.default = void 0; | ||
exports.VictoryZoomContainer = void 0; | ||
exports.zoomContainerMixin = zoomContainerMixin; | ||
@@ -13,7 +14,5 @@ var _isFunction2 = _interopRequireDefault(require("lodash/isFunction")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _zoomHelpers = _interopRequireDefault(require("./zoom-helpers")); | ||
var _zoomHelpers = require("./zoom-helpers"); | ||
@@ -64,7 +63,8 @@ var _victoryCore = require("victory-core"); | ||
var zoomContainerMixin = function (base) { | ||
function zoomContainerMixin(Base) { | ||
var _class; | ||
return _class = /*#__PURE__*/function (_base) { | ||
_inherits(VictoryZoomContainer, _base); | ||
// @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'." | ||
return _class = /*#__PURE__*/function (_Base) { | ||
_inherits(VictoryZoomContainer, _Base); | ||
@@ -171,5 +171,4 @@ var _super = _createSuper(VictoryZoomContainer); | ||
var childComponents = _react.default.Children.toArray(props.children); // eslint-disable-next-line max-statements | ||
var childComponents = _react.default.Children.toArray(props.children); | ||
return childComponents.map(function (child) { | ||
@@ -188,3 +187,3 @@ var role = child.type && child.type.role; | ||
if (!_zoomHelpers.default.checkDomainEquality(zoomDomain, cachedZoomDomain)) { | ||
if (!_zoomHelpers.ZoomHelpers.checkDomainEquality(zoomDomain, cachedZoomDomain)) { | ||
// if zoomDomain has been changed, use it | ||
@@ -227,19 +226,3 @@ domain = zoomDomain; | ||
return VictoryZoomContainer; | ||
}(base), _class.displayName = "VictoryZoomContainer", _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 | ||
}) | ||
}), _class.defaultProps = _objectSpread(_objectSpread({}, _victoryCore.VictoryContainer.defaultProps), {}, { | ||
}(Base), _class.displayName = "VictoryZoomContainer", _class.defaultProps = _objectSpread(_objectSpread({}, _victoryCore.VictoryContainer.defaultProps), {}, { | ||
clipContainerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryClipContainer, null), | ||
@@ -254,18 +237,18 @@ allowPan: true, | ||
onMouseDown: function (evt, targetProps) { | ||
return props.disable ? {} : _zoomHelpers.default.onMouseDown(evt, targetProps); | ||
return props.disable ? {} : _zoomHelpers.ZoomHelpers.onMouseDown(evt, targetProps); | ||
}, | ||
onTouchStart: function (evt, targetProps) { | ||
return props.disable ? {} : _zoomHelpers.default.onMouseDown(evt, targetProps); | ||
return props.disable ? {} : _zoomHelpers.ZoomHelpers.onMouseDown(evt, targetProps); | ||
}, | ||
onMouseUp: function (evt, targetProps) { | ||
return props.disable ? {} : _zoomHelpers.default.onMouseUp(evt, targetProps); | ||
return props.disable ? {} : _zoomHelpers.ZoomHelpers.onMouseUp(evt, targetProps); | ||
}, | ||
onTouchEnd: function (evt, targetProps) { | ||
return props.disable ? {} : _zoomHelpers.default.onMouseUp(evt, targetProps); | ||
return props.disable ? {} : _zoomHelpers.ZoomHelpers.onMouseUp(evt, targetProps); | ||
}, | ||
onMouseLeave: function (evt, targetProps) { | ||
return props.disable ? {} : _zoomHelpers.default.onMouseLeave(evt, targetProps); | ||
return props.disable ? {} : _zoomHelpers.ZoomHelpers.onMouseLeave(evt, targetProps); | ||
}, | ||
onTouchCancel: function (evt, targetProps) { | ||
return props.disable ? {} : _zoomHelpers.default.onMouseLeave(evt, targetProps); | ||
return props.disable ? {} : _zoomHelpers.ZoomHelpers.onMouseLeave(evt, targetProps); | ||
}, | ||
@@ -278,3 +261,3 @@ // eslint-disable-next-line max-params | ||
return _zoomHelpers.default.onMouseMove(evt, targetProps, eventKey, ctx); | ||
return _zoomHelpers.ZoomHelpers.onMouseMove(evt, targetProps, eventKey, ctx); | ||
}, | ||
@@ -288,18 +271,12 @@ // eslint-disable-next-line max-params | ||
evt.preventDefault(); | ||
return _zoomHelpers.default.onMouseMove(evt, targetProps, eventKey, ctx); | ||
return _zoomHelpers.ZoomHelpers.onMouseMove(evt, targetProps, eventKey, ctx); | ||
} | ||
}, props.disable || !props.allowZoom ? {} : { | ||
onWheel: _zoomHelpers.default.onWheel | ||
onWheel: _zoomHelpers.ZoomHelpers.onWheel | ||
}) | ||
}]; | ||
}, _class; | ||
}; | ||
} | ||
exports.zoomContainerMixin = zoomContainerMixin; | ||
var _default = zoomContainerMixin(_victoryCore.VictoryContainer); // @ts-expect-error IMPORTANT: when converting this file to TypeScript, you must export the type as well: | ||
// export const VictoryZoomContainer = zoomContainerMixin(VictoryContainer); | ||
// export type VictoryZoomContainer = typeof VictoryZoomContainer; | ||
exports.default = _default; | ||
var VictoryZoomContainer = zoomContainerMixin(_victoryCore.VictoryContainer); | ||
exports.VictoryZoomContainer = VictoryZoomContainer; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.default = exports.RawZoomHelpers = void 0; | ||
exports.ZoomHelpers = exports.RawZoomHelpers = void 0; | ||
@@ -405,4 +405,3 @@ var _delay2 = _interopRequireDefault(require("lodash/delay")); | ||
exports.RawZoomHelpers = RawZoomHelpers; | ||
// allow victory-native to extend these helpers | ||
var _default = { | ||
var ZoomHelpers = { | ||
checkDomainEquality: RawZoomHelpers.checkDomainEquality.bind(RawZoomHelpers), | ||
@@ -423,2 +422,2 @@ onMouseDown: RawZoomHelpers.onMouseDown.bind(RawZoomHelpers), | ||
}; | ||
exports.default = _default; | ||
exports.ZoomHelpers = ZoomHelpers; |
{ | ||
"name": "victory-zoom-container", | ||
"version": "36.8.2", | ||
"version": "36.8.3", | ||
"description": "Interactive Zoom Component for Victory", | ||
@@ -25,3 +25,3 @@ "keywords": [ | ||
"prop-types": "^15.8.1", | ||
"victory-core": "^36.8.2" | ||
"victory-core": "^36.8.3" | ||
}, | ||
@@ -28,0 +28,0 @@ "peerDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1009700
21
18107
Updatedvictory-core@^36.8.3