graphein 0.7.2 → 0.8.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 +12 -10
- package/dist/index.js +3 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2482,8 +2482,9 @@ declare function fontString(size: number, family: string, weight?: number | stri
|
|
|
2482
2482
|
*
|
|
2483
2483
|
* A dashboard owns a shared dataset and a shared selection store, lays its views
|
|
2484
2484
|
* out on a responsive grid, and *auto-wires* cross-interaction: slicers filter
|
|
2485
|
-
* the charts, and clicking a chart cross-
|
|
2486
|
-
*
|
|
2485
|
+
* the charts, and clicking a chart cross-filters the other views while the
|
|
2486
|
+
* source dims its own unpicked marks (Power BI–style).
|
|
2487
|
+
* Everything is plain JSON — no callbacks — so a dashboard
|
|
2487
2488
|
* round-trips through `JSON.stringify` just like a chart.
|
|
2488
2489
|
*/
|
|
2489
2490
|
|
|
@@ -2607,8 +2608,9 @@ interface DashboardSpec {
|
|
|
2607
2608
|
views: DashboardView[];
|
|
2608
2609
|
/**
|
|
2609
2610
|
* Cross-interaction policy:
|
|
2610
|
-
* - 'auto' (default):
|
|
2611
|
-
*
|
|
2611
|
+
* - 'auto' (default): every source cross-filters the page — slicers and chart
|
|
2612
|
+
* clicks both subset rows in the other views; the clicked chart dims its own
|
|
2613
|
+
* unpicked marks instead of hiding them.
|
|
2612
2614
|
* - 'none': views are laid out but not linked.
|
|
2613
2615
|
* - an array of {@link InteractionLink}: explicit wiring (replaces auto).
|
|
2614
2616
|
*/
|
|
@@ -3682,12 +3684,12 @@ declare function render(target: HTMLElement | string, spec: ChartSpec, options?:
|
|
|
3682
3684
|
* store) so it unit-tests in node and the runtime stays a thin shell.
|
|
3683
3685
|
*
|
|
3684
3686
|
* Rules (interactions: 'auto'):
|
|
3685
|
-
* - A **slicer** publishes a value on its field/param; every
|
|
3686
|
-
*
|
|
3687
|
-
* - A **chart** click publishes a point selection on its key field(s)
|
|
3688
|
-
*
|
|
3689
|
-
*
|
|
3690
|
-
*
|
|
3687
|
+
* - A **slicer** publishes a value on its field/param; every other non-slicer
|
|
3688
|
+
* view gets a `filter` clause for it (page-level cross-filter).
|
|
3689
|
+
* - A **chart** click publishes a point selection on its key field(s). The
|
|
3690
|
+
* source emphasizes itself (`highlight` on its own param, so it dims the
|
|
3691
|
+
* unpicked marks rather than hiding them), and **every other view** gets a
|
|
3692
|
+
* `filter` clause for that param (Power BI–style cross-filter of the page).
|
|
3691
3693
|
*/
|
|
3692
3694
|
|
|
3693
3695
|
declare function isSlicerType(type: ChartSpec['type']): boolean;
|
package/dist/index.js
CHANGED
|
@@ -16401,11 +16401,6 @@ function addFilterParam(spec, paramName) {
|
|
|
16401
16401
|
filter.push({ param: paramName });
|
|
16402
16402
|
return { ...spec, filter };
|
|
16403
16403
|
}
|
|
16404
|
-
function usesAll(spec, fields) {
|
|
16405
|
-
if (fields.length === 0) return false;
|
|
16406
|
-
const have = specFields(spec);
|
|
16407
|
-
return fields.every((f) => have.has(f));
|
|
16408
|
-
}
|
|
16409
16404
|
function autoParamName(view) {
|
|
16410
16405
|
const existing = view.spec.params?.[0]?.name;
|
|
16411
16406
|
return existing ?? `__sel__${view.id}`;
|
|
@@ -16441,16 +16436,12 @@ function wireViews(views, interactions) {
|
|
|
16441
16436
|
name: src.param,
|
|
16442
16437
|
select: { type: "point", on: "click", fields: src.fields }
|
|
16443
16438
|
});
|
|
16439
|
+
out[src.view].spec = addHighlight(out[src.view].spec, src.param);
|
|
16444
16440
|
}
|
|
16445
16441
|
out.forEach((v, j) => {
|
|
16446
16442
|
if (isSlicerType(v.spec.type)) return;
|
|
16447
|
-
if (
|
|
16448
|
-
|
|
16449
|
-
out[j].spec = addFilterParam(out[j].spec, src.param);
|
|
16450
|
-
} else {
|
|
16451
|
-
if (!usesAll(v.spec, src.fields)) return;
|
|
16452
|
-
out[j].spec = addHighlight(out[j].spec, src.param);
|
|
16453
|
-
}
|
|
16443
|
+
if (j === src.view) return;
|
|
16444
|
+
out[j].spec = addFilterParam(out[j].spec, src.param);
|
|
16454
16445
|
});
|
|
16455
16446
|
}
|
|
16456
16447
|
return out;
|