@opendata-ai/openchart-vue 7.11.0 → 8.0.0-rc.2
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 +154 -4
- package/dist/index.js +356 -90
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -1
- package/dist/styles.css.map +1 -0
- package/package.json +4 -4
- package/src/ChartStory.ts +184 -0
- package/src/Map.ts +160 -0
- package/src/Visualization.ts +5 -0
- package/src/__tests__/ChartStory.test.ts +70 -0
- package/src/index.ts +7 -0
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
compileBarList,
|
|
8
8
|
compileChart,
|
|
9
9
|
compileGraph,
|
|
10
|
+
compileMap,
|
|
10
11
|
compileSankey,
|
|
11
12
|
compileTable,
|
|
12
13
|
getChartRenderer,
|
|
@@ -333,11 +334,154 @@ var Chart = defineComponent2({
|
|
|
333
334
|
}
|
|
334
335
|
});
|
|
335
336
|
|
|
337
|
+
// src/ChartStory.ts
|
|
338
|
+
import {
|
|
339
|
+
createChartStory
|
|
340
|
+
} from "@opendata-ai/openchart-vanilla/story";
|
|
341
|
+
import {
|
|
342
|
+
defineComponent as defineComponent3,
|
|
343
|
+
h as h3,
|
|
344
|
+
onMounted as onMounted3,
|
|
345
|
+
onUnmounted as onUnmounted3,
|
|
346
|
+
ref as ref3,
|
|
347
|
+
watch as watch3
|
|
348
|
+
} from "vue";
|
|
349
|
+
var sectionStyle = {
|
|
350
|
+
position: "relative",
|
|
351
|
+
display: "grid",
|
|
352
|
+
gridTemplateColumns: "minmax(0, 26rem) minmax(0, 1fr)",
|
|
353
|
+
gap: "3rem",
|
|
354
|
+
alignItems: "start"
|
|
355
|
+
};
|
|
356
|
+
var stepStyle = {
|
|
357
|
+
minHeight: "80vh",
|
|
358
|
+
display: "flex",
|
|
359
|
+
alignItems: "center"
|
|
360
|
+
};
|
|
361
|
+
var panelStyle = {
|
|
362
|
+
position: "sticky",
|
|
363
|
+
top: "2rem",
|
|
364
|
+
height: "calc(100vh - 4rem)",
|
|
365
|
+
display: "flex",
|
|
366
|
+
alignItems: "center",
|
|
367
|
+
justifyContent: "center"
|
|
368
|
+
};
|
|
369
|
+
var ChartStory = defineComponent3({
|
|
370
|
+
name: "ChartStory",
|
|
371
|
+
props: {
|
|
372
|
+
spec: {
|
|
373
|
+
type: Object,
|
|
374
|
+
required: true
|
|
375
|
+
},
|
|
376
|
+
steps: {
|
|
377
|
+
type: Array,
|
|
378
|
+
required: true
|
|
379
|
+
},
|
|
380
|
+
narrative: {
|
|
381
|
+
type: Array,
|
|
382
|
+
default: void 0
|
|
383
|
+
},
|
|
384
|
+
step: {
|
|
385
|
+
type: Number,
|
|
386
|
+
default: void 0
|
|
387
|
+
},
|
|
388
|
+
triggerPosition: {
|
|
389
|
+
type: Number,
|
|
390
|
+
default: void 0
|
|
391
|
+
},
|
|
392
|
+
cameraMode: {
|
|
393
|
+
type: String,
|
|
394
|
+
default: void 0
|
|
395
|
+
},
|
|
396
|
+
mountOptions: {
|
|
397
|
+
type: Object,
|
|
398
|
+
default: void 0
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
setup(props, { slots, expose }) {
|
|
402
|
+
const sectionRef = ref3(null);
|
|
403
|
+
const mountRef = ref3(null);
|
|
404
|
+
const stepEls = ref3([]);
|
|
405
|
+
let story = null;
|
|
406
|
+
onMounted3(() => {
|
|
407
|
+
const mount = mountRef.value;
|
|
408
|
+
if (!mount) return;
|
|
409
|
+
const blocks = props.narrative ?? [];
|
|
410
|
+
if (blocks.length > 0 && blocks.length !== props.steps.length) {
|
|
411
|
+
console.warn(
|
|
412
|
+
`[openchart] ChartStory: narrative length (${blocks.length}) does not match steps length (${props.steps.length}). Each step should have a corresponding narrative element.`
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
story = createChartStory(
|
|
416
|
+
mount,
|
|
417
|
+
{
|
|
418
|
+
spec: props.spec,
|
|
419
|
+
steps: props.steps,
|
|
420
|
+
triggerPosition: props.triggerPosition,
|
|
421
|
+
cameraMode: props.cameraMode
|
|
422
|
+
},
|
|
423
|
+
props.mountOptions
|
|
424
|
+
);
|
|
425
|
+
if (sectionRef.value) story.setContainer(sectionRef.value);
|
|
426
|
+
stepEls.value.forEach((el, i) => {
|
|
427
|
+
if (el) story?.registerStep(i, el);
|
|
428
|
+
});
|
|
429
|
+
if (props.step !== void 0) story.goTo(props.step);
|
|
430
|
+
});
|
|
431
|
+
watch3(
|
|
432
|
+
() => props.step,
|
|
433
|
+
(next) => {
|
|
434
|
+
if (next !== void 0) story?.goTo(next);
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
onUnmounted3(() => {
|
|
438
|
+
story?.destroy();
|
|
439
|
+
story = null;
|
|
440
|
+
});
|
|
441
|
+
expose({
|
|
442
|
+
goTo(index) {
|
|
443
|
+
story?.goTo(index);
|
|
444
|
+
},
|
|
445
|
+
get instance() {
|
|
446
|
+
return story;
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
return () => {
|
|
450
|
+
const blocks = props.narrative ?? slots.default?.() ?? [];
|
|
451
|
+
return h3("section", { ref: sectionRef, style: sectionStyle }, [
|
|
452
|
+
h3(
|
|
453
|
+
"div",
|
|
454
|
+
{ style: { position: "relative" } },
|
|
455
|
+
blocks.map(
|
|
456
|
+
(content, i) => h3(
|
|
457
|
+
"div",
|
|
458
|
+
{
|
|
459
|
+
// Steps are a fixed ordered list, so the index is the stable
|
|
460
|
+
// identity. Do not reorder or splice narrative entries at runtime
|
|
461
|
+
// (that would remap step refs to the wrong content); rebuild the
|
|
462
|
+
// whole story instead.
|
|
463
|
+
key: i,
|
|
464
|
+
ref: (el) => {
|
|
465
|
+
stepEls.value[i] = el;
|
|
466
|
+
},
|
|
467
|
+
"data-oc-story-step": i,
|
|
468
|
+
style: stepStyle
|
|
469
|
+
},
|
|
470
|
+
[h3("div", { style: { maxWidth: "36rem" } }, [content])]
|
|
471
|
+
)
|
|
472
|
+
)
|
|
473
|
+
),
|
|
474
|
+
h3("div", { style: panelStyle }, [h3("div", { ref: mountRef, style: { width: "100%" } })])
|
|
475
|
+
]);
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
|
|
336
480
|
// src/composables/useChart.ts
|
|
337
481
|
import { createChart as createChart2 } from "@opendata-ai/openchart-vanilla";
|
|
338
|
-
import { onMounted as
|
|
482
|
+
import { onMounted as onMounted4, onUnmounted as onUnmounted4, ref as ref4, shallowRef, watch as watch4 } from "vue";
|
|
339
483
|
function useChart(spec, options) {
|
|
340
|
-
const containerRef =
|
|
484
|
+
const containerRef = ref4(null);
|
|
341
485
|
const chart = shallowRef(null);
|
|
342
486
|
const layout = shallowRef(null);
|
|
343
487
|
function mount() {
|
|
@@ -358,13 +502,13 @@ function useChart(spec, options) {
|
|
|
358
502
|
chart.value = null;
|
|
359
503
|
layout.value = null;
|
|
360
504
|
}
|
|
361
|
-
|
|
505
|
+
onMounted4(() => {
|
|
362
506
|
mount();
|
|
363
507
|
});
|
|
364
|
-
|
|
508
|
+
onUnmounted4(() => {
|
|
365
509
|
destroy();
|
|
366
510
|
});
|
|
367
|
-
|
|
511
|
+
watch4(spec, (newSpec) => {
|
|
368
512
|
const instance = chart.value;
|
|
369
513
|
if (!instance) return;
|
|
370
514
|
instance.update(newSpec);
|
|
@@ -378,9 +522,9 @@ function useChart(spec, options) {
|
|
|
378
522
|
}
|
|
379
523
|
|
|
380
524
|
// src/composables/useDarkMode.ts
|
|
381
|
-
import { onUnmounted as
|
|
525
|
+
import { onUnmounted as onUnmounted5, ref as ref5, watch as watch5 } from "vue";
|
|
382
526
|
function useDarkMode(mode) {
|
|
383
|
-
const isDark =
|
|
527
|
+
const isDark = ref5(resolveInitial(mode.value));
|
|
384
528
|
let cleanup = null;
|
|
385
529
|
function setup(currentMode) {
|
|
386
530
|
cleanup?.();
|
|
@@ -402,10 +546,10 @@ function useDarkMode(mode) {
|
|
|
402
546
|
cleanup = () => mq.removeEventListener("change", handler);
|
|
403
547
|
}
|
|
404
548
|
setup(mode.value);
|
|
405
|
-
|
|
549
|
+
watch5(mode, (newMode) => {
|
|
406
550
|
setup(newMode);
|
|
407
551
|
});
|
|
408
|
-
|
|
552
|
+
onUnmounted5(() => {
|
|
409
553
|
cleanup?.();
|
|
410
554
|
cleanup = null;
|
|
411
555
|
});
|
|
@@ -421,9 +565,9 @@ function resolveInitial(mode) {
|
|
|
421
565
|
}
|
|
422
566
|
|
|
423
567
|
// src/composables/useGraph.ts
|
|
424
|
-
import { ref as
|
|
568
|
+
import { ref as ref6 } from "vue";
|
|
425
569
|
function useGraph() {
|
|
426
|
-
const graphRef =
|
|
570
|
+
const graphRef = ref6(null);
|
|
427
571
|
function search(query) {
|
|
428
572
|
graphRef.value?.search(query);
|
|
429
573
|
}
|
|
@@ -457,11 +601,11 @@ function useGraph() {
|
|
|
457
601
|
import {
|
|
458
602
|
createTable
|
|
459
603
|
} from "@opendata-ai/openchart-vanilla";
|
|
460
|
-
import { onMounted as
|
|
604
|
+
import { onMounted as onMounted5, onUnmounted as onUnmounted6, ref as ref7, shallowRef as shallowRef2, watch as watch6 } from "vue";
|
|
461
605
|
function useTable(spec, options) {
|
|
462
|
-
const containerRef =
|
|
606
|
+
const containerRef = ref7(null);
|
|
463
607
|
const table = shallowRef2(null);
|
|
464
|
-
const state =
|
|
608
|
+
const state = ref7({
|
|
465
609
|
sort: null,
|
|
466
610
|
search: "",
|
|
467
611
|
page: 0
|
|
@@ -486,13 +630,13 @@ function useTable(spec, options) {
|
|
|
486
630
|
table.value?.destroy();
|
|
487
631
|
table.value = null;
|
|
488
632
|
}
|
|
489
|
-
|
|
633
|
+
onMounted5(() => {
|
|
490
634
|
mount();
|
|
491
635
|
});
|
|
492
|
-
|
|
636
|
+
onUnmounted6(() => {
|
|
493
637
|
destroy();
|
|
494
638
|
});
|
|
495
|
-
|
|
639
|
+
watch6(spec, (newSpec) => {
|
|
496
640
|
const instance = table.value;
|
|
497
641
|
if (!instance) return;
|
|
498
642
|
instance.update(newSpec);
|
|
@@ -506,11 +650,11 @@ function useTable(spec, options) {
|
|
|
506
650
|
}
|
|
507
651
|
|
|
508
652
|
// src/composables/useTableState.ts
|
|
509
|
-
import { ref as
|
|
653
|
+
import { ref as ref8 } from "vue";
|
|
510
654
|
function useTableState(initialState) {
|
|
511
|
-
const sort =
|
|
512
|
-
const search =
|
|
513
|
-
const page =
|
|
655
|
+
const sort = ref8(initialState?.sort ?? null);
|
|
656
|
+
const search = ref8(initialState?.search ?? "");
|
|
657
|
+
const page = ref8(initialState?.page ?? 0);
|
|
514
658
|
function setSort(newSort) {
|
|
515
659
|
sort.value = newSort;
|
|
516
660
|
}
|
|
@@ -541,15 +685,15 @@ import {
|
|
|
541
685
|
createTable as createTable2
|
|
542
686
|
} from "@opendata-ai/openchart-vanilla";
|
|
543
687
|
import {
|
|
544
|
-
defineComponent as
|
|
545
|
-
h as
|
|
688
|
+
defineComponent as defineComponent4,
|
|
689
|
+
h as h4,
|
|
546
690
|
inject as inject4,
|
|
547
|
-
onMounted as
|
|
548
|
-
onUnmounted as
|
|
549
|
-
ref as
|
|
550
|
-
watch as
|
|
691
|
+
onMounted as onMounted6,
|
|
692
|
+
onUnmounted as onUnmounted7,
|
|
693
|
+
ref as ref9,
|
|
694
|
+
watch as watch7
|
|
551
695
|
} from "vue";
|
|
552
|
-
var DataTable =
|
|
696
|
+
var DataTable = defineComponent4({
|
|
553
697
|
name: "DataTable",
|
|
554
698
|
props: {
|
|
555
699
|
spec: {
|
|
@@ -592,7 +736,7 @@ var DataTable = defineComponent3({
|
|
|
592
736
|
"update:page": (_page) => true
|
|
593
737
|
},
|
|
594
738
|
setup(props, { emit }) {
|
|
595
|
-
const containerRef =
|
|
739
|
+
const containerRef = ref9(null);
|
|
596
740
|
let instance = null;
|
|
597
741
|
const contextTheme = inject4(VizThemeKey, void 0);
|
|
598
742
|
const contextDarkMode = inject4(VizDarkModeKey, void 0);
|
|
@@ -635,13 +779,13 @@ var DataTable = defineComponent3({
|
|
|
635
779
|
instance = null;
|
|
636
780
|
prevSpec = "";
|
|
637
781
|
}
|
|
638
|
-
|
|
782
|
+
onMounted6(() => {
|
|
639
783
|
mountTable();
|
|
640
784
|
});
|
|
641
|
-
|
|
785
|
+
onUnmounted7(() => {
|
|
642
786
|
destroyTable();
|
|
643
787
|
});
|
|
644
|
-
|
|
788
|
+
watch7(
|
|
645
789
|
() => JSON.stringify(props.spec),
|
|
646
790
|
(newVal) => {
|
|
647
791
|
if (!instance) return;
|
|
@@ -651,7 +795,7 @@ var DataTable = defineComponent3({
|
|
|
651
795
|
}
|
|
652
796
|
}
|
|
653
797
|
);
|
|
654
|
-
|
|
798
|
+
watch7(
|
|
655
799
|
[
|
|
656
800
|
() => props.theme,
|
|
657
801
|
() => props.darkMode,
|
|
@@ -664,7 +808,7 @@ var DataTable = defineComponent3({
|
|
|
664
808
|
mountTable();
|
|
665
809
|
}
|
|
666
810
|
);
|
|
667
|
-
|
|
811
|
+
watch7([() => props.sort, () => props.search, () => props.page], () => {
|
|
668
812
|
if (!instance || !isControlled()) return;
|
|
669
813
|
instance.setState({
|
|
670
814
|
sort: props.sort ?? null,
|
|
@@ -676,7 +820,7 @@ var DataTable = defineComponent3({
|
|
|
676
820
|
const base = "oc-table-root";
|
|
677
821
|
return props.class ? `${base} ${props.class}` : base;
|
|
678
822
|
};
|
|
679
|
-
return () =>
|
|
823
|
+
return () => h4("div", {
|
|
680
824
|
ref: containerRef,
|
|
681
825
|
class: rootClass(),
|
|
682
826
|
style: props.style
|
|
@@ -689,15 +833,15 @@ import {
|
|
|
689
833
|
createGraph
|
|
690
834
|
} from "@opendata-ai/openchart-vanilla";
|
|
691
835
|
import {
|
|
692
|
-
defineComponent as
|
|
693
|
-
h as
|
|
836
|
+
defineComponent as defineComponent5,
|
|
837
|
+
h as h5,
|
|
694
838
|
inject as inject5,
|
|
695
|
-
onMounted as
|
|
696
|
-
onUnmounted as
|
|
697
|
-
ref as
|
|
698
|
-
watch as
|
|
839
|
+
onMounted as onMounted7,
|
|
840
|
+
onUnmounted as onUnmounted8,
|
|
841
|
+
ref as ref10,
|
|
842
|
+
watch as watch8
|
|
699
843
|
} from "vue";
|
|
700
|
-
var Graph =
|
|
844
|
+
var Graph = defineComponent5({
|
|
701
845
|
name: "Graph",
|
|
702
846
|
props: {
|
|
703
847
|
spec: {
|
|
@@ -727,7 +871,7 @@ var Graph = defineComponent4({
|
|
|
727
871
|
"selection-change": (_nodeIds) => true
|
|
728
872
|
},
|
|
729
873
|
setup(props, { emit, expose }) {
|
|
730
|
-
const containerRef =
|
|
874
|
+
const containerRef = ref10(null);
|
|
731
875
|
let instance = null;
|
|
732
876
|
let prevSpec = "";
|
|
733
877
|
const contextTheme = inject5(VizThemeKey, void 0);
|
|
@@ -780,13 +924,13 @@ var Graph = defineComponent4({
|
|
|
780
924
|
return instance;
|
|
781
925
|
}
|
|
782
926
|
});
|
|
783
|
-
|
|
927
|
+
onMounted7(() => {
|
|
784
928
|
mountGraph();
|
|
785
929
|
});
|
|
786
|
-
|
|
930
|
+
onUnmounted8(() => {
|
|
787
931
|
destroyGraph();
|
|
788
932
|
});
|
|
789
|
-
|
|
933
|
+
watch8(
|
|
790
934
|
() => JSON.stringify(props.spec),
|
|
791
935
|
(newVal) => {
|
|
792
936
|
if (!instance) return;
|
|
@@ -796,7 +940,7 @@ var Graph = defineComponent4({
|
|
|
796
940
|
}
|
|
797
941
|
}
|
|
798
942
|
);
|
|
799
|
-
|
|
943
|
+
watch8(
|
|
800
944
|
[
|
|
801
945
|
() => props.theme,
|
|
802
946
|
() => props.darkMode,
|
|
@@ -813,7 +957,122 @@ var Graph = defineComponent4({
|
|
|
813
957
|
const base = "oc-graph-root";
|
|
814
958
|
return props.class ? `${base} ${props.class}` : base;
|
|
815
959
|
};
|
|
816
|
-
return () =>
|
|
960
|
+
return () => h5("div", {
|
|
961
|
+
ref: containerRef,
|
|
962
|
+
class: rootClass(),
|
|
963
|
+
style: props.style
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
});
|
|
967
|
+
|
|
968
|
+
// src/Map.ts
|
|
969
|
+
import { createMap } from "@opendata-ai/openchart-vanilla";
|
|
970
|
+
import {
|
|
971
|
+
defineComponent as defineComponent6,
|
|
972
|
+
h as h6,
|
|
973
|
+
inject as inject6,
|
|
974
|
+
onMounted as onMounted8,
|
|
975
|
+
onUnmounted as onUnmounted9,
|
|
976
|
+
ref as ref11,
|
|
977
|
+
watch as watch9
|
|
978
|
+
} from "vue";
|
|
979
|
+
var GeoMap = defineComponent6({
|
|
980
|
+
name: "GeoMap",
|
|
981
|
+
props: {
|
|
982
|
+
spec: {
|
|
983
|
+
type: Object,
|
|
984
|
+
required: true
|
|
985
|
+
},
|
|
986
|
+
theme: {
|
|
987
|
+
type: Object,
|
|
988
|
+
default: void 0
|
|
989
|
+
},
|
|
990
|
+
darkMode: {
|
|
991
|
+
type: String,
|
|
992
|
+
default: void 0
|
|
993
|
+
},
|
|
994
|
+
class: {
|
|
995
|
+
type: String,
|
|
996
|
+
default: void 0
|
|
997
|
+
},
|
|
998
|
+
style: {
|
|
999
|
+
type: [String, Object],
|
|
1000
|
+
default: void 0
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
1003
|
+
emits: {
|
|
1004
|
+
"mark-click": (_event) => true,
|
|
1005
|
+
"mark-hover": (_event) => true
|
|
1006
|
+
},
|
|
1007
|
+
setup(props, { emit, expose }) {
|
|
1008
|
+
const containerRef = ref11(null);
|
|
1009
|
+
let instance = null;
|
|
1010
|
+
let prevSpec = "";
|
|
1011
|
+
const contextTheme = inject6(VizThemeKey, void 0);
|
|
1012
|
+
const contextDarkMode = inject6(VizDarkModeKey, void 0);
|
|
1013
|
+
function resolveTheme() {
|
|
1014
|
+
return props.theme ?? contextTheme?.value;
|
|
1015
|
+
}
|
|
1016
|
+
function resolveDarkMode() {
|
|
1017
|
+
return props.darkMode ?? contextDarkMode?.value;
|
|
1018
|
+
}
|
|
1019
|
+
function mountMap() {
|
|
1020
|
+
const container = containerRef.value;
|
|
1021
|
+
if (!container) return;
|
|
1022
|
+
const options = {
|
|
1023
|
+
theme: resolveTheme(),
|
|
1024
|
+
darkMode: resolveDarkMode(),
|
|
1025
|
+
onMarkClick: (feature) => emit("mark-click", feature),
|
|
1026
|
+
onMarkHover: (feature) => emit("mark-hover", feature),
|
|
1027
|
+
responsive: true
|
|
1028
|
+
};
|
|
1029
|
+
instance = createMap(container, props.spec, options);
|
|
1030
|
+
prevSpec = JSON.stringify(props.spec);
|
|
1031
|
+
}
|
|
1032
|
+
function destroyMap() {
|
|
1033
|
+
instance?.destroy();
|
|
1034
|
+
instance = null;
|
|
1035
|
+
prevSpec = "";
|
|
1036
|
+
}
|
|
1037
|
+
expose({
|
|
1038
|
+
get instance() {
|
|
1039
|
+
return instance;
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
onMounted8(() => {
|
|
1043
|
+
mountMap();
|
|
1044
|
+
});
|
|
1045
|
+
onUnmounted9(() => {
|
|
1046
|
+
destroyMap();
|
|
1047
|
+
});
|
|
1048
|
+
watch9(
|
|
1049
|
+
() => JSON.stringify(props.spec),
|
|
1050
|
+
(newVal) => {
|
|
1051
|
+
if (!instance) return;
|
|
1052
|
+
if (newVal !== prevSpec) {
|
|
1053
|
+
prevSpec = newVal;
|
|
1054
|
+
instance.update(props.spec);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
);
|
|
1058
|
+
watch9(
|
|
1059
|
+
[
|
|
1060
|
+
() => props.theme,
|
|
1061
|
+
() => props.darkMode,
|
|
1062
|
+
() => contextTheme?.value,
|
|
1063
|
+
() => contextDarkMode?.value
|
|
1064
|
+
],
|
|
1065
|
+
() => {
|
|
1066
|
+
if (!containerRef.value) return;
|
|
1067
|
+
destroyMap();
|
|
1068
|
+
mountMap();
|
|
1069
|
+
}
|
|
1070
|
+
);
|
|
1071
|
+
const rootClass = () => {
|
|
1072
|
+
const base = "oc-map-root";
|
|
1073
|
+
return props.class ? `${base} ${props.class}` : base;
|
|
1074
|
+
};
|
|
1075
|
+
return () => h6("div", {
|
|
817
1076
|
ref: containerRef,
|
|
818
1077
|
class: rootClass(),
|
|
819
1078
|
style: props.style
|
|
@@ -826,15 +1085,15 @@ import {
|
|
|
826
1085
|
createSankey
|
|
827
1086
|
} from "@opendata-ai/openchart-vanilla";
|
|
828
1087
|
import {
|
|
829
|
-
defineComponent as
|
|
830
|
-
h as
|
|
831
|
-
inject as
|
|
832
|
-
onMounted as
|
|
833
|
-
onUnmounted as
|
|
834
|
-
ref as
|
|
835
|
-
watch as
|
|
1088
|
+
defineComponent as defineComponent7,
|
|
1089
|
+
h as h7,
|
|
1090
|
+
inject as inject7,
|
|
1091
|
+
onMounted as onMounted9,
|
|
1092
|
+
onUnmounted as onUnmounted10,
|
|
1093
|
+
ref as ref12,
|
|
1094
|
+
watch as watch10
|
|
836
1095
|
} from "vue";
|
|
837
|
-
var Sankey =
|
|
1096
|
+
var Sankey = defineComponent7({
|
|
838
1097
|
name: "Sankey",
|
|
839
1098
|
props: {
|
|
840
1099
|
spec: {
|
|
@@ -865,11 +1124,11 @@ var Sankey = defineComponent5({
|
|
|
865
1124
|
"link-hover": (_link) => true
|
|
866
1125
|
},
|
|
867
1126
|
setup(props, { emit, expose }) {
|
|
868
|
-
const containerRef =
|
|
1127
|
+
const containerRef = ref12(null);
|
|
869
1128
|
let instance = null;
|
|
870
1129
|
let prevSpec = "";
|
|
871
|
-
const contextTheme =
|
|
872
|
-
const contextDarkMode =
|
|
1130
|
+
const contextTheme = inject7(VizThemeKey, void 0);
|
|
1131
|
+
const contextDarkMode = inject7(VizDarkModeKey, void 0);
|
|
873
1132
|
function resolveTheme() {
|
|
874
1133
|
return props.theme ?? contextTheme?.value;
|
|
875
1134
|
}
|
|
@@ -901,13 +1160,13 @@ var Sankey = defineComponent5({
|
|
|
901
1160
|
return instance;
|
|
902
1161
|
}
|
|
903
1162
|
});
|
|
904
|
-
|
|
1163
|
+
onMounted9(() => {
|
|
905
1164
|
mountSankey();
|
|
906
1165
|
});
|
|
907
|
-
|
|
1166
|
+
onUnmounted10(() => {
|
|
908
1167
|
destroySankey();
|
|
909
1168
|
});
|
|
910
|
-
|
|
1169
|
+
watch10(
|
|
911
1170
|
() => JSON.stringify(props.spec),
|
|
912
1171
|
(newVal) => {
|
|
913
1172
|
if (!instance) return;
|
|
@@ -917,7 +1176,7 @@ var Sankey = defineComponent5({
|
|
|
917
1176
|
}
|
|
918
1177
|
}
|
|
919
1178
|
);
|
|
920
|
-
|
|
1179
|
+
watch10(
|
|
921
1180
|
[
|
|
922
1181
|
() => props.theme,
|
|
923
1182
|
() => props.darkMode,
|
|
@@ -934,7 +1193,7 @@ var Sankey = defineComponent5({
|
|
|
934
1193
|
const base = "oc-sankey-root";
|
|
935
1194
|
return props.class ? `${base} ${props.class}` : base;
|
|
936
1195
|
};
|
|
937
|
-
return () =>
|
|
1196
|
+
return () => h7("div", {
|
|
938
1197
|
ref: containerRef,
|
|
939
1198
|
class: rootClass(),
|
|
940
1199
|
style: props.style
|
|
@@ -943,8 +1202,8 @@ var Sankey = defineComponent5({
|
|
|
943
1202
|
});
|
|
944
1203
|
|
|
945
1204
|
// src/ThemeProvider.ts
|
|
946
|
-
import { computed as computed2, defineComponent as
|
|
947
|
-
var VizThemeProvider =
|
|
1205
|
+
import { computed as computed2, defineComponent as defineComponent8, provide } from "vue";
|
|
1206
|
+
var VizThemeProvider = defineComponent8({
|
|
948
1207
|
name: "VizThemeProvider",
|
|
949
1208
|
props: {
|
|
950
1209
|
theme: {
|
|
@@ -970,15 +1229,15 @@ import {
|
|
|
970
1229
|
createTileMap
|
|
971
1230
|
} from "@opendata-ai/openchart-vanilla";
|
|
972
1231
|
import {
|
|
973
|
-
defineComponent as
|
|
974
|
-
h as
|
|
975
|
-
inject as
|
|
976
|
-
onMounted as
|
|
977
|
-
onUnmounted as
|
|
978
|
-
ref as
|
|
979
|
-
watch as
|
|
1232
|
+
defineComponent as defineComponent9,
|
|
1233
|
+
h as h8,
|
|
1234
|
+
inject as inject8,
|
|
1235
|
+
onMounted as onMounted10,
|
|
1236
|
+
onUnmounted as onUnmounted11,
|
|
1237
|
+
ref as ref13,
|
|
1238
|
+
watch as watch11
|
|
980
1239
|
} from "vue";
|
|
981
|
-
var TileMap =
|
|
1240
|
+
var TileMap = defineComponent9({
|
|
982
1241
|
name: "TileMap",
|
|
983
1242
|
props: {
|
|
984
1243
|
spec: {
|
|
@@ -1007,11 +1266,11 @@ var TileMap = defineComponent7({
|
|
|
1007
1266
|
"tile-hover": (_tile) => true
|
|
1008
1267
|
},
|
|
1009
1268
|
setup(props, { emit, expose }) {
|
|
1010
|
-
const containerRef =
|
|
1269
|
+
const containerRef = ref13(null);
|
|
1011
1270
|
let instance = null;
|
|
1012
1271
|
let prevSpec = "";
|
|
1013
|
-
const contextTheme =
|
|
1014
|
-
const contextDarkMode =
|
|
1272
|
+
const contextTheme = inject8(VizThemeKey, void 0);
|
|
1273
|
+
const contextDarkMode = inject8(VizDarkModeKey, void 0);
|
|
1015
1274
|
function resolveTheme() {
|
|
1016
1275
|
return props.theme ?? contextTheme?.value;
|
|
1017
1276
|
}
|
|
@@ -1041,13 +1300,13 @@ var TileMap = defineComponent7({
|
|
|
1041
1300
|
return instance;
|
|
1042
1301
|
}
|
|
1043
1302
|
});
|
|
1044
|
-
|
|
1303
|
+
onMounted10(() => {
|
|
1045
1304
|
mountTileMap();
|
|
1046
1305
|
});
|
|
1047
|
-
|
|
1306
|
+
onUnmounted11(() => {
|
|
1048
1307
|
destroyTileMap();
|
|
1049
1308
|
});
|
|
1050
|
-
|
|
1309
|
+
watch11(
|
|
1051
1310
|
() => JSON.stringify(props.spec),
|
|
1052
1311
|
(newVal) => {
|
|
1053
1312
|
if (!instance) return;
|
|
@@ -1057,7 +1316,7 @@ var TileMap = defineComponent7({
|
|
|
1057
1316
|
}
|
|
1058
1317
|
}
|
|
1059
1318
|
);
|
|
1060
|
-
|
|
1319
|
+
watch11(
|
|
1061
1320
|
[
|
|
1062
1321
|
() => props.theme,
|
|
1063
1322
|
() => props.darkMode,
|
|
@@ -1074,7 +1333,7 @@ var TileMap = defineComponent7({
|
|
|
1074
1333
|
const base = "oc-tilemap-root";
|
|
1075
1334
|
return props.class ? `${base} ${props.class}` : base;
|
|
1076
1335
|
};
|
|
1077
|
-
return () =>
|
|
1336
|
+
return () => h8("div", {
|
|
1078
1337
|
ref: containerRef,
|
|
1079
1338
|
class: rootClass(),
|
|
1080
1339
|
style: props.style
|
|
@@ -1086,12 +1345,13 @@ var TileMap = defineComponent7({
|
|
|
1086
1345
|
import {
|
|
1087
1346
|
isBarListSpec,
|
|
1088
1347
|
isGraphSpec,
|
|
1348
|
+
isMapSpec,
|
|
1089
1349
|
isSankeySpec,
|
|
1090
1350
|
isTableSpec,
|
|
1091
1351
|
isTileMapSpec
|
|
1092
1352
|
} from "@opendata-ai/openchart-core";
|
|
1093
|
-
import { defineComponent as
|
|
1094
|
-
var Visualization =
|
|
1353
|
+
import { defineComponent as defineComponent10, h as h9 } from "vue";
|
|
1354
|
+
var Visualization = defineComponent10({
|
|
1095
1355
|
name: "Visualization",
|
|
1096
1356
|
props: {
|
|
1097
1357
|
spec: {
|
|
@@ -1120,28 +1380,33 @@ var Visualization = defineComponent8({
|
|
|
1120
1380
|
const { spec, theme, darkMode, class: className, style } = props;
|
|
1121
1381
|
const sharedProps = { theme, darkMode, class: className, style };
|
|
1122
1382
|
if (isTableSpec(spec)) {
|
|
1123
|
-
return
|
|
1383
|
+
return h9(DataTable, { ...sharedProps, spec });
|
|
1124
1384
|
}
|
|
1125
1385
|
if (isGraphSpec(spec)) {
|
|
1126
|
-
return
|
|
1386
|
+
return h9(Graph, { ...sharedProps, spec });
|
|
1127
1387
|
}
|
|
1128
1388
|
if (isSankeySpec(spec)) {
|
|
1129
|
-
return
|
|
1389
|
+
return h9(Sankey, { ...sharedProps, spec });
|
|
1130
1390
|
}
|
|
1131
1391
|
if (isTileMapSpec(spec)) {
|
|
1132
|
-
return
|
|
1392
|
+
return h9(TileMap, { ...sharedProps, spec });
|
|
1133
1393
|
}
|
|
1134
1394
|
if (isBarListSpec(spec)) {
|
|
1135
|
-
return
|
|
1395
|
+
return h9(BarList, { ...sharedProps, spec });
|
|
1396
|
+
}
|
|
1397
|
+
if (isMapSpec(spec)) {
|
|
1398
|
+
return h9(GeoMap, { ...sharedProps, spec });
|
|
1136
1399
|
}
|
|
1137
|
-
return
|
|
1400
|
+
return h9(Chart, { ...sharedProps, spec });
|
|
1138
1401
|
};
|
|
1139
1402
|
}
|
|
1140
1403
|
});
|
|
1141
1404
|
export {
|
|
1142
1405
|
BarList,
|
|
1143
1406
|
Chart,
|
|
1407
|
+
ChartStory,
|
|
1144
1408
|
DataTable,
|
|
1409
|
+
GeoMap,
|
|
1145
1410
|
Graph,
|
|
1146
1411
|
Sankey,
|
|
1147
1412
|
TileMap,
|
|
@@ -1154,6 +1419,7 @@ export {
|
|
|
1154
1419
|
compileBarList,
|
|
1155
1420
|
compileChart,
|
|
1156
1421
|
compileGraph,
|
|
1422
|
+
compileMap,
|
|
1157
1423
|
compileSankey,
|
|
1158
1424
|
compileTable,
|
|
1159
1425
|
exportCSV,
|