@civicactions/cmsds-open-data-components 3.0.0-alpha.27 → 3.0.0-alpha.28

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.js CHANGED
@@ -1352,7 +1352,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
1352
1352
  else if (requireConditions) {
1353
1353
  if (conditions && conditions.length) fetchData();
1354
1354
  else {
1355
- setCount(null);
1355
+ setCount(0);
1356
1356
  setValues([]);
1357
1357
  }
1358
1358
  }
@@ -2943,8 +2943,16 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalP
2943
2943
  }) : null;
2944
2944
  (0, $hgUW1$useEffect)(()=>{
2945
2945
  if (distribution.identifier) {
2946
- resource.setResource(distribution.identifier);
2947
- resource.setManual(false);
2946
+ let localFileFormat = "";
2947
+ if (distribution.data.format) localFileFormat = distribution.data.format.toUpperCase();
2948
+ else if (distribution.data.mediaType) {
2949
+ const mediaType = distribution.data.mediaType.split("/");
2950
+ if (mediaType.length && mediaType[1]) localFileFormat = mediaType[1].toUpperCase();
2951
+ }
2952
+ if (localFileFormat === "CSV") {
2953
+ resource.setResource(distribution.identifier);
2954
+ resource.setManual(false);
2955
+ }
2948
2956
  }
2949
2957
  }, [
2950
2958
  distribution
@@ -3019,11 +3027,11 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalP
3019
3027
  className: "ds-l-row",
3020
3028
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3021
3029
  className: "ds-l-md-col--12 dc-dataset",
3022
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tabs), {
3030
+ children: distribution && distribution.data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tabs), {
3023
3031
  onChange: function noRefCheck() {},
3024
3032
  defaultSelectedId: window.location.hash.substring(1),
3025
3033
  children: [
3026
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
3034
+ distribution.data.format === "csv" && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
3027
3035
  id: "data-table",
3028
3036
  tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3029
3037
  children: [