@opendata-ai/openchart-react 9.0.0 → 9.2.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/index.d.ts +27 -9
- package/dist/index.js +134 -39
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { BarListSpec, ThemeConfig, DarkMode, DataRow, ChartEventHandlers, ChartSpec, LayerSpec, ElementRef, GeoMapSpec, TableSpec, SortState, GeoReaderSelection, ReaderChangeMeta, GraphSpec, ChartLayout, SankeySpec, TileMapSpec, VizSpec } from '@opendata-ai/openchart-core';
|
|
1
|
+
import { BarListSpec, ThemeConfig, DarkMode, DataRow, ChartEventHandlers, ChartSpec, LayerSpec, ElementRef, GeoMapSpec, TableSpec, SortState, GeoReaderSelection, ReaderChangeMeta, GraphSpec, ChartLayout, RaceSpec, RaceFrame, SankeySpec, TileMapSpec, VizSpec } from '@opendata-ai/openchart-core';
|
|
2
2
|
export * from '@opendata-ai/openchart-core';
|
|
3
|
-
import { BarListInstance, InteractionMode, ChartReaderProps, ChartInstance, MountOptions, GeoReaderOptions, GeoMapMountOptions, GeoMapMarkEvent, Camera, GeoMapCameraChangeMeta, GeoMapInstance, CameraFlightOptions, GraphFlyTarget, GraphCamera, GraphHighlightTarget, GraphLegendData, GraphInstance, GraphTooltipFormatter, TableInstance, TableState, TableMountOptions, SankeyInstance, TileMapInstance } from '@opendata-ai/openchart-vanilla';
|
|
4
|
-
export { GeoMapCameraChangeMeta, InteractionMode, JPGExportOptions, PNGExportOptions, SVGExportOptions, SpecSequenceOptions, exportCSV, exportJPG, exportPNG, exportSVG, exportSVGWithFonts, exportSpecSequence } from '@opendata-ai/openchart-vanilla';
|
|
3
|
+
import { BarListInstance, InteractionMode, ChartReaderProps, ChartInstance, MountOptions, GeoReaderOptions, GeoMapMountOptions, GeoMapMarkEvent, Camera, GeoMapCameraChangeMeta, GeoMapInstance, CameraFlightOptions, GraphFlyTarget, GraphCamera, GraphHighlightTarget, GraphLegendData, GraphInstance, GraphTooltipFormatter, TableInstance, TableState, TableMountOptions, RaceMountOptions, RaceInstance, SankeyInstance, TileMapInstance } from '@opendata-ai/openchart-vanilla';
|
|
4
|
+
export { GeoMapCameraChangeMeta, InteractionMode, JPGExportOptions, PNGExportOptions, PlaybackController, PlaybackPeriod, PlaybackState, SVGExportOptions, SpecSequenceOptions, exportCSV, exportJPG, exportPNG, exportSVG, exportSVGWithFonts, exportSpecSequence } from '@opendata-ai/openchart-vanilla';
|
|
5
5
|
export { ChartRenderer, CompileResult, CompiledGraphEdge, CompiledGraphNode, GraphCompilation, NormalizedBarListSpec, NormalizedChartSpec, NormalizedChrome, NormalizedGeoMapSpec, NormalizedGraphSpec, NormalizedSankeySpec, NormalizedSpec, NormalizedTableSpec, NormalizedTileMapSpec, SimulationConfig, ValidationError, ValidationErrorCode, ValidationResult, clearRenderers, compile, compileBarList, compileChart, compileGeoMap, compileGraph, compileSankey, compileTable, compileTileMap, getChartRenderer, normalizeSpec, registerChartRenderer, validateSpec } from '@opendata-ai/openchart-engine';
|
|
6
6
|
import * as react from 'react';
|
|
7
7
|
import { CSSProperties, ReactNode, Ref } from 'react';
|
|
8
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
8
|
import { ChartStoryOptions, ChartStoryInstance } from '@opendata-ai/openchart-vanilla/story';
|
|
10
9
|
|
|
11
10
|
interface BarListProps {
|
|
@@ -145,7 +144,7 @@ interface ChartStoryProps<TData extends DataRow = DataRow> {
|
|
|
145
144
|
style?: CSSProperties;
|
|
146
145
|
ref?: Ref<ChartStoryHandle>;
|
|
147
146
|
}
|
|
148
|
-
declare function ChartStory<TData extends DataRow = DataRow>({ spec, steps, narrative, step, triggerPosition, cameraMode, mountOptions, className, style, ref, }: ChartStoryProps<TData>):
|
|
147
|
+
declare function ChartStory<TData extends DataRow = DataRow>({ spec, steps, narrative, step, triggerPosition, cameraMode, mountOptions, className, style, ref, }: ChartStoryProps<TData>): react.JSX.Element;
|
|
149
148
|
|
|
150
149
|
interface DataTableProps {
|
|
151
150
|
/** The table spec to render. */
|
|
@@ -179,7 +178,7 @@ interface DataTableProps {
|
|
|
179
178
|
* Uses the vanilla adapter internally. Supports controlled and uncontrolled
|
|
180
179
|
* modes for sort, search, and pagination state.
|
|
181
180
|
*/
|
|
182
|
-
declare function DataTable({ spec, theme: themeProp, darkMode, onRowClick, onSortChange, onSearchChange, onPageChange, className, style, sort, search, page, }: DataTableProps):
|
|
181
|
+
declare function DataTable({ spec, theme: themeProp, darkMode, onRowClick, onSortChange, onSearchChange, onPageChange, className, style, sort, search, page, }: DataTableProps): react.JSX.Element;
|
|
183
182
|
|
|
184
183
|
interface GeoMapProps {
|
|
185
184
|
reader?: false | GeoReaderOptions;
|
|
@@ -495,6 +494,25 @@ interface UseTableStateOptions {
|
|
|
495
494
|
*/
|
|
496
495
|
declare function useTableState(initialState?: UseTableStateOptions): UseTableStateReturn;
|
|
497
496
|
|
|
497
|
+
/** Options and callbacks for a mounted race chart. */
|
|
498
|
+
interface RaceProps {
|
|
499
|
+
spec: RaceSpec;
|
|
500
|
+
theme?: ThemeConfig;
|
|
501
|
+
darkMode?: DarkMode;
|
|
502
|
+
className?: string;
|
|
503
|
+
style?: CSSProperties;
|
|
504
|
+
autoResize?: boolean;
|
|
505
|
+
watermark?: boolean;
|
|
506
|
+
onWarn?: RaceMountOptions['onWarn'];
|
|
507
|
+
onPeriod?: (period: RaceFrame['period']) => void;
|
|
508
|
+
}
|
|
509
|
+
/** Ref handle for imperative race playback. */
|
|
510
|
+
interface RaceHandle {
|
|
511
|
+
readonly instance: RaceInstance | null;
|
|
512
|
+
}
|
|
513
|
+
/** Render an interactive race chart. */
|
|
514
|
+
declare const Race: react.ForwardRefExoticComponent<RaceProps & react.RefAttributes<RaceHandle>>;
|
|
515
|
+
|
|
498
516
|
interface SankeyProps {
|
|
499
517
|
/** The sankey spec to render. */
|
|
500
518
|
spec: SankeySpec;
|
|
@@ -540,7 +558,7 @@ interface VizThemeProviderProps {
|
|
|
540
558
|
children: ReactNode;
|
|
541
559
|
}
|
|
542
560
|
/** Provides a theme and dark mode preference to all nested Chart, DataTable, and Graph components. */
|
|
543
|
-
declare function VizThemeProvider({ theme, darkMode, children }: VizThemeProviderProps):
|
|
561
|
+
declare function VizThemeProvider({ theme, darkMode, children }: VizThemeProviderProps): react.JSX.Element;
|
|
544
562
|
|
|
545
563
|
interface TileMapProps {
|
|
546
564
|
/** The tilemap spec to render. */
|
|
@@ -599,6 +617,6 @@ interface VisualizationProps {
|
|
|
599
617
|
* Accepts any VizSpec and renders it with the correct component based on the
|
|
600
618
|
* spec's type field. For event handlers, use Chart, DataTable, or Graph directly.
|
|
601
619
|
*/
|
|
602
|
-
declare function Visualization({ spec, theme, darkMode, className, style }: VisualizationProps):
|
|
620
|
+
declare function Visualization({ spec, theme, darkMode, className, style }: VisualizationProps): react.JSX.Element;
|
|
603
621
|
|
|
604
|
-
export { BarList, type BarListHandle, type BarListProps, Chart, type ChartHandle, type ChartProps, ChartStory, type ChartStoryHandle, type ChartStoryProps, DataTable, type DataTableProps, GeoMap, type GeoMapHandle, type GeoMapProps, Graph, type GraphHandle, type GraphProps, type ObservationChartProps, Sankey, type SankeyHandle, type SankeyProps, type SliceChartProps, TileMap, type TileMapHandle, type TileMapProps, type UseChartOptions, type UseChartReturn, type UseGraphReturn, type UseTableReturn, type UseTableStateOptions, type UseTableStateReturn, Visualization, type VisualizationProps, VizThemeProvider, type VizThemeProviderProps, useChart, useDarkMode, useGraph, useTable, useTableState, useVizDarkMode, useVizTheme };
|
|
622
|
+
export { BarList, type BarListHandle, type BarListProps, Chart, type ChartHandle, type ChartProps, ChartStory, type ChartStoryHandle, type ChartStoryProps, DataTable, type DataTableProps, GeoMap, type GeoMapHandle, type GeoMapProps, Graph, type GraphHandle, type GraphProps, type ObservationChartProps, Race, type RaceHandle, type RaceProps, Sankey, type SankeyHandle, type SankeyProps, type SliceChartProps, TileMap, type TileMapHandle, type TileMapProps, type UseChartOptions, type UseChartReturn, type UseGraphReturn, type UseTableReturn, type UseTableStateOptions, type UseTableStateReturn, Visualization, type VisualizationProps, VizThemeProvider, type VizThemeProviderProps, useChart, useDarkMode, useGraph, useTable, useTableState, useVizDarkMode, useVizTheme };
|
package/dist/index.js
CHANGED
|
@@ -744,6 +744,7 @@ var Graph = forwardRef4(function Graph2({
|
|
|
744
744
|
const graphRef = useRef6(null);
|
|
745
745
|
const specRef = useRef6("");
|
|
746
746
|
const prevMountDepsRef = useRef6(null);
|
|
747
|
+
const prevEntrancePlayedRef = useRef6(false);
|
|
747
748
|
const handlersRef = useRef6({});
|
|
748
749
|
handlersRef.current = {
|
|
749
750
|
onNodeClick,
|
|
@@ -866,7 +867,7 @@ var Graph = forwardRef4(function Graph2({
|
|
|
866
867
|
const tooltipOption = tooltipOn ? { formatter: stableTooltipFormatter } : false;
|
|
867
868
|
const mountDeps = [theme, resolvedDarkMode, tooltipOn, legendKey, fitOnLoad];
|
|
868
869
|
const prevDeps = prevMountDepsRef.current;
|
|
869
|
-
const suppressEntrance = prevDeps !== null && mountDeps.some((d, i) => !Object.is(d, prevDeps[i]));
|
|
870
|
+
const suppressEntrance = prevDeps !== null && prevEntrancePlayedRef.current && mountDeps.some((d, i) => !Object.is(d, prevDeps[i]));
|
|
870
871
|
const options = {
|
|
871
872
|
theme,
|
|
872
873
|
darkMode: resolvedDarkMode,
|
|
@@ -891,6 +892,7 @@ var Graph = forwardRef4(function Graph2({
|
|
|
891
892
|
specRef.current = JSON.stringify(spec);
|
|
892
893
|
prevMountDepsRef.current = mountDeps;
|
|
893
894
|
return () => {
|
|
895
|
+
prevEntrancePlayedRef.current = graphRef.current?.entrancePlayed ?? false;
|
|
894
896
|
graphRef.current?.destroy();
|
|
895
897
|
graphRef.current = null;
|
|
896
898
|
};
|
|
@@ -1168,21 +1170,109 @@ function useTableState(initialState) {
|
|
|
1168
1170
|
};
|
|
1169
1171
|
}
|
|
1170
1172
|
|
|
1171
|
-
// src/
|
|
1173
|
+
// src/Race.tsx
|
|
1172
1174
|
import { mergeThemeConfig as mergeThemeConfig6 } from "@opendata-ai/openchart-core";
|
|
1173
1175
|
import {
|
|
1174
|
-
|
|
1176
|
+
createRace
|
|
1175
1177
|
} from "@opendata-ai/openchart-vanilla";
|
|
1176
1178
|
import {
|
|
1177
1179
|
forwardRef as forwardRef5,
|
|
1178
|
-
useCallback as useCallback9,
|
|
1179
1180
|
useEffect as useEffect9,
|
|
1180
1181
|
useImperativeHandle as useImperativeHandle6,
|
|
1181
1182
|
useMemo as useMemo6,
|
|
1182
1183
|
useRef as useRef10
|
|
1183
1184
|
} from "react";
|
|
1184
1185
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1185
|
-
var
|
|
1186
|
+
var Race = forwardRef5(function Race2({ spec, theme, darkMode, className, style, autoResize, watermark, onWarn, onPeriod }, ref) {
|
|
1187
|
+
const contextTheme = useVizTheme();
|
|
1188
|
+
const contextDarkMode = useVizDarkMode();
|
|
1189
|
+
const resolvedDarkMode = darkMode ?? contextDarkMode;
|
|
1190
|
+
const containerRef = useRef10(null);
|
|
1191
|
+
const mounted = useRef10(null);
|
|
1192
|
+
const warnRef = useRef10(onWarn);
|
|
1193
|
+
useEffect9(() => {
|
|
1194
|
+
warnRef.current = onWarn;
|
|
1195
|
+
}, [onWarn]);
|
|
1196
|
+
const options = useMemo6(
|
|
1197
|
+
() => ({
|
|
1198
|
+
theme: mergeThemeConfig6(contextTheme, theme),
|
|
1199
|
+
darkMode: resolvedDarkMode,
|
|
1200
|
+
autoResize,
|
|
1201
|
+
watermark,
|
|
1202
|
+
onWarn: (message) => (warnRef.current ?? console.warn)(message)
|
|
1203
|
+
}),
|
|
1204
|
+
[contextTheme, theme, resolvedDarkMode, autoResize, watermark]
|
|
1205
|
+
);
|
|
1206
|
+
const optionsKey = JSON.stringify({ autoResize, watermark });
|
|
1207
|
+
const themeKey = JSON.stringify({ theme: options.theme, darkMode: options.darkMode });
|
|
1208
|
+
useImperativeHandle6(
|
|
1209
|
+
ref,
|
|
1210
|
+
() => ({
|
|
1211
|
+
get instance() {
|
|
1212
|
+
return mounted.current?.instance ?? null;
|
|
1213
|
+
}
|
|
1214
|
+
}),
|
|
1215
|
+
[]
|
|
1216
|
+
);
|
|
1217
|
+
useEffect9(() => {
|
|
1218
|
+
const container = containerRef.current;
|
|
1219
|
+
if (!container) return;
|
|
1220
|
+
const current = mounted.current;
|
|
1221
|
+
const specKey = JSON.stringify(spec);
|
|
1222
|
+
if (current?.optionsKey === optionsKey) {
|
|
1223
|
+
if (specKey !== current.specKey) {
|
|
1224
|
+
current.instance.update(spec);
|
|
1225
|
+
current.specKey = specKey;
|
|
1226
|
+
}
|
|
1227
|
+
if (themeKey !== current.themeKey) {
|
|
1228
|
+
current.instance.setTheme(options);
|
|
1229
|
+
current.themeKey = themeKey;
|
|
1230
|
+
}
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
const state = current?.instance.getState();
|
|
1234
|
+
const instance = createRace(container, spec, { ...options, initialState: state });
|
|
1235
|
+
current?.instance.destroy();
|
|
1236
|
+
if (state) instance.resize();
|
|
1237
|
+
mounted.current = { instance, optionsKey, themeKey, specKey };
|
|
1238
|
+
}, [spec, options, optionsKey, themeKey]);
|
|
1239
|
+
useEffect9(() => {
|
|
1240
|
+
const current = mounted.current;
|
|
1241
|
+
if (current?.optionsKey === optionsKey && onPeriod)
|
|
1242
|
+
return current.instance.on("period", onPeriod);
|
|
1243
|
+
}, [optionsKey, onPeriod]);
|
|
1244
|
+
useEffect9(
|
|
1245
|
+
() => () => {
|
|
1246
|
+
mounted.current?.instance.destroy();
|
|
1247
|
+
mounted.current = null;
|
|
1248
|
+
},
|
|
1249
|
+
[]
|
|
1250
|
+
);
|
|
1251
|
+
return /* @__PURE__ */ jsx8(
|
|
1252
|
+
"div",
|
|
1253
|
+
{
|
|
1254
|
+
ref: containerRef,
|
|
1255
|
+
className: className ? `oc-root ${className}` : "oc-root",
|
|
1256
|
+
style
|
|
1257
|
+
}
|
|
1258
|
+
);
|
|
1259
|
+
});
|
|
1260
|
+
|
|
1261
|
+
// src/Sankey.tsx
|
|
1262
|
+
import { mergeThemeConfig as mergeThemeConfig7 } from "@opendata-ai/openchart-core";
|
|
1263
|
+
import {
|
|
1264
|
+
createSankey
|
|
1265
|
+
} from "@opendata-ai/openchart-vanilla";
|
|
1266
|
+
import {
|
|
1267
|
+
forwardRef as forwardRef6,
|
|
1268
|
+
useCallback as useCallback9,
|
|
1269
|
+
useEffect as useEffect10,
|
|
1270
|
+
useImperativeHandle as useImperativeHandle7,
|
|
1271
|
+
useMemo as useMemo7,
|
|
1272
|
+
useRef as useRef11
|
|
1273
|
+
} from "react";
|
|
1274
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1275
|
+
var Sankey = forwardRef6(function Sankey2({
|
|
1186
1276
|
spec,
|
|
1187
1277
|
theme: themeProp,
|
|
1188
1278
|
darkMode,
|
|
@@ -1195,12 +1285,12 @@ var Sankey = forwardRef5(function Sankey2({
|
|
|
1195
1285
|
}, ref) {
|
|
1196
1286
|
const contextTheme = useVizTheme();
|
|
1197
1287
|
const contextDarkMode = useVizDarkMode();
|
|
1198
|
-
const theme =
|
|
1288
|
+
const theme = useMemo7(() => mergeThemeConfig7(contextTheme, themeProp), [contextTheme, themeProp]);
|
|
1199
1289
|
const resolvedDarkMode = darkMode ?? contextDarkMode;
|
|
1200
|
-
const containerRef =
|
|
1201
|
-
const instanceRef =
|
|
1202
|
-
const specRef =
|
|
1203
|
-
const handlersRef =
|
|
1290
|
+
const containerRef = useRef11(null);
|
|
1291
|
+
const instanceRef = useRef11(null);
|
|
1292
|
+
const specRef = useRef11("");
|
|
1293
|
+
const handlersRef = useRef11({});
|
|
1204
1294
|
handlersRef.current = {
|
|
1205
1295
|
onNodeClick,
|
|
1206
1296
|
onLinkClick,
|
|
@@ -1223,7 +1313,7 @@ var Sankey = forwardRef5(function Sankey2({
|
|
|
1223
1313
|
(link) => handlersRef.current.onLinkHover?.(link),
|
|
1224
1314
|
[]
|
|
1225
1315
|
);
|
|
1226
|
-
|
|
1316
|
+
useImperativeHandle7(
|
|
1227
1317
|
ref,
|
|
1228
1318
|
() => ({
|
|
1229
1319
|
get instance() {
|
|
@@ -1232,7 +1322,7 @@ var Sankey = forwardRef5(function Sankey2({
|
|
|
1232
1322
|
}),
|
|
1233
1323
|
[]
|
|
1234
1324
|
);
|
|
1235
|
-
|
|
1325
|
+
useEffect10(() => {
|
|
1236
1326
|
const container = containerRef.current;
|
|
1237
1327
|
if (!container) return;
|
|
1238
1328
|
const options = {
|
|
@@ -1258,7 +1348,7 @@ var Sankey = forwardRef5(function Sankey2({
|
|
|
1258
1348
|
stableOnNodeHover,
|
|
1259
1349
|
stableOnLinkHover
|
|
1260
1350
|
]);
|
|
1261
|
-
|
|
1351
|
+
useEffect10(() => {
|
|
1262
1352
|
const instance = instanceRef.current;
|
|
1263
1353
|
if (!instance) return;
|
|
1264
1354
|
const specString = JSON.stringify(spec);
|
|
@@ -1266,7 +1356,7 @@ var Sankey = forwardRef5(function Sankey2({
|
|
|
1266
1356
|
specRef.current = specString;
|
|
1267
1357
|
instance.update(spec);
|
|
1268
1358
|
}, [spec]);
|
|
1269
|
-
return /* @__PURE__ */
|
|
1359
|
+
return /* @__PURE__ */ jsx9(
|
|
1270
1360
|
"div",
|
|
1271
1361
|
{
|
|
1272
1362
|
ref: containerRef,
|
|
@@ -1277,28 +1367,28 @@ var Sankey = forwardRef5(function Sankey2({
|
|
|
1277
1367
|
});
|
|
1278
1368
|
|
|
1279
1369
|
// src/TileMap.tsx
|
|
1280
|
-
import { mergeThemeConfig as
|
|
1370
|
+
import { mergeThemeConfig as mergeThemeConfig8 } from "@opendata-ai/openchart-core";
|
|
1281
1371
|
import {
|
|
1282
1372
|
createTileMap
|
|
1283
1373
|
} from "@opendata-ai/openchart-vanilla";
|
|
1284
1374
|
import {
|
|
1285
|
-
forwardRef as
|
|
1375
|
+
forwardRef as forwardRef7,
|
|
1286
1376
|
useCallback as useCallback10,
|
|
1287
|
-
useEffect as
|
|
1288
|
-
useImperativeHandle as
|
|
1289
|
-
useMemo as
|
|
1290
|
-
useRef as
|
|
1377
|
+
useEffect as useEffect11,
|
|
1378
|
+
useImperativeHandle as useImperativeHandle8,
|
|
1379
|
+
useMemo as useMemo8,
|
|
1380
|
+
useRef as useRef12
|
|
1291
1381
|
} from "react";
|
|
1292
|
-
import { jsx as
|
|
1293
|
-
var TileMap =
|
|
1382
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1383
|
+
var TileMap = forwardRef7(function TileMap2({ spec, theme: themeProp, darkMode, onTileClick, onTileHover, className, style }, ref) {
|
|
1294
1384
|
const contextTheme = useVizTheme();
|
|
1295
1385
|
const contextDarkMode = useVizDarkMode();
|
|
1296
|
-
const theme =
|
|
1386
|
+
const theme = useMemo8(() => mergeThemeConfig8(contextTheme, themeProp), [contextTheme, themeProp]);
|
|
1297
1387
|
const resolvedDarkMode = darkMode ?? contextDarkMode;
|
|
1298
|
-
const containerRef =
|
|
1299
|
-
const instanceRef =
|
|
1300
|
-
const specRef =
|
|
1301
|
-
const handlersRef =
|
|
1388
|
+
const containerRef = useRef12(null);
|
|
1389
|
+
const instanceRef = useRef12(null);
|
|
1390
|
+
const specRef = useRef12("");
|
|
1391
|
+
const handlersRef = useRef12({});
|
|
1302
1392
|
handlersRef.current = {
|
|
1303
1393
|
onTileClick,
|
|
1304
1394
|
onTileHover
|
|
@@ -1311,7 +1401,7 @@ var TileMap = forwardRef6(function TileMap2({ spec, theme: themeProp, darkMode,
|
|
|
1311
1401
|
(tile) => handlersRef.current.onTileHover?.(tile),
|
|
1312
1402
|
[]
|
|
1313
1403
|
);
|
|
1314
|
-
|
|
1404
|
+
useImperativeHandle8(
|
|
1315
1405
|
ref,
|
|
1316
1406
|
() => ({
|
|
1317
1407
|
get instance() {
|
|
@@ -1320,7 +1410,7 @@ var TileMap = forwardRef6(function TileMap2({ spec, theme: themeProp, darkMode,
|
|
|
1320
1410
|
}),
|
|
1321
1411
|
[]
|
|
1322
1412
|
);
|
|
1323
|
-
|
|
1413
|
+
useEffect11(() => {
|
|
1324
1414
|
const container = containerRef.current;
|
|
1325
1415
|
if (!container) return;
|
|
1326
1416
|
const options = {
|
|
@@ -1337,7 +1427,7 @@ var TileMap = forwardRef6(function TileMap2({ spec, theme: themeProp, darkMode,
|
|
|
1337
1427
|
instanceRef.current = null;
|
|
1338
1428
|
};
|
|
1339
1429
|
}, [theme, resolvedDarkMode, stableOnTileClick, stableOnTileHover]);
|
|
1340
|
-
|
|
1430
|
+
useEffect11(() => {
|
|
1341
1431
|
const instance = instanceRef.current;
|
|
1342
1432
|
if (!instance) return;
|
|
1343
1433
|
const specString = JSON.stringify(spec);
|
|
@@ -1345,7 +1435,7 @@ var TileMap = forwardRef6(function TileMap2({ spec, theme: themeProp, darkMode,
|
|
|
1345
1435
|
specRef.current = specString;
|
|
1346
1436
|
instance.update(spec);
|
|
1347
1437
|
}, [spec]);
|
|
1348
|
-
return /* @__PURE__ */
|
|
1438
|
+
return /* @__PURE__ */ jsx10(
|
|
1349
1439
|
"div",
|
|
1350
1440
|
{
|
|
1351
1441
|
ref: containerRef,
|
|
@@ -1360,14 +1450,15 @@ import {
|
|
|
1360
1450
|
isBarListSpec,
|
|
1361
1451
|
isGeoMapSpec,
|
|
1362
1452
|
isGraphSpec,
|
|
1453
|
+
isRaceSpec,
|
|
1363
1454
|
isSankeySpec,
|
|
1364
1455
|
isTableSpec,
|
|
1365
1456
|
isTileMapSpec
|
|
1366
1457
|
} from "@opendata-ai/openchart-core";
|
|
1367
|
-
import { jsx as
|
|
1458
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1368
1459
|
function Visualization({ spec, theme, darkMode, className, style }) {
|
|
1369
1460
|
if (isTableSpec(spec)) {
|
|
1370
|
-
return /* @__PURE__ */
|
|
1461
|
+
return /* @__PURE__ */ jsx11(
|
|
1371
1462
|
DataTable,
|
|
1372
1463
|
{
|
|
1373
1464
|
spec,
|
|
@@ -1379,21 +1470,24 @@ function Visualization({ spec, theme, darkMode, className, style }) {
|
|
|
1379
1470
|
);
|
|
1380
1471
|
}
|
|
1381
1472
|
if (isGraphSpec(spec)) {
|
|
1382
|
-
return /* @__PURE__ */
|
|
1473
|
+
return /* @__PURE__ */ jsx11(Graph, { spec, theme, darkMode, className, style });
|
|
1383
1474
|
}
|
|
1384
1475
|
if (isSankeySpec(spec)) {
|
|
1385
|
-
return /* @__PURE__ */
|
|
1476
|
+
return /* @__PURE__ */ jsx11(Sankey, { spec, theme, darkMode, className, style });
|
|
1386
1477
|
}
|
|
1387
1478
|
if (isTileMapSpec(spec)) {
|
|
1388
|
-
return /* @__PURE__ */
|
|
1479
|
+
return /* @__PURE__ */ jsx11(TileMap, { spec, theme, darkMode, className, style });
|
|
1389
1480
|
}
|
|
1390
1481
|
if (isBarListSpec(spec)) {
|
|
1391
|
-
return /* @__PURE__ */
|
|
1482
|
+
return /* @__PURE__ */ jsx11(BarList, { spec, theme, darkMode, className, style });
|
|
1392
1483
|
}
|
|
1393
1484
|
if (isGeoMapSpec(spec)) {
|
|
1394
|
-
return /* @__PURE__ */
|
|
1485
|
+
return /* @__PURE__ */ jsx11(GeoMap, { spec, theme, darkMode, className, style });
|
|
1486
|
+
}
|
|
1487
|
+
if (isRaceSpec(spec)) {
|
|
1488
|
+
return /* @__PURE__ */ jsx11(Race, { spec, theme, darkMode, className, style });
|
|
1395
1489
|
}
|
|
1396
|
-
return /* @__PURE__ */
|
|
1490
|
+
return /* @__PURE__ */ jsx11(Chart, { spec, theme, darkMode, className, style });
|
|
1397
1491
|
}
|
|
1398
1492
|
export {
|
|
1399
1493
|
BarList,
|
|
@@ -1402,6 +1496,7 @@ export {
|
|
|
1402
1496
|
DataTable,
|
|
1403
1497
|
GeoMap,
|
|
1404
1498
|
Graph,
|
|
1499
|
+
Race,
|
|
1405
1500
|
Sankey,
|
|
1406
1501
|
TileMap,
|
|
1407
1502
|
Visualization,
|