@bicharts/chart-host 0.6.32 → 0.6.33

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/README.md CHANGED
@@ -67,6 +67,12 @@ payload→source row mapping — which is the part you must not hand-roll:
67
67
  > not an id in your table. Re-render a chart with filtered rows and its payload renumbers from
68
68
  > zero, so the same integer now denotes a different record. Comparing indices across two charts
69
69
  > does not throw — it quietly filters to the wrong thing.
70
+ >
71
+ > Rows built from `data.sample.json` already carry a `__rowIdx__` column (the sample's own
72
+ > positions). The payload builder owns that name: it drops an incoming `__rowIdx__` and writes
73
+ > each payload's positions itself, so the rows above need no cleaning. (Before 0.6.33 the
74
+ > incoming column was kept beside the new one and a filtered chart's clicks read it; on an older
75
+ > version, leave `__rowIdx__` out when you build `columns`.)
70
76
 
71
77
  ### The coordinated dashboard: one chart filters, the other highlights
72
78
 
@@ -1728,6 +1728,7 @@ var St3 = Object.freeze({ integer: "number", decimal: "number", double: "number"
1728
1728
  var Nt2 = Object.freeze({ RENDER_START: "render-start", RENDER_OK: "render-ok", RENDER_ERROR: "render-error", VIEW: "view", VIEW_VERDICT: "view-verdict" });
1729
1729
 
1730
1730
  // src/payload.ts
1731
+ var ROW_IDX_COLUMN = "__rowIdx__";
1731
1732
  function resolvePointChannel(cols, rowObjs, point) {
1732
1733
  let pLat = null;
1733
1734
  let pLon = null;
@@ -1784,7 +1785,7 @@ function resolvePointChannel(cols, rowObjs, point) {
1784
1785
  return { lat: pLat, lon: pLon, prec: pPrec, geoPoint, rolesRefused };
1785
1786
  }
1786
1787
  function buildRenderPayload(cols, rowObjs, geo, point, destination, opts) {
1787
- const colNames = cols.map((c2) => c2.name);
1788
+ cols = cols.filter((c2) => c2.name !== ROW_IDX_COLUMN);
1788
1789
  let utcDayColumns = null;
1789
1790
  if (opts?.utcDays) {
1790
1791
  const norm = rn(cols, rowObjs);
@@ -1807,10 +1808,13 @@ function buildRenderPayload(cols, rowObjs, geo, point, destination, opts) {
1807
1808
  geoUnmatched = { count: built.totalRows - built.matchedRows, examples: built.unmatched.slice(0, 8) };
1808
1809
  geoUnmatchedDistinct = built.unmatched.length;
1809
1810
  }
1810
- const hostNames = ["__rowIdx__"];
1811
+ const hostNames = [ROW_IDX_COLUMN];
1811
1812
  if (geoIso) hostNames.push("__geoIso__");
1812
1813
  if (pLat) hostNames.push("__geoLat__", "__geoLon__", "__geoPrecision__");
1813
1814
  if (dLat) hostNames.push("__geoLatD__", "__geoLonD__", "__geoPrecisionD__");
1815
+ const owned = new Set(hostNames);
1816
+ if (cols.some((c2) => owned.has(c2.name))) cols = cols.filter((c2) => !owned.has(c2.name));
1817
+ const colNames = cols.map((c2) => c2.name);
1814
1818
  const aliasCols = [];
1815
1819
  if (opts?.aliases && opts.aliases.length > 0) {
1816
1820
  const claimed = /* @__PURE__ */ new Set([...colNames, ...hostNames]);
@@ -1850,7 +1854,7 @@ function buildRenderPayload(cols, rowObjs, geo, point, destination, opts) {
1850
1854
  for (const ac of aliasCols) a4[k3++] = a4[ac.from];
1851
1855
  out[r] = a4;
1852
1856
  }
1853
- const colsOut = [...cols, { name: "__rowIdx__", dataType: "Integer", isMeasure: false, modelDesc: "" }];
1857
+ const colsOut = [...cols, { name: ROW_IDX_COLUMN, dataType: "Integer", isMeasure: false, modelDesc: "" }];
1854
1858
  if (geoIso) colsOut.push({ name: "__geoIso__", dataType: "String", isMeasure: false, modelDesc: "" });
1855
1859
  if (pLat) colsOut.push(
1856
1860
  { name: "__geoLat__", dataType: "Double", isMeasure: false, modelDesc: "" },
package/dist/index.mjs CHANGED
@@ -140,7 +140,7 @@ import {
140
140
  unpinScrolledAxis,
141
141
  valuePlacementFlag,
142
142
  withoutViewOnlyKeys
143
- } from "./chunk-P22NUGCZ.mjs";
143
+ } from "./chunk-3GA6D5WX.mjs";
144
144
  import "./chunk-A2GMXZP7.mjs";
145
145
  import "./chunk-GHODWOAL.mjs";
146
146
 
package/dist/react.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  loadGeo,
8
8
  syncMemberSelection,
9
9
  toSourceRows
10
- } from "./chunk-P22NUGCZ.mjs";
10
+ } from "./chunk-3GA6D5WX.mjs";
11
11
  import "./chunk-A2GMXZP7.mjs";
12
12
  import "./chunk-GHODWOAL.mjs";
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.6.32",
3
+ "version": "0.6.33",
4
4
  "description": "Run a BIC-generated D3 chart in any web host: compiles the generated render() function, applies the shared option defaults, resolves mark clicks (through tooltip overlays), owns the selection affordance, and translates row indices between cross-filtered charts. The same contract the BIC Power BI visual implements, minus Power BI. React bindings at @bicharts/chart-host/react.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",