victory-bar 37.3.2 → 37.3.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-bar",
3
- "version": "37.3.2",
3
+ "version": "37.3.4",
4
4
  "description": "Bar Component for Victory",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -21,8 +21,8 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "lodash": "^4.17.19",
24
- "victory-core": "37.3.2",
25
- "victory-vendor": "37.3.2"
24
+ "victory-core": "37.3.4",
25
+ "victory-vendor": "37.3.4"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=16.6.0"
@@ -190,32 +190,6 @@
190
190
  "pnpm-lock.yaml"
191
191
  ]
192
192
  },
193
- "format": {
194
- "command": "nps format:pkg",
195
- "files": [
196
- "src/**",
197
- "*.json",
198
- "../../.prettierignore",
199
- "../../.prettierrc.json"
200
- ],
201
- "output": [],
202
- "packageLocks": [
203
- "pnpm-lock.yaml"
204
- ]
205
- },
206
- "format:fix": {
207
- "command": "pnpm run format || nps format:pkg:fix",
208
- "files": [
209
- "src/**",
210
- "*.json",
211
- "../../.prettierignore",
212
- "../../.prettierrc.json"
213
- ],
214
- "output": [],
215
- "packageLocks": [
216
- "pnpm-lock.yaml"
217
- ]
218
- },
219
193
  "lint": {
220
194
  "command": "eslint src",
221
195
  "files": [
@@ -283,8 +257,6 @@
283
257
  "check": "wireit",
284
258
  "types:check": "wireit",
285
259
  "types:create": "wireit",
286
- "format": "wireit",
287
- "format:fix": "wireit",
288
260
  "lint": "wireit",
289
261
  "lint:fix": "wireit",
290
262
  "jest": "wireit"
@@ -1,4 +1,4 @@
1
- import { isPlainObject } from "lodash";
1
+ import isPlainObject from "lodash/isPlainObject";
2
2
  import { Helpers, VictoryStyleObject } from "victory-core";
3
3
  import { BarProps } from "./bar";
4
4
  import {
package/src/bar.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef } from "react";
2
- import { defaults } from "lodash";
2
+ import defaults from "lodash/defaults";
3
3
  import {
4
4
  Helpers,
5
5
  NumberOrCallback,
@@ -5,6 +5,7 @@ import {
5
5
  Helpers,
6
6
  LabelHelpers,
7
7
  Scale,
8
+ VictoryClipContainer,
8
9
  } from "victory-core";
9
10
 
10
11
  export const getBarPosition = (props, datum) => {
@@ -61,6 +62,12 @@ const getCalculatedValues = (props) => {
61
62
  let data = Data.getData(props);
62
63
  data = Data.formatDataFromDomain(data, domain, 0);
63
64
 
65
+ // when inside a zoom container, reset the _x and _y properties of each datum to the original
66
+ // x and y property values so they will not be clipped. See https://github.com/FormidableLabs/victory/pull/2970
67
+ if (props.groupComponent.type === VictoryClipContainer) {
68
+ data = data.map((datum) => ({ ...datum, _x: datum.x, _y: datum.y }));
69
+ }
70
+
64
71
  return { style, data, scale, domain, origin };
65
72
  };
66
73
 
@@ -13,6 +13,7 @@ import {
13
13
  EventPropTypeInterface,
14
14
  NumberOrCallback,
15
15
  StringOrNumberOrCallback,
16
+ VictoryClipContainer,
16
17
  VictoryCommonProps,
17
18
  VictoryDatableProps,
18
19
  VictoryMultiLabelableProps,
@@ -127,7 +128,9 @@ class VictoryBarBase extends React.Component<VictoryBarProps> {
127
128
  "groupComponent",
128
129
  "containerComponent",
129
130
  ];
130
-
131
+ // passed to addEvents.renderData to prevent data props with undefined _x or _y from excluding data from render.
132
+ // used when inside of VictoryZoomContainer
133
+ static shouldRenderDatum = () => true;
131
134
  // Overridden in native versions
132
135
  shouldAnimate() {
133
136
  return !!this.props.animate;
@@ -141,7 +144,15 @@ class VictoryBarBase extends React.Component<VictoryBarProps> {
141
144
  return this.animateComponent(props, animationWhitelist);
142
145
  }
143
146
 
144
- const children = this.renderData(props);
147
+ let children;
148
+ // when inside a zoom container (the only place VictoryClipContainer is used), all data
149
+ // should be renderable so bars won't dissappear before they've fully exited the container's bounds
150
+ // see https://github.com/FormidableLabs/victory/pull/2970
151
+ if (props.groupComponent.type === VictoryClipContainer) {
152
+ children = this.renderData(props, VictoryBarBase.shouldRenderDatum);
153
+ } else {
154
+ children = this.renderData(props);
155
+ }
145
156
 
146
157
  const component = props.standalone
147
158
  ? this.renderContainer(props.containerComponent, children)