@opendata-ai/openchart-vanilla 6.11.0 → 6.12.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 +8 -0
- package/dist/index.js +31 -18
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/svg-renderer.test.ts +7 -0
- package/src/graph/canvas-renderer.ts +3 -1
- package/src/graph/types.ts +2 -0
- package/src/graph-mount.ts +4 -0
- package/src/mount.ts +3 -0
- package/src/sankey-mount.ts +3 -0
- package/src/sankey-renderer.ts +3 -1
- package/src/svg-renderer.ts +3 -1
- package/src/table-mount.ts +3 -0
- package/src/table-renderer.ts +14 -12
package/dist/index.d.ts
CHANGED
|
@@ -100,6 +100,8 @@ interface GraphMountOptions {
|
|
|
100
100
|
theme?: ThemeConfig;
|
|
101
101
|
darkMode?: DarkMode;
|
|
102
102
|
responsive?: boolean;
|
|
103
|
+
/** Show the tryOpenData.ai watermark. Defaults to true. */
|
|
104
|
+
watermark?: boolean;
|
|
103
105
|
/** Show the built-in tooltip on node/edge hover. Defaults to true. */
|
|
104
106
|
tooltip?: boolean;
|
|
105
107
|
/** Show the built-in legend. Defaults to true. */
|
|
@@ -151,6 +153,8 @@ interface MountOptions extends ChartEventHandlers {
|
|
|
151
153
|
onDataPointClick?: (data: Record<string, unknown>) => void;
|
|
152
154
|
/** Enable responsive resizing. Defaults to true. */
|
|
153
155
|
responsive?: boolean;
|
|
156
|
+
/** Show the tryOpenData.ai watermark. Defaults to true. */
|
|
157
|
+
watermark?: boolean;
|
|
154
158
|
/** Initial selected element. */
|
|
155
159
|
selectedElement?: ElementRef;
|
|
156
160
|
}
|
|
@@ -250,6 +254,8 @@ interface SankeyMountOptions {
|
|
|
250
254
|
darkMode?: DarkMode;
|
|
251
255
|
/** Enable responsive resizing. Defaults to true. */
|
|
252
256
|
responsive?: boolean;
|
|
257
|
+
/** Show the tryOpenData.ai watermark. Defaults to true. */
|
|
258
|
+
watermark?: boolean;
|
|
253
259
|
/** Show tooltips on hover. Defaults to true. */
|
|
254
260
|
tooltip?: boolean;
|
|
255
261
|
/** Callback when a node is clicked. */
|
|
@@ -351,6 +357,8 @@ interface TableMountOptions {
|
|
|
351
357
|
theme?: ThemeConfig;
|
|
352
358
|
darkMode?: DarkMode;
|
|
353
359
|
responsive?: boolean;
|
|
360
|
+
/** Show the tryOpenData.ai watermark. Defaults to true. */
|
|
361
|
+
watermark?: boolean;
|
|
354
362
|
onRowClick?: (row: Record<string, unknown>) => void;
|
|
355
363
|
onStateChange?: (state: TableState) => void;
|
|
356
364
|
externalState?: {
|
package/dist/index.js
CHANGED
|
@@ -376,7 +376,9 @@ var GraphCanvasRenderer = class {
|
|
|
376
376
|
);
|
|
377
377
|
}
|
|
378
378
|
ctx.restore();
|
|
379
|
-
|
|
379
|
+
if (state.watermark) {
|
|
380
|
+
this.drawBrand(ctx, cssWidth, cssHeight, theme);
|
|
381
|
+
}
|
|
380
382
|
}
|
|
381
383
|
// -------------------------------------------------------------------------
|
|
382
384
|
// Brand rendering
|
|
@@ -2707,7 +2709,8 @@ function createGraph(container, spec, options) {
|
|
|
2707
2709
|
width,
|
|
2708
2710
|
height,
|
|
2709
2711
|
theme: options?.theme,
|
|
2710
|
-
darkMode
|
|
2712
|
+
darkMode,
|
|
2713
|
+
watermark: options?.watermark
|
|
2711
2714
|
};
|
|
2712
2715
|
return compileGraph(currentSpec, compileOpts);
|
|
2713
2716
|
}
|
|
@@ -2927,7 +2930,8 @@ function createGraph(container, spec, options) {
|
|
|
2927
2930
|
adjacencyMap,
|
|
2928
2931
|
theme: compilation.theme,
|
|
2929
2932
|
searchMatches: searchManager.getMatches(),
|
|
2930
|
-
isGesturing
|
|
2933
|
+
isGesturing,
|
|
2934
|
+
watermark: compilation.watermark
|
|
2931
2935
|
};
|
|
2932
2936
|
renderer.render(state);
|
|
2933
2937
|
}
|
|
@@ -4353,7 +4357,9 @@ function renderChartSVG(layout, container, opts) {
|
|
|
4353
4357
|
renderAnnotations(svg, layout);
|
|
4354
4358
|
renderLegend(svg, layout.legend);
|
|
4355
4359
|
renderChrome(svg, layout);
|
|
4356
|
-
|
|
4360
|
+
if (layout.watermark) {
|
|
4361
|
+
renderBrand(svg, layout);
|
|
4362
|
+
}
|
|
4357
4363
|
currentAnimation = void 0;
|
|
4358
4364
|
currentGradientMap = /* @__PURE__ */ new Map();
|
|
4359
4365
|
container.appendChild(svg);
|
|
@@ -5654,6 +5660,7 @@ function createChart(container, spec, options) {
|
|
|
5654
5660
|
height,
|
|
5655
5661
|
theme: options?.theme,
|
|
5656
5662
|
darkMode,
|
|
5663
|
+
watermark: options?.watermark,
|
|
5657
5664
|
measureText
|
|
5658
5665
|
};
|
|
5659
5666
|
if (isLayerSpec(currentSpec)) {
|
|
@@ -6896,7 +6903,9 @@ function renderSankeySVG(layout, animation) {
|
|
|
6896
6903
|
renderLabels(svg, layout.nodes);
|
|
6897
6904
|
renderLegend2(svg, layout.legend);
|
|
6898
6905
|
renderChrome2(svg, layout);
|
|
6899
|
-
|
|
6906
|
+
if (layout.watermark) {
|
|
6907
|
+
renderBrand2(svg, layout);
|
|
6908
|
+
}
|
|
6900
6909
|
return svg;
|
|
6901
6910
|
}
|
|
6902
6911
|
|
|
@@ -6937,7 +6946,8 @@ function createSankey(container, spec, options) {
|
|
|
6937
6946
|
width,
|
|
6938
6947
|
height,
|
|
6939
6948
|
theme: options?.theme,
|
|
6940
|
-
darkMode
|
|
6949
|
+
darkMode,
|
|
6950
|
+
watermark: options?.watermark
|
|
6941
6951
|
};
|
|
6942
6952
|
return compileSankey(currentSpec, compileOpts);
|
|
6943
6953
|
}
|
|
@@ -7671,18 +7681,20 @@ function renderTable(layout, container, opts) {
|
|
|
7671
7681
|
liveRegion.setAttribute("aria-atomic", "true");
|
|
7672
7682
|
liveRegion.setAttribute("role", "status");
|
|
7673
7683
|
wrapper.appendChild(liveRegion);
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7684
|
+
if (layout.watermark) {
|
|
7685
|
+
const brandColor = theme ? theme.colors.axis : "#999999";
|
|
7686
|
+
const brand = document.createElement("div");
|
|
7687
|
+
brand.className = "oc-table-ref";
|
|
7688
|
+
brand.style.cssText = "text-align: right; padding: 4px 8px;";
|
|
7689
|
+
const brandLink = document.createElement("a");
|
|
7690
|
+
brandLink.href = BRAND_URL3;
|
|
7691
|
+
brandLink.target = "_blank";
|
|
7692
|
+
brandLink.rel = "noopener";
|
|
7693
|
+
brandLink.style.cssText = `font-size: ${BRAND_FONT_SIZE4}px; font-weight: 600; color: ${brandColor}; opacity: 0.55; text-decoration: none; font-family: ${theme ? theme.fonts.family : "sans-serif"};`;
|
|
7694
|
+
brandLink.textContent = "tryOpenData.ai";
|
|
7695
|
+
brand.appendChild(brandLink);
|
|
7696
|
+
wrapper.appendChild(brand);
|
|
7697
|
+
}
|
|
7686
7698
|
if (opts?.animate && layout.animation?.enabled) {
|
|
7687
7699
|
const anim = layout.animation;
|
|
7688
7700
|
const rowCount = layout.rows.length;
|
|
@@ -7773,6 +7785,7 @@ function createTable(container, spec, options) {
|
|
|
7773
7785
|
height: 600,
|
|
7774
7786
|
theme: options?.theme,
|
|
7775
7787
|
darkMode,
|
|
7788
|
+
watermark: options?.watermark,
|
|
7776
7789
|
sort: state.sort ?? void 0,
|
|
7777
7790
|
search: state.search || void 0,
|
|
7778
7791
|
page: state.page
|