@opendata-ai/openchart-vue 9.0.0 → 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 +112 -3
- package/dist/index.js +164 -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, MarkFocusEvent, 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';
|
|
@@ -935,6 +935,115 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
935
935
|
initialZoom: number;
|
|
936
936
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
937
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
|
+
|
|
938
1047
|
interface SankeyProps {
|
|
939
1048
|
spec: SankeySpec;
|
|
940
1049
|
theme?: ThemeConfig;
|
|
@@ -1160,4 +1269,4 @@ declare const Visualization: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
1160
1269
|
style: string | CSSProperties;
|
|
1161
1270
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
1162
1271
|
|
|
1163
|
-
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
|
@@ -1152,6 +1152,7 @@ var Graph = defineComponent6({
|
|
|
1152
1152
|
let instance = null;
|
|
1153
1153
|
let prevSpec = "";
|
|
1154
1154
|
let mountedOnce = false;
|
|
1155
|
+
let prevEntrancePlayed = false;
|
|
1155
1156
|
const contextTheme = inject6(VizThemeKey, void 0);
|
|
1156
1157
|
const contextDarkMode = inject6(VizDarkModeKey, void 0);
|
|
1157
1158
|
function resolveTheme() {
|
|
@@ -1186,13 +1187,16 @@ var Graph = defineComponent6({
|
|
|
1186
1187
|
onHighlightChange: (nodeIds) => emit("highlight-change", nodeIds),
|
|
1187
1188
|
onCameraChange: (camera) => emit("camera-change", camera),
|
|
1188
1189
|
autoResize: true,
|
|
1189
|
-
|
|
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
|
|
1190
1193
|
};
|
|
1191
1194
|
instance = createGraph(container, props.spec, options);
|
|
1192
1195
|
prevSpec = JSON.stringify(props.spec);
|
|
1193
1196
|
mountedOnce = true;
|
|
1194
1197
|
}
|
|
1195
1198
|
function destroyGraph() {
|
|
1199
|
+
prevEntrancePlayed = instance?.entrancePlayed ?? false;
|
|
1196
1200
|
instance?.destroy();
|
|
1197
1201
|
instance = null;
|
|
1198
1202
|
prevSpec = "";
|
|
@@ -1302,12 +1306,13 @@ var Graph = defineComponent6({
|
|
|
1302
1306
|
}
|
|
1303
1307
|
});
|
|
1304
1308
|
|
|
1305
|
-
// src/
|
|
1309
|
+
// src/Race.ts
|
|
1306
1310
|
import { mergeThemeConfig as mergeThemeConfig6 } from "@opendata-ai/openchart-core";
|
|
1307
1311
|
import {
|
|
1308
|
-
|
|
1312
|
+
createRace
|
|
1309
1313
|
} from "@opendata-ai/openchart-vanilla";
|
|
1310
1314
|
import {
|
|
1315
|
+
computed as computed2,
|
|
1311
1316
|
defineComponent as defineComponent7,
|
|
1312
1317
|
h as h7,
|
|
1313
1318
|
inject as inject7,
|
|
@@ -1316,7 +1321,117 @@ import {
|
|
|
1316
1321
|
ref as ref12,
|
|
1317
1322
|
watch as watch10
|
|
1318
1323
|
} from "vue";
|
|
1319
|
-
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({
|
|
1320
1435
|
name: "Sankey",
|
|
1321
1436
|
props: {
|
|
1322
1437
|
spec: {
|
|
@@ -1347,13 +1462,13 @@ var Sankey = defineComponent7({
|
|
|
1347
1462
|
"link-hover": (_link) => true
|
|
1348
1463
|
},
|
|
1349
1464
|
setup(props, { emit, expose }) {
|
|
1350
|
-
const containerRef =
|
|
1465
|
+
const containerRef = ref13(null);
|
|
1351
1466
|
let instance = null;
|
|
1352
1467
|
let prevSpec = "";
|
|
1353
|
-
const contextTheme =
|
|
1354
|
-
const contextDarkMode =
|
|
1468
|
+
const contextTheme = inject8(VizThemeKey, void 0);
|
|
1469
|
+
const contextDarkMode = inject8(VizDarkModeKey, void 0);
|
|
1355
1470
|
function resolveTheme() {
|
|
1356
|
-
return
|
|
1471
|
+
return mergeThemeConfig7(contextTheme?.value, props.theme);
|
|
1357
1472
|
}
|
|
1358
1473
|
function resolveDarkMode() {
|
|
1359
1474
|
return props.darkMode ?? contextDarkMode?.value;
|
|
@@ -1383,13 +1498,13 @@ var Sankey = defineComponent7({
|
|
|
1383
1498
|
return instance;
|
|
1384
1499
|
}
|
|
1385
1500
|
});
|
|
1386
|
-
|
|
1501
|
+
onMounted10(() => {
|
|
1387
1502
|
mountSankey();
|
|
1388
1503
|
});
|
|
1389
|
-
|
|
1504
|
+
onUnmounted11(() => {
|
|
1390
1505
|
destroySankey();
|
|
1391
1506
|
});
|
|
1392
|
-
|
|
1507
|
+
watch11(
|
|
1393
1508
|
() => JSON.stringify(props.spec),
|
|
1394
1509
|
(newVal) => {
|
|
1395
1510
|
if (!instance) return;
|
|
@@ -1399,7 +1514,7 @@ var Sankey = defineComponent7({
|
|
|
1399
1514
|
}
|
|
1400
1515
|
}
|
|
1401
1516
|
);
|
|
1402
|
-
|
|
1517
|
+
watch11(
|
|
1403
1518
|
[
|
|
1404
1519
|
() => props.theme,
|
|
1405
1520
|
() => props.darkMode,
|
|
@@ -1416,7 +1531,7 @@ var Sankey = defineComponent7({
|
|
|
1416
1531
|
const base = "oc-sankey-root";
|
|
1417
1532
|
return props.class ? `${base} ${props.class}` : base;
|
|
1418
1533
|
};
|
|
1419
|
-
return () =>
|
|
1534
|
+
return () => h8("div", {
|
|
1420
1535
|
ref: containerRef,
|
|
1421
1536
|
class: rootClass(),
|
|
1422
1537
|
style: props.style
|
|
@@ -1425,8 +1540,8 @@ var Sankey = defineComponent7({
|
|
|
1425
1540
|
});
|
|
1426
1541
|
|
|
1427
1542
|
// src/ThemeProvider.ts
|
|
1428
|
-
import { computed as
|
|
1429
|
-
var VizThemeProvider =
|
|
1543
|
+
import { computed as computed3, defineComponent as defineComponent9, provide } from "vue";
|
|
1544
|
+
var VizThemeProvider = defineComponent9({
|
|
1430
1545
|
name: "VizThemeProvider",
|
|
1431
1546
|
props: {
|
|
1432
1547
|
theme: {
|
|
@@ -1439,8 +1554,8 @@ var VizThemeProvider = defineComponent8({
|
|
|
1439
1554
|
}
|
|
1440
1555
|
},
|
|
1441
1556
|
setup(props, { slots }) {
|
|
1442
|
-
const themeRef =
|
|
1443
|
-
const darkModeRef =
|
|
1557
|
+
const themeRef = computed3(() => props.theme);
|
|
1558
|
+
const darkModeRef = computed3(() => props.darkMode);
|
|
1444
1559
|
provide(VizThemeKey, themeRef);
|
|
1445
1560
|
provide(VizDarkModeKey, darkModeRef);
|
|
1446
1561
|
return () => slots.default?.();
|
|
@@ -1448,20 +1563,20 @@ var VizThemeProvider = defineComponent8({
|
|
|
1448
1563
|
});
|
|
1449
1564
|
|
|
1450
1565
|
// src/TileMap.ts
|
|
1451
|
-
import { mergeThemeConfig as
|
|
1566
|
+
import { mergeThemeConfig as mergeThemeConfig8 } from "@opendata-ai/openchart-core";
|
|
1452
1567
|
import {
|
|
1453
1568
|
createTileMap
|
|
1454
1569
|
} from "@opendata-ai/openchart-vanilla";
|
|
1455
1570
|
import {
|
|
1456
|
-
defineComponent as
|
|
1457
|
-
h as
|
|
1458
|
-
inject as
|
|
1459
|
-
onMounted as
|
|
1460
|
-
onUnmounted as
|
|
1461
|
-
ref as
|
|
1462
|
-
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
|
|
1463
1578
|
} from "vue";
|
|
1464
|
-
var TileMap =
|
|
1579
|
+
var TileMap = defineComponent10({
|
|
1465
1580
|
name: "TileMap",
|
|
1466
1581
|
props: {
|
|
1467
1582
|
spec: {
|
|
@@ -1490,13 +1605,13 @@ var TileMap = defineComponent9({
|
|
|
1490
1605
|
"tile-hover": (_tile) => true
|
|
1491
1606
|
},
|
|
1492
1607
|
setup(props, { emit, expose }) {
|
|
1493
|
-
const containerRef =
|
|
1608
|
+
const containerRef = ref14(null);
|
|
1494
1609
|
let instance = null;
|
|
1495
1610
|
let prevSpec = "";
|
|
1496
|
-
const contextTheme =
|
|
1497
|
-
const contextDarkMode =
|
|
1611
|
+
const contextTheme = inject9(VizThemeKey, void 0);
|
|
1612
|
+
const contextDarkMode = inject9(VizDarkModeKey, void 0);
|
|
1498
1613
|
function resolveTheme() {
|
|
1499
|
-
return
|
|
1614
|
+
return mergeThemeConfig8(contextTheme?.value, props.theme);
|
|
1500
1615
|
}
|
|
1501
1616
|
function resolveDarkMode() {
|
|
1502
1617
|
return props.darkMode ?? contextDarkMode?.value;
|
|
@@ -1524,13 +1639,13 @@ var TileMap = defineComponent9({
|
|
|
1524
1639
|
return instance;
|
|
1525
1640
|
}
|
|
1526
1641
|
});
|
|
1527
|
-
|
|
1642
|
+
onMounted11(() => {
|
|
1528
1643
|
mountTileMap();
|
|
1529
1644
|
});
|
|
1530
|
-
|
|
1645
|
+
onUnmounted12(() => {
|
|
1531
1646
|
destroyTileMap();
|
|
1532
1647
|
});
|
|
1533
|
-
|
|
1648
|
+
watch12(
|
|
1534
1649
|
() => JSON.stringify(props.spec),
|
|
1535
1650
|
(newVal) => {
|
|
1536
1651
|
if (!instance) return;
|
|
@@ -1540,7 +1655,7 @@ var TileMap = defineComponent9({
|
|
|
1540
1655
|
}
|
|
1541
1656
|
}
|
|
1542
1657
|
);
|
|
1543
|
-
|
|
1658
|
+
watch12(
|
|
1544
1659
|
[
|
|
1545
1660
|
() => props.theme,
|
|
1546
1661
|
() => props.darkMode,
|
|
@@ -1557,7 +1672,7 @@ var TileMap = defineComponent9({
|
|
|
1557
1672
|
const base = "oc-tilemap-root";
|
|
1558
1673
|
return props.class ? `${base} ${props.class}` : base;
|
|
1559
1674
|
};
|
|
1560
|
-
return () =>
|
|
1675
|
+
return () => h9("div", {
|
|
1561
1676
|
ref: containerRef,
|
|
1562
1677
|
class: rootClass(),
|
|
1563
1678
|
style: props.style
|
|
@@ -1570,12 +1685,13 @@ import {
|
|
|
1570
1685
|
isBarListSpec,
|
|
1571
1686
|
isGeoMapSpec,
|
|
1572
1687
|
isGraphSpec,
|
|
1688
|
+
isRaceSpec,
|
|
1573
1689
|
isSankeySpec,
|
|
1574
1690
|
isTableSpec,
|
|
1575
1691
|
isTileMapSpec
|
|
1576
1692
|
} from "@opendata-ai/openchart-core";
|
|
1577
|
-
import { defineComponent as
|
|
1578
|
-
var Visualization =
|
|
1693
|
+
import { defineComponent as defineComponent11, h as h10 } from "vue";
|
|
1694
|
+
var Visualization = defineComponent11({
|
|
1579
1695
|
name: "Visualization",
|
|
1580
1696
|
props: {
|
|
1581
1697
|
spec: {
|
|
@@ -1604,24 +1720,27 @@ var Visualization = defineComponent10({
|
|
|
1604
1720
|
const { spec, theme, darkMode, class: className, style } = props;
|
|
1605
1721
|
const sharedProps = { theme, darkMode, class: className, style };
|
|
1606
1722
|
if (isTableSpec(spec)) {
|
|
1607
|
-
return
|
|
1723
|
+
return h10(DataTable, { ...sharedProps, spec });
|
|
1608
1724
|
}
|
|
1609
1725
|
if (isGraphSpec(spec)) {
|
|
1610
|
-
return
|
|
1726
|
+
return h10(Graph, { ...sharedProps, spec });
|
|
1611
1727
|
}
|
|
1612
1728
|
if (isSankeySpec(spec)) {
|
|
1613
|
-
return
|
|
1729
|
+
return h10(Sankey, { ...sharedProps, spec });
|
|
1614
1730
|
}
|
|
1615
1731
|
if (isTileMapSpec(spec)) {
|
|
1616
|
-
return
|
|
1732
|
+
return h10(TileMap, { ...sharedProps, spec });
|
|
1617
1733
|
}
|
|
1618
1734
|
if (isBarListSpec(spec)) {
|
|
1619
|
-
return
|
|
1735
|
+
return h10(BarList, { ...sharedProps, spec });
|
|
1620
1736
|
}
|
|
1621
1737
|
if (isGeoMapSpec(spec)) {
|
|
1622
|
-
return
|
|
1738
|
+
return h10(GeoMap, { ...sharedProps, spec });
|
|
1739
|
+
}
|
|
1740
|
+
if (isRaceSpec(spec)) {
|
|
1741
|
+
return h10(Race, { ...sharedProps, spec });
|
|
1623
1742
|
}
|
|
1624
|
-
return
|
|
1743
|
+
return h10(Chart, { ...sharedProps, spec });
|
|
1625
1744
|
};
|
|
1626
1745
|
}
|
|
1627
1746
|
});
|
|
@@ -1632,6 +1751,7 @@ export {
|
|
|
1632
1751
|
DataTable,
|
|
1633
1752
|
GeoMap,
|
|
1634
1753
|
Graph,
|
|
1754
|
+
Race,
|
|
1635
1755
|
Sankey,
|
|
1636
1756
|
TileMap,
|
|
1637
1757
|
Visualization,
|