@banyan_cloud/roots 2.0.10 → 2.0.11
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/dist/esm/index.js +24 -18
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -16156,16 +16156,23 @@ var BasePieChart = function BasePieChart(props) {
|
|
|
16156
16156
|
hoverBorderWidth = props.hoverBorderWidth,
|
|
16157
16157
|
dataSetOptions = props.dataSetOptions,
|
|
16158
16158
|
extra = props.extra;
|
|
16159
|
-
var _useState = useState(
|
|
16159
|
+
var _useState = useState(customLabel),
|
|
16160
16160
|
_useState2 = _slicedToArray(_useState, 2),
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
var _useState3 = useState(
|
|
16161
|
+
modCustomLabel = _useState2[0],
|
|
16162
|
+
setModCustomLabel = _useState2[1];
|
|
16163
|
+
var _useState3 = useState([]),
|
|
16164
16164
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
16165
|
-
|
|
16166
|
-
|
|
16165
|
+
excludedIndices = _useState4[0],
|
|
16166
|
+
setExcludedIndices = _useState4[1];
|
|
16167
|
+
var _useState5 = useState(null),
|
|
16168
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
16169
|
+
hoveredIndex = _useState6[0],
|
|
16170
|
+
setHoveredIndex = _useState6[1]; // Track the hovered legend index
|
|
16167
16171
|
var legendRef = useRef(null); // Reference to hold the custom legend
|
|
16168
16172
|
|
|
16173
|
+
useEffect(function () {
|
|
16174
|
+
setModCustomLabel(customLabel);
|
|
16175
|
+
}, [customLabel === null || customLabel === void 0 ? void 0 : customLabel.id]);
|
|
16169
16176
|
if (loading || fallback) {
|
|
16170
16177
|
return /*#__PURE__*/jsx(ChartSkeleton$1, {
|
|
16171
16178
|
theme: theme,
|
|
@@ -16366,7 +16373,7 @@ var BasePieChart = function BasePieChart(props) {
|
|
|
16366
16373
|
var centerTextPlugin = {
|
|
16367
16374
|
id: 'centerText',
|
|
16368
16375
|
afterDatasetsDraw: function afterDatasetsDraw(chart) {
|
|
16369
|
-
var
|
|
16376
|
+
var _modCustomLabel$value, _modCustomLabel$value2, _modCustomLabel$value3, _modCustomLabel$margi, _modCustomLabel$label, _modCustomLabel$label2, _modCustomLabel$label3, _modCustomLabel$label4, _modCustomLabel$label5;
|
|
16370
16377
|
var ctx = chart.ctx,
|
|
16371
16378
|
_chart$chartArea = chart.chartArea,
|
|
16372
16379
|
left = _chart$chartArea.left,
|
|
@@ -16376,32 +16383,32 @@ var BasePieChart = function BasePieChart(props) {
|
|
|
16376
16383
|
ctx.save();
|
|
16377
16384
|
|
|
16378
16385
|
// Center text styling and positioning
|
|
16379
|
-
ctx.font = "".concat(
|
|
16386
|
+
ctx.font = "".concat(modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$value = modCustomLabel.valueStyles) === null || _modCustomLabel$value === void 0 ? void 0 : _modCustomLabel$value.fontStyle, " ").concat(modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$value2 = modCustomLabel.valueStyles) === null || _modCustomLabel$value2 === void 0 ? void 0 : _modCustomLabel$value2.fontSize, " Poppins");
|
|
16380
16387
|
ctx.textAlign = 'center';
|
|
16381
16388
|
ctx.textBaseline = 'middle';
|
|
16382
|
-
ctx.fillStyle =
|
|
16389
|
+
ctx.fillStyle = modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$value3 = modCustomLabel.valueStyles) === null || _modCustomLabel$value3 === void 0 ? void 0 : _modCustomLabel$value3.color;
|
|
16383
16390
|
|
|
16384
16391
|
// Calculate the center position of the chart
|
|
16385
16392
|
var centerX = (left + right) / 2;
|
|
16386
16393
|
var centerY = (top + bottom) / 2;
|
|
16387
16394
|
|
|
16388
16395
|
// Render the center text
|
|
16389
|
-
ctx.fillText("".concat(
|
|
16396
|
+
ctx.fillText("".concat(modCustomLabel === null || modCustomLabel === void 0 ? void 0 : modCustomLabel.id), centerX, centerY);
|
|
16390
16397
|
|
|
16391
16398
|
// Render the compliance title with bottom margin
|
|
16392
|
-
var titleBottomMargin = (
|
|
16393
|
-
var position = (
|
|
16399
|
+
var titleBottomMargin = (_modCustomLabel$margi = modCustomLabel.margin) !== null && _modCustomLabel$margi !== void 0 ? _modCustomLabel$margi : 10; // Adjust this value for bottom margin
|
|
16400
|
+
var position = (_modCustomLabel$label = modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$label2 = modCustomLabel.labelStyles) === null || _modCustomLabel$label2 === void 0 ? void 0 : _modCustomLabel$label2.position) !== null && _modCustomLabel$label !== void 0 ? _modCustomLabel$label : 5;
|
|
16394
16401
|
var titleYPosition = centerY + position; // Default title Y position
|
|
16395
|
-
ctx.font = "".concat(
|
|
16396
|
-
ctx.fillStyle = "".concat(
|
|
16397
|
-
ctx.fillText("".concat(
|
|
16402
|
+
ctx.font = "".concat(modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$label3 = modCustomLabel.labelStyles) === null || _modCustomLabel$label3 === void 0 ? void 0 : _modCustomLabel$label3.fontStyle, " ").concat(modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$label4 = modCustomLabel.labelStyles) === null || _modCustomLabel$label4 === void 0 ? void 0 : _modCustomLabel$label4.fontSize, " Poppins"); // Title font style
|
|
16403
|
+
ctx.fillStyle = "".concat(modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$label5 = modCustomLabel.labelStyles) === null || _modCustomLabel$label5 === void 0 ? void 0 : _modCustomLabel$label5.color); // Title text color (gray)
|
|
16404
|
+
ctx.fillText("".concat(modCustomLabel === null || modCustomLabel === void 0 ? void 0 : modCustomLabel.title), centerX, titleYPosition + titleBottomMargin);
|
|
16398
16405
|
|
|
16399
16406
|
// Render compliance strip if `complianceStrip` is true
|
|
16400
16407
|
if (strip) {
|
|
16401
16408
|
var _strip$stripSize, _strip$stripWidth, _strip$startColor, _strip$endColor;
|
|
16402
16409
|
var stripRadius = (_strip$stripSize = strip === null || strip === void 0 ? void 0 : strip.stripSize) !== null && _strip$stripSize !== void 0 ? _strip$stripSize : 35; // Radius for the outer ring
|
|
16403
16410
|
var stripThickness = (_strip$stripWidth = strip === null || strip === void 0 ? void 0 : strip.stripWidth) !== null && _strip$stripWidth !== void 0 ? _strip$stripWidth : 7; // Thickness of the strip
|
|
16404
|
-
var compliancePercentage =
|
|
16411
|
+
var compliancePercentage = modCustomLabel === null || modCustomLabel === void 0 ? void 0 : modCustomLabel.value; // Set compliance percentage
|
|
16405
16412
|
|
|
16406
16413
|
// Fixed start and end angles
|
|
16407
16414
|
var startAngle = 130 * Math.PI / 180; // Convert degrees to radians
|
|
@@ -16452,7 +16459,6 @@ var BasePieChart = function BasePieChart(props) {
|
|
|
16452
16459
|
// Return the first color stop as fallback
|
|
16453
16460
|
return (colorStops === null || colorStops === void 0 ? void 0 : colorStops[0]) || '#000'; // Fallback to black
|
|
16454
16461
|
}) : [];
|
|
16455
|
-
console.log(legendColors);
|
|
16456
16462
|
var customLegendPlugin = {
|
|
16457
16463
|
id: 'customLegend',
|
|
16458
16464
|
afterUpdate: function afterUpdate(chart) {
|
|
@@ -16515,7 +16521,7 @@ var BasePieChart = function BasePieChart(props) {
|
|
|
16515
16521
|
children: [/*#__PURE__*/jsx(Pie, _objectSpread2({
|
|
16516
16522
|
data: data,
|
|
16517
16523
|
options: _objectSpread2({}, options),
|
|
16518
|
-
plugins: [
|
|
16524
|
+
plugins: [modCustomLabel && centerTextPlugin, (legend === null || legend === void 0 ? void 0 : legend.icon) && (legend === null || legend === void 0 ? void 0 : legend.display) && customLegendPlugin].filter(Boolean)
|
|
16519
16525
|
}, extra)), (legend === null || legend === void 0 ? void 0 : legend.icon) && (legend === null || legend === void 0 ? void 0 : legend.display) && /*#__PURE__*/jsx("ul", {
|
|
16520
16526
|
style: _objectSpread2({}, legend === null || legend === void 0 ? void 0 : legend.legendStyles),
|
|
16521
16527
|
ref: legendRef
|