victory-shared-events 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-shared-events.js +150 -104
- package/dist/victory-shared-events.min.js +1 -1
- package/es/victory-shared-events.d.ts +1 -2
- package/es/victory-shared-events.js +9 -9
- package/lib/victory-shared-events.d.ts +1 -2
- package/lib/victory-shared-events.js +9 -9
- package/package.json +2 -30
- package/src/victory-shared-events.tsx +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -22,22 +22,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22
22
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
23
23
|
/* harmony export */ "VictorySharedEvents": function() { return /* binding */ VictorySharedEvents; }
|
|
24
24
|
/* harmony export */ });
|
|
25
|
-
/* harmony import */ var
|
|
26
|
-
/* harmony import */ var
|
|
27
|
-
/* harmony import */ var
|
|
28
|
-
/* harmony import */ var
|
|
29
|
-
/* harmony import */ var
|
|
30
|
-
/* harmony import */ var
|
|
31
|
-
/* harmony import */ var
|
|
32
|
-
/* harmony import */ var
|
|
33
|
-
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/timer-context.js");
|
|
34
|
-
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/events.js");
|
|
35
|
-
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/collection.js");
|
|
36
|
-
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
|
|
25
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
26
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
27
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
28
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
29
|
+
/* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/isEmpty */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isEmpty.js");
|
|
30
|
+
/* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);
|
|
31
|
+
/* harmony import */ var lodash_fromPairs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/fromPairs */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/fromPairs.js");
|
|
32
|
+
/* harmony import */ var lodash_fromPairs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_fromPairs__WEBPACK_IMPORTED_MODULE_3__);
|
|
37
33
|
/* harmony import */ var react_fast_compare__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-fast-compare */ "../../../node_modules/.pnpm/react-fast-compare@3.2.0/node_modules/react-fast-compare/index.js");
|
|
38
34
|
/* harmony import */ var react_fast_compare__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_fast_compare__WEBPACK_IMPORTED_MODULE_4__);
|
|
39
35
|
/* harmony import */ var json_stringify_safe__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! json-stringify-safe */ "../../../node_modules/.pnpm/json-stringify-safe@5.0.1/node_modules/json-stringify-safe/stringify.js");
|
|
40
36
|
/* harmony import */ var json_stringify_safe__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(json_stringify_safe__WEBPACK_IMPORTED_MODULE_5__);
|
|
37
|
+
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/timer-context.js");
|
|
38
|
+
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/events.js");
|
|
39
|
+
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/collection.js");
|
|
40
|
+
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
@@ -53,12 +53,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
53
53
|
|
|
54
54
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
55
55
|
|
|
56
|
-
class VictorySharedEvents extends (
|
|
56
|
+
class VictorySharedEvents extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
|
|
57
57
|
static displayName = "VictorySharedEvents";
|
|
58
58
|
static role = "shared-event-wrapper";
|
|
59
59
|
static contextType = victory_core__WEBPACK_IMPORTED_MODULE_6__["default"];
|
|
60
60
|
static defaultProps = {
|
|
61
|
-
groupComponent: /*#__PURE__*/
|
|
61
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("g", null)
|
|
62
62
|
};
|
|
63
63
|
constructor(props) {
|
|
64
64
|
super(props);
|
|
@@ -115,7 +115,7 @@ class VictorySharedEvents extends (react__WEBPACK_IMPORTED_MODULE_3___default().
|
|
|
115
115
|
return props.events;
|
|
116
116
|
}
|
|
117
117
|
applyExternalMutations(props, externalMutations) {
|
|
118
|
-
if (!
|
|
118
|
+
if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(externalMutations)) {
|
|
119
119
|
const callbacks = props.externalEventMutations.reduce((memo, mutation) => victory_core__WEBPACK_IMPORTED_MODULE_9__.isFunction(mutation.callback) ? memo.concat(mutation.callback) : memo, []);
|
|
120
120
|
const compiledCallbacks = callbacks.length ? () => {
|
|
121
121
|
callbacks.forEach(c => c());
|
|
@@ -124,7 +124,7 @@ class VictorySharedEvents extends (react__WEBPACK_IMPORTED_MODULE_3___default().
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
getExternalMutations(props, baseProps) {
|
|
127
|
-
return !
|
|
127
|
+
return !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(props.externalEventMutations) ? victory_core__WEBPACK_IMPORTED_MODULE_7__.getExternalMutationsWithChildren(props.externalEventMutations, baseProps, this.state, Object.keys(baseProps)) : undefined;
|
|
128
128
|
}
|
|
129
129
|
cacheSharedEvents(name, sharedEvents, cacheValues) {
|
|
130
130
|
this.sharedEventsCache[name] = [sharedEvents, cacheValues];
|
|
@@ -140,7 +140,7 @@ class VictorySharedEvents extends (react__WEBPACK_IMPORTED_MODULE_3___default().
|
|
|
140
140
|
const {
|
|
141
141
|
container
|
|
142
142
|
} = props;
|
|
143
|
-
const children =
|
|
143
|
+
const children = react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(this.props.children);
|
|
144
144
|
const childBaseProps = this.getBasePropsFromChildren(children);
|
|
145
145
|
const parentBaseProps = container ? container.props : {};
|
|
146
146
|
return Object.assign({}, childBaseProps, {
|
|
@@ -156,7 +156,7 @@ class VictorySharedEvents extends (react__WEBPACK_IMPORTED_MODULE_3___default().
|
|
|
156
156
|
return null;
|
|
157
157
|
};
|
|
158
158
|
const baseProps = victory_core__WEBPACK_IMPORTED_MODULE_9__.reduceChildren(childComponents, iteratee);
|
|
159
|
-
return
|
|
159
|
+
return lodash_fromPairs__WEBPACK_IMPORTED_MODULE_3___default()(baseProps);
|
|
160
160
|
}
|
|
161
161
|
getNewChildren(props, baseProps) {
|
|
162
162
|
const {
|
|
@@ -166,9 +166,9 @@ class VictorySharedEvents extends (react__WEBPACK_IMPORTED_MODULE_3___default().
|
|
|
166
166
|
const alterChildren = (children, childNames) => {
|
|
167
167
|
return children.reduce((memo, child, index) => {
|
|
168
168
|
if (child.props.children) {
|
|
169
|
-
const newChildren =
|
|
169
|
+
const newChildren = react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(child.props.children);
|
|
170
170
|
const names = childNames.slice(index, index + newChildren.length);
|
|
171
|
-
const results = /*#__PURE__*/
|
|
171
|
+
const results = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(child, child.props, alterChildren(newChildren, names));
|
|
172
172
|
return memo.concat(results);
|
|
173
173
|
} else if (childNames[index] !== "parent" && child.type && victory_core__WEBPACK_IMPORTED_MODULE_9__.isFunction(child.type.getBaseProps)) {
|
|
174
174
|
const name = child.props.name || childNames[index];
|
|
@@ -187,7 +187,7 @@ class VictorySharedEvents extends (react__WEBPACK_IMPORTED_MODULE_3___default().
|
|
|
187
187
|
getEventState: (key, target) => this.getEventState(key, target, name)
|
|
188
188
|
};
|
|
189
189
|
this.cacheSharedEvents(name, sharedEvents, sharedEventsCacheValues);
|
|
190
|
-
return memo.concat( /*#__PURE__*/
|
|
190
|
+
return memo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(child, Object.assign({
|
|
191
191
|
key: `events-${name}`,
|
|
192
192
|
sharedEvents,
|
|
193
193
|
eventKey,
|
|
@@ -198,7 +198,7 @@ class VictorySharedEvents extends (react__WEBPACK_IMPORTED_MODULE_3___default().
|
|
|
198
198
|
}, []);
|
|
199
199
|
};
|
|
200
200
|
const childNames = Object.keys(baseProps);
|
|
201
|
-
const childComponents =
|
|
201
|
+
const childComponents = react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(props.children);
|
|
202
202
|
return alterChildren(childComponents, childNames);
|
|
203
203
|
}
|
|
204
204
|
getContainer(props, baseProps, events) {
|
|
@@ -217,22 +217,22 @@ class VictorySharedEvents extends (react__WEBPACK_IMPORTED_MODULE_3___default().
|
|
|
217
217
|
const parentEvents = sharedEvents && boundGetEvents({
|
|
218
218
|
sharedEvents
|
|
219
219
|
}, "parent");
|
|
220
|
-
const parentProps =
|
|
220
|
+
const parentProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, this.getEventState("parent", "parent"), containerProps, baseProps.parent, {
|
|
221
221
|
children
|
|
222
222
|
});
|
|
223
|
-
const containerEvents =
|
|
223
|
+
const containerEvents = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, victory_core__WEBPACK_IMPORTED_MODULE_7__.getPartialEvents(parentEvents, "parent", parentProps), containerProps.events);
|
|
224
224
|
this.globalEvents = victory_core__WEBPACK_IMPORTED_MODULE_7__.getGlobalEvents(containerEvents);
|
|
225
225
|
const localEvents = victory_core__WEBPACK_IMPORTED_MODULE_7__.omitGlobalEvents(containerEvents);
|
|
226
|
-
return role === "container" ? /*#__PURE__*/
|
|
226
|
+
return role === "container" ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(container, Object.assign({}, parentProps, {
|
|
227
227
|
events: localEvents
|
|
228
|
-
})) : /*#__PURE__*/
|
|
228
|
+
})) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(container, localEvents, children);
|
|
229
229
|
}
|
|
230
230
|
render() {
|
|
231
231
|
const events = this.getAllEvents(this.props);
|
|
232
232
|
if (events) {
|
|
233
233
|
return this.getContainer(this.props, this.baseProps, events);
|
|
234
234
|
}
|
|
235
|
-
return /*#__PURE__*/
|
|
235
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(this.props.container, {
|
|
236
236
|
children: this.props.children
|
|
237
237
|
});
|
|
238
238
|
}
|
|
@@ -4045,14 +4045,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4045
4045
|
/* harmony export */ "getScopedEvents": function() { return /* binding */ getScopedEvents; },
|
|
4046
4046
|
/* harmony export */ "omitGlobalEvents": function() { return /* binding */ omitGlobalEvents; }
|
|
4047
4047
|
/* harmony export */ });
|
|
4048
|
-
/* harmony import */ var
|
|
4049
|
-
/* harmony import */ var
|
|
4050
|
-
/* harmony import */ var
|
|
4051
|
-
/* harmony import */ var
|
|
4052
|
-
/* harmony import */ var
|
|
4053
|
-
/* harmony import */ var
|
|
4054
|
-
/* harmony import */ var
|
|
4055
|
-
/* harmony import */ var
|
|
4048
|
+
/* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/isEmpty */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isEmpty.js");
|
|
4049
|
+
/* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0__);
|
|
4050
|
+
/* harmony import */ var lodash_pickBy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/pickBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/pickBy.js");
|
|
4051
|
+
/* harmony import */ var lodash_pickBy__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_pickBy__WEBPACK_IMPORTED_MODULE_1__);
|
|
4052
|
+
/* harmony import */ var lodash_omitBy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/omitBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/omitBy.js");
|
|
4053
|
+
/* harmony import */ var lodash_omitBy__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_omitBy__WEBPACK_IMPORTED_MODULE_2__);
|
|
4054
|
+
/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/uniq */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniq.js");
|
|
4055
|
+
/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_uniq__WEBPACK_IMPORTED_MODULE_3__);
|
|
4056
4056
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
4057
4057
|
|
|
4058
4058
|
|
|
@@ -4128,7 +4128,7 @@ getScopedEvents) {
|
|
|
4128
4128
|
*/
|
|
4129
4129
|
// eslint-disable-next-line max-params
|
|
4130
4130
|
function getScopedEvents(events, namespace, childType, baseProps) {
|
|
4131
|
-
if (
|
|
4131
|
+
if (lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(events)) {
|
|
4132
4132
|
return {};
|
|
4133
4133
|
}
|
|
4134
4134
|
|
|
@@ -4241,7 +4241,7 @@ function getScopedEvents(events, namespace, childType, baseProps) {
|
|
|
4241
4241
|
// eslint-disable-next-line max-params
|
|
4242
4242
|
const onEvent = (evt, childProps, eventKey, eventName) => {
|
|
4243
4243
|
const eventReturn = events[eventName](evt, childProps, eventKey, this);
|
|
4244
|
-
if (!
|
|
4244
|
+
if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(eventReturn)) {
|
|
4245
4245
|
const callbacks = compileCallbacks(eventReturn);
|
|
4246
4246
|
this.setState(parseEventReturn(eventReturn, eventKey), callbacks);
|
|
4247
4247
|
}
|
|
@@ -4302,7 +4302,7 @@ function getExternalMutationsWithChildren(mutations, baseProps, baseState, child
|
|
|
4302
4302
|
const childState = baseState[childName];
|
|
4303
4303
|
const mutation = getExternalMutations(mutations, baseProps[childName], baseState[childName], childName);
|
|
4304
4304
|
memo[childName] = mutation ? mutation : childState;
|
|
4305
|
-
return
|
|
4305
|
+
return lodash_pickBy__WEBPACK_IMPORTED_MODULE_1___default()(memo, v => !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(v));
|
|
4306
4306
|
}, {});
|
|
4307
4307
|
}
|
|
4308
4308
|
|
|
@@ -4338,7 +4338,7 @@ function getExternalMutations(mutations, baseProps, baseState, childName) {
|
|
|
4338
4338
|
} else {
|
|
4339
4339
|
// use keys from both state and props so that elements not intially included in baseProps
|
|
4340
4340
|
// will be used. (i.e. labels)
|
|
4341
|
-
const targets =
|
|
4341
|
+
const targets = lodash_uniq__WEBPACK_IMPORTED_MODULE_3___default()(Object.keys(keyProps).concat(Object.keys(keyState)));
|
|
4342
4342
|
memo[eventKey] = targets.reduce((m, target) => {
|
|
4343
4343
|
const identifier = {
|
|
4344
4344
|
eventKey,
|
|
@@ -4347,10 +4347,10 @@ function getExternalMutations(mutations, baseProps, baseState, childName) {
|
|
|
4347
4347
|
};
|
|
4348
4348
|
const mutation = getExternalMutation(mutations, keyProps[target], keyState[target], identifier);
|
|
4349
4349
|
m[target] = mutation !== undefined ? Object.assign({}, keyState[target], mutation) : keyState[target];
|
|
4350
|
-
return
|
|
4350
|
+
return lodash_pickBy__WEBPACK_IMPORTED_MODULE_1___default()(m, v => !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(v));
|
|
4351
4351
|
}, {});
|
|
4352
4352
|
}
|
|
4353
|
-
return
|
|
4353
|
+
return lodash_pickBy__WEBPACK_IMPORTED_MODULE_1___default()(memo, v => !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(v));
|
|
4354
4354
|
}, {});
|
|
4355
4355
|
}
|
|
4356
4356
|
|
|
@@ -4382,11 +4382,11 @@ function getExternalMutation(mutations, baseProps, baseState, identifier) {
|
|
|
4382
4382
|
}
|
|
4383
4383
|
// find any mutation objects that match the target
|
|
4384
4384
|
const targetMutations = scopedMutations.filter(m => filterMutations(m, "target"));
|
|
4385
|
-
if (
|
|
4385
|
+
if (lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(targetMutations)) {
|
|
4386
4386
|
return undefined;
|
|
4387
4387
|
}
|
|
4388
4388
|
const keyMutations = targetMutations.filter(m => filterMutations(m, "eventKey"));
|
|
4389
|
-
if (
|
|
4389
|
+
if (lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(keyMutations)) {
|
|
4390
4390
|
return undefined;
|
|
4391
4391
|
}
|
|
4392
4392
|
return keyMutations.reduce((memo, curr) => {
|
|
@@ -4412,8 +4412,8 @@ function getGlobalEventNameFromKey(key) {
|
|
|
4412
4412
|
const match = key.match(GLOBAL_EVENT_REGEX);
|
|
4413
4413
|
return match && match[1] && match[1].toLowerCase();
|
|
4414
4414
|
}
|
|
4415
|
-
const getGlobalEvents = events =>
|
|
4416
|
-
const omitGlobalEvents = events =>
|
|
4415
|
+
const getGlobalEvents = events => lodash_pickBy__WEBPACK_IMPORTED_MODULE_1___default()(events, (_, key) => GLOBAL_EVENT_REGEX.test(key));
|
|
4416
|
+
const omitGlobalEvents = events => lodash_omitBy__WEBPACK_IMPORTED_MODULE_2___default()(events, (_, key) => GLOBAL_EVENT_REGEX.test(key));
|
|
4417
4417
|
const emulateReactEvent = event => Object.assign(event, {
|
|
4418
4418
|
nativeEvent: event
|
|
4419
4419
|
});
|
|
@@ -4454,40 +4454,45 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4454
4454
|
/* harmony export */ "reduceChildren": function() { return /* binding */ reduceChildren; },
|
|
4455
4455
|
/* harmony export */ "scalePoint": function() { return /* binding */ scalePoint; }
|
|
4456
4456
|
/* harmony export */ });
|
|
4457
|
-
/* harmony import */ var
|
|
4458
|
-
/* harmony import */ var
|
|
4459
|
-
/* harmony import */ var
|
|
4460
|
-
/* harmony import */ var
|
|
4461
|
-
/* harmony import */ var
|
|
4462
|
-
/* harmony import */ var
|
|
4463
|
-
/* harmony import */ var
|
|
4464
|
-
/* harmony import */ var
|
|
4465
|
-
|
|
4457
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
4458
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
4459
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
4460
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
4461
|
+
/* harmony import */ var lodash_property__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/property */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/property.js");
|
|
4462
|
+
/* harmony import */ var lodash_property__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_property__WEBPACK_IMPORTED_MODULE_2__);
|
|
4463
|
+
/* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/pick */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/pick.js");
|
|
4464
|
+
/* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_pick__WEBPACK_IMPORTED_MODULE_3__);
|
|
4466
4465
|
|
|
4467
4466
|
|
|
4468
4467
|
|
|
4469
|
-
// Private Functions
|
|
4470
4468
|
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4469
|
+
/**
|
|
4470
|
+
* Determine the range of a cartesian axis
|
|
4471
|
+
*/
|
|
4472
|
+
function getCartesianRange(options) {
|
|
4473
|
+
const vertical = options.axis !== "x";
|
|
4475
4474
|
if (vertical) {
|
|
4476
|
-
return [
|
|
4475
|
+
return [options.height - options.padding.bottom, options.padding.top];
|
|
4477
4476
|
}
|
|
4478
|
-
return [padding.left,
|
|
4477
|
+
return [options.padding.left, options.width - options.padding.right];
|
|
4479
4478
|
}
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4479
|
+
|
|
4480
|
+
/**
|
|
4481
|
+
* Determine the range of a polar axis in radians
|
|
4482
|
+
*/
|
|
4483
|
+
function getPolarRange(options) {
|
|
4484
|
+
if (options.axis === "x") {
|
|
4485
|
+
const startAngle = degreesToRadians(options.startAngle || 0);
|
|
4486
|
+
const endAngle = degreesToRadians(options.endAngle || 360);
|
|
4484
4487
|
return [startAngle, endAngle];
|
|
4485
4488
|
}
|
|
4486
|
-
return [
|
|
4489
|
+
return [options.innerRadius || 0, getRadius({
|
|
4490
|
+
height: options.height,
|
|
4491
|
+
width: options.width,
|
|
4492
|
+
padding: options.padding
|
|
4493
|
+
})];
|
|
4487
4494
|
}
|
|
4488
4495
|
|
|
4489
|
-
// Exported Functions
|
|
4490
|
-
|
|
4491
4496
|
/**
|
|
4492
4497
|
* Creates an object composed of the inverted keys and values of object.
|
|
4493
4498
|
* If object contains duplicate values, subsequent values overwrite property assignments of previous values.
|
|
@@ -4524,8 +4529,11 @@ function omit(originalObject, ks) {
|
|
|
4524
4529
|
}
|
|
4525
4530
|
return newObject;
|
|
4526
4531
|
}
|
|
4532
|
+
|
|
4533
|
+
/**
|
|
4534
|
+
* Coalesce the x and y values from a data point
|
|
4535
|
+
*/
|
|
4527
4536
|
function getPoint(datum) {
|
|
4528
|
-
const exists = val => val !== undefined;
|
|
4529
4537
|
const {
|
|
4530
4538
|
_x,
|
|
4531
4539
|
_x1,
|
|
@@ -4536,16 +4544,20 @@ function getPoint(datum) {
|
|
|
4536
4544
|
_y0,
|
|
4537
4545
|
_voronoiY
|
|
4538
4546
|
} = datum;
|
|
4539
|
-
const defaultX =
|
|
4540
|
-
const defaultY =
|
|
4547
|
+
const defaultX = _x1 ?? _x;
|
|
4548
|
+
const defaultY = _y1 ?? _y;
|
|
4541
4549
|
const point = {
|
|
4542
|
-
x:
|
|
4543
|
-
x0:
|
|
4544
|
-
y:
|
|
4545
|
-
y0:
|
|
4550
|
+
x: _voronoiX ?? defaultX,
|
|
4551
|
+
x0: _x0 ?? _x,
|
|
4552
|
+
y: _voronoiY ?? defaultY,
|
|
4553
|
+
y0: _y0 ?? _y
|
|
4546
4554
|
};
|
|
4547
|
-
return
|
|
4555
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, point, datum);
|
|
4548
4556
|
}
|
|
4557
|
+
|
|
4558
|
+
/**
|
|
4559
|
+
* Scale a point based on the origin, direction, and given scale function
|
|
4560
|
+
*/
|
|
4549
4561
|
function scalePoint(props, datum) {
|
|
4550
4562
|
const {
|
|
4551
4563
|
scale,
|
|
@@ -4568,11 +4580,11 @@ function scalePoint(props, datum) {
|
|
|
4568
4580
|
y0: polar ? -y0 * Math.sin(x0) + origin.x : y0
|
|
4569
4581
|
};
|
|
4570
4582
|
}
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4583
|
+
|
|
4584
|
+
/**
|
|
4585
|
+
* Returns a padding value from a number or partial padding values
|
|
4586
|
+
*/
|
|
4587
|
+
function getPadding(padding) {
|
|
4576
4588
|
const paddingVal = typeof padding === "number" ? padding : 0;
|
|
4577
4589
|
const paddingObj = typeof padding === "object" ? padding : {};
|
|
4578
4590
|
return {
|
|
@@ -4582,6 +4594,10 @@ function getPadding(props, name) {
|
|
|
4582
4594
|
right: paddingObj.right || paddingVal
|
|
4583
4595
|
};
|
|
4584
4596
|
}
|
|
4597
|
+
|
|
4598
|
+
/**
|
|
4599
|
+
* Returns true if the component is defined as a tooltip
|
|
4600
|
+
*/
|
|
4585
4601
|
function isTooltip(component) {
|
|
4586
4602
|
const labelRole = component && component.type && component.type.role;
|
|
4587
4603
|
return labelRole === "tooltip";
|
|
@@ -4596,8 +4612,8 @@ function getDefaultStyles(props, role) {
|
|
|
4596
4612
|
return defaultStyles;
|
|
4597
4613
|
}
|
|
4598
4614
|
const tooltipStyle = theme.tooltip && theme.tooltip.style || {};
|
|
4599
|
-
const labelStyle =
|
|
4600
|
-
return
|
|
4615
|
+
const labelStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, tooltipStyle, defaultStyles.labels);
|
|
4616
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, {
|
|
4601
4617
|
labels: labelStyle
|
|
4602
4618
|
}, defaultStyles);
|
|
4603
4619
|
}
|
|
@@ -4605,7 +4621,7 @@ function getStyles(style, defaultStyles) {
|
|
|
4605
4621
|
const width = "100%";
|
|
4606
4622
|
const height = "100%";
|
|
4607
4623
|
if (!style) {
|
|
4608
|
-
return
|
|
4624
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
|
|
4609
4625
|
parent: {
|
|
4610
4626
|
height,
|
|
4611
4627
|
width
|
|
@@ -4621,14 +4637,18 @@ function getStyles(style, defaultStyles) {
|
|
|
4621
4637
|
const defaultLabels = defaultStyles && defaultStyles.labels || {};
|
|
4622
4638
|
const defaultData = defaultStyles && defaultStyles.data || {};
|
|
4623
4639
|
return {
|
|
4624
|
-
parent:
|
|
4640
|
+
parent: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, parent, defaultParent, {
|
|
4625
4641
|
width,
|
|
4626
4642
|
height
|
|
4627
4643
|
}),
|
|
4628
|
-
labels:
|
|
4629
|
-
data:
|
|
4644
|
+
labels: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labels, defaultLabels),
|
|
4645
|
+
data: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, data, defaultData)
|
|
4630
4646
|
};
|
|
4631
4647
|
}
|
|
4648
|
+
|
|
4649
|
+
/**
|
|
4650
|
+
* Returns the value of a prop or accessor function with the given props
|
|
4651
|
+
*/
|
|
4632
4652
|
function evaluateProp(prop, props) {
|
|
4633
4653
|
return isFunction(prop) ? prop(props) : prop;
|
|
4634
4654
|
}
|
|
@@ -4650,19 +4670,28 @@ function degreesToRadians(degrees) {
|
|
|
4650
4670
|
function radiansToDegrees(radians) {
|
|
4651
4671
|
return typeof radians === "number" ? radians / (Math.PI / 180) : radians;
|
|
4652
4672
|
}
|
|
4653
|
-
|
|
4673
|
+
|
|
4674
|
+
/**
|
|
4675
|
+
* Get the maximum radius that will fit in the container
|
|
4676
|
+
*/
|
|
4677
|
+
function getRadius(options) {
|
|
4678
|
+
const {
|
|
4679
|
+
width,
|
|
4680
|
+
height,
|
|
4681
|
+
padding
|
|
4682
|
+
} = options;
|
|
4654
4683
|
const {
|
|
4655
4684
|
left,
|
|
4656
4685
|
right,
|
|
4657
4686
|
top,
|
|
4658
4687
|
bottom
|
|
4659
|
-
} =
|
|
4660
|
-
const {
|
|
4661
|
-
width,
|
|
4662
|
-
height
|
|
4663
|
-
} = props;
|
|
4688
|
+
} = padding;
|
|
4664
4689
|
return Math.min(width - left - right, height - top - bottom) / 2;
|
|
4665
4690
|
}
|
|
4691
|
+
|
|
4692
|
+
/**
|
|
4693
|
+
* Returns the origin for a polar chart within the padded area
|
|
4694
|
+
*/
|
|
4666
4695
|
function getPolarOrigin(props) {
|
|
4667
4696
|
const {
|
|
4668
4697
|
width,
|
|
@@ -4673,7 +4702,7 @@ function getPolarOrigin(props) {
|
|
|
4673
4702
|
bottom,
|
|
4674
4703
|
left,
|
|
4675
4704
|
right
|
|
4676
|
-
} = getPadding(props);
|
|
4705
|
+
} = getPadding(props.padding);
|
|
4677
4706
|
const radius = Math.min(width - left - right, height - top - bottom) / 2;
|
|
4678
4707
|
const offsetWidth = width / 2 + left - right;
|
|
4679
4708
|
const offsetHeight = height / 2 + top - bottom;
|
|
@@ -4682,13 +4711,30 @@ function getPolarOrigin(props) {
|
|
|
4682
4711
|
y: offsetHeight + radius > height ? radius + top - bottom : offsetHeight
|
|
4683
4712
|
};
|
|
4684
4713
|
}
|
|
4714
|
+
|
|
4715
|
+
/**
|
|
4716
|
+
* Determine the range of an axis based on the given props
|
|
4717
|
+
*/
|
|
4685
4718
|
function getRange(props, axis) {
|
|
4686
4719
|
if (props.range && props.range[axis]) {
|
|
4687
4720
|
return props.range[axis];
|
|
4688
4721
|
} else if (props.range && Array.isArray(props.range)) {
|
|
4689
4722
|
return props.range;
|
|
4690
4723
|
}
|
|
4691
|
-
return props.polar ? getPolarRange(
|
|
4724
|
+
return props.polar ? getPolarRange({
|
|
4725
|
+
axis,
|
|
4726
|
+
innerRadius: props.innerRadius,
|
|
4727
|
+
startAngle: props.startAngle,
|
|
4728
|
+
endAngle: props.endAngle,
|
|
4729
|
+
height: props.height,
|
|
4730
|
+
width: props.width,
|
|
4731
|
+
padding: getPadding(props.padding)
|
|
4732
|
+
}) : getCartesianRange({
|
|
4733
|
+
axis,
|
|
4734
|
+
height: props.height,
|
|
4735
|
+
width: props.width,
|
|
4736
|
+
padding: getPadding(props.padding)
|
|
4737
|
+
});
|
|
4692
4738
|
}
|
|
4693
4739
|
|
|
4694
4740
|
/**
|
|
@@ -4720,7 +4766,7 @@ function createAccessor(key) {
|
|
|
4720
4766
|
return x => x;
|
|
4721
4767
|
}
|
|
4722
4768
|
// otherwise, assume it is an array index, property key or path (_.property handles all three)
|
|
4723
|
-
return
|
|
4769
|
+
return lodash_property__WEBPACK_IMPORTED_MODULE_2___default()(key);
|
|
4724
4770
|
}
|
|
4725
4771
|
function modifyProps(props, fallbackProps, role) {
|
|
4726
4772
|
const theme = props.theme && props.theme[role] ? props.theme[role] : {};
|
|
@@ -4729,7 +4775,7 @@ function modifyProps(props, fallbackProps, role) {
|
|
|
4729
4775
|
const defaultObject = horizontal === undefined ? {} : {
|
|
4730
4776
|
horizontal
|
|
4731
4777
|
};
|
|
4732
|
-
return
|
|
4778
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()(defaultObject, props, themeProps, fallbackProps);
|
|
4733
4779
|
}
|
|
4734
4780
|
|
|
4735
4781
|
/**
|
|
@@ -4816,10 +4862,10 @@ initialMemo, combine) {
|
|
|
4816
4862
|
const childRole = child.type && child.type.role;
|
|
4817
4863
|
const childName = child.props.name || `${childRole}-${names[index]}`;
|
|
4818
4864
|
if (child.props && child.props.children) {
|
|
4819
|
-
const childProps = Object.assign({}, child.props,
|
|
4820
|
-
const nestedChildren = child.type && child.type.role === "stack" && isFunction(child.type.getChildren) ? child.type.getChildren(childProps) :
|
|
4821
|
-
const nestedChildProps = Object.assign({}, c.props,
|
|
4822
|
-
return /*#__PURE__*/
|
|
4865
|
+
const childProps = Object.assign({}, child.props, lodash_pick__WEBPACK_IMPORTED_MODULE_3___default()(parentProps, sharedProps));
|
|
4866
|
+
const nestedChildren = child.type && child.type.role === "stack" && isFunction(child.type.getChildren) ? child.type.getChildren(childProps) : react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(child.props.children).map(c => {
|
|
4867
|
+
const nestedChildProps = Object.assign({}, c.props, lodash_pick__WEBPACK_IMPORTED_MODULE_3___default()(childProps, sharedProps));
|
|
4868
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(c, nestedChildProps);
|
|
4823
4869
|
});
|
|
4824
4870
|
const childNames = nestedChildren.map((c, i) => `${childName}-${i}`);
|
|
4825
4871
|
const nestedResults = traverseChildren(nestedChildren, childNames, child);
|
|
@@ -4833,7 +4879,7 @@ initialMemo, combine) {
|
|
|
4833
4879
|
return newMemo;
|
|
4834
4880
|
}, initialMemo);
|
|
4835
4881
|
};
|
|
4836
|
-
const validChildren = children.filter(
|
|
4882
|
+
const validChildren = children.filter(react__WEBPACK_IMPORTED_MODULE_0__.isValidElement);
|
|
4837
4883
|
const childNames = validChildren.map((c, i) => i);
|
|
4838
4884
|
return traverseChildren(validChildren, childNames);
|
|
4839
4885
|
}
|
|
@@ -4853,10 +4899,10 @@ function isHorizontal(props) {
|
|
|
4853
4899
|
if (memo || childProps.horizontal || !childProps.children) {
|
|
4854
4900
|
return memo || childProps.horizontal;
|
|
4855
4901
|
}
|
|
4856
|
-
return traverseChildren(
|
|
4902
|
+
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(childProps.children));
|
|
4857
4903
|
}, false);
|
|
4858
4904
|
};
|
|
4859
|
-
return traverseChildren(
|
|
4905
|
+
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(props.children));
|
|
4860
4906
|
}
|
|
4861
4907
|
|
|
4862
4908
|
/***/ }),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):"object"==typeof exports?exports.VictorySharedEvents=n(require("react")):t.VictorySharedEvents=n(t.React)}(self,(function(t){return function(){var n={2516:function(t,n){function e(t,n){var e=[],r=[];return null==n&&(n=function(t,n){return e[0]===n?"[Circular ~]":"[Circular ~."+r.slice(0,e.indexOf(n)).join(".")+"]"}),function(o,i){if(e.length>0){var s=e.indexOf(this);~s?e.splice(s+1):e.push(this),~s?r.splice(s,1/0,o):r.push(o),~e.indexOf(i)&&(i=n.call(this,o,i))}else e.push(i);return null==t?i:t.call(this,o,i)}}(t.exports=function(t,n,r,o){return JSON.stringify(t,e(n,o),r)}).getSerialize=e},3273:function(t,n,e){var r=e(163);t.exports=function(){if(!arguments.length)return[];var t=arguments[0];return r(t)?t:[t]}},8708:function(t,n,e){var r=e(1171),o=e(7838),i=e(4859),s=e(4073),u=e(8541);function c(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=s,c.prototype.set=u,t.exports=c},2596:function(t,n,e){var r=e(2373).Symbol;t.exports=r},6082:function(t){t.exports=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}},5510:function(t,n,e){var r=e(6123);t.exports=function(t,n){return!(null==t||!t.length)&&r(t,n,0)>-1}},9955:function(t){t.exports=function(t,n,e){for(var r=-1,o=null==t?0:t.length;++r<o;)if(e(n,t[r]))return!0;return!1}},8644:function(t){t.exports=function(t,n){for(var e=-1,r=null==t?0:t.length,o=Array(r);++e<r;)o[e]=n(t[e],e,t);return o}},9559:function(t){t.exports=function(t,n){for(var e=-1,r=n.length,o=t.length;++e<r;)t[o+e]=n[e];return t}},1634:function(t){t.exports=function(t,n){for(var e=-1,r=null==t?0:t.length;++e<r;)if(n(t[e],e,t))return!0;return!1}},4132:function(t,n,e){var r=e(8347),o=e(788),i=Object.prototype.hasOwnProperty;t.exports=function(t,n,e){var s=t[n];i.call(t,n)&&o(s,e)&&(void 0!==e||n in t)||r(t,n,e)}},3162:function(t,n,e){var r=e(788);t.exports=function(t,n){for(var e=t.length;e--;)if(r(t[e][0],n))return e;return-1}},8347:function(t,n,e){var r=e(5525);t.exports=function(t,n,e){"__proto__"==n&&r?r(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e}},6457:function(t,n,e){var r=e(9559),o=e(3608);t.exports=function t(n,e,i,s,u){var c=-1,a=n.length;for(i||(i=o),u||(u=[]);++c<a;){var f=n[c];e>0&&i(f)?e>1?t(f,e-1,i,s,u):r(u,f):s||(u[u.length]=f)}return u}},4432:function(t,n,e){var r=e(9026),o=e(3110);t.exports=function(t,n){for(var e=0,i=(n=r(n,t)).length;null!=t&&e<i;)t=t[o(n[e++])];return e&&e==i?t:void 0}},563:function(t){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},6776:function(t){t.exports=function(t,n){return null!=t&&n in Object(t)}},6123:function(t){t.exports=function(t,n,e){for(var r=e-1,o=t.length;++r<o;)if(t[r]===n)return r;return-1}},9070:function(t,n,e){var r=e(7028),o=e(3474);t.exports=function t(n,e,i,s,u){return n===e||(null==n||null==e||!o(n)&&!o(e)?n!=n&&e!=e:r(n,e,i,s,t,u))}},7028:function(t,n,e){var r=e(8708),o=e(8705),i=e(2813),s=e(6682),u=e(9667),c=e(163),a=e(4801),f=e(4289),l="[object Arguments]",p="[object Array]",v="[object Object]",h=Object.prototype.hasOwnProperty;t.exports=function(t,n,e,d,y,b){var g=c(t),x=c(n),m=g?p:u(t),j=x?p:u(n),O=(m=m==l?v:m)==v,E=(j=j==l?v:j)==v,A=m==j;if(A&&a(t)){if(!a(n))return!1;g=!0,O=!1}if(A&&!O)return b||(b=new r),g||f(t)?o(t,n,e,d,y,b):i(t,n,m,e,d,y,b);if(!(1&e)){var _=O&&h.call(t,"__wrapped__"),w=E&&h.call(n,"__wrapped__");if(_||w){var S=_?t.value():t,k=w?n.value():n;return b||(b=new r),y(S,k,e,d,b)}}return!!A&&(b||(b=new r),s(t,n,e,d,y,b))}},9548:function(t,n,e){var r=e(8708),o=e(9070);t.exports=function(t,n,e,i){var s=e.length,u=s,c=!i;if(null==t)return!u;for(t=Object(t);s--;){var a=e[s];if(c&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++s<u;){var f=(a=e[s])[0],l=t[f],p=a[1];if(c&&a[2]){if(void 0===l&&!(f in t))return!1}else{var v=new r;if(i)var h=i(l,p,f,t,n,v);if(!(void 0===h?o(p,l,3,i,v):h))return!1}}return!0}},3472:function(t,n,e){var r=e(758),o=e(5223),i=e(5346),s=e(163),u=e(8532);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?s(t)?o(t[0],t[1]):r(t):u(t)}},7190:function(t,n,e){var r=e(5125)(Object.keys,Object);t.exports=r},758:function(t,n,e){var r=e(9548),o=e(597),i=e(6878);t.exports=function(t){var n=o(t);return 1==n.length&&n[0][2]?i(n[0][0],n[0][1]):function(e){return e===t||r(e,t,n)}}},5223:function(t,n,e){var r=e(9070),o=e(9201),i=e(5066),s=e(726),u=e(5385),c=e(6878),a=e(3110);t.exports=function(t,n){return s(t)&&u(n)?c(a(t),n):function(e){var s=o(e,t);return void 0===s&&s===n?i(e,t):r(n,s,3)}}},5436:function(t,n,e){var r=e(6371),o=e(5066);t.exports=function(t,n){return r(t,n,(function(n,e){return o(t,e)}))}},6371:function(t,n,e){var r=e(4432),o=e(6539),i=e(9026);t.exports=function(t,n,e){for(var s=-1,u=n.length,c={};++s<u;){var a=n[s],f=r(t,a);e(f,a)&&o(c,i(a,t),f)}return c}},1600:function(t){t.exports=function(t){return function(n){return null==n?void 0:n[t]}}},3301:function(t,n,e){var r=e(4432);t.exports=function(t){return function(n){return r(n,t)}}},6317:function(t,n,e){var r=e(5346),o=e(4280),i=e(201);t.exports=function(t,n){return i(o(t,n,r),t+"")}},6539:function(t,n,e){var r=e(4132),o=e(9026),i=e(9099),s=e(7709),u=e(3110);t.exports=function(t,n,e,c){if(!s(t))return t;for(var a=-1,f=(n=o(n,t)).length,l=f-1,p=t;null!=p&&++a<f;){var v=u(n[a]),h=e;if("__proto__"===v||"constructor"===v||"prototype"===v)return t;if(a!=l){var d=p[v];void 0===(h=c?c(d,v,p):void 0)&&(h=s(d)?d:i(n[a+1])?[]:{})}r(p,v,h),p=p[v]}return t}},6316:function(t,n,e){var r=e(2596),o=e(8644),i=e(163),s=e(1995),u=r?r.prototype:void 0,c=u?u.toString:void 0;t.exports=function t(n){if("string"==typeof n)return n;if(i(n))return o(n,t)+"";if(s(n))return c?c.call(n):"";var e=n+"";return"0"==e&&1/n==-1/0?"-0":e}},946:function(t,n,e){var r=e(3273),o=e(5510),i=e(9955),s=e(9914),u=e(6602),c=e(6226);t.exports=function(t,n,e){var a=-1,f=o,l=t.length,p=!0,v=[],h=v;if(e)p=!1,f=i;else if(l>=200){var d=n?null:u(t);if(d)return c(d);p=!1,f=s,h=new r}else h=n?[]:v;t:for(;++a<l;){var y=t[a],b=n?n(y):y;if(y=e||0!==y?y:0,p&&b==b){for(var g=h.length;g--;)if(h[g]===b)continue t;n&&h.push(b),v.push(y)}else f(h,b,e)||(h!==v&&h.push(b),v.push(y))}return v}},9914:function(t,n,e){var r=e(6123);t.exports=function(t,n){return!(null==t||!t.length)&&r(t,n,0)>-1}},9026:function(t,n,e){var r=e(163),o=e(726),i=e(7801),s=e(7010);t.exports=function(t,n){return r(t)?t:o(t,n)?[t]:i(s(t))}},6602:function(t){t.exports=function(){}},5525:function(t,n,e){var r=e(3743),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},8705:function(t,n,e){var r=e(3273),o=e(1634),i=e(9914);t.exports=function(t,n,e,s,u,c){var a=1&e,f=t.length,l=n.length;if(f!=l&&!(a&&l>f))return!1;var p=c.get(t),v=c.get(n);if(p&&v)return p==n&&v==t;var h=-1,d=!0,y=2&e?new r:void 0;for(c.set(t,n),c.set(n,t);++h<f;){var b=t[h],g=n[h];if(s)var x=a?s(g,b,h,n,t,c):s(b,g,h,t,n,c);if(void 0!==x){if(x)continue;d=!1;break}if(y){if(!o(n,(function(t,n){if(!i(y,n)&&(b===t||u(b,t,e,s,c)))return y.push(n)}))){d=!1;break}}else if(b!==g&&!u(b,g,e,s,c)){d=!1;break}}return c.delete(t),c.delete(n),d}},2813:function(t){t.exports=function(t,n){return t===n||t!=t&&n!=n}},6682:function(t,n,e){var r=e(8143),o=Object.prototype.hasOwnProperty;t.exports=function(t,n,e,i,s,u){var c=1&e,a=r(t),f=a.length;if(f!=r(n).length&&!c)return!1;for(var l=f;l--;){var p=a[l];if(!(c?p in n:o.call(n,p)))return!1}var v=u.get(t),h=u.get(n);if(v&&h)return v==n&&h==t;var d=!0;u.set(t,n),u.set(n,t);for(var y=c;++l<f;){var b=t[p=a[l]],g=n[p];if(i)var x=c?i(g,b,p,n,t,u):i(b,g,p,t,n,u);if(!(void 0===x?b===g||s(b,g,e,i,u):x)){d=!1;break}y||(y="constructor"==p)}if(d&&!y){var m=t.constructor,j=n.constructor;m==j||!("constructor"in t)||!("constructor"in n)||"function"==typeof m&&m instanceof m&&"function"==typeof j&&j instanceof j||(d=!1)}return u.delete(t),u.delete(n),d}},5557:function(t,n,e){var r=e(2645),o=e(4280),i=e(201);t.exports=function(t){return i(o(t,void 0,r),t+"")}},2117:function(t,n,e){var r="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=r},8143:function(t,n,e){var r=e(5125)(Object.keys,Object);t.exports=r},7271:function(t){t.exports=function(t){var n=[];if(null!=t)for(var e in Object(t))n.push(e);return n}},597:function(t,n,e){var r=e(5385),o=e(7747);t.exports=function(t){for(var n=o(t),e=n.length;e--;){var i=n[e],s=t[i];n[e]=[i,s,r(s)]}return n}},3743:function(t){t.exports=function(t,n){return null==t?void 0:t[n]}},9667:function(t){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},3096:function(t,n,e){var r=e(9026),o=e(5075),i=e(163),s=e(9099),u=e(8454),c=e(3110);t.exports=function(t,n,e){for(var a=-1,f=(n=r(n,t)).length,l=!1;++a<f;){var p=c(n[a]);if(!(l=null!=t&&e(t,p)))break;t=t[p]}return l||++a!=f?l:!!(f=null==t?0:t.length)&&u(f)&&s(p,f)&&(i(t)||o(t))}},3608:function(t,n,e){var r=e(2596),o=e(5075),i=e(163),s=r?r.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},9099:function(t){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t<e}},8286:function(t){t.exports=function(){return!1}},726:function(t,n,e){var r=e(163),o=e(1995),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;t.exports=function(t,n){if(r(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!o(t))||s.test(t)||!i.test(t)||null!=n&&t in Object(n)}},5782:function(t){t.exports=function(){return!1}},5385:function(t,n,e){var r=e(7709);t.exports=function(t){return t==t&&!r(t)}},1171:function(t){t.exports=function(){this.__data__=[],this.size=0}},7838:function(t,n,e){var r=e(3162),o=Array.prototype.splice;t.exports=function(t){var n=this.__data__,e=r(n,t);return!(e<0||(e==n.length-1?n.pop():o.call(n,e,1),--this.size,0))}},4859:function(t,n,e){var r=e(3162);t.exports=function(t){var n=this.__data__,e=r(n,t);return e<0?void 0:n[e][1]}},4073:function(t,n,e){var r=e(3162);t.exports=function(t){return r(this.__data__,t)>-1}},8541:function(t,n,e){var r=e(3162);t.exports=function(t,n){var e=this.__data__,o=r(e,t);return o<0?(++this.size,e.push([t,n])):e[o][1]=n,this}},6878:function(t){t.exports=function(t,n){return function(e){return null!=e&&e[t]===n&&(void 0!==n||t in Object(e))}}},2453:function(t){t.exports=function(t){return t}},5125:function(t){t.exports=function(t,n){return function(e){return t(n(e))}}},4280:function(t,n,e){var r=e(6082),o=Math.max;t.exports=function(t,n,e){return n=o(void 0===n?t.length-1:n,0),function(){for(var i=arguments,s=-1,u=o(i.length-n,0),c=Array(u);++s<u;)c[s]=i[n+s];s=-1;for(var a=Array(n+1);++s<n;)a[s]=i[s];return a[n]=e(c),r(t,this,a)}}},2373:function(t,n,e){var r=e(2117),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},6226:function(t){t.exports=function(){return[]}},201:function(t){t.exports=function(t){return t}},7801:function(t,n,e){var r=e(2453),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,s=r((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(o,(function(t,e,r,o){n.push(r?o.replace(i,"$1"):e||t)})),n}));t.exports=s},3110:function(t,n,e){var r=e(1995);t.exports=function(t){if("string"==typeof t||r(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},1893:function(t,n,e){var r=e(6317),o=e(788),i=e(8286),s=e(8855),u=Object.prototype,c=u.hasOwnProperty,a=r((function(t,n){t=Object(t);var e=-1,r=n.length,a=r>2?n[2]:void 0;for(a&&i(n[0],n[1],a)&&(r=1);++e<r;)for(var f=n[e],l=s(f),p=-1,v=l.length;++p<v;){var h=l[p],d=t[h];(void 0===d||o(d,u[h])&&!c.call(t,h))&&(t[h]=f[h])}return t}));t.exports=a},788:function(t){t.exports=function(t,n){return t===n||t!=t&&n!=n}},2645:function(t,n,e){var r=e(6457);t.exports=function(t){return null!=t&&t.length?r(t,1):[]}},7314:function(t){t.exports=function(t){for(var n=-1,e=null==t?0:t.length,r={};++n<e;){var o=t[n];r[o[0]]=o[1]}return r}},9201:function(t,n,e){var r=e(4432);t.exports=function(t,n,e){var o=null==t?void 0:r(t,n);return void 0===o?e:o}},5066:function(t,n,e){var r=e(6776),o=e(3096);t.exports=function(t,n){return null!=t&&o(t,n,r)}},5346:function(t){t.exports=function(t){return t}},5075:function(t){t.exports=function(){return!1}},163:function(t){var n=Array.isArray;t.exports=n},981:function(t,n,e){var r=e(9642),o=e(8454);t.exports=function(t){return null!=t&&o(t.length)&&!r(t)}},4801:function(t){t.exports=function(){return!1}},4155:function(t,n,e){var r=e(7190),o=e(9667),i=e(5075),s=e(163),u=e(981),c=e(4801),a=e(5782),f=e(4289),l=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(u(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||c(t)||f(t)||i(t)))return!t.length;var n=o(t);if("[object Map]"==n||"[object Set]"==n)return!t.size;if(a(t))return!r(t).length;for(var e in t)if(l.call(t,e))return!1;return!0}},9642:function(t,n,e){var r=e(563),o=e(7709);t.exports=function(t){if(!o(t))return!1;var n=r(t);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}},8454:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},7709:function(t){t.exports=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},3474:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},1995:function(t){t.exports=function(){return!1}},4289:function(t){t.exports=function(){return!1}},7747:function(t,n,e){var r=e(5125)(Object.keys,Object);t.exports=r},8855:function(t){t.exports=function(t){var n=[];if(null!=t)for(var e in Object(t))n.push(e);return n}},6051:function(t){t.exports=function(t){if("function"!=typeof t)throw new TypeError("Expected a function");return function(){var n=arguments;switch(n.length){case 0:return!t.call(this);case 1:return!t.call(this,n[0]);case 2:return!t.call(this,n[0],n[1]);case 3:return!t.call(this,n[0],n[1],n[2])}return!t.apply(this,n)}}},1616:function(t,n,e){var r=e(3472),o=e(6051),i=e(4912);t.exports=function(t,n){return i(t,o(r(n)))}},9082:function(t,n,e){var r=e(5436),o=e(5557)((function(t,n){return null==t?{}:r(t,n)}));t.exports=o},4912:function(t,n,e){var r=e(8644),o=e(3472),i=e(6371),s=e(7271);t.exports=function(t,n){if(null==t)return{};var e=r(s(t),(function(t){return[t]}));return n=o(n),i(t,e,(function(t,e){return n(t,e[0])}))}},8532:function(t,n,e){var r=e(1600),o=e(3301),i=e(726),s=e(3110);t.exports=function(t){return i(t)?r(s(t)):o(t)}},7010:function(t,n,e){var r=e(6316);t.exports=function(t){return null==t?"":r(t)}},9602:function(t,n,e){var r=e(946);t.exports=function(t){return t&&t.length?r(t):[]}},7491:function(t){var n="undefined"!=typeof Element,e="function"==typeof Map,r="function"==typeof Set,o="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function i(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var u,c,a,f;if(Array.isArray(t)){if((u=t.length)!=s.length)return!1;for(c=u;0!=c--;)if(!i(t[c],s[c]))return!1;return!0}if(e&&t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(f=t.entries();!(c=f.next()).done;)if(!s.has(c.value[0]))return!1;for(f=t.entries();!(c=f.next()).done;)if(!i(c.value[1],s.get(c.value[0])))return!1;return!0}if(r&&t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(f=t.entries();!(c=f.next()).done;)if(!s.has(c.value[0]))return!1;return!0}if(o&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(s)){if((u=t.length)!=s.length)return!1;for(c=u;0!=c--;)if(t[c]!==s[c])return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((u=(a=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(c=u;0!=c--;)if(!Object.prototype.hasOwnProperty.call(s,a[c]))return!1;if(n&&t instanceof Element)return!1;for(c=u;0!=c--;)if(("_owner"!==a[c]&&"__v"!==a[c]&&"__o"!==a[c]||!t.$$typeof)&&!i(t[a[c]],s[a[c]]))return!1;return!0}return t!=t&&s!=s}t.exports=function(t,n){try{return i(t,n)}catch(t){if((t.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw t}}},9787:function(n){"use strict";n.exports=t}},e={};function r(t){var o=e[t];if(void 0!==o)return o.exports;var i=e[t]={exports:{}};return n[t](i,i.exports,r),i.exports}r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,{a:n}),n},r.d=function(t,n){for(var e in n)r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return function(){"use strict";r.r(o),r.d(o,{VictorySharedEvents:function(){return Q}});var t,n,e=r(7314),i=r.n(e),s=r(4155),u=r.n(s),c=r(1893),a=r.n(c),f=r(9787),l=r.n(f),p=0,v=0,h=0,d=0,y=0,b=0,g="object"==typeof performance&&performance.now?performance:Date,x="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function m(){return y||(x(j),y=g.now()+b)}function j(){y=0}function O(){this._call=this._time=this._next=null}function E(t,n,e){var r=new O;return r.restart(t,n,e),r}function A(){y=(d=g.now())+b,p=v=0;try{!function(){m(),++p;for(var n,e=t;e;)(n=y-e._time)>=0&&e._call.call(void 0,n),e=e._next;--p}()}finally{p=0,function(){for(var e,r,o=t,i=1/0;o;)o._call?(i>o._time&&(i=o._time),e=o,o=o._next):(r=o._next,o._next=null,o=e?e._next=r:t=r);n=e,w(i)}(),y=0}}function _(){var t=g.now(),n=t-d;n>1e3&&(b-=n,d=t)}function w(t){p||(v&&(v=clearTimeout(v)),t-y>24?(t<1/0&&(v=setTimeout(A,t-g.now()-b)),h&&(h=clearInterval(h))):(h||(d=g.now(),h=setInterval(_,1e3)),p=1,x(A)))}O.prototype=E.prototype={constructor:O,restart:function(e,r,o){if("function"!=typeof e)throw new TypeError("callback is not a function");o=(null==o?m():+o)+(null==r?0:+r),this._next||n===this||(n?n._next=this:t=this,n=this),this._call=e,this._time=o,w()},stop:function(){this._call&&(this._call=null,this._time=1/0,w())}};class S{constructor(){this.shouldAnimate=!0,this.subscribers=[],this.timer=null,this.activeSubscriptions=0}bypassAnimation(){this.shouldAnimate=!1}resumeAnimation(){this.shouldAnimate=!0}loop=()=>{this.subscribers.forEach((t=>{t.callback(m()-t.startTime,t.duration)}))};start(){this.timer||(this.timer=E(this.loop))}stop(){this.timer&&(this.timer.stop(),this.timer=null)}subscribe(t,n){const e=this.subscribers.push({startTime:m(),callback:t,duration:this.shouldAnimate?n:0});return this.activeSubscriptions++,this.start(),e}unsubscribe(t){null!==t&&this.subscribers[t-1]&&(delete this.subscribers[t-1],this.activeSubscriptions--),0===this.activeSubscriptions&&this.stop()}}const k=l().createContext({transitionTimer:new S,animationTimer:new S});k.displayName="TimerContext";var C=k,P=r(9602),G=r.n(P),N=r(1616),$=r.n(N),K=r(4912),M=r.n(K),T=r(9082),B=r.n(T);function z(t){return"function"==typeof t}r(8532);const F=/^onGlobal(.*)$/;function L(t,n,e,r){const o=t=>{const r=(()=>{const r=t.reduce(((t,e)=>void 0!==e.target?(Array.isArray(e.target)?e.target.includes(n):`${e.target}`==`${n}`)?t.concat(e):t:t.concat(e)),[]);return void 0!==e&&"parent"!==n?r.filter((t=>{const n=t.eventKey,r=t=>!t||`${t}`==`${e}`;return Array.isArray(n)?n.some((t=>r(t))):r(n)})):r})();return Array.isArray(r)&&r.reduce(((t,n)=>n?Object.assign(t,n.eventHandlers):t),{})},i=(()=>Array.isArray(this.componentEvents)?Array.isArray(t.events)?this.componentEvents.concat(...t.events):this.componentEvents:t.events)(),s=i&&z(r)?r(o(i),n):void 0;if(!t.sharedEvents)return s;const u=t.sharedEvents.getEvents,c=t.sharedEvents.events&&u(o(t.sharedEvents.events),n);return Object.assign({},c,s)}function V(t,n,e,r){if(u()(t))return{};const o=r||this.baseProps,i=(t,n)=>{const{childName:e,target:r,key:i}=t,s="props"===n?o:this.state||{},u=null!=e&&s[e]?s[e]:s;return"parent"===i?u.parent:u[i]&&u[i][r]},s=(t,r)=>{const s="parent"===n?t.childName:t.childName||e,u=t.target||n,c=(n,e)=>{const r=this.state||{};if(!z(t.mutation))return r;const s=i({childName:e,key:n,target:u},"props"),c=i({childName:e,key:n,target:u},"state"),a=t.mutation(Object.assign({},s,c),o),f=r[e]||{},l=t=>a?(t=>"parent"===u?Object.assign(t,{[n]:Object.assign(t[n]||{},a)}):Object.assign(t,{[n]:Object.assign(t[n]||{},{[u]:a})}))(t):(t=>(t[n]&&t[n][u]&&delete t[n][u],t[n]&&!Object.keys(t[n]).length&&delete t[n],t))(t);return null!=e?Object.assign(r,{[e]:l(f)}):l(r)},a=n=>{const e=(n=>"parent"===u?"parent":"all"===t.eventKey?o[n]?Object.keys(o[n]).filter((t=>"parent"!==t)):Object.keys(o).filter((t=>"parent"!==t)):void 0===t.eventKey&&"parent"===r?o[n]?Object.keys(o[n]):Object.keys(o):void 0!==t.eventKey?t.eventKey:r)(n);return Array.isArray(e)?e.reduce(((t,e)=>Object.assign(t,c(e,n))),{}):c(e,n)},f="all"===s?Object.keys(o).filter((t=>"parent"!==t)):s;return Array.isArray(f)?f.reduce(((t,n)=>Object.assign(t,a(n))),{}):a(f)},c=(n,e,r,o)=>{const i=t[o](n,e,r,this);if(!u()(i)){const t=(t=>{const n=t=>z(t.callback)&&t.callback,e=(Array.isArray(t)?t.map((t=>n(t))):[n(t)]).filter((t=>!1!==t));return e.length?()=>e.forEach((t=>t())):void 0})(i);this.setState(((t,n)=>Array.isArray(t)?t.reduce(((t,e)=>Object.assign({},t,s(e,n))),{}):s(t,n))(i,r),t)}};return Object.keys(t).reduce(((t,n)=>(t[n]=c,t)),{})}function D(t,n,e){const r=this.state||{};return e?r[e]&&r[e][t]&&r[e][t][n]:"parent"===t?r[t]&&r[t][n]||r[t]:r[t]&&r[t][n]}function q(t,n,e,r){const o=(t,n)=>"string"==typeof t[n]?"all"===t[n]||t[n]===r[n]:!!Array.isArray(t[n])&&t[n].map((t=>`${t}`)).includes(r[n]);let i=Array.isArray(t)?t:[t];r.childName&&(i=t.filter((t=>o(t,"childName"))));const s=i.filter((t=>o(t,"target")));if(u()(s))return;const c=s.filter((t=>o(t,"eventKey")));return u()(c)?void 0:c.reduce(((t,r)=>{const o=(r&&z(r.mutation)?r.mutation:()=>{})(Object.assign({},n,e));return Object.assign({},t,o)}),{})}function U(t){const n=t.match(F);return n&&n[1]&&n[1].toLowerCase()}function I(t,n){return t&&n?t.filter((t=>!n.includes(t))):[]}var R=r(7491),H=r.n(R),J=r(2516),W=r.n(J);class Q extends l().Component{static displayName="VictorySharedEvents";static role="shared-event-wrapper";static contextType=C;static defaultProps={groupComponent:l().createElement("g",null)};constructor(t){super(t),this.getScopedEvents=V.bind(this),this.getEventState=D.bind(this),this.state=this.state||{},this.sharedEventsCache={},this.globalEvents={},this.prevGlobalEventKeys=[],this.boundGlobalEvents={},this.baseProps=this.getBaseProps(t)}shouldComponentUpdate(t){if(!H()(this.props,t)){this.baseProps=this.getBaseProps(t);const n=this.getExternalMutations(t,this.baseProps);this.applyExternalMutations(t,n)}return!0}componentDidMount(){const t=Object.keys(this.globalEvents);t.forEach((t=>this.addGlobalListener(t))),this.prevGlobalEventKeys=t}componentDidUpdate(){const t=Object.keys(this.globalEvents);I(this.prevGlobalEventKeys,t).forEach((t=>this.removeGlobalListener(t))),I(t,this.prevGlobalEventKeys).forEach((t=>this.addGlobalListener(t))),this.prevGlobalEventKeys=t}componentWillUnmount(){this.prevGlobalEventKeys.forEach((t=>this.removeGlobalListener(t)))}addGlobalListener(t){const n=n=>{const e=this.globalEvents[t];return e&&e((t=>Object.assign(t,{nativeEvent:t}))(n))};this.boundGlobalEvents[t]=n,window.addEventListener(U(t),n)}removeGlobalListener(t){window.removeEventListener(U(t),this.boundGlobalEvents[t])}getAllEvents(t){const n=function(t,n){const e=Array.isArray(n)&&n.reduce(((n,e)=>{const r=t[e],o=r&&r.type&&r.type.defaultEvents,i=z(o)?o(r.props):o;return Array.isArray(i)?n.concat(...i):n}),[]);return e&&e.length?e:void 0}(t,["container","groupComponent"]);return Array.isArray(n)?Array.isArray(t.events)?n.concat(...t.events):n:t.events}applyExternalMutations(t,n){if(!u()(n)){const e=t.externalEventMutations.reduce(((t,n)=>z(n.callback)?t.concat(n.callback):t),[]),r=e.length?()=>{e.forEach((t=>t()))}:void 0;this.setState(n,r)}}getExternalMutations(t,n){return u()(t.externalEventMutations)?void 0:function(t,n,e,r){return void 0===n&&(n={}),void 0===e&&(e={}),r.reduce(((r,o)=>{const i=e[o],s=function(t,n,e,r){return void 0===n&&(n={}),void 0===e&&(e={}),Object.keys(n).reduce(((o,i)=>{const s=e[i]||{},c=n[i]||{};if("parent"===i){const n=q(t,c,s,{eventKey:i,target:"parent"});o[i]=void 0!==n?Object.assign({},s,n):s}else{const n=G()(Object.keys(c).concat(Object.keys(s)));o[i]=n.reduce(((n,e)=>{const o={eventKey:i,target:e,childName:r},a=q(t,c[e],s[e],o);return n[e]=void 0!==a?Object.assign({},s[e],a):s[e],M()(n,(t=>!u()(t)))}),{})}return M()(o,(t=>!u()(t)))}),{})}(t,n[o],e[o],o);return r[o]=s||i,M()(r,(t=>!u()(t)))}),{})}(t.externalEventMutations,n,this.state,Object.keys(n))}cacheSharedEvents(t,n,e){this.sharedEventsCache[t]=[n,e]}getCachedSharedEvents(t,n){const[e,r]=this.sharedEventsCache[t]||[];if(e&&H()(n,r))return e}getBaseProps(t){const{container:n}=t,e=l().Children.toArray(this.props.children),r=this.getBasePropsFromChildren(e),o=n?n.props:{};return Object.assign({},r,{parent:o})}getBasePropsFromChildren(t){const n=function(t,n,e,r,o){void 0===e&&(e={}),void 0===r&&(r=[]),void 0===o&&(o=(t,n)=>t.concat(n));const i=["data","domain","categories","polar","startAngle","endAngle","minDomain","maxDomain","horizontal"],s=(t,n,u)=>t.reduce(((t,r,u)=>{let c=t;const a=r.type&&r.type.role,f=r.props.name||`${a}-${n[u]}`;if(r.props&&r.props.children){const t=Object.assign({},r.props,B()(e,i)),n=r.type&&"stack"===r.type.role&&z(r.type.getChildren)?r.type.getChildren(t):l().Children.toArray(r.props.children).map((n=>{const e=Object.assign({},n.props,B()(t,i));return l().cloneElement(n,e)})),u=n.map(((t,n)=>`${f}-${n}`)),a=s(n,u,r);c=o(c,a)}else{const t=((t,n)=>{if(t.type&&z(t.type.getBaseProps)){const e=t.props&&t.type.getBaseProps(t.props);return e?[[n,e]]:null}return null})(r,f);t&&(c=o(c,t))}return c}),r),u=t.filter(f.isValidElement),c=u.map(((t,n)=>n));return s(u,c)}(t);return i()(n)}getNewChildren(t,n){const{events:e,eventKey:r}=t,o=(t,i)=>t.reduce(((t,s,u)=>{if(s.props.children){const n=l().Children.toArray(s.props.children),e=i.slice(u,u+n.length),r=l().cloneElement(s,s.props,o(n,e));return t.concat(r)}if("parent"!==i[u]&&s.type&&z(s.type.getBaseProps)){const o=s.props.name||i[u],c=Array.isArray(e)&&e.filter((t=>"parent"!==t.target&&(Array.isArray(t.childName)?t.childName.indexOf(o)>-1:t.childName===o||"all"===t.childName))),a=[o,n,c,W()(this.state[o])],f=this.getCachedSharedEvents(o,a)||{events:c,getEvents:(t,e)=>this.getScopedEvents(t,e,o,n),getEventState:(t,n)=>this.getEventState(t,n,o)};return this.cacheSharedEvents(o,f,a),t.concat(l().cloneElement(s,Object.assign({key:`events-${o}`,sharedEvents:f,eventKey:r,name:o},s.props)))}return t.concat(s)}),[]),i=Object.keys(n),s=l().Children.toArray(t.children);return o(s,i)}getContainer(t,n,e){const r=this.getNewChildren(t,n),o=Array.isArray(e)?e.filter((t=>"parent"===t.target)):[],i=o.length>0?{events:o,getEvents:(t,e)=>this.getScopedEvents(t,e,null,n),getEventState:this.getEventState}:null,s=t.container||t.groupComponent,u=s.type&&s.type.role,c=s.props||{},f=L.bind(this),p=i&&f({sharedEvents:i},"parent"),v=a()({},this.getEventState("parent","parent"),c,n.parent,{children:r}),h=a()({},function(t,n,e){return t?Object.keys(t).reduce(((n,r)=>(n[r]=n=>t[r](n,e,"parent",r),n)),{}):{}}(p,0,v),c.events);this.globalEvents=(t=>M()(t,((t,n)=>F.test(n))))(h);const d=(t=>$()(t,((t,n)=>F.test(n))))(h);return"container"===u?l().cloneElement(s,Object.assign({},v,{events:d})):l().cloneElement(s,d,r)}render(){const t=this.getAllEvents(this.props);return t?this.getContainer(this.props,this.baseProps,t):l().cloneElement(this.props.container,{children:this.props.children})}}}(),o}()}));
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):"object"==typeof exports?exports.VictorySharedEvents=n(require("react")):t.VictorySharedEvents=n(t.React)}(self,(function(t){return function(){var n={2516:function(t,n){function e(t,n){var e=[],r=[];return null==n&&(n=function(t,n){return e[0]===n?"[Circular ~]":"[Circular ~."+r.slice(0,e.indexOf(n)).join(".")+"]"}),function(o,i){if(e.length>0){var s=e.indexOf(this);~s?e.splice(s+1):e.push(this),~s?r.splice(s,1/0,o):r.push(o),~e.indexOf(i)&&(i=n.call(this,o,i))}else e.push(i);return null==t?i:t.call(this,o,i)}}(t.exports=function(t,n,r,o){return JSON.stringify(t,e(n,o),r)}).getSerialize=e},3273:function(t,n,e){var r=e(163);t.exports=function(){if(!arguments.length)return[];var t=arguments[0];return r(t)?t:[t]}},8708:function(t,n,e){var r=e(1171),o=e(7838),i=e(4859),s=e(4073),u=e(8541);function c(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=s,c.prototype.set=u,t.exports=c},2596:function(t,n,e){var r=e(2373).Symbol;t.exports=r},6082:function(t){t.exports=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}},5510:function(t,n,e){var r=e(6123);t.exports=function(t,n){return!(null==t||!t.length)&&r(t,n,0)>-1}},9955:function(t){t.exports=function(t,n,e){for(var r=-1,o=null==t?0:t.length;++r<o;)if(e(n,t[r]))return!0;return!1}},8644:function(t){t.exports=function(t,n){for(var e=-1,r=null==t?0:t.length,o=Array(r);++e<r;)o[e]=n(t[e],e,t);return o}},9559:function(t){t.exports=function(t,n){for(var e=-1,r=n.length,o=t.length;++e<r;)t[o+e]=n[e];return t}},1634:function(t){t.exports=function(t,n){for(var e=-1,r=null==t?0:t.length;++e<r;)if(n(t[e],e,t))return!0;return!1}},4132:function(t,n,e){var r=e(8347),o=e(788),i=Object.prototype.hasOwnProperty;t.exports=function(t,n,e){var s=t[n];i.call(t,n)&&o(s,e)&&(void 0!==e||n in t)||r(t,n,e)}},3162:function(t,n,e){var r=e(788);t.exports=function(t,n){for(var e=t.length;e--;)if(r(t[e][0],n))return e;return-1}},8347:function(t,n,e){var r=e(5525);t.exports=function(t,n,e){"__proto__"==n&&r?r(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e}},6457:function(t,n,e){var r=e(9559),o=e(3608);t.exports=function t(n,e,i,s,u){var c=-1,a=n.length;for(i||(i=o),u||(u=[]);++c<a;){var f=n[c];e>0&&i(f)?e>1?t(f,e-1,i,s,u):r(u,f):s||(u[u.length]=f)}return u}},4432:function(t,n,e){var r=e(9026),o=e(3110);t.exports=function(t,n){for(var e=0,i=(n=r(n,t)).length;null!=t&&e<i;)t=t[o(n[e++])];return e&&e==i?t:void 0}},563:function(t){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},6776:function(t){t.exports=function(t,n){return null!=t&&n in Object(t)}},6123:function(t){t.exports=function(t,n,e){for(var r=e-1,o=t.length;++r<o;)if(t[r]===n)return r;return-1}},9070:function(t,n,e){var r=e(7028),o=e(3474);t.exports=function t(n,e,i,s,u){return n===e||(null==n||null==e||!o(n)&&!o(e)?n!=n&&e!=e:r(n,e,i,s,t,u))}},7028:function(t,n,e){var r=e(8708),o=e(8705),i=e(2813),s=e(6682),u=e(9667),c=e(163),a=e(4801),f=e(4289),l="[object Arguments]",p="[object Array]",v="[object Object]",h=Object.prototype.hasOwnProperty;t.exports=function(t,n,e,d,y,b){var g=c(t),x=c(n),m=g?p:u(t),j=x?p:u(n),O=(m=m==l?v:m)==v,E=(j=j==l?v:j)==v,A=m==j;if(A&&a(t)){if(!a(n))return!1;g=!0,O=!1}if(A&&!O)return b||(b=new r),g||f(t)?o(t,n,e,d,y,b):i(t,n,m,e,d,y,b);if(!(1&e)){var _=O&&h.call(t,"__wrapped__"),w=E&&h.call(n,"__wrapped__");if(_||w){var S=_?t.value():t,k=w?n.value():n;return b||(b=new r),y(S,k,e,d,b)}}return!!A&&(b||(b=new r),s(t,n,e,d,y,b))}},9548:function(t,n,e){var r=e(8708),o=e(9070);t.exports=function(t,n,e,i){var s=e.length,u=s,c=!i;if(null==t)return!u;for(t=Object(t);s--;){var a=e[s];if(c&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++s<u;){var f=(a=e[s])[0],l=t[f],p=a[1];if(c&&a[2]){if(void 0===l&&!(f in t))return!1}else{var v=new r;if(i)var h=i(l,p,f,t,n,v);if(!(void 0===h?o(p,l,3,i,v):h))return!1}}return!0}},3472:function(t,n,e){var r=e(758),o=e(5223),i=e(5346),s=e(163),u=e(8532);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?s(t)?o(t[0],t[1]):r(t):u(t)}},7190:function(t,n,e){var r=e(5125)(Object.keys,Object);t.exports=r},758:function(t,n,e){var r=e(9548),o=e(597),i=e(6878);t.exports=function(t){var n=o(t);return 1==n.length&&n[0][2]?i(n[0][0],n[0][1]):function(e){return e===t||r(e,t,n)}}},5223:function(t,n,e){var r=e(9070),o=e(9201),i=e(5066),s=e(726),u=e(5385),c=e(6878),a=e(3110);t.exports=function(t,n){return s(t)&&u(n)?c(a(t),n):function(e){var s=o(e,t);return void 0===s&&s===n?i(e,t):r(n,s,3)}}},5436:function(t,n,e){var r=e(6371),o=e(5066);t.exports=function(t,n){return r(t,n,(function(n,e){return o(t,e)}))}},6371:function(t,n,e){var r=e(4432),o=e(6539),i=e(9026);t.exports=function(t,n,e){for(var s=-1,u=n.length,c={};++s<u;){var a=n[s],f=r(t,a);e(f,a)&&o(c,i(a,t),f)}return c}},1600:function(t){t.exports=function(t){return function(n){return null==n?void 0:n[t]}}},3301:function(t,n,e){var r=e(4432);t.exports=function(t){return function(n){return r(n,t)}}},6317:function(t,n,e){var r=e(5346),o=e(4280),i=e(201);t.exports=function(t,n){return i(o(t,n,r),t+"")}},6539:function(t,n,e){var r=e(4132),o=e(9026),i=e(9099),s=e(7709),u=e(3110);t.exports=function(t,n,e,c){if(!s(t))return t;for(var a=-1,f=(n=o(n,t)).length,l=f-1,p=t;null!=p&&++a<f;){var v=u(n[a]),h=e;if("__proto__"===v||"constructor"===v||"prototype"===v)return t;if(a!=l){var d=p[v];void 0===(h=c?c(d,v,p):void 0)&&(h=s(d)?d:i(n[a+1])?[]:{})}r(p,v,h),p=p[v]}return t}},6316:function(t,n,e){var r=e(2596),o=e(8644),i=e(163),s=e(1995),u=r?r.prototype:void 0,c=u?u.toString:void 0;t.exports=function t(n){if("string"==typeof n)return n;if(i(n))return o(n,t)+"";if(s(n))return c?c.call(n):"";var e=n+"";return"0"==e&&1/n==-1/0?"-0":e}},946:function(t,n,e){var r=e(3273),o=e(5510),i=e(9955),s=e(9914),u=e(6602),c=e(6226);t.exports=function(t,n,e){var a=-1,f=o,l=t.length,p=!0,v=[],h=v;if(e)p=!1,f=i;else if(l>=200){var d=n?null:u(t);if(d)return c(d);p=!1,f=s,h=new r}else h=n?[]:v;t:for(;++a<l;){var y=t[a],b=n?n(y):y;if(y=e||0!==y?y:0,p&&b==b){for(var g=h.length;g--;)if(h[g]===b)continue t;n&&h.push(b),v.push(y)}else f(h,b,e)||(h!==v&&h.push(b),v.push(y))}return v}},9914:function(t,n,e){var r=e(6123);t.exports=function(t,n){return!(null==t||!t.length)&&r(t,n,0)>-1}},9026:function(t,n,e){var r=e(163),o=e(726),i=e(7801),s=e(7010);t.exports=function(t,n){return r(t)?t:o(t,n)?[t]:i(s(t))}},6602:function(t){t.exports=function(){}},5525:function(t,n,e){var r=e(3743),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},8705:function(t,n,e){var r=e(3273),o=e(1634),i=e(9914);t.exports=function(t,n,e,s,u,c){var a=1&e,f=t.length,l=n.length;if(f!=l&&!(a&&l>f))return!1;var p=c.get(t),v=c.get(n);if(p&&v)return p==n&&v==t;var h=-1,d=!0,y=2&e?new r:void 0;for(c.set(t,n),c.set(n,t);++h<f;){var b=t[h],g=n[h];if(s)var x=a?s(g,b,h,n,t,c):s(b,g,h,t,n,c);if(void 0!==x){if(x)continue;d=!1;break}if(y){if(!o(n,(function(t,n){if(!i(y,n)&&(b===t||u(b,t,e,s,c)))return y.push(n)}))){d=!1;break}}else if(b!==g&&!u(b,g,e,s,c)){d=!1;break}}return c.delete(t),c.delete(n),d}},2813:function(t){t.exports=function(t,n){return t===n||t!=t&&n!=n}},6682:function(t,n,e){var r=e(8143),o=Object.prototype.hasOwnProperty;t.exports=function(t,n,e,i,s,u){var c=1&e,a=r(t),f=a.length;if(f!=r(n).length&&!c)return!1;for(var l=f;l--;){var p=a[l];if(!(c?p in n:o.call(n,p)))return!1}var v=u.get(t),h=u.get(n);if(v&&h)return v==n&&h==t;var d=!0;u.set(t,n),u.set(n,t);for(var y=c;++l<f;){var b=t[p=a[l]],g=n[p];if(i)var x=c?i(g,b,p,n,t,u):i(b,g,p,t,n,u);if(!(void 0===x?b===g||s(b,g,e,i,u):x)){d=!1;break}y||(y="constructor"==p)}if(d&&!y){var m=t.constructor,j=n.constructor;m==j||!("constructor"in t)||!("constructor"in n)||"function"==typeof m&&m instanceof m&&"function"==typeof j&&j instanceof j||(d=!1)}return u.delete(t),u.delete(n),d}},5557:function(t,n,e){var r=e(2645),o=e(4280),i=e(201);t.exports=function(t){return i(o(t,void 0,r),t+"")}},2117:function(t,n,e){var r="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=r},8143:function(t,n,e){var r=e(5125)(Object.keys,Object);t.exports=r},7271:function(t){t.exports=function(t){var n=[];if(null!=t)for(var e in Object(t))n.push(e);return n}},597:function(t,n,e){var r=e(5385),o=e(7747);t.exports=function(t){for(var n=o(t),e=n.length;e--;){var i=n[e],s=t[i];n[e]=[i,s,r(s)]}return n}},3743:function(t){t.exports=function(t,n){return null==t?void 0:t[n]}},9667:function(t){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},3096:function(t,n,e){var r=e(9026),o=e(5075),i=e(163),s=e(9099),u=e(8454),c=e(3110);t.exports=function(t,n,e){for(var a=-1,f=(n=r(n,t)).length,l=!1;++a<f;){var p=c(n[a]);if(!(l=null!=t&&e(t,p)))break;t=t[p]}return l||++a!=f?l:!!(f=null==t?0:t.length)&&u(f)&&s(p,f)&&(i(t)||o(t))}},3608:function(t,n,e){var r=e(2596),o=e(5075),i=e(163),s=r?r.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},9099:function(t){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t<e}},8286:function(t){t.exports=function(){return!1}},726:function(t,n,e){var r=e(163),o=e(1995),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;t.exports=function(t,n){if(r(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!o(t))||s.test(t)||!i.test(t)||null!=n&&t in Object(n)}},5782:function(t){t.exports=function(){return!1}},5385:function(t,n,e){var r=e(7709);t.exports=function(t){return t==t&&!r(t)}},1171:function(t){t.exports=function(){this.__data__=[],this.size=0}},7838:function(t,n,e){var r=e(3162),o=Array.prototype.splice;t.exports=function(t){var n=this.__data__,e=r(n,t);return!(e<0||(e==n.length-1?n.pop():o.call(n,e,1),--this.size,0))}},4859:function(t,n,e){var r=e(3162);t.exports=function(t){var n=this.__data__,e=r(n,t);return e<0?void 0:n[e][1]}},4073:function(t,n,e){var r=e(3162);t.exports=function(t){return r(this.__data__,t)>-1}},8541:function(t,n,e){var r=e(3162);t.exports=function(t,n){var e=this.__data__,o=r(e,t);return o<0?(++this.size,e.push([t,n])):e[o][1]=n,this}},6878:function(t){t.exports=function(t,n){return function(e){return null!=e&&e[t]===n&&(void 0!==n||t in Object(e))}}},2453:function(t){t.exports=function(t){return t}},5125:function(t){t.exports=function(t,n){return function(e){return t(n(e))}}},4280:function(t,n,e){var r=e(6082),o=Math.max;t.exports=function(t,n,e){return n=o(void 0===n?t.length-1:n,0),function(){for(var i=arguments,s=-1,u=o(i.length-n,0),c=Array(u);++s<u;)c[s]=i[n+s];s=-1;for(var a=Array(n+1);++s<n;)a[s]=i[s];return a[n]=e(c),r(t,this,a)}}},2373:function(t,n,e){var r=e(2117),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},6226:function(t){t.exports=function(){return[]}},201:function(t){t.exports=function(t){return t}},7801:function(t,n,e){var r=e(2453),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,s=r((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(o,(function(t,e,r,o){n.push(r?o.replace(i,"$1"):e||t)})),n}));t.exports=s},3110:function(t,n,e){var r=e(1995);t.exports=function(t){if("string"==typeof t||r(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},1893:function(t,n,e){var r=e(6317),o=e(788),i=e(8286),s=e(8855),u=Object.prototype,c=u.hasOwnProperty,a=r((function(t,n){t=Object(t);var e=-1,r=n.length,a=r>2?n[2]:void 0;for(a&&i(n[0],n[1],a)&&(r=1);++e<r;)for(var f=n[e],l=s(f),p=-1,v=l.length;++p<v;){var h=l[p],d=t[h];(void 0===d||o(d,u[h])&&!c.call(t,h))&&(t[h]=f[h])}return t}));t.exports=a},788:function(t){t.exports=function(t,n){return t===n||t!=t&&n!=n}},2645:function(t,n,e){var r=e(6457);t.exports=function(t){return null!=t&&t.length?r(t,1):[]}},7314:function(t){t.exports=function(t){for(var n=-1,e=null==t?0:t.length,r={};++n<e;){var o=t[n];r[o[0]]=o[1]}return r}},9201:function(t,n,e){var r=e(4432);t.exports=function(t,n,e){var o=null==t?void 0:r(t,n);return void 0===o?e:o}},5066:function(t,n,e){var r=e(6776),o=e(3096);t.exports=function(t,n){return null!=t&&o(t,n,r)}},5346:function(t){t.exports=function(t){return t}},5075:function(t){t.exports=function(){return!1}},163:function(t){var n=Array.isArray;t.exports=n},981:function(t,n,e){var r=e(9642),o=e(8454);t.exports=function(t){return null!=t&&o(t.length)&&!r(t)}},4801:function(t){t.exports=function(){return!1}},4155:function(t,n,e){var r=e(7190),o=e(9667),i=e(5075),s=e(163),u=e(981),c=e(4801),a=e(5782),f=e(4289),l=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(u(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||c(t)||f(t)||i(t)))return!t.length;var n=o(t);if("[object Map]"==n||"[object Set]"==n)return!t.size;if(a(t))return!r(t).length;for(var e in t)if(l.call(t,e))return!1;return!0}},9642:function(t,n,e){var r=e(563),o=e(7709);t.exports=function(t){if(!o(t))return!1;var n=r(t);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}},8454:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},7709:function(t){t.exports=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},3474:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},1995:function(t){t.exports=function(){return!1}},4289:function(t){t.exports=function(){return!1}},7747:function(t,n,e){var r=e(5125)(Object.keys,Object);t.exports=r},8855:function(t){t.exports=function(t){var n=[];if(null!=t)for(var e in Object(t))n.push(e);return n}},6051:function(t){t.exports=function(t){if("function"!=typeof t)throw new TypeError("Expected a function");return function(){var n=arguments;switch(n.length){case 0:return!t.call(this);case 1:return!t.call(this,n[0]);case 2:return!t.call(this,n[0],n[1]);case 3:return!t.call(this,n[0],n[1],n[2])}return!t.apply(this,n)}}},1616:function(t,n,e){var r=e(3472),o=e(6051),i=e(4912);t.exports=function(t,n){return i(t,o(r(n)))}},9082:function(t,n,e){var r=e(5436),o=e(5557)((function(t,n){return null==t?{}:r(t,n)}));t.exports=o},4912:function(t,n,e){var r=e(8644),o=e(3472),i=e(6371),s=e(7271);t.exports=function(t,n){if(null==t)return{};var e=r(s(t),(function(t){return[t]}));return n=o(n),i(t,e,(function(t,e){return n(t,e[0])}))}},8532:function(t,n,e){var r=e(1600),o=e(3301),i=e(726),s=e(3110);t.exports=function(t){return i(t)?r(s(t)):o(t)}},7010:function(t,n,e){var r=e(6316);t.exports=function(t){return null==t?"":r(t)}},9602:function(t,n,e){var r=e(946);t.exports=function(t){return t&&t.length?r(t):[]}},7491:function(t){var n="undefined"!=typeof Element,e="function"==typeof Map,r="function"==typeof Set,o="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function i(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var u,c,a,f;if(Array.isArray(t)){if((u=t.length)!=s.length)return!1;for(c=u;0!=c--;)if(!i(t[c],s[c]))return!1;return!0}if(e&&t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(f=t.entries();!(c=f.next()).done;)if(!s.has(c.value[0]))return!1;for(f=t.entries();!(c=f.next()).done;)if(!i(c.value[1],s.get(c.value[0])))return!1;return!0}if(r&&t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(f=t.entries();!(c=f.next()).done;)if(!s.has(c.value[0]))return!1;return!0}if(o&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(s)){if((u=t.length)!=s.length)return!1;for(c=u;0!=c--;)if(t[c]!==s[c])return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((u=(a=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(c=u;0!=c--;)if(!Object.prototype.hasOwnProperty.call(s,a[c]))return!1;if(n&&t instanceof Element)return!1;for(c=u;0!=c--;)if(("_owner"!==a[c]&&"__v"!==a[c]&&"__o"!==a[c]||!t.$$typeof)&&!i(t[a[c]],s[a[c]]))return!1;return!0}return t!=t&&s!=s}t.exports=function(t,n){try{return i(t,n)}catch(t){if((t.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw t}}},9787:function(n){"use strict";n.exports=t}},e={};function r(t){var o=e[t];if(void 0!==o)return o.exports;var i=e[t]={exports:{}};return n[t](i,i.exports,r),i.exports}r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,{a:n}),n},r.d=function(t,n){for(var e in n)r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return function(){"use strict";r.r(o),r.d(o,{VictorySharedEvents:function(){return Q}});var t,n,e=r(9787),i=r.n(e),s=r(1893),u=r.n(s),c=r(4155),a=r.n(c),f=r(7314),l=r.n(f),p=r(7491),v=r.n(p),h=r(2516),d=r.n(h),y=0,b=0,g=0,x=0,m=0,j=0,O="object"==typeof performance&&performance.now?performance:Date,E="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function A(){return m||(E(_),m=O.now()+j)}function _(){m=0}function w(){this._call=this._time=this._next=null}function S(t,n,e){var r=new w;return r.restart(t,n,e),r}function k(){m=(x=O.now())+j,y=b=0;try{!function(){A(),++y;for(var n,e=t;e;)(n=m-e._time)>=0&&e._call.call(void 0,n),e=e._next;--y}()}finally{y=0,function(){for(var e,r,o=t,i=1/0;o;)o._call?(i>o._time&&(i=o._time),e=o,o=o._next):(r=o._next,o._next=null,o=e?e._next=r:t=r);n=e,P(i)}(),m=0}}function C(){var t=O.now(),n=t-x;n>1e3&&(j-=n,x=t)}function P(t){y||(b&&(b=clearTimeout(b)),t-m>24?(t<1/0&&(b=setTimeout(k,t-O.now()-j)),g&&(g=clearInterval(g))):(g||(x=O.now(),g=setInterval(C,1e3)),y=1,E(k)))}w.prototype=S.prototype={constructor:w,restart:function(e,r,o){if("function"!=typeof e)throw new TypeError("callback is not a function");o=(null==o?A():+o)+(null==r?0:+r),this._next||n===this||(n?n._next=this:t=this,n=this),this._call=e,this._time=o,P()},stop:function(){this._call&&(this._call=null,this._time=1/0,P())}};class G{constructor(){this.shouldAnimate=!0,this.subscribers=[],this.timer=null,this.activeSubscriptions=0}bypassAnimation(){this.shouldAnimate=!1}resumeAnimation(){this.shouldAnimate=!0}loop=()=>{this.subscribers.forEach((t=>{t.callback(A()-t.startTime,t.duration)}))};start(){this.timer||(this.timer=S(this.loop))}stop(){this.timer&&(this.timer.stop(),this.timer=null)}subscribe(t,n){const e=this.subscribers.push({startTime:A(),callback:t,duration:this.shouldAnimate?n:0});return this.activeSubscriptions++,this.start(),e}unsubscribe(t){null!==t&&this.subscribers[t-1]&&(delete this.subscribers[t-1],this.activeSubscriptions--),0===this.activeSubscriptions&&this.stop()}}const N=i().createContext({transitionTimer:new G,animationTimer:new G});N.displayName="TimerContext";var $=N,K=r(4912),M=r.n(K),T=r(1616),B=r.n(T),z=r(9602),F=r.n(z),L=(r(8532),r(9082)),V=r.n(L);function D(t){return"function"==typeof t}const q=/^onGlobal(.*)$/;function U(t,n,e,r){const o=t=>{const r=(()=>{const r=t.reduce(((t,e)=>void 0!==e.target?(Array.isArray(e.target)?e.target.includes(n):`${e.target}`==`${n}`)?t.concat(e):t:t.concat(e)),[]);return void 0!==e&&"parent"!==n?r.filter((t=>{const n=t.eventKey,r=t=>!t||`${t}`==`${e}`;return Array.isArray(n)?n.some((t=>r(t))):r(n)})):r})();return Array.isArray(r)&&r.reduce(((t,n)=>n?Object.assign(t,n.eventHandlers):t),{})},i=(()=>Array.isArray(this.componentEvents)?Array.isArray(t.events)?this.componentEvents.concat(...t.events):this.componentEvents:t.events)(),s=i&&D(r)?r(o(i),n):void 0;if(!t.sharedEvents)return s;const u=t.sharedEvents.getEvents,c=t.sharedEvents.events&&u(o(t.sharedEvents.events),n);return Object.assign({},c,s)}function I(t,n,e,r){if(a()(t))return{};const o=r||this.baseProps,i=(t,n)=>{const{childName:e,target:r,key:i}=t,s="props"===n?o:this.state||{},u=null!=e&&s[e]?s[e]:s;return"parent"===i?u.parent:u[i]&&u[i][r]},s=(t,r)=>{const s="parent"===n?t.childName:t.childName||e,u=t.target||n,c=(n,e)=>{const r=this.state||{};if(!D(t.mutation))return r;const s=i({childName:e,key:n,target:u},"props"),c=i({childName:e,key:n,target:u},"state"),a=t.mutation(Object.assign({},s,c),o),f=r[e]||{},l=t=>a?(t=>"parent"===u?Object.assign(t,{[n]:Object.assign(t[n]||{},a)}):Object.assign(t,{[n]:Object.assign(t[n]||{},{[u]:a})}))(t):(t=>(t[n]&&t[n][u]&&delete t[n][u],t[n]&&!Object.keys(t[n]).length&&delete t[n],t))(t);return null!=e?Object.assign(r,{[e]:l(f)}):l(r)},a=n=>{const e=(n=>"parent"===u?"parent":"all"===t.eventKey?o[n]?Object.keys(o[n]).filter((t=>"parent"!==t)):Object.keys(o).filter((t=>"parent"!==t)):void 0===t.eventKey&&"parent"===r?o[n]?Object.keys(o[n]):Object.keys(o):void 0!==t.eventKey?t.eventKey:r)(n);return Array.isArray(e)?e.reduce(((t,e)=>Object.assign(t,c(e,n))),{}):c(e,n)},f="all"===s?Object.keys(o).filter((t=>"parent"!==t)):s;return Array.isArray(f)?f.reduce(((t,n)=>Object.assign(t,a(n))),{}):a(f)},u=(n,e,r,o)=>{const i=t[o](n,e,r,this);if(!a()(i)){const t=(t=>{const n=t=>D(t.callback)&&t.callback,e=(Array.isArray(t)?t.map((t=>n(t))):[n(t)]).filter((t=>!1!==t));return e.length?()=>e.forEach((t=>t())):void 0})(i);this.setState(((t,n)=>Array.isArray(t)?t.reduce(((t,e)=>Object.assign({},t,s(e,n))),{}):s(t,n))(i,r),t)}};return Object.keys(t).reduce(((t,n)=>(t[n]=u,t)),{})}function R(t,n,e){const r=this.state||{};return e?r[e]&&r[e][t]&&r[e][t][n]:"parent"===t?r[t]&&r[t][n]||r[t]:r[t]&&r[t][n]}function H(t,n,e,r){const o=(t,n)=>"string"==typeof t[n]?"all"===t[n]||t[n]===r[n]:!!Array.isArray(t[n])&&t[n].map((t=>`${t}`)).includes(r[n]);let i=Array.isArray(t)?t:[t];r.childName&&(i=t.filter((t=>o(t,"childName"))));const s=i.filter((t=>o(t,"target")));if(a()(s))return;const u=s.filter((t=>o(t,"eventKey")));return a()(u)?void 0:u.reduce(((t,r)=>{const o=(r&&D(r.mutation)?r.mutation:()=>{})(Object.assign({},n,e));return Object.assign({},t,o)}),{})}function J(t){const n=t.match(q);return n&&n[1]&&n[1].toLowerCase()}function W(t,n){return t&&n?t.filter((t=>!n.includes(t))):[]}class Q extends i().Component{static displayName="VictorySharedEvents";static role="shared-event-wrapper";static contextType=$;static defaultProps={groupComponent:i().createElement("g",null)};constructor(t){super(t),this.getScopedEvents=I.bind(this),this.getEventState=R.bind(this),this.state=this.state||{},this.sharedEventsCache={},this.globalEvents={},this.prevGlobalEventKeys=[],this.boundGlobalEvents={},this.baseProps=this.getBaseProps(t)}shouldComponentUpdate(t){if(!v()(this.props,t)){this.baseProps=this.getBaseProps(t);const n=this.getExternalMutations(t,this.baseProps);this.applyExternalMutations(t,n)}return!0}componentDidMount(){const t=Object.keys(this.globalEvents);t.forEach((t=>this.addGlobalListener(t))),this.prevGlobalEventKeys=t}componentDidUpdate(){const t=Object.keys(this.globalEvents);W(this.prevGlobalEventKeys,t).forEach((t=>this.removeGlobalListener(t))),W(t,this.prevGlobalEventKeys).forEach((t=>this.addGlobalListener(t))),this.prevGlobalEventKeys=t}componentWillUnmount(){this.prevGlobalEventKeys.forEach((t=>this.removeGlobalListener(t)))}addGlobalListener(t){const n=n=>{const e=this.globalEvents[t];return e&&e((t=>Object.assign(t,{nativeEvent:t}))(n))};this.boundGlobalEvents[t]=n,window.addEventListener(J(t),n)}removeGlobalListener(t){window.removeEventListener(J(t),this.boundGlobalEvents[t])}getAllEvents(t){const n=function(t,n){const e=Array.isArray(n)&&n.reduce(((n,e)=>{const r=t[e],o=r&&r.type&&r.type.defaultEvents,i=D(o)?o(r.props):o;return Array.isArray(i)?n.concat(...i):n}),[]);return e&&e.length?e:void 0}(t,["container","groupComponent"]);return Array.isArray(n)?Array.isArray(t.events)?n.concat(...t.events):n:t.events}applyExternalMutations(t,n){if(!a()(n)){const e=t.externalEventMutations.reduce(((t,n)=>D(n.callback)?t.concat(n.callback):t),[]),r=e.length?()=>{e.forEach((t=>t()))}:void 0;this.setState(n,r)}}getExternalMutations(t,n){return a()(t.externalEventMutations)?void 0:function(t,n,e,r){return void 0===n&&(n={}),void 0===e&&(e={}),r.reduce(((r,o)=>{const i=e[o],s=function(t,n,e,r){return void 0===n&&(n={}),void 0===e&&(e={}),Object.keys(n).reduce(((o,i)=>{const s=e[i]||{},u=n[i]||{};if("parent"===i){const n=H(t,u,s,{eventKey:i,target:"parent"});o[i]=void 0!==n?Object.assign({},s,n):s}else{const n=F()(Object.keys(u).concat(Object.keys(s)));o[i]=n.reduce(((n,e)=>{const o={eventKey:i,target:e,childName:r},c=H(t,u[e],s[e],o);return n[e]=void 0!==c?Object.assign({},s[e],c):s[e],M()(n,(t=>!a()(t)))}),{})}return M()(o,(t=>!a()(t)))}),{})}(t,n[o],e[o],o);return r[o]=s||i,M()(r,(t=>!a()(t)))}),{})}(t.externalEventMutations,n,this.state,Object.keys(n))}cacheSharedEvents(t,n,e){this.sharedEventsCache[t]=[n,e]}getCachedSharedEvents(t,n){const[e,r]=this.sharedEventsCache[t]||[];if(e&&v()(n,r))return e}getBaseProps(t){const{container:n}=t,e=i().Children.toArray(this.props.children),r=this.getBasePropsFromChildren(e),o=n?n.props:{};return Object.assign({},r,{parent:o})}getBasePropsFromChildren(t){const n=function(t,n,r,o,s){void 0===r&&(r={}),void 0===o&&(o=[]),void 0===s&&(s=(t,n)=>t.concat(n));const u=["data","domain","categories","polar","startAngle","endAngle","minDomain","maxDomain","horizontal"],c=(t,n,e)=>t.reduce(((t,e,o)=>{let a=t;const f=e.type&&e.type.role,l=e.props.name||`${f}-${n[o]}`;if(e.props&&e.props.children){const t=Object.assign({},e.props,V()(r,u)),n=e.type&&"stack"===e.type.role&&D(e.type.getChildren)?e.type.getChildren(t):i().Children.toArray(e.props.children).map((n=>{const e=Object.assign({},n.props,V()(t,u));return i().cloneElement(n,e)})),o=n.map(((t,n)=>`${l}-${n}`)),f=c(n,o,e);a=s(a,f)}else{const t=((t,n)=>{if(t.type&&D(t.type.getBaseProps)){const e=t.props&&t.type.getBaseProps(t.props);return e?[[n,e]]:null}return null})(e,l);t&&(a=s(a,t))}return a}),o),a=t.filter(e.isValidElement),f=a.map(((t,n)=>n));return c(a,f)}(t);return l()(n)}getNewChildren(t,n){const{events:e,eventKey:r}=t,o=(t,s)=>t.reduce(((t,u,c)=>{if(u.props.children){const n=i().Children.toArray(u.props.children),e=s.slice(c,c+n.length),r=i().cloneElement(u,u.props,o(n,e));return t.concat(r)}if("parent"!==s[c]&&u.type&&D(u.type.getBaseProps)){const o=u.props.name||s[c],a=Array.isArray(e)&&e.filter((t=>"parent"!==t.target&&(Array.isArray(t.childName)?t.childName.indexOf(o)>-1:t.childName===o||"all"===t.childName))),f=[o,n,a,d()(this.state[o])],l=this.getCachedSharedEvents(o,f)||{events:a,getEvents:(t,e)=>this.getScopedEvents(t,e,o,n),getEventState:(t,n)=>this.getEventState(t,n,o)};return this.cacheSharedEvents(o,l,f),t.concat(i().cloneElement(u,Object.assign({key:`events-${o}`,sharedEvents:l,eventKey:r,name:o},u.props)))}return t.concat(u)}),[]),s=Object.keys(n),u=i().Children.toArray(t.children);return o(u,s)}getContainer(t,n,e){const r=this.getNewChildren(t,n),o=Array.isArray(e)?e.filter((t=>"parent"===t.target)):[],s=o.length>0?{events:o,getEvents:(t,e)=>this.getScopedEvents(t,e,null,n),getEventState:this.getEventState}:null,c=t.container||t.groupComponent,a=c.type&&c.type.role,f=c.props||{},l=U.bind(this),p=s&&l({sharedEvents:s},"parent"),v=u()({},this.getEventState("parent","parent"),f,n.parent,{children:r}),h=u()({},function(t,n,e){return t?Object.keys(t).reduce(((n,r)=>(n[r]=n=>t[r](n,e,"parent",r),n)),{}):{}}(p,0,v),f.events);this.globalEvents=(t=>M()(t,((t,n)=>q.test(n))))(h);const d=(t=>B()(t,((t,n)=>q.test(n))))(h);return"container"===a?i().cloneElement(c,Object.assign({},v,{events:d})):i().cloneElement(c,d,r)}render(){const t=this.getAllEvents(this.props);return t?this.getContainer(this.props,this.baseProps,t):i().cloneElement(this.props.container,{children:this.props.children})}}}(),o}()}));
|
|
2
2
|
//# sourceMappingURL=victory-shared-events.min.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { EventCallbackInterface, EventMixinCalculatedValues, EventPropTypeInterface, StringOrNumberOrCallback } from "victory-core";
|
|
4
|
-
export
|
|
3
|
+
export type VictorySharedEventsProps = {
|
|
5
4
|
children?: React.ReactElement | React.ReactElement[];
|
|
6
5
|
container?: React.ReactElement;
|
|
7
6
|
groupComponent?: React.ReactElement;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import _fromPairs from "lodash/fromPairs";
|
|
2
|
-
import _isEmpty from "lodash/isEmpty";
|
|
3
|
-
import _defaults from "lodash/defaults";
|
|
4
1
|
import React from "react";
|
|
5
|
-
import
|
|
2
|
+
import defaults from "lodash/defaults";
|
|
3
|
+
import isEmpty from "lodash/isEmpty";
|
|
4
|
+
import fromPairs from "lodash/fromPairs";
|
|
6
5
|
import isEqual from "react-fast-compare";
|
|
7
6
|
import stringify from "json-stringify-safe";
|
|
7
|
+
import { Collection, Events, Helpers, TimerContext } from "victory-core";
|
|
8
8
|
|
|
9
9
|
// DISCLAIMER:
|
|
10
10
|
// This file is not currently tested, and it is first on the list of files
|
|
@@ -75,7 +75,7 @@ export class VictorySharedEvents extends React.Component {
|
|
|
75
75
|
return props.events;
|
|
76
76
|
}
|
|
77
77
|
applyExternalMutations(props, externalMutations) {
|
|
78
|
-
if (!
|
|
78
|
+
if (!isEmpty(externalMutations)) {
|
|
79
79
|
const callbacks = props.externalEventMutations.reduce((memo, mutation) => Helpers.isFunction(mutation.callback) ? memo.concat(mutation.callback) : memo, []);
|
|
80
80
|
const compiledCallbacks = callbacks.length ? () => {
|
|
81
81
|
callbacks.forEach(c => c());
|
|
@@ -84,7 +84,7 @@ export class VictorySharedEvents extends React.Component {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
getExternalMutations(props, baseProps) {
|
|
87
|
-
return !
|
|
87
|
+
return !isEmpty(props.externalEventMutations) ? Events.getExternalMutationsWithChildren(props.externalEventMutations, baseProps, this.state, Object.keys(baseProps)) : undefined;
|
|
88
88
|
}
|
|
89
89
|
cacheSharedEvents(name, sharedEvents, cacheValues) {
|
|
90
90
|
this.sharedEventsCache[name] = [sharedEvents, cacheValues];
|
|
@@ -116,7 +116,7 @@ export class VictorySharedEvents extends React.Component {
|
|
|
116
116
|
return null;
|
|
117
117
|
};
|
|
118
118
|
const baseProps = Helpers.reduceChildren(childComponents, iteratee);
|
|
119
|
-
return
|
|
119
|
+
return fromPairs(baseProps);
|
|
120
120
|
}
|
|
121
121
|
getNewChildren(props, baseProps) {
|
|
122
122
|
const {
|
|
@@ -177,10 +177,10 @@ export class VictorySharedEvents extends React.Component {
|
|
|
177
177
|
const parentEvents = sharedEvents && boundGetEvents({
|
|
178
178
|
sharedEvents
|
|
179
179
|
}, "parent");
|
|
180
|
-
const parentProps =
|
|
180
|
+
const parentProps = defaults({}, this.getEventState("parent", "parent"), containerProps, baseProps.parent, {
|
|
181
181
|
children
|
|
182
182
|
});
|
|
183
|
-
const containerEvents =
|
|
183
|
+
const containerEvents = defaults({}, Events.getPartialEvents(parentEvents, "parent", parentProps), containerProps.events);
|
|
184
184
|
this.globalEvents = Events.getGlobalEvents(containerEvents);
|
|
185
185
|
const localEvents = Events.omitGlobalEvents(containerEvents);
|
|
186
186
|
return role === "container" ? /*#__PURE__*/React.cloneElement(container, Object.assign({}, parentProps, {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { EventCallbackInterface, EventMixinCalculatedValues, EventPropTypeInterface, StringOrNumberOrCallback } from "victory-core";
|
|
4
|
-
export
|
|
3
|
+
export type VictorySharedEventsProps = {
|
|
5
4
|
children?: React.ReactElement | React.ReactElement[];
|
|
6
5
|
container?: React.ReactElement;
|
|
7
6
|
groupComponent?: React.ReactElement;
|
|
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VictorySharedEvents = void 0;
|
|
7
|
-
var _fromPairs2 = _interopRequireDefault(require("lodash/fromPairs"));
|
|
8
|
-
var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
|
|
9
|
-
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
|
|
10
7
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var
|
|
8
|
+
var _defaults = _interopRequireDefault(require("lodash/defaults"));
|
|
9
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
10
|
+
var _fromPairs = _interopRequireDefault(require("lodash/fromPairs"));
|
|
12
11
|
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
|
|
13
12
|
var _jsonStringifySafe = _interopRequireDefault(require("json-stringify-safe"));
|
|
13
|
+
var _victoryCore = require("victory-core");
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
// DISCLAIMER:
|
|
16
16
|
// This file is not currently tested, and it is first on the list of files
|
|
@@ -81,7 +81,7 @@ class VictorySharedEvents extends _react.default.Component {
|
|
|
81
81
|
return props.events;
|
|
82
82
|
}
|
|
83
83
|
applyExternalMutations(props, externalMutations) {
|
|
84
|
-
if (!(0,
|
|
84
|
+
if (!(0, _isEmpty.default)(externalMutations)) {
|
|
85
85
|
const callbacks = props.externalEventMutations.reduce((memo, mutation) => _victoryCore.Helpers.isFunction(mutation.callback) ? memo.concat(mutation.callback) : memo, []);
|
|
86
86
|
const compiledCallbacks = callbacks.length ? () => {
|
|
87
87
|
callbacks.forEach(c => c());
|
|
@@ -90,7 +90,7 @@ class VictorySharedEvents extends _react.default.Component {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
getExternalMutations(props, baseProps) {
|
|
93
|
-
return !(0,
|
|
93
|
+
return !(0, _isEmpty.default)(props.externalEventMutations) ? _victoryCore.Events.getExternalMutationsWithChildren(props.externalEventMutations, baseProps, this.state, Object.keys(baseProps)) : undefined;
|
|
94
94
|
}
|
|
95
95
|
cacheSharedEvents(name, sharedEvents, cacheValues) {
|
|
96
96
|
this.sharedEventsCache[name] = [sharedEvents, cacheValues];
|
|
@@ -122,7 +122,7 @@ class VictorySharedEvents extends _react.default.Component {
|
|
|
122
122
|
return null;
|
|
123
123
|
};
|
|
124
124
|
const baseProps = _victoryCore.Helpers.reduceChildren(childComponents, iteratee);
|
|
125
|
-
return (0,
|
|
125
|
+
return (0, _fromPairs.default)(baseProps);
|
|
126
126
|
}
|
|
127
127
|
getNewChildren(props, baseProps) {
|
|
128
128
|
const {
|
|
@@ -183,10 +183,10 @@ class VictorySharedEvents extends _react.default.Component {
|
|
|
183
183
|
const parentEvents = sharedEvents && boundGetEvents({
|
|
184
184
|
sharedEvents
|
|
185
185
|
}, "parent");
|
|
186
|
-
const parentProps = (0,
|
|
186
|
+
const parentProps = (0, _defaults.default)({}, this.getEventState("parent", "parent"), containerProps, baseProps.parent, {
|
|
187
187
|
children
|
|
188
188
|
});
|
|
189
|
-
const containerEvents = (0,
|
|
189
|
+
const containerEvents = (0, _defaults.default)({}, _victoryCore.Events.getPartialEvents(parentEvents, "parent", parentProps), containerProps.events);
|
|
190
190
|
this.globalEvents = _victoryCore.Events.getGlobalEvents(containerEvents);
|
|
191
191
|
const localEvents = _victoryCore.Events.omitGlobalEvents(containerEvents);
|
|
192
192
|
return role === "container" ? /*#__PURE__*/_react.default.cloneElement(container, Object.assign({}, parentProps, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-shared-events",
|
|
3
|
-
"version": "37.3.
|
|
3
|
+
"version": "37.3.4",
|
|
4
4
|
"description": "Shared Event Helper for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"json-stringify-safe": "^5.0.1",
|
|
24
24
|
"lodash": "^4.17.19",
|
|
25
25
|
"react-fast-compare": "^3.2.0",
|
|
26
|
-
"victory-core": "37.3.
|
|
26
|
+
"victory-core": "37.3.4"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": ">=16.6.0"
|
|
@@ -182,32 +182,6 @@
|
|
|
182
182
|
"pnpm-lock.yaml"
|
|
183
183
|
]
|
|
184
184
|
},
|
|
185
|
-
"format": {
|
|
186
|
-
"command": "nps format:pkg",
|
|
187
|
-
"files": [
|
|
188
|
-
"src/**",
|
|
189
|
-
"*.json",
|
|
190
|
-
"../../.prettierignore",
|
|
191
|
-
"../../.prettierrc.json"
|
|
192
|
-
],
|
|
193
|
-
"output": [],
|
|
194
|
-
"packageLocks": [
|
|
195
|
-
"pnpm-lock.yaml"
|
|
196
|
-
]
|
|
197
|
-
},
|
|
198
|
-
"format:fix": {
|
|
199
|
-
"command": "pnpm run format || nps format:pkg:fix",
|
|
200
|
-
"files": [
|
|
201
|
-
"src/**",
|
|
202
|
-
"*.json",
|
|
203
|
-
"../../.prettierignore",
|
|
204
|
-
"../../.prettierrc.json"
|
|
205
|
-
],
|
|
206
|
-
"output": [],
|
|
207
|
-
"packageLocks": [
|
|
208
|
-
"pnpm-lock.yaml"
|
|
209
|
-
]
|
|
210
|
-
},
|
|
211
185
|
"lint": {
|
|
212
186
|
"command": "eslint src",
|
|
213
187
|
"files": [
|
|
@@ -270,8 +244,6 @@
|
|
|
270
244
|
"check": "wireit",
|
|
271
245
|
"types:check": "wireit",
|
|
272
246
|
"types:create": "wireit",
|
|
273
|
-
"format": "wireit",
|
|
274
|
-
"format:fix": "wireit",
|
|
275
247
|
"lint": "wireit",
|
|
276
248
|
"lint:fix": "wireit",
|
|
277
249
|
"jest": "wireit"
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { defaults, isEmpty, fromPairs } from "lodash";
|
|
2
1
|
import React from "react";
|
|
2
|
+
import defaults from "lodash/defaults";
|
|
3
|
+
import isEmpty from "lodash/isEmpty";
|
|
4
|
+
import fromPairs from "lodash/fromPairs";
|
|
5
|
+
import isEqual from "react-fast-compare";
|
|
6
|
+
import stringify from "json-stringify-safe";
|
|
7
|
+
|
|
3
8
|
import {
|
|
4
9
|
Collection,
|
|
5
10
|
EventCallbackInterface,
|
|
@@ -10,8 +15,6 @@ import {
|
|
|
10
15
|
StringOrNumberOrCallback,
|
|
11
16
|
TimerContext,
|
|
12
17
|
} from "victory-core";
|
|
13
|
-
import isEqual from "react-fast-compare";
|
|
14
|
-
import stringify from "json-stringify-safe";
|
|
15
18
|
|
|
16
19
|
export type VictorySharedEventsProps = {
|
|
17
20
|
children?: React.ReactElement | React.ReactElement[];
|