@opendata-ai/openchart-vue 6.27.0 → 6.28.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 +73 -4
- package/dist/index.js +238 -109
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +4 -4
- package/src/BarList.ts +155 -0
- package/src/Visualization.ts +11 -1
- package/src/index.ts +4 -1
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { exportCSV, exportJPG, exportPNG, exportSVG } from "@opendata-ai/opencha
|
|
|
4
4
|
import {
|
|
5
5
|
clearRenderers,
|
|
6
6
|
compile,
|
|
7
|
+
compileBarList,
|
|
7
8
|
compileChart,
|
|
8
9
|
compileGraph,
|
|
9
10
|
compileSankey,
|
|
@@ -14,11 +15,12 @@ import {
|
|
|
14
15
|
validateSpec
|
|
15
16
|
} from "@opendata-ai/openchart-engine";
|
|
16
17
|
|
|
17
|
-
// src/
|
|
18
|
-
import {
|
|
18
|
+
// src/BarList.ts
|
|
19
|
+
import {
|
|
20
|
+
createBarList
|
|
21
|
+
} from "@opendata-ai/openchart-vanilla";
|
|
19
22
|
import {
|
|
20
23
|
defineComponent,
|
|
21
|
-
getCurrentInstance,
|
|
22
24
|
h,
|
|
23
25
|
inject as inject2,
|
|
24
26
|
onMounted,
|
|
@@ -40,8 +42,124 @@ function useVizDarkMode() {
|
|
|
40
42
|
return computed(() => darkMode?.value);
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
// src/BarList.ts
|
|
46
|
+
var BarList = defineComponent({
|
|
47
|
+
name: "BarList",
|
|
48
|
+
props: {
|
|
49
|
+
spec: {
|
|
50
|
+
type: Object,
|
|
51
|
+
required: true
|
|
52
|
+
},
|
|
53
|
+
theme: {
|
|
54
|
+
type: Object,
|
|
55
|
+
default: void 0
|
|
56
|
+
},
|
|
57
|
+
darkMode: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: void 0
|
|
60
|
+
},
|
|
61
|
+
class: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: void 0
|
|
64
|
+
},
|
|
65
|
+
style: {
|
|
66
|
+
type: [String, Object],
|
|
67
|
+
default: void 0
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
emits: {
|
|
71
|
+
"row-click": (_row) => true,
|
|
72
|
+
"row-hover": (_row) => true
|
|
73
|
+
},
|
|
74
|
+
setup(props, { emit, expose }) {
|
|
75
|
+
const containerRef = ref(null);
|
|
76
|
+
let instance = null;
|
|
77
|
+
let prevSpec = "";
|
|
78
|
+
const contextTheme = inject2(VizThemeKey, void 0);
|
|
79
|
+
const contextDarkMode = inject2(VizDarkModeKey, void 0);
|
|
80
|
+
function resolveTheme() {
|
|
81
|
+
return props.theme ?? contextTheme?.value;
|
|
82
|
+
}
|
|
83
|
+
function resolveDarkMode() {
|
|
84
|
+
return props.darkMode ?? contextDarkMode?.value;
|
|
85
|
+
}
|
|
86
|
+
function mountBarList() {
|
|
87
|
+
const container = containerRef.value;
|
|
88
|
+
if (!container) return;
|
|
89
|
+
const options = {
|
|
90
|
+
theme: resolveTheme(),
|
|
91
|
+
darkMode: resolveDarkMode(),
|
|
92
|
+
onRowClick: (row) => emit("row-click", row),
|
|
93
|
+
onRowHover: (row) => emit("row-hover", row),
|
|
94
|
+
responsive: true
|
|
95
|
+
};
|
|
96
|
+
instance = createBarList(container, props.spec, options);
|
|
97
|
+
prevSpec = JSON.stringify(props.spec);
|
|
98
|
+
}
|
|
99
|
+
function destroyBarList() {
|
|
100
|
+
instance?.destroy();
|
|
101
|
+
instance = null;
|
|
102
|
+
prevSpec = "";
|
|
103
|
+
}
|
|
104
|
+
expose({
|
|
105
|
+
get instance() {
|
|
106
|
+
return instance;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
onMounted(() => {
|
|
110
|
+
mountBarList();
|
|
111
|
+
});
|
|
112
|
+
onUnmounted(() => {
|
|
113
|
+
destroyBarList();
|
|
114
|
+
});
|
|
115
|
+
watch(
|
|
116
|
+
() => JSON.stringify(props.spec),
|
|
117
|
+
(newVal) => {
|
|
118
|
+
if (!instance) return;
|
|
119
|
+
if (newVal !== prevSpec) {
|
|
120
|
+
prevSpec = newVal;
|
|
121
|
+
instance.update(props.spec);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
watch(
|
|
126
|
+
[
|
|
127
|
+
() => props.theme,
|
|
128
|
+
() => props.darkMode,
|
|
129
|
+
() => contextTheme?.value,
|
|
130
|
+
() => contextDarkMode?.value
|
|
131
|
+
],
|
|
132
|
+
() => {
|
|
133
|
+
if (!containerRef.value) return;
|
|
134
|
+
destroyBarList();
|
|
135
|
+
mountBarList();
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
const rootClass = () => {
|
|
139
|
+
const base = "oc-barlist-root";
|
|
140
|
+
return props.class ? `${base} ${props.class}` : base;
|
|
141
|
+
};
|
|
142
|
+
return () => h("div", {
|
|
143
|
+
ref: containerRef,
|
|
144
|
+
class: rootClass(),
|
|
145
|
+
style: props.style
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
43
150
|
// src/Chart.ts
|
|
44
|
-
|
|
151
|
+
import { createChart } from "@opendata-ai/openchart-vanilla";
|
|
152
|
+
import {
|
|
153
|
+
defineComponent as defineComponent2,
|
|
154
|
+
getCurrentInstance,
|
|
155
|
+
h as h2,
|
|
156
|
+
inject as inject3,
|
|
157
|
+
onMounted as onMounted2,
|
|
158
|
+
onUnmounted as onUnmounted2,
|
|
159
|
+
ref as ref2,
|
|
160
|
+
watch as watch2
|
|
161
|
+
} from "vue";
|
|
162
|
+
var Chart = defineComponent2({
|
|
45
163
|
name: "Chart",
|
|
46
164
|
props: {
|
|
47
165
|
spec: {
|
|
@@ -83,11 +201,11 @@ var Chart = defineComponent({
|
|
|
83
201
|
"data-point-click": (_data) => true
|
|
84
202
|
},
|
|
85
203
|
setup(props, { emit, expose }) {
|
|
86
|
-
const containerRef =
|
|
204
|
+
const containerRef = ref2(null);
|
|
87
205
|
let instance = null;
|
|
88
206
|
let prevSpec = "";
|
|
89
|
-
const contextTheme =
|
|
90
|
-
const contextDarkMode =
|
|
207
|
+
const contextTheme = inject3(VizThemeKey, void 0);
|
|
208
|
+
const contextDarkMode = inject3(VizDarkModeKey, void 0);
|
|
91
209
|
const vm = getCurrentInstance();
|
|
92
210
|
const vnodeProps = vm?.vnode.props ?? {};
|
|
93
211
|
const hasAnnotationEditListener = "onAnnotation-edit" in vnodeProps || "onAnnotationEdit" in vnodeProps;
|
|
@@ -149,13 +267,13 @@ var Chart = defineComponent({
|
|
|
149
267
|
return instance;
|
|
150
268
|
}
|
|
151
269
|
});
|
|
152
|
-
|
|
270
|
+
onMounted2(() => {
|
|
153
271
|
mountChart();
|
|
154
272
|
});
|
|
155
|
-
|
|
273
|
+
onUnmounted2(() => {
|
|
156
274
|
destroyChart();
|
|
157
275
|
});
|
|
158
|
-
|
|
276
|
+
watch2(
|
|
159
277
|
() => JSON.stringify(props.spec),
|
|
160
278
|
(newVal) => {
|
|
161
279
|
if (!instance) return;
|
|
@@ -165,7 +283,7 @@ var Chart = defineComponent({
|
|
|
165
283
|
}
|
|
166
284
|
}
|
|
167
285
|
);
|
|
168
|
-
|
|
286
|
+
watch2(
|
|
169
287
|
() => props.selectedElement,
|
|
170
288
|
(newVal) => {
|
|
171
289
|
if (!instance) return;
|
|
@@ -176,7 +294,7 @@ var Chart = defineComponent({
|
|
|
176
294
|
}
|
|
177
295
|
}
|
|
178
296
|
);
|
|
179
|
-
|
|
297
|
+
watch2(
|
|
180
298
|
[
|
|
181
299
|
() => props.theme,
|
|
182
300
|
() => props.darkMode,
|
|
@@ -193,7 +311,7 @@ var Chart = defineComponent({
|
|
|
193
311
|
const base = "oc-chart-root";
|
|
194
312
|
return props.class ? `${base} ${props.class}` : base;
|
|
195
313
|
};
|
|
196
|
-
return () =>
|
|
314
|
+
return () => h2("div", {
|
|
197
315
|
ref: containerRef,
|
|
198
316
|
class: rootClass(),
|
|
199
317
|
style: props.style
|
|
@@ -203,9 +321,9 @@ var Chart = defineComponent({
|
|
|
203
321
|
|
|
204
322
|
// src/composables/useChart.ts
|
|
205
323
|
import { createChart as createChart2 } from "@opendata-ai/openchart-vanilla";
|
|
206
|
-
import { onMounted as
|
|
324
|
+
import { onMounted as onMounted3, onUnmounted as onUnmounted3, ref as ref3, shallowRef, watch as watch3 } from "vue";
|
|
207
325
|
function useChart(spec, options) {
|
|
208
|
-
const containerRef =
|
|
326
|
+
const containerRef = ref3(null);
|
|
209
327
|
const chart = shallowRef(null);
|
|
210
328
|
const layout = shallowRef(null);
|
|
211
329
|
function mount() {
|
|
@@ -226,13 +344,13 @@ function useChart(spec, options) {
|
|
|
226
344
|
chart.value = null;
|
|
227
345
|
layout.value = null;
|
|
228
346
|
}
|
|
229
|
-
|
|
347
|
+
onMounted3(() => {
|
|
230
348
|
mount();
|
|
231
349
|
});
|
|
232
|
-
|
|
350
|
+
onUnmounted3(() => {
|
|
233
351
|
destroy();
|
|
234
352
|
});
|
|
235
|
-
|
|
353
|
+
watch3(spec, (newSpec) => {
|
|
236
354
|
const instance = chart.value;
|
|
237
355
|
if (!instance) return;
|
|
238
356
|
instance.update(newSpec);
|
|
@@ -246,9 +364,9 @@ function useChart(spec, options) {
|
|
|
246
364
|
}
|
|
247
365
|
|
|
248
366
|
// src/composables/useDarkMode.ts
|
|
249
|
-
import { onUnmounted as
|
|
367
|
+
import { onUnmounted as onUnmounted4, ref as ref4, watch as watch4 } from "vue";
|
|
250
368
|
function useDarkMode(mode) {
|
|
251
|
-
const isDark =
|
|
369
|
+
const isDark = ref4(resolveInitial(mode.value));
|
|
252
370
|
let cleanup = null;
|
|
253
371
|
function setup(currentMode) {
|
|
254
372
|
cleanup?.();
|
|
@@ -270,10 +388,10 @@ function useDarkMode(mode) {
|
|
|
270
388
|
cleanup = () => mq.removeEventListener("change", handler);
|
|
271
389
|
}
|
|
272
390
|
setup(mode.value);
|
|
273
|
-
|
|
391
|
+
watch4(mode, (newMode) => {
|
|
274
392
|
setup(newMode);
|
|
275
393
|
});
|
|
276
|
-
|
|
394
|
+
onUnmounted4(() => {
|
|
277
395
|
cleanup?.();
|
|
278
396
|
cleanup = null;
|
|
279
397
|
});
|
|
@@ -289,9 +407,9 @@ function resolveInitial(mode) {
|
|
|
289
407
|
}
|
|
290
408
|
|
|
291
409
|
// src/composables/useGraph.ts
|
|
292
|
-
import { ref as
|
|
410
|
+
import { ref as ref5 } from "vue";
|
|
293
411
|
function useGraph() {
|
|
294
|
-
const graphRef =
|
|
412
|
+
const graphRef = ref5(null);
|
|
295
413
|
function search(query) {
|
|
296
414
|
graphRef.value?.search(query);
|
|
297
415
|
}
|
|
@@ -325,11 +443,11 @@ function useGraph() {
|
|
|
325
443
|
import {
|
|
326
444
|
createTable
|
|
327
445
|
} from "@opendata-ai/openchart-vanilla";
|
|
328
|
-
import { onMounted as
|
|
446
|
+
import { onMounted as onMounted4, onUnmounted as onUnmounted5, ref as ref6, shallowRef as shallowRef2, watch as watch5 } from "vue";
|
|
329
447
|
function useTable(spec, options) {
|
|
330
|
-
const containerRef =
|
|
448
|
+
const containerRef = ref6(null);
|
|
331
449
|
const table = shallowRef2(null);
|
|
332
|
-
const state =
|
|
450
|
+
const state = ref6({
|
|
333
451
|
sort: null,
|
|
334
452
|
search: "",
|
|
335
453
|
page: 0
|
|
@@ -354,13 +472,13 @@ function useTable(spec, options) {
|
|
|
354
472
|
table.value?.destroy();
|
|
355
473
|
table.value = null;
|
|
356
474
|
}
|
|
357
|
-
|
|
475
|
+
onMounted4(() => {
|
|
358
476
|
mount();
|
|
359
477
|
});
|
|
360
|
-
|
|
478
|
+
onUnmounted5(() => {
|
|
361
479
|
destroy();
|
|
362
480
|
});
|
|
363
|
-
|
|
481
|
+
watch5(spec, (newSpec) => {
|
|
364
482
|
const instance = table.value;
|
|
365
483
|
if (!instance) return;
|
|
366
484
|
instance.update(newSpec);
|
|
@@ -374,11 +492,11 @@ function useTable(spec, options) {
|
|
|
374
492
|
}
|
|
375
493
|
|
|
376
494
|
// src/composables/useTableState.ts
|
|
377
|
-
import { ref as
|
|
495
|
+
import { ref as ref7 } from "vue";
|
|
378
496
|
function useTableState(initialState) {
|
|
379
|
-
const sort =
|
|
380
|
-
const search =
|
|
381
|
-
const page =
|
|
497
|
+
const sort = ref7(initialState?.sort ?? null);
|
|
498
|
+
const search = ref7(initialState?.search ?? "");
|
|
499
|
+
const page = ref7(initialState?.page ?? 0);
|
|
382
500
|
function setSort(newSort) {
|
|
383
501
|
sort.value = newSort;
|
|
384
502
|
}
|
|
@@ -409,15 +527,15 @@ import {
|
|
|
409
527
|
createTable as createTable2
|
|
410
528
|
} from "@opendata-ai/openchart-vanilla";
|
|
411
529
|
import {
|
|
412
|
-
defineComponent as
|
|
413
|
-
h as
|
|
414
|
-
inject as
|
|
415
|
-
onMounted as
|
|
416
|
-
onUnmounted as
|
|
417
|
-
ref as
|
|
418
|
-
watch as
|
|
530
|
+
defineComponent as defineComponent3,
|
|
531
|
+
h as h3,
|
|
532
|
+
inject as inject4,
|
|
533
|
+
onMounted as onMounted5,
|
|
534
|
+
onUnmounted as onUnmounted6,
|
|
535
|
+
ref as ref8,
|
|
536
|
+
watch as watch6
|
|
419
537
|
} from "vue";
|
|
420
|
-
var DataTable =
|
|
538
|
+
var DataTable = defineComponent3({
|
|
421
539
|
name: "DataTable",
|
|
422
540
|
props: {
|
|
423
541
|
spec: {
|
|
@@ -460,10 +578,10 @@ var DataTable = defineComponent2({
|
|
|
460
578
|
"update:page": (_page) => true
|
|
461
579
|
},
|
|
462
580
|
setup(props, { emit }) {
|
|
463
|
-
const containerRef =
|
|
581
|
+
const containerRef = ref8(null);
|
|
464
582
|
let instance = null;
|
|
465
|
-
const contextTheme =
|
|
466
|
-
const contextDarkMode =
|
|
583
|
+
const contextTheme = inject4(VizThemeKey, void 0);
|
|
584
|
+
const contextDarkMode = inject4(VizDarkModeKey, void 0);
|
|
467
585
|
function resolveTheme() {
|
|
468
586
|
return props.theme ?? contextTheme?.value;
|
|
469
587
|
}
|
|
@@ -503,13 +621,13 @@ var DataTable = defineComponent2({
|
|
|
503
621
|
instance = null;
|
|
504
622
|
prevSpec = "";
|
|
505
623
|
}
|
|
506
|
-
|
|
624
|
+
onMounted5(() => {
|
|
507
625
|
mountTable();
|
|
508
626
|
});
|
|
509
|
-
|
|
627
|
+
onUnmounted6(() => {
|
|
510
628
|
destroyTable();
|
|
511
629
|
});
|
|
512
|
-
|
|
630
|
+
watch6(
|
|
513
631
|
() => JSON.stringify(props.spec),
|
|
514
632
|
(newVal) => {
|
|
515
633
|
if (!instance) return;
|
|
@@ -519,7 +637,7 @@ var DataTable = defineComponent2({
|
|
|
519
637
|
}
|
|
520
638
|
}
|
|
521
639
|
);
|
|
522
|
-
|
|
640
|
+
watch6(
|
|
523
641
|
[
|
|
524
642
|
() => props.theme,
|
|
525
643
|
() => props.darkMode,
|
|
@@ -532,7 +650,7 @@ var DataTable = defineComponent2({
|
|
|
532
650
|
mountTable();
|
|
533
651
|
}
|
|
534
652
|
);
|
|
535
|
-
|
|
653
|
+
watch6([() => props.sort, () => props.search, () => props.page], () => {
|
|
536
654
|
if (!instance || !isControlled()) return;
|
|
537
655
|
instance.setState({
|
|
538
656
|
sort: props.sort ?? null,
|
|
@@ -544,7 +662,7 @@ var DataTable = defineComponent2({
|
|
|
544
662
|
const base = "oc-table-root";
|
|
545
663
|
return props.class ? `${base} ${props.class}` : base;
|
|
546
664
|
};
|
|
547
|
-
return () =>
|
|
665
|
+
return () => h3("div", {
|
|
548
666
|
ref: containerRef,
|
|
549
667
|
class: rootClass(),
|
|
550
668
|
style: props.style
|
|
@@ -557,15 +675,15 @@ import {
|
|
|
557
675
|
createGraph
|
|
558
676
|
} from "@opendata-ai/openchart-vanilla";
|
|
559
677
|
import {
|
|
560
|
-
defineComponent as
|
|
561
|
-
h as
|
|
562
|
-
inject as
|
|
563
|
-
onMounted as
|
|
564
|
-
onUnmounted as
|
|
565
|
-
ref as
|
|
566
|
-
watch as
|
|
678
|
+
defineComponent as defineComponent4,
|
|
679
|
+
h as h4,
|
|
680
|
+
inject as inject5,
|
|
681
|
+
onMounted as onMounted6,
|
|
682
|
+
onUnmounted as onUnmounted7,
|
|
683
|
+
ref as ref9,
|
|
684
|
+
watch as watch7
|
|
567
685
|
} from "vue";
|
|
568
|
-
var Graph =
|
|
686
|
+
var Graph = defineComponent4({
|
|
569
687
|
name: "Graph",
|
|
570
688
|
props: {
|
|
571
689
|
spec: {
|
|
@@ -595,11 +713,11 @@ var Graph = defineComponent3({
|
|
|
595
713
|
"selection-change": (_nodeIds) => true
|
|
596
714
|
},
|
|
597
715
|
setup(props, { emit, expose }) {
|
|
598
|
-
const containerRef =
|
|
716
|
+
const containerRef = ref9(null);
|
|
599
717
|
let instance = null;
|
|
600
718
|
let prevSpec = "";
|
|
601
|
-
const contextTheme =
|
|
602
|
-
const contextDarkMode =
|
|
719
|
+
const contextTheme = inject5(VizThemeKey, void 0);
|
|
720
|
+
const contextDarkMode = inject5(VizDarkModeKey, void 0);
|
|
603
721
|
function resolveTheme() {
|
|
604
722
|
return props.theme ?? contextTheme?.value;
|
|
605
723
|
}
|
|
@@ -648,13 +766,13 @@ var Graph = defineComponent3({
|
|
|
648
766
|
return instance;
|
|
649
767
|
}
|
|
650
768
|
});
|
|
651
|
-
|
|
769
|
+
onMounted6(() => {
|
|
652
770
|
mountGraph();
|
|
653
771
|
});
|
|
654
|
-
|
|
772
|
+
onUnmounted7(() => {
|
|
655
773
|
destroyGraph();
|
|
656
774
|
});
|
|
657
|
-
|
|
775
|
+
watch7(
|
|
658
776
|
() => JSON.stringify(props.spec),
|
|
659
777
|
(newVal) => {
|
|
660
778
|
if (!instance) return;
|
|
@@ -664,7 +782,7 @@ var Graph = defineComponent3({
|
|
|
664
782
|
}
|
|
665
783
|
}
|
|
666
784
|
);
|
|
667
|
-
|
|
785
|
+
watch7(
|
|
668
786
|
[
|
|
669
787
|
() => props.theme,
|
|
670
788
|
() => props.darkMode,
|
|
@@ -681,7 +799,7 @@ var Graph = defineComponent3({
|
|
|
681
799
|
const base = "oc-graph-root";
|
|
682
800
|
return props.class ? `${base} ${props.class}` : base;
|
|
683
801
|
};
|
|
684
|
-
return () =>
|
|
802
|
+
return () => h4("div", {
|
|
685
803
|
ref: containerRef,
|
|
686
804
|
class: rootClass(),
|
|
687
805
|
style: props.style
|
|
@@ -694,15 +812,15 @@ import {
|
|
|
694
812
|
createSankey
|
|
695
813
|
} from "@opendata-ai/openchart-vanilla";
|
|
696
814
|
import {
|
|
697
|
-
defineComponent as
|
|
698
|
-
h as
|
|
699
|
-
inject as
|
|
700
|
-
onMounted as
|
|
701
|
-
onUnmounted as
|
|
702
|
-
ref as
|
|
703
|
-
watch as
|
|
815
|
+
defineComponent as defineComponent5,
|
|
816
|
+
h as h5,
|
|
817
|
+
inject as inject6,
|
|
818
|
+
onMounted as onMounted7,
|
|
819
|
+
onUnmounted as onUnmounted8,
|
|
820
|
+
ref as ref10,
|
|
821
|
+
watch as watch8
|
|
704
822
|
} from "vue";
|
|
705
|
-
var Sankey =
|
|
823
|
+
var Sankey = defineComponent5({
|
|
706
824
|
name: "Sankey",
|
|
707
825
|
props: {
|
|
708
826
|
spec: {
|
|
@@ -733,11 +851,11 @@ var Sankey = defineComponent4({
|
|
|
733
851
|
"link-hover": (_link) => true
|
|
734
852
|
},
|
|
735
853
|
setup(props, { emit, expose }) {
|
|
736
|
-
const containerRef =
|
|
854
|
+
const containerRef = ref10(null);
|
|
737
855
|
let instance = null;
|
|
738
856
|
let prevSpec = "";
|
|
739
|
-
const contextTheme =
|
|
740
|
-
const contextDarkMode =
|
|
857
|
+
const contextTheme = inject6(VizThemeKey, void 0);
|
|
858
|
+
const contextDarkMode = inject6(VizDarkModeKey, void 0);
|
|
741
859
|
function resolveTheme() {
|
|
742
860
|
return props.theme ?? contextTheme?.value;
|
|
743
861
|
}
|
|
@@ -769,13 +887,13 @@ var Sankey = defineComponent4({
|
|
|
769
887
|
return instance;
|
|
770
888
|
}
|
|
771
889
|
});
|
|
772
|
-
|
|
890
|
+
onMounted7(() => {
|
|
773
891
|
mountSankey();
|
|
774
892
|
});
|
|
775
|
-
|
|
893
|
+
onUnmounted8(() => {
|
|
776
894
|
destroySankey();
|
|
777
895
|
});
|
|
778
|
-
|
|
896
|
+
watch8(
|
|
779
897
|
() => JSON.stringify(props.spec),
|
|
780
898
|
(newVal) => {
|
|
781
899
|
if (!instance) return;
|
|
@@ -785,7 +903,7 @@ var Sankey = defineComponent4({
|
|
|
785
903
|
}
|
|
786
904
|
}
|
|
787
905
|
);
|
|
788
|
-
|
|
906
|
+
watch8(
|
|
789
907
|
[
|
|
790
908
|
() => props.theme,
|
|
791
909
|
() => props.darkMode,
|
|
@@ -802,7 +920,7 @@ var Sankey = defineComponent4({
|
|
|
802
920
|
const base = "oc-sankey-root";
|
|
803
921
|
return props.class ? `${base} ${props.class}` : base;
|
|
804
922
|
};
|
|
805
|
-
return () =>
|
|
923
|
+
return () => h5("div", {
|
|
806
924
|
ref: containerRef,
|
|
807
925
|
class: rootClass(),
|
|
808
926
|
style: props.style
|
|
@@ -811,8 +929,8 @@ var Sankey = defineComponent4({
|
|
|
811
929
|
});
|
|
812
930
|
|
|
813
931
|
// src/ThemeProvider.ts
|
|
814
|
-
import { computed as computed2, defineComponent as
|
|
815
|
-
var VizThemeProvider =
|
|
932
|
+
import { computed as computed2, defineComponent as defineComponent6, provide } from "vue";
|
|
933
|
+
var VizThemeProvider = defineComponent6({
|
|
816
934
|
name: "VizThemeProvider",
|
|
817
935
|
props: {
|
|
818
936
|
theme: {
|
|
@@ -838,15 +956,15 @@ import {
|
|
|
838
956
|
createTileMap
|
|
839
957
|
} from "@opendata-ai/openchart-vanilla";
|
|
840
958
|
import {
|
|
841
|
-
defineComponent as
|
|
842
|
-
h as
|
|
843
|
-
inject as
|
|
844
|
-
onMounted as
|
|
845
|
-
onUnmounted as
|
|
846
|
-
ref as
|
|
847
|
-
watch as
|
|
959
|
+
defineComponent as defineComponent7,
|
|
960
|
+
h as h6,
|
|
961
|
+
inject as inject7,
|
|
962
|
+
onMounted as onMounted8,
|
|
963
|
+
onUnmounted as onUnmounted9,
|
|
964
|
+
ref as ref11,
|
|
965
|
+
watch as watch9
|
|
848
966
|
} from "vue";
|
|
849
|
-
var TileMap =
|
|
967
|
+
var TileMap = defineComponent7({
|
|
850
968
|
name: "TileMap",
|
|
851
969
|
props: {
|
|
852
970
|
spec: {
|
|
@@ -875,11 +993,11 @@ var TileMap = defineComponent6({
|
|
|
875
993
|
"tile-hover": (_tile) => true
|
|
876
994
|
},
|
|
877
995
|
setup(props, { emit, expose }) {
|
|
878
|
-
const containerRef =
|
|
996
|
+
const containerRef = ref11(null);
|
|
879
997
|
let instance = null;
|
|
880
998
|
let prevSpec = "";
|
|
881
|
-
const contextTheme =
|
|
882
|
-
const contextDarkMode =
|
|
999
|
+
const contextTheme = inject7(VizThemeKey, void 0);
|
|
1000
|
+
const contextDarkMode = inject7(VizDarkModeKey, void 0);
|
|
883
1001
|
function resolveTheme() {
|
|
884
1002
|
return props.theme ?? contextTheme?.value;
|
|
885
1003
|
}
|
|
@@ -909,13 +1027,13 @@ var TileMap = defineComponent6({
|
|
|
909
1027
|
return instance;
|
|
910
1028
|
}
|
|
911
1029
|
});
|
|
912
|
-
|
|
1030
|
+
onMounted8(() => {
|
|
913
1031
|
mountTileMap();
|
|
914
1032
|
});
|
|
915
|
-
|
|
1033
|
+
onUnmounted9(() => {
|
|
916
1034
|
destroyTileMap();
|
|
917
1035
|
});
|
|
918
|
-
|
|
1036
|
+
watch9(
|
|
919
1037
|
() => JSON.stringify(props.spec),
|
|
920
1038
|
(newVal) => {
|
|
921
1039
|
if (!instance) return;
|
|
@@ -925,7 +1043,7 @@ var TileMap = defineComponent6({
|
|
|
925
1043
|
}
|
|
926
1044
|
}
|
|
927
1045
|
);
|
|
928
|
-
|
|
1046
|
+
watch9(
|
|
929
1047
|
[
|
|
930
1048
|
() => props.theme,
|
|
931
1049
|
() => props.darkMode,
|
|
@@ -942,7 +1060,7 @@ var TileMap = defineComponent6({
|
|
|
942
1060
|
const base = "oc-tilemap-root";
|
|
943
1061
|
return props.class ? `${base} ${props.class}` : base;
|
|
944
1062
|
};
|
|
945
|
-
return () =>
|
|
1063
|
+
return () => h6("div", {
|
|
946
1064
|
ref: containerRef,
|
|
947
1065
|
class: rootClass(),
|
|
948
1066
|
style: props.style
|
|
@@ -951,9 +1069,15 @@ var TileMap = defineComponent6({
|
|
|
951
1069
|
});
|
|
952
1070
|
|
|
953
1071
|
// src/Visualization.ts
|
|
954
|
-
import {
|
|
955
|
-
|
|
956
|
-
|
|
1072
|
+
import {
|
|
1073
|
+
isBarListSpec,
|
|
1074
|
+
isGraphSpec,
|
|
1075
|
+
isSankeySpec,
|
|
1076
|
+
isTableSpec,
|
|
1077
|
+
isTileMapSpec
|
|
1078
|
+
} from "@opendata-ai/openchart-core";
|
|
1079
|
+
import { defineComponent as defineComponent8, h as h7 } from "vue";
|
|
1080
|
+
var Visualization = defineComponent8({
|
|
957
1081
|
name: "Visualization",
|
|
958
1082
|
props: {
|
|
959
1083
|
spec: {
|
|
@@ -982,22 +1106,26 @@ var Visualization = defineComponent7({
|
|
|
982
1106
|
const { spec, theme, darkMode, class: className, style } = props;
|
|
983
1107
|
const sharedProps = { theme, darkMode, class: className, style };
|
|
984
1108
|
if (isTableSpec(spec)) {
|
|
985
|
-
return
|
|
1109
|
+
return h7(DataTable, { ...sharedProps, spec });
|
|
986
1110
|
}
|
|
987
1111
|
if (isGraphSpec(spec)) {
|
|
988
|
-
return
|
|
1112
|
+
return h7(Graph, { ...sharedProps, spec });
|
|
989
1113
|
}
|
|
990
1114
|
if (isSankeySpec(spec)) {
|
|
991
|
-
return
|
|
1115
|
+
return h7(Sankey, { ...sharedProps, spec });
|
|
992
1116
|
}
|
|
993
1117
|
if (isTileMapSpec(spec)) {
|
|
994
|
-
return
|
|
1118
|
+
return h7(TileMap, { ...sharedProps, spec });
|
|
1119
|
+
}
|
|
1120
|
+
if (isBarListSpec(spec)) {
|
|
1121
|
+
return h7(BarList, { ...sharedProps, spec });
|
|
995
1122
|
}
|
|
996
|
-
return
|
|
1123
|
+
return h7(Chart, { ...sharedProps, spec });
|
|
997
1124
|
};
|
|
998
1125
|
}
|
|
999
1126
|
});
|
|
1000
1127
|
export {
|
|
1128
|
+
BarList,
|
|
1001
1129
|
Chart,
|
|
1002
1130
|
DataTable,
|
|
1003
1131
|
Graph,
|
|
@@ -1009,6 +1137,7 @@ export {
|
|
|
1009
1137
|
VizThemeProvider,
|
|
1010
1138
|
clearRenderers,
|
|
1011
1139
|
compile,
|
|
1140
|
+
compileBarList,
|
|
1012
1141
|
compileChart,
|
|
1013
1142
|
compileGraph,
|
|
1014
1143
|
compileSankey,
|