@civicactions/cmsds-open-data-components 3.0.0-alpha.17 → 3.0.0-alpha.19
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 +192 -79
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +1 -20
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -3
package/dist/main.js
CHANGED
|
@@ -7,8 +7,8 @@ import {NavLink as $hgUW1$NavLink, useLocation as $hgUW1$useLocation, useSearchP
|
|
|
7
7
|
import $hgUW1$qs from "qs";
|
|
8
8
|
import $hgUW1$swaggeruireact from "swagger-ui-react";
|
|
9
9
|
import "swagger-ui-react/swagger-ui.css";
|
|
10
|
-
import {useQuery as $hgUW1$useQuery, QueryClient as $hgUW1$QueryClient, QueryClientProvider as $hgUW1$QueryClientProvider} from "@tanstack/react-query";
|
|
11
10
|
import $hgUW1$axios from "axios";
|
|
11
|
+
import {useQuery as $hgUW1$useQuery, QueryClient as $hgUW1$QueryClient, QueryClientProvider as $hgUW1$QueryClientProvider} from "@tanstack/react-query";
|
|
12
12
|
import $hgUW1$dompurify from "dompurify";
|
|
13
13
|
import $hgUW1$reacttexttruncate from "react-text-truncate";
|
|
14
14
|
import {useMediaQuery as $hgUW1$useMediaQuery} from "react-responsive";
|
|
@@ -251,6 +251,7 @@ var $026cb986f9fea2b1$export$2e2bcd8739ae039 = $026cb986f9fea2b1$var$PageNotFoun
|
|
|
251
251
|
|
|
252
252
|
|
|
253
253
|
|
|
254
|
+
|
|
254
255
|
const $61ff88fb3f6ee2c8$var$queryClient = new (0, $hgUW1$QueryClient)();
|
|
255
256
|
const $61ff88fb3f6ee2c8$var$withQueryProvider = (WrappedComponent)=>(props)=>{
|
|
256
257
|
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$QueryClientProvider), {
|
|
@@ -458,22 +459,39 @@ const $b38839fd67928f42$var$SearchItemIcon = (props)=>{
|
|
|
458
459
|
});
|
|
459
460
|
case "data-dictionary":
|
|
460
461
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
|
|
461
|
-
width: "
|
|
462
|
+
width: "14px",
|
|
462
463
|
height: "16px",
|
|
463
|
-
viewBox: "0 0
|
|
464
|
+
viewBox: "0 0 14 16",
|
|
464
465
|
version: "1.1",
|
|
465
466
|
xmlns: "http://www.w3.org/2000/svg",
|
|
466
467
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
467
468
|
children: [
|
|
468
469
|
/*#__PURE__*/ (0, $hgUW1$jsx)("title", {
|
|
469
|
-
children: "
|
|
470
|
+
children: "Data Dictionary Icon"
|
|
470
471
|
}),
|
|
471
472
|
/*#__PURE__*/ (0, $hgUW1$jsx)("g", {
|
|
473
|
+
id: "Dev-Handoff",
|
|
472
474
|
stroke: "none",
|
|
473
475
|
strokeWidth: "1",
|
|
474
476
|
fillRule: "evenodd",
|
|
475
|
-
children: /*#__PURE__*/ (0, $hgUW1$
|
|
476
|
-
|
|
477
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("g", {
|
|
478
|
+
id: "Group-15",
|
|
479
|
+
transform: "translate(0, 0)",
|
|
480
|
+
fillRule: "nonzero",
|
|
481
|
+
children: [
|
|
482
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("path", {
|
|
483
|
+
d: "M0.0218026938,8.0971396 C0.0218026938,6.24591342 -0.0192244811,4.39368657 0.0358119731,2.54446171 C0.0728364968,1.28162525 1.07950328,0.231929969 2.34434106,0.0678212692 C2.69057039,0.022791443 3.04180304,0.00477951255 3.39003369,0.00477951255 C6.28395052,-0.000223801472 9.17786735,-0.00322578988 12.0717842,0.00578017535 C12.6811878,0.00778150096 13.2435603,0.169888875 13.6428248,0.683228893 C13.9059991,1.02145292 13.9950581,1.42171804 13.9970594,1.83299045 C14.0050647,4.76793446 14.0080667,7.70287846 13.9950581,10.6378225 C13.9920561,11.280248 13.7689083,11.8466231 13.1875232,12.2078624 C13.0464297,12.2959207 12.992394,12.4099963 12.9953959,12.5811096 C13.0054026,13.1394795 13.0064032,13.69885 12.9953959,14.2572198 C12.9913933,14.4473458 13.0364231,14.5173922 13.2425597,14.5243968 C13.6178082,14.5364047 13.8979938,14.7765638 13.9720428,15.0987772 C14.0450912,15.4129854 13.9069998,15.7482074 13.6088022,15.9013088 C13.4827187,15.9663519 13.3226127,15.9933698 13.1775166,15.9933698 C9.62516362,15.9983731 6.07181,16.0053777 2.51945705,15.9933698 C1.09851587,15.9883665 0.0708351712,15.0207255 0.0268060079,13.5997844 C-0.0202251439,12.0507583 0.00979474021,10.4987303 0.00579208899,8.94770299 C0.00579208899,8.66451541 0.00579208899,8.38032718 0.00579208899,8.0971396 C0.010795403,8.0971396 0.015798717,8.0971396 0.0218026938,8.0971396 L0.0218026938,8.0971396 Z M1.49477834,11.1421565 C1.99510974,11.1071333 2.44740933,11.0490949 2.90070958,11.0480942 C5.91970926,11.0400889 8.93870894,11.0440916 11.9577086,11.0430909 C12.4020029,11.0430909 12.5280864,10.9200094 12.5280864,10.4837204 C12.5280864,7.66585394 12.5280864,4.84698682 12.5280864,2.02912036 C12.5280864,1.58382542 12.4430301,1.49976974 12.0057404,1.49976974 C9.7952763,1.49976974 7.58581283,1.49976974 5.37534869,1.49976974 C4.50777404,1.49976974 3.64019939,1.4927651 2.7736254,1.50277173 C2.01712432,1.51177769 1.47576575,2.0711482 1.47576575,2.82664862 C1.47576575,5.50342162 1.47576575,8.17919395 1.47576575,10.855967 C1.47576575,10.9610365 1.48877436,11.0661061 1.49377768,11.1421565 L1.49477834,11.1421565 Z M6.8923535,14.5153908 C8.3263033,14.5153908 9.7602531,14.5093869 11.1932022,14.5203941 C11.4393653,14.5223955 11.5334276,14.467359 11.5224203,14.2041847 C11.5014064,13.7388765 11.5044084,13.2705663 11.5224203,12.8042574 C11.5314263,12.5630977 11.4553759,12.4960533 11.2132155,12.4960533 C8.37933843,12.5040586 5.54446071,12.5010566 2.71058365,12.5020573 C2.5935061,12.5020573 2.47642855,12.4990553 2.36135233,12.5140652 C1.64988108,12.6031242 1.26662722,13.4186644 1.63387047,14.0360733 C1.86102093,14.4173259 2.22426152,14.5083862 2.61652134,14.5113882 C4.04146518,14.5203941 5.46740967,14.5153908 6.8923535,14.5153908 L6.8923535,14.5153908 Z",
|
|
484
|
+
id: "Shape"
|
|
485
|
+
}),
|
|
486
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("path", {
|
|
487
|
+
d: "M7.50976245,7.49574126 C6.62717786,7.49574126 5.7435926,7.49774259 4.86100801,7.49574126 C4.36167727,7.49373993 4.05747578,7.22956495 4.03045788,6.787272 C4.00243933,6.33597307 4.34366534,6.01476031 4.87101464,6.01275899 C5.95373179,6.00775567 7.03644895,6.01175832 8.1191661,6.01175832 C8.79361283,6.01175832 9.46805956,6.00675501 10.143507,6.01375965 C10.7519099,6.01976362 11.0981393,6.45305062 10.9360319,6.99140721 C10.8429703,7.30261334 10.55578,7.4947406 10.1585169,7.49674192 C9.2759323,7.50074457 8.39234705,7.49774259 7.50976245,7.49774259 L7.50976245,7.49574126 Z",
|
|
488
|
+
id: "Path"
|
|
489
|
+
}),
|
|
490
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("path", {
|
|
491
|
+
d: "M7.50776113,5.00108889 C6.61617057,5.00108889 5.72458001,5.0060922 4.83298945,4.99908757 C4.25360569,4.99508491 3.90237305,4.53177804 4.07248572,4.01643669 C4.1565414,3.76226834 4.33365871,3.61517091 4.5868264,3.55913379 C4.6999013,3.53411722 4.81797951,3.52611192 4.9340564,3.52611192 C6.6501931,3.52411059 8.36733048,3.52411059 10.0834672,3.52611192 C10.5577814,3.52611192 10.8299616,3.69022062 10.9340306,4.03044597 C11.090134,4.53778201 10.7439046,4.99408425 10.1825328,4.99908757 C9.29094224,5.00709287 8.39935169,5.00108889 7.50776113,5.00108889 L7.50776113,5.00108889 Z",
|
|
492
|
+
id: "Path"
|
|
493
|
+
})
|
|
494
|
+
]
|
|
477
495
|
})
|
|
478
496
|
})
|
|
479
497
|
]
|
|
@@ -816,7 +834,6 @@ async function $eff7d34c30f5a0fc$export$2d2256cb46e92ff7(rootUrl, options, addit
|
|
|
816
834
|
|
|
817
835
|
|
|
818
836
|
|
|
819
|
-
|
|
820
837
|
const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
821
838
|
const { rootUrl: rootUrl , surveyLink: surveyLink , additionalParams: additionalParams , enableSort: enableSort , defaultSort: defaultSort , pageTitle: pageTitle , filterTitle: filterTitle , showLargeFileWarning: showLargeFileWarning , largeFileThemes: largeFileThemes , introText: introText , showDownloadIcon: showDownloadIcon } = props;
|
|
822
839
|
const sortOptions = [
|
|
@@ -964,13 +981,18 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
964
981
|
["page-size"]: pageSize !== 10 ? pageSize : undefined,
|
|
965
982
|
...additionalParams
|
|
966
983
|
};
|
|
967
|
-
const { data: data ,
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
984
|
+
const { data: data , isLoading: isLoading , error: error } = (0, $hgUW1$useQuery)({
|
|
985
|
+
queryKey: [
|
|
986
|
+
"datasets",
|
|
987
|
+
params
|
|
988
|
+
],
|
|
989
|
+
queryFn: ()=>{
|
|
990
|
+
return (0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify(params, {
|
|
991
|
+
arrayFormat: "comma",
|
|
992
|
+
encode: false
|
|
993
|
+
})}`);
|
|
994
|
+
}
|
|
995
|
+
});
|
|
974
996
|
if (data && data.data.total && totalItems != data.data.total) setTotalItems(data.data.total);
|
|
975
997
|
const facets = data && data.data.facets ? (0, $eff7d34c30f5a0fc$export$959638e8dca60ce6)(data ? data.data.facets : []) : {
|
|
976
998
|
theme: null,
|
|
@@ -1057,7 +1079,7 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
1057
1079
|
}),
|
|
1058
1080
|
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
1059
1081
|
className: "ds-l-col--12 ds-l-sm-col--8",
|
|
1060
|
-
children:
|
|
1082
|
+
children: isLoading ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
1061
1083
|
className: "ds-u-valign--middle",
|
|
1062
1084
|
"aria-valuetext": "Dataset Search loading",
|
|
1063
1085
|
role: "status"
|
|
@@ -1203,6 +1225,8 @@ var $e873081a6e8f024e$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
|
|
|
1203
1225
|
|
|
1204
1226
|
|
|
1205
1227
|
|
|
1228
|
+
|
|
1229
|
+
|
|
1206
1230
|
const $b4aa9c66f2e86959$var$useMetastoreDataset = (datasetId, rootAPIUrl, additionalParams = {})=>{
|
|
1207
1231
|
const [dataset, setDataset] = (0, $hgUW1$useState)({
|
|
1208
1232
|
title: "",
|
|
@@ -2558,7 +2582,6 @@ var $5644ebd2c3dbfd7b$export$2e2bcd8739ae039 = $5644ebd2c3dbfd7b$var$DatasetAddi
|
|
|
2558
2582
|
|
|
2559
2583
|
|
|
2560
2584
|
|
|
2561
|
-
|
|
2562
2585
|
const $0958733ee130fc44$var$ResourceInformation = ({ resource: resource })=>{
|
|
2563
2586
|
const { count: count , columns: columns } = resource;
|
|
2564
2587
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
@@ -2607,12 +2630,25 @@ const $0958733ee130fc44$var$ResourceInformation = ({ resource: resource })=>{
|
|
|
2607
2630
|
var $0958733ee130fc44$export$2e2bcd8739ae039 = $0958733ee130fc44$var$ResourceInformation;
|
|
2608
2631
|
|
|
2609
2632
|
|
|
2610
|
-
const $7357cc0f79f9c514$var$Resource = ({
|
|
2633
|
+
const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions , resource: resource , title: title })=>{
|
|
2634
|
+
function getFormatType(dist) {
|
|
2635
|
+
if (dist.data.format) return dist.data.format.toLowerCase();
|
|
2636
|
+
if (dist.data.mediaType) {
|
|
2637
|
+
const mediaType = dist.data.mediaType.split("/");
|
|
2638
|
+
if (mediaType.length && mediaType[1]) return mediaType[1].toLowerCase();
|
|
2639
|
+
}
|
|
2640
|
+
if (dist.data["%Ref:downloadURL"].length && dist.data["%Ref:downloadURL"][0].data) {
|
|
2641
|
+
if (dist.data["%Ref:downloadURL"][0].data.mimeType) {
|
|
2642
|
+
const mimeType = dist.data["%Ref:downloadURL"][0].data.mimeType.split("/");
|
|
2643
|
+
if (mimeType.length && mimeType[1]) return mimeType[1].toLowerCase();
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
return "";
|
|
2647
|
+
}
|
|
2611
2648
|
const sm = (0, $hgUW1$useMediaQuery)({
|
|
2612
2649
|
minWidth: 0,
|
|
2613
2650
|
maxWidth: 767
|
|
2614
2651
|
});
|
|
2615
|
-
const fileIcon = "fa-file-" + fileFormat.toLowerCase();
|
|
2616
2652
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2617
2653
|
className: "ds-u-display--flex ds-u-flex-wrap--wrap",
|
|
2618
2654
|
children: [
|
|
@@ -2620,35 +2656,46 @@ const $7357cc0f79f9c514$var$Resource = ({ distribution: distribution , resource:
|
|
|
2620
2656
|
className: "ds-l-col--12 ds-u-padding-left--0 ds-text-heading--2xl",
|
|
2621
2657
|
children: "Resources"
|
|
2622
2658
|
}),
|
|
2623
|
-
/*#__PURE__*/ (0, $hgUW1$
|
|
2624
|
-
className: "ds-
|
|
2625
|
-
children:
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2659
|
+
distributions.length && /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
2660
|
+
className: "ds-c-list ds-c-list--bare",
|
|
2661
|
+
children: distributions.map((dist)=>{
|
|
2662
|
+
const fileFormat = getFormatType(dist);
|
|
2663
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
|
|
2664
|
+
className: "ds-u-display--flex ds-u-flex-wrap--wrap",
|
|
2665
|
+
children: [
|
|
2666
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2667
|
+
className: "ds-u-font-weight--bold ds-u-font-size--lg ds-l-col--12 ds-l-md-col--6 ds-u-padding-left--0",
|
|
2668
|
+
children: [
|
|
2669
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
2670
|
+
className: "fa ds-u-color--primary ds-u-padding-right--1 fa-file-" + (fileFormat == "xlsx" ? "excel" : fileFormat)
|
|
2671
|
+
}),
|
|
2672
|
+
title + " (" + fileFormat.toUpperCase() + ")"
|
|
2673
|
+
]
|
|
2674
|
+
}),
|
|
2675
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2676
|
+
className: "ds-l-col--12 ds-l-md-col--6 ds-u-text-align--center ds-u-md-text-align--right ds-u-margin-top--2 ds-u-md-margin-top--0",
|
|
2677
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
|
|
2678
|
+
href: dist.data.downloadURL,
|
|
2679
|
+
style: {
|
|
2680
|
+
order: sm ? "1" : "0",
|
|
2681
|
+
width: sm ? "100%" : "auto"
|
|
2682
|
+
},
|
|
2683
|
+
"aria-label": "Download " + title + " " + fileFormat,
|
|
2684
|
+
className: "ds-c-button",
|
|
2685
|
+
children: [
|
|
2686
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
2687
|
+
className: "fa fa-file-download ds-u-color--primary ds-u-padding-right--1"
|
|
2688
|
+
}),
|
|
2689
|
+
"Download"
|
|
2690
|
+
]
|
|
2691
|
+
})
|
|
2692
|
+
}),
|
|
2693
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $0958733ee130fc44$export$2e2bcd8739ae039), {
|
|
2694
|
+
resource: resource
|
|
2695
|
+
})
|
|
2696
|
+
]
|
|
2697
|
+
}, dist.identifier);
|
|
2648
2698
|
})
|
|
2649
|
-
}) : "",
|
|
2650
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $0958733ee130fc44$export$2e2bcd8739ae039), {
|
|
2651
|
-
resource: resource
|
|
2652
2699
|
})
|
|
2653
2700
|
]
|
|
2654
2701
|
});
|
|
@@ -2656,37 +2703,18 @@ const $7357cc0f79f9c514$var$Resource = ({ distribution: distribution , resource:
|
|
|
2656
2703
|
var $7357cc0f79f9c514$export$2e2bcd8739ae039 = $7357cc0f79f9c514$var$Resource;
|
|
2657
2704
|
|
|
2658
2705
|
|
|
2659
|
-
const $364dc44850cd8f7f$var$DatasetOverview = ({ dataset: dataset , resource: resource ,
|
|
2706
|
+
const $364dc44850cd8f7f$var$DatasetOverview = ({ dataset: dataset , resource: resource , distributions: distributions , metadataMapping: metadataMapping })=>{
|
|
2660
2707
|
const md = (0, $hgUW1$useMediaQuery)({
|
|
2661
2708
|
minWidth: 0,
|
|
2662
2709
|
maxWidth: 768
|
|
2663
2710
|
});
|
|
2664
|
-
const [fileFormat, setFileFormat] = (0, $hgUW1$useState)("");
|
|
2665
|
-
(0, $hgUW1$useEffect)(()=>{
|
|
2666
|
-
if (distribution.identifier) {
|
|
2667
|
-
let localFileFormat = "";
|
|
2668
|
-
if (distribution.data.format) localFileFormat = distribution.data.format.toUpperCase();
|
|
2669
|
-
else if (distribution.data.mediaType) {
|
|
2670
|
-
const mediaType = distribution.data.mediaType.split("/");
|
|
2671
|
-
if (mediaType.length && mediaType[1]) localFileFormat = mediaType[1].toUpperCase();
|
|
2672
|
-
}
|
|
2673
|
-
setFileFormat(localFileFormat);
|
|
2674
|
-
if (localFileFormat === "CSV") {
|
|
2675
|
-
resource.setResource(distribution.identifier);
|
|
2676
|
-
resource.setManual(false);
|
|
2677
|
-
}
|
|
2678
|
-
}
|
|
2679
|
-
}, [
|
|
2680
|
-
distribution
|
|
2681
|
-
]);
|
|
2682
2711
|
const rows = (0, $5644ebd2c3dbfd7b$export$eea3a12df15499ca)(metadataMapping, dataset);
|
|
2683
2712
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
2684
2713
|
children: [
|
|
2685
2714
|
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $7357cc0f79f9c514$export$2e2bcd8739ae039), {
|
|
2686
|
-
|
|
2715
|
+
distributions: distributions,
|
|
2687
2716
|
resource: resource,
|
|
2688
|
-
title: dataset.title
|
|
2689
|
-
fileFormat: fileFormat
|
|
2717
|
+
title: dataset.title
|
|
2690
2718
|
}),
|
|
2691
2719
|
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2692
2720
|
className: "dc-c-additional-info-table ds-u-margin-bottom--6 ds-u-padding-left--0 ds-l-lg-col--7 ds-l-md-col--9 ds-l-col--12",
|
|
@@ -2741,7 +2769,7 @@ const $789279954d8eff7f$var$ApiDocumentation = ({ endpoint: endpoint })=>{
|
|
|
2741
2769
|
var $789279954d8eff7f$export$2e2bcd8739ae039 = $789279954d8eff7f$var$ApiDocumentation;
|
|
2742
2770
|
|
|
2743
2771
|
|
|
2744
|
-
const $cf6eaefd6b928de3$var$DatasetAPI = ({ id: id , rootUrl: rootUrl })=>{
|
|
2772
|
+
const $cf6eaefd6b928de3$var$DatasetAPI = ({ id: id , rootUrl: rootUrl , apiUrl: apiUrl })=>{
|
|
2745
2773
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
2746
2774
|
children: [
|
|
2747
2775
|
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
@@ -2762,7 +2790,7 @@ const $cf6eaefd6b928de3$var$DatasetAPI = ({ id: id , rootUrl: rootUrl })=>{
|
|
|
2762
2790
|
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2763
2791
|
className: "ds-l-col--12 ds-l-md-col--3 ds-u-font-weight--bold ds-u-margin-top--2 ds-u-padding-left--0 ds-u-md-padding-left--2",
|
|
2764
2792
|
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
|
|
2765
|
-
href:
|
|
2793
|
+
href: apiUrl,
|
|
2766
2794
|
children: [
|
|
2767
2795
|
"View API",
|
|
2768
2796
|
" ",
|
|
@@ -2792,7 +2820,80 @@ var $cf6eaefd6b928de3$export$2e2bcd8739ae039 = $cf6eaefd6b928de3$var$DatasetAPI;
|
|
|
2792
2820
|
|
|
2793
2821
|
|
|
2794
2822
|
|
|
2795
|
-
|
|
2823
|
+
|
|
2824
|
+
|
|
2825
|
+
|
|
2826
|
+
const $6012b86ffcaf3f71$var$DataDictionary = ({ datasetDictionary: datasetDictionary , title: title })=>{
|
|
2827
|
+
const tableColumns = [
|
|
2828
|
+
{
|
|
2829
|
+
colName: "name",
|
|
2830
|
+
UIName: "Name"
|
|
2831
|
+
},
|
|
2832
|
+
{
|
|
2833
|
+
colName: "title",
|
|
2834
|
+
UIName: "Title"
|
|
2835
|
+
},
|
|
2836
|
+
{
|
|
2837
|
+
colName: "type",
|
|
2838
|
+
UIName: "Type"
|
|
2839
|
+
},
|
|
2840
|
+
{
|
|
2841
|
+
colName: "format",
|
|
2842
|
+
UIName: "Format"
|
|
2843
|
+
}
|
|
2844
|
+
];
|
|
2845
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
2846
|
+
children: [
|
|
2847
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
2848
|
+
className: "ds-text-heading--2xl ds-u-margin-y--3",
|
|
2849
|
+
children: title
|
|
2850
|
+
}),
|
|
2851
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
|
|
2852
|
+
children: [
|
|
2853
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableHead), {
|
|
2854
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableRow), {
|
|
2855
|
+
children: tableColumns.map((col)=>{
|
|
2856
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
2857
|
+
children: col.UIName
|
|
2858
|
+
});
|
|
2859
|
+
})
|
|
2860
|
+
})
|
|
2861
|
+
}),
|
|
2862
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
|
|
2863
|
+
children: datasetDictionary.map((row)=>{
|
|
2864
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableRow), {
|
|
2865
|
+
children: tableColumns.map((col)=>{
|
|
2866
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
2867
|
+
children: row[col.colName]
|
|
2868
|
+
});
|
|
2869
|
+
})
|
|
2870
|
+
});
|
|
2871
|
+
})
|
|
2872
|
+
})
|
|
2873
|
+
]
|
|
2874
|
+
})
|
|
2875
|
+
]
|
|
2876
|
+
});
|
|
2877
|
+
};
|
|
2878
|
+
var $6012b86ffcaf3f71$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($6012b86ffcaf3f71$var$DataDictionary);
|
|
2879
|
+
|
|
2880
|
+
|
|
2881
|
+
|
|
2882
|
+
const $a0f13962e513caa1$var$getSiteWideDataDictionary = (rootUrl, dataDictionaryUrl)=>{
|
|
2883
|
+
const { data: data , isLoading: isLoading , error: error } = (0, $hgUW1$useQuery)({
|
|
2884
|
+
queryKey: [
|
|
2885
|
+
"dictionary"
|
|
2886
|
+
],
|
|
2887
|
+
queryFn: ()=>{
|
|
2888
|
+
return fetch(rootUrl + dataDictionaryUrl).then((res)=>res.json());
|
|
2889
|
+
}
|
|
2890
|
+
});
|
|
2891
|
+
return {
|
|
2892
|
+
siteWideDataDictionary: data,
|
|
2893
|
+
dataDictionaryLoading: isLoading
|
|
2894
|
+
};
|
|
2895
|
+
};
|
|
2896
|
+
const $a0f13962e513caa1$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalParams: additionalParams , customColumns: customColumns , setDatasetTitle: setDatasetTitle , customMetadataMapping: customMetadataMapping , apiPageUrl: apiPageUrl = "/api" , dataDictionaryUrl: dataDictionaryUrl })=>{
|
|
2796
2897
|
const options = location.search ? {
|
|
2797
2898
|
...(0, $hgUW1$qs).parse(location.search, {
|
|
2798
2899
|
ignoreQueryPrefix: true
|
|
@@ -2807,13 +2908,23 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalP
|
|
|
2807
2908
|
...customMetadataMapping
|
|
2808
2909
|
};
|
|
2809
2910
|
let distribution = {};
|
|
2810
|
-
let
|
|
2811
|
-
if (
|
|
2911
|
+
let distributions = dataset.distribution ? dataset.distribution : [];
|
|
2912
|
+
if (distributions.length) distribution = distributions[0];
|
|
2812
2913
|
const resource = (0, $1d3d480a9cfaabe0$export$2e2bcd8739ae039)("", rootUrl, {
|
|
2813
2914
|
...options,
|
|
2814
2915
|
limit: 25,
|
|
2815
2916
|
manual: true
|
|
2816
2917
|
}, additionalParams);
|
|
2918
|
+
const { siteWideDataDictionary: siteWideDataDictionary } = dataDictionaryUrl ? $a0f13962e513caa1$var$getSiteWideDataDictionary(rootUrl, dataDictionaryUrl) : {
|
|
2919
|
+
siteWideDataDictionary: null
|
|
2920
|
+
};
|
|
2921
|
+
console.log(siteWideDataDictionary);
|
|
2922
|
+
// compare schema fields with siteWideDataDictionary to display commonalities for now
|
|
2923
|
+
// until dataset level data dictionaries are implemented
|
|
2924
|
+
const datasetDictionary = siteWideDataDictionary && resource && resource.schema[distribution.identifier] ? siteWideDataDictionary.data.fields.filter((field)=>{
|
|
2925
|
+
return Object.keys(resource.schema[distribution.identifier].fields).indexOf(field.name) !== -1;
|
|
2926
|
+
}) : null;
|
|
2927
|
+
console.log(datasetDictionary);
|
|
2817
2928
|
(0, $hgUW1$useEffect)(()=>{
|
|
2818
2929
|
if (distribution.identifier) {
|
|
2819
2930
|
resource.setResource(distribution.identifier);
|
|
@@ -2927,11 +3038,11 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalP
|
|
|
2927
3038
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $364dc44850cd8f7f$export$2e2bcd8739ae039), {
|
|
2928
3039
|
resource: resource,
|
|
2929
3040
|
dataset: dataset,
|
|
2930
|
-
|
|
3041
|
+
distributions: distributions,
|
|
2931
3042
|
metadataMapping: metadataMapping
|
|
2932
3043
|
})
|
|
2933
3044
|
}),
|
|
2934
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
|
|
3045
|
+
datasetDictionary && datasetDictionary.length && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
|
|
2935
3046
|
id: "data-dictionary",
|
|
2936
3047
|
tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
2937
3048
|
children: [
|
|
@@ -2941,8 +3052,9 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalP
|
|
|
2941
3052
|
"Data Dictionary"
|
|
2942
3053
|
]
|
|
2943
3054
|
}),
|
|
2944
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)(
|
|
2945
|
-
|
|
3055
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6012b86ffcaf3f71$export$2e2bcd8739ae039), {
|
|
3056
|
+
datasetDictionary: datasetDictionary,
|
|
3057
|
+
title: "Data Dictionary"
|
|
2946
3058
|
})
|
|
2947
3059
|
}),
|
|
2948
3060
|
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
|
|
@@ -2957,7 +3069,8 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalP
|
|
|
2957
3069
|
}),
|
|
2958
3070
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf6eaefd6b928de3$export$2e2bcd8739ae039), {
|
|
2959
3071
|
id: id,
|
|
2960
|
-
rootUrl: rootUrl
|
|
3072
|
+
rootUrl: rootUrl,
|
|
3073
|
+
apiUrl: apiPageUrl
|
|
2961
3074
|
})
|
|
2962
3075
|
})
|
|
2963
3076
|
]
|
|
@@ -2972,7 +3085,7 @@ $a0f13962e513caa1$var$Dataset.propTypes = {
|
|
|
2972
3085
|
id: (0, $hgUW1$proptypes).string.isRequired,
|
|
2973
3086
|
rootUrl: (0, $hgUW1$proptypes).string.isRequired
|
|
2974
3087
|
};
|
|
2975
|
-
var $a0f13962e513caa1$export$2e2bcd8739ae039 = $a0f13962e513caa1$var$Dataset;
|
|
3088
|
+
var $a0f13962e513caa1$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($a0f13962e513caa1$var$Dataset);
|
|
2976
3089
|
|
|
2977
3090
|
|
|
2978
3091
|
|