@datawheel/data-explorer 1.0.15 → 1.0.16
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.mjs +29 -17
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -484,6 +484,7 @@ var vizbuilderTranslation = {
|
|
|
484
484
|
total: "Total: {{value}}"
|
|
485
485
|
},
|
|
486
486
|
transient: {
|
|
487
|
+
title_one_row: "The dataset has only one row and can't be used to generate charts.",
|
|
487
488
|
title_loading: "Generating charts...",
|
|
488
489
|
title_empty: "No results",
|
|
489
490
|
description_empty: "The selected combination of parameters can't be used to generate a meaningful set of charts. Try changing some parameters (maybe applying some restriction in a column) and generating charts again."
|
|
@@ -4920,6 +4921,7 @@ function SideBarItem({ children }) {
|
|
|
4920
4921
|
function Auto() {
|
|
4921
4922
|
const { translate: t } = useTranslation();
|
|
4922
4923
|
const { expanded, input, setInput } = useSideBar();
|
|
4924
|
+
const [inputValue, setInputValue] = useState(input);
|
|
4923
4925
|
return /* @__PURE__ */ React13__default.createElement(
|
|
4924
4926
|
Input,
|
|
4925
4927
|
{
|
|
@@ -4928,8 +4930,11 @@ function Auto() {
|
|
|
4928
4930
|
radius: "xl",
|
|
4929
4931
|
size: "md",
|
|
4930
4932
|
placeholder: t("params.label_search"),
|
|
4931
|
-
|
|
4932
|
-
onInput: (e) =>
|
|
4933
|
+
value: inputValue,
|
|
4934
|
+
onInput: (e) => {
|
|
4935
|
+
setInputValue(e.currentTarget.value);
|
|
4936
|
+
setInput(e.currentTarget.value);
|
|
4937
|
+
},
|
|
4933
4938
|
styles: {
|
|
4934
4939
|
wrapper: {
|
|
4935
4940
|
width: expanded ? "100%" : 0,
|
|
@@ -4944,7 +4949,10 @@ function Auto() {
|
|
|
4944
4949
|
CloseButton,
|
|
4945
4950
|
{
|
|
4946
4951
|
"aria-label": "Clear input",
|
|
4947
|
-
onClick: () =>
|
|
4952
|
+
onClick: () => {
|
|
4953
|
+
setInput("");
|
|
4954
|
+
setInputValue("");
|
|
4955
|
+
},
|
|
4948
4956
|
style: { display: input ? void 0 : "none" }
|
|
4949
4957
|
}
|
|
4950
4958
|
)
|
|
@@ -7549,6 +7557,9 @@ function NonIdealState2(props) {
|
|
|
7549
7557
|
if (status === "loading") {
|
|
7550
7558
|
return /* @__PURE__ */ React13__default.createElement(Flex, { justify: "center", align: "center", direction: "column" }, /* @__PURE__ */ React13__default.createElement(Loader, { size: "xl" }), /* @__PURE__ */ React13__default.createElement(Title, { mt: "md", order: 4 }, t("vizbuilder.transient.title_loading")));
|
|
7551
7559
|
}
|
|
7560
|
+
if (status === "one-row") {
|
|
7561
|
+
return /* @__PURE__ */ React13__default.createElement(Flex, { justify: "center", align: "center", direction: "column", w: "50%" }, /* @__PURE__ */ React13__default.createElement(IconCircleOff, { size: 92 }), /* @__PURE__ */ React13__default.createElement(Title, { mt: "md", mb: "md", order: 4 }, t("vizbuilder.transient.title_one_row")));
|
|
7562
|
+
}
|
|
7552
7563
|
return /* @__PURE__ */ React13__default.createElement(Flex, { justify: "center", align: "center", direction: "column", w: "50%" }, /* @__PURE__ */ React13__default.createElement(IconCircleOff, { size: 92 }), /* @__PURE__ */ React13__default.createElement(Title, { mt: "md", mb: "md", order: 4 }, t("vizbuilder.transient.title_empty")), /* @__PURE__ */ React13__default.createElement(Text, null, t("vizbuilder.transient.description_empty")));
|
|
7553
7564
|
}, [status, t]);
|
|
7554
7565
|
return /* @__PURE__ */ React13__default.createElement(Center, { h: "100%" }, description);
|
|
@@ -7569,9 +7580,12 @@ function Vizbuilder(props) {
|
|
|
7569
7580
|
const queryItem = useSelector$1(selectCurrentQueryItem);
|
|
7570
7581
|
const currentChart = (queryItem == null ? void 0 : queryItem.chart) || "";
|
|
7571
7582
|
const { actions: actions2 } = useSettings();
|
|
7572
|
-
const setCurrentChart = useCallback(
|
|
7573
|
-
|
|
7574
|
-
|
|
7583
|
+
const setCurrentChart = useCallback(
|
|
7584
|
+
(chart) => {
|
|
7585
|
+
actions2.updateChart(chart);
|
|
7586
|
+
},
|
|
7587
|
+
[actions2]
|
|
7588
|
+
);
|
|
7575
7589
|
const getMeasureConfig = useMemo(() => {
|
|
7576
7590
|
const config = measureConfig || {};
|
|
7577
7591
|
return typeof config === "function" ? config : (item) => config[item.name];
|
|
@@ -7598,9 +7612,14 @@ function Vizbuilder(props) {
|
|
|
7598
7612
|
console.debug("Loading datasets...", datasets);
|
|
7599
7613
|
return /* @__PURE__ */ React13__default.createElement(Notice, { status: "loading" });
|
|
7600
7614
|
}
|
|
7601
|
-
|
|
7615
|
+
let chartList = Object.values(charts);
|
|
7616
|
+
if (chartList.length === 0 && !Array.isArray(datasets) && datasets.data.length === 1)
|
|
7617
|
+
return /* @__PURE__ */ React13__default.createElement(Notice, { status: "one-row" });
|
|
7602
7618
|
if (chartList.length === 0) return /* @__PURE__ */ React13__default.createElement(Notice, { status: "empty" });
|
|
7603
7619
|
const isSingleChart = chartList.length === 1;
|
|
7620
|
+
if (chartList.length > 10) {
|
|
7621
|
+
chartList = chartList.slice(0, 10);
|
|
7622
|
+
}
|
|
7604
7623
|
return /* @__PURE__ */ React13__default.createElement(ErrorBoundary, null, /* @__PURE__ */ React13__default.createElement(
|
|
7605
7624
|
SimpleGrid,
|
|
7606
7625
|
{
|
|
@@ -7650,14 +7669,7 @@ function Vizbuilder(props) {
|
|
|
7650
7669
|
isFullMode: true
|
|
7651
7670
|
}
|
|
7652
7671
|
);
|
|
7653
|
-
}, [
|
|
7654
|
-
charts,
|
|
7655
|
-
currentChart,
|
|
7656
|
-
downloadFormats,
|
|
7657
|
-
getMeasureConfig,
|
|
7658
|
-
showConfidenceInt,
|
|
7659
|
-
userConfig
|
|
7660
|
-
]);
|
|
7672
|
+
}, [charts, currentChart, downloadFormats, getMeasureConfig, showConfidenceInt, userConfig]);
|
|
7661
7673
|
return /* @__PURE__ */ React13__default.createElement("div", { style: { height: "100%" }, className: clsx_m_default("vb-wrapper", props.className) }, props.customHeader, content, props.customFooter, /* @__PURE__ */ React13__default.createElement(
|
|
7662
7674
|
Modal,
|
|
7663
7675
|
{
|
|
@@ -7740,14 +7752,14 @@ function VizbuilderView(props) {
|
|
|
7740
7752
|
data: (data == null ? void 0 : data.data) || [],
|
|
7741
7753
|
locale: params.locale || "en"
|
|
7742
7754
|
};
|
|
7743
|
-
return !query.isLoading && /* @__PURE__ */ React13__default.createElement(
|
|
7755
|
+
return !query.isLoading && /* @__PURE__ */ React13__default.createElement(React13__default.Fragment, null, /* @__PURE__ */ React13__default.createElement(
|
|
7744
7756
|
Vizbuilder,
|
|
7745
7757
|
{
|
|
7746
7758
|
datasets: dataset,
|
|
7747
7759
|
chartLimits: CHART_LIMITS,
|
|
7748
7760
|
downloadFormats: DOWNLOAD_FORMATS
|
|
7749
7761
|
}
|
|
7750
|
-
);
|
|
7762
|
+
));
|
|
7751
7763
|
}
|
|
7752
7764
|
|
|
7753
7765
|
// src/components/RawResponseView.tsx
|