@carto/ps-react-ui 5.4.0 → 5.6.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-5-dVhroJ.js +1289 -0
- package/dist/actions-5-dVhroJ.js.map +1 -0
- package/dist/{category-C6myUFUJ.js → category-DBUD2ZBo.js} +267 -250
- package/dist/category-DBUD2ZBo.js.map +1 -0
- package/dist/item-color-ZYxH3NM5.js +20 -0
- package/dist/item-color-ZYxH3NM5.js.map +1 -0
- package/dist/scale-0elCv3tk.js +29 -0
- package/dist/scale-0elCv3tk.js.map +1 -0
- package/dist/types/widgets-v2/actions/index.d.ts +1 -1
- package/dist/types/widgets-v2/actions/relative-data/index.d.ts +1 -0
- package/dist/types/widgets-v2/actions/relative-data/labels.d.ts +3 -0
- package/dist/types/widgets-v2/actions/relative-data/relative-data.d.ts +16 -2
- package/dist/types/widgets-v2/actions/relative-data/scale.d.ts +26 -0
- package/dist/types/widgets-v2/actions/relative-data/style.d.ts +12 -0
- package/dist/types/widgets-v2/bar/types.d.ts +6 -0
- package/dist/types/widgets-v2/category/category.d.ts +2 -1
- 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 +2 -2
- 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 +91 -81
- package/dist/widgets-v2/bar.js.map +1 -1
- package/dist/widgets-v2/category.js +1 -1
- package/dist/widgets-v2/histogram.js +133 -100
- 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 +151 -110
- package/dist/widgets-v2/scatterplot.js.map +1 -1
- package/dist/widgets-v2/timeseries.js +96 -86
- 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 +1 -1
- 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/actions/index.ts +1 -0
- package/src/widgets-v2/actions/relative-data/index.ts +1 -0
- package/src/widgets-v2/actions/relative-data/labels.ts +6 -0
- package/src/widgets-v2/actions/relative-data/relative-data.test.tsx +78 -1
- package/src/widgets-v2/actions/relative-data/relative-data.tsx +137 -20
- package/src/widgets-v2/actions/relative-data/scale.ts +48 -0
- package/src/widgets-v2/actions/relative-data/style.ts +10 -0
- package/src/widgets-v2/bar/options.test.ts +122 -0
- package/src/widgets-v2/bar/options.ts +31 -16
- package/src/widgets-v2/bar/types.ts +6 -0
- package/src/widgets-v2/category/category.relative-data.test.tsx +51 -63
- package/src/widgets-v2/category/category.tsx +25 -11
- 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 +44 -19
- 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 +7 -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 +90 -0
- package/src/widgets-v2/scatterplot/options.ts +53 -15
- 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 +37 -16
- 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-Dhlz_adK.js +0 -1167
- package/dist/actions-Dhlz_adK.js.map +0 -1
- package/dist/category-C6myUFUJ.js.map +0 -1
|
@@ -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;
|
|
@@ -96,12 +96,12 @@ export type { ToolboxLabels } from './toolbox/labels.js';
|
|
|
96
96
|
export type { EchartProps, EchartUIProps, EchartsEventHandler } from './echart/index.js';
|
|
97
97
|
export type { NoteProps, NoteMarkdownProps } from './note/widget-note.js';
|
|
98
98
|
export type { NoteLabels } from './note/labels.js';
|
|
99
|
-
export type { SearcherProps, SearcherToggleProps, StackToggleProps, ShowAllToggleProps, ZoomToggleProps, BrushToggleProps, RelativeDataProps, DownloadProps, DownloadItem, DownloadContext, FullScreenTriggerProps, FullScreenSlotProps, LockSelectionProps, LockSelectionKey, ChangeColumnProps, ChangeColumnItem, } from './actions/index.js';
|
|
99
|
+
export type { SearcherProps, SearcherToggleProps, StackToggleProps, ShowAllToggleProps, ZoomToggleProps, BrushToggleProps, RelativeDataProps, RelativeScale, DownloadProps, DownloadItem, DownloadContext, FullScreenTriggerProps, FullScreenSlotProps, LockSelectionProps, LockSelectionKey, ChangeColumnProps, ChangeColumnItem, } from './actions/index.js';
|
|
100
100
|
export type { FormulaUIProps, FormulaDataItem, FormulaWidgetData, } from './formula/index.js';
|
|
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-5-dVhroJ.js";
|
|
2
2
|
import { a as E, i as D, n as O, r as k, t as A } from "../zoom-toggle-IsF8BnAp.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-DGgFOaXj.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
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { r as e } from "../zoom-toggle-IsF8BnAp.js";
|
|
2
|
-
import { n as t
|
|
3
|
-
import { n
|
|
4
|
-
import {
|
|
5
|
-
import { c as f } from "
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
2
|
+
import { n as t } from "../scale-0elCv3tk.js";
|
|
3
|
+
import { n, t as r } from "../download-DGgFOaXj.js";
|
|
4
|
+
import { n as i, r as a, t as o } from "../utils-Dr6gf3vD.js";
|
|
5
|
+
import { a as s, d as c, f as l, i as u, s as d, u as f } from "../chart-config-B_fdIcD3.js";
|
|
6
|
+
import { t as p } from "../item-color-ZYxH3NM5.js";
|
|
7
|
+
import { c as m } from "react/compiler-runtime";
|
|
8
|
+
import { Box as h, Skeleton as g } from "@mui/material";
|
|
9
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
10
|
+
import * as y from "echarts";
|
|
9
11
|
//#region src/widgets-v2/bar/options.ts
|
|
10
|
-
function
|
|
12
|
+
function b({ theme: e, formatter: t, labelFormatter: n }) {
|
|
11
13
|
let r = 0, i = 1;
|
|
12
14
|
return {
|
|
13
15
|
grid: {
|
|
14
16
|
left: parseInt(e.spacing(1)),
|
|
15
17
|
top: parseInt(e.spacing(3)),
|
|
16
18
|
right: parseInt(e.spacing(1)),
|
|
17
|
-
...
|
|
19
|
+
...s(!1, e),
|
|
18
20
|
containLabel: !0
|
|
19
21
|
},
|
|
20
22
|
tooltip: {
|
|
@@ -28,10 +30,10 @@ function v({ theme: e, formatter: t, labelFormatter: n }) {
|
|
|
28
30
|
fontFamily: e.typography.caption.fontFamily
|
|
29
31
|
},
|
|
30
32
|
axisPointer: { type: "line" },
|
|
31
|
-
position:
|
|
32
|
-
formatter:
|
|
33
|
+
position: c(e),
|
|
34
|
+
formatter: S(t, n)
|
|
33
35
|
},
|
|
34
|
-
legend: { ...
|
|
36
|
+
legend: { ...d({
|
|
35
37
|
hasLegend: !1,
|
|
36
38
|
labelFormatter: n
|
|
37
39
|
}) },
|
|
@@ -42,7 +44,7 @@ function v({ theme: e, formatter: t, labelFormatter: n }) {
|
|
|
42
44
|
axisLine: { show: !1 },
|
|
43
45
|
axisTick: { show: !1 },
|
|
44
46
|
axisLabel: {
|
|
45
|
-
...
|
|
47
|
+
...u(e),
|
|
46
48
|
padding: [
|
|
47
49
|
parseInt(e.spacing(.5)),
|
|
48
50
|
0,
|
|
@@ -57,8 +59,8 @@ function v({ theme: e, formatter: t, labelFormatter: n }) {
|
|
|
57
59
|
},
|
|
58
60
|
yAxis: {
|
|
59
61
|
type: "value",
|
|
60
|
-
min: (e) => (r = e.min < 0 ?
|
|
61
|
-
max: (e) => (i = e.max <= 0 ? 1 :
|
|
62
|
+
min: (e) => (r = e.min < 0 ? l(e.min) : 0, r),
|
|
63
|
+
max: (e) => (i = e.max <= 0 ? 1 : l(e.max), i),
|
|
62
64
|
axisLine: { show: !1 },
|
|
63
65
|
axisTick: { show: !1 },
|
|
64
66
|
splitLine: {
|
|
@@ -66,7 +68,7 @@ function v({ theme: e, formatter: t, labelFormatter: n }) {
|
|
|
66
68
|
lineStyle: { color: e.palette.black?.[4] ?? e.palette.divider }
|
|
67
69
|
},
|
|
68
70
|
axisLabel: {
|
|
69
|
-
...
|
|
71
|
+
...u(e),
|
|
70
72
|
margin: parseInt(e.spacing(1)),
|
|
71
73
|
show: !0,
|
|
72
74
|
showMaxLabel: !0,
|
|
@@ -78,76 +80,84 @@ function v({ theme: e, formatter: t, labelFormatter: n }) {
|
|
|
78
80
|
}
|
|
79
81
|
};
|
|
80
82
|
}
|
|
81
|
-
function
|
|
82
|
-
let { theme:
|
|
83
|
-
return (
|
|
84
|
-
if (
|
|
85
|
-
let e =
|
|
86
|
-
theme:
|
|
87
|
-
formatter:
|
|
88
|
-
labelFormatter:
|
|
83
|
+
function x(n) {
|
|
84
|
+
let { theme: r, formatter: s, labelFormatter: c, optionsOverride: u } = n, d = n.series, f = n.selection, m = f && f.length > 0 ? new Set(f) : null;
|
|
85
|
+
return (n, f, h) => {
|
|
86
|
+
if (n == null) {
|
|
87
|
+
let e = b({
|
|
88
|
+
theme: r,
|
|
89
|
+
formatter: s,
|
|
90
|
+
labelFormatter: c
|
|
89
91
|
});
|
|
90
|
-
return
|
|
92
|
+
return u ? a(e, u) : e;
|
|
91
93
|
}
|
|
92
|
-
let
|
|
93
|
-
if (
|
|
94
|
-
...
|
|
94
|
+
let g = Array.isArray(f) ? f : [];
|
|
95
|
+
if (g.length === 0) return {
|
|
96
|
+
...n,
|
|
95
97
|
dataset: [],
|
|
96
98
|
series: []
|
|
97
99
|
};
|
|
98
|
-
let
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
let _ = g.length > 1, v = typeof n.legend == "object" && !Array.isArray(n.legend) ? n.legend : {}, x = typeof n.grid == "object" && !Array.isArray(n.grid) ? n.grid : {}, C = typeof n.tooltip == "object" && !Array.isArray(n.tooltip) ? n.tooltip : {}, w = typeof n.yAxis == "object" && !Array.isArray(n.yAxis) ? n.yAxis : {}, T = t(w), E = Array.isArray(n.series) ? n.series : [], D = E[0] ?? {}, O = h?.formatter, k = h?.labelFormatter, A = 0, j = 1, M = i(n.dataZoom, _), N = typeof x.bottom == "number" ? x.bottom : 24, P = _ ? 56 : N, F = M ? P + e.sliderHeight + e.sliderGap : P, I = (e, t) => {
|
|
101
|
+
let n = p({
|
|
102
|
+
theme: r,
|
|
103
|
+
datums: e,
|
|
104
|
+
template: t,
|
|
105
|
+
fallback: (e) => e.color
|
|
106
|
+
});
|
|
107
|
+
return { color: (e) => {
|
|
108
|
+
let t = n(e);
|
|
109
|
+
if (!m) return t;
|
|
110
|
+
let r = e.value?.name ?? e.name;
|
|
111
|
+
return r != null && m.has(r) ? t : y.color.modifyAlpha(t, .15);
|
|
112
|
+
} };
|
|
113
|
+
};
|
|
104
114
|
return {
|
|
105
|
-
...
|
|
106
|
-
dataset:
|
|
107
|
-
series:
|
|
108
|
-
let
|
|
115
|
+
...n,
|
|
116
|
+
dataset: g.map((e) => ({ source: e })),
|
|
117
|
+
series: g.map((e, t) => {
|
|
118
|
+
let n = E[t] ?? D, i = o(r, d?.[t]?.color);
|
|
109
119
|
return {
|
|
110
|
-
...typeof
|
|
120
|
+
...typeof n == "object" ? n : {},
|
|
111
121
|
type: "bar",
|
|
112
122
|
datasetIndex: t,
|
|
113
|
-
name:
|
|
123
|
+
name: d?.[t]?.name ?? `Series ${t + 1}`,
|
|
114
124
|
encode: {
|
|
115
125
|
x: "name",
|
|
116
126
|
y: "value"
|
|
117
127
|
},
|
|
118
128
|
barMaxWidth: 100,
|
|
119
129
|
emphasis: { focus: "series" },
|
|
120
|
-
itemStyle:
|
|
130
|
+
itemStyle: I(e, n),
|
|
121
131
|
...i ? { color: i } : {}
|
|
122
132
|
};
|
|
123
133
|
}),
|
|
124
134
|
legend: {
|
|
125
|
-
...
|
|
126
|
-
show:
|
|
135
|
+
...v,
|
|
136
|
+
show: _
|
|
127
137
|
},
|
|
128
138
|
grid: {
|
|
129
|
-
...
|
|
130
|
-
bottom:
|
|
139
|
+
...x,
|
|
140
|
+
bottom: F
|
|
131
141
|
},
|
|
132
|
-
...
|
|
142
|
+
...M ? { dataZoom: M } : {},
|
|
133
143
|
yAxis: {
|
|
134
|
-
...
|
|
135
|
-
min: (e) => (
|
|
136
|
-
max: (e) => (
|
|
144
|
+
...w,
|
|
145
|
+
min: (e) => (A = e.min < 0 ? T.min ?? l(e.min) : 0, A),
|
|
146
|
+
max: (e) => (j = e.max <= 0 ? 1 : T.max ?? l(e.max), j),
|
|
137
147
|
axisLabel: {
|
|
138
|
-
...
|
|
139
|
-
formatter: (e) => e !==
|
|
148
|
+
...w.axisLabel ?? {},
|
|
149
|
+
formatter: (e) => e !== j && e !== A || e === 0 ? "" : O ? O(e) : String(e)
|
|
140
150
|
}
|
|
141
151
|
},
|
|
142
152
|
tooltip: {
|
|
143
|
-
...
|
|
144
|
-
formatter:
|
|
153
|
+
...C,
|
|
154
|
+
formatter: S(O, k)
|
|
145
155
|
}
|
|
146
156
|
};
|
|
147
157
|
};
|
|
148
158
|
}
|
|
149
|
-
function
|
|
150
|
-
return
|
|
159
|
+
function S(e, t) {
|
|
160
|
+
return f((n) => {
|
|
151
161
|
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
162
|
return {
|
|
153
163
|
name: String(s),
|
|
@@ -159,7 +169,7 @@ function b(e, t) {
|
|
|
159
169
|
}
|
|
160
170
|
//#endregion
|
|
161
171
|
//#region src/widgets-v2/bar/skeleton.tsx
|
|
162
|
-
var
|
|
172
|
+
var C = {
|
|
163
173
|
container: {
|
|
164
174
|
display: "flex",
|
|
165
175
|
alignItems: "center",
|
|
@@ -191,58 +201,58 @@ var x = {
|
|
|
191
201
|
alignItems: "center",
|
|
192
202
|
gap: ({ spacing: e }) => e(1.5)
|
|
193
203
|
}
|
|
194
|
-
},
|
|
204
|
+
}, w = [
|
|
195
205
|
"20%",
|
|
196
206
|
"40%",
|
|
197
207
|
"60%",
|
|
198
208
|
"20%",
|
|
199
209
|
"80%"
|
|
200
210
|
];
|
|
201
|
-
function
|
|
202
|
-
let e =
|
|
203
|
-
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ h
|
|
204
|
-
sx:
|
|
205
|
-
children:
|
|
211
|
+
function T() {
|
|
212
|
+
let e = m(2), t;
|
|
213
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ _(h, {
|
|
214
|
+
sx: C.grid,
|
|
215
|
+
children: w.map(D)
|
|
206
216
|
}), e[0] = t) : t = e[0];
|
|
207
217
|
let n;
|
|
208
|
-
return e[1] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */
|
|
209
|
-
sx:
|
|
210
|
-
children: [t, /* @__PURE__ */ h
|
|
211
|
-
sx:
|
|
212
|
-
children: [0, 1].map(
|
|
218
|
+
return e[1] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ v(h, {
|
|
219
|
+
sx: C.container,
|
|
220
|
+
children: [t, /* @__PURE__ */ _(h, {
|
|
221
|
+
sx: C.legend,
|
|
222
|
+
children: [0, 1].map(E)
|
|
213
223
|
})]
|
|
214
224
|
}), e[1] = n) : n = e[1], n;
|
|
215
225
|
}
|
|
216
|
-
function
|
|
217
|
-
return /* @__PURE__ */
|
|
218
|
-
sx:
|
|
219
|
-
children: [/* @__PURE__ */
|
|
226
|
+
function E(e) {
|
|
227
|
+
return /* @__PURE__ */ v(h, {
|
|
228
|
+
sx: C.legendItem,
|
|
229
|
+
children: [/* @__PURE__ */ _(g, {
|
|
220
230
|
variant: "circular",
|
|
221
231
|
width: 8,
|
|
222
232
|
height: 8
|
|
223
|
-
}), /* @__PURE__ */
|
|
233
|
+
}), /* @__PURE__ */ _(g, {
|
|
224
234
|
width: 48,
|
|
225
235
|
height: 8
|
|
226
236
|
})]
|
|
227
237
|
}, `legend-${e}`);
|
|
228
238
|
}
|
|
229
|
-
function
|
|
230
|
-
return /* @__PURE__ */
|
|
231
|
-
sx:
|
|
239
|
+
function D(e, t) {
|
|
240
|
+
return /* @__PURE__ */ _(g, {
|
|
241
|
+
sx: C.bar,
|
|
232
242
|
variant: "rectangular",
|
|
233
243
|
height: e
|
|
234
244
|
}, `bar-${t}`);
|
|
235
245
|
}
|
|
236
246
|
//#endregion
|
|
237
247
|
//#region src/widgets-v2/bar/download.tsx
|
|
238
|
-
function
|
|
239
|
-
let
|
|
240
|
-
return e.getCaptureEl &&
|
|
248
|
+
function O(e) {
|
|
249
|
+
let t = [];
|
|
250
|
+
return e.getCaptureEl && t.push(n({
|
|
241
251
|
filename: e.filename,
|
|
242
252
|
getCaptureEl: e.getCaptureEl,
|
|
243
253
|
pixelRatio: e.pngPixelRatio,
|
|
244
254
|
backgroundColor: e.pngBackgroundColor
|
|
245
|
-
})),
|
|
255
|
+
})), t.push(r({
|
|
246
256
|
filename: e.filename,
|
|
247
257
|
getRows: (t) => {
|
|
248
258
|
let n = e.getData(t), r = [];
|
|
@@ -252,9 +262,9 @@ function E(e) {
|
|
|
252
262
|
}
|
|
253
263
|
return r;
|
|
254
264
|
}
|
|
255
|
-
})),
|
|
265
|
+
})), t;
|
|
256
266
|
}
|
|
257
267
|
//#endregion
|
|
258
|
-
export {
|
|
268
|
+
export { T as BarSkeleton, b as barOptions, O as createBarDownloadConfig, x as createBarOptionFactory };
|
|
259
269
|
|
|
260
270
|
//# sourceMappingURL=bar.js.map
|