oolib 2.197.0 → 2.197.1
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.
|
@@ -29,5 +29,8 @@ export interface BarChartProps {
|
|
|
29
29
|
summarizeAfterIdx?: number;
|
|
30
30
|
style?: React.CSSProperties;
|
|
31
31
|
}
|
|
32
|
+
export declare const FadeGradientWhenScroll: ({ style }: {
|
|
33
|
+
style?: {};
|
|
34
|
+
}) => React.JSX.Element;
|
|
32
35
|
export declare const BarChart: React.FC<BarChartProps>;
|
|
33
36
|
export {};
|
|
@@ -47,7 +47,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
47
47
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.BarChart = exports.useTrackMousePosition = void 0;
|
|
50
|
+
exports.BarChart = exports.FadeGradientWhenScroll = exports.useTrackMousePosition = void 0;
|
|
51
51
|
var react_1 = __importStar(require("react"));
|
|
52
52
|
var recharts_1 = require("recharts");
|
|
53
53
|
var CustomizedLabel_1 = require("./comps/CustomizedLabel");
|
|
@@ -303,6 +303,7 @@ var FadeGradientWhenScroll = function (_a) {
|
|
|
303
303
|
var _b = _a.style, style = _b === void 0 ? {} : _b;
|
|
304
304
|
return (react_1.default.createElement("div", { style: __assign({ width: '100%', height: '40px', position: 'sticky', left: 0, bottom: 0, background: "linear-gradient(to top, ".concat(__1.colors2.white, ", hsla(0, 0%, 100%, 0))") }, style) }));
|
|
305
305
|
};
|
|
306
|
+
exports.FadeGradientWhenScroll = FadeGradientWhenScroll;
|
|
306
307
|
var BarChart = function (_a) {
|
|
307
308
|
var _data = _a.data, valuePath = _a.valuePath, _b = _a.style, style = _b === void 0 ? {} : _b, tooltipLabelsMapping = _a.tooltipLabelsMapping, tooltipLabelsPath = _a.tooltipLabelsPath, breakdownCategoryName = _a.breakdownCategoryName, // basically, if lets say tagCat1 is broken down by tagCat2. then tagCat2's display would be this property
|
|
308
309
|
_c = _a.labelPath, // basically, if lets say tagCat1 is broken down by tagCat2. then tagCat2's display would be this property
|
|
@@ -334,9 +335,9 @@ var BarChart = function (_a) {
|
|
|
334
335
|
isBreakdown: true,
|
|
335
336
|
breakdownDisplayType: "stacked",
|
|
336
337
|
showSumOfBreakdownValues: true, showPercent: showPercent, showCount: showCount, activeBar: activeBar, setActiveBar: setActiveBar, onClick: onClick, mousePosition: mousePosition, dataMaxValue: dataMaxValue, breakdownCategoryName: breakdownCategoryName })),
|
|
337
|
-
orientation === 'vertical' && react_1.default.createElement(FadeGradientWhenScroll, null)),
|
|
338
|
+
orientation === 'vertical' && react_1.default.createElement(exports.FadeGradientWhenScroll, null)),
|
|
338
339
|
isBreakdown && react_1.default.createElement("div", { style: __assign({ position: 'sticky' }, (orientation === 'vertical' ? { top: 0 } : { bottom: 0, background: __1.colors2.white })) },
|
|
339
|
-
orientation === 'horizontal' && react_1.default.createElement(FadeGradientWhenScroll, { style: { transform: 'translateY(-100%)', top: 0, bottom: 'unset', position: 'absolute', } }),
|
|
340
|
+
orientation === 'horizontal' && react_1.default.createElement(exports.FadeGradientWhenScroll, { style: { transform: 'translateY(-100%)', top: 0, bottom: 'unset', position: 'absolute', } }),
|
|
340
341
|
react_1.default.createElement(Legend_1.Legend, { orientation: orientation, label: breakdownCategoryName, data: data[0].map(function (d) { return ({
|
|
341
342
|
text: d.labels.tooltipLabel,
|
|
342
343
|
color: d.labels.barColor
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
2
6
|
var __assign = (this && this.__assign) || function () {
|
|
3
7
|
__assign = Object.assign || function(t) {
|
|
4
8
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -54,6 +58,7 @@ var Typo2_1 = require("../../Typo2");
|
|
|
54
58
|
var CustomTooltip_1 = __importDefault(require("../BarChart/comps/CustomTooltip"));
|
|
55
59
|
var usePrepareData_1 = require("../utils/usePrepareData");
|
|
56
60
|
var __1 = require("../../../..");
|
|
61
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
57
62
|
/**
|
|
58
63
|
* Maps a value from an input range to a color
|
|
59
64
|
* with the base color at the center point of the range
|
|
@@ -116,8 +121,8 @@ function hslToHex(h, s, l) {
|
|
|
116
121
|
var _configs = {
|
|
117
122
|
gridGap: 2,
|
|
118
123
|
cellRoundness: 4,
|
|
119
|
-
cellSize:
|
|
120
|
-
axisLabelWidth:
|
|
124
|
+
cellSize: 40,
|
|
125
|
+
axisLabelWidth: 150
|
|
121
126
|
};
|
|
122
127
|
var HeatMapCell = function (_a) {
|
|
123
128
|
var value = _a.value, dataMaxValue = _a.dataMaxValue, _b = _a.dataMinValue, dataMinValue = _b === void 0 ? 0 : _b, showPercent = _a.showPercent;
|
|
@@ -146,6 +151,11 @@ var HeatMapCell = function (_a) {
|
|
|
146
151
|
} },
|
|
147
152
|
react_1.default.createElement(Typo2_1.UI_CAPTION_SEMIBOLD_DF, { style: { color: textColor } }, value.labels.count))));
|
|
148
153
|
};
|
|
154
|
+
var STYLED_UI_CAPTION_SEMIBOLD_DF = (0, styled_components_1.default)(Typo2_1.UI_CAPTION_SEMIBOLD_DF)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n\n"], ["\n ", "\n\n"
|
|
155
|
+
/**
|
|
156
|
+
* expects exactly the same data structure as barcharts - breakdown version
|
|
157
|
+
*/
|
|
158
|
+
])), (0, __1.clampText)(2));
|
|
149
159
|
/**
|
|
150
160
|
* expects exactly the same data structure as barcharts - breakdown version
|
|
151
161
|
*/
|
|
@@ -161,76 +171,105 @@ var HeatMapGrid = function (_a) {
|
|
|
161
171
|
showPercent: showPercent,
|
|
162
172
|
summarizeAfterIdx: summarizeAfterIdx,
|
|
163
173
|
}), data = _h.data, dataMaxValue = _h.dataMaxValue, dataToSummarize = _h.dataToSummarize;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
overflow: "hidden",
|
|
184
|
-
wordBreak: "break-word",
|
|
185
|
-
} }, d[0].labels.name.length > 50 ? d[0].labels.name.substring(0, 50) + "..." : d[0].labels.name))); })),
|
|
174
|
+
var vizRef = (0, react_1.useRef)(null);
|
|
175
|
+
var wrapperRef = (0, react_1.useRef)(null);
|
|
176
|
+
var setFader = function () {
|
|
177
|
+
var _a, _b, _c, _d;
|
|
178
|
+
if (vizRef.current && wrapperRef.current && ((_b = (_a = vizRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.bottom) > ((_d = (_c = wrapperRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect()) === null || _d === void 0 ? void 0 : _d.bottom)) {
|
|
179
|
+
if (!showFader) {
|
|
180
|
+
setShowFader(true);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
setShowFader(false);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
var _j = (0, react_1.useState)(false), showFader = _j[0], setShowFader = _j[1];
|
|
188
|
+
(0, react_1.useEffect)(function () {
|
|
189
|
+
setFader();
|
|
190
|
+
}, []);
|
|
191
|
+
(0, __1.useScroll)(setFader);
|
|
192
|
+
return (react_1.default.createElement("div", { ref: wrapperRef, style: __assign({ position: 'relative' }, style) },
|
|
186
193
|
react_1.default.createElement("div", { style: {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
194
|
+
position: 'relative',
|
|
195
|
+
display: "grid",
|
|
196
|
+
gridTemplateColumns: "auto 1fr",
|
|
197
|
+
gap: _configs.gridGap + 'px',
|
|
198
|
+
overflow: "auto",
|
|
199
|
+
alignItems: "end",
|
|
200
|
+
height: '100%'
|
|
191
201
|
} },
|
|
192
202
|
react_1.default.createElement("div", { style: {
|
|
193
203
|
display: "flex",
|
|
194
|
-
|
|
204
|
+
flexDirection: "column",
|
|
195
205
|
gap: _configs.gridGap + "px",
|
|
196
|
-
} }, data[0].map(function (dd) { return (react_1.default.createElement("div", { style: {
|
|
197
|
-
width: _configs.cellSize + "px",
|
|
198
|
-
height: _configs.axisLabelWidth + "px",
|
|
199
|
-
display: "flex",
|
|
200
|
-
alignItems: "flex-end",
|
|
201
|
-
textWrap: "nowrap",
|
|
202
|
-
justifyContent: 'center',
|
|
203
|
-
position: "relative",
|
|
204
|
-
overflow: "visible",
|
|
205
|
-
flexShrink: 0,
|
|
206
206
|
} },
|
|
207
|
-
react_1.default.createElement(
|
|
208
|
-
|
|
209
|
-
height: "
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
data.map(function (d) { return (react_1.default.createElement("div", { style: {
|
|
207
|
+
react_1.default.createElement("div", { style: { height: _configs.axisLabelWidth + "px" } }),
|
|
208
|
+
data.map(function (d) { return (react_1.default.createElement("div", { style: {
|
|
209
|
+
height: _configs.cellSize + "px",
|
|
210
|
+
textAlign: "right",
|
|
211
|
+
display: "flex",
|
|
212
|
+
alignItems: "center",
|
|
213
|
+
justifyContent: "flex-end",
|
|
214
|
+
} },
|
|
215
|
+
react_1.default.createElement(STYLED_UI_CAPTION_SEMIBOLD_DF, { style: {
|
|
216
|
+
// width: "fit-content",
|
|
217
|
+
maxWidth: _configs.axisLabelWidth + "px",
|
|
218
|
+
// maxHeight: "2.4em",
|
|
219
|
+
// lineHeight: "1.2em",
|
|
220
|
+
// overflow: "hidden",
|
|
221
|
+
// wordBreak: "break-word",
|
|
222
|
+
} }, d[0].labels.name.length > 50 ? d[0].labels.name.substring(0, 50) + "..." : d[0].labels.name))); })),
|
|
223
|
+
react_1.default.createElement("div", { ref: vizRef, style: {
|
|
225
224
|
display: "flex",
|
|
226
|
-
|
|
225
|
+
flexDirection: "column",
|
|
227
226
|
gap: _configs.gridGap + "px",
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
227
|
+
overflowX: "auto", //horizontal scroll
|
|
228
|
+
position: 'relative'
|
|
229
|
+
} },
|
|
230
|
+
react_1.default.createElement("div", { style: {
|
|
231
|
+
display: "flex",
|
|
232
|
+
alignItems: "center",
|
|
233
|
+
gap: _configs.gridGap + "px",
|
|
234
|
+
} }, data[0].map(function (dd) { return (react_1.default.createElement("div", { style: {
|
|
235
|
+
width: _configs.cellSize + "px",
|
|
236
|
+
height: _configs.axisLabelWidth + "px",
|
|
237
|
+
display: "flex",
|
|
238
|
+
alignItems: "flex-end",
|
|
239
|
+
textWrap: "nowrap",
|
|
240
|
+
justifyContent: 'center',
|
|
241
|
+
position: "relative",
|
|
242
|
+
overflow: "visible",
|
|
243
|
+
flexShrink: 0,
|
|
244
|
+
} },
|
|
245
|
+
react_1.default.createElement(STYLED_UI_CAPTION_SEMIBOLD_DF, { style: {
|
|
246
|
+
width: _configs.axisLabelWidth + "px",
|
|
247
|
+
position: "absolute", // Add this
|
|
248
|
+
bottom: 0, // which is half of the line height of the current text
|
|
249
|
+
left: '50%', // Center horizontally
|
|
250
|
+
transformOrigin: "left bottom", // Change origin to bottom
|
|
251
|
+
transform: "rotate(-90deg) translateY(50%)", // Adjust transform
|
|
252
|
+
// Multi-line
|
|
253
|
+
whiteSpace: "normal",
|
|
254
|
+
// overflow: "hidden",
|
|
255
|
+
// display: "-webkit-box",
|
|
256
|
+
// WebkitBoxOrient: "vertical",
|
|
257
|
+
// WebkitLineClamp: 2,
|
|
258
|
+
// textOverflow: "ellipsis",
|
|
259
|
+
// lineHeight: "16px",
|
|
260
|
+
} }, dd.labels.tooltipLabel))); })),
|
|
261
|
+
data.map(function (d) { return (react_1.default.createElement("div", { style: {
|
|
262
|
+
display: "flex",
|
|
263
|
+
alignItems: "center",
|
|
264
|
+
gap: _configs.gridGap + "px",
|
|
265
|
+
// flexShrink: 0,
|
|
266
|
+
} }, d.map(function (dd) {
|
|
267
|
+
// console.log({
|
|
268
|
+
// color: mapValueToColor(dd.labels.count, 0, dataMaxValue),
|
|
269
|
+
// });
|
|
270
|
+
return react_1.default.createElement(HeatMapCell, { showPercent: false, dataMaxValue: dataMaxValue, value: dd });
|
|
271
|
+
}))); }))),
|
|
272
|
+
showFader && react_1.default.createElement(BarChart_1.FadeGradientWhenScroll, { style: { position: 'absolute', bottom: 0, left: 0 } })));
|
|
235
273
|
};
|
|
236
274
|
exports.HeatMapGrid = HeatMapGrid;
|
|
275
|
+
var templateObject_1;
|