@civicactions/cmsds-open-data-components 4.0.4 → 4.0.5-oe
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.css +3 -13
- package/dist/main.css.map +1 -1
- package/dist/main.js +164 -143
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
2
|
import {jsx as $hgUW1$jsx, jsxs as $hgUW1$jsxs, Fragment as $hgUW1$Fragment} from "react/jsx-runtime";
|
|
3
|
-
import {Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, Button as $hgUW1$Button, CloseIconThin as $hgUW1$CloseIconThin, ArrowIcon as $hgUW1$ArrowIcon, Spinner as $hgUW1$Spinner, Alert as $hgUW1$Alert, Dialog as $hgUW1$Dialog, TextField as $hgUW1$TextField, Tooltip as $hgUW1$Tooltip, TooltipIcon as $hgUW1$TooltipIcon, Choice as $hgUW1$Choice, Dropdown as $hgUW1$Dropdown, Pagination as $hgUW1$Pagination, Table as $hgUW1$Table, TableHead as $hgUW1$TableHead, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableBody as $hgUW1$TableBody, Tabs as $hgUW1$Tabs, TabPanel as $hgUW1$TabPanel,
|
|
3
|
+
import {Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, Button as $hgUW1$Button, CloseIconThin as $hgUW1$CloseIconThin, ArrowIcon as $hgUW1$ArrowIcon, Spinner as $hgUW1$Spinner, Alert as $hgUW1$Alert, Dialog as $hgUW1$Dialog, TextField as $hgUW1$TextField, Tooltip as $hgUW1$Tooltip, TooltipIcon as $hgUW1$TooltipIcon, Choice as $hgUW1$Choice, Dropdown as $hgUW1$Dropdown, Pagination as $hgUW1$Pagination, Table as $hgUW1$Table, TableHead as $hgUW1$TableHead, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableBody as $hgUW1$TableBody, Tabs as $hgUW1$Tabs, TabPanel as $hgUW1$TabPanel, Badge as $hgUW1$Badge} from "@cmsgov/design-system";
|
|
4
4
|
import $hgUW1$react, {createContext as $hgUW1$createContext, useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect, useContext as $hgUW1$useContext, useMemo as $hgUW1$useMemo, useCallback as $hgUW1$useCallback} from "react";
|
|
5
5
|
import {NavLink as $hgUW1$NavLink, Link as $hgUW1$Link, useNavigate as $hgUW1$useNavigate, useLocation as $hgUW1$useLocation, useSearchParams as $hgUW1$useSearchParams} from "react-router-dom";
|
|
6
6
|
import $hgUW1$qs from "qs";
|
|
@@ -2258,15 +2258,19 @@ function $7264a673914aa746$export$2b9377795161999(type) {
|
|
|
2258
2258
|
|
|
2259
2259
|
|
|
2260
2260
|
|
|
2261
|
-
const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: header, sortElement: sortElement, setAriaLiveFeedback: setAriaLiveFeedback })=>{
|
|
2261
|
+
const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: header, sortElement: sortElement, setAriaLiveFeedback: setAriaLiveFeedback, id: id })=>{
|
|
2262
2262
|
const [columnResizing, setColumnResizing] = (0, $hgUW1$useState)("");
|
|
2263
|
+
// Fix for JSX in Data Dictionary Title header cell
|
|
2264
|
+
const ariaLabel = header.id === "titleResizable" ? "Title" : header.column.columnDef.header;
|
|
2263
2265
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("th", {
|
|
2264
2266
|
key: header.id,
|
|
2265
2267
|
style: {
|
|
2266
2268
|
width: header.getSize()
|
|
2267
2269
|
},
|
|
2270
|
+
id: id,
|
|
2268
2271
|
title: typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "",
|
|
2269
2272
|
className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold",
|
|
2273
|
+
"aria-sort": header.column.getIsSorted() === "asc" ? "ascending" : header.column.getIsSorted() === "desc" ? "descending" : "none",
|
|
2270
2274
|
children: [
|
|
2271
2275
|
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2272
2276
|
className: "ds-u-display--flex",
|
|
@@ -2279,7 +2283,7 @@ const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: heade
|
|
|
2279
2283
|
sortElement && /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
|
|
2280
2284
|
onClick: header.column.getToggleSortingHandler(),
|
|
2281
2285
|
className: header.column.getCanSort() ? `cursor-pointer select-none ds-u-focus-visible ${sortElement(header.column.getIsSorted())}` : "",
|
|
2282
|
-
"aria-label": `${
|
|
2286
|
+
"aria-label": `${ariaLabel} sort order`
|
|
2283
2287
|
})
|
|
2284
2288
|
]
|
|
2285
2289
|
}),
|
|
@@ -2287,7 +2291,7 @@ const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: heade
|
|
|
2287
2291
|
onMouseDown: header.getResizeHandler(),
|
|
2288
2292
|
onTouchStart: header.getResizeHandler(),
|
|
2289
2293
|
className: `dc-c-resize-handle ds-u-focus-visible ${header.column.getIsResizing() || header.column.id == columnResizing ? "isResizing" : ""}`,
|
|
2290
|
-
"aria-label": `Resize ${
|
|
2294
|
+
"aria-label": `Resize ${ariaLabel} column`,
|
|
2291
2295
|
onKeyDown: (e)=>{
|
|
2292
2296
|
const columnSizingObject = table.getState().columnSizing;
|
|
2293
2297
|
switch(e.key){
|
|
@@ -2373,6 +2377,7 @@ const $23763e27eda0e8d7$var$FixedSizeTHead = ({ table: table, sortElement: sortE
|
|
|
2373
2377
|
},
|
|
2374
2378
|
title: header.column.columnDef.header,
|
|
2375
2379
|
className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold",
|
|
2380
|
+
"aria-sort": header.column.getIsSorted() === "asc" ? "ascending" : header.column.getIsSorted() === "desc" ? "descending" : "none",
|
|
2376
2381
|
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2377
2382
|
onClick: header.column.getToggleSortingHandler(),
|
|
2378
2383
|
className: "ds-u-display--flex",
|
|
@@ -4539,42 +4544,6 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
4539
4544
|
window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
|
|
4540
4545
|
}
|
|
4541
4546
|
const pageSize = defaultPageSize;
|
|
4542
|
-
(0, $hgUW1$useEffect)(()=>{
|
|
4543
|
-
const baseNumber = Number(totalItems) > 0 ? 1 : 0;
|
|
4544
|
-
const startingNumber = baseNumber + (Number(pageSize) * Number(page) - Number(pageSize));
|
|
4545
|
-
const endingNumber = Number(pageSize) * Number(page);
|
|
4546
|
-
setCurrentResultNumbers({
|
|
4547
|
-
total: Number(totalItems),
|
|
4548
|
-
startingNumber: Number(totalItems) >= startingNumber ? startingNumber : 0,
|
|
4549
|
-
endingNumber: Number(totalItems) < endingNumber ? Number(totalItems) : endingNumber
|
|
4550
|
-
});
|
|
4551
|
-
setTimeout(()=>{
|
|
4552
|
-
setAnnouncementText(`Showing ${startingNumber} to ${endingNumber} of ${totalItems} datasets`);
|
|
4553
|
-
}, 100);
|
|
4554
|
-
if (totalItems <= 0 && currentResultNumbers !== null) setNoResults(true);
|
|
4555
|
-
else setNoResults(false);
|
|
4556
|
-
}, [
|
|
4557
|
-
totalItems,
|
|
4558
|
-
pageSize,
|
|
4559
|
-
page
|
|
4560
|
-
]);
|
|
4561
|
-
(0, $hgUW1$useEffect)(()=>{
|
|
4562
|
-
if (page !== 1 && (transformedParams.fulltext !== fulltext || transformedParams.selectedFacets !== selectedFacets)) setPage(1);
|
|
4563
|
-
}, [
|
|
4564
|
-
fulltext,
|
|
4565
|
-
selectedFacets
|
|
4566
|
-
]);
|
|
4567
|
-
(0, $hgUW1$useEffect)(()=>{
|
|
4568
|
-
if (totalItems !== null && totalItems !== undefined && totalItems > 0) {
|
|
4569
|
-
var params = buildSearchParams(true);
|
|
4570
|
-
if (params !== location.search) setSearchParams(params);
|
|
4571
|
-
}
|
|
4572
|
-
}, [
|
|
4573
|
-
page,
|
|
4574
|
-
sort,
|
|
4575
|
-
sortOrder,
|
|
4576
|
-
totalItems
|
|
4577
|
-
]);
|
|
4578
4547
|
function resetFilters() {
|
|
4579
4548
|
setFullText(defaultFulltext);
|
|
4580
4549
|
setFilterText(defaultFulltext);
|
|
@@ -4622,6 +4591,50 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
4622
4591
|
theme: null,
|
|
4623
4592
|
keyword: null
|
|
4624
4593
|
};
|
|
4594
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4595
|
+
const baseNumber = Number(totalItems) > 0 ? 1 : 0;
|
|
4596
|
+
const startingNumber = baseNumber + (Number(pageSize) * Number(page) - Number(pageSize));
|
|
4597
|
+
const endingNumber = Number(pageSize) * Number(page);
|
|
4598
|
+
setCurrentResultNumbers({
|
|
4599
|
+
total: Number(totalItems),
|
|
4600
|
+
startingNumber: Number(totalItems) >= startingNumber ? startingNumber : 0,
|
|
4601
|
+
endingNumber: Number(totalItems) < endingNumber ? Number(totalItems) : endingNumber
|
|
4602
|
+
});
|
|
4603
|
+
if (totalItems <= 0 && currentResultNumbers !== null) setNoResults(true);
|
|
4604
|
+
else setNoResults(false);
|
|
4605
|
+
}, [
|
|
4606
|
+
totalItems,
|
|
4607
|
+
pageSize,
|
|
4608
|
+
page
|
|
4609
|
+
]);
|
|
4610
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4611
|
+
if (page !== 1 && (transformedParams.fulltext !== fulltext || transformedParams.selectedFacets !== selectedFacets)) setPage(1);
|
|
4612
|
+
}, [
|
|
4613
|
+
fulltext,
|
|
4614
|
+
selectedFacets
|
|
4615
|
+
]);
|
|
4616
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4617
|
+
if (totalItems !== null && totalItems !== undefined && totalItems > 0) {
|
|
4618
|
+
var params = buildSearchParams(true);
|
|
4619
|
+
if (params !== location.search) setSearchParams(params);
|
|
4620
|
+
}
|
|
4621
|
+
}, [
|
|
4622
|
+
page,
|
|
4623
|
+
sort,
|
|
4624
|
+
sortOrder,
|
|
4625
|
+
totalItems
|
|
4626
|
+
]);
|
|
4627
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4628
|
+
// No results found
|
|
4629
|
+
if (noResults) setAnnouncementText("No results found.");
|
|
4630
|
+
else if (!isPending && (!data || !data.data.results)) setAnnouncementText("Could not connect to the API.");
|
|
4631
|
+
else setAnnouncementText(`Showing ${currentResultNumbers.startingNumber} to ${currentResultNumbers.endingNumber} of ${currentResultNumbers.total} datasets`);
|
|
4632
|
+
}, [
|
|
4633
|
+
data,
|
|
4634
|
+
isPending,
|
|
4635
|
+
noResults,
|
|
4636
|
+
currentResultNumbers
|
|
4637
|
+
]);
|
|
4625
4638
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
4626
4639
|
children: [
|
|
4627
4640
|
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $5723016a5461c1ca$export$2e2bcd8739ae039), {
|
|
@@ -4630,6 +4643,15 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
4630
4643
|
/*#__PURE__*/ (0, $hgUW1$jsxs)("section", {
|
|
4631
4644
|
className: "ds-l-container",
|
|
4632
4645
|
children: [
|
|
4646
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4647
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
4648
|
+
className: "ds-u-visibility--screen-reader",
|
|
4649
|
+
"aria-live": "assertive",
|
|
4650
|
+
"aria-atomic": "true",
|
|
4651
|
+
"data-testid": "currentResults",
|
|
4652
|
+
children: announcementText
|
|
4653
|
+
})
|
|
4654
|
+
}),
|
|
4633
4655
|
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4634
4656
|
className: "ds-l-row",
|
|
4635
4657
|
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
@@ -4714,34 +4736,23 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
4714
4736
|
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
4715
4737
|
className: "ds-u-display--flex ds-u-justify-content--between ds-u-align-items--end ds-u-flex-wrap--reverse ds-u-sm-flex-wrap--wrap",
|
|
4716
4738
|
children: [
|
|
4717
|
-
enablePagination && /*#__PURE__*/ (0, $hgUW1$
|
|
4739
|
+
enablePagination && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4718
4740
|
className: "ds-l-col--12 ds-l-sm-col--6 ds-l-md-col--8 ds-u-sm-padding-left--0",
|
|
4719
|
-
children:
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
" datasets"
|
|
4733
|
-
]
|
|
4734
|
-
})
|
|
4735
|
-
}),
|
|
4736
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
4737
|
-
className: "ds-u-visibility--screen-reader",
|
|
4738
|
-
role: "status",
|
|
4739
|
-
"aria-live": "assertive",
|
|
4740
|
-
"aria-atomic": "true",
|
|
4741
|
-
"data-testid": "currentResults",
|
|
4742
|
-
children: announcementText
|
|
4741
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
4742
|
+
className: "ds-u-margin-y--0",
|
|
4743
|
+
children: currentResultNumbers && data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
4744
|
+
children: [
|
|
4745
|
+
"Showing ",
|
|
4746
|
+
currentResultNumbers.startingNumber,
|
|
4747
|
+
" -",
|
|
4748
|
+
" ",
|
|
4749
|
+
currentResultNumbers.endingNumber,
|
|
4750
|
+
" of ",
|
|
4751
|
+
data.data.total,
|
|
4752
|
+
" datasets"
|
|
4753
|
+
]
|
|
4743
4754
|
})
|
|
4744
|
-
|
|
4755
|
+
})
|
|
4745
4756
|
}),
|
|
4746
4757
|
enableSort && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4747
4758
|
className: "ds-l-col--12 ds-l-sm-col--6 ds-l-md-col--4 ds-u-sm-padding-right--0",
|
|
@@ -4762,6 +4773,7 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
4762
4773
|
children: [
|
|
4763
4774
|
noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
4764
4775
|
variation: "error",
|
|
4776
|
+
role: "region",
|
|
4765
4777
|
heading: "No results found."
|
|
4766
4778
|
}),
|
|
4767
4779
|
data && data.data.results ? Object.keys(data.data.results).map((key)=>{
|
|
@@ -4789,6 +4801,7 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
4789
4801
|
}, item.identifier);
|
|
4790
4802
|
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
4791
4803
|
variation: "error",
|
|
4804
|
+
role: "region",
|
|
4792
4805
|
heading: "Could not connect to the API."
|
|
4793
4806
|
})
|
|
4794
4807
|
]
|
|
@@ -4901,37 +4914,6 @@ const $550bcc185f420ff5$var$DatasetList = ({ rootUrl: rootUrl, enableSort: enabl
|
|
|
4901
4914
|
}
|
|
4902
4915
|
};
|
|
4903
4916
|
const pageSize = defaultPageSize;
|
|
4904
|
-
(0, $hgUW1$useEffect)(()=>{
|
|
4905
|
-
// Update browser URL with current search params
|
|
4906
|
-
const params = buildSearchParams(true);
|
|
4907
|
-
const url = new URL(window.location.href);
|
|
4908
|
-
window.history.pushState({}, "", `${url.origin}${url.pathname}${params}`);
|
|
4909
|
-
const baseNumber = Number(totalItems) > 0 ? 1 : 0;
|
|
4910
|
-
const startingNumber = baseNumber + (Number(pageSize) * Number(page) - Number(pageSize));
|
|
4911
|
-
const endingNumber = Number(pageSize) * Number(page);
|
|
4912
|
-
setCurrentResultNumbers({
|
|
4913
|
-
total: Number(totalItems),
|
|
4914
|
-
startingNumber: Number(totalItems) >= startingNumber ? startingNumber : 0,
|
|
4915
|
-
endingNumber: Number(totalItems) < endingNumber ? Number(totalItems) : endingNumber
|
|
4916
|
-
});
|
|
4917
|
-
setTimeout(()=>{
|
|
4918
|
-
setAnnouncementText(`Showing ${startingNumber} to ${endingNumber} of ${totalItems} datasets`);
|
|
4919
|
-
}, 100);
|
|
4920
|
-
if (totalItems <= 0 && currentResultNumbers !== null) setNoResults(true);
|
|
4921
|
-
else setNoResults(false);
|
|
4922
|
-
}, [
|
|
4923
|
-
totalItems,
|
|
4924
|
-
pageSize,
|
|
4925
|
-
page
|
|
4926
|
-
]);
|
|
4927
|
-
(0, $hgUW1$useEffect)(()=>{
|
|
4928
|
-
var params = buildSearchParams(true);
|
|
4929
|
-
if (params !== location.search) setSearchParams(params);
|
|
4930
|
-
}, [
|
|
4931
|
-
page,
|
|
4932
|
-
sort,
|
|
4933
|
-
sortOrder
|
|
4934
|
-
]);
|
|
4935
4917
|
function buildSearchParams(includePage) {
|
|
4936
4918
|
let newParams = {};
|
|
4937
4919
|
if (Number(page) !== 1 && includePage) newParams.page = page;
|
|
@@ -4961,6 +4943,45 @@ const $550bcc185f420ff5$var$DatasetList = ({ rootUrl: rootUrl, enableSort: enabl
|
|
|
4961
4943
|
}
|
|
4962
4944
|
});
|
|
4963
4945
|
if (data && data.data.total && totalItems != data.data.total) setTotalItems(data.data.total);
|
|
4946
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4947
|
+
// Update browser URL with current search params
|
|
4948
|
+
const params = buildSearchParams(true);
|
|
4949
|
+
const url = new URL(window.location.href);
|
|
4950
|
+
window.history.pushState({}, "", `${url.origin}${url.pathname}${params}`);
|
|
4951
|
+
const baseNumber = Number(totalItems) > 0 ? 1 : 0;
|
|
4952
|
+
const startingNumber = baseNumber + (Number(pageSize) * Number(page) - Number(pageSize));
|
|
4953
|
+
const endingNumber = Number(pageSize) * Number(page);
|
|
4954
|
+
setCurrentResultNumbers({
|
|
4955
|
+
total: Number(totalItems),
|
|
4956
|
+
startingNumber: Number(totalItems) >= startingNumber ? startingNumber : 0,
|
|
4957
|
+
endingNumber: Number(totalItems) < endingNumber ? Number(totalItems) : endingNumber
|
|
4958
|
+
});
|
|
4959
|
+
if (totalItems <= 0 && currentResultNumbers !== null) setNoResults(true);
|
|
4960
|
+
else setNoResults(false);
|
|
4961
|
+
}, [
|
|
4962
|
+
totalItems,
|
|
4963
|
+
pageSize,
|
|
4964
|
+
page
|
|
4965
|
+
]);
|
|
4966
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4967
|
+
var params = buildSearchParams(true);
|
|
4968
|
+
if (params !== location.search) setSearchParams(params);
|
|
4969
|
+
}, [
|
|
4970
|
+
page,
|
|
4971
|
+
sort,
|
|
4972
|
+
sortOrder
|
|
4973
|
+
]);
|
|
4974
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4975
|
+
// No results found
|
|
4976
|
+
if (noResults) setAnnouncementText("No results found.");
|
|
4977
|
+
else if (!isPending && (!data || !data.data.results)) setAnnouncementText("Could not connect to the API.");
|
|
4978
|
+
else setAnnouncementText(`Showing ${currentResultNumbers.startingNumber} to ${currentResultNumbers.endingNumber} of ${currentResultNumbers.total} datasets`);
|
|
4979
|
+
}, [
|
|
4980
|
+
data,
|
|
4981
|
+
isPending,
|
|
4982
|
+
noResults,
|
|
4983
|
+
currentResultNumbers
|
|
4984
|
+
]);
|
|
4964
4985
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
4965
4986
|
children: [
|
|
4966
4987
|
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $5723016a5461c1ca$export$2e2bcd8739ae039), {
|
|
@@ -4969,6 +4990,15 @@ const $550bcc185f420ff5$var$DatasetList = ({ rootUrl: rootUrl, enableSort: enabl
|
|
|
4969
4990
|
/*#__PURE__*/ (0, $hgUW1$jsxs)("section", {
|
|
4970
4991
|
className: "ds-l-container",
|
|
4971
4992
|
children: [
|
|
4993
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4994
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
4995
|
+
className: "ds-u-visibility--screen-reader",
|
|
4996
|
+
"aria-live": "assertive",
|
|
4997
|
+
"aria-atomic": "true",
|
|
4998
|
+
"data-testid": "currentResults",
|
|
4999
|
+
children: announcementText
|
|
5000
|
+
})
|
|
5001
|
+
}),
|
|
4972
5002
|
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4973
5003
|
className: "ds-l-row",
|
|
4974
5004
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
@@ -5009,33 +5039,22 @@ const $550bcc185f420ff5$var$DatasetList = ({ rootUrl: rootUrl, enableSort: enabl
|
|
|
5009
5039
|
className: "ds-u-margin-bottom--3",
|
|
5010
5040
|
children: introText ? introText : null
|
|
5011
5041
|
}),
|
|
5012
|
-
enablePagination && /*#__PURE__*/ (0, $hgUW1$
|
|
5013
|
-
children:
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
" datasets"
|
|
5027
|
-
]
|
|
5028
|
-
})
|
|
5029
|
-
}),
|
|
5030
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
5031
|
-
className: "ds-u-visibility--screen-reader",
|
|
5032
|
-
role: "status",
|
|
5033
|
-
"aria-live": "assertive",
|
|
5034
|
-
"aria-atomic": "true",
|
|
5035
|
-
"data-testid": "currentResults",
|
|
5036
|
-
children: announcementText
|
|
5042
|
+
enablePagination && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
5043
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
5044
|
+
className: "ds-u-margin-y--0",
|
|
5045
|
+
children: currentResultNumbers && data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
5046
|
+
children: [
|
|
5047
|
+
"Showing ",
|
|
5048
|
+
currentResultNumbers.startingNumber,
|
|
5049
|
+
" -",
|
|
5050
|
+
" ",
|
|
5051
|
+
currentResultNumbers.endingNumber,
|
|
5052
|
+
" of ",
|
|
5053
|
+
data.data.total,
|
|
5054
|
+
" datasets"
|
|
5055
|
+
]
|
|
5037
5056
|
})
|
|
5038
|
-
|
|
5057
|
+
})
|
|
5039
5058
|
})
|
|
5040
5059
|
]
|
|
5041
5060
|
}),
|
|
@@ -5058,6 +5077,7 @@ const $550bcc185f420ff5$var$DatasetList = ({ rootUrl: rootUrl, enableSort: enabl
|
|
|
5058
5077
|
children: [
|
|
5059
5078
|
noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
5060
5079
|
variation: "error",
|
|
5080
|
+
role: "region",
|
|
5061
5081
|
heading: "No results found."
|
|
5062
5082
|
}),
|
|
5063
5083
|
data && data.data.results ? Object.keys(data.data.results).map((key)=>{
|
|
@@ -5072,6 +5092,7 @@ const $550bcc185f420ff5$var$DatasetList = ({ rootUrl: rootUrl, enableSort: enabl
|
|
|
5072
5092
|
}, item.identifier);
|
|
5073
5093
|
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
5074
5094
|
variation: "error",
|
|
5095
|
+
role: "region",
|
|
5075
5096
|
heading: "Could not connect to the API."
|
|
5076
5097
|
})
|
|
5077
5098
|
]
|
|
@@ -5188,6 +5209,11 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
5188
5209
|
const [schema, setSchema] = (0, $hgUW1$useState)({});
|
|
5189
5210
|
// const [joins, setJoins] = useState()
|
|
5190
5211
|
const [properties, setProperties] = (0, $hgUW1$useState)(options.properties ? options.properties : undefined);
|
|
5212
|
+
// Check drupalSettings for datastore_query_api
|
|
5213
|
+
const useDatasetAPI = typeof window !== "undefined" && window.drupalSettings?.datastore_query_api === true;
|
|
5214
|
+
const datasetID = additionalParams.datasetID;
|
|
5215
|
+
// Remove datasetID from params to avoid sending it to the API
|
|
5216
|
+
const { datasetID: _, ...restAdditionalParams } = additionalParams;
|
|
5191
5217
|
let params = {
|
|
5192
5218
|
keys: keys,
|
|
5193
5219
|
limit: limit,
|
|
@@ -5196,7 +5222,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
5196
5222
|
sorts: sort,
|
|
5197
5223
|
properties: properties,
|
|
5198
5224
|
groupings: groupings,
|
|
5199
|
-
...
|
|
5225
|
+
...restAdditionalParams
|
|
5200
5226
|
};
|
|
5201
5227
|
params = (0, $6d5c0212e738499b$export$34e95918366a058e)(params, ACA);
|
|
5202
5228
|
const paramsString = Object.keys(params).length ? `${(0, $hgUW1$qs).stringify(params)}` : "";
|
|
@@ -5205,13 +5231,15 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
5205
5231
|
if (!requireConditions) enabled = true;
|
|
5206
5232
|
if (conditions && conditions.length) enabled = true;
|
|
5207
5233
|
}
|
|
5234
|
+
// Change whether distribution API or dataset API is used based on option
|
|
5235
|
+
const queryID = useDatasetAPI && datasetID ? `${datasetID}/0` : id;
|
|
5208
5236
|
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
5209
5237
|
queryKey: [
|
|
5210
5238
|
"datastore" + id + paramsString
|
|
5211
5239
|
],
|
|
5212
5240
|
queryFn: ()=>{
|
|
5213
5241
|
setCount(null);
|
|
5214
|
-
return fetch(`${rootUrl}/datastore/query/${
|
|
5242
|
+
return fetch(`${rootUrl}/datastore/query/${queryID}?${paramsString}`).then((res)=>res.json());
|
|
5215
5243
|
},
|
|
5216
5244
|
enabled: enabled
|
|
5217
5245
|
});
|
|
@@ -5225,7 +5253,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
5225
5253
|
count: true,
|
|
5226
5254
|
schema: true
|
|
5227
5255
|
};
|
|
5228
|
-
return fetch(`${rootUrl}/datastore/query/${
|
|
5256
|
+
return fetch(`${rootUrl}/datastore/query/${queryID}?${(0, $hgUW1$qs).stringify((0, $6d5c0212e738499b$export$34e95918366a058e)(unfilteredParams, ACA))}`).then((res)=>res.json());
|
|
5229
5257
|
}
|
|
5230
5258
|
});
|
|
5231
5259
|
(0, $hgUW1$useEffect)(()=>{
|
|
@@ -5941,7 +5969,8 @@ const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns,
|
|
|
5941
5969
|
table: table,
|
|
5942
5970
|
header: header,
|
|
5943
5971
|
setAriaLiveFeedback: setAriaLiveFeedback,
|
|
5944
|
-
sortElement: sortElement
|
|
5972
|
+
sortElement: sortElement,
|
|
5973
|
+
id: "dataDictionary_" + header.id
|
|
5945
5974
|
}, header.id + "_resize") : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableCell), {
|
|
5946
5975
|
key: header.id,
|
|
5947
5976
|
className: `ds-u-border-y--2 ds-u-border--dark ds-u-border-x--0`,
|
|
@@ -6355,6 +6384,8 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
|
|
|
6355
6384
|
const resource = (0, $1d3d480a9cfaabe0$export$2e2bcd8739ae039)("", rootUrl, {
|
|
6356
6385
|
...options,
|
|
6357
6386
|
limit: defaultPageSize
|
|
6387
|
+
}, {
|
|
6388
|
+
datasetID: id // pass datasetID into additional params to enable dataset API option in useDatastore
|
|
6358
6389
|
});
|
|
6359
6390
|
const siteWideDataDictionary = dataDictionaryUrl ? $a0f13962e513caa1$var$getDataDictionary(rootUrl + dataDictionaryUrl).dataDictionary : null;
|
|
6360
6391
|
// compare schema fields with siteWideDataDictionary to display commonalities for now
|
|
@@ -6420,7 +6451,6 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
|
|
|
6420
6451
|
window.location.hash
|
|
6421
6452
|
]);
|
|
6422
6453
|
const displayDataDictionaryTab = distribution.data && distribution.data.describedBy && distribution.data.describedByType === "application/vnd.tableschema+json" || datasetSitewideDictionary && datasetSitewideDictionary.length > 0;
|
|
6423
|
-
const formatType = (0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution);
|
|
6424
6454
|
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
6425
6455
|
children: dataset.error ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $026cb986f9fea2b1$export$2e2bcd8739ae039), {
|
|
6426
6456
|
content: notFoundContent,
|
|
@@ -6692,21 +6722,15 @@ var $b9af6ce5e2c06331$export$2e2bcd8739ae039 = $b9af6ce5e2c06331$var$Header;
|
|
|
6692
6722
|
|
|
6693
6723
|
|
|
6694
6724
|
|
|
6695
|
-
|
|
6696
6725
|
const $24918217e48ac525$var$NavLink = ({ link: link, className: className = null, wrapLabel: wrapLabel = false, clickHandler: clickHandler })=>{
|
|
6697
6726
|
const innerHtml = wrapLabel ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
6698
6727
|
children: link.label
|
|
6699
6728
|
}) : link.label;
|
|
6700
|
-
return /*#__PURE__*/ (0, $hgUW1$
|
|
6729
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$NavLink), {
|
|
6701
6730
|
className: ({ isActive: isActive })=>isActive ? `dc-c-active-link ${className}` : `${className}`,
|
|
6702
6731
|
to: link.url,
|
|
6703
6732
|
onClick: clickHandler ? clickHandler : undefined,
|
|
6704
|
-
children:
|
|
6705
|
-
innerHtml,
|
|
6706
|
-
link?.target === "_blank" && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$ExternalLinkIcon), {
|
|
6707
|
-
className: "ds-u-margin-left--05 ds-c-external-link-icon"
|
|
6708
|
-
})
|
|
6709
|
-
]
|
|
6733
|
+
children: innerHtml
|
|
6710
6734
|
});
|
|
6711
6735
|
// }
|
|
6712
6736
|
};
|
|
@@ -7096,15 +7120,10 @@ const $a6df0aa147323304$var$Footer = ({ links: links, showEmail: showEmail = tru
|
|
|
7096
7120
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
7097
7121
|
className: "ds-u-padding--0 ds-u-display--flex ds-u-lg-flex-direction--row ds-u-flex-direction--column",
|
|
7098
7122
|
children: footerUtilityLinks.map((link)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
7099
|
-
children: /*#__PURE__*/ (0, $hgUW1$
|
|
7123
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
|
|
7100
7124
|
href: link.url,
|
|
7101
7125
|
className: "ds-u-margin-right--2",
|
|
7102
|
-
children:
|
|
7103
|
-
link.label,
|
|
7104
|
-
link?.target === "_blank" && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$ExternalLinkIcon), {
|
|
7105
|
-
className: "ds-u-margin-left--05 ds-c-external-link-icon"
|
|
7106
|
-
})
|
|
7107
|
-
]
|
|
7126
|
+
children: link.label
|
|
7108
7127
|
})
|
|
7109
7128
|
}, link.id))
|
|
7110
7129
|
})
|
|
@@ -7763,6 +7782,8 @@ const $dd6eb2b30d7ad75d$var$FilteredResourceBody = ({ id: id, dataset: dataset,
|
|
|
7763
7782
|
const resource = (0, $1d3d480a9cfaabe0$export$2e2bcd8739ae039)("", rootUrl, {
|
|
7764
7783
|
...options,
|
|
7765
7784
|
limit: 25
|
|
7785
|
+
}, {
|
|
7786
|
+
datasetID: id
|
|
7766
7787
|
});
|
|
7767
7788
|
(0, $hgUW1$useEffect)(()=>{
|
|
7768
7789
|
if (distribution.identifier) resource.setResource(distribution.identifier);
|