@bicharts/chart-host 0.5.52 → 0.5.53
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.
|
@@ -594,38 +594,38 @@ var Y2 = ["pct", "percent", "percentage", "rate", "ratio", "rating", "share", "s
|
|
|
594
594
|
var J2 = ["latitude", "longitude"];
|
|
595
595
|
var Q2 = ["latitude", "longitude"];
|
|
596
596
|
var tt = /^\s*(sum|count|count\s+distinct|distinct\s+count)\s+of\s+/i;
|
|
597
|
-
var
|
|
598
|
-
var
|
|
599
|
-
var
|
|
597
|
+
var jt = /(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g;
|
|
598
|
+
var Wt = new RegExp("\\b(" + X2.join("|") + ")\\b|(" + Y2.join("|") + ")$", "i");
|
|
599
|
+
var Xt = new RegExp("\\b(" + J2.join("|") + ")\\b|(" + Q2.join("|") + ")$", "i");
|
|
600
600
|
function L2(e) {
|
|
601
601
|
return e ? String(e).replace(tt, "").trim() : "";
|
|
602
602
|
}
|
|
603
603
|
function et(e) {
|
|
604
604
|
return !!e && tt.test(String(e));
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function Yt(e) {
|
|
607
607
|
let t = L2(e);
|
|
608
|
-
return t.length === 0 ? "" : t.replace(
|
|
608
|
+
return t.length === 0 ? "" : t.replace(jt, " ");
|
|
609
609
|
}
|
|
610
610
|
function nt(e, t) {
|
|
611
|
-
return t ? e.test(
|
|
611
|
+
return t ? e.test(Yt(t)) || e.test(L2(t)) : false;
|
|
612
612
|
}
|
|
613
613
|
function z2(e) {
|
|
614
|
-
return nt(
|
|
614
|
+
return nt(Xt, e);
|
|
615
615
|
}
|
|
616
616
|
function it(e) {
|
|
617
|
-
return nt(
|
|
617
|
+
return nt(Wt, e) || z2(e);
|
|
618
618
|
}
|
|
619
619
|
var ot = /int|double|decimal|single|float|number|currency|money/i;
|
|
620
|
-
function
|
|
620
|
+
function Jt(e) {
|
|
621
621
|
let t = String(e?.valueNature ?? "").trim().toLowerCase();
|
|
622
622
|
return t === "categorical" ? "Categorical" : t === "ordinal" ? "Ordinal" : t === "continuous" || e?.isMeasure === true || ot.test(String(e?.dataType ?? "")) ? "Continuous" : "Categorical";
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function Qt(e) {
|
|
625
625
|
return e?.isMeasure === true || ot.test(String(e?.dataType ?? ""));
|
|
626
626
|
}
|
|
627
627
|
function G2(e) {
|
|
628
|
-
let t = e ?? {}, i =
|
|
628
|
+
let t = e ?? {}, i = Jt(t);
|
|
629
629
|
if (i !== "Continuous") return { nature: i, additivity: "unknown", basis: "role", suppressed: false };
|
|
630
630
|
if (z2(t.name)) return { nature: i, additivity: "positional", basis: "name", suppressed: true };
|
|
631
631
|
let s = String(t.additivity ?? "").trim().toLowerCase();
|
|
@@ -636,10 +636,10 @@ function G2(e) {
|
|
|
636
636
|
}
|
|
637
637
|
return t.discourageAggregationAcrossGroups === true ? { nature: i, additivity: "intensive_rate", basis: "host-flag", suppressed: false } : it(t.name) ? { nature: i, additivity: "intensive_rate", basis: "name", suppressed: false } : { nature: i, additivity: "additive", basis: "default", suppressed: false };
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function D2(e) {
|
|
640
640
|
let t = G2(e), i = e ?? {};
|
|
641
641
|
if (t.nature === "Categorical") return ["first", "distinctcount", "count"];
|
|
642
|
-
if (t.nature === "Ordinal") return
|
|
642
|
+
if (t.nature === "Ordinal") return Qt(i) ? ["median", "average", "min", "max", "first", "distinctcount", "count"] : ["first", "distinctcount", "count"];
|
|
643
643
|
switch (t.additivity) {
|
|
644
644
|
case "positional":
|
|
645
645
|
return ["min", "max", "count", "distinctcount", "first"];
|
|
@@ -649,16 +649,16 @@ function F2(e) {
|
|
|
649
649
|
return ["sum", "average", "median", "min", "max", "count", "distinctcount", "first"];
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
|
-
function
|
|
653
|
-
return
|
|
652
|
+
function te(e) {
|
|
653
|
+
return D2(e)[0];
|
|
654
654
|
}
|
|
655
|
-
function
|
|
655
|
+
function ne(e, t) {
|
|
656
656
|
if (t !== "sum" && t !== "count") return false;
|
|
657
657
|
if (t === "count") return true;
|
|
658
658
|
let i = G2(e);
|
|
659
659
|
return i.additivity === "additive" || i.additivity === "part_of_whole" || i.additivity === "unknown";
|
|
660
660
|
}
|
|
661
|
-
var
|
|
661
|
+
var F2 = 2;
|
|
662
662
|
var at = 400;
|
|
663
663
|
function K2(e) {
|
|
664
664
|
return !!E(e);
|
|
@@ -716,24 +716,24 @@ function H2(e) {
|
|
|
716
716
|
function st(e, t) {
|
|
717
717
|
return p(t, en) ? true : V2(e).some((i) => /^\d{5}(-\d{4})?$/.test(i.replace(/\.0+$/, "")));
|
|
718
718
|
}
|
|
719
|
-
function
|
|
719
|
+
function ie(e, t) {
|
|
720
720
|
let i = v2(e);
|
|
721
721
|
if (i.length === 0) return 0;
|
|
722
722
|
let s = 0;
|
|
723
723
|
for (let u2 of i) p3(u2, t) && s++;
|
|
724
724
|
return Math.round(s / i.length * 1e3) / 10;
|
|
725
725
|
}
|
|
726
|
-
function
|
|
726
|
+
function $2(e, t) {
|
|
727
727
|
let i = 0;
|
|
728
728
|
for (let s of v2(e)) t(s) && i++;
|
|
729
729
|
return i;
|
|
730
730
|
}
|
|
731
|
-
function
|
|
731
|
+
function oe(e, t) {
|
|
732
732
|
let i = 0;
|
|
733
733
|
for (let s of V2(e)) t(s) && i++;
|
|
734
734
|
return i;
|
|
735
735
|
}
|
|
736
|
-
function
|
|
736
|
+
function re(e, t, i, s, u2) {
|
|
737
737
|
let x2 = [], c = [], o = {}, R = {}, N2 = new Set(e), l = (n) => t.map((r) => r[n]);
|
|
738
738
|
for (let n of ["city", "country"]) {
|
|
739
739
|
let r = i?.[n];
|
|
@@ -762,15 +762,15 @@ function oe(e, t, i, s, u2) {
|
|
|
762
762
|
if (h2(a2)) continue;
|
|
763
763
|
let d = I2(a2);
|
|
764
764
|
if (d < 95) continue;
|
|
765
|
-
let E2 =
|
|
766
|
-
E2 <
|
|
765
|
+
let E2 = $2(a2, (b2) => !!Y(b2)), ct = $2(a2, (b2) => !!Y(b2) && !rt(b2, s));
|
|
766
|
+
E2 < F2 && ct < 1 || (!n || d > n.pct) && (n = { name: r, pct: d });
|
|
767
767
|
}
|
|
768
768
|
n && (o.state = n.name, m2.add(n.name), x2.push(`state=${n.name} (${n.pct}% states/provinces)`));
|
|
769
769
|
}
|
|
770
770
|
if (!o.zip) for (let n of C) {
|
|
771
771
|
if (m2.has(n)) continue;
|
|
772
772
|
let r = l(n), a2 = H2(r);
|
|
773
|
-
if (!(a2 < 95) && st(r, n) && !(
|
|
773
|
+
if (!(a2 < 95) && st(r, n) && !(oe(r, (d) => Z(d).length > 0) < F2)) {
|
|
774
774
|
o.zip = n, m2.add(n), x2.push(`zip=${n} (${a2}% ZIP codes)`);
|
|
775
775
|
break;
|
|
776
776
|
}
|
|
@@ -789,8 +789,8 @@ function oe(e, t, i, s, u2) {
|
|
|
789
789
|
let n = null;
|
|
790
790
|
for (let r of C) {
|
|
791
791
|
if (m2.has(r)) continue;
|
|
792
|
-
let a2 = l(r), d =
|
|
793
|
-
d < m3 ||
|
|
792
|
+
let a2 = l(r), d = ie(a2, s);
|
|
793
|
+
d < m3 || $2(a2, (E2) => p3(E2, s)) < F2 || (!n || d > n.pct) && (n = { name: r, pct: d });
|
|
794
794
|
}
|
|
795
795
|
n && (o.city = n.name, x2.push(`city=${n.name} (${n.pct}% known cities)`));
|
|
796
796
|
}
|
|
@@ -813,7 +813,7 @@ function resolvePointChannel(cols, rowObjs, point) {
|
|
|
813
813
|
let labelCol;
|
|
814
814
|
if (bind) {
|
|
815
815
|
const dims = cols.filter((c) => !c.isMeasure).map((c) => c.name);
|
|
816
|
-
const res =
|
|
816
|
+
const res = re(dims, rowObjs, bind, point?.mapKind, cols.map((c) => c.name));
|
|
817
817
|
bind = res.bind;
|
|
818
818
|
rolesBackfilled = res.backfilled;
|
|
819
819
|
rolesRefused = res.refused;
|
|
@@ -1614,9 +1614,9 @@ export {
|
|
|
1614
1614
|
clearGeoCache,
|
|
1615
1615
|
L3,
|
|
1616
1616
|
G2 as G,
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1617
|
+
D2 as D,
|
|
1618
|
+
te,
|
|
1619
|
+
ne,
|
|
1620
1620
|
buildRenderPayload,
|
|
1621
1621
|
createMarkResolver,
|
|
1622
1622
|
ensureCrossfilterHitTargets,
|
package/dist/index.mjs
CHANGED
|
@@ -17,9 +17,9 @@ import {
|
|
|
17
17
|
CONTAINER_SLOT_INITIAL_XF_MARK,
|
|
18
18
|
CONTAINER_SLOT_UI_STATE,
|
|
19
19
|
CONTAINER_SLOT_XF_CLEAR,
|
|
20
|
+
D,
|
|
20
21
|
DIM_OPACITY_DEFAULT,
|
|
21
22
|
DIM_OPACITY_VAR,
|
|
22
|
-
F,
|
|
23
23
|
FLIP_MODE_DEFAULT,
|
|
24
24
|
G,
|
|
25
25
|
GEO_POINT_PRECISIONS,
|
|
@@ -30,7 +30,6 @@ import {
|
|
|
30
30
|
LIFT_SELECTED_CLASS,
|
|
31
31
|
MARK_CLASS,
|
|
32
32
|
MARK_SELECTED_CLASS,
|
|
33
|
-
Qt,
|
|
34
33
|
ROW_IDX_ATTR,
|
|
35
34
|
SELECTION_ACTIVE_CLASS,
|
|
36
35
|
XFILTER_REFRESH_EVENT,
|
|
@@ -42,13 +41,13 @@ import {
|
|
|
42
41
|
compileRenderFn,
|
|
43
42
|
createChartHost,
|
|
44
43
|
createMarkResolver,
|
|
45
|
-
ee,
|
|
46
44
|
ensureCrossfilterHitTargets,
|
|
47
45
|
explainRenderFailure,
|
|
48
46
|
geoAssetFor,
|
|
49
47
|
geoFromCache,
|
|
50
48
|
isBlankRender,
|
|
51
49
|
loadGeo,
|
|
50
|
+
ne,
|
|
52
51
|
noopViewStateProvider,
|
|
53
52
|
periodTickSuppressesFeedback,
|
|
54
53
|
registerGeo,
|
|
@@ -56,8 +55,9 @@ import {
|
|
|
56
55
|
requiredD3Plugins,
|
|
57
56
|
resolveOptions,
|
|
58
57
|
sessionViewStateProvider,
|
|
59
|
-
stripEsmExports
|
|
60
|
-
|
|
58
|
+
stripEsmExports,
|
|
59
|
+
te
|
|
60
|
+
} from "./chunk-COSG4M73.mjs";
|
|
61
61
|
import "./chunk-A2GMXZP7.mjs";
|
|
62
62
|
|
|
63
63
|
// src/trivial.ts
|
|
@@ -694,11 +694,11 @@ function isSuppressed(col) {
|
|
|
694
694
|
}
|
|
695
695
|
function resolveAgg(col, requested, auto) {
|
|
696
696
|
const fallback = () => {
|
|
697
|
-
const d =
|
|
697
|
+
const d = te(col);
|
|
698
698
|
return d === "first" ? "count" : d;
|
|
699
699
|
};
|
|
700
700
|
if (auto) return fallback();
|
|
701
|
-
return
|
|
701
|
+
return D(col).indexOf(requested) >= 0 ? requested : fallback();
|
|
702
702
|
}
|
|
703
703
|
function toNumber(v) {
|
|
704
704
|
if (v == null || v === "") return null;
|
|
@@ -802,7 +802,7 @@ function computeSelectionCard(payload, selectedRowIdxs, opts = {}) {
|
|
|
802
802
|
}
|
|
803
803
|
const value = reduce(selVals, colAgg, selRaw);
|
|
804
804
|
let sharePct = null;
|
|
805
|
-
if (
|
|
805
|
+
if (ne(col, colAgg) && value != null) {
|
|
806
806
|
const allVals = [];
|
|
807
807
|
const allRaw = [];
|
|
808
808
|
for (let r = 0; r < rows.length; r++) {
|
package/dist/react.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.53",
|
|
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",
|