victory-create-container 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/CHANGELOG.md +8 -0
- package/dist/victory-create-container.js +437 -385
- package/dist/victory-create-container.min.js +1 -1
- package/es/create-container.d.ts +2 -2
- package/es/create-container.js +9 -9
- package/lib/create-container.d.ts +2 -2
- package/lib/create-container.js +9 -9
- package/package.json +7 -35
- package/src/create-container.tsx +11 -2
package/es/create-container.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { VictoryContainer, VictoryContainerProps } from "victory-core";
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export type ContainerType = "zoom" | "selection" | "brush" | "cursor" | "voronoi";
|
|
4
|
+
type ContainerComponents = Record<ContainerType, React.ComponentType<any> & {
|
|
5
5
|
defaultEvents: (props: any) => any[];
|
|
6
6
|
}>;
|
|
7
7
|
export declare function makeCreateContainerFunction<TContainerComponents extends ContainerComponents>(containerComponents: TContainerComponents, VictoryContainerBase: typeof VictoryContainer): <TContainerA extends ContainerType | VictoryContainerProps, TContainerB extends ContainerType | VictoryContainerProps>(containerA: TContainerA extends ContainerType ? TContainerA : ContainerType, containerB: TContainerB extends ContainerType ? TContainerB : ContainerType) => {
|
package/es/create-container.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import forOwn from "lodash/forOwn";
|
|
3
|
+
import groupBy from "lodash/groupBy";
|
|
4
|
+
import isEmpty from "lodash/isEmpty";
|
|
5
|
+
import toPairs from "lodash/toPairs";
|
|
5
6
|
import { VictoryZoomContainer, useVictoryZoomContainer } from "victory-zoom-container";
|
|
6
7
|
import { VictorySelectionContainer, useVictorySelectionContainer } from "victory-selection-container";
|
|
7
|
-
import React from "react";
|
|
8
8
|
import { VictoryContainer } from "victory-core";
|
|
9
9
|
import { VictoryVoronoiContainer, useVictoryVoronoiContainer } from "victory-voronoi-container";
|
|
10
10
|
import { VictoryCursorContainer, useVictoryCursorContainer } from "victory-cursor-container";
|
|
@@ -21,7 +21,7 @@ const combineEventHandlers = eventHandlersArray => {
|
|
|
21
21
|
// takes an array of event handler objects and produces one eventHandlers object
|
|
22
22
|
// creates a custom combinedHandler() for events with multiple conflicting handlers
|
|
23
23
|
return eventHandlersArray.reduce((localHandlers, finalHandlers) => {
|
|
24
|
-
|
|
24
|
+
forOwn(localHandlers, (localHandler, eventName) => {
|
|
25
25
|
const existingHandler = finalHandlers[eventName];
|
|
26
26
|
if (existingHandler) {
|
|
27
27
|
// create new handler for event that concats the existing handler's mutations with new ones
|
|
@@ -42,11 +42,11 @@ const combineEventHandlers = eventHandlersArray => {
|
|
|
42
42
|
const combineDefaultEvents = defaultEvents => {
|
|
43
43
|
// takes a defaultEvents array and returns one equal or lesser length,
|
|
44
44
|
// by combining any events that have the same target
|
|
45
|
-
const eventsByTarget =
|
|
46
|
-
const events =
|
|
45
|
+
const eventsByTarget = groupBy(defaultEvents, "target");
|
|
46
|
+
const events = toPairs(eventsByTarget).map(_ref => {
|
|
47
47
|
let [target, eventsArray] = _ref;
|
|
48
48
|
const newEventsArray = eventsArray.filter(Boolean);
|
|
49
|
-
return
|
|
49
|
+
return isEmpty(newEventsArray) ? null : {
|
|
50
50
|
target,
|
|
51
51
|
eventHandlers: combineEventHandlers(eventsArray.map(event => event.eventHandlers))
|
|
52
52
|
// note: does not currently handle eventKey or childName
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { VictoryContainer, VictoryContainerProps } from "victory-core";
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export type ContainerType = "zoom" | "selection" | "brush" | "cursor" | "voronoi";
|
|
4
|
+
type ContainerComponents = Record<ContainerType, React.ComponentType<any> & {
|
|
5
5
|
defaultEvents: (props: any) => any[];
|
|
6
6
|
}>;
|
|
7
7
|
export declare function makeCreateContainerFunction<TContainerComponents extends ContainerComponents>(containerComponents: TContainerComponents, VictoryContainerBase: typeof VictoryContainer): <TContainerA extends ContainerType | VictoryContainerProps, TContainerB extends ContainerType | VictoryContainerProps>(containerA: TContainerA extends ContainerType ? TContainerA : ContainerType, containerB: TContainerB extends ContainerType ? TContainerB : ContainerType) => {
|
package/lib/create-container.js
CHANGED
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createContainer = void 0;
|
|
7
7
|
exports.makeCreateContainerFunction = makeCreateContainerFunction;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _forOwn = _interopRequireDefault(require("lodash/forOwn"));
|
|
10
|
+
var _groupBy = _interopRequireDefault(require("lodash/groupBy"));
|
|
11
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
12
|
+
var _toPairs = _interopRequireDefault(require("lodash/toPairs"));
|
|
12
13
|
var _victoryZoomContainer = require("victory-zoom-container");
|
|
13
14
|
var _victorySelectionContainer = require("victory-selection-container");
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
var _victoryCore = require("victory-core");
|
|
16
16
|
var _victoryVoronoiContainer = require("victory-voronoi-container");
|
|
17
17
|
var _victoryCursorContainer = require("victory-cursor-container");
|
|
@@ -29,7 +29,7 @@ const combineEventHandlers = eventHandlersArray => {
|
|
|
29
29
|
// takes an array of event handler objects and produces one eventHandlers object
|
|
30
30
|
// creates a custom combinedHandler() for events with multiple conflicting handlers
|
|
31
31
|
return eventHandlersArray.reduce((localHandlers, finalHandlers) => {
|
|
32
|
-
(0,
|
|
32
|
+
(0, _forOwn.default)(localHandlers, (localHandler, eventName) => {
|
|
33
33
|
const existingHandler = finalHandlers[eventName];
|
|
34
34
|
if (existingHandler) {
|
|
35
35
|
// create new handler for event that concats the existing handler's mutations with new ones
|
|
@@ -50,11 +50,11 @@ const combineEventHandlers = eventHandlersArray => {
|
|
|
50
50
|
const combineDefaultEvents = defaultEvents => {
|
|
51
51
|
// takes a defaultEvents array and returns one equal or lesser length,
|
|
52
52
|
// by combining any events that have the same target
|
|
53
|
-
const eventsByTarget = (0,
|
|
54
|
-
const events = (0,
|
|
53
|
+
const eventsByTarget = (0, _groupBy.default)(defaultEvents, "target");
|
|
54
|
+
const events = (0, _toPairs.default)(eventsByTarget).map(_ref => {
|
|
55
55
|
let [target, eventsArray] = _ref;
|
|
56
56
|
const newEventsArray = eventsArray.filter(Boolean);
|
|
57
|
-
return (0,
|
|
57
|
+
return (0, _isEmpty.default)(newEventsArray) ? null : {
|
|
58
58
|
target,
|
|
59
59
|
eventHandlers: combineEventHandlers(eventsArray.map(event => event.eventHandlers))
|
|
60
60
|
// note: does not currently handle eventKey or childName
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-create-container",
|
|
3
|
-
"version": "37.3.
|
|
3
|
+
"version": "37.3.4",
|
|
4
4
|
"description": "Container Helper for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lodash": "^4.17.19",
|
|
24
|
-
"victory-brush-container": "37.3.
|
|
25
|
-
"victory-core": "37.3.
|
|
26
|
-
"victory-cursor-container": "37.3.
|
|
27
|
-
"victory-selection-container": "37.3.
|
|
28
|
-
"victory-voronoi-container": "37.3.
|
|
29
|
-
"victory-zoom-container": "37.3.
|
|
24
|
+
"victory-brush-container": "37.3.4",
|
|
25
|
+
"victory-core": "37.3.4",
|
|
26
|
+
"victory-cursor-container": "37.3.4",
|
|
27
|
+
"victory-selection-container": "37.3.4",
|
|
28
|
+
"victory-voronoi-container": "37.3.4",
|
|
29
|
+
"victory-zoom-container": "37.3.4"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=16.6.0"
|
|
@@ -215,32 +215,6 @@
|
|
|
215
215
|
"pnpm-lock.yaml"
|
|
216
216
|
]
|
|
217
217
|
},
|
|
218
|
-
"format": {
|
|
219
|
-
"command": "nps format:pkg",
|
|
220
|
-
"files": [
|
|
221
|
-
"src/**",
|
|
222
|
-
"*.json",
|
|
223
|
-
"../../.prettierignore",
|
|
224
|
-
"../../.prettierrc.json"
|
|
225
|
-
],
|
|
226
|
-
"output": [],
|
|
227
|
-
"packageLocks": [
|
|
228
|
-
"pnpm-lock.yaml"
|
|
229
|
-
]
|
|
230
|
-
},
|
|
231
|
-
"format:fix": {
|
|
232
|
-
"command": "pnpm run format || nps format:pkg:fix",
|
|
233
|
-
"files": [
|
|
234
|
-
"src/**",
|
|
235
|
-
"*.json",
|
|
236
|
-
"../../.prettierignore",
|
|
237
|
-
"../../.prettierrc.json"
|
|
238
|
-
],
|
|
239
|
-
"output": [],
|
|
240
|
-
"packageLocks": [
|
|
241
|
-
"pnpm-lock.yaml"
|
|
242
|
-
]
|
|
243
|
-
},
|
|
244
218
|
"lint": {
|
|
245
219
|
"command": "eslint src",
|
|
246
220
|
"files": [
|
|
@@ -318,8 +292,6 @@
|
|
|
318
292
|
"check": "wireit",
|
|
319
293
|
"types:check": "wireit",
|
|
320
294
|
"types:create": "wireit",
|
|
321
|
-
"format": "wireit",
|
|
322
|
-
"format:fix": "wireit",
|
|
323
295
|
"lint": "wireit",
|
|
324
296
|
"lint:fix": "wireit",
|
|
325
297
|
"jest": "wireit"
|
package/src/create-container.tsx
CHANGED
|
@@ -1,22 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import forOwn from "lodash/forOwn";
|
|
3
|
+
import groupBy from "lodash/groupBy";
|
|
4
|
+
import isEmpty from "lodash/isEmpty";
|
|
5
|
+
import toPairs from "lodash/toPairs";
|
|
6
|
+
|
|
1
7
|
import {
|
|
2
8
|
VictoryZoomContainer,
|
|
3
9
|
useVictoryZoomContainer,
|
|
4
10
|
} from "victory-zoom-container";
|
|
11
|
+
|
|
5
12
|
import {
|
|
6
13
|
VictorySelectionContainer,
|
|
7
14
|
useVictorySelectionContainer,
|
|
8
15
|
} from "victory-selection-container";
|
|
9
|
-
|
|
16
|
+
|
|
10
17
|
import { VictoryContainer, VictoryContainerProps } from "victory-core";
|
|
11
|
-
|
|
18
|
+
|
|
12
19
|
import {
|
|
13
20
|
VictoryVoronoiContainer,
|
|
14
21
|
useVictoryVoronoiContainer,
|
|
15
22
|
} from "victory-voronoi-container";
|
|
23
|
+
|
|
16
24
|
import {
|
|
17
25
|
VictoryCursorContainer,
|
|
18
26
|
useVictoryCursorContainer,
|
|
19
27
|
} from "victory-cursor-container";
|
|
28
|
+
|
|
20
29
|
import {
|
|
21
30
|
VictoryBrushContainer,
|
|
22
31
|
useVictoryBrushContainer,
|