@opendata-ai/openchart-vue 9.0.0-rc.2 → 9.1.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 +114 -3
- package/dist/index.js +166 -44
- 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,6 +1,6 @@
|
|
|
1
|
-
import { BarListSpec, ThemeConfig, DarkMode, ChartSpec, LayerSpec, EditTransaction, ElementRef, ReaderChangeMeta, MarkEvent, Annotation, GeoMapSpec, ChartLayout, GraphSpec, TableSpec, SortState, GeoReaderSelection, SankeySpec, TileMapSpec, VizSpec } from '@opendata-ai/openchart-core';
|
|
1
|
+
import { BarListSpec, ThemeConfig, DarkMode, ChartSpec, LayerSpec, EditTransaction, ElementRef, ReaderChangeMeta, MarkEvent, MarkFocusEvent, Annotation, GeoMapSpec, ChartLayout, GraphSpec, TableSpec, SortState, GeoReaderSelection, RaceSpec, RaceFrame, SankeySpec, TileMapSpec, VizSpec } from '@opendata-ai/openchart-core';
|
|
2
2
|
export * from '@opendata-ai/openchart-core';
|
|
3
|
-
import { ReaderPresentationOptions, ChartReaderSelection, InteractionMode, MountOptions, ChartInstance, CameraFlightOptions, GraphFlyTarget, GraphCamera, GraphHighlightTarget, GraphLegendData, GraphInstance, TableInstance, TableState, TableMountOptions, GeoReaderOptions, GeoMapMountOptions, GeoMapMarkEvent, Camera, GeoMapCameraChangeMeta, GraphTooltipFormatter } from '@opendata-ai/openchart-vanilla';
|
|
3
|
+
import { ReaderPresentationOptions, ChartReaderSelection, InteractionMode, MountOptions, ChartInstance, CameraFlightOptions, GraphFlyTarget, GraphCamera, GraphHighlightTarget, GraphLegendData, GraphInstance, TableInstance, TableState, TableMountOptions, GeoReaderOptions, GeoMapMountOptions, GeoMapMarkEvent, Camera, GeoMapCameraChangeMeta, GraphTooltipFormatter, RaceMountOptions } from '@opendata-ai/openchart-vanilla';
|
|
4
4
|
export { GeoMapCameraChangeMeta, InteractionMode, JPGExportOptions, PNGExportOptions, 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 vue from 'vue';
|
|
@@ -172,6 +172,7 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
172
172
|
'reader-change': (_selection: ChartReaderSelection, _meta: ReaderChangeMeta) => true;
|
|
173
173
|
'mark-click': (_event: MarkEvent) => true;
|
|
174
174
|
'mark-hover': (_event: MarkEvent) => true;
|
|
175
|
+
'mark-focus': (_event: MarkFocusEvent) => true;
|
|
175
176
|
'mark-leave': () => true;
|
|
176
177
|
'legend-toggle': (_series: string, _visible: boolean) => true;
|
|
177
178
|
'annotation-click': (_annotation: Annotation, _event: MouseEvent, _element: ElementRef) => true;
|
|
@@ -253,6 +254,7 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
253
254
|
"onReader-change"?: ((_selection: ChartReaderSelection, _meta: ReaderChangeMeta) => any) | undefined;
|
|
254
255
|
"onMark-click"?: ((_event: MarkEvent) => any) | undefined;
|
|
255
256
|
"onMark-hover"?: ((_event: MarkEvent) => any) | undefined;
|
|
257
|
+
"onMark-focus"?: ((_event: MarkFocusEvent) => any) | undefined;
|
|
256
258
|
"onMark-leave"?: (() => any) | undefined;
|
|
257
259
|
"onLegend-toggle"?: ((_series: string, _visible: boolean) => any) | undefined;
|
|
258
260
|
"onAnnotation-click"?: ((_annotation: Annotation, _event: MouseEvent, _element: ElementRef) => any) | undefined;
|
|
@@ -933,6 +935,115 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
933
935
|
initialZoom: number;
|
|
934
936
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
935
937
|
|
|
938
|
+
/** Options and callbacks for a mounted race chart. */
|
|
939
|
+
interface RaceProps {
|
|
940
|
+
spec: RaceSpec;
|
|
941
|
+
theme?: ThemeConfig;
|
|
942
|
+
darkMode?: DarkMode;
|
|
943
|
+
class?: string;
|
|
944
|
+
style?: string | CSSProperties;
|
|
945
|
+
autoResize?: boolean;
|
|
946
|
+
watermark?: boolean;
|
|
947
|
+
onWarn?: RaceMountOptions['onWarn'];
|
|
948
|
+
onPeriod?: (period: RaceFrame['period']) => void;
|
|
949
|
+
}
|
|
950
|
+
/** Render an interactive race chart. */
|
|
951
|
+
declare const Race: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
952
|
+
spec: {
|
|
953
|
+
type: PropType<RaceSpec>;
|
|
954
|
+
required: true;
|
|
955
|
+
};
|
|
956
|
+
theme: {
|
|
957
|
+
type: PropType<ThemeConfig>;
|
|
958
|
+
default: undefined;
|
|
959
|
+
};
|
|
960
|
+
darkMode: {
|
|
961
|
+
type: PropType<DarkMode>;
|
|
962
|
+
default: undefined;
|
|
963
|
+
};
|
|
964
|
+
class: {
|
|
965
|
+
type: StringConstructor;
|
|
966
|
+
default: undefined;
|
|
967
|
+
};
|
|
968
|
+
style: {
|
|
969
|
+
type: PropType<string | CSSProperties>;
|
|
970
|
+
default: undefined;
|
|
971
|
+
};
|
|
972
|
+
autoResize: {
|
|
973
|
+
type: BooleanConstructor;
|
|
974
|
+
default: undefined;
|
|
975
|
+
};
|
|
976
|
+
watermark: {
|
|
977
|
+
type: BooleanConstructor;
|
|
978
|
+
default: undefined;
|
|
979
|
+
};
|
|
980
|
+
onWarn: {
|
|
981
|
+
type: PropType<RaceProps["onWarn"]>;
|
|
982
|
+
default: undefined;
|
|
983
|
+
};
|
|
984
|
+
onPeriod: {
|
|
985
|
+
type: PropType<RaceProps["onPeriod"]>;
|
|
986
|
+
default: undefined;
|
|
987
|
+
};
|
|
988
|
+
onPeriodOnce: {
|
|
989
|
+
type: PropType<RaceProps["onPeriod"]>;
|
|
990
|
+
default: undefined;
|
|
991
|
+
};
|
|
992
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
993
|
+
[key: string]: any;
|
|
994
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
995
|
+
spec: {
|
|
996
|
+
type: PropType<RaceSpec>;
|
|
997
|
+
required: true;
|
|
998
|
+
};
|
|
999
|
+
theme: {
|
|
1000
|
+
type: PropType<ThemeConfig>;
|
|
1001
|
+
default: undefined;
|
|
1002
|
+
};
|
|
1003
|
+
darkMode: {
|
|
1004
|
+
type: PropType<DarkMode>;
|
|
1005
|
+
default: undefined;
|
|
1006
|
+
};
|
|
1007
|
+
class: {
|
|
1008
|
+
type: StringConstructor;
|
|
1009
|
+
default: undefined;
|
|
1010
|
+
};
|
|
1011
|
+
style: {
|
|
1012
|
+
type: PropType<string | CSSProperties>;
|
|
1013
|
+
default: undefined;
|
|
1014
|
+
};
|
|
1015
|
+
autoResize: {
|
|
1016
|
+
type: BooleanConstructor;
|
|
1017
|
+
default: undefined;
|
|
1018
|
+
};
|
|
1019
|
+
watermark: {
|
|
1020
|
+
type: BooleanConstructor;
|
|
1021
|
+
default: undefined;
|
|
1022
|
+
};
|
|
1023
|
+
onWarn: {
|
|
1024
|
+
type: PropType<RaceProps["onWarn"]>;
|
|
1025
|
+
default: undefined;
|
|
1026
|
+
};
|
|
1027
|
+
onPeriod: {
|
|
1028
|
+
type: PropType<RaceProps["onPeriod"]>;
|
|
1029
|
+
default: undefined;
|
|
1030
|
+
};
|
|
1031
|
+
onPeriodOnce: {
|
|
1032
|
+
type: PropType<RaceProps["onPeriod"]>;
|
|
1033
|
+
default: undefined;
|
|
1034
|
+
};
|
|
1035
|
+
}>> & Readonly<{}>, {
|
|
1036
|
+
theme: ThemeConfig;
|
|
1037
|
+
darkMode: DarkMode;
|
|
1038
|
+
class: string;
|
|
1039
|
+
style: string | CSSProperties;
|
|
1040
|
+
autoResize: boolean;
|
|
1041
|
+
onWarn: ((message: string) => void) | undefined;
|
|
1042
|
+
onPeriod: ((period: RaceFrame["period"]) => void) | undefined;
|
|
1043
|
+
watermark: boolean;
|
|
1044
|
+
onPeriodOnce: ((period: RaceFrame["period"]) => void) | undefined;
|
|
1045
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
1046
|
+
|
|
936
1047
|
interface SankeyProps {
|
|
937
1048
|
spec: SankeySpec;
|
|
938
1049
|
theme?: ThemeConfig;
|
|
@@ -1158,4 +1269,4 @@ declare const Visualization: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
1158
1269
|
style: string | CSSProperties;
|
|
1159
1270
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
1160
1271
|
|
|
1161
|
-
export { BarList, type BarListProps, type BarListRowEvent, Chart, type ChartProps, ChartStory, type ChartStoryProps, DataTable, type DataTableProps, GeoMap, type GeoMapProps, Graph, type GraphHandle, type GraphProps, Sankey, type SankeyProps, TileMap, type TileMapProps, type UseChartOptions, type UseChartReturn, type UseGraphReturn, type UseTableReturn, type UseTableStateOptions, type UseTableStateReturn, Visualization, type VisualizationProps, VizDarkModeKey, VizThemeKey, VizThemeProvider, type VizThemeProviderProps, useChart, useDarkMode, useGraph, useTable, useTableState, useVizDarkMode, useVizTheme };
|
|
1272
|
+
export { BarList, type BarListProps, type BarListRowEvent, Chart, type ChartProps, ChartStory, type ChartStoryProps, DataTable, type DataTableProps, GeoMap, type GeoMapProps, Graph, type GraphHandle, type GraphProps, Race, type RaceProps, Sankey, type SankeyProps, TileMap, type TileMapProps, type UseChartOptions, type UseChartReturn, type UseGraphReturn, type UseTableReturn, type UseTableStateOptions, type UseTableStateReturn, Visualization, type VisualizationProps, VizDarkModeKey, VizThemeKey, VizThemeProvider, type VizThemeProviderProps, useChart, useDarkMode, useGraph, useTable, useTableState, useVizDarkMode, useVizTheme };
|
package/dist/index.js
CHANGED
|
@@ -240,6 +240,7 @@ var Chart = defineComponent2({
|
|
|
240
240
|
"reader-change": (_selection, _meta) => true,
|
|
241
241
|
"mark-click": (_event) => true,
|
|
242
242
|
"mark-hover": (_event) => true,
|
|
243
|
+
"mark-focus": (_event) => true,
|
|
243
244
|
"mark-leave": () => true,
|
|
244
245
|
"legend-toggle": (_series, _visible) => true,
|
|
245
246
|
"annotation-click": (_annotation, _event, _element) => true,
|
|
@@ -279,6 +280,7 @@ var Chart = defineComponent2({
|
|
|
279
280
|
renderer: props.renderer,
|
|
280
281
|
onMarkClick: (event) => emit("mark-click", event),
|
|
281
282
|
onMarkHover: (event) => emit("mark-hover", event),
|
|
283
|
+
onMarkFocus: (event) => emit("mark-focus", event),
|
|
282
284
|
onMarkLeave: () => emit("mark-leave"),
|
|
283
285
|
onLegendToggle: (series, visible) => emit("legend-toggle", series, visible),
|
|
284
286
|
onAnnotationClick: (annotation, event, element) => emit("annotation-click", annotation, event, element),
|
|
@@ -1150,6 +1152,7 @@ var Graph = defineComponent6({
|
|
|
1150
1152
|
let instance = null;
|
|
1151
1153
|
let prevSpec = "";
|
|
1152
1154
|
let mountedOnce = false;
|
|
1155
|
+
let prevEntrancePlayed = false;
|
|
1153
1156
|
const contextTheme = inject6(VizThemeKey, void 0);
|
|
1154
1157
|
const contextDarkMode = inject6(VizDarkModeKey, void 0);
|
|
1155
1158
|
function resolveTheme() {
|
|
@@ -1184,13 +1187,16 @@ var Graph = defineComponent6({
|
|
|
1184
1187
|
onHighlightChange: (nodeIds) => emit("highlight-change", nodeIds),
|
|
1185
1188
|
onCameraChange: (camera) => emit("camera-change", camera),
|
|
1186
1189
|
autoResize: true,
|
|
1187
|
-
|
|
1190
|
+
// Only when the previous instance's entrance played: one still
|
|
1191
|
+
// waiting to be seen replays on the new instance instead of being lost.
|
|
1192
|
+
suppressEntrance: mountedOnce && !playEntrance && prevEntrancePlayed
|
|
1188
1193
|
};
|
|
1189
1194
|
instance = createGraph(container, props.spec, options);
|
|
1190
1195
|
prevSpec = JSON.stringify(props.spec);
|
|
1191
1196
|
mountedOnce = true;
|
|
1192
1197
|
}
|
|
1193
1198
|
function destroyGraph() {
|
|
1199
|
+
prevEntrancePlayed = instance?.entrancePlayed ?? false;
|
|
1194
1200
|
instance?.destroy();
|
|
1195
1201
|
instance = null;
|
|
1196
1202
|
prevSpec = "";
|
|
@@ -1300,12 +1306,13 @@ var Graph = defineComponent6({
|
|
|
1300
1306
|
}
|
|
1301
1307
|
});
|
|
1302
1308
|
|
|
1303
|
-
// src/
|
|
1309
|
+
// src/Race.ts
|
|
1304
1310
|
import { mergeThemeConfig as mergeThemeConfig6 } from "@opendata-ai/openchart-core";
|
|
1305
1311
|
import {
|
|
1306
|
-
|
|
1312
|
+
createRace
|
|
1307
1313
|
} from "@opendata-ai/openchart-vanilla";
|
|
1308
1314
|
import {
|
|
1315
|
+
computed as computed2,
|
|
1309
1316
|
defineComponent as defineComponent7,
|
|
1310
1317
|
h as h7,
|
|
1311
1318
|
inject as inject7,
|
|
@@ -1314,7 +1321,117 @@ import {
|
|
|
1314
1321
|
ref as ref12,
|
|
1315
1322
|
watch as watch10
|
|
1316
1323
|
} from "vue";
|
|
1317
|
-
var
|
|
1324
|
+
var Race = defineComponent7({
|
|
1325
|
+
name: "Race",
|
|
1326
|
+
props: {
|
|
1327
|
+
spec: { type: Object, required: true },
|
|
1328
|
+
theme: { type: Object, default: void 0 },
|
|
1329
|
+
darkMode: { type: String, default: void 0 },
|
|
1330
|
+
class: { type: String, default: void 0 },
|
|
1331
|
+
style: { type: [String, Object], default: void 0 },
|
|
1332
|
+
autoResize: { type: Boolean, default: void 0 },
|
|
1333
|
+
watermark: { type: Boolean, default: void 0 },
|
|
1334
|
+
onWarn: { type: Function, default: void 0 },
|
|
1335
|
+
// Vue skips listener-only changes for declared emits. Track this listener as a prop.
|
|
1336
|
+
onPeriod: { type: Function, default: void 0 },
|
|
1337
|
+
onPeriodOnce: { type: Function, default: void 0 }
|
|
1338
|
+
},
|
|
1339
|
+
setup(props, { emit, expose }) {
|
|
1340
|
+
const containerRef = ref12(null);
|
|
1341
|
+
let instance = null;
|
|
1342
|
+
let mountedOptionsKey = "";
|
|
1343
|
+
let mountedThemeKey = "";
|
|
1344
|
+
let mountedSpecKey = "";
|
|
1345
|
+
let unsubscribe;
|
|
1346
|
+
const contextTheme = inject7(VizThemeKey, void 0);
|
|
1347
|
+
const contextDarkMode = inject7(VizDarkModeKey, void 0);
|
|
1348
|
+
const options = computed2(() => ({
|
|
1349
|
+
theme: mergeThemeConfig6(contextTheme?.value, props.theme),
|
|
1350
|
+
darkMode: props.darkMode ?? contextDarkMode?.value,
|
|
1351
|
+
autoResize: props.autoResize,
|
|
1352
|
+
watermark: props.watermark,
|
|
1353
|
+
onWarn: (message) => (props.onWarn ?? console.warn)(message)
|
|
1354
|
+
}));
|
|
1355
|
+
const optionsKey = computed2(
|
|
1356
|
+
() => JSON.stringify({ autoResize: props.autoResize, watermark: props.watermark })
|
|
1357
|
+
);
|
|
1358
|
+
const themeKey = computed2(() => {
|
|
1359
|
+
const { theme, darkMode } = options.value;
|
|
1360
|
+
return JSON.stringify({ theme, darkMode });
|
|
1361
|
+
});
|
|
1362
|
+
const specKey = computed2(() => JSON.stringify(props.spec));
|
|
1363
|
+
function subscribe() {
|
|
1364
|
+
unsubscribe?.();
|
|
1365
|
+
unsubscribe = props.onPeriod || props.onPeriodOnce ? instance?.on("period", (period) => emit("period", period)) : void 0;
|
|
1366
|
+
}
|
|
1367
|
+
function destroyRace() {
|
|
1368
|
+
unsubscribe?.();
|
|
1369
|
+
unsubscribe = void 0;
|
|
1370
|
+
instance?.destroy();
|
|
1371
|
+
instance = null;
|
|
1372
|
+
}
|
|
1373
|
+
function mountRace() {
|
|
1374
|
+
const container = containerRef.value;
|
|
1375
|
+
if (!container) return;
|
|
1376
|
+
const state = instance?.getState();
|
|
1377
|
+
const current = createRace(container, props.spec, { ...options.value, initialState: state });
|
|
1378
|
+
destroyRace();
|
|
1379
|
+
if (state) current.resize();
|
|
1380
|
+
instance = current;
|
|
1381
|
+
mountedOptionsKey = optionsKey.value;
|
|
1382
|
+
mountedThemeKey = themeKey.value;
|
|
1383
|
+
mountedSpecKey = specKey.value;
|
|
1384
|
+
subscribe();
|
|
1385
|
+
}
|
|
1386
|
+
expose({
|
|
1387
|
+
get instance() {
|
|
1388
|
+
return instance;
|
|
1389
|
+
}
|
|
1390
|
+
});
|
|
1391
|
+
onMounted9(mountRace);
|
|
1392
|
+
onUnmounted10(destroyRace);
|
|
1393
|
+
watch10(
|
|
1394
|
+
[optionsKey, themeKey, specKey, () => props.onPeriod, () => props.onPeriodOnce],
|
|
1395
|
+
([nextOptionsKey, nextThemeKey, nextSpecKey, onPeriod, onPeriodOnce], [, , , previous, previousOnce]) => {
|
|
1396
|
+
if (onPeriod !== previous || onPeriodOnce !== previousOnce) subscribe();
|
|
1397
|
+
if (!instance || nextOptionsKey !== mountedOptionsKey) {
|
|
1398
|
+
mountRace();
|
|
1399
|
+
return;
|
|
1400
|
+
}
|
|
1401
|
+
if (nextSpecKey !== mountedSpecKey) {
|
|
1402
|
+
instance.update(props.spec);
|
|
1403
|
+
mountedSpecKey = nextSpecKey;
|
|
1404
|
+
}
|
|
1405
|
+
if (nextThemeKey !== mountedThemeKey) {
|
|
1406
|
+
instance.setTheme(options.value);
|
|
1407
|
+
mountedThemeKey = nextThemeKey;
|
|
1408
|
+
}
|
|
1409
|
+
},
|
|
1410
|
+
{ flush: "post" }
|
|
1411
|
+
);
|
|
1412
|
+
return () => h7("div", {
|
|
1413
|
+
ref: containerRef,
|
|
1414
|
+
class: ["oc-root", props.class],
|
|
1415
|
+
style: props.style
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
1418
|
+
});
|
|
1419
|
+
|
|
1420
|
+
// src/Sankey.ts
|
|
1421
|
+
import { mergeThemeConfig as mergeThemeConfig7 } from "@opendata-ai/openchart-core";
|
|
1422
|
+
import {
|
|
1423
|
+
createSankey
|
|
1424
|
+
} from "@opendata-ai/openchart-vanilla";
|
|
1425
|
+
import {
|
|
1426
|
+
defineComponent as defineComponent8,
|
|
1427
|
+
h as h8,
|
|
1428
|
+
inject as inject8,
|
|
1429
|
+
onMounted as onMounted10,
|
|
1430
|
+
onUnmounted as onUnmounted11,
|
|
1431
|
+
ref as ref13,
|
|
1432
|
+
watch as watch11
|
|
1433
|
+
} from "vue";
|
|
1434
|
+
var Sankey = defineComponent8({
|
|
1318
1435
|
name: "Sankey",
|
|
1319
1436
|
props: {
|
|
1320
1437
|
spec: {
|
|
@@ -1345,13 +1462,13 @@ var Sankey = defineComponent7({
|
|
|
1345
1462
|
"link-hover": (_link) => true
|
|
1346
1463
|
},
|
|
1347
1464
|
setup(props, { emit, expose }) {
|
|
1348
|
-
const containerRef =
|
|
1465
|
+
const containerRef = ref13(null);
|
|
1349
1466
|
let instance = null;
|
|
1350
1467
|
let prevSpec = "";
|
|
1351
|
-
const contextTheme =
|
|
1352
|
-
const contextDarkMode =
|
|
1468
|
+
const contextTheme = inject8(VizThemeKey, void 0);
|
|
1469
|
+
const contextDarkMode = inject8(VizDarkModeKey, void 0);
|
|
1353
1470
|
function resolveTheme() {
|
|
1354
|
-
return
|
|
1471
|
+
return mergeThemeConfig7(contextTheme?.value, props.theme);
|
|
1355
1472
|
}
|
|
1356
1473
|
function resolveDarkMode() {
|
|
1357
1474
|
return props.darkMode ?? contextDarkMode?.value;
|
|
@@ -1381,13 +1498,13 @@ var Sankey = defineComponent7({
|
|
|
1381
1498
|
return instance;
|
|
1382
1499
|
}
|
|
1383
1500
|
});
|
|
1384
|
-
|
|
1501
|
+
onMounted10(() => {
|
|
1385
1502
|
mountSankey();
|
|
1386
1503
|
});
|
|
1387
|
-
|
|
1504
|
+
onUnmounted11(() => {
|
|
1388
1505
|
destroySankey();
|
|
1389
1506
|
});
|
|
1390
|
-
|
|
1507
|
+
watch11(
|
|
1391
1508
|
() => JSON.stringify(props.spec),
|
|
1392
1509
|
(newVal) => {
|
|
1393
1510
|
if (!instance) return;
|
|
@@ -1397,7 +1514,7 @@ var Sankey = defineComponent7({
|
|
|
1397
1514
|
}
|
|
1398
1515
|
}
|
|
1399
1516
|
);
|
|
1400
|
-
|
|
1517
|
+
watch11(
|
|
1401
1518
|
[
|
|
1402
1519
|
() => props.theme,
|
|
1403
1520
|
() => props.darkMode,
|
|
@@ -1414,7 +1531,7 @@ var Sankey = defineComponent7({
|
|
|
1414
1531
|
const base = "oc-sankey-root";
|
|
1415
1532
|
return props.class ? `${base} ${props.class}` : base;
|
|
1416
1533
|
};
|
|
1417
|
-
return () =>
|
|
1534
|
+
return () => h8("div", {
|
|
1418
1535
|
ref: containerRef,
|
|
1419
1536
|
class: rootClass(),
|
|
1420
1537
|
style: props.style
|
|
@@ -1423,8 +1540,8 @@ var Sankey = defineComponent7({
|
|
|
1423
1540
|
});
|
|
1424
1541
|
|
|
1425
1542
|
// src/ThemeProvider.ts
|
|
1426
|
-
import { computed as
|
|
1427
|
-
var VizThemeProvider =
|
|
1543
|
+
import { computed as computed3, defineComponent as defineComponent9, provide } from "vue";
|
|
1544
|
+
var VizThemeProvider = defineComponent9({
|
|
1428
1545
|
name: "VizThemeProvider",
|
|
1429
1546
|
props: {
|
|
1430
1547
|
theme: {
|
|
@@ -1437,8 +1554,8 @@ var VizThemeProvider = defineComponent8({
|
|
|
1437
1554
|
}
|
|
1438
1555
|
},
|
|
1439
1556
|
setup(props, { slots }) {
|
|
1440
|
-
const themeRef =
|
|
1441
|
-
const darkModeRef =
|
|
1557
|
+
const themeRef = computed3(() => props.theme);
|
|
1558
|
+
const darkModeRef = computed3(() => props.darkMode);
|
|
1442
1559
|
provide(VizThemeKey, themeRef);
|
|
1443
1560
|
provide(VizDarkModeKey, darkModeRef);
|
|
1444
1561
|
return () => slots.default?.();
|
|
@@ -1446,20 +1563,20 @@ var VizThemeProvider = defineComponent8({
|
|
|
1446
1563
|
});
|
|
1447
1564
|
|
|
1448
1565
|
// src/TileMap.ts
|
|
1449
|
-
import { mergeThemeConfig as
|
|
1566
|
+
import { mergeThemeConfig as mergeThemeConfig8 } from "@opendata-ai/openchart-core";
|
|
1450
1567
|
import {
|
|
1451
1568
|
createTileMap
|
|
1452
1569
|
} from "@opendata-ai/openchart-vanilla";
|
|
1453
1570
|
import {
|
|
1454
|
-
defineComponent as
|
|
1455
|
-
h as
|
|
1456
|
-
inject as
|
|
1457
|
-
onMounted as
|
|
1458
|
-
onUnmounted as
|
|
1459
|
-
ref as
|
|
1460
|
-
watch as
|
|
1571
|
+
defineComponent as defineComponent10,
|
|
1572
|
+
h as h9,
|
|
1573
|
+
inject as inject9,
|
|
1574
|
+
onMounted as onMounted11,
|
|
1575
|
+
onUnmounted as onUnmounted12,
|
|
1576
|
+
ref as ref14,
|
|
1577
|
+
watch as watch12
|
|
1461
1578
|
} from "vue";
|
|
1462
|
-
var TileMap =
|
|
1579
|
+
var TileMap = defineComponent10({
|
|
1463
1580
|
name: "TileMap",
|
|
1464
1581
|
props: {
|
|
1465
1582
|
spec: {
|
|
@@ -1488,13 +1605,13 @@ var TileMap = defineComponent9({
|
|
|
1488
1605
|
"tile-hover": (_tile) => true
|
|
1489
1606
|
},
|
|
1490
1607
|
setup(props, { emit, expose }) {
|
|
1491
|
-
const containerRef =
|
|
1608
|
+
const containerRef = ref14(null);
|
|
1492
1609
|
let instance = null;
|
|
1493
1610
|
let prevSpec = "";
|
|
1494
|
-
const contextTheme =
|
|
1495
|
-
const contextDarkMode =
|
|
1611
|
+
const contextTheme = inject9(VizThemeKey, void 0);
|
|
1612
|
+
const contextDarkMode = inject9(VizDarkModeKey, void 0);
|
|
1496
1613
|
function resolveTheme() {
|
|
1497
|
-
return
|
|
1614
|
+
return mergeThemeConfig8(contextTheme?.value, props.theme);
|
|
1498
1615
|
}
|
|
1499
1616
|
function resolveDarkMode() {
|
|
1500
1617
|
return props.darkMode ?? contextDarkMode?.value;
|
|
@@ -1522,13 +1639,13 @@ var TileMap = defineComponent9({
|
|
|
1522
1639
|
return instance;
|
|
1523
1640
|
}
|
|
1524
1641
|
});
|
|
1525
|
-
|
|
1642
|
+
onMounted11(() => {
|
|
1526
1643
|
mountTileMap();
|
|
1527
1644
|
});
|
|
1528
|
-
|
|
1645
|
+
onUnmounted12(() => {
|
|
1529
1646
|
destroyTileMap();
|
|
1530
1647
|
});
|
|
1531
|
-
|
|
1648
|
+
watch12(
|
|
1532
1649
|
() => JSON.stringify(props.spec),
|
|
1533
1650
|
(newVal) => {
|
|
1534
1651
|
if (!instance) return;
|
|
@@ -1538,7 +1655,7 @@ var TileMap = defineComponent9({
|
|
|
1538
1655
|
}
|
|
1539
1656
|
}
|
|
1540
1657
|
);
|
|
1541
|
-
|
|
1658
|
+
watch12(
|
|
1542
1659
|
[
|
|
1543
1660
|
() => props.theme,
|
|
1544
1661
|
() => props.darkMode,
|
|
@@ -1555,7 +1672,7 @@ var TileMap = defineComponent9({
|
|
|
1555
1672
|
const base = "oc-tilemap-root";
|
|
1556
1673
|
return props.class ? `${base} ${props.class}` : base;
|
|
1557
1674
|
};
|
|
1558
|
-
return () =>
|
|
1675
|
+
return () => h9("div", {
|
|
1559
1676
|
ref: containerRef,
|
|
1560
1677
|
class: rootClass(),
|
|
1561
1678
|
style: props.style
|
|
@@ -1568,12 +1685,13 @@ import {
|
|
|
1568
1685
|
isBarListSpec,
|
|
1569
1686
|
isGeoMapSpec,
|
|
1570
1687
|
isGraphSpec,
|
|
1688
|
+
isRaceSpec,
|
|
1571
1689
|
isSankeySpec,
|
|
1572
1690
|
isTableSpec,
|
|
1573
1691
|
isTileMapSpec
|
|
1574
1692
|
} from "@opendata-ai/openchart-core";
|
|
1575
|
-
import { defineComponent as
|
|
1576
|
-
var Visualization =
|
|
1693
|
+
import { defineComponent as defineComponent11, h as h10 } from "vue";
|
|
1694
|
+
var Visualization = defineComponent11({
|
|
1577
1695
|
name: "Visualization",
|
|
1578
1696
|
props: {
|
|
1579
1697
|
spec: {
|
|
@@ -1602,24 +1720,27 @@ var Visualization = defineComponent10({
|
|
|
1602
1720
|
const { spec, theme, darkMode, class: className, style } = props;
|
|
1603
1721
|
const sharedProps = { theme, darkMode, class: className, style };
|
|
1604
1722
|
if (isTableSpec(spec)) {
|
|
1605
|
-
return
|
|
1723
|
+
return h10(DataTable, { ...sharedProps, spec });
|
|
1606
1724
|
}
|
|
1607
1725
|
if (isGraphSpec(spec)) {
|
|
1608
|
-
return
|
|
1726
|
+
return h10(Graph, { ...sharedProps, spec });
|
|
1609
1727
|
}
|
|
1610
1728
|
if (isSankeySpec(spec)) {
|
|
1611
|
-
return
|
|
1729
|
+
return h10(Sankey, { ...sharedProps, spec });
|
|
1612
1730
|
}
|
|
1613
1731
|
if (isTileMapSpec(spec)) {
|
|
1614
|
-
return
|
|
1732
|
+
return h10(TileMap, { ...sharedProps, spec });
|
|
1615
1733
|
}
|
|
1616
1734
|
if (isBarListSpec(spec)) {
|
|
1617
|
-
return
|
|
1735
|
+
return h10(BarList, { ...sharedProps, spec });
|
|
1618
1736
|
}
|
|
1619
1737
|
if (isGeoMapSpec(spec)) {
|
|
1620
|
-
return
|
|
1738
|
+
return h10(GeoMap, { ...sharedProps, spec });
|
|
1739
|
+
}
|
|
1740
|
+
if (isRaceSpec(spec)) {
|
|
1741
|
+
return h10(Race, { ...sharedProps, spec });
|
|
1621
1742
|
}
|
|
1622
|
-
return
|
|
1743
|
+
return h10(Chart, { ...sharedProps, spec });
|
|
1623
1744
|
};
|
|
1624
1745
|
}
|
|
1625
1746
|
});
|
|
@@ -1630,6 +1751,7 @@ export {
|
|
|
1630
1751
|
DataTable,
|
|
1631
1752
|
GeoMap,
|
|
1632
1753
|
Graph,
|
|
1754
|
+
Race,
|
|
1633
1755
|
Sankey,
|
|
1634
1756
|
TileMap,
|
|
1635
1757
|
Visualization,
|