@datawheel/data-explorer 0.3.10 → 0.3.12
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/main.d.mts +2 -0
- package/dist/main.mjs +21 -11
- package/package.json +1 -1
package/dist/main.d.mts
CHANGED
package/dist/main.mjs
CHANGED
|
@@ -1716,7 +1716,6 @@ function serializePermalink(item) {
|
|
|
1716
1716
|
function parsePermalink(cube, value) {
|
|
1717
1717
|
const search = new URLSearchParams(value);
|
|
1718
1718
|
const params = requestToQueryParams(cube, search);
|
|
1719
|
-
console.log(search.get("chart"));
|
|
1720
1719
|
return buildQuery({
|
|
1721
1720
|
panel: search.get("panel") || "table",
|
|
1722
1721
|
chart: search.get("chart") || "",
|
|
@@ -1776,7 +1775,6 @@ function useUpdatePermaLink({
|
|
|
1776
1775
|
}
|
|
1777
1776
|
function useKey(params = {}) {
|
|
1778
1777
|
const queryItem = useSelector(selectCurrentQueryItem);
|
|
1779
|
-
console.log(queryItem);
|
|
1780
1778
|
if (isValidQuery(queryItem.params)) {
|
|
1781
1779
|
return serializePermalink({ ...queryItem, params: { ...queryItem.params, ...params } });
|
|
1782
1780
|
}
|
|
@@ -1855,6 +1853,9 @@ init_esm_shims();
|
|
|
1855
1853
|
|
|
1856
1854
|
// src/state/utils.ts
|
|
1857
1855
|
init_esm_shims();
|
|
1856
|
+
function calcMaxMemberCount(lengths) {
|
|
1857
|
+
return lengths.reduce((prev, curr) => prev * curr);
|
|
1858
|
+
}
|
|
1858
1859
|
function pickDefaultDrilldowns(dimensions) {
|
|
1859
1860
|
const levels = [];
|
|
1860
1861
|
const findDefaultHierarchy = (dim) => dim.hierarchies.find((h) => h.name === dim.default_hierarchy) || dim.hierarchies[0];
|
|
@@ -1862,9 +1863,20 @@ function pickDefaultDrilldowns(dimensions) {
|
|
|
1862
1863
|
if (dimension.type === "time" || levels.length < 4) {
|
|
1863
1864
|
const hierarchy = findDefaultHierarchy(dimension);
|
|
1864
1865
|
const levelIndex = dimension.type === "geo" ? hierarchy.levels.length - 1 : 0;
|
|
1865
|
-
levels.push(hierarchy.levels[levelIndex]);
|
|
1866
|
+
levels.push({ ...hierarchy.levels[levelIndex], type: dimension.type });
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
let totalCount = calcMaxMemberCount(levels.map((l) => l.count));
|
|
1870
|
+
while (totalCount > 5e6) {
|
|
1871
|
+
const geoIndex = levels.findIndex((level) => level.type === "geo");
|
|
1872
|
+
if (geoIndex !== -1) {
|
|
1873
|
+
levels.splice(geoIndex, 1);
|
|
1874
|
+
} else {
|
|
1875
|
+
levels.pop();
|
|
1866
1876
|
}
|
|
1877
|
+
totalCount = calcMaxMemberCount(levels.map((l) => l.count));
|
|
1867
1878
|
}
|
|
1879
|
+
console.log(levels, "lkvs");
|
|
1868
1880
|
return levels;
|
|
1869
1881
|
}
|
|
1870
1882
|
|
|
@@ -5291,14 +5303,12 @@ function ExplorerContent(props) {
|
|
|
5291
5303
|
const serverConfig = useMemo(() => {
|
|
5292
5304
|
return props.serverConfig !== void 0 ? props.serverConfig : {};
|
|
5293
5305
|
}, [props.serverConfig]);
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
);
|
|
5301
|
-
}, [props.serverURL, serverConfig, props.defaultDataLocale, props.defaultCube]);
|
|
5306
|
+
useSetup(
|
|
5307
|
+
props.serverURL,
|
|
5308
|
+
serverConfig,
|
|
5309
|
+
props.defaultDataLocale,
|
|
5310
|
+
props.defaultCube
|
|
5311
|
+
);
|
|
5302
5312
|
const { classes } = useStyles4({ height: props.height });
|
|
5303
5313
|
useEffect(() => {
|
|
5304
5314
|
if (props.locale) translation.setLocale(props.locale);
|