victory-create-container
Advanced tools
Comparing version 35.8.5 to 35.9.0
import * as React from "react"; | ||
export type ContainerType = "brush" | "cursor" | "selection" | "voronoi" | "zoom"; | ||
export type ContainerType = | ||
| "brush" | ||
| "cursor" | ||
| "selection" | ||
| "voronoi" | ||
| "zoom"; | ||
export function createContainer<V, W>( | ||
@@ -5,0 +10,0 @@ c1: ContainerType, |
import * as React from "react"; | ||
export type ContainerType = "brush" | "cursor" | "selection" | "voronoi" | "zoom"; | ||
export type ContainerType = | ||
| "brush" | ||
| "cursor" | ||
| "selection" | ||
| "voronoi" | ||
| "zoom"; | ||
export function createContainer<V, W>( | ||
@@ -5,0 +10,0 @@ c1: ContainerType, |
{ | ||
"name": "victory-create-container", | ||
"version": "35.8.5", | ||
"version": "35.9.0", | ||
"description": "Container Helper for Victory", | ||
@@ -23,8 +23,8 @@ "keywords": [ | ||
"lodash": "^4.17.19", | ||
"victory-brush-container": "^35.8.5", | ||
"victory-core": "^35.8.1", | ||
"victory-cursor-container": "^35.8.1", | ||
"victory-selection-container": "^35.8.1", | ||
"victory-voronoi-container": "^35.8.4", | ||
"victory-zoom-container": "^35.8.1" | ||
"victory-brush-container": "^35.9.0", | ||
"victory-core": "^35.9.0", | ||
"victory-cursor-container": "^35.9.0", | ||
"victory-selection-container": "^35.9.0", | ||
"victory-voronoi-container": "^35.9.0", | ||
"victory-zoom-container": "^35.9.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "scripts": { |
@@ -1,2 +0,11 @@ | ||
import { toPairs, groupBy, forOwn, includes, flow, isEmpty, isFunction, keys } from "lodash"; | ||
import { | ||
toPairs, | ||
groupBy, | ||
forOwn, | ||
includes, | ||
flow, | ||
isEmpty, | ||
isFunction, | ||
keys | ||
} from "lodash"; | ||
import { VictoryContainer, Log } from "victory-core"; | ||
@@ -52,3 +61,5 @@ import { voronoiContainerMixin } from "victory-voronoi-container"; | ||
target, | ||
eventHandlers: combineEventHandlers(eventsArray.map((event) => event.eventHandlers)) | ||
eventHandlers: combineEventHandlers( | ||
eventsArray.map((event) => event.eventHandlers) | ||
) | ||
// note: does not currently handle eventKey or childName | ||
@@ -110,26 +121,34 @@ }; | ||
if (behavior && !includes(behaviors, behavior)) { | ||
Log.warn(`"${behavior}" is not a valid behavior. Choose from [${behaviors.join(", ")}].`); | ||
Log.warn( | ||
`"${behavior}" is not a valid behavior. Choose from [${behaviors.join( | ||
", " | ||
)}].` | ||
); | ||
} | ||
}; | ||
const makeCreateContainerFunction = (mixinMap, Container) => (behaviorA, behaviorB, ...invalid) => { | ||
// eslint-disable-line | ||
const behaviors = keys(mixinMap); | ||
const makeCreateContainerFunction = | ||
(mixinMap, Container) => | ||
(behaviorA, behaviorB, ...invalid) => { | ||
// eslint-disable-line | ||
const behaviors = keys(mixinMap); | ||
checkBehaviorName(behaviorA, behaviors); | ||
checkBehaviorName(behaviorB, behaviors); | ||
checkBehaviorName(behaviorA, behaviors); | ||
checkBehaviorName(behaviorB, behaviors); | ||
if (invalid.length) { | ||
Log.warn("too many arguments given to createContainer (maximum accepted: 2)."); | ||
} | ||
if (invalid.length) { | ||
Log.warn( | ||
"too many arguments given to createContainer (maximum accepted: 2)." | ||
); | ||
} | ||
const firstMixins = mixinMap[behaviorA]; | ||
const secondMixins = mixinMap[behaviorB] || []; | ||
const firstMixins = mixinMap[behaviorA]; | ||
const secondMixins = mixinMap[behaviorB] || []; | ||
if (!firstMixins) { | ||
return Container; | ||
} | ||
if (!firstMixins) { | ||
return Container; | ||
} | ||
return combineContainerMixins([...firstMixins, ...secondMixins], Container); | ||
}; | ||
return combineContainerMixins([...firstMixins, ...secondMixins], Container); | ||
}; | ||
@@ -136,0 +155,0 @@ const createContainer = makeCreateContainerFunction( |
import * as React from "react"; | ||
export type ContainerType = "brush" | "cursor" | "selection" | "voronoi" | "zoom"; | ||
export type ContainerType = | ||
| "brush" | ||
| "cursor" | ||
| "selection" | ||
| "voronoi" | ||
| "zoom"; | ||
export function createContainer<V, W>( | ||
@@ -5,0 +10,0 @@ c1: ContainerType, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1574373
26740