@civicactions/cmsds-open-data-components 3.0.0-alpha.8 → 3.0.0-rc.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,21 +1,21 @@
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
3
  import $hgUW1$react, {useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect} 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, Choice as $hgUW1$Choice, Badge as $hgUW1$Badge, Tooltip as $hgUW1$Tooltip, Table as $hgUW1$Table, TableHead as $hgUW1$TableHead, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableBody as $hgUW1$TableBody, Dialog as $hgUW1$Dialog, HelpDrawer as $hgUW1$HelpDrawer} from "@cmsgov/design-system";
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} 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";
8
8
  import $hgUW1$swaggeruireact from "swagger-ui-react";
9
9
  import "swagger-ui-react/swagger-ui.css";
10
- import {useQuery as $hgUW1$useQuery, QueryClient as $hgUW1$QueryClient, QueryClientProvider as $hgUW1$QueryClientProvider} from "@tanstack/react-query";
11
10
  import $hgUW1$axios from "axios";
11
+ import {useQuery as $hgUW1$useQuery, QueryClient as $hgUW1$QueryClient, QueryClientProvider as $hgUW1$QueryClientProvider} from "@tanstack/react-query";
12
12
  import $hgUW1$dompurify from "dompurify";
13
13
  import $hgUW1$reacttexttruncate from "react-text-truncate";
14
14
  import {useMediaQuery as $hgUW1$useMediaQuery} from "react-responsive";
15
15
  import {createColumnHelper as $hgUW1$createColumnHelper, useReactTable as $hgUW1$useReactTable, getCoreRowModel as $hgUW1$getCoreRowModel, getSortedRowModel as $hgUW1$getSortedRowModel, flexRender as $hgUW1$flexRender} from "@tanstack/react-table";
16
- import {usePopper as $hgUW1$usePopper} from "react-popper";
17
16
  import $hgUW1$reactdatepicker from "react-datepicker";
18
17
  import "react-datepicker/dist/react-datepicker.css";
18
+ import {usePopper as $hgUW1$usePopper} from "react-popper";
19
19
 
20
20
  function $parcel$interopDefault(a) {
21
21
  return a && a.__esModule ? a.default : a;
@@ -31,30 +31,23 @@ function $parcel$interopDefault(a) {
31
31
 
32
32
 
33
33
 
34
- // import validator from 'validator';
35
- const $cf8eeac354b9dd32$var$NavLink = ({ link: link , className: className , wrapLabel: wrapLabel })=>{
34
+ const $24918217e48ac525$var$NavLink = ({ link: link , className: className , wrapLabel: wrapLabel , clickHandler: clickHandler })=>{
36
35
  const innerHtml = wrapLabel ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
37
36
  children: link.label
38
37
  }) : link.label;
39
- // if (validator.isURL(link.url, { require_protocol: true })) {
40
- // return (
41
- // <a className={className} href={link.url}>
42
- // {innerHtml}
43
- // </a>
44
- // );
45
- // } else {
46
38
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$NavLink), {
47
39
  className: ({ isActive: isActive })=>isActive ? `dc-c-active-link ${className}` : `${className}`,
48
40
  to: link.url,
41
+ onClick: clickHandler ? clickHandler : undefined,
49
42
  children: innerHtml
50
43
  });
51
44
  // }
52
45
  };
53
- $cf8eeac354b9dd32$var$NavLink.defaultProps = {
46
+ $24918217e48ac525$var$NavLink.defaultProps = {
54
47
  wrapLabel: false,
55
48
  className: null
56
49
  };
57
- $cf8eeac354b9dd32$var$NavLink.propTypes = {
50
+ $24918217e48ac525$var$NavLink.propTypes = {
58
51
  link: (0, $hgUW1$proptypes).shape({
59
52
  url: (0, $hgUW1$proptypes).string,
60
53
  label: (0, $hgUW1$proptypes).string,
@@ -65,7 +58,7 @@ $cf8eeac354b9dd32$var$NavLink.propTypes = {
65
58
  * Will wrap the link label in a span for help with styling.
66
59
  */ wrapLabel: (0, $hgUW1$proptypes).bool
67
60
  };
68
- var $cf8eeac354b9dd32$export$2e2bcd8739ae039 = $cf8eeac354b9dd32$var$NavLink;
61
+ var $24918217e48ac525$export$2e2bcd8739ae039 = $24918217e48ac525$var$NavLink;
69
62
 
70
63
 
71
64
  const $4f153ca537d853e5$var$SubMenu = ({ link: link , linkClasses: linkClasses , wrapLabel: wrapLabel })=>{
@@ -111,7 +104,7 @@ const $4f153ca537d853e5$var$SubMenu = ({ link: link , linkClasses: linkClasses ,
111
104
  /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
112
105
  className: "dc-c-site-menu--sub-menu",
113
106
  children: link.submenu.map((s)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
114
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf8eeac354b9dd32$export$2e2bcd8739ae039), {
107
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $24918217e48ac525$export$2e2bcd8739ae039), {
115
108
  link: s,
116
109
  wrapLabel: wrapLabel
117
110
  })
@@ -124,7 +117,7 @@ var $4f153ca537d853e5$export$2e2bcd8739ae039 = $4f153ca537d853e5$var$SubMenu;
124
117
 
125
118
 
126
119
 
127
- const $f57121650539d8c5$var$NavBar = ({ links: links , menuName: menuName , menuId: menuId , menuClasses: menuClasses , linkClasses: linkClasses , wrapLabel: wrapLabel })=>{
120
+ const $f57121650539d8c5$var$NavBar = ({ links: links , menuName: menuName , menuId: menuId , menuClasses: menuClasses , linkClasses: linkClasses , wrapLabel: wrapLabel , clickHandler: clickHandler })=>{
128
121
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("nav", {
129
122
  className: `dc-c-${menuId}-menu`,
130
123
  "aria-labelledby": `dc-c-${menuId}-menu--heading`,
@@ -143,10 +136,11 @@ const $f57121650539d8c5$var$NavBar = ({ links: links , menuName: menuName , menu
143
136
  linkClasses: linkClasses
144
137
  }, link.id);
145
138
  else return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
146
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf8eeac354b9dd32$export$2e2bcd8739ae039), {
139
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $24918217e48ac525$export$2e2bcd8739ae039), {
147
140
  link: link,
148
141
  className: linkClasses,
149
- wrapLabel: wrapLabel
142
+ wrapLabel: wrapLabel,
143
+ clickHandler: clickHandler
150
144
  })
151
145
  }, link.id);
152
146
  })
@@ -250,6 +244,7 @@ var $026cb986f9fea2b1$export$2e2bcd8739ae039 = $026cb986f9fea2b1$var$PageNotFoun
250
244
 
251
245
 
252
246
 
247
+
253
248
  const $61ff88fb3f6ee2c8$var$queryClient = new (0, $hgUW1$QueryClient)();
254
249
  const $61ff88fb3f6ee2c8$var$withQueryProvider = (WrappedComponent)=>(props)=>{
255
250
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$QueryClientProvider), {
@@ -271,6 +266,53 @@ var $61ff88fb3f6ee2c8$export$2e2bcd8739ae039 = $61ff88fb3f6ee2c8$var$withQueryPr
271
266
 
272
267
 
273
268
 
269
+
270
+ const $b61856b23f5f58a2$var$LargeFileDialog = (props)=>{
271
+ const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
272
+ const { downloadUrl: downloadUrl } = props;
273
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
274
+ children: [
275
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
276
+ variation: "ghost",
277
+ onClick: ()=>setModalOpen(true),
278
+ children: "Download"
279
+ }),
280
+ modalOpen && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Dialog), {
281
+ onExit: ()=>setModalOpen(false),
282
+ heading: "Notice: Large File Size",
283
+ closeButtonSize: "big",
284
+ actions: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
285
+ children: [
286
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
287
+ href: downloadUrl,
288
+ className: "ds-u-margin-right--2 ",
289
+ variation: "solid",
290
+ children: "Yes, download"
291
+ }),
292
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
293
+ variation: "ghost",
294
+ onClick: ()=>setModalOpen(false),
295
+ children: "No, cancel"
296
+ })
297
+ ]
298
+ }),
299
+ children: [
300
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
301
+ children: "This is a very large file and, depending on your network characteristics and software, may take a long time to download or fail to download. Additionally, the number of rows in the file may larger than the maximum rows your version of Microsoft Excel supports. If you can't download the file, we recommend engaging your IT support staff. If you are able to download the file but are unable to open it in MS Excel or get a message that the data has been truncated, we recommend trying alternative programs such as MS Access, Universal Viewer, Editpad or any other software your organization has available for large datasets."
302
+ }),
303
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
304
+ children: "Would you like to proceed?"
305
+ })
306
+ ]
307
+ })
308
+ ]
309
+ });
310
+ };
311
+ var $b61856b23f5f58a2$export$2e2bcd8739ae039 = $b61856b23f5f58a2$var$LargeFileDialog;
312
+
313
+
314
+
315
+
274
316
  const $b38839fd67928f42$var$SearchItemIcon = (props)=>{
275
317
  switch(props.id){
276
318
  case "overview":
@@ -408,6 +450,45 @@ const $b38839fd67928f42$var$SearchItemIcon = (props)=>{
408
450
  })
409
451
  ]
410
452
  });
453
+ case "data-dictionary":
454
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
455
+ width: "14px",
456
+ height: "16px",
457
+ viewBox: "0 0 14 16",
458
+ version: "1.1",
459
+ xmlns: "http://www.w3.org/2000/svg",
460
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
461
+ children: [
462
+ /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
463
+ children: "Data Dictionary Icon"
464
+ }),
465
+ /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
466
+ id: "Dev-Handoff",
467
+ stroke: "none",
468
+ strokeWidth: "1",
469
+ fillRule: "evenodd",
470
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("g", {
471
+ id: "Group-15",
472
+ transform: "translate(0, 0)",
473
+ fillRule: "nonzero",
474
+ children: [
475
+ /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
476
+ d: "M0.0218026938,8.0971396 C0.0218026938,6.24591342 -0.0192244811,4.39368657 0.0358119731,2.54446171 C0.0728364968,1.28162525 1.07950328,0.231929969 2.34434106,0.0678212692 C2.69057039,0.022791443 3.04180304,0.00477951255 3.39003369,0.00477951255 C6.28395052,-0.000223801472 9.17786735,-0.00322578988 12.0717842,0.00578017535 C12.6811878,0.00778150096 13.2435603,0.169888875 13.6428248,0.683228893 C13.9059991,1.02145292 13.9950581,1.42171804 13.9970594,1.83299045 C14.0050647,4.76793446 14.0080667,7.70287846 13.9950581,10.6378225 C13.9920561,11.280248 13.7689083,11.8466231 13.1875232,12.2078624 C13.0464297,12.2959207 12.992394,12.4099963 12.9953959,12.5811096 C13.0054026,13.1394795 13.0064032,13.69885 12.9953959,14.2572198 C12.9913933,14.4473458 13.0364231,14.5173922 13.2425597,14.5243968 C13.6178082,14.5364047 13.8979938,14.7765638 13.9720428,15.0987772 C14.0450912,15.4129854 13.9069998,15.7482074 13.6088022,15.9013088 C13.4827187,15.9663519 13.3226127,15.9933698 13.1775166,15.9933698 C9.62516362,15.9983731 6.07181,16.0053777 2.51945705,15.9933698 C1.09851587,15.9883665 0.0708351712,15.0207255 0.0268060079,13.5997844 C-0.0202251439,12.0507583 0.00979474021,10.4987303 0.00579208899,8.94770299 C0.00579208899,8.66451541 0.00579208899,8.38032718 0.00579208899,8.0971396 C0.010795403,8.0971396 0.015798717,8.0971396 0.0218026938,8.0971396 L0.0218026938,8.0971396 Z M1.49477834,11.1421565 C1.99510974,11.1071333 2.44740933,11.0490949 2.90070958,11.0480942 C5.91970926,11.0400889 8.93870894,11.0440916 11.9577086,11.0430909 C12.4020029,11.0430909 12.5280864,10.9200094 12.5280864,10.4837204 C12.5280864,7.66585394 12.5280864,4.84698682 12.5280864,2.02912036 C12.5280864,1.58382542 12.4430301,1.49976974 12.0057404,1.49976974 C9.7952763,1.49976974 7.58581283,1.49976974 5.37534869,1.49976974 C4.50777404,1.49976974 3.64019939,1.4927651 2.7736254,1.50277173 C2.01712432,1.51177769 1.47576575,2.0711482 1.47576575,2.82664862 C1.47576575,5.50342162 1.47576575,8.17919395 1.47576575,10.855967 C1.47576575,10.9610365 1.48877436,11.0661061 1.49377768,11.1421565 L1.49477834,11.1421565 Z M6.8923535,14.5153908 C8.3263033,14.5153908 9.7602531,14.5093869 11.1932022,14.5203941 C11.4393653,14.5223955 11.5334276,14.467359 11.5224203,14.2041847 C11.5014064,13.7388765 11.5044084,13.2705663 11.5224203,12.8042574 C11.5314263,12.5630977 11.4553759,12.4960533 11.2132155,12.4960533 C8.37933843,12.5040586 5.54446071,12.5010566 2.71058365,12.5020573 C2.5935061,12.5020573 2.47642855,12.4990553 2.36135233,12.5140652 C1.64988108,12.6031242 1.26662722,13.4186644 1.63387047,14.0360733 C1.86102093,14.4173259 2.22426152,14.5083862 2.61652134,14.5113882 C4.04146518,14.5203941 5.46740967,14.5153908 6.8923535,14.5153908 L6.8923535,14.5153908 Z",
477
+ id: "Shape"
478
+ }),
479
+ /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
480
+ d: "M7.50976245,7.49574126 C6.62717786,7.49574126 5.7435926,7.49774259 4.86100801,7.49574126 C4.36167727,7.49373993 4.05747578,7.22956495 4.03045788,6.787272 C4.00243933,6.33597307 4.34366534,6.01476031 4.87101464,6.01275899 C5.95373179,6.00775567 7.03644895,6.01175832 8.1191661,6.01175832 C8.79361283,6.01175832 9.46805956,6.00675501 10.143507,6.01375965 C10.7519099,6.01976362 11.0981393,6.45305062 10.9360319,6.99140721 C10.8429703,7.30261334 10.55578,7.4947406 10.1585169,7.49674192 C9.2759323,7.50074457 8.39234705,7.49774259 7.50976245,7.49774259 L7.50976245,7.49574126 Z",
481
+ id: "Path"
482
+ }),
483
+ /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
484
+ d: "M7.50776113,5.00108889 C6.61617057,5.00108889 5.72458001,5.0060922 4.83298945,4.99908757 C4.25360569,4.99508491 3.90237305,4.53177804 4.07248572,4.01643669 C4.1565414,3.76226834 4.33365871,3.61517091 4.5868264,3.55913379 C4.6999013,3.53411722 4.81797951,3.52611192 4.9340564,3.52611192 C6.6501931,3.52411059 8.36733048,3.52411059 10.0834672,3.52611192 C10.5577814,3.52611192 10.8299616,3.69022062 10.9340306,4.03044597 C11.090134,4.53778201 10.7439046,4.99408425 10.1825328,4.99908757 C9.29094224,5.00709287 8.39935169,5.00108889 7.50776113,5.00108889 L7.50776113,5.00108889 Z",
485
+ id: "Path"
486
+ })
487
+ ]
488
+ })
489
+ })
490
+ ]
491
+ });
411
492
  default:
412
493
  return null;
413
494
  }
@@ -547,10 +628,15 @@ const $52c6454cae137465$var$DatasetSearchListItem = (props)=>{
547
628
  className: linkContainerClasses,
548
629
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
549
630
  className: linkClasses,
550
- children: largeFile ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
551
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
552
- id: "download"
553
- })
631
+ children: largeFile ? /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
632
+ children: [
633
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
634
+ id: "download"
635
+ }),
636
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b61856b23f5f58a2$export$2e2bcd8739ae039), {
637
+ downloadUrl: downloadUrl
638
+ })
639
+ ]
554
640
  }) : /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
555
641
  href: downloadUrl,
556
642
  children: [
@@ -577,6 +663,9 @@ var $52c6454cae137465$export$2e2bcd8739ae039 = $52c6454cae137465$var$DatasetSear
577
663
 
578
664
  const $e011250e8a3bd5e5$var$SearchFacets = (props)=>{
579
665
  const { facets: facets , title: title , onClickFunction: onClickFunction , selectedFacets: selectedFacets = [] } = props;
666
+ const filteredFacets = facets.filter((f)=>{
667
+ return Number(f.total) > 0 || selectedFacets.findIndex((i)=>i === f.name) !== -1;
668
+ });
580
669
  return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
581
670
  className: "dkan-dataset-search--facet-container ds-u-margin-bottom--4",
582
671
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Accordion), {
@@ -585,9 +674,7 @@ const $e011250e8a3bd5e5$var$SearchFacets = (props)=>{
585
674
  heading: title,
586
675
  defaultOpen: true,
587
676
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
588
- children: facets.filter((f)=>{
589
- return Number(f.total) > 0;
590
- }).map((f)=>{
677
+ children: filteredFacets.length ? filteredFacets.map((f)=>{
591
678
  return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
592
679
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
593
680
  className: "ds-u-margin-y--1",
@@ -599,6 +686,9 @@ const $e011250e8a3bd5e5$var$SearchFacets = (props)=>{
599
686
  onClick: ()=>onClickFunction(f.type, f.name)
600
687
  })
601
688
  }, f.name);
689
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
690
+ className: "ds-h5",
691
+ children: "No matching facets found."
602
692
  })
603
693
  })
604
694
  })
@@ -737,9 +827,8 @@ async function $eff7d34c30f5a0fc$export$2d2256cb46e92ff7(rootUrl, options, addit
737
827
 
738
828
 
739
829
 
740
-
741
830
  const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
742
- const { rootUrl: rootUrl , surveyLink: surveyLink , additionalParams: additionalParams , enableSort: enableSort , defaultSort: defaultSort , pageTitle: pageTitle , filterTitle: filterTitle , showLargeFileWarning: showLargeFileWarning , introText: introText , showDownloadIcon: showDownloadIcon } = props;
831
+ const { rootUrl: rootUrl , surveyLink: surveyLink , additionalParams: additionalParams , enableSort: enableSort , defaultSort: defaultSort , pageTitle: pageTitle , filterTitle: filterTitle , showLargeFileWarning: showLargeFileWarning , largeFileThemes: largeFileThemes , introText: introText , showDownloadIcon: showDownloadIcon } = props;
743
832
  const sortOptions = [
744
833
  {
745
834
  label: "Newest",
@@ -885,13 +974,18 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
885
974
  ["page-size"]: pageSize !== 10 ? pageSize : undefined,
886
975
  ...additionalParams
887
976
  };
888
- const { data: data , status: status , error: error } = (0, $hgUW1$useQuery)([
889
- "datasets",
890
- params
891
- ], ()=>(0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify(params, {
892
- arrayFormat: "comma",
893
- encode: false
894
- })}`));
977
+ const { data: data , isLoading: isLoading , error: error } = (0, $hgUW1$useQuery)({
978
+ queryKey: [
979
+ "datasets",
980
+ params
981
+ ],
982
+ queryFn: ()=>{
983
+ return (0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify(params, {
984
+ arrayFormat: "comma",
985
+ encode: false
986
+ })}`);
987
+ }
988
+ });
895
989
  if (data && data.data.total && totalItems != data.data.total) setTotalItems(data.data.total);
896
990
  const facets = data && data.data.facets ? (0, $eff7d34c30f5a0fc$export$959638e8dca60ce6)(data ? data.data.facets : []) : {
897
991
  theme: null,
@@ -978,7 +1072,7 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
978
1072
  }),
979
1073
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
980
1074
  className: "ds-l-col--12 ds-l-sm-col--8",
981
- children: status === "loading" ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
1075
+ children: isLoading ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
982
1076
  className: "ds-u-valign--middle",
983
1077
  "aria-valuetext": "Dataset Search loading",
984
1078
  role: "status"
@@ -1034,6 +1128,10 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
1034
1128
  let distribution_array = item.distribution ? item.distribution : [];
1035
1129
  return distribution_array.length ? item.distribution[0].downloadURL : null;
1036
1130
  }
1131
+ let showLargeFile = false;
1132
+ if (largeFileThemes && item.theme) largeFileThemes.forEach((theme)=>{
1133
+ if (item.theme.includes(theme)) showLargeFile = true;
1134
+ });
1037
1135
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $52c6454cae137465$export$2e2bcd8739ae039), {
1038
1136
  title: item.title,
1039
1137
  modified: item.modified,
@@ -1041,7 +1139,7 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
1041
1139
  theme: item.theme,
1042
1140
  identifier: item.identifier,
1043
1141
  downloadUrl: showDownloadIcon ? getDownloadUrl(item) : null,
1044
- largeFile: item.theme && item.theme.includes("General Payments")
1142
+ largeFile: showLargeFile
1045
1143
  });
1046
1144
  }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
1047
1145
  variation: "error",
@@ -1118,15 +1216,29 @@ var $e873081a6e8f024e$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
1118
1216
 
1119
1217
 
1120
1218
 
1121
- const $68d79598b83f3382$var$useMetastoreDataset = (datasetId, rootAPIUrl, additionalParams = {})=>{
1122
- const [dataset, setDataset] = (0, $hgUW1$useState)({});
1219
+
1220
+
1221
+
1222
+
1223
+ const $b4aa9c66f2e86959$var$useMetastoreDataset = (datasetId, rootAPIUrl, additionalParams = {})=>{
1224
+ const [dataset, setDataset] = (0, $hgUW1$useState)({
1225
+ title: "",
1226
+ distribution: [],
1227
+ error: "",
1228
+ description: "",
1229
+ identifier: ""
1230
+ });
1123
1231
  const [id, setId] = (0, $hgUW1$useState)(datasetId);
1124
1232
  const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
1125
1233
  const additionalParamsString = Object.keys(additionalParams).length ? `&${(0, $hgUW1$qs).stringify(additionalParams)}` : "";
1126
1234
  (0, $hgUW1$useEffect)(()=>{
1127
1235
  async function fetchData() {
1128
1236
  return (0, $hgUW1$axios).get(`${rootUrl}/metastore/schemas/dataset/items/${id}?show-reference-ids${additionalParamsString}`).then((res)=>setDataset(res.data)).catch((error)=>setDataset({
1129
- error: error
1237
+ title: dataset.title,
1238
+ distribution: dataset.distribution,
1239
+ error: error,
1240
+ description: dataset.description,
1241
+ identifier: dataset.identifier
1130
1242
  }));
1131
1243
  }
1132
1244
  fetchData();
@@ -1140,13 +1252,7 @@ const $68d79598b83f3382$var$useMetastoreDataset = (datasetId, rootAPIUrl, additi
1140
1252
  setRootUrl: setRootUrl
1141
1253
  };
1142
1254
  };
1143
- var $68d79598b83f3382$export$2e2bcd8739ae039 = $68d79598b83f3382$var$useMetastoreDataset;
1144
-
1145
-
1146
-
1147
-
1148
-
1149
-
1255
+ var $b4aa9c66f2e86959$export$2e2bcd8739ae039 = $b4aa9c66f2e86959$var$useMetastoreDataset;
1150
1256
 
1151
1257
 
1152
1258
 
@@ -1196,7 +1302,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
1196
1302
  const [id, setResource] = (0, $hgUW1$useState)(resourceId);
1197
1303
  const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
1198
1304
  const [limit, setLimit] = (0, $hgUW1$useState)(options.limit ? options.limit : 20);
1199
- const [count, setCount] = (0, $hgUW1$useState)(null);
1305
+ const [count, setCount] = (0, $hgUW1$useState)(0);
1200
1306
  const [columns, setColumns] = (0, $hgUW1$useState)([]);
1201
1307
  const [offset, setOffset] = (0, $hgUW1$useState)(options.offset ? options.offset : 0);
1202
1308
  const [loading, setLoading] = (0, $hgUW1$useState)(false);
@@ -1240,7 +1346,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
1240
1346
  else if (requireConditions) {
1241
1347
  if (conditions && conditions.length) fetchData();
1242
1348
  else {
1243
- setCount(null);
1349
+ setCount(0);
1244
1350
  setValues([]);
1245
1351
  }
1246
1352
  }
@@ -1285,135 +1391,373 @@ var $1d3d480a9cfaabe0$export$2e2bcd8739ae039 = $1d3d480a9cfaabe0$var$useDatastor
1285
1391
 
1286
1392
 
1287
1393
 
1288
- // OPERATORS
1289
- // =
1290
- // <> not equal to
1291
- // BETWEEN
1292
- // IN
1293
- // NOT IN
1294
- // >=
1295
- // <=
1296
- // like
1297
- function $ead72e621d62e6fc$export$64030b8086b23b59(filterArray) {
1298
- const conditions = filterArray.map((f)=>{
1299
- return {
1300
- resource: "t",
1301
- property: f.id,
1302
- value: `%${f.value}%`,
1303
- operator: "LIKE"
1304
- };
1305
- });
1306
- return conditions;
1307
- }
1308
- function $ead72e621d62e6fc$export$5bccb6115193eb03(filterArray) {
1309
- if (!filterArray || filterArray.length === 0) return "";
1310
- const where_clauses = [];
1311
- filterArray.forEach((v, i)=>{
1312
- // Switch delimiter to, and strip any double-quote for Dkan2's sql query.
1313
- let value = `%25${v.value}%25`;
1314
- where_clauses[i] = `${v.id} = "${v.value.replace('"', "")}"`;
1315
- });
1316
- return `[WHERE ${where_clauses.join(" AND ")}]`;
1317
- }
1318
-
1319
-
1320
- function $aa4450dcbeef3ac0$export$385a5aba38cc3325(sortArray) {
1321
- let newQuery = [];
1322
- sortArray.forEach((s)=>{
1323
- return newQuery.push({
1324
- property: s.id,
1325
- order: s.desc ? "desc" : "asc"
1326
- });
1327
- });
1328
- return newQuery;
1329
- }
1330
-
1331
-
1332
-
1333
-
1334
-
1335
-
1336
-
1337
1394
 
1338
1395
 
1339
- const $96d341d082bffec5$var$TruncatedResizeableTHead = ({ table: table , sortElement: sortElement })=>{
1340
- return /*#__PURE__*/ (0, $hgUW1$jsx)("thead", {
1341
- className: "dc-thead--truncated dc-thead--resizeable",
1342
- children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1343
- children: headerGroup.headers.map((header)=>{
1344
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("th", {
1345
- key: header.id,
1346
- style: {
1347
- width: header.getSize()
1348
- },
1349
- title: header.column.columnDef.header,
1350
- className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold dc-c-table-header-cell",
1351
- children: [
1352
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1353
- onClick: header.column.getToggleSortingHandler(),
1354
- children: [
1355
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1356
- style: {
1357
- maxWidth: header.getSize() - 16
1358
- },
1359
- children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
1360
- }),
1361
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1362
- className: header.column.getCanSort() ? `cursor-pointer select-none ${sortElement(header.column.getIsSorted())}` : ""
1363
- })
1364
- ]
1365
- }),
1366
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1367
- onMouseDown: header.getResizeHandler(),
1368
- onTouchStart: header.getResizeHandler(),
1369
- className: `dc-c-resize-handle ${header.column.getIsResizing() ? "isResizing" : ""}`
1370
- })
1371
- ]
1372
- });
1373
- })
1374
- }, headerGroup.id))
1375
- });
1396
+ const $28f16f59778efa64$export$82b1b1d517e5388a = {
1397
+ "R/P10Y": {
1398
+ name: "Decennial"
1399
+ },
1400
+ "R/P4Y": {
1401
+ name: "Quadrennial"
1402
+ },
1403
+ "R/P1Y": {
1404
+ name: "Annual"
1405
+ },
1406
+ "R/P2M": {
1407
+ name: "Bimonthly"
1408
+ },
1409
+ "R/P3.5D": {
1410
+ name: "Semiweekly"
1411
+ },
1412
+ "R/P1D": {
1413
+ name: "Daily"
1414
+ },
1415
+ "R/P2W": {
1416
+ name: "Biweekly"
1417
+ },
1418
+ "R/P6M": {
1419
+ name: "Semiannual"
1420
+ },
1421
+ "R/P2Y": {
1422
+ name: "Biennial"
1423
+ },
1424
+ "R/P3Y": {
1425
+ name: "Triennial"
1426
+ },
1427
+ "R/P0.33W": {
1428
+ name: "Three times a week"
1429
+ },
1430
+ "R/P0.33M": {
1431
+ name: "Three times a month"
1432
+ },
1433
+ "R/PT1S": {
1434
+ name: "Continuously updated"
1435
+ },
1436
+ "R/P1M": {
1437
+ name: "Monthly"
1438
+ },
1439
+ "R/P3M": {
1440
+ name: "Quarterly"
1441
+ },
1442
+ "R/P0.5M": {
1443
+ name: "Semimonthly"
1444
+ },
1445
+ "R/P4M": {
1446
+ name: "Three times a year"
1447
+ },
1448
+ "R/P1W": {
1449
+ name: "Weekly"
1450
+ },
1451
+ "R/PT1H": {
1452
+ name: "Hourly"
1453
+ },
1454
+ irregular: {
1455
+ name: "Irregular"
1456
+ }
1376
1457
  };
1377
- var $96d341d082bffec5$export$2e2bcd8739ae039 = $96d341d082bffec5$var$TruncatedResizeableTHead;
1378
-
1379
-
1380
1458
 
1381
1459
 
1382
-
1383
- const $23763e27eda0e8d7$var$FixedSizeTHead = ({ table: table , sortElement: sortElement })=>{
1384
- return /*#__PURE__*/ (0, $hgUW1$jsx)("thead", {
1385
- className: "dc-thead--fixed-size",
1386
- children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1387
- children: headerGroup.headers.map((header)=>{
1388
- return /*#__PURE__*/ (0, $hgUW1$jsx)("th", {
1389
- key: header.id,
1390
- style: {
1391
- width: header.getSize()
1392
- },
1393
- title: header.column.columnDef.header,
1394
- className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold dc-c-table-header-cell",
1395
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1396
- onClick: header.column.getToggleSortingHandler(),
1397
- children: [
1398
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1399
- children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
1400
- }),
1401
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1402
- className: header.column.getCanSort() ? `cursor-pointer select-none ${sortElement(header.column.getIsSorted())}` : ""
1403
- })
1404
- ]
1405
- })
1406
- });
1460
+ const $6da0396069e23175$export$bc27cf7ecf44639d = {
1461
+ modified: (data)=>{
1462
+ return [
1463
+ {
1464
+ label: "Modified",
1465
+ value: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
1466
+ date: data
1407
1467
  })
1408
- }, headerGroup.id))
1409
- });
1410
- };
1411
- var $23763e27eda0e8d7$export$2e2bcd8739ae039 = $23763e27eda0e8d7$var$FixedSizeTHead;
1468
+ }
1469
+ ];
1470
+ },
1471
+ issued: (data)=>{
1472
+ return [
1473
+ {
1474
+ label: "Issued",
1475
+ value: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
1476
+ date: data
1477
+ })
1478
+ }
1479
+ ];
1480
+ },
1481
+ accrualPeriodicity: (data)=>{
1482
+ return [
1483
+ {
1484
+ label: "Frequency",
1485
+ value: (0, $28f16f59778efa64$export$82b1b1d517e5388a)[data].name
1486
+ }
1487
+ ];
1488
+ },
1489
+ publisher: (data)=>{
1490
+ if (data.data && data.data.name) return [
1491
+ {
1492
+ label: "Publisher",
1493
+ value: data.data.name
1494
+ }
1495
+ ];
1496
+ else return [];
1497
+ },
1498
+ identifier: (data)=>{
1499
+ return [
1500
+ {
1501
+ label: "Identifier",
1502
+ value: data
1503
+ }
1504
+ ];
1505
+ },
1506
+ contactPoint: (data)=>{
1507
+ let rows = [];
1508
+ if (data.fn) rows.push({
1509
+ label: "Contact",
1510
+ value: data.fn
1511
+ });
1512
+ if (data.hasEmail) rows.push({
1513
+ label: "Contact Email",
1514
+ value: data.hasEmail
1515
+ });
1516
+ return rows;
1517
+ },
1518
+ bureauCode: (data)=>{
1519
+ if (data.length) return [
1520
+ {
1521
+ label: "Bureau Code",
1522
+ value: data[0]
1523
+ }
1524
+ ];
1525
+ },
1526
+ programCode: (data)=>{
1527
+ if (data.length) return [
1528
+ {
1529
+ label: "Program Code",
1530
+ value: data[0]
1531
+ }
1532
+ ];
1533
+ },
1534
+ theme: (data)=>{
1535
+ return [
1536
+ {
1537
+ label: "Category",
1538
+ value: data.map((theme)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
1539
+ to: `/datasets?theme[]=${theme.data}`,
1540
+ children: theme.data
1541
+ }, theme.data)).reduce((prev, curr)=>[
1542
+ prev,
1543
+ ", ",
1544
+ curr
1545
+ ])
1546
+ }
1547
+ ];
1548
+ },
1549
+ keyword: (data)=>{
1550
+ return [
1551
+ {
1552
+ label: "Tags",
1553
+ value: data.map((keyword)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
1554
+ to: `/datasets?keyword[]=${keyword.data}`,
1555
+ children: keyword.data
1556
+ }, keyword.data)).reduce((prev, curr)=>[
1557
+ prev,
1558
+ ", ",
1559
+ curr
1560
+ ])
1561
+ }
1562
+ ];
1563
+ },
1564
+ license: (data)=>{
1565
+ return [
1566
+ {
1567
+ label: "License",
1568
+ value: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
1569
+ href: data,
1570
+ children: data
1571
+ })
1572
+ }
1573
+ ];
1574
+ },
1575
+ accessLevel: (data)=>{
1576
+ return [
1577
+ {
1578
+ label: "Public Access Level",
1579
+ value: data
1580
+ }
1581
+ ];
1582
+ },
1583
+ temporal: (data)=>{
1584
+ return [
1585
+ {
1586
+ label: "Temporal Coverage",
1587
+ value: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1588
+ className: "dc-c-word-break--all",
1589
+ children: data
1590
+ })
1591
+ }
1592
+ ];
1593
+ },
1594
+ spatial: (data)=>{
1595
+ return [
1596
+ {
1597
+ label: "Spacial/Geographical Coverage",
1598
+ value: data
1599
+ }
1600
+ ];
1601
+ },
1602
+ references: (data)=>{
1603
+ return [
1604
+ {
1605
+ label: "Related Documents",
1606
+ value: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
1607
+ className: "ds-u-margin--0 ds-u-padding-y--0 ds-u-padding-left--2 ds-u-padding-right--0",
1608
+ children: data.map((item)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1609
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
1610
+ href: item,
1611
+ children: item
1612
+ })
1613
+ }, item))
1614
+ })
1615
+ }
1616
+ ];
1617
+ }
1618
+ };
1619
+
1620
+
1621
+
1622
+
1623
+
1624
+
1625
+
1626
+
1627
+
1628
+
1629
+
1630
+
1631
+
1632
+
1633
+ const $96d341d082bffec5$var$TruncatedResizeableTHead = ({ table: table , sortElement: sortElement , setAriaLiveFeedback: setAriaLiveFeedback })=>{
1634
+ const [columnResizing, setColumnResizing] = (0, $hgUW1$useState)("");
1635
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("thead", {
1636
+ className: "dc-thead--truncated dc-thead--resizeable",
1637
+ children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1638
+ children: headerGroup.headers.map((header)=>{
1639
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("th", {
1640
+ key: header.id,
1641
+ style: {
1642
+ width: header.getSize()
1643
+ },
1644
+ title: header.column.columnDef.header,
1645
+ className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold dc-c-table-header-cell",
1646
+ children: [
1647
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1648
+ children: [
1649
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1650
+ style: {
1651
+ maxWidth: header.getSize() - 16
1652
+ },
1653
+ children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
1654
+ }),
1655
+ /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
1656
+ onClick: header.column.getToggleSortingHandler(),
1657
+ className: header.column.getCanSort() ? `cursor-pointer select-none ds-u-focus-visible ${sortElement(header.column.getIsSorted())}` : "",
1658
+ "aria-label": `${header.column.columnDef.header} sort order`
1659
+ })
1660
+ ]
1661
+ }),
1662
+ /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
1663
+ onMouseDown: header.getResizeHandler(),
1664
+ onTouchStart: header.getResizeHandler(),
1665
+ className: `dc-c-resize-handle ds-u-focus-visible ${header.column.getIsResizing() || header.column.id == columnResizing ? "isResizing" : ""}`,
1666
+ "aria-label": `Resize ${header.column.columnDef.header} column`,
1667
+ onKeyDown: (e)=>{
1668
+ const columnSizingObject = table.getState().columnSizing;
1669
+ switch(e.key){
1670
+ case "Enter":
1671
+ case " ":
1672
+ e.preventDefault();
1673
+ e.stopPropagation();
1674
+ if (columnResizing) {
1675
+ // end resizing
1676
+ setColumnResizing("");
1677
+ setAriaLiveFeedback(`${header.column.columnDef.header} dropped.`);
1678
+ } else {
1679
+ // start resizing
1680
+ setColumnResizing(header.column.id);
1681
+ setAriaLiveFeedback(`${header.column.columnDef.header} grabbed.`);
1682
+ }
1683
+ break;
1684
+ case "Escape":
1685
+ if (columnResizing) {
1686
+ setColumnResizing("");
1687
+ setAriaLiveFeedback(`${header.column.columnDef.header} dropped.`);
1688
+ }
1689
+ break;
1690
+ case "ArrowRight":
1691
+ e.preventDefault();
1692
+ e.stopPropagation();
1693
+ if (columnResizing) {
1694
+ columnSizingObject[header.column.id] = header.getSize() + 10;
1695
+ table.setColumnSizing(columnSizingObject);
1696
+ setAriaLiveFeedback(`${header.column.columnDef.header} has been resized. The new width is ${header.getSize()} pixels.`);
1697
+ }
1698
+ break;
1699
+ case "ArrowLeft":
1700
+ e.preventDefault();
1701
+ e.stopPropagation();
1702
+ if (columnResizing) {
1703
+ columnSizingObject[header.column.id] = header.getSize() - 10;
1704
+ table.setColumnSizing(columnSizingObject);
1705
+ setAriaLiveFeedback(`${header.column.columnDef.header} has been resized. The new width is ${header.getSize()} pixels.`);
1706
+ }
1707
+ break;
1708
+ }
1709
+ },
1710
+ onBlur: ()=>{
1711
+ setColumnResizing("");
1712
+ }
1713
+ })
1714
+ ]
1715
+ });
1716
+ })
1717
+ }, headerGroup.id))
1718
+ });
1719
+ };
1720
+ var $96d341d082bffec5$export$2e2bcd8739ae039 = $96d341d082bffec5$var$TruncatedResizeableTHead;
1721
+
1722
+
1723
+
1724
+
1725
+
1726
+ const $23763e27eda0e8d7$var$FixedSizeTHead = ({ table: table , sortElement: sortElement })=>{
1727
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("thead", {
1728
+ className: "dc-thead--fixed-size",
1729
+ children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1730
+ children: headerGroup.headers.map((header)=>{
1731
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("th", {
1732
+ key: header.id,
1733
+ style: {
1734
+ width: header.getSize()
1735
+ },
1736
+ title: header.column.columnDef.header,
1737
+ className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold dc-c-table-header-cell",
1738
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1739
+ onClick: header.column.getToggleSortingHandler(),
1740
+ children: [
1741
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1742
+ children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
1743
+ }),
1744
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1745
+ className: header.column.getCanSort() ? `cursor-pointer select-none ${sortElement(header.column.getIsSorted())}` : ""
1746
+ })
1747
+ ]
1748
+ })
1749
+ });
1750
+ })
1751
+ }, headerGroup.id))
1752
+ });
1753
+ };
1754
+ var $23763e27eda0e8d7$export$2e2bcd8739ae039 = $23763e27eda0e8d7$var$FixedSizeTHead;
1412
1755
 
1413
1756
 
1414
1757
 
1415
1758
  const $d98f94c79ddf4e0e$var$DataTable = ({ data: data , columns: columns , setSort: setSort , sortTransform: sortTransform , tablePadding: tablePadding , canResize: canResize , loading: loading = false })=>{
1416
1759
  const [sorting, setSorting] = (0, $hgUW1$react).useState([]);
1760
+ const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)("");
1417
1761
  const columnHelper = (0, $hgUW1$createColumnHelper)();
1418
1762
  const table_columns = columns.map((col)=>{
1419
1763
  if (col.cell) return columnHelper.accessor(col.accessor, {
@@ -1449,135 +1793,211 @@ const $d98f94c79ddf4e0e$var$DataTable = ({ data: data , columns: columns , setSo
1449
1793
  }, [
1450
1794
  sorting
1451
1795
  ]);
1452
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1453
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("table", {
1454
- tabIndex: 0,
1455
- style: {
1456
- width: canResize ? table.getCenterTotalSize() : "100%"
1457
- },
1458
- className: "dc-c-datatable",
1459
- children: [
1460
- canResize ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $96d341d082bffec5$export$2e2bcd8739ae039), {
1461
- table: table,
1462
- sortElement: sortElement
1463
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $23763e27eda0e8d7$export$2e2bcd8739ae039), {
1464
- table: table,
1465
- sortElement: sortElement
1466
- }),
1467
- loading ? /*#__PURE__*/ (0, $hgUW1$jsx)("tbody", {
1468
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1469
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("td", {
1470
- colSpan: columns.length,
1471
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
1472
- "aria-valuetext": "Dataset loading",
1473
- role: "status",
1474
- className: "ds-u-margin--3"
1796
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1797
+ children: [
1798
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("table", {
1799
+ tabIndex: 0,
1800
+ style: {
1801
+ width: canResize ? table.getCenterTotalSize() : "100%"
1802
+ },
1803
+ className: "dc-c-datatable",
1804
+ children: [
1805
+ canResize ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $96d341d082bffec5$export$2e2bcd8739ae039), {
1806
+ table: table,
1807
+ sortElement: sortElement,
1808
+ setAriaLiveFeedback: setAriaLiveFeedback
1809
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $23763e27eda0e8d7$export$2e2bcd8739ae039), {
1810
+ table: table,
1811
+ sortElement: sortElement
1812
+ }),
1813
+ loading ? /*#__PURE__*/ (0, $hgUW1$jsx)("tbody", {
1814
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1815
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("td", {
1816
+ colSpan: columns.length,
1817
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
1818
+ "aria-valuetext": "Dataset loading",
1819
+ role: "status",
1820
+ className: "ds-u-margin--3"
1821
+ })
1475
1822
  })
1476
1823
  })
1824
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)("tbody", {
1825
+ children: table.getRowModel().rows.map((row, index)=>{
1826
+ const even = (index + 1) % 2 === 0;
1827
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1828
+ className: `${even ? "dc-c-datatable--even-row" : ""}`,
1829
+ children: row.getVisibleCells().map((cell)=>{
1830
+ let classList = "dc-truncate ds-u-padding-x--1";
1831
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("td", {
1832
+ key: cell.id,
1833
+ style: {
1834
+ maxWidth: cell.column.getSize()
1835
+ },
1836
+ className: `${classList} ${tablePadding}`,
1837
+ children: (0, $hgUW1$flexRender)(cell.column.columnDef.cell, cell.getContext())
1838
+ });
1839
+ })
1840
+ }, row.id);
1841
+ })
1477
1842
  })
1478
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)("tbody", {
1479
- children: table.getRowModel().rows.map((row, index)=>{
1480
- const even = (index + 1) % 2 === 0;
1481
- return /*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1482
- className: `${even ? "dc-c-datatable--even-row" : ""}`,
1483
- children: row.getVisibleCells().map((cell)=>{
1484
- let classList = "dc-truncate ds-u-padding-x--1";
1485
- return /*#__PURE__*/ (0, $hgUW1$jsx)("td", {
1486
- key: cell.id,
1487
- style: {
1488
- maxWidth: cell.column.getSize()
1489
- },
1490
- className: `${classList} ${tablePadding}`,
1491
- children: (0, $hgUW1$flexRender)(cell.column.columnDef.cell, cell.getContext())
1492
- });
1493
- })
1494
- }, row.id);
1495
- })
1496
- })
1497
- ]
1498
- })
1843
+ ]
1844
+ }),
1845
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1846
+ className: "sr-only",
1847
+ "aria-live": "assertive",
1848
+ "aria-atomic": "true",
1849
+ children: ariaLiveFeedback
1850
+ })
1851
+ ]
1499
1852
  });
1500
1853
  };
1501
1854
  var $d98f94c79ddf4e0e$export$2e2bcd8739ae039 = $d98f94c79ddf4e0e$var$DataTable;
1502
1855
 
1503
1856
 
1857
+ function $aa4450dcbeef3ac0$export$385a5aba38cc3325(sortArray) {
1858
+ let newQuery = [];
1859
+ sortArray.forEach((s)=>{
1860
+ return newQuery.push({
1861
+ property: s.id,
1862
+ order: s.desc ? "desc" : "asc"
1863
+ });
1864
+ });
1865
+ return newQuery;
1866
+ }
1504
1867
 
1505
1868
 
1506
- function $626282d9a03c51d5$var$calculateMaxWidth(previewSize) {
1507
- return Math.floor(previewSize * 0.84);
1869
+ // Example custom column headers, where only effective date has an ! at the end
1870
+ // [
1871
+ // {schema: 'date', cell: ({ value }) => localeDate(value),},
1872
+ // {accessor: 'effective_date',cell: ({ value }) => localeDate(value) + '!',},
1873
+ // ]
1874
+ function $7264a673914aa746$export$8049e8f40a9bdfb8(customHeaders, columns, schema) {
1875
+ return columns.map((column)=>{
1876
+ const customAccessorIndex = customHeaders.findIndex((header)=>header.accessor === column);
1877
+ const customSchemaIndex = customHeaders.findIndex((header)=>header.schema === schema.fields[column].mysql_type);
1878
+ let newColumn = {};
1879
+ // If specific accessor is passed, this will override a general mysql_type Cell rewrite.
1880
+ if (customAccessorIndex > -1) {
1881
+ newColumn.header = schema && schema.fields[column].description ? schema.fields[column].description : column;
1882
+ newColumn.accessor = column;
1883
+ newColumn.cell = customHeaders[customAccessorIndex].cell;
1884
+ } else {
1885
+ newColumn.header = schema && schema.fields[column].description ? schema.fields[column].description : column;
1886
+ newColumn.accessor = column;
1887
+ if (customSchemaIndex > -1) newColumn.cell = customHeaders[customSchemaIndex].cell;
1888
+ }
1889
+ return newColumn;
1890
+ });
1508
1891
  }
1509
- function $626282d9a03c51d5$export$1147582dfae658c6(columns, schema) {
1510
- return columns.map((column)=>({
1511
- header: schema && schema.fields[column].description ? schema.fields[column].description : column,
1512
- accessor: column
1513
- }));
1892
+ function $7264a673914aa746$export$e284ae5d89467c8f(date) {
1893
+ if (!date) return date;
1894
+ date = new Date(date);
1895
+ date = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
1896
+ return date;
1514
1897
  }
1515
- function $626282d9a03c51d5$var$DefaultColumnFilter({ column: { Header: Header , accessor: accessor , setFilter: setFilter , filterValue: filterValue } }) {
1516
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
1517
- label: `Filter by ${Header}`,
1518
- onChange: (e)=>{
1519
- setFilter(e.target.value) || undefined;
1520
- },
1521
- labelClassName: "ds-u-visibility--screen-reader",
1522
- name: accessor,
1523
- value: filterValue || ""
1524
- });
1898
+ function $7264a673914aa746$export$6b5e57d20078142b(value, operator) {
1899
+ let newValue = value;
1900
+ if (Array.isArray(newValue)) newValue = newValue.join(",");
1901
+ // return newValue.replace(/(^\%+|\%+$)/gm, '');
1902
+ return newValue;
1525
1903
  }
1526
- const $626282d9a03c51d5$var$ResourcePreview = ({ tablePadding: tablePadding , id: id , options: options , resource: resource , defaultSort: defaultSort , customColumns: customColumns , truncateCellHeader: truncateCellHeader , columnSettings: columnSettings , columnWidths: columnWidths , customClasses: customClasses , canResize: canResize })=>{
1527
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1528
- id: "resource-preview",
1529
- className: "ds-u-overflow--auto ds-u-border-x--1 ds-u-border-bottom--1",
1530
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
1531
- // filterTitle="Filter columns"
1532
- data: resource.values,
1533
- canResize: canResize,
1534
- sortDefaults: defaultSort,
1535
- columns: customColumns ? customColumns : $626282d9a03c51d5$export$1147582dfae658c6(resource.columns, resource.schema[id]),
1536
- // schema={resource.schema}
1537
- // totalRows={parseInt(resource.totalRows)}
1538
- // limit={resource.limit}
1539
- // offset={resource.offset}
1540
- // loading={resource.loading}
1541
- setSort: resource.setSort,
1542
- // setConditions={resource.setConditions}
1543
- // conditionsTransform={transformTableFilterToQueryCondition}
1544
- sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
1545
- tablePadding: tablePadding,
1546
- className: "dc-c-datatable",
1547
- customColumnFilter: $626282d9a03c51d5$var$DefaultColumnFilter,
1548
- options: options,
1549
- CustomLoadingComponent: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1550
- className: "ds-u-display--flex ds-u-padding--3",
1551
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
1552
- className: "ds-u-valign--middle",
1553
- role: "status",
1554
- "aria-valuetext": "Datatable loading"
1555
- })
1556
- }),
1557
- CustomNoResults: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1558
- className: "ds-u-display--flex ds-u-padding--3",
1559
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
1560
- children: "No results returned."
1561
- })
1562
- })
1563
- })
1564
- });
1565
- };
1566
- $626282d9a03c51d5$var$ResourcePreview.defaultProps = {
1567
- options: {
1568
- layout: "flex",
1569
- columnFilter: false,
1570
- columnSort: true,
1571
- columnResize: true
1904
+ const $7264a673914aa746$export$5f89a5ae87bc48e1 = [
1905
+ {
1906
+ label: "Is",
1907
+ value: "="
1572
1908
  },
1573
- truncateCellHeader: true,
1574
- defaultSort: [],
1575
- canResize: true
1576
- };
1577
- var $626282d9a03c51d5$export$2e2bcd8739ae039 = $626282d9a03c51d5$var$ResourcePreview;
1578
-
1579
-
1580
-
1909
+ {
1910
+ label: "Starts With",
1911
+ value: "starts with"
1912
+ },
1913
+ {
1914
+ label: "Contains",
1915
+ value: "contains"
1916
+ },
1917
+ {
1918
+ label: "Is Not",
1919
+ value: "<>"
1920
+ },
1921
+ {
1922
+ label: "Or",
1923
+ value: "in"
1924
+ },
1925
+ {
1926
+ label: "Is",
1927
+ value: "="
1928
+ },
1929
+ {
1930
+ label: "Is Not",
1931
+ value: "<>"
1932
+ },
1933
+ {
1934
+ label: "Greater Than",
1935
+ value: ">"
1936
+ },
1937
+ {
1938
+ label: "Less Than",
1939
+ value: "<"
1940
+ }
1941
+ ];
1942
+ function $7264a673914aa746$export$2b9377795161999(type) {
1943
+ switch(type){
1944
+ case "text":
1945
+ case "string":
1946
+ return [
1947
+ {
1948
+ label: "Is",
1949
+ value: "="
1950
+ },
1951
+ {
1952
+ label: "Starts With",
1953
+ value: "starts with"
1954
+ },
1955
+ {
1956
+ label: "Contains",
1957
+ value: "contains"
1958
+ },
1959
+ {
1960
+ label: "Is Not",
1961
+ value: "<>"
1962
+ },
1963
+ {
1964
+ label: "Or",
1965
+ value: "in"
1966
+ }
1967
+ ];
1968
+ case "date":
1969
+ return [
1970
+ {
1971
+ label: "Is",
1972
+ value: "="
1973
+ },
1974
+ {
1975
+ label: "Is Not",
1976
+ value: "<>"
1977
+ },
1978
+ {
1979
+ label: "Greater Than",
1980
+ value: ">"
1981
+ },
1982
+ {
1983
+ label: "Less Than",
1984
+ value: "<"
1985
+ }
1986
+ ];
1987
+ default:
1988
+ // These 2 should be safe for all data types
1989
+ return [
1990
+ {
1991
+ label: "Is",
1992
+ value: "="
1993
+ },
1994
+ {
1995
+ label: "Is Not",
1996
+ value: "<>"
1997
+ }
1998
+ ];
1999
+ }
2000
+ }
1581
2001
 
1582
2002
 
1583
2003
 
@@ -1620,287 +2040,445 @@ var $2ed0091f7e32d1e6$export$2e2bcd8739ae039 = $2ed0091f7e32d1e6$var$DataTablePa
1620
2040
 
1621
2041
 
1622
2042
 
2043
+ const $6380a4a580b24362$var$DataTableHeader = ({ resource: resource , downloadURL: downloadURL , jsonUrl: jsonUrl })=>{
2044
+ const { limit: limit , offset: offset , count: count } = resource;
2045
+ const intCount = count ? count : 0;
2046
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2047
+ className: "ds-l-row ds-u-align-items--center ds-u-margin-bottom--2",
2048
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2049
+ className: "ds-l-col--12 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--between ds-u-align-items--center",
2050
+ children: [
2051
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2052
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2ed0091f7e32d1e6$export$2e2bcd8739ae039), {
2053
+ totalRows: intCount,
2054
+ limit: limit,
2055
+ offset: offset
2056
+ })
2057
+ }),
2058
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2059
+ className: "dc-c-resource-header--buttons ds-l-col--12 ds-l-md-col--8 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end ds-u-margin-bottom--2 ds-u-md-margin-bottom--0 ds-u-padding-x--0",
2060
+ children: [
2061
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2062
+ className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-sm-margin-right--2 ds-u-margin-bottom--2 ds-u-sm-margin-bottom--0",
2063
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
2064
+ onOpen: ()=>{
2065
+ navigator.clipboard.writeText(window.location.href);
2066
+ },
2067
+ className: "ds-c-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12",
2068
+ placement: "bottom",
2069
+ dialog: true,
2070
+ ariaLabel: "Copy link to filtered data",
2071
+ title: "Link copied to clipboard",
2072
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2073
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2074
+ children: [
2075
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2076
+ className: "fas fa-copy"
2077
+ }),
2078
+ " Copy link to filtered data"
2079
+ ]
2080
+ })
2081
+ })
2082
+ }),
2083
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2084
+ className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0",
2085
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2086
+ 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",
2087
+ href: downloadURL,
2088
+ "aria-label": "Download filtered data (CSV)",
2089
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2090
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2091
+ children: [
2092
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2093
+ className: "fas fa-file-csv"
2094
+ }),
2095
+ " Export CSV"
2096
+ ]
2097
+ })
2098
+ })
2099
+ }),
2100
+ jsonUrl && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2101
+ 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",
2102
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2103
+ 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",
2104
+ href: jsonUrl,
2105
+ "aria-label": "Export to .JSON",
2106
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2107
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2108
+ children: [
2109
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2110
+ className: "fas fa-file-code"
2111
+ }),
2112
+ " Export to JSON"
2113
+ ]
2114
+ })
2115
+ })
2116
+ })
2117
+ ]
2118
+ })
2119
+ ]
2120
+ })
2121
+ });
2122
+ };
2123
+ var $6380a4a580b24362$export$2e2bcd8739ae039 = $6380a4a580b24362$var$DataTableHeader;
1623
2124
 
1624
2125
 
1625
2126
 
1626
- const $1e012d1e3b534af0$var$DataTableDensity = ({ setTablePadding: setTablePadding , tablePadding: tablePadding })=>{
1627
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1628
- className: "ds-u-display--flex",
1629
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
1630
- options: [
1631
- {
1632
- label: "Tight",
1633
- value: "ds-u-padding-y--0"
1634
- },
1635
- {
1636
- label: "Normal",
1637
- value: "ds-u-padding-y--1"
1638
- },
1639
- {
1640
- label: "Expanded",
1641
- value: "ds-u-padding-y--2"
1642
- }
1643
- ],
1644
- size: "small",
1645
- label: "Display density:",
1646
- labelClassName: "ds-u-margin-top--0",
1647
- name: "datatable_display_density",
1648
- onChange: (e)=>setTablePadding(e.target.value),
1649
- defaultValue: "ds-u-padding-y--1"
1650
- })
1651
- });
1652
- };
1653
- $1e012d1e3b534af0$var$DataTableDensity.propTypes = {
1654
- setTablePadding: (0, $hgUW1$proptypes).func.isRequired
1655
- };
1656
- var $1e012d1e3b534af0$export$2e2bcd8739ae039 = $1e012d1e3b534af0$var$DataTableDensity;
1657
2127
 
1658
2128
 
1659
2129
 
1660
2130
 
1661
2131
 
1662
- const $e71aee394fdad8bd$var$ManageColumns = ()=>{
1663
- const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
1664
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
1665
- onClick: ()=>setModalOpen(!modalOpen),
1666
- children: "Manage Columns"
1667
- });
1668
- };
1669
- var $e71aee394fdad8bd$export$2e2bcd8739ae039 = $e71aee394fdad8bd$var$ManageColumns;
1670
-
1671
-
1672
2132
 
1673
2133
 
1674
2134
 
1675
2135
 
1676
- const $4def8e29c2039eb8$var$DataTableRowChanger = ({ setLimit: setLimit , rowOptions: rowOptions , limit: limit })=>{
1677
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1678
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
1679
- options: rowOptions.map((row)=>({
1680
- label: row.toString(),
1681
- value: row
1682
- })),
1683
- size: "small",
1684
- label: "Rows per page:",
1685
- labelClassName: "ds-u-margin-top--0",
1686
- name: "datatable_rows_per_page",
1687
- onChange: (e)=>setLimit(e.target.value),
1688
- defaultValue: limit
1689
- })
2136
+ const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions , schema: schema , customColumns: customColumns })=>{
2137
+ const { fields: fields } = schema;
2138
+ if (!conditions || !conditions.length) return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
2139
+ children: "Add a filter"
1690
2140
  });
1691
- };
1692
- $4def8e29c2039eb8$var$DataTableRowChanger.defaultProps = {
1693
- rowOptions: [
1694
- 10,
1695
- 25,
1696
- 50,
1697
- 100
1698
- ]
1699
- };
1700
- $4def8e29c2039eb8$var$DataTableRowChanger.propTypes = {
1701
- rowOptions: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).number),
1702
- setLimit: (0, $hgUW1$proptypes).func.isRequired
1703
- };
1704
- var $4def8e29c2039eb8$export$2e2bcd8739ae039 = $4def8e29c2039eb8$var$DataTableRowChanger;
1705
-
1706
-
1707
-
1708
-
1709
- const $e973bc477cdc2dc7$var$DownloadIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
1710
- width: "15px",
1711
- height: "15px",
1712
- viewBox: "0 0 384 512",
1713
- version: "1.1",
1714
- xmlns: "http://www.w3.org/2000/svg",
1715
- xmlnsXlink: "http://www.w3.org/1999/xlink",
1716
- children: [
1717
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1718
- children: "Download Icon"
1719
- }),
1720
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
1721
- stroke: "none",
1722
- strokeWidth: "1",
1723
- fill: "none",
1724
- fillRule: "evenodd",
1725
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
1726
- fill: "#112E51",
1727
- fillRule: "nonzero",
1728
- d: "M384 128h-128V0L384 128zM256 160H384v304c0 26.51-21.49 48-48 48h-288C21.49 512 0 490.5 0 464v-416C0 21.49 21.49 0 48 0H224l.0039 128C224 145.7 238.3 160 256 160zM255 295L216 334.1V232c0-13.25-10.75-24-24-24S168 218.8 168 232v102.1L128.1 295C124.3 290.3 118.2 288 112 288S99.72 290.3 95.03 295c-9.375 9.375-9.375 24.56 0 33.94l80 80c9.375 9.375 24.56 9.375 33.94 0l80-80c9.375-9.375 9.375-24.56 0-33.94S264.4 285.7 255 295z"
1729
- })
1730
- })
1731
- ]
2141
+ function formatValue(text, property) {
2142
+ if (customColumns.length > 0) {
2143
+ let newValue = text;
2144
+ let customColumn = customColumns.find((c)=>c.accessor === property);
2145
+ if (customColumn && customColumn.cell) return customColumn.cell({
2146
+ value: text
2147
+ });
2148
+ return text;
2149
+ } else return text;
2150
+ }
2151
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2152
+ className: "dc-querybuilder-title",
2153
+ children: conditions.map((c)=>{
2154
+ const field = fields[c.property];
2155
+ const description = field && field.description ? field.description : c.property;
2156
+ const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
2157
+ const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
2158
+ const formattedText = formatValue(cleanedText, c.property);
2159
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2160
+ className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
2161
+ children: [
2162
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2163
+ className: "ds-u-font-weight--bold",
2164
+ children: description
2165
+ }),
2166
+ " ",
2167
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2168
+ className: "ds-u-font-weight--normal",
2169
+ children: operator.label.toUpperCase()
2170
+ }),
2171
+ " ",
2172
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2173
+ className: "ds-u-color--success",
2174
+ children: formattedText
2175
+ })
2176
+ ]
2177
+ });
2178
+ }).reduce((prev, curr)=>[
2179
+ prev,
2180
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
2181
+ className: "ds-u-margin-x--1",
2182
+ variation: "info",
2183
+ children: "AND"
2184
+ }),
2185
+ curr
2186
+ ])
1732
2187
  });
1733
- var $e973bc477cdc2dc7$export$2e2bcd8739ae039 = $e973bc477cdc2dc7$var$DownloadIcon;
2188
+ };
2189
+ var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
1734
2190
 
1735
2191
 
1736
2192
 
1737
2193
 
1738
- const $7ec5423a30aa3f61$var$CopyIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
1739
- width: "15px",
1740
- height: "15px",
1741
- viewBox: "0 0 512 512",
1742
- version: "1.1",
1743
- xmlns: "http://www.w3.org/2000/svg",
1744
- xmlnsXlink: "http://www.w3.org/1999/xlink",
1745
- children: [
1746
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1747
- children: "Copy Icon"
1748
- }),
1749
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
1750
- stroke: "none",
1751
- strokeWidth: "1",
1752
- fill: "none",
1753
- fillRule: "evenodd",
1754
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
1755
- fill: "#112E51",
1756
- fillRule: "nonzero",
1757
- d: "M384 96L384 0h-112c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48H464c26.51 0 48-21.49 48-48V128h-95.1C398.4 128 384 113.6 384 96zM416 0v96h96L416 0zM192 352V128h-144c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h192c26.51 0 48-21.49 48-48L288 416h-32C220.7 416 192 387.3 192 352z"
1758
- })
1759
- })
1760
- ]
1761
- });
1762
- var $7ec5423a30aa3f61$export$2e2bcd8739ae039 = $7ec5423a30aa3f61$var$CopyIcon;
1763
2194
 
1764
2195
 
1765
2196
 
1766
2197
 
1767
- const $ec9e1550b0b034d0$var$SettingsIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
1768
- width: "15px",
1769
- height: "15px",
1770
- // viewBox="0 0 15 15"
1771
- viewBox: "0 0 512 512",
1772
- version: "1.1",
1773
- xmlns: "http://www.w3.org/2000/svg",
1774
- xmlnsXlink: "http://www.w3.org/1999/xlink",
2198
+ function $6369abf590ca298f$var$getStartDate(condition, schema, id) {
2199
+ if (schema[id].fields[condition.property].mysql_type === "date") {
2200
+ const newDate = new Date(condition.value.toString());
2201
+ if (newDate instanceof Date && !isNaN(newDate.getTime())) return newDate;
2202
+ }
2203
+ return new Date();
2204
+ }
2205
+ const $6369abf590ca298f$var$QueryRow = ({ id: id , condition: condition , index: index , update: update , remove: remove , propertyOptions: propertyOptions , schema: schema })=>{
2206
+ const [operator, setOperator] = (0, $hgUW1$useState)(condition.operator);
2207
+ const [property, setProperty] = (0, $hgUW1$useState)(condition.property);
2208
+ const [value, setValue] = (0, $hgUW1$useState)(condition.value);
2209
+ const [startDate, setStartDate] = (0, $hgUW1$react).useState($6369abf590ca298f$var$getStartDate(condition, schema, id));
2210
+ (0, $hgUW1$useEffect)(()=>{
2211
+ if (property !== condition.property) {
2212
+ if (property) update(index, "property", property);
2213
+ else update(index, "property", "");
2214
+ if (schema[id].fields[condition.property].mysql_type === "date") {
2215
+ if (!value) setValue(startDate.toJSON().slice(0, 10));
2216
+ }
2217
+ }
2218
+ }, [
2219
+ property,
2220
+ value,
2221
+ startDate,
2222
+ schema,
2223
+ id,
2224
+ condition
2225
+ ]);
2226
+ (0, $hgUW1$useEffect)(()=>{
2227
+ if (operator !== condition.operator) {
2228
+ if (operator) update(index, "operator", operator);
2229
+ else update(index, "operator", "");
2230
+ }
2231
+ }, [
2232
+ operator
2233
+ ]);
2234
+ (0, $hgUW1$useEffect)(()=>{
2235
+ if (value !== condition.value) {
2236
+ if (value) update(index, "value", value);
2237
+ else update(index, "value", "");
2238
+ }
2239
+ }, [
2240
+ value
2241
+ ]);
2242
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("fieldset", {
2243
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--between ds-u-align-items--center ds-u-border--0",
1775
2244
  children: [
1776
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1777
- children: "Settings Icon"
2245
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2246
+ className: "ds-l-col--12 ds-l-md-col--8 ds-u-display--flex ds-u-justify-content--between ds-u-padding-x--0",
2247
+ children: [
2248
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2249
+ options: propertyOptions,
2250
+ className: "ds-l-col--8 ds-u-padding-left--0",
2251
+ value: property,
2252
+ label: "Column Name",
2253
+ name: `${condition.key}_property`,
2254
+ onChange: (e)=>setProperty(e.target.value)
2255
+ }),
2256
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2257
+ options: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[property].mysql_type),
2258
+ className: "ds-l-col--4 ds-u-padding-x--0",
2259
+ value: operator,
2260
+ label: "Operator",
2261
+ name: `${condition.key}_operator`,
2262
+ onChange: (e)=>setOperator(e.target.value)
2263
+ })
2264
+ ]
1778
2265
  }),
1779
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
1780
- stroke: "none",
1781
- strokeWidth: "1",
1782
- fill: "none",
1783
- fillRule: "evenodd",
1784
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
1785
- fill: "#112E51",
1786
- fillRule: "nonzero",
1787
- d: "M495.9 166.6C499.2 175.2 496.4 184.9 489.6 191.2L446.3 230.6C447.4 238.9 448 247.4 448 256C448 264.6 447.4 273.1 446.3 281.4L489.6 320.8C496.4 327.1 499.2 336.8 495.9 345.4C491.5 357.3 486.2 368.8 480.2 379.7L475.5 387.8C468.9 398.8 461.5 409.2 453.4 419.1C447.4 426.2 437.7 428.7 428.9 425.9L373.2 408.1C359.8 418.4 344.1 427 329.2 433.6L316.7 490.7C314.7 499.7 307.7 506.1 298.5 508.5C284.7 510.8 270.5 512 255.1 512C241.5 512 227.3 510.8 213.5 508.5C204.3 506.1 197.3 499.7 195.3 490.7L182.8 433.6C167 427 152.2 418.4 138.8 408.1L83.14 425.9C74.3 428.7 64.55 426.2 58.63 419.1C50.52 409.2 43.12 398.8 36.52 387.8L31.84 379.7C25.77 368.8 20.49 357.3 16.06 345.4C12.82 336.8 15.55 327.1 22.41 320.8L65.67 281.4C64.57 273.1 64 264.6 64 256C64 247.4 64.57 238.9 65.67 230.6L22.41 191.2C15.55 184.9 12.82 175.3 16.06 166.6C20.49 154.7 25.78 143.2 31.84 132.3L36.51 124.2C43.12 113.2 50.52 102.8 58.63 92.95C64.55 85.8 74.3 83.32 83.14 86.14L138.8 103.9C152.2 93.56 167 84.96 182.8 78.43L195.3 21.33C197.3 12.25 204.3 5.04 213.5 3.51C227.3 1.201 241.5 0 256 0C270.5 0 284.7 1.201 298.5 3.51C307.7 5.04 314.7 12.25 316.7 21.33L329.2 78.43C344.1 84.96 359.8 93.56 373.2 103.9L428.9 86.14C437.7 83.32 447.4 85.8 453.4 92.95C461.5 102.8 468.9 113.2 475.5 124.2L480.2 132.3C486.2 143.2 491.5 154.7 495.9 166.6V166.6zM256 336C300.2 336 336 300.2 336 255.1C336 211.8 300.2 175.1 256 175.1C211.8 175.1 176 211.8 176 255.1C176 300.2 211.8 336 256 336z"
1788
- })
2266
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2267
+ 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",
2268
+ children: [
2269
+ schema[id].fields[property].mysql_type === "date" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2270
+ children: [
2271
+ /*#__PURE__*/ (0, $hgUW1$jsx)("label", {
2272
+ className: "ds-c-label",
2273
+ htmlFor: `${condition.key}_date_value`,
2274
+ id: `${condition.key}_date_value-label`,
2275
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2276
+ children: "Value"
2277
+ })
2278
+ }),
2279
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
2280
+ name: `${condition.key}_date_value`,
2281
+ selected: (0, $7264a673914aa746$export$e284ae5d89467c8f)(startDate),
2282
+ onChange: (date)=>{
2283
+ setStartDate(date);
2284
+ setValue(date.toJSON().slice(0, 10));
2285
+ },
2286
+ showMonthDropdown: true,
2287
+ showYearDropdown: true,
2288
+ dropdownMode: "select",
2289
+ className: "ds-c-field",
2290
+ withPortal: true
2291
+ })
2292
+ ]
2293
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
2294
+ className: "ds-l-col--11 ds-u-padding-x--0",
2295
+ label: "Value",
2296
+ name: `${condition.key}_value`,
2297
+ value: (0, $7264a673914aa746$export$6b5e57d20078142b)(value, operator),
2298
+ onChange: (e)=>setValue(e.target.value)
2299
+ }),
2300
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2301
+ variation: "ghost",
2302
+ size: "small",
2303
+ className: "ds-u-margin-top--3 ds-u-padding-right--0",
2304
+ "aria-label": "Delete filter",
2305
+ onClick: ()=>remove(index),
2306
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2307
+ className: "fas fa-trash"
2308
+ })
2309
+ })
2310
+ ]
1789
2311
  })
1790
2312
  ]
1791
2313
  });
1792
- var $ec9e1550b0b034d0$export$2e2bcd8739ae039 = $ec9e1550b0b034d0$var$SettingsIcon;
1793
-
2314
+ };
2315
+ var $6369abf590ca298f$export$2e2bcd8739ae039 = $6369abf590ca298f$var$QueryRow;
1794
2316
 
1795
2317
 
1796
- const $af099c546cb226c7$var$ResourceHeader = ({ setTablePadding: setTablePadding , id: id , distribution: distribution , includeFiltered: includeFiltered , includeDensity: includeDensity , includeDownload: includeDownload , resource: resource , tablePadding: tablePadding , downloadUrl: downloadUrl })=>{
1797
- const md = (0, $hgUW1$useMediaQuery)({
1798
- minWidth: 0,
1799
- maxWidth: 768
1800
- });
1801
- const { limit: limit , offset: offset , count: count , setLimit: setLimit , setOffset: setOffset } = resource;
1802
- const intCount = count ? parseInt(count) : 0;
1803
- const [referenceElement, setReferenceElement] = (0, $hgUW1$useState)(null);
1804
- const [popperElement, setPopperElement] = (0, $hgUW1$useState)(null);
1805
- const [arrowElement, setArrowElement] = (0, $hgUW1$useState)(null);
1806
- const { styles: styles , attributes: attributes } = (0, $hgUW1$usePopper)(referenceElement, popperElement, {
1807
- modifiers: [
2318
+ function $ee4ad47aa483e5b5$var$updateQueryForDatastore(condition) {
2319
+ let cond = condition;
2320
+ delete cond.key;
2321
+ if (cond.operator === "=" || cond.operator === "<>") {
2322
+ if (Array.isArray(cond.value)) cond.value = cond.value.join();
2323
+ cond.value = cond.value.replace(/(^\%+|\%+$)/gm, "");
2324
+ }
2325
+ if (cond.operator.toLowerCase() === "like") {
2326
+ if (Array.isArray(cond.value)) cond.value = cond.value.join();
2327
+ const cleanedValue = cond.value.replace(/(^\%+|\%+$)/gm, "");
2328
+ cond.value = `%${cleanedValue}%`;
2329
+ }
2330
+ if (cond.operator.toLowerCase() === "in") {
2331
+ if (!Array.isArray(cond.value)) cond.value = cond.value.split(",");
2332
+ }
2333
+ if (Array.isArray(cond.value)) cond.value = cond.value.map((v)=>v.trim().replace(/(^\%+|\%+$)/gm, ""));
2334
+ return cond;
2335
+ }
2336
+ const $ee4ad47aa483e5b5$var$QueryBuilder = (props)=>{
2337
+ const { resource: resource , id: id , includeSearchParams: includeSearchParams , customColumns: customColumns } = props;
2338
+ const { conditions: conditions , schema: schema , setConditions: setConditions } = resource;
2339
+ const fields = Object.keys(schema[id].fields);
2340
+ const [conditionsCleared, setConditionsCleared] = (0, $hgUW1$useState)(false);
2341
+ const [queryConditions, setQueryConditions] = (0, $hgUW1$useState)([]);
2342
+ const [titleConditions, setTitleConditions] = (0, $hgUW1$useState)([]); // Add use effect to load conditions on first load if needed
2343
+ const [conditionsChanged, setConditionsChanged] = (0, $hgUW1$useState)(false);
2344
+ const small = (0, $hgUW1$useMediaQuery)({
2345
+ minWidth: 0,
2346
+ maxWidth: 544
2347
+ });
2348
+ const addCondition = (condition)=>{
2349
+ if (Array.isArray(condition)) {
2350
+ const keyedConditions = condition.map((oc)=>({
2351
+ ...oc,
2352
+ key: Date.now().toString() + oc.value + oc.property
2353
+ }));
2354
+ setQueryConditions(keyedConditions);
2355
+ } else setQueryConditions([
2356
+ ...queryConditions,
1808
2357
  {
1809
- name: "arrow",
1810
- options: {
1811
- element: arrowElement
1812
- }
2358
+ property: fields[0],
2359
+ value: "",
2360
+ operator: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[fields[0]].mysql_type)[0].value,
2361
+ key: Date.now().toString()
1813
2362
  }
1814
- ]
2363
+ ]);
2364
+ };
2365
+ (0, $hgUW1$react).useEffect(()=>{
2366
+ addCondition(conditions);
2367
+ setTitleConditions(conditions);
2368
+ }, []);
2369
+ (0, $hgUW1$react).useEffect(()=>{
2370
+ if (conditionsCleared) {
2371
+ submitConditions(new Event("submit"));
2372
+ setConditionsCleared(false);
2373
+ }
2374
+ }, [
2375
+ conditionsCleared
2376
+ ]);
2377
+ const propertyOptions = fields.map((f)=>{
2378
+ if (schema[id].fields[f].description) return {
2379
+ label: schema[id].fields[f].description,
2380
+ value: f
2381
+ };
2382
+ return {
2383
+ label: f,
2384
+ value: f
2385
+ };
1815
2386
  });
1816
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1817
- className: "dc-c-resource-header",
1818
- children: [
1819
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1820
- className: "ds-l-row",
1821
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1822
- className: "ds-l-col--12",
1823
- children: includeFiltered && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
1824
- className: "ds-c-button ds-c-button--solid",
1825
- to: `/dataset/${id}/data`,
1826
- children: "View and filter data"
1827
- })
1828
- })
1829
- }),
1830
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1831
- className: "ds-l-row ds-u-align-items--center",
1832
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1833
- className: "ds-l-col--12 ds-u-display--flex ds-u-justify-content--between ds-u-align-items--center",
2387
+ const submitConditions = (e)=>{
2388
+ e.preventDefault();
2389
+ const submitConditions = queryConditions.filter((oc)=>{
2390
+ if (oc.property) return oc;
2391
+ return false;
2392
+ }).map((oc)=>{
2393
+ let cond = Object.assign({}, oc);
2394
+ return $ee4ad47aa483e5b5$var$updateQueryForDatastore(cond);
2395
+ });
2396
+ setConditions(submitConditions);
2397
+ setTitleConditions(queryConditions.map((oc)=>Object.assign({}, oc)));
2398
+ setConditionsChanged(false);
2399
+ if (includeSearchParams) {
2400
+ const url = new URL(window.location.href);
2401
+ const urlString = (0, $hgUW1$qs).stringify({
2402
+ conditions: submitConditions
2403
+ }, {
2404
+ encodeValuesOnly: true,
2405
+ addQueryPrefix: true
2406
+ });
2407
+ window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
2408
+ }
2409
+ };
2410
+ const updateCondition = (index, key, value)=>{
2411
+ let newConditions = [
2412
+ ...queryConditions
2413
+ ];
2414
+ newConditions[index][key] = value;
2415
+ setQueryConditions(newConditions);
2416
+ setConditionsChanged(true);
2417
+ };
2418
+ const removeCondition = (index)=>{
2419
+ let newConditions = queryConditions.map((oc)=>Object.assign({}, oc));
2420
+ newConditions.splice(index, 1);
2421
+ setQueryConditions(newConditions);
2422
+ setConditionsChanged(true);
2423
+ setConditionsCleared(true);
2424
+ };
2425
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2426
+ className: "dc-query-builder ds-u-margin-bottom--3",
2427
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Accordion), {
2428
+ bordered: true,
2429
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
2430
+ heading: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bef7bff2823feea2$export$2e2bcd8739ae039), {
2431
+ schema: schema[id],
2432
+ conditions: titleConditions,
2433
+ customColumns: customColumns
2434
+ }),
2435
+ defaultOpen: true,
2436
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("form", {
2437
+ onSubmit: (e)=>submitConditions(e),
1834
2438
  children: [
1835
2439
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1836
- className: "ds-u-font-weight--bold",
1837
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2ed0091f7e32d1e6$export$2e2bcd8739ae039), {
1838
- totalRows: parseInt(intCount),
1839
- limit: parseInt(limit),
1840
- offset: parseInt(offset)
1841
- })
2440
+ children: queryConditions.map((qf, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $6369abf590ca298f$export$2e2bcd8739ae039), {
2441
+ id: id,
2442
+ schema: schema,
2443
+ condition: qf,
2444
+ index: index,
2445
+ propertyOptions: propertyOptions,
2446
+ update: updateCondition,
2447
+ remove: removeCondition
2448
+ }, qf.key))
1842
2449
  }),
1843
2450
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1844
- className: "dc-c-resource-header--buttons",
2451
+ 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",
1845
2452
  children: [
1846
- includeDownload && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2453
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2454
+ 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",
2455
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2456
+ variation: "ghost",
2457
+ onClick: ()=>addCondition(null),
2458
+ className: "ds-u-padding-left--0",
2459
+ children: "+ Add another filter"
2460
+ })
2461
+ }),
2462
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2463
+ className: "ds-u-display--flex ds-u-justify-content--end ds-l-col--12 ds-l-md-col--6 ds-u-padding-x--0",
1847
2464
  children: [
1848
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Button), {
1849
- size: "small",
1850
- className: "ds-u-text-align--left ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1",
1851
- href: downloadUrl,
1852
- "aria-label": "Download filtered data (CSV)",
1853
- children: [
1854
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $e973bc477cdc2dc7$export$2e2bcd8739ae039), {}),
1855
- !md && /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1856
- className: "ds-u-font-weight--semibold ds-u-margin-left--1",
1857
- children: "Download filtered data (CSV)"
1858
- })
1859
- ]
2465
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2466
+ disabled: !conditionsChanged,
2467
+ className: "ds-u-float--right ds-l-md-col--6 ds-u-margin--right--0 ds-u-sm-margin-right--2",
2468
+ type: "submit",
2469
+ variation: "solid",
2470
+ children: "Apply filters"
1860
2471
  }),
1861
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
1862
- onOpen: ()=>{
1863
- navigator.clipboard.writeText(window.location.href);
2472
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2473
+ disabled: queryConditions.length === 0,
2474
+ className: "ds-u-float--right ds-l-md-col--6 ds-l-col--5",
2475
+ variation: small ? "ghost" : undefined,
2476
+ onClick: ()=>{
2477
+ setQueryConditions([]);
2478
+ setTitleConditions([]);
2479
+ setConditionsCleared(true);
1864
2480
  },
1865
- className: "ds-c-button ds-c-button--small ds-u-text-align--left ds-u-margin-right--1",
1866
- placement: "bottom",
1867
- dialog: true,
1868
- ariaLabel: "Copy link to filtered data",
1869
- title: "Link copied to clipboard",
1870
- children: [
1871
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $7ec5423a30aa3f61$export$2e2bcd8739ae039), {}),
1872
- !md && /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1873
- className: "ds-u-font-weight--semibold ds-u-margin-left--1",
1874
- children: "Copy link to filtered data"
1875
- })
1876
- ]
1877
- })
1878
- ]
1879
- }),
1880
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
1881
- className: "ds-c-button ds-c-button--small ds-u-text-align--left display-settings-font",
1882
- placement: "bottom",
1883
- dialog: true,
1884
- ariaLabel: "Display settings",
1885
- title: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1886
- className: "dc-c-display-settings",
1887
- children: [
1888
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $4def8e29c2039eb8$export$2e2bcd8739ae039), {
1889
- limit: limit,
1890
- setLimit: setLimit,
1891
- setOffset: setOffset
1892
- }),
1893
- includeDensity && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $1e012d1e3b534af0$export$2e2bcd8739ae039), {
1894
- setTablePadding: setTablePadding,
1895
- tablePadding: tablePadding
1896
- })
1897
- ]
1898
- }),
1899
- children: [
1900
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ec9e1550b0b034d0$export$2e2bcd8739ae039), {}),
1901
- !md && /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1902
- className: "ds-u-font-weight--semibold ds-u-margin-left--1",
1903
- children: "Display settings"
2481
+ children: small ? "Clear all" : "Clear all filters"
1904
2482
  })
1905
2483
  ]
1906
2484
  })
@@ -1909,105 +2487,107 @@ const $af099c546cb226c7$var$ResourceHeader = ({ setTablePadding: setTablePadding
1909
2487
  ]
1910
2488
  })
1911
2489
  })
1912
- ]
2490
+ })
1913
2491
  });
1914
2492
  };
1915
- var $af099c546cb226c7$export$2e2bcd8739ae039 = $af099c546cb226c7$var$ResourceHeader;
1916
-
1917
-
1918
-
1919
-
1920
-
2493
+ $ee4ad47aa483e5b5$var$QueryBuilder.defaultProps = {
2494
+ includeSearchParams: true
2495
+ };
2496
+ var $ee4ad47aa483e5b5$export$2e2bcd8739ae039 = $ee4ad47aa483e5b5$var$QueryBuilder;
1921
2497
 
1922
2498
 
1923
- const $17193a17e26a72da$var$DatasetTags = ({ keywords: keywords })=>{
1924
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1925
- className: "dc-c-dataset-tags ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1",
2499
+ function $a35cf16d1488f54e$export$1147582dfae658c6(columns, schema) {
2500
+ return columns.map((column)=>({
2501
+ header: schema && schema.fields[column].description ? schema.fields[column].description : column,
2502
+ accessor: column
2503
+ }));
2504
+ }
2505
+ const $a35cf16d1488f54e$var$DatasetTable = ({ id: id , distribution: distribution , resource: resource , rootUrl: rootUrl , customColumns: customColumns = [] , jsonUrl: jsonUrl })=>{
2506
+ const defaultPage = 1;
2507
+ const defaultPageSize = 10;
2508
+ const [page, setPage] = (0, $hgUW1$useState)(defaultPage);
2509
+ const customColumnHeaders = (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution.identifier]);
2510
+ const columns = customColumnHeaders ? customColumnHeaders : $a35cf16d1488f54e$export$1147582dfae658c6(resource.columns, resource.schema[id]);
2511
+ const rowOptions = [
2512
+ 10,
2513
+ 25,
2514
+ 50,
2515
+ 100
2516
+ ];
2517
+ const { limit: limit , setLimit: setLimit , setOffset: setOffset } = resource;
2518
+ const pageSize = limit ? limit : defaultPageSize;
2519
+ const downloadURL = `${rootUrl}/datastore/query/${id}/0/download?${(0, $hgUW1$qs).stringify({
2520
+ conditions: resource.conditions
2521
+ }, {
2522
+ encode: true
2523
+ })}&format=csv`;
2524
+ if (Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length) return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
1926
2525
  children: [
1927
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
1928
- className: "ds-u-color--primary ds-u-font-size--xl ds-u-margin-top--0 ds-u-margin-bottom--2",
1929
- children: "Tags"
2526
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ee4ad47aa483e5b5$export$2e2bcd8739ae039), {
2527
+ resource: resource,
2528
+ id: distribution.identifier,
2529
+ customColumns: customColumnHeaders
2530
+ }),
2531
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6380a4a580b24362$export$2e2bcd8739ae039), {
2532
+ resource: resource,
2533
+ downloadURL: downloadURL,
2534
+ jsonUrl: jsonUrl
2535
+ }),
2536
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2537
+ className: "ds-u-overflow--auto ds-u-border-x--1 ds-u-border-bottom--1",
2538
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
2539
+ data: resource.values,
2540
+ canResize: true,
2541
+ columns: columns,
2542
+ setSort: resource.setSort,
2543
+ sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
2544
+ tablePadding: "ds-u-padding-y--2"
2545
+ })
1930
2546
  }),
1931
- keywords && keywords.map((k)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
1932
- to: `/datasets?keyword[]=${k.data}`,
1933
- className: "dc-c-dataset-tags--tag ds-u-color--base ds-u-font-size--sm ds-u-text-decoration--none ds-u-margin-right--1 ds-u-margin-bottom--1 ds-u-padding-x--2 ds-u-padding-y--1 ds-u-radius",
1934
- children: k.data
1935
- }, k.identifier))
2547
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2548
+ 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",
2549
+ children: [
2550
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
2551
+ totalPages: Math.ceil(resource.count / pageSize),
2552
+ currentPage: page,
2553
+ onPageChange: (evt, page)=>{
2554
+ evt.preventDefault();
2555
+ setOffset((page - 1) * limit);
2556
+ setPage(page);
2557
+ },
2558
+ renderHref: (page)=>{
2559
+ return "";
2560
+ },
2561
+ className: "ds-l-lg-col--7 ds-l-md-col--9 ds-l-col--12 ds-u-padding-x--0"
2562
+ }),
2563
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2564
+ options: rowOptions.map((row)=>({
2565
+ label: row.toString(),
2566
+ value: row
2567
+ })),
2568
+ size: "medium",
2569
+ label: "Rows per page:",
2570
+ labelClassName: "ds-u-margin-top--0",
2571
+ name: "datatable_rows_per_page",
2572
+ onChange: (e)=>{
2573
+ setLimit(parseInt(e.target.value));
2574
+ setPage(1);
2575
+ setOffset(0);
2576
+ },
2577
+ defaultValue: limit.toString()
2578
+ })
2579
+ ]
2580
+ })
1936
2581
  ]
1937
2582
  });
2583
+ else return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {});
1938
2584
  };
1939
- $17193a17e26a72da$var$DatasetTags.propTypes = {
1940
- keywords: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).shape({
1941
- data: (0, $hgUW1$proptypes).string.isRequired,
1942
- identifier: (0, $hgUW1$proptypes).string.isRequired
1943
- })).isRequired
1944
- };
1945
- var $17193a17e26a72da$export$2e2bcd8739ae039 = $17193a17e26a72da$var$DatasetTags;
2585
+ var $a35cf16d1488f54e$export$2e2bcd8739ae039 = $a35cf16d1488f54e$var$DatasetTable;
1946
2586
 
1947
2587
 
1948
2588
 
1949
2589
 
1950
2590
 
1951
- const $f341c2fd9bc53390$var$DatasetDownloads = ({ dataDictionaryURL: dataDictionaryURL , dataDictionaryType: dataDictionaryType , distributions: distributions })=>{
1952
- function trimDataDictionaryType() {
1953
- let splitDataDictionaryType = dataDictionaryType.split("/");
1954
- let type = splitDataDictionaryType.length > 1 ? splitDataDictionaryType[1] : splitDataDictionaryType[0];
1955
- return type.toUpperCase();
1956
- }
1957
- function getFormatType(dist) {
1958
- if (dist.data.format) return dist.data.format.toUpperCase();
1959
- if (dist.data.mediaType) {
1960
- const mediaType = dist.data.mediaType.split("/");
1961
- if (mediaType.length && mediaType[1]) return mediaType[1].toUpperCase();
1962
- }
1963
- if (dist.data["%Ref:downloadURL"].length && dist.data["%Ref:downloadURL"][0].data) {
1964
- if (dist.data["%Ref:downloadURL"][0].data.mimeType) {
1965
- const mimeType = dist.data["%Ref:downloadURL"][0].data.mimeType.split("/");
1966
- if (mimeType.length && mimeType[1]) return mimeType[1].toUpperCase();
1967
- }
1968
- }
1969
- return "";
1970
- }
1971
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1972
- className: "ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1 dc-c-dataset-downloads",
1973
- children: [
1974
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
1975
- className: "ds-u-color--primary ds-u-font-size--xl ds-u-margin-top--0 ds-u-margin-bottom--2 ds-u-padding-bottom--2 ds-u-border ds-u-border-bottom--1",
1976
- children: "Downloads"
1977
- }),
1978
- (distributions.length || dataDictionaryURL && dataDictionaryType) && /*#__PURE__*/ (0, $hgUW1$jsxs)("ul", {
1979
- className: "ds-c-list ds-c-list--bare",
1980
- children: [
1981
- distributions.map((dist)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1982
- className: "ds-u-padding-bottom--1",
1983
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
1984
- href: dist.data.downloadURL,
1985
- className: "ds-u-word-break",
1986
- children: [
1987
- getFormatType(dist),
1988
- " ",
1989
- "Resource File"
1990
- ]
1991
- })
1992
- }, dist.identifier)),
1993
- dataDictionaryURL && dataDictionaryType && /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1994
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
1995
- href: dataDictionaryURL,
1996
- children: [
1997
- "Data Dictionary (",
1998
- trimDataDictionaryType(),
1999
- ")"
2000
- ]
2001
- })
2002
- })
2003
- ]
2004
- })
2005
- ]
2006
- });
2007
- };
2008
- var $f341c2fd9bc53390$export$2e2bcd8739ae039 = $f341c2fd9bc53390$var$DatasetDownloads;
2009
-
2010
-
2011
2591
 
2012
2592
 
2013
2593
 
@@ -2070,624 +2650,366 @@ var $5644ebd2c3dbfd7b$export$2e2bcd8739ae039 = $5644ebd2c3dbfd7b$var$DatasetAddi
2070
2650
 
2071
2651
 
2072
2652
 
2073
- const $072291d44ce1834a$var$ResourceFooter = ({ resource: resource })=>{
2074
- const { limit: limit , values: values , offset: offset , count: count , setOffset: setOffset } = resource;
2075
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2076
- children: values.length > 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
2077
- id: "test-default",
2078
- currentPage: Number(offset) / limit + 1,
2079
- totalPages: Math.ceil(Number(count) / limit),
2080
- onPageChange: (evt, page)=>{
2081
- evt.preventDefault();
2082
- setOffset((page - 1) * limit);
2083
- },
2084
- renderHref: (page)=>{
2085
- return "";
2086
- }
2087
- })
2088
- });
2089
- };
2090
- var $072291d44ce1834a$export$2e2bcd8739ae039 = $072291d44ce1834a$var$ResourceFooter;
2091
-
2092
-
2093
-
2094
-
2095
2653
 
2096
2654
 
2097
- const $68eacd619bee0da7$var$ResourceInformation = ({ resource: resource })=>{
2655
+ const $0958733ee130fc44$var$ResourceInformation = ({ resource: resource })=>{
2098
2656
  const { count: count , columns: columns } = resource;
2099
2657
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2100
- className: "dc-c-resource-info-table",
2658
+ className: "dc-c-resource-info-table ds-l-col--12 ds-u-padding-left--0 ds-u-margin-y--2",
2101
2659
  children: [
2102
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2103
- className: "ds-text-heading--2xl ds-u-margin-y--3",
2660
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h3", {
2661
+ className: "ds-u-font-size--base ds-h3 ds-text-heading--xl",
2104
2662
  children: "About this Resource"
2105
2663
  }),
2106
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
2107
- compact: true,
2108
- striped: true,
2664
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2665
+ className: "ds-u-display--flex ds-u-text-align--center ds-u-justify-content--center ds-u-md-justify-content--start",
2109
2666
  children: [
2110
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
2667
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2668
+ className: "ds-u-fill--gray-lightest ds-u-radius ds-u-margin-right--1 ds-u-padding--2",
2111
2669
  children: [
2112
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2113
- component: "th",
2114
- scope: "row",
2670
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2671
+ className: "ds-u-padding-top--05",
2115
2672
  children: "Rows"
2116
2673
  }),
2117
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2118
- align: "right",
2119
- children: parseInt(count).toLocaleString()
2674
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2675
+ className: "ds-u-font-weight--bold",
2676
+ children: count.toLocaleString()
2120
2677
  })
2121
2678
  ]
2122
2679
  }),
2123
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
2680
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2681
+ className: "ds-u-fill--gray-lightest ds-u-radius ds-u-margin-right--1 ds-u-padding--2",
2682
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2683
+ children: [
2684
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2685
+ className: "ds-u-padding-top--05",
2686
+ children: "Columns"
2687
+ }),
2688
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2689
+ className: "ds-u-font-weight--bold",
2690
+ children: columns.length.toLocaleString()
2691
+ })
2692
+ ]
2693
+ })
2694
+ })
2695
+ ]
2696
+ })
2697
+ ]
2698
+ });
2699
+ };
2700
+ var $0958733ee130fc44$export$2e2bcd8739ae039 = $0958733ee130fc44$var$ResourceInformation;
2701
+
2702
+
2703
+
2704
+ const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions , resource: resource , title: title })=>{
2705
+ function getFormatType(dist) {
2706
+ if (dist.data.format) return dist.data.format.toLowerCase();
2707
+ if (dist.data.mediaType) {
2708
+ const mediaType = dist.data.mediaType.split("/");
2709
+ if (mediaType.length && mediaType[1]) return mediaType[1].toLowerCase();
2710
+ }
2711
+ if (dist.data["%Ref:downloadURL"].length && dist.data["%Ref:downloadURL"][0].data) {
2712
+ if (dist.data["%Ref:downloadURL"][0].data.mimeType) {
2713
+ const mimeType = dist.data["%Ref:downloadURL"][0].data.mimeType.split("/");
2714
+ if (mimeType.length && mimeType[1]) return mimeType[1].toLowerCase();
2715
+ }
2716
+ }
2717
+ return "";
2718
+ }
2719
+ const sm = (0, $hgUW1$useMediaQuery)({
2720
+ minWidth: 0,
2721
+ maxWidth: 767
2722
+ });
2723
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2724
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap",
2725
+ children: [
2726
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2727
+ className: "ds-l-col--12 ds-u-padding-left--0 ds-text-heading--2xl",
2728
+ children: "Resources"
2729
+ }),
2730
+ distributions.length && /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
2731
+ className: "ds-c-list ds-c-list--bare dc-c-resource-full-width",
2732
+ children: distributions.map((dist)=>{
2733
+ const fileFormat = getFormatType(dist);
2734
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
2735
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap",
2124
2736
  children: [
2125
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2126
- component: "th",
2127
- scope: "row",
2128
- children: "Columns"
2737
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2738
+ 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",
2739
+ children: [
2740
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2741
+ className: "fa ds-u-color--primary ds-u-padding-right--1 fa-file-" + (fileFormat == "xlsx" ? "excel" : fileFormat)
2742
+ }),
2743
+ title + " (" + fileFormat.toUpperCase() + ")"
2744
+ ]
2129
2745
  }),
2130
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2131
- align: "right",
2132
- children: columns.length.toLocaleString()
2746
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2747
+ 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",
2748
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
2749
+ href: dist.data.downloadURL,
2750
+ style: {
2751
+ order: sm ? "1" : "0",
2752
+ width: sm ? "100%" : "auto"
2753
+ },
2754
+ "aria-label": "Download " + title + " " + fileFormat,
2755
+ className: "ds-c-button",
2756
+ children: [
2757
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2758
+ className: "fa fa-file-download ds-u-color--primary ds-u-padding-right--1"
2759
+ }),
2760
+ "Download"
2761
+ ]
2762
+ })
2763
+ }),
2764
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $0958733ee130fc44$export$2e2bcd8739ae039), {
2765
+ resource: resource
2133
2766
  })
2134
2767
  ]
2768
+ }, dist.identifier);
2769
+ })
2770
+ })
2771
+ ]
2772
+ });
2773
+ };
2774
+ var $7357cc0f79f9c514$export$2e2bcd8739ae039 = $7357cc0f79f9c514$var$Resource;
2775
+
2776
+
2777
+ const $364dc44850cd8f7f$var$DatasetOverview = ({ dataset: dataset , resource: resource , distributions: distributions , metadataMapping: metadataMapping })=>{
2778
+ const md = (0, $hgUW1$useMediaQuery)({
2779
+ minWidth: 0,
2780
+ maxWidth: 768
2781
+ });
2782
+ const rows = (0, $5644ebd2c3dbfd7b$export$eea3a12df15499ca)(metadataMapping, dataset);
2783
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2784
+ children: [
2785
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $7357cc0f79f9c514$export$2e2bcd8739ae039), {
2786
+ distributions: distributions,
2787
+ resource: resource,
2788
+ title: dataset.title
2789
+ }),
2790
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2791
+ 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",
2792
+ children: [
2793
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2794
+ className: "ds-h2 ds-text-heading--2xl",
2795
+ children: "Additional Information"
2796
+ }),
2797
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Table), {
2798
+ compact: true,
2799
+ stackable: true,
2800
+ stackableBreakpoint: "md",
2801
+ warningDisabled: true,
2802
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
2803
+ children: rows.map((r)=>/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
2804
+ children: [
2805
+ md ? "" : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2806
+ component: "th",
2807
+ className: "ds-u-font-weight--bold",
2808
+ children: r.label
2809
+ }),
2810
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2811
+ stackedTitle: r.label,
2812
+ children: r.value
2813
+ })
2814
+ ]
2815
+ }, `${r.label}_${dataset.identifier}`))
2816
+ })
2135
2817
  })
2136
2818
  ]
2137
2819
  })
2138
2820
  ]
2139
2821
  });
2140
2822
  };
2141
- var $68eacd619bee0da7$export$2e2bcd8739ae039 = $68eacd619bee0da7$var$ResourceInformation;
2823
+ var $364dc44850cd8f7f$export$2e2bcd8739ae039 = $364dc44850cd8f7f$var$DatasetOverview;
2142
2824
 
2143
2825
 
2144
- // Example custom column headers, where only effective date has an ! at the end
2145
- // [
2146
- // {schema: 'date', cell: ({ value }) => localeDate(value),},
2147
- // {accessor: 'effective_date',cell: ({ value }) => localeDate(value) + '!',},
2148
- // ]
2149
- function $7264a673914aa746$export$8049e8f40a9bdfb8(customHeaders, columns, schema) {
2150
- return columns.map((column)=>{
2151
- const customAccessorIndex = customHeaders.findIndex((header)=>header.accessor === column);
2152
- const customSchemaIndex = customHeaders.findIndex((header)=>header.schema === schema.fields[column].mysql_type);
2153
- let newColumn = {};
2154
- // If specific accessor is passed, this will override a general mysql_type Cell rewrite.
2155
- if (customAccessorIndex > -1) {
2156
- newColumn.header = schema && schema.fields[column].description ? schema.fields[column].description : column;
2157
- newColumn.accessor = column;
2158
- newColumn.cell = customHeaders[customAccessorIndex].cell;
2159
- } else {
2160
- newColumn.header = schema && schema.fields[column].description ? schema.fields[column].description : column;
2161
- newColumn.accessor = column;
2162
- if (customSchemaIndex > -1) newColumn.cell = customHeaders[customSchemaIndex].cell;
2163
- }
2164
- return newColumn;
2826
+
2827
+
2828
+
2829
+
2830
+
2831
+
2832
+
2833
+ const $789279954d8eff7f$var$ApiDocumentation = ({ endpoint: endpoint })=>{
2834
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2835
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
2836
+ url: endpoint
2837
+ })
2165
2838
  });
2166
- }
2167
- function $7264a673914aa746$export$e284ae5d89467c8f(date) {
2168
- if (!date) return date;
2169
- date = new Date(date);
2170
- date = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
2171
- return date;
2172
- }
2173
- function $7264a673914aa746$export$6b5e57d20078142b(value, operator) {
2174
- let newValue = value;
2175
- if (Array.isArray(newValue)) newValue = newValue.join(",");
2176
- // return newValue.replace(/(^\%+|\%+$)/gm, '');
2177
- return newValue;
2178
- }
2179
- const $7264a673914aa746$export$5f89a5ae87bc48e1 = [
2180
- {
2181
- label: "Is",
2182
- value: "="
2183
- },
2184
- {
2185
- label: "Starts With",
2186
- value: "starts with"
2187
- },
2188
- {
2189
- label: "Contains",
2190
- value: "contains"
2191
- },
2192
- {
2193
- label: "Is Not",
2194
- value: "<>"
2195
- },
2196
- {
2197
- label: "Or",
2198
- value: "in"
2199
- },
2200
- {
2201
- label: "Is",
2202
- value: "="
2203
- },
2204
- {
2205
- label: "Is Not",
2206
- value: "<>"
2207
- },
2208
- {
2209
- label: "Greater Than",
2210
- value: ">"
2211
- },
2212
- {
2213
- label: "Less Than",
2214
- value: "<"
2215
- }
2216
- ];
2217
- function $7264a673914aa746$export$2b9377795161999(type) {
2218
- switch(type){
2219
- case "text":
2220
- case "string":
2221
- return [
2222
- {
2223
- label: "Is",
2224
- value: "="
2225
- },
2226
- {
2227
- label: "Starts With",
2228
- value: "starts with"
2229
- },
2230
- {
2231
- label: "Contains",
2232
- value: "contains"
2233
- },
2234
- {
2235
- label: "Is Not",
2236
- value: "<>"
2237
- },
2238
- {
2239
- label: "Or",
2240
- value: "in"
2241
- }
2242
- ];
2243
- case "date":
2244
- return [
2245
- {
2246
- label: "Is",
2247
- value: "="
2248
- },
2249
- {
2250
- label: "Is Not",
2251
- value: "<>"
2252
- },
2253
- {
2254
- label: "Greater Than",
2255
- value: ">"
2256
- },
2257
- {
2258
- label: "Less Than",
2259
- value: "<"
2260
- }
2261
- ];
2262
- default:
2263
- // These 2 should be safe for all data types
2264
- return [
2265
- {
2266
- label: "Is",
2267
- value: "="
2268
- },
2269
- {
2270
- label: "Is Not",
2271
- value: "<>"
2272
- }
2273
- ];
2274
- }
2275
- }
2276
-
2839
+ };
2840
+ var $789279954d8eff7f$export$2e2bcd8739ae039 = $789279954d8eff7f$var$ApiDocumentation;
2277
2841
 
2278
2842
 
2279
- const $766b8e351dd607f5$var$DatasetBody = ({ rootUrl: rootUrl , id: id , dataset: dataset , additionalParams: additionalParams , customColumns: customColumns , columnSettings: columnSettings , columnWidths: columnWidths , metadataMapping: metadataMapping })=>{
2280
- let apiDocs = (0, $hgUW1$useRef)();
2281
- const [tablePadding, setTablePadding] = (0, $hgUW1$useState)("ds-u-padding-y--1");
2282
- const [fileFormat, setFileFormat] = (0, $hgUW1$useState)("");
2283
- let distribution = {};
2284
- let distribution_array = dataset.distribution ? dataset.distribution : [];
2285
- if (distribution_array.length) distribution = distribution_array[0];
2286
- const resource = (0, $1d3d480a9cfaabe0$export$2e2bcd8739ae039)("", rootUrl, {
2287
- limit: 10,
2288
- manual: true
2289
- }, additionalParams);
2290
- (0, $hgUW1$useEffect)(()=>{
2291
- if (distribution.identifier) {
2292
- let localFileFormat = "";
2293
- if (distribution.data.format) localFileFormat = distribution.data.format.toUpperCase();
2294
- else if (distribution.data.mediaType) {
2295
- const mediaType = distribution.data.mediaType.split("/");
2296
- if (mediaType.length && mediaType[1]) localFileFormat = mediaType[1].toUpperCase();
2297
- }
2298
- setFileFormat(localFileFormat);
2299
- if (localFileFormat === "CSV") {
2300
- resource.setResource(distribution.identifier);
2301
- resource.setManual(false);
2302
- }
2303
- }
2304
- }, [
2305
- distribution
2306
- ]);
2307
- return /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
2308
- className: "ds-l-container",
2309
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2310
- className: "ds-l-row ds-u-padding-top--3",
2311
- children: [
2312
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2313
- className: "ds-l-md-col--9 ds-l-sm-col--12",
2314
- children: [
2315
- /*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
2316
- className: "ds-title ds-u-word-break",
2317
- children: dataset.title
2318
- }),
2319
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2320
- className: "ds-l-row",
2321
- children: [
2322
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2323
- className: "ds-l-col--6 ds-u-margin-bottom--2",
2324
- children: dataset.theme ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
2325
- variation: "info",
2326
- children: dataset.theme[0].data
2327
- }) : null
2328
- }),
2329
- dataset.modified && /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
2330
- className: "ds-l-col--6 ds-u-color--gray ds-u-text-align--right",
2331
- children: [
2332
- "Updated ",
2333
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
2334
- date: dataset.modified
2335
- })
2336
- ]
2337
- })
2338
- ]
2339
- }),
2340
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2341
- className: "dc-c-metadata-description",
2342
- dangerouslySetInnerHTML: {
2343
- __html: (0, $hgUW1$dompurify).sanitize(dataset.description)
2344
- }
2345
- }),
2346
- resource.columns && Object.keys(resource.schema).length ? /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2843
+ const $cf6eaefd6b928de3$var$DatasetAPI = ({ id: id , rootUrl: rootUrl , apiUrl: apiUrl , additionalParams: additionalParams })=>{
2844
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2845
+ children: [
2846
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2847
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap",
2848
+ children: [
2849
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2850
+ className: "ds-l-col--12 ds-l-md-col--9 ds-u-padding-left--0",
2851
+ children: [
2852
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2853
+ className: "ds-text-heading--2xl",
2854
+ children: "Try the API"
2855
+ }),
2856
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2857
+ children: "The Open Data API (ODA) provides programmatic access to this dataset including the ability to filter, query, and aggregate data."
2858
+ })
2859
+ ]
2860
+ }),
2861
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2862
+ 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",
2863
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
2864
+ href: apiUrl,
2347
2865
  children: [
2348
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2349
- className: "dc-resource-header ds-text-heading--2xl ds-u-margin-y--3",
2350
- children: "Resource Preview"
2351
- }),
2352
- resource.columns ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2866
+ "View API",
2867
+ " ",
2868
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2869
+ style: {
2870
+ whiteSpace: "nowrap"
2871
+ },
2353
2872
  children: [
2354
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $af099c546cb226c7$export$2e2bcd8739ae039), {
2355
- id: id,
2356
- includeFiltered: true,
2357
- includeDensity: true,
2358
- tablePadding: tablePadding,
2359
- setTablePadding: setTablePadding,
2360
- distribution: distribution,
2361
- resource: resource
2362
- }),
2363
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $626282d9a03c51d5$export$2e2bcd8739ae039), {
2364
- id: distribution.identifier,
2365
- tablePadding: tablePadding,
2366
- resource: resource,
2367
- customColumns: (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution_array[0].identifier]),
2368
- columnSettings: columnSettings,
2369
- options: {
2370
- layout: "flex",
2371
- columnFilter: false,
2372
- columnSort: true,
2373
- columnResize: true
2374
- },
2375
- columnWidths: columnWidths
2376
- }),
2377
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $072291d44ce1834a$export$2e2bcd8739ae039), {
2378
- resource: resource
2379
- }),
2380
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $68eacd619bee0da7$export$2e2bcd8739ae039), {
2381
- resource: resource
2873
+ "specification ",
2874
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2875
+ className: "fa fa-arrow-right ds-u-font-weight--bold"
2382
2876
  })
2383
2877
  ]
2384
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)(Spinner, {
2385
- "aria-valuetext": "Dataset loading",
2386
- role: "status"
2387
2878
  })
2388
2879
  ]
2389
- }) : "",
2390
- dataset.identifier && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5644ebd2c3dbfd7b$export$2e2bcd8739ae039), {
2391
- datasetInfo: dataset,
2392
- id: dataset.identifier,
2393
- metadataMapping: metadataMapping
2394
- }),
2395
- Object.keys(distribution).length && fileFormat === "CSV" && dataset.identifier ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2396
- ref: apiDocs,
2397
- children: [
2398
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2399
- className: "ds-text-heading--2xl ds-u-margin-y--2",
2400
- children: "Try the API"
2401
- }),
2402
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
2403
- url: `${rootUrl}/metastore/schemas/dataset/items/${dataset.identifier}/docs${additionalParams && additionalParams.ACA ? "?ACA=" + additionalParams.ACA + "&redirect=false" : ""}`,
2404
- docExpansion: "list",
2405
- defaultModelsExpandDepth: -1
2406
- })
2407
- ]
2408
- }) : ""
2409
- ]
2410
- }),
2411
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2412
- className: "ds-l-md-col--3 ds-l-sm-col--12",
2413
- children: [
2414
- Object.keys(distribution).length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $f341c2fd9bc53390$export$2e2bcd8739ae039), {
2415
- dataDictionaryURL: dataset.describedBy,
2416
- dataDictionaryType: dataset.describedByType,
2417
- distributions: dataset.distribution
2418
- }) : "",
2419
- dataset.keyword && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $17193a17e26a72da$export$2e2bcd8739ae039), {
2420
- keywords: dataset.keyword
2421
- }),
2422
- Object.keys(distribution).length && fileFormat === "CSV" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2423
- className: "dc-c-dataset-tags ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1",
2424
- children: [
2425
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2426
- className: "ds-u-color--primary ds-u-font-size--xl ds-u-margin-top--0 ds-u-margin-bottom--2 ds-u-padding-bottom--2",
2427
- children: "API"
2428
- }),
2429
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2430
- variation: "ghost",
2431
- onClick: ()=>window.scrollTo({
2432
- behavior: "smooth",
2433
- top: apiDocs.current.offsetTop
2434
- }),
2435
- children: "Scroll to dataset API"
2436
- })
2437
- ]
2438
- }) : ""
2439
- ]
2440
- })
2441
- ]
2442
- })
2880
+ })
2881
+ })
2882
+ ]
2883
+ }),
2884
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $789279954d8eff7f$export$2e2bcd8739ae039), {
2885
+ endpoint: `${rootUrl}/metastore/schemas/dataset/items/${id}/docs${additionalParams && additionalParams.ACA ? "?ACA=" + additionalParams.ACA + "&redirect=false" : ""}`
2886
+ })
2887
+ ]
2443
2888
  });
2444
2889
  };
2445
- $766b8e351dd607f5$var$DatasetBody.propTypes = {
2446
- id: (0, $hgUW1$proptypes).string.isRequired,
2447
- dataset: (0, $hgUW1$proptypes).object.isRequired
2448
- };
2449
- var $766b8e351dd607f5$export$2e2bcd8739ae039 = $766b8e351dd607f5$var$DatasetBody;
2450
-
2451
-
2890
+ var $cf6eaefd6b928de3$export$2e2bcd8739ae039 = $cf6eaefd6b928de3$var$DatasetAPI;
2452
2891
 
2453
2892
 
2454
2893
 
2455
2894
 
2456
2895
 
2457
- const $28f16f59778efa64$export$82b1b1d517e5388a = {
2458
- "R/P10Y": {
2459
- name: "Decennial"
2460
- },
2461
- "R/P4Y": {
2462
- name: "Quadrennial"
2463
- },
2464
- "R/P1Y": {
2465
- name: "Annual"
2466
- },
2467
- "R/P2M": {
2468
- name: "Bimonthly"
2469
- },
2470
- "R/P3.5D": {
2471
- name: "Semiweekly"
2472
- },
2473
- "R/P1D": {
2474
- name: "Daily"
2475
- },
2476
- "R/P2W": {
2477
- name: "Biweekly"
2478
- },
2479
- "R/P6M": {
2480
- name: "Semiannual"
2481
- },
2482
- "R/P2Y": {
2483
- name: "Biennial"
2484
- },
2485
- "R/P3Y": {
2486
- name: "Triennial"
2487
- },
2488
- "R/P0.33W": {
2489
- name: "Three times a week"
2490
- },
2491
- "R/P0.33M": {
2492
- name: "Three times a month"
2493
- },
2494
- "R/PT1S": {
2495
- name: "Continuously updated"
2496
- },
2497
- "R/P1M": {
2498
- name: "Monthly"
2499
- },
2500
- "R/P3M": {
2501
- name: "Quarterly"
2502
- },
2503
- "R/P0.5M": {
2504
- name: "Semimonthly"
2505
- },
2506
- "R/P4M": {
2507
- name: "Three times a year"
2508
- },
2509
- "R/P1W": {
2510
- name: "Weekly"
2511
- },
2512
- "R/PT1H": {
2513
- name: "Hourly"
2514
- },
2515
- irregular: {
2516
- name: "Irregular"
2517
- }
2518
- };
2519
-
2520
2896
 
2521
- const $6da0396069e23175$export$bc27cf7ecf44639d = {
2522
- modified: (data)=>{
2523
- return [
2524
- {
2525
- label: "Modified",
2526
- value: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
2527
- date: data
2528
- })
2529
- }
2530
- ];
2531
- },
2532
- issued: (data)=>{
2533
- return [
2534
- {
2535
- label: "Issued",
2536
- value: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
2537
- date: data
2538
- })
2539
- }
2540
- ];
2541
- },
2542
- accrualPeriodicity: (data)=>{
2543
- return [
2544
- {
2545
- label: "Frequency",
2546
- value: (0, $28f16f59778efa64$export$82b1b1d517e5388a)[data].name
2547
- }
2548
- ];
2549
- },
2550
- publisher: (data)=>{
2551
- if (data.data && data.data.name) return [
2552
- {
2553
- label: "Publisher",
2554
- value: data.data.name
2555
- }
2556
- ];
2557
- else return [];
2558
- },
2559
- identifier: (data)=>{
2560
- return [
2561
- {
2562
- label: "Identifier",
2563
- value: data
2564
- }
2565
- ];
2566
- },
2567
- contactPoint: (data)=>{
2568
- let rows = [];
2569
- if (data.fn) rows.push({
2570
- label: "Contact",
2571
- value: data.fn
2572
- });
2573
- if (data.hasEmail) rows.push({
2574
- label: "Contact Email",
2575
- value: data.hasEmail
2576
- });
2577
- return rows;
2578
- },
2579
- bureauCode: (data)=>{
2580
- if (data.length) return [
2581
- {
2582
- label: "Bureau Code",
2583
- value: data[0]
2584
- }
2585
- ];
2586
- },
2587
- programCode: (data)=>{
2588
- if (data.length) return [
2589
- {
2590
- label: "Program Code",
2591
- value: data[0]
2592
- }
2593
- ];
2594
- },
2595
- theme: (data)=>{
2596
- return [
2597
- {
2598
- label: "Category",
2599
- value: data.map((theme)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
2600
- to: `/datasets?theme[]=${theme.data}`,
2601
- children: theme.data
2602
- }, theme.data)).reduce((prev, curr)=>[
2603
- prev,
2604
- ", ",
2605
- curr
2606
- ])
2607
- }
2608
- ];
2609
- },
2610
- keyword: (data)=>{
2611
- return [
2612
- {
2613
- label: "Tags",
2614
- value: data.map((keyword)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
2615
- to: `/datasets?keyword[]=${keyword.data}`,
2616
- children: keyword.data
2617
- }, keyword.data)).reduce((prev, curr)=>[
2618
- prev,
2619
- ", ",
2620
- curr
2621
- ])
2622
- }
2623
- ];
2624
- },
2625
- license: (data)=>{
2626
- return [
2627
- {
2628
- label: "License",
2629
- value: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
2630
- href: data,
2631
- children: data
2632
- })
2633
- }
2634
- ];
2635
- },
2636
- accessLevel: (data)=>{
2637
- return [
2638
- {
2639
- label: "Public Access Level",
2640
- value: data
2641
- }
2642
- ];
2643
- },
2644
- temporal: (data)=>{
2645
- return [
2646
- {
2647
- label: "Temporal Coverage",
2648
- value: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2649
- className: "dc-c-word-break--all",
2650
- children: data
2651
- })
2652
- }
2653
- ];
2654
- },
2655
- spatial: (data)=>{
2656
- return [
2657
- {
2658
- label: "Spacial/Geographical Coverage",
2659
- value: data
2660
- }
2661
- ];
2662
- },
2663
- references: (data)=>{
2664
- return [
2665
- {
2666
- label: "Related Documents",
2667
- value: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
2668
- className: "ds-u-margin--0 ds-u-padding-y--0 ds-u-padding-left--2 ds-u-padding-right--0",
2669
- children: data.map((item)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
2670
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
2671
- href: item,
2672
- children: item
2673
- })
2674
- }, item))
2675
- })
2676
- }
2677
- ];
2678
- }
2897
+ const $6012b86ffcaf3f71$var$DataDictionary = ({ datasetDictionary: datasetDictionary , title: title })=>{
2898
+ const tableColumns = [
2899
+ {
2900
+ colName: "name",
2901
+ UIName: "Name"
2902
+ },
2903
+ {
2904
+ colName: "title",
2905
+ UIName: "Title"
2906
+ },
2907
+ {
2908
+ colName: "type",
2909
+ UIName: "Type"
2910
+ },
2911
+ {
2912
+ colName: "format",
2913
+ UIName: "Format"
2914
+ }
2915
+ ];
2916
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2917
+ children: [
2918
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2919
+ className: "ds-text-heading--2xl ds-u-margin-y--3",
2920
+ children: title
2921
+ }),
2922
+ /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
2923
+ children: [
2924
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableHead), {
2925
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableRow), {
2926
+ children: tableColumns.map((col)=>{
2927
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2928
+ children: col.UIName
2929
+ });
2930
+ })
2931
+ })
2932
+ }),
2933
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
2934
+ children: datasetDictionary.map((row)=>{
2935
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableRow), {
2936
+ children: tableColumns.map((col)=>{
2937
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2938
+ children: row[col.colName]
2939
+ });
2940
+ })
2941
+ });
2942
+ })
2943
+ })
2944
+ ]
2945
+ })
2946
+ ]
2947
+ });
2679
2948
  };
2949
+ var $6012b86ffcaf3f71$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($6012b86ffcaf3f71$var$DataDictionary);
2680
2950
 
2681
2951
 
2682
2952
 
2683
- const $6e7bdcbebdb4b794$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalParams: additionalParams , customColumns: customColumns , setDatasetTitle: setDatasetTitle , columnSettings: columnSettings , columnWidths: columnWidths , customMetadataMapping: customMetadataMapping })=>{
2684
- const metastore = (0, $68d79598b83f3382$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
2685
- const { dataset: dataset } = metastore;
2953
+ const $a0f13962e513caa1$var$getSiteWideDataDictionary = (rootUrl, dataDictionaryUrl)=>{
2954
+ const { data: data , isLoading: isLoading , error: error } = (0, $hgUW1$useQuery)({
2955
+ queryKey: [
2956
+ "dictionary"
2957
+ ],
2958
+ queryFn: ()=>{
2959
+ return fetch(rootUrl + dataDictionaryUrl).then((res)=>res.json());
2960
+ }
2961
+ });
2962
+ return {
2963
+ siteWideDataDictionary: data,
2964
+ dataDictionaryLoading: isLoading
2965
+ };
2966
+ };
2967
+ const $a0f13962e513caa1$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalParams: additionalParams , customColumns: customColumns , setDatasetTitle: setDatasetTitle , customMetadataMapping: customMetadataMapping , apiPageUrl: apiPageUrl = "/api" , dataDictionaryUrl: dataDictionaryUrl })=>{
2968
+ const options = location.search ? {
2969
+ ...(0, $hgUW1$qs).parse(location.search, {
2970
+ ignoreQueryPrefix: true
2971
+ })
2972
+ } : {
2973
+ conditions: []
2974
+ };
2975
+ const { dataset: dataset } = (0, $b4aa9c66f2e86959$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
2686
2976
  const title = dataset.title ? dataset.title : "";
2687
2977
  const metadataMapping = {
2688
2978
  ...(0, $6da0396069e23175$export$bc27cf7ecf44639d),
2689
2979
  ...customMetadataMapping
2690
2980
  };
2981
+ let distribution = {};
2982
+ let distributions = dataset.distribution ? dataset.distribution : [];
2983
+ if (distributions.length) distribution = distributions[0];
2984
+ const resource = (0, $1d3d480a9cfaabe0$export$2e2bcd8739ae039)("", rootUrl, {
2985
+ ...options,
2986
+ limit: 25,
2987
+ manual: true
2988
+ }, additionalParams);
2989
+ const { siteWideDataDictionary: siteWideDataDictionary } = dataDictionaryUrl ? $a0f13962e513caa1$var$getSiteWideDataDictionary(rootUrl, dataDictionaryUrl) : {
2990
+ siteWideDataDictionary: null
2991
+ };
2992
+ // compare schema fields with siteWideDataDictionary to display commonalities for now
2993
+ // until dataset level data dictionaries are implemented
2994
+ const datasetDictionary = siteWideDataDictionary && resource && resource.schema[distribution.identifier] ? siteWideDataDictionary.data.fields.filter((field)=>{
2995
+ return Object.keys(resource.schema[distribution.identifier].fields).indexOf(field.name) !== -1;
2996
+ }) : null;
2997
+ (0, $hgUW1$useEffect)(()=>{
2998
+ if (distribution.identifier) {
2999
+ let localFileFormat = "";
3000
+ if (distribution.data.format) localFileFormat = distribution.data.format.toUpperCase();
3001
+ else if (distribution.data.mediaType) {
3002
+ const mediaType = distribution.data.mediaType.split("/");
3003
+ if (mediaType.length && mediaType[1]) localFileFormat = mediaType[1].toUpperCase();
3004
+ }
3005
+ if (localFileFormat === "CSV") {
3006
+ resource.setResource(distribution.identifier);
3007
+ resource.setManual(false);
3008
+ }
3009
+ }
3010
+ }, [
3011
+ distribution
3012
+ ]);
2691
3013
  (0, $hgUW1$useEffect)(()=>{
2692
3014
  if (title) {
2693
3015
  if (setDatasetTitle) setDatasetTitle(title);
@@ -2728,25 +3050,120 @@ const $6e7bdcbebdb4b794$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalP
2728
3050
  });
2729
3051
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
2730
3052
  children: dataset.error ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $026cb986f9fea2b1$export$2e2bcd8739ae039), {
2731
- content: notFoundContent
2732
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $766b8e351dd607f5$export$2e2bcd8739ae039), {
2733
- rootUrl: rootUrl,
2734
- id: id,
2735
- dataset: dataset,
2736
- additionalParams: additionalParams,
2737
- customColumns: customColumns ? customColumns : [],
2738
- columnSettings: columnSettings,
2739
- columnWidths: columnWidths,
2740
- metadataMapping: metadataMapping
3053
+ content: notFoundContent,
3054
+ siteUrl: rootUrl
3055
+ }) : /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3056
+ className: "ds-l-container",
3057
+ children: [
3058
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3059
+ className: "ds-l-row",
3060
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3061
+ className: "ds-l-md-col--9",
3062
+ children: [
3063
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
3064
+ className: "ds-u-margin-bottom--7 ds-h1 title-underline ds-u-margin-top--3",
3065
+ children: title
3066
+ }),
3067
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3068
+ className: "ds-u-measure--wide ds-u-margin-bottom--7",
3069
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
3070
+ className: "dc-c-metadata-description",
3071
+ dangerouslySetInnerHTML: {
3072
+ __html: (0, $hgUW1$dompurify).sanitize(dataset.description)
3073
+ }
3074
+ })
3075
+ })
3076
+ ]
3077
+ })
3078
+ }),
3079
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3080
+ className: "ds-l-row",
3081
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3082
+ className: "ds-l-md-col--12 dc-dataset",
3083
+ children: distribution && distribution.data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tabs), {
3084
+ onChange: function noRefCheck() {},
3085
+ defaultSelectedId: window.location.hash.substring(1),
3086
+ children: [
3087
+ distribution.data.format === "csv" && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
3088
+ id: "data-table",
3089
+ tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3090
+ children: [
3091
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
3092
+ id: "data-table"
3093
+ }),
3094
+ "Data Table"
3095
+ ]
3096
+ }),
3097
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a35cf16d1488f54e$export$2e2bcd8739ae039), {
3098
+ id: id,
3099
+ distribution: distribution,
3100
+ resource: resource,
3101
+ rootUrl: rootUrl,
3102
+ customColumns: customColumns
3103
+ })
3104
+ }),
3105
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
3106
+ id: "overview",
3107
+ tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3108
+ children: [
3109
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
3110
+ id: "overview"
3111
+ }),
3112
+ "Overview"
3113
+ ]
3114
+ }),
3115
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $364dc44850cd8f7f$export$2e2bcd8739ae039), {
3116
+ resource: resource,
3117
+ dataset: dataset,
3118
+ distributions: distributions,
3119
+ metadataMapping: metadataMapping
3120
+ })
3121
+ }),
3122
+ datasetDictionary && datasetDictionary.length && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
3123
+ id: "data-dictionary",
3124
+ tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3125
+ children: [
3126
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
3127
+ id: "data-dictionary"
3128
+ }),
3129
+ "Data Dictionary"
3130
+ ]
3131
+ }),
3132
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6012b86ffcaf3f71$export$2e2bcd8739ae039), {
3133
+ datasetDictionary: datasetDictionary,
3134
+ title: "Data Dictionary"
3135
+ })
3136
+ }),
3137
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
3138
+ id: "api",
3139
+ tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3140
+ children: [
3141
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
3142
+ id: "api"
3143
+ }),
3144
+ "API"
3145
+ ]
3146
+ }),
3147
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf6eaefd6b928de3$export$2e2bcd8739ae039), {
3148
+ id: id,
3149
+ rootUrl: rootUrl,
3150
+ apiUrl: apiPageUrl,
3151
+ additionalParams: additionalParams
3152
+ })
3153
+ })
3154
+ ]
3155
+ })
3156
+ })
3157
+ })
3158
+ ]
2741
3159
  })
2742
3160
  });
2743
3161
  };
2744
- $6e7bdcbebdb4b794$var$Dataset.propTypes = {
3162
+ $a0f13962e513caa1$var$Dataset.propTypes = {
2745
3163
  id: (0, $hgUW1$proptypes).string.isRequired,
2746
3164
  rootUrl: (0, $hgUW1$proptypes).string.isRequired
2747
3165
  };
2748
- var $6e7bdcbebdb4b794$export$2e2bcd8739ae039 = $6e7bdcbebdb4b794$var$Dataset;
2749
-
3166
+ var $a0f13962e513caa1$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($a0f13962e513caa1$var$Dataset);
2750
3167
 
2751
3168
 
2752
3169
 
@@ -2985,9 +3402,20 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
2985
3402
  });
2986
3403
  const menu = (0, $hgUW1$useRef)(null);
2987
3404
  (0, $hgUW1$useEffect)(()=>{
2988
- function handleFocusOut(event) {
2989
- if (menu.current && !menu.current.contains(event.relatedTarget)) setMenuOpen(false);
2990
- }
3405
+ const trapFocus = (event, container)=>{
3406
+ const focusableEls = getFocusableElements(menu.current).selectors.visible;
3407
+ const firstEl = focusableEls[0];
3408
+ const lastEl = focusableEls[focusableEls.length - 1];
3409
+ if (event.key === "Tab") {
3410
+ if (event.shiftKey && document.activeElement === firstEl) {
3411
+ lastEl.focus();
3412
+ event.preventDefault();
3413
+ } else if (!event.shiftKey && document.activeElement === lastEl) {
3414
+ firstEl.focus();
3415
+ event.preventDefault();
3416
+ }
3417
+ }
3418
+ };
2991
3419
  function handleFocusIn(event) {
2992
3420
  if (!menuOpen) return;
2993
3421
  const mobileHeaderMenu = document.querySelector(`.${$caaccb8ea608e518$var$mobileHeaderMenuClassName}`);
@@ -2999,8 +3427,7 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
2999
3427
  }
3000
3428
  function handleClick(event) {
3001
3429
  // Links are wrapped in spans, this checks if the parent is an A, also check if in the search modal.
3002
- if (// event.target.parentElement.nodeName === 'A' ||
3003
- event.target.closest(".dc-c-search-dialog")) setMenuOpen(false);
3430
+ if (event.target.closest(".dc-c-search-dialog")) setMenuOpen(false);
3004
3431
  }
3005
3432
  function handleSearchEnter(event) {
3006
3433
  // Close upon user hitting enter on search.
@@ -3010,21 +3437,35 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
3010
3437
  // Close upon user hitting escape
3011
3438
  if (event.keyCode === 27 && menuOpen) setMenuOpen(false);
3012
3439
  }
3013
- menu.current.addEventListener("focusout", handleFocusOut);
3014
3440
  document.addEventListener("mousedown", handleClick);
3015
3441
  document.addEventListener("keyup", handleSearchEnter);
3016
3442
  document.addEventListener("keyup", handleMenuClose);
3017
3443
  handleFocusIn();
3444
+ menu.current.addEventListener("keydown", (evt)=>trapFocus(evt, menu.current));
3018
3445
  return ()=>{
3019
3446
  document.removeEventListener("keyup", handleSearchEnter);
3020
3447
  document.removeEventListener("keyup", handleMenuClose);
3021
3448
  document.removeEventListener("mousedown", handleClick);
3022
- if (menu.current) menu.current.removeEventListener("focusout", handleFocusOut);
3449
+ if (menu.current) menu.current.removeEventListener("keydown", trapFocus);
3023
3450
  };
3024
3451
  }, [
3025
- menu.current,
3026
3452
  menuOpen
3027
3453
  ]);
3454
+ const getFocusableElements = (container)=>{
3455
+ const allSelectors = container.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])');
3456
+ const visibleSelectors = Array.from(allSelectors).filter((el)=>{
3457
+ return el.offsetWidth > 0 || el.offsetHeight > 0;
3458
+ });
3459
+ return {
3460
+ selectors: {
3461
+ all: allSelectors,
3462
+ visible: visibleSelectors
3463
+ }
3464
+ };
3465
+ };
3466
+ const handleMobileLinkClick = (e)=>{
3467
+ if (e.target.closest("a").getAttribute("href") === window.location.pathname) setMenuOpen(false);
3468
+ };
3028
3469
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("header", {
3029
3470
  className: `dc-c-header dc-c-mobile-header ${menuOpen ? "menu-open" : ""}`,
3030
3471
  "aria-label": "Site header",
@@ -3097,6 +3538,7 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
3097
3538
  }),
3098
3539
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3099
3540
  className: $caaccb8ea608e518$var$mobileHeaderMenuClassName,
3541
+ "data-testid": "mobile-menu",
3100
3542
  ref: menu,
3101
3543
  children: [
3102
3544
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
@@ -3128,7 +3570,8 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
3128
3570
  menuName: "Main Nav",
3129
3571
  menuId: "site",
3130
3572
  menuClasses: "dc-c-header--links dc-c-header--mobile-links",
3131
- linkClasses: "ds-u-margin-left--1 ds-u-padding-bottom--2 ds-text-heading--md"
3573
+ linkClasses: "ds-u-margin-left--1 ds-u-padding-bottom--2 ds-text-heading--md",
3574
+ clickHandler: handleMobileLinkClick
3132
3575
  }),
3133
3576
  mobile && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3134
3577
  className: "cms-mobile-header--container",
@@ -3283,7 +3726,7 @@ const $a6df0aa147323304$var$Footer = ({ links: links , showEmail: showEmail , em
3283
3726
  className: "ds-u-font-size--sm ds-u-margin-bottom--3",
3284
3727
  children: footerOpenDataToolLinks.map((link)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
3285
3728
  className: "ds-u-margin-bottom--1",
3286
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf8eeac354b9dd32$export$2e2bcd8739ae039), {
3729
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $24918217e48ac525$export$2e2bcd8739ae039), {
3287
3730
  link: link,
3288
3731
  className: "dc-menu-item"
3289
3732
  })
@@ -3314,7 +3757,7 @@ const $a6df0aa147323304$var$Footer = ({ links: links , showEmail: showEmail , em
3314
3757
  }, link.id);
3315
3758
  return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
3316
3759
  className: "ds-u-margin-bottom--1",
3317
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf8eeac354b9dd32$export$2e2bcd8739ae039), {
3760
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $24918217e48ac525$export$2e2bcd8739ae039), {
3318
3761
  link: link,
3319
3762
  className: "dc-menu-item"
3320
3763
  })
@@ -3676,6 +4119,190 @@ var $a6df0aa147323304$export$2e2bcd8739ae039 = $a6df0aa147323304$var$Footer;
3676
4119
 
3677
4120
 
3678
4121
 
4122
+
4123
+
4124
+
4125
+
4126
+ const $5655284dbbb89508$var$DocumentationTable = (props)=>{
4127
+ const { data: data } = props;
4128
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
4129
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
4130
+ stackable: true,
4131
+ className: "ds-c-table",
4132
+ children: [
4133
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableHead), {
4134
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
4135
+ children: [
4136
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
4137
+ id: "application",
4138
+ headers: "Application",
4139
+ children: "Application"
4140
+ }, "Application"),
4141
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
4142
+ id: "notes",
4143
+ headers: "Notes",
4144
+ children: "Notes"
4145
+ }, "Notes"),
4146
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
4147
+ id: "links",
4148
+ headers: "Links",
4149
+ children: "Links"
4150
+ }, "Links")
4151
+ ]
4152
+ })
4153
+ }),
4154
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
4155
+ children: data.map((d)=>/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
4156
+ children: [
4157
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
4158
+ id: d.id,
4159
+ stackedTitle: "Application",
4160
+ headers: "Application",
4161
+ children: d.application
4162
+ }, d.id),
4163
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
4164
+ id: d.id,
4165
+ stackedTitle: "Notes",
4166
+ headers: "Notes",
4167
+ children: d.notes
4168
+ }, `${d.id}-notes`),
4169
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
4170
+ id: d.id,
4171
+ stackedTitle: "Links",
4172
+ headers: "Links",
4173
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
4174
+ className: "dkan-newtab",
4175
+ href: d.link,
4176
+ children: [
4177
+ d.linkText,
4178
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
4179
+ className: "ds-u-visibility--screen-reader",
4180
+ children: [
4181
+ " ",
4182
+ d.screenReaderOnlyText
4183
+ ]
4184
+ })
4185
+ ]
4186
+ })
4187
+ }, `${d.id}-link`)
4188
+ ]
4189
+ }, `${d.id}-row`))
4190
+ })
4191
+ ]
4192
+ })
4193
+ });
4194
+ };
4195
+ var $5655284dbbb89508$export$2e2bcd8739ae039 = $5655284dbbb89508$var$DocumentationTable;
4196
+
4197
+
4198
+ const $c7bf75f7e8a68780$export$7850f4d545d994c6 = [
4199
+ {
4200
+ id: "excel",
4201
+ application: "Microsoft Excel",
4202
+ notes: "Official size limitations for Microsoft Excel",
4203
+ link: "https://support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3?redirectSourcePath=%252fen-us%252farticle%252fExcel-specifications-and-limits-ca36e2dc-1f09-4620-b726-67c00b05040f",
4204
+ linkText: "Excel Specifications and Limits",
4205
+ screenReaderOnlyText: "on microsoft.com"
4206
+ },
4207
+ {
4208
+ id: "access",
4209
+ application: "Microsoft Access",
4210
+ notes: "Official size limitations for Microsoft Access",
4211
+ link: "https://support.microsoft.com/en-us/office/access-specifications-0cf3c66f-9cf2-4e32-9568-98c1025bb47c?ui=en-us&rs=en-us&ad=us",
4212
+ linkText: "Access 2016 Specifications",
4213
+ screenReaderOnlyText: "on microsoft.com"
4214
+ },
4215
+ {
4216
+ id: "oracle-sql-developer",
4217
+ application: "Oracle SQL Developer",
4218
+ notes: "Oracle SQL Developer tool",
4219
+ link: "https://www.oracle.com/database/sqldeveloper/",
4220
+ linkText: "Oracle SQL Developer Overview",
4221
+ screenReaderOnlyText: "on oracle.com"
4222
+ },
4223
+ {
4224
+ id: "oracle-database",
4225
+ application: "Oracle Database",
4226
+ notes: "Oracle Database official size limitations",
4227
+ link: "https://docs.oracle.com/cd/B28359_01/server.111/b28320/limits002.htm#i287915",
4228
+ linkText: "Oracle Physical Database Limits",
4229
+ screenReaderOnlyText: "on oracle.com"
4230
+ },
4231
+ {
4232
+ id: "oracle-sql-client-tools",
4233
+ application: "Oracle SQL Client Tools",
4234
+ notes: "Oracle SQL Client Tools",
4235
+ link: "https://www.oracle.com/database/technologies/oracle-database-software-downloads.html",
4236
+ linkText: "Oracle SQL Client",
4237
+ screenReaderOnlyText: "on oracle.com"
4238
+ }
4239
+ ];
4240
+
4241
+
4242
+ const $669d2782ec2e2250$var$SpecsAndLimits = (props)=>{
4243
+ const { documentationList: documentationList , children: children } = props;
4244
+ const defaultContent = /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4245
+ children: "Some datasets are extremely large and may be difficult to download and/or cause computer performance issues. The Centers for Medicare and Medicaid Services (CMS) recommends using WinZip, WinRAR, or 7-Zip for file decompression."
4246
+ });
4247
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
4248
+ className: "ds-u-padding-top--3 ds-l-container",
4249
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4250
+ className: "ds-l-md-col--12",
4251
+ children: [
4252
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
4253
+ className: "ds-text-heading--5xl ds-u-margin-bottom--4",
4254
+ children: "Software Specs and Limits"
4255
+ }),
4256
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4257
+ className: "dc-page-content about ds-u-measure--wide ds-u-margin-top--6",
4258
+ children: [
4259
+ children ? children : defaultContent,
4260
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4261
+ children: "This documentation will assist users in importing the data."
4262
+ }),
4263
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
4264
+ heading: "Notice",
4265
+ className: "ds-u-margin-top--6",
4266
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4267
+ className: "ds-c-alert__text",
4268
+ children: "Be aware of the file size and row limitations of the software you are attempting to import the files into. For information on limitations, look at the software's official documentation."
4269
+ })
4270
+ })
4271
+ ]
4272
+ }),
4273
+ /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
4274
+ className: "ds-u-margin-top--4 ds-l-row",
4275
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4276
+ className: "ds-l-col--12",
4277
+ children: [
4278
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
4279
+ className: "ds-text-heading--2xl ds-h2",
4280
+ children: "Documentation by Application"
4281
+ }),
4282
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4283
+ className: "ds-u-margin-top--4",
4284
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5655284dbbb89508$export$2e2bcd8739ae039), {
4285
+ data: documentationList
4286
+ })
4287
+ })
4288
+ ]
4289
+ })
4290
+ })
4291
+ ]
4292
+ })
4293
+ });
4294
+ };
4295
+ $669d2782ec2e2250$var$SpecsAndLimits.defaultProps = {
4296
+ documentationList: (0, $c7bf75f7e8a68780$export$7850f4d545d994c6),
4297
+ content: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4298
+ children: "Some datasets are extremely large and may be difficult to download and/or cause computer performance issues. The Centers for Medicare and Medicaid Services (CMS) recommends using WinZip, WinRAR, or 7-Zip for file decompression."
4299
+ })
4300
+ };
4301
+ var $669d2782ec2e2250$export$2e2bcd8739ae039 = $669d2782ec2e2250$var$SpecsAndLimits;
4302
+
4303
+
4304
+
4305
+
3679
4306
  const $efc410f5f7ac5ef3$var$useSearchAPI = (rootUrl, initialSearchParams = {}, additionalParams = {})=>{
3680
4307
  const defaultSort = "";
3681
4308
  const defaultFulltext = "";
@@ -3866,39 +4493,168 @@ var $59a079354baa335c$export$2e2bcd8739ae039 = $59a079354baa335c$var$Hero;
3866
4493
 
3867
4494
 
3868
4495
 
3869
- const $789279954d8eff7f$var$ApiDocumentation = ({ endpoint: endpoint })=>{
4496
+
4497
+
4498
+
4499
+
4500
+
4501
+
4502
+
4503
+
4504
+ const $1e012d1e3b534af0$var$DataTableDensity = ({ setTablePadding: setTablePadding , tablePadding: tablePadding })=>{
3870
4505
  return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3871
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
3872
- url: endpoint
4506
+ className: "ds-u-display--flex",
4507
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
4508
+ options: [
4509
+ {
4510
+ label: "Tight",
4511
+ value: "ds-u-padding-y--0"
4512
+ },
4513
+ {
4514
+ label: "Normal",
4515
+ value: "ds-u-padding-y--1"
4516
+ },
4517
+ {
4518
+ label: "Expanded",
4519
+ value: "ds-u-padding-y--2"
4520
+ }
4521
+ ],
4522
+ label: "Display density:",
4523
+ labelClassName: "ds-u-margin-top--0",
4524
+ name: "datatable_display_density",
4525
+ onChange: (e)=>setTablePadding(e.target.value),
4526
+ defaultValue: tablePadding
4527
+ })
4528
+ });
4529
+ };
4530
+ $1e012d1e3b534af0$var$DataTableDensity.propTypes = {
4531
+ setTablePadding: (0, $hgUW1$proptypes).func.isRequired
4532
+ };
4533
+ var $1e012d1e3b534af0$export$2e2bcd8739ae039 = $1e012d1e3b534af0$var$DataTableDensity;
4534
+
4535
+
4536
+
4537
+
4538
+
4539
+ const $e71aee394fdad8bd$var$ManageColumns = ()=>{
4540
+ const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
4541
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4542
+ onClick: ()=>setModalOpen(!modalOpen),
4543
+ children: "Manage Columns"
4544
+ });
4545
+ };
4546
+ var $e71aee394fdad8bd$export$2e2bcd8739ae039 = $e71aee394fdad8bd$var$ManageColumns;
4547
+
4548
+
4549
+
4550
+
4551
+
4552
+
4553
+ const $7848c69a021266f7$var$DataTableRowChanger = (props)=>{
4554
+ const { limit: limit , rowOptions: rowOptions , setLimit: setLimit } = props;
4555
+ const rowOptionsFormatted = rowOptions.map((row)=>({
4556
+ label: row.toString(),
4557
+ value: row.toString()
4558
+ }));
4559
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4560
+ className: "ds-u-display--flex",
4561
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
4562
+ options: rowOptionsFormatted,
4563
+ label: "Rows per page:",
4564
+ labelClassName: "ds-u-margin-top--0",
4565
+ name: "datatable_rows_per_page",
4566
+ onChange: (e)=>setLimit(e.target.value),
4567
+ defaultValue: limit.toString()
3873
4568
  })
3874
4569
  });
3875
4570
  };
3876
- var $789279954d8eff7f$export$2e2bcd8739ae039 = $789279954d8eff7f$var$ApiDocumentation;
4571
+ $7848c69a021266f7$var$DataTableRowChanger.defaultProps = {
4572
+ rowOptions: [
4573
+ 10,
4574
+ 25,
4575
+ 50,
4576
+ 100
4577
+ ]
4578
+ };
4579
+ $7848c69a021266f7$var$DataTableRowChanger.propTypes = {
4580
+ rowOptions: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).number),
4581
+ setLimit: (0, $hgUW1$proptypes).func.isRequired,
4582
+ limit: (0, $hgUW1$proptypes).number
4583
+ };
4584
+ var $7848c69a021266f7$export$2e2bcd8739ae039 = $7848c69a021266f7$var$DataTableRowChanger;
3877
4585
 
3878
4586
 
3879
4587
 
3880
4588
 
4589
+ const $e973bc477cdc2dc7$var$DownloadIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
4590
+ width: "15px",
4591
+ height: "15px",
4592
+ viewBox: "0 0 384 512",
4593
+ version: "1.1",
4594
+ xmlns: "http://www.w3.org/2000/svg",
4595
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4596
+ children: [
4597
+ /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
4598
+ children: "Download Icon"
4599
+ }),
4600
+ /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
4601
+ stroke: "none",
4602
+ strokeWidth: "1",
4603
+ fill: "none",
4604
+ fillRule: "evenodd",
4605
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
4606
+ fill: "#112E51",
4607
+ fillRule: "nonzero",
4608
+ d: "M384 128h-128V0L384 128zM256 160H384v304c0 26.51-21.49 48-48 48h-288C21.49 512 0 490.5 0 464v-416C0 21.49 21.49 0 48 0H224l.0039 128C224 145.7 238.3 160 256 160zM255 295L216 334.1V232c0-13.25-10.75-24-24-24S168 218.8 168 232v102.1L128.1 295C124.3 290.3 118.2 288 112 288S99.72 290.3 95.03 295c-9.375 9.375-9.375 24.56 0 33.94l80 80c9.375 9.375 24.56 9.375 33.94 0l80-80c9.375-9.375 9.375-24.56 0-33.94S264.4 285.7 255 295z"
4609
+ })
4610
+ })
4611
+ ]
4612
+ });
4613
+ var $e973bc477cdc2dc7$export$2e2bcd8739ae039 = $e973bc477cdc2dc7$var$DownloadIcon;
3881
4614
 
3882
4615
 
3883
4616
 
3884
4617
 
4618
+ const $7ec5423a30aa3f61$var$CopyIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
4619
+ width: "15px",
4620
+ height: "15px",
4621
+ viewBox: "0 0 512 512",
4622
+ version: "1.1",
4623
+ xmlns: "http://www.w3.org/2000/svg",
4624
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4625
+ children: [
4626
+ /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
4627
+ children: "Copy Icon"
4628
+ }),
4629
+ /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
4630
+ stroke: "none",
4631
+ strokeWidth: "1",
4632
+ fill: "none",
4633
+ fillRule: "evenodd",
4634
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
4635
+ fill: "#112E51",
4636
+ fillRule: "nonzero",
4637
+ d: "M384 96L384 0h-112c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48H464c26.51 0 48-21.49 48-48V128h-95.1C398.4 128 384 113.6 384 96zM416 0v96h96L416 0zM192 352V128h-144c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h192c26.51 0 48-21.49 48-48L288 416h-32C220.7 416 192 387.3 192 352z"
4638
+ })
4639
+ })
4640
+ ]
4641
+ });
4642
+ var $7ec5423a30aa3f61$export$2e2bcd8739ae039 = $7ec5423a30aa3f61$var$CopyIcon;
3885
4643
 
3886
4644
 
3887
4645
 
3888
4646
 
3889
- const $847b0964185837b2$var$CloseIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
4647
+ const $ec9e1550b0b034d0$var$SettingsIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
3890
4648
  width: "15px",
3891
4649
  height: "15px",
3892
- viewBox: "0 0 15 15",
4650
+ // viewBox="0 0 15 15"
4651
+ viewBox: "0 0 512 512",
3893
4652
  version: "1.1",
3894
4653
  xmlns: "http://www.w3.org/2000/svg",
3895
4654
  xmlnsXlink: "http://www.w3.org/1999/xlink",
3896
4655
  children: [
3897
4656
  /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
3898
- children: "Close Icon"
3899
- }),
3900
- /*#__PURE__*/ (0, $hgUW1$jsx)("desc", {
3901
- children: "Created with Sketch."
4657
+ children: "Settings Icon"
3902
4658
  }),
3903
4659
  /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
3904
4660
  stroke: "none",
@@ -3906,347 +4662,274 @@ const $847b0964185837b2$var$CloseIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg"
3906
4662
  fill: "none",
3907
4663
  fillRule: "evenodd",
3908
4664
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3909
- d: "M14.6467778,11.2126037 C14.8818403,11.4476661 15,11.7342663 15,12.0711472 C15,12.4080282 14.8818403,12.6946283 14.6467778,12.9296908 L12.9296908,14.6467778 C12.6933713,14.8830973 12.4067711,15.001257 12.0698902,15.001257 C11.7342663,15.001257 11.4476661,14.8830973 11.2126037,14.6467778 L7.49937149,10.9348026 L3.7873963,14.6467778 C3.55233386,14.8830973 3.26573368,15.001257 2.92885276,15.001257 C2.59197184,15.001257 2.30662868,14.8830973 2.07030923,14.6467778 L0.353222157,12.9296908 C0.116902707,12.6946283 0,12.4080282 0,12.0711472 C0,11.7342663 0.116902707,11.4476661 0.353222157,11.2126037 L4.06519735,7.50062851 L0.353222157,3.78865331 C0.116902707,3.55233386 0,3.2669907 0,2.92885276 C0,2.59322886 0.116902707,2.30662868 0.353222157,2.07156624 L2.07030923,0.353222157 C2.30662868,0.118159725 2.59197184,0 2.92885276,0 C3.26573368,0 3.55233386,0.118159725 3.7873963,0.353222157 L7.49937149,4.06519735 L11.2126037,0.353222157 C11.4476661,0.118159725 11.7342663,0 12.0698902,0 C12.4067711,0 12.6933713,0.118159725 12.9296908,0.353222157 L14.6467778,2.07156624 C14.8818403,2.30662868 15,2.59322886 15,2.92885276 C15,3.2669907 14.8818403,3.55233386 14.6467778,3.78865331 L10.9348026,7.50062851 L14.6467778,11.2126037 Z",
3910
- fill: "#000000",
3911
- fillRule: "nonzero"
4665
+ fill: "#112E51",
4666
+ fillRule: "nonzero",
4667
+ d: "M495.9 166.6C499.2 175.2 496.4 184.9 489.6 191.2L446.3 230.6C447.4 238.9 448 247.4 448 256C448 264.6 447.4 273.1 446.3 281.4L489.6 320.8C496.4 327.1 499.2 336.8 495.9 345.4C491.5 357.3 486.2 368.8 480.2 379.7L475.5 387.8C468.9 398.8 461.5 409.2 453.4 419.1C447.4 426.2 437.7 428.7 428.9 425.9L373.2 408.1C359.8 418.4 344.1 427 329.2 433.6L316.7 490.7C314.7 499.7 307.7 506.1 298.5 508.5C284.7 510.8 270.5 512 255.1 512C241.5 512 227.3 510.8 213.5 508.5C204.3 506.1 197.3 499.7 195.3 490.7L182.8 433.6C167 427 152.2 418.4 138.8 408.1L83.14 425.9C74.3 428.7 64.55 426.2 58.63 419.1C50.52 409.2 43.12 398.8 36.52 387.8L31.84 379.7C25.77 368.8 20.49 357.3 16.06 345.4C12.82 336.8 15.55 327.1 22.41 320.8L65.67 281.4C64.57 273.1 64 264.6 64 256C64 247.4 64.57 238.9 65.67 230.6L22.41 191.2C15.55 184.9 12.82 175.3 16.06 166.6C20.49 154.7 25.78 143.2 31.84 132.3L36.51 124.2C43.12 113.2 50.52 102.8 58.63 92.95C64.55 85.8 74.3 83.32 83.14 86.14L138.8 103.9C152.2 93.56 167 84.96 182.8 78.43L195.3 21.33C197.3 12.25 204.3 5.04 213.5 3.51C227.3 1.201 241.5 0 256 0C270.5 0 284.7 1.201 298.5 3.51C307.7 5.04 314.7 12.25 316.7 21.33L329.2 78.43C344.1 84.96 359.8 93.56 373.2 103.9L428.9 86.14C437.7 83.32 447.4 85.8 453.4 92.95C461.5 102.8 468.9 113.2 475.5 124.2L480.2 132.3C486.2 143.2 491.5 154.7 495.9 166.6V166.6zM256 336C300.2 336 336 300.2 336 255.1C336 211.8 300.2 175.1 256 175.1C211.8 175.1 176 211.8 176 255.1C176 300.2 211.8 336 256 336z"
3912
4668
  })
3913
4669
  })
3914
4670
  ]
3915
4671
  });
3916
- var $847b0964185837b2$export$2e2bcd8739ae039 = $847b0964185837b2$var$CloseIcon;
4672
+ var $ec9e1550b0b034d0$export$2e2bcd8739ae039 = $ec9e1550b0b034d0$var$SettingsIcon;
3917
4673
 
3918
4674
 
3919
4675
 
3920
- function $3535053b28e5ffce$var$convertUTCToLocalDate(date) {
3921
- if (!date) return date;
3922
- date = new Date(date);
3923
- date = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
3924
- return date;
3925
- }
3926
- function $3535053b28e5ffce$var$buildOperatorOptions(type) {
3927
- switch(type){
3928
- case "text":
3929
- case "string":
3930
- return [
3931
- {
3932
- label: "Is",
3933
- value: "="
3934
- },
3935
- {
3936
- label: "Contains",
3937
- value: "like"
3938
- },
3939
- {
3940
- label: "Is Not",
3941
- value: "<>"
3942
- },
3943
- {
3944
- label: "Or",
3945
- value: "in"
3946
- }
3947
- ];
3948
- case "date":
3949
- return [
3950
- {
3951
- label: "Is",
3952
- value: "="
3953
- },
3954
- {
3955
- label: "Is Not",
3956
- value: "<>"
3957
- },
3958
- {
3959
- label: "Greater Than",
3960
- value: ">"
3961
- },
3962
- {
3963
- label: "Less Than",
3964
- value: "<"
3965
- }
3966
- ];
3967
- default:
3968
- // These 2 should be safe for all data types
3969
- return [
3970
- {
3971
- label: "Is",
3972
- value: "="
3973
- },
3974
- {
3975
- label: "Is Not",
3976
- value: "<>"
3977
- }
3978
- ];
3979
- }
3980
- }
3981
- function $3535053b28e5ffce$var$cleanText(value, operator) {
3982
- let newValue = value;
3983
- if (Array.isArray(newValue)) newValue = newValue.join(",");
3984
- return newValue.replace(/(^\%+|\%+$)/gm, "");
3985
- }
3986
- const $3535053b28e5ffce$var$ResourceConditionField = ({ data: data , index: index , remove: remove , schema: schema , update: update })=>{
3987
- const { fields: fields } = schema;
3988
- const [startDate, setStartDate] = (0, $hgUW1$react).useState(data.value ? new Date(data.value) : new Date());
3989
- const [propertyOptions, setPropertyOptions] = (0, $hgUW1$react).useState(Object.keys(fields).map((key)=>{
3990
- return {
3991
- label: fields[key].description ? fields[key].description : key,
3992
- value: key
3993
- };
3994
- }));
3995
- const [property, setProperty] = (0, $hgUW1$react).useState(data.property);
3996
- const [operator, setOperator] = (0, $hgUW1$react).useState(data.operator);
3997
- const [operatorOptions, setOperatorOptions] = (0, $hgUW1$react).useState([
3998
- {
3999
- label: "--",
4000
- value: ""
4001
- }
4002
- ]);
4003
- const [value, setValue] = (0, $hgUW1$react).useState(data.value);
4004
- (0, $hgUW1$react).useEffect(()=>{
4005
- if (property) {
4006
- const opOptions = $3535053b28e5ffce$var$buildOperatorOptions(fields[property].mysql_type ? fields[property].mysql_type : fields[property].type).map((opt)=>{
4007
- return {
4008
- label: opt.label,
4009
- value: opt.value
4010
- };
4011
- });
4012
- update(index, "property", property);
4013
- if (!operator) setOperator(opOptions[0].value);
4014
- setOperatorOptions(opOptions);
4015
- if (fields[property].mysql_type && fields[property].mysql_type === "date" || fields[property].type === "date") setValue(startDate.toJSON().slice(0, 10));
4016
- } else {
4017
- update(index, "property", property);
4018
- setOperator("");
4019
- setValue("");
4020
- setOperatorOptions([
4021
- {
4022
- label: "--",
4023
- value: ""
4676
+ const $af099c546cb226c7$var$ResourceHeader = ({ setTablePadding: setTablePadding , id: id , distribution: distribution , includeFiltered: includeFiltered , includeDensity: includeDensity , includeDownload: includeDownload , resource: resource , tablePadding: tablePadding , downloadUrl: downloadUrl })=>{
4677
+ const md = (0, $hgUW1$useMediaQuery)({
4678
+ minWidth: 0,
4679
+ maxWidth: 768
4680
+ });
4681
+ const { limit: limit , offset: offset , count: count , setLimit: setLimit , setOffset: setOffset } = resource;
4682
+ const intCount = count ? parseInt(count) : 0;
4683
+ const [referenceElement, setReferenceElement] = (0, $hgUW1$useState)(null);
4684
+ const [popperElement, setPopperElement] = (0, $hgUW1$useState)(null);
4685
+ const [arrowElement, setArrowElement] = (0, $hgUW1$useState)(null);
4686
+ const { styles: styles , attributes: attributes } = (0, $hgUW1$usePopper)(referenceElement, popperElement, {
4687
+ modifiers: [
4688
+ {
4689
+ name: "arrow",
4690
+ options: {
4691
+ element: arrowElement
4024
4692
  }
4025
- ]);
4026
- }
4027
- }, [
4028
- property,
4029
- operator
4030
- ]);
4031
- (0, $hgUW1$react).useEffect(()=>{
4032
- if (operator) update(index, "operator", operator);
4033
- else update(index, "operator", "");
4034
- }, [
4035
- operator
4036
- ]);
4037
- (0, $hgUW1$react).useEffect(()=>{
4038
- if (value) update(index, "value", value);
4039
- else update(index, "value", "");
4040
- }, [
4041
- value
4042
- ]);
4043
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("fieldset", {
4693
+ }
4694
+ ]
4695
+ });
4696
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4697
+ className: "dc-c-resource-header",
4044
4698
  children: [
4045
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4046
- className: "ds-l-form-row",
4047
- children: [
4048
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
4049
- options: [
4050
- {
4051
- label: "Select column",
4052
- value: ""
4053
- },
4054
- ...propertyOptions
4055
- ],
4056
- value: property,
4057
- onChange: (e)=>setProperty(e.target.value),
4058
- label: "Filter column",
4059
- labelClassName: "ds-u-margin-top--0 ds-u-visibility--screen-reader",
4060
- name: `column_name_${index}`,
4061
- className: "ds-l-col--6"
4062
- }),
4063
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
4064
- options: [
4065
- ...operatorOptions
4066
- ],
4067
- value: operator,
4068
- disabled: !property ? true : false,
4069
- onChange: (e)=>setOperator(e.target.value),
4070
- labelClassName: "ds-u-margin-top--0 ds-u-visibility--screen-reader",
4071
- size: "small",
4072
- label: "Filter operator",
4073
- name: `filter_operator_${index}`,
4074
- className: "ds-l-col--3"
4699
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4700
+ className: "ds-l-row",
4701
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4702
+ className: "ds-l-col--12",
4703
+ children: includeFiltered && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
4704
+ className: "ds-c-button ds-c-button--solid",
4705
+ to: `/dataset/${id}/data`,
4706
+ children: "View and filter data"
4075
4707
  })
4076
- ]
4708
+ })
4077
4709
  }),
4078
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4079
- className: "ds-l-form-row",
4080
- children: [
4081
- property && (fields[property].mysql_type === "date" || fields[property].type === "date") ? /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4082
- className: "ds-u-clearfix ds-l-col--11",
4083
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
4084
- selected: $3535053b28e5ffce$var$convertUTCToLocalDate(startDate),
4085
- onChange: (date)=>{
4086
- setStartDate(date);
4087
- setValue(date.toJSON().slice(0, 10));
4088
- },
4089
- showMonthDropdown: true,
4090
- showYearDropdown: true,
4091
- dropdownMode: "select",
4092
- className: "ds-c-field"
4710
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4711
+ className: "ds-l-row ds-u-align-items--center",
4712
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4713
+ className: "ds-l-col--12 ds-u-display--flex ds-u-justify-content--between ds-u-align-items--center",
4714
+ children: [
4715
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4716
+ className: "ds-u-font-weight--bold",
4717
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2ed0091f7e32d1e6$export$2e2bcd8739ae039), {
4718
+ totalRows: parseInt(intCount),
4719
+ limit: parseInt(limit),
4720
+ offset: parseInt(offset)
4721
+ })
4722
+ }),
4723
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4724
+ className: "dc-c-resource-header--buttons",
4725
+ children: [
4726
+ includeDownload && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
4727
+ children: [
4728
+ /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Button), {
4729
+ size: "small",
4730
+ className: "ds-u-text-align--left ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1",
4731
+ href: downloadUrl,
4732
+ "aria-label": "Download filtered data (CSV)",
4733
+ children: [
4734
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $e973bc477cdc2dc7$export$2e2bcd8739ae039), {}),
4735
+ !md && /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4736
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1",
4737
+ children: "Download filtered data (CSV)"
4738
+ })
4739
+ ]
4740
+ }),
4741
+ /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
4742
+ onOpen: ()=>{
4743
+ navigator.clipboard.writeText(window.location.href);
4744
+ },
4745
+ className: "ds-c-button ds-c-button--small ds-u-text-align--left ds-u-margin-right--1 display-settings-font",
4746
+ placement: "bottom",
4747
+ dialog: true,
4748
+ ariaLabel: "Copy link to filtered data",
4749
+ title: "Link copied to clipboard",
4750
+ children: [
4751
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $7ec5423a30aa3f61$export$2e2bcd8739ae039), {}),
4752
+ !md && /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4753
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1",
4754
+ children: "Copy link to filtered data"
4755
+ })
4756
+ ]
4757
+ })
4758
+ ]
4759
+ }),
4760
+ /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
4761
+ className: "ds-c-button ds-c-button--small ds-u-text-align--left display-settings-font",
4762
+ placement: "bottom",
4763
+ dialog: true,
4764
+ ariaLabel: "Display settings",
4765
+ title: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4766
+ className: "dc-c-display-settings",
4767
+ children: [
4768
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $7848c69a021266f7$export$2e2bcd8739ae039), {
4769
+ limit: limit,
4770
+ setLimit: setLimit,
4771
+ setOffset: setOffset
4772
+ }),
4773
+ includeDensity && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $1e012d1e3b534af0$export$2e2bcd8739ae039), {
4774
+ setTablePadding: setTablePadding,
4775
+ tablePadding: tablePadding
4776
+ })
4777
+ ]
4778
+ }),
4779
+ children: [
4780
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ec9e1550b0b034d0$export$2e2bcd8739ae039), {}),
4781
+ !md && /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4782
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1",
4783
+ children: "Display settings"
4784
+ })
4785
+ ]
4786
+ })
4787
+ ]
4093
4788
  })
4094
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
4095
- hint: operator.toLowerCase() === "in" ? `Separate values with a comma.` : "",
4096
- value: $3535053b28e5ffce$var$cleanText(value, operator),
4097
- disabled: !property ? true : false,
4098
- onChange: (e)=>setValue(e.target.value),
4099
- label: "Filter value",
4100
- labelClassName: "ds-u-margin-top--0",
4101
- name: `filter_value_${index}`,
4102
- className: "ds-l-col--11"
4103
- }),
4104
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4105
- className: "ds-l-col--1",
4106
- variation: "transparent",
4107
- "aria-label": "Remove filter",
4108
- onClick: (e)=>{
4109
- e.preventDefault();
4110
- remove(index);
4111
- },
4112
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $847b0964185837b2$export$2e2bcd8739ae039), {})
4113
- })
4114
- ]
4789
+ ]
4790
+ })
4115
4791
  })
4116
4792
  ]
4117
4793
  });
4118
4794
  };
4119
- var $3535053b28e5ffce$export$2e2bcd8739ae039 = $3535053b28e5ffce$var$ResourceConditionField;
4795
+ var $af099c546cb226c7$export$2e2bcd8739ae039 = $af099c546cb226c7$var$ResourceHeader;
4120
4796
 
4121
4797
 
4122
- const $f29607dfa784d2bd$var$ResourceFilter = ({ id: id , filterOpen: filterOpen , setFilterOpen: setFilterOpen , defaultCondition: defaultCondition , resource: resource , includeSearchParams: includeSearchParams })=>{
4123
- const { setConditions: setConditions , schema: schema , conditions: conditions } = resource;
4124
- const [formConditions, setFormConditions] = (0, $hgUW1$react).useState(conditions && conditions.length ? conditions : [
4125
- {
4126
- ...defaultCondition
4127
- }
4128
- ]);
4129
- (0, $hgUW1$react).useEffect(()=>{
4130
- if (includeSearchParams) {
4131
- const url = new URL(window.location);
4132
- const urlString = (0, $hgUW1$qs).stringify({
4133
- conditions: conditions
4134
- }, {
4135
- encodeValuesOnly: true,
4136
- addQueryPrefix: true
4137
- });
4138
- window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
4139
- }
4140
- }, [
4141
- conditions
4142
- ]);
4143
- function removeByIndex(index) {
4144
- let newConditions = [
4145
- ...formConditions
4146
- ];
4147
- newConditions.splice(index, 1);
4148
- setFormConditions(newConditions);
4149
- setConditions(newConditions);
4150
- }
4151
- function updateByIndex(index, key, value) {
4152
- let newConditions = [
4153
- ...formConditions
4154
- ];
4155
- newConditions[index][key] = value;
4156
- setFormConditions(newConditions);
4157
- }
4158
- function removeAll() {
4159
- setFormConditions([]);
4160
- setConditions([]);
4161
- }
4162
- function submitFilters(e) {
4163
- e.preventDefault();
4164
- if (formConditions.length) {
4165
- const updatedConditions = formConditions.filter((cond)=>{
4166
- if (cond.property) return cond;
4167
- return false;
4168
- }).map((cond)=>{
4169
- if (cond.operator === "=" || cond.operator === "<>") {
4170
- if (Array.isArray(cond.value)) cond.value = cond.value.join();
4171
- cond.value = cond.value.replace(/(^\%+|\%+$)/gm, "");
4172
- }
4173
- if (cond.operator.toLowerCase() === "like") {
4174
- if (Array.isArray(cond.value)) cond.value = cond.value.join();
4175
- const cleanedValue = cond.value.replace(/(^\%+|\%+$)/gm, "");
4176
- cond.value = `%${cleanedValue}%`;
4177
- }
4178
- if (cond.operator.toLowerCase() === "in") {
4179
- if (!Array.isArray(cond.value)) cond.value = cond.value.split(",");
4180
- }
4181
- if (Array.isArray(cond.value)) cond.value = cond.value.map((v)=>v.trim().replace(/(^\%+|\%+$)/gm, ""));
4182
- return cond;
4183
- });
4184
- setConditions(updatedConditions);
4185
- }
4186
- }
4187
- return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$HelpDrawer), {
4188
- footerTitle: "Update actions",
4189
- footerBody: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4190
- className: "ds-u-margin-right--1",
4191
- onClick: (e)=>submitFilters(e, formConditions),
4192
- children: "Update table"
4193
- }),
4194
- heading: "Add filters",
4195
- className: "dc-c-filterd-resouce-drawer",
4196
- onCloseClick: ()=>{
4197
- setFilterOpen(!filterOpen);
4798
+
4799
+
4800
+
4801
+ // OPERATORS
4802
+ // =
4803
+ // <> not equal to
4804
+ // BETWEEN
4805
+ // IN
4806
+ // NOT IN
4807
+ // >=
4808
+ // <=
4809
+ // like
4810
+ function $ead72e621d62e6fc$export$64030b8086b23b59(filterArray) {
4811
+ const conditions = filterArray.map((f)=>{
4812
+ return {
4813
+ resource: "t",
4814
+ property: f.id,
4815
+ value: `%${f.value}%`,
4816
+ operator: "LIKE"
4817
+ };
4818
+ });
4819
+ return conditions;
4820
+ }
4821
+ function $ead72e621d62e6fc$export$5bccb6115193eb03(filterArray) {
4822
+ if (!filterArray || filterArray.length === 0) return "";
4823
+ const where_clauses = [];
4824
+ filterArray.forEach((v, i)=>{
4825
+ // Switch delimiter to, and strip any double-quote for Dkan2's sql query.
4826
+ let value = `%25${v.value}%25`;
4827
+ where_clauses[i] = `${v.id} = "${v.value.replace('"', "")}"`;
4828
+ });
4829
+ return `[WHERE ${where_clauses.join(" AND ")}]`;
4830
+ }
4831
+
4832
+
4833
+
4834
+
4835
+
4836
+
4837
+ function $626282d9a03c51d5$var$calculateMaxWidth(previewSize) {
4838
+ return Math.floor(previewSize * 0.84);
4839
+ }
4840
+ function $626282d9a03c51d5$export$1147582dfae658c6(columns, schema) {
4841
+ return columns.map((column)=>({
4842
+ header: schema && schema.fields[column].description ? schema.fields[column].description : column,
4843
+ accessor: column
4844
+ }));
4845
+ }
4846
+ function $626282d9a03c51d5$var$DefaultColumnFilter({ column: { Header: Header , accessor: accessor , setFilter: setFilter , filterValue: filterValue } }) {
4847
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
4848
+ label: `Filter by ${Header}`,
4849
+ onChange: (e)=>{
4850
+ setFilter(e.target.value) || undefined;
4198
4851
  },
4199
- children: [
4200
- /*#__PURE__*/ (0, $hgUW1$jsxs)("form", {
4201
- onSubmit: (e)=>submitFilters(e, formConditions),
4202
- children: [
4203
- Object.keys(schema).length && formConditions.map((f, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $3535053b28e5ffce$export$2e2bcd8739ae039), {
4204
- data: f,
4205
- index: index,
4206
- remove: removeByIndex,
4207
- schema: schema[id],
4208
- update: updateByIndex
4209
- }, index)),
4210
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4211
- className: "ds-u-margin-right--1",
4212
- variation: "ghost",
4213
- onClick: (e)=>{
4214
- e.preventDefault();
4215
- setFormConditions([
4216
- ...formConditions,
4217
- {
4218
- ...defaultCondition
4219
- }
4220
- ]);
4221
- },
4222
- children: "+ Add another filter"
4223
- })
4224
- ]
4852
+ labelClassName: "ds-u-visibility--screen-reader",
4853
+ name: accessor,
4854
+ value: filterValue || ""
4855
+ });
4856
+ }
4857
+ const $626282d9a03c51d5$var$ResourcePreview = ({ tablePadding: tablePadding , id: id , options: options , resource: resource , defaultSort: defaultSort , customColumns: customColumns , truncateCellHeader: truncateCellHeader , columnSettings: columnSettings , columnWidths: columnWidths , customClasses: customClasses , canResize: canResize })=>{
4858
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4859
+ id: "resource-preview",
4860
+ className: "ds-u-overflow--auto ds-u-border-x--1 ds-u-border-bottom--1",
4861
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
4862
+ // filterTitle="Filter columns"
4863
+ data: resource.values,
4864
+ canResize: canResize,
4865
+ sortDefaults: defaultSort,
4866
+ columns: customColumns ? customColumns : $626282d9a03c51d5$export$1147582dfae658c6(resource.columns, resource.schema[id]),
4867
+ // schema={resource.schema}
4868
+ // totalRows={parseInt(resource.totalRows)}
4869
+ // limit={resource.limit}
4870
+ // offset={resource.offset}
4871
+ // loading={resource.loading}
4872
+ setSort: resource.setSort,
4873
+ // setConditions={resource.setConditions}
4874
+ // conditionsTransform={transformTableFilterToQueryCondition}
4875
+ sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
4876
+ tablePadding: tablePadding,
4877
+ className: "dc-c-datatable",
4878
+ customColumnFilter: $626282d9a03c51d5$var$DefaultColumnFilter,
4879
+ options: options,
4880
+ CustomLoadingComponent: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4881
+ className: "ds-u-display--flex ds-u-padding--3",
4882
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
4883
+ className: "ds-u-valign--middle",
4884
+ role: "status",
4885
+ "aria-valuetext": "Datatable loading"
4886
+ })
4225
4887
  }),
4226
- formConditions.length > 1 ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4227
- variation: "ghost",
4228
- onClick: (e)=>{
4229
- e.preventDefault();
4230
- removeAll();
4231
- },
4232
- children: "Remove all filters"
4233
- }) : ""
4234
- ]
4888
+ CustomNoResults: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4889
+ className: "ds-u-display--flex ds-u-padding--3",
4890
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4891
+ children: "No results returned."
4892
+ })
4893
+ })
4894
+ })
4235
4895
  });
4236
4896
  };
4237
- $f29607dfa784d2bd$var$ResourceFilter.defaultProps = {
4238
- defaultCondition: {
4239
- property: "",
4240
- value: "",
4241
- operator: ""
4897
+ $626282d9a03c51d5$var$ResourcePreview.defaultProps = {
4898
+ options: {
4899
+ layout: "flex",
4900
+ columnFilter: false,
4901
+ columnSort: true,
4902
+ columnResize: true
4242
4903
  },
4243
- includeSearchParams: true
4904
+ truncateCellHeader: true,
4905
+ defaultSort: [],
4906
+ canResize: true
4244
4907
  };
4245
- var $f29607dfa784d2bd$export$2e2bcd8739ae039 = $f29607dfa784d2bd$var$ResourceFilter;
4908
+ var $626282d9a03c51d5$export$2e2bcd8739ae039 = $626282d9a03c51d5$var$ResourcePreview;
4909
+
4246
4910
 
4247
4911
 
4248
4912
 
4249
4913
 
4914
+ const $072291d44ce1834a$var$ResourceFooter = ({ resource: resource })=>{
4915
+ const { limit: limit , values: values , offset: offset , count: count , setOffset: setOffset } = resource;
4916
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4917
+ children: values.length > 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
4918
+ id: "test-default",
4919
+ currentPage: Number(offset) / limit + 1,
4920
+ totalPages: Math.ceil(Number(count) / limit),
4921
+ onPageChange: (evt, page)=>{
4922
+ evt.preventDefault();
4923
+ setOffset((page - 1) * limit);
4924
+ },
4925
+ renderHref: (page)=>{
4926
+ return "";
4927
+ }
4928
+ })
4929
+ });
4930
+ };
4931
+ var $072291d44ce1834a$export$2e2bcd8739ae039 = $072291d44ce1834a$var$ResourceFooter;
4932
+
4250
4933
 
4251
4934
 
4252
4935
 
@@ -4322,7 +5005,6 @@ var $ec3e23baa005dc03$export$2e2bcd8739ae039 = $ec3e23baa005dc03$var$Breadcrumb;
4322
5005
 
4323
5006
 
4324
5007
 
4325
-
4326
5008
 
4327
5009
 
4328
5010
  function $374c4669b044ddf8$var$getStartDate(condition, schema, id) {
@@ -4393,7 +5075,7 @@ const $374c4669b044ddf8$var$QueryRow = ({ id: id , condition: condition , index:
4393
5075
  className: "ds-l-sm-col--3 ds-l-md-col--2 ds-l-col--12 ds-u-padding--0 ds-u-md-padding-right--2 ds-u-margin-bottom--0 ds-u-md-margin-bottom--2"
4394
5076
  }),
4395
5077
  schema[id].fields[property].mysql_type === "date" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4396
- className: "ds-l-md-col--5 ds-l-lg-col--4 ds-l-sm-col--8 ds-l-col--12 ds-u-padding--0 ds-u-sm-padding-right--2 ds-u-md-padding-right--0 ds-u-lg-padding-right--2",
5078
+ className: "ds-l-md-col--5 ds-l-lg-col--4 ds-l-sm-col--8 ds-l-col--12 ds-u-padding--0 ds-u-sm-padding-right--2 ds-u-md-padding-right--0 ds-u-lg-padding-right--2 ds-u-margin-bottom--2",
4397
5079
  children: [
4398
5080
  /*#__PURE__*/ (0, $hgUW1$jsx)("label", {
4399
5081
  className: "ds-c-label",
@@ -4439,71 +5121,6 @@ var $374c4669b044ddf8$export$2e2bcd8739ae039 = $374c4669b044ddf8$var$QueryRow;
4439
5121
 
4440
5122
 
4441
5123
 
4442
-
4443
- const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions , schema: schema , customColumns: customColumns })=>{
4444
- const { fields: fields } = schema;
4445
- if (!conditions.length) return "Add a filter";
4446
- function formatValue(text, property) {
4447
- if (customColumns.length > 0) {
4448
- let newValue = text;
4449
- let customColumn = customColumns.find((c)=>c.accessor === property);
4450
- if (customColumn && customColumn.cell) return customColumn.cell({
4451
- value: text
4452
- });
4453
- return text;
4454
- } else return text;
4455
- }
4456
- function buildTitle() {
4457
- const newTitle = conditions.map((c)=>{
4458
- const field = fields[c.property];
4459
- const description = field && field.description ? field.description : c.property;
4460
- const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
4461
- return `${description} ${operator.label} ${(0, $7264a673914aa746$export$6b5e57d20078142b)(c.value)}`;
4462
- });
4463
- return newTitle.join(" AND ");
4464
- }
4465
- return /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4466
- className: "dc-querybuilder-title",
4467
- children: conditions.map((c)=>{
4468
- const field = fields[c.property];
4469
- const description = field && field.description ? field.description : c.property;
4470
- const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
4471
- const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
4472
- const formattedText = formatValue(cleanedText, c.property);
4473
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
4474
- className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
4475
- children: [
4476
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4477
- className: "ds-u-font-weight--bold",
4478
- children: description
4479
- }),
4480
- " ",
4481
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4482
- className: "ds-u-font-weight--normal",
4483
- children: operator.label.toUpperCase()
4484
- }),
4485
- " ",
4486
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4487
- className: "ds-u-color--success",
4488
- children: formattedText
4489
- })
4490
- ]
4491
- });
4492
- }).reduce((prev, curr)=>[
4493
- prev,
4494
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
4495
- className: "ds-u-margin-x--1",
4496
- variation: "info",
4497
- children: "AND"
4498
- }),
4499
- curr
4500
- ])
4501
- });
4502
- };
4503
- var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
4504
-
4505
-
4506
-
4507
5124
  function $3b6ca952e79f0695$var$updateQueryForDatastore(condition) {
4508
5125
  let cond = condition;
4509
5126
  delete cond.key;
@@ -4776,7 +5393,7 @@ var $dd6eb2b30d7ad75d$export$2e2bcd8739ae039 = $dd6eb2b30d7ad75d$var$FilteredRes
4776
5393
  const $f61ecf9f84951a61$var$FilteredResource = ({ id: id , dist_id: dist_id , location: location , apiDocPage: apiDocPage , additionalParams: additionalParams , customColumns: customColumns , setDatasetTitle: setDatasetTitle , columnSettings: columnSettings , columnWidths: columnWidths , customTitle: customTitle , rootUrl: rootUrl })=>{
4777
5394
  const [ready, setReady] = (0, $hgUW1$useState)(false);
4778
5395
  const [error, setError] = (0, $hgUW1$useState)(false);
4779
- const { dataset: dataset } = (0, $68d79598b83f3382$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
5396
+ const { dataset: dataset } = (0, $b4aa9c66f2e86959$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
4780
5397
  const distIndex = dist_id === "data" ? 0 : dist_id;
4781
5398
  (0, $hgUW1$useEffect)(()=>{
4782
5399
  if (dataset.error) setError(true);
@@ -4887,5 +5504,5 @@ var $90fb213ab8eeb2e7$export$2e2bcd8739ae039 = $90fb213ab8eeb2e7$var$useScrollTo
4887
5504
 
4888
5505
 
4889
5506
 
4890
- export {$f57121650539d8c5$export$2e2bcd8739ae039 as NavBar, $c96c4b9ef7203c1f$export$2e2bcd8739ae039 as APIPage, $026cb986f9fea2b1$export$2e2bcd8739ae039 as PageNotFound, $e873081a6e8f024e$export$2e2bcd8739ae039 as DatasetSearch, $6e7bdcbebdb4b794$export$2e2bcd8739ae039 as Dataset, $a5a6a06d249c33b8$export$2e2bcd8739ae039 as Header, $a6df0aa147323304$export$2e2bcd8739ae039 as Footer, $efc410f5f7ac5ef3$export$2e2bcd8739ae039 as useSearchAPI, $1d3d480a9cfaabe0$export$2e2bcd8739ae039 as useDatastore, $aa4450dcbeef3ac0$export$385a5aba38cc3325 as transformTableSortToQuerySort, $59a079354baa335c$export$2e2bcd8739ae039 as Hero, $52c6454cae137465$export$2e2bcd8739ae039 as DatasetSearchListItem, $789279954d8eff7f$export$2e2bcd8739ae039 as ApiDocumentation, $f29607dfa784d2bd$export$2e2bcd8739ae039 as ResourceFilter, $af099c546cb226c7$export$2e2bcd8739ae039 as ResourceHeader, $626282d9a03c51d5$export$2e2bcd8739ae039 as ResourcePreview, $072291d44ce1834a$export$2e2bcd8739ae039 as ResourceFooter, $ec3e23baa005dc03$export$2e2bcd8739ae039 as Breadcrumb, $bd76a91923d7e8a7$export$2e2bcd8739ae039 as TransformedDate, $d98f94c79ddf4e0e$export$2e2bcd8739ae039 as DataTable, $5644ebd2c3dbfd7b$export$eea3a12df15499ca as buildRows, $f61ecf9f84951a61$export$2e2bcd8739ae039 as FilteredResource, $bef7bff2823feea2$export$2e2bcd8739ae039 as QueryTitle, $7264a673914aa746$export$2b9377795161999 as buildOperatorOptions, $7264a673914aa746$export$e284ae5d89467c8f as convertUTCToLocalDate, $7264a673914aa746$export$6b5e57d20078142b as cleanText, $7264a673914aa746$export$8049e8f40a9bdfb8 as buildCustomColHeaders, $eb7821d186b1a389$export$2e2bcd8739ae039 as useAddLoginLink, $90fb213ab8eeb2e7$export$2e2bcd8739ae039 as useScrollToTop, $68d79598b83f3382$export$2e2bcd8739ae039 as useMetastoreDataset, $6da0396069e23175$export$bc27cf7ecf44639d as defaultMetadataMapping, $2ed0091f7e32d1e6$export$2e2bcd8739ae039 as DataTablePageResults};
5507
+ export {$f57121650539d8c5$export$2e2bcd8739ae039 as NavBar, $c96c4b9ef7203c1f$export$2e2bcd8739ae039 as APIPage, $026cb986f9fea2b1$export$2e2bcd8739ae039 as PageNotFound, $e873081a6e8f024e$export$2e2bcd8739ae039 as DatasetSearch, $a0f13962e513caa1$export$2e2bcd8739ae039 as Dataset, $a35cf16d1488f54e$export$2e2bcd8739ae039 as DatasetTable, $a5a6a06d249c33b8$export$2e2bcd8739ae039 as Header, $a6df0aa147323304$export$2e2bcd8739ae039 as Footer, $669d2782ec2e2250$export$2e2bcd8739ae039 as SpecsAndLimits, $efc410f5f7ac5ef3$export$2e2bcd8739ae039 as useSearchAPI, $1d3d480a9cfaabe0$export$2e2bcd8739ae039 as useDatastore, $aa4450dcbeef3ac0$export$385a5aba38cc3325 as transformTableSortToQuerySort, $59a079354baa335c$export$2e2bcd8739ae039 as Hero, $52c6454cae137465$export$2e2bcd8739ae039 as DatasetSearchListItem, $789279954d8eff7f$export$2e2bcd8739ae039 as ApiDocumentation, $af099c546cb226c7$export$2e2bcd8739ae039 as ResourceHeader, $626282d9a03c51d5$export$2e2bcd8739ae039 as ResourcePreview, $072291d44ce1834a$export$2e2bcd8739ae039 as ResourceFooter, $ec3e23baa005dc03$export$2e2bcd8739ae039 as Breadcrumb, $bd76a91923d7e8a7$export$2e2bcd8739ae039 as TransformedDate, $d98f94c79ddf4e0e$export$2e2bcd8739ae039 as DataTable, $5644ebd2c3dbfd7b$export$eea3a12df15499ca as buildRows, $f61ecf9f84951a61$export$2e2bcd8739ae039 as FilteredResource, $bef7bff2823feea2$export$2e2bcd8739ae039 as QueryTitle, $7264a673914aa746$export$2b9377795161999 as buildOperatorOptions, $7264a673914aa746$export$e284ae5d89467c8f as convertUTCToLocalDate, $7264a673914aa746$export$6b5e57d20078142b as cleanText, $7264a673914aa746$export$8049e8f40a9bdfb8 as buildCustomColHeaders, $eb7821d186b1a389$export$2e2bcd8739ae039 as useAddLoginLink, $90fb213ab8eeb2e7$export$2e2bcd8739ae039 as useScrollToTop, $b4aa9c66f2e86959$export$2e2bcd8739ae039 as useMetastoreDataset, $6da0396069e23175$export$bc27cf7ecf44639d as defaultMetadataMapping, $2ed0091f7e32d1e6$export$2e2bcd8739ae039 as DataTablePageResults};
4891
5508
  //# sourceMappingURL=main.js.map