@civicactions/cmsds-open-data-components 3.1.3-alpha.2 → 3.1.3-alpha.4
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 +14 -20
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2713,9 +2713,8 @@ const $0958733ee130fc44$var$ResourceInformation = ({ resource: resource })=>{
|
|
|
2713
2713
|
var $0958733ee130fc44$export$2e2bcd8739ae039 = $0958733ee130fc44$var$ResourceInformation;
|
|
2714
2714
|
|
|
2715
2715
|
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
function getFormatType(dist) {
|
|
2716
|
+
function $f764661366bd9e1b$export$ee48b7e0e4eb536e(dist) {
|
|
2717
|
+
if (dist && dist.data) {
|
|
2719
2718
|
if (dist.data.format) return dist.data.format.toLowerCase();
|
|
2720
2719
|
if (dist.data.mediaType) {
|
|
2721
2720
|
const mediaType = dist.data.mediaType.split("/");
|
|
@@ -2727,8 +2726,13 @@ const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource
|
|
|
2727
2726
|
if (mimeType.length && mimeType[1]) return mimeType[1].toLowerCase();
|
|
2728
2727
|
}
|
|
2729
2728
|
}
|
|
2730
|
-
return "";
|
|
2731
2729
|
}
|
|
2730
|
+
return "";
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
|
|
2734
|
+
|
|
2735
|
+
const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource: resource, title: title })=>{
|
|
2732
2736
|
const sm = (0, $hgUW1$useMediaQuery)({
|
|
2733
2737
|
minWidth: 0,
|
|
2734
2738
|
maxWidth: 767
|
|
@@ -2743,7 +2747,7 @@ const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource
|
|
|
2743
2747
|
distributions.length ? /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
2744
2748
|
className: "ds-c-list ds-c-list--bare dc-c-resource-full-width",
|
|
2745
2749
|
children: distributions.map((dist)=>{
|
|
2746
|
-
const fileFormat =
|
|
2750
|
+
const fileFormat = (0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(dist);
|
|
2747
2751
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
|
|
2748
2752
|
className: `ds-u-display--flex ds-u-flex-wrap--wrap ${fileFormat !== "csv" && "ds-u-margin-bottom--2"}`,
|
|
2749
2753
|
children: [
|
|
@@ -3002,6 +3006,7 @@ var $6012b86ffcaf3f71$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
|
|
|
3002
3006
|
|
|
3003
3007
|
|
|
3004
3008
|
|
|
3009
|
+
|
|
3005
3010
|
const $a0f13962e513caa1$var$getSiteWideDataDictionary = (rootUrl, dataDictionaryUrl)=>{
|
|
3006
3011
|
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
3007
3012
|
queryKey: [
|
|
@@ -3046,20 +3051,9 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3046
3051
|
const datasetDictionary = siteWideDataDictionary && resource && resource.schema[distribution.identifier] ? siteWideDataDictionary.data.fields.filter((field)=>{
|
|
3047
3052
|
return Object.keys(resource.schema[distribution.identifier].fields).indexOf(field.name) !== -1;
|
|
3048
3053
|
}) : null;
|
|
3049
|
-
const getlocalFileFormat = ()=>{
|
|
3050
|
-
let localFileFormat = "";
|
|
3051
|
-
if (distribution.identifier) {
|
|
3052
|
-
if (distribution.data.format) localFileFormat = distribution.data.format.toUpperCase();
|
|
3053
|
-
else if (distribution.data.mediaType) {
|
|
3054
|
-
const mediaType = distribution.data.mediaType.split("/");
|
|
3055
|
-
if (mediaType.length && mediaType[1]) localFileFormat = mediaType[1].toUpperCase();
|
|
3056
|
-
}
|
|
3057
|
-
}
|
|
3058
|
-
return localFileFormat;
|
|
3059
|
-
};
|
|
3060
3054
|
(0, $hgUW1$useEffect)(()=>{
|
|
3061
|
-
const localFileFormat =
|
|
3062
|
-
if (localFileFormat === "
|
|
3055
|
+
const localFileFormat = (0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution);
|
|
3056
|
+
if (localFileFormat === "csv") resource.setResource(distribution.identifier);
|
|
3063
3057
|
}, [
|
|
3064
3058
|
distribution
|
|
3065
3059
|
]);
|
|
@@ -3104,7 +3098,7 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3104
3098
|
// The below code manages the selected tab in the Design System tab group manually to ensure we can still use the
|
|
3105
3099
|
// Data Table tab as the default since it no longer exists on initial render (By default, Overview will appear as default)
|
|
3106
3100
|
const getDefaultTab = ()=>{
|
|
3107
|
-
return
|
|
3101
|
+
return (0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution) === "csv" ? "data-table" : "overview";
|
|
3108
3102
|
};
|
|
3109
3103
|
const [selectedTab, setSelectedTab] = (0, $hgUW1$useState)(window.location.hash.substring(1) ? window.location.hash.substring(1) : getDefaultTab());
|
|
3110
3104
|
(0, $hgUW1$useEffect)(()=>{
|
|
@@ -3165,7 +3159,7 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3165
3159
|
},
|
|
3166
3160
|
selectedId: selectedTab,
|
|
3167
3161
|
children: [
|
|
3168
|
-
|
|
3162
|
+
(0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution) === "csv" && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
|
|
3169
3163
|
id: "data-table",
|
|
3170
3164
|
tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
3171
3165
|
className: "ds-u-color--primary",
|