@datawheel/data-explorer 1.0.13 → 1.0.15
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 +34 -30
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -560,7 +560,14 @@ function SettingsProvider(props) {
|
|
|
560
560
|
locale: locale || props.defaultLocale
|
|
561
561
|
};
|
|
562
562
|
},
|
|
563
|
-
[
|
|
563
|
+
[
|
|
564
|
+
props.formatters,
|
|
565
|
+
props.previewLimit,
|
|
566
|
+
props.toolbarConfig,
|
|
567
|
+
locale,
|
|
568
|
+
props.defaultLocale,
|
|
569
|
+
props.defaultCube
|
|
570
|
+
]
|
|
564
571
|
);
|
|
565
572
|
return /* @__PURE__ */ React13__default.createElement(TranslationProvider, { defaultLocale: props.defaultLocale, translations: props.translations }, /* @__PURE__ */ React13__default.createElement(ContextProvider, { value }, props.children));
|
|
566
573
|
}
|
|
@@ -2591,10 +2598,10 @@ var DownloadQuery = ({ data }) => {
|
|
|
2591
2598
|
};
|
|
2592
2599
|
var mimeTypes = {
|
|
2593
2600
|
csv: "text/csv",
|
|
2594
|
-
|
|
2601
|
+
jsonrecords: "application/json",
|
|
2595
2602
|
tsv: "text/tab-separated-values",
|
|
2596
|
-
|
|
2597
|
-
|
|
2603
|
+
parquet: "application/octet-stream",
|
|
2604
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
2598
2605
|
};
|
|
2599
2606
|
function useDownload(props) {
|
|
2600
2607
|
const { provider } = props;
|
|
@@ -2630,12 +2637,13 @@ function useDownload(props) {
|
|
|
2630
2637
|
}
|
|
2631
2638
|
}, [error]);
|
|
2632
2639
|
const onClick = useCallback(
|
|
2633
|
-
(evt) => {
|
|
2640
|
+
(evt, cb = () => {
|
|
2641
|
+
}) => {
|
|
2634
2642
|
evt.stopPropagation();
|
|
2635
2643
|
evt.preventDefault();
|
|
2636
|
-
return run(provider());
|
|
2644
|
+
return run(provider()).then(cb);
|
|
2637
2645
|
},
|
|
2638
|
-
[run
|
|
2646
|
+
[run]
|
|
2639
2647
|
);
|
|
2640
2648
|
return { onClick, isLoading, data: file, error };
|
|
2641
2649
|
}
|
|
@@ -2652,14 +2660,13 @@ var ItemDownload = (props) => {
|
|
|
2652
2660
|
{
|
|
2653
2661
|
...itemProps,
|
|
2654
2662
|
icon: icon(isLoading),
|
|
2655
|
-
onClick: (e) => {
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
}).catch((error) => {
|
|
2663
|
+
onClick: async (e) => {
|
|
2664
|
+
try {
|
|
2665
|
+
onClick(e, () => setOpened(false));
|
|
2666
|
+
} catch (error) {
|
|
2660
2667
|
console.error("Download error:", error);
|
|
2661
2668
|
setOpened(false);
|
|
2662
|
-
}
|
|
2669
|
+
}
|
|
2663
2670
|
}
|
|
2664
2671
|
},
|
|
2665
2672
|
/* @__PURE__ */ React13__default.createElement(Text, { fz: "sm" }, props.children)
|
|
@@ -2669,21 +2676,18 @@ function MenuOpts({ formats }) {
|
|
|
2669
2676
|
const { translate: t } = useTranslation();
|
|
2670
2677
|
const [opened, setOpened] = useState(false);
|
|
2671
2678
|
const { mutateAsync: downloadQuery } = useDownloadQuery();
|
|
2672
|
-
const buttons =
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
[formats, t]
|
|
2685
|
-
);
|
|
2686
|
-
return /* @__PURE__ */ React13__default.createElement(Menu, { shadow: "md", width: 200, opened, onClose: () => setOpened(false) }, /* @__PURE__ */ React13__default.createElement(Menu.Target, null, /* @__PURE__ */ React13__default.createElement(
|
|
2679
|
+
const buttons = formats.map((format2) => /* @__PURE__ */ React13__default.createElement(
|
|
2680
|
+
ItemDownload,
|
|
2681
|
+
{
|
|
2682
|
+
component: "a",
|
|
2683
|
+
key: format2,
|
|
2684
|
+
provider: () => downloadQuery({ format: format2 }),
|
|
2685
|
+
icon: (loading) => loading ? /* @__PURE__ */ React13__default.createElement(Loader, { size: 15 }) : /* @__PURE__ */ React13__default.createElement(IconDownload, { size: 15 }),
|
|
2686
|
+
setOpened
|
|
2687
|
+
},
|
|
2688
|
+
/* @__PURE__ */ React13__default.createElement(Text, { size: "xs" }, t(`formats.${format2}`))
|
|
2689
|
+
));
|
|
2690
|
+
return /* @__PURE__ */ React13__default.createElement(Menu, { shadow: "md", width: 200, opened }, /* @__PURE__ */ React13__default.createElement(Menu.Target, null, /* @__PURE__ */ React13__default.createElement(
|
|
2687
2691
|
ActionIcon,
|
|
2688
2692
|
{
|
|
2689
2693
|
onClick: () => setOpened((o) => !o),
|
|
@@ -6297,12 +6301,12 @@ function ExplorerComponent(props) {
|
|
|
6297
6301
|
serverConfig: props.serverConfig,
|
|
6298
6302
|
serverURL: props.serverURL,
|
|
6299
6303
|
defaultLocale,
|
|
6300
|
-
translations: props.translations
|
|
6304
|
+
translations: props.translations,
|
|
6305
|
+
defaultCube: props.defaultCube
|
|
6301
6306
|
},
|
|
6302
6307
|
/* @__PURE__ */ React13__default.createElement(AppProviders, null, /* @__PURE__ */ React13__default.createElement(ExplorerTour, { tourConfig: { ...defaultTourConfig, ...tourConfig } }, /* @__PURE__ */ React13__default.createElement(
|
|
6303
6308
|
ExplorerContent,
|
|
6304
6309
|
{
|
|
6305
|
-
defaultCube: props.defaultCube,
|
|
6306
6310
|
defaultOpenParams,
|
|
6307
6311
|
height,
|
|
6308
6312
|
panels,
|