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