oolib 2.203.0 → 2.203.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,6 +25,7 @@ var getAllOptionsFns_1 = require("./getAllOptionsFns");
|
|
|
25
25
|
// }
|
|
26
26
|
var getValue_SINGLE = function (_a) {
|
|
27
27
|
var _b;
|
|
28
|
+
var _c;
|
|
28
29
|
var valueProp = _a.valueProp, optionsFn = _a.optionsFn, options = _a.options, theme = _a.theme, saveValueAsString = _a.saveValueAsString;
|
|
29
30
|
if (!saveValueAsString)
|
|
30
31
|
return valueProp;
|
|
@@ -33,7 +34,7 @@ var getValue_SINGLE = function (_a) {
|
|
|
33
34
|
// For grouped data, search through all options in all groups
|
|
34
35
|
for (var _i = 0, allOptions_1 = allOptions; _i < allOptions_1.length; _i++) {
|
|
35
36
|
var group = allOptions_1[_i];
|
|
36
|
-
var found = group.options.find(function (d) { return d.value === valueProp; });
|
|
37
|
+
var found = (_c = group.options) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.value === valueProp; });
|
|
37
38
|
if (found)
|
|
38
39
|
return found;
|
|
39
40
|
}
|
|
@@ -41,7 +42,7 @@ var getValue_SINGLE = function (_a) {
|
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
43
44
|
// For normal data, search directly
|
|
44
|
-
return allOptions.find(function (d) { return d.value === valueProp; });
|
|
45
|
+
return allOptions === null || allOptions === void 0 ? void 0 : allOptions.find(function (d) { return d.value === valueProp; });
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
48
|
exports.getValue_SINGLE = getValue_SINGLE;
|
|
@@ -55,9 +56,10 @@ var getValue_MULTI = function (_a) {
|
|
|
55
56
|
if ((0, List_1.isGroupedData)(allOptions)) {
|
|
56
57
|
// For grouped data, map each value and search through all options in all groups
|
|
57
58
|
return valueProp.map(function (vProp) {
|
|
59
|
+
var _a;
|
|
58
60
|
for (var _i = 0, allOptions_2 = allOptions; _i < allOptions_2.length; _i++) {
|
|
59
61
|
var group = allOptions_2[_i];
|
|
60
|
-
var found = group.options.find(function (d) { return d.value === vProp; });
|
|
62
|
+
var found = (_a = group.options) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.value === vProp; });
|
|
61
63
|
if (found)
|
|
62
64
|
return found;
|
|
63
65
|
}
|
|
@@ -67,7 +69,7 @@ var getValue_MULTI = function (_a) {
|
|
|
67
69
|
else {
|
|
68
70
|
// For normal data, map directly
|
|
69
71
|
return valueProp.map(function (vProp) {
|
|
70
|
-
return allOptions.find(function (d) { return d.value === vProp; });
|
|
72
|
+
return allOptions === null || allOptions === void 0 ? void 0 : allOptions.find(function (d) { return d.value === vProp; });
|
|
71
73
|
}).filter(Boolean); // Remove any undefined values
|
|
72
74
|
}
|
|
73
75
|
};
|
|
@@ -118,6 +118,7 @@ var BarGraph = function (_a) {
|
|
|
118
118
|
var tagCategory = _a.tagCategory, index1 = _a.index1, _c = _a.showCount, showCount = _c === void 0 ? true : _c, _d = _a.showPercent, showPercent = _d === void 0 ? true : _d, onClick = _a.onClick, debug = _a.debug;
|
|
119
119
|
var containerRef = (0, react_1.useRef)();
|
|
120
120
|
var _e = (0, BarChart_1.useTrackMousePosition)({ containerRef: containerRef }), mousePosition = _e.mousePosition, isHovering = _e.isHovering;
|
|
121
|
+
var _f = (0, react_1.useState)(null), hoveredBarIndex = _f[0], setHoveredBarIndex = _f[1];
|
|
121
122
|
var truncateText = function (text, maxLength) {
|
|
122
123
|
if (maxLength === void 0) { maxLength = 30; }
|
|
123
124
|
if (!text)
|
|
@@ -127,10 +128,10 @@ var BarGraph = function (_a) {
|
|
|
127
128
|
return text.slice(0, maxLength) + '...';
|
|
128
129
|
};
|
|
129
130
|
var handleBarMouseEnter = function (index) {
|
|
130
|
-
|
|
131
|
+
setHoveredBarIndex(index);
|
|
131
132
|
};
|
|
132
133
|
var handleBarMouseLeave = function () {
|
|
133
|
-
|
|
134
|
+
setHoveredBarIndex(null);
|
|
134
135
|
};
|
|
135
136
|
var handleBarClick = function (tag) {
|
|
136
137
|
if (onClick) {
|
|
@@ -146,6 +147,7 @@ var BarGraph = function (_a) {
|
|
|
146
147
|
count: showCount ? tag.count : undefined,
|
|
147
148
|
tooltipLabel: tag.display
|
|
148
149
|
}];
|
|
150
|
+
var isHovered = isHovering && hoveredBarIndex === index;
|
|
149
151
|
return (react_1.default.createElement("div", { key: tag._id || "".concat(index1, "-").concat(index), onMouseEnter: function () { return handleBarMouseEnter(index); }, onMouseLeave: handleBarMouseLeave, onClick: function () { return handleBarClick(tag); }, style: { cursor: onClick ? 'pointer' : 'default' } },
|
|
150
152
|
react_1.default.createElement(styled_1.StyledSingleBarWrapper, { barSections: tag.barSections, debug: debug },
|
|
151
153
|
react_1.default.createElement(styled_1.StyledBar, { style: {
|
|
@@ -154,7 +156,7 @@ var BarGraph = function (_a) {
|
|
|
154
156
|
} }),
|
|
155
157
|
react_1.default.createElement(styled_1.StyledLabelWrapper, null,
|
|
156
158
|
react_1.default.createElement(__2.UI_BODY_SM, null, truncateText(tag === null || tag === void 0 ? void 0 : tag.display, 30))),
|
|
157
|
-
|
|
159
|
+
isHovered && mousePosition && (react_1.default.createElement(CustomTooltip_1.default, { active: true, payload: [tag], mousePosition: mousePosition, value: tooltipData, showPercent: showPercent })))));
|
|
158
160
|
})));
|
|
159
161
|
};
|
|
160
162
|
exports.BarGraph = BarGraph;
|