victory-core 36.8.1 → 36.8.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.
@@ -443,7 +443,7 @@ var getCalculatedProps = function (props) {
443
443
  verticalAnchor: verticalAnchor,
444
444
  dx: dx,
445
445
  dy: dy,
446
- originalDy: props.dy,
446
+ originalDy: Helpers.evaluateProp(props.dy, props),
447
447
  transform: transform,
448
448
  x: x,
449
449
  y: y
@@ -27,7 +27,7 @@ export interface EventsMixinClass<TProps> {
27
27
  renderData(props: TProps): any;
28
28
  renderContinuousData(props: TProps): any;
29
29
  animateComponent(props: TProps, defaultAnimationWhitelist: string[]): React.ReactElement;
30
- getComponentProps(component: React.ReactElement, type: string, index: number): TProps;
30
+ getComponentProps(component: React.ReactNode, type: string, index: string | number): TProps;
31
31
  dataKeys: string[];
32
32
  }
33
33
  /**
@@ -90,7 +90,7 @@ export declare function addEvents<TBase extends WrappedComponentClass<TProps>, T
90
90
  cacheValues(obj: any): void;
91
91
  getBaseProps(props: any, getSharedEventState: any): Record<string, object>;
92
92
  getAllEvents(props: any): any;
93
- getComponentProps(component: any, type: any, index: any): any;
93
+ getComponentProps(component: React.ReactNode, type: string, index: string | number): any;
94
94
  renderContainer(component: any, children: any): React.DetailedReactHTMLElement<any, HTMLElement>;
95
95
  animateComponent(props: TProps, defaultAnimationWhitelist: string[]): React.ReactElement;
96
96
  renderContinuousData(props: TProps): React.DetailedReactHTMLElement<any, HTMLElement>;
@@ -314,13 +314,15 @@ export function addEvents(WrappedComponent) {
314
314
  return undefined;
315
315
  }
316
316
 
317
+ var currentProps = component && typeof component === "object" && "props" in component ? component.props : undefined;
318
+
317
319
  if (this.hasEvents) {
318
320
  var baseEvents = this.getEvents(this.props, type, key);
319
321
 
320
322
  var componentProps = _defaults({
321
323
  index: index,
322
324
  key: id
323
- }, this.getEventState(key, type), this.getSharedEventState(key, type), component.props, baseProps, {
325
+ }, this.getEventState(key, type), this.getSharedEventState(key, type), currentProps, baseProps, {
324
326
  id: id
325
327
  });
326
328
 
@@ -334,7 +336,7 @@ export function addEvents(WrappedComponent) {
334
336
  return _defaults({
335
337
  index: index,
336
338
  key: id
337
- }, component.props, baseProps, {
339
+ }, currentProps, baseProps, {
338
340
  id: id
339
341
  });
340
342
  }
@@ -471,7 +471,7 @@ var getCalculatedProps = function (props) {
471
471
  verticalAnchor: verticalAnchor,
472
472
  dx: dx,
473
473
  dy: dy,
474
- originalDy: props.dy,
474
+ originalDy: Helpers.evaluateProp(props.dy, props),
475
475
  transform: transform,
476
476
  x: x,
477
477
  y: y
@@ -27,7 +27,7 @@ export interface EventsMixinClass<TProps> {
27
27
  renderData(props: TProps): any;
28
28
  renderContinuousData(props: TProps): any;
29
29
  animateComponent(props: TProps, defaultAnimationWhitelist: string[]): React.ReactElement;
30
- getComponentProps(component: React.ReactElement, type: string, index: number): TProps;
30
+ getComponentProps(component: React.ReactNode, type: string, index: string | number): TProps;
31
31
  dataKeys: string[];
32
32
  }
33
33
  /**
@@ -90,7 +90,7 @@ export declare function addEvents<TBase extends WrappedComponentClass<TProps>, T
90
90
  cacheValues(obj: any): void;
91
91
  getBaseProps(props: any, getSharedEventState: any): Record<string, object>;
92
92
  getAllEvents(props: any): any;
93
- getComponentProps(component: any, type: any, index: any): any;
93
+ getComponentProps(component: React.ReactNode, type: string, index: string | number): any;
94
94
  renderContainer(component: any, children: any): React.DetailedReactHTMLElement<any, HTMLElement>;
95
95
  animateComponent(props: TProps, defaultAnimationWhitelist: string[]): React.ReactElement;
96
96
  renderContinuousData(props: TProps): React.DetailedReactHTMLElement<any, HTMLElement>;
@@ -326,12 +326,14 @@ function addEvents(WrappedComponent) {
326
326
  return undefined;
327
327
  }
328
328
 
329
+ var currentProps = component && typeof component === "object" && "props" in component ? component.props : undefined;
330
+
329
331
  if (this.hasEvents) {
330
332
  var baseEvents = this.getEvents(this.props, type, key);
331
333
  var componentProps = (0, _defaults2.default)({
332
334
  index: index,
333
335
  key: id
334
- }, this.getEventState(key, type), this.getSharedEventState(key, type), component.props, baseProps, {
336
+ }, this.getEventState(key, type), this.getSharedEventState(key, type), currentProps, baseProps, {
335
337
  id: id
336
338
  });
337
339
  var events = (0, _defaults2.default)({}, Events.getPartialEvents(baseEvents, key, componentProps), componentProps.events);
@@ -343,7 +345,7 @@ function addEvents(WrappedComponent) {
343
345
  return (0, _defaults2.default)({
344
346
  index: index,
345
347
  key: id
346
- }, component.props, baseProps, {
348
+ }, currentProps, baseProps, {
347
349
  id: id
348
350
  });
349
351
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-core",
3
- "version": "36.8.1",
3
+ "version": "36.8.2",
4
4
  "description": "Victory Core",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -23,7 +23,7 @@
23
23
  "lodash": "^4.17.21",
24
24
  "prop-types": "^15.8.1",
25
25
  "react-fast-compare": "^3.2.0",
26
- "victory-vendor": "^36.8.1"
26
+ "victory-vendor": "^36.8.2"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": ">=16.6.0"
@@ -508,7 +508,7 @@ const getCalculatedProps = <T extends VictoryLabelProps>(props: T) => {
508
508
  verticalAnchor,
509
509
  dx,
510
510
  dy,
511
- originalDy: props.dy,
511
+ originalDy: Helpers.evaluateProp(props.dy, props),
512
512
  transform,
513
513
  x,
514
514
  y,
@@ -68,9 +68,9 @@ export interface EventsMixinClass<TProps> {
68
68
  defaultAnimationWhitelist: string[],
69
69
  ): React.ReactElement;
70
70
  getComponentProps(
71
- component: React.ReactElement,
71
+ component: React.ReactNode,
72
72
  type: string,
73
- index: number,
73
+ index: string | number,
74
74
  ): TProps;
75
75
  dataKeys: string[];
76
76
  }
@@ -352,7 +352,11 @@ export function addEvents<
352
352
  return props.events;
353
353
  }
354
354
 
355
- getComponentProps(component, type, index) {
355
+ getComponentProps(
356
+ component: React.ReactNode,
357
+ type: string,
358
+ index: string | number,
359
+ ) {
356
360
  const name = this.props.name || WrappedComponent.role;
357
361
  const key = (this.dataKeys && this.dataKeys[index]) || index;
358
362
  const id = `${name}-${type}-${key}`;
@@ -365,13 +369,18 @@ export function addEvents<
365
369
  return undefined;
366
370
  }
367
371
 
372
+ const currentProps =
373
+ component && typeof component === "object" && "props" in component
374
+ ? component.props
375
+ : undefined;
376
+
368
377
  if (this.hasEvents) {
369
378
  const baseEvents = this.getEvents(this.props, type, key);
370
379
  const componentProps = defaults(
371
380
  { index, key: id },
372
381
  this.getEventState(key, type),
373
382
  this.getSharedEventState(key, type),
374
- component.props,
383
+ currentProps,
375
384
  baseProps,
376
385
  { id },
377
386
  );
@@ -385,7 +394,7 @@ export function addEvents<
385
394
  return assign({}, componentProps, { events });
386
395
  }
387
396
 
388
- return defaults({ index, key: id }, component.props, baseProps, { id });
397
+ return defaults({ index, key: id }, currentProps, baseProps, { id });
389
398
  }
390
399
 
391
400
  renderContainer(component, children) {