@carto/ps-react-ui 4.24.0 → 4.26.0
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/{actions-B1ss030_.js → actions-DXfQMrll.js} +56 -46
- package/dist/actions-DXfQMrll.js.map +1 -0
- package/dist/category-DuKx_CJX.js +933 -0
- package/dist/category-DuKx_CJX.js.map +1 -0
- package/dist/item-color-C1cu6EJd.js +20 -0
- package/dist/item-color-C1cu6EJd.js.map +1 -0
- package/dist/types/widgets-v2/bar/types.d.ts +6 -0
- package/dist/types/widgets-v2/category/category-ui.d.ts +10 -2
- package/dist/types/widgets-v2/category/category.d.ts +7 -1
- package/dist/types/widgets-v2/category/components/category-bar-stacked.d.ts +8 -1
- package/dist/types/widgets-v2/category/components/category-bar.d.ts +24 -2
- package/dist/types/widgets-v2/category/components/category-row-multi.d.ts +3 -1
- package/dist/types/widgets-v2/category/components/category-row-single.d.ts +3 -1
- package/dist/types/widgets-v2/category/components/category-row-stacked.d.ts +10 -1
- package/dist/types/widgets-v2/category/style.d.ts +33 -6
- package/dist/types/widgets-v2/histogram/bins.d.ts +7 -0
- package/dist/types/widgets-v2/histogram/download.d.ts +2 -2
- package/dist/types/widgets-v2/histogram/index.d.ts +2 -1
- package/dist/types/widgets-v2/histogram/options.d.ts +1 -1
- package/dist/types/widgets-v2/histogram/transforms.d.ts +5 -4
- package/dist/types/widgets-v2/histogram/types.d.ts +22 -5
- package/dist/types/widgets-v2/index.d.ts +1 -1
- package/dist/types/widgets-v2/pie/types.d.ts +6 -0
- package/dist/types/widgets-v2/scatterplot/download.d.ts +2 -2
- package/dist/types/widgets-v2/scatterplot/index.d.ts +2 -1
- package/dist/types/widgets-v2/scatterplot/points.d.ts +7 -0
- package/dist/types/widgets-v2/scatterplot/transforms.d.ts +4 -3
- package/dist/types/widgets-v2/scatterplot/types.d.ts +21 -2
- package/dist/types/widgets-v2/timeseries/types.d.ts +6 -0
- package/dist/types/widgets-v2/utils/item-color.d.ts +26 -0
- package/dist/widgets-v2/actions.js +1 -1
- package/dist/widgets-v2/bar.js +66 -57
- package/dist/widgets-v2/bar.js.map +1 -1
- package/dist/widgets-v2/category.js +1 -1
- package/dist/widgets-v2/histogram.js +103 -71
- package/dist/widgets-v2/histogram.js.map +1 -1
- package/dist/widgets-v2/pie.js +98 -78
- package/dist/widgets-v2/pie.js.map +1 -1
- package/dist/widgets-v2/scatterplot.js +119 -79
- package/dist/widgets-v2/scatterplot.js.map +1 -1
- package/dist/widgets-v2/timeseries.js +70 -61
- package/dist/widgets-v2/timeseries.js.map +1 -1
- package/dist/widgets-v2.js +2 -2
- package/dist/widgets-v2.js.map +1 -1
- package/package.json +3 -3
- package/src/widgets-v2/actions/fullscreen/fullscreen-store.test.tsx +77 -13
- package/src/widgets-v2/actions/fullscreen/fullscreen.tsx +48 -5
- package/src/widgets-v2/bar/options.test.ts +106 -0
- package/src/widgets-v2/bar/options.ts +25 -14
- package/src/widgets-v2/bar/types.ts +6 -0
- package/src/widgets-v2/category/category-ui.test.tsx +139 -0
- package/src/widgets-v2/category/category-ui.tsx +64 -11
- package/src/widgets-v2/category/category.test.tsx +67 -0
- package/src/widgets-v2/category/category.tsx +32 -15
- package/src/widgets-v2/category/components/category-bar-stacked.test.tsx +18 -0
- package/src/widgets-v2/category/components/category-bar-stacked.tsx +42 -29
- package/src/widgets-v2/category/components/category-bar.test.tsx +66 -0
- package/src/widgets-v2/category/components/category-bar.tsx +65 -9
- package/src/widgets-v2/category/components/category-row-multi.tsx +21 -0
- package/src/widgets-v2/category/components/category-row-single.tsx +4 -0
- package/src/widgets-v2/category/components/category-row-stacked.tsx +24 -1
- package/src/widgets-v2/category/style.ts +58 -14
- package/src/widgets-v2/histogram/bins.ts +22 -0
- package/src/widgets-v2/histogram/download.test.ts +10 -0
- package/src/widgets-v2/histogram/download.ts +7 -3
- package/src/widgets-v2/histogram/index.ts +3 -0
- package/src/widgets-v2/histogram/options.test.ts +62 -0
- package/src/widgets-v2/histogram/options.ts +38 -17
- package/src/widgets-v2/histogram/transforms.test.ts +21 -7
- package/src/widgets-v2/histogram/transforms.ts +26 -12
- package/src/widgets-v2/histogram/types.ts +25 -5
- package/src/widgets-v2/index.ts +6 -1
- package/src/widgets-v2/pie/options.test.ts +91 -0
- package/src/widgets-v2/pie/options.ts +50 -20
- package/src/widgets-v2/pie/types.ts +6 -0
- package/src/widgets-v2/scatterplot/download.test.ts +9 -0
- package/src/widgets-v2/scatterplot/download.ts +5 -3
- package/src/widgets-v2/scatterplot/index.ts +3 -0
- package/src/widgets-v2/scatterplot/options.test.ts +78 -0
- package/src/widgets-v2/scatterplot/options.ts +35 -11
- package/src/widgets-v2/scatterplot/points.ts +35 -0
- package/src/widgets-v2/scatterplot/transforms.test.ts +19 -0
- package/src/widgets-v2/scatterplot/transforms.ts +23 -18
- package/src/widgets-v2/scatterplot/types.ts +25 -2
- package/src/widgets-v2/timeseries/options.test.ts +65 -0
- package/src/widgets-v2/timeseries/options.ts +32 -17
- package/src/widgets-v2/timeseries/types.ts +6 -0
- package/src/widgets-v2/utils/item-color.test.ts +74 -0
- package/src/widgets-v2/utils/item-color.ts +55 -0
- package/dist/actions-B1ss030_.js.map +0 -1
- package/dist/category-Ca5XDx0N.js +0 -839
- package/dist/category-Ca5XDx0N.js.map +0 -1
|
@@ -2,4 +2,5 @@ export { histogramOptions, createHistogramOptionFactory } from './options.js';
|
|
|
2
2
|
export { HistogramSkeleton, type HistogramSkeletonProps } from './skeleton.js';
|
|
3
3
|
export { createHistogramDownloadConfig } from './download.js';
|
|
4
4
|
export { toRelativeHistogramData, filterHistogramByLockedBins, } from './transforms.js';
|
|
5
|
-
export
|
|
5
|
+
export { getHistogramBinValue } from './bins.js';
|
|
6
|
+
export type { HistogramBin, HistogramBinObject, HistogramWidgetData, HistogramOptionsInput, HistogramOptionFactoryInput, HistogramEChartsOption, } from './types.js';
|
|
@@ -31,7 +31,7 @@ export declare function histogramOptions({ theme, formatter, }: HistogramOptions
|
|
|
31
31
|
* the consumer-supplied `optionsOverride`. Called once by Provider to
|
|
32
32
|
* seed `rawOptions` in the store.
|
|
33
33
|
* - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`
|
|
34
|
-
* (`HistogramWidgetData` — `
|
|
34
|
+
* (`HistogramWidgetData` — `HistogramBin[][]`) into the option via the
|
|
35
35
|
* dataset API. Each series gets its own dataset of `[binLabel, count]`
|
|
36
36
|
* pairs derived from `ticks`; series reference their dataset by
|
|
37
37
|
* `datasetIndex` and are encoded by column position. Reactive
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Histogram-specific `RelativeData` transform. Histogram data is
|
|
3
|
-
* `
|
|
3
|
+
* `HistogramBin[][]` — each series is a flat list of bin counts (plain
|
|
4
|
+
* numbers or `{ value, color? }`, whose shape is kept). This
|
|
4
5
|
* rewrites each count to its share of the series total (0–100), so
|
|
5
6
|
* pairing with `createPercentFormatter` renders the y-axis as
|
|
6
7
|
* percentages.
|
|
@@ -11,13 +12,13 @@
|
|
|
11
12
|
* inputs produce sane signed shares-of-magnitude. A series whose total
|
|
12
13
|
* magnitude is zero (all-zero or empty input) is returned unchanged so
|
|
13
14
|
* a stalled or empty data set doesn't show misleading 0% values. Inputs
|
|
14
|
-
* whose shape isn't `
|
|
15
|
+
* whose shape isn't `HistogramBin[][]` fall through untouched (same defensive
|
|
15
16
|
* shape-check pattern as the default transform).
|
|
16
17
|
*/
|
|
17
18
|
export declare const toRelativeHistogramData: (input: unknown) => unknown;
|
|
18
19
|
/**
|
|
19
|
-
* `LockSelection` filter for Histogram. Data is `
|
|
20
|
-
* of bin counts per series, positionally paired with `ticks` (bin `i` covers
|
|
20
|
+
* `LockSelection` filter for Histogram. Data is `HistogramBin[][]` — a flat
|
|
21
|
+
* list of bin counts per series, positionally paired with `ticks` (bin `i` covers
|
|
21
22
|
* `[ticks[i], ticks[i+1])`). Unlike name-keyed widgets, locked-out bins can't
|
|
22
23
|
* be REMOVED — that would shift every later bin's index and desync it from
|
|
23
24
|
* its `ticks` range. Zeroing them out instead preserves array length/position,
|
|
@@ -2,12 +2,29 @@ import { Theme } from '@mui/material';
|
|
|
2
2
|
import { EChartsOption } from 'echarts';
|
|
3
3
|
import { WidgetSeries } from '../types.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* One histogram bin: either its count, or `{ value, color? }` to give the
|
|
6
|
+
* bar its own colour (CSS colour or theme palette path such as
|
|
7
|
+
* `'primary.main'`). A bin `color` wins over the template's
|
|
8
|
+
* `itemStyle.color` and the series colour; selection dimming still applies.
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type HistogramBin = number | HistogramBinObject;
|
|
11
|
+
/** Object form of a {@link HistogramBin}. */
|
|
12
|
+
export interface HistogramBinObject {
|
|
13
|
+
value: number;
|
|
14
|
+
color?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Histogram widget data — array of series, each a flat array of bins. The
|
|
18
|
+
* option factory's merge phase (see {@link createHistogramOptionFactory})
|
|
19
|
+
* combines this with `ticks` to produce a 2-column dataset
|
|
20
|
+
* (`[binLabel, count]`) for ECharts.
|
|
21
|
+
*
|
|
22
|
+
* Defaults to plain counts (`number[][]`) so existing code that reads bins
|
|
23
|
+
* as numbers keeps type-checking; use `HistogramWidgetData<HistogramBin>`
|
|
24
|
+
* to also accept `{ value, color? }` bins. Every histogram API (option
|
|
25
|
+
* factory, transforms, download) accepts both forms.
|
|
26
|
+
*/
|
|
27
|
+
export type HistogramWidgetData<B extends HistogramBin = number> = readonly (readonly B[])[];
|
|
11
28
|
/** Inputs to the structural-only {@link histogramOptions} builder. */
|
|
12
29
|
export interface HistogramOptionsInput {
|
|
13
30
|
theme: Theme;
|
|
@@ -101,7 +101,7 @@ export type { FormulaUIProps, FormulaDataItem, FormulaWidgetData, } from './form
|
|
|
101
101
|
export type { MarkdownUIProps, MarkdownWidgetData } from './markdown/index.js';
|
|
102
102
|
export type { PieDatum, PieWidgetData } from './pie/index.js';
|
|
103
103
|
export type { TimeseriesDatum, TimeseriesWidgetData } from './timeseries/index.js';
|
|
104
|
-
export type { ScatterplotDatum, ScatterplotWidgetData } from './scatterplot/index.js';
|
|
104
|
+
export type { ScatterplotDatum, ScatterplotPoint, ScatterplotItem, ScatterplotWidgetData, } from './scatterplot/index.js';
|
|
105
105
|
export type { SpreadUIProps, SpreadDataItem, SpreadWidgetData, SpreadVariant, } from './spread/index.js';
|
|
106
106
|
export type { RangeProps, RangeUIProps, RangeDataItem, RangeWidgetData, RangeItemValue, } from './range/index.js';
|
|
107
107
|
export type { CategoryProps, CategoryUIProps, CategoryDataItem, CategoryWidgetData, CategoryKey, CategorySeriesConfig, CategoryLabels, } from './category/index.js';
|
|
@@ -5,6 +5,12 @@ import { WidgetSeries } from '../types.js';
|
|
|
5
5
|
export interface PieDatum {
|
|
6
6
|
name: string | number;
|
|
7
7
|
value: number;
|
|
8
|
+
/**
|
|
9
|
+
* Optional colour for this item (CSS colour or theme palette path such as
|
|
10
|
+
* `'primary.main'`). Wins over the template's `itemStyle.color` and the
|
|
11
|
+
* series colour; selection dimming still applies on top.
|
|
12
|
+
*/
|
|
13
|
+
color?: string;
|
|
8
14
|
}
|
|
9
15
|
/** Pie widget data — one slice array per series (rendered as side-by-side donuts). */
|
|
10
16
|
export type PieWidgetData = readonly (readonly PieDatum[])[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DownloadContext, DownloadItem } from '../actions/download/index.js';
|
|
2
|
-
import { ScatterplotWidgetData } from './types.js';
|
|
2
|
+
import { ScatterplotItem, ScatterplotWidgetData } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Download menu items for the Scatterplot widget. Always includes a CSV
|
|
5
5
|
* item with `series, x, y` columns (one row per point). When
|
|
@@ -8,7 +8,7 @@ import { ScatterplotWidgetData } from './types.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function createScatterplotDownloadConfig(args: {
|
|
10
10
|
filename: string;
|
|
11
|
-
getData: (ctx: DownloadContext) => ScatterplotWidgetData
|
|
11
|
+
getData: (ctx: DownloadContext) => ScatterplotWidgetData<ScatterplotItem>;
|
|
12
12
|
seriesNames?: readonly string[];
|
|
13
13
|
getCaptureEl?: (ctx: DownloadContext) => HTMLElement | null;
|
|
14
14
|
pngPixelRatio?: number;
|
|
@@ -2,4 +2,5 @@ export { scatterplotOptions, createScatterplotOptionFactory } from './options.js
|
|
|
2
2
|
export { ScatterplotSkeleton, type ScatterplotSkeletonProps } from './skeleton.js';
|
|
3
3
|
export { createScatterplotDownloadConfig } from './download.js';
|
|
4
4
|
export { toRelativeScatterplotData, filterScatterplotByLockedPoints, } from './transforms.js';
|
|
5
|
-
export
|
|
5
|
+
export { getScatterplotXY } from './points.js';
|
|
6
|
+
export type { ScatterplotDatum, ScatterplotPoint, ScatterplotItem, ScatterplotWidgetData, ScatterplotOptionsInput, ScatterplotOptionFactoryInput, ScatterplotEChartsOption, } from './types.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ScatterplotItem } from './types.js';
|
|
2
|
+
/** `[x, y]` of a {@link ScatterplotItem}, whichever form it takes. */
|
|
3
|
+
export declare function getScatterplotXY(point: ScatterplotItem): readonly [number, number];
|
|
4
|
+
/** Whether `v` is a valid {@link ScatterplotItem} with finite coordinates. */
|
|
5
|
+
export declare function isScatterplotDatum(v: unknown): v is ScatterplotItem;
|
|
6
|
+
/** Same point with new coordinates; keeps the object form (and `color`). */
|
|
7
|
+
export declare function withScatterplotXY(point: ScatterplotItem, x: number, y: number): ScatterplotItem;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Scatterplot-specific `RelativeData` transform. Scatter data is
|
|
3
|
-
* `[
|
|
3
|
+
* `ScatterplotItem[][]` — each series is a list of `[x, y]` tuples or
|
|
4
|
+
* `{ x, y, color? }` points (whose shape is kept).
|
|
4
5
|
* Relative is a values-axis concept, so this rewrites `y` to its
|
|
5
6
|
* share of the series's total `y` (0–100) and leaves `x` raw — x is
|
|
6
7
|
* coordinate space, not part of the cohort total.
|
|
@@ -11,12 +12,12 @@
|
|
|
11
12
|
* y values produce sane signed shares-of-magnitude. A series whose
|
|
12
13
|
* total y-magnitude is zero (all-zero or empty input) is returned
|
|
13
14
|
* unchanged so a stalled or empty data set doesn't show misleading 0%
|
|
14
|
-
* values. Inputs whose shape isn't `[
|
|
15
|
+
* values. Inputs whose shape isn't `ScatterplotItem[]` fall through
|
|
15
16
|
* untouched.
|
|
16
17
|
*/
|
|
17
18
|
export declare const toRelativeScatterplotData: (input: unknown) => unknown;
|
|
18
19
|
/**
|
|
19
|
-
* `LockSelection` filter for Scatterplot. Data is `[
|
|
20
|
+
* `LockSelection` filter for Scatterplot. Data is `ScatterplotItem[][]` —
|
|
20
21
|
* points have no `name`, so selection (and locking) is keyed on a synthetic
|
|
21
22
|
* `${seriesIndex}:${dataIndex}` string (same format `useChartSelection`'s
|
|
22
23
|
* `keyFromClick`/`keysFromBrush` produce for this widget). Unlike Histogram,
|
|
@@ -3,8 +3,27 @@ import { EChartsOption } from 'echarts';
|
|
|
3
3
|
import { WidgetSeries } from '../types.js';
|
|
4
4
|
/** A single point — `[x, y]` tuple. */
|
|
5
5
|
export type ScatterplotDatum = readonly [number, number];
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Object form of a point, to give it its own colour. `color` (CSS colour or
|
|
8
|
+
* theme palette path such as `'primary.main'`) wins over the template's
|
|
9
|
+
* `itemStyle.color` and the series colour; selection dimming still applies.
|
|
10
|
+
*/
|
|
11
|
+
export interface ScatterplotPoint {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
color?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Any accepted point: an `[x, y]` tuple or a {@link ScatterplotPoint}. */
|
|
17
|
+
export type ScatterplotItem = ScatterplotDatum | ScatterplotPoint;
|
|
18
|
+
/**
|
|
19
|
+
* Scatterplot widget data — array of series, each a list of points.
|
|
20
|
+
*
|
|
21
|
+
* Defaults to `[x, y]` tuples so existing code that destructures points
|
|
22
|
+
* keeps type-checking; use `ScatterplotWidgetData<ScatterplotItem>` to also
|
|
23
|
+
* accept `{ x, y, color? }` points. Every scatterplot API (option factory,
|
|
24
|
+
* transforms, download) accepts both forms.
|
|
25
|
+
*/
|
|
26
|
+
export type ScatterplotWidgetData<P extends ScatterplotItem = ScatterplotDatum> = readonly (readonly P[])[];
|
|
8
27
|
/** Inputs to the structural-only {@link scatterplotOptions} builder. */
|
|
9
28
|
export interface ScatterplotOptionsInput {
|
|
10
29
|
theme: Theme;
|
|
@@ -9,6 +9,12 @@ import { WidgetSeries } from '../types.js';
|
|
|
9
9
|
export interface TimeseriesDatum {
|
|
10
10
|
name: Date | number | string;
|
|
11
11
|
value: number;
|
|
12
|
+
/**
|
|
13
|
+
* Optional colour for this item (CSS colour or theme palette path such as
|
|
14
|
+
* `'primary.main'`). Wins over the template's `itemStyle.color` and the
|
|
15
|
+
* series colour; selection dimming still applies on top.
|
|
16
|
+
*/
|
|
17
|
+
color?: string;
|
|
12
18
|
}
|
|
13
19
|
/** Timeseries widget data — one array of points per series. */
|
|
14
20
|
export type TimeseriesWidgetData = readonly (readonly TimeseriesDatum[])[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { CallbackDataParams } from 'echarts/types/dist/shared';
|
|
3
|
+
/** ECharts `itemStyle.color` callback, as emitted by the chart widgets. */
|
|
4
|
+
export type ItemColorCallback = (params: CallbackDataParams) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Builds the callback that resolves the **base** colour of every item of one
|
|
7
|
+
* series, before any selection dimming. Priority:
|
|
8
|
+
*
|
|
9
|
+
* 1. the datum's own `color` (`datums[params.dataIndex].color`);
|
|
10
|
+
* 2. the consumer's `template.itemStyle.color` (from `optionsOverride`):
|
|
11
|
+
* a string is used as is, a function is called with the ECharts params;
|
|
12
|
+
* 3. `fallback` — the widget's default (series colour / palette).
|
|
13
|
+
*
|
|
14
|
+
* The datum is looked up by `params.dataIndex` in the widget's own data
|
|
15
|
+
* rather than read off `params.data`, so it works whatever the dataset row
|
|
16
|
+
* shape is (object rows, `[label, count]` tuples, `[x, y]` tuples).
|
|
17
|
+
*
|
|
18
|
+
* Datum and template colours go through {@link resolveThemeColor}, same as
|
|
19
|
+
* per-series colours, so palette paths such as `'primary.main'` work.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createItemColorResolver({ theme, datums, template, fallback, }: {
|
|
22
|
+
theme: Theme;
|
|
23
|
+
datums: readonly unknown[];
|
|
24
|
+
template: unknown;
|
|
25
|
+
fallback: ItemColorCallback;
|
|
26
|
+
}): ItemColorCallback;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as e, E as t, S as n, T as r, _ as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, n as h, o as g, p as _, r as v, s as y, t as b, u as x, v as S, w as C, x as w, y as T } from "../actions-
|
|
1
|
+
import { C as e, E as t, S as n, T as r, _ as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, n as h, o as g, p as _, r as v, s as y, t as b, u as x, v as S, w as C, x as w, y as T } from "../actions-DXfQMrll.js";
|
|
2
2
|
import { a as E, i as D, n as O, r as k, t as A } from "../zoom-toggle-KA63b6-J.js";
|
|
3
3
|
import { a as j, c as M, d as N, f as P, i as F, l as I, n as L, o as R, r as z, s as B, t as V, u as H } from "../download--wRRnf19.js";
|
|
4
4
|
export { l as BrushToggle, F as CSVIcon, b as ChangeColumn, _ as DEFAULT_BRUSH_TOGGLE_LABELS, h as DEFAULT_CHANGE_COLUMN_LABELS, M as DEFAULT_DOWNLOAD_LABELS, y as DEFAULT_FULLSCREEN_LABELS, f as DEFAULT_LOCK_SELECTION_LABELS, p as DEFAULT_RELATIVE_DATA_LABELS, r as DEFAULT_SEARCHER_LABELS, S as DEFAULT_SHOW_ALL_LABELS, o as DEFAULT_STACK_TOGGLE_LABELS, O as DEFAULT_ZOOM_TOGGLE_LABELS, z as DOWNLOAD_ITEM_IDS, B as Download, g as FullScreen, v as LockSelection, j as MarkdownIcon, R as PNGIcon, s as RelativeData, d as SHOW_ALL_ID, n as Searcher, e as SearcherToggle, u as ShowAllToggle, T as StackToggle, k as ZOOM_LAYOUT, A as ZoomToggle, m as addBrush, w as addStack, D as addZoom, V as buildCsvDownloadItem, L as buildPngDownloadItem, E as createAddZoom, x as createPercentFormatter, I as downloadDOMToPNG, H as downloadToCSV, a as filterByLockedItems, t as filterBySearchText, C as setSearcherText, i as setShowAll, N as toCsvString, c as toRelativeData, P as triggerLinkDownload };
|
package/dist/widgets-v2/bar.js
CHANGED
|
@@ -2,12 +2,13 @@ import { r as e } from "../zoom-toggle-KA63b6-J.js";
|
|
|
2
2
|
import { n as t, t as n } from "../download--wRRnf19.js";
|
|
3
3
|
import { n as r, r as i, t as a } from "../utils-ClB6nn4w.js";
|
|
4
4
|
import { a as o, d as s, f as c, i as l, s as u, u as d } from "../chart-config-BWxjodlt.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
5
|
+
import { t as f } from "../item-color-C1cu6EJd.js";
|
|
6
|
+
import { c as p } from "react/compiler-runtime";
|
|
7
|
+
import { Box as m, Skeleton as h } from "@mui/material";
|
|
8
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
9
|
+
import * as v from "echarts";
|
|
9
10
|
//#region src/widgets-v2/bar/options.ts
|
|
10
|
-
function
|
|
11
|
+
function y({ theme: e, formatter: t, labelFormatter: n }) {
|
|
11
12
|
let r = 0, i = 1;
|
|
12
13
|
return {
|
|
13
14
|
grid: {
|
|
@@ -29,7 +30,7 @@ function v({ theme: e, formatter: t, labelFormatter: n }) {
|
|
|
29
30
|
},
|
|
30
31
|
axisPointer: { type: "line" },
|
|
31
32
|
position: s(e),
|
|
32
|
-
formatter:
|
|
33
|
+
formatter: x(t, n)
|
|
33
34
|
},
|
|
34
35
|
legend: { ...u({
|
|
35
36
|
hasLegend: !1,
|
|
@@ -78,34 +79,42 @@ function v({ theme: e, formatter: t, labelFormatter: n }) {
|
|
|
78
79
|
}
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
-
let { theme: n, formatter: o, labelFormatter: s, optionsOverride: l } = t, u = t.series, d = t.selection,
|
|
83
|
-
return (t, d,
|
|
82
|
+
function b(t) {
|
|
83
|
+
let { theme: n, formatter: o, labelFormatter: s, optionsOverride: l } = t, u = t.series, d = t.selection, p = d && d.length > 0 ? new Set(d) : null;
|
|
84
|
+
return (t, d, m) => {
|
|
84
85
|
if (t == null) {
|
|
85
|
-
let e =
|
|
86
|
+
let e = y({
|
|
86
87
|
theme: n,
|
|
87
88
|
formatter: o,
|
|
88
89
|
labelFormatter: s
|
|
89
90
|
});
|
|
90
91
|
return l ? i(e, l) : e;
|
|
91
92
|
}
|
|
92
|
-
let
|
|
93
|
-
if (
|
|
93
|
+
let h = Array.isArray(d) ? d : [];
|
|
94
|
+
if (h.length === 0) return {
|
|
94
95
|
...t,
|
|
95
96
|
dataset: [],
|
|
96
97
|
series: []
|
|
97
98
|
};
|
|
98
|
-
let
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
let g = h.length > 1, _ = typeof t.legend == "object" && !Array.isArray(t.legend) ? t.legend : {}, b = typeof t.grid == "object" && !Array.isArray(t.grid) ? t.grid : {}, S = typeof t.tooltip == "object" && !Array.isArray(t.tooltip) ? t.tooltip : {}, C = typeof t.yAxis == "object" && !Array.isArray(t.yAxis) ? t.yAxis : {}, w = Array.isArray(t.series) ? t.series : [], T = w[0] ?? {}, E = m?.formatter, D = m?.labelFormatter, O = 0, k = 1, A = r(t.dataZoom, g), j = typeof b.bottom == "number" ? b.bottom : 24, M = g ? 56 : j, N = A ? M + e.sliderHeight + e.sliderGap : M, P = (e, t) => {
|
|
100
|
+
let r = f({
|
|
101
|
+
theme: n,
|
|
102
|
+
datums: e,
|
|
103
|
+
template: t,
|
|
104
|
+
fallback: (e) => e.color
|
|
105
|
+
});
|
|
106
|
+
return { color: (e) => {
|
|
107
|
+
let t = r(e);
|
|
108
|
+
if (!p) return t;
|
|
109
|
+
let n = e.value?.name ?? e.name;
|
|
110
|
+
return n != null && p.has(n) ? t : v.color.modifyAlpha(t, .15);
|
|
111
|
+
} };
|
|
112
|
+
};
|
|
104
113
|
return {
|
|
105
114
|
...t,
|
|
106
|
-
dataset:
|
|
107
|
-
series:
|
|
108
|
-
let r =
|
|
115
|
+
dataset: h.map((e) => ({ source: e })),
|
|
116
|
+
series: h.map((e, t) => {
|
|
117
|
+
let r = w[t] ?? T, i = a(n, u?.[t]?.color);
|
|
109
118
|
return {
|
|
110
119
|
...typeof r == "object" ? r : {},
|
|
111
120
|
type: "bar",
|
|
@@ -117,36 +126,36 @@ function y(t) {
|
|
|
117
126
|
},
|
|
118
127
|
barMaxWidth: 100,
|
|
119
128
|
emphasis: { focus: "series" },
|
|
120
|
-
itemStyle:
|
|
129
|
+
itemStyle: P(e, r),
|
|
121
130
|
...i ? { color: i } : {}
|
|
122
131
|
};
|
|
123
132
|
}),
|
|
124
133
|
legend: {
|
|
125
|
-
...
|
|
126
|
-
show:
|
|
134
|
+
..._,
|
|
135
|
+
show: g
|
|
127
136
|
},
|
|
128
137
|
grid: {
|
|
129
|
-
...
|
|
130
|
-
bottom:
|
|
138
|
+
...b,
|
|
139
|
+
bottom: N
|
|
131
140
|
},
|
|
132
|
-
...
|
|
141
|
+
...A ? { dataZoom: A } : {},
|
|
133
142
|
yAxis: {
|
|
134
|
-
...
|
|
135
|
-
min: (e) => (
|
|
136
|
-
max: (e) => (
|
|
143
|
+
...C,
|
|
144
|
+
min: (e) => (O = e.min < 0 ? c(e.min) : 0, O),
|
|
145
|
+
max: (e) => (k = e.max <= 0 ? 1 : c(e.max), k),
|
|
137
146
|
axisLabel: {
|
|
138
|
-
...
|
|
139
|
-
formatter: (e) => e !==
|
|
147
|
+
...C.axisLabel ?? {},
|
|
148
|
+
formatter: (e) => e !== k && e !== O || e === 0 ? "" : E ? E(e) : String(e)
|
|
140
149
|
}
|
|
141
150
|
},
|
|
142
151
|
tooltip: {
|
|
143
|
-
...
|
|
144
|
-
formatter:
|
|
152
|
+
...S,
|
|
153
|
+
formatter: x(E, D)
|
|
145
154
|
}
|
|
146
155
|
};
|
|
147
156
|
};
|
|
148
157
|
}
|
|
149
|
-
function
|
|
158
|
+
function x(e, t) {
|
|
150
159
|
return d((n) => {
|
|
151
160
|
let r = n.value?.value, i = typeof r == "number" && e ? e(r) : r ?? "", a = typeof n.marker == "string" ? n.marker : "", o = n.seriesName ? `${n.seriesName}: ` : "", s = t ? String(t(n.name ?? "")) : n.name ?? "";
|
|
152
161
|
return {
|
|
@@ -159,7 +168,7 @@ function b(e, t) {
|
|
|
159
168
|
}
|
|
160
169
|
//#endregion
|
|
161
170
|
//#region src/widgets-v2/bar/skeleton.tsx
|
|
162
|
-
var
|
|
171
|
+
var S = {
|
|
163
172
|
container: {
|
|
164
173
|
display: "flex",
|
|
165
174
|
alignItems: "center",
|
|
@@ -191,51 +200,51 @@ var x = {
|
|
|
191
200
|
alignItems: "center",
|
|
192
201
|
gap: ({ spacing: e }) => e(1.5)
|
|
193
202
|
}
|
|
194
|
-
},
|
|
203
|
+
}, C = [
|
|
195
204
|
"20%",
|
|
196
205
|
"40%",
|
|
197
206
|
"60%",
|
|
198
207
|
"20%",
|
|
199
208
|
"80%"
|
|
200
209
|
];
|
|
201
|
-
function
|
|
202
|
-
let e =
|
|
203
|
-
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */
|
|
204
|
-
sx:
|
|
205
|
-
children:
|
|
210
|
+
function w() {
|
|
211
|
+
let e = p(2), t;
|
|
212
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ g(m, {
|
|
213
|
+
sx: S.grid,
|
|
214
|
+
children: C.map(E)
|
|
206
215
|
}), e[0] = t) : t = e[0];
|
|
207
216
|
let n;
|
|
208
|
-
return e[1] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */
|
|
209
|
-
sx:
|
|
210
|
-
children: [t, /* @__PURE__ */
|
|
211
|
-
sx:
|
|
212
|
-
children: [0, 1].map(
|
|
217
|
+
return e[1] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ _(m, {
|
|
218
|
+
sx: S.container,
|
|
219
|
+
children: [t, /* @__PURE__ */ g(m, {
|
|
220
|
+
sx: S.legend,
|
|
221
|
+
children: [0, 1].map(T)
|
|
213
222
|
})]
|
|
214
223
|
}), e[1] = n) : n = e[1], n;
|
|
215
224
|
}
|
|
216
|
-
function
|
|
217
|
-
return /* @__PURE__ */
|
|
218
|
-
sx:
|
|
219
|
-
children: [/* @__PURE__ */ h
|
|
225
|
+
function T(e) {
|
|
226
|
+
return /* @__PURE__ */ _(m, {
|
|
227
|
+
sx: S.legendItem,
|
|
228
|
+
children: [/* @__PURE__ */ g(h, {
|
|
220
229
|
variant: "circular",
|
|
221
230
|
width: 8,
|
|
222
231
|
height: 8
|
|
223
|
-
}), /* @__PURE__ */ h
|
|
232
|
+
}), /* @__PURE__ */ g(h, {
|
|
224
233
|
width: 48,
|
|
225
234
|
height: 8
|
|
226
235
|
})]
|
|
227
236
|
}, `legend-${e}`);
|
|
228
237
|
}
|
|
229
|
-
function
|
|
230
|
-
return /* @__PURE__ */ h
|
|
231
|
-
sx:
|
|
238
|
+
function E(e, t) {
|
|
239
|
+
return /* @__PURE__ */ g(h, {
|
|
240
|
+
sx: S.bar,
|
|
232
241
|
variant: "rectangular",
|
|
233
242
|
height: e
|
|
234
243
|
}, `bar-${t}`);
|
|
235
244
|
}
|
|
236
245
|
//#endregion
|
|
237
246
|
//#region src/widgets-v2/bar/download.tsx
|
|
238
|
-
function
|
|
247
|
+
function D(e) {
|
|
239
248
|
let r = [];
|
|
240
249
|
return e.getCaptureEl && r.push(t({
|
|
241
250
|
filename: e.filename,
|
|
@@ -255,6 +264,6 @@ function E(e) {
|
|
|
255
264
|
})), r;
|
|
256
265
|
}
|
|
257
266
|
//#endregion
|
|
258
|
-
export {
|
|
267
|
+
export { w as BarSkeleton, y as barOptions, D as createBarDownloadConfig, b as createBarOptionFactory };
|
|
259
268
|
|
|
260
269
|
//# sourceMappingURL=bar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar.js","names":["EChartsOption","echarts","CallbackDataParams","buildAxisLabelStyle","buildGridConfig","buildLegendConfig","createTooltipFormatter","createTooltipPositioner","niceNum","ZOOM_LAYOUT","OptionFactory","mergeOptions","resolveThemeColor","positionDataZoomForLegend","BarEChartsOption","BarOptionFactoryInput","BarOptionsInput","BarWidgetData","barOptions","theme","formatter","labelFormatter","niceMin","niceMax","grid","left","parseInt","spacing","top","right","containLabel","tooltip","trigger","backgroundColor","palette","grey","borderWidth","padding","textStyle","color","common","white","fontSize","fontFamily","typography","caption","axisPointer","type","position","buildBarTooltipFormatter","legend","hasLegend","lineStyle","secondary","main","Object","values","qualitative","bold","Record","xAxis","axisLine","show","axisTick","axisLabel","margin","interval","hideOverlap","v","String","yAxis","min","extent","max","splitLine","black","divider","showMaxLabel","showMinLabel","verticalAlign","inside","value","createBarOptionFactory","options","optionsOverride","series","selection","selectionSet","length","Set","option","data","ctx","structural","Partial","seriesArr","Array","isArray","dataset","baseLegend","baseGrid","baseTooltip","baseYAxis","seriesTemplates","broadcastTemplate","liveFormatter","liveLabelFormatter","dataZoomLayout","dataZoom","fallbackBottom","bottom","baseBottom","gridBottom","sliderHeight","sliderGap","dimItemStyle","params","base","datum","name","has","modifyAlpha","map","s","source","_","i","template","overrideColor","const","datasetIndex","encode","x","y","barMaxWidth","emphasis","focus","itemStyle","item","row","raw","formattedValue","marker","seriesName","Box","Skeleton","SxProps","Theme","styles","container","display","alignItems","justifyContent","flexDirection","gap","spacing","height","grid","flex","width","bar","maxWidth","marginLeft","legend","legendItem","Record","BAR_HEIGHTS","const","BarSkeleton","$","_c","t0","Symbol","for","map","_temp","t1","_temp2","i_0","i","buildCsvDownloadItem","buildPngDownloadItem","DownloadContext","DownloadItem","BarWidgetData","BarDownloadConfigArgs","filename","getData","ctx","getCaptureEl","HTMLElement","pngPixelRatio","pngBackgroundColor","createBarDownloadConfig","args","items","push","pixelRatio","backgroundColor","getRows","data","rows","i","series","entries","d","name","value"],"sources":["../../src/widgets-v2/bar/options.ts","../../src/widgets-v2/bar/skeleton.tsx","../../src/widgets-v2/bar/download.tsx"],"sourcesContent":["import type { EChartsOption } from 'echarts'\nimport * as echarts from 'echarts'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport {\n buildAxisLabelStyle,\n buildGridConfig,\n buildLegendConfig,\n createTooltipFormatter,\n createTooltipPositioner,\n niceNum,\n} from '../../widgets/utils/chart-config'\nimport { ZOOM_LAYOUT } from '../actions/zoom-toggle'\nimport type { OptionFactory } from '../echart'\nimport { mergeOptions, resolveThemeColor } from '../utils'\nimport { positionDataZoomForLegend } from '../utils/data-zoom-layout'\nimport type {\n BarEChartsOption,\n BarOptionFactoryInput,\n BarOptionsInput,\n BarWidgetData,\n} from './types'\n\n/**\n * Builds the **structural** ECharts option for a bar widget — axes, grid,\n * tooltip styling, themed legend. Intentionally data-agnostic: no series,\n * no dataset, no `legend.show` (those depend on data and are added by the\n * option factory's merge phase). This separation is what lets data-side\n * pipeline transforms (Searcher, RelativeData) drive the rendered chart —\n * the merge happens at render time inside the Echart bridge.\n *\n * Styling matches the v1 `barConfig` look-and-feel: minimal axes (only\n * min/max y-labels rendered inside the plot via `niceNum`), themed tooltip,\n * scroll legend, and CARTO color palette. The y-axis min/max + label\n * formatter and the tooltip formatter are wired here for the no-data case;\n * {@link createBarOptionFactory} re-derives them at fusion time so reactive\n * formatter changes (RelativeData) and stack templates (StackToggle) flow\n * through to the chart.\n */\nexport function barOptions({\n theme,\n formatter,\n labelFormatter,\n}: BarOptionsInput): BarEChartsOption {\n // Closure shared between yAxis min/max callbacks and the label formatter,\n // so only the rounded extents are labelled (matches v1).\n let niceMin = 0\n let niceMax = 1\n\n return {\n grid: {\n left: parseInt(theme.spacing(1)),\n top: parseInt(theme.spacing(3)),\n right: parseInt(theme.spacing(1)),\n // Default: no legend. Merger bumps this when there are >1 series.\n ...buildGridConfig(false, theme),\n containLabel: true,\n },\n tooltip: {\n trigger: 'axis',\n backgroundColor: theme.palette.grey[900],\n borderWidth: 0,\n padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],\n textStyle: {\n color: theme.palette.common.white,\n fontSize: 11,\n fontFamily: theme.typography.caption.fontFamily,\n },\n axisPointer: { type: 'line' },\n position: createTooltipPositioner(theme),\n formatter: buildBarTooltipFormatter(formatter, labelFormatter),\n },\n // Legend styling baked here; `show` is toggled by the merger based on\n // series count.\n legend: {\n ...buildLegendConfig({ hasLegend: false, labelFormatter }),\n },\n axisPointer: { lineStyle: { color: theme.palette.grey[400] } },\n color: [\n theme.palette.secondary.main,\n ...Object.values(\n (theme.palette as { qualitative?: { bold?: Record<string, string> } })\n .qualitative?.bold ?? {},\n ),\n ],\n xAxis: {\n type: 'category',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n ...buildAxisLabelStyle(theme),\n padding: [parseInt(theme.spacing(0.5)), 0, 0, 0],\n margin: 0,\n // `interval: 0` makes every category label a candidate so `hideOverlap`\n // can pack the maximum number that physically fit; the category-axis\n // default (`'auto'`) sub-samples first and shows fewer than fit.\n interval: 0,\n hideOverlap: true,\n ...(labelFormatter && {\n formatter: (v: string | number) => String(labelFormatter(v)),\n }),\n },\n },\n yAxis: {\n type: 'value',\n min: (extent: { min: number }) => {\n niceMin = extent.min < 0 ? niceNum(extent.min) : 0\n return niceMin\n },\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n axisLabel: {\n ...buildAxisLabelStyle(theme),\n margin: parseInt(theme.spacing(1)),\n show: true,\n showMaxLabel: true,\n showMinLabel: true,\n verticalAlign: 'bottom',\n inside: true,\n formatter: (value: number) => {\n if (value !== niceMax && value !== niceMin) return ''\n if (value === 0) return ''\n return formatter ? formatter(value) : String(value)\n },\n },\n },\n } as BarEChartsOption\n}\n\n/**\n * Returns the bar widget's {@link OptionFactory} — a single closure that\n * handles BOTH option-construction phases:\n *\n * - **Structural phase** (`option == null`) — builds the theme-aware\n * structural option via {@link barOptions}, optionally merging the\n * consumer-supplied `optionsOverride` on top. Called once by Provider\n * to seed `rawOptions` in the store; configTransforms (StackToggle /\n * ZoomToggle / BrushToggle) then mutate it via the pipeline middleware.\n * - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`\n * (`BarWidgetData`) into the option via the dataset API: one dataset\n * per series, each series referencing its dataset by index, encoded\n * by `name` (x) and `value` (y). Spreads any series-template fields\n * already on the incoming option (e.g. `{ stack: 'total' }` from\n * `addStack`) into every emitted series so configTransforms compose\n * end-to-end. Reactive `ctx.formatter` / `ctx.labelFormatter` drive\n * the y-axis min/max-only label and the tooltip formatter at fusion\n * time so RelativeData's percent formatter flows through without a\n * structural rebuild.\n *\n * Stable identity when the inputs don't change (consumers should wrap the\n * call in `useMemo` keyed on the same inputs).\n */\nexport function createBarOptionFactory(\n options: BarOptionFactoryInput,\n): OptionFactory {\n const { theme, formatter, labelFormatter, optionsOverride } = options\n const series = options.series\n const selection = options.selection\n const selectionSet =\n selection && selection.length > 0\n ? new Set<string | number>(selection)\n : null\n return (option, data, ctx) => {\n // Structural phase: Provider seeds rawOptions with this branch. No data\n // is read; we just emit the theme-aware base (optionally with override).\n if (option == null) {\n const structural = barOptions({ theme, formatter, labelFormatter })\n return optionsOverride\n ? (mergeOptions(\n structural as unknown as Record<string, unknown>,\n optionsOverride as Partial<Record<string, unknown>>,\n ) as EChartsOption)\n : structural\n }\n\n const seriesArr = Array.isArray(data) ? (data as BarWidgetData) : []\n if (seriesArr.length === 0) {\n return { ...option, dataset: [], series: [] }\n }\n const hasLegend = seriesArr.length > 1\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n const baseGrid =\n typeof option.grid === 'object' && !Array.isArray(option.grid)\n ? option.grid\n : {}\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseYAxis =\n typeof option.yAxis === 'object' && !Array.isArray(option.yAxis)\n ? option.yAxis\n : {}\n\n const seriesTemplates = Array.isArray(option.series) ? option.series : []\n const broadcastTemplate = seriesTemplates[0] ?? {}\n\n // Reactive (live store) formatters from ctx — distinct from the\n // closure-time `formatter` / `labelFormatter` captured for the\n // structural-build branch above. RelativeData can install a percent\n // formatter on the store after the factory was constructed; the merge\n // phase reads `ctx` to pick that up.\n const liveFormatter = ctx?.formatter\n const liveLabelFormatter = ctx?.labelFormatter\n\n // Closure shared between the yAxis min/max callbacks and the label\n // formatter, so only the rounded extents are labelled (matches v1).\n // Delegating the extent to ECharts (rather than precomputing scalars\n // from the raw data) is what keeps stacked bars inside the plot: when\n // StackToggle marks the series, ECharts feeds the *post-stack* extent\n // to these callbacks, so `niceNum` rounds the stacked total instead of\n // a single series.\n let niceMin = 0\n let niceMax = 1\n\n // Zoom slider layout: when ZoomToggle has installed `dataZoom`, push the\n // slider above the legend (if any) and reserve room in the grid below.\n const dataZoomLayout = positionDataZoomForLegend(option.dataZoom, hasLegend)\n const fallbackBottom =\n typeof baseGrid.bottom === 'number' ? baseGrid.bottom : 24\n const baseBottom = hasLegend ? 56 : fallbackBottom\n const gridBottom = dataZoomLayout\n ? baseBottom + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : baseBottom\n\n // When a selection is active, dim non-selected bars by routing the\n // resolved palette color through `modifyAlpha`. Per-row `itemStyle` on\n // dataset object-rows is silently ignored when `series.encode` is in\n // play — the callback approach is the standard ECharts pattern for\n // per-data styling derived from a dataset.\n //\n // We *always* emit `itemStyle.color` (a passthrough when nothing is\n // selected), not conditionally — dropping the key between renders\n // would let ECharts' default merge keep the previous callback alive\n // and bars would stay dimmed forever after an external clear. Always\n // emitting lets normal merge swap the callback in place, no\n // `replaceMerge` and no entry-animation flash on selection on/off.\n const dimItemStyle = {\n color: (params: CallbackDataParams) => {\n const base = params.color as string\n if (!selectionSet) return base\n const datum = params.value as { name?: string | number } | undefined\n const name = datum?.name ?? params.name\n return name != null && selectionSet.has(name)\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n },\n }\n\n return {\n ...option,\n dataset: seriesArr.map((s) => ({ source: s as readonly object[] })),\n series: seriesArr.map((_, i) => {\n const template =\n (seriesTemplates[i] as object | undefined) ??\n (broadcastTemplate as object)\n // Per-series `color` override: ECharts sets `params.color` from\n // `series[i].color` when resolving styles, so the dim callback\n // above keeps working — it just dims the user's colour rather\n // than the palette default.\n const overrideColor = resolveThemeColor(theme, series?.[i]?.color)\n return {\n ...(typeof template === 'object' ? template : {}),\n type: 'bar' as const,\n datasetIndex: i,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n encode: { x: 'name', y: 'value' },\n barMaxWidth: 100,\n emphasis: { focus: 'series' },\n itemStyle: dimItemStyle,\n ...(overrideColor ? { color: overrideColor } : {}),\n }\n }),\n legend: { ...baseLegend, show: hasLegend },\n grid: {\n ...baseGrid,\n bottom: gridBottom,\n },\n ...(dataZoomLayout ? { dataZoom: dataZoomLayout } : {}),\n yAxis: {\n ...baseYAxis,\n min: (extent: { min: number }) => {\n niceMin = extent.min < 0 ? niceNum(extent.min) : 0\n return niceMin\n },\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n axisLabel: {\n ...((baseYAxis as { axisLabel?: object }).axisLabel ?? {}),\n formatter: (value: number) => {\n if (value !== niceMax && value !== niceMin) return ''\n if (value === 0) return ''\n return liveFormatter ? liveFormatter(value) : String(value)\n },\n },\n } as EChartsOption['yAxis'],\n tooltip: {\n ...baseTooltip,\n formatter: buildBarTooltipFormatter(liveFormatter, liveLabelFormatter),\n },\n } as EChartsOption\n }\n}\n\nfunction buildBarTooltipFormatter(\n formatter: ((value: number) => string) | undefined,\n labelFormatter: ((value: string | number) => string | number) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const row = item.value as { name?: string | number; value?: number }\n const raw = row?.value\n const formattedValue =\n typeof raw === 'number' && formatter ? formatter(raw) : (raw ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = labelFormatter\n ? String(labelFormatter(item.name ?? ''))\n : (item.name ?? '')\n return { name: String(name), seriesName, marker, value: formattedValue }\n })\n}\n","import { Box, Skeleton, type SxProps, type Theme } from '@mui/material'\n\nconst styles = {\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexDirection: 'column',\n gap: ({ spacing }) => spacing(1),\n height: ({ spacing }) => spacing(38),\n },\n grid: {\n display: 'flex',\n justifyContent: 'space-between',\n flex: '1 1 auto',\n alignItems: 'flex-end',\n width: '100%',\n },\n bar: {\n flex: 1,\n maxWidth: ({ spacing }) => spacing(12),\n '& + &': {\n marginLeft: ({ spacing }) => spacing(1),\n },\n },\n legend: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n height: ({ spacing }) => spacing(5),\n },\n legendItem: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n },\n} satisfies Record<string, SxProps<Theme>>\n\nconst BAR_HEIGHTS = ['20%', '40%', '60%', '20%', '80%'] as const\n\n/**\n * Loading state for the Bar widget. Mirrors a bar chart's silhouette — five\n * vertical bars at staggered heights anchored to the bottom, plus a legend\n * stub — so the skeleton reads as \"a bar chart\" rather than a generic list.\n */\nexport function BarSkeleton() {\n return (\n <Box sx={styles.container}>\n <Box sx={styles.grid}>\n {BAR_HEIGHTS.map((height, i) => (\n <Skeleton\n key={`bar-${i}`}\n sx={styles.bar}\n variant='rectangular'\n height={height}\n />\n ))}\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n","import {\n buildCsvDownloadItem,\n buildPngDownloadItem,\n type DownloadContext,\n type DownloadItem,\n} from '../actions/download'\nimport type { BarWidgetData } from './types'\n\nexport interface BarDownloadConfigArgs {\n filename: string\n getData: (ctx: DownloadContext) => BarWidgetData\n /**\n * Optional getter for the widget's capture element (registered by\n * `Widget.State` on its success path). When provided, a PNG item is\n * prepended to the returned list. Wire it to\n * `() => getCaptureEl(id)`.\n */\n getCaptureEl?: (ctx: DownloadContext) => HTMLElement | null\n /** PNG `pixelRatio` (default 2). */\n pngPixelRatio?: number\n /** PNG `backgroundColor` (default transparent). */\n pngBackgroundColor?: string | null\n}\n\n/**\n * Builds download items for the Bar widget. Always includes a CSV item\n * with one `name,value` block per series, separated by an empty row when\n * there are multiple. When `getCaptureEl` is supplied, also prepends a PNG\n * item that rasterises the captured element via `html2canvas`.\n */\nexport function createBarDownloadConfig(\n args: BarDownloadConfigArgs,\n): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push(\n buildCsvDownloadItem({\n filename: args.filename,\n getRows: (ctx) => {\n const data = args.getData(ctx)\n const rows: unknown[][] = []\n for (const [i, series] of data.entries()) {\n if (i > 0) rows.push([])\n rows.push(['name', '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BK,EAAKL,KAAK,CAAC,QAAQ,OAAO,CAAC;IAC3B,KAAK,IAAMS,KAAKF,GAAQF,EAAKL,KAAK,CAACS,EAAEC,MAAMD,EAAEE,KAAK,CAAC;GACrD;GACA,OAAON;EACT;CACF,CAAC,CACH,GACON;AACT"}
|
|
1
|
+
{"version":3,"file":"bar.js","names":["EChartsOption","echarts","CallbackDataParams","buildAxisLabelStyle","buildGridConfig","buildLegendConfig","createTooltipFormatter","createTooltipPositioner","niceNum","ZOOM_LAYOUT","OptionFactory","mergeOptions","resolveThemeColor","createItemColorResolver","positionDataZoomForLegend","BarEChartsOption","BarOptionFactoryInput","BarOptionsInput","BarWidgetData","barOptions","theme","formatter","labelFormatter","niceMin","niceMax","grid","left","parseInt","spacing","top","right","containLabel","tooltip","trigger","backgroundColor","palette","grey","borderWidth","padding","textStyle","color","common","white","fontSize","fontFamily","typography","caption","axisPointer","type","position","buildBarTooltipFormatter","legend","hasLegend","lineStyle","secondary","main","Object","values","qualitative","bold","Record","xAxis","axisLine","show","axisTick","axisLabel","margin","interval","hideOverlap","v","String","yAxis","min","extent","max","splitLine","black","divider","showMaxLabel","showMinLabel","verticalAlign","inside","value","createBarOptionFactory","options","optionsOverride","series","selection","selectionSet","length","Set","option","data","ctx","structural","Partial","seriesArr","Array","isArray","dataset","baseLegend","baseGrid","baseTooltip","baseYAxis","seriesTemplates","broadcastTemplate","liveFormatter","liveLabelFormatter","dataZoomLayout","dataZoom","fallbackBottom","bottom","baseBottom","gridBottom","sliderHeight","sliderGap","makeDimItemStyle","datums","template","baseColor","fallback","params","base","datum","name","has","modifyAlpha","map","s","source","i","overrideColor","const","datasetIndex","encode","x","y","barMaxWidth","emphasis","focus","itemStyle","item","row","raw","formattedValue","marker","seriesName","Box","Skeleton","SxProps","Theme","styles","container","display","alignItems","justifyContent","flexDirection","gap","spacing","height","grid","flex","width","bar","maxWidth","marginLeft","legend","legendItem","Record","BAR_HEIGHTS","const","BarSkeleton","$","_c","t0","Symbol","for","map","_temp","t1","_temp2","i_0","i","buildCsvDownloadItem","buildPngDownloadItem","DownloadContext","DownloadItem","BarWidgetData","BarDownloadConfigArgs","filename","getData","ctx","getCaptureEl","HTMLElement","pngPixelRatio","pngBackgroundColor","createBarDownloadConfig","args","items","push","pixelRatio","backgroundColor","getRows","data","rows","i","series","entries","d","name","value"],"sources":["../../src/widgets-v2/bar/options.ts","../../src/widgets-v2/bar/skeleton.tsx","../../src/widgets-v2/bar/download.tsx"],"sourcesContent":["import type { EChartsOption } from 'echarts'\nimport * as echarts from 'echarts'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport {\n buildAxisLabelStyle,\n buildGridConfig,\n buildLegendConfig,\n createTooltipFormatter,\n createTooltipPositioner,\n niceNum,\n} from '../../widgets/utils/chart-config'\nimport { ZOOM_LAYOUT } from '../actions/zoom-toggle'\nimport type { OptionFactory } from '../echart'\nimport { mergeOptions, resolveThemeColor } from '../utils'\nimport { createItemColorResolver } from '../utils/item-color'\nimport { positionDataZoomForLegend } from '../utils/data-zoom-layout'\nimport type {\n BarEChartsOption,\n BarOptionFactoryInput,\n BarOptionsInput,\n BarWidgetData,\n} from './types'\n\n/**\n * Builds the **structural** ECharts option for a bar widget — axes, grid,\n * tooltip styling, themed legend. Intentionally data-agnostic: no series,\n * no dataset, no `legend.show` (those depend on data and are added by the\n * option factory's merge phase). This separation is what lets data-side\n * pipeline transforms (Searcher, RelativeData) drive the rendered chart —\n * the merge happens at render time inside the Echart bridge.\n *\n * Styling matches the v1 `barConfig` look-and-feel: minimal axes (only\n * min/max y-labels rendered inside the plot via `niceNum`), themed tooltip,\n * scroll legend, and CARTO color palette. The y-axis min/max + label\n * formatter and the tooltip formatter are wired here for the no-data case;\n * {@link createBarOptionFactory} re-derives them at fusion time so reactive\n * formatter changes (RelativeData) and stack templates (StackToggle) flow\n * through to the chart.\n */\nexport function barOptions({\n theme,\n formatter,\n labelFormatter,\n}: BarOptionsInput): BarEChartsOption {\n // Closure shared between yAxis min/max callbacks and the label formatter,\n // so only the rounded extents are labelled (matches v1).\n let niceMin = 0\n let niceMax = 1\n\n return {\n grid: {\n left: parseInt(theme.spacing(1)),\n top: parseInt(theme.spacing(3)),\n right: parseInt(theme.spacing(1)),\n // Default: no legend. Merger bumps this when there are >1 series.\n ...buildGridConfig(false, theme),\n containLabel: true,\n },\n tooltip: {\n trigger: 'axis',\n backgroundColor: theme.palette.grey[900],\n borderWidth: 0,\n padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],\n textStyle: {\n color: theme.palette.common.white,\n fontSize: 11,\n fontFamily: theme.typography.caption.fontFamily,\n },\n axisPointer: { type: 'line' },\n position: createTooltipPositioner(theme),\n formatter: buildBarTooltipFormatter(formatter, labelFormatter),\n },\n // Legend styling baked here; `show` is toggled by the merger based on\n // series count.\n legend: {\n ...buildLegendConfig({ hasLegend: false, labelFormatter }),\n },\n axisPointer: { lineStyle: { color: theme.palette.grey[400] } },\n color: [\n theme.palette.secondary.main,\n ...Object.values(\n (theme.palette as { qualitative?: { bold?: Record<string, string> } })\n .qualitative?.bold ?? {},\n ),\n ],\n xAxis: {\n type: 'category',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n ...buildAxisLabelStyle(theme),\n padding: [parseInt(theme.spacing(0.5)), 0, 0, 0],\n margin: 0,\n // `interval: 0` makes every category label a candidate so `hideOverlap`\n // can pack the maximum number that physically fit; the category-axis\n // default (`'auto'`) sub-samples first and shows fewer than fit.\n interval: 0,\n hideOverlap: true,\n ...(labelFormatter && {\n formatter: (v: string | number) => String(labelFormatter(v)),\n }),\n },\n },\n yAxis: {\n type: 'value',\n min: (extent: { min: number }) => {\n niceMin = extent.min < 0 ? niceNum(extent.min) : 0\n return niceMin\n },\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n axisLabel: {\n ...buildAxisLabelStyle(theme),\n margin: parseInt(theme.spacing(1)),\n show: true,\n showMaxLabel: true,\n showMinLabel: true,\n verticalAlign: 'bottom',\n inside: true,\n formatter: (value: number) => {\n if (value !== niceMax && value !== niceMin) return ''\n if (value === 0) return ''\n return formatter ? formatter(value) : String(value)\n },\n },\n },\n } as BarEChartsOption\n}\n\n/**\n * Returns the bar widget's {@link OptionFactory} — a single closure that\n * handles BOTH option-construction phases:\n *\n * - **Structural phase** (`option == null`) — builds the theme-aware\n * structural option via {@link barOptions}, optionally merging the\n * consumer-supplied `optionsOverride` on top. Called once by Provider\n * to seed `rawOptions` in the store; configTransforms (StackToggle /\n * ZoomToggle / BrushToggle) then mutate it via the pipeline middleware.\n * - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`\n * (`BarWidgetData`) into the option via the dataset API: one dataset\n * per series, each series referencing its dataset by index, encoded\n * by `name` (x) and `value` (y). Spreads any series-template fields\n * already on the incoming option (e.g. `{ stack: 'total' }` from\n * `addStack`) into every emitted series so configTransforms compose\n * end-to-end. Reactive `ctx.formatter` / `ctx.labelFormatter` drive\n * the y-axis min/max-only label and the tooltip formatter at fusion\n * time so RelativeData's percent formatter flows through without a\n * structural rebuild.\n *\n * Stable identity when the inputs don't change (consumers should wrap the\n * call in `useMemo` keyed on the same inputs).\n */\nexport function createBarOptionFactory(\n options: BarOptionFactoryInput,\n): OptionFactory {\n const { theme, formatter, labelFormatter, optionsOverride } = options\n const series = options.series\n const selection = options.selection\n const selectionSet =\n selection && selection.length > 0\n ? new Set<string | number>(selection)\n : null\n return (option, data, ctx) => {\n // Structural phase: Provider seeds rawOptions with this branch. No data\n // is read; we just emit the theme-aware base (optionally with override).\n if (option == null) {\n const structural = barOptions({ theme, formatter, labelFormatter })\n return optionsOverride\n ? (mergeOptions(\n structural as unknown as Record<string, unknown>,\n optionsOverride as Partial<Record<string, unknown>>,\n ) as EChartsOption)\n : structural\n }\n\n const seriesArr = Array.isArray(data) ? (data as BarWidgetData) : []\n if (seriesArr.length === 0) {\n return { ...option, dataset: [], series: [] }\n }\n const hasLegend = seriesArr.length > 1\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n const baseGrid =\n typeof option.grid === 'object' && !Array.isArray(option.grid)\n ? option.grid\n : {}\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseYAxis =\n typeof option.yAxis === 'object' && !Array.isArray(option.yAxis)\n ? option.yAxis\n : {}\n\n const seriesTemplates = Array.isArray(option.series) ? option.series : []\n const broadcastTemplate = seriesTemplates[0] ?? {}\n\n // Reactive (live store) formatters from ctx — distinct from the\n // closure-time `formatter` / `labelFormatter` captured for the\n // structural-build branch above. RelativeData can install a percent\n // formatter on the store after the factory was constructed; the merge\n // phase reads `ctx` to pick that up.\n const liveFormatter = ctx?.formatter\n const liveLabelFormatter = ctx?.labelFormatter\n\n // Closure shared between the yAxis min/max callbacks and the label\n // formatter, so only the rounded extents are labelled (matches v1).\n // Delegating the extent to ECharts (rather than precomputing scalars\n // from the raw data) is what keeps stacked bars inside the plot: when\n // StackToggle marks the series, ECharts feeds the *post-stack* extent\n // to these callbacks, so `niceNum` rounds the stacked total instead of\n // a single series.\n let niceMin = 0\n let niceMax = 1\n\n // Zoom slider layout: when ZoomToggle has installed `dataZoom`, push the\n // slider above the legend (if any) and reserve room in the grid below.\n const dataZoomLayout = positionDataZoomForLegend(option.dataZoom, hasLegend)\n const fallbackBottom =\n typeof baseGrid.bottom === 'number' ? baseGrid.bottom : 24\n const baseBottom = hasLegend ? 56 : fallbackBottom\n const gridBottom = dataZoomLayout\n ? baseBottom + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : baseBottom\n\n // When a selection is active, dim non-selected bars by routing the\n // item's base colour through `modifyAlpha`. Per-row `itemStyle` on\n // dataset object-rows is silently ignored when `series.encode` is in\n // play — the callback approach is the standard ECharts pattern for\n // per-data styling derived from a dataset. The base colour is the\n // datum's `color`, else the template's `itemStyle.color`, else the\n // series colour / palette (`params.color`).\n //\n // We *always* emit `itemStyle.color` (a passthrough when nothing is\n // selected), not conditionally — dropping the key between renders\n // would let ECharts' default merge keep the previous callback alive\n // and bars would stay dimmed forever after an external clear. Always\n // emitting lets normal merge swap the callback in place, no\n // `replaceMerge` and no entry-animation flash on selection on/off.\n const makeDimItemStyle = (datums: readonly object[], template: unknown) => {\n const baseColor = createItemColorResolver({\n theme,\n datums,\n template,\n fallback: (params) => params.color as string,\n })\n return {\n color: (params: CallbackDataParams) => {\n const base = baseColor(params)\n if (!selectionSet) return base\n const datum = params.value as { name?: string | number } | undefined\n const name = datum?.name ?? params.name\n return name != null && selectionSet.has(name)\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n },\n }\n }\n\n return {\n ...option,\n dataset: seriesArr.map((s) => ({ source: s as readonly object[] })),\n series: seriesArr.map((s, i) => {\n const template =\n (seriesTemplates[i] as object | undefined) ??\n (broadcastTemplate as object)\n // Per-series `color` override: ECharts sets `params.color` from\n // `series[i].color` when resolving styles, so the dim callback\n // above keeps working — it just dims the user's colour rather\n // than the palette default.\n const overrideColor = resolveThemeColor(theme, series?.[i]?.color)\n return {\n ...(typeof template === 'object' ? template : {}),\n type: 'bar' as const,\n datasetIndex: i,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n encode: { x: 'name', y: 'value' },\n barMaxWidth: 100,\n emphasis: { focus: 'series' },\n itemStyle: makeDimItemStyle(s, template),\n ...(overrideColor ? { color: overrideColor } : {}),\n }\n }),\n legend: { ...baseLegend, show: hasLegend },\n grid: {\n ...baseGrid,\n bottom: gridBottom,\n },\n ...(dataZoomLayout ? { dataZoom: dataZoomLayout } : {}),\n yAxis: {\n ...baseYAxis,\n min: (extent: { min: number }) => {\n niceMin = extent.min < 0 ? niceNum(extent.min) : 0\n return niceMin\n },\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n axisLabel: {\n ...((baseYAxis as { axisLabel?: object }).axisLabel ?? {}),\n formatter: (value: number) => {\n if (value !== niceMax && value !== niceMin) return ''\n if (value === 0) return ''\n return liveFormatter ? liveFormatter(value) : String(value)\n },\n },\n } as EChartsOption['yAxis'],\n tooltip: {\n ...baseTooltip,\n formatter: buildBarTooltipFormatter(liveFormatter, liveLabelFormatter),\n },\n } as EChartsOption\n }\n}\n\nfunction buildBarTooltipFormatter(\n formatter: ((value: number) => string) | undefined,\n labelFormatter: ((value: string | number) => string | number) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const row = item.value as { name?: string | number; value?: number }\n const raw = row?.value\n const formattedValue =\n typeof raw === 'number' && formatter ? formatter(raw) : (raw ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = labelFormatter\n ? String(labelFormatter(item.name ?? ''))\n : (item.name ?? '')\n return { name: String(name), seriesName, marker, value: formattedValue }\n })\n}\n","import { Box, Skeleton, type SxProps, type Theme } from '@mui/material'\n\nconst styles = {\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexDirection: 'column',\n gap: ({ spacing }) => spacing(1),\n height: ({ spacing }) => spacing(38),\n },\n grid: {\n display: 'flex',\n justifyContent: 'space-between',\n flex: '1 1 auto',\n alignItems: 'flex-end',\n width: '100%',\n },\n bar: {\n flex: 1,\n maxWidth: ({ spacing }) => spacing(12),\n '& + &': {\n marginLeft: ({ spacing }) => spacing(1),\n },\n },\n legend: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n height: ({ spacing }) => spacing(5),\n },\n legendItem: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n },\n} satisfies Record<string, SxProps<Theme>>\n\nconst BAR_HEIGHTS = ['20%', '40%', '60%', '20%', '80%'] as const\n\n/**\n * Loading state for the Bar widget. Mirrors a bar chart's silhouette — five\n * vertical bars at staggered heights anchored to the bottom, plus a legend\n * stub — so the skeleton reads as \"a bar chart\" rather than a generic list.\n */\nexport function BarSkeleton() {\n return (\n <Box sx={styles.container}>\n <Box sx={styles.grid}>\n {BAR_HEIGHTS.map((height, i) => (\n <Skeleton\n key={`bar-${i}`}\n sx={styles.bar}\n variant='rectangular'\n height={height}\n />\n ))}\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n","import {\n buildCsvDownloadItem,\n buildPngDownloadItem,\n type DownloadContext,\n type DownloadItem,\n} from '../actions/download'\nimport type { BarWidgetData } from './types'\n\nexport interface BarDownloadConfigArgs {\n filename: string\n getData: (ctx: DownloadContext) => BarWidgetData\n /**\n * Optional getter for the widget's capture element (registered by\n * `Widget.State` on its success path). When provided, a PNG item is\n * prepended to the returned list. Wire it to\n * `() => getCaptureEl(id)`.\n */\n getCaptureEl?: (ctx: DownloadContext) => HTMLElement | null\n /** PNG `pixelRatio` (default 2). */\n pngPixelRatio?: number\n /** PNG `backgroundColor` (default transparent). */\n pngBackgroundColor?: string | null\n}\n\n/**\n * Builds download items for the Bar widget. Always includes a CSV item\n * with one `name,value` block per series, separated by an empty row when\n * there are multiple. When `getCaptureEl` is supplied, also prepends a PNG\n * item that rasterises the captured element via `html2canvas`.\n */\nexport function createBarDownloadConfig(\n args: BarDownloadConfigArgs,\n): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push(\n buildCsvDownloadItem({\n filename: args.filename,\n getRows: (ctx) => {\n const data = args.getData(ctx)\n const rows: unknown[][] = []\n for (const [i, series] of data.entries()) {\n if (i > 0) rows.push([])\n rows.push(['name', 'value'])\n for (const d of series) rows.push([d.name, d.value])\n }\n return rows\n },\n }),\n )\n return items\n}\n"],"mappings":";;;;;;;;;;AAuCA,SAAgBmB,EAAW,EACzBC,UACAC,cACAC,qBACoC;CAGpC,IAAIC,IAAU,GACVC,IAAU;CAEd,OAAO;EACLC,MAAM;GACJC,MAAMC,SAASP,EAAMQ,QAAQ,CAAC,CAAC;GAC/BC,KAAKF,SAASP,EAAMQ,QAAQ,CAAC,CAAC;GAC9BE,OAAOH,SAASP,EAAMQ,QAAQ,CAAC,CAAC;GAEhC,GAAGxB,EAAgB,IAAOgB,CAAK;GAC/BW,cAAc;EAChB;EACAC,SAAS;GACPC,SAAS;GACTC,iBAAiBd,EAAMe,QAAQC,KAAK;GACpCC,aAAa;GACbC,SAAS,CAACX,SAASP,EAAMQ,QAAQ,CAAC,CAAC,GAAGD,SAASP,EAAMQ,QAAQ,CAAC,CAAC,CAAC;GAChEW,WAAW;IACTC,OAAOpB,EAAMe,QAAQM,OAAOC;IAC5BC,UAAU;IACVC,YAAYxB,EAAMyB,WAAWC,QAAQF;GACvC;GACAG,aAAa,EAAEC,MAAM,OAAO;GAC5BC,UAAU1C,EAAwBa,CAAK;GACvCC,WAAW6B,EAAyB7B,GAAWC,CAAc;EAC/D;EAGA6B,QAAQ,EACN,GAAG9C,EAAkB;GAAE+C,WAAW;GAAO9B;EAAe,CAAC,EAC3D;EACAyB,aAAa,EAAEM,WAAW,EAAEb,OAAOpB,EAAMe,QAAQC,KAAK,KAAK,EAAE;EAC7DI,OAAO,CACLpB,EAAMe,QAAQmB,UAAUC,MACxB,GAAGC,OAAOC,OACPrC,EAAMe,QACJuB,aAAaC,QAAQ,CAAC,CAC3B,CAAC;EAEHE,OAAO;GACLb,MAAM;GACNc,UAAU,EAAEC,MAAM,GAAM;GACxBC,UAAU,EAAED,MAAM,GAAM;GACxBE,WAAW;IACT,GAAG9D,EAAoBiB,CAAK;IA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Q,EAAKR;EACfa,UAAUX,MAAQ;GAChB,IAAMY,IAAON,EAAKP,QAAQC,CAAG,GACvBa,IAAoB,CAAA;GAC1B,KAAK,IAAM,CAACC,GAAGC,MAAWH,EAAKI,QAAQ,GAAG;IAExCH,AADIC,IAAI,KAAGD,EAAKL,KAAK,CAAA,CAAE,GACvBK,EAAKL,KAAK,CAAC,QAAQ,OAAO,CAAC;IAC3B,KAAK,IAAMS,KAAKF,GAAQF,EAAKL,KAAK,CAACS,EAAEC,MAAMD,EAAEE,KAAK,CAAC;GACrD;GACA,OAAON;EACT;CACF,CAAC,CACH,GACON;AACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../category-
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../category-DuKx_CJX.js";
|
|
2
2
|
export { o as Category, r as CategoryBar, e as CategoryLegend, s as CategoryRowMulti, a as CategoryRowOther, t as CategoryRowSingle, i as CategorySkeleton, n as CategoryUI, c as createCategoryDownloadConfig };
|