victory-bar 37.3.1 → 37.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/dist/victory-bar.js +15 -48
- package/dist/victory-bar.min.js +1 -1
- package/es/bar.js +2 -2
- package/es/geometry-helper-methods.js +0 -1
- package/es/path-helper-methods.js +0 -12
- package/es/victory-bar.d.ts +1 -1
- package/es/victory-bar.js +1 -1
- package/lib/bar.js +2 -2
- package/lib/geometry-helper-methods.js +0 -1
- package/lib/path-helper-methods.js +0 -12
- package/lib/victory-bar.d.ts +1 -1
- package/lib/victory-bar.js +1 -1
- package/package.json +7 -11
- package/src/bar.tsx +30 -31
- package/src/geometry-helper-methods.ts +0 -1
- package/src/path-helper-methods.ts +0 -6
- package/src/victory-bar.tsx +1 -1
package/CHANGELOG.md
CHANGED
package/dist/victory-bar.js
CHANGED
|
@@ -169,9 +169,9 @@ const defaultProps = {
|
|
|
169
169
|
role: "presentation",
|
|
170
170
|
shapeRendering: "auto"
|
|
171
171
|
};
|
|
172
|
-
|
|
172
|
+
const Bar = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(
|
|
173
173
|
// eslint-disable-next-line prefer-arrow-callback
|
|
174
|
-
|
|
174
|
+
function Bar(initialProps, ref) {
|
|
175
175
|
const props = evaluateProps(lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, initialProps, defaultProps));
|
|
176
176
|
const {
|
|
177
177
|
polar,
|
|
@@ -280,7 +280,6 @@ const circle = (center, radius) => ({
|
|
|
280
280
|
// Left-most point is returned as 0th element of array
|
|
281
281
|
// Right-most point is returned as 1st elemennt of array
|
|
282
282
|
intersection(circle1) {
|
|
283
|
-
// eslint-disable-line max-statements
|
|
284
283
|
const P0 = this.center;
|
|
285
284
|
const P1 = circle1.center;
|
|
286
285
|
const r0 = this.radius;
|
|
@@ -602,8 +601,6 @@ const getVerticalBarPoints = (position, sign, cr) => {
|
|
|
602
601
|
y0,
|
|
603
602
|
y1
|
|
604
603
|
} = position;
|
|
605
|
-
|
|
606
|
-
// eslint-disable-next-line max-statements, max-len
|
|
607
604
|
const getHalfPoints = side => {
|
|
608
605
|
const isLeft = side === "Left";
|
|
609
606
|
const signL = isLeft ? 1 : -1;
|
|
@@ -687,8 +684,6 @@ const getHorizontalBarPoints = (position, sign, cr) => {
|
|
|
687
684
|
} = position;
|
|
688
685
|
const x0 = position.x0 < position.x1 ? position.x0 : position.x1;
|
|
689
686
|
const x1 = position.x0 < position.x1 ? position.x1 : position.x0;
|
|
690
|
-
|
|
691
|
-
// eslint-disable-next-line max-statements, max-len
|
|
692
687
|
const getHalfPoints = side => {
|
|
693
688
|
const isTop = side === "top";
|
|
694
689
|
const signL = isTop ? -1 : 1;
|
|
@@ -768,8 +763,6 @@ const getHorizontalBarPoints = (position, sign, cr) => {
|
|
|
768
763
|
// eslint-disable-next-line no-magic-numbers
|
|
769
764
|
bottomPoints[3], bottomPoints[2]];
|
|
770
765
|
};
|
|
771
|
-
|
|
772
|
-
// eslint-disable-next-line max-params
|
|
773
766
|
const getVerticalBarPath = (props, width, cornerRadius) => {
|
|
774
767
|
const position = getPosition(props, width);
|
|
775
768
|
const sign = position.y0 > position.y1 ? 1 : -1;
|
|
@@ -777,8 +770,6 @@ const getVerticalBarPath = (props, width, cornerRadius) => {
|
|
|
777
770
|
const points = getVerticalBarPoints(position, sign, cornerRadius);
|
|
778
771
|
return mapPointsToPath(points, cornerRadius, direction);
|
|
779
772
|
};
|
|
780
|
-
|
|
781
|
-
// eslint-disable-next-line max-params
|
|
782
773
|
const getHorizontalBarPath = (props, width, cornerRadius) => {
|
|
783
774
|
const position = getPosition(props, width);
|
|
784
775
|
const sign = position.x0 < position.x1 ? 1 : -1;
|
|
@@ -836,8 +827,6 @@ const getVerticalPolarBarPath = (props, cornerRadius) => {
|
|
|
836
827
|
leftMiddle
|
|
837
828
|
};
|
|
838
829
|
};
|
|
839
|
-
|
|
840
|
-
// eslint-disable-next-line max-statements
|
|
841
830
|
const getTopPath = () => {
|
|
842
831
|
const {
|
|
843
832
|
topRight,
|
|
@@ -880,8 +869,6 @@ const getVerticalPolarBarPath = (props, cornerRadius) => {
|
|
|
880
869
|
coords: subCoords[i].split(",")
|
|
881
870
|
}));
|
|
882
871
|
};
|
|
883
|
-
|
|
884
|
-
// eslint-disable-next-line max-statements
|
|
885
872
|
const getBottomPath = () => {
|
|
886
873
|
const {
|
|
887
874
|
bottomRight,
|
|
@@ -983,7 +970,7 @@ const defaultData = [{
|
|
|
983
970
|
y: 4
|
|
984
971
|
}];
|
|
985
972
|
|
|
986
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
973
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
987
974
|
|
|
988
975
|
/**
|
|
989
976
|
* Draw SVG bar charts with React. VictoryBar is a composable component, so it doesn"t include axes
|
|
@@ -5626,7 +5613,7 @@ const interpolateFunction = function (a, b) {
|
|
|
5626
5613
|
return b;
|
|
5627
5614
|
}
|
|
5628
5615
|
return function () {
|
|
5629
|
-
/* eslint-disable
|
|
5616
|
+
/* eslint-disable prefer-rest-params */
|
|
5630
5617
|
const aval = typeof a === "function" ? a.apply(this, arguments) : a;
|
|
5631
5618
|
const bval = typeof b === "function" ? b.apply(this, arguments) : b;
|
|
5632
5619
|
return (0,victory_vendor_d3_interpolate__WEBPACK_IMPORTED_MODULE_2__.interpolate)(aval, bval)(t);
|
|
@@ -6018,9 +6005,9 @@ const VictoryContainer = initialProps => {
|
|
|
6018
6005
|
...style,
|
|
6019
6006
|
width: responsive ? style?.width : dimensions.width,
|
|
6020
6007
|
height: responsive ? style?.height : dimensions.height,
|
|
6021
|
-
pointerEvents: "none",
|
|
6022
|
-
touchAction: "none",
|
|
6023
|
-
position: "relative"
|
|
6008
|
+
pointerEvents: style?.pointerEvents ?? "none",
|
|
6009
|
+
touchAction: style?.touchAction ?? "none",
|
|
6010
|
+
position: style?.position ?? "relative"
|
|
6024
6011
|
},
|
|
6025
6012
|
"data-ouia-component-id": ouiaId,
|
|
6026
6013
|
"data-ouia-component-type": ouiaType,
|
|
@@ -8075,7 +8062,7 @@ class VictoryTransition extends (react__WEBPACK_IMPORTED_MODULE_2___default().Co
|
|
|
8075
8062
|
componentDidMount() {
|
|
8076
8063
|
this.setState({
|
|
8077
8064
|
nodesShouldLoad: true
|
|
8078
|
-
});
|
|
8065
|
+
});
|
|
8079
8066
|
}
|
|
8080
8067
|
shouldComponentUpdate(nextProps) {
|
|
8081
8068
|
if (!react_fast_compare__WEBPACK_IMPORTED_MODULE_3___default()(this.props, nextProps)) {
|
|
@@ -8289,7 +8276,7 @@ const defaultComponents = [{
|
|
|
8289
8276
|
function addEvents(WrappedComponent, options) {
|
|
8290
8277
|
if (options === void 0) {
|
|
8291
8278
|
options = {};
|
|
8292
|
-
} // eslint-disable-next-line @typescript-eslint/no-empty-
|
|
8279
|
+
} // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
8293
8280
|
// @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
|
|
8294
8281
|
class AddEventsMixin extends WrappedComponent {
|
|
8295
8282
|
constructor(props) {
|
|
@@ -8658,7 +8645,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8658
8645
|
|
|
8659
8646
|
|
|
8660
8647
|
|
|
8661
|
-
/* eslint-disable no-use-before-define */
|
|
8662
8648
|
|
|
8663
8649
|
|
|
8664
8650
|
|
|
@@ -8784,8 +8770,6 @@ function formatDataFromDomain(dataset, domain, defaultBaseline) {
|
|
|
8784
8770
|
const isUnderMinY = underMin(minDomainY);
|
|
8785
8771
|
const isOverMaxX = overMax(maxDomainX);
|
|
8786
8772
|
const isOverMaxY = overMax(maxDomainY);
|
|
8787
|
-
|
|
8788
|
-
// eslint-disable-next-line complexity
|
|
8789
8773
|
return dataset.map(datum => {
|
|
8790
8774
|
let {
|
|
8791
8775
|
_x,
|
|
@@ -8896,7 +8880,6 @@ function formatData(dataset, props, expectedKeys) {
|
|
|
8896
8880
|
};
|
|
8897
8881
|
}
|
|
8898
8882
|
const data = preformattedData ? dataset : dataset.reduce((dataArr, datum, index) => {
|
|
8899
|
-
// eslint-disable-line complexity
|
|
8900
8883
|
const parsedDatum = parseDatum(datum);
|
|
8901
8884
|
const fallbackValues = {
|
|
8902
8885
|
x: index,
|
|
@@ -9089,7 +9072,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9089
9072
|
|
|
9090
9073
|
|
|
9091
9074
|
|
|
9092
|
-
/* eslint-disable no-use-before-define */
|
|
9093
9075
|
|
|
9094
9076
|
|
|
9095
9077
|
|
|
@@ -9145,8 +9127,6 @@ function getExtremeFromData(dataset, axis, type) {
|
|
|
9145
9127
|
}, initialValue);
|
|
9146
9128
|
return containsDate ? new Date(result) : result;
|
|
9147
9129
|
}
|
|
9148
|
-
|
|
9149
|
-
// eslint-disable-next-line max-statements
|
|
9150
9130
|
function padDomain(domain, props, axis) {
|
|
9151
9131
|
if (!props.domainPadding) {
|
|
9152
9132
|
return domain;
|
|
@@ -9482,7 +9462,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9482
9462
|
|
|
9483
9463
|
|
|
9484
9464
|
|
|
9485
|
-
/* eslint-disable no-use-before-define */
|
|
9486
9465
|
|
|
9487
9466
|
const GLOBAL_EVENT_REGEX = /^onGlobal(.*)$/;
|
|
9488
9467
|
|
|
@@ -9530,11 +9509,10 @@ getScopedEvents) {
|
|
|
9530
9509
|
*/
|
|
9531
9510
|
const getAllEvents = () => {
|
|
9532
9511
|
// Mandatory usage: `getEvents.bind(this)`
|
|
9533
|
-
|
|
9512
|
+
|
|
9534
9513
|
if (Array.isArray(this.componentEvents)) {
|
|
9535
9514
|
return Array.isArray(props.events) ? this.componentEvents.concat(...props.events) : this.componentEvents;
|
|
9536
9515
|
}
|
|
9537
|
-
/* eslint-enable no-invalid-this */
|
|
9538
9516
|
return props.events;
|
|
9539
9517
|
};
|
|
9540
9518
|
const allEvents = getAllEvents();
|
|
@@ -9559,7 +9537,7 @@ function getScopedEvents(events, namespace, childType, baseProps) {
|
|
|
9559
9537
|
}
|
|
9560
9538
|
|
|
9561
9539
|
// Mandatory usage: `getScopedEvents.bind(this)`
|
|
9562
|
-
|
|
9540
|
+
|
|
9563
9541
|
const newBaseProps = baseProps || this.baseProps;
|
|
9564
9542
|
// returns the original base props or base state of a given target element
|
|
9565
9543
|
const getTargetProps = (identifier, type) => {
|
|
@@ -9568,7 +9546,6 @@ function getScopedEvents(events, namespace, childType, baseProps) {
|
|
|
9568
9546
|
target,
|
|
9569
9547
|
key
|
|
9570
9548
|
} = identifier;
|
|
9571
|
-
// eslint-disable-next-line no-invalid-this
|
|
9572
9549
|
const baseType = type === "props" ? newBaseProps : this.state || {};
|
|
9573
9550
|
const base = childName === undefined || childName === null || !baseType[childName] ? baseType : baseType[childName];
|
|
9574
9551
|
return key === "parent" ? base.parent : base[key] && base[key][target];
|
|
@@ -9595,7 +9572,6 @@ function getScopedEvents(events, namespace, childType, baseProps) {
|
|
|
9595
9572
|
|
|
9596
9573
|
// returns the state object with mutated props applied for a single key
|
|
9597
9574
|
const getMutationObject = (key, childName) => {
|
|
9598
|
-
// eslint-disable-next-line no-invalid-this
|
|
9599
9575
|
const baseState = this.state || {};
|
|
9600
9576
|
if (!(0,_helpers__WEBPACK_IMPORTED_MODULE_4__.isFunction)(eventReturn.mutation)) {
|
|
9601
9577
|
return baseState;
|
|
@@ -9668,11 +9644,9 @@ function getScopedEvents(events, namespace, childType, baseProps) {
|
|
|
9668
9644
|
// into a state mutation, and calls setState
|
|
9669
9645
|
// eslint-disable-next-line max-params
|
|
9670
9646
|
const onEvent = (evt, childProps, eventKey, eventName) => {
|
|
9671
|
-
// eslint-disable-next-line no-invalid-this
|
|
9672
9647
|
const eventReturn = events[eventName](evt, childProps, eventKey, this);
|
|
9673
9648
|
if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_3___default()(eventReturn)) {
|
|
9674
9649
|
const callbacks = compileCallbacks(eventReturn);
|
|
9675
|
-
// eslint-disable-next-line no-invalid-this
|
|
9676
9650
|
this.setState(parseEventReturn(eventReturn, eventKey), callbacks);
|
|
9677
9651
|
}
|
|
9678
9652
|
};
|
|
@@ -9702,7 +9676,7 @@ function getPartialEvents(events, eventKey, childProps) {
|
|
|
9702
9676
|
// eslint-disable-next-line max-params
|
|
9703
9677
|
function getEventState(eventKey, namespace, childType) {
|
|
9704
9678
|
// Mandatory usage: `getEventState.bind(this)`
|
|
9705
|
-
|
|
9679
|
+
|
|
9706
9680
|
const state = this.state || {};
|
|
9707
9681
|
if (!childType) {
|
|
9708
9682
|
return eventKey === "parent" ? state[eventKey] && state[eventKey][namespace] || state[eventKey] : state[eventKey] && state[eventKey][namespace];
|
|
@@ -9895,7 +9869,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9895
9869
|
|
|
9896
9870
|
|
|
9897
9871
|
|
|
9898
|
-
/* eslint-disable no-use-before-define */
|
|
9899
9872
|
|
|
9900
9873
|
// Private Functions
|
|
9901
9874
|
|
|
@@ -10364,7 +10337,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10364
10337
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
|
|
10365
10338
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
10366
10339
|
|
|
10367
|
-
/* eslint-disable no-use-before-define */
|
|
10368
10340
|
|
|
10369
10341
|
// Private Functions
|
|
10370
10342
|
|
|
@@ -10684,7 +10656,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10684
10656
|
/* harmony import */ var _collection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./collection */ "../../victory-core/es/victory-util/collection.js");
|
|
10685
10657
|
/* harmony import */ var victory_vendor_d3_scale__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! victory-vendor/d3-scale */ "../../victory-vendor/es/d3-scale.js");
|
|
10686
10658
|
|
|
10687
|
-
/* eslint-disable no-use-before-define */
|
|
10688
10659
|
|
|
10689
10660
|
|
|
10690
10661
|
|
|
@@ -11475,8 +11446,6 @@ function getChildBeforeLoad(animate, child, data, cb) {
|
|
|
11475
11446
|
clipWidth: 0
|
|
11476
11447
|
};
|
|
11477
11448
|
}
|
|
11478
|
-
|
|
11479
|
-
// eslint-disable-next-line max-params
|
|
11480
11449
|
function getChildOnLoad(animate, data, cb) {
|
|
11481
11450
|
const newAnimate = Object.assign({}, animate, {
|
|
11482
11451
|
onEnd: cb
|
|
@@ -11499,7 +11468,7 @@ function getChildOnLoad(animate, data, cb) {
|
|
|
11499
11468
|
};
|
|
11500
11469
|
}
|
|
11501
11470
|
|
|
11502
|
-
// eslint-disable-next-line max-params
|
|
11471
|
+
// eslint-disable-next-line max-params
|
|
11503
11472
|
function getChildPropsOnExit(animate, child, data, exitingNodes, cb) {
|
|
11504
11473
|
// Whether or not _this_ child has exiting nodes, we want the exit-
|
|
11505
11474
|
// transition for all children to have the same duration, delay, etc.
|
|
@@ -11523,7 +11492,7 @@ function getChildPropsOnExit(animate, child, data, exitingNodes, cb) {
|
|
|
11523
11492
|
};
|
|
11524
11493
|
}
|
|
11525
11494
|
|
|
11526
|
-
// eslint-disable-next-line max-params
|
|
11495
|
+
// eslint-disable-next-line max-params
|
|
11527
11496
|
function getChildPropsBeforeEnter(animate, child, data, enteringNodes, cb) {
|
|
11528
11497
|
let newAnimate = animate;
|
|
11529
11498
|
let newData = data;
|
|
@@ -11548,7 +11517,7 @@ function getChildPropsBeforeEnter(animate, child, data, enteringNodes, cb) {
|
|
|
11548
11517
|
};
|
|
11549
11518
|
}
|
|
11550
11519
|
|
|
11551
|
-
// eslint-disable-next-line max-params
|
|
11520
|
+
// eslint-disable-next-line max-params
|
|
11552
11521
|
function getChildPropsOnEnter(animate, data, enteringNodes, cb) {
|
|
11553
11522
|
// Whether or not _this_ child has entering nodes, we want the entering-
|
|
11554
11523
|
// transition for all children to have the same duration, delay, etc.
|
|
@@ -11655,8 +11624,6 @@ function getTransitionPropsFactory(props, state, setState) {
|
|
|
11655
11624
|
}
|
|
11656
11625
|
return {};
|
|
11657
11626
|
};
|
|
11658
|
-
|
|
11659
|
-
// eslint-disable-next-line max-statements, complexity, max-len
|
|
11660
11627
|
return function getTransitionProps(child, index) {
|
|
11661
11628
|
const data = getChildData(child) || [];
|
|
11662
11629
|
const animate = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, props.animate, child.props.animate);
|