victory-line
Advanced tools
Comparing version 36.9.1 to 36.9.2-next.0
# victory-line | ||
## 36.9.2-next.0 | ||
### Patch Changes | ||
- f6f7cc515: Replace lodash isNil and isNan with native code | ||
- 6e34169a5: Replace lodash isFunction with native code | ||
- Updated dependencies [3f2da66e3] | ||
- Updated dependencies [c13308624] | ||
- Updated dependencies [f6f7cc515] | ||
- Updated dependencies [6e34169a5] | ||
- victory-core@36.9.2-next.0 | ||
- victory-vendor@36.9.2-next.0 | ||
## 36.9.1 | ||
@@ -4,0 +17,0 @@ |
@@ -0,0 +0,0 @@ import React from "react"; |
@@ -1,12 +0,5 @@ | ||
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 _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 _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; } | ||
/* eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1, 2] }]*/ | ||
import React from "react"; | ||
import { Helpers, Path, LineHelpers, UserProps } from "victory-core"; | ||
var evaluateProps = function (props) { | ||
const evaluateProps = props => { | ||
/** | ||
@@ -19,5 +12,5 @@ * Potential evaluated props are: | ||
*/ | ||
var ariaLabel = Helpers.evaluateProp(props.ariaLabel, props); | ||
var id = Helpers.evaluateProp(props.id, props); | ||
var style = Helpers.evaluateStyle(Object.assign({ | ||
const ariaLabel = Helpers.evaluateProp(props.ariaLabel, props); | ||
const id = Helpers.evaluateProp(props.id, props); | ||
const style = Helpers.evaluateStyle(Object.assign({ | ||
fill: "none", | ||
@@ -27,12 +20,11 @@ stroke: "black", | ||
}, props.style), props); | ||
var tabIndex = Helpers.evaluateProp(props.tabIndex, props); | ||
const tabIndex = Helpers.evaluateProp(props.tabIndex, props); | ||
return Object.assign({}, props, { | ||
ariaLabel: ariaLabel, | ||
id: id, | ||
style: style, | ||
tabIndex: tabIndex | ||
ariaLabel, | ||
id, | ||
style, | ||
tabIndex | ||
}); | ||
}; | ||
var defaultProps = { | ||
const defaultProps = { | ||
pathComponent: /*#__PURE__*/React.createElement(Path, null), | ||
@@ -42,13 +34,20 @@ role: "presentation", | ||
}; | ||
export var Curve = function (initialProps) { | ||
var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps)); | ||
var userProps = UserProps.getSafeUserProps(props); | ||
var polar = props.polar, | ||
origin = props.origin; | ||
var lineFunction = LineHelpers.getLineFunction(props); | ||
var defaultTransform = polar && origin ? "translate(".concat(origin.x, ", ").concat(origin.y, ")") : undefined; | ||
var d = lineFunction(props.data); | ||
return /*#__PURE__*/React.cloneElement(props.pathComponent, _objectSpread(_objectSpread(_objectSpread({}, props.events), userProps), {}, { | ||
export const Curve = initialProps => { | ||
const props = evaluateProps({ | ||
...defaultProps, | ||
...initialProps | ||
}); | ||
const userProps = UserProps.getSafeUserProps(props); | ||
const { | ||
polar, | ||
origin | ||
} = props; | ||
const lineFunction = LineHelpers.getLineFunction(props); | ||
const defaultTransform = polar && origin ? `translate(${origin.x}, ${origin.y})` : undefined; | ||
const d = lineFunction(props.data); | ||
return /*#__PURE__*/React.cloneElement(props.pathComponent, { | ||
...props.events, | ||
...userProps, | ||
"aria-label": props.ariaLabel, | ||
d: d, | ||
d, | ||
style: props.style, | ||
@@ -61,3 +60,3 @@ transform: props.transform || defaultTransform, | ||
tabIndex: props.tabIndex | ||
})); | ||
}); | ||
}; |
export declare const getBaseProps: (initialProps: any, fallbackProps: any) => any; | ||
//# sourceMappingURL=helper-methods.d.ts.map |
@@ -1,92 +0,88 @@ | ||
import _isNil from "lodash/isNil"; | ||
import { Helpers, LabelHelpers, Data, Domain, Scale } from "victory-core"; | ||
var getCalculatedValues = function (props) { | ||
var data = Data.getData(props); | ||
const getCalculatedValues = props => { | ||
let data = Data.getData(props); | ||
if (data.length < 2) { | ||
data = []; | ||
} | ||
var range = { | ||
const range = { | ||
x: Helpers.getRange(props, "x"), | ||
y: Helpers.getRange(props, "y") | ||
}; | ||
var domain = { | ||
const domain = { | ||
x: Domain.getDomain(props, "x"), | ||
y: Domain.getDomain(props, "y") | ||
}; | ||
var scale = { | ||
const scale = { | ||
x: Scale.getBaseScale(props, "x").domain(domain.x).range(props.horizontal ? range.y : range.x), | ||
y: Scale.getBaseScale(props, "y").domain(domain.y).range(props.horizontal ? range.x : range.y) | ||
}; | ||
var origin = props.polar ? props.origin || Helpers.getPolarOrigin(props) : undefined; | ||
var defaultStyles = Helpers.getDefaultStyles(props, "line"); | ||
var style = Helpers.getStyles(props.style, defaultStyles); | ||
const origin = props.polar ? props.origin || Helpers.getPolarOrigin(props) : undefined; | ||
const defaultStyles = Helpers.getDefaultStyles(props, "line"); | ||
const style = Helpers.getStyles(props.style, defaultStyles); | ||
return { | ||
domain: domain, | ||
data: data, | ||
scale: scale, | ||
style: style, | ||
origin: origin | ||
domain, | ||
data, | ||
scale, | ||
style, | ||
origin | ||
}; | ||
}; | ||
export var getBaseProps = function (initialProps, fallbackProps) { | ||
var modifiedProps = Helpers.modifyProps(initialProps, fallbackProps, "line"); | ||
var props = Object.assign({}, modifiedProps, getCalculatedValues(modifiedProps)); | ||
var data = props.data, | ||
domain = props.domain, | ||
events = props.events, | ||
groupComponent = props.groupComponent, | ||
height = props.height, | ||
horizontal = props.horizontal, | ||
interpolation = props.interpolation, | ||
origin = props.origin, | ||
padding = props.padding, | ||
polar = props.polar, | ||
scale = props.scale, | ||
sharedEvents = props.sharedEvents, | ||
standalone = props.standalone, | ||
style = props.style, | ||
theme = props.theme, | ||
width = props.width, | ||
labels = props.labels, | ||
name = props.name, | ||
disableInlineStyles = props.disableInlineStyles; | ||
var initialChildProps = { | ||
export const getBaseProps = (initialProps, fallbackProps) => { | ||
const modifiedProps = Helpers.modifyProps(initialProps, fallbackProps, "line"); | ||
const props = Object.assign({}, modifiedProps, getCalculatedValues(modifiedProps)); | ||
const { | ||
data, | ||
domain, | ||
events, | ||
groupComponent, | ||
height, | ||
horizontal, | ||
interpolation, | ||
origin, | ||
padding, | ||
polar, | ||
scale, | ||
sharedEvents, | ||
standalone, | ||
style, | ||
theme, | ||
width, | ||
labels, | ||
name, | ||
disableInlineStyles | ||
} = props; | ||
const initialChildProps = { | ||
parent: { | ||
style: style.parent, | ||
scale: scale, | ||
data: data, | ||
height: height, | ||
width: width, | ||
name: name, | ||
domain: domain, | ||
standalone: standalone, | ||
polar: polar, | ||
origin: origin, | ||
padding: padding, | ||
horizontal: horizontal | ||
scale, | ||
data, | ||
height, | ||
width, | ||
name, | ||
domain, | ||
standalone, | ||
polar, | ||
origin, | ||
padding, | ||
horizontal | ||
}, | ||
all: { | ||
data: { | ||
horizontal: horizontal, | ||
polar: polar, | ||
origin: origin, | ||
scale: scale, | ||
data: data, | ||
interpolation: interpolation, | ||
groupComponent: groupComponent, | ||
horizontal, | ||
polar, | ||
origin, | ||
scale, | ||
data, | ||
interpolation, | ||
groupComponent, | ||
style: disableInlineStyles ? {} : style.data, | ||
theme: theme, | ||
disableInlineStyles: disableInlineStyles | ||
theme, | ||
disableInlineStyles | ||
} | ||
} | ||
}; | ||
return data.reduce(function (childProps, datum, index) { | ||
var text = LabelHelpers.getText(props, datum, index); | ||
return data.reduce((childProps, datum, index) => { | ||
const text = LabelHelpers.getText(props, datum, index); | ||
if (text !== undefined && text !== null || labels && (events || sharedEvents)) { | ||
var eventKey = !_isNil(datum.eventKey) ? datum.eventKey : index; | ||
const eventKey = !Helpers.isNil(datum.eventKey) ? datum.eventKey : index; | ||
childProps[eventKey] = { | ||
@@ -96,5 +92,4 @@ labels: LabelHelpers.getProps(props, index) | ||
} | ||
return childProps; | ||
}, initialChildProps); | ||
}; |
export * from "./victory-line"; | ||
export * from "./curve"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -0,0 +0,0 @@ import React from "react"; |
@@ -1,21 +0,1 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
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 _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 ? Object.setPrototypeOf.bind() : 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 _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.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
import React from "react"; | ||
@@ -25,3 +5,3 @@ import { getBaseProps } from "./helper-methods"; | ||
import { Helpers, VictoryLabel, addEvents, VictoryContainer, VictoryTheme, DefaultTransitions, VictoryClipContainer, Data, Domain, UserProps } from "victory-core"; | ||
var fallbackProps = { | ||
const fallbackProps = { | ||
width: 450, | ||
@@ -32,3 +12,3 @@ height: 300, | ||
}; | ||
var options = { | ||
const options = { | ||
components: [{ | ||
@@ -43,68 +23,52 @@ name: "parent", | ||
}] | ||
}; // eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
}; | ||
var VictoryLineBase = /*#__PURE__*/function (_React$Component) { | ||
_inherits(VictoryLineBase, _React$Component); | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
var _super = _createSuper(VictoryLineBase); | ||
class VictoryLineBase extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
static animationWhitelist = ["data", "domain", "height", "padding", "samples", "style", "width"]; | ||
static displayName = "VictoryLine"; | ||
static role = "line"; | ||
static defaultTransitions = DefaultTransitions.continuousTransitions(); | ||
static defaultPolarTransitions = DefaultTransitions.continuousPolarTransitions(); | ||
static continuous = true; | ||
static defaultProps = { | ||
containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null), | ||
dataComponent: /*#__PURE__*/React.createElement(Curve, null), | ||
labelComponent: /*#__PURE__*/React.createElement(VictoryLabel, { | ||
renderInPortal: true | ||
}), | ||
groupComponent: /*#__PURE__*/React.createElement(VictoryClipContainer, null), | ||
samples: 50, | ||
sortKey: "x", | ||
sortOrder: "ascending", | ||
standalone: true, | ||
theme: VictoryTheme.grayscale | ||
}; | ||
static getDomain = Domain.getDomain; | ||
static getData = Data.getData; | ||
static getBaseProps = props => getBaseProps(props, fallbackProps); | ||
static expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"]; | ||
function VictoryLineBase(props) { | ||
_classCallCheck(this, VictoryLineBase); | ||
return _super.call(this, props); | ||
// Overridden in native versions | ||
shouldAnimate() { | ||
return !!this.props.animate; | ||
} | ||
_createClass(VictoryLineBase, [{ | ||
key: "shouldAnimate", | ||
value: // Overridden in native versions | ||
function shouldAnimate() { | ||
return !!this.props.animate; | ||
render() { | ||
const { | ||
animationWhitelist, | ||
role | ||
} = VictoryLineBase; | ||
const props = Helpers.modifyProps(this.props, fallbackProps, role); | ||
if (this.shouldAnimate()) { | ||
return this.animateComponent(props, animationWhitelist); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var animationWhitelist = VictoryLineBase.animationWhitelist, | ||
role = VictoryLineBase.role; | ||
var props = Helpers.modifyProps(this.props, fallbackProps, role); | ||
if (this.shouldAnimate()) { | ||
return this.animateComponent(props, animationWhitelist); | ||
} | ||
var children = this.renderContinuousData(props); | ||
var component = props.standalone ? this.renderContainer(props.containerComponent, children) : children; | ||
return UserProps.withSafeUserProps(component, props); | ||
} | ||
}]); | ||
return VictoryLineBase; | ||
}(React.Component); | ||
VictoryLineBase.animationWhitelist = ["data", "domain", "height", "padding", "samples", "style", "width"]; | ||
VictoryLineBase.displayName = "VictoryLine"; | ||
VictoryLineBase.role = "line"; | ||
VictoryLineBase.defaultTransitions = DefaultTransitions.continuousTransitions(); | ||
VictoryLineBase.defaultPolarTransitions = DefaultTransitions.continuousPolarTransitions(); | ||
VictoryLineBase.continuous = true; | ||
VictoryLineBase.defaultProps = { | ||
containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null), | ||
dataComponent: /*#__PURE__*/React.createElement(Curve, null), | ||
labelComponent: /*#__PURE__*/React.createElement(VictoryLabel, { | ||
renderInPortal: true | ||
}), | ||
groupComponent: /*#__PURE__*/React.createElement(VictoryClipContainer, null), | ||
samples: 50, | ||
sortKey: "x", | ||
sortOrder: "ascending", | ||
standalone: true, | ||
theme: VictoryTheme.grayscale | ||
}; | ||
VictoryLineBase.getDomain = Domain.getDomain; | ||
VictoryLineBase.getData = Data.getData; | ||
VictoryLineBase.getBaseProps = function (props) { | ||
return getBaseProps(props, fallbackProps); | ||
}; | ||
VictoryLineBase.expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"]; | ||
export var VictoryLine = addEvents(VictoryLineBase, options); | ||
const children = this.renderContinuousData(props); | ||
const component = props.standalone ? this.renderContainer(props.containerComponent, children) : children; | ||
return UserProps.withSafeUserProps(component, props); | ||
} | ||
} | ||
export const VictoryLine = addEvents(VictoryLineBase, options); |
@@ -0,0 +0,0 @@ import React from "react"; |
@@ -7,16 +7,8 @@ "use strict"; | ||
exports.Curve = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _victoryCore = require("victory-core"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1, 2] }]*/ | ||
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 _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 _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 evaluateProps = function (props) { | ||
const evaluateProps = props => { | ||
/** | ||
@@ -29,7 +21,5 @@ * Potential evaluated props are: | ||
*/ | ||
var ariaLabel = _victoryCore.Helpers.evaluateProp(props.ariaLabel, props); | ||
var id = _victoryCore.Helpers.evaluateProp(props.id, props); | ||
var style = _victoryCore.Helpers.evaluateStyle(Object.assign({ | ||
const ariaLabel = _victoryCore.Helpers.evaluateProp(props.ariaLabel, props); | ||
const id = _victoryCore.Helpers.evaluateProp(props.id, props); | ||
const style = _victoryCore.Helpers.evaluateStyle(Object.assign({ | ||
fill: "none", | ||
@@ -39,14 +29,11 @@ stroke: "black", | ||
}, props.style), props); | ||
var tabIndex = _victoryCore.Helpers.evaluateProp(props.tabIndex, props); | ||
const tabIndex = _victoryCore.Helpers.evaluateProp(props.tabIndex, props); | ||
return Object.assign({}, props, { | ||
ariaLabel: ariaLabel, | ||
id: id, | ||
style: style, | ||
tabIndex: tabIndex | ||
ariaLabel, | ||
id, | ||
style, | ||
tabIndex | ||
}); | ||
}; | ||
var defaultProps = { | ||
const defaultProps = { | ||
pathComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Path, null), | ||
@@ -56,18 +43,20 @@ role: "presentation", | ||
}; | ||
var Curve = function (initialProps) { | ||
var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps)); | ||
var userProps = _victoryCore.UserProps.getSafeUserProps(props); | ||
var polar = props.polar, | ||
origin = props.origin; | ||
var lineFunction = _victoryCore.LineHelpers.getLineFunction(props); | ||
var defaultTransform = polar && origin ? "translate(".concat(origin.x, ", ").concat(origin.y, ")") : undefined; | ||
var d = lineFunction(props.data); | ||
return /*#__PURE__*/_react.default.cloneElement(props.pathComponent, _objectSpread(_objectSpread(_objectSpread({}, props.events), userProps), {}, { | ||
const Curve = initialProps => { | ||
const props = evaluateProps({ | ||
...defaultProps, | ||
...initialProps | ||
}); | ||
const userProps = _victoryCore.UserProps.getSafeUserProps(props); | ||
const { | ||
polar, | ||
origin | ||
} = props; | ||
const lineFunction = _victoryCore.LineHelpers.getLineFunction(props); | ||
const defaultTransform = polar && origin ? `translate(${origin.x}, ${origin.y})` : undefined; | ||
const d = lineFunction(props.data); | ||
return /*#__PURE__*/_react.default.cloneElement(props.pathComponent, { | ||
...props.events, | ||
...userProps, | ||
"aria-label": props.ariaLabel, | ||
d: d, | ||
d, | ||
style: props.style, | ||
@@ -80,5 +69,4 @@ transform: props.transform || defaultTransform, | ||
tabIndex: props.tabIndex | ||
})); | ||
}); | ||
}; | ||
exports.Curve = Curve; |
export declare const getBaseProps: (initialProps: any, fallbackProps: any) => any; | ||
//# sourceMappingURL=helper-methods.d.ts.map |
@@ -7,101 +7,89 @@ "use strict"; | ||
exports.getBaseProps = void 0; | ||
var _isNil2 = _interopRequireDefault(require("lodash/isNil")); | ||
var _victoryCore = require("victory-core"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var getCalculatedValues = function (props) { | ||
var data = _victoryCore.Data.getData(props); | ||
const getCalculatedValues = props => { | ||
let data = _victoryCore.Data.getData(props); | ||
if (data.length < 2) { | ||
data = []; | ||
} | ||
var range = { | ||
const range = { | ||
x: _victoryCore.Helpers.getRange(props, "x"), | ||
y: _victoryCore.Helpers.getRange(props, "y") | ||
}; | ||
var domain = { | ||
const domain = { | ||
x: _victoryCore.Domain.getDomain(props, "x"), | ||
y: _victoryCore.Domain.getDomain(props, "y") | ||
}; | ||
var scale = { | ||
const scale = { | ||
x: _victoryCore.Scale.getBaseScale(props, "x").domain(domain.x).range(props.horizontal ? range.y : range.x), | ||
y: _victoryCore.Scale.getBaseScale(props, "y").domain(domain.y).range(props.horizontal ? range.x : range.y) | ||
}; | ||
var origin = props.polar ? props.origin || _victoryCore.Helpers.getPolarOrigin(props) : undefined; | ||
var defaultStyles = _victoryCore.Helpers.getDefaultStyles(props, "line"); | ||
var style = _victoryCore.Helpers.getStyles(props.style, defaultStyles); | ||
const origin = props.polar ? props.origin || _victoryCore.Helpers.getPolarOrigin(props) : undefined; | ||
const defaultStyles = _victoryCore.Helpers.getDefaultStyles(props, "line"); | ||
const style = _victoryCore.Helpers.getStyles(props.style, defaultStyles); | ||
return { | ||
domain: domain, | ||
data: data, | ||
scale: scale, | ||
style: style, | ||
origin: origin | ||
domain, | ||
data, | ||
scale, | ||
style, | ||
origin | ||
}; | ||
}; | ||
var getBaseProps = function (initialProps, fallbackProps) { | ||
var modifiedProps = _victoryCore.Helpers.modifyProps(initialProps, fallbackProps, "line"); | ||
var props = Object.assign({}, modifiedProps, getCalculatedValues(modifiedProps)); | ||
var data = props.data, | ||
domain = props.domain, | ||
events = props.events, | ||
groupComponent = props.groupComponent, | ||
height = props.height, | ||
horizontal = props.horizontal, | ||
interpolation = props.interpolation, | ||
origin = props.origin, | ||
padding = props.padding, | ||
polar = props.polar, | ||
scale = props.scale, | ||
sharedEvents = props.sharedEvents, | ||
standalone = props.standalone, | ||
style = props.style, | ||
theme = props.theme, | ||
width = props.width, | ||
labels = props.labels, | ||
name = props.name, | ||
disableInlineStyles = props.disableInlineStyles; | ||
var initialChildProps = { | ||
const getBaseProps = (initialProps, fallbackProps) => { | ||
const modifiedProps = _victoryCore.Helpers.modifyProps(initialProps, fallbackProps, "line"); | ||
const props = Object.assign({}, modifiedProps, getCalculatedValues(modifiedProps)); | ||
const { | ||
data, | ||
domain, | ||
events, | ||
groupComponent, | ||
height, | ||
horizontal, | ||
interpolation, | ||
origin, | ||
padding, | ||
polar, | ||
scale, | ||
sharedEvents, | ||
standalone, | ||
style, | ||
theme, | ||
width, | ||
labels, | ||
name, | ||
disableInlineStyles | ||
} = props; | ||
const initialChildProps = { | ||
parent: { | ||
style: style.parent, | ||
scale: scale, | ||
data: data, | ||
height: height, | ||
width: width, | ||
name: name, | ||
domain: domain, | ||
standalone: standalone, | ||
polar: polar, | ||
origin: origin, | ||
padding: padding, | ||
horizontal: horizontal | ||
scale, | ||
data, | ||
height, | ||
width, | ||
name, | ||
domain, | ||
standalone, | ||
polar, | ||
origin, | ||
padding, | ||
horizontal | ||
}, | ||
all: { | ||
data: { | ||
horizontal: horizontal, | ||
polar: polar, | ||
origin: origin, | ||
scale: scale, | ||
data: data, | ||
interpolation: interpolation, | ||
groupComponent: groupComponent, | ||
horizontal, | ||
polar, | ||
origin, | ||
scale, | ||
data, | ||
interpolation, | ||
groupComponent, | ||
style: disableInlineStyles ? {} : style.data, | ||
theme: theme, | ||
disableInlineStyles: disableInlineStyles | ||
theme, | ||
disableInlineStyles | ||
} | ||
} | ||
}; | ||
return data.reduce(function (childProps, datum, index) { | ||
var text = _victoryCore.LabelHelpers.getText(props, datum, index); | ||
return data.reduce((childProps, datum, index) => { | ||
const text = _victoryCore.LabelHelpers.getText(props, datum, index); | ||
if (text !== undefined && text !== null || labels && (events || sharedEvents)) { | ||
var eventKey = !(0, _isNil2.default)(datum.eventKey) ? datum.eventKey : index; | ||
const eventKey = !_victoryCore.Helpers.isNil(datum.eventKey) ? datum.eventKey : index; | ||
childProps[eventKey] = { | ||
@@ -111,7 +99,5 @@ labels: _victoryCore.LabelHelpers.getProps(props, index) | ||
} | ||
return childProps; | ||
}, initialChildProps); | ||
}; | ||
exports.getBaseProps = getBaseProps; |
export * from "./victory-line"; | ||
export * from "./curve"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -6,5 +6,3 @@ "use strict"; | ||
}); | ||
var _victoryLine = require("./victory-line"); | ||
Object.keys(_victoryLine).forEach(function (key) { | ||
@@ -20,5 +18,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _curve = require("./curve"); | ||
Object.keys(_curve).forEach(function (key) { | ||
@@ -25,0 +21,0 @@ if (key === "default" || key === "__esModule") return; |
@@ -0,0 +0,0 @@ import React from "react"; |
@@ -7,34 +7,8 @@ "use strict"; | ||
exports.VictoryLine = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _helperMethods = require("./helper-methods"); | ||
var _curve = require("./curve"); | ||
var _victoryCore = require("victory-core"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
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 _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 ? Object.setPrototypeOf.bind() : 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 _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.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
var fallbackProps = { | ||
const fallbackProps = { | ||
width: 450, | ||
@@ -45,3 +19,3 @@ height: 300, | ||
}; | ||
var options = { | ||
const options = { | ||
components: [{ | ||
@@ -56,70 +30,52 @@ name: "parent", | ||
}] | ||
}; // eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
}; | ||
var VictoryLineBase = /*#__PURE__*/function (_React$Component) { | ||
_inherits(VictoryLineBase, _React$Component); | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
var _super = _createSuper(VictoryLineBase); | ||
class VictoryLineBase extends _react.default.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
static animationWhitelist = ["data", "domain", "height", "padding", "samples", "style", "width"]; | ||
static displayName = "VictoryLine"; | ||
static role = "line"; | ||
static defaultTransitions = _victoryCore.DefaultTransitions.continuousTransitions(); | ||
static defaultPolarTransitions = _victoryCore.DefaultTransitions.continuousPolarTransitions(); | ||
static continuous = true; | ||
static defaultProps = { | ||
containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null), | ||
dataComponent: /*#__PURE__*/_react.default.createElement(_curve.Curve, null), | ||
labelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, { | ||
renderInPortal: true | ||
}), | ||
groupComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryClipContainer, null), | ||
samples: 50, | ||
sortKey: "x", | ||
sortOrder: "ascending", | ||
standalone: true, | ||
theme: _victoryCore.VictoryTheme.grayscale | ||
}; | ||
static getDomain = _victoryCore.Domain.getDomain; | ||
static getData = _victoryCore.Data.getData; | ||
static getBaseProps = props => (0, _helperMethods.getBaseProps)(props, fallbackProps); | ||
static expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"]; | ||
function VictoryLineBase(props) { | ||
_classCallCheck(this, VictoryLineBase); | ||
return _super.call(this, props); | ||
// Overridden in native versions | ||
shouldAnimate() { | ||
return !!this.props.animate; | ||
} | ||
_createClass(VictoryLineBase, [{ | ||
key: "shouldAnimate", | ||
value: // Overridden in native versions | ||
function shouldAnimate() { | ||
return !!this.props.animate; | ||
render() { | ||
const { | ||
animationWhitelist, | ||
role | ||
} = VictoryLineBase; | ||
const props = _victoryCore.Helpers.modifyProps(this.props, fallbackProps, role); | ||
if (this.shouldAnimate()) { | ||
return this.animateComponent(props, animationWhitelist); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var animationWhitelist = VictoryLineBase.animationWhitelist, | ||
role = VictoryLineBase.role; | ||
var props = _victoryCore.Helpers.modifyProps(this.props, fallbackProps, role); | ||
if (this.shouldAnimate()) { | ||
return this.animateComponent(props, animationWhitelist); | ||
} | ||
var children = this.renderContinuousData(props); | ||
var component = props.standalone ? this.renderContainer(props.containerComponent, children) : children; | ||
return _victoryCore.UserProps.withSafeUserProps(component, props); | ||
} | ||
}]); | ||
return VictoryLineBase; | ||
}(_react.default.Component); | ||
VictoryLineBase.animationWhitelist = ["data", "domain", "height", "padding", "samples", "style", "width"]; | ||
VictoryLineBase.displayName = "VictoryLine"; | ||
VictoryLineBase.role = "line"; | ||
VictoryLineBase.defaultTransitions = _victoryCore.DefaultTransitions.continuousTransitions(); | ||
VictoryLineBase.defaultPolarTransitions = _victoryCore.DefaultTransitions.continuousPolarTransitions(); | ||
VictoryLineBase.continuous = true; | ||
VictoryLineBase.defaultProps = { | ||
containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null), | ||
dataComponent: /*#__PURE__*/_react.default.createElement(_curve.Curve, null), | ||
labelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, { | ||
renderInPortal: true | ||
}), | ||
groupComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryClipContainer, null), | ||
samples: 50, | ||
sortKey: "x", | ||
sortOrder: "ascending", | ||
standalone: true, | ||
theme: _victoryCore.VictoryTheme.grayscale | ||
}; | ||
VictoryLineBase.getDomain = _victoryCore.Domain.getDomain; | ||
VictoryLineBase.getData = _victoryCore.Data.getData; | ||
VictoryLineBase.getBaseProps = function (props) { | ||
return (0, _helperMethods.getBaseProps)(props, fallbackProps); | ||
}; | ||
VictoryLineBase.expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"]; | ||
var VictoryLine = (0, _victoryCore.addEvents)(VictoryLineBase, options); | ||
exports.VictoryLine = VictoryLine; | ||
const children = this.renderContinuousData(props); | ||
const component = props.standalone ? this.renderContainer(props.containerComponent, children) : children; | ||
return _victoryCore.UserProps.withSafeUserProps(component, props); | ||
} | ||
} | ||
const VictoryLine = exports.VictoryLine = (0, _victoryCore.addEvents)(VictoryLineBase, options); |
{ | ||
"name": "victory-line", | ||
"version": "36.9.1", | ||
"version": "36.9.2-next.0", | ||
"description": "Line Component for Victory", | ||
@@ -24,4 +24,4 @@ "keywords": [ | ||
"lodash": "^4.17.19", | ||
"victory-core": "^36.9.1", | ||
"victory-vendor": "^36.9.1" | ||
"victory-core": "^36.9.2-next.0", | ||
"victory-vendor": "^36.9.2-next.0" | ||
}, | ||
@@ -32,8 +32,4 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"victory-chart": "*", | ||
"victory-line": "*" | ||
"victory-chart": "36.9.2-next.0" | ||
}, | ||
"publishConfig": { | ||
"provenance": true | ||
}, | ||
"wireit": { | ||
@@ -261,3 +257,3 @@ "### THESE WIREIT CONFIGS ARE GENERATED ####": {}, | ||
"jest": { | ||
"command": "nps jest:pkg", | ||
"command": "jest --passWithNoTests", | ||
"files": [ | ||
@@ -271,6 +267,6 @@ "src/**/*.test.*", | ||
"dependencies": [ | ||
"build:lib:cjs", | ||
"../victory-chart:build:lib:cjs", | ||
"../victory-vendor:build:lib:cjs", | ||
"../victory-voronoi:build:lib:cjs" | ||
"../victory-core:build", | ||
"../victory-vendor:build", | ||
"../victory-chart:build", | ||
"../victory-voronoi:build" | ||
], | ||
@@ -277,0 +273,0 @@ "packageLocks": [ |
@@ -1,2 +0,1 @@ | ||
import { isNil } from "lodash"; | ||
import { Helpers, LabelHelpers, Data, Domain, Scale } from "victory-core"; | ||
@@ -104,3 +103,3 @@ | ||
) { | ||
const eventKey = !isNil(datum.eventKey) ? datum.eventKey : index; | ||
const eventKey = !Helpers.isNil(datum.eventKey) ? datum.eventKey : index; | ||
childProps[eventKey] = { labels: LabelHelpers.getProps(props, index) }; | ||
@@ -107,0 +106,0 @@ } |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
1
1180948
20282
2
4
Updatedvictory-core@^36.9.2-next.0