@carto/ps-react-ui 4.12.0 → 4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{echart-BMPpj7n_.js → echart-Bdvbfx9s.js} +2 -2
- package/dist/echart-Bdvbfx9s.js.map +1 -0
- package/dist/{option-builders-F-c9ELi1.js → option-builders-DPeoyQaM.js} +41 -33
- package/dist/option-builders-DPeoyQaM.js.map +1 -0
- package/dist/types/widgets/utils/chart-config/index.d.ts +1 -1
- package/dist/types/widgets-v2/pie/skeleton.d.ts +9 -0
- package/dist/widgets/bar.js +1 -1
- package/dist/widgets/histogram.js +1 -1
- package/dist/widgets/pie.js +1 -1
- package/dist/widgets/scatterplot.js +5 -5
- package/dist/widgets/timeseries.js +1 -1
- package/dist/widgets/utils.js +1 -1
- package/dist/widgets-v2/bar.js +64 -64
- package/dist/widgets-v2/bar.js.map +1 -1
- package/dist/widgets-v2/echart.js +1 -1
- package/dist/widgets-v2/histogram.js +89 -89
- package/dist/widgets-v2/histogram.js.map +1 -1
- package/dist/widgets-v2/pie.js +149 -95
- package/dist/widgets-v2/pie.js.map +1 -1
- package/dist/widgets-v2/scatterplot.js +153 -157
- package/dist/widgets-v2/scatterplot.js.map +1 -1
- package/dist/widgets-v2/timeseries.js +74 -74
- package/dist/widgets-v2/timeseries.js.map +1 -1
- package/dist/widgets-v2.js +2 -2
- package/package.json +1 -1
- package/src/widgets/utils/chart-config/index.ts +1 -0
- package/src/widgets/utils/chart-config/option-builders.test.ts +34 -0
- package/src/widgets/utils/chart-config/option-builders.ts +21 -0
- package/src/widgets-v2/bar/options.ts +3 -2
- package/src/widgets-v2/echart/edge-label-clamp.ts +7 -4
- package/src/widgets-v2/histogram/options.ts +3 -2
- package/src/widgets-v2/pie/skeleton.test.tsx +6 -3
- package/src/widgets-v2/pie/skeleton.tsx +69 -7
- package/src/widgets-v2/scatterplot/options.ts +3 -6
- package/src/widgets-v2/timeseries/options.ts +3 -2
- package/dist/echart-BMPpj7n_.js.map +0 -1
- package/dist/option-builders-F-c9ELi1.js.map +0 -1
- package/dist/types/widgets/utils/chart-config/option-builders.d.ts +0 -124
|
@@ -9,7 +9,7 @@ import * as N from "echarts";
|
|
|
9
9
|
const k = {
|
|
10
10
|
alignMinLabel: null,
|
|
11
11
|
alignMaxLabel: null
|
|
12
|
-
}, D =
|
|
12
|
+
}, D = 1;
|
|
13
13
|
function B(t) {
|
|
14
14
|
const e = N.format.getTextRect(t.firstLabel, t.font).width / 2, n = N.format.getTextRect(t.lastLabel, t.font).width / 2;
|
|
15
15
|
return {
|
|
@@ -247,4 +247,4 @@ export {
|
|
|
247
247
|
se as a,
|
|
248
248
|
te as o
|
|
249
249
|
};
|
|
250
|
-
//# sourceMappingURL=echart-
|
|
250
|
+
//# sourceMappingURL=echart-Bdvbfx9s.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"echart-Bdvbfx9s.js","sources":["../src/widgets-v2/echart/edge-label-clamp.ts","../src/widgets-v2/echart/shared-resize-observer.ts","../src/widgets-v2/echart/style.ts","../src/widgets-v2/echart/echart-ui.tsx","../src/widgets-v2/echart/echart.tsx"],"sourcesContent":["import * as echarts from 'echarts'\nimport type { ECharts, EChartsOption } from 'echarts'\n\n/**\n * Render-time clamp that stops the first/last **category x-axis** labels from\n * clipping at the chart edges — *only when they actually overflow*.\n *\n * ECharts centers each category label on its tick; the first/last ticks sit at\n * the plot boundary, so a wide edge label spills past the chart and is cut off.\n * `grid.containLabel` does not contain this horizontal overflow and the v6\n * `outerBounds` shrink is unreliable, so we measure at render time and anchor\n * the overflowing edge label inward (`alignMinLabel: 'left'` /\n * `alignMaxLabel: 'right'`). Labels that fit stay centered.\n *\n * Lives in the generic bridge because the verdict needs the laid-out chart\n * (`convertToPixel`, `getWidth`); everything else is read from the `option`.\n * Auto-targets bar + histogram (category x-axis); pie's horizontal-bar fallback\n * (category *y*-axis), scatterplot (value) and timeseries (time) are skipped.\n */\n\nexport interface EdgeAlignment {\n alignMinLabel: 'left' | null\n alignMaxLabel: 'right' | null\n}\n\nexport const CENTERED: EdgeAlignment = {\n alignMinLabel: null,\n alignMaxLabel: null,\n}\n\n// Small cushion biasing toward anchoring when borderline: clipping is worse\n// than a hair of off-centering, and the measured width can differ slightly\n// from the final render (mainly when the web font isn't loaded yet at measure\n// time). Kept to 1px — a wider margin anchored labels that only just clear the\n// edge, and an anchored edge label can then be dropped by the axis\n// `hideOverlap`, leaving a gap. 1px guards measurement error without that.\nconst SAFETY_MARGIN_PX = 1\n\n/**\n * Pure overflow decision. Inputs are anchor-independent (tick centers and text\n * width don't depend on the label's current `text-anchor`), so feeding the\n * result back via `setOption` doesn't change them — the next pass yields the\n * same verdict, keeping the clamp loop-stable.\n */\nexport function decideEdgeAlignment(args: {\n firstLabel: string\n lastLabel: string\n font: string\n firstTickX: number\n lastTickX: number\n width: number\n}): EdgeAlignment {\n const halfFirst =\n echarts.format.getTextRect(args.firstLabel, args.font).width / 2\n const halfLast =\n echarts.format.getTextRect(args.lastLabel, args.font).width / 2\n return {\n alignMinLabel:\n halfFirst + SAFETY_MARGIN_PX > args.firstTickX ? 'left' : null,\n alignMaxLabel:\n halfLast + SAFETY_MARGIN_PX > args.width - args.lastTickX\n ? 'right'\n : null,\n }\n}\n\ninterface AxisLabel {\n formatter?: (value: string | number) => string | number\n fontSize?: number | string\n fontFamily?: string\n fontWeight?: number | string\n}\n\ninterface CategoryXAxis {\n type?: string\n axisLabel?: AxisLabel\n}\n\ninterface SeriesLike {\n encode?: { x?: string | number }\n datasetIndex?: number\n}\n\ntype Cell = string | number | null | undefined\n\nfunction firstOf<T>(value: T | T[] | undefined): T | undefined {\n if (Array.isArray(value)) return value[0]\n return value\n}\n\nfunction firstXAxis(option: EChartsOption): CategoryXAxis | undefined {\n const axis = firstOf(\n option.xAxis as CategoryXAxis | CategoryXAxis[] | undefined,\n )\n return axis && typeof axis === 'object' ? axis : undefined\n}\n\nfunction hasDataZoom(option: EChartsOption): boolean {\n const dz = option.dataZoom\n return Array.isArray(dz) ? dz.length > 0 : dz != null\n}\n\nfunction cellToText(value: Cell, fmt: AxisLabel['formatter']): string {\n if (typeof fmt === 'function') return String(fmt(value ?? ''))\n return value == null ? '' : String(value)\n}\n\n/**\n * Extracts the displayed first/last category strings and the label font from\n * the option, reading categories generically via `series[0].encode.x` into the\n * referenced dataset (`'name'` for bar, `0` for histogram). Returns `null` when\n * the option isn't a measurable category x-axis (fewer than 2 categories, no\n * dataset, etc.).\n */\nexport function resolveEdgeLabels(option: EChartsOption): {\n firstLabel: string\n lastLabel: string\n font: string\n count: number\n} | null {\n const xAxis = firstXAxis(option)\n if (!xAxis) return null\n if (xAxis.type !== 'category') return null\n\n const series0 = firstOf(\n option.series as SeriesLike | SeriesLike[] | undefined,\n )\n const encodeX = series0?.encode?.x\n if (encodeX == null) return null\n\n const datasetIndex = series0?.datasetIndex ?? 0\n const allDatasets = option.dataset as\n | { source?: unknown }\n | { source?: unknown }[]\n | undefined\n const dataset = Array.isArray(allDatasets)\n ? allDatasets[datasetIndex]\n : allDatasets\n const source = dataset?.source\n if (!Array.isArray(source) || source.length < 2) return null\n\n const rows = source as Record<string | number, Cell>[]\n const fmt = xAxis.axisLabel?.formatter\n const axisLabel = xAxis.axisLabel ?? {}\n const size =\n typeof axisLabel.fontSize === 'number'\n ? `${axisLabel.fontSize}px`\n : (axisLabel.fontSize ?? '12px')\n const family = axisLabel.fontFamily ?? 'sans-serif'\n const weight = axisLabel.fontWeight != null ? `${axisLabel.fontWeight} ` : ''\n\n return {\n firstLabel: cellToText(rows[0]?.[encodeX], fmt),\n lastLabel: cellToText(rows[rows.length - 1]?.[encodeX], fmt),\n font: `${weight}${size} ${family}`,\n count: source.length,\n }\n}\n\n/**\n * Measures the rendered chart and, when the edge labels would clip, applies\n * `alignMinLabel`/`alignMaxLabel` (or clears them) via an imperative merge\n * `setOption`. Returns the alignment now in effect so the caller can keep a\n * `prev` ref and skip redundant `setOption`s. Should be invoked from the\n * chart's `finished` event (layout is settled, so `convertToPixel` is valid).\n */\nexport function clampEdgeLabels(\n chart: ECharts,\n option: EChartsOption,\n prev: EdgeAlignment,\n): EdgeAlignment {\n const next = computeAlignment(chart, option)\n if (\n next.alignMinLabel === prev.alignMinLabel &&\n next.alignMaxLabel === prev.alignMaxLabel\n ) {\n return prev\n }\n chart.setOption({ xAxis: { axisLabel: { ...next } } } as EChartsOption, {\n lazyUpdate: true,\n })\n return next\n}\n\nfunction computeAlignment(\n chart: ECharts,\n option: EChartsOption,\n): EdgeAlignment {\n // Under dataZoom, convertToPixel on the absolute first/last index returns\n // off-plot pixels, so the overflow math is invalid — reset to centered.\n if (hasDataZoom(option)) return CENTERED\n\n const labels = resolveEdgeLabels(option)\n if (!labels) return CENTERED\n\n const firstTickX = chart.convertToPixel({ xAxisIndex: 0 }, 0)\n const lastTickX = chart.convertToPixel({ xAxisIndex: 0 }, labels.count - 1)\n const width = chart.getWidth()\n // Layout not measurable yet (defensive — `finished` normally fires after\n // layout). Fall back to centered; a later `finished` re-measures.\n if (\n typeof firstTickX !== 'number' ||\n typeof lastTickX !== 'number' ||\n !Number.isFinite(firstTickX) ||\n !Number.isFinite(lastTickX) ||\n !width\n ) {\n return CENTERED\n }\n\n return decideEdgeAlignment({\n firstLabel: labels.firstLabel,\n lastLabel: labels.lastLabel,\n font: labels.font,\n firstTickX,\n lastTickX,\n width,\n })\n}\n","type ResizeCallback = () => void\n\nconst callbacks = new Map<Element, ResizeCallback>()\nlet observer: ResizeObserver | null = null\n\n/**\n * Returns the singleton ResizeObserver, lazily constructing it on first use.\n * Returns `null` when `ResizeObserver` is not available in the global scope\n * (SSR, very old browsers, or tests that intentionally remove it).\n */\nfunction getObserver(): ResizeObserver | null {\n if (typeof ResizeObserver === 'undefined') return null\n observer ??= new ResizeObserver((entries) => {\n for (const entry of entries) {\n const callback = callbacks.get(entry.target)\n callback?.()\n }\n })\n return observer\n}\n\nconst NOOP_CLEANUP = (): void => undefined\n\nexport function observeResize(\n element: Element,\n callback: ResizeCallback,\n): () => void {\n const ro = getObserver()\n // Gracefully degrade when no ResizeObserver is available — consumers\n // still see one initial measure() pass via their own effect; we just\n // skip the subsequent resize-driven re-measures.\n if (!ro) return NOOP_CLEANUP\n callbacks.set(element, callback)\n ro.observe(element)\n return () => {\n callbacks.delete(element)\n if (observer) {\n observer.unobserve(element)\n // Disconnect the singleton once the last subscriber leaves so the\n // observer doesn't outlive its consumers in SSR teardown / micro-\n // frontend unmount scenarios. A subsequent observeResize() will\n // lazily re-create it via getObserver().\n if (callbacks.size === 0) {\n observer.disconnect()\n observer = null\n }\n }\n }\n}\n\n/** @internal — for tests only. */\nexport function __resetSharedResizeObserver(): void {\n if (observer) observer.disconnect()\n callbacks.clear()\n observer = null\n}\n","import type { SxProps, Theme } from '@mui/material'\n\nexport const styles = {\n root: {\n width: '100%',\n minHeight: 0,\n },\n} satisfies Record<string, SxProps<Theme>>\n","import { useEffect, useEffectEvent, useRef } from 'react'\nimport { Box, type SxProps, type Theme } from '@mui/material'\nimport * as echarts from 'echarts'\nimport {\n clampEdgeLabels,\n CENTERED,\n type EdgeAlignment,\n} from './edge-label-clamp'\nimport { observeResize } from './shared-resize-observer'\nimport { styles } from './style'\n\nexport const DEFAULT_INIT_OPTS = {\n renderer: 'svg',\n height: 304,\n} satisfies echarts.EChartsInitOpts\n\nexport type EchartsEventHandler = (event: unknown) => void\n\nexport interface EchartUIProps {\n option: echarts.EChartsOption\n /**\n * Keys to merge as arrays (replace by index) instead of by id. The middleware\n * memoizes this content-stably, so identical sets don't re-trigger setOption.\n */\n replaceMerge?: readonly string[]\n /**\n * Opaque ECharts event passthrough — handlers fire untransformed.\n *\n * **Must be referentially stable** (memoize it with `useMemo` /\n * `useCallback`, or hoist to module scope). The binding effect depends on\n * the `onEvents` object identity; an inline `{ click: handler }` literal\n * recreates the object on every render and causes every listener to be\n * detached and re-attached each commit.\n */\n onEvents?: Record<string, EchartsEventHandler>\n /**\n * Init options forwarded to echarts.init. Captured at mount only — to change\n * `renderer` or `height` after mount, unmount and remount the chart.\n * Defaults: `{ renderer: 'svg', height: 304 }`.\n */\n init?: echarts.EChartsInitOpts\n /**\n * Optional callback fired once after the ECharts instance is created\n * (`onInstance(chart)`) and once when it's about to be disposed\n * (`onInstance(null)`). Used by `Widget.Echart` to publish the live\n * instance to the per-widget registry so other actions (e.g.\n * `ZoomToggle`'s disable handler) can reach it without DOM lookups.\n * No need to memoize — the bridge wraps it in `useEffectEvent` so an\n * unstable reference does not re-init the chart.\n */\n onInstance?: (chart: echarts.ECharts | null) => void\n className?: string\n sx?: SxProps<Theme>\n}\n\nexport function EchartUI({\n option,\n replaceMerge,\n onEvents,\n init,\n onInstance,\n className,\n sx,\n}: EchartUIProps) {\n const containerRef = useRef<HTMLDivElement>(null)\n const chartRef = useRef<echarts.ECharts | null>(null)\n\n // Structural fingerprint of the last applied series / dataset arrays.\n // Used to decide whether the next `setOption` should *replace* those\n // components (when their shape changed) or *merge* them (when only\n // styling-level fields differ — e.g. a new `itemStyle.color` callback\n // from a selection update). Replacing wipes ECharts' per-series runtime\n // state (hover, animation cache, brush areas), so we want to do it only\n // when the structure actually moved.\n const seriesFingerprintRef = useRef<string | null>(null)\n const datasetFingerprintRef = useRef<string | null>(null)\n\n // Latest applied option (read by the `finished` clamp listener, which is\n // bound once and must see the current option) + the edge-label alignment\n // currently applied to the chart (so the clamp skips redundant setOptions).\n const optionRef = useRef<echarts.EChartsOption>(option)\n const edgeAlignRef = useRef<EdgeAlignment>(CENTERED)\n\n // Stable notify wrapper — always reads the latest `onInstance` prop\n // without forcing the init effect below to re-run when the parent\n // passes a fresh function reference. The init effect now only fires\n // when `init` actually changes (documented as mount-only anyway).\n const notifyInstance = useEffectEvent(\n (chart: echarts.ECharts | null): void => {\n onInstance?.(chart)\n },\n )\n\n // Init / dispose. `init` is captured once at mount.\n useEffect(() => {\n if (!containerRef.current) return undefined\n const chart = echarts.init(containerRef.current, null, {\n ...DEFAULT_INIT_OPTS,\n ...init,\n })\n chartRef.current = chart\n notifyInstance(chart)\n // Edge-label clamp: after each layout settles (option change OR resize both\n // end in a render → `finished`), measure the category x-axis edge labels\n // and anchor them inward only if they'd clip. `finished` (not rAF) so\n // `convertToPixel` sees the flushed `lazyUpdate` layout. Loop-safe: the\n // verdict is anchor-independent, so our own clamp setOption recomputes the\n // same result and the ref guard short-circuits.\n const onFinished = (): void => {\n edgeAlignRef.current = clampEdgeLabels(\n chart,\n optionRef.current,\n edgeAlignRef.current,\n )\n }\n chart.on('finished', onFinished)\n return () => {\n chart.off('finished', onFinished)\n // Notify observers *before* disposal so any queued imperative\n // dispatches (e.g. ZoomToggle's `setOption` cleanup) see the\n // instance disappear before its DOM is torn down.\n notifyInstance(null)\n chart.dispose()\n chartRef.current = null\n }\n }, [init])\n\n // Apply option / replaceMerge changes via merge mode (no remount required).\n useEffect(() => {\n const seriesFp = computeSeriesFingerprint(option)\n const datasetFp = computeDatasetFingerprint(option)\n const augmented = new Set<string>(replaceMerge ?? [])\n if (seriesFp !== seriesFingerprintRef.current) augmented.add('series')\n if (datasetFp !== datasetFingerprintRef.current) augmented.add('dataset')\n seriesFingerprintRef.current = seriesFp\n datasetFingerprintRef.current = datasetFp\n // Expose the latest option to the `finished` clamp listener (bound once).\n optionRef.current = option\n chartRef.current?.setOption(option, {\n notMerge: false,\n lazyUpdate: true,\n replaceMerge: augmented.size > 0 ? Array.from(augmented) : undefined,\n })\n }, [option, replaceMerge])\n\n // Resize via shared singleton observer.\n useEffect(() => {\n const node = containerRef.current\n if (!node) return undefined\n return observeResize(node, () => {\n chartRef.current?.resize()\n })\n }, [])\n\n // Bind / unbind opaque event handlers.\n useEffect(() => {\n const chart = chartRef.current\n if (!chart || !onEvents) return undefined\n for (const [event, handler] of Object.entries(onEvents)) {\n chart.on(event, handler)\n }\n return () => {\n for (const [event, handler] of Object.entries(onEvents)) {\n chart.off(event, handler)\n }\n }\n }, [onEvents])\n\n return (\n <Box\n ref={containerRef}\n className={className}\n sx={{ ...styles.root, ...sx }}\n />\n )\n}\n\n/**\n * Cheap structural digest of the option's `series` array — covers the fields\n * that actually demand a `replaceMerge` (length, type, datasetIndex, name,\n * stack, encode). Excludes runtime-style fields like `itemStyle` (callbacks\n * have unstable identity but don't change structure).\n */\nfunction computeSeriesFingerprint(option: echarts.EChartsOption): string {\n const series = option.series\n if (!Array.isArray(series)) return series ? '1' : ''\n return series\n .map((s) => {\n if (s == null || typeof s !== 'object') return String(s)\n const o = s as Record<string, unknown>\n return [\n o.type,\n o.datasetIndex,\n o.name,\n o.stack,\n // `encode` is small; stringify is cheap and stable for plain objects.\n JSON.stringify(o.encode ?? null),\n ].join('|')\n })\n .join('||')\n}\n\n/**\n * Structural digest of the option's `dataset` array — count is the only\n * thing that needs `replaceMerge` here. Row-level changes are picked up by\n * ECharts' default merge.\n */\nfunction computeDatasetFingerprint(option: echarts.EChartsOption): string {\n const dataset = option.dataset\n if (!Array.isArray(dataset)) return dataset ? '1' : ''\n return String(dataset.length)\n}\n","import { useCallback, useMemo } from 'react'\nimport type * as echarts from 'echarts'\nimport {\n applyTransforms,\n setEchartInstance,\n useWidgetId,\n useWidgetShallow,\n type Transform,\n} from '../stores'\nimport { EchartUI, type EchartsEventHandler } from './echart-ui'\n\n/**\n * Default ECharts `replaceMerge` keys for every widget. `dataZoom` and\n * `brush` are omitted so ZoomToggle / BrushToggle's user-driven runtime\n * state (slider range, brushed areas in `multiple` mode) survives unrelated\n * re-renders. `series` and `dataset` are also omitted: EchartUI fingerprints\n * them per-render and adds them to `replaceMerge` only when their shape\n * actually changes, keeping ECharts' per-series runtime state alive when\n * only callback-style fields differ.\n *\n * Lives in this module (not the generic store) because it's an ECharts\n * concept. Module-private — callers should not need it.\n */\nconst DEFAULT_REPLACE_MERGE: readonly string[] = ['toolbox']\n\n/**\n * Reactive context passed to every {@link OptionFactory} call so the\n * factory can rebuild render-time pieces (axis label / tooltip formatters)\n * from the live store. Drives RelativeData / consumer-formatter changes\n * through to the chart without rebuilding the structural option.\n */\nexport interface OptionFactoryContext {\n formatter?: (value: number) => string\n labelFormatter?: (value: string | number) => string | number\n}\n\n/**\n * The per-widget option factory — a single callable that owns BOTH phases\n * of option construction:\n *\n * - **Structural phase** — when `option == null`, return the theme-aware\n * structural option (tooltip / legend / color palette / series\n * template, optionally merged with a consumer-supplied `optionsOverride`).\n * No data is read. `<Widget.Echart>` calls the factory with\n * `(undefined, undefined)` synchronously during render to derive the\n * structural base; `configTransforms` (Stack/Zoom/Brush) then mutate it\n * in the same render pass.\n * - **Merge phase** — when `option` is defined, fuse `data` into the\n * post-configTransforms option at fusion time. `<Widget.Echart>` calls\n * the factory with `(transformed, data, ctx)` on every render.\n *\n * The two phases share a closure (the factory creator captures `theme`,\n * `formatter`, `labelFormatter`, `seriesNames`, `selection`, `optionsOverride`,\n * …), so structural and merge agree on the same widget configuration.\n *\n * The third arg `ctx` carries the **live** store-side formatters at the\n * call site — distinct from the closure-time formatters because actions\n * like RelativeData can install a percent formatter on the store after\n * the factory was constructed. The merge phase reads from `ctx`; the\n * structural phase typically uses the closure-time values.\n */\nexport type OptionFactory = (\n option: echarts.EChartsOption | undefined,\n data: unknown,\n ctx?: OptionFactoryContext,\n) => echarts.EChartsOption\n\nexport interface EchartProps {\n /**\n * The per-widget {@link OptionFactory}. Required — `<Widget.Echart>`\n * derives the structural option from it (so configTransforms have a base\n * to mutate) and fuses `state.data` into the post-pipeline option at\n * render time. Wrap the factory creator in `useMemo` so its identity is\n * stable across renders.\n */\n optionFactory: OptionFactory\n onEvents?: Record<string, EchartsEventHandler>\n init?: echarts.EChartsInitOpts\n className?: string\n}\n\ninterface EchartSlice {\n data: unknown\n configTransforms: readonly Transform[]\n formatter?: (value: number) => string\n labelFormatter?: (value: string | number) => string | number\n}\n\nconst echartSelector = (s: {\n data: unknown\n configTransforms: readonly Transform[]\n formatter?: (value: number) => string\n labelFormatter?: (value: string | number) => string | number\n}): EchartSlice => ({\n data: s.data,\n configTransforms: s.configTransforms,\n formatter: s.formatter,\n labelFormatter: s.labelFormatter,\n})\n\n/**\n * Stateful Echart bridge — owns the entire ECharts coupling. The whole\n * option pipeline lives here, not in the store:\n *\n * 1. **Structural** — `optionFactory(undefined, undefined)` produces the\n * theme-aware base. Memoized on the factory identity, so the consumer's\n * `useMemo` ID gates the rebuild.\n * 2. **Transformed** — `applyTransforms(structural, configTransforms)`\n * applies any registered configTransforms (Stack/Zoom/Brush) over the\n * structural base. Memoized on `[structural, configTransforms]`.\n * 3. **`replaceMerge`** — derived from the enabled configTransforms'\n * `replaceMergeKeys`, deduped and sorted, seeded with\n * {@link DEFAULT_REPLACE_MERGE}. Memoized on `[configTransforms]` so\n * ECharts sees a stable array reference across non-transform changes.\n * 4. **Merge** — `optionFactory(transformed, data, ctx)` fuses post-\n * pipeline data into the option. Reactive `ctx` carries the live store\n * formatters so RelativeData's percent formatter flows through without\n * a structural rebuild.\n *\n * The `<Widget.Provider>` doesn't know about the factory at all: it stays\n * a renderer-agnostic shell. The `ProviderProps` surface has no ECharts\n * coupling, so non-Echart widgets don't transitively import the type.\n */\nexport function Echart({\n optionFactory,\n onEvents,\n init,\n className,\n}: EchartProps) {\n const id = useWidgetId()\n const slice = useWidgetShallow(id, echartSelector)\n\n // Publish the live ECharts instance to the per-id registry so actions\n // (e.g. `ZoomToggle`'s disable handler) can reach it imperatively. The\n // callback identity is stable across renders (only `id` is in deps), so\n // EchartUI's init effect doesn't see a fresh `onInstance` and re-init.\n const onInstance = useCallback(\n (chart: echarts.ECharts | null) => setEchartInstance(id, chart),\n [id],\n )\n\n // Destructure so React Compiler sees specific deps instead of inferring\n // the whole `slice` object. `useWidgetShallow` already shallow-compares\n // the slice, so per-field deps drive each memo exactly when its inputs\n // change.\n const {\n data: sliceData,\n configTransforms,\n formatter: sliceFormatter,\n labelFormatter: sliceLabelFormatter,\n } = slice\n\n const structural = useMemo(\n () => optionFactory(undefined, undefined),\n [optionFactory],\n )\n\n const transformed = useMemo(\n () =>\n applyTransforms(structural, configTransforms) as echarts.EChartsOption,\n [structural, configTransforms],\n )\n\n const replaceMerge = useMemo(() => {\n const keys = new Set<string>(DEFAULT_REPLACE_MERGE)\n for (const xf of configTransforms) {\n if (xf.enabled && xf.replaceMergeKeys?.length) {\n for (const k of xf.replaceMergeKeys) keys.add(k)\n }\n }\n return Array.from(keys).sort()\n }, [configTransforms])\n\n const option = useMemo(\n () =>\n optionFactory(transformed, sliceData, {\n formatter: sliceFormatter,\n labelFormatter: sliceLabelFormatter,\n }),\n [\n optionFactory,\n transformed,\n sliceData,\n sliceFormatter,\n sliceLabelFormatter,\n ],\n )\n\n return (\n <EchartUI\n option={option}\n replaceMerge={replaceMerge}\n onEvents={onEvents}\n init={init}\n onInstance={onInstance}\n className={className}\n />\n )\n}\n"],"names":["CENTERED","alignMinLabel","alignMaxLabel","SAFETY_MARGIN_PX","decideEdgeAlignment","args","halfFirst","echarts","format","getTextRect","firstLabel","font","width","halfLast","lastLabel","firstTickX","lastTickX","firstOf","value","Array","isArray","firstXAxis","option","axis","xAxis","undefined","hasDataZoom","dz","dataZoom","length","cellToText","fmt","String","resolveEdgeLabels","type","series0","series","encodeX","encode","x","datasetIndex","allDatasets","dataset","source","rows","axisLabel","formatter","size","fontSize","family","fontFamily","weight","fontWeight","count","clampEdgeLabels","chart","prev","next","computeAlignment","setOption","lazyUpdate","labels","convertToPixel","xAxisIndex","getWidth","Number","isFinite","callbacks","Map","observer","getObserver","ResizeObserver","entries","entry","callback","get","target","NOOP_CLEANUP","observeResize","element","ro","set","observe","delete","unobserve","disconnect","__resetSharedResizeObserver","clear","styles","root","minHeight","DEFAULT_INIT_OPTS","renderer","height","EchartUI","t0","$","_c","replaceMerge","onEvents","init","onInstance","className","sx","containerRef","useRef","chartRef","seriesFingerprintRef","datasetFingerprintRef","optionRef","edgeAlignRef","t1","notifyInstance","useEffectEvent","t2","current","chart_0","onFinished","on","off","dispose","t3","useEffect","t4","t5","seriesFp","computeSeriesFingerprint","datasetFp","computeDatasetFingerprint","augmented","Set","add","notMerge","from","t6","t7","Symbol","for","node","resize","t8","t9","chart_1","event","handler","Object","event_0","handler_0","t10","t11","Box","map","s","o","name","stack","JSON","stringify","join","DEFAULT_REPLACE_MERGE","echartSelector","data","configTransforms","labelFormatter","Echart","optionFactory","id","useWidgetId","slice","useWidgetShallow","setEchartInstance","sliceData","sliceFormatter","sliceLabelFormatter","structural","applyTransforms","transformed","keys","xf","enabled","replaceMergeKeys","k","sort"],"mappings":";;;;;;;;AAyBO,MAAMA,IAA0B;AAAA,EACrCC,eAAe;AAAA,EACfC,eAAe;AACjB,GAQMC,IAAmB;AAQlB,SAASC,EAAoBC,GAOlB;AAChB,QAAMC,IACJC,EAAQC,OAAOC,YAAYJ,EAAKK,YAAYL,EAAKM,IAAI,EAAEC,QAAQ,GAC3DC,IACJN,EAAQC,OAAOC,YAAYJ,EAAKS,WAAWT,EAAKM,IAAI,EAAEC,QAAQ;AAChE,SAAO;AAAA,IACLX,eACEK,IAAYH,IAAmBE,EAAKU,aAAa,SAAS;AAAA,IAC5Db,eACEW,IAAWV,IAAmBE,EAAKO,QAAQP,EAAKW,YAC5C,UACA;AAAA,EAAA;AAEV;AAqBA,SAASC,EAAWC,GAA2C;AAC7D,SAAIC,MAAMC,QAAQF,CAAK,IAAUA,EAAM,CAAC,IACjCA;AACT;AAEA,SAASG,EAAWC,GAAkD;AACpE,QAAMC,IAAON,EACXK,EAAOE,KACT;AACA,SAAOD,KAAQ,OAAOA,KAAS,WAAWA,IAAOE;AACnD;AAEA,SAASC,EAAYJ,GAAgC;AACnD,QAAMK,IAAKL,EAAOM;AAClB,SAAOT,MAAMC,QAAQO,CAAE,IAAIA,EAAGE,SAAS,IAAIF,KAAM;AACnD;AAEA,SAASG,EAAWZ,GAAaa,GAAqC;AACpE,SAAI,OAAOA,KAAQ,aAAmBC,OAAOD,EAAIb,KAAS,EAAE,CAAC,IACtDA,KAAS,OAAO,KAAKc,OAAOd,CAAK;AAC1C;AASO,SAASe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AAA7H,WACzB8H;AAAAA,IAAcT,gBACTU;AAAAA,EAAAA,CACjB,GAAC7E,OAAAqE,GAAArE,QAAA2E,GAAA3E,QAAA4E,GAAA5E,QAAA6E,GAAA7E,QAAAgF,GAAAhF,QAAA4B,KAAAA,IAAA5B,EAAA,EAAA;AALN,QAAA1E,IAEIsG;AAWH,MAAAU;AAAA,SAAAtC,UAAAM,KAAAN,EAAA,EAAA,MAAAI,KAAAJ,EAAA,EAAA,MAAAG,KAAAH,EAAA,EAAA,MAAAK,KAAAL,UAAA1E,KAAA0E,EAAA,EAAA,MAAAE,KAGCoC,sBAACxC,IAAA,EACSxE,QAAAA,GACM4E,cAAAA,GACJC,UAAAA,GACJC,MAAAA,GACMC,YAAAA,GACDC,WAAAA,GAAS,GACpBN,QAAAM,GAAAN,QAAAI,GAAAJ,QAAAG,GAAAH,QAAAK,GAAAL,QAAA1E,GAAA0E,QAAAE,GAAAF,QAAAsC,KAAAA,IAAAtC,EAAA,EAAA,GAPFsC;AAOE;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function
|
|
1
|
+
function b(t) {
|
|
2
2
|
if (t === 0) return 0;
|
|
3
3
|
const e = Math.abs(t), n = Math.pow(10, Math.floor(Math.log10(e))), i = Math.ceil(e / n) * n;
|
|
4
4
|
return t < 0 ? -i : i;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function y({
|
|
7
7
|
hasLegend: t,
|
|
8
8
|
labelFormatter: e
|
|
9
9
|
}) {
|
|
@@ -19,7 +19,7 @@ function b({
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function m(t, e) {
|
|
23
23
|
return {
|
|
24
24
|
...!t && {
|
|
25
25
|
bottom: parseInt(e.spacing(3))
|
|
@@ -29,60 +29,67 @@ function h(t, e) {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function h(t) {
|
|
33
|
+
return {
|
|
34
|
+
fontSize: t.typography.overlineDelicate?.fontSize,
|
|
35
|
+
fontFamily: t.typography.overlineDelicate?.fontFamily,
|
|
36
|
+
color: t.palette.black?.[60] ?? t.palette.text.secondary
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function x(t) {
|
|
40
|
+
return function(e, n, i, o, r) {
|
|
34
41
|
const a = {
|
|
35
42
|
top: parseInt(t.spacing(0.5))
|
|
36
43
|
};
|
|
37
|
-
return
|
|
44
|
+
return r.contentSize[0] < r.viewSize[0] - e[0] ? a.left = e[0] : a.right = r.viewSize[0] - e[0], a;
|
|
38
45
|
};
|
|
39
46
|
}
|
|
40
47
|
function d(t) {
|
|
41
48
|
if (t)
|
|
42
49
|
return (e) => t(e);
|
|
43
50
|
}
|
|
44
|
-
function
|
|
45
|
-
const n = t && !Array.isArray(t), i = t,
|
|
51
|
+
function v(t, e) {
|
|
52
|
+
const n = t && !Array.isArray(t), i = t, o = e && n ? (r) => String(e(r)) : void 0;
|
|
46
53
|
return {
|
|
47
54
|
...i,
|
|
48
55
|
axisLabel: {
|
|
49
56
|
...typeof i.axisLabel == "object" && i.axisLabel ? i.axisLabel : {},
|
|
50
|
-
formatter:
|
|
57
|
+
formatter: o
|
|
51
58
|
}
|
|
52
59
|
};
|
|
53
60
|
}
|
|
54
|
-
function
|
|
61
|
+
function F(t, e) {
|
|
55
62
|
let n = d(e);
|
|
56
|
-
const i = t && !Array.isArray(t),
|
|
57
|
-
return (!i ||
|
|
58
|
-
...
|
|
63
|
+
const i = t && !Array.isArray(t), o = t;
|
|
64
|
+
return (!i || o.type !== "value") && (n = void 0), {
|
|
65
|
+
...o,
|
|
59
66
|
axisLabel: {
|
|
60
|
-
...typeof
|
|
67
|
+
...typeof o.axisLabel == "object" && o.axisLabel ? o.axisLabel : {},
|
|
61
68
|
formatter: n
|
|
62
69
|
}
|
|
63
70
|
};
|
|
64
71
|
}
|
|
65
|
-
function
|
|
72
|
+
function S(t) {
|
|
66
73
|
return (e) => {
|
|
67
|
-
const n = Array.isArray(e) ? e : [e], i = (s, l) => `<div style="margin: 0px 0 0;line-height:1;">${s ? `<div style="font-size:11px;color:#FFFFFF;font-weight:400;line-height:1; margin-bottom: 10px">${s}</div>` : ""}<div style="margin: 0;line-height:1;">${l}</div><div style="clear:both"></div></div>`,
|
|
74
|
+
const n = Array.isArray(e) ? e : [e], i = (s, l) => `<div style="margin: 0px 0 0;line-height:1;">${s ? `<div style="font-size:11px;color:#FFFFFF;font-weight:400;line-height:1; margin-bottom: 10px">${s}</div>` : ""}<div style="margin: 0;line-height:1;">${l}</div><div style="clear:both"></div></div>`, o = n.map((s) => {
|
|
68
75
|
const {
|
|
69
76
|
name: l,
|
|
70
77
|
seriesName: c,
|
|
71
|
-
marker:
|
|
72
|
-
value:
|
|
78
|
+
marker: p,
|
|
79
|
+
value: g
|
|
73
80
|
} = t(s, n);
|
|
74
81
|
return {
|
|
75
82
|
name: l,
|
|
76
83
|
seriesName: c,
|
|
77
|
-
marker:
|
|
78
|
-
value:
|
|
84
|
+
marker: p,
|
|
85
|
+
value: g
|
|
79
86
|
};
|
|
80
|
-
}),
|
|
87
|
+
}), r = o[0]?.name ?? "", u = r || n.length > 1 ? "margin: 10px 0 0;line-height:1;" : "margin: 0;line-height:1;", f = o.map(({
|
|
81
88
|
seriesName: s,
|
|
82
89
|
marker: l,
|
|
83
90
|
value: c
|
|
84
91
|
}) => `<div style="${u}"><div style="margin: 0px 0 0;line-height:1;">${l}${s ? `<span style="font-size:11px;color:#FFFFFF;font-weight:400;margin-left:2px;margin-right:10px">${s}</span>` : ""}<span style="float:right;margin-left:10px;font-size:11px;color:#FFFFFF;font-weight:900">${c}</span></div></div>`);
|
|
85
|
-
return i(
|
|
92
|
+
return i(r, f.join(""));
|
|
86
93
|
};
|
|
87
94
|
}
|
|
88
95
|
function L(t, e = "y") {
|
|
@@ -91,7 +98,7 @@ function L(t, e = "y") {
|
|
|
91
98
|
formatter: (n) => {
|
|
92
99
|
const i = n.encode?.[e]?.[0];
|
|
93
100
|
if (i === void 0) return "";
|
|
94
|
-
const
|
|
101
|
+
const o = n.dimensionNames?.[i], r = n.value, a = o ? r[o] : void 0;
|
|
95
102
|
return typeof a == "number" ? t(a) : String(a ?? "");
|
|
96
103
|
}
|
|
97
104
|
}
|
|
@@ -108,15 +115,16 @@ function w(t) {
|
|
|
108
115
|
} : {};
|
|
109
116
|
}
|
|
110
117
|
export {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
v as a,
|
|
119
|
+
F as b,
|
|
120
|
+
m as c,
|
|
121
|
+
y as d,
|
|
115
122
|
d as e,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
S as f,
|
|
124
|
+
x as g,
|
|
125
|
+
h,
|
|
126
|
+
L as i,
|
|
127
|
+
w as j,
|
|
128
|
+
b as n
|
|
121
129
|
};
|
|
122
|
-
//# sourceMappingURL=option-builders-
|
|
130
|
+
//# sourceMappingURL=option-builders-DPeoyQaM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-builders-DPeoyQaM.js","sources":["../src/widgets/utils/chart-config/option-builders.ts"],"sourcesContent":["import type { Theme } from '@mui/material'\nimport type { LegendComponentOption } from 'echarts'\nimport type {\n CallbackDataParams,\n TopLevelFormatterParams,\n} from 'echarts/types/dist/shared'\n\n/**\n * Shared EChart configuration builders for chart widgets\n */\n\n/**\n * Rounds a value up to the nearest \"nice\" number.\n * A nice number is a multiple of 10^floor(log10(value)).\n *\n * Examples: 547 → 600, 200 → 200, 1200 → 2000, 18 → 20, 5 → 5, -547 → -500\n */\nexport function niceNum(value: number): number {\n if (value === 0) return 0\n const absValue = Math.abs(value)\n const base = Math.pow(10, Math.floor(Math.log10(absValue)))\n const rounded = Math.ceil(absValue / base) * base\n return value < 0 ? -rounded : rounded\n}\n\n/**\n * Builds standard legend configuration for chart widgets\n *\n * @param params - Legend configuration parameters\n * @param params.hasLegend - Whether to show the legend\n * @param params.labelFormatter - Optional formatter for legend item names\n * @returns Legend configuration object\n */\nexport function buildLegendConfig({\n hasLegend,\n labelFormatter,\n}: {\n hasLegend: boolean\n labelFormatter?: (value: string | number) => string | number\n}): LegendComponentOption {\n return {\n show: hasLegend,\n icon: 'circle' as const,\n left: 0,\n bottom: 0,\n orient: 'horizontal',\n type: 'scroll',\n ...(labelFormatter && {\n formatter: (name: string) => String(labelFormatter(name)),\n }),\n }\n}\n\n/**\n * Builds standard grid configuration with legend-aware spacing\n *\n * @param hasLegend - Whether the chart has a legend\n * @param theme - MUI theme for spacing\n * @param additionalConfig - Additional grid configuration to merge\n * @returns Grid configuration object\n */\nexport function buildGridConfig(hasLegend: boolean, theme: Theme) {\n return {\n ...(!hasLegend && { bottom: parseInt(theme.spacing(3)) }),\n ...(hasLegend && { bottom: parseInt(theme.spacing(7)) }),\n }\n}\n\n/**\n * Builds the shared axis-label text style for chart widgets, matching the\n * design's \"Overline (Delicate)\" token (Inter, 10px) in the secondary text\n * colour (`rgba(44,48,50,0.6)`). Spread into an ECharts `axisLabel` for both\n * x and y axes so every chart's labels stay consistent.\n *\n * Note: the token's `letterSpacing` and `textTransform: uppercase` are not\n * representable in ECharts canvas text, so only font size/family/colour are\n * applied.\n *\n * @param theme - MUI theme providing the typography token and palette\n * @returns `{ fontSize, fontFamily, color }` for an ECharts `axisLabel`\n */\nexport function buildAxisLabelStyle(theme: Theme) {\n return {\n fontSize: theme.typography.overlineDelicate?.fontSize,\n fontFamily: theme.typography.overlineDelicate?.fontFamily,\n color: theme.palette.black?.[60] ?? theme.palette.text.secondary,\n }\n}\n\n/**\n * Creates a tooltip position calculator that handles overflow\n * Used by bar, histogram, and scatterplot widgets\n *\n * @param theme - MUI theme for spacing\n * @returns Tooltip position function\n */\nexport function createTooltipPositioner(theme: Theme) {\n return function (\n point: [number, number],\n _params: unknown,\n _dom: unknown,\n _rect: unknown,\n size: { contentSize: [number, number]; viewSize: [number, number] },\n ) {\n const position = { top: parseInt(theme.spacing(0.5)) } as Record<\n string,\n number\n >\n\n // Position tooltip left or right based on available space\n if (size.contentSize[0] < size.viewSize[0] - point[0]) {\n position.left = point[0]\n } else {\n position.right = size.viewSize[0] - point[0]\n }\n\n return position\n }\n}\n\n/**\n * Creates an axis label formatter for ECharts\n * Used to format numeric axis labels with a widget formatter\n *\n * @param formatter - Optional formatter function from widget config\n * @returns Axis label formatter function or undefined\n */\nexport function createAxisLabelFormatter(\n formatter?: (value: number) => string,\n) {\n if (!formatter) return undefined\n return (value: number) => formatter(value)\n}\n\n/**\n * Applies labelFormatter to xAxis configuration\n * Applies to any xAxis regardless of axis type (category, value, etc.)\n *\n * @param xAxis - Existing xAxis configuration\n * @param labelFormatter - Optional labelFormatter function from widget config\n * @returns Updated xAxis configuration\n */\nexport function applyXAxisFormatter(\n xAxis: unknown,\n formatter?: (value: string | number) => string | number,\n) {\n const xAxisIsObject = xAxis && !Array.isArray(xAxis)\n const xAxisTyped = xAxis as { type?: string; axisLabel?: unknown }\n\n const axisFormatter =\n formatter && xAxisIsObject\n ? (value: string | number) => String(formatter(value))\n : undefined\n\n return {\n ...xAxisTyped,\n axisLabel: {\n ...(typeof xAxisTyped.axisLabel === 'object' && xAxisTyped.axisLabel\n ? xAxisTyped.axisLabel\n : {}),\n formatter: axisFormatter,\n },\n }\n}\n\n/**\n * Applies formatter to yAxis configuration\n * Only applies to single axis objects (not arrays) with type 'value'\n *\n * @param yAxis - Existing yAxis configuration\n * @param formatter - Optional formatter function from widget config\n * @returns Updated yAxis configuration or undefined if no changes needed\n */\nexport function applyYAxisFormatter(\n yAxis: unknown,\n formatter?: (value: number) => string,\n) {\n let axisFormatter = createAxisLabelFormatter(formatter)\n\n const yAxisIsObject = yAxis && !Array.isArray(yAxis)\n const yAxisTyped = yAxis as { type?: string; axisLabel?: unknown }\n\n if (!yAxisIsObject || yAxisTyped.type !== 'value') {\n axisFormatter = undefined\n }\n\n return {\n ...yAxisTyped,\n axisLabel: {\n ...(typeof yAxisTyped.axisLabel === 'object' && yAxisTyped.axisLabel\n ? yAxisTyped.axisLabel\n : {}),\n formatter: axisFormatter,\n },\n }\n}\n\n/**\n * Creates a tooltip formatter for ECharts\n * Formats numeric values in tooltip using widget formatter\n * Handles both axis trigger (array) and item trigger (object) modes\n *\n * @param formatter - Optional formatter function from widget config\n * @returns Tooltip formatter function or undefined\n */\nexport function createTooltipFormatter(\n callback: (\n item: CallbackDataParams,\n items: CallbackDataParams[],\n ) => {\n name: string\n seriesName: string\n marker: string\n value: string | number\n },\n) {\n return (params: TopLevelFormatterParams) => {\n // Handle both array (axis trigger) and object (item trigger)\n const items = Array.isArray(params) ? params : [params]\n\n const tooltip = (name: string, callback: string) =>\n `<div style=\"margin: 0px 0 0;line-height:1;\">${name ? `<div style=\"font-size:11px;color:#FFFFFF;font-weight:400;line-height:1; margin-bottom: 10px\">${name}</div>` : ''}<div style=\"margin: 0;line-height:1;\">${callback}</div><div style=\"clear:both\"></div></div>`\n\n const values = items.map((item) => {\n const { name, seriesName, marker, value } = callback(item, items)\n return {\n name,\n seriesName,\n marker,\n value,\n }\n })\n\n const name = values[0]?.name ?? ''\n // Show margin if name exists or there are multiple items\n const showMargin = name || items.length > 1\n const marginStyle = showMargin\n ? 'margin: 10px 0 0;line-height:1;'\n : 'margin: 0;line-height:1;'\n\n const formattedValues = values.map(\n ({ seriesName, marker, value }) =>\n `<div style=\"${marginStyle}\"><div style=\"margin: 0px 0 0;line-height:1;\">${marker}${seriesName ? `<span style=\"font-size:11px;color:#FFFFFF;font-weight:400;margin-left:2px;margin-right:10px\">${seriesName}</span>` : ''}<span style=\"float:right;margin-left:10px;font-size:11px;color:#FFFFFF;font-weight:900\">${value}</span></div></div>`,\n )\n\n return tooltip(name, formattedValues.join(''))\n }\n}\n\n/**\n * Builds a series `label` config that applies formatter to the data value\n * extracted from a dataset row using ECharts encode/dimensionNames.\n *\n * Does not set `show` — labels remain hidden by default per ECharts defaults.\n *\n * @param formatter - Optional numeric value formatter\n * @param encodeKey - The encode dimension key to extract ('y' for vertical charts, 'x' for horizontal)\n */\nexport function buildSeriesLabelConfig(\n formatter?: (value: number) => string,\n encodeKey = 'y',\n): { label: { formatter: (params: CallbackDataParams) => string } } | object {\n if (!formatter) return {}\n\n return {\n label: {\n formatter: (params: CallbackDataParams) => {\n const encodeIndex = params.encode?.[encodeKey]?.[0]\n if (encodeIndex === undefined) return ''\n const dimName = params.dimensionNames?.[encodeIndex]\n const row = params.value as Record<string, string | number>\n const value = dimName ? row[dimName] : undefined\n return typeof value === 'number'\n ? formatter(value)\n : String(value ?? '')\n },\n },\n }\n}\n\n/**\n * Builds a series `label` config that applies formatter to a raw numeric value.\n * Used by histogram where series data is number[] (not datasets).\n *\n * Does not set `show` — labels remain hidden by default per ECharts defaults.\n *\n * @param formatter - Optional numeric value formatter\n */\nexport function buildHistogramSeriesLabelConfig(\n formatter?: (value: number) => string,\n): { label: { formatter: (params: CallbackDataParams) => string } } | object {\n if (!formatter) return {}\n\n return {\n label: {\n formatter: (params: CallbackDataParams) => {\n const value = params.value as number\n return typeof value === 'number'\n ? formatter(value)\n : String(value ?? '')\n },\n },\n }\n}\n"],"names":["niceNum","value","absValue","Math","abs","base","pow","floor","log10","rounded","ceil","buildLegendConfig","hasLegend","labelFormatter","show","icon","left","bottom","orient","type","formatter","name","String","buildGridConfig","theme","parseInt","spacing","buildAxisLabelStyle","fontSize","typography","overlineDelicate","fontFamily","color","palette","black","text","secondary","createTooltipPositioner","point","_params","_dom","_rect","size","position","top","contentSize","viewSize","right","createAxisLabelFormatter","applyXAxisFormatter","xAxis","xAxisIsObject","Array","isArray","xAxisTyped","axisFormatter","undefined","axisLabel","applyYAxisFormatter","yAxis","yAxisIsObject","yAxisTyped","createTooltipFormatter","callback","params","items","tooltip","values","map","item","seriesName","marker","marginStyle","length","formattedValues","join","buildSeriesLabelConfig","encodeKey","label","encodeIndex","encode","dimName","dimension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mF,EACdhE,GAC2E;AAC3E,SAAKA,IAEE;AAAA,IACL0D,OAAO;AAAA,MACL1D,WAAWA,CAAC4C,MAA+B;AACzC,cAAM/D,IAAQ+D,EAAO/D;AACrB,eAAO,OAAOA,KAAU,WACpBmB,EAAUnB,CAAK,IACfqB,OAAOrB,KAAS,EAAE;AAAA,MACxB;AAAA,IAAA;AAAA,EACF,IAVqB,CAAA;AAYzB;"}
|
|
@@ -5,5 +5,5 @@ export { defaultFormatter, defaultLabelFormatter } from '../formatter';
|
|
|
5
5
|
export { createChartWidgetConfig } from './config-factory';
|
|
6
6
|
export type { ChartWidgetBaseConfig, CreateChartWidgetConfigParams, } from './config-factory';
|
|
7
7
|
export { flattenObjectArrayToCSV, scatterplotDataToCSV } from './csv-modifiers';
|
|
8
|
-
export { buildLegendConfig, buildGridConfig, createTooltipPositioner, createAxisLabelFormatter, createTooltipFormatter, applyXAxisFormatter, applyYAxisFormatter, niceNum, buildSeriesLabelConfig, buildHistogramSeriesLabelConfig, } from './option-builders';
|
|
8
|
+
export { buildLegendConfig, buildGridConfig, buildAxisLabelStyle, createTooltipPositioner, createAxisLabelFormatter, createTooltipFormatter, applyXAxisFormatter, applyYAxisFormatter, niceNum, buildSeriesLabelConfig, buildHistogramSeriesLabelConfig, } from './option-builders';
|
|
9
9
|
export { createChartDownloadConfig } from './download-config';
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
export interface PieSkeletonProps {
|
|
2
2
|
count?: number;
|
|
3
3
|
}
|
|
4
|
+
/**
|
|
5
|
+
* Loading state for the Pie widget. Mirrors the donut silhouette — a ring
|
|
6
|
+
* (gray circle with a background-coloured hole punched out), a stacked
|
|
7
|
+
* value/name stub in the centre, and a centered legend stub below — so the
|
|
8
|
+
* skeleton reads as "a donut chart" rather than a solid disc.
|
|
9
|
+
*
|
|
10
|
+
* Single donut only: multi-series pie loads as a horizontal bar chart, so
|
|
11
|
+
* rendering one ring stays honest regardless of `count`.
|
|
12
|
+
*/
|
|
4
13
|
export declare function PieSkeleton({ count }: PieSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/widgets/bar.js
CHANGED
|
@@ -7,7 +7,7 @@ import "zustand/shallow";
|
|
|
7
7
|
import { g as w } from "../options-CthfUJDz.js";
|
|
8
8
|
import { m as v } from "../utils-BOhInag6.js";
|
|
9
9
|
import { c as L, f as S } from "../download-config-oJIFZ2WC.js";
|
|
10
|
-
import {
|
|
10
|
+
import { i as _, f as C, g as M, n as u, a as A, c as I, d as N } from "../option-builders-DPeoyQaM.js";
|
|
11
11
|
import { Box as l, Skeleton as o } from "@mui/material";
|
|
12
12
|
import { b as T } from "../styles-cohnxh9F.js";
|
|
13
13
|
const R = L(S);
|
|
@@ -6,7 +6,7 @@ import "../widget-store-Bw5zRUGg.js";
|
|
|
6
6
|
import "zustand/shallow";
|
|
7
7
|
import { g as k } from "../options-CthfUJDz.js";
|
|
8
8
|
import { m as C } from "../utils-BOhInag6.js";
|
|
9
|
-
import {
|
|
9
|
+
import { j as v, f as $, g as A, n as u, c as M, d as T } from "../option-builders-DPeoyQaM.js";
|
|
10
10
|
import { Box as f, Skeleton as y } from "@mui/material";
|
|
11
11
|
import "@mui/icons-material";
|
|
12
12
|
import { d as h, a as d } from "../exports-Cr43OCul.js";
|
package/dist/widgets/pie.js
CHANGED
|
@@ -7,7 +7,7 @@ import "zustand/shallow";
|
|
|
7
7
|
import { g as L } from "../options-CthfUJDz.js";
|
|
8
8
|
import { m as N } from "../utils-BOhInag6.js";
|
|
9
9
|
import { c as j, f as A } from "../download-config-oJIFZ2WC.js";
|
|
10
|
-
import {
|
|
10
|
+
import { i as O, f as b, g as T, n as v, c as S, d as _ } from "../option-builders-DPeoyQaM.js";
|
|
11
11
|
import { Box as h, Skeleton as f } from "@mui/material";
|
|
12
12
|
import { b as z } from "../styles-cohnxh9F.js";
|
|
13
13
|
const ee = j(A);
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsxs as g, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { c as
|
|
2
|
+
import { c as b } from "react/compiler-runtime";
|
|
3
3
|
import "react";
|
|
4
4
|
import "echarts";
|
|
5
5
|
import "../widget-store-Bw5zRUGg.js";
|
|
6
6
|
import "zustand/shallow";
|
|
7
|
-
import { g as
|
|
7
|
+
import { g as h } from "../options-CthfUJDz.js";
|
|
8
8
|
import { m as S } from "../utils-BOhInag6.js";
|
|
9
9
|
import { c as v, s as k } from "../download-config-oJIFZ2WC.js";
|
|
10
|
-
import {
|
|
10
|
+
import { i as w, f as L, b as I, a as _, d as C } from "../option-builders-DPeoyQaM.js";
|
|
11
11
|
import { Box as p, Skeleton as c } from "@mui/material";
|
|
12
12
|
import { b as A } from "../styles-cohnxh9F.js";
|
|
13
13
|
const G = v(k);
|
|
14
14
|
function H(e) {
|
|
15
15
|
return {
|
|
16
16
|
type: "scatterplot",
|
|
17
|
-
option: S(
|
|
17
|
+
option: S(h(e), D(e)),
|
|
18
18
|
formatter: e.formatter,
|
|
19
19
|
labelFormatter: e.labelFormatter
|
|
20
20
|
};
|
|
@@ -180,7 +180,7 @@ const f = {
|
|
|
180
180
|
top: "40%"
|
|
181
181
|
}];
|
|
182
182
|
function J() {
|
|
183
|
-
const e =
|
|
183
|
+
const e = b(2);
|
|
184
184
|
let t;
|
|
185
185
|
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t = T.map(O), e[0] = t) : t = e[0];
|
|
186
186
|
let o;
|
|
@@ -7,7 +7,7 @@ import "zustand/shallow";
|
|
|
7
7
|
import { g as b } from "../options-CthfUJDz.js";
|
|
8
8
|
import { m as k } from "../utils-BOhInag6.js";
|
|
9
9
|
import { c as v, f as w } from "../download-config-oJIFZ2WC.js";
|
|
10
|
-
import {
|
|
10
|
+
import { i as L, f as C, b as I, a as S, c as _, d as A } from "../option-builders-DPeoyQaM.js";
|
|
11
11
|
import { Box as l, Skeleton as r } from "@mui/material";
|
|
12
12
|
import { b as j } from "../styles-cohnxh9F.js";
|
|
13
13
|
const H = v(w);
|
package/dist/widgets/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as i, a as n } from "../formatter-B9Bxn1k7.js";
|
|
2
2
|
import { c as f, f as p, s as c } from "../download-config-oJIFZ2WC.js";
|
|
3
|
-
import { a as d, b as u, c as b, d as x, e as C, f as g, g as F, n as y } from "../option-builders-
|
|
3
|
+
import { a as d, b as u, c as b, d as x, e as C, f as g, g as F, n as y } from "../option-builders-DPeoyQaM.js";
|
|
4
4
|
import { b as S } from "../styles-cohnxh9F.js";
|
|
5
5
|
function r({
|
|
6
6
|
type: a,
|