@civicactions/cmsds-open-data-components 3.0.0-alpha.9 → 3.0.0

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: [
@@ -741,9 +827,8 @@ async function $eff7d34c30f5a0fc$export$2d2256cb46e92ff7(rootUrl, options, addit
741
827
 
742
828
 
743
829
 
744
-
745
830
  const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
746
- 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;
747
832
  const sortOptions = [
748
833
  {
749
834
  label: "Newest",
@@ -889,13 +974,18 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
889
974
  ["page-size"]: pageSize !== 10 ? pageSize : undefined,
890
975
  ...additionalParams
891
976
  };
892
- const { data: data , status: status , error: error } = (0, $hgUW1$useQuery)([
893
- "datasets",
894
- params
895
- ], ()=>(0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify(params, {
896
- arrayFormat: "comma",
897
- encode: false
898
- })}`));
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
+ });
899
989
  if (data && data.data.total && totalItems != data.data.total) setTotalItems(data.data.total);
900
990
  const facets = data && data.data.facets ? (0, $eff7d34c30f5a0fc$export$959638e8dca60ce6)(data ? data.data.facets : []) : {
901
991
  theme: null,
@@ -982,7 +1072,7 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
982
1072
  }),
983
1073
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
984
1074
  className: "ds-l-col--12 ds-l-sm-col--8",
985
- children: status === "loading" ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
1075
+ children: isLoading ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
986
1076
  className: "ds-u-valign--middle",
987
1077
  "aria-valuetext": "Dataset Search loading",
988
1078
  role: "status"
@@ -1038,6 +1128,10 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
1038
1128
  let distribution_array = item.distribution ? item.distribution : [];
1039
1129
  return distribution_array.length ? item.distribution[0].downloadURL : null;
1040
1130
  }
1131
+ let showLargeFile = false;
1132
+ if (largeFileThemes && item.theme) largeFileThemes.forEach((theme)=>{
1133
+ if (item.theme.includes(theme)) showLargeFile = true;
1134
+ });
1041
1135
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $52c6454cae137465$export$2e2bcd8739ae039), {
1042
1136
  title: item.title,
1043
1137
  modified: item.modified,
@@ -1045,7 +1139,7 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
1045
1139
  theme: item.theme,
1046
1140
  identifier: item.identifier,
1047
1141
  downloadUrl: showDownloadIcon ? getDownloadUrl(item) : null,
1048
- largeFile: item.theme && item.theme.includes("General Payments")
1142
+ largeFile: showLargeFile
1049
1143
  });
1050
1144
  }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
1051
1145
  variation: "error",
@@ -1122,15 +1216,29 @@ var $e873081a6e8f024e$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
1122
1216
 
1123
1217
 
1124
1218
 
1125
- const $68d79598b83f3382$var$useMetastoreDataset = (datasetId, rootAPIUrl, additionalParams = {})=>{
1126
- 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
+ });
1127
1231
  const [id, setId] = (0, $hgUW1$useState)(datasetId);
1128
1232
  const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
1129
1233
  const additionalParamsString = Object.keys(additionalParams).length ? `&${(0, $hgUW1$qs).stringify(additionalParams)}` : "";
1130
1234
  (0, $hgUW1$useEffect)(()=>{
1131
1235
  async function fetchData() {
1132
1236
  return (0, $hgUW1$axios).get(`${rootUrl}/metastore/schemas/dataset/items/${id}?show-reference-ids${additionalParamsString}`).then((res)=>setDataset(res.data)).catch((error)=>setDataset({
1133
- error: error
1237
+ title: dataset.title,
1238
+ distribution: dataset.distribution,
1239
+ error: error,
1240
+ description: dataset.description,
1241
+ identifier: dataset.identifier
1134
1242
  }));
1135
1243
  }
1136
1244
  fetchData();
@@ -1144,13 +1252,7 @@ const $68d79598b83f3382$var$useMetastoreDataset = (datasetId, rootAPIUrl, additi
1144
1252
  setRootUrl: setRootUrl
1145
1253
  };
1146
1254
  };
1147
- var $68d79598b83f3382$export$2e2bcd8739ae039 = $68d79598b83f3382$var$useMetastoreDataset;
1148
-
1149
-
1150
-
1151
-
1152
-
1153
-
1255
+ var $b4aa9c66f2e86959$export$2e2bcd8739ae039 = $b4aa9c66f2e86959$var$useMetastoreDataset;
1154
1256
 
1155
1257
 
1156
1258
 
@@ -1200,7 +1302,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
1200
1302
  const [id, setResource] = (0, $hgUW1$useState)(resourceId);
1201
1303
  const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
1202
1304
  const [limit, setLimit] = (0, $hgUW1$useState)(options.limit ? options.limit : 20);
1203
- const [count, setCount] = (0, $hgUW1$useState)(null);
1305
+ const [count, setCount] = (0, $hgUW1$useState)(0);
1204
1306
  const [columns, setColumns] = (0, $hgUW1$useState)([]);
1205
1307
  const [offset, setOffset] = (0, $hgUW1$useState)(options.offset ? options.offset : 0);
1206
1308
  const [loading, setLoading] = (0, $hgUW1$useState)(false);
@@ -1244,7 +1346,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
1244
1346
  else if (requireConditions) {
1245
1347
  if (conditions && conditions.length) fetchData();
1246
1348
  else {
1247
- setCount(null);
1349
+ setCount(0);
1248
1350
  setValues([]);
1249
1351
  }
1250
1352
  }
@@ -1289,135 +1391,373 @@ var $1d3d480a9cfaabe0$export$2e2bcd8739ae039 = $1d3d480a9cfaabe0$var$useDatastor
1289
1391
 
1290
1392
 
1291
1393
 
1292
- // OPERATORS
1293
- // =
1294
- // <> not equal to
1295
- // BETWEEN
1296
- // IN
1297
- // NOT IN
1298
- // >=
1299
- // <=
1300
- // like
1301
- function $ead72e621d62e6fc$export$64030b8086b23b59(filterArray) {
1302
- const conditions = filterArray.map((f)=>{
1303
- return {
1304
- resource: "t",
1305
- property: f.id,
1306
- value: `%${f.value}%`,
1307
- operator: "LIKE"
1308
- };
1309
- });
1310
- return conditions;
1311
- }
1312
- function $ead72e621d62e6fc$export$5bccb6115193eb03(filterArray) {
1313
- if (!filterArray || filterArray.length === 0) return "";
1314
- const where_clauses = [];
1315
- filterArray.forEach((v, i)=>{
1316
- // Switch delimiter to, and strip any double-quote for Dkan2's sql query.
1317
- let value = `%25${v.value}%25`;
1318
- where_clauses[i] = `${v.id} = "${v.value.replace('"', "")}"`;
1319
- });
1320
- return `[WHERE ${where_clauses.join(" AND ")}]`;
1321
- }
1322
-
1323
-
1324
- function $aa4450dcbeef3ac0$export$385a5aba38cc3325(sortArray) {
1325
- let newQuery = [];
1326
- sortArray.forEach((s)=>{
1327
- return newQuery.push({
1328
- property: s.id,
1329
- order: s.desc ? "desc" : "asc"
1330
- });
1331
- });
1332
- return newQuery;
1333
- }
1334
-
1335
-
1336
-
1337
-
1338
-
1339
-
1340
1394
 
1341
1395
 
1342
-
1343
- const $96d341d082bffec5$var$TruncatedResizeableTHead = ({ table: table , sortElement: sortElement })=>{
1344
- return /*#__PURE__*/ (0, $hgUW1$jsx)("thead", {
1345
- className: "dc-thead--truncated dc-thead--resizeable",
1346
- children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1347
- children: headerGroup.headers.map((header)=>{
1348
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("th", {
1349
- key: header.id,
1350
- style: {
1351
- width: header.getSize()
1352
- },
1353
- title: header.column.columnDef.header,
1354
- className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold dc-c-table-header-cell",
1355
- children: [
1356
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1357
- onClick: header.column.getToggleSortingHandler(),
1358
- children: [
1359
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1360
- style: {
1361
- maxWidth: header.getSize() - 16
1362
- },
1363
- children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
1364
- }),
1365
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1366
- className: header.column.getCanSort() ? `cursor-pointer select-none ${sortElement(header.column.getIsSorted())}` : ""
1367
- })
1368
- ]
1369
- }),
1370
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1371
- onMouseDown: header.getResizeHandler(),
1372
- onTouchStart: header.getResizeHandler(),
1373
- className: `dc-c-resize-handle ${header.column.getIsResizing() ? "isResizing" : ""}`
1374
- })
1375
- ]
1376
- });
1377
- })
1378
- }, headerGroup.id))
1379
- });
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
+ }
1380
1457
  };
1381
- var $96d341d082bffec5$export$2e2bcd8739ae039 = $96d341d082bffec5$var$TruncatedResizeableTHead;
1382
-
1383
-
1384
-
1385
1458
 
1386
1459
 
1387
- const $23763e27eda0e8d7$var$FixedSizeTHead = ({ table: table , sortElement: sortElement })=>{
1388
- return /*#__PURE__*/ (0, $hgUW1$jsx)("thead", {
1389
- className: "dc-thead--fixed-size",
1390
- children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1391
- children: headerGroup.headers.map((header)=>{
1392
- return /*#__PURE__*/ (0, $hgUW1$jsx)("th", {
1393
- key: header.id,
1394
- style: {
1395
- width: header.getSize()
1396
- },
1397
- title: header.column.columnDef.header,
1398
- className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold dc-c-table-header-cell",
1399
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1400
- onClick: header.column.getToggleSortingHandler(),
1401
- children: [
1402
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1403
- children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
1404
- }),
1405
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1406
- className: header.column.getCanSort() ? `cursor-pointer select-none ${sortElement(header.column.getIsSorted())}` : ""
1407
- })
1408
- ]
1409
- })
1410
- });
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
1411
1467
  })
1412
- }, headerGroup.id))
1413
- });
1414
- };
1415
- var $23763e27eda0e8d7$export$2e2bcd8739ae039 = $23763e27eda0e8d7$var$FixedSizeTHead;
1416
-
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;
1755
+
1417
1756
 
1418
1757
 
1419
1758
  const $d98f94c79ddf4e0e$var$DataTable = ({ data: data , columns: columns , setSort: setSort , sortTransform: sortTransform , tablePadding: tablePadding , canResize: canResize , loading: loading = false })=>{
1420
1759
  const [sorting, setSorting] = (0, $hgUW1$react).useState([]);
1760
+ const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)("");
1421
1761
  const columnHelper = (0, $hgUW1$createColumnHelper)();
1422
1762
  const table_columns = columns.map((col)=>{
1423
1763
  if (col.cell) return columnHelper.accessor(col.accessor, {
@@ -1453,135 +1793,211 @@ const $d98f94c79ddf4e0e$var$DataTable = ({ data: data , columns: columns , setSo
1453
1793
  }, [
1454
1794
  sorting
1455
1795
  ]);
1456
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1457
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("table", {
1458
- tabIndex: 0,
1459
- style: {
1460
- width: canResize ? table.getCenterTotalSize() : "100%"
1461
- },
1462
- className: "dc-c-datatable",
1463
- children: [
1464
- canResize ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $96d341d082bffec5$export$2e2bcd8739ae039), {
1465
- table: table,
1466
- sortElement: sortElement
1467
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $23763e27eda0e8d7$export$2e2bcd8739ae039), {
1468
- table: table,
1469
- sortElement: sortElement
1470
- }),
1471
- loading ? /*#__PURE__*/ (0, $hgUW1$jsx)("tbody", {
1472
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1473
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("td", {
1474
- colSpan: columns.length,
1475
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
1476
- "aria-valuetext": "Dataset loading",
1477
- role: "status",
1478
- 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
+ })
1479
1822
  })
1480
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
+ })
1481
1842
  })
1482
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)("tbody", {
1483
- children: table.getRowModel().rows.map((row, index)=>{
1484
- const even = (index + 1) % 2 === 0;
1485
- return /*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1486
- className: `${even ? "dc-c-datatable--even-row" : ""}`,
1487
- children: row.getVisibleCells().map((cell)=>{
1488
- let classList = "dc-truncate ds-u-padding-x--1";
1489
- return /*#__PURE__*/ (0, $hgUW1$jsx)("td", {
1490
- key: cell.id,
1491
- style: {
1492
- maxWidth: cell.column.getSize()
1493
- },
1494
- className: `${classList} ${tablePadding}`,
1495
- children: (0, $hgUW1$flexRender)(cell.column.columnDef.cell, cell.getContext())
1496
- });
1497
- })
1498
- }, row.id);
1499
- })
1500
- })
1501
- ]
1502
- })
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
+ ]
1503
1852
  });
1504
1853
  };
1505
1854
  var $d98f94c79ddf4e0e$export$2e2bcd8739ae039 = $d98f94c79ddf4e0e$var$DataTable;
1506
1855
 
1507
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
+ }
1508
1867
 
1509
1868
 
1510
- function $626282d9a03c51d5$var$calculateMaxWidth(previewSize) {
1511
- 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
+ });
1512
1891
  }
1513
- function $626282d9a03c51d5$export$1147582dfae658c6(columns, schema) {
1514
- return columns.map((column)=>({
1515
- header: schema && schema.fields[column].description ? schema.fields[column].description : column,
1516
- accessor: column
1517
- }));
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;
1518
1897
  }
1519
- function $626282d9a03c51d5$var$DefaultColumnFilter({ column: { Header: Header , accessor: accessor , setFilter: setFilter , filterValue: filterValue } }) {
1520
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
1521
- label: `Filter by ${Header}`,
1522
- onChange: (e)=>{
1523
- setFilter(e.target.value) || undefined;
1524
- },
1525
- labelClassName: "ds-u-visibility--screen-reader",
1526
- name: accessor,
1527
- value: filterValue || ""
1528
- });
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;
1529
1903
  }
1530
- 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 })=>{
1531
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1532
- id: "resource-preview",
1533
- className: "ds-u-overflow--auto ds-u-border-x--1 ds-u-border-bottom--1",
1534
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
1535
- // filterTitle="Filter columns"
1536
- data: resource.values,
1537
- canResize: canResize,
1538
- sortDefaults: defaultSort,
1539
- columns: customColumns ? customColumns : $626282d9a03c51d5$export$1147582dfae658c6(resource.columns, resource.schema[id]),
1540
- // schema={resource.schema}
1541
- // totalRows={parseInt(resource.totalRows)}
1542
- // limit={resource.limit}
1543
- // offset={resource.offset}
1544
- // loading={resource.loading}
1545
- setSort: resource.setSort,
1546
- // setConditions={resource.setConditions}
1547
- // conditionsTransform={transformTableFilterToQueryCondition}
1548
- sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
1549
- tablePadding: tablePadding,
1550
- className: "dc-c-datatable",
1551
- customColumnFilter: $626282d9a03c51d5$var$DefaultColumnFilter,
1552
- options: options,
1553
- CustomLoadingComponent: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1554
- className: "ds-u-display--flex ds-u-padding--3",
1555
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
1556
- className: "ds-u-valign--middle",
1557
- role: "status",
1558
- "aria-valuetext": "Datatable loading"
1559
- })
1560
- }),
1561
- CustomNoResults: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1562
- className: "ds-u-display--flex ds-u-padding--3",
1563
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
1564
- children: "No results returned."
1565
- })
1566
- })
1567
- })
1568
- });
1569
- };
1570
- $626282d9a03c51d5$var$ResourcePreview.defaultProps = {
1571
- options: {
1572
- layout: "flex",
1573
- columnFilter: false,
1574
- columnSort: true,
1575
- columnResize: true
1904
+ const $7264a673914aa746$export$5f89a5ae87bc48e1 = [
1905
+ {
1906
+ label: "Is",
1907
+ value: "="
1576
1908
  },
1577
- truncateCellHeader: true,
1578
- defaultSort: [],
1579
- canResize: true
1580
- };
1581
- var $626282d9a03c51d5$export$2e2bcd8739ae039 = $626282d9a03c51d5$var$ResourcePreview;
1582
-
1583
-
1584
-
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
+ }
1585
2001
 
1586
2002
 
1587
2003
 
@@ -1624,287 +2040,445 @@ var $2ed0091f7e32d1e6$export$2e2bcd8739ae039 = $2ed0091f7e32d1e6$var$DataTablePa
1624
2040
 
1625
2041
 
1626
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;
1627
2124
 
1628
2125
 
1629
2126
 
1630
- const $1e012d1e3b534af0$var$DataTableDensity = ({ setTablePadding: setTablePadding , tablePadding: tablePadding })=>{
1631
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1632
- className: "ds-u-display--flex",
1633
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
1634
- options: [
1635
- {
1636
- label: "Tight",
1637
- value: "ds-u-padding-y--0"
1638
- },
1639
- {
1640
- label: "Normal",
1641
- value: "ds-u-padding-y--1"
1642
- },
1643
- {
1644
- label: "Expanded",
1645
- value: "ds-u-padding-y--2"
1646
- }
1647
- ],
1648
- size: "small",
1649
- label: "Display density:",
1650
- labelClassName: "ds-u-margin-top--0",
1651
- name: "datatable_display_density",
1652
- onChange: (e)=>setTablePadding(e.target.value),
1653
- defaultValue: "ds-u-padding-y--1"
1654
- })
1655
- });
1656
- };
1657
- $1e012d1e3b534af0$var$DataTableDensity.propTypes = {
1658
- setTablePadding: (0, $hgUW1$proptypes).func.isRequired
1659
- };
1660
- var $1e012d1e3b534af0$export$2e2bcd8739ae039 = $1e012d1e3b534af0$var$DataTableDensity;
1661
-
1662
2127
 
1663
2128
 
1664
2129
 
1665
2130
 
1666
- const $e71aee394fdad8bd$var$ManageColumns = ()=>{
1667
- const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
1668
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
1669
- onClick: ()=>setModalOpen(!modalOpen),
1670
- children: "Manage Columns"
1671
- });
1672
- };
1673
- var $e71aee394fdad8bd$export$2e2bcd8739ae039 = $e71aee394fdad8bd$var$ManageColumns;
1674
-
1675
2131
 
1676
2132
 
1677
2133
 
1678
2134
 
1679
2135
 
1680
- const $4def8e29c2039eb8$var$DataTableRowChanger = ({ setLimit: setLimit , rowOptions: rowOptions , limit: limit })=>{
1681
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1682
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
1683
- options: rowOptions.map((row)=>({
1684
- label: row.toString(),
1685
- value: row
1686
- })),
1687
- size: "small",
1688
- label: "Rows per page:",
1689
- labelClassName: "ds-u-margin-top--0",
1690
- name: "datatable_rows_per_page",
1691
- onChange: (e)=>setLimit(e.target.value),
1692
- defaultValue: limit
1693
- })
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"
1694
2140
  });
1695
- };
1696
- $4def8e29c2039eb8$var$DataTableRowChanger.defaultProps = {
1697
- rowOptions: [
1698
- 10,
1699
- 25,
1700
- 50,
1701
- 100
1702
- ]
1703
- };
1704
- $4def8e29c2039eb8$var$DataTableRowChanger.propTypes = {
1705
- rowOptions: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).number),
1706
- setLimit: (0, $hgUW1$proptypes).func.isRequired
1707
- };
1708
- var $4def8e29c2039eb8$export$2e2bcd8739ae039 = $4def8e29c2039eb8$var$DataTableRowChanger;
1709
-
1710
-
1711
-
1712
-
1713
- const $e973bc477cdc2dc7$var$DownloadIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
1714
- width: "15px",
1715
- height: "15px",
1716
- viewBox: "0 0 384 512",
1717
- version: "1.1",
1718
- xmlns: "http://www.w3.org/2000/svg",
1719
- xmlnsXlink: "http://www.w3.org/1999/xlink",
1720
- children: [
1721
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1722
- children: "Download Icon"
1723
- }),
1724
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
1725
- stroke: "none",
1726
- strokeWidth: "1",
1727
- fill: "none",
1728
- fillRule: "evenodd",
1729
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
1730
- fill: "#112E51",
1731
- fillRule: "nonzero",
1732
- 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"
1733
- })
1734
- })
1735
- ]
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
+ ])
1736
2187
  });
1737
- var $e973bc477cdc2dc7$export$2e2bcd8739ae039 = $e973bc477cdc2dc7$var$DownloadIcon;
2188
+ };
2189
+ var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
1738
2190
 
1739
2191
 
1740
2192
 
1741
2193
 
1742
- const $7ec5423a30aa3f61$var$CopyIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
1743
- width: "15px",
1744
- height: "15px",
1745
- viewBox: "0 0 512 512",
1746
- version: "1.1",
1747
- xmlns: "http://www.w3.org/2000/svg",
1748
- xmlnsXlink: "http://www.w3.org/1999/xlink",
1749
- children: [
1750
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1751
- children: "Copy Icon"
1752
- }),
1753
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
1754
- stroke: "none",
1755
- strokeWidth: "1",
1756
- fill: "none",
1757
- fillRule: "evenodd",
1758
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
1759
- fill: "#112E51",
1760
- fillRule: "nonzero",
1761
- 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"
1762
- })
1763
- })
1764
- ]
1765
- });
1766
- var $7ec5423a30aa3f61$export$2e2bcd8739ae039 = $7ec5423a30aa3f61$var$CopyIcon;
1767
2194
 
1768
2195
 
1769
2196
 
1770
2197
 
1771
- const $ec9e1550b0b034d0$var$SettingsIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
1772
- width: "15px",
1773
- height: "15px",
1774
- // viewBox="0 0 15 15"
1775
- viewBox: "0 0 512 512",
1776
- version: "1.1",
1777
- xmlns: "http://www.w3.org/2000/svg",
1778
- 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",
1779
2244
  children: [
1780
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1781
- 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
+ ]
1782
2265
  }),
1783
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
1784
- stroke: "none",
1785
- strokeWidth: "1",
1786
- fill: "none",
1787
- fillRule: "evenodd",
1788
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
1789
- fill: "#112E51",
1790
- fillRule: "nonzero",
1791
- 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"
1792
- })
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
+ ]
1793
2311
  })
1794
2312
  ]
1795
2313
  });
1796
- var $ec9e1550b0b034d0$export$2e2bcd8739ae039 = $ec9e1550b0b034d0$var$SettingsIcon;
1797
-
2314
+ };
2315
+ var $6369abf590ca298f$export$2e2bcd8739ae039 = $6369abf590ca298f$var$QueryRow;
1798
2316
 
1799
2317
 
1800
- const $af099c546cb226c7$var$ResourceHeader = ({ setTablePadding: setTablePadding , id: id , distribution: distribution , includeFiltered: includeFiltered , includeDensity: includeDensity , includeDownload: includeDownload , resource: resource , tablePadding: tablePadding , downloadUrl: downloadUrl })=>{
1801
- const md = (0, $hgUW1$useMediaQuery)({
1802
- minWidth: 0,
1803
- maxWidth: 768
1804
- });
1805
- const { limit: limit , offset: offset , count: count , setLimit: setLimit , setOffset: setOffset } = resource;
1806
- const intCount = count ? parseInt(count) : 0;
1807
- const [referenceElement, setReferenceElement] = (0, $hgUW1$useState)(null);
1808
- const [popperElement, setPopperElement] = (0, $hgUW1$useState)(null);
1809
- const [arrowElement, setArrowElement] = (0, $hgUW1$useState)(null);
1810
- const { styles: styles , attributes: attributes } = (0, $hgUW1$usePopper)(referenceElement, popperElement, {
1811
- 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,
1812
2357
  {
1813
- name: "arrow",
1814
- options: {
1815
- element: arrowElement
1816
- }
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()
1817
2362
  }
1818
- ]
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
+ };
1819
2386
  });
1820
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1821
- className: "dc-c-resource-header",
1822
- children: [
1823
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1824
- className: "ds-l-row",
1825
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1826
- className: "ds-l-col--12",
1827
- children: includeFiltered && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
1828
- className: "ds-c-button ds-c-button--solid",
1829
- to: `/dataset/${id}/data`,
1830
- children: "View and filter data"
1831
- })
1832
- })
1833
- }),
1834
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1835
- className: "ds-l-row ds-u-align-items--center",
1836
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1837
- 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),
1838
2438
  children: [
1839
2439
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1840
- className: "ds-u-font-weight--bold",
1841
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2ed0091f7e32d1e6$export$2e2bcd8739ae039), {
1842
- totalRows: parseInt(intCount),
1843
- limit: parseInt(limit),
1844
- offset: parseInt(offset)
1845
- })
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))
1846
2449
  }),
1847
2450
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1848
- 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",
1849
2452
  children: [
1850
- 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",
1851
2464
  children: [
1852
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Button), {
1853
- size: "small",
1854
- className: "ds-u-text-align--left ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1",
1855
- href: downloadUrl,
1856
- "aria-label": "Download filtered data (CSV)",
1857
- children: [
1858
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $e973bc477cdc2dc7$export$2e2bcd8739ae039), {}),
1859
- !md && /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1860
- className: "ds-u-font-weight--semibold ds-u-margin-left--1",
1861
- children: "Download filtered data (CSV)"
1862
- })
1863
- ]
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"
1864
2471
  }),
1865
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
1866
- onOpen: ()=>{
1867
- 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);
1868
2480
  },
1869
- className: "ds-c-button ds-c-button--small ds-u-text-align--left ds-u-margin-right--1",
1870
- placement: "bottom",
1871
- dialog: true,
1872
- ariaLabel: "Copy link to filtered data",
1873
- title: "Link copied to clipboard",
1874
- children: [
1875
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $7ec5423a30aa3f61$export$2e2bcd8739ae039), {}),
1876
- !md && /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1877
- className: "ds-u-font-weight--semibold ds-u-margin-left--1",
1878
- children: "Copy link to filtered data"
1879
- })
1880
- ]
1881
- })
1882
- ]
1883
- }),
1884
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
1885
- className: "ds-c-button ds-c-button--small ds-u-text-align--left display-settings-font",
1886
- placement: "bottom",
1887
- dialog: true,
1888
- ariaLabel: "Display settings",
1889
- title: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1890
- className: "dc-c-display-settings",
1891
- children: [
1892
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $4def8e29c2039eb8$export$2e2bcd8739ae039), {
1893
- limit: limit,
1894
- setLimit: setLimit,
1895
- setOffset: setOffset
1896
- }),
1897
- includeDensity && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $1e012d1e3b534af0$export$2e2bcd8739ae039), {
1898
- setTablePadding: setTablePadding,
1899
- tablePadding: tablePadding
1900
- })
1901
- ]
1902
- }),
1903
- children: [
1904
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ec9e1550b0b034d0$export$2e2bcd8739ae039), {}),
1905
- !md && /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1906
- className: "ds-u-font-weight--semibold ds-u-margin-left--1",
1907
- children: "Display settings"
2481
+ children: small ? "Clear all" : "Clear all filters"
1908
2482
  })
1909
2483
  ]
1910
2484
  })
@@ -1913,105 +2487,107 @@ const $af099c546cb226c7$var$ResourceHeader = ({ setTablePadding: setTablePadding
1913
2487
  ]
1914
2488
  })
1915
2489
  })
1916
- ]
2490
+ })
1917
2491
  });
1918
2492
  };
1919
- var $af099c546cb226c7$export$2e2bcd8739ae039 = $af099c546cb226c7$var$ResourceHeader;
1920
-
1921
-
1922
-
1923
-
1924
-
2493
+ $ee4ad47aa483e5b5$var$QueryBuilder.defaultProps = {
2494
+ includeSearchParams: true
2495
+ };
2496
+ var $ee4ad47aa483e5b5$export$2e2bcd8739ae039 = $ee4ad47aa483e5b5$var$QueryBuilder;
1925
2497
 
1926
2498
 
1927
- const $17193a17e26a72da$var$DatasetTags = ({ keywords: keywords })=>{
1928
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1929
- 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), {
1930
2525
  children: [
1931
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
1932
- className: "ds-u-color--primary ds-u-font-size--xl ds-u-margin-top--0 ds-u-margin-bottom--2",
1933
- 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
+ })
1934
2546
  }),
1935
- keywords && keywords.map((k)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
1936
- to: `/datasets?keyword[]=${k.data}`,
1937
- 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",
1938
- children: k.data
1939
- }, 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
+ })
1940
2581
  ]
1941
2582
  });
2583
+ else return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {});
1942
2584
  };
1943
- $17193a17e26a72da$var$DatasetTags.propTypes = {
1944
- keywords: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).shape({
1945
- data: (0, $hgUW1$proptypes).string.isRequired,
1946
- identifier: (0, $hgUW1$proptypes).string.isRequired
1947
- })).isRequired
1948
- };
1949
- var $17193a17e26a72da$export$2e2bcd8739ae039 = $17193a17e26a72da$var$DatasetTags;
2585
+ var $a35cf16d1488f54e$export$2e2bcd8739ae039 = $a35cf16d1488f54e$var$DatasetTable;
1950
2586
 
1951
2587
 
1952
2588
 
1953
2589
 
1954
2590
 
1955
- const $f341c2fd9bc53390$var$DatasetDownloads = ({ dataDictionaryURL: dataDictionaryURL , dataDictionaryType: dataDictionaryType , distributions: distributions })=>{
1956
- function trimDataDictionaryType() {
1957
- let splitDataDictionaryType = dataDictionaryType.split("/");
1958
- let type = splitDataDictionaryType.length > 1 ? splitDataDictionaryType[1] : splitDataDictionaryType[0];
1959
- return type.toUpperCase();
1960
- }
1961
- function getFormatType(dist) {
1962
- if (dist.data.format) return dist.data.format.toUpperCase();
1963
- if (dist.data.mediaType) {
1964
- const mediaType = dist.data.mediaType.split("/");
1965
- if (mediaType.length && mediaType[1]) return mediaType[1].toUpperCase();
1966
- }
1967
- if (dist.data["%Ref:downloadURL"].length && dist.data["%Ref:downloadURL"][0].data) {
1968
- if (dist.data["%Ref:downloadURL"][0].data.mimeType) {
1969
- const mimeType = dist.data["%Ref:downloadURL"][0].data.mimeType.split("/");
1970
- if (mimeType.length && mimeType[1]) return mimeType[1].toUpperCase();
1971
- }
1972
- }
1973
- return "";
1974
- }
1975
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1976
- className: "ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1 dc-c-dataset-downloads",
1977
- children: [
1978
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
1979
- 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",
1980
- children: "Downloads"
1981
- }),
1982
- (distributions.length || dataDictionaryURL && dataDictionaryType) && /*#__PURE__*/ (0, $hgUW1$jsxs)("ul", {
1983
- className: "ds-c-list ds-c-list--bare",
1984
- children: [
1985
- distributions.map((dist)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1986
- className: "ds-u-padding-bottom--1",
1987
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
1988
- href: dist.data.downloadURL,
1989
- className: "ds-u-word-break",
1990
- children: [
1991
- getFormatType(dist),
1992
- " ",
1993
- "Resource File"
1994
- ]
1995
- })
1996
- }, dist.identifier)),
1997
- dataDictionaryURL && dataDictionaryType && /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1998
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
1999
- href: dataDictionaryURL,
2000
- children: [
2001
- "Data Dictionary (",
2002
- trimDataDictionaryType(),
2003
- ")"
2004
- ]
2005
- })
2006
- })
2007
- ]
2008
- })
2009
- ]
2010
- });
2011
- };
2012
- var $f341c2fd9bc53390$export$2e2bcd8739ae039 = $f341c2fd9bc53390$var$DatasetDownloads;
2013
-
2014
-
2015
2591
 
2016
2592
 
2017
2593
 
@@ -2074,624 +2650,366 @@ var $5644ebd2c3dbfd7b$export$2e2bcd8739ae039 = $5644ebd2c3dbfd7b$var$DatasetAddi
2074
2650
 
2075
2651
 
2076
2652
 
2077
- const $072291d44ce1834a$var$ResourceFooter = ({ resource: resource })=>{
2078
- const { limit: limit , values: values , offset: offset , count: count , setOffset: setOffset } = resource;
2079
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2080
- children: values.length > 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
2081
- id: "test-default",
2082
- currentPage: Number(offset) / limit + 1,
2083
- totalPages: Math.ceil(Number(count) / limit),
2084
- onPageChange: (evt, page)=>{
2085
- evt.preventDefault();
2086
- setOffset((page - 1) * limit);
2087
- },
2088
- renderHref: (page)=>{
2089
- return "";
2090
- }
2091
- })
2092
- });
2093
- };
2094
- var $072291d44ce1834a$export$2e2bcd8739ae039 = $072291d44ce1834a$var$ResourceFooter;
2095
-
2096
-
2097
-
2098
-
2099
2653
 
2100
2654
 
2101
- const $68eacd619bee0da7$var$ResourceInformation = ({ resource: resource })=>{
2655
+ const $0958733ee130fc44$var$ResourceInformation = ({ resource: resource })=>{
2102
2656
  const { count: count , columns: columns } = resource;
2103
2657
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2104
- 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",
2105
2659
  children: [
2106
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2107
- 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",
2108
2662
  children: "About this Resource"
2109
2663
  }),
2110
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
2111
- compact: true,
2112
- 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",
2113
2666
  children: [
2114
- /*#__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",
2115
2669
  children: [
2116
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2117
- component: "th",
2118
- scope: "row",
2670
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2671
+ className: "ds-u-padding-top--05",
2119
2672
  children: "Rows"
2120
2673
  }),
2121
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2122
- align: "right",
2123
- children: parseInt(count).toLocaleString()
2674
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2675
+ className: "ds-u-font-weight--bold",
2676
+ children: count.toLocaleString()
2124
2677
  })
2125
2678
  ]
2126
2679
  }),
2127
- /*#__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",
2128
2736
  children: [
2129
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2130
- component: "th",
2131
- scope: "row",
2132
- 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
+ ]
2133
2745
  }),
2134
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2135
- align: "right",
2136
- 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
2137
2766
  })
2138
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
+ })
2139
2817
  })
2140
2818
  ]
2141
2819
  })
2142
2820
  ]
2143
2821
  });
2144
2822
  };
2145
- var $68eacd619bee0da7$export$2e2bcd8739ae039 = $68eacd619bee0da7$var$ResourceInformation;
2823
+ var $364dc44850cd8f7f$export$2e2bcd8739ae039 = $364dc44850cd8f7f$var$DatasetOverview;
2146
2824
 
2147
2825
 
2148
- // Example custom column headers, where only effective date has an ! at the end
2149
- // [
2150
- // {schema: 'date', cell: ({ value }) => localeDate(value),},
2151
- // {accessor: 'effective_date',cell: ({ value }) => localeDate(value) + '!',},
2152
- // ]
2153
- function $7264a673914aa746$export$8049e8f40a9bdfb8(customHeaders, columns, schema) {
2154
- return columns.map((column)=>{
2155
- const customAccessorIndex = customHeaders.findIndex((header)=>header.accessor === column);
2156
- const customSchemaIndex = customHeaders.findIndex((header)=>header.schema === schema.fields[column].mysql_type);
2157
- let newColumn = {};
2158
- // If specific accessor is passed, this will override a general mysql_type Cell rewrite.
2159
- if (customAccessorIndex > -1) {
2160
- newColumn.header = schema && schema.fields[column].description ? schema.fields[column].description : column;
2161
- newColumn.accessor = column;
2162
- newColumn.cell = customHeaders[customAccessorIndex].cell;
2163
- } else {
2164
- newColumn.header = schema && schema.fields[column].description ? schema.fields[column].description : column;
2165
- newColumn.accessor = column;
2166
- if (customSchemaIndex > -1) newColumn.cell = customHeaders[customSchemaIndex].cell;
2167
- }
2168
- 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
+ })
2169
2838
  });
2170
- }
2171
- function $7264a673914aa746$export$e284ae5d89467c8f(date) {
2172
- if (!date) return date;
2173
- date = new Date(date);
2174
- date = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
2175
- return date;
2176
- }
2177
- function $7264a673914aa746$export$6b5e57d20078142b(value, operator) {
2178
- let newValue = value;
2179
- if (Array.isArray(newValue)) newValue = newValue.join(",");
2180
- // return newValue.replace(/(^\%+|\%+$)/gm, '');
2181
- return newValue;
2182
- }
2183
- const $7264a673914aa746$export$5f89a5ae87bc48e1 = [
2184
- {
2185
- label: "Is",
2186
- value: "="
2187
- },
2188
- {
2189
- label: "Starts With",
2190
- value: "starts with"
2191
- },
2192
- {
2193
- label: "Contains",
2194
- value: "contains"
2195
- },
2196
- {
2197
- label: "Is Not",
2198
- value: "<>"
2199
- },
2200
- {
2201
- label: "Or",
2202
- value: "in"
2203
- },
2204
- {
2205
- label: "Is",
2206
- value: "="
2207
- },
2208
- {
2209
- label: "Is Not",
2210
- value: "<>"
2211
- },
2212
- {
2213
- label: "Greater Than",
2214
- value: ">"
2215
- },
2216
- {
2217
- label: "Less Than",
2218
- value: "<"
2219
- }
2220
- ];
2221
- function $7264a673914aa746$export$2b9377795161999(type) {
2222
- switch(type){
2223
- case "text":
2224
- case "string":
2225
- return [
2226
- {
2227
- label: "Is",
2228
- value: "="
2229
- },
2230
- {
2231
- label: "Starts With",
2232
- value: "starts with"
2233
- },
2234
- {
2235
- label: "Contains",
2236
- value: "contains"
2237
- },
2238
- {
2239
- label: "Is Not",
2240
- value: "<>"
2241
- },
2242
- {
2243
- label: "Or",
2244
- value: "in"
2245
- }
2246
- ];
2247
- case "date":
2248
- return [
2249
- {
2250
- label: "Is",
2251
- value: "="
2252
- },
2253
- {
2254
- label: "Is Not",
2255
- value: "<>"
2256
- },
2257
- {
2258
- label: "Greater Than",
2259
- value: ">"
2260
- },
2261
- {
2262
- label: "Less Than",
2263
- value: "<"
2264
- }
2265
- ];
2266
- default:
2267
- // These 2 should be safe for all data types
2268
- return [
2269
- {
2270
- label: "Is",
2271
- value: "="
2272
- },
2273
- {
2274
- label: "Is Not",
2275
- value: "<>"
2276
- }
2277
- ];
2278
- }
2279
- }
2280
-
2839
+ };
2840
+ var $789279954d8eff7f$export$2e2bcd8739ae039 = $789279954d8eff7f$var$ApiDocumentation;
2281
2841
 
2282
2842
 
2283
- const $766b8e351dd607f5$var$DatasetBody = ({ rootUrl: rootUrl , id: id , dataset: dataset , additionalParams: additionalParams , customColumns: customColumns , columnSettings: columnSettings , columnWidths: columnWidths , metadataMapping: metadataMapping })=>{
2284
- let apiDocs = (0, $hgUW1$useRef)();
2285
- const [tablePadding, setTablePadding] = (0, $hgUW1$useState)("ds-u-padding-y--1");
2286
- const [fileFormat, setFileFormat] = (0, $hgUW1$useState)("");
2287
- let distribution = {};
2288
- let distribution_array = dataset.distribution ? dataset.distribution : [];
2289
- if (distribution_array.length) distribution = distribution_array[0];
2290
- const resource = (0, $1d3d480a9cfaabe0$export$2e2bcd8739ae039)("", rootUrl, {
2291
- limit: 10,
2292
- manual: true
2293
- }, additionalParams);
2294
- (0, $hgUW1$useEffect)(()=>{
2295
- if (distribution.identifier) {
2296
- let localFileFormat = "";
2297
- if (distribution.data.format) localFileFormat = distribution.data.format.toUpperCase();
2298
- else if (distribution.data.mediaType) {
2299
- const mediaType = distribution.data.mediaType.split("/");
2300
- if (mediaType.length && mediaType[1]) localFileFormat = mediaType[1].toUpperCase();
2301
- }
2302
- setFileFormat(localFileFormat);
2303
- if (localFileFormat === "CSV") {
2304
- resource.setResource(distribution.identifier);
2305
- resource.setManual(false);
2306
- }
2307
- }
2308
- }, [
2309
- distribution
2310
- ]);
2311
- return /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
2312
- className: "ds-l-container",
2313
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2314
- className: "ds-l-row ds-u-padding-top--3",
2315
- children: [
2316
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2317
- className: "ds-l-md-col--9 ds-l-sm-col--12",
2318
- children: [
2319
- /*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
2320
- className: "ds-title ds-u-word-break",
2321
- children: dataset.title
2322
- }),
2323
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2324
- className: "ds-l-row",
2325
- children: [
2326
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2327
- className: "ds-l-col--6 ds-u-margin-bottom--2",
2328
- children: dataset.theme ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
2329
- variation: "info",
2330
- children: dataset.theme[0].data
2331
- }) : null
2332
- }),
2333
- dataset.modified && /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
2334
- className: "ds-l-col--6 ds-u-color--gray ds-u-text-align--right",
2335
- children: [
2336
- "Updated ",
2337
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
2338
- date: dataset.modified
2339
- })
2340
- ]
2341
- })
2342
- ]
2343
- }),
2344
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2345
- className: "dc-c-metadata-description",
2346
- dangerouslySetInnerHTML: {
2347
- __html: (0, $hgUW1$dompurify).sanitize(dataset.description)
2348
- }
2349
- }),
2350
- 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,
2351
2865
  children: [
2352
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2353
- className: "dc-resource-header ds-text-heading--2xl ds-u-margin-y--3",
2354
- children: "Resource Preview"
2355
- }),
2356
- resource.columns ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2866
+ "View API",
2867
+ " ",
2868
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2869
+ style: {
2870
+ whiteSpace: "nowrap"
2871
+ },
2357
2872
  children: [
2358
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $af099c546cb226c7$export$2e2bcd8739ae039), {
2359
- id: id,
2360
- includeFiltered: true,
2361
- includeDensity: true,
2362
- tablePadding: tablePadding,
2363
- setTablePadding: setTablePadding,
2364
- distribution: distribution,
2365
- resource: resource
2366
- }),
2367
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $626282d9a03c51d5$export$2e2bcd8739ae039), {
2368
- id: distribution.identifier,
2369
- tablePadding: tablePadding,
2370
- resource: resource,
2371
- customColumns: (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution_array[0].identifier]),
2372
- columnSettings: columnSettings,
2373
- options: {
2374
- layout: "flex",
2375
- columnFilter: false,
2376
- columnSort: true,
2377
- columnResize: true
2378
- },
2379
- columnWidths: columnWidths
2380
- }),
2381
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $072291d44ce1834a$export$2e2bcd8739ae039), {
2382
- resource: resource
2383
- }),
2384
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $68eacd619bee0da7$export$2e2bcd8739ae039), {
2385
- resource: resource
2873
+ "specification ",
2874
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2875
+ className: "fa fa-arrow-right ds-u-font-weight--bold"
2386
2876
  })
2387
2877
  ]
2388
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)(Spinner, {
2389
- "aria-valuetext": "Dataset loading",
2390
- role: "status"
2391
- })
2392
- ]
2393
- }) : "",
2394
- dataset.identifier && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5644ebd2c3dbfd7b$export$2e2bcd8739ae039), {
2395
- datasetInfo: dataset,
2396
- id: dataset.identifier,
2397
- metadataMapping: metadataMapping
2398
- }),
2399
- Object.keys(distribution).length && fileFormat === "CSV" && dataset.identifier ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2400
- ref: apiDocs,
2401
- children: [
2402
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2403
- className: "ds-text-heading--2xl ds-u-margin-y--2",
2404
- children: "Try the API"
2405
- }),
2406
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
2407
- url: `${rootUrl}/metastore/schemas/dataset/items/${dataset.identifier}/docs${additionalParams && additionalParams.ACA ? "?ACA=" + additionalParams.ACA + "&redirect=false" : ""}`,
2408
- docExpansion: "list",
2409
- defaultModelsExpandDepth: -1
2410
- })
2411
- ]
2412
- }) : ""
2413
- ]
2414
- }),
2415
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2416
- className: "ds-l-md-col--3 ds-l-sm-col--12",
2417
- children: [
2418
- Object.keys(distribution).length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $f341c2fd9bc53390$export$2e2bcd8739ae039), {
2419
- dataDictionaryURL: dataset.describedBy,
2420
- dataDictionaryType: dataset.describedByType,
2421
- distributions: dataset.distribution
2422
- }) : "",
2423
- dataset.keyword && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $17193a17e26a72da$export$2e2bcd8739ae039), {
2424
- keywords: dataset.keyword
2425
- }),
2426
- Object.keys(distribution).length && fileFormat === "CSV" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2427
- className: "dc-c-dataset-tags ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1",
2428
- children: [
2429
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2430
- 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",
2431
- children: "API"
2432
- }),
2433
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2434
- variation: "ghost",
2435
- onClick: ()=>window.scrollTo({
2436
- behavior: "smooth",
2437
- top: apiDocs.current.offsetTop
2438
- }),
2439
- children: "Scroll to dataset API"
2440
2878
  })
2441
2879
  ]
2442
- }) : ""
2443
- ]
2444
- })
2445
- ]
2446
- })
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
+ ]
2447
2888
  });
2448
2889
  };
2449
- $766b8e351dd607f5$var$DatasetBody.propTypes = {
2450
- id: (0, $hgUW1$proptypes).string.isRequired,
2451
- dataset: (0, $hgUW1$proptypes).object.isRequired
2452
- };
2453
- var $766b8e351dd607f5$export$2e2bcd8739ae039 = $766b8e351dd607f5$var$DatasetBody;
2454
-
2890
+ var $cf6eaefd6b928de3$export$2e2bcd8739ae039 = $cf6eaefd6b928de3$var$DatasetAPI;
2455
2891
 
2456
2892
 
2457
2893
 
2458
2894
 
2459
2895
 
2460
2896
 
2461
- const $28f16f59778efa64$export$82b1b1d517e5388a = {
2462
- "R/P10Y": {
2463
- name: "Decennial"
2464
- },
2465
- "R/P4Y": {
2466
- name: "Quadrennial"
2467
- },
2468
- "R/P1Y": {
2469
- name: "Annual"
2470
- },
2471
- "R/P2M": {
2472
- name: "Bimonthly"
2473
- },
2474
- "R/P3.5D": {
2475
- name: "Semiweekly"
2476
- },
2477
- "R/P1D": {
2478
- name: "Daily"
2479
- },
2480
- "R/P2W": {
2481
- name: "Biweekly"
2482
- },
2483
- "R/P6M": {
2484
- name: "Semiannual"
2485
- },
2486
- "R/P2Y": {
2487
- name: "Biennial"
2488
- },
2489
- "R/P3Y": {
2490
- name: "Triennial"
2491
- },
2492
- "R/P0.33W": {
2493
- name: "Three times a week"
2494
- },
2495
- "R/P0.33M": {
2496
- name: "Three times a month"
2497
- },
2498
- "R/PT1S": {
2499
- name: "Continuously updated"
2500
- },
2501
- "R/P1M": {
2502
- name: "Monthly"
2503
- },
2504
- "R/P3M": {
2505
- name: "Quarterly"
2506
- },
2507
- "R/P0.5M": {
2508
- name: "Semimonthly"
2509
- },
2510
- "R/P4M": {
2511
- name: "Three times a year"
2512
- },
2513
- "R/P1W": {
2514
- name: "Weekly"
2515
- },
2516
- "R/PT1H": {
2517
- name: "Hourly"
2518
- },
2519
- irregular: {
2520
- name: "Irregular"
2521
- }
2522
- };
2523
-
2524
-
2525
- const $6da0396069e23175$export$bc27cf7ecf44639d = {
2526
- modified: (data)=>{
2527
- return [
2528
- {
2529
- label: "Modified",
2530
- value: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
2531
- date: data
2532
- })
2533
- }
2534
- ];
2535
- },
2536
- issued: (data)=>{
2537
- return [
2538
- {
2539
- label: "Issued",
2540
- value: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
2541
- date: data
2542
- })
2543
- }
2544
- ];
2545
- },
2546
- accrualPeriodicity: (data)=>{
2547
- return [
2548
- {
2549
- label: "Frequency",
2550
- value: (0, $28f16f59778efa64$export$82b1b1d517e5388a)[data].name
2551
- }
2552
- ];
2553
- },
2554
- publisher: (data)=>{
2555
- if (data.data && data.data.name) return [
2556
- {
2557
- label: "Publisher",
2558
- value: data.data.name
2559
- }
2560
- ];
2561
- else return [];
2562
- },
2563
- identifier: (data)=>{
2564
- return [
2565
- {
2566
- label: "Identifier",
2567
- value: data
2568
- }
2569
- ];
2570
- },
2571
- contactPoint: (data)=>{
2572
- let rows = [];
2573
- if (data.fn) rows.push({
2574
- label: "Contact",
2575
- value: data.fn
2576
- });
2577
- if (data.hasEmail) rows.push({
2578
- label: "Contact Email",
2579
- value: data.hasEmail
2580
- });
2581
- return rows;
2582
- },
2583
- bureauCode: (data)=>{
2584
- if (data.length) return [
2585
- {
2586
- label: "Bureau Code",
2587
- value: data[0]
2588
- }
2589
- ];
2590
- },
2591
- programCode: (data)=>{
2592
- if (data.length) return [
2593
- {
2594
- label: "Program Code",
2595
- value: data[0]
2596
- }
2597
- ];
2598
- },
2599
- theme: (data)=>{
2600
- return [
2601
- {
2602
- label: "Category",
2603
- value: data.map((theme)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
2604
- to: `/datasets?theme[]=${theme.data}`,
2605
- children: theme.data
2606
- }, theme.data)).reduce((prev, curr)=>[
2607
- prev,
2608
- ", ",
2609
- curr
2610
- ])
2611
- }
2612
- ];
2613
- },
2614
- keyword: (data)=>{
2615
- return [
2616
- {
2617
- label: "Tags",
2618
- value: data.map((keyword)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
2619
- to: `/datasets?keyword[]=${keyword.data}`,
2620
- children: keyword.data
2621
- }, keyword.data)).reduce((prev, curr)=>[
2622
- prev,
2623
- ", ",
2624
- curr
2625
- ])
2626
- }
2627
- ];
2628
- },
2629
- license: (data)=>{
2630
- return [
2631
- {
2632
- label: "License",
2633
- value: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
2634
- href: data,
2635
- children: data
2636
- })
2637
- }
2638
- ];
2639
- },
2640
- accessLevel: (data)=>{
2641
- return [
2642
- {
2643
- label: "Public Access Level",
2644
- value: data
2645
- }
2646
- ];
2647
- },
2648
- temporal: (data)=>{
2649
- return [
2650
- {
2651
- label: "Temporal Coverage",
2652
- value: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2653
- className: "dc-c-word-break--all",
2654
- children: data
2655
- })
2656
- }
2657
- ];
2658
- },
2659
- spatial: (data)=>{
2660
- return [
2661
- {
2662
- label: "Spacial/Geographical Coverage",
2663
- value: data
2664
- }
2665
- ];
2666
- },
2667
- references: (data)=>{
2668
- return [
2669
- {
2670
- label: "Related Documents",
2671
- value: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
2672
- className: "ds-u-margin--0 ds-u-padding-y--0 ds-u-padding-left--2 ds-u-padding-right--0",
2673
- children: data.map((item)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
2674
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
2675
- href: item,
2676
- children: item
2677
- })
2678
- }, item))
2679
- })
2680
- }
2681
- ];
2682
- }
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
+ });
2683
2948
  };
2949
+ var $6012b86ffcaf3f71$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($6012b86ffcaf3f71$var$DataDictionary);
2684
2950
 
2685
2951
 
2686
2952
 
2687
- const $6e7bdcbebdb4b794$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalParams: additionalParams , customColumns: customColumns , setDatasetTitle: setDatasetTitle , columnSettings: columnSettings , columnWidths: columnWidths , customMetadataMapping: customMetadataMapping })=>{
2688
- const metastore = (0, $68d79598b83f3382$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
2689
- 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);
2690
2976
  const title = dataset.title ? dataset.title : "";
2691
2977
  const metadataMapping = {
2692
2978
  ...(0, $6da0396069e23175$export$bc27cf7ecf44639d),
2693
2979
  ...customMetadataMapping
2694
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
+ ]);
2695
3013
  (0, $hgUW1$useEffect)(()=>{
2696
3014
  if (title) {
2697
3015
  if (setDatasetTitle) setDatasetTitle(title);
@@ -2732,25 +3050,120 @@ const $6e7bdcbebdb4b794$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalP
2732
3050
  });
2733
3051
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
2734
3052
  children: dataset.error ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $026cb986f9fea2b1$export$2e2bcd8739ae039), {
2735
- content: notFoundContent
2736
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $766b8e351dd607f5$export$2e2bcd8739ae039), {
2737
- rootUrl: rootUrl,
2738
- id: id,
2739
- dataset: dataset,
2740
- additionalParams: additionalParams,
2741
- customColumns: customColumns ? customColumns : [],
2742
- columnSettings: columnSettings,
2743
- columnWidths: columnWidths,
2744
- 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
+ }) : null,
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
+ ]
2745
3159
  })
2746
3160
  });
2747
3161
  };
2748
- $6e7bdcbebdb4b794$var$Dataset.propTypes = {
3162
+ $a0f13962e513caa1$var$Dataset.propTypes = {
2749
3163
  id: (0, $hgUW1$proptypes).string.isRequired,
2750
3164
  rootUrl: (0, $hgUW1$proptypes).string.isRequired
2751
3165
  };
2752
- var $6e7bdcbebdb4b794$export$2e2bcd8739ae039 = $6e7bdcbebdb4b794$var$Dataset;
2753
-
3166
+ var $a0f13962e513caa1$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($a0f13962e513caa1$var$Dataset);
2754
3167
 
2755
3168
 
2756
3169
 
@@ -2989,9 +3402,20 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
2989
3402
  });
2990
3403
  const menu = (0, $hgUW1$useRef)(null);
2991
3404
  (0, $hgUW1$useEffect)(()=>{
2992
- function handleFocusOut(event) {
2993
- if (menu.current && !menu.current.contains(event.relatedTarget)) setMenuOpen(false);
2994
- }
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
+ };
2995
3419
  function handleFocusIn(event) {
2996
3420
  if (!menuOpen) return;
2997
3421
  const mobileHeaderMenu = document.querySelector(`.${$caaccb8ea608e518$var$mobileHeaderMenuClassName}`);
@@ -3003,8 +3427,7 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
3003
3427
  }
3004
3428
  function handleClick(event) {
3005
3429
  // Links are wrapped in spans, this checks if the parent is an A, also check if in the search modal.
3006
- if (// event.target.parentElement.nodeName === 'A' ||
3007
- event.target.closest(".dc-c-search-dialog")) setMenuOpen(false);
3430
+ if (event.target.closest(".dc-c-search-dialog")) setMenuOpen(false);
3008
3431
  }
3009
3432
  function handleSearchEnter(event) {
3010
3433
  // Close upon user hitting enter on search.
@@ -3014,21 +3437,35 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
3014
3437
  // Close upon user hitting escape
3015
3438
  if (event.keyCode === 27 && menuOpen) setMenuOpen(false);
3016
3439
  }
3017
- menu.current.addEventListener("focusout", handleFocusOut);
3018
3440
  document.addEventListener("mousedown", handleClick);
3019
3441
  document.addEventListener("keyup", handleSearchEnter);
3020
3442
  document.addEventListener("keyup", handleMenuClose);
3021
3443
  handleFocusIn();
3444
+ menu.current.addEventListener("keydown", (evt)=>trapFocus(evt, menu.current));
3022
3445
  return ()=>{
3023
3446
  document.removeEventListener("keyup", handleSearchEnter);
3024
3447
  document.removeEventListener("keyup", handleMenuClose);
3025
3448
  document.removeEventListener("mousedown", handleClick);
3026
- if (menu.current) menu.current.removeEventListener("focusout", handleFocusOut);
3449
+ if (menu.current) menu.current.removeEventListener("keydown", trapFocus);
3027
3450
  };
3028
3451
  }, [
3029
- menu.current,
3030
3452
  menuOpen
3031
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
+ };
3032
3469
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("header", {
3033
3470
  className: `dc-c-header dc-c-mobile-header ${menuOpen ? "menu-open" : ""}`,
3034
3471
  "aria-label": "Site header",
@@ -3101,6 +3538,7 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
3101
3538
  }),
3102
3539
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3103
3540
  className: $caaccb8ea608e518$var$mobileHeaderMenuClassName,
3541
+ "data-testid": "mobile-menu",
3104
3542
  ref: menu,
3105
3543
  children: [
3106
3544
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
@@ -3132,7 +3570,8 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
3132
3570
  menuName: "Main Nav",
3133
3571
  menuId: "site",
3134
3572
  menuClasses: "dc-c-header--links dc-c-header--mobile-links",
3135
- 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
3136
3575
  }),
3137
3576
  mobile && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3138
3577
  className: "cms-mobile-header--container",
@@ -3287,7 +3726,7 @@ const $a6df0aa147323304$var$Footer = ({ links: links , showEmail: showEmail , em
3287
3726
  className: "ds-u-font-size--sm ds-u-margin-bottom--3",
3288
3727
  children: footerOpenDataToolLinks.map((link)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
3289
3728
  className: "ds-u-margin-bottom--1",
3290
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf8eeac354b9dd32$export$2e2bcd8739ae039), {
3729
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $24918217e48ac525$export$2e2bcd8739ae039), {
3291
3730
  link: link,
3292
3731
  className: "dc-menu-item"
3293
3732
  })
@@ -3318,7 +3757,7 @@ const $a6df0aa147323304$var$Footer = ({ links: links , showEmail: showEmail , em
3318
3757
  }, link.id);
3319
3758
  return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
3320
3759
  className: "ds-u-margin-bottom--1",
3321
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf8eeac354b9dd32$export$2e2bcd8739ae039), {
3760
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $24918217e48ac525$export$2e2bcd8739ae039), {
3322
3761
  link: link,
3323
3762
  className: "dc-menu-item"
3324
3763
  })
@@ -3680,6 +4119,190 @@ var $a6df0aa147323304$export$2e2bcd8739ae039 = $a6df0aa147323304$var$Footer;
3680
4119
 
3681
4120
 
3682
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
+
3683
4306
  const $efc410f5f7ac5ef3$var$useSearchAPI = (rootUrl, initialSearchParams = {}, additionalParams = {})=>{
3684
4307
  const defaultSort = "";
3685
4308
  const defaultFulltext = "";
@@ -3870,39 +4493,168 @@ var $59a079354baa335c$export$2e2bcd8739ae039 = $59a079354baa335c$var$Hero;
3870
4493
 
3871
4494
 
3872
4495
 
3873
- const $789279954d8eff7f$var$ApiDocumentation = ({ endpoint: endpoint })=>{
4496
+
4497
+
4498
+
4499
+
4500
+
4501
+
4502
+
4503
+
4504
+ const $1e012d1e3b534af0$var$DataTableDensity = ({ setTablePadding: setTablePadding , tablePadding: tablePadding })=>{
3874
4505
  return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3875
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
3876
- 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()
3877
4568
  })
3878
4569
  });
3879
4570
  };
3880
- 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;
3881
4585
 
3882
4586
 
3883
4587
 
3884
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;
3885
4614
 
3886
4615
 
3887
4616
 
3888
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;
3889
4643
 
3890
4644
 
3891
4645
 
3892
4646
 
3893
- const $847b0964185837b2$var$CloseIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
4647
+ const $ec9e1550b0b034d0$var$SettingsIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
3894
4648
  width: "15px",
3895
4649
  height: "15px",
3896
- viewBox: "0 0 15 15",
4650
+ // viewBox="0 0 15 15"
4651
+ viewBox: "0 0 512 512",
3897
4652
  version: "1.1",
3898
4653
  xmlns: "http://www.w3.org/2000/svg",
3899
4654
  xmlnsXlink: "http://www.w3.org/1999/xlink",
3900
4655
  children: [
3901
4656
  /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
3902
- children: "Close Icon"
3903
- }),
3904
- /*#__PURE__*/ (0, $hgUW1$jsx)("desc", {
3905
- children: "Created with Sketch."
4657
+ children: "Settings Icon"
3906
4658
  }),
3907
4659
  /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
3908
4660
  stroke: "none",
@@ -3910,346 +4662,273 @@ const $847b0964185837b2$var$CloseIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg"
3910
4662
  fill: "none",
3911
4663
  fillRule: "evenodd",
3912
4664
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3913
- 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",
3914
- fill: "#000000",
3915
- 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"
3916
4668
  })
3917
4669
  })
3918
4670
  ]
3919
4671
  });
3920
- var $847b0964185837b2$export$2e2bcd8739ae039 = $847b0964185837b2$var$CloseIcon;
4672
+ var $ec9e1550b0b034d0$export$2e2bcd8739ae039 = $ec9e1550b0b034d0$var$SettingsIcon;
3921
4673
 
3922
4674
 
3923
4675
 
3924
- function $3535053b28e5ffce$var$convertUTCToLocalDate(date) {
3925
- if (!date) return date;
3926
- date = new Date(date);
3927
- date = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
3928
- return date;
3929
- }
3930
- function $3535053b28e5ffce$var$buildOperatorOptions(type) {
3931
- switch(type){
3932
- case "text":
3933
- case "string":
3934
- return [
3935
- {
3936
- label: "Is",
3937
- value: "="
3938
- },
3939
- {
3940
- label: "Contains",
3941
- value: "like"
3942
- },
3943
- {
3944
- label: "Is Not",
3945
- value: "<>"
3946
- },
3947
- {
3948
- label: "Or",
3949
- value: "in"
3950
- }
3951
- ];
3952
- case "date":
3953
- return [
3954
- {
3955
- label: "Is",
3956
- value: "="
3957
- },
3958
- {
3959
- label: "Is Not",
3960
- value: "<>"
3961
- },
3962
- {
3963
- label: "Greater Than",
3964
- value: ">"
3965
- },
3966
- {
3967
- label: "Less Than",
3968
- value: "<"
3969
- }
3970
- ];
3971
- default:
3972
- // These 2 should be safe for all data types
3973
- return [
3974
- {
3975
- label: "Is",
3976
- value: "="
3977
- },
3978
- {
3979
- label: "Is Not",
3980
- value: "<>"
3981
- }
3982
- ];
3983
- }
3984
- }
3985
- function $3535053b28e5ffce$var$cleanText(value, operator) {
3986
- let newValue = value;
3987
- if (Array.isArray(newValue)) newValue = newValue.join(",");
3988
- return newValue.replace(/(^\%+|\%+$)/gm, "");
3989
- }
3990
- const $3535053b28e5ffce$var$ResourceConditionField = ({ data: data , index: index , remove: remove , schema: schema , update: update })=>{
3991
- const { fields: fields } = schema;
3992
- const [startDate, setStartDate] = (0, $hgUW1$react).useState(data.value ? new Date(data.value) : new Date());
3993
- const [propertyOptions, setPropertyOptions] = (0, $hgUW1$react).useState(Object.keys(fields).map((key)=>{
3994
- return {
3995
- label: fields[key].description ? fields[key].description : key,
3996
- value: key
3997
- };
3998
- }));
3999
- const [property, setProperty] = (0, $hgUW1$react).useState(data.property);
4000
- const [operator, setOperator] = (0, $hgUW1$react).useState(data.operator);
4001
- const [operatorOptions, setOperatorOptions] = (0, $hgUW1$react).useState([
4002
- {
4003
- label: "--",
4004
- value: ""
4005
- }
4006
- ]);
4007
- const [value, setValue] = (0, $hgUW1$react).useState(data.value);
4008
- (0, $hgUW1$react).useEffect(()=>{
4009
- if (property) {
4010
- const opOptions = $3535053b28e5ffce$var$buildOperatorOptions(fields[property].mysql_type ? fields[property].mysql_type : fields[property].type).map((opt)=>{
4011
- return {
4012
- label: opt.label,
4013
- value: opt.value
4014
- };
4015
- });
4016
- update(index, "property", property);
4017
- if (!operator) setOperator(opOptions[0].value);
4018
- setOperatorOptions(opOptions);
4019
- if (fields[property].mysql_type && fields[property].mysql_type === "date" || fields[property].type === "date") setValue(startDate.toJSON().slice(0, 10));
4020
- } else {
4021
- update(index, "property", property);
4022
- setOperator("");
4023
- setValue("");
4024
- setOperatorOptions([
4025
- {
4026
- label: "--",
4027
- 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
4028
4692
  }
4029
- ]);
4030
- }
4031
- }, [
4032
- property,
4033
- operator
4034
- ]);
4035
- (0, $hgUW1$react).useEffect(()=>{
4036
- if (operator) update(index, "operator", operator);
4037
- else update(index, "operator", "");
4038
- }, [
4039
- operator
4040
- ]);
4041
- (0, $hgUW1$react).useEffect(()=>{
4042
- if (value) update(index, "value", value);
4043
- else update(index, "value", "");
4044
- }, [
4045
- value
4046
- ]);
4047
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("fieldset", {
4693
+ }
4694
+ ]
4695
+ });
4696
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4697
+ className: "dc-c-resource-header",
4048
4698
  children: [
4049
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4050
- className: "ds-l-form-row",
4051
- children: [
4052
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
4053
- options: [
4054
- {
4055
- label: "Select column",
4056
- value: ""
4057
- },
4058
- ...propertyOptions
4059
- ],
4060
- value: property,
4061
- onChange: (e)=>setProperty(e.target.value),
4062
- label: "Filter column",
4063
- labelClassName: "ds-u-margin-top--0 ds-u-visibility--screen-reader",
4064
- name: `column_name_${index}`,
4065
- className: "ds-l-col--6"
4066
- }),
4067
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
4068
- options: [
4069
- ...operatorOptions
4070
- ],
4071
- value: operator,
4072
- disabled: !property ? true : false,
4073
- onChange: (e)=>setOperator(e.target.value),
4074
- labelClassName: "ds-u-margin-top--0 ds-u-visibility--screen-reader",
4075
- size: "small",
4076
- label: "Filter operator",
4077
- name: `filter_operator_${index}`,
4078
- 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"
4079
4707
  })
4080
- ]
4708
+ })
4081
4709
  }),
4082
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4083
- className: "ds-l-form-row",
4084
- children: [
4085
- property && (fields[property].mysql_type === "date" || fields[property].type === "date") ? /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4086
- className: "ds-u-clearfix ds-l-col--11",
4087
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
4088
- selected: $3535053b28e5ffce$var$convertUTCToLocalDate(startDate),
4089
- onChange: (date)=>{
4090
- setStartDate(date);
4091
- setValue(date.toJSON().slice(0, 10));
4092
- },
4093
- showMonthDropdown: true,
4094
- showYearDropdown: true,
4095
- dropdownMode: "select",
4096
- 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
+ ]
4097
4788
  })
4098
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
4099
- hint: operator.toLowerCase() === "in" ? `Separate values with a comma.` : "",
4100
- value: $3535053b28e5ffce$var$cleanText(value, operator),
4101
- disabled: !property ? true : false,
4102
- onChange: (e)=>setValue(e.target.value),
4103
- label: "Filter value",
4104
- labelClassName: "ds-u-margin-top--0",
4105
- name: `filter_value_${index}`,
4106
- className: "ds-l-col--11"
4107
- }),
4108
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4109
- className: "ds-l-col--1",
4110
- variation: "transparent",
4111
- "aria-label": "Remove filter",
4112
- onClick: (e)=>{
4113
- e.preventDefault();
4114
- remove(index);
4115
- },
4116
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $847b0964185837b2$export$2e2bcd8739ae039), {})
4117
- })
4118
- ]
4789
+ ]
4790
+ })
4119
4791
  })
4120
4792
  ]
4121
4793
  });
4122
4794
  };
4123
- var $3535053b28e5ffce$export$2e2bcd8739ae039 = $3535053b28e5ffce$var$ResourceConditionField;
4795
+ var $af099c546cb226c7$export$2e2bcd8739ae039 = $af099c546cb226c7$var$ResourceHeader;
4124
4796
 
4125
4797
 
4126
- const $f29607dfa784d2bd$var$ResourceFilter = ({ id: id , filterOpen: filterOpen , setFilterOpen: setFilterOpen , defaultCondition: defaultCondition , resource: resource , includeSearchParams: includeSearchParams })=>{
4127
- const { setConditions: setConditions , schema: schema , conditions: conditions } = resource;
4128
- const [formConditions, setFormConditions] = (0, $hgUW1$react).useState(conditions && conditions.length ? conditions : [
4129
- {
4130
- ...defaultCondition
4131
- }
4132
- ]);
4133
- (0, $hgUW1$react).useEffect(()=>{
4134
- if (includeSearchParams) {
4135
- const url = new URL(window.location);
4136
- const urlString = (0, $hgUW1$qs).stringify({
4137
- conditions: conditions
4138
- }, {
4139
- encodeValuesOnly: true,
4140
- addQueryPrefix: true
4141
- });
4142
- window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
4143
- }
4144
- }, [
4145
- conditions
4146
- ]);
4147
- function removeByIndex(index) {
4148
- let newConditions = [
4149
- ...formConditions
4150
- ];
4151
- newConditions.splice(index, 1);
4152
- setFormConditions(newConditions);
4153
- setConditions(newConditions);
4154
- }
4155
- function updateByIndex(index, key, value) {
4156
- let newConditions = [
4157
- ...formConditions
4158
- ];
4159
- newConditions[index][key] = value;
4160
- setFormConditions(newConditions);
4161
- }
4162
- function removeAll() {
4163
- setFormConditions([]);
4164
- setConditions([]);
4165
- }
4166
- function submitFilters(e) {
4167
- e.preventDefault();
4168
- if (formConditions.length) {
4169
- const updatedConditions = formConditions.filter((cond)=>{
4170
- if (cond.property) return cond;
4171
- return false;
4172
- }).map((cond)=>{
4173
- if (cond.operator === "=" || cond.operator === "<>") {
4174
- if (Array.isArray(cond.value)) cond.value = cond.value.join();
4175
- cond.value = cond.value.replace(/(^\%+|\%+$)/gm, "");
4176
- }
4177
- if (cond.operator.toLowerCase() === "like") {
4178
- if (Array.isArray(cond.value)) cond.value = cond.value.join();
4179
- const cleanedValue = cond.value.replace(/(^\%+|\%+$)/gm, "");
4180
- cond.value = `%${cleanedValue}%`;
4181
- }
4182
- if (cond.operator.toLowerCase() === "in") {
4183
- if (!Array.isArray(cond.value)) cond.value = cond.value.split(",");
4184
- }
4185
- if (Array.isArray(cond.value)) cond.value = cond.value.map((v)=>v.trim().replace(/(^\%+|\%+$)/gm, ""));
4186
- return cond;
4187
- });
4188
- setConditions(updatedConditions);
4189
- }
4190
- }
4191
- return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$HelpDrawer), {
4192
- footerTitle: "Update actions",
4193
- footerBody: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4194
- className: "ds-u-margin-right--1",
4195
- onClick: (e)=>submitFilters(e, formConditions),
4196
- children: "Update table"
4197
- }),
4198
- heading: "Add filters",
4199
- className: "dc-c-filterd-resouce-drawer",
4200
- onCloseClick: ()=>{
4201
- 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;
4202
4851
  },
4203
- children: [
4204
- /*#__PURE__*/ (0, $hgUW1$jsxs)("form", {
4205
- onSubmit: (e)=>submitFilters(e, formConditions),
4206
- children: [
4207
- Object.keys(schema).length && formConditions.map((f, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $3535053b28e5ffce$export$2e2bcd8739ae039), {
4208
- data: f,
4209
- index: index,
4210
- remove: removeByIndex,
4211
- schema: schema[id],
4212
- update: updateByIndex
4213
- }, index)),
4214
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4215
- className: "ds-u-margin-right--1",
4216
- variation: "ghost",
4217
- onClick: (e)=>{
4218
- e.preventDefault();
4219
- setFormConditions([
4220
- ...formConditions,
4221
- {
4222
- ...defaultCondition
4223
- }
4224
- ]);
4225
- },
4226
- children: "+ Add another filter"
4227
- })
4228
- ]
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
+ })
4229
4887
  }),
4230
- formConditions.length > 1 ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4231
- variation: "ghost",
4232
- onClick: (e)=>{
4233
- e.preventDefault();
4234
- removeAll();
4235
- },
4236
- children: "Remove all filters"
4237
- }) : ""
4238
- ]
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
+ })
4239
4895
  });
4240
4896
  };
4241
- $f29607dfa784d2bd$var$ResourceFilter.defaultProps = {
4242
- defaultCondition: {
4243
- property: "",
4244
- value: "",
4245
- operator: ""
4897
+ $626282d9a03c51d5$var$ResourcePreview.defaultProps = {
4898
+ options: {
4899
+ layout: "flex",
4900
+ columnFilter: false,
4901
+ columnSort: true,
4902
+ columnResize: true
4246
4903
  },
4247
- includeSearchParams: true
4904
+ truncateCellHeader: true,
4905
+ defaultSort: [],
4906
+ canResize: true
4248
4907
  };
4249
- var $f29607dfa784d2bd$export$2e2bcd8739ae039 = $f29607dfa784d2bd$var$ResourceFilter;
4908
+ var $626282d9a03c51d5$export$2e2bcd8739ae039 = $626282d9a03c51d5$var$ResourcePreview;
4909
+
4910
+
4250
4911
 
4251
4912
 
4252
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;
4253
4932
 
4254
4933
 
4255
4934
 
@@ -4326,7 +5005,6 @@ var $ec3e23baa005dc03$export$2e2bcd8739ae039 = $ec3e23baa005dc03$var$Breadcrumb;
4326
5005
 
4327
5006
 
4328
5007
 
4329
-
4330
5008
 
4331
5009
 
4332
5010
  function $374c4669b044ddf8$var$getStartDate(condition, schema, id) {
@@ -4397,7 +5075,7 @@ const $374c4669b044ddf8$var$QueryRow = ({ id: id , condition: condition , index:
4397
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"
4398
5076
  }),
4399
5077
  schema[id].fields[property].mysql_type === "date" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4400
- 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",
4401
5079
  children: [
4402
5080
  /*#__PURE__*/ (0, $hgUW1$jsx)("label", {
4403
5081
  className: "ds-c-label",
@@ -4443,72 +5121,6 @@ var $374c4669b044ddf8$export$2e2bcd8739ae039 = $374c4669b044ddf8$var$QueryRow;
4443
5121
 
4444
5122
 
4445
5123
 
4446
-
4447
- const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions , schema: schema , customColumns: customColumns })=>{
4448
- const { fields: fields } = schema;
4449
- if (!conditions.length) return "Add a filter";
4450
- function formatValue(text, property) {
4451
- if (customColumns.length > 0) {
4452
- let newValue = text;
4453
- let customColumn = customColumns.find((c)=>c.accessor === property);
4454
- if (customColumn && customColumn.cell) return customColumn.cell({
4455
- value: text
4456
- });
4457
- return text;
4458
- } else return text;
4459
- }
4460
- function buildTitle() {
4461
- const newTitle = conditions.map((c)=>{
4462
- const field = fields[c.property];
4463
- const description = field && field.description ? field.description : c.property;
4464
- const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
4465
- return `${description} ${operator.label} ${(0, $7264a673914aa746$export$6b5e57d20078142b)(c.value)}`;
4466
- });
4467
- return newTitle.join(" AND ");
4468
- }
4469
- return /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4470
- className: "dc-querybuilder-title",
4471
- children: conditions.map((c)=>{
4472
- const field = fields[c.property];
4473
- const description = field && field.description ? field.description : c.property;
4474
- const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
4475
- const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
4476
- const formattedText = formatValue(cleanedText, c.property);
4477
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
4478
- className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
4479
- children: [
4480
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4481
- className: "ds-u-font-weight--bold",
4482
- children: description
4483
- }),
4484
- " ",
4485
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4486
- className: "ds-u-font-weight--normal",
4487
- children: operator.label.toUpperCase()
4488
- }),
4489
- " ",
4490
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4491
- className: "ds-u-color--success",
4492
- children: formattedText
4493
- })
4494
- ]
4495
- });
4496
- }).reduce((prev, curr)=>[
4497
- prev,
4498
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
4499
- className: "ds-u-margin-x--1",
4500
- variation: "info",
4501
- children: "AND"
4502
- }),
4503
- curr
4504
- ])
4505
- });
4506
- };
4507
- var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
4508
-
4509
-
4510
-
4511
-
4512
5124
  function $3b6ca952e79f0695$var$updateQueryForDatastore(condition) {
4513
5125
  let cond = condition;
4514
5126
  delete cond.key;
@@ -4781,7 +5393,7 @@ var $dd6eb2b30d7ad75d$export$2e2bcd8739ae039 = $dd6eb2b30d7ad75d$var$FilteredRes
4781
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 })=>{
4782
5394
  const [ready, setReady] = (0, $hgUW1$useState)(false);
4783
5395
  const [error, setError] = (0, $hgUW1$useState)(false);
4784
- const { dataset: dataset } = (0, $68d79598b83f3382$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
5396
+ const { dataset: dataset } = (0, $b4aa9c66f2e86959$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
4785
5397
  const distIndex = dist_id === "data" ? 0 : dist_id;
4786
5398
  (0, $hgUW1$useEffect)(()=>{
4787
5399
  if (dataset.error) setError(true);
@@ -4892,5 +5504,5 @@ var $90fb213ab8eeb2e7$export$2e2bcd8739ae039 = $90fb213ab8eeb2e7$var$useScrollTo
4892
5504
 
4893
5505
 
4894
5506
 
4895
- 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};
4896
5508
  //# sourceMappingURL=main.js.map