@civicactions/cmsds-open-data-components 4.1.7-alpha.1 → 4.1.7-alpha.3
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 +12 -48
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +0 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1450,10 +1450,11 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
1450
1450
|
const { rootUrl: rootUrl, enableSort: enableSort = true, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 10, defaultSort: defaultSort = {
|
|
1451
1451
|
defaultSort: 'modified',
|
|
1452
1452
|
defaultOrder: 'desc'
|
|
1453
|
-
}, pageTitle: pageTitle = 'Dataset Explorer', categoriesTitle: categoriesTitle = 'Categories', filterTitle: filterTitle = 'Tags', showLargeFileWarning: showLargeFileWarning = false, largeFileThemes: largeFileThemes, introText: introText = '', showDownloadIcon: showDownloadIcon = false, altMobileSearchButton: altMobileSearchButton, dataDictionaryLinks: dataDictionaryLinks = false, showDateDetails: showDateDetails = false, updateDateMonthYearOnly: updateDateMonthYearOnly = false, showTopics: showTopics = false, topicSlugFunction: topicSlugFunction, children: children } = props;
|
|
1453
|
+
}, pageTitle: pageTitle = 'Dataset Explorer', categoriesTitle: categoriesTitle = 'Categories', filterTitle: filterTitle = 'Tags', showLargeFileWarning: showLargeFileWarning = false, largeFileThemes: largeFileThemes, introText: introText = '', showDownloadIcon: showDownloadIcon = false, altMobileSearchButton: altMobileSearchButton, dataDictionaryLinks: dataDictionaryLinks = false, showDateDetails: showDateDetails = false, updateDateMonthYearOnly: updateDateMonthYearOnly = false, showTopics: showTopics = false, topicSlugFunction: topicSlugFunction, analytics: analytics = false, onAnalyticsEvent: onAnalyticsEvent = ()=>{}, children: children } = props;
|
|
1454
1454
|
const { ACA: ACA } = (0, $hgUW1$useContext)((0, $844981eac9b63865$export$eccc29c8d0ff408));
|
|
1455
1455
|
const [searchParams] = (0, $hgUW1$useSearchParams)();
|
|
1456
1456
|
const navigate = (0, $hgUW1$useNavigate)();
|
|
1457
|
+
const location = (0, $hgUW1$useLocation)();
|
|
1457
1458
|
// Derive all search state from URL params
|
|
1458
1459
|
const selectedFacets = (0, $hgUW1$useMemo)(()=>{
|
|
1459
1460
|
const parsed = (0, $hgUW1$qs).parse(searchParams.toString());
|
|
@@ -1601,6 +1602,12 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
1601
1602
|
noResults,
|
|
1602
1603
|
currentResultNumbers
|
|
1603
1604
|
]);
|
|
1605
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
1606
|
+
if (analytics && location.search) onAnalyticsEvent(location);
|
|
1607
|
+
}, [
|
|
1608
|
+
analytics,
|
|
1609
|
+
location.search
|
|
1610
|
+
]);
|
|
1604
1611
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
1605
1612
|
children: [
|
|
1606
1613
|
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $5723016a5461c1ca$export$2e2bcd8739ae039), {
|
|
@@ -3474,18 +3481,7 @@ const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, showCopy
|
|
|
3474
3481
|
}, {
|
|
3475
3482
|
encode: true
|
|
3476
3483
|
})}&format=csv`;
|
|
3477
|
-
|
|
3478
|
-
400: {
|
|
3479
|
-
title: 'Data unavailable',
|
|
3480
|
-
message: 'This data is not available for preview at this time. Please try again later.'
|
|
3481
|
-
},
|
|
3482
|
-
500: {
|
|
3483
|
-
title: 'Something went wrong',
|
|
3484
|
-
message: 'Something went wrong on our end. Please try again later.'
|
|
3485
|
-
}
|
|
3486
|
-
};
|
|
3487
|
-
// Data loaded successfully
|
|
3488
|
-
if (!resource.error && Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length) return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
3484
|
+
if (Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length) return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
3489
3485
|
children: [
|
|
3490
3486
|
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3491
3487
|
className: isModal ? 'dkan-datatable-fullscreen-mode' : '',
|
|
@@ -3536,28 +3532,7 @@ const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, showCopy
|
|
|
3536
3532
|
})
|
|
3537
3533
|
]
|
|
3538
3534
|
});
|
|
3539
|
-
else
|
|
3540
|
-
const resourceErrorStatus = resource.error.status in useDatastoreErrorMessages ? resource.error.status : 500;
|
|
3541
|
-
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3542
|
-
children: [
|
|
3543
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
3544
|
-
className: "ds-text-heading--lg ds-u-margin--0 ds-u-color--primary",
|
|
3545
|
-
children: useDatastoreErrorMessages[resourceErrorStatus].title
|
|
3546
|
-
}),
|
|
3547
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
3548
|
-
className: "ds-u-padding-bottom--2 ds-u-margin-bottom--7",
|
|
3549
|
-
children: useDatastoreErrorMessages[resourceErrorStatus].message
|
|
3550
|
-
}),
|
|
3551
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
3552
|
-
href: "/",
|
|
3553
|
-
variation: "solid",
|
|
3554
|
-
className: "",
|
|
3555
|
-
children: "Go to home"
|
|
3556
|
-
})
|
|
3557
|
-
]
|
|
3558
|
-
});
|
|
3559
|
-
// Data loading
|
|
3560
|
-
} else return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
3535
|
+
else return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
3561
3536
|
"aria-valuetext": "Dataset loading",
|
|
3562
3537
|
role: "status",
|
|
3563
3538
|
className: "ds-u-margin--3"
|
|
@@ -6066,23 +6041,13 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
6066
6041
|
}
|
|
6067
6042
|
// Change whether distribution API or dataset API is used based on option
|
|
6068
6043
|
const queryID = useDatasetAPI && datasetID ? `${datasetID}/0` : id;
|
|
6069
|
-
async function fetchJson(url) {
|
|
6070
|
-
const res = await fetch(url);
|
|
6071
|
-
const body = await res.json().catch(()=>({}));
|
|
6072
|
-
if (!res.ok) {
|
|
6073
|
-
const err = new Error(body.message || body.error || res.statusText);
|
|
6074
|
-
err.status = res.status;
|
|
6075
|
-
throw err;
|
|
6076
|
-
}
|
|
6077
|
-
return body;
|
|
6078
|
-
}
|
|
6079
6044
|
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
6080
6045
|
queryKey: [
|
|
6081
6046
|
"datastore" + id + paramsString
|
|
6082
6047
|
],
|
|
6083
6048
|
queryFn: ()=>{
|
|
6084
6049
|
setCount(null);
|
|
6085
|
-
return
|
|
6050
|
+
return fetch(`${rootUrl}/datastore/query/${queryID}?${paramsString}`).then((res)=>res.json());
|
|
6086
6051
|
},
|
|
6087
6052
|
enabled: enabled
|
|
6088
6053
|
});
|
|
@@ -6096,7 +6061,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
6096
6061
|
count: true,
|
|
6097
6062
|
schema: true
|
|
6098
6063
|
};
|
|
6099
|
-
return
|
|
6064
|
+
return fetch(`${rootUrl}/datastore/query/${queryID}?${(0, $hgUW1$qs).stringify((0, $6d5c0212e738499b$export$34e95918366a058e)(unfilteredParams, ACA))}`).then((res)=>res.json());
|
|
6100
6065
|
}
|
|
6101
6066
|
});
|
|
6102
6067
|
(0, $hgUW1$useEffect)(()=>{
|
|
@@ -6119,7 +6084,6 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
6119
6084
|
]);
|
|
6120
6085
|
return {
|
|
6121
6086
|
loading: enabled ? isPending : false,
|
|
6122
|
-
error: error,
|
|
6123
6087
|
values: values,
|
|
6124
6088
|
count: count,
|
|
6125
6089
|
columns: columns,
|