@hestia-earth/ui-components 0.41.27 → 0.41.28

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.
@@ -5654,7 +5654,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
5654
5654
  // show label 8px from bar
5655
5655
  const gapX = 8;
5656
5656
  const placementGap = (placement) => (placement === 'right' ? +gapX : -gapX);
5657
- const placementX = (x, chart, data, placement) => placement === 'right' ? (data < 0 ? positionAtZero(chart) : x) : x;
5657
+ const placementX = (x, chart, data, placement) => placement === 'right' ? (Array.isArray(data) || data < 0 ? positionAtZero(chart) : x) : x;
5658
5658
  const positionAtZero = (chart) => chart.scales.x.getPixelForValue(0);
5659
5659
  const defaultBarDrawSettings = {
5660
5660
  placement: 'right',
@@ -6012,9 +6012,9 @@ const lollipopChartPlugin = settings => ({
6012
6012
  clickableDictionary.push((clientX, clientY) => isMouseInsideCircle({ clientX, clientY }, { x: xValue, y }, circleRadius));
6013
6013
  circle(ctx, xValue, y, color, circleRadius);
6014
6014
  // draw the line between the 2 cricles if necessary
6015
- Array.isArray(data) && lineWidth && line(ctx, base, x, y, color, lineWidth);
6015
+ [Array.isArray(data), !!lineWidth].every(Boolean) && line(ctx, base, x, y, color, lineWidth);
6016
6016
  // when drawing from the data, draw both ends if its an array
6017
- if (xValue === null) {
6017
+ if (isUndefined(overrideValue)) {
6018
6018
  clickableDictionary.push((clientX, clientY) => isMouseInsideCircle({ clientX, clientY }, { x: base, y }, circleRadius));
6019
6019
  Array.isArray(data) && circle(ctx, base, y, color, circleRadius);
6020
6020
  }
@@ -6121,11 +6121,12 @@ const convertToSvg = (config, metadata = {}) => new Promise((resolve, reject) =>
6121
6121
  // 4. Register Export-Specific Plugins
6122
6122
  chartConfig.plugins = [
6123
6123
  afterBarDrawPlugin({
6124
- textFn: ({ data }) => [toPrecision(data), metadata.units].filter(Boolean).join(' '),
6125
- emptyValueLabel: 'No data'
6124
+ textFn: ({ data }) => [toPrecision(Array.isArray(data) ? data[0] : data), metadata.units].filter(Boolean).join(' '),
6125
+ emptyValueLabel: 'No data',
6126
+ ...(metadata?.afterBarDrawConfig || {})
6126
6127
  }),
6127
6128
  metadata.lollipopConfig ? lollipopChartPlugin(metadata.lollipopConfig) : null
6128
- ].filter((p) => Boolean(p));
6129
+ ].filter(Boolean);
6129
6130
  chart = new Chart(mockCanvas, chartConfig);
6130
6131
  });
6131
6132
  const exportAsSVG = async (config, metadata) => {
@@ -6523,12 +6524,12 @@ class ChartTooltipComponent {
6523
6524
  this.tooltipX = signal(0, ...(ngDevMode ? [{ debugName: "tooltipX" }] : []));
6524
6525
  this.tooltipY = signal(0, ...(ngDevMode ? [{ debugName: "tooltipY" }] : []));
6525
6526
  }
6526
- show(data, x, y, options = { placement: 'bottom' }) {
6527
+ show(data, x, y, options = {}) {
6527
6528
  this.tooltipX.set(x);
6528
6529
  this.tooltipY.set(y);
6529
6530
  const text = this.tooltipFn()(data);
6530
6531
  this.tooltip().container = options?.container;
6531
- this.tooltip().placement = options?.placement;
6532
+ this.tooltip().placement = options?.placement || 'bottom';
6532
6533
  text && setTimeout(() => this.tooltip().open({ data: text }));
6533
6534
  }
6534
6535
  hide() {