@opendata-ai/openchart-vue 9.3.0 → 9.5.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 +17 -2
- package/dist/index.js +33 -16
- 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,4 +1,4 @@
|
|
|
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';
|
|
1
|
+
import { BarListSpec, ThemeConfig, DarkMode, ChartSpec, LayerSpec, EditTransaction, ElementRef, ReaderChangeMeta, MarkEvent, MarkFocusEvent, Annotation, AnnotationPlacementTool, 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
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, PlaybackController, PlaybackPeriod, PlaybackState, SVGExportOptions, SpecSequenceOptions, exportCSV, exportJPG, exportPNG, exportSVG, exportSVGWithFonts, exportSpecSequence } from '@opendata-ai/openchart-vanilla';
|
|
@@ -89,8 +89,12 @@ interface ChartProps {
|
|
|
89
89
|
rowHover?: boolean;
|
|
90
90
|
autoResize?: boolean;
|
|
91
91
|
revision?: string | number;
|
|
92
|
-
/** Interaction mode; inferred from
|
|
92
|
+
/** Interaction mode; inferred from listeners when omitted. Changes switch modes in place. */
|
|
93
93
|
interaction?: InteractionMode;
|
|
94
|
+
/** Selection outline color. Changing it recreates the chart, like theme. */
|
|
95
|
+
selectionColor?: string;
|
|
96
|
+
/** Reports engine changes to the armed placement tool. */
|
|
97
|
+
onPlacementToolChange?: (tool: AnnotationPlacementTool | null) => void;
|
|
94
98
|
onEdit?: (tx: EditTransaction) => void;
|
|
95
99
|
onSelect?: (element: ElementRef) => void;
|
|
96
100
|
onDeselect?: (element: ElementRef) => void;
|
|
@@ -166,6 +170,10 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
166
170
|
type: PropType<InteractionMode>;
|
|
167
171
|
default: undefined;
|
|
168
172
|
};
|
|
173
|
+
selectionColor: {
|
|
174
|
+
type: StringConstructor;
|
|
175
|
+
default: undefined;
|
|
176
|
+
};
|
|
169
177
|
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
170
178
|
[key: string]: any;
|
|
171
179
|
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
@@ -181,6 +189,7 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
181
189
|
x: string | number;
|
|
182
190
|
y: number;
|
|
183
191
|
}>) => true;
|
|
192
|
+
'placement-tool-change': (_tool: AnnotationPlacementTool | null) => true;
|
|
184
193
|
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
185
194
|
reader: {
|
|
186
195
|
type: PropType<false | ReaderPresentationOptions>;
|
|
@@ -250,6 +259,10 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
250
259
|
type: PropType<InteractionMode>;
|
|
251
260
|
default: undefined;
|
|
252
261
|
};
|
|
262
|
+
selectionColor: {
|
|
263
|
+
type: StringConstructor;
|
|
264
|
+
default: undefined;
|
|
265
|
+
};
|
|
253
266
|
}>> & Readonly<{
|
|
254
267
|
"onReader-change"?: ((_selection: ChartReaderSelection, _meta: ReaderChangeMeta) => any) | undefined;
|
|
255
268
|
"onMark-click"?: ((_event: MarkEvent) => any) | undefined;
|
|
@@ -263,6 +276,7 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
263
276
|
x: string | number;
|
|
264
277
|
y: number;
|
|
265
278
|
}[]) => any) | undefined;
|
|
279
|
+
"onPlacement-tool-change"?: ((_tool: AnnotationPlacementTool | null) => any) | undefined;
|
|
266
280
|
}>, {
|
|
267
281
|
theme: ThemeConfig;
|
|
268
282
|
darkMode: DarkMode;
|
|
@@ -280,6 +294,7 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
280
294
|
selectedElement: ElementRef;
|
|
281
295
|
highlight: string[] | null;
|
|
282
296
|
interaction: InteractionMode;
|
|
297
|
+
selectionColor: string;
|
|
283
298
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
284
299
|
|
|
285
300
|
interface ChartStoryProps {
|
package/dist/index.js
CHANGED
|
@@ -161,7 +161,8 @@ var BarList = /* @__PURE__ */ defineComponent({
|
|
|
161
161
|
import { mergeThemeConfig as mergeThemeConfig2 } from "@opendata-ai/openchart-core";
|
|
162
162
|
import {
|
|
163
163
|
createChart,
|
|
164
|
-
createChartReaderBinding
|
|
164
|
+
createChartReaderBinding,
|
|
165
|
+
resolveInteractionMode
|
|
165
166
|
} from "@opendata-ai/openchart-vanilla";
|
|
166
167
|
import {
|
|
167
168
|
defineComponent as defineComponent2,
|
|
@@ -234,7 +235,8 @@ var Chart = /* @__PURE__ */ defineComponent2({
|
|
|
234
235
|
interaction: {
|
|
235
236
|
type: String,
|
|
236
237
|
default: void 0
|
|
237
|
-
}
|
|
238
|
+
},
|
|
239
|
+
selectionColor: { type: String, default: void 0 }
|
|
238
240
|
},
|
|
239
241
|
emits: {
|
|
240
242
|
"reader-change": (_selection, _meta) => true,
|
|
@@ -245,7 +247,8 @@ var Chart = /* @__PURE__ */ defineComponent2({
|
|
|
245
247
|
"legend-toggle": (_series, _visible) => true,
|
|
246
248
|
"annotation-click": (_annotation, _event, _element) => true,
|
|
247
249
|
"highlight-change": (_values) => true,
|
|
248
|
-
reveal: (_guess) => true
|
|
250
|
+
reveal: (_guess) => true,
|
|
251
|
+
"placement-tool-change": (_tool) => true
|
|
249
252
|
},
|
|
250
253
|
setup(props, { emit, expose }) {
|
|
251
254
|
const containerRef = ref2(null);
|
|
@@ -278,6 +281,7 @@ var Chart = /* @__PURE__ */ defineComponent2({
|
|
|
278
281
|
theme: resolveTheme(),
|
|
279
282
|
darkMode: resolveDarkMode(),
|
|
280
283
|
renderer: props.renderer,
|
|
284
|
+
selectionColor: props.selectionColor,
|
|
281
285
|
onMarkClick: (event) => emit("mark-click", event),
|
|
282
286
|
onMarkHover: (event) => emit("mark-hover", event),
|
|
283
287
|
onMarkFocus: (event) => emit("mark-focus", event),
|
|
@@ -286,16 +290,15 @@ var Chart = /* @__PURE__ */ defineComponent2({
|
|
|
286
290
|
onAnnotationClick: (annotation, event, element) => emit("annotation-click", annotation, event, element),
|
|
287
291
|
onHighlightChange: (values) => emit("highlight-change", values),
|
|
288
292
|
onReveal: (guess) => emit("reveal", guess),
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
...props.interaction != null ? { interaction: props.interaction } : {},
|
|
293
|
+
onSelect: (element) => props.onSelect?.(element),
|
|
294
|
+
onDeselect: (element) => props.onDeselect?.(element),
|
|
295
|
+
onPlacementToolChange: (tool) => emit("placement-tool-change", tool),
|
|
296
|
+
interaction: resolveInteractionMode(props),
|
|
294
297
|
...props.selectedElement ? { selectedElement: props.selectedElement } : {},
|
|
295
298
|
rowHover: props.rowHover,
|
|
296
299
|
autoResize: props.autoResize,
|
|
297
300
|
revision: props.revision,
|
|
298
|
-
|
|
301
|
+
onEdit: (tx) => props.onEdit?.(tx)
|
|
299
302
|
};
|
|
300
303
|
instance = createChart(container, props.spec, options);
|
|
301
304
|
prevSpec = JSON.stringify(props.spec);
|
|
@@ -326,6 +329,17 @@ var Chart = /* @__PURE__ */ defineComponent2({
|
|
|
326
329
|
});
|
|
327
330
|
onMounted2(() => {
|
|
328
331
|
mountChart();
|
|
332
|
+
watch2(
|
|
333
|
+
[() => resolveInteractionMode(props), () => Boolean(props.onEdit)],
|
|
334
|
+
([mode, hasEditListener]) => {
|
|
335
|
+
if (mode === "edit" && !hasEditListener) {
|
|
336
|
+
console.warn(
|
|
337
|
+
"[openchart] interaction: 'edit' was set without an onEdit handler; edit gestures will run but their transactions have no sink."
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
{ immediate: true }
|
|
342
|
+
);
|
|
329
343
|
});
|
|
330
344
|
onUnmounted2(() => {
|
|
331
345
|
destroyChart();
|
|
@@ -345,12 +359,18 @@ var Chart = /* @__PURE__ */ defineComponent2({
|
|
|
345
359
|
}
|
|
346
360
|
);
|
|
347
361
|
watch2(
|
|
348
|
-
() => props
|
|
349
|
-
(
|
|
362
|
+
() => resolveInteractionMode(props),
|
|
363
|
+
(mode) => {
|
|
364
|
+
if (instance && instance.getInteraction() !== mode) instance.setInteraction(mode);
|
|
365
|
+
}
|
|
366
|
+
);
|
|
367
|
+
watch2(
|
|
368
|
+
[() => props.selectedElement, () => resolveInteractionMode(props)],
|
|
369
|
+
([newVal], [oldVal]) => {
|
|
350
370
|
if (!instance) return;
|
|
351
371
|
if (newVal) {
|
|
352
372
|
instance.select(newVal);
|
|
353
|
-
} else {
|
|
373
|
+
} else if (oldVal) {
|
|
354
374
|
instance.deselect();
|
|
355
375
|
}
|
|
356
376
|
}
|
|
@@ -365,15 +385,12 @@ var Chart = /* @__PURE__ */ defineComponent2({
|
|
|
365
385
|
watch2([() => props.reader, () => props.readerSelection], () => syncReader(), { deep: false });
|
|
366
386
|
watch2(
|
|
367
387
|
[
|
|
368
|
-
() => Boolean(props.onEdit),
|
|
369
|
-
() => Boolean(props.onSelect),
|
|
370
|
-
() => Boolean(props.onDeselect),
|
|
371
388
|
() => props.rowHover,
|
|
372
389
|
() => props.autoResize,
|
|
373
390
|
() => props.theme,
|
|
374
391
|
() => props.darkMode,
|
|
375
392
|
() => props.renderer,
|
|
376
|
-
() => props.
|
|
393
|
+
() => props.selectionColor,
|
|
377
394
|
() => contextTheme?.value,
|
|
378
395
|
() => contextDarkMode?.value
|
|
379
396
|
],
|