@civicactions/cmsds-open-data-components 3.2.6-alpha.5 → 3.4.0-alpha.1

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
@@ -1,7 +1,7 @@
1
1
  import "./main.css";
2
2
  import {jsxs as $hgUW1$jsxs, jsx as $hgUW1$jsx, Fragment as $hgUW1$Fragment} from "react/jsx-runtime";
3
- import $hgUW1$react, {useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect, useMemo as $hgUW1$useMemo, useCallback as $hgUW1$useCallback} from "react";
4
- import {Button as $hgUW1$Button, Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, TextField as $hgUW1$TextField, Spinner as $hgUW1$Spinner, Dropdown as $hgUW1$Dropdown, Alert as $hgUW1$Alert, Pagination as $hgUW1$Pagination, Dialog as $hgUW1$Dialog, Choice as $hgUW1$Choice, Tabs as $hgUW1$Tabs, TabPanel as $hgUW1$TabPanel, Tooltip as $hgUW1$Tooltip, Badge as $hgUW1$Badge, Table as $hgUW1$Table, TableBody as $hgUW1$TableBody, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableHead as $hgUW1$TableHead, TooltipIcon as $hgUW1$TooltipIcon} from "@cmsgov/design-system";
3
+ import $hgUW1$react, {useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect, createContext as $hgUW1$createContext, useMemo as $hgUW1$useMemo, useContext as $hgUW1$useContext, useCallback as $hgUW1$useCallback} from "react";
4
+ import {Button as $hgUW1$Button, Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, TextField as $hgUW1$TextField, Spinner as $hgUW1$Spinner, Dropdown as $hgUW1$Dropdown, Alert as $hgUW1$Alert, Pagination as $hgUW1$Pagination, Dialog as $hgUW1$Dialog, Choice as $hgUW1$Choice, Tabs as $hgUW1$Tabs, TabPanel as $hgUW1$TabPanel, Table as $hgUW1$Table, TableBody as $hgUW1$TableBody, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableHead as $hgUW1$TableHead, Tooltip as $hgUW1$Tooltip, TooltipIcon as $hgUW1$TooltipIcon, Badge as $hgUW1$Badge} from "@cmsgov/design-system";
5
5
  import $hgUW1$proptypes from "prop-types";
6
6
  import {NavLink as $hgUW1$NavLink, useLocation as $hgUW1$useLocation, useSearchParams as $hgUW1$useSearchParams, Link as $hgUW1$Link, useNavigate as $hgUW1$useNavigate} from "react-router-dom";
7
7
  import $hgUW1$qs from "qs";
@@ -12,7 +12,7 @@ import {useQuery as $hgUW1$useQuery, QueryClient as $hgUW1$QueryClient, QueryCli
12
12
  import {useMediaQuery as $hgUW1$useMediaQuery} from "react-responsive";
13
13
  import $hgUW1$dompurify from "dompurify";
14
14
  import $hgUW1$lodashtruncate from "lodash.truncate";
15
- import {createColumnHelper as $hgUW1$createColumnHelper, useReactTable as $hgUW1$useReactTable, getCoreRowModel as $hgUW1$getCoreRowModel, getSortedRowModel as $hgUW1$getSortedRowModel, flexRender as $hgUW1$flexRender, getFilteredRowModel as $hgUW1$getFilteredRowModel, getPaginationRowModel as $hgUW1$getPaginationRowModel} from "@tanstack/react-table";
15
+ import {createColumnHelper as $hgUW1$createColumnHelper, useReactTable as $hgUW1$useReactTable, getCoreRowModel as $hgUW1$getCoreRowModel, getFilteredRowModel as $hgUW1$getFilteredRowModel, getPaginationRowModel as $hgUW1$getPaginationRowModel, getSortedRowModel as $hgUW1$getSortedRowModel, flexRender as $hgUW1$flexRender} from "@tanstack/react-table";
16
16
  import {KeyboardSensor as $hgUW1$KeyboardSensor, PointerSensor as $hgUW1$PointerSensor, useSensors as $hgUW1$useSensors, useSensor as $hgUW1$useSensor, DndContext as $hgUW1$DndContext, closestCenter as $hgUW1$closestCenter} from "@dnd-kit/core";
17
17
  import {sortableKeyboardCoordinates as $hgUW1$sortableKeyboardCoordinates, arrayMove as $hgUW1$arrayMove, SortableContext as $hgUW1$SortableContext, verticalListSortingStrategy as $hgUW1$verticalListSortingStrategy, useSortable as $hgUW1$useSortable} from "@dnd-kit/sortable";
18
18
  import {restrictToVerticalAxis as $hgUW1$restrictToVerticalAxis} from "@dnd-kit/modifiers";
@@ -1389,6 +1389,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
1389
1389
  "datastore" + id + additionalParamsString
1390
1390
  ],
1391
1391
  queryFn: ()=>{
1392
+ setCount(null);
1392
1393
  return fetch(`${rootUrl}/datastore/query/${id}?${additionalParamsString}`).then((res)=>res.json());
1393
1394
  },
1394
1395
  enabled: enabled
@@ -1551,7 +1552,10 @@ const $6da0396069e23175$export$bc27cf7ecf44639d = {
1551
1552
  });
1552
1553
  if (data.hasEmail) rows.push({
1553
1554
  label: "Contact Email",
1554
- value: data.hasEmail
1555
+ value: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
1556
+ href: data.hasEmail.includes("mailto:") ? data.hasEmail : `mailto:${data.hasEmail}`,
1557
+ children: data.hasEmail.replace("mailto:", "")
1558
+ })
1555
1559
  });
1556
1560
  return rows;
1557
1561
  },
@@ -1667,1029 +1671,634 @@ const $6da0396069e23175$export$bc27cf7ecf44639d = {
1667
1671
 
1668
1672
 
1669
1673
 
1670
-
1671
-
1672
-
1673
-
1674
-
1675
- const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: header, sortElement: sortElement, setAriaLiveFeedback: setAriaLiveFeedback })=>{
1676
- const [columnResizing, setColumnResizing] = (0, $hgUW1$useState)("");
1677
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("th", {
1678
- key: header.id,
1679
- style: {
1680
- width: header.getSize()
1681
- },
1682
- className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold",
1674
+ function $5644ebd2c3dbfd7b$export$eea3a12df15499ca(metadataMapping, datasetInfo) {
1675
+ const rows = [];
1676
+ Object.keys(metadataMapping).forEach((d)=>{
1677
+ if (!datasetInfo[d]) return null;
1678
+ else rows.push(...metadataMapping[d](datasetInfo[d]));
1679
+ });
1680
+ return rows;
1681
+ }
1682
+ const $5644ebd2c3dbfd7b$var$DatasetAdditionalInformation = ({ datasetInfo: datasetInfo, id: id, metadataMapping: metadataMapping })=>{
1683
+ const rows = $5644ebd2c3dbfd7b$export$eea3a12df15499ca(metadataMapping, datasetInfo);
1684
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1685
+ className: "dc-c-additional-info-table ds-u-margin-bottom--6",
1683
1686
  children: [
1684
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1685
- className: "ds-u-display--flex",
1687
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
1688
+ className: "ds-text-heading--2xl ds-u-margin-y--3",
1689
+ children: "Additional Information"
1690
+ }),
1691
+ /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
1692
+ compact: true,
1693
+ striped: true,
1686
1694
  children: [
1687
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1688
- style: {
1689
- maxWidth: header.getSize() - 16
1690
- },
1691
- title: typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "",
1692
- children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
1695
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableHead), {
1696
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
1697
+ children: [
1698
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
1699
+ children: "Field"
1700
+ }),
1701
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
1702
+ children: "Value"
1703
+ })
1704
+ ]
1705
+ })
1693
1706
  }),
1694
- sortElement && /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
1695
- onClick: header.column.getToggleSortingHandler(),
1696
- className: header.column.getCanSort() ? `cursor-pointer select-none ds-u-focus-visible ${sortElement(header.column.getIsSorted())}` : "",
1697
- "aria-label": `${header.column.columnDef.header} sort order`
1707
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
1708
+ children: rows.map((r)=>/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
1709
+ children: [
1710
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
1711
+ children: r.label
1712
+ }),
1713
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
1714
+ className: "ds-u-word-break-anywhere",
1715
+ children: r.value
1716
+ })
1717
+ ]
1718
+ }, `${r.label}_${id}`))
1698
1719
  })
1699
1720
  ]
1700
- }),
1701
- /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
1702
- onMouseDown: header.getResizeHandler(),
1703
- onTouchStart: header.getResizeHandler(),
1704
- className: `dc-c-resize-handle ds-u-focus-visible ${header.column.getIsResizing() || header.column.id == columnResizing ? "isResizing" : ""}`,
1705
- "aria-label": `Resize ${header.column.columnDef.header} column`,
1706
- onKeyDown: (e)=>{
1707
- const columnSizingObject = table.getState().columnSizing;
1708
- switch(e.key){
1709
- case "Enter":
1710
- case " ":
1711
- e.preventDefault();
1712
- e.stopPropagation();
1713
- if (columnResizing) {
1714
- // end resizing
1715
- setColumnResizing("");
1716
- setAriaLiveFeedback(`${header.column.columnDef.header} dropped.`);
1717
- } else {
1718
- // start resizing
1719
- setColumnResizing(header.column.id);
1720
- setAriaLiveFeedback(`${header.column.columnDef.header} grabbed.`);
1721
- }
1722
- break;
1723
- case "Escape":
1724
- if (columnResizing) {
1725
- setColumnResizing("");
1726
- setAriaLiveFeedback(`${header.column.columnDef.header} dropped.`);
1727
- }
1728
- break;
1729
- case "ArrowRight":
1730
- e.preventDefault();
1731
- e.stopPropagation();
1732
- if (columnResizing) {
1733
- columnSizingObject[header.column.id] = header.getSize() + 10;
1734
- table.setColumnSizing(columnSizingObject);
1735
- setAriaLiveFeedback(`${header.column.columnDef.header} has been resized. The new width is ${header.getSize()} pixels.`);
1736
- }
1737
- break;
1738
- case "ArrowLeft":
1739
- e.preventDefault();
1740
- e.stopPropagation();
1741
- if (columnResizing) {
1742
- columnSizingObject[header.column.id] = header.getSize() - 10;
1743
- table.setColumnSizing(columnSizingObject);
1744
- setAriaLiveFeedback(`${header.column.columnDef.header} has been resized. The new width is ${header.getSize()} pixels.`);
1745
- }
1746
- break;
1747
- }
1748
- },
1749
- onBlur: ()=>{
1750
- setColumnResizing("");
1751
- }
1752
1721
  })
1753
1722
  ]
1754
1723
  });
1755
1724
  };
1756
- var $64a351d3fd8413c3$export$2e2bcd8739ae039 = $64a351d3fd8413c3$var$HeaderResizeElement;
1725
+ var $5644ebd2c3dbfd7b$export$2e2bcd8739ae039 = $5644ebd2c3dbfd7b$var$DatasetAdditionalInformation;
1757
1726
 
1758
1727
 
1759
- const $96d341d082bffec5$var$TruncatedResizeableTHead = ({ table: table, sortElement: sortElement = null, setAriaLiveFeedback: setAriaLiveFeedback })=>{
1760
- return /*#__PURE__*/ (0, $hgUW1$jsx)("thead", {
1761
- className: "dc-thead--truncated dc-thead--resizeable",
1762
- children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1763
- className: "dc-c-sticky-header",
1764
- children: headerGroup.headers.map((header)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $64a351d3fd8413c3$export$2e2bcd8739ae039), {
1765
- table: table,
1766
- header: header,
1767
- sortElement: sortElement,
1768
- setAriaLiveFeedback: setAriaLiveFeedback
1769
- }, header.id + "_dataTableResize"))
1770
- }, headerGroup.id))
1771
- });
1772
- };
1773
- var $96d341d082bffec5$export$2e2bcd8739ae039 = $96d341d082bffec5$var$TruncatedResizeableTHead;
1774
1728
 
1775
1729
 
1776
1730
 
1777
1731
 
1778
1732
 
1779
- const $23763e27eda0e8d7$var$FixedSizeTHead = ({ table: table, sortElement: sortElement })=>{
1780
- return /*#__PURE__*/ (0, $hgUW1$jsx)("thead", {
1781
- className: "dc-thead--fixed-size",
1782
- children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1783
- children: headerGroup.headers.map((header)=>{
1784
- return /*#__PURE__*/ (0, $hgUW1$jsx)("th", {
1785
- key: header.id,
1786
- style: {
1787
- width: header.getSize()
1788
- },
1789
- title: header.column.columnDef.header,
1790
- className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold",
1733
+
1734
+
1735
+ const $0958733ee130fc44$var$ResourceInformation = ({ resource: resource })=>{
1736
+ const { count: count, columns: columns } = resource;
1737
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1738
+ className: "dc-c-resource-info-table ds-l-col--12 ds-u-padding-left--0 ds-u-margin-y--2",
1739
+ children: [
1740
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h3", {
1741
+ className: "ds-u-font-size--base ds-text-heading--xl ds-text-heading--xl",
1742
+ children: "About this Resource"
1743
+ }),
1744
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1745
+ className: "ds-u-display--flex ds-u-text-align--center ds-u-justify-content--center ds-u-md-justify-content--start",
1746
+ children: [
1747
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1748
+ className: "ds-u-fill--gray-lightest ds-u-radius ds-u-margin-right--1 ds-u-padding--2",
1749
+ children: [
1750
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1751
+ className: "ds-u-padding-top--05",
1752
+ children: "Rows"
1753
+ }),
1754
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1755
+ className: "ds-u-font-weight--bold",
1756
+ children: count ? count.toLocaleString() : ""
1757
+ })
1758
+ ]
1759
+ }),
1760
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1761
+ className: "ds-u-fill--gray-lightest ds-u-radius ds-u-margin-right--1 ds-u-padding--2",
1791
1762
  children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1792
- onClick: header.column.getToggleSortingHandler(),
1793
- className: "ds-u-display--flex",
1794
1763
  children: [
1795
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1796
- children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
1764
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1765
+ className: "ds-u-padding-top--05",
1766
+ children: "Columns"
1797
1767
  }),
1798
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1799
- className: header.column.getCanSort() ? `cursor-pointer select-none ${sortElement(header.column.getIsSorted())}` : ""
1768
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1769
+ className: "ds-u-font-weight--bold",
1770
+ children: columns.length.toLocaleString()
1800
1771
  })
1801
1772
  ]
1802
1773
  })
1803
- });
1804
- })
1805
- }, headerGroup.id))
1774
+ })
1775
+ ]
1776
+ })
1777
+ ]
1806
1778
  });
1807
1779
  };
1808
- var $23763e27eda0e8d7$export$2e2bcd8739ae039 = $23763e27eda0e8d7$var$FixedSizeTHead;
1809
-
1810
-
1811
-
1812
-
1813
-
1814
-
1815
-
1816
-
1817
-
1780
+ var $0958733ee130fc44$export$2e2bcd8739ae039 = $0958733ee130fc44$var$ResourceInformation;
1818
1781
 
1819
1782
 
1783
+ function $f764661366bd9e1b$export$ee48b7e0e4eb536e(dist) {
1784
+ if (dist && dist.data) {
1785
+ if (dist.data.format) return dist.data.format.toLowerCase();
1786
+ if (dist.data.mediaType) {
1787
+ const mediaType = dist.data.mediaType.split("/");
1788
+ if (mediaType.length && mediaType[1]) return mediaType[1].toLowerCase();
1789
+ }
1790
+ if (dist.data["%Ref:downloadURL"].length && dist.data["%Ref:downloadURL"][0].data) {
1791
+ if (dist.data["%Ref:downloadURL"][0].data.mimeType) {
1792
+ const mimeType = dist.data["%Ref:downloadURL"][0].data.mimeType.split("/");
1793
+ if (mimeType.length && mimeType[1]) return mimeType[1].toLowerCase();
1794
+ }
1795
+ }
1796
+ }
1797
+ return "";
1798
+ }
1820
1799
 
1821
1800
 
1822
1801
 
1823
- const $5fe94aeb50e0798b$var$Card = ({ id: id, visible: visible, updateVisibility: updateVisibility })=>{
1824
- const { attributes: attributes, listeners: listeners, setNodeRef: setNodeRef, transform: transform, transition: transition, isDragging: isDragging } = (0, $hgUW1$useSortable)({
1825
- id: id
1802
+ const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource: resource, title: title })=>{
1803
+ const sm = (0, $hgUW1$useMediaQuery)({
1804
+ minWidth: 0,
1805
+ maxWidth: 767
1826
1806
  });
1827
- const style = {
1828
- transform: (0, $hgUW1$CSS).Transform.toString(transform),
1829
- transition: transition,
1830
- opacity: isDragging ? 0.7 : 1,
1831
- zIndex: isDragging ? 1 : 0,
1832
- position: "relative",
1833
- background: "white",
1834
- touchAction: "none"
1835
- };
1836
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
1837
- className: "ds-u-display--flex ds-u-justify-content--between ds-u-border-bottom--1",
1838
- ref: setNodeRef,
1839
- style: style,
1840
- ...listeners,
1841
- ...attributes,
1842
- onPointerUp: (e)=>{
1843
- // Small hack to get around a chrome / webkit rendering bug = force chrome to repaint the checkbox
1844
- // For whatever reason the way dnd-kit handles events doesn't work well with chrome
1845
- // Without this code checkboxes can end up visually out of sync with app state until a repaint is forced
1846
- // this code forces the repaint without user interaction
1847
- const target = e.target;
1848
- if (isDragging && target.tagName.toLowerCase() === "label") setTimeout(()=>{
1849
- target.parentNode.querySelector("input").checked = visible;
1850
- }, 1);
1851
- },
1807
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1808
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap",
1852
1809
  children: [
1853
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
1854
- type: "checkbox",
1855
- label: id,
1856
- name: id + "_visibility",
1857
- checked: visible,
1858
- className: "ds-l-col--10 ds-u-margin-top--0 ds-u-margin-y--1 ds-u-padding-x--3",
1859
- labelClassName: "dc-truncate",
1860
- value: "",
1861
- onChange: ()=>{
1862
- updateVisibility(id, !visible);
1863
- }
1810
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
1811
+ className: "ds-l-col--12 ds-u-padding-left--0 ds-text-heading--2xl",
1812
+ children: "Resources"
1864
1813
  }),
1865
- /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
1866
- className: `ds-l-col--2 dkan-manage-columns-reorder-button ${isDragging && "grabbed"}`,
1867
- "aria-label": `Reorder ${id} column`,
1868
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1869
- className: "fa fa-sort"
1814
+ distributions.length ? /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
1815
+ className: "ds-c-list ds-c-list--bare dc-c-resource-full-width",
1816
+ children: distributions.map((dist)=>{
1817
+ const fileFormat = (0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(dist);
1818
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
1819
+ className: `ds-u-display--flex ds-u-flex-wrap--wrap ${fileFormat !== "csv" && "ds-u-margin-bottom--2"}`,
1820
+ children: [
1821
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1822
+ 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 ds-u-align-items--center ds-u-display--flex",
1823
+ children: [
1824
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
1825
+ className: "fa ds-u-color--primary ds-u-padding-right--1 ds-u-font-size--3xl fa-file-" + (fileFormat == "xlsx" ? "xls" : fileFormat)
1826
+ }),
1827
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
1828
+ className: "ds-u-margin-top--0",
1829
+ children: [
1830
+ dist.data.title ? dist.data.title : title,
1831
+ " (" + fileFormat.toUpperCase() + ")"
1832
+ ]
1833
+ })
1834
+ ]
1835
+ }),
1836
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1837
+ 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",
1838
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
1839
+ href: dist.data.downloadURL,
1840
+ style: {
1841
+ order: sm ? "1" : "0",
1842
+ width: sm ? "100%" : "auto"
1843
+ },
1844
+ "aria-label": `Download ${dist.data.title || title} ${fileFormat}`,
1845
+ className: "ds-c-button",
1846
+ children: [
1847
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
1848
+ className: "fa fa-file-download ds-u-color--primary ds-u-padding-right--1"
1849
+ }),
1850
+ "Download"
1851
+ ]
1852
+ })
1853
+ }),
1854
+ dist.data.description && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1855
+ className: "ds-u-measure--wide ds-u-margin-bottom--7",
1856
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1857
+ className: "dc-c-metadata-description ds-u-margin--0",
1858
+ dangerouslySetInnerHTML: {
1859
+ __html: (0, $hgUW1$dompurify).sanitize(dist.data.description)
1860
+ }
1861
+ })
1862
+ }),
1863
+ fileFormat === "csv" && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $0958733ee130fc44$export$2e2bcd8739ae039), {
1864
+ resource: resource
1865
+ })
1866
+ ]
1867
+ }, dist.identifier);
1870
1868
  })
1869
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1870
+ className: "ds-u-margin-bottom--2",
1871
+ children: "No resources have been added to this dataset."
1871
1872
  })
1872
1873
  ]
1873
1874
  });
1874
1875
  };
1875
- var $5fe94aeb50e0798b$export$2e2bcd8739ae039 = $5fe94aeb50e0798b$var$Card;
1876
-
1876
+ var $7357cc0f79f9c514$export$2e2bcd8739ae039 = $7357cc0f79f9c514$var$Resource;
1877
1877
 
1878
1878
 
1879
- class $5d9e2ce238d53d29$var$ExcludeCheckboxKeyboardSensor extends (0, $hgUW1$KeyboardSensor) {
1880
- // Custom function to exclude checkbox from keyboard dragging
1881
- static activators = [
1882
- {
1883
- eventName: "onKeyDown",
1884
- handler: ({ nativeEvent: event })=>{
1885
- // prevent scrolling the list
1886
- const isCheckbox = [
1887
- "input",
1888
- "checkbox"
1889
- ].indexOf(event.target.tagName.toLowerCase()) !== -1;
1890
- if (event.key === " " && !isCheckbox) event.preventDefault();
1891
- // only activate on a space or return press
1892
- if ([
1893
- " ",
1894
- "Enter"
1895
- ].indexOf(event.key) === -1) return false;
1896
- if (!isCheckbox) return true;
1897
- return false;
1898
- }
1899
- }
1900
- ];
1901
- }
1902
- class $5d9e2ce238d53d29$var$ExcludeCheckboxPointerSensor extends (0, $hgUW1$PointerSensor) {
1903
- // Custom function to stop accidental checkbox clicks on pointer activation
1904
- static activators = [
1905
- {
1906
- eventName: "onPointerDown",
1907
- handler: ({ nativeEvent: event })=>{
1908
- if (event.target.tagName.toLowerCase() === "input") return false;
1909
- if (event.target.tagName.toLowerCase() === "label") event.target.blur();
1910
- return true;
1911
- }
1912
- }
1913
- ];
1914
- }
1915
- const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, defaultColumnOrder: defaultColumnOrder, setColumnOrder: setColumnOrder, setColumnVisibility: setColumnVisibility })=>{
1916
- const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
1917
- const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)();
1918
- // maintain card state separately from table state - only sync states when the Save button is pressed
1919
- const [cards, setCards] = (0, $hgUW1$useState)(columns.map((c)=>{
1920
- return {
1921
- id: c.id,
1922
- visible: c.getIsVisible()
1923
- };
1924
- }));
1925
- const cardOrder = (0, $hgUW1$useMemo)(()=>cards.map(({ id: id })=>id), [
1926
- cards
1927
- ]);
1928
- const sensors = (0, $hgUW1$useSensors)((0, $hgUW1$useSensor)($5d9e2ce238d53d29$var$ExcludeCheckboxPointerSensor, {
1929
- activationConstraint: {
1930
- distance: 5
1931
- }
1932
- }), (0, $hgUW1$useSensor)($5d9e2ce238d53d29$var$ExcludeCheckboxKeyboardSensor, {
1933
- coordinateGetter: (0, $hgUW1$sortableKeyboardCoordinates)
1934
- }));
1935
- const hiddenColumns = columns.filter((c)=>c.getIsVisible() === false).length;
1936
- const cardHiddenColumns = cards.filter((c)=>c.visible === false).length;
1937
- const updateVisibility = (0, $hgUW1$useCallback)((id, newVisibility)=>{
1938
- setCards(cards.map((card)=>{
1939
- if (card.id === id) return {
1940
- ...card,
1941
- visible: newVisibility
1942
- };
1943
- return card;
1944
- }));
1879
+ const $364dc44850cd8f7f$var$DatasetOverview = ({ dataset: dataset, resource: resource, distributions: distributions, metadataMapping: metadataMapping })=>{
1880
+ const md = (0, $hgUW1$useMediaQuery)({
1881
+ minWidth: 0,
1882
+ maxWidth: 768
1945
1883
  });
1946
- function handleDragEnd(e) {
1947
- const { active: active, over: over } = e;
1948
- if (active.id !== over.id) {
1949
- const oldIndex = cardOrder.indexOf(active.id);
1950
- const newIndex = cardOrder.indexOf(over.id);
1951
- let newCards = (0, $hgUW1$arrayMove)(cards, oldIndex, newIndex);
1952
- setCards(newCards);
1953
- }
1954
- }
1955
- const resetCards = ()=>{
1956
- setCards(columns.map((c)=>{
1957
- return {
1958
- id: c.id,
1959
- visible: c.getIsVisible()
1960
- };
1961
- }));
1962
- };
1884
+ const rows = (0, $5644ebd2c3dbfd7b$export$eea3a12df15499ca)(metadataMapping, dataset);
1963
1885
  return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
1964
1886
  children: [
1887
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $7357cc0f79f9c514$export$2e2bcd8739ae039), {
1888
+ distributions: distributions,
1889
+ resource: resource,
1890
+ title: dataset.title
1891
+ }),
1965
1892
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1966
- className: "ds-u-border-top--1 ds-u-fill--gray-lightest ds-u-display--flex ds-u-justify-content--between",
1893
+ 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",
1967
1894
  children: [
1968
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1969
- children: hiddenColumns > 0 && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Alert), {
1970
- variation: "warn",
1971
- children: [
1972
- hiddenColumns,
1973
- " Columns Hidden"
1974
- ]
1975
- })
1895
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
1896
+ className: "ds-text-heading--2xl ds-text-heading--2xl",
1897
+ children: "Additional Information"
1976
1898
  }),
1977
- /*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
1978
- "aria-label": "Manage columns - Opens in a dialog",
1979
- icon: "columns",
1980
- text: "Manage columns",
1981
- className: "ds-c-button ds-c-button--ghost ds-u-margin-y--1",
1982
- onClick: ()=>{
1983
- setModalOpen(true);
1984
- },
1985
- children: [
1986
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
1987
- className: "far fa-cog ds-u-margin-right--1"
1988
- }),
1989
- "Manage Columns"
1990
- ]
1899
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Table), {
1900
+ compact: true,
1901
+ stackable: true,
1902
+ stackableBreakpoint: "md",
1903
+ warningDisabled: true,
1904
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
1905
+ children: rows.map((r)=>/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
1906
+ children: [
1907
+ md ? "" : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
1908
+ component: "th",
1909
+ className: "ds-u-font-weight--bold",
1910
+ children: r.label
1911
+ }),
1912
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
1913
+ stackedTitle: r.label,
1914
+ children: r.value
1915
+ })
1916
+ ]
1917
+ }, `${r.label}_${dataset.identifier}`))
1918
+ })
1991
1919
  })
1992
1920
  ]
1993
- }),
1994
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1995
- className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
1996
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Dialog), {
1997
- heading: "Manage columns",
1998
- isOpen: modalOpen,
1999
- onExit: ()=>{
2000
- setModalOpen(false);
2001
- resetCards();
2002
- },
2003
- className: "dkan-manage-columns-dialog",
2004
- actions: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2005
- className: "ds-u-display--flex ds-u-justify-content--between ds-u-flex-wrap--wrap ds-u-padding-x--3 ds-u-padding-bottom--1 ds-u-sm-padding-bottom--3",
2006
- children: [
2007
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2008
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0",
2009
- children: [
2010
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2011
- variation: "solid",
2012
- className: "ds-l-col--6 ds-l-sm-col--auto",
2013
- onClick: ()=>{
2014
- setModalOpen(false);
2015
- // update table state
2016
- // Visibility
2017
- // This code is building a new columnVisibility state object from the card state and doing a single setState on the table
2018
- // vs doing a setState on every changed column individually
2019
- const newColumnVisibility = Object.fromEntries(cards.map((c)=>Object.values(c)));
2020
- setColumnVisibility(newColumnVisibility);
2021
- // Card order
2022
- const newCardOrder = cards.map((c)=>{
2023
- return c.id;
2024
- });
2025
- setColumnOrder(newCardOrder);
2026
- // save to localStorage
2027
- const localStorageData = {
2028
- tableColumnOrder: newCardOrder,
2029
- tableColumnVisibility: newColumnVisibility
2030
- };
2031
- localStorage.setItem(id, JSON.stringify(localStorageData));
2032
- },
2033
- children: "Save"
2034
- }),
2035
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2036
- variation: "ghost",
2037
- className: "ds-l-col--6 ds-l-sm-col--auto",
2038
- onClick: ()=>{
2039
- setModalOpen(false);
2040
- resetCards();
2041
- },
2042
- children: "Cancel"
2043
- })
2044
- ]
2045
- }),
2046
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2047
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-padding-top--1 ds-u-sm-padding-y--0",
2048
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2049
- variation: "ghost",
2050
- className: "ds-l-col--6 ds-l-sm-col--auto",
2051
- onClick: ()=>{
2052
- // reset to default column order and set all cards to visible
2053
- // do not save this to the table state until the "Save" button is clicked
2054
- setCards(defaultColumnOrder.map((column)=>{
2055
- const card = cards.filter((c)=>c.id === column)[0];
2056
- return {
2057
- ...card,
2058
- visible: true
2059
- };
2060
- }));
2061
- },
2062
- children: "Reset Columns"
2063
- })
2064
- })
2065
- ]
2066
- }),
2067
- children: [
2068
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2069
- id: "reorder-help",
2070
- className: "ds-u-padding-x--3",
2071
- children: "Activate the reorder button and use the arrow keys to reorder the list or use your mouse to drag/reorder. Press escape to cancel the reordering."
2072
- }),
2073
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
2074
- checked: cardHiddenColumns === 0,
2075
- type: "checkbox",
2076
- onChange: ()=>{
2077
- setCards(cards.map((c)=>{
2078
- return {
2079
- ...c,
2080
- visible: cardHiddenColumns !== 0
2081
- };
2082
- }));
2083
- },
2084
- className: "ds-u-padding-x--3",
2085
- name: "",
2086
- value: "",
2087
- label: "Select all",
2088
- hint: cardHiddenColumns && cardHiddenColumns + " columns hidden"
2089
- }),
2090
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2091
- className: "ds-u-display--flex ds-u-justify-content--between ds-u-font-weight--bold ds-u-padding-y--2 ds-u-padding-x--3 ds-u-border-y--1 ds-u-margin-top--2",
2092
- children: [
2093
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2094
- children: "Display column"
2095
- }),
2096
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2097
- children: "Reorder"
2098
- })
2099
- ]
2100
- }),
2101
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$DndContext), {
2102
- collisionDetection: (0, $hgUW1$closestCenter),
2103
- modifiers: [
2104
- (0, $hgUW1$restrictToVerticalAxis)
2105
- ],
2106
- sensors: sensors,
2107
- onDragEnd: handleDragEnd,
2108
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$SortableContext), {
2109
- items: cardOrder,
2110
- strategy: (0, $hgUW1$verticalListSortingStrategy),
2111
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
2112
- className: "dkan-manage-columns-list",
2113
- children: cards.map((card)=>{
2114
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5fe94aeb50e0798b$export$2e2bcd8739ae039), {
2115
- id: card.id,
2116
- visible: card.visible,
2117
- updateVisibility: updateVisibility
2118
- }, card.id);
2119
- })
2120
- })
2121
- })
2122
- }),
2123
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2124
- className: "sr-only aria-live-feedback",
2125
- "aria-live": "assertive",
2126
- "aria-atomic": "true",
2127
- children: ariaLiveFeedback
2128
- })
2129
- ]
2130
- })
2131
1921
  })
2132
1922
  ]
2133
1923
  });
2134
1924
  };
2135
- var $5d9e2ce238d53d29$export$2e2bcd8739ae039 = $5d9e2ce238d53d29$var$ManageColumns;
1925
+ var $364dc44850cd8f7f$export$2e2bcd8739ae039 = $364dc44850cd8f7f$var$DatasetOverview;
2136
1926
 
2137
1927
 
2138
- const $d98f94c79ddf4e0e$var$DataTable = ({ id: id, data: data, columns: columns, setSort: setSort, sortTransform: sortTransform, tablePadding: tablePadding, canResize: canResize, loading: loading = false, manageColumnsEnabled: manageColumnsEnabled })=>{
2139
- const [sorting, setSorting] = (0, $hgUW1$react).useState([]);
2140
- const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)("");
2141
- const columnHelper = (0, $hgUW1$createColumnHelper)();
2142
- const table_columns = columns.map((col)=>{
2143
- if (col.cell) return columnHelper.accessor(col.accessor, {
2144
- header: col.header,
2145
- cell: col.cell
2146
- });
2147
- return columnHelper.accessor(col.accessor, {
2148
- header: col.header
2149
- });
2150
- });
2151
- const localStorageData = JSON.parse(localStorage.getItem(id));
2152
- const [columnOrder, setColumnOrder] = (0, $hgUW1$useState)(()=>{
2153
- if (manageColumnsEnabled && localStorageData) return localStorageData.tableColumnOrder;
2154
- else return table_columns.map((c)=>c.accessorKey);
2155
- });
2156
- const [columnVisibility, setColumnVisibility] = (0, $hgUW1$useState)(()=>{
2157
- if (manageColumnsEnabled && localStorageData) return localStorageData.tableColumnVisibility;
2158
- else return {};
2159
- });
2160
- const sortElement = (isSorted, onClickFn)=>{
2161
- if (isSorted === "asc") return "dc-c-sort--asc";
2162
- if (isSorted === "desc") return "dc-c-sort--desc";
2163
- return "dc-c-sort--default";
2164
- };
2165
- const filters = [];
2166
- const table = (0, $hgUW1$useReactTable)({
2167
- data: data,
2168
- columns: table_columns,
2169
- manualSorting: true,
2170
- state: {
2171
- columnOrder: columnOrder,
2172
- columnVisibility: columnVisibility,
2173
- sorting: sorting
2174
- },
2175
- columnResizeMode: "onChange",
2176
- onSortingChange: setSorting,
2177
- onColumnOrderChange: setColumnOrder,
2178
- onColumnVisibilityChange: setColumnVisibility,
2179
- getCoreRowModel: (0, $hgUW1$getCoreRowModel)(),
2180
- getSortedRowModel: (0, $hgUW1$getSortedRowModel)(),
2181
- debugTable: false
1928
+
1929
+
1930
+
1931
+
1932
+
1933
+
1934
+
1935
+ const $789279954d8eff7f$var$ApiDocumentation = ({ endpoint: endpoint })=>{
1936
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1937
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
1938
+ url: endpoint
1939
+ })
2182
1940
  });
2183
- (0, $hgUW1$react).useEffect(()=>{
2184
- const normalizedSort = sortTransform ? sortTransform(sorting) : filters;
2185
- setSort(normalizedSort);
2186
- }, [
2187
- sorting
2188
- ]);
2189
- const defaultColumnOrder = (0, $hgUW1$useMemo)(()=>table_columns.map((column)=>{
2190
- return column.accessorKey;
2191
- }));
1941
+ };
1942
+ var $789279954d8eff7f$export$2e2bcd8739ae039 = $789279954d8eff7f$var$ApiDocumentation;
1943
+
1944
+
1945
+ const $cf6eaefd6b928de3$var$DatasetAPI = ({ id: id, rootUrl: rootUrl, apiUrl: apiUrl, additionalParams: additionalParams })=>{
2192
1946
  return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2193
1947
  children: [
2194
- manageColumnsEnabled && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2195
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5d9e2ce238d53d29$export$2e2bcd8739ae039), {
2196
- id: id,
2197
- columns: table.getAllLeafColumns(),
2198
- columnOrder: columnOrder,
2199
- defaultColumnOrder: defaultColumnOrder,
2200
- setColumnOrder: setColumnOrder,
2201
- setColumnVisibility: setColumnVisibility
2202
- })
2203
- }),
2204
1948
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2205
- className: "dc-c-datatable-wrapper",
2206
- tabIndex: 0,
1949
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap",
2207
1950
  children: [
2208
- /*#__PURE__*/ (0, $hgUW1$jsxs)("table", {
2209
- style: {
2210
- width: canResize ? table.getCenterTotalSize() : "100%"
2211
- },
2212
- className: "dc-c-datatable",
1951
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1952
+ className: "ds-l-col--12 ds-l-md-col--9 ds-u-padding-left--0",
2213
1953
  children: [
2214
- canResize ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $96d341d082bffec5$export$2e2bcd8739ae039), {
2215
- table: table,
2216
- sortElement: sortElement,
2217
- setAriaLiveFeedback: setAriaLiveFeedback
2218
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $23763e27eda0e8d7$export$2e2bcd8739ae039), {
2219
- table: table,
2220
- sortElement: sortElement
1954
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
1955
+ className: "ds-text-heading--2xl",
1956
+ children: "Try the API"
2221
1957
  }),
2222
- loading ? /*#__PURE__*/ (0, $hgUW1$jsx)("tbody", {}) : /*#__PURE__*/ (0, $hgUW1$jsx)("tbody", {
2223
- children: table.getRowModel().rows.map((row, index)=>{
2224
- const even = (index + 1) % 2 === 0;
2225
- return /*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
2226
- className: `${even ? "dc-c-datatable--even-row" : ""}`,
2227
- children: row.getVisibleCells().map((cell)=>{
2228
- let classList = "dc-truncate ds-u-padding-x--1";
2229
- return /*#__PURE__*/ (0, $hgUW1$jsx)("td", {
2230
- key: cell.id,
2231
- style: {
2232
- maxWidth: cell.column.getSize()
2233
- },
2234
- className: `${classList} ${tablePadding}`,
2235
- title: cell.getValue(),
2236
- children: (0, $hgUW1$flexRender)(cell.column.columnDef.cell, cell.getContext())
2237
- });
2238
- })
2239
- }, row.id);
2240
- })
1958
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
1959
+ children: "The Open Data API (ODA) provides programmatic access to this dataset including the ability to filter, query, and aggregate data."
2241
1960
  })
2242
1961
  ]
2243
1962
  }),
2244
1963
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2245
- className: "sr-only",
2246
- "aria-live": "assertive",
2247
- "aria-atomic": "true",
2248
- children: ariaLiveFeedback
1964
+ 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",
1965
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
1966
+ href: apiUrl,
1967
+ children: [
1968
+ "View API",
1969
+ " ",
1970
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
1971
+ style: {
1972
+ whiteSpace: "nowrap"
1973
+ },
1974
+ children: [
1975
+ "specification ",
1976
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
1977
+ className: "fa fa-arrow-right ds-u-font-weight--bold"
1978
+ })
1979
+ ]
1980
+ })
1981
+ ]
1982
+ })
2249
1983
  })
2250
1984
  ]
2251
1985
  }),
2252
- loading && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
2253
- "aria-valuetext": "Dataset loading",
2254
- role: "status",
2255
- className: "ds-u-margin--3"
2256
- }),
2257
- !loading && table.getRowModel().rows.length === 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
2258
- variation: "warn",
2259
- children: "No results found for the current filters"
1986
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $789279954d8eff7f$export$2e2bcd8739ae039), {
1987
+ endpoint: `${rootUrl}/metastore/schemas/dataset/items/${id}/docs${additionalParams && additionalParams.ACA ? "?ACA=" + additionalParams.ACA + "&redirect=false" : ""}`
2260
1988
  })
2261
1989
  ]
2262
1990
  });
2263
1991
  };
2264
- var $d98f94c79ddf4e0e$export$2e2bcd8739ae039 = $d98f94c79ddf4e0e$var$DataTable;
1992
+ var $cf6eaefd6b928de3$export$2e2bcd8739ae039 = $cf6eaefd6b928de3$var$DatasetAPI;
2265
1993
 
2266
1994
 
2267
- function $aa4450dcbeef3ac0$export$385a5aba38cc3325(sortArray) {
2268
- let newQuery = [];
2269
- sortArray.forEach((s)=>{
2270
- return newQuery.push({
2271
- property: s.id,
2272
- order: s.desc ? "desc" : "asc"
2273
- });
1995
+
1996
+
1997
+
1998
+
1999
+
2000
+
2001
+
2002
+
2003
+
2004
+
2005
+
2006
+
2007
+
2008
+
2009
+
2010
+
2011
+
2012
+ const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: header, sortElement: sortElement, setAriaLiveFeedback: setAriaLiveFeedback })=>{
2013
+ const [columnResizing, setColumnResizing] = (0, $hgUW1$useState)("");
2014
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("th", {
2015
+ key: header.id,
2016
+ style: {
2017
+ width: header.getSize()
2018
+ },
2019
+ className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold",
2020
+ children: [
2021
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2022
+ className: "ds-u-display--flex",
2023
+ children: [
2024
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2025
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2026
+ title: typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "",
2027
+ children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
2028
+ })
2029
+ }),
2030
+ sortElement && /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
2031
+ onClick: header.column.getToggleSortingHandler(),
2032
+ className: header.column.getCanSort() ? `cursor-pointer select-none ds-u-focus-visible ${sortElement(header.column.getIsSorted())}` : "",
2033
+ "aria-label": `${header.column.columnDef.header} sort order`
2034
+ })
2035
+ ]
2036
+ }),
2037
+ /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
2038
+ onMouseDown: header.getResizeHandler(),
2039
+ onTouchStart: header.getResizeHandler(),
2040
+ className: `dc-c-resize-handle ds-u-focus-visible ${header.column.getIsResizing() || header.column.id == columnResizing ? "isResizing" : ""}`,
2041
+ "aria-label": `Resize ${header.column.columnDef.header} column`,
2042
+ onKeyDown: (e)=>{
2043
+ const columnSizingObject = table.getState().columnSizing;
2044
+ switch(e.key){
2045
+ case "Enter":
2046
+ case " ":
2047
+ e.preventDefault();
2048
+ e.stopPropagation();
2049
+ if (columnResizing) {
2050
+ // end resizing
2051
+ setColumnResizing("");
2052
+ setAriaLiveFeedback(`${header.column.columnDef.header} dropped.`);
2053
+ } else {
2054
+ // start resizing
2055
+ setColumnResizing(header.column.id);
2056
+ setAriaLiveFeedback(`${header.column.columnDef.header} grabbed.`);
2057
+ }
2058
+ break;
2059
+ case "Escape":
2060
+ if (columnResizing) {
2061
+ setColumnResizing("");
2062
+ setAriaLiveFeedback(`${header.column.columnDef.header} dropped.`);
2063
+ }
2064
+ break;
2065
+ case "ArrowRight":
2066
+ e.preventDefault();
2067
+ e.stopPropagation();
2068
+ if (columnResizing) {
2069
+ columnSizingObject[header.column.id] = header.getSize() + 10;
2070
+ table.setColumnSizing(columnSizingObject);
2071
+ setAriaLiveFeedback(`${header.column.columnDef.header} has been resized. The new width is ${header.getSize()} pixels.`);
2072
+ }
2073
+ break;
2074
+ case "ArrowLeft":
2075
+ e.preventDefault();
2076
+ e.stopPropagation();
2077
+ if (columnResizing) {
2078
+ columnSizingObject[header.column.id] = header.getSize() - 10;
2079
+ table.setColumnSizing(columnSizingObject);
2080
+ setAriaLiveFeedback(`${header.column.columnDef.header} has been resized. The new width is ${header.getSize()} pixels.`);
2081
+ }
2082
+ break;
2083
+ }
2084
+ },
2085
+ onBlur: ()=>{
2086
+ setColumnResizing("");
2087
+ }
2088
+ })
2089
+ ]
2274
2090
  });
2275
- return newQuery;
2276
- }
2277
-
2278
-
2279
- // Example custom column headers, where only effective date has an ! at the end
2280
- // [
2281
- // {schema: 'date', cell: ({ value }) => localeDate(value),},
2282
- // {accessor: 'effective_date',cell: ({ value }) => localeDate(value) + '!',},
2283
- // ]
2284
- function $7264a673914aa746$export$8049e8f40a9bdfb8(customHeaders, columns, schema) {
2285
- return columns.map((column)=>{
2286
- const customAccessorIndex = customHeaders.findIndex((header)=>header.accessor === column);
2287
- const customSchemaIndex = customHeaders.findIndex((header)=>header.schema === schema.fields[column].mysql_type);
2288
- let newColumn = {};
2289
- // If specific accessor is passed, this will override a general mysql_type Cell rewrite.
2290
- if (customAccessorIndex > -1) {
2291
- newColumn.header = schema && schema.fields[column].description ? schema.fields[column].description : column;
2292
- newColumn.accessor = column;
2293
- newColumn.cell = customHeaders[customAccessorIndex].cell;
2294
- } else {
2295
- newColumn.header = schema && schema.fields[column].description ? schema.fields[column].description : column;
2296
- newColumn.accessor = column;
2297
- if (customSchemaIndex > -1) newColumn.cell = customHeaders[customSchemaIndex].cell;
2298
- }
2299
- return newColumn;
2300
- });
2301
- }
2302
- function $7264a673914aa746$export$e284ae5d89467c8f(date) {
2303
- if (!date) return date;
2304
- date = new Date(date);
2305
- date = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
2306
- return date;
2307
- }
2308
- function $7264a673914aa746$export$6b5e57d20078142b(value, operator) {
2309
- let newValue = value;
2310
- if (Array.isArray(newValue)) newValue = newValue.join(",");
2311
- // return newValue.replace(/(^\%+|\%+$)/gm, '');
2312
- return newValue;
2313
- }
2314
- const $7264a673914aa746$export$5f89a5ae87bc48e1 = [
2315
- {
2316
- label: "Is",
2317
- value: "="
2318
- },
2319
- {
2320
- label: "Starts With",
2321
- value: "starts with"
2322
- },
2323
- {
2324
- label: "Contains",
2325
- value: "contains"
2326
- },
2327
- {
2328
- label: "Is Not",
2329
- value: "<>"
2330
- },
2331
- {
2332
- label: "Or",
2333
- value: "in"
2334
- },
2335
- {
2336
- label: "Is",
2337
- value: "="
2338
- },
2339
- {
2340
- label: "Is Not",
2341
- value: "<>"
2342
- },
2343
- {
2344
- label: "Greater Than",
2345
- value: ">"
2346
- },
2347
- {
2348
- label: "Less Than",
2349
- value: "<"
2350
- }
2351
- ];
2352
- function $7264a673914aa746$export$2b9377795161999(type) {
2353
- switch(type){
2354
- case "text":
2355
- case "string":
2356
- return [
2357
- {
2358
- label: "Is",
2359
- value: "="
2360
- },
2361
- {
2362
- label: "Starts With",
2363
- value: "starts with"
2364
- },
2365
- {
2366
- label: "Contains",
2367
- value: "contains"
2368
- },
2369
- {
2370
- label: "Is Not",
2371
- value: "<>"
2372
- },
2373
- {
2374
- label: "Or",
2375
- value: "in"
2376
- }
2377
- ];
2378
- case "date":
2379
- return [
2380
- {
2381
- label: "Is",
2382
- value: "="
2383
- },
2384
- {
2385
- label: "Is Not",
2386
- value: "<>"
2387
- },
2388
- {
2389
- label: "Greater Than",
2390
- value: ">"
2391
- },
2392
- {
2393
- label: "Less Than",
2394
- value: "<"
2395
- }
2396
- ];
2397
- default:
2398
- // These 2 should be safe for all data types
2399
- return [
2400
- {
2401
- label: "Is",
2402
- value: "="
2403
- },
2404
- {
2405
- label: "Is Not",
2406
- value: "<>"
2407
- }
2408
- ];
2409
- }
2410
- }
2411
-
2091
+ };
2092
+ var $64a351d3fd8413c3$export$2e2bcd8739ae039 = $64a351d3fd8413c3$var$HeaderResizeElement;
2412
2093
 
2413
2094
 
2414
2095
 
2415
-
2416
-
2417
-
2418
-
2419
- const $2ed0091f7e32d1e6$var$DataTablePageResults = ({ totalRows: totalRows, limit: limit, offset: offset, className: className })=>{
2420
- const numTotalRows = totalRows;
2421
- if (numTotalRows === 0) return /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2422
- className: className,
2423
- children: `0 - 0 of 0 rows`
2096
+ const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns, tableData: tableData, pageSize: pageSize, columnFilters: columnFilters })=>{
2097
+ const [sorting, setSorting] = (0, $hgUW1$useState)([]);
2098
+ const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)("");
2099
+ const mobile = (0, $hgUW1$useMediaQuery)({
2100
+ minWidth: 0,
2101
+ maxWidth: 544
2424
2102
  });
2425
- const ofTotal = ()=>{
2426
- if (limit >= numTotalRows) return numTotalRows;
2427
- if (limit + offset >= numTotalRows) return numTotalRows;
2428
- if (offset === 0) return limit;
2429
- return offset + limit;
2103
+ const sortElement = (isSorted)=>{
2104
+ if (isSorted === "asc") return "dc-c-sort--asc";
2105
+ if (isSorted === "desc") return "dc-c-sort--desc";
2106
+ return "dc-c-sort--default";
2430
2107
  };
2431
- const page = offset / limit;
2432
- const startTotal = ()=>page * limit + 1;
2433
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
2434
- className: className,
2435
- children: [
2436
- "Displaying",
2437
- " ",
2438
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2439
- className: "ds-u-font-weight--bold",
2440
- children: `${startTotal().toLocaleString()} - ${ofTotal().toLocaleString()}`
2441
- }),
2442
- " ",
2443
- "of ",
2444
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2445
- className: "ds-u-font-weight--bold",
2446
- children: `${numTotalRows.toLocaleString()}`
2447
- }),
2448
- " ",
2449
- "results"
2450
- ]
2108
+ const table = (0, $hgUW1$useReactTable)({
2109
+ data: tableData,
2110
+ columns: tableColumns,
2111
+ columnResizeMode: "onChange",
2112
+ getCoreRowModel: (0, $hgUW1$getCoreRowModel)(),
2113
+ getFilteredRowModel: (0, $hgUW1$getFilteredRowModel)(),
2114
+ getPaginationRowModel: (0, $hgUW1$getPaginationRowModel)(),
2115
+ getSortedRowModel: (0, $hgUW1$getSortedRowModel)(),
2116
+ onSortingChange: setSorting,
2117
+ initialState: {
2118
+ pagination: {
2119
+ pageSize: pageSize,
2120
+ pageIndex: 0
2121
+ }
2122
+ },
2123
+ state: {
2124
+ sorting: sorting,
2125
+ columnFilters: columnFilters
2126
+ }
2451
2127
  });
2452
- };
2453
- $2ed0091f7e32d1e6$var$DataTablePageResults.defaultProps = {
2454
- className: "data-table-results"
2455
- };
2456
- $2ed0091f7e32d1e6$var$DataTablePageResults.propTypes = {
2457
- className: (0, $hgUW1$proptypes).string,
2458
- totalRows: (0, $hgUW1$proptypes).number.isRequired,
2459
- limit: (0, $hgUW1$proptypes).number.isRequired,
2460
- offset: (0, $hgUW1$proptypes).number.isRequired
2461
- };
2462
- var $2ed0091f7e32d1e6$export$2e2bcd8739ae039 = $2ed0091f7e32d1e6$var$DataTablePageResults;
2463
-
2464
-
2465
-
2466
-
2467
-
2468
- const $6380a4a580b24362$var$DataTableHeader = ({ resource: resource, downloadURL: downloadURL, unfilteredDownloadURL: unfilteredDownloadURL, jsonUrl: jsonUrl, setPage: setPage })=>{
2469
- const { limit: limit, offset: offset, count: count, conditions: conditions, setLimit: setLimit, setOffset: setOffset } = resource;
2470
- const intCount = count ? count : 0;
2471
- const rowOptions = [
2472
- 10,
2473
- 25,
2474
- 50,
2475
- 100
2128
+ const sortOptions = [
2129
+ {
2130
+ value: "default",
2131
+ label: "No Sort"
2132
+ },
2133
+ {
2134
+ value: "titleasc",
2135
+ label: "Title A-Z"
2136
+ },
2137
+ {
2138
+ value: "titledesc",
2139
+ label: "Title Z-A"
2140
+ },
2141
+ {
2142
+ value: "typeasc",
2143
+ label: "Type A-Z"
2144
+ },
2145
+ {
2146
+ value: "typedesc",
2147
+ label: "Type Z-A"
2148
+ }
2476
2149
  ];
2150
+ const sortStatesLookup = {
2151
+ default: [],
2152
+ titleasc: [
2153
+ {
2154
+ id: "titleResizable",
2155
+ desc: false
2156
+ }
2157
+ ],
2158
+ titledesc: [
2159
+ {
2160
+ id: "titleResizable",
2161
+ desc: true
2162
+ }
2163
+ ],
2164
+ typeasc: [
2165
+ {
2166
+ id: "type",
2167
+ desc: false
2168
+ }
2169
+ ],
2170
+ typedesc: [
2171
+ {
2172
+ id: "type",
2173
+ desc: true
2174
+ }
2175
+ ]
2176
+ };
2477
2177
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2478
- className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--between",
2479
2178
  children: [
2179
+ mobile && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2180
+ className: "ds-u-margin-bottom--3 ds-l-col--12 ds-l-sm-col--6",
2181
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2182
+ labelClassName: "ds-u-margin-top--1 ds-u-sm-margin-top--0",
2183
+ options: sortOptions,
2184
+ label: "Sort",
2185
+ value: Object.keys(sortStatesLookup).find((key)=>{
2186
+ return JSON.stringify(sortStatesLookup[key]) == JSON.stringify(sorting);
2187
+ }),
2188
+ name: "dc-data-dictionary-type",
2189
+ onChange: (e)=>{
2190
+ setSorting(sortStatesLookup[e.target.value]);
2191
+ }
2192
+ })
2193
+ }),
2480
2194
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2481
- className: "dc-c-resource-header--buttons ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end ds-l-col--12 ds-u-margin-top--2 ds-u-padding-x--0",
2195
+ className: "dc-c-datadictionary-table",
2482
2196
  children: [
2483
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2484
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-margin-bottom--2",
2485
- children: conditions && conditions.length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
2486
- onOpen: ()=>{
2487
- navigator.clipboard.writeText(window.location.href);
2488
- },
2489
- className: "ds-c-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12",
2490
- placement: "bottom",
2491
- dialog: true,
2492
- ariaLabel: "Copy link to filtered data",
2493
- title: "Link copied to clipboard",
2494
- "aria-disabled": !conditions || conditions.length === 0,
2495
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2496
- className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2497
- children: [
2498
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2499
- className: "fas fa-copy"
2500
- }),
2501
- " Copy link to filtered data"
2502
- ]
2503
- })
2504
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2505
- "aria-disabled": true,
2506
- "aria-label": "Copy link to filtered data",
2507
- className: "ds-c-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12",
2508
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2509
- className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2510
- children: [
2511
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2512
- className: "fas fa-copy"
2513
- }),
2514
- " Copy link to filtered data"
2515
- ]
2516
- })
2517
- })
2518
- }),
2519
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2520
- className: "ds-l-col--12 ds-l-md-col--auto ds-u-padding-x--0 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end",
2197
+ /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
2198
+ className: "dc-c-datatable",
2199
+ style: {
2200
+ width: "100%"
2201
+ },
2202
+ stackable: true,
2521
2203
  children: [
2522
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2523
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-sm-margin-left--2 ds-u-margin-bottom--2",
2524
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2525
- className: "ds-u-text-align--center ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1 ds-u-display--inline-block ds-l-col--12",
2526
- href: downloadURL,
2527
- "aria-disabled": !conditions || conditions.length === 0,
2528
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2529
- className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2530
- children: [
2531
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2532
- className: "fas fa-file-csv"
2533
- }),
2534
- " Download filtered data (CSV)"
2535
- ]
2536
- })
2537
- })
2204
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableHead), {
2205
+ className: "dc-thead--truncated dc-thead--resizeable",
2206
+ children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableRow), {
2207
+ children: headerGroup.headers.map((header)=>{
2208
+ return header.id === "titleResizable" ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $64a351d3fd8413c3$export$2e2bcd8739ae039), {
2209
+ table: table,
2210
+ header: header,
2211
+ setAriaLiveFeedback: setAriaLiveFeedback,
2212
+ sortElement: sortElement
2213
+ }, header.id + "_resize") : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableCell), {
2214
+ key: header.id,
2215
+ className: `ds-u-border-y--2 ds-u-border--dark ds-u-border-x--0`,
2216
+ id: "dataDictionary_" + header.id,
2217
+ children: [
2218
+ (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext()),
2219
+ header.id === "type" && /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
2220
+ onClick: header.column.getToggleSortingHandler(),
2221
+ className: header.column.getCanSort() ? `cursor-pointer select-none ds-u-focus-visible ${sortElement(header.column.getIsSorted())}` : "",
2222
+ "aria-label": `${header.column.columnDef.header} sort order`
2223
+ })
2224
+ ]
2225
+ });
2226
+ })
2227
+ }, "header" + headerGroup.id))
2538
2228
  }),
2539
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2540
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-sm-margin-left--2 ds-u-margin-bottom--2",
2541
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2542
- className: "ds-u-text-align--center ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1 ds-u-display--inline-block ds-l-col--12",
2543
- href: unfilteredDownloadURL,
2544
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2545
- className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2546
- children: [
2547
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2548
- className: "fas fa-file-csv"
2549
- }),
2550
- " Download full dataset (CSV)"
2551
- ]
2552
- })
2229
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
2230
+ children: table.getRowModel().rows.map((row, index)=>{
2231
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableRow), {
2232
+ children: row.getVisibleCells().map((cell)=>{
2233
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2234
+ key: cell.id,
2235
+ style: {
2236
+ maxWidth: mobile ? "100%" : cell.column.getSize(),
2237
+ whiteSpace: cell.column.id === "description" ? "pre-wrap" : "normal"
2238
+ },
2239
+ className: `${cell.column.id === "titleResizable" ? "ds-u-word-break" : ""}`,
2240
+ headers: "dataDictionary_" + cell.column.id,
2241
+ stackedTitle: cell.column.id === "titleResizable" ? "Title" : cell.column.columnDef.header,
2242
+ children: (0, $hgUW1$flexRender)(cell.column.columnDef.cell, cell.getContext())
2243
+ });
2244
+ })
2245
+ }, index + JSON.stringify(row));
2553
2246
  })
2554
2247
  })
2555
2248
  ]
2556
2249
  }),
2557
- jsonUrl && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2558
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-margin-left--2 ds-u-margin-top--2 ds-u-sm-margin-top--0",
2559
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2560
- className: "ds-u-text-align--center ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1 ds-u-display--inline-block ds-l-col--12",
2561
- href: jsonUrl,
2562
- "aria-label": "Export to .JSON",
2563
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2564
- className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2565
- children: [
2566
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2567
- className: "fas fa-file-code"
2568
- }),
2569
- " Export to JSON"
2570
- ]
2571
- })
2572
- })
2573
- })
2574
- ]
2575
- }),
2576
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2577
- className: "ds-l-col--12 ds-u-display--flex ds-u-align-items--end ds-u-flex-direction--row-reverse ds-u-sm-flex-direction--row ds-u-padding-x--0 ds-u-margin-bottom--2 ds-u-flex-wrap--wrap",
2578
- children: [
2579
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2580
- className: "ds-l-col--12 ds-l-sm-col--8 ds-u-padding-x--0",
2581
- children: !resource.loading && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2ed0091f7e32d1e6$export$2e2bcd8739ae039), {
2582
- totalRows: intCount,
2583
- limit: limit,
2584
- offset: offset
2585
- })
2586
- }),
2587
2250
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2588
- className: "ds-l-col--12 ds-l-sm-col--4 ds-u-display--flex ds-u-justify-content--end ds-u-padding-x--0",
2589
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2590
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2591
- options: rowOptions.map((row)=>({
2592
- label: row.toString(),
2593
- value: row
2594
- })),
2595
- size: "medium",
2596
- label: "Rows per page:",
2597
- labelClassName: "ds-u-margin-top--0",
2598
- name: "datatable_rows_per_page",
2599
- onChange: (e)=>{
2600
- setLimit(parseInt(e.target.value));
2601
- setPage(1);
2602
- setOffset(0);
2603
- },
2604
- defaultValue: limit.toString()
2605
- })
2606
- })
2607
- })
2608
- ]
2609
- })
2610
- ]
2611
- });
2612
- };
2613
- var $6380a4a580b24362$export$2e2bcd8739ae039 = $6380a4a580b24362$var$DataTableHeader;
2614
-
2615
-
2616
-
2617
-
2618
-
2619
-
2620
-
2621
-
2622
-
2623
-
2624
-
2625
-
2626
- const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions, schema: schema, customColumns: customColumns })=>{
2627
- const { fields: fields } = schema;
2628
- const prependedMessage = /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
2629
- children: "Data filters: "
2630
- });
2631
- if (!conditions || !conditions.length) return /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
2632
- className: "ds-u-margin-y--0",
2633
- children: [
2634
- prependedMessage,
2635
- " none"
2636
- ]
2637
- });
2638
- function formatValue(text, property) {
2639
- if (customColumns && customColumns.length > 0) {
2640
- let newValue = text;
2641
- let customColumn = customColumns.find((c)=>c.accessor === property);
2642
- if (customColumn && customColumn.cell) return customColumn.cell({
2643
- value: text
2644
- });
2645
- return text;
2646
- } else return text;
2647
- }
2648
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2649
- className: "dc-querybuilder-title",
2650
- children: [
2651
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2652
- className: "ds-u-margin-y--0",
2653
- children: prependedMessage
2654
- }),
2655
- conditions.map((c)=>{
2656
- const field = fields[c.property];
2657
- const description = field && field.description ? field.description : c.property;
2658
- const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
2659
- const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
2660
- const formattedText = formatValue(cleanedText, c.property);
2661
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2662
- className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
2663
- children: [
2664
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2665
- className: "ds-u-font-weight--bold",
2666
- children: description
2667
- }),
2668
- " ",
2669
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2670
- className: "ds-u-font-weight--normal",
2671
- children: operator.label.toUpperCase()
2672
- }),
2673
- " ",
2674
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2675
- className: "ds-u-color--success",
2676
- children: formattedText
2677
- })
2678
- ]
2679
- });
2680
- }).reduce((prev, curr)=>[
2681
- prev,
2682
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
2683
- className: "ds-u-margin-x--1",
2684
- variation: "info",
2685
- children: "AND"
2251
+ className: "sr-only",
2252
+ "aria-live": "assertive",
2253
+ "aria-atomic": "true",
2254
+ children: ariaLiveFeedback
2686
2255
  }),
2687
- curr
2688
- ])
2256
+ table.getRowModel().rows.length === 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
2257
+ variation: "warn",
2258
+ children: "No results found for the current filters"
2259
+ })
2260
+ ]
2261
+ }),
2262
+ table.getRowCount() > pageSize ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
2263
+ totalPages: table.getPageCount(),
2264
+ currentPage: table.getState().pagination.pageIndex + 1,
2265
+ onPageChange: (evt, page)=>{
2266
+ evt.preventDefault();
2267
+ table.setPageIndex(page - 1);
2268
+ },
2269
+ renderHref: (page)=>{
2270
+ return "";
2271
+ }
2272
+ }) : ""
2689
2273
  ]
2690
2274
  });
2691
2275
  };
2692
- var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
2276
+ var $6765a74df807d015$export$2e2bcd8739ae039 = $6765a74df807d015$var$DataDictionaryTable;
2277
+
2278
+
2279
+ const $a24829b27758fe6c$var$SitewideDataDictionaryTable = ({ datasetDictionary: datasetDictionary, pageSize: pageSize })=>{
2280
+ const columnHelper = (0, $hgUW1$createColumnHelper)();
2281
+ const tableColumns = [
2282
+ columnHelper.accessor("name", {
2283
+ header: "Name"
2284
+ }),
2285
+ columnHelper.accessor("title", {
2286
+ header: "Title"
2287
+ }),
2288
+ columnHelper.accessor("type", {
2289
+ header: "Type"
2290
+ }),
2291
+ columnHelper.accessor("format", {
2292
+ header: "Format"
2293
+ })
2294
+ ];
2295
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6765a74df807d015$export$2e2bcd8739ae039), {
2296
+ tableColumns: tableColumns,
2297
+ tableData: datasetDictionary,
2298
+ pageSize: pageSize
2299
+ });
2300
+ };
2301
+ var $a24829b27758fe6c$export$2e2bcd8739ae039 = $a24829b27758fe6c$var$SitewideDataDictionaryTable;
2693
2302
 
2694
2303
 
2695
2304
 
@@ -2698,402 +2307,612 @@ var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
2698
2307
 
2699
2308
 
2700
2309
 
2701
- function $6369abf590ca298f$var$getStartDate(condition, schema, id) {
2702
- if (schema[id].fields[condition.property].mysql_type === "date") {
2703
- const newDate = new Date(condition.value.toString());
2704
- if (newDate instanceof Date && !isNaN(newDate.getTime())) return newDate;
2705
- }
2706
- return new Date();
2707
- }
2708
- const $6369abf590ca298f$var$QueryRow = ({ id: id, condition: condition, index: index, update: update, remove: remove, propertyOptions: propertyOptions, schema: schema })=>{
2709
- const [operator, setOperator] = (0, $hgUW1$useState)(condition.operator);
2710
- const [property, setProperty] = (0, $hgUW1$useState)(condition.property);
2711
- const [value, setValue] = (0, $hgUW1$useState)(condition.value);
2712
- const [startDate, setStartDate] = (0, $hgUW1$react).useState($6369abf590ca298f$var$getStartDate(condition, schema, id));
2713
- (0, $hgUW1$useEffect)(()=>{
2714
- if (property !== condition.property) {
2715
- if (property) update(index, "property", property);
2716
- else update(index, "property", "");
2717
- if (schema[id].fields[condition.property].mysql_type === "date") {
2718
- if (!value) setValue(startDate.toJSON().slice(0, 10));
2310
+
2311
+
2312
+
2313
+
2314
+ const $2eec38d4d0dbf714$var$ClearFiltersButton = ({ disabled: disabled = false, clearFiltersFn: clearFiltersFn })=>{
2315
+ const small = (0, $hgUW1$useMediaQuery)({
2316
+ minWidth: 0,
2317
+ maxWidth: 544
2318
+ });
2319
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2320
+ disabled: disabled,
2321
+ className: "ds-u-float--right ds-l-md-col--6 ds-l-col--5",
2322
+ variation: small ? "ghost" : undefined,
2323
+ onClick: ()=>clearFiltersFn(),
2324
+ children: small ? "Clear all" : "Clear all filters"
2325
+ });
2326
+ };
2327
+ var $2eec38d4d0dbf714$export$2e2bcd8739ae039 = $2eec38d4d0dbf714$var$ClearFiltersButton;
2328
+
2329
+
2330
+ const $a6e312940f7003ef$var$DatasetDictionaryTable = ({ datasetDictionary: datasetDictionary, pageSize: pageSize })=>{
2331
+ const [titleFilter, setTitleFilter] = (0, $hgUW1$useState)("");
2332
+ const [typeFilter, setTypeFilter] = (0, $hgUW1$useState)("all");
2333
+ const columnFilters = (0, $hgUW1$useMemo)(()=>[
2334
+ {
2335
+ id: "titleResizable",
2336
+ value: titleFilter
2337
+ },
2338
+ {
2339
+ id: "type",
2340
+ value: typeFilter === "all" ? "" : typeFilter
2719
2341
  }
2720
- }
2721
- }, [
2722
- property,
2723
- value,
2724
- startDate,
2725
- schema,
2726
- id,
2727
- condition
2728
- ]);
2729
- (0, $hgUW1$useEffect)(()=>{
2730
- if (operator !== condition.operator) {
2731
- if (operator) update(index, "operator", operator);
2732
- else update(index, "operator", "");
2733
- }
2734
- }, [
2735
- operator
2342
+ ], [
2343
+ titleFilter,
2344
+ typeFilter
2736
2345
  ]);
2737
- (0, $hgUW1$useEffect)(()=>{
2738
- if (value !== condition.value) {
2739
- if (value) update(index, "value", value);
2740
- else update(index, "value", "");
2346
+ const tableData = datasetDictionary.map((item)=>{
2347
+ return {
2348
+ titleResizable: item.title,
2349
+ description: item.description,
2350
+ type: item.type
2351
+ };
2352
+ });
2353
+ const columnHelper = (0, $hgUW1$createColumnHelper)();
2354
+ const tableColumns = [
2355
+ columnHelper.accessor("titleResizable", {
2356
+ header: ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2357
+ className: "dc-c-tooltip-width-override",
2358
+ children: [
2359
+ "Title",
2360
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
2361
+ title: "Title represents the column headers of the data file",
2362
+ // @ts-ignore
2363
+ style: {
2364
+ border: "none",
2365
+ background: "none"
2366
+ },
2367
+ maxWidth: "400px",
2368
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TooltipIcon), {})
2369
+ })
2370
+ ]
2371
+ }),
2372
+ size: 300
2373
+ }),
2374
+ columnHelper.accessor("description", {
2375
+ header: "Description",
2376
+ minSize: 600
2377
+ }),
2378
+ columnHelper.accessor("type", {
2379
+ header: "Type",
2380
+ size: 150,
2381
+ enableResizing: false
2382
+ })
2383
+ ];
2384
+ const typeOptions = [
2385
+ {
2386
+ value: "all",
2387
+ label: "All Types"
2388
+ },
2389
+ {
2390
+ value: "string",
2391
+ label: "String"
2392
+ },
2393
+ {
2394
+ value: "date",
2395
+ label: "Date"
2396
+ },
2397
+ {
2398
+ value: "datetime",
2399
+ label: "Datetime"
2400
+ },
2401
+ {
2402
+ value: "year",
2403
+ label: "Year"
2404
+ },
2405
+ {
2406
+ value: "integer",
2407
+ label: "Integer"
2408
+ },
2409
+ {
2410
+ value: "number",
2411
+ label: "Number"
2412
+ },
2413
+ {
2414
+ value: "boolean",
2415
+ label: "Boolean"
2741
2416
  }
2742
- }, [
2743
- value
2744
- ]);
2745
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("fieldset", {
2746
- className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--between ds-u-align-items--center ds-u-border--0",
2417
+ ];
2418
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2419
+ children: [
2420
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2421
+ className: "dc-query-builder ds-u-margin-bottom--3",
2422
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2423
+ className: "ds-c-accordion ds-c-accordion--bordered",
2424
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
2425
+ heading: "Data Dictionary Filters",
2426
+ defaultOpen: true,
2427
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2428
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap",
2429
+ children: [
2430
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
2431
+ className: "ds-l-col--12 ds-l-sm-col--6",
2432
+ labelClassName: "ds-u-margin-top--1 ds-u-sm-margin-top--0",
2433
+ label: "Title",
2434
+ value: titleFilter,
2435
+ name: "dc-data-dictionary-title",
2436
+ onChange: (e)=>setTitleFilter(e.target.value)
2437
+ }),
2438
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2439
+ className: "ds-l-col--12 ds-l-sm-col--6",
2440
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2441
+ labelClassName: "ds-u-margin-top--1 ds-u-sm-margin-top--0",
2442
+ options: typeOptions,
2443
+ label: "Type",
2444
+ value: typeFilter,
2445
+ name: "dc-data-dictionary-type",
2446
+ onChange: (e)=>setTypeFilter(e.target.value)
2447
+ })
2448
+ }),
2449
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2450
+ className: "ds-u-float--right ds-u-padding-y--2 ds-l-col--12 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end",
2451
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2452
+ className: "ds-u-display--flex ds-u-justify-content--end ds-l-col--12 ds-l-md-col--6 ds-u-padding-x--0",
2453
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2eec38d4d0dbf714$export$2e2bcd8739ae039), {
2454
+ clearFiltersFn: ()=>{
2455
+ setTitleFilter("");
2456
+ setTypeFilter("all");
2457
+ }
2458
+ })
2459
+ })
2460
+ })
2461
+ ]
2462
+ })
2463
+ })
2464
+ })
2465
+ }),
2466
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6765a74df807d015$export$2e2bcd8739ae039), {
2467
+ tableColumns: tableColumns,
2468
+ tableData: tableData,
2469
+ pageSize: pageSize,
2470
+ columnFilters: columnFilters
2471
+ })
2472
+ ]
2473
+ });
2474
+ };
2475
+ var $a6e312940f7003ef$export$2e2bcd8739ae039 = $a6e312940f7003ef$var$DatasetDictionaryTable;
2476
+
2477
+
2478
+
2479
+ const $6012b86ffcaf3f71$var$DataDictionary = ({ datasetDictionaryEndpoint: datasetDictionaryEndpoint, datasetSitewideDictionary: datasetSitewideDictionary, title: title, pageSize: pageSize = 20, additionalParams: additionalParams, csvDownload: csvDownload })=>{
2480
+ const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
2481
+ queryKey: [
2482
+ "dictionary" + datasetDictionaryEndpoint
2483
+ ],
2484
+ queryFn: ()=>{
2485
+ return (0, $hgUW1$axios).get(`${datasetDictionaryEndpoint}?${(0, $hgUW1$qs).stringify(additionalParams, {
2486
+ arrayFormat: "comma",
2487
+ encode: false
2488
+ })}`).then((res)=>res.data).catch((error)=>console.error(error));
2489
+ },
2490
+ enabled: datasetDictionaryEndpoint !== undefined
2491
+ });
2492
+ const datasetDictionary = data && data.data && data.data.fields && data.data.fields.length ? data.data.fields : null;
2493
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2747
2494
  children: [
2748
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2749
- className: "ds-l-col--12 ds-l-md-col--8 ds-u-display--flex ds-u-justify-content--between ds-u-padding-x--0",
2750
- children: [
2751
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2752
- options: propertyOptions,
2753
- className: "ds-l-col--8 ds-u-padding-left--0",
2754
- value: property,
2755
- label: "Column Name",
2756
- name: `${condition.key}_property`,
2757
- onChange: (e)=>setProperty(e.target.value)
2758
- }),
2759
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2760
- options: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[property].mysql_type),
2761
- className: "ds-l-col--4 ds-u-padding-x--0",
2762
- value: operator,
2763
- label: "Operator",
2764
- name: `${condition.key}_operator`,
2765
- onChange: (e)=>setOperator(e.target.value)
2766
- })
2767
- ]
2495
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2496
+ className: "ds-text-heading--2xl ds-u-margin-y--3",
2497
+ children: title
2768
2498
  }),
2769
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2770
- className: "ds-l-col--12 ds-l-md-col--4 ds-u-padding-x--0 ds-u-md-padding-left--2 ds-u-display--flex ds-u-justify-content--between",
2499
+ datasetDictionary && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2771
2500
  children: [
2772
- schema[id].fields[property].mysql_type === "date" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2501
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2502
+ className: "ds-u-margin-bottom--1 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end",
2773
2503
  children: [
2774
- /*#__PURE__*/ (0, $hgUW1$jsx)("label", {
2775
- className: "ds-c-label",
2776
- htmlFor: `${condition.key}_date_value`,
2777
- id: `${condition.key}_date_value-label`,
2778
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2779
- children: "Value"
2780
- })
2504
+ /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Button), {
2505
+ className: "ds-l-col--12 ds-l-sm-col--6 ds-l-md-col--4",
2506
+ onClick: ()=>window.open(datasetDictionaryEndpoint),
2507
+ type: "button",
2508
+ children: [
2509
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2510
+ className: "fa fa-file-download ds-u-color--primary ds-u-padding-right--1"
2511
+ }),
2512
+ " View Dictionary JSON"
2513
+ ]
2781
2514
  }),
2782
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
2783
- name: `${condition.key}_date_value`,
2784
- selected: (0, $7264a673914aa746$export$e284ae5d89467c8f)(startDate),
2785
- onChange: (date)=>{
2786
- setStartDate(date);
2787
- setValue(date.toJSON().slice(0, 10));
2788
- },
2789
- showMonthDropdown: true,
2790
- showYearDropdown: true,
2791
- dropdownMode: "select",
2792
- className: "ds-c-field",
2793
- withPortal: true
2515
+ csvDownload && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2516
+ className: "ds-l-col--12 ds-l-sm-col--6 ds-l-md-col--4 ds-u-margin-top--2 ds-u-sm-margin-top--0 ds-u-padding--0 ds-u-sm-padding-left--2",
2517
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
2518
+ href: datasetDictionaryEndpoint + "/csv",
2519
+ className: "ds-c-button",
2520
+ style: {
2521
+ width: "100%"
2522
+ },
2523
+ children: [
2524
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2525
+ className: "fa fa-file-download ds-u-color--primary ds-u-padding-right--1"
2526
+ }),
2527
+ "Download Dictionary CSV"
2528
+ ]
2529
+ })
2794
2530
  })
2795
2531
  ]
2796
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
2797
- className: "ds-l-col--11 ds-u-padding-x--0",
2798
- label: "Value",
2799
- name: `${condition.key}_value`,
2800
- value: (0, $7264a673914aa746$export$6b5e57d20078142b)(value, operator),
2801
- onChange: (e)=>setValue(e.target.value)
2802
2532
  }),
2803
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2804
- variation: "ghost",
2805
- size: "small",
2806
- className: "ds-u-margin-top--6 ds-u-padding-right--0",
2807
- "aria-label": "Delete filter",
2808
- onClick: ()=>remove(index),
2809
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2810
- className: "fas fa-trash"
2811
- })
2533
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a6e312940f7003ef$export$2e2bcd8739ae039), {
2534
+ datasetDictionary: datasetDictionary,
2535
+ pageSize: pageSize
2812
2536
  })
2813
2537
  ]
2538
+ }),
2539
+ datasetSitewideDictionary && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a24829b27758fe6c$export$2e2bcd8739ae039), {
2540
+ datasetDictionary: datasetSitewideDictionary,
2541
+ pageSize: pageSize
2814
2542
  })
2815
2543
  ]
2816
2544
  });
2817
2545
  };
2818
- var $6369abf590ca298f$export$2e2bcd8739ae039 = $6369abf590ca298f$var$QueryRow;
2546
+ var $6012b86ffcaf3f71$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($6012b86ffcaf3f71$var$DataDictionary);
2819
2547
 
2820
2548
 
2821
2549
 
2822
2550
 
2823
2551
 
2824
2552
 
2825
- const $2eec38d4d0dbf714$var$ClearFiltersButton = ({ disabled: disabled = false, clearFiltersFn: clearFiltersFn })=>{
2826
- const small = (0, $hgUW1$useMediaQuery)({
2827
- minWidth: 0,
2828
- maxWidth: 544
2829
- });
2830
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2831
- disabled: disabled,
2832
- className: "ds-u-float--right ds-l-md-col--6 ds-l-col--5",
2833
- variation: small ? "ghost" : undefined,
2834
- onClick: ()=>clearFiltersFn(),
2835
- children: small ? "Clear all" : "Clear all filters"
2836
- });
2837
- };
2838
- var $2eec38d4d0dbf714$export$2e2bcd8739ae039 = $2eec38d4d0dbf714$var$ClearFiltersButton;
2839
2553
 
2840
2554
 
2841
- function $ee4ad47aa483e5b5$var$updateQueryForDatastore(condition) {
2842
- let cond = condition;
2843
- delete cond.key;
2844
- if (cond.operator === "=" || cond.operator === "<>") {
2845
- if (Array.isArray(cond.value)) cond.value = cond.value.join();
2846
- cond.value = cond.value.replace(/(^\%+|\%+$)/gm, "");
2847
- }
2848
- if (cond.operator.toLowerCase() === "like") {
2849
- if (Array.isArray(cond.value)) cond.value = cond.value.join();
2850
- const cleanedValue = cond.value.replace(/(^\%+|\%+$)/gm, "");
2851
- cond.value = `%${cleanedValue}%`;
2852
- }
2853
- if (cond.operator.toLowerCase() === "in") {
2854
- if (!Array.isArray(cond.value)) cond.value = cond.value.split(",");
2855
- }
2856
- if (Array.isArray(cond.value)) cond.value = cond.value.map((v)=>v.trim().replace(/(^\%+|\%+$)/gm, ""));
2857
- return cond;
2858
- }
2859
- const $ee4ad47aa483e5b5$var$QueryBuilder = (props)=>{
2860
- const { resource: resource, id: id, includeSearchParams: includeSearchParams, customColumns: customColumns } = props;
2861
- const { conditions: conditions, schema: schema, setConditions: setConditions } = resource;
2862
- const fields = Object.keys(schema[id].fields);
2863
- const [conditionsCleared, setConditionsCleared] = (0, $hgUW1$useState)(false);
2864
- const [queryConditions, setQueryConditions] = (0, $hgUW1$useState)([]);
2865
- const [titleConditions, setTitleConditions] = (0, $hgUW1$useState)([]); // Add use effect to load conditions on first load if needed
2866
- const [conditionsChanged, setConditionsChanged] = (0, $hgUW1$useState)(false);
2867
- const small = (0, $hgUW1$useMediaQuery)({
2868
- minWidth: 0,
2869
- maxWidth: 544
2870
- });
2871
- const addCondition = (condition)=>{
2872
- if (Array.isArray(condition)) {
2873
- const keyedConditions = condition.map((oc)=>({
2874
- ...oc,
2875
- key: Date.now().toString() + oc.value + oc.property
2876
- }));
2877
- setQueryConditions(keyedConditions);
2878
- } else setQueryConditions([
2879
- ...queryConditions,
2880
- {
2881
- property: fields[0],
2882
- value: "",
2883
- operator: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[fields[0]].mysql_type)[0].value,
2884
- key: Date.now().toString()
2885
- }
2886
- ]);
2887
- };
2888
- (0, $hgUW1$react).useEffect(()=>{
2889
- if (conditions && conditions.length) addCondition(conditions);
2890
- else addCondition(null);
2891
- setTitleConditions(conditions);
2892
- }, []);
2893
- (0, $hgUW1$react).useEffect(()=>{
2894
- if (conditionsCleared) {
2895
- submitConditions(new Event("submit"));
2896
- setConditionsCleared(false);
2897
- }
2898
- }, [
2899
- conditionsCleared
2900
- ]);
2901
- const propertyOptions = fields.map((f)=>{
2902
- if (schema[id].fields[f].description) return {
2903
- label: schema[id].fields[f].description,
2904
- value: f
2905
- };
2906
- return {
2907
- label: f,
2908
- value: f
2909
- };
2910
- });
2911
- const submitConditions = (e)=>{
2912
- e.preventDefault();
2913
- const submitConditions = queryConditions.filter((oc)=>{
2914
- if (oc.property) return oc;
2915
- return false;
2916
- }).map((oc)=>{
2917
- let cond = Object.assign({}, oc);
2918
- return $ee4ad47aa483e5b5$var$updateQueryForDatastore(cond);
2919
- });
2920
- setConditions(submitConditions);
2921
- setTitleConditions(queryConditions.map((oc)=>Object.assign({}, oc)));
2922
- setConditionsChanged(false);
2923
- if (includeSearchParams) {
2924
- const url = new URL(window.location.href);
2925
- const urlString = (0, $hgUW1$qs).stringify({
2926
- conditions: submitConditions
2927
- }, {
2928
- encodeValuesOnly: true,
2929
- addQueryPrefix: true
2930
- });
2931
- window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
2932
- }
2933
- };
2934
- const updateCondition = (index, key, value)=>{
2935
- let newConditions = [
2936
- ...queryConditions
2937
- ];
2938
- newConditions[index][key] = value;
2939
- setQueryConditions(newConditions);
2940
- setConditionsChanged(true);
2941
- };
2942
- const removeCondition = (index)=>{
2943
- let newConditions = queryConditions.map((oc)=>Object.assign({}, oc));
2944
- newConditions.splice(index, 1);
2945
- setQueryConditions(newConditions);
2946
- setConditionsChanged(true);
2947
- setConditionsCleared(true);
2948
- };
2949
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2950
- className: "dc-query-builder ds-u-margin-bottom--3",
2951
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2952
- className: "ds-c-accordion ds-c-accordion--bordered",
2953
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
2954
- heading: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bef7bff2823feea2$export$2e2bcd8739ae039), {
2955
- schema: schema[id],
2956
- conditions: titleConditions,
2957
- customColumns: customColumns
2958
- }),
2959
- defaultOpen: true,
2960
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("form", {
2961
- onSubmit: (e)=>submitConditions(e),
2962
- children: [
2963
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2964
- children: queryConditions.map((qf, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $6369abf590ca298f$export$2e2bcd8739ae039), {
2965
- id: id,
2966
- schema: schema,
2967
- condition: qf,
2968
- index: index,
2969
- propertyOptions: propertyOptions,
2970
- update: updateCondition,
2971
- remove: removeCondition
2972
- }, qf.key))
2973
- }),
2974
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2975
- className: "dc-query-bulder--form-buttons ds-u-padding-x--2 ds-u-padding-top--0 ds-u-md-padding-top--2 ds-u-display--flex ds-u-flex-wrap--wrap",
2555
+
2556
+
2557
+
2558
+
2559
+
2560
+
2561
+
2562
+
2563
+
2564
+ const $96d341d082bffec5$var$TruncatedResizeableTHead = ({ table: table, sortElement: sortElement = null, setAriaLiveFeedback: setAriaLiveFeedback })=>{
2565
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("thead", {
2566
+ className: "dc-thead--truncated dc-thead--resizeable",
2567
+ children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
2568
+ className: "dc-c-sticky-header",
2569
+ children: headerGroup.headers.map((header)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $64a351d3fd8413c3$export$2e2bcd8739ae039), {
2570
+ table: table,
2571
+ header: header,
2572
+ sortElement: sortElement,
2573
+ setAriaLiveFeedback: setAriaLiveFeedback
2574
+ }, header.id + "_dataTableResize"))
2575
+ }, headerGroup.id))
2576
+ });
2577
+ };
2578
+ var $96d341d082bffec5$export$2e2bcd8739ae039 = $96d341d082bffec5$var$TruncatedResizeableTHead;
2579
+
2580
+
2581
+
2582
+
2583
+
2584
+ const $23763e27eda0e8d7$var$FixedSizeTHead = ({ table: table, sortElement: sortElement })=>{
2585
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("thead", {
2586
+ className: "dc-thead--fixed-size",
2587
+ children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
2588
+ children: headerGroup.headers.map((header)=>{
2589
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("th", {
2590
+ key: header.id,
2591
+ style: {
2592
+ width: header.getSize()
2593
+ },
2594
+ title: header.column.columnDef.header,
2595
+ className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold",
2596
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2597
+ onClick: header.column.getToggleSortingHandler(),
2598
+ className: "ds-u-display--flex",
2976
2599
  children: [
2977
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2978
- className: "ds-l-col--12 ds-l-md-col--4 ds-l-md-col--6 ds-u-padding-x--0 ds-u-margin-bottom--2 ds-u-md-margin-bottom--0",
2979
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2980
- variation: "ghost",
2981
- onClick: ()=>addCondition(null),
2982
- className: "ds-u-padding-left--0",
2983
- children: "+ Add filter"
2984
- })
2600
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2601
+ children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
2985
2602
  }),
2986
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2987
- className: "ds-u-display--flex ds-u-justify-content--end ds-l-col--12 ds-l-md-col--6 ds-u-padding-x--0",
2988
- children: [
2989
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2990
- disabled: !conditionsChanged,
2991
- className: "ds-u-float--right ds-l-md-col--6 ds-u-margin--right--0 ds-u-sm-margin-right--2",
2992
- type: "submit",
2993
- variation: "solid",
2994
- children: "Apply filters"
2995
- }),
2996
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2eec38d4d0dbf714$export$2e2bcd8739ae039), {
2997
- disabled: queryConditions.length === 0,
2998
- clearFiltersFn: ()=>{
2999
- setQueryConditions([]);
3000
- setTitleConditions([]);
3001
- setConditionsCleared(true);
3002
- }
3003
- })
3004
- ]
2603
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2604
+ className: header.column.getCanSort() ? `cursor-pointer select-none ${sortElement(header.column.getIsSorted())}` : ""
3005
2605
  })
3006
2606
  ]
3007
2607
  })
3008
- ]
2608
+ });
3009
2609
  })
3010
- })
3011
- })
2610
+ }, headerGroup.id))
3012
2611
  });
3013
2612
  };
3014
- $ee4ad47aa483e5b5$var$QueryBuilder.defaultProps = {
3015
- includeSearchParams: true
3016
- };
3017
- var $ee4ad47aa483e5b5$export$2e2bcd8739ae039 = $ee4ad47aa483e5b5$var$QueryBuilder;
2613
+ var $23763e27eda0e8d7$export$2e2bcd8739ae039 = $23763e27eda0e8d7$var$FixedSizeTHead;
3018
2614
 
3019
2615
 
3020
- function $a35cf16d1488f54e$export$1147582dfae658c6(columns, schema) {
3021
- return columns.map((column)=>({
3022
- header: schema && schema.fields[column].description ? schema.fields[column].description : column,
3023
- accessor: column
3024
- }));
3025
- }
3026
- const $a35cf16d1488f54e$var$DatasetTable = ({ id: id, distribution: distribution, resource: resource, rootUrl: rootUrl, customColumns: customColumns = [], jsonUrl: jsonUrl, dataDictionaryBanner: dataDictionaryBanner, manageColumnsEnabled: manageColumnsEnabled })=>{
3027
- const defaultPage = 1;
3028
- const defaultPageSize = 10;
3029
- const [page, setPage] = (0, $hgUW1$useState)(defaultPage);
3030
- const customColumnHeaders = (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution.identifier]);
3031
- const columns = customColumnHeaders ? customColumnHeaders : $a35cf16d1488f54e$export$1147582dfae658c6(resource.columns, resource.schema[id]);
3032
- const { limit: limit, setLimit: setLimit, setOffset: setOffset } = resource;
3033
- const pageSize = limit ? limit : defaultPageSize;
3034
- const downloadURL = `${rootUrl}/datastore/query/${id}/0/download?${(0, $hgUW1$qs).stringify({
3035
- conditions: resource.conditions
3036
- }, {
3037
- encode: true
3038
- })}&format=csv`;
3039
- if (Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length) return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2616
+
2617
+
2618
+
2619
+
2620
+
2621
+
2622
+
2623
+
2624
+
2625
+
2626
+
2627
+
2628
+
2629
+
2630
+
2631
+ const $5fe94aeb50e0798b$var$Card = ({ id: id, visible: visible, updateVisibility: updateVisibility })=>{
2632
+ const { attributes: attributes, listeners: listeners, setNodeRef: setNodeRef, transform: transform, transition: transition, isDragging: isDragging } = (0, $hgUW1$useSortable)({
2633
+ id: id
2634
+ });
2635
+ const style = {
2636
+ transform: (0, $hgUW1$CSS).Transform.toString(transform),
2637
+ transition: transition,
2638
+ opacity: isDragging ? 0.7 : 1,
2639
+ zIndex: isDragging ? 1 : 0,
2640
+ position: "relative",
2641
+ background: "white",
2642
+ touchAction: "none"
2643
+ };
2644
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
2645
+ className: "ds-u-display--flex ds-u-justify-content--between ds-u-border-bottom--1",
2646
+ ref: setNodeRef,
2647
+ style: style,
2648
+ ...listeners,
2649
+ ...attributes,
2650
+ onPointerUp: (e)=>{
2651
+ // Small hack to get around a chrome / webkit rendering bug = force chrome to repaint the checkbox
2652
+ // For whatever reason the way dnd-kit handles events doesn't work well with chrome
2653
+ // Without this code checkboxes can end up visually out of sync with app state until a repaint is forced
2654
+ // this code forces the repaint without user interaction
2655
+ const target = e.target;
2656
+ if (isDragging && target.tagName.toLowerCase() === "label") setTimeout(()=>{
2657
+ target.parentNode.querySelector("input").checked = visible;
2658
+ }, 1);
2659
+ },
3040
2660
  children: [
3041
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ee4ad47aa483e5b5$export$2e2bcd8739ae039), {
3042
- resource: resource,
3043
- id: distribution.identifier,
3044
- customColumns: customColumnHeaders
3045
- }),
3046
- dataDictionaryBanner && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3047
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
3048
- children: 'Click on the "Data Dictionary" tab above for full column definitions'
3049
- })
3050
- }),
3051
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6380a4a580b24362$export$2e2bcd8739ae039), {
3052
- resource: resource,
3053
- downloadURL: downloadURL,
3054
- unfilteredDownloadURL: distribution.data.downloadURL,
3055
- jsonUrl: jsonUrl,
3056
- setPage: setPage
2661
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
2662
+ type: "checkbox",
2663
+ label: id,
2664
+ name: id + "_visibility",
2665
+ checked: visible,
2666
+ className: "ds-l-col--10 ds-u-margin-top--0 ds-u-margin-y--1 ds-u-padding-x--3",
2667
+ labelClassName: "dc-truncate",
2668
+ value: "",
2669
+ onChange: ()=>{
2670
+ updateVisibility(id, !visible);
2671
+ }
3057
2672
  }),
3058
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3059
- className: "ds-u-border-x--1 ds-u-border-bottom--1",
3060
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
3061
- id: id,
3062
- data: resource.values,
3063
- canResize: true,
3064
- columns: columns,
3065
- setSort: resource.setSort,
3066
- sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
3067
- tablePadding: "ds-u-padding-y--2",
3068
- loading: resource.loading,
3069
- manageColumnsEnabled: manageColumnsEnabled
2673
+ /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
2674
+ className: `ds-l-col--2 dkan-manage-columns-reorder-button ${isDragging && "grabbed"}`,
2675
+ "aria-label": `Reorder ${id} column`,
2676
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2677
+ className: "fa fa-sort"
3070
2678
  })
2679
+ })
2680
+ ]
2681
+ });
2682
+ };
2683
+ var $5fe94aeb50e0798b$export$2e2bcd8739ae039 = $5fe94aeb50e0798b$var$Card;
2684
+
2685
+
2686
+
2687
+
2688
+ class $5d9e2ce238d53d29$var$ExcludeCheckboxKeyboardSensor extends (0, $hgUW1$KeyboardSensor) {
2689
+ // Custom function to exclude checkbox from keyboard dragging
2690
+ static activators = [
2691
+ {
2692
+ eventName: "onKeyDown",
2693
+ handler: ({ nativeEvent: event })=>{
2694
+ // prevent scrolling the list
2695
+ const isCheckbox = [
2696
+ "input",
2697
+ "checkbox"
2698
+ ].indexOf(event.target.tagName.toLowerCase()) !== -1;
2699
+ if (event.key === " " && !isCheckbox) event.preventDefault();
2700
+ // only activate on a space or return press
2701
+ if ([
2702
+ " ",
2703
+ "Enter"
2704
+ ].indexOf(event.key) === -1) return false;
2705
+ if (!isCheckbox) return true;
2706
+ return false;
2707
+ }
2708
+ }
2709
+ ];
2710
+ }
2711
+ class $5d9e2ce238d53d29$var$ExcludeCheckboxPointerSensor extends (0, $hgUW1$PointerSensor) {
2712
+ // Custom function to stop accidental checkbox clicks on pointer activation
2713
+ static activators = [
2714
+ {
2715
+ eventName: "onPointerDown",
2716
+ handler: ({ nativeEvent: event })=>{
2717
+ if (event.target.tagName.toLowerCase() === "input") return false;
2718
+ if (event.target.tagName.toLowerCase() === "label") event.target.blur();
2719
+ return true;
2720
+ }
2721
+ }
2722
+ ];
2723
+ }
2724
+ const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, defaultColumnOrder: defaultColumnOrder, modalOpen: modalOpen, setModalOpen: setModalOpen })=>{
2725
+ const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, setColumnVisibility: setColumnVisibility } = (0, $hgUW1$useContext)((0, $39bc4d98030a5599$export$a5806b00c0db0089));
2726
+ // maintain card state separately from table state - only sync states when the Save button is pressed
2727
+ const [cards, setCards] = (0, $hgUW1$useState)(columns.map((c)=>{
2728
+ return {
2729
+ id: c.id,
2730
+ visible: c.getIsVisible()
2731
+ };
2732
+ }));
2733
+ const cardOrder = (0, $hgUW1$useMemo)(()=>cards.map(({ id: id })=>id), [
2734
+ cards
2735
+ ]);
2736
+ // keep state in sync
2737
+ (0, $hgUW1$useEffect)(()=>{
2738
+ if (columnOrder.length) setCards(columnOrder.map((c)=>{
2739
+ const column = columns.filter((col)=>col.id === c)[0];
2740
+ return {
2741
+ id: column.id,
2742
+ visible: column.getIsVisible()
2743
+ };
2744
+ }));
2745
+ }, [
2746
+ columnOrder
2747
+ ]);
2748
+ const sensors = (0, $hgUW1$useSensors)((0, $hgUW1$useSensor)($5d9e2ce238d53d29$var$ExcludeCheckboxPointerSensor, {
2749
+ activationConstraint: {
2750
+ distance: 5
2751
+ }
2752
+ }), (0, $hgUW1$useSensor)($5d9e2ce238d53d29$var$ExcludeCheckboxKeyboardSensor, {
2753
+ coordinateGetter: (0, $hgUW1$sortableKeyboardCoordinates)
2754
+ }));
2755
+ const cardHiddenColumns = cards.filter((c)=>c.visible === false).length;
2756
+ const updateVisibility = (0, $hgUW1$useCallback)((id, newVisibility)=>{
2757
+ setCards(cards.map((card)=>{
2758
+ if (card.id === id) return {
2759
+ ...card,
2760
+ visible: newVisibility
2761
+ };
2762
+ return card;
2763
+ }));
2764
+ });
2765
+ function handleDragEnd(e) {
2766
+ const { active: active, over: over } = e;
2767
+ if (active.id !== over.id) {
2768
+ const oldIndex = cardOrder.indexOf(active.id);
2769
+ const newIndex = cardOrder.indexOf(over.id);
2770
+ let newCards = (0, $hgUW1$arrayMove)(cards, oldIndex, newIndex);
2771
+ setCards(newCards);
2772
+ }
2773
+ }
2774
+ const resetCards = ()=>{
2775
+ setCards(columns.map((c)=>{
2776
+ return {
2777
+ id: c.id,
2778
+ visible: c.getIsVisible()
2779
+ };
2780
+ }));
2781
+ };
2782
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2783
+ className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
2784
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Dialog), {
2785
+ heading: "Manage columns",
2786
+ isOpen: modalOpen,
2787
+ onExit: ()=>{
2788
+ setModalOpen(false);
2789
+ resetCards();
2790
+ },
2791
+ className: "dkan-manage-columns-dialog",
2792
+ actions: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2793
+ className: "ds-u-display--flex ds-u-justify-content--between ds-u-flex-wrap--wrap ds-u-padding-x--3 ds-u-padding-bottom--1 ds-u-sm-padding-bottom--3",
2794
+ children: [
2795
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2796
+ className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0",
2797
+ children: [
2798
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2799
+ variation: "solid",
2800
+ className: "ds-l-col--6 ds-l-sm-col--auto",
2801
+ onClick: ()=>{
2802
+ setModalOpen(false);
2803
+ // update table state
2804
+ // Visibility
2805
+ // This code is building a new columnVisibility state object from the card state and doing a single setState on the table
2806
+ // vs doing a setState on every changed column individually
2807
+ const newColumnVisibility = Object.fromEntries(cards.map((c)=>Object.values(c)));
2808
+ setColumnVisibility(newColumnVisibility);
2809
+ // Card order
2810
+ const newCardOrder = cards.map((c)=>{
2811
+ return c.id;
2812
+ });
2813
+ setColumnOrder(newCardOrder);
2814
+ // save to localStorage
2815
+ const localStorageData = {
2816
+ tableColumnOrder: newCardOrder,
2817
+ tableColumnVisibility: newColumnVisibility
2818
+ };
2819
+ localStorage.setItem(id, JSON.stringify(localStorageData));
2820
+ },
2821
+ children: "Save"
2822
+ }),
2823
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2824
+ variation: "ghost",
2825
+ className: "ds-l-col--6 ds-l-sm-col--auto",
2826
+ onClick: ()=>{
2827
+ setModalOpen(false);
2828
+ resetCards();
2829
+ },
2830
+ children: "Cancel"
2831
+ })
2832
+ ]
2833
+ }),
2834
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2835
+ className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-padding-top--1 ds-u-sm-padding-y--0",
2836
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2837
+ variation: "ghost",
2838
+ className: "ds-l-col--6 ds-l-sm-col--auto",
2839
+ onClick: ()=>{
2840
+ // reset to default column order and set all cards to visible
2841
+ // do not save this to the table state until the "Save" button is clicked
2842
+ setCards(defaultColumnOrder.map((column)=>{
2843
+ const card = cards.filter((c)=>c.id === column)[0];
2844
+ return {
2845
+ ...card,
2846
+ visible: true
2847
+ };
2848
+ }));
2849
+ },
2850
+ children: "Reset Columns"
2851
+ })
2852
+ })
2853
+ ]
3071
2854
  }),
3072
- !resource.loading && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3073
- className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end ds-u-md-justify-content--between ds-u-margin-top--2 ds-u-align-items--center",
3074
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
3075
- totalPages: Math.ceil(resource.count ? resource.count / pageSize : 1),
3076
- currentPage: page,
3077
- onPageChange: (evt, page)=>{
3078
- evt.preventDefault();
3079
- setOffset((page - 1) * limit);
3080
- setPage(page);
3081
- },
3082
- renderHref: (page)=>{
3083
- return "";
2855
+ children: [
2856
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2857
+ id: "reorder-help",
2858
+ className: "ds-u-padding-x--3",
2859
+ children: "Activate the reorder button and use the arrow keys to reorder the list or use your mouse to drag/reorder. Press escape to cancel the reordering."
2860
+ }),
2861
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
2862
+ checked: cardHiddenColumns === 0,
2863
+ type: "checkbox",
2864
+ onChange: ()=>{
2865
+ setCards(cards.map((c)=>{
2866
+ return {
2867
+ ...c,
2868
+ visible: cardHiddenColumns !== 0
2869
+ };
2870
+ }));
3084
2871
  },
3085
- className: "ds-l-col--12 ds-u-padding-x--0"
2872
+ className: "ds-u-padding-x--3",
2873
+ name: "",
2874
+ value: "",
2875
+ label: "Select all",
2876
+ hint: cardHiddenColumns && cardHiddenColumns + " columns hidden"
2877
+ }),
2878
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2879
+ className: "ds-u-display--flex ds-u-justify-content--between ds-u-font-weight--bold ds-u-padding-y--2 ds-u-padding-x--3 ds-u-border-y--1 ds-u-margin-top--2",
2880
+ children: [
2881
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2882
+ children: "Display column"
2883
+ }),
2884
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2885
+ children: "Reorder"
2886
+ })
2887
+ ]
2888
+ }),
2889
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$DndContext), {
2890
+ collisionDetection: (0, $hgUW1$closestCenter),
2891
+ modifiers: [
2892
+ (0, $hgUW1$restrictToVerticalAxis)
2893
+ ],
2894
+ sensors: sensors,
2895
+ onDragEnd: handleDragEnd,
2896
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$SortableContext), {
2897
+ items: cardOrder,
2898
+ strategy: (0, $hgUW1$verticalListSortingStrategy),
2899
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
2900
+ className: "dkan-manage-columns-list",
2901
+ children: cards.map((card)=>{
2902
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5fe94aeb50e0798b$export$2e2bcd8739ae039), {
2903
+ id: card.id,
2904
+ visible: card.visible,
2905
+ updateVisibility: updateVisibility
2906
+ }, card.id);
2907
+ })
2908
+ })
2909
+ })
3086
2910
  })
3087
- })
3088
- ]
3089
- });
3090
- else return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
3091
- "aria-valuetext": "Dataset loading",
3092
- role: "status",
3093
- className: "ds-u-margin--3"
2911
+ ]
2912
+ })
3094
2913
  });
3095
2914
  };
3096
- var $a35cf16d1488f54e$export$2e2bcd8739ae039 = $a35cf16d1488f54e$var$DatasetTable;
2915
+ var $5d9e2ce238d53d29$export$2e2bcd8739ae039 = $5d9e2ce238d53d29$var$ManageColumns;
3097
2916
 
3098
2917
 
3099
2918
 
@@ -3101,61 +2920,374 @@ var $a35cf16d1488f54e$export$2e2bcd8739ae039 = $a35cf16d1488f54e$var$DatasetTabl
3101
2920
 
3102
2921
 
3103
2922
 
2923
+ const $16bd41951b91f02d$var$FullScreenDataTable = ({ modalOpen: modalOpen, setModalOpen: setModalOpen })=>{
2924
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2925
+ className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
2926
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dialog), {
2927
+ heading: "Dataset Explorer",
2928
+ isOpen: modalOpen,
2929
+ onExit: ()=>setModalOpen(false),
2930
+ className: "dkan-full-screen-dataset-dialog",
2931
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a35cf16d1488f54e$export$2e2bcd8739ae039), {
2932
+ isModal: true,
2933
+ closeFullScreenModal: ()=>setModalOpen(false)
2934
+ })
2935
+ })
2936
+ });
2937
+ };
2938
+ var $16bd41951b91f02d$export$2e2bcd8739ae039 = $16bd41951b91f02d$var$FullScreenDataTable;
3104
2939
 
3105
2940
 
3106
- function $5644ebd2c3dbfd7b$export$eea3a12df15499ca(metadataMapping, datasetInfo) {
3107
- const rows = [];
3108
- Object.keys(metadataMapping).forEach((d)=>{
3109
- if (!datasetInfo[d]) return null;
3110
- else rows.push(...metadataMapping[d](datasetInfo[d]));
3111
- });
3112
- return rows;
3113
- }
3114
- const $5644ebd2c3dbfd7b$var$DatasetAdditionalInformation = ({ datasetInfo: datasetInfo, id: id, metadataMapping: metadataMapping })=>{
3115
- const rows = $5644ebd2c3dbfd7b$export$eea3a12df15499ca(metadataMapping, datasetInfo);
3116
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3117
- className: "dc-c-additional-info-table ds-u-margin-bottom--6",
2941
+ const $71b4324f265dec16$var$DataTableControls = ({ id: id, columns: columns, defaultColumnOrder: defaultColumnOrder, isModal: isModal, closeFullScreenModal: closeFullScreenModal })=>{
2942
+ const [manageColumnsModalOpen, setManageColumnsModalOpen] = (0, $hgUW1$useState)(false);
2943
+ const [fullScreenModalOpen, setFullScreenModalOpen] = (0, $hgUW1$useState)(false);
2944
+ const hiddenColumns = columns.filter((c)=>c.getIsVisible() === false).length;
2945
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3118
2946
  children: [
3119
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
3120
- className: "ds-text-heading--2xl ds-u-margin-y--3",
3121
- children: "Additional Information"
3122
- }),
3123
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
3124
- compact: true,
3125
- striped: true,
2947
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2948
+ className: "ds-u-border-top--1 ds-u-fill--gray-lightest ds-u-display--flex ds-u-justify-content--between",
3126
2949
  children: [
3127
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableHead), {
3128
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
2950
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2951
+ children: hiddenColumns > 0 && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Alert), {
2952
+ variation: "warn",
3129
2953
  children: [
3130
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
3131
- children: "Field"
3132
- }),
3133
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
3134
- children: "Value"
3135
- })
2954
+ hiddenColumns,
2955
+ " Columns Hidden"
3136
2956
  ]
3137
2957
  })
3138
2958
  }),
3139
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
3140
- children: rows.map((r)=>/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
2959
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2960
+ children: [
2961
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
2962
+ "aria-label": "Manage columns - Opens in a dialog",
2963
+ className: "ds-c-button ds-c-button--ghost ds-u-margin-y--1",
2964
+ onClick: ()=>{
2965
+ setManageColumnsModalOpen(true);
2966
+ },
3141
2967
  children: [
3142
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
3143
- children: r.label
2968
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2969
+ className: "far fa-cog ds-u-margin-right--1"
3144
2970
  }),
3145
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
3146
- className: "ds-u-word-break-anywhere",
3147
- children: r.value
3148
- })
2971
+ "Manage Columns"
3149
2972
  ]
3150
- }, `${r.label}_${id}`))
2973
+ }),
2974
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
2975
+ "aria-label": isModal ? "Close Full Screen dialog" : "Full Screen mode - Opens in a dialog",
2976
+ className: "ds-c-button ds-c-button--ghost ds-u-margin-y--1",
2977
+ onClick: ()=>{
2978
+ if (isModal) closeFullScreenModal();
2979
+ else setFullScreenModalOpen(true);
2980
+ },
2981
+ children: [
2982
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2983
+ className: `fa ${isModal ? "fa-compress" : "fa-expand"} ds-u-margin-right--1`
2984
+ }),
2985
+ isModal ? "Exit Full Screen" : "Full Screen"
2986
+ ]
2987
+ })
2988
+ ]
2989
+ })
2990
+ ]
2991
+ }),
2992
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2993
+ children: [
2994
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5d9e2ce238d53d29$export$2e2bcd8739ae039), {
2995
+ id: id,
2996
+ columns: columns,
2997
+ defaultColumnOrder: defaultColumnOrder,
2998
+ modalOpen: manageColumnsModalOpen,
2999
+ setModalOpen: setManageColumnsModalOpen
3000
+ }),
3001
+ !isModal && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $16bd41951b91f02d$export$2e2bcd8739ae039), {
3002
+ modalOpen: fullScreenModalOpen,
3003
+ setModalOpen: setFullScreenModalOpen
3004
+ })
3005
+ ]
3006
+ })
3007
+ ]
3008
+ });
3009
+ };
3010
+ var $71b4324f265dec16$export$2e2bcd8739ae039 = $71b4324f265dec16$var$DataTableControls;
3011
+
3012
+
3013
+
3014
+
3015
+ const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, setSort: setSort, sortTransform: sortTransform, tablePadding: tablePadding, canResize: canResize, loading: loading = false, isModal: isModal, closeFullScreenModal: closeFullScreenModal })=>{
3016
+ const { id: id, resource: resource, datasetTableControls: datasetTableControls } = (0, $hgUW1$useContext)((0, $a0f13962e513caa1$export$a7997ae78b143b));
3017
+ const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, columnVisibility: columnVisibility, setColumnVisibility: setColumnVisibility } = (0, $hgUW1$useContext)((0, $39bc4d98030a5599$export$a5806b00c0db0089));
3018
+ const data = resource.values;
3019
+ const [sorting, setSorting] = (0, $hgUW1$react).useState([]);
3020
+ const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)("");
3021
+ const dataTableWrapperElement = (0, $hgUW1$useRef)(null);
3022
+ const columnHelper = (0, $hgUW1$createColumnHelper)();
3023
+ const table_columns = columns.map((col)=>{
3024
+ if (col.cell) return columnHelper.accessor(col.accessor, {
3025
+ header: col.header,
3026
+ cell: col.cell
3027
+ });
3028
+ return columnHelper.accessor(col.accessor, {
3029
+ header: col.header
3030
+ });
3031
+ });
3032
+ (0, $hgUW1$useEffect)(()=>{
3033
+ if (!columnOrder.length) setColumnOrder(table_columns.map((c)=>c.accessorKey));
3034
+ }, [
3035
+ columnOrder
3036
+ ]);
3037
+ const sortElement = (isSorted, onClickFn)=>{
3038
+ if (isSorted === "asc") return "dc-c-sort--asc";
3039
+ if (isSorted === "desc") return "dc-c-sort--desc";
3040
+ return "dc-c-sort--default";
3041
+ };
3042
+ const filters = [];
3043
+ const table = (0, $hgUW1$useReactTable)({
3044
+ data: data,
3045
+ columns: table_columns,
3046
+ manualSorting: true,
3047
+ state: {
3048
+ columnOrder: columnOrder,
3049
+ columnVisibility: columnVisibility,
3050
+ sorting: sorting
3051
+ },
3052
+ columnResizeMode: "onChange",
3053
+ onSortingChange: setSorting,
3054
+ onColumnOrderChange: setColumnOrder,
3055
+ onColumnVisibilityChange: setColumnVisibility,
3056
+ getCoreRowModel: (0, $hgUW1$getCoreRowModel)(),
3057
+ getSortedRowModel: (0, $hgUW1$getSortedRowModel)(),
3058
+ debugTable: false
3059
+ });
3060
+ (0, $hgUW1$useEffect)(()=>{
3061
+ const normalizedSort = sortTransform ? sortTransform(sorting) : filters;
3062
+ setSort(normalizedSort);
3063
+ }, [
3064
+ sorting
3065
+ ]);
3066
+ const defaultColumnOrder = (0, $hgUW1$useMemo)(()=>table_columns.map((column)=>column.accessorKey), []);
3067
+ const tableWrapperWidth = ()=>{
3068
+ if (dataTableWrapperElement.current) return dataTableWrapperElement.current.offsetWidth;
3069
+ return "auto";
3070
+ };
3071
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3072
+ children: [
3073
+ datasetTableControls && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3074
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $71b4324f265dec16$export$2e2bcd8739ae039), {
3075
+ id: id,
3076
+ columns: table.getAllLeafColumns(),
3077
+ defaultColumnOrder: defaultColumnOrder,
3078
+ isModal: isModal,
3079
+ closeFullScreenModal: closeFullScreenModal
3080
+ })
3081
+ }),
3082
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3083
+ className: "dc-c-datatable-wrapper",
3084
+ tabIndex: 0,
3085
+ ref: dataTableWrapperElement,
3086
+ children: [
3087
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("table", {
3088
+ style: {
3089
+ width: canResize ? table.getCenterTotalSize() : "100%",
3090
+ minWidth: tableWrapperWidth()
3091
+ },
3092
+ className: "dc-c-datatable",
3093
+ children: [
3094
+ canResize ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $96d341d082bffec5$export$2e2bcd8739ae039), {
3095
+ table: table,
3096
+ sortElement: sortElement,
3097
+ setAriaLiveFeedback: setAriaLiveFeedback
3098
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $23763e27eda0e8d7$export$2e2bcd8739ae039), {
3099
+ table: table,
3100
+ sortElement: sortElement
3101
+ }),
3102
+ loading ? /*#__PURE__*/ (0, $hgUW1$jsx)("tbody", {}) : /*#__PURE__*/ (0, $hgUW1$jsx)("tbody", {
3103
+ children: table.getRowModel().rows.map((row, index)=>{
3104
+ const even = (index + 1) % 2 === 0;
3105
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
3106
+ className: `${even ? "dc-c-datatable--even-row" : ""}`,
3107
+ children: row.getVisibleCells().map((cell)=>{
3108
+ let classList = "dc-truncate ds-u-padding-x--1";
3109
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("td", {
3110
+ key: cell.id,
3111
+ style: {
3112
+ maxWidth: cell.column.getSize()
3113
+ },
3114
+ className: `${classList} ${tablePadding}`,
3115
+ title: cell.getValue(),
3116
+ children: (0, $hgUW1$flexRender)(cell.column.columnDef.cell, cell.getContext())
3117
+ });
3118
+ })
3119
+ }, row.id);
3120
+ })
3121
+ })
3122
+ ]
3123
+ }),
3124
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3125
+ className: "sr-only",
3126
+ "aria-live": "assertive",
3127
+ "aria-atomic": "true",
3128
+ children: ariaLiveFeedback
3151
3129
  })
3152
3130
  ]
3131
+ }),
3132
+ loading && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
3133
+ "aria-valuetext": "Dataset loading",
3134
+ role: "status",
3135
+ className: "ds-u-margin--3"
3136
+ }),
3137
+ !loading && table.getRowModel().rows.length === 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
3138
+ variation: "warn",
3139
+ children: "No results found for the current filters"
3153
3140
  })
3154
3141
  ]
3155
3142
  });
3156
3143
  };
3157
- var $5644ebd2c3dbfd7b$export$2e2bcd8739ae039 = $5644ebd2c3dbfd7b$var$DatasetAdditionalInformation;
3144
+ var $d98f94c79ddf4e0e$export$2e2bcd8739ae039 = $d98f94c79ddf4e0e$var$DataTable;
3145
+
3146
+
3147
+ function $aa4450dcbeef3ac0$export$385a5aba38cc3325(sortArray) {
3148
+ let newQuery = [];
3149
+ sortArray.forEach((s)=>{
3150
+ return newQuery.push({
3151
+ property: s.id,
3152
+ order: s.desc ? "desc" : "asc"
3153
+ });
3154
+ });
3155
+ return newQuery;
3156
+ }
3157
+
3158
3158
 
3159
+ // Example custom column headers, where only effective date has an ! at the end
3160
+ // [
3161
+ // {schema: 'date', cell: ({ value }) => localeDate(value),},
3162
+ // {accessor: 'effective_date',cell: ({ value }) => localeDate(value) + '!',},
3163
+ // ]
3164
+ function $7264a673914aa746$export$8049e8f40a9bdfb8(customHeaders, columns, schema) {
3165
+ return columns.map((column)=>{
3166
+ const customAccessorIndex = customHeaders.findIndex((header)=>header.accessor === column);
3167
+ const customSchemaIndex = customHeaders.findIndex((header)=>header.schema === schema.fields[column].mysql_type);
3168
+ let newColumn = {};
3169
+ // If specific accessor is passed, this will override a general mysql_type Cell rewrite.
3170
+ if (customAccessorIndex > -1) {
3171
+ newColumn.header = schema && schema.fields[column].description ? schema.fields[column].description : column;
3172
+ newColumn.accessor = column;
3173
+ newColumn.cell = customHeaders[customAccessorIndex].cell;
3174
+ } else {
3175
+ newColumn.header = schema && schema.fields[column].description ? schema.fields[column].description : column;
3176
+ newColumn.accessor = column;
3177
+ if (customSchemaIndex > -1) newColumn.cell = customHeaders[customSchemaIndex].cell;
3178
+ }
3179
+ return newColumn;
3180
+ });
3181
+ }
3182
+ function $7264a673914aa746$export$e284ae5d89467c8f(date) {
3183
+ if (!date) return date;
3184
+ date = new Date(date);
3185
+ date = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
3186
+ return date;
3187
+ }
3188
+ function $7264a673914aa746$export$6b5e57d20078142b(value, operator) {
3189
+ let newValue = value;
3190
+ if (Array.isArray(newValue)) newValue = newValue.join(",");
3191
+ // return newValue.replace(/(^\%+|\%+$)/gm, '');
3192
+ return newValue;
3193
+ }
3194
+ const $7264a673914aa746$export$5f89a5ae87bc48e1 = [
3195
+ {
3196
+ label: "Is",
3197
+ value: "="
3198
+ },
3199
+ {
3200
+ label: "Starts With",
3201
+ value: "starts with"
3202
+ },
3203
+ {
3204
+ label: "Contains",
3205
+ value: "contains"
3206
+ },
3207
+ {
3208
+ label: "Is Not",
3209
+ value: "<>"
3210
+ },
3211
+ {
3212
+ label: "Or",
3213
+ value: "in"
3214
+ },
3215
+ {
3216
+ label: "Is",
3217
+ value: "="
3218
+ },
3219
+ {
3220
+ label: "Is Not",
3221
+ value: "<>"
3222
+ },
3223
+ {
3224
+ label: "Greater Than",
3225
+ value: ">"
3226
+ },
3227
+ {
3228
+ label: "Less Than",
3229
+ value: "<"
3230
+ }
3231
+ ];
3232
+ function $7264a673914aa746$export$2b9377795161999(type) {
3233
+ switch(type){
3234
+ case "text":
3235
+ case "string":
3236
+ return [
3237
+ {
3238
+ label: "Is",
3239
+ value: "="
3240
+ },
3241
+ {
3242
+ label: "Starts With",
3243
+ value: "starts with"
3244
+ },
3245
+ {
3246
+ label: "Contains",
3247
+ value: "contains"
3248
+ },
3249
+ {
3250
+ label: "Is Not",
3251
+ value: "<>"
3252
+ },
3253
+ {
3254
+ label: "Or",
3255
+ value: "in"
3256
+ }
3257
+ ];
3258
+ case "date":
3259
+ return [
3260
+ {
3261
+ label: "Is",
3262
+ value: "="
3263
+ },
3264
+ {
3265
+ label: "Is Not",
3266
+ value: "<>"
3267
+ },
3268
+ {
3269
+ label: "Greater Than",
3270
+ value: ">"
3271
+ },
3272
+ {
3273
+ label: "Less Than",
3274
+ value: "<"
3275
+ }
3276
+ ];
3277
+ default:
3278
+ // These 2 should be safe for all data types
3279
+ return [
3280
+ {
3281
+ label: "Is",
3282
+ value: "="
3283
+ },
3284
+ {
3285
+ label: "Is Not",
3286
+ value: "<>"
3287
+ }
3288
+ ];
3289
+ }
3290
+ }
3159
3291
 
3160
3292
 
3161
3293
 
@@ -3164,189 +3296,176 @@ var $5644ebd2c3dbfd7b$export$2e2bcd8739ae039 = $5644ebd2c3dbfd7b$var$DatasetAddi
3164
3296
 
3165
3297
 
3166
3298
 
3167
- const $0958733ee130fc44$var$ResourceInformation = ({ resource: resource })=>{
3168
- const { count: count, columns: columns } = resource;
3169
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3170
- className: "dc-c-resource-info-table ds-l-col--12 ds-u-padding-left--0 ds-u-margin-y--2",
3299
+ const $2ed0091f7e32d1e6$var$DataTablePageResults = ({ totalRows: totalRows, limit: limit, offset: offset, className: className })=>{
3300
+ const numTotalRows = totalRows;
3301
+ if (numTotalRows === 0) return /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
3302
+ className: className,
3303
+ children: `0 - 0 of 0 rows`
3304
+ });
3305
+ const ofTotal = ()=>{
3306
+ if (limit >= numTotalRows) return numTotalRows;
3307
+ if (limit + offset >= numTotalRows) return numTotalRows;
3308
+ if (offset === 0) return limit;
3309
+ return offset + limit;
3310
+ };
3311
+ const page = offset / limit;
3312
+ const startTotal = ()=>page * limit + 1;
3313
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
3314
+ className: className,
3171
3315
  children: [
3172
- /*#__PURE__*/ (0, $hgUW1$jsx)("h3", {
3173
- className: "ds-u-font-size--base ds-text-heading--xl ds-text-heading--xl",
3174
- children: "About this Resource"
3316
+ "Displaying",
3317
+ " ",
3318
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3319
+ className: "ds-u-font-weight--bold",
3320
+ children: `${startTotal().toLocaleString()} - ${ofTotal().toLocaleString()}`
3175
3321
  }),
3176
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3177
- className: "ds-u-display--flex ds-u-text-align--center ds-u-justify-content--center ds-u-md-justify-content--start",
3178
- children: [
3179
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3180
- className: "ds-u-fill--gray-lightest ds-u-radius ds-u-margin-right--1 ds-u-padding--2",
3181
- children: [
3182
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3183
- className: "ds-u-padding-top--05",
3184
- children: "Rows"
3185
- }),
3186
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3187
- className: "ds-u-font-weight--bold",
3188
- children: count ? count.toLocaleString() : ""
3189
- })
3190
- ]
3191
- }),
3192
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3193
- className: "ds-u-fill--gray-lightest ds-u-radius ds-u-margin-right--1 ds-u-padding--2",
3194
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3195
- children: [
3196
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3197
- className: "ds-u-padding-top--05",
3198
- children: "Columns"
3199
- }),
3200
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3201
- className: "ds-u-font-weight--bold",
3202
- children: columns.length.toLocaleString()
3203
- })
3204
- ]
3205
- })
3206
- })
3207
- ]
3208
- })
3322
+ " ",
3323
+ "of ",
3324
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3325
+ className: "ds-u-font-weight--bold",
3326
+ children: `${numTotalRows.toLocaleString()}`
3327
+ }),
3328
+ " ",
3329
+ "results"
3209
3330
  ]
3210
3331
  });
3211
3332
  };
3212
- var $0958733ee130fc44$export$2e2bcd8739ae039 = $0958733ee130fc44$var$ResourceInformation;
3333
+ $2ed0091f7e32d1e6$var$DataTablePageResults.defaultProps = {
3334
+ className: "data-table-results"
3335
+ };
3336
+ $2ed0091f7e32d1e6$var$DataTablePageResults.propTypes = {
3337
+ className: (0, $hgUW1$proptypes).string,
3338
+ totalRows: (0, $hgUW1$proptypes).number.isRequired,
3339
+ limit: (0, $hgUW1$proptypes).number.isRequired,
3340
+ offset: (0, $hgUW1$proptypes).number.isRequired
3341
+ };
3342
+ var $2ed0091f7e32d1e6$export$2e2bcd8739ae039 = $2ed0091f7e32d1e6$var$DataTablePageResults;
3213
3343
 
3214
3344
 
3215
- function $f764661366bd9e1b$export$ee48b7e0e4eb536e(dist) {
3216
- if (dist && dist.data) {
3217
- if (dist.data.format) return dist.data.format.toLowerCase();
3218
- if (dist.data.mediaType) {
3219
- const mediaType = dist.data.mediaType.split("/");
3220
- if (mediaType.length && mediaType[1]) return mediaType[1].toLowerCase();
3221
- }
3222
- if (dist.data["%Ref:downloadURL"].length && dist.data["%Ref:downloadURL"][0].data) {
3223
- if (dist.data["%Ref:downloadURL"][0].data.mimeType) {
3224
- const mimeType = dist.data["%Ref:downloadURL"][0].data.mimeType.split("/");
3225
- if (mimeType.length && mimeType[1]) return mimeType[1].toLowerCase();
3226
- }
3227
- }
3228
- }
3229
- return "";
3230
- }
3231
3345
 
3232
3346
 
3233
3347
 
3234
- const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource: resource, title: title })=>{
3235
- const sm = (0, $hgUW1$useMediaQuery)({
3236
- minWidth: 0,
3237
- maxWidth: 767
3238
- });
3348
+ const $6380a4a580b24362$var$DataTableHeader = ({ resource: resource, downloadURL: downloadURL, unfilteredDownloadURL: unfilteredDownloadURL, setPage: setPage })=>{
3349
+ const { limit: limit, offset: offset, count: count, conditions: conditions, setLimit: setLimit, setOffset: setOffset } = resource;
3350
+ const intCount = count ? count : 0;
3351
+ const rowOptions = [
3352
+ 10,
3353
+ 25,
3354
+ 50,
3355
+ 100
3356
+ ];
3239
3357
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3240
- className: "ds-u-display--flex ds-u-flex-wrap--wrap",
3358
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--between",
3241
3359
  children: [
3242
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
3243
- className: "ds-l-col--12 ds-u-padding-left--0 ds-text-heading--2xl",
3244
- children: "Resources"
3245
- }),
3246
- distributions.length ? /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
3247
- className: "ds-c-list ds-c-list--bare dc-c-resource-full-width",
3248
- children: distributions.map((dist)=>{
3249
- const fileFormat = (0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(dist);
3250
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
3251
- className: `ds-u-display--flex ds-u-flex-wrap--wrap ${fileFormat !== "csv" && "ds-u-margin-bottom--2"}`,
3252
- children: [
3253
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3254
- 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 ds-u-align-items--center ds-u-display--flex",
3360
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3361
+ className: "dc-c-resource-header--buttons ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end ds-l-col--12 ds-u-margin-top--2 ds-u-padding-x--0",
3362
+ children: [
3363
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3364
+ className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-margin-bottom--2",
3365
+ children: conditions && conditions.length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
3366
+ onOpen: ()=>{
3367
+ navigator.clipboard.writeText(window.location.href);
3368
+ },
3369
+ className: "ds-c-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12",
3370
+ placement: "bottom",
3371
+ dialog: true,
3372
+ ariaLabel: "Copy link to filtered data",
3373
+ title: "Link copied to clipboard",
3374
+ "aria-disabled": !conditions || conditions.length === 0,
3375
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3376
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
3255
3377
  children: [
3256
3378
  /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3257
- className: "fa ds-u-color--primary ds-u-padding-right--1 ds-u-font-size--3xl fa-file-" + (fileFormat == "xlsx" ? "xls" : fileFormat)
3379
+ className: "fas fa-copy"
3258
3380
  }),
3259
- /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
3260
- className: "ds-u-margin-top--0",
3381
+ " Copy link to filtered data"
3382
+ ]
3383
+ })
3384
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3385
+ "aria-disabled": true,
3386
+ "aria-label": "Copy link to filtered data",
3387
+ className: "ds-c-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12",
3388
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3389
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
3390
+ children: [
3391
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3392
+ className: "fas fa-copy"
3393
+ }),
3394
+ " Copy link to filtered data"
3395
+ ]
3396
+ })
3397
+ })
3398
+ }),
3399
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3400
+ className: "ds-l-col--12 ds-l-md-col--auto ds-u-padding-x--0 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end",
3401
+ children: [
3402
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3403
+ className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-sm-margin-left--2 ds-u-margin-bottom--2",
3404
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3405
+ className: "ds-u-text-align--center ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1 ds-u-display--inline-block ds-l-col--12",
3406
+ href: downloadURL,
3407
+ "aria-disabled": !conditions || conditions.length === 0,
3408
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3409
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
3261
3410
  children: [
3262
- dist.data.title ? dist.data.title : title,
3263
- " (" + fileFormat.toUpperCase() + ")"
3411
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3412
+ className: "fas fa-file-csv"
3413
+ }),
3414
+ " Download filtered data (CSV)"
3264
3415
  ]
3265
3416
  })
3266
- ]
3267
- }),
3268
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3269
- 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",
3270
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
3271
- href: dist.data.downloadURL,
3272
- style: {
3273
- order: sm ? "1" : "0",
3274
- width: sm ? "100%" : "auto"
3275
- },
3276
- "aria-label": `Download ${dist.data.title || title} ${fileFormat}`,
3277
- className: "ds-c-button",
3278
- children: [
3279
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3280
- className: "fa fa-file-download ds-u-color--primary ds-u-padding-right--1"
3281
- }),
3282
- "Download"
3283
- ]
3284
3417
  })
3285
3418
  }),
3286
- dist.data.description && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3287
- className: "ds-u-measure--wide ds-u-margin-bottom--7",
3288
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3289
- className: "dc-c-metadata-description ds-u-margin--0",
3290
- dangerouslySetInnerHTML: {
3291
- __html: (0, $hgUW1$dompurify).sanitize(dist.data.description)
3292
- }
3419
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3420
+ className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-sm-margin-left--2 ds-u-margin-bottom--2",
3421
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3422
+ className: "ds-u-text-align--center ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1 ds-u-display--inline-block ds-l-col--12",
3423
+ href: unfilteredDownloadURL,
3424
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3425
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
3426
+ children: [
3427
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3428
+ className: "fas fa-file-csv"
3429
+ }),
3430
+ " Download full dataset (CSV)"
3431
+ ]
3432
+ })
3293
3433
  })
3294
- }),
3295
- fileFormat === "csv" && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $0958733ee130fc44$export$2e2bcd8739ae039), {
3296
- resource: resource
3297
3434
  })
3298
3435
  ]
3299
- }, dist.identifier);
3300
- })
3301
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3302
- className: "ds-u-margin-bottom--2",
3303
- children: "No resources have been added to this dataset."
3304
- })
3305
- ]
3306
- });
3307
- };
3308
- var $7357cc0f79f9c514$export$2e2bcd8739ae039 = $7357cc0f79f9c514$var$Resource;
3309
-
3310
-
3311
- const $364dc44850cd8f7f$var$DatasetOverview = ({ dataset: dataset, resource: resource, distributions: distributions, metadataMapping: metadataMapping })=>{
3312
- const md = (0, $hgUW1$useMediaQuery)({
3313
- minWidth: 0,
3314
- maxWidth: 768
3315
- });
3316
- const rows = (0, $5644ebd2c3dbfd7b$export$eea3a12df15499ca)(metadataMapping, dataset);
3317
- return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3318
- children: [
3319
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $7357cc0f79f9c514$export$2e2bcd8739ae039), {
3320
- distributions: distributions,
3321
- resource: resource,
3322
- title: dataset.title
3436
+ })
3437
+ ]
3323
3438
  }),
3324
3439
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3325
- 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",
3440
+ className: "ds-l-col--12 ds-u-display--flex ds-u-align-items--end ds-u-flex-direction--row-reverse ds-u-sm-flex-direction--row ds-u-padding-x--0 ds-u-margin-bottom--2 ds-u-flex-wrap--wrap",
3326
3441
  children: [
3327
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
3328
- className: "ds-text-heading--2xl ds-text-heading--2xl",
3329
- children: "Additional Information"
3442
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3443
+ className: "ds-l-col--12 ds-l-sm-col--8 ds-u-padding-x--0",
3444
+ children: !resource.loading && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2ed0091f7e32d1e6$export$2e2bcd8739ae039), {
3445
+ totalRows: intCount,
3446
+ limit: limit,
3447
+ offset: offset
3448
+ })
3330
3449
  }),
3331
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Table), {
3332
- compact: true,
3333
- stackable: true,
3334
- stackableBreakpoint: "md",
3335
- warningDisabled: true,
3336
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
3337
- children: rows.map((r)=>/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
3338
- children: [
3339
- md ? "" : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
3340
- component: "th",
3341
- className: "ds-u-font-weight--bold",
3342
- children: r.label
3343
- }),
3344
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
3345
- stackedTitle: r.label,
3346
- children: r.value
3347
- })
3348
- ]
3349
- }, `${r.label}_${dataset.identifier}`))
3450
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3451
+ className: "ds-l-col--12 ds-l-sm-col--4 ds-u-display--flex ds-u-justify-content--end ds-u-padding-x--0",
3452
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3453
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
3454
+ options: rowOptions.map((row)=>({
3455
+ label: row.toString(),
3456
+ value: row
3457
+ })),
3458
+ size: "medium",
3459
+ label: "Rows per page:",
3460
+ labelClassName: "ds-u-margin-top--0",
3461
+ name: "datatable_rows_per_page",
3462
+ onChange: (e)=>{
3463
+ setLimit(parseInt(e.target.value));
3464
+ setPage(1);
3465
+ setOffset(0);
3466
+ },
3467
+ defaultValue: limit.toString()
3468
+ })
3350
3469
  })
3351
3470
  })
3352
3471
  ]
@@ -3354,7 +3473,7 @@ const $364dc44850cd8f7f$var$DatasetOverview = ({ dataset: dataset, resource: res
3354
3473
  ]
3355
3474
  });
3356
3475
  };
3357
- var $364dc44850cd8f7f$export$2e2bcd8739ae039 = $364dc44850cd8f7f$var$DatasetOverview;
3476
+ var $6380a4a580b24362$export$2e2bcd8739ae039 = $6380a4a580b24362$var$DataTableHeader;
3358
3477
 
3359
3478
 
3360
3479
 
@@ -3364,73 +3483,75 @@ var $364dc44850cd8f7f$export$2e2bcd8739ae039 = $364dc44850cd8f7f$var$DatasetOver
3364
3483
 
3365
3484
 
3366
3485
 
3367
- const $789279954d8eff7f$var$ApiDocumentation = ({ endpoint: endpoint })=>{
3368
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3369
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
3370
- url: endpoint
3371
- })
3372
- });
3373
- };
3374
- var $789279954d8eff7f$export$2e2bcd8739ae039 = $789279954d8eff7f$var$ApiDocumentation;
3375
3486
 
3376
3487
 
3377
- const $cf6eaefd6b928de3$var$DatasetAPI = ({ id: id, rootUrl: rootUrl, apiUrl: apiUrl, additionalParams: additionalParams })=>{
3378
- return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3488
+ const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions, schema: schema, customColumns: customColumns })=>{
3489
+ const { fields: fields } = schema;
3490
+ const prependedMessage = /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
3491
+ children: "Data filters: "
3492
+ });
3493
+ if (!conditions || !conditions.length) return /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
3494
+ className: "ds-u-margin-y--0",
3379
3495
  children: [
3380
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3381
- className: "ds-u-display--flex ds-u-flex-wrap--wrap",
3382
- children: [
3383
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3384
- className: "ds-l-col--12 ds-l-md-col--9 ds-u-padding-left--0",
3385
- children: [
3386
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
3387
- className: "ds-text-heading--2xl",
3388
- children: "Try the API"
3389
- }),
3390
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
3391
- children: "The Open Data API (ODA) provides programmatic access to this dataset including the ability to filter, query, and aggregate data."
3392
- })
3393
- ]
3394
- }),
3395
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3396
- 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",
3397
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
3398
- href: apiUrl,
3399
- children: [
3400
- "View API",
3401
- " ",
3402
- /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3403
- style: {
3404
- whiteSpace: "nowrap"
3405
- },
3406
- children: [
3407
- "specification ",
3408
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3409
- className: "fa fa-arrow-right ds-u-font-weight--bold"
3410
- })
3411
- ]
3412
- })
3413
- ]
3414
- })
3415
- })
3416
- ]
3496
+ prependedMessage,
3497
+ " none"
3498
+ ]
3499
+ });
3500
+ function formatValue(text, property) {
3501
+ if (customColumns && customColumns.length > 0) {
3502
+ let newValue = text;
3503
+ let customColumn = customColumns.find((c)=>c.accessor === property);
3504
+ if (customColumn && customColumn.cell) return customColumn.cell({
3505
+ value: text
3506
+ });
3507
+ return text;
3508
+ } else return text;
3509
+ }
3510
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3511
+ className: "dc-querybuilder-title",
3512
+ children: [
3513
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
3514
+ className: "ds-u-margin-y--0",
3515
+ children: prependedMessage
3417
3516
  }),
3418
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $789279954d8eff7f$export$2e2bcd8739ae039), {
3419
- endpoint: `${rootUrl}/metastore/schemas/dataset/items/${id}/docs${additionalParams && additionalParams.ACA ? "?ACA=" + additionalParams.ACA + "&redirect=false" : ""}`
3420
- })
3517
+ conditions.map((c)=>{
3518
+ const field = fields[c.property];
3519
+ const description = field && field.description ? field.description : c.property;
3520
+ const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
3521
+ const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
3522
+ const formattedText = formatValue(cleanedText, c.property);
3523
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3524
+ className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
3525
+ children: [
3526
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3527
+ className: "ds-u-font-weight--bold",
3528
+ children: description
3529
+ }),
3530
+ " ",
3531
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3532
+ className: "ds-u-font-weight--normal",
3533
+ children: operator.label.toUpperCase()
3534
+ }),
3535
+ " ",
3536
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3537
+ className: "ds-u-color--success",
3538
+ children: formattedText
3539
+ })
3540
+ ]
3541
+ });
3542
+ }).reduce((prev, curr)=>[
3543
+ prev,
3544
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
3545
+ className: "ds-u-margin-x--1",
3546
+ variation: "info",
3547
+ children: "AND"
3548
+ }),
3549
+ curr
3550
+ ])
3421
3551
  ]
3422
3552
  });
3423
3553
  };
3424
- var $cf6eaefd6b928de3$export$2e2bcd8739ae039 = $cf6eaefd6b928de3$var$DatasetAPI;
3425
-
3426
-
3427
-
3428
-
3429
-
3430
-
3431
-
3432
-
3433
-
3554
+ var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
3434
3555
 
3435
3556
 
3436
3557
 
@@ -3440,443 +3561,425 @@ var $cf6eaefd6b928de3$export$2e2bcd8739ae039 = $cf6eaefd6b928de3$var$DatasetAPI;
3440
3561
 
3441
3562
 
3442
3563
 
3443
- const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns, tableData: tableData, pageSize: pageSize, columnFilters: columnFilters })=>{
3444
- const [sorting, setSorting] = (0, $hgUW1$useState)([]);
3445
- const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)("");
3446
- const mobile = (0, $hgUW1$useMediaQuery)({
3447
- minWidth: 0,
3448
- maxWidth: 544
3564
+ function $6369abf590ca298f$var$getStartDate(condition, schema, id) {
3565
+ if (schema[id].fields[condition.property].mysql_type === "date") {
3566
+ const newDate = new Date(condition.value.toString());
3567
+ if (newDate instanceof Date && !isNaN(newDate.getTime())) return newDate;
3568
+ }
3569
+ return new Date();
3570
+ }
3571
+ const $6369abf590ca298f$var$QueryRow = ({ id: id, condition: condition, index: index, update: update, remove: remove, propertyOptions: propertyOptions, schema: schema })=>{
3572
+ const [operator, setOperator] = (0, $hgUW1$useState)(condition.operator);
3573
+ const [property, setProperty] = (0, $hgUW1$useState)(condition.property);
3574
+ const [value, setValue] = (0, $hgUW1$useState)(condition.value);
3575
+ const [startDate, setStartDate] = (0, $hgUW1$react).useState($6369abf590ca298f$var$getStartDate(condition, schema, id));
3576
+ const xl = (0, $hgUW1$useMediaQuery)({
3577
+ minWidth: 1280
3449
3578
  });
3450
- const sortElement = (isSorted)=>{
3451
- if (isSorted === "asc") return "dc-c-sort--asc";
3452
- if (isSorted === "desc") return "dc-c-sort--desc";
3453
- return "dc-c-sort--default";
3454
- };
3455
- const table = (0, $hgUW1$useReactTable)({
3456
- data: tableData,
3457
- columns: tableColumns,
3458
- columnResizeMode: "onChange",
3459
- getCoreRowModel: (0, $hgUW1$getCoreRowModel)(),
3460
- getFilteredRowModel: (0, $hgUW1$getFilteredRowModel)(),
3461
- getPaginationRowModel: (0, $hgUW1$getPaginationRowModel)(),
3462
- getSortedRowModel: (0, $hgUW1$getSortedRowModel)(),
3463
- onSortingChange: setSorting,
3464
- initialState: {
3465
- pagination: {
3466
- pageSize: pageSize,
3467
- pageIndex: 0
3579
+ (0, $hgUW1$useEffect)(()=>{
3580
+ if (property !== condition.property) {
3581
+ if (property) update(index, "property", property);
3582
+ else update(index, "property", "");
3583
+ if (schema[id].fields[condition.property].mysql_type === "date") {
3584
+ if (!value) setValue(startDate.toJSON().slice(0, 10));
3468
3585
  }
3469
- },
3470
- state: {
3471
- sorting: sorting,
3472
- columnFilters: columnFilters
3473
3586
  }
3474
- });
3475
- const sortOptions = [
3476
- {
3477
- value: "default",
3478
- label: "No Sort"
3479
- },
3480
- {
3481
- value: "titleasc",
3482
- label: "Title A-Z"
3483
- },
3484
- {
3485
- value: "titledesc",
3486
- label: "Title Z-A"
3487
- },
3488
- {
3489
- value: "typeasc",
3490
- label: "Type A-Z"
3491
- },
3492
- {
3493
- value: "typedesc",
3494
- label: "Type Z-A"
3587
+ }, [
3588
+ property,
3589
+ value,
3590
+ startDate,
3591
+ schema,
3592
+ id,
3593
+ condition
3594
+ ]);
3595
+ (0, $hgUW1$useEffect)(()=>{
3596
+ if (operator !== condition.operator) {
3597
+ if (operator) update(index, "operator", operator);
3598
+ else update(index, "operator", "");
3495
3599
  }
3496
- ];
3497
- const sortStatesLookup = {
3498
- default: [],
3499
- titleasc: [
3500
- {
3501
- id: "titleResizable",
3502
- desc: false
3503
- }
3504
- ],
3505
- titledesc: [
3506
- {
3507
- id: "titleResizable",
3508
- desc: true
3509
- }
3510
- ],
3511
- typeasc: [
3512
- {
3513
- id: "type",
3514
- desc: false
3515
- }
3516
- ],
3517
- typedesc: [
3518
- {
3519
- id: "type",
3520
- desc: true
3521
- }
3522
- ]
3523
- };
3524
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3600
+ }, [
3601
+ operator
3602
+ ]);
3603
+ (0, $hgUW1$useEffect)(()=>{
3604
+ if (value !== condition.value) {
3605
+ if (value) update(index, "value", value);
3606
+ else update(index, "value", "");
3607
+ }
3608
+ }, [
3609
+ value
3610
+ ]);
3611
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("fieldset", {
3612
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--between ds-u-align-items--center ds-u-border--0",
3525
3613
  children: [
3526
- mobile && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3527
- className: "ds-u-margin-bottom--3 ds-l-col--12 ds-l-sm-col--6",
3528
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
3529
- labelClassName: "ds-u-margin-top--1 ds-u-sm-margin-top--0",
3530
- options: sortOptions,
3531
- label: "Sort",
3532
- value: Object.keys(sortStatesLookup).find((key)=>{
3533
- return JSON.stringify(sortStatesLookup[key]) == JSON.stringify(sorting);
3534
- }),
3535
- name: "dc-data-dictionary-type",
3536
- onChange: (e)=>{
3537
- setSorting(sortStatesLookup[e.target.value]);
3538
- }
3539
- })
3540
- }),
3541
3614
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3542
- className: "dc-c-datadictionary-table",
3615
+ className: "ds-l-col--12 ds-l-md-col--8 ds-u-display--flex ds-u-justify-content--between ds-u-padding-x--0",
3543
3616
  children: [
3544
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
3545
- className: "dc-c-datatable",
3546
- style: {
3547
- width: "100%"
3548
- },
3549
- stackable: true,
3550
- children: [
3551
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableHead), {
3552
- className: "dc-thead--truncated dc-thead--resizeable",
3553
- children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableRow), {
3554
- children: headerGroup.headers.map((header)=>{
3555
- return header.id === "titleResizable" ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $64a351d3fd8413c3$export$2e2bcd8739ae039), {
3556
- table: table,
3557
- header: header,
3558
- setAriaLiveFeedback: setAriaLiveFeedback,
3559
- sortElement: sortElement
3560
- }, header.id + "_resize") : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableCell), {
3561
- key: header.id,
3562
- className: `ds-u-border-y--2 ds-u-border--dark ds-u-border-x--0`,
3563
- id: "dataDictionary_" + header.id,
3564
- children: [
3565
- (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext()),
3566
- header.id === "type" && /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
3567
- onClick: header.column.getToggleSortingHandler(),
3568
- className: header.column.getCanSort() ? `cursor-pointer select-none ds-u-focus-visible ${sortElement(header.column.getIsSorted())}` : "",
3569
- "aria-label": `${header.column.columnDef.header} sort order`
3570
- })
3571
- ]
3572
- });
3573
- })
3574
- }, "header" + headerGroup.id))
3575
- }),
3576
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
3577
- children: table.getRowModel().rows.map((row, index)=>{
3578
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableRow), {
3579
- children: row.getVisibleCells().map((cell)=>{
3580
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
3581
- key: cell.id,
3582
- style: {
3583
- maxWidth: mobile ? "100%" : cell.column.getSize(),
3584
- whiteSpace: cell.column.id === "description" ? "pre-wrap" : "normal"
3585
- },
3586
- className: `${cell.column.id === "titleResizable" ? "ds-u-word-break" : ""}`,
3587
- headers: "dataDictionary_" + cell.column.id,
3588
- stackedTitle: cell.column.id === "titleResizable" ? "Title" : cell.column.columnDef.header,
3589
- children: (0, $hgUW1$flexRender)(cell.column.columnDef.cell, cell.getContext())
3590
- });
3591
- })
3592
- }, index + JSON.stringify(row));
3617
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
3618
+ options: propertyOptions,
3619
+ className: "ds-l-col--8 ds-u-padding-left--0",
3620
+ value: property,
3621
+ label: "Column Name",
3622
+ name: `${condition.key}_property`,
3623
+ onChange: (e)=>setProperty(e.target.value)
3624
+ }),
3625
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
3626
+ options: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[property].mysql_type),
3627
+ className: "ds-l-col--4 ds-u-padding-x--0",
3628
+ value: operator,
3629
+ label: "Operator",
3630
+ name: `${condition.key}_operator`,
3631
+ onChange: (e)=>setOperator(e.target.value)
3632
+ })
3633
+ ]
3634
+ }),
3635
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3636
+ className: "ds-l-col--12 ds-l-md-col--4 ds-u-padding-x--0 ds-u-md-padding-left--2 ds-u-display--flex ds-u-justify-content--between",
3637
+ children: [
3638
+ schema[id].fields[property].mysql_type === "date" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3639
+ children: [
3640
+ /*#__PURE__*/ (0, $hgUW1$jsx)("label", {
3641
+ className: "ds-c-label",
3642
+ htmlFor: `${condition.key}_date_value`,
3643
+ id: `${condition.key}_date_value-label`,
3644
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3645
+ children: "Value"
3593
3646
  })
3647
+ }),
3648
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
3649
+ name: `${condition.key}_date_value`,
3650
+ selected: (0, $7264a673914aa746$export$e284ae5d89467c8f)(startDate),
3651
+ onChange: (date)=>{
3652
+ setStartDate(date);
3653
+ setValue(date.toJSON().slice(0, 10));
3654
+ },
3655
+ showMonthDropdown: true,
3656
+ showYearDropdown: true,
3657
+ dropdownMode: "select",
3658
+ className: "ds-c-field",
3659
+ withPortal: true
3594
3660
  })
3595
3661
  ]
3662
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
3663
+ className: "ds-l-col--11 ds-u-padding-x--0",
3664
+ label: "Value",
3665
+ name: `${condition.key}_value`,
3666
+ value: (0, $7264a673914aa746$export$6b5e57d20078142b)(value, operator),
3667
+ onChange: (e)=>setValue(e.target.value)
3596
3668
  }),
3597
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3598
- className: "sr-only",
3599
- "aria-live": "assertive",
3600
- "aria-atomic": "true",
3601
- children: ariaLiveFeedback
3602
- }),
3603
- table.getRowModel().rows.length === 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
3604
- variation: "warn",
3605
- children: "No results found for the current filters"
3669
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3670
+ variation: "ghost",
3671
+ size: "small",
3672
+ className: "ds-u-margin-top--6 ds-u-padding-right--0",
3673
+ "aria-label": "Delete filter",
3674
+ onClick: ()=>remove(index),
3675
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3676
+ className: "fas fa-trash"
3677
+ })
3606
3678
  })
3607
3679
  ]
3608
- }),
3609
- table.getRowCount() > pageSize ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
3610
- totalPages: table.getPageCount(),
3611
- currentPage: table.getState().pagination.pageIndex + 1,
3612
- onPageChange: (evt, page)=>{
3613
- evt.preventDefault();
3614
- table.setPageIndex(page - 1);
3615
- },
3616
- renderHref: (page)=>{
3617
- return "";
3618
- }
3619
- }) : ""
3680
+ })
3620
3681
  ]
3621
3682
  });
3622
3683
  };
3623
- var $6765a74df807d015$export$2e2bcd8739ae039 = $6765a74df807d015$var$DataDictionaryTable;
3624
-
3625
-
3626
- const $a24829b27758fe6c$var$SitewideDataDictionaryTable = ({ datasetDictionary: datasetDictionary, pageSize: pageSize })=>{
3627
- const columnHelper = (0, $hgUW1$createColumnHelper)();
3628
- const tableColumns = [
3629
- columnHelper.accessor("name", {
3630
- header: "Name"
3631
- }),
3632
- columnHelper.accessor("title", {
3633
- header: "Title"
3634
- }),
3635
- columnHelper.accessor("type", {
3636
- header: "Type"
3637
- }),
3638
- columnHelper.accessor("format", {
3639
- header: "Format"
3640
- })
3641
- ];
3642
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6765a74df807d015$export$2e2bcd8739ae039), {
3643
- tableColumns: tableColumns,
3644
- tableData: datasetDictionary,
3645
- pageSize: pageSize
3646
- });
3647
- };
3648
- var $a24829b27758fe6c$export$2e2bcd8739ae039 = $a24829b27758fe6c$var$SitewideDataDictionaryTable;
3649
-
3650
-
3651
-
3652
-
3653
-
3654
-
3684
+ var $6369abf590ca298f$export$2e2bcd8739ae039 = $6369abf590ca298f$var$QueryRow;
3655
3685
 
3656
3686
 
3657
3687
 
3658
- const $a6e312940f7003ef$var$DatasetDictionaryTable = ({ datasetDictionary: datasetDictionary, pageSize: pageSize })=>{
3659
- const [titleFilter, setTitleFilter] = (0, $hgUW1$useState)("");
3660
- const [typeFilter, setTypeFilter] = (0, $hgUW1$useState)("all");
3661
- const columnFilters = (0, $hgUW1$useMemo)(()=>[
3688
+ function $ee4ad47aa483e5b5$var$updateQueryForDatastore(condition) {
3689
+ let cond = condition;
3690
+ delete cond.key;
3691
+ if (cond.operator === "=" || cond.operator === "<>") {
3692
+ if (Array.isArray(cond.value)) cond.value = cond.value.join();
3693
+ cond.value = cond.value.replace(/(^\%+|\%+$)/gm, "");
3694
+ }
3695
+ if (cond.operator.toLowerCase() === "like") {
3696
+ if (Array.isArray(cond.value)) cond.value = cond.value.join();
3697
+ const cleanedValue = cond.value.replace(/(^\%+|\%+$)/gm, "");
3698
+ cond.value = `%${cleanedValue}%`;
3699
+ }
3700
+ if (cond.operator.toLowerCase() === "in") {
3701
+ if (!Array.isArray(cond.value)) cond.value = cond.value.split(",");
3702
+ }
3703
+ if (Array.isArray(cond.value)) cond.value = cond.value.map((v)=>v.trim().replace(/(^\%+|\%+$)/gm, ""));
3704
+ return cond;
3705
+ }
3706
+ const $ee4ad47aa483e5b5$var$QueryBuilder = ({ resource: resource, id: id, includeSearchParams: includeSearchParams, customColumns: customColumns, isModal: isModal = false })=>{
3707
+ const { conditions: conditions, schema: schema, setConditions: setConditions } = resource;
3708
+ const fields = Object.keys(schema[id].fields);
3709
+ const [queryConditions, setQueryConditions] = (0, $hgUW1$useState)([]);
3710
+ const [titleConditions, setTitleConditions] = (0, $hgUW1$useState)([]); // Add use effect to load conditions on first load if needed
3711
+ const [conditionsChanged, setConditionsChanged] = (0, $hgUW1$useState)(false);
3712
+ const syncConditions = ()=>{
3713
+ if (conditions && conditions.length) {
3714
+ const keyedConditions = conditions.map((oc)=>({
3715
+ ...oc,
3716
+ key: Date.now().toString() + oc.value + oc.property
3717
+ }));
3718
+ setQueryConditions(keyedConditions);
3719
+ } else setQueryConditions([
3662
3720
  {
3663
- id: "titleResizable",
3664
- value: titleFilter
3665
- },
3721
+ property: fields[0],
3722
+ value: "",
3723
+ operator: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[fields[0]].mysql_type)[0].value,
3724
+ key: Date.now().toString()
3725
+ }
3726
+ ]);
3727
+ };
3728
+ const addCondition = (condition)=>{
3729
+ if (Array.isArray(condition)) {
3730
+ const keyedConditions = condition.map((oc)=>({
3731
+ ...oc,
3732
+ key: Date.now().toString() + oc.value + oc.property
3733
+ }));
3734
+ setQueryConditions(keyedConditions);
3735
+ } else setQueryConditions([
3736
+ ...queryConditions,
3666
3737
  {
3667
- id: "type",
3668
- value: typeFilter === "all" ? "" : typeFilter
3738
+ property: fields[0],
3739
+ value: "",
3740
+ operator: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[fields[0]].mysql_type)[0].value,
3741
+ key: Date.now().toString()
3669
3742
  }
3670
- ], [
3671
- titleFilter,
3672
- typeFilter
3743
+ ]);
3744
+ };
3745
+ // Sync the UI with the actual data conditions whenever those change
3746
+ (0, $hgUW1$react).useEffect(()=>{
3747
+ syncConditions();
3748
+ setTitleConditions(conditions);
3749
+ }, [
3750
+ conditions
3673
3751
  ]);
3674
- const tableData = datasetDictionary.map((item)=>{
3752
+ const propertyOptions = fields.map((f)=>{
3753
+ if (schema[id].fields[f].description) return {
3754
+ label: schema[id].fields[f].description,
3755
+ value: f
3756
+ };
3675
3757
  return {
3676
- titleResizable: item.title,
3677
- description: item.description,
3678
- type: item.type
3758
+ label: f,
3759
+ value: f
3679
3760
  };
3680
3761
  });
3681
- const columnHelper = (0, $hgUW1$createColumnHelper)();
3682
- const tableColumns = [
3683
- columnHelper.accessor("titleResizable", {
3684
- header: ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3685
- className: "dc-c-tooltip-width-override",
3686
- children: [
3687
- "Title",
3688
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
3689
- title: "Title represents the column headers of the data file",
3690
- // @ts-ignore
3691
- style: {
3692
- border: "none",
3693
- background: "none"
3694
- },
3695
- maxWidth: "400px",
3696
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TooltipIcon), {})
3697
- })
3698
- ]
3699
- }),
3700
- size: 300
3701
- }),
3702
- columnHelper.accessor("description", {
3703
- header: "Description",
3704
- minSize: 600
3705
- }),
3706
- columnHelper.accessor("type", {
3707
- header: "Type",
3708
- size: 150,
3709
- enableResizing: false
3710
- })
3711
- ];
3712
- const typeOptions = [
3713
- {
3714
- value: "all",
3715
- label: "All Types"
3716
- },
3717
- {
3718
- value: "string",
3719
- label: "String"
3720
- },
3721
- {
3722
- value: "date",
3723
- label: "Date"
3724
- },
3725
- {
3726
- value: "datetime",
3727
- label: "Datetime"
3728
- },
3729
- {
3730
- value: "year",
3731
- label: "Year"
3732
- },
3733
- {
3734
- value: "integer",
3735
- label: "Integer"
3736
- },
3737
- {
3738
- value: "number",
3739
- label: "Number"
3740
- },
3741
- {
3742
- value: "boolean",
3743
- label: "Boolean"
3744
- }
3745
- ];
3746
- return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3747
- children: [
3748
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3749
- className: "dc-query-builder ds-u-margin-bottom--3",
3750
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3751
- className: "ds-c-accordion ds-c-accordion--bordered",
3752
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
3753
- heading: "Data Dictionary Filters",
3754
- defaultOpen: true,
3755
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3756
- className: "ds-u-display--flex ds-u-flex-wrap--wrap",
3762
+ const updateBrowserURL = (newConditions)=>{
3763
+ if (includeSearchParams) {
3764
+ const url = new URL(window.location.href);
3765
+ const urlString = (0, $hgUW1$qs).stringify({
3766
+ conditions: newConditions
3767
+ }, {
3768
+ encodeValuesOnly: true,
3769
+ addQueryPrefix: true
3770
+ });
3771
+ window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
3772
+ }
3773
+ };
3774
+ const submitConditions = (e)=>{
3775
+ // only update the data conditions when "Apply filters" is pressed
3776
+ e.preventDefault();
3777
+ const submitConditions = queryConditions.filter((oc)=>{
3778
+ if (oc.property) return oc;
3779
+ return false;
3780
+ }).map((oc)=>{
3781
+ let cond = Object.assign({}, oc);
3782
+ return $ee4ad47aa483e5b5$var$updateQueryForDatastore(cond);
3783
+ });
3784
+ setConditions(submitConditions);
3785
+ setConditionsChanged(false);
3786
+ updateBrowserURL(submitConditions);
3787
+ };
3788
+ const updateCondition = (index, key, value)=>{
3789
+ let newConditions = [
3790
+ ...queryConditions
3791
+ ];
3792
+ newConditions[index][key] = value;
3793
+ setQueryConditions(newConditions);
3794
+ setConditionsChanged(true);
3795
+ };
3796
+ const removeCondition = (index)=>{
3797
+ // just removes the condition from the UI - "Apply Filters" must be clicked to change the data model
3798
+ let newConditions = queryConditions.map((oc)=>Object.assign({}, oc));
3799
+ newConditions.splice(index, 1);
3800
+ setQueryConditions(newConditions);
3801
+ setConditionsChanged(true);
3802
+ };
3803
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3804
+ className: "dc-query-builder ds-u-margin-bottom--3",
3805
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3806
+ className: "ds-c-accordion ds-c-accordion--bordered",
3807
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
3808
+ heading: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bef7bff2823feea2$export$2e2bcd8739ae039), {
3809
+ schema: schema[id],
3810
+ conditions: titleConditions,
3811
+ customColumns: customColumns
3812
+ }),
3813
+ defaultOpen: !isModal,
3814
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("form", {
3815
+ onSubmit: (e)=>submitConditions(e),
3816
+ children: [
3817
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3818
+ children: queryConditions.map((qf, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $6369abf590ca298f$export$2e2bcd8739ae039), {
3819
+ id: id,
3820
+ schema: schema,
3821
+ condition: qf,
3822
+ index: index,
3823
+ propertyOptions: propertyOptions,
3824
+ update: updateCondition,
3825
+ remove: removeCondition
3826
+ }, qf.key))
3827
+ }),
3828
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3829
+ className: "dc-query-bulder--form-buttons ds-u-padding-x--2 ds-u-padding-top--0 ds-u-md-padding-top--2 ds-u-display--flex ds-u-flex-wrap--wrap",
3757
3830
  children: [
3758
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
3759
- className: "ds-l-col--12 ds-l-sm-col--6",
3760
- labelClassName: "ds-u-margin-top--1 ds-u-sm-margin-top--0",
3761
- label: "Title",
3762
- value: titleFilter,
3763
- name: "dc-data-dictionary-title",
3764
- onChange: (e)=>setTitleFilter(e.target.value)
3765
- }),
3766
3831
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3767
- className: "ds-l-col--12 ds-l-sm-col--6",
3768
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
3769
- labelClassName: "ds-u-margin-top--1 ds-u-sm-margin-top--0",
3770
- options: typeOptions,
3771
- label: "Type",
3772
- value: typeFilter,
3773
- name: "dc-data-dictionary-type",
3774
- onChange: (e)=>setTypeFilter(e.target.value)
3832
+ className: "ds-l-col--12 ds-l-md-col--4 ds-l-md-col--6 ds-u-padding-x--0 ds-u-margin-bottom--2 ds-u-md-margin-bottom--0",
3833
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3834
+ variation: "ghost",
3835
+ onClick: ()=>addCondition(null),
3836
+ className: "ds-u-padding-left--0",
3837
+ children: "+ Add filter"
3775
3838
  })
3776
3839
  }),
3777
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3778
- className: "ds-u-float--right ds-u-padding-y--2 ds-l-col--12 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end",
3779
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3780
- className: "ds-u-display--flex ds-u-justify-content--end ds-l-col--12 ds-l-md-col--6 ds-u-padding-x--0",
3781
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2eec38d4d0dbf714$export$2e2bcd8739ae039), {
3840
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3841
+ className: "ds-u-display--flex ds-u-justify-content--end ds-l-col--12 ds-l-md-col--6 ds-u-padding-x--0",
3842
+ children: [
3843
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3844
+ disabled: !conditionsChanged,
3845
+ className: "ds-u-float--right ds-l-md-col--6 ds-u-margin--right--0 ds-u-sm-margin-right--2",
3846
+ type: "submit",
3847
+ variation: "solid",
3848
+ children: "Apply filters"
3849
+ }),
3850
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2eec38d4d0dbf714$export$2e2bcd8739ae039), {
3851
+ disabled: queryConditions.length === 0,
3782
3852
  clearFiltersFn: ()=>{
3783
- setTitleFilter("");
3784
- setTypeFilter("all");
3853
+ setConditions([]);
3854
+ updateBrowserURL([]);
3785
3855
  }
3786
3856
  })
3787
- })
3857
+ ]
3788
3858
  })
3789
3859
  ]
3790
3860
  })
3791
- })
3861
+ ]
3792
3862
  })
3793
- }),
3794
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6765a74df807d015$export$2e2bcd8739ae039), {
3795
- tableColumns: tableColumns,
3796
- tableData: tableData,
3797
- pageSize: pageSize,
3798
- columnFilters: columnFilters
3799
3863
  })
3800
- ]
3864
+ })
3801
3865
  });
3802
3866
  };
3803
- var $a6e312940f7003ef$export$2e2bcd8739ae039 = $a6e312940f7003ef$var$DatasetDictionaryTable;
3867
+ $ee4ad47aa483e5b5$var$QueryBuilder.defaultProps = {
3868
+ includeSearchParams: true
3869
+ };
3870
+ var $ee4ad47aa483e5b5$export$2e2bcd8739ae039 = $ee4ad47aa483e5b5$var$QueryBuilder;
3804
3871
 
3805
3872
 
3806
3873
 
3807
- const $6012b86ffcaf3f71$var$DataDictionary = ({ datasetDictionaryEndpoint: datasetDictionaryEndpoint, datasetSitewideDictionary: datasetSitewideDictionary, title: title, pageSize: pageSize = 20, additionalParams: additionalParams, csvDownload: csvDownload })=>{
3808
- const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
3809
- queryKey: [
3810
- "dictionary" + datasetDictionaryEndpoint
3811
- ],
3812
- queryFn: ()=>{
3813
- return (0, $hgUW1$axios).get(`${datasetDictionaryEndpoint}?${(0, $hgUW1$qs).stringify(additionalParams, {
3814
- arrayFormat: "comma",
3815
- encode: false
3816
- })}`).then((res)=>res.data).catch((error)=>console.error(error));
3817
- },
3818
- enabled: datasetDictionaryEndpoint !== undefined
3819
- });
3820
- const datasetDictionary = data && data.data && data.data.fields && data.data.fields.length ? data.data.fields : null;
3821
- return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3874
+ function $a35cf16d1488f54e$export$1147582dfae658c6(columns, schema) {
3875
+ return columns.map((column)=>({
3876
+ header: schema && schema.fields[column].description ? schema.fields[column].description : column,
3877
+ accessor: column
3878
+ }));
3879
+ }
3880
+ const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, closeFullScreenModal: closeFullScreenModal })=>{
3881
+ const { id: id, distribution: distribution, resource: resource, rootUrl: rootUrl, customColumns: customColumns = [], dataDictionaryBanner: dataDictionaryBanner } = (0, $hgUW1$useContext)((0, $a0f13962e513caa1$export$a7997ae78b143b));
3882
+ const defaultPage = 1;
3883
+ const defaultPageSize = 10;
3884
+ const [page, setPage] = (0, $hgUW1$useState)(defaultPage);
3885
+ const customColumnHeaders = (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution.identifier]);
3886
+ const columns = customColumnHeaders ? customColumnHeaders : $a35cf16d1488f54e$export$1147582dfae658c6(resource.columns, resource.schema[id]);
3887
+ const { limit: limit, setOffset: setOffset } = resource;
3888
+ const pageSize = limit ? limit : defaultPageSize;
3889
+ const downloadURL = `${rootUrl}/datastore/query/${id}/0/download?${(0, $hgUW1$qs).stringify({
3890
+ conditions: resource.conditions
3891
+ }, {
3892
+ encode: true
3893
+ })}&format=csv`;
3894
+ if (Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length) return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3822
3895
  children: [
3823
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
3824
- className: "ds-text-heading--2xl ds-u-margin-y--3",
3825
- children: title
3896
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ee4ad47aa483e5b5$export$2e2bcd8739ae039), {
3897
+ resource: resource,
3898
+ id: distribution.identifier,
3899
+ customColumns: customColumnHeaders,
3900
+ isModal: isModal
3826
3901
  }),
3827
- datasetDictionary && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3828
- children: [
3829
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3830
- className: "ds-u-margin-bottom--1 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end",
3831
- children: [
3832
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Button), {
3833
- className: "ds-l-col--12 ds-l-sm-col--6 ds-l-md-col--4",
3834
- onClick: ()=>window.open(datasetDictionaryEndpoint),
3835
- type: "button",
3836
- children: [
3837
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3838
- className: "fa fa-file-download ds-u-color--primary ds-u-padding-right--1"
3839
- }),
3840
- " View Dictionary JSON"
3841
- ]
3842
- }),
3843
- csvDownload && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3844
- className: "ds-l-col--12 ds-l-sm-col--6 ds-l-md-col--4 ds-u-margin-top--2 ds-u-sm-margin-top--0 ds-u-padding--0 ds-u-sm-padding-left--2",
3845
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
3846
- href: datasetDictionaryEndpoint + "/csv",
3847
- className: "ds-c-button",
3848
- style: {
3849
- width: "100%"
3850
- },
3851
- children: [
3852
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3853
- className: "fa fa-file-download ds-u-color--primary ds-u-padding-right--1"
3854
- }),
3855
- "Download Dictionary CSV"
3856
- ]
3857
- })
3858
- })
3859
- ]
3860
- }),
3861
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a6e312940f7003ef$export$2e2bcd8739ae039), {
3862
- datasetDictionary: datasetDictionary,
3863
- pageSize: pageSize
3864
- })
3865
- ]
3902
+ dataDictionaryBanner && !isModal && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3903
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
3904
+ children: 'Click on the "Data Dictionary" tab above for full column definitions'
3905
+ })
3866
3906
  }),
3867
- datasetSitewideDictionary && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a24829b27758fe6c$export$2e2bcd8739ae039), {
3868
- datasetDictionary: datasetSitewideDictionary,
3869
- pageSize: pageSize
3907
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6380a4a580b24362$export$2e2bcd8739ae039), {
3908
+ resource: resource,
3909
+ downloadURL: downloadURL,
3910
+ unfilteredDownloadURL: distribution.data.downloadURL,
3911
+ setPage: setPage
3912
+ }),
3913
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3914
+ className: `ds-u-border-x--1 ds-u-border-bottom--1 ${isModal && "dkan-datatable-fullscreen-mode"}`,
3915
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
3916
+ canResize: true,
3917
+ columns: columns,
3918
+ setSort: resource.setSort,
3919
+ sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
3920
+ tablePadding: "ds-u-padding-y--2",
3921
+ loading: resource.loading,
3922
+ isModal: isModal,
3923
+ closeFullScreenModal: closeFullScreenModal
3924
+ })
3925
+ }),
3926
+ !resource.loading && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3927
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end ds-u-md-justify-content--between ds-u-margin-top--2 ds-u-align-items--center",
3928
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
3929
+ totalPages: Math.ceil(resource.count ? resource.count / pageSize : 1),
3930
+ currentPage: page,
3931
+ onPageChange: (evt, page)=>{
3932
+ evt.preventDefault();
3933
+ setOffset((page - 1) * limit);
3934
+ setPage(page);
3935
+ },
3936
+ renderHref: (page)=>{
3937
+ return "";
3938
+ },
3939
+ className: "ds-l-col--12 ds-u-padding-x--0"
3940
+ })
3870
3941
  })
3871
3942
  ]
3872
3943
  });
3944
+ else return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
3945
+ "aria-valuetext": "Dataset loading",
3946
+ role: "status",
3947
+ className: "ds-u-margin--3"
3948
+ });
3873
3949
  };
3874
- var $6012b86ffcaf3f71$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($6012b86ffcaf3f71$var$DataDictionary);
3950
+ var $a35cf16d1488f54e$export$2e2bcd8739ae039 = $a35cf16d1488f54e$var$DatasetTable;
3875
3951
 
3876
3952
 
3877
3953
 
3954
+ const $39bc4d98030a5599$export$a5806b00c0db0089 = /*#__PURE__*/ (0, $hgUW1$createContext)({});
3955
+ const $39bc4d98030a5599$var$DataTableStateWrapper = ()=>{
3956
+ const { id: id, datasetTableControls: datasetTableControls } = (0, $hgUW1$useContext)((0, $a0f13962e513caa1$export$a7997ae78b143b));
3957
+ // a wrapper component to keep column state synced between full screen and regular modes
3958
+ const localStorageData = id ? JSON.parse(localStorage.getItem(id)) : null;
3959
+ const [columnOrder, setColumnOrder] = (0, $hgUW1$useState)(()=>{
3960
+ if (datasetTableControls && localStorageData) return localStorageData.tableColumnOrder;
3961
+ else return [];
3962
+ });
3963
+ const [columnVisibility, setColumnVisibility] = (0, $hgUW1$useState)(()=>{
3964
+ if (datasetTableControls && localStorageData) return localStorageData.tableColumnVisibility;
3965
+ else return {};
3966
+ });
3967
+ return /*#__PURE__*/ (0, $hgUW1$jsx)($39bc4d98030a5599$export$a5806b00c0db0089.Provider, {
3968
+ value: {
3969
+ columnOrder: columnOrder,
3970
+ setColumnOrder: setColumnOrder,
3971
+ columnVisibility: columnVisibility,
3972
+ setColumnVisibility: setColumnVisibility
3973
+ },
3974
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a35cf16d1488f54e$export$2e2bcd8739ae039), {})
3975
+ });
3976
+ };
3977
+ var $39bc4d98030a5599$export$2e2bcd8739ae039 = $39bc4d98030a5599$var$DataTableStateWrapper;
3878
3978
 
3879
3979
 
3980
+ const $a0f13962e513caa1$export$a7997ae78b143b = /*#__PURE__*/ (0, $hgUW1$createContext)({
3981
+ id: null
3982
+ });
3880
3983
  const $a0f13962e513caa1$var$getDataDictionary = (dataDictionaryUrl, additionalParams)=>{
3881
3984
  const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
3882
3985
  queryKey: [
@@ -3894,7 +3997,7 @@ const $a0f13962e513caa1$var$getDataDictionary = (dataDictionaryUrl, additionalPa
3894
3997
  dataDictionaryLoading: isPending
3895
3998
  };
3896
3999
  };
3897
- const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalParams: additionalParams, customColumns: customColumns, setDatasetTitle: setDatasetTitle, customMetadataMapping: customMetadataMapping, apiPageUrl: apiPageUrl = "/api", dataDictionaryUrl: dataDictionaryUrl, borderlessTabs: borderlessTabs = false, defaultPageSize: defaultPageSize = 25, dataDictionaryCSV: dataDictionaryCSV = false, dataDictionaryBanner: dataDictionaryBanner = false, manageColumnsEnabled: manageColumnsEnabled = false })=>{
4000
+ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalParams: additionalParams, customColumns: customColumns, setDatasetTitle: setDatasetTitle, customMetadataMapping: customMetadataMapping, apiPageUrl: apiPageUrl = "/api", dataDictionaryUrl: dataDictionaryUrl, borderlessTabs: borderlessTabs = false, defaultPageSize: defaultPageSize = 25, dataDictionaryCSV: dataDictionaryCSV = false, dataDictionaryBanner: dataDictionaryBanner = false, datasetTableControls: datasetTableControls = false })=>{
3898
4001
  const options = location.search ? {
3899
4002
  ...(0, $hgUW1$qs).parse(location.search, {
3900
4003
  ignoreQueryPrefix: true
@@ -4044,14 +4147,17 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
4044
4147
  ]
4045
4148
  }),
4046
4149
  className: borderlessTabs ? "ds-u-border--0 ds-u-padding-x--0" : "",
4047
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a35cf16d1488f54e$export$2e2bcd8739ae039), {
4048
- id: id,
4049
- distribution: distribution,
4050
- resource: resource,
4051
- rootUrl: rootUrl,
4052
- customColumns: customColumns,
4053
- dataDictionaryBanner: dataDictionaryBanner && displayDataDictionaryTab,
4054
- manageColumnsEnabled: manageColumnsEnabled
4150
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)($a0f13962e513caa1$export$a7997ae78b143b.Provider, {
4151
+ value: {
4152
+ id: id,
4153
+ resource: resource,
4154
+ distribution: distribution,
4155
+ rootUrl: rootUrl,
4156
+ customColumns: customColumns,
4157
+ dataDictionaryBanner: dataDictionaryBanner && displayDataDictionaryTab,
4158
+ datasetTableControls: datasetTableControls
4159
+ },
4160
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $39bc4d98030a5599$export$2e2bcd8739ae039), {})
4055
4161
  })
4056
4162
  }),
4057
4163
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {