victory-pie
Version:
Pie Component for Victory
1,294 lines (1,150 loc) • 920 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["VictoryPie"] = factory(require("react"));
else
root["VictoryPie"] = factory(root["React"]);
})(self, function(__WEBPACK_EXTERNAL_MODULE_react__) {
return /******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./helper-methods.ts":
/*!***************************!*\
!*** ./helper-methods.ts ***!
\***************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "getAverage": function() { return /* binding */ getAverage; },
/* harmony export */ "getBaseProps": function() { return /* binding */ getBaseProps; },
/* harmony export */ "getLabelIndicatorPropsForLineSegment": function() { return /* binding */ getLabelIndicatorPropsForLineSegment; },
/* harmony export */ "getXOffset": function() { return /* binding */ getXOffset; },
/* harmony export */ "getXOffsetMultiplayerByAngle": function() { return /* binding */ getXOffsetMultiplayerByAngle; },
/* harmony export */ "getYOffset": function() { return /* binding */ getYOffset; },
/* harmony export */ "getYOffsetMultiplayerByAngle": function() { return /* binding */ getYOffsetMultiplayerByAngle; }
/* harmony export */ });
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/isPlainObject */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isPlainObject.js");
/* harmony import */ var lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-vendor/d3-shape */ "../../victory-vendor/es/d3-shape.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/style.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/data.js");
/* eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1, 2, 45, 90, 135, 180, 225, 270, 315, 360] }]*/
const checkForValidText = text => {
if (text === undefined || text === null || victory_core__WEBPACK_IMPORTED_MODULE_3__.isFunction(text)) {
return text;
}
return `${text}`;
};
const getColor = (style, colors, index) => {
if (style && style.data && style.data.fill) {
return style.data.fill;
}
return colors && colors[index % colors.length];
};
const getRadius = (props, padding) => {
if (typeof props.radius === "number") {
return props.radius;
}
return Math.min(props.width - padding.left - padding.right, props.height - padding.top - padding.bottom) / 2;
};
const getOrigin = (props, padding) => {
const {
width,
height
} = props;
const origin = lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_1___default()(props.origin) ? props.origin : {};
return {
x: origin.x !== undefined ? origin.x : (padding.left - padding.right + width) / 2,
y: origin.y !== undefined ? origin.y : (padding.top - padding.bottom + height) / 2
};
};
const getSlices = (props, data) => {
const padAngle = victory_core__WEBPACK_IMPORTED_MODULE_3__.isFunction(props.padAngle) ? 0 : props.padAngle;
const layoutFunction = victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_2__.pie().sort(null).startAngle(victory_core__WEBPACK_IMPORTED_MODULE_3__.degreesToRadians(props.startAngle)).endAngle(victory_core__WEBPACK_IMPORTED_MODULE_3__.degreesToRadians(props.endAngle)).padAngle(victory_core__WEBPACK_IMPORTED_MODULE_3__.degreesToRadians(padAngle)).value(datum => {
return datum._y;
});
return layoutFunction(data);
};
const getCategoriesFromProps = props => Array.isArray(props.categories) ? props.categories : props?.categories?.x ?? [];
/**
* Sorts data by props.categories or props.categories.x. If all of the data keys aren't
* included in categories, any remaining data will be appended to the data array.
* If extraneous categories are included in the categories prop, the will be ignored and
* have no effect on the rendered component.
*/
const getDataSortedByCategories = (props, data) => {
const sorted = [];
getCategoriesFromProps(props).forEach(category => {
const idx = data.findIndex(_ref => {
let {
x
} = _ref;
return x === category;
});
if (idx >= 0) {
const datum = data.splice(idx, 1)[0];
sorted.push(datum);
}
});
return [...sorted, ...data];
};
const getCalculatedValues = props => {
const {
colorScale,
theme
} = props;
const styleObject = victory_core__WEBPACK_IMPORTED_MODULE_3__.getDefaultStyles(props, "pie");
const style = victory_core__WEBPACK_IMPORTED_MODULE_3__.getStyles(props.style, styleObject);
const colors = Array.isArray(colorScale) ? colorScale : victory_core__WEBPACK_IMPORTED_MODULE_4__.getColorScale(colorScale, theme);
const padding = victory_core__WEBPACK_IMPORTED_MODULE_3__.getPadding(props.padding);
const defaultRadius = getRadius(props, padding);
const origin = getOrigin(props, padding);
const data = getDataSortedByCategories(props, victory_core__WEBPACK_IMPORTED_MODULE_5__.getData(props));
const slices = getSlices(props, data);
return Object.assign({}, props, {
style,
colors,
padding,
defaultRadius,
data,
slices,
origin
});
};
const getSliceStyle = (index, calculatedValues) => {
const {
style,
colors
} = calculatedValues;
const fill = getColor(style, colors, index);
return Object.assign({
fill
}, style.data);
};
const getLabelText = (props, datum, index) => {
let text;
if (datum.label) {
text = datum.label;
} else if (Array.isArray(props.labels)) {
text = props.labels[index];
} else {
text = victory_core__WEBPACK_IMPORTED_MODULE_3__.isFunction(props.labels) ? props.labels : datum.xName || datum._x;
}
return checkForValidText(text);
};
const getLabelArc = labelRadius => {
return victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_2__.arc().outerRadius(labelRadius).innerRadius(labelRadius);
};
const getCalculatedLabelRadius = (radius, labelRadius, style) => {
const padding = style && style.padding || 0;
return labelRadius || radius + padding;
};
const getLabelPosition = (arc, slice, position) => {
const construct = {
startAngle: position === "startAngle" ? slice.startAngle : slice.endAngle,
endAngle: position === "endAngle" ? slice.endAngle : slice.startAngle
};
const clonedArc = Object.assign({}, slice, construct);
return arc.centroid(clonedArc);
};
const getLabelOrientation = (degree, labelPlacement) => {
if (labelPlacement === "perpendicular") {
return degree > 90 && degree < 270 ? "bottom" : "top";
} else if (labelPlacement === "parallel") {
return degree >= 0 && degree <= 180 ? "right" : "left";
}
if (degree < 45 || degree > 315) {
return "top";
} else if (degree >= 45 && degree < 135) {
return "right";
} else if (degree >= 135 && degree < 225) {
return "bottom";
}
return "left";
};
const getTextAnchor = orientation => {
if (orientation === "top" || orientation === "bottom") {
return "middle";
}
return orientation === "right" ? "start" : "end";
};
const getVerticalAnchor = orientation => {
if (orientation === "left" || orientation === "right") {
return "middle";
}
return orientation === "bottom" ? "start" : "end";
};
const getBaseLabelAngle = (slice, labelPosition, labelStyle) => {
let baseAngle = 0;
if (labelPosition.angle !== undefined) {
baseAngle = labelStyle.angle;
} else if (labelPosition === "centroid") {
baseAngle = victory_core__WEBPACK_IMPORTED_MODULE_3__.radiansToDegrees((slice.startAngle + slice.endAngle) / 2);
} else {
baseAngle = labelPosition === "startAngle" ? victory_core__WEBPACK_IMPORTED_MODULE_3__.radiansToDegrees(slice.startAngle) : victory_core__WEBPACK_IMPORTED_MODULE_3__.radiansToDegrees(slice.endAngle);
}
const positiveAngle = baseAngle < 0 ? 360 - baseAngle : baseAngle;
return positiveAngle % 360;
};
const getLabelAngle = (baseAngle, labelPlacement) => {
if (labelPlacement === "vertical") {
return 0;
}
if (labelPlacement === "parallel") {
return baseAngle > 180 && baseAngle < 360 ? baseAngle + 90 : baseAngle - 90;
}
return baseAngle > 90 && baseAngle < 270 ? baseAngle - 180 : baseAngle;
};
const getLabelProps = (text, dataProps, calculatedValues) => {
const {
index,
datum,
data,
slice,
labelComponent,
theme
} = dataProps;
const {
style,
defaultRadius,
origin,
width,
height
} = calculatedValues;
const labelRadius = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(calculatedValues.labelRadius, Object.assign({
text
}, dataProps));
const labelPosition = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(calculatedValues.labelPosition, Object.assign({
text
}, dataProps)) || "centroid";
const labelPlacement = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(calculatedValues.labelPlacement, Object.assign({
text
}, dataProps)) || "vertical";
const labelStyle = Object.assign({
padding: 0
}, style.labels);
const evaluatedStyle = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateStyle(labelStyle, Object.assign({
labelRadius,
text
}, dataProps));
const calculatedLabelRadius = getCalculatedLabelRadius(defaultRadius, labelRadius, evaluatedStyle);
const labelArc = getLabelArc(calculatedLabelRadius);
const position = getLabelPosition(labelArc, slice, labelPosition);
const baseAngle = getBaseLabelAngle(slice, labelPosition, labelStyle);
const labelAngle = getLabelAngle(baseAngle, labelPlacement);
const orientation = getLabelOrientation(baseAngle, labelPlacement);
const textAnchor = labelStyle.textAnchor || getTextAnchor(orientation);
const verticalAnchor = labelStyle.verticalAnchor || getVerticalAnchor(orientation);
const labelProps = {
width,
height,
index,
datum,
data,
slice,
orientation,
text,
style: labelStyle,
x: Math.round(position[0]) + origin.x,
y: Math.round(position[1]) + origin.y,
textAnchor,
verticalAnchor,
angle: labelAngle,
calculatedLabelRadius
};
if (!victory_core__WEBPACK_IMPORTED_MODULE_3__.isTooltip(labelComponent)) {
return labelProps;
}
const tooltipTheme = theme && theme.tooltip || {};
return lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, labelProps, victory_core__WEBPACK_IMPORTED_MODULE_3__.omit(tooltipTheme, ["style"]));
};
const getXOffsetMultiplayerByAngle = angle => Math.cos(angle - victory_core__WEBPACK_IMPORTED_MODULE_3__.degreesToRadians(90));
const getYOffsetMultiplayerByAngle = angle => Math.sin(angle - victory_core__WEBPACK_IMPORTED_MODULE_3__.degreesToRadians(90));
const getXOffset = (offset, angle) => offset * getXOffsetMultiplayerByAngle(angle);
const getYOffset = (offset, angle) => offset * getYOffsetMultiplayerByAngle(angle);
const getAverage = array => array.reduce((acc, cur) => acc + cur, 0) / array.length;
const getLabelIndicatorPropsForLineSegment = (props, calculatedValues, labelProps) => {
const {
innerRadius,
radius,
slice: {
startAngle,
endAngle
},
labelIndicatorInnerOffset,
labelIndicatorOuterOffset,
index
} = props;
const {
height,
width
} = calculatedValues;
const {
calculatedLabelRadius
} = labelProps;
// calculation
const middleRadius = getAverage([innerRadius, radius]);
const midAngle = getAverage([endAngle, startAngle]);
const centerX = width / 2;
const centerY = height / 2;
const innerOffset = middleRadius + labelIndicatorInnerOffset;
const outerOffset = calculatedLabelRadius - labelIndicatorOuterOffset;
const x1 = centerX + getXOffset(innerOffset, midAngle);
const y1 = centerY + getYOffset(innerOffset, midAngle);
const x2 = centerX + getXOffset(outerOffset, midAngle);
const y2 = centerY + getYOffset(outerOffset, midAngle);
const labelIndicatorProps = {
x1,
y1,
x2,
y2,
index
};
return lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, labelIndicatorProps);
};
const getBaseProps = (initialProps, fallbackProps) => {
const props = victory_core__WEBPACK_IMPORTED_MODULE_3__.modifyProps(initialProps, fallbackProps, "pie");
const calculatedValues = getCalculatedValues(props);
const {
slices,
style,
data,
origin,
defaultRadius,
labels,
events,
sharedEvents,
height,
width,
standalone,
name,
innerRadius,
cornerRadius,
padAngle,
disableInlineStyles,
labelIndicator
} = calculatedValues;
const radius = props.radius || defaultRadius;
const initialChildProps = {
parent: {
standalone,
height,
width,
slices,
name,
style: style.parent
}
};
return slices.reduce((childProps, slice, index) => {
const datum = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, data[index], {
startAngle: victory_core__WEBPACK_IMPORTED_MODULE_3__.radiansToDegrees(slice.startAngle),
endAngle: victory_core__WEBPACK_IMPORTED_MODULE_3__.radiansToDegrees(slice.endAngle),
padAngle: victory_core__WEBPACK_IMPORTED_MODULE_3__.radiansToDegrees(slice.padAngle)
});
const eventKey = !victory_core__WEBPACK_IMPORTED_MODULE_3__.isNil(datum.eventKey) ? datum.eventKey : index;
const dataProps = {
index,
slice,
datum,
data,
origin,
innerRadius,
radius,
cornerRadius,
padAngle,
style: disableInlineStyles ? {} : getSliceStyle(index, calculatedValues),
disableInlineStyles
};
childProps[eventKey] = {
data: dataProps
};
const text = getLabelText(props, datum, index);
if (text !== undefined && text !== null || labels && (events || sharedEvents)) {
const evaluatedText = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(text, dataProps);
childProps[eventKey].labels = getLabelProps(evaluatedText, Object.assign({}, props, dataProps), calculatedValues);
if (labelIndicator) {
const labelProps = childProps[eventKey].labels;
if (labelProps.calculatedLabelRadius > radius) {
childProps[eventKey].labelIndicators = getLabelIndicatorPropsForLineSegment(Object.assign({}, props, dataProps), calculatedValues, labelProps);
}
}
}
return childProps;
}, initialChildProps);
};
/***/ }),
/***/ "./slice.tsx":
/*!*******************!*\
!*** ./slice.tsx ***!
\*******************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Slice": function() { return /* binding */ Slice; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/path.js");
/* 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");
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-vendor/d3-shape */ "../../victory-vendor/es/d3-shape.js");
const getPath = props => {
const {
slice,
radius,
innerRadius,
cornerRadius
} = props;
if (victory_core__WEBPACK_IMPORTED_MODULE_3__.isFunction(props.pathFunction)) {
return props.pathFunction(slice);
}
const padAngle = victory_core__WEBPACK_IMPORTED_MODULE_3__.degreesToRadians(props.padAngle);
const startAngle = victory_core__WEBPACK_IMPORTED_MODULE_3__.degreesToRadians(props.sliceStartAngle);
const endAngle = victory_core__WEBPACK_IMPORTED_MODULE_3__.degreesToRadians(props.sliceEndAngle);
const pathFunction = victory_vendor_d3_shape__WEBPACK_IMPORTED_MODULE_2__.arc().cornerRadius(cornerRadius).outerRadius(radius).innerRadius(innerRadius || 0);
return pathFunction(lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
startAngle,
endAngle,
padAngle
}, slice));
};
const evaluateProps = props => {
/**
* * Potential evaluated props of following must be evaluated in this order:
* 1) `style`
* 2) `radius`
* 3) `innerRadius`
*
* Everything else does not have to be evaluated in a particular order:
* `ariaLabel`
* `id`
* `cornerRadius`
* `padAngle`
* `sliceStartAngle`
* `sliceEndAngle`
* `tabIndex`
*/
const style = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateStyle(props.style, props);
const radius = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.radius, Object.assign({}, props, {
style
}));
const innerRadius = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.innerRadius, Object.assign({}, props, {
style,
radius
}));
const ariaLabel = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.ariaLabel, props);
const id = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.id, props);
const cornerRadius = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.cornerRadius, props);
const padAngle = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.padAngle, props);
const sliceStartAngle = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.sliceStartAngle, props);
const sliceEndAngle = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.sliceEndAngle, props);
const tabIndex = victory_core__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.tabIndex, props);
return Object.assign({}, props, {
ariaLabel,
style,
radius,
innerRadius,
id,
cornerRadius,
padAngle,
sliceStartAngle,
sliceEndAngle,
tabIndex
});
};
const defaultProps = {
pathComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_4__.Path, null),
role: "presentation",
shapeRendering: "auto"
};
const Slice = initialProps => {
const props = evaluateProps(lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, initialProps, defaultProps));
const defaultTransform = props.origin ? `translate(${props.origin.x}, ${props.origin.y})` : undefined;
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(props.pathComponent, {
...props.events,
"aria-label": props.ariaLabel,
d: getPath(props),
style: props.style,
transform: props.transform || defaultTransform,
className: props.className,
role: props.role,
shapeRendering: props.shapeRendering,
clipPath: props.clipPath,
tabIndex: props.tabIndex
});
};
/***/ }),
/***/ "./victory-pie.tsx":
/*!*************************!*\
!*** ./victory-pie.tsx ***!
\*************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "VictoryPie": function() { return /* binding */ VictoryPie; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-label/victory-label.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-theme/victory-theme.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/data.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/line-segment.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/user-props.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/add-events.js");
/* harmony import */ var _helper_methods__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helper-methods */ "./helper-methods.ts");
/* harmony import */ var _slice__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./slice */ "./slice.tsx");
const fallbackProps = {
endAngle: 360,
height: 400,
innerRadius: 0,
cornerRadius: 0,
padAngle: 0,
padding: 30,
width: 400,
startAngle: 0,
colorScale: ["#ffffff", "#f0f0f0", "#d9d9d9", "#bdbdbd", "#969696", "#737373", "#525252", "#252525", "#000000"],
labelPosition: "centroid",
labelIndicatorInnerOffset: 15,
labelIndicatorOuterOffset: 5
};
const datumHasXandY = datum => {
return !victory_core__WEBPACK_IMPORTED_MODULE_1__.isNil(datum._x) && !victory_core__WEBPACK_IMPORTED_MODULE_1__.isNil(datum._y);
};
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
class VictoryPieBase extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
static animationWhitelist = ["data", "endAngle", "height", "innerRadius", "cornerRadius", "padAngle", "padding", "colorScale", "startAngle", "style", "width"];
static displayName = "VictoryPie";
static role = "pie";
static defaultTransitions = {
onExit: {
duration: 500,
before: () => ({
_y: 0,
label: " "
})
},
onEnter: {
duration: 500,
before: () => ({
_y: 0,
label: " "
}),
after: datum => ({
y_: datum._y,
label: datum.label
})
}
};
static defaultProps = {
data: [{
x: "A",
y: 1
}, {
x: "B",
y: 2
}, {
x: "C",
y: 3
}, {
x: "D",
y: 1
}, {
x: "E",
y: 2
}],
standalone: true,
dataComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_slice__WEBPACK_IMPORTED_MODULE_2__.Slice, null),
labelComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryLabel, null),
containerComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_4__.VictoryContainer, null),
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("g", null),
sortOrder: "ascending",
theme: victory_core__WEBPACK_IMPORTED_MODULE_5__.VictoryTheme.grayscale
};
static getBaseProps(props) {
return (0,_helper_methods__WEBPACK_IMPORTED_MODULE_6__.getBaseProps)(props, fallbackProps);
}
static getData = victory_core__WEBPACK_IMPORTED_MODULE_7__.getData;
static expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent", "labelIndicatorComponent"];
// Overridden in victory-native
shouldAnimate() {
return Boolean(this.props.animate);
}
renderComponents(props, shouldRenderDatum) {
if (shouldRenderDatum === void 0) {
shouldRenderDatum = datumHasXandY;
}
const {
dataComponent,
labelComponent,
groupComponent,
labelIndicator,
labelPosition
} = props;
if (!groupComponent) {
throw new Error("VictoryPie expects a groupComponent prop");
}
const showIndicator = labelIndicator && labelPosition === "centroid";
const children = [];
if (dataComponent) {
const dataComponents = this.dataKeys.reduce((validDataComponents, _dataKey, index) => {
const dataProps = this.getComponentProps(dataComponent, "data", index);
if (shouldRenderDatum(dataProps.datum)) {
validDataComponents.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(dataComponent, dataProps));
}
return validDataComponents;
}, []);
children.push(...dataComponents);
}
if (labelComponent) {
const labelComponents = this.dataKeys.map((_dataKey, index) => {
const labelProps = this.getComponentProps(labelComponent, "labels", index);
if (labelProps.text !== undefined && labelProps.text !== null) {
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(labelComponent, labelProps);
}
return undefined;
}).filter(comp => comp !== undefined);
children.push(...labelComponents);
}
if (showIndicator && labelIndicator) {
let labelIndicatorComponent = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_8__.LineSegment, null);
if (typeof labelIndicator === "object") {
// pass user provided react component
labelIndicatorComponent = labelIndicator;
}
const labelIndicatorComponents = this.dataKeys.map((_dataKey, index) => {
const labelIndicatorProps = this.getComponentProps(labelIndicatorComponent, "labelIndicators", index);
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(labelIndicatorComponent, labelIndicatorProps);
});
children.push(...labelIndicatorComponents);
}
return this.renderContainer(groupComponent, children);
}
render() {
const {
animationWhitelist,
role
} = VictoryPie;
const props = victory_core__WEBPACK_IMPORTED_MODULE_1__.modifyProps(this.props, fallbackProps, role);
if (this.shouldAnimate()) {
return this.animateComponent(props, animationWhitelist);
}
const children = this.renderComponents(props);
const component = props.standalone ? this.renderContainer(props.containerComponent, children) : children;
return victory_core__WEBPACK_IMPORTED_MODULE_9__.withSafeUserProps(component, props);
}
}
const VictoryPie = (0,victory_core__WEBPACK_IMPORTED_MODULE_10__.addEvents)(VictoryPieBase);
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js":
/*!***********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js ***!
\***********************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var listCacheClear = __webpack_require__(/*! ./_listCacheClear */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js"),
listCacheDelete = __webpack_require__(/*! ./_listCacheDelete */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js"),
listCacheGet = __webpack_require__(/*! ./_listCacheGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js"),
listCacheHas = __webpack_require__(/*! ./_listCacheHas */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js"),
listCacheSet = __webpack_require__(/*! ./_listCacheSet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js");
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
module.exports = ListCache;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js":
/*!***********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js ***!
\***********************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var isArray = __webpack_require__(/*! ./isArray */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js");
/**
* Casts `value` as an array if it's not one.
*
* @static
* @memberOf _
* @since 4.4.0
* @category Lang
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast array.
* @example
*
* _.castArray(1);
* // => [1]
*
* _.castArray({ 'a': 1 });
* // => [{ 'a': 1 }]
*
* _.castArray('abc');
* // => ['abc']
*
* _.castArray(null);
* // => [null]
*
* _.castArray(undefined);
* // => [undefined]
*
* _.castArray();
* // => []
*
* var array = [1, 2, 3];
* console.log(_.castArray(array) === array);
* // => true
*/
function castArray() {
if (!arguments.length) {
return [];
}
var value = arguments[0];
return isArray(value) ? value : [value];
}
module.exports = castArray;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js":
/*!********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js ***!
\********************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var listCacheClear = __webpack_require__(/*! ./_listCacheClear */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js"),
listCacheDelete = __webpack_require__(/*! ./_listCacheDelete */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js"),
listCacheGet = __webpack_require__(/*! ./_listCacheGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js"),
listCacheHas = __webpack_require__(/*! ./_listCacheHas */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js"),
listCacheSet = __webpack_require__(/*! ./_listCacheSet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js");
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
module.exports = ListCache;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js":
/*!*********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js ***!
\*********************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var root = __webpack_require__(/*! ./_root */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js");
/** Built-in value references. */
var Symbol = root.Symbol;
module.exports = Symbol;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js":
/*!********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js ***!
\********************************************************************************/
/***/ (function(module) {
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
module.exports = apply;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayIncludes.js":
/*!****************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayIncludes.js ***!
\****************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var baseIndexOf = __webpack_require__(/*! ./_baseIndexOf */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIndexOf.js");
/**
* A specialized version of `_.includes` for arrays without support for
* specifying an index to search from.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
}
module.exports = arrayIncludes;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayIncludesWith.js":
/*!********************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayIncludesWith.js ***!
\********************************************************************************************/
/***/ (function(module) {
/**
* This function is like `arrayIncludes` except that it accepts a comparator.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @param {Function} comparator The comparator invoked per element.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
module.exports = arrayIncludesWith;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js":
/*!***********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js ***!
\***********************************************************************************/
/***/ (function(module) {
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
module.exports = arrayMap;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayPush.js":
/*!************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayPush.js ***!
\************************************************************************************/
/***/ (function(module) {
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
module.exports = arrayPush;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arraySome.js":
/*!************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arraySome.js ***!
\************************************************************************************/
/***/ (function(module) {
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
module.exports = arraySome;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignValue.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignValue.js ***!
\**************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var baseAssignValue = __webpack_require__(/*! ./_baseAssignValue */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js"),
eq = __webpack_require__(/*! ./eq */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/eq.js");
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))) {
baseAssignValue(object, key, value);
}
}
module.exports = assignValue;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js":
/*!***************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js ***!
\***************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var eq = __webpack_require__(/*! ./eq */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/eq.js");
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
module.exports = assocIndexOf;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js":
/*!******************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js ***!
\******************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var defineProperty = __webpack_require__(/*! ./_defineProperty */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js");
/**
* The base implementation of `assignValue` and `assignMergeValue` without
* value checks.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function baseAssignValue(object, key, value) {
if (key == '__proto__' && defineProperty) {
defineProperty(object, key, {
'configurable': true,
'enumerable': true,
'value': value,
'writable': true
});
} else {
object[key] = value;
}
}
module.exports = baseAssignValue;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseFlatten.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseFlatten.js ***!
\**************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var arrayPush = __webpack_require__(/*! ./_arrayPush */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayPush.js"),
isFlattenable = __webpack_require__(/*! ./_isFlattenable */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isFlattenable.js");
/**
* The base implementation of `_.flatten` with support for restricting flattening.
*
* @private
* @param {Array} array The array to flatten.
* @param {number} depth The maximum recursion depth.
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
* @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
module.exports = baseFlatten;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js":
/*!**********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js ***!
\**********************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var castPath = __webpack_require__(/*! ./_castPath */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js"),
toKey = __webpack_require__(/*! ./_toKey */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toKey.js");
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = castPath(path, object);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
module.exports = baseGet;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js":
/*!*************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js ***!
\*************************************************************************************/
/***/ (function(module) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
module.exports = objectToString;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHasIn.js":
/*!************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHasIn.js ***!
\************************************************************************************/
/***/ (function(module) {
/**
* The base implementation of `_.hasIn` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHasIn(object, key) {
return object != null && key in Object(object);
}
module.exports = baseHasIn;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIndexOf.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIndexOf.js ***!
\**************************************************************************************/
/***/ (function(module) {
/**
* A specialized version of `_.indexOf` which performs strict equality
* comparisons of values, i.e. `===`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
module.exports = strictIndexOf;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqual.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqual.js ***!
\**************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var baseIsEqualDeep = __webpack_require__(/*! ./_baseIsEqualDeep */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqualDeep.js"),
isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isOb